Browse Source

Pull request #1: 从master合一下分支到es6

Merge in ~ZHENFEI.LI/fineui from master to es6

* commit '0890d11ff00ca89356a5a9655e10c184138d8a45': (46 commits)
  auto upgrade version to 2.0.20221228163952
  REPORT-85533 fix: BI.parseDateTime方法对%l:%M:%S %P这种格式的日期如果带有秒数解析出错
  auto upgrade version to 2.0.20221226102617
  auto upgrade version to 2.0.20221223112542
  BI-119128 fix: 【自适应迭代发散】小屏编辑,高度适应+自定义(1366*449),直接预览,文本控件下拉选项偏离
  auto upgrade version to 2.0.20221223092552
  BI-119112 fix:editor弹出errorbubble位置修改
  Revert "BI-119112 fix:editor可以自定义error bubble位置"
  BI-119112 fix:editor可以自定义error bubble位置
  BI-119217 fix: 【6.0.6冒烟】等比自适应-高清屏-宽度自适应预览,下拉树查看已选展示异常
  auto upgrade version to 2.0.20221221181657
  REPORT-87371 fix: 【BI6.0】【目录管理-管理首页】添加首页时模板类型的下拉框为空
  REPORT-87371 fix: 【BI6.0】【目录管理-管理首页】添加首页时模板类型的下拉框为空
  auto upgrade version to 2.0.20221221100651
  auto upgrade version to 2.0.20221218194544
  auto upgrade version to 2.0.20221216170431
  BI-118262 fix: 树过滤组件搜索过滤不生效
  BI-117667 fix: 【6.0.5冒烟】数值下拉选择多个选项,查看已选点击加载更多展示重复数据
  auto upgrade version to 2.0.20221216114354
  KERNEL-13893 feat: 颜色选择器默认色板候选调整
  ...
es6
Zhenfei.Li-李振飞 2 years ago
parent
commit
4f558b6410
  1. 3
      demo/js/widget/numbereditor/demo.number_editor.js
  2. 2
      package.json
  3. 56
      src/base/combination/combo.js
  4. 38
      src/case/colorchooser/colorpicker/button/button.colorshow.js
  5. 261
      src/case/colorchooser/colorpicker/colorpicker.hex.js
  6. 274
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  7. 170
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js
  8. 96
      src/case/colorchooser/colorpicker/editor.colorpicker.js
  9. 64
      src/case/colorchooser/colorpicker/editor.colorpicker.simple.js
  10. 10
      src/case/linearsegment/linear.segment.js
  11. 9
      src/case/segment/segment.js
  12. 8
      src/case/ztree/parttree.js
  13. 13
      src/core/2.base.js
  14. 12
      src/core/controller/controller.bubbles.js
  15. 61
      src/core/controller/controller.layer.js
  16. 3474
      src/core/controller/popper.js
  17. 189
      src/core/platform/web/dom.js
  18. 3
      src/core/platform/web/function.js
  19. 21
      src/widget/multiselect/check/multiselect.display.js
  20. 124
      src/widget/multitree/multi.tree.combo.js
  21. 143
      src/widget/multitree/multi.tree.insert.combo.js
  22. 108
      src/widget/multitree/trigger/multi.tree.search.insert.pane.js
  23. 30
      src/widget/multitree/trigger/multi.tree.search.pane.js
  24. 31
      src/widget/multitree/trigger/searcher.multi.tree.js
  25. 48
      src/widget/numbereditor/number.editor.js
  26. 2
      typescript/base/single/button/button.basic.ts

3
demo/js/widget/numbereditor/demo.number_editor.js

