diff --git a/designer-demo/package.json b/designer-demo/package.json
index 69a54f99e..ee717a529 100644
--- a/designer-demo/package.json
+++ b/designer-demo/package.json
@@ -11,7 +11,8 @@
"vue": "^3.4.21",
"@opentiny/tiny-engine": "workspace:^",
"@opentiny/tiny-engine-entry": "workspace:^",
- "@opentiny/tiny-engine-canvas": "workspace:^"
+ "@opentiny/tiny-engine-canvas": "workspace:^",
+ "@opentiny/tiny-engine-configurator": "workspace:*"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
diff --git a/designer-demo/src/MyInputConfigurator.vue b/designer-demo/src/MyInputConfigurator.vue
new file mode 100644
index 000000000..47a9b11e5
--- /dev/null
+++ b/designer-demo/src/MyInputConfigurator.vue
@@ -0,0 +1,63 @@
+
+ 我是自定义的 input configurator
+
+
+
+
+
+
+
diff --git a/designer-demo/src/configurators.js b/designer-demo/src/configurators.js
new file mode 100644
index 000000000..3f76596d7
--- /dev/null
+++ b/designer-demo/src/configurators.js
@@ -0,0 +1,11 @@
+import { InputConfigurator, SelectConfigurator } from '@opentiny/tiny-engine-configurator'
+import MyInputConfigurator from './MyInputConfigurator.vue'
+
+export const configurators = [
+ {
+ name: 'MyInputConfigurator',
+ component: MyInputConfigurator
+ },
+ InputConfigurator,
+ SelectConfigurator
+]
diff --git a/designer-demo/src/main.js b/designer-demo/src/main.js
index f94c13b04..01e6d4f16 100644
--- a/designer-demo/src/main.js
+++ b/designer-demo/src/main.js
@@ -13,5 +13,6 @@
// 导入@opentiny/tiny-engine时,内部的依赖包也会逐个导入,可能会执行useComplie,此时需要templateHashMap。所以需要先执行一次defineEntry
import { registry } from './defineEntry.js'
import { init } from '@opentiny/tiny-engine'
+import { configurators } from './configurators.js'
-init({ registry })
+init({ registry, configurators })
diff --git a/packages/builtinComponent/src/meta/CanvasCol.json b/packages/builtinComponent/src/meta/CanvasCol.json
index 33c68b5df..540bdb901 100644
--- a/packages/builtinComponent/src/meta/CanvasCol.json
+++ b/packages/builtinComponent/src/meta/CanvasCol.json
@@ -56,7 +56,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -72,7 +72,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -88,7 +88,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -104,7 +104,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{ "value": "flex-start", "label": "头部对齐" },
@@ -128,7 +128,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{ "value": "flex-start", "label": "头部对齐" },
diff --git a/packages/builtinComponent/src/meta/CanvasRow.json b/packages/builtinComponent/src/meta/CanvasRow.json
index 5033b30ba..0ee26acbf 100644
--- a/packages/builtinComponent/src/meta/CanvasRow.json
+++ b/packages/builtinComponent/src/meta/CanvasRow.json
@@ -34,7 +34,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -50,7 +50,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -66,7 +66,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -82,7 +82,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{ "value": "flex-start", "label": "头部对齐" },
@@ -106,7 +106,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{ "value": "flex-start", "label": "头部对齐" },
diff --git a/packages/builtinComponent/src/meta/CanvasRowColContainer.json b/packages/builtinComponent/src/meta/CanvasRowColContainer.json
index e363530f6..5ee884cdf 100644
--- a/packages/builtinComponent/src/meta/CanvasRowColContainer.json
+++ b/packages/builtinComponent/src/meta/CanvasRowColContainer.json
@@ -34,7 +34,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
}
diff --git a/packages/canvas/src/components/builtin/builtin.json b/packages/canvas/src/components/builtin/builtin.json
index 79c678294..560a90016 100644
--- a/packages/canvas/src/components/builtin/builtin.json
+++ b/packages/canvas/src/components/builtin/builtin.json
@@ -94,7 +94,7 @@
},
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -256,7 +256,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"type": "textarea",
"autosize": true
@@ -399,7 +399,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
}
diff --git a/packages/common/component/ConfigItem.vue b/packages/common/component/ConfigItem.vue
index c0fd195e7..565d639bb 100644
--- a/packages/common/component/ConfigItem.vue
+++ b/packages/common/component/ConfigItem.vue
@@ -111,6 +111,7 @@ import MultiTypeSelector from './MultiTypeSelector.vue'
import { useHistory, useProperties, useResource, useLayout, useCanvas } from '@opentiny/tiny-engine-controller'
import { generateFunction } from '@opentiny/tiny-engine-controller/utils'
import { SCHEMA_DATA_TYPE, PAGE_STATUS, TYPES } from '@opentiny/tiny-engine-controller/js/constants'
+import { getConfigurator } from '@opentiny/tiny-engine-entry'
const hasRule = (required, rules) => {
if (required) {
@@ -201,13 +202,14 @@ export default {
(props.property?.label?.text?.[locale.value] ?? props.property?.label?.text)
)
const isLinked = computed(() => Boolean(props.property.linked))
- const component = computed(() =>
- multiType.value
+ const component = computed(() => {
+ // TODO: 需要弄清楚 props.metaComponents[widget.value.component] 是什么场景
+ return multiType.value
? MultiTypeSelector
- : props.metaComponents[widget.value.component] ||
- MetaComponents[widget.value.component] ||
- MetaComponents['MetaInput']
- )
+ : getConfigurator(widget.value.component) ||
+ props.metaComponents[widget.value.component] ||
+ getConfigurator('InputConfigurator')
+ })
const bindValue = computed(() => {
let value = props.property?.widget?.props?.modelValue
diff --git a/packages/common/index.js b/packages/common/index.js
index 2fcb94fcc..e322eeba1 100644
--- a/packages/common/index.js
+++ b/packages/common/index.js
@@ -146,8 +146,7 @@ export const MetaComponents = {
MetaIpSection,
MetaRelatedEditor,
MetaRelatedColumns,
- MetaTableColumns,
- SearchEmpty
+ MetaTableColumns
}
export {
diff --git a/packages/configurator/README.md b/packages/configurator/README.md
new file mode 100644
index 000000000..fa5949c81
--- /dev/null
+++ b/packages/configurator/README.md
@@ -0,0 +1,3 @@
+# TinyEngine 的 configurator component 组件
+
+右侧属性面板配置物料属性的组件。
diff --git a/packages/configurator/package.json b/packages/configurator/package.json
new file mode 100644
index 000000000..df8f8f74a
--- /dev/null
+++ b/packages/configurator/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "@opentiny/tiny-engine-configurator",
+ "version": "1.0.0",
+ "description": "",
+ "main": "dist/index.js",
+ "module": "dist/index.js",
+ "type": "module",
+ "scripts": {
+ "build": "vite build",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "OpenTiny Team",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/opentiny/tiny-engine/issues"
+ },
+ "homepage": "https://opentiny.design/tiny-engine",
+ "devDependencies": {
+ "vite": "^4.3.7"
+ },
+ "peerDependencies": {
+ "@opentiny/vue": "^3.14.0",
+ "vue": "^3.4.15"
+ },
+ "dependencies": {
+ "@opentiny/tiny-engine-controller": "workspace:*"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/opentiny/tiny-engine",
+ "directory": "packages/configurator"
+ },
+ "files": [
+ "dist"
+ ]
+}
diff --git a/packages/configurator/src/index.js b/packages/configurator/src/index.js
new file mode 100644
index 000000000..dabd62d79
--- /dev/null
+++ b/packages/configurator/src/index.js
@@ -0,0 +1,2 @@
+export { default as InputConfigurator } from './input-configurator'
+export { default as SelectConfigurator } from './select-configurator'
diff --git a/packages/configurator/src/input-configurator/InputConfigurator.vue b/packages/configurator/src/input-configurator/InputConfigurator.vue
new file mode 100644
index 000000000..5e58cb2df
--- /dev/null
+++ b/packages/configurator/src/input-configurator/InputConfigurator.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/configurator/src/input-configurator/index.js b/packages/configurator/src/input-configurator/index.js
new file mode 100644
index 000000000..94a933b6e
--- /dev/null
+++ b/packages/configurator/src/input-configurator/index.js
@@ -0,0 +1,6 @@
+import InputConfigurator from './InputConfigurator.vue'
+
+export default {
+ name: 'InputConfigurator',
+ component: InputConfigurator
+}
diff --git a/packages/configurator/src/select-configurator/SelectConfigurator.vue b/packages/configurator/src/select-configurator/SelectConfigurator.vue
new file mode 100644
index 000000000..d9a59b8f9
--- /dev/null
+++ b/packages/configurator/src/select-configurator/SelectConfigurator.vue
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+ {{ item.label?.[locale] ?? item.label ?? item }}
+
+
+
+
+
+
+ {{ item.label?.[locale] ?? item.label ?? item }}
+
+
+
+
+
+
+
diff --git a/packages/configurator/src/select-configurator/index.js b/packages/configurator/src/select-configurator/index.js
new file mode 100644
index 000000000..685f88bd5
--- /dev/null
+++ b/packages/configurator/src/select-configurator/index.js
@@ -0,0 +1,6 @@
+import SelectConfigurator from './SelectConfigurator.vue'
+
+export default {
+ name: 'SelectConfigurator',
+ component: SelectConfigurator
+}
diff --git a/packages/configurator/vite.config.js b/packages/configurator/vite.config.js
new file mode 100644
index 000000000..6c428011c
--- /dev/null
+++ b/packages/configurator/vite.config.js
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2023 - present TinyEngine Authors.
+ * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
+ *
+ * Use of this source code is governed by an MIT-style license.
+ *
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
+ *
+ */
+
+import { defineConfig } from 'vite'
+import path from 'node:path'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+ plugins: [vue(), vueJsx()],
+ publicDir: false,
+ build: {
+ lib: {
+ entry: path.resolve(__dirname, './src/index.js'),
+ fileName: () => 'index.js',
+ formats: ['es']
+ },
+ rollupOptions: {
+ output: {
+ banner: 'import "./style.css"'
+ },
+ external: ['vue', /@opentiny\/tiny-engine.*/, /@opentiny\/vue.*/]
+ }
+ }
+})
diff --git a/packages/design-core/public/mock/bundle.json b/packages/design-core/public/mock/bundle.json
index 2fa58678f..d4e06792e 100644
--- a/packages/design-core/public/mock/bundle.json
+++ b/packages/design-core/public/mock/bundle.json
@@ -79,7 +79,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "MyInputConfigurator",
"props": {}
}
},
@@ -101,7 +101,7 @@
"type": "string",
"defaultValue": "default",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -137,7 +137,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -360,7 +360,7 @@
"type": "string",
"defaultValue": "default",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -396,7 +396,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -748,7 +748,7 @@
"type": "string",
"defaultValue": "right",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -784,7 +784,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"device": []
@@ -806,7 +806,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"device": []
@@ -850,7 +850,7 @@
"type": "string",
"defaultValue": "left",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -971,7 +971,7 @@
"type": "string",
"defaultValue": "default",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1137,7 +1137,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1158,7 +1158,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1179,7 +1179,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1244,7 +1244,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1308,7 +1308,7 @@
"type": "string",
"defaultValue": "default",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1344,7 +1344,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1365,7 +1365,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1525,7 +1525,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1578,7 +1578,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1597,7 +1597,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1616,7 +1616,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1673,7 +1673,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1846,7 +1846,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1881,7 +1881,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -1916,7 +1916,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -1936,7 +1936,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -2017,7 +2017,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -2141,7 +2141,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"device": []
@@ -2208,7 +2208,7 @@
"type": "string",
"defaultValue": "default",
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -2310,7 +2310,7 @@
"labelPosition": "top",
"type": "string",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"device": []
@@ -2331,7 +2331,7 @@
"cols": 12,
"labelPosition": "top",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"device": []
@@ -2373,7 +2373,7 @@
"cols": 12,
"labelPosition": "top",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"device": []
@@ -2395,7 +2395,7 @@
"labelPosition": "top",
"defaultValue": "fixed",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"options": [
{
@@ -2766,7 +2766,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -2785,7 +2785,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -2804,7 +2804,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -2900,7 +2900,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"options": [
{
@@ -2975,7 +2975,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -2994,7 +2994,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"options": [
{
@@ -3100,7 +3100,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"options": [
{
@@ -3130,7 +3130,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"options": [
{
@@ -3245,7 +3245,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -3264,7 +3264,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -3579,7 +3579,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -3681,7 +3681,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -3851,7 +3851,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -3870,7 +3870,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -3889,7 +3889,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4027,7 +4027,7 @@
"cols": 12,
"rules": [],
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -4187,7 +4187,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4206,7 +4206,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4419,7 +4419,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4438,7 +4438,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4457,7 +4457,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -4548,7 +4548,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4567,7 +4567,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -4656,7 +4656,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -4810,7 +4810,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -4962,7 +4962,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -5021,7 +5021,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -5040,7 +5040,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -5297,7 +5297,7 @@
"defaultValue": "标签",
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -5317,7 +5317,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -5431,7 +5431,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -5738,7 +5738,7 @@
"readOnly": false,
"disabled": false,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -5796,7 +5796,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -6069,7 +6069,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -6176,7 +6176,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -6468,7 +6468,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -6505,7 +6505,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -6572,7 +6572,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -6591,7 +6591,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -6707,7 +6707,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -6727,7 +6727,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -6876,7 +6876,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7135,7 +7135,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7154,7 +7154,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7174,7 +7174,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7317,7 +7317,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7357,7 +7357,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7596,7 +7596,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7655,7 +7655,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7702,7 +7702,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7721,7 +7721,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7855,7 +7855,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -7914,7 +7914,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8046,7 +8046,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"dataType": "Array"
}
@@ -8114,7 +8114,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -8257,7 +8257,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8297,7 +8297,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8356,7 +8356,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8579,7 +8579,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8639,7 +8639,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -8822,7 +8822,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8841,7 +8841,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8935,7 +8935,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -8976,7 +8976,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
}
@@ -9073,7 +9073,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -9166,7 +9166,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -9298,7 +9298,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -9318,7 +9318,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -9464,7 +9464,7 @@
}
},
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
}
},
@@ -9506,7 +9506,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -9594,7 +9594,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -9677,7 +9677,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -9802,7 +9802,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"placeholder": "比如:id"
}
@@ -10061,7 +10061,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -10415,7 +10415,7 @@
"cols": 12,
"defaultValue": "total,sizes,prev, pager, next",
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"type": "textarea"
}
@@ -10572,7 +10572,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -10592,7 +10592,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -10987,7 +10987,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -11007,7 +11007,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"disabled": true,
"placeholder": "请使用变量绑定来绑定函数"
@@ -11485,7 +11485,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -11557,7 +11557,7 @@
"defaultValue": "提示信息",
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -11576,7 +11576,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {
"disabled": true,
"placeholder": "请使用变量绑定来绑定函数"
@@ -11727,7 +11727,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -11798,7 +11798,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -11836,7 +11836,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -11932,7 +11932,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -12027,7 +12027,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -12065,7 +12065,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaInput",
+ "component": "InputConfigurator",
"props": {}
},
"description": {
@@ -12209,7 +12209,7 @@
}
},
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -12329,7 +12329,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -12687,7 +12687,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
@@ -12740,7 +12740,7 @@
"disabled": false,
"cols": 12,
"widget": {
- "component": "MetaSelect",
+ "component": "SelectConfigurator",
"props": {
"options": [
{
diff --git a/packages/design-core/src/init.js b/packages/design-core/src/init.js
index f3be02085..990b49878 100644
--- a/packages/design-core/src/init.js
+++ b/packages/design-core/src/init.js
@@ -25,6 +25,7 @@ import { utils } from '@opentiny/tiny-engine-utils'
import { defineEntry } from '@opentiny/tiny-engine-entry'
import App from './App.vue'
import defaultRegistry from '../registry.js'
+import { registerConfigurators } from './registerConfigurators'
import 'virtual:svg-icons-register'
@@ -80,9 +81,11 @@ const defaultLifeCycles = {
}
}
-export const init = ({ selector = '#app', registry = defaultRegistry, lifeCycles = {} } = {}) => {
+export const init = ({ selector = '#app', registry = defaultRegistry, lifeCycles = {}, configurators = [] } = {}) => {
const { beforeAppCreate, appCreated, appMounted } = lifeCycles
+ registerConfigurators(configurators)
+
defaultLifeCycles.beforeAppCreate({ registry })
beforeAppCreate?.({ registry })
const app = createApp(App)
diff --git a/packages/design-core/src/registerConfigurators.js b/packages/design-core/src/registerConfigurators.js
new file mode 100644
index 000000000..22752108c
--- /dev/null
+++ b/packages/design-core/src/registerConfigurators.js
@@ -0,0 +1,11 @@
+// TODO: 抽空 common package 中的 metaComponent
+import { MetaComponents } from '@opentiny/tiny-engine-common'
+import { addConfigurator } from '@opentiny/tiny-engine-entry'
+
+/**
+ * 注册用户指定的 configurators
+ */
+export const registerConfigurators = (configurators) => {
+ addConfigurator(Object.entries(MetaComponents).map(([name, component]) => ({ name, component })))
+ addConfigurator(configurators)
+}
diff --git a/packages/design-core/vite.config.js b/packages/design-core/vite.config.js
index 905f24444..fb728de8e 100644
--- a/packages/design-core/vite.config.js
+++ b/packages/design-core/vite.config.js
@@ -199,7 +199,8 @@ const devAlias = {
'@opentiny/tiny-engine-i18n-host': path.resolve(__dirname, '../i18n/src/lib.js'),
'@opentiny/tiny-engine-builtin-component': path.resolve(__dirname, '../builtinComponent/index.js'),
'@opentiny/tiny-engine-entry': path.resolve(__dirname, '../entry/src/index.js'),
- '@opentiny/tiny-engine-layout': path.resolve(__dirname, '../layout/index.js')
+ '@opentiny/tiny-engine-layout': path.resolve(__dirname, '../layout/index.js'),
+ '@opentiny/tiny-engine-configurator': path.resolve(__dirname, '../configurator/src/index.js')
}
const prodAlias = {
diff --git a/packages/entry/README.md b/packages/entry/README.md
new file mode 100644
index 000000000..d50a0057c
--- /dev/null
+++ b/packages/entry/README.md
@@ -0,0 +1,26 @@
+# entry(暂定)
+
+## configurators
+
+往设计器添加 metaComponent,满足右侧属性面板属性设置器自定义组件的需求
+
+### addConfigurator
+
+```javascript
+addConfigurator([
+ {
+ name: 'InputConfigurator',
+ component: InputConfigurator
+ },
+ {
+ name: 'SelectConfigurator',
+ component: SelectConfigurator
+ }
+])
+```
+
+### getConfigurator
+
+```javascript
+getConfigurator('InputConfigurator')
+```
diff --git a/packages/entry/src/configurators.js b/packages/entry/src/configurators.js
new file mode 100644
index 000000000..8b3d8f751
--- /dev/null
+++ b/packages/entry/src/configurators.js
@@ -0,0 +1,14 @@
+const configuratorsMap = new Map()
+
+export const addConfigurator = (components) => {
+ // TODO: 数据结构校验&错误抛出
+ if (Array.isArray(components)) {
+ for (const { name, component } of components) {
+ configuratorsMap.set(name, component)
+ }
+ }
+}
+
+export const getConfigurator = (name) => {
+ return configuratorsMap.get(name)
+}
diff --git a/packages/entry/src/index.js b/packages/entry/src/index.js
index 1d3f928e1..eaea5b879 100644
--- a/packages/entry/src/index.js
+++ b/packages/entry/src/index.js
@@ -16,3 +16,4 @@ export { defineEntry, callEntry, beforeCallEntry, afterCallEntry, getMergeRegist
export { getLayoutComponent } from './layoutHash'
export { default as useMessage } from './useMessage'
export { useShareState } from './useShareState'
+export { getConfigurator, addConfigurator } from './configurators'