Browse Source

feature:提供textvaluecombo的复选功能

es6
guy 2 years ago
parent
commit
3e9d6add1c
  1. 2
      lodash.md
  2. 18
      src/case/combo/textvaluecombo/combo.textvalue.js
  3. 109
      src/case/combo/textvaluecombo/popup.textvalue.js
  4. 433
      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: {}, el: {},
allowClear: false, allowClear: false,
status: "success", // success | warning | error, status: "success", // success | warning | error,
title: null, title: null
}); });
}, },
@ -44,11 +44,11 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
if (this.options.status === "error") { if (this.options.status === "error") {
return { return {
level: "warning", level: "warning",
text: o.warningTitle, text: o.warningTitle
}; };
} }
return { return {
level: "success", level: "success"
}; };
}; };
@ -96,6 +96,18 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
action: (...args) => { action: (...args) => {
this.fireEvent(BI.Controller.EVENT_CHANGE, ...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();
}
} }
] ]
}; };

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

@ -6,33 +6,93 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
}); });
}, },
_init: function () { render () {
BI.TextValueComboPopup.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
this.popup = BI.createWidget({ if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return {
type: "bi.vertical",
vgap: 5,
items: [{
type: "bi.button_group", type: "bi.button_group",
ref: (_ref) => {
this.popup = _ref;
},
items: this._formatItems(o.items), items: this._formatItems(o.items),
chooseType: o.chooseType, chooseType: o.chooseType,
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}], }],
value: o.value value: o.value,
}); listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
} }
}); }
this.check(); }]
}]
BI.createWidget({ };
}
return {
type: "bi.vertical", type: "bi.vertical",
element: this, verticalAlign: BI.VerticalAlign.Stretch,
vgap: 5, rowSize: ["fill", ""],
items: [this.popup] 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
})
}]
};
},
mounted: function () {
this.check();
}, },
_formatItems: function (items) { _formatItems: function (items) {
@ -40,6 +100,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
return BI.map(items, function (i, item) { return BI.map(items, function (i, item) {
return BI.extend({ return BI.extend({
type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item", type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item",
iconWrapperWidth: 36,
textAlign: o.textAlign, textAlign: o.textAlign,
title: item.title || item.text title: item.title || item.text
}, item); }, item);
@ -52,13 +113,29 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
}, },
getValue: function () { getValue: function () {
if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return this.popup.getValue(); 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) { 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_CHANGE = "EVENT_CHANGE";
BI.TextValueComboPopup.EVENT_CLEAR = "EVENT_CLEAR";
BI.TextValueComboPopup.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup); BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);

433
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 { } else {
layout = "bi.vtape"; layout = "bi.vtape";
} }
return { return _.pickBy({
type: layout, type: layout,
scrollable: o.scrollable, scrollable: o.scrollable,
scrolly: o.scrolly, scrolly: o.scrolly,
@ -45,8 +45,12 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap, bgap: o.bgap,
innerHgap: o.innerHgap, innerHgap: o.innerHgap,
innerVgap: o.innerVgap, 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 { } else {
layout = "bi.htape"; layout = "bi.htape";
} }
return { return _.pickBy({
type: layout, type: layout,
scrollable: o.scrollable, scrollable: o.scrollable,
scrolly: o.scrolly, scrolly: o.scrolly,
@ -98,8 +102,12 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap, bgap: o.bgap,
innerHgap: o.innerHgap, innerHgap: o.innerHgap,
innerVgap: o.innerVgap, 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 { } else {
layout = "bi.window"; layout = "bi.window";
} }
return { return _.pickBy({
type: layout, type: layout,
scrollable: o.scrollable, scrollable: o.scrollable,
scrolly: o.scrolly, scrolly: o.scrolly,
scrollx: o.scrollx, scrollx: o.scrollx,
columns: o.columns, columns: o.columns,
rows: o.rows, rows: o.rows,
columnSize: o.columnSize,
rowSize: o.rowSize,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, 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 { } else {
layout = "bi.htape"; layout = "bi.htape";
} }
return { return _.pickBy({
type: layout, type: layout,
columnSize: columnSize,
scrollable: o.scrollable, scrollable: o.scrollable,
scrolly: o.scrolly, scrolly: o.scrolly,
scrollx: o.scrollx, scrollx: o.scrollx,
@ -202,7 +211,11 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap, bgap: o.bgap,
innerHgap: o.innerHgap, innerHgap: o.innerHgap,
innerVgap: o.innerVgap, 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; return ob;
}); });
BI.Plugin.configWidget("bi.inline", function (ob) { BI.Plugin.configWidget("bi.inline", function (ob) {

Loading…
Cancel
Save