升级layui
This commit is contained in:
@@ -26,7 +26,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
|
||||
// 默认配置
|
||||
var configType = 'yml';
|
||||
var configPath = 'pear.configs.yml';
|
||||
var configPath = 'pear.config.yml';
|
||||
|
||||
this.setConfigPath = function(path) {
|
||||
configPath = path;
|
||||
@@ -93,6 +93,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
height: '100%',
|
||||
method: param.menu.method,
|
||||
control: param.menu.control ? 'control' : false, // control
|
||||
controlWidth: param.menu.controlWidth,
|
||||
defaultMenu: 0,
|
||||
accordion: param.menu.accordion,
|
||||
url: param.menu.data,
|
||||
@@ -103,6 +104,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
},
|
||||
done: function() {
|
||||
sideMenu.selectItem(param.menu.select);
|
||||
pearAdmin.collaspe(param);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -196,6 +198,14 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
}, param.other.keepLoad)
|
||||
}
|
||||
|
||||
this.collaspe = function(param) {
|
||||
if (param.menu.collaspe) {
|
||||
if ($(window).width() >= 768) {
|
||||
collaspe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.themeRender = function(option) {
|
||||
if (option.theme.allowCustom === false) {
|
||||
$(".setting").remove();
|
||||
@@ -454,8 +464,9 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
function buildLinkHtml() {
|
||||
var links = "";
|
||||
$.each(config.links, function(i, value) {
|
||||
// value.target 存在,则为新窗口打开,增加 target="_blank" 属性
|
||||
links += '<a class="more-menu-item" href="' + value.href + '" '+(value.target?' target="_blank" ':'')+'>' +
|
||||
// value.target 存在,则为新窗口打开,增加 target="_blank" 属性
|
||||
links += '<a class="more-menu-item" href="' + value.href + '" ' + (value.target ? ' target="_blank" ' : '') +
|
||||
'>' +
|
||||
'<i class="' + value.icon + '" style="font-size: 19px;"></i> ' + value.title +
|
||||
'</a>'
|
||||
})
|
||||
|
||||
@@ -14205,8 +14205,8 @@
|
||||
|
||||
var isUpdate = animationType === 'update';
|
||||
var isRemove = animationType === 'remove';
|
||||
var animationPayload; // Check if there is global animation configuration from dataZoom/resize can override the configs in option.
|
||||
// If animation is enabled. Will use this animation configs in payload.
|
||||
var animationPayload; // Check if there is global animation configuration from dataZoom/resize can override the config in option.
|
||||
// If animation is enabled. Will use this animation config in payload.
|
||||
// If animation is disabled. Just ignore it.
|
||||
|
||||
if (animatableModel && animatableModel.ecModel) {
|
||||
@@ -18731,7 +18731,7 @@
|
||||
if (isArray(mediaOnRoot)) {
|
||||
each(mediaOnRoot, function (singleMedia) {
|
||||
if ("development" !== 'production') {
|
||||
// Real case of wrong configs.
|
||||
// Real case of wrong config.
|
||||
if (singleMedia && !singleMedia.option && isObject(singleMedia.query) && isObject(singleMedia.query.option)) {
|
||||
error('Illegal media option. Must be like { media: [ { query: {}, option: {} } ] }');
|
||||
}
|
||||
@@ -18748,7 +18748,7 @@
|
||||
});
|
||||
} else {
|
||||
if ("development" !== 'production') {
|
||||
// Real case of wrong configs.
|
||||
// Real case of wrong config.
|
||||
error('Illegal media option. Must be an array. Like { media: [ {...}, {...} ] }');
|
||||
}
|
||||
}
|
||||
@@ -19508,7 +19508,7 @@
|
||||
// readonly frozen: boolean;
|
||||
function SourceImpl(fields) {
|
||||
this.data = fields.data || (fields.sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS ? {} : []);
|
||||
this.sourceFormat = fields.sourceFormat || SOURCE_FORMAT_UNKNOWN; // Visit configs
|
||||
this.sourceFormat = fields.sourceFormat || SOURCE_FORMAT_UNKNOWN; // Visit config
|
||||
|
||||
this.seriesLayoutBy = fields.seriesLayoutBy || SERIES_LAYOUT_BY_COLUMN;
|
||||
this.startIndex = fields.startIndex || 0;
|
||||
@@ -21392,18 +21392,18 @@
|
||||
* source: [...]
|
||||
* }, {
|
||||
* // By default from 0.
|
||||
* transform: { type: 'filter', configs: {...} }
|
||||
* transform: { type: 'filter', config: {...} }
|
||||
* }, {
|
||||
* // Piped.
|
||||
* transform: [
|
||||
* { type: 'filter', configs: {...} },
|
||||
* { type: 'sort', configs: {...} }
|
||||
* { type: 'filter', config: {...} },
|
||||
* { type: 'sort', config: {...} }
|
||||
* ]
|
||||
* }, {
|
||||
* id: 'regressionData',
|
||||
* fromDatasetIndex: 1,
|
||||
* // Third-party transform
|
||||
* transform: { type: 'ecStat:regression', configs: {...} }
|
||||
* transform: { type: 'ecStat:regression', config: {...} }
|
||||
* }, {
|
||||
* // retrieve the extra result.
|
||||
* id: 'regressionFormula',
|
||||
@@ -23545,7 +23545,7 @@
|
||||
// performed. Because is a series is filtered, most of the tasks will not
|
||||
// be performed. A stream-dependent operation probably cause wrong biz logic.
|
||||
// Perhaps we should not provide a separate callback for this case instead
|
||||
// of providing the configs `performRawSeries`. The stream-dependent operaions
|
||||
// of providing the config `performRawSeries`. The stream-dependent operaions
|
||||
// and stream-independent operations should better not be mixed.
|
||||
|
||||
performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model);
|
||||
@@ -25599,9 +25599,9 @@
|
||||
hostEl.setTextConfig({
|
||||
// Force to set local false.
|
||||
local: false,
|
||||
// Ignore position and rotation configs on the host el if x or y is changed.
|
||||
// Ignore position and rotation config on the host el if x or y is changed.
|
||||
position: layoutOption.x != null || layoutOption.y != null ? null : defaultLabelAttr.attachedPos,
|
||||
// Ignore rotation configs on the host el if rotation is changed.
|
||||
// Ignore rotation config on the host el if rotation is changed.
|
||||
rotation: layoutOption.rotate != null ? layoutOption.rotate * degreeToRadian : defaultLabelAttr.attachedRot,
|
||||
offset: [layoutOption.dx || 0, layoutOption.dy || 0]
|
||||
});
|
||||
@@ -52007,7 +52007,7 @@
|
||||
}
|
||||
/**
|
||||
* Init a tree data structure from data in option series
|
||||
* @param option the object used to configs echarts view
|
||||
* @param option the object used to config echarts view
|
||||
* @return storage initial data
|
||||
*/
|
||||
|
||||
@@ -61948,7 +61948,7 @@
|
||||
/**
|
||||
* Init a graph data structure from data in option series
|
||||
*
|
||||
* @param {Object} option the object used to configs echarts view
|
||||
* @param {Object} option the object used to config echarts view
|
||||
* @return {module:echarts/data/List} storage initial data
|
||||
*/
|
||||
|
||||
@@ -64102,7 +64102,7 @@
|
||||
this._effectCfg ? this.updateEffectAnimation(effectCfg) : this.startEffectAnimation(effectCfg);
|
||||
this._effectCfg = effectCfg;
|
||||
} else {
|
||||
// Not keep old effect configs
|
||||
// Not keep old effect config
|
||||
this._effectCfg = null;
|
||||
this.stopEffectAnimation();
|
||||
|
||||
@@ -64222,7 +64222,7 @@
|
||||
progressive: 0,
|
||||
// When to show the effect, option: 'render'|'emphasis'
|
||||
showEffectOn: 'render',
|
||||
// Ripple effect configs
|
||||
// Ripple effect config
|
||||
rippleEffect: {
|
||||
period: 4,
|
||||
// Scale of ripple
|
||||
@@ -69537,7 +69537,7 @@
|
||||
* generete shape and style at the first time rather than always do that).
|
||||
* So we still use "merge" rather than "erase all". If users need "erase all", they can
|
||||
* simple always set all of the props each time.
|
||||
* Some "object-like" configs like `textConfig`, `textContent`, `style` which are not needed for
|
||||
* Some "object-like" config like `textConfig`, `textContent`, `style` which are not needed for
|
||||
* every elment, so we replace them only when user specify them. And the that is a total replace.
|
||||
*
|
||||
* TODO: there is no hint of 'isFirst' to users. So the performance enhancement can not be
|
||||
@@ -70410,7 +70410,7 @@
|
||||
*
|
||||
* [Compat]: since ec5, RectText has been separated from its hosts el.
|
||||
* so `api.style()` will only return the style from `itemStyle` but not handle `label`
|
||||
* any more. But `series.label` configs is never published in doc.
|
||||
* any more. But `series.label` config is never published in doc.
|
||||
* We still compat it in `api.style()`. But not encourage to use it and will still not
|
||||
* to pulish it to doc.
|
||||
* @public
|
||||
@@ -87018,7 +87018,7 @@
|
||||
color: thisOption.color.slice().reverse()
|
||||
};
|
||||
} // Compatible with previous logic, always give a defautl color, otherwise
|
||||
// simple configs with no inRange and outOfRange will not work.
|
||||
// simple config with no inRange and outOfRange will not work.
|
||||
// Originally we use visualMap.color as the default color, but setOption at
|
||||
// the second time the default color will be erased. So we change to use
|
||||
// constant DEFAULT_COLOR.
|
||||
@@ -89581,7 +89581,7 @@
|
||||
|
||||
if (!isObjectNotArray(exprOption)) {
|
||||
if ("development" !== 'production') {
|
||||
errMsg = makePrintable('Illegal configs. Expect a plain object but actually', exprOption);
|
||||
errMsg = makePrintable('Illegal config. Expect a plain object but actually', exprOption);
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
@@ -89722,7 +89722,7 @@
|
||||
// PEDING: enhance to filter by index rather than create new data
|
||||
transform: function (params) {
|
||||
// [Caveat] Fail-Fast:
|
||||
// Do not return the whole dataset unless user configs indicate it explicitly.
|
||||
// Do not return the whole dataset unless user config indicate it explicitly.
|
||||
// For example, if no condition specified by mistake, return an empty result
|
||||
// is better than return the entire raw soruce for user to find the mistake.
|
||||
var upstream = params.upstream;
|
||||
@@ -89780,7 +89780,7 @@
|
||||
var sampleLog = '';
|
||||
|
||||
if ("development" !== 'production') {
|
||||
sampleLog = ['Valid configs is like:', '{ dimension: "age", order: "asc" }', 'or [{ dimension: "age", order: "asc"], { dimension: "date", order: "desc" }]'].join(' ');
|
||||
sampleLog = ['Valid config is like:', '{ dimension: "age", order: "asc" }', 'or [{ dimension: "age", order: "asc"], { dimension: "date", order: "desc" }]'].join(' ');
|
||||
}
|
||||
|
||||
var sortTransform = {
|
||||
@@ -89789,15 +89789,15 @@
|
||||
var upstream = params.upstream;
|
||||
var config = params.config;
|
||||
var errMsg = ''; // Normalize
|
||||
// const orderExprList: OrderExpression[] = isArray(configs[0])
|
||||
// ? configs as OrderExpression[]
|
||||
// : [configs as OrderExpression];
|
||||
// const orderExprList: OrderExpression[] = isArray(config[0])
|
||||
// ? config as OrderExpression[]
|
||||
// : [config as OrderExpression];
|
||||
|
||||
var orderExprList = normalizeToArray(config);
|
||||
|
||||
if (!orderExprList.length) {
|
||||
if ("development" !== 'production') {
|
||||
errMsg = 'Empty `configs` in sort transform.';
|
||||
errMsg = 'Empty `config` in sort transform.';
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
@@ -89812,7 +89812,7 @@
|
||||
|
||||
if (dimLoose == null) {
|
||||
if ("development" !== 'production') {
|
||||
errMsg = 'Sort transform configs must has "dimension" specified.' + sampleLog;
|
||||
errMsg = 'Sort transform config must has "dimension" specified.' + sampleLog;
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
@@ -89820,7 +89820,7 @@
|
||||
|
||||
if (order !== 'asc' && order !== 'desc') {
|
||||
if ("development" !== 'production') {
|
||||
errMsg = 'Sort transform configs must has "order" specified.' + sampleLog;
|
||||
errMsg = 'Sort transform config must has "order" specified.' + sampleLog;
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
@@ -89850,7 +89850,7 @@
|
||||
|
||||
if (!dimInfo) {
|
||||
if ("development" !== 'production') {
|
||||
errMsg = makePrintable('Can not find dimension info via: ' + dimLoose + '.\n', 'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\n', 'Illegal configs:', orderExpr, '.\n');
|
||||
errMsg = makePrintable('Can not find dimension info via: ' + dimLoose + '.\n', 'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\n', 'Illegal config:', orderExpr, '.\n');
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
@@ -89860,7 +89860,7 @@
|
||||
|
||||
if (parserName && !parser) {
|
||||
if ("development" !== 'production') {
|
||||
errMsg = makePrintable('Invalid parser name ' + parserName + '.\n', 'Illegal configs:', orderExpr, '.\n');
|
||||
errMsg = makePrintable('Invalid parser name ' + parserName + '.\n', 'Illegal config:', orderExpr, '.\n');
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
|
||||
@@ -444,7 +444,7 @@ layui.define(function (exports) {
|
||||
*/
|
||||
MD5: function (options) {
|
||||
/**
|
||||
* Private configs properties. You may need to tweak these to be compatible with
|
||||
* Private config properties. You may need to tweak these to be compatible with
|
||||
* the server-side, but the defaults work in most cases.
|
||||
* See {@link Hashes.MD5#method-setUpperCase} and {@link Hashes.SHA1#method-setUpperCase}
|
||||
*/
|
||||
@@ -681,7 +681,7 @@ layui.define(function (exports) {
|
||||
*/
|
||||
SHA1: function (options) {
|
||||
/**
|
||||
* Private configs properties. You may need to tweak these to be compatible with
|
||||
* Private config properties. You may need to tweak these to be compatible with
|
||||
* the server-side, but the defaults work in most cases.
|
||||
* See {@link Hashes.MD5#method-setUpperCase} and {@link Hashes.SHA1#method-setUpperCase}
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
defaultOpen: opt.defaultOpen,
|
||||
defaultSelect: opt.defaultSelect,
|
||||
control: opt.control,
|
||||
controlWidth: opt.controlWidth ? opt.controlWidth: 500,
|
||||
defaultMenu: opt.defaultMenu,
|
||||
accordion: opt.accordion,
|
||||
height: opt.height,
|
||||
@@ -47,6 +48,33 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
|
||||
// 处理高度
|
||||
$("#"+opt.elem).height(option.height)
|
||||
|
||||
setTimeout(function(){
|
||||
$("#"+opt.control+" .control").on("mousewheel DOMMouseScroll", function(event) {
|
||||
|
||||
var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
|
||||
(event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1)); // firefox
|
||||
|
||||
if (delta > 0) {
|
||||
for (var num = 1; num < 20; num++) {
|
||||
setTimeout(function() {
|
||||
if ($("#"+opt.control+" .control ul").css('left').replace("px", "") < 0) {
|
||||
$("#"+opt.control+" .control ul").css("left", "+=2px");
|
||||
}
|
||||
}, 10)
|
||||
}
|
||||
} else if (delta < 0) {
|
||||
if(( (Number)($("#"+opt.control+" .control ul").css("left").replace("px","")) + ($("#"+opt.control+" .control ul").width() - $("#"+opt.control+" .control").width())) > 0){
|
||||
for (var num = 1; num < 20; num++) {
|
||||
setTimeout(function() {
|
||||
$("#"+opt.control+" .control ul").css("left", "-=2px");
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},1000)
|
||||
|
||||
return new pearMenu(opt);
|
||||
}
|
||||
|
||||
@@ -234,7 +262,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
}
|
||||
|
||||
function createMenuAndControl(option) {
|
||||
var control = '<ul class="layui-nav pear-nav-control pc layui-hide-xs">';
|
||||
var control = '<div style="width: '+ option.controlWidth +'px;white-space: nowrap;overflow-x: scroll;overflow: hidden;" class="control"><ul class="layui-nav pear-nav-control pc layui-hide-xs" style="width: fit-content;">';
|
||||
var controlPe = '<ul class="layui-nav pear-nav-control layui-hide-sm">';
|
||||
// 声 明 头 部
|
||||
var menu = '<div class="layui-side-scroll ' + option.theme + '">'
|
||||
@@ -297,7 +325,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
})
|
||||
controlItemPe += "</li></dl></ul>"
|
||||
controlPe += controlItemPe;
|
||||
$("#" + option.control).html(control);
|
||||
$("#" + option.control).html(control+"</div>");
|
||||
$("#" + option.control).append(controlPe);
|
||||
$("#" + option.elem).html(menu);
|
||||
$("#" + option.control + " .pear-nav-control").on("click", "[pear-id]", function() {
|
||||
@@ -353,7 +381,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
});
|
||||
// 封 装
|
||||
} else {
|
||||
content += '<div class="toast"> 无 内 容 </div>';
|
||||
content += '<dd style="background-color: transparent!important;"><a style="background-color: transparent!important;margin-left: 26px">目录为空</a></dd>';
|
||||
}
|
||||
content += '</dl>';
|
||||
return content;
|
||||
|
||||
@@ -24,6 +24,10 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
}
|
||||
setTimeout(function(){
|
||||
element.init();
|
||||
$(opt.elem+" li").click(function(e){
|
||||
$(this).siblings().removeClass('pear-this');
|
||||
$(this).addClass('pear-this');
|
||||
})
|
||||
},300);
|
||||
return new message(option);
|
||||
}
|
||||
@@ -61,9 +65,8 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
|
||||
// 根据 data 便利数据
|
||||
$.each(option.data, function(i, item) {
|
||||
|
||||
if (i === 0) {
|
||||
noticeTitle += '<li class="layui-this">' + item.title + '</li>';
|
||||
noticeTitle += '<li class="pear-this">' + item.title + '</li>';
|
||||
noticeContent += '<div class="layui-tab-item layui-show">';
|
||||
} else {
|
||||
noticeTitle += '<li>' + item.title + '</li>';
|
||||
@@ -77,7 +80,6 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
'<span>' + note.title + '</span>' +
|
||||
'<span>' + note.time + '</span>' +
|
||||
'</div>';
|
||||
|
||||
})
|
||||
noticeContent += '</div>';
|
||||
})
|
||||
|
||||
@@ -52,7 +52,8 @@ layui.define(["jquery","layer"], function (exports) {
|
||||
style += '.layui-elem-quote{border-left: 5px solid '+ color +'}';
|
||||
style += '.layui-timeline-axis{color:' + color + '}';
|
||||
style += '.layui-laydate .layui-this{background-color:'+color+'!important}';
|
||||
style += '.pear-text{color:' + color + '!important}';
|
||||
style += '.pear-this,.pear-text{color:' + color + '!important}';
|
||||
style += '.pear-back{background-color:'+ color +'!important}';
|
||||
style += '.pear-collasped-pe{background-color:'+color+'!important}'
|
||||
style += '.layui-form-select dl dd.layui-this{background-color:'+color+'}'
|
||||
style += '.tag-item-normal{background:'+color+'!important}';
|
||||
|
||||
+2
-2
@@ -2398,14 +2398,14 @@
|
||||
var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), {
|
||||
revoke: curry(revokeBehaviour, name),
|
||||
config: function (spec) {
|
||||
var prepared = asRawOrDie(name + '-configs', configSchema, spec);
|
||||
var prepared = asRawOrDie(name + '-config', configSchema, spec);
|
||||
return {
|
||||
key: name,
|
||||
value: {
|
||||
config: prepared,
|
||||
me: me,
|
||||
configAsRaw: cached(function () {
|
||||
return asRawOrDie(name + '-configs', configSchema, spec);
|
||||
return asRawOrDie(name + '-config', configSchema, spec);
|
||||
}),
|
||||
initialConfig: spec,
|
||||
state: state
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -4107,14 +4107,14 @@
|
||||
var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), {
|
||||
revoke: curry(revokeBehaviour, name),
|
||||
config: function (spec) {
|
||||
var prepared = asRawOrDie(name + '-configs', configSchema, spec);
|
||||
var prepared = asRawOrDie(name + '-config', configSchema, spec);
|
||||
return {
|
||||
key: name,
|
||||
value: {
|
||||
config: prepared,
|
||||
me: me,
|
||||
configAsRaw: cached(function () {
|
||||
return asRawOrDie(name + '-configs', configSchema, spec);
|
||||
return asRawOrDie(name + '-config', configSchema, spec);
|
||||
}),
|
||||
initialConfig: spec,
|
||||
state: state
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user