From 0f3e94688dd803dcb1e44616a2e303b0a7ee22da Mon Sep 17 00:00:00 2001 From: iapyang Date: Fri, 26 Feb 2021 11:41:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=B8=80?= =?UTF-8?q?=E4=B8=AAbasic=20button=E8=A3=85=E9=A5=B0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic.button.wrapper.ts | 19 +++++++++++++++ typescript/core/decorator/decorator.ts | 24 +++++++++++++++++++ typescript/index.ts | 4 ++++ 3 files changed, 47 insertions(+) create mode 100644 typescript/component/basicbuttonwrapper/basic.button.wrapper.ts diff --git a/typescript/component/basicbuttonwrapper/basic.button.wrapper.ts b/typescript/component/basicbuttonwrapper/basic.button.wrapper.ts new file mode 100644 index 000000000..4b5f70b57 --- /dev/null +++ b/typescript/component/basicbuttonwrapper/basic.button.wrapper.ts @@ -0,0 +1,19 @@ +import { shortcut } from "../../core/decorator/decorator"; + +@shortcut() +export class BasicButtonWrapper extends BI.BasicButton { + public static xtype = 'bi.component.basic_button_wrapper'; + + public props: { + render(): any; + doClick(): void; + } + + public render() { + return this.options.render(); + } + + public doClick() { + this.options.doClick(); + } +} diff --git a/typescript/core/decorator/decorator.ts b/typescript/core/decorator/decorator.ts index 29ca97c55..9b10d7a70 100644 --- a/typescript/core/decorator/decorator.ts +++ b/typescript/core/decorator/decorator.ts @@ -1,3 +1,5 @@ +import { BasicButtonWrapper } from "../../component/basicbuttonwrapper/basic.button.wrapper"; + export type Constructor = new(...args: any[]) => T; /** @@ -27,6 +29,28 @@ export function model() { }; } +/** + * 给控件render外包装basicButton + */ +export function click() { + return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) { + const render = descriptor.value; + + descriptor.value = function(this:any, ...args: any[]) { + return { + type: BasicButtonWrapper.xtype, + cls: 'cursor-default', + render: () => render.apply(this, args), + doClick: () => { + this.fireEvent('click'); + }, + }; + }; + + return descriptor; + }; +} + /** * 类注册_store属性 * @param Model model类 diff --git a/typescript/index.ts b/typescript/index.ts index b35966288..208880538 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -152,6 +152,7 @@ import { Tree, Node } from "./core/utils/tree"; import { TextNode } from "./base/single/button/node/textnode"; import { TextValueCheckComboPopup } from "./case/combo/textvaluecheckcombo/popup.textvaluecheck"; import { ImageButton } from './base/single/button/buttons/button.image'; +import { BasicButtonWrapper } from "./component/basicbuttonwrapper/basic.button.wrapper"; export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { @@ -309,10 +310,12 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { TextNode: typeof TextNode; TextValueCheckComboPopup: typeof TextValueCheckComboPopup; ImageButton: typeof ImageButton; + BasicButtonWrapper: typeof BasicButtonWrapper; } export default { Decorators: decorator, + BasicButtonWrapper, }; export { OB, @@ -468,4 +471,5 @@ export { TextNode, TextValueCheckComboPopup, ImageButton, + BasicButtonWrapper, }; From efebc47b4832563899a45482bb52d45f1b74cd4d Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 2 Mar 2021 14:53:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Revert=20"feat:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=B8=80=E4=B8=AAbasic=20button=E8=A3=85=E9=A5=B0=E5=99=A8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0f3e94688dd803dcb1e44616a2e303b0a7ee22da. --- .../basic.button.wrapper.ts | 19 --------------- typescript/core/decorator/decorator.ts | 24 ------------------- typescript/index.ts | 4 ---- 3 files changed, 47 deletions(-) delete mode 100644 typescript/component/basicbuttonwrapper/basic.button.wrapper.ts diff --git a/typescript/component/basicbuttonwrapper/basic.button.wrapper.ts b/typescript/component/basicbuttonwrapper/basic.button.wrapper.ts deleted file mode 100644 index 4b5f70b57..000000000 --- a/typescript/component/basicbuttonwrapper/basic.button.wrapper.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { shortcut } from "../../core/decorator/decorator"; - -@shortcut() -export class BasicButtonWrapper extends BI.BasicButton { - public static xtype = 'bi.component.basic_button_wrapper'; - - public props: { - render(): any; - doClick(): void; - } - - public render() { - return this.options.render(); - } - - public doClick() { - this.options.doClick(); - } -} diff --git a/typescript/core/decorator/decorator.ts b/typescript/core/decorator/decorator.ts index 9b10d7a70..29ca97c55 100644 --- a/typescript/core/decorator/decorator.ts +++ b/typescript/core/decorator/decorator.ts @@ -1,5 +1,3 @@ -import { BasicButtonWrapper } from "../../component/basicbuttonwrapper/basic.button.wrapper"; - export type Constructor = new(...args: any[]) => T; /** @@ -29,28 +27,6 @@ export function model() { }; } -/** - * 给控件render外包装basicButton - */ -export function click() { - return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) { - const render = descriptor.value; - - descriptor.value = function(this:any, ...args: any[]) { - return { - type: BasicButtonWrapper.xtype, - cls: 'cursor-default', - render: () => render.apply(this, args), - doClick: () => { - this.fireEvent('click'); - }, - }; - }; - - return descriptor; - }; -} - /** * 类注册_store属性 * @param Model model类 diff --git a/typescript/index.ts b/typescript/index.ts index 208880538..b35966288 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -152,7 +152,6 @@ import { Tree, Node } from "./core/utils/tree"; import { TextNode } from "./base/single/button/node/textnode"; import { TextValueCheckComboPopup } from "./case/combo/textvaluecheckcombo/popup.textvaluecheck"; import { ImageButton } from './base/single/button/buttons/button.image'; -import { BasicButtonWrapper } from "./component/basicbuttonwrapper/basic.button.wrapper"; export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { @@ -310,12 +309,10 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { TextNode: typeof TextNode; TextValueCheckComboPopup: typeof TextValueCheckComboPopup; ImageButton: typeof ImageButton; - BasicButtonWrapper: typeof BasicButtonWrapper; } export default { Decorators: decorator, - BasicButtonWrapper, }; export { OB, @@ -471,5 +468,4 @@ export { TextNode, TextValueCheckComboPopup, ImageButton, - BasicButtonWrapper, }; From 65a05ec188085154d28b8c6186b745ae2e02278a Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 2 Mar 2021 14:58:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/fix/fix.compact.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index affb9a10b..727a884b3 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -207,7 +207,7 @@ function traverse (parent, path) { BI.each(parent, function (i, child) { - const childPath = path.concat(i); + var childPath = path.concat(i); if (BI.isArray(child)) { traverse(child, childPath); } else if (BI.isPlainObject(child)) {