Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~teller/fineui

es6
iapyang 2 years ago
parent
commit
821d4bca6b
  1. 23
      demo/js/case/combo/demo.text_value_combo.js
  2. 64
      demo/js/widget/slider/demo.slider.js
  3. 2
      lodash.md
  4. 2
      package.json
  5. 1
      src/base/combination/bubble.js
  6. 1
      src/base/combination/combo.js
  7. 31
      src/case/combo/textvaluecombo/combo.textvalue.js
  8. 129
      src/case/combo/textvaluecombo/popup.textvalue.js
  9. 26
      src/case/trigger/trigger.text.select.js
  10. 145
      src/component/treevaluechooser/abstract.treevaluechooser.js
  11. 3
      src/component/treevaluechooser/pane.treevaluechooser.js
  12. 437
      src/core/1.lodash.js
  13. 43
      src/core/logic/logic.layout.js
  14. 11
      src/core/platform/web/config.js
  15. 27
      src/widget/intervalslider/intervalslider.js
  16. 4
      src/widget/multiselectlist/multiselectlist.js
  17. 3
      src/widget/multitree/multi.tree.combo.js
  18. 3
      src/widget/multitree/multi.tree.insert.combo.js
  19. 3
      src/widget/multitree/multi.tree.list.combo.js
  20. 17
      src/widget/singleslider/singleslider.js
  21. 30
      src/widget/singleslider/singleslider.label.js
  22. 21
      src/widget/singleslider/singleslider.normal.js

23
demo/js/case/combo/demo.text_value_combo.js

@ -146,7 +146,7 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
type: "bi.button", type: "bi.button",
text: "setValue(1)", text: "setValue(1)",
handler: function () { handler: function () {
combo1.setValue(); combo1.setValue(1);
}, },
}, },
vgap: 10, vgap: 10,
@ -184,6 +184,27 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
vgap: 10, vgap: 10,
} }
] ]
}),
this.createCombo("支持复选", {
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
}) })
] ]
}; };

64
demo/js/widget/slider/demo.slider.js

@ -17,16 +17,11 @@ Demo.Slider = BI.inherit(BI.Widget, {
digit: 0, digit: 0,
width: o.width, width: o.width,
height: o.height, height: o.height,
cls: "layout-bg-white" cls: "layout-bg-white",
}); value: 30,
singleSlider.setMinAndMax({
min: 10, min: 10,
max: o.max max: 100
}); });
singleSlider.setValue(30);
singleSlider.populate();
singleSlider.on(BI.SingleSlider.EVENT_CHANGE, function () { singleSlider.on(BI.SingleSlider.EVENT_CHANGE, function () {
console.log(this.getValue()); console.log(this.getValue());
}); });
@ -35,14 +30,14 @@ Demo.Slider = BI.inherit(BI.Widget, {
type: "bi.single_slider_normal", type: "bi.single_slider_normal",
width: o.width, width: o.width,
height: 30, height: 30,
cls: "layout-bg-white" cls: "layout-bg-white",
});
normalSingleSlider.setMinAndMax({
min: o.min, min: o.min,
max: o.max max: o.max,
value: 30,
});
normalSingleSlider.on(BI.SingleSliderNormal.EVENT_DRAG, function () {
console.log(this.getValue());
}); });
normalSingleSlider.setValue(10);
normalSingleSlider.populate();
var singleSliderLabel = BI.createWidget({ var singleSliderLabel = BI.createWidget({
type: "bi.single_slider_label", type: "bi.single_slider_label",
@ -50,47 +45,38 @@ Demo.Slider = BI.inherit(BI.Widget, {
height: o.height, height: o.height,
digit: 0, digit: 0,
unit: "个", unit: "个",
cls: "layout-bg-white" cls: "layout-bg-white",
});
singleSliderLabel.setMinAndMax({
min: o.min, min: o.min,
max: o.max max: o.max,
value: 10,
}); });
singleSliderLabel.setValue(10);
singleSliderLabel.populate();
var intervalSlider = BI.createWidget({ var intervalSlider = BI.createWidget({
type: "bi.interval_slider", type: "bi.interval_slider",
width: o.width, width: o.width,
digit: 0, digit: 0,
cls: "layout-bg-white" cls: "layout-bg-white",
});
intervalSlider.setMinAndMax({
min: o.min, min: o.min,
max: o.max max: o.max,
}); value: {
intervalSlider.setValue({ min: 10,
min: 10, max: 70
max: 120 }
}); });
intervalSlider.populate();
var intervalSliderLabel = BI.createWidget({ var intervalSliderLabel = BI.createWidget({
type: "bi.interval_slider", type: "bi.interval_slider",
width: o.width, width: o.width,
unit: "px", unit: "px",
cls: "layout-bg-white", cls: "layout-bg-white",
digit: 1 digit: 1,
});
intervalSliderLabel.setMinAndMax({
min: 0, min: 0,
max: 120 max: 120,
}); value: {
intervalSliderLabel.setValue({ min: 60,
min: 10, max: 120
max: 120 }
}); });
intervalSliderLabel.populate();
return { return {
@ -126,4 +112,4 @@ Demo.Slider = BI.inherit(BI.Widget, {
}; };
} }
}); });
BI.shortcut("demo.slider", Demo.Slider); BI.shortcut("demo.slider", Demo.Slider);

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"

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220916093936", "version": "2.0.20220920140416",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

