From 6330f219be98757a5fd3dabb1837653bcaf21ca2 Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 17:51:09 +0800 Subject: [PATCH 01/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20update=20start=20sc?= =?UTF-8?q?ripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 388716ab7..6d85e5e3b 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash # FIXME! do not run build -lerna exec --scope @ali/lowcode-react-renderer -- npm run build -lerna exec --scope @ali/lowcode-demo -- npm start +# lerna exec --scope @ali/lowcode-react-renderer -- npm run build +# lerna exec --scope @ali/lowcode-demo -- npm start +lerna exec --scope @ali/gdt-simple-form-sdk -- npm start From 18807abceb7eb08b46adebe19dfcfb2a5766d972 Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 20:50:42 +0800 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20prototype=20getTit?= =?UTF-8?q?le=20=E6=94=AF=E6=8C=81=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/bundle/prototype.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index 86a9a0c92..bda37a203 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -15,6 +15,7 @@ import { upgradePropConfig, upgradeConfigure, } from './upgrade-metadata'; +import { globalLocale } from '@ali/lowcode-editor-core'; import { designer } from '../editor'; import { uniqueId } from '@ali/lowcode-utils'; @@ -23,7 +24,7 @@ const GlobalPropsConfigure: Array<{ initials?: InitialItem[]; filters?: FilterItem[]; autoruns?: AutorunItem[]; - config: FieldConfig + config: FieldConfig; }> = []; const Overrides: { [componentName: string]: { @@ -53,7 +54,7 @@ function addGlobalPropsConfigure(config: OldGlobalPropConfig) { addAutorun: (item) => { autoruns.push(item); }, - }) + }), }); } function removeGlobalPropsConfigure(name: string) { @@ -82,7 +83,7 @@ function overridePropsConfigure(componentName: string, config: { [name: string]: override = upgradeConfigure(config, { addInitial, addFilter, addAutorun }); } else { override = {}; - Object.keys(config).forEach(key => { + Object.keys(config).forEach((key) => { override[key] = upgradePropConfig(config[key], { addInitial, addFilter, addAutorun }); }); } @@ -212,7 +213,7 @@ class Prototype { static addGlobalExtraActions = addGlobalExtraActions; static removeGlobalPropsConfigure = removeGlobalPropsConfigure; static overridePropsConfigure = overridePropsConfigure; - static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { + static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { return new Prototype(config, lookup); } @@ -220,7 +221,7 @@ class Prototype { readonly meta: ComponentMeta; readonly options: OldPrototypeConfig | ComponentMetadata; - constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { + constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { if (lookup) { this.meta = designer.getComponentMeta(input.componentName); this.options = this.meta.getMetadata(); @@ -257,7 +258,15 @@ class Prototype { return this.meta.getMetadata().experimental?.context?.[name]; } - getTitle() { + getTitle(currentLocale?: string) { + if (currentLocale && this.meta.title[currentLocale]) { + return this.meta.title[currentLocale]; + } + const locale = globalLocale.getLocale(); + if (this.meta.title && this.meta.title.type === 'i18n') { + return this.meta.title[locale] || this.meta.title; + } + return this.meta.title; } From 3e233629b0512c2d0e8f0a41c26fd91781956ff1 Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 20:57:02 +0800 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20update=20sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 6d85e5e3b..833b31515 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# FIXME! do not run build -# lerna exec --scope @ali/lowcode-react-renderer -- npm run build -# lerna exec --scope @ali/lowcode-demo -- npm start -lerna exec --scope @ali/gdt-simple-form-sdk -- npm start +FIXME! do not run build +lerna exec --scope @ali/lowcode-react-renderer -- npm run build +lerna exec --scope @ali/lowcode-demo -- npm start + From 15fb96457514fd246db9fd84164bcdb2bd3e22da Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 20:57:50 +0800 Subject: [PATCH 04/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20update=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start.sh b/scripts/start.sh index 833b31515..ad2897969 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -FIXME! do not run build +# FIXME! do not run build lerna exec --scope @ali/lowcode-react-renderer -- npm run build lerna exec --scope @ali/lowcode-demo -- npm start From 927c8f22fd4a95b00c1898030d2d64f21f2e0a91 Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 20:58:13 +0800 Subject: [PATCH 05/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20empty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/start.sh b/scripts/start.sh index ad2897969..388716ab7 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -3,4 +3,3 @@ # FIXME! do not run build lerna exec --scope @ali/lowcode-react-renderer -- npm run build lerna exec --scope @ali/lowcode-demo -- npm start - From 732bccffdec5c67b1f933fe3672fe8cf8c1c9335 Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 21:16:18 +0800 Subject: [PATCH 06/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E7=94=A8=20isI18nD?= =?UTF-8?q?ata=20=E5=88=A4=E6=96=AD=20meta=20title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-preset-vision/src/bundle/prototype.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index bda37a203..d7f4612be 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -1,5 +1,5 @@ import { ComponentType, ReactElement } from 'react'; -import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem } from '@ali/lowcode-types'; +import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem, isI18nData } from '@ali/lowcode-types'; import { ComponentMeta, addBuiltinComponentAction, @@ -259,12 +259,14 @@ class Prototype { } getTitle(currentLocale?: string) { - if (currentLocale && this.meta.title[currentLocale]) { - return this.meta.title[currentLocale]; - } - const locale = globalLocale.getLocale(); - if (this.meta.title && this.meta.title.type === 'i18n') { - return this.meta.title[locale] || this.meta.title; + if (isI18nData(this.meta.title)) { + if (currentLocale && this.meta.title[currentLocale]) { + return this.meta.title[currentLocale]; + } + const locale = globalLocale.getLocale(); + if (this.meta.title && this.meta.title.type === 'i18n') { + return this.meta.title[locale] || this.meta.title; + } } return this.meta.title; From 14803dd94de4bf74b73dd796c84da338e71511a4 Mon Sep 17 00:00:00 2001 From: YJSON Date: Wed, 15 Jul 2020 21:18:39 +0800 Subject: [PATCH 07/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-preset-vision/src/bundle/prototype.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index d7f4612be..e4e01f908 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -213,7 +213,7 @@ class Prototype { static addGlobalExtraActions = addGlobalExtraActions; static removeGlobalPropsConfigure = removeGlobalPropsConfigure; static overridePropsConfigure = overridePropsConfigure; - static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { + static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { return new Prototype(config, lookup); } @@ -221,7 +221,7 @@ class Prototype { readonly meta: ComponentMeta; readonly options: OldPrototypeConfig | ComponentMetadata; - constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { + constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { if (lookup) { this.meta = designer.getComponentMeta(input.componentName); this.options = this.meta.getMetadata(); From 710f3ba74f3e0ff53ff66bb1447907d6fcfd78f5 Mon Sep 17 00:00:00 2001 From: YJSON Date: Thu, 16 Jul 2020 10:24:28 +0800 Subject: [PATCH 08/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-preset-vision/src/bundle/prototype.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index e4e01f908..57b72046e 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -213,7 +213,7 @@ class Prototype { static addGlobalExtraActions = addGlobalExtraActions; static removeGlobalPropsConfigure = removeGlobalPropsConfigure; static overridePropsConfigure = overridePropsConfigure; - static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { + static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { return new Prototype(config, lookup); } @@ -221,7 +221,7 @@ class Prototype { readonly meta: ComponentMeta; readonly options: OldPrototypeConfig | ComponentMetadata; - constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { + constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { if (lookup) { this.meta = designer.getComponentMeta(input.componentName); this.options = this.meta.getMetadata(); @@ -260,15 +260,9 @@ class Prototype { getTitle(currentLocale?: string) { if (isI18nData(this.meta.title)) { - if (currentLocale && this.meta.title[currentLocale]) { - return this.meta.title[currentLocale]; - } - const locale = globalLocale.getLocale(); - if (this.meta.title && this.meta.title.type === 'i18n') { - return this.meta.title[locale] || this.meta.title; - } + const locale = currentLocale || globalLocale.getLocale(); + return this.meta.title[locale] || this.meta.title; } - return this.meta.title; } From e3ca0bd6cbbd264c240f34f924b15a2cbe640642 Mon Sep 17 00:00:00 2001 From: YJSON Date: Thu, 16 Jul 2020 10:26:29 +0800 Subject: [PATCH 09/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-preset-vision/src/bundle/prototype.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index 57b72046e..7e0dc857e 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -213,7 +213,7 @@ class Prototype { static addGlobalExtraActions = addGlobalExtraActions; static removeGlobalPropsConfigure = removeGlobalPropsConfigure; static overridePropsConfigure = overridePropsConfigure; - static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { + static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { return new Prototype(config, lookup); } @@ -221,7 +221,7 @@ class Prototype { readonly meta: ComponentMeta; readonly options: OldPrototypeConfig | ComponentMetadata; - constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { + constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { if (lookup) { this.meta = designer.getComponentMeta(input.componentName); this.options = this.meta.getMetadata(); From a22e66aaf35601ccb5ea4dacaea279ae62152ccc Mon Sep 17 00:00:00 2001 From: YJSON Date: Thu, 16 Jul 2020 12:59:11 +0800 Subject: [PATCH 10/10] =?UTF-8?q?fix:=20=F0=9F=90=9B=20use=20intl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-preset-vision/src/bundle/prototype.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index 7e0dc857e..00cdeae29 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -15,7 +15,7 @@ import { upgradePropConfig, upgradeConfigure, } from './upgrade-metadata'; -import { globalLocale } from '@ali/lowcode-editor-core'; +import { intl } from '@ali/lowcode-editor-core'; import { designer } from '../editor'; import { uniqueId } from '@ali/lowcode-utils'; @@ -258,12 +258,8 @@ class Prototype { return this.meta.getMetadata().experimental?.context?.[name]; } - getTitle(currentLocale?: string) { - if (isI18nData(this.meta.title)) { - const locale = currentLocale || globalLocale.getLocale(); - return this.meta.title[locale] || this.meta.title; - } - return this.meta.title; + getTitle() { + return intl(this.meta.title); } getComponentName() {