Browse Source

Merge pull request #204033 in DEC/fineui from final/11.0 to persist/11.0

* commit '3d3973ee8c0ebc13ab283f04fb37707e13a7722e': (198 commits)
  同步
  同步
  Pull request #3135: BI-115516 check面板也处理下
  Merge pull request #200297 in DEC/fineui from master to feature/x
  Merge pull request #200530 in DEC/fineui from master to feature/x
  无JIRA fix: text_value_combo_popup 兼容性
  BI-115369 同步修改
  update
  无JIRA任务 图标key
  Pull request #3114: 无JIRA任务 chore: 优化
  auto upgrade version to 2.0.20221009164825
  BI-114880 style:图标更新
  auto upgrade version to 2.0.20221008165420
  auto upgrade version to 2.0.20221007090556
  resizeObserver
  auto upgrade version to 2.0.20221004143445
  auto upgrade version to 2.0.20221003165530
  feature: 支持type可以直接传函数,没有xtype都行
  无JIRA fix: 动态日期面板border
  auto upgrade version to 2.0.20220928194458
  ...
research/test
superman 2 years ago
parent
commit
015d3f400e
  1. 3
      bi.lessconfig.json
  2. 2
      bin/cli/worker/template/main_thread.helper.t
  3. 23
      demo/js/case/combo/demo.text_value_combo.js
  4. 68
      demo/js/widget/downlist/demo.downlist.js
  5. 47
      demo/js/widget/numbereditor/demo.number_editor.js
  6. 62
      demo/js/widget/slider/demo.slider.js
  7. BIN
      dist/font/iconfont.eot
  8. 230
      dist/font/iconfont.svg
  9. BIN
      dist/font/iconfont.ttf
  10. BIN
      dist/font/iconfont.woff
  11. BIN
      dist/font/iconfont.woff2
  12. 2
      lodash.md
  13. 6
      package.json
  14. 7
      plugins/webpack-fui-worker-plugin/worker-loader.js
  15. 5
      src/base/collection/collection.js
  16. 12
      src/base/combination/bubble.js
  17. 3
      src/base/combination/combo.js
  18. 11
      src/base/grid/grid.js
  19. 15
      src/base/layer/layer.popover.js
  20. 7
      src/base/list/virtualgrouplist.js
  21. 1
      src/base/pager/pager.js
  22. 5
      src/base/single/button/button.basic.js
  23. 1
      src/base/single/button/buttons/button.text.js
  24. 1
      src/base/single/button/listitem/blankiconicontextitem.js
  25. 1
      src/base/single/button/listitem/blankicontexticonitem.js
  26. 1
      src/base/single/button/listitem/blankicontextitem.js
  27. 1
      src/base/single/button/listitem/icontexticonitem.js
  28. 1
      src/base/single/button/listitem/icontextitem.js
  29. 1
      src/base/single/button/listitem/texticonitem.js
  30. 1
      src/base/single/button/listitem/textitem.js
  31. 1
      src/base/single/button/node/icontexticonnode.js
  32. 1
      src/base/single/button/node/icontextnode.js
  33. 1
      src/base/single/button/node/texticonnode.js
  34. 1
      src/base/single/button/node/textnode.js
  35. 3
      src/base/single/editor/editor.textarea.js
  36. 17
      src/base/single/label/abstract.label.js
  37. 17
      src/base/single/label/label.js
  38. 2
      src/base/single/tip/tip.tooltip.js
  39. 5
      src/case/button/icon/icon.change.js
  40. 22
      src/case/button/icon/iconhalf/icon.half.js
  41. 2
      src/case/button/switch.js
  42. 9
      src/case/colorchooser/colorchooser.js
  43. 62
      src/case/combo/textvaluecombo/combo.textvalue.js
  44. 72
      src/case/combo/textvaluecombo/combo.textvaluesmall.js
  45. 131
      src/case/combo/textvaluecombo/popup.textvalue.js
  46. 1
      src/case/pager/pager.detail.js
  47. 45
      src/case/trigger/trigger.text.select.js
  48. 179
      src/component/treevaluechooser/abstract.treevaluechooser.js
  49. 2
      src/component/treevaluechooser/combo.treevaluechooser.js
  50. 4
      src/component/treevaluechooser/pane.treevaluechooser.js
  51. 437
      src/core/1.lodash.js
  52. 14
      src/core/4.widget.js
  53. 14
      src/core/5.inject.js
  54. 43
      src/core/logic/logic.layout.js
  55. 11
      src/core/platform/web/config.js
  56. 29
      src/core/platform/web/detectElementResize.js
  57. 90
      src/core/platform/web/jquery/_jquery.js
  58. 22
      src/core/utils/i18n.js
  59. 9
      src/less/base/single/html.less
  60. 7
      src/less/base/tree/ztree.less
  61. 2
      src/less/base/trigger/trigger.less
  62. 25
      src/less/core/utils/common.less
  63. 1
      src/less/lib/font.less
  64. 2
      src/less/resource/font.less
  65. 10
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  66. 2
      src/router/router.js
  67. 223
      src/widget/downlist/combo.downlist.js
  68. 16
      src/widget/downlist/item.downlist.js
  69. 66
      src/widget/downlist/item.downlistgroup.js
  70. 2
      src/widget/dynamicdate/dynamicdate.param.item.js
  71. 8
      src/widget/dynamicdate/dynamicdate.trigger.js
  72. 25
      src/widget/intervalslider/intervalslider.js
  73. 4
      src/widget/multilayerdownlist/popup.downlist.js
  74. 3
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  75. 101
      src/widget/multilayersingletree/multilayersingletree.combo.js
  76. 13
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  77. 22
      src/widget/multiselect/check/multiselect.display.js
  78. 9
      src/widget/multiselect/loader.js
  79. 2
      src/widget/multiselect/multiselect.combo.js
  80. 2
      src/widget/multiselect/multiselect.combo.nobar.js
  81. 2
      src/widget/multiselect/multiselect.insert.combo.js
  82. 2
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  83. 2
      src/widget/multiselectlist/multiselectlist.insert.js
  84. 2
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  85. 4
      src/widget/multiselectlist/multiselectlist.js
  86. 1
      src/widget/multitree/multi.tree.combo.js
  87. 3
      src/widget/multitree/multi.tree.insert.combo.js
  88. 3
      src/widget/multitree/multi.tree.list.combo.js
  89. 14
      src/widget/numbereditor/number.editor.js
  90. 2
      src/widget/singleselect/trigger/searcher.singleselect.js
  91. 15
      src/widget/singleslider/singleslider.js
  92. 28
      src/widget/singleslider/singleslider.label.js
  93. 19
      src/widget/singleslider/singleslider.normal.js
  94. 9
      src/widget/time/time.trigger.js
  95. 8
      src/widget/timeinterval/dateinterval.js
  96. 8
      src/widget/timeinterval/timeinterval.js
  97. 7
      src/widget/timeinterval/timeperiods.js
  98. 7
      src/widget/yearinterval/yearinterval.js
  99. 32
      src/widget/yearmonth/card.static.yearmonth.js
  100. 3
      src/widget/yearmonth/combo.yearmonth.js
  101. Some files were not shown because too many files have changed in this diff Show More

3
bi.lessconfig.json

@ -46,5 +46,6 @@
"@font-trigger-triangle": "e924", "@font-trigger-triangle": "e924",
"@font-solid-bottom": "e905", "@font-solid-bottom": "e905",
"@font-solid-right": "e906", "@font-solid-right": "e906",
"@font-dot": "e762" "@font-dot": "e762",
"@font-down-triangle": "e70b"
} }

2
bin/cli/worker/template/main_thread.helper.t

@ -2,7 +2,7 @@ import { ${WorkerName}MainThreadWorker } from './main_thread/${workerName}_main_
// 不需要一起打包的话则不需要引入这行 // 不需要一起打包的话则不需要引入这行
// FuiWorkerPlugin中的属性会同步到fui-worker中同时支持loader行内传入属性 // FuiWorkerPlugin中的属性会同步到fui-worker中同时支持loader行内传入属性
// 根据实际需求传入inline返回格式 true -> blob urlfalse -> servicePath // 根据实际需求传入inline返回格式 true -> blob urlfalse -> servicePath
import { workerUrl } from 'fui-worker!./worker_thread/${workerName}_worker_thread'; import workerUrl from 'fui-worker!./worker_thread/${workerName}_worker_thread';
export class ${WorkerName}WorkerHelper { export class ${WorkerName}WorkerHelper {
private worker: ${WorkerName}MainThreadWorker; private worker: ${WorkerName}MainThreadWorker;

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());
}
}
]
}
]
}) })
] ]
}; };

68
demo/js/widget/downlist/demo.downlist.js