@ -14,7 +14,8 @@ Demo.FileManager = BI.inherit(BI.Widget, {
},
height: 24,
width: 150,
errorText: "hahah"
errorText: "hahah",
watermark: "每个人都是自己健康的第一责任人",
});
editor1.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) {

2
package.json

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

56
src/base/combination/combo.js

@ -38,9 +38,9 @@
adjustLength: 0, // 调整的距离
adjustXOffset: 0,
adjustYOffset: 0,
supportCSSTransform: false,
supportCSSTransform: true,
hideChecker: BI.emptyFn,
offsetStyle: "left", // left,right,center
offsetStyle: "", // "",center,middle
el: {},
popup: {},
comboClass: "bi-combo-popup",
@ -162,7 +162,7 @@
this._assertPopupViewRender();
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW);
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下
this.popupView.css({ left: -999999999, top: -99999999 });
this.popupView.css({ left: -99999, top: -99999 });
this.popupView.visible();
BI.each(needHideWhenAnotherComboOpen, function (i, combo) {
if (i !== self.getName()) {
@ -196,31 +196,33 @@
this.popupView.visible();
var combo = (o.belowMouse && BI.isNotNull(e)) ? {
element: {
0: e.target,
0: BI.extend({}, e.target, {
getBoundingClientRect: function () {
return {
left: e.pageX,
top: e.pageY,
width: 0,
height: 0,
};
}
}),
offset: function () {
return {
left: e.pageX,
top: e.pageY,
};
},
bounds: function () {
// offset为其相对于父定位元素的偏移
return {
x: e.offsetX,
y: e.offsetY,
width: 0,
height: 24,
};
},
outerWidth: function () {
return 0;
},
outerHeight: function () {
return 24;
},
},
} : this.combo;
var positionRelativeElement = o.supportCSSTransform ? BI.DOM.getPositionRelativeContainingBlock(BI.isNull(o.container) ? this.element[0] : BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]) : null;
var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(
BI.isNull(o.container)
? this.element[0]
: BI.isWidget(o.container)
? o.container.element[0]
: BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]
);
switch (o.direction) {
case "bottom":
case "bottom,right":
@ -290,10 +292,6 @@
break;
}
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
var width = this.combo.element.outerWidth();
var height = this.combo.element.outerHeight();
this.popupView.setDirection && this.popupView.setDirection(p.dir, {
@ -312,8 +310,14 @@
var scaleX = positonedRect.width / positionRelativeElement.offsetWidth;
var scaleY = positonedRect.height / positionRelativeElement.offsetHeight;
p.top && (p.top = p.top / scaleY);
p.left && (p.left = p.left / scaleX);
p.top && (p.top = Math.round(p.top / scaleY + positionRelativeElement.scrollTop));
p.left && (p.left = Math.round(p.left / scaleX + positionRelativeElement.scrollLeft));
p.adaptHeight && (p.adaptHeight = Math.round(p.adaptHeight / scaleY));
}
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
if ("left" in p) {

38
src/case/colorchooser/colorpicker/button/button.colorshow.js

@ -6,30 +6,32 @@
BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, {
props: {
baseCls: 'bi-color-chooser-show-button bi-border bi-list-item-effect',
baseCls: 'bi-color-chooser-show-button bi-border bi-list-item-effect bi-border-radius',
},
render: function () {
var self = this, o = this.options;
return {
type: 'bi.htape',
items: [{
el: {
type: "bi.icon_label",
ref: function (_ref) {
self.icon = _ref;
items: [
{
el: {
type: "bi.icon_label",
ref: function (_ref) {
self.icon = _ref;
},
iconWidth: 16,
iconHeight: 16,
},
iconWidth: 16,
iconHeight: 16,
},
hgap: 20,
width: 16,
}, {
type: 'bi.label',
textAlign: 'left',
text: o.text,
}]
}
hgap: 20,
width: 16,
}, {
type: 'bi.label',
textAlign: 'left',
text: o.text,
}
]
};
},
doClick: function () {
@ -40,4 +42,4 @@ BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, {
},
});
BI.ColorChooserShowButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.color_picker_show_button", BI.ColorChooserShowButton);
BI.shortcut("bi.color_picker_show_button", BI.ColorChooserShowButton);

261
src/case/colorchooser/colorpicker/colorpicker.hex.js

@ -11,118 +11,173 @@ BI.HexColorPicker = BI.inherit(BI.Widget, {
},
_items: [
[{
value: "#808080"
}, {
value: "#ffffff"
}, {
value: "#ffebe5"
}, {
value: "#ffddba"
}, {
value: "#ffeebb"
}, {
value: "#d4e9bf"
}, {
value: "#c7e1e1"
}, {
value: "#bfe3f0"
}, {
value: "#ccd6eb"
}],
[{
value: "#616161"
}, {
value: "#f2f2f2"
}, {
value: "#ffd6cc"
}, {
value: "#ffb87a"
}, {
value: "#ffdf91"
}, {
value: "#b7d2b6"
}, {
value: "#a3d2c9"
}, {
value: "#8ab6d6"
}, {
value: "#bcbce0"
}],
[{
value: "#404040"
}, {
value: "#dedede"
}, {
value: "#ffab9b"
}, {
value: "#eb8a3a"
}, {
value: "#ffc947"
}, {
value: "#8aa964"
}, {
value: "#5eaaa0"
}, {
value: "#2978b5"
}, {
value: "#8f8faa"
}],
[{
value: "#202020"
}, {
value: "#bfbfbf"
}, {
value: "#df7461"
}, {
value: "#cf7536"
}, {
value: "#e6b63b"
}, {
value: "#5b8a72"
}, {
value: "#3b9aa3"
}, {
value: "#336291"
}, {
value: "#58568f"
}],
[{
value: "#000000"
}, {
value: "#a1a1a1"
}, {
value: "#b55140"
}, {
value: "#a6713c"
}, {
value: "#ad975f"
}, {
value: "#5f7d6e"
}, {
value: "#3b7480"
}, {
value: "#425d78"
}, {
value: "#62608a"
}]
[
{
"value": "#999999"
},
{
"value": "#FFFFFF"
},
{
"value": "#FFE5E5"
},
{
"value": "#FFF1E5"
},
{
"value": "#FFF9E5"
},
{
"value": "#E9F5E9"
},
{
"value": "#EAEEFF"
},
{
"value": "#EFEBF7"
},
{
"value": "#FCE8EF"
}
],
[
{
"value": "#737373"
},
{
"value": "#F2F2F2"
},
{
"value": "#FFA6A6"
},
{
"value": "#FFD0A6"
},
{
"value": "#FFEDA6"
},
{
"value": "#B3DCB2"
},
{
"value": "#B9C6FF"
},
{
"value": "#CABAE6"
},
{
"value": "#F8B1C9"
}
],
[
{
"value": "#4C4C4C"
},
{
"value": "#D9D9D9"
},
{
"value": "#FF5959"
},
{
"value": "#FFA759"
},
{
"value": "#FFDD59"
},
{
"value": "#7EBE70"
},
{
"value": "#7B95FF"
},
{
"value": "#9C7FD0"
},
{
"value": "#F06D99"
}
],
[
{
"value": "#262626"
},
{
"value": "#BFBFBF"
},
{
"value": "#FF0000"
},
{
"value": "#FF7800"
},
{
"value": "#FFCB00"
},
{
"value": "#259B23"
},
{
"value": "#355CFF"
},
{
"value": "#673AB7"
},
{
"value": "#E91E63"
}
],
[
{
"value": "#000000"
},
{
"value": "#A6A6A6"
},
{
"value": "#A80000"
},
{
"value": "#B65600"
},
{
"value": "#CEB000"
},
{
"value": "#0E550C"
},
{
"value": "#09269C"
},
{
"value": "#3A1A73"
},
{
"value": "#B30072"
}
]
],
render: function () {
var self = this, o = this.options;
return {
type: "bi.button_group",
items: this._digest(o.items || this._items),
layouts: [{
type: "bi.grid",
}],
layouts: [
{
type: "bi.grid",
}
],
value: o.value,
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.HexColorPicker.EVENT_CHANGE, arguments);
listeners: [
{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.HexColorPicker.EVENT_CHANGE, arguments);
}
}
}],
],
ref: function (_ref) {
self.colors = _ref;
}

274
src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

@ -21,7 +21,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options, c = this.constants;
this.storeValue = {};
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20
@ -33,146 +33,162 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
var Ws = BI.map(BI.range(0, 3), function () {
return {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.RGB_WIDTH,
height: 24,
listeners: [{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
listeners: [
{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
}]
]
};
});
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.vertical",
tgap: 10,
items: [{
type: 'bi.vertical_adapt',
columnSize: ["fill", 'fill'],
height: 24,
items: [{
type: "bi.color_picker_show_button",
cls: "trans-color-icon",
height: 22,
title: BI.i18nText("BI-Transparent_Color"),
text: BI.i18nText("BI-Transparent_Color"),
listeners: [{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("transparent");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}],
ref: function (_ref) {
self.transparent = _ref;
}
}, {
el: {
type: "bi.color_picker_show_button",
cls: "auto-color-icon",
height: 22,
title: BI.i18nText("BI-Basic_Auto"),
text: BI.i18nText("BI-Basic_Auto"),
listeners: [{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}],
ref: function (_ref) {
self.none = _ref;
}
},
lgap: 10,
}]
}, {
el: {
type: "bi.vertical_adapt",
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
rgap: 5,
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
items: [
{
el: {
type: "bi.vertical",
tgap: 10,
items: [
{
type: 'bi.vertical_adapt',
columnSize: ["fill", 'fill'],
height: 24,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
items: [
{
type: "bi.color_picker_show_button",
cls: "trans-color-icon",
height: 22,
title: BI.i18nText("BI-Transparent_Color"),
text: BI.i18nText("BI-Transparent_Color"),
listeners: [
{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("transparent");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
],
ref: function (_ref) {
self.transparent = _ref;
}
}, {
el: {
type: "bi.color_picker_show_button",
cls: "auto-color-icon",
height: 22,
title: BI.i18nText("BI-Basic_Auto"),
text: BI.i18nText("BI-Basic_Auto"),
listeners: [
{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
],
ref: function (_ref) {
self.none = _ref;
}
},
lgap: 10,
}
}]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
rgap: -5,
width: c.RGB_WIDTH
}]
}
}]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
]
}, {
el: {
type: "bi.vertical_adapt",
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
rgap: 5,
items: [
{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input bi-border-radius",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 24,
listeners: [
{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref;
}
}),
rgap: -5,
width: c.RGB_WIDTH
}
]
}
}
]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
};
},
@ -181,13 +197,13 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
@ -223,7 +239,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-square-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-square-normal-background").removeClass("trans-color-background");
this.colorShow.element.css({ "background-color": color }).removeClass("auto-color-square-normal-background").removeClass("trans-color-background");
}
},

