.
This commit is contained in:
243
root/res/zui/lib/array/zui.array.js
Normal file
243
root/res/zui/lib/array/zui.array.js
Normal file
@@ -0,0 +1,243 @@
|
||||
/*!
|
||||
* ZUI: 数组辅助方法 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: array.js
|
||||
* Array Polyfill.
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
// Some polyfills copy from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var STR_FUNCTION = 'function';
|
||||
|
||||
/**
|
||||
* Calls a function for each element in the array.
|
||||
*/
|
||||
if(!Array.prototype.forEach) {
|
||||
Array.prototype.forEach = function(fun /*, thisp*/ ) {
|
||||
var len = this.length;
|
||||
if(typeof fun != STR_FUNCTION)
|
||||
throw new TypeError();
|
||||
|
||||
var thisp = arguments[1];
|
||||
for(var i = 0; i < len; i++) {
|
||||
if(i in this) {
|
||||
fun.call(thisp, this[i], i, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge an object is an real array
|
||||
*/
|
||||
if(!Array.isArray) {
|
||||
Array.isArray = function(obj) {
|
||||
return Object.toString.call(obj) === '[object Array]';
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
|
||||
*/
|
||||
if(!Array.prototype.lastIndexOf) {
|
||||
Array.prototype.lastIndexOf = function(elt /*, from*/ ) {
|
||||
var len = this.length;
|
||||
|
||||
var from = Number(arguments[1]);
|
||||
if(isNaN(from)) {
|
||||
from = len - 1;
|
||||
} else {
|
||||
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
||||
if(from < 0)
|
||||
from += len;
|
||||
else if(from >= len)
|
||||
from = len - 1;
|
||||
}
|
||||
|
||||
for(; from > -1; from--) {
|
||||
if(from in this &&
|
||||
this[from] === elt)
|
||||
return from;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if every element in this array satisfies the provided testing function.
|
||||
*/
|
||||
if(!Array.prototype.every) {
|
||||
Array.prototype.every = function(fun /*, thisp*/ ) {
|
||||
var len = this.length;
|
||||
if(typeof fun != STR_FUNCTION)
|
||||
throw new TypeError();
|
||||
|
||||
var thisp = arguments[1];
|
||||
for(var i = 0; i < len; i++) {
|
||||
if(i in this &&
|
||||
!fun.call(thisp, this[i], i, this))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new array with all of the elements of this array for which the provided filtering function returns true.
|
||||
*/
|
||||
if(!Array.prototype.filter) {
|
||||
Array.prototype.filter = function(fun /*, thisp*/ ) {
|
||||
var len = this.length;
|
||||
if(typeof fun != STR_FUNCTION)
|
||||
throw new TypeError();
|
||||
|
||||
var res = [];
|
||||
var thisp = arguments[1];
|
||||
for(var i = 0; i < len; i++) {
|
||||
if(i in this) {
|
||||
var val = this[i]; // in case fun mutates this
|
||||
if(fun.call(thisp, val, i, this))
|
||||
res.push(val);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
|
||||
*/
|
||||
if(!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(elt /*, from*/ ) {
|
||||
var len = this.length;
|
||||
|
||||
var from = Number(arguments[1]) || 0;
|
||||
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
||||
if(from < 0)
|
||||
from += len;
|
||||
|
||||
for(; from < len; from++) {
|
||||
if(from in this &&
|
||||
this[from] === elt)
|
||||
return from;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new array with the results of calling a provided function on every element in this array.
|
||||
*/
|
||||
if(!Array.prototype.map) {
|
||||
Array.prototype.map = function(fun /*, thisp*/ ) {
|
||||
var len = this.length;
|
||||
if(typeof fun != STR_FUNCTION)
|
||||
throw new TypeError();
|
||||
|
||||
var res = new Array(len);
|
||||
var thisp = arguments[1];
|
||||
for(var i = 0; i < len; i++) {
|
||||
if(i in this)
|
||||
res[i] = fun.call(thisp, this[i], i, this);
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new array with the results match the condistions
|
||||
* @param {plain object or function} conditions
|
||||
* @param {array} result
|
||||
* @return {array}
|
||||
*/
|
||||
if(!Array.prototype.where) {
|
||||
Array.prototype.where = function(conditions, result) {
|
||||
result = result || [];
|
||||
var cdt, ok, objVal;
|
||||
this.forEach(function(val) {
|
||||
ok = true;
|
||||
for(var key in conditions) {
|
||||
cdt = conditions[key];
|
||||
if(typeof cdt === STR_FUNCTION) {
|
||||
ok = cdt(val);
|
||||
} else {
|
||||
objVal = val[key];
|
||||
ok = (objVal && objVal === cdt);
|
||||
}
|
||||
if(!ok) break;
|
||||
}
|
||||
if(ok) result.push(val);
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a object contains grouped result as object key
|
||||
* @param {string} key
|
||||
* @return {Object}
|
||||
*/
|
||||
if(!Array.prototype.groupBy) {
|
||||
Array.prototype.groupBy = function(key) {
|
||||
var result = {};
|
||||
this.forEach(function(val) {
|
||||
var keyName = val[key];
|
||||
if(!keyName) {
|
||||
keyName = 'unkown';
|
||||
}
|
||||
|
||||
if(!result[keyName]) {
|
||||
result[keyName] = [];
|
||||
}
|
||||
result[keyName].push(val);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if at least one element in this array satisfies the provided testing conditions.
|
||||
* @param {function or plain object} conditions
|
||||
* @return {Boolean}
|
||||
*/
|
||||
if(!Array.prototype.has) {
|
||||
Array.prototype.has = function(conditions) {
|
||||
var result = false,
|
||||
cdt, ok, objVal;
|
||||
this.forEach(function(val) {
|
||||
ok = true;
|
||||
for(var key in conditions) {
|
||||
cdt = conditions[key];
|
||||
if(typeof cdt === STR_FUNCTION) {
|
||||
ok = cdt(val);
|
||||
} else {
|
||||
objVal = val[key];
|
||||
ok = (objVal && objVal === cdt);
|
||||
}
|
||||
if(!ok) break;
|
||||
}
|
||||
if(ok) {
|
||||
result = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
}());
|
||||
7
root/res/zui/lib/array/zui.array.min.js
vendored
Normal file
7
root/res/zui/lib/array/zui.array.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 数组辅助方法 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
!function(){"use strict";var r="function";Array.prototype.forEach||(Array.prototype.forEach=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=arguments[1],i=0;i<o;i++)i in this&&t.call(e,this[i],i,this)}),Array.isArray||(Array.isArray=function(r){return"[object Array]"===Object.toString.call(r)}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(r){var t=this.length,o=Number(arguments[1]);for(isNaN(o)?o=t-1:(o=o<0?Math.ceil(o):Math.floor(o),o<0?o+=t:o>=t&&(o=t-1));o>-1;o--)if(o in this&&this[o]===r)return o;return-1}),Array.prototype.every||(Array.prototype.every=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=arguments[1],i=0;i<o;i++)if(i in this&&!t.call(e,this[i],i,this))return!1;return!0}),Array.prototype.filter||(Array.prototype.filter=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=[],i=arguments[1],n=0;n<o;n++)if(n in this){var a=this[n];t.call(i,a,n,this)&&e.push(a)}return e}),Array.prototype.indexOf||(Array.prototype.indexOf=function(r){var t=this.length,o=Number(arguments[1])||0;for(o=o<0?Math.ceil(o):Math.floor(o),o<0&&(o+=t);o<t;o++)if(o in this&&this[o]===r)return o;return-1}),Array.prototype.map||(Array.prototype.map=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=new Array(o),i=arguments[1],n=0;n<o;n++)n in this&&(e[n]=t.call(i,this[n],n,this));return e}),Array.prototype.where||(Array.prototype.where=function(t,o){o=o||[];var e,i,n;return this.forEach(function(a){i=!0;for(var y in t)if(e=t[y],typeof e===r?i=e(a):(n=a[y],i=n&&n===e),!i)break;i&&o.push(a)}),o}),Array.prototype.groupBy||(Array.prototype.groupBy=function(r){var t={};return this.forEach(function(o){var e=o[r];e||(e="unkown"),t[e]||(t[e]=[]),t[e].push(o)}),t}),Array.prototype.has||(Array.prototype.has=function(t){var o,e,i,n=!1;return this.forEach(function(a){e=!0;for(var y in t)if(o=t[y],typeof o===r?e=o(a):(i=a[y],e=i&&i===o),!e)break;if(e)return n=!0,!1}),n})}();
|
||||
104
root/res/zui/lib/board/zui.board.css
Normal file
104
root/res/zui/lib/board/zui.board.css
Normal file
@@ -0,0 +1,104 @@
|
||||
/*!
|
||||
* ZUI: 看板 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.board-item {
|
||||
padding: 6px 10px;
|
||||
margin-bottom: 5px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
|
||||
box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.board-item:hover {
|
||||
-webkit-box-shadow: 0 1px 1 rgba(0, 0, 0, .1);
|
||||
box-shadow: 0 1px 1 rgba(0, 0, 0, .1);
|
||||
}
|
||||
.board-item.board-item-empty {
|
||||
display: none;
|
||||
color: #808080;
|
||||
border-style: dashed;
|
||||
}
|
||||
.board-item.board-item-shadow {
|
||||
display: none;
|
||||
padding: 0;
|
||||
background: #ddd;
|
||||
border: none;
|
||||
border-color: #ddd;
|
||||
-webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, .1);
|
||||
box-shadow: inset 0 0 4px rgba(0, 0, 0, .1);
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.board-item.drag-shadow {
|
||||
width: 250px;
|
||||
cursor: move;
|
||||
background-color: #fff;
|
||||
border-color: #c4c4c4;
|
||||
-webkit-box-shadow: 1px 1px 15px rgba(0, 0, 0, .25);
|
||||
box-shadow: 1px 1px 15px rgba(0, 0, 0, .25);
|
||||
opacity: .9;
|
||||
}
|
||||
.board-item.drag-from {
|
||||
background-color: #ebf2f9;
|
||||
}
|
||||
.board-list .board-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.board {
|
||||
float: left;
|
||||
width: 250px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.board.drop-in-empty .board-item-empty {
|
||||
height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
border: transparent;
|
||||
}
|
||||
.board:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
.board > .panel-body {
|
||||
padding: 5px;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
.boards:before,
|
||||
.boards:after {
|
||||
/* 1 */
|
||||
display: table;
|
||||
content: " ";
|
||||
/* 2 */
|
||||
}
|
||||
.boards:after {
|
||||
clear: both;
|
||||
}
|
||||
.boards.dragging .board.drop-in {
|
||||
border-color: #c4c4c4;
|
||||
-webkit-box-shadow: 1px 1px 15px rgba(0, 0, 0, .25);
|
||||
box-shadow: 1px 1px 15px rgba(0, 0, 0, .25);
|
||||
}
|
||||
.boards.dragging .board.drop-in .board-item-shadow {
|
||||
display: block;
|
||||
}
|
||||
.boards.dragging .board .board-item.board-item-empty {
|
||||
display: block;
|
||||
}
|
||||
.boards.dragging .board-item.disable-drop {
|
||||
display: none;
|
||||
}
|
||||
.boards.drop-in .board-item.drag-from {
|
||||
height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
border: transparent;
|
||||
}
|
||||
128
root/res/zui/lib/board/zui.board.js
Normal file
128
root/res/zui/lib/board/zui.board.js
Normal file
@@ -0,0 +1,128 @@
|
||||
/*!
|
||||
* ZUI: 看板 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: boards.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
if(!$.fn.droppable) throw new Error('Droppable requires for boards');
|
||||
|
||||
var Boards = function(element, options) {
|
||||
this.$ = $(element);
|
||||
this.options = this.getOptions(options);
|
||||
|
||||
this.getLang();
|
||||
this.init();
|
||||
};
|
||||
|
||||
Boards.DEFAULTS = {
|
||||
// lang: null,
|
||||
langs: {
|
||||
'zh_cn': {
|
||||
append2end: '移动到末尾'
|
||||
},
|
||||
'zh_tw': {
|
||||
append2end: '移动到末尾'
|
||||
},
|
||||
'en': {
|
||||
append2end: 'Move to the end.'
|
||||
}
|
||||
}
|
||||
}; // default options
|
||||
|
||||
Boards.prototype.getOptions = function(options) {
|
||||
options = $.extend({lang: $.zui.clientLang()}, Boards.DEFAULTS, this.$.data(), options);
|
||||
return options;
|
||||
};
|
||||
|
||||
Boards.prototype.getLang = function() {
|
||||
var options = this.options;
|
||||
this.lang = options.langs[options.lang] || options.langs[Boards.DEFAULTS.lang];
|
||||
};
|
||||
|
||||
Boards.prototype.init = function() {
|
||||
var idSeed = 1;
|
||||
var lang = this.lang;
|
||||
this.$.find('.board-item:not(".disable-drop"), .board:not(".disable-drop")').each(function() {
|
||||
var $this = $(this);
|
||||
if($this.attr('id')) {
|
||||
$this.attr('data-id', $this.attr('id'));
|
||||
} else if(!$this.attr('data-id')) {
|
||||
$this.attr('data-id', 'board' + (idSeed++));
|
||||
}
|
||||
|
||||
if($this.hasClass('board')) {
|
||||
$this.find('.board-list').append('<div class="board-item board-item-empty"><i class="icon-plus"></i> {append2end}</div>'.format(lang))
|
||||
.append('<div class="board-item board-item-shadow"></div>'.format(lang));
|
||||
}
|
||||
});
|
||||
|
||||
this.bind();
|
||||
};
|
||||
|
||||
Boards.prototype.bind = function(items) {
|
||||
var $boards = this.$,
|
||||
setting = this.options;
|
||||
|
||||
$boards.droppable($.extend({
|
||||
before: setting.before,
|
||||
target: '.board-item:not(".disable-drop, .board-item-shadow")',
|
||||
flex: true,
|
||||
selector: '.board-item:not(".disable-drop, .board-item-shadow")',
|
||||
start: function(e) {
|
||||
$boards.addClass('dragging').find('.board-item-shadow').height(e.element.outerHeight());
|
||||
},
|
||||
drag: function(e) {
|
||||
$boards.find('.board.drop-in-empty').removeClass('drop-in-empty');
|
||||
if(e.isIn) {
|
||||
var board = e.target.closest('.board').addClass('drop-in');
|
||||
var shadow = board.find('.board-item-shadow');
|
||||
var target = e.target;
|
||||
|
||||
$boards.addClass('drop-in').find('.board.drop-in').not(board).removeClass('drop-in');
|
||||
|
||||
shadow.insertBefore(target);
|
||||
|
||||
board.toggleClass('drop-in-empty', target.hasClass('board-item-empty'));
|
||||
}
|
||||
},
|
||||
drop: function(e) {
|
||||
if(e.isNew) {
|
||||
var result;
|
||||
if($.isFunction(setting['drop'])) {
|
||||
result = setting['drop'](e);
|
||||
}
|
||||
if(result !== false) e.element.insertBefore(e.target);
|
||||
}
|
||||
},
|
||||
finish: function() {
|
||||
$boards.removeClass('dragging').removeClass('drop-in').find('.board.drop-in').removeClass('drop-in');
|
||||
}
|
||||
}, setting.droppable));
|
||||
};
|
||||
|
||||
$.fn.boards = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data('zui.boards');
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data('zui.boards', (data = new Boards(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.boards.Constructor = Boards;
|
||||
}(jQuery));
|
||||
6
root/res/zui/lib/board/zui.board.min.css
vendored
Normal file
6
root/res/zui/lib/board/zui.board.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 看板 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.board-item{padding:6px 10px;margin-bottom:5px;background:#fff;border:1px solid #ddd;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.05);box-shadow:0 1px 0 rgba(0,0,0,.05);-webkit-transition:all .4s cubic-bezier(.175,.885,.32,1);-o-transition:all .4s cubic-bezier(.175,.885,.32,1);transition:all .4s cubic-bezier(.175,.885,.32,1)}.board-item:hover{-webkit-box-shadow:0 1px 1 rgba(0,0,0,.1);box-shadow:0 1px 1 rgba(0,0,0,.1)}.board-item.board-item-empty{display:none;color:grey;border-style:dashed}.board-item.board-item-shadow{display:none;padding:0;background:#ddd;border:none;border-color:#ddd;-webkit-box-shadow:inset 0 0 4px rgba(0,0,0,.1);box-shadow:inset 0 0 4px rgba(0,0,0,.1);-webkit-transition:all .4s cubic-bezier(.175,.885,.32,1);-o-transition:all .4s cubic-bezier(.175,.885,.32,1);transition:all .4s cubic-bezier(.175,.885,.32,1)}.board-item.drag-shadow{width:250px;cursor:move;background-color:#fff;border-color:#c4c4c4;-webkit-box-shadow:1px 1px 15px rgba(0,0,0,.25);box-shadow:1px 1px 15px rgba(0,0,0,.25);opacity:.9}.board-item.drag-from{background-color:#ebf2f9}.board-list .board-item:last-child{margin-bottom:0}.board{float:left;width:250px;margin-right:10px}.board.drop-in-empty .board-item-empty{height:0;padding:0;margin:0;overflow:hidden;border:transparent}.board:last-child{margin-right:0}.board>.panel-body{padding:5px;background:#f1f1f1}.boards:after,.boards:before{display:table;content:" "}.boards:after{clear:both}.boards.dragging .board.drop-in{border-color:#c4c4c4;-webkit-box-shadow:1px 1px 15px rgba(0,0,0,.25);box-shadow:1px 1px 15px rgba(0,0,0,.25)}.boards.dragging .board.drop-in .board-item-shadow{display:block}.boards.dragging .board .board-item.board-item-empty{display:block}.boards.dragging .board-item.disable-drop{display:none}.boards.drop-in .board-item.drag-from{height:0;padding:0;margin:0;overflow:hidden;border:transparent}
|
||||
7
root/res/zui/lib/board/zui.board.min.js
vendored
Normal file
7
root/res/zui/lib/board/zui.board.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 看板 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
!function(t){"use strict";if(!t.fn.droppable)throw new Error("Droppable requires for boards");var o=function(o,a){this.$=t(o),this.options=this.getOptions(a),this.getLang(),this.init()};o.DEFAULTS={langs:{zh_cn:{append2end:"移动到末尾"},zh_tw:{append2end:"移动到末尾"},en:{append2end:"Move to the end."}}},o.prototype.getOptions=function(a){return a=t.extend({lang:t.zui.clientLang()},o.DEFAULTS,this.$.data(),a)},o.prototype.getLang=function(){var t=this.options;this.lang=t.langs[t.lang]||t.langs[o.DEFAULTS.lang]},o.prototype.init=function(){var o=1,a=this.lang;this.$.find('.board-item:not(".disable-drop"), .board:not(".disable-drop")').each(function(){var i=t(this);i.attr("id")?i.attr("data-id",i.attr("id")):i.attr("data-id")||i.attr("data-id","board"+o++),i.hasClass("board")&&i.find(".board-list").append('<div class="board-item board-item-empty"><i class="icon-plus"></i> {append2end}</div>'.format(a)).append('<div class="board-item board-item-shadow"></div>'.format(a))}),this.bind()},o.prototype.bind=function(o){var a=this.$,i=this.options;a.droppable(t.extend({before:i.before,target:'.board-item:not(".disable-drop, .board-item-shadow")',flex:!0,selector:'.board-item:not(".disable-drop, .board-item-shadow")',start:function(t){a.addClass("dragging").find(".board-item-shadow").height(t.element.outerHeight())},drag:function(t){if(a.find(".board.drop-in-empty").removeClass("drop-in-empty"),t.isIn){var o=t.target.closest(".board").addClass("drop-in"),i=o.find(".board-item-shadow"),e=t.target;a.addClass("drop-in").find(".board.drop-in").not(o).removeClass("drop-in"),i.insertBefore(e),o.toggleClass("drop-in-empty",e.hasClass("board-item-empty"))}},drop:function(o){if(o.isNew){var a;t.isFunction(i.drop)&&(a=i.drop(o)),a!==!1&&o.element.insertBefore(o.target)}},finish:function(){a.removeClass("dragging").removeClass("drop-in").find(".board.drop-in").removeClass("drop-in")}},i.droppable))},t.fn.boards=function(a){return this.each(function(){var i=t(this),e=i.data("zui.boards"),n="object"==typeof a&&a;e||i.data("zui.boards",e=new o(this,n)),"string"==typeof a&&e[a]()})},t.fn.boards.Constructor=o}(jQuery);
|
||||
3
root/res/zui/lib/bootbox/bootbox.css
Normal file
3
root/res/zui/lib/bootbox/bootbox.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.bootbox.modal .modal-dialog {
|
||||
width: 400px;
|
||||
}
|
||||
847
root/res/zui/lib/bootbox/bootbox.js
vendored
Normal file
847
root/res/zui/lib/bootbox/bootbox.js
vendored
Normal file
@@ -0,0 +1,847 @@
|
||||
/* ========================================================================
|
||||
* Bootbox: bootbox.js [v4.4.0]
|
||||
* http://bootboxjs.com/
|
||||
*
|
||||
* ZUI: The file has been changed in ZUI. It will not keep update with the
|
||||
* official version in the future.
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* http://bootboxjs.com/license.txt
|
||||
* Improvement in ZUI:
|
||||
* 1. Determine client language and apply setting automatically.
|
||||
* 2. Changed button position.
|
||||
* ======================================================================== */
|
||||
|
||||
/*! bootbox.js v4.4.0 http://bootboxjs.com/license.txt */
|
||||
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/180
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/186
|
||||
(function(root, factory) {
|
||||
|
||||
'use strict';
|
||||
if(typeof define === "function" && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(["jquery"], factory);
|
||||
} else if(typeof exports === "object") {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory(require("jquery"));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
root.bootbox = factory(root.jQuery);
|
||||
}
|
||||
|
||||
}(this, function init($, undefined) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// the base DOM structure needed to create a modal
|
||||
var templates = {
|
||||
dialog: "<div class='bootbox modal' tabindex='-1' role='dialog'>" +
|
||||
"<div class='modal-dialog'>" +
|
||||
"<div class='modal-content'>" +
|
||||
"<div class='modal-body'><div class='bootbox-body'></div></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>",
|
||||
header: "<div class='modal-header'>" +
|
||||
"<h4 class='modal-title'></h4>" +
|
||||
"</div>",
|
||||
footer: "<div class='modal-footer'></div>",
|
||||
closeButton: "<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>×</button>",
|
||||
form: "<form class='bootbox-form'></form>",
|
||||
inputs: {
|
||||
text: "<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",
|
||||
textarea: "<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",
|
||||
email: "<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",
|
||||
select: "<select class='bootbox-input bootbox-input-select form-control'></select>",
|
||||
checkbox: "<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",
|
||||
date: "<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",
|
||||
time: "<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",
|
||||
number: "<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",
|
||||
password: "<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"
|
||||
}
|
||||
};
|
||||
|
||||
var defaults = {
|
||||
// default language
|
||||
locale: $.zui && $.zui.clientLang ? $.zui.clientLang() : 'zh_cn',
|
||||
// show backdrop or not. Default to static so user has to interact with dialog
|
||||
backdrop: "static",
|
||||
// animate the modal in/out
|
||||
animate: true,
|
||||
// additional class string applied to the top level dialog
|
||||
className: null,
|
||||
// whether or not to include a close button
|
||||
closeButton: true,
|
||||
// show the dialog immediately by default
|
||||
show: true,
|
||||
// dialog container
|
||||
container: "body"
|
||||
};
|
||||
|
||||
// our public object; augmented after our private API
|
||||
var exports = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function _t(key) {
|
||||
var locale = locales[defaults.locale];
|
||||
return locale ? locale[key] : locales.en[key];
|
||||
}
|
||||
|
||||
function processCallback(e, dialog, callback) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
// by default we assume a callback will get rid of the dialog,
|
||||
// although it is given the opportunity to override this
|
||||
|
||||
// so, if the callback can be invoked and it *explicitly returns false*
|
||||
// then we'll set a flag to keep the dialog active...
|
||||
var preserveDialog = $.isFunction(callback) && callback.call(dialog, e) === false;
|
||||
|
||||
// ... otherwise we'll bin it
|
||||
if(!preserveDialog) {
|
||||
dialog.modal("hide");
|
||||
}
|
||||
}
|
||||
|
||||
function getKeyLength(obj) {
|
||||
// @TODO defer to Object.keys(x).length if available?
|
||||
var k, t = 0;
|
||||
for(k in obj) {
|
||||
t++;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
function each(collection, iterator) {
|
||||
var index = 0;
|
||||
$.each(collection, function(key, value) {
|
||||
iterator(key, value, index++);
|
||||
});
|
||||
}
|
||||
|
||||
function sanitize(options) {
|
||||
var buttons;
|
||||
var total;
|
||||
|
||||
if(typeof options !== "object") {
|
||||
throw new Error("Please supply an object of options");
|
||||
}
|
||||
|
||||
if(!options.message) {
|
||||
throw new Error("Please specify a message");
|
||||
}
|
||||
|
||||
// make sure any supplied options take precedence over defaults
|
||||
options = $.extend({}, defaults, options);
|
||||
|
||||
if(!options.buttons) {
|
||||
options.buttons = {};
|
||||
}
|
||||
|
||||
buttons = options.buttons;
|
||||
|
||||
total = getKeyLength(buttons);
|
||||
|
||||
each(buttons, function(key, button, index) {
|
||||
|
||||
if($.isFunction(button)) {
|
||||
// short form, assume value is our callback. Since button
|
||||
// isn't an object it isn't a reference either so re-assign it
|
||||
button = buttons[key] = {
|
||||
callback: button
|
||||
};
|
||||
}
|
||||
|
||||
// before any further checks make sure by now button is the correct type
|
||||
if($.type(button) !== "object") {
|
||||
throw new Error("button with key " + key + " must be an object");
|
||||
}
|
||||
|
||||
if(!button.label) {
|
||||
// the lack of an explicit label means we'll assume the key is good enough
|
||||
button.label = key;
|
||||
}
|
||||
|
||||
if(!button.className) {
|
||||
if((total === 2 && (key === 'ok' || key === 'confirm')) || total === 1) {
|
||||
// always add a primary to the main option in a two-button dialog
|
||||
button.className = "btn-primary";
|
||||
} else {
|
||||
button.className = "btn-default";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* map a flexible set of arguments into a single returned object
|
||||
* if args.length is already one just return it, otherwise
|
||||
* use the properties argument to map the unnamed args to
|
||||
* object properties
|
||||
* so in the latter case:
|
||||
* mapArguments(["foo", $.noop], ["message", "callback"])
|
||||
* -> { message: "foo", callback: $.noop }
|
||||
*/
|
||||
function mapArguments(args, properties) {
|
||||
var argn = args.length;
|
||||
var options = {};
|
||||
|
||||
if(argn < 1 || argn > 2) {
|
||||
throw new Error("Invalid argument length");
|
||||
}
|
||||
|
||||
if(argn === 2 || typeof args[0] === "string") {
|
||||
options[properties[0]] = args[0];
|
||||
options[properties[1]] = args[1];
|
||||
} else {
|
||||
options = args[0];
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* merge a set of default dialog options with user supplied arguments
|
||||
*/
|
||||
function mergeArguments(defaults, args, properties) {
|
||||
return $.extend(
|
||||
// deep merge
|
||||
true,
|
||||
// ensure the target is an empty, unreferenced object
|
||||
{},
|
||||
// the base options object for this type of dialog (often just buttons)
|
||||
defaults,
|
||||
// args could be an object or array; if it's an array properties will
|
||||
// map it to a proper options object
|
||||
mapArguments(
|
||||
args,
|
||||
properties
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* this entry-level method makes heavy use of composition to take a simple
|
||||
* range of inputs and return valid options suitable for passing to bootbox.dialog
|
||||
*/
|
||||
function mergeDialogOptions(className, labels, properties, args) {
|
||||
// build up a base set of dialog properties
|
||||
var baseOptions = {
|
||||
className: "bootbox-" + className,
|
||||
buttons: createLabels.apply(null, labels)
|
||||
};
|
||||
|
||||
// ensure the buttons properties generated, *after* merging
|
||||
// with user args are still valid against the supplied labels
|
||||
return validateButtons(
|
||||
// merge the generated base properties with user supplied arguments
|
||||
mergeArguments(
|
||||
baseOptions,
|
||||
args,
|
||||
// if args.length > 1, properties specify how each arg maps to an object key
|
||||
properties
|
||||
),
|
||||
labels
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* from a given list of arguments return a suitable object of button labels
|
||||
* all this does is normalise the given labels and translate them where possible
|
||||
* e.g. "ok", "confirm" -> { ok: "OK, cancel: "Annuleren" }
|
||||
*/
|
||||
function createLabels() {
|
||||
var buttons = {};
|
||||
|
||||
for(var i = 0, j = arguments.length; i < j; i++) {
|
||||
var argument = arguments[i];
|
||||
var key = argument.toLowerCase();
|
||||
var value = argument.toUpperCase();
|
||||
|
||||
buttons[key] = {
|
||||
label: _t(value)
|
||||
};
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
function validateButtons(options, buttons) {
|
||||
var allowedButtons = {};
|
||||
each(buttons, function(key, value) {
|
||||
allowedButtons[value] = true;
|
||||
});
|
||||
|
||||
each(options.buttons, function(key) {
|
||||
if(allowedButtons[key] === undefined) {
|
||||
throw new Error("button key " + key + " is not allowed (options are " + buttons.join("\n") + ")");
|
||||
}
|
||||
});
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
exports.alert = function() {
|
||||
var options;
|
||||
|
||||
options = mergeDialogOptions("alert", ["ok"], ["message", "callback"], arguments);
|
||||
|
||||
if(options.callback && !$.isFunction(options.callback)) {
|
||||
throw new Error("alert requires callback property to be a function when provided");
|
||||
}
|
||||
|
||||
/**
|
||||
* overrides
|
||||
*/
|
||||
options.buttons.ok.callback = options.onEscape = function() {
|
||||
if($.isFunction(options.callback)) {
|
||||
return options.callback.call(this);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
return exports.dialog(options);
|
||||
};
|
||||
|
||||
exports.confirm = function() {
|
||||
var options;
|
||||
|
||||
// ZUI change begin
|
||||
options = mergeDialogOptions("confirm", ["confirm", "cancel"], ["message", "callback"], arguments);
|
||||
// OLD WAY: options = mergeDialogOptions("confirm", ["cancel", "confirm"], ["message", "callback"], arguments);
|
||||
// ZUI change end
|
||||
|
||||
/**
|
||||
* overrides; undo anything the user tried to set they shouldn't have
|
||||
*/
|
||||
options.buttons.cancel.callback = options.onEscape = function() {
|
||||
return options.callback.call(this, false);
|
||||
};
|
||||
|
||||
options.buttons.confirm.callback = function() {
|
||||
return options.callback.call(this, true);
|
||||
};
|
||||
|
||||
// confirm specific validation
|
||||
if(!$.isFunction(options.callback)) {
|
||||
throw new Error("confirm requires a callback");
|
||||
}
|
||||
|
||||
return exports.dialog(options);
|
||||
};
|
||||
|
||||
exports.prompt = function() {
|
||||
var options;
|
||||
var defaults;
|
||||
var dialog;
|
||||
var form;
|
||||
var input;
|
||||
var shouldShow;
|
||||
var inputOptions;
|
||||
|
||||
// we have to create our form first otherwise
|
||||
// its value is undefined when gearing up our options
|
||||
// @TODO this could be solved by allowing message to
|
||||
// be a function instead...
|
||||
form = $(templates.form);
|
||||
|
||||
// prompt defaults are more complex than others in that
|
||||
// users can override more defaults
|
||||
// @TODO I don't like that prompt has to do a lot of heavy
|
||||
// lifting which mergeDialogOptions can *almost* support already
|
||||
// just because of 'value' and 'inputType' - can we refactor?
|
||||
defaults = {
|
||||
className: "bootbox-prompt",
|
||||
buttons: createLabels("cancel", "confirm"),
|
||||
value: "",
|
||||
inputType: "text"
|
||||
};
|
||||
|
||||
options = validateButtons(
|
||||
// ZUI change begin
|
||||
mergeArguments(defaults, arguments, ["title", "callback"]), ["confirm", "cancel"]
|
||||
// OLD WAY: mergeArguments(defaults, arguments, ["title", "callback"]), ["cancel", "confirm"]arguments);
|
||||
// ZUI change end
|
||||
);
|
||||
|
||||
// capture the user's show value; we always set this to false before
|
||||
// spawning the dialog to give us a chance to attach some handlers to
|
||||
// it, but we need to make sure we respect a preference not to show it
|
||||
shouldShow = (options.show === undefined) ? true : options.show;
|
||||
|
||||
/**
|
||||
* overrides; undo anything the user tried to set they shouldn't have
|
||||
*/
|
||||
options.message = form;
|
||||
|
||||
options.buttons.cancel.callback = options.onEscape = function() {
|
||||
return options.callback.call(this, null);
|
||||
};
|
||||
|
||||
options.buttons.confirm.callback = function() {
|
||||
var value;
|
||||
|
||||
switch(options.inputType) {
|
||||
case "text":
|
||||
case "textarea":
|
||||
case "email":
|
||||
case "select":
|
||||
case "date":
|
||||
case "time":
|
||||
case "number":
|
||||
case "password":
|
||||
value = input.val();
|
||||
break;
|
||||
|
||||
case "checkbox":
|
||||
var checkedItems = input.find("input:checked");
|
||||
|
||||
// we assume that checkboxes are always multiple,
|
||||
// hence we default to an empty array
|
||||
value = [];
|
||||
|
||||
each(checkedItems, function(_, item) {
|
||||
value.push($(item).val());
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
return options.callback.call(this, value);
|
||||
};
|
||||
|
||||
options.show = false;
|
||||
|
||||
// prompt specific validation
|
||||
if(!options.title) {
|
||||
throw new Error("prompt requires a title");
|
||||
}
|
||||
|
||||
if(!$.isFunction(options.callback)) {
|
||||
throw new Error("prompt requires a callback");
|
||||
}
|
||||
|
||||
if(!templates.inputs[options.inputType]) {
|
||||
throw new Error("invalid prompt type");
|
||||
}
|
||||
|
||||
// create the input based on the supplied type
|
||||
input = $(templates.inputs[options.inputType]);
|
||||
|
||||
switch(options.inputType) {
|
||||
case "text":
|
||||
case "textarea":
|
||||
case "email":
|
||||
case "date":
|
||||
case "time":
|
||||
case "number":
|
||||
case "password":
|
||||
input.val(options.value);
|
||||
break;
|
||||
|
||||
case "select":
|
||||
var groups = {};
|
||||
inputOptions = options.inputOptions || [];
|
||||
|
||||
if(!$.isArray(inputOptions)) {
|
||||
throw new Error("Please pass an array of input options");
|
||||
}
|
||||
|
||||
if(!inputOptions.length) {
|
||||
throw new Error("prompt with select requires options");
|
||||
}
|
||||
|
||||
each(inputOptions, function(_, option) {
|
||||
|
||||
// assume the element to attach to is the input...
|
||||
var elem = input;
|
||||
|
||||
if(option.value === undefined || option.text === undefined) {
|
||||
throw new Error("given options in wrong format");
|
||||
}
|
||||
|
||||
// ... but override that element if this option sits in a group
|
||||
|
||||
if(option.group) {
|
||||
// initialise group if necessary
|
||||
if(!groups[option.group]) {
|
||||
groups[option.group] = $("<optgroup/>").attr("label", option.group);
|
||||
}
|
||||
|
||||
elem = groups[option.group];
|
||||
}
|
||||
|
||||
elem.append("<option value='" + option.value + "'>" + option.text + "</option>");
|
||||
});
|
||||
|
||||
each(groups, function(_, group) {
|
||||
input.append(group);
|
||||
});
|
||||
|
||||
// safe to set a select's value as per a normal input
|
||||
input.val(options.value);
|
||||
break;
|
||||
|
||||
case "checkbox":
|
||||
var values = $.isArray(options.value) ? options.value : [options.value];
|
||||
inputOptions = options.inputOptions || [];
|
||||
|
||||
if(!inputOptions.length) {
|
||||
throw new Error("prompt with checkbox requires options");
|
||||
}
|
||||
|
||||
if(!inputOptions[0].value || !inputOptions[0].text) {
|
||||
throw new Error("given options in wrong format");
|
||||
}
|
||||
|
||||
// checkboxes have to nest within a containing element, so
|
||||
// they break the rules a bit and we end up re-assigning
|
||||
// our 'input' element to this container instead
|
||||
input = $("<div/>");
|
||||
|
||||
each(inputOptions, function(_, option) {
|
||||
var checkbox = $(templates.inputs[options.inputType]);
|
||||
|
||||
checkbox.find("input").attr("value", option.value);
|
||||
checkbox.find("label").append(option.text);
|
||||
|
||||
// we've ensured values is an array so we can always iterate over it
|
||||
each(values, function(_, value) {
|
||||
if(value === option.value) {
|
||||
checkbox.find("input").prop("checked", true);
|
||||
}
|
||||
});
|
||||
|
||||
input.append(checkbox);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
// @TODO provide an attributes option instead
|
||||
// and simply map that as keys: vals
|
||||
if(options.placeholder) {
|
||||
input.attr("placeholder", options.placeholder);
|
||||
}
|
||||
|
||||
if(options.pattern) {
|
||||
input.attr("pattern", options.pattern);
|
||||
}
|
||||
|
||||
if(options.maxlength) {
|
||||
input.attr("maxlength", options.maxlength);
|
||||
}
|
||||
|
||||
// now place it in our form
|
||||
form.append(input);
|
||||
|
||||
form.on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
// Fix for SammyJS (or similar JS routing library) hijacking the form post.
|
||||
e.stopPropagation();
|
||||
// @TODO can we actually click *the* button object instead?
|
||||
// e.g. buttons.confirm.click() or similar
|
||||
dialog.find(".btn-primary").click();
|
||||
});
|
||||
|
||||
dialog = exports.dialog(options);
|
||||
|
||||
// clear the existing handler focusing the submit button...
|
||||
dialog.off("shown.zui.modal");
|
||||
|
||||
// ...and replace it with one focusing our input, if possible
|
||||
dialog.on("shown.zui.modal", function() {
|
||||
// need the closure here since input isn't
|
||||
// an object otherwise
|
||||
input.focus();
|
||||
});
|
||||
|
||||
if(shouldShow === true) {
|
||||
dialog.modal("show");
|
||||
}
|
||||
|
||||
return dialog;
|
||||
};
|
||||
|
||||
exports.dialog = function(options) {
|
||||
options = sanitize(options);
|
||||
|
||||
|
||||
var dialog = $(templates.dialog);
|
||||
var innerDialog = dialog.find(".modal-dialog");
|
||||
var body = dialog.find(".modal-body");
|
||||
var buttons = options.buttons;
|
||||
var buttonStr = "";
|
||||
var callbacks = {
|
||||
onEscape: options.onEscape
|
||||
};
|
||||
|
||||
if($.fn.modal === undefined) {
|
||||
throw new Error(
|
||||
"$.fn.modal is not defined; please double check you have included " +
|
||||
"the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ " +
|
||||
"for more details."
|
||||
);
|
||||
}
|
||||
|
||||
each(buttons, function(key, button) {
|
||||
|
||||
// @TODO I don't like this string appending to itself; bit dirty. Needs reworking
|
||||
// can we just build up button elements instead? slower but neater. Then button
|
||||
// can just become a template too
|
||||
buttonStr += "<button data-bb-handler='" + key + "' type='button' class='btn " + button.className + "'>" + button.label + "</button>";
|
||||
callbacks[key] = button.callback;
|
||||
});
|
||||
|
||||
body.find(".bootbox-body").html(options.message);
|
||||
|
||||
if(options.animate === true) {
|
||||
dialog.addClass("fade");
|
||||
}
|
||||
|
||||
if(options.className) {
|
||||
dialog.addClass(options.className);
|
||||
}
|
||||
|
||||
if(options.size === "large") {
|
||||
innerDialog.addClass("modal-lg");
|
||||
} else if(options.size === "small") {
|
||||
innerDialog.addClass("modal-sm");
|
||||
}
|
||||
|
||||
if(options.title) {
|
||||
body.before(templates.header);
|
||||
}
|
||||
|
||||
if(options.closeButton) {
|
||||
var closeButton = $(templates.closeButton);
|
||||
|
||||
if(options.title) {
|
||||
dialog.find(".modal-header").prepend(closeButton);
|
||||
} else {
|
||||
closeButton.css("margin-top", "-10px").prependTo(body);
|
||||
}
|
||||
}
|
||||
|
||||
if(options.title) {
|
||||
dialog.find(".modal-title").html(options.title);
|
||||
}
|
||||
|
||||
if(buttonStr.length) {
|
||||
body.after(templates.footer);
|
||||
dialog.find(".modal-footer").html(buttonStr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap event listeners; used handle extra
|
||||
* setup & teardown required after the underlying
|
||||
* modal has performed certain actions
|
||||
*/
|
||||
|
||||
dialog.on("hidden.zui.modal", function(e) {
|
||||
// ensure we don't accidentally intercept hidden events triggered
|
||||
// by children of the current dialog. We shouldn't anymore now BS
|
||||
// namespaces its events; but still worth doing
|
||||
if(e.target === this) {
|
||||
dialog.remove();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
dialog.on("show.zui.modal", function() {
|
||||
// sadly this doesn't work; show is called *just* before
|
||||
// the backdrop is added so we'd need a setTimeout hack or
|
||||
// otherwise... leaving in as would be nice
|
||||
if (options.backdrop) {
|
||||
dialog.next(".modal-backdrop").addClass("bootbox-backdrop");
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
dialog.on("shown.zui.modal", function() {
|
||||
dialog.find(".btn-primary:first").focus();
|
||||
});
|
||||
|
||||
/**
|
||||
* Bootbox event listeners; experimental and may not last
|
||||
* just an attempt to decouple some behaviours from their
|
||||
* respective triggers
|
||||
*/
|
||||
|
||||
if(options.backdrop !== "static") {
|
||||
// A boolean true/false according to the Bootstrap docs
|
||||
// should show a dialog the user can dismiss by clicking on
|
||||
// the background.
|
||||
// We always only ever pass static/false to the actual
|
||||
// $.modal function because with `true` we can't trap
|
||||
// this event (the .modal-backdrop swallows it)
|
||||
// However, we still want to sort of respect true
|
||||
// and invoke the escape mechanism instead
|
||||
dialog.on("click.dismiss.zui.modal", function(e) {
|
||||
// @NOTE: the target varies in >= 3.3.x releases since the modal backdrop
|
||||
// moved *inside* the outer dialog rather than *alongside* it
|
||||
if(dialog.children(".modal-backdrop").length) {
|
||||
e.currentTarget = dialog.children(".modal-backdrop").get(0);
|
||||
}
|
||||
|
||||
if(e.target !== e.currentTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
dialog.trigger("escape.close.bb");
|
||||
});
|
||||
}
|
||||
|
||||
dialog.on("escape.close.bb", function(e) {
|
||||
if(callbacks.onEscape) {
|
||||
processCallback(e, dialog, callbacks.onEscape);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Standard jQuery event listeners; used to handle user
|
||||
* interaction with our dialog
|
||||
*/
|
||||
|
||||
dialog.on("click", ".modal-footer button", function(e) {
|
||||
var callbackKey = $(this).data("bb-handler");
|
||||
|
||||
processCallback(e, dialog, callbacks[callbackKey]);
|
||||
});
|
||||
|
||||
dialog.on("click", ".bootbox-close-button", function(e) {
|
||||
// onEscape might be falsy but that's fine; the fact is
|
||||
// if the user has managed to click the close button we
|
||||
// have to close the dialog, callback or not
|
||||
processCallback(e, dialog, callbacks.onEscape);
|
||||
});
|
||||
|
||||
dialog.on("keyup", function(e) {
|
||||
if(e.which === 27) {
|
||||
dialog.trigger("escape.close.bb");
|
||||
}
|
||||
});
|
||||
|
||||
// the remainder of this method simply deals with adding our
|
||||
// dialogent to the DOM, augmenting it with Bootstrap's modal
|
||||
// functionality and then giving the resulting object back
|
||||
// to our caller
|
||||
|
||||
$(options.container).append(dialog);
|
||||
|
||||
dialog.modal({
|
||||
backdrop: options.backdrop ? "static" : false,
|
||||
keyboard: false,
|
||||
show: false
|
||||
});
|
||||
|
||||
if(options.show) {
|
||||
dialog.modal("show");
|
||||
}
|
||||
|
||||
// @TODO should we return the raw element here or should
|
||||
// we wrap it in an object on which we can expose some neater
|
||||
// methods, e.g. var d = bootbox.alert(); d.hide(); instead
|
||||
// of d.modal("hide");
|
||||
|
||||
/*
|
||||
function BBDialog(elem) {
|
||||
this.elem = elem;
|
||||
}
|
||||
|
||||
BBDialog.prototype = {
|
||||
hide: function() {
|
||||
return this.elem.modal("hide");
|
||||
},
|
||||
show: function() {
|
||||
return this.elem.modal("show");
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
return dialog;
|
||||
|
||||
};
|
||||
|
||||
exports.setDefaults = function() {
|
||||
var values = {};
|
||||
|
||||
if(arguments.length === 2) {
|
||||
// allow passing of single key/value...
|
||||
values[arguments[0]] = arguments[1];
|
||||
} else {
|
||||
// ... and as an object too
|
||||
values = arguments[0];
|
||||
}
|
||||
|
||||
$.extend(defaults, values);
|
||||
};
|
||||
|
||||
exports.hideAll = function() {
|
||||
$(".bootbox").modal("hide");
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* standard locales. Please add more according to ISO 639-1 standard. Multiple language variants are
|
||||
* unlikely to be required. If this gets too large it can be split out into separate JS files.
|
||||
*/
|
||||
var locales = {
|
||||
en: {
|
||||
OK: "OK",
|
||||
CANCEL: "Cancel",
|
||||
CONFIRM: "OK"
|
||||
},
|
||||
zh_cn: {
|
||||
OK: "确认",
|
||||
CANCEL: "取消",
|
||||
CONFIRM: "确认"
|
||||
},
|
||||
zh_tw: {
|
||||
OK: "確認",
|
||||
CANCEL: "取消",
|
||||
CONFIRM: "確認"
|
||||
}
|
||||
};
|
||||
|
||||
exports.addLocale = function(name, values) {
|
||||
$.each(["OK", "CANCEL", "CONFIRM"], function(_, v) {
|
||||
if(!values[v]) {
|
||||
throw new Error("Please supply a translation for '" + v + "'");
|
||||
}
|
||||
});
|
||||
|
||||
locales[name] = {
|
||||
OK: values.OK,
|
||||
CANCEL: values.CANCEL,
|
||||
CONFIRM: values.CONFIRM
|
||||
};
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
exports.removeLocale = function(name) {
|
||||
delete locales[name];
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
exports.setLocale = function(name) {
|
||||
return exports.setDefaults("locale", name);
|
||||
};
|
||||
|
||||
exports.init = function(_$) {
|
||||
return init(_$ || $);
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
||||
1
root/res/zui/lib/bootbox/bootbox.min.css
vendored
Normal file
1
root/res/zui/lib/bootbox/bootbox.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.bootbox.modal .modal-dialog{width:400px}
|
||||
2
root/res/zui/lib/bootbox/bootbox.min.js
vendored
Normal file
2
root/res/zui/lib/bootbox/bootbox.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
156
root/res/zui/lib/calendar/zui.calendar.css
Normal file
156
root/res/zui/lib/calendar/zui.calendar.css
Normal file
@@ -0,0 +1,156 @@
|
||||
/*!
|
||||
* ZUI: 日历 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.calendar {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.calendar > header {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.calendar > header .btn-toolbar > .btn-group {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.calendar > header .calendar-caption {
|
||||
line-height: 30px;
|
||||
}
|
||||
.calendar .table {
|
||||
margin-bottom: 0;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.calendar .table > thead > tr > th,
|
||||
.calendar .table > tbody > tr > td {
|
||||
width: 14.28571428571429%;
|
||||
padding: 0;
|
||||
}
|
||||
.calendar .table > thead > tr > th {
|
||||
color: #808080;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
}
|
||||
.calendar .weekends-empty .table > thead > tr > th,
|
||||
.calendar .weekends-empty .table > tbody > tr > td {
|
||||
width: 20%;
|
||||
}
|
||||
.calendar .weekends-empty .table > thead > tr > th.weekend-head,
|
||||
.calendar .weekends-empty .table > tbody > tr > td.weekend-day {
|
||||
width: 40px;
|
||||
min-width: 40px;
|
||||
}
|
||||
.calendar .day {
|
||||
opacity: .7;
|
||||
}
|
||||
.calendar .day > .heading {
|
||||
padding: 2px 5px;
|
||||
text-align: right;
|
||||
}
|
||||
.calendar .day > .heading > .month {
|
||||
padding: 1px 2px;
|
||||
color: #fff;
|
||||
background-color: #b3b3b3;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.calendar .day > .content {
|
||||
height: 100%;
|
||||
min-height: 70px;
|
||||
}
|
||||
.calendar .cell-day {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
.calendar .cell-day.past > .day > .content {
|
||||
opacity: .7;
|
||||
}
|
||||
.calendar .cell-day.current-month {
|
||||
background: none;
|
||||
}
|
||||
.calendar .cell-day.current-month > .day {
|
||||
opacity: 1;
|
||||
}
|
||||
.calendar .cell-day.current {
|
||||
background-color: #fff0d5;
|
||||
-webkit-box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #808080;
|
||||
box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #808080;
|
||||
}
|
||||
.calendar .cell-day.current > .day > .content {
|
||||
padding: 0;
|
||||
}
|
||||
.calendar .cell-day.current > .day > .heading {
|
||||
background-color: rgba(0, 0, 0, .1);
|
||||
}
|
||||
.calendar .cell-day.drop-to {
|
||||
background-color: #fff0d5;
|
||||
opacity: 1;
|
||||
}
|
||||
.calendar .event {
|
||||
padding: 1px 5px;
|
||||
margin: 0 1px 1px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
background-color: #3280fc;
|
||||
opacity: .95;
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
a.calendar .event:hover {
|
||||
background-color: #0462f7;
|
||||
}
|
||||
.calendar .event:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.calendar .event.drag-shadow {
|
||||
cursor: move;
|
||||
}
|
||||
.calendar .event.drag-from {
|
||||
opacity: .25;
|
||||
}
|
||||
.calendar .event.color-red {
|
||||
color: #fff;
|
||||
background-color: #ea644a;
|
||||
}
|
||||
a.calendar .event.color-red:hover {
|
||||
background-color: #e53d1c;
|
||||
}
|
||||
.calendar .event.color-green {
|
||||
color: #fff;
|
||||
background-color: #38b03f;
|
||||
}
|
||||
a.calendar .event.color-green:hover {
|
||||
background-color: #2c8931;
|
||||
}
|
||||
.calendar .event.color-yellow {
|
||||
color: #fff;
|
||||
background-color: #f1a325;
|
||||
}
|
||||
a.calendar .event.color-yellow:hover {
|
||||
background-color: #d5890e;
|
||||
}
|
||||
.calendar .event.color-blue {
|
||||
color: #fff;
|
||||
background-color: #03b8cf;
|
||||
}
|
||||
a.calendar .event.color-blue:hover {
|
||||
background-color: #028b9d;
|
||||
}
|
||||
.calendar .event.color-brown {
|
||||
color: #fff;
|
||||
background-color: #bd7b46;
|
||||
}
|
||||
a.calendar .event.color-brown:hover {
|
||||
background-color: #996337;
|
||||
}
|
||||
.calendar .event.color-purple {
|
||||
color: #fff;
|
||||
background-color: #8666b8;
|
||||
}
|
||||
a.calendar .event.color-purple:hover {
|
||||
background-color: #6c4aa1;
|
||||
}
|
||||
.calendar.limit-event-title .event {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
705
root/res/zui/lib/calendar/zui.calendar.js
Normal file
705
root/res/zui/lib/calendar/zui.calendar.js
Normal file
@@ -0,0 +1,705 @@
|
||||
/*!
|
||||
* ZUI: 日历 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: calendar.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
(function($, window) {
|
||||
'use strict';
|
||||
var NAME = 'zui.calendar';
|
||||
var NUMBER_TYPE_NAME = 'number';
|
||||
var STRING_TYPE_NAME = 'string';
|
||||
var UNDEFINED_TYPE_NAME = 'undefined';
|
||||
var presetColors = {
|
||||
"primary": 1,
|
||||
"green": 2,
|
||||
"red": 3,
|
||||
"blue": 4,
|
||||
"yellow": 5,
|
||||
"brown": 6,
|
||||
"purple": 7
|
||||
};
|
||||
|
||||
var getNearbyLastWeekDay = function(date, lastWeek) {
|
||||
lastWeek = lastWeek || 1;
|
||||
|
||||
var d = date.clone();
|
||||
while(d.getDay() != lastWeek) {
|
||||
d.addDays(-1);
|
||||
}
|
||||
d.clearTime();
|
||||
return d;
|
||||
},
|
||||
|
||||
getFirstDayOfMonth = function(date) {
|
||||
var d = date.clone();
|
||||
d.setDate(1);
|
||||
return d;
|
||||
},
|
||||
|
||||
calculateDays = function(start, end) {
|
||||
var s = start.clone().clearTime();
|
||||
var e = end.clone().clearTime();
|
||||
return Math.round((e.getTime() - s.getTime()) / Date.ONEDAY_TICKS) + 1;
|
||||
},
|
||||
|
||||
everyDayTo = function(start, end, callback) {
|
||||
var a = start.clone();
|
||||
var i = 0;
|
||||
while(a <= end) {
|
||||
callback(a.clone(), i++);
|
||||
a.addDays(1);
|
||||
}
|
||||
};
|
||||
|
||||
var Calendar = function(element, options) {
|
||||
this.name = NAME;
|
||||
this.$ = $(element);
|
||||
this.id = this.$.attr('id') || (NAME + $.zui.uuid());
|
||||
this.$.attr('id', this.id);
|
||||
this.storeName = NAME + '.' + this.id;
|
||||
|
||||
this.getOptions(options);
|
||||
this.getLang();
|
||||
|
||||
this.data = this.options.data;
|
||||
this.addCalendars(this.data.calendars);
|
||||
this.addEvents(this.data.events);
|
||||
this.sortEvents();
|
||||
|
||||
this.storeData = $.zui.store.pageGet(this.storeName, {
|
||||
date: 'today',
|
||||
view: 'month'
|
||||
});
|
||||
|
||||
this.date = this.options.startDate || 'today';
|
||||
this.view = this.options.startView || 'month';
|
||||
|
||||
this.$.toggleClass('limit-event-title', options.limitEventTitle);
|
||||
|
||||
if(this.options.withHeader) {
|
||||
var $header = this.$.children('.calender-header');
|
||||
if(!$header.length) {
|
||||
$header = $('<header><div class="btn-toolbar"><div class="btn-group"><button type="button" class="btn btn-today">{today}</button></div><div class="btn-group"><button type="button" class="btn btn-prev"><i class="icon-chevron-left"></i></button><button type="button" class="btn btn-next"><i class="icon-chevron-right"></i></button></div><div class="btn-group"><span class="calendar-caption"></span></div></div></header>'.format(this.lang));
|
||||
this.$.append($header);
|
||||
}
|
||||
this.$caption = $header.find('.calendar-caption');
|
||||
this.$todayBtn = $header.find('.btn-today');
|
||||
this.$header = $header;
|
||||
}
|
||||
|
||||
var $views = this.$.children('.calendar-views');
|
||||
if(!$views.length) {
|
||||
$views = $('<div class="calendar-views"></div>');
|
||||
this.$.append($views);
|
||||
}
|
||||
this.$views = $views;
|
||||
this.$monthView = $views.children('.calendar-view.month');
|
||||
|
||||
this.display();
|
||||
|
||||
this.bindEvents();
|
||||
};
|
||||
|
||||
// default options
|
||||
Calendar.DEFAULTS = {
|
||||
langs: {
|
||||
zh_cn: {
|
||||
weekNames: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
||||
today: '今天',
|
||||
year: '{0}年',
|
||||
month: '{0}月',
|
||||
yearMonth: '{0}年{1}月'
|
||||
},
|
||||
zh_tw: {
|
||||
weekNames: ['週一', '週二', '週三', '週四', '週五', '週六', '週日'],
|
||||
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
||||
today: '今天',
|
||||
year: '{0}年',
|
||||
month: '{0}月',
|
||||
yearMonth: '{0}年{1}月'
|
||||
},
|
||||
en: {
|
||||
weekNames: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
today: 'Today',
|
||||
year: '{0}',
|
||||
month: '{0}',
|
||||
yearMonth: '{2}, {0}'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
calendars: {
|
||||
defaultCal: {
|
||||
color: '#229F24'
|
||||
}
|
||||
},
|
||||
events: []
|
||||
},
|
||||
// startView: "month", // default view when load complete
|
||||
// startDate: 'today', // default date when load complete
|
||||
limitEventTitle: true,
|
||||
storage: true,
|
||||
withHeader: true,
|
||||
dragThenDrop: true, // drag an event and drop at another day,
|
||||
// hideEmptyWeekends: false // Auto hide empty weekends
|
||||
};
|
||||
|
||||
// Sort events by start datetime
|
||||
Calendar.prototype.sortEvents = function() {
|
||||
var events = this.events;
|
||||
if(!$.isArray(events)) {
|
||||
events = [];
|
||||
}
|
||||
|
||||
events.sort(function(a, b) {
|
||||
return a.start < b.start ? 1 : (a.start > b.start ? (-1) : 0);
|
||||
});
|
||||
|
||||
this.events = events;
|
||||
};
|
||||
|
||||
Calendar.prototype.bindEvents = function() {
|
||||
var $e = this.$,
|
||||
self = this;
|
||||
|
||||
$e.on('click', '.btn-today', function() {
|
||||
self.date = new Date();
|
||||
self.display();
|
||||
self.callEvent('clickTodayBtn');
|
||||
}).on('click', '.btn-next', function() {
|
||||
if(self.view === 'month') {
|
||||
self.date.addMonths(1);
|
||||
}
|
||||
self.display();
|
||||
self.callEvent('clickNextBtn');
|
||||
}).on('click', '.btn-prev', function() {
|
||||
if(self.view === 'month') {
|
||||
self.date.addMonths(-1);
|
||||
}
|
||||
self.display();
|
||||
self.callEvent('clickPrevBtn');
|
||||
}).on('click', '.event', function(event) {
|
||||
self.callEvent('clickEvent', {
|
||||
element: this,
|
||||
event: $(this).data('event'),
|
||||
events: self.events
|
||||
});
|
||||
event.stopPropagation();
|
||||
}).on('click', '.cell-day', function() {
|
||||
self.callEvent('clickCell', {
|
||||
element: this,
|
||||
view: self.view,
|
||||
date: new Date($(this).children('.day').attr('data-date')),
|
||||
events: self.events
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Calendar.prototype.addCalendars = function(calendars, silence) {
|
||||
var that = this;
|
||||
if(!that.calendars) that.calendars = {};
|
||||
|
||||
if($.isPlainObject(calendars)) {
|
||||
calendars = [calendars];
|
||||
}
|
||||
$.each(calendars, function(index, cal) {
|
||||
if(!silence && !that.callEvent('beforeAddCalendars', {
|
||||
newCalendar: cal,
|
||||
data: that.data
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!cal.color) cal.color = 'primary';
|
||||
if(!presetColors[cal.color.toLowerCase()]) {
|
||||
var c = new $.zui.Color(cal.color);
|
||||
cal.textColor = c.contrast().hexStr();
|
||||
} else {
|
||||
cal.presetColor = true;
|
||||
}
|
||||
that.calendars[cal.name] = cal;
|
||||
});
|
||||
|
||||
if(!silence) {
|
||||
that.display();
|
||||
that.callEvent('addCalendars', {
|
||||
newCalendars: calendars,
|
||||
data: that.data
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Calendar.prototype.addEvents = function(events, silence) {
|
||||
var that = this;
|
||||
if(!that.events) that.events = [];
|
||||
|
||||
if($.isPlainObject(events)) {
|
||||
events = [events];
|
||||
}
|
||||
$.each(events, function(index, e) {
|
||||
if(!silence && !that.callEvent('beforeAddEvent', {
|
||||
newEvent: e,
|
||||
data: that.data
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
var startType = typeof e.start;
|
||||
var endType = typeof e.end;
|
||||
if(startType === NUMBER_TYPE_NAME || startType === STRING_TYPE_NAME) {
|
||||
e.start = new Date(e.start);
|
||||
}
|
||||
if(endType === NUMBER_TYPE_NAME || endType === STRING_TYPE_NAME) {
|
||||
e.end = new Date(e.end);
|
||||
}
|
||||
if(typeof e.id === UNDEFINED_TYPE_NAME) {
|
||||
e.id = $.zui.uuid();
|
||||
}
|
||||
|
||||
if(e.allDay) {
|
||||
e.start.clearTime();
|
||||
e.end.clearTime().addDays(1).addMilliseconds(-1);
|
||||
}
|
||||
|
||||
e.days = calculateDays(e.start, e.end);
|
||||
|
||||
that.events.push(e);
|
||||
});
|
||||
|
||||
if(!silence) {
|
||||
that.sortEvents();
|
||||
that.display();
|
||||
that.callEvent('addEvents', {
|
||||
newEvents: events,
|
||||
data: that.data
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Calendar.prototype.getEvent = function(id) {
|
||||
var events = this.events;
|
||||
for(var i = 0; i < events.length; i++) {
|
||||
if(events[i].id == id) {
|
||||
return events[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Calendar.prototype.updateEvents = function(events) {
|
||||
var eventsParams = {
|
||||
data: this.data,
|
||||
changes: []
|
||||
},
|
||||
that = this;
|
||||
|
||||
if($.isPlainObject(events)) {
|
||||
events = [events];
|
||||
}
|
||||
var event, chgs, eventParam;
|
||||
$.each(events, function(index, changes) {
|
||||
event = changes.event;
|
||||
chgs = changes.changes;
|
||||
eventParam = {
|
||||
event: event,
|
||||
changes: []
|
||||
};
|
||||
if(typeof event === STRING_TYPE_NAME) {
|
||||
event = that.getEvent(event);
|
||||
}
|
||||
if(event) {
|
||||
if($.isPlainObject(chgs)) {
|
||||
chgs = [chgs];
|
||||
}
|
||||
$.each(changes, function(idx, chge) {
|
||||
if(that.callEvent('beforeChange', {
|
||||
event: event,
|
||||
change: chge.change,
|
||||
to: chge.to,
|
||||
from: event[chge.change]
|
||||
})) {
|
||||
eventParam.changes.push($.extend(true, {}, chge, {
|
||||
from: event[chge.change]
|
||||
}));
|
||||
event[chge.change] = chge.to;
|
||||
}
|
||||
});
|
||||
}
|
||||
eventsParams.changes.push(eventParam);
|
||||
});
|
||||
|
||||
that.sortEvents();
|
||||
that.display();
|
||||
that.callEvent('change', eventsParams);
|
||||
};
|
||||
|
||||
Calendar.prototype.removeEvents = function(events) {
|
||||
if(!$.isArray(events)) {
|
||||
events = [events];
|
||||
}
|
||||
var id, event, idx, evts = this.events,
|
||||
that = this,
|
||||
removedEvents = [];
|
||||
$.each(events, function(index, value) {
|
||||
id = $.isPlainObject(value) ? value.id : value;
|
||||
idx = -1;
|
||||
for(var i = 0; i < evts.length; i++) {
|
||||
if(evts[i].id == id) {
|
||||
idx = i;
|
||||
event = evts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(idx >= 0 && that.callEvent('beforeRemoveEvent', {
|
||||
event: event,
|
||||
eventId: id,
|
||||
data: that.data
|
||||
})) {
|
||||
evts.splice(idx, 1);
|
||||
removedEvents.push(event);
|
||||
}
|
||||
});
|
||||
|
||||
that.sortEvents();
|
||||
that.display();
|
||||
that.callEvent('removeEvents', {
|
||||
removedEvents: removedEvents,
|
||||
data: that.data
|
||||
});
|
||||
};
|
||||
|
||||
Calendar.prototype.getOptions = function(options) {
|
||||
this.options = $.extend({}, Calendar.DEFAULTS, this.$.data(), options);
|
||||
};
|
||||
|
||||
Calendar.prototype.getLang = function() {
|
||||
this.lang = this.options.langs[this.options.lang || ($.zui && $.zui.clientLang ? $.zui.clientLang() : 'zh-cn')];
|
||||
};
|
||||
|
||||
Calendar.prototype.display = function(view, date) {
|
||||
var that = this;
|
||||
var viewType = typeof view;
|
||||
var dateType = typeof date;
|
||||
|
||||
if(viewType === UNDEFINED_TYPE_NAME) {
|
||||
view = that.view;
|
||||
} else {
|
||||
that.view = view;
|
||||
}
|
||||
|
||||
if(dateType === UNDEFINED_TYPE_NAME) {
|
||||
date = that.date;
|
||||
} else {
|
||||
that.date = date;
|
||||
}
|
||||
|
||||
if(date === 'today') {
|
||||
date = new Date();
|
||||
that.date = date;
|
||||
}
|
||||
|
||||
if(typeof date === STRING_TYPE_NAME) {
|
||||
date = new Date(date);
|
||||
that.date = date;
|
||||
}
|
||||
|
||||
if(that.options.storage) {
|
||||
$.zui.store.pageSet(that.storeName, {
|
||||
date: date,
|
||||
view: view
|
||||
});
|
||||
}
|
||||
|
||||
var eventPramas = {
|
||||
view: view,
|
||||
date: date
|
||||
};
|
||||
if(that.callEvent('beforeDisplay', eventPramas)) {
|
||||
switch(view) {
|
||||
case 'month':
|
||||
that.displayMonth(date);
|
||||
break;
|
||||
}
|
||||
|
||||
that.callEvent('display', eventPramas);
|
||||
}
|
||||
};
|
||||
|
||||
Calendar.prototype.displayMonth = function(date) {
|
||||
var that = this;
|
||||
date = date || that.date;
|
||||
var options = that.options,
|
||||
lang = that.lang,
|
||||
i,
|
||||
$views = that.$views,
|
||||
$e = that.$;
|
||||
|
||||
var $view = that.$monthView;
|
||||
if(!$view.length) {
|
||||
$view = $('<div class="calendar-view month"><table class="table table-bordered"><thead><tr class="week-head"></tr></thead><tbody class="month-days"></tbody></table></div>');
|
||||
|
||||
var $weekHead = $view.find('.week-head'),
|
||||
$monthDays = $view.find('.month-days'),
|
||||
$tr;
|
||||
|
||||
for(i = 0; i < 7; i++) {
|
||||
$('<th>' + lang.weekNames[i] + '</th>').toggleClass('weekend-head', i >= 5).appendTo($weekHead);
|
||||
}
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
$tr = $('<tr class="week-days"></tr>');
|
||||
for(var j = 0; j < 7; j++) {
|
||||
$('<td class="cell-day"><div class="day"><div class="heading"><span class="month"></span> <span class="number"></span></div><div class="content"><div class="events"></div></div></div></td>').toggleClass('weekend-day', j >= 5).appendTo($tr);
|
||||
}
|
||||
$monthDays.append($tr);
|
||||
}
|
||||
|
||||
$views.append($view);
|
||||
that.$monthView = $view;
|
||||
}
|
||||
|
||||
var $weeks = $view.find('.week-days'),
|
||||
$days = $view.find('.day'),
|
||||
firstDayOfMonth = getFirstDayOfMonth(date),
|
||||
// lastDayOfMonth = getLastDayOfMonth(date),
|
||||
$week,
|
||||
$day,
|
||||
$cell,
|
||||
year,
|
||||
day,
|
||||
month,
|
||||
today = new Date();
|
||||
var firstDay = getNearbyLastWeekDay(firstDayOfMonth),
|
||||
thisYear = date.getFullYear(),
|
||||
thisMonth = date.getMonth(),
|
||||
todayMonth = today.getMonth(),
|
||||
todayYear = today.getFullYear(),
|
||||
todayDate = today.getDate();
|
||||
var lastDay = firstDay.clone().addDays(6 * 7).addMilliseconds(-1),
|
||||
printDate = firstDay.clone().addDays(1).addMilliseconds(-1);
|
||||
var events = that.getEvents(firstDay, lastDay),
|
||||
calendars = that.calendars,
|
||||
printDateId, isFirstDayOfWeek, $event, cal, $dayEvents;
|
||||
|
||||
var isEmptyWeekends = true;
|
||||
$weeks.each(function(weekIdx) {
|
||||
$week = $(this);
|
||||
$week.find('.day').each(function(dayIndex) {
|
||||
isFirstDayOfWeek = dayIndex === 0;
|
||||
$day = $(this);
|
||||
$cell = $day.closest('.cell-day');
|
||||
year = printDate.getFullYear();
|
||||
day = printDate.getDate();
|
||||
month = printDate.getMonth();
|
||||
printDateId = printDate.toDateString();
|
||||
$day.attr('data-date', printDateId);
|
||||
$day.find('.heading > .number').text(day);
|
||||
|
||||
$day.find('.heading > .month')
|
||||
.toggle((weekIdx === 0 && dayIndex === 0) || day === 1)
|
||||
.text(((month === 0 && day === 1) ? (lang.year.format(year) + ' ') : '') + lang.monthNames[month]);
|
||||
$cell.toggleClass('current-month', month === thisMonth);
|
||||
$cell.toggleClass('current', (day === todayDate && month === todayMonth && year === todayYear));
|
||||
$cell.toggleClass('past', printDate < today);
|
||||
$cell.toggleClass('future', printDate > today);
|
||||
$dayEvents = $day.find('.events').empty();
|
||||
|
||||
var dayEvents = events[printDateId];
|
||||
if(dayEvents) {
|
||||
var eventsMap = dayEvents.events,
|
||||
stripCount = 0,
|
||||
e;
|
||||
for(i = 0; i <= dayEvents.maxPos; ++i) {
|
||||
e = eventsMap[i];
|
||||
if(!e || (e.placeholder && !isFirstDayOfWeek)) {
|
||||
stripCount++;
|
||||
continue;
|
||||
}
|
||||
if (isEmptyWeekends && dayIndex >= 5) {
|
||||
isEmptyWeekends = false;
|
||||
}
|
||||
$event = $('<div data-id="' + e.id + '" class="event" title="' + e.desc + '"><span class="time">' + e.start.format('hh:mm') + '</span> <span class="title">' + e.title + '</span></div>');
|
||||
$event.find('.time').toggle(!e.allDay);
|
||||
$event.data('event', e);
|
||||
$event.attr('data-days', e.days);
|
||||
|
||||
if(e.calendar) {
|
||||
cal = calendars[e.calendar];
|
||||
if(cal) {
|
||||
if(cal.presetColor) {
|
||||
$event.addClass('color-' + cal.color);
|
||||
} else {
|
||||
$event.css({
|
||||
'background-color': cal.color,
|
||||
color: cal.textColor
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(e.days) {
|
||||
if(!e.placeholder) {
|
||||
$event.css('width', Math.min(7 - dayIndex, e.days) + '00%');
|
||||
} else if(isFirstDayOfWeek) {
|
||||
$event.css('width', Math.min(7, e.days - e.holderPos) + '00%');
|
||||
}
|
||||
}
|
||||
|
||||
if(stripCount > 0) {
|
||||
$event.css('margin-top', stripCount * 22);
|
||||
stripCount = 0;
|
||||
}
|
||||
|
||||
$dayEvents.append($event);
|
||||
}
|
||||
}
|
||||
|
||||
printDate.addDays(1);
|
||||
});
|
||||
});
|
||||
if (options.hideEmptyWeekends) {
|
||||
$view.toggleClass('weekends-empty', isEmptyWeekends);
|
||||
}
|
||||
|
||||
if(options.withHeader) {
|
||||
that.$caption.text(lang.yearMonth.format(thisYear, thisMonth + 1, lang.monthNames[thisMonth]));
|
||||
that.$todayBtn.toggleClass('disabled', thisMonth === todayMonth && thisYear === todayYear);
|
||||
}
|
||||
|
||||
if(options.dragThenDrop) {
|
||||
if(!$.fn.droppable) {
|
||||
return console.error('Calendar dragThenDrop option requires droppable.js');
|
||||
}
|
||||
if(!$view.data('zui.droppable')) {
|
||||
$view.droppable($.extend({
|
||||
target: '.cell-day',
|
||||
selector: '.event',
|
||||
flex: true,
|
||||
start: function() {
|
||||
that.$.addClass('event-dragging');
|
||||
},
|
||||
drop: function(e) {
|
||||
var et = e.element.data('event'),
|
||||
newDate = e.target.children('.day').attr('data-date');
|
||||
if(!et || !newDate) return;
|
||||
var startDate = et.start.clone();
|
||||
if(startDate.toDateString() != newDate) {
|
||||
newDate = new Date(newDate);
|
||||
newDate.setHours(startDate.getHours());
|
||||
newDate.setMinutes(startDate.getMinutes());
|
||||
newDate.setSeconds(startDate.getSeconds());
|
||||
|
||||
if(that.callEvent('beforeChange', {
|
||||
event: et,
|
||||
change: 'start',
|
||||
to: newDate
|
||||
})) {
|
||||
var oldEnd = et.end.clone();
|
||||
|
||||
et.end.addMilliseconds(et.end.getTime() - startDate.getTime());
|
||||
et.start = newDate;
|
||||
|
||||
that.display();
|
||||
|
||||
that.callEvent('change', {
|
||||
data: that.data,
|
||||
changes: [{
|
||||
event: et,
|
||||
changes: [{
|
||||
change: 'start',
|
||||
from: startDate,
|
||||
to: et.start
|
||||
}, {
|
||||
change: 'end',
|
||||
from: oldEnd,
|
||||
to: et.end
|
||||
}]
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
finish: function() {
|
||||
that.$.removeClass('event-dragging');
|
||||
}
|
||||
}, ($.isPlainObject(options.dragThenDrop)) ? options.dragThenDrop : null));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Calendar.prototype.getEvents = function(start, end) {
|
||||
var events = {};
|
||||
var calendars = this.calendars;
|
||||
var addEventToDay = function(day, event, position) {
|
||||
var dayId = day.toDateString();
|
||||
var dayEvents = events[dayId];
|
||||
if(!dayEvents) {
|
||||
dayEvents = {
|
||||
maxPos: -1,
|
||||
events: {}
|
||||
};
|
||||
}
|
||||
|
||||
if(typeof position === 'undefined') {
|
||||
for(var i = 0; i < 100; ++i) {
|
||||
if(!dayEvents.events[i]) {
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dayEvents.maxPos = Math.max(position, dayEvents.maxPos);
|
||||
dayEvents.events[position] = event;
|
||||
events[dayId] = dayEvents;
|
||||
return position;
|
||||
};
|
||||
$.each(this.events, function(index, e) {
|
||||
if(e.start >= start && e.start <= end) {
|
||||
var position = addEventToDay(e.start, e);
|
||||
if(e.days > 1) {
|
||||
var placeholder = $.extend({
|
||||
placeholder: true
|
||||
}, e);
|
||||
everyDayTo(e.start.clone().addDays(1), e.end, function(thisDay, i) {
|
||||
addEventToDay(thisDay.clone(), $.extend({
|
||||
holderPos: i
|
||||
}, placeholder), position);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return events;
|
||||
};
|
||||
|
||||
Calendar.prototype.callEvent = function(name, params) {
|
||||
var result = this.$.callEvent(name + '.' + NAME, params, this);
|
||||
return !(result.result !== undefined && (!result.result));
|
||||
};
|
||||
|
||||
$.fn.calendar = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(NAME);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(NAME, (data = new Calendar(this, options)));
|
||||
|
||||
if(typeof option == STRING_TYPE_NAME) data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.calendar.Constructor = Calendar;
|
||||
}(jQuery, window));
|
||||
|
||||
6
root/res/zui/lib/calendar/zui.calendar.min.css
vendored
Normal file
6
root/res/zui/lib/calendar/zui.calendar.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 日历 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.calendar{margin-bottom:20px}.calendar>header{margin-bottom:10px}.calendar>header .btn-toolbar>.btn-group{margin-right:10px}.calendar>header .calendar-caption{line-height:30px}.calendar .table{margin-bottom:0;table-layout:fixed}.calendar .table>tbody>tr>td,.calendar .table>thead>tr>th{width:14.28571428571429%;padding:0}.calendar .table>thead>tr>th{color:grey;text-align:center;background-color:#fff}.calendar .weekends-empty .table>tbody>tr>td,.calendar .weekends-empty .table>thead>tr>th{width:20%}.calendar .weekends-empty .table>tbody>tr>td.weekend-day,.calendar .weekends-empty .table>thead>tr>th.weekend-head{width:40px;min-width:40px}.calendar .day{opacity:.7}.calendar .day>.heading{padding:2px 5px;text-align:right}.calendar .day>.heading>.month{padding:1px 2px;color:#fff;background-color:#b3b3b3;border-radius:3px}.calendar .day>.content{height:100%;min-height:70px}.calendar .cell-day{background-color:#f1f1f1}.calendar .cell-day.past>.day>.content{opacity:.7}.calendar .cell-day.current-month{background:0 0}.calendar .cell-day.current-month>.day{opacity:1}.calendar .cell-day.current{background-color:#fff0d5;-webkit-box-shadow:inset 1px 1px 0 grey,inset -1px -1px 0 grey;box-shadow:inset 1px 1px 0 grey,inset -1px -1px 0 grey}.calendar .cell-day.current>.day>.content{padding:0}.calendar .cell-day.current>.day>.heading{background-color:rgba(0,0,0,.1)}.calendar .cell-day.drop-to{background-color:#fff0d5;opacity:1}.calendar .event{padding:1px 5px;margin:0 1px 1px;color:#fff;cursor:pointer;background-color:#3280fc;opacity:.95;-webkit-transition:all .4s cubic-bezier(.175,.885,.32,1);-o-transition:all .4s cubic-bezier(.175,.885,.32,1);transition:all .4s cubic-bezier(.175,.885,.32,1)}a.calendar .event:hover{background-color:#0462f7}.calendar .event:hover{opacity:1}.calendar .event.drag-shadow{cursor:move}.calendar .event.drag-from{opacity:.25}.calendar .event.color-red{color:#fff;background-color:#ea644a}a.calendar .event.color-red:hover{background-color:#e53d1c}.calendar .event.color-green{color:#fff;background-color:#38b03f}a.calendar .event.color-green:hover{background-color:#2c8931}.calendar .event.color-yellow{color:#fff;background-color:#f1a325}a.calendar .event.color-yellow:hover{background-color:#d5890e}.calendar .event.color-blue{color:#fff;background-color:#03b8cf}a.calendar .event.color-blue:hover{background-color:#028b9d}.calendar .event.color-brown{color:#fff;background-color:#bd7b46}a.calendar .event.color-brown:hover{background-color:#996337}.calendar .event.color-purple{color:#fff;background-color:#8666b8}a.calendar .event.color-purple:hover{background-color:#6c4aa1}.calendar.limit-event-title .event{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
7
root/res/zui/lib/calendar/zui.calendar.min.js
vendored
Normal file
7
root/res/zui/lib/calendar/zui.calendar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3267
root/res/zui/lib/chart/zui.chart.js
Normal file
3267
root/res/zui/lib/chart/zui.chart.js
Normal file
File diff suppressed because it is too large
Load Diff
14
root/res/zui/lib/chart/zui.chart.min.js
vendored
Normal file
14
root/res/zui/lib/chart/zui.chart.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
436
root/res/zui/lib/chosen/chosen.css
Normal file
436
root/res/zui/lib/chosen/chosen.css
Normal file
@@ -0,0 +1,436 @@
|
||||
/*!
|
||||
* Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||
* by Patrick Filler for Harvest, http://getharvest.com
|
||||
*
|
||||
* Copyright (c) 2011-2016 Harvest http://getharvest.com
|
||||
* MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||
*/
|
||||
.chosen-container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
vertical-align: middle;
|
||||
zoom: 1;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
*display: inline;
|
||||
}
|
||||
.chosen-container .chosen-drop {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: -9999px;
|
||||
z-index: 1010;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border: 1px solid #cbcbcb;
|
||||
border: 1px solid rgba(0, 0, 0, .15);
|
||||
border-top: 0;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
|
||||
}
|
||||
.chosen-container .chosen-drop.chosen-drop-size-limited {
|
||||
border-top: 1px solid rgba(0, 0, 0, .15);
|
||||
}
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
left: 0;
|
||||
}
|
||||
.chosen-container a {
|
||||
cursor: pointer;
|
||||
}
|
||||
.chosen-container.chosen-up .chosen-drop {
|
||||
top: inherit;
|
||||
bottom: 100%;
|
||||
margin-top: auto;
|
||||
margin-bottom: -1px;
|
||||
border-radius: 2px 2px 0 0;
|
||||
-webkit-box-shadow: 0 -3px 5px rgba(0, 0, 0, .175);
|
||||
box-shadow: 0 -3px 5px rgba(0, 0, 0, .175);
|
||||
}
|
||||
.chosen-container-single .chosen-single {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
padding: 5px 8px;
|
||||
overflow: hidden;
|
||||
line-height: 1.53846154;
|
||||
color: #222;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
||||
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
||||
}
|
||||
.chosen-container-single .chosen-default {
|
||||
color: #808080;
|
||||
}
|
||||
.chosen-container-single .chosen-single > span {
|
||||
display: block;
|
||||
margin-right: 26px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-single .chosen-single-with-deselect span {
|
||||
margin-right: 38px;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr {
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: 24px;
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 19.5px;
|
||||
font-weight: bold;
|
||||
line-height: 14px;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
filter: alpha(opacity=20);
|
||||
opacity: .2;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr:before {
|
||||
content: '×';
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr:hover,
|
||||
.chosen-container-single .chosen-single abbr:focus {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
filter: alpha(opacity=50);
|
||||
opacity: .5;
|
||||
}
|
||||
.chosen-container-single .chosen-single div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
height: 100%;
|
||||
padding: 5px 8px;
|
||||
}
|
||||
.chosen-container-single .chosen-single div b {
|
||||
display: inline-block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin-bottom: 2px;
|
||||
margin-left: 2px;
|
||||
vertical-align: middle;
|
||||
border-top: 4px dashed;
|
||||
border-top: 4px solid \9;
|
||||
border-right: 4px solid transparent;
|
||||
border-left: 4px solid transparent;
|
||||
}
|
||||
.chosen-container-single .chosen-search {
|
||||
position: relative;
|
||||
z-index: 1010;
|
||||
padding: 3px 4px;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-single .chosen-search input[type="text"] {
|
||||
width: 100%;
|
||||
height: 27px;
|
||||
padding: 2px 26px 2px 8px;
|
||||
margin: 1px 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
outline: 0;
|
||||
}
|
||||
.chosen-container-single .chosen-search input[type="text"]:focus {
|
||||
border-color: #145ccd;
|
||||
}
|
||||
.chosen-container-single .chosen-search:before {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
display: block;
|
||||
font-family: ZenIcon;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
color: #808080;
|
||||
text-transform: none;
|
||||
content: '\e603';
|
||||
|
||||
speak: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.chosen-container-single .chosen-drop {
|
||||
margin-top: -1px;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
}
|
||||
.chosen-container .chosen-results {
|
||||
position: relative;
|
||||
max-height: 240px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.chosen-container .chosen-results li {
|
||||
display: none;
|
||||
padding: 5px 10px;
|
||||
margin: 0;
|
||||
line-height: 15px;
|
||||
list-style: none;
|
||||
-webkit-transition: background-color .2s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: background-color .2s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: background-color .2s cubic-bezier(.175, .885, .32, 1);
|
||||
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
.chosen-container .chosen-results li.active-result {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chosen-container .chosen-results li.disabled-result {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-container .chosen-results li.highlighted {
|
||||
color: #fff;
|
||||
background-color: #3280fc;
|
||||
}
|
||||
.chosen-container .chosen-results li.no-results {
|
||||
display: list-item;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-result {
|
||||
display: list-item;
|
||||
font-weight: bold;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-option {
|
||||
padding-left: 15px;
|
||||
}
|
||||
.chosen-container .chosen-results li em {
|
||||
font-style: normal;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
min-height: 30px \0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
cursor: text;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
||||
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices:before,
|
||||
.chosen-container-multi .chosen-choices:after {
|
||||
/* 1 */
|
||||
display: table;
|
||||
content: " ";
|
||||
/* 2 */
|
||||
}
|
||||
.chosen-container-multi .chosen-choices:after {
|
||||
clear: both;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li {
|
||||
display: block;
|
||||
float: left;
|
||||
padding: 0 6px;
|
||||
margin: 5px 0 0 6px;
|
||||
list-style: none;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field {
|
||||
padding: 0;
|
||||
margin-bottom: 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
||||
height: 20px;
|
||||
font-size: 100%;
|
||||
color: #808080;
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0;
|
||||
outline: 0;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field .default {
|
||||
color: #999;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field:before {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
bottom: 8px;
|
||||
display: block;
|
||||
font-family: ZenIcon;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
color: #808080;
|
||||
text-transform: none;
|
||||
content: '\e603';
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity .2s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: opacity .2s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: opacity .2s cubic-bezier(.175, .885, .32, 1);
|
||||
|
||||
speak: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice {
|
||||
position: relative;
|
||||
padding: 3px 20px 3px 5px;
|
||||
line-height: 12px;
|
||||
cursor: default;
|
||||
background-color: #f1f1f1;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, .05);
|
||||
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, .05);
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice:hover {
|
||||
background-color: #fff;
|
||||
border-color: #c4c4c4;
|
||||
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, .1);
|
||||
box-shadow: 0 1px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 15.6px;
|
||||
font-weight: bold;
|
||||
line-height: 14px;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
filter: alpha(opacity=20);
|
||||
opacity: .2;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:before {
|
||||
content: '×';
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover,
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:focus {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
filter: alpha(opacity=50);
|
||||
opacity: .5;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
||||
padding-right: 5px;
|
||||
color: #666;
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
||||
background: #d4d4d4;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
.chosen-container-multi .chosen-results {
|
||||
padding: 5px 0;
|
||||
margin: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-drop .result-selected {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-container-active .chosen-single {
|
||||
border-color: #145ccd;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(20, 92, 205, .6);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(20, 92, 205, .6);
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single {
|
||||
border: 1px solid #cbcbcb;
|
||||
border: 1px solid rgba(0, 0, 0, .15);
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
background: transparent;
|
||||
border-left: none;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
||||
content: "";
|
||||
border-top: 0 dotted;
|
||||
border-bottom: 4px solid;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop.chosen-up .chosen-single {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
|
||||
}
|
||||
.chosen-container-active .chosen-choices {
|
||||
border-color: #145ccd;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(20, 92, 205, .6);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(20, 92, 205, .6);
|
||||
}
|
||||
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
||||
color: #111 !important;
|
||||
}
|
||||
.chosen-container-active .chosen-choices li.search-field:before {
|
||||
opacity: 1;
|
||||
}
|
||||
.chosen-disabled {
|
||||
cursor: default;
|
||||
opacity: .5 !important;
|
||||
}
|
||||
.chosen-disabled .chosen-single {
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||
cursor: default;
|
||||
}
|
||||
1313
root/res/zui/lib/chosen/chosen.js
Normal file
1313
root/res/zui/lib/chosen/chosen.js
Normal file
File diff suppressed because it is too large
Load Diff
7
root/res/zui/lib/chosen/chosen.min.css
vendored
Normal file
7
root/res/zui/lib/chosen/chosen.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
11
root/res/zui/lib/chosen/chosen.min.js
vendored
Normal file
11
root/res/zui/lib/chosen/chosen.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
27
root/res/zui/lib/chosenicons/zui.chosenicons.css
Normal file
27
root/res/zui/lib/chosenicons/zui.chosenicons.css
Normal file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* ZUI: 图标选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.chosen-container.chosen-icons .chosen-results {
|
||||
padding: 5px;
|
||||
}
|
||||
.chosen-container.chosen-icons .chosen-results li {
|
||||
border-radius: 4px;
|
||||
}
|
||||
.chosen-container.chosen-icons .chosen-results li.group-result {
|
||||
padding: 5px 0;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
border-radius: 0;
|
||||
}
|
||||
.chosen-container.chosen-icons .chosen-results li.group-option {
|
||||
display: inline-block;
|
||||
width: 30px;
|
||||
padding: 8px;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
160
root/res/zui/lib/chosenicons/zui.chosenicons.js
Normal file
160
root/res/zui/lib/chosenicons/zui.chosenicons.js
Normal file
@@ -0,0 +1,160 @@
|
||||
/*!
|
||||
* ZUI: 图标选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: chosen.icons.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+ function($) {
|
||||
'use strict';
|
||||
|
||||
var ChosenIcons = function(element, options) {
|
||||
this.$ = $(element);
|
||||
this.options = this.getOptions(options);
|
||||
this.lang = ChosenIcons.LANGS[this.options.lang];
|
||||
this.id = 'chosen-icons-' + parseInt(Math.random() * 10000000000 + 1);
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
ChosenIcons.DEFAULTS = {
|
||||
optional: true,
|
||||
lang: 'zh_cn',
|
||||
icons: {
|
||||
common: ['heart', 'user', 'group', 'list-ul', 'th', 'th-large', 'star', 'star-empty', 'search', 'envelope', 'dashboard', 'sitemap', 'umbrella', 'lightbulb', 'envelope-alt', 'cog', 'ok', 'remove', 'home', 'time', 'flag', 'flag-alt', 'flag-checkered', 'qrcode', 'tag', 'tags', 'book', 'bookmark', 'bookmark-empty', 'print', 'camera', 'picture', 'globe', 'map-marker', 'edit', 'edit-sign', 'play', 'stop', 'plus-sign', 'minus-sign', 'remove-sign', 'ok-sign', 'check-sign', 'question-sign', 'info-sign', 'exclamation-sign', 'plus', 'plus-sign', 'minus', 'minus-sign', 'asterisk', 'calendar', 'calendar-empty', 'comment', 'comment-alt', 'comments', 'comments-alt', 'folder-close', 'folder-open', 'folder-close-alt', 'folder-open-alt', 'thumbs-up', 'thumbs-down', 'pushpin', 'building', 'phone', 'rss', 'rss-sign', 'bullhorn', 'bell', 'bell-alt', 'certificate', 'wrench', 'tasks', 'cloud', 'beaker', 'magic', 'smile', 'frown', 'meh', 'code', 'location-arrow'],
|
||||
web: ['share', 'pencil', 'trash', 'file-alt', 'file', 'file-text', 'download-alt', 'upload-alt', 'inbox', 'repeat', 'refresh', 'lock', 'check', 'check-empty', 'eye-open', 'eye-close', 'key', 'signin', 'signout', 'external-link', 'external-link-sign', 'link', 'reorder', 'quote-left', 'quote-right', 'spinner', 'reply', 'question', 'info', 'archive', 'collapse', 'collapse-top'],
|
||||
editor: ['table', 'copy', 'save', 'list-ol', 'paste', 'keyboard', 'paper-clip', 'crop', 'unlink', 'sort-by-alphabet', 'sort-by-alphabet-alt', 'sort-by-attributes', 'sort-by-attributes-alt', 'sort-by-order', 'sort-by-order-alt'],
|
||||
directional: ['chevron-left', 'chevron-right', 'chevron-down', 'chevron-up', 'arrow-left', 'arrow-right', 'arrow-down', 'arrow-up', 'hand-right', 'hand-left', 'hand-up', 'hand-down', 'circle-arrow-left', 'circle-arrow-right', 'circle-arrow-up', 'circle-arrow-down', 'double-angle-left', 'double-angle-right', 'double-angle-down', 'double-angle-up', 'angle-left', 'angle-right', 'angle-down', 'angle-up', 'long-arrow-left', 'long-arrow-right', 'long-arrow-down', 'long-arrow-up', 'caret-left', 'caret-right', 'caret-down', 'caret-up'],
|
||||
other: ['desktop', 'laptop', 'tablet', 'mobile', 'building', 'firefox', 'ie', 'opera', 'qq', 'lemon', 'sign-blank', 'circle', 'circle-blank', 'terminal', 'html5', 'android', 'apple', 'windows', 'weibo', 'wechat', 'renren', 'bug', 'moon', 'sun']
|
||||
}
|
||||
};
|
||||
|
||||
ChosenIcons.LANGS = {};
|
||||
ChosenIcons.LANGS['zh_cn'] = {
|
||||
emptyIcon: '[没有图标]',
|
||||
commonIcons: '常用图标',
|
||||
webIcons: 'Web 图标',
|
||||
editorIcons: '编辑器图标',
|
||||
directionalIcons: '箭头总汇',
|
||||
otherIcons: '其他图标',
|
||||
};
|
||||
ChosenIcons.LANGS['en'] = {
|
||||
emptyIcon: '[No Icon]',
|
||||
commonIcons: 'Common Icons',
|
||||
webIcons: 'Web Icons',
|
||||
editorIcons: 'Editor Icons',
|
||||
directionalIcons: 'Directional Icons',
|
||||
otherIcons: 'Other Icons'
|
||||
};
|
||||
ChosenIcons.LANGS['zh_tw'] = {
|
||||
emptyIcon: '[沒有圖標]',
|
||||
commonIcons: '常用圖標',
|
||||
webIcons: 'Web 圖標',
|
||||
editorIcons: '編輯器圖標',
|
||||
directionalIcons: '箭頭總匯',
|
||||
otherIcons: '其他圖標'
|
||||
};
|
||||
|
||||
ChosenIcons.prototype.getOptions = function(options) {
|
||||
options = $.extend(true, {
|
||||
placeholder_text: ' ',
|
||||
disable_search: true,
|
||||
width: '100%',
|
||||
inherit_select_classes: true
|
||||
}, ChosenIcons.DEFAULTS, this.$.data(), options);
|
||||
return options;
|
||||
};
|
||||
|
||||
ChosenIcons.prototype.init = function() {
|
||||
var that = this;
|
||||
var $this = this.$.addClass('chosen-icons').addClass(this.id).removeClass('form-control');
|
||||
|
||||
$this.empty();
|
||||
|
||||
if(this.options.optional) {
|
||||
$this.append(this.getOptionHtml());
|
||||
}
|
||||
|
||||
var lang = this.lang;
|
||||
|
||||
var iconsHtml = [];
|
||||
$.each(this.options.icons, function(name, icons) {
|
||||
iconsHtml.push(that.getgroupHtml(name, icons));
|
||||
});
|
||||
|
||||
$this.append(iconsHtml.join(''));
|
||||
|
||||
$this.chosen(this.options);
|
||||
|
||||
var chosenSelector = '.chosen-container.' + this.id;
|
||||
|
||||
$this.on('chosen:showing_dropdown', function() {
|
||||
$(chosenSelector + ' .chosen-results .group-option').each(function() {
|
||||
var $this = $(this).addClass('icon');
|
||||
var text = $(this).text();
|
||||
$this.html('<i class="icon-' + text + '" title="' + text + '"></i>');
|
||||
});
|
||||
}).change(function() {
|
||||
var span = $(chosenSelector + ' .chosen-single > span');
|
||||
var text = $(this).val();
|
||||
|
||||
if(text && text.length > 0) {
|
||||
span.html('<i class="' + text + '"></i> <span class="text-muted">' + text.substr(5).replace(/-/g, ' ') + '</span>');
|
||||
}
|
||||
else {
|
||||
span.html('<span class="text-muted">' + lang.emptyIcon + '</span>');
|
||||
}
|
||||
});
|
||||
|
||||
var val = $this.data('value');
|
||||
if(val) {
|
||||
$this.val(val).change();
|
||||
}
|
||||
}
|
||||
|
||||
ChosenIcons.prototype.getgroupHtml = function(name, icons) {
|
||||
icons = icons || this.options.icons[name]
|
||||
var iconsHtml = [],
|
||||
that = this;
|
||||
|
||||
$.each(icons, function(i, icon) {
|
||||
iconsHtml.push(that.getOptionHtml(icon));
|
||||
});
|
||||
|
||||
return '<optgroup label="' + this.lang[name + 'Icons'] + '">' + iconsHtml.join('') + '</optgroup>';
|
||||
}
|
||||
|
||||
ChosenIcons.prototype.getOptionHtml = function(value) {
|
||||
var name = value;
|
||||
if(value && value.length > 0) {
|
||||
value = 'icon-' + value;
|
||||
} else {
|
||||
value = '';
|
||||
name = this.lang.emptyIcon;
|
||||
}
|
||||
return '<option value="' + value + '">' + name + '</option>';
|
||||
}
|
||||
|
||||
$.fn.chosenIcons = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data('zui.chosenIcons');
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data('zui.chosenIcons', (data = new ChosenIcons(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
})
|
||||
};
|
||||
|
||||
$.fn.chosenIcons.Constructor = ChosenIcons;
|
||||
}(jQuery);
|
||||
|
||||
6
root/res/zui/lib/chosenicons/zui.chosenicons.min.css
vendored
Normal file
6
root/res/zui/lib/chosenicons/zui.chosenicons.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 图标选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.chosen-container.chosen-icons .chosen-results{padding:5px}.chosen-container.chosen-icons .chosen-results li{border-radius:4px}.chosen-container.chosen-icons .chosen-results li.group-result{padding:5px 0;font-size:12px;color:#666;border-radius:0}.chosen-container.chosen-icons .chosen-results li.group-option{display:inline-block;width:30px;padding:8px;font-size:14px;line-height:14px;text-align:center}
|
||||
7
root/res/zui/lib/chosenicons/zui.chosenicons.min.js
vendored
Normal file
7
root/res/zui/lib/chosenicons/zui.chosenicons.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 图标选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
+function(o){"use strict";var e=function(t,n){this.$=o(t),this.options=this.getOptions(n),this.lang=e.LANGS[this.options.lang],this.id="chosen-icons-"+parseInt(1e10*Math.random()+1),this.init()};e.DEFAULTS={optional:!0,lang:"zh_cn",icons:{common:["heart","user","group","list-ul","th","th-large","star","star-empty","search","envelope","dashboard","sitemap","umbrella","lightbulb","envelope-alt","cog","ok","remove","home","time","flag","flag-alt","flag-checkered","qrcode","tag","tags","book","bookmark","bookmark-empty","print","camera","picture","globe","map-marker","edit","edit-sign","play","stop","plus-sign","minus-sign","remove-sign","ok-sign","check-sign","question-sign","info-sign","exclamation-sign","plus","plus-sign","minus","minus-sign","asterisk","calendar","calendar-empty","comment","comment-alt","comments","comments-alt","folder-close","folder-open","folder-close-alt","folder-open-alt","thumbs-up","thumbs-down","pushpin","building","phone","rss","rss-sign","bullhorn","bell","bell-alt","certificate","wrench","tasks","cloud","beaker","magic","smile","frown","meh","code","location-arrow"],web:["share","pencil","trash","file-alt","file","file-text","download-alt","upload-alt","inbox","repeat","refresh","lock","check","check-empty","eye-open","eye-close","key","signin","signout","external-link","external-link-sign","link","reorder","quote-left","quote-right","spinner","reply","question","info","archive","collapse","collapse-top"],editor:["table","copy","save","list-ol","paste","keyboard","paper-clip","crop","unlink","sort-by-alphabet","sort-by-alphabet-alt","sort-by-attributes","sort-by-attributes-alt","sort-by-order","sort-by-order-alt"],directional:["chevron-left","chevron-right","chevron-down","chevron-up","arrow-left","arrow-right","arrow-down","arrow-up","hand-right","hand-left","hand-up","hand-down","circle-arrow-left","circle-arrow-right","circle-arrow-up","circle-arrow-down","double-angle-left","double-angle-right","double-angle-down","double-angle-up","angle-left","angle-right","angle-down","angle-up","long-arrow-left","long-arrow-right","long-arrow-down","long-arrow-up","caret-left","caret-right","caret-down","caret-up"],other:["desktop","laptop","tablet","mobile","building","firefox","ie","opera","qq","lemon","sign-blank","circle","circle-blank","terminal","html5","android","apple","windows","weibo","wechat","renren","bug","moon","sun"]}},e.LANGS={},e.LANGS.zh_cn={emptyIcon:"[没有图标]",commonIcons:"常用图标",webIcons:"Web 图标",editorIcons:"编辑器图标",directionalIcons:"箭头总汇",otherIcons:"其他图标"},e.LANGS.en={emptyIcon:"[No Icon]",commonIcons:"Common Icons",webIcons:"Web Icons",editorIcons:"Editor Icons",directionalIcons:"Directional Icons",otherIcons:"Other Icons"},e.LANGS.zh_tw={emptyIcon:"[沒有圖標]",commonIcons:"常用圖標",webIcons:"Web 圖標",editorIcons:"編輯器圖標",directionalIcons:"箭頭總匯",otherIcons:"其他圖標"},e.prototype.getOptions=function(t){return t=o.extend(!0,{placeholder_text:" ",disable_search:!0,width:"100%",inherit_select_classes:!0},e.DEFAULTS,this.$.data(),t)},e.prototype.init=function(){var e=this,t=this.$.addClass("chosen-icons").addClass(this.id).removeClass("form-control");t.empty(),this.options.optional&&t.append(this.getOptionHtml());var n=this.lang,s=[];o.each(this.options.icons,function(o,t){s.push(e.getgroupHtml(o,t))}),t.append(s.join("")),t.chosen(this.options);var i=".chosen-container."+this.id;t.on("chosen:showing_dropdown",function(){o(i+" .chosen-results .group-option").each(function(){var e=o(this).addClass("icon"),t=o(this).text();e.html('<i class="icon-'+t+'" title="'+t+'"></i>')})}).change(function(){var e=o(i+" .chosen-single > span"),t=o(this).val();t&&t.length>0?e.html('<i class="'+t+'"></i> <span class="text-muted">'+t.substr(5).replace(/-/g," ")+"</span>"):e.html('<span class="text-muted">'+n.emptyIcon+"</span>")});var r=t.data("value");r&&t.val(r).change()},e.prototype.getgroupHtml=function(e,t){t=t||this.options.icons[e];var n=[],s=this;return o.each(t,function(o,e){n.push(s.getOptionHtml(e))}),'<optgroup label="'+this.lang[e+"Icons"]+'">'+n.join("")+"</optgroup>"},e.prototype.getOptionHtml=function(o){var e=o;return o&&o.length>0?o="icon-"+o:(o="",e=this.lang.emptyIcon),'<option value="'+o+'">'+e+"</option>"},o.fn.chosenIcons=function(t){return this.each(function(){var n=o(this),s=n.data("zui.chosenIcons"),i="object"==typeof t&&t;s||n.data("zui.chosenIcons",s=new e(this,i)),"string"==typeof t&&s[t]()})},o.fn.chosenIcons.Constructor=e}(jQuery);
|
||||
745
root/res/zui/lib/clipboard/clipboard.js
Normal file
745
root/res/zui/lib/clipboard/clipboard.js
Normal file
@@ -0,0 +1,745 @@
|
||||
/*!
|
||||
* clipboard.js v1.5.5
|
||||
* https://zenorocha.github.io/clipboard.js
|
||||
*
|
||||
* Licensed MIT © Zeno Rocha
|
||||
*/
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var matches = require('matches-selector')
|
||||
|
||||
module.exports = function (element, selector, checkYoSelf) {
|
||||
var parent = checkYoSelf ? element : element.parentNode
|
||||
|
||||
while (parent && parent !== document) {
|
||||
if (matches(parent, selector)) return parent;
|
||||
parent = parent.parentNode
|
||||
}
|
||||
}
|
||||
|
||||
},{"matches-selector":2}],2:[function(require,module,exports){
|
||||
|
||||
/**
|
||||
* Element prototype.
|
||||
*/
|
||||
|
||||
var proto = Element.prototype;
|
||||
|
||||
/**
|
||||
* Vendor function.
|
||||
*/
|
||||
|
||||
var vendor = proto.matchesSelector
|
||||
|| proto.webkitMatchesSelector
|
||||
|| proto.mozMatchesSelector
|
||||
|| proto.msMatchesSelector
|
||||
|| proto.oMatchesSelector;
|
||||
|
||||
/**
|
||||
* Expose `match()`.
|
||||
*/
|
||||
|
||||
module.exports = match;
|
||||
|
||||
/**
|
||||
* Match `el` to `selector`.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @param {String} selector
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function match(el, selector) {
|
||||
if (vendor) return vendor.call(el, selector);
|
||||
var nodes = el.parentNode.querySelectorAll(selector);
|
||||
for (var i = 0; i < nodes.length; ++i) {
|
||||
if (nodes[i] == el) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},{}],3:[function(require,module,exports){
|
||||
var closest = require('closest');
|
||||
|
||||
/**
|
||||
* Delegates event to a selector.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function delegate(element, selector, type, callback) {
|
||||
var listenerFn = listener.apply(this, arguments);
|
||||
|
||||
element.addEventListener(type, listenerFn);
|
||||
|
||||
return {
|
||||
destroy: function() {
|
||||
element.removeEventListener(type, listenerFn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds closest match and invokes callback.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Function}
|
||||
*/
|
||||
function listener(element, selector, type, callback) {
|
||||
return function(e) {
|
||||
e.delegateTarget = closest(e.target, selector, true);
|
||||
|
||||
if (e.delegateTarget) {
|
||||
callback.call(element, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = delegate;
|
||||
|
||||
},{"closest":1}],4:[function(require,module,exports){
|
||||
/**
|
||||
* Check if argument is a HTML element.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.node = function(value) {
|
||||
return value !== undefined
|
||||
&& value instanceof HTMLElement
|
||||
&& value.nodeType === 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if argument is a list of HTML elements.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.nodeList = function(value) {
|
||||
var type = Object.prototype.toString.call(value);
|
||||
|
||||
return value !== undefined
|
||||
&& (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
||||
&& ('length' in value)
|
||||
&& (value.length === 0 || exports.node(value[0]));
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if argument is a string.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.string = function(value) {
|
||||
return typeof value === 'string'
|
||||
|| value instanceof String;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if argument is a function.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.function = function(value) {
|
||||
var type = Object.prototype.toString.call(value);
|
||||
|
||||
return type === '[object Function]';
|
||||
};
|
||||
|
||||
},{}],5:[function(require,module,exports){
|
||||
var is = require('./is');
|
||||
var delegate = require('delegate');
|
||||
|
||||
/**
|
||||
* Validates all params and calls the right
|
||||
* listener function based on its target type.
|
||||
*
|
||||
* @param {String|HTMLElement|HTMLCollection|NodeList} target
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listen(target, type, callback) {
|
||||
if (!target && !type && !callback) {
|
||||
throw new Error('Missing required arguments');
|
||||
}
|
||||
|
||||
if (!is.string(type)) {
|
||||
throw new TypeError('Second argument must be a String');
|
||||
}
|
||||
|
||||
if (!is.function(callback)) {
|
||||
throw new TypeError('Third argument must be a Function');
|
||||
}
|
||||
|
||||
if (is.node(target)) {
|
||||
return listenNode(target, type, callback);
|
||||
}
|
||||
else if (is.nodeList(target)) {
|
||||
return listenNodeList(target, type, callback);
|
||||
}
|
||||
else if (is.string(target)) {
|
||||
return listenSelector(target, type, callback);
|
||||
}
|
||||
else {
|
||||
throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener to a HTML element
|
||||
* and returns a remove listener function.
|
||||
*
|
||||
* @param {HTMLElement} node
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listenNode(node, type, callback) {
|
||||
node.addEventListener(type, callback);
|
||||
|
||||
return {
|
||||
destroy: function() {
|
||||
node.removeEventListener(type, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event listener to a list of HTML elements
|
||||
* and returns a remove listener function.
|
||||
*
|
||||
* @param {NodeList|HTMLCollection} nodeList
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listenNodeList(nodeList, type, callback) {
|
||||
Array.prototype.forEach.call(nodeList, function(node) {
|
||||
node.addEventListener(type, callback);
|
||||
});
|
||||
|
||||
return {
|
||||
destroy: function() {
|
||||
Array.prototype.forEach.call(nodeList, function(node) {
|
||||
node.removeEventListener(type, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event listener to a selector
|
||||
* and returns a remove listener function.
|
||||
*
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listenSelector(selector, type, callback) {
|
||||
return delegate(document.body, selector, type, callback);
|
||||
}
|
||||
|
||||
module.exports = listen;
|
||||
|
||||
},{"./is":4,"delegate":3}],6:[function(require,module,exports){
|
||||
function select(element) {
|
||||
var selectedText;
|
||||
|
||||
if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
||||
element.focus();
|
||||
element.setSelectionRange(0, element.value.length);
|
||||
|
||||
selectedText = element.value;
|
||||
}
|
||||
else {
|
||||
if (element.hasAttribute('contenteditable')) {
|
||||
element.focus();
|
||||
}
|
||||
|
||||
var selection = window.getSelection();
|
||||
var range = document.createRange();
|
||||
|
||||
range.selectNodeContents(element);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
|
||||
selectedText = selection.toString();
|
||||
}
|
||||
|
||||
return selectedText;
|
||||
}
|
||||
|
||||
module.exports = select;
|
||||
|
||||
},{}],7:[function(require,module,exports){
|
||||
function E () {
|
||||
// Keep this empty so it's easier to inherit from
|
||||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||
}
|
||||
|
||||
E.prototype = {
|
||||
on: function (name, callback, ctx) {
|
||||
var e = this.e || (this.e = {});
|
||||
|
||||
(e[name] || (e[name] = [])).push({
|
||||
fn: callback,
|
||||
ctx: ctx
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
once: function (name, callback, ctx) {
|
||||
var self = this;
|
||||
function listener () {
|
||||
self.off(name, listener);
|
||||
callback.apply(ctx, arguments);
|
||||
};
|
||||
|
||||
listener._ = callback
|
||||
return this.on(name, listener, ctx);
|
||||
},
|
||||
|
||||
emit: function (name) {
|
||||
var data = [].slice.call(arguments, 1);
|
||||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||||
var i = 0;
|
||||
var len = evtArr.length;
|
||||
|
||||
for (i; i < len; i++) {
|
||||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
off: function (name, callback) {
|
||||
var e = this.e || (this.e = {});
|
||||
var evts = e[name];
|
||||
var liveEvents = [];
|
||||
|
||||
if (evts && callback) {
|
||||
for (var i = 0, len = evts.length; i < len; i++) {
|
||||
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
||||
liveEvents.push(evts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove event from queue to prevent memory leak
|
||||
// Suggested by https://github.com/lazd
|
||||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||
|
||||
(liveEvents.length)
|
||||
? e[name] = liveEvents
|
||||
: delete e[name];
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = E;
|
||||
|
||||
},{}],8:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
var _select = require('select');
|
||||
|
||||
var _select2 = _interopRequireDefault(_select);
|
||||
|
||||
/**
|
||||
* Inner class which performs selection from either `text` or `target`
|
||||
* properties and then executes copy or cut operations.
|
||||
*/
|
||||
|
||||
var ClipboardAction = (function () {
|
||||
/**
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
function ClipboardAction(options) {
|
||||
_classCallCheck(this, ClipboardAction);
|
||||
|
||||
this.resolveOptions(options);
|
||||
this.initSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines base properties passed from constructor.
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.resolveOptions = function resolveOptions() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
this.action = options.action;
|
||||
this.emitter = options.emitter;
|
||||
this.target = options.target;
|
||||
this.text = options.text;
|
||||
this.trigger = options.trigger;
|
||||
|
||||
this.selectedText = '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Decides which selection strategy is going to be applied based
|
||||
* on the existence of `text` and `target` properties.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.initSelection = function initSelection() {
|
||||
if (this.text && this.target) {
|
||||
throw new Error('Multiple attributes declared, use either "target" or "text"');
|
||||
} else if (this.text) {
|
||||
this.selectFake();
|
||||
} else if (this.target) {
|
||||
this.selectTarget();
|
||||
} else {
|
||||
throw new Error('Missing required attributes, use either "target" or "text"');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a fake textarea element, sets its value from `text` property,
|
||||
* and makes a selection on it.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.selectFake = function selectFake() {
|
||||
var _this = this;
|
||||
|
||||
this.removeFake();
|
||||
|
||||
this.fakeHandler = document.body.addEventListener('click', function () {
|
||||
return _this.removeFake();
|
||||
});
|
||||
|
||||
this.fakeElem = document.createElement('textarea');
|
||||
this.fakeElem.style.position = 'absolute';
|
||||
this.fakeElem.style.left = '-9999px';
|
||||
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
||||
this.fakeElem.setAttribute('readonly', '');
|
||||
this.fakeElem.value = this.text;
|
||||
|
||||
document.body.appendChild(this.fakeElem);
|
||||
|
||||
this.selectedText = _select2['default'](this.fakeElem);
|
||||
this.copyText();
|
||||
};
|
||||
|
||||
/**
|
||||
* Only removes the fake element after another click event, that way
|
||||
* a user can hit `Ctrl+C` to copy because selection still exists.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.removeFake = function removeFake() {
|
||||
if (this.fakeHandler) {
|
||||
document.body.removeEventListener('click');
|
||||
this.fakeHandler = null;
|
||||
}
|
||||
|
||||
if (this.fakeElem) {
|
||||
document.body.removeChild(this.fakeElem);
|
||||
this.fakeElem = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Selects the content from element passed on `target` property.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.selectTarget = function selectTarget() {
|
||||
this.selectedText = _select2['default'](this.target);
|
||||
this.copyText();
|
||||
};
|
||||
|
||||
/**
|
||||
* Executes the copy operation based on the current selection.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.copyText = function copyText() {
|
||||
var succeeded = undefined;
|
||||
|
||||
try {
|
||||
succeeded = document.execCommand(this.action);
|
||||
} catch (err) {
|
||||
succeeded = false;
|
||||
}
|
||||
|
||||
this.handleResult(succeeded);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires an event based on the copy operation result.
|
||||
* @param {Boolean} succeeded
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
|
||||
if (succeeded) {
|
||||
this.emitter.emit('success', {
|
||||
action: this.action,
|
||||
text: this.selectedText,
|
||||
trigger: this.trigger,
|
||||
clearSelection: this.clearSelection.bind(this)
|
||||
});
|
||||
} else {
|
||||
this.emitter.emit('error', {
|
||||
action: this.action,
|
||||
trigger: this.trigger,
|
||||
clearSelection: this.clearSelection.bind(this)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes current selection and focus from `target` element.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.clearSelection = function clearSelection() {
|
||||
if (this.target) {
|
||||
this.target.blur();
|
||||
}
|
||||
|
||||
window.getSelection().removeAllRanges();
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the `action` to be performed which can be either 'copy' or 'cut'.
|
||||
* @param {String} action
|
||||
*/
|
||||
|
||||
/**
|
||||
* Destroy lifecycle.
|
||||
*/
|
||||
|
||||
ClipboardAction.prototype.destroy = function destroy() {
|
||||
this.removeFake();
|
||||
};
|
||||
|
||||
_createClass(ClipboardAction, [{
|
||||
key: 'action',
|
||||
set: function set() {
|
||||
var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
|
||||
|
||||
this._action = action;
|
||||
|
||||
if (this._action !== 'copy' && this._action !== 'cut') {
|
||||
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the `action` property.
|
||||
* @return {String}
|
||||
*/
|
||||
get: function get() {
|
||||
return this._action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the `target` property using an element
|
||||
* that will be have its content copied.
|
||||
* @param {Element} target
|
||||
*/
|
||||
}, {
|
||||
key: 'target',
|
||||
set: function set(target) {
|
||||
if (target !== undefined) {
|
||||
if (target && typeof target === 'object' && target.nodeType === 1) {
|
||||
this._target = target;
|
||||
} else {
|
||||
throw new Error('Invalid "target" value, use a valid Element');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the `target` property.
|
||||
* @return {String|HTMLElement}
|
||||
*/
|
||||
get: function get() {
|
||||
return this._target;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ClipboardAction;
|
||||
})();
|
||||
|
||||
exports['default'] = ClipboardAction;
|
||||
module.exports = exports['default'];
|
||||
|
||||
},{"select":6}],9:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _clipboardAction = require('./clipboard-action');
|
||||
|
||||
var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
|
||||
|
||||
var _tinyEmitter = require('tiny-emitter');
|
||||
|
||||
var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
|
||||
|
||||
var _goodListener = require('good-listener');
|
||||
|
||||
var _goodListener2 = _interopRequireDefault(_goodListener);
|
||||
|
||||
/**
|
||||
* Base class which takes one or more elements, adds event listeners to them,
|
||||
* and instantiates a new `ClipboardAction` on each click.
|
||||
*/
|
||||
|
||||
var Clipboard = (function (_Emitter) {
|
||||
_inherits(Clipboard, _Emitter);
|
||||
|
||||
/**
|
||||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
function Clipboard(trigger, options) {
|
||||
_classCallCheck(this, Clipboard);
|
||||
|
||||
_Emitter.call(this);
|
||||
|
||||
this.resolveOptions(options);
|
||||
this.listenClick(trigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to retrieve attribute value.
|
||||
* @param {String} suffix
|
||||
* @param {Element} element
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines if attributes would be resolved using internal setter functions
|
||||
* or custom functions that were passed in the constructor.
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
||||
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
||||
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a click event listener to the passed trigger.
|
||||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
||||
*/
|
||||
|
||||
Clipboard.prototype.listenClick = function listenClick(trigger) {
|
||||
var _this = this;
|
||||
|
||||
this.listener = _goodListener2['default'](trigger, 'click', function (e) {
|
||||
return _this.onClick(e);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines a new `ClipboardAction` on each click event.
|
||||
* @param {Event} e
|
||||
*/
|
||||
|
||||
Clipboard.prototype.onClick = function onClick(e) {
|
||||
var trigger = e.delegateTarget || e.currentTarget;
|
||||
|
||||
if (this.clipboardAction) {
|
||||
this.clipboardAction = null;
|
||||
}
|
||||
|
||||
this.clipboardAction = new _clipboardAction2['default']({
|
||||
action: this.action(trigger),
|
||||
target: this.target(trigger),
|
||||
text: this.text(trigger),
|
||||
trigger: trigger,
|
||||
emitter: this
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Default `action` lookup function.
|
||||
* @param {Element} trigger
|
||||
*/
|
||||
|
||||
Clipboard.prototype.defaultAction = function defaultAction(trigger) {
|
||||
return getAttributeValue('action', trigger);
|
||||
};
|
||||
|
||||
/**
|
||||
* Default `target` lookup function.
|
||||
* @param {Element} trigger
|
||||
*/
|
||||
|
||||
Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
|
||||
var selector = getAttributeValue('target', trigger);
|
||||
|
||||
if (selector) {
|
||||
return document.querySelector(selector);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Default `text` lookup function.
|
||||
* @param {Element} trigger
|
||||
*/
|
||||
|
||||
Clipboard.prototype.defaultText = function defaultText(trigger) {
|
||||
return getAttributeValue('text', trigger);
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroy lifecycle.
|
||||
*/
|
||||
|
||||
Clipboard.prototype.destroy = function destroy() {
|
||||
this.listener.destroy();
|
||||
|
||||
if (this.clipboardAction) {
|
||||
this.clipboardAction.destroy();
|
||||
this.clipboardAction = null;
|
||||
}
|
||||
};
|
||||
|
||||
return Clipboard;
|
||||
})(_tinyEmitter2['default']);
|
||||
|
||||
function getAttributeValue(suffix, element) {
|
||||
var attribute = 'data-clipboard-' + suffix;
|
||||
|
||||
if (!element.hasAttribute(attribute)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return element.getAttribute(attribute);
|
||||
}
|
||||
|
||||
exports['default'] = Clipboard;
|
||||
module.exports = exports['default'];
|
||||
|
||||
},{"./clipboard-action":8,"good-listener":5,"tiny-emitter":7}]},{},[9])(9)
|
||||
});
|
||||
7
root/res/zui/lib/clipboard/clipboard.min.js
vendored
Normal file
7
root/res/zui/lib/clipboard/clipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
71
root/res/zui/lib/colorpicker/zui.colorpicker.css
Normal file
71
root/res/zui/lib/colorpicker/zui.colorpicker.css
Normal file
@@ -0,0 +1,71 @@
|
||||
/*!
|
||||
* ZUI: 颜色选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.colorpicker .dropdown-menu {
|
||||
min-width: 0;
|
||||
padding: 2px;
|
||||
}
|
||||
.colorpicker .dropdown-menu > li {
|
||||
display: block;
|
||||
float: left;
|
||||
padding: 2px;
|
||||
}
|
||||
.colorpicker .dropdown-menu > li > a {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
font-family: ZenIcon;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
text-transform: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
|
||||
speak: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.colorpicker .dropdown-menu > li > a:before {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
margin-top: -8px;
|
||||
}
|
||||
.colorpicker .dropdown-menu > li > a:hover {
|
||||
border-color: #333;
|
||||
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
|
||||
}
|
||||
.colorpicker .dropdown-menu > li > a.active:before {
|
||||
content: '\e60d';
|
||||
}
|
||||
.colorpicker .dropdown-menu > li > a.empty {
|
||||
color: #666;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.colorpicker .dropdown-menu > li > a.empty:before {
|
||||
content: '\d7';
|
||||
}
|
||||
.colorpicker .btn {
|
||||
text-shadow: none;
|
||||
}
|
||||
.colorpicker .btn .cp-title {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.colorpicker.btn-wrapper {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
230
root/res/zui/lib/colorpicker/zui.colorpicker.js
Normal file
230
root/res/zui/lib/colorpicker/zui.colorpicker.js
Normal file
@@ -0,0 +1,230 @@
|
||||
/*!
|
||||
* ZUI: 颜色选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: ColorPicker.js [1.5.0+]
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
var name = 'zui.colorPicker'; // modal name
|
||||
var TEAMPLATE = '<div class="colorpicker"><button type="button" class="btn dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><i class="ic"></i></button><ul class="dropdown-menu clearfix"></ul></div>';
|
||||
var LANG = {
|
||||
zh_cn: {
|
||||
errorTip: "不是有效的颜色值"
|
||||
},
|
||||
zh_tw: {
|
||||
errorTip: "不是有效的顏色值"
|
||||
},
|
||||
en: {
|
||||
errorTip: "Not a valid color value"
|
||||
}
|
||||
};
|
||||
|
||||
// The ColorPicker modal class
|
||||
var ColorPicker = function(element, options) {
|
||||
this.name = name;
|
||||
this.$ = $(element);
|
||||
|
||||
this.getOptions(options);
|
||||
this.init();
|
||||
};
|
||||
|
||||
// default options
|
||||
ColorPicker.DEFAULTS = {
|
||||
colors: ['#00BCD4', '#388E3C', '#3280fc', '#3F51B5', '#9C27B0', '#795548', '#F57C00', '#F44336', '#E91E63'],
|
||||
pullMenuRight: true,
|
||||
wrapper: 'btn-wrapper',
|
||||
tileSize: 30,
|
||||
lineCount: 5,
|
||||
optional: true,
|
||||
tooltip: 'top',
|
||||
icon: 'caret-down',
|
||||
// btnTip: 'Tool tip in button'
|
||||
};
|
||||
|
||||
ColorPicker.prototype.init = function() {
|
||||
var options = this.options,
|
||||
that = this;
|
||||
|
||||
this.$picker = $(TEAMPLATE).addClass(options.wrapper);
|
||||
this.$picker.find('.cp-title').toggle(options.title !== undefined).text(options.title);
|
||||
this.$menu = this.$picker.find('.dropdown-menu').toggleClass('pull-right', options.pullMenuRight);
|
||||
this.$btn = this.$picker.find('.btn.dropdown-toggle');
|
||||
this.$btn.find('.ic').addClass('icon-' + options.icon);
|
||||
if(options.btnTip) {
|
||||
this.$picker.attr('data-toggle', 'tooltip').tooltip({title: options.btnTip, placement: options.tooltip, container: 'body'});
|
||||
}
|
||||
this.$.attr('data-provide', null).after(this.$picker);
|
||||
|
||||
// init colors
|
||||
this.colors = {};
|
||||
$.each(this.options.colors, function(idx, rawColor) {
|
||||
if($.zui.Color.isColor(rawColor)) {
|
||||
var color = new $.zui.Color(rawColor);
|
||||
that.colors[color.toCssStr()] = color;
|
||||
}
|
||||
});
|
||||
|
||||
this.updateColors();
|
||||
var that = this;
|
||||
this.$picker.on('click', '.cp-tile', function() {
|
||||
that.setValue($(this).data('color'));
|
||||
});
|
||||
var $input = this.$;
|
||||
var setInputColor = function() {
|
||||
var val = $input.val();
|
||||
var isColor = $.zui.Color.isColor(val);
|
||||
$input.parent().toggleClass('has-error', !isColor && !(options.optional && val === ''));
|
||||
if(isColor) {
|
||||
that.setValue(val, true);
|
||||
} else {
|
||||
if(options.optional && val === '') {
|
||||
$input.tooltip('hide');
|
||||
} else if(!$input.is(':focus')) {
|
||||
$input.tooltip('show', options.errorTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($input.is('input:not([type=hidden])')) {
|
||||
if(options.tooltip) {
|
||||
$input.attr('data-toggle', 'tooltip').tooltip({trigger: 'manual', placement: options.tooltip, tipClass: 'tooltip-danger', container: 'body'});
|
||||
}
|
||||
$input.on('keyup paste input change', setInputColor);
|
||||
} else {
|
||||
$input.appendTo(this.$picker);
|
||||
}
|
||||
setInputColor();
|
||||
};
|
||||
|
||||
ColorPicker.prototype.addColor = function(color) {
|
||||
if(!(color instanceof $.zui.Color)) {
|
||||
color = new $.zui.Color(color);
|
||||
}
|
||||
var hex = color.toCssStr(),
|
||||
options = this.options;
|
||||
|
||||
if(!this.colors[hex]) {
|
||||
this.colors[hex] = color;
|
||||
}
|
||||
|
||||
var $a = $('<a href="###" class="cp-tile"></a>', {
|
||||
titile: color
|
||||
}).data('color', color).css({
|
||||
'color': color.contrast().toCssStr(),
|
||||
'background': hex,
|
||||
'border-color': color.luma() > 0.43 ? '#ccc' : 'transparent'
|
||||
}).attr('data-color', hex);
|
||||
this.$menu.append($('<li/>').css({width: options.tileSize, height: options.tileSize}).append($a));
|
||||
if(options.optional) {
|
||||
this.$menu.find('.cp-tile.empty').parent().detach().appendTo(this.$menu);
|
||||
}
|
||||
};
|
||||
|
||||
ColorPicker.prototype.updateColors = function(colors) {
|
||||
var $picker = this.$picker,
|
||||
$menu = this.$menu.empty(),
|
||||
options = this.options,
|
||||
colors = colors || this.colors,
|
||||
that = this;
|
||||
var bestLineCount = 0;
|
||||
$.each(colors, function(idx, color) {
|
||||
that.addColor(color);
|
||||
bestLineCount++;
|
||||
});
|
||||
if(options.optional) {
|
||||
var $li = $('<li><a class="cp-tile empty" href="###"></a></li>').css({width: options.tileSize, height: options.tileSize});
|
||||
this.$menu.append($li);
|
||||
bestLineCount++;
|
||||
}
|
||||
$menu.css('width', Math.min(bestLineCount, options.lineCount) * options.tileSize + 6);
|
||||
};
|
||||
|
||||
ColorPicker.prototype.setValue = function(color, notSetInput) {
|
||||
var options = this.options;
|
||||
this.$menu.find('.cp-tile.active').removeClass('active');
|
||||
var hex = '';
|
||||
if(color) {
|
||||
var c = new $.zui.Color(color);
|
||||
hex = c.toCssStr().toLowerCase();
|
||||
this.$btn.css({
|
||||
background: hex,
|
||||
color: c.contrast().toCssStr(),
|
||||
borderColor: c.luma() > 0.43 ? '#ccc' : hex
|
||||
});
|
||||
if(!this.colors[hex]) {
|
||||
this.addColor(c);
|
||||
}
|
||||
if(!notSetInput && this.$.val().toLowerCase() !== hex) {
|
||||
this.$.val(hex).trigger('change');
|
||||
}
|
||||
this.$menu.find('.cp-tile[data-color="' + hex + '"]').addClass('active');
|
||||
this.$.tooltip('hide');
|
||||
this.$.trigger('colorchange', c);
|
||||
} else {
|
||||
this.$btn.attr('style', null);
|
||||
if(!notSetInput && this.$.val() !== '') {
|
||||
this.$.val(hex).trigger('change');
|
||||
}
|
||||
if(options.optional) {
|
||||
this.$.tooltip('hide');
|
||||
}
|
||||
this.$menu.find('.cp-tile.empty').addClass('active');
|
||||
this.$.trigger('colorchange', null);
|
||||
}
|
||||
|
||||
if(options.updateBorder) {
|
||||
$(options.updateBorder).css('border-color', hex);
|
||||
}
|
||||
if(options.updateBackground) {
|
||||
$(options.updateBackground).css('background-color', hex);
|
||||
}
|
||||
if(options.updateColor) {
|
||||
$(options.updateText).css('color', hex);
|
||||
}
|
||||
if(options.updateText) {
|
||||
$(options.updateText).text(hex);
|
||||
}
|
||||
};
|
||||
|
||||
// Get and init options
|
||||
ColorPicker.prototype.getOptions = function(options) {
|
||||
var thisOptions = $.extend({}, ColorPicker.DEFAULTS, this.$.data(), options);
|
||||
if(typeof thisOptions.colors === 'string') thisOptions.colors = thisOptions.colors.split(',');
|
||||
var lang = (thisOptions.lang || $.zui.clientLang()).toLowerCase();
|
||||
if(!thisOptions.errorTip) {
|
||||
thisOptions.errorTip = LANG[lang].errorTip;
|
||||
}
|
||||
if(!$.fn.tooltip) thisOptions.btnTip = false;
|
||||
this.options = thisOptions;
|
||||
};
|
||||
|
||||
// Extense jquery element
|
||||
$.fn.colorPicker = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(name);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(name, (data = new ColorPicker(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.colorPicker.Constructor = ColorPicker;
|
||||
|
||||
// Auto call colorPicker after document load complete
|
||||
$(function() {
|
||||
$('[data-provide="colorpicker"]').colorPicker();
|
||||
});
|
||||
}(jQuery));
|
||||
6
root/res/zui/lib/colorpicker/zui.colorpicker.min.css
vendored
Normal file
6
root/res/zui/lib/colorpicker/zui.colorpicker.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 颜色选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.colorpicker .dropdown-menu{min-width:0;padding:2px}.colorpicker .dropdown-menu>li{display:block;float:left;padding:2px}.colorpicker .dropdown-menu>li>a{position:relative;display:block;width:100%;height:100%;padding:0;font-family:ZenIcon;font-size:14px;font-style:normal;font-weight:400;font-variant:normal;line-height:1;text-align:center;text-transform:none;border:1px solid transparent;border-radius:4px;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.colorpicker .dropdown-menu>li>a:before{position:absolute;top:50%;display:block;width:100%;height:20px;margin-top:-8px}.colorpicker .dropdown-menu>li>a:hover{border-color:#333;-webkit-box-shadow:0 1px 4px rgba(0,0,0,.25);box-shadow:0 1px 4px rgba(0,0,0,.25)}.colorpicker .dropdown-menu>li>a.active:before{content:'\e60d'}.colorpicker .dropdown-menu>li>a.empty{color:#666;background:#f2f2f2}.colorpicker .dropdown-menu>li>a.empty:before{content:'\d7'}.colorpicker .btn{text-shadow:none}.colorpicker .btn .cp-title{display:inline-block;margin-right:5px}.colorpicker.btn-wrapper{position:relative;display:inline-block}
|
||||
7
root/res/zui/lib/colorpicker/zui.colorpicker.min.js
vendored
Normal file
7
root/res/zui/lib/colorpicker/zui.colorpicker.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 颜色选择器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
!function(t){"use strict";var o="zui.colorPicker",i='<div class="colorpicker"><button type="button" class="btn dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><i class="ic"></i></button><ul class="dropdown-menu clearfix"></ul></div>',e={zh_cn:{errorTip:"不是有效的颜色值"},zh_tw:{errorTip:"不是有效的顏色值"},en:{errorTip:"Not a valid color value"}},r=function(i,e){this.name=o,this.$=t(i),this.getOptions(e),this.init()};r.DEFAULTS={colors:["#00BCD4","#388E3C","#3280fc","#3F51B5","#9C27B0","#795548","#F57C00","#F44336","#E91E63"],pullMenuRight:!0,wrapper:"btn-wrapper",tileSize:30,lineCount:5,optional:!0,tooltip:"top",icon:"caret-down"},r.prototype.init=function(){var o=this.options,e=this;this.$picker=t(i).addClass(o.wrapper),this.$picker.find(".cp-title").toggle(void 0!==o.title).text(o.title),this.$menu=this.$picker.find(".dropdown-menu").toggleClass("pull-right",o.pullMenuRight),this.$btn=this.$picker.find(".btn.dropdown-toggle"),this.$btn.find(".ic").addClass("icon-"+o.icon),o.btnTip&&this.$picker.attr("data-toggle","tooltip").tooltip({title:o.btnTip,placement:o.tooltip,container:"body"}),this.$.attr("data-provide",null).after(this.$picker),this.colors={},t.each(this.options.colors,function(o,i){if(t.zui.Color.isColor(i)){var r=new t.zui.Color(i);e.colors[r.toCssStr()]=r}}),this.updateColors();var e=this;this.$picker.on("click",".cp-tile",function(){e.setValue(t(this).data("color"))});var r=this.$,s=function(){var i=r.val(),s=t.zui.Color.isColor(i);r.parent().toggleClass("has-error",!(s||o.optional&&""===i)),s?e.setValue(i,!0):o.optional&&""===i?r.tooltip("hide"):r.is(":focus")||r.tooltip("show",o.errorTip)};r.is("input:not([type=hidden])")?(o.tooltip&&r.attr("data-toggle","tooltip").tooltip({trigger:"manual",placement:o.tooltip,tipClass:"tooltip-danger",container:"body"}),r.on("keyup paste input change",s)):r.appendTo(this.$picker),s()},r.prototype.addColor=function(o){o instanceof t.zui.Color||(o=new t.zui.Color(o));var i=o.toCssStr(),e=this.options;this.colors[i]||(this.colors[i]=o);var r=t('<a href="###" class="cp-tile"></a>',{titile:o}).data("color",o).css({color:o.contrast().toCssStr(),background:i,"border-color":o.luma()>.43?"#ccc":"transparent"}).attr("data-color",i);this.$menu.append(t("<li/>").css({width:e.tileSize,height:e.tileSize}).append(r)),e.optional&&this.$menu.find(".cp-tile.empty").parent().detach().appendTo(this.$menu)},r.prototype.updateColors=function(o){var i=(this.$picker,this.$menu.empty()),e=this.options,o=o||this.colors,r=this,s=0;if(t.each(o,function(t,o){r.addColor(o),s++}),e.optional){var a=t('<li><a class="cp-tile empty" href="###"></a></li>').css({width:e.tileSize,height:e.tileSize});this.$menu.append(a),s++}i.css("width",Math.min(s,e.lineCount)*e.tileSize+6)},r.prototype.setValue=function(o,i){var e=this.options;this.$menu.find(".cp-tile.active").removeClass("active");var r="";if(o){var s=new t.zui.Color(o);r=s.toCssStr().toLowerCase(),this.$btn.css({background:r,color:s.contrast().toCssStr(),borderColor:s.luma()>.43?"#ccc":r}),this.colors[r]||this.addColor(s),i||this.$.val().toLowerCase()===r||this.$.val(r).trigger("change"),this.$menu.find('.cp-tile[data-color="'+r+'"]').addClass("active"),this.$.tooltip("hide"),this.$.trigger("colorchange",s)}else this.$btn.attr("style",null),i||""===this.$.val()||this.$.val(r).trigger("change"),e.optional&&this.$.tooltip("hide"),this.$menu.find(".cp-tile.empty").addClass("active"),this.$.trigger("colorchange",null);e.updateBorder&&t(e.updateBorder).css("border-color",r),e.updateBackground&&t(e.updateBackground).css("background-color",r),e.updateColor&&t(e.updateText).css("color",r),e.updateText&&t(e.updateText).text(r)},r.prototype.getOptions=function(o){var i=t.extend({},r.DEFAULTS,this.$.data(),o);"string"==typeof i.colors&&(i.colors=i.colors.split(","));var s=(i.lang||t.zui.clientLang()).toLowerCase();i.errorTip||(i.errorTip=e[s].errorTip),t.fn.tooltip||(i.btnTip=!1),this.options=i},t.fn.colorPicker=function(i){return this.each(function(){var e=t(this),s=e.data(o),a="object"==typeof i&&i;s||e.data(o,s=new r(this,a)),"string"==typeof i&&s[i]()})},t.fn.colorPicker.Constructor=r,t(function(){t('[data-provide="colorpicker"]').colorPicker()})}(jQuery);
|
||||
72
root/res/zui/lib/colorset.js/zui.colorset.js
Normal file
72
root/res/zui/lib/colorset.js/zui.colorset.js
Normal file
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* ZUI: JS配色表 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
* ZUI: Generated from less code - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
var nextColorIndex = 0;
|
||||
var presetColors = ['primary', 'red', 'yellow', 'green', 'blue', 'purple', 'brown', 'dark'];
|
||||
|
||||
var colorset = {
|
||||
primary: '#3280fc',
|
||||
secondary: '#145ccd',
|
||||
pale: '#ebf2f9',
|
||||
fore: '#353535',
|
||||
back: '#fff',
|
||||
grayDarker: '#222222',
|
||||
grayDark: '#333333',
|
||||
gray: '#808080',
|
||||
grayLight: '#dddddd',
|
||||
grayLighter: '#e5e5e5',
|
||||
grayPale: '#f1f1f1',
|
||||
white: '#fff',
|
||||
black: '#000',
|
||||
red: '#ea644a',
|
||||
yellow: '#f1a325',
|
||||
green: '#38b03f',
|
||||
blue: '#03b8cf',
|
||||
purple: '#8666b8',
|
||||
brown: '#bd7b46',
|
||||
greenPale: '#ddf4df',
|
||||
yellowPale: '#fff0d5',
|
||||
redPale: '#ffe5e0',
|
||||
bluePale: '#ddf3f5',
|
||||
brownPale: '#f7ebe1',
|
||||
purplePale: '#f5eeff',
|
||||
light: '#fff',
|
||||
dark: '#353535',
|
||||
success: '#38b03f',
|
||||
warning: '#f1a325',
|
||||
danger: '#ea644a',
|
||||
info: '#03b8cf',
|
||||
important: '#bd7b46',
|
||||
special: '#8666b8',
|
||||
successPale: '#ddf4df',
|
||||
warningPale: '#fff0d5',
|
||||
dangerPale: '#ffe5e0',
|
||||
infoPale: '#ddf3f5',
|
||||
importantPale: '#f7ebe1',
|
||||
specialPale: '#f5eeff'
|
||||
};
|
||||
|
||||
colorset.get = function(colorName) {
|
||||
if(typeof colorName === 'undefined' || colorName === 'random') {
|
||||
colorName = presetColors[(nextColorIndex++) % presetColors.length];
|
||||
}
|
||||
var color = colorset[colorName] ? colorset[colorName] : colorName;
|
||||
return $.zui.Color ? new $.zui.Color(color) : color;
|
||||
}
|
||||
|
||||
$.zui({colorset: colorset});
|
||||
if($.zui.Color) $.extend($.zui.Color, colorset);
|
||||
}(jQuery));
|
||||
13
root/res/zui/lib/colorset.js/zui.colorset.min.js
vendored
Normal file
13
root/res/zui/lib/colorset.js/zui.colorset.min.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
* ZUI: JS配色表 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
/*!
|
||||
* ZUI: Generated from less code - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
!function(e){"use strict";var f=0,r=["primary","red","yellow","green","blue","purple","brown","dark"],a={primary:"#3280fc",secondary:"#145ccd",pale:"#ebf2f9",fore:"#353535",back:"#fff",grayDarker:"#222222",grayDark:"#333333",gray:"#808080",grayLight:"#dddddd",grayLighter:"#e5e5e5",grayPale:"#f1f1f1",white:"#fff",black:"#000",red:"#ea644a",yellow:"#f1a325",green:"#38b03f",blue:"#03b8cf",purple:"#8666b8",brown:"#bd7b46",greenPale:"#ddf4df",yellowPale:"#fff0d5",redPale:"#ffe5e0",bluePale:"#ddf3f5",brownPale:"#f7ebe1",purplePale:"#f5eeff",light:"#fff",dark:"#353535",success:"#38b03f",warning:"#f1a325",danger:"#ea644a",info:"#03b8cf",important:"#bd7b46",special:"#8666b8",successPale:"#ddf4df",warningPale:"#fff0d5",dangerPale:"#ffe5e0",infoPale:"#ddf3f5",importantPale:"#f7ebe1",specialPale:"#f5eeff"};a.get=function(l){"undefined"!=typeof l&&"random"!==l||(l=r[f++%r.length]);var d=a[l]?a[l]:l;return e.zui.Color?new e.zui.Color(d):d},e.zui({colorset:a}),e.zui.Color&&e.extend(e.zui.Color,a)}(jQuery);
|
||||
288
root/res/zui/lib/dashboard/zui.dashboard.css
Normal file
288
root/res/zui/lib/dashboard/zui.dashboard.css
Normal file
@@ -0,0 +1,288 @@
|
||||
/*!
|
||||
* ZUI: 仪表盘 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.dashboard {
|
||||
position: relative;
|
||||
}
|
||||
.dashboard .panel {
|
||||
position: relative;
|
||||
}
|
||||
.dashboard .panel-actions {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
.dashboard .panel-actions .dropdown-menu {
|
||||
min-width: 80px;
|
||||
}
|
||||
.dashboard .panel-actions .dropdown-menu > li > a {
|
||||
padding: 3px 10px;
|
||||
}
|
||||
.dashboard .panel-actions > a,
|
||||
.dashboard .panel-actions > .dropdown > a {
|
||||
color: #808080;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
.dashboard .panel-actions > a,
|
||||
.dashboard .panel-actions > .btn,
|
||||
.dashboard .panel-actions > .dropdown {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
.dashboard .panel-actions > a,
|
||||
.dashboard .panel-actions > .btn,
|
||||
.dashboard .panel-actions > .dropdown > a,
|
||||
.dashboard .panel-actions > .dropdown > .btn {
|
||||
display: block;
|
||||
min-width: 28px;
|
||||
height: 31px;
|
||||
padding: 0 3px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
filter: alpha(opacity=70);
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
opacity: .7;
|
||||
}
|
||||
.dashboard .panel-actions > a:hover,
|
||||
.dashboard .panel-actions > .dropdown > a:hover {
|
||||
background-color: rgba(0, 0, 0, .1);
|
||||
}
|
||||
.dashboard .panel-heading {
|
||||
height: 32px;
|
||||
padding: 6px 60px 6px 6px;
|
||||
font-weight: bold;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.dashboard .panel-heading > .icon {
|
||||
filter: alpha(opacity=70);
|
||||
opacity: .7;
|
||||
}
|
||||
.dashboard .panel-heading:hover > .panel-actions > .btn,
|
||||
.dashboard .panel-heading:hover > .panel-actions > .dropdown > .btn,
|
||||
.dashboard .panel-heading:hover > .panel-actions > .dropdown > a,
|
||||
.dashboard .panel-heading:hover > .panel-actions > a {
|
||||
filter: alpha(opacity=100);
|
||||
opacity: 1;
|
||||
}
|
||||
.dashboard .panel-body {
|
||||
position: absolute;
|
||||
top: 32px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
padding: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.dashboard .panel-body.no-padding {
|
||||
padding: 0;
|
||||
}
|
||||
.dashboard .panel-body > :last-child {
|
||||
margin: 0;
|
||||
}
|
||||
.dashboard .panel-body > .list-group .list-group-item {
|
||||
border-right: none;
|
||||
border-left: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
.dashboard .panel-body > .list-group .list-group-item:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
.dashboard.dashboard-draggable .panel-heading {
|
||||
cursor: move;
|
||||
}
|
||||
.dashboard .panel-dragging {
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, .1);
|
||||
border: 1px solid #fff;
|
||||
-webkit-box-shadow: none!important;
|
||||
box-shadow: none!important;
|
||||
}
|
||||
.dashboard .panel-dragging > * {
|
||||
filter: alpha(opacity=10);
|
||||
opacity: .1;
|
||||
}
|
||||
.dashboard .panel-dragging-shadow {
|
||||
position: absolute;
|
||||
cursor: move;
|
||||
background: rgba(255, 255, 255, .5);
|
||||
border: 2px solid rgba(255, 255, 255, .9);
|
||||
-webkit-box-shadow: 1px 5px 15px rgba(0, 0, 0, .5) !important;
|
||||
box-shadow: 1px 5px 15px rgba(0, 0, 0, .5) !important;
|
||||
}
|
||||
.dashboard .panel-dragging-shadow > * {
|
||||
filter: alpha(opacity=70);
|
||||
opacity: .7;
|
||||
}
|
||||
.dashboard .panel-dragging-shadow.circle {
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
-webkit-transition: width .2s, height .2s;
|
||||
-o-transition: width .2s, height .2s;
|
||||
transition: width .2s, height .2s;
|
||||
}
|
||||
.dashboard .panel-dragging-shadow.circle .panel-actions {
|
||||
display: none;
|
||||
}
|
||||
.dashboard .dragging-col-holder {
|
||||
display: none;
|
||||
}
|
||||
.dashboard.dashboard-holding .dragging-col-holder {
|
||||
display: block;
|
||||
}
|
||||
.dashboard.dashboard-holding .dragging-col {
|
||||
display: none;
|
||||
}
|
||||
.dashboard .resize-handle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 4px;
|
||||
bottom: 20px;
|
||||
width: 12px;
|
||||
cursor: e-resize;
|
||||
filter: alpha(opacity=0);
|
||||
border-radius: 4px;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: opacity .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: opacity .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.dashboard .resize-handle > .icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-top: -10px;
|
||||
line-height: 20px;
|
||||
color: #3280fc;
|
||||
text-align: center;
|
||||
background-color: rgba(50, 128, 252, .2);
|
||||
-webkit-transition: left .4s cubic-bezier(.175, .885, .32, 1), top .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: left .4s cubic-bezier(.175, .885, .32, 1), top .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: left .4s cubic-bezier(.175, .885, .32, 1), top .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.dashboard .resize-handle:hover {
|
||||
background-color: rgba(50, 128, 252, .12);
|
||||
filter: alpha(opacity=100);
|
||||
opacity: 1;
|
||||
}
|
||||
.dashboard .resize-handle:hover > .icon {
|
||||
left: -4px;
|
||||
}
|
||||
.dashboard .resize-handle.resize-vertical {
|
||||
top: auto;
|
||||
right: 10px;
|
||||
bottom: 14px;
|
||||
left: 10px;
|
||||
width: auto;
|
||||
height: 12px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.dashboard .resize-handle.resize-vertical > .icon {
|
||||
top: 0;
|
||||
left: 50%;
|
||||
margin-top: 0;
|
||||
margin-left: -10px;
|
||||
}
|
||||
.dashboard .resize-handle.resize-vertical:hover {
|
||||
background-color: rgba(50, 128, 252, .12);
|
||||
filter: alpha(opacity=100);
|
||||
opacity: 1;
|
||||
}
|
||||
.dashboard .resize-handle.resize-vertical:hover > .icon {
|
||||
top: -4px;
|
||||
}
|
||||
.dashboard .resizing {
|
||||
-webkit-transition: width .2s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: width .2s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: width .2s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.dashboard .resizing-v .resize-vertical {
|
||||
opacity: 1;
|
||||
}
|
||||
.dashboard .resizing-v .resize-vertical > .icon {
|
||||
top: -4px;
|
||||
}
|
||||
.dashboard .resizing-h .resize-horizontal {
|
||||
opacity: 1;
|
||||
}
|
||||
.dashboard .resizing-h .resize-horizontal > .icon {
|
||||
left: -4px;
|
||||
}
|
||||
.dashboard .resizing .resize-handle {
|
||||
background-color: rgba(50, 128, 252, .12);
|
||||
}
|
||||
.dashboard .panel-body:after,
|
||||
.dashboard .panel-body:before {
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
content: ' ';
|
||||
opacity: 0;
|
||||
-webkit-transition: visibility .2s, opacity .2s;
|
||||
-o-transition: visibility .2s, opacity .2s;
|
||||
transition: visibility .2s, opacity .2s;
|
||||
}
|
||||
.dashboard .panel-body:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
.dashboard .panel-body:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-top: -20px;
|
||||
margin-left: -20px;
|
||||
font-family: ZenIcon;
|
||||
font-size: 14px;
|
||||
font-size: 28px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
text-transform: none;
|
||||
content: '\e97c';
|
||||
-webkit-animation: spin 2s infinite linear;
|
||||
-o-animation: spin 2s infinite linear;
|
||||
animation: spin 2s infinite linear;
|
||||
|
||||
speak: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.dashboard .panel-loading > .panel-body {
|
||||
overflow: hidden;
|
||||
}
|
||||
.dashboard .panel-loading > .panel-body:before,
|
||||
.dashboard .panel-loading > .panel-body:after {
|
||||
visibility: visible;
|
||||
opacity: .5;
|
||||
}
|
||||
.dashboard-inverse {
|
||||
background-color: #3280fc;
|
||||
}
|
||||
.dashboard-inverse .panel {
|
||||
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, .15);
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, .15);
|
||||
}
|
||||
.dashboard-inverse .panel-dragging {
|
||||
background: rgba(0, 0, 0, .3);
|
||||
}
|
||||
.dashboard-inverse .panel-dragging-shadow {
|
||||
-webkit-box-shadow: 1px 2px 15px rgba(0, 0, 0, .5) !important;
|
||||
box-shadow: 1px 2px 15px rgba(0, 0, 0, .5) !important;
|
||||
}
|
||||
529
root/res/zui/lib/dashboard/zui.dashboard.js
Normal file
529
root/res/zui/lib/dashboard/zui.dashboard.js
Normal file
@@ -0,0 +1,529 @@
|
||||
/*!
|
||||
* ZUI: 仪表盘 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: dashboard.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($, Math, undefined) {
|
||||
'use strict';
|
||||
|
||||
var dashboardMessager = $.zui.Messager ? new $.zui.Messager({placement: 'top', time: 1500, close: 0, scale: false, fade: false}) : 0;
|
||||
|
||||
var Dashboard = function(element, options) {
|
||||
this.$ = $(element);
|
||||
this.options = this.getOptions(options);
|
||||
this.draggable = this.$.hasClass('dashboard-draggable') || this.options.draggable;
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
Dashboard.DEFAULTS = {
|
||||
minHeight: 100,
|
||||
height: 360,
|
||||
shadowType: 'normal',
|
||||
sensitive: false,
|
||||
circleShadowSize: 100,
|
||||
onlyRefreshBody: true,
|
||||
resizable: true, // 'vertical', 'horizontal'
|
||||
resizeMessage: false
|
||||
};
|
||||
|
||||
Dashboard.prototype.getOptions = function(options) {
|
||||
options = $.extend({}, Dashboard.DEFAULTS, this.$.data(), options);
|
||||
return options;
|
||||
};
|
||||
|
||||
Dashboard.prototype.handleRemoveEvent = function() {
|
||||
var afterPanelRemoved = this.options.afterPanelRemoved;
|
||||
var tip = this.options.panelRemovingTip;
|
||||
this.$.on('click', '.remove-panel', function() {
|
||||
var panel = $(this).closest('.panel');
|
||||
var name = panel.data('name') || panel.find('.panel-heading').text().replace('\n', '').replace(/(^\s*)|(\s*$)/g, '');
|
||||
var index = panel.attr('data-id');
|
||||
|
||||
if(tip === undefined || tip === false || confirm(tip.format(name))) {
|
||||
panel.parent().remove();
|
||||
if(afterPanelRemoved && $.isFunction(afterPanelRemoved)) {
|
||||
afterPanelRemoved(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Dashboard.prototype.handleRefreshEvent = function() {
|
||||
var that = this;
|
||||
var onlyRefreshBody = this.options.onlyRefreshBody;
|
||||
this.$.on('click', '.refresh-panel', function() {
|
||||
var panel = $(this).closest('.panel');
|
||||
that.refresh(panel, onlyRefreshBody);
|
||||
});
|
||||
};
|
||||
|
||||
Dashboard.prototype.handleDraggable = function() {
|
||||
var dashboard = this.$;
|
||||
var options = this.options;
|
||||
var circleShadow = options.shadowType === 'circle';
|
||||
var circleSize = options.circleShadowSize;
|
||||
var halfCircleSize = circleSize / 2;
|
||||
var afterOrdered = options.afterOrdered;
|
||||
|
||||
this.$.addClass('dashboard-draggable');
|
||||
|
||||
this.$.on('mousedown', '.panel-actions, .drag-disabled', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
var pColClass;
|
||||
this.$.on('mousedown', '.panel-heading, .panel-drag-handler', function(event) {
|
||||
var panel = $(this).closest('.panel');
|
||||
var pCol = panel.parent();
|
||||
var row = panel.closest('.row');
|
||||
var dPanel = panel.clone().addClass('panel-dragging-shadow');
|
||||
var pos = panel.offset();
|
||||
var dPos = dashboard.offset();
|
||||
var dColShadow = row.find('.dragging-col-holder');
|
||||
var sWidth = panel.width(),
|
||||
sHeight = panel.height(),
|
||||
sX1, sY1, sX2, sY2, moveFn, dropCol, dropBefore, nextDropCol;
|
||||
if(!dColShadow.length) {
|
||||
dColShadow = $('<div class="dragging-col-holder"><div class="panel"></div></div>').removeClass('dragging-col').appendTo(row);
|
||||
}
|
||||
|
||||
if(pColClass) dColShadow.removeClass(pColClass);
|
||||
dColShadow.addClass(pColClass = pCol.attr('class'));
|
||||
|
||||
dColShadow.insertBefore(pCol).find('.panel').replaceWith(panel.clone().addClass('panel-dragging panel-dragging-holder'));
|
||||
|
||||
dashboard.addClass('dashboard-dragging');
|
||||
panel.addClass('panel-dragging').parent().addClass('dragging-col');
|
||||
|
||||
dPanel.css({
|
||||
left: pos.left - dPos.left,
|
||||
top: pos.top - dPos.top,
|
||||
width: sWidth,
|
||||
height: sHeight
|
||||
}).appendTo(dashboard).data('mouseOffset', {
|
||||
x: event.pageX - pos.left + dPos.left,
|
||||
y: event.pageY - pos.top + dPos.top
|
||||
});
|
||||
|
||||
if(circleShadow) {
|
||||
dPanel.addClass('circle');
|
||||
setTimeout(function() {
|
||||
dPanel.css({
|
||||
left: event.pageX - dPos.left - halfCircleSize,
|
||||
top: event.pageY - dPos.top - halfCircleSize,
|
||||
width: circleSize,
|
||||
height: circleSize
|
||||
}).data('mouseOffset', {
|
||||
x: dPos.left + halfCircleSize,
|
||||
y: dPos.top + halfCircleSize
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$(document).on('mousemove', mouseMove).on('mouseup', mouseUp);
|
||||
event.preventDefault();
|
||||
|
||||
function mouseMove(event) {
|
||||
// console.log('......................');
|
||||
var offset = dPanel.data('mouseOffset');
|
||||
sX1 = event.pageX - offset.x;
|
||||
sY1 = event.pageY - offset.y;
|
||||
sX2 = sX1 + sWidth;
|
||||
sY2 = sY1 + sHeight;
|
||||
dPanel.css({
|
||||
left: sX1,
|
||||
top: sY1
|
||||
});
|
||||
|
||||
row.find('.dragging-in').removeClass('dragging-in');
|
||||
dropBefore = false;
|
||||
dropCol = null;
|
||||
var area = 0,
|
||||
thisArea;
|
||||
row.children(':not(.dragging-col)').each(function() {
|
||||
var col = $(this);
|
||||
if(col.hasClass('dragging-col-holder')) {
|
||||
dropBefore = (!options.sensitive) || (area < 100);
|
||||
return true;
|
||||
}
|
||||
var p = col.children('.panel');
|
||||
var pP = p.offset(),
|
||||
pW = p.width(),
|
||||
pH = p.height();
|
||||
var pX = pP.left,
|
||||
pY = pP.top;
|
||||
|
||||
if(options.sensitive) {
|
||||
pX -= dPos.left;
|
||||
pY -= dPos.top;
|
||||
thisArea = getIntersectArea(sX1, sY1, sX2, sY2, pX, pY, pX + pW, pY + pH);
|
||||
if(thisArea > 100 && thisArea > area && thisArea > Math.min(getRectArea(sX1, sY1, sX2, sY2), getRectArea(pX, pY, pX + pW, pY + pH)) / 3) {
|
||||
area = thisArea;
|
||||
dropCol = col;
|
||||
}
|
||||
} else {
|
||||
var mX = event.pageX,
|
||||
mY = event.pageY;
|
||||
|
||||
if(mX > pX && mY > pY && mX < (pX + pW) && mY < (pY + pH)) {
|
||||
dropCol = col;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(dropCol) {
|
||||
if(moveFn) clearTimeout(moveFn);
|
||||
nextDropCol = dropCol;
|
||||
moveFn = setTimeout(movePanel, 50);
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function movePanel() {
|
||||
if(nextDropCol) {
|
||||
nextDropCol.addClass('dragging-in');
|
||||
if(dropBefore) dColShadow.insertAfter(nextDropCol);
|
||||
else dColShadow.insertBefore(nextDropCol);
|
||||
dashboard.addClass('dashboard-holding');
|
||||
moveFn = null;
|
||||
nextDropCol = null;
|
||||
}
|
||||
}
|
||||
|
||||
function mouseUp(event) {
|
||||
if(moveFn) clearTimeout(moveFn);
|
||||
|
||||
var oldOrder = panel.data('order');
|
||||
panel.parent().insertAfter(dColShadow);
|
||||
var newOrder = 0;
|
||||
var newOrders = {};
|
||||
|
||||
row.children(':not(.dragging-col-holder)').each(function() {
|
||||
var p = $(this).children('.panel');
|
||||
p.data('order', ++newOrder);
|
||||
newOrders[p.data('id') || p.attr('id')] = newOrder;
|
||||
p.parent().attr('data-order', newOrder);
|
||||
});
|
||||
|
||||
if(oldOrder != newOrders[panel.data('id') || panel.attr('id')]) {
|
||||
row.data('orders', newOrders);
|
||||
|
||||
if(afterOrdered && $.isFunction(afterOrdered)) {
|
||||
afterOrdered(newOrders);
|
||||
}
|
||||
}
|
||||
|
||||
dPanel.remove();
|
||||
|
||||
dashboard.removeClass('dashboard-holding');
|
||||
dashboard.find('.dragging-col').removeClass('dragging-col');
|
||||
dashboard.find('.panel-dragging').removeClass('panel-dragging');
|
||||
row.find('.dragging-in').removeClass('dragging-in');
|
||||
dashboard.removeClass('dashboard-dragging');
|
||||
$(document).off('mousemove', mouseMove).off('mouseup', mouseUp);
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Dashboard.prototype.handlePanelPadding = function() {
|
||||
this.$.find('.panel-body > table, .panel-body > .list-group').parent().addClass('no-padding');
|
||||
};
|
||||
|
||||
Dashboard.prototype.updatePanelHeight = function() {
|
||||
var that = this;
|
||||
var defaultHeight = that.options.height;
|
||||
var minHeight = that.options.minHeight;
|
||||
var sizeConfig = {};
|
||||
if(that.id && $.zui.store) {
|
||||
sizeConfig = $.zui.store.pageGet('zui.dashboard.' + that.id + '.sizeConfig', sizeConfig);
|
||||
}
|
||||
|
||||
this.$.children('.row').each(function() {
|
||||
var $row = $(this);
|
||||
var rowWidth = $row.width();
|
||||
var rows = [], row = [], calWidth = 0;
|
||||
$row.children(':not(.dragging-col-holder)').each(function() {
|
||||
var $col = $(this);
|
||||
var colWidth = $col.width();
|
||||
if(calWidth + colWidth > rowWidth) {
|
||||
if(row.length) rows.push(row);
|
||||
row = [$col];
|
||||
calWidth = colWidth;
|
||||
} else {
|
||||
calWidth += colWidth;
|
||||
row.push($col);
|
||||
}
|
||||
});
|
||||
if(row.length) rows.push(row);
|
||||
if(rows.length) {
|
||||
$.each(rows, function(rowId) {
|
||||
row = rows[rowId];
|
||||
var bestHeight = 0;
|
||||
var panels = [];
|
||||
var setNewHeight = false;
|
||||
$.each(row, function(colId) {
|
||||
var $col = row[colId].data('row-id', rowId);
|
||||
var $panel = $col.children('.panel:first');
|
||||
panels.push($panel);
|
||||
if(setNewHeight) return;
|
||||
var newHeight = $panel.data('newHeight');
|
||||
if(newHeight) {
|
||||
$panel.data('newHeight', null).data('height', newHeight);
|
||||
bestHeight = Math.max(minHeight, newHeight);
|
||||
setNewHeight = true;
|
||||
} else {
|
||||
var panelHeight = $panel.data('height') || sizeConfig[$panel.data('id')];
|
||||
if(panelHeight) bestHeight = Math.max(bestHeight, panelHeight);
|
||||
}
|
||||
});
|
||||
if(!bestHeight) {
|
||||
bestHeight = defaultHeight;
|
||||
}
|
||||
$.each(panels, function(idx) {
|
||||
var $panel = panels[idx].css('height', bestHeight);
|
||||
sizeConfig[$panel.data('id')] = $panel.data('height');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if(that.id && $.zui.store) {
|
||||
$.zui.store.pageSet('zui.dashboard.' + that.id + '.sizeConfig', sizeConfig);
|
||||
}
|
||||
|
||||
return sizeConfig;
|
||||
};
|
||||
|
||||
Dashboard.prototype.handleResizeEvent = function() {
|
||||
var that = this;
|
||||
var options = that.options;
|
||||
var resizable = options.resizable;
|
||||
var onResize = options.onResize;
|
||||
var minHeight = options.minHeight;
|
||||
var resizeMessage = options.resizeMessage;
|
||||
var messagerAvaliable = resizeMessage && dashboardMessager;
|
||||
that.$.on('mousedown', '.resize-handle', function(e) {
|
||||
var $handle = $(this);
|
||||
var isVertical = $handle.hasClass('resize-vertical');
|
||||
var $col = $handle.parent()
|
||||
.addClass('resizing')
|
||||
.toggleClass('resizing-v', isVertical)
|
||||
.toggleClass('resizing-h', !isVertical);
|
||||
var $row = $col.closest('.row');
|
||||
var $panel = $col.children('.panel');
|
||||
var startX = e.pageX, startY = e.pageY;
|
||||
var startWidth = $col.width(), startHeight = $panel.height();
|
||||
var rowWidth = $row.width();
|
||||
var oldGrid = Math.round(12*startWidth/rowWidth);
|
||||
var lastGrid = oldGrid;
|
||||
if(!isVertical) $col.attr('data-grid', oldGrid);
|
||||
|
||||
var mouseMove = function(event) {
|
||||
if(isVertical) {
|
||||
$panel.css('height', Math.max(minHeight, startHeight + (event.pageY - startY)));
|
||||
}
|
||||
else {
|
||||
var x = event.pageX;
|
||||
var grid = Math.max(1, Math.min(12, Math.round(12 * (startWidth + (x - startX)) / rowWidth)));
|
||||
if(lastGrid != grid) {
|
||||
$col.attr('data-grid', grid).css('width', (100*grid/12) + '%');
|
||||
if(messagerAvaliable) dashboardMessager[dashboardMessager.isShow ? 'update' : 'show'](Math.round(100*grid/12) + '% (' + grid + '/12)');
|
||||
lastGrid = grid;
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
var mouseUp = function(event) {
|
||||
$col.removeClass('resizing resizing-v resizing-h');
|
||||
|
||||
if(isVertical) {
|
||||
var newHeight = Math.max(minHeight, startHeight + (event.pageY - startY));
|
||||
if(newHeight !== startHeight)
|
||||
{
|
||||
if($.isFunction(onResize))
|
||||
{
|
||||
var revert = function() {
|
||||
$panel.css('height', startHeight).data('height', startHeight);
|
||||
that.updatePanelHeight();
|
||||
};
|
||||
var result = onResize({type: 'vertical', id: $panel.data('id'), element: $col, old: startHeight, height: newHeight, revert: revert});
|
||||
if(result === false) revert();
|
||||
}
|
||||
$panel.css('height', newHeight).data('newHeight', newHeight);;
|
||||
}
|
||||
} else {
|
||||
var lastGrid = $col.attr('data-grid');
|
||||
if(oldGrid != lastGrid) {
|
||||
if($.isFunction(onResize)) {
|
||||
var revert = function() {
|
||||
$col.attr('data-grid', oldGrid).css('width', null);
|
||||
that.updatePanelHeight();
|
||||
};
|
||||
var result = onResize({type: 'horizontal', id: $panel.data('id'), element: $col, old: oldGrid, grid: lastGrid, revert: revert});
|
||||
if(result === false) revert();
|
||||
else if(result !== true) {
|
||||
if(messagerAvaliable) dashboardMessager.show(Math.round(100*lastGrid/12) + '% (' + lastGrid + '/12)');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
that.updatePanelHeight();
|
||||
$('body').off('mousemove.resize', mouseMove).off('mouseup.resize', mouseUp);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
$('body').on('mousemove.resize', mouseMove).on('mouseup.resize', mouseUp);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
var $col = that.$.children('.row').children(':not(.dragging-col-holder)');
|
||||
if(resizable === true || resizable === 'horizontal')
|
||||
{
|
||||
$col.append('<div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div>');
|
||||
}
|
||||
if(resizable === true || resizable === 'vertical')
|
||||
{
|
||||
$col.append('<div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div>');
|
||||
}
|
||||
};
|
||||
|
||||
Dashboard.prototype.refresh = function($panel, onlyRefreshBody) {
|
||||
if(onlyRefreshBody === undefined) onlyRefreshBody = this.options.onlyRefreshBody;
|
||||
var afterRefresh = this.options.afterRefresh;
|
||||
$panel = $($panel);
|
||||
var url = $panel.data('url');
|
||||
if(!url) return;
|
||||
$panel.addClass('panel-loading').find('.panel-heading .icon-refresh,.panel-heading .icon-repeat').addClass('icon-spin');
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'html'
|
||||
}).done(function(data) {
|
||||
var $data = $(data);
|
||||
if($data.hasClass('panel')) {
|
||||
$panel.empty().append($data.children());
|
||||
} else if(onlyRefreshBody) {
|
||||
$panel.find('.panel-body').empty().html(data);
|
||||
} else {
|
||||
$panel.html(data);
|
||||
}
|
||||
if($.isFunction(afterRefresh)) {
|
||||
afterRefresh.call(this, {
|
||||
result: true,
|
||||
data: data,
|
||||
$panel: $panel
|
||||
});
|
||||
}
|
||||
}).fail(function() {
|
||||
$panel.addClass('panel-error');
|
||||
if($.isFunction(afterRefresh)) {
|
||||
afterRefresh.call(this, {
|
||||
result: false,
|
||||
$panel: $panel
|
||||
});
|
||||
}
|
||||
}).always(function() {
|
||||
$panel.removeClass('panel-loading');
|
||||
$panel.find('.panel-heading .icon-refresh,.panel-heading .icon-repeat').removeClass('icon-spin');
|
||||
});
|
||||
};
|
||||
|
||||
function getRectArea(x1, y1, x2, y2) {
|
||||
return Math.abs((x2 - x1) * (y2 - y1));
|
||||
}
|
||||
|
||||
function isPointInner(x, y, x1, y1, x2, y2) {
|
||||
return x >= x1 && x <= x2 && y >= y1 && y <= y2;
|
||||
}
|
||||
|
||||
function getIntersectArea(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {
|
||||
var x1 = Math.max(ax1, bx1),
|
||||
y1 = Math.max(ay1, by1),
|
||||
x2 = Math.min(ax2, bx2),
|
||||
y2 = Math.min(ay2, by2);
|
||||
if(isPointInner(x1, y1, ax1, ay1, ax2, ay2) && isPointInner(x2, y2, ax1, ay1, ax2, ay2) && isPointInner(x1, y1, bx1, by1, bx2, by2) && isPointInner(x2, y2, bx1, by1, bx2, by2)) {
|
||||
return getRectArea(x1, y1, x2, y2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Dashboard.prototype.init = function() {
|
||||
var options = this.options, that = this;
|
||||
that.id = options.id ? options.id : that.$.attr('id');
|
||||
if(options.data) {
|
||||
var $row = $('<div class="row"/>');
|
||||
$.each(options.data, function(idx, config) {
|
||||
var $col = $('<div class="col-sm-' + (config.colWidth || 4) + '"/>');
|
||||
if(config.colAttrs) $col.attr(config.colAttrs);
|
||||
var $panel = $('<div class="panel" data-id="' + (config.id || $.zui.uuid()) + '"/>');
|
||||
if(config.panelAttrs) $panel.attr(config.panelAttrs);
|
||||
if(config.height !== undefined) $panel.data('height', config.height);
|
||||
if(config.content !== undefined) {
|
||||
if($.isFunction(config.content)) {
|
||||
var content = config.content($panel);
|
||||
if(content !== true) {
|
||||
$panel.html(content);
|
||||
}
|
||||
} else {
|
||||
$panel.html(config.content);
|
||||
}
|
||||
}
|
||||
$row.append($col.append($panel.data('url', config.url)));
|
||||
});
|
||||
that.$.append($row);
|
||||
}
|
||||
|
||||
that.updatePanelHeight();
|
||||
that.handlePanelPadding();
|
||||
that.handleRemoveEvent();
|
||||
that.handleRefreshEvent();
|
||||
if(options.resizable) that.handleResizeEvent();
|
||||
if(that.draggable) that.handleDraggable();
|
||||
|
||||
var orderSeed = 0;
|
||||
that.$.find('.panel').each(function() {
|
||||
var $this = $(this);
|
||||
$this.data('order', ++orderSeed);
|
||||
if(!$this.attr('id')) {
|
||||
$this.attr('id', 'panel' + orderSeed);
|
||||
}
|
||||
if(!$this.attr('data-id')) {
|
||||
$this.attr('data-id', orderSeed);
|
||||
}
|
||||
|
||||
that.refresh($this, options.onlyRefreshBody);
|
||||
});
|
||||
|
||||
that.$.find('[data-toggle="tooltip"]').tooltip({container: 'body'});
|
||||
};
|
||||
|
||||
$.fn.dashboard = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data('zui.dashboard');
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data('zui.dashboard', (data = new Dashboard(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.dashboard.Constructor = Dashboard;
|
||||
}(jQuery, Math, undefined));
|
||||
|
||||
6
root/res/zui/lib/dashboard/zui.dashboard.min.css
vendored
Normal file
6
root/res/zui/lib/dashboard/zui.dashboard.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
root/res/zui/lib/dashboard/zui.dashboard.min.js
vendored
Normal file
7
root/res/zui/lib/dashboard/zui.dashboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
272
root/res/zui/lib/datagrid/zui.datagrid.css
Normal file
272
root/res/zui/lib/datagrid/zui.datagrid.css
Normal file
@@ -0,0 +1,272 @@
|
||||
/*!
|
||||
* ZUI: 数据表格② - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.datagrid-container {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.datagrid-cells {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
.datagrid-cell {
|
||||
position: absolute;
|
||||
padding: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-transition: .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-webkit-transition-property: background, outline;
|
||||
-o-transition-property: background, outline;
|
||||
transition-property: background, outline;
|
||||
}
|
||||
.datagrid-cell.datagrid-cell-index {
|
||||
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
|
||||
color: #808080;
|
||||
text-align: right;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
.datagrid-cell.datagrid-cell-head {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
.datagrid-cell-span {
|
||||
z-index: 10;
|
||||
}
|
||||
.datagrid-row {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
-webkit-transition: .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-webkit-transition-property: background, outline;
|
||||
-o-transition-property: background, outline;
|
||||
transition-property: background, outline;
|
||||
}
|
||||
.datagrid-row-head {
|
||||
font-weight: bold;
|
||||
color: #808080;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
.datagrid-fixed.datagrid-row {
|
||||
z-index: 35;
|
||||
}
|
||||
.datagrid-fixed.datagrid-cell {
|
||||
z-index: 30;
|
||||
}
|
||||
.datagrid-fixed-edge-top {
|
||||
-webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .125), 0 1px 0 rgba(0, 0, 0, .25);
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .125), 0 1px 0 rgba(0, 0, 0, .25);
|
||||
}
|
||||
.datagrid-fixed-edge-bottom {
|
||||
-webkit-box-shadow: 0 -2px 5px 0 rgba(0, 0, 0, .125), 0 -1px 0 rgba(0, 0, 0, .25);
|
||||
box-shadow: 0 -2px 5px 0 rgba(0, 0, 0, .125), 0 -1px 0 rgba(0, 0, 0, .25);
|
||||
}
|
||||
.datagrid-fixed-edge-left {
|
||||
-webkit-box-shadow: -1px 0 0 rgba(0, 0, 0, .25) inset;
|
||||
box-shadow: -1px 0 0 rgba(0, 0, 0, .25) inset;
|
||||
}
|
||||
.datagrid-fixed-edge-right {
|
||||
-webkit-box-shadow: 1px 0 0 rgba(0, 0, 0, .25) inset;
|
||||
box-shadow: 1px 0 0 rgba(0, 0, 0, .25) inset;
|
||||
}
|
||||
.datagrid-row-cell.active .datagrid-cell {
|
||||
background-color: #fff0d5;
|
||||
}
|
||||
.datagrid-row-cell.active .datagrid-cell.datagrid-cell-index {
|
||||
background-color: #ffe7bc;
|
||||
}
|
||||
.datagrid-hover-row .datagrid-row-cell:hover {
|
||||
z-index: 20;
|
||||
}
|
||||
.datagrid-hover-row .datagrid-row-cell:hover .datagrid-cell {
|
||||
background-color: #ebf2f9;
|
||||
}
|
||||
.datagrid-hover-row .datagrid-row-cell:hover.datagrid-fixed {
|
||||
z-index: 38;
|
||||
}
|
||||
.datagrid-hover-row .datagrid-row-cell:hover > .datagrid-cell-index {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.datagrid-hover-row .datagrid-row-cell:hover.active .datagrid-cell {
|
||||
background-color: #ffe1ac;
|
||||
}
|
||||
.datagrid-hover-row .datagrid-row-cell:hover.active .datagrid-cell-index {
|
||||
background-color: #ffda98;
|
||||
}
|
||||
.datagrid-hover-row.datagrid-hover-shadow .datagrid-row-cell:hover {
|
||||
-webkit-box-shadow: 0 1px 3px 2px rgba(0, 0, 0, .05), 0 0 2px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: 0 1px 3px 2px rgba(0, 0, 0, .05), 0 0 2px 1px rgba(0, 0, 0, .075);
|
||||
}
|
||||
.datagrid-hover-cell .datagrid-row-cell .datagrid-cell-cell:hover {
|
||||
z-index: 40;
|
||||
background-color: #fff;
|
||||
outline: 1px solid #808080;
|
||||
outline-offset: -1px;
|
||||
}
|
||||
.datagrid-hover-cell .datagrid-row-cell .datagrid-cell-cell.datagrid-fixed:hover,
|
||||
.datagrid-hover-cell .datagrid-row-cell.datagrid-fixed .datagrid-cell-cell:hover {
|
||||
z-index: 42;
|
||||
}
|
||||
.datagrid-hover-cell.datagrid-hover-shadow .datagrid-row-cell .datagrid-cell:hover {
|
||||
-webkit-box-shadow: 0 1px 3px 3px rgba(0, 0, 0, .075), 0 0 2px rgba(0, 0, 0, .1);
|
||||
box-shadow: 0 1px 3px 3px rgba(0, 0, 0, .075), 0 0 2px rgba(0, 0, 0, .1);
|
||||
}
|
||||
.datagrid-hover-col .datagrid-cell.hover {
|
||||
background-color: #ebf2f9;
|
||||
}
|
||||
.datagrid-hover-col .datagrid-cell-head.hover,
|
||||
.datagrid-hover-col .datagrid-cell-index.hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.datagrid-hover-col .datagrid-row-cell.active .datagrid-cell.hover {
|
||||
background-color: #d7e5f3;
|
||||
}
|
||||
.datagrid-scrollbar {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
-webkit-transition: 2.5s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: 2.5s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: 2.5s cubic-bezier(.175, .885, .32, 1);
|
||||
-webkit-transition-property: background, opacity;
|
||||
-o-transition-property: background, opacity;
|
||||
transition-property: background, opacity;
|
||||
}
|
||||
.datagrid-scrollbar.scrolling,
|
||||
.datagrid-container:hover .datagrid-scrollbar {
|
||||
opacity: 1;
|
||||
}
|
||||
.datagrid-scrollbar > .bar {
|
||||
position: absolute;
|
||||
min-width: 10px;
|
||||
background-color: #ddd;
|
||||
background-color: rgba(0, 0, 0, .25);
|
||||
}
|
||||
.datagrid-scrollbar.scrolling,
|
||||
.datagrid-scrollbar:hover {
|
||||
background-color: rgba(0, 0, 0, .075);
|
||||
}
|
||||
.datagrid-scrollbar.scrolling > .bar,
|
||||
.datagrid-scrollbar:hover > .bar {
|
||||
position: absolute;
|
||||
background-color: #808080;
|
||||
background-color: rgba(0, 0, 0, .5);
|
||||
}
|
||||
.datagrid-scrollbar-h {
|
||||
left: 0;
|
||||
height: 10px;
|
||||
}
|
||||
.datagrid-scrollbar-h > .bar {
|
||||
top: 0!important;
|
||||
bottom: 0!important;
|
||||
min-width: 20px;
|
||||
}
|
||||
.datagrid-scrollbar-v {
|
||||
top: 0;
|
||||
width: 10px;
|
||||
}
|
||||
.datagrid-scrollbar-v > .bar {
|
||||
right: 0!important;
|
||||
left: 0!important;
|
||||
min-height: 20px;
|
||||
}
|
||||
.datagrid-messager {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 60;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
.datagrid-messager > .close {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
padding-bottom: 5px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.datagrid-messager > .close:hover {
|
||||
background-color: rgba(0, 0, 0, .1);
|
||||
}
|
||||
.datagrid-loading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 61;
|
||||
background-color: rgba(255, 255, 255, .6);
|
||||
}
|
||||
.datagrid-loading > .content {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
display: block;
|
||||
height: 50px;
|
||||
margin-top: -25px;
|
||||
text-align: center;
|
||||
}
|
||||
.datagrid-loading > .content > .icon {
|
||||
color: #3280fc;
|
||||
}
|
||||
.datagrid-col-sortable {
|
||||
padding-right: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datagrid-sorter {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 20px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
.datagrid-sort-down > .icon-sort:before {
|
||||
color: #3280fc;
|
||||
content: '\e6b8';
|
||||
}
|
||||
.datagrid-sort-up > .icon-sort:before {
|
||||
color: #3280fc;
|
||||
content: '\e6b9';
|
||||
}
|
||||
.datagrid-borderless .datagrid-container {
|
||||
border-color: transparent;
|
||||
}
|
||||
.datagrid-borderless .datagrid-cell {
|
||||
border-right-color: transparent;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
.datagrid-borderless .datagrid-fixed-edge-left {
|
||||
-webkit-box-shadow: -1px 0 0 rgba(0, 0, 0, .1) inset;
|
||||
box-shadow: -1px 0 0 rgba(0, 0, 0, .1) inset;
|
||||
}
|
||||
.datagrid-borderless .datagrid-fixed-edge-right {
|
||||
-webkit-box-shadow: 1px 0 0 rgba(0, 0, 0, .1) inset;
|
||||
box-shadow: 1px 0 0 rgba(0, 0, 0, .1) inset;
|
||||
}
|
||||
.datagrid-borderless .datagrid-row-cell:not(:hover) .datagrid-cell.datagrid-cell-index {
|
||||
background-color: #fff;
|
||||
}
|
||||
.datagrid-striped .datagrid-cells > .datagrid-row-cell:nth-child(odd) .datagrid-cell-cell {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
1825
root/res/zui/lib/datagrid/zui.datagrid.js
Normal file
1825
root/res/zui/lib/datagrid/zui.datagrid.js
Normal file
File diff suppressed because it is too large
Load Diff
6
root/res/zui/lib/datagrid/zui.datagrid.min.css
vendored
Normal file
6
root/res/zui/lib/datagrid/zui.datagrid.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
14
root/res/zui/lib/datagrid/zui.datagrid.min.js
vendored
Normal file
14
root/res/zui/lib/datagrid/zui.datagrid.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
200
root/res/zui/lib/datatable/zui.datatable.css
Normal file
200
root/res/zui/lib/datatable/zui.datatable.css
Normal file
@@ -0,0 +1,200 @@
|
||||
/*!
|
||||
* ZUI: 数据表格 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.datatable-head,
|
||||
.datatable-rows {
|
||||
display: table;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.datatable {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.datatable > .datatable-head {
|
||||
-webkit-transition: -webkit-box-shadow .2s;
|
||||
-o-transition: box-shadow .2s;
|
||||
transition: -webkit-box-shadow .2s;
|
||||
transition: box-shadow .2s;
|
||||
transition: box-shadow .2s, -webkit-box-shadow .2s;
|
||||
}
|
||||
.datatable .table {
|
||||
margin: 0;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.datatable .table > tbody > tr > td,
|
||||
.datatable .table > thead > tr > th {
|
||||
min-width: 20px;
|
||||
}
|
||||
.datatable .table > tbody > tr > td.check-btn,
|
||||
.datatable .table > thead > tr > th.check-btn {
|
||||
width: 30px;
|
||||
color: #9b9b9b;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datatable .table > tbody > tr.hover > td.check-btn,
|
||||
.datatable .table > tbody > tr.active > td.check-btn,
|
||||
.datatable .table > thead > tr > th.check-btn:hover,
|
||||
.datatable .table > tbody > tr > td.check-btn:hover,
|
||||
.datatable .table > thead > tr > th.check-btn.checked,
|
||||
.datatable .table > tbody > tr > td.check-btn.checked {
|
||||
color: #4f4f4f;
|
||||
}
|
||||
.datatable .table > thead > tr > th.check-btn.checked > .icon-check-empty:before,
|
||||
.datatable .table > tbody > tr > td.check-btn.checked > .icon-check-empty:before,
|
||||
.datatable .table > tbody > tr.active > td.check-btn > .icon-check-empty:before {
|
||||
content: '\e642';
|
||||
}
|
||||
.datatable .table > thead > tr > th.col-hover {
|
||||
background-color: #e2e2e2;
|
||||
}
|
||||
.datatable .table > tbody > tr > td.col-hover,
|
||||
.datatable .table > tbody > tr.hover > td {
|
||||
background-color: #ebf2f9;
|
||||
}
|
||||
.datatable .table > tbody > tr.active.hover td {
|
||||
background-color: #ffdea2;
|
||||
}
|
||||
.datatable.head-fixed > .datatable-head {
|
||||
position: fixed;
|
||||
z-index: 1030;
|
||||
-webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .15);
|
||||
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .15);
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th.text-center {
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th:after {
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
font-family: ZenIcon;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
color: #808080;
|
||||
text-transform: none;
|
||||
content: '\e6bd';
|
||||
|
||||
speak: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th.sort-down:after {
|
||||
color: #145ccd;
|
||||
content: '\e6b8';
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th.sort-up:after {
|
||||
color: #145ccd;
|
||||
content: '\e6b9';
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th.check-btn:after,
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th.sort-disabled:after {
|
||||
display: none;
|
||||
}
|
||||
.datatable.sortable .datatable-head-span .table > thead > tr > th.sort-disabled {
|
||||
cursor: default;
|
||||
}
|
||||
.datatable-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
.datatable-span {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
}
|
||||
.datatable-span.flexarea {
|
||||
overflow: hidden;
|
||||
}
|
||||
.datatable-span.flexarea.datatable-head-span.dragging {
|
||||
cursor: move !important;
|
||||
}
|
||||
.datatable-span.flexarea .table {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.datatable-span.flexarea .scrolled-shadow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
display: none;
|
||||
width: 20px;
|
||||
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, .15);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, .15);
|
||||
opacity: 0;
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.datatable-span.flexarea .scrolled-in-shadow {
|
||||
left: -30px;
|
||||
}
|
||||
.datatable-span.flexarea .scrolled-out-shadow {
|
||||
right: -30px;
|
||||
}
|
||||
.datatable > .scroll-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
.datatable .scroll-slide {
|
||||
position: absolute;
|
||||
right: -1px;
|
||||
bottom: 0;
|
||||
left: -1px;
|
||||
display: none;
|
||||
height: 11px;
|
||||
background: #e5e5e5;
|
||||
background: rgba(128, 128, 128, .1);
|
||||
border: 1px solid #e5e5e5;
|
||||
border-bottom: none;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity .5s, background .3s;
|
||||
-o-transition: opacity .5s, background .3s;
|
||||
transition: opacity .5s, background .3s;
|
||||
}
|
||||
.datatable .scroll-slide > .bar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
min-width: 50px;
|
||||
height: 10px;
|
||||
cursor: move;
|
||||
background-color: #a6a6a6;
|
||||
}
|
||||
.datatable .scroll-slide:hover > .bar {
|
||||
background-color: #808080;
|
||||
}
|
||||
.datatable .scroll-slide.scroll-pos-out {
|
||||
bottom: -14px;
|
||||
height: 15px;
|
||||
}
|
||||
.datatable .scroll-slide.scroll-pos-out > .bar {
|
||||
height: 14px;
|
||||
}
|
||||
.datatable.show-scroll-slide:hover .scroll-slide,
|
||||
.datatable.show-scroll-slide.scrolling .scroll-slide,
|
||||
.datatable.show-scroll-slide:hover .scrolled-shadow,
|
||||
.datatable.show-scroll-slide.scrolling .scrolled-shadow {
|
||||
opacity: 1;
|
||||
}
|
||||
.datatable.show-scroll-slide .scroll-slide,
|
||||
.datatable.show-scroll-slide .scrolled-shadow {
|
||||
display: block;
|
||||
}
|
||||
.datatable.show-scroll-slide.scrolled-in .scrolled-in-shadow {
|
||||
left: -20px;
|
||||
}
|
||||
.datatable.show-scroll-slide.scrolled-out .scrolled-out-shadow {
|
||||
right: -20px;
|
||||
}
|
||||
948
root/res/zui/lib/datatable/zui.datatable.js
Normal file
948
root/res/zui/lib/datatable/zui.datatable.js
Normal file
@@ -0,0 +1,948 @@
|
||||
/*!
|
||||
* ZUI: 数据表格 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: datatable.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
var name = 'zui.datatable';
|
||||
var store = $.zui.store;
|
||||
|
||||
/**
|
||||
* Datatable class
|
||||
*
|
||||
* @param object element DOM element or jquery element
|
||||
* @param object options Datatable options
|
||||
*/
|
||||
var DataTable = function(element, options) {
|
||||
this.name = name;
|
||||
this.$ = $(element);
|
||||
this.isTable = (this.$[0].tagName === 'TABLE');
|
||||
this.firstShow = true;
|
||||
if(this.isTable) {
|
||||
this.$table = this.$;
|
||||
this.id = 'datatable-' + (this.$.attr('id') || $.zui.uuid());
|
||||
} else {
|
||||
this.$datatable = this.$.addClass('datatable');
|
||||
if(this.$.attr('id')) {
|
||||
this.id = this.$.attr('id');
|
||||
} else {
|
||||
this.id = 'datatable-' + $.zui.uuid();
|
||||
this.$.attr('id', this.id);
|
||||
}
|
||||
}
|
||||
this.getOptions(options);
|
||||
this.load();
|
||||
|
||||
this.callEvent('ready');
|
||||
};
|
||||
|
||||
// default options
|
||||
DataTable.DEFAULTS = {
|
||||
// Check options
|
||||
checkable: false, // added check icon to the head of rows
|
||||
checkByClickRow: true, // change check status by click anywhere on a row
|
||||
checkedClass: 'active', // apply CSS class to an checked row
|
||||
checkboxName: null,
|
||||
selectable: true,
|
||||
|
||||
// Sort options
|
||||
sortable: false, // enable sorter
|
||||
|
||||
// storage
|
||||
storage: true, // enable storage
|
||||
|
||||
// fixed header of columns
|
||||
fixedHeader: false, // fixed header
|
||||
fixedHeaderOffset: 0, // set top offset of header when fixed
|
||||
fixedLeftWidth: '30%', // set left width after first render
|
||||
fixedRightWidth: '30%', // set right width after first render
|
||||
flexHeadDrag: true, // scroll flexarea by drag header
|
||||
scrollPos: 'in', // scroll bar position: 'out' | 'in'
|
||||
|
||||
// hover effection
|
||||
rowHover: true, // apply hover effection to row
|
||||
colHover: true, // apply hover effection to head
|
||||
hoverClass: 'hover',
|
||||
colHoverClass: 'col-hover',
|
||||
|
||||
|
||||
// Fix cell height
|
||||
fixCellHeight: true,
|
||||
|
||||
// Merge rows
|
||||
mergeRows: false, // Merge rows
|
||||
|
||||
// custom columns size
|
||||
// customizable: false, // enable customizable
|
||||
minColWidth: 20, // min width of columns
|
||||
minFixedLeftWidth: 200, // min left width
|
||||
minFixedRightWidth: 200, // min right width
|
||||
minFlexAreaWidth: 200 // min flexarea width
|
||||
};
|
||||
|
||||
// Get options
|
||||
DataTable.prototype.getOptions = function(options) {
|
||||
var $e = this.$;
|
||||
options = $.extend({}, DataTable.DEFAULTS, this.$.data(), options);
|
||||
|
||||
options.tableClass = options.tableClass || '';
|
||||
options.tableClass = ' ' + options.tableClass + ' table-datatable';
|
||||
|
||||
$.each(['bordered', 'condensed', 'striped', 'condensed', 'fixed'], function(idx, cls) {
|
||||
cls = 'table-' + cls;
|
||||
if($e.hasClass(cls)) options.tableClass += ' ' + cls;
|
||||
});
|
||||
|
||||
if($e.hasClass('table-hover') || options.rowHover) {
|
||||
options.tableClass += ' table-hover';
|
||||
}
|
||||
|
||||
if(!options.checkable || !$.fn.selectable) options.selectable = false;
|
||||
|
||||
this.options = options;
|
||||
};
|
||||
|
||||
// Load data form options or table dom
|
||||
DataTable.prototype.load = function(data) {
|
||||
var options = this.options,
|
||||
cols;
|
||||
|
||||
if($.isFunction(data)) {
|
||||
data = data(this.data, this);
|
||||
data.keepSort = true;
|
||||
} else if($.isPlainObject(data)) {
|
||||
this.data = data;
|
||||
} else if(typeof data === 'string') {
|
||||
var $table = $(data);
|
||||
if($table.length) {
|
||||
this.$table = $table.first();
|
||||
this.$table.data(name, this);
|
||||
this.isTable = true;
|
||||
}
|
||||
data = null;
|
||||
} else {
|
||||
data = options.data;
|
||||
}
|
||||
|
||||
if(!data) {
|
||||
if(this.isTable) {
|
||||
data = {
|
||||
cols: [],
|
||||
rows: []
|
||||
};
|
||||
cols = data.cols;
|
||||
var rows = data.rows,
|
||||
i,
|
||||
$th, $tr, $td, row, $t = this.$table,
|
||||
colSpan;
|
||||
|
||||
$t.children('thead').children('tr:first').children('th').each(function() {
|
||||
$th = $(this);
|
||||
cols.push($.extend({
|
||||
text: $th.html(),
|
||||
flex: false || $th.hasClass('flex-col'),
|
||||
width: 'auto',
|
||||
cssClass: $th.attr('class'),
|
||||
css: $th.attr('style'),
|
||||
type: 'string',
|
||||
ignore: $th.hasClass('ignore'),
|
||||
sort: !$th.hasClass('sort-disabled'),
|
||||
mergeRows: $th.attr('merge-rows')
|
||||
}, $th.data()));
|
||||
});
|
||||
|
||||
$t.children('tbody').children('tr').each(function() {
|
||||
$tr = $(this);
|
||||
row = $.extend({
|
||||
data: [],
|
||||
checked: false,
|
||||
cssClass: $tr.attr('class'),
|
||||
css: $tr.attr('style'),
|
||||
id: $tr.attr('id')
|
||||
}, $tr.data());
|
||||
|
||||
$tr.children('td').each(function() {
|
||||
$td = $(this);
|
||||
colSpan = $td.attr('colspan') || 1;
|
||||
row.data.push($.extend({
|
||||
cssClass: $td.attr('class'),
|
||||
css: $td.attr('style'),
|
||||
text: $td.html(),
|
||||
colSpan: colSpan,
|
||||
title: $td.attr('title')
|
||||
}, $td.data()));
|
||||
|
||||
if(colSpan > 1) {
|
||||
for(i = 1; i < colSpan; i++) {
|
||||
row.data.push({
|
||||
empty: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rows.push(row);
|
||||
});
|
||||
|
||||
var $tfoot = $t.children('tfoot');
|
||||
if($tfoot.length) {
|
||||
data.footer = $('<table class="table' + options.tableClass + '"></table>').append($tfoot);
|
||||
}
|
||||
} else {
|
||||
throw new Error('No data avaliable!');
|
||||
}
|
||||
}
|
||||
|
||||
data.flexStart = -1;
|
||||
data.flexEnd = -1;
|
||||
|
||||
cols = data.cols;
|
||||
data.colsLength = cols.length;
|
||||
for(var i = 0; i < data.colsLength; ++i) {
|
||||
var col = cols[i];
|
||||
if(col.flex) {
|
||||
if(data.flexStart < 0) {
|
||||
data.flexStart = i;
|
||||
}
|
||||
|
||||
data.flexEnd = i;
|
||||
}
|
||||
}
|
||||
|
||||
if(data.flexStart === 0 && data.flexEnd === data.colsLength) {
|
||||
data.flexStart = -1;
|
||||
data.flexEnd = -1;
|
||||
}
|
||||
|
||||
data.flexArea = data.flexStart >= 0;
|
||||
data.fixedRight = data.flexEnd >= 0 && data.flexEnd < (data.colsLength - 1);
|
||||
data.fixedLeft = data.flexStart > 0;
|
||||
if(data.flexStart < 0 && data.flexEnd < 0) {
|
||||
data.fixedLeft = true;
|
||||
data.flexStart = data.colsLength;
|
||||
data.flexEnd = data.colsLength;
|
||||
}
|
||||
|
||||
this.data = data;
|
||||
|
||||
this.callEvent('afterLoad', {
|
||||
data: data
|
||||
});
|
||||
|
||||
this.render();
|
||||
};
|
||||
|
||||
// Render datatable
|
||||
DataTable.prototype.render = function() {
|
||||
var that = this;
|
||||
var $datatable = that.$datatable || (that.isTable ? $('<div class="datatable" id="' + that.id + '"/>') : that.$datatable),
|
||||
options = that.options,
|
||||
data = that.data,
|
||||
cols = that.data.cols,
|
||||
rows = that.data.rows;
|
||||
var checkable = options.checkable,
|
||||
$left,
|
||||
i,
|
||||
$right,
|
||||
$flex,
|
||||
dataRowSpan = '<div class="datatable-rows-span datatable-span"><div class="datatable-wrapper"><table class="table"></table></div></div>',
|
||||
dataHeadSpan = '<div class="datatable-head-span datatable-span"><div class="datatable-wrapper"><table class="table"><thead></thead></table></div></div>';
|
||||
|
||||
$datatable.children('.datatable-head, .datatable-rows, .scroll-wrapper').remove();
|
||||
|
||||
// Set css class to datatable by options
|
||||
$datatable.toggleClass('sortable', options.sortable);
|
||||
// $datatable.toggleClass('customizable', options.customizable);
|
||||
|
||||
// Head
|
||||
var $head = $('<div class="datatable-head"/>'),
|
||||
$tr,
|
||||
$th,
|
||||
col;
|
||||
$left = $('<tr class="datatable-row datatable-row-left"/>');
|
||||
$right = $('<tr class="datatable-row datatable-row-right"/>');
|
||||
$flex = $('<tr class="datatable-row datatable-row-flex"/>');
|
||||
for(i = 0; i < cols.length; i++) {
|
||||
col = cols[i];
|
||||
$tr = i < data.flexStart ? $left : ((i >= data.flexStart && i <= data.flexEnd) ? $flex : $right);
|
||||
if(i === 0 && checkable) {
|
||||
$tr.append('<th data-index="check" class="check-all check-btn"><i class="icon-check-empty"></i></th>');
|
||||
}
|
||||
if(col.ignore) continue;
|
||||
|
||||
$th = $('<th class="datatable-head-cell"/>');
|
||||
|
||||
// set sort class
|
||||
$th.toggleClass('sort-down', col.sort === 'down')
|
||||
.toggleClass('sort-up', col.sort === 'up')
|
||||
.toggleClass('sort-disabled', col.sort === false);
|
||||
|
||||
$th.addClass(col.cssClass)
|
||||
.addClass(col.colClass)
|
||||
.html(col.text)
|
||||
.attr({
|
||||
'data-index': i,
|
||||
'data-type': col.type,
|
||||
style: col.css
|
||||
}).css('width', col.width);
|
||||
$tr.append($th);
|
||||
}
|
||||
|
||||
var $headSpan;
|
||||
if(data.fixedLeft) {
|
||||
$headSpan = $(dataHeadSpan);
|
||||
$headSpan.addClass('fixed-left')
|
||||
// .find('.datatable-wrapper')
|
||||
// .append('<div class="size-handle size-handle-head size-handle-left"></div>')
|
||||
.find('table')
|
||||
.addClass(options.tableClass)
|
||||
.find('thead').append($left);
|
||||
$head.append($headSpan);
|
||||
}
|
||||
if(data.flexArea) {
|
||||
$headSpan = $(dataHeadSpan);
|
||||
$headSpan.addClass('flexarea')
|
||||
.find('.datatable-wrapper')
|
||||
.append('<div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div>')
|
||||
.find('table')
|
||||
.addClass(options.tableClass)
|
||||
.find('thead').append($flex);
|
||||
$head.append($headSpan);
|
||||
}
|
||||
if(data.fixedRight) {
|
||||
$headSpan = $(dataHeadSpan);
|
||||
$headSpan.addClass('fixed-right')
|
||||
// .find('.datatable-wrapper')
|
||||
// .append('<div class="size-handle size-handle-head size-handle-right"></div>')
|
||||
.find('table')
|
||||
.addClass(options.tableClass)
|
||||
.find('thead').append($right);
|
||||
$head.append($headSpan);
|
||||
}
|
||||
$datatable.append($head);
|
||||
|
||||
// Rows
|
||||
var $rows = $('<div class="datatable-rows">');
|
||||
var $leftRow,
|
||||
$flexRow,
|
||||
$rightRow,
|
||||
// $tr,
|
||||
$td,
|
||||
$cTd,
|
||||
row,
|
||||
rowLen = rows.length,
|
||||
rowCol,
|
||||
rowColLen;
|
||||
$left = $('<tbody/>');
|
||||
$right = $('<tbody/>');
|
||||
$flex = $('<tbody/>');
|
||||
|
||||
for(var r = 0; r < rowLen; ++r) {
|
||||
row = rows[r];
|
||||
|
||||
// format row
|
||||
if(typeof row.id === 'undefined') {
|
||||
row.id = r;
|
||||
}
|
||||
row.index = r;
|
||||
|
||||
$leftRow = $('<tr class="datatable-row"/>');
|
||||
$leftRow.addClass(row.cssClass)
|
||||
.toggleClass(options.checkedClass, !!row.checked)
|
||||
.attr({
|
||||
'data-index': r,
|
||||
'data-id': row.id
|
||||
});
|
||||
$flexRow = $leftRow.clone().addClass('datatable-row-flex');
|
||||
$rightRow = $leftRow.clone().addClass('datatable-row-right');
|
||||
$leftRow.addClass('datatable-row-left');
|
||||
|
||||
rowColLen = row.data.length;
|
||||
for(i = 0; i < rowColLen; ++i) {
|
||||
rowCol = row.data[i];
|
||||
if(i > 0 && rowCol.empty) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tr = i < data.flexStart ? $leftRow : ((i >= data.flexStart && i <= data.flexEnd) ? $flexRow : $rightRow);
|
||||
if(i === 0 && checkable) {
|
||||
$cTd = $('<td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td>');
|
||||
if(options.checkboxName) {
|
||||
$cTd.append('<input class="hide" type="checkbox" name="' + options.checkboxName + '" value="' + row.id + '">');
|
||||
}
|
||||
$tr.append($cTd);
|
||||
}
|
||||
|
||||
if(cols[i].ignore) continue;
|
||||
|
||||
// format row column
|
||||
if(!$.isPlainObject(rowCol)) {
|
||||
rowCol = {
|
||||
text: rowCol,
|
||||
row: r,
|
||||
index: i
|
||||
};
|
||||
} else {
|
||||
rowCol.row = r;
|
||||
rowCol.index = i;
|
||||
}
|
||||
row.data[i] = rowCol;
|
||||
|
||||
$td = $('<td class="datatable-cell"/>');
|
||||
|
||||
$td.html(rowCol.text)
|
||||
.addClass(rowCol.cssClass)
|
||||
.addClass(cols[i].colClass)
|
||||
.attr('colspan', rowCol.colSpan)
|
||||
.attr({
|
||||
'data-row': r,
|
||||
'data-index': i,
|
||||
'data-flex': false,
|
||||
'data-type': cols[i].type,
|
||||
style: rowCol.css,
|
||||
title: rowCol.title || ''
|
||||
}).css('width', cols[i].width);
|
||||
|
||||
|
||||
$tr.append($td);
|
||||
}
|
||||
|
||||
$left.append($leftRow);
|
||||
$flex.append($flexRow);
|
||||
$right.append($rightRow);
|
||||
}
|
||||
|
||||
|
||||
var $rowSpan;
|
||||
if(data.fixedLeft) {
|
||||
$rowSpan = $(dataRowSpan);
|
||||
$rowSpan.addClass('fixed-left')
|
||||
.find('table')
|
||||
.addClass(options.tableClass)
|
||||
.append($left);
|
||||
$rows.append($rowSpan);
|
||||
}
|
||||
if(data.flexArea) {
|
||||
$rowSpan = $(dataRowSpan);
|
||||
$rowSpan.addClass('flexarea')
|
||||
.find('.datatable-wrapper')
|
||||
.append('<div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div>')
|
||||
.find('table')
|
||||
.addClass(options.tableClass)
|
||||
.append($flex);
|
||||
$rows.append($rowSpan);
|
||||
}
|
||||
if(data.fixedRight) {
|
||||
$rowSpan = $(dataRowSpan);
|
||||
$rowSpan.addClass('fixed-right')
|
||||
.find('table')
|
||||
.addClass(options.tableClass)
|
||||
.append($right);
|
||||
$rows.append($rowSpan);
|
||||
}
|
||||
$datatable.append($rows);
|
||||
|
||||
if(data.flexArea) {
|
||||
$datatable.append('<div class="scroll-wrapper"><div class="scroll-slide scroll-pos-' + options.scrollPos + '"><div class="bar"></div></div></div>');
|
||||
}
|
||||
|
||||
var $oldFooter = $datatable.children('.datatable-footer').detach();
|
||||
if(data.footer) {
|
||||
$datatable.append($('<div class="datatable-footer"/>').append(data.footer));
|
||||
data.footer = null;
|
||||
} else if($oldFooter.length) {
|
||||
$datatable.append($oldFooter);
|
||||
}
|
||||
|
||||
that.$datatable = $datatable.data(name, that);
|
||||
if(that.isTable && that.firstShow) {
|
||||
that.$table.attr('data-datatable-id', this.id).hide().after($datatable);
|
||||
that.firstShow = false;
|
||||
}
|
||||
|
||||
that.bindEvents();
|
||||
that.refreshSize();
|
||||
that.callEvent('render');
|
||||
};
|
||||
|
||||
// Bind global events
|
||||
DataTable.prototype.bindEvents = function() {
|
||||
var that = this,
|
||||
data = this.data,
|
||||
options = this.options,
|
||||
$datatable = this.$datatable;
|
||||
|
||||
var $dataSpans = that.$dataSpans = $datatable.children('.datatable-head, .datatable-rows').find('.datatable-span');
|
||||
var $rowsSpans = that.$rowsSpans = $datatable.children('.datatable-rows').children('.datatable-rows-span');
|
||||
var $headSpans = that.$headSpans = $datatable.children('.datatable-head').children('.datatable-head-span');
|
||||
var $cells = that.$cells = $dataSpans.find('.datatable-head-cell,.datatable-cell');
|
||||
var $dataCells = that.$dataCells = $cells.filter('.datatable-cell');
|
||||
that.$headCells = $cells.filter('.datatable-head-cell');
|
||||
var $rows = that.$rows = that.$rowsSpans.find('.datatable-row');
|
||||
|
||||
// handle row hover events
|
||||
if(options.rowHover) {
|
||||
var hoverClass = options.hoverClass;
|
||||
$rowsSpans.on('mouseenter', '.datatable-cell', function() {
|
||||
$dataCells.filter('.' + hoverClass).removeClass(hoverClass);
|
||||
$rows.filter('.' + hoverClass).removeClass(hoverClass);
|
||||
|
||||
$rows.filter('[data-index="' + $(this).addClass(hoverClass).data('row') + '"]').addClass(hoverClass);
|
||||
}).on('mouseleave', '.datatable-cell', function() {
|
||||
$dataCells.filter('.' + hoverClass).removeClass(hoverClass);
|
||||
$rows.filter('.' + hoverClass).removeClass(hoverClass);
|
||||
});
|
||||
}
|
||||
|
||||
// handle col hover events
|
||||
if(options.colHover) {
|
||||
var colHoverClass = options.colHoverClass;
|
||||
$headSpans.on('mouseenter', '.datatable-head-cell', function() {
|
||||
$cells.filter('.' + colHoverClass).removeClass(colHoverClass);
|
||||
$cells.filter('[data-index="' + $(this).data('index') + '"]').addClass(colHoverClass);
|
||||
}).on('mouseleave', '.datatable-head-cell', function() {
|
||||
$cells.filter('.' + colHoverClass).removeClass(colHoverClass);
|
||||
});
|
||||
}
|
||||
|
||||
// handle srcoll for flex area
|
||||
if(data.flexArea) {
|
||||
var $scrollbar = $datatable.find('.scroll-slide'),
|
||||
// $flexArea = $datatable.find('.datatable-span.flexarea .table'),
|
||||
$flexArea = $datatable.find('.datatable-span.flexarea'),
|
||||
$fixedLeft = $datatable.find('.datatable-span.fixed-left'),
|
||||
// $flexTable = $datatable.find('.datatable-rows-span.flexarea .table');
|
||||
$flexTable = $datatable.find('.datatable-span.flexarea .table-datatable');
|
||||
var $bar = $scrollbar.children('.bar'),
|
||||
flexWidth,
|
||||
scrollWidth,
|
||||
tableWidth,
|
||||
lastBarLeft,
|
||||
barLeft,
|
||||
scrollOffsetStoreName = that.id + '_' + 'scrollOffset',
|
||||
firtScroll,
|
||||
left;
|
||||
|
||||
that.width = $datatable.width();
|
||||
$datatable.resize(function() {
|
||||
that.width = $datatable.width();
|
||||
});
|
||||
|
||||
var srollTable = function(offset, silence) {
|
||||
barLeft = Math.max(0, Math.min(flexWidth - scrollWidth, offset));
|
||||
if(!silence) {
|
||||
$datatable.addClass('scrolling');
|
||||
}
|
||||
$bar.css('left', barLeft);
|
||||
left = 0 - Math.floor((tableWidth - flexWidth) * barLeft / (flexWidth - scrollWidth));
|
||||
$flexTable.css('left', left);
|
||||
lastBarLeft = barLeft;
|
||||
|
||||
$datatable.toggleClass('scrolled-in', barLeft > 2)
|
||||
.toggleClass('scrolled-out', barLeft < flexWidth - scrollWidth - 2);
|
||||
|
||||
if(options.storage) store.pageSet(scrollOffsetStoreName, barLeft);
|
||||
};
|
||||
var resizeScrollbar = function() {
|
||||
flexWidth = $flexArea.width();
|
||||
$scrollbar.width(flexWidth).css('left', $fixedLeft.width());
|
||||
tableWidth = 0;
|
||||
tableWidth = $flexTable.width();
|
||||
scrollWidth = Math.floor((flexWidth * flexWidth) / tableWidth);
|
||||
$bar.css('width', scrollWidth);
|
||||
$flexTable.css('min-width', flexWidth);
|
||||
$datatable.toggleClass('show-scroll-slide', tableWidth > flexWidth);
|
||||
|
||||
if(!firtScroll && flexWidth !== scrollWidth) {
|
||||
firtScroll = true;
|
||||
srollTable(store.pageGet(scrollOffsetStoreName, 0), true); // todo: unused?
|
||||
}
|
||||
|
||||
if($datatable.hasClass('size-changing')) {
|
||||
srollTable(barLeft, true);
|
||||
}
|
||||
};
|
||||
// $scrollbar.resize(resizeScrollbar); // todo: unuseful?
|
||||
$flexArea.resize(resizeScrollbar);
|
||||
if(options.storage) resizeScrollbar();
|
||||
|
||||
var dragOptions = {
|
||||
move: false,
|
||||
stopPropagation: true,
|
||||
drag: function(e) {
|
||||
srollTable($bar.position().left + e.smallOffset.x * (e.element.hasClass('bar') ? 1 : -1));
|
||||
},
|
||||
finish: function() {
|
||||
$datatable.removeClass('scrolling');
|
||||
}
|
||||
};
|
||||
|
||||
if($.fn.draggable) {
|
||||
$bar.draggable(dragOptions);
|
||||
if(options.flexHeadDrag) {
|
||||
$datatable.find('.datatable-head-span.flexarea').draggable(dragOptions);
|
||||
}
|
||||
} else {
|
||||
console.error('DataTable requires draggable.js to improve UI.');
|
||||
}
|
||||
|
||||
$scrollbar.mousedown(function(event) {
|
||||
var x = event.pageX - $scrollbar.offset().left;
|
||||
srollTable(x - (scrollWidth / 2));
|
||||
});
|
||||
}
|
||||
|
||||
// handle row check events
|
||||
if(options.checkable) {
|
||||
var checkedStatusStoreName = that.id + '_checkedStatus',
|
||||
checkedClass = options.checkedClass,
|
||||
rowId;
|
||||
var syncChecks = function() {
|
||||
var $checkRows = $rowsSpans.first().find('.datatable-row');
|
||||
var $checkedRows = $checkRows.filter('.' + checkedClass);
|
||||
if(options.checkboxName) $checkRows.find('.check-row input:checkbox').prop('checked', false);
|
||||
var checkedStatus = {
|
||||
checkedAll: $checkRows.length === $checkedRows.length && $checkedRows.length > 0,
|
||||
checks: $checkedRows.map(function() {
|
||||
rowId = $(this).data('id');
|
||||
if(options.checkboxName) {
|
||||
$(this).find('.check-row input:checkbox').prop('checked', true);
|
||||
}
|
||||
return rowId;
|
||||
}).toArray()
|
||||
};
|
||||
that.checks = checkedStatus;
|
||||
$.each(data.rows, function(index, value) {
|
||||
value.checked = ($.inArray(value.id, checkedStatus.checks) > -1);
|
||||
});
|
||||
$headSpans.find('.check-all').toggleClass('checked', !!checkedStatus.checkedAll);
|
||||
|
||||
if(options.storage) store.pageSet(checkedStatusStoreName, checkedStatus);
|
||||
|
||||
that.callEvent('checksChanged', {
|
||||
checks: checkedStatus
|
||||
});
|
||||
};
|
||||
|
||||
var toggleRowClass = function(ele, toggle) {
|
||||
var $tr = $(ele).closest('tr');
|
||||
if(toggle === undefined) toggle = !$tr.hasClass(checkedClass);
|
||||
$rows.filter('[data-index="' + $tr.data('index') + '"]').toggleClass(checkedClass, !!toggle);
|
||||
};
|
||||
|
||||
var checkEventPrefix = 'click.zui.datatable.check';
|
||||
if(options.selectable) {
|
||||
var selectableOptions = {
|
||||
selector: '.datatable-rows .datatable-row',
|
||||
trigger: '.datatable-rows',
|
||||
start: function(e) {
|
||||
var $checkRow = $(e.target).closest('.check-row, .check-btn');
|
||||
if($checkRow.length) {
|
||||
if($checkRow.is('.check-row')) {
|
||||
toggleRowClass($checkRow);
|
||||
syncChecks();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
rangeFunc: function(range, targetRange) {
|
||||
return Math.max(range.top, targetRange.top) < Math.min(range.top + range.height, targetRange.top + targetRange.height);
|
||||
},
|
||||
select: function(e) {
|
||||
toggleRowClass(e.target, true);
|
||||
},
|
||||
unselect: function(e) {
|
||||
toggleRowClass(e.target, false);
|
||||
},
|
||||
finish: function(e) {
|
||||
syncChecks();
|
||||
}
|
||||
};
|
||||
if($.isPlainObject(options.selectable)) {
|
||||
$.extend(selectableOptions, options.selectable);
|
||||
}
|
||||
this.$datatable.selectable(selectableOptions);
|
||||
} else {
|
||||
this.$rowsSpans.off(checkEventPrefix).on(checkEventPrefix + 'row', options.checkByClickRow ? 'tr' : '.check-row', function() {
|
||||
toggleRowClass(this);
|
||||
syncChecks();
|
||||
});
|
||||
}
|
||||
|
||||
this.$datatable.off(checkEventPrefix).on('click.zui.datatable.check', '.check-all', function() {
|
||||
$rows.toggleClass(checkedClass, $(this).toggleClass('checked').hasClass('checked'));
|
||||
syncChecks();
|
||||
}).on(checkEventPrefix + '.none', '.check-none', function() {
|
||||
$rows.toggleClass(checkedClass, false);
|
||||
syncChecks();
|
||||
}).on(checkEventPrefix + '.inverse', '.check-inverse', function() {
|
||||
$rows.toggleClass(checkedClass);
|
||||
syncChecks();
|
||||
});
|
||||
|
||||
if(options.storage) {
|
||||
var checkedStatus = store.pageGet(checkedStatusStoreName);
|
||||
if(checkedStatus) {
|
||||
$headSpans.find('.check-all').toggleClass('checked', checkedStatus.checkedAll);
|
||||
if(checkedStatus.checkedAll) {
|
||||
$rows.addClass(checkedClass);
|
||||
} else {
|
||||
$rows.removeClass(checkedClass);
|
||||
$.each(checkedStatus.checks, function(index, ele) {
|
||||
$rows.filter('[data-id="' + ele + '"]').addClass(checkedClass);
|
||||
});
|
||||
}
|
||||
if(checkedStatus.checks.length) {
|
||||
syncChecks();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fixed header
|
||||
if(options.fixedHeader) {
|
||||
var offsetTop,
|
||||
height,
|
||||
scrollTop,
|
||||
$dataTableHead = $datatable.children('.datatable-head'),
|
||||
navbarHeight = options.fixedHeaderOffset || $('.navbar.navbar-fixed-top').height() || 0;
|
||||
var handleScroll = function() {
|
||||
offsetTop = $datatable.offset().top;
|
||||
scrollTop = $(window).scrollTop();
|
||||
height = $datatable.height();
|
||||
$datatable.toggleClass('head-fixed', (scrollTop + navbarHeight) > offsetTop && (scrollTop + navbarHeight) < (offsetTop + height));
|
||||
if($datatable.hasClass('head-fixed')) {
|
||||
$dataTableHead.css({
|
||||
width: $datatable.width(),
|
||||
top: navbarHeight
|
||||
});
|
||||
} else {
|
||||
$dataTableHead.attr('style', '');
|
||||
}
|
||||
};
|
||||
|
||||
$(window).scroll(handleScroll);
|
||||
handleScroll();
|
||||
}
|
||||
|
||||
// handle sort
|
||||
if(options.sortable) {
|
||||
$headSpans.on('click', 'th:not(.sort-disabled, .check-btn)', function() {
|
||||
if($datatable.hasClass('size-changing')) return;
|
||||
that.sortTable($(this));
|
||||
});
|
||||
|
||||
if(options.storage) that.sortTable();
|
||||
} else if(options.mergeRows) {
|
||||
this.mergeRows();
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.prototype.mergeRows = function() {
|
||||
var $cells = this.$rowsSpans.find('.datatable-cell');
|
||||
var cols = this.data.cols;
|
||||
for(var i = 0; i < cols.length; i++) {
|
||||
var col = cols[i];
|
||||
if(col.mergeRows) {
|
||||
var $cs = $cells.filter('[data-index="' + i + '"]');
|
||||
if($cs.length > 1) {
|
||||
var $lastCell, rowspan;
|
||||
$cs.each(function() {
|
||||
var $cell = $(this);
|
||||
if($lastCell) {
|
||||
if($cell.html() === $lastCell.html()) {
|
||||
rowspan = $lastCell.attr('rowspan') || 1;
|
||||
if(typeof rowspan !== 'number') {
|
||||
rowspan = parseInt(rowspan);
|
||||
if(isNaN(rowspan)) rowspan = 1;
|
||||
}
|
||||
|
||||
$lastCell.attr('rowspan', rowspan + 1).css('vertical-align', 'middle');
|
||||
$cell.remove();
|
||||
} else {
|
||||
$lastCell = $cell;
|
||||
}
|
||||
} else {
|
||||
$lastCell = $cell;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Sort table
|
||||
DataTable.prototype.sortTable = function($th) {
|
||||
var store = $.zui.store,
|
||||
options = this.options;
|
||||
var sorterStoreName = this.id + '_datatableSorter';
|
||||
var sorter = options.storage ? store.pageGet(sorterStoreName) : null;
|
||||
|
||||
// sort-down: desc
|
||||
// sort-up: asc
|
||||
|
||||
if(!$th) {
|
||||
if(sorter) {
|
||||
$th = this.$headCells.filter('[data-index="' + sorter.index + '"]').addClass('sort-' + (sorter.type === 'up' ? 'down' : 'up'));
|
||||
} else {
|
||||
$th = this.$headCells.filter('.sort-up, .sort-down').first();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$th.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = this.data;
|
||||
var cols = data.cols,
|
||||
rows = data.rows,
|
||||
$headCells = this.$headCells,
|
||||
sortUp,
|
||||
type,
|
||||
index;
|
||||
|
||||
sortUp = !$th.hasClass('sort-up');
|
||||
if(data.keepSort) sortUp = !sortUp;
|
||||
data.keepSort = null;
|
||||
|
||||
$headCells.removeClass('sort-up sort-down');
|
||||
$th.addClass(sortUp ? 'sort-up' : 'sort-down');
|
||||
|
||||
index = $th.data('index');
|
||||
|
||||
$.each(cols, function(idx, col) {
|
||||
if(idx != index && (col.sort === 'up' || col.sort === 'down')) {
|
||||
col.sort = true;
|
||||
} else if(idx == index) {
|
||||
col.sort = sortUp ? 'up' : 'down';
|
||||
type = col.type;
|
||||
}
|
||||
});
|
||||
|
||||
var valA, valB, result, $dataRows = this.$dataCells.filter('[data-index="' + index + '"]');
|
||||
rows.sort(function(cellA, cellB) {
|
||||
cellA = cellA.data[index];
|
||||
cellB = cellB.data[index];
|
||||
valA = $dataRows.filter('[data-row="' + cellA.row + '"]').text();
|
||||
valB = $dataRows.filter('[data-row="' + cellB.row + '"]').text();
|
||||
if(type === 'number') {
|
||||
valA = parseFloat(valA);
|
||||
valB = parseFloat(valB);
|
||||
} else if(type === 'date') {
|
||||
valA = Date.parse(valA);
|
||||
valB = Date.parse(valB);
|
||||
} else {
|
||||
valA = valA.toLowerCase();
|
||||
valB = valB.toLowerCase();
|
||||
}
|
||||
result = valA < valB ? 1 : (valA > valB ? -1 : 0);
|
||||
if(sortUp) {
|
||||
result = result * (-1);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
var $rows = this.$rows,
|
||||
lastRows = [],
|
||||
$row, $lastRow, $r;
|
||||
$.each(rows, function(idx, row) {
|
||||
$row = $rows.filter('[data-index="' + row.index + '"]');
|
||||
$row.each(function(rIdx) {
|
||||
$r = $(this);
|
||||
$lastRow = lastRows[rIdx];
|
||||
if($lastRow) {
|
||||
$lastRow.after($r);
|
||||
} else {
|
||||
$r.parent().prepend($r);
|
||||
}
|
||||
lastRows[rIdx] = $r;
|
||||
});
|
||||
});
|
||||
|
||||
sorter = {
|
||||
index: index,
|
||||
type: sortUp ? 'up' : 'down'
|
||||
};
|
||||
|
||||
// save sort with local storage
|
||||
if(options.storage) store.pageSet(sorterStoreName, sorter);
|
||||
|
||||
this.callEvent('sort', {
|
||||
sorter: sorter
|
||||
});
|
||||
};
|
||||
|
||||
// Refresh size
|
||||
DataTable.prototype.refreshSize = function() {
|
||||
var $datatable = this.$datatable,
|
||||
options = this.options,
|
||||
rows = this.data.rows,
|
||||
cols = this.data.cols,
|
||||
i;
|
||||
|
||||
$datatable.find('.datatable-span.fixed-left').css('width', options.fixedLeftWidth);
|
||||
$datatable.find('.datatable-span.fixed-right').css('width', options.fixedRightWidth);
|
||||
|
||||
if(options.fixCellHeight) {
|
||||
var findMaxHeight = function($cells) {
|
||||
var mx = 0,
|
||||
$cell, rowSpan;
|
||||
$cells.css('height', 'auto');
|
||||
$cells.each(function() {
|
||||
$cell = $(this);
|
||||
rowSpan = $cell.attr('rowspan');
|
||||
if(!rowSpan || rowSpan == 1) mx = Math.max(mx, $cell.outerHeight());
|
||||
});
|
||||
return mx;
|
||||
};
|
||||
var $dataCells = this.$dataCells,
|
||||
$cells = this.$cells,
|
||||
$headCells = this.$headCells;
|
||||
|
||||
// set height of head cells
|
||||
var headMaxHeight = findMaxHeight($headCells);
|
||||
$headCells.css('min-height', headMaxHeight).css('height', headMaxHeight);
|
||||
|
||||
// set height of data cells
|
||||
var $rowCells;
|
||||
for(i = 0; i < rows.length; ++i) {
|
||||
$rowCells = $dataCells.filter('[data-row="' + i + '"]');
|
||||
var rowMaxHeight = findMaxHeight($rowCells);
|
||||
$rowCells.css('min-height', rowMaxHeight).css('height', rowMaxHeight);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Call event
|
||||
DataTable.prototype.callEvent = function(name, params) {
|
||||
var result = this.$.callEvent(name + '.' + this.name, params, this).result;
|
||||
return !(result !== undefined && (!result));
|
||||
};
|
||||
|
||||
$.fn.datatable = function(option, newData) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(name);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(name, (data = new DataTable(this, options)));
|
||||
|
||||
if(typeof option == 'string') {
|
||||
if(option === 'load' && $.isPlainObject(newData) && (newData.keepSort === undefined || newData.keepSort === null)) newData.keepSort = true;
|
||||
data[option](newData);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.datatable.Constructor = DataTable;
|
||||
}(jQuery));
|
||||
6
root/res/zui/lib/datatable/zui.datatable.min.css
vendored
Normal file
6
root/res/zui/lib/datatable/zui.datatable.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 数据表格 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.datatable-head,.datatable-rows{display:table;width:100%;table-layout:fixed}.datatable{margin-bottom:20px}.datatable>.datatable-head{-webkit-transition:-webkit-box-shadow .2s;-o-transition:box-shadow .2s;transition:-webkit-box-shadow .2s;transition:box-shadow .2s;transition:box-shadow .2s,-webkit-box-shadow .2s}.datatable .table{margin:0;table-layout:fixed}.datatable .table>tbody>tr>td,.datatable .table>thead>tr>th{min-width:20px}.datatable .table>tbody>tr>td.check-btn,.datatable .table>thead>tr>th.check-btn{width:30px;color:#9b9b9b;text-align:center;cursor:pointer}.datatable .table>tbody>tr.active>td.check-btn,.datatable .table>tbody>tr.hover>td.check-btn,.datatable .table>tbody>tr>td.check-btn.checked,.datatable .table>tbody>tr>td.check-btn:hover,.datatable .table>thead>tr>th.check-btn.checked,.datatable .table>thead>tr>th.check-btn:hover{color:#4f4f4f}.datatable .table>tbody>tr.active>td.check-btn>.icon-check-empty:before,.datatable .table>tbody>tr>td.check-btn.checked>.icon-check-empty:before,.datatable .table>thead>tr>th.check-btn.checked>.icon-check-empty:before{content:'\e642'}.datatable .table>thead>tr>th.col-hover{background-color:#e2e2e2}.datatable .table>tbody>tr.hover>td,.datatable .table>tbody>tr>td.col-hover{background-color:#ebf2f9}.datatable .table>tbody>tr.active.hover td{background-color:#ffdea2}.datatable.head-fixed>.datatable-head{position:fixed;z-index:1030;-webkit-box-shadow:0 1px 4px 0 rgba(0,0,0,.15);box-shadow:0 1px 4px 0 rgba(0,0,0,.15)}.datatable.sortable .datatable-head-span .table>thead>tr>th{overflow:hidden;white-space:nowrap;cursor:pointer}.datatable.sortable .datatable-head-span .table>thead>tr>th.text-center{padding-right:0;padding-left:0}.datatable.sortable .datatable-head-span .table>thead>tr>th:after{display:inline-block;margin-left:5px;font-family:ZenIcon;font-size:14px;font-style:normal;font-weight:400;font-variant:normal;line-height:1;color:grey;text-transform:none;content:'\e6bd';speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.datatable.sortable .datatable-head-span .table>thead>tr>th.sort-down:after{color:#145ccd;content:'\e6b8'}.datatable.sortable .datatable-head-span .table>thead>tr>th.sort-up:after{color:#145ccd;content:'\e6b9'}.datatable.sortable .datatable-head-span .table>thead>tr>th.check-btn:after,.datatable.sortable .datatable-head-span .table>thead>tr>th.sort-disabled:after{display:none}.datatable.sortable .datatable-head-span .table>thead>tr>th.sort-disabled{cursor:default}.datatable-wrapper{position:relative}.datatable-span{display:table-cell;vertical-align:top}.datatable-span.flexarea{overflow:hidden}.datatable-span.flexarea.datatable-head-span.dragging{cursor:move!important}.datatable-span.flexarea .table{position:relative;top:0;left:0}.datatable-span.flexarea .scrolled-shadow{position:absolute;top:0;bottom:0;display:none;width:20px;-webkit-box-shadow:0 0 10px rgba(0,0,0,.15);box-shadow:0 0 10px rgba(0,0,0,.15);opacity:0;-webkit-transition:all .4s cubic-bezier(.175,.885,.32,1);-o-transition:all .4s cubic-bezier(.175,.885,.32,1);transition:all .4s cubic-bezier(.175,.885,.32,1)}.datatable-span.flexarea .scrolled-in-shadow{left:-30px}.datatable-span.flexarea .scrolled-out-shadow{right:-30px}.datatable>.scroll-wrapper{position:relative;width:100%}.datatable .scroll-slide{position:absolute;right:-1px;bottom:0;left:-1px;display:none;height:11px;background:#e5e5e5;background:rgba(128,128,128,.1);border:1px solid #e5e5e5;border-bottom:none;opacity:0;-webkit-transition:opacity .5s,background .3s;-o-transition:opacity .5s,background .3s;transition:opacity .5s,background .3s}.datatable .scroll-slide>.bar{position:absolute;top:0;left:0;min-width:50px;height:10px;cursor:move;background-color:#a6a6a6}.datatable .scroll-slide:hover>.bar{background-color:grey}.datatable .scroll-slide.scroll-pos-out{bottom:-14px;height:15px}.datatable .scroll-slide.scroll-pos-out>.bar{height:14px}.datatable.show-scroll-slide.scrolling .scroll-slide,.datatable.show-scroll-slide.scrolling .scrolled-shadow,.datatable.show-scroll-slide:hover .scroll-slide,.datatable.show-scroll-slide:hover .scrolled-shadow{opacity:1}.datatable.show-scroll-slide .scroll-slide,.datatable.show-scroll-slide .scrolled-shadow{display:block}.datatable.show-scroll-slide.scrolled-in .scrolled-in-shadow{left:-20px}.datatable.show-scroll-slide.scrolled-out .scrolled-out-shadow{right:-20px}
|
||||
7
root/res/zui/lib/datatable/zui.datatable.min.js
vendored
Normal file
7
root/res/zui/lib/datatable/zui.datatable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
239
root/res/zui/lib/datetimepicker/datetimepicker.css
Normal file
239
root/res/zui/lib/datetimepicker/datetimepicker.css
Normal file
@@ -0,0 +1,239 @@
|
||||
/*!
|
||||
* Datetimepicker for Bootstrap
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Licensed under the Apache License v2.0
|
||||
*/
|
||||
.datetimepicker {
|
||||
padding: 4px;
|
||||
margin-top: 1px;
|
||||
white-space: normal;
|
||||
border-radius: 4px;
|
||||
|
||||
direction: ltr;
|
||||
}
|
||||
.datetimepicker.datetimepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.datetimepicker.datetimepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
.datetimepicker > div {
|
||||
display: none;
|
||||
}
|
||||
.datetimepicker.minutes div.datetimepicker-minutes {
|
||||
display: block;
|
||||
}
|
||||
.datetimepicker.hours div.datetimepicker-hours {
|
||||
display: block;
|
||||
}
|
||||
.datetimepicker.days div.datetimepicker-days {
|
||||
display: block;
|
||||
}
|
||||
.datetimepicker.months div.datetimepicker-months {
|
||||
display: block;
|
||||
}
|
||||
.datetimepicker.years div.datetimepicker-years {
|
||||
display: block;
|
||||
}
|
||||
.datetimepicker table {
|
||||
margin: 0;
|
||||
}
|
||||
.datetimepicker table tr td.minute:hover {
|
||||
cursor: pointer;
|
||||
background: #eee;
|
||||
}
|
||||
.datetimepicker table tr td.hour:hover {
|
||||
cursor: pointer;
|
||||
background: #eee;
|
||||
}
|
||||
.datetimepicker table tr td.day:hover {
|
||||
cursor: pointer;
|
||||
background: #eee;
|
||||
}
|
||||
.datetimepicker table tr td span {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
margin: 1%;
|
||||
line-height: 54px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.datetimepicker table tr td span:hover {
|
||||
background: #eee;
|
||||
}
|
||||
.datetimepicker table tr td span.old {
|
||||
color: #999;
|
||||
}
|
||||
.datetimepicker .datetimepicker-hours span {
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
.datetimepicker .datetimepicker-minutes span {
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
.datetimepicker th.switch {
|
||||
width: 145px;
|
||||
}
|
||||
.datetimepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
.datetimepicker-dropdown,
|
||||
.datetimepicker-dropdown-left {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
[class*="datetimepicker-dropdown"]:before {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
content: '';
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-bottom-color: rgba(0, 0, 0, .2);
|
||||
border-left: 7px solid transparent;
|
||||
}
|
||||
[class*="datetimepicker-dropdown"]:after {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
content: '';
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #fff;
|
||||
border-left: 6px solid transparent;
|
||||
}
|
||||
[class*="datetimepicker-dropdown-top"]:before {
|
||||
display: inline-block;
|
||||
content: '';
|
||||
border-top: 7px solid #ccc;
|
||||
border-top-color: rgba(0, 0, 0, .2);
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 0;
|
||||
border-left: 7px solid transparent;
|
||||
}
|
||||
[class*="datetimepicker-dropdown-top"]:after {
|
||||
display: inline-block;
|
||||
content: '';
|
||||
border-top: 6px solid #fff;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 0;
|
||||
border-left: 6px solid transparent;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-left:before {
|
||||
top: -7px;
|
||||
right: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-left:after {
|
||||
top: -6px;
|
||||
right: 7px;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-right:before {
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-right:after {
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-left:before {
|
||||
right: 6px;
|
||||
bottom: -7px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-left:after {
|
||||
right: 7px;
|
||||
bottom: -6px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-right:before {
|
||||
bottom: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-right:after {
|
||||
bottom: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datetimepicker td,
|
||||
.datetimepicker th {
|
||||
width: 22px;
|
||||
height: 20px;
|
||||
padding: 3px 0;
|
||||
text-align: center;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.table-striped .datetimepicker td,
|
||||
.table-striped .datetimepicker th {
|
||||
background-color: transparent;
|
||||
}
|
||||
.datetimepicker td.old,
|
||||
.datetimepicker td.new {
|
||||
color: #999;
|
||||
}
|
||||
.datetimepicker td.disabled,
|
||||
.datetimepicker td.disabled:hover {
|
||||
color: #999;
|
||||
cursor: default;
|
||||
background: none;
|
||||
}
|
||||
.datetimepicker td.day.today {
|
||||
color: #fff;
|
||||
background-color: #f1a325;
|
||||
border-color: #f1a325;
|
||||
border-color: rgba(0, 0, 0, .1) rgba(0, 0, 0, .1) rgba(0, 0, 0, .25);
|
||||
}
|
||||
.datetimepicker td.day.active {
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
|
||||
background-color: #3280fc;
|
||||
border-color: #0462f7;
|
||||
border-color: rgba(0, 0, 0, .1) rgba(0, 0, 0, .1) rgba(0, 0, 0, .25);
|
||||
}
|
||||
.datetimepicker td.day.active:hover {
|
||||
background-color: #0462f7;
|
||||
}
|
||||
.datetimepicker td.day.today:hover,
|
||||
.datetimepicker td.day.today.active:hover {
|
||||
background-color: #d5890e;
|
||||
}
|
||||
.datetimepicker .datetimepicker-hours td span.hour_am,
|
||||
.datetimepicker .datetimepicker-hours td span.hour_pm {
|
||||
width: 14.6%;
|
||||
}
|
||||
.datetimepicker .datetimepicker-hours fieldset legend,
|
||||
.datetimepicker .datetimepicker-minutes fieldset legend {
|
||||
margin-bottom: inherit;
|
||||
line-height: 30px;
|
||||
}
|
||||
.datetimepicker td span.disabled,
|
||||
.datetimepicker td span.disabled:hover {
|
||||
color: #999;
|
||||
cursor: default;
|
||||
background: none;
|
||||
}
|
||||
.datetimepicker td span.active,
|
||||
.datetimepicker td span.active:hover,
|
||||
.datetimepicker td span.active.disabled,
|
||||
.datetimepicker td span.active.disabled:hover {
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
|
||||
background-color: #3280fc;
|
||||
border-color: #0462f7;
|
||||
border-color: rgba(0, 0, 0, .1) rgba(0, 0, 0, .1) rgba(0, 0, 0, .25);
|
||||
}
|
||||
.datetimepicker thead tr:first-child th,
|
||||
.datetimepicker tfoot tr:first-child th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.datetimepicker thead tr:first-child th:hover,
|
||||
.datetimepicker tfoot tr:first-child th:hover {
|
||||
background: #eee;
|
||||
}
|
||||
.input-group.date > .input-group-addon {
|
||||
border-left: none;
|
||||
}
|
||||
.input-append.date .add-on i,
|
||||
.input-prepend.date .add-on i,
|
||||
.input-group.date .input-group-addon span {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
1710
root/res/zui/lib/datetimepicker/datetimepicker.js
Normal file
1710
root/res/zui/lib/datetimepicker/datetimepicker.js
Normal file
File diff suppressed because it is too large
Load Diff
5
root/res/zui/lib/datetimepicker/datetimepicker.min.css
vendored
Normal file
5
root/res/zui/lib/datetimepicker/datetimepicker.min.css
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Datetimepicker for Bootstrap
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Licensed under the Apache License v2.0
|
||||
*/.datetimepicker{padding:4px;margin-top:1px;white-space:normal;border-radius:4px;direction:ltr}.datetimepicker.datetimepicker-rtl{direction:rtl}.datetimepicker.datetimepicker-rtl table tr td span{float:right}.datetimepicker>div{display:none}.datetimepicker.minutes div.datetimepicker-minutes{display:block}.datetimepicker.hours div.datetimepicker-hours{display:block}.datetimepicker.days div.datetimepicker-days{display:block}.datetimepicker.months div.datetimepicker-months{display:block}.datetimepicker.years div.datetimepicker-years{display:block}.datetimepicker table{margin:0}.datetimepicker table tr td.minute:hover{cursor:pointer;background:#eee}.datetimepicker table tr td.hour:hover{cursor:pointer;background:#eee}.datetimepicker table tr td.day:hover{cursor:pointer;background:#eee}.datetimepicker table tr td span{display:block;float:left;width:23%;height:54px;margin:1%;line-height:54px;cursor:pointer;border-radius:4px}.datetimepicker table tr td span:hover{background:#eee}.datetimepicker table tr td span.old{color:#999}.datetimepicker .datetimepicker-hours span{height:26px;line-height:26px}.datetimepicker .datetimepicker-minutes span{height:26px;line-height:26px}.datetimepicker th.switch{width:145px}.datetimepicker-inline{width:220px}.datetimepicker-dropdown,.datetimepicker-dropdown-left{top:0;left:0}[class*=datetimepicker-dropdown]:before{position:absolute;display:inline-block;content:'';border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,.2);border-left:7px solid transparent}[class*=datetimepicker-dropdown]:after{position:absolute;display:inline-block;content:'';border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent}[class*=datetimepicker-dropdown-top]:before{display:inline-block;content:'';border-top:7px solid #ccc;border-top-color:rgba(0,0,0,.2);border-right:7px solid transparent;border-bottom:0;border-left:7px solid transparent}[class*=datetimepicker-dropdown-top]:after{display:inline-block;content:'';border-top:6px solid #fff;border-right:6px solid transparent;border-bottom:0;border-left:6px solid transparent}.datetimepicker-dropdown-bottom-left:before{top:-7px;right:6px}.datetimepicker-dropdown-bottom-left:after{top:-6px;right:7px}.datetimepicker-dropdown-bottom-right:before{top:-7px;left:6px}.datetimepicker-dropdown-bottom-right:after{top:-6px;left:7px}.datetimepicker-dropdown-top-left:before{right:6px;bottom:-7px}.datetimepicker-dropdown-top-left:after{right:7px;bottom:-6px}.datetimepicker-dropdown-top-right:before{bottom:-7px;left:6px}.datetimepicker-dropdown-top-right:after{bottom:-6px;left:7px}.datetimepicker td,.datetimepicker th{width:22px;height:20px;padding:3px 0;text-align:center;border:none;border-radius:4px}.table-striped .datetimepicker td,.table-striped .datetimepicker th{background-color:transparent}.datetimepicker td.new,.datetimepicker td.old{color:#999}.datetimepicker td.disabled,.datetimepicker td.disabled:hover{color:#999;cursor:default;background:0 0}.datetimepicker td.day.today{color:#fff;background-color:#f1a325;border-color:#f1a325;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25)}.datetimepicker td.day.active{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#3280fc;border-color:#0462f7;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25)}.datetimepicker td.day.active:hover{background-color:#0462f7}.datetimepicker td.day.today.active:hover,.datetimepicker td.day.today:hover{background-color:#d5890e}.datetimepicker .datetimepicker-hours td span.hour_am,.datetimepicker .datetimepicker-hours td span.hour_pm{width:14.6%}.datetimepicker .datetimepicker-hours fieldset legend,.datetimepicker .datetimepicker-minutes fieldset legend{margin-bottom:inherit;line-height:30px}.datetimepicker td span.disabled,.datetimepicker td span.disabled:hover{color:#999;cursor:default;background:0 0}.datetimepicker td span.active,.datetimepicker td span.active.disabled,.datetimepicker td span.active.disabled:hover,.datetimepicker td span.active:hover{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#3280fc;border-color:#0462f7;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25)}.datetimepicker tfoot tr:first-child th,.datetimepicker thead tr:first-child th{cursor:pointer}.datetimepicker tfoot tr:first-child th:hover,.datetimepicker thead tr:first-child th:hover{background:#eee}.input-group.date>.input-group-addon{border-left:none}.input-append.date .add-on i,.input-group.date .input-group-addon span,.input-prepend.date .add-on i{width:14px;height:14px;cursor:pointer}
|
||||
7
root/res/zui/lib/datetimepicker/datetimepicker.min.js
vendored
Normal file
7
root/res/zui/lib/datetimepicker/datetimepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
179
root/res/zui/lib/hotkey/hotkey.js
Normal file
179
root/res/zui/lib/hotkey/hotkey.js
Normal file
@@ -0,0 +1,179 @@
|
||||
/* ========================================================================
|
||||
* jQuery Hotkeys Plugin
|
||||
* Based upon the plugin by Tzury Bar Yochay:
|
||||
* https://github.com/tzuryby/jquery.hotkeys
|
||||
*
|
||||
* ZUI: The file has been changed in ZUI. It will not keep update with the
|
||||
* official version in the future.
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* Original idea by:
|
||||
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery Hotkeys Plugin
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Based upon the plugin by Tzury Bar Yochay:
|
||||
* http://github.com/tzuryby/hotkeys
|
||||
*
|
||||
* Original idea by:
|
||||
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||
*/
|
||||
|
||||
(function(jQuery) {
|
||||
|
||||
jQuery.hotkeys = {
|
||||
version: "0.8",
|
||||
|
||||
specialKeys: {
|
||||
8: "backspace",
|
||||
9: "tab",
|
||||
13: "return",
|
||||
16: "shift",
|
||||
17: "ctrl",
|
||||
18: "alt",
|
||||
19: "pause",
|
||||
20: "capslock",
|
||||
27: "esc",
|
||||
32: "space",
|
||||
33: "pageup",
|
||||
34: "pagedown",
|
||||
35: "end",
|
||||
36: "home",
|
||||
37: "left",
|
||||
38: "up",
|
||||
39: "right",
|
||||
40: "down",
|
||||
45: "insert",
|
||||
46: "del",
|
||||
96: "0",
|
||||
97: "1",
|
||||
98: "2",
|
||||
99: "3",
|
||||
100: "4",
|
||||
101: "5",
|
||||
102: "6",
|
||||
103: "7",
|
||||
104: "8",
|
||||
105: "9",
|
||||
106: "*",
|
||||
107: "+",
|
||||
109: "-",
|
||||
110: ".",
|
||||
111: "/",
|
||||
112: "f1",
|
||||
113: "f2",
|
||||
114: "f3",
|
||||
115: "f4",
|
||||
116: "f5",
|
||||
117: "f6",
|
||||
118: "f7",
|
||||
119: "f8",
|
||||
120: "f9",
|
||||
121: "f10",
|
||||
122: "f11",
|
||||
123: "f12",
|
||||
144: "numlock",
|
||||
145: "scroll",
|
||||
191: "/",
|
||||
224: "meta"
|
||||
},
|
||||
|
||||
shiftNums: {
|
||||
"`": "~",
|
||||
"1": "!",
|
||||
"2": "@",
|
||||
"3": "#",
|
||||
"4": "$",
|
||||
"5": "%",
|
||||
"6": "^",
|
||||
"7": "&",
|
||||
"8": "*",
|
||||
"9": "(",
|
||||
"0": ")",
|
||||
"-": "_",
|
||||
"=": "+",
|
||||
";": ": ",
|
||||
"'": "\"",
|
||||
",": "<",
|
||||
".": ">",
|
||||
"/": "?",
|
||||
"\\": "|"
|
||||
}
|
||||
};
|
||||
|
||||
function keyHandler(handleObj) {
|
||||
// Only care when a possible input has been specified
|
||||
if(typeof handleObj.data !== "string") {
|
||||
return;
|
||||
}
|
||||
|
||||
var origHandler = handleObj.handler,
|
||||
keys = handleObj.data.toLowerCase().split(" ");
|
||||
|
||||
handleObj.handler = function(event) {
|
||||
// Don't fire in text-accepting inputs that we didn't directly bind to
|
||||
if(this !== event.target && (/textarea|select/i.test(event.target.nodeName) ||
|
||||
event.target.type === "text")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Keypress represents characters, not special keys
|
||||
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
|
||||
character = String.fromCharCode(event.which).toLowerCase(),
|
||||
key, modif = "",
|
||||
possible = {};
|
||||
|
||||
// check combinations (alt|ctrl|shift+anything)
|
||||
if(event.altKey && special !== "alt") {
|
||||
modif += "alt+";
|
||||
}
|
||||
|
||||
if(event.ctrlKey && special !== "ctrl") {
|
||||
modif += "ctrl+";
|
||||
}
|
||||
|
||||
// TODO: Need to make sure this works consistently across platforms
|
||||
if(event.metaKey && !event.ctrlKey && special !== "meta") {
|
||||
modif += "meta+";
|
||||
}
|
||||
|
||||
if(event.shiftKey && special !== "shift") {
|
||||
modif += "shift+";
|
||||
}
|
||||
|
||||
if(special) {
|
||||
possible[modif + special] = true;
|
||||
|
||||
} else {
|
||||
possible[modif + character] = true;
|
||||
possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
|
||||
|
||||
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
||||
if(modif === "shift+") {
|
||||
possible[jQuery.hotkeys.shiftNums[character]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0, l = keys.length; i < l; i++) {
|
||||
if(possible[keys[i]]) {
|
||||
return origHandler.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
jQuery.each(["keydown", "keyup", "keypress"], function() {
|
||||
jQuery.event.special[this] = {
|
||||
add: keyHandler
|
||||
};
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
12
root/res/zui/lib/hotkey/hotkey.min.js
vendored
Normal file
12
root/res/zui/lib/hotkey/hotkey.min.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/*!
|
||||
* jQuery Hotkeys Plugin
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Based upon the plugin by Tzury Bar Yochay:
|
||||
* http://github.com/tzuryby/hotkeys
|
||||
*
|
||||
* Original idea by:
|
||||
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||
*/
|
||||
!function(e){function t(t){if("string"==typeof t.data){var s=t.handler,a=t.data.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||!/textarea|select/i.test(t.target.nodeName)&&"text"!==t.target.type){var r="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],f=String.fromCharCode(t.which).toLowerCase(),i="",h={};t.altKey&&"alt"!==r&&(i+="alt+"),t.ctrlKey&&"ctrl"!==r&&(i+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==r&&(i+="meta+"),t.shiftKey&&"shift"!==r&&(i+="shift+"),r?h[i+r]=!0:(h[i+f]=!0,h[i+e.hotkeys.shiftNums[f]]=!0,"shift+"===i&&(h[e.hotkeys.shiftNums[f]]=!0));for(var o=0,c=a.length;o<c;o++)if(h[a[o]])return s.apply(this,arguments)}}}}e.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}})}(jQuery);
|
||||
14
root/res/zui/lib/ieonly/excanvas.js
Normal file
14
root/res/zui/lib/ieonly/excanvas.js
Normal file
File diff suppressed because one or more lines are too long
8
root/res/zui/lib/ieonly/html5shiv.js
vendored
Normal file
8
root/res/zui/lib/ieonly/html5shiv.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
|
||||
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
|
||||
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
|
||||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
|
||||
if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
|
||||
5
root/res/zui/lib/ieonly/respond.js
Normal file
5
root/res/zui/lib/ieonly/respond.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
||||
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
||||
* */
|
||||
|
||||
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
||||
120
root/res/zui/lib/imgcutter/zui.imgcutter.css
Normal file
120
root/res/zui/lib/imgcutter/zui.imgcutter.css
Normal file
@@ -0,0 +1,120 @@
|
||||
/*!
|
||||
* ZUI: 图片裁剪工具 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.img-cutter {
|
||||
padding: 10px;
|
||||
margin-bottom: 20px;
|
||||
background: #e5e5e5;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.img-cutter > .canvas {
|
||||
position: relative;
|
||||
min-width: 50px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.img-cutter > .canvas > .cover {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.img-cutter > .canvas > img {
|
||||
-webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: all .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.img-cutter > .canvas > .controller {
|
||||
position: absolute;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
z-index: 5;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
cursor: move;
|
||||
background: none;
|
||||
border: 1px dashed #fff;
|
||||
border-color: rgba(255, 255, 255, .7);
|
||||
-webkit-transition: opacity .4s cubic-bezier(.175, .885, .32, 1);
|
||||
-o-transition: opacity .4s cubic-bezier(.175, .885, .32, 1);
|
||||
transition: opacity .4s cubic-bezier(.175, .885, .32, 1);
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control {
|
||||
position: absolute;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background: #000;
|
||||
background: rgba(0, 0, 0, .6);
|
||||
border: 1px solid #fff;
|
||||
border-color: rgba(255, 255, 255, .6);
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='left'] {
|
||||
top: 50%;
|
||||
left: -4px;
|
||||
margin-top: -3px;
|
||||
cursor: w-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='top'] {
|
||||
top: -4px;
|
||||
left: 50%;
|
||||
margin-left: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='right'] {
|
||||
top: 50%;
|
||||
right: -4px;
|
||||
margin-top: -3px;
|
||||
cursor: e-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='bottom'] {
|
||||
bottom: -4px;
|
||||
left: 50%;
|
||||
margin-left: -3px;
|
||||
cursor: s-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='top-left'] {
|
||||
top: -4px;
|
||||
left: -4px;
|
||||
cursor: nw-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='top-right'] {
|
||||
top: -4px;
|
||||
right: -4px;
|
||||
cursor: ne-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='bottom-left'] {
|
||||
bottom: -4px;
|
||||
left: -4px;
|
||||
cursor: sw-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .controller > .control[data-direction='bottom-right'] {
|
||||
right: -4px;
|
||||
bottom: -4px;
|
||||
cursor: se-resize;
|
||||
}
|
||||
.img-cutter > .canvas > .cliper {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
clip: rect(0px, 50px, 50px, 0);
|
||||
}
|
||||
.img-cutter.hover > .canvas > img,
|
||||
.img-cutter.hover > .canvas > .controller > .cover {
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
}
|
||||
.img-cutter.hover > .canvas > .controller {
|
||||
display: none;
|
||||
}
|
||||
280
root/res/zui/lib/imgcutter/zui.imgcutter.js
Normal file
280
root/res/zui/lib/imgcutter/zui.imgcutter.js
Normal file
@@ -0,0 +1,280 @@
|
||||
/*!
|
||||
* ZUI: 图片裁剪工具 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: img-cutter.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($, Math, undefined) {
|
||||
'use strict';
|
||||
|
||||
if(!$.fn.draggable) console.error('img-cutter requires draggable.js');
|
||||
if(!$.zui.imgReady) console.error('img-cutter requires image.ready.js');
|
||||
|
||||
var NAME = 'zui.imgCutter';
|
||||
|
||||
var ImgCutter = function(element, options) {
|
||||
this.$ = $(element);
|
||||
this.initOptions(options);
|
||||
this.init();
|
||||
};
|
||||
|
||||
ImgCutter.DEFAULTS = {
|
||||
coverColor: '#000',
|
||||
coverOpacity: 0.6,
|
||||
// fixedRatio: false,
|
||||
defaultWidth: 128,
|
||||
defaultHeight: 128,
|
||||
minWidth: 48,
|
||||
minHeight: 48
|
||||
}; // default options
|
||||
|
||||
ImgCutter.prototype.callEvent = function(name, params) {
|
||||
var result = this.$.callEvent(name + '.' + NAME, params, this);
|
||||
return !(result.result !== undefined && (!result.result));
|
||||
};
|
||||
|
||||
ImgCutter.prototype.initOptions = function(options) {
|
||||
this.options = $.extend({}, ImgCutter.DEFAULTS, this.$.data(), options);
|
||||
this.options.coverOpacityIE = this.options.coverOpacity * 100;
|
||||
this.clipWidth = this.options.defaultWidth;
|
||||
this.clipHeight = this.options.defaultHeight;
|
||||
};
|
||||
|
||||
ImgCutter.prototype.init = function() {
|
||||
this.initDom();
|
||||
this.initSize();
|
||||
this.bindEvents();
|
||||
};
|
||||
|
||||
ImgCutter.prototype.initDom = function() {
|
||||
this.$canvas = this.$.children('.canvas');
|
||||
this.$img = this.$canvas.children('img');
|
||||
this.$actions = this.$.children('.actions');
|
||||
this.$btn = this.$.find('.img-cutter-submit');
|
||||
this.$preview = this.$.find('.img-cutter-preview');
|
||||
|
||||
this.options.img = this.$img.attr('src');
|
||||
|
||||
this.$canvas.append('<div class="cover" style="background: {coverColor}; opacity: {coverOpacity}; filter:alpha(opacity={coverOpacityIE});"></div><div class="controller" style="width: {defaultWidth}px; height: {defaultHeight}px"><div class="control" data-direction="top"></div><div class="control" data-direction="right"></div><div class="control" data-direction="bottom"></div><div class="control" data-direction="left"></div><div class="control" data-direction="top-left"></div><div class="control" data-direction="top-right"></div><div class="control" data-direction="bottom-left"></div><div class="control" data-direction="bottom-right"></div></div><div class="cliper"><img src="{img}"/></div>'.format(this.options));
|
||||
|
||||
this.$cover = this.$canvas.children('.cover');
|
||||
this.$controller = this.$canvas.children('.controller');
|
||||
this.$cliper = this.$canvas.children('.cliper');
|
||||
this.$chipImg = this.$cliper.children('img');
|
||||
|
||||
if(this.options.fixedRatio) {
|
||||
this.$.addClass('fixed-ratio');
|
||||
}
|
||||
};
|
||||
|
||||
ImgCutter.prototype.resetImage = function(img) {
|
||||
var that = this;
|
||||
that.options.img = img;
|
||||
that.$img.attr('src', img);
|
||||
that.$chipImg.attr('src', img);
|
||||
that.imgWidth = undefined;
|
||||
that.left = undefined;
|
||||
that.initSize();
|
||||
};
|
||||
|
||||
ImgCutter.prototype.initSize = function() {
|
||||
var that = this;
|
||||
if(!that.imgWidth) {
|
||||
$.zui.imgReady(that.options.img, function() {
|
||||
that.imgWidth = this.width;
|
||||
that.imgHeight = this.height;
|
||||
that.callEvent('ready');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var waitImgWidth = setInterval(function() {
|
||||
if(that.imgWidth) {
|
||||
clearInterval(waitImgWidth);
|
||||
|
||||
that.width = Math.min(that.imgWidth, that.$.width());
|
||||
that.$canvas.css('width', this.width);
|
||||
that.$cliper.css('width', this.width);
|
||||
that.height = that.$canvas.height();
|
||||
|
||||
if(that.left === undefined) {
|
||||
that.left = Math.floor((that.width - that.$controller.width()) / 2);
|
||||
that.top = Math.floor((that.height - that.$controller.height()) / 2);
|
||||
}
|
||||
|
||||
that.refreshSize();
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
ImgCutter.prototype.refreshSize = function(ratioSide) {
|
||||
var options = this.options;
|
||||
|
||||
this.clipWidth = Math.max(options.minWidth, Math.min(this.width, this.clipWidth));
|
||||
this.clipHeight = Math.max(options.minHeight, Math.min(this.height, this.clipHeight));
|
||||
|
||||
if(options.fixedRatio) {
|
||||
if(ratioSide && ratioSide === 'height') {
|
||||
this.clipWidth = Math.max(options.minWidth, Math.min(this.width, this.clipHeight * options.defaultWidth / options.defaultHeight));
|
||||
this.clipHeight = this.clipWidth * options.defaultHeight / options.defaultWidth;
|
||||
} else {
|
||||
this.clipHeight = Math.max(options.minHeight, Math.min(this.height, this.clipWidth * options.defaultHeight / options.defaultWidth));
|
||||
this.clipWidth = this.clipHeight * options.defaultWidth / options.defaultHeight;
|
||||
}
|
||||
}
|
||||
|
||||
this.left = Math.min(this.width - this.clipWidth, Math.max(0, this.left));
|
||||
this.top = Math.min(this.height - this.clipHeight, Math.max(0, this.top));
|
||||
this.right = this.left + this.clipWidth;
|
||||
this.bottom = this.top + this.clipHeight;
|
||||
|
||||
this.$controller.css({
|
||||
left: this.left,
|
||||
top: this.top,
|
||||
width: this.clipWidth,
|
||||
height: this.clipHeight
|
||||
});
|
||||
this.$cliper.css('clip', 'rect({0}px {1}px {2}px {3}px'.format(this.top, this.left + this.clipWidth, this.top + this.clipHeight, this.left));
|
||||
|
||||
|
||||
this.callEvent('change', {
|
||||
top: this.top,
|
||||
left: this.left,
|
||||
bottom: this.bottom,
|
||||
right: this.right,
|
||||
width: this.clipWidth,
|
||||
height: this.clipHeight
|
||||
});
|
||||
};
|
||||
|
||||
ImgCutter.prototype.getData = function() {
|
||||
var that = this;
|
||||
that.data = {
|
||||
originWidth: that.imgWidth,
|
||||
originHeight: that.imgHeight,
|
||||
scaleWidth: that.width,
|
||||
scaleHeight: that.height,
|
||||
width: that.right - that.left,
|
||||
height: that.bottom - that.top,
|
||||
left: that.left,
|
||||
top: that.top,
|
||||
right: that.right,
|
||||
bottom: that.bottom,
|
||||
scaled: that.imgWidth != that.width || that.imgHeight != that.height
|
||||
};
|
||||
return that.data;
|
||||
};
|
||||
|
||||
ImgCutter.prototype.bindEvents = function() {
|
||||
var that = this,
|
||||
options = this.options;
|
||||
this.$.resize($.proxy(this.initSize, this));
|
||||
this.$btn.hover(function() {
|
||||
that.$.toggleClass('hover');
|
||||
}).click(function() {
|
||||
var data = that.getData();
|
||||
|
||||
if(!that.callEvent('before', data)) return;
|
||||
|
||||
var url = options.post || options.get || options.url || null;
|
||||
if(url !== null) {
|
||||
$.ajax({
|
||||
type: options.post ? 'POST' : 'GET',
|
||||
url: url,
|
||||
data: data
|
||||
})
|
||||
.done(function(e) {
|
||||
that.callEvent('done', e);
|
||||
}).fail(function(e) {
|
||||
that.callEvent('fail', e);
|
||||
}).always(function(e) {
|
||||
that.callEvent('always', e);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.$controller.draggable({
|
||||
move: false,
|
||||
container: this.$canvas,
|
||||
drag: function(e) {
|
||||
that.left += e.smallOffset.x;
|
||||
that.top += e.smallOffset.y;
|
||||
that.refreshSize();
|
||||
}
|
||||
});
|
||||
|
||||
this.$controller.children('.control').draggable({
|
||||
move: false,
|
||||
container: this.$canvas,
|
||||
stopPropagation: true,
|
||||
drag: function(e) {
|
||||
var dr = e.element.data('direction');
|
||||
var offset = e.smallOffset;
|
||||
var ratioSide = false;
|
||||
|
||||
switch(dr) {
|
||||
case 'left':
|
||||
case 'top-left':
|
||||
case 'bottom-left':
|
||||
that.left += offset.x;
|
||||
that.left = Math.min(that.right - options.minWidth, Math.max(0, that.left));
|
||||
that.clipWidth = that.right - that.left;
|
||||
break;
|
||||
case 'right':
|
||||
case 'top-right':
|
||||
case 'bottom-right':
|
||||
that.clipWidth += offset.x;
|
||||
that.clipWidth = Math.min(that.width - that.left, Math.max(options.minWidth, that.clipWidth));
|
||||
break;
|
||||
}
|
||||
switch(dr) {
|
||||
case 'top':
|
||||
case 'top-left':
|
||||
case 'top-right':
|
||||
that.top += offset.y;
|
||||
that.top = Math.min(that.bottom - options.minHeight, Math.max(0, that.top));
|
||||
that.clipHeight = that.bottom - that.top;
|
||||
ratioSide = true;
|
||||
break;
|
||||
case 'bottom':
|
||||
case 'bottom-left':
|
||||
case 'bottom-right':
|
||||
that.clipHeight += offset.y;
|
||||
that.clipHeight = Math.min(that.height - that.top, Math.max(options.minHeight, that.clipHeight));
|
||||
ratioSide = true;
|
||||
break;
|
||||
}
|
||||
|
||||
that.refreshSize(ratioSide);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.imgCutter = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(NAME);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(NAME, (data = new ImgCutter(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.imgCutter.Constructor = ImgCutter;
|
||||
|
||||
$(function() {
|
||||
$('[data-toggle="imgCutter"]').imgCutter();
|
||||
});
|
||||
}(jQuery, Math, undefined));
|
||||
|
||||
6
root/res/zui/lib/imgcutter/zui.imgcutter.min.css
vendored
Normal file
6
root/res/zui/lib/imgcutter/zui.imgcutter.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 图片裁剪工具 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.img-cutter{padding:10px;margin-bottom:20px;background:#e5e5e5;border:1px solid #ddd}.img-cutter>.canvas{position:relative;min-width:50px;max-width:100%;margin:0 auto}.img-cutter>.canvas>.cover{position:absolute;top:0;left:0;z-index:1;width:100%;height:100%;-webkit-transition:all .4s cubic-bezier(.175,.885,.32,1);-o-transition:all .4s cubic-bezier(.175,.885,.32,1);transition:all .4s cubic-bezier(.175,.885,.32,1)}.img-cutter>.canvas>img{-webkit-transition:all .4s cubic-bezier(.175,.885,.32,1);-o-transition:all .4s cubic-bezier(.175,.885,.32,1);transition:all .4s cubic-bezier(.175,.885,.32,1)}.img-cutter>.canvas>.controller{position:absolute;top:5%;left:5%;z-index:5;width:100px;height:100px;cursor:move;background:0 0;border:1px dashed #fff;border-color:rgba(255,255,255,.7);-webkit-transition:opacity .4s cubic-bezier(.175,.885,.32,1);-o-transition:opacity .4s cubic-bezier(.175,.885,.32,1);transition:opacity .4s cubic-bezier(.175,.885,.32,1)}.img-cutter>.canvas>.controller>.control{position:absolute;width:6px;height:6px;background:#000;background:rgba(0,0,0,.6);border:1px solid #fff;border-color:rgba(255,255,255,.6)}.img-cutter>.canvas>.controller>.control[data-direction=left]{top:50%;left:-4px;margin-top:-3px;cursor:w-resize}.img-cutter>.canvas>.controller>.control[data-direction=top]{top:-4px;left:50%;margin-left:-3px;cursor:n-resize}.img-cutter>.canvas>.controller>.control[data-direction=right]{top:50%;right:-4px;margin-top:-3px;cursor:e-resize}.img-cutter>.canvas>.controller>.control[data-direction=bottom]{bottom:-4px;left:50%;margin-left:-3px;cursor:s-resize}.img-cutter>.canvas>.controller>.control[data-direction=top-left]{top:-4px;left:-4px;cursor:nw-resize}.img-cutter>.canvas>.controller>.control[data-direction=top-right]{top:-4px;right:-4px;cursor:ne-resize}.img-cutter>.canvas>.controller>.control[data-direction=bottom-left]{bottom:-4px;left:-4px;cursor:sw-resize}.img-cutter>.canvas>.controller>.control[data-direction=bottom-right]{right:-4px;bottom:-4px;cursor:se-resize}.img-cutter>.canvas>.cliper{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;clip:rect(0,50px,50px,0)}.img-cutter.hover>.canvas>.controller>.cover,.img-cutter.hover>.canvas>img{filter:alpha(opacity=0);opacity:0}.img-cutter.hover>.canvas>.controller{display:none}
|
||||
7
root/res/zui/lib/imgcutter/zui.imgcutter.min.js
vendored
Normal file
7
root/res/zui/lib/imgcutter/zui.imgcutter.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
105
root/res/zui/lib/imgready/imgready.js
Normal file
105
root/res/zui/lib/imgready/imgready.js
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ========================================================================
|
||||
* TangBin: image.ready.js
|
||||
* http://www.planeart.cn/?p=1121
|
||||
*
|
||||
* ZUI: The file has been changed in ZUI. It will not keep update with the
|
||||
* original version in the future.
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* @version 2011.05.27
|
||||
* @author TangBin
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
/*! TangBin: image.ready.js http://www.planeart.cn/?p=1121 */
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Image ready
|
||||
* @param {String} image url
|
||||
* @param {Function} callback on image ready
|
||||
* @param {Function} callback on image load
|
||||
* @param {Function} callback on error
|
||||
* @example imgReady('image.png', function () {
|
||||
alert('size ready: width=' + this.width + '; height=' + this.height);
|
||||
});
|
||||
*/
|
||||
$.zui.imgReady = (function() {
|
||||
var list = [],
|
||||
intervalId = null,
|
||||
|
||||
// 用来执行队列
|
||||
tick = function() {
|
||||
var i = 0;
|
||||
for(; i < list.length; i++) {
|
||||
list[i].end ? list.splice(i--, 1) : list[i]();
|
||||
}!list.length && stop();
|
||||
},
|
||||
|
||||
// 停止所有定时器队列
|
||||
stop = function() {
|
||||
clearInterval(intervalId);
|
||||
intervalId = null;
|
||||
};
|
||||
|
||||
return function(url, ready, load, error) {
|
||||
var onready, width, height, newWidth, newHeight,
|
||||
img = new Image();
|
||||
|
||||
img.src = url;
|
||||
|
||||
// 如果图片被缓存,则直接返回缓存数据
|
||||
if(img.complete) {
|
||||
ready.call(img);
|
||||
load && load.call(img);
|
||||
return;
|
||||
}
|
||||
|
||||
width = img.width;
|
||||
height = img.height;
|
||||
|
||||
// 加载错误后的事件
|
||||
img.onerror = function() {
|
||||
error && error.call(img);
|
||||
onready.end = true;
|
||||
img = img.onload = img.onerror = null;
|
||||
};
|
||||
|
||||
// 图片尺寸就绪
|
||||
onready = function() {
|
||||
newWidth = img.width;
|
||||
newHeight = img.height;
|
||||
if(newWidth !== width || newHeight !== height ||
|
||||
// 如果图片已经在其他地方加载可使用面积检测
|
||||
newWidth * newHeight > 1024
|
||||
) {
|
||||
ready.call(img);
|
||||
onready.end = true;
|
||||
}
|
||||
};
|
||||
onready();
|
||||
|
||||
// 完全加载完毕的事件
|
||||
img.onload = function() {
|
||||
// onload在定时器时间差范围内可能比onready快
|
||||
// 这里进行检查并保证onready优先执行
|
||||
!onready.end && onready();
|
||||
|
||||
load && load.call(img);
|
||||
|
||||
// IE gif动画会循环执行onload,置空onload即可
|
||||
img = img.onload = img.onerror = null;
|
||||
};
|
||||
|
||||
// 加入队列中定期执行
|
||||
if(!onready.end) {
|
||||
list.push(onready);
|
||||
// 无论何时只允许出现一个定时器,减少浏览器性能损耗
|
||||
if(intervalId === null) intervalId = setInterval(tick, 40);
|
||||
}
|
||||
};
|
||||
})();
|
||||
}(jQuery));
|
||||
|
||||
2
root/res/zui/lib/imgready/imgready.min.js
vendored
Normal file
2
root/res/zui/lib/imgready/imgready.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*! TangBin: image.ready.js http://www.planeart.cn/?p=1121 */
|
||||
!function(n){"use strict";n.zui.imgReady=function(){var n=[],l=null,e=function(){for(var l=0;l<n.length;l++)n[l].end?n.splice(l--,1):n[l]();!n.length&&o()},o=function(){clearInterval(l),l=null};return function(o,r,t,u){var c,i,a,d,f,h=new Image;return h.src=o,h.complete?(r.call(h),void(t&&t.call(h))):(i=h.width,a=h.height,h.onerror=function(){u&&u.call(h),c.end=!0,h=h.onload=h.onerror=null},c=function(){d=h.width,f=h.height,(d!==i||f!==a||d*f>1024)&&(r.call(h),c.end=!0)},c(),h.onload=function(){!c.end&&c(),t&&t.call(h),h=h.onload=h.onerror=null},void(c.end||(n.push(c),null===l&&(l=setInterval(e,40)))))}}()}(jQuery);
|
||||
4
root/res/zui/lib/jquery/jquery.js
vendored
Normal file
4
root/res/zui/lib/jquery/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
44
root/res/zui/lib/migrate1.2/zui.migrate1.2.js
Normal file
44
root/res/zui/lib/migrate1.2/zui.migrate1.2.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/*!
|
||||
* ZUI: 1.2升级到1.3兼容插件 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: zui.migrate.1.2.js
|
||||
* This file inclues some helper methods to help upgrad version 1.2 or
|
||||
* lower to version 1.3
|
||||
* If you are using 1.3+, then ignore this.
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($, window) {
|
||||
var zui = $.zui;
|
||||
if(zui) {
|
||||
function extendTo(name, target) {
|
||||
if($.isArray(name)) {
|
||||
$.each(name, function(i, n) {
|
||||
extendTo(n, target);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var config = {};
|
||||
config[name] = zui[name];
|
||||
|
||||
if(target) {
|
||||
$.extend(target, config);
|
||||
} else {
|
||||
$.extend(config);
|
||||
}
|
||||
}
|
||||
|
||||
extendTo(['uuid', 'callEvent', 'clientLang', 'browser', 'messager', 'Messager', 'showMessager', 'closeModal', 'ajustModalPosition', 'ModalTrigger', 'modalTrigger', 'store']);
|
||||
extendTo(['Color', 'imgReady', 'messager', 'Messager', 'showMessager', 'closeModal', 'ajustModalPosition', 'ModalTrigger', 'modalTrigger', 'store'], window);
|
||||
}
|
||||
}(jQuery, window));
|
||||
|
||||
7
root/res/zui/lib/migrate1.2/zui.migrate1.2.min.js
vendored
Normal file
7
root/res/zui/lib/migrate1.2/zui.migrate1.2.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 1.2升级到1.3兼容插件 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
!function(e,o){function r(o,a){if(e.isArray(o))return void e.each(o,function(e,o){r(o,a)});var i={};i[o]=s[o],a?e.extend(a,i):e.extend(i)}var s=e.zui;s&&(r(["uuid","callEvent","clientLang","browser","messager","Messager","showMessager","closeModal","ajustModalPosition","ModalTrigger","modalTrigger","store"]),r(["Color","imgReady","messager","Messager","showMessager","closeModal","ajustModalPosition","ModalTrigger","modalTrigger","store"],o))}(jQuery,window);
|
||||
2
root/res/zui/lib/prettify/lang-apollo.js
Normal file
2
root/res/zui/lib/prettify/lang-apollo.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\n\r]*/,null,"#"],["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
|
||||
null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[ES]?BANK=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[!-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["apollo","agc","aea"]);
|
||||
3
root/res/zui/lib/prettify/lang-basic.js
Normal file
3
root/res/zui/lib/prettify/lang-basic.js
Normal file
@@ -0,0 +1,3 @@
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["str",/^"(?:[^\n\r"\\]|\\.)*(?:"|$)/,a,'"'],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^REM[^\n\r]*/,a],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,a],["pln",/^[a-z][^\W_]?(?:\$|%)?/i,a],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i,a,"0123456789"],["pun",
|
||||
/^.[^\s\w"$%.]*/,a]]),["basic","cbm"]);
|
||||
18
root/res/zui/lib/prettify/lang-clj.js
Normal file
18
root/res/zui/lib/prettify/lang-clj.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright (C) 2011 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a],
|
||||
["typ",/^:[\dA-Za-z-]+/]]),["clj"]);
|
||||
2
root/res/zui/lib/prettify/lang-css.js
Normal file
2
root/res/zui/lib/prettify/lang-css.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n\u000c"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]+)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],
|
||||
["com",/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}\b/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
|
||||
3
root/res/zui/lib/prettify/lang-dart.js
Normal file
3
root/res/zui/lib/prettify/lang-dart.js
Normal file
@@ -0,0 +1,3 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!.*/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/.*/],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i],
|
||||
["typ",/^\b(?:bool|double|dynamic|int|num|object|string|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?'''[\S\s]*?[^\\]'''/],["str",/^r?"""[\S\s]*?[^\\]"""/],["str",/^r?'('|[^\n\f\r]*?[^\\]')/],["str",/^r?"("|[^\n\f\r]*?[^\\]")/],["pln",/^[$_a-z]\w*/i],["pun",/^[!%&*+/:<-?^|~-]/],["lit",/^\b0x[\da-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit",/^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(),.;[\]{}]/]]),
|
||||
["dart"]);
|
||||
2
root/res/zui/lib/prettify/lang-erlang.js
Normal file
2
root/res/zui/lib/prettify/lang-erlang.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["lit",/^[a-z]\w*/],["lit",/^'(?:[^\n\f\r'\\]|\\[^&])+'?/,null,"'"],["lit",/^\?[^\t\n ({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
|
||||
["kwd",/^-[_a-z]+/],["typ",/^[A-Z_]\w*/],["pun",/^[,.;]/]]),["erlang","erl"]);
|
||||
1
root/res/zui/lib/prettify/lang-go.js
Normal file
1
root/res/zui/lib/prettify/lang-go.js
Normal file
@@ -0,0 +1 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])+(?:'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\/\*[\S\s]*?\*\/)/],["pln",/^(?:[^"'/`]|\/(?![*/]))+/]]),["go"]);
|
||||
2
root/res/zui/lib/prettify/lang-hs.js
Normal file
2
root/res/zui/lib/prettify/lang-hs.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/,
|
||||
null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]);
|
||||
3
root/res/zui/lib/prettify/lang-lisp.js
Normal file
3
root/res/zui/lib/prettify/lang-lisp.js
Normal file
@@ -0,0 +1,3 @@
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],
|
||||
["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","lsp","scm","ss","rkt"]);
|
||||
1
root/res/zui/lib/prettify/lang-llvm.js
Normal file
1
root/res/zui/lib/prettify/lang-llvm.js
Normal file
@@ -0,0 +1 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^!?"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["com",/^;[^\n\r]*/,null,";"]],[["pln",/^[!%@](?:[$\-.A-Z_a-z][\w$\-.]*|\d+)/],["kwd",/^[^\W\d]\w*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[Xx][\dA-Fa-f]+)/],["pun",/^[(-*,:<->[\]{}]|\.\.\.$/]]),["llvm","ll"]);
|
||||
2
root/res/zui/lib/prettify/lang-lua.js
Normal file
2
root/res/zui/lib/prettify/lang-lua.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],
|
||||
["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]);
|
||||
6
root/res/zui/lib/prettify/lang-matlab.js
Normal file
6
root/res/zui/lib/prettify/lang-matlab.js
Normal file
File diff suppressed because one or more lines are too long
2
root/res/zui/lib/prettify/lang-ml.js
Normal file
2
root/res/zui/lib/prettify/lang-ml.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xa0]+(?:[$_a-z][\w']*|``[^\t\n\r`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])(?:'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\(\*[\S\s]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
|
||||
["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^(?:[_a-z][\w']*[!#?]?|``[^\t\n\r`]*(?:``|$))/i],["pun",/^[^\w\t\n\r "'\xa0]+/]]),["fs","ml"]);
|
||||
2
root/res/zui/lib/prettify/lang-mumps.js
Normal file
2
root/res/zui/lib/prettify/lang-mumps.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"]|\\.)*"/,null,'"']],[["com",/^;[^\n\r]*/,null,";"],["dec",/^\$(?:d|device|ec|ecode|es|estack|et|etrap|h|horolog|i|io|j|job|k|key|p|principal|q|quit|st|stack|s|storage|sy|system|t|test|tl|tlevel|tr|trestart|x|y|z[a-z]*|a|ascii|c|char|d|data|e|extract|f|find|fn|fnumber|g|get|j|justify|l|length|na|name|o|order|p|piece|ql|qlength|qs|qsubscript|q|query|r|random|re|reverse|s|select|st|stack|t|text|tr|translate|nan)\b/i,
|
||||
null],["kwd",/^(?:[^$]b|break|c|close|d|do|e|else|f|for|g|goto|h|halt|h|hang|i|if|j|job|k|kill|l|lock|m|merge|n|new|o|open|q|quit|r|read|s|set|tc|tcommit|tre|trestart|tro|trollback|ts|tstart|u|use|v|view|w|write|x|xecute)\b/i,null],["lit",/^[+-]?(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?/i],["pln",/^[a-z][^\W_]*/i],["pun",/^[^\w\t\n\r"$%;^\xa0]|_/]]),["mumps"]);
|
||||
4
root/res/zui/lib/prettify/lang-n.js
Normal file
4
root/res/zui/lib/prettify/lang-n.js
Normal file
@@ -0,0 +1,4 @@
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/,
|
||||
a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/,
|
||||
a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]);
|
||||
3
root/res/zui/lib/prettify/lang-pascal.js
Normal file
3
root/res/zui/lib/prettify/lang-pascal.js
Normal file
@@ -0,0 +1,3 @@
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["str",/^'(?:[^\n\r'\\]|\\.)*(?:'|$)/,a,"'"],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^\(\*[\S\s]*?(?:\*\)|$)|^{[\S\s]*?(?:}|$)/,a],["kwd",/^(?:absolute|and|array|asm|assembler|begin|case|const|constructor|destructor|div|do|downto|else|end|external|for|forward|function|goto|if|implementation|in|inline|interface|interrupt|label|mod|not|object|of|or|packed|procedure|program|record|repeat|set|shl|shr|then|to|type|unit|until|uses|var|virtual|while|with|xor)\b/i,a],
|
||||
["lit",/^(?:true|false|self|nil)/i,a],["pln",/^[a-z][^\W_]*/i,a],["lit",/^(?:\$[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/i,a,"0123456789"],["pun",/^.[^\s\w$'./@]*/,a]]),["pascal"]);
|
||||
1
root/res/zui/lib/prettify/lang-proto.js
Normal file
1
root/res/zui/lib/prettify/lang-proto.js
Normal file
@@ -0,0 +1 @@
|
||||
PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]);
|
||||
2
root/res/zui/lib/prettify/lang-r.js
Normal file
2
root/res/zui/lib/prettify/lang-r.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^'\\]|\\[\S\s])*(?:'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![\w.])/],["lit",/^0[Xx][\dA-Fa-f]+([Pp]\d+)?[Li]?/],["lit",/^[+-]?(\d+(\.\d+)?|\.\d+)([Ee][+-]?\d+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|\d+))(?![\w.])/],
|
||||
["pun",/^(?:<<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|[!*+/^]|%.*?%|[$=@~]|:{1,3}|[(),;?[\]{}])/],["pln",/^(?:[A-Za-z]+[\w.]*|\.[^\W\d][\w.]*)(?![\w.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]);
|
||||
1
root/res/zui/lib/prettify/lang-rd.js
Normal file
1
root/res/zui/lib/prettify/lang-rd.js
Normal file
@@ -0,0 +1 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\n\r]*/,null,"%"]],[["lit",/^\\(?:cr|l?dots|R|tab)\b/],["kwd",/^\\[@-Za-z]+/],["kwd",/^#(?:ifn?def|endif)/],["pln",/^\\[{}]/],["pun",/^[()[\]{}]+/]]),["Rd","rd"]);
|
||||
2
root/res/zui/lib/prettify/lang-scala.js
Normal file
2
root/res/zui/lib/prettify/lang-scala.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:""(?:""?(?!")|[^"\\]|\\.)*"{0,3}|(?:[^\n\r"\\]|\\.)*"?)/,null,'"'],["lit",/^`(?:[^\n\r\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&(--:-@[-^{-~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\n\r'\\]|\\(?:'|[^\n\r']+))'/],["lit",/^'[$A-Z_a-z][\w$]*(?![\w$'])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/],
|
||||
["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:0(?:[0-7]+|x[\da-f]+)l?|(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:e[+-]?\d+)?f?|l?)|\\.\d+(?:e[+-]?\d+)?f?)/i],["typ",/^[$_]*[A-Z][\d$A-Z_]*[a-z][\w$]*/],["pln",/^[$A-Z_a-z][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]);
|
||||
2
root/res/zui/lib/prettify/lang-sql.js
Normal file
2
root/res/zui/lib/prettify/lang-sql.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\n\r]*|\/\*[\S\s]*?(?:\*\/|$))/],["kwd",/^(?:add|all|alter|and|any|apply|as|asc|authorization|backup|begin|between|break|browse|bulk|by|cascade|case|check|checkpoint|close|clustered|coalesce|collate|column|commit|compute|connect|constraint|contains|containstable|continue|convert|create|cross|current|current_date|current_time|current_timestamp|current_user|cursor|database|dbcc|deallocate|declare|default|delete|deny|desc|disk|distinct|distributed|double|drop|dummy|dump|else|end|errlvl|escape|except|exec|execute|exists|exit|fetch|file|fillfactor|following|for|foreign|freetext|freetexttable|from|full|function|goto|grant|group|having|holdlock|identity|identitycol|identity_insert|if|in|index|inner|insert|intersect|into|is|join|key|kill|left|like|lineno|load|match|matched|merge|natural|national|nocheck|nonclustered|nocycle|not|null|nullif|of|off|offsets|on|open|opendatasource|openquery|openrowset|openxml|option|or|order|outer|over|partition|percent|pivot|plan|preceding|precision|primary|print|proc|procedure|public|raiserror|read|readtext|reconfigure|references|replication|restore|restrict|return|revoke|right|rollback|rowcount|rowguidcol|rows?|rule|save|schema|select|session_user|set|setuser|shutdown|some|start|statistics|system_user|table|textsize|then|to|top|tran|transaction|trigger|truncate|tsequal|unbounded|union|unique|unpivot|update|updatetext|use|user|using|values|varying|view|waitfor|when|where|while|with|within|writetext|xml)(?=[^\w-]|$)/i,
|
||||
null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^[_a-z][\w-]*/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'+\xa0-]*/]]),["sql"]);
|
||||
3
root/res/zui/lib/prettify/lang-tcl.js
Normal file
3
root/res/zui/lib/prettify/lang-tcl.js
Normal file
@@ -0,0 +1,3 @@
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^{+/,a,"{"],["clo",/^}+/,a,"}"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:after|append|apply|array|break|case|catch|continue|error|eval|exec|exit|expr|for|foreach|if|incr|info|proc|return|set|switch|trace|uplevel|upvar|while)\b/,a],["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",
|
||||
/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["tcl"]);
|
||||
1
root/res/zui/lib/prettify/lang-tex.js
Normal file
1
root/res/zui/lib/prettify/lang-tex.js
Normal file
@@ -0,0 +1 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\n\r]*/,null,"%"]],[["kwd",/^\\[@-Za-z]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[()=[\]{}]+/]]),["latex","tex"]);
|
||||
2
root/res/zui/lib/prettify/lang-vb.js
Normal file
2
root/res/zui/lib/prettify/lang-vb.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})(?:["\u201c\u201d]c|$)|["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})*(?:["\u201c\u201d]|$))/i,null,'"\u201c\u201d'],["com",/^['\u2018\u2019](?:_(?:\r\n?|[^\r]?)|[^\n\r_\u2028\u2029])*/,null,"'\u2018\u2019"]],[["kwd",/^(?:addhandler|addressof|alias|and|andalso|ansi|as|assembly|auto|boolean|byref|byte|byval|call|case|catch|cbool|cbyte|cchar|cdate|cdbl|cdec|char|cint|class|clng|cobj|const|cshort|csng|cstr|ctype|date|decimal|declare|default|delegate|dim|directcast|do|double|each|else|elseif|end|endif|enum|erase|error|event|exit|finally|for|friend|function|get|gettype|gosub|goto|handles|if|implements|imports|in|inherits|integer|interface|is|let|lib|like|long|loop|me|mod|module|mustinherit|mustoverride|mybase|myclass|namespace|new|next|not|notinheritable|notoverridable|object|on|option|optional|or|orelse|overloads|overridable|overrides|paramarray|preserve|private|property|protected|public|raiseevent|readonly|redim|removehandler|resume|return|select|set|shadows|shared|short|single|static|step|stop|string|structure|sub|synclock|then|throw|to|try|typeof|unicode|until|variant|wend|when|while|with|withevents|writeonly|xor|endif|gosub|let|variant|wend)\b/i,
|
||||
null],["com",/^rem\b.*/i],["lit",/^(?:true\b|false\b|nothing\b|\d+(?:e[+-]?\d+[dfr]?|[dfilrs])?|(?:&h[\da-f]+|&o[0-7]+)[ils]?|\d*\.\d+(?:e[+-]?\d+)?[dfr]?|#\s+(?:\d+[/-]\d+[/-]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:am|pm))?)?|\d+:\d+(?::\d+)?(\s*(?:am|pm))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*(?:\[[!#%&@]+])?|\[(?:[a-z]|_\w)\w*])/i],["pun",/^[^\w\t\n\r "'[\]\xa0\u2018\u2019\u201c\u201d\u2028\u2029]+/],["pun",/^(?:\[|])/]]),["vb","vbs"]);
|
||||
3
root/res/zui/lib/prettify/lang-vhdl.js
Normal file
3
root/res/zui/lib/prettify/lang-vhdl.js
Normal file
@@ -0,0 +1,3 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["str",/^(?:[box]?"(?:[^"]|"")*"|'.')/i],["com",/^--[^\n\r]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i,
|
||||
null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^'(?:active|ascending|base|delayed|driving|driving_value|event|high|image|instance_name|last_active|last_event|last_value|left|leftof|length|low|path_name|pos|pred|quiet|range|reverse_range|right|rightof|simple_name|stable|succ|transaction|val|value)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w.\\]+#(?:[+-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:e[+-]?\d+(?:_\d+)*)?)/i],
|
||||
["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'\xa0-]*/]]),["vhdl","vhd"]);
|
||||
2
root/res/zui/lib/prettify/lang-wiki.js
Normal file
2
root/res/zui/lib/prettify/lang-wiki.js
Normal file
@@ -0,0 +1,2 @@
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\d\t a-gi-z\xa0]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[*=[\]^~]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^[A-Z][a-z][\da-z]+[A-Z][a-z][^\W_]+\b/],["lang-",/^{{{([\S\s]+?)}}}/],["lang-",/^`([^\n\r`]+)`/],["str",/^https?:\/\/[^\s#/?]*(?:\/[^\s#?]*)?(?:\?[^\s#]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\S\s])[^\n\r#*=A-[^`h{~]*/]]),["wiki"]);
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]);
|
||||
3
root/res/zui/lib/prettify/lang-xq.js
Normal file
3
root/res/zui/lib/prettify/lang-xq.js
Normal file
File diff suppressed because one or more lines are too long
2
root/res/zui/lib/prettify/lang-yaml.js
Normal file
2
root/res/zui/lib/prettify/lang-yaml.js
Normal file
@@ -0,0 +1,2 @@
|
||||
var a=null;
|
||||
PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]);
|
||||
2
root/res/zui/lib/prettify/prettify.css
Normal file
2
root/res/zui/lib/prettify/prettify.css
Normal file
@@ -0,0 +1,2 @@
|
||||
/*! Apache License 2.0 https://github.com/google/code-prettify*/
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
31
root/res/zui/lib/prettify/prettify.js
Normal file
31
root/res/zui/lib/prettify/prettify.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/*! Apache License 2.0 https://github.com/google/code-prettify*/
|
||||
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
|
||||
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
|
||||
h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
|
||||
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
|
||||
f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
|
||||
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
|
||||
if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
|
||||
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
|
||||
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
|
||||
s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
|
||||
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
|
||||
c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
|
||||
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
|
||||
a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
|
||||
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
|
||||
["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
|
||||
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
|
||||
o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
|
||||
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
|
||||
h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()
|
||||
35
root/res/zui/lib/prettify/run_prettify.js
Normal file
35
root/res/zui/lib/prettify/run_prettify.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/*! Apache License 2.0 https://github.com/google/code-prettify*/
|
||||
!function(){var r=null;
|
||||
(function(){function X(e){function j(){try{J.doScroll("left")}catch(e){P(j,50);return}w("poll")}function w(j){if(!(j.type=="readystatechange"&&x.readyState!="complete")&&((j.type=="load"?n:x)[z](i+j.type,w,!1),!m&&(m=!0)))e.call(n,j.type||j)}var Y=x.addEventListener,m=!1,C=!0,t=Y?"addEventListener":"attachEvent",z=Y?"removeEventListener":"detachEvent",i=Y?"":"on";if(x.readyState=="complete")e.call(n,"lazy");else{if(x.createEventObject&&J.doScroll){try{C=!n.frameElement}catch(A){}C&&j()}x[t](i+"DOMContentLoaded",
|
||||
w,!1);x[t](i+"readystatechange",w,!1);n[t](i+"load",w,!1)}}function Q(){S&&X(function(){var e=K.length;$(e?function(){for(var j=0;j<e;++j)(function(e){P(function(){n.exports[K[e]].apply(n,arguments)},0)})(j)}:void 0)})}for(var n=window,P=n.setTimeout,x=document,J=x.documentElement,L=x.head||x.getElementsByTagName("head")[0]||J,z="",A=x.scripts,m=A.length;--m>=0;){var M=A[m],T=M.src.match(/^[^#?]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);if(T){z=T[1]||"";M.parentNode.removeChild(M);break}}var S=!0,D=
|
||||
[],N=[],K=[];z.replace(/[&?]([^&=]+)=([^&]+)/g,function(e,j,w){w=decodeURIComponent(w);j=decodeURIComponent(j);j=="autorun"?S=!/^[0fn]/i.test(w):j=="lang"?D.push(w):j=="skin"?N.push(w):j=="callback"&&K.push(w)});m=0;for(z=D.length;m<z;++m)(function(){var e=x.createElement("script");e.onload=e.onerror=e.onreadystatechange=function(){if(e&&(!e.readyState||/loaded|complete/.test(e.readyState)))e.onerror=e.onload=e.onreadystatechange=r,--R,R||P(Q,0),e.parentNode&&e.parentNode.removeChild(e),e=r};e.type=
|
||||
"text/javascript";e.src="https://google-code-prettify.googlecode.com/svn/loader/lang-"+encodeURIComponent(D[m])+".js";L.insertBefore(e,L.firstChild)})(D[m]);for(var R=D.length,A=[],m=0,z=N.length;m<z;++m)A.push("https://google-code-prettify.googlecode.com/svn/loader/skins/"+encodeURIComponent(N[m])+".css");A.push("https://google-code-prettify.googlecode.com/svn/loader/prettify.css");(function(e){function j(m){if(m!==w){var n=x.createElement("link");n.rel="stylesheet";n.type="text/css";if(m+1<w)n.error=
|
||||
n.onerror=function(){j(m+1)};n.href=e[m];L.appendChild(n)}}var w=e.length;j(0)})(A);var $=function(){window.PR_SHOULD_USE_CONTINUATION=!0;var e;(function(){function j(a){function d(f){var b=f.charCodeAt(0);if(b!==92)return b;var a=f.charAt(1);return(b=i[a])?b:"0"<=a&&a<="7"?parseInt(f.substring(1),8):a==="u"||a==="x"?parseInt(f.substring(2),16):f.charCodeAt(1)}function h(f){if(f<32)return(f<16?"\\x0":"\\x")+f.toString(16);f=String.fromCharCode(f);return f==="\\"||f==="-"||f==="]"||f==="^"?"\\"+f:
|
||||
f}function b(f){var b=f.substring(1,f.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),f=[],a=b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,g=b.length;a<g;++a){var k=b[a];if(/\\[bdsw]/i.test(k))c.push(k);else{var k=d(k),o;a+2<g&&"-"===b[a+1]?(o=d(b[a+2]),a+=2):o=k;f.push([k,o]);o<65||k>122||(o<65||k>90||f.push([Math.max(65,k)|32,Math.min(o,90)|32]),o<97||k>122||f.push([Math.max(97,k)&-33,Math.min(o,122)&-33]))}}f.sort(function(f,a){return f[0]-
|
||||
a[0]||a[1]-f[1]});b=[];g=[];for(a=0;a<f.length;++a)k=f[a],k[0]<=g[1]+1?g[1]=Math.max(g[1],k[1]):b.push(g=k);for(a=0;a<b.length;++a)k=b[a],c.push(h(k[0])),k[1]>k[0]&&(k[1]+1>k[0]&&c.push("-"),c.push(h(k[1])));c.push("]");return c.join("")}function e(f){for(var a=f.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],g=0,k=0;g<c;++g){var o=a[g];o==="("?++k:"\\"===o.charAt(0)&&(o=+o.substring(1))&&(o<=k?d[o]=-1:a[g]=h(o))}for(g=
|
||||
1;g<d.length;++g)-1===d[g]&&(d[g]=++j);for(k=g=0;g<c;++g)o=a[g],o==="("?(++k,d[k]||(a[g]="(?:")):"\\"===o.charAt(0)&&(o=+o.substring(1))&&o<=k&&(a[g]="\\"+d[o]);for(g=0;g<c;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(f.ignoreCase&&F)for(g=0;g<c;++g)o=a[g],f=o.charAt(0),o.length>=2&&f==="["?a[g]=b(o):f!=="\\"&&(a[g]=o.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var j=0,F=!1,l=!1,I=0,c=a.length;I<c;++I){var p=a[I];if(p.ignoreCase)l=
|
||||
!0;else if(/[a-z]/i.test(p.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){F=!0;l=!1;break}}for(var i={b:8,t:9,n:10,v:11,f:12,r:13},q=[],I=0,c=a.length;I<c;++I){p=a[I];if(p.global||p.multiline)throw Error(""+p);q.push("(?:"+e(p)+")")}return RegExp(q.join("|"),l?"gi":"g")}function m(a,d){function h(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)h(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)e[l]="\n",F[l<<1]=j++,F[l++<<1|1]=a}}else if(c==
|
||||
3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),e[l]=c,F[l<<1]=j,j+=c.length,F[l++<<1|1]=a)}var b=/(?:^|\s)nocode(?:\s|$)/,e=[],j=0,F=[],l=0;h(a);return{a:e.join("").replace(/\n$/,""),d:F}}function n(a,d,h,b){d&&(a={a:d,e:a},h(a),b.push.apply(b,a.g))}function x(a){for(var d=void 0,h=a.firstChild;h;h=h.nextSibling)var b=h.nodeType,d=b===1?d?a:h:b===3?S.test(h.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function h(a){for(var l=a.e,j=[l,"pln"],c=
|
||||
0,p=a.a.match(e)||[],m={},q=0,f=p.length;q<f;++q){var B=p[q],y=m[B],u=void 0,g;if(typeof y==="string")g=!1;else{var k=b[B.charAt(0)];if(k)u=B.match(k[1]),y=k[0];else{for(g=0;g<i;++g)if(k=d[g],u=B.match(k[1])){y=k[0];break}u||(y="pln")}if((g=y.length>=5&&"lang-"===y.substring(0,5))&&!(u&&typeof u[1]==="string"))g=!1,y="src";g||(m[B]=y)}k=c;c+=B.length;if(g){g=u[1];var o=B.indexOf(g),H=o+g.length;u[2]&&(H=B.length-u[2].length,o=H-g.length);y=y.substring(5);n(l+k,B.substring(0,o),h,j);n(l+k+o,g,A(y,
|
||||
g),j);n(l+k+H,B.substring(H),h,j)}else j.push(l+k,y)}a.g=j}var b={},e;(function(){for(var h=a.concat(d),l=[],i={},c=0,p=h.length;c<p;++c){var m=h[c],q=m[3];if(q)for(var f=q.length;--f>=0;)b[q.charAt(f)]=m;m=m[1];q=""+m;i.hasOwnProperty(q)||(l.push(m),i[q]=r)}l.push(/[\S\s]/);e=j(l)})();var i=d.length;return h}function t(a){var d=[],h=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,
|
||||
r,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,r,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,r,"\"'"]);a.verbatimStrings&&h.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,r]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,r,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,
|
||||
r,"#"]),h.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,r])):d.push(["com",/^#[^\n\r]*/,r,"#"]));a.cStyleComments&&(h.push(["com",/^\/\/[^\n\r]*/,r]),h.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,r]));if(b=a.regexLiterals){var e=(b=b>1?"":"\n\r")?".":"[\\S\\s]";h.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
|
||||
("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+e+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+e+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&h.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&h.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),r]);d.push(["pln",/^\s+/,r," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");h.push(["lit",/^@[$_a-z][\w$@]*/i,r],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,r],["pln",/^[$_a-z][\w$@]*/i,r],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,
|
||||
r,"0123456789"],["pln",/^\\[\S\s]?/,r],["pun",RegExp(b),r]);return C(d,h)}function z(a,d,h){function b(a){var c=a.nodeType;if(c==1&&!j.test(a.className))if("br"===a.nodeName)e(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&h){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(l.createTextNode(d),a.nextSibling),e(a),c||a.parentNode.removeChild(a)}}
|
||||
function e(a){function b(a,c){var d=c?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),h=a.nextSibling;f.appendChild(d);for(var e=h;e;e=h)h=e.nextSibling,f.appendChild(e)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var j=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,l=a.ownerDocument,i=l.createElement("li");a.firstChild;)i.appendChild(a.firstChild);for(var c=[i],p=0;p<c.length;++p)b(c[p]);d===(d|0)&&c[0].setAttribute("value",
|
||||
d);var n=l.createElement("ol");n.className="linenums";for(var d=Math.max(0,d-1|0)||0,p=0,q=c.length;p<q;++p)i=c[p],i.className="L"+(p+d)%10,i.firstChild||i.appendChild(l.createTextNode("\u00a0")),n.appendChild(i);a.appendChild(n)}function i(a,d){for(var h=d.length;--h>=0;){var b=d[h];U.hasOwnProperty(b)?V.console&&console.warn("cannot override language handler %s",b):U[b]=a}}function A(a,d){if(!a||!U.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return U[a]}function D(a){var d=
|
||||
a.h;try{var h=m(a.c,a.i),b=h.a;a.a=b;a.d=h.d;a.e=0;A(d,b)(a);var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent),e=e&&+e[1]<=8,d=/\n/g,i=a.a,j=i.length,h=0,l=a.d,n=l.length,b=0,c=a.g,p=c.length,t=0;c[p]=j;var q,f;for(f=q=0;f<p;)c[f]!==c[f+2]?(c[q++]=c[f++],c[q++]=c[f++]):f+=2;p=q;for(f=q=0;f<p;){for(var x=c[f],y=c[f+1],u=f+2;u+2<=p&&c[u+1]===y;)u+=2;c[q++]=x;c[q++]=y;f=u}c.length=q;var g=a.c,k;if(g)k=g.style.display,g.style.display="none";try{for(;b<n;){var o=l[b+2]||j,H=c[t+2]||j,u=Math.min(o,H),E=l[b+
|
||||
1],W;if(E.nodeType!==1&&(W=i.substring(h,u))){e&&(W=W.replace(d,"\r"));E.nodeValue=W;var Z=E.ownerDocument,s=Z.createElement("span");s.className=c[t+1];var z=E.parentNode;z.replaceChild(s,E);s.appendChild(E);h<o&&(l[b+1]=E=Z.createTextNode(i.substring(u,o)),z.insertBefore(E,s.nextSibling))}h=u;h>=o&&(b+=2);h>=H&&(t+=2)}}finally{if(g)g.style.display=k}}catch(v){V.console&&console.log(v&&v.stack||v)}}var V=window,G=["break,continue,do,else,for,if,return,while"],O=[[G,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],J=[O,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],K=[O,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
L=[K,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],O=[O,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],M=[G,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
N=[G,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],R=[G,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],G=[G,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],Q=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
S=/\S/,T=t({keywords:[J,L,O,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",M,N,G],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),U={};i(T,["default-code"]);i(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);i(C([["pln",/^\s+/,r," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,r,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);i(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);i(t({keywords:J,hashComments:!0,cStyleComments:!0,types:Q}),["c","cc","cpp","cxx","cyc","m"]);i(t({keywords:"null,true,false"}),["json"]);i(t({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:Q}),
|
||||
["cs"]);i(t({keywords:K,cStyleComments:!0}),["java"]);i(t({keywords:G,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);i(t({keywords:M,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);i(t({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);i(t({keywords:N,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);i(t({keywords:O,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);i(t({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);i(t({keywords:R,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
i(C([],[["str",/^[\S\s]+/]]),["regex"]);var X=V.PR={createSimpleLexer:C,registerLangHandler:i,sourceDecorator:t,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:function(a,d,e){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;e&&z(b,e,!0);D({h:d,j:e,c:b,i:1});return b.innerHTML},
|
||||
prettyPrint:e=e=function(a,d){function e(){for(var b=V.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;p<j.length&&c.now()<b;p++){for(var d=j[p],m=k,l=d;l=l.previousSibling;){var n=l.nodeType,s=(n===7||n===8)&&l.nodeValue;if(s?!/^\??prettify\b/.test(s):n!==3||/\S/.test(l.nodeValue))break;if(s){m={};s.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){m[b]=c});break}}l=d.className;if((m!==k||f.test(l))&&!w.test(l)){n=!1;for(s=d.parentNode;s;s=s.parentNode)if(g.test(s.tagName)&&s.className&&f.test(s.className)){n=
|
||||
!0;break}if(!n){d.className+=" prettyprinted";n=m.lang;if(!n){var n=l.match(q),A;if(!n&&(A=x(d))&&u.test(A.tagName))n=A.className.match(q);n&&(n=n[1])}if(y.test(d.tagName))s=1;else var s=d.currentStyle,v=i.defaultView,s=(s=s?s.whiteSpace:v&&v.getComputedStyle?v.getComputedStyle(d,r).getPropertyValue("white-space"):0)&&"pre"===s.substring(0,3);v=m.linenums;if(!(v=v==="true"||+v))v=(v=l.match(/\blinenums\b(?::(\d+))?/))?v[1]&&v[1].length?+v[1]:!0:!1;v&&z(d,v,s);t={h:n,c:d,j:v,i:s};D(t)}}}p<j.length?
|
||||
P(e,250):"function"===typeof a&&a()}for(var b=d||document.body,i=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],j=[],m=0;m<b.length;++m)for(var l=0,n=b[m].length;l<n;++l)j.push(b[m][l]);var b=r,c=Date;c.now||(c={now:function(){return+new Date}});var p=0,t,q=/\blang(?:uage)?-([\w.]+)(?!\S)/,f=/\bprettyprint\b/,w=/\bprettyprinted\b/,y=/pre|xmp/i,u=/^code$/i,g=/^(?:pre|code|xmp)$/i,k={};e()}};typeof define==="function"&&define.amd&&
|
||||
define("google-code-prettify",[],function(){return X})})();return e}();R||P(Q,0)})();}()
|
||||
318
root/res/zui/lib/selectable/zui.selectable.js
Normal file
318
root/res/zui/lib/selectable/zui.selectable.js
Normal file
@@ -0,0 +1,318 @@
|
||||
/*!
|
||||
* ZUI: 拖拽选择 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: selectable.js [1.5.0+]
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
var name = 'zui.selectable'; // module name
|
||||
|
||||
// The selectable modal class
|
||||
var Selectable = function(element, options) {
|
||||
this.name = name;
|
||||
this.$ = $(element);
|
||||
this.id = $.zui.uuid();
|
||||
this.selectOrder = 1;
|
||||
this.selections = {};
|
||||
|
||||
this.getOptions(options);
|
||||
this._init();
|
||||
};
|
||||
|
||||
var isPointInner = function(x, y, a) {
|
||||
return x >= a.left && x <= (a.left + a.width) && y >= a.top && y <= (a.top + a.height);
|
||||
};
|
||||
|
||||
var isIntersectArea = function(a, b) {
|
||||
var x1 = Math.max(a.left, b.left),
|
||||
y1 = Math.max(a.top, b.top),
|
||||
x2 = Math.min(a.left + a.width, b.left + b.width),
|
||||
y2 = Math.min(a.top + a.height, b.top + b.height);
|
||||
|
||||
return isPointInner(x1, y1, a) && isPointInner(x2, y2, a) && isPointInner(x1, y1, b) && isPointInner(x2, y2, b);
|
||||
};
|
||||
|
||||
// default options
|
||||
Selectable.DEFAULTS = {
|
||||
selector: 'li,tr,div',
|
||||
trigger: '',
|
||||
selectClass: 'active',
|
||||
rangeStyle: {
|
||||
border: '1px solid ' + ($.zui.colorset ? $.zui.colorset.primary : '#3280fc'),
|
||||
backgroundColor: $.zui.colorset ? (new $.zui.Color($.zui.colorset.primary).fade(20).toCssStr()) : 'rgba(50, 128, 252, 0.2)'
|
||||
},
|
||||
clickBehavior: 'toggle',
|
||||
ignoreVal: 3
|
||||
// mouseButton: -1 // 0, 1, 2, -1, all, left, right, middle
|
||||
};
|
||||
|
||||
// Get and init options
|
||||
Selectable.prototype.getOptions = function(options) {
|
||||
this.options = $.extend({}, Selectable.DEFAULTS, this.$.data(), options);
|
||||
};
|
||||
|
||||
Selectable.prototype.select = function(elementOrid) {
|
||||
this.toggle(elementOrid, true);
|
||||
};
|
||||
|
||||
Selectable.prototype.unselect = function(elementOrid) {
|
||||
this.toggle(elementOrid, false);
|
||||
};
|
||||
|
||||
Selectable.prototype.toggle = function(elementOrid, isSelect, handle) {
|
||||
var $element, id, selector = this.options.selector, that = this;
|
||||
if(elementOrid === undefined) {
|
||||
this.$.find(selector).each(function() {
|
||||
that.toggle(this, isSelect);
|
||||
});
|
||||
return;
|
||||
} else if(typeof elementOrid === 'object') {
|
||||
$element = $(elementOrid).closest(selector);
|
||||
id = $element.data('id');
|
||||
} else {
|
||||
id = elementOrid;
|
||||
$element = that.$.find('.slectable-item[data-id="' + id + '"]');
|
||||
}
|
||||
if($element && $element.length) {
|
||||
if(!id) {
|
||||
id = $.zui.uuid();
|
||||
$element.attr('data-id', id);
|
||||
}
|
||||
if(isSelect === undefined || isSelect === null) {
|
||||
isSelect = !that.selections[id];
|
||||
}
|
||||
if(!!isSelect !== !!that.selections[id]) {
|
||||
var handleResult;
|
||||
if($.isFunction(handle)) {
|
||||
handleResult = handle(isSelect);
|
||||
}
|
||||
if(handleResult !== true) {
|
||||
that.selections[id] = isSelect ? that.selectOrder++ : false;
|
||||
that.callEvent(isSelect ? 'select' : 'unselect', {id: id, selections: that.selections, target: $element, selected: that.getSelectedArray()}, that);
|
||||
}
|
||||
}
|
||||
if (that.options.selectClass) {
|
||||
$element.toggleClass(that.options.selectClass, isSelect);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Selectable.prototype.getSelectedArray = function() {
|
||||
var selected = [];
|
||||
$.each(this.selections, function(thisId, thisIsSelected) {
|
||||
if(thisIsSelected) selected.push(thisId);
|
||||
});
|
||||
return selected;
|
||||
};
|
||||
|
||||
Selectable.prototype.syncSelectionsFromClass = function() {
|
||||
var that = this;
|
||||
var $children = that.$children = that.$.find(that.options.selector);
|
||||
that.selections = {};
|
||||
that.$children.each(function() {
|
||||
var $item = $(this);
|
||||
that.selections[$item.data('id')] = $item.hasClass(that.options.selectClass);
|
||||
});
|
||||
};
|
||||
|
||||
Selectable.prototype._init = function() {
|
||||
var options = this.options, that = this;
|
||||
var ignoreVal = options.ignoreVal;
|
||||
var isIgnoreMove = true;
|
||||
var eventNamespace = '.' + this.name + '.' + this.id;
|
||||
var startX, startY, $range, range, x, y, checkRangeCall;
|
||||
var checkFunc = $.isFunction(options.checkFunc) ? options.checkFunc : null;
|
||||
var rangeFunc = $.isFunction(options.rangeFunc) ? options.rangeFunc : null;
|
||||
var isMouseDown = false;
|
||||
var mouseDownBackEventCall = null;
|
||||
var mouseDownEventName = 'mousedown' + eventNamespace;
|
||||
|
||||
var checkRange = function() {
|
||||
if(!range) return;
|
||||
that.$children.each(function() {
|
||||
var $item = $(this);
|
||||
var offset = $item.offset();
|
||||
offset.width = $item.outerWidth();
|
||||
offset.height = $item.outerHeight();
|
||||
var isIntersect = rangeFunc ? rangeFunc.call(this, range, offset) : isIntersectArea(range, offset);
|
||||
if(checkFunc) {
|
||||
var result = checkFunc.call(that, {
|
||||
intersect: isIntersect,
|
||||
target: $item,
|
||||
range: range,
|
||||
targetRange: offset
|
||||
});
|
||||
if(result === true) {
|
||||
that.select($item);
|
||||
} else if(result === false) {
|
||||
that.unselect($item);
|
||||
}
|
||||
} else {
|
||||
if(isIntersect) {
|
||||
that.select($item);
|
||||
} else if(!that.multiKey) {
|
||||
that.unselect($item);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var mousemove = function(e) {
|
||||
if(!isMouseDown) return;
|
||||
x = e.pageX;
|
||||
y = e.pageY;
|
||||
range = {
|
||||
width: Math.abs(x - startX),
|
||||
height: Math.abs(y - startY),
|
||||
left: x > startX ? startX : x,
|
||||
top: y > startY ? startY : y
|
||||
};
|
||||
|
||||
if(isIgnoreMove && range.width < ignoreVal && range.height < ignoreVal) return;
|
||||
if(!$range) {
|
||||
$range = $('.selectable-range[data-id="' + that.id + '"]');
|
||||
if(!$range.length) {
|
||||
$range = $('<div class="selectable-range" data-id="' + that.id + '"></div>')
|
||||
.css($.extend({
|
||||
zIndex: 1060,
|
||||
position: 'absolute',
|
||||
top: startX,
|
||||
left: startY,
|
||||
pointerEvents: 'none',
|
||||
}, that.options.rangeStyle))
|
||||
.appendTo($('body'));
|
||||
}
|
||||
}
|
||||
$range.css(range);
|
||||
clearTimeout(checkRangeCall);
|
||||
checkRangeCall = setTimeout(checkRange, 10);
|
||||
isIgnoreMove = false;
|
||||
};
|
||||
|
||||
var mouseup = function(e) {
|
||||
$(document).off(eventNamespace);
|
||||
clearTimeout(mouseDownBackEventCall);
|
||||
if(!isMouseDown) return;
|
||||
isMouseDown = false;
|
||||
if($range) $range.remove();
|
||||
if(!isIgnoreMove)
|
||||
{
|
||||
if(range) {
|
||||
clearTimeout(checkRangeCall);
|
||||
checkRange();
|
||||
range = null;
|
||||
}
|
||||
}
|
||||
that.callEvent('finish', {selections: that.selections, selected: that.getSelectedArray()});
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
var mousedown = function(e) {
|
||||
if(isMouseDown) {
|
||||
return mouseup(e);
|
||||
}
|
||||
|
||||
var mouseButton = $.zui.getMouseButtonCode(options.mouseButton);
|
||||
if(mouseButton > -1 && e.button !== mouseButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(that.altKey || e.which === 3 || that.callEvent('start', e) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $children = that.$children = that.$.find(options.selector);
|
||||
$children.addClass('slectable-item');
|
||||
|
||||
var clickBehavior = that.multiKey ? 'multi' : options.clickBehavior;
|
||||
if(clickBehavior === 'multi') {
|
||||
that.toggle(e.target);
|
||||
} else if(clickBehavior === 'single') {
|
||||
that.unselect();
|
||||
that.select(e.target);
|
||||
} else if(clickBehavior === 'toggle') {
|
||||
that.toggle(e.target, null, function(isSelect) {
|
||||
that.unselect();
|
||||
});
|
||||
}
|
||||
|
||||
if(that.callEvent('startDrag', e) === false) {
|
||||
that.callEvent('finish', {selections: that.selections, selected: that.getSelectedArray()});
|
||||
return;
|
||||
}
|
||||
|
||||
startX = e.pageX;
|
||||
startY = e.pageY;
|
||||
|
||||
$range = null;
|
||||
isIgnoreMove = true;
|
||||
isMouseDown = true;
|
||||
|
||||
$(document).on('mousemove' + eventNamespace, mousemove).on('mouseup' + eventNamespace, mouseup);
|
||||
mouseDownBackEventCall = setTimeout(function() {
|
||||
$(document).on(mouseDownEventName, mouseup);
|
||||
}, 10);
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
var $container = options.container && options.container !== 'default' ? $(options.container) : this.$;
|
||||
if(options.trigger) {
|
||||
$container.on(mouseDownEventName, options.trigger, mousedown);
|
||||
} else {
|
||||
$container.on(mouseDownEventName, mousedown);
|
||||
}
|
||||
|
||||
$(document).on('keydown', function(e) {
|
||||
var code = e.keyCode;
|
||||
if(code === 17 || code == 91) that.multiKey = code;
|
||||
else if(code === 18) that.altKey = true;
|
||||
}).on('keyup', function(e) {
|
||||
that.multiKey = false;
|
||||
that.altKey = false;
|
||||
});
|
||||
};
|
||||
|
||||
// Call event helper
|
||||
Selectable.prototype.callEvent = function(name, params) {
|
||||
var event = $.Event(name + '.' + this.name);
|
||||
this.$.trigger(event, params);
|
||||
var result = event.result;
|
||||
var callback = this.options[name];
|
||||
if($.isFunction(callback)) {
|
||||
result = callback.apply(this, $.isArray(params) ? params : [params]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// Extense jquery element
|
||||
$.fn.selectable = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(name);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(name, (data = new Selectable(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.selectable.Constructor = Selectable;
|
||||
|
||||
// Auto call selectable after document load complete
|
||||
$(function() {
|
||||
$('[data-ride="selectable"]').selectable();
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
7
root/res/zui/lib/selectable/zui.selectable.min.js
vendored
Normal file
7
root/res/zui/lib/selectable/zui.selectable.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 拖拽选择 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
!function(t){"use strict";var e="zui.selectable",i=function(i,n){this.name=e,this.$=t(i),this.id=t.zui.uuid(),this.selectOrder=1,this.selections={},this.getOptions(n),this._init()},n=function(t,e,i){return t>=i.left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height},o=function(t,e){var i=Math.max(t.left,e.left),o=Math.max(t.top,e.top),s=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height);return n(i,o,t)&&n(s,l,t)&&n(i,o,e)&&n(s,l,e)};i.DEFAULTS={selector:"li,tr,div",trigger:"",selectClass:"active",rangeStyle:{border:"1px solid "+(t.zui.colorset?t.zui.colorset.primary:"#3280fc"),backgroundColor:t.zui.colorset?new t.zui.Color(t.zui.colorset.primary).fade(20).toCssStr():"rgba(50, 128, 252, 0.2)"},clickBehavior:"toggle",ignoreVal:3},i.prototype.getOptions=function(e){this.options=t.extend({},i.DEFAULTS,this.$.data(),e)},i.prototype.select=function(t){this.toggle(t,!0)},i.prototype.unselect=function(t){this.toggle(t,!1)},i.prototype.toggle=function(e,i,n){var o,s,l=this.options.selector,c=this;if(void 0===e)return void this.$.find(l).each(function(){c.toggle(this,i)});if("object"==typeof e?(o=t(e).closest(l),s=o.data("id")):(s=e,o=c.$.find('.slectable-item[data-id="'+s+'"]')),o&&o.length){if(s||(s=t.zui.uuid(),o.attr("data-id",s)),void 0!==i&&null!==i||(i=!c.selections[s]),!!i!=!!c.selections[s]){var a;t.isFunction(n)&&(a=n(i)),a!==!0&&(c.selections[s]=!!i&&c.selectOrder++,c.callEvent(i?"select":"unselect",{id:s,selections:c.selections,target:o,selected:c.getSelectedArray()},c))}c.options.selectClass&&o.toggleClass(c.options.selectClass,i)}},i.prototype.getSelectedArray=function(){var e=[];return t.each(this.selections,function(t,i){i&&e.push(t)}),e},i.prototype.syncSelectionsFromClass=function(){var e=this;e.$children=e.$.find(e.options.selector);e.selections={},e.$children.each(function(){var i=t(this);e.selections[i.data("id")]=i.hasClass(e.options.selectClass)})},i.prototype._init=function(){var e,i,n,s,l,c,a,r=this.options,u=this,h=r.ignoreVal,d=!0,g="."+this.name+"."+this.id,f=t.isFunction(r.checkFunc)?r.checkFunc:null,p=t.isFunction(r.rangeFunc)?r.rangeFunc:null,v=!1,y=null,m="mousedown"+g,b=function(){s&&u.$children.each(function(){var e=t(this),i=e.offset();i.width=e.outerWidth(),i.height=e.outerHeight();var n=p?p.call(this,s,i):o(s,i);if(f){var l=f.call(u,{intersect:n,target:e,range:s,targetRange:i});l===!0?u.select(e):l===!1&&u.unselect(e)}else n?u.select(e):u.multiKey||u.unselect(e)})},C=function(o){v&&(l=o.pageX,c=o.pageY,s={width:Math.abs(l-e),height:Math.abs(c-i),left:l>e?e:l,top:c>i?i:c},d&&s.width<h&&s.height<h||(n||(n=t('.selectable-range[data-id="'+u.id+'"]'),n.length||(n=t('<div class="selectable-range" data-id="'+u.id+'"></div>').css(t.extend({zIndex:1060,position:"absolute",top:e,left:i,pointerEvents:"none"},u.options.rangeStyle)).appendTo(t("body")))),n.css(s),clearTimeout(a),a=setTimeout(b,10),d=!1))},$=function(e){t(document).off(g),clearTimeout(y),v&&(v=!1,n&&n.remove(),d||s&&(clearTimeout(a),b(),s=null),u.callEvent("finish",{selections:u.selections,selected:u.getSelectedArray()}),e.preventDefault())},w=function(o){if(v)return $(o);var s=t.zui.getMouseButtonCode(r.mouseButton);if(!(s>-1&&o.button!==s||u.altKey||3===o.which||u.callEvent("start",o)===!1)){var l=u.$children=u.$.find(r.selector);l.addClass("slectable-item");var c=u.multiKey?"multi":r.clickBehavior;if("multi"===c?u.toggle(o.target):"single"===c?(u.unselect(),u.select(o.target)):"toggle"===c&&u.toggle(o.target,null,function(t){u.unselect()}),u.callEvent("startDrag",o)===!1)return void u.callEvent("finish",{selections:u.selections,selected:u.getSelectedArray()});e=o.pageX,i=o.pageY,n=null,d=!0,v=!0,t(document).on("mousemove"+g,C).on("mouseup"+g,$),y=setTimeout(function(){t(document).on(m,$)},10),o.preventDefault()}},F=r.container&&"default"!==r.container?t(r.container):this.$;r.trigger?F.on(m,r.trigger,w):F.on(m,w),t(document).on("keydown",function(t){var e=t.keyCode;17===e||91==e?u.multiKey=e:18===e&&(u.altKey=!0)}).on("keyup",function(t){u.multiKey=!1,u.altKey=!1})},i.prototype.callEvent=function(e,i){var n=t.Event(e+"."+this.name);this.$.trigger(n,i);var o=n.result,s=this.options[e];return t.isFunction(s)&&(o=s.apply(this,t.isArray(i)?i:[i])),o},t.fn.selectable=function(n){return this.each(function(){var o=t(this),s=o.data(e),l="object"==typeof n&&n;s||o.data(e,s=new i(this,l)),"string"==typeof n&&s[n]()})},t.fn.selectable.Constructor=i,t(function(){t('[data-ride="selectable"]').selectable()})}(jQuery);
|
||||
185
root/res/zui/lib/sortable/zui.sortable.js
Normal file
185
root/res/zui/lib/sortable/zui.sortable.js
Normal file
@@ -0,0 +1,185 @@
|
||||
/*!
|
||||
* ZUI: 排序 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: sortable.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+ function($, window, document) {
|
||||
'use strict';
|
||||
|
||||
if(!$.fn.droppable) {
|
||||
console.error('Sortable requires droppable.js');
|
||||
return;
|
||||
}
|
||||
|
||||
var NAME = 'zui.sortable',
|
||||
DEFAULTS = {
|
||||
selector : 'li,div',
|
||||
dragCssClass : 'invisible',
|
||||
sortingClass : 'sortable-sorting'
|
||||
},
|
||||
STR_ORDER = 'order';
|
||||
|
||||
var Sortable = function(element, options) {
|
||||
var that = this;
|
||||
that.$ = $(element);
|
||||
that.options = $.extend({}, DEFAULTS, that.$.data(), options);
|
||||
that.init();
|
||||
};
|
||||
|
||||
Sortable.DEFAULTS = DEFAULTS;
|
||||
Sortable.NAME = NAME;
|
||||
|
||||
Sortable.prototype.init = function() {
|
||||
var that = this,
|
||||
$root = that.$,
|
||||
options = that.options,
|
||||
selector = options.selector,
|
||||
sortingClass = options.sortingClass,
|
||||
dragCssClass = options.dragCssClass,
|
||||
isReverse = options.reverse;
|
||||
|
||||
var markOrders = function($items) {
|
||||
$items = $items || that.getItems(1);
|
||||
var orders = [];
|
||||
|
||||
$items.each(function() {
|
||||
var order = $(this).data(STR_ORDER);
|
||||
if(typeof order === 'number') {
|
||||
orders.push(order);
|
||||
}
|
||||
});
|
||||
|
||||
orders.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
var itemsCount = $items.length;
|
||||
while(orders.length < itemsCount) {
|
||||
orders.push(orders.length ? (orders[orders.length - 1] + 1) : 0);
|
||||
}
|
||||
|
||||
if(isReverse) {
|
||||
orders.reverse();
|
||||
}
|
||||
|
||||
that.maxOrder = 0;
|
||||
$items.each(function(idx) {
|
||||
that.maxOrder = Math.max(that.maxOrder, orders[idx]);
|
||||
$(this).data(STR_ORDER, orders[idx]).attr('data-' + STR_ORDER, orders[idx]);
|
||||
});
|
||||
};
|
||||
|
||||
markOrders();
|
||||
|
||||
$root.droppable({
|
||||
handle : options.trigger,
|
||||
target : selector,
|
||||
selector : selector,
|
||||
container : $root,
|
||||
always : options.always,
|
||||
flex : true,
|
||||
lazy : options.lazy,
|
||||
canMoveHere : options.canMoveHere,
|
||||
nested : options.nested,
|
||||
before : options.before,
|
||||
mouseButton : options.mouseButton,
|
||||
start: function(e) {
|
||||
if(dragCssClass) e.element.addClass(dragCssClass);
|
||||
that.trigger('start', e);
|
||||
},
|
||||
drag: function(e) {
|
||||
$root.addClass(sortingClass);
|
||||
if(e.isIn) {
|
||||
var $ele = e.element,
|
||||
$target = e.target,
|
||||
eleOrder = $ele.data(STR_ORDER),
|
||||
targetOrder = $target.data(STR_ORDER);
|
||||
if (!eleOrder && eleOrder !== 0) {
|
||||
that.maxOrder++;
|
||||
eleOrder = that.maxOrder;
|
||||
$ele.attr('data-' + STR_ORDER, eleOrder);
|
||||
}
|
||||
if (!targetOrder && targetOrder !== 0) {
|
||||
that.maxOrder++;
|
||||
targetOrder = that.maxOrder;
|
||||
$target.attr('data-' + STR_ORDER, targetOrder);
|
||||
}
|
||||
if(eleOrder == targetOrder) return;
|
||||
else if(eleOrder > targetOrder) {
|
||||
$target[isReverse ? 'after' : 'before']($ele);
|
||||
} else {
|
||||
$target[isReverse ? 'before' : 'after']($ele);
|
||||
}
|
||||
var $items = that.getItems(1);
|
||||
markOrders($items);
|
||||
that.trigger(STR_ORDER, {
|
||||
list: $items,
|
||||
element: $ele
|
||||
});
|
||||
}
|
||||
},
|
||||
finish: function(e) {
|
||||
if(dragCssClass && e.element) e.element.removeClass(dragCssClass);
|
||||
$root.removeClass(sortingClass);
|
||||
that.trigger('finish', {
|
||||
list: that.getItems(1),
|
||||
element: e.element
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Sortable.prototype.destroy = function() {
|
||||
this.$.droppable('destroy');
|
||||
this.$.data(NAME, null);
|
||||
};
|
||||
|
||||
Sortable.prototype.reset = function() {
|
||||
this.destroy();
|
||||
this.init();
|
||||
};
|
||||
|
||||
Sortable.prototype.getItems = function(onlyElements) {
|
||||
var $items = this.$.children(this.options.selector).not('.drag-shadow');
|
||||
if(!onlyElements) {
|
||||
return $items.map(function() {
|
||||
var $item = $(this);
|
||||
return {
|
||||
item: $item,
|
||||
order: $item.data('order')
|
||||
};
|
||||
});
|
||||
}
|
||||
return $items;
|
||||
};
|
||||
|
||||
Sortable.prototype.trigger = function(name, params) {
|
||||
return $.zui.callEvent(this.options[name], params, this);
|
||||
};
|
||||
|
||||
$.fn.sortable = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(NAME);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(NAME, (data = new Sortable(this, options)));
|
||||
else if(typeof option == 'object') data.reset();
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.sortable.Constructor = Sortable;
|
||||
}(jQuery, window, document);
|
||||
|
||||
7
root/res/zui/lib/sortable/zui.sortable.min.js
vendored
Normal file
7
root/res/zui/lib/sortable/zui.sortable.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* ZUI: 排序 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
+function(t,e,r){"use strict";if(!t.fn.droppable)return void console.error("Sortable requires droppable.js");var a="zui.sortable",n={selector:"li,div",dragCssClass:"invisible",sortingClass:"sortable-sorting"},o="order",s=function(e,r){var a=this;a.$=t(e),a.options=t.extend({},n,a.$.data(),r),a.init()};s.DEFAULTS=n,s.NAME=a,s.prototype.init=function(){var e=this,r=e.$,a=e.options,n=a.selector,s=a.sortingClass,i=a.dragCssClass,l=a.reverse,d=function(r){r=r||e.getItems(1);var a=[];r.each(function(){var e=t(this).data(o);"number"==typeof e&&a.push(e)}),a.sort(function(t,e){return t-e});for(var n=r.length;a.length<n;)a.push(a.length?a[a.length-1]+1:0);l&&a.reverse(),e.maxOrder=0,r.each(function(r){e.maxOrder=Math.max(e.maxOrder,a[r]),t(this).data(o,a[r]).attr("data-"+o,a[r])})};d(),r.droppable({handle:a.trigger,target:n,selector:n,container:r,always:a.always,flex:!0,lazy:a.lazy,canMoveHere:a.canMoveHere,nested:a.nested,before:a.before,mouseButton:a.mouseButton,start:function(t){i&&t.element.addClass(i),e.trigger("start",t)},drag:function(t){if(r.addClass(s),t.isIn){var a=t.element,n=t.target,i=a.data(o),u=n.data(o);if(i||0===i||(e.maxOrder++,i=e.maxOrder,a.attr("data-"+o,i)),u||0===u||(e.maxOrder++,u=e.maxOrder,n.attr("data-"+o,u)),i==u)return;i>u?n[l?"after":"before"](a):n[l?"before":"after"](a);var f=e.getItems(1);d(f),e.trigger(o,{list:f,element:a})}},finish:function(t){i&&t.element&&t.element.removeClass(i),r.removeClass(s),e.trigger("finish",{list:e.getItems(1),element:t.element})}})},s.prototype.destroy=function(){this.$.droppable("destroy"),this.$.data(a,null)},s.prototype.reset=function(){this.destroy(),this.init()},s.prototype.getItems=function(e){var r=this.$.children(this.options.selector).not(".drag-shadow");return e?r:r.map(function(){var e=t(this);return{item:e,order:e.data("order")}})},s.prototype.trigger=function(e,r){return t.zui.callEvent(this.options[e],r,this)},t.fn.sortable=function(e){return this.each(function(){var r=t(this),n=r.data(a),o="object"==typeof e&&e;n?"object"==typeof e&&n.reset():r.data(a,n=new s(this,o)),"string"==typeof e&&n[e]()})},t.fn.sortable.Constructor=s}(jQuery,window,document);
|
||||
146
root/res/zui/lib/tabs/zui.tabs.css
Normal file
146
root/res/zui/lib/tabs/zui.tabs.css
Normal file
@@ -0,0 +1,146 @@
|
||||
/*!
|
||||
* ZUI: 标签页管理器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
.tabs {
|
||||
position: relative;
|
||||
min-height: 400px;
|
||||
}
|
||||
.tabs-navbar {
|
||||
padding: 4px 4px 0 4px;
|
||||
}
|
||||
.tabs-nav {
|
||||
height: 30px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
border-bottom: none;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.tab-nav-item {
|
||||
width: 160px;
|
||||
min-width: 0;
|
||||
max-width: 160px;
|
||||
padding-right: 2px;
|
||||
margin-bottom: 0;
|
||||
border: none;
|
||||
}
|
||||
.tab-nav-item:hover {
|
||||
min-width: 95px;
|
||||
}
|
||||
.tab-nav-link {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background-color: rgba(255, 255, 255, .65);
|
||||
background-color: #e5e5e5;
|
||||
border-color: #ddd;
|
||||
border-bottom: none;
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
.tab-nav-link > .title {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
left: 30px;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tab-nav-link > .icon {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
opacity: .8;
|
||||
}
|
||||
.tab-nav-item.loading .tab-nav-link > .icon:before {
|
||||
content: '\e97b';
|
||||
-webkit-animation: spin 2s infinite linear;
|
||||
-o-animation: spin 2s infinite linear;
|
||||
animation: spin 2s infinite linear;
|
||||
}
|
||||
.tab-nav-link > .close {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-weight: 200;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
text-shadow: none;
|
||||
visibility: hidden;
|
||||
border-radius: 4px;
|
||||
opacity: 0;
|
||||
-webkit-transition: all .2s;
|
||||
-o-transition: all .2s;
|
||||
transition: all .2s;
|
||||
}
|
||||
.tab-nav-link > .close:hover {
|
||||
color: #fff;
|
||||
background-color: #ea644a;
|
||||
}
|
||||
.tab-nav-link:hover > .title {
|
||||
right: 25px;
|
||||
}
|
||||
.tab-nav-link:hover > .close {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
.tab-nav-link.not-closable > .close {
|
||||
display: none;
|
||||
}
|
||||
.nav-tabs.tabs-nav > li > a,
|
||||
.nav-tabs.tabs-nav > li > a:hover,
|
||||
.nav-tabs.tabs-nav > li > a:focus {
|
||||
border-color: #ddd #ddd transparent #ddd;
|
||||
}
|
||||
.tab-nav-condensed .tab-nav-link > .title {
|
||||
left: 5px;
|
||||
text-overflow: initial;
|
||||
}
|
||||
.tab-nav-condensed .tab-nav-link > .icon {
|
||||
display: none;
|
||||
}
|
||||
.tabs-container {
|
||||
position: absolute;
|
||||
top: 34px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
.tabs-container > .tab-pane {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: none;
|
||||
}
|
||||
.tabs-container > .tab-pane.active {
|
||||
display: block;
|
||||
}
|
||||
.tab-iframe-cover {
|
||||
display: none;
|
||||
}
|
||||
.tabs-show-contextmenu .tab-iframe-cover {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
}
|
||||
488
root/res/zui/lib/tabs/zui.tabs.js
Normal file
488
root/res/zui/lib/tabs/zui.tabs.js
Normal file
@@ -0,0 +1,488 @@
|
||||
/*!
|
||||
* ZUI: 标签页管理器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/
|
||||
|
||||
/* ========================================================================
|
||||
* ZUI: tabs.js
|
||||
* http://zui.sexy
|
||||
* ========================================================================
|
||||
* Copyright (c) 2017-2018 cnezsoft.com; Licensed MIT
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Tab object
|
||||
* @param {Object | String} tab
|
||||
*/
|
||||
var Tab = function(tab) {
|
||||
var that = this;
|
||||
if(typeof tab === 'string') {
|
||||
that.url = tab;
|
||||
} else if($.isPlainObject(tab)) {
|
||||
$.extend(that, tab);
|
||||
}
|
||||
if(!that.id) {
|
||||
that.id = $.zui.uuid();
|
||||
}
|
||||
if(!that.type) {
|
||||
if(that.iframe) {
|
||||
that.type = 'iframe';
|
||||
that.url = that.url || that.iframe;
|
||||
} else if(that.ajax) {
|
||||
that.type = 'ajax';
|
||||
that.url = that.url || ($.isPlainObject(that.ajax) ? that.ajax.url : that.ajax);
|
||||
} else if(that.url) {
|
||||
that.type = tab.ajax ? 'ajax' : 'iframe';
|
||||
} else {
|
||||
that.type = 'custom';
|
||||
}
|
||||
}
|
||||
that.createTime = new Date().getTime();
|
||||
that.openTime = 0;
|
||||
that.onCreate && that.onCreate.call(that);
|
||||
};
|
||||
|
||||
Tab.prototype.open = function() {
|
||||
var that = this;
|
||||
that.openTime = new Date().getTime();
|
||||
that.onOpen && that.onOpen.call(that);
|
||||
};
|
||||
|
||||
Tab.prototype.close = function() {
|
||||
var that = this;
|
||||
that.openTime = 0;
|
||||
that.onClose && that.onClose.call(that);
|
||||
};
|
||||
|
||||
Tab.create = function(data) {
|
||||
if (data instanceof Tab) {
|
||||
return data;
|
||||
}
|
||||
return new Tab(data);
|
||||
};
|
||||
|
||||
var NAME = 'zui.tabs'; // model name
|
||||
var DEFAULTS = {
|
||||
tabs: [],
|
||||
defaultTabIcon: 'icon-window',
|
||||
contextMenu: true,
|
||||
errorTemplate: '<div class="alert alert-block alert-danger with-icon"><i class="icon-warning-sign"></i><div class="content">{0}</div></div>',
|
||||
// messagerOptions: null,
|
||||
showMessage: true,
|
||||
navTemplate: '<nav class="tabs-navbar"></nav>',
|
||||
containerTemplate: '<div class="tabs-container"></div>'
|
||||
};
|
||||
|
||||
var LANG = {
|
||||
zh_cn: {
|
||||
reload: '重新加载',
|
||||
close: '关闭',
|
||||
closeOthers: '关闭其他标签页',
|
||||
closeRight: '关闭右侧标签页',
|
||||
reopenLast: '恢复上次关闭的标签页',
|
||||
errorCannotFetchFromRemote: '无法从远程服务器({0})获取内容。'
|
||||
},
|
||||
zh_tw: {
|
||||
reload: '重新加載',
|
||||
close: '關閉',
|
||||
closeOthers: '關閉其他標籤頁',
|
||||
closeRight: '關閉右側標籤頁',
|
||||
reopenLast: '恢復上次關閉的標籤頁',
|
||||
errorCannotFetchFromRemote: '無法從遠程服務器({0})獲取內容。'
|
||||
},
|
||||
en: {
|
||||
reload: 'Reload',
|
||||
close: 'Close',
|
||||
closeOthers: 'Close others',
|
||||
closeRight: 'Close right',
|
||||
reopenLast: 'Reopen last',
|
||||
errorCannotFetchFromRemote: 'Cannot fetch data from remote server {0}.'
|
||||
}
|
||||
};
|
||||
|
||||
// The tabs model class
|
||||
var Tabs = function(element, options) {
|
||||
var that = this;
|
||||
that.name = NAME;
|
||||
that.$ = $(element);
|
||||
|
||||
options = that.options = $.extend({}, DEFAULTS, this.$.data(), options);
|
||||
var lang = options.lang || 'zh_cn';
|
||||
that.lang = $.isPlainObject(lang) ? ($.extend(true, {}, LANG[lang.lang || $.zui.clientLang()], lang)) : LANG[lang];
|
||||
|
||||
// Initialize here
|
||||
var $navbar = that.$.find('.tabs-navbar');
|
||||
if (!$navbar.length) {
|
||||
$navbar = $(options.navTemplate).appendTo(that.$);
|
||||
}
|
||||
that.$navbar = $navbar;
|
||||
|
||||
var $nav = $navbar.find('.tabs-nav');
|
||||
if (!$nav.length) {
|
||||
$nav = $('<ul class="tabs-nav nav nav-tabs"></ul>').appendTo($navbar);
|
||||
}
|
||||
that.$nav = $nav;
|
||||
|
||||
var $tabs = that.$.find('.tabs-container');
|
||||
if (!$tabs.length) {
|
||||
$tabs = $(options.containerTemplate).appendTo(that.$);
|
||||
}
|
||||
that.$tabs = $tabs;
|
||||
|
||||
that.activeTabId = options.defaultTab;
|
||||
var tabs = options.tabs || [];
|
||||
that.tabs = {};
|
||||
$.each(tabs, function(index, item) {
|
||||
var tab = Tab.create(item);
|
||||
that.tabs[tab.id] = tab;
|
||||
|
||||
if (!that.activeTabId) {
|
||||
that.activeTabId = tab.id;
|
||||
}
|
||||
|
||||
that.renderTab(tab);
|
||||
});
|
||||
that.closedTabs = [];
|
||||
|
||||
that.open(that.getActiveTab());
|
||||
|
||||
$nav.on('click.' + NAME, '.tab-nav-link', function () {
|
||||
that.open(that.getTab($(this).data('id')));
|
||||
}).on('click.' + NAME, '.tab-nav-close', function (e) {
|
||||
that.close($(this).closest('.tab-nav-link').data('id'));
|
||||
e.stopPropagation();
|
||||
}).on('resize.' + NAME, function () {
|
||||
that.adjustNavs();
|
||||
});
|
||||
|
||||
if (options.contextMenu) {
|
||||
$nav.contextmenu({
|
||||
selector: '.tab-nav-link',
|
||||
itemsCreator: function (e) {
|
||||
return that.createMenuItems(that.getTab($(this).data('id')));
|
||||
},
|
||||
onShow: function () {
|
||||
that.$.addClass('tabs-show-contextmenu');
|
||||
},
|
||||
onHide: function () {
|
||||
that.$.removeClass('tabs-show-contextmenu');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Tabs.prototype.createMenuItems = function (tab) {
|
||||
var that = this;
|
||||
var lang = that.lang;
|
||||
return [{
|
||||
label: lang.reload,
|
||||
onClick: function () {
|
||||
that.open(tab, true);
|
||||
}
|
||||
}, '-', {
|
||||
label: lang.close,
|
||||
disabled: tab.forbidClose,
|
||||
onClick: function () {
|
||||
that.close(tab.id);
|
||||
}
|
||||
}, {
|
||||
label: lang.closeOthers,
|
||||
disabled: that.$nav.find('.tab-nav-item:not(.hidden)').length <= 1,
|
||||
onClick: function () {
|
||||
that.closeOthers(tab.id);
|
||||
}
|
||||
}, {
|
||||
label: lang.closeRight,
|
||||
disabled: !$('#tab-nav-item-' + tab.id).next('.tab-nav-item:not(.hidden)').length,
|
||||
onClick: function () {
|
||||
that.closeRight(tab.id);
|
||||
}
|
||||
}, '-', {
|
||||
label: lang.reopenLast,
|
||||
disabled: !that.closedTabs.length,
|
||||
onClick: function () {
|
||||
that.reopen();
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
||||
Tabs.prototype.adjustNavs = function (immediately) {
|
||||
var that = this;
|
||||
if (!immediately) {
|
||||
if (that.adjustNavsTimer) {
|
||||
clearTimeout(that.adjustNavsTimer);
|
||||
}
|
||||
that.adjustNavsTimer = setTimeout(function() {
|
||||
that.adjustNavs(true);
|
||||
}, 50);
|
||||
return;
|
||||
}
|
||||
if (that.adjustNavsTimer) {
|
||||
that.adjustNavsTimer = null;
|
||||
}
|
||||
var $nav = that.$nav;
|
||||
var $navItems = $nav.find('.tab-nav-item:not(.hidden)');
|
||||
var totalWidth = $nav.width();
|
||||
var totalCount = $navItems.length;
|
||||
var maxWidth = Math.floor(totalWidth/totalCount);
|
||||
if(maxWidth < 96) {
|
||||
maxWidth = Math.floor((totalWidth-96)/(totalCount-1))
|
||||
}
|
||||
$nav.toggleClass('tab-nav-condensed', maxWidth <= 50);
|
||||
$navItems.css('max-width', maxWidth);
|
||||
};
|
||||
|
||||
Tabs.prototype.renderTab = function(tab, beforeTabId) {
|
||||
var that = this;
|
||||
var $nav = that.$nav;
|
||||
var $tabNav = $('#tab-nav-item-' + tab.id);
|
||||
if (!$tabNav.length) {
|
||||
var $a = $('<a class="tab-nav-link"><i class="icon"></i><span class="title"></span><i class="close tab-nav-close" title="' + that.lang.close + '">×</i></a>').attr({
|
||||
href: '#tabs-item-' + tab.id,
|
||||
'data-id': tab.id
|
||||
});
|
||||
$tabNav = $('<li class="tab-nav-item" data-id="' + tab.id + '" id="tab-nav-item-' + tab.id + '" />').append($a).appendTo(that.$nav);
|
||||
if (beforeTabId) {
|
||||
var $before$nav = $('#tab-nav-item-' + beforeTabId);
|
||||
if ($before$nav.length) {
|
||||
$tabNav.insertAfter($before$nav);
|
||||
}
|
||||
}
|
||||
that.adjustNavs();
|
||||
}
|
||||
var $a = $tabNav.find('a').attr('title', tab.desc).toggleClass('not-closable', !!tab.forbidClose);
|
||||
$a.find('.icon').attr('class', 'icon ' + (tab.icon || that.options.defaultTabIcon));
|
||||
$a.find('.title').text(tab.title || tab.defaultTitle || '');
|
||||
return $tabNav;
|
||||
};
|
||||
|
||||
Tabs.prototype.getActiveTab = function() {
|
||||
var that = this;
|
||||
return that.activeTabId ? that.tabs[that.activeTabId] : null;
|
||||
};
|
||||
|
||||
Tabs.prototype.getTab = function(tabId) {
|
||||
var that = this;
|
||||
if (!tabId) {
|
||||
return that.getActiveTab();
|
||||
}
|
||||
if (typeof tabId === 'object') {
|
||||
tabId = tabId.id;
|
||||
}
|
||||
return that.tabs[tabId];
|
||||
};
|
||||
|
||||
Tabs.prototype.close = function(tabId, forceClose) {
|
||||
var that = this;
|
||||
var tab = that.getTab(tabId);
|
||||
if (tab && (forceClose || !tab.forbidClose)) {
|
||||
$('#tab-nav-item-' + tab.id).remove();
|
||||
$('#tab-' + tab.id).remove();
|
||||
tab.close();
|
||||
delete that.tabs[tab.id];
|
||||
that.closedTabs.push(tab);
|
||||
that.$.callComEvent(that, 'onClose', tab);
|
||||
|
||||
var lastTab;
|
||||
$.each(that.tabs, function (tabId, tab) {
|
||||
if (!lastTab || lastTab.openTime < tab.openTime) {
|
||||
lastTab = tab;
|
||||
}
|
||||
});
|
||||
lastTab && that.open(lastTab);
|
||||
}
|
||||
};
|
||||
|
||||
Tabs.prototype.open = function(tab, forceReload) {
|
||||
var that = this;
|
||||
|
||||
if (!(tab instanceof Tab)) {
|
||||
tab = Tab.create(tab);
|
||||
}
|
||||
|
||||
var $tabNav = that.renderTab(tab);
|
||||
that.$nav.find('.tab-nav-item.active').removeClass('active');
|
||||
$tabNav.addClass('active');
|
||||
|
||||
var $tabPane = $('#tab-' + tab.id);
|
||||
if (!$tabPane.length) {
|
||||
$tabPane = $('<div class="tab-pane" id="tab-' + tab.id + '" />').appendTo(that.$tabs);
|
||||
}
|
||||
that.$tabs.find('.tab-pane.active').removeClass('active');
|
||||
$tabPane.addClass('active');
|
||||
|
||||
tab.open();
|
||||
that.activeTabId = tab.id;
|
||||
that.tabs[tab.id] = tab;
|
||||
|
||||
if (forceReload || !tab.loaded) {
|
||||
that.reload(tab);
|
||||
}
|
||||
|
||||
that.$.callComEvent(that, 'onOpen', tab);
|
||||
};
|
||||
|
||||
Tabs.prototype.showMessage = function (message, type) {
|
||||
$.zui.messager.show(message, $.extend({
|
||||
placement: 'center'
|
||||
}, this.options.messagerOptions, {
|
||||
type: type
|
||||
}));
|
||||
};
|
||||
|
||||
Tabs.prototype.reload = function(tab) {
|
||||
var that = this;
|
||||
|
||||
if (typeof tab === 'string') {
|
||||
tab = that.getTab(tab);
|
||||
} else if (!tab) {
|
||||
tab = that.getActiveTab();
|
||||
}
|
||||
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tab.openTime) {
|
||||
return that.open(tab);
|
||||
}
|
||||
|
||||
var $tabNav = $('#tab-nav-item-' + tab.id).addClass('loading').removeClass('has-error');
|
||||
var $tabPane = $('#tab-' + tab.id).addClass('loading').removeClass('has-error');
|
||||
var afterRefresh = function (content, error) {
|
||||
if (!tab.openTime) {
|
||||
return;
|
||||
}
|
||||
$tabNav.removeClass('loading');
|
||||
$tabPane.removeClass('loading');
|
||||
that.$.callComEvent(that, 'onLoad', tab);
|
||||
if(typeof content === 'string' || content instanceof $) {
|
||||
if (tab.contentConverter) {
|
||||
content = tab.contentConverter(content, tab);
|
||||
}
|
||||
$tabPane.empty().append(content);
|
||||
if (!tab.title) {
|
||||
content = $tabPane.text().replace(/\n/g, '');
|
||||
tab.title = content.length > 10 ? content.substr(0, 10) : content;
|
||||
that.renderTab(tab);
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
$tabNav.addClass('has-error');
|
||||
$tabPane.addClass('has-error');
|
||||
var showMessage = that.options.showMessage;
|
||||
if (showMessage) {
|
||||
if ($.isFunction(showMessage)) {
|
||||
error = showMessage(error);
|
||||
}
|
||||
that.showMessage(error, 'danger');
|
||||
}
|
||||
if (!content) {
|
||||
$tabPane.html(that.options.errorTemplate.format(error));
|
||||
}
|
||||
}
|
||||
tab.loaded = new Date().getTime();
|
||||
};
|
||||
if (tab.type === 'ajax') {
|
||||
var ajaxOption = {
|
||||
type: 'get',
|
||||
url: tab.url,
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
afterRefresh(false, that.lang.errorCannotFetchFromRemote.format(tab.url));
|
||||
},
|
||||
success: function(data) {
|
||||
afterRefresh(data);
|
||||
}
|
||||
};
|
||||
if($.isPlainObject(tab.ajax)) {
|
||||
ajaxOption = $.extend(ajaxOption, tab.ajax);
|
||||
}
|
||||
$.ajax(ajaxOption);
|
||||
} else if (tab.type === 'iframe') {
|
||||
try {
|
||||
var iframeName = 'tab-iframe-' + tab.id;
|
||||
var $iframe = $('<iframe id="' + iframeName + '" name="' + iframeName + '" src="' + (tab.url) + '" frameborder="no" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true" scrolling="auto" style="width: 100%; height: 100%; left: 0px;"></iframe>');
|
||||
$iframe.appendTo($tabPane.empty());
|
||||
$('<div class="tab-iframe-cover" />').appendTo($tabPane);
|
||||
var frame = document.getElementById(iframeName);
|
||||
frame.onload = frame.onreadystatechange = function() {
|
||||
if(this.readyState && this.readyState != 'complete') return;
|
||||
afterRefresh();
|
||||
var contentDocument = frame.contentDocument;
|
||||
if (contentDocument && !tab.title) {
|
||||
tab.title = contentDocument.title;
|
||||
that.renderTab(tab);
|
||||
}
|
||||
};
|
||||
} catch (e) {
|
||||
afterRefresh();
|
||||
}
|
||||
} else {
|
||||
var content = tab.content || tab.custom;
|
||||
if (typeof content === 'function') {
|
||||
content = content(tab, afterRefresh, that);
|
||||
if (content !== true) {
|
||||
afterRefresh(content);
|
||||
}
|
||||
} else {
|
||||
afterRefresh(content);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Tabs.prototype.closeOthers = function(tabId) {
|
||||
var that = this;
|
||||
that.$nav.find('.tab-nav-link:not(.hidden)').each(function() {
|
||||
var thisTabId = $(this).data('id');
|
||||
if (thisTabId !== tabId) {
|
||||
that.close(thisTabId);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Tabs.prototype.closeRight = function(tabId) {
|
||||
var $tabNav = $('#tab-nav-item-' + tabId);
|
||||
var $rightNav = $tabNav.next('.tab-nav-item:not(.hidden)');
|
||||
while ($rightNav.length) {
|
||||
this.close($rightNav.data('id'));
|
||||
$rightNav = $tabNav.next('.tab-nav-item:not(.hidden)');
|
||||
}
|
||||
};
|
||||
|
||||
Tabs.prototype.closeAll = function() {
|
||||
var that = this;
|
||||
that.$nav.find('.tab-nav-link:not(.hidden)').each(function() {
|
||||
that.close($(this).data('id'));
|
||||
});
|
||||
};
|
||||
|
||||
Tabs.prototype.reopen = function() {
|
||||
var that = this;
|
||||
if(that.closedTabs.length) {
|
||||
that.open(that.closedTabs.pop());
|
||||
}
|
||||
};
|
||||
|
||||
// Extense jquery element
|
||||
$.fn.tabs = function(option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data(NAME);
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if(!data) $this.data(NAME, (data = new Tabs(this, options)));
|
||||
|
||||
if(typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
Tabs.NAME = NAME;
|
||||
$.fn.tabs.Constructor = Tabs;
|
||||
}(jQuery));
|
||||
|
||||
6
root/res/zui/lib/tabs/zui.tabs.min.css
vendored
Normal file
6
root/res/zui/lib/tabs/zui.tabs.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ZUI: 标签页管理器 - v1.8.1 - 2018-01-18
|
||||
* http://zui.sexy
|
||||
* GitHub: https://github.com/easysoft/zui.git
|
||||
* Copyright (c) 2018 cnezsoft.com; Licensed MIT
|
||||
*/.tabs{position:relative;min-height:400px}.tabs-navbar{padding:4px 4px 0 4px}.tabs-nav{height:30px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-bottom:none;border-bottom:1px solid #ddd}.tab-nav-item{width:160px;min-width:0;max-width:160px;padding-right:2px;margin-bottom:0;border:none}.tab-nav-item:hover{min-width:95px}.tab-nav-link{position:relative;height:30px;margin:0;overflow:hidden;background-color:rgba(255,255,255,.65);background-color:#e5e5e5;border-color:#ddd;border-bottom:none;border-radius:2px 2px 0 0}.tab-nav-link>.title{position:absolute;top:5px;right:5px;left:30px;display:block;overflow:hidden;font-size:14px;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.tab-nav-link>.icon{position:absolute;top:5px;left:5px;display:block;width:20px;height:20px;line-height:20px;text-align:center;opacity:.8}.tab-nav-item.loading .tab-nav-link>.icon:before{content:'\e97b';-webkit-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}.tab-nav-link>.close{position:absolute;top:5px;right:5px;width:20px;height:20px;font-weight:200;line-height:16px;text-align:center;text-shadow:none;visibility:hidden;border-radius:4px;opacity:0;-webkit-transition:all .2s;-o-transition:all .2s;transition:all .2s}.tab-nav-link>.close:hover{color:#fff;background-color:#ea644a}.tab-nav-link:hover>.title{right:25px}.tab-nav-link:hover>.close{visibility:visible;opacity:1}.tab-nav-link.not-closable>.close{display:none}.nav-tabs.tabs-nav>li>a,.nav-tabs.tabs-nav>li>a:focus,.nav-tabs.tabs-nav>li>a:hover{border-color:#ddd #ddd transparent #ddd}.tab-nav-condensed .tab-nav-link>.title{left:5px;text-overflow:initial}.tab-nav-condensed .tab-nav-link>.icon{display:none}.tabs-container{position:absolute;top:34px;right:0;bottom:0;left:0}.tabs-container>.tab-pane{position:absolute;top:0;right:0;bottom:0;left:0;display:none}.tabs-container>.tab-pane.active{display:block}.tab-iframe-cover{display:none}.tabs-show-contextmenu .tab-iframe-cover{position:absolute;top:0;right:0;bottom:0;left:0;display:block}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user