@ -1,3 +1,15 @@
(function () {
var CustomIcon = BI.inherit(BI.Widget, {
render: function () {
return {
type: "bi.label",
text: "✨",
};
},
});
BI.shortcut("demo.downlist.icon", CustomIcon);
}());
Demo.Downlist = BI.inherit(BI.Widget, { Demo.Downlist = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-downlist" baseCls: "demo-downlist"
@ -22,9 +34,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this; var self = this;
// test
return { return {
type: "bi.horizontal_adapt", type: "bi.left",
items: [{ items: [{
type: "bi.down_list_combo", type: "bi.down_list_combo",
ref: function (_ref) { ref: function (_ref) {
@ -35,11 +47,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
width: 100, width: 100,
items: [ items: [
[{ [{
el: { text: "column 1111",
text: "column 1111", iconCls1: "dot-e-font",
iconCls1: "dot-e-font", value: 12,
value: 12
},
children: [{ children: [{
text: "column 1.1", text: "column 1.1",
value: 21, value: 21,
@ -131,7 +141,49 @@ Demo.Downlist = BI.inherit(BI.Widget, {
// }] // }]
}] }]
] ],
}, {
type: "bi.down_list_combo",
el: {
type: "bi.button",
ghost: true,
iconPosition: "right",
icon: "column-next-page-h-font",
text: "自定义 trigger 和 icon 的级联下拉框",
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function (v) {
console.log("触发值", v);
}
}, {
eventName: "EVENT_SON_VALUE_CHANGE",
action: function(v) {
console.log("二级菜单触发值", v)
}
}],
items: [
[{
text: "选项一",
value: 1,
icon: {
type: "demo.downlist.icon",
},
children: [{
text: "选项一",
value: 11,
icon: {
type: "demo.downlist.icon",
},
}, {
text: "选项二",
value: 12,
}],
}, {
text: "选项二",
value: 2,
}]
],
}, { }, {
type: "bi.multi_layer_down_list_combo", type: "bi.multi_layer_down_list_combo",
ref: function (_ref) { ref: function (_ref) {

47
demo/js/widget/numbereditor/demo.number_editor.js

@ -7,7 +7,7 @@ Demo.FileManager = BI.inherit(BI.Widget, {
}, },
render: function () { render: function () {
var editor = BI.createWidget({ var editor1 = BI.createWidget({
type: "bi.number_editor", type: "bi.number_editor",
validationChecker: function (v) { validationChecker: function (v) {
return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0; return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0;
@ -16,20 +16,49 @@ Demo.FileManager = BI.inherit(BI.Widget, {
width: 150, width: 150,
errorText: "hahah" errorText: "hahah"
}); });
editor.on(BI.NumberEditor.EVENT_CHANGE, function () { editor1.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) { if (BI.parseFloat(this.getValue()) < 1) {
editor.setDownEnable(false); editor1.setDownEnable(false);
} else { } else {
editor.setDownEnable(true); editor1.setDownEnable(true);
} }
BI.Msg.toast(editor.getValue()); BI.Msg.toast(editor1.getValue());
}); });
var editor2 = BI.createWidget({
type: "bi.number_editor",
validationChecker: function (v) {
return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0;
},
valueFormatter: (v) => `${v}$`,
valueParser: (v) => v.replace(/\$\s?|(,*)/g, ''),
height: 24,
width: 150,
errorText: "hahah"
});
editor2.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) {
editor2.setDownEnable(false);
} else {
editor2.setDownEnable(true);
}
BI.Msg.toast(editor2.getValue());
});
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ hgap: 20,
el: editor, vgap: 20,
height: 24 items: [
}] {
el: editor1,
height: 24
}, {
el: editor2,
height: 24
}
]
}; };
} }
}); });

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

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

230
dist/font/iconfont.svg vendored

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 710 KiB

After

Width:  |  Height:  |  Size: 788 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

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"

6
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220826175704", "version": "2.0.20221009164825",
"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",
@ -11,8 +11,10 @@
"@babel/core": "^7.17.4", "@babel/core": "^7.17.4",
"@babel/polyfill": "7.6.0", "@babel/polyfill": "7.6.0",
"@fui/babel-preset-fineui": "^2.0.0", "@fui/babel-preset-fineui": "^2.0.0",
"@fui/eslint-plugin": "^1.0.15", "@fui/eslint-plugin": "^1.0.19",
"@types/node": "15.6.1", "@types/node": "15.6.1",
"@typescript-eslint/eslint-plugin": "2.33.0",
"@typescript-eslint/parser": "2.33.0",
"autoprefixer": "9.6.1", "autoprefixer": "9.6.1",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",
"chai": "4.2.0", "chai": "4.2.0",

7
plugins/webpack-fui-worker-plugin/worker-loader.js

@ -117,16 +117,13 @@ function loader() {
// 添加 @ts-nocheck 避免 ts-check 报错 // 添加 @ts-nocheck 避免 ts-check 报错
// 修复export const 下 const不会被转译的问题 // 修复export const 下 const不会被转译的问题
`// @ts-nocheck `// @ts-nocheck
const blob = new Blob([${JSON.stringify(compilation.assets[entry].source())}]); export default window.URL.createObjectURL(new Blob([${JSON.stringify(compilation.assets[entry].source())}]));
const workerUrl = window.URL.createObjectURL(blob);
export default workerUrl;
` `
) )
: callback( : callback(
null, null,
`// @ts-nocheck `// @ts-nocheck
const servicePath = __webpack_public_path__ + ${JSON.stringify(entry)}; export default __webpack_public_path__ + ${JSON.stringify(entry)};
export default servicePath;
` `
) )
}); });

5
src/base/collection/collection.js

@ -16,6 +16,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrolly: false, scrolly: false,
overflowX: true, overflowX: true,
overflowY: true, overflowY: true,
el: {
type: "bi.vertical"
},
cellSizeAndPositionGetter: BI.emptyFn, cellSizeAndPositionGetter: BI.emptyFn,
horizontalOverscanSize: 0, horizontalOverscanSize: 0,
verticalOverscanSize: 0, verticalOverscanSize: 0,
@ -65,7 +68,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrollable = "x"; scrollable = "x";
} }
} }
BI._lazyCreateWidget({ BI._lazyCreateWidget(o.el, {
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
scrollable: scrollable, scrollable: scrollable,

12
src/base/combination/bubble.js

@ -12,7 +12,7 @@
attributes: { attributes: {
tabIndex: -1, tabIndex: -1,
}, },
trigger: "click", // click || hover || click-hover || "" trigger: "click", // click || hover || click-hover || "hover-click" || ""
toggle: true, toggle: true,
direction: "", direction: "",
placement: "bottom-start", // top-start/top/top-end/bottom-start/bottom/bottom-end/left-start/left/left-end/right-start/right/right-end placement: "bottom-start", // top-start/top/top-end/bottom-start/bottom/bottom-end/left-start/left/left-end/right-start/right/right-end
@ -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 }
@ -218,6 +219,15 @@
} }
}); });
break; break;
case "hover-click":
self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self._popupView(e);
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Bubble.EVENT_EXPAND);
}
});
break;
default: default:
break; break;
} }

3
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 }
@ -152,7 +153,7 @@
o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName());
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW, e);
}, },
_popupView: function (e) { _popupView: function (e) {

11
src/base/grid/grid.js

@ -16,6 +16,9 @@ BI.GridView = BI.inherit(BI.Widget, {
scrolly: false, scrolly: false,
overflowX: true, overflowX: true,
overflowY: true, overflowY: true,
el: {
type: "bi.vertical"
},
overscanColumnCount: 0, overscanColumnCount: 0,
overscanRowCount: 0, overscanRowCount: 0,
rowHeightGetter: BI.emptyFn, // number类型或function类型 rowHeightGetter: BI.emptyFn, // number类型或function类型
@ -68,7 +71,7 @@ BI.GridView = BI.inherit(BI.Widget, {
scrollable = "x"; scrollable = "x";
} }
} }
BI._lazyCreateWidget({ BI._lazyCreateWidget(o.el, {
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
scrollable: scrollable, scrollable: scrollable,
@ -94,6 +97,12 @@ BI.GridView = BI.inherit(BI.Widget, {
} }
}, },
destroyed: function () {
BI.each(this.renderedCells, function(i, cell) {
cell.el._destroy();
})
},
_calculateSizeAndPositionData: function () { _calculateSizeAndPositionData: function () {
var o = this.options; var o = this.options;
this.rowCount = 0; this.rowCount = 0;

15
src/base/layer/layer.popover.js

@ -158,9 +158,11 @@ BI.Popover = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var self = this; var self = this;
this.dragger.element.mousedown(function (e) { this.dragger.element.mousedown(function (e) {
self.startX = self.element[0].offsetLeft; if (self.options.draggable !== false) {
self.startY = self.element[0].offsetTop; self.startX = self.element[0].offsetLeft;
self.tracker.captureMouseMoves(e); self.startY = self.element[0].offsetTop;
self.tracker.captureMouseMoves(e);
}
}); });
}, },
@ -207,6 +209,10 @@ BI.Popover = BI.inherit(BI.Widget, {
}; };
}, },
setDraggable: function (b) {
this.options.draggable = b;
},
hide: function () { hide: function () {
}, },
@ -224,9 +230,6 @@ BI.Popover = BI.inherit(BI.Widget, {
setZindex: function (zindex) { setZindex: function (zindex) {
this.element.css({ "z-index": zindex }); this.element.css({ "z-index": zindex });
}, },
destroyed: function () {
},
}); });
BI.shortcut("bi.popover", BI.Popover); BI.shortcut("bi.popover", BI.Popover);

7
src/base/list/virtualgrouplist.js

@ -79,7 +79,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
}, },
_isAutoHeight: function () { _isAutoHeight: function () {
return this.options.rowHeight === "auto"; return !BI.isNumber(this.options.rowHeight);
}, },
_renderMoreIf: function () { _renderMoreIf: function () {
@ -97,12 +97,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) { this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) {
return o.itemFormatter(item, index + i); return o.itemFormatter(item, index + i);
}), this); }), this);
var addedHeight = getElementHeight() - lastHeight; var elementHeight = getElementHeight();
var addedHeight = elementHeight - lastHeight;
this.tree.set(cnt, addedHeight); this.tree.set(cnt, addedHeight);
this.renderedIndex = cnt; this.renderedIndex = cnt;
cnt++; cnt++;
index += o.blockSize; index += o.blockSize;
lastHeight = this.renderedIndex === -1 ? 0 : getElementHeight(); lastHeight = this.renderedIndex === -1 ? 0 : elementHeight;
} }
}, },

1
src/base/pager/pager.js

