Browse Source

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

es6
Claire 3 years ago
parent
commit
6b433c345f
  1. 15
      changelog.md
  2. 2
      package.json
  3. 43
      src/base/single/input/input.js
  4. 4
      src/case/checkbox/check.first.treenode.js
  5. 4
      src/case/checkbox/check.last.treenode.js
  6. 4
      src/case/checkbox/check.mid.treenode.js
  7. 4
      src/case/checkbox/check.treenode.js
  8. 9
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  9. 1
      src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js
  10. 25
      src/case/combo/textvaluecombo/combo.textvalue.js
  11. 2
      src/case/list/list.select.js
  12. 63
      src/case/trigger/trigger.text.js
  13. 25
      src/case/trigger/trigger.text.select.js
  14. 2
      src/core/wrapper/layout/layout.inline.js
  15. 35
      src/less/base/combo/combo.less
  16. 14
      src/less/base/combo/combo.textvalue.less
  17. 11
      src/less/base/trigger/trigger.text.less
  18. 2
      src/less/core/wrapper/flex.horizontal.less
  19. 2
      src/less/core/wrapper/flex.vertical.less
  20. 2
      src/less/core/wrapper/flex.wrapper.horizontal.less
  21. 2
      src/less/core/wrapper/flex.wrapper.vertical.less
  22. 1
      src/less/lib/theme.less
  23. 28
      src/less/widget/multilayerselecttree/multilayerselecttree.combo.less
  24. 27
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  25. 74
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  26. 39
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  27. 30
      src/widget/multilayersingletree/multilayersingletree.combo.js
  28. 37
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  29. 40
      src/widget/selecttree/selecttree.combo.js
  30. 40
      src/widget/singletree/singletree.combo.js
  31. 22
      src/widget/singletree/singletree.trigger.js
  32. 8
      src/widget/year/combo.year.js
  33. 9
      src/widget/year/trigger.year.js
  34. 2
      typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts
  35. 2
      typescript/widget/multilayersingletree/multilayersingletree.combo.ts

15
changelog.md

@ -1,4 +1,19 @@
# 更新日志
3.0(2022-05)
- 下拉选择框支持清空
3.0(2022-03)
- 支持响应式
- 全面支持Typescript
- 增加JSX支持
- 布局组件支持更多动态特性
- 底层API支持动画
- 增加WebWorker支持
- 支持路由
- 插件支持版本控制
- Fix数据流支持proxy版本
2.0(2022-01)
- 提供自定义表单

2
package.json

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

43
src/base/single/input/input.js

@ -206,14 +206,29 @@ BI.Input = BI.inherit(BI.Single, {
this._lastValue = this.getValue();
},
_checkValidationOnValueChange: function () {
var o = this.options;
_checkValidationOnValueChange: function (callback) {
var self = this, o = this.options;
var v = this.getValue();
this.setValid(
(o.allowBlank === true && BI.trim(v) == "") || (
BI.isNotEmptyString(BI.trim(v)) && o.validationChecker.apply(this, [BI.trim(v)]) !== false
)
);
if (o.allowBlank === true && BI.trim(v) == "") {
this.setValid(true);
callback && callback();
return;
}
if (BI.trim(v) == "") {
this.setValid(false);
callback && callback();
return;
}
var checker = o.validationChecker.apply(this, [BI.trim(v)]);
if (checker instanceof Promise) {
checker.then(function (validate) {
self.setValid(validate !== false);
callback && callback();
})
} else {
this.setValid(checker !== false);
callback && callback();
}
},
focus: function () {
@ -245,14 +260,16 @@ BI.Input = BI.inherit(BI.Single, {
},
setValue: function (textValue) {
var self = this;
this.element.val(textValue);
BI.nextTick(BI.bind(function () {
this._checkValidationOnValueChange();
this._defaultState();
if (this.isValid()) {
this._lastValidValue = this._lastSubmitValue = this.getValue();
BI.nextTick(function () {
self._checkValidationOnValueChange(function () {
self._defaultState();
if (self.isValid()) {
self._lastValidValue = self._lastSubmitValue = self.getValue();
}
}, this));
});
});
},
getValue: function () {

4
src/case/checkbox/check.first.treenode.js

@ -7,8 +7,8 @@ BI.FirstTreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.FirstTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type2" : "tree-collapse-icon-type2",
iconWidth: 24,
iconHeight: 24
iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT
});
},

4
src/case/checkbox/check.last.treenode.js

@ -7,8 +7,8 @@ BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend(BI.LastTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type4" : "tree-collapse-icon-type4",
iconWidth: 24,
iconHeight: 24
iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT
});
},

4
src/case/checkbox/check.mid.treenode.js

@ -7,8 +7,8 @@ BI.MidTreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.MidTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type3" : "tree-collapse-icon-type3",
iconWidth: 24,
iconHeight: 24
iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT
});
},