1
src/base/combination/bubble.js

@ -83,6 +83,7 @@
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this, element: this,
scrolly: false,
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [ items: [
{ el: this.combo } { el: this.combo }

1
src/base/combination/combo.js

@ -93,6 +93,7 @@
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this, element: this,
scrolly: false,
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [ items: [
{ el: this.combo } { el: this.combo }

31
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"
}; };
}; };
@ -85,17 +85,33 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
eventName: BI.TextValueComboPopup.EVENT_CHANGE, eventName: BI.TextValueComboPopup.EVENT_CHANGE,
action: (...args) => { action: (...args) => {
changeTag = true; changeTag = true;
this.setValue(this.popup.getValue()); const value = this.popup.getValue();
this.setValue(value);
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
this.combo.hideView(); this.combo.hideView();
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args);
} }
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_MULTI && BI.isEmptyArray(value)) {
this._clear();
}
} }
}, { }, {
eventName: BI.Controller.EVENT_CHANGE, eventName: BI.Controller.EVENT_CHANGE,
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._clear();
this.combo.hideView();
}
}, {
eventName: BI.TextValueComboPopup.EVENT_CONFIRM,
action: (...args) => {
this.combo.hideView();
}
} }
] ]
}; };
@ -139,6 +155,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
}, },
_clear: function () { _clear: function () {
this.trigger.setText("");
this.combo.setValue(); this.combo.setValue();
this.setStatus("success"); this.setStatus("success");
}, },
@ -152,7 +169,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
var vals = BI.isArray(v) ? v : [v]; var vals = BI.isArray(v) ? v : [v];
var result = BI.intersection(BI.map(this.options.items, (i, item) => item.value), vals); var result = BI.intersection(BI.map(this.options.items, "value"), vals);
if (result.length !== vals.length) { if (result.length !== vals.length) {
this.setStatus("error"); this.setStatus("error");
@ -165,6 +182,10 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
this._clear(); this._clear();
}, },
setText: function (text) {
this.trigger.setText(text);
},
setValue: function (v) { setValue: function (v) {
this.combo.setValue(v); this.combo.setValue(v);
this._checkError(v); this._checkError(v);

129
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) {
type: "bi.button_group", return {
items: this._formatItems(o.items), type: "bi.vertical",
chooseType: o.chooseType, vgap: 5,
layouts: [{ items: [{
type: "bi.vertical" type: "bi.button_group",
}], ref: (_ref) => {
value: o.value 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) { mounted: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
});
this.check(); this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
vgap: 5,
items: [this.popup]
});
}, },
_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 () {
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) { 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);

26
src/case/trigger/trigger.text.select.js

