Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~teller/fineui

es6
iapyang 2 years ago
parent
commit
e533a2dfce
  1. 5
      bi.lessconfig.json
  2. 9
      demo/js/base/button/demo.button.js
  3. 62
      demo/js/widget/downlist/demo.downlist.js
  4. BIN
      dist/font/iconfont.eot
  5. 128
      dist/font/iconfont.svg
  6. BIN
      dist/font/iconfont.ttf
  7. BIN
      dist/font/iconfont.woff
  8. BIN
      dist/font/iconfont.woff2
  9. 2
      package.json
  10. 20
      src/base/0.base.js
  11. 2
      src/base/single/1.text.js
  12. 8
      src/base/single/button/buttons/button.js
  13. 3
      src/base/single/editor/editor.textarea.js
  14. 8
      src/base/single/input/radio/radio.js
  15. 6
      src/base/single/tip/tip.tooltip.js
  16. 22
      src/case/button/icon/iconhalf/icon.half.js
  17. 30
      src/case/combo/textvaluecombo/combo.textvalue.js
  18. 12
      src/core/4.widget.js
  19. 0
      src/core/6.plugin.js
  20. 6
      src/core/controller/controller.layer.js
  21. 17
      src/core/controller/controller.resizer.js
  22. 70
      src/core/platform/web/config.js
  23. 22
      src/core/utils/i18n.js
  24. 9
      src/less/base/single/button/item.singleselect.icontext.less
  25. 6
      src/less/base/single/input/radio.less
  26. 10
      src/less/base/tree/ztree.less
  27. 8
      src/less/widget/multiselect/multiselect.combo.less
  28. 16
      src/widget/downlist/item.downlist.js
  29. 66
      src/widget/downlist/item.downlistgroup.js
  30. 1
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  31. 2
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  32. 1
      src/widget/multilayersingletree/multilayersingletree.combo.js
  33. 2
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  34. 22
      src/widget/multiselect/multiselect.combo.nobar.js
  35. 1
      src/widget/multiselect/multiselect.loader.js
  36. 3
      src/widget/singleselect/trigger/searcher.singleselect.js
  37. 16
      typescript/base/single/button/buttons/button.ts

5
bi.lessconfig.json

@ -38,5 +38,8 @@
"@color-bi-color-toast-normal": "#2C60DB", "@color-bi-color-toast-normal": "#2C60DB",
"@color-bi-color-toast-text": "#000A19", "@color-bi-color-toast-text": "#000A19",
"@color-bi-text-header-background": "rgba(9, 30, 64, 0.9)", "@color-bi-text-header-background": "rgba(9, 30, 64, 0.9)",
"@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)" "@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)",
"@font-down-triangle": "e70b",
"@font-date": "e733",
"@font-trigger-triangle": "e924"
} }

9
demo/js/base/button/demo.button.js