4
src/case/checkbox/check.treenode.js

@ -7,8 +7,8 @@ BI.TreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.TreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type1" : "tree-collapse-icon-type1",
iconWidth: 24,
iconHeight: 24
iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT
});
},

9
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -11,6 +11,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
items: [],
tipType: "",
warningTitle: "",
allowClear: false,
},
render: function () {
@ -48,6 +49,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
allowClear: o.allowClear,
listeners: [{
eventName: BI.SearchTextValueTrigger.EVENT_CHANGE,
action: function () {
@ -55,6 +57,13 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
self.combo.hideView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}, {
eventName: BI.SearchTextValueTrigger.EVENT_CLEAR,
action: function () {
self.setValue();
self.combo.hideView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}]
},
popup: {

1
src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js

@ -111,4 +111,5 @@ BI.SearchTextValueTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.SearchTextValueTrigger.EVENT_STOP = "EVENT_STOP";
BI.SearchTextValueTrigger.EVENT_START = "EVENT_START";
BI.SearchTextValueTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchTextValueTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.search_text_value_trigger", BI.SearchTextValueTrigger);

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

@ -12,6 +12,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
text: "",
value: "",
allowClear: false,
});
},
@ -33,7 +34,16 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
height: o.height,
text: o.text,
value: o.value,
warningTitle: o.warningTitle
warningTitle: o.warningTitle,
allowClear: o.allowClear,
listeners: [
{
eventName: BI.SelectTextTrigger.EVENT_CLEAR,
action: function () {
self._clear();
}
}
],
});
this.popup = BI.createWidget({
type: "bi.text_value_combo_popup",
@ -67,10 +77,15 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
}
},
_clear: function () {
this.setValue();
},
_checkError: function (v) {
if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) {
this.trigger.options.tipType = "success";
this.element.removeClass("combo-error");
this.element.removeClass("error");
this.trigger.element.removeClass("error");
} else {
v = BI.isArray(v) ? v : [v];
var result = BI.find(this.options.items, function (idx, item) {
@ -78,10 +93,12 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
});
if (BI.isNull(result)) {
this.trigger.setTipType("warning");
this.element.removeClass("combo-error").addClass("combo-error");
this.element.addClass("error");
this.trigger.element.addClass("error");
} else {
this.trigger.setTipType("success");
this.element.removeClass("combo-error");
this.element.removeClass("error");
this.trigger.element.removeClass("error");
}
}
},

2
src/case/list/list.select.js

