Browse Source

Merge pull request #220865 in DEC/fineui from feature/x to bugfix/11.0

* commit '45584a539091330529b59435b952a8d983fc9059': (34 commits)
  auto upgrade version to 2.0.20230202142959
  JSY-26079 update: 去除 multi_select_insert_no_bar_list 的全选配置
  Revert "JSY-26063 fix: 前端搜索支持配置大小写敏感"
  JSY-26079 feat: multi_select_insert_no_bar_list 搜索面板全选按钮支持可选
  JSY-26063 fix: 前端搜索支持配置大小写敏感
  auto upgrade version to 2.0.20230130114621
  auto upgrade version to 2.0.20230130112753
  无jira 去掉grunt
  auto upgrade version to 2.0.20230113121657
  auto upgrade version to 2.0.20230112210841
  JSY-25995 feat: TextValueCombo 支持 EVENT_BEFORE_POPUPVIEW 事件监听
  Update demo/app.js
  auto upgrade version to 2.0.20230109200447
  无jira refact:删除没有用的 less
  auto upgrade version to 2.0.20230109102030
  auto upgrade version to 2.0.20230107203454
  JSY-25808 fix: fineui-复选下拉框bug
  auto upgrade version to 2.0.20230106121528
  auto upgrade version to 2.0.20230106114746
  KERNEL-14024 feat: bi.number_editor 功能优化, 支持键盘上下键微调数值
  ...
research/test
superman 2 years ago
parent
commit
863a93dd3f
  1. 3
      demo/app.js
  2. 3
      package.json
  3. 2
      src/base/single/editor/editor.js
  4. 2
      src/case/calendar/calendar.js
  5. 4
      src/case/combo/textvaluecombo/combo.textvalue.js
  6. 6
      src/case/combo/textvaluecombo/popup.textvalue.js
  7. 4
      src/case/editor/editor.sign.js
  8. 11053
      src/core/platform/web/jquery/_jquery.js
  9. 5
      src/less/case/calendar/calendar.less
  10. 89
      src/widget/multiselect/multiselect.combo.nobar.js
  11. 90
      src/widget/multiselect/multiselect.insert.combo.js
  12. 87
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  13. 30
      src/widget/multiselect/multiselect.insert.trigger.js
  14. 35
      src/widget/multiselect/multiselect.trigger.js
  15. 6
      src/widget/multiselect/search/multiselect.search.insert.pane.js
  16. 96
      src/widget/multiselect/search/multiselect.search.loader.js
  17. 23
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  18. 23
      src/widget/multiselect/trigger/searcher.multiselect.js
  19. 3
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  20. 51
      src/widget/numbereditor/number.editor.js
  21. 1
      typescript/case/combo/combo.textvalue.ts
  22. 11
      typescript/core/base.ts

3
demo/app.js

@ -1,6 +1,9 @@
Demo = { Demo = {
version: 1.0 version: 1.0
}; };
BI.EVENT_BLUR = false
BI.$(function () { BI.$(function () {
var ref; var ref;

3
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20221230161545", "version": "2.0.20230202142959",
"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",
@ -88,6 +88,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/yargs": "17.0.13", "@types/yargs": "17.0.13",
"jquery": "3.6.3",
"yargs": "17.6.2" "yargs": "17.6.2"
} }
} }

2
src/base/single/editor/editor.js