@ -376,6 +376,15 @@ Demo.Button = BI.inherit(BI.Widget, {
this.loaded(); this.loaded();
}, 5 * 1000); }, 5 * 1000);
}, },
}, {
type: "bi.button",
text: "文字偏左的按钮",
textAlign: "left",
width: 200,
}, {
type: "bi.button",
text: "小于最小宽度的按钮",
width: 50,
}]; }];
return { return {

62
demo/js/widget/downlist/demo.downlist.js

@ -1,3 +1,15 @@
(function () {
var CustomIcon = BI.inherit(BI.Widget, {
render: function () {
return {
type: "bi.label",
text: "✨",
};
},
});
BI.shortcut("demo.downlist.icon", CustomIcon);
}());
Demo.Downlist = BI.inherit(BI.Widget, { Demo.Downlist = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-downlist" baseCls: "demo-downlist"
@ -22,9 +34,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this; var self = this;
// test
return { return {
type: "bi.horizontal_adapt", type: "bi.left",
items: [{ items: [{
type: "bi.down_list_combo", type: "bi.down_list_combo",
ref: function (_ref) { ref: function (_ref) {
@ -131,7 +143,51 @@ Demo.Downlist = BI.inherit(BI.Widget, {
// }] // }]
}] }]
] ],
}, {
type: "bi.down_list_combo",
el: {
type: "bi.button",
ghost: true,
iconPosition: "right",
icon: "column-next-page-h-font",
text: "自定义 trigger 和 icon 的级联下拉框",
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function (v) {
console.log("触发值", v);
}
}, {
eventName: "EVENT_SON_VALUE_CHANGE",
action: function(v) {
console.log("二级菜单触发值", v)
}
}],
items: [
[{
el: {
text: "选项一",
value: 1,
icon: {
type: "demo.downlist.icon",
},
},
children: [{
text: "选项一",
value: 11,
icon: {
type: "demo.downlist.icon",
},
}, {
text: "选项二",
value: 12,
}],
}, {
text: "选项二",
value: 2,
}]
],
}, { }, {
type: "bi.multi_layer_down_list_combo", type: "bi.multi_layer_down_list_combo",
ref: function (_ref) { ref: function (_ref) {

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

128
dist/font/iconfont.svg vendored

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 705 KiB

After

Width:  |  Height:  |  Size: 699 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220824175535", "version": "2.0.20220905163443",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

20
src/base/0.base.js

@ -1,11 +1,9 @@
BI.prepares.push(function () { BI.Resizers = new BI.ResizeController();
BI.Resizers = new BI.ResizeController(); BI.Layers = new BI.LayerController();
BI.Layers = new BI.LayerController(); BI.Maskers = new BI.MaskersController();
BI.Maskers = new BI.MaskersController(); BI.Bubbles = new BI.BubblesController();
BI.Bubbles = new BI.BubblesController(); BI.Tooltips = new BI.TooltipsController();
BI.Tooltips = new BI.TooltipsController(); BI.Popovers = new BI.PopoverController();
BI.Popovers = new BI.PopoverController(); BI.Drawers = new BI.DrawerController();
BI.Drawers = new BI.DrawerController(); BI.Broadcasts = new BI.BroadcastController();
BI.Broadcasts = new BI.BroadcastController(); BI.StyleLoaders = new BI.StyleLoaderManager();
BI.StyleLoaders = new BI.StyleLoaderManager();
});

2
src/base/single/1.text.js

@ -65,7 +65,7 @@
tagName: "span", tagName: "span",
}); });
this.text.element.click(function (e) { this.text.element.click(function (e) {
o.handler.call(self, self.getValue(), self, e); !o.disabled && !o.invalid && o.handler.call(self, self.getValue(), self, e);
}); });
BI.createWidget({ BI.createWidget({
type: "bi.default", type: "bi.default",

8
src/base/single/button/buttons/button.js

@ -107,8 +107,9 @@
}); });
} }
// 用于 whiteSpace // 用户可能设置的 width 小于按钮的最小宽度
var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; var actualWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width;
var textWidth = iconInvisible && o.width ? actualWidth - o.hgap * 2 : null;
if (BI.isNotNull(o.textWidth)) { if (BI.isNotNull(o.textWidth)) {
// textWidth 需要减去图标 // textWidth 需要减去图标
textWidth = o.textWidth - (iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth); textWidth = o.textWidth - (iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth);
@ -141,6 +142,7 @@
// bi.center_adapt 作用:让 hgap 不影响 iconGap。 // bi.center_adapt 作用:让 hgap 不影响 iconGap。
BI.createWidget({ BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
horizontalAlign: o.textAlign,
element: this, element: this,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -161,7 +163,7 @@
}); });
if (o.minWidth > 0) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit}); this.element.css({ "min-width": o.minWidth / BI.pixRatio + BI.pixUnit });
} }
}, },

3
src/base/single/editor/editor.textarea.js