170
src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js

@ -19,7 +19,7 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options, c = this.constants;
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20
@ -31,97 +31,105 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
var Ws = BI.map(BI.range(0, 3), function () {
return {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.RGB_WIDTH,
height: 24,
listeners: [{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
listeners: [
{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
}
}
}
}]
}
]
};
});
return {
type: "bi.vertical",
tgap: 10,
items: [{
el: {
type: "bi.vertical_adapt",
rgap: 5,
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18,
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 24,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
items: [
{
el: {
type: "bi.vertical_adapt",
rgap: 5,
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
items: [
{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18,
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input bi-border-radius",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 24,
listeners: [
{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref;
}
}),
rgap: -5,
width: c.RGB_WIDTH
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
rgap: -5,
width: c.RGB_WIDTH
}]
]
}
}
}]
]
}
};
},
_hexChecker: function (v) {
@ -129,13 +137,13 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION));
@ -157,7 +165,7 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
this.colorShow.element.css({ "background-color": color });
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
@ -174,4 +182,4 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.SimpleHexColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_hex_color_picker_editor", BI.SimpleHexColorPickerEditor);
BI.shortcut("bi.simple_hex_color_picker_editor", BI.SimpleHexColorPickerEditor);

96
src/case/colorchooser/colorpicker/editor.colorpicker.js

