Browse Source

Pull request #3391: 无JIRA任务 fix: 修复pane.list的bug

Merge in VISUAL/fineui from ~ZHENFEI.LI/fineui:es6 to es6

* commit '8fa373e05250b1520eb903e243e3ffc4c2ada898':
  无JIRA任务 fix: 修复pane.list的bug
  无JIRA任务 fix: TextValueCombo的引用正常
es6
Zhenfei.Li-李振飞 2 years ago
parent
commit
fc04f09227
  1. 51
      src/base/combination/group.button.js
  2. 3
      src/case/layer/pane.list.js
  3. 2
      src/widget/dynamicdate/dynamicdate.param.item.js

51
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 {

3
src/case/layer/pane.list.js

@ -93,7 +93,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);

2
src/widget/dynamicdate/dynamicdate.param.item.js

@ -79,7 +79,7 @@ export class DynamicDateParamItem extends Widget {
container: null,
value: o.offset,
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: () => {
this.fireEvent(DynamicDateParamItem.EVENT_CHANGE);
},

Loading…
Cancel
Save