@ -79,7 +79,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + self.getName()); BI.Widget._renderEngine.createElement(document).unbind("mousedown." + self.getName());
}); });
this.content.element.keydown(function () { this.content.element.keydown(function () {
// 水印快速消失 // 水印快速消失
self._checkWaterMark(); self._checkWaterMark();
}); });
this.content.element.keyup(function (e) { this.content.element.keyup(function (e) {
@ -111,7 +111,6 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
cls: "bi-water-mark textarea-watermark", cls: "bi-water-mark textarea-watermark",
textAlign: "left", textAlign: "left",
whiteSpace: o.scrolly ? "normal" : "nowrap", whiteSpace: o.scrolly ? "normal" : "nowrap",
title: o.watermark,
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled, disabled: o.disabled,

8
src/base/single/input/radio/radio.js

@ -9,10 +9,10 @@ BI.Radio = BI.inherit(BI.BasicButton, {
baseCls: "bi-radio", baseCls: "bi-radio",
selected: false, selected: false,
handler: BI.emptyFn, handler: BI.emptyFn,
width: 14, width: 16,
height: 14, height: 16,
iconWidth: 14, iconWidth: 16,
iconHeight: 14, iconHeight: 16,
}, },
render: function () { render: function () {

6
src/base/single/tip/tip.tooltip.js

@ -25,10 +25,12 @@ BI.Tooltip = BI.inherit(BI.Tip, {
render: function () { render: function () {
var o = this.options; var o = this.options;
this.element.addClass("tooltip-" + o.level); this.element.addClass("tooltip-" + o.level);
function fn(e) { function fn(e) {
o.stopPropagation && e.stopPropagation(); o.stopPropagation && e.stopPropagation();
o.stopEvent && e.stopEvent(); o.stopEvent && e.stopEvent();
} }
this.element.bind({ this.element.bind({
click: fn, click: fn,
mousedown: fn, mousedown: fn,
@ -48,7 +50,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
innerVgap: this._const.vgap, innerVgap: this._const.vgap,
items: BI.map(texts, function (i, text) { items: BI.map(texts, function (i, text) {
return { return {
type: "bi.label", type: "bi.text",
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: "normal", whiteSpace: "normal",
text: text, text: text,
@ -58,7 +60,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
}); });
} else { } else {
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.text",
element: this, element: this,
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: "normal", whiteSpace: "normal",

22
src/case/button/icon/iconhalf/icon.half.js

@ -7,16 +7,30 @@ BI.HalfButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-half-button bi-high-light-border", selected: false,
height: 14,
width: 14, width: 14,
selected: false height: 14,
iconWidth: 14,
iconHeight: 14,
}); });
}, },
render: function () {
var o = this.options;
return {
type: "bi.center_adapt",
items: [{
type: "bi.default",
cls: "bi-half-button bi-high-light-border",
width: o.iconWidth,
height: o.iconHeight,
}],
};
},
doClick: function () { doClick: function () {
BI.HalfButton.superclass.doClick.apply(this, arguments); BI.HalfButton.superclass.doClick.apply(this, arguments);
if(this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.HalfButton.EVENT_CHANGE); this.fireEvent(BI.HalfButton.EVENT_CHANGE);
} }
} }

30
src/case/combo/textvaluecombo/combo.textvalue.js

@ -14,7 +14,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
value: "", value: "",
defaultText: "", defaultText: "",
allowClear: false, allowClear: false,
status: "success", // success | warning | error status: "success", // success | warning | error,
title: null,
}); });
}, },
@ -35,6 +36,21 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
const o = this.options; const o = this.options;
const title = () => {
if (BI.isFunction(o.title)) {
return o.title();
}
if (this.options.status === "error") {
return {
level: "warning",
text: o.warningTitle,
};
}
return {
level: "success",
};
};
const trigger = { const trigger = {
type: "bi.select_text_trigger", type: "bi.select_text_trigger",
ref: ref => this.trigger = ref, ref: ref => this.trigger = ref,
@ -43,17 +59,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
height: o.height, height: o.height,
text: o.text, text: o.text,
value: o.value, value: o.value,
title: () => { title,
if (this.options.status === "error") {
return {
level: "warning",
text: o.warningTitle,
};
}
return {
level: "success",
};
},
allowClear: o.allowClear, allowClear: o.allowClear,
defaultText: o.defaultText, defaultText: o.defaultText,
listeners: [ listeners: [

12
src/core/4.widget.js

@ -748,7 +748,16 @@
this.purgeListeners(); this.purgeListeners();
}, },
_assetMounted: function () {
if (!this.isVisible()) {
this._setVisible(true);
this._mount(false, false, false);
this._setVisible(false);
}
},
_empty: function () { _empty: function () {
this._assetMounted();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount(); widget && widget._unMount && widget._unMount();
}); });
@ -790,6 +799,7 @@
}); });
}); });
this._watchers && (this._watchers = []); this._watchers && (this._watchers = []);
this._assetMounted();
this.__d(); this.__d();
this.element.empty(); this.element.empty();
this.element.unbind(); this.element.unbind();
@ -799,6 +809,7 @@
}, },
_destroy: function () { _destroy: function () {
this._assetMounted();
this.__destroy(); this.__destroy();
this.element.destroy(); this.element.destroy();
this.purgeListeners(); this.purgeListeners();
@ -806,6 +817,7 @@
destroy: function () { destroy: function () {
var self = this, o = this.options; var self = this, o = this.options;
this._assetMounted();
this.__destroy(); this.__destroy();
if (o.animation) { if (o.animation) {
this._innerSetVisible(false); this._innerSetVisible(false);

0
src/core/plugin.js → src/core/6.plugin.js

6
src/core/controller/controller.layer.js

@ -15,7 +15,10 @@ BI.LayerController = BI.inherit(BI.Controller, {
this.layerManager = {}; this.layerManager = {};
this.layouts = {}; this.layouts = {};
this.zindex = BI.zIndex_layer; this.zindex = BI.zIndex_layer;
BI.Resizers.add("layerController" + BI.uniqueId(), BI.bind(this._resize, this)); },
_initResizer: function () {
this.resizer = BI.Resizers.add("layerController" + BI.uniqueId(), BI.bind(this._resize, this));
}, },
_resize: function () { _resize: function () {
@ -38,6 +41,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
}, },
create: function (name, from, op, context) { create: function (name, from, op, context) {
BI.isNull(this.resizer) && this._initResizer();
if (this.has(name)) { if (this.has(name)) {
return this.get(name); return this.get(name);
} }

17
src/core/controller/controller.resizer.js

@ -5,18 +5,20 @@
* @class * @class
*/ */
BI.ResizeController = BI.inherit(BI.Controller, { BI.ResizeController = BI.inherit(BI.Controller, {
init: function () { init: function () {
var self = this;
this.resizerManger = {}; this.resizerManger = {};
var fn = BI.debounce(function (ev) { },
// if (BI.isWindow(ev.target)) {
_initResizeListener: function () {
var self = this;
this.resizeHandler = BI.debounce(function (ev) {
self._resize(ev); self._resize(ev);
// }
}, 30); }, 30);
if ("onorientationchange" in _global) { if ("onorientationchange" in _global) {
_global.onorientationchange = fn; _global.onorientationchange = this.resizeHandler;
} else { } else {
BI.Widget._renderEngine.createElement(_global).resize(fn); BI.Widget._renderEngine.createElement(_global).resize(this.resizeHandler);
} }
}, },
@ -34,13 +36,14 @@ BI.ResizeController = BI.inherit(BI.Controller, {
} }
if (BI.isFunction(resizer)) { if (BI.isFunction(resizer)) {
resizer(ev); resizer(ev);
return;
} }
}); });
}, },
add: function (name, resizer) { add: function (name, resizer) {
var self = this; var self = this;
BI.isNull(this.resizeHandler) && this._initResizeListener();
if (this.has(name)) { if (this.has(name)) {
return this; return this;
} }

70
src/core/platform/web/config.js

@ -1,5 +1,5 @@
// 工程配置 // 工程配置
BI.prepares.push(function () { !(function () {
// 注册布局 // 注册布局
// adapt类布局优先级规则 // adapt类布局优先级规则
// 1、支持flex的浏览器下使用flex布局 // 1、支持flex的浏览器下使用flex布局
@ -39,16 +39,16 @@ BI.prepares.push(function () {
// return BI.extend({}, ob, {type: "bi.table_adapt"}); // return BI.extend({}, ob, {type: "bi.table_adapt"});
// } // }
if (supportFlex) { if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_horizontal"}); return BI.extend({}, ob, { type: "bi.flex_horizontal" });
} }
return BI.extend({ return BI.extend({
scrollx: true scrollx: true
}, ob, {type: "bi.inline"}); }, ob, { type: "bi.inline" });
}); });
BI.Plugin.configWidget("bi.vertical", function (ob) { BI.Plugin.configWidget("bi.vertical", function (ob) {
if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) { if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) {
if (isSupportFlex()) { if (isSupportFlex()) {
return BI.extend({}, ob, {type: "bi.flex_vertical"}); return BI.extend({}, ob, { type: "bi.flex_vertical" });
} }
return BI.extend({}, ob, { return BI.extend({}, ob, {
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
@ -88,14 +88,14 @@ BI.prepares.push(function () {
if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
return BI.extend({ return BI.extend({
verticalAlign: BI.VerticalAlign.Top verticalAlign: BI.VerticalAlign.Top
}, ob, {type: "bi.horizontal_float_fill"}); }, ob, { type: "bi.horizontal_float_fill" });
} }
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch horizontalAlign: BI.HorizontalAlign.Stretch
}, ob, {type: "bi.table_adapt"}); }, ob, { type: "bi.table_adapt" });
} }
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_inline"}); return BI.extend({}, ob, { type: "bi.responsive_inline" });
} }
return ob; return ob;
}); });
@ -104,9 +104,9 @@ BI.prepares.push(function () {
// var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; // var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
// if (!isAdapt || justOneItem) { // if (!isAdapt || justOneItem) {
if (supportFlex) { if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); return BI.extend({}, ob, { type: "bi.flex_center_adapt" });
} }
return BI.extend({}, ob, {type: "bi.inline_center_adapt"}); return BI.extend({}, ob, { type: "bi.inline_center_adapt" });
// } // }
// return ob; // return ob;
}); });
@ -115,9 +115,9 @@ BI.prepares.push(function () {
// var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; // var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
// if (!isAdapt || justOneItem) { // if (!isAdapt || justOneItem) {
if (supportFlex) { if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_vertical_center_adapt"}); return BI.extend({}, ob, { type: "bi.flex_vertical_center_adapt" });
} }
return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"}); return BI.extend({}, ob, { type: "bi.inline_vertical_adapt" });
// } // }
// return ob; // return ob;
}); });
@ -126,7 +126,7 @@ BI.prepares.push(function () {
var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
var verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP; var verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP;
if (verticalAlignTop && justOneItem) { if (verticalAlignTop && justOneItem) {
return BI.extend({}, ob, {type: "bi.horizontal_auto"}); return BI.extend({}, ob, { type: "bi.horizontal_auto" });
} }
var supportFlex = isSupportFlex(); var supportFlex = isSupportFlex();
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
@ -134,24 +134,24 @@ BI.prepares.push(function () {
if (isAdapt) { if (isAdapt) {
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center horizontalAlign: BI.HorizontalAlign.Center
}, ob, {type: "bi.table_adapt"}); }, ob, { type: "bi.table_adapt" });
} }
if (supportFlex) { if (supportFlex) {
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center, horizontalAlign: BI.HorizontalAlign.Center,
scrollx: false scrollx: false
}, ob, {type: "bi.flex_horizontal"}); }, ob, { type: "bi.flex_horizontal" });
} }
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center horizontalAlign: BI.HorizontalAlign.Center
}, ob, {type: "bi.table_adapt"}); }, ob, { type: "bi.table_adapt" });
}); });
BI.Plugin.configWidget("bi.horizontal_float", function (ob) { BI.Plugin.configWidget("bi.horizontal_float", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {
return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"}); return BI.extend({}, ob, { type: "bi.flex_horizontal_adapt" });
} }
if (ob.items && ob.items.length <= 1) { if (ob.items && ob.items.length <= 1) {
return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"}); return BI.extend({}, ob, { type: "bi.inline_horizontal_adapt" });
} }
return ob; return ob;
}); });
@ -162,16 +162,16 @@ BI.prepares.push(function () {
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
scrollx: false scrollx: false
}, ob, {type: "bi.flex_horizontal"}); }, ob, { type: "bi.flex_horizontal" });
} }
if ((ob.horizontalAlign && ob.horizontalAlign !== BI.HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) { if ((ob.horizontalAlign && ob.horizontalAlign !== BI.HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) {
// 宽度不受限,要用table布局 // 宽度不受限,要用table布局
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch verticalAlign: BI.VerticalAlign.Stretch
}, ob, {type: "bi.table_adapt"}); }, ob, { type: "bi.table_adapt" });
} }
return BI.extend({}, ob, {type: "bi.horizontal_float_fill"}); return BI.extend({}, ob, { type: "bi.horizontal_float_fill" });
}); });
BI.Plugin.configWidget("bi.vertical_fill", function (ob) { BI.Plugin.configWidget("bi.vertical_fill", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {
@ -179,7 +179,7 @@ BI.prepares.push(function () {
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
scrolly: false scrolly: false
}, ob, {type: "bi.flex_vertical"}); }, ob, { type: "bi.flex_vertical" });
} }
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// 有滚动条,降级到table布局处理 // 有滚动条,降级到table布局处理
@ -204,18 +204,18 @@ BI.prepares.push(function () {
} }
if (hasAuto) { if (hasAuto) {
// 有自动高的时候 // 有自动高的时候
return BI.extend({}, ob, {type: "bi.vtape_auto"}); return BI.extend({}, ob, { type: "bi.vtape_auto" });
} }
return BI.extend({}, ob, {type: "bi.vtape"}); return BI.extend({}, ob, { type: "bi.vtape" });
}); });
BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) { BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) {
if (!isSupportSticky) { if (!isSupportSticky) {
return BI.extend({ scrollx: true }, ob, {type: "bi.horizontal_fill"}); return BI.extend({ scrollx: true }, ob, { type: "bi.horizontal_fill" });
} }
}); });
BI.Plugin.configWidget("bi.vertical_sticky", function (ob) { BI.Plugin.configWidget("bi.vertical_sticky", function (ob) {
if (!isSupportSticky) { if (!isSupportSticky) {
return BI.extend({ scrolly: true }, ob, {type: "bi.vertical_fill"}); return BI.extend({ scrolly: true }, ob, { type: "bi.vertical_fill" });
} }
}); });
@ -223,7 +223,7 @@ BI.prepares.push(function () {
if (isSupportFlex()) { if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { // if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"}); return BI.extend({}, ob, { type: "bi.flex_left_right_vertical_adapt" });
// } // }
} }
return ob; return ob;
@ -232,40 +232,40 @@ BI.prepares.push(function () {
if (ob.scrollable === true || ob.scrollx !== false) { if (ob.scrollable === true || ob.scrollx !== false) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_flex_scrollable_horizontal"}); return BI.extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" });
} }
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"}); return BI.extend({}, ob, { type: "bi.flex_scrollable_horizontal" });
} }
} }
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_flex_horizontal"}); return BI.extend({}, ob, { type: "bi.responsive_flex_horizontal" });
} }
}); });
BI.Plugin.configWidget("bi.flex_vertical", function (ob) { BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) { if (ob.scrollable === true || ob.scrollx === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); return BI.extend({}, ob, { type: "bi.flex_scrollable_vertical" });
} }
} }
}); });
BI.Plugin.configWidget("bi.table", function (ob) { BI.Plugin.configWidget("bi.table", function (ob) {
if (!isSupportGrid()) { if (!isSupportGrid()) {
return BI.extend({}, ob, {type: "bi.td"}); return BI.extend({}, ob, { type: "bi.td" });
} }
return ob; return ob;
}); });
BI.Plugin.configWidget("bi.radio", function (ob) { BI.Plugin.configWidget("bi.radio", function (ob) {
if (BI.isIE() && BI.getIEVersion() <= 9) { if (BI.isIE() && BI.getIEVersion() <= 9) {
return BI.extend({}, ob, {type: "bi.image_radio"}); return BI.extend({}, ob, { type: "bi.image_radio" });
} }
return ob; return ob;
}); });
BI.Plugin.configWidget("bi.checkbox", function (ob) { BI.Plugin.configWidget("bi.checkbox", function (ob) {
if (BI.isIE() && BI.getIEVersion() <= 9) { if (BI.isIE() && BI.getIEVersion() <= 9) {
return BI.extend({}, ob, {type: "bi.image_checkbox"}); return BI.extend({}, ob, { type: "bi.image_checkbox" });
} }
return ob; return ob;
}); });
@ -274,6 +274,6 @@ BI.prepares.push(function () {
if (BI.isIE() && BI.getIEVersion() < 9) { if (BI.isIE() && BI.getIEVersion() < 9) {
return ob; return ob;
} }
return BI.extend({}, ob, {type: "bi.half_button"}); return BI.extend({}, ob, { type: "bi.half_button" });
}); });
}); }());