@ -235,6 +235,7 @@ BI.Pager = BI.inherit(BI.Widget, {
setAllPages: function (pages) { setAllPages: function (pages) {
this.options.pages = pages; this.options.pages = pages;
this._populate();
}, },
hasPrev: function (v) { hasPrev: function (v) {

5
src/base/single/button/button.basic.js

@ -26,6 +26,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
trigger: null, trigger: null,
handler: BI.emptyFn, handler: BI.emptyFn,
bubble: null, bubble: null,
debounce: true
}); });
}, },
@ -222,10 +223,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
// 之后的300ms点击无效 // 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, { var onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true, "leading": true,
"trailing": false, "trailing": false,
}); }) : this._doClick;
function ev(e) { function ev(e) {
if (o.stopEvent) { if (o.stopEvent) {

1
src/base/single/button/buttons/button.text.js

@ -42,6 +42,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword, keyword: o.keyword,
title: null,
}); });
}, },

1
src/base/single/button/listitem/blankiconicontextitem.js

@ -62,6 +62,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}], }],
}; };

1
src/base/single/button/listitem/blankicontexticonitem.js

@ -56,6 +56,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}, { }, {
type: "bi.icon_label", type: "bi.icon_label",

1
src/base/single/button/listitem/blankicontextitem.js

@ -55,6 +55,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}], }],
}; };

1
src/base/single/button/listitem/icontexticonitem.js

@ -52,6 +52,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}, { }, {
type: "bi.icon_label", type: "bi.icon_label",

1
src/base/single/button/listitem/icontextitem.js

@ -53,6 +53,7 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}], }],
}; };

1
src/base/single/button/listitem/texticonitem.js

@ -46,6 +46,7 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}, { }, {
type: "bi.icon_label", type: "bi.icon_label",

1
src/base/single/button/listitem/textitem.js

@ -39,6 +39,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
py: o.py, py: o.py,
title: null,
}); });
}, },

1
src/base/single/button/node/icontexticonnode.js

@ -50,6 +50,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}, { }, {
type: "bi.icon_label", type: "bi.icon_label",

1
src/base/single/button/node/icontextnode.js

@ -50,6 +50,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}], }],
}; };

1
src/base/single/button/node/texticonnode.js

@ -42,6 +42,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height, height: o.height,
title: null,
}, },
}, { }, {
type: "bi.icon_label", type: "bi.icon_label",

1
src/base/single/button/node/textnode.js

@ -38,6 +38,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
py: o.py, py: o.py,
title: null,
}); });
}, },

3
src/base/single/editor/editor.textarea.js

@ -79,7 +79,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + self.getName()); BI.Widget._renderEngine.createElement(document).unbind("mousedown." + self.getName());
}); });
this.content.element.keydown(function () { this.content.element.keydown(function () {
// 水印快速消失 // 水印快速消失
self._checkWaterMark(); self._checkWaterMark();
}); });
this.content.element.keyup(function (e) { this.content.element.keyup(function (e) {
@ -111,7 +111,6 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
cls: "bi-water-mark textarea-watermark", cls: "bi-water-mark textarea-watermark",
textAlign: "left", textAlign: "left",
whiteSpace: o.scrolly ? "normal" : "nowrap", whiteSpace: o.scrolly ? "normal" : "nowrap",
title: o.watermark,
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled, disabled: o.disabled,

17
src/base/single/label/abstract.label.js

@ -24,23 +24,6 @@
}); });
}, },
getTitle: function () {
var title = this.options.title;
var text = this.options.text;
if (BI.isFunction(title)) {
return title();
}
if (BI.isNotNull(title)) {
return title;
}
if (BI.isFunction(text)) {
return text();
}
return text;
},
_createJson: function () { _createJson: function () {
var o = this.options; var o = this.options;

17
src/base/single/label/label.js

@ -10,6 +10,23 @@ BI.Label = BI.inherit(BI.AbstractLabel, {
keyword: "", keyword: "",
}, },
getTitle: function () {
var title = this.options.title;
var text = this.options.text;
if (BI.isFunction(title)) {
return title();
}
if (BI.isNotNull(title)) {
return title;
}
if (BI.isFunction(text)) {
return text();
}
return text;
},
doRedMark: function () { doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark.apply(this.text, arguments);
}, },

2
src/base/single/tip/tip.tooltip.js

@ -53,6 +53,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
whiteSpace: "normal", whiteSpace: "normal",
text: text, text: text,
textHeight: 18, textHeight: 18,
title: null,
}; };
}), }),
}); });
@ -63,6 +64,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: "normal", whiteSpace: "normal",
text: o.text, text: o.text,
title: null,
textHeight: 18, textHeight: 18,
hgap: this._const.hgap, hgap: this._const.hgap,
vgap: this._const.vgap, vgap: this._const.vgap,

5
src/case/button/icon/icon.change.js

@ -31,8 +31,11 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.IconChangeButton.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
o.iconCls = BI.isFunction(o.iconCls) ? this.__watch(o.iconCls, function (context, newValue) {
self.setIcon(newValue);
}) : o.iconCls;
BI.IconChangeButton.superclass._init.apply(this, arguments);
this.button = BI.createWidget({ this.button = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
element: this, element: this,

22
src/case/button/icon/iconhalf/icon.half.js

@ -7,16 +7,30 @@ BI.HalfButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-half-button bi-high-light-border", selected: false,
height: 14,
width: 14, width: 14,
selected: false height: 14,
iconWidth: 14,
iconHeight: 14,
}); });
}, },
render: function () {
var o = this.options;
return {
type: "bi.center_adapt",
items: [{
type: "bi.default",
cls: "bi-half-button bi-high-light-border",
width: o.iconWidth,
height: o.iconHeight,
}],
};
},
doClick: function () { doClick: function () {
BI.HalfButton.superclass.doClick.apply(this, arguments); BI.HalfButton.superclass.doClick.apply(this, arguments);
if(this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.HalfButton.EVENT_CHANGE); this.fireEvent(BI.HalfButton.EVENT_CHANGE);
} }
} }

2
src/case/button/switch.js

@ -77,7 +77,7 @@ BI.Switch = BI.inherit(BI.BasicButton, {
doClick: function () { doClick: function () {
BI.Switch.superclass.doClick.apply(this, arguments); BI.Switch.superclass.doClick.apply(this, arguments);
this.fireEvent(BI.Switch.EVENT_CHANGE); this.fireEvent(BI.Switch.EVENT_CHANGE, this.isSelected());
} }
}); });
BI.Switch.EVENT_CHANGE = "EVENT_CHANGE"; BI.Switch.EVENT_CHANGE = "EVENT_CHANGE";

9
src/case/colorchooser/colorchooser.js

@ -39,7 +39,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
width: o.el.type ? o.width : o.width - 2, width: o.el.type ? o.width : o.width - 2,
height: o.el.type ? o.height : o.height - 2 height: o.el.type ? o.height : o.height - 2
}, o.el), }, o.el),
popup: { popup: () => ({
el: BI.extend({ el: BI.extend({
type: "bi.hex_color_chooser_popup", type: "bi.hex_color_chooser_popup",
recommendColorsGetter: o.recommendColorsGetter, recommendColorsGetter: o.recommendColorsGetter,
@ -64,13 +64,13 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, o.popup), }, o.popup),
value: o.value, value: o.value,
width: 300 width: 300
}, }),
value: o.value value: o.value
}); });
var fn = function () { var fn = function () {
var color = self.colorPicker.getValue(); var color = self.colorPicker.getValue();
self.trigger.setValue(color); self.setValue(color);
}; };
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
@ -98,7 +98,8 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, },
setValue: function (color) { setValue: function (color) {
this.combo.setValue((color || "").toLowerCase()); this.options.value = (color || "").toLowerCase();
this.combo.setValue(this.options.value);
}, },
getValue: function () { getValue: function () {

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

@ -13,9 +13,10 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
text: "", text: "",
value: "", value: "",
defaultText: "", defaultText: "",
el: {},
allowClear: false, allowClear: false,
status: "success", // success | warning | error, status: "success", // success | warning | error,
title: null, title: null
}); });
}, },
@ -43,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"
}; };
}; };
@ -71,7 +72,9 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
} }
} }
], ],
...o.el
}; };
let changeTag = false;
const popup = { const popup = {
type: "bi.text_value_combo_popup", type: "bi.text_value_combo_popup",
ref: ref => this.popup = ref, ref: ref => this.popup = ref,
@ -81,15 +84,34 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
{ {
eventName: BI.TextValueComboPopup.EVENT_CHANGE, eventName: BI.TextValueComboPopup.EVENT_CHANGE,
action: (...args) => { action: (...args) => {
this.setValue(this.popup.getValue()); changeTag = true;
this.combo.hideView(); const value = this.popup.getValue();
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); this.setValue(value);
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
this.combo.hideView(...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();
}
} }
] ]
}; };
@ -101,6 +123,21 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
direction: o.direction, direction: o.direction,
adjustLength: 2, adjustLength: 2,
el: trigger, el: trigger,
listeners: [
{
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: () => {
changeTag = false;
}
}, {
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: (...args) => {
if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_SINGLE && changeTag) {
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args);
}
}
}
],
popup: { popup: {
el: popup, el: popup,
value: o.value, value: o.value,
@ -112,12 +149,13 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
const o = this.options; const o = this.options;
if (BI.isKey(o.value)) { if (BI.isKey(o.value) || BI.isObject(o.value)) {
this._checkError(o.value); this._checkError(o.value);
} }
}, },
_clear: function () { _clear: function () {
this.trigger.setText("");
this.combo.setValue(); this.combo.setValue();
this.setStatus("success"); this.setStatus("success");
}, },
@ -131,11 +169,9 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
var vals = BI.isArray(v) ? v : [v]; var vals = BI.isArray(v) ? v : [v];
var result = BI.find(this.options.items, function (idx, item) { var result = BI.intersection(BI.map(this.options.items, "value"), vals);
return BI.contains(vals, item.value);
});
if (BI.isNull(result)) { if (result.length !== vals.length) {
this.setStatus("error"); this.setStatus("error");
} else { } else {
this.setStatus("success"); this.setStatus("success");
@ -146,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);

72
src/case/combo/textvaluecombo/combo.textvaluesmall.js

@ -15,64 +15,44 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
var self = this, o = this.options; var o = this.options;
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) { return {
self.setValue(newValue); type: "bi.text_value_combo",
}) : o.value; ref: (_ref) => {
o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { this.combo = _ref;
self.populate(newValue); },
}) : o.items;
BI.SmallTextValueCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget(o.el, {
type: "bi.small_select_text_trigger",
items: o.items,
height: o.height, height: o.height,
text: o.text
});
this.popup = BI.createWidget({
type: "bi.text_value_combo_popup",
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items el: {
}); type: "bi.small_select_text_trigger",
this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { ...o.el
self.setValue(self.popup.getValue()); },
self.SmallTextValueCombo.hideView(); text: o.text,
self.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE); value: o.value,
}); defaultText: o.defaultText,
this.popup.on(BI.Controller.EVENT_CHANGE, function () { allowClear: o.allowClear,
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); status: o.status,
}); title: o.title,
this.SmallTextValueCombo = BI.createWidget({ listeners: [{
type: "bi.combo", eventName: BI.TextValueCombo.EVENT_CHANGE,
element: this, action: (...args) => {
container: o.container, this.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE, ...args);
adjustLength: 2, }
el: this.trigger, }]
popup: {
el: this.popup,
maxHeight: 240,
minHeight: 25
}
});
if(BI.isKey(o.value)){
this.setValue(o.value);
} }
}, },
setValue: function (v) { setValue: function (v) {
this.trigger.setValue(v); this.combo.setValue(v);
this.popup.setValue(v);
}, },
getValue: function () { getValue: function () {
return this.popup.getValue(); return this.combo.getValue();
}, },
populate: function (items) { populate: function (items) {
this.options.items = items; this.combo.populate(items);
this.SmallTextValueCombo.populate(items);
} }
}); });
BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE";

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