@ -20,15 +20,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_init: function () { _init: function () {
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items); var text = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: obj.text, text: text,
defaultText: o.defaultText, defaultText: o.defaultText,
textCls: obj.textCls,
textHgap: o.textHgap, textHgap: o.textHgap,
textVgap: o.textVgap, textVgap: o.textVgap,
textLgap: o.textLgap, textLgap: o.textLgap,
@ -73,21 +72,9 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0 && val.length === 0) { if (result.length > 0 && val.length === 0) {
return { return result.join(",");
textCls: "",
text: result.join(","),
};
} else { } else {
var text = BI.isFunction(o.text) ? o.text() : o.text; return BI.isFunction(o.text) ? o.text() : o.text;
if (BI.isEmptyString(text)) {
return {
textCls: "bi-tips",
text: ""
};
}
return {
text,
};
} }
}, },
@ -97,9 +84,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}, },
setValue: function (val) { setValue: function (val) {
var formatValue = this._digest(val, this.options.items); var formatText = this._digest(val, this.options.items);
this.trigger.setTextCls(formatValue.textCls); this.trigger.setText(formatText);
this.trigger.setText(formatValue.text);
}, },
setTipType: function (v) { setTipType: function (v) {

145
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -532,70 +532,81 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues || {}; var selectedValues = op.selectedValues || {};
var valueMap = {}; function getResult(parentValues, checkState) {
// if (judgeState(parentValues, selectedValues, checkState)) { var valueMap = {};
valueMap = dealWithSelectedValue(parentValues, selectedValues); // if (judgeState(parentValues, selectedValues, checkState)) {
// } valueMap = dealWithSelectedValue(parentValues, selectedValues);
var nodes = this._getChildren(parentValues); // }
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { var nodes = self._getChildren(parentValues);
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); for (var i = (times - 1) * self._const.perPage; nodes[i] && i < times * self._const.perPage; i++) {
result.push({ var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
id: nodes[i].id, var openState = o.open || nodes[i].open;
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: nodes[i].getChildrenLength() > 0,
checked: state[0],
halfCheck: state[1],
open: o.open,
disabled: nodes[i].disabled,
title: nodes[i].title || nodes[i].text,
warningTitle: nodes[i].warningTitle,
});
}
// 如果指定节点全部打开
if (o.open) {
var allNodes = [];
// 获取所有节点
BI.each(nodes, function (idx, node) {
allNodes = BI.concat(allNodes, self._getAllChildren(parentValues.concat([node.value])));
});
var lastFind;
BI.each(allNodes, function (idx, node) {
var valueMap = dealWithSelectedValue(node.parentValues, selectedValues);
// REPORT-24409 fix: 设置节点全部展开,添加的节点没有给状态
var parentCheckState = {};
var find = BI.find(result, function (idx, pNode) {
return pNode.id === node.pId;
});
if (find) {
parentCheckState.checked = find.halfCheck ? false : find.checked;
parentCheckState.half = find.halfCheck;
// 默认展开也需要重置父节点的halfCheck
if (BI.isNotNull(lastFind) && (lastFind !== find || allNodes.length - 1 === idx)) {
lastFind.half = lastFind.halfCheck;
lastFind.halfCheck = false;
}
}
lastFind = find;
var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState);
result.push({ result.push({
id: node.id, id: nodes[i].id,
pId: node.pId, pId: nodes[i].pId,
value: node.value, value: nodes[i].value,
text: node.text, text: nodes[i].text,
times: 1, times: 1,
isParent: node.getChildrenLength() > 0, isParent: nodes[i].getChildrenLength() > 0,
checked: state[0], checked: state[0],
halfCheck: state[1], half: state[1],
open: self.options.open, halfCheck: openState ? false : state[1],
disabled: node.disabled, open: openState,
title: node.title || node.text, disabled: nodes[i].disabled,
warningTitle: node.warningTitle, title: nodes[i].title || nodes[i].text,
warningTitle: nodes[i].warningTitle,
}); });
}); if (openState) {
getResult(parentValues.concat([nodes[i].value]), {checked: state[0], half: state[1]});
}
}
} }
getResult(parentValues, checkState);
// 如果指定节点全部打开
// if (o.open) {
// var allNodes = [];
// // 获取所有节点
// BI.each(nodes, function (idx, node) {
// allNodes = BI.concat(allNodes, self._getAllChildren(parentValues.concat([node.value])));
// });
// var lastFind;
// BI.each(allNodes, function (idx, node) {
// var valueMap = dealWithSelectedValue(node.parentValues, selectedValues);
// // REPORT-24409 fix: 设置节点全部展开,添加的节点没有给状态
// var parentCheckState = {};
// var find = BI.find(result, function (idx, pNode) {
// return pNode.id === node.pId;
// });
// if (find) {
// parentCheckState.checked = find.halfCheck ? false : find.checked;
// parentCheckState.half = find.halfCheck;
// // 默认展开也需要重置父节点的halfCheck
// if (BI.isNotNull(lastFind) && (lastFind !== find || allNodes.length - 1 === idx)) {
// lastFind.half = lastFind.halfCheck;
// lastFind.halfCheck = false;
// }
// }
// lastFind = find;
// var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState);
// result.push({
// id: node.id,
// pId: node.pId,
// value: node.value,
// text: node.text,
// times: 1,
// isParent: node.getChildrenLength() > 0,
// checked: state[0],
// halfCheck: state[1],
// open: true,
// disabled: node.disabled,
// title: node.title || node.text,
// warningTitle: node.warningTitle,
// });
// });
// }
// 深层嵌套的比较麻烦,这边先实现的是在根节点添加 // 深层嵌套的比较麻烦,这边先实现的是在根节点添加
if (parentValues.length === 0 && times === 1) { if (parentValues.length === 0 && times === 1) {
result = BI.concat(self._getAddedValueNode(parentValues, selectedValues), result); result = BI.concat(self._getAddedValueNode(parentValues, selectedValues), result);
@ -603,17 +614,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
BI.nextTick(function () { BI.nextTick(function () {
callback({ callback({
items: result, items: result,
hasNext: nodes.length > times * self._const.perPage hasNext: self._getChildren(parentValues).length > times * self._const.perPage
}); });
}); });
function judgeState(parentValues, selected_value, checkState) { // function judgeState(parentValues, selected_value, checkState) {
var checked = checkState.checked, half = checkState.half; // var checked = checkState.checked, half = checkState.half;
if (parentValues.length > 0 && !checked) { // if (parentValues.length > 0 && !checked) {
return false; // return false;
} // }
return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value)); // return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
} // }
function dealWithSelectedValue(parentValues, selectedValues) { function dealWithSelectedValue(parentValues, selectedValues) {
var valueMap = {}, parents = (parentValues || []).slice(0); var valueMap = {}, parents = (parentValues || []).slice(0);

3
src/component/treevaluechooser/pane.treevaluechooser.js

@ -29,6 +29,9 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
this.pane.on(BI.MultiSelectTree.EVENT_CHANGE, function () { this.pane.on(BI.MultiSelectTree.EVENT_CHANGE, function () {
self.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE); self.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE);
}); });
if (BI.isNotNull(o.value)) {
this.pane.setSelectedValue(o.value);
}
if (BI.isNotNull(o.items)) { if (BI.isNotNull(o.items)) {
this._initData(o.items); this._initData(o.items);
this.pane.populate(); this.pane.populate();

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 { } 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);
} }
}); });

