Browse Source

Merge pull request #190069 in DEC/fineui from feature/x to bugfix/11.0

* commit '6813491d9595c8f43c63166442c4202262a5b052': (184 commits)
  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
  auto upgrade version to 2.0.20220928160431
  chore: single类组件的子label的title应该为null
  KERNEL-12982 feat: [组件化] : BI.Popover提供控制能否拖动的能力
  chore: title属性需要传给子label
  chore: title属性需要传给子label
  auto upgrade version to 2.0.20220928144523
  REPORT-80978 fix: DynamicYearMonthPopup 左右切换年份后,默认选中消失
  auto upgrade version to 2.0.20220927115526
  auto upgrade version to 2.0.20220927103529
  chore: 优化
  auto upgrade version to 2.0.20220926221530
  update
  ...
research/test
superman 2 years ago
parent
commit
248ec00f2d
  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. 49
      demo/js/widget/numbereditor/demo.number_editor.js
  6. 64
      demo/js/widget/slider/demo.slider.js
  7. 2
      lodash.md
  8. 6
      package.json
  9. 7
      plugins/webpack-fui-worker-plugin/worker-loader.js
  10. 9
      src/base/collection/collection.js
  11. 1
      src/base/combination/bubble.js
  12. 3
      src/base/combination/combo.js
  13. 11
      src/base/grid/grid.js
  14. 17
      src/base/layer/layer.popover.js
  15. 9
      src/base/list/virtualgrouplist.js
  16. 1
      src/base/pager/pager.js
  17. 5
      src/base/single/button/button.basic.js
  18. 1
      src/base/single/button/buttons/button.text.js
  19. 1
      src/base/single/button/listitem/blankiconicontextitem.js
  20. 1
      src/base/single/button/listitem/blankicontexticonitem.js
  21. 1
      src/base/single/button/listitem/blankicontextitem.js
  22. 1
      src/base/single/button/listitem/icontexticonitem.js
  23. 1
      src/base/single/button/listitem/icontextitem.js
  24. 1
      src/base/single/button/listitem/texticonitem.js
  25. 1
      src/base/single/button/listitem/textitem.js
  26. 1
      src/base/single/button/node/icontexticonnode.js
  27. 1
      src/base/single/button/node/icontextnode.js
  28. 1
      src/base/single/button/node/texticonnode.js
  29. 1
      src/base/single/button/node/textnode.js
  30. 2
      src/base/single/editor/editor.textarea.js
  31. 17
      src/base/single/label/abstract.label.js
  32. 17
      src/base/single/label/label.js
  33. 2
      src/base/single/tip/tip.tooltip.js
  34. 7
      src/case/button/icon/icon.change.js
  35. 24
      src/case/button/icon/iconhalf/icon.half.js
  36. 2
      src/case/button/switch.js
  37. 9
      src/case/colorchooser/colorchooser.js
  38. 62
      src/case/combo/textvaluecombo/combo.textvalue.js
  39. 74
      src/case/combo/textvaluecombo/combo.textvaluesmall.js
  40. 131
      src/case/combo/textvaluecombo/popup.textvalue.js
  41. 1
      src/case/pager/pager.detail.js
  42. 45
      src/case/trigger/trigger.text.select.js
  43. 177
      src/component/treevaluechooser/abstract.treevaluechooser.js
  44. 2
      src/component/treevaluechooser/combo.treevaluechooser.js
  45. 4
      src/component/treevaluechooser/pane.treevaluechooser.js
  46. 437
      src/core/1.lodash.js
  47. 14
      src/core/4.widget.js
  48. 16
      src/core/5.inject.js
  49. 43
      src/core/logic/logic.layout.js
  50. 11
      src/core/platform/web/config.js
  51. 29
      src/core/platform/web/detectElementResize.js
  52. 90
      src/core/platform/web/jquery/_jquery.js
  53. 22
      src/core/utils/i18n.js
  54. 11
      src/less/base/single/html.less
  55. 7
      src/less/base/tree/ztree.less
  56. 4
      src/less/base/trigger/trigger.less
  57. 25
      src/less/core/utils/common.less
  58. 10
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  59. 2
      src/router/router.js
  60. 243
      src/widget/downlist/combo.downlist.js
  61. 16
      src/widget/downlist/item.downlist.js
  62. 68
      src/widget/downlist/item.downlistgroup.js
  63. 2
      src/widget/dynamicdate/dynamicdate.param.item.js
  64. 8
      src/widget/dynamicdate/dynamicdate.trigger.js
  65. 27
      src/widget/intervalslider/intervalslider.js
  66. 4
      src/widget/multilayerdownlist/popup.downlist.js
  67. 3
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  68. 101
      src/widget/multilayersingletree/multilayersingletree.combo.js
  69. 13
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  70. 2
      src/widget/multiselect/multiselect.combo.js
  71. 2
      src/widget/multiselect/multiselect.combo.nobar.js
  72. 2
      src/widget/multiselect/multiselect.insert.combo.js
  73. 2
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  74. 2
      src/widget/multiselectlist/multiselectlist.insert.js
  75. 4
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  76. 4
      src/widget/multiselectlist/multiselectlist.js
  77. 1
      src/widget/multitree/multi.tree.combo.js
  78. 3
      src/widget/multitree/multi.tree.insert.combo.js
  79. 3
      src/widget/multitree/multi.tree.list.combo.js
  80. 16
      src/widget/numbereditor/number.editor.js
  81. 17
      src/widget/singleslider/singleslider.js
  82. 30
      src/widget/singleslider/singleslider.label.js
  83. 21
      src/widget/singleslider/singleslider.normal.js
  84. 13
      src/widget/time/time.trigger.js
  85. 8
      src/widget/timeinterval/dateinterval.js
  86. 10
      src/widget/timeinterval/timeinterval.js
  87. 9
      src/widget/timeinterval/timeperiods.js
  88. 9
      src/widget/yearinterval/yearinterval.js
  89. 32
      src/widget/yearmonth/card.static.yearmonth.js
  90. 3
      src/widget/yearmonth/combo.yearmonth.js
  91. 14
      src/widget/yearmonth/trigger.yearmonth.js
  92. 7
      src/widget/yearmonthinterval/yearmonthinterval.js
  93. 3
      src/widget/yearquarter/combo.yearquarter.js
  94. 14
      src/widget/yearquarter/trigger.yearquarter.js
  95. 9
      src/widget/yearquarterinterval/yearquarterinterval.js
  96. 5
      typescript/base/single/button/buttons/button.ts
  97. 2
      typescript/base/single/label/abstract.label.ts
  98. 6
      typescript/shims-tsx.ts
  99. 10
      webpack/attachments.js