@ -6,40 +6,101 @@ 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_MULTI) {
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) {
var o = this.options; var o = this.options;
return BI.map(items, function (i, item) { return BI.map(items, function (i, item) {
return BI.extend({ return BI.extend({
type: "bi.single_select_item", type: o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI ? "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_MULTI) {
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_MULTI) {
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);

1
src/case/pager/pager.js → src/case/pager/pager.detail.js

@ -223,6 +223,7 @@ BI.DetailPager = BI.inherit(BI.Widget, {
setAllPages: function (pages) { setAllPages: function (pages) {
this.options.pages = pages; this.options.pages = pages;
this._populate();
}, },
hasPrev: function (v) { hasPrev: function (v) {

45
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,
@ -52,40 +51,31 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_digest: function (val, items) { _digest: function (val, items) {
var o = this.options; var o = this.options;
val = BI.isArray(val) ? val[0] : val;
val = BI.isArray(val) ? val.slice() : [val];
var result = [];
// 提升valueFormatter的优先级 // 提升valueFormatter的优先级
if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) { if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) {
return { BI.each(val, function (index, v) {
text: o.valueFormatter(val), result.push(o.valueFormatter(v));
}; });
return result.join(",");
} }
var result = [];
var formatItems = BI.Tree.transformToArrayFormat(items); var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) { BI.each(formatItems, function (i, item) {
if (val === item.value && !BI.contains(result, item.text || item.value)) { if (BI.contains(val, item.value) && !BI.contains(result, item.text || item.value)) {
result.push(item.text || item.value); result.push(item.text || item.value);
BI.remove(val, item.value);
} }
}); });
if (result.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: o.text
};
} }
}, },
@ -95,9 +85,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) {

179
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].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);
@ -840,6 +851,40 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
return this._getChildren(parentValues).length; return this._getChildren(parentValues).length;
}, },
assertSelectedValue: function (selectedValues, items = []) {
if (BI.isPlainObject(selectedValues)) {
return selectedValues;
}
var tree = BI.Tree.transformToTreeFormat(items);
var value2ParentMap = {};
BI.Tree.traversal(tree, function (index, node, pNode) {
value2ParentMap[node.value] = pNode;
});
var result = {};
BI.each(selectedValues, function (index, value) {
var curr = value;
var parentPath = [];
while (curr) {
parentPath.unshift(curr);
curr = value2ParentMap[curr]?.value;
}
BI.each(parentPath, function (index) {
if (BI.isNull(BI.get(result, parentPath.slice(0, index + 1)))) {
BI.set(result, parentPath.slice(0, index + 1), {});
}
});
// 执行完一条路径,check一下
var lengths = BI.size(BI.get(result, parentPath.slice(0, -1)));
if (lengths === value2ParentMap[value]?.children?.length) {
BI.set(result, parentPath.slice(0, -1), {});
}
});
return result;
},
buildCompleteTree: function (selectedValues) { buildCompleteTree: function (selectedValues) {
var self = this; var self = this;
var result = {}; var result = {};

2
src/component/treevaluechooser/combo.treevaluechooser.js

@ -30,7 +30,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
value: o.value, value: this.assertSelectedValue(o.value, o.items),
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),

4
src/component/treevaluechooser/pane.treevaluechooser.js

@ -29,6 +29,10 @@ 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)) {
var selectedValues = this.assertSelectedValue(o.value, o.items);
this.pane.setSelectedValue(selectedValues);
}
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

14
src/core/4.widget.js

@ -360,6 +360,7 @@
var workerMode = BI.Providers.getProvider("bi.provider.system").getWorkerMode(); var workerMode = BI.Providers.getProvider("bi.provider.system").getWorkerMode();
var render = BI.isFunction(this.options.render) ? this.options.render : (workerMode ? (this.$render || this.render) : this.render); var render = BI.isFunction(this.options.render) ? this.options.render : (workerMode ? (this.$render || this.render) : this.render);
var els = render && render.call(this); var els = render && render.call(this);
els = this.options.configRender ? this.options.configRender(els) : els;
els = BI.Plugin.getRender(this.options.type, els); els = BI.Plugin.getRender(this.options.type, els);
if (BI.isPlainObject(els)) { if (BI.isPlainObject(els)) {
els = [els]; els = [els];
@ -743,12 +744,22 @@
}, },
_unMount: function () { _unMount: function () {
this._assetMounted();
this.__destroy(); this.__destroy();
this.fireEvent(BI.Events.UNMOUNT); this.fireEvent(BI.Events.UNMOUNT);
this.purgeListeners(); this.purgeListeners();
}, },
_assetMounted: function () {
if (!this.isVisible()) {
this._setVisible(true);
this._mount(false, false, false);
this._setVisible(false);
}
},
_empty: function () { _empty: function () {
this._assetMounted();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount(); widget && widget._unMount && widget._unMount();
}); });
@ -790,6 +801,7 @@
}); });
}); });
this._watchers && (this._watchers = []); this._watchers && (this._watchers = []);
this._assetMounted();
this.__d(); this.__d();
this.element.empty(); this.element.empty();
this.element.unbind(); this.element.unbind();
@ -799,6 +811,7 @@
}, },
_destroy: function () { _destroy: function () {
this._assetMounted();
this.__destroy(); this.__destroy();
this.element.destroy(); this.element.destroy();
this.purgeListeners(); this.purgeListeners();
@ -806,6 +819,7 @@
destroy: function () { destroy: function () {
var self = this, o = this.options; var self = this, o = this.options;
this._assetMounted();
this.__destroy(); this.__destroy();
if (o.animation) { if (o.animation) {
this._innerSetVisible(false); this._innerSetVisible(false);

14
src/core/5.inject.js

@ -411,7 +411,7 @@
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config, context, lazy) { var createWidget = function (config, context, lazy) {
var cls = kv[config.type]; var cls = BI.isFunction(config.type) ? config.type : kv[config.type];
if (!cls) { if (!cls) {
throw new Error("组件: [" + config.type + "] 未定义"); throw new Error("组件: [" + config.type + "] 未定义");
@ -451,7 +451,8 @@
} }
if (el) { if (el) {
runConfigFunction(el.type); var elType = (el.type && el.type.xtype) || el.type;
runConfigFunction(elType);
} }
// 先把准备环境准备好 // 先把准备环境准备好
@ -466,13 +467,14 @@
return item; return item;
} }
if (el) { if (el) {
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(elType, el);
if (w.type === el.type) { var wType = (w.type && w.type.xtype) || w.type;
if (BI.Plugin.hasObject(el.type)) { if (wType === elType) {
if (BI.Plugin.hasObject(elType)) {
w.listeners = (w.listeners || []).concat([{ w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT, eventName: BI.Events.MOUNT,
action: function () { action: function () {
BI.Plugin.getObject(el.type, this); BI.Plugin.getObject(elType, this);
} }
}]); }]);
} }

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 BI._.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
}, BI.isNotNull);
} }
}); });
@ -85,7 +89,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
} else { } else {
layout = "bi.htape"; layout = "bi.htape";
} }
return { return BI._.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
}, BI.isNotNull);
} }
}); });
@ -135,19 +143,21 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
} else { } else {
layout = "bi.window"; layout = "bi.window";
} }
return { return BI._.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
}, BI.isNotNull);
} }
}); });
@ -188,9 +198,8 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
} else { } else {
layout = "bi.htape"; layout = "bi.htape";
} }
return { return BI._.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
}, BI.isNotNull);
} }
}); });

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

29
src/core/platform/web/detectElementResize.js

