From f381df071ceb319a5b121e3c1eb9bdbff76876bb Mon Sep 17 00:00:00 2001 From: Claire <1119518763@qq.com> Date: Thu, 6 Jul 2023 11:30:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?JSY-30724=20feat:=E5=8C=BA=E9=97=B4?= =?UTF-8?q?=E6=BB=91=E5=9D=97=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A1=86=E7=9A=84=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/intervalslider/intervalslider.js | 31 ++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/widget/intervalslider/intervalslider.js b/src/widget/intervalslider/intervalslider.js index 6c70c33a3..22dbf0626 100644 --- a/src/widget/intervalslider/intervalslider.js +++ b/src/widget/intervalslider/intervalslider.js @@ -21,7 +21,9 @@ BI.IntervalSlider = BI.inherit(BI.Single, { value: { min: "", max: "", - } + }, + lAlign: "center", + rAlign: "center", }, beforeMount: function () { @@ -38,6 +40,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { var self = this; var c = this._constant; + var o = this.options; this.enable = false; this.valueOne = ""; this.valueTwo = ""; @@ -60,8 +63,9 @@ BI.IntervalSlider = BI.inherit(BI.Single, { cls: "slider-editor-button", text: this.options.unit, allowBlank: false, - width: BI.toPix(c.EDITOR_WIDTH, 2), + width: BI.isNull(o.editorWidth) ? BI.toPix(c.EDITOR_WIDTH, 2) : BI.toPix(o.editorWidth, 2), height: BI.toPix(c.EDITOR_HEIGHT, 2), + textAlign: o.lAlign, validationChecker: function (v) { return self._checkValidation(v); } @@ -88,8 +92,9 @@ BI.IntervalSlider = BI.inherit(BI.Single, { cls: "slider-editor-button", text: this.options.unit, allowBlank: false, - width: BI.toPix(c.EDITOR_WIDTH, 2), + width: BI.isNull(o.editorWidth) ? BI.toPix(c.EDITOR_WIDTH, 2) : BI.toPix(o.editorWidth, 2), height: BI.toPix(c.EDITOR_HEIGHT, 2), + textAlign: o.rAlign, validationChecker: function (v) { return self._checkValidation(v); } @@ -218,6 +223,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { _createLabelWrapper: function () { var c = this._constant; + var o = this.options; return { el: { type: "bi.vertical", @@ -227,16 +233,12 @@ BI.IntervalSlider = BI.inherit(BI.Single, { el: this.labelOne, top: 0, left: 0, - }] - }, { - type: "bi.absolute", - items: [{ + }, { el: this.labelTwo, top: 0, right: 0, }] }], - rgap: c.EDITOR_R_GAP, height: c.SLIDER_HEIGHT }, top: 0, @@ -359,8 +361,17 @@ BI.IntervalSlider = BI.inherit(BI.Single, { }, _resetLabelPosition: function(needReverse) { - this.labelOne.element.css({left: needReverse ? "100%" : "0%"}); - this.labelTwo.element.css({left: needReverse ? "0%" : "100%"}); + var o = this.options; + this.labelOne.element.css({ + left: needReverse ? "unset" : "0%", + right: needReverse ? "0%" : "unset", + }); + this.labelOne.element.children()[0] && (this.labelOne.element.children()[0].style.textAlign = needReverse ? o.rAlign : o.lAlign); + this.labelTwo.element.css({ + left: needReverse ? "0%" : "unset", + right: needReverse ? "unset" : "0%", + }); + this.labelTwo.element.children()[0] && (this.labelTwo.element.children()[0].style.textAlign = needReverse ? o.lAlign : o.rAlign); }, _setSliderOnePosition: function (percent) { From c8daadffe3b5bd594c3e7d047fdb151bac449fbc Mon Sep 17 00:00:00 2001 From: Claire <1119518763@qq.com> Date: Thu, 6 Jul 2023 13:57:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?JSY-30724=20feat:=E5=8C=BA=E9=97=B4?= =?UTF-8?q?=E6=BB=91=E5=9D=97=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A1=86=E7=9A=84=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/intervalslider/intervalslider.js | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/packages/fineui/src/widget/intervalslider/intervalslider.js b/packages/fineui/src/widget/intervalslider/intervalslider.js index ce07c7451..894ef7a2c 100644 --- a/packages/fineui/src/widget/intervalslider/intervalslider.js +++ b/packages/fineui/src/widget/intervalslider/intervalslider.js @@ -42,6 +42,8 @@ export class IntervalSlider extends Single { min: 0, max: 100, value: { min: "", max: "" }, + lAlign: "center", + rAlign: "center", }; static EVENT_CHANGE = "EVENT_CHANGE"; @@ -61,6 +63,7 @@ export class IntervalSlider extends Single { this.enable = false; this.valueOne = ""; this.valueTwo = ""; + const { unit, lAlign, rAlign, editorWidth } = this.options; this.calculation = new AccurateCalculationModel(); this.grayTrack = createWidget({ @@ -78,9 +81,10 @@ export class IntervalSlider extends Single { this.labelOne = createWidget({ type: SignTextEditor.xtype, cls: "slider-editor-button", - text: this.options.unit, + text: unit, allowBlank: false, - width: toPix(c.EDITOR_WIDTH, 2), + textAlign: lAlign, + width: BI.isNull(editorWidth) ? BI.toPix(c.EDITOR_WIDTH, 2) : BI.toPix(editorWidth, 2), height: toPix(c.EDITOR_HEIGHT, 2), validationChecker: v => this._checkValidation(v), }); @@ -107,9 +111,10 @@ export class IntervalSlider extends Single { this.labelTwo = createWidget({ type: SignTextEditor.xtype, cls: "slider-editor-button", - text: this.options.unit, + text: unit, allowBlank: false, - width: toPix(c.EDITOR_WIDTH, 2), + textAlign: rAlign, + width: BI.isNull(editorWidth) ? BI.toPix(c.EDITOR_WIDTH, 2) : BI.toPix(editorWidth, 2), height: toPix(c.EDITOR_HEIGHT, 2), validationChecker: v => this._checkValidation(v), }); @@ -258,21 +263,15 @@ export class IntervalSlider extends Single { el: this.labelOne, top: 0, left: 0, - } - ], - }, - { - type: AbsoluteLayout.xtype, - items: [ + }, { el: this.labelTwo, top: 0, right: 0, - } + }, ], - } + }, ], - rgap: c.EDITOR_R_GAP, height: c.SLIDER_HEIGHT, }, top: 0, @@ -403,8 +402,17 @@ export class IntervalSlider extends Single { } _resetLabelPosition(needReverse) { - this.labelOne.element.css({ left: needReverse ? "100%" : "0%" }); - this.labelTwo.element.css({ left: needReverse ? "0%" : "100%" }); + const { lAlign, rAlign } = this.options; + this.labelOne.element.css({ + left: needReverse ? "unset" : "0%", + right: needReverse ? "0%" : "unset", + }); + this.labelOne.element.children()[0] && (this.labelOne.element.children()[0].style.textAlign = needReverse ? rAlign : lAlign); + this.labelTwo.element.css({ + left: needReverse ? "0%" : "unset", + right: needReverse ? "unset" : "0%", + }); + this.labelTwo.element.children()[0] && (this.labelTwo.element.children()[0].style.textAlign = needReverse ? lAlign : rAlign); } _setSliderOnePosition(percent) {