Browse Source

Pull request #2021: JSY-6678 feat: 补充声明

Merge in VISUAL/fineui from ~KIRA/fineui:master to master

* commit '86748d3e5ad42ed6680404630d80875547207eac':
  JSY-6678 feat: 补充声明
  JSY-6678 feat: 补充声明
es6
Kira 3 years ago
parent
commit
e0545e927f
  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,
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";

15
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;
} & BasicButton['props'];
doClick(...args: any[]): void;
doRedMark(...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 {
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;

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_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;

Loading…
Cancel
Save