5.0.215
parent
d5662a6b8a
commit
f5a96877da
|
@ -4476,7 +4476,7 @@ body .layui-table-tips .layui-layer-content {
|
|||
.layui-tab-title {
|
||||
position: relative;
|
||||
left: 0;
|
||||
height: 40px;
|
||||
height: 32px;
|
||||
white-space: nowrap;
|
||||
font-size: 0;
|
||||
border-bottom-width: 1px;
|
||||
|
@ -4497,7 +4497,7 @@ body .layui-table-tips .layui-layer-content {
|
|||
|
||||
.layui-tab-title li {
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
line-height: 32px;
|
||||
min-width: 65px;
|
||||
padding: 0 15px;
|
||||
text-align: center;
|
||||
|
@ -4518,7 +4518,7 @@ body .layui-table-tips .layui-layer-content {
|
|||
top: 0;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 41px;
|
||||
height: 33px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-bottom-color: #fff;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,72 +6,72 @@
|
|||
|
||||
*/
|
||||
|
||||
layui.define('jquery', function(exports){
|
||||
layui.define('jquery', function (exports) {
|
||||
"use strict";
|
||||
|
||||
var $ = layui.$
|
||||
,hint = layui.hint()
|
||||
,device = layui.device()
|
||||
, hint = layui.hint()
|
||||
, device = layui.device()
|
||||
|
||||
,MOD_NAME = 'element', THIS = 'layui-this', SHOW = 'layui-show'
|
||||
, MOD_NAME = 'element', THIS = 'layui-this', SHOW = 'layui-show'
|
||||
|
||||
,Element = function(){
|
||||
this.config = {};
|
||||
};
|
||||
, Element = function () {
|
||||
this.config = {};
|
||||
};
|
||||
|
||||
//全局设置
|
||||
Element.prototype.set = function(options){
|
||||
Element.prototype.set = function (options) {
|
||||
var that = this;
|
||||
$.extend(true, that.config, options);
|
||||
return that;
|
||||
};
|
||||
|
||||
//表单事件监听
|
||||
Element.prototype.on = function(events, callback){
|
||||
Element.prototype.on = function (events, callback) {
|
||||
return layui.onevent.call(this, MOD_NAME, events, callback);
|
||||
};
|
||||
|
||||
//外部Tab新增
|
||||
Element.prototype.tabAdd = function(filter, options){
|
||||
Element.prototype.tabAdd = function (filter, options) {
|
||||
var TITLE = '.layui-tab-title'
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,barElem = titElem.children('.layui-tab-bar')
|
||||
,contElem = tabElem.children('.layui-tab-content')
|
||||
,li = '<li lay-id="'+ (options.id||'') +'"'
|
||||
+(options.attr ? ' lay-attr="'+ options.attr +'"' : '') +'>'+ (options.title||'unnaming') +'</li>';
|
||||
, tabElem = $('.layui-tab[lay-filter=' + filter + ']')
|
||||
, titElem = tabElem.children(TITLE)
|
||||
, barElem = titElem.children('.layui-tab-bar')
|
||||
, contElem = tabElem.children('.layui-tab-content')
|
||||
, li = '<li lay-id="' + (options.id || '') + '"'
|
||||
+ (options.attr ? ' lay-attr="' + options.attr + '"' : '') + '>' + (options.title || 'unnaming') + '</li>';
|
||||
|
||||
barElem[0] ? barElem.before(li) : titElem.append(li);
|
||||
contElem.append('<div class="layui-tab-item">'+ (options.content||'') +'</div>');
|
||||
contElem.append('<div class="layui-tab-item">' + (options.content || '') + '</div>');
|
||||
call.hideTabMore(true);
|
||||
call.tabAuto();
|
||||
return this;
|
||||
};
|
||||
|
||||
//外部Tab删除
|
||||
Element.prototype.tabDelete = function(filter, layid){
|
||||
Element.prototype.tabDelete = function (filter, layid) {
|
||||
var TITLE = '.layui-tab-title'
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
|
||||
, tabElem = $('.layui-tab[lay-filter=' + filter + ']')
|
||||
, titElem = tabElem.children(TITLE)
|
||||
, liElem = titElem.find('>li[lay-id="' + layid + '"]');
|
||||
call.tabDelete(null, liElem);
|
||||
return this;
|
||||
};
|
||||
|
||||
//外部Tab切换
|
||||
Element.prototype.tabChange = function(filter, layid){
|
||||
Element.prototype.tabChange = function (filter, layid) {
|
||||
var TITLE = '.layui-tab-title'
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
|
||||
, tabElem = $('.layui-tab[lay-filter=' + filter + ']')
|
||||
, titElem = tabElem.children(TITLE)
|
||||
, liElem = titElem.find('>li[lay-id="' + layid + '"]');
|
||||
call.tabClick.call(liElem[0], null, null, liElem);
|
||||
return this;
|
||||
};
|
||||
|
||||
//自定义Tab选项卡
|
||||
Element.prototype.tab = function(options){
|
||||
Element.prototype.tab = function (options) {
|
||||
options = options || {};
|
||||
dom.on('click', options.headerElem, function(e){
|
||||
dom.on('click', options.headerElem, function (e) {
|
||||
var index = $(this).index();
|
||||
call.tabClick.call(this, e, index, null, options);
|
||||
});
|
||||
|
@ -79,293 +79,293 @@ layui.define('jquery', function(exports){
|
|||
|
||||
|
||||
//动态改变进度条
|
||||
Element.prototype.progress = function(filter, percent){
|
||||
Element.prototype.progress = function (filter, percent) {
|
||||
var ELEM = 'layui-progress'
|
||||
,elem = $('.'+ ELEM +'[lay-filter='+ filter +']')
|
||||
,elemBar = elem.find('.'+ ELEM +'-bar')
|
||||
,text = elemBar.find('.'+ ELEM +'-text');
|
||||
, elem = $('.' + ELEM + '[lay-filter=' + filter + ']')
|
||||
, elemBar = elem.find('.' + ELEM + '-bar')
|
||||
, text = elemBar.find('.' + ELEM + '-text');
|
||||
elemBar.css('width', percent);
|
||||
text.text(percent);
|
||||
return this;
|
||||
};
|
||||
|
||||
var NAV_ELEM = '.layui-nav', NAV_ITEM = 'layui-nav-item', NAV_BAR = 'layui-nav-bar'
|
||||
,NAV_TREE = 'layui-nav-tree', NAV_CHILD = 'layui-nav-child', NAV_MORE = 'layui-nav-more'
|
||||
,NAV_ANIM = 'layui-anim layui-anim-upbit'
|
||||
, NAV_TREE = 'layui-nav-tree', NAV_CHILD = 'layui-nav-child', NAV_MORE = 'layui-nav-more'
|
||||
, NAV_ANIM = 'layui-anim layui-anim-upbit'
|
||||
|
||||
//基础事件体
|
||||
,call = {
|
||||
//Tab点击
|
||||
tabClick: function(e, index, liElem, options){
|
||||
options = options || {};
|
||||
var othis = liElem || $(this)
|
||||
,index = index || othis.parent().children('li').index(othis)
|
||||
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
||||
,item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
,elemA = othis.find('a')
|
||||
,filter = parents.attr('lay-filter');
|
||||
//基础事件体
|
||||
, call = {
|
||||
//Tab点击
|
||||
tabClick: function (e, index, liElem, options) {
|
||||
options = options || {};
|
||||
var othis = liElem || $(this)
|
||||
, index = index || othis.parent().children('li').index(othis)
|
||||
, parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
||||
, item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
, elemA = othis.find('a')
|
||||
, filter = parents.attr('lay-filter');
|
||||
|
||||
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank')){
|
||||
othis.addClass(THIS).siblings().removeClass(THIS);
|
||||
item.eq(index).addClass(SHOW).siblings().removeClass(SHOW);
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'tab('+ filter +')', {
|
||||
elem: parents
|
||||
,index: index
|
||||
});
|
||||
}
|
||||
|
||||
//Tab删除
|
||||
,tabDelete: function(e, othis){
|
||||
var li = othis || $(this).parent(), index = li.index()
|
||||
,parents = li.parents('.layui-tab').eq(0)
|
||||
,item = parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
,filter = parents.attr('lay-filter');
|
||||
|
||||
if(li.hasClass(THIS)){
|
||||
if(li.next()[0]){
|
||||
call.tabClick.call(li.next()[0], null, index + 1);
|
||||
} else if(li.prev()[0]){
|
||||
call.tabClick.call(li.prev()[0], null, index - 1);
|
||||
}
|
||||
}
|
||||
|
||||
li.remove();
|
||||
item.eq(index).remove();
|
||||
setTimeout(function(){
|
||||
call.tabAuto();
|
||||
}, 50);
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'tabDelete('+ filter +')', {
|
||||
elem: parents
|
||||
,index: index
|
||||
});
|
||||
}
|
||||
|
||||
//Tab自适应
|
||||
,tabAuto: function(){
|
||||
var SCROLL = 'layui-tab-scroll', MORE = 'layui-tab-more', BAR = 'layui-tab-bar'
|
||||
,CLOSE = 'layui-tab-close', that = this;
|
||||
|
||||
$('.layui-tab').each(function(){
|
||||
var othis = $(this)
|
||||
,title = othis.children('.layui-tab-title')
|
||||
,item = othis.children('.layui-tab-content').children('.layui-tab-item')
|
||||
,STOPE = 'lay-stope="tabmore"'
|
||||
,span = $('<span class="layui-unselect layui-tab-bar" '+ STOPE +'><i '+ STOPE +' class="layui-icon"></i></span>');
|
||||
|
||||
if(that === window && device.ie != 8){
|
||||
call.hideTabMore(true)
|
||||
if (!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank')) {
|
||||
othis.addClass(THIS).siblings().removeClass(THIS);
|
||||
item.eq(index).addClass(SHOW).siblings().removeClass(SHOW);
|
||||
}
|
||||
|
||||
//允许关闭
|
||||
if(othis.attr('lay-allowClose')){
|
||||
title.find('li').each(function(){
|
||||
var li = $(this);
|
||||
if(!li.find('.'+CLOSE)[0]){
|
||||
var close = $('<i class="layui-icon layui-unselect '+ CLOSE +'">ဆ</i>');
|
||||
close.on('click', call.tabDelete);
|
||||
li.append(close);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(typeof othis.attr('lay-unauto') === 'string') return;
|
||||
|
||||
//响应式
|
||||
if(title.prop('scrollWidth') > title.outerWidth()+1){
|
||||
if(title.find('.'+BAR)[0]) return;
|
||||
title.append(span);
|
||||
othis.attr('overflow', '');
|
||||
span.on('click', function(e){
|
||||
title[this.title ? 'removeClass' : 'addClass'](MORE);
|
||||
this.title = this.title ? '' : '收缩';
|
||||
});
|
||||
} else {
|
||||
title.find('.'+BAR).remove();
|
||||
othis.removeAttr('overflow');
|
||||
}
|
||||
});
|
||||
}
|
||||
//隐藏更多Tab
|
||||
,hideTabMore: function(e){
|
||||
var tsbTitle = $('.layui-tab-title');
|
||||
if(e === true || $(e.target).attr('lay-stope') !== 'tabmore'){
|
||||
tsbTitle.removeClass('layui-tab-more');
|
||||
tsbTitle.find('.layui-tab-bar').attr('title','');
|
||||
}
|
||||
}
|
||||
|
||||
//点击一级菜单
|
||||
/*
|
||||
,clickThis: function(){
|
||||
var othis = $(this), parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter')
|
||||
,elemA = othis.find('a')
|
||||
,unselect = typeof othis.attr('lay-unselect') === 'string';
|
||||
|
||||
if(othis.find('.'+NAV_CHILD)[0]) return;
|
||||
|
||||
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank') && !unselect){
|
||||
parents.find('.'+THIS).removeClass(THIS);
|
||||
othis.addClass(THIS);
|
||||
layui.event.call(this, MOD_NAME, 'tab(' + filter + ')', {
|
||||
elem: parents
|
||||
, index: index
|
||||
});
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
|
||||
}
|
||||
)
|
||||
*/
|
||||
//Tab删除
|
||||
, tabDelete: function (e, othis) {
|
||||
var li = othis || $(this).parent(), index = li.index()
|
||||
, parents = li.parents('.layui-tab').eq(0)
|
||||
, item = parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
, filter = parents.attr('lay-filter');
|
||||
|
||||
//点击菜单 - a标签触发
|
||||
,clickThis: function(){
|
||||
var othis = $(this)
|
||||
,parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter')
|
||||
,parent = othis.parent()
|
||||
,child = othis.siblings('.'+NAV_CHILD)
|
||||
,unselect = typeof parent.attr('lay-unselect') === 'string';
|
||||
|
||||
if(!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect){
|
||||
if(!child[0]){
|
||||
parents.find('.'+THIS).removeClass(THIS);
|
||||
parent.addClass(THIS);
|
||||
}
|
||||
}
|
||||
|
||||
//如果是垂直菜单
|
||||
if(parents.hasClass(NAV_TREE)){
|
||||
child.removeClass(NAV_ANIM);
|
||||
|
||||
//如果有子菜单,则展开
|
||||
if(child[0]){
|
||||
parent[child.css('display') === 'none' ? 'addClass': 'removeClass'](NAV_ITEM+'ed');
|
||||
if(parents.attr('lay-shrink') === 'all'){
|
||||
parent.siblings().removeClass(NAV_ITEM + 'ed');
|
||||
if (li.hasClass(THIS)) {
|
||||
if (li.next()[0]) {
|
||||
call.tabClick.call(li.next()[0], null, index + 1);
|
||||
} else if (li.prev()[0]) {
|
||||
call.tabClick.call(li.prev()[0], null, index - 1);
|
||||
}
|
||||
}
|
||||
|
||||
li.remove();
|
||||
item.eq(index).remove();
|
||||
setTimeout(function () {
|
||||
call.tabAuto();
|
||||
}, 50);
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'tabDelete(' + filter + ')', {
|
||||
elem: parents
|
||||
, index: index
|
||||
});
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
|
||||
}
|
||||
//Tab自适应
|
||||
, tabAuto: function () {
|
||||
var SCROLL = 'layui-tab-scroll', MORE = 'layui-tab-more', BAR = 'layui-tab-bar'
|
||||
, CLOSE = 'layui-tab-close', that = this;
|
||||
|
||||
//点击子菜单选中
|
||||
/*
|
||||
,clickChild: function(){
|
||||
var othis = $(this), parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter');
|
||||
parents.find('.'+THIS).removeClass(THIS);
|
||||
othis.addClass(THIS);
|
||||
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
|
||||
}
|
||||
*/
|
||||
$('.layui-tab').each(function () {
|
||||
var othis = $(this)
|
||||
, title = othis.children('.layui-tab-title')
|
||||
, item = othis.children('.layui-tab-content').children('.layui-tab-item')
|
||||
, STOPE = 'lay-stope="tabmore"'
|
||||
, span = $('<span class="layui-unselect layui-tab-bar" ' + STOPE + '><i ' + STOPE + ' class="layui-icon"></i></span>');
|
||||
|
||||
//折叠面板
|
||||
,collapse: function(){
|
||||
var othis = $(this), icon = othis.find('.layui-colla-icon')
|
||||
,elemCont = othis.siblings('.layui-colla-content')
|
||||
,parents = othis.parents('.layui-collapse').eq(0)
|
||||
,filter = parents.attr('lay-filter')
|
||||
,isNone = elemCont.css('display') === 'none';
|
||||
if (that === window && device.ie != 8) {
|
||||
call.hideTabMore(true)
|
||||
}
|
||||
|
||||
//是否手风琴
|
||||
if(typeof parents.attr('lay-accordion') === 'string'){
|
||||
var show = parents.children('.layui-colla-item').children('.'+SHOW);
|
||||
show.siblings('.layui-colla-title').children('.layui-colla-icon').html('');
|
||||
show.removeClass(SHOW);
|
||||
//允许关闭
|
||||
if (othis.attr('lay-allowClose')) {
|
||||
title.find('li').each(function () {
|
||||
var li = $(this);
|
||||
if (!li.find('.' + CLOSE)[0]) {
|
||||
var close = $('<i class="layui-icon layui-unselect ' + CLOSE + '">ဆ</i>');
|
||||
close.on('click', call.tabDelete);
|
||||
li.append(close);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof othis.attr('lay-unauto') === 'string') return;
|
||||
|
||||
//响应式
|
||||
if (title.prop('scrollWidth') > title.outerWidth() + 1) {
|
||||
if (title.find('.' + BAR)[0]) return;
|
||||
title.append(span);
|
||||
othis.attr('overflow', '');
|
||||
span.on('click', function (e) {
|
||||
title[this.title ? 'removeClass' : 'addClass'](MORE);
|
||||
this.title = this.title ? '' : '收缩';
|
||||
});
|
||||
} else {
|
||||
title.find('.' + BAR).remove();
|
||||
othis.removeAttr('overflow');
|
||||
}
|
||||
});
|
||||
}
|
||||
//隐藏更多Tab
|
||||
, hideTabMore: function (e) {
|
||||
var tsbTitle = $('.layui-tab-title');
|
||||
if (e === true || $(e.target).attr('lay-stope') !== 'tabmore') {
|
||||
tsbTitle.removeClass('layui-tab-more');
|
||||
tsbTitle.find('.layui-tab-bar').attr('title', '');
|
||||
}
|
||||
}
|
||||
|
||||
elemCont[isNone ? 'addClass' : 'removeClass'](SHOW);
|
||||
icon.html(isNone ? '' : '');
|
||||
//点击一级菜单
|
||||
/*
|
||||
,clickThis: function(){
|
||||
var othis = $(this), parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter')
|
||||
,elemA = othis.find('a')
|
||||
,unselect = typeof othis.attr('lay-unselect') === 'string';
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'collapse('+ filter +')', {
|
||||
title: othis
|
||||
,content: elemCont
|
||||
,show: isNone
|
||||
});
|
||||
}
|
||||
};
|
||||
if(othis.find('.'+NAV_CHILD)[0]) return;
|
||||
|
||||
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank') && !unselect){
|
||||
parents.find('.'+THIS).removeClass(THIS);
|
||||
othis.addClass(THIS);
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
|
||||
}
|
||||
)
|
||||
*/
|
||||
|
||||
//点击菜单 - a标签触发
|
||||
, clickThis: function () {
|
||||
var othis = $(this)
|
||||
, parents = othis.parents(NAV_ELEM)
|
||||
, filter = parents.attr('lay-filter')
|
||||
, parent = othis.parent()
|
||||
, child = othis.siblings('.' + NAV_CHILD)
|
||||
, unselect = typeof parent.attr('lay-unselect') === 'string';
|
||||
|
||||
if (!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect) {
|
||||
if (!child[0]) {
|
||||
parents.find('.' + THIS).removeClass(THIS);
|
||||
parent.addClass(THIS);
|
||||
}
|
||||
}
|
||||
|
||||
//如果是垂直菜单
|
||||
if (parents.hasClass(NAV_TREE)) {
|
||||
child.removeClass(NAV_ANIM);
|
||||
|
||||
//如果有子菜单,则展开
|
||||
if (child[0]) {
|
||||
parent[child.css('display') === 'none' ? 'addClass' : 'removeClass'](NAV_ITEM + 'ed');
|
||||
if (parents.attr('lay-shrink') === 'all') {
|
||||
parent.siblings().removeClass(NAV_ITEM + 'ed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'nav(' + filter + ')', othis);
|
||||
}
|
||||
|
||||
//点击子菜单选中
|
||||
/*
|
||||
,clickChild: function(){
|
||||
var othis = $(this), parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter');
|
||||
parents.find('.'+THIS).removeClass(THIS);
|
||||
othis.addClass(THIS);
|
||||
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
|
||||
}
|
||||
*/
|
||||
|
||||
//折叠面板
|
||||
, collapse: function () {
|
||||
var othis = $(this), icon = othis.find('.layui-colla-icon')
|
||||
, elemCont = othis.siblings('.layui-colla-content')
|
||||
, parents = othis.parents('.layui-collapse').eq(0)
|
||||
, filter = parents.attr('lay-filter')
|
||||
, isNone = elemCont.css('display') === 'none';
|
||||
|
||||
//是否手风琴
|
||||
if (typeof parents.attr('lay-accordion') === 'string') {
|
||||
var show = parents.children('.layui-colla-item').children('.' + SHOW);
|
||||
show.siblings('.layui-colla-title').children('.layui-colla-icon').html('');
|
||||
show.removeClass(SHOW);
|
||||
}
|
||||
|
||||
elemCont[isNone ? 'addClass' : 'removeClass'](SHOW);
|
||||
icon.html(isNone ? '' : '');
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'collapse(' + filter + ')', {
|
||||
title: othis
|
||||
, content: elemCont
|
||||
, show: isNone
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//初始化元素操作
|
||||
Element.prototype.init = function(type, filter){
|
||||
var that = this, elemFilter = function(){
|
||||
return filter ? ('[lay-filter="' + filter +'"]') : '';
|
||||
Element.prototype.init = function (type, filter) {
|
||||
var that = this, elemFilter = function () {
|
||||
return filter ? ('[lay-filter="' + filter + '"]') : '';
|
||||
}(), items = {
|
||||
|
||||
//Tab选项卡
|
||||
tab: function(){
|
||||
tab: function () {
|
||||
call.tabAuto.call({});
|
||||
}
|
||||
|
||||
//导航菜单
|
||||
,nav: function(){
|
||||
var TIME = 200, timer = {}, timerMore = {}, timeEnd = {}, follow = function(bar, nav, index){
|
||||
var othis = $(this), child = othis.find('.'+NAV_CHILD);
|
||||
, nav: function () {
|
||||
var TIME = 200, timer = {}, timerMore = {}, timeEnd = {}, follow = function (bar, nav, index) {
|
||||
var othis = $(this), child = othis.find('.' + NAV_CHILD);
|
||||
|
||||
if(nav.hasClass(NAV_TREE)){
|
||||
if (nav.hasClass(NAV_TREE)) {
|
||||
bar.css({
|
||||
top: othis.position().top
|
||||
,height: othis.children('a').outerHeight()
|
||||
,opacity: 1
|
||||
, height: othis.children('a').outerHeight()
|
||||
, opacity: 1
|
||||
});
|
||||
} else {
|
||||
child.addClass(NAV_ANIM);
|
||||
bar.css({
|
||||
left: othis.position().left + parseFloat(othis.css('marginLeft'))
|
||||
,top: othis.position().top + othis.height() - bar.height()
|
||||
, top: othis.position().top + othis.height() - bar.height()
|
||||
});
|
||||
|
||||
timer[index] = setTimeout(function(){
|
||||
timer[index] = setTimeout(function () {
|
||||
bar.css({
|
||||
width: othis.width()
|
||||
,opacity: 1
|
||||
, opacity: 1
|
||||
});
|
||||
}, device.ie && device.ie < 10 ? 0 : TIME);
|
||||
|
||||
clearTimeout(timeEnd[index]);
|
||||
if(child.css('display') === 'block'){
|
||||
if (child.css('display') === 'block') {
|
||||
clearTimeout(timerMore[index]);
|
||||
}
|
||||
timerMore[index] = setTimeout(function(){
|
||||
timerMore[index] = setTimeout(function () {
|
||||
child.addClass(SHOW)
|
||||
othis.find('.'+NAV_MORE).addClass(NAV_MORE+'d');
|
||||
othis.find('.' + NAV_MORE).addClass(NAV_MORE + 'd');
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
$(NAV_ELEM + elemFilter).each(function(index){
|
||||
$(NAV_ELEM + elemFilter).each(function (index) {
|
||||
var othis = $(this)
|
||||
,bar = $('<span class="'+ NAV_BAR +'"></span>')
|
||||
,itemElem = othis.find('.'+NAV_ITEM);
|
||||
, bar = $('<span class="' + NAV_BAR + '"></span>')
|
||||
, itemElem = othis.find('.' + NAV_ITEM);
|
||||
|
||||
//Hover滑动效果
|
||||
if(!othis.find('.'+NAV_BAR)[0]){
|
||||
if (!othis.find('.' + NAV_BAR)[0]) {
|
||||
othis.append(bar);
|
||||
itemElem.on('mouseenter', function(){
|
||||
itemElem.on('mouseenter', function () {
|
||||
follow.call(this, bar, othis, index);
|
||||
}).on('mouseleave', function(){
|
||||
if(!othis.hasClass(NAV_TREE)){
|
||||
}).on('mouseleave', function () {
|
||||
if (!othis.hasClass(NAV_TREE)) {
|
||||
clearTimeout(timerMore[index]);
|
||||
timerMore[index] = setTimeout(function(){
|
||||
othis.find('.'+NAV_CHILD).removeClass(SHOW);
|
||||
othis.find('.'+NAV_MORE).removeClass(NAV_MORE+'d');
|
||||
timerMore[index] = setTimeout(function () {
|
||||
othis.find('.' + NAV_CHILD).removeClass(SHOW);
|
||||
othis.find('.' + NAV_MORE).removeClass(NAV_MORE + 'd');
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
othis.on('mouseleave', function(){
|
||||
othis.on('mouseleave', function () {
|
||||
clearTimeout(timer[index])
|
||||
timeEnd[index] = setTimeout(function(){
|
||||
if(othis.hasClass(NAV_TREE)){
|
||||
timeEnd[index] = setTimeout(function () {
|
||||
if (othis.hasClass(NAV_TREE)) {
|
||||
bar.css({
|
||||
height: 0
|
||||
,top: bar.position().top + bar.height()/2
|
||||
,opacity: 0
|
||||
, top: bar.position().top + bar.height() / 2
|
||||
, opacity: 0
|
||||
});
|
||||
} else {
|
||||
bar.css({
|
||||
width: 0
|
||||
,left: bar.position().left + bar.width()/2
|
||||
,opacity: 0
|
||||
, left: bar.position().left + bar.width() / 2
|
||||
, opacity: 0
|
||||
});
|
||||
}
|
||||
}, TIME);
|
||||
|
@ -373,14 +373,14 @@ layui.define('jquery', function(exports){
|
|||
}
|
||||
|
||||
//展开子菜单
|
||||
itemElem.find('a').each(function(){
|
||||
itemElem.find('a').each(function () {
|
||||
var thisA = $(this)
|
||||
,parent = thisA.parent()
|
||||
,child = thisA.siblings('.'+NAV_CHILD);
|
||||
, parent = thisA.parent()
|
||||
, child = thisA.siblings('.' + NAV_CHILD);
|
||||
|
||||
//输出小箭头
|
||||
if(child[0] && !thisA.children('.'+NAV_MORE)[0]){
|
||||
thisA.append('<span class="'+ NAV_MORE +'"></span>');
|
||||
if (child[0] && !thisA.children('.' + NAV_MORE)[0]) {
|
||||
thisA.append('<span class="' + NAV_MORE + '"></span>');
|
||||
}
|
||||
|
||||
thisA.off('click', call.clickThis).on('click', call.clickThis); //点击菜单
|
||||
|
@ -389,60 +389,60 @@ layui.define('jquery', function(exports){
|
|||
}
|
||||
|
||||
//面包屑
|
||||
,breadcrumb: function(){
|
||||
, breadcrumb: function () {
|
||||
var ELEM = '.layui-breadcrumb';
|
||||
|
||||
$(ELEM + elemFilter).each(function(){
|
||||
$(ELEM + elemFilter).each(function () {
|
||||
var othis = $(this)
|
||||
,ATTE_SPR = 'lay-separator'
|
||||
,separator = othis.attr(ATTE_SPR) || '/'
|
||||
,aNode = othis.find('a');
|
||||
if(aNode.next('span['+ ATTE_SPR +']')[0]) return;
|
||||
aNode.each(function(index){
|
||||
if(index === aNode.length - 1) return;
|
||||
$(this).after('<span '+ ATTE_SPR +'>'+ separator +'</span>');
|
||||
, ATTE_SPR = 'lay-separator'
|
||||
, separator = othis.attr(ATTE_SPR) || '/'
|
||||
, aNode = othis.find('a');
|
||||
if (aNode.next('span[' + ATTE_SPR + ']')[0]) return;
|
||||
aNode.each(function (index) {
|
||||
if (index === aNode.length - 1) return;
|
||||
$(this).after('<span ' + ATTE_SPR + '>' + separator + '</span>');
|
||||
});
|
||||
othis.css('visibility', 'visible');
|
||||
});
|
||||
}
|
||||
|
||||
//进度条
|
||||
,progress: function(){
|
||||
, progress: function () {
|
||||
var ELEM = 'layui-progress';
|
||||
$('.' + ELEM + elemFilter).each(function(){
|
||||
$('.' + ELEM + elemFilter).each(function () {
|
||||
var othis = $(this)
|
||||
,elemBar = othis.find('.layui-progress-bar')
|
||||
,percent = elemBar.attr('lay-percent');
|
||||
, elemBar = othis.find('.layui-progress-bar')
|
||||
, percent = elemBar.attr('lay-percent');
|
||||
|
||||
elemBar.css('width', function(){
|
||||
elemBar.css('width', function () {
|
||||
return /^.+\/.+$/.test(percent)
|
||||
? (new Function('return '+ percent)() * 100) + '%'
|
||||
: percent;
|
||||
? (new Function('return ' + percent)() * 100) + '%'
|
||||
: percent;
|
||||
}());
|
||||
|
||||
if(othis.attr('lay-showPercent')){
|
||||
setTimeout(function(){
|
||||
elemBar.html('<span class="'+ ELEM +'-text">'+ percent +'</span>');
|
||||
},350);
|
||||
if (othis.attr('lay-showPercent')) {
|
||||
setTimeout(function () {
|
||||
elemBar.html('<span class="' + ELEM + '-text">' + percent + '</span>');
|
||||
}, 350);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//折叠面板
|
||||
,collapse: function(){
|
||||
, collapse: function () {
|
||||
var ELEM = 'layui-collapse';
|
||||
|
||||
$('.' + ELEM + elemFilter).each(function(){
|
||||
$('.' + ELEM + elemFilter).each(function () {
|
||||
var elemItem = $(this).find('.layui-colla-item')
|
||||
elemItem.each(function(){
|
||||
elemItem.each(function () {
|
||||
var othis = $(this)
|
||||
,elemTitle = othis.find('.layui-colla-title')
|
||||
,elemCont = othis.find('.layui-colla-content')
|
||||
,isNone = elemCont.css('display') === 'none';
|
||||
, elemTitle = othis.find('.layui-colla-title')
|
||||
, elemCont = othis.find('.layui-colla-content')
|
||||
, isNone = elemCont.css('display') === 'none';
|
||||
|
||||
//初始状态
|
||||
elemTitle.find('.layui-colla-icon').remove();
|
||||
elemTitle.append('<i class="layui-icon layui-colla-icon">'+ (isNone ? '' : '') +'</i>');
|
||||
elemTitle.append('<i class="layui-icon layui-colla-icon">' + (isNone ? '' : '') + '</i>');
|
||||
|
||||
//点击标题
|
||||
elemTitle.off('click', call.collapse).on('click', call.collapse);
|
||||
|
@ -452,7 +452,7 @@ layui.define('jquery', function(exports){
|
|||
}
|
||||
};
|
||||
|
||||
return items[type] ? items[type]() : layui.each(items, function(index, item){
|
||||
return items[type] ? items[type]() : layui.each(items, function (index, item) {
|
||||
item();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1025,8 +1025,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function (exports)
|
|||
/**
|
||||
* 渲染cardList 的td
|
||||
*/
|
||||
renderCardListTd = function (col,colIndex, row, rowIndex, rowNo) {
|
||||
var field = col.field ||colIndex
|
||||
renderCardListTd = function (col, colIndex, row, rowIndex, rowNo) {
|
||||
var field = col.field || colIndex
|
||||
, key = options.index + '-' + col.key
|
||||
, content = row[field]
|
||||
, title = col.title;
|
||||
|
@ -1130,8 +1130,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function (exports)
|
|||
/**
|
||||
*
|
||||
*/
|
||||
renderImageListTd = function (col,colIndex, row, rowIndex, rowNo) {
|
||||
var field = col.field||colIndex
|
||||
renderImageListTd = function (col, colIndex, row, rowIndex, rowNo) {
|
||||
var field = col.field || colIndex
|
||||
, key = options.index + '-' + col.key
|
||||
, content = row[field]
|
||||
, title = col.title,
|
||||
|
@ -1347,7 +1347,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function (exports)
|
|||
numbers = rowIndex + options.limit * (curr - 1) + 1;
|
||||
that.eachCols(function (colIndex, col) {
|
||||
if (col.colGroup) return;
|
||||
var ret = renderCardListTd(col,colIndex, row, rowIndex, numbers);
|
||||
var ret = renderCardListTd(col, colIndex, row, rowIndex, numbers);
|
||||
infotds.push(ret.infotds);
|
||||
tds.push(ret.td);
|
||||
if (col.type === 'radio') {
|
||||
|
@ -1365,7 +1365,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function (exports)
|
|||
numbers = rowIndex + options.limit * (curr - 1) + 1;
|
||||
that.eachCols(function (colIndex, col) {
|
||||
if (col.colGroup) return;
|
||||
var ret = renderImageListTd(col,colIndex, row, rowIndex, numbers);
|
||||
var ret = renderImageListTd(col, colIndex, row, rowIndex, numbers);
|
||||
tds.push(ret.td);
|
||||
tileDivs.push(ret.title);
|
||||
if (col.fixed && col.fixed !== 'right') tds_fixed.push(td);
|
||||
|
@ -2670,7 +2670,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function (exports)
|
|||
that.layFixed.find(ELEM_BODY).scrollTop(scrollTop);
|
||||
|
||||
that.scrollPatch();
|
||||
console.info("that.layHeader.scrollLeft:" + that.layHeader.scrollLeft())
|
||||
layer.close(that.tipsIndex);
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -853,6 +853,11 @@ enum PageEditState {
|
|||
*/
|
||||
class ComponentBase extends SerializeComponetBase {
|
||||
/**
|
||||
*组件的最外层的jquery对象
|
||||
注意: 如果在运行时操作该对象会造成不可预知的错误. 谨慎!!!
|
||||
*/
|
||||
$elemt: JQuery<any>
|
||||
/**
|
||||
*组件背景
|
||||
*/
|
||||
background: string
|
||||
|
@ -1214,6 +1219,10 @@ setParentAfter(parent: ComponentBase,before: ComponentBase): void
|
|||
*组件容器基类 可视化组件
|
||||
*/
|
||||
class ContainerBase extends ComponentBase {
|
||||
/**
|
||||
*是否运行点击的消息传递 默认是true. 如果要自己处理组件的内部点击事件可以设置成false
|
||||
*/
|
||||
isClickStopEvent: boolean
|
||||
|
||||
/**
|
||||
* 把子组件的html元素$elemt添加到自己的children里面;
|
||||
|
@ -1390,6 +1399,14 @@ getTempParamObj(): object
|
|||
*/
|
||||
getTempParamValue(paramName: string): any
|
||||
|
||||
/**
|
||||
* 运行模式 下是否存在数据需要保存才能通过页签关闭页面
|
||||
注意:改函数与 hasChanged的区别 ; 本函数是运行模式针对数据级别的变动标志,hasChanged 是设计模式下组件的属性变动的标志
|
||||
* @returns true 存在修改的数据,则反之 (默认:false)
|
||||
|
||||
*/
|
||||
hasDataChanged(): boolean
|
||||
|
||||
/**
|
||||
* 注册是否允许关闭回调
|
||||
* @param fn 回调函数
|
||||
|
@ -1425,6 +1442,13 @@ removeComponentById(id: string): void
|
|||
*/
|
||||
setHandle(h: any): void
|
||||
|
||||
/**
|
||||
* 运行模式 下是否存在数据需要保存,如果存在页面关闭时候回提示,
|
||||
* @param value true 存在修改的数据,则反之
|
||||
|
||||
*/
|
||||
setHasDataChanged(value: boolean): void
|
||||
|
||||
/**
|
||||
* 设置并融合页面的参数数组
|
||||
不存在就新增,存在就更新
|
||||
|
@ -4726,10 +4750,10 @@ resumeEvents(): void
|
|||
|
||||
/**
|
||||
* 组件序列化
|
||||
* @returns 返回json字符串
|
||||
* @param space 可选参数 输出的格式的缩进参数. 如:每行缩进两个空格 serialize(2)* @returns 返回json字符串
|
||||
|
||||
*/
|
||||
serialize(): any
|
||||
serialize(space: any): any
|
||||
|
||||
/**
|
||||
* 设置组件名称
|
||||
|
@ -6000,6 +6024,13 @@ getAt(index: number): Row
|
|||
*/
|
||||
getById(id: string): Row
|
||||
|
||||
/**
|
||||
* 获取某个修改状态的修改数据
|
||||
* @param state 修改状态 取值: insert,update,delete* @returns 返回对应修改状态的数据数组
|
||||
|
||||
*/
|
||||
getChangeDatas(state: RowState): object[]
|
||||
|
||||
/**
|
||||
* 获取修改的数据用于提交
|
||||
[
|
||||
|
@ -9704,6 +9735,42 @@ declare type onSelectChangedHandle = (cmp: SelectTreeBase,node: ztree.ITreeNode,
|
|||
*/
|
||||
class TreeBase extends DbComponentBase {
|
||||
|
||||
/**
|
||||
* 增加节点
|
||||
* @param parent 父节点,跟节点传 null/undefine
|
||||
* @param nodes 新增的节点数组* @returns 返回新增的节点数组
|
||||
|
||||
*/
|
||||
addNode(parent: ITreeNode,nodes: ITreeNode[]): ITreeNode[]
|
||||
|
||||
/**
|
||||
* 清除书签
|
||||
|
||||
*/
|
||||
clearBookmark(): void
|
||||
|
||||
/**
|
||||
* 展开 / 折叠 全部节点
|
||||
* @param expandFlag true 表示 展开 节点 ;false 表示 折叠 节点* @returns true 表示 展开 全部节点 false 表示 折叠 全部节点
|
||||
|
||||
*/
|
||||
expandAll(expandFlag: boolean): boolean
|
||||
|
||||
/**
|
||||
* 展开 / 折叠 指定的节点
|
||||
* @param node 指定的节点
|
||||
* @param expandFlag true 表示 展开 节点 ;false 表示 折叠 节点* @returns true 表示 展开节点 false 表示 折叠节点
|
||||
|
||||
*/
|
||||
expandNode(node: ITreeNode,expandFlag: boolean): boolean
|
||||
|
||||
/**
|
||||
* 获取所有的节点包含了跟节点和子孙节点的全集数组
|
||||
* @returns 返回所有的节点包含了跟节点和子孙节点的全集数组
|
||||
|
||||
*/
|
||||
getAllNodes(): ITreeNode[]
|
||||
|
||||
/**
|
||||
* 得到被选中的节点数组
|
||||
* @returns 返回选择的节点数组 ITreeNode[]
|
||||
|
@ -9718,6 +9785,12 @@ getSelectNodes(): ITreeNode[]
|
|||
*/
|
||||
getTreeObj(): IzTreeObj
|
||||
|
||||
/**
|
||||
* 选择项跳到书签节点
|
||||
|
||||
*/
|
||||
gotoBookmark(): void
|
||||
|
||||
/**
|
||||
* 加载数据
|
||||
* @param data 数据数组
|
||||
|
@ -9740,6 +9813,13 @@ onCheckChanged(callback: onCheckChangedHandle): void
|
|||
*/
|
||||
onDbClickNode(callback: onSelectChangedHandle): void
|
||||
|
||||
/**
|
||||
* 注册树的数据加载完成事件
|
||||
* @param callback 完成回调
|
||||
|
||||
*/
|
||||
onLoadedData(callback: onLoadedDataHandle): void
|
||||
|
||||
/**
|
||||
* 注册select 值发生点击时候触发事件
|
||||
* @param callback 回调
|
||||
|
@ -9747,23 +9827,66 @@ onDbClickNode(callback: onSelectChangedHandle): void
|
|||
*/
|
||||
onSelectChanged(callback: onSelectChangedHandle): void
|
||||
|
||||
/**
|
||||
* 重新刷新关联的数据源
|
||||
|
||||
*/
|
||||
reload(): void
|
||||
|
||||
/**
|
||||
* 移除子节点
|
||||
* @param parent 父节点* @returns 父节点的子节点数组
|
||||
|
||||
*/
|
||||
removeChildNodes(parent: ITreeNode): ITreeNode[]
|
||||
|
||||
/**
|
||||
* 移除节点
|
||||
* @param node 需要移除的节点
|
||||
|
||||
*/
|
||||
removeNode(node: ITreeNode): void
|
||||
|
||||
/**
|
||||
* 移除func回调返回true 的节点
|
||||
* @param func 匹配节点的回调函数
|
||||
|
||||
*/
|
||||
removeNodeFunc(func: SelectNodeHandle): void
|
||||
|
||||
/**
|
||||
* 设置保存书签
|
||||
* @param bookmark 书签对象 (默认:null时候 保存的是当前选中的节点)
|
||||
|
||||
*/
|
||||
saveBookmark(bookmark: ITreeNode): void
|
||||
|
||||
/**
|
||||
* 选中指定节点
|
||||
* @param treeNode 需要被选中的节点数据
|
||||
* @param addFlag true 表示追加选中,会出现多点同时被选中的情况 false (默认)表示单独选中,原先被选中的节点会被取消选中状态
|
||||
* @param isSilent true 选中节点时,不会让节点自动滚到到可视区域内 false (默认)表示选中节点时,会让节点自动滚到到可视区域内
|
||||
* @param isSilent true 选中节点时,不会让节点自动滚到到可视区域内 false (默认)表示选中节点时,会让节点自动滚到到可视区域内* @returns 返回选择的节点实例
|
||||
|
||||
*/
|
||||
selectNode(treeNode: ITreeNode,addFlag: Boolean,isSilent: boolean): void
|
||||
selectNode(treeNode: ITreeNode,addFlag: boolean,isSilent: boolean): ITreeNode
|
||||
|
||||
/**
|
||||
* 通过func回调返回true 遍历所有的节点并选中返回true的节点(焦点停留在该节点)
|
||||
* @param func 匹配节点的回调函数
|
||||
* @param addFlag true 表示追加选中,会出现多点同时被选中的情况 false (默认)表示单独选中,原先被选中的节点会被取消选中状态
|
||||
* @param isSilent true 选中节点时,不会让节点自动滚到到可视区域内 false (默认)表示选中节点时,会让节点自动滚到到可视区域内* @returns 返回选择的节点实例
|
||||
|
||||
*/
|
||||
selectNodeByFunc(func: SelectNodeHandle,addFlag: boolean,isSilent: boolean): ITreeNode
|
||||
|
||||
/**
|
||||
* 通过id选中指定节点(焦点停留在该节点)
|
||||
* @param id 需要被选中的节点id
|
||||
* @param addFlag true 表示追加选中,会出现多点同时被选中的情况 false (默认)表示单独选中,原先被选中的节点会被取消选中状态
|
||||
* @param isSilent true 选中节点时,不会让节点自动滚到到可视区域内 false (默认)表示选中节点时,会让节点自动滚到到可视区域内
|
||||
* @param addFlag true 表示追加选中,会出现多点同时被选中的情况 false (默认)表示单独选中,原先被选中的节点会被取消选中状态
|
||||
* @param isSilent true 选中节点时,不会让节点自动滚到到可视区域内 false (默认)表示选中节点时,会让节点自动滚到到可视区域内* @returns 返回选择的节点实例
|
||||
|
||||
*/
|
||||
selectNodeById(id: string,addFlag: Boolean,isSilent: boolean): void
|
||||
selectNodeById(id: string,addFlag: boolean,isSilent: boolean): ITreeNode
|
||||
|
||||
/**
|
||||
* 隐藏/显示节点
|
||||
|
@ -9773,12 +9896,19 @@ selectNodeById(id: string,addFlag: Boolean,isSilent: boolean): void
|
|||
*/
|
||||
setNodeVisable(id: string,visiable: boolean): void
|
||||
|
||||
/**
|
||||
* 更新某节点数据,主要用于该节点显示属性的更新。
|
||||
* @param node
|
||||
|
||||
*/
|
||||
updateNode(node: ITreeNode): void
|
||||
|
||||
/**
|
||||
* 更新某节点数据,主要用于该节点显示属性的更新。
|
||||
* @param id 节点的id
|
||||
|
||||
*/
|
||||
updateNode(id: string): void
|
||||
updateNodeById(id: string): void
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -10004,6 +10134,21 @@ getPath(): ITreeNode[]
|
|||
*/
|
||||
getPreNode(): ITreeNode
|
||||
}
|
||||
/**
|
||||
*节点选择回调
|
||||
|
||||
*/
|
||||
declare type SelectNodeHandle = (node: ITreeNode) => boolean
|
||||
/**
|
||||
*组件加载玩数据
|
||||
|
||||
*/
|
||||
declare type onLoadedDataHandle = (cmp: TreeBase) => void
|
||||
/**
|
||||
*节点的名称渲染事件句柄
|
||||
|
||||
*/
|
||||
declare type onRenderNodeHandle = (cmp: TreeBase,node: ztree.ITreeNode) => boolean
|
||||
/**
|
||||
*弹出tree 的 page
|
||||
用于弹出树形的选择选择
|
||||
|
@ -10049,6 +10194,8 @@ class AttributeRender {
|
|||
}
|
||||
/**
|
||||
*剪贴板对象
|
||||
操作剪贴板的类
|
||||
注意: 由于受浏览器的安全限制读取剪贴板. 谷歌浏览器只有在 127.0.0.1 /localhost / https才运行读取剪贴板 获取不支持读取
|
||||
*/
|
||||
class Clipboard {
|
||||
|
||||
|
@ -10108,6 +10255,20 @@ class Designer {
|
|||
config: any
|
||||
version: any
|
||||
|
||||
/**
|
||||
* 获取设计器的当前设计页面实例
|
||||
* @returns 返回页面实例
|
||||
|
||||
*/
|
||||
getPage(): DesignerPageBase
|
||||
|
||||
/**
|
||||
* 设计模式下 判断是否有修改过模型
|
||||
* @returns 返回是否存修改的数据
|
||||
|
||||
*/
|
||||
hasChanged(): boolean
|
||||
|
||||
/**
|
||||
* 渲染设计器
|
||||
这个函数常用于在后台数据库获取页面模型的json 后渲染使用
|
||||
|
@ -10142,6 +10303,13 @@ class ObjectTree {
|
|||
*/
|
||||
class Preview {
|
||||
|
||||
/**
|
||||
* 获取页面实例
|
||||
* @returns 返回页面实例
|
||||
|
||||
*/
|
||||
getPage(): DesignerPageBase
|
||||
|
||||
/**
|
||||
* 预览类渲染函数
|
||||
* @param previewElemtId html 元素的id
|
||||
|
@ -10151,7 +10319,7 @@ render(previewElemtId: string): void
|
|||
|
||||
}
|
||||
/**
|
||||
* 组件树
|
||||
* 版本管理类
|
||||
*/
|
||||
class VersionManger {
|
||||
|
||||
|
@ -12823,8 +12991,8 @@ off(handle: string,msgFilter: string,fn: Function): void
|
|||
* 注册对象的消息处理
|
||||
* @param handle 接收消息来源的对象id或者组件实例...等等.
|
||||
* @param msg 消息字符串
|
||||
* @param callback 消息回调
|
||||
* @param override 是否覆盖之前注册的消息处理函数 默认值 = false
|
||||
* @param callback 消息处理回调
|
||||
* @param override 是否覆盖之前注册的消息处理函数 默认值 = false 只允许存在一个处理回调.
|
||||
* @param isGlobal 是否全局监听(跨域iframe监听) 默认值 = false
|
||||
|
||||
*/
|
||||
|
@ -12836,9 +13004,10 @@ on(handle: string | IComponent,msg: string,callback: Function,override: boolean,
|
|||
* @param msg 消息值
|
||||
* @param parms 附带到消息的参数对象 注意消息参数对象不能是组件的实例,这是因为发送会序列化操作会导致死循环
|
||||
* @param isGlobal 是否全局监听(跨域iframe监听) 默认值 = false
|
||||
* @param doMsgCallback 可选参数, 处理消息的回调
|
||||
|
||||
*/
|
||||
send(handle: string | IComponent,msg: string,parms: any,isGlobal: boolean): void
|
||||
send(handle: string | IComponent,msg: string,parms: any,isGlobal: boolean,doMsgCallback: MessageCallbackhandle): void
|
||||
|
||||
/**
|
||||
* 判断浏览器是否支持postMessage
|
||||
|
@ -12849,6 +13018,45 @@ static getSupportPostMessage(): boolean
|
|||
|
||||
}
|
||||
/**
|
||||
*消息实体类
|
||||
*/
|
||||
interface IMessage {
|
||||
/**
|
||||
*回调函数的id
|
||||
消息回调时候需要使用
|
||||
*/
|
||||
callbackId: string
|
||||
/**
|
||||
*消息接收的句柄
|
||||
*/
|
||||
handle: string
|
||||
/**
|
||||
*消息类型
|
||||
*/
|
||||
msg: string
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
params: any
|
||||
/**
|
||||
*消息处理的返回值
|
||||
*/
|
||||
result: any
|
||||
/**
|
||||
*源消息
|
||||
*/
|
||||
sourceMsg: IMessage
|
||||
/**
|
||||
*消息的所属的target对象的ID
|
||||
*/
|
||||
targetId: string
|
||||
}
|
||||
/**
|
||||
*消息的处理回调
|
||||
|
||||
*/
|
||||
declare type MessageCallbackhandle = (msg: IMessage) => any
|
||||
/**
|
||||
*组件的取名服务类
|
||||
*/
|
||||
class NameGenerateService extends ServiceBase {
|
||||
|
@ -13385,6 +13593,14 @@ static Form(options: IFormOptions): number
|
|||
*/
|
||||
static addJavaScript(id: string,javascript: string): boolean
|
||||
|
||||
/**
|
||||
* 给url地址增加参数 一般用于get请求的参数增加
|
||||
* @param url 地址字符串
|
||||
* @param paramObj 参数对象* @returns 返回处理完成的url地址字符串
|
||||
|
||||
*/
|
||||
static addQueryString(url: string,paramObj: object): string
|
||||
|
||||
/**
|
||||
* 任意值转成boolean类型
|
||||
true: 'true', 11
|
||||
|
@ -13436,9 +13652,10 @@ static autoFill(frmElem: HTMLElement,data: string[],options: object): void
|
|||
* @param cmpId 目标组件ID或者组件实例
|
||||
* @param msgName 消息常量值
|
||||
* @param params 参数
|
||||
* @param doMsgCallback 可选参数, 处理消息的回调
|
||||
|
||||
*/
|
||||
static broadcast(cmpId: string | IComponent,msgName: string,params: any): void
|
||||
static broadcast(cmpId: string | IComponent,msgName: string,params: any,doMsgCallback: MessageCallbackhandle): void
|
||||
|
||||
/**
|
||||
* 关闭指定的弹出层
|
||||
|
@ -13524,22 +13741,24 @@ static doError(xhr: any,textStatus: any): void
|
|||
|
||||
/**
|
||||
* 下载文件
|
||||
注意:这个函数中文文件名存在乱码现象
|
||||
* @param url 下载的文件地址
|
||||
* @param params 参数
|
||||
* @param paramObj 参数对象
|
||||
* @param onStarCallBack 开始下载回调函数
|
||||
* @param processCallBack 处理的回调函数
|
||||
* @param completeCallback 完成回调函数
|
||||
|
||||
*/
|
||||
static downloaFile(url: string,params: any,onStarCallBack: any,processCallBack: any,completeCallback: any): void
|
||||
static downloaFile(url: string,paramObj: object,onStarCallBack: any,processCallBack: any,completeCallback: any): void
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* @param url 下载地址
|
||||
* @param completeCallback 完成回调函数
|
||||
* @param paramobj 参数对象
|
||||
|
||||
*/
|
||||
static download(url: string,completeCallback: any): void
|
||||
static download(url: string,completeCallback: any,paramobj: object): void
|
||||
|
||||
/**
|
||||
* 生效AMD加载
|
||||
|
@ -13607,6 +13826,15 @@ static formPost(url: string,method: MethodType,param: object,callBackFunc: AjaxH
|
|||
*/
|
||||
static formSubmit(url: string,params: IParam[],newTab: boolean): void
|
||||
|
||||
/**
|
||||
* 模拟form 提交
|
||||
* @param url 提交的地址
|
||||
* @param paramObj 参数对象
|
||||
* @param newTab 是否在新页签开启 默认:true
|
||||
|
||||
*/
|
||||
static formSubmitWithParams(url: string,paramObj: object,newTab: boolean): void
|
||||
|
||||
/**
|
||||
* 格式化数字显示方式
|
||||
用法
|
||||
|
@ -14032,13 +14260,14 @@ static require(jsUrl: string,onFinishCallBack: Function,attrs: object): void
|
|||
static requires(jsUrls: string[],onFinishCallBack: Function,attrs: object,isSequence: boolean): void
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* 当前window/iframe 发送消息
|
||||
* @param cmpId 目标组件ID或者组件实例
|
||||
* @param msgName 消息常量值
|
||||
* @param params 参数
|
||||
* @param doMsgCallback 可选参数, 处理消息的回调
|
||||
|
||||
*/
|
||||
static send(cmpId: string | IComponent,msgName: string,params: any): void
|
||||
static send(cmpId: string | IComponent,msgName: string,params: any,doMsgCallback: MessageCallbackhandle): void
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
|
@ -14106,6 +14335,16 @@ Common.tips("hello", btn.getElemt(), { tips: {color:"red", direct: "down" } })
|
|||
*/
|
||||
static tips(content: string,$follow: JQuery<any>,options: IFormTipsOptions): number
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param uploadUrl 上传文件的路径
|
||||
* @param accept 可选参数,可以选择那些文件 默认值:file/* ,可设置 image/* text/* audio/* video/* .xxx 多个格式可以使用逗号隔开: .xxx,.doc,.docx,.xls,.xlsx,.pdf
|
||||
* @param onFinishCallBack 可选参数 完成回调 存在错误时候等于错误信息,为空时候说明完成上传
|
||||
* @param config 可选参数 上传的配置项
|
||||
|
||||
*/
|
||||
static uploadFile(uploadUrl: string,accept: string,onFinishCallBack: onFinishCallBackHandle,config: IUploadImageConfig): void
|
||||
|
||||
/**
|
||||
* 上传图片方法
|
||||
```typescript
|
||||
|
@ -14594,6 +14833,16 @@ class HashMap {
|
|||
*/
|
||||
class KdUploader {
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param uploadUrl 上传文件的路径
|
||||
* @param accept 可以选择那些文件
|
||||
* @param onFinishCallBack 完成回调 存在错误时候等于错误信息,为空时候说明完成上传
|
||||
* @param config 上传的配置项
|
||||
|
||||
*/
|
||||
static upLoadFile(uploadUrl: string,accept: string,onFinishCallBack: onFinishCallBackHandle,config: IUploadImageConfig): void
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param config 上传的配置
|
||||
|
@ -14607,6 +14856,11 @@ static upLoadImage(config: IUploadImageConfig): void
|
|||
*/
|
||||
interface IUploadImageConfig {
|
||||
/**
|
||||
*选择的文件类型
|
||||
*/
|
||||
accept: string
|
||||
elem: HTMLElement
|
||||
/**
|
||||
*上传的文件
|
||||
*/
|
||||
file: File
|
||||
|
@ -14615,6 +14869,10 @@ file: File
|
|||
*/
|
||||
headers: any
|
||||
/**
|
||||
*是否允许上传多个文件
|
||||
*/
|
||||
isMultiple: boolean
|
||||
/**
|
||||
*上传开始前回调
|
||||
*/
|
||||
onBefore: Function
|
||||
|
@ -14635,6 +14893,12 @@ onUploading: any
|
|||
*/
|
||||
url: string
|
||||
}
|
||||
/**
|
||||
*完成回调类型
|
||||
*@param err 存在错误时候等于错误信息,为空时候说明完成上传
|
||||
|
||||
*/
|
||||
declare type onFinishCallBackHandle = (err: string) => void
|
||||
/**
|
||||
*消息盒子
|
||||
用于跨iframe的消息处理和发送
|
||||
|
@ -15220,6 +15484,13 @@ class Custom extends ContainerBase {
|
|||
*/
|
||||
onLoadScript(callback: onCustomHandle): void
|
||||
|
||||
/**
|
||||
* 设置html
|
||||
* @param html html字符串
|
||||
|
||||
*/
|
||||
setHtml(html: string): void
|
||||
|
||||
}
|
||||
/**
|
||||
*脚本加载回调
|
||||
|
@ -15570,6 +15841,28 @@ class TabItemsAttrEditor extends ButtonAttrEditor {
|
|||
*页签内容容器
|
||||
*/
|
||||
class TabPanel extends ContainerBase {
|
||||
/**
|
||||
*附带的临时参数对象
|
||||
*/
|
||||
params: object
|
||||
/**
|
||||
*页签标题
|
||||
*/
|
||||
title: string
|
||||
|
||||
/**
|
||||
* 获取页签的标记
|
||||
* @returns 返回是否显示标记 true 显示,则反之
|
||||
|
||||
*/
|
||||
getShowFlag(): boolean
|
||||
|
||||
/**
|
||||
* 得到组件的父容器组件tab
|
||||
* @returns 返回父组件的实例
|
||||
|
||||
*/
|
||||
getTab(): Tabs
|
||||
|
||||
/**
|
||||
* 得到页签的索引号
|
||||
|
@ -15592,6 +15885,13 @@ onTitleClick(handle: TabPanelTitleClickHandle): void
|
|||
*/
|
||||
onTitleCloseClick(handle: TabPanelTitleClickHandle): void
|
||||
|
||||
/**
|
||||
* 刷新页签
|
||||
如果是url的iframe的页签可以使用该函数刷新
|
||||
|
||||
*/
|
||||
refresh(): void
|
||||
|
||||
/**
|
||||
* 移除页签
|
||||
|
||||
|
@ -15604,6 +15904,20 @@ remove(): void
|
|||
*/
|
||||
setActive(): void
|
||||
|
||||
/**
|
||||
* 设置页签的标记
|
||||
* @param value 是否显示标记 true 显示,则反之
|
||||
|
||||
*/
|
||||
setShowFlag(value: boolean): void
|
||||
|
||||
/**
|
||||
* 设置页签的标题
|
||||
* @param title 标题字符
|
||||
|
||||
*/
|
||||
setTitle(title: string): void
|
||||
|
||||
}
|
||||
/**
|
||||
*Tabs 选项卡
|
||||
|
@ -15642,6 +15956,13 @@ addTab(tab: TabPanel): void
|
|||
*/
|
||||
addUrlTab(title: string,url: string,params: object,method: MethodType,allowClose: boolean): void
|
||||
|
||||
/**
|
||||
* 查找tabPanel
|
||||
* @param findCallback 差早回调* @returns 返回查找到页签数组
|
||||
|
||||
*/
|
||||
findTabPage(findCallback: findTabPanelHandle): TabPanel[]
|
||||
|
||||
/**
|
||||
* 返回激活的页签
|
||||
* @returns 页签的实例
|
||||
|
@ -15697,6 +16018,11 @@ url: string
|
|||
*/
|
||||
interface TabItemsAttrEditorConfig {
|
||||
}
|
||||
/**
|
||||
*查找页签回调类型
|
||||
|
||||
*/
|
||||
declare type findTabPanelHandle = (tabPanel: TabPanel) => boolean
|
||||
/**
|
||||
*文本域组件
|
||||
*/
|
||||
|
@ -35228,3 +35554,349 @@ $( "p" ).wrapInner( $( "<span class='red'></span>" ) );
|
|||
|
||||
[n: number]: TElement;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
zTree: ztree.IzTree;
|
||||
}
|
||||
declare namespace ztree {
|
||||
|
||||
|
||||
interface IJSON {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
|
||||
type ApplicationType = 'application/x-www-form-urlencoded' | 'application/json';
|
||||
type AjaxType = 'get' | 'post' | 'GET' | 'POST';
|
||||
type dataType = 'text' | 'json' | 'jsonp' | 'html' | 'xml' | 'script';
|
||||
|
||||
interface IAsync {
|
||||
autoParam?: string[];
|
||||
contentType?: ApplicationType;
|
||||
dataFilter?: (treeId: string, parentNode: object, responseData: IJSON[] | IJSON | string) => IJSON[] | IJSON;
|
||||
dataType?: dataType;
|
||||
enable?: boolean;
|
||||
otherParam?: string[] | IJSON;
|
||||
type?: AjaxType;
|
||||
headers?: object;
|
||||
xhrFields?: object;
|
||||
url: string;
|
||||
}
|
||||
|
||||
|
||||
type CallBackBeforeFn = (treeId: string, treeNode: ITreeNode) => boolean;
|
||||
type CallBackOnFn = (event: Event, treeId: string, treeNode: ITreeNode) => void;
|
||||
|
||||
interface ICallback {
|
||||
beforeAsync?: CallBackBeforeFn;
|
||||
beforeCheck?: CallBackBeforeFn;
|
||||
beforeClick?: (treeId: string, treeNode: ITreeNode, clickFlag: number) => boolean;
|
||||
beforeCollapse?: CallBackBeforeFn;
|
||||
beforeDblClick?: CallBackBeforeFn;
|
||||
beforeDrag?: (treeId: string, treeNode: ITreeNode[]) => boolean;
|
||||
beforeDragOpen?: CallBackBeforeFn;
|
||||
beforeDrop?: (treeId: string, treeNode: ITreeNode[], targetNode: ITreeNode, moveType: string, isCopy: boolean) => boolean;
|
||||
beforeEditName?: CallBackBeforeFn;
|
||||
beforeExpand?: CallBackBeforeFn;
|
||||
beforeMouseDown?: CallBackBeforeFn;
|
||||
beforeMouseUp?: CallBackBeforeFn;
|
||||
beforeRemove?: CallBackBeforeFn;
|
||||
beforeRename?: (treeId: string, treeNode: ITreeNode, newName: string, isCancel: boolean) => boolean;
|
||||
beforeRightClick?: CallBackBeforeFn;
|
||||
|
||||
onAsyncError?: (event: Event, treeId: string, treeNode: ITreeNode, XMLHttpRequest: any, textStatus: string, errorThrown: string) => void;
|
||||
onAsyncSuccess?: (event: Event, treeId: string, treeNode: ITreeNode, msg: string | object) => void;
|
||||
onCheck?: (event: Event, treeId: string, treeNode: object) => void;
|
||||
onClick?: (event: Event, treeId: string, treeNode: ITreeNode, clickFlag: number) => void;
|
||||
onCollapse?: (event: Event, treeId: string, treeNode: ITreeNode) => void;
|
||||
onDblClick?: (event: Event, treeId: string, treeNode: ITreeNode) => void;
|
||||
onDrag?: (event: Event, treeId: string, treeNodes: ITreeNode[]) => void;
|
||||
onDragMove?: (event: Event, treeId: string, treeNodes: ITreeNode[]) => void;
|
||||
onDrop?: (event: Event, treeId: string, treeNodes: ITreeNode[], targetNode: object, moveType: string, isCopy: boolean) => void;
|
||||
onExpand?: CallBackOnFn;
|
||||
onMouseDown?: CallBackOnFn;
|
||||
onMouseUp?: CallBackOnFn;
|
||||
onNodeCreated?: CallBackOnFn;
|
||||
onRemove?: CallBackOnFn;
|
||||
onRename?: (event: Event, treeId: string, treeNode: ITreeNode, isCancel: boolean) => void;
|
||||
onRightClick?: CallBackOnFn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 树节点接口声明
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
[key: string]: any
|
||||
/**
|
||||
* 节点的唯一标识 tId。
|
||||
*/
|
||||
tId?: string
|
||||
|
||||
/**
|
||||
* 节点的父节点唯一标识 tId。
|
||||
*/
|
||||
parentTId?: string
|
||||
|
||||
/**
|
||||
* 节点的 checkBox / radio 的 勾选状态
|
||||
*/
|
||||
checkBox?: boolean
|
||||
|
||||
/**
|
||||
* 记录节点的层级
|
||||
* 根节点 level = 0,依次递增
|
||||
*/
|
||||
level?: number
|
||||
|
||||
/**
|
||||
* 节点是否为同级节点中的最后一个节点。
|
||||
*/
|
||||
isLastNode?: boolean
|
||||
|
||||
/**
|
||||
* 节点是否为同级节点中的第一个节点。
|
||||
*/
|
||||
isFirstNode?: boolean
|
||||
|
||||
/**
|
||||
* 记录节点 的 hover 状态
|
||||
*/
|
||||
isHover?: boolean
|
||||
|
||||
|
||||
/**
|
||||
* 用于记录节点是否处于编辑名称状态 [setting.edit.enable = true 时有效]
|
||||
*/
|
||||
editNameFlag?: boolean
|
||||
|
||||
/**
|
||||
* 节点是否正在进行异步加载。
|
||||
*/
|
||||
isAjaxing?: boolean
|
||||
|
||||
/**
|
||||
* 节点是否已经进行过异步加载,避免父节点反复异步加载数据。
|
||||
*/
|
||||
zAsync?: boolean
|
||||
|
||||
/**
|
||||
* 用于设置节点的子节点的 checkBox / radio 的半选状态
|
||||
* setting.check.checkType = "checkbox"
|
||||
* -1 不存在子节点 或 子节点全部设置为 nocheck = true
|
||||
* 0 无 子节点被勾选
|
||||
* 1 部分 子节点被勾选
|
||||
* 2 全部 子节点被勾选
|
||||
* setting.check.checkType = "radio"
|
||||
* -1 不存在子节点 或 子节点全部设置为 nocheck = true
|
||||
* 0 无 子节点被勾选
|
||||
* 2 有 子节点被勾选
|
||||
*/
|
||||
check_Child_State?: number
|
||||
/**
|
||||
* 设置节点的 checkBox / radio 的 focus 状态
|
||||
* 默认值:false
|
||||
*/
|
||||
check_Focus?: boolean
|
||||
|
||||
/**
|
||||
* 强制节点的 checkBox / radio 的 半勾选状态。[setting.check.enable = true & treeNode.nocheck = false 时有效]
|
||||
* 1、强制为半勾选状态后,不再进行自动计算半勾选状态
|
||||
* 2、设置 treeNode.halfCheck = false 或 null 才能恢复自动计算半勾选状态
|
||||
* 3、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据
|
||||
* 默认值:false
|
||||
*/
|
||||
halfCheck?: boolean
|
||||
/**
|
||||
* 节点自定义图标的 URL 路径。
|
||||
* 1、父节点如果只设置 icon ,会导致展开、折叠时都使用同一个图标
|
||||
* 2、父节点展开、折叠使用不同的个性化图标需要同时设置 treeNode.iconOpen / treeNode.iconClose 两个属性
|
||||
* 3、如果想利用 className 设置个性化图标,需要设置 treeNode.iconSkin 属性
|
||||
* 默认值:无
|
||||
*/
|
||||
icon?: string
|
||||
|
||||
/**
|
||||
* 父节点自定义折叠时图标的 URL 路径。
|
||||
* 1、此属性只针对父节点有效
|
||||
* 2、此属性必须与 iconOpen 同时使用
|
||||
* 3、如果想利用 className 设置个性化图标,需要设置 treeNode.iconSkin 属性
|
||||
* 默认值:无
|
||||
*/
|
||||
iconClose?: string
|
||||
/**
|
||||
* 父节点自定义展开时图标的 URL 路径。
|
||||
* 1、此属性只针对父节点有效
|
||||
* 2、此属性必须与 iconClose 同时使用
|
||||
* 3、如果想利用 className 设置个性化图标,需要设置 treeNode.iconSkin 属性
|
||||
* 默认值:无
|
||||
*/
|
||||
iconOpen?: string
|
||||
/**
|
||||
* 获取节点在同级节点中的位置。
|
||||
*/
|
||||
getIndex(): number
|
||||
/**
|
||||
* 获取与节点相邻的后一个节点。
|
||||
*/
|
||||
getNextNode(): ITreeNode
|
||||
/**
|
||||
* 获取节点的父节点。
|
||||
* @return 节点的父节点数据对象。
|
||||
*/
|
||||
getParentNode(): ITreeNode
|
||||
|
||||
/**
|
||||
* 获取 treeNode 节点的所有父节点(包括自己)。
|
||||
* @returns treeNode 节点的所有父节点的数据集合(包括自己)
|
||||
*/
|
||||
getPath(): ITreeNode[]
|
||||
|
||||
|
||||
/**
|
||||
* 获取与 treeNode 节点相邻的前一个节点。
|
||||
*/
|
||||
getPreNode(): ITreeNode
|
||||
|
||||
}
|
||||
|
||||
interface ICheck {
|
||||
autoCheckTrigger?: boolean;
|
||||
chkboxType?: IJSON;
|
||||
chkStyle?: string;
|
||||
enable?: boolean;
|
||||
nocheckInherit?: boolean;
|
||||
chkDisabledInherit?: boolean;
|
||||
radioType?: string;
|
||||
}
|
||||
|
||||
interface IData {
|
||||
keep?: {
|
||||
leaf?: boolean;
|
||||
parent?: boolean;
|
||||
},
|
||||
key?: {
|
||||
checked?: string;
|
||||
children?: string;
|
||||
isParent?: string;
|
||||
isHidden?: string;
|
||||
name?: string;
|
||||
title?: string;
|
||||
url?: string;
|
||||
},
|
||||
simpleData?: {
|
||||
enable?: boolean;
|
||||
idKey?: string;
|
||||
pIdKey?: string;
|
||||
rootPId?: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
type removeFnType<T> = (treeId: string, treeNode: ITreeNode) => T;
|
||||
|
||||
interface IEdit {
|
||||
drag?: {
|
||||
autoExpandTrigger?: boolean;
|
||||
isCopy?: boolean;
|
||||
isMove?: boolean;
|
||||
prev?: boolean;
|
||||
next?: boolean;
|
||||
inner?: boolean;
|
||||
borderMax?: number;
|
||||
borderMin?: number;
|
||||
minMoveSize?: number;
|
||||
maxShowNodeNum?: number;
|
||||
autoOpenTime?: number;
|
||||
},
|
||||
editNameSelectAll?: boolean;
|
||||
enable?: boolean;
|
||||
removeTitle?: string | removeFnType<string>;
|
||||
renameTitle?: string | removeFnType<string>;
|
||||
showRemoveBtn?: boolean | removeFnType<boolean>;
|
||||
showRenameBtn?: boolean | removeFnType<boolean>;
|
||||
}
|
||||
|
||||
|
||||
type dblClickExpandFn<T> = (treeId: string, treeNode: ITreeNode) => T;
|
||||
|
||||
interface IView {
|
||||
addDiyDom?: dblClickExpandFn<void>;
|
||||
addHoverDom?: dblClickExpandFn<void>;
|
||||
autoCancelSelected?: boolean;
|
||||
dblClickExpand?: boolean | dblClickExpandFn<boolean>;
|
||||
expandSpeed?: string | number;
|
||||
fontCss?: IJSON | dblClickExpandFn<IJSON>;
|
||||
nameIsHTML?: boolean;
|
||||
removeHoverDom?: dblClickExpandFn<void>;
|
||||
selectedMulti?: boolean;
|
||||
showIcon?: boolean | dblClickExpandFn<boolean>;
|
||||
showLine?: boolean;
|
||||
showTitle?: boolean | dblClickExpandFn<boolean>;
|
||||
txtSelectedEnable?: boolean;
|
||||
}
|
||||
|
||||
interface IZTreeSetting {
|
||||
/**
|
||||
* html元素的id
|
||||
*/
|
||||
treeId?: string
|
||||
treeInstObj?: object
|
||||
async?: IAsync;
|
||||
callback?: ICallback;
|
||||
check?: ICheck;
|
||||
data?: IData;
|
||||
edit?: IEdit;
|
||||
view?: IView;
|
||||
}
|
||||
|
||||
|
||||
type filterFnType = (node: ITreeNode) => boolean;
|
||||
|
||||
export interface IzTreeObj {
|
||||
setting: IZTreeSetting;
|
||||
addNodes: (parentNode: ITreeNode, index?: number, newNodes?: IJSON[] | IJSON, isSilentBoolean?: boolean) => ITreeNode[];
|
||||
cancelEditName: (newName?: string) => void;
|
||||
cancelSelectedNode: (treeNode?: ITreeNode) => void;
|
||||
checkAllNodes: (checked: boolean) => void;
|
||||
checkNode: (treeNode: ITreeNode, checked?: boolean, checkTypeFlag?: boolean, callbackFlag?: boolean) => void;
|
||||
copyNode: (targetNode: ITreeNode, treeNode: ITreeNode, moveType: string, isSilent: boolean) => ITreeNode;
|
||||
destroy: () => void;
|
||||
editName: (treeNode: ITreeNode) => void;
|
||||
expandAll: (expandFlag: boolean) => boolean | null;
|
||||
expandNode: (treeNode: ITreeNode, expandFlag?: boolean, sonSign?: boolean, focus?: boolean, callbackFlag?: boolean) => boolean | null;
|
||||
getChangeCheckedNodes: () => ITreeNode[];
|
||||
getCheckedNodes: (checked?: boolean) => ITreeNode[];
|
||||
getNodeByParam: (key: string, value: any, parentNode?: ITreeNode) => ITreeNode;
|
||||
getNodeByTId: (tId: string) => ITreeNode;
|
||||
getNodeIndex: (treeNode: ITreeNode) => number;
|
||||
getNodes: () => ITreeNode[];
|
||||
getNodesByFilter: (filter: filterFnType, isSingle?: boolean, parentNode?: ITreeNode, invokeParam?: any) => ITreeNode[];
|
||||
getNodesByParam: (key: string, value: any, parentNode?: ITreeNode) => ITreeNode[];
|
||||
getNodesByParamFuzzy: (key: string, value: string, parentNode?: ITreeNode) => ITreeNode;
|
||||
getSelectedNodes: () => any;
|
||||
hideNode: (treeNode: ITreeNode) => void;
|
||||
hideNodes: (treeNodes: ITreeNode[]) => void;
|
||||
moveNode: (targetNode: ITreeNode, treeNode: ITreeNode, moveType: string, isSilent?: boolean) => ITreeNode;
|
||||
reAsyncChildNodes: (parentNode: ITreeNode, reloadType: string, isSilent?: boolean, callback?: any) => void;
|
||||
reAsyncChildNodesPromise: (parentNode: ITreeNode, reloadType: string, isSilent?: boolean) => any;
|
||||
refresh: () => void;
|
||||
removeChildNodes: (parentNode: ITreeNode) => ITreeNode[];
|
||||
removeNode: (treeNode: ITreeNode, callbackFlag?: boolean) => void;
|
||||
selectNode: (treeNode: ITreeNode, addFlag?: boolean, isSilent?: boolean) => void;
|
||||
setChkDisabled: (treeNode: ITreeNode, disabled?: boolean, inheritParent?: boolean, inheritChildren?: boolean) => void;
|
||||
setEditable: (editable: boolean) => void;
|
||||
showNode: (treeNode: ITreeNode) => void;
|
||||
showNodes: (treeNodes: ITreeNode[]) => void;
|
||||
transformToArray: (treeNodes: ITreeNode[] | IJSON) => ITreeNode[];
|
||||
transformTozTreeNodes: (simpleNodes: IJSON[] | IJSON) => ITreeNode[];
|
||||
updateNode: (treeNode: ITreeNode, checkTypeFlag?: boolean) => void;
|
||||
}
|
||||
|
||||
export interface IzTree {
|
||||
init?: (dom: any, setting: IZTreeSetting, zNodes: IJSON[] | object) => IzTreeObj;
|
||||
getZTreeObj?: (treeId: string) => IzTreeObj;
|
||||
destroy?: (treeId: string) => void;
|
||||
_z?: any;
|
||||
}
|
||||
}
|
|
@ -6,72 +6,72 @@
|
|||
|
||||
*/
|
||||
|
||||
layui.define('jquery', function(exports){
|
||||
layui.define('jquery', function (exports) {
|
||||
"use strict";
|
||||
|
||||
var $ = layui.$
|
||||
,hint = layui.hint()
|
||||
,device = layui.device()
|
||||
, hint = layui.hint()
|
||||
, device = layui.device()
|
||||
|
||||
,MOD_NAME = 'element', THIS = 'layui-this', SHOW = 'layui-show'
|
||||
, MOD_NAME = 'element', THIS = 'layui-this', SHOW = 'layui-show'
|
||||
|
||||
,Element = function(){
|
||||
this.config = {};
|
||||
};
|
||||
, Element = function () {
|
||||
this.config = {};
|
||||
};
|
||||
|
||||
//全局设置
|
||||
Element.prototype.set = function(options){
|
||||
Element.prototype.set = function (options) {
|
||||
var that = this;
|
||||
$.extend(true, that.config, options);
|
||||
return that;
|
||||
};
|
||||
|
||||
//表单事件监听
|
||||
Element.prototype.on = function(events, callback){
|
||||
Element.prototype.on = function (events, callback) {
|
||||
return layui.onevent.call(this, MOD_NAME, events, callback);
|
||||
};
|
||||
|
||||
//外部Tab新增
|
||||
Element.prototype.tabAdd = function(filter, options){
|
||||
Element.prototype.tabAdd = function (filter, options) {
|
||||
var TITLE = '.layui-tab-title'
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,barElem = titElem.children('.layui-tab-bar')
|
||||
,contElem = tabElem.children('.layui-tab-content')
|
||||
,li = '<li lay-id="'+ (options.id||'') +'"'
|
||||
+(options.attr ? ' lay-attr="'+ options.attr +'"' : '') +'>'+ (options.title||'unnaming') +'</li>';
|
||||
, tabElem = $('.layui-tab[lay-filter=' + filter + ']')
|
||||
, titElem = tabElem.children(TITLE)
|
||||
, barElem = titElem.children('.layui-tab-bar')
|
||||
, contElem = tabElem.children('.layui-tab-content')
|
||||
, li = '<li lay-id="' + (options.id || '') + '"'
|
||||
+ (options.attr ? ' lay-attr="' + options.attr + '"' : '') + '>' + (options.title || 'unnaming') + '</li>';
|
||||
|
||||
barElem[0] ? barElem.before(li) : titElem.append(li);
|
||||
contElem.append('<div class="layui-tab-item">'+ (options.content||'') +'</div>');
|
||||
contElem.append('<div class="layui-tab-item">' + (options.content || '') + '</div>');
|
||||
call.hideTabMore(true);
|
||||
call.tabAuto();
|
||||
return this;
|
||||
};
|
||||
|
||||
//外部Tab删除
|
||||
Element.prototype.tabDelete = function(filter, layid){
|
||||
Element.prototype.tabDelete = function (filter, layid) {
|
||||
var TITLE = '.layui-tab-title'
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
|
||||
, tabElem = $('.layui-tab[lay-filter=' + filter + ']')
|
||||
, titElem = tabElem.children(TITLE)
|
||||
, liElem = titElem.find('>li[lay-id="' + layid + '"]');
|
||||
call.tabDelete(null, liElem);
|
||||
return this;
|
||||
};
|
||||
|
||||
//外部Tab切换
|
||||
Element.prototype.tabChange = function(filter, layid){
|
||||
Element.prototype.tabChange = function (filter, layid) {
|
||||
var TITLE = '.layui-tab-title'
|
||||
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
|
||||
,titElem = tabElem.children(TITLE)
|
||||
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
|
||||
, tabElem = $('.layui-tab[lay-filter=' + filter + ']')
|
||||
, titElem = tabElem.children(TITLE)
|
||||
, liElem = titElem.find('>li[lay-id="' + layid + '"]');
|
||||
call.tabClick.call(liElem[0], null, null, liElem);
|
||||
return this;
|
||||
};
|
||||
|
||||
//自定义Tab选项卡
|
||||
Element.prototype.tab = function(options){
|
||||
Element.prototype.tab = function (options) {
|
||||
options = options || {};
|
||||
dom.on('click', options.headerElem, function(e){
|
||||
dom.on('click', options.headerElem, function (e) {
|
||||
var index = $(this).index();
|
||||
call.tabClick.call(this, e, index, null, options);
|
||||
});
|
||||
|
@ -79,263 +79,267 @@ layui.define('jquery', function(exports){
|
|||
|
||||
|
||||
//动态改变进度条
|
||||
Element.prototype.progress = function(filter, percent){
|
||||
Element.prototype.progress = function (filter, percent) {
|
||||
var ELEM = 'layui-progress'
|
||||
,elem = $('.'+ ELEM +'[lay-filter='+ filter +']')
|
||||
,elemBar = elem.find('.'+ ELEM +'-bar')
|
||||
,text = elemBar.find('.'+ ELEM +'-text');
|
||||
, elem = $('.' + ELEM + '[lay-filter=' + filter + ']')
|
||||
, elemBar = elem.find('.' + ELEM + '-bar')
|
||||
, text = elemBar.find('.' + ELEM + '-text');
|
||||
elemBar.css('width', percent);
|
||||
text.text(percent);
|
||||
return this;
|
||||
};
|
||||
|
||||
var NAV_ELEM = '.layui-nav', NAV_ITEM = 'layui-nav-item', NAV_BAR = 'layui-nav-bar'
|
||||
,NAV_TREE = 'layui-nav-tree', NAV_CHILD = 'layui-nav-child', NAV_MORE = 'layui-nav-more'
|
||||
,NAV_ANIM = 'layui-anim layui-anim-upbit'
|
||||
, NAV_TREE = 'layui-nav-tree', NAV_CHILD = 'layui-nav-child', NAV_MORE = 'layui-nav-more'
|
||||
, NAV_ANIM = 'layui-anim layui-anim-upbit'
|
||||
|
||||
//基础事件体
|
||||
,call = {
|
||||
//Tab点击
|
||||
tabClick: function(e, index, liElem, options){
|
||||
options = options || {};
|
||||
var othis = liElem || $(this)
|
||||
,index = index || othis.parent().children('li').index(othis)
|
||||
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
||||
,item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
,elemA = othis.find('a')
|
||||
,filter = parents.attr('lay-filter');
|
||||
//基础事件体
|
||||
, call = {
|
||||
//Tab点击
|
||||
tabClick: function (e, index, liElem, options) {
|
||||
options = options || {};
|
||||
var othis = liElem || $(this)
|
||||
, index = index || othis.parent().children('li').index(othis)
|
||||
, parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
||||
, item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
, elemA = othis.find('a')
|
||||
, filter = parents.attr('lay-filter');
|
||||
|
||||
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank')){
|
||||
othis.addClass(THIS).siblings().removeClass(THIS);
|
||||
item.eq(index).addClass(SHOW).siblings().removeClass(SHOW);
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'tab('+ filter +')', {
|
||||
elem: parents
|
||||
,index: index
|
||||
});
|
||||
}
|
||||
|
||||
//Tab删除
|
||||
,tabDelete: function(e, othis){
|
||||
var li = othis || $(this).parent(), index = li.index()
|
||||
,parents = li.parents('.layui-tab').eq(0)
|
||||
,item = parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
,filter = parents.attr('lay-filter');
|
||||
|
||||
if(li.hasClass(THIS)){
|
||||
if(li.next()[0]){
|
||||
call.tabClick.call(li.next()[0], null, index + 1);
|
||||
} else if(li.prev()[0]){
|
||||
call.tabClick.call(li.prev()[0], null, index - 1);
|
||||
}
|
||||
}
|
||||
|
||||
li.remove();
|
||||
item.eq(index).remove();
|
||||
setTimeout(function(){
|
||||
call.tabAuto();
|
||||
}, 50);
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'tabDelete('+ filter +')', {
|
||||
elem: parents
|
||||
,index: index
|
||||
});
|
||||
}
|
||||
|
||||
//Tab自适应
|
||||
,tabAuto: function(){
|
||||
var SCROLL = 'layui-tab-scroll', MORE = 'layui-tab-more', BAR = 'layui-tab-bar'
|
||||
,CLOSE = 'layui-tab-close', that = this;
|
||||
|
||||
$('.layui-tab').each(function(){
|
||||
var othis = $(this)
|
||||
,title = othis.children('.layui-tab-title')
|
||||
,item = othis.children('.layui-tab-content').children('.layui-tab-item')
|
||||
,STOPE = 'lay-stope="tabmore"'
|
||||
,span = $('<span class="layui-unselect layui-tab-bar" '+ STOPE +'><i '+ STOPE +' class="layui-icon"></i></span>');
|
||||
|
||||
if(that === window && device.ie != 8){
|
||||
call.hideTabMore(true)
|
||||
if (!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank')) {
|
||||
othis.addClass(THIS).siblings().removeClass(THIS);
|
||||
item.eq(index).addClass(SHOW).siblings().removeClass(SHOW);
|
||||
}
|
||||
|
||||
//允许关闭
|
||||
if(othis.attr('lay-allowClose')){
|
||||
title.find('li').each(function(){
|
||||
var li = $(this);
|
||||
if(!li.find('.'+CLOSE)[0]){
|
||||
var close = $('<i class="layui-icon layui-unselect '+ CLOSE +'">ဆ</i>');
|
||||
close.on('click', call.tabDelete);
|
||||
li.append(close);
|
||||
layui.event.call(this, MOD_NAME, 'tab(' + filter + ')', {
|
||||
elem: parents
|
||||
, index: index
|
||||
});
|
||||
}
|
||||
|
||||
//Tab删除
|
||||
, tabDelete: function (e, othis) {
|
||||
var li = othis || $(this).parent(), index = li.index()
|
||||
, parents = li.parents('.layui-tab').eq(0)
|
||||
, item = parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||
, filter = parents.attr('lay-filter');
|
||||
setTimeout(function () {
|
||||
call.tabAuto();
|
||||
}, 50);
|
||||
var param = {
|
||||
elem: parents
|
||||
, index: index
|
||||
, canClose: true
|
||||
};
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'tabDelete(' + filter + ')', param);
|
||||
|
||||
if (param.canClose === true) {
|
||||
if (li.hasClass(THIS)) {
|
||||
if (li.next()[0]) {
|
||||
call.tabClick.call(li.next()[0], null, index + 1);
|
||||
} else if (li.prev()[0]) {
|
||||
call.tabClick.call(li.prev()[0], null, index - 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
item.eq(index).remove();
|
||||
li.remove();
|
||||
}
|
||||
|
||||
if(typeof othis.attr('lay-unauto') === 'string') return;
|
||||
|
||||
//响应式
|
||||
if(title.prop('scrollWidth') > title.outerWidth()+1){
|
||||
if(title.find('.'+BAR)[0]) return;
|
||||
title.append(span);
|
||||
othis.attr('overflow', '');
|
||||
span.on('click', function(e){
|
||||
title[this.title ? 'removeClass' : 'addClass'](MORE);
|
||||
this.title = this.title ? '' : '收缩';
|
||||
});
|
||||
} else {
|
||||
title.find('.'+BAR).remove();
|
||||
othis.removeAttr('overflow');
|
||||
}
|
||||
});
|
||||
}
|
||||
//隐藏更多Tab
|
||||
,hideTabMore: function(e){
|
||||
var tsbTitle = $('.layui-tab-title');
|
||||
if(e === true || $(e.target).attr('lay-stope') !== 'tabmore'){
|
||||
tsbTitle.removeClass('layui-tab-more');
|
||||
tsbTitle.find('.layui-tab-bar').attr('title','');
|
||||
}
|
||||
}
|
||||
|
||||
//点击菜单 - a标签触发
|
||||
,clickThis: function(){
|
||||
var othis = $(this)
|
||||
,parents = othis.parents(NAV_ELEM)
|
||||
,filter = parents.attr('lay-filter')
|
||||
,parent = othis.parent()
|
||||
,child = othis.siblings('.'+NAV_CHILD)
|
||||
,unselect = typeof parent.attr('lay-unselect') === 'string';
|
||||
//Tab自适应
|
||||
, tabAuto: function () {
|
||||
var SCROLL = 'layui-tab-scroll', MORE = 'layui-tab-more', BAR = 'layui-tab-bar'
|
||||
, CLOSE = 'layui-tab-close', that = this;
|
||||
|
||||
if(!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect){
|
||||
if(!child[0]){
|
||||
parents.find('.'+THIS).removeClass(THIS);
|
||||
parent.addClass(THIS);
|
||||
$('.layui-tab').each(function () {
|
||||
var othis = $(this)
|
||||
, title = othis.children('.layui-tab-title')
|
||||
, item = othis.children('.layui-tab-content').children('.layui-tab-item')
|
||||
, STOPE = 'lay-stope="tabmore"'
|
||||
, span = $('<span class="layui-unselect layui-tab-bar" ' + STOPE + '><i ' + STOPE + ' class="layui-icon"></i></span>');
|
||||
|
||||
if (that === window && device.ie != 8) {
|
||||
call.hideTabMore(true)
|
||||
}
|
||||
|
||||
//允许关闭
|
||||
if (othis.attr('lay-allowClose')) {
|
||||
title.find('li').each(function () {
|
||||
var li = $(this);
|
||||
if (!li.find('.' + CLOSE)[0]) {
|
||||
var close = $('<i class="layui-icon layui-unselect ' + CLOSE + '">ဆ</i>');
|
||||
close.on('click', call.tabDelete);
|
||||
li.append(close);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof othis.attr('lay-unauto') === 'string') return;
|
||||
|
||||
//响应式
|
||||
if (title.prop('scrollWidth') > title.outerWidth() + 1) {
|
||||
if (title.find('.' + BAR)[0]) return;
|
||||
title.append(span);
|
||||
othis.attr('overflow', '');
|
||||
span.on('click', function (e) {
|
||||
title[this.title ? 'removeClass' : 'addClass'](MORE);
|
||||
this.title = this.title ? '' : '收缩';
|
||||
});
|
||||
} else {
|
||||
title.find('.' + BAR).remove();
|
||||
othis.removeAttr('overflow');
|
||||
}
|
||||
});
|
||||
}
|
||||
//隐藏更多Tab
|
||||
, hideTabMore: function (e) {
|
||||
var tsbTitle = $('.layui-tab-title');
|
||||
if (e === true || $(e.target).attr('lay-stope') !== 'tabmore') {
|
||||
tsbTitle.removeClass('layui-tab-more');
|
||||
tsbTitle.find('.layui-tab-bar').attr('title', '');
|
||||
}
|
||||
}
|
||||
|
||||
//如果是垂直菜单
|
||||
if(parents.hasClass(NAV_TREE)){
|
||||
child.removeClass(NAV_ANIM);
|
||||
//点击菜单 - a标签触发
|
||||
, clickThis: function () {
|
||||
var othis = $(this)
|
||||
, parents = othis.parents(NAV_ELEM)
|
||||
, filter = parents.attr('lay-filter')
|
||||
, parent = othis.parent()
|
||||
, child = othis.siblings('.' + NAV_CHILD)
|
||||
, unselect = typeof parent.attr('lay-unselect') === 'string';
|
||||
|
||||
//如果有子菜单,则展开
|
||||
if(child[0]){
|
||||
parent[child.css('display') === 'none' ? 'addClass': 'removeClass'](NAV_ITEM+'ed');
|
||||
if(parents.attr('lay-shrink') === 'all'){
|
||||
parent.siblings().removeClass(NAV_ITEM + 'ed');
|
||||
if (!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect) {
|
||||
if (!child[0]) {
|
||||
parents.find('.' + THIS).removeClass(THIS);
|
||||
parent.addClass(THIS);
|
||||
}
|
||||
}
|
||||
|
||||
//如果是垂直菜单
|
||||
if (parents.hasClass(NAV_TREE)) {
|
||||
child.removeClass(NAV_ANIM);
|
||||
|
||||
//如果有子菜单,则展开
|
||||
if (child[0]) {
|
||||
parent[child.css('display') === 'none' ? 'addClass' : 'removeClass'](NAV_ITEM + 'ed');
|
||||
if (parents.attr('lay-shrink') === 'all') {
|
||||
parent.siblings().removeClass(NAV_ITEM + 'ed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'nav(' + filter + ')', othis);
|
||||
}
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
|
||||
}
|
||||
|
||||
//折叠面板
|
||||
, collapse: function () {
|
||||
var othis = $(this), icon = othis.find('.layui-colla-icon')
|
||||
, elemCont = othis.siblings('.layui-colla-content')
|
||||
, parents = othis.parents('.layui-collapse').eq(0)
|
||||
, filter = parents.attr('lay-filter')
|
||||
, isNone = elemCont.css('display') === 'none';
|
||||
|
||||
//折叠面板
|
||||
,collapse: function(){
|
||||
var othis = $(this), icon = othis.find('.layui-colla-icon')
|
||||
,elemCont = othis.siblings('.layui-colla-content')
|
||||
,parents = othis.parents('.layui-collapse').eq(0)
|
||||
,filter = parents.attr('lay-filter')
|
||||
,isNone = elemCont.css('display') === 'none';
|
||||
//是否手风琴
|
||||
if (typeof parents.attr('lay-accordion') === 'string') {
|
||||
var show = parents.children('.layui-colla-item').children('.' + SHOW);
|
||||
show.siblings('.layui-colla-title').children('.layui-colla-icon').html('');
|
||||
show.removeClass(SHOW);
|
||||
}
|
||||
|
||||
//是否手风琴
|
||||
if(typeof parents.attr('lay-accordion') === 'string'){
|
||||
var show = parents.children('.layui-colla-item').children('.'+SHOW);
|
||||
show.siblings('.layui-colla-title').children('.layui-colla-icon').html('');
|
||||
show.removeClass(SHOW);
|
||||
elemCont[isNone ? 'addClass' : 'removeClass'](SHOW);
|
||||
icon.html(isNone ? '' : '');
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'collapse(' + filter + ')', {
|
||||
title: othis
|
||||
, content: elemCont
|
||||
, show: isNone
|
||||
});
|
||||
}
|
||||
|
||||
elemCont[isNone ? 'addClass' : 'removeClass'](SHOW);
|
||||
icon.html(isNone ? '' : '');
|
||||
|
||||
layui.event.call(this, MOD_NAME, 'collapse('+ filter +')', {
|
||||
title: othis
|
||||
,content: elemCont
|
||||
,show: isNone
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//初始化元素操作
|
||||
Element.prototype.init = function(type, filter){
|
||||
var that = this, elemFilter = function(){
|
||||
return filter ? ('[lay-filter="' + filter +'"]') : '';
|
||||
Element.prototype.init = function (type, filter) {
|
||||
var that = this, elemFilter = function () {
|
||||
return filter ? ('[lay-filter="' + filter + '"]') : '';
|
||||
}(), items = {
|
||||
|
||||
//Tab选项卡
|
||||
tab: function(){
|
||||
tab: function () {
|
||||
call.tabAuto.call({});
|
||||
}
|
||||
|
||||
//导航菜单
|
||||
,nav: function(){
|
||||
var TIME = 200, timer = {}, timerMore = {}, timeEnd = {}, follow = function(bar, nav, index){
|
||||
var othis = $(this), child = othis.find('.'+NAV_CHILD);
|
||||
, nav: function () {
|
||||
var TIME = 200, timer = {}, timerMore = {}, timeEnd = {}, follow = function (bar, nav, index) {
|
||||
var othis = $(this), child = othis.find('.' + NAV_CHILD);
|
||||
|
||||
if(nav.hasClass(NAV_TREE)){
|
||||
if (nav.hasClass(NAV_TREE)) {
|
||||
bar.css({
|
||||
top: othis.position().top
|
||||
,height: othis.children('a').outerHeight()
|
||||
,opacity: 1
|
||||
, height: othis.children('a').outerHeight()
|
||||
, opacity: 1
|
||||
});
|
||||
} else {
|
||||
child.addClass(NAV_ANIM);
|
||||
bar.css({
|
||||
left: othis.position().left + parseFloat(othis.css('marginLeft'))
|
||||
,top: othis.position().top + othis.height() - bar.height()
|
||||
, top: othis.position().top + othis.height() - bar.height()
|
||||
});
|
||||
|
||||
timer[index] = setTimeout(function(){
|
||||
timer[index] = setTimeout(function () {
|
||||
bar.css({
|
||||
width: othis.width()
|
||||
,opacity: 1
|
||||
, opacity: 1
|
||||
});
|
||||
}, device.ie && device.ie < 10 ? 0 : TIME);
|
||||
|
||||
clearTimeout(timeEnd[index]);
|
||||
if(child.css('display') === 'block'){
|
||||
if (child.css('display') === 'block') {
|
||||
clearTimeout(timerMore[index]);
|
||||
}
|
||||
timerMore[index] = setTimeout(function(){
|
||||
timerMore[index] = setTimeout(function () {
|
||||
child.addClass(SHOW)
|
||||
othis.find('.'+NAV_MORE).addClass(NAV_MORE+'d');
|
||||
othis.find('.' + NAV_MORE).addClass(NAV_MORE + 'd');
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
$(NAV_ELEM + elemFilter).each(function(index){
|
||||
$(NAV_ELEM + elemFilter).each(function (index) {
|
||||
var othis = $(this)
|
||||
,bar = $('<span class="'+ NAV_BAR +'"></span>')
|
||||
,itemElem = othis.find('.'+NAV_ITEM);
|
||||
, bar = $('<span class="' + NAV_BAR + '"></span>')
|
||||
, itemElem = othis.find('.' + NAV_ITEM);
|
||||
|
||||
//Hover滑动效果
|
||||
if(!othis.find('.'+NAV_BAR)[0]){
|
||||
if (!othis.find('.' + NAV_BAR)[0]) {
|
||||
othis.append(bar);
|
||||
itemElem.on('mouseenter', function(){
|
||||
itemElem.on('mouseenter', function () {
|
||||
follow.call(this, bar, othis, index);
|
||||
}).on('mouseleave', function(){
|
||||
if(!othis.hasClass(NAV_TREE)){
|
||||
}).on('mouseleave', function () {
|
||||
if (!othis.hasClass(NAV_TREE)) {
|
||||
clearTimeout(timerMore[index]);
|
||||
timerMore[index] = setTimeout(function(){
|
||||
othis.find('.'+NAV_CHILD).removeClass(SHOW);
|
||||
othis.find('.'+NAV_MORE).removeClass(NAV_MORE+'d');
|
||||
timerMore[index] = setTimeout(function () {
|
||||
othis.find('.' + NAV_CHILD).removeClass(SHOW);
|
||||
othis.find('.' + NAV_MORE).removeClass(NAV_MORE + 'd');
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
othis.on('mouseleave', function(){
|
||||
othis.on('mouseleave', function () {
|
||||
clearTimeout(timer[index])
|
||||
timeEnd[index] = setTimeout(function(){
|
||||
if(othis.hasClass(NAV_TREE)){
|
||||
timeEnd[index] = setTimeout(function () {
|
||||
if (othis.hasClass(NAV_TREE)) {
|
||||
bar.css({
|
||||
height: 0
|
||||
,top: bar.position().top + bar.height()/2
|
||||
,opacity: 0
|
||||
, top: bar.position().top + bar.height() / 2
|
||||
, opacity: 0
|
||||
});
|
||||
} else {
|
||||
bar.css({
|
||||
width: 0
|
||||
,left: bar.position().left + bar.width()/2
|
||||
,opacity: 0
|
||||
, left: bar.position().left + bar.width() / 2
|
||||
, opacity: 0
|
||||
});
|
||||
}
|
||||
}, TIME);
|
||||
|
@ -343,14 +347,14 @@ layui.define('jquery', function(exports){
|
|||
}
|
||||
|
||||
//展开子菜单
|
||||
itemElem.find('a').each(function(){
|
||||
itemElem.find('a').each(function () {
|
||||
var thisA = $(this)
|
||||
,parent = thisA.parent()
|
||||
,child = thisA.siblings('.'+NAV_CHILD);
|
||||
, parent = thisA.parent()
|
||||
, child = thisA.siblings('.' + NAV_CHILD);
|
||||
|
||||
//输出小箭头
|
||||
if(child[0] && !thisA.children('.'+NAV_MORE)[0]){
|
||||
thisA.append('<span class="'+ NAV_MORE +'"></span>');
|
||||
if (child[0] && !thisA.children('.' + NAV_MORE)[0]) {
|
||||
thisA.append('<span class="' + NAV_MORE + '"></span>');
|
||||
}
|
||||
|
||||
thisA.off('click', call.clickThis).on('click', call.clickThis); //点击菜单
|
||||
|
@ -359,60 +363,60 @@ layui.define('jquery', function(exports){
|
|||
}
|
||||
|
||||
//面包屑
|
||||
,breadcrumb: function(){
|
||||
, breadcrumb: function () {
|
||||
var ELEM = '.layui-breadcrumb';
|
||||
|
||||
$(ELEM + elemFilter).each(function(){
|
||||
$(ELEM + elemFilter).each(function () {
|
||||
var othis = $(this)
|
||||
,ATTE_SPR = 'lay-separator'
|
||||
,separator = othis.attr(ATTE_SPR) || '/'
|
||||
,aNode = othis.find('a');
|
||||
if(aNode.next('span['+ ATTE_SPR +']')[0]) return;
|
||||
aNode.each(function(index){
|
||||
if(index === aNode.length - 1) return;
|
||||
$(this).after('<span '+ ATTE_SPR +'>'+ separator +'</span>');
|
||||
, ATTE_SPR = 'lay-separator'
|
||||
, separator = othis.attr(ATTE_SPR) || '/'
|
||||
, aNode = othis.find('a');
|
||||
if (aNode.next('span[' + ATTE_SPR + ']')[0]) return;
|
||||
aNode.each(function (index) {
|
||||
if (index === aNode.length - 1) return;
|
||||
$(this).after('<span ' + ATTE_SPR + '>' + separator + '</span>');
|
||||
});
|
||||
othis.css('visibility', 'visible');
|
||||
});
|
||||
}
|
||||
|
||||
//进度条
|
||||
,progress: function(){
|
||||
, progress: function () {
|
||||
var ELEM = 'layui-progress';
|
||||
$('.' + ELEM + elemFilter).each(function(){
|
||||
$('.' + ELEM + elemFilter).each(function () {
|
||||
var othis = $(this)
|
||||
,elemBar = othis.find('.layui-progress-bar')
|
||||
,percent = elemBar.attr('lay-percent');
|
||||
, elemBar = othis.find('.layui-progress-bar')
|
||||
, percent = elemBar.attr('lay-percent');
|
||||
|
||||
elemBar.css('width', function(){
|
||||
elemBar.css('width', function () {
|
||||
return /^.+\/.+$/.test(percent)
|
||||
? (new Function('return '+ percent)() * 100) + '%'
|
||||
: percent;
|
||||
? (new Function('return ' + percent)() * 100) + '%'
|
||||
: percent;
|
||||
}());
|
||||
|
||||
if(othis.attr('lay-showPercent')){
|
||||
setTimeout(function(){
|
||||
elemBar.html('<span class="'+ ELEM +'-text">'+ percent +'</span>');
|
||||
},350);
|
||||
if (othis.attr('lay-showPercent')) {
|
||||
setTimeout(function () {
|
||||
elemBar.html('<span class="' + ELEM + '-text">' + percent + '</span>');
|
||||
}, 350);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//折叠面板
|
||||
,collapse: function(){
|
||||
, collapse: function () {
|
||||
var ELEM = 'layui-collapse';
|
||||
|
||||
$('.' + ELEM + elemFilter).each(function(){
|
||||
$('.' + ELEM + elemFilter).each(function () {
|
||||
var elemItem = $(this).find('.layui-colla-item')
|
||||
elemItem.each(function(){
|
||||
elemItem.each(function () {
|
||||
var othis = $(this)
|
||||
,elemTitle = othis.find('.layui-colla-title')
|
||||
,elemCont = othis.find('.layui-colla-content')
|
||||
,isNone = elemCont.css('display') === 'none';
|
||||
, elemTitle = othis.find('.layui-colla-title')
|
||||
, elemCont = othis.find('.layui-colla-content')
|
||||
, isNone = elemCont.css('display') === 'none';
|
||||
|
||||
//初始状态
|
||||
elemTitle.find('.layui-colla-icon').remove();
|
||||
elemTitle.append('<i class="layui-icon layui-colla-icon">'+ (isNone ? '' : '') +'</i>');
|
||||
elemTitle.append('<i class="layui-icon layui-colla-icon">' + (isNone ? '' : '') + '</i>');
|
||||
|
||||
//点击标题
|
||||
elemTitle.off('click', call.collapse).on('click', call.collapse);
|
||||
|
@ -422,7 +426,7 @@ layui.define('jquery', function(exports){
|
|||
}
|
||||
};
|
||||
|
||||
return items[type] ? items[type]() : layui.each(items, function(index, item){
|
||||
return items[type] ? items[type]() : layui.each(items, function (index, item) {
|
||||
item();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -233,9 +233,8 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
*/
|
||||
refresh: function () {
|
||||
var iframe = admin.tabsBody(common.tabsPage.index).find('.layadmin-iframe');
|
||||
$('.layadmin-tabsbody-shade').show();
|
||||
//$('.layadmin-tabsbody-shade').show();
|
||||
iframe.attr('src', iframe.attr('src'));
|
||||
// iframe[0].contentWindow.location.reload(true);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -687,11 +686,26 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
|
||||
//监听 tabspage 删除
|
||||
element.on('tabDelete(' + FILTER_TAB_TBAS + ')', function (obj) {
|
||||
var othis = $(TABS_HEADER + '.layui-this');
|
||||
|
||||
var tab = obj.elem.find('li').eq(obj.index)
|
||||
let $iframe = admin.tabsBody(obj.index).find('iframe');
|
||||
if ($iframe.length > 0) {
|
||||
yhpreview = $iframe[0].contentWindow['yhpreview'];
|
||||
if (yhpreview && yhpreview.getPage().hasDataChanged()) {
|
||||
layer.msg('存在未保存的数据,请先保存数据再关闭页面');
|
||||
obj.canClose = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (obj.canClose !== false) {
|
||||
if (tab.hasClass('layui-this')) {
|
||||
if (tab.next()[0]) {
|
||||
setThisRouter(tab.next());
|
||||
} else if (tab.prev()[0]) {
|
||||
setThisRouter(tab.prev());
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.index && admin.tabsBody(obj.index).remove();
|
||||
setThisRouter(othis);
|
||||
|
||||
//移除resize事件
|
||||
admin.delResize();
|
||||
events.setPrevAndNext();
|
||||
|
@ -756,10 +770,10 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
}
|
||||
$win.on('resize', layui.data.resizeSystem);
|
||||
|
||||
/**
|
||||
* 渲染角色下拉
|
||||
* @param {*} loginInfo 登录的返回信息
|
||||
*/
|
||||
/**
|
||||
* 渲染角色下拉
|
||||
* @param {*} loginInfo 登录的返回信息
|
||||
*/
|
||||
function renderRoles(loginInfo) {
|
||||
var html = '',
|
||||
rolelist = loginInfo.roleCursor,
|
||||
|
@ -788,9 +802,9 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
$rolecourse.append(html);
|
||||
initRoleClickEvent();
|
||||
}
|
||||
/**
|
||||
* 初始化角色点击事件
|
||||
*/
|
||||
/**
|
||||
* 初始化角色点击事件
|
||||
*/
|
||||
function initRoleClickEvent() {
|
||||
$('#rolecourse a').on('click', function () {
|
||||
var curroleid = $('#ROLENAME').attr('roleid'),
|
||||
|
@ -825,10 +839,10 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 渲染头像
|
||||
* @param {*} userInfo 用户信息
|
||||
*/
|
||||
/**
|
||||
* 渲染头像
|
||||
* @param {*} userInfo 用户信息
|
||||
*/
|
||||
function renderTouX(userInfo) {
|
||||
if (userInfo.TOUX != undefined && userInfo.TOUX != null && userInfo.TOUX != '') {
|
||||
$('#TOUX').prop('src', layui.cache['contentPath'] + userInfo.TOUX);
|
||||
|
@ -836,10 +850,10 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
$('#TOUX').prop('src', layui.cache['contentPath'] + '/static/image/userImg.png');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 渲染点击用户名的下拉系统的菜单
|
||||
* @param {*} loginInfo 登录的返回信息
|
||||
*/
|
||||
/**
|
||||
* 渲染点击用户名的下拉系统的菜单
|
||||
* @param {*} loginInfo 登录的返回信息
|
||||
*/
|
||||
function renderSysMenu(loginInfo) {
|
||||
$.ajax({
|
||||
url: layui.cache['contentPath'] + '/manager/coresysopt/querybyid',
|
||||
|
@ -869,18 +883,18 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 渲染其他,用户名,机构名等
|
||||
* @param {*} userInfo 登录的返回信息
|
||||
*/
|
||||
/**
|
||||
* 渲染其他,用户名,机构名等
|
||||
* @param {*} userInfo 登录的返回信息
|
||||
*/
|
||||
function renderOthers(userInfo) {
|
||||
$('#OBJNAME').html(userInfo.userCursor.OBJNAME);
|
||||
$('#ORGNAME').html(userInfo.currentOrgName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染消息
|
||||
*/
|
||||
/**
|
||||
* 渲染消息
|
||||
*/
|
||||
function renderMessageBox() {
|
||||
// 获取待办信息
|
||||
$.ajax({
|
||||
|
@ -900,9 +914,9 @@ layui.define(['view', 'theme', 'common'], function (exports) {
|
|||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 主题渲染
|
||||
*/
|
||||
/**
|
||||
* 主题渲染
|
||||
*/
|
||||
function renderTheme() {
|
||||
window['kdtheme'].render(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue