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)}${printTag(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
-}
-
-`
-}
-
-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 (
-
- {props.children}
- |
- )
- },
- },
- body: {
- cell: (props: any) => {
- return (
-
- {props.children}
- |
- )
- },
- },
- }}
- >
- {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.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