@ -109,6 +109,7 @@ BI.Editor = BI.inherit(BI.Single, {
if (e.keyCode !== BI.KeyCode.TAB && self.watermark) { if (e.keyCode !== BI.KeyCode.TAB && self.watermark) {
self.watermark.invisible(); self.watermark.invisible();
} }
self.fireEvent(BI.Editor.EVENT_QUICK_DOWN, arguments);
}); });
this.editor.on(BI.Input.EVENT_VALID, function () { 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_BLUR = "EVENT_BLUR";
BI.Editor.EVENT_CLICK = "EVENT_CLICK"; BI.Editor.EVENT_CLICK = "EVENT_CLICK";
BI.Editor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; 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_SPACE = "EVENT_SPACE";
BI.Editor.EVENT_BACKSPACE = "EVENT_BACKSPACE"; BI.Editor.EVENT_BACKSPACE = "EVENT_BACKSPACE";

2
src/case/calendar/calendar.js

@ -170,7 +170,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
forceSelected: true, forceSelected: true,
value: year + "-" + month + "-" + td.text, value: year + "-" + month + "-" + td.text,
disabled: td.disabled, disabled: td.disabled,
cls: td.lastMonth || td.nextMonth ? "not-current-month-day" : "", cls: td.lastMonth || td.nextMonth ? "bi-tips" : "",
lgap: 2, lgap: 2,
rgap: 2, rgap: 2,
tgap: 4, tgap: 4,

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

@ -130,6 +130,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: () => { action: () => {
changeTag = false; changeTag = false;
this.fireEvent(BI.TextValueCombo.EVENT_BEFORE_POPUPVIEW);
} }
}, { }, {
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
@ -144,7 +145,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: popup, el: popup,
value: o.value, value: o.value,
maxHeight: 240, maxHeight: 240,
minHeight: 25 minHeight: (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_MULTI && o.allowSelectAll) ? 55 : 25
} }
}; };
}, },
@ -209,5 +210,6 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
this.combo.populate(items); this.combo.populate(items);
} }
}); });
BI.TextValueCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.TextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_combo", BI.TextValueCombo); BI.shortcut("bi.text_value_combo", BI.TextValueCombo);

6
src/case/combo/textvaluecombo/popup.textvalue.js

@ -131,8 +131,10 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
}; };
}, },
mounted: function () { beforeMount: function () {
this.check(); if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
this.check();
}
}, },
_formatItems: function (items) { _formatItems: function (items) {

4
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) { this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.SignEditor.EVENT_KEY_DOWN, arguments); 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 () { this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.SignEditor.EVENT_VALID, arguments); 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_BLUR = "EVENT_BLUR";
BI.SignEditor.EVENT_CLICK = "EVENT_CLICK"; BI.SignEditor.EVENT_CLICK = "EVENT_CLICK";
BI.SignEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; 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_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.SignEditor.EVENT_START = "EVENT_START"; BI.SignEditor.EVENT_START = "EVENT_START";

11053
src/core/platform/web/jquery/_jquery.js vendored

File diff suppressed because it is too large Load Diff

5
src/less/case/calendar/calendar.less

@ -1,5 +0,0 @@
@import "../../index.less";
.bi-calendar-date-item.not-current-month-day {
color: @color-bi-text-disabled-button !important;
}

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

@ -54,6 +54,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: { value: {
type: BI.Selection.Multi, type: BI.Selection.Multi,
@ -134,29 +135,31 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this); self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this); self.numberCounter.setAdapter(this);
}, },
listeners: [{ listeners: [
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, {
action: function () { eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
self._dataChange = true; action: function () {
self.storeValue = this.getValue(); self._dataChange = true;
self._adjust(function () { self.storeValue = this.getValue();
assertShowValue(); self._adjust(function () {
}); assertShowValue();
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM); });
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, itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
@ -262,26 +265,28 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: this.combo, {
left: 0, el: this.combo,
right: 0, left: 0,
top: 0, right: 0,
bottom: 0 top: 0,
}, { bottom: 0
el: triggerBtn, }, {
right: 0, el: triggerBtn,
top: 0, right: 0,
bottom: 0 top: 0,
}, { bottom: 0
el: { }, {
type: "bi.vertical_adapt", el: {
items: [this.numberCounter] type: "bi.vertical_adapt",
}, items: [this.numberCounter]
right: o.height, },
top: 0, right: o.height,
height: o.height top: 0,
}] height: o.height
}
]
}); });
}, },

90
src/widget/multiselect/multiselect.insert.combo.js