@ -112,7 +112,21 @@
}; };
var addResizeListener = function (element, fn) { var addResizeListener = function (element, fn) {
if (attachEvent) { if (window.ResizeObserver) {
if (!element.__resizeObserver__) {
var resizeObserver = new window.ResizeObserver(function () {
element.__resizeListeners__.forEach(function (listener) {
listener();
});
});
resizeObserver.observe(element);
element.__resizeObserver__ = resizeObserver;
}
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
}
element.__resizeListeners__.push(fn);
} else if (attachEvent) {
element.attachEvent("onresize", fn); element.attachEvent("onresize", fn);
BI.nextTick(fn); BI.nextTick(fn);
} else { } else {
@ -137,8 +151,17 @@
} }
}; };
var removeResizeListener = function (element, fn) { var removeResizeListener = function (element, fn) {
if (attachEvent) element.detachEvent("onresize", fn); if (window.ResizeObserver) {
else { var index = element.__resizeListeners__.indexOf(fn);
if (index >= 0) {
element.__resizeListeners__.splice(index, 1);
if (!element.__resizeListeners__.length) {
element.__resizeObserver__ && element.__resizeObserver__.unobserve(element);
}
}
} else if (attachEvent) {
element.detachEvent("onresize", fn);
} else {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) { if (!element.__resizeListeners__.length) {
element.removeEventListener("scroll", scrollListener); element.removeEventListener("scroll", scrollListener);

90
src/core/platform/web/jquery/_jquery.js vendored

@ -1,5 +1,5 @@
/*! /*!
* jQuery JavaScript Library v1.12.4 * jQuery JavaScript Library v3.6.1
* http://jquery.com/ * http://jquery.com/
* *
* Includes Sizzle.js * Includes Sizzle.js
@ -63,16 +63,15 @@
var support = {}; var support = {};
var var
version = "1.12.4", version = "3.6.1",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function (selector, context) {
// The jQuery object is actually just the init constructor 'enhanced' // The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included) // Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context ); return new jQuery.fn.init(selector, context);
}, },
// Support: Android<4.1, IE<9 // Support: Android<4.1, IE<9
@ -10358,20 +10357,27 @@
function createStandardXHR() { function createStandardXHR() {
try { try {
return new window.XMLHttpRequest(); return new window.XMLHttpRequest();
} catch ( e ) {} } catch (e) {
}
} }
function createActiveXHR() { function createActiveXHR() {
try { try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" ); return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch ( e ) {} } catch (e) {
}
} }
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter(function (s) {
if (s.crossDomain) {
s.contents.script = false;
}
});
// Install script dataType // Install script dataType
jQuery.ajaxSetup( { jQuery.ajaxSetup({
accepts: { accepts: {
script: "text/javascript, application/javascript, " + script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript" "application/ecmascript, application/x-ecmascript"
@ -10537,54 +10543,82 @@
s.jsonpCallback = originalSettings.jsonpCallback; s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use // save the callback name for future use
oldCallbacks.push( callbackName ); oldCallbacks.push(callbackName);
} }
// Call if it was a function and we have a response // Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) { if (responseContainer && jQuery.isFunction(overwritten)) {
overwritten( responseContainer[ 0 ] ); overwritten(responseContainer[0]);
} }
responseContainer = overwritten = undefined; responseContainer = overwritten = undefined;
} ); });
// Delegate to script // Delegate to script
return "script"; return "script";
} }
} ); });
// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = (function () {
var body = document.implementation.createHTMLDocument("").body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
})();
// data: string of html // data: string of html
// context (optional): If specified, the fragment will be created in this context, // context (optional): If specified, the fragment will be created in this context,
// defaults to document // defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string // keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) { jQuery.parseHTML = function (data, context, keepScripts) {
if ( !data || typeof data !== "string" ) { if (!data || typeof data !== "string") {
return null; return null;
} }
if ( typeof context === "boolean" ) { if (typeof context === "boolean") {
keepScripts = context; keepScripts = context;
context = false; context = false;
} }
context = context || document;
var parsed = rsingleTag.exec( data ), var base, parsed, scripts;
scripts = !keepScripts && [];
if (!context) {
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
if (support.createHTMLDocument) {
context = document.implementation.createHTMLDocument("");
// Set the base href for the created document
// so any parsed elements with URLs
// are based on the document's URL (gh-2965)
base = context.createElement("base");
base.href = document.location.href;
context.head.appendChild(base);
} else {
context = document;
}
}
parsed = rsingleTag.exec(data);
scripts = !keepScripts && [];
// Single tag // Single tag
if ( parsed ) { if (parsed) {
return [ context.createElement( parsed[ 1 ] ) ]; return [context.createElement(parsed[1])];
} }
parsed = buildFragment( [ data ], context, scripts ); parsed = buildFragment([data], context, scripts);
if ( scripts && scripts.length ) { if (scripts && scripts.length) {
jQuery( scripts ).remove(); jQuery(scripts).remove();
} }
return jQuery.merge( [], parsed.childNodes ); return jQuery.merge([], parsed.childNodes);
}; };

22
src/core/utils/i18n.js

@ -1,5 +1,8 @@
!(function () { !(function () {
var i18nStore = {}; var i18nStore = {};
var i18nFormatters = {};
BI._.extend(BI, { BI._.extend(BI, {
changeI18n: function (i18n) { changeI18n: function (i18n) {
if (i18n) { if (i18n) {
@ -9,6 +12,7 @@
addI18n: function (i18n) { addI18n: function (i18n) {
BI.extend(i18nStore, i18n); BI.extend(i18nStore, i18n);
}, },
i18nText: function (key) { i18nText: function (key) {
var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || ""; var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || "";
if (!localeText) { if (!localeText) {
@ -16,10 +20,18 @@
} }
var len = arguments.length; var len = arguments.length;
if (len > 1) { if (len > 1) {
if (localeText.indexOf("{R1}") > -1) { if (localeText.indexOf("{R1") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var reg = new RegExp(`{R${i},(.*?)}`, "g");
localeText = BI.replaceAll(localeText, key, arguments[i] + "");
var result = reg.exec(localeText);
if (result) {
var formatName = result[1];
localeText = BI.replaceAll(localeText, reg, i18nFormatters[formatName](key, arguments[i]));
} else {
localeText = BI.replaceAll(localeText, `{R${i}}`, arguments[i] + "");
}
} }
} else { } else {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
@ -30,6 +42,10 @@
} }
} }
return localeText; return localeText;
},
addI18nFormatter: function (formatName, fn) {
i18nFormatters[formatName] = fn;
} }
}); });
})(); })();

9
src/less/base/single/html.less

@ -18,8 +18,6 @@
canvas, canvas,
video { video {
display: inline-block; display: inline-block;
*display: inline;
*zoom: 1
} }
audio:not([controls]) { audio:not([controls]) {
display: none; display: none;
@ -180,7 +178,6 @@
border: 0; border: 0;
padding: 0; padding: 0;
white-space: normal; white-space: normal;
*margin-left: -7px
} }
button, button,
input, input,
@ -189,7 +186,6 @@
font-size: 100%; font-size: 100%;
margin: 0; margin: 0;
vertical-align: baseline; vertical-align: baseline;
*vertical-align: middle
} }
button, button,
input { input {
@ -201,7 +197,6 @@
input[type="submit"] { input[type="submit"] {
-webkit-appearance: button; -webkit-appearance: button;
cursor: pointer; cursor: pointer;
*overflow: visible
} }
button[disabled], button[disabled],
input[disabled] { input[disabled] {
@ -211,8 +206,8 @@
input[type="radio"] { input[type="radio"] {
box-sizing: border-box; box-sizing: border-box;
padding: 0; padding: 0;
*height: 13px; height: 13px;
*width: 13px width: 13px
} }
input[type="search"] { input[type="search"] {
-webkit-appearance: textfield; -webkit-appearance: textfield;

7
src/less/base/tree/ztree.less

@ -130,7 +130,6 @@
margin: 0; margin: 0;
font-size: 12px; font-size: 12px;
border: 1px #7EC4CC solid; border: 1px #7EC4CC solid;
*border: 0px
} }
.ztree li span { .ztree li span {
@ -315,42 +314,36 @@
margin-right: 2px; margin-right: 2px;
background-position: -110px -16px; background-position: -110px -16px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.ico_close { .ztree li span.button.ico_close {
margin-right: 2px; margin-right: 2px;
background-position: -110px 0; background-position: -110px 0;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.ico_docu { .ztree li span.button.ico_docu {
margin-right: 2px; margin-right: 2px;
background-position: -110px -32px; background-position: -110px -32px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.edit { .ztree li span.button.edit {
margin-right: 2px; margin-right: 2px;
background-position: -110px -48px; background-position: -110px -48px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.remove { .ztree li span.button.remove {
margin-right: 2px; margin-right: 2px;
background-position: -110px -64px; background-position: -110px -64px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
.ztree li span.button.ico_loading { .ztree li span.button.ico_loading {
width: 0px; width: 0px;
margin-right: 2px; margin-right: 2px;
vertical-align: top; vertical-align: top;
*vertical-align: middle
} }
ul.tmpTargetzTree { ul.tmpTargetzTree {

2
src/less/base/trigger/trigger.less

@ -1,7 +1,7 @@
@import "../../index.less"; @import "../../index.less";
.bi-trigger{ .bi-trigger{
& .bi-trigger-icon-button{ & .bi-trigger-icon-button, &.bi-trigger-icon-button {
font-size: @font-size-16; font-size: @font-size-16;
} }
} }

25
src/less/core/utils/common.less

@ -2,6 +2,19 @@
.base-disabled { .base-disabled {
cursor: not-allowed !important; cursor: not-allowed !important;
.cursor-pointer {
cursor: not-allowed !important;
}
.cursor-default {
cursor: not-allowed !important;
}
.cursor-move {
cursor: not-allowed !important;
}
.cursor-text{
cursor: not-allowed !important;
}
color: @color-bi-text-disabled !important; color: @color-bi-text-disabled !important;
& .bi-input { & .bi-input {
@ -41,6 +54,18 @@
.base-invalid { .base-invalid {
cursor: default !important; cursor: default !important;
.cursor-pointer {
cursor: default !important;
}
.cursor-default {
cursor: default !important;
}
.cursor-move {
cursor: default !important;
}
.cursor-text{
cursor: default !important;
}
} }
//focus时边框高亮 //focus时边框高亮

1
src/less/lib/font.less

@ -23,6 +23,7 @@
@font-arrow-left: "e1bc"; @font-arrow-left: "e1bc";
@font-arrow-right: "e1bd"; @font-arrow-right: "e1bd";
@font-arrow-bottom: "e1a4";
@font-up-triangle: "e1c6"; @font-up-triangle: "e1c6";
@font-down-triangle: "e1c9"; @font-down-triangle: "e1c9";

2
src/less/resource/font.less

@ -66,7 +66,7 @@
//实心下拉三角 //实心下拉三角
.font-hover(solid-triangle-left-font, @font-solid-left); .font-hover(solid-triangle-left-font, @font-solid-left);
.font-hover(solid-triangle-top-font, @font-solid-top); .font-hover(solid-triangle-top-font, @font-solid-top);
.font-hover(solid-triangle-bottom-font, @font-solid-bottom); .font-hover(solid-triangle-bottom-font, @font-arrow-bottom);
//实心展开三角 //实心展开三角
.font(expander-right-font, @font-solid-right); .font(expander-right-font, @font-solid-right);
.font(expander-down-font, @font-solid-bottom); .font(expander-down-font, @font-solid-bottom);

10
src/less/widget/multilayersingletree/multilayersingletree.combo.less

@ -1,6 +1,16 @@
@import "../../index.less"; @import "../../index.less";
@val: transform .3s ease;
.bi-multilayer-single-tree-combo { .bi-multilayer-single-tree-combo {
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
}
}
&.status-error { &.status-error {
&.bi-border, &.bi-border-bottom { &.bi-border, &.bi-border-bottom {
border-color: @border-color-negative; border-color: @border-color-negative;

2
src/router/router.js

@ -2326,7 +2326,7 @@
route.matched[lastRouteIndex] === current.matched[lastCurrentIndex] route.matched[lastRouteIndex] === current.matched[lastCurrentIndex]
) { ) {
this.ensureURL(); this.ensureURL();
return abort(createNavigationDuplicatedError(current, route)) return;
} }
var ref = resolveQueue( var ref = resolveQueue(

223
src/widget/downlist/combo.downlist.js

@ -1,110 +1,139 @@
/** (function() {
* Created by roy on 15/8/14. function transformItems(items) {
*/ if (!items) return items;
BI.DownListCombo = BI.inherit(BI.Widget, { var result = BI.cloneDeep(items);
_defaultConfig: function () { var isComplexItmes = BI.some(items, function (_, item) {
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), { return BI.isArray(item);
baseCls: "bi-down-list-combo",
height: 24,
items: [],
adjustLength: 0,
direction: "bottom",
trigger: "click",
container: null,
stopPropagation: false,
el: {},
minWidth: 140,
maxHeight: 1000,
destroyWhenHide: false
}); });
}, // 传一维数组,帮转二维
if (!isComplexItmes) {
result = [result];
}
// 帮转 el
BI.each(result, function (_, arr) {
BI.each(arr, function (_, item) {
if (item.children && !item.el) {
item.el = {
text: item.text,
icon: item.icon,
cls: item.cls,
iconCls1: item.iconCls1,
value: item.value
};
}
});
});
return result;
}
_init: function () { /**
BI.DownListCombo.superclass._init.apply(this, arguments); * Created by roy on 15/8/14.
var self = this, o = this.options; */
BI.DownListCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-down-list-combo",
height: 24,
items: [],
adjustLength: 0,
direction: "bottom",
trigger: "click",
container: null,
stopPropagation: false,
el: {},
minWidth: 140,
maxHeight: 1000,
destroyWhenHide: false
});
},
this.downlistcombo = BI.createWidget({ _init: function () {
element: this, BI.DownListCombo.superclass._init.apply(this, arguments);
type: "bi.combo", var self = this, o = this.options;
trigger: o.trigger,
isNeedAdjustWidth: false, this.downlistcombo = BI.createWidget({
isDefaultInit: true, element: this,
container: o.container, type: "bi.combo",
adjustLength: o.adjustLength, trigger: o.trigger,
direction: o.direction, isNeedAdjustWidth: false,
belowMouse: o.belowMouse, isDefaultInit: true,
stopPropagation: o.stopPropagation, container: o.container,
destroyWhenHide: o.destroyWhenHide, adjustLength: o.adjustLength,
el: BI.createWidget(o.el, { direction: o.direction,
type: "bi.icon_trigger", belowMouse: o.belowMouse,
extraCls: o.iconCls,
width: o.width,
height: o.height
}),
popup: {
el: {
type: "bi.down_list_popup",
ref: function (ref) {
self.popupView = ref;
},
items: o.items,
chooseType: o.chooseType,
value: o.value,
listeners: [{
eventName: BI.DownListPopup.EVENT_CHANGE,
action: function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
}
}, {
eventName: BI.DownListPopup.EVENT_SON_VALUE_CHANGE,
action: function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
}
}]
},
stopPropagation: o.stopPropagation, stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight, destroyWhenHide: o.destroyWhenHide,
minWidth: o.minWidth el: BI.createWidget(o.el, {
} type: "bi.icon_trigger",
}); extraCls: o.iconCls,
width: o.width,
height: o.height
}),
popup: {
el: {
type: "bi.down_list_popup",
ref: function (ref) {
self.popupView = ref;
},
items: transformItems(o.items),
chooseType: o.chooseType,
value: o.value,
listeners: [{
eventName: BI.DownListPopup.EVENT_CHANGE,
action: function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
}
}, {
eventName: BI.DownListPopup.EVENT_SON_VALUE_CHANGE,
action: function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
}
}]
},
stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight,
minWidth: o.minWidth
}
});
this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
}); });
}, },
hideView: function () { hideView: function () {
this.downlistcombo.hideView(); this.downlistcombo.hideView();
}, },
showView: function (e) { showView: function (e) {
this.downlistcombo.showView(e); this.downlistcombo.showView(e);
}, },
populate: function (items) { populate: function (items) {
this.popupView.populate(items); this.popupView.populate(items);
}, },
setValue: function (v) { setValue: function (v) {
this.popupView.setValue(v); this.popupView.setValue(v);
}, },
getValue: function () { getValue: function () {
return this.popupView.getValue(); return this.popupView.getValue();
}, },
adjustWidth: function () { adjustWidth: function () {
this.downlistcombo.adjustWidth(); this.downlistcombo.adjustWidth();
}, },
adjustHeight: function () { adjustHeight: function () {
this.downlistcombo.adjustHeight(); this.downlistcombo.adjustHeight();
} }
}); });
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.down_list_combo", BI.DownListCombo); BI.shortcut("bi.down_list_combo", BI.DownListCombo);
}());

