From 0b5c115a9d2f8ffdbe84d4738cc9aca3419895bb Mon Sep 17 00:00:00 2001 From: Kira Date: Tue, 13 Jul 2021 17:48:00 +0800 Subject: [PATCH] =?UTF-8?q?JSY-6678=20feat:=20=E8=A1=A5=E5=85=85=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 64 ++++++++++--------- typescript/case/button/item.multiselect.ts | 15 ++++- .../case/toolbar/toolbar.multiselect.ts | 12 +++- .../widget/multiselect/multiselect.combo.ts | 8 +++ 4 files changed, 65 insertions(+), 34 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 339e02af0b..0dc2550de5 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -12,12 +12,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { valueFormatter: BI.emptyFn, itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: 24, - allowEdit: true + allowEdit: true, }); }, _init: function () { - var self = this, o = this.options; + var self = this; var o = this.options; BI.MultiSelectCombo.superclass._init.apply(this, arguments); var assertShowValue = function () { if (BI.isKey(self._startValue)) { @@ -52,13 +52,13 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { left: 0, top: 0, right: 0, - bottom: 25 - } + bottom: 25, + }, }, valueFormatter: o.valueFormatter, itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemHeight: o.itemHeight, - value: this.storeValue + value: this.storeValue, }); this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () { @@ -143,22 +143,22 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { assertShowValue(); }); self.fireEvent(BI.MultiSelectCombo.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(); - } + }, }], itemsCreator: o.itemsCreator, - itemsHeight: o.itemsHeight, + itemHeight: o.itemHeight, valueFormatter: o.valueFormatter, onLoaded: function () { BI.nextTick(function () { @@ -167,12 +167,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.numberCounter.adjustView(); self.trigger.getSearcher().adjustView(); }); - } + }, }, value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; - } + }, }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { @@ -200,7 +200,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { type: "bi.trigger_icon_button", width: o.height, height: o.height, - cls: "multi-select-trigger-icon-button" + cls: "multi-select-trigger-icon-button", }); triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { self.numberCounter.hideView(); @@ -218,12 +218,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { left: 0, top: 0, right: 0, - bottom: 25 - } + bottom: 25, + }, }, valueFormatter: o.valueFormatter, itemsCreator: BI.bind(this._itemsCreator4Trigger, this), - value: this.storeValue + value: this.storeValue, }); this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { if (!self.combo.isViewVisible()) { @@ -260,26 +260,26 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { left: 0, right: 0, top: 0, - bottom: 0 + bottom: 0, }, { el: triggerBtn, right: 0, top: 0, - bottom: 0 + bottom: 0, }, { el: { type: "bi.vertical_adapt", - items: [this.numberCounter] + items: [this.numberCounter], }, right: o.height, top: 0, - height: o.height - }] + height: o.height, + }], }); }, _itemsCreator4Trigger: function (op, callback) { - var self = this, o = this.options; + var self = this; var o = this.options; o.itemsCreator(op, function (res) { if (op.times === 1 && BI.isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 @@ -310,12 +310,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _joinKeywords: function (keywords, callback) { - var self = this, o = this.options; + var self = this; var o = this.options; this._assertValue(this.storeValue); this.requesting = true; o.itemsCreator({ type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, - keywords: keywords + keywords: keywords, }, function (ob) { var values = BI.map(ob.items, "value"); digest(values); @@ -333,12 +333,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _joinAll: function (res, callback) { - var self = this, o = this.options; + var self = this; var o = this.options; this._assertValue(res); this.requesting = true; o.itemsCreator({ type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()] + keywords: [this.trigger.getKey()], }, function (ob) { var items = BI.map(ob.items, "value"); if (self.storeValue.type === res.type) { @@ -353,7 +353,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); change && (self.storeValue.value = BI.values(map)); self._adjust(callback); - return; + +return; } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); @@ -374,7 +375,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _adjust: function (callback) { - var self = this, o = this.options; + var self = this; var o = this.options; adjust(); callback(); @@ -388,7 +389,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _join: function (res, callback) { - var self = this, o = this.options; + var self = this; var o = this.options; this._assertValue(res); this._assertValue(this.storeValue); if (this.storeValue.type === res.type) { @@ -410,7 +411,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); change && (this.storeValue.value = BI.values(map)); self._adjust(callback); - return; + +return; } this._joinAll(res, callback); }, @@ -446,12 +448,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { populate: function () { this._populate.apply(this, arguments); this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); - } + }, }); BI.extend(BI.MultiSelectCombo, { REQ_GET_DATA_LENGTH: 1, - REQ_GET_ALL_DATA: -1 + REQ_GET_ALL_DATA: -1, }); BI.MultiSelectCombo.EVENT_BLUR = "EVENT_BLUR"; diff --git a/typescript/case/button/item.multiselect.ts b/typescript/case/button/item.multiselect.ts index 2f5eb95ef0..26bddb2eac 100644 --- a/typescript/case/button/item.multiselect.ts +++ b/typescript/case/button/item.multiselect.ts @@ -4,12 +4,23 @@ export declare class MultiSelectItem extends BasicButton { static xtype: string; static EVENT_CHANGE: string; - + + props: { + login: { + dynamic: boolean; + } + text: string; + iconWrapperWidth: number; + textLgap: number; + textRgap: number; + textHgap: number; + } + doClick(...args: any[]): void; doRedMark(...args: any[]): void; unRedMark(...args: any[]): void; - setSelected(v: boolean): void; + setSelected(v: boolean): void; } diff --git a/typescript/case/toolbar/toolbar.multiselect.ts b/typescript/case/toolbar/toolbar.multiselect.ts index a0e5d1d681..5908f671b4 100644 --- a/typescript/case/toolbar/toolbar.multiselect.ts +++ b/typescript/case/toolbar/toolbar.multiselect.ts @@ -2,9 +2,19 @@ import { BasicButton } from "../../base/single/button/button.basic"; export declare class MultiSelectBar extends BasicButton { static xtype: string; - + static EVENT_CHANGE: string; + props: { + text: string; + isAllCheckedBySelectedValue: (values: any[]) => boolean; + isHalfCheckedBySelectedValue: (values: any[]) => boolean; + halfSelected: boolean; + iconWrapperWidth: number; + iconWidth: number; + iconHeight: number; + } & BasicButton['props']; + setHalfSelected(v: boolean): void; isHalfSelected(): boolean; diff --git a/typescript/widget/multiselect/multiselect.combo.ts b/typescript/widget/multiselect/multiselect.combo.ts index e1d444b87a..9ebe8b9fbf 100644 --- a/typescript/widget/multiselect/multiselect.combo.ts +++ b/typescript/widget/multiselect/multiselect.combo.ts @@ -11,6 +11,14 @@ export declare class MultiSelectCombo extends Single { static REQ_GET_DATA_LENGTH: 1; static REQ_GET_ALL_DATA: -1; + props: { + itemsCreator: (options: any, callback: () => any[]) => void; + itemHeight: number; + text: string; + valueFormatter: (v: string) => string; + allowEdit: boolean; + } & Single['props'] + _itemsCreator4Trigger(op: any, callback: Function): void; _stopEditing(): void;