Browse Source

Merge pull request #207137 in DEC/fineui from release/11.0 to bugfix/11.0

* commit 'ae40ddb908dae9687eec6d84dbc6e361c99c3bed': (42 commits)
  无jira number-counter样式调整
  auto upgrade version to 2.0.20221110175602
  REPORT-84106 fix: sticky bug
  REPORT-84106 fix: sticky bug
  auto upgrade version to 2.0.20221110101625
  auto upgrade version to 2.0.20221109193835
  无JIRA fix: 修复tape布局 NaN的场景
  REPORT-83562 feat: 日期控件非本月的日期可选
  无JIRA revert commit c45e768, 不是实时校验的一律不许用气泡
  auto upgrade version to 2.0.20221108162444
  auto upgrade version to 2.0.20221108105434
  auto upgrade version to 2.0.20221108103803
  KERNEL-13349 feat: 复选下拉框checkselectedswitcher修复
  auto upgrade version to 2.0.20221107121634
  auto upgrade version to 2.0.20221105202549
  优化一下布局
  auto upgrade version to 2.0.20221104171438
  auto upgrade version to 2.0.20221104164422
  无JIRA  fix: bi.text_value_down_list_combo修复
  auto upgrade version to 2.0.20221104135556
  ...
master
superman 2 years ago
parent
commit
5d195dab39
  1. 4
      dist/fix/fix.compact.js
  2. 58
      examples/useContext.html
  3. 2
      package.json
  4. 57
      src/base/single/0.single.js
  5. 5
      src/base/single/editor/editor.js
  6. 3
      src/case/calendar/calendar.js
  7. 4
      src/core/wrapper/layout/layout.tape.js
  8. 2
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  9. 2
      src/core/wrapper/layout/sticky/sticky.vertical.js
  10. 5
      src/less/case/calendar/calendar.less
  11. 4
      src/less/widget/multiselect/trigger/button.checkselected.less
  12. 1
      src/widget/date/calendar/combo.month.date.js
  13. 37
      src/widget/downlist/combo.downlist.js
  14. 4
      src/widget/editor/editor.text.js
  15. 7
      src/widget/multitree/trigger/multi.tree.button.checkselected.js
  16. 24
      src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js

4
dist/fix/fix.compact.js vendored

@ -109,13 +109,13 @@
pushTarget(this.store); pushTarget(this.store);
return true; return true;
} }
if (this._store) { if (this._store || this.options._store) {
var store = BI.Widget.findStore(this.options.context || this._parent || this.options.element || this._context); var store = BI.Widget.findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
} }
this.store = this._store(); this.store = (this._store || this.options._store).call(this);
this.store && (this.store._widget = this); this.store && (this.store._widget = this);
needPop && popTarget(); needPop && popTarget();
needPop = false; needPop = false;

58
examples/useContext.html