16
src/widget/downlist/item.downlist.js

@ -33,17 +33,21 @@ BI.DownListItem = BI.inherit(BI.BasicButton, {
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}); });
var icon = BI.isPlainObject(o.icon) ? o.icon : {
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight,
}
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: 36, width: 36,
height: o.height, height: o.height,
items: [{ items: [{
el: { el: icon,
type: "bi.icon", }],
width: o.iconWidth,
height: o.iconHeight
}
}]
}); });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({

66
src/widget/downlist/item.downlistgroup.js

@ -8,11 +8,11 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
}, },
// invalid: true, // invalid: true,
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
icon: "",
iconCls2: "pull-right-e-font" iconCls2: "pull-right-e-font"
}); });
}, },
_init: function () { render: function () {
BI.DownListGroupItem.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
var self = this; var self = this;
this.text = BI.createWidget({ this.text = BI.createWidget({
@ -21,20 +21,29 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height
});
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
width: 36,
height: o.height, height: o.height,
iconHeight: o.iconHeight,
iconWidth: 36,
disableSelected: true,
selected: this._digest(o.value)
}); });
if (BI.isPlainObject(o.icon)) {
this.icon1 = BI.createWidget({
width: 36,
height: o.height,
type: "bi.center_adapt",
items: [o.icon],
});
} else {
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
width: 36,
height: o.height,
iconHeight: o.iconHeight,
iconWidth: 36,
disableSelected: true,
selected: this._digest(o.value),
});
}
this.icon2 = BI.createWidget({ this.icon2 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls2, cls: o.iconCls2,
@ -42,27 +51,6 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
forceNotSelected: true forceNotSelected: true
}); });
var blank = BI.createWidget({
type: "bi.layout",
width: 24
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.icon2,
top: 0,
bottom: 0,
right: 0
}]
});
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank)
}))));
this.element.hover(function () { this.element.hover(function () {
if (self.isEnabled()) { if (self.isEnabled()) {
self.hover(); self.hover();
@ -72,6 +60,12 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
self.dishover(); self.dishover();
} }
}); });
return {
type: "bi.horizontal_fill",
columnSize: [36, "fill", 24],
items: [this.icon1, this.text, this.icon2]
}
}, },
_getLevel: function () { _getLevel: function () {
@ -117,8 +111,8 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
}, },
setValue: function (v) { setValue: function (v) {
this.icon1.setSelected(this._digest(v)); this.icon1.setSelected && this.icon1.setSelected(this._digest(v));
} },
}); });
BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem); BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem);

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