11
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) {
@ -229,7 +236,7 @@
return ob; return ob;
}); });
BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { BI.Plugin.configWidget("bi.flex_horizontal", function (ob) {
if (ob.scrollable === true || ob.scrollx !== false) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" }); return BI.extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" });
@ -242,7 +249,7 @@
} }
}); });
BI.Plugin.configWidget("bi.flex_vertical", function (ob) { BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
return BI.extend({}, ob, { type: "bi.flex_scrollable_vertical" }); return BI.extend({}, ob, { type: "bi.flex_scrollable_vertical" });
} }

27
src/widget/intervalslider/intervalslider.js

@ -15,7 +15,23 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-interval-slider bi-slider-track", baseCls: "bi-interval-slider bi-slider-track",
digit: false, digit: false,
unit: "" unit: "",
min: 0,
max: 100,
value: {
min: "",
max: "",
}
},
beforeMount: function () {
const { value, min, max } = this.options;
this.setMinAndMax({
min,
max,
});
this.setValue(value);
this.populate();
}, },
render: function () { render: function () {
@ -25,13 +41,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.enable = false; this.enable = false;
this.valueOne = ""; this.valueOne = "";
this.valueTwo = ""; this.valueTwo = "";
this.calculation = new BI.AccurateCalculationModel();
// this.backgroundTrack = BI.createWidget({ this.calculation = new BI.AccurateCalculationModel();
// type: "bi.layout",
// cls: "background-track",
// height: c.TRACK_HEIGHT
// });
this.grayTrack = BI.createWidget({ this.grayTrack = BI.createWidget({
type: "bi.layout", type: "bi.layout",
cls: "gray-track", cls: "gray-track",
@ -539,4 +550,4 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
} }
}); });
BI.IntervalSlider.EVENT_CHANGE = "EVENT_CHANGE"; BI.IntervalSlider.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.interval_slider", BI.IntervalSlider); BI.shortcut("bi.interval_slider", BI.IntervalSlider);

4
src/widget/multiselectlist/multiselectlist.js