22
src/core/utils/i18n.js

@ -1,5 +1,8 @@
!(function () { !(function () {
var i18nStore = {}; var i18nStore = {};
var i18nFormatters = {};
BI._.extend(BI, { BI._.extend(BI, {
changeI18n: function (i18n) { changeI18n: function (i18n) {
if (i18n) { if (i18n) {
@ -9,6 +12,7 @@
addI18n: function (i18n) { addI18n: function (i18n) {
BI.extend(i18nStore, i18n); BI.extend(i18nStore, i18n);
}, },
i18nText: function (key) { i18nText: function (key) {
var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || ""; var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || "";
if (!localeText) { if (!localeText) {
@ -16,10 +20,18 @@
} }
var len = arguments.length; var len = arguments.length;
if (len > 1) { if (len > 1) {
if (localeText.indexOf("{R1}") > -1) { if (localeText.indexOf("{R1") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var reg = new RegExp(`{R${i},(.*?)}`, "g");
localeText = BI.replaceAll(localeText, key, arguments[i] + "");
var result = reg.exec(localeText);
if (result) {
var formatName = result[1];
localeText = BI.replaceAll(localeText, reg, i18nFormatters[formatName](key, arguments[i]));
} else {
localeText = BI.replaceAll(localeText, `{R${i}}`, arguments[i] + "");
}
} }
} else { } else {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
@ -30,6 +42,10 @@
} }
} }
return localeText; return localeText;
},
addI18nFormatter: function (formatName, fn) {
i18nFormatters[formatName] = fn;
} }
}); });
})(); })();

9
src/less/base/single/button/item.singleselect.icontext.less

@ -1,9 +0,0 @@
@import "../../../index.less";
.bi-single-select-icon-text-item{
&:active, &.active {
& .b-font:before {
color: @color-bi-text-active-single-select-icon-text-item;
}
}
}

6
src/less/base/single/input/radio.less

@ -18,13 +18,13 @@
border-color: @color-bi-border-hover-active-radio; border-color: @color-bi-border-hover-active-radio;
background-color: @color-bi-background-active-radio; background-color: @color-bi-background-active-radio;
&:after { &:after {
width: 6px; width: 8px;
height: 6px; height: 8px;
display: table; display: table;
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
.border-radius(3px); .border-radius(4px);
background-color: @color-bi-background-active-radio-content; background-color: @color-bi-background-active-radio-content;
.transform(translate(-50%, -50%)); .transform(translate(-50%, -50%));
@transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s; @transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;

10
src/less/base/tree/ztree.less

@ -50,7 +50,7 @@
&:before { &:before {
border-left: 1px solid @border-color-dark-gray-line; border-left: 1px solid @border-color-dark-gray-line;
height: 100%; height: 100%;
left: 15px; left: 14px;
margin-top: 0; margin-top: 0;
} }
} }
@ -92,7 +92,7 @@
} }
.ztree.solid li a { .ztree.solid li a {
height: 32px; height: 30px;
} }
.ztree li a.curSelectedNode { .ztree li a.curSelectedNode {
@ -143,7 +143,7 @@
} }
.ztree.solid li span { .ztree.solid li span {
line-height: 32px; line-height: 30px;
} }
.ztree li span.icon { .ztree li span.icon {
@ -282,8 +282,8 @@
} }
.ztree.solid li span.button.switch { .ztree.solid li span.button.switch {
width: 32px; width: 30px;
height: 32px height: 30px
} }
.ztree li span.button.switch.noline_open { .ztree li span.button.switch.noline_open {

8
src/less/widget/multiselect/multiselect.combo.less

@ -1,9 +1,12 @@
@import "../../index.less"; @import "../../index.less";
@val: transform .3s ease; @val: transform .3s ease;
.bi-multi-select-combo{
& .multi-select-trigger-icon-button{ .bi-multi-select-combo, .bi-multi-select-combo-no-bar {
& .multi-select-trigger-icon-button {
font-size: @font-size-16; font-size: @font-size-16;
} }
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button { & .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon { & .x-icon {
@ -11,6 +14,7 @@
.transition(@val); .transition(@val);
} }
} }
& .bi-combo + .bi-trigger-icon-button { & .bi-combo + .bi-trigger-icon-button {
& .x-icon { & .x-icon {
.rotate(0deg); .rotate(0deg);

16
src/widget/downlist/item.downlist.js

@ -33,17 +33,21 @@ BI.DownListItem = BI.inherit(BI.BasicButton, {
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}); });
var icon = BI.isPlainObject(o.icon) ? o.icon : {
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight,
}
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: 36, width: 36,
height: o.height, height: o.height,
items: [{ items: [{
el: { el: icon,
type: "bi.icon", }],
width: o.iconWidth,
height: o.iconHeight
}
}]
}); });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({

66
src/widget/downlist/item.downlistgroup.js

@ -8,11 +8,11 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
}, },
// invalid: true, // invalid: true,
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
icon: "",
iconCls2: "pull-right-e-font" iconCls2: "pull-right-e-font"
}); });
}, },
_init: function () { render: function () {
BI.DownListGroupItem.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
var self = this; var self = this;
this.text = BI.createWidget({ this.text = BI.createWidget({
@ -21,20 +21,29 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height
});
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
width: 36,
height: o.height, height: o.height,
iconHeight: o.iconHeight,
iconWidth: 36,
disableSelected: true,
selected: this._digest(o.value)
}); });
if (BI.isPlainObject(o.icon)) {
this.icon1 = BI.createWidget({
width: 36,
height: o.height,
type: "bi.center_adapt",
items: [o.icon],
});
} else {
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
width: 36,
height: o.height,
iconHeight: o.iconHeight,
iconWidth: 36,
disableSelected: true,
selected: this._digest(o.value),
});
}
this.icon2 = BI.createWidget({ this.icon2 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls2, cls: o.iconCls2,
@ -42,27 +51,6 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
forceNotSelected: true forceNotSelected: true
}); });
var blank = BI.createWidget({
type: "bi.layout",
width: 24
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.icon2,
top: 0,
bottom: 0,
right: 0
}]
});
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank)
}))));
this.element.hover(function () { this.element.hover(function () {
if (self.isEnabled()) { if (self.isEnabled()) {
self.hover(); self.hover();
@ -72,6 +60,12 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
self.dishover(); self.dishover();
} }
}); });
return {
type: "bi.horizontal_fill",
columnSize: [36, "fill", 24],
items: [this.icon1, this.text, this.icon2]
}
}, },
_getLevel: function () { _getLevel: function () {
@ -117,8 +111,8 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
}, },
setValue: function (v) { setValue: function (v) {
this.icon1.setSelected(this._digest(v)); this.icon1.setSelected && this.icon1.setSelected(this._digest(v));
} },
}); });
BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem); BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem);