@ -94,7 +94,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
var hasNext = this.list.hasNext();
var isAlreadyAllSelected = this.toolbar.isSelected();
var isHalf = selectLength > 0 && notSelectLength > 0;
var allSelected = isAlreadyAllSelected;
var allSelected = selectLength > 0 && notSelectLength <= 0 && (!hasNext || isAlreadyAllSelected);
if (this.isAllSelected() === false) {
hasNext && (isHalf = selectLength > 0);

63
src/case/trigger/trigger.text.js

@ -7,25 +7,27 @@
*/
BI.TextTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
props: function () {
var self = this;
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger",
return {
baseCls: "bi-text-trigger",
height: 24,
textHgap: 6,
textCls: "",
allowClear: false,
title: function () {
return self.text.getText();
}
});
};
},
_init: function () {
BI.TextTrigger.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({
var text = {
type: "bi.label",
ref: function (_ref) {
self.text = _ref;
},
cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left",
height: o.height,
@ -39,22 +41,46 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
tgap: o.textTgap,
bgap: o.textBgap,
readonly: o.readonly
});
this.trigerButton = BI.createWidget({
};
var triggerButton = {
type: "bi.trigger_icon_button",
ref: function (_ref) {
self.triggerButton = _ref;
},
width: o.triggerWidth || o.height
});
};
BI.createWidget({
element: this,
return ({
type: "bi.horizontal_fill",
columnSize: ["fill", o.triggerWidth || o.height],
items: [
{
el: this.text,
el: text,
width: "fill"
}, {
el: this.trigerButton,
width: o.triggerWidth || o.height
el: o.allowClear ? {
type: "bi.vertical_adapt",
horizontalAlign: "left",
scrollable: false,
items: [
{
el: {
type: "bi.icon_button",
ref: function (_ref) {
self.clearBtn = _ref;
},
cls: "close-h-font " + (o.allowClear ? "clear-button" : ""),
stopPropagation: true,
handler: function () {
self.fireEvent(BI.TextTrigger.EVENT_CLEAR);
},
},
}, {
el: triggerButton,
}
]
} : triggerButton,
}
]
});
@ -73,6 +99,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
setText: function (text) {
this.text.setText(text);
if (this.options.allowClear) {
this.clearBtn.setVisible(BI.isNotEmptyString(text));
}
},
setTipType: function (v) {
@ -80,4 +109,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
this.options.tipType = v;
}
});
BI.TextTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.text_trigger", BI.TextTrigger);

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

@ -11,6 +11,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
return BI.extend(BI.SelectTextTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-text-trigger",
height: 24,
allowClear: false,
});
},
@ -32,7 +33,17 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
textTgap: o.textTgap,
textBgap: o.textBgap,
tipType: o.tipType,
warningTitle: o.warningTitle
warningTitle: o.warningTitle,
allowClear: o.allowClear,
listeners: [
{
eventName: BI.TextTrigger.EVENT_CLEAR,
action: function () {
self.setText("");
self.fireEvent(BI.SelectTextTrigger.EVENT_CLEAR);
}
}
]
});
},
@ -51,15 +62,20 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
return {
textCls: "",
text: result.join(",")
}
};
} else {
return {
textCls: "bi-water-mark",
text: BI.isFunction(o.text) ? o.text() : o.text
}
};
}
},
setText: function (text) {
this.options.text = text;
this.trigger.setText(text);
},
setValue: function (vals) {
var formatValue = this._digest(vals, this.options.items);
this.trigger.setTextCls(formatValue.textCls);
@ -67,6 +83,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
},
setTipType: function (v) {
this.options.tipType = v;
this.trigger.setTipType(v);
},
@ -78,4 +95,6 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.items = items;
}
});
BI.SelectTextTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.select_text_trigger", BI.SelectTextTrigger);

2
src/core/wrapper/layout/layout.inline.js