@ -29,7 +29,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
height: 16,
width: 16
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createWidgets(BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 20,
@ -41,7 +41,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
@ -95,56 +95,60 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.vertical_adapt",
items: [{
el: this.colorShow,
width: 16
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}, {
el: this.transparent,
width: 16,
lgap: 5
}, {
el: this.none,
width: 16,
lgap: 5
}]
},
left: 10,
right: 10,
top: 0,
bottom: 0
}]
items: [
{
el: {
type: "bi.vertical_adapt",
items: [
{
el: this.colorShow,
width: 16
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}, {
el: this.transparent,
width: 16,
lgap: 5
}, {
el: this.none,
width: 16,
lgap: 5
}
]
},
left: 10,
right: 10,
top: 0,
bottom: 0
}
]
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
@ -164,7 +168,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-normal-background").removeClass("trans-color-background");
this.colorShow.element.css({ "background-color": color }).removeClass("auto-color-normal-background").removeClass("trans-color-background");
}
},
@ -223,4 +227,4 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.ColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);
BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);

64
src/case/colorchooser/colorpicker/editor.colorpicker.simple.js

@ -28,7 +28,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
height: 16,
width: 16
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createWidgets(BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 20,
@ -40,7 +40,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
@ -64,47 +64,49 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [{
el: this.colorShow,
width: 16,
lgap: 20,
rgap: 15
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}]
items: [
{
el: this.colorShow,
width: 16,
lgap: 20,
rgap: 15
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}
]
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
this.colorShow.element.css({ "background-color": color });
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
@ -120,4 +122,4 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.SimpleColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);

10
src/case/linearsegment/linear.segment.js

@ -47,6 +47,14 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
getValue: function () {
return this.buttonGroup.getValue();
}
},
populate: function (buttons) {
var o = this.options;
this.buttonGroup.populate([BI.createItems(buttons, {
type: "bi.linear_segment_button",
height: o.height
})])
},
});
BI.shortcut("bi.linear_segment", BI.LinearSegment);

9
src/case/segment/segment.js

@ -58,6 +58,15 @@ BI.Segment = BI.inherit(BI.Widget, {
getValue: function () {
return this.buttonGroup.getValue();
},
populate: function (buttons) {
var o = this.options;
this.buttonGroup.populate([BI.createItems(buttons, {
type: "bi.segment_button",
height: BI.toPix(o.height, 2),
whiteSpace: o.whiteSpace,
})]);
},
});
BI.Segment.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.segment", BI.Segment);

8
src/case/ztree/parttree.js