1
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -13,7 +13,6 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
defaultText: "", defaultText: "",
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [], items: [],
value: "",
allowEdit: false, allowEdit: false,
allowSearchValue: false, allowSearchValue: false,
allowInsertValue: false, allowInsertValue: false,

2
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -42,7 +42,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
self.editor = this; self.editor = this;
}, },
defaultText: o.defaultText, defaultText: o.defaultText,
text: this._digest(o.value), text: BI.isKey(o.value) ? this._digest(o.value) : o.text,
value: o.value, value: o.value,
height: o.height, height: o.height,
tipText: "", tipText: "",

1
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -16,7 +16,6 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
defaultText: "", defaultText: "",
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [], items: [],
value: "",
allowEdit: false, allowEdit: false,
allowSearchValue: false, allowSearchValue: false,
allowInsertValue: false, allowInsertValue: false,

2
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -42,7 +42,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
self.editor = this; self.editor = this;
}, },
defaultText: o.defaultText, defaultText: o.defaultText,
text: this._digest(o.value), text: BI.isKey(o.value) ? this._digest(o.value) : o.text,
value: o.value, value: o.value,
height: o.height, height: o.height,
tipText: "", tipText: "",

22
src/widget/multiselect/multiselect.combo.nobar.js

@ -174,7 +174,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
value: o.value value: o.value
}, },
hideChecker: function (e) { hideChecker: function (e) {
return self.numberCounter.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -199,6 +199,21 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
masker: { masker: {
@ -252,6 +267,11 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",

1
src/widget/multiselect/multiselect.loader.js

@ -45,6 +45,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
onLoaded: opts.onLoaded, onLoaded: opts.onLoaded,
el: { el: {
type: "bi.multi_select_inner_loader", type: "bi.multi_select_inner_loader",
isDefaultInit: false,
} }
}, opts.el), }, opts.el),
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {

3
src/widget/singleselect/trigger/searcher.singleselect.js

@ -125,9 +125,10 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
if (BI.isNull(v)) { if (BI.isUndefined(v)) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
v = v || "";
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));
} }
}, },