@ -15,7 +15,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
BI.MultiSelectList.superclass._init.apply(this, arguments); BI.MultiSelectList.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = {}; this.storeValue = this._assertValue(o.value || {});
var assertShowValue = function () { var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue)); BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
@ -31,6 +31,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
logic: { logic: {
dynamic: false dynamic: false
}, },
value: o.value,
isDefaultInit: true, isDefaultInit: true,
// onLoaded: o.onLoaded, // onLoaded: o.onLoaded,
el: {} el: {}
@ -198,6 +199,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
val || (val = {}); val || (val = {});
val.type || (val.type = BI.Selection.Multi); val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []); val.value || (val.value = []);
return val;
}, },
_makeMap: function (values) { _makeMap: function (values) {

3
src/widget/multitree/multi.tree.combo.js

@ -80,7 +80,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.storeValue.value = val;
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.getValue());
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,

3
src/widget/multitree/multi.tree.insert.combo.js

@ -97,7 +97,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.storeValue.value = val;
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue());
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,

3
src/widget/multitree/multi.tree.list.combo.js

@ -114,7 +114,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.storeValue.value = val;
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.getValue());
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,

17
src/widget/singleslider/singleslider.js

@ -16,7 +16,20 @@ BI.SingleSlider = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-single-slider bi-slider-track", baseCls: "bi-single-slider bi-slider-track",
digit: false, digit: false,
unit: "" unit: "",
value: "",
min: 0,
max: 100,
},
beforeMount: function () {
const { value, min, max } = this.options;
this.setMinAndMax({
min,
max,
});
this.setValue(value);
this.populate();
}, },
render: function () { render: function () {
@ -340,4 +353,4 @@ BI.SingleSlider = BI.inherit(BI.Single, {
} }
}); });
BI.SingleSlider.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSlider.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_slider", BI.SingleSlider); BI.shortcut("bi.single_slider", BI.SingleSlider);

30
src/widget/singleslider/singleslider.label.js

@ -13,16 +13,27 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, {
TRACK_GAP_HALF: 7, TRACK_GAP_HALF: 7,
TRACK_GAP: 14 TRACK_GAP: 14
}, },
_defaultConfig: function () {
return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), { props: {
baseCls: "bi-single-slider-label bi-slider-track", baseCls: "bi-single-slider-label bi-slider-track",
digit: false, digit: false,
unit: "" unit: "",
value: "",
min: 0,
max: 100,
},
beforeMount: function () {
const { value, min, max } = this.options;
this.setMinAndMax({
min,
max,
}); });
this.setValue(value);
this.populate();
}, },
_init: function () {
BI.SingleSliderLabel.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options; var self = this, o = this.options;
var c = this._constant; var c = this._constant;
this.enable = false; this.enable = false;
@ -83,9 +94,8 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, {
}); });
this._setVisible(false); this._setVisible(false);
BI.createWidget({ return ({
type: "bi.absolute", type: "bi.absolute",
element: this,
items: [{ items: [{
el: { el: {
type: "bi.vertical", type: "bi.vertical",
@ -308,4 +318,4 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, {
} }
}); });
BI.SingleSliderLabel.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSliderLabel.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_slider_label", BI.SingleSliderLabel); BI.shortcut("bi.single_slider_label", BI.SingleSliderLabel);

21
src/widget/singleslider/singleslider.normal.js

@ -16,16 +16,27 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-single-slider-normal bi-slider-track", baseCls: "bi-single-slider-normal bi-slider-track",
minMax: { min: 0,
min: 0, max: 100,
max: 100 value: "",
}
// color: "#3f8ce8" // color: "#3f8ce8"
}, },
beforeMount: function () {
const { value, min, max } = this.options;
this.setMinAndMax({
min,
max,
});
this.setValue(value);
this.populate();
},
render: function () { render: function () {
var self = this; var self = this;
var o = this.options;
var c = this._constant; var c = this._constant;
var track = this._createTrack(); var track = this._createTrack();
this.slider = BI.createWidget({ this.slider = BI.createWidget({
type: "bi.single_slider_button" type: "bi.single_slider_button"
@ -282,4 +293,4 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, {
} }
}); });
BI.SingleSliderNormal.EVENT_DRAG = "EVENT_DRAG"; BI.SingleSliderNormal.EVENT_DRAG = "EVENT_DRAG";
BI.shortcut("bi.single_slider_normal", BI.SingleSliderNormal); BI.shortcut("bi.single_slider_normal", BI.SingleSliderNormal);

Loading…
Cancel
Save