@ -22,10 +22,10 @@
state: function () { state: function () {
return { return {
expand: false, expand: false,
cssScale: 2.0 cssScale: true
}; };
}, },
childContext: ["text"], childContext: ["text", "cssScale"],
computed: { computed: {
text: function () { text: function () {
@ -41,10 +41,20 @@
}); });
BI.model("demo.model", Model); BI.model("demo.model", Model);
var TempModel = BI.inherit(BI.Model, {
state: function () {
return {
cssScale: false
};
},
childContext: ["cssScale"],
});
BI.model("demo.temp_model", TempModel);
var oldFormat = BI.pixFormat; var oldFormat = BI.pixFormat;
BI.pixFormat = function (pix, border) { BI.pixFormat = function (pix, border) {
var context = BI.useContext("cssScale"); var context = BI.useContext("cssScale");
if (!context) { if (!context || context.model.cssScale === false) {
return oldFormat.apply(this, arguments); return oldFormat.apply(this, arguments);
} }
if (!BI.isNumber(pix)) { if (!BI.isNumber(pix)) {
@ -59,8 +69,8 @@
var oldPix = BI.toPix; var oldPix = BI.toPix;
BI.toPix = function (pix, border) { BI.toPix = function (pix, border) {
var context = BI.useContext("cssScale"); var context = BI.useContext("cssScale");
if (!context) { if (!context || context.model.cssScale === false) {
return oldPix.apply(this, arguments); return oldFormat.apply(this, arguments);
} }
if (!BI.isNumber(pix)) { if (!BI.isNumber(pix)) {
return pix; return pix;
@ -109,7 +119,7 @@
var child; var child;
var store = BI.useStore(); var store = BI.useStore();
return function () { return function () {
this.element[0].style.setProperty('--css-scale', store.model.cssScale); this.element[0].style.setProperty('--css-scale', 2);
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 20, vgap: 20,
@ -130,6 +140,42 @@
day: 15 day: 15
} }
} }
}, {
type: "bi.down_list_combo",
cls: "bi-border",
width: 24,
height: 24,
popup: {
_store: function () {
return BI.Models.getModel("demo.temp_model");
}
},
value: [{value: 2}, {value: 3, childValue: 4}],
items: [[{
text: "属于",
value: 1,
cls: "dot-e-font"
}, {
text: "不属于",
value: 2,
cls: "dot-e-font"
}], [{
el: {
text: "大于",
value: 3,
iconCls1: "dot-e-font"
},
value: 3,
children: [{
text: "固定值",
value: 4,
cls: "dot-e-font"
}, {
text: "平均值",
value: 5,
cls: "dot-e-font"
}]
}]]
}] }]
}; };
}; };

2
package.json

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

57
src/base/single/0.single.js