16
typescript/base/single/button/buttons/button.ts

@ -10,10 +10,16 @@ export declare class Button extends BasicButton {
minWidth?: number; minWidth?: number;
readonly?: boolean; readonly?: boolean;
iconCls?: string; iconCls?: string;
level?: 'common' | 'success' | 'warning' |'ignore', level?: 'common' | 'success' | 'warning' | 'error' | 'ignore',
block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制 block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制
loading?: boolean, // 是否处于加载中
light?: boolean, // 是否使用浅色
plain?: boolean, // 是否是朴素按钮,和 clear 的区别是 plain 有悬浮效果
clear?: boolean; // 是否去掉边框和背景 clear?: boolean; // 是否去掉边框和背景
ghost?: boolean; // 是否幽灵显示, 即正常状态无背景 ghost?: boolean; // 是否幽灵显示, 即正常状态无背景
iconGap?: number;
iconPosition?: string;
textWidth?: number;
} & AbstractLabel['props'] & IconLabel['props'] & BasicButton['props']; } & AbstractLabel['props'] & IconLabel['props'] & BasicButton['props'];
text: Label; text: Label;
@ -26,4 +32,12 @@ export declare class Button extends BasicButton {
doHighLight(...args: any[]): void; doHighLight(...args: any[]): void;
unHighLight(...args: any[]): void; unHighLight(...args: any[]): void;
loading(): void;
loaded(): void;
setIcon(iconCls: string): void;
isLoading(): boolean;
} }

Loading…
Cancel
Save