@ -37,6 +37,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode);
this.fireEvent(BI.PartTree.EVENT_CLICK_TREE_NODE);
if (treeNode.checked === true) {
this.options.paras.selectedValues = this._getUnionValue();
// this._buildTree(self.options.paras.selectedValues, BI.concat(parentValues, name));
@ -80,7 +81,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
var rootNoots = this.nodes.getNodes();
track(rootNoots);
function track (nodes) {
function track(nodes) {
BI.each(nodes, function (i, node) {
var checkState = node.getCheckStatus();
if (checkState.checked === false) {
@ -135,7 +136,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
self.fireEvent(BI.Events.AFTERINIT);
};
function callback (nodes) {
function callback(nodes) {
if (self._stop === true) {
return;
}
@ -171,7 +172,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
track([], valueA, valueB);
track([], valueB, valueA);
function track (parent, node, compare) {
function track(parent, node, compare) {
BI.each(node, function (n, item) {
if (BI.isNull(compare[n])) {
self._addTreeNode(map, parent, n, item);
@ -197,4 +198,5 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
}
});
BI.PartTree.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.part_tree", BI.PartTree);

13
src/core/2.base.js

@ -1036,11 +1036,18 @@ BI._.extend(BI, {
return MM >= 1 && MM <= 12 && DD <= MD[MM - 1];
},
/**
*
* @param str
* @param fmt
* @returns {Date|Date}
* 年月日缺省值为当前日期, 时分秒缺省值为0
*/
parseDateTime: function (str, fmt) {
var today = BI.getDate();
var y = 0;
var m = 0;
var d = 1;
var y;
var m;
var d;
// wei : 对于fmt为‘YYYYMM’或者‘YYYYMMdd’的格式,str的值为类似'201111'的形式,因为年月之间没有分隔符,所以正则表达式分割无效,导致bug7376。
var a = str.split(/\W+/);
if (fmt.toLowerCase() == "%y%x" || fmt.toLowerCase() == "%y%x%d") {

12
src/core/controller/controller.bubbles.js

@ -46,9 +46,11 @@ export default class BubblesController extends Controller {
BI.createWidget({
type: "bi.default",
element: container,
items: [{
el: bubble
}]
items: [
{
el: bubble
}
]
});
if (this.storePoppers[name]) {
this.storePoppers[name].destroy();
@ -66,6 +68,10 @@ export default class BubblesController extends Controller {
options: {
offset: [adjustXOffset, adjustYOffset]
}
},
{
name: "preventOverflow",
enabled: false
}
]
});

61
src/core/controller/controller.layer.js

@ -67,41 +67,54 @@ export default class LayerController extends Controller {
const layout = BI.createWidget({
type: "bi.absolute",
invisible: true,
items: [{
el: widget,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
items: [
{
el: widget,
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
}, context);
BI.createWidget({
type: "bi.absolute",
element: op.container || this.options.render,
items: [{
el: layout,
left: offset.left || 0,
right: offset.right || 0,
top: offset.top || 0,
bottom: offset.bottom || 0
}]
items: [
{
el: layout,
left: offset.left || 0,
right: offset.right || 0,
top: offset.top || 0,
bottom: offset.bottom || 0
}
]
});
if (w) {
layout.element.addClass("bi-popup-view");
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css({
function getComputedPosition() {
var css = {
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
};
const { top, left, scaleY, scaleX } = BI.DOM.getPositionRelativeContainingBlockRect(layout.element[0]);
css.top = (css.top - top) / scaleY;
css.left = (css.left - left) / scaleX;
return css;
}
layout.element.css(getComputedPosition());
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css(getComputedPosition());
});
}
this.add(name, widget, layout);

3474
src/core/controller/popper.js

File diff suppressed because it is too large Load Diff

189
src/core/platform/web/dom.js

@ -239,22 +239,26 @@
},
isRightSpaceLarger: function (combo) {
var windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return windowBounds.width - combo.element.offset().left - combo.element.bounds().width >= combo.element.offset().left;
var comboBounds = combo.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
return viewportBounds.width - comboBounds.right >= comboBounds.left;
},
isBottomSpaceLarger: function (combo) {
var windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top;
var comboBounds = combo.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
return viewportBounds.height - comboBounds.bottom >= comboBounds.top;
},
_getLeftAlignPosition: function (combo, popup, extraWidth, container) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
var left = combo.element.offset().left - (container ? container.getBoundingClientRect().left : 0) + extraWidth;
var comboRect = combo.element[0].getBoundingClientRect(),
popupRect = popup.element[0].getBoundingClientRect(),
viewportRect = document.documentElement.getBoundingClientRect(),
containerRect = container ? container.getBoundingClientRect() : { left: 0 };
var left = comboRect.left - containerRect.left + extraWidth;
if (left + viewBounds.width > windowBounds.width) {
left = windowBounds.width - viewBounds.width;
if (comboRect.left + popupRect.width > viewportRect.width) {
left = viewportRect.width - popupRect.width - containerRect.left;
}
return left;
},
@ -263,12 +267,13 @@
var left = this._getLeftAlignPosition(combo, popup, extraWidth, container);
var dir = "";
// 如果放不下,优先使用RightAlign, 如果RightAlign也放不下, 再使用left=0
if (left < 0) {
var containerRect = container ? container.getBoundingClientRect() : { left: 0 };
if (left + containerRect.left < 0) {
left = this._getRightAlignPosition(combo, popup, extraWidth);
dir = "left";
}
if (left < 0) {
left = 0;
if (left + containerRect.left < 0) {
left = 0 - containerRect.left;
}
return {
left: left,
@ -276,26 +281,28 @@
};
},
getLeftAdaptPosition: function (combo, popup, extraWidth) {
if (BI.DOM.isLeftSpaceEnough(combo, popup, extraWidth)) {
return BI.DOM.getLeftPosition(combo, popup, extraWidth);
getLeftAdaptPosition: function (combo, popup, extraWidth, container) {
if (BI.DOM.isLeftSpaceEnough(combo, popup, extraWidth, container)) {
return BI.DOM.getLeftPosition(combo, popup, extraWidth, container);
}
return {
left: 0
};
},
_getRightAlignPosition: function (combo, popup, extraWidth) {
var comboBounds = combo.element.bounds(), viewBounds = popup.element.bounds();
return combo.element.offset().left + comboBounds.width - viewBounds.width - extraWidth;
_getRightAlignPosition: function (combo, popup, extraWidth, container) {
var comboBounds = combo.element[0].getBoundingClientRect(),
viewBounds = popup.element[0].getBoundingClientRect(),
containerRect = container ? container.getBoundingClientRect() : { left: 0 };
return comboBounds.left + comboBounds.width - viewBounds.width - extraWidth - containerRect.left;
},
getRightAlignPosition: function (combo, popup, extraWidth) {
var left = this._getRightAlignPosition(combo, popup, extraWidth);
getRightAlignPosition: function (combo, popup, extraWidth, container) {
var left = this._getRightAlignPosition(combo, popup, extraWidth, container);
var dir = "";
// 如果放不下,优先使用LeftAlign, 如果LeftAlign也放不下, 再使用left=0
if (left < 0) {
left = this._getLeftAlignPosition(combo, popup, extraWidth);
left = this._getLeftAlignPosition(combo, popup, extraWidth, container);
dir = "right";
}
if (left < 0) {
@ -307,27 +314,26 @@
};
},
getRightAdaptPosition: function (combo, popup, extraWidth) {
if (BI.DOM.isRightSpaceEnough(combo, popup, extraWidth)) {
return BI.DOM.getRightPosition(combo, popup, extraWidth);
getRightAdaptPosition: function (combo, popup, extraWidth, container) {
if (BI.DOM.isRightSpaceEnough(combo, popup, extraWidth, container)) {
return BI.DOM.getRightPosition(combo, popup, extraWidth, container);
}
return {
left: BI.Widget._renderEngine.createElement("body").bounds().width - popup.element.bounds().width
left: document.documentElement.getBoundingClientRect().width - popup.element[0].getBoundingClientRect().width - container.getBoundingClientRect().left
};
},
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect(),
containerBounds = container ? container.getBoundingClientRect() : { top: 0 };
var top, adaptHeight, dir;
if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top - containerBounds.top + extraHeight;
top = comboBounds.top - containerBounds.top + extraHeight;
} else if (needAdaptHeight) {
top = comboBounds.top - containerBounds.top + extraHeight;
adaptHeight = viewportBounds.height - top;
adaptHeight = viewportBounds.height - comboBounds.top;
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
// 下方空间不足且不允许调整高度的情况下,优先使用上对齐
top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight;
@ -351,44 +357,45 @@
};
},
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) {
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
if (BI.DOM.isTopSpaceEnough(combo, popup, extraHeight)) {
return BI.DOM.getTopPosition(combo, popup, extraHeight);
}
if (needAdaptHeight) {
return {
top: 0,
adaptHeight: combo.element.offset().top - extraHeight
top: 0 - positionRelativeElementRect.top,
adaptHeight: comboBounds.top - extraHeight
};
}
if (popupBounds.height + extraHeight > windowBounds.height) {
if (popupBounds.height + extraHeight > viewportBounds.height) {
return {
top: 0,
adaptHeight: windowBounds.height - extraHeight
top: 0 - positionRelativeElementRect.top,
adaptHeight: viewportBounds.height - extraHeight
};
}
return {
top: 0
top: 0 - positionRelativeElementRect.top
};
},
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(),
containerBounds = container ? container.getBoundingClientRect() : { top: 0 };
var top, adaptHeight, dir;
if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height;
top = comboBounds.top + comboBounds.height - containerBounds.top - popupBounds.height;
} else if (needAdaptHeight) {
top = 0 - containerBounds.top;
adaptHeight = comboBounds.top + comboBounds.height - extraHeight;
} else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
// 上方空间不足且不允许调整高度的情况下,优先使用下对齐
top = comboOffset.top - containerBounds.top + extraHeight;
top = comboBounds.top - containerBounds.top + extraHeight;
dir = "bottom";
} else {
top = 0;
@ -409,41 +416,43 @@
};
},
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) {
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect();
if (BI.DOM.isBottomSpaceEnough(combo, popup, extraHeight)) {
return BI.DOM.getBottomPosition(combo, popup, extraHeight);
return BI.DOM.getBottomPosition(combo, popup, extraHeight, positionRelativeElement);
}
if (needAdaptHeight) {
return {
top: comboOffset.top + comboBounds.height + extraHeight,
adaptHeight: windowBounds.height - comboOffset.top - comboBounds.height - extraHeight
top: comboBounds.top + comboBounds.height + extraHeight - positionRelativeElementRect.top,
adaptHeight: viewportBounds.height - comboBounds.top - comboBounds.height - extraHeight
};
}
if (popupBounds.height + extraHeight > windowBounds.height) {
if (popupBounds.height + extraHeight > viewportBounds.height) {
return {
top: extraHeight,
adaptHeight: windowBounds.height - extraHeight
top: extraHeight - positionRelativeElementRect.top,
adaptHeight: viewportBounds.height - extraHeight
};
}
return {
top: windowBounds.height - popupBounds.height - extraHeight
top: viewportBounds.height - popupBounds.height - extraHeight - positionRelativeElementRect.top
};
},
getCenterAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getCenterAdaptPosition: function (combo, popup, positionRelativeElement) {
var comboRect = combo.element[0].getBoundingClientRect(),
popupRect = popup.element[0].getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
var left;
if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) {
left = windowBounds.width - popupBounds.width;
if (comboRect.left + comboRect.width / 2 + popupRect.width / 2 > viewportBounds.width) {
left = viewportBounds.width - comboRect.width - positionRelativeElementRect.left;
} else {
left = comboOffset.left + comboBounds.width / 2 - popupBounds.width / 2;
left = comboRect.left + (comboRect.width - popupRect.width) / 2 - positionRelativeElementRect.left;
}
if (left < 0) {
if (left + positionRelativeElementRect.left < 0) {
left = 0;
}
return {
@ -451,17 +460,19 @@
};
},
getMiddleAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getMiddleAdaptPosition: function (combo, popup, positionRelativeElement) {
var comboRect = combo.element[0].getBoundingClientRect(),
popupRect = popup.element[0].getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
var top;
if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) {
top = windowBounds.height - popupBounds.height;
if (comboRect.top + comboRect.height / 2 + popupRect.height / 2 > viewportBounds.height) {
top = viewportBounds.height - popupRect.height - positionRelativeElementRect.top;
} else {
top = comboOffset.top + comboBounds.height / 2 - popupBounds.height / 2;
top = comboRect.top + (comboRect.height - popupRect.height) / 2 - positionRelativeElementRect.top;
}
if (top < 0) {
if (top + positionRelativeElementRect.top < 0) {
top = 0;
}
return {
@ -633,10 +644,10 @@
case "left":
case "right":
if (BI.DOM.isRightSpaceLarger(combo)) {
left = BI.DOM.getRightAdaptPosition(combo, popup, extraWidth).left;
left = BI.DOM.getRightAdaptPosition(combo, popup, extraWidth, container).left;
firstDir = "right";
} else {
left = BI.DOM.getLeftAdaptPosition(combo, popup, extraWidth).left;
left = BI.DOM.getLeftAdaptPosition(combo, popup, extraWidth, container).left;
firstDir = "left";
}
if (topBottom[0] === "bottom") {
@ -651,19 +662,19 @@
return pos;
default :
if (BI.DOM.isBottomSpaceLarger(combo)) {
top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top;
top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight, container).top;
firstDir = "bottom";
} else {
top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top;
top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight, container).top;
firstDir = "top";
}
if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth);
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, container);
pos.top = top;
pos.dir = firstDir + "," + pos.dir;
return pos;
}
pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth);
pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth, container);
pos.top = top;
pos.dir = firstDir + "," + pos.dir;
return pos;
@ -671,35 +682,35 @@
},
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, container) {
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, positionRelativeElement) {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight;
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight);
var viewportBounds = document.documentElement.getBoundingClientRect();
var maxHeight = Math.min(popup.attr("maxHeight") || viewportBounds.height, viewportBounds.height);
popup.resetHeight && popup.resetHeight(maxHeight);
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], container);
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], positionRelativeElement);
switch (offsetStyle) {
case "center":
if (position.change) {
var p = BI.DOM.getMiddleAdaptPosition(combo, popup);
var p = BI.DOM.getMiddleAdaptPosition(combo, popup, positionRelativeElement);
position.top = p.top;
} else {
var p = BI.DOM.getCenterAdaptPosition(combo, popup);
var p = BI.DOM.getCenterAdaptPosition(combo, popup, positionRelativeElement);
position.left = p.left;
}
break;
case "middle":
if (position.change) {
var p = BI.DOM.getCenterAdaptPosition(combo, popup);
var p = BI.DOM.getCenterAdaptPosition(combo, popup, positionRelativeElement);
position.left = p.left;
} else {
var p = BI.DOM.getMiddleAdaptPosition(combo, popup);
var p = BI.DOM.getMiddleAdaptPosition(combo, popup, positionRelativeElement);
position.top = p.top;
}
break;
}
if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
popup.resetHeight && popup.resetHeight(Math.min(viewportBounds.height - position.top + (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight));
}
return position;
},
@ -729,5 +740,19 @@
return BI.DOM.getPositionRelativeContainingBlock(element.parentNode);
},
/**
* 获取position:fixed相对定位的元素的clientRect
*/
getPositionRelativeContainingBlockRect: function (element) {
var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(element);
var rect = positionRelativeElement.getBoundingClientRect();
return {
...rect.toJSON(),
scaleX: rect.width / positionRelativeElement.offsetWidth,
scaleY: rect.height / positionRelativeElement.offsetHeight
};
},
});
})();

3
src/core/platform/web/function.js

@ -140,8 +140,9 @@ BI._.extend(BI, {
},
getMinimumFontSize: function () {
// not work for firefox
const el = document.createElement('div');
el.style.fontSize = "0px";
el.style.fontSize = "1px";
document.body.appendChild(el);
const size = getComputedStyle(el).fontSize;
el.remove();

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

@ -40,10 +40,12 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
},
items: this._createItems(opts.items),
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
layouts: [{
type: "bi.vertical",
lgap: 10
}]
layouts: [
{
type: "bi.vertical",
lgap: 10
}
]
},
itemsCreator: function (options, callback) {
if (options.times === 1) {
@ -53,10 +55,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
if (cacheItems.length > 0) {
var renderedItems = cacheItems.slice(0, 100);
cacheItems = cacheItems.slice(100);
self.hasNext = true;
if (cacheItems.length === 0) {
self.hasNext = false;
}
self.hasNext = cacheItems.length > 0;
callback(self._createItems(renderedItems));
return;
}
@ -65,8 +64,8 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
self.hasNext = !!ob.hasNext;
var firstItemsCount = 100 + ob.items.length % 100;
if (ob.items.length > 100) {
cacheItems = ob.items.slice(100 + ob.items.length % 100);
self.hasNext = true;
cacheItems = ob.items.slice(firstItemsCount);
self.hasNext = (firstItemsCount === ob.items.length) ? false : true;
}
callback(self._createItems(ob.items.slice(0, firstItemsCount)));
});
@ -104,4 +103,4 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
}
});
BI.shortcut("bi.display_selected_list", BI.DisplaySelectedList);
BI.shortcut("bi.display_selected_list", BI.DisplaySelectedList);

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

