Browse Source

JSY-6678 feat: 补充声明

es6
Kira 3 years ago
parent
commit
0b5c115a9d
  1. 64
      src/widget/multiselect/multiselect.combo.js
  2. 15
      typescript/case/button/item.multiselect.ts
  3. 12
      typescript/case/toolbar/toolbar.multiselect.ts
  4. 8
      typescript/widget/multiselect/multiselect.combo.ts

64
src/widget/multiselect/multiselect.combo.js

@ -12,12 +12,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: 24, height: 24,
allowEdit: true allowEdit: true,
}); });
}, },
_init: function () { _init: function () {
var self = this, o = this.options; var self = this; var o = this.options;
BI.MultiSelectCombo.superclass._init.apply(this, arguments); BI.MultiSelectCombo.superclass._init.apply(this, arguments);
var assertShowValue = function () { var assertShowValue = function () {
if (BI.isKey(self._startValue)) { if (BI.isKey(self._startValue)) {
@ -52,13 +52,13 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
left: 0, left: 0,
top: 0, top: 0,
right: 0, right: 0,
bottom: 25 bottom: 25,
} },
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: this.storeValue value: this.storeValue,
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
@ -143,22 +143,22 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
}); });
self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM); self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM);
} },
}, { }, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () { action: function () {
self._defaultState(); self._defaultState();
} },
}, { }, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () { action: function () {
self._dataChange = true; self._dataChange = true;
self.setValue(); self.setValue();
self._defaultState(); self._defaultState();
} },
}], }],
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
itemsHeight: o.itemsHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
onLoaded: function () { onLoaded: function () {
BI.nextTick(function () { BI.nextTick(function () {
@ -167,12 +167,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.numberCounter.adjustView(); self.numberCounter.adjustView();
self.trigger.getSearcher().adjustView(); self.trigger.getSearcher().adjustView();
}); });
} },
}, },
value: o.value, value: o.value,
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; 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 () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
@ -200,7 +200,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
type: "bi.trigger_icon_button", type: "bi.trigger_icon_button",
width: o.height, width: o.height,
height: o.height, height: o.height,
cls: "multi-select-trigger-icon-button" cls: "multi-select-trigger-icon-button",
}); });
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView(); self.numberCounter.hideView();
@ -218,12 +218,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
left: 0, left: 0,
top: 0, top: 0,
right: 0, right: 0,
bottom: 25 bottom: 25,
} },
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: this.storeValue value: this.storeValue,
}); });
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
@ -260,26 +260,26 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0,
}, { }, {
el: triggerBtn, el: triggerBtn,
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0,
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
items: [this.numberCounter] items: [this.numberCounter],
}, },
right: o.height, right: o.height,
top: 0, top: 0,
height: o.height height: o.height,
}] }],
}); });
}, },
_itemsCreator4Trigger: function (op, callback) { _itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options; var self = this; var o = this.options;
o.itemsCreator(op, function (res) { o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) { if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉 // 预防trigger内部把当前的storeValue改掉
@ -310,12 +310,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_joinKeywords: function (keywords, callback) { _joinKeywords: function (keywords, callback) {
var self = this, o = this.options; var self = this; var o = this.options;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.requesting = true; this.requesting = true;
o.itemsCreator({ o.itemsCreator({
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, type: BI.MultiSelectCombo.REQ_GET_ALL_DATA,
keywords: keywords keywords: keywords,
}, function (ob) { }, function (ob) {
var values = BI.map(ob.items, "value"); var values = BI.map(ob.items, "value");
digest(values); digest(values);
@ -333,12 +333,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_joinAll: function (res, callback) { _joinAll: function (res, callback) {
var self = this, o = this.options; var self = this; var o = this.options;
this._assertValue(res); this._assertValue(res);
this.requesting = true; this.requesting = true;
o.itemsCreator({ o.itemsCreator({
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, type: BI.MultiSelectCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()] keywords: [this.trigger.getKey()],
}, function (ob) { }, function (ob) {
var items = BI.map(ob.items, "value"); var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) { if (self.storeValue.type === res.type) {
@ -353,7 +353,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}); });
change && (self.storeValue.value = BI.values(map)); change && (self.storeValue.value = BI.values(map));
self._adjust(callback); self._adjust(callback);
return;
return;
} }
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
@ -374,7 +375,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_adjust: function (callback) { _adjust: function (callback) {
var self = this, o = this.options; var self = this; var o = this.options;
adjust(); adjust();
callback(); callback();
@ -388,7 +389,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_join: function (res, callback) { _join: function (res, callback) {
var self = this, o = this.options; var self = this; var o = this.options;
this._assertValue(res); this._assertValue(res);
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) { if (this.storeValue.type === res.type) {
@ -410,7 +411,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}); });
change && (this.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
self._adjust(callback); self._adjust(callback);
return;
return;
} }
this._joinAll(res, callback); this._joinAll(res, callback);
}, },
@ -446,12 +448,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
populate: function () { populate: function () {
this._populate.apply(this, arguments); this._populate.apply(this, arguments);
this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments);
} },
}); });
BI.extend(BI.MultiSelectCombo, { BI.extend(BI.MultiSelectCombo, {
REQ_GET_DATA_LENGTH: 1, REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1 REQ_GET_ALL_DATA: -1,
}); });
BI.MultiSelectCombo.EVENT_BLUR = "EVENT_BLUR"; BI.MultiSelectCombo.EVENT_BLUR = "EVENT_BLUR";

15
typescript/case/button/item.multiselect.ts

@ -4,12 +4,23 @@ export declare class MultiSelectItem extends BasicButton {
static xtype: string; static xtype: string;
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
props: {
login: {
dynamic: boolean;
}
text: string;
iconWrapperWidth: number;
textLgap: number;
textRgap: number;
textHgap: number;
}
doClick(...args: any[]): void; doClick(...args: any[]): void;
doRedMark(...args: any[]): void; doRedMark(...args: any[]): void;
unRedMark(...args: any[]): void; unRedMark(...args: any[]): void;
setSelected(v: boolean): void; setSelected(v: boolean): void;
} }

12
typescript/case/toolbar/toolbar.multiselect.ts

@ -2,9 +2,19 @@ import { BasicButton } from "../../base/single/button/button.basic";
export declare class MultiSelectBar extends BasicButton { export declare class MultiSelectBar extends BasicButton {
static xtype: string; static xtype: string;
static EVENT_CHANGE: 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; setHalfSelected(v: boolean): void;
isHalfSelected(): boolean; isHalfSelected(): boolean;

8
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_DATA_LENGTH: 1;
static REQ_GET_ALL_DATA: -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; _itemsCreator4Trigger(op: any, callback: Function): void;
_stopEditing(): void; _stopEditing(): void;

Loading…
Cancel
Save