From 12dacdcc337690f02fad77787a7bb9520c103cd1 Mon Sep 17 00:00:00 2001 From: Janry Date: Fri, 17 Sep 2021 15:15:36 +0800 Subject: [PATCH 01/33] chore(workflow): fix actions --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ae8643c30c..2fe26eb5acb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: jobs: build: runs-on: ${{ matrix.os }} - if: !contains(github.event.head_commit.message, 'chore(versions)') + if: contains(github.event.head_commit.message, 'chore(versions)') == false strategy: matrix: node_version: [10.x, 11.x] From 7dc9d9ff859435ffc71ceef43b28784fe40df71d Mon Sep 17 00:00:00 2001 From: Lyca Date: Fri, 17 Sep 2021 15:22:00 +0800 Subject: [PATCH 02/33] feat(react): fix schema x-component-props children invalid (#2160) --- .../react/src/__tests__/schema.json.spec.tsx | 62 +++++++++++++++++++ .../src/__tests__/schema.markup.spec.tsx | 43 +++++++++++++ .../react/src/components/ReactiveField.tsx | 2 +- 3 files changed, 106 insertions(+), 1 deletion(-) diff --git a/packages/react/src/__tests__/schema.json.spec.tsx b/packages/react/src/__tests__/schema.json.spec.tsx index 7ce729a051e..9df058089f1 100644 --- a/packages/react/src/__tests__/schema.json.spec.tsx +++ b/packages/react/src/__tests__/schema.json.spec.tsx @@ -58,4 +58,66 @@ describe('json schema field', () => { ) expect(queryByTestId('input')).toBeVisible() }) + test('x-component-props children', () => { + const form = createForm() + const Text: React.FC = ({ children }) => { + return
{children}
+ } + const SchemaField = createSchemaField({ + components: { + Text, + }, + }) + const { queryByTestId } = render( + + + + ) + expect(queryByTestId('children-test')).toBeVisible() + expect(queryByTestId('children-test').innerHTML).toEqual('children') + }) + test('x-content', async () => { + const form = createForm() + const Text: React.FC = ({ children }) => { + return
{children}
+ } + const SchemaField = createSchemaField({ + components: { + Text, + }, + }) + const { queryByTestId } = render( + + + + ) + expect(queryByTestId('content-test')).toBeVisible() + expect(queryByTestId('content-test').innerHTML).toEqual('content') + }) }) diff --git a/packages/react/src/__tests__/schema.markup.spec.tsx b/packages/react/src/__tests__/schema.markup.spec.tsx index 0d0e2398e0f..2c328aef023 100644 --- a/packages/react/src/__tests__/schema.markup.spec.tsx +++ b/packages/react/src/__tests__/schema.markup.spec.tsx @@ -176,6 +176,49 @@ describe('markup schema field', () => { ) }) + test('props children', () => { + const form = createForm() + const Text: React.FC = (props) => { + return
{props.children}
+ } + const SchemaField = createSchemaField({ + components: { + Text, + }, + }) + const { queryByTestId } = render( + + + + + + ) + expect(queryByTestId('children-test')).toBeVisible() + expect(queryByTestId('children-test').innerHTML).toEqual('props') + }) + test('x-content', () => { + const form = createForm() + const Text: React.FC = (props) => { + return
{props.children}
+ } + const SchemaField = createSchemaField({ + components: { + Text, + }, + }) + const { queryByTestId } = render( + + + + + + ) + expect(queryByTestId('content-test')).toBeVisible() + expect(queryByTestId('content-test').innerHTML).toEqual('content') + }) }) describe('recursion field', () => { diff --git a/packages/react/src/components/ReactiveField.tsx b/packages/react/src/components/ReactiveField.tsx index 3508fc1dc69..e33e00b9432 100644 --- a/packages/react/src/components/ReactiveField.tsx +++ b/packages/react/src/components/ReactiveField.tsx @@ -32,7 +32,7 @@ const ReactiveInternal: React.FC = (props) => { const field = props.field const content = mergeChildren( renderChildren(props.children, field, field.form), - field.content + field.content ?? field.component[1].children ) if (field.display !== 'visible') return null From 184884cacd6e71370a99e0cbe2fba590171e79d5 Mon Sep 17 00:00:00 2001 From: janrywang Date: Fri, 17 Sep 2021 17:23:54 +0800 Subject: [PATCH 03/33] perf(schema): improve performance --- packages/json-schema/src/compiler.ts | 10 ++++++---- packages/json-schema/src/traverse.ts | 10 ++++++---- .../__tests__/{test.spec.ts => hasCollected.spec.ts} | 0 packages/reactive/src/__tests__/observable.spec.ts | 7 +++++++ packages/reactive/src/handlers.ts | 4 ++-- 5 files changed, 21 insertions(+), 10 deletions(-) rename packages/reactive/src/__tests__/{test.spec.ts => hasCollected.spec.ts} (100%) create mode 100644 packages/reactive/src/__tests__/observable.spec.ts diff --git a/packages/json-schema/src/compiler.ts b/packages/json-schema/src/compiler.ts index bea5e14a867..81b11f0da67 100644 --- a/packages/json-schema/src/compiler.ts +++ b/packages/json-schema/src/compiler.ts @@ -62,7 +62,7 @@ export const compile = ( source: Source, scope?: Scope ): any => { - const seenObjects = new WeakSet() + const seenObjects = [] const compile = (source: any) => { if (isStr(source)) { return shallowCompile(source, scope) @@ -70,10 +70,12 @@ export const compile = ( return source.map((value: any) => compile(value)) } else if (isPlainObj(source)) { if (isNoNeedCompileObject(source)) return source - if (seenObjects.has(source)) { + const seenIndex = seenObjects.indexOf(source) + if (seenIndex > -1) { return source } - seenObjects.add(source) + const addIndex = seenObjects.length + seenObjects.push(source) const results = reduce( source, (buf, value, key) => { @@ -82,7 +84,7 @@ export const compile = ( }, {} ) - seenObjects.delete(source) + seenObjects.splice(addIndex, 1) return results } return source diff --git a/packages/json-schema/src/traverse.ts b/packages/json-schema/src/traverse.ts index a5ac80a108f..258024a3b7e 100644 --- a/packages/json-schema/src/traverse.ts +++ b/packages/json-schema/src/traverse.ts @@ -7,16 +7,18 @@ export const traverse = ( visitor: (value: any, path: Array, address: string) => void, filter?: (value: any, path: Array) => boolean ) => { - const seenObjects = new WeakSet() + const seenObjects = [] const root = target const traverse = (target: any, path = [], address = '') => { if (filter?.(target, path) === false) return if (isPlainObj(target)) { - if (seenObjects.has(target)) { + const seenIndex = seenObjects.indexOf(target) + if (seenIndex > -1) { return } - seenObjects.add(target) + const addIndex = seenObjects.length + seenObjects.push(target) if (isNoNeedCompileObject(target) && root !== target) { visitor(target, path, address) return @@ -24,7 +26,7 @@ export const traverse = ( each(target, (value, key) => { traverse(value, path.concat(key), address + '.' + key) }) - seenObjects.delete(target) + seenObjects.splice(addIndex, 1) } else { visitor(target, path, address) } diff --git a/packages/reactive/src/__tests__/test.spec.ts b/packages/reactive/src/__tests__/hasCollected.spec.ts similarity index 100% rename from packages/reactive/src/__tests__/test.spec.ts rename to packages/reactive/src/__tests__/hasCollected.spec.ts diff --git a/packages/reactive/src/__tests__/observable.spec.ts b/packages/reactive/src/__tests__/observable.spec.ts new file mode 100644 index 00000000000..eebbd8031c9 --- /dev/null +++ b/packages/reactive/src/__tests__/observable.spec.ts @@ -0,0 +1,7 @@ +import { observable } from '../' + +test('array mutation', () => { + const arr = observable([1, 2, 3, 4]) + arr.splice(2, 1) + expect(arr).toEqual([1, 2, 4]) +}) diff --git a/packages/reactive/src/handlers.ts b/packages/reactive/src/handlers.ts index 477fe3a3059..e144b693913 100644 --- a/packages/reactive/src/handlers.ts +++ b/packages/reactive/src/handlers.ts @@ -221,14 +221,14 @@ export const baseHandlers: ProxyHandler = { return true }, deleteProperty(target, key) { - const res = Reflect.deleteProperty(target, key) const oldValue = target[key] + delete target[key] runReactionsFromTargetKey({ target, key, oldValue, type: 'delete', }) - return res + return true }, } From cdf84057f66162c3aa9adce9ad3a6e878d22545f Mon Sep 17 00:00:00 2001 From: janrywang Date: Fri, 17 Sep 2021 17:27:50 +0800 Subject: [PATCH 04/33] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v2.0.0-rc.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 84 ++----------------- devtools/chrome-extension/package.json | 6 +- lerna.json | 2 +- packages/antd/package.json | 14 ++-- packages/core/package.json | 8 +- packages/element/package.json | 14 ++-- packages/json-schema/package.json | 8 +- packages/next/package.json | 14 ++-- packages/path/package.json | 2 +- packages/react/package.json | 14 ++-- packages/reactive-react/package.json | 4 +- .../package.json | 6 +- packages/reactive-vue/package.json | 4 +- packages/reactive/package.json | 2 +- packages/shared/package.json | 4 +- packages/validator/package.json | 4 +- packages/vue/package.json | 14 ++-- 17 files changed, 66 insertions(+), 138 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c3743ff27f..215f601d0b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v2.0.0-rc.7(2021-09-15) + +### :beetle: Bug Fixes + +1. [fix(json-schema/reactive): fix circular reference check logic](https://github.com/alibaba/formily/commit/b356dad3) :point_right: ( [janrywang](https://github.com/janrywang) ) + ## v2.0.0-rc.6(2021-09-14) ### :beetle: Bug Fixes @@ -797,81 +803,3 @@ 1. [chore(workflow): update ci action](https://github.com/alibaba/formily/commit/d3dd91ca) :point_right: ( [janrywang](https://github.com/janrywang) ) 1. [chore(github): update pr template](https://github.com/alibaba/formily/commit/b3149307) :point_right: ( [janrywang](https://github.com/janrywang) ) - -## v2.0.0-beta.57(2021-05-27) - -### :tada: Enhancements - -1. [feat(json-schema): support definitions and #1147](https://github.com/alibaba/formily/commit/87339c70) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [feat(core): support more types for dataSource](https://github.com/alibaba/formily/commit/6715555e) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [feat(react): support x-component-props.children](https://github.com/alibaba/formily/commit/c8176380) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [feat(next): support form drawer get context from fusion (#1511)](https://github.com/alibaba/formily/commit/7fce306c) :point_right: ( [王大白](https://github.com/王大白) ) - -1. [feat(next): add fusion multiple lang of validator (#1504)](https://github.com/alibaba/formily/commit/2ca07e7a) :point_right: ( [王大白](https://github.com/王大白) ) - -1. [feat(antd): support defaultOpenPanelCount for ArrayCollapse (#1505)](https://github.com/alibaba/formily/commit/e9e3f74e) :point_right: ( [Lind](https://github.com/Lind) ) - -1. [feat(next): add stopPropagation to array-base events](https://github.com/alibaba/formily/commit/276a5fbb) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [feat(core): remove property of form values with undefined value (#1495)](https://github.com/alibaba/formily/commit/296eae47) :point_right: ( [小黄黄](https://github.com/小黄黄) ) - -### :beetle: Bug Fixes - -1. [fix(antd): fix ArrayCollapse items calculation](https://github.com/alibaba/formily/commit/1d10ac81) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [fix(react): fix ci](https://github.com/alibaba/formily/commit/9826425c) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [fix(core): remove @types/react peerDependencies](https://github.com/alibaba/formily/commit/2ad43225) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [fix(react): fix ReactComponentPropsByPathValue type return error result (#1507)](https://github.com/alibaba/formily/commit/fb7654eb) :point_right: ( [liuwei](https://github.com/liuwei) ) - -1. [fix(json-schema): fix single function x-reactions not work #1497](https://github.com/alibaba/formily/commit/ae5019df) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [fix(core): fix reactive query #1494](https://github.com/alibaba/formily/commit/a0ca5b2b) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [fix(validator): fix typo](https://github.com/alibaba/formily/commit/b1a83d2b) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [fix(path): fix realative path for sibling in array (#1492)](https://github.com/alibaba/formily/commit/860264d6) :point_right: ( [JustDs](https://github.com/JustDs) ) - -1. [fix(antd/next): fix FormItem typings (#1486)](https://github.com/alibaba/formily/commit/91b4b617) :point_right: ( [Nokecy](https://github.com/Nokecy) ) - -### :memo: Documents Changes - -1. [docs(readme): add download stats](https://github.com/alibaba/formily/commit/09ec8e52) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [docs(all): add inject global styles](https://github.com/alibaba/formily/commit/70852e91) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [docs(issue-helper): improve issue-helper](https://github.com/alibaba/formily/commit/e4d10d13) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [docs(guide): update issue helper](https://github.com/alibaba/formily/commit/76b58651) :point_right: ( [janrywang](https://github.com/janrywang) ) - -### :rose: Improve code quality - -1. [refactor(antd/next): rewrite PreviewText to JSXComponent (#1509)](https://github.com/alibaba/formily/commit/3f6c34d2) :point_right: ( [liuwei](https://github.com/liuwei) ) - -1. [refactor(json-schema): refactor stringify type to fix literal type is erased (#1508)](https://github.com/alibaba/formily/commit/43e79a61) :point_right: ( [liuwei](https://github.com/liuwei) ) - -### :blush: Other Changes - -1. [chore(dumi): update next css link](https://github.com/alibaba/formily/commit/6843d946) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(pkg): update lint-staged scripts](https://github.com/alibaba/formily/commit/ddd8fc9a) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(project): prettier all code and change style behavior](https://github.com/alibaba/formily/commit/3792c221) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(github): update git commit specific](https://github.com/alibaba/formily/commit/af58562c) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(scripts): remove mapCoverage.js](https://github.com/alibaba/formily/commit/3b3c3134) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(designable): add setters package](https://github.com/alibaba/formily/commit/d3bbca3b) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(workflow): Update check-pr-title.yml (#1490)](https://github.com/alibaba/formily/commit/9243908d) :point_right: ( [xrkffgg](https://github.com/xrkffgg) ) - -1. [chore(project): update pr template](https://github.com/alibaba/formily/commit/30d39dd1) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(workflow): add issue helper action](https://github.com/alibaba/formily/commit/e2d7c0ad) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(workflow): rename main.yml ==>commitlint.yml](https://github.com/alibaba/formily/commit/45734661) :point_right: ( [Janry](https://github.com/Janry) ) diff --git a/devtools/chrome-extension/package.json b/devtools/chrome-extension/package.json index d542011f7b0..830775cc729 100644 --- a/devtools/chrome-extension/package.json +++ b/devtools/chrome-extension/package.json @@ -1,6 +1,6 @@ { "name": "@formily/chrome-extension", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "private": true, "license": "MIT", "repository": { @@ -21,8 +21,8 @@ "start": "webpack-dev-server --config config/webpack.dev.ts" }, "dependencies": { - "@formily/core": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", + "@formily/core": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", "react": "^17.0.0", "react-dom": "^17.0.0", "react-json-view": "^1.19.1", diff --git a/lerna.json b/lerna.json index a0bc060351e..5b0c1f2d8d8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "npmClient": "yarn", "useWorkspaces": true, "npmClientArgs": ["--ignore-engines"], diff --git a/packages/antd/package.json b/packages/antd/package.json index bfd8f22a6af..824524b0c55 100644 --- a/packages/antd/package.json +++ b/packages/antd/package.json @@ -1,6 +1,6 @@ { "name": "@formily/antd", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -52,12 +52,12 @@ }, "dependencies": { "@ant-design/icons": "^4.0.0", - "@formily/core": "2.0.0-rc.7", - "@formily/json-schema": "2.0.0-rc.7", - "@formily/react": "2.0.0-rc.7", - "@formily/reactive": "2.0.0-rc.7", - "@formily/reactive-react": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", + "@formily/core": "2.0.0-rc.8", + "@formily/json-schema": "2.0.0-rc.8", + "@formily/react": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive-react": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", "@juggle/resize-observer": "^3.3.1", "classnames": "^2.2.6", "react-sortable-hoc": "^1.11.0", diff --git a/packages/core/package.json b/packages/core/package.json index 5b7e942135c..4c586d296cc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@formily/core", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -33,9 +33,9 @@ "dumi": "^1.1.0-rc.8" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", - "@formily/validator": "2.0.0-rc.7" + "@formily/reactive": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", + "@formily/validator": "2.0.0-rc.8" }, "publishConfig": { "access": "public" diff --git a/packages/element/package.json b/packages/element/package.json index 995fda5a4c4..cd20a04b58e 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@formily/element", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -46,12 +46,12 @@ "vuepress-plugin-typescript": "^0.3.1" }, "dependencies": { - "@formily/core": "2.0.0-rc.7", - "@formily/json-schema": "2.0.0-rc.7", - "@formily/reactive": "2.0.0-rc.7", - "@formily/reactive-vue": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", - "@formily/vue": "2.0.0-rc.7", + "@formily/core": "2.0.0-rc.8", + "@formily/json-schema": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive-vue": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", + "@formily/vue": "2.0.0-rc.8", "portal-vue": "^2.1.7", "vue-slicksort": "^1.2.0" }, diff --git a/packages/json-schema/package.json b/packages/json-schema/package.json index dc49ceb920c..daedde70e8e 100644 --- a/packages/json-schema/package.json +++ b/packages/json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@formily/json-schema", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -28,9 +28,9 @@ "build:global": "ts-node ../../scripts/build-global" }, "dependencies": { - "@formily/core": "2.0.0-rc.7", - "@formily/reactive": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7" + "@formily/core": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8" }, "publishConfig": { "access": "public" diff --git a/packages/next/package.json b/packages/next/package.json index 21869eb31a2..6c2ef76d4c1 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "@formily/next", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "umd:main": "dist/formily.next.umd.production.js", @@ -52,12 +52,12 @@ }, "dependencies": { "@ant-design/icons": "^4.0.0", - "@formily/core": "2.0.0-rc.7", - "@formily/json-schema": "2.0.0-rc.7", - "@formily/react": "2.0.0-rc.7", - "@formily/reactive": "2.0.0-rc.7", - "@formily/reactive-react": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", + "@formily/core": "2.0.0-rc.8", + "@formily/json-schema": "2.0.0-rc.8", + "@formily/react": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive-react": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", "@juggle/resize-observer": "^3.3.1", "classnames": "^2.2.6", "react-sortable-hoc": "^1.11.0", diff --git a/packages/path/package.json b/packages/path/package.json index 009ff77f935..28f6bab0281 100644 --- a/packages/path/package.json +++ b/packages/path/package.json @@ -1,6 +1,6 @@ { "name": "@formily/path", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", diff --git a/packages/react/package.json b/packages/react/package.json index 7fd2402cdb2..1d826d9250d 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@formily/react", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -40,12 +40,12 @@ "dumi": "^1.1.0-rc.8" }, "dependencies": { - "@formily/core": "2.0.0-rc.7", - "@formily/json-schema": "2.0.0-rc.7", - "@formily/reactive": "2.0.0-rc.7", - "@formily/reactive-react": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", - "@formily/validator": "2.0.0-rc.7", + "@formily/core": "2.0.0-rc.8", + "@formily/json-schema": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive-react": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", + "@formily/validator": "2.0.0-rc.8", "hoist-non-react-statics": "^3.3.2" }, "publishConfig": { diff --git a/packages/reactive-react/package.json b/packages/reactive-react/package.json index 8fbea1fefa3..591b2c254aa 100644 --- a/packages/reactive-react/package.json +++ b/packages/reactive-react/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive-react", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -39,7 +39,7 @@ "dumi": "^1.1.0-rc.8" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.7", + "@formily/reactive": "2.0.0-rc.8", "hoist-non-react-statics": "^3.3.2" }, "publishConfig": { diff --git a/packages/reactive-test-cases-for-react18/package.json b/packages/reactive-test-cases-for-react18/package.json index 465085644e0..6c13b2a28a8 100644 --- a/packages/reactive-test-cases-for-react18/package.json +++ b/packages/reactive-test-cases-for-react18/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive-test-cases-for-react18", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "private": true, "repository": { @@ -36,8 +36,8 @@ "react-is": "next" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.7", - "@formily/reactive-react": "2.0.0-rc.7", + "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive-react": "2.0.0-rc.8", "react": "next", "react-dom": "next", "react-is": "next" diff --git a/packages/reactive-vue/package.json b/packages/reactive-vue/package.json index 585e0740feb..6621382ddd6 100644 --- a/packages/reactive-vue/package.json +++ b/packages/reactive-vue/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive-vue", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -33,7 +33,7 @@ "vue": "^2.6.12" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.7", + "@formily/reactive": "2.0.0-rc.8", "vue-demi": "^0.9.0" }, "peerDependencies": { diff --git a/packages/reactive/package.json b/packages/reactive/package.json index a4e0adb3902..bd335ea9be5 100644 --- a/packages/reactive/package.json +++ b/packages/reactive/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", diff --git a/packages/shared/package.json b/packages/shared/package.json index 8b7d475ae7d..9311866136b 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@formily/shared", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -31,7 +31,7 @@ "build:umd": "rollup --config" }, "dependencies": { - "@formily/path": "2.0.0-rc.7", + "@formily/path": "2.0.0-rc.8", "camel-case": "^4.1.1", "lower-case": "^2.0.1", "no-case": "^3.0.4", diff --git a/packages/validator/package.json b/packages/validator/package.json index ffe4e7844ea..9e156210d99 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -1,6 +1,6 @@ { "name": "@formily/validator", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -27,7 +27,7 @@ "build:umd": "rollup --config" }, "dependencies": { - "@formily/shared": "2.0.0-rc.7" + "@formily/shared": "2.0.0-rc.8" }, "publishConfig": { "access": "public" diff --git a/packages/vue/package.json b/packages/vue/package.json index fd75baa204e..ae908688939 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@formily/vue", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "license": "MIT", "main": "lib", "module": "esm", @@ -36,12 +36,12 @@ "vuepress-plugin-typescript": "^0.3.1" }, "dependencies": { - "@formily/core": "2.0.0-rc.7", - "@formily/json-schema": "2.0.0-rc.7", - "@formily/reactive": "2.0.0-rc.7", - "@formily/reactive-vue": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7", - "@formily/validator": "2.0.0-rc.7", + "@formily/core": "2.0.0-rc.8", + "@formily/json-schema": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive-vue": "2.0.0-rc.8", + "@formily/shared": "2.0.0-rc.8", + "@formily/validator": "2.0.0-rc.8", "@type-helper/vue2": "npm:vue@2", "@type-helper/vue3": "npm:vue@3", "vue-demi": "^0.9.0", From 205e164ca552637226243f7279797a5e5ecbd8a9 Mon Sep 17 00:00:00 2001 From: Muyao Date: Fri, 17 Sep 2021 20:55:35 +0800 Subject: [PATCH 05/33] feat(element): support element-ui slot (#2162) --- .../shared/get-component-by-tag.ts | 55 ---------------- .../element/src/__builtins__/shared/index.ts | 2 +- .../__builtins__/shared/resolve-component.ts | 21 +++--- .../shared/transform-component.ts | 65 +++++++++++++++++++ .../element/src/__builtins__/shared/utils.ts | 10 +++ packages/element/src/checkbox/index.ts | 4 +- packages/element/src/date-picker/index.ts | 11 ++-- packages/element/src/input-number/index.ts | 4 +- packages/element/src/input/index.ts | 4 +- packages/element/src/radio/index.ts | 4 +- packages/element/src/select/index.ts | 32 +++++++-- packages/element/src/time-picker/index.ts | 11 ++-- yarn.lock | 5 ++ 13 files changed, 139 insertions(+), 89 deletions(-) delete mode 100644 packages/element/src/__builtins__/shared/get-component-by-tag.ts create mode 100644 packages/element/src/__builtins__/shared/transform-component.ts diff --git a/packages/element/src/__builtins__/shared/get-component-by-tag.ts b/packages/element/src/__builtins__/shared/get-component-by-tag.ts deleted file mode 100644 index cb3b2f50de4..00000000000 --- a/packages/element/src/__builtins__/shared/get-component-by-tag.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { Component } from 'vue' -import { merge } from '@formily/shared' -import { h } from '@formily/vue' -import { isVue2 } from 'vue-demi' - -type ListenersTransformRules = Record - -export const getComponentByTag = >( - tag: any, - transformRules?: ListenersTransformRules, - defaultProps?: Partial -): Component | any => { - if (isVue2) { - return { - functional: true, - render(h, context) { - const data = context.data - if (transformRules) { - const listeners = transformRules - Object.keys(listeners).forEach((extract) => { - if (data.on !== undefined) { - data.on[listeners[extract]] = context.listeners[extract] - } - }) - } - if (defaultProps) { - data.props = merge(defaultProps, data.props) - } - return h(tag, data, context.children) - }, - } - } else { - return { - setup(props, { attrs, slots }) { - return () => { - let data = { - ...attrs, - } - if (transformRules) { - const listeners = transformRules - Object.keys(listeners).forEach((extract) => { - const event = listeners[extract] - data[`on${event[0].toUpperCase()}${event.slice(1)}`] = - attrs[`on${extract[0].toUpperCase()}${extract.slice(1)}`] - }) - } - if (defaultProps) { - data = merge(defaultProps, data) - } - return h(tag, attrs, slots) - } - }, - } - } -} diff --git a/packages/element/src/__builtins__/shared/index.ts b/packages/element/src/__builtins__/shared/index.ts index d7b9d7e4ddd..25aee28cd35 100644 --- a/packages/element/src/__builtins__/shared/index.ts +++ b/packages/element/src/__builtins__/shared/index.ts @@ -1,4 +1,4 @@ -export * from './get-component-by-tag' +export * from './transform-component' export * from './resolve-component' export * from './create-context' export * from './utils' diff --git a/packages/element/src/__builtins__/shared/resolve-component.ts b/packages/element/src/__builtins__/shared/resolve-component.ts index 9eec7b3b0b4..b9ff6615582 100644 --- a/packages/element/src/__builtins__/shared/resolve-component.ts +++ b/packages/element/src/__builtins__/shared/resolve-component.ts @@ -1,26 +1,21 @@ +import { Component } from 'vue' import { h, toRaw } from '@vue/composition-api' -import { Component, VNode } from 'vue' +import { SlotTypes } from '.' +import { isVnode } from './utils' export const resolveComponent = ( - child?: - | Component - | string - | number - | boolean - | ((...args: any[]) => VNode[] | VNode), + child?: SlotTypes, props?: Record ) => { if (child) { - if ( - typeof child === 'string' || - typeof child === 'number' || - typeof child === 'boolean' - ) { + if (typeof child === 'string' || typeof child === 'number') { return child } else if (typeof child === 'function') { return (child as Function)(props) + } else if (isVnode(child)) { + return child } else { - return h(toRaw(child), { props }) + return h(toRaw(child as Component), { props }) } } diff --git a/packages/element/src/__builtins__/shared/transform-component.ts b/packages/element/src/__builtins__/shared/transform-component.ts new file mode 100644 index 00000000000..4c8af267117 --- /dev/null +++ b/packages/element/src/__builtins__/shared/transform-component.ts @@ -0,0 +1,65 @@ +import type { Component } from 'vue' +import { merge } from '@formily/shared' +import { h } from '@formily/vue' +import { isVue2, h as hInVue2, defineComponent } from 'vue-demi' + +type ListenersTransformRules = Record + +export const transformComponent = >( + tag: any, + transformRules?: ListenersTransformRules, + defaultProps?: Partial +): Component | any => { + if (isVue2) { + return defineComponent({ + setup(props, { attrs, slots, listeners }) { + return () => { + const data = { + attrs: { + ...attrs, + }, + on: { + ...listeners, + }, + } + + if (transformRules) { + const transformListeners = transformRules + Object.keys(transformListeners).forEach((extract) => { + if (data.on !== undefined) { + data.on[transformListeners[extract]] = listeners[extract] + } + }) + } + if (defaultProps) { + data.attrs = merge(defaultProps, data.attrs) + } + + return h(tag, data, slots) + } + }, + }) + } else { + return defineComponent({ + setup(props, { attrs, slots }) { + return () => { + let data = { + ...attrs, + } + if (transformRules) { + const listeners = transformRules + Object.keys(listeners).forEach((extract) => { + const event = listeners[extract] + data[`on${event[0].toUpperCase()}${event.slice(1)}`] = + attrs[`on${extract[0].toUpperCase()}${extract.slice(1)}`] + }) + } + if (defaultProps) { + data = merge(defaultProps, data) + } + return h(tag, data, slots) + } + }, + }) + } +} diff --git a/packages/element/src/__builtins__/shared/utils.ts b/packages/element/src/__builtins__/shared/utils.ts index 3d2fc2d205a..e98703446ca 100644 --- a/packages/element/src/__builtins__/shared/utils.ts +++ b/packages/element/src/__builtins__/shared/utils.ts @@ -9,6 +9,16 @@ export function isValidElement(element) { ) // remove text node } +export function isVnode(element: any): boolean { + return ( + element && + typeof element === 'object' && + 'componentOptions' in element && + 'context' in element && + element.tag !== undefined + ) +} + export function isVueOptions(options) { return ( options && diff --git a/packages/element/src/checkbox/index.ts b/packages/element/src/checkbox/index.ts index da22fa269de..d0144701f7e 100644 --- a/packages/element/src/checkbox/index.ts +++ b/packages/element/src/checkbox/index.ts @@ -2,7 +2,7 @@ import { connect, mapProps, h, mapReadPretty } from '@formily/vue' import { defineComponent, PropType } from '@vue/composition-api' import { composeExport, - getComponentByTag, + transformComponent, resolveComponent, SlotTypes, } from '../__builtins__/shared' @@ -83,7 +83,7 @@ export type CheckboxGroupProps = ElCheckboxGroupProps & { optionType: 'default' | 'button' } -const TransformElCheckboxGroup = getComponentByTag(ElCheckboxGroup, { +const TransformElCheckboxGroup = transformComponent(ElCheckboxGroup, { change: 'input', }) diff --git a/packages/element/src/date-picker/index.ts b/packages/element/src/date-picker/index.ts index cd5a705e52c..eaab986b073 100644 --- a/packages/element/src/date-picker/index.ts +++ b/packages/element/src/date-picker/index.ts @@ -1,4 +1,4 @@ -import { getComponentByTag } from '../__builtins__/shared' +import { transformComponent } from '../__builtins__/shared' import { connect, mapProps, mapReadPretty } from '@formily/vue' import type { DatePicker as ElDatePickerProps } from 'element-ui' @@ -7,9 +7,12 @@ import { PreviewText } from '../preview-text' export type DatePickerProps = ElDatePickerProps -const TransformElDatePicker = getComponentByTag(ElDatePicker, { - change: 'input', -}) +const TransformElDatePicker = transformComponent( + ElDatePicker, + { + change: 'input', + } +) const getDefaultFormat = (props, formatType = 'format') => { const type = props.type diff --git a/packages/element/src/input-number/index.ts b/packages/element/src/input-number/index.ts index 5683acf3154..fb4c325e2bd 100644 --- a/packages/element/src/input-number/index.ts +++ b/packages/element/src/input-number/index.ts @@ -1,4 +1,4 @@ -import { getComponentByTag } from '../__builtins__/shared' +import { transformComponent } from '../__builtins__/shared' import { connect, mapProps, mapReadPretty } from '@formily/vue' import type { InputNumber as _ElInputNumberProps } from 'element-ui' @@ -7,7 +7,7 @@ import { PreviewText } from '../preview-text' export type InputNumberProps = _ElInputNumberProps -const TransformElInputNumber = getComponentByTag( +const TransformElInputNumber = transformComponent( ElInputNumber, { change: 'input', diff --git a/packages/element/src/input/index.ts b/packages/element/src/input/index.ts index 2407aa4422c..2c5c07b1767 100644 --- a/packages/element/src/input/index.ts +++ b/packages/element/src/input/index.ts @@ -1,4 +1,4 @@ -import { composeExport, getComponentByTag } from '../__builtins__/shared' +import { composeExport, transformComponent } from '../__builtins__/shared' import { connect, mapProps, mapReadPretty } from '@formily/vue' import { PreviewText } from '../preview-text' import type { Input as ElInputProps } from 'element-ui' @@ -6,7 +6,7 @@ import { Input as ElInput } from 'element-ui' export type InputProps = ElInputProps -const TransformElInput = getComponentByTag(ElInput, { +const TransformElInput = transformComponent(ElInput, { change: 'input', }) diff --git a/packages/element/src/radio/index.ts b/packages/element/src/radio/index.ts index fcf498ca2e2..384ffbfb639 100644 --- a/packages/element/src/radio/index.ts +++ b/packages/element/src/radio/index.ts @@ -2,7 +2,7 @@ import { connect, mapProps, h, mapReadPretty } from '@formily/vue' import { defineComponent, PropType } from '@vue/composition-api' import { composeExport, - getComponentByTag, + transformComponent, resolveComponent, SlotTypes, } from '../__builtins__/shared' @@ -31,7 +31,7 @@ export type RadioGroupProps = ElRadioGroupProps & { export type RadioProps = ElRadioProps -const TransformElRadioGroup = getComponentByTag(ElRadioGroup, { +const TransformElRadioGroup = transformComponent(ElRadioGroup, { change: 'input', }) diff --git a/packages/element/src/select/index.ts b/packages/element/src/select/index.ts index 53d08efbb53..b2d4f778bd3 100644 --- a/packages/element/src/select/index.ts +++ b/packages/element/src/select/index.ts @@ -7,9 +7,14 @@ import type { Option as ElOptionProps, } from 'element-ui' import { Select as ElSelect, Option as ElOption } from 'element-ui' +import { resolveComponent, SlotTypes } from '../__builtins__' export type SelectProps = ElSelectProps & { - options?: Array + options?: Array< + Omit & { + label: SlotTypes + } + > } const SelectOption = defineComponent({ @@ -26,11 +31,30 @@ const SelectOption = defineComponent({ if (typeof option === 'string') { return h( ElOption, - { props: { label: option, value: option } }, - {} + { props: { value: option } }, + { + default: () => [ + resolveComponent(slots?.option ?? option, { option }), + ], + } ) } else { - return h(ElOption, { props: option }, {}) + return h( + ElOption, + { + props: { + ...option, + label: '', + }, + }, + { + default: () => [ + resolveComponent(slots?.option ?? option.label, { + option, + }), + ], + } + ) } }), } diff --git a/packages/element/src/time-picker/index.ts b/packages/element/src/time-picker/index.ts index 4a74f655e17..cc40bdc0a26 100644 --- a/packages/element/src/time-picker/index.ts +++ b/packages/element/src/time-picker/index.ts @@ -1,4 +1,4 @@ -import { getComponentByTag } from '../__builtins__/shared' +import { transformComponent } from '../__builtins__/shared' import { connect, mapProps, mapReadPretty } from '@formily/vue' import { PreviewText } from '../preview-text' import type { TimePicker as ElTimePickerProps } from 'element-ui' @@ -6,9 +6,12 @@ import { TimePicker as ElTimePicker } from 'element-ui' export type TimePickerProps = ElTimePickerProps -const TransformElTimePicker = getComponentByTag(ElTimePicker, { - change: 'input', -}) +const TransformElTimePicker = transformComponent( + ElTimePicker, + { + change: 'input', + } +) export const TimePicker = connect( TransformElTimePicker, diff --git a/yarn.lock b/yarn.lock index ad143ff149f..5b1d40af2b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19619,6 +19619,11 @@ vue-frag@^1.1.4: resolved "https://registry.yarnpkg.com/vue-frag/-/vue-frag-1.1.5.tgz#1158f92361dff2c312e00b8ca85334c329e566e7" integrity sha512-g+PP9pjW1gnrmPjy2Sa5jK/bfxYHK8Hgt1sVs/Y/7KT+srGJUwtGNwXNTUvWv/zJ2yGcvJVEH98eIrICyZX9Ng== +vue-hoc@^0.4.7: + version "0.4.7" + resolved "https://registry.nlark.com/vue-hoc/download/vue-hoc-0.4.7.tgz#4d3322ba89b8b0e42b19045ef536c21d948a4fac" + integrity sha1-TTMiuom4sOQrGQRe9TbCHZSKT6w= + vue-hot-reload-api@^2.3.0: version "2.3.4" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2" From 3fbb86974a371c8a16706dd5028a077d71cafb3f Mon Sep 17 00:00:00 2001 From: janrywang Date: Sat, 18 Sep 2021 20:22:43 +0800 Subject: [PATCH 06/33] fix(core): fix assign initialValue will overwrite value --- packages/core/src/__tests__/array.spec.ts | 2 +- packages/core/src/__tests__/field.spec.ts | 66 +++++++++- packages/core/src/__tests__/form.spec.ts | 7 +- packages/core/src/__tests__/graph.spec.ts | 2 +- packages/core/src/models/Field.ts | 66 ++++++---- packages/core/src/models/Form.ts | 46 ++----- packages/core/src/models/VoidField.ts | 36 +++--- packages/core/src/shared/constants.ts | 1 - packages/core/src/shared/internals.ts | 144 +++++++++------------- packages/reactive/src/handlers.ts | 3 +- 10 files changed, 198 insertions(+), 175 deletions(-) diff --git a/packages/core/src/__tests__/array.spec.ts b/packages/core/src/__tests__/array.spec.ts index 3635d69a2cf..e7582a27a74 100644 --- a/packages/core/src/__tests__/array.spec.ts +++ b/packages/core/src/__tests__/array.spec.ts @@ -391,7 +391,7 @@ test('array field remove memo leak', async () => { basePath: 'array', }) ) - expect(handler).toBeCalledTimes(1) + expect(handler).toBeCalledTimes(0) expect(valuesChange).toBeCalledTimes(4) }) diff --git a/packages/core/src/__tests__/field.spec.ts b/packages/core/src/__tests__/field.spec.ts index dd86180d8d9..dceb1d7142a 100644 --- a/packages/core/src/__tests__/field.spec.ts +++ b/packages/core/src/__tests__/field.spec.ts @@ -330,6 +330,35 @@ test('setDecorator/setDecoratorProps', () => { expect(field.decorator[1]).toEqual({ props: 123, hello: 'world' }) }) +test('reaction initialValue', () => { + const form = attach( + createForm({ + values: { + aa: 123, + }, + }) + ) + const aa = attach( + form.createField({ + name: 'aa', + reactions(field) { + field.initialValue = 321 + }, + }) + ) + const bb = attach( + form.createField({ + name: 'bb', + value: 123, + reactions(field) { + field.initialValue = 321 + }, + }) + ) + expect(aa.value).toEqual(123) + expect(bb.value).toEqual(123) +}) + test('selfValidate/errors/warnings/successes/valid/invalid/validateStatus/queryFeedbacks', async () => { const form = attach(createForm()) const field = attach( @@ -425,20 +454,20 @@ test('selfValidate/errors/warnings/successes/valid/invalid/validateStatus/queryF expect(field.selfErrors).toEqual(['error']) await field.onBlur() expect(field.selfErrors).toEqual([ - 'The field value is a invalid url', 'error', + 'The field value is a invalid url', ]) await field.onFocus() expect(field.selfErrors).toEqual([ + 'error', 'The field value is a invalid url', 'The field value is not a valid date format', - 'error', ]) field.setFeedback() expect(field.selfErrors).toEqual([ + 'error', 'The field value is a invalid url', 'The field value is not a valid date format', - 'error', ]) expect(field3.feedbacks).toEqual([]) field3.setFeedback() @@ -1494,3 +1523,34 @@ test('field submit', async () => { } expect(onSubmit).toBeCalledTimes(0) }) + +test('initial display with value', () => { + const form = attach(createForm()) + const aa = attach( + form.createField({ + name: 'aa', + value: 123, + visible: false, + }) + ) + const bb = attach( + form.createField({ + name: 'bb', + value: 123, + visible: true, + }) + ) + const cc = attach( + form.createField({ + name: 'cc', + value: 123, + hidden: true, + }) + ) + expect(aa.value).toBeUndefined() + expect(aa.visible).toBeFalsy() + expect(bb.value).toEqual(123) + expect(bb.visible).toBeTruthy() + expect(cc.value).toEqual(123) + expect(cc.hidden).toBeTruthy() +}) diff --git a/packages/core/src/__tests__/form.spec.ts b/packages/core/src/__tests__/form.spec.ts index 5a0aa89bc66..afd16fd87cf 100644 --- a/packages/core/src/__tests__/form.spec.ts +++ b/packages/core/src/__tests__/form.spec.ts @@ -315,7 +315,7 @@ test('query', () => { expect(form.query('object.void').get('initialValue')).toBeUndefined() expect(form.query('object.void').get('inputValue')).toBeUndefined() expect(form.query('array').get('value')).toEqual([]) - expect(form.query('array').get('initialValue')).toBeUndefined() + expect(form.query('array').get('initialValue')).toEqual([]) expect(form.query('array').get('inputValue')).toBeNull() form.setFieldState('array', (state) => { state.value = [111] @@ -975,7 +975,6 @@ test('initialValues merge values before create field', () => { name: 'array', }) ) - form.values.array = [{ aa: '321' }] const arr_0_aa = attach( form.createField({ @@ -1062,8 +1061,8 @@ test('empty array initialValues', () => { expect(form.values.aa).toEqual([0]) expect(form.values.bb).toEqual(['']) expect(form.values.cc).toEqual([]) - expect(form.values.dd).toEqual([]) - expect(form.values.ee).toEqual([]) + expect(form.values.dd).toEqual([null]) + expect(form.values.ee).toEqual([undefined]) }) test('form lifecycle can be triggered after call form.setXXX', () => { diff --git a/packages/core/src/__tests__/graph.spec.ts b/packages/core/src/__tests__/graph.spec.ts index 322e021417b..c32937704ee 100644 --- a/packages/core/src/__tests__/graph.spec.ts +++ b/packages/core/src/__tests__/graph.spec.ts @@ -26,7 +26,7 @@ test('getGraph/setGraph', () => { ) form.query('normal').take((field) => { if (isVoidField(field)) return - field.errors = ['error'] + field.selfErrors = ['error'] }) const graph = form.getFormGraph() form.clearFormGraph() diff --git a/packages/core/src/models/Field.ts b/packages/core/src/models/Field.ts index 23443e89b59..699d439ee06 100644 --- a/packages/core/src/models/Field.ts +++ b/packages/core/src/models/Field.ts @@ -45,12 +45,12 @@ import { initFieldUpdate, updateFeedback, queryFeedbacks, + allowAssignDefaultValue, queryFeedbackMessages, getValuesFromEvent, modelStateSetter, modelStateGetter, isHTMLInputEvent, - initFieldValue, setValidatorRule, batchValidate, batchSubmit, @@ -59,6 +59,7 @@ import { setSubmitting, setLoading, selfValidate, + getValidFieldDefaultValue, } from '../shared/internals' import { Query } from './Query' export class Field< @@ -96,6 +97,7 @@ export class Field< path: FormPath form: Form + designable: boolean props: IFieldProps caches: IFieldCaches = {} @@ -108,23 +110,22 @@ export class Field< form: Form, designable: boolean ) { - this.initialize(props, form) + this.form = form + this.props = props + this.designable = designable this.makeIndexes(address) - this.makeObservable(designable) - this.makeReactive(designable) - this.onInit(designable) + this.initialize() + this.makeObservable() + this.makeReactive() + this.onInit() } protected makeIndexes(address: FormPathPattern) { + this.form.fields[address.toString()] = this buildNodeIndexes(this, address) } - protected initialize( - props: IFieldProps, - form: Form - ) { - this.form = form - this.props = props + protected initialize() { this.initialized = false this.loading = false this.validating = false @@ -137,8 +138,8 @@ export class Field< this.inputValues = [] this.inputValue = null this.feedbacks = [] - this.title = props.title - this.description = props.description + this.title = this.props.title + this.description = this.props.description this.display = this.props.display this.pattern = this.props.pattern this.editable = this.props.editable @@ -151,13 +152,18 @@ export class Field< this.validator = this.props.validator this.required = this.props.required this.content = this.props.content + this.value = getValidFieldDefaultValue( + this.props.value, + this.props.initialValue + ) + this.initialValue = this.props.initialValue this.data = this.props.data this.decorator = toArr(this.props.decorator) this.component = toArr(this.props.component) } - protected makeObservable(designable: boolean) { - if (designable) return + protected makeObservable() { + if (this.designable) return define(this, { title: observable.ref, description: observable.ref, @@ -237,8 +243,8 @@ export class Field< }) } - protected makeReactive(designable: boolean) { - if (designable) return + protected makeReactive() { + if (this.designable) return this.disposers.push( reaction( () => this.value, @@ -516,10 +522,27 @@ export class Field< } set value(value: ValueType) { + if (!this.initialized) { + if (this.display === 'none') { + this.caches.value = value + return + } + if (!allowAssignDefaultValue(this.value, value) && !this.designable) { + return + } + } this.form.setValuesIn(this.path, value) } set initialValue(initialValue: ValueType) { + if (!this.initialized) { + if ( + !allowAssignDefaultValue(this.initialValue, initialValue) && + !this.designable + ) { + return + } + } this.form.setInitialValuesIn(this.path, initialValue) } @@ -663,14 +686,9 @@ export class Field< getState: IModelGetter = modelStateGetter(this) - onInit = (designable: boolean) => { + onInit = () => { this.initialized = true - batch.scope(() => { - initFieldValue(this, designable) - }) - batch.scope(() => { - initFieldUpdate(this) - }) + initFieldUpdate(this) this.notify(LifeCycleTypes.ON_FIELD_INIT) } diff --git a/packages/core/src/models/Form.ts b/packages/core/src/models/Form.ts index 4c3a1906428..5036cce6bb1 100644 --- a/packages/core/src/models/Form.ts +++ b/packages/core/src/models/Form.ts @@ -1,11 +1,4 @@ -import { - define, - observable, - batch, - action, - isObservable, - observe, -} from '@formily/reactive' +import { define, observable, batch, action, observe } from '@formily/reactive' import { FormPath, FormPathPattern, @@ -13,7 +6,6 @@ import { uid, globalThisPolyfill, merge, - clone, isPlainObj, isArr, isObj, @@ -47,7 +39,6 @@ import { modelStateSetter, createFieldStateSetter, createFieldStateGetter, - applyValuesPatch, triggerFormInitialValuesChange, triggerFormValuesChange, batchValidate, @@ -56,6 +47,7 @@ import { setValidating, setSubmitting, setLoading, + getValidFormValues, } from '../shared/internals' import { isVoidField } from '../shared/checkers' import { runEffects } from '../shared/effectbox' @@ -91,9 +83,9 @@ export class Form { constructor(props: IFormProps) { this.initialize(props) - this.makeInitialValues() this.makeObservable() this.makeReactive() + this.makeValues() this.onInit() } @@ -122,14 +114,9 @@ export class Form { }) } - protected makeInitialValues() { - this.values = isObservable(this.props.values) - ? this.props.values - : clone(this.props.values) || ({} as any) - this.initialValues = isObservable(this.props.initialValues) - ? this.props.initialValues - : clone(this.props.initialValues) || ({} as any) - applyValuesPatch(this, [], this.initialValues) + protected makeValues() { + this.values = getValidFormValues(this.props.values) + this.initialValues = getValidFormValues(this.props.initialValues) } protected makeObservable() { @@ -180,7 +167,6 @@ export class Form { } protected makeReactive() { - if (this.props.designable) return this.disposers.push( observe( this, @@ -314,12 +300,7 @@ export class Form { if (!identifier) return if (!this.fields[identifier] || this.props.designable) { batch(() => { - this.fields[identifier] = new Field( - address, - props, - this, - this.props.designable - ) + new Field(address, props, this, this.props.designable) }) this.notify(LifeCycleTypes.ON_FORM_GRAPH_CHANGE) } @@ -337,11 +318,12 @@ export class Form { if (!identifier) return if (!this.fields[identifier] || this.props.designable) { batch(() => { - this.fields[identifier] = new ArrayField( + new ArrayField( address, { ...props, value: isArr(props.value) ? props.value : [], + initialValue: isObj(props.initialValue) ? props.initialValue : [], }, this, this.props.designable @@ -363,11 +345,12 @@ export class Form { if (!identifier) return if (!this.fields[identifier] || this.props.designable) { batch(() => { - this.fields[identifier] = new ObjectField( + new ObjectField( address, { ...props, value: isObj(props.value) ? props.value : {}, + initialValue: isObj(props.initialValue) ? props.initialValue : {}, }, this, this.props.designable @@ -389,12 +372,7 @@ export class Form { if (!identifier) return if (!this.fields[identifier] || this.props.designable) { batch(() => { - this.fields[identifier] = new VoidField( - address, - props, - this, - this.props.designable - ) + new VoidField(address, props, this, this.props.designable) }) this.notify(LifeCycleTypes.ON_FORM_GRAPH_CHANGE) } diff --git a/packages/core/src/models/VoidField.ts b/packages/core/src/models/VoidField.ts index b5a58c04dc9..cbcf54c490a 100644 --- a/packages/core/src/models/VoidField.ts +++ b/packages/core/src/models/VoidField.ts @@ -49,6 +49,7 @@ export class VoidField { componentType: Component componentProps: Record + designable: boolean address: FormPath path: FormPath form: Form @@ -62,30 +63,29 @@ export class VoidField { form: Form, designable: boolean ) { - this.initialize(props, form) + this.form = form + this.props = props + this.designable = designable this.makeIndexes(address) - this.makeObservable(designable) - this.makeReactive(designable) + this.initialize() + this.makeObservable() + this.makeReactive() this.onInit() } protected makeIndexes(address: FormPathPattern) { + this.form.fields[address.toString()] = this buildNodeIndexes(this, address) } - protected initialize( - props: IVoidFieldProps, - form: Form - ) { - this.form = form - this.props = props + protected initialize() { this.mounted = false this.unmounted = false this.initialized = false - this.title = props.title - this.description = props.description + this.title = this.props.title + this.description = this.props.description this.pattern = this.props.pattern - this.display = props.display + this.display = this.props.display this.hidden = this.props.hidden this.editable = this.props.editable this.disabled = this.props.disabled @@ -98,8 +98,8 @@ export class VoidField { this.component = toArr(this.props.component) } - protected makeObservable(designable: boolean) { - if (designable) return + protected makeObservable() { + if (this.designable) return define(this, { title: observable.ref, description: observable.ref, @@ -138,8 +138,8 @@ export class VoidField { }) } - protected makeReactive(designable: boolean) { - if (designable) return + protected makeReactive() { + if (this.designable) return this.form.addEffects(this, () => { toArr(this.props.reactions).forEach((reaction) => { if (isFn(reaction)) { @@ -349,9 +349,7 @@ export class VoidField { onInit = () => { this.initialized = true - batch.scope(() => { - initFieldUpdate(this) - }) + initFieldUpdate(this) this.notify(LifeCycleTypes.ON_FIELD_INIT) } diff --git a/packages/core/src/shared/constants.ts b/packages/core/src/shared/constants.ts index ad96672164b..3152cd7f4a1 100644 --- a/packages/core/src/shared/constants.ts +++ b/packages/core/src/shared/constants.ts @@ -20,7 +20,6 @@ export const ReservedProperties = new Set([ export const RESPONSE_REQUEST_DURATION = 100 export const GlobalState = { - initializing: false, lifecycles: [], context: [], effectStart: false, diff --git a/packages/core/src/shared/internals.ts b/packages/core/src/shared/internals.ts index fcf6ad4d1e7..44fc838daf9 100644 --- a/packages/core/src/shared/internals.ts +++ b/packages/core/src/shared/internals.ts @@ -8,18 +8,15 @@ import { isEmpty, isArr, isPlainObj, - toArr, isNumberLike, - shallowClone, clone, - isEqual, } from '@formily/shared' import { ValidatorTriggerType, validate, parseValidatorDescriptions, } from '@formily/validator' -import { batch, toJS, DataChange } from '@formily/reactive' +import { batch, toJS, isObservable, DataChange } from '@formily/reactive' import { Field, ArrayField, Form, ObjectField } from '../models' import { ISpliceArrayStateProps, @@ -44,7 +41,6 @@ import { import { RESPONSE_REQUEST_DURATION, ReservedProperties, - GlobalState, NumberIndexReg, } from './constants' @@ -158,6 +154,7 @@ export const matchFeedback = ( export const queryFeedbacks = (field: Field, search?: ISearchFeedback) => { return field.feedbacks.filter((feedback) => { + if (!feedback.messages?.length) return false return matchFeedback(search, { ...feedback, address: field.address?.toString(), @@ -189,9 +186,8 @@ export const updateFeedback = (field: Field, feedback?: IFieldFeedback) => { if (searched.length) { field.feedbacks = field.feedbacks.reduce((buf, item) => { if (searched.includes(item)) { - const messages = toArr(feedback.messages) - if (messages?.length) { - item.messages = messages + if (feedback.messages?.length) { + item.messages = feedback.messages return buf.concat(item) } else { return buf @@ -201,8 +197,9 @@ export const updateFeedback = (field: Field, feedback?: IFieldFeedback) => { } }, []) return + } else if (feedback.messages?.length) { + field.feedbacks = field.feedbacks.concat(feedback) } - field.feedbacks = field.feedbacks.concat(feedback) } }) } @@ -487,64 +484,7 @@ export const cleanupObjectChildren = (field: ObjectField, keys: string[]) => { }) } -export const initFieldValue = (field: Field, designable: boolean) => { - GlobalState.initializing = true - if (designable) { - if (isValid(field.props.initialValue)) { - field.initialValue = shallowClone(field.props.initialValue) - } - if (isValid(field.props.value)) { - field.value = field.props.value - } - } else { - const fromValue = (value: any) => [ - isValid(value), - isEmpty(value, true), - value, - ] - const [, isEmptySelfValue, selfValue] = fromValue(field.value) - const [, isEmptySelfInitialValue, selfInitialValue] = fromValue( - field.initialValue - ) - const [isValidPropsValue, isEmptyPropsValue, propsValue] = fromValue( - field.props.value - ) - const [ - isValidPropsInitialValue, - isEmptyPropsInitialValue, - propsInitialValue, - ] = fromValue(field.props.initialValue) - if (isEmptySelfInitialValue) { - if (isEmptyPropsInitialValue) { - if (!isEqual(selfInitialValue, propsInitialValue)) { - field.initialValue = shallowClone(propsInitialValue) - } - } else if (isValidPropsInitialValue) { - field.initialValue = shallowClone(propsInitialValue) - } - } - if (isEmptySelfValue) { - if (!isEmptyPropsValue) { - field.value = shallowClone(propsValue) - } else { - if (!isEmptyPropsInitialValue) { - field.value = shallowClone(propsInitialValue) - } else if (isValidPropsValue) { - if (!isEqual(selfValue, propsValue)) { - field.value = shallowClone(propsValue) - } - } else if (isValidPropsInitialValue) { - if (!isEqual(selfValue, propsInitialValue)) { - field.value = shallowClone(propsInitialValue) - } - } - } - } - } - GlobalState.initializing = false -} - -export const initFieldUpdate = (field: GeneralField) => { +export const initFieldUpdate = batch.scope.bound((field: GeneralField) => { const form = field.form const updates = FormPath.ensureIn(form, 'requests.updates', []) const indexes = FormPath.ensureIn(form, 'requests.updateIndexes', {}) @@ -566,7 +506,7 @@ export const initFieldUpdate = (field: GeneralField) => { delete indexes[pattern.toString()] } } -} +}) export const subscribeUpdate = ( form: Form, @@ -723,22 +663,20 @@ export const applyValuesPatch = ( const patch = (source: any, path: Array = []) => { const targetValue = form.getValuesIn(path) const targetField = form.query(path).take() - if (isEmpty(targetValue)) { - if (isEmpty(source)) return + if (allowAssignDefaultValue(targetValue, source)) { update(path, source) } else { - const arrA = isArr(targetValue) - const arrB = isArr(source) - const objA = isPlainObj(targetValue) - const objB = isPlainObj(source) - if ((arrA && arrA === arrB) || (objA && objA === objB)) { + if (isPlainObj(targetValue) && isPlainObj(source)) { each(source, (value, key) => { - if (isEmpty(value)) return patch(value, path.concat(key)) }) } else { if (targetField) { - if (!isVoidField(targetField) && !targetField.modified) { + if ( + !isVoidField(targetField) && + targetField.initialized && + !targetField.modified + ) { update(path, source) } } else { @@ -747,7 +685,6 @@ export const applyValuesPatch = ( } } } - if (GlobalState.initializing) return patch(source, path) } @@ -761,25 +698,20 @@ export const triggerFormInitialValuesChange = ( if (change.type === 'add' || change.type === 'set') { applyValuesPatch(form, path.slice(1), change.value) } - form.notify(LifeCycleTypes.ON_FORM_INITIAL_VALUES_CHANGE) + if (form.initialized) { + form.notify(LifeCycleTypes.ON_FORM_INITIAL_VALUES_CHANGE) + } } } export const triggerFormValuesChange = (form: Form, change: DataChange) => { const path = change.path if (path[path.length - 1] === 'length') return - if (path[0] === 'values') { + if (path[0] === 'values' && form.initialized) { form.notify(LifeCycleTypes.ON_FORM_VALUES_CHANGE) } } -const getValues = (target: Form | Field) => { - if (isForm(target)) { - return toJS(target.values) - } - return toJS(target.value) -} - const notify = ( target: Form | Field, formType: LifeCycleTypes, @@ -874,6 +806,12 @@ export const batchSubmit = async ( target: Form | Field, onSubmit?: (values: any) => Promise | void ): Promise => { + const getValues = (target: Form | Field) => { + if (isForm(target)) { + return toJS(target.values) + } + return toJS(target.value) + } target.setSubmitting(true) try { notify( @@ -1039,3 +977,35 @@ export const selfReset = batch.bound( } } ) + +export const getValidFormValues = (values: any) => { + if (isObservable(values)) return values + return clone(values || {}) +} + +export const getValidFieldDefaultValue = (value: any, initialValue: any) => { + if (allowAssignDefaultValue(value, initialValue)) return initialValue + return value +} + +export const allowAssignDefaultValue = (target: any, source: any) => { + const isEmptyTarget = isEmpty(target) + const isEmptySource = isEmpty(source) + const isValidTarget = isValid(target) + const isValidSource = isValid(source) + if (!isValidTarget) { + if (isValidSource) { + return true + } + return false + } + + if (isEmptyTarget) { + if (isEmptySource) { + return false + } else { + return true + } + } + return false +} diff --git a/packages/reactive/src/handlers.ts b/packages/reactive/src/handlers.ts index e144b693913..991478c2bfc 100644 --- a/packages/reactive/src/handlers.ts +++ b/packages/reactive/src/handlers.ts @@ -191,8 +191,9 @@ export const baseHandlers: ProxyHandler = { return result }, ownKeys(target) { + const keys = Reflect.ownKeys(target) bindTargetKeyWithCurrentReaction({ target, type: 'iterate' }) - return Reflect.ownKeys(target) + return keys }, set(target, key, value, receiver) { const hadKey = hasOwnProperty.call(target, key) From 7067221627a497b976fd7948c264b91b8a955fc7 Mon Sep 17 00:00:00 2001 From: janrywang Date: Sat, 18 Sep 2021 20:59:48 +0800 Subject: [PATCH 07/33] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v2.0.0-rc.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 42 +++++++++---------- devtools/chrome-extension/package.json | 6 +-- lerna.json | 2 +- packages/antd/package.json | 14 +++---- packages/core/package.json | 8 ++-- packages/element/package.json | 14 +++---- packages/json-schema/package.json | 8 ++-- packages/next/package.json | 14 +++---- packages/path/package.json | 2 +- packages/react/package.json | 14 +++---- packages/reactive-react/package.json | 4 +- .../package.json | 6 +-- packages/reactive-vue/package.json | 4 +- packages/reactive/package.json | 2 +- packages/shared/package.json | 4 +- packages/validator/package.json | 4 +- packages/vue/package.json | 14 +++---- 17 files changed, 80 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 215f601d0b0..8c38e32b42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## v2.0.0-rc.8(2021-09-17) + +### :tada: Enhancements + +1. [feat(react): fix schema x-component-props children invalid (#2160)](https://github.com/alibaba/formily/commit/7dc9d9ff) :point_right: ( [Lyca](https://github.com/Lyca) ) + +### :memo: Documents Changes + +1. [docs(reactive): update toJS/markRaw docs](https://github.com/alibaba/formily/commit/77cb7b7b) :point_right: ( [janrywang](https://github.com/janrywang) ) + +### :rocket: Improve Performance + +1. [perf(schema): improve performance](https://github.com/alibaba/formily/commit/184884ca) :point_right: ( [janrywang](https://github.com/janrywang) ) + +### :blush: Other Changes + +1. [chore(workflow): fix actions](https://github.com/alibaba/formily/commit/12dacdcc) :point_right: ( [Janry](https://github.com/Janry) ) + +1. [chore(designable): lock version](https://github.com/alibaba/formily/commit/b61ad907) :point_right: ( [janrywang](https://github.com/janrywang) ) + ## v2.0.0-rc.7(2021-09-15) ### :beetle: Bug Fixes @@ -781,25 +801,3 @@ ### :blush: Other Changes 1. [chore(readme): update readme](https://github.com/alibaba/formily/commit/96140630) :point_right: ( [janrywang](https://github.com/janrywang) ) - -## v2.0.0-beta.58(2021-05-27) - -### :tada: Enhancements - -1. [feat(next): add ArrayCollapse (#1513)](https://github.com/alibaba/formily/commit/ebddc015) :point_right: ( [Lind](https://github.com/Lind) ) - -### :beetle: Bug Fixes - -1. [fix(vue): remove empty default slots of fields (#1517)](https://github.com/alibaba/formily/commit/00a80b4b) :point_right: ( [月落音阑](https://github.com/月落音阑) ) - -### :memo: Documents Changes - -1. [docs(json-schema): add definitions and doc](https://github.com/alibaba/formily/commit/e729e007) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [docs(core): fix typo (#1512)](https://github.com/alibaba/formily/commit/c568de99) :point_right: ( [后浪](https://github.com/后浪) ) - -### :blush: Other Changes - -1. [chore(workflow): update ci action](https://github.com/alibaba/formily/commit/d3dd91ca) :point_right: ( [janrywang](https://github.com/janrywang) ) - -1. [chore(github): update pr template](https://github.com/alibaba/formily/commit/b3149307) :point_right: ( [janrywang](https://github.com/janrywang) ) diff --git a/devtools/chrome-extension/package.json b/devtools/chrome-extension/package.json index 830775cc729..68275a5060d 100644 --- a/devtools/chrome-extension/package.json +++ b/devtools/chrome-extension/package.json @@ -1,6 +1,6 @@ { "name": "@formily/chrome-extension", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "private": true, "license": "MIT", "repository": { @@ -21,8 +21,8 @@ "start": "webpack-dev-server --config config/webpack.dev.ts" }, "dependencies": { - "@formily/core": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", + "@formily/core": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", "react": "^17.0.0", "react-dom": "^17.0.0", "react-json-view": "^1.19.1", diff --git a/lerna.json b/lerna.json index 5b0c1f2d8d8..f62ad534ebd 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "npmClient": "yarn", "useWorkspaces": true, "npmClientArgs": ["--ignore-engines"], diff --git a/packages/antd/package.json b/packages/antd/package.json index 824524b0c55..82d766cf5ff 100644 --- a/packages/antd/package.json +++ b/packages/antd/package.json @@ -1,6 +1,6 @@ { "name": "@formily/antd", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -52,12 +52,12 @@ }, "dependencies": { "@ant-design/icons": "^4.0.0", - "@formily/core": "2.0.0-rc.8", - "@formily/json-schema": "2.0.0-rc.8", - "@formily/react": "2.0.0-rc.8", - "@formily/reactive": "2.0.0-rc.8", - "@formily/reactive-react": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", + "@formily/core": "2.0.0-rc.9", + "@formily/json-schema": "2.0.0-rc.9", + "@formily/react": "2.0.0-rc.9", + "@formily/reactive": "2.0.0-rc.9", + "@formily/reactive-react": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", "@juggle/resize-observer": "^3.3.1", "classnames": "^2.2.6", "react-sortable-hoc": "^1.11.0", diff --git a/packages/core/package.json b/packages/core/package.json index 4c586d296cc..78379ab0137 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@formily/core", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -33,9 +33,9 @@ "dumi": "^1.1.0-rc.8" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", - "@formily/validator": "2.0.0-rc.8" + "@formily/reactive": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", + "@formily/validator": "2.0.0-rc.9" }, "publishConfig": { "access": "public" diff --git a/packages/element/package.json b/packages/element/package.json index cd20a04b58e..a02e32b9d82 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@formily/element", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -46,12 +46,12 @@ "vuepress-plugin-typescript": "^0.3.1" }, "dependencies": { - "@formily/core": "2.0.0-rc.8", - "@formily/json-schema": "2.0.0-rc.8", - "@formily/reactive": "2.0.0-rc.8", - "@formily/reactive-vue": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", - "@formily/vue": "2.0.0-rc.8", + "@formily/core": "2.0.0-rc.9", + "@formily/json-schema": "2.0.0-rc.9", + "@formily/reactive": "2.0.0-rc.9", + "@formily/reactive-vue": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", + "@formily/vue": "2.0.0-rc.9", "portal-vue": "^2.1.7", "vue-slicksort": "^1.2.0" }, diff --git a/packages/json-schema/package.json b/packages/json-schema/package.json index daedde70e8e..4a92319d4fe 100644 --- a/packages/json-schema/package.json +++ b/packages/json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@formily/json-schema", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -28,9 +28,9 @@ "build:global": "ts-node ../../scripts/build-global" }, "dependencies": { - "@formily/core": "2.0.0-rc.8", - "@formily/reactive": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8" + "@formily/core": "2.0.0-rc.9", + "@formily/reactive": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9" }, "publishConfig": { "access": "public" diff --git a/packages/next/package.json b/packages/next/package.json index 6c2ef76d4c1..45758a26c58 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "@formily/next", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "umd:main": "dist/formily.next.umd.production.js", @@ -52,12 +52,12 @@ }, "dependencies": { "@ant-design/icons": "^4.0.0", - "@formily/core": "2.0.0-rc.8", - "@formily/json-schema": "2.0.0-rc.8", - "@formily/react": "2.0.0-rc.8", - "@formily/reactive": "2.0.0-rc.8", - "@formily/reactive-react": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", + "@formily/core": "2.0.0-rc.9", + "@formily/json-schema": "2.0.0-rc.9", + "@formily/react": "2.0.0-rc.9", + "@formily/reactive": "2.0.0-rc.9", + "@formily/reactive-react": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", "@juggle/resize-observer": "^3.3.1", "classnames": "^2.2.6", "react-sortable-hoc": "^1.11.0", diff --git a/packages/path/package.json b/packages/path/package.json index 28f6bab0281..de8b196b826 100644 --- a/packages/path/package.json +++ b/packages/path/package.json @@ -1,6 +1,6 @@ { "name": "@formily/path", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", diff --git a/packages/react/package.json b/packages/react/package.json index 1d826d9250d..ba958f986fe 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@formily/react", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -40,12 +40,12 @@ "dumi": "^1.1.0-rc.8" }, "dependencies": { - "@formily/core": "2.0.0-rc.8", - "@formily/json-schema": "2.0.0-rc.8", - "@formily/reactive": "2.0.0-rc.8", - "@formily/reactive-react": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", - "@formily/validator": "2.0.0-rc.8", + "@formily/core": "2.0.0-rc.9", + "@formily/json-schema": "2.0.0-rc.9", + "@formily/reactive": "2.0.0-rc.9", + "@formily/reactive-react": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", + "@formily/validator": "2.0.0-rc.9", "hoist-non-react-statics": "^3.3.2" }, "publishConfig": { diff --git a/packages/reactive-react/package.json b/packages/reactive-react/package.json index 591b2c254aa..c3aadf50799 100644 --- a/packages/reactive-react/package.json +++ b/packages/reactive-react/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive-react", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -39,7 +39,7 @@ "dumi": "^1.1.0-rc.8" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.9", "hoist-non-react-statics": "^3.3.2" }, "publishConfig": { diff --git a/packages/reactive-test-cases-for-react18/package.json b/packages/reactive-test-cases-for-react18/package.json index 6c13b2a28a8..132e84a23fa 100644 --- a/packages/reactive-test-cases-for-react18/package.json +++ b/packages/reactive-test-cases-for-react18/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive-test-cases-for-react18", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "private": true, "repository": { @@ -36,8 +36,8 @@ "react-is": "next" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.8", - "@formily/reactive-react": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.9", + "@formily/reactive-react": "2.0.0-rc.9", "react": "next", "react-dom": "next", "react-is": "next" diff --git a/packages/reactive-vue/package.json b/packages/reactive-vue/package.json index 6621382ddd6..82a45bba075 100644 --- a/packages/reactive-vue/package.json +++ b/packages/reactive-vue/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive-vue", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -33,7 +33,7 @@ "vue": "^2.6.12" }, "dependencies": { - "@formily/reactive": "2.0.0-rc.8", + "@formily/reactive": "2.0.0-rc.9", "vue-demi": "^0.9.0" }, "peerDependencies": { diff --git a/packages/reactive/package.json b/packages/reactive/package.json index bd335ea9be5..0d62209e261 100644 --- a/packages/reactive/package.json +++ b/packages/reactive/package.json @@ -1,6 +1,6 @@ { "name": "@formily/reactive", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", diff --git a/packages/shared/package.json b/packages/shared/package.json index 9311866136b..e51f9035170 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@formily/shared", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -31,7 +31,7 @@ "build:umd": "rollup --config" }, "dependencies": { - "@formily/path": "2.0.0-rc.8", + "@formily/path": "2.0.0-rc.9", "camel-case": "^4.1.1", "lower-case": "^2.0.1", "no-case": "^3.0.4", diff --git a/packages/validator/package.json b/packages/validator/package.json index 9e156210d99..e71dd2e4292 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -1,6 +1,6 @@ { "name": "@formily/validator", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -27,7 +27,7 @@ "build:umd": "rollup --config" }, "dependencies": { - "@formily/shared": "2.0.0-rc.8" + "@formily/shared": "2.0.0-rc.9" }, "publishConfig": { "access": "public" diff --git a/packages/vue/package.json b/packages/vue/package.json index ae908688939..3ef85ecdd51 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@formily/vue", - "version": "2.0.0-rc.8", + "version": "2.0.0-rc.9", "license": "MIT", "main": "lib", "module": "esm", @@ -36,12 +36,12 @@ "vuepress-plugin-typescript": "^0.3.1" }, "dependencies": { - "@formily/core": "2.0.0-rc.8", - "@formily/json-schema": "2.0.0-rc.8", - "@formily/reactive": "2.0.0-rc.8", - "@formily/reactive-vue": "2.0.0-rc.8", - "@formily/shared": "2.0.0-rc.8", - "@formily/validator": "2.0.0-rc.8", + "@formily/core": "2.0.0-rc.9", + "@formily/json-schema": "2.0.0-rc.9", + "@formily/reactive": "2.0.0-rc.9", + "@formily/reactive-vue": "2.0.0-rc.9", + "@formily/shared": "2.0.0-rc.9", + "@formily/validator": "2.0.0-rc.9", "@type-helper/vue2": "npm:vue@2", "@type-helper/vue3": "npm:vue@3", "vue-demi": "^0.9.0", From 71832aec9ac87f6d4cab67dc2fbdc5518eb7bdb6 Mon Sep 17 00:00:00 2001 From: janrywang Date: Sat, 18 Sep 2021 23:22:25 +0800 Subject: [PATCH 08/33] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v2.0.0-rc.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ---- .github/workflows/release.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fe26eb5acb..6621f53a93c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,6 @@ name: Node CI on: - push: - branches: - - formily_next pull_request: branches: - formily_next @@ -11,7 +8,6 @@ on: jobs: build: runs-on: ${{ matrix.os }} - if: contains(github.event.head_commit.message, 'chore(versions)') == false strategy: matrix: node_version: [10.x, 11.x] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1e6096d0fe..920ccc62c97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,21 @@ jobs: yarn -v yarn --ignore-engines yarn build + yarn test:prod yarn run release:force + env: + CI: true + HEADLESS: false + PROGRESS: none + NODE_ENV: test + NODE_OPTIONS: --max_old_space_size=4096 + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true env: HEADLESS: false PROGRESS: none From 1141e580cac800e20d5eb2b46b8d65b0789f8988 Mon Sep 17 00:00:00 2001 From: janrywang Date: Sat, 18 Sep 2021 23:40:56 +0800 Subject: [PATCH 09/33] perf(path): use Map replace LRUMap --- packages/path/src/index.ts | 7 +- packages/path/src/lru.ts | 318 ------------------------------------- 2 files changed, 3 insertions(+), 322 deletions(-) delete mode 100644 packages/path/src/lru.ts diff --git a/packages/path/src/index.ts b/packages/path/src/index.ts index 822d06a3f8b..1623128e60e 100644 --- a/packages/path/src/index.ts +++ b/packages/path/src/index.ts @@ -8,10 +8,9 @@ import { existInByDestructor, } from './destructor' import { Segments, Node, Pattern } from './types' -import { LRUMap } from './lru' import { Matcher } from './matcher' -const pathCache = new LRUMap(10000) +const pathCache = new Map() const isMatcher = Symbol('PATH_MATCHER') @@ -248,8 +247,8 @@ export class Path { this.isRegExp = isRegExp this.haveExcludePattern = haveExcludePattern this.tree = tree as Node - this.matchCache = new LRUMap(200) - this.includesCache = new LRUMap(200) + this.matchCache = new Map() + this.includesCache = new Map() } toString() { diff --git a/packages/path/src/lru.ts b/packages/path/src/lru.ts deleted file mode 100644 index ac27f0fe373..00000000000 --- a/packages/path/src/lru.ts +++ /dev/null @@ -1,318 +0,0 @@ -/* istanbul ignore file */ -/** - * A doubly linked list-based Least Recently Used (LRU) cache. Will keep most - * recently used items while discarding least recently used items when its limit - * is reached. - * - * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson - * See README.md for details. - * - * Illustration of the design: - * - * entry entry entry entry - * ______ ______ ______ ______ - * | head |.newer => | |.newer => | |.newer => | tail | - * | A | | B | | C | | D | - * |______| <= older.|______| <= older.|______| <= older.|______| - * - * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added - */ -/* eslint-disable */ - -const NEWER = Symbol('newer') -const OLDER = Symbol('older') - -export function LRUMap(limit: number, entries?: any) { - if (typeof limit !== 'number') { - // called as (entries) - entries = limit - limit = 0 - } - - this.size = 0 - this.limit = limit - this.oldest = this.newest = undefined - this._keymap = new Map() - - if (entries) { - this.assign(entries) - if (limit < 1) { - this.limit = this.size - } - } -} - -function Entry(key: any, value: any) { - this.key = key - this.value = value - this[NEWER] = undefined - this[OLDER] = undefined -} - -LRUMap.prototype._markEntryAsUsed = function (entry: any) { - if (entry === this.newest) { - // Already the most recenlty used entry, so no need to update the list - return - } - // HEAD--------------TAIL - // <.older .newer> - // <--- add direction -- - // A B C E - if (entry[NEWER]) { - if (entry === this.oldest) { - this.oldest = entry[NEWER] - } - entry[NEWER][OLDER] = entry[OLDER] // C <-- E. - } - if (entry[OLDER]) { - entry[OLDER][NEWER] = entry[NEWER] // C. --> E - } - entry[NEWER] = undefined // D --x - entry[OLDER] = this.newest // D. --> E - if (this.newest) { - this.newest[NEWER] = entry // E. <-- D - } - this.newest = entry -} - -LRUMap.prototype.assign = function (entries: any) { - let entry: any - let limit = this.limit || Number.MAX_VALUE - this._keymap.clear() - const it = entries[Symbol.iterator]() - for (let itv = it.next(); !itv.done; itv = it.next()) { - const e = new Entry(itv.value[0], itv.value[1]) - this._keymap.set(e.key, e) - if (!entry) { - this.oldest = e - } else { - entry[NEWER] = e - e[OLDER] = entry - } - entry = e - if (limit-- === 0) { - throw new Error('overflow') - } - } - this.newest = entry - this.size = this._keymap.size -} - -LRUMap.prototype.get = function (key: any) { - // First, find our cache entry - const entry = this._keymap.get(key) - if (!entry) { - return - } // Not cached. Sorry. - // As was found in the cache, register it as being requested recently - this._markEntryAsUsed(entry) - return entry.value -} - -LRUMap.prototype.set = function (key: any, value: any) { - let entry = this._keymap.get(key) - - if (entry) { - // update existing - entry.value = value - this._markEntryAsUsed(entry) - return this - } - - // new entry - this._keymap.set(key, (entry = new Entry(key, value))) - - if (this.newest) { - // link previous tail to the new tail (entry) - this.newest[NEWER] = entry - entry[OLDER] = this.newest - } else { - // we're first in -- yay - this.oldest = entry - } - - // add new entry to the end of the linked list -- it's now the freshest entry. - this.newest = entry - ++this.size - if (this.size > this.limit) { - // we hit the limit -- remove the head - this.shift() - } - - return this -} - -LRUMap.prototype.shift = function () { - // todo: handle special case when limit == 1 - const entry = this.oldest - if (entry) { - if (this.oldest[NEWER]) { - // advance the list - this.oldest = this.oldest[NEWER] - this.oldest[OLDER] = undefined - } else { - // the cache is exhausted - this.oldest = undefined - this.newest = undefined - } - // Remove last strong reference to and remove links from the purged - // entry being returned: - entry[NEWER] = entry[OLDER] = undefined - this._keymap.delete(entry.key) - --this.size - return [entry.key, entry.value] - } -} - -// ---------------------------------------------------------------------------- -// Following code is optional and can be removed without breaking the core -// functionality. - -LRUMap.prototype.find = function (key: any) { - const e = this._keymap.get(key) - return e ? e.value : undefined -} - -LRUMap.prototype.has = function (key: any) { - return this._keymap.has(key) -} - -LRUMap.prototype.delete = function (key: any) { - const entry = this._keymap.get(key) - if (!entry) { - return - } - this._keymap.delete(entry.key) - if (entry[NEWER] && entry[OLDER]) { - // relink the older entry with the newer entry - entry[OLDER][NEWER] = entry[NEWER] - entry[NEWER][OLDER] = entry[OLDER] - } else if (entry[NEWER]) { - // remove the link to us - entry[NEWER][OLDER] = undefined - // link the newer entry to head - this.oldest = entry[NEWER] - } else if (entry[OLDER]) { - // remove the link to us - entry[OLDER][NEWER] = undefined - // link the newer entry to head - this.newest = entry[OLDER] - } else { - // if(entry[OLDER] === undefined && entry.newer === undefined) { - this.oldest = this.newest = undefined - } - - this.size-- - return entry.value -} - -LRUMap.prototype.clear = function () { - // Not clearing links should be safe, as we don't expose live links to user - this.oldest = this.newest = undefined - this.size = 0 - this._keymap.clear() -} - -function EntryIterator(oldestEntry: any) { - this.entry = oldestEntry -} -EntryIterator.prototype[Symbol.iterator] = function () { - return this -} -EntryIterator.prototype.next = function () { - const ent = this.entry - if (ent) { - this.entry = ent[NEWER] - return { done: false, value: [ent.key, ent.value] } - } else { - return { done: true, value: undefined } - } -} - -function KeyIterator(oldestEntry) { - this.entry = oldestEntry -} -KeyIterator.prototype[Symbol.iterator] = function () { - return this -} -KeyIterator.prototype.next = function () { - const ent = this.entry - if (ent) { - this.entry = ent[NEWER] - return { done: false, value: ent.key } - } else { - return { done: true, value: undefined } - } -} - -function ValueIterator(oldestEntry) { - this.entry = oldestEntry -} -ValueIterator.prototype[Symbol.iterator] = function () { - return this -} -ValueIterator.prototype.next = function () { - const ent = this.entry - if (ent) { - this.entry = ent[NEWER] - return { done: false, value: ent.value } - } else { - return { done: true, value: undefined } - } -} - -LRUMap.prototype.keys = function () { - return new KeyIterator(this.oldest) -} - -LRUMap.prototype.values = function () { - return new ValueIterator(this.oldest) -} - -LRUMap.prototype.entries = function () { - return this -} - -LRUMap.prototype[Symbol.iterator] = function () { - return new EntryIterator(this.oldest) -} - -LRUMap.prototype.forEach = function ( - fun: (value: any, key: any, ctx: object) => void, - thisObj: any -) { - if (typeof thisObj !== 'object') { - thisObj = this - } - let entry = this.oldest - while (entry) { - fun.call(thisObj, entry.value, entry.key, this) - entry = entry[NEWER] - } -} - -/** Returns a JSON (array) representation */ -LRUMap.prototype.toJSON = function () { - const s = new Array(this.size) - let i = 0 - let entry = this.oldest - while (entry) { - s[i++] = { key: entry.key, value: entry.value } - entry = entry[NEWER] - } - return s -} - -/** Returns a String representation */ -LRUMap.prototype.toString = function () { - let s = '' - let entry = this.oldest - while (entry) { - s += String(entry.key) + ':' + entry.value - entry = entry[NEWER] - if (entry) { - s += ' < ' - } - } - return s -} From 0a915e16787d1aa48eb01e24c0ea5dc0c44a32d4 Mon Sep 17 00:00:00 2001 From: janrywang Date: Sat, 18 Sep 2021 23:47:50 +0800 Subject: [PATCH 10/33] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v2.0.0-rc.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yarn.lock | 179 ++---------------------------------------------------- 1 file changed, 4 insertions(+), 175 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5b1d40af2b4..18454607e39 100644 --- a/yarn.lock +++ b/yarn.lock @@ -387,11 +387,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.3.tgz#3416d9bea748052cfcb63dbcc27368105b1ed862" integrity sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA== -"@babel/parser@^7.14.7": - version "7.15.6" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.6.tgz#043b9aa3c303c0722e5377fef9197f4cf1796549" - integrity sha512-S/TSCcsRuCkmpUuoWijua0Snt+f3ewU/8spLo+4AXJCZfT0bVCzLD5MuOKdrx0mlAptbKzn5AdgEIIKXxXkz9Q== - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.14.5.tgz#4b467302e1548ed3b1be43beae2cc9cf45e0bb7e" @@ -1166,67 +1161,6 @@ resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f" integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ== -"@designable/core@0.5.29", "@designable/core@^0.x": - version "0.5.29" - resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.5.29.tgz#de866560fb62bf644d650cf35c718234e377022e" - integrity sha512-SZDaIwg853C08MrNQAksCgVZjxY/qgPxpomBwkSJyjs9v4FOEMOgrkjMelofNCzfnuRQeBWnHrQoWXy0F9GEpQ== - dependencies: - "@designable/shared" "0.5.29" - "@formily/json-schema" "^2.0.0-beta.84" - "@formily/path" "^2.0.0-beta.84" - "@formily/reactive" "^2.0.0-beta.84" - "@juggle/resize-observer" "^3.3.1" - -"@designable/formily@^0.x": - version "0.5.29" - resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.5.29.tgz#33e4d2c482af05e85ccf10439c748261e9fab2ba" - integrity sha512-JCTYEKOuDH1Yr82GC6pAF9zSQxN1PaHSruam4AyrsTWygr5uotcAPObYVWT13IZIfWiSWQSuryBKXDC05PnXVQ== - dependencies: - "@designable/core" "0.5.29" - "@designable/shared" "0.5.29" - "@formily/core" "^2.0.0-beta.84" - "@formily/json-schema" "^2.0.0-beta.84" - -"@designable/react-settings-form@^0.x": - version "0.5.29" - resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.5.29.tgz#09dab2de564a2eaa8fe746b18e259309fe83bf84" - integrity sha512-1WbA1ALzUOvQ9FRYY10kHyhXqL0ZBCHZF/8XSpDdy7p30arYm4hifDhabJet4D2I18Mijd7VaZQ2dC1R1iKM2A== - dependencies: - "@babel/parser" "^7.14.7" - "@designable/core" "0.5.29" - "@designable/react" "0.5.29" - "@designable/shared" "0.5.29" - "@formily/antd" "^2.0.0-beta.84" - "@formily/core" "^2.0.0-beta.84" - "@formily/react" "^2.0.0-beta.84" - "@formily/reactive" "^2.0.0-beta.84" - "@formily/reactive-react" "^2.0.0-beta.84" - "@formily/shared" "^2.0.0-beta.84" - "@monaco-editor/react" "^4.2.1" - monaco-editor "^0.25.2" - prettier "^2.3.2" - react-color "^2.19.3" - react-tiny-popover "^6.0.5" - -"@designable/react@0.5.29", "@designable/react@^0.x": - version "0.5.29" - resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.5.29.tgz#7cc99c65ab4205436a16803c06c27d9b94016e6a" - integrity sha512-zTdFxG/8EykSavwxdI4n10aTQxRv8w0OTIT6Zng3+rumSnXxPlvwXbVE+HtUTVVrG7luKyjnAXW1XT74Xb4dSA== - dependencies: - "@designable/core" "0.5.29" - "@designable/shared" "0.5.29" - "@formily/reactive" "^2.0.0-beta.84" - "@formily/reactive-react" "^2.0.0-beta.84" - "@juggle/resize-observer" "^3.3.1" - dateformat "^4.5.1" - -"@designable/shared@0.5.29": - version "0.5.29" - resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.5.29.tgz#47e60c0a16776c126b002aeee262416c06de7e64" - integrity sha512-z/+koR92O9lrjEn+wevWWTcZyc71klAF9KYRFiuiMgLpLGmC121ZVrBJuaf3/lcshSnOJZwe8ThTW0O1CG1pvg== - dependencies: - requestidlecallback "^0.3.0" - "@emotion/cache@^10.0.27": version "10.0.29" resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-10.0.29.tgz#87e7e64f412c060102d589fe7c6dc042e6f9d1e0" @@ -1419,11 +1353,6 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== -"@icons/material@^0.2.4": - version "0.2.4" - resolved "https://registry.yarnpkg.com/@icons/material/-/material-0.2.4.tgz#e90c9f71768b3736e76d7dd6783fc6c2afa88bc8" - integrity sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw== - "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -2320,21 +2249,6 @@ stringify-entities "^3.0.1" stringify-object "^3.3.0" -"@monaco-editor/loader@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@monaco-editor/loader/-/loader-1.1.1.tgz#37db648c81a86946d0febd391de00df9c28a0a3d" - integrity sha512-mkT4r4xDjIyOG9o9M6rJDSzEIeonwF80sYErxEvAAL4LncFVdcbNli8Qv6NDqF6nyv6sunuKkDzo4iFjxPL+uQ== - dependencies: - state-local "^1.0.6" - -"@monaco-editor/react@^4.2.1": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@monaco-editor/react/-/react-4.2.2.tgz#636e5b8eb9519ef62f475f9a4a50f62ee0c493a8" - integrity sha512-yDDct+f/mZ946tJEXudvmMC8zXDygkELNujpJGjqJ0gS3WePZmS/IwBBsuJ8JyKQQC3Dy/+Ivg1sSpW+UvCv9g== - dependencies: - "@monaco-editor/loader" "^1.1.1" - prop-types "^15.7.2" - "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -4565,7 +4479,7 @@ autocomplete.js@0.36.0: dependencies: immediate "^3.2.3" -autoprefixer@^9.0, autoprefixer@^9.5.1, autoprefixer@^9.6.1: +autoprefixer@^9.5.1, autoprefixer@^9.6.1: version "9.8.6" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.6.tgz#3b73594ca1bf9266320c5acf1588d74dea74210f" integrity sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg== @@ -6778,11 +6692,6 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -dateformat@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c" - integrity sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q== - dayjs@1.x, dayjs@^1.9.6: version "1.10.6" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63" @@ -8545,7 +8454,7 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@8.1.0, fs-extra@^8.1.0: +fs-extra@8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== @@ -11907,11 +11816,6 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash-es@^4.17.15: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" - integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== - lodash._baseclone@~4.5.0: version "4.5.7" resolved "https://registry.yarnpkg.com/lodash._baseclone/-/lodash._baseclone-4.5.7.tgz#ce42ade08384ef5d62fa77c30f61a46e686f8434" @@ -12014,7 +11918,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.x, lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.7.0: +lodash@4.x, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.7.0: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -12326,11 +12230,6 @@ matcher@^1.0.0: dependencies: escape-string-regexp "^1.0.4" -material-colors@^1.2.1: - version "1.2.6" - resolved "https://registry.yarnpkg.com/material-colors/-/material-colors-1.2.6.tgz#6d1958871126992ceecc72f4bcc4d8f010865f46" - integrity sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg== - mathjax-full@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/mathjax-full/-/mathjax-full-3.2.0.tgz#e53269842a943d4df10502937518991268996c5c" @@ -12996,23 +12895,6 @@ moment@^2.21.0, moment@^2.24.0, moment@^2.25.3: resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== -monaco-editor-webpack-plugin@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-4.1.2.tgz#afea30e4e0374132f8f298d358c99efc2cad3e84" - integrity sha512-snmHecygICKT0UlHhva+Cs2WaLPpxy3111xbvInhjjTr5m0xQTFHlmJ2QQDcB14Vzmm7f07uc1TtbvOpmL50BA== - dependencies: - loader-utils "^2.0.0" - -monaco-editor@*: - version "0.27.0" - resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.27.0.tgz#4b69108bb1dc1f60174c5dcdf51bc5306ab5ba26" - integrity sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ== - -monaco-editor@^0.25.2: - version "0.25.2" - resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.25.2.tgz#119e2b15bbd968a1a99c03cac9c329316d7c37e9" - integrity sha512-5iylzSJevCnzJn9UVsW8yOZ3yHjmAs4TfvH3zsbftKiFKmHG0xirGN6DK9Kk04VSWxYCZZAIafYJoNJJMAU1KA== - move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -15342,11 +15224,6 @@ prettier@^2.1.2, prettier@^2.2.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== -prettier@^2.3.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.0.tgz#85bdfe0f70c3e777cf13a4ffff39713ca6f64cba" - integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ== - pretty-error@^2.0.2: version "2.1.2" resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6" @@ -15504,7 +15381,7 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2: +prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -16143,19 +16020,6 @@ react-base16-styling@^0.6.0: lodash.flow "^3.3.0" pure-color "^1.2.0" -react-color@^2.19.3: - version "2.19.3" - resolved "https://registry.yarnpkg.com/react-color/-/react-color-2.19.3.tgz#ec6c6b4568312a3c6a18420ab0472e146aa5683d" - integrity sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA== - dependencies: - "@icons/material" "^0.2.4" - lodash "^4.17.15" - lodash-es "^4.17.15" - material-colors "^1.2.1" - prop-types "^15.5.10" - reactcss "^1.2.0" - tinycolor2 "^1.4.1" - react-docgen-typescript-dumi-tmp@^1.22.1-0: version "1.22.1-0" resolved "https://registry.yarnpkg.com/react-docgen-typescript-dumi-tmp/-/react-docgen-typescript-dumi-tmp-1.22.1-0.tgz#6f452de05c5c114a6e1dd60b34930afaa7ae39a0" @@ -16224,14 +16088,6 @@ react-mde@^11.5.0: resolved "https://registry.yarnpkg.com/react-mde/-/react-mde-11.5.0.tgz#3e81a505071aa80287fb23a1c0ce5e8b34c82055" integrity sha512-CH/VK6d+tpVjJ8rTXfh1dDt6GWedTgCU0668p8toqhAc3vy0Lu872O2RKYDSpkUrlbHI08fjUPTl++nExp6gag== -react-monaco-editor@^0.43.0: - version "0.43.0" - resolved "https://registry.yarnpkg.com/react-monaco-editor/-/react-monaco-editor-0.43.0.tgz#495578470db7b27ab306af813b31f206a6bf9d1c" - integrity sha512-2PXSDwOzjUDlwdsK8psrmezSB2lPnjLQ/SRNwqoRF2+TAB2n4Q+Bs1wGlWOZbU8WI7s6Wnni0+3PdT9nSPtzRA== - dependencies: - monaco-editor "*" - prop-types "^15.7.2" - react-refresh@0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.10.0.tgz#2f536c9660c0b9b1d500684d9e52a65e7404f7e3" @@ -16309,11 +16165,6 @@ react-textarea-autosize@^8.3.2: use-composed-ref "^1.0.0" use-latest "^1.0.0" -react-tiny-popover@^6.0.5: - version "6.0.10" - resolved "https://registry.yarnpkg.com/react-tiny-popover/-/react-tiny-popover-6.0.10.tgz#6167a1b4a1ae6cf847d2909057defd00d95d726c" - integrity sha512-ECMucd701SxWHGa+2YuVvccCxxTjmhomcD0ZYTF+Qmi5qNAj8pdlExFN+k+p1G78QTYIGPGNLocxRb9f6cZ0Mw== - react-transition-group@^2.0.0, react-transition-group@^2.2.1: version "2.9.0" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d" @@ -16360,13 +16211,6 @@ react@next: loose-envify "^1.1.0" object-assign "^4.1.1" -reactcss@^1.2.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/reactcss/-/reactcss-1.2.3.tgz#c00013875e557b1cf0dfd9a368a1c3dab3b548dd" - integrity sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A== - dependencies: - lodash "^4.0.1" - read-cmd-shim@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-2.0.0.tgz#4a50a71d6f0965364938e9038476f7eede3928d9" @@ -16860,11 +16704,6 @@ request@^2.87.0, request@^2.88.0, request@^2.88.2: tunnel-agent "^0.6.0" uuid "^3.3.2" -requestidlecallback@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/requestidlecallback/-/requestidlecallback-0.3.0.tgz#6fb74e0733f90df3faa4838f9f6a2a5f9b742ac5" - integrity sha1-b7dOBzP5DfP6pIOPn2oqX5t0KsU= - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -17984,11 +17823,6 @@ staged-git-files@^1.1.2: resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.2.0.tgz#05b43f4fcec6d4799ac41c826ecd17c0bd53ce82" integrity sha512-MYK3aDsO8XAXkv2ASsrznObxVDlocYm7gc/cMk/hB4vbJZeEqOO7H1mZR7EY2C5q3YgKOBo3Tmu0D30h7RjdWg== -state-local@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/state-local/-/state-local-1.0.7.tgz#da50211d07f05748d53009bee46307a37db386d5" - integrity sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w== - static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -19619,11 +19453,6 @@ vue-frag@^1.1.4: resolved "https://registry.yarnpkg.com/vue-frag/-/vue-frag-1.1.5.tgz#1158f92361dff2c312e00b8ca85334c329e566e7" integrity sha512-g+PP9pjW1gnrmPjy2Sa5jK/bfxYHK8Hgt1sVs/Y/7KT+srGJUwtGNwXNTUvWv/zJ2yGcvJVEH98eIrICyZX9Ng== -vue-hoc@^0.4.7: - version "0.4.7" - resolved "https://registry.nlark.com/vue-hoc/download/vue-hoc-0.4.7.tgz#4d3322ba89b8b0e42b19045ef536c21d948a4fac" - integrity sha1-TTMiuom4sOQrGQRe9TbCHZSKT6w= - vue-hot-reload-api@^2.3.0: version "2.3.4" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2" From ff834f2e551b6429d767504e2333d52062989890 Mon Sep 17 00:00:00 2001 From: janrywang Date: Sun, 19 Sep 2021 00:03:50 +0800 Subject: [PATCH 11/33] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v2.0.0-rc.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 920ccc62c97..95ee6c5bf9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,10 +9,10 @@ jobs: runs-on: ubuntu-latest if: contains(github.event.head_commit.message, 'chore(versions)') steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 with: - node-version: 11 + node-version: 12 registry-url: https://registry.npmjs.org/ - run: | yarn -v From 063172455106fe72a0ed15e8a73c48e69fc80080 Mon Sep 17 00:00:00 2001 From: janrywang Date: Sun, 19 Sep 2021 00:06:03 +0800 Subject: [PATCH 12/33] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v2.0.0-rc.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95ee6c5bf9d..2a289476268 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,11 @@ jobs: PROGRESS: none NODE_ENV: test NODE_OPTIONS: --max_old_space_size=4096 + NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }} + ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }} + REGISTRY: https://registry.npmjs.org - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 @@ -33,11 +38,3 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true verbose: true - env: - HEADLESS: false - PROGRESS: none - NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }} - ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }} - REGISTRY: https://registry.npmjs.org From 84327d2d0c4a60ae6ac8de060800cd7ceb9358d8 Mon Sep 17 00:00:00 2001 From: janrywang Date: Mon, 20 Sep 2021 10:22:50 +0800 Subject: [PATCH 13/33] chore(desingbale): move designable-antd/next to designable repo --- designable/.eslintrc | 74 --- designable/antd/.npmignore | 11 - designable/antd/.umirc.js | 44 -- designable/antd/LICENSE.md | 20 - designable/antd/README.md | 7 - designable/antd/copy.ts | 6 - designable/antd/package.json | 71 --- designable/antd/playground/main.tsx | 137 ------ designable/antd/playground/service/index.ts | 1 - designable/antd/playground/service/schema.ts | 27 - designable/antd/playground/template.ejs | 21 - designable/antd/playground/webpack.base.ts | 104 ---- designable/antd/playground/webpack.dev.ts | 56 --- designable/antd/playground/webpack.prod.ts | 40 -- .../antd/playground/widgets/ActionsWidget.tsx | 51 -- .../antd/playground/widgets/LogoWidget.tsx | 20 - .../playground/widgets/MarkupSchemaWidget.tsx | 158 ------ .../antd/playground/widgets/PreviewWidget.tsx | 93 ---- .../playground/widgets/SchemaEditorWidget.tsx | 29 -- designable/antd/playground/widgets/index.ts | 5 - designable/antd/rollup.config.js | 24 - .../components/DesignableArrayCards/index.tsx | 243 --------- .../DesignableArrayCards/styles.less | 5 - .../DesignableArrayCollapse/index.tsx | 0 .../components/DesignableArrayItems/index.tsx | 0 .../components/DesignableArrayTable/index.tsx | 412 ---------------- .../DesignableArrayTable/styles.less | 5 - .../components/DesignableArrayTabs/index.tsx | 0 .../components/DesignableContainer/index.tsx | 20 - .../DesignableContainer/styles.less | 7 - .../src/components/DesignableField/index.tsx | 438 ----------------- .../src/components/DesignableField/options.ts | 186 ------- .../src/components/DesignableField/types.ts | 17 - .../src/components/DesignableForm/index.tsx | 61 --- .../src/components/DesignableForm/styles.less | 34 -- .../DesignableFormCollapse/index.tsx | 133 ----- .../components/DesignableFormTab/index.tsx | 116 ----- .../src/components/DesignableObject/index.tsx | 10 - .../src/components/DesignableText/index.tsx | 25 - .../src/components/DesignableText/styles.less | 10 - .../antd/src/components/Droppable/index.tsx | 21 - .../antd/src/components/Droppable/styles.less | 9 - .../src/components/FormItemSwitcher/index.tsx | 18 - .../src/components/LoadTemplate/index.tsx | 44 -- .../src/components/LoadTemplate/styles.less | 35 -- designable/antd/src/components/index.ts | 2 - designable/antd/src/hooks/index.ts | 1 - designable/antd/src/hooks/useDropTemplate.ts | 28 -- designable/antd/src/index.ts | 3 - designable/antd/src/locales/en-US.ts | 464 ------------------ designable/antd/src/locales/index.ts | 8 - designable/antd/src/locales/zh-CN.ts | 457 ----------------- designable/antd/src/schemas/ArrayCards.ts | 5 - designable/antd/src/schemas/ArrayTable.ts | 106 ---- designable/antd/src/schemas/CSSStyle.ts | 51 -- designable/antd/src/schemas/Card.ts | 36 -- designable/antd/src/schemas/Cascader.ts | 76 --- designable/antd/src/schemas/Checkbox.ts | 12 - designable/antd/src/schemas/DatePicker.ts | 118 ----- designable/antd/src/schemas/Form.ts | 11 - designable/antd/src/schemas/FormCollapse.ts | 61 --- designable/antd/src/schemas/FormGrid.ts | 65 --- designable/antd/src/schemas/FormItem.ts | 141 ------ designable/antd/src/schemas/FormLayout.ts | 124 ----- designable/antd/src/schemas/FormTab.ts | 48 -- designable/antd/src/schemas/Input.ts | 92 ---- designable/antd/src/schemas/NumberPicker.ts | 81 --- designable/antd/src/schemas/Password.ts | 13 - designable/antd/src/schemas/Radio.ts | 38 -- designable/antd/src/schemas/Rate.ts | 40 -- designable/antd/src/schemas/Select.ts | 149 ------ designable/antd/src/schemas/Slider.ts | 79 --- designable/antd/src/schemas/Space.ts | 41 -- designable/antd/src/schemas/Switch.ts | 21 - designable/antd/src/schemas/Text.ts | 21 - designable/antd/src/schemas/TimePicker.ts | 124 ----- designable/antd/src/schemas/Transfer.ts | 46 -- designable/antd/src/schemas/TreeSelect.ts | 139 ------ designable/antd/src/schemas/Upload.ts | 103 ---- designable/antd/src/schemas/index.ts | 27 - designable/antd/src/shared.ts | 116 ----- designable/antd/src/sources/arrays.ts | 23 - designable/antd/src/sources/displays.ts | 11 - designable/antd/src/sources/index.ts | 4 - designable/antd/src/sources/inputs.ts | 192 -------- designable/antd/src/sources/layouts.ts | 49 -- designable/antd/tsconfig.build.json | 14 - designable/antd/tsconfig.json | 5 - designable/next/.npmignore | 11 - designable/next/.umirc.js | 44 -- designable/next/LICENSE.md | 20 - designable/next/README.md | 7 - designable/next/copy.ts | 6 - designable/next/package.json | 72 --- designable/next/playground/main.tsx | 139 ------ designable/next/playground/service/index.ts | 1 - designable/next/playground/service/schema.ts | 27 - designable/next/playground/template.ejs | 20 - designable/next/playground/webpack.base.ts | 122 ----- designable/next/playground/webpack.dev.ts | 56 --- designable/next/playground/webpack.prod.ts | 40 -- .../next/playground/widgets/ActionsWidget.tsx | 49 -- .../next/playground/widgets/LogoWidget.tsx | 10 - .../playground/widgets/MarkupSchemaWidget.tsx | 157 ------ .../next/playground/widgets/PreviewWidget.tsx | 93 ---- .../playground/widgets/SchemaEditorWidget.tsx | 29 -- designable/next/playground/widgets/index.ts | 5 - designable/next/rollup.config.js | 27 - .../components/DesignableArrayCards/index.tsx | 245 --------- .../DesignableArrayCards/styles.less | 5 - .../DesignableArrayCollapse/index.tsx | 0 .../components/DesignableArrayItems/index.tsx | 0 .../components/DesignableArrayTable/index.tsx | 329 ------------- .../DesignableArrayTable/styles.less | 5 - .../components/DesignableArrayTabs/index.tsx | 0 .../components/DesignableContainer/index.tsx | 20 - .../DesignableContainer/styles.less | 7 - .../src/components/DesignableField/index.tsx | 437 ----------------- .../src/components/DesignableField/options.ts | 186 ------- .../src/components/DesignableField/types.ts | 16 - .../src/components/DesignableForm/index.tsx | 61 --- .../src/components/DesignableForm/styles.scss | 40 -- .../DesignableFormCollapse/index.tsx | 117 ----- .../components/DesignableFormTab/index.tsx | 116 ----- .../src/components/DesignableObject/index.tsx | 10 - .../src/components/DesignableText/index.tsx | 25 - .../src/components/DesignableText/styles.less | 10 - .../next/src/components/Droppable/index.tsx | 21 - .../next/src/components/Droppable/styles.less | 9 - .../src/components/FormItemSwitcher/index.tsx | 18 - .../src/components/LoadTemplate/index.tsx | 47 -- .../src/components/LoadTemplate/styles.scss | 35 -- designable/next/src/components/index.ts | 2 - designable/next/src/hooks/index.ts | 1 - designable/next/src/hooks/useDropTemplate.ts | 28 -- designable/next/src/index.ts | 3 - designable/next/src/locales/en-US/Array.ts | 31 -- .../next/src/locales/en-US/ArrayCards.ts | 6 - .../next/src/locales/en-US/ArrayTable.ts | 54 -- designable/next/src/locales/en-US/Card.ts | 8 - designable/next/src/locales/en-US/Cascader.ts | 11 - designable/next/src/locales/en-US/Checkbox.ts | 5 - designable/next/src/locales/en-US/Common.ts | 68 --- .../next/src/locales/en-US/DatePicker.ts | 21 - designable/next/src/locales/en-US/Field.ts | 38 -- .../next/src/locales/en-US/FormCollapse.ts | 10 - designable/next/src/locales/en-US/FormGrid.ts | 10 - designable/next/src/locales/en-US/FormItem.ts | 8 - .../next/src/locales/en-US/FormLayout.ts | 35 -- designable/next/src/locales/en-US/FormTab.ts | 29 -- designable/next/src/locales/en-US/Input.ts | 26 - .../next/src/locales/en-US/NumberPicker.ts | 16 - designable/next/src/locales/en-US/Password.ts | 3 - designable/next/src/locales/en-US/Radio.ts | 10 - designable/next/src/locales/en-US/Range.ts | 32 -- designable/next/src/locales/en-US/Rating.ts | 11 - designable/next/src/locales/en-US/Select.ts | 28 -- designable/next/src/locales/en-US/Space.ts | 10 - designable/next/src/locales/en-US/Style.ts | 15 - designable/next/src/locales/en-US/Switch.ts | 10 - designable/next/src/locales/en-US/Text.ts | 9 - .../next/src/locales/en-US/TimePicker.ts | 11 - designable/next/src/locales/en-US/Transfer.ts | 16 - .../next/src/locales/en-US/TreeSelect.ts | 26 - designable/next/src/locales/en-US/Upload.ts | 30 -- designable/next/src/locales/en-US/index.ts | 110 ----- designable/next/src/locales/index.ts | 8 - designable/next/src/locales/types.ts | 12 - designable/next/src/locales/zh-CN/Array.ts | 31 -- .../next/src/locales/zh-CN/ArrayCards.ts | 6 - .../next/src/locales/zh-CN/ArrayTable.ts | 52 -- designable/next/src/locales/zh-CN/Card.ts | 8 - designable/next/src/locales/zh-CN/Cascader.ts | 11 - designable/next/src/locales/zh-CN/Checkbox.ts | 5 - designable/next/src/locales/zh-CN/Common.ts | 65 --- .../next/src/locales/zh-CN/DatePicker.ts | 21 - designable/next/src/locales/zh-CN/Field.ts | 37 -- .../next/src/locales/zh-CN/FormCollapse.ts | 10 - designable/next/src/locales/zh-CN/FormGrid.ts | 10 - designable/next/src/locales/zh-CN/FormItem.ts | 8 - .../next/src/locales/zh-CN/FormLayout.ts | 35 -- designable/next/src/locales/zh-CN/FormTab.ts | 29 -- designable/next/src/locales/zh-CN/Input.ts | 24 - .../next/src/locales/zh-CN/NumberPicker.ts | 16 - designable/next/src/locales/zh-CN/Password.ts | 3 - designable/next/src/locales/zh-CN/Radio.ts | 10 - designable/next/src/locales/zh-CN/Range.ts | 31 -- designable/next/src/locales/zh-CN/Rating.ts | 11 - designable/next/src/locales/zh-CN/Select.ts | 32 -- designable/next/src/locales/zh-CN/Space.ts | 10 - designable/next/src/locales/zh-CN/Style.ts | 15 - designable/next/src/locales/zh-CN/Switch.ts | 10 - designable/next/src/locales/zh-CN/Text.ts | 9 - .../next/src/locales/zh-CN/TimePicker.ts | 11 - designable/next/src/locales/zh-CN/Transfer.ts | 16 - .../next/src/locales/zh-CN/TreeSelect.ts | 21 - designable/next/src/locales/zh-CN/Upload.ts | 30 -- designable/next/src/locales/zh-CN/index.ts | 110 ----- designable/next/src/schemas/ArrayCards.ts | 5 - designable/next/src/schemas/ArrayTable.ts | 181 ------- designable/next/src/schemas/CSSStyle.ts | 51 -- designable/next/src/schemas/Card.ts | 42 -- designable/next/src/schemas/Cascader.ts | 64 --- designable/next/src/schemas/Checkbox.ts | 22 - designable/next/src/schemas/DatePicker.ts | 84 ---- designable/next/src/schemas/Form.ts | 11 - designable/next/src/schemas/FormCollapse.ts | 23 - designable/next/src/schemas/FormGrid.ts | 65 --- designable/next/src/schemas/FormItem.ts | 140 ------ designable/next/src/schemas/FormLayout.ts | 123 ----- designable/next/src/schemas/FormTab.ts | 98 ---- designable/next/src/schemas/Input.ts | 166 ------- designable/next/src/schemas/NumberPicker.ts | 89 ---- designable/next/src/schemas/Password.ts | 7 - designable/next/src/schemas/Radio.ts | 49 -- designable/next/src/schemas/Range.ts | 82 ---- designable/next/src/schemas/Rating.ts | 36 -- designable/next/src/schemas/Select.ts | 183 ------- designable/next/src/schemas/Space.ts | 41 -- designable/next/src/schemas/Switch.ts | 31 -- designable/next/src/schemas/Text.ts | 21 - designable/next/src/schemas/TimePicker.ts | 64 --- designable/next/src/schemas/Transfer.ts | 81 --- designable/next/src/schemas/TreeSelect.ts | 104 ---- designable/next/src/schemas/Upload.ts | 111 ----- designable/next/src/schemas/index.ts | 27 - designable/next/src/shared.ts | 116 ----- designable/next/src/sources/arrays.ts | 23 - designable/next/src/sources/displays.ts | 11 - designable/next/src/sources/index.ts | 4 - designable/next/src/sources/inputs.ts | 192 -------- designable/next/src/sources/layouts.ts | 50 -- designable/next/tsconfig.build.json | 14 - designable/next/tsconfig.json | 5 - designable/setters/.npmignore | 11 - designable/setters/.umirc.js | 44 -- designable/setters/LICENSE.md | 20 - designable/setters/README.md | 7 - designable/setters/copy.ts | 6 - designable/setters/package.json | 55 --- designable/setters/rollup.config.js | 24 - .../DataSourceSetter/DataSettingPanel.tsx | 122 ----- .../components/DataSourceSetter/Header.tsx | 19 - .../src/components/DataSourceSetter/Title.tsx | 64 --- .../components/DataSourceSetter/TreePanel.tsx | 129 ----- .../src/components/DataSourceSetter/index.tsx | 73 --- .../src/components/DataSourceSetter/shared.ts | 56 --- .../components/DataSourceSetter/styles.less | 81 --- .../src/components/DataSourceSetter/types.ts | 17 - .../ReactionsSetter/FieldPropertySetter.tsx | 136 ----- .../ReactionsSetter/PathSelector.tsx | 113 ----- .../ReactionsSetter/declarations.ts | 62 --- .../src/components/ReactionsSetter/helpers.ts | 393 --------------- .../src/components/ReactionsSetter/index.tsx | 435 ---------------- .../components/ReactionsSetter/properties.ts | 51 -- .../components/ReactionsSetter/styles.less | 105 ---- .../src/components/ReactionsSetter/types.ts | 13 - .../src/components/ValidatorSetter/index.tsx | 172 ------- designable/setters/src/components/index.ts | 3 - designable/setters/src/index.ts | 2 - designable/setters/src/locales/en-US.ts | 105 ---- designable/setters/src/locales/index.ts | 5 - designable/setters/src/locales/zh-CN.ts | 103 ---- designable/setters/tsconfig.build.json | 14 - designable/setters/tsconfig.json | 5 - docs/guide/form-builder.md | 299 +++++------ docs/guide/form-builder.zh-CN.md | 273 ++++++----- 267 files changed, 293 insertions(+), 15365 deletions(-) delete mode 100644 designable/.eslintrc delete mode 100644 designable/antd/.npmignore delete mode 100644 designable/antd/.umirc.js delete mode 100644 designable/antd/LICENSE.md delete mode 100644 designable/antd/README.md delete mode 100644 designable/antd/copy.ts delete mode 100644 designable/antd/package.json delete mode 100644 designable/antd/playground/main.tsx delete mode 100644 designable/antd/playground/service/index.ts delete mode 100644 designable/antd/playground/service/schema.ts delete mode 100644 designable/antd/playground/template.ejs delete mode 100644 designable/antd/playground/webpack.base.ts delete mode 100644 designable/antd/playground/webpack.dev.ts delete mode 100644 designable/antd/playground/webpack.prod.ts delete mode 100644 designable/antd/playground/widgets/ActionsWidget.tsx delete mode 100644 designable/antd/playground/widgets/LogoWidget.tsx delete mode 100644 designable/antd/playground/widgets/MarkupSchemaWidget.tsx delete mode 100644 designable/antd/playground/widgets/PreviewWidget.tsx delete mode 100644 designable/antd/playground/widgets/SchemaEditorWidget.tsx delete mode 100644 designable/antd/playground/widgets/index.ts delete mode 100644 designable/antd/rollup.config.js delete mode 100644 designable/antd/src/components/DesignableArrayCards/index.tsx delete mode 100644 designable/antd/src/components/DesignableArrayCards/styles.less delete mode 100644 designable/antd/src/components/DesignableArrayCollapse/index.tsx delete mode 100644 designable/antd/src/components/DesignableArrayItems/index.tsx delete mode 100644 designable/antd/src/components/DesignableArrayTable/index.tsx delete mode 100644 designable/antd/src/components/DesignableArrayTable/styles.less delete mode 100644 designable/antd/src/components/DesignableArrayTabs/index.tsx delete mode 100644 designable/antd/src/components/DesignableContainer/index.tsx delete mode 100644 designable/antd/src/components/DesignableContainer/styles.less delete mode 100644 designable/antd/src/components/DesignableField/index.tsx delete mode 100644 designable/antd/src/components/DesignableField/options.ts delete mode 100644 designable/antd/src/components/DesignableField/types.ts delete mode 100644 designable/antd/src/components/DesignableForm/index.tsx delete mode 100644 designable/antd/src/components/DesignableForm/styles.less delete mode 100644 designable/antd/src/components/DesignableFormCollapse/index.tsx delete mode 100644 designable/antd/src/components/DesignableFormTab/index.tsx delete mode 100644 designable/antd/src/components/DesignableObject/index.tsx delete mode 100644 designable/antd/src/components/DesignableText/index.tsx delete mode 100644 designable/antd/src/components/DesignableText/styles.less delete mode 100644 designable/antd/src/components/Droppable/index.tsx delete mode 100644 designable/antd/src/components/Droppable/styles.less delete mode 100644 designable/antd/src/components/FormItemSwitcher/index.tsx delete mode 100644 designable/antd/src/components/LoadTemplate/index.tsx delete mode 100644 designable/antd/src/components/LoadTemplate/styles.less delete mode 100644 designable/antd/src/components/index.ts delete mode 100644 designable/antd/src/hooks/index.ts delete mode 100644 designable/antd/src/hooks/useDropTemplate.ts delete mode 100644 designable/antd/src/index.ts delete mode 100644 designable/antd/src/locales/en-US.ts delete mode 100644 designable/antd/src/locales/index.ts delete mode 100644 designable/antd/src/locales/zh-CN.ts delete mode 100644 designable/antd/src/schemas/ArrayCards.ts delete mode 100644 designable/antd/src/schemas/ArrayTable.ts delete mode 100644 designable/antd/src/schemas/CSSStyle.ts delete mode 100644 designable/antd/src/schemas/Card.ts delete mode 100644 designable/antd/src/schemas/Cascader.ts delete mode 100644 designable/antd/src/schemas/Checkbox.ts delete mode 100644 designable/antd/src/schemas/DatePicker.ts delete mode 100644 designable/antd/src/schemas/Form.ts delete mode 100644 designable/antd/src/schemas/FormCollapse.ts delete mode 100644 designable/antd/src/schemas/FormGrid.ts delete mode 100644 designable/antd/src/schemas/FormItem.ts delete mode 100644 designable/antd/src/schemas/FormLayout.ts delete mode 100644 designable/antd/src/schemas/FormTab.ts delete mode 100644 designable/antd/src/schemas/Input.ts delete mode 100644 designable/antd/src/schemas/NumberPicker.ts delete mode 100644 designable/antd/src/schemas/Password.ts delete mode 100644 designable/antd/src/schemas/Radio.ts delete mode 100644 designable/antd/src/schemas/Rate.ts delete mode 100644 designable/antd/src/schemas/Select.ts delete mode 100644 designable/antd/src/schemas/Slider.ts delete mode 100644 designable/antd/src/schemas/Space.ts delete mode 100644 designable/antd/src/schemas/Switch.ts delete mode 100644 designable/antd/src/schemas/Text.ts delete mode 100644 designable/antd/src/schemas/TimePicker.ts delete mode 100644 designable/antd/src/schemas/Transfer.ts delete mode 100644 designable/antd/src/schemas/TreeSelect.ts delete mode 100644 designable/antd/src/schemas/Upload.ts delete mode 100644 designable/antd/src/schemas/index.ts delete mode 100644 designable/antd/src/shared.ts delete mode 100644 designable/antd/src/sources/arrays.ts delete mode 100644 designable/antd/src/sources/displays.ts delete mode 100644 designable/antd/src/sources/index.ts delete mode 100644 designable/antd/src/sources/inputs.ts delete mode 100644 designable/antd/src/sources/layouts.ts delete mode 100644 designable/antd/tsconfig.build.json delete mode 100644 designable/antd/tsconfig.json delete mode 100644 designable/next/.npmignore delete mode 100644 designable/next/.umirc.js delete mode 100644 designable/next/LICENSE.md delete mode 100644 designable/next/README.md delete mode 100644 designable/next/copy.ts delete mode 100644 designable/next/package.json delete mode 100644 designable/next/playground/main.tsx delete mode 100644 designable/next/playground/service/index.ts delete mode 100644 designable/next/playground/service/schema.ts delete mode 100644 designable/next/playground/template.ejs delete mode 100644 designable/next/playground/webpack.base.ts delete mode 100644 designable/next/playground/webpack.dev.ts delete mode 100644 designable/next/playground/webpack.prod.ts delete mode 100644 designable/next/playground/widgets/ActionsWidget.tsx delete mode 100644 designable/next/playground/widgets/LogoWidget.tsx delete mode 100644 designable/next/playground/widgets/MarkupSchemaWidget.tsx delete mode 100644 designable/next/playground/widgets/PreviewWidget.tsx delete mode 100644 designable/next/playground/widgets/SchemaEditorWidget.tsx delete mode 100644 designable/next/playground/widgets/index.ts delete mode 100644 designable/next/rollup.config.js delete mode 100644 designable/next/src/components/DesignableArrayCards/index.tsx delete mode 100644 designable/next/src/components/DesignableArrayCards/styles.less delete mode 100644 designable/next/src/components/DesignableArrayCollapse/index.tsx delete mode 100644 designable/next/src/components/DesignableArrayItems/index.tsx delete mode 100644 designable/next/src/components/DesignableArrayTable/index.tsx delete mode 100644 designable/next/src/components/DesignableArrayTable/styles.less delete mode 100644 designable/next/src/components/DesignableArrayTabs/index.tsx delete mode 100644 designable/next/src/components/DesignableContainer/index.tsx delete mode 100644 designable/next/src/components/DesignableContainer/styles.less delete mode 100644 designable/next/src/components/DesignableField/index.tsx delete mode 100644 designable/next/src/components/DesignableField/options.ts delete mode 100644 designable/next/src/components/DesignableField/types.ts delete mode 100644 designable/next/src/components/DesignableForm/index.tsx delete mode 100644 designable/next/src/components/DesignableForm/styles.scss delete mode 100644 designable/next/src/components/DesignableFormCollapse/index.tsx delete mode 100644 designable/next/src/components/DesignableFormTab/index.tsx delete mode 100644 designable/next/src/components/DesignableObject/index.tsx delete mode 100644 designable/next/src/components/DesignableText/index.tsx delete mode 100644 designable/next/src/components/DesignableText/styles.less delete mode 100644 designable/next/src/components/Droppable/index.tsx delete mode 100644 designable/next/src/components/Droppable/styles.less delete mode 100644 designable/next/src/components/FormItemSwitcher/index.tsx delete mode 100644 designable/next/src/components/LoadTemplate/index.tsx delete mode 100644 designable/next/src/components/LoadTemplate/styles.scss delete mode 100644 designable/next/src/components/index.ts delete mode 100644 designable/next/src/hooks/index.ts delete mode 100644 designable/next/src/hooks/useDropTemplate.ts delete mode 100644 designable/next/src/index.ts delete mode 100644 designable/next/src/locales/en-US/Array.ts delete mode 100644 designable/next/src/locales/en-US/ArrayCards.ts delete mode 100644 designable/next/src/locales/en-US/ArrayTable.ts delete mode 100644 designable/next/src/locales/en-US/Card.ts delete mode 100644 designable/next/src/locales/en-US/Cascader.ts delete mode 100644 designable/next/src/locales/en-US/Checkbox.ts delete mode 100644 designable/next/src/locales/en-US/Common.ts delete mode 100644 designable/next/src/locales/en-US/DatePicker.ts delete mode 100644 designable/next/src/locales/en-US/Field.ts delete mode 100644 designable/next/src/locales/en-US/FormCollapse.ts delete mode 100644 designable/next/src/locales/en-US/FormGrid.ts delete mode 100644 designable/next/src/locales/en-US/FormItem.ts delete mode 100644 designable/next/src/locales/en-US/FormLayout.ts delete mode 100644 designable/next/src/locales/en-US/FormTab.ts delete mode 100644 designable/next/src/locales/en-US/Input.ts delete mode 100644 designable/next/src/locales/en-US/NumberPicker.ts delete mode 100644 designable/next/src/locales/en-US/Password.ts delete mode 100644 designable/next/src/locales/en-US/Radio.ts delete mode 100644 designable/next/src/locales/en-US/Range.ts delete mode 100644 designable/next/src/locales/en-US/Rating.ts delete mode 100644 designable/next/src/locales/en-US/Select.ts delete mode 100644 designable/next/src/locales/en-US/Space.ts delete mode 100644 designable/next/src/locales/en-US/Style.ts delete mode 100644 designable/next/src/locales/en-US/Switch.ts delete mode 100644 designable/next/src/locales/en-US/Text.ts delete mode 100644 designable/next/src/locales/en-US/TimePicker.ts delete mode 100644 designable/next/src/locales/en-US/Transfer.ts delete mode 100644 designable/next/src/locales/en-US/TreeSelect.ts delete mode 100644 designable/next/src/locales/en-US/Upload.ts delete mode 100644 designable/next/src/locales/en-US/index.ts delete mode 100644 designable/next/src/locales/index.ts delete mode 100644 designable/next/src/locales/types.ts delete mode 100644 designable/next/src/locales/zh-CN/Array.ts delete mode 100644 designable/next/src/locales/zh-CN/ArrayCards.ts delete mode 100644 designable/next/src/locales/zh-CN/ArrayTable.ts delete mode 100644 designable/next/src/locales/zh-CN/Card.ts delete mode 100644 designable/next/src/locales/zh-CN/Cascader.ts delete mode 100644 designable/next/src/locales/zh-CN/Checkbox.ts delete mode 100644 designable/next/src/locales/zh-CN/Common.ts delete mode 100644 designable/next/src/locales/zh-CN/DatePicker.ts delete mode 100644 designable/next/src/locales/zh-CN/Field.ts delete mode 100644 designable/next/src/locales/zh-CN/FormCollapse.ts delete mode 100644 designable/next/src/locales/zh-CN/FormGrid.ts delete mode 100644 designable/next/src/locales/zh-CN/FormItem.ts delete mode 100644 designable/next/src/locales/zh-CN/FormLayout.ts delete mode 100644 designable/next/src/locales/zh-CN/FormTab.ts delete mode 100644 designable/next/src/locales/zh-CN/Input.ts delete mode 100644 designable/next/src/locales/zh-CN/NumberPicker.ts delete mode 100644 designable/next/src/locales/zh-CN/Password.ts delete mode 100644 designable/next/src/locales/zh-CN/Radio.ts delete mode 100644 designable/next/src/locales/zh-CN/Range.ts delete mode 100644 designable/next/src/locales/zh-CN/Rating.ts delete mode 100644 designable/next/src/locales/zh-CN/Select.ts delete mode 100644 designable/next/src/locales/zh-CN/Space.ts delete mode 100644 designable/next/src/locales/zh-CN/Style.ts delete mode 100644 designable/next/src/locales/zh-CN/Switch.ts delete mode 100644 designable/next/src/locales/zh-CN/Text.ts delete mode 100644 designable/next/src/locales/zh-CN/TimePicker.ts delete mode 100644 designable/next/src/locales/zh-CN/Transfer.ts delete mode 100644 designable/next/src/locales/zh-CN/TreeSelect.ts delete mode 100644 designable/next/src/locales/zh-CN/Upload.ts delete mode 100644 designable/next/src/locales/zh-CN/index.ts delete mode 100644 designable/next/src/schemas/ArrayCards.ts delete mode 100644 designable/next/src/schemas/ArrayTable.ts delete mode 100644 designable/next/src/schemas/CSSStyle.ts delete mode 100644 designable/next/src/schemas/Card.ts delete mode 100644 designable/next/src/schemas/Cascader.ts delete mode 100644 designable/next/src/schemas/Checkbox.ts delete mode 100644 designable/next/src/schemas/DatePicker.ts delete mode 100644 designable/next/src/schemas/Form.ts delete mode 100644 designable/next/src/schemas/FormCollapse.ts delete mode 100644 designable/next/src/schemas/FormGrid.ts delete mode 100644 designable/next/src/schemas/FormItem.ts delete mode 100644 designable/next/src/schemas/FormLayout.ts delete mode 100644 designable/next/src/schemas/FormTab.ts delete mode 100644 designable/next/src/schemas/Input.ts delete mode 100644 designable/next/src/schemas/NumberPicker.ts delete mode 100644 designable/next/src/schemas/Password.ts delete mode 100644 designable/next/src/schemas/Radio.ts delete mode 100644 designable/next/src/schemas/Range.ts delete mode 100644 designable/next/src/schemas/Rating.ts delete mode 100644 designable/next/src/schemas/Select.ts delete mode 100644 designable/next/src/schemas/Space.ts delete mode 100644 designable/next/src/schemas/Switch.ts delete mode 100644 designable/next/src/schemas/Text.ts delete mode 100644 designable/next/src/schemas/TimePicker.ts delete mode 100644 designable/next/src/schemas/Transfer.ts delete mode 100644 designable/next/src/schemas/TreeSelect.ts delete mode 100644 designable/next/src/schemas/Upload.ts delete mode 100644 designable/next/src/schemas/index.ts delete mode 100644 designable/next/src/shared.ts delete mode 100644 designable/next/src/sources/arrays.ts delete mode 100644 designable/next/src/sources/displays.ts delete mode 100644 designable/next/src/sources/index.ts delete mode 100644 designable/next/src/sources/inputs.ts delete mode 100644 designable/next/src/sources/layouts.ts delete mode 100644 designable/next/tsconfig.build.json delete mode 100644 designable/next/tsconfig.json delete mode 100644 designable/setters/.npmignore delete mode 100644 designable/setters/.umirc.js delete mode 100644 designable/setters/LICENSE.md delete mode 100644 designable/setters/README.md delete mode 100644 designable/setters/copy.ts delete mode 100644 designable/setters/package.json delete mode 100644 designable/setters/rollup.config.js delete mode 100644 designable/setters/src/components/DataSourceSetter/DataSettingPanel.tsx delete mode 100644 designable/setters/src/components/DataSourceSetter/Header.tsx delete mode 100644 designable/setters/src/components/DataSourceSetter/Title.tsx delete mode 100644 designable/setters/src/components/DataSourceSetter/TreePanel.tsx delete mode 100644 designable/setters/src/components/DataSourceSetter/index.tsx delete mode 100644 designable/setters/src/components/DataSourceSetter/shared.ts delete mode 100644 designable/setters/src/components/DataSourceSetter/styles.less delete mode 100644 designable/setters/src/components/DataSourceSetter/types.ts delete mode 100644 designable/setters/src/components/ReactionsSetter/FieldPropertySetter.tsx delete mode 100644 designable/setters/src/components/ReactionsSetter/PathSelector.tsx delete mode 100644 designable/setters/src/components/ReactionsSetter/declarations.ts delete mode 100644 designable/setters/src/components/ReactionsSetter/helpers.ts delete mode 100644 designable/setters/src/components/ReactionsSetter/index.tsx delete mode 100644 designable/setters/src/components/ReactionsSetter/properties.ts delete mode 100644 designable/setters/src/components/ReactionsSetter/styles.less delete mode 100644 designable/setters/src/components/ReactionsSetter/types.ts delete mode 100644 designable/setters/src/components/ValidatorSetter/index.tsx delete mode 100644 designable/setters/src/components/index.ts delete mode 100644 designable/setters/src/index.ts delete mode 100644 designable/setters/src/locales/en-US.ts delete mode 100644 designable/setters/src/locales/index.ts delete mode 100644 designable/setters/src/locales/zh-CN.ts delete mode 100644 designable/setters/tsconfig.build.json delete mode 100644 designable/setters/tsconfig.json diff --git a/designable/.eslintrc b/designable/.eslintrc deleted file mode 100644 index 018630faf56..00000000000 --- a/designable/.eslintrc +++ /dev/null @@ -1,74 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "extends": [ - "plugin:react/recommended", - "plugin:@typescript-eslint/recommended", - "prettier/@typescript-eslint", - "plugin:markdown/recommended" - ], - "env": { - "node": true - }, - "plugins": ["@typescript-eslint", "react", "prettier", "markdown"], - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 10, - "ecmaFeatures": { - "jsx": true - } - }, - "settings": { - "react": { - "version": "detect" - } - }, - "rules": { - "prettier/prettier": 0, - // don't force es6 functions to include space before paren - "space-before-function-paren": 0, - "react/prop-types": 0, - "react/no-find-dom-node": 0, - "react/display-name": 0, - // allow specifying true explicitly for boolean props - "react/jsx-boolean-value": 0, - "react/no-did-update-set-state": 0, - // maybe we should no-public - "@typescript-eslint/explicit-member-accessibility": 0, - "@typescript-eslint/interface-name-prefix": 0, - "@typescript-eslint/no-explicit-any": 0, - "@typescript-eslint/explicit-function-return-type": 0, - "@typescript-eslint/no-parameter-properties": 0, - "@typescript-eslint/array-type": 0, - "@typescript-eslint/no-object-literal-type-assertion": 0, - "@typescript-eslint/no-use-before-define": 0, - "@typescript-eslint/no-unused-vars": 1, - "@typescript-eslint/no-namespace": 0, - "@typescript-eslint/ban-types": 0, - "@typescript-eslint/adjacent-overload-signatures": 0, - "@typescript-eslint/explicit-module-boundary-types": 0, - "@typescript-eslint/no-empty-function": 0, - "no-console": [ - "error", - { - "allow": ["warn", "error", "info"] - } - ], - "prefer-const": 0, - "no-var": 1, - "prefer-rest-params": 0 - }, - "overrides": [ - { - "files": ["**/*.md"], - "processor": "markdown/markdown" - }, - { - "files": ["**/*.md/*.{jsx,tsx}"], - "rules": { - "@typescript-eslint/no-unused-vars": "error", - "no-unused-vars": "error", - "no-console": "off" - } - } - ] -} diff --git a/designable/antd/.npmignore b/designable/antd/.npmignore deleted file mode 100644 index 1ff337420fd..00000000000 --- a/designable/antd/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -*.log -build -docs -doc-site -__tests__ -.eslintrc -jest.config.js -tsconfig.json -.umi -src \ No newline at end of file diff --git a/designable/antd/.umirc.js b/designable/antd/.umirc.js deleted file mode 100644 index 1362b3c43c6..00000000000 --- a/designable/antd/.umirc.js +++ /dev/null @@ -1,44 +0,0 @@ -import { resolve } from 'path' -export default { - mode: 'site', - logo: '//img.alicdn.com/imgextra/i2/O1CN01Kq3OHU1fph6LGqjIz_!!6000000004056-55-tps-1141-150.svg', - title: 'Formily', - hash: true, - favicon: - '//img.alicdn.com/imgextra/i3/O1CN01XtT3Tv1Wd1b5hNVKy_!!6000000002810-55-tps-360-360.svg', - outputPath: './doc-site', - navs: [ - { - title: 'Ant Design', - path: '/components', - }, - { - title: '主站', - path: 'https://v2.formilyjs.org', - }, - { - title: 'GITHUB', - path: 'https://github.com/alibaba/formily', - }, - ], - styles: [ - `.__dumi-default-navbar-logo{ - height: 60px !important; - width: 150px !important; - padding-left:0 !important; - color: transparent !important; - } - .__dumi-default-navbar{ - padding: 0 28px !important; - } - .__dumi-default-layout-hero{ - background-image: url(//img.alicdn.com/imgextra/i4/O1CN01ZcvS4e26XMsdsCkf9_!!6000000007671-2-tps-6001-4001.png); - background-size: cover; - background-repeat: no-repeat; - } - nav a{ - text-decoration: none !important; - } - `, - ], -} diff --git a/designable/antd/LICENSE.md b/designable/antd/LICENSE.md deleted file mode 100644 index 509632e8e80..00000000000 --- a/designable/antd/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-present, Alibaba Group Holding Limited. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/designable/antd/README.md b/designable/antd/README.md deleted file mode 100644 index 84103eebdc5..00000000000 --- a/designable/antd/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# @formily/designable-antd - -### Install - -```bash -npm install --save @formily/designable-antd -``` diff --git a/designable/antd/copy.ts b/designable/antd/copy.ts deleted file mode 100644 index d451fc48651..00000000000 --- a/designable/antd/copy.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { runCopy } from '../../scripts/build-style' - -runCopy({ - esStr: 'antd/es/', - libStr: 'antd/lib/', -}) diff --git a/designable/antd/package.json b/designable/antd/package.json deleted file mode 100644 index e0bc10e1dbc..00000000000 --- a/designable/antd/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@formily/designable-antd", - "version": "2.0.0-rc.7", - "license": "MIT", - "main": "lib", - "module": "esm", - "umd:main": "dist/formily.designable.antd.umd.production.js", - "unpkg": "dist/formily.designable.umd.production.js", - "jsdelivr": "dist/formily.designable.umd.production.js", - "jsnext:main": "esm", - "repository": { - "type": "git", - "url": "git+https://github.com/alibaba/formily.git" - }, - "types": "esm/index.d.ts", - "bugs": { - "url": "https://github.com/alibaba/formily/issues" - }, - "homepage": "https://github.com/alibaba/formily#readme", - "engines": { - "npm": ">=3.0.0" - }, - "scripts": { - "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && npm run build:umd && ts-node copy", - "build:cjs": "tsc --project tsconfig.build.json", - "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm", - "build:umd": "rollup --config", - "build:playground": "webpack-cli --config playground/webpack.prod.ts", - "start": "webpack-dev-server --config playground/webpack.dev.ts" - }, - "devDependencies": { - "@designable/react-settings-form": "^0.x", - "autoprefixer": "^9.0", - "file-loader": "^5.0.2", - "fs-extra": "^8.1.0", - "html-webpack-plugin": "^3.2.0", - "mini-css-extract-plugin": "^1.6.0", - "monaco-editor-webpack-plugin": "^4.0.0", - "raw-loader": "^4.0.0", - "react-monaco-editor": "^0.43.0", - "style-loader": "^1.1.3", - "ts-loader": "^7.0.4", - "typescript": "4.1.5", - "webpack": "^4.41.5", - "webpack-bundle-analyzer": "^3.9.0", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.10.1" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 || >=17.0.0", - "@types/react-dom": ">=16.8.0 || >=17.0.0", - "antd": "^4.0.0", - "react": ">=16.8.0 || >=17.0.0", - "react-dom": ">=16.8.0", - "react-is": ">=16.8.0 || >=17.0.0" - }, - "dependencies": { - "@designable/core": "^0.x", - "@designable/formily": "^0.x", - "@designable/react": "^0.x", - "@formily/antd": "2.0.0-rc.7", - "@formily/core": "2.0.0-rc.7", - "@formily/designable-setters": "2.0.0-rc.7", - "@formily/react": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "2c44ae410a73f02735c63c6430e021a50e21f3ec" -} diff --git a/designable/antd/playground/main.tsx b/designable/antd/playground/main.tsx deleted file mode 100644 index df5f255f327..00000000000 --- a/designable/antd/playground/main.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom' -import { - Designer, - DesignerToolsWidget, - ViewToolsWidget, - Workspace, - OutlineTreeWidget, - DragSourceWidget, - HistoryWidget, - MainPanel, - CompositePanel, - WorkspacePanel, - ToolbarPanel, - ViewportPanel, - ViewPanel, - SettingsPanel, - ComponentTreeWidget, -} from '@designable/react' -import { SettingsForm } from '@designable/react-settings-form' -import { - createDesigner, - GlobalRegistry, - Shortcut, - KeyCode, -} from '@designable/core' -import { createDesignableField, createDesignableForm } from '../src' -import { - LogoWidget, - ActionsWidget, - PreviewWidget, - SchemaEditorWidget, - MarkupSchemaWidget, -} from './widgets' -import { saveSchema } from './service' -import 'antd/dist/antd.less' -GlobalRegistry.registerDesignerLocales({ - 'zh-CN': { - sources: { - Inputs: '输入控件', - Layouts: '布局组件', - Arrays: '自增组件', - Displays: '展示组件', - }, - }, - 'en-US': { - sources: { - Inputs: 'Inputs', - Layouts: 'Layouts', - Arrays: 'Arrays', - Displays: 'Displays', - }, - }, -}) - -const Root = createDesignableForm({ - registryName: 'Root', -}) - -const DesignableField = createDesignableField({ - registryName: 'DesignableField', -}) - -const SaveShortCut = new Shortcut({ - codes: [ - [KeyCode.Meta, KeyCode.S], - [KeyCode.Control, KeyCode.S], - ], - handler(ctx) { - saveSchema(ctx.engine) - }, -}) - -const engine = createDesigner({ - shortcuts: [SaveShortCut], -}) - -const App = () => { - return ( - - } actions={}> - - - - - - - - - - - - - - - - - - - - - - - {() => ( - - )} - - - {(tree, onChange) => ( - - )} - - - {(tree) => } - - - {(tree) => } - - - - - - - - - - ) -} - -ReactDOM.render(, document.getElementById('root')) diff --git a/designable/antd/playground/service/index.ts b/designable/antd/playground/service/index.ts deleted file mode 100644 index cb7cdd48bd0..00000000000 --- a/designable/antd/playground/service/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './schema' diff --git a/designable/antd/playground/service/schema.ts b/designable/antd/playground/service/schema.ts deleted file mode 100644 index 1c7b2c63996..00000000000 --- a/designable/antd/playground/service/schema.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Engine } from '@designable/core' -import { transformToSchema, transformToTreeNode } from '@designable/formily' -import { message } from 'antd' - -export const saveSchema = (designer: Engine) => { - localStorage.setItem( - 'formily-schema', - JSON.stringify( - transformToSchema(designer.getCurrentTree(), { - designableFieldName: 'DesignableField', - designableFormName: 'Root', - }) - ) - ) - message.success('Save Success') -} - -export const loadInitialSchema = (designer: Engine) => { - try { - designer.setCurrentTree( - transformToTreeNode(JSON.parse(localStorage.getItem('formily-schema')), { - designableFieldName: 'DesignableField', - designableFormName: 'Root', - }) - ) - } catch {} -} diff --git a/designable/antd/playground/template.ejs b/designable/antd/playground/template.ejs deleted file mode 100644 index 4ea62ab0bcd..00000000000 --- a/designable/antd/playground/template.ejs +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Designable Playground - - - - -
-
- - - - - \ No newline at end of file diff --git a/designable/antd/playground/webpack.base.ts b/designable/antd/playground/webpack.base.ts deleted file mode 100644 index 1fe60d689fb..00000000000 --- a/designable/antd/playground/webpack.base.ts +++ /dev/null @@ -1,104 +0,0 @@ -import path from 'path' -import fs from 'fs-extra' -import { GlobSync } from 'glob' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' -import autoprefixer from 'autoprefixer' -//import { getThemeVariables } from 'antd/dist/theme' - -const getWorkspaceAlias = () => { - const basePath = path.resolve(__dirname, '../../../') - const pkg = fs.readJSONSync(path.resolve(basePath, 'package.json')) || {} - const results = {} - const workspaces = pkg.workspaces - if (Array.isArray(workspaces)) { - workspaces.forEach((pattern) => { - const { found } = new GlobSync(pattern, { cwd: basePath }) - found.forEach((name) => { - const pkg = fs.readJSONSync( - path.resolve(basePath, name, './package.json') - ) - results[pkg.name] = path.resolve(basePath, name, './src') - }) - }) - } - return results -} - -export default { - mode: 'development', - devtool: 'inline-source-map', // 嵌入到源文件中 - stats: { - entrypoints: false, - children: false, - }, - entry: { - playground: path.resolve(__dirname, './main'), - }, - output: { - path: path.resolve(__dirname, '../build'), - filename: '[name].[hash].bundle.js', - }, - resolve: { - modules: ['node_modules'], - extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'], - alias: getWorkspaceAlias(), - }, - externals: { - react: 'React', - 'react-dom': 'ReactDOM', - moment: 'moment', - antd: 'antd', - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: [ - { - loader: require.resolve('ts-loader'), - options: { - transpileOnly: true, - }, - }, - ], - }, - { - test: /\.css$/, - use: [MiniCssExtractPlugin.loader, require.resolve('css-loader')], - }, - { - test: /\.less$/, - use: [ - MiniCssExtractPlugin.loader, - { loader: 'css-loader' }, - { - loader: 'postcss-loader', - options: { - plugins: () => autoprefixer(), - }, - }, - { - loader: 'less-loader', - options: { - // modifyVars: getThemeVariables({ - // dark: true, // 开启暗黑模式 - // }), - javascriptEnabled: true, - }, - }, - ], - }, - { - test: /\.(woff|woff2|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/, - use: ['url-loader'], - }, - { - test: /\.html?$/, - loader: require.resolve('file-loader'), - options: { - name: '[name].[ext]', - }, - }, - ], - }, -} diff --git a/designable/antd/playground/webpack.dev.ts b/designable/antd/playground/webpack.dev.ts deleted file mode 100644 index 710c0570dae..00000000000 --- a/designable/antd/playground/webpack.dev.ts +++ /dev/null @@ -1,56 +0,0 @@ -import baseConfig from './webpack.base' -import HtmlWebpackPlugin from 'html-webpack-plugin' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' -import MonacoPlugin from 'monaco-editor-webpack-plugin' -//import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' -import webpack from 'webpack' -import path from 'path' - -const PORT = 3000 - -const createPages = (pages) => { - return pages.map(({ filename, template, chunk }) => { - return new HtmlWebpackPlugin({ - filename, - template, - inject: 'body', - chunks: chunk, - }) - }) -} - -for (const key in baseConfig.entry) { - if (Array.isArray(baseConfig.entry[key])) { - baseConfig.entry[key].push( - require.resolve('webpack/hot/dev-server'), - `${require.resolve('webpack-dev-server/client')}?http://localhost:${PORT}` - ) - } -} - -export default { - ...baseConfig, - plugins: [ - new MiniCssExtractPlugin({ - filename: '[name].[hash].css', - chunkFilename: '[id].[hash].css', - }), - ...createPages([ - { - filename: 'index.html', - template: path.resolve(__dirname, './template.ejs'), - chunk: ['playground'], - }, - ]), - new webpack.HotModuleReplacementPlugin(), - new MonacoPlugin({ - languages: ['json'], - }), - // new BundleAnalyzerPlugin() - ], - devServer: { - host: '127.0.0.1', - open: true, - port: PORT, - }, -} diff --git a/designable/antd/playground/webpack.prod.ts b/designable/antd/playground/webpack.prod.ts deleted file mode 100644 index 520f909e4f0..00000000000 --- a/designable/antd/playground/webpack.prod.ts +++ /dev/null @@ -1,40 +0,0 @@ -import baseConfig from './webpack.base' -import HtmlWebpackPlugin from 'html-webpack-plugin' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' -import MonacoPlugin from 'monaco-editor-webpack-plugin' -import path from 'path' - -const createPages = (pages) => { - return pages.map(({ filename, template, chunk }) => { - return new HtmlWebpackPlugin({ - filename, - template, - inject: 'body', - chunks: chunk, - }) - }) -} - -export default { - ...baseConfig, - mode: 'production', - plugins: [ - new MiniCssExtractPlugin({ - filename: '[name].[hash].css', - chunkFilename: '[id].[hash].css', - }), - ...createPages([ - { - filename: 'index.html', - template: path.resolve(__dirname, './template.ejs'), - chunk: ['playground'], - }, - ]), - new MonacoPlugin({ - languages: ['json'], - }), - ], - optimization: { - minimize: true, - }, -} diff --git a/designable/antd/playground/widgets/ActionsWidget.tsx b/designable/antd/playground/widgets/ActionsWidget.tsx deleted file mode 100644 index e9cc15e1341..00000000000 --- a/designable/antd/playground/widgets/ActionsWidget.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React, { useEffect } from 'react' -import { Space, Button, Radio } from 'antd' -import { GithubOutlined } from '@ant-design/icons' -import { useDesigner, TextWidget } from '@designable/react' -import { GlobalRegistry } from '@designable/core' -import { observer } from '@formily/react' -import { loadInitialSchema, saveSchema } from '../service' - -export const ActionsWidget = observer(() => { - const designer = useDesigner() - useEffect(() => { - loadInitialSchema(designer) - }, []) - return ( - - - { - GlobalRegistry.setDesignerLanguage(e.target.value) - }} - /> - - - - - ) -}) diff --git a/designable/antd/playground/widgets/LogoWidget.tsx b/designable/antd/playground/widgets/LogoWidget.tsx deleted file mode 100644 index a6b86de416c..00000000000 --- a/designable/antd/playground/widgets/LogoWidget.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react' -import { useTheme } from '@designable/react' - -const logo = { - dark: '//img.alicdn.com/imgextra/i2/O1CN01NTUDi81fHLQvZCPnc_!!6000000003981-55-tps-1141-150.svg', - light: - '//img.alicdn.com/imgextra/i2/O1CN01Kq3OHU1fph6LGqjIz_!!6000000004056-55-tps-1141-150.svg', -} - -export const LogoWidget: React.FC = () => { - const url = logo[useTheme()] - return ( -
- -
- ) -} diff --git a/designable/antd/playground/widgets/MarkupSchemaWidget.tsx b/designable/antd/playground/widgets/MarkupSchemaWidget.tsx deleted file mode 100644 index 0331628d258..00000000000 --- a/designable/antd/playground/widgets/MarkupSchemaWidget.tsx +++ /dev/null @@ -1,158 +0,0 @@ -import React from 'react' -import { TreeNode } from '@designable/core' -import { MonacoInput } from '@designable/react-settings-form' -import { isEmpty, isPlainObj } from '@formily/shared' - -export interface IMarkupSchemaWidgetProps { - tree: TreeNode -} - -const transformToMarkupSchemaCode = (tree: TreeNode) => { - const printAttribute = (node: TreeNode) => { - if (!node) return '' - return `${Object.keys(node.props || {}) - .map((key) => { - if ( - key === '_designableId' || - key === '_isJSONSchemaObject' || - key === 'version' || - key === 'type' - ) - return '' - const value = node.props[key] - if (isPlainObj(value) && isEmpty(value)) return '' - if (typeof value === 'string') return `${key}="${value}"` - return `${key}={${JSON.stringify(value)}}` - }) - .join(' ')}` - } - const printChildren = (node: TreeNode) => { - if (!node) return '' - return node.children - .map((child) => { - return printNode(child) - }) - .join('') - } - const printTag = (node: TreeNode) => { - if (node.props.type === 'string') return 'SchemaField.String' - if (node.props.type === 'number') return 'SchemaField.Number' - if (node.props.type === 'boolean') return 'SchemaField.Boolean' - if (node.props.type === 'date') return 'SchemaField.Date' - if (node.props.type === 'datetime') return 'SchemaField.DateTime' - if (node.props.type === 'array') return 'SchemaField.Array' - if (node.props.type === 'object') return 'SchemaField.Object' - if (node.props.type === 'void') return 'SchemaField.Void' - return 'SchemaField.Markup' - } - const printNode = (node: TreeNode) => { - if (!node) return '' - return `<${printTag(node)} ${printAttribute(node)} ${ - node.children.length - ? `>${printChildren(node)}` - : '/>' - }` - } - const root = tree.find((child) => { - return child.componentName === 'Root' - }) - return `import React, { useMemo } from 'react' -import { createForm } from '@formily/core' -import { createSchemaField } from '@formily/react' -import { - Form, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Space, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, -} from '@formily/antd' -import { Card, Slider, Rate } from 'antd' - -const Text: React.FC<{ - content?: string - mode?: 'normal' | 'h1' | 'h2' | 'h3' | 'p' -}> = ({ mode, content, ...props }) => { - const tagName = mode === 'normal' || !mode ? 'div' : mode - return React.createElement(tagName, props, content) -} - -const SchemaField = createSchemaField({ - components: { - Space, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - Text, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - Card, - Slider, - Rate, - }, -}) - -export default ()=>{ - const form = useMemo(()=>createForm(),[]) - - return
- - ${printChildren(root)} - -
-} - -` -} - -export const MarkupSchemaWidget: React.FC = ( - props -) => { - return ( - - ) -} diff --git a/designable/antd/playground/widgets/PreviewWidget.tsx b/designable/antd/playground/widgets/PreviewWidget.tsx deleted file mode 100644 index 763be4ae44c..00000000000 --- a/designable/antd/playground/widgets/PreviewWidget.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import React, { useMemo } from 'react' -import { createForm } from '@formily/core' -import { createSchemaField } from '@formily/react' -import { - Form, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Space, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, -} from '@formily/antd' -import { Card, Slider, Rate } from 'antd' -import { TreeNode } from '@designable/core' -import { transformToSchema } from '@designable/formily' - -const Text: React.FC<{ - content?: string - mode?: 'normal' | 'h1' | 'h2' | 'h3' | 'p' -}> = ({ mode, content, ...props }) => { - const tagName = mode === 'normal' || !mode ? 'div' : mode - return React.createElement(tagName, props, content) -} - -const SchemaField = createSchemaField({ - components: { - Space, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - Text, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - Card, - Slider, - Rate, - }, -}) - -export interface IPreviewWidgetProps { - tree: TreeNode -} - -export const PreviewWidget: React.FC = (props) => { - const form = useMemo(() => createForm(), []) - const { form: formProps, schema } = transformToSchema(props.tree, { - designableFormName: 'Root', - designableFieldName: 'DesignableField', - }) - return ( -
- - - ) -} diff --git a/designable/antd/playground/widgets/SchemaEditorWidget.tsx b/designable/antd/playground/widgets/SchemaEditorWidget.tsx deleted file mode 100644 index 805703bd94d..00000000000 --- a/designable/antd/playground/widgets/SchemaEditorWidget.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react' -import { transformToSchema, transformToTreeNode } from '@designable/formily' -import { TreeNode, ITreeNode } from '@designable/core' -import { MonacoInput } from '@designable/react-settings-form' - -export interface ISchemaEditorWidgetProps { - tree: TreeNode - onChange?: (tree: ITreeNode) => void -} - -const Parser = { - designableFormName: 'Root', - designableFieldName: 'DesignableField', -} - -export const SchemaEditorWidget: React.FC = ( - props -) => { - return ( - { - props.onChange?.(transformToTreeNode(JSON.parse(value), Parser)) - }} - language="json" - /> - ) -} diff --git a/designable/antd/playground/widgets/index.ts b/designable/antd/playground/widgets/index.ts deleted file mode 100644 index 1ca916232fc..00000000000 --- a/designable/antd/playground/widgets/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './LogoWidget' -export * from './ActionsWidget' -export * from './PreviewWidget' -export * from './SchemaEditorWidget' -export * from './MarkupSchemaWidget' diff --git a/designable/antd/rollup.config.js b/designable/antd/rollup.config.js deleted file mode 100644 index 859c8d570c1..00000000000 --- a/designable/antd/rollup.config.js +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig, { - removeImportStyleFromInputFilePlugin, -} from '../../scripts/rollup.base.js' -import postcss from 'rollup-plugin-postcss' -import NpmImport from 'less-plugin-npm-import' - -export default baseConfig( - 'formily.designable.antd', - 'Formily.Designable.Antd', - removeImportStyleFromInputFilePlugin(), - postcss({ - extract: true, - minimize: true, - // extensions: ['.css', '.less', '.sass'], - use: { - less: { - plugins: [new NpmImport({ prefix: '~' })], - javascriptEnabled: true, - }, - sass: {}, - stylus: {}, - }, - }) -) diff --git a/designable/antd/src/components/DesignableArrayCards/index.tsx b/designable/antd/src/components/DesignableArrayCards/index.tsx deleted file mode 100644 index dc7ab12a71b..00000000000 --- a/designable/antd/src/components/DesignableArrayCards/index.tsx +++ /dev/null @@ -1,243 +0,0 @@ -import React, { Fragment } from 'react' -import { Card, CardProps } from 'antd' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { useTreeNode, TreeNodeWidget, useNodeIdProps } from '@designable/react' -import { ArrayBase } from '@formily/antd' -import { observer } from '@formily/react' -import { LoadTemplate } from '../LoadTemplate' -import cls from 'classnames' -import { useDropTemplate } from '../../hooks' -import { - hasNodeByComponentPath, - queryNodesByComponentPath, - createEnsureTypeItemsNode, - findNodeByComponentPath, - createNodeId, -} from '../../shared' -import './styles.less' - -const ensureVoidItemsNode = createEnsureTypeItemsNode('void') - -const isArrayCardsOperation = (name: string) => - name === 'ArrayCards.Remove' || - name === 'ArrayCards.MoveDown' || - name === 'ArrayCards.MoveUp' - -export const DesignableArrayCards: React.FC = observer((props) => { - const node = useTreeNode() - const nodeId = useNodeIdProps() - const designer = useDropTemplate('ArrayCards', (source) => { - const indexNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.Index', - }, - }) - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.Addition', - }, - }) - const removeNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.Remove', - }, - }) - const moveDownNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.MoveDown', - }, - }) - const moveUpNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.MoveUp', - }, - }) - - const voidNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - }, - children: [indexNode, ...source, removeNode, moveDownNode, moveUpNode], - }) - return [voidNode, additionNode] - }) - const renderCard = () => { - if (node.children.length === 0) return - const additions = queryNodesByComponentPath(node, [ - 'ArrayCards', - 'ArrayCards.Addition', - ]) - const indexes = queryNodesByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.Index', - ]) - const operations = queryNodesByComponentPath(node, [ - 'ArrayCards', - '*', - isArrayCardsOperation, - ]) - const children = queryNodesByComponentPath(node, [ - 'ArrayCards', - '*', - (name) => name.indexOf('ArrayCards.') === -1, - ]) - return ( - - - - {indexes.map((node, key) => ( - - ))} - {props.title} - - } - className={cls('ant-formily-array-cards-item', props.className)} - extra={ - - {operations.map((node) => ( - - ))} - {props.extra} - - } - > -
- {children.length ? ( - children.map((node) => ( - - )) - ) : ( - - )} -
-
-
- {additions.map((node) => ( - - ))} -
- ) - } - - return ( -
- {renderCard()} - { - if ( - hasNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.Index', - ]) - ) - return - const indexNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.Index', - }, - }) - ensureVoidItemsNode(node).append(indexNode) - }, - }, - - { - title: 'Common.addOperation', - onClick: () => { - const oldAdditionNode = findNodeByComponentPath(node, [ - 'ArrayCards', - 'ArrayCards.Addition', - ]) - if (!oldAdditionNode) { - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.Addition', - }, - }) - ensureVoidItemsNode(node).insertAfter(additionNode) - } - const oldRemoveNode = findNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.Remove', - ]) - const oldMoveDownNode = findNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.MoveDown', - ]) - const oldMoveUpNode = findNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.MoveUp', - ]) - if (!oldRemoveNode) { - ensureVoidItemsNode(node).append( - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.Remove', - }, - }) - ) - } - if (!oldMoveDownNode) { - ensureVoidItemsNode(node).append( - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.MoveDown', - }, - }) - ) - } - if (!oldMoveUpNode) { - ensureVoidItemsNode(node).append( - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.MoveUp', - }, - }) - ) - } - }, - }, - ]} - /> -
- ) -}) - -ArrayBase.mixin(DesignableArrayCards) diff --git a/designable/antd/src/components/DesignableArrayCards/styles.less b/designable/antd/src/components/DesignableArrayCards/styles.less deleted file mode 100644 index 67e6789cd21..00000000000 --- a/designable/antd/src/components/DesignableArrayCards/styles.less +++ /dev/null @@ -1,5 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-array-cards { - background-color: @background-color-light; -} diff --git a/designable/antd/src/components/DesignableArrayCollapse/index.tsx b/designable/antd/src/components/DesignableArrayCollapse/index.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/designable/antd/src/components/DesignableArrayItems/index.tsx b/designable/antd/src/components/DesignableArrayItems/index.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/designable/antd/src/components/DesignableArrayTable/index.tsx b/designable/antd/src/components/DesignableArrayTable/index.tsx deleted file mode 100644 index 78fd2b447e6..00000000000 --- a/designable/antd/src/components/DesignableArrayTable/index.tsx +++ /dev/null @@ -1,412 +0,0 @@ -import React from 'react' -import { Table, TableProps } from 'antd' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { useTreeNode, TreeNodeWidget, useNodeIdProps } from '@designable/react' -import { ArrayBase } from '@formily/antd' -import { observer } from '@formily/react' -import { LoadTemplate } from '../LoadTemplate' -import cls from 'classnames' -import { - createNodeId, - queryNodesByComponentPath, - hasNodeByComponentPath, - findNodeByComponentPath, - createEnsureTypeItemsNode, -} from '../../shared' -import { useDropTemplate } from '../../hooks' -import './styles.less' - -const ensureObjectItemsNode = createEnsureTypeItemsNode('object') - -export const DesignableArrayTable: React.FC> = observer( - (props) => { - const node = useTreeNode() - const nodeId = useNodeIdProps() - const designer = useDropTemplate('ArrayTable', (source) => { - const sortHandleNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.SortHandle', - }, - }, - ], - }) - const indexNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Index', - }, - }, - ], - }) - const columnNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: source.map((node) => { - node.props.title = undefined - return node - }), - }) - - const operationNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Remove', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveDown', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveUp', - }, - }, - ], - }) - const objectNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'object', - }, - children: [sortHandleNode, indexNode, columnNode, operationNode], - }) - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayTable.Addition', - }, - }) - return [objectNode, additionNode] - }) - const columns = queryNodesByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - ]) - const additions = queryNodesByComponentPath(node, [ - 'ArrayTable', - 'ArrayTable.Addition', - ]) - const defaultRowKey = () => { - return node.id - } - const createColumnId = (props: any) => { - return createNodeId( - designer, - props.className.match(/data-id\:([^\s]+)/)?.[1] - ) - } - - const renderTable = () => { - if (node.children.length === 0) return - return ( - - { - return ( - - ) - }, - }, - body: { - cell: (props: any) => { - return ( - - ) - }, - }, - }} - > - {columns.map((node, key) => { - const children = node.children.map((child) => { - return - }) - return ( - { - return ( - - {children.length > 0 ? children : 'Droppable'} - - ) - }} - /> - ) - })} - {columns.length === 0 && ( - } /> - )} -
- {props.children} - - {props.children} -
- {additions.map((child) => { - return - })} -
- ) - } - - useDropTemplate('ArrayTable.Column', (source) => { - return source.map((node) => { - node.props.title = undefined - return node - }) - }) - - return ( -
- {renderTable()} - { - if ( - hasNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - 'ArrayTable.SortHandle', - ]) - ) - return - const tableColumn = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.SortHandle', - }, - }, - ], - }) - ensureObjectItemsNode(node).prepend(tableColumn) - }, - }, - { - title: 'Common.addIndex', - onClick: () => { - if ( - hasNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - 'ArrayTable.Index', - ]) - ) - return - const tableColumn = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Index', - }, - }, - ], - }) - const sortNode = findNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - 'ArrayTable.SortHandle', - ]) - if (sortNode) { - sortNode.parent.insertAfter(tableColumn) - } else { - ensureObjectItemsNode(node).prepend(tableColumn) - } - }, - }, - { - title: 'Common.addTableColumn', - onClick: () => { - const operationNode = findNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - (name) => { - return ( - name === 'ArrayTable.Remove' || - name === 'ArrayTable.MoveDown' || - name === 'ArrayTable.MoveUp' - ) - }, - ]) - const tableColumn = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - }) - if (operationNode) { - operationNode.parent.insertBefore(tableColumn) - } else { - ensureObjectItemsNode(node).append(tableColumn) - } - }, - }, - { - title: 'Common.addOperation', - onClick: () => { - const oldOperationNode = findNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - (name) => { - return ( - name === 'ArrayTable.Remove' || - name === 'ArrayTable.MoveDown' || - name === 'ArrayTable.MoveUp' - ) - }, - ]) - const oldAdditionNode = findNodeByComponentPath(node, [ - 'ArrayTable', - 'ArrayTable.Addition', - ]) - if (!oldOperationNode) { - const operationNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Remove', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveDown', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveUp', - }, - }, - ], - }) - ensureObjectItemsNode(node).append(operationNode) - } - if (!oldAdditionNode) { - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayTable.Addition', - }, - }) - ensureObjectItemsNode(node).insertAfter(additionNode) - } - }, - }, - ]} - /> -
- ) - } -) - -ArrayBase.mixin(DesignableArrayTable) diff --git a/designable/antd/src/components/DesignableArrayTable/styles.less b/designable/antd/src/components/DesignableArrayTable/styles.less deleted file mode 100644 index a45490e2904..00000000000 --- a/designable/antd/src/components/DesignableArrayTable/styles.less +++ /dev/null @@ -1,5 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-array-table { - background-color: @background-color-light; -} diff --git a/designable/antd/src/components/DesignableArrayTabs/index.tsx b/designable/antd/src/components/DesignableArrayTabs/index.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/designable/antd/src/components/DesignableContainer/index.tsx b/designable/antd/src/components/DesignableContainer/index.tsx deleted file mode 100644 index a892319c8c7..00000000000 --- a/designable/antd/src/components/DesignableContainer/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react' -import { useNodeIdProps } from '@designable/react' -import { Droppable } from '../Droppable' -import './styles.less' - -export const createDesignableContainer = ( - Target: React.JSXElementConstructor -) => { - return (props: any) => { - const nodeId = useNodeIdProps() - if (props.children) { - return ( -
- {props.children} -
- ) - } - return - } -} diff --git a/designable/antd/src/components/DesignableContainer/styles.less b/designable/antd/src/components/DesignableContainer/styles.less deleted file mode 100644 index e0f5c30388e..00000000000 --- a/designable/antd/src/components/DesignableContainer/styles.less +++ /dev/null @@ -1,7 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-form-container { - margin: 0 !important; - padding: 20px; - border: 1px solid @border-color-split; -} diff --git a/designable/antd/src/components/DesignableField/index.tsx b/designable/antd/src/components/DesignableField/index.tsx deleted file mode 100644 index dd078bee123..00000000000 --- a/designable/antd/src/components/DesignableField/index.tsx +++ /dev/null @@ -1,438 +0,0 @@ -import React from 'react' -import { FormPath } from '@formily/core' -import { GlobalRegistry, TreeNode } from '@designable/core' -import { useDesigner, useTreeNode } from '@designable/react' -import { - ArrayField, - Field, - ObjectField, - VoidField, - observer, - Schema, - ISchema, -} from '@formily/react' -import { - DataSourceSetter, - ReactionsSetter, - ValidatorSetter, -} from '@formily/designable-setters' -import { FormTab, FormItem } from '@formily/antd' -import { isArr, isStr, each, reduce } from '@formily/shared' -import { FormItemSwitcher } from '../FormItemSwitcher' -import { DesignableObject } from '../DesignableObject' -import { createOptions } from './options' -import { IDesignableFieldFactoryProps } from './types' -import { includesComponent } from '../../shared' -import * as defaultSchemas from '../../schemas' - -Schema.silent() - -const SchemaStateMap = { - title: 'title', - description: 'description', - default: 'value', - enum: 'dataSource', - readOnly: 'readOnly', - writeOnly: 'editable', - required: 'required', - 'x-content': 'content', - 'x-value': 'value', - 'x-editable': 'editable', - 'x-disabled': 'disabled', - 'x-read-pretty': 'readPretty', - 'x-read-only': 'readOnly', - 'x-visible': 'visible', - 'x-hidden': 'hidden', - 'x-display': 'display', - 'x-pattern': 'pattern', -} - -const NeedShownExpression = { - title: true, - description: true, - default: true, - 'x-content': true, - 'x-value': true, -} - -const isExpression = (val: any) => isStr(val) && /^\{\{.*\}\}$/.test(val) - -const filterExpression = (val: any) => { - if (typeof val === 'object') { - const isArray = isArr(val) - const results = reduce( - val, - (buf: any, value, key) => { - if (isExpression(value)) { - return buf - } else { - const results = filterExpression(value) - if (results === undefined || results === null) return buf - if (isArray) { - return buf.concat([results]) - } - buf[key] = results - return buf - } - }, - isArray ? [] : {} - ) - return results - } - if (isExpression(val)) { - return - } - return val -} - -const toDesignableFieldProps = ( - schema: ISchema, - components: any, - nodeIdAttrName: string, - id: string -) => { - const results: any = {} - each(SchemaStateMap, (fieldKey, schemaKey) => { - const value = schema[schemaKey] - if (isExpression(value)) { - if (!NeedShownExpression[schemaKey]) return - if (value) { - results[fieldKey] = value - return - } - } else if (value) { - results[fieldKey] = filterExpression(value) - } - }) - if (!components['FormItem']) { - components['FormItem'] = FormItem - } - const decorator = - schema['x-decorator'] && FormPath.getIn(components, schema['x-decorator']) - const component = - schema['x-component'] && FormPath.getIn(components, schema['x-component']) - const decoratorProps = schema['x-decorator-props'] || {} - const componentProps = schema['x-component-props'] || {} - - if (decorator) { - results.decorator = [decorator, { ...decoratorProps }] - } - if (component) { - results.component = [component, { ...componentProps }] - } - if (decorator) { - FormPath.setIn(results['decorator'][1], nodeIdAttrName, id) - } else if (component) { - FormPath.setIn(results['component'][1], nodeIdAttrName, id) - } - results.title = results.title && ( - {results.title} - ) - results.description = results.description && ( - {results.description} - ) - return results -} - -export const createDesignableField = ( - options: IDesignableFieldFactoryProps -) => { - const realOptions = createOptions(options) - - const tabs = {} - - const getFieldPropsSchema = (node: TreeNode): ISchema => { - const decorator = node.props['x-decorator'] - const component = node.props['x-component'] - const decoratorSchema = - decorator && - (FormPath.getIn(realOptions.componentsPropsSchema, decorator) || - FormPath.getIn(defaultSchemas, decorator)) - const componentSchema = - component && - (FormPath.getIn(realOptions.componentsPropsSchema, component) || - FormPath.getIn(defaultSchemas, component)) - const TabSchema = (key: string, schema: ISchema) => { - tabs[key] = tabs[key] || FormTab.createFormTab() - return { - type: 'object', - properties: { - propsTab: { - type: 'void', - 'x-component': 'FormTab', - 'x-component-props': { - formTab: tabs[key], - style: { - overflow: 'visible', - }, - }, - properties: { - propsPane: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - tab: GlobalRegistry.getDesignerMessage( - `settings.${key}.tab_property` - ), - }, - properties: schema.properties, - }, - stylePane: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - tab: GlobalRegistry.getDesignerMessage( - `settings.${key}.tab_style` - ), - }, - properties: { - style: defaultSchemas.CSSStyle, - }, - }, - }, - }, - }, - } - } - const base = { - type: 'object', - properties: { - name: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - defaultValue: node.id, - }, - 'x-index': 0, - }, - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-index': 1, - }, - description: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - 'x-index': 2, - }, - 'x-display': { - type: 'string', - enum: ['visible', 'hidden', 'none', ''], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'visible', - }, - 'x-index': 3, - }, - 'x-pattern': { - type: 'string', - enum: ['editable', 'disabled', 'readOnly', 'readPretty', ''], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'editable', - }, - 'x-index': 4, - }, - 'x-component-props': - componentSchema && TabSchema('x-component-props', componentSchema), - 'x-decorator-props': - decoratorSchema && TabSchema('x-decorator-props', decoratorSchema), - }, - } - - if (node.props.type === 'void') { - if (!includesComponent(node, realOptions.dropReactionComponents)) { - Object.assign(base.properties, { - 'x-reactions': { - 'x-decorator': 'FormItem', - 'x-index': 5, - 'x-component': ReactionsSetter, - }, - }) - } - if (!includesComponent(node, realOptions.dropFormItemComponents)) { - Object.assign(base.properties, { - 'x-decorator': { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': FormItemSwitcher, - 'x-index': 10, - 'x-reactions': { - target: '*(title,description)', - fulfill: { - state: { - hidden: '{{$self.value !== "FormItem"}}', - }, - }, - }, - }, - }) - } else { - delete base.properties.title - delete base.properties.description - } - } else { - if (!includesComponent(node, realOptions.dropReactionComponents)) { - Object.assign(base.properties, { - 'x-reactions': { - 'x-decorator': 'FormItem', - 'x-index': 7, - 'x-component': ReactionsSetter, - }, - }) - } - Object.assign(base.properties, { - default: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-index': 5, - }, - enum: { - 'x-decorator': 'FormItem', - 'x-component': DataSourceSetter, - 'x-index': 6, - }, - 'x-validator': { - type: 'array', - 'x-component': ValidatorSetter, - 'x-index': 8, - }, - required: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-index': 9, - }, - }) - } - - base['$namespace'] = `namespace.${component}` - - return base - } - - const calculateChildrenRestricts = (target: TreeNode, source: TreeNode[]) => { - const targetComponent = target.props['x-component'] - const restrictChildrenComponents = - realOptions.restrictChildrenComponents?.[targetComponent] - if (restrictChildrenComponents?.length) { - if ( - source.every((node) => - includesComponent(node, restrictChildrenComponents, target) - ) - ) { - return true - } - return false - } - return true - } - - const calculateSiblingsRestricts = (target: TreeNode, source: TreeNode[]) => { - const targetComponent = target.props['x-component'] - const restrictSiblingComponents = - realOptions.restrictSiblingComponents?.[targetComponent] - if (restrictSiblingComponents?.length) { - if ( - source.every((node) => - includesComponent(node, restrictSiblingComponents, target) - ) - ) { - return true - } - return false - } - return true - } - - if (!realOptions.registryName) throw new Error('Can not found registryName') - - GlobalRegistry.registerDesignerProps({ - [realOptions.registryName]: (node) => { - const componentName = node.props?.['x-component'] - const message = GlobalRegistry.getDesignerMessage( - `components.${componentName}` - ) - const isObjectNode = node.props.type === 'object' - const isArrayNode = node.props.type === 'array' - const isVoidNode = node.props.type === 'void' - const title = typeof message === 'string' ? message : message?.title - const nodeTitle = - title || - (isObjectNode - ? GlobalRegistry.getDesignerMessage('components.Object') - : isVoidNode - ? GlobalRegistry.getDesignerMessage('components.Void') - : '') - const sourceIcon = realOptions.componentsSourceIcon?.[componentName] - return { - title: nodeTitle, - sourceIcon: isObjectNode ? 'ObjectSource' : sourceIcon, - icon: realOptions.componentsIcon?.[componentName], - draggable: true, - droppable: isObjectNode || isArrayNode || isVoidNode, - selfRenderChildren: - isArrayNode || - includesComponent(node, realOptions.selfRenderChildrenComponents), - inlineLayout: includesComponent( - node, - realOptions.inlineLayoutComponents - ), - inlineChildrenLayout: includesComponent( - node, - realOptions.inlineChildrenLayoutComponents - ), - allowSiblings(target, source) { - return calculateSiblingsRestricts(target, source) - }, - allowAppend(target, source) { - return ( - (target.props.type === 'void' || - target.props.type === 'array' || - target.props.type === 'object') && - calculateChildrenRestricts(target, source) - ) - }, - propsSchema: getFieldPropsSchema(node), - } - }, - }) - - const DesignableField: React.FC = observer((props) => { - const designer = useDesigner() - const node = useTreeNode() - if (!node) return null - - const fieldProps = toDesignableFieldProps( - props, - realOptions.components, - designer.props.nodeIdAttrName, - node.id - ) - if (props.type === 'object') { - return ( - - - {props.children} - - - ) - } else if (props.type === 'array') { - return - } else if (node.props.type === 'void') { - return ( - - {props.children} - - ) - } - return - }) - - return DesignableField -} diff --git a/designable/antd/src/components/DesignableField/options.ts b/designable/antd/src/components/DesignableField/options.ts deleted file mode 100644 index 7cbf0ed07c4..00000000000 --- a/designable/antd/src/components/DesignableField/options.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { IDesignableFieldFactoryProps } from './types' -import { - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Space, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - FormGrid, - FormLayout, -} from '@formily/antd' -import { Card, Slider, Rate } from 'antd' -import { createDesignableContainer } from '../DesignableContainer' -import { DesignableFormTab } from '../DesignableFormTab' -import { DesignableFormCollapse } from '../DesignableFormCollapse' -import { DesignableArrayTable } from '../DesignableArrayTable' -import { DesignableArrayCards } from '../DesignableArrayCards' -import { DesignableText } from '../DesignableText' -import { TreeNode } from '@designable/core' - -const isChildrenComponents = - (parentName: string, names?: string[]) => (name: string) => - Array.isArray(names) && names.length > 0 - ? names.some((key) => { - return `${parentName}.${key}` === name - }) - : name.indexOf(`${parentName}.`) > -1 - -const InlineArrayChildren = [ - 'Column', - 'Index', - 'SortHandle', - 'Remove', - 'MoveDown', - 'MoveUp', -] - -const isFormTabChildren = isChildrenComponents('FormTab') -const isFormCollapseChildren = isChildrenComponents('FormCollapse') -const isArrayTableInlineChildren = isChildrenComponents( - 'ArrayTable', - InlineArrayChildren -) -const isArrayCardsInlineChildren = isChildrenComponents( - 'ArrayCards', - InlineArrayChildren -) -const isObjectNode = (name: string, node: TreeNode) => { - return node.props['type'] === 'object' -} - -const isNotArrayColumn = (name: string, node: TreeNode) => { - return node.props['x-component'] !== 'ArrayTable.Column' -} - -const allowDropWithEmpty = (name: string, node: TreeNode, target: TreeNode) => { - if (target) return target.children.length === 0 - return false -} - -const noChildren = () => false - -export const createOptions = ( - options: IDesignableFieldFactoryProps -): IDesignableFieldFactoryProps => { - return { - ...options, - dropFormItemComponents: [ - ...(options.dropFormItemComponents || []), - isFormTabChildren, - isFormCollapseChildren, - ], - dropReactionComponents: [ - ...(options.dropReactionComponents || []), - isFormTabChildren, - isFormCollapseChildren, - ], - selfRenderChildrenComponents: [ - ...(options.selfRenderChildrenComponents || []), - 'FormTab', - 'FormCollapse', - ], - inlineChildrenLayoutComponents: [ - ...(options.inlineChildrenLayoutComponents || []), - 'FormItem', - 'FormGrid', - 'Space', - ], - inlineLayoutComponents: [ - ...(options.inlineLayoutComponents || []), - isArrayTableInlineChildren, - isArrayCardsInlineChildren, - ], - restrictChildrenComponents: { - FormTab: [allowDropWithEmpty, 'FormTab.TabPane'], - FormCollapse: [allowDropWithEmpty, 'FormCollapse.CollapsePanel'], - ArrayTable: [allowDropWithEmpty, isObjectNode, 'ArrayTable.Addition'], - 'ArrayTable.Column': [isNotArrayColumn], - Text: [noChildren], - }, - restrictSiblingComponents: { - 'FormTab.TabPane': ['FormTab.TabPane'], - 'FormCollapse.CollapsePanel': ['FormCollapse.CollapsePanel'], - 'ArrayTable.Column': ['ArrayTable.Column'], - }, - componentsSourceIcon: { - ...options.componentsSourceIcon, - Space: 'SpaceSource', - FormGrid: 'GridSource', - FormTab: 'TabSource', - FormCollapse: 'CollapseSource', - ArrayTable: 'ArrayTableSource', - ArrayCards: 'ArrayCardsSource', - DatePicker: 'DatePickerSource', - 'DatePicker.RangePicker': 'DateRangePickerSource', - 'Checkbox.Group': 'CheckboxGroupSource', - 'Radio.Group': 'RadioGroupSource', - Slider: 'SliderSource', - Rate: 'RateSource', - TimePicker: 'TimePickerSource', - 'TimePicker.RangePicker': 'TimeRangePickerSource', - Cascader: 'CascaderSource', - TreeSelect: 'TreeSelectSource', - Select: 'SelectSource', - 'Input.TextArea': 'TextAreaSource', - Input: 'InputSource', - NumberPicker: 'NumberPickerSource', - Password: 'PasswordSource', - Transfer: 'TransferSource', - Switch: 'SwitchSource', - Upload: 'UploadSource', - 'Upload.Dragger': 'UploadDraggerSource', - Card: 'CardSource', - FormLayout: 'FormLayoutSource', - Text: 'TextSource', - Image: 'ImageSource', - Button: 'ButtonSource', - Video: 'MediaSource', - }, - components: { - ...options.components, - Space: createDesignableContainer(Space), - FormGrid: createDesignableContainer(FormGrid), - FormLayout: createDesignableContainer(FormLayout), - FormTab: DesignableFormTab, - FormCollapse: DesignableFormCollapse, - ArrayTable: DesignableArrayTable, - ArrayCards: DesignableArrayCards, - Text: DesignableText, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - Card, - Slider, - Rate, - }, - } -} diff --git a/designable/antd/src/components/DesignableField/types.ts b/designable/antd/src/components/DesignableField/types.ts deleted file mode 100644 index abf5d0b9cc0..00000000000 --- a/designable/antd/src/components/DesignableField/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react' -import { ISchema } from '@formily/react' -import { ComponentNameMatcher } from '../../shared' -export interface IDesignableFieldFactoryProps { - registryName: string - components?: Record> - componentsIcon?: Record - componentsSourceIcon?: Record - componentsPropsSchema?: Record - dropFormItemComponents?: ComponentNameMatcher[] - dropReactionComponents?: ComponentNameMatcher[] - selfRenderChildrenComponents?: ComponentNameMatcher[] - inlineChildrenLayoutComponents?: ComponentNameMatcher[] - inlineLayoutComponents?: ComponentNameMatcher[] - restrictChildrenComponents?: Record - restrictSiblingComponents?: Record -} diff --git a/designable/antd/src/components/DesignableForm/index.tsx b/designable/antd/src/components/DesignableForm/index.tsx deleted file mode 100644 index 9c9fb13d7d4..00000000000 --- a/designable/antd/src/components/DesignableForm/index.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React, { useMemo } from 'react' -import { IDesignerProps, GlobalRegistry } from '@designable/core' -import { createForm } from '@formily/core' -import { Form, IFormLayoutProps } from '@formily/antd' -import { observer } from '@formily/react' -import { usePrefix } from '@designable/react' -import { Form as FormPropsSchema } from '../../schemas' -import './styles.less' - -export interface IDesignableFormFactoryProps extends IDesignerProps { - registryName: string - component?: React.JSXElementConstructor -} - -export const createDesignableForm = (options: IDesignableFormFactoryProps) => { - const realOptions: IDesignableFormFactoryProps = { - component: Form, - droppable: true, - draggable: false, - propsSchema: FormPropsSchema, - ...options, - defaultProps: { - labelCol: 6, - wrapperCol: 12, - ...options.defaultProps, - }, - } - - const FormComponent = realOptions.component || Form - - const DesignableForm: React.FC = observer((props) => { - const prefix = usePrefix('designable-form') - const form = useMemo( - () => - createForm({ - designable: true, - }), - [] - ) - return ( - - {props.children} - - ) - }) - - if (!realOptions.registryName) throw new Error('Can not found registryName') - - realOptions.title = `components.${realOptions.registryName}` - - GlobalRegistry.registerDesignerProps({ - [realOptions.registryName]: realOptions, - }) - - return DesignableForm -} diff --git a/designable/antd/src/components/DesignableForm/styles.less b/designable/antd/src/components/DesignableForm/styles.less deleted file mode 100644 index 4aaf7758d29..00000000000 --- a/designable/antd/src/components/DesignableForm/styles.less +++ /dev/null @@ -1,34 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-designable-form { - .@{ant-prefix}-input, - .@{ant-prefix}-input-number, - .@{ant-prefix}-input-affix-wrapper, - .@{ant-prefix}-cascader-picker, - .@{ant-prefix}-picker-input, - .@{ant-prefix}-picker, - .@{ant-prefix}-cascader-picker-label, - .@{ant-prefix}-slider, - .@{ant-prefix}-checkbox, - .@{ant-prefix}-rate, - .@{ant-prefix}-switch, - .@{ant-prefix}-radio, - .@{ant-prefix}-radio-wrapper, - .@{ant-prefix}-checkbox-group, - .@{ant-prefix}-checkbox-wrapper, - .@{ant-prefix}-radio-group, - .@{ant-prefix}-upload, - .@{ant-prefix}-transfer, - .@{ant-prefix}-select, - .@{ant-prefix}-select-selector { - pointer-events: none !important; - - input { - pointer-events: none !important; - } - } - - .anticon svg { - pointer-events: none; - } -} diff --git a/designable/antd/src/components/DesignableFormCollapse/index.tsx b/designable/antd/src/components/DesignableFormCollapse/index.tsx deleted file mode 100644 index 5a271e2bd8d..00000000000 --- a/designable/antd/src/components/DesignableFormCollapse/index.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import React, { Fragment, useState } from 'react' -import { observer } from '@formily/react' -import { Collapse } from 'antd' -import { CollapseProps, CollapsePanelProps } from 'antd/lib/collapse' -import { useTreeNode, useNodeIdProps, TreeNodeWidget } from '@designable/react' -import { toArr } from '@formily/shared' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { LoadTemplate } from '../LoadTemplate' -import { useDropTemplate } from '../../hooks' -import { matchComponent } from '../../shared' - -const parseCollpase = (parent: TreeNode) => { - const tabs: TreeNode[] = [] - parent.children.forEach((node) => { - if (matchComponent(node, 'FormCollapse.CollapsePanel')) { - tabs.push(node) - } - }) - return tabs -} - -export const DesignableFormCollapse: React.FC & { - CollapsePanel?: React.FC -} = observer((props) => { - const [activeKey, setActiveKey] = useState([]) - const node = useTreeNode() - const nodeId = useNodeIdProps() - const designer = useDropTemplate('FormCollapse', (source) => { - const panelNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormCollapse.CollapsePanel', - 'x-component-props': { - header: `Unnamed Title`, - }, - }, - children: source, - }) - - setActiveKey(toArr(activeKey).concat(panelNode.id)) - return [panelNode] - }) - const getCorrectActiveKey = ( - activeKey: string[] | string, - tabs: TreeNode[] - ) => { - if (!tabs.length || !activeKey?.length) { - if (props.accordion) { - return tabs[0]?.id - } - return tabs.map((item) => item.id) - } - if ( - tabs.some((node) => - Array.isArray(activeKey) - ? activeKey.includes(node.id) - : node.id === activeKey - ) - ) - return activeKey - return tabs[tabs.length - 1].id - } - const panels = parseCollpase(node) - const renderCollapse = () => { - if (!node.children?.length) return - return ( - { - setActiveKey(toArr(id)) - }} - > - {panels.map((panel) => { - const props = panel.props['x-component-props'] || {} - return ( - - {React.createElement( - 'div', - { - [designer.props.nodeIdAttrName]: panel.id, - }, - panel.children.length ? ( - - ) : ( - - ) - )} - - ) - })} - - ) - } - return ( -
- {renderCollapse()} - { - const tabPane = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormCollapse.CollapsePanel', - 'x-component-props': { - header: `Unnamed Title`, - }, - }, - }) - node.append(tabPane) - const keys = toArr(activeKey) - setActiveKey(keys.concat(tabPane.id)) - }, - }, - ]} - /> -
- ) -}) - -DesignableFormCollapse.CollapsePanel = (props) => { - return {props.children} -} diff --git a/designable/antd/src/components/DesignableFormTab/index.tsx b/designable/antd/src/components/DesignableFormTab/index.tsx deleted file mode 100644 index 7bc6a158963..00000000000 --- a/designable/antd/src/components/DesignableFormTab/index.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import React, { Fragment, useState } from 'react' -import { observer } from '@formily/react' -import { Tabs } from 'antd' -import { TabsProps, TabPaneProps } from 'antd/lib/tabs' -import { useNodeIdProps, useTreeNode, TreeNodeWidget } from '@designable/react' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { LoadTemplate } from '../LoadTemplate' -import { useDropTemplate } from '../../hooks' -import { matchComponent } from '../../shared' - -const parseTabs = (parent: TreeNode) => { - const tabs: TreeNode[] = [] - parent.children.forEach((node) => { - if (matchComponent(node, 'FormTab.TabPane')) { - tabs.push(node) - } - }) - return tabs -} - -const getCorrectActiveKey = (activeKey: string, tabs: TreeNode[]) => { - if (tabs.length === 0) return - if (tabs.some((node) => node.id === activeKey)) return activeKey - return tabs[tabs.length - 1].id -} - -export const DesignableFormTab: React.FC & { - TabPane?: React.FC -} = observer((props) => { - const [activeKey, setActiveKey] = useState() - const nodeId = useNodeIdProps() - const node = useTreeNode() - const designer = useDropTemplate('FormTab', (source) => { - return [ - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - tab: `Unnamed Title`, - }, - }, - children: source, - }), - ] - }) - const tabs = parseTabs(node) - const renderTabs = () => { - if (!node.children?.length) return - return ( - { - setActiveKey(id) - }} - > - {tabs.map((tab) => { - const props = tab.props['x-component-props'] || {} - return ( - - {React.createElement( - 'div', - { - [designer.props.nodeIdAttrName]: tab.id, - }, - tab.children.length ? ( - - ) : ( - - ) - )} - - ) - })} - - ) - } - return ( -
- {renderTabs()} - { - const tabPane = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - tab: `Unnamed Title`, - }, - }, - }) - node.append(tabPane) - setActiveKey(tabPane.id) - }, - }, - ]} - /> -
- ) -}) - -DesignableFormTab.TabPane = (props) => { - return {props.children} -} diff --git a/designable/antd/src/components/DesignableObject/index.tsx b/designable/antd/src/components/DesignableObject/index.tsx deleted file mode 100644 index b894214f3d8..00000000000 --- a/designable/antd/src/components/DesignableObject/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' -import { useNodeIdProps, useTreeNode } from '@designable/react' -import { Droppable } from '../Droppable' - -export const DesignableObject: React.FC = (props) => { - const node = useTreeNode() - const nodeId = useNodeIdProps() - if (node.children.length === 0) return - return
{props.children}
-} diff --git a/designable/antd/src/components/DesignableText/index.tsx b/designable/antd/src/components/DesignableText/index.tsx deleted file mode 100644 index 6b08755dbf8..00000000000 --- a/designable/antd/src/components/DesignableText/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react' -import { useDesigner } from '@designable/react' -import cls from 'classnames' -import './styles.less' - -export interface IDesignableTextProps { - content?: string - mode?: 'normal' | 'h1' | 'h2' | 'h3' | 'p' - style?: React.CSSProperties - className?: string -} - -export const DesignableText: React.FC = (props) => { - const designer = useDesigner() - const tagName = props.mode === 'normal' || !props.mode ? 'div' : props.mode - return React.createElement( - tagName, - { - ...props, - className: cls(props.className, 'dn-text'), - [designer.props.contentEditableAttrName]: 'x-component-props.content', - }, - props.content - ) -} diff --git a/designable/antd/src/components/DesignableText/styles.less b/designable/antd/src/components/DesignableText/styles.less deleted file mode 100644 index a55fac3c947..00000000000 --- a/designable/antd/src/components/DesignableText/styles.less +++ /dev/null @@ -1,10 +0,0 @@ -.dn-text { - &:empty::before { - content: 'Please Input'; - display: block; - opacity: 0.6; - } - &:focus{ - padding: 4px; - } -} diff --git a/designable/antd/src/components/Droppable/index.tsx b/designable/antd/src/components/Droppable/index.tsx deleted file mode 100644 index 0802ab99f5e..00000000000 --- a/designable/antd/src/components/Droppable/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react' -import { usePrefix, TextWidget } from '@designable/react' -import { Empty } from 'antd' -import cls from 'classnames' -import './styles.less' - -export interface IDroppableProps { - style?: React.CSSProperties - className?: string -} - -export const Droppable: React.FC = (props: any) => { - const prefix = usePrefix('droppable') - return ( - } - /> - ) -} diff --git a/designable/antd/src/components/Droppable/styles.less b/designable/antd/src/components/Droppable/styles.less deleted file mode 100644 index d175c36436a..00000000000 --- a/designable/antd/src/components/Droppable/styles.less +++ /dev/null @@ -1,9 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-droppable { - margin-left: 0 !important; - margin-right: 0 !important; - padding: 20px; - border: 1px solid @border-color-split; - color: @text-color; -} diff --git a/designable/antd/src/components/FormItemSwitcher/index.tsx b/designable/antd/src/components/FormItemSwitcher/index.tsx deleted file mode 100644 index 04134856fbd..00000000000 --- a/designable/antd/src/components/FormItemSwitcher/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import { Switch } from 'antd' - -export interface IFormItemSwitcherProps { - value?: string - onChange?: (value: string) => void -} - -export const FormItemSwitcher: React.FC = (props) => { - return ( - { - props.onChange(value ? 'FormItem' : undefined) - }} - /> - ) -} diff --git a/designable/antd/src/components/LoadTemplate/index.tsx b/designable/antd/src/components/LoadTemplate/index.tsx deleted file mode 100644 index 5decd4d1b72..00000000000 --- a/designable/antd/src/components/LoadTemplate/index.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react' -import { Space, Typography, Divider } from 'antd' -import { usePrefix, TextWidget } from '@designable/react' -import cls from 'classnames' -import './styles.less' - -export interface ITemplateAction { - title: React.ReactNode - tooltip?: React.ReactNode - icon?: string | React.ReactNode - onClick: () => void -} - -export interface ILoadTemplateProps { - className?: string - style?: React.CSSProperties - actions?: ITemplateAction[] -} - -export const LoadTemplate: React.FC = (props) => { - const prefix = usePrefix('load-template') - return ( -
-
- }> - {props.actions?.map((action, key) => { - return ( - { - e.stopPropagation() - action?.onClick?.() - }} - > - {action.title} - - ) - })} - -
-
- ) -} diff --git a/designable/antd/src/components/LoadTemplate/styles.less b/designable/antd/src/components/LoadTemplate/styles.less deleted file mode 100644 index 3496c3c8d76..00000000000 --- a/designable/antd/src/components/LoadTemplate/styles.less +++ /dev/null @@ -1,35 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-load-template { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - overflow: hidden; - padding-top: 10px; - padding-bottom: 10px; - &-actions { - position: relative; - padding: 0 20px; - &::before { - position: absolute; - content: ''; - display: block; - height: 0; - width: 300%; - top: 50%; - border-bottom: 2px dashed @border-color-split; - right: 100%; - } - &::after { - position: absolute; - content: ''; - display: block; - height: 0; - width: 300%; - top: 50%; - border-bottom: 2px dashed @border-color-split; - left: 100%; - } - } -} diff --git a/designable/antd/src/components/index.ts b/designable/antd/src/components/index.ts deleted file mode 100644 index 19322276aac..00000000000 --- a/designable/antd/src/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DesignableField' -export * from './DesignableForm' diff --git a/designable/antd/src/hooks/index.ts b/designable/antd/src/hooks/index.ts deleted file mode 100644 index 6ab5860beb4..00000000000 --- a/designable/antd/src/hooks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './useDropTemplate' diff --git a/designable/antd/src/hooks/useDropTemplate.ts b/designable/antd/src/hooks/useDropTemplate.ts deleted file mode 100644 index c07ef103935..00000000000 --- a/designable/antd/src/hooks/useDropTemplate.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AppendNodeEvent, TreeNode } from '@designable/core' -import { useDesigner } from '@designable/react' -import { matchComponent, matchChildComponent } from '../shared' - -export const useDropTemplate = ( - name: string, - getChildren: (source: TreeNode[]) => TreeNode[] -) => { - return useDesigner((designer) => { - return designer.subscribeTo(AppendNodeEvent, (event) => { - const { source, target } = event.data - if (Array.isArray(target)) return - if (!Array.isArray(source)) return - if ( - matchComponent( - target, - (key) => - key === name && - source.every((child) => !matchChildComponent(child, name)) - ) && - target.children.length === 0 - ) { - target.setChildren(...getChildren(source)) - return false - } - }) - }) -} diff --git a/designable/antd/src/index.ts b/designable/antd/src/index.ts deleted file mode 100644 index e1e3b6f0e4e..00000000000 --- a/designable/antd/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import './locales' -import './sources' -export * from './components' diff --git a/designable/antd/src/locales/en-US.ts b/designable/antd/src/locales/en-US.ts deleted file mode 100644 index 14c3635a4da..00000000000 --- a/designable/antd/src/locales/en-US.ts +++ /dev/null @@ -1,464 +0,0 @@ -const StyleLocale = { - width: 'Width', - height: 'Height', - display: 'Display', - background: 'Background', - boxShadow: 'Box Shadow', - font: 'Font', - margin: 'Margin', - padding: 'Padding', - borderRadius: 'Radius', - border: 'Border', - opacity: 'Opacity', -} - -const FormLayoutLocale = { - labelCol: 'Label Col', - wrapperCol: 'Wrapper Col', - colon: 'Colon', - labelAlign: { - title: 'Label Align', - dataSource: ['Left', 'Right', 'Inherit'], - }, - wrapperAlign: { - title: 'Wrapper Align', - dataSource: ['Left', 'Right', 'Inherit'], - }, - labelWrap: 'Label Wrap', - wrapperWrap: 'Wrapper Wrap', - labelWidth: 'Label Width', - wrapperWidth: 'Wrapper Width', - fullness: 'Fullness', - inset: 'Inset', - shallow: 'Shallow', - bordered: 'Bordered', - size: { title: 'Size', dataSource: ['Large', 'Small', 'Default', 'Inherit'] }, - layout: { - title: 'Layout', - dataSource: ['Vertical', 'Horizontal', 'Inline', 'Inherit'], - }, - feedbackLayout: { - title: 'Feedback Layout', - dataSource: ['Loose', 'Terse', 'Popup', 'None', 'Inherit'], - }, - tooltipLayout: { - title: 'Tooltip Layout', - dataSource: ['Icon', 'Text', 'Inherit'], - }, -} - -const InputLocale = { - addonAfter: 'Addon After', - addonBefore: 'Addon Before', - style: StyleLocale, - allowClear: 'Allow Clear', - maxLength: 'Max Length', - prefix: 'Prefix', - suffix: 'Suffix', - placeholder: 'Placeholder', - autoSize: { - title: 'Auto Size', - }, - showCount: 'Show Count', - checkStrength: 'Check Strength', -} - -const FormItemLocale = { - tooltip: 'Tooltip', - asterisk: 'Asterisk', - gridSpan: 'Grid Span', -} - -const SelectLocale = { - mode: { - title: 'Mode', - dataSource: ['Multiple', 'Tags', 'Single'], - }, - autoClearSearchValue: { - title: 'Auto Clear Search Value', - tooltip: 'Only used to multiple and tags mode', - }, - autoFocus: 'Auto Focus', - defaultActiveFirstOption: 'Default Active First Option', - dropdownMatchSelectWidth: 'Dropdown Match Select Width', - defaultOpen: 'Default Open', - filterOption: 'Filter Option', - filterSort: 'Filter Sort', - labelInValue: 'Label In Value', - listHeight: 'List Height', - maxTagCount: 'Max Tag Count', - maxTagPlaceholder: { - title: 'Max Tag Placeholder', - tooltip: 'Content displayed when tag is hidden', - }, - maxTagTextLength: 'Max Tag Text Length', - notFoundContent: 'Not Found Content', - showArrow: 'Show Arrow', - showSearch: 'Show Search', - virtual: 'Use Virtual Scroll', -} - -const CardLocale = { - type: 'Type', - title: 'Title', - extra: 'Extra Content', - cardTypes: [ - { label: 'Built-in', value: 'inner' }, - { label: 'Default', value: '' }, - ], -} - -const CascaderLocale = { - changeOnSelect: { - title: 'Change On Select', - tooltip: 'Click on each level of menu option value will change', - }, - displayRender: { - title: 'Display Render', - tooltip: - 'The rendering function displayed after selection, the default is label => label.join("/") ', - }, - fieldNames: { - title: 'Field Names', - tooltip: - 'Defaults:{ label: "label", value: "value", children: "children" }', - }, -} - -const RadioLocale = { - buttonStyle: { title: 'Button style', dataSource: ['Hollow', 'Solid'] }, - optionType: { title: 'Option type', dataSource: ['Default', 'Button'] }, -} - -const DatePickerLocale = { - disabledDate: { - title: 'Disabled Date', - tooltip: 'Format (currentDate: moment) => boolean', - }, - disabledTime: { - title: 'Disabled Time', - tooltip: 'Format (currentDate: moment) => boolean', - }, - inputReadOnly: 'Input ReadOnly', - format: 'Format', - picker: { - title: 'Picker', - dataSource: ['Time', 'Date', 'Month', 'Year', 'Quart'], - }, - showNow: 'Show Now', - showTime: 'Show Time', - showToday: 'Show Today', -} - -const NumberPickerLocale = { - formatter: { - title: 'Format Converter', - tooltip: 'Format:function(value: number | string): string', - }, - keyboard: 'Enable Shortcut Keys', - parser: { - title: 'Format Parser', - tooltip: - 'Specify the method of converting back to numbers from the format converter, and use it with the format converter, the format:function(string): number', - }, - decimalSeparator: 'Decimal Separator', - precision: 'Precision', - max: 'Max', - min: 'Min', - step: 'Step', - stringMode: { - title: 'String Format', - tooltip: - 'Support high-precision decimals after opening. At the same time onChange will return string type', - }, -} - -const RateLocale = { - allowHalf: 'Allow Half', - tooltips: { title: 'Tooltips', tooltip: 'Format:string[]' }, - count: 'Count', -} - -const SliderLocale = { - sliderDots: 'Fixed Scale', - sliderRange: 'Double Slider', - sliderReverse: 'Reverse Coordinate System', - vertical: 'Vertical', - tooltipPlacement: { - title: 'Tooltip Placement', - tooltip: 'Set up prompt placement. Reference Tooltip', - }, - tooltipVisible: { - title: 'Tooltip Visible', - tooltip: - 'When turned on, the prompt will always be displayed; otherwise, it will always not be displayed, even when dragging and moving in', - }, - marks: 'Marks', -} - -const TimePickerLocale = { - clearText: 'Clear Text', - disabledHours: 'Disbaled Hours', - disabledMinutes: 'Disabled Minutes', - disabledSeconds: 'Disabled Seconds', - hideDisabledOptions: 'Hide Disabled Options', - hourStep: 'Hour Step', - minuteStep: 'Minute Step', - secondStep: 'Second Step', - use12Hours: 'Use 12-hour', -} - -const TreeSelectLocale = { - dropdownMatchSelectWidth: { - title: 'Dropdown Match Select Width', - tooltip: - 'By default, min-width will be set, and it will be ignored when the value is less than the width of the selection box. false will turn off virtual scrolling', - }, - showCheckedStrategy: { - title: 'Show Checked Strategy', - tooltip: - 'When configuring treeCheckable, define how to backfill the selected item. TreeSelect.SHOW_ALL: Show all selected nodes (including parent nodes). TreeSelect.SHOW_PARENT: Only display the parent node (when all child nodes under the parent node are selected). Only show child nodes by default', - dataSource: ['Show All', 'Show Parent Node', 'Show Child Nodes'], - }, - treeCheckable: 'Tree Checkable', - treeDefaultExpandAll: 'Tree Default Expand All', - treeDefaultExpandedKeys: { - title: 'Tree Default Expanded Keys', - tooltip: 'Format:Array', - }, - treeNodeFilterProp: { - title: 'Tree Node Filter Properties', - tooltip: 'The treeNode attribute corresponding to the input item filter', - }, - treeDataSimpleMode: { - title: 'Tree Data Simple Mode', - tooltip: `Use treeData in a simple format. For specific settings, refer to the settable type (the treeData should be a data structure like this: [{id:1, pId:0, value:'1', title:"test1",...} ,...], pId is the id of the parent node)`, - }, - treeNodeLabelProp: { - title: 'Tree Node Label Properties', - tooltip: 'The default is title', - }, - filterTreeNode: 'Filter Tree Node', -} - -const TransferLocale = { - oneWay: 'One Way', - operations: { - title: 'Operations', - tooltip: 'Format:string[]', - }, - titles: { title: 'Titles', tooltip: 'Format:string[]' }, - showSearchAll: 'Show Search All', -} - -const UploadLocale = { - accept: 'Accept', - action: 'Upload Address', - data: 'Data', - directory: 'Support Upload Directory', - headers: 'Headers', - listType: { title: 'List Type', dataSource: ['Text', 'Image', 'Card'] }, - multiple: 'Multiple', - name: 'Name', - openFileDialogOnClick: 'Open File Dialog On Click', - showUploadList: 'Show Upload List', - withCredentials: 'withCredentials', - maxCount: 'Max Count', - method: 'Method', - textContent: 'Text Content', -} - -const FormGridLocale = { - minWidth: 'Min Width', - minColumns: 'Min Columns', - maxWidth: 'Max Width', - maxColumns: 'Max Columns', - breakpoints: 'Breakpoints', - columnGap: 'Column Gap', - rowGap: 'Row Gap', - colWrap: 'Col Wrap', -} - -const SpaceLocale = { - direction: { title: 'Direction', dataSource: ['Vertical', 'Horizontal'] }, - split: 'Split', - wrap: 'Word Wrap', -} - -const FormTabLocale = { - animated: 'Enable Animated', - centered: 'Label Centered', - tab: 'Tab Title', - tabsTypeEnum: [ - { label: 'Line', value: 'line' }, - { label: 'Card', value: 'card' }, - ], -} - -const FormCollapseLocale = { - accordion: 'Accordion Mode', - collapsible: { title: 'Collapsible', dataSource: ['Header', 'Disable'] }, - ghost: 'Ghost Mode', - header: 'Header Title', -} - -const ArrayTableLocale = { - showHeader: 'Show Header', - sticky: 'Sticky', - align: { - title: 'Align', - dataSource: ['Left', 'Right', 'Centered'], - }, - colSpan: 'ColSpan', - fixed: { title: 'Fixed column', dataSource: ['Left', 'Right', 'None'] }, - width: 'Width', - defaultValue: 'DefaultValue', -} - -const ComponentLocale = { - ...FormLayoutLocale, - ...InputLocale, - ...FormItemLocale, - ...SelectLocale, - ...CardLocale, - ...CascaderLocale, - ...RadioLocale, - ...DatePickerLocale, - ...NumberPickerLocale, - ...RateLocale, - ...SliderLocale, - ...TimePickerLocale, - ...TreeSelectLocale, - ...TransferLocale, - ...UploadLocale, - ...FormGridLocale, - ...SpaceLocale, - ...FormTabLocale, - ...FormCollapseLocale, - ...ArrayTableLocale, -} - -const FieldLocale = { - name: 'Name', - title: 'Title', - required: 'Required', - description: 'Description', - default: 'Default', - enum: 'DataSource', - style: StyleLocale, - 'x-display': { - title: 'Display State', - tooltip: - 'When the display value is "None", the data will be "Hidden" and deleted. When the display value is hidden, only the UI will be hidden', - dataSource: ['Visible', 'Hidden', 'None', 'Inherit'], - }, - 'x-pattern': { - title: 'UI Pattern', - dataSource: ['Editable', 'Disabled', 'ReadOnly', 'ReadPretty', 'Inherit'], - }, - 'x-validator': 'Validator', - 'x-reactions': 'Reactions', - 'x-decorator': 'Decorator', - 'x-decorator-props': { - ...ComponentLocale, - tab_property: 'Decorator', - tab_style: 'Style', - }, - 'x-component-props': { - ...ComponentLocale, - tab_property: 'Component', - tab_style: 'Style', - }, -} - -const ArrayOperationsLocale = { - Index: 'Index', - SortHandle: 'Sort Handle', - Addition: 'Addition', - Remove: 'Remove', - MoveDown: 'Move Down', - MoveUp: 'Move Up', -} - -export default { - 'en-US': { - Components: { - Root: 'Root', - DesignableForm: 'Form', - DesignableField: 'Field', - Input: { title: 'Input', TextArea: 'TextArea' }, - Select: 'Select', - Radio: { title: 'Radio', Group: 'Radio Group' }, - Checkbox: { - title: 'Checkbox', - Group: 'Checkbox Group', - }, - Card: 'Card', - FormGrid: 'Form Grid', - FormLayout: 'Form Layout', - Slider: 'Slider', - Rate: 'Rate', - Cascader: 'Cascader', - Space: 'Space', - DatePicker: { title: 'Date', RangePicker: 'Date Range' }, - TimePicker: { title: 'Time', RangePicker: 'Time Range' }, - NumberPicker: 'Number', - Password: 'Password', - Transfer: 'Transfer', - TreeSelect: 'TreeSelect', - Upload: { title: 'Upload', Dragger: 'Dragger Upload' }, - Switch: 'Switch', - FormTab: { title: 'Form Tab', TabPane: 'Tab Panel' }, - FormCollapse: { title: 'Form Collapse', CollapsePanel: 'Collapse Panel' }, - Object: 'Object', - Void: 'Void Element', - Text: 'Text', - ArrayTable: { - title: 'Array Table', - Column: 'Column', - ...ArrayOperationsLocale, - }, - ArrayCards: { - title: 'Array Cards', - ...ArrayOperationsLocale, - }, - ArrayTabs: { - title: 'Array Tabs', - ...ArrayOperationsLocale, - }, - ArrayCollapse: { - title: 'Array Collapse', - ...ArrayOperationsLocale, - }, - FormItem: 'FormItem', - }, - Settings: { - ...FieldLocale, - ...ComponentLocale, - namespace: { - Text: { - content: 'Text Content', - mode: { - title: 'Text Mode', - dataSource: ['H1', 'H2', 'H3', 'Paragraph', 'Normal'], - }, - }, - Space: { - align: { - title: 'Align', - dataSource: ['Start', 'End', 'Center', 'Baseline'], - }, - }, - }, - }, - Common: { - droppable: 'Droppable', - addTabPane: 'Add Panel', - addCollapsePanel: 'Add Panel', - addTableColumn: 'Add Column', - addTableSortHandle: 'Add Sort Handle', - addIndex: 'Add Index', - addOperation: 'Add Operations', - }, - }, -} diff --git a/designable/antd/src/locales/index.ts b/designable/antd/src/locales/index.ts deleted file mode 100644 index 5d64361884b..00000000000 --- a/designable/antd/src/locales/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { GlobalRegistry } from '@designable/core' -import zhCN from './zh-CN' -import enUS from './en-US' - -GlobalRegistry.registerDesignerLocales({ - ...zhCN, - ...enUS, -}) diff --git a/designable/antd/src/locales/zh-CN.ts b/designable/antd/src/locales/zh-CN.ts deleted file mode 100644 index 4e695b2229a..00000000000 --- a/designable/antd/src/locales/zh-CN.ts +++ /dev/null @@ -1,457 +0,0 @@ -const StyleLocale = { - width: '宽度', - height: '高度', - display: '展示', - background: '背景', - boxShadow: '阴影', - font: '字体', - margin: '外边距', - padding: '内边距', - borderRadius: '圆角', - border: '边框', - opacity: '透明度', -} - -const FormLayoutLocale = { - labelCol: '标签网格宽度', - wrapperCol: '组件网格宽度', - colon: '是否有冒号', - labelAlign: { title: '标签对齐', dataSource: ['左对齐', '右对齐', '继承'] }, - wrapperAlign: { title: '组件对齐', dataSource: ['左对齐', '右对齐', '继承'] }, - labelWrap: '标签换行', - wrapperWrap: '组件换行', - labelWidth: '标签宽度', - wrapperWidth: '组件宽度', - fullness: '组件占满', - inset: '内联布局', - shallow: '是否浅传递', - bordered: '是否有边框', - size: { title: '尺寸', dataSource: ['大', '小', '默认', '继承'] }, - layout: { title: '布局', dataSource: ['垂直', '水平', '内联', '继承'] }, - feedbackLayout: { - title: '反馈布局', - dataSource: ['宽松', '紧凑', '弹层', '无', '继承'], - }, - tooltipLayout: { title: '提示布局', dataSource: ['图标', '文本', '继承'] }, -} - -const InputLocale = { - addonAfter: '后缀标签', - addonBefore: '前缀标签', - style: StyleLocale, - allowClear: '允许清除内容', - bordered: '是否有边框', - maxLength: '最大长度', - prefix: '前缀', - suffix: '后缀', - placeholder: '占位提示', - autoSize: { - title: '自适应高度', - tooltip: '可设置为 true | false 或对象:{ minRows: 2, maxRows: 6 }', - }, - showCount: '是否展示字数', - checkStrength: '检测强度', -} - -const FormItemLocale = { - tooltip: '提示', - asterisk: '星号', - gridSpan: '网格跨列', -} - -const SelectLocale = { - mode: { - title: '模式', - dataSource: ['多选', '标签', '单选'], - }, - autoClearSearchValue: { - title: '选中自动清除', - tooltip: '仅在多选或者标签模式下支持', - }, - autoFocus: '自动获取焦点', - defaultActiveFirstOption: '默认高亮第一个选项', - dropdownMatchSelectWidth: { - title: '下拉菜单和选择器同宽', - tooltip: - '默认将设置 min-width,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动', - }, - defaultOpen: '默认展开', - filterOption: '选项筛选器', - filterSort: '选项排序器', - labelInValue: { - title: '标签值', - tooltip: - '是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式', - }, - listHeight: '弹窗滚动高度', - maxTagCount: { - title: '最多标签数量', - tooltip: '最多显示多少个 tag,响应式模式会对性能产生损耗', - }, - maxTagPlaceholder: { - title: '最多标签占位', - tooltip: '隐藏 tag 时显示的内容', - }, - maxTagTextLength: '最多标签文本长度', - notFoundContent: '空状态内容', - showArrow: '显示箭头', - showSearch: '支持搜索', - virtual: '开启虚拟滚动', -} - -const CardLocale = { - type: '类型', - title: '标题', - extra: '右侧扩展', - cardTypes: [ - { label: '内置', value: 'inner' }, - { label: '默认', value: '' }, - ], -} - -const CascaderLocale = { - changeOnSelect: { - title: '选择时触发', - tooltip: '点选每级菜单选项值都会发生变化', - }, - displayRender: { - title: '渲染函数', - tooltip: '选择后展示的渲染函数,默认为label => label.join("/") ', - }, - fieldNames: { - title: '自定义字段名', - tooltip: '默认值:{ label: "label", value: "value", children: "children" }', - }, -} - -const RadioLocale = { - buttonStyle: { title: '按钮风格', dataSource: ['空心', '实心'] }, - optionType: { title: '选项类型', dataSource: ['默认', '按钮'] }, -} - -const DatePickerLocale = { - disabledDate: { - title: '不可选日期', - tooltip: '格式 (currentDate: moment) => boolean', - }, - disabledTime: { - title: '不可选时间', - tooltip: '格式 (currentDate: moment) => boolean', - }, - inputReadOnly: '输入框只读', - format: '格式', - picker: { - title: '选择器类型', - dataSource: ['时间', '日期', '月份', '年', '季度'], - }, - showNow: '显示此刻', - showTime: '时间选择', - showToday: '显示今天', -} - -const NumberPickerLocale = { - formatter: { - title: '格式转换器', - tooltip: '格式:function(value: number | string): string', - }, - keyboard: '启用快捷键', - parser: { - title: '格式解析器', - tooltip: - '指定从 格式转换器 里转换回数字的方式,和 格式转换器 搭配使用,格式:function(string): number', - }, - decimalSeparator: '小数点', - precision: '数字精度', - max: '最大值', - min: '最小值', - step: '步长', - stringMode: { - title: '字符串格式', - tooltip: '开启后支持高精度小数。同时 onChange 将返回 string 类型', - }, -} - -const RateLocale = { - allowHalf: '允许半选', - tooltips: { title: '提示信息', tooltip: '格式:string[]' }, - count: '总数', -} - -const SliderLocale = { - sliderDots: '刻度固定', - sliderRange: '双滑块', - sliderReverse: '反向坐标系', - vertical: '垂直布局', - tooltipPlacement: { - title: '提示位置', - tooltip: '设置 提示 展示位置。参考 Tooltip', - }, - tooltipVisible: { - title: '提示显示', - tooltip: '开启时,提示 将会始终显示;否则始终不显示,哪怕在拖拽及移入时', - }, - marks: '刻度标签', -} - -const TimePickerLocale = { - clearText: '清除提示', - disabledHours: '禁止小时', - disabledMinutes: '禁止分钟', - disabledSeconds: '禁止秒', - hideDisabledOptions: '隐藏禁止选项', - hourStep: '小时间隔', - minuteStep: '分钟间隔', - secondStep: '秒间隔', - use12Hours: '12小时制', -} - -const TreeSelectLocale = { - dropdownMatchSelectWidth: { - title: '下拉选择器同宽', - tooltip: - '默认将设置 min-width,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动', - }, - showCheckedStrategy: { - title: '复选回显策略', - tooltip: - '配置 treeCheckable 时,定义选中项回填的方式。TreeSelect.SHOW_ALL: 显示所有选中节点(包括父节点)。TreeSelect.SHOW_PARENT: 只显示父节点(当父节点下所有子节点都选中时)。 默认只显示子节点', - dataSource: ['显示所有', '显示父节点', '显示子节点'], - }, - treeCheckable: '开启复选', - treeDefaultExpandAll: '默认展开所有', - treeDefaultExpandedKeys: { - title: '默认展开选项', - tooltip: '格式:Array', - }, - treeNodeFilterProp: { - title: '节点过滤属性', - tooltip: '输入项过滤对应的 treeNode 属性', - }, - treeDataSimpleMode: { - title: '使用简单数据结构', - tooltip: `使用简单格式的 treeData,具体设置参考可设置的类型 (此时 treeData 应变为这样的数据结构: [{id:1, pId:0, value:'1', title:"test1",...},...], pId 是父节点的 id)`, - }, - treeNodeLabelProp: { title: '标签显示名称', tooltip: '默认为title' }, - filterTreeNode: '节点过滤器', -} - -const TransferLocale = { - oneWay: '单向展示', - operations: { title: '操作文案集合', tooltip: '格式:string[]' }, - titles: { title: '标题集合', tooltip: '格式:string[]' }, - showSearchAll: '支持全选', -} - -const UploadLocale = { - accept: '可接受类型', - action: '上传地址', - data: '数据/参数', - directory: '支持上传目录', - headers: '请求头', - listType: { title: '列表类型', dataSource: ['文本', '图片', '卡片'] }, - multiple: '多选模式', - name: '字段标识', - openFileDialogOnClick: { - title: '点击打开文件对话框', - tooltip: '点击打开文件对话框', - }, - showUploadList: '是否展示文件列表', - withCredentials: '携带Cookie', - maxCount: '最大数量', - method: '方法', - textContent: '上传文案', -} - -const FormGridLocale = { - minWidth: '最小宽度', - minColumns: '最小列数', - maxWidth: '最大宽度', - maxColumns: '最大列数', - breakpoints: '响应式断点', - columnGap: '列间距', - rowGap: '行间距', - colWrap: '自动换行', -} - -const SpaceLocale = { - direction: { title: '方向', dataSource: ['垂直', '水平'] }, - split: '分割内容', - wrap: '自动换行', -} - -const FormTabLocale = { - animated: '启用动画过渡', - centered: '标签居中', - tab: '选项名称', - tabsTypeEnum: [ - { label: '线框', value: 'line' }, - { label: '卡片', value: 'card' }, - ], -} - -const FormCollapseLocale = { - accordion: '手风琴模式', - collapsible: { title: '可折叠区域', dataSource: ['头部', '禁用'] }, - ghost: '幽灵模式', - header: '头部内容', -} - -const ArrayTableLocale = { - showHeader: '显示头部', - sticky: '吸顶', - align: { - title: '对齐', - dataSource: ['左', '右', '居中'], - }, - colSpan: '跨列', - fixed: { title: '固定列', dataSource: ['左', '右', '无'] }, - width: '宽度', - defaultValue: '默认值', -} - -const ComponentLocale = { - ...FormLayoutLocale, - ...InputLocale, - ...FormItemLocale, - ...SelectLocale, - ...CardLocale, - ...CascaderLocale, - ...RadioLocale, - ...DatePickerLocale, - ...NumberPickerLocale, - ...RateLocale, - ...SliderLocale, - ...TimePickerLocale, - ...TreeSelectLocale, - ...TransferLocale, - ...UploadLocale, - ...FormGridLocale, - ...SpaceLocale, - ...FormTabLocale, - ...FormCollapseLocale, - ...ArrayTableLocale, -} - -const FieldLocale = { - name: '字段标识', - title: '标题', - required: '必填', - description: '描述', - default: '默认值', - enum: '数据源', - style: StyleLocale, - 'x-display': { - title: '展示状态', - tooltip: '半隐藏只会隐藏UI,全隐藏会删除数据', - dataSource: ['显示', '半隐藏', '全隐藏', '继承'], - }, - 'x-pattern': { - title: 'UI形态', - dataSource: ['可编辑', '禁用', '只读', '阅读', '继承'], - }, - 'x-validator': '校验规则', - 'x-reactions': '响应器规则', - 'x-decorator': '启用容器组件', - 'x-decorator-props': { - ...ComponentLocale, - tab_property: '容器属性', - tab_style: '容器样式', - }, - 'x-component-props': { - ...ComponentLocale, - tab_property: '组件属性', - tab_style: '组件样式', - }, -} - -const ArrayOperationsLocale = { - Index: '索引', - SortHandle: '排序手柄', - Addition: '新增按钮', - Remove: '删除按钮', - MoveDown: '下移按钮', - MoveUp: '上移按钮', -} - -export default { - 'zh-CN': { - Components: { - Root: '根组件', - DesignableForm: '表单', - DesignableField: '字段', - Input: { title: '输入框', TextArea: '多行文本' }, - Select: '选择框', - Radio: { title: '单选框', Group: '单选框组' }, - Checkbox: { - title: '复选框', - Group: '复选框组', - }, - Card: '卡片布局', - FormGrid: '网格布局', - FormLayout: '表单布局', - Slider: '滑动条', - Rate: '评分器', - Cascader: '联级选择', - Space: '弹性间距', - DatePicker: { title: '日期选择', RangePicker: '日期范围' }, - TimePicker: { title: '时间选择', RangePicker: '时间范围' }, - NumberPicker: '数字输入', - Password: '密码输入', - Transfer: '穿梭框', - TreeSelect: '树选择', - Upload: { title: '上传', Dragger: '拖拽上传' }, - Switch: '开关', - FormTab: { title: '选项卡布局', TabPane: '选项卡面板' }, - FormCollapse: { title: '手风琴布局', CollapsePanel: '手风琴面板' }, - Object: '数据对象', - Void: '虚拟容器', - Text: '文本', - ArrayTable: { - title: '自增表格', - Column: '表格列', - ...ArrayOperationsLocale, - }, - ArrayCards: { - title: '自增卡片', - ...ArrayOperationsLocale, - }, - ArrayTabs: { - title: '自增选项卡', - ...ArrayOperationsLocale, - }, - ArrayCollapse: { - title: '自增手风琴', - ...ArrayOperationsLocale, - }, - FormItem: '表单项容器', - }, - Settings: { - ...FieldLocale, - ...ComponentLocale, - namespace: { - Text: { - content: '文本内容', - mode: { - title: '文本类型', - dataSource: ['H1', 'H2', 'H3', 'Paragraph', 'Normal'], - }, - }, - Space: { - align: { - title: '对齐', - dataSource: ['头部', '尾部', '居中', '基准线'], - }, - }, - }, - }, - Common: { - droppable: '可以拖入组件', - addTabPane: '添加选项卡', - addCollapsePanel: '添加手风琴卡片', - addTableColumn: '添加表格列', - addTableSortHandle: '添加排序', - addIndex: '添加索引', - addOperation: '添加操作', - }, - }, -} diff --git a/designable/antd/src/schemas/ArrayCards.ts b/designable/antd/src/schemas/ArrayCards.ts deleted file mode 100644 index b970c033a98..00000000000 --- a/designable/antd/src/schemas/ArrayCards.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ArrayTable } from './ArrayTable' -import { Card } from './Card' - -export const ArrayCards = Card -ArrayCards.Addition = ArrayTable.Addition diff --git a/designable/antd/src/schemas/ArrayTable.ts b/designable/antd/src/schemas/ArrayTable.ts deleted file mode 100644 index a88dc4cba8f..00000000000 --- a/designable/antd/src/schemas/ArrayTable.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { ISchema } from '@formily/react' - -export const ArrayTable: ISchema & { Addition?: ISchema; Column?: ISchema } = { - type: 'object', - properties: { - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - showHeader: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - sticky: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'small', - }, - }, - }, -} - -const Column: ISchema = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - align: { - type: 'string', - enum: ['left', 'right', 'center'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'left', - optionType: 'button', - }, - }, - colSpan: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - width: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - fixed: { - type: 'string', - enum: ['left', 'right', false], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - optionType: 'button', - }, - }, - }, -} - -const Addition: ISchema = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - method: { - type: 'string', - enum: ['push', 'unshift'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'push', - optionType: 'button', - }, - }, - defaultValue: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - }, - }, -} - -ArrayTable.Column = Column -ArrayTable.Addition = Addition diff --git a/designable/antd/src/schemas/CSSStyle.ts b/designable/antd/src/schemas/CSSStyle.ts deleted file mode 100644 index 53563535aa0..00000000000 --- a/designable/antd/src/schemas/CSSStyle.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { ISchema } from '@formily/react' - -export const CSSStyle: ISchema = { - type: 'void', - properties: { - 'style.width': { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - 'style.height': { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - 'style.display': { - 'x-component': 'DisplayStyleSetter', - }, - 'style.background': { - 'x-component': 'BackgroundStyleSetter', - }, - 'style.boxShadow': { - 'x-component': 'BoxShadowStyleSetter', - }, - 'style.font': { - 'x-component': 'FontStyleSetter', - }, - 'style.margin': { - 'x-component': 'BoxStyleSetter', - }, - 'style.padding': { - 'x-component': 'BoxStyleSetter', - }, - 'style.borderRadius': { - 'x-component': 'BorderRadiusStyleSetter', - }, - 'style.border': { - 'x-component': 'BorderStyleSetter', - }, - 'style.opacity': { - 'x-decorator': 'FormItem', - 'x-component': 'Slider', - 'x-component-props': { - defaultValue: 1, - min: 0, - max: 1, - step: 0.01, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Card.ts b/designable/antd/src/schemas/Card.ts deleted file mode 100644 index 22ef2b083ba..00000000000 --- a/designable/antd/src/schemas/Card.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { GlobalRegistry } from '@designable/core' -import { ISchema } from '@formily/react' - -export const Card: ISchema & { Addition?: ISchema } = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - extra: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - type: { - type: 'boolean', - enum: GlobalRegistry.getDesignerMessage('settings.cardTypes'), - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: '', - optionType: 'button', - }, - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Cascader.ts b/designable/antd/src/schemas/Cascader.ts deleted file mode 100644 index e7b7d7d40ae..00000000000 --- a/designable/antd/src/schemas/Cascader.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Cascader: ISchema = { - type: 'object', - properties: { - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - changeOnSelect: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - displayRender: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - fieldNames: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - notFoundContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - defaultValue: 'Not Found', - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'middle', - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Checkbox.ts b/designable/antd/src/schemas/Checkbox.ts deleted file mode 100644 index 9c152bbdb92..00000000000 --- a/designable/antd/src/schemas/Checkbox.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Checkbox: ISchema & { Group?: ISchema } = { - type: 'object', - properties: { - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/antd/src/schemas/DatePicker.ts b/designable/antd/src/schemas/DatePicker.ts deleted file mode 100644 index 5b72fcf4710..00000000000 --- a/designable/antd/src/schemas/DatePicker.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { ISchema } from '@formily/react' - -const CommonDatePickerAPI = { - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - disabledTime: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - disabledDate: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - inputReadOnly: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'middle', - }, - }, - format: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - placeholder: 'YYYY-MM-DD', - }, - }, -} - -export const DatePicker: ISchema & { RangePicker?: ISchema } = { - type: 'object', - properties: { - picker: { - type: 'string', - enum: ['time', 'date', 'month', 'year', 'decade'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'date', - }, - }, - ...CommonDatePickerAPI, - showNow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showTime: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showToday: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} - -DatePicker.RangePicker = { - type: 'object', - properties: { - picker: { - type: 'string', - enum: ['time', 'date', 'month', 'year', 'decade'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'date', - }, - }, - ...CommonDatePickerAPI, - showTime: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/antd/src/schemas/Form.ts b/designable/antd/src/schemas/Form.ts deleted file mode 100644 index 1d5e472ab9f..00000000000 --- a/designable/antd/src/schemas/Form.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ISchema } from '@formily/react' -import { FormLayout } from './FormLayout' -import { CSSStyle } from './CSSStyle' - -export const Form: ISchema = { - type: 'object', - properties: { - ...(FormLayout.properties as any), - style: CSSStyle, - }, -} diff --git a/designable/antd/src/schemas/FormCollapse.ts b/designable/antd/src/schemas/FormCollapse.ts deleted file mode 100644 index 328ba1398dc..00000000000 --- a/designable/antd/src/schemas/FormCollapse.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ISchema } from '@formily/react' - -export const FormCollapse: ISchema & { CollapsePanel?: ISchema } = { - type: 'object', - properties: { - accordion: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - collapsible: { - type: 'string', - enum: ['header', 'disabled'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'header', - optionType: 'button', - }, - }, - ghost: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} - -FormCollapse.CollapsePanel = { - type: 'object', - properties: { - collapsible: { - type: 'string', - enum: ['header', 'disabled'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'header', - optionType: 'button', - }, - }, - header: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - extra: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, -} diff --git a/designable/antd/src/schemas/FormGrid.ts b/designable/antd/src/schemas/FormGrid.ts deleted file mode 100644 index 73a1fbea9f8..00000000000 --- a/designable/antd/src/schemas/FormGrid.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { ISchema } from '@formily/react' - -export const FormGrid: ISchema = { - type: 'object', - properties: { - minWidth: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 100, - }, - }, - maxWidth: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - minColumns: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 0, - }, - }, - maxColumns: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - breakpoints: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - columnGap: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 10, - }, - }, - rowGap: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 5, - }, - }, - colWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/FormItem.ts b/designable/antd/src/schemas/FormItem.ts deleted file mode 100644 index 354cbd7c417..00000000000 --- a/designable/antd/src/schemas/FormItem.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { ISchema } from '@formily/react' - -export const FormItem: ISchema = { - type: 'object', - properties: { - tooltip: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonBefore: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonAfter: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - labelCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - wrapperCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - labelWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - wrapperWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - colon: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - asterisk: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - gridSpan: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - feedbackLayout: { - type: 'string', - enum: ['loose', 'terse', 'popover', 'none', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'loose', - }, - }, - size: { - type: 'string', - enum: ['large', 'small', 'default', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'default', - }, - }, - layout: { - type: 'string', - enum: ['vertical', 'horizontal', 'inline', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'horizontal', - }, - }, - - tooltipLayout: { - type: 'string', - enum: ['icon', 'text', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'icon', - }, - }, - labelAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'right', - }, - }, - wrapperAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'left', - }, - }, - labelWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - wrapperWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - fullness: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - inset: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/FormLayout.ts b/designable/antd/src/schemas/FormLayout.ts deleted file mode 100644 index 366d27b5f3e..00000000000 --- a/designable/antd/src/schemas/FormLayout.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { ISchema } from '@formily/react' - -export const FormLayout: ISchema = { - type: 'object', - properties: { - labelCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - wrapperCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - labelWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - wrapperWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - colon: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - feedbackLayout: { - type: 'string', - enum: ['loose', 'terse', 'popover', 'none', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'loose', - }, - }, - size: { - type: 'string', - enum: ['large', 'small', 'default', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'default', - }, - }, - layout: { - type: 'string', - enum: ['vertical', 'horizontal', 'inline', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'horizontal', - }, - }, - tooltipLayout: { - type: 'string', - enum: ['icon', 'text', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'icon', - }, - }, - labelAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'right', - }, - }, - wrapperAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'left', - }, - }, - labelWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - wrapperWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - - fullness: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - inset: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - shallow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/FormTab.ts b/designable/antd/src/schemas/FormTab.ts deleted file mode 100644 index 5074ca66159..00000000000 --- a/designable/antd/src/schemas/FormTab.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { GlobalRegistry } from '@designable/core' -import { ISchema } from '@formily/react' - -export const FormTab: ISchema & { TabPane?: ISchema } = { - type: 'object', - properties: { - animated: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - centered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - size: { - type: 'string', - enum: ['large', 'small', 'default', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'default', - }, - }, - type: { - type: 'string', - enum: GlobalRegistry.getDesignerMessage('settings.tabsTypeEnum'), - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'line', - optionType: 'button', - }, - }, - }, -} - -FormTab.TabPane = { - type: 'object', - properties: { - tab: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, -} diff --git a/designable/antd/src/schemas/Input.ts b/designable/antd/src/schemas/Input.ts deleted file mode 100644 index 641033ee824..00000000000 --- a/designable/antd/src/schemas/Input.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Input: ISchema & { TextArea?: ISchema } = { - type: 'object', - properties: { - addonBefore: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonAfter: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - prefix: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - suffix: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - maxLength: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'middle', - }, - }, - }, -} - -Input.TextArea = { - type: 'object', - properties: { - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - maxLength: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - autoSize: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showCount: { - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/antd/src/schemas/NumberPicker.ts b/designable/antd/src/schemas/NumberPicker.ts deleted file mode 100644 index 7b026706fef..00000000000 --- a/designable/antd/src/schemas/NumberPicker.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { ISchema } from '@formily/react' - -export const NumberPicker: ISchema = { - type: 'object', - properties: { - decimalSeparator: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - precision: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - max: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - min: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - step: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'middle', - }, - }, - formatter: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - parser: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - stringMode: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - keyboard: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Password.ts b/designable/antd/src/schemas/Password.ts deleted file mode 100644 index 972ad912052..00000000000 --- a/designable/antd/src/schemas/Password.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ISchema } from '@formily/react' -import { Input } from './Input' -export const Password: ISchema = { - type: 'object', - properties: { - ...(Input.properties as any), - checkStrength: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/antd/src/schemas/Radio.ts b/designable/antd/src/schemas/Radio.ts deleted file mode 100644 index 7101ab5051e..00000000000 --- a/designable/antd/src/schemas/Radio.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Radio: ISchema & { Group?: ISchema } = { - type: 'object', - properties: { - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} - -Radio.Group = { - type: 'object', - properties: { - optionType: { - type: 'string', - enum: ['default', 'button'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'default', - optionType: 'button', - }, - }, - buttonStyle: { - type: 'string', - enum: ['outline', 'solid'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'outline', - optionType: 'button', - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Rate.ts b/designable/antd/src/schemas/Rate.ts deleted file mode 100644 index 1c03dbe0529..00000000000 --- a/designable/antd/src/schemas/Rate.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Rate: ISchema = { - type: 'object', - properties: { - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - count: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 5, - }, - }, - allowHalf: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - tooltips: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/antd/src/schemas/Select.ts b/designable/antd/src/schemas/Select.ts deleted file mode 100644 index eb340cc30c9..00000000000 --- a/designable/antd/src/schemas/Select.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Select: ISchema = { - type: 'object', - properties: { - mode: { - type: 'string', - enum: ['multiple', 'tags', null], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: null, - optionType: 'button', - }, - }, - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - autoClearSearchValue: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - dropdownMatchSelectWidth: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - defaultActiveFirstOption: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - defaultOpen: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - labelInValue: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showArrow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - virtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultValue: true, - }, - }, - filterOption: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['BOOLEAN', 'EXPRESSION'], - }, - }, - filterSort: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - listHeight: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 256, - }, - }, - maxTagCount: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - maxTagPlaceholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - maxTagTextLength: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - notFoundContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - defaultValue: 'Not Found', - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'middle', - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Slider.ts b/designable/antd/src/schemas/Slider.ts deleted file mode 100644 index 00e185512a6..00000000000 --- a/designable/antd/src/schemas/Slider.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { GlobalRegistry } from '@designable/core' -import { ISchema } from '@formily/react' - -export const Slider: ISchema = { - type: 'object', - properties: { - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - dots: { - title: GlobalRegistry.getDesignerMessage('settings.sliderDots'), - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - range: { - title: GlobalRegistry.getDesignerMessage('settings.sliderRange'), - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - reverse: { - title: GlobalRegistry.getDesignerMessage('settings.sliderReverse'), - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - vertical: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - tooltipVisible: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - tooltipPlacement: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - marks: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - max: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 100, - }, - }, - min: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 0, - }, - }, - step: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 1, - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Space.ts b/designable/antd/src/schemas/Space.ts deleted file mode 100644 index da16defeaa7..00000000000 --- a/designable/antd/src/schemas/Space.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Space: ISchema = { - type: 'object', - properties: { - align: { - type: 'string', - enum: ['start', 'end', 'center', 'baseline'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - }, - direction: { - type: 'string', - enum: ['vertical', 'horizontal'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'horizontal', - optionType: 'button', - }, - }, - size: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 8, - }, - }, - split: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - wrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/antd/src/schemas/Switch.ts b/designable/antd/src/schemas/Switch.ts deleted file mode 100644 index 1b5a158ebbd..00000000000 --- a/designable/antd/src/schemas/Switch.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Switch: ISchema = { - type: 'object', - properties: { - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - size: { - type: 'string', - enum: ['large', 'small', 'default', ''], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'default', - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Text.ts b/designable/antd/src/schemas/Text.ts deleted file mode 100644 index 66784e1c78e..00000000000 --- a/designable/antd/src/schemas/Text.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Text: ISchema = { - type: 'object', - properties: { - content: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - }, - mode: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'normal', - }, - enum: ['h1', 'h2', 'h3', 'p', 'normal'], - }, - }, -} diff --git a/designable/antd/src/schemas/TimePicker.ts b/designable/antd/src/schemas/TimePicker.ts deleted file mode 100644 index 8bb9a28f9f6..00000000000 --- a/designable/antd/src/schemas/TimePicker.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { ISchema } from '@formily/react' - -export const CommonTimePickerAPI = { - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - clearText: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - disabledHours: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - disabledMinutes: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - disabledSeconds: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - hideDisabledOptions: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - inputReadOnly: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showNow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - use12Hours: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - hourStep: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 1, - }, - }, - minuteStep: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 1, - }, - }, - secondStep: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 1, - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - }, - format: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - placeholder: 'YYYY-MM-DD', - }, - }, -} - -export const TimePicker: ISchema & { RangePicker?: ISchema } = { - type: 'object', - properties: CommonTimePickerAPI, -} - -TimePicker.RangePicker = { - type: 'object', - properties: CommonTimePickerAPI, -} diff --git a/designable/antd/src/schemas/Transfer.ts b/designable/antd/src/schemas/Transfer.ts deleted file mode 100644 index 7873d1d9213..00000000000 --- a/designable/antd/src/schemas/Transfer.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Transfer: ISchema = { - type: 'object', - properties: { - oneWay: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showSearchAll: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - filterOption: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - operations: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - titles: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - }, -} diff --git a/designable/antd/src/schemas/TreeSelect.ts b/designable/antd/src/schemas/TreeSelect.ts deleted file mode 100644 index 96cc1dfd38e..00000000000 --- a/designable/antd/src/schemas/TreeSelect.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { ISchema } from '@formily/react' - -export const TreeSelect: ISchema = { - type: 'object', - properties: { - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - autoClearSearchValue: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - labelInValue: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showArrow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - virtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - treeCheckable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - treeDefaultExpandAll: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - dropdownMatchSelectWidth: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - showCheckedStrategy: { - type: 'string', - enum: ['SHOW_ALL', 'SHOW_PARENT', 'SHOW_CHILD'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'SHOW_CHILD', - }, - }, - treeDefaultExpandedKeys: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - treeNodeFilterProp: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - treeNodeLabelProp: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - filterTreeNode: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['BOOLEAN', 'EXPRESSION'], - }, - }, - treeDataSimpleMode: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['BOOLEAN', 'EXPRESSION'], - }, - }, - listHeight: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 256, - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - size: { - type: 'string', - enum: ['large', 'small', 'middle', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'middle', - }, - }, - }, -} diff --git a/designable/antd/src/schemas/Upload.ts b/designable/antd/src/schemas/Upload.ts deleted file mode 100644 index a43dc306041..00000000000 --- a/designable/antd/src/schemas/Upload.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Upload: ISchema & { Dragger?: ISchema } = { - type: 'object', - properties: { - textContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - accept: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - action: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['TEXT', 'EXPRESSION'], - }, - }, - name: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - defaultValue: 'file', - }, - }, - maxCount: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - method: { - enum: ['POST', 'PUT', 'GET'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'POST', - optionType: 'button', - }, - }, - data: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - headers: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - - listType: { - enum: ['text', 'picture', 'picture-card'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'text', - optionType: 'button', - }, - }, - directory: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - multiple: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - openFileDialogOnClick: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - showUploadList: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - withCredentials: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} - -Upload.Dragger = Upload diff --git a/designable/antd/src/schemas/index.ts b/designable/antd/src/schemas/index.ts deleted file mode 100644 index e046ffae474..00000000000 --- a/designable/antd/src/schemas/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from './Input' -export * from './Text' -export * from './FormLayout' -export * from './CSSStyle' -export * from './Form' -export * from './FormItem' -export * from './Select' -export * from './Card' -export * from './Cascader' -export * from './Checkbox' -export * from './Radio' -export * from './DatePicker' -export * from './NumberPicker' -export * from './Password' -export * from './Rate' -export * from './Slider' -export * from './TimePicker' -export * from './TreeSelect' -export * from './Transfer' -export * from './Upload' -export * from './Switch' -export * from './FormGrid' -export * from './Space' -export * from './FormTab' -export * from './FormCollapse' -export * from './ArrayTable' -export * from './ArrayCards' diff --git a/designable/antd/src/shared.ts b/designable/antd/src/shared.ts deleted file mode 100644 index 0edd6e34f8c..00000000000 --- a/designable/antd/src/shared.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { TreeNode, Engine } from '@designable/core' - -export type ComponentNameMatcher = - | string - | string[] - | ((name: string, node: TreeNode, context?: any) => boolean) - -export const matchComponent = ( - node: TreeNode, - name: ComponentNameMatcher, - context?: any -) => { - if (name === '*') return true - const componentName = node?.props?.['x-component'] - if (typeof name === 'function') - return name(componentName || '', node, context) - if (Array.isArray(name)) return name.includes(componentName) - return componentName === name -} - -export const matchChildComponent = ( - node: TreeNode, - name: ComponentNameMatcher, - context?: any -) => { - if (name === '*') return true - const componentName = node?.props?.['x-component'] - if (!componentName) return false - if (typeof name === 'function') - return name(componentName || '', node, context) - if (Array.isArray(name)) return name.includes(componentName) - return componentName.indexOf(`${name}.`) > -1 -} - -export const includesComponent = ( - node: TreeNode, - names: ComponentNameMatcher[], - target?: TreeNode -) => { - return names.some((name) => matchComponent(node, name, target)) -} - -export const queryNodesByComponentPath = ( - node: TreeNode, - path: ComponentNameMatcher[] -): TreeNode[] => { - if (path?.length === 0) return [] - if (path?.length === 1) { - if (matchComponent(node, path[0])) { - return [node] - } - } - return matchComponent(node, path[0]) - ? node.children.reduce((buf, child) => { - return buf.concat(queryNodesByComponentPath(child, path.slice(1))) - }, []) - : [] -} - -export const findNodeByComponentPath = ( - node: TreeNode, - path: ComponentNameMatcher[] -): TreeNode => { - if (path?.length === 0) return - if (path?.length === 1) { - if (matchComponent(node, path[0])) { - return node - } - } - if (matchComponent(node, path[0])) { - for (let i = 0; i < node.children.length; i++) { - const next = findNodeByComponentPath(node.children[i], path.slice(1)) - if (next) { - return next - } - } - } -} - -export const hasNodeByComponentPath = ( - node: TreeNode, - path: ComponentNameMatcher[] -) => !!findNodeByComponentPath(node, path) - -export const matchArrayItemsNode = (node: TreeNode) => { - return ( - node?.parent?.props?.type === 'array' && - node?.parent?.children?.[0] === node - ) -} - -export const createNodeId = (designer: Engine, id: string) => { - return { - [designer.props.nodeIdAttrName]: id, - } -} - -export const createEnsureTypeItemsNode = (type: string) => (node: TreeNode) => { - const objectNode = node.children.find((child) => child.props['type'] === type) - if ( - objectNode && - objectNode.designerProps.droppable && - !objectNode.props['x-component'] - ) { - return objectNode - } else { - const newObjectNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type, - }, - }) - node.prepend(newObjectNode) - return newObjectNode - } -} diff --git a/designable/antd/src/sources/arrays.ts b/designable/antd/src/sources/arrays.ts deleted file mode 100644 index 0f8cb421140..00000000000 --- a/designable/antd/src/sources/arrays.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('arrays', [ - { - componentName: 'DesignableField', - props: { - type: 'array', - 'x-decorator': 'FormItem', - 'x-component': 'ArrayTable', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'array', - 'x-decorator': 'FormItem', - 'x-component': 'ArrayCards', - 'x-component-props': { - title: `Title`, - }, - }, - }, -]) diff --git a/designable/antd/src/sources/displays.ts b/designable/antd/src/sources/displays.ts deleted file mode 100644 index 8506ea95256..00000000000 --- a/designable/antd/src/sources/displays.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('displays', [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'Text', - }, - }, -]) diff --git a/designable/antd/src/sources/index.ts b/designable/antd/src/sources/index.ts deleted file mode 100644 index c9da47ecd8a..00000000000 --- a/designable/antd/src/sources/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import './inputs' -import './layouts' -import './arrays' -import './displays' diff --git a/designable/antd/src/sources/inputs.ts b/designable/antd/src/sources/inputs.ts deleted file mode 100644 index 703584626d7..00000000000 --- a/designable/antd/src/sources/inputs.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('inputs', [ - { - componentName: 'DesignableField', - props: { - title: 'Input', - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'TextArea', - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'Select', - 'x-decorator': 'FormItem', - 'x-component': 'Select', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'Tree Select', - 'x-decorator': 'FormItem', - 'x-component': 'TreeSelect', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'Cascader', - 'x-decorator': 'FormItem', - 'x-component': 'Cascader', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string | number', - title: 'Radio Group', - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - enum: [ - { label: '选项1', value: 1 }, - { label: '选项2', value: 2 }, - ], - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Checkbox Group', - 'x-decorator': 'FormItem', - 'x-component': 'Checkbox.Group', - enum: [ - { label: '选项1', value: 1 }, - { label: '选项2', value: 2 }, - ], - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'number', - title: 'Slider', - 'x-decorator': 'FormItem', - 'x-component': 'Slider', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'number', - title: 'Rate', - 'x-decorator': 'FormItem', - 'x-component': 'Rate', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string', - title: 'DatePicker', - 'x-decorator': 'FormItem', - 'x-component': 'DatePicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: '[string,string]', - title: 'DateRangePicker', - 'x-decorator': 'FormItem', - 'x-component': 'DatePicker.RangePicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string', - title: 'TimePicker', - 'x-decorator': 'FormItem', - 'x-component': 'TimePicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: '[string,string]', - title: 'TimeRangePicker', - 'x-decorator': 'FormItem', - 'x-component': 'TimePicker.RangePicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'number', - title: 'NumberPicker', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string', - title: 'Password', - 'x-decorator': 'FormItem', - 'x-component': 'Password', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Transfer', - 'x-decorator': 'FormItem', - 'x-component': 'Transfer', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Upload', - 'x-decorator': 'FormItem', - 'x-component': 'Upload', - 'x-component-props': { - textContent: 'Upload', - }, - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Drag Upload', - 'x-decorator': 'FormItem', - 'x-component': 'Upload.Dragger', - 'x-component-props': { - textContent: 'Click or drag file to this area to upload', - }, - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'boolean', - title: 'Switch', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'object', - }, - }, -]) diff --git a/designable/antd/src/sources/layouts.ts b/designable/antd/src/sources/layouts.ts deleted file mode 100644 index f7809a01540..00000000000 --- a/designable/antd/src/sources/layouts.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('layouts', [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'Card', - 'x-component-props': { - title: 'Title', - }, - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormGrid', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormLayout', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'Space', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormTab', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormCollapse', - }, - }, -]) diff --git a/designable/antd/tsconfig.build.json b/designable/antd/tsconfig.build.json deleted file mode 100644 index dbf069a065d..00000000000 --- a/designable/antd/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./lib", - "paths": { - "@formily/*": [ - "../../packages/*", - "../../designable/*", - "../../devtools/*" - ] - }, - "declaration": true - } -} diff --git a/designable/antd/tsconfig.json b/designable/antd/tsconfig.json deleted file mode 100644 index c6865c25a75..00000000000 --- a/designable/antd/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["./src/**/*.ts", "./src/**/*.tsx"], - "exclude": ["./src/__tests__/*", "./esm/*", "./lib/*"] -} diff --git a/designable/next/.npmignore b/designable/next/.npmignore deleted file mode 100644 index 1ff337420fd..00000000000 --- a/designable/next/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -*.log -build -docs -doc-site -__tests__ -.eslintrc -jest.config.js -tsconfig.json -.umi -src \ No newline at end of file diff --git a/designable/next/.umirc.js b/designable/next/.umirc.js deleted file mode 100644 index 1362b3c43c6..00000000000 --- a/designable/next/.umirc.js +++ /dev/null @@ -1,44 +0,0 @@ -import { resolve } from 'path' -export default { - mode: 'site', - logo: '//img.alicdn.com/imgextra/i2/O1CN01Kq3OHU1fph6LGqjIz_!!6000000004056-55-tps-1141-150.svg', - title: 'Formily', - hash: true, - favicon: - '//img.alicdn.com/imgextra/i3/O1CN01XtT3Tv1Wd1b5hNVKy_!!6000000002810-55-tps-360-360.svg', - outputPath: './doc-site', - navs: [ - { - title: 'Ant Design', - path: '/components', - }, - { - title: '主站', - path: 'https://v2.formilyjs.org', - }, - { - title: 'GITHUB', - path: 'https://github.com/alibaba/formily', - }, - ], - styles: [ - `.__dumi-default-navbar-logo{ - height: 60px !important; - width: 150px !important; - padding-left:0 !important; - color: transparent !important; - } - .__dumi-default-navbar{ - padding: 0 28px !important; - } - .__dumi-default-layout-hero{ - background-image: url(//img.alicdn.com/imgextra/i4/O1CN01ZcvS4e26XMsdsCkf9_!!6000000007671-2-tps-6001-4001.png); - background-size: cover; - background-repeat: no-repeat; - } - nav a{ - text-decoration: none !important; - } - `, - ], -} diff --git a/designable/next/LICENSE.md b/designable/next/LICENSE.md deleted file mode 100644 index 509632e8e80..00000000000 --- a/designable/next/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-present, Alibaba Group Holding Limited. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/designable/next/README.md b/designable/next/README.md deleted file mode 100644 index 79f8236d6e2..00000000000 --- a/designable/next/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# @formily/designable-next - -### Install - -```bash -npm install --save @formily/designable-next -``` diff --git a/designable/next/copy.ts b/designable/next/copy.ts deleted file mode 100644 index 669b8f3af0d..00000000000 --- a/designable/next/copy.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { runCopy } from '../../scripts/build-style' - -runCopy({ - esStr: '@alifd/next/es/', - libStr: '@alifd/next/lib/', -}) diff --git a/designable/next/package.json b/designable/next/package.json deleted file mode 100644 index 8ed260399e6..00000000000 --- a/designable/next/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@formily/designable-next", - "version": "2.0.0-rc.7", - "license": "MIT", - "main": "lib", - "module": "esm", - "umd:main": "dist/formily.designable.next.umd.production.js", - "unpkg": "dist/formily.designable.next.umd.production.js", - "jsdelivr": "dist/formily.designable.next.umd.production.js", - "jsnext:main": "esm", - "repository": { - "type": "git", - "url": "git+https://github.com/alibaba/formily.git" - }, - "types": "esm/index.d.ts", - "bugs": { - "url": "https://github.com/alibaba/formily/issues" - }, - "homepage": "https://github.com/alibaba/formily#readme", - "engines": { - "npm": ">=3.0.0" - }, - "scripts": { - "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && npm run build:umd && ts-node copy", - "build:cjs": "tsc --project tsconfig.build.json", - "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm", - "build:umd": "rollup --config", - "build:playground": "webpack-cli --config playground/webpack.prod.ts", - "start": "webpack-dev-server --config playground/webpack.dev.ts" - }, - "devDependencies": { - "@designable/react-settings-form": "^0.x", - "autoprefixer": "^9.0", - "file-loader": "^5.0.2", - "fs-extra": "^8.1.0", - "html-webpack-plugin": "^3.2.0", - "mini-css-extract-plugin": "^1.6.0", - "monaco-editor-webpack-plugin": "^4.0.0", - "raw-loader": "^4.0.0", - "react-monaco-editor": "^0.43.0", - "style-loader": "^1.1.3", - "ts-loader": "^7.0.4", - "typescript": "4.1.5", - "webpack": "^4.41.5", - "webpack-bundle-analyzer": "^3.9.0", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.10.1" - }, - "peerDependencies": { - "@alifd/next": "^1.23.0", - "@types/react": ">=16.8.0 || >=17.0.0", - "@types/react-dom": ">=16.8.0 || >=17.0.0", - "antd": "^4.0.0", - "react": ">=16.8.0 || >=17.0.0", - "react-dom": ">=16.8.0", - "react-is": ">=16.8.0 || >=17.0.0" - }, - "dependencies": { - "@designable/core": "^0.x", - "@designable/formily": "^0.x", - "@designable/react": "^0.x", - "@formily/core": "2.0.0-rc.7", - "@formily/designable-setters": "2.0.0-rc.7", - "@formily/next": "2.0.0-rc.7", - "@formily/react": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "2c44ae410a73f02735c63c6430e021a50e21f3ec" -} diff --git a/designable/next/playground/main.tsx b/designable/next/playground/main.tsx deleted file mode 100644 index 65bf9a67592..00000000000 --- a/designable/next/playground/main.tsx +++ /dev/null @@ -1,139 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom' -import { - Designer, - DesignerToolsWidget, - ViewToolsWidget, - Workspace, - OutlineTreeWidget, - DragSourceWidget, - HistoryWidget, - MainPanel, - CompositePanel, - WorkspacePanel, - ToolbarPanel, - ViewportPanel, - ViewPanel, - SettingsPanel, - ComponentTreeWidget, -} from '@designable/react' -import { SettingsForm } from '@designable/react-settings-form' -import { - createDesigner, - GlobalRegistry, - Shortcut, - KeyCode, -} from '@designable/core' -import { createDesignableField, createDesignableForm } from '../src' -import { - LogoWidget, - ActionsWidget, - PreviewWidget, - SchemaEditorWidget, - MarkupSchemaWidget, -} from './widgets' -import { saveSchema } from './service' -import 'antd/dist/antd.less' -import '@alifd/next/dist/next.css' - -GlobalRegistry.registerDesignerLocales({ - 'zh-CN': { - sources: { - Inputs: '输入控件', - Layouts: '布局组件', - Arrays: '自增组件', - Displays: '展示组件', - }, - }, - 'en-US': { - sources: { - Inputs: 'Inputs', - Layouts: 'Layouts', - Arrays: 'Arrays', - Displays: 'Displays', - }, - }, -}) - -const Root = createDesignableForm({ - registryName: 'Root', -}) - -const DesignableField = createDesignableField({ - registryName: 'DesignableField', -}) - -const SaveShortCut = new Shortcut({ - codes: [ - [KeyCode.Meta, KeyCode.S], - [KeyCode.Control, KeyCode.S], - ], - handler(ctx) { - saveSchema(ctx.engine) - }, -}) - -const engine = createDesigner({ - shortcuts: [SaveShortCut], -}) - -const App = () => { - return ( - - } actions={}> - - - - - - - - - - - - - - - - - - - - - - - {() => ( - - )} - - - {(tree, onChange) => ( - - )} - - - {(tree) => } - - - {(tree) => } - - - - - - - - - - ) -} - -ReactDOM.render(, document.getElementById('root')) diff --git a/designable/next/playground/service/index.ts b/designable/next/playground/service/index.ts deleted file mode 100644 index cb7cdd48bd0..00000000000 --- a/designable/next/playground/service/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './schema' diff --git a/designable/next/playground/service/schema.ts b/designable/next/playground/service/schema.ts deleted file mode 100644 index 1c7b2c63996..00000000000 --- a/designable/next/playground/service/schema.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Engine } from '@designable/core' -import { transformToSchema, transformToTreeNode } from '@designable/formily' -import { message } from 'antd' - -export const saveSchema = (designer: Engine) => { - localStorage.setItem( - 'formily-schema', - JSON.stringify( - transformToSchema(designer.getCurrentTree(), { - designableFieldName: 'DesignableField', - designableFormName: 'Root', - }) - ) - ) - message.success('Save Success') -} - -export const loadInitialSchema = (designer: Engine) => { - try { - designer.setCurrentTree( - transformToTreeNode(JSON.parse(localStorage.getItem('formily-schema')), { - designableFieldName: 'DesignableField', - designableFormName: 'Root', - }) - ) - } catch {} -} diff --git a/designable/next/playground/template.ejs b/designable/next/playground/template.ejs deleted file mode 100644 index a4dd656fb7d..00000000000 --- a/designable/next/playground/template.ejs +++ /dev/null @@ -1,20 +0,0 @@ - - - - Designable Playground - - - - -
-
- - - - - \ No newline at end of file diff --git a/designable/next/playground/webpack.base.ts b/designable/next/playground/webpack.base.ts deleted file mode 100644 index 688533b50cb..00000000000 --- a/designable/next/playground/webpack.base.ts +++ /dev/null @@ -1,122 +0,0 @@ -import path from 'path' -import fs from 'fs-extra' -import { GlobSync } from 'glob' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' -import autoprefixer from 'autoprefixer' -//import { getThemeVariables } from 'antd/dist/theme' - -const getWorkspaceAlias = () => { - const basePath = path.resolve(__dirname, '../../../') - const pkg = fs.readJSONSync(path.resolve(basePath, 'package.json')) || {} - const results = {} - const workspaces = pkg.workspaces - if (Array.isArray(workspaces)) { - workspaces.forEach((pattern) => { - const { found } = new GlobSync(pattern, { cwd: basePath }) - found.forEach((name) => { - const pkg = fs.readJSONSync( - path.resolve(basePath, name, './package.json') - ) - results[pkg.name] = path.resolve(basePath, name, './src') - }) - }) - } - return results -} - -export default { - mode: 'development', - devtool: 'inline-source-map', // 嵌入到源文件中 - stats: { - entrypoints: false, - children: false, - }, - entry: { - playground: path.resolve(__dirname, './main'), - }, - output: { - path: path.resolve(__dirname, '../build'), - filename: '[name].[hash].bundle.js', - }, - resolve: { - modules: ['node_modules'], - extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'], - alias: getWorkspaceAlias(), - }, - externals: { - react: 'React', - 'react-dom': 'ReactDOM', - moment: 'moment', - antd: 'antd', - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: [ - { - loader: require.resolve('ts-loader'), - options: { - transpileOnly: true, - }, - }, - ], - }, - { - test: /\.css$/, - use: [MiniCssExtractPlugin.loader, require.resolve('css-loader')], - }, - { - test: /\.less$/, - use: [ - MiniCssExtractPlugin.loader, - { loader: 'css-loader' }, - { - loader: 'postcss-loader', - options: { - plugins: () => autoprefixer(), - }, - }, - { - loader: 'less-loader', - options: { - // modifyVars: getThemeVariables({ - // dark: true // 开启暗黑模式 - // }), - javascriptEnabled: true, - }, - }, - ], - }, - { - test: /\.s[ac]ss$/i, - use: [ - MiniCssExtractPlugin.loader, - { - loader: 'css-loader', - }, - { - loader: 'postcss-loader', - options: { - plugins: () => autoprefixer(), - }, - }, - { - loader: 'sass-loader', - }, - ], - }, - { - test: /\.(woff|woff2|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/, - use: ['url-loader'], - }, - { - test: /\.html?$/, - loader: require.resolve('file-loader'), - options: { - name: '[name].[ext]', - }, - }, - ], - }, -} diff --git a/designable/next/playground/webpack.dev.ts b/designable/next/playground/webpack.dev.ts deleted file mode 100644 index 710c0570dae..00000000000 --- a/designable/next/playground/webpack.dev.ts +++ /dev/null @@ -1,56 +0,0 @@ -import baseConfig from './webpack.base' -import HtmlWebpackPlugin from 'html-webpack-plugin' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' -import MonacoPlugin from 'monaco-editor-webpack-plugin' -//import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' -import webpack from 'webpack' -import path from 'path' - -const PORT = 3000 - -const createPages = (pages) => { - return pages.map(({ filename, template, chunk }) => { - return new HtmlWebpackPlugin({ - filename, - template, - inject: 'body', - chunks: chunk, - }) - }) -} - -for (const key in baseConfig.entry) { - if (Array.isArray(baseConfig.entry[key])) { - baseConfig.entry[key].push( - require.resolve('webpack/hot/dev-server'), - `${require.resolve('webpack-dev-server/client')}?http://localhost:${PORT}` - ) - } -} - -export default { - ...baseConfig, - plugins: [ - new MiniCssExtractPlugin({ - filename: '[name].[hash].css', - chunkFilename: '[id].[hash].css', - }), - ...createPages([ - { - filename: 'index.html', - template: path.resolve(__dirname, './template.ejs'), - chunk: ['playground'], - }, - ]), - new webpack.HotModuleReplacementPlugin(), - new MonacoPlugin({ - languages: ['json'], - }), - // new BundleAnalyzerPlugin() - ], - devServer: { - host: '127.0.0.1', - open: true, - port: PORT, - }, -} diff --git a/designable/next/playground/webpack.prod.ts b/designable/next/playground/webpack.prod.ts deleted file mode 100644 index 520f909e4f0..00000000000 --- a/designable/next/playground/webpack.prod.ts +++ /dev/null @@ -1,40 +0,0 @@ -import baseConfig from './webpack.base' -import HtmlWebpackPlugin from 'html-webpack-plugin' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' -import MonacoPlugin from 'monaco-editor-webpack-plugin' -import path from 'path' - -const createPages = (pages) => { - return pages.map(({ filename, template, chunk }) => { - return new HtmlWebpackPlugin({ - filename, - template, - inject: 'body', - chunks: chunk, - }) - }) -} - -export default { - ...baseConfig, - mode: 'production', - plugins: [ - new MiniCssExtractPlugin({ - filename: '[name].[hash].css', - chunkFilename: '[id].[hash].css', - }), - ...createPages([ - { - filename: 'index.html', - template: path.resolve(__dirname, './template.ejs'), - chunk: ['playground'], - }, - ]), - new MonacoPlugin({ - languages: ['json'], - }), - ], - optimization: { - minimize: true, - }, -} diff --git a/designable/next/playground/widgets/ActionsWidget.tsx b/designable/next/playground/widgets/ActionsWidget.tsx deleted file mode 100644 index 6ef85e1c374..00000000000 --- a/designable/next/playground/widgets/ActionsWidget.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import React, { useEffect } from 'react' -import { Space, Button, Radio } from 'antd' -import { GithubOutlined } from '@ant-design/icons' -import { useDesigner, TextWidget } from '@designable/react' -import { GlobalRegistry } from '@designable/core' -import { observer } from '@formily/react' -import { loadInitialSchema, saveSchema } from '../service' - -export const ActionsWidget = observer(() => { - const designer = useDesigner() - useEffect(() => { - loadInitialSchema(designer) - }, []) - return ( - - - { - GlobalRegistry.setDesignerLanguage(e.target.value) - }} - /> - - - - - ) -}) diff --git a/designable/next/playground/widgets/LogoWidget.tsx b/designable/next/playground/widgets/LogoWidget.tsx deleted file mode 100644 index fa415acf8c4..00000000000 --- a/designable/next/playground/widgets/LogoWidget.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' - -export const LogoWidget: React.FC = () => ( -
- -
-) diff --git a/designable/next/playground/widgets/MarkupSchemaWidget.tsx b/designable/next/playground/widgets/MarkupSchemaWidget.tsx deleted file mode 100644 index fe1e9651275..00000000000 --- a/designable/next/playground/widgets/MarkupSchemaWidget.tsx +++ /dev/null @@ -1,157 +0,0 @@ -import React from 'react' -import { TreeNode } from '@designable/core' -import { MonacoInput } from '@designable/react-settings-form' -import { isEmpty, isPlainObj } from '@formily/shared' - -export interface IMarkupSchemaWidgetProps { - tree: TreeNode -} - -const transformToMarkupSchemaCode = (tree: TreeNode) => { - const printAttribute = (node: TreeNode) => { - if (!node) return '' - return `${Object.keys(node.props || {}) - .map((key) => { - if ( - key === '_designableId' || - key === '_isJSONSchemaObject' || - key === 'version' || - key === 'type' - ) - return '' - const value = node.props[key] - if (isPlainObj(value) && isEmpty(value)) return '' - if (typeof value === 'string') return `${key}="${value}"` - return `${key}={${JSON.stringify(value)}}` - }) - .join(' ')}` - } - const printChildren = (node: TreeNode) => { - if (!node) return '' - return node.children - .map((child) => { - return printNode(child) - }) - .join('') - } - const printTag = (node: TreeNode) => { - if (node.props.type === 'string') return 'SchemaField.String' - if (node.props.type === 'number') return 'SchemaField.Number' - if (node.props.type === 'boolean') return 'SchemaField.Boolean' - if (node.props.type === 'date') return 'SchemaField.Date' - if (node.props.type === 'datetime') return 'SchemaField.DateTime' - if (node.props.type === 'array') return 'SchemaField.Array' - if (node.props.type === 'object') return 'SchemaField.Object' - if (node.props.type === 'void') return 'SchemaField.Void' - return 'SchemaField.Markup' - } - const printNode = (node: TreeNode) => { - if (!node) return '' - return `<${printTag(node)} ${printAttribute(node)} ${ - node.children.length - ? `>${printChildren(node)}` - : '/>' - }` - } - const root = tree.find((child) => { - return child.componentName === 'Root' - }) - return `import React, { useMemo } from 'react' -import { createForm } from '@formily/core' -import { createSchemaField } from '@formily/react' -import { - Form, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Space, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, -} from '@formily/next' -import { Card, Range, Rating } from '@alifd/next' - -const Text: React.FC<{ - content?: string - mode?: 'normal' | 'h1' | 'h2' | 'h3' | 'p' -}> = ({ mode, content, ...props }) => { - const tagName = mode === 'normal' || !mode ? 'div' : mode - return React.createElement(tagName, props, content) -} - -const SchemaField = createSchemaField({ - components: { - Space, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - Card, - Range, - Rating, - }, -}) - -export default ()=>{ - const form = useMemo(() => createForm(), []) - - return
- - ${printChildren(root)} - -
-} - -` -} - -export const MarkupSchemaWidget: React.FC = ( - props -) => { - return ( - - ) -} diff --git a/designable/next/playground/widgets/PreviewWidget.tsx b/designable/next/playground/widgets/PreviewWidget.tsx deleted file mode 100644 index d3250501804..00000000000 --- a/designable/next/playground/widgets/PreviewWidget.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import React, { useMemo } from 'react' -import { createForm } from '@formily/core' -import { createSchemaField } from '@formily/react' -import { - Form, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Space, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, -} from '@formily/next' -import { Card, Range, Rating } from '@alifd/next' -import { TreeNode } from '@designable/core' -import { transformToSchema } from '@designable/formily' - -const Text: React.FC<{ - content?: string - mode?: 'normal' | 'h1' | 'h2' | 'h3' | 'p' -}> = ({ mode, content, ...props }) => { - const tagName = mode === 'normal' || !mode ? 'div' : mode - return React.createElement(tagName, props, content) -} - -const SchemaField = createSchemaField({ - components: { - Space, - FormGrid, - FormLayout, - FormTab, - FormCollapse, - ArrayTable, - ArrayCards, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - Text, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - Card, - Range, - Rating, - }, -}) - -export interface IPreviewWidgetProps { - tree: TreeNode -} - -export const PreviewWidget: React.FC = (props) => { - const form = useMemo(() => createForm(), []) - const { form: formProps, schema } = transformToSchema(props.tree, { - designableFormName: 'Root', - designableFieldName: 'DesignableField', - }) - return ( -
- - - ) -} diff --git a/designable/next/playground/widgets/SchemaEditorWidget.tsx b/designable/next/playground/widgets/SchemaEditorWidget.tsx deleted file mode 100644 index 805703bd94d..00000000000 --- a/designable/next/playground/widgets/SchemaEditorWidget.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react' -import { transformToSchema, transformToTreeNode } from '@designable/formily' -import { TreeNode, ITreeNode } from '@designable/core' -import { MonacoInput } from '@designable/react-settings-form' - -export interface ISchemaEditorWidgetProps { - tree: TreeNode - onChange?: (tree: ITreeNode) => void -} - -const Parser = { - designableFormName: 'Root', - designableFieldName: 'DesignableField', -} - -export const SchemaEditorWidget: React.FC = ( - props -) => { - return ( - { - props.onChange?.(transformToTreeNode(JSON.parse(value), Parser)) - }} - language="json" - /> - ) -} diff --git a/designable/next/playground/widgets/index.ts b/designable/next/playground/widgets/index.ts deleted file mode 100644 index 1ca916232fc..00000000000 --- a/designable/next/playground/widgets/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './LogoWidget' -export * from './ActionsWidget' -export * from './PreviewWidget' -export * from './SchemaEditorWidget' -export * from './MarkupSchemaWidget' diff --git a/designable/next/rollup.config.js b/designable/next/rollup.config.js deleted file mode 100644 index 3f5783a93d6..00000000000 --- a/designable/next/rollup.config.js +++ /dev/null @@ -1,27 +0,0 @@ -import baseConfig, { - removeImportStyleFromInputFilePlugin, -} from '../../scripts/rollup.base.js' -import postcss from 'rollup-plugin-postcss' -import NpmImport from 'less-plugin-npm-import' - -export default baseConfig( - 'formily.designable.next', - 'Formily.Designable.Next', - removeImportStyleFromInputFilePlugin(), - postcss({ - extract: true, - minimize: true, - // extensions: ['.css', '.less', '.sass'], - use: { - less: { - plugins: [new NpmImport({ prefix: '~' })], - javascriptEnabled: true, - }, - sass: { - plugins: [new NpmImport({ prefix: '~' })], - javascriptEnabled: true, - }, - stylus: {}, - }, - }) -) diff --git a/designable/next/src/components/DesignableArrayCards/index.tsx b/designable/next/src/components/DesignableArrayCards/index.tsx deleted file mode 100644 index 3f3222dec03..00000000000 --- a/designable/next/src/components/DesignableArrayCards/index.tsx +++ /dev/null @@ -1,245 +0,0 @@ -import React, { Fragment } from 'react' -import { Card } from '@alifd/next' -import { CardProps } from '@alifd/next/types/card' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { useTreeNode, TreeNodeWidget, useNodeIdProps } from '@designable/react' -import { ArrayBase } from '@formily/next' -import { observer } from '@formily/react' -import { LoadTemplate } from '../LoadTemplate' -import cls from 'classnames' -import { useDropTemplate } from '../../hooks' -import { - hasNodeByComponentPath, - queryNodesByComponentPath, - createEnsureTypeItemsNode, - findNodeByComponentPath, - createNodeId, -} from '../../shared' -import './styles.less' - -const ensureVoidItemsNode = createEnsureTypeItemsNode('void') - -const isArrayCardsOperation = (name: string) => - name === 'ArrayCards.Remove' || - name === 'ArrayCards.MoveDown' || - name === 'ArrayCards.MoveUp' - -export const DesignableArrayCards: React.FC = observer((props) => { - const node = useTreeNode() - const nodeId = useNodeIdProps() - const designer = useDropTemplate('ArrayCards', (source) => { - const indexNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.Index', - }, - }) - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.Addition', - }, - }) - const removeNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.Remove', - }, - }) - const moveDownNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.MoveDown', - }, - }) - const moveUpNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.MoveUp', - }, - }) - - const voidNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - }, - children: [indexNode, ...source, removeNode, moveDownNode, moveUpNode], - }) - return [voidNode, additionNode] - }) - const renderCard = () => { - if (node.children.length === 0) return - const additions = queryNodesByComponentPath(node, [ - 'ArrayCards', - 'ArrayCards.Addition', - ]) - const indexes = queryNodesByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.Index', - ]) - const operations = queryNodesByComponentPath(node, [ - 'ArrayCards', - '*', - isArrayCardsOperation, - ]) - const children = queryNodesByComponentPath(node, [ - 'ArrayCards', - '*', - (name) => name.indexOf('ArrayCards.') === -1, - ]) - return ( - - - - {indexes.map((node, key) => ( - - ))} - {props.title} - - } - className={cls('ant-formily-array-cards-item', props.className)} - extra={ - - {operations.map((node) => ( - - ))} - {props.extra} - - } - > -
- {children.length ? ( - children.map((node) => ( - - )) - ) : ( - - )} -
-
-
- {additions.map((node) => ( - - ))} -
- ) - } - - return ( -
- {renderCard()} - { - if ( - hasNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.Index', - ]) - ) - return - const indexNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.Index', - }, - }) - ensureVoidItemsNode(node).appendNode(indexNode) - }, - }, - - { - title: 'Common.addOperation', - onClick: () => { - const oldAdditionNode = findNodeByComponentPath(node, [ - 'ArrayCards', - 'ArrayCards.Addition', - ]) - if (!oldAdditionNode) { - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayCards.Addition', - }, - }) - ensureVoidItemsNode(node).insertAfter(additionNode) - } - const oldRemoveNode = findNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.Remove', - ]) - const oldMoveDownNode = findNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.MoveDown', - ]) - const oldMoveUpNode = findNodeByComponentPath(node, [ - 'ArrayCards', - '*', - 'ArrayCards.MoveUp', - ]) - if (!oldRemoveNode) { - ensureVoidItemsNode(node).appendNode( - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.Remove', - }, - }) - ) - } - if (!oldMoveDownNode) { - ensureVoidItemsNode(node).appendNode( - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.MoveDown', - }, - }) - ) - } - if (!oldMoveUpNode) { - ensureVoidItemsNode(node).appendNode( - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayCards.MoveUp', - }, - }) - ) - } - }, - }, - ]} - /> -
- ) -}) - -ArrayBase.mixin(DesignableArrayCards) diff --git a/designable/next/src/components/DesignableArrayCards/styles.less b/designable/next/src/components/DesignableArrayCards/styles.less deleted file mode 100644 index 67e6789cd21..00000000000 --- a/designable/next/src/components/DesignableArrayCards/styles.less +++ /dev/null @@ -1,5 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-array-cards { - background-color: @background-color-light; -} diff --git a/designable/next/src/components/DesignableArrayCollapse/index.tsx b/designable/next/src/components/DesignableArrayCollapse/index.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/designable/next/src/components/DesignableArrayItems/index.tsx b/designable/next/src/components/DesignableArrayItems/index.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/designable/next/src/components/DesignableArrayTable/index.tsx b/designable/next/src/components/DesignableArrayTable/index.tsx deleted file mode 100644 index d55886020b7..00000000000 --- a/designable/next/src/components/DesignableArrayTable/index.tsx +++ /dev/null @@ -1,329 +0,0 @@ -import React from 'react' -import { Table } from '@alifd/next' -import { TableProps } from '@alifd/next/types/table' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { useTreeNode, TreeNodeWidget, useNodeIdProps } from '@designable/react' -import { ArrayBase } from '@formily/next' -import { observer } from '@formily/react' -import { LoadTemplate } from '../LoadTemplate' -import cls from 'classnames' -import { - createNodeId, - queryNodesByComponentPath, - hasNodeByComponentPath, - findNodeByComponentPath, - createEnsureTypeItemsNode, -} from '../../shared' -import { useDropTemplate } from '../../hooks' -import './styles.less' - -const ensureObjectItemsNode = createEnsureTypeItemsNode('object') - -export const DesignableArrayTable: React.FC = observer((props) => { - const node = useTreeNode() - const nodeId = useNodeIdProps() - const designer = useDropTemplate('ArrayTable', (source) => { - const indexNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Index', - }, - }, - ], - }) - const columnNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: source.map((node) => { - node.props.title = undefined - return node - }), - }) - - const operationNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Remove', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveDown', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveUp', - }, - }, - ], - }) - const objectNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'object', - }, - children: [indexNode, columnNode, operationNode], - }) - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayTable.Addition', - }, - }) - return [objectNode, additionNode] - }) - const columns = queryNodesByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - ]) - const additions = queryNodesByComponentPath(node, [ - 'ArrayTable', - 'ArrayTable.Addition', - ]) - const defaultRowKey = () => { - return node.id - } - - const renderTable = () => { - if (node.children.length === 0) return - return ( - - - {columns.map((node, key) => { - const children = node.children.map((child) => { - return - }) - return ( - { - return ( - - {children.length > 0 ? children : 'Droppable'} - - ) - }} - /> - ) - })} - {columns.length === 0 && } />} -
- {additions.map((child) => { - return - })} -
- ) - } - - useDropTemplate('ArrayTable.Column', (source) => { - return source.map((node) => { - node.props.title = undefined - return node - }) - }) - - return ( -
- {renderTable()} - { - if ( - hasNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - 'ArrayTable.Index', - ]) - ) - return - const tableColumn = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Index', - }, - }, - ], - }) - const sortNode = findNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - 'ArrayTable.SortHandle', - ]) - if (sortNode) { - sortNode.parent.insertAfter(tableColumn) - } else { - ensureObjectItemsNode(node).prependNode(tableColumn) - } - }, - }, - { - title: 'Common.addTableColumn', - onClick: () => { - const operationNode = findNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - (name) => { - return ( - name === 'ArrayTable.Remove' || - name === 'ArrayTable.MoveDown' || - name === 'ArrayTable.MoveUp' - ) - }, - ]) - const tableColumn = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - }) - if (operationNode) { - operationNode.parent.insertBefore(tableColumn) - } else { - ensureObjectItemsNode(node).appendNode(tableColumn) - } - }, - }, - { - title: 'Common.addOperation', - onClick: () => { - const oldOperationNode = findNodeByComponentPath(node, [ - 'ArrayTable', - '*', - 'ArrayTable.Column', - (name) => { - return ( - name === 'ArrayTable.Remove' || - name === 'ArrayTable.MoveDown' || - name === 'ArrayTable.MoveUp' - ) - }, - ]) - const oldAdditionNode = findNodeByComponentPath(node, [ - 'ArrayTable', - 'ArrayTable.Addition', - ]) - if (!oldOperationNode) { - const operationNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Column', - 'x-component-props': { - title: `Title`, - }, - }, - children: [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.Remove', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveDown', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'ArrayTable.MoveUp', - }, - }, - ], - }) - ensureObjectItemsNode(node).appendNode(operationNode) - } - if (!oldAdditionNode) { - const additionNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - title: 'Addition', - 'x-component': 'ArrayTable.Addition', - }, - }) - ensureObjectItemsNode(node).insertAfter(additionNode) - } - }, - }, - ]} - /> -
- ) -}) - -ArrayBase.mixin(DesignableArrayTable) diff --git a/designable/next/src/components/DesignableArrayTable/styles.less b/designable/next/src/components/DesignableArrayTable/styles.less deleted file mode 100644 index a45490e2904..00000000000 --- a/designable/next/src/components/DesignableArrayTable/styles.less +++ /dev/null @@ -1,5 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-array-table { - background-color: @background-color-light; -} diff --git a/designable/next/src/components/DesignableArrayTabs/index.tsx b/designable/next/src/components/DesignableArrayTabs/index.tsx deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/designable/next/src/components/DesignableContainer/index.tsx b/designable/next/src/components/DesignableContainer/index.tsx deleted file mode 100644 index a892319c8c7..00000000000 --- a/designable/next/src/components/DesignableContainer/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react' -import { useNodeIdProps } from '@designable/react' -import { Droppable } from '../Droppable' -import './styles.less' - -export const createDesignableContainer = ( - Target: React.JSXElementConstructor -) => { - return (props: any) => { - const nodeId = useNodeIdProps() - if (props.children) { - return ( -
- {props.children} -
- ) - } - return - } -} diff --git a/designable/next/src/components/DesignableContainer/styles.less b/designable/next/src/components/DesignableContainer/styles.less deleted file mode 100644 index e0f5c30388e..00000000000 --- a/designable/next/src/components/DesignableContainer/styles.less +++ /dev/null @@ -1,7 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-form-container { - margin: 0 !important; - padding: 20px; - border: 1px solid @border-color-split; -} diff --git a/designable/next/src/components/DesignableField/index.tsx b/designable/next/src/components/DesignableField/index.tsx deleted file mode 100644 index 5c4b7b2a2b3..00000000000 --- a/designable/next/src/components/DesignableField/index.tsx +++ /dev/null @@ -1,437 +0,0 @@ -import React from 'react' -import { FormPath } from '@formily/core' -import { GlobalRegistry, TreeNode } from '@designable/core' -import { useDesigner, useTreeNode } from '@designable/react' -import { - ArrayField, - Field, - ObjectField, - VoidField, - observer, - Schema, - ISchema, -} from '@formily/react' -import { - DataSourceSetter, - ReactionsSetter, - ValidatorSetter, -} from '@formily/designable-setters' -import { FormTab, FormItem } from '@formily/antd' -import { isArr, isStr, each, reduce } from '@formily/shared' -import { FormItemSwitcher } from '../FormItemSwitcher' -import { DesignableObject } from '../DesignableObject' -import { createOptions } from './options' -import { IDesignableFieldFactoryProps } from './types' -import { includesComponent } from '../../shared' -import * as defaultSchemas from '../../schemas' - -Schema.silent() - -const SchemaStateMap = { - title: 'title', - description: 'description', - default: 'value', - enum: 'dataSource', - readOnly: 'readOnly', - writeOnly: 'editable', - required: 'required', - 'x-content': 'content', - 'x-value': 'value', - 'x-editable': 'editable', - 'x-disabled': 'disabled', - 'x-read-pretty': 'readPretty', - 'x-read-only': 'readOnly', - 'x-visible': 'visible', - 'x-hidden': 'hidden', - 'x-display': 'display', - 'x-pattern': 'pattern', -} - -const NeedShownExpression = { - title: true, - description: true, - default: true, - 'x-content': true, - 'x-value': true, -} - -const isExpression = (val: any) => isStr(val) && /^\{\{.*\}\}$/.test(val) - -const filterExpression = (val: any) => { - if (typeof val === 'object') { - const isArray = isArr(val) - const results = reduce( - val, - (buf: any, value, key) => { - if (isExpression(value)) { - return buf - } else { - const results = filterExpression(value) - if (results === undefined || results === null) return buf - if (isArray) { - return buf.concat([results]) - } - buf[key] = results - return buf - } - }, - isArray ? [] : {} - ) - return results - } - if (isExpression(val)) { - return - } - return val -} - -const toDesignableFieldProps = ( - schema: ISchema, - components: any, - nodeIdAttrName: string, - id: string -) => { - const results: any = {} - each(SchemaStateMap, (fieldKey, schemaKey) => { - const value = schema[schemaKey] - if (isExpression(value)) { - if (!NeedShownExpression[schemaKey]) return - if (value) { - results[fieldKey] = value - return - } - } else if (value) { - results[fieldKey] = filterExpression(value) - } - }) - if (!components['FormItem']) { - components['FormItem'] = FormItem - } - const decorator = - schema['x-decorator'] && FormPath.getIn(components, schema['x-decorator']) - const component = - schema['x-component'] && FormPath.getIn(components, schema['x-component']) - const decoratorProps = schema['x-decorator-props'] || {} - const componentProps = schema['x-component-props'] || {} - - if (decorator) { - results.decorator = [decorator, { ...decoratorProps }] - } - if (component) { - results.component = [component, { ...componentProps }] - } - if (decorator) { - FormPath.setIn(results['decorator'][1], nodeIdAttrName, id) - } else if (component) { - FormPath.setIn(results['component'][1], nodeIdAttrName, id) - } - results.title = results.title && ( - {results.title} - ) - results.description = results.description && ( - {results.description} - ) - return results -} - -export const createDesignableField = ( - options: IDesignableFieldFactoryProps -) => { - const realOptions = createOptions(options) - const tabs = {} - - const getFieldPropsSchema = (node: TreeNode): ISchema => { - const decorator = node.props['x-decorator'] - const component = node.props['x-component'] - const decoratorSchema = - decorator && - (FormPath.getIn(realOptions.componentsPropsSchema, decorator) || - FormPath.getIn(defaultSchemas, decorator)) - const componentSchema = - component && - (FormPath.getIn(realOptions.componentsPropsSchema, component) || - FormPath.getIn(defaultSchemas, component)) - const TabSchema = (key: string, schema: ISchema) => { - tabs[key] = tabs[key] || FormTab.createFormTab() - return { - type: 'object', - properties: { - propsTab: { - type: 'void', - 'x-component': 'FormTab', - 'x-component-props': { - formTab: tabs[key], - style: { - overflow: 'visible', - }, - }, - properties: { - propsPane: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - tab: GlobalRegistry.getDesignerMessage( - `settings.${key}.tab_property` - ), - }, - properties: schema.properties, - }, - stylePane: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - tab: GlobalRegistry.getDesignerMessage( - `settings.${key}.tab_style` - ), - }, - properties: { - style: defaultSchemas.CSSStyle, - }, - }, - }, - }, - }, - } - } - const base = { - type: 'object', - properties: { - name: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - defaultValue: node.id, - }, - 'x-index': 0, - }, - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-index': 1, - }, - description: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - 'x-index': 2, - }, - 'x-display': { - type: 'string', - enum: ['visible', 'hidden', 'none', ''], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'visible', - }, - 'x-index': 3, - }, - 'x-pattern': { - type: 'string', - enum: ['editable', 'disabled', 'readOnly', 'readPretty', ''], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'editable', - }, - 'x-index': 4, - }, - 'x-component-props': - componentSchema && TabSchema('x-component-props', componentSchema), - 'x-decorator-props': - decoratorSchema && TabSchema('x-decorator-props', decoratorSchema), - }, - } - - if (node.props.type === 'void') { - if (!includesComponent(node, realOptions.dropReactionComponents)) { - Object.assign(base.properties, { - 'x-reactions': { - 'x-decorator': 'FormItem', - 'x-index': 5, - 'x-component': ReactionsSetter, - }, - }) - } - if (!includesComponent(node, realOptions.dropFormItemComponents)) { - Object.assign(base.properties, { - 'x-decorator': { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': FormItemSwitcher, - 'x-index': 10, - 'x-reactions': { - target: '*(title,description)', - fulfill: { - state: { - hidden: '{{$self.value !== "FormItem"}}', - }, - }, - }, - }, - }) - } else { - delete base.properties.title - delete base.properties.description - } - } else { - if (!includesComponent(node, realOptions.dropReactionComponents)) { - Object.assign(base.properties, { - 'x-reactions': { - 'x-decorator': 'FormItem', - 'x-index': 7, - 'x-component': ReactionsSetter, - }, - }) - } - Object.assign(base.properties, { - default: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-index': 5, - }, - enum: { - 'x-decorator': 'FormItem', - 'x-component': DataSourceSetter, - 'x-index': 6, - }, - 'x-validator': { - type: 'array', - 'x-component': ValidatorSetter, - 'x-index': 8, - }, - required: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-index': 9, - }, - }) - } - - base['$namespace'] = `namespace.${component}` - - return base - } - - const calculateChildrenRestricts = (target: TreeNode, source: TreeNode[]) => { - const targetComponent = target.props['x-component'] - const restrictChildrenComponents = - realOptions.restrictChildrenComponents?.[targetComponent] - if (restrictChildrenComponents?.length) { - if ( - source.every((node) => - includesComponent(node, restrictChildrenComponents, target) - ) - ) { - return true - } - return false - } - return true - } - - const calculateSiblingsRestricts = (target: TreeNode, source: TreeNode[]) => { - const targetComponent = target.props['x-component'] - const restrictSiblingComponents = - realOptions.restrictSiblingComponents?.[targetComponent] - if (restrictSiblingComponents?.length) { - if ( - source.every((node) => - includesComponent(node, restrictSiblingComponents, target) - ) - ) { - return true - } - return false - } - return true - } - - if (!realOptions.registryName) throw new Error('Can not found registryName') - - GlobalRegistry.registerDesignerProps({ - [realOptions.registryName]: (node) => { - const componentName = node.props?.['x-component'] - const message = GlobalRegistry.getDesignerMessage( - `components.${componentName}` - ) - const isObjectNode = node.props.type === 'object' - const isArrayNode = node.props.type === 'array' - const isVoidNode = node.props.type === 'void' - const title = typeof message === 'string' ? message : message?.title - const nodeTitle = - title || - (isObjectNode - ? GlobalRegistry.getDesignerMessage('components.Object') - : isVoidNode - ? GlobalRegistry.getDesignerMessage('components.Void') - : '') - const sourceIcon = realOptions.componentsSourceIcon?.[componentName] - return { - title: nodeTitle, - sourceIcon: isObjectNode ? 'ObjectSource' : sourceIcon, - icon: realOptions.componentsIcon?.[componentName], - draggable: true, - droppable: isObjectNode || isArrayNode || isVoidNode, - selfRenderChildren: - isArrayNode || - includesComponent(node, realOptions.selfRenderChildrenComponents), - inlineLayout: includesComponent( - node, - realOptions.inlineLayoutComponents - ), - inlineChildrenLayout: includesComponent( - node, - realOptions.inlineChildrenLayoutComponents - ), - allowSiblings(target, source) { - return calculateSiblingsRestricts(target, source) - }, - allowAppend(target, source) { - return ( - (target.props.type === 'void' || - target.props.type === 'array' || - target.props.type === 'object') && - calculateChildrenRestricts(target, source) - ) - }, - propsSchema: getFieldPropsSchema(node), - } - }, - }) - - const DesignableField: React.FC = observer((props) => { - const designer = useDesigner() - const node = useTreeNode() - if (!node) return null - - const fieldProps = toDesignableFieldProps( - props, - realOptions.components, - designer.props.nodeIdAttrName, - node.id - ) - if (props.type === 'object') { - return ( - - - {props.children} - - - ) - } else if (props.type === 'array') { - return - } else if (node.props.type === 'void') { - return ( - - {props.children} - - ) - } - return - }) - - return DesignableField -} diff --git a/designable/next/src/components/DesignableField/options.ts b/designable/next/src/components/DesignableField/options.ts deleted file mode 100644 index 71560594cd5..00000000000 --- a/designable/next/src/components/DesignableField/options.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { IDesignableFieldFactoryProps } from './types' -import { - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Space, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - FormGrid, - FormLayout, -} from '@formily/next' -import { Card, Range, Rating } from '@alifd/next' -import { createDesignableContainer } from '../DesignableContainer' -import { DesignableFormTab } from '../DesignableFormTab' -import { DesignableFormCollapse } from '../DesignableFormCollapse' -import { DesignableArrayTable } from '../DesignableArrayTable' -import { DesignableArrayCards } from '../DesignableArrayCards' -import { DesignableText } from '../DesignableText' -import { TreeNode } from '@designable/core' - -const isChildrenComponents = - (parentName: string, names?: string[]) => (name: string) => - Array.isArray(names) && names.length > 0 - ? names.some((key) => { - return `${parentName}.${key}` === name - }) - : name.indexOf(`${parentName}.`) > -1 - -const InlineArrayChildren = [ - 'Column', - 'Index', - 'SortHandle', - 'Remove', - 'MoveDown', - 'MoveUp', -] - -const isFormTabChildren = isChildrenComponents('FormTab') -const isFormCollapseChildren = isChildrenComponents('FormCollapse') -const isArrayTableInlineChildren = isChildrenComponents( - 'ArrayTable', - InlineArrayChildren -) -const isArrayCardsInlineChildren = isChildrenComponents( - 'ArrayCards', - InlineArrayChildren -) -const isObjectNode = (name: string, node: TreeNode) => { - return node.props['type'] === 'object' -} - -const isNotArrayColumn = (name: string, node: TreeNode) => { - return node.props['x-component'] !== 'ArrayTable.Column' -} - -const allowDropWithEmpty = (name: string, node: TreeNode, target: TreeNode) => { - if (target) return target.children.length === 0 - return false -} - -const noChildren = () => false - -export const createOptions = ( - options: IDesignableFieldFactoryProps -): IDesignableFieldFactoryProps => { - return { - ...options, - dropFormItemComponents: [ - ...(options.dropFormItemComponents || []), - isFormTabChildren, - isFormCollapseChildren, - ], - dropReactionComponents: [ - ...(options.dropReactionComponents || []), - isFormTabChildren, - isFormCollapseChildren, - ], - selfRenderChildrenComponents: [ - ...(options.selfRenderChildrenComponents || []), - 'FormTab', - 'FormCollapse', - ], - inlineChildrenLayoutComponents: [ - ...(options.inlineChildrenLayoutComponents || []), - 'FormItem', - 'FormGrid', - 'Space', - ], - inlineLayoutComponents: [ - ...(options.inlineLayoutComponents || []), - isArrayTableInlineChildren, - isArrayCardsInlineChildren, - ], - restrictChildrenComponents: { - FormTab: [allowDropWithEmpty, 'FormTab.TabPane'], - FormCollapse: [allowDropWithEmpty, 'FormCollapse.CollapsePanel'], - ArrayTable: [allowDropWithEmpty, isObjectNode, 'ArrayTable.Addition'], - 'ArrayTable.Column': [isNotArrayColumn], - Text: [noChildren], - }, - restrictSiblingComponents: { - 'FormTab.TabPane': ['FormTab.TabPane'], - 'FormCollapse.CollapsePanel': ['FormCollapse.CollapsePanel'], - 'ArrayTable.Column': ['ArrayTable.Column'], - }, - componentsSourceIcon: { - ...options.componentsSourceIcon, - Space: 'SpaceSource', - FormGrid: 'GridSource', - FormTab: 'TabSource', - FormCollapse: 'CollapseSource', - ArrayTable: 'ArrayTableSource', - ArrayCards: 'ArrayCardsSource', - DatePicker: 'DatePickerSource', - 'DatePicker.RangePicker': 'DateRangePickerSource', - 'Checkbox.Group': 'CheckboxGroupSource', - 'Radio.Group': 'RadioGroupSource', - Range: 'SliderSource', - Rating: 'RateSource', - TimePicker: 'TimePickerSource', - 'TimePicker.RangePicker': 'TimeRangePickerSource', - Cascader: 'CascaderSource', - TreeSelect: 'TreeSelectSource', - Select: 'SelectSource', - 'Input.TextArea': 'TextAreaSource', - Input: 'InputSource', - NumberPicker: 'NumberPickerSource', - Password: 'PasswordSource', - Transfer: 'TransferSource', - Switch: 'SwitchSource', - Upload: 'UploadSource', - 'Upload.Dragger': 'UploadDraggerSource', - Card: 'CardSource', - FormLayout: 'FormLayoutSource', - Text: 'TextSource', - Image: 'ImageSource', - Button: 'ButtonSource', - Video: 'MediaSource', - }, - components: { - ...options.components, - Space: createDesignableContainer(Space), - FormGrid: createDesignableContainer(FormGrid), - FormLayout: createDesignableContainer(FormLayout), - FormTab: DesignableFormTab, - FormCollapse: DesignableFormCollapse, - ArrayTable: DesignableArrayTable, - ArrayCards: DesignableArrayCards, - Text: DesignableText, - FormItem, - DatePicker, - Checkbox, - Cascader, - Editable, - Input, - NumberPicker, - Switch, - Password, - PreviewText, - Radio, - Reset, - Select, - Submit, - TimePicker, - Transfer, - TreeSelect, - Upload, - Card, - Range, - Rating, - }, - } -} diff --git a/designable/next/src/components/DesignableField/types.ts b/designable/next/src/components/DesignableField/types.ts deleted file mode 100644 index ca1b59f7aab..00000000000 --- a/designable/next/src/components/DesignableField/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ISchema } from '@formily/react' -import { ComponentNameMatcher } from '../../shared' -export interface IDesignableFieldFactoryProps { - registryName: string - components?: Record> - componentsIcon?: Record - componentsSourceIcon?: Record - componentsPropsSchema?: Record - dropFormItemComponents?: ComponentNameMatcher[] - dropReactionComponents?: ComponentNameMatcher[] - selfRenderChildrenComponents?: ComponentNameMatcher[] - inlineChildrenLayoutComponents?: ComponentNameMatcher[] - inlineLayoutComponents?: ComponentNameMatcher[] - restrictChildrenComponents?: Record - restrictSiblingComponents?: Record -} diff --git a/designable/next/src/components/DesignableForm/index.tsx b/designable/next/src/components/DesignableForm/index.tsx deleted file mode 100644 index 8f691abbff9..00000000000 --- a/designable/next/src/components/DesignableForm/index.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React, { useMemo } from 'react' -import { IDesignerProps, GlobalRegistry } from '@designable/core' -import { createForm } from '@formily/core' -import { Form, IFormLayoutProps } from '@formily/next' -import { observer } from '@formily/react' -import { usePrefix } from '@designable/react' -import { Form as FormPropsSchema } from '../../schemas' -import './styles.scss' - -export interface IDesignableFormFactoryProps extends IDesignerProps { - registryName: string - component?: React.JSXElementConstructor -} - -export const createDesignableForm = (options: IDesignableFormFactoryProps) => { - const realOptions: IDesignableFormFactoryProps = { - component: Form, - droppable: true, - draggable: false, - propsSchema: FormPropsSchema, - ...options, - defaultProps: { - labelCol: 6, - wrapperCol: 12, - ...options.defaultProps, - }, - } - - const FormComponent = realOptions.component || Form - - const DesignableForm: React.FC = observer((props) => { - const prefix = usePrefix('designable-form') - const form = useMemo( - () => - createForm({ - designable: true, - }), - [] - ) - return ( - - {props.children} - - ) - }) - - if (!realOptions.registryName) throw new Error('Can not found registryName') - - realOptions.title = `components.${realOptions.registryName}` - - GlobalRegistry.registerDesignerProps({ - [realOptions.registryName]: realOptions, - }) - - return DesignableForm -} diff --git a/designable/next/src/components/DesignableForm/styles.scss b/designable/next/src/components/DesignableForm/styles.scss deleted file mode 100644 index 857cadf3928..00000000000 --- a/designable/next/src/components/DesignableForm/styles.scss +++ /dev/null @@ -1,40 +0,0 @@ -@import '~@alifd/next/lib/core/style/global'; - -$next-prefix: $css-prefix; - -@mixin none-pointer-events($selector, $important: true) { - #{$selector} { - pointer-events: none #{if($important, !important, '')}; - } -} - -@mixin designable-bootstrap($components...) { - .dn-designable-form { - @each $component in $components { - $selector: #{$next-prefix}#{$component}; - @include none-pointer-events('.#{$selector}, .#{$selector} input'); - } - @include none-pointer-events('.anticon svg', false); - } -} - -@include designable-bootstrap( - 'input', - 'input-textarea', - 'select', - 'radio-group', - 'range', - 'cascader', - 'switch', - 'checkbox-group', - 'date-picker', - 'range-picker', - 'month-picker', - 'year-picker', - 'week-picker', - 'time-picker', - 'rating', - 'transfer', - 'tree-select', - 'upload' -); diff --git a/designable/next/src/components/DesignableFormCollapse/index.tsx b/designable/next/src/components/DesignableFormCollapse/index.tsx deleted file mode 100644 index a38e4cf85d3..00000000000 --- a/designable/next/src/components/DesignableFormCollapse/index.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import React, { Fragment, useState } from 'react' -import { observer } from '@formily/react' -import { toArr } from '@formily/shared' -import { Collapse } from '@alifd/next' -import type { - CollapseProps, - PanelProps as CollapsePanelProps, -} from '@alifd/next/types/collapse' -import { useTreeNode, useNodeIdProps, TreeNodeWidget } from '@designable/react' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { LoadTemplate } from '../LoadTemplate' -import { useDropTemplate } from '../../hooks' -import { matchComponent } from '../../shared' - -const parseCollpase = (parent: TreeNode) => { - const panels: TreeNode[] = [] - parent.children.forEach((node) => { - if (matchComponent(node, 'FormCollapse.CollapsePanel')) { - panels.push(node) - } - }) - return panels -} - -export const DesignableFormCollapse: React.FC & { - CollapsePanel?: React.FC -} = observer((props) => { - const [expandedKeys, setExpandedKeys] = useState([]) - const node = useTreeNode() - const nodeId = useNodeIdProps() - const designer = useDropTemplate('FormCollapse', (source) => { - const panelNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormCollapse.CollapsePanel', - 'x-component-props': { - title: `Unnamed Title`, - }, - }, - children: source, - }) - - setExpandedKeys([...expandedKeys, panelNode.id]) - return [panelNode] - }) - - const panels = parseCollpase(node) - - const renderCollapse = () => { - if (!node.children?.length) return - return ( - { - setExpandedKeys(toArr(expandedKeys)) - }} - > - {panels.map((panel) => { - const props = panel.props['x-component-props'] || {} - return ( - - {React.createElement( - 'div', - { - [designer.props.nodeIdAttrName]: panel.id, - }, - panel.children.length ? ( - - ) : ( - - ) - )} - - ) - })} - - ) - } - return ( -
- {renderCollapse()} - { - const collapsePanel = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormCollapse.CollapsePanel', - 'x-component-props': { - title: `Unnamed Title`, - }, - }, - }) - node.appendNode(collapsePanel) - setExpandedKeys([...expandedKeys, collapsePanel.id]) - }, - }, - ]} - /> -
- ) -}) - -DesignableFormCollapse.CollapsePanel = (props) => { - return {props.children} -} diff --git a/designable/next/src/components/DesignableFormTab/index.tsx b/designable/next/src/components/DesignableFormTab/index.tsx deleted file mode 100644 index 1848d5b5273..00000000000 --- a/designable/next/src/components/DesignableFormTab/index.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import React, { Fragment, useState } from 'react' -import { observer } from '@formily/react' -import { Tab } from '@alifd/next' -import { ItemProps, TabProps } from '@alifd/next/types/tab' -import { useNodeIdProps, useTreeNode, TreeNodeWidget } from '@designable/react' -import { Droppable } from '../Droppable' -import { TreeNode } from '@designable/core' -import { LoadTemplate } from '../LoadTemplate' -import { useDropTemplate } from '../../hooks' -import { matchComponent } from '../../shared' - -const parseTabs = (parent: TreeNode) => { - const tabs: TreeNode[] = [] - parent.children.forEach((node) => { - if (matchComponent(node, 'FormTab.TabPane')) { - tabs.push(node) - } - }) - return tabs -} - -const getCorrectActiveKey = (activeKey: string, tabs: TreeNode[]) => { - if (tabs.length === 0) return - if (tabs.some((node) => node.id === activeKey)) return activeKey - return tabs[tabs.length - 1].id -} - -export const DesignableFormTab: React.FC & { - TabPane?: React.FC -} = observer((props) => { - const [activeKey, setActiveKey] = useState() - const nodeId = useNodeIdProps() - const node = useTreeNode() - const designer = useDropTemplate('FormTab', (source) => { - return [ - new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - title: `Unnamed Title`, - }, - }, - children: source, - }), - ] - }) - const tabs = parseTabs(node) - const renderTabs = () => { - if (!node.children?.length) return - return ( - { - setActiveKey(id) - }} - > - {tabs.map((tab) => { - const props = tab.props['x-component-props'] || {} - return ( - - {React.createElement( - 'div', - { - [designer.props.nodeIdAttrName]: tab.id, - }, - tab.children.length ? ( - - ) : ( - - ) - )} - - ) - })} - - ) - } - return ( -
- {renderTabs()} - { - const tabPane = new TreeNode({ - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormTab.TabPane', - 'x-component-props': { - title: `Unnamed Title`, - }, - }, - }) - node.appendNode(tabPane) - setActiveKey(tabPane.id) - }, - }, - ]} - /> -
- ) -}) - -DesignableFormTab.TabPane = (props) => { - return {props.children} -} diff --git a/designable/next/src/components/DesignableObject/index.tsx b/designable/next/src/components/DesignableObject/index.tsx deleted file mode 100644 index b894214f3d8..00000000000 --- a/designable/next/src/components/DesignableObject/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' -import { useNodeIdProps, useTreeNode } from '@designable/react' -import { Droppable } from '../Droppable' - -export const DesignableObject: React.FC = (props) => { - const node = useTreeNode() - const nodeId = useNodeIdProps() - if (node.children.length === 0) return - return
{props.children}
-} diff --git a/designable/next/src/components/DesignableText/index.tsx b/designable/next/src/components/DesignableText/index.tsx deleted file mode 100644 index 6b08755dbf8..00000000000 --- a/designable/next/src/components/DesignableText/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react' -import { useDesigner } from '@designable/react' -import cls from 'classnames' -import './styles.less' - -export interface IDesignableTextProps { - content?: string - mode?: 'normal' | 'h1' | 'h2' | 'h3' | 'p' - style?: React.CSSProperties - className?: string -} - -export const DesignableText: React.FC = (props) => { - const designer = useDesigner() - const tagName = props.mode === 'normal' || !props.mode ? 'div' : props.mode - return React.createElement( - tagName, - { - ...props, - className: cls(props.className, 'dn-text'), - [designer.props.contentEditableAttrName]: 'x-component-props.content', - }, - props.content - ) -} diff --git a/designable/next/src/components/DesignableText/styles.less b/designable/next/src/components/DesignableText/styles.less deleted file mode 100644 index a55fac3c947..00000000000 --- a/designable/next/src/components/DesignableText/styles.less +++ /dev/null @@ -1,10 +0,0 @@ -.dn-text { - &:empty::before { - content: 'Please Input'; - display: block; - opacity: 0.6; - } - &:focus{ - padding: 4px; - } -} diff --git a/designable/next/src/components/Droppable/index.tsx b/designable/next/src/components/Droppable/index.tsx deleted file mode 100644 index 0802ab99f5e..00000000000 --- a/designable/next/src/components/Droppable/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react' -import { usePrefix, TextWidget } from '@designable/react' -import { Empty } from 'antd' -import cls from 'classnames' -import './styles.less' - -export interface IDroppableProps { - style?: React.CSSProperties - className?: string -} - -export const Droppable: React.FC = (props: any) => { - const prefix = usePrefix('droppable') - return ( - } - /> - ) -} diff --git a/designable/next/src/components/Droppable/styles.less b/designable/next/src/components/Droppable/styles.less deleted file mode 100644 index d175c36436a..00000000000 --- a/designable/next/src/components/Droppable/styles.less +++ /dev/null @@ -1,9 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-droppable { - margin-left: 0 !important; - margin-right: 0 !important; - padding: 20px; - border: 1px solid @border-color-split; - color: @text-color; -} diff --git a/designable/next/src/components/FormItemSwitcher/index.tsx b/designable/next/src/components/FormItemSwitcher/index.tsx deleted file mode 100644 index 04134856fbd..00000000000 --- a/designable/next/src/components/FormItemSwitcher/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import { Switch } from 'antd' - -export interface IFormItemSwitcherProps { - value?: string - onChange?: (value: string) => void -} - -export const FormItemSwitcher: React.FC = (props) => { - return ( - { - props.onChange(value ? 'FormItem' : undefined) - }} - /> - ) -} diff --git a/designable/next/src/components/LoadTemplate/index.tsx b/designable/next/src/components/LoadTemplate/index.tsx deleted file mode 100644 index 3bd2e9fa764..00000000000 --- a/designable/next/src/components/LoadTemplate/index.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react' -import { Button } from '@alifd/next' -import { Space, Divider } from 'antd' -import { usePrefix, TextWidget } from '@designable/react' -import cls from 'classnames' -import './styles.scss' - -export interface ITemplateAction { - title: React.ReactNode - tooltip?: React.ReactNode - icon?: string | React.ReactNode - onClick: () => void -} - -export interface ILoadTemplateProps { - className?: string - style?: React.CSSProperties - actions?: ITemplateAction[] -} - -export const LoadTemplate: React.FC = (props) => { - const prefix = usePrefix('load-template') - return ( -
-
- }> - {props.actions?.map((action, key) => { - return ( - - ) - })} - -
-
- ) -} diff --git a/designable/next/src/components/LoadTemplate/styles.scss b/designable/next/src/components/LoadTemplate/styles.scss deleted file mode 100644 index 152a6f3469d..00000000000 --- a/designable/next/src/components/LoadTemplate/styles.scss +++ /dev/null @@ -1,35 +0,0 @@ -@import '~@alifd/next/lib/core/style/_color.scss'; - -.dn-load-template { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - overflow: hidden; - padding-top: 10px; - padding-bottom: 10px; - &-actions { - position: relative; - padding: 0 20px; - &::before { - position: absolute; - content: ''; - display: block; - height: 0; - width: 300%; - top: 50%; - border-bottom: 2px dashed $color-line1-2; - right: 100%; - } - &::after { - position: absolute; - content: ''; - display: block; - height: 0; - width: 300%; - top: 50%; - border-bottom: 2px dashed $color-line1-2; - left: 100%; - } - } -} diff --git a/designable/next/src/components/index.ts b/designable/next/src/components/index.ts deleted file mode 100644 index 19322276aac..00000000000 --- a/designable/next/src/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DesignableField' -export * from './DesignableForm' diff --git a/designable/next/src/hooks/index.ts b/designable/next/src/hooks/index.ts deleted file mode 100644 index 6ab5860beb4..00000000000 --- a/designable/next/src/hooks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './useDropTemplate' diff --git a/designable/next/src/hooks/useDropTemplate.ts b/designable/next/src/hooks/useDropTemplate.ts deleted file mode 100644 index 89a13ad3181..00000000000 --- a/designable/next/src/hooks/useDropTemplate.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AppendNodeEvent, TreeNode } from '@designable/core' -import { useDesigner } from '@designable/react' -import { matchComponent, matchChildComponent } from '../shared' - -export const useDropTemplate = ( - name: string, - getChildren: (source: TreeNode[]) => TreeNode[] -) => { - return useDesigner((designer) => { - return designer.subscribeTo(AppendNodeEvent, (event) => { - const { source, target } = event.data - if (Array.isArray(target)) return - if (!Array.isArray(source)) return - if ( - matchComponent( - target, - (key) => - key === name && - source.every((child) => !matchChildComponent(child, name)) - ) && - target.children.length === 0 - ) { - target.setNodeChildren(...getChildren(source)) - return false - } - }) - }) -} diff --git a/designable/next/src/index.ts b/designable/next/src/index.ts deleted file mode 100644 index e1e3b6f0e4e..00000000000 --- a/designable/next/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import './locales' -import './sources' -export * from './components' diff --git a/designable/next/src/locales/en-US/Array.ts b/designable/next/src/locales/en-US/Array.ts deleted file mode 100644 index a567945a8fe..00000000000 --- a/designable/next/src/locales/en-US/Array.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { ISettingsLocale } from '../types' - -const ArrayOperations: ISettingsLocale = { - Index: 'Indexes', - SortHandle: 'Sort Handle', - Addition: 'Addition', - Remove: 'Remove', - MoveDown: 'Move Down', - MoveUp: 'Move Up', -} - -export const ArrayTable: ISettingsLocale = { - ...ArrayOperations, - title: 'Array Table', - Column: 'Column', -} - -export const ArrayCards: ISettingsLocale = { - ...ArrayOperations, - title: 'Array Cards', -} - -export const ArrayTabs = { - ...ArrayOperations, - title: 'Array Tabs', -} - -export const ArrayCollapse: ISettingsLocale = { - ...ArrayOperations, - title: 'Array Collapse', -} diff --git a/designable/next/src/locales/en-US/ArrayCards.ts b/designable/next/src/locales/en-US/ArrayCards.ts deleted file mode 100644 index 11b5f1a4d56..00000000000 --- a/designable/next/src/locales/en-US/ArrayCards.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ArrayTable } from './ArrayTable' -import { Card } from './Card' - -export const ArrayCards = Card - -ArrayCards.Addition = ArrayTable.Addition diff --git a/designable/next/src/locales/en-US/ArrayTable.ts b/designable/next/src/locales/en-US/ArrayTable.ts deleted file mode 100644 index 1b0bffbee12..00000000000 --- a/designable/next/src/locales/en-US/ArrayTable.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const ArrayTable: ISettingsLocale = { - primaryKey: 'Primary Key', - tableLayout: { - title: 'Table Layout', - dataSource: ['Auto', 'Fixed'], - }, - size: { - title: 'Size', - dataSource: ['Small', 'Medium', 'Inherit', 'None'], - }, - tableWidth: 'Table Width', - hasHeader: 'Header', - isZebra: 'Zebra', - emptyContent: 'Empty Content', - fixedHeader: 'Fixed Header', - maxBodyHeight: { - title: 'Max Body Height', - tooltip: - 'When Fixed Header is enabled, scroll bars will appear when the height exceeds this height', - }, - stickyHeader: 'Sticky Header', -} - -ArrayTable.Column = { - align: { - title: 'Cell Alignment', - dataSource: ['Left', 'Medium', 'Right'], - }, - alignHeader: { - title: 'Header alignment', - tooltip: - 'If not set, the alignment will be the same as that of the Cell Alignment', - dataSource: ['Left', 'Center', 'Right'], - }, - lock: { - title: 'Lock Column', - dataSource: ['None', 'Left', 'Right', 'Lock'], - }, - colSpan: 'Col Span', - wordBreak: { - title: 'Word Break', - dataSource: ['All', 'Word'], - }, -} - -ArrayTable.Addition = { - method: { - title: 'Method', - dataSource: ['Push', 'Unshift'], - }, - defaultValue: 'Default Value', -} diff --git a/designable/next/src/locales/en-US/Card.ts b/designable/next/src/locales/en-US/Card.ts deleted file mode 100644 index f09046fca90..00000000000 --- a/designable/next/src/locales/en-US/Card.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Card: ISettingsLocale = { - subTitle: 'Subtitle', - showTitleBullet: 'Title Bullet', - showHeadDivider: 'Title Divider', - contentHeight: 'Content Height', -} diff --git a/designable/next/src/locales/en-US/Cascader.ts b/designable/next/src/locales/en-US/Cascader.ts deleted file mode 100644 index 0291dd7a1ba..00000000000 --- a/designable/next/src/locales/en-US/Cascader.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Cascader: ISettingsLocale = { - expandTriggerType: { - title: 'Expand Trigger', - dataSource: ['Click', 'Hover'], - }, - canOnlySelectLeaf: 'Only Select Leaf', - canOnlyCheckLeaf: 'Only Check Leaf', - checkStrictly: 'Check Strictly', -} diff --git a/designable/next/src/locales/en-US/Checkbox.ts b/designable/next/src/locales/en-US/Checkbox.ts deleted file mode 100644 index 6e70835994f..00000000000 --- a/designable/next/src/locales/en-US/Checkbox.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Checkbox: ISettingsLocale = {} - -Checkbox.Group = {} diff --git a/designable/next/src/locales/en-US/Common.ts b/designable/next/src/locales/en-US/Common.ts deleted file mode 100644 index c9e52094bb4..00000000000 --- a/designable/next/src/locales/en-US/Common.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Style } from './Style' -import type { ISettingsLocale } from '../types' - -export const Common: ISettingsLocale = { - title: 'Title', - placeholder: 'Placeholder', - extra: 'Extra', - min: 'Min Value', - max: 'Max Value', - step: 'Step', - closeable: 'Closeable', - autoFocus: 'Auto Focus', - width: 'Width', - height: 'Height', - minLength: 'Min Length', - maxLength: 'Max Length', - minWidth: 'Min Width', - maxWidth: 'Max Width', - minHeight: 'Min Height', - maxHeight: 'Max Height', - notFoundContent: 'No Content Prompt', - addonBefore: 'Addon Before', - addonAfter: 'Addon After', - innerBefore: 'Inner Before', - innerAfter: 'Inner After', - addonTextBefore: 'Addon Text Before', - addonTextAfter: 'Addon Text After', - tooltip: 'Tooltip', - autoWidth: 'Auto Width', - name: 'Name', - showSearch: 'Search Button', - multiple: 'Allow Multiple Selections', - hasArrow: 'Dropdown Arrow', - hasBorder: 'Frame', - hasClear: { - title: 'Clear Button', - tooltip: - 'When enabled, you can click the clear button on the right to clear the input quickly', - }, - style: Style, - size: { - title: 'Size', - dataSource: ['Small', 'Medium', 'Large', 'Inherit'], - }, - direction: { - title: 'Direction', - dataSource: ['Horizontal', 'Vertical'], - }, - followTrigger: { - title: 'Follow Scroll', - tooltip: - 'When enabled, allows the popup layer to scroll with the component instead of staying in the popup position', - }, - useVirtual: { - title: 'Virtual Scroll', - tooltip: - 'It is used to optimize performance when the amount of data is large, and may flicker when scrolling quickly', - }, - immutable: 'Immutable Data', - popupTriggerType: { - title: 'Popup Trigger', - dataSource: ['Click', 'Hover'], - }, - popupAlign: { - title: 'Popup Align', - tooltip: 'Refer to the Overlay documentation', - }, -} diff --git a/designable/next/src/locales/en-US/DatePicker.ts b/designable/next/src/locales/en-US/DatePicker.ts deleted file mode 100644 index a259dde6288..00000000000 --- a/designable/next/src/locales/en-US/DatePicker.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { ISettingsLocale } from '../types' - -const CommonDatePickerLocale: ISettingsLocale = { - format: { - title: 'Format', - placeholder: 'YYYY-MM-DD', - }, - showTime: 'Show Time', - resetTime: 'Reset On Select', -} -export const DatePicker: ISettingsLocale = { - ...CommonDatePickerLocale, -} - -DatePicker.RangePicker = { - ...CommonDatePickerLocale, - type: { - title: 'Type', - dataSource: ['Date', 'Month', 'Year'], - }, -} diff --git a/designable/next/src/locales/en-US/Field.ts b/designable/next/src/locales/en-US/Field.ts deleted file mode 100644 index aad03b8ba7b..00000000000 --- a/designable/next/src/locales/en-US/Field.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { FormItem } from './FormItem' -import { Style } from './Style' -import type { ISettingsLocale } from '../types' -import { Common } from './Common' - -export const Field: ISettingsLocale = { - name: 'Name', - title: 'Title', - required: 'Required', - description: 'Description', - default: 'Default', - enum: 'Data Source', - 'x-display': { - title: 'Display State', - tooltip: - 'When the display value is "None", the data will be "Hidden" and deleted. When the display value is hidden, only the UI will be hidden', - dataSource: ['Visible', 'Hidden', 'None', 'Inherit'], - }, - 'x-pattern': { - title: 'UI Pattern', - dataSource: ['Editable', 'Disabled', 'ReadOnly', 'ReadPretty', 'Inherit'], - }, - 'x-validator': 'Validator', - 'x-reactions': 'Reactions', - 'x-decorator': 'Decorator', - 'x-decorator-props': { - ...Common, - ...FormItem, - style: Style, - tab_property: 'Decorator', - tab_style: 'Style', - }, - 'x-component-props': { - ...Common, - tab_property: 'Component', - tab_style: 'Style', - }, -} diff --git a/designable/next/src/locales/en-US/FormCollapse.ts b/designable/next/src/locales/en-US/FormCollapse.ts deleted file mode 100644 index 22c855ee67d..00000000000 --- a/designable/next/src/locales/en-US/FormCollapse.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormCollapse: ISettingsLocale = { - accordion: { - title: 'Accordion', - tooltip: 'When enabled, only one can be expanded at a time', - }, -} - -FormCollapse.CollapsePanel = {} diff --git a/designable/next/src/locales/en-US/FormGrid.ts b/designable/next/src/locales/en-US/FormGrid.ts deleted file mode 100644 index c8a68cdb304..00000000000 --- a/designable/next/src/locales/en-US/FormGrid.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormGrid: ISettingsLocale = { - minColumns: 'Min Columns', - maxColumns: 'Max Columns', - breakpoints: 'Breakpoints', - columnGap: 'Column Gap', - rowGap: 'Row Gap', - colWrap: 'Col Wrap', -} diff --git a/designable/next/src/locales/en-US/FormItem.ts b/designable/next/src/locales/en-US/FormItem.ts deleted file mode 100644 index abead7f5177..00000000000 --- a/designable/next/src/locales/en-US/FormItem.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { FormLayout } from './FormLayout' -import type { ISettingsLocale } from '../types' - -export const FormItem: ISettingsLocale = { - ...FormLayout, - asterisk: 'Asterisk', - gridSpan: 'Grid Span', -} diff --git a/designable/next/src/locales/en-US/FormLayout.ts b/designable/next/src/locales/en-US/FormLayout.ts deleted file mode 100644 index 375d215f26a..00000000000 --- a/designable/next/src/locales/en-US/FormLayout.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormLayout: ISettingsLocale = { - labelCol: 'Label Col', - wrapperCol: 'Component Col', - labelWidth: 'Label Width', - wrapperWidth: 'Wrapper Width', - colon: 'Colon', - feedbackLayout: { - title: 'Feedback layout', - dataSource: ['Loose', 'Terse', 'Popup', 'None', 'Inherit'], - }, - layout: { - title: 'Layout', - dataSource: ['Horizontal', 'Vertical', 'Inline', 'Inherit'], - }, - tooltipLayout: { - title: 'Tooltip Layout', - dataSource: ['Icon', 'Text', 'Inherit'], - }, - labelAlign: { - title: 'Label Align', - dataSource: ['Left', 'Right', 'Inherit'], - }, - wrapperAlign: { - title: 'Wrapper Align', - dataSource: ['Left', 'Right', 'Inherit'], - }, - labelWrap: 'Label Wrap', - wrapperWrap: 'Wrapper wrap', - fullness: 'Fullness', - inset: 'Inset', - shallow: 'Shallow', - bordered: 'Border', -} diff --git a/designable/next/src/locales/en-US/FormTab.ts b/designable/next/src/locales/en-US/FormTab.ts deleted file mode 100644 index 60ffee74be2..00000000000 --- a/designable/next/src/locales/en-US/FormTab.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormTab: ISettingsLocale = { - size: { - title: 'Size', - dataSource: ['Small', 'Medium', 'Inherit'], - }, - shape: { - title: 'Shape', - dataSource: ['Pure', 'Wrapper', 'Text', 'Capsule'], - }, - animation: 'Transition', - excessMode: { - title: 'Excess Mode', - tooltip: 'When there are too many tabs, how to slide?', - dataSource: ['Slider', 'Dropdown'], - }, - tabPosition: { - title: 'Tab Position', - dataSource: ['Top', 'Bottom', 'Left', 'Right'], - }, - triggerType: { - title: 'Trigger Type', - tooltip: 'Trigger method of activation tab', - dataSource: ['Click', 'Hover'], - }, -} - -FormTab.TabPane = {} diff --git a/designable/next/src/locales/en-US/Input.ts b/designable/next/src/locales/en-US/Input.ts deleted file mode 100644 index 95295cf8521..00000000000 --- a/designable/next/src/locales/en-US/Input.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Input: ISettingsLocale = { - showLimitHint: 'Show Limit Hint', - cutString: { - title: 'Cut String', - tooltip: - 'When the maxLength is set, whether to truncate the string is exceeded', - }, - trim: { - title: 'Trim', - tooltip: 'Remove leading and trailing spaces', - }, - composition: 'Filter Ime Middle Letters', - hint: { - title: 'Hint', - tooltip: - 'The value is taken from the type of Icon and is in the same position as the clear button', - }, -} - -Input.TextArea = { - ...Input, - autoHeight: 'Auto Height', - rows: 'Rows', -} diff --git a/designable/next/src/locales/en-US/NumberPicker.ts b/designable/next/src/locales/en-US/NumberPicker.ts deleted file mode 100644 index 6fdafcfeda4..00000000000 --- a/designable/next/src/locales/en-US/NumberPicker.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const NumberPicker: ISettingsLocale = { - type: { - title: 'Type', - dataSource: ['Normal', 'Inline'], - }, - precision: 'Precision', - innerAfter: 'Inner After', - device: { - title: 'Preset Device', - dataSource: ['Desktop', 'Phone', 'Pad'], - }, - hasTrigger: 'Trigger', - alwaysShowTrigger: 'Always Show Trigger', -} diff --git a/designable/next/src/locales/en-US/Password.ts b/designable/next/src/locales/en-US/Password.ts deleted file mode 100644 index 085fb24a106..00000000000 --- a/designable/next/src/locales/en-US/Password.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Password: ISettingsLocale = {} diff --git a/designable/next/src/locales/en-US/Radio.ts b/designable/next/src/locales/en-US/Radio.ts deleted file mode 100644 index 2d95c4a2690..00000000000 --- a/designable/next/src/locales/en-US/Radio.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Radio: ISettingsLocale = {} - -Radio.Group = { - shape: { - title: 'Shape', - dataSource: ['Normal', 'Button'], - }, -} diff --git a/designable/next/src/locales/en-US/Range.ts b/designable/next/src/locales/en-US/Range.ts deleted file mode 100644 index cbad183ee35..00000000000 --- a/designable/next/src/locales/en-US/Range.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Range: ISettingsLocale = { - slider: { - title: 'Slider', - dataSource: ['Single', 'Double'], - }, - step: { - title: 'Step', - tooltip: - 'The value must be greater than 0 and can be divided by (max - min)', - }, - marks: { - title: 'Marks', - tooltip: - 'False means not to display, Array enumeration shows the value, Number means to divide equally by number, Object means to divide by key, and value is displayed)', - }, - marksPosition: { - title: 'Marks Position', - dataSource: ['Top', 'Bottom'], - }, - hasTip: 'Show Tips', - reverse: { - title: 'Reversal', - tooltip: 'Selected state inversion', - }, - pure: 'Pure Rendering', - fixedWidth: { - title: 'Fixed Width', - }, - tooltipVisible: 'Tooltips Visible', -} diff --git a/designable/next/src/locales/en-US/Rating.ts b/designable/next/src/locales/en-US/Rating.ts deleted file mode 100644 index 03b60ddc6fa..00000000000 --- a/designable/next/src/locales/en-US/Rating.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Rating: ISettingsLocale = { - count: 'Star Count', - showGrade: 'Grade', - allowHalf: 'Allow Half Star', - allowClear: { - title: 'Clear After Clicking', - tooltip: 'After scoring, click the Rating again to clear the count', - }, -} diff --git a/designable/next/src/locales/en-US/Select.ts b/designable/next/src/locales/en-US/Select.ts deleted file mode 100644 index 8a2d4a01882..00000000000 --- a/designable/next/src/locales/en-US/Select.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Select: ISettingsLocale = { - filterLocal: 'Local Filter', - filter: 'Filter Function', - autoHighlightFirstItem: 'Auto highlight first item', - mode: { - title: 'Mode', - dataSource: ['Single', 'Multiple', 'Tags'], - }, - notFoundContent: 'No Content Prompt', - showDataSourceChildren: 'Show Data Source Children', - hasSelectAll: 'Can Select All', - cacheValue: { - title: 'Cache Value', - tooltip: - 'Do you want to keep the selected value when the data source changes', - }, - tagInline: 'Tag Inline', - tagClosable: 'Tag Closable', - adjustTagSize: { - title: 'Adjust Tag Size', - tooltip: 'Adjust the tag the same as the selector', - }, - maxTagCount: 'Max Tag Count', - hiddenSelected: 'Hidden Selected', - popupAutoFocus: 'Popup Auto Focus', -} diff --git a/designable/next/src/locales/en-US/Space.ts b/designable/next/src/locales/en-US/Space.ts deleted file mode 100644 index a156842dfcc..00000000000 --- a/designable/next/src/locales/en-US/Space.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Space: ISettingsLocale = { - align: { - title: 'Alignment', - dataSource: ['Start', 'End', 'Center', 'Baseline'], - }, - split: 'Split', - wrap: 'Auto Wrap', -} diff --git a/designable/next/src/locales/en-US/Style.ts b/designable/next/src/locales/en-US/Style.ts deleted file mode 100644 index 8dae5a1bc02..00000000000 --- a/designable/next/src/locales/en-US/Style.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Style: ISettingsLocale = { - width: 'Width', - height: 'Height', - display: 'Display', - background: 'Background', - boxShadow: 'Box Shadow', - font: 'Font', - margin: 'Margin', - padding: 'Padding', - borderRadius: 'Border Radius', - border: 'Border', - opacity: 'Opacity', -} diff --git a/designable/next/src/locales/en-US/Switch.ts b/designable/next/src/locales/en-US/Switch.ts deleted file mode 100644 index 14fa275d935..00000000000 --- a/designable/next/src/locales/en-US/Switch.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Switch: ISettingsLocale = { - size: { - title: 'Size', - dataSource: ['Small', 'Medium', 'Inherit', 'Nothing'], - }, - checkedChildren: 'Open Content', - unCheckedChildren: 'Close Content', -} diff --git a/designable/next/src/locales/en-US/Text.ts b/designable/next/src/locales/en-US/Text.ts deleted file mode 100644 index 03179836474..00000000000 --- a/designable/next/src/locales/en-US/Text.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Text: ISettingsLocale = { - content: 'Text Content', - mode: { - title: 'Text Type', - dataSource: ['H1', 'H2', 'H3', 'Paragraph', 'Normal'], - }, -} diff --git a/designable/next/src/locales/en-US/TimePicker.ts b/designable/next/src/locales/en-US/TimePicker.ts deleted file mode 100644 index 59c3e81bf0b..00000000000 --- a/designable/next/src/locales/en-US/TimePicker.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const TimePicker: ISettingsLocale = { - format: { - title: 'Format', - placeholder: 'e.g. HH:mm:ss', - }, - hourStep: 'Hour Step', - minuteStep: 'Minute Step', - secondStep: 'Second Step', -} diff --git a/designable/next/src/locales/en-US/Transfer.ts b/designable/next/src/locales/en-US/Transfer.ts deleted file mode 100644 index 01ead4e6759..00000000000 --- a/designable/next/src/locales/en-US/Transfer.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Transfer: ISettingsLocale = { - id: 'Id', - mode: { - title: 'Mode', - dataSource: ['Normal', 'Simple'], - }, - leftDisabled: 'Disable Left Panel', - rightDisabled: 'Disable Right Panel', - filter: 'Filter Function', - searchPlaceholder: 'Search placeholder tips', - titles: 'Titles', - sortable: 'Sortable', - showCheckAll: 'Show Check All', -} diff --git a/designable/next/src/locales/en-US/TreeSelect.ts b/designable/next/src/locales/en-US/TreeSelect.ts deleted file mode 100644 index ba21dbcf5c9..00000000000 --- a/designable/next/src/locales/en-US/TreeSelect.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Select } from './Select' -import type { ISettingsLocale } from '../types' - -export const TreeSelect: ISettingsLocale = { - ...Select, - treeCheckable: { - title: 'Tree Checkable', - tooltip: - 'Whether the tree in the drop-down box supports checking the check box of the node', - }, - treeCheckStrictly: { - title: 'Tree Check Strictly', - tooltip: - 'Check whether the node check box in the tree in the drop-down box is completely controlled (the selected status of parent and child nodes is no longer associated)', - }, - treeCheckedStrategy: { - title: 'Tree Checked Strategy', - tooltip: 'How to backfill when selected', - dataSource: [ - 'Return only parents', - 'Return only children', - 'Returns all selected', - ], - }, - treeDefaultExpandAll: 'Expand All By Default', -} diff --git a/designable/next/src/locales/en-US/Upload.ts b/designable/next/src/locales/en-US/Upload.ts deleted file mode 100644 index 187b431b9e7..00000000000 --- a/designable/next/src/locales/en-US/Upload.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Upload: ISettingsLocale = { - action: 'Upload Url', - shape: { - title: 'Shape', - dataSource: ['Normal', 'Card'], - }, - accept: 'Accept File Type', - data: 'Upload Extra Data', - headers: 'Upload Headers', - withCredentials: 'With Credentials', - timeout: 'Timeout(ms)', - method: { - title: 'Upload Method', - dataSource: ['POST', 'PUT'], - }, - request: 'Custom Upload Function', - name: 'Name Key', - listType: { - title: 'Upload List Type', - dataSource: ['Default', 'Text', 'Image', 'Card'], - }, - limit: 'Max Upload count', - dragable: 'Dragable', - useDataURL: 'Local Preview', - autoUpload: 'Auto Upload', -} - -Upload.Dragger = { ...Upload } diff --git a/designable/next/src/locales/en-US/index.ts b/designable/next/src/locales/en-US/index.ts deleted file mode 100644 index aa99fff17b9..00000000000 --- a/designable/next/src/locales/en-US/index.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { Common } from './Common' -import { Field } from './Field' -import { FormLayout } from './FormLayout' -import { Card } from './Card' -import { FormGrid } from './FormGrid' -import { Space } from './Space' -import { FormTab } from './FormTab' -import { FormCollapse } from './FormCollapse' -import { Input } from './Input' -import { Select } from './Select' -import { TreeSelect } from './TreeSelect' -import { Cascader } from './Cascader' -import { Radio } from './Radio' -import { Checkbox } from './Checkbox' -import { Range } from './Range' -import { Rating } from './Rating' -import { DatePicker } from './DatePicker' -import { TimePicker } from './TimePicker' -import { NumberPicker } from './NumberPicker' -import { Password } from './Password' -import { Transfer } from './Transfer' -import { Upload } from './Upload' -import { Switch } from './Switch' -import { ArrayTable } from './ArrayTable' -import { ArrayCards } from './ArrayCards' -import { Text } from './Text' -import * as ArrayComponents from './Array' -import type { ISettingsLocale } from '../types' - -const Form: ISettingsLocale = { ...Common, ...FormLayout } - -const Components: ISettingsLocale = { - FormLayout, - Card, - FormGrid, - Space, - FormTab, - FormCollapse, - Input, - Select, - TreeSelect, - Cascader, - Radio, - Checkbox, - Range, - Rating, - DatePicker, - TimePicker, - NumberPicker, - Password, - Transfer, - Upload, - Switch, - Text, - ArrayTable, - ArrayCards, -} - -const enUS: ISettingsLocale = { - Components: { - Root: 'Root', - DesignableForm: 'Form', - DesignableField: 'Field', - Input: { title: 'Input', TextArea: 'TextArea' }, - Select: 'Select', - Radio: { title: 'Radio', Group: 'Radio Group' }, - Checkbox: { - title: 'Checkbox', - Group: 'Checkbox Group', - }, - Card: 'Card', - FormGrid: 'Form Grid', - FormLayout: 'Form Layout', - Range: 'Range', - Rating: 'Rating', - Cascader: 'Cascader', - Space: 'Space', - DatePicker: { title: 'Date', RangePicker: 'Date Range' }, - TimePicker: { title: 'Time', RangePicker: 'Time Range' }, - NumberPicker: 'Number', - Password: 'Password', - Transfer: 'Transfer', - TreeSelect: 'TreeSelect', - Upload: { title: 'Upload', Dragger: 'Dragger Upload' }, - Switch: 'Switch', - FormTab: { title: 'Form Tab', TabPane: 'Tab Panel' }, - FormCollapse: { title: 'Form Collapse', CollapsePanel: 'Collapse Panel' }, - Object: 'Object', - Void: 'Void Element', - Text: 'Text', - ...ArrayComponents, - FormItem: 'Form Item', - }, - Settings: { - ...Form, - ...Field, - namespace: Components, - }, - Common: { - droppable: 'Droppable', - addTabPane: 'Add Panel', - addCollapsePanel: 'Add Panel', - addTableColumn: 'Add Column', - addTableSortHandle: 'Add Sort Handle', - addIndex: 'Add Index', - addOperation: 'Add Operations', - }, -} - -export default enUS diff --git a/designable/next/src/locales/index.ts b/designable/next/src/locales/index.ts deleted file mode 100644 index a2ddf209801..00000000000 --- a/designable/next/src/locales/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { GlobalRegistry } from '@designable/core' -import zhCN from './zh-CN' -import enUS from './en-US' - -GlobalRegistry.registerDesignerLocales({ - 'zh-CN': zhCN, - 'en-US': enUS, -}) diff --git a/designable/next/src/locales/types.ts b/designable/next/src/locales/types.ts deleted file mode 100644 index aff99c9b286..00000000000 --- a/designable/next/src/locales/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -export interface ISettingsLocale { - [key: string]: - | string - | { - title?: string - description?: string - tooltip?: string - placeholder?: string - dataSource?: string[] - } - | ISettingsLocale -} diff --git a/designable/next/src/locales/zh-CN/Array.ts b/designable/next/src/locales/zh-CN/Array.ts deleted file mode 100644 index f932b425633..00000000000 --- a/designable/next/src/locales/zh-CN/Array.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { ISettingsLocale } from '../types' - -const ArrayOperations: ISettingsLocale = { - Index: '索引', - SortHandle: '排序手柄', - Addition: '新增按钮', - Remove: '删除按钮', - MoveDown: '下移按钮', - MoveUp: '上移按钮', -} - -export const ArrayTable: ISettingsLocale = { - ...ArrayOperations, - title: '自增表格', - Column: '表格列', -} - -export const ArrayCards: ISettingsLocale = { - ...ArrayOperations, - title: '自增卡片', -} - -export const ArrayTabs = { - ...ArrayOperations, - title: '自增选项卡', -} - -export const ArrayCollapse: ISettingsLocale = { - ...ArrayOperations, - title: '自增手风琴', -} diff --git a/designable/next/src/locales/zh-CN/ArrayCards.ts b/designable/next/src/locales/zh-CN/ArrayCards.ts deleted file mode 100644 index 11b5f1a4d56..00000000000 --- a/designable/next/src/locales/zh-CN/ArrayCards.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ArrayTable } from './ArrayTable' -import { Card } from './Card' - -export const ArrayCards = Card - -ArrayCards.Addition = ArrayTable.Addition diff --git a/designable/next/src/locales/zh-CN/ArrayTable.ts b/designable/next/src/locales/zh-CN/ArrayTable.ts deleted file mode 100644 index 70b9080af4a..00000000000 --- a/designable/next/src/locales/zh-CN/ArrayTable.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const ArrayTable: ISettingsLocale = { - primaryKey: '主键', - tableLayout: { - title: '表格布局', - dataSource: ['自动', '固定'], - }, - size: { - title: '尺寸', - dataSource: ['小', '中', '继承', '无'], - }, - tableWidth: '表格宽度', - hasHeader: '表格头', - isZebra: '斑马线', - emptyContent: '空内容文案', - fixedHeader: '固定表格头', - maxBodyHeight: { - title: '最大主体高度', - tooltip: '启用固定表格头时,超过此高度时会出现滚动条', - }, - stickyHeader: '粘性头部', -} - -ArrayTable.Column = { - align: { - title: '单元格对齐', - dataSource: ['左', '中', '右'], - }, - alignHeader: { - title: '表格头对齐', - tooltip: '不设置将与单元格对齐方式相同', - dataSource: ['左', '中', '右'], - }, - lock: { - title: '锁列', - dataSource: ['不锁', '左', '右', '锁'], - }, - colSpan: '格数', - wordBreak: { - title: '单词打破', - dataSource: ['全部', '单词'], - }, -} - -ArrayTable.Addition = { - method: { - title: '添加方法', - dataSource: ['尾部', '头部'], - }, - defaultValue: '默认值', -} diff --git a/designable/next/src/locales/zh-CN/Card.ts b/designable/next/src/locales/zh-CN/Card.ts deleted file mode 100644 index 0a62632e7c5..00000000000 --- a/designable/next/src/locales/zh-CN/Card.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Card: ISettingsLocale = { - subTitle: '子标题', - showTitleBullet: '标题项目符号', - showHeadDivider: '标题分割线', - contentHeight: '内容高度', -} diff --git a/designable/next/src/locales/zh-CN/Cascader.ts b/designable/next/src/locales/zh-CN/Cascader.ts deleted file mode 100644 index 9378baa0d36..00000000000 --- a/designable/next/src/locales/zh-CN/Cascader.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Cascader: ISettingsLocale = { - expandTriggerType: { - title: '展开触发', - dataSource: ['点击', '移入'], - }, - canOnlySelectLeaf: '单选仅叶节点', - canOnlyCheckLeaf: '多选仅叶节点', - checkStrictly: '父子节点选中不关联', -} diff --git a/designable/next/src/locales/zh-CN/Checkbox.ts b/designable/next/src/locales/zh-CN/Checkbox.ts deleted file mode 100644 index 6e70835994f..00000000000 --- a/designable/next/src/locales/zh-CN/Checkbox.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Checkbox: ISettingsLocale = {} - -Checkbox.Group = {} diff --git a/designable/next/src/locales/zh-CN/Common.ts b/designable/next/src/locales/zh-CN/Common.ts deleted file mode 100644 index bca424e0b04..00000000000 --- a/designable/next/src/locales/zh-CN/Common.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Style } from './Style' -import type { ISettingsLocale } from '../types' - -export const Common: ISettingsLocale = { - title: '标题', - placeholder: '占位提示', - extra: '右侧扩展', - min: '最小值', - max: '最大值', - step: '步长', - closeable: '可关闭', - autoFocus: '自动聚焦', - width: '宽度', - height: '高度', - minLength: '最小长度', - maxLength: '最大长度', - minWidth: '最小宽度', - maxWidth: '最大宽度', - minHeight: '最小高度', - maxHeight: '最大高度', - notFoundContent: '无内容提示文案', - addonBefore: '前缀', - addonAfter: '后缀', - innerBefore: '框内前缀', - innerAfter: '框内后缀', - addonTextBefore: '前缀标签', - addonTextAfter: '后缀标签', - tooltip: '提示', - autoWidth: '自动宽度', - name: '名称', - showSearch: '搜索按钮', - multiple: '允许多选', - hasArrow: '下拉箭头', - hasBorder: '边框', - hasClear: { - title: '清除按钮', - tooltip: '启用后,输入时可点击右侧清除按钮快速清空输入', - }, - style: Style, - size: { - title: '尺寸', - dataSource: ['小', '中', '大', '继承'], - }, - direction: { - title: '方向', - dataSource: ['水平', '垂直'], - }, - followTrigger: { - title: '跟随滚动', - tooltip: '启用后可让弹层跟随组件一起滚动,而不是停留在弹出的位置', - }, - useVirtual: { - title: '虚拟滚动', - tooltip: '用于数据量较大时优化性能,快速滚动时可能闪烁', - }, - immutable: '不可变数据', - popupTriggerType: { - title: '触发弹层', - dataSource: ['点击', '移入'], - }, - popupAlign: { - title: '弹层对齐方式', - tooltip: '参考 Overlay 文档', - }, -} diff --git a/designable/next/src/locales/zh-CN/DatePicker.ts b/designable/next/src/locales/zh-CN/DatePicker.ts deleted file mode 100644 index d87f1a98049..00000000000 --- a/designable/next/src/locales/zh-CN/DatePicker.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { ISettingsLocale } from '../types' - -const CommonDatePickerLocale: ISettingsLocale = { - format: { - title: '格式', - placeholder: 'YYYY-MM-DD', - }, - showTime: '使用时间控件', - resetTime: '选择时重置时间', -} -export const DatePicker: ISettingsLocale = { - ...CommonDatePickerLocale, -} - -DatePicker.RangePicker = { - ...CommonDatePickerLocale, - type: { - title: '类型', - dataSource: ['日', '月', '年'], - }, -} diff --git a/designable/next/src/locales/zh-CN/Field.ts b/designable/next/src/locales/zh-CN/Field.ts deleted file mode 100644 index c7439e55ee9..00000000000 --- a/designable/next/src/locales/zh-CN/Field.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { FormItem } from './FormItem' -import { Style } from './Style' -import type { ISettingsLocale } from '../types' -import { Common } from './Common' - -export const Field: ISettingsLocale = { - name: '字段标识', - title: '标题', - required: '必填', - description: '描述', - default: '默认值', - enum: '数据源', - 'x-display': { - title: '展示状态', - tooltip: '半隐藏只会隐藏UI,全隐藏会删除数据', - dataSource: ['显示', '半隐藏', '全隐藏', '继承'], - }, - 'x-pattern': { - title: 'UI形态', - dataSource: ['可编辑', '禁用', '只读', '阅读', '继承'], - }, - 'x-validator': '校验规则', - 'x-reactions': '响应器规则', - 'x-decorator': '启用容器组件', - 'x-decorator-props': { - ...Common, - ...FormItem, - style: Style, - tab_property: '容器属性', - tab_style: '容器样式', - }, - 'x-component-props': { - ...Common, - tab_property: '组件属性', - tab_style: '组件样式', - }, -} diff --git a/designable/next/src/locales/zh-CN/FormCollapse.ts b/designable/next/src/locales/zh-CN/FormCollapse.ts deleted file mode 100644 index 2d6e0a7a05b..00000000000 --- a/designable/next/src/locales/zh-CN/FormCollapse.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormCollapse: ISettingsLocale = { - accordion: { - title: '手风琴模式', - tooltip: '启用后一次只能展开一个', - }, -} - -FormCollapse.CollapsePanel = {} diff --git a/designable/next/src/locales/zh-CN/FormGrid.ts b/designable/next/src/locales/zh-CN/FormGrid.ts deleted file mode 100644 index a14c0aeeddc..00000000000 --- a/designable/next/src/locales/zh-CN/FormGrid.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormGrid: ISettingsLocale = { - minColumns: '最小列数', - maxColumns: '最大列数', - breakpoints: '响应式断点', - columnGap: '列间距', - rowGap: '行间距', - colWrap: '自动换行', -} diff --git a/designable/next/src/locales/zh-CN/FormItem.ts b/designable/next/src/locales/zh-CN/FormItem.ts deleted file mode 100644 index 88c2e057d7f..00000000000 --- a/designable/next/src/locales/zh-CN/FormItem.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { FormLayout } from './FormLayout' -import type { ISettingsLocale } from '../types' - -export const FormItem: ISettingsLocale = { - ...FormLayout, - asterisk: '星号', - gridSpan: '网格跨列', -} diff --git a/designable/next/src/locales/zh-CN/FormLayout.ts b/designable/next/src/locales/zh-CN/FormLayout.ts deleted file mode 100644 index 8361f0173fc..00000000000 --- a/designable/next/src/locales/zh-CN/FormLayout.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormLayout: ISettingsLocale = { - labelCol: '标签网格宽度', - wrapperCol: '组件网格宽度', - labelWidth: '标签宽度', - wrapperWidth: '组件宽度', - colon: '是否有冒号', - feedbackLayout: { - title: '反馈布局', - dataSource: ['宽松', '紧凑', '弹层', '无', '继承'], - }, - layout: { - title: '布局', - dataSource: ['水平', '垂直', '内联', '继承'], - }, - tooltipLayout: { - title: '提示布局', - dataSource: ['图标', '文本', '继承'], - }, - labelAlign: { - title: '标签对齐', - dataSource: ['左', '右', '继承'], - }, - wrapperAlign: { - title: '组件对齐', - dataSource: ['左', '右', '继承'], - }, - labelWrap: '标签换行', - wrapperWrap: '组件换行', - fullness: '组件占满', - inset: '内联布局', - shallow: '是否浅传递', - bordered: '是否有边框', -} diff --git a/designable/next/src/locales/zh-CN/FormTab.ts b/designable/next/src/locales/zh-CN/FormTab.ts deleted file mode 100644 index 9215a5b0157..00000000000 --- a/designable/next/src/locales/zh-CN/FormTab.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const FormTab: ISettingsLocale = { - size: { - title: '尺寸', - dataSource: ['小', '中', '继承'], - }, - shape: { - title: '外观', - dataSource: ['纯净', '包裹', '文本', '胶囊'], - }, - animation: '动画过渡', - excessMode: { - title: '滑动模式', - tooltip: '选项卡过多时,如何滑动?', - dataSource: ['滑动器', '下拉列表'], - }, - tabPosition: { - title: '选项卡位置', - dataSource: ['上', '下', '左', '右'], - }, - triggerType: { - title: '选项卡激活方式', - tooltip: '激活选项卡的触发方式', - dataSource: ['点击', '移入'], - }, -} - -FormTab.TabPane = {} diff --git a/designable/next/src/locales/zh-CN/Input.ts b/designable/next/src/locales/zh-CN/Input.ts deleted file mode 100644 index a0e4a501f4c..00000000000 --- a/designable/next/src/locales/zh-CN/Input.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Input: ISettingsLocale = { - showLimitHint: '长度限制提示', - cutString: { - title: '截断', - tooltip: '当设置最大长度后,超出是否截断字符串', - }, - trim: { - title: '修剪', - tooltip: '移除首尾空格', - }, - composition: '过滤输入法中间字母', - hint: { - title: '水印', - tooltip: '值取自 Icon 的 type,与清除按钮在同一位置', - }, -} - -Input.TextArea = { - ...Input, - autoHeight: '自动高度', - rows: '文本框高度', -} diff --git a/designable/next/src/locales/zh-CN/NumberPicker.ts b/designable/next/src/locales/zh-CN/NumberPicker.ts deleted file mode 100644 index 7141f2570a6..00000000000 --- a/designable/next/src/locales/zh-CN/NumberPicker.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const NumberPicker: ISettingsLocale = { - type: { - title: '类型', - dataSource: ['正常', '内联'], - }, - precision: '保留小数点后位数', - innerAfter: '后缀', - device: { - title: '预设设备', - dataSource: ['桌面', '手机', '平板'], - }, - hasTrigger: '展示调整按钮', - alwaysShowTrigger: '总是展示调整按钮', -} diff --git a/designable/next/src/locales/zh-CN/Password.ts b/designable/next/src/locales/zh-CN/Password.ts deleted file mode 100644 index 085fb24a106..00000000000 --- a/designable/next/src/locales/zh-CN/Password.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Password: ISettingsLocale = {} diff --git a/designable/next/src/locales/zh-CN/Radio.ts b/designable/next/src/locales/zh-CN/Radio.ts deleted file mode 100644 index d46d575081e..00000000000 --- a/designable/next/src/locales/zh-CN/Radio.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Radio: ISettingsLocale = {} - -Radio.Group = { - shape: { - title: '形状', - dataSource: ['正常', '按钮'], - }, -} diff --git a/designable/next/src/locales/zh-CN/Range.ts b/designable/next/src/locales/zh-CN/Range.ts deleted file mode 100644 index bb0176709b3..00000000000 --- a/designable/next/src/locales/zh-CN/Range.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Range: ISettingsLocale = { - slider: { - title: '滑块个数', - dataSource: ['单个', '两个'], - }, - step: { - title: '步长', - tooltip: '取值必须大于 0,并且可被 (最大值 - 最小值) 整除', - }, - marks: { - title: '标记', - tooltip: - '刻度数值显示逻辑(false 代表不显示,array 枚举显示的值,number 代表按 number 平分,object 表示按 key 划分,value 值显示)', - }, - marksPosition: { - title: '标记位置', - dataSource: ['上方', '下方'], - }, - hasTip: '显示提示', - reverse: { - title: '反转', - tooltip: '选中态反转', - }, - pure: '纯净渲染', - fixedWidth: { - title: '是否为拖动线段类型', - }, - tooltipVisible: '默认展示提示', -} diff --git a/designable/next/src/locales/zh-CN/Rating.ts b/designable/next/src/locales/zh-CN/Rating.ts deleted file mode 100644 index aeb22874375..00000000000 --- a/designable/next/src/locales/zh-CN/Rating.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Rating: ISettingsLocale = { - count: '评分总数', - showGrade: '星星总数', - allowHalf: '半星评分', - allowClear: { - title: '点击后清除', - tooltip: '评分后再次点击评分清除评分', - }, -} diff --git a/designable/next/src/locales/zh-CN/Select.ts b/designable/next/src/locales/zh-CN/Select.ts deleted file mode 100644 index 7cfa9e81699..00000000000 --- a/designable/next/src/locales/zh-CN/Select.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Select: ISettingsLocale = { - filterLocal: '本地过滤', - filter: '过滤方法', - autoHighlightFirstItem: '自动高亮首项', - mode: { - title: '模式', - dataSource: ['单选', '多选', '标签'], - }, - notFoundContent: { - title: '无内容提示', - tooltip: '弹层内容为空的文案', - }, - showDataSourceChildren: { - title: '展示数据源子节点', - }, - hasSelectAll: '多选模式下是否可全选', - cacheValue: { - title: '缓存选中值', - tooltip: '数据源变化的时是否保留已选的内容', - }, - tagInline: '标签行内展示', - tagClosable: '标签可关闭', - adjustTagSize: { - title: '调整标签大小', - tooltip: '调整标签大小与选择器相同', - }, - maxTagCount: '最多展示标签数量', - hiddenSelected: '选择后立即隐藏菜单', - popupAutoFocus: '弹出菜单时自动聚焦', -} diff --git a/designable/next/src/locales/zh-CN/Space.ts b/designable/next/src/locales/zh-CN/Space.ts deleted file mode 100644 index 5e4905a741f..00000000000 --- a/designable/next/src/locales/zh-CN/Space.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Space: ISettingsLocale = { - align: { - title: '对齐', - dataSource: ['起始', '结尾', '中间', '基线'], - }, - split: '分割内容', - wrap: '自动换行', -} diff --git a/designable/next/src/locales/zh-CN/Style.ts b/designable/next/src/locales/zh-CN/Style.ts deleted file mode 100644 index 95f58f8a620..00000000000 --- a/designable/next/src/locales/zh-CN/Style.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Style: ISettingsLocale = { - width: '宽度', - height: '高度', - display: '展示', - background: '背景', - boxShadow: '阴影', - font: '字体', - margin: '外边距', - padding: '内边距', - borderRadius: '圆角', - border: '边框', - opacity: '透明度', -} diff --git a/designable/next/src/locales/zh-CN/Switch.ts b/designable/next/src/locales/zh-CN/Switch.ts deleted file mode 100644 index 603f42f9f03..00000000000 --- a/designable/next/src/locales/zh-CN/Switch.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Switch: ISettingsLocale = { - size: { - title: '尺寸', - dataSource: ['小', '中', '继承', '无'], - }, - checkedChildren: '打开时内容', - unCheckedChildren: '关闭时内容', -} diff --git a/designable/next/src/locales/zh-CN/Text.ts b/designable/next/src/locales/zh-CN/Text.ts deleted file mode 100644 index 5ee0dbec454..00000000000 --- a/designable/next/src/locales/zh-CN/Text.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Text: ISettingsLocale = { - content: '文本内容', - mode: { - title: '文本类型', - dataSource: ['H1', 'H2', 'H3', 'Paragraph', 'Normal'], - }, -} diff --git a/designable/next/src/locales/zh-CN/TimePicker.ts b/designable/next/src/locales/zh-CN/TimePicker.ts deleted file mode 100644 index 7cb18b90d86..00000000000 --- a/designable/next/src/locales/zh-CN/TimePicker.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const TimePicker: ISettingsLocale = { - format: { - title: '格式化', - placeholder: '如 HH:mm:ss', - }, - hourStep: '小时步长', - minuteStep: '分钟步长', - secondStep: '秒钟步长', -} diff --git a/designable/next/src/locales/zh-CN/Transfer.ts b/designable/next/src/locales/zh-CN/Transfer.ts deleted file mode 100644 index d2beef4d636..00000000000 --- a/designable/next/src/locales/zh-CN/Transfer.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Transfer: ISettingsLocale = { - id: '标识', - mode: { - title: '模式', - dataSource: ['正常', '简单'], - }, - leftDisabled: '禁用左侧面板', - rightDisabled: '禁用右侧面板', - filter: '过滤函数', - searchPlaceholder: '搜索占位提示', - titles: '左右面板标题', - sortable: '拖拽排序', - showCheckAll: '底部全选', -} diff --git a/designable/next/src/locales/zh-CN/TreeSelect.ts b/designable/next/src/locales/zh-CN/TreeSelect.ts deleted file mode 100644 index caf633e5e71..00000000000 --- a/designable/next/src/locales/zh-CN/TreeSelect.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Select } from './Select' -import type { ISettingsLocale } from '../types' - -export const TreeSelect: ISettingsLocale = { - ...Select, - treeCheckable: { - title: '勾选树', - tooltip: '下拉框中的树是否支持勾选节点的复选框', - }, - treeCheckStrictly: { - title: '严格树勾选', - tooltip: - '下拉框中的树勾选节点复选框是否完全受控(父子节点选中状态不再关联)', - }, - treeCheckedStrategy: { - title: '勾选树策略', - tooltip: '选中时回填的方式', - dataSource: ['只返回父节点', '只返回子节点', '返回所有选中的节点'], - }, - treeDefaultExpandAll: '默认展开所有节点', -} diff --git a/designable/next/src/locales/zh-CN/Upload.ts b/designable/next/src/locales/zh-CN/Upload.ts deleted file mode 100644 index dd20e75c140..00000000000 --- a/designable/next/src/locales/zh-CN/Upload.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { ISettingsLocale } from '../types' - -export const Upload: ISettingsLocale = { - action: '上传地址', - shape: { - title: '外观', - dataSource: ['正常', '卡片'], - }, - accept: '接受文件类型', - data: '上传额外参数', - headers: '上传请求头部', - withCredentials: '携带 Cookie', - timeout: '超时(ms)', - method: { - title: '上传方法', - dataSource: ['POST', 'PUT'], - }, - request: '自定义上传函数', - name: '文件名键值', - listType: { - title: '上传列表样式', - dataSource: ['默认', '文本', '图片', '卡片'], - }, - limit: '最大文件上传数量', - dragable: '支持拖拽上传', - useDataURL: '本地预览', - autoUpload: '自动上传', -} - -Upload.Dragger = { ...Upload } diff --git a/designable/next/src/locales/zh-CN/index.ts b/designable/next/src/locales/zh-CN/index.ts deleted file mode 100644 index 6fc8d75e0b9..00000000000 --- a/designable/next/src/locales/zh-CN/index.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { Common } from './Common' -import { Field } from './Field' -import { FormLayout } from './FormLayout' -import { Card } from './Card' -import { FormGrid } from './FormGrid' -import { Space } from './Space' -import { FormTab } from './FormTab' -import { FormCollapse } from './FormCollapse' -import { Input } from './Input' -import { Select } from './Select' -import { TreeSelect } from './TreeSelect' -import { Cascader } from './Cascader' -import { Radio } from './Radio' -import { Checkbox } from './Checkbox' -import { Range } from './Range' -import { Rating } from './Rating' -import { DatePicker } from './DatePicker' -import { TimePicker } from './TimePicker' -import { NumberPicker } from './NumberPicker' -import { Password } from './Password' -import { Transfer } from './Transfer' -import { Upload } from './Upload' -import { Switch } from './Switch' -import { Text } from './Text' -import { ArrayTable } from './ArrayTable' -import { ArrayCards } from './ArrayCards' -import * as ArrayComponents from './Array' -import type { ISettingsLocale } from '../types' - -const Form: ISettingsLocale = { ...Common, ...FormLayout } - -const Components: ISettingsLocale = { - FormLayout, - Card, - FormGrid, - Space, - FormTab, - FormCollapse, - Input, - Select, - TreeSelect, - Cascader, - Radio, - Checkbox, - Range, - Rating, - Text, - DatePicker, - TimePicker, - NumberPicker, - Password, - Transfer, - Upload, - Switch, - ArrayTable, - ArrayCards, -} - -const zhCN: ISettingsLocale = { - Components: { - Root: '根组件', - DesignableForm: '表单', - DesignableField: '字段', - Input: { title: '输入框', TextArea: '多行文本' }, - Select: '选择框', - Radio: { title: '单选框', Group: '单选框组' }, - Checkbox: { - title: '复选框', - Group: '复选框组', - }, - Card: '卡片布局', - FormGrid: '网格布局', - FormLayout: '表单布局', - Range: '滑动条', - Rating: '评分器', - Cascader: '联级选择', - Space: '弹性间距', - DatePicker: { title: '日期选择', RangePicker: '日期范围' }, - TimePicker: { title: '时间选择', RangePicker: '时间范围' }, - NumberPicker: '数字输入', - Password: '密码输入', - Transfer: '穿梭框', - TreeSelect: '树选择', - Upload: { title: '上传', Dragger: '拖拽上传' }, - Switch: '开关', - FormTab: { title: '选项卡布局', TabPane: '选项卡面板' }, - FormCollapse: { title: '手风琴布局', CollapsePanel: '手风琴面板' }, - Object: '数据对象', - Void: '虚拟容器', - Text: '文本', - ...ArrayComponents, - FormItem: '表单项容器', - }, - Settings: { - ...Form, - ...Field, - namespace: Components, - }, - Common: { - droppable: '可以拖入组件', - addTabPane: '添加选项卡', - addCollapsePanel: '添加手风琴卡片', - addTableColumn: '添加表格列', - addTableSortHandle: '添加排序', - addIndex: '添加索引', - addOperation: '添加操作', - }, -} - -export default zhCN diff --git a/designable/next/src/schemas/ArrayCards.ts b/designable/next/src/schemas/ArrayCards.ts deleted file mode 100644 index b970c033a98..00000000000 --- a/designable/next/src/schemas/ArrayCards.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ArrayTable } from './ArrayTable' -import { Card } from './Card' - -export const ArrayCards = Card -ArrayCards.Addition = ArrayTable.Addition diff --git a/designable/next/src/schemas/ArrayTable.ts b/designable/next/src/schemas/ArrayTable.ts deleted file mode 100644 index b4e8623c5e3..00000000000 --- a/designable/next/src/schemas/ArrayTable.ts +++ /dev/null @@ -1,181 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const ArrayTable: ISchema & { Addition?: ISchema; Column?: ISchema } = { - type: 'object', - properties: { - primaryKey: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - defaultValue: 'id', - }, - }, - tableLayout: { - type: 'string', - enum: ['auto', 'fixed'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'auto', - optionType: 'button', - }, - }, - size: { - type: 'string', - enum: ['small', 'medium', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - tableWidth: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - hasBorder: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - hasHeader: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - isZebra: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - emptyContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - fixedHeader: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - default: false, - }, - maxBodyHeight: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-reactions': { - dependencies: ['.fixedHeader'], - fulfill: { - state: { - visible: '{{$deps[0]}}', - }, - }, - }, - }, - stickyHeader: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - useVirtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} - -const Column: ISchema = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - width: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - align: { - type: 'string', - enum: ['left', 'center', 'right'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - optionType: 'button', - }, - }, - alignHeader: { - type: 'string', - enum: ['left', 'center', 'right'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - optionType: 'button', - }, - }, - lock: { - type: 'string', - enum: [false, 'left', 'right', true], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - optionType: 'button', - }, - }, - colSpan: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - wordBreak: { - type: 'string', - enum: ['all', 'word'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'all', - optionType: 'button', - }, - }, - }, -} - -const Addition: ISchema = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - method: { - type: 'string', - enum: ['push', 'unshift'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'push', - optionType: 'button', - }, - }, - defaultValue: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - }, - }, -} - -ArrayTable.Column = Column -ArrayTable.Addition = Addition diff --git a/designable/next/src/schemas/CSSStyle.ts b/designable/next/src/schemas/CSSStyle.ts deleted file mode 100644 index 8d60878091d..00000000000 --- a/designable/next/src/schemas/CSSStyle.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const CSSStyle: ISchema = { - type: 'void', - properties: { - 'style.width': { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - 'style.height': { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - 'style.display': { - 'x-component': 'DisplayStyleSetter', - }, - 'style.background': { - 'x-component': 'BackgroundStyleSetter', - }, - 'style.boxShadow': { - 'x-component': 'BoxShadowStyleSetter', - }, - 'style.font': { - 'x-component': 'FontStyleSetter', - }, - 'style.margin': { - 'x-component': 'BoxStyleSetter', - }, - 'style.padding': { - 'x-component': 'BoxStyleSetter', - }, - 'style.borderRadius': { - 'x-component': 'BorderRadiusStyleSetter', - }, - 'style.border': { - 'x-component': 'BorderStyleSetter', - }, - 'style.opacity': { - 'x-decorator': 'FormItem', - 'x-component': 'Slider', - 'x-component-props': { - defaultValue: 1, - min: 0, - max: 1, - step: 0.01, - }, - }, - }, -} diff --git a/designable/next/src/schemas/Card.ts b/designable/next/src/schemas/Card.ts deleted file mode 100644 index 5f6145433cb..00000000000 --- a/designable/next/src/schemas/Card.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Card: ISchema & { Addition?: ISchema } = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - subTitle: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - showTitleBullet: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - showHeadDivider: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - contentHeight: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - extra: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, -} diff --git a/designable/next/src/schemas/Cascader.ts b/designable/next/src/schemas/Cascader.ts deleted file mode 100644 index 38eec4d401b..00000000000 --- a/designable/next/src/schemas/Cascader.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Cascader: ISchema = { - type: 'object', - properties: { - expandTriggerType: { - type: 'string', - enum: ['click', 'hover'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'click', - optionType: 'button', - }, - }, - useVirtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - multiple: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - default: false, - }, - canOnlySelectLeaf: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-reactions': { - dependencies: ['.multiple'], - fulfill: { - state: { - visible: '{{!$deps[0]}}', - }, - }, - }, - }, - canOnlyCheckLeaf: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-reactions': { - dependencies: ['.multiple'], - fulfill: { - state: { - visible: '{{$deps[0]}}', - }, - }, - }, - }, - checkStrictly: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - immutable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Checkbox.ts b/designable/next/src/schemas/Checkbox.ts deleted file mode 100644 index 98226f8ff8a..00000000000 --- a/designable/next/src/schemas/Checkbox.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Checkbox: ISchema & { Group?: ISchema } = { - type: 'object', - properties: {}, -} - -Checkbox.Group = { - type: 'object', - properties: { - direction: { - type: 'string', - enum: ['hoz', 'ver'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'hoz', - optionType: 'button', - }, - }, - }, -} diff --git a/designable/next/src/schemas/DatePicker.ts b/designable/next/src/schemas/DatePicker.ts deleted file mode 100644 index 54382b5b74c..00000000000 --- a/designable/next/src/schemas/DatePicker.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { ISchema } from '@formily/react' - -const CommonDatePickerAPI = { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - format: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - showTime: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - resetTime: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - hasClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - popupTriggerType: { - type: 'string', - enum: ['click', 'hover'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'click', - optionType: 'button', - }, - }, - popupAlign: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - followTrigger: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, -} - -export const DatePicker: ISchema & { RangePicker?: ISchema } = { - type: 'object', - properties: { - ...CommonDatePickerAPI, - }, -} - -DatePicker.RangePicker = { - type: 'object', - properties: { - ...CommonDatePickerAPI, - type: { - type: 'string', - enum: ['date', 'month', 'year'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'date', - }, - }, - }, -} diff --git a/designable/next/src/schemas/Form.ts b/designable/next/src/schemas/Form.ts deleted file mode 100644 index 51b143ecd33..00000000000 --- a/designable/next/src/schemas/Form.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ISchema } from '@formily/react' -import { FormLayout } from './FormLayout' -import { CSSStyle } from './CSSStyle' - -export const Form: ISchema = { - type: 'object', - properties: { - ...(FormLayout.properties as any), - style: CSSStyle, - }, -} diff --git a/designable/next/src/schemas/FormCollapse.ts b/designable/next/src/schemas/FormCollapse.ts deleted file mode 100644 index 23e94628ec9..00000000000 --- a/designable/next/src/schemas/FormCollapse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const FormCollapse: ISchema & { CollapsePanel?: ISchema } = { - type: 'object', - properties: { - accordion: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} - -FormCollapse.CollapsePanel = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, -} diff --git a/designable/next/src/schemas/FormGrid.ts b/designable/next/src/schemas/FormGrid.ts deleted file mode 100644 index ced61bbc994..00000000000 --- a/designable/next/src/schemas/FormGrid.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const FormGrid: ISchema = { - type: 'object', - properties: { - minWidth: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 100, - }, - }, - maxWidth: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - minColumns: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 0, - }, - }, - maxColumns: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - breakpoints: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - columnGap: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 10, - }, - }, - rowGap: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 5, - }, - }, - colWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/next/src/schemas/FormItem.ts b/designable/next/src/schemas/FormItem.ts deleted file mode 100644 index b87bea7c1a1..00000000000 --- a/designable/next/src/schemas/FormItem.ts +++ /dev/null @@ -1,140 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const FormItem: ISchema = { - type: 'object', - properties: { - tooltip: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonBefore: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonAfter: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - labelCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - wrapperCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - labelWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - wrapperWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - colon: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - asterisk: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - gridSpan: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - feedbackLayout: { - type: 'string', - enum: ['loose', 'terse', 'popover', 'none', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'loose', - }, - }, - size: { - type: 'string', - enum: ['small', 'default', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'default', - }, - }, - layout: { - type: 'string', - enum: ['horizontal', 'vertical', 'inline', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'horizontal', - }, - }, - tooltipLayout: { - type: 'string', - enum: ['icon', 'text', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'icon', - }, - }, - labelAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'right', - }, - }, - wrapperAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'left', - }, - }, - labelWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - wrapperWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - fullness: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - inset: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/next/src/schemas/FormLayout.ts b/designable/next/src/schemas/FormLayout.ts deleted file mode 100644 index 517aae1ebbf..00000000000 --- a/designable/next/src/schemas/FormLayout.ts +++ /dev/null @@ -1,123 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const FormLayout: ISchema = { - type: 'object', - properties: { - labelCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - wrapperCol: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - labelWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - wrapperWidth: { - 'x-decorator': 'FormItem', - 'x-component': 'SizeInput', - }, - colon: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - feedbackLayout: { - type: 'string', - enum: ['loose', 'terse', 'popover', 'none', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'loose', - }, - }, - size: { - type: 'string', - enum: ['small', 'default', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'default', - }, - }, - layout: { - type: 'string', - enum: ['horizontal', 'vertical', 'inline', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'horizontal', - }, - }, - tooltipLayout: { - type: 'string', - enum: ['icon', 'text', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'icon', - }, - }, - labelAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'right', - }, - }, - wrapperAlign: { - type: 'string', - enum: ['left', 'right', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'left', - }, - }, - labelWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - wrapperWrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - fullness: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - inset: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - shallow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - bordered: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/next/src/schemas/FormTab.ts b/designable/next/src/schemas/FormTab.ts deleted file mode 100644 index 2e548c66506..00000000000 --- a/designable/next/src/schemas/FormTab.ts +++ /dev/null @@ -1,98 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const FormTab: ISchema & { TabPane?: ISchema } = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - shape: { - type: 'string', - enum: ['pure', 'wrapped', 'text', 'capsule'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - default: 'pure', - }, - animation: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - excessMode: { - type: 'string', - enum: ['slide', 'dropdown'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'slide', - optionType: 'button', - }, - }, - tabPosition: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'top', - optionType: 'button', - }, - 'x-reactions': { - dependencies: ['.shape'], - when: `{{$deps[0] === 'wrapped'}}`, - fulfill: { - schema: { - enum: ['top', 'bottom', 'left', 'right'], - }, - }, - otherwise: { - schema: { - enum: ['top', 'bottom'], - }, - state: { - value: `{{$self.value !== 'bottom' ? 'top' : 'bottom'}}`, - }, - }, - }, - }, - triggerType: { - type: 'string', - enum: ['click', 'hover'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'click', - optionType: 'button', - }, - }, - extra: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, -} - -FormTab.TabPane = { - type: 'object', - properties: { - title: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - closeable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Input.ts b/designable/next/src/schemas/Input.ts deleted file mode 100644 index 4b569352ffa..00000000000 --- a/designable/next/src/schemas/Input.ts +++ /dev/null @@ -1,166 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Input: ISchema & { TextArea?: ISchema } = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - maxLength: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - showLimitHint: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - cutString: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - trim: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - composition: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - hasClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - hasBorder: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - hint: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - innerBefore: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - innerAfter: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonTextBefore: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - addonTextAfter: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} - -Input.TextArea = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - maxLength: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - cutString: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - trim: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - composition: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - hasBorder: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - autoHeight: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - default: false, - }, - rows: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-reactions': { - dependencies: ['.autoHeight'], - fulfill: { - state: { - visible: '{{!$deps[0]}}', - }, - }, - }, - 'x-component-props': { - min: 0, - precision: 0, - }, - }, - }, -} diff --git a/designable/next/src/schemas/NumberPicker.ts b/designable/next/src/schemas/NumberPicker.ts deleted file mode 100644 index 01632c53a89..00000000000 --- a/designable/next/src/schemas/NumberPicker.ts +++ /dev/null @@ -1,89 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const NumberPicker: ISchema = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - type: { - type: 'string', - enum: ['normal', 'inline'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'normal', - optionType: 'button', - }, - }, - step: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - precision: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - min: 0, - precision: 0, - }, - }, - autoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - max: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - min: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - innerAfter: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - device: { - type: 'string', - enum: ['desktop', 'phone', 'tablet'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'desktop', - optionType: 'button', - }, - }, - hasTrigger: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - default: true, - }, - alwaysShowTrigger: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-reactions': { - dependencies: ['.hasTrigger'], - fulfill: { - state: { - visible: '{{$deps[0]}}', - }, - }, - }, - }, - }, -} diff --git a/designable/next/src/schemas/Password.ts b/designable/next/src/schemas/Password.ts deleted file mode 100644 index f3fa977cd0b..00000000000 --- a/designable/next/src/schemas/Password.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ISchema } from '@formily/react' -import { Input } from './Input' - -export const Password: ISchema = { - type: 'object', - properties: Input.properties, -} diff --git a/designable/next/src/schemas/Radio.ts b/designable/next/src/schemas/Radio.ts deleted file mode 100644 index 6abe7312b31..00000000000 --- a/designable/next/src/schemas/Radio.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Radio: ISchema & { Group?: ISchema } = { - type: 'object', - properties: {}, -} - -Radio.Group = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - shape: { - type: 'string', - enum: ['normal', 'button'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - default: 'normal', - 'x-component-props': { - optionType: 'button', - }, - }, - direction: { - type: 'string', - enum: ['hoz', 'ver'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'hoz', - optionType: 'button', - }, - 'x-reactions': { - dependencies: ['.shape'], - fulfill: { - state: { - visible: `{{$deps[0] === 'normal'}}`, - }, - }, - }, - }, - }, -} diff --git a/designable/next/src/schemas/Range.ts b/designable/next/src/schemas/Range.ts deleted file mode 100644 index 5f99130c8b0..00000000000 --- a/designable/next/src/schemas/Range.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Range: ISchema = { - type: 'object', - properties: { - slider: { - type: 'string', - enum: ['single', 'double'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'single', - optionType: 'button', - }, - }, - min: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - max: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - step: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - marks: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION', 'BOOLEAN', 'NUMBER'], - }, - }, - marksPosition: { - type: 'string', - enum: ['above', 'below'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'above', - optionType: 'button', - }, - }, - hasTip: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - reverse: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - pure: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - fixedWidth: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - tooltipVisible: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - rtl: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Rating.ts b/designable/next/src/schemas/Rating.ts deleted file mode 100644 index 39ef62d611e..00000000000 --- a/designable/next/src/schemas/Rating.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Rating: ISchema = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - count: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - showGrade: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - allowHalf: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - allowClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Select.ts b/designable/next/src/schemas/Select.ts deleted file mode 100644 index cbc9bd0e1a7..00000000000 --- a/designable/next/src/schemas/Select.ts +++ /dev/null @@ -1,183 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Select: ISchema = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - autoWidth: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - hasClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - followTrigger: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - filterLocal: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - filter: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - helpCode: - 'function(key: string, item: object): boolean {\n return true\n}', - }, - }, - autoHighlightFirstItem: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - useVirtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - mode: { - type: 'string', - enum: ['single', 'multiple', 'tag'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - default: 'single', - 'x-component-props': { - optionType: 'button', - }, - }, - notFoundContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - showDataSourceChildren: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - hasBorder: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - hasArrow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-reactions': { - dependencies: ['.mode'], - fulfill: { - state: { - visible: `{{$deps[0] !== 'tag'}}`, - }, - }, - }, - }, - hasSelectAll: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - cacheValue: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - tagInline: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-reactions': { - dependencies: ['.mode'], - fulfill: { - state: { - visible: `{{$deps[0] === 'multiple'}}`, - }, - }, - }, - }, - tagClosable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - adjustTagSize: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: false, - }, - }, - maxTagCount: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - hiddenSelected: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-reactions': { - dependencies: ['.mode'], - fulfill: { - state: { - visible: `{{$deps[0] === 'tag' || $deps[0] === 'multiple'}}`, - }, - }, - }, - }, - popupAutoFocus: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Space.ts b/designable/next/src/schemas/Space.ts deleted file mode 100644 index 0de4efe051c..00000000000 --- a/designable/next/src/schemas/Space.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Space: ISchema = { - type: 'object', - properties: { - align: { - type: 'string', - enum: ['start', 'end', 'center', 'baseline'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - }, - direction: { - type: 'string', - enum: ['horizontal', 'vertical'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'horizontal', - optionType: 'button', - }, - }, - size: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - 'x-component-props': { - defaultValue: 8, - }, - }, - split: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - wrap: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Switch.ts b/designable/next/src/schemas/Switch.ts deleted file mode 100644 index 03b184c5d56..00000000000 --- a/designable/next/src/schemas/Switch.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Switch: ISchema = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - checkedChildren: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - unCheckedChildren: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - autoWidth: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Text.ts b/designable/next/src/schemas/Text.ts deleted file mode 100644 index 66784e1c78e..00000000000 --- a/designable/next/src/schemas/Text.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ISchema } from '@formily/react' - -export const Text: ISchema = { - type: 'object', - properties: { - content: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - }, - mode: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'normal', - }, - enum: ['h1', 'h2', 'h3', 'p', 'normal'], - }, - }, -} diff --git a/designable/next/src/schemas/TimePicker.ts b/designable/next/src/schemas/TimePicker.ts deleted file mode 100644 index c9d0dba8f9e..00000000000 --- a/designable/next/src/schemas/TimePicker.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const TimePicker: ISchema = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - hasClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - format: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - hourStep: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - minuteStep: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - secondStep: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - popupAlign: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - popupTriggerType: { - type: 'string', - enum: ['click', 'hover'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'click', - optionType: 'button', - }, - }, - }, -} diff --git a/designable/next/src/schemas/Transfer.ts b/designable/next/src/schemas/Transfer.ts deleted file mode 100644 index 47cbb8cee21..00000000000 --- a/designable/next/src/schemas/Transfer.ts +++ /dev/null @@ -1,81 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Transfer: ISchema = { - type: 'object', - properties: { - id: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - mode: { - type: 'string', - enum: ['normal', 'simple'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'normal', - optionType: 'button', - }, - }, - leftDisabled: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - rightDisabled: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - filter: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - helpCode: - 'function(searchedValue: string, data: object): boolean {\n return true\n}', - }, - }, - searchPlaceholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - notFoundContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - titles: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - sortable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - useVirtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - showCheckAll: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} diff --git a/designable/next/src/schemas/TreeSelect.ts b/designable/next/src/schemas/TreeSelect.ts deleted file mode 100644 index 6038be397f0..00000000000 --- a/designable/next/src/schemas/TreeSelect.ts +++ /dev/null @@ -1,104 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const TreeSelect: ISchema = { - type: 'object', - properties: { - size: { - type: 'string', - enum: ['small', 'medium', 'large', null], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'medium', - }, - }, - placeholder: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - hasArrow: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - hasBorder: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - hasClear: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - autoWidth: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - showSearch: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - notFoundContent: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - multiple: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - treeCheckable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - treeCheckStrictly: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - treeCheckedStrategy: { - type: 'string', - enum: ['parent', 'child', 'all'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: 'parent', - }, - }, - treeDefaultExpandAll: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - followTrigger: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - useVirtual: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - immutable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, -} diff --git a/designable/next/src/schemas/Upload.ts b/designable/next/src/schemas/Upload.ts deleted file mode 100644 index 7019b05efd2..00000000000 --- a/designable/next/src/schemas/Upload.ts +++ /dev/null @@ -1,111 +0,0 @@ -import type { ISchema } from '@formily/react' - -export const Upload: ISchema & { Dragger?: ISchema } = { - type: 'object', - properties: { - action: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - shape: { - type: 'string', - enum: [null, 'card'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: null, - optionType: 'button', - }, - }, - accept: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - data: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - headers: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - withCredentials: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - timeout: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - method: { - type: 'string', - enum: ['post', 'put'], - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - 'x-component-props': { - defaultValue: 'post', - optionType: 'button', - }, - }, - request: { - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - helpCode: `// Function(option: Object) => Object`, - }, - }, - name: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - listType: { - type: 'string', - enum: [null, 'text', 'image', 'card'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - defaultValue: null, - }, - }, - limit: { - type: 'number', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - dragable: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - useDataURL: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - autoUpload: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - 'x-component-props': { - defaultChecked: true, - }, - }, - }, -} - -Upload.Dragger = Upload diff --git a/designable/next/src/schemas/index.ts b/designable/next/src/schemas/index.ts deleted file mode 100644 index 77c01f385c0..00000000000 --- a/designable/next/src/schemas/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from './Input' -export * from './FormLayout' -export * from './CSSStyle' -export * from './Form' -export * from './FormItem' -export * from './Select' -export * from './Card' -export * from './Cascader' -export * from './Checkbox' -export * from './Radio' -export * from './DatePicker' -export * from './NumberPicker' -export * from './Password' -export * from './Rating' -export * from './Range' -export * from './TimePicker' -export * from './TreeSelect' -export * from './Transfer' -export * from './Upload' -export * from './Switch' -export * from './FormGrid' -export * from './Space' -export * from './Text' -export * from './FormTab' -export * from './FormCollapse' -export * from './ArrayTable' -export * from './ArrayCards' diff --git a/designable/next/src/shared.ts b/designable/next/src/shared.ts deleted file mode 100644 index 42347831f5c..00000000000 --- a/designable/next/src/shared.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { TreeNode, Engine } from '@designable/core' - -export type ComponentNameMatcher = - | string - | string[] - | ((name: string, node: TreeNode, context?: any) => boolean) - -export const matchComponent = ( - node: TreeNode, - name: ComponentNameMatcher, - context?: any -) => { - if (name === '*') return true - const componentName = node?.props?.['x-component'] - if (typeof name === 'function') - return name(componentName || '', node, context) - if (Array.isArray(name)) return name.includes(componentName) - return componentName === name -} - -export const matchChildComponent = ( - node: TreeNode, - name: ComponentNameMatcher, - context?: any -) => { - if (name === '*') return true - const componentName = node?.props?.['x-component'] - if (!componentName) return false - if (typeof name === 'function') - return name(componentName || '', node, context) - if (Array.isArray(name)) return name.includes(componentName) - return componentName.indexOf(`${name}.`) > -1 -} - -export const includesComponent = ( - node: TreeNode, - names: ComponentNameMatcher[], - target?: TreeNode -) => { - return names.some((name) => matchComponent(node, name, target)) -} - -export const queryNodesByComponentPath = ( - node: TreeNode, - path: ComponentNameMatcher[] -): TreeNode[] => { - if (path?.length === 0) return [] - if (path?.length === 1) { - if (matchComponent(node, path[0])) { - return [node] - } - } - return matchComponent(node, path[0]) - ? node.children.reduce((buf, child) => { - return buf.concat(queryNodesByComponentPath(child, path.slice(1))) - }, []) - : [] -} - -export const findNodeByComponentPath = ( - node: TreeNode, - path: ComponentNameMatcher[] -): TreeNode => { - if (path?.length === 0) return - if (path?.length === 1) { - if (matchComponent(node, path[0])) { - return node - } - } - if (matchComponent(node, path[0])) { - for (let i = 0; i < node.children.length; i++) { - const next = findNodeByComponentPath(node.children[i], path.slice(1)) - if (next) { - return next - } - } - } -} - -export const hasNodeByComponentPath = ( - node: TreeNode, - path: ComponentNameMatcher[] -) => !!findNodeByComponentPath(node, path) - -export const matchArrayItemsNode = (node: TreeNode) => { - return ( - node?.parent?.props?.type === 'array' && - node?.parent?.children?.[0] === node - ) -} - -export const createNodeId = (designer: Engine, id: string) => { - return { - [designer.props.nodeIdAttrName]: id, - } -} - -export const createEnsureTypeItemsNode = (type: string) => (node: TreeNode) => { - const objectNode = node.children.find((child) => child.props['type'] === type) - if ( - objectNode && - objectNode.designerProps.droppable && - !objectNode.props['x-component'] - ) { - return objectNode - } else { - const newObjectNode = new TreeNode({ - componentName: 'DesignableField', - props: { - type, - }, - }) - node.prependNode(newObjectNode) - return newObjectNode - } -} diff --git a/designable/next/src/sources/arrays.ts b/designable/next/src/sources/arrays.ts deleted file mode 100644 index 0f8cb421140..00000000000 --- a/designable/next/src/sources/arrays.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('arrays', [ - { - componentName: 'DesignableField', - props: { - type: 'array', - 'x-decorator': 'FormItem', - 'x-component': 'ArrayTable', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'array', - 'x-decorator': 'FormItem', - 'x-component': 'ArrayCards', - 'x-component-props': { - title: `Title`, - }, - }, - }, -]) diff --git a/designable/next/src/sources/displays.ts b/designable/next/src/sources/displays.ts deleted file mode 100644 index 8506ea95256..00000000000 --- a/designable/next/src/sources/displays.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('displays', [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'Text', - }, - }, -]) diff --git a/designable/next/src/sources/index.ts b/designable/next/src/sources/index.ts deleted file mode 100644 index c9da47ecd8a..00000000000 --- a/designable/next/src/sources/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import './inputs' -import './layouts' -import './arrays' -import './displays' diff --git a/designable/next/src/sources/inputs.ts b/designable/next/src/sources/inputs.ts deleted file mode 100644 index 40c03e750d6..00000000000 --- a/designable/next/src/sources/inputs.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('inputs', [ - { - componentName: 'DesignableField', - props: { - title: 'Input', - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'TextArea', - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'Select', - 'x-decorator': 'FormItem', - 'x-component': 'Select', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'Tree Select', - 'x-decorator': 'FormItem', - 'x-component': 'TreeSelect', - }, - }, - { - componentName: 'DesignableField', - props: { - title: 'Cascader', - 'x-decorator': 'FormItem', - 'x-component': 'Cascader', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string | number', - title: 'Radio Group', - 'x-decorator': 'FormItem', - 'x-component': 'Radio.Group', - enum: [ - { label: '选项1', value: 1 }, - { label: '选项2', value: 2 }, - ], - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Checkbox Group', - 'x-decorator': 'FormItem', - 'x-component': 'Checkbox.Group', - enum: [ - { label: '选项1', value: 1 }, - { label: '选项2', value: 2 }, - ], - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'number', - title: 'Range', - 'x-decorator': 'FormItem', - 'x-component': 'Range', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'number', - title: 'Rating', - 'x-decorator': 'FormItem', - 'x-component': 'Rating', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string', - title: 'DatePicker', - 'x-decorator': 'FormItem', - 'x-component': 'DatePicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: '[string,string]', - title: 'DateRangePicker', - 'x-decorator': 'FormItem', - 'x-component': 'DatePicker.RangePicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string', - title: 'TimePicker', - 'x-decorator': 'FormItem', - 'x-component': 'TimePicker', - }, - }, - // { - // componentName: 'DesignableField', - // props: { - // type: '[string,string]', - // title: 'TimeRangePicker', - // 'x-decorator': 'FormItem', - // 'x-component': 'TimePicker.RangePicker', - // }, - // }, - { - componentName: 'DesignableField', - props: { - type: 'number', - title: 'NumberPicker', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'string', - title: 'Password', - 'x-decorator': 'FormItem', - 'x-component': 'Password', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Transfer', - 'x-decorator': 'FormItem', - 'x-component': 'Transfer', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Upload', - 'x-decorator': 'FormItem', - 'x-component': 'Upload', - 'x-component-props': { - textContent: 'Upload', - }, - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'Array', - title: 'Drag Upload', - 'x-decorator': 'FormItem', - 'x-component': 'Upload.Dragger', - 'x-component-props': { - textContent: 'Click or drag file to this area to upload', - }, - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'boolean', - title: 'Switch', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'object', - }, - }, -]) diff --git a/designable/next/src/sources/layouts.ts b/designable/next/src/sources/layouts.ts deleted file mode 100644 index 3cbaa54b251..00000000000 --- a/designable/next/src/sources/layouts.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { GlobalDragSource } from '@designable/core' - -GlobalDragSource.appendSourcesByGroup('layouts', [ - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'Card', - 'x-component-props': { - title: 'Title', - contentHeight: 'auto', - }, - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormGrid', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormLayout', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'Space', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormTab', - }, - }, - { - componentName: 'DesignableField', - props: { - type: 'void', - 'x-component': 'FormCollapse', - }, - }, -]) diff --git a/designable/next/tsconfig.build.json b/designable/next/tsconfig.build.json deleted file mode 100644 index dbf069a065d..00000000000 --- a/designable/next/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./lib", - "paths": { - "@formily/*": [ - "../../packages/*", - "../../designable/*", - "../../devtools/*" - ] - }, - "declaration": true - } -} diff --git a/designable/next/tsconfig.json b/designable/next/tsconfig.json deleted file mode 100644 index c6865c25a75..00000000000 --- a/designable/next/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["./src/**/*.ts", "./src/**/*.tsx"], - "exclude": ["./src/__tests__/*", "./esm/*", "./lib/*"] -} diff --git a/designable/setters/.npmignore b/designable/setters/.npmignore deleted file mode 100644 index 1ff337420fd..00000000000 --- a/designable/setters/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -*.log -build -docs -doc-site -__tests__ -.eslintrc -jest.config.js -tsconfig.json -.umi -src \ No newline at end of file diff --git a/designable/setters/.umirc.js b/designable/setters/.umirc.js deleted file mode 100644 index 1362b3c43c6..00000000000 --- a/designable/setters/.umirc.js +++ /dev/null @@ -1,44 +0,0 @@ -import { resolve } from 'path' -export default { - mode: 'site', - logo: '//img.alicdn.com/imgextra/i2/O1CN01Kq3OHU1fph6LGqjIz_!!6000000004056-55-tps-1141-150.svg', - title: 'Formily', - hash: true, - favicon: - '//img.alicdn.com/imgextra/i3/O1CN01XtT3Tv1Wd1b5hNVKy_!!6000000002810-55-tps-360-360.svg', - outputPath: './doc-site', - navs: [ - { - title: 'Ant Design', - path: '/components', - }, - { - title: '主站', - path: 'https://v2.formilyjs.org', - }, - { - title: 'GITHUB', - path: 'https://github.com/alibaba/formily', - }, - ], - styles: [ - `.__dumi-default-navbar-logo{ - height: 60px !important; - width: 150px !important; - padding-left:0 !important; - color: transparent !important; - } - .__dumi-default-navbar{ - padding: 0 28px !important; - } - .__dumi-default-layout-hero{ - background-image: url(//img.alicdn.com/imgextra/i4/O1CN01ZcvS4e26XMsdsCkf9_!!6000000007671-2-tps-6001-4001.png); - background-size: cover; - background-repeat: no-repeat; - } - nav a{ - text-decoration: none !important; - } - `, - ], -} diff --git a/designable/setters/LICENSE.md b/designable/setters/LICENSE.md deleted file mode 100644 index 509632e8e80..00000000000 --- a/designable/setters/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-present, Alibaba Group Holding Limited. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/designable/setters/README.md b/designable/setters/README.md deleted file mode 100644 index 84103eebdc5..00000000000 --- a/designable/setters/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# @formily/designable-antd - -### Install - -```bash -npm install --save @formily/designable-antd -``` diff --git a/designable/setters/copy.ts b/designable/setters/copy.ts deleted file mode 100644 index d451fc48651..00000000000 --- a/designable/setters/copy.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { runCopy } from '../../scripts/build-style' - -runCopy({ - esStr: 'antd/es/', - libStr: 'antd/lib/', -}) diff --git a/designable/setters/package.json b/designable/setters/package.json deleted file mode 100644 index efbc3ca3a0d..00000000000 --- a/designable/setters/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@formily/designable-setters", - "version": "2.0.0-rc.7", - "license": "MIT", - "main": "lib", - "module": "esm", - "umd:main": "dist/formily.designable.antd.umd.production.js", - "unpkg": "dist/formily.designable.umd.production.js", - "jsdelivr": "dist/formily.designable.umd.production.js", - "jsnext:main": "esm", - "repository": { - "type": "git", - "url": "git+https://github.com/alibaba/formily.git" - }, - "types": "esm/index.d.ts", - "bugs": { - "url": "https://github.com/alibaba/formily/issues" - }, - "homepage": "https://github.com/alibaba/formily#readme", - "engines": { - "npm": ">=3.0.0" - }, - "scripts": { - "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && npm run build:umd && ts-node copy", - "build:cjs": "tsc --project tsconfig.build.json", - "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm", - "build:umd": "rollup --config", - "start": "webpack-dev-server --config playground/webpack.dev.ts" - }, - "devDependencies": { - "antd": "^4.0.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 || >=17.0.0", - "@types/react-dom": ">=16.8.0 || >=17.0.0", - "antd": "^4.0.0", - "react": ">=16.8.0 || >=17.0.0", - "react-dom": ">=16.8.0", - "react-is": ">=16.8.0 || >=17.0.0" - }, - "dependencies": { - "@designable/core": "^0.x", - "@designable/formily": "^0.x", - "@designable/react": "^0.x", - "@designable/react-settings-form": "^0.x", - "@formily/antd": "2.0.0-rc.7", - "@formily/core": "2.0.0-rc.7", - "@formily/react": "2.0.0-rc.7", - "@formily/shared": "2.0.0-rc.7" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "2c44ae410a73f02735c63c6430e021a50e21f3ec" -} diff --git a/designable/setters/rollup.config.js b/designable/setters/rollup.config.js deleted file mode 100644 index 859c8d570c1..00000000000 --- a/designable/setters/rollup.config.js +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig, { - removeImportStyleFromInputFilePlugin, -} from '../../scripts/rollup.base.js' -import postcss from 'rollup-plugin-postcss' -import NpmImport from 'less-plugin-npm-import' - -export default baseConfig( - 'formily.designable.antd', - 'Formily.Designable.Antd', - removeImportStyleFromInputFilePlugin(), - postcss({ - extract: true, - minimize: true, - // extensions: ['.css', '.less', '.sass'], - use: { - less: { - plugins: [new NpmImport({ prefix: '~' })], - javascriptEnabled: true, - }, - sass: {}, - stylus: {}, - }, - }) -) diff --git a/designable/setters/src/components/DataSourceSetter/DataSettingPanel.tsx b/designable/setters/src/components/DataSourceSetter/DataSettingPanel.tsx deleted file mode 100644 index 3989b9f5d34..00000000000 --- a/designable/setters/src/components/DataSourceSetter/DataSettingPanel.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import React, { useMemo, Fragment } from 'react' -import { Button } from 'antd' -import { PlusOutlined } from '@ant-design/icons' -import { ArrayItems, Form, Input, FormItem } from '@formily/antd' -import { createForm } from '@formily/core' -import { observer } from '@formily/reactive-react' -import { createSchemaField } from '@formily/react' -import { ValueInput } from '@designable/react-settings-form' -import { usePrefix, TextWidget } from '@designable/react' -import { Header } from './Header' -import { traverseTree } from './shared' -import { ITreeDataSource } from './types' -import './styles.less' - -const SchemaField = createSchemaField({ - components: { - FormItem, - Input, - ArrayItems, - ValueInput, - }, -}) - -export interface IDataSettingPanelProps { - treeDataSource: ITreeDataSource -} - -export const DataSettingPanel: React.FC = observer( - (props) => { - const prefix = usePrefix('data-source-setter') - const form = useMemo(() => { - let values: any - traverseTree(props.treeDataSource.dataSource, (dataItem) => { - if (dataItem.key === props.treeDataSource.selectedKey) { - values = dataItem - } - }) - return createForm({ - values, - }) - }, [ - props.treeDataSource.selectedKey, - props.treeDataSource.dataSource.length, - ]) - if (!props.treeDataSource.selectedKey) - return ( - -
- } - extra={null} - /> -
- -
- - ) - return ( - -
- } - extra={ - - } - /> -
-
- - - - - } - x-decorator="FormItem" - name="label" - x-component="Input" - /> - - } - x-decorator="FormItem" - name="value" - x-component="ValueInput" - /> - - - - -
-
- - ) - } -) diff --git a/designable/setters/src/components/DataSourceSetter/Header.tsx b/designable/setters/src/components/DataSourceSetter/Header.tsx deleted file mode 100644 index 4e81abad2c6..00000000000 --- a/designable/setters/src/components/DataSourceSetter/Header.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React, { ReactNode } from 'react' -import { observer } from '@formily/reactive-react' -import { usePrefix } from '@designable/react' -import './styles.less' - -export interface IHeaderProps { - extra: ReactNode | null - title: ReactNode | string -} - -export const Header: React.FC = observer(({ extra, title }) => { - const prefix = usePrefix('data-source-setter') - return ( -
-
{title}
- {extra} -
- ) -}) diff --git a/designable/setters/src/components/DataSourceSetter/Title.tsx b/designable/setters/src/components/DataSourceSetter/Title.tsx deleted file mode 100644 index b1a5f306da6..00000000000 --- a/designable/setters/src/components/DataSourceSetter/Title.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import React from 'react' -import { clone, toArr } from '@formily/shared' -import { observer } from '@formily/reactive-react' -import { IconWidget, TextWidget, usePrefix } from '@designable/react' -import { INodeItem, ITreeDataSource } from './types' -import { traverseTree } from './shared' -import './styles.less' -export interface ITitleProps extends INodeItem { - treeDataSource: ITreeDataSource -} - -export const Title: React.FC = observer((props) => { - const prefix = usePrefix('data-source-setter-node-title') - const getTitleValue = (dataSource) => { - const optionalKeys = ['label', 'title', 'header'] - let nodeTitle: string - optionalKeys.some((key) => { - const title = toArr(dataSource).find((item) => item.label === key)?.value - if (title !== undefined) { - nodeTitle = title - return true - } - return false - }) - if (nodeTitle === undefined) { - toArr(dataSource || []).some((item) => { - if (item.value && typeof item.value === 'string') { - nodeTitle = item.value - return true - } - return false - }) - } - return nodeTitle - } - - const renderTitle = (dataSource) => { - const nodeTitle = getTitleValue(dataSource) - if (nodeTitle === undefined) - return ( - - ) - else return nodeTitle + '' - } - - return ( -
- - {renderTitle(props?.map || [])} - - { - const newDataSource = clone(props?.treeDataSource?.dataSource) - traverseTree(newDataSource || [], (dataItem, i, data) => { - if (data[i].key === props.duplicateKey) toArr(data).splice(i, 1) - }) - props.treeDataSource.dataSource = newDataSource - }} - /> -
- ) -}) diff --git a/designable/setters/src/components/DataSourceSetter/TreePanel.tsx b/designable/setters/src/components/DataSourceSetter/TreePanel.tsx deleted file mode 100644 index 3210fb0a4dd..00000000000 --- a/designable/setters/src/components/DataSourceSetter/TreePanel.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import React, { Fragment } from 'react' -import { Tree, Button, TreeProps } from 'antd' -import { uid } from '@formily/shared' -import { observer } from '@formily/reactive-react' -import { usePrefix, TextWidget, IconWidget } from '@designable/react' -import { Title } from './Title' -import { Header } from './Header' -import { traverseTree } from './shared' -import { ITreeDataSource, INodeItem } from './types' -import './styles.less' -import { GlobalRegistry } from '@designable/core' - -export interface ITreePanelProps { - treeDataSource: ITreeDataSource -} - -export const TreePanel: React.FC = observer((props) => { - const prefix = usePrefix('data-source-setter') - const dropHandler = (info: Parameters[0]) => { - const dropKey = info.node?.key - const dragKey = info.dragNode?.key - const dropPos = info.node.pos.split('-') - const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]) - const data = [...props.treeDataSource.dataSource] - // Find dragObject - let dragObj: INodeItem - traverseTree(data, (item, index, arr) => { - if (arr[index].key === dragKey) { - arr.splice(index, 1) - dragObj = item - } - }) - if (!info.dropToGap) { - traverseTree(data, (item) => { - if (item.key === dropKey) { - item.children = item.children || [] - item.children.unshift(dragObj) - } - }) - } else if ( - (info.node.children || []).length > 0 && - info.node.expanded && - dropPosition === 1 - ) { - traverseTree(data, (item) => { - if (item.key === dropKey) { - item.children = item.children || [] - item.children.unshift(dragObj) - } - }) - } else { - let ar: any[] - let i: number - traverseTree(data, (item, index, arr) => { - if (item.key === dropKey) { - ar = arr - i = index - } - }) - if (dropPosition === -1) { - ar.splice(i, 0, dragObj) - } else { - ar.splice(i + 1, 0, dragObj) - } - } - props.treeDataSource.dataSource = data - } - return ( - -
- } - extra={ - - } - /> -
- {}} - onDrop={dropHandler} - titleRender={(titleProps: INodeItem) => { - return ( - - ) - }} - onSelect={(selectedKeys) => { - if (selectedKeys[0]) { - props.treeDataSource.selectedKey = selectedKeys[0].toString() - } - }} - > -
- - ) -}) diff --git a/designable/setters/src/components/DataSourceSetter/index.tsx b/designable/setters/src/components/DataSourceSetter/index.tsx deleted file mode 100644 index 9d8ef8606ac..00000000000 --- a/designable/setters/src/components/DataSourceSetter/index.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React, { Fragment, useMemo, useState } from 'react' -import cls from 'classnames' -import { Modal, Button } from 'antd' -import { observable } from '@formily/reactive' -import { observer } from '@formily/reactive-react' -import { usePrefix, useTheme, TextWidget } from '@designable/react' -import { DataSettingPanel } from './DataSettingPanel' -import { TreePanel } from './TreePanel' -import { transformDataToValue, transformValueToData } from './shared' -import { IDataSourceItem, ITreeDataSource } from './types' -import './styles.less' - -export interface IDataSourceSetterProps { - className?: string - style?: React.CSSProperties - onChange: (dataSource: IDataSourceItem[]) => void - value: IDataSourceItem[] -} -export const DataSourceSetter: React.FC = observer( - (props) => { - const { className, value = [], onChange } = props - const theme = useTheme() - const prefix = usePrefix('data-source-setter') - const [modalVisible, setModalVisible] = useState(false) - const treeDataSource: ITreeDataSource = useMemo( - () => - observable({ - dataSource: transformValueToData(value), - selectedKey: '', - }), - [value, modalVisible] - ) - const openModal = () => setModalVisible(true) - const closeModal = () => setModalVisible(false) - return ( - - - - } - width="65%" - bodyStyle={{ padding: 10 }} - transitionName="" - maskTransitionName="" - visible={modalVisible} - onCancel={closeModal} - onOk={() => { - onChange(transformDataToValue(treeDataSource.dataSource)) - closeModal() - }} - > -
-
- -
-
- -
-
-
-
- ) - } -) diff --git a/designable/setters/src/components/DataSourceSetter/shared.ts b/designable/setters/src/components/DataSourceSetter/shared.ts deleted file mode 100644 index 072c6c70f83..00000000000 --- a/designable/setters/src/components/DataSourceSetter/shared.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { uid, clone, toArr } from '@formily/shared' -import { IDataSourceItem, INodeItem } from './types' - -export interface INode { - key?: string - map?: any - children?: INode[] -} - -export const traverseTree = ( - data: T[], - callback: (dataItem: T, i: number, data: T[]) => any -) => { - for (let i = 0; i < data.length; i++) { - callback(data[i], i, data) - if (data[i]?.children) { - traverseTree(data[i]?.children, callback) - } - } -} - -export const transformValueToData = (value: IDataSourceItem[]): INodeItem[] => { - const data = clone(value) - traverseTree(data, (item, i, dataSource) => { - const dataItem = { - key: '', - duplicateKey: '', - map: [], - children: [], - } - for (const [key, value] of Object.entries(dataSource[i] || {})) { - if (key !== 'children') dataItem.map.push({ label: key, value: value }) - } - const uuid = uid() - dataItem.key = uuid - dataItem.duplicateKey = uuid - dataItem.children = dataSource[i].children || [] - dataSource[i] = dataItem - }) - return data -} - -export const transformDataToValue = (data: INodeItem[]): IDataSourceItem[] => { - const value = clone(data) - traverseTree(value, (item, i, dataSource) => { - let valueItem: IDataSourceItem = { - children: [], - } - toArr(dataSource[i].map).forEach((item) => { - if (item.label) valueItem[item.label] = item.value - }) - valueItem.children = dataSource[i]?.children || [] - dataSource[i] = valueItem - }) - return value -} diff --git a/designable/setters/src/components/DataSourceSetter/styles.less b/designable/setters/src/components/DataSourceSetter/styles.less deleted file mode 100644 index f2561f2726e..00000000000 --- a/designable/setters/src/components/DataSourceSetter/styles.less +++ /dev/null @@ -1,81 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-data-source-setter { - ::-webkit-scrollbar { - width: 5px; - height: 5px; - } - - ::-webkit-scrollbar-thumb { - background-color: rgba(0, 0, 0, 0.2); - border-radius: 0; - transition: all 0.25s ease-in-out; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(0, 0, 0, 0.3); - } - &-node-title { - display: flex; - justify-content: space-between; - align-items: center; - - &-icon { - transition: all 0.15s ease-in-out; - opacity: 0; - - &:hover { - color: @primary-color; - } - } - } - - &-layout { - display: flex; - justify-content: space-around; - border: 1px solid @border-color-split; - border-radius: 3px; - - .ant-tree-treenode { - padding-right: 10px; - white-space: nowrap; - - &:hover { - .dn-data-source-setter-node-title-icon { - opacity: 1; - } - } - } - - &-item { - position: relative; - - &.left { - width: 40%; - border-right: 1px solid @border-color-split; - } - - &.right { - width: 60%; - } - - &-header { - display: flex; - flex: none; - align-items: center; - justify-content: space-between; - height: 40px; - padding: 8px 12px 9px; - border-bottom: 1px solid @border-color-split; - border-radius: 2px 2px 0 0; - } - - &-content { - padding: 2%; - height: 300px; - max-height: 300px; - overflow: scroll; - } - } - } -} diff --git a/designable/setters/src/components/DataSourceSetter/types.ts b/designable/setters/src/components/DataSourceSetter/types.ts deleted file mode 100644 index ffffd0e65b9..00000000000 --- a/designable/setters/src/components/DataSourceSetter/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface IDataSourceItem { - label?: '' - value?: any - children?: any[] -} - -export interface INodeItem { - key: string - duplicateKey?: string - map?: { label: string; value: any }[] - children?: INodeItem[] -} - -export interface ITreeDataSource { - dataSource: INodeItem[] - selectedKey: string -} diff --git a/designable/setters/src/components/ReactionsSetter/FieldPropertySetter.tsx b/designable/setters/src/components/ReactionsSetter/FieldPropertySetter.tsx deleted file mode 100644 index eb09e255880..00000000000 --- a/designable/setters/src/components/ReactionsSetter/FieldPropertySetter.tsx +++ /dev/null @@ -1,136 +0,0 @@ -import React, { useState } from 'react' -import { TextWidget, usePrefix } from '@designable/react' -import { Menu } from 'antd' -import { MonacoInput } from '@designable/react-settings-form' -import { isPlainObj, reduce } from '@formily/shared' -import { FieldProperties } from './properties' -export interface IFieldProperty { - [key: string]: string -} - -export interface IFieldPropertySetterProps { - extraLib?: string - value?: IFieldProperty - onChange?: (value: IFieldProperty) => void -} - -const template = (code: string) => { - if (!code) return - return code.trim() -} - -export const FieldPropertySetter: React.FC = ( - props -) => { - const [selectKeys, setSelectKeys] = useState(['visible']) - const prefix = usePrefix('field-property-setter') - const value = { ...props.value } - - const parseExpression = (expression: string) => { - if (!expression) return '' - return String(expression).match(/^\{\{([\s\S]*)\}\}$/)?.[1] || '' - } - - const filterEmpty = (value: object) => { - return reduce( - value, - (buf, value, key) => { - if (!value || value === '{{}}') return buf - buf[key] = value - return buf - }, - {} - ) - } - - const currentProperty = FieldProperties.find( - (item) => item.key === selectKeys[0] - ) - - return ( -
- { - setSelectKeys(selectedKeys) - }} - > - {FieldProperties.map((key) => { - if (isPlainObj(key)) { - return ( - - - - ) - } - return ( - - - - ) - })} - -
-
- {`$self.${selectKeys[0]} = (`} - - {'//'}{' '} - {' '} - {'`'} - {currentProperty?.type} - {'`'} - -
-
- { - props.onChange?.( - filterEmpty({ - ...value, - [selectKeys[0]]: `{{${expression}}}`, - }) - ) - }} - /> -
-
{`)`}
-
-
- ) -} diff --git a/designable/setters/src/components/ReactionsSetter/PathSelector.tsx b/designable/setters/src/components/ReactionsSetter/PathSelector.tsx deleted file mode 100644 index b96d326aed6..00000000000 --- a/designable/setters/src/components/ReactionsSetter/PathSelector.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import React from 'react' -import { TreeNode } from '@designable/core' -import { useCurrentNode } from '@designable/react' -import { TreeSelectProps, TreeSelect } from 'antd' - -export interface IPathSelectorProps - extends Omit, 'onChange'> { - value?: string - onChange?: (value: string, node: TreeNode) => void - style?: React.CSSProperties - className?: string -} - -const transformDataSource = (node: TreeNode) => { - const currentNode = node - const dots = (count: number) => { - let dots = '' - for (let i = 0; i < count; i++) { - dots += '.' - } - return dots - } - const targetPath = (parentNode: TreeNode, targetNode: TreeNode) => { - const path = [] - const transform = (node: TreeNode) => { - if (node && node !== parentNode) { - path.push(node.props.name || node.id) - } else { - transform(node.parent) - } - } - transform(targetNode) - return path.reverse().join('.') - } - const hasNoVoidChildren = (node: TreeNode) => { - return node.children?.some((node) => { - if (node.props.type !== 'void' && node !== currentNode) return true - return hasNoVoidChildren(node) - }) - } - const findRoot = (node: TreeNode): TreeNode => { - if (!node?.parent) return node - if (node?.parent?.componentName !== node.componentName) return node.parent - return findRoot(node.parent) - } - const findArrayParent = (node: TreeNode) => { - if (!node?.parent) return - if (node.parent.props.type === 'array') return node.parent - if (node.parent === root) return - return findArrayParent(node.parent) - } - const transformRelativePath = (arrayNode: TreeNode, targetNode: TreeNode) => { - if (targetNode.depth === currentNode.depth) - return `.${targetNode.props.name || targetNode.id}` - return `${dots(currentNode.depth - arrayNode.depth)}[].${targetPath( - arrayNode, - targetNode - )}` - } - const transformChildren = (children: TreeNode[], path = []) => { - return children.reduce((buf, node) => { - if (node === currentNode) return buf - if (node.props.type === 'array' && !node.contains(currentNode)) return buf - if (node.props.type === 'void' && !hasNoVoidChildren(node)) return buf - const currentPath = path.concat(node.props.name || node.id) - const arrayNode = findArrayParent(node) - const label = - node.props.title || - node.props['x-component-props']?.title || - node.props.name || - node.designerProps.title - const value = arrayNode - ? transformRelativePath(arrayNode, node) - : currentPath.join('.') - return buf.concat({ - label, - value, - node, - children: transformChildren(node.children, currentPath), - }) - }, []) - } - const root = findRoot(node) - if (root) { - return transformChildren(root.children) - } - return [] -} - -export const PathSelector: React.FC = (props) => { - const baseNode = useCurrentNode() - const dataSource = transformDataSource(baseNode) - const findNode = (dataSource: any[], value: string) => { - for (let i = 0; i < dataSource.length; i++) { - const item = dataSource[i] - if (item.value === value) return item.node - if (item.children?.length) { - const fondedChild = findNode(item.children, value) - if (fondedChild) return fondedChild - } - } - } - return ( - { - props.onChange(value, findNode(dataSource, value)) - }} - treeDefaultExpandAll - treeData={dataSource} - /> - ) -} diff --git a/designable/setters/src/components/ReactionsSetter/declarations.ts b/designable/setters/src/components/ReactionsSetter/declarations.ts deleted file mode 100644 index 80fedfaa790..00000000000 --- a/designable/setters/src/components/ReactionsSetter/declarations.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { MonacoInput } from '@designable/react-settings-form' - -export interface IDependency { - name: string - path: string -} - -const loadDependencies = async (deps: IDependency[]) => { - return Promise.all( - deps.map(async ({ name, path }) => ({ - name, - path, - library: await fetch(`//cdn.jsdelivr.net/npm/${name}/${path}`).then( - (res) => res.text() - ), - })) - ) -} - -MonacoInput.loader.init().then(async (monaco) => { - const deps = await loadDependencies([ - { name: '@formily/core', path: 'dist/formily.core.all.d.ts' }, - ]) - deps?.forEach(({ name, library }) => { - monaco.languages.typescript.typescriptDefaults.addExtraLib( - `declare module '${name}'{ ${library} }`, - `file:///node_modules/${name}/index.d.ts` - ) - }) - monaco.languages.typescript.typescriptDefaults.addExtraLib( - ` - import { Form, Field } from '@formily/core' - declare global { - /* - * Form Model - **/ - declare var $form: Form - /* - * Field Model - **/ - declare var $self: Field - /* - * create an persistent observable state object - **/ - declare var $observable: (target: T, deps?: any[]) => T - /* - * create a persistent data - **/ - declare var $memo: (callback: () => T, deps?: any[]) => T - /* - * handle side-effect logic - **/ - declare var $effect: (callback: () => void | (() => void), deps?: any[]) => void - /* - * set initial component props to current field - **/ - declare var $props: (props: any) => void - } - `, - `file:///node_modules/formily_global.d.ts` - ) -}) diff --git a/designable/setters/src/components/ReactionsSetter/helpers.ts b/designable/setters/src/components/ReactionsSetter/helpers.ts deleted file mode 100644 index 0b28735bebc..00000000000 --- a/designable/setters/src/components/ReactionsSetter/helpers.ts +++ /dev/null @@ -1,393 +0,0 @@ -export const GlobalHelper = ` -/** - * You can use the built-in context variables - * - * 1. \`$self\` is the current Field Model - * - * 2. \`$form\` is the current Form Model - * - * 3. \`$deps\` is the dependencies value - * - * 4. \`$observable\` function is used to create an persistent observable state object - * - * 5. \`$memo\` function is is used to create a persistent data - * - * 6. \`$effect\` function is used to handle side-effect logic - * - * 7. \`$props\` function is used to set component props to current field - * - * Document Links - * - * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F - **/ -` - -export const BooleanHelper = ` -/** - * Example 1 - * Static Boolean - **/ - -false - -/** - * Example 2 - * Equal Calculation - **/ - -$deps.VariableName === 'TARGET_VALUE' - -/** - * Example 3 - * Not Equal Calculation - **/ - -$deps.VariableName !== 'TARGET_VALUE' - -/** - * Example 4 - * And Logic Calculation - **/ - -$deps.VariableName1 && $deps.VariableName2 - -/** - * Example 5 - * Grater Logic Calculation - **/ - -$deps.VariableName > 100 - -/** - * Example 6 - * Not Logic Calculation - **/ - -!$deps.VariableName - -${GlobalHelper} -` - -export const DisplayHelper = ` -/** - * Example 1 - * Static Mode - **/ - -'none' - -/** - * Example 2 - * Equal Condition Associated - **/ - -$deps.VariableName === 'TARGET_VALUE' ? 'visible' : 'none' - -/** - * Example 3 - * Not Equal Condition Associated - **/ - -$deps.VariableName !== 'TARGET_VALUE' ? 'visible' : 'hidden' - -/** - * Example 4 - * And Logic Condition Associated - **/ - -$deps.VariableName1 && $deps.VariableName2 ? 'visible' : 'none' - -/** - * Example 5 - * Grater Logic Condition Associated - **/ - -$deps.VariableName > 100 ? 'visible' : 'hidden' - -/** - * Example 6 - * Not Logic Condition Associated - **/ - -!$deps.VariableName ? 'visible' : 'none' - -${GlobalHelper} -` - -export const PatternHelper = ` -/** - * Example 1 - * Static Mode - **/ - -'readPretty' - -/** - * Example 2 - * Equal Condition Associated - **/ - -$deps.VariableName === 'TARGET_VALUE' ? 'editable' : 'disabled' - -/** - * Example 3 - * Not Equal Condition Associated - **/ - -$deps.VariableName !== 'TARGET_VALUE' ? 'editable' : 'readOnly' - -/** - * Example 4 - * And Logic Condition Associated - **/ - -$deps.VariableName1 && $deps.VariableName2 ? 'editable' : 'readPretty' - -/** - * Example 5 - * Grater Logic Condition Associated - **/ - -$deps.VariableName > 100 ? 'editable' : 'readOnly' - -/** - * Example 6 - * Not Logic Condition Associated - **/ - -!$deps.VariableName ? 'editable' : 'disabled' - -${GlobalHelper} -` - -export const StringHelper = ` -/** - * Example 1 - * Static String - **/ - -'Normal String Text' - -/** - * Example 2 - * Associated String - **/ - -$deps.VariableName === 'TARGET_VALUE' ? 'Associated String Text' : '' - -${GlobalHelper} -` - -export const AnyHelper = ` -/** - * Example 1 - * String Type - **/ - -'String' - -/** - * Example 2 - * String Array - **/ - -['StringArray'] - -/** - * Example 3 - * Object Array - **/ - -[{ key: 'ObjectArray' }] - -/** - * Example 4 - * Boolean - **/ - -true - -/** - * Example 5 - * RegExp - **/ - -/\d+/ - -/** - * Example 1 - * Associated String Value - **/ - -$deps.VariableName + 'Compose String' - -/** - * Example 2 - * Associated Array Value - **/ - -[ $deps.VariableName ] - -/** - * Example 3 - * Associated Object Value - **/ - -{ - key : $deps.VariableName -} - -/** - * Example 4 - * Associated Boolean Value - **/ - -!$deps.VariableName - -${GlobalHelper} -` - -export const DataSourceHelper = ` -/** - * Example 1 - * Static DataSource - **/ - -[ - { label : "item1", value: "1" }, - { label : "item2", value: "2" } -] - -/** - * Example 2 - * Associated DataSource - **/ - -[ - { label : "item1", value: "1" }, - { label : "item2", value: "2" }, - ...$deps.VariableName -] - -${GlobalHelper} -` - -export const ComponentPropsHelper = ` -/** - * Example 1 - * Static Props - **/ - -{ - placeholder: "This is placeholder" -} - -/** - * Example 2 - * Associated Props - **/ - -{ - placeholder: $deps.VariableName -} - -${GlobalHelper} -` - -export const DecoratorPropsHelper = ` -/** - * Example 1 - * Static Props - **/ - -{ - labelCol:6 -} - -/** - * Example 2 - * Associated Props - **/ - -{ - labelCol: $deps.VariableName -} - -${GlobalHelper} -` - -export const FulfillRunHelper = ` -/** - * Example 1 - * Async Select - **/ - -$effect(()=>{ - $self.loading = true - fetch('//some.domain/getSomething') - .then(response=>response.json()) - .then(({ data })=>{ - $self.loading = false - $self.dataSource = data - },()=>{ - $self.loading = false - }) -},[]) - - -/** - * Example 2 - * Async Search Select - **/ - -const state = $observable({ - keyword:'' -}) - -$props({ - onSearch(keyword){ - state.keyword = keyword - } -}) - -$effect(()=>{ - $self.loading = true - fetch(\`//some.domain/getSomething?q=\${state.keyword}\`) - .then(response=>response.json()) - .then(({ data })=>{ - $self.loading = false - $self.dataSource = data - },()=>{ - $self.loading = false - }) -},[ state.keyword ]) - -/** - * Example 3 - * Async Associated Select - **/ - -const state = $observable({ - keyword:'' -}) - -$props({ - onSearch(keyword){ - state.keyword = keyword - } -}) - -$effect(()=>{ - $self.loading = true - fetch(\`//some.domain/getSomething?q=\${state.keyword}&other=\${$deps.VariableName}\`) - .then(response=>response.json()) - .then(({ data })=>{ - $self.loading = false - $self.dataSource = data - },()=>{ - $self.loading = false - }) -},[ state.keyword, $deps.VariableName ]) - -${GlobalHelper} -` diff --git a/designable/setters/src/components/ReactionsSetter/index.tsx b/designable/setters/src/components/ReactionsSetter/index.tsx deleted file mode 100644 index 19707f88a42..00000000000 --- a/designable/setters/src/components/ReactionsSetter/index.tsx +++ /dev/null @@ -1,435 +0,0 @@ -import React, { useEffect, useMemo, useState } from 'react' -import { clone, uid } from '@formily/shared' -import { createForm, isVoidField } from '@formily/core' -import { createSchemaField } from '@formily/react' -import { GlobalRegistry } from '@designable/core' -import { requestIdle } from '@designable/shared' -import { usePrefix, TextWidget } from '@designable/react' -import { MonacoInput } from '@designable/react-settings-form' -import { - Form, - ArrayTable, - Input, - Select, - FormItem, - FormCollapse, -} from '@formily/antd' -import { Modal, Card, Button, Tag, Tooltip } from 'antd' -import { PathSelector } from './PathSelector' -import { FieldPropertySetter } from './FieldPropertySetter' -import { FulfillRunHelper } from './helpers' -import { IReaction } from './types' -import './declarations' -import './styles.less' - -export interface IReactionsSetterProps { - value?: IReaction - onChange?: (value: IReaction) => void -} - -const TypeView = ({ value }) => { - const text = String(value) - if (text.length <= 26) return {text} - return ( - - - -
-                {text}
-              
-
- - } - > - {text.substring(0, 24)}... -
-
- ) -} - -const SchemaField = createSchemaField({ - components: { - Card, - FormCollapse, - Input, - TypeView, - Select, - FormItem, - PathSelector, - FieldPropertySetter, - ArrayTable, - MonacoInput, - }, -}) - -const FieldStateProperties = [ - 'value', - 'initialValue', - 'inputValue', - 'inputValues', - 'modified', - 'initialized', - 'title', - 'description', - 'mounted', - 'unmounted', - 'active', - 'visited', - 'loading', - 'errors', - 'warnings', - 'successes', - 'feedbacks', - 'valid', - 'invalid', - 'pattern', - 'display', - 'disabled', - 'readOnly', - 'readPretty', - 'visible', - 'hidden', - 'editable', - 'validateStatus', - 'validating', -] - -const FieldStateValueTypes = { - modified: 'boolean', - initialized: 'boolean', - title: 'string', - description: 'string', - mounted: 'boolean', - unmounted: 'boolean', - active: 'boolean', - visited: 'boolean', - loading: 'boolean', - errors: 'string[]', - warnings: 'string[]', - successes: 'string[]', - feedbacks: `Array< - triggerType?: 'onInput' | 'onFocus' | 'onBlur' - type?: 'error' | 'success' | 'warning' - code?: - | 'ValidateError' - | 'ValidateSuccess' - | 'ValidateWarning' - | 'EffectError' - | 'EffectSuccess' - | 'EffectWarning' - messages?: string[] -> -`, - valid: 'boolean', - invalid: 'boolean', - pattern: "'editable' | 'disabled' | 'readOnly' | 'readPretty'", - display: "'visible' | 'hidden' | 'none'", - disabled: 'boolean', - readOnly: 'boolean', - readPretty: 'boolean', - visible: 'boolean', - hidden: 'boolean', - editable: 'boolean', - validateStatus: "'error' | 'warning' | 'success' | 'validating'", - validating: 'boolean', -} - -export const ReactionsSetter: React.FC = (props) => { - const [modalVisible, setModalVisible] = useState(false) - const [innerVisible, setInnerVisible] = useState(false) - const prefix = usePrefix('reactions-setter') - const form = useMemo(() => { - return createForm({ - values: clone(props.value), - }) - }, [modalVisible, props.value]) - const formCollapse = useMemo( - () => FormCollapse.createFormCollapse(['deps', 'state']), - [modalVisible] - ) - const openModal = () => setModalVisible(true) - const closeModal = () => setModalVisible(false) - useEffect(() => { - if (modalVisible) { - requestIdle( - () => { - setInnerVisible(true) - }, - { - timeout: 400, - } - ) - } else { - setInnerVisible(false) - } - }, [modalVisible]) - return ( - <> - - { - form.submit((values) => { - props.onChange?.(values) - }) - closeModal() - }} - > -
- {innerVisible && ( -
- - - - - - - - - - - - - { - if (isVoidField(field)) return - field.query('.source').take((source) => { - if (isVoidField(source)) return - if ( - source.value && - !field.value && - !field.modified - ) { - field.value = - source.inputValues[1]?.props?.name || - `v_${uid()}` - } - }) - }} - /> - - - - { - if (isVoidField(field)) return - const property = field - .query('.property') - .get('inputValues') - field.query('.source').take((source) => { - if (isVoidField(source)) return - if (source.value) { - if ( - property[0] === 'value' || - property[0] === 'initialValue' || - property[0] === 'inputValue' - ) { - field.value = - source.inputValues[1]?.props?.type || - 'any' - } else if (property[0] === 'inputValues') { - field.value = `any[]` - } else if (property[0]) { - field.value = - FieldStateValueTypes[property[0]] - } else { - field.value = 'any' - } - } - }) - }} - /> - - - - - - - - - - - - - - { - const deps = field.query('dependencies').value() - if (Array.isArray(deps)) { - field.componentProps.extraLib = ` - declare var $deps : { - ${deps.map(({ name, type }) => { - if (!name) return '' - return `${name}?:${type || 'any'},` - })} - } - ` - } - }} - /> - - - -
- )} -
-
- - ) -} diff --git a/designable/setters/src/components/ReactionsSetter/properties.ts b/designable/setters/src/components/ReactionsSetter/properties.ts deleted file mode 100644 index 25c2dffce91..00000000000 --- a/designable/setters/src/components/ReactionsSetter/properties.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - BooleanHelper, - PatternHelper, - StringHelper, - AnyHelper, - DataSourceHelper, - DecoratorPropsHelper, - DisplayHelper, - ComponentPropsHelper, -} from './helpers' - -export const FieldProperties = [ - { - key: 'visible', - type: 'boolean', - helpCode: BooleanHelper, - }, - { key: 'hidden', type: 'boolean', helpCode: BooleanHelper }, - { - key: 'display', - type: '"visible" | "hidden" | "none"', - helpCode: DisplayHelper, - }, - { - key: 'pattern', - type: '"editable" | "disabled" | "readOnly" | "readPretty"', - helpCode: PatternHelper, - }, - { key: 'title', type: 'string', helpCode: StringHelper }, - { key: 'description', type: 'string', helpCode: StringHelper }, - { key: 'value', type: 'any', helpCode: AnyHelper }, - { key: 'initialValue', type: 'any', helpCode: AnyHelper }, - { key: 'required', type: 'boolean', helpCode: BooleanHelper }, - { - key: 'dataSource', - type: 'Array<{label?:string,value?:any}>', - helpCode: DataSourceHelper, - }, - { - key: 'component[1]', - token: 'componentProps', - type: 'object', - helpCode: ComponentPropsHelper, - }, - { - key: 'decorator[1]', - token: 'decoratorProps', - type: 'object', - helpCode: DecoratorPropsHelper, - }, -] diff --git a/designable/setters/src/components/ReactionsSetter/styles.less b/designable/setters/src/components/ReactionsSetter/styles.less deleted file mode 100644 index 45a223967b7..00000000000 --- a/designable/setters/src/components/ReactionsSetter/styles.less +++ /dev/null @@ -1,105 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.dn-reactions-setter { - width: 100%; - min-height: 623px; - overflow: hidden; - - ::-webkit-scrollbar { - width: 5px; - height: 5px; - } - - ::-webkit-scrollbar-thumb { - background-color: rgba(0, 0, 0, 0.2); - border-radius: 0; - transition: all 0.25s ease-in-out; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(0, 0, 0, 0.3); - } - - .@{ant-prefix}-collapse { - border: 1px solid @border-color-split; - - &-header { - padding: 8px 10px !important; - background-color: @background-color-light !important; - border-bottom: 1px solid @border-color-split !important; - font-weight: 500 !important; - - .@{ant-prefix}-collapse-arrow { - margin-right: 4px !important; - } - } - - &-item { - border: none !important; - } - - &-content { - border: none !important; - transition: none !important; - } - - &-content-box { - padding: 12px !important; - } - } - - .reaction-runner { - .@{ant-prefix}-collapse-content-box { - padding: 12px 0 !important; - } - } - - .reaction-state { - .@{ant-prefix}-collapse-content-box { - padding: 12px 0 !important; - } - } - - .dn-field-property-setter { - display: flex; - height: 300px; - - &-coder-wrapper { - display: flex; - flex-grow: 2; - height: 100%; - padding-left: 10px; - position: relative; - flex-direction: column; - } - - &-coder-start { - font-size: 18px; - line-height: 30px; - margin-bottom: 4px; - color: @text-color; - font-weight: 300; - flex-grow: 0; - opacity: 0.96; - height: 31px; - } - - &-coder-end { - font-size: 18px; - height: 31px; - color: @text-color; - margin-top: 4px; - margin-bottom: 4px; - line-height: 30px; - font-weight: 300; - flex-grow: 0; - opacity: 0.96; - } - - &-coder { - min-width: 0; - flex-grow: 2; - padding-left: 10px; - } - } -} diff --git a/designable/setters/src/components/ReactionsSetter/types.ts b/designable/setters/src/components/ReactionsSetter/types.ts deleted file mode 100644 index ad84a650ed3..00000000000 --- a/designable/setters/src/components/ReactionsSetter/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface IReaction { - dependencies?: { - [key: string]: string - } - fulfill?: { - state?: { - [key: string]: string - } - schema?: { - [key: string]: string - } - } -} diff --git a/designable/setters/src/components/ValidatorSetter/index.tsx b/designable/setters/src/components/ValidatorSetter/index.tsx deleted file mode 100644 index ff02955c452..00000000000 --- a/designable/setters/src/components/ValidatorSetter/index.tsx +++ /dev/null @@ -1,172 +0,0 @@ -import React from 'react' -import { ArrayField } from '@formily/core' -import { - observer, - useField, - SchemaContext, - Schema, - ISchema, -} from '@formily/react' -import { GlobalRegistry } from '@designable/core' -import { ArrayItems } from '@formily/antd' -import { FoldItem } from '@designable/react-settings-form' -import { Select } from 'antd' - -export interface IValidatorSetterProps { - value?: any - onChange?: (value: any) => void -} - -const ValidatorSchema: ISchema = { - type: 'array', - items: { - type: 'object', - 'x-decorator': 'ArrayItems.Item', - 'x-decorator-props': { - style: { - alignItems: 'center', - borderRadius: 3, - paddingTop: 6, - paddingBottom: 6, - }, - }, - properties: { - sortable: { - type: 'void', - 'x-component': 'ArrayItems.SortHandle', - 'x-component-props': { style: { marginRight: 10 } }, - }, - drawer: { - type: 'void', - 'x-component': 'DrawerSetter', - properties: { - triggerType: { - type: 'string', - enum: ['onInput', 'onFocus', 'onBlur'], - 'x-decorator': 'FormItem', - 'x-component': 'Select', - }, - validator: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'ValueInput', - 'x-component-props': { - include: ['EXPRESSION'], - }, - }, - message: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input.TextArea', - }, - format: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Select', - 'x-component-props': { - allowClear: true, - }, - }, - pattern: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'Input', - 'x-component-props': { - prefix: '/', - suffix: '/', - }, - }, - len: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - max: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - min: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - exclusiveMaximum: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - exclusiveMinimum: { - type: 'string', - 'x-decorator': 'FormItem', - 'x-component': 'NumberPicker', - }, - whitespace: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - required: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Switch', - }, - }, - }, - moveDown: { - type: 'void', - 'x-component': 'ArrayItems.MoveDown', - 'x-component-props': { style: { marginLeft: 10 } }, - }, - moveUp: { - type: 'void', - 'x-component': 'ArrayItems.MoveUp', - 'x-component-props': { style: { marginLeft: 5 } }, - }, - remove: { - type: 'void', - 'x-component': 'ArrayItems.Remove', - 'x-component-props': { style: { marginLeft: 5 } }, - }, - }, - }, - properties: { - addValidatorRules: { - type: 'void', - 'x-component': 'ArrayItems.Addition', - 'x-component-props': { - style: { - marginBottom: 10, - }, - }, - }, - }, -} - -export const ValidatorSetter: React.FC = observer( - (props) => { - const field = useField() - return ( - - -