@ -42,7 +42,15 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
itemsCreator: o.itemsCreator
itemsCreator: o.itemsCreator,
listeners: [
{
eventName: BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE,
action: function () {
self._dataChange = true;
}
}
],
},
value: { value: o.value || {} }
});
@ -61,43 +69,45 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
listeners: [
{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
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());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
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());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}],
],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
@ -293,26 +303,28 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
bottom: 0
}]
items: [
{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
bottom: 0
}
]
});
},

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

@ -47,18 +47,25 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
listeners: [{
eventName: BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.storeValue.value[self.trigger.getSearcher().getKeyword()] = {};
self._assertShowValue();
// setValue以更新paras.value, 之后从search popup中拿到的就能有add的值了
self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue);
self._stopEditing();
self._dataChange = true;
listeners: [
{
eventName: BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.storeValue.value[self.trigger.getSearcher().getKeyword()] = {};
self._assertShowValue();
// setValue以更新paras.value, 之后从search popup中拿到的就能有add的值了
self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue);
self._stopEditing();
self._dataChange = true;
}
}, {
eventName: BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE,
action: function () {
self._dataChange = true;
}
}
}]
]
}
},
value: { value: o.value || {} }
@ -79,43 +86,45 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
listeners: [
{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}],
],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
@ -303,26 +312,28 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height,
}]
items: [
{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height,
}
]
});
},