@ -40,7 +40,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width;
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (o.columnSize.length > 0) {
if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) {
columnSize = null;

35
src/less/base/combo/combo.less

@ -1,4 +1,5 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-combo {
& > .bi-trigger {
@ -9,9 +10,11 @@
}
}
}
&.bi-combo-popup {
display: block !important;
visibility: visible !important;
& > .bi-trigger {
& .bi-trigger-icon-button {
& .x-icon {
@ -21,11 +24,13 @@
}
}
}
&.bi-combo-popup, &.bi-combo-hover, &:hover {
&.bi-border, &.bi-border-bottom {
border-color: @color-bi-border-hover-combo;
}
}
&.disabled {
&.bi-combo-hover, &:hover {
&.bi-border, &.bi-border-bottom {
@ -33,6 +38,36 @@
}
}
}
&.error {
&.bi-combo-hover, &:hover {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
}
}
// 将来统一变成combo的特性
//&.status-error {
// &.bi-border, &.bi-border-bottom {
// border-color: @border-color-negative;
// }
//
// .bi-trigger .select-text-label {
// color: @color-bi-text-error-text-trigger;
// }
//}
//
//&.status-warning {
// &.bi-border, &.bi-border-bottom {
// border-color: @border-color-warning;
// }
//
// .bi-trigger .select-text-label {
// color: @font-color-warning;
// }
//}
}
.bi-theme-dark {

14
src/less/base/combo/combo.textvalue.less

@ -1,14 +0,0 @@
@import "../../index.less";
.bi-text-value-combo {
&.combo-error {
& .bi-select-text-trigger {
& .select-text-label {
color: @color-bi-text-error-hover-text-value-combo;
}
}
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
}
}

11
src/less/base/trigger/trigger.text.less

@ -0,0 +1,11 @@
@import "../../index.less";
.bi-text-trigger {
&.error .select-text-label {
color: @color-bi-text-error-text-trigger;
}
&:where(:not(&:hover)) .clear-button {
display: none;
}
}

2
src/less/core/wrapper/flex.horizontal.less

@ -169,7 +169,9 @@
}
> .f-f {
&:not(.f-s-n) {
min-width: 0;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

2
src/less/core/wrapper/flex.vertical.less

@ -168,7 +168,9 @@
}
> .f-f {
&:not(.f-s-n) {
min-height: 0;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

2
src/less/core/wrapper/flex.wrapper.horizontal.less

@ -265,7 +265,9 @@
}
> .f-f {
&:not(.f-s-n) {
min-width: 0;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

2
src/less/core/wrapper/flex.wrapper.vertical.less

@ -259,7 +259,9 @@
}
> .f-f {
&:not(.f-s-n) {
min-height: 0;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

1
src/less/lib/theme.less

@ -179,6 +179,7 @@
@color-bi-border-hover-text-value-down-list-combo: @color-bi-border-highlight;
@color-bi-border-hover-text-value-check-combo: @color-bi-border-highlight;
@color-bi-text-error-hover-text-value-combo: @color-bi-text-failure;
@color-bi-text-error-text-trigger: @color-bi-text-failure;
@color-bi-text-error-hover-text-value-icon-combo: @color-bi-text-failure;
@color-bi-text-error-hover-search-text-value-combo: @color-bi-text-failure;
@color-bi-background-bubble-combo-triangle: @color-bi-background-default;

28
src/less/widget/multilayerselecttree/multilayerselecttree.combo.less

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

27
src/less/widget/multilayersingletree/multilayersingletree.combo.less

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

74
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -16,66 +16,29 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
allowEdit: false,
allowSearchValue: false,
allowInsertValue: false,
isNeedAdjustWidth: true
isNeedAdjustWidth: true,
status: "", // "error","warning"
});
},
_init: function () {
var o = this.options;
if (this._shouldWrapper()) {
o.height -= 2;
BI.isNumeric(o.width) && (o.width -= 2);
}
BI.isNumeric(o.height) && (o.height -= 2);
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
},
render: function () {
var self = this, o = this.options;
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
return this._shouldWrapper() ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
_shouldWrapper: function () {
var o = this.options;
return !o.allowEdit && o.itemsCreator === BI.emptyFn;
return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
},
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
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,
@ -139,7 +102,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
watermark: o.watermark,
height: o.height - (o.simple ? 1 : 2),
// height: o.height - (o.simple ? 1 : 2),
height: o.height,
text: o.text,
value: o.value,
tipType: o.tipType,
@ -184,7 +148,7 @@ BI.MultiLayerSelectTreeCombo = 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) ? false : self.triggerBtn.element.find(e.target).length === 0;
return !(o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0);
},
listeners: [{
@ -198,7 +162,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW);
}
}]
}
};
},
_getSyncConfig: function () {
@ -213,7 +177,9 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
text: o.text,
height: o.height,
items: o.items,
value: o.value
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
}
});
},
@ -236,6 +202,22 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
return this.trigger ? this.trigger.getSearcher() : this.textTrigger.getTextor();
},
clear: function () {
// do some work
},
setStatus: function (status) {
if (BI.isKey(this.options.status)) {
this.element.removeClass("status-" + this.options.status);
}
this.element.addClass("status-" + status);
this.options.status = status;
},
setTipType: function (v) {
this.trigger ? this.trigger.setTipType(v) : this.textTrigger.setTipType(v);
},
populate: function (items) {
this.combo.populate(items);
},