@ -55,6 +55,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: this.storeValue, value: this.storeValue,
}); });
@ -138,31 +139,34 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this); self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this); self.numberCounter.setAdapter(this);
}, },
listeners: [{ listeners: [
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, {
action: function () { eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
self._dataChange = true; action: function () {
self.storeValue = this.getValue(); self._dataChange = true;
self._adjust(function () { self.storeValue = this.getValue();
assertShowValue(); self._adjust(function () {
}); assertShowValue();
self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM); });
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, itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
onLoaded: function () { onLoaded: function () {
BI.nextTick(function () { BI.nextTick(function () {
@ -260,26 +264,28 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: this.combo, {
left: 0, el: this.combo,
right: 0, left: 0,
top: 0, right: 0,
bottom: 0 top: 0,
}, { bottom: 0
el: triggerBtn, }, {
right: 0, el: triggerBtn,
top: 0, right: 0,
bottom: 0 top: 0,
}, { bottom: 0
el: { }, {
type: "bi.vertical_adapt", el: {
items: [this.numberCounter] type: "bi.vertical_adapt",
}, items: [this.numberCounter]
right: o.height, },
top: 0, right: o.height,
height: o.height, top: 0,
}] height: o.height,
}
]
}); });
}, },

87
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -54,6 +54,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: { value: {
type: BI.Selection.Multi, type: BI.Selection.Multi,
@ -129,28 +130,30 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this); self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this); self.numberCounter.setAdapter(this);
}, },
listeners: [{ listeners: [
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, {
action: function () { eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
self._dataChange = true; action: function () {
self.storeValue = this.getValue(); self._dataChange = true;
self._adjust(function () { self.storeValue = this.getValue();
assertShowValue(); 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, itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
@ -256,26 +259,28 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: this.combo, {
left: 0, el: this.combo,
right: 0, left: 0,
top: 0, right: 0,
bottom: 0 top: 0,
}, { bottom: 0
el: triggerBtn, }, {
right: 0, el: triggerBtn,
top: 0, right: 0,
bottom: 0 top: 0,
}, { bottom: 0
el: { }, {
type: "bi.vertical_adapt", el: {
items: [this.numberCounter] type: "bi.vertical_adapt",
}, items: [this.numberCounter]
right: o.height, },
top: 0, right: o.height,
height: o.height top: 0,
}] height: o.height
}
]
}); });
}, },

30
src/widget/multiselect/multiselect.insert.trigger.js

@ -40,6 +40,7 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
defaultText: o.defaultText, defaultText: o.defaultText,
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
watermark: o.watermark, watermark: o.watermark,
popup: {}, popup: {},
@ -86,24 +87,27 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
}, { }, {
el: BI.createWidget(), el: BI.createWidget(),
width: 24 width: 24
}] }
]
}); });
!o.allowEdit && BI.createWidget({ !o.allowEdit && BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: { {
type: "bi.text", el: {
title: function () { type: "bi.text",
return self.searcher.getState(); title: function () {
} return self.searcher.getState();
}, }
left: 0, },
right: 24, left: 0,
top: 0, right: 24,
bottom: 0 top: 0,
}] bottom: 0
}
]
}); });
}, },

35
src/widget/multiselect/multiselect.trigger.js

@ -41,6 +41,7 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
watermark: o.watermark, watermark: o.watermark,
popup: {}, popup: {},
adapter: o.adapter, adapter: o.adapter,
@ -88,23 +89,25 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
!o.allowEdit && BI.createWidget({ !o.allowEdit && BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: { {
type: "bi.text", el: {
title: function () { type: "bi.text",
/** 修正REPORT-73699引入,需要考虑到传递过来的值是方法的情况 */ title: function () {
var state = self.searcher.getState(); /** 修正REPORT-73699引入,需要考虑到传递过来的值是方法的情况 */
if (BI.isFunction(state)) { var state = self.searcher.getState();
return state(); if (BI.isFunction(state)) {
return state();
}
return state;
} }
return state; },
} left: 0,
}, right: 24,
left: 0, top: 0,
right: 24, bottom: 0
top: 0, }
bottom: 0 ]
}]
}); });
}, },

6
src/widget/multiselect/search/multiselect.search.insert.pane.js

