From 04f12cdf173243adf17a477a35657311ef33f6fb Mon Sep 17 00:00:00 2001 From: jian Date: Mon, 8 Jan 2024 12:48:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-129824=20fix:=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/foundation/message.js | 4 ++-- packages/fineui/src/case/button/switch.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/fineui/src/base/foundation/message.js b/packages/fineui/src/base/foundation/message.js index 3847eba44..e96848c35 100644 --- a/packages/fineui/src/base/foundation/message.js +++ b/packages/fineui/src/base/foundation/message.js @@ -199,7 +199,9 @@ function _show(hasCancel, title, message, callback, config = {}) { items: [ { type: VerticalLayout.xtype, + cls: "bi-card bi-border-radius", width: 450, + hgap: 32, attributes: { tabIndex: 1, }, @@ -224,8 +226,6 @@ function _show(hasCancel, title, message, callback, config = {}) { } catch (e) { } }, - cls: "bi-card", - hgap: 32, items: [ { el: { diff --git a/packages/fineui/src/case/button/switch.js b/packages/fineui/src/case/button/switch.js index 68a5c556a..904f2607e 100644 --- a/packages/fineui/src/case/button/switch.js +++ b/packages/fineui/src/case/button/switch.js @@ -39,7 +39,7 @@ export class Switch extends BasicButton { width: 12, height: 12, top: tgap, - left: o.selected ? 28 : 4, + left: o.selected ? o.width - 16 : 4, }, { type: Label.xtype, @@ -78,7 +78,7 @@ export class Switch extends BasicButton { setSelected(v) { super.setSelected(...arguments); - this.layout.attr("items")[0].left = v ? 28 : 4; + this.layout.attr("items")[0].left = v ? this.options.width - 16 : 4; this.layout.resize(); this.options.showTip && this.openTip.setVisible(v); this.options.showTip && this.closeTip.setVisible(!v); From 84e4135f881013c84ffb67324c1237112b4054f0 Mon Sep 17 00:00:00 2001 From: jian Date: Mon, 8 Jan 2024 15:02:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-129824=20fix:=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/case/button/switch.js | 28 +++++++++---------- .../fineui/typescript/case/button/switch.ts | 5 ++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/fineui/src/case/button/switch.js b/packages/fineui/src/case/button/switch.js index 904f2607e..81510ed45 100644 --- a/packages/fineui/src/case/button/switch.js +++ b/packages/fineui/src/case/button/switch.js @@ -1,15 +1,13 @@ import { AbsoluteLayout, shortcut, i18nText } from "@/core"; import { TextButton, Label, BasicButton } from "@/base"; +const CIRCLE_SIZE = 12; + @shortcut() export class Switch extends BasicButton { static xtype = "bi.switch"; static EVENT_CHANGE = "EVENT_CHANGE"; - constants = { - CIRCLE_SIZE: 12, - }; - props = { extraCls: "bi-switch", attributes: { @@ -17,13 +15,13 @@ export class Switch extends BasicButton { }, height: 20, width: 44, - showTip: false, + showTip: true, + textGap: 8, }; render() { - const o = this.options, - c = this.constants; - const tgap = (o.height - c.CIRCLE_SIZE) / 2; + const { selected, width, height, textGap, showTip } = this.options; + const tgap = (height - CIRCLE_SIZE) / 2; return { type: AbsoluteLayout.xtype, @@ -39,15 +37,15 @@ export class Switch extends BasicButton { width: 12, height: 12, top: tgap, - left: o.selected ? o.width - 16 : 4, + left: selected ? width - height + tgap : tgap, }, { type: Label.xtype, text: i18nText("BI-Basic_Simple_Open"), cls: "content-tip", - left: 8, + left: textGap, top: tgap - 2, - invisible: !(o.showTip && o.selected), + invisible: !(showTip && selected), ref: _ref => { this.openTip = _ref; }, @@ -56,9 +54,9 @@ export class Switch extends BasicButton { type: Label.xtype, text: i18nText("BI-Basic_Simple_Close"), cls: "content-tip", - right: 8, + right: textGap, top: tgap - 2, - invisible: !(o.showTip && !o.selected), + invisible: !(showTip && !selected), ref: _ref => { this.closeTip = _ref; }, @@ -78,7 +76,9 @@ export class Switch extends BasicButton { setSelected(v) { super.setSelected(...arguments); - this.layout.attr("items")[0].left = v ? this.options.width - 16 : 4; + const { width, height } = this.options; + const tgap = (height - CIRCLE_SIZE) / 2; + this.layout.attr("items")[0].left = v ? width - height + tgap : tgap; this.layout.resize(); this.options.showTip && this.openTip.setVisible(v); this.options.showTip && this.closeTip.setVisible(!v); diff --git a/packages/fineui/typescript/case/button/switch.ts b/packages/fineui/typescript/case/button/switch.ts index dc4489892..2b08b4b98 100644 --- a/packages/fineui/typescript/case/button/switch.ts +++ b/packages/fineui/typescript/case/button/switch.ts @@ -1,6 +1,11 @@ import { BasicButton } from "../../base/single/button/button.basic"; export declare class Switch extends BasicButton { + + props: { + textGap: number; + } & BasicButton['props'] + static xtype: string; static EVENT_CHANGE: string; }