Browse Source

无JIRA任务 fix: 修复pane.list的bug

es6
Zhenfei.Li 2 years ago
parent
commit
80db0a5eee
  1. 25
      src/base/combination/group.button.js
  2. 3
      src/case/layer/pane.list.js

25
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,10 +65,11 @@ 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:
@ -80,10 +81,10 @@ export class ButtonGroup extends Widget {
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], {
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 {

3
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);

Loading…
Cancel
Save