39
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -19,8 +19,9 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
if (o.itemsCreator === BI.emptyFn) {
this._initData();
}
var content = {
type: "bi.htape",
return {
type: "bi.horizontal_fill",
items: [
{
el: {
@ -99,35 +100,21 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
},
width: "fill",
}, {
el: {
type: "bi.layout",
width: 24
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: 24,
},
width: 24
width: 24,
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_initData: function () {
@ -159,7 +146,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
};
},
_getChildren: function (node) {

30
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -25,17 +25,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
_init: function () {
var o = this.options;
if (this._shouldWrapper()) {
o.height -= 2;
BI.isNumeric(o.width) && (o.width -= 2);
}
BI.isNumeric(o.height) && (o.height -= 2);
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
},
render: function () {
var self = this, o = this.options;
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
return this._shouldWrapper() ? combo : {
type: "bi.absolute",
@ -79,7 +77,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
return {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
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,
@ -142,7 +140,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
items: o.items,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
height: o.height - (o.simple ? 1 : 2),
height: o.height,
text: o.text,
value: o.value,
tipType: o.tipType,
@ -186,7 +184,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) ? false : self.triggerBtn.element.find(e.target).length === 0
return !(o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0);
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
@ -199,7 +197,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW);
}
}]
}
};
},
_getSyncConfig: function () {
@ -214,7 +212,9 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
text: o.text,
height: o.height,
items: o.items,
value: o.value
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
}
});
},
@ -237,6 +237,18 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return this.combo.getValue();
},
setStatus: function (status) {
if (BI.isKey(this.options.status)) {
this.element.removeClass("status-" + this.options.status);
}
this.element.addClass("status-" + status);
this.options.status = status;
},
setTipType: function (v) {
this.trigger ? this.trigger.setTipType(v) : this.textTrigger.setTipType(v);
},
populate: function (items) {
this.combo.populate(items);
},