3
bi.lessconfig.json

@ -46,5 +46,6 @@
"@font-trigger-triangle": "e924",
"@font-solid-bottom": "e905",
"@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行内传入属性
// 根据实际需求传入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 {
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",
text: "setValue(1)",
handler: function () {
combo1.setValue();
combo1.setValue(1);
},
},
vgap: 10,
@ -184,6 +184,27 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
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, {
props: {
baseCls: "demo-downlist"
@ -22,9 +34,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
render: function () {
var self = this;
// test
return {
type: "bi.horizontal_adapt",
type: "bi.left",
items: [{
type: "bi.down_list_combo",
ref: function (_ref) {
@ -35,11 +47,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
width: 100,
items: [
[{
el: {
text: "column 1111",
iconCls1: "dot-e-font",
value: 12
},
text: "column 1111",
iconCls1: "dot-e-font",
value: 12,
children: [{
text: "column 1.1",
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",
ref: function (_ref) {

49
demo/js/widget/numbereditor/demo.number_editor.js

@ -7,7 +7,7 @@ Demo.FileManager = BI.inherit(BI.Widget, {
},
render: function () {
var editor = BI.createWidget({
var editor1 = BI.createWidget({
type: "bi.number_editor",
validationChecker: function (v) {
return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0;
@ -16,21 +16,50 @@ Demo.FileManager = BI.inherit(BI.Widget, {
width: 150,
errorText: "hahah"
});
editor.on(BI.NumberEditor.EVENT_CHANGE, function () {
editor1.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) {
editor.setDownEnable(false);
editor1.setDownEnable(false);
} 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 {
type: "bi.vertical",
items: [{
el: editor,
height: 24
}]
hgap: 20,
vgap: 20,
items: [
{
el: editor1,
height: 24
}, {
el: editor2,
height: 24
}
]
};
}
});
BI.shortcut("demo.number_editor", Demo.FileManager);
BI.shortcut("demo.number_editor", Demo.FileManager);

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

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

2
lodash.md

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

6
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20220826175704",
"version": "2.0.20221008165420",
"description": "fineui",
"main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts",
@ -11,8 +11,10 @@
"@babel/core": "^7.17.4",
"@babel/polyfill": "7.6.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",
"@typescript-eslint/eslint-plugin": "2.33.0",
"@typescript-eslint/parser": "2.33.0",
"autoprefixer": "9.6.1",
"babel-loader": "8.0.6",
"chai": "4.2.0",

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

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

9
src/base/collection/collection.js

@ -16,6 +16,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrolly: false,
overflowX: true,
overflowY: true,
el: {
type: "bi.vertical"
},
cellSizeAndPositionGetter: BI.emptyFn,
horizontalOverscanSize: 0,
verticalOverscanSize: 0,
@ -65,7 +68,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrollable = "x";
}
}
BI._lazyCreateWidget({
BI._lazyCreateWidget(o.el, {
type: "bi.vertical",
element: this,
scrollable: scrollable,
@ -124,7 +127,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
_cellRenderers: function (height, width, x, y) {
this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y);
return this._cellGroupRenderer();
},
@ -135,7 +138,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
var cellMetadata = self._sectionManager.getCellMetadata(index);
rendered.push(cellMetadata);
});
return rendered;
},

1
src/base/combination/bubble.js

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

3
src/base/combination/combo.js

@ -93,6 +93,7 @@
BI.createWidget(BI.extend({
element: this,
scrolly: false,
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{ el: this.combo }
@ -152,7 +153,7 @@
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());
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW);
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW, e);
},
_popupView: function (e) {

11
src/base/grid/grid.js

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

17
src/base/layer/layer.popover.js

@ -158,15 +158,17 @@ BI.Popover = BI.inherit(BI.Widget, {
mounted: function () {
var self = this;
this.dragger.element.mousedown(function (e) {
self.startX = self.element[0].offsetLeft;
self.startY = self.element[0].offsetTop;
self.tracker.captureMouseMoves(e);
if (self.options.draggable !== false) {
self.startX = self.element[0].offsetLeft;
self.startY = self.element[0].offsetTop;
self.tracker.captureMouseMoves(e);
}
});
},
_getSuitableBodyHeight: function (height) {
var o = this.options;
return BI.clamp(height, 0, BI.Widget._renderEngine.createElement("body")[0].clientHeight - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap);
},
@ -207,6 +209,10 @@ BI.Popover = BI.inherit(BI.Widget, {
};
},
setDraggable: function (b) {
this.options.draggable = b;
},
hide: function () {
},
@ -224,9 +230,6 @@ BI.Popover = BI.inherit(BI.Widget, {
setZindex: function (zindex) {
this.element.css({ "z-index": zindex });
},
destroyed: function () {
},
});
BI.shortcut("bi.popover", BI.Popover);

9
src/base/list/virtualgrouplist.js

@ -27,7 +27,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
items: [{
@ -79,7 +79,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
},
_isAutoHeight: function () {
return this.options.rowHeight === "auto";
return !BI.isNumber(this.options.rowHeight);
},
_renderMoreIf: function () {
@ -97,12 +97,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) {
return o.itemFormatter(item, index + i);
}), this);
var addedHeight = getElementHeight() - lastHeight;
var elementHeight = getElementHeight();
var addedHeight = elementHeight - lastHeight;
this.tree.set(cnt, addedHeight);
this.renderedIndex = cnt;
cnt++;
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) {
this.options.pages = pages;
this._populate();
},
hasPrev: function (v) {

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

@ -26,6 +26,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
trigger: null,
handler: BI.emptyFn,
bubble: null,
debounce: true
});
},
@ -222,10 +223,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
});
// 之后的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,
"trailing": false,
});
}) : this._doClick;
function ev(e) {
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,
py: o.py,
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,
keyword: o.keyword,
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,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
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,
keyword: o.keyword,
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,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
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,
keyword: o.keyword,
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,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
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,
keyword: o.keyword,
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,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
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,
keyword: o.keyword,
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,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
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,
keyword: o.keyword,
py: o.py,
title: null,
});
},

2
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());
});
this.content.element.keydown(function () {
// 水印快速消失
// 水印快速消失
self._checkWaterMark();
});
this.content.element.keyup(function (e) {

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 () {
var o = this.options;

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

@ -10,6 +10,23 @@ BI.Label = BI.inherit(BI.AbstractLabel, {
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 () {
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",
text: text,
textHeight: 18,
title: null,
};
}),
});
@ -63,6 +64,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
textAlign: o.textAlign,
whiteSpace: "normal",
text: o.text,
title: null,
textHeight: 18,
hgap: this._const.hgap,
vgap: this._const.vgap,

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

@ -31,8 +31,11 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
},
_init: function () {
BI.IconChangeButton.superclass._init.apply(this, arguments);
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({
type: "bi.icon_button",
element: this,
@ -80,4 +83,4 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
}
});
BI.IconChangeButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_change_button", BI.IconChangeButton);
BI.shortcut("bi.icon_change_button", BI.IconChangeButton);

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

@ -7,20 +7,34 @@ BI.HalfButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-half-button bi-high-light-border",
height: 14,
selected: false,
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 () {
BI.HalfButton.superclass.doClick.apply(this, arguments);
if(this.isValid()) {
if (this.isValid()) {
this.fireEvent(BI.HalfButton.EVENT_CHANGE);
}
}
});
BI.HalfButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.half_button", BI.HalfButton);
BI.shortcut("bi.half_button", BI.HalfButton);

2
src/case/button/switch.js

@ -77,7 +77,7 @@ BI.Switch = BI.inherit(BI.BasicButton, {
doClick: function () {
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";

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

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

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

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

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

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

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

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) {
this.options.pages = pages;
this._populate();
},
hasPrev: function (v) {

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

@ -20,15 +20,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_init: function () {
BI.SelectTextTrigger.superclass._init.apply(this, arguments);
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({
type: "bi.text_trigger",
element: this,
height: o.height,
readonly: o.readonly,
text: obj.text,
text: text,
defaultText: o.defaultText,
textCls: obj.textCls,
textHgap: o.textHgap,
textVgap: o.textVgap,
textLgap: o.textLgap,
@ -52,40 +51,31 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_digest: function (val, items) {
var o = this.options;
val = BI.isArray(val) ? val[0] : val;
val = BI.isArray(val) ? val.slice() : [val];
var result = [];
// 提升valueFormatter的优先级
if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) {
return {
text: o.valueFormatter(val),
};
BI.each(val, function (index, v) {
result.push(o.valueFormatter(v));
});
return result.join(",");
}
var result = [];
var formatItems = BI.Tree.transformToArrayFormat(items);
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);
BI.remove(val, item.value);
}
});
if (result.length > 0) {
return {
textCls: "",
text: result.join(","),
};
if (result.length > 0 && val.length === 0) {
return result.join(",");
} else {
var text = BI.isFunction(o.text) ? o.text() : o.text;
if (BI.isEmptyString(text)) {
return {
textCls: "bi-tips",
text: ""
};
}
return {
text: o.text
};
return BI.isFunction(o.text) ? o.text() : o.text;
}
},
@ -95,9 +85,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
},
setValue: function (val) {
var formatValue = this._digest(val, this.options.items);
this.trigger.setTextCls(formatValue.textCls);
this.trigger.setText(formatValue.text);
var formatText = this._digest(val, this.options.items);
this.trigger.setText(formatText);
},
setTipType: function (v) {

177
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -532,70 +532,81 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var checkState = op.checkState || {};
var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues || {};
var valueMap = {};
// 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 state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
result.push({
id: nodes[i].id,
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);
function getResult(parentValues, checkState) {
var valueMap = {};
// if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWithSelectedValue(parentValues, selectedValues);
// }
var nodes = self._getChildren(parentValues);
for (var i = (times - 1) * self._const.perPage; nodes[i] && i < times * self._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
var openState = o.open || nodes[i].open;
result.push({
id: node.id,
pId: node.pId,
value: node.value,
text: node.text,
id: nodes[i].id,
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: node.getChildrenLength() > 0,
checked: state[0],
halfCheck: state[1],
open: self.options.open,
disabled: node.disabled,
title: node.title || node.text,
warningTitle: node.warningTitle,
half: state[1],
halfCheck: openState ? false : state[1],
open: openState,
disabled: nodes[i].disabled,
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) {
result = BI.concat(self._getAddedValueNode(parentValues, selectedValues), result);
@ -603,17 +614,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
BI.nextTick(function () {
callback({
items: result,
hasNext: nodes.length > times * self._const.perPage
hasNext: self._getChildren(parentValues).length > times * self._const.perPage
});
});
function judgeState(parentValues, selected_value, checkState) {
var checked = checkState.checked, half = checkState.half;
if (parentValues.length > 0 && !checked) {
return false;
}
return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
}
// function judgeState(parentValues, selected_value, checkState) {
// var checked = checkState.checked, half = checkState.half;
// if (parentValues.length > 0 && !checked) {
// return false;
// }
// return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
// }
function dealWithSelectedValue(parentValues, selectedValues) {
var valueMap = {}, parents = (parentValues || []).slice(0);
@ -840,6 +851,40 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
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) {
var self = this;
var result = {};

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

@ -30,7 +30,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
text: o.text,
defaultText: o.defaultText,
allowEdit: o.allowEdit,
value: o.value,
value: this.assertSelectedValue(o.value, o.items),
watermark: o.watermark,
element: 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 () {
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)) {
this._initData(o.items);
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 render = BI.isFunction(this.options.render) ? this.options.render : (workerMode ? (this.$render || this.render) : this.render);
var els = render && render.call(this);
els = this.options.configRender ? this.options.configRender(els) : els;
els = BI.Plugin.getRender(this.options.type, els);
if (BI.isPlainObject(els)) {
els = [els];
@ -743,12 +744,22 @@
},
_unMount: function () {
this._assetMounted();
this.__destroy();
this.fireEvent(BI.Events.UNMOUNT);
this.purgeListeners();
},
_assetMounted: function () {
if (!this.isVisible()) {
this._setVisible(true);
this._mount(false, false, false);
this._setVisible(false);
}
},
_empty: function () {
this._assetMounted();
BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount();
});
@ -790,6 +801,7 @@
});
});
this._watchers && (this._watchers = []);
this._assetMounted();
this.__d();
this.element.empty();
this.element.unbind();
@ -799,6 +811,7 @@
},
_destroy: function () {
this._assetMounted();
this.__destroy();
this.element.destroy();
this.purgeListeners();
@ -806,6 +819,7 @@
destroy: function () {
var self = this, o = this.options;
this._assetMounted();
this.__destroy();
if (o.animation) {
this._innerSetVisible(false);

16
src/core/5.inject.js

@ -411,7 +411,7 @@
// 根据配置属性生成widget
var createWidget = function (config, context, lazy) {
var cls = kv[config.type];
var cls = BI.isFunction(config.type) ? config.type : kv[config.type];
if (!cls) {
throw new Error("组件: [" + config.type + "] 未定义");
@ -449,9 +449,10 @@
} else if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
}
if (el) {
runConfigFunction(el.type);
var elType = (el.type && el.type.xtype) || el.type;
runConfigFunction(elType);
}
// 先把准备环境准备好
@ -466,13 +467,14 @@
return item;
}
if (el) {
w = BI.Plugin.getWidget(el.type, el);
if (w.type === el.type) {
if (BI.Plugin.hasObject(el.type)) {
w = BI.Plugin.getWidget(elType, el);
var wType = (w.type && w.type.xtype) || w.type;
if (wType === elType) {
if (BI.Plugin.hasObject(elType)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
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 {
layout = "bi.vtape";
}
return {
return BI._.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
@ -45,8 +45,12 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, BI._.identity);
}
});
@ -85,7 +89,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.htape";
}
return {
return BI._.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
@ -98,8 +102,12 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, BI._.identity);
}
});
@ -135,19 +143,21 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.window";
}
return {
return BI._.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
scrollx: o.scrollx,
columns: o.columns,
rows: o.rows,
columnSize: o.columnSize,
rowSize: o.rowSize,
hgap: o.hgap,
vgap: o.vgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, BI._.identity);
}
});
@ -188,9 +198,8 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.htape";
}
return {
return BI._.pickBy({
type: layout,
columnSize: columnSize,
scrollable: o.scrollable,
scrolly: o.scrolly,
scrollx: o.scrollx,
@ -202,7 +211,11 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: columnSize,
rowSize: o.rowSize
}, BI._.identity);
}
});

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