@ -20,7 +20,7 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.sign_editor", type: "bi.sign_editor",
cls: "bi-border", cls: "bi-border bi-focus-shadow bi-border-radius",
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2, height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2,
validationChecker: function (v) { validationChecker: function (v) {
return BI.isNaturalNumber(v); return BI.isNaturalNumber(v);

8
src/widget/dynamicdate/dynamicdate.trigger.js

@ -9,7 +9,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24 iconWidth: 24
}, },
props: { props: () => ({
extraCls: "bi-date-trigger", extraCls: "bi-date-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -17,8 +17,8 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24, iconWidth: 24,
format: "", // 显示的日期格式化方式 format: "", // 显示的日期格式化方式
allowEdit: true, // 是否允许编辑 allowEdit: true, // 是否允许编辑
watermark: "" watermark: BI.i18nText("BI-Basic_Unrestricted"),
}, }),
_init: function () { _init: function () {
BI.DynamicDateTrigger.superclass._init.apply(this, arguments); BI.DynamicDateTrigger.superclass._init.apply(this, arguments);
@ -44,7 +44,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true, allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), watermark: o.watermark,
errorText: function (v) { errorText: function (v) {
var str = ""; var str = "";
if (!BI.isKey(o.format)) { if (!BI.isKey(o.format)) {

25
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",

4
src/widget/multilayerdownlist/popup.downlist.js

@ -99,7 +99,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
item.el.logic = { item.el.logic = {
dynamic: true dynamic: true
}; };
item.el.height = sourceItem.el.height || self.constants.height; item.el.height = sourceItem.el.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT;
item.el.iconCls2 = self.constants.nextIcon; item.el.iconCls2 = self.constants.nextIcon;
item.popup = { item.popup = {
lgap: 1, lgap: 1,
@ -183,7 +183,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
if (BI.isNotEmptyArray(child.children)) { if (BI.isNotEmptyArray(child.children)) {
item.type = "bi.down_list_group_item"; item.type = "bi.down_list_group_item";
item.iconCls2 = self.constants.nextIcon; item.iconCls2 = self.constants.nextIcon;
item.height = child.height || self.constants.height; item.height = child.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT;
self._createChildren(item, child); self._createChildren(item, child);
} }
targetItem.items.push(item); targetItem.items.push(item);

3
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -35,7 +35,6 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var baseConfig = this._getBaseConfig(); var baseConfig = this._getBaseConfig();
if (o.allowEdit) { if (o.allowEdit) {
return { return {
type: "bi.absolute", type: "bi.absolute",
@ -210,7 +209,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.trigger_icon_button", type: "bi.trigger_icon_button",
cls: "trigger-icon-button", cls: "bi-trigger trigger-icon-button",
ref: function (_ref) { ref: function (_ref) {
self.triggerBtn = _ref; self.triggerBtn = _ref;
}, },

101
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -33,14 +33,48 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); var cls = (o.simple ? "bi-border-bottom " : "bi-border bi-border-radius ") + (BI.isKey(o.status) ? ("status-" + o.status) : "");
var baseConfig = this._getBaseConfig();
if (o.allowEdit) {
return {
type: "bi.absolute",
cls,
items: [
{
el: BI.extend(baseConfig, this._getSearchConfig()),
top: 0, bottom: 0, right: 0, left: 0
}, {
el: self._getTriggerIconButton(),
top: 0, bottom: 0, right: 0,
},
]
};
}
return BI.extend(baseConfig, {
el: {
type: "bi.single_tree_trigger",
ref: function (_ref) {
self.textTrigger = _ref;
},
text: o.text,
defaultText: o.defaultText,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
},
}, { cls });
}, },
_getBaseConfig: function () { _getBaseConfig: function () {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.combo", type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius ") + (BI.isKey(o.status) ? ("status-" + o.status) : ""),
container: o.container, container: o.container,
destroyWhenHide: o.destroyWhenHide, destroyWhenHide: o.destroyWhenHide,
adjustLength: 2, adjustLength: 2,
@ -152,7 +186,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
// IE11下,popover(position: fixed)下放置下拉控件(position: fixed), 滚动的时候会异常卡顿 // IE11下,popover(position: fixed)下放置下拉控件(position: fixed), 滚动的时候会异常卡顿
// 通过container参数将popup放置于popover之外解决此问题, 其他下拉控件由于元素少或者有分页,所以 // 通过container参数将popup放置于popover之外解决此问题, 其他下拉控件由于元素少或者有分页,所以
// 卡顿不明显, 先在此做尝试, 并在FineUI特殊处理待解决文档中标记跟踪 // 卡顿不明显, 先在此做尝试, 并在FineUI特殊处理待解决文档中标记跟踪
return !(o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0); return (o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0) ? false : self.triggerBtn?.element.find(e.target).length === 0;
}, },
listeners: [{ listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
@ -168,46 +202,29 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
}; };
}, },
_getSyncConfig: function () { _getTriggerIconButton: function () {
var o = this.options, self = this; var self = this, o = this.options;
var baseConfig = this._getBaseConfig(); return {
return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : { type: "bi.trigger_icon_button",
el: { cls: "bi-trigger trigger-icon-button",
type: "bi.single_tree_trigger", ref: function (_ref) {
ref: function (_ref) { self.triggerBtn = _ref;
self.textTrigger = _ref;
},
text: o.text,
defaultText: o.defaultText,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
},
});
},
_getAsyncConfig: function () {
var o = this.options, self = this;
var baseConfig = this._getBaseConfig();
return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : {
el: {
type: "bi.single_tree_trigger",
ref: function (_ref) {
self.textTrigger = _ref;
},
text: o.text,
defaultText: o.defaultText,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
}, },
}); width: o.height,
height: o.height,
listeners: [
{
eventName: BI.TriggerIconButton.EVENT_CHANGE,
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
}
]
};
}, },
getSearcher: function () { getSearcher: function () {

13
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -102,17 +102,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
}] }]
}, },
width: "fill", width: "fill",
}, { rgap: 24,
el: { },
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: 24,
},
width: 24
}
] ]
}; };
}, },

22
src/widget/multiselect/check/multiselect.display.js

@ -26,6 +26,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
var self = this, opts = this.options; var self = this, opts = this.options;
this.hasNext = false; this.hasNext = false;
var cacheItems = [];
this.button_group = BI.createWidget({ this.button_group = BI.createWidget({
type: "bi.list_pane", type: "bi.list_pane",
@ -45,10 +46,29 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
}] }]
}, },
itemsCreator: function (options, callback) { itemsCreator: function (options, callback) {
if (options.times === 1) {
cacheItems = [];
}
if (cacheItems.length > 0) {
var renderedItems = cacheItems.slice(0, 100);
cacheItems = cacheItems.slice(100);
self.hasNext = true;
if (cacheItems.length === 0) {
self.hasNext = false;
}
callback(self._createItems(renderedItems));
return;
}
opts.itemsCreator(options, function (ob) { opts.itemsCreator(options, function (ob) {
self.hasNext = !!ob.hasNext; self.hasNext = !!ob.hasNext;
callback(self._createItems(ob.items)); var firstItemsCount = 100 + ob.items.length % 100;
if (ob.items.length > 100) {
cacheItems = ob.items.slice(100 + ob.items.length % 100);
self.hasNext = true;
}
callback(self._createItems(ob.items.slice(0, firstItemsCount)));
}); });
}, },
hasNext: function () { hasNext: function () {

9
src/widget/multiselect/loader.js

@ -167,7 +167,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
}]); }]);
return false; return false;
} }
this.options.items = (items || []).slice(0, 100); this.options.items = (items || []).slice(0, 100 + (items || []).length % 100);
this.times = 1; this.times = 1;
this.count = 0; this.count = 0;
this.count += items.length; this.count += items.length;
@ -184,14 +184,15 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
populate: function (items, keyword) { populate: function (items, keyword) {
if (this._populate.apply(this, arguments)) { if (this._populate.apply(this, arguments)) {
this.cachItems = []; this.cachItems = [];
if (items.length > 100) { var firstItemsCount = 100 + items.length % 100;
this.cachItems = items.slice(100); if (items.length > firstItemsCount) {
this.cachItems = items.slice(firstItemsCount);
} }
var renderEngine = BI.Widget._renderEngine; var renderEngine = BI.Widget._renderEngine;
BI.Widget.registerRenderEngine(BI.Element.renderEngine); BI.Widget.registerRenderEngine(BI.Element.renderEngine);
this.cachGroup.populate.call(this.cachGroup, items, keyword); this.cachGroup.populate.call(this.cachGroup, items, keyword);
BI.Widget.registerRenderEngine(renderEngine); BI.Widget.registerRenderEngine(renderEngine);
this.button_group.populate.call(this.button_group, items.slice(0, 100), keyword); this.button_group.populate.call(this.button_group, items.slice(0, firstItemsCount), keyword);
} }
}, },

2
src/widget/multiselect/multiselect.combo.js

@ -35,7 +35,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue); self.numberCounter.setButtonChecked(self.storeValue);
}; };
this.storeValue = o.value || {}; this.storeValue = BI.deepClone(o.value) || {};
this._assertValue(this.storeValue); this._assertValue(this.storeValue);

2
src/widget/multiselect/multiselect.combo.nobar.js

@ -34,7 +34,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
}; };
this.storeValue = { this.storeValue = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: o.value || [] value: BI.deepClone(o.value) || []
}; };
// 标记正在请求数据 // 标记正在请求数据
this.requesting = false; this.requesting = false;

2
src/widget/multiselect/multiselect.insert.combo.js

@ -33,7 +33,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue); self.numberCounter.setButtonChecked(self.storeValue);
}; };
this.storeValue = o.value || {}; this.storeValue = BI.deepClone(o.value) || {};
// 标记正在请求数据 // 标记正在请求数据
this.requesting = false; this.requesting = false;

2
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -34,7 +34,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}; };
this.storeValue = { this.storeValue = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: o.value || [] value: BI.deepClone(o.value) || []
}; };
// 标记正在请求数据 // 标记正在请求数据
this.requesting = false; this.requesting = false;

