2.0.2
This commit is contained in:
@@ -17732,12 +17732,13 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--el-bg-color-page: #F8F9FB ;
|
||||
--el-color-primary: #0072ef;
|
||||
--el-bg-color-page: #f8f9fb ;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
--el-color-primary: #409eff;
|
||||
--el-color-primary: #0072ef;
|
||||
--el-color-primary-light-3: #3375b9;
|
||||
--el-color-primary-light-5: #2a598a;
|
||||
--el-color-primary-light-7: #213d5b;
|
||||
@@ -17783,8 +17784,8 @@ html.dark {
|
||||
--el-box-shadow-light: 0px 0px 12px rgba(0, 0, 0, .72);
|
||||
--el-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, .72);
|
||||
--el-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, .72), 0px 12px 32px #000000, 0px 8px 16px -8px #000000;
|
||||
--el-bg-color-page: #303134;
|
||||
--el-bg-color: #37383C;
|
||||
--el-bg-color-page: #37383C;
|
||||
--el-bg-color: #303134;
|
||||
--el-bg-color-overlay: #3B3C3E;
|
||||
--el-text-color-primary: #FFFFFF;
|
||||
--el-text-color-regular: #C3C4C5;
|
||||
@@ -17792,11 +17793,11 @@ html.dark {
|
||||
--el-text-color-placeholder: #8B8C8D;
|
||||
--el-text-color-disabled: #67686B;
|
||||
--el-border-color-darker: #636466;
|
||||
--el-border-color-dark: #58585B;
|
||||
--el-border-color: #242527;
|
||||
--el-border-color-light: #414243;
|
||||
--el-border-color-lighter: #363637;
|
||||
--el-border-color-extra-light: #2B2B2C;
|
||||
--el-border-color-dark: #2c2f32;
|
||||
--el-border-color: rgba(0,0,0,0.25);
|
||||
--el-border-color-light: rgba(0,0,0,0.3);
|
||||
--el-border-color-lighter: rgba(0,0,0,0.25);
|
||||
--el-border-color-extra-light: rgba(0,0,0,0.35);
|
||||
--el-fill-color-darker: #424243;
|
||||
--el-fill-color-dark: #39393A;
|
||||
--el-fill-color: #303030;
|
||||
@@ -17807,7 +17808,38 @@ html.dark {
|
||||
--el-fill-color-blank1: #2C2D30;
|
||||
--el-mask-color: rgba(0, 0, 0, .8);
|
||||
--el-mask-color-extra-light: rgba(0, 0, 0, .3);
|
||||
--el-menu-text-color:var(--el-text-color-regular);
|
||||
--el-menu-hover-text-color:var(--el-text-color-primary);
|
||||
--el-menu-active-color:var(--el-text-color-primary);
|
||||
}
|
||||
html.dark .el-textarea, html.dark .el-textarea__inner, html.dark .el-input {
|
||||
--el-fill-color-blank: #2C2D30;
|
||||
}
|
||||
html.dark .el-button.is-text {
|
||||
--el-button-hover-text-color:var(--el-text-color-primary);
|
||||
--el-button-text-color:var(--el-text-color-regular);
|
||||
}
|
||||
html.dark .el-button.is-active {
|
||||
--el-button-active-bg-color:var(--el-color-primary-light-9);
|
||||
--el-button-text-color:var(--el-text-color-primary);
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
}
|
||||
html.dark .el-collapse {
|
||||
--el-collapse-header-bg-color:var(--el-bg-color);
|
||||
--el-collapse-content-bg-color:var(--el-bg-color);
|
||||
}
|
||||
html.dark .el-card {
|
||||
--el-card-bg-color:var(--el-bg-color);
|
||||
}
|
||||
html.dark ::-webkit-scrollbar-thumb {
|
||||
background-color: #57595E;
|
||||
}
|
||||
html.dark ::-webkit-scrollbar-thumb:hover {
|
||||
background: #6D6F75;
|
||||
}
|
||||
html.dark .el-text.el-text--primary {
|
||||
--el-text-color:var(--el-text-color-primary);
|
||||
}
|
||||
html.dark .el-dropdown-menu__item {
|
||||
--el-dropdown-menuItem-hover-color:var(--el-text-color-primary);
|
||||
}
|
||||
78
static/element/Element-Plus/ElementPlus.min.js
vendored
Normal file
78
static/element/Element-Plus/ElementPlus.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,3 +1,7 @@
|
||||
:root {
|
||||
--el-menu-base-level-padding:12px;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -18,7 +22,7 @@
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
background-color: #D8DADD;
|
||||
border-radius: 10px;
|
||||
-webkit-transition: all 0.2s ease-in-out;
|
||||
transition: all 0.2s ease-in-out;
|
||||
@@ -26,7 +30,7 @@
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
cursor: pointer;
|
||||
background-color: rgba(0, 0, 0, 0.3019607843);
|
||||
background: #C4C6CA;
|
||||
}
|
||||
|
||||
:-webkit-any(article, aside, nav, section) :-webkit-any(article, aside, nav, section) h1 {
|
||||
@@ -53,6 +57,22 @@
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.el-backtop {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.dzz-menu > li {
|
||||
margin-right: 8px !important;
|
||||
}
|
||||
|
||||
.el-menu-item.is-active {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.el-button.is-active {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
}
|
||||
@@ -130,6 +150,65 @@ html, body, #dzzoffice, .el-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.menu-hamburger {
|
||||
width: 20px;
|
||||
display: -webkit-inline-box;
|
||||
display: -ms-inline-flexbox;
|
||||
display: inline-flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
height: 40px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
.menu-hamburger > span {
|
||||
background-color: var(--el-text-color-primary);
|
||||
border-radius: 10px;
|
||||
height: 2px;
|
||||
margin: 2px 0;
|
||||
-webkit-transition: var(--el-transition-all);
|
||||
transition: var(--el-transition-all);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.menu-hamburger > span.hamburger-1 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.menu-hamburger > span.hamburger-3 {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.menu-hamburger.active .hamburger-1 {
|
||||
-webkit-transform-origin: bottom;
|
||||
transform-origin: bottom;
|
||||
-webkit-transform: rotate(45deg) translate(13px);
|
||||
transform: rotate(45deg) translate(13px);
|
||||
}
|
||||
|
||||
.menu-hamburger.active .hamburger-2 {
|
||||
-webkit-transform-origin: top;
|
||||
transform-origin: top;
|
||||
-webkit-transform: rotate(-45deg);
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.menu-hamburger.active .hamburger-3 {
|
||||
-webkit-transform-origin: bottom;
|
||||
transform-origin: bottom;
|
||||
width: 50%;
|
||||
-webkit-transform: translate(2px, -10px) rotate(45deg);
|
||||
transform: translate(2px, -10px) rotate(45deg);
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -150,6 +229,14 @@ html, body, #dzzoffice, .el-container {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.input-with-select .el-input-group__prepend {
|
||||
background-color: var(--el-fill-color-blank);
|
||||
}
|
||||
|
||||
.el-menu {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.el-tree {
|
||||
background: transparent;
|
||||
}
|
||||
@@ -207,6 +294,42 @@ html, body, #dzzoffice, .el-container {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
.avatar-uploader .avatar-uploader-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
.avatar-uploader .el-image {
|
||||
height: 150px;
|
||||
width: 100%;
|
||||
line-height: 150px;
|
||||
}
|
||||
.avatar-uploader .el-progress {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.right-toolbar {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
@@ -322,23 +445,6 @@ html, body, #dzzoffice, .el-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.page-left {
|
||||
position: relative;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
.page-left .el-menu {
|
||||
height: 100%;
|
||||
}
|
||||
.page-left .el-menu .el-menu-item:hover {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
.page-left .el-menu .el-menu-item.is-active {
|
||||
background-color: var(--el-menu-hover-bg-color);
|
||||
}
|
||||
.page-left .el-menu .el-menu-item.is-active .el-text {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.el-popper.isdropdown {
|
||||
--el-dropdown-menu-box-shadow: var(--el-box-shadow-light);
|
||||
--el-dropdown-menuItem-hover-fill: var(--el-color-primary-light-9);
|
||||
@@ -433,8 +539,23 @@ html, body, #dzzoffice, .el-container {
|
||||
--el-cascader-tag-background: var(--el-color-info-light-9);
|
||||
}
|
||||
|
||||
.page-left .el-menu {
|
||||
height: 100%;
|
||||
}
|
||||
.page-left .el-menu .el-menu-item:hover {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
.page-left .el-menu .el-menu-item.is-active {
|
||||
background-color: var(--el-menu-hover-bg-color);
|
||||
}
|
||||
.page-left .el-menu .el-menu-item.is-active .el-text {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.page-left {
|
||||
border-right: var(--el-border);
|
||||
position: relative;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
.page-left .left-main .el-menu {
|
||||
--el-menu-item-height: 34px;
|
||||
|
||||
@@ -212,62 +212,25 @@ body {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.p, .m {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.p {
|
||||
display: none;
|
||||
}
|
||||
.m {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.container {
|
||||
width: 750px;
|
||||
}
|
||||
.p {
|
||||
display: none;
|
||||
}
|
||||
.m {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.container {
|
||||
width: 970px;
|
||||
}
|
||||
.p {
|
||||
display: block;
|
||||
}
|
||||
.m {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
.container {
|
||||
width: 1170px;
|
||||
}
|
||||
.p {
|
||||
display: block;
|
||||
}
|
||||
.m {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1400px) {
|
||||
.container {
|
||||
width: 1370px;
|
||||
}
|
||||
.p {
|
||||
display: block;
|
||||
}
|
||||
.m {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.ucenter-header {
|
||||
position: relative;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 6000;
|
||||
background: var(--el-bg-color-page);
|
||||
}
|
||||
.Details-Iframe iframe {
|
||||
border: 0;
|
||||
@@ -16,6 +17,13 @@
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.image-wrapper .imagtablelayout .li-item:first-child {
|
||||
cursor: pointer;
|
||||
}
|
||||
.image-wrapper.ischecked .imagtablelayout {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.imagtablelayout {
|
||||
border-top: var(--el-border);
|
||||
border-bottom: var(--el-border);
|
||||
@@ -47,6 +55,9 @@
|
||||
width: 100%;
|
||||
left: 0;
|
||||
}
|
||||
.imagtablelayout.imagtable-content:hover {
|
||||
background: var(--el-fill-color-light);
|
||||
}
|
||||
.imagtablelayout.imagtable-content.tabeven {
|
||||
width: 50%;
|
||||
}
|
||||
@@ -161,6 +172,10 @@
|
||||
line-height: 25px;
|
||||
float: left;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
.imagtablelayout.imagtable-content.details .li-item.item-details .name:hover {
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.imagtablelayout.imagtable-content.details .li-item.item-details .message {
|
||||
width: 100%;
|
||||
@@ -194,14 +209,6 @@
|
||||
.imagtablelayout.imagtable-content.details .li-item.operation {
|
||||
width: auto;
|
||||
}
|
||||
.imagtablelayout.imagtable-content .last-btn {
|
||||
opacity: 0;
|
||||
-webkit-transition: var(--el-transition-fade);
|
||||
transition: var(--el-transition-fade);
|
||||
}
|
||||
.imagtablelayout.imagtable-content:hover .last-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.imagelayout {
|
||||
position: relative;
|
||||
@@ -218,12 +225,6 @@
|
||||
border: var(--el-border);
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
.imagelayout .image-wrapper.limit .image-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
.imagelayout .image-wrapper.limit .imagtablelayout {
|
||||
cursor: pointer;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
@@ -232,10 +233,6 @@
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item.image-item-imageList {
|
||||
padding: 0 44px;
|
||||
padding-top: 26px;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item.image-item-imageList .image-single {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
@@ -272,10 +269,6 @@
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item.image-item-imageList .message {
|
||||
text-align: center;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item.image-item-waterFall {
|
||||
padding: 0 4px;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item .collect-box {
|
||||
position: absolute;
|
||||
@@ -490,7 +483,7 @@
|
||||
padding: 0 4px;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item .message .name {
|
||||
max-height: 46px;
|
||||
max-height: 44px;
|
||||
width: 100%;
|
||||
word-break: break-all;
|
||||
display: -webkit-box;
|
||||
@@ -501,7 +494,7 @@
|
||||
font-size: var(--el-font-size-base);
|
||||
white-space: unset;
|
||||
text-align: center;
|
||||
line-height: 16px;
|
||||
line-height: 20px;
|
||||
color: var(--el-text-color-primary);
|
||||
padding-top: 4px;
|
||||
}
|
||||
@@ -511,7 +504,6 @@
|
||||
text-align: center;
|
||||
padding-top: 4px;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 20px;
|
||||
}
|
||||
.imagelayout .image-wrapper .image-item .message .other .el-rate {
|
||||
height: auto;
|
||||
@@ -523,12 +515,6 @@
|
||||
border-left-color: var(--el-button-divide-border-color);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.imagelayout .image-wrapper .image-item.image-item-imageList {
|
||||
padding: 0 10px;
|
||||
padding-top: 16px;
|
||||
}
|
||||
}
|
||||
.file-headers {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
|
||||
8
static/tagsinput/jquery.tagsinput.css
Normal file
8
static/tagsinput/jquery.tagsinput.css
Normal file
@@ -0,0 +1,8 @@
|
||||
div.tagsinput { border:1px solid #e1e1e1; background: #FFF; padding:3px 0 0 5px; max-width:300px;/*height:100px;*/ overflow-y: auto;}
|
||||
div.tagsinput.focus {border-color: #66afe9;}
|
||||
div.tagsinput span.tag { position:relative;border: 1px solid #d6e9c6; -moz-border-radius:2px; -webkit-border-radius:2px; display: block; float: left; padding: 3px 18px 3px 5px; text-decoration:none; background: #dff0d8; color: #638421; margin-right: 3px; margin-bottom:3px; font-size:13px;}
|
||||
div.tagsinput span.tag a { font-weight: bold; color: #3c763d; text-decoration:none; font-size: 11px;display: block;width: 12px;height: 13px;position: absolute;right: 3px;top: 4px;text-align:center;line-height:1em}
|
||||
div.tagsinput input { width:80px; margin:0px; font-family: helvetica; font-size: 13px; border:1px solid transparent; padding:3px 5px; background: transparent; color: #000; outline:0px; margin-right:3px; margin-bottom:3px; }
|
||||
div.tagsinput div { display:block; float: left; }
|
||||
.tags_clear { clear: both; width: 100%; height: 0px; }
|
||||
.not_valid {background: #FBD8DB !important; color: #90111A !important;}
|
||||
366
static/tagsinput/jquery.tagsinput.js
Normal file
366
static/tagsinput/jquery.tagsinput.js
Normal file
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
|
||||
jQuery Tags Input Plugin 1.3.3
|
||||
|
||||
Copyright (c) 2011 XOXCO, Inc
|
||||
|
||||
Documentation for this plugin lives here:
|
||||
http://xoxco.com/clickable/jquery-tags-input
|
||||
|
||||
Licensed under the MIT license:
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
ben@xoxco.com
|
||||
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var delimiter = new Array();
|
||||
var tags_callbacks = new Array();
|
||||
$.fn.doAutosize = function(o){
|
||||
var minWidth = $(this).data('minwidth'),
|
||||
maxWidth = $(this).data('maxwidth'),
|
||||
val = '',
|
||||
input = $(this),
|
||||
testSubject = $('#'+$(this).data('tester_id'));
|
||||
|
||||
if (val === (val = input.val())) {return;}
|
||||
|
||||
// Enter new content into testSubject
|
||||
var escaped = val.replace(/&/g, '&').replace(/\s/g,' ').replace(/</g, '<').replace(/>/g, '>');
|
||||
testSubject.html(escaped);
|
||||
// Calculate new width + whether to change
|
||||
var testerWidth = testSubject.width(),
|
||||
newWidth = (testerWidth + o.comfortZone) >= minWidth ? testerWidth + o.comfortZone : minWidth,
|
||||
currentWidth = input.width(),
|
||||
isValidWidthChange = (newWidth < currentWidth && newWidth >= minWidth)
|
||||
|| (newWidth > minWidth && newWidth < maxWidth);
|
||||
|
||||
// Animate width
|
||||
if (isValidWidthChange) {
|
||||
input.width(newWidth);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
$.fn.resetAutosize = function(options){
|
||||
// alert(JSON.stringify(options));
|
||||
var minWidth = $(this).data('minwidth') || options.minInputWidth || $(this).width(),
|
||||
maxWidth = $(this).data('maxwidth') || options.maxInputWidth || ($(this).closest('.tagsinput').width() - options.inputPadding),
|
||||
val = '',
|
||||
input = $(this),
|
||||
testSubject = $('<tester/>').css({
|
||||
position: 'absolute',
|
||||
top: -9999,
|
||||
left: -9999,
|
||||
width: 'auto',
|
||||
fontSize: input.css('fontSize'),
|
||||
fontFamily: input.css('fontFamily'),
|
||||
fontWeight: input.css('fontWeight'),
|
||||
letterSpacing: input.css('letterSpacing'),
|
||||
whiteSpace: 'nowrap'
|
||||
}),
|
||||
testerId = $(this).attr('id')+'_autosize_tester';
|
||||
if(! $('#'+testerId).length > 0){
|
||||
testSubject.attr('id', testerId);
|
||||
testSubject.appendTo('body');
|
||||
}
|
||||
|
||||
input.data('minwidth', minWidth);
|
||||
input.data('maxwidth', maxWidth);
|
||||
input.data('tester_id', testerId);
|
||||
input.css('width', minWidth);
|
||||
};
|
||||
|
||||
$.fn.addTag = function(value,options) {
|
||||
options = jQuery.extend({focus:false,callback:true},options);
|
||||
this.each(function() {
|
||||
var id = $(this).attr('id');
|
||||
|
||||
var tagslist = $(this).val().split(delimiter[id]);
|
||||
if (tagslist[0] == '') {
|
||||
tagslist = new Array();
|
||||
}
|
||||
|
||||
value = jQuery.trim(value);
|
||||
|
||||
if (options.unique) {
|
||||
var skipTag = $(this).tagExist(value);
|
||||
if(skipTag == true) {
|
||||
//Marks fake input as not_valid to let styling it
|
||||
$('#'+id+'_tag').addClass('not_valid');
|
||||
}
|
||||
} else {
|
||||
var skipTag = false;
|
||||
}
|
||||
|
||||
if (value !='' && skipTag != true) {
|
||||
$('<span>').addClass('tag').append(
|
||||
$('<span>').text(value),
|
||||
$('<a>', {
|
||||
href : '#',
|
||||
title : 'Removing tag',
|
||||
text : 'x'
|
||||
}).click(function () {
|
||||
return $('#' + id).removeTag(escape(value));
|
||||
})
|
||||
).insertBefore('#' + id + '_addTag');
|
||||
|
||||
tagslist.push(value);
|
||||
|
||||
$('#'+id+'_tag').val('');
|
||||
if (options.focus) {
|
||||
$('#'+id+'_tag').focus();
|
||||
} else {
|
||||
$('#'+id+'_tag').blur();
|
||||
}
|
||||
|
||||
$.fn.tagsInput.updateTagsField(this,tagslist);
|
||||
|
||||
if (options.callback && tags_callbacks[id] && tags_callbacks[id]['onAddTag']) {
|
||||
var f = tags_callbacks[id]['onAddTag'];
|
||||
f.call(this, value);
|
||||
}
|
||||
if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
|
||||
{
|
||||
var i = tagslist.length;
|
||||
var f = tags_callbacks[id]['onChange'];
|
||||
f.call(this, $(this), tagslist[i-1]);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
$.fn.removeTag = function(value) {
|
||||
value = unescape(value);
|
||||
this.each(function() {
|
||||
var id = $(this).attr('id');
|
||||
|
||||
var old = $(this).val().split(delimiter[id]);
|
||||
|
||||
$('#'+id+'_tagsinput .tag').remove();
|
||||
str = '';
|
||||
for (i=0; i< old.length; i++) {
|
||||
if (old[i]!=value) {
|
||||
str = str + delimiter[id] +old[i];
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.tagsInput.importTags(this,str);
|
||||
|
||||
if (tags_callbacks[id] && tags_callbacks[id]['onRemoveTag']) {
|
||||
var f = tags_callbacks[id]['onRemoveTag'];
|
||||
f.call(this, value);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
$.fn.tagExist = function(val) {
|
||||
var id = $(this).attr('id');
|
||||
var tagslist = $(this).val().split(delimiter[id]);
|
||||
return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not
|
||||
};
|
||||
|
||||
// clear all existing tags and import new ones from a string
|
||||
$.fn.importTags = function(str) {
|
||||
id = $(this).attr('id');
|
||||
$('#'+id+'_tagsinput .tag').remove();
|
||||
$.fn.tagsInput.importTags(this,str);
|
||||
}
|
||||
|
||||
$.fn.tagsInput = function(options) {
|
||||
var settings = jQuery.extend({
|
||||
interactive:true,
|
||||
defaultText:'add a tag',
|
||||
minChars:0,
|
||||
width:'300px',
|
||||
height:'100px',
|
||||
autocomplete: {selectFirst: false },
|
||||
'hide':true,
|
||||
'delimiter':',',
|
||||
'unique':true,
|
||||
removeWithBackspace:true,
|
||||
placeholderColor:'#666666',
|
||||
autosize: true,
|
||||
comfortZone: 20,
|
||||
inputPadding: 6*2
|
||||
},options);
|
||||
|
||||
this.each(function() {
|
||||
if (settings.hide) {
|
||||
$(this).hide();
|
||||
}
|
||||
var id = $(this).attr('id');
|
||||
if (!id || delimiter[$(this).attr('id')]) {
|
||||
id = $(this).attr('id', 'tags' + new Date().getTime()).attr('id');
|
||||
}
|
||||
|
||||
var data = jQuery.extend({
|
||||
pid:id,
|
||||
real_input: '#'+id,
|
||||
holder: '#'+id+'_tagsinput',
|
||||
input_wrapper: '#'+id+'_addTag',
|
||||
fake_input: '#'+id+'_tag'
|
||||
},settings);
|
||||
|
||||
delimiter[id] = data.delimiter;
|
||||
|
||||
if (settings.onAddTag || settings.onRemoveTag || settings.onChange) {
|
||||
tags_callbacks[id] = new Array();
|
||||
tags_callbacks[id]['onAddTag'] = settings.onAddTag;
|
||||
tags_callbacks[id]['onRemoveTag'] = settings.onRemoveTag;
|
||||
tags_callbacks[id]['onChange'] = settings.onChange;
|
||||
}
|
||||
|
||||
var markup = '<div id="'+id+'_tagsinput" class="tagsinput '+this.className+'"><div id="'+id+'_addTag">';
|
||||
|
||||
if (settings.interactive) {
|
||||
markup = markup + '<input id="'+id+'_tag" value="" data-default="'+settings.defaultText+'" />';
|
||||
}
|
||||
|
||||
markup = markup + '</div><div class="tags_clear"></div></div>';
|
||||
|
||||
$(markup).insertAfter(this);
|
||||
|
||||
$(data.holder).css('max-width',settings.width);
|
||||
$(data.holder).css('min-height',settings.height);
|
||||
//$(data.holder).css('height','100%');
|
||||
|
||||
if ($(data.real_input).val()!='') {
|
||||
$.fn.tagsInput.importTags($(data.real_input),$(data.real_input).val());
|
||||
}
|
||||
if (settings.interactive) {
|
||||
$(data.fake_input).val($(data.fake_input).attr('data-default'));
|
||||
$(data.fake_input).css('color',settings.placeholderColor);
|
||||
$(data.fake_input).resetAutosize(settings);
|
||||
|
||||
$(data.holder).bind('click',data,function(event) {
|
||||
$(event.data.fake_input).focus();
|
||||
});
|
||||
|
||||
$(data.fake_input).bind('focus',data,function(event) {
|
||||
if ($(event.data.fake_input).val()==$(event.data.fake_input).attr('data-default')) {
|
||||
$(event.data.fake_input).val('');
|
||||
}
|
||||
$(data.holder).addClass('focus');
|
||||
$(event.data.fake_input).css('color','#000000');
|
||||
});
|
||||
$(data.fake_input).on('blur',function(){
|
||||
$(data.holder).removeClass('focus');
|
||||
});
|
||||
if (settings.autocomplete_url != undefined) {
|
||||
autocomplete_options = {source: settings.autocomplete_url};
|
||||
for (attrname in settings.autocomplete) {
|
||||
autocomplete_options[attrname] = settings.autocomplete[attrname];
|
||||
}
|
||||
|
||||
if (jQuery.Autocompleter !== undefined) {
|
||||
$(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete);
|
||||
$(data.fake_input).bind('result',data,function(event,data,formatted) {
|
||||
if (data) {
|
||||
$('#'+id).addTag(data[0] + "",{focus:true,unique:(settings.unique)});
|
||||
}
|
||||
});
|
||||
}else if (jQuery.ui.autocomplete !== undefined) {
|
||||
$(data.fake_input).autocomplete(autocomplete_options);
|
||||
$(data.fake_input).bind('autocompleteselect',data,function(event,ui) {
|
||||
$(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}else if(settings.typeahead!=undefined){
|
||||
if(jQuery.fn.typeahead!=undefined){
|
||||
settings.typeahead.taginput=$('#'+id);
|
||||
if(settings.typeahead.itemSelected==undefined){
|
||||
settings.typeahead.itemSelected= function(el,val,text){
|
||||
$('#'+id).addTag(text,{focus:true,unique:(settings.unique)});
|
||||
}
|
||||
}
|
||||
$(data.fake_input).typeahead(settings.typeahead);
|
||||
}
|
||||
|
||||
} else {
|
||||
// if a user tabs out of the field, create a new tag
|
||||
// this is only available if autocomplete is not used.
|
||||
$(data.fake_input).bind('blur',data,function(event) {
|
||||
var d = $(this).attr('data-default');
|
||||
if ($(event.data.fake_input).val()!='' && $(event.data.fake_input).val()!=d) {
|
||||
if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
|
||||
$(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
|
||||
} else {
|
||||
$(event.data.fake_input).val($(event.data.fake_input).attr('data-default'));
|
||||
$(event.data.fake_input).css('color',settings.placeholderColor);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
// if user types a comma, create a new tag
|
||||
$(data.fake_input).bind('keypress',data,function(event) {
|
||||
if (event.which==event.data.delimiter.charCodeAt(0) || event.which==13 ) {
|
||||
event.preventDefault();
|
||||
if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
|
||||
$(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
|
||||
$(event.data.fake_input).resetAutosize(settings);
|
||||
return false;
|
||||
} else if (event.data.autosize) {
|
||||
$(event.data.fake_input).doAutosize(settings);
|
||||
|
||||
}
|
||||
});
|
||||
//Delete last tag on backspace
|
||||
data.removeWithBackspace && $(data.fake_input).bind('keydown', function(event)
|
||||
{
|
||||
if(event.keyCode == 8 && $(this).val() == '')
|
||||
{
|
||||
event.preventDefault();
|
||||
var last_tag = $(this).closest('.tagsinput').find('.tag:last').text();
|
||||
var id = $(this).attr('id').replace(/_tag$/, '');
|
||||
last_tag = last_tag.replace(/[\s]+x$/, '');
|
||||
$('#' + id).removeTag(escape(last_tag));
|
||||
$(this).trigger('focus');
|
||||
}
|
||||
});
|
||||
$(data.fake_input).blur();
|
||||
|
||||
//Removes the not_valid class when user changes the value of the fake input
|
||||
if(data.unique) {
|
||||
$(data.fake_input).keydown(function(event){
|
||||
if(event.keyCode == 8 || String.fromCharCode(event.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/)) {
|
||||
$(this).removeClass('not_valid');
|
||||
}
|
||||
});
|
||||
}
|
||||
} // if settings.interactive
|
||||
});
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.tagsInput.updateTagsField = function(obj,tagslist) {
|
||||
var id = $(obj).attr('id');
|
||||
$(obj).val(tagslist.join(delimiter[id])).trigger('change');
|
||||
};
|
||||
|
||||
$.fn.tagsInput.importTags = function(obj,val) {
|
||||
$(obj).val('');
|
||||
var id = $(obj).attr('id');
|
||||
var tags = val.split(delimiter[id]);
|
||||
for (i=0; i<tags.length; i++) {
|
||||
$(obj).addTag(tags[i],{focus:false,callback:false});
|
||||
}
|
||||
if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
|
||||
{
|
||||
var f = tags_callbacks[id]['onChange'];
|
||||
f.call(obj, obj, tags[i]);
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user