Browse Source

Pull request #3062: KERNEL-12735 feat:日期相关控件水印支持

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit 'ef03f1a7d4d3d7d82d091d90755720df663812cb':
  REPORT-76823 fix: FR11样式-控件-下拉树控件,点击按钮展开后,无法再次点击收起
  无JRIA fix: valueFormatter fix
  KERNEL-12735 feat:日期相关控件水印支持
  KERNEL-12735 feat:日期相关控件水印支持
es6
Dailer-刘荣歆 2 years ago
parent
commit
47a5bcea16
  1. 3
      src/case/trigger/trigger.text.select.js
  2. 2
      src/less/base/trigger/trigger.less
  3. 10
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  4. 4
      src/widget/dynamicdate/dynamicdate.trigger.js
  5. 3
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  6. 97
      src/widget/multilayersingletree/multilayersingletree.combo.js
  7. 11
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  8. 5
      src/widget/time/time.trigger.js
  9. 8
      src/widget/timeinterval/dateinterval.js
  10. 8
      src/widget/timeinterval/timeinterval.js
  11. 7
      src/widget/timeinterval/timeperiods.js
  12. 7
      src/widget/yearinterval/yearinterval.js
  13. 3
      src/widget/yearmonth/combo.yearmonth.js
  14. 8
      src/widget/yearmonth/trigger.yearmonth.js
  15. 7
      src/widget/yearmonthinterval/yearmonthinterval.js
  16. 3
      src/widget/yearquarter/combo.yearquarter.js
  17. 8
      src/widget/yearquarter/trigger.yearquarter.js
  18. 7
      src/widget/yearquarterinterval/yearquarterinterval.js

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

@ -52,7 +52,6 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_digest: function (val, items) { _digest: function (val, items) {
var o = this.options; var o = this.options;
val = BI.isArray(val) ? val.slice() : [val];
// 提升valueFormatter的优先级 // 提升valueFormatter的优先级
if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) { if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) {
@ -61,6 +60,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}; };
} }
val = BI.isArray(val) ? val : [val];
var result = []; var result = [];
var formatItems = BI.Tree.transformToArrayFormat(items); var formatItems = BI.Tree.transformToArrayFormat(items);

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

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

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

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

4
src/widget/dynamicdate/dynamicdate.trigger.js

@ -17,7 +17,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24, iconWidth: 24,
format: "", // 显示的日期格式化方式 format: "", // 显示的日期格式化方式
allowEdit: true, // 是否允许编辑 allowEdit: true, // 是否允许编辑
watermark: "" watermark: BI.i18nText("BI-Basic_Unrestricted"),
}, },
_init: function () { _init: function () {
@ -44,7 +44,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true, allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), watermark: o.watermark,
errorText: function (v) { errorText: function (v) {
var str = ""; var str = "";
if (!BI.isKey(o.format)) { if (!BI.isKey(o.format)) {

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

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

97
src/widget/multilayersingletree/multilayersingletree.combo.js

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

11
src/widget/multilayersingletree/multilayersingletree.trigger.js

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

5
src/widget/time/time.trigger.js

@ -27,7 +27,8 @@
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
value: {}, value: {},
format: "", format: "",
allowEdit: false allowEdit: false,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
}, },
render: function () { render: function () {
@ -52,7 +53,7 @@
value: this._formatValue(o.value), value: this._formatValue(o.value),
hgap: 4, hgap: 4,
allowBlank: true, allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), watermark: o.watermark,
title: BI.bind(this._getTitle, this), title: BI.bind(this._getTitle, this),
listeners: [{ listeners: [{
eventName: "EVENT_KEY_DOWN", eventName: "EVENT_KEY_DOWN",

8
src/widget/timeinterval/dateinterval.js

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

8
src/widget/timeinterval/timeinterval.js

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

7
src/widget/timeinterval/timeperiods.js

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

7
src/widget/yearinterval/yearinterval.js

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

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

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

8
src/widget/yearmonth/trigger.yearmonth.js

@ -9,7 +9,11 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
extraCls: "bi-year-month-trigger", extraCls: "bi-year-month-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24,
watermark: {
year: BI.i18nText("BI-Basic_Unrestricted"),
month: BI.i18nText("BI-Basic_Unrestricted"),
},
}, },
beforeInit: function (callback) { beforeInit: function (callback) {
@ -80,7 +84,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
quitChecker: function () { quitChecker: function () {
return false; return false;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"), watermark: isYear ? o.watermark?.year : o.watermark.month,
errorText: function (v) { errorText: function (v) {
var year = isYear ? v : self.yearEditor.getValue(); var year = isYear ? v : self.yearEditor.getValue();
var month = isYear ? self.monthEditor.getValue() : v; var month = isYear ? self.monthEditor.getValue() : v;

7
src/widget/yearmonthinterval/yearmonthinterval.js

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

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

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

8
src/widget/yearquarter/trigger.yearquarter.js

@ -9,7 +9,11 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
extraCls: "bi-year-quarter-trigger", extraCls: "bi-year-quarter-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24,
watermark: {
year: BI.i18nText("BI-Basic_Unrestricted"),
quarter: BI.i18nText("BI-Basic_Unrestricted"),
},
}, },
_init: function () { _init: function () {
@ -96,7 +100,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
BI.getQuarter(end) BI.getQuarter(end)
); );
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"), watermark: isYear ? o.watermark?.year : o.watermark?.quarter,
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true allowBlank: true

7
src/widget/yearquarterinterval/yearquarterinterval.js

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

Loading…
Cancel
Save