37
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -19,8 +19,9 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
if (o.itemsCreator === BI.emptyFn) {
this._initData();
}
var content = {
type: "bi.htape",
return {
type: "bi.horizontal_fill",
items: [
{
el: {
@ -99,35 +100,21 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
},
width: "fill",
}, {
el: {
type: "bi.layout",
width: 24
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: 24,
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_initData: function () {
@ -159,7 +146,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
value: node.value,
isParent: BI.isNotEmptyArray(node.children),
open: open
}
};
},
_getChildren: function (node) {

40
src/widget/selecttree/selecttree.combo.js

@ -11,6 +11,7 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
text: "",
items: [],
value: "",
allowClear: false,
});
},
@ -25,7 +26,13 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
text: o.text,
height: o.height,
items: o.items,
value: o.value
value: o.value,
allowClear: o.allowClear,
warningTitle: o.warningTitle,
});
this.trigger.on(BI.SingleTreeTrigger.EVENT_CLEAR, function () {
self._clear();
});
this.popup = BI.createWidget({
@ -53,12 +60,43 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
self.setValue(self.popup.getValue());
self.combo.hideView();
});
if (BI.isKey(o.value)) {
this._checkError(o.value);
}
},
_checkError: function (v) {
if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) {
this.trigger.options.tipType = "success";
this.trigger.element.removeClass("error");
this.element.removeClass("error");
} else {
v = BI.isArray(v) ? v : [v];
var result = BI.find(this.options.items, function (idx, item) {
return BI.contains(v, item.value);
});
if (BI.isNull(result)) {
this.trigger.setTipType("warning");
this.element.removeClass("error").addClass("error");
this.trigger.element.removeClass("error").addClass("error");
} else {
this.trigger.setTipType("success");
this.trigger.element.removeClass("error");
this.element.removeClass("error");
}
}
},
_clear: function () {
this.setValue([]);
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this._checkError(v);
},
getValue: function () {

40
src/widget/singletree/singletree.combo.js

@ -12,6 +12,7 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
text: "",
items: [],
value: "",
allowClear: false,
});
},
@ -26,9 +27,15 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
text: o.text,
height: o.height,
items: o.items,
value: o.value
value: o.value,
allowClear: o.allowClear,
warningTitle: o.warningTitle,
}, o.trigger));
this.trigger.on(BI.SingleTreeTrigger.EVENT_CLEAR, function () {
self._clear();
});
this.popup = BI.createWidget({
type: "bi.single_level_tree",
items: o.items,
@ -58,6 +65,36 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
self.combo.hideView();
self.fireEvent(BI.SingleTreeCombo.EVENT_CHANGE);
});
if (BI.isKey(o.value)) {
this._checkError(o.value);
}
},
_checkError: function (v) {
if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) {
this.trigger.options.tipType = "success";
this.trigger.element.removeClass("error");
this.element.removeClass("error");
} else {
v = BI.isArray(v) ? v : [v];
var result = BI.find(this.options.items, function (idx, item) {
return BI.contains(v, item.value);
});
if (BI.isNull(result)) {
this.trigger.setTipType("warning");
this.element.removeClass("error").addClass("error");
this.trigger.element.removeClass("error").addClass("error");
} else {
this.trigger.setTipType("success");
this.trigger.element.removeClass("error");
this.element.removeClass("error");
}
}
},
_clear: function () {
this.setValue([]);
},
populate: function (items) {
@ -68,6 +105,7 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this._checkError(v);
},
getValue: function () {

22
src/widget/singletree/singletree.trigger.js

@ -11,7 +11,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
height: 24,
text: "",
items: [],
value: ""
value: "",
allowClear: false,
});
},
@ -26,7 +27,18 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
text: o.text,
items: o.items,
height: o.height,
value: o.value
warningTitle: o.warningTitle,
tipType: o.tipType,
value: o.value,
allowClear: o.allowClear,
listeners: [
{
eventName: BI.SelectTextTrigger.EVENT_CLEAR,
action: function () {
self.fireEvent(BI.SingleTreeTrigger.EVENT_CLEAR);
}
}
]
});
},
@ -47,6 +59,11 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
this._checkTitle();
},
setTipType: function (v) {
this.options.tipType = v;
this.trigger.setTipType(v);
},
getValue: function () {
return this.options.value || [];
},
@ -61,4 +78,5 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
});
BI.SingleTreeTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);

8
src/widget/year/combo.year.js

@ -24,7 +24,8 @@ BI.DynamicYearCombo = 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.DynamicYearTrigger.EVENT_KEY_DOWN, function () {
if (self.combo.isViewVisible()) {
@ -211,8 +212,11 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
isStateValid: function () {
return this.trigger.isValid();
}
},
setWaterMark: function (v) {
this.trigger.setWaterMark(v);
}
});
BI.DynamicYearCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";

9
src/widget/year/trigger.year.js

@ -10,7 +10,8 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
extraCls: "bi-year-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
watermark: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -35,7 +36,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
},
hgap: c.hgap,
vgap: c.vgap,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
watermark: o.watermark,
allowBlank: true,
errorText: function (v) {
if (BI.isPositiveInteger(v)) {
@ -188,6 +189,10 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
getKey: function () {
return this.editor.getValue() | 0;
},
setWaterMark: function (v) {
this.editor.setWaterMark(v);
}
});
BI.DynamicYearTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";

2
typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts

@ -21,4 +21,6 @@ export declare class MultiLayerSelectTreeCombo extends Widget {
blur(): void;
showView(): void;
setStatus(status: "error" | "warning"): void;
}

2
typescript/widget/multilayersingletree/multilayersingletree.combo.ts

@ -21,4 +21,6 @@ export declare class MultiLayerSingleTreeCombo extends Widget {
blur(): void;
showView(): void;
setStatus(status: "error" | "warning"): void;
}

Loading…
Cancel
Save