2
src/widget/multiselectlist/multiselectlist.insert.js

@ -15,7 +15,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
BI.MultiSelectInsertList.superclass._init.apply(this, arguments); BI.MultiSelectInsertList.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = this._assertValue(o.value || {}); this.storeValue = this._assertValue(BI.deepClone(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));

2
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -16,7 +16,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = { this.storeValue = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: o.value || [] value: BI.deepClone(o.value) || []
}; };
var assertShowValue = function () { var assertShowValue = function () {

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(BI.deepClone(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) {

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

@ -80,6 +80,7 @@ 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.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue());
} }
}, { }, {

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: self.combo.getValue() };
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: self.combo.getValue() };
self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.getValue());
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,

14
src/widget/numbereditor/number.editor.js

@ -10,6 +10,9 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
valueFormatter: function (v) { valueFormatter: function (v) {
return v; return v;
}, },
valueParser: function (v) {
return v;
},
value: 0, value: 0,
allowBlank: false, allowBlank: false,
errorText: "", errorText: "",
@ -30,14 +33,19 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
value: o.valueFormatter(o.value), value: o.valueFormatter(o.value),
validationChecker: function (v) { validationChecker: function (v) {
// 不设置validationChecker就自动检测 // 不设置validationChecker就自动检测
if(o.validationChecker === BI.emptyFn && !self._checkValueInRange(v)) { var parsedValue = o.valueParser(v);
if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) {
return false; return false;
} }
return o.validationChecker(v); return o.validationChecker(parsedValue);
}, },
errorText: o.errorText errorText: o.errorText
}); });
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
// 大多数时候valueFormatter往往需要配合valueParser一起使用
var value = this.getValue();
var parsedValue = o.valueParser(value);
this.setValue(o.valueFormatter(parsedValue));
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
@ -57,6 +65,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
forceNotSelected: true, forceNotSelected: true,
trigger: "lclick,", trigger: "lclick,",
debounce: false,
cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12" cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12"
}); });
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () {
@ -68,6 +77,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
trigger: "lclick,", trigger: "lclick,",
forceNotSelected: true, forceNotSelected: true,
debounce: false,
cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12" cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12"
}); });
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () {

2
src/widget/singleselect/trigger/searcher.singleselect.js

@ -128,7 +128,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
if (BI.isUndefined(v)) { if (BI.isUndefined(v)) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
v = v || ""; v = v ?? "";
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));
} }
}, },

15
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 () {

28
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",

19
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"

9
src/widget/time/time.trigger.js

@ -23,12 +23,13 @@
DEFAULT_HOUR: "00" DEFAULT_HOUR: "00"
}, },
props: { props: () => ({
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
value: {}, value: {},
format: "", format: "",
allowEdit: false allowEdit: false,
}, watermark: BI.i18nText("BI-Basic_Unrestricted"),
}),
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
@ -52,7 +53,7 @@
value: this._formatValue(o.value), value: this._formatValue(o.value),
hgap: 4, hgap: 4,
allowBlank: true, allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), watermark: o.watermark,
title: BI.bind(this._getTitle, this), title: BI.bind(this._getTitle, this),
listeners: [{ listeners: [{
eventName: "EVENT_KEY_DOWN", eventName: "EVENT_KEY_DOWN",

8
src/widget/timeinterval/dateinterval.js

@ -24,8 +24,8 @@ BI.DateInterval = BI.inherit(BI.Single, {
BI.DateInterval.superclass._init.apply(this, arguments); BI.DateInterval.superclass._init.apply(this, arguments);
o.value = o.value || {}; o.value = o.value || {};
this.left = this._createCombo(o.value.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({ this.label = BI.createWidget({
type: "bi.label", type: "bi.label",
height: o.height, height: o.height,
@ -65,7 +65,7 @@ BI.DateInterval = BI.inherit(BI.Single, {
}); });
}, },
_createCombo: function (v) { _createCombo: function (v, watermark) {
var self = this, o = this.options; var self = this, o = this.options;
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.dynamic_date_combo", type: "bi.dynamic_date_combo",
@ -74,7 +74,7 @@ BI.DateInterval = BI.inherit(BI.Single, {
maxDate: o.maxDate, maxDate: o.maxDate,
simple: o.simple, simple: o.simple,
behaviors: o.behaviors, behaviors: o.behaviors,
watermark: o.watermark, watermark: watermark,
value: v, value: v,
height: o.height, height: o.height,
listeners: [{ listeners: [{

8
src/widget/timeinterval/timeinterval.js

@ -24,8 +24,8 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.TimeInterval.superclass._init.apply(this, arguments); BI.TimeInterval.superclass._init.apply(this, arguments);
o.value = o.value || {}; o.value = o.value || {};
this.left = this._createCombo(o.value.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({ this.label = BI.createWidget({
type: "bi.label", type: "bi.label",
height: o.height, height: o.height,
@ -65,7 +65,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
}); });
}, },
_createCombo: function (v) { _createCombo: function (v, watermark) {
var self = this, o = this.options; var self = this, o = this.options;
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.dynamic_date_time_combo", type: "bi.dynamic_date_time_combo",
@ -74,7 +74,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
minDate: o.minDate, minDate: o.minDate,
maxDate: o.maxDate, maxDate: o.maxDate,
behaviors: o.behaviors, behaviors: o.behaviors,
watermark: o.watermark, watermark: watermark,
value: v, value: v,
height: o.height, height: o.height,
}); });

7
src/widget/timeinterval/timeperiods.js

@ -51,7 +51,7 @@
ref: function (_ref) { ref: function (_ref) {
self.left = _ref; self.left = _ref;
} }
}, this._createCombo(o.value.start)), }, this._createCombo(o.value.start, o.watermark?.start)),
left: this.constants.offset, left: this.constants.offset,
right: 0, right: 0,
top: 0, top: 0,
@ -64,7 +64,7 @@
ref: function (_ref) { ref: function (_ref) {
self.right = _ref; self.right = _ref;
} }
}, this._createCombo(o.value.end)), }, this._createCombo(o.value.end, o.watermark?.end)),
left: 0, left: 0,
right: this.constants.offset, right: this.constants.offset,
top: 0, top: 0,
@ -80,13 +80,14 @@
}; };
}, },
_createCombo: function (v) { _createCombo: function (v, watermark) {
var self = this; var self = this;
var o = this.options; var o = this.options;
return { return {
type: "bi.time_combo", type: "bi.time_combo",
value: v, value: v,
height: o.height, height: o.height,
watermark: watermark,
listeners: [{ listeners: [{
eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW,
action: function () { action: function () {

7
src/widget/yearinterval/yearinterval.js

@ -23,8 +23,8 @@ BI.YearInterval = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
o.value = o.value || {}; o.value = o.value || {};
this.left = this._createCombo(o.value.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{ return [{
type: "bi.center", type: "bi.center",
@ -63,7 +63,7 @@ BI.YearInterval = BI.inherit(BI.Single, {
}] }]
}, },
_createCombo: function (v) { _createCombo: function (v, watermark) {
var self = this, o = this.options; var self = this, o = this.options;
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.dynamic_year_combo", type: "bi.dynamic_year_combo",
@ -73,6 +73,7 @@ BI.YearInterval = BI.inherit(BI.Single, {
height: o.height, height: o.height,
behaviors: o.behaviors, behaviors: o.behaviors,
value: v, value: v,
watermark: watermark,
listeners: [{ listeners: [{
eventName: BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW, eventName: BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW,
action: function () { action: function () {

32
src/widget/yearmonth/card.static.yearmonth.js

@ -9,13 +9,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
var self = this; var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = BI.chunk(month, 2);
items.push(month.slice(0, 2));
items.push(month.slice(2, 4));
items.push(month.slice(4, 6));
items.push(month.slice(6, 8));
items.push(month.slice(8, 10));
items.push(month.slice(10, 12));
return BI.map(items, function (i, item) { return BI.map(items, function (i, item) {
return BI.map(item, function (j, td) { return BI.map(item, function (j, td) {
return { return {
@ -57,10 +51,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value); self._checkMonthStatus(value);
self.setValue({ self._setYear(value);
year: value,
month: self.selectedMonth
});
} }
}] }]
}, { }, {
@ -106,7 +97,8 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
var o = this.options; var o = this.options;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d");
var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear();
var minMonth = 0; var maxMonth = 11; var minMonth = 0;
var maxMonth = 11;
minYear === year && (minMonth = minDate.getMonth()); minYear === year && (minMonth = minDate.getMonth());
maxYear === year && (maxMonth = maxDate.getMonth()); maxYear === year && (maxMonth = maxDate.getMonth());
var yearInvalid = year < minYear || year > maxYear; var yearInvalid = year < minYear || year > maxYear;
@ -116,6 +108,22 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
}); });
}, },
_setYear: function (year) {
var o = this.options;
var dateVoid = BI.checkDateVoid(year, this.selectedMonth, 1, o.min, o.max);
// 在切换年的时候,如果月份不在区间内了,取消选中
if (BI.contains(["y", "m"], dateVoid[0])) {
this.selectedYear = year;
this.month.setValue();
return;
}
this.selectedYear = year;
this.month.setValue(this.selectedMonth);
},
setMinDate: function (minDate) { setMinDate: function (minDate) {
if (this.options.min !== minDate) { if (this.options.min !== minDate) {
this.options.min = minDate; this.options.min = minDate;

3
src/widget/yearmonth/combo.yearmonth.js

@ -23,7 +23,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
height: o.height - border, height: o.height - border,
value: o.value || "" value: o.value || "",
watermark: o.watermark,
}); });
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () {
self.combo.isViewVisible() && self.combo.hideView(); self.combo.isViewVisible() && self.combo.hideView();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save