@ -19,35 +19,37 @@ BI.Single = BI.inherit(BI.Widget, {
return BI.extend(conf, { return BI.extend(conf, {
readonly: false, readonly: false,
title: null, title: null,
warningTitle: null, warningTitle: null, // deprecated
tipType: null, // success或warning tipType: null, // deprecated success或warning
belowMouse: false, // title是否跟随鼠标 belowMouse: false, // title是否跟随鼠标
enableHover: false, enableHover: false,
}); });
}, },
_showToolTip: function (e, opt) { _showToolTip: function (e, opt) {
opt || (opt = {}); opt || (opt = {});
var self = this;
var o = this.options; var o = this.options;
var tooltipOpt = {};
var title = this.getTitle(); var title = this.getTitle();
if (BI.isPlainObject(title)) {
tooltipOpt = title; if (title instanceof Promise) {
this.requestingTitle = title;
title.then(resolvedTitle => {
// 由于是异步的,所以无法避免Promise resolve时机问题,所以设计为:鼠标移出了则不显示,并且只显示最后一次发起的查询结果
this.mouseOver && this.requestingTitle === title && showToolTip(this._getTooltipOptions(resolvedTitle));
});
} else { } else {
tooltipOpt.level = this.getTipType() || "success"; showToolTip(this._getTooltipOptions(title));
// 由于以前的用法,存在大量disabled:true搭配warningTitle的情况,所以这里做一个兼容,disabled:true的情况下,依然优先显示warningTitle,避免只设置了warningTitle而没有设置title的情况
if (BI.isNull(o.tipType) && !this.isEnabled()) {
tooltipOpt.text = (this.getWarningTitle() || title);
} else {
tooltipOpt.text = tooltipOpt.level === "success" ? title : (this.getWarningTitle() || title);
}
} }
if (BI.isKey(tooltipOpt.text)) {
BI.Tooltips.show(e, this.getName(), tooltipOpt, this, opt); function showToolTip(tooltipOpt) {
if (o.action) { if (BI.isKey(tooltipOpt.text) && !BI.Tooltips.has(self.getName())) {
BI.Actions.runAction(o.action, "hover", o, this); BI.Tooltips.show(e, self.getName(), tooltipOpt, self, opt);
if (o.action) {
BI.Actions.runAction(o.action, "hover", o, self);
}
BI.Actions.runGlobalAction("hover", o, self);
} }
BI.Actions.runGlobalAction("hover", o, this);
} }
}, },
@ -91,12 +93,30 @@ BI.Single = BI.inherit(BI.Widget, {
} }
}, },
_getTooltipOptions: function (title) {
var o = this.options;
var tooltipOpt = {};
if (BI.isPlainObject(title)) {
tooltipOpt = title;
} else {
tooltipOpt.level = this.getTipType() || "success";
// 由于以前的用法,存在大量disabled:true搭配warningTitle的情况,所以这里做一个兼容,disabled:true的情况下,依然优先显示warningTitle,避免只设置了warningTitle而没有设置title的情况
if (BI.isNull(o.tipType) && !this.isEnabled()) {
tooltipOpt.text = (this.getWarningTitle() || title);
} else {
tooltipOpt.text = tooltipOpt.level === "success" ? title : (this.getWarningTitle() || title);
}
}
return tooltipOpt;
},
enableHover: function (opt) { enableHover: function (opt) {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
if (!this._hoverBinded) { if (!this._hoverBinded) {
this.element.unbind("mouseenter.title").on("mouseenter.title", function (e) { this.element.unbind("mouseenter.title").on("mouseenter.title", function (e) {
self._e = e; self._e = e;
self.mouseOver = true;
if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) {
delayingTooltips = self.getName(); delayingTooltips = self.getName();
self.showTimeout = BI.delay(function () { self.showTimeout = BI.delay(function () {
@ -144,6 +164,7 @@ BI.Single = BI.inherit(BI.Widget, {
}); });
this.element.unbind("mouseleave.title").on("mouseleave.title", function (e) { this.element.unbind("mouseleave.title").on("mouseleave.title", function (e) {
self._e = null; self._e = null;
self.mouseOver = false;
self._clearTimeOut(); self._clearTimeOut();
self._hideTooltip(); self._hideTooltip();
}); });

5
src/base/single/editor/editor.js

@ -344,11 +344,6 @@ BI.Editor = BI.inherit(BI.Single, {
return this.editor.isValid(); return this.editor.isValid();
}, },
setValid: function (b) {
this.editor.setValid(b);
this._checkError();
},
destroyed: function () { destroyed: function () {
BI.Bubbles.remove(this.getName()); BI.Bubbles.remove(this.getName());
}, },

3
src/case/calendar/calendar.js

@ -161,7 +161,8 @@ BI.Calendar = BI.inherit(BI.Widget, {
once: false, once: false,
forceSelected: true, forceSelected: true,
value: o.year + "-" + month + "-" + td.text, value: o.year + "-" + month + "-" + td.text,
disabled: td.lastMonth || td.nextMonth || td.disabled, disabled: td.disabled,
cls: td.lastMonth || td.nextMonth ? "not-current-month-day": "",
lgap: 2, lgap: 2,
rgap: 2, rgap: 2,
tgap: 4, tgap: 4,

4
src/core/wrapper/layout/layout.tape.js

@ -217,7 +217,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
top: self._optimiseGap(top[i] + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.vgap + o.tgap) top: self._optimiseGap(top[i] + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.vgap + o.tgap)
}); });
if (rowSize === "" || rowSize === "fill") { if (BI.isNull(rowSize) || rowSize === "" || rowSize === "fill") {
return true; return true;
} }
}); });
@ -235,7 +235,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
bottom: self._optimiseGap(bottom[i] + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.vgap + o.bgap) bottom: self._optimiseGap(bottom[i] + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.vgap + o.bgap)
}); });
if (rowSize === "" || rowSize === "fill") { if (BI.isNull(rowSize) || rowSize === "" || rowSize === "fill") {
return true; return true;
} }
}); });

2
src/core/wrapper/layout/sticky/sticky.horizontal.js

