From d1a3b2418e85c2bb492f657c4e988fb231b3aa74 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 9 Sep 2020 12:37:40 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20label?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=A4=9A=E8=A1=8C=E6=96=87=E6=9C=AC=E6=BA=A2?= =?UTF-8?q?=E5=87=BA=E6=98=BE=E7=A4=BA...=EF=BC=88=E4=BB=85webkit=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 3 +++ demo/js/base/demo.label.js | 8 ++++++++ src/base/single/label/label.js | 1 + src/base/single/text.js | 17 +++++++++++++---- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 4865f27b5..3a43f6b23 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2020-09) +- bi.label支持多行文本溢出显示...(仅支持webkit内核) + 2.0(2020-08) - bi.sign_editor支持显示值居左/居中/居右显示 - bi.iframe新增EVENT_LOADED事件 diff --git a/demo/js/base/demo.label.js b/demo/js/base/demo.label.js index 0f5158f13..e9a69daf7 100644 --- a/demo/js/base/demo.label.js +++ b/demo/js/base/demo.label.js @@ -104,6 +104,14 @@ Demo.Label = BI.inherit(BI.Widget, { textWidth: 200, textHeight: 30, height: 60 + }, { + type: "bi.label", + cls: "layout-bg1", + text: "label设置了宽度, 并且设置了显示行数是2行, 无论输入多少文本,在允许换行的情况下只会显示2行,并在第二行结尾出现...", + textAlign: "left", + width: 300, + lineNumber: 2, + whiteSpace: "normal" }, { type: "bi.left", items: [{ diff --git a/src/base/single/label/label.js b/src/base/single/label/label.js index 101fdeb3d..362083dc2 100644 --- a/src/base/single/label/label.js +++ b/src/base/single/label/label.js @@ -17,6 +17,7 @@ BI.Label = BI.inherit(BI.AbstractLabel, { textAlign: o.textAlign, whiteSpace: o.whiteSpace, lineHeight: o.textHeight, + lineNumber: o.lineNumber, text: o.text, value: o.value, py: o.py, diff --git a/src/base/single/text.js b/src/base/single/text.js index 823843bfc..2272fb15b 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -20,7 +20,8 @@ bgap: 0, text: "", py: "", - highLight: false + highLight: false, + lineNumber: null, }, render: function () { @@ -54,12 +55,20 @@ if (BI.isWidthOrHeight(o.maxWidth)) { this.element.css({maxWidth: o.maxWidth}); } - this.element.css({ + var cssObj = { textAlign: o.textAlign, whiteSpace: this._getTextWrap(), textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "", - overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : "") - }); + overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : ""), + }; + if (BI.isNumber(o.lineNumber)) { + BI.extend(cssObj, { + display: "-webkit-box", + "-webkit-line-clamp": o.lineNumber + "", + "-webkit-box-orient": "vertical", + }); + } + this.element.css(cssObj); if (o.handler && o.handler !== BI.emptyFn) { this.text = BI.createWidget({ type: "bi.layout", From 5db2268d031f0d4e18156d73538f9fbad59dc15c Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 9 Sep 2020 14:37:57 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Revert=20"=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=20label=E6=8F=90=E4=BE=9B=E5=A4=9A=E8=A1=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=BA=A2=E5=87=BA=E6=98=BE=E7=A4=BA...=EF=BC=88=E4=BB=85webkit?= =?UTF-8?q?=EF=BC=89"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d1a3b2418e85c2bb492f657c4e988fb231b3aa74. --- changelog.md | 3 --- demo/js/base/demo.label.js | 8 -------- src/base/single/label/label.js | 1 - src/base/single/text.js | 17 ++++------------- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/changelog.md b/changelog.md index 3a43f6b23..4865f27b5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,4 @@ # 更新日志 -2.0(2020-09) -- bi.label支持多行文本溢出显示...(仅支持webkit内核) - 2.0(2020-08) - bi.sign_editor支持显示值居左/居中/居右显示 - bi.iframe新增EVENT_LOADED事件 diff --git a/demo/js/base/demo.label.js b/demo/js/base/demo.label.js index e9a69daf7..0f5158f13 100644 --- a/demo/js/base/demo.label.js +++ b/demo/js/base/demo.label.js @@ -104,14 +104,6 @@ Demo.Label = BI.inherit(BI.Widget, { textWidth: 200, textHeight: 30, height: 60 - }, { - type: "bi.label", - cls: "layout-bg1", - text: "label设置了宽度, 并且设置了显示行数是2行, 无论输入多少文本,在允许换行的情况下只会显示2行,并在第二行结尾出现...", - textAlign: "left", - width: 300, - lineNumber: 2, - whiteSpace: "normal" }, { type: "bi.left", items: [{ diff --git a/src/base/single/label/label.js b/src/base/single/label/label.js index 362083dc2..101fdeb3d 100644 --- a/src/base/single/label/label.js +++ b/src/base/single/label/label.js @@ -17,7 +17,6 @@ BI.Label = BI.inherit(BI.AbstractLabel, { textAlign: o.textAlign, whiteSpace: o.whiteSpace, lineHeight: o.textHeight, - lineNumber: o.lineNumber, text: o.text, value: o.value, py: o.py, diff --git a/src/base/single/text.js b/src/base/single/text.js index 2272fb15b..823843bfc 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -20,8 +20,7 @@ bgap: 0, text: "", py: "", - highLight: false, - lineNumber: null, + highLight: false }, render: function () { @@ -55,20 +54,12 @@ if (BI.isWidthOrHeight(o.maxWidth)) { this.element.css({maxWidth: o.maxWidth}); } - var cssObj = { + this.element.css({ textAlign: o.textAlign, whiteSpace: this._getTextWrap(), textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "", - overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : ""), - }; - if (BI.isNumber(o.lineNumber)) { - BI.extend(cssObj, { - display: "-webkit-box", - "-webkit-line-clamp": o.lineNumber + "", - "-webkit-box-orient": "vertical", - }); - } - this.element.css(cssObj); + overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : "") + }); if (o.handler && o.handler !== BI.emptyFn) { this.text = BI.createWidget({ type: "bi.layout", From f033567b65afc7df3a442a291a8a7eec91212d81 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 14 Sep 2020 14:52:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?BI-71788=20fix:=20=E5=B0=86=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=80=BCsetValue=E8=BF=9B=E5=85=A5=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89=E5=90=8E=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E5=99=A8=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=85=A8=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 3 +++ .../valuechooser/combo.valuechooser.insert.js | 19 +++++++++++++++++-- .../valuechooser/combo.valuechooser.js | 19 +++++++++++++++++-- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 4865f27b5..bc702c9df 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2020-09) +- 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题 + 2.0(2020-08) - bi.sign_editor支持显示值居左/居中/居右显示 - bi.iframe新增EVENT_LOADED事件 diff --git a/src/component/valuechooser/combo.valuechooser.insert.js b/src/component/valuechooser/combo.valuechooser.insert.js index b86963806..700794459 100644 --- a/src/component/valuechooser/combo.valuechooser.insert.js +++ b/src/component/valuechooser/combo.valuechooser.insert.js @@ -26,7 +26,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { element: this, allowEdit: o.allowEdit, text: o.text, - value: o.value, + value: this._assertValue(o.value), itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -65,8 +65,23 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { }); }, + _assertValue: function (v) { + v = v || {}; + var value = v; + if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) { + var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0; + if (isAllSelect) { + value = { + type: BI.Selection.All, + value: [], + }; + } + } + return value; + }, + setValue: function (v) { - this.combo.setValue(v); + this.combo.setValue(this._assertValue(v)); }, getValue: function () { diff --git a/src/component/valuechooser/combo.valuechooser.js b/src/component/valuechooser/combo.valuechooser.js index f7a1c6a35..e39515b98 100644 --- a/src/component/valuechooser/combo.valuechooser.js +++ b/src/component/valuechooser/combo.valuechooser.js @@ -30,7 +30,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { element: this, allowEdit: o.allowEdit, text: o.text, - value: o.value, + value: this._assertValue(o.value), itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -69,8 +69,23 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { }); }, + _assertValue: function (v) { + v = v || {}; + var value = v; + if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) { + var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0; + if (isAllSelect) { + value = { + type: BI.Selection.All, + value: [], + }; + } + } + return value; + }, + setValue: function (v) { - this.combo.setValue(v); + this.combo.setValue(this._assertValue(v)); }, getValue: function () { From fe265a404747c068458f700d141887652b5f8e08 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 14 Sep 2020 14:57:08 +0800 Subject: [PATCH 4/4] update --- .../valuechooser/abstract.valuechooser.js | 17 ++++++++++++++++- .../valuechooser/combo.valuechooser.insert.js | 15 --------------- .../valuechooser/combo.valuechooser.js | 15 --------------- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/component/valuechooser/abstract.valuechooser.js b/src/component/valuechooser/abstract.valuechooser.js index ac4b08ae5..bd1ab309c 100644 --- a/src/component/valuechooser/abstract.valuechooser.js +++ b/src/component/valuechooser/abstract.valuechooser.js @@ -88,5 +88,20 @@ BI.AbstractValueChooser = BI.inherit(BI.Widget, { hasNext: self._hasNextByTimes(resultItems, options.times) }); } - } + }, + + _assertValue: function (v) { + v = v || {}; + var value = v; + if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) { + var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0; + if (isAllSelect) { + value = { + type: BI.Selection.All, + value: [], + }; + } + } + return value; + }, }); \ No newline at end of file diff --git a/src/component/valuechooser/combo.valuechooser.insert.js b/src/component/valuechooser/combo.valuechooser.insert.js index 700794459..cc64d15b6 100644 --- a/src/component/valuechooser/combo.valuechooser.insert.js +++ b/src/component/valuechooser/combo.valuechooser.insert.js @@ -65,21 +65,6 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { }); }, - _assertValue: function (v) { - v = v || {}; - var value = v; - if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) { - var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0; - if (isAllSelect) { - value = { - type: BI.Selection.All, - value: [], - }; - } - } - return value; - }, - setValue: function (v) { this.combo.setValue(this._assertValue(v)); }, diff --git a/src/component/valuechooser/combo.valuechooser.js b/src/component/valuechooser/combo.valuechooser.js index e39515b98..9f1a05f8d 100644 --- a/src/component/valuechooser/combo.valuechooser.js +++ b/src/component/valuechooser/combo.valuechooser.js @@ -69,21 +69,6 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { }); }, - _assertValue: function (v) { - v = v || {}; - var value = v; - if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) { - var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0; - if (isAllSelect) { - value = { - type: BI.Selection.All, - value: [], - }; - } - } - return value; - }, - setValue: function (v) { this.combo.setValue(this._assertValue(v)); },