diff --git a/bi.lessconfig.json b/bi.lessconfig.json
index 44b1ca0f6..d82f94985 100644
--- a/bi.lessconfig.json
+++ b/bi.lessconfig.json
@@ -29,7 +29,8 @@
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#FFFFFF",
"@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479",
- "@color-bi-background-tooltip-success": "#2E3A4D",
+ "@color-bi-background-tooltip-success": "#3F506A",
+ "@color-bi-background-tooltip-failure": "#E65251",
"@color-bi-border-tooltip-success": "#2E3A4D",
"@color-bi-background-toast-success": "#FFFFFF",
"@color-bi-background-toast-warning": "#FFFFFF",
diff --git a/demo/js/core/abstract/combination/demo.combo_group.js b/demo/js/core/abstract/combination/demo.combo_group.js
index aeb9a1936..2cd391b7d 100644
--- a/demo/js/core/abstract/combination/demo.combo_group.js
+++ b/demo/js/core/abstract/combination/demo.combo_group.js
@@ -12,7 +12,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 25,
iconCls: "close-ha-font"
},
- children: [{
+ items: [{
type: "bi.single_select_item",
height: 25,
text: "一月",
@@ -63,7 +63,7 @@ Demo.Func = BI.inherit(BI.Widget, {
},
width: 200
});
- childCombo.setValue(BI.deepClone(this.child)[0].children[0].value);
+ childCombo.setValue(BI.deepClone(this.child)[0].items[0].value);
return BI.createWidget({
type: "bi.left",
diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot
index 3a2dc8643..876d0c407 100644
Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ
diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg
index e45847d23..bf89d8452 100644
--- a/dist/font/iconfont.svg
+++ b/dist/font/iconfont.svg
@@ -14,6 +14,24 @@
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf
index 11a6aec01..d126a7c97 100644
Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ
diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff
index 3a5514a21..3ea104492 100644
Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ
diff --git a/dist/font/iconfont.woff2 b/dist/font/iconfont.woff2
index 8eea86c81..a695ead6a 100644
Binary files a/dist/font/iconfont.woff2 and b/dist/font/iconfont.woff2 differ
diff --git a/package.json b/package.json
index 4b7359a5a..035e98713 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fineui",
- "version": "2.0.20221228163952",
+ "version": "2.0.20230106121528",
"description": "fineui",
"main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts",
diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js
index c0a77c9f6..2dfcb8b6c 100644
--- a/src/base/single/editor/editor.js
+++ b/src/base/single/editor/editor.js
@@ -109,6 +109,7 @@ BI.Editor = BI.inherit(BI.Single, {
if (e.keyCode !== BI.KeyCode.TAB && self.watermark) {
self.watermark.invisible();
}
+ self.fireEvent(BI.Editor.EVENT_QUICK_DOWN, arguments);
});
this.editor.on(BI.Input.EVENT_VALID, function () {
@@ -360,6 +361,7 @@ BI.Editor.EVENT_FOCUS = "EVENT_FOCUS";
BI.Editor.EVENT_BLUR = "EVENT_BLUR";
BI.Editor.EVENT_CLICK = "EVENT_CLICK";
BI.Editor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
+BI.Editor.EVENT_QUICK_DOWN = "EVENT_QUICK_DOWN";
BI.Editor.EVENT_SPACE = "EVENT_SPACE";
BI.Editor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js
index 02642da1a..0cd4460ad 100644
--- a/src/case/combo/textvaluecombo/combo.textvalue.js
+++ b/src/case/combo/textvaluecombo/combo.textvalue.js
@@ -144,7 +144,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: popup,
value: o.value,
maxHeight: 240,
- minHeight: 25
+ minHeight: 60
}
};
},
diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js
index 3411793a4..aed1b0979 100644
--- a/src/case/combo/textvaluecombo/popup.textvalue.js
+++ b/src/case/combo/textvaluecombo/popup.textvalue.js
@@ -131,8 +131,10 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
};
},
- mounted: function () {
- this.check();
+ beforeMount: function () {
+ if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
+ this.check();
+ }
},
_formatItems: function (items) {
diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js
index 0fb65fa0d..a624d78a2 100644
--- a/src/case/editor/editor.sign.js
+++ b/src/case/editor/editor.sign.js
@@ -87,6 +87,9 @@ BI.SignEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.SignEditor.EVENT_KEY_DOWN, arguments);
});
+ this.editor.on(BI.Editor.EVENT_QUICK_DOWN, function () {
+ self.fireEvent(BI.SignEditor.EVENT_QUICK_DOWN, arguments);
+ });
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.SignEditor.EVENT_VALID, arguments);
@@ -265,6 +268,7 @@ BI.SignEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.SignEditor.EVENT_BLUR = "EVENT_BLUR";
BI.SignEditor.EVENT_CLICK = "EVENT_CLICK";
BI.SignEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
+BI.SignEditor.EVENT_QUICK_DOWN = "EVENT_QUICK_DOWN";
BI.SignEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.SignEditor.EVENT_START = "EVENT_START";
diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js
index 945aa359a..cc9ed0f8d 100644
--- a/src/core/platform/web/dom.js
+++ b/src/core/platform/web/dom.js
@@ -448,7 +448,7 @@
viewportBounds = document.documentElement.getBoundingClientRect();
var left;
if (comboRect.left + comboRect.width / 2 + popupRect.width / 2 > viewportBounds.width) {
- left = viewportBounds.width - comboRect.width - positionRelativeElementRect.left;
+ left = viewportBounds.width - popupRect.width - positionRelativeElementRect.left;
} else {
left = comboRect.left + (comboRect.width - popupRect.width) / 2 - positionRelativeElementRect.left;
}
@@ -710,7 +710,7 @@
break;
}
if (needAdaptHeight === true) {
- popup.resetHeight && popup.resetHeight(Math.min(viewportBounds.height - position.top + (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight));
+ popup.resetHeight && popup.resetHeight(Math.min(viewportBounds.height - position.top - (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight));
}
return position;
},
diff --git a/src/core/utils/chinesePY.js b/src/core/utils/chinesePY.js
index b22cd94cb..392f108b4 100644
--- a/src/core/utils/chinesePY.js
+++ b/src/core/utils/chinesePY.js
@@ -425,6 +425,10 @@
BI._.extend(BI, {
makeFirstPY: function (str, options) {
options = options || {};
+ // BI-119441 长字段搜索分叉后数量达百万级,这里控制下字段过长的话不进行多音字分叉
+ if (str.length > 100 && BI.isNull(options.ignoreMulti)) {
+ options.ignoreMulti = true;
+ }
if (typeof (str) !== "string") {return "" + str;}
var arrResult = []; // 保存中间结果的数组
for (var i = 0, len = str.length; i < len; i++) {
diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js
index ce84a730e..d757ebbca 100644
--- a/src/widget/multiselect/multiselect.combo.nobar.js
+++ b/src/widget/multiselect/multiselect.combo.nobar.js
@@ -54,6 +54,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
+ itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
value: {
type: BI.Selection.Multi,
@@ -134,29 +135,31 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
- listeners: [{
- eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
- action: function () {
- self._dataChange = true;
- self.storeValue = this.getValue();
- self._adjust(function () {
- assertShowValue();
- });
- self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
+ listeners: [
+ {
+ eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
+ action: function () {
+ self._dataChange = true;
+ self.storeValue = this.getValue();
+ self._adjust(function () {
+ assertShowValue();
+ });
+ self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
+ }
+ }, {
+ eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
+ action: function () {
+ self._defaultState();
+ }
+ }, {
+ eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
+ action: function () {
+ self._dataChange = true;
+ self.setValue();
+ self._defaultState();
+ }
}
- }, {
- eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
- action: function () {
- self._defaultState();
- }
- }, {
- eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
- action: function () {
- self._dataChange = true;
- self.setValue();
- self._defaultState();
- }
- }],
+ ],
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
@@ -262,26 +265,28 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: this.combo,
- left: 0,
- right: 0,
- top: 0,
- bottom: 0
- }, {
- el: triggerBtn,
- right: 0,
- top: 0,
- bottom: 0
- }, {
- el: {
- type: "bi.vertical_adapt",
- items: [this.numberCounter]
- },
- right: o.height,
- top: 0,
- height: o.height
- }]
+ items: [
+ {
+ el: this.combo,
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0
+ }, {
+ el: triggerBtn,
+ right: 0,
+ top: 0,
+ bottom: 0
+ }, {
+ el: {
+ type: "bi.vertical_adapt",
+ items: [this.numberCounter]
+ },
+ right: o.height,
+ top: 0,
+ height: o.height
+ }
+ ]
});
},
diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js
index 6540e0dc9..c18aa6d90 100644
--- a/src/widget/multiselect/multiselect.insert.combo.js
+++ b/src/widget/multiselect/multiselect.insert.combo.js
@@ -55,6 +55,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
+ itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
value: this.storeValue,
});
@@ -138,31 +139,34 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
- listeners: [{
- eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
- action: function () {
- self._dataChange = true;
- self.storeValue = this.getValue();
- self._adjust(function () {
- assertShowValue();
- });
- self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM);
+ listeners: [
+ {
+ eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
+ action: function () {
+ self._dataChange = true;
+ self.storeValue = this.getValue();
+ self._adjust(function () {
+ assertShowValue();
+ });
+ self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM);
+ }
+ }, {
+ eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
+ action: function () {
+ self._defaultState();
+ }
+ }, {
+ eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
+ action: function () {
+ self._dataChange = true;
+ self.setValue();
+ self._defaultState();
+ }
}
- }, {
- eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
- action: function () {
- self._defaultState();
- }
- }, {
- eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
- action: function () {
- self._dataChange = true;
- self.setValue();
- self._defaultState();
- }
- }],
+ ],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
+ itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
onLoaded: function () {
BI.nextTick(function () {
@@ -260,26 +264,28 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: this.combo,
- left: 0,
- right: 0,
- top: 0,
- bottom: 0
- }, {
- el: triggerBtn,
- right: 0,
- top: 0,
- bottom: 0
- }, {
- el: {
- type: "bi.vertical_adapt",
- items: [this.numberCounter]
- },
- right: o.height,
- top: 0,
- height: o.height,
- }]
+ items: [
+ {
+ el: this.combo,
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0
+ }, {
+ el: triggerBtn,
+ right: 0,
+ top: 0,
+ bottom: 0
+ }, {
+ el: {
+ type: "bi.vertical_adapt",
+ items: [this.numberCounter]
+ },
+ right: o.height,
+ top: 0,
+ height: o.height,
+ }
+ ]
});
},
diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js
index c7ff2109d..d3fbc3862 100644
--- a/src/widget/multiselect/multiselect.insert.combo.nobar.js
+++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js
@@ -54,6 +54,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
+ itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
value: {
type: BI.Selection.Multi,
@@ -129,28 +130,30 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
- listeners: [{
- eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
- action: function () {
- self._dataChange = true;
- self.storeValue = this.getValue();
- self._adjust(function () {
- assertShowValue();
- });
+ listeners: [
+ {
+ eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
+ action: function () {
+ self._dataChange = true;
+ self.storeValue = this.getValue();
+ self._adjust(function () {
+ assertShowValue();
+ });
+ }
+ }, {
+ eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
+ action: function () {
+ self._defaultState();
+ }
+ }, {
+ eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
+ action: function () {
+ self._dataChange = true;
+ self.setValue();
+ self._defaultState();
+ }
}
- }, {
- eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
- action: function () {
- self._defaultState();
- }
- }, {
- eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
- action: function () {
- self._dataChange = true;
- self.setValue();
- self._defaultState();
- }
- }],
+ ],
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
@@ -256,26 +259,28 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: this.combo,
- left: 0,
- right: 0,
- top: 0,
- bottom: 0
- }, {
- el: triggerBtn,
- right: 0,
- top: 0,
- bottom: 0
- }, {
- el: {
- type: "bi.vertical_adapt",
- items: [this.numberCounter]
- },
- right: o.height,
- top: 0,
- height: o.height
- }]
+ items: [
+ {
+ el: this.combo,
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0
+ }, {
+ el: triggerBtn,
+ right: 0,
+ top: 0,
+ bottom: 0
+ }, {
+ el: {
+ type: "bi.vertical_adapt",
+ items: [this.numberCounter]
+ },
+ right: o.height,
+ top: 0,
+ height: o.height
+ }
+ ]
});
},
diff --git a/src/widget/multiselect/multiselect.insert.trigger.js b/src/widget/multiselect/multiselect.insert.trigger.js
index b04aebd07..4ed1b19ef 100644
--- a/src/widget/multiselect/multiselect.insert.trigger.js
+++ b/src/widget/multiselect/multiselect.insert.trigger.js
@@ -40,6 +40,7 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
defaultText: o.defaultText,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
+ itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
watermark: o.watermark,
popup: {},
@@ -86,24 +87,27 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
}, {
el: BI.createWidget(),
width: 24
- }]
+ }
+ ]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: {
- type: "bi.text",
- title: function () {
- return self.searcher.getState();
- }
- },
- left: 0,
- right: 24,
- top: 0,
- bottom: 0
- }]
+ items: [
+ {
+ el: {
+ type: "bi.text",
+ title: function () {
+ return self.searcher.getState();
+ }
+ },
+ left: 0,
+ right: 24,
+ top: 0,
+ bottom: 0
+ }
+ ]
});
},
diff --git a/src/widget/multiselect/multiselect.trigger.js b/src/widget/multiselect/multiselect.trigger.js
index 937e83804..f8f95c02b 100644
--- a/src/widget/multiselect/multiselect.trigger.js
+++ b/src/widget/multiselect/multiselect.trigger.js
@@ -41,6 +41,7 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
+ itemFormatter: o.itemFormatter,
watermark: o.watermark,
popup: {},
adapter: o.adapter,
@@ -88,23 +89,25 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: {
- type: "bi.text",
- title: function () {
- /** 修正REPORT-73699引入,需要考虑到传递过来的值是方法的情况 */
- var state = self.searcher.getState();
- if (BI.isFunction(state)) {
- return state();
+ items: [
+ {
+ el: {
+ type: "bi.text",
+ title: function () {
+ /** 修正REPORT-73699引入,需要考虑到传递过来的值是方法的情况 */
+ var state = self.searcher.getState();
+ if (BI.isFunction(state)) {
+ return state();
+ }
+ return state;
}
- return state;
- }
- },
- left: 0,
- right: 24,
- top: 0,
- bottom: 0
- }]
+ },
+ left: 0,
+ right: 24,
+ top: 0,
+ bottom: 0
+ }
+ ]
});
},
diff --git a/src/widget/multiselect/search/multiselect.search.loader.js b/src/widget/multiselect/search/multiselect.search.loader.js
index 89e4cb318..5f6d09f54 100644
--- a/src/widget/multiselect/search/multiselect.search.loader.js
+++ b/src/widget/multiselect/search/multiselect.search.loader.js
@@ -51,9 +51,11 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
return true;
}
},
- layouts: [{
- type: "bi.vertical"
- }]
+ layouts: [
+ {
+ type: "bi.vertical"
+ }
+ ]
}
}
},
@@ -92,15 +94,21 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
_createItems: function (items) {
var allSelected = this.isAllSelected();
- return BI.createItems(items, {
- type: "bi.multi_select_item",
- logic: {
- dynamic: false
- },
- height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
- selected: allSelected,
- cls: "bi-list-item-active",
- iconWrapperWidth: 36
+ var itemFormatter = this.options.itemFormatter;
+
+ return BI.map(items, (index, item) => {
+ return {
+ type: "bi.multi_select_item",
+ logic: {
+ dynamic: false
+ },
+ height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
+ selected: allSelected,
+ cls: "bi-list-item-active",
+ iconWrapperWidth: 36,
+ ...item,
+ ...itemFormatter(item)
+ };
});
},
diff --git a/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/src/widget/multiselect/trigger/searcher.multiselect.insert.js
index bf77db1e7..ec31d3d31 100644
--- a/src/widget/multiselect/trigger/searcher.multiselect.insert.js
+++ b/src/widget/multiselect/trigger/searcher.multiselect.insert.js
@@ -29,17 +29,19 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
height: o.height,
text: o.text,
defaultText: o.defaultText,
- listeners: [{
- eventName: BI.MultiSelectEditor.EVENT_FOCUS,
- action: function () {
- self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_FOCUS);
- }
- }, {
- eventName: BI.MultiSelectEditor.EVENT_BLUR,
- action: function () {
- self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_BLUR);
+ listeners: [
+ {
+ eventName: BI.MultiSelectEditor.EVENT_FOCUS,
+ action: function () {
+ self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_FOCUS);
+ }
+ }, {
+ eventName: BI.MultiSelectEditor.EVENT_BLUR,
+ action: function () {
+ self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_BLUR);
+ }
}
- }]
+ ]
});
this.searcher = BI.createWidget({
@@ -56,6 +58,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
popup: BI.extend({
type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter,
+ itemFormatter: o.itemFormatter,
keywordGetter: function () {
return self.editor.getKeyword();
},
diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js
index 5744cd1de..e7ed00874 100644
--- a/src/widget/multiselect/trigger/searcher.multiselect.js
+++ b/src/widget/multiselect/trigger/searcher.multiselect.js
@@ -29,17 +29,19 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
text: o.text,
defaultText: o.defaultText,
watermark: o.watermark,
- listeners: [{
- eventName: BI.MultiSelectEditor.EVENT_FOCUS,
- action: function () {
- self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
- }
- }, {
- eventName: BI.MultiSelectEditor.EVENT_BLUR,
- action: function () {
- self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
+ listeners: [
+ {
+ eventName: BI.MultiSelectEditor.EVENT_FOCUS,
+ action: function () {
+ self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
+ }
+ }, {
+ eventName: BI.MultiSelectEditor.EVENT_BLUR,
+ action: function () {
+ self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
+ }
}
- }]
+ ]
});
this.searcher = BI.createWidget({
@@ -55,6 +57,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
popup: BI.extend({
type: "bi.multi_select_search_pane",
valueFormatter: o.valueFormatter,
+ itemFormatter: o.itemFormatter,
keywordGetter: function () {
return self.editor.getValue();
},
diff --git a/src/widget/numbereditor/number.editor.js b/src/widget/numbereditor/number.editor.js
index 2624c5dc4..13f360baa 100644
--- a/src/widget/numbereditor/number.editor.js
+++ b/src/widget/numbereditor/number.editor.js
@@ -39,9 +39,33 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) {
return false;
}
+
return o.validationChecker(parsedValue);
},
- errorText: o.errorText
+ errorText: o.errorText,
+ listeners: [
+ {
+ eventName: BI.SignEditor.EVENT_QUICK_DOWN,
+ action: e => {
+ if ([BI.KeyCode.UP, BI.KeyCode.DOWN].includes(e.keyCode)) {
+ e.preventDefault();
+ }
+ },
+ },
+ {
+ eventName: BI.SignEditor.EVENT_KEY_DOWN,
+ action: (keycode) => {
+ if (keycode === BI.KeyCode.UP) {
+ this._finetuning(o.step);
+
+ return;
+ }
+ if (keycode === BI.KeyCode.DOWN) {
+ this._finetuning(-o.step);
+ }
+ },
+ }
+ ],
});
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
// 大多数时候valueFormatter往往需要配合valueParser一起使用
@@ -68,7 +92,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
forceNotSelected: true,
trigger: "lclick,",
debounce: false,
- cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12"
+ cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12",
});
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(o.step);
@@ -80,7 +104,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
trigger: "lclick,",
forceNotSelected: true,
debounce: false,
- cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12"
+ cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12",
});
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(-o.step);
@@ -101,17 +125,17 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
{
column: 0,
row: 0,
- el: this.topBtn
+ el: this.topBtn,
}, {
column: 0,
row: 1,
- el: this.bottomBtn
+ el: this.bottomBtn,
}
- ]
+ ],
},
- width: 23
+ width: 23,
}
- ]
+ ],
});
},
@@ -125,6 +149,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
_checkValueInRange: function (v) {
var o = this.options;
+
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max);
},
@@ -137,8 +162,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
// 微调
_finetuning: function (add) {
- var v = BI.parseFloat(this.getValue());
- this.setValue(BI.add(v, add));
+ const { max, min } = this.options;
+ let v = BI.parseFloat(this.getValue());
+ v = BI.add(v, add);
+ v = BI.clamp(v, min, max);
+ this.setValue(v);
},
setUpEnable: function (v) {
@@ -165,7 +193,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
var o = this.options;
o.value = v;
this.editor.setValue(o.valueFormatter(v));
- }
+ this._checkAdjustDisabled(o.value);
+ },
});
BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
diff --git a/src/widget/yearmonth/combo.yearmonth.js b/src/widget/yearmonth/combo.yearmonth.js
index 82d6e3ca8..0fc8cab5c 100644
--- a/src/widget/yearmonth/combo.yearmonth.js
+++ b/src/widget/yearmonth/combo.yearmonth.js
@@ -80,39 +80,45 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
ref: function () {
self.popup = this;
},
- listeners: [{
- eventName: BI.DynamicYearMonthPopup.EVENT_CHANGE,
- action: function () {
- self.setValue(self.popup.getValue());
- self.combo.hideView();
- self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
- }
- }, {
- eventName: BI.DynamicYearMonthPopup.BUTTON_CLEAR_EVENT_CHANGE,
- action: function () {
- self.setValue();
- self.combo.hideView();
- self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
- }
- }, {
- eventName: BI.DynamicYearMonthPopup.BUTTON_lABEL_EVENT_CHANGE,
- action: function () {
- var date = BI.getDate();
- self.setValue({ type: BI.DynamicYearMonthCombo.Static, value: { year: date.getFullYear(), month: date.getMonth() + 1 } });
- self.combo.hideView();
- self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
- }
- }, {
- eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE,
- action: function () {
- var value = self.popup.getValue();
- if (self._checkValue(value)) {
- self.setValue(value);
+ listeners: [
+ {
+ eventName: BI.DynamicYearMonthPopup.EVENT_CHANGE,
+ action: function () {
+ self.setValue(self.popup.getValue());
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
+ }
+ }, {
+ eventName: BI.DynamicYearMonthPopup.BUTTON_CLEAR_EVENT_CHANGE,
+ action: function () {
+ self.setValue();
+ self.comboWrapper.element.removeClass("error");
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
+ }
+ }, {
+ eventName: BI.DynamicYearMonthPopup.BUTTON_lABEL_EVENT_CHANGE,
+ action: function () {
+ var date = BI.getDate();
+ self.setValue({
+ type: BI.DynamicYearMonthCombo.Static,
+ value: { year: date.getFullYear(), month: date.getMonth() + 1 }
+ });
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
+ }
+ }, {
+ eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE,
+ action: function () {
+ var value = self.popup.getValue();
+ if (self._checkValue(value)) {
+ self.setValue(value);
+ }
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
}
- self.combo.hideView();
- self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
}
- }],
+ ],
behaviors: o.behaviors,
min: o.minDate,
max: o.maxDate
@@ -130,31 +136,35 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: {
- type: "bi.horizontal_fill",
- columnSize: ["", "fill"],
- cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
- ref: function () {
- self.comboWrapper = this;
+ items: [
+ {
+ el: {
+ type: "bi.horizontal_fill",
+ columnSize: ["", "fill"],
+ cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
+ ref: function () {
+ self.comboWrapper = this;
+ },
+ items: [
+ {
+ el: {
+ type: "bi.icon_button",
+ cls: "bi-trigger-icon-button date-change-h-font",
+ width: BI.toPix(o.height, border),
+ height: BI.toPix(o.height, border),
+ ref: function () {
+ self.changeIcon = this;
+ }
+ }
+ }, this.combo
+ ]
},
- items: [{
- el: {
- type: "bi.icon_button",
- cls: "bi-trigger-icon-button date-change-h-font",
- width: BI.toPix(o.height, border),
- height: BI.toPix(o.height, border),
- ref: function () {
- self.changeIcon = this;
- }
- }
- }, this.combo]
- },
- top: 0,
- left: 0,
- right: 0,
- bottom: 0
- }]
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0
+ }
+ ]
});
this._checkDynamicValue(o.value);
},
diff --git a/src/widget/yearquarter/combo.yearquarter.js b/src/widget/yearquarter/combo.yearquarter.js
index 1403d254f..b7f04c4bd 100644
--- a/src/widget/yearquarter/combo.yearquarter.js
+++ b/src/widget/yearquarter/combo.yearquarter.js
@@ -1,6 +1,6 @@
BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
- _consts:{
+ _consts: {
iconWidth: 24
},
props: {
@@ -83,39 +83,45 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
ref: function () {
self.popup = this;
},
- listeners: [{
- eventName: BI.DynamicYearQuarterPopup.EVENT_CHANGE,
- action: function () {
- self.setValue(self.popup.getValue());
- self.combo.hideView();
- self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
- }
- }, {
- eventName: BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE,
- action: function () {
- self.setValue();
- self.combo.hideView();
- self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
- }
- }, {
- eventName: BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE,
- action: function () {
- var date = BI.getDate();
- self.setValue({ type: BI.DynamicYearMonthCombo.Static, value: { year: date.getFullYear(), quarter: BI.getQuarter(date) } });
- self.combo.hideView();
- self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
- }
- }, {
- eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE,
- action: function () {
- var value = self.popup.getValue();
- if (self._checkValue(value)) {
- self.setValue(value);
+ listeners: [
+ {
+ eventName: BI.DynamicYearQuarterPopup.EVENT_CHANGE,
+ action: function () {
+ self.setValue(self.popup.getValue());
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
+ }
+ }, {
+ eventName: BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE,
+ action: function () {
+ self.setValue();
+ self.comboWrapper.element.removeClass("error");
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
+ }
+ }, {
+ eventName: BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE,
+ action: function () {
+ var date = BI.getDate();
+ self.setValue({
+ type: BI.DynamicYearMonthCombo.Static,
+ value: { year: date.getFullYear(), quarter: BI.getQuarter(date) }
+ });
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
+ }
+ }, {
+ eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE,
+ action: function () {
+ var value = self.popup.getValue();
+ if (self._checkValue(value)) {
+ self.setValue(value);
+ }
+ self.combo.hideView();
+ self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
}
- self.combo.hideView();
- self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
}
- }],
+ ],
behaviors: o.behaviors,
min: o.minDate,
max: o.maxDate
@@ -133,31 +139,35 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.absolute",
element: this,
- items: [{
- el: {
- type: "bi.horizontal_fill",
- columnSize: ["", "fill"],
- cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
- ref: function () {
- self.comboWrapper = this;
+ items: [
+ {
+ el: {
+ type: "bi.horizontal_fill",
+ columnSize: ["", "fill"],
+ cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
+ ref: function () {
+ self.comboWrapper = this;
+ },
+ items: [
+ {
+ el: {
+ type: "bi.icon_button",
+ cls: "bi-trigger-icon-button date-change-h-font",
+ width: this._consts.iconWidth,
+ height: BI.toPix(o.height, border),
+ ref: function () {
+ self.changeIcon = this;
+ }
+ }
+ }, this.combo
+ ]
},
- items: [{
- el: {
- type: "bi.icon_button",
- cls: "bi-trigger-icon-button date-change-h-font",
- width: this._consts.iconWidth,
- height: BI.toPix(o.height, border),
- ref: function () {
- self.changeIcon = this;
- }
- }
- }, this.combo]
- },
- top: 0,
- left: 0,
- right: 0,
- bottom: 0
- }]
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0
+ }
+ ]
});
this._checkDynamicValue(o.value);
},
diff --git a/typescript/core/base.ts b/typescript/core/base.ts
index 79dc317af..5cc0a010c 100644
--- a/typescript/core/base.ts
+++ b/typescript/core/base.ts
@@ -177,7 +177,8 @@ export interface _base {
functions: (object: object) => string[];
- extend: (object: object, ...sources: any[]) => object;
+ extend(object: T): T;
+ extend(object: T, ...sources: U): T & UnionToIntersection>;
defaults: (object: object, ...sources: any[]) => object;
@@ -399,3 +400,11 @@ type merge = {
deepExtend(object: any, ...otherArgs: any[]): any;
}
+
+type UnionToIntersection = (
+ Union extends unknown
+ ? (x: Union) => void
+ : never
+) extends ((x: infer Intersection) => void)
+ ? Intersection
+ : never;