@ -22,7 +22,7 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, {
} }
if (columnSize !== "fill") { if (columnSize !== "fill") {
var fillIndex; var fillIndex;
BI.count(0, o.items.length - 1, index => { BI.count(0, o.items.length, index => {
if (BI.isNotNull(fillIndex)) { if (BI.isNotNull(fillIndex)) {
return; return;
} }

2
src/core/wrapper/layout/sticky/sticky.vertical.js

@ -22,7 +22,7 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, {
} }
if (rowSize !== "fill") { if (rowSize !== "fill") {
var fillIndex; var fillIndex;
BI.count(0, o.items.length - 1, index => { BI.count(0, o.items.length, index => {
if (BI.isNotNull(fillIndex)) { if (BI.isNotNull(fillIndex)) {
return; return;
} }

5
src/less/case/calendar/calendar.less

@ -0,0 +1,5 @@
@import "../../index.less";
.bi-calendar-date-item.not-current-month-day {
color: @color-bi-text-disabled-button !important;
}

4
src/less/widget/multiselect/trigger/button.checkselected.less

@ -2,8 +2,8 @@
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
min-width: 16px; .border-radius(50%);
.border-radius(8px);
&:active { &:active {
color: @color-bi-text-highlight; color: @color-bi-text-highlight;
background-color: @color-bi-background-multi-select-trigger-check-selected; background-color: @color-bi-background-multi-select-trigger-check-selected;

1
src/widget/date/calendar/combo.month.date.js

@ -48,6 +48,7 @@ BI.MonthDateCombo = BI.inherit(BI.Trigger, {
el: { el: {
type: "bi.vertical", type: "bi.vertical",
hgap: 6, hgap: 6,
vgap: 5,
items: [this.popup] items: [this.popup]
} }
} }

37
src/widget/downlist/combo.downlist.js

@ -17,7 +17,7 @@
text: item.text, text: item.text,
icon: item.icon, icon: item.icon,
cls: item.cls, cls: item.cls,
iconCls1: item.iconCls1, iconCls1: item.iconCls1,
value: item.value value: item.value
}; };
} }
@ -25,7 +25,7 @@
}); });
return result; return result;
} }
/** /**
* Created by roy on 15/8/14. * Created by roy on 15/8/14.
*/ */
@ -41,16 +41,17 @@
container: null, container: null,
stopPropagation: false, stopPropagation: false,
el: {}, el: {},
popup: {},
minWidth: 140, minWidth: 140,
maxHeight: 1000, maxHeight: 1000,
destroyWhenHide: false destroyWhenHide: false
}); });
}, },
_init: function () { _init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments); BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.downlistcombo = BI.createWidget({ this.downlistcombo = BI.createWidget({
element: this, element: this,
type: "bi.combo", type: "bi.combo",
@ -63,12 +64,13 @@
belowMouse: o.belowMouse, belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation, stopPropagation: o.stopPropagation,
destroyWhenHide: o.destroyWhenHide, destroyWhenHide: o.destroyWhenHide,
el: BI.createWidget(o.el, { el: {
type: "bi.icon_trigger", type: "bi.icon_trigger",
extraCls: o.iconCls, extraCls: o.iconCls,
width: o.width, width: o.width,
height: o.height height: o.height,
}), ...o.el
},
popup: { popup: {
el: { el: {
type: "bi.down_list_popup", type: "bi.down_list_popup",
@ -94,39 +96,40 @@
}, },
stopPropagation: o.stopPropagation, stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight, maxHeight: o.maxHeight,
minWidth: o.minWidth minWidth: o.minWidth,
...o.popup
} }
}); });
this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
}); });
}, },
hideView: function () { hideView: function () {
this.downlistcombo.hideView(); this.downlistcombo.hideView();
}, },
showView: function (e) { showView: function (e) {
this.downlistcombo.showView(e); this.downlistcombo.showView(e);
}, },
populate: function (items) { populate: function (items) {
this.popupView.populate(items); this.popupView.populate(items);
}, },
setValue: function (v) { setValue: function (v) {
this.popupView.setValue(v); this.popupView.setValue(v);
}, },
getValue: function () { getValue: function () {
return this.popupView.getValue(); return this.popupView.getValue();
}, },
adjustWidth: function () { adjustWidth: function () {
this.downlistcombo.adjustWidth(); this.downlistcombo.adjustWidth();
}, },
adjustHeight: function () { adjustHeight: function () {
this.downlistcombo.adjustHeight(); this.downlistcombo.adjustHeight();
} }
@ -134,6 +137,6 @@
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.down_list_combo", BI.DownListCombo); BI.shortcut("bi.down_list_combo", BI.DownListCombo);
}()); }());

