From 5c33854bc8a5c0724e6bc514a4e41f731f99fe05 Mon Sep 17 00:00:00 2001 From: "Xavier.Meng" Date: Fri, 2 Dec 2022 19:30:16 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=97=A0JIRA=20refactor(widget):=20?= =?UTF-8?q?=E5=88=A0=E6=8E=89=5FWidget=E7=AD=89=EF=BC=8C=E9=83=BD=E6=8D=A2?= =?UTF-8?q?=E6=88=90Widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../allvalue.multitextvalue.combo.ts | 12 +- typescript/core/base.ts | 4 +- typescript/core/plugin.ts | 4 +- typescript/core/widget.ts | 404 +----------------- 4 files changed, 11 insertions(+), 413 deletions(-) diff --git a/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts b/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts index 990ef0cd1..960fa6219 100644 --- a/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts +++ b/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts @@ -1,14 +1,4 @@ -import { Widget, _Widget } from "../../core/widget"; - -export interface _AllValueMultiTextValueCombo extends _Widget { - getValue(): T[]; - - populate(items: any): void; -} - -export interface _AllValueMultiTextValueComboStatic { - EVENT_CONFIRM: string; -} +import { Widget } from "../../core/widget"; export declare class AllValueMultiTextValueCombo extends Widget { static xtype: string; diff --git a/typescript/core/base.ts b/typescript/core/base.ts index 4d6550f4f..79dc317af 100644 --- a/typescript/core/base.ts +++ b/typescript/core/base.ts @@ -1,4 +1,4 @@ -import { _Widget } from "./widget"; +import { Widget } from "./widget"; export interface _base { assert: (v: any, is: Function) => Boolean; @@ -7,7 +7,7 @@ export interface _base { UUID: () => string; - isWidget: (widget: any) => widget is _Widget; + isWidget: (widget: any) => widget is Widget; createWidgets: (items: any, options: any, context: any) => any; diff --git a/typescript/core/plugin.ts b/typescript/core/plugin.ts index 83c1176fb..afae32a91 100644 --- a/typescript/core/plugin.ts +++ b/typescript/core/plugin.ts @@ -1,7 +1,7 @@ -import { _Widget } from "./widget"; +import { Widget } from "./widget"; type configWidgetFn = (type: string, options: Obj) => void -type configObjectFn = (type: string, widget: _Widget) => void +type configObjectFn = (type: string, widget: Widget) => void export type _config = (widgetFunction: configWidgetFn | configWidgetFn[], objectFunction: configObjectFn | configObjectFn[]) => void diff --git a/typescript/core/widget.ts b/typescript/core/widget.ts index 5992ce01c..3cd8f175e 100644 --- a/typescript/core/widget.ts +++ b/typescript/core/widget.ts @@ -1,396 +1,5 @@ import { OB, _OB } from "./ob"; -export interface _WidgetStatic { - - /** - * 注册渲染引擎 - * @param engine 引擎 - */ - registerRenderEngine(engine: RenderEngine): void; -} - -export interface _Widget extends _OB { - - /** - * 出现loading的锁 - */ - __asking: boolean; - - /** - * 同步锁 - */ - __async: boolean; - - /** - * widget类标识符 - */ - widgetName: string | null; - - /** - * 是否为根节点 - */ - _isRoot: boolean; - - /** - * 父节点 - */ - _parent: _Widget | null; - // TODO: 完成jquery文件夹后把这块改了 - /** - * 真实dom的类jQuery对象 - */ - element: { - width(): number; - height(): number; - width(width: number | string): _Widget["element"]; - height(height: number | string): _Widget["element"]; - [key: string]: any; - }; - - /** - * 子元素 - */ - _children: { - [key: string]: _Widget; - }; - - /** - * 是否已挂载 - */ - _isMounted: boolean; - - /** - * 手动设置enable - */ - _manualSetEnable: boolean; - - /** - * 手动设置valid - */ - _manualSetValid: boolean; - - _store(): void; - - // 生命周期函数 - /** - * 初始化前 - */ - beforeInit?(cb: Function): void; - - /** - * 创建前 - */ - beforeCreate?(): void; - - /** - * 创建 - */ - created?(): void; - - /** - * 渲染 - */ - render?(): any; - - /** - * 挂载前 - */ - beforeMount?(): void; - - /** - * 挂载 - */ - mounted?(): void; - - /** - * 更新前 - */ - shouldUpdate?(...args: any[]): void; - - /** - * 更新 - */ - update?(...args: any[]): void; - - /** - * 销毁前 - */ - beforeDestroy?(): void; - - /** - * 销毁 - */ - destroyed?(): void; - - /** - * 初始化render函数 - */ - _initRender: () => void; - - /** - * 内部主render函数 - */ - _render: () => void; - - /** - * 初始化根节点 - */ - _initRoot: () => void; - - /** - * 初始化元素宽度 - */ - _initElementWidth: () => void; - - /** - * 初始化元素高度 - */ - _initElementHeight: () => void; - - /** - * 初始化元素可见 - */ - _initVisual: () => void; - - /** - * 初始化元素可用不可用 - */ - _initEffects: () => void; - - /** - * 设置mounted锁 - */ - _initState: () => void; - - /** - * 生成真实dom - */ - _initElement: () => void; - - /** - * 设置父节点 - */ - _setParent: () => void; - - /** - * @param force 是否强制挂载子节点 - * @param deep 子节点是否也是按照当前force处理 - * @param lifeHook 生命周期钩子触不触发,默认触发 - * @param predicate 递归每个widget的回调 - */ - _mount(force?: boolean, deep?: boolean, lifeHook?: boolean, predicate?: Function): boolean; - - /** - * 挂载子节点 - */ - _mountChildren?(): void; - - /** - * 是否已挂载 - */ - isMounted(): boolean; - - /** - * 设置宽度 - */ - setWidth(w: number): void; - - /** - * 设置高度 - */ - setHeight(h: number): void; - - /** - * 设置可用 - */ - _setEnable(enable: boolean): void; - - /** - * 设置合法 - */ - _setValid(valid: boolean): void; - - /** - * 设置可见 - */ - _setVisible(visible: boolean): void; - - /** - * 设置是否可用 - */ - setEnable(enable: boolean): void; - - /** - * 设置是否可见 - */ - setVisible(visible: boolean): void; - - /** - * 设置是否合法 - */ - setValid(valid: boolean): void; - - /** - * 设置反馈效果 - * @param args arguments参数 - */ - doBehavior(...args: any[]): void; - - /** - * 获取宽度 - */ - getWidth(): number; - - /** - * 获取高度 - */ - getHeight(): number; - - /** - * 是否合法 - */ - isValid(): boolean; - - /** - * 新增子元素 - */ - addWidget(_name: any, _widget: _Widget): _Widget; - - /** - * 根据wigetname获取子元素实例 - */ - getWidgetByName(_name: string): _Widget | undefined; - - /** - * 移除子元素 - * @param nameOrWidget widgetName或widget实例 - */ - removeWidget(nameOrWidget: string | _Widget): void; - - /** - * 是否有某个子元素 - */ - hasWidget(name: string): boolean; - - /** - * 获取widgetName - */ - getName(): string; - - /** - * 设置tag - * @param tag html tag - */ - setTag(tag: string): void; - - /** - * 获取tag - */ - getTag(): string; - - /** - * 设置属性 - * @param key 键 - * @param value 值 - */ - attr(key: string | { [key: string]: any }, value?: any): any; - - /** - * 获取text - */ - getText(): string; - - /** - * 设置text - */ - setText(text: string): void; - - /** - * 获取值 - */ - getValue(): any; - - /** - * 设置值 - */ - setValue(...args: any[]): void; - - /** - * 获取是否enable - */ - isEnabled(): boolean; - - /** - * 是否可见 - */ - isVisible(): boolean; - - /** - * disable元素 - */ - disable(): void; - - /** - * enable元素 - */ - enable(): void; - - /** - * 是widget合法 - */ - valid(): void; - - /** - * 使元素不合法 - */ - invalid(): void; - - /** - * 使不可见 - */ - invisible(..._args: any[]): void; - - /** - * 可见 - */ - visible(..._args: any[]): void; - - /** - * 清除子元素 - */ - __d(): void; - - /** - * 取消挂载 - */ - _unMount(): void; - - /** - * hang元素 - */ - isolate(): void; - - /** - * 请除元素 - */ - empty(): void; - - /** - * 刷新控件 - */ - reset(): void; - - /** - * 内部destory方法 - */ - _destroy(): void; - - /** - * destory元素 - */ - destroy(): void; -} - interface RenderEngine { // TODO: 完成jquery文件夹后把这块改了 /** @@ -406,7 +15,6 @@ interface RenderEngine { } export declare class Widget extends OB { - // /** * 注册渲染引擎 * @param engine 引擎 @@ -441,7 +49,7 @@ export declare class Widget extends OB { /** * 父节点 */ - _parent: _Widget | null; + _parent: Widget | null; // TODO: 完成jquery文件夹后把这块改了 /** * 真实dom的类jQuery对象 @@ -458,7 +66,7 @@ export declare class Widget extends OB { * 子元素 */ _children: { - [key: string]: _Widget; + [key: string]: Widget; }; /** @@ -666,19 +274,19 @@ export declare class Widget extends OB { /** * 新增子元素 */ - addWidget(widget: _Widget): _Widget; - addWidget(_name: any, _widget: _Widget): _Widget; + addWidget(widget: Widget): Widget; + addWidget(_name: any, _widget: Widget): Widget; /** * 根据wigetname获取子元素实例 */ - getWidgetByName(_name: string): _Widget | undefined; + getWidgetByName(_name: string): Widget | undefined; /** * 移除子元素 * @param nameOrWidget widgetName或widget实例 */ - removeWidget(nameOrWidget: string | _Widget): void; + removeWidget(nameOrWidget: string | Widget): void; /** * 是否有某个子元素 From c6b5a8376beabae59b2e16937697604410d1b893 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 5 Dec 2022 12:17:56 +0800 Subject: [PATCH 2/9] auto upgrade version to 2.0.20221205121730 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd175efdf..0e5717b27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221202174010", + "version": "2.0.20221205121730", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From ff6fe859b479696ce9f2eb1d92534652337dac65 Mon Sep 17 00:00:00 2001 From: Treecat Date: Mon, 5 Dec 2022 14:41:33 +0800 Subject: [PATCH 3/9] =?UTF-8?q?REPORT-85956=20fix:=E8=AE=BE=E7=BD=AEtextWi?= =?UTF-8?q?dth=E5=B1=9E=E6=80=A7=E6=97=B6=E5=A6=82=E6=9E=9C=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E8=B6=85=E8=BF=87=E6=8C=89=E9=92=AE=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E4=BC=9A=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/base/button/demo.button.js | 5 +++++ src/base/single/button/buttons/button.js | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/demo/js/base/button/demo.button.js b/demo/js/base/button/demo.button.js index 981683e84..2514b949e 100644 --- a/demo/js/base/button/demo.button.js +++ b/demo/js/base/button/demo.button.js @@ -385,6 +385,11 @@ Demo.Button = BI.inherit(BI.Widget, { type: "bi.button", text: "小于最小宽度的按钮", width: 50, + }, { + type: "bi.button", + text: "一个文字超级超级长的 button, 他比按钮宽度还长。", + textWidth: 500, + width: 100, }]; return { diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index a06f23191..bc1468450 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -81,7 +81,7 @@ }, hgap: o.hgap, vgap: o.vgap, - items: self.generateItems() + items: self.generateItems(), }); // 如果 options 对应的属性为 true 则给元素添加 class @@ -102,7 +102,7 @@ // 由于button默认情况下有个边框,所以要主动算行高 var lineHeight, textHeight = o.textHeight; - var hasBorder = false + var hasBorder = false; if (BI.isNumber(o.height)) { if (!isVertical(o.iconPosition)) { if (!(o.clear && o.block && o.light)) { @@ -121,12 +121,12 @@ var iconInvisible = !(o.loading || o.iconCls || o.icon || defaultRenderIcon); - var textWidth = o.textWidth; - if (BI.isNull(o.textWidth)) { - textWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width; - textWidth -= (o.hgap * 2 + o.iconGap) - textWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth - } + var maxTextWidth = Math.max(o.minWidth, o.width); + maxTextWidth -= (o.hgap * 2 + o.iconGap); + // 减去图标水平占位宽度 + maxTextWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth; + var textWidth = BI.isNull(o.textWidth) ? maxTextWidth : Math.min(o.textWidth, maxTextWidth); + this.text = BI.createWidget({ type: "bi.label", text: o.text, @@ -140,7 +140,7 @@ }); if (iconInvisible) { - return [this.text] + return [this.text]; } this._iconRendered = true; From 7e7587689110e0942ae8d84c9b00b187c383cc1e Mon Sep 17 00:00:00 2001 From: data Date: Mon, 5 Dec 2022 15:15:41 +0800 Subject: [PATCH 4/9] auto upgrade version to 2.0.20221205151529 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e5717b27..a72f5374c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221205121730", + "version": "2.0.20221205151529", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 241893125567067dbb492a823bb8354cdc6e8a1a Mon Sep 17 00:00:00 2001 From: data Date: Tue, 6 Dec 2022 10:47:09 +0800 Subject: [PATCH 5/9] auto upgrade version to 2.0.20221206104638 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a72f5374c..9d867dc31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221205151529", + "version": "2.0.20221206104638", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From d14d460d4ccf2f3338f03cd2e83f5b82fc054de1 Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 8 Dec 2022 09:46:16 +0800 Subject: [PATCH 6/9] =?UTF-8?q?KERNEL-13782=20feat:=20editor=E6=94=AF?= =?UTF-8?q?=E6=8C=81autoTrim=20props=E6=8E=A7=E5=88=B6=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=87=AA=E5=8A=A8trim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/editor/editor.js | 63 ++++++++++++++------------ src/case/editor/editor.clear.js | 6 ++- src/case/editor/editor.defaulttext.js | 1 + src/case/editor/editor.shelter.js | 3 +- src/case/editor/editor.sign.js | 3 +- src/case/editor/editor.state.js | 3 +- src/case/editor/editor.state.simple.js | 19 ++++---- src/widget/editor/editor.search.js | 3 +- src/widget/editor/editor.text.js | 3 +- 9 files changed, 61 insertions(+), 43 deletions(-) diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js index ac9e779e9..c0a77c9f6 100644 --- a/src/base/single/editor/editor.js +++ b/src/base/single/editor/editor.js @@ -23,6 +23,7 @@ BI.Editor = BI.inherit(BI.Single, { allowBlank: false, watermark: "", errorText: "", + autoTrim: true, }); }, @@ -49,25 +50,29 @@ BI.Editor = BI.inherit(BI.Single, { margin: "0", }); - var items = [{ - el: { - type: "bi.absolute", - ref: function (_ref) { - self.contentWrapper = _ref; + var items = [ + { + el: { + type: "bi.absolute", + ref: function (_ref) { + self.contentWrapper = _ref; + }, + items: [ + { + el: this.editor, + left: 0, + right: 0, + top: 0, + bottom: 0, + } + ], }, - items: [{ - el: this.editor, - left: 0, - right: 0, - top: 0, - bottom: 0, - }], - }, - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - }]; + left: o.hgap + o.lgap, + right: o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap, + } + ]; BI.createWidget({ type: "bi.absolute", @@ -248,13 +253,15 @@ BI.Editor = BI.inherit(BI.Single, { BI.createWidget({ type: "bi.absolute", element: this.contentWrapper, - items: [{ - el: this.watermark, - left: 0, - right: 0, - top: 0, - bottom: 0, - }], + items: [ + { + el: this.watermark, + left: 0, + right: 0, + top: 0, + bottom: 0, + } + ], }); } this.watermark.setText(v); @@ -265,7 +272,7 @@ BI.Editor = BI.inherit(BI.Single, { var o = this.options; var errorText = o.errorText; if (BI.isFunction(errorText)) { - errorText = errorText(BI.trim(this.editor.getValue())); + errorText = errorText(o.autoTrim ? BI.trim(this.editor.getValue()) : this.editor.getValue()); } if (!this.disabledError && BI.isKey(errorText)) { BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, { @@ -330,10 +337,10 @@ BI.Editor = BI.inherit(BI.Single, { getValue: function () { if (!this.isValid()) { - return BI.trim(this.editor.getLastValidValue()); + return this.options.autoTrim ? BI.trim(this.editor.getLastValidValue()) : this.editor.getLastValidValue(); } - return BI.trim(this.editor.getValue()); + return this.options.autoTrim ? BI.trim(this.editor.getValue()) : this.editor.getValue(); }, isEditing: function () { diff --git a/src/case/editor/editor.clear.js b/src/case/editor/editor.clear.js index 6fd199a43..e18ab9599 100644 --- a/src/case/editor/editor.clear.js +++ b/src/case/editor/editor.clear.js @@ -31,7 +31,8 @@ BI.ClearEditor = BI.inherit(BI.Widget, { errorText: o.errorText, validationChecker: o.validationChecker, quitChecker: o.quitChecker, - value: o.value + value: o.value, + autoTrim: o.autoTrim, }); this.clear = BI.createWidget({ type: "bi.icon_button", @@ -54,7 +55,8 @@ BI.ClearEditor = BI.inherit(BI.Widget, { { el: this.clear, width: 24 - }] + } + ] }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/case/editor/editor.defaulttext.js b/src/case/editor/editor.defaulttext.js index 4cfaf59a5..fe88d27bb 100644 --- a/src/case/editor/editor.defaulttext.js +++ b/src/case/editor/editor.defaulttext.js @@ -45,6 +45,7 @@ BI.DefaultTextEditor = BI.inherit(BI.Widget, { watermark: o.watermark, errorText: o.errorText, invisible: true, + autoTrim: o.autoTrim, }); var showText = BI.isFunction(o.text) ? o.text() : o.text; diff --git a/src/case/editor/editor.shelter.js b/src/case/editor/editor.shelter.js index 31883614c..4cb8e4d75 100644 --- a/src/case/editor/editor.shelter.js +++ b/src/case/editor/editor.shelter.js @@ -46,7 +46,8 @@ BI.ShelterEditor = BI.inherit(BI.Widget, { quitChecker: o.quitChecker, allowBlank: o.allowBlank, watermark: o.watermark, - errorText: o.errorText + errorText: o.errorText, + autoTrim: o.autoTrim, }); this.text = BI.createWidget({ type: "bi.text_button", diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js index 7a69a5005..0fb65fa0d 100644 --- a/src/case/editor/editor.sign.js +++ b/src/case/editor/editor.sign.js @@ -46,7 +46,8 @@ BI.SignEditor = BI.inherit(BI.Widget, { quitChecker: o.quitChecker, allowBlank: o.allowBlank, watermark: o.watermark, - errorText: o.errorText + errorText: o.errorText, + autoTrim: o.autoTrim, }); this.text = BI.createWidget({ type: "bi.text_button", diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index 8ed915716..9c3f340f9 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -45,7 +45,8 @@ BI.StateEditor = BI.inherit(BI.Widget, { quitChecker: o.quitChecker, allowBlank: o.allowBlank, watermark: o.watermark, - errorText: o.errorText + errorText: o.errorText, + autoTrim: o.autoTrim, }); this.text = BI.createWidget({ type: "bi.text_button", diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index 4d17ab30e..96be87aa1 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -45,7 +45,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { quitChecker: o.quitChecker, allowBlank: o.allowBlank, watermark: o.watermark, - errorText: o.errorText + errorText: o.errorText, + autoTrim: o.autoTrim, }); this.text = BI.createWidget({ type: "bi.text_button", @@ -68,13 +69,15 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { BI.createWidget({ type: "bi.absolute", element: this, - items: [{ - el: this.text, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] + 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); diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index 29e4983eb..bd40ae5a9 100644 --- a/src/widget/editor/editor.search.js +++ b/src/widget/editor/editor.search.js @@ -27,7 +27,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, { errorText: o.errorText, validationChecker: o.validationChecker, quitChecker: o.quitChecker, - value: o.value + value: o.value, + autoTrim: o.autoTrim, }); this.clear = BI.createWidget({ type: "bi.icon_button", diff --git a/src/widget/editor/editor.text.js b/src/widget/editor/editor.text.js index 19f51fd73..022b5f2ad 100644 --- a/src/widget/editor/editor.text.js +++ b/src/widget/editor/editor.text.js @@ -47,7 +47,8 @@ BI.TextEditor = BI.inherit(BI.Widget, { watermark: o.watermark, errorText: o.errorText, inputType: o.inputType, - autocomplete: o.autocomplete + autocomplete: o.autocomplete, + autoTrim: o.autoTrim, }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); From dff599e8c1e29ac36423dc43a3ccdefd961776d6 Mon Sep 17 00:00:00 2001 From: data Date: Thu, 8 Dec 2022 12:17:02 +0800 Subject: [PATCH 7/9] auto upgrade version to 2.0.20221208121622 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d867dc31..5d047f85b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221206104638", + "version": "2.0.20221208121622", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From e591db90646452ec9e2e3ef9620ce8212a053b32 Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 8 Dec 2022 16:18:26 +0800 Subject: [PATCH 8/9] =?UTF-8?q?KERNEL-11877=20BI-118434=20=E7=AD=89?= =?UTF-8?q?=E6=AF=94=E4=B8=8Bscale=E7=BC=A9=E6=94=BE=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/bubble.js | 21 +++--- src/base/combination/combo.js | 39 +++++++---- src/core/platform/web/dom.js | 120 +++++++++++++++++++++++---------- 3 files changed, 123 insertions(+), 57 deletions(-) diff --git a/src/base/combination/bubble.js b/src/base/combination/bubble.js index 1af43b79c..7b5f57736 100644 --- a/src/base/combination/bubble.js +++ b/src/base/combination/bubble.js @@ -106,7 +106,8 @@ _initPullDownAction: function () { var self = this, o = this.options; var evs = (this.options.trigger || "").split(","); - function st (e) { + + function st(e) { if (o.stopEvent) { e.stopEvent(); } @@ -268,7 +269,7 @@ BI.createWidget({ type: "bi.vertical", scrolly: false, - element: this.options.container || this, + element: BI.isFunction(this.options.container) ? this.options.container() : (this.options.container || this), items: [ { el: this.popupView } ], @@ -344,14 +345,16 @@ if (this.popper) { this.popper.destroy(); } - var modifiers = [{ - name: "offset", - options: { - offset: function () { - return [o.adjustXOffset, (o.showArrow ? 12 : 0) + (o.adjustYOffset + o.adjustLength)]; + var modifiers = [ + { + name: "offset", + options: { + offset: function () { + return [o.adjustXOffset, (o.showArrow ? 12 : 0) + (o.adjustYOffset + o.adjustLength)]; + }, }, - }, - }]; + } + ]; if (this.options.showArrow) { modifiers.push({ name: "arrow", diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 7abbf77eb..02f838877 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -38,6 +38,7 @@ adjustLength: 0, // 调整的距离 adjustXOffset: 0, adjustYOffset: 0, + supportCSSTransform: false, hideChecker: BI.emptyFn, offsetStyle: "left", // left,right,center el: {}, @@ -218,46 +219,47 @@ }, }, } : this.combo; + var positionRelativeElement = o.supportCSSTransform ? BI.DOM.getPositionRelativeContainingBlock(BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]) : null; switch (o.direction) { case "bottom": case "bottom,right": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle, positionRelativeElement); break; case "top": case "top,right": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle, positionRelativeElement); break; case "left": case "left,bottom": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle, positionRelativeElement); break; case "right": case "right,bottom": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle, positionRelativeElement); break; case "top,left": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle, positionRelativeElement); break; case "bottom,left": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle, positionRelativeElement); break; case "left,top": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle, positionRelativeElement); break; case "right,top": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle, positionRelativeElement); break; case "right,innerRight": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle, positionRelativeElement); break; case "right,innerLeft": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], o.offsetStyle, positionRelativeElement); break; case "innerRight": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], o.offsetStyle, positionRelativeElement); break; case "innerLeft": - p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], o.offsetStyle, positionRelativeElement); break; case "top,custom": case "custom,top": @@ -290,6 +292,7 @@ if ("adaptHeight" in p) { this.resetListHeight(p.adaptHeight); } + var width = this.combo.element.outerWidth(); var height = this.combo.element.outerHeight(); this.popupView.setDirection && this.popupView.setDirection(p.dir, { @@ -300,6 +303,18 @@ adjustYOffset: o.adjustYOffset, offset: this.combo.element.offset(), }); + + if (o.supportCSSTransform) { + + var positonedRect = positionRelativeElement.getBoundingClientRect(); + + var scaleX = positonedRect.width / positionRelativeElement.offsetWidth; + var scaleY = positonedRect.height / positionRelativeElement.offsetHeight; + + p.top && (p.top = p.top / scaleY); + p.left && (p.left = p.left / scaleX); + } + if ("left" in p) { this.popupView.element.css({ left: p.left, diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index 05757959d..bab3d7042 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -56,7 +56,7 @@ preloadImages: function (srcArray, onload) { var count = 0, images = []; - function complete () { + function complete() { count++; if (count >= srcArray.length) { onload(); @@ -151,9 +151,15 @@ BI.extend(BI.DOM, { - getLeftPosition: function (combo, popup, extraWidth) { + getLeftPosition: function (combo, popup, extraWidth, container) { + var el = combo.element; + var popupEl = popup.element; + var elRect = el[0].getBoundingClientRect(); + var popupElRect = popupEl[0].getBoundingClientRect(); + var containerRect = container ? container.getBoundingClientRect() : { left: 0 }; + return { - left: combo.element.offset().left - popup.element.outerWidth() - (extraWidth || 0) + left: elRect.left - containerRect.left - popupElRect.width - (extraWidth || 0) }; }, @@ -163,10 +169,13 @@ }; }, - getRightPosition: function (combo, popup, extraWidth) { + getRightPosition: function (combo, popup, extraWidth, container) { var el = combo.element; + var elRect = el[0].getBoundingClientRect(); + var containerRect = container ? container.getBoundingClientRect() : { left: 0 }; + return { - left: el.offset().left + el.outerWidth() + (extraWidth || 0) + left: elRect.left + elRect.width - containerRect.left + (extraWidth || 0) }; }, @@ -177,16 +186,25 @@ }; }, - getTopPosition: function (combo, popup, extraHeight) { + getTopPosition: function (combo, popup, extraHeight, container) { + var el = combo.element; + var popupEl = popup.element; + var elRect = el[0].getBoundingClientRect(); + var popupElRect = popupEl[0].getBoundingClientRect(); + var containerRect = container ? container.getBoundingClientRect() : { top: 0 }; + return { - top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0) + top: elRect.top - containerRect.top - popupElRect.height - (extraHeight || 0) }; }, - getBottomPosition: function (combo, popup, extraHeight) { + getBottomPosition: function (combo, popup, extraHeight, container) { var el = combo.element; + var elRect = el[0].getBoundingClientRect(); + var containerRect = container ? container.getBoundingClientRect() : { top: 0 }; + return { - top: el.offset().top + el.outerHeight() + (extraHeight || 0) + top: elRect.top - containerRect.top + elRect.height + (extraHeight || 0) }; }, @@ -230,18 +248,19 @@ return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top; }, - _getLeftAlignPosition: function (combo, popup, extraWidth) { + _getLeftAlignPosition: function (combo, popup, extraWidth, container) { var viewBounds = popup.element.bounds(), windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); - var left = combo.element.offset().left + extraWidth; + var left = combo.element.offset().left - (container ? container.getBoundingClientRect().left : 0) + extraWidth; + if (left + viewBounds.width > windowBounds.width) { left = windowBounds.width - viewBounds.width; } return left; }, - getLeftAlignPosition: function (combo, popup, extraWidth) { - var left = this._getLeftAlignPosition(combo, popup, extraWidth); + getLeftAlignPosition: function (combo, popup, extraWidth, container) { + var left = this._getLeftAlignPosition(combo, popup, extraWidth, container); var dir = ""; // 如果放不下,优先使用RightAlign, 如果RightAlign也放不下, 再使用left=0 if (left < 0) { @@ -297,13 +316,14 @@ }; }, - getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { + getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) { var comboOffset = combo.element.offset(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); + windowBounds = BI.Widget._renderEngine.createElement("body").bounds(), + containerBounds = container ? container.getBoundingClientRect() : { top: 0 }; var top, adaptHeight, dir; if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { - top = comboOffset.top + extraHeight; + top = comboOffset.top - containerBounds.top + extraHeight; } else if (needAdaptHeight) { top = comboOffset.top + extraHeight; adaptHeight = windowBounds.height - top; @@ -353,13 +373,15 @@ }; }, - getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { + getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); + var comboBounds = combo.element[0].getBoundingClientRect(), + popupBounds = popup.element[0].getBoundingClientRect(), + windowBounds = BI.Widget._renderEngine.createElement("body").bounds(), + containerBounds = container ? container.getBoundingClientRect() : { top: 0 }; var top, adaptHeight, dir; if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { - top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; + top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height; } else if (needAdaptHeight) { top = 0; adaptHeight = comboOffset.top + comboBounds.height - extraHeight; @@ -446,7 +468,7 @@ }; }, - getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) { + getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, container) { extraWidth || (extraWidth = 0); extraHeight || (extraHeight = 0); var i, direct; @@ -483,11 +505,11 @@ if (!isNeedAdaptHeight) { var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight; if (BI.DOM.isLeftSpaceEnough(combo, popup, tW)) { - left = BI.DOM.getLeftPosition(combo, popup, tW).left; + left = BI.DOM.getLeftPosition(combo, popup, tW, container).left; if (topBottom[0] === "bottom") { - pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight); + pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight, container); } else { - pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); + pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight, container); } pos.dir = "left," + pos.dir; if (tbFirst) { @@ -503,11 +525,11 @@ if (!isNeedAdaptHeight) { var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight; if (BI.DOM.isRightSpaceEnough(combo, popup, tW)) { - left = BI.DOM.getRightPosition(combo, popup, tW).left; + left = BI.DOM.getRightPosition(combo, popup, tW, container).left; if (topBottom[0] === "bottom") { - pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight); + pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight, container); } else { - pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); + pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight, container); } pos.dir = "right," + pos.dir; if (tbFirst) { @@ -522,11 +544,11 @@ case "top": var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; if (BI.DOM.isTopSpaceEnough(combo, popup, tH)) { - top = BI.DOM.getTopPosition(combo, popup, tH).top; + top = BI.DOM.getTopPosition(combo, popup, tH, container).top; if (leftRight[0] === "right") { - pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); + pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, container); } else { - pos = BI.DOM.getRightAlignPosition(combo, popup, tW); + pos = BI.DOM.getRightAlignPosition(combo, popup, tW, container); } pos.dir = "top," + pos.dir; if (lrFirst) { @@ -543,11 +565,11 @@ case "bottom": var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; if (BI.DOM.isBottomSpaceEnough(combo, popup, tH)) { - top = BI.DOM.getBottomPosition(combo, popup, tH).top; + top = BI.DOM.getBottomPosition(combo, popup, tH, container).top; if (leftRight[0] === "right") { - pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); + pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, container); } else { - pos = BI.DOM.getRightAlignPosition(combo, popup, tW); + pos = BI.DOM.getRightAlignPosition(combo, popup, tW, container); } pos.dir = "bottom," + pos.dir; if (lrFirst) { @@ -648,13 +670,13 @@ }, - getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle) { + getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, container) { extraWidth || (extraWidth = 0); extraHeight || (extraHeight = 0); var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight; var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); popup.resetHeight && popup.resetHeight(maxHeight); - var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"]); + var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], container); switch (offsetStyle) { case "center": if (position.change) { @@ -679,6 +701,32 @@ popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); } return position; - } + }, + + /** + * 获取position:fixed相对定位的元素 + */ + getPositionRelativeContainingBlock: function (element) { + if (['html', 'body', '#document'].indexOf((element.nodeName || '').toLowerCase()) >= 0) { + // $FlowFixMe[incompatible-return]: assume body is always available + return element.ownerDocument.body; + } + + function isExcept(node) { + var _computedStyle = getComputedStyle(node); + var transform = _computedStyle.transform; + var perspective = _computedStyle.perspective; + var filter = _computedStyle.filter; + var willChange = _computedStyle["will-change"]; + + return [transform, perspective, filter].some(value => value !== 'none') || (willChange === "transform"); + } + + if (isExcept(element)) { + return element; + } + + return BI.DOM.getPositionRelativeContainingBlock(element.parentNode); + }, }); })(); From d87670aba03018c08694af9d96ab3f8fb814fffe Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 8 Dec 2022 16:19:37 +0800 Subject: [PATCH 9/9] demo --- demo/js/west.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/demo/js/west.js b/demo/js/west.js index d4cc9d59b..d2cd70109 100644 --- a/demo/js/west.js +++ b/demo/js/west.js @@ -9,6 +9,10 @@ Demo.West = BI.inherit(BI.Widget, { render: function () { var self = this; + + + var selectedId = BI.Router.$router.currentRoute.params?.componentId; + return { type: "bi.vtape", items: [{ @@ -60,7 +64,7 @@ Demo.West = BI.inherit(BI.Widget, { self.fireEvent(Demo.West.EVENT_VALUE_CHANGE, v); } }], - value: Demo.showIndex, + value: selectedId || Demo.showIndex, items: Demo.CONFIG, ref: function (ref) { self.tree = ref; @@ -70,4 +74,4 @@ Demo.West = BI.inherit(BI.Widget, { } }); Demo.West.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE"; -BI.shortcut("demo.west", Demo.West); \ No newline at end of file +BI.shortcut("demo.west", Demo.West);