108
src/widget/multitree/trigger/multi.tree.search.insert.pane.js

@ -25,55 +25,64 @@ BI.MultiTreeSearchInsertPane = BI.inherit(BI.Widget, {
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.text_button",
invisible: true,
ref: function (_ref) {
self.addTip = _ref;
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
height: this.constants.height,
cls: "bi-high-light",
handler: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM, opts.keywordGetter());
}
},
top: 5,
left: 0,
right: 0
}, {
el: BI.extend({
type: "bi.part_tree",
tipText: BI.i18nText("BI-No_Select"),
itemsCreator: function (op, callback) {
op.keyword = opts.keywordGetter();
opts.itemsCreator(op, function (res) {
callback(res);
self.setKeyword(opts.keywordGetter(), res.items);
});
},
ref: function (_ref) {
self.partTree = _ref;
},
value: opts.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
items: [
{
el: {
type: "bi.text_button",
invisible: true,
ref: function (_ref) {
self.addTip = _ref;
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
height: this.constants.height,
cls: "bi-high-light",
handler: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM, opts.keywordGetter());
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CHANGE);
}
}]
}, opts.el),
left: 0,
top: 0,
bottom: 0,
right: 0
}]
},
top: 5,
left: 0,
right: 0
}, {
el: BI.extend({
type: "bi.part_tree",
tipText: BI.i18nText("BI-No_Select"),
itemsCreator: function (op, callback) {
op.keyword = opts.keywordGetter();
opts.itemsCreator(op, function (res) {
callback(res);
self.setKeyword(opts.keywordGetter(), res.items);
});
},
ref: function (_ref) {
self.partTree = _ref;
},
value: opts.value,
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CHANGE);
}
}, {
eventName: BI.PartTree.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE);
}
}
]
}, opts.el),
left: 0,
top: 0,
bottom: 0,
right: 0
}
]
};
},
@ -115,5 +124,6 @@ BI.MultiTreeSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_search_insert_pane", BI.MultiTreeSearchInsertPane);
BI.shortcut("bi.multi_tree_search_insert_pane", BI.MultiTreeSearchInsertPane);

