From 8205b3f29440f3217e4ceebe60575cc17b64f818 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 18 Oct 2022 16:58:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?BI-107080=20fix:=20=E3=80=906.0=E4=B8=89?= =?UTF-8?q?=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91=E5=8F=AA=E6=9C=89=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6=E6=97=A0=E9=99=90?= =?UTF-8?q?=E5=88=B6=E7=9A=84=E6=97=B6=E5=80=99=E6=82=AC=E6=B5=AE=E6=97=A0?= =?UTF-8?q?tooltip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/dynamicdate/dynamicdate.trigger.js | 3 ++ .../dynamicdatetime.trigger.js | 42 ++++++++++--------- src/widget/time/time.trigger.js | 3 ++ src/widget/yearquarter/trigger.yearquarter.js | 2 - 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/widget/dynamicdate/dynamicdate.trigger.js b/src/widget/dynamicdate/dynamicdate.trigger.js index 012f6c722..9ecaa3cd9 100644 --- a/src/widget/dynamicdate/dynamicdate.trigger.js +++ b/src/widget/dynamicdate/dynamicdate.trigger.js @@ -152,6 +152,9 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, { _getTitle: function () { var storeValue = this.storeValue || {}; + if (BI.isEmptyObject(storeValue)) { + return this.options.watermark; + } var type = storeValue.type || BI.DynamicDateCombo.Static; var value = storeValue.value; switch (type) { diff --git a/src/widget/dynamicdatetime/dynamicdatetime.trigger.js b/src/widget/dynamicdatetime/dynamicdatetime.trigger.js index dd5c7ed6f..86a942fe7 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.trigger.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.trigger.js @@ -9,7 +9,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { iconWidth: 24 }, - props: { + props: () => ({ extraCls: "bi-date-time-trigger", min: "1900-01-01", // 最小日期 max: "2099-12-31", // 最大日期 @@ -17,8 +17,8 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { iconWidth: 24, format: "", // 显示的日期格式化方式 allowEdit: true, // 是否允许编辑 - watermark: "" - }, + watermark: BI.i18nText("BI-Basic_Unrestricted"), + }), _init: function () { BI.DynamicDateTimeTrigger.superclass._init.apply(this, arguments); @@ -44,7 +44,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { hgap: c.hgap, vgap: c.vgap, allowBlank: true, - watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), + watermark: o.watermark, errorText: function (v) { var str = ""; if (!BI.isKey(o.format)) { @@ -149,7 +149,11 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { }, _getTitle: function () { + var o = this.options; var storeValue = this.storeValue || {}; + if (BI.isEmptyObject(storeValue)) { + return o.watermark; + } var type = storeValue.type || BI.DynamicDateCombo.Static; var value = storeValue.value; switch (type) { @@ -197,7 +201,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { // 这边不能直接用\d+去切日期, 因为format格式可能是20190607这样的没有分割符的 = = // 先看一下是否是合法的, 如果合法就变成标准格式的走原来的流程, 不合法不关心 var date = BI.parseDateTime(v, this._getFormatString()); - if(BI.print(date, this._getFormatString()) === v) { + if (BI.print(date, this._getFormatString()) === v) { v = BI.print(date, c.compareFormat); result = [0, 1, 2]; } @@ -214,7 +218,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { BI.isNumeric(v) && v.length === 1 && (suffixArray[idx] = "0" + v); }); // hh:mm - if(suffixArray.length === 2 && !hasSecond) { + if (suffixArray.length === 2 && !hasSecond) { suffixArray.push("00"); } var suffixString = suffixArray.join(":"); @@ -283,42 +287,42 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { _getText: function (obj) { var value = ""; var endText = ""; - if(BI.isNotNull(obj.year)) { - if(BI.parseInt(obj.year) !== 0) { + if (BI.isNotNull(obj.year)) { + if (BI.parseInt(obj.year) !== 0) { value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); } - if(BI.isNotNull(obj.quarter)) { - if(BI.parseInt(obj.quarter) !== 0) { + if (BI.isNotNull(obj.quarter)) { + if (BI.parseInt(obj.quarter) !== 0) { value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); } - if(BI.isNotNull(obj.month)) { - if(BI.parseInt(obj.month) !== 0) { + if (BI.isNotNull(obj.month)) { + if (BI.parseInt(obj.month) !== 0) { value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); } - if(BI.isNotNull(obj.week)) { - if(BI.parseInt(obj.week) !== 0) { + if (BI.isNotNull(obj.week)) { + if (BI.parseInt(obj.week) !== 0) { value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); } - if(BI.isNotNull(obj.day)) { - if(BI.parseInt(obj.day) !== 0) { + if (BI.isNotNull(obj.day)) { + if (BI.parseInt(obj.day) !== 0) { value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; } - if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { + if (BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } - return value + endText; + return value + endText; - function getPositionText (baseText, position) { + function getPositionText(baseText, position) { switch (position) { case BI.DynamicDateCard.OFFSET.BEGIN: return baseText + BI.i18nText("BI-Basic_Begin_Start"); diff --git a/src/widget/time/time.trigger.js b/src/widget/time/time.trigger.js index 6b089fa86..a15235cf4 100644 --- a/src/widget/time/time.trigger.js +++ b/src/widget/time/time.trigger.js @@ -157,6 +157,9 @@ _getTitle: function () { var storeValue = this.storeValue || {}; + if (BI.isEmptyObject(storeValue)) { + return this.options.watermark; + } var date = BI.getDate(); return BI.print(BI.getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString()); }, diff --git a/src/widget/yearquarter/trigger.yearquarter.js b/src/widget/yearquarter/trigger.yearquarter.js index 84bda3b3f..876856379 100644 --- a/src/widget/yearquarter/trigger.yearquarter.js +++ b/src/widget/yearquarter/trigger.yearquarter.js @@ -249,9 +249,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, { value = value || {}; var quarter = BI.isNull(value.quarter) ? null : value.quarter; this.yearEditor.setValue(value.year); - this.yearEditor.setTitle(value.year); this.quarterEditor.setValue(quarter); - this.quarterEditor.setTitle(quarter); this.setTitle(this._getStaticTitle(value)); break; } From 908ff5cb06c4e2a2730819ceeb1b27aec990d495 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 18 Oct 2022 17:17:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=97=A0JIRA:=20sign=5Feditor=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/editor.sign.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js index 330c31dfe..7a69a5005 100644 --- a/src/case/editor/editor.sign.js +++ b/src/case/editor/editor.sign.js @@ -68,17 +68,6 @@ BI.SignEditor = BI.inherit(BI.Widget, { self.fireEvent(BI.SignEditor.EVENT_CLICK_LABEL); }); }); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.text, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); @@ -137,10 +126,17 @@ BI.SignEditor = BI.inherit(BI.Widget, { self.fireEvent(BI.SignEditor.EVENT_EMPTY, arguments); }); BI.createWidget({ - type: "bi.vertical", - scrolly: false, + type: "bi.absolute", element: this, - items: [this.editor] + items: [ + { + el: this.text, + inset: 0, + }, { + el: this.editor, + inset: 0, + } + ] }); this._showHint(); self._checkText(); From 23a1aa75cece7a9f2f45285b70e25294e833211c Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 18 Oct 2022 17:19:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=A0jira=20editor=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/editor.shelter.js | 24 ++++++++++-------------- src/case/editor/editor.state.js | 24 ++++++++++-------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/case/editor/editor.shelter.js b/src/case/editor/editor.shelter.js index 39def9d77..31883614c 100644 --- a/src/case/editor/editor.shelter.js +++ b/src/case/editor/editor.shelter.js @@ -58,17 +58,6 @@ BI.ShelterEditor = BI.inherit(BI.Widget, { height: o.height, hgap: o.hgap + 2 }); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.text, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); this.text.on(BI.Controller.EVENT_CHANGE, function () { arguments[2] = self; self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -134,10 +123,17 @@ BI.ShelterEditor = BI.inherit(BI.Widget, { self.fireEvent(BI.ShelterEditor.EVENT_EMPTY, arguments); }); BI.createWidget({ - type: "bi.vertical", - scrolly: false, + type: "bi.absolute", element: this, - items: [this.editor] + items: [ + { + el: this.text, + inset: 0, + }, { + el: this.editor, + inset: 0, + } + ] }); this._showHint(); self._checkText(); diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index e9d3900bd..8ed915716 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -77,17 +77,6 @@ BI.StateEditor = BI.inherit(BI.Widget, { self.fireEvent(BI.StateEditor.EVENT_CLICK_LABEL); }); }); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.text, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); @@ -143,10 +132,17 @@ BI.StateEditor = BI.inherit(BI.Widget, { self.fireEvent(BI.StateEditor.EVENT_EMPTY, arguments); }); BI.createWidget({ - type: "bi.vertical", - scrolly: false, + type: "bi.absolute", element: this, - items: [this.editor] + items: [ + { + el: this.text, + inset: 0, + }, { + el: this.editor, + inset: 0, + } + ] }); this._showHint(); if (BI.isNotNull(o.text)) {