@ -19,7 +19,8 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
keywordGetter: BI.emptyFn, keywordGetter: BI.emptyFn,
itemHeight: 24 allowSelectAll: true,
itemHeight: 24,
}); });
}, },
@ -47,7 +48,8 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
}]); }]);
}, },
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: o.value value: o.value,
allowSelectAll: o.allowSelectAll,
}); });
this.loader.on(BI.Controller.EVENT_CHANGE, function () { this.loader.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

96
src/widget/multiselect/search/multiselect.search.loader.js

@ -13,6 +13,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
keywordGetter: BI.emptyFn, keywordGetter: BI.emptyFn,
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
itemFormatter: BI.emptyFn, itemFormatter: BI.emptyFn,
allowSelectAll: true,
itemHeight: 24 itemHeight: 24
}); });
}, },
@ -23,7 +24,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
var self = this, opts = this.options; var self = this, opts = this.options;
var hasNext = false; var hasNext = false;
this.storeValue = BI.deepClone(opts.value); this.storeValue = BI.deepClone(opts.value);
this.button_group = BI.createWidget({ this.button_group = BI.createWidget(opts.allowSelectAll ? {
type: "bi.select_list", type: "bi.select_list",
toolbar: { toolbar: {
type: "bi.multi_select_bar", type: "bi.multi_select_bar",
@ -51,9 +52,11 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
return true; return true;
} }
}, },
layouts: [{ layouts: [
type: "bi.vertical" {
}] type: "bi.vertical"
}
]
} }
} }
}, },
@ -81,31 +84,90 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
hasNext: function () { hasNext: function () {
return hasNext; return hasNext;
} }
} : {
type: "bi.list_pane",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
element: this,
el: {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
behaviors: {
redmark: function () {
return true;
}
},
layouts: [
{
type: "bi.vertical"
}
]
},
itemsCreator: function (op, callback) {
self.storeValue && (op = BI.extend(op || {}, {
selectedValues: self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
var keyword = ob.keyword = opts.keywordGetter();
hasNext = ob.hasNext;
var firstItems = [];
if (op.times === 1 && self.storeValue) {
var json = self._filterValues(self.storeValue);
firstItems = self._createItems(json);
}
var context = {
tipText: ob.tipText,
};
callback(firstItems.concat(self._createItems(ob.items)), keyword, context);
if (op.times === 1 && self.storeValue) {
self.setValue(self.storeValue);
}
});
},
value: opts.value,
height: "fill",
}); });
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { if (opts.allowSelectAll) {
self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); this.button_group.on(BI.SelectList.EVENT_CHANGE, function () {
}); self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments);
});
} else {
this.button_group.on(BI.ListPane.EVENT_CHANGE, function (val) {
self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, val);
});
}
}, },
_createItems: function (items) { _createItems: function (items) {
var allSelected = this.isAllSelected(); var allSelected = this.isAllSelected();
return BI.createItems(items, { var itemFormatter = this.options.itemFormatter;
type: "bi.multi_select_item",
logic: { return BI.map(items, (index, item) => {
dynamic: false return {
}, type: "bi.multi_select_item",
height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, logic: {
selected: allSelected, dynamic: false
cls: "bi-list-item-active", },
iconWrapperWidth: 36 height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
selected: allSelected,
cls: "bi-list-item-active",
iconWrapperWidth: 36,
...item,
...itemFormatter(item)
};
}); });
}, },
isAllSelected: function () { isAllSelected: function () {
return this.button_group.isAllSelected(); var o = this.options;
return o.allowSelectAll ? this.button_group.isAllSelected() : false;
}, },
_filterValues: function (src) { _filterValues: function (src) {

23
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -29,17 +29,19 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
height: o.height, height: o.height,
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
listeners: [{ listeners: [
eventName: BI.MultiSelectEditor.EVENT_FOCUS, {
action: function () { eventName: BI.MultiSelectEditor.EVENT_FOCUS,
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_FOCUS); action: function () {
} self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_FOCUS);
}, { }
eventName: BI.MultiSelectEditor.EVENT_BLUR, }, {
action: function () { eventName: BI.MultiSelectEditor.EVENT_BLUR,
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_BLUR); action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_BLUR);
}
} }
}] ]
}); });
this.searcher = BI.createWidget({ this.searcher = BI.createWidget({
@ -56,6 +58,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
popup: BI.extend({ popup: BI.extend({
type: "bi.multi_select_search_insert_pane", type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
keywordGetter: function () { keywordGetter: function () {
return self.editor.getKeyword(); return self.editor.getKeyword();
}, },

23
src/widget/multiselect/trigger/searcher.multiselect.js

@ -29,17 +29,19 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
watermark: o.watermark, watermark: o.watermark,
listeners: [{ listeners: [
eventName: BI.MultiSelectEditor.EVENT_FOCUS, {
action: function () { eventName: BI.MultiSelectEditor.EVENT_FOCUS,
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS); action: function () {
} self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
}, { }
eventName: BI.MultiSelectEditor.EVENT_BLUR, }, {
action: function () { eventName: BI.MultiSelectEditor.EVENT_BLUR,
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR); action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
}
} }
}] ]
}); });
this.searcher = BI.createWidget({ this.searcher = BI.createWidget({
@ -55,6 +57,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
popup: BI.extend({ popup: BI.extend({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_pane",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
keywordGetter: function () { keywordGetter: function () {
return self.editor.getValue(); return self.editor.getValue();
}, },

3
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -61,6 +61,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
} }
}, },
allowSelectAll: false,
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -244,7 +245,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
// 和复选下拉框同步,allData做缓存是会爆炸的 // 和复选下拉框同步,allData做缓存是会爆炸的
digest(); digest();
function digest (items) { function digest(items) {
BI.each(keywords, function (i, val) { BI.each(keywords, function (i, val) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val); self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}); });

51
src/widget/numbereditor/number.editor.js

@ -39,9 +39,33 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) { if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) {
return false; return false;
} }
return o.validationChecker(parsedValue); 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 () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
// 大多数时候valueFormatter往往需要配合valueParser一起使用 // 大多数时候valueFormatter往往需要配合valueParser一起使用
@ -68,7 +92,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
forceNotSelected: true, forceNotSelected: true,
trigger: "lclick,", trigger: "lclick,",
debounce: false, 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 () { this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(o.step); self._finetuning(o.step);
@ -80,7 +104,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
trigger: "lclick,", trigger: "lclick,",
forceNotSelected: true, forceNotSelected: true,
debounce: false, 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 () { this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(-o.step); self._finetuning(-o.step);
@ -101,17 +125,17 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
{ {
column: 0, column: 0,
row: 0, row: 0,
el: this.topBtn el: this.topBtn,
}, { }, {
column: 0, column: 0,
row: 1, 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) { _checkValueInRange: function (v) {
var o = this.options; var o = this.options;
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max); 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) { _finetuning: function (add) {
var v = BI.parseFloat(this.getValue()); const { max, min } = this.options;
this.setValue(BI.add(v, add)); let v = BI.parseFloat(this.getValue());
v = BI.add(v, add);
v = BI.clamp(v, min, max);
this.setValue(v);
}, },
setUpEnable: function (v) { setUpEnable: function (v) {
@ -165,7 +193,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
var o = this.options; var o = this.options;
o.value = v; o.value = v;
this.editor.setValue(o.valueFormatter(v)); this.editor.setValue(o.valueFormatter(v));
} this._checkAdjustDisabled(o.value);
},
}); });
BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM";

1
typescript/case/combo/combo.textvalue.ts

@ -4,6 +4,7 @@ export declare class TextValueCombo extends Widget {
static xtype: string; static xtype: string;
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
clear(): void; clear(): void;
setText(text: string): void; setText(text: string): void;

11
typescript/core/base.ts

@ -177,7 +177,8 @@ export interface _base {
functions: (object: object) => string[]; functions: (object: object) => string[];
extend: (object: object, ...sources: any[]) => object; extend<T extends object>(object: T): T;
extend<T extends object, U extends unknown[]>(object: T, ...sources: U): T & UnionToIntersection<NonNullable<U[number]>>;
defaults: (object: object, ...sources: any[]) => object; defaults: (object: object, ...sources: any[]) => object;
@ -399,3 +400,11 @@ type merge = {
deepExtend(object: any, ...otherArgs: any[]): any; deepExtend(object: any, ...otherArgs: any[]): any;
} }
type UnionToIntersection<Union> = (
Union extends unknown
? (x: Union) => void
: never
) extends ((x: infer Intersection) => void)
? Intersection
: never;

Loading…
Cancel
Save