4
src/widget/editor/editor.text.js

@ -138,10 +138,6 @@ BI.TextEditor = BI.inherit(BI.Widget, {
return this.editor.isValid(); return this.editor.isValid();
}, },
setValid: function (b) {
this.editor.setValid(b);
},
setValue: function (v) { setValue: function (v) {
this.editor.setValue(v); this.editor.setValue(v);
}, },

7
src/widget/multitree/trigger/multi.tree.button.checkselected.js

@ -19,8 +19,8 @@ BI.MultiTreeCheckSelectedButton = BI.inherit(BI.Single, {
this.indicator = BI.createWidget({ this.indicator = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "check-font trigger-check-selected icon-size-12", cls: "check-font trigger-check-selected icon-size-12",
width: 15, width: 16,
height: 15, height: 16,
stopPropagation: true stopPropagation: true
}); });
@ -31,7 +31,6 @@ BI.MultiTreeCheckSelectedButton = BI.inherit(BI.Single, {
hgap: 4, hgap: 4,
text: BI.i18nText("BI-Check_Selected"), text: BI.i18nText("BI-Check_Selected"),
textAlign: "center", textAlign: "center",
textHeight: 15
}); });
this.checkSelected.on(BI.Controller.EVENT_CHANGE, function () { this.checkSelected.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -65,4 +64,4 @@ BI.MultiTreeCheckSelectedButton = BI.inherit(BI.Single, {
}); });
BI.MultiTreeCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiTreeCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_tree_check_selected_button", BI.MultiTreeCheckSelectedButton); BI.shortcut("bi.multi_tree_check_selected_button", BI.MultiTreeCheckSelectedButton);

24
src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js

@ -19,14 +19,6 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
if(BI.isNotNull(o.value)) { if(BI.isNotNull(o.value)) {
value = this._digest(o.value); value = this._digest(o.value);
} }
this.trigger = BI.createWidget({
type: "bi.down_list_select_text_trigger",
cls: "text-value-down-list-trigger",
height: BI.toPix(o.height, 2),
items: o.items,
text: o.text,
value: value
});
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.down_list_combo", type: "bi.down_list_combo",
@ -35,7 +27,17 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
adjustLength: 2, adjustLength: 2,
width: BI.toPix(o.width, 2), width: BI.toPix(o.width, 2),
height: BI.toPix(o.height, 2), height: BI.toPix(o.height, 2),
el: this.trigger, el: {
type: "bi.down_list_select_text_trigger",
ref: function (_ref) {
self.trigger = _ref;
},
cls: "text-value-down-list-trigger",
height: BI.toPix(o.height, 2),
items: o.items,
text: o.text,
value: value
},
value: BI.isNull(value) ? [] : [value], value: BI.isNull(value) ? [] : [value],
items: BI.deepClone(o.items) items: BI.deepClone(o.items)
}); });
@ -79,7 +81,7 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
v = this._digest(v); v = this._digest(v);
this.combo.setValue([v]); this.combo.setValue([v]);
this.trigger.setValue(v); this.trigger?.setValue(v);
}, },
getValue: function () { getValue: function () {
@ -94,4 +96,4 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo); BI.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo);

Loading…
Cancel
Save