@ -62,6 +62,13 @@
})
});
}
if (ob.verticalAlign === BI.VerticalAlign.Stretch) {
if (isSupportFlex()) {
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch,
}, ob, { type: "bi.flex_vertical" });
}
}
return ob;
});
BI.Plugin.configWidget("bi.inline", function (ob) {
@ -229,7 +236,7 @@
return 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 (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" });
@ -242,7 +249,7 @@
}
});
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) {
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) {
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);
BI.nextTick(fn);
} else {
@ -137,8 +151,17 @@
}
};
var removeResizeListener = function (element, fn) {
if (attachEvent) element.detachEvent("onresize", fn);
else {
if (window.ResizeObserver) {
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);
if (!element.__resizeListeners__.length) {
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/
*
* Includes Sizzle.js
@ -63,16 +63,15 @@
var support = {};
var
version = "1.12.4",
version = "3.6.1",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
jQuery = function (selector, context) {
// 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)
return new jQuery.fn.init( selector, context );
return new jQuery.fn.init(selector, context);
},
// Support: Android<4.1, IE<9
@ -10358,20 +10357,27 @@
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch ( e ) {}
} catch (e) {
}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch ( e ) {}
return new window.ActiveXObject("Microsoft.XMLHTTP");
} 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
jQuery.ajaxSetup( {
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
@ -10537,54 +10543,82 @@
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
oldCallbacks.push(callbackName);
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
if (responseContainer && jQuery.isFunction(overwritten)) {
overwritten(responseContainer[0]);
}
responseContainer = overwritten = undefined;
} );
});
// Delegate to 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
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
jQuery.parseHTML = function (data, context, keepScripts) {
if (!data || typeof data !== "string") {
return null;
}
if ( typeof context === "boolean" ) {
if (typeof context === "boolean") {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
var base, parsed, scripts;
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
if ( parsed ) {
return [ context.createElement( parsed[ 1 ] ) ];
if (parsed) {
return [context.createElement(parsed[1])];
}
parsed = buildFragment( [ data ], context, scripts );
parsed = buildFragment([data], context, scripts);
if ( scripts && scripts.length ) {
jQuery( scripts ).remove();
if (scripts && scripts.length) {
jQuery(scripts).remove();
}
return jQuery.merge( [], parsed.childNodes );
return jQuery.merge([], parsed.childNodes);
};

22
src/core/utils/i18n.js

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

11
src/less/base/single/html.less

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

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

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

4
src/less/base/trigger/trigger.less

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

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

@ -2,6 +2,19 @@
.base-disabled {
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;
& .bi-input {
@ -41,6 +54,18 @@
.base-invalid {
cursor: default !important;
.cursor-pointer {
cursor: default !important;
}
.cursor-default {
cursor: default !important;
}
.cursor-move {
cursor: default !important;
}
.cursor-text{
cursor: default !important;
}
}
//focus时边框高亮

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

@ -1,6 +1,16 @@
@import "../../index.less";
@val: transform .3s ease;
.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 {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;

2
src/router/router.js

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

243
src/widget/downlist/combo.downlist.js

@ -1,110 +1,139 @@
/**
* Created by roy on 15/8/14.
*/
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
(function() {
function transformItems(items) {
if (!items) return items;
var result = BI.cloneDeep(items);
var isComplexItmes = BI.some(items, function (_, item) {
return BI.isArray(item);
});
},
_init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.downlistcombo = BI.createWidget({
element: this,
type: "bi.combo",
trigger: o.trigger,
isNeedAdjustWidth: false,
isDefaultInit: true,
container: o.container,
adjustLength: o.adjustLength,
direction: o.direction,
belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation,
destroyWhenHide: o.destroyWhenHide,
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: 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 () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
// 传一维数组,帮转二维
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
};
}
});
});
},
hideView: function () {
this.downlistcombo.hideView();
},
showView: function (e) {
this.downlistcombo.showView(e);
},
populate: function (items) {
this.popupView.populate(items);
},
setValue: function (v) {
this.popupView.setValue(v);
},
getValue: function () {
return this.popupView.getValue();
},
adjustWidth: function () {
this.downlistcombo.adjustWidth();
},
adjustHeight: function () {
this.downlistcombo.adjustHeight();
return result;
}
});
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.down_list_combo", BI.DownListCombo);
/**
* Created by roy on 15/8/14.
*/
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
});
},
_init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.downlistcombo = BI.createWidget({
element: this,
type: "bi.combo",
trigger: o.trigger,
isNeedAdjustWidth: false,
isDefaultInit: true,
container: o.container,
adjustLength: o.adjustLength,
direction: o.direction,
belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation,
destroyWhenHide: o.destroyWhenHide,
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 () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
});
},
hideView: function () {
this.downlistcombo.hideView();
},
showView: function (e) {
this.downlistcombo.showView(e);
},
populate: function (items) {
this.popupView.populate(items);
},
setValue: function (v) {
this.popupView.setValue(v);
},
getValue: function () {
return this.popupView.getValue();
},
adjustWidth: function () {
this.downlistcombo.adjustWidth();
},
adjustHeight: function () {
this.downlistcombo.adjustHeight();
}
});
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
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,
height: o.height
});
var icon = BI.isPlainObject(o.icon) ? o.icon : {
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight,
}
this.icon = BI.createWidget({
type: "bi.center_adapt",
width: 36,
height: o.height,
items: [{
el: {
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
}
}]
el: icon,
}],
});
BI.createWidget(BI.extend({

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

@ -8,11 +8,11 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
},
// invalid: true,
iconCls1: "dot-e-font",
icon: "",
iconCls2: "pull-right-e-font"
});
},
_init: function () {
BI.DownListGroupItem.superclass._init.apply(this, arguments);
render: function () {
var o = this.options;
var self = this;
this.text = BI.createWidget({
@ -21,20 +21,29 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
textAlign: "left",
text: o.text,
value: o.value,
height: o.height
});
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)
});
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({
type: "bi.icon_button",
cls: o.iconCls2,
@ -42,27 +51,6 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
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 () {
if (self.isEnabled()) {
self.hover();
@ -72,6 +60,12 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
self.dishover();
}
});
return {
type: "bi.horizontal_fill",
columnSize: [36, "fill", 24],
items: [this.icon1, this.text, this.icon2]
}
},
_getLevel: function () {
@ -117,8 +111,8 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
},
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.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: [{
el: {
type: "bi.sign_editor",
cls: "bi-border",
cls: "bi-border bi-focus-shadow bi-border-radius",
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2,
validationChecker: function (v) {
return BI.isNaturalNumber(v);

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

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

27
src/widget/intervalslider/intervalslider.js

@ -15,7 +15,23 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
props: {
baseCls: "bi-interval-slider bi-slider-track",
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 () {
@ -25,13 +41,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.enable = false;
this.valueOne = "";
this.valueTwo = "";
this.calculation = new BI.AccurateCalculationModel();
// this.backgroundTrack = BI.createWidget({
// type: "bi.layout",
// cls: "background-track",
// height: c.TRACK_HEIGHT
// });
this.calculation = new BI.AccurateCalculationModel();
this.grayTrack = BI.createWidget({
type: "bi.layout",
cls: "gray-track",
@ -539,4 +550,4 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
}
});
BI.IntervalSlider.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.interval_slider", BI.IntervalSlider);
BI.shortcut("bi.interval_slider", BI.IntervalSlider);

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

@ -99,7 +99,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
item.el.logic = {
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.popup = {
lgap: 1,
@ -183,7 +183,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
if (BI.isNotEmptyArray(child.children)) {
item.type = "bi.down_list_group_item";
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);
}
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();
if (o.allowEdit) {
return {
type: "bi.absolute",
@ -210,7 +209,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
return {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
cls: "bi-trigger trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},

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

@ -33,14 +33,48 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
render: function () {
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 () {
var self = this, o = this.options;
return {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius ") + (BI.isKey(o.status) ? ("status-" + o.status) : ""),
container: o.container,
destroyWhenHide: o.destroyWhenHide,
adjustLength: 2,
@ -152,7 +186,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
// IE11下,popover(position: fixed)下放置下拉控件(position: fixed), 滚动的时候会异常卡顿
// 通过container参数将popup放置于popover之外解决此问题, 其他下拉控件由于元素少或者有分页,所以
// 卡顿不明显, 先在此做尝试, 并在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: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
@ -168,46 +202,29 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
};
},
_getSyncConfig: 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,
},
});
},
_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,
_getTriggerIconButton: function () {
var self = this, o = this.options;
return {
type: "bi.trigger_icon_button",
cls: "bi-trigger trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
});
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 () {

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

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

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

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

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

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

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

@ -34,7 +34,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
value: BI.deepClone(o.value) || []
};
// 标记正在请求数据
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);
var self = this, o = this.options;
this.storeValue = this._assertValue(o.value || {});
this.storeValue = this._assertValue(BI.deepClone(o.value) || {});
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));

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

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

4
src/widget/multiselectlist/multiselectlist.js

@ -15,7 +15,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
BI.MultiSelectList.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {};
this.storeValue = this._assertValue(BI.deepClone(o.value) || {});
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));
@ -31,6 +31,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
value: o.value,
isDefaultInit: true,
// onLoaded: o.onLoaded,
el: {}
@ -198,6 +199,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
return val;
},
_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.numberCounter.setButtonChecked(val);
self.storeValue = { value: 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.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,

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.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,

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

@ -10,6 +10,9 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
valueFormatter: function (v) {
return v;
},
valueParser: function (v) {
return v;
},
value: 0,
allowBlank: false,
errorText: "",
@ -30,14 +33,19 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
value: o.valueFormatter(o.value),
validationChecker: function (v) {
// 不设置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 o.validationChecker(v);
return o.validationChecker(parsedValue);
},
errorText: o.errorText
});
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);
});
this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
@ -57,6 +65,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button",
forceNotSelected: true,
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"
});
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () {
@ -68,6 +77,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button",
trigger: "lclick,",
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"
});
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () {
@ -154,4 +164,4 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
});
BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.number_editor", BI.NumberEditor);
BI.shortcut("bi.number_editor", BI.NumberEditor);

