From 80db0a5eee7379944cf06aa4c48056c9fb643313 Mon Sep 17 00:00:00 2001 From: "Zhenfei.Li" Date: Thu, 12 Jan 2023 15:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20fix:=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpane.list=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/group.button.js | 51 ++++++++++++++-------------- src/case/layer/pane.list.js | 3 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index 01b54e98c..814ce099e 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -31,7 +31,7 @@ export class ButtonGroup extends Widget { const behaviors = {}; each(optionsBehaviors, (key, rule) => { behaviors[key] = BI.BehaviorFactory.createBehavior(key, { - rule: rule, + rule, }); }); this.behaviors = behaviors; @@ -65,25 +65,26 @@ export class ButtonGroup extends Widget { args[0] = buttons; each(this.behaviors, (i, behavior) => { - behavior.doBehavior.apply(behavior, args); + behavior.doBehavior(...args); }); each(buttons, (i, btn) => { - btn.on(Controller.EVENT_CHANGE, (type, value, obj, ...arg) => { + btn.on(Controller.EVENT_CHANGE, (...arg) => { + const [type, value, obj] = arg; if (type === BI.Events.CLICK) { switch (chooseType) { - case ButtonGroup.CHOOSE_TYPE_SINGLE: - this.setValue(btn.getValue()); - break; - case ButtonGroup.CHOOSE_TYPE_NONE: - this.setValue([]); - break; - default: - break; + case ButtonGroup.CHOOSE_TYPE_SINGLE: + this.setValue(btn.getValue()); + break; + case ButtonGroup.CHOOSE_TYPE_NONE: + this.setValue([]); + break; + default: + break; } - this.fireEvent(Controller.EVENT_CHANGE, type, value, obj, ...arg); + this.fireEvent(Controller.EVENT_CHANGE, ...arg); this.fireEvent(ButtonGroup.EVENT_CHANGE, value, obj); } else { - this.fireEvent(Controller.EVENT_CHANGE, type, value, obj, ...arg); + this.fireEvent(Controller.EVENT_CHANGE, ...arg); } }); btn.on(BI.Events.DESTROY, () => { @@ -98,15 +99,13 @@ export class ButtonGroup extends Widget { const { layouts: optionsLayouts } = this.options; const layouts = isArray(optionsLayouts) ? optionsLayouts : [optionsLayouts]; for (let i = layouts.length - 1; i > 0; i--) { - btns = map(btns, (k, it) => { - return extend({}, layouts[i], { - items: [ - extend({}, layouts[i].el, { - el: it, - }) - ], - }); - }); + btns = map(btns, (k, it) => extend({}, layouts[i], { + items: [ + extend({}, layouts[i].el, { + el: it, + }) + ], + })); } return btns; @@ -154,12 +153,12 @@ export class ButtonGroup extends Widget { const args = Array.prototype.slice.call(arguments); args.unshift(this.buttons); each(this.behaviors, (i, behavior) => { - behavior.doBehavior.apply(behavior, args); + behavior.doBehavior(...args); }); } prependItems(items) { - const btns = this._btnsCreator.apply(this, arguments); + const btns = this._btnsCreator(...arguments); this.buttons = concat(btns, this.buttons); if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) { @@ -173,7 +172,7 @@ export class ButtonGroup extends Widget { } addItems(items) { - const btns = this._btnsCreator.apply(this, arguments); + const btns = this._btnsCreator(...arguments); this.buttons = concat(this.buttons, btns); // 如果是一个简单的layout @@ -209,7 +208,7 @@ export class ButtonGroup extends Widget { this.empty(); this.options.items = items; - this.buttons = this._btnsCreator.apply(this, arguments); + this.buttons = this._btnsCreator(...arguments); if (this._isSimpleLayout()) { items = this._packageSimpleItems(this.buttons); } else { diff --git a/src/case/layer/pane.list.js b/src/case/layer/pane.list.js index 69d6f4df1..8fa7e5f4c 100644 --- a/src/case/layer/pane.list.js +++ b/src/case/layer/pane.list.js @@ -69,7 +69,8 @@ export class ListPane extends Pane { }], }); - this.button_group.on(Controller.EVENT_CHANGE, (type, value, obj, ...args) => { + this.button_group.on(Controller.EVENT_CHANGE, (...args) => { + const [type, value, obj] = args; this.fireEvent(Controller.EVENT_CHANGE, ...args); if (type === Events.CLICK) { this.fireEvent(ListPane.EVENT_CHANGE, value, obj);