Browse Source

BI-155273 fix: 新增一些方法

master
Jimmy.Chai 3 months ago
parent
commit
1667f4027c
  1. 28
      packages/fineui/src/case/combo/iconcombo/combo.icon.js
  2. 26
      packages/fineui/src/widget/numberinterval/numberinterval.js
  3. 4
      packages/fineui/typescript/case/combo/iconcombo/combo.icon.ts
  4. 1
      packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts
  5. 7
      packages/fineui/typescript/widget/numberinterval/numberinterval.ts

28
packages/fineui/src/case/combo/iconcombo/combo.icon.js

@ -8,6 +8,7 @@ export class IconCombo extends Widget {
static xtype = "bi.icon_combo"; static xtype = "bi.icon_combo";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
_defaultConfig() { _defaultConfig() {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -55,18 +56,18 @@ export class IconCombo extends Widget {
value: o.value, value: o.value,
isShowDown: o.isShowDown, isShowDown: o.isShowDown,
}); });
this.popup = createWidget(o.popup, { this.popupEl = createWidget(o.popup, {
type: IconComboPopup.xtype, type: IconComboPopup.xtype,
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items, items: o.items,
value: o.value, value: o.value,
}); });
this.popup.on(IconComboPopup.EVENT_CHANGE, () => { this.popupEl.on(IconComboPopup.EVENT_CHANGE, () => {
this.setValue(this.popup.getValue()); this.setValue(this.popupEl.getValue());
this.iconCombo.hideView(); this.iconCombo.hideView();
this.fireEvent(IconCombo.EVENT_CHANGE); this.fireEvent(IconCombo.EVENT_CHANGE);
}); });
this.popup.on(Controller.EVENT_CHANGE, (...args) => { this.popupEl.on(Controller.EVENT_CHANGE, (...args) => {
this.fireEvent(Controller.EVENT_CHANGE, ...args); this.fireEvent(Controller.EVENT_CHANGE, ...args);
}); });
this.iconCombo = createWidget({ this.iconCombo = createWidget({
@ -82,11 +83,20 @@ export class IconCombo extends Widget {
el: this.trigger, el: this.trigger,
hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen, hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen,
popup: { popup: {
el: this.popup, el: this.popupEl,
maxWidth: o.maxWidth, maxWidth: o.maxWidth,
maxHeight: o.maxHeight, maxHeight: o.maxHeight,
minWidth: o.minWidth, minWidth: o.minWidth,
ref: (ref) => {
this.popup = ref;
}, },
},
listeners: [{
eventName: Combo.EVENT_BEFORE_POPUPVIEW,
action: () => {
this.fireEvent(IconCombo.EVENT_BEFORE_POPUPVIEW);
},
}],
}); });
} }
@ -100,15 +110,19 @@ export class IconCombo extends Widget {
setValue(v) { setValue(v) {
this.trigger.setValue(v); this.trigger.setValue(v);
this.popup.setValue(v); this.popupEl.setValue(v);
} }
getValue() { getValue() {
const value = this.popup.getValue(); const value = this.popupEl.getValue();
return isNull(value) ? [] : isArray(value) ? value : [value]; return isNull(value) ? [] : isArray(value) ? value : [value];
} }
getPopup() {
return this.popup;
}
populate(items) { populate(items) {
this.options.items = items; this.options.items = items;
this.iconCombo.populate(items); this.iconCombo.populate(items);

26
packages/fineui/src/widget/numberinterval/numberinterval.js

@ -41,6 +41,8 @@ export class NumberInterval extends Single {
static EVENT_CONFIRM = "EVENT_CONFIRM"; static EVENT_CONFIRM = "EVENT_CONFIRM";
static EVENT_VALID = "EVENT_VALID"; static EVENT_VALID = "EVENT_VALID";
static EVENT_ERROR = "EVENT_ERROR"; static EVENT_ERROR = "EVENT_ERROR";
static EVENT_BEFORE_LEFT_POPUPVIEW = "EVENT_BEFORE_LEFT_POPUPVIEW";
static EVENT_BEFORE_RIGHT_POPUPVIEW = "EVENT_BEFORE_RIGHT_POPUPVIEW";
_defaultConfig() { _defaultConfig() {
const conf = super._defaultConfig(...arguments); const conf = super._defaultConfig(...arguments);
@ -151,6 +153,8 @@ export class NumberInterval extends Single {
}); });
this.smallCombo = createWidget({ this.smallCombo = createWidget({
type: IconCombo.xtype, type: IconCombo.xtype,
container: o.container,
popup: o.popup,
cls: `number-interval-small-combo${ cls: `number-interval-small-combo${
o.simple ? "" : " bi-border-top bi-border-bottom bi-border-right bi-border-corner-right-radius" o.simple ? "" : " bi-border-top bi-border-bottom bi-border-right bi-border-corner-right-radius"
}`, }`,
@ -168,6 +172,12 @@ export class NumberInterval extends Single {
iconCls: "less-equal-font", iconCls: "less-equal-font",
}, },
], ],
listeners: [{
eventName: IconCombo.EVENT_BEFORE_POPUPVIEW,
action: () => {
this.fireEvent(NumberInterval.EVENT_BEFORE_LEFT_POPUPVIEW);
},
}],
}); });
if (o.closeMin === true) { if (o.closeMin === true) {
this.smallCombo.setValue(1); this.smallCombo.setValue(1);
@ -176,6 +186,8 @@ export class NumberInterval extends Single {
} }
this.bigCombo = createWidget({ this.bigCombo = createWidget({
type: IconCombo.xtype, type: IconCombo.xtype,
container: o.container,
popup: o.popup,
cls: `number-interval-big-combo${ cls: `number-interval-big-combo${
o.simple ? "" : " bi-border-top bi-border-bottom bi-border-left bi-border-corner-left-radius" o.simple ? "" : " bi-border-top bi-border-bottom bi-border-left bi-border-corner-left-radius"
}`, }`,
@ -193,6 +205,12 @@ export class NumberInterval extends Single {
iconCls: "less-equal-font", iconCls: "less-equal-font",
}, },
], ],
listeners: [{
eventName: IconCombo.EVENT_BEFORE_POPUPVIEW,
action: () => {
this.fireEvent(NumberInterval.EVENT_BEFORE_RIGHT_POPUPVIEW);
},
}],
}); });
if (o.closeMax === true) { if (o.closeMax === true) {
this.bigCombo.setValue(1); this.bigCombo.setValue(1);
@ -621,6 +639,14 @@ export class NumberInterval extends Single {
this.bigEditor.focus(); this.bigEditor.focus();
} }
getLeftCombo() {
return this.smallCombo;
}
getRightCombo() {
return this.bigCombo;
}
destroyed() { destroyed() {
const c = this.constants; const c = this.constants;
Bubbles.remove(c.typeError); Bubbles.remove(c.typeError);

4
packages/fineui/typescript/case/combo/iconcombo/combo.icon.ts

@ -1,13 +1,17 @@
import { PopupView } from "../../../base/layer/layer.popup";
import { Widget } from '../../../core/widget'; import { Widget } from '../../../core/widget';
export declare class IconCombo extends Widget { export declare class IconCombo extends Widget {
static xtype: string; static xtype: string;
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
showView(): void; showView(): void;
hideView(): void; hideView(): void;
populate(items: any[]): void; populate(items: any[]): void;
getPopup(): PopupView;
} }

1
packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts

@ -6,6 +6,7 @@ export declare class MultiSelectInsertCombo extends Single {
static xtype: string; static xtype: string;
static EVENT_FOCUS: string; static EVENT_FOCUS: string;
static EVENT_BLUR: string; static EVENT_BLUR: string;
static EVENT_START: string;
static EVENT_STOP: string; static EVENT_STOP: string;
static EVENT_SEARCHING: string; static EVENT_SEARCHING: string;
static EVENT_CLICK_ITEM: string; static EVENT_CLICK_ITEM: string;

7
packages/fineui/typescript/widget/numberinterval/numberinterval.ts

@ -1,3 +1,4 @@
import { Combo } from '../../base/combination/combo';
import { Single } from '../../base/single/single'; import { Single } from '../../base/single/single';
export declare class NumberInterval extends Single { export declare class NumberInterval extends Single {
@ -6,6 +7,8 @@ export declare class NumberInterval extends Single {
static EVENT_CONFIRM: string; static EVENT_CONFIRM: string;
static EVENT_VALID: string; static EVENT_VALID: string;
static EVENT_ERROR: string; static EVENT_ERROR: string;
static EVENT_BEFORE_LEFT_POPUPVIEW: string;
static EVENT_BEFORE_RIGHT_POPUPVIEW: string;
props: { props: {
watermark?: string; watermark?: string;
@ -40,4 +43,8 @@ export declare class NumberInterval extends Single {
focusMinEditor(): void; focusMinEditor(): void;
focusMaxEditor(): void; focusMaxEditor(): void;
getLeftCombo(): Combo;
getRightCombo(): Combo;
} }

Loading…
Cancel
Save