17
src/widget/singleslider/singleslider.js

@ -16,7 +16,20 @@ BI.SingleSlider = BI.inherit(BI.Single, {
props: {
baseCls: "bi-single-slider bi-slider-track",
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 () {
@ -340,4 +353,4 @@ BI.SingleSlider = BI.inherit(BI.Single, {
}
});
BI.SingleSlider.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_slider", BI.SingleSlider);
BI.shortcut("bi.single_slider", BI.SingleSlider);

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

@ -13,16 +13,27 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, {
TRACK_GAP_HALF: 7,
TRACK_GAP: 14
},
_defaultConfig: function () {
return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-slider-label bi-slider-track",
digit: false,
unit: ""
props: {
baseCls: "bi-single-slider-label bi-slider-track",
digit: false,
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 c = this._constant;
this.enable = false;
@ -83,9 +94,8 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, {
});
this._setVisible(false);
BI.createWidget({
return ({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.vertical",
@ -308,4 +318,4 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, {
}
});
BI.SingleSliderLabel.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_slider_label", BI.SingleSliderLabel);
BI.shortcut("bi.single_slider_label", BI.SingleSliderLabel);

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

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

13
src/widget/time/time.trigger.js

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

8
src/widget/timeinterval/dateinterval.js

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

10
src/widget/timeinterval/timeinterval.js

@ -24,8 +24,8 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.TimeInterval.superclass._init.apply(this, arguments);
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
type: "bi.label",
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 combo = BI.createWidget({
type: "bi.dynamic_date_time_combo",
@ -74,7 +74,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
minDate: o.minDate,
maxDate: o.maxDate,
behaviors: o.behaviors,
watermark: o.watermark,
watermark: watermark,
value: v,
height: o.height,
});
@ -202,4 +202,4 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.TimeInterval.EVENT_VALID = "EVENT_VALID";
BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR";
BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.time_interval", BI.TimeInterval);
BI.shortcut("bi.time_interval", BI.TimeInterval);

9
src/widget/timeinterval/timeperiods.js

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

9
src/widget/yearinterval/yearinterval.js

@ -23,8 +23,8 @@ BI.YearInterval = BI.inherit(BI.Single, {
var self = this, o = this.options;
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{
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 combo = BI.createWidget({
type: "bi.dynamic_year_combo",
@ -73,6 +73,7 @@ BI.YearInterval = BI.inherit(BI.Single, {
height: o.height,
behaviors: o.behaviors,
value: v,
watermark: watermark,
listeners: [{
eventName: BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {
@ -206,4 +207,4 @@ BI.YearInterval.EVENT_VALID = "EVENT_VALID";
BI.YearInterval.EVENT_ERROR = "EVENT_ERROR";
BI.YearInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.YearInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.year_interval", BI.YearInterval);
BI.shortcut("bi.year_interval", BI.YearInterval);

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

@ -9,13 +9,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
var self = this;
// 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = [];
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));
var items = BI.chunk(month, 2);
return BI.map(items, function (i, item) {
return BI.map(item, function (j, td) {
return {
@ -57,10 +51,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
action: function () {
var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({
year: value,
month: self.selectedMonth
});
self._setYear(value);
}
}]
}, {
@ -106,7 +97,8 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
var o = this.options;
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 minMonth = 0; var maxMonth = 11;
var minMonth = 0;
var maxMonth = 11;
minYear === year && (minMonth = minDate.getMonth());
maxYear === year && (maxMonth = maxDate.getMonth());
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) {
if (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,
max: o.maxDate,
height: o.height - border,
value: o.value || ""
value: o.value || "",
watermark: o.watermark,
});
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () {
self.combo.isViewVisible() && self.combo.hideView();

14
src/widget/yearmonth/trigger.yearmonth.js

@ -5,12 +5,16 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24
},
props: {
props: () => ({
extraCls: "bi-year-month-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
},
height: 24,
watermark: {
year: BI.i18nText("BI-Basic_Unrestricted"),
month: BI.i18nText("BI-Basic_Unrestricted"),
},
}),
beforeInit: function (callback) {
var o = this.options;
@ -80,7 +84,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
quitChecker: function () {
return false;
},
watermark: BI.i18nText("BI-Basic_Unrestricted"),
watermark: isYear ? o.watermark?.year : o.watermark.month,
errorText: function (v) {
var year = isYear ? v : self.yearEditor.getValue();
var month = isYear ? self.monthEditor.getValue() : v;
@ -288,4 +292,4 @@ BI.DynamicYearMonthTrigger.EVENT_START = "EVENT_START";
BI.DynamicYearMonthTrigger.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.DynamicYearMonthTrigger.EVENT_STOP = "EVENT_STOP";
BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);
BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);

7
src/widget/yearmonthinterval/yearmonthinterval.js

@ -19,8 +19,8 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
BI.YearMonthInterval.superclass._init.apply(this, arguments);
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
type: "bi.label",
height: o.height,
@ -61,7 +61,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
});
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_year_month_combo",
@ -71,6 +71,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
maxDate: o.maxDate,
behaviors: o.behaviors,
value: v,
watermark: watermark,
listeners: [{
eventName: BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {

3
src/widget/yearquarter/combo.yearquarter.js

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

14
src/widget/yearquarter/trigger.yearquarter.js

@ -5,12 +5,16 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24
},
props: {
props: () => ({
extraCls: "bi-year-quarter-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
},
height: 24,
watermark: {
year: BI.i18nText("BI-Basic_Unrestricted"),
quarter: BI.i18nText("BI-Basic_Unrestricted"),
},
}),
_init: function () {
BI.DynamicYearQuarterTrigger.superclass._init.apply(this, arguments);
@ -96,7 +100,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
BI.getQuarter(end)
);
},
watermark: BI.i18nText("BI-Basic_Unrestricted"),
watermark: isYear ? o.watermark?.year : o.watermark?.quarter,
hgap: c.hgap,
vgap: c.vgap,
allowBlank: true
@ -272,4 +276,4 @@ BI.DynamicYearQuarterTrigger.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.DynamicYearQuarterTrigger.EVENT_STOP = "EVENT_STOP";
BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.DynamicYearQuarterTrigger.EVENT_VALID = "EVENT_VALID";
BI.shortcut("bi.dynamic_year_quarter_trigger", BI.DynamicYearQuarterTrigger);
BI.shortcut("bi.dynamic_year_quarter_trigger", BI.DynamicYearQuarterTrigger);

9
src/widget/yearquarterinterval/yearquarterinterval.js

@ -23,8 +23,8 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
var self = this, o = this.options;
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{
type: "bi.center",
@ -63,7 +63,7 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
}]
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_year_quarter_combo",
@ -73,6 +73,7 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
behaviors: o.behaviors,
value: v,
height: o.height,
watermark: watermark,
listeners: [{
eventName: BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {
@ -204,4 +205,4 @@ BI.YearQuarterInterval.EVENT_VALID = "EVENT_VALID";
BI.YearQuarterInterval.EVENT_ERROR = "EVENT_ERROR";
BI.YearQuarterInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.YearQuarterInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.year_quarter_interval", BI.YearQuarterInterval);
BI.shortcut("bi.year_quarter_interval", BI.YearQuarterInterval);

5
typescript/base/single/button/buttons/button.ts

@ -10,8 +10,11 @@ export declare class Button extends BasicButton {
minWidth?: number;
readonly?: boolean;
iconCls?: string;
level?: 'common' | 'success' | 'warning' |'ignore',
level?: 'common' | 'success' | 'warning' | 'error' | 'ignore',
block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制
loading?: boolean, // 是否处于加载中
light?: boolean, // 是否使用浅色
plain?: boolean, // 是否是朴素按钮,和 clear 的区别是 plain 有悬浮效果
clear?: boolean; // 是否去掉边框和背景
ghost?: boolean; // 是否幽灵显示, 即正常状态无背景
iconGap?: number;

2
typescript/base/single/label/abstract.label.ts

@ -10,7 +10,7 @@ export declare class AbstractLabel extends Single {
textHeight?: number | null;
highLight?: boolean;
handler?: Function | null;
text?: string;
text?: string | ((context: any) => string);
} & Single['props']
doRedMark(...args: any[]): void;

6
typescript/shims-tsx.ts

@ -13,6 +13,12 @@ interface UIProps {
bgap: number;
vgap: number;
hgap: number;
_rgap: number;
_lgap: number;
_tgap: number;
_bgap: number;
_hgap: number;
_vgap: number;
inset: number | string;
}

10
webpack/attachments.js

@ -7,8 +7,13 @@ const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
const runtimePolyfill = ["@babel/polyfill", "es6-promise/auto"];
const basicAttachmentMap = {
polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(["@babel/polyfill", "es6-promise/auto"]),
polyfill: sync([
"src/core/0.foundation.js",
"src/polyfill/**/*.js",
]).concat(runtimePolyfill),
core: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
@ -202,6 +207,7 @@ const fineuiProxy = [].concat(
);
const fineuiWithoutJqueryAndPolyfillJs = [].concat(
runtimePolyfill,
sync([
"src/core/0.foundation.js",
lodashJs,
@ -227,13 +233,13 @@ const demo = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core,
basicAttachmentMap.fix,
basicAttachmentMap.config,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
sync(["public/less/app.less", "public/less/**/*.less"]),
[fixCompact, workerCompact],
basicAttachmentMap.config,
basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),
);

Loading…
Cancel
Save