30
src/widget/multitree/trigger/multi.tree.search.pane.js

@ -25,17 +25,24 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
opts.itemsCreator(op, callback);
},
value: opts.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE);
}
}, {
eventName: BI.PartTree.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE);
}
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE);
}
}],
],
ref: function (_ref) {
self.partTree = _ref;
}
@ -72,5 +79,6 @@ BI.MultiTreeSearchPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);
BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);

31
src/widget/multitree/trigger/searcher.multi.tree.js

@ -33,17 +33,19 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
defaultText: o.defaultText,
height: o.height
},
listeners: [{
eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
listeners: [
{
eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
}
}, {
eventName: BI.MultiSelectEditor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
}
}
}, {
eventName: BI.MultiSelectEditor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
}
}]
]
});
this.searcher = BI.createWidget({
@ -67,6 +69,14 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
listeners: [
{
eventName: BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE, arguments);
}
}
],
value: o.value
}, o.popup),
@ -206,4 +216,5 @@ BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearcher.EVENT_START = "EVENT_START";
BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_searcher", BI.MultiTreeSearcher);

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

@ -18,7 +18,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
errorText: "",
step: 1,
min: BI.MIN,
max: BI.MAX
max: BI.MAX,
watermark: "",
});
},
@ -30,6 +31,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
height: BI.toPix(o.height, 2),
simple: o.simple,
allowBlank: o.allowBlank,
watermark: o.watermark,
value: o.valueFormatter(o.value),
validationChecker: function (v) {
// 不设置validationChecker就自动检测
@ -89,23 +91,27 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.htape",
height: BI.toPix(o.height, 2),
element: this,
items: [this.editor, {
el: {
type: "bi.grid",
columns: 1,
rows: 2,
items: [{
column: 0,
row: 0,
el: this.topBtn
}, {
column: 0,
row: 1,
el: this.bottomBtn
}]
},
width: 23
}]
items: [
this.editor, {
el: {
type: "bi.grid",
columns: 1,
rows: 2,
items: [
{
column: 0,
row: 0,
el: this.topBtn
}, {
column: 0,
row: 1,
el: this.bottomBtn
}
]
},
width: 23
}
]
});
},
@ -117,13 +123,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
return this.editor.isEditing();
},
_checkValueInRange: function(v) {
_checkValueInRange: function (v) {
var o = this.options;
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max);
},
_checkAdjustDisabled: function(v) {
if(this.options.validationChecker === BI.emptyFn) {
_checkAdjustDisabled: function (v) {
if (this.options.validationChecker === BI.emptyFn) {
this.bottomBtn.setEnable(BI.parseFloat(v) > this.options.min);
this.topBtn.setEnable(BI.parseFloat(v) < this.options.max);
}

2
typescript/base/single/button/button.basic.ts

@ -38,7 +38,7 @@ export declare class BasicButton extends Single {
trigger?: string | null;
handler?: Function;
bubble?: Function | null | string;
text?: string;
text?: string | ((context: any) => string);
el?: Obj;
} & Single["props"];

Loading…
Cancel
Save