Browse Source

Merge pull request #174810 in DEC/fineui from master to feature/x

* commit '81cf25c7272ee8368eb5c7701df2825df8fa7230':
  feature:提供textvaluecombo的复选功能
master
superman 2 years ago
parent
commit
2fe66ecd01
  1. 2
      lodash.md
  2. 18
      src/case/combo/textvaluecombo/combo.textvalue.js
  3. 129
      src/case/combo/textvaluecombo/popup.textvalue.js
  4. 437
      src/core/1.lodash.js
  5. 43
      src/core/logic/logic.layout.js
  6. 7
      src/core/platform/web/config.js

2
lodash.md

@ -1 +1 @@
lodash core plus="debounce,throttle,get,set,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy,before,after,unescape,chunk"
lodash core plus="debounce,throttle,get,set,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy,before,after,unescape,chunk,pick,pickBy,identity"

18
src/case/combo/textvaluecombo/combo.textvalue.js

@ -16,7 +16,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: {},
allowClear: false,
status: "success", // success | warning | error,
title: null,
title: null
});
},
@ -44,11 +44,11 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
if (this.options.status === "error") {
return {
level: "warning",
text: o.warningTitle,
text: o.warningTitle
};
}
return {
level: "success",
level: "success"
};
};
@ -96,6 +96,18 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
action: (...args) => {
this.fireEvent(BI.Controller.EVENT_CHANGE, ...args);
}
}, {
eventName: BI.TextValueComboPopup.EVENT_CLEAR,
action: (...args) => {
changeTag = true;
this.setValue([]);
this.combo.hideView();
}
}, {
eventName: BI.TextValueComboPopup.EVENT_CONFIRM,
action: (...args) => {
this.combo.hideView();
}
}
]
};

129
src/case/combo/textvaluecombo/popup.textvalue.js

@ -6,33 +6,93 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
});
},
_init: function () {
BI.TextValueComboPopup.superclass._init.apply(this, arguments);
render () {
var o = this.options, self = this;
this.popup = BI.createWidget({
type: "bi.button_group",
items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}],
value: o.value
});
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return {
type: "bi.vertical",
vgap: 5,
items: [{
type: "bi.button_group",
ref: (_ref) => {
this.popup = _ref;
},
items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}],
value: o.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
}
}]
}]
};
}
return {
type: "bi.vertical",
verticalAlign: BI.VerticalAlign.Stretch,
rowSize: ["fill", ""],
items: [{
type: "bi.select_list",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
el: {
chooseType: o.chooseType
}
},
items: this._formatItems(o.items),
value: {
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: o.value
},
listeners: [{
eventName: BI.SelectList.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}]
}, {
type: "bi.center",
cls: "list-view-toolbar bi-high-light bi-split-top",
height: 24,
items: BI.createItems([{
type: "bi.text_button",
text: BI.i18nText("BI-Basic_Clears"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR);
}
}, {
type: "bi.text_button",
text: BI.i18nText("BI-Basic_OK"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM);
}
}], {
once: false,
shadow: true,
isShadowShowingOnSelected: true
})
}]
};
},
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
});
mounted: function () {
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
vgap: 5,
items: [this.popup]
});
},
_formatItems: function (items) {
@ -40,6 +100,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
return BI.map(items, function (i, item) {
return BI.extend({
type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item",
iconWrapperWidth: 36,
textAlign: o.textAlign,
title: item.title || item.text
}, item);
@ -52,13 +113,29 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
},
getValue: function () {
return this.popup.getValue();
if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return this.popup.getValue();
}
var val = this.popup.getValue();
if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return val.value;
} else {
return val.assist;
}
},
setValue: function (v) {
this.popup.setValue(v);
if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return this.popup.setValue(v);
}
this.popup.setValue({
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: v
});
}
});
BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextValueComboPopup.EVENT_CLEAR = "EVENT_CLEAR";
BI.TextValueComboPopup.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);

437
src/core/1.lodash.js

File diff suppressed because it is too large Load Diff

43
src/core/logic/logic.layout.js

@ -32,7 +32,7 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.vtape";
}
return {
return _.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
@ -45,8 +45,12 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, _.identity);
}
});
@ -85,7 +89,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.htape";
}
return {
return _.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
@ -98,8 +102,12 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, _.identity);
}
});
@ -135,19 +143,21 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.window";
}
return {
return _.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
scrollx: o.scrollx,
columns: o.columns,
rows: o.rows,
columnSize: o.columnSize,
rowSize: o.rowSize,
hgap: o.hgap,
vgap: o.vgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, _.identity);
}
});
@ -188,9 +198,8 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.htape";
}
return {
return _.pickBy({
type: layout,
columnSize: columnSize,
scrollable: o.scrollable,
scrolly: o.scrolly,
scrollx: o.scrollx,
@ -202,7 +211,11 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: columnSize,
rowSize: o.rowSize
}, _.identity);
}
});

7
src/core/platform/web/config.js

@ -62,6 +62,13 @@
})
});
}
if (ob.verticalAlign === BI.VerticalAlign.Stretch) {
if (isSupportFlex()) {
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch,
}, ob, { type: "bi.flex_vertical" });
}
}
return ob;
});
BI.Plugin.configWidget("bi.inline", function (ob) {

Loading…
Cancel
Save