fix(ui,runtime): 迭代器容器迭代数据兼容

re #613
This commit is contained in:
roymondchen 2024-05-31 14:45:21 +08:00
parent 7fb4d96cb0
commit 94db430b85
15 changed files with 175 additions and 153 deletions

View File

@ -14,21 +14,23 @@
"react:build": "tsc && vite build" "react:build": "tsc && vite build"
}, },
"dependencies": { "dependencies": {
"@tmagic/core": "1.4.4", "qrcode": "^1.5.0"
"@tmagic/schema": "1.4.4",
"@tmagic/utils": "1.4.4",
"qrcode": "^1.5.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"peerDependencies": {
"qrcode": "^1.5.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^17.0.37", "@types/react": "^18.3.3",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^18.3.0"
"typescript": "^5.4.5" },
"peerDependencies": {
"@tmagic/core": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*",
"react": ">=18.3.1",
"react-dom": ">=18.3.1",
"typescript": "*"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
} }
} }

View File

@ -22,7 +22,11 @@ interface IteratorContainerProps extends MContainer {
const IteratorContainer: React.FC<IteratorContainerProps> = ({ config, id }) => { const IteratorContainer: React.FC<IteratorContainerProps> = ({ config, id }) => {
const { app } = useApp({ config }); const { app } = useApp({ config });
const { iteratorData = [] } = config; let { iteratorData = [] } = config;
if (!Array.isArray(iteratorData)) {
iteratorData = [];
}
if (app?.platform === 'editor' && !iteratorData.length) { if (app?.platform === 'editor' && !iteratorData.length) {
iteratorData.push({}); iteratorData.push({});

View File

@ -26,8 +26,13 @@ export default [
checkStrictly: false, checkStrictly: false,
type: 'data-source-field-select', type: 'data-source-field-select',
onChange: (vm: any, v: string[] = [], { model }: any) => { onChange: (vm: any, v: string[] = [], { model }: any) => {
if (Array.isArray(v)) {
const [dsId, ...keys] = v; const [dsId, ...keys] = v;
model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys]; model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys];
} else {
model.dsField = [];
}
return v; return v;
}, },
}, },

View File

@ -11,15 +11,19 @@
"url": "https://github.com/Tencent/tmagic-editor.git" "url": "https://github.com/Tencent/tmagic-editor.git"
}, },
"dependencies": { "dependencies": {
"@tmagic/core": "1.4.4", "qrcode": "^1.5.0"
"@tmagic/schema": "1.4.4",
"@tmagic/utils": "1.4.4",
"qrcode": "^1.5.0",
"vue": "^2.7.4"
}, },
"peerDependencies": { "peerDependencies": {
"qrcode": "^1.5.0", "@tmagic/core": "workspace:*",
"vue": "^2.7.4" "@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*",
"vue": ">=2.7.4",
"typescript": "*"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}, },
"devDependencies": { "devDependencies": {
"vue-template-compiler": "^2.7.4" "vue-template-compiler": "^2.7.4"

View File

@ -36,7 +36,11 @@ const app: Core | undefined = inject('app');
const style = computed(() => app?.transformStyle(props.config.style || {})); const style = computed(() => app?.transformStyle(props.config.style || {}));
const configs = computed(() => { const configs = computed(() => {
const { iteratorData = [] } = props.config; let { iteratorData = [] } = props.config;
if (!Array.isArray(iteratorData)) {
iteratorData = [];
}
if (app?.platform === 'editor' && !iteratorData.length) { if (app?.platform === 'editor' && !iteratorData.length) {
iteratorData.push({}); iteratorData.push({});

View File

@ -26,9 +26,12 @@ export default [
checkStrictly: false, checkStrictly: false,
type: 'data-source-field-select', type: 'data-source-field-select',
onChange: (vm: any, v: string[] = [], { model }: any) => { onChange: (vm: any, v: string[] = [], { model }: any) => {
if (Array.isArray(v)) {
const [dsId, ...keys] = v; const [dsId, ...keys] = v;
model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys]; model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys];
return v; } else {
model.dsField = [];
}
}, },
}, },
{ {

View File

@ -12,17 +12,21 @@
"url": "https://github.com/Tencent/tmagic-editor.git" "url": "https://github.com/Tencent/tmagic-editor.git"
}, },
"dependencies": { "dependencies": {
"@tmagic/core": "1.4.4",
"@tmagic/schema": "1.4.4",
"@tmagic/utils": "1.4.4",
"delegate": "^3.2.0", "delegate": "^3.2.0",
"qrcode": "^1.5.0", "qrcode": "^1.5.0",
"tiny-emitter": "^2.1.0", "tiny-emitter": "^2.1.0"
"vue": "^3.4.27"
}, },
"peerDependencies": { "peerDependencies": {
"qrcode": "^1.5.0", "@tmagic/core": "workspace:*",
"vue": "^3.4.27" "@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*",
"vue": ">=3.4.27",
"typescript": "*"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}, },
"devDependencies": { "devDependencies": {
"@testing-library/vue": "^6.4.2", "@testing-library/vue": "^6.4.2",

View File

@ -36,7 +36,11 @@ const { app } = useApp({
}); });
const configs = computed(() => { const configs = computed(() => {
const { iteratorData = [] } = props.config; let { iteratorData = [] } = props.config;
if (!Array.isArray(iteratorData)) {
iteratorData = [];
}
if (app?.platform === 'editor' && !iteratorData.length) { if (app?.platform === 'editor' && !iteratorData.length) {
iteratorData.push({}); iteratorData.push({});

View File

@ -26,9 +26,12 @@ export default [
checkStrictly: false, checkStrictly: false,
type: 'data-source-field-select', type: 'data-source-field-select',
onChange: (vm: any, v: string[] = [], { model }: any) => { onChange: (vm: any, v: string[] = [], { model }: any) => {
if (Array.isArray(v)) {
const [dsId, ...keys] = v; const [dsId, ...keys] = v;
model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys]; model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys];
return v; } else {
model.dsField = [];
}
}, },
}, },
{ {

179
pnpm-lock.yaml generated
View File

@ -115,7 +115,7 @@ importers:
version: 5.2.11(@types/node@18.19.3)(sass@1.77.0)(terser@5.31.0) version: 5.2.11(@types/node@18.19.3)(sass@1.77.0)(terser@5.31.0)
vitepress: vitepress:
specifier: 1.2.2 specifier: 1.2.2
version: 1.2.2(@algolia/client-search@4.23.3)(@types/node@18.19.3)(@types/react@17.0.37)(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(async-validator@4.2.5)(axios@0.25.0)(postcss@8.4.38)(qrcode@1.5.0)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(sass@1.77.0)(search-insights@2.9.0)(sortablejs@1.15.2)(terser@5.31.0)(typescript@5.4.5) version: 1.2.2(@algolia/client-search@4.23.3)(@types/node@18.19.3)(@types/react@18.3.3)(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(async-validator@4.2.5)(axios@0.25.0)(postcss@8.4.38)(qrcode@1.5.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.0)(search-insights@2.9.0)(sortablejs@1.15.2)(terser@5.31.0)(typescript@5.4.5)
vitest: vitest:
specifier: ^1.6.0 specifier: ^1.6.0
version: 1.6.0(@types/node@18.19.3)(jsdom@19.0.0)(sass@1.77.0)(terser@5.31.0) version: 1.6.0(@types/node@18.19.3)(jsdom@19.0.0)(sass@1.77.0)(terser@5.31.0)
@ -624,14 +624,14 @@ importers:
packages/ui: packages/ui:
dependencies: dependencies:
'@tmagic/core': '@tmagic/core':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4(dayjs@1.11.11) version: link:../core
'@tmagic/schema': '@tmagic/schema':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4 version: link:../schema
'@tmagic/utils': '@tmagic/utils':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4(dayjs@1.11.11) version: link:../utils
delegate: delegate:
specifier: ^3.2.0 specifier: ^3.2.0
version: 3.2.0 version: 3.2.0
@ -641,8 +641,11 @@ importers:
tiny-emitter: tiny-emitter:
specifier: ^2.1.0 specifier: ^2.1.0
version: 2.1.0 version: 2.1.0
typescript:
specifier: '*'
version: 5.4.5
vue: vue:
specifier: ^3.4.27 specifier: '>=3.4.27'
version: 3.4.27(typescript@5.4.5) version: 3.4.27(typescript@5.4.5)
devDependencies: devDependencies:
'@testing-library/vue': '@testing-library/vue':
@ -661,51 +664,54 @@ importers:
packages/ui-react: packages/ui-react:
dependencies: dependencies:
'@tmagic/core': '@tmagic/core':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4(dayjs@1.11.11) version: link:../core
'@tmagic/schema': '@tmagic/schema':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4 version: link:../schema
'@tmagic/utils': '@tmagic/utils':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4(dayjs@1.11.11) version: link:../utils
qrcode: qrcode:
specifier: ^1.5.0 specifier: ^1.5.0
version: 1.5.0 version: 1.5.0
react: react:
specifier: ^17.0.0 specifier: '>=18.3.1'
version: 17.0.2 version: 18.3.1
react-dom: react-dom:
specifier: ^17.0.0 specifier: '>=18.3.1'
version: 17.0.2(react@17.0.2) version: 18.3.1(react@18.3.1)
typescript:
specifier: '*'
version: 5.4.5
devDependencies: devDependencies:
'@types/react': '@types/react':
specifier: ^17.0.37 specifier: ^18.3.3
version: 17.0.37 version: 18.3.3
'@types/react-dom': '@types/react-dom':
specifier: ^17.0.11 specifier: ^18.3.0
version: 17.0.11 version: 18.3.0
typescript:
specifier: ^5.4.5
version: 5.4.5
packages/ui-vue2: packages/ui-vue2:
dependencies: dependencies:
'@tmagic/core': '@tmagic/core':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4(dayjs@1.11.11) version: link:../core
'@tmagic/schema': '@tmagic/schema':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4 version: link:../schema
'@tmagic/utils': '@tmagic/utils':
specifier: 1.4.4 specifier: workspace:*
version: 1.4.4(dayjs@1.11.11) version: link:../utils
qrcode: qrcode:
specifier: ^1.5.0 specifier: ^1.5.0
version: 1.5.0 version: 1.5.0
typescript:
specifier: '*'
version: 5.4.5
vue: vue:
specifier: ^2.7.4 specifier: '>=2.7.4'
version: 2.7.4 version: 3.4.27(typescript@5.4.5)
devDependencies: devDependencies:
vue-template-compiler: vue-template-compiler:
specifier: ^2.7.4 specifier: ^2.7.4
@ -832,9 +838,6 @@ importers:
runtime/react: runtime/react:
dependencies: dependencies:
'@tmagic/cli':
specifier: 1.4.6
version: 1.4.6(typescript@5.4.5)
'@tmagic/core': '@tmagic/core':
specifier: 1.4.6 specifier: 1.4.6
version: 1.4.6(@tmagic/data-source@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5) version: 1.4.6(@tmagic/data-source@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5)
@ -849,7 +852,7 @@ importers:
version: 1.4.6(@tmagic/core@1.4.6(@tmagic/data-source@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(scenejs@1.9.4)(typescript@5.4.5) version: 1.4.6(@tmagic/core@1.4.6(@tmagic/data-source@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(scenejs@1.9.4)(typescript@5.4.5)
'@tmagic/ui-react': '@tmagic/ui-react':
specifier: 1.4.6 specifier: 1.4.6
version: 1.4.6(dayjs@1.11.11)(qrcode@1.5.0)(react-dom@17.0.2(react@17.0.2))(react@17.0.2) version: 1.4.6(dayjs@1.11.11)(qrcode@1.5.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@tmagic/utils': '@tmagic/utils':
specifier: 1.4.6 specifier: 1.4.6
version: 1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5) version: 1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5)
@ -860,24 +863,27 @@ importers:
specifier: ^4.17.21 specifier: ^4.17.21
version: 4.17.21 version: 4.17.21
react: react:
specifier: ^17.0.2 specifier: ^18.3.1
version: 17.0.2 version: 18.3.1
react-dom: react-dom:
specifier: ^17.0.2 specifier: ^18.3.1
version: 17.0.2(react@17.0.2) version: 18.3.1(react@18.3.1)
terser: terser:
specifier: ^5.31.0 specifier: ^5.31.0
version: 5.31.0 version: 5.31.0
devDependencies: devDependencies:
'@tmagic/cli':
specifier: 1.4.6
version: 1.4.6(typescript@5.4.5)
'@types/lodash-es': '@types/lodash-es':
specifier: ^4.17.4 specifier: ^4.17.4
version: 4.17.4 version: 4.17.4
'@types/react': '@types/react':
specifier: ^17.0.37 specifier: ^18.3.3
version: 17.0.37 version: 18.3.3
'@types/react-dom': '@types/react-dom':
specifier: ^17.0.11 specifier: ^18.3.0
version: 17.0.11 version: 18.3.0
'@vitejs/plugin-legacy': '@vitejs/plugin-legacy':
specifier: ^5.4.0 specifier: ^5.4.0
version: 5.4.0(terser@5.31.0)(vite@5.2.11(@types/node@18.19.3)(sass@1.77.0)(terser@5.31.0)) version: 5.4.0(terser@5.31.0)(vite@5.2.11(@types/node@18.19.3)(sass@1.77.0)(terser@5.31.0))
@ -979,9 +985,6 @@ importers:
runtime/vue2: runtime/vue2:
dependencies: dependencies:
'@tmagic/cli':
specifier: 1.4.6
version: 1.4.6(typescript@5.4.5)
'@tmagic/core': '@tmagic/core':
specifier: 1.4.6 specifier: 1.4.6
version: 1.4.6(@tmagic/data-source@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5) version: 1.4.6(@tmagic/data-source@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5))(@tmagic/schema@1.4.6(typescript@5.4.5))(@tmagic/utils@1.4.6(@tmagic/schema@1.4.6(typescript@5.4.5))(typescript@5.4.5))(typescript@5.4.5)
@ -1010,6 +1013,9 @@ importers:
specifier: ^2.7.4 specifier: ^2.7.4
version: 2.7.4 version: 2.7.4
devDependencies: devDependencies:
'@tmagic/cli':
specifier: 1.4.6
version: 1.4.6(typescript@5.4.5)
'@types/events': '@types/events':
specifier: ^3.0.0 specifier: ^3.0.0
version: 3.0.0 version: 3.0.0
@ -3009,14 +3015,11 @@ packages:
'@types/qrcode@1.4.2': '@types/qrcode@1.4.2':
resolution: {integrity: sha512-7uNT9L4WQTNJejHTSTdaJhfBSCN73xtXaHFyBJ8TSwiLhe4PRuTue7Iph0s2nG9R/ifUaSnGhLUOZavlBEqDWQ==} resolution: {integrity: sha512-7uNT9L4WQTNJejHTSTdaJhfBSCN73xtXaHFyBJ8TSwiLhe4PRuTue7Iph0s2nG9R/ifUaSnGhLUOZavlBEqDWQ==}
'@types/react-dom@17.0.11': '@types/react-dom@18.3.0':
resolution: {integrity: sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==} resolution: {integrity: sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==}
'@types/react@17.0.37': '@types/react@18.3.3':
resolution: {integrity: sha512-2FS1oTqBGcH/s0E+CjrCCR9+JMpsu9b69RTFO+40ua43ZqP5MmQ4iUde/dMjWR909KxZwmOQIFq6AV6NjEG5xg==} resolution: {integrity: sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==}
'@types/scheduler@0.16.3':
resolution: {integrity: sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==}
'@types/semver@7.3.13': '@types/semver@7.3.13':
resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}
@ -5213,10 +5216,6 @@ packages:
nwsapi@2.2.3: nwsapi@2.2.3:
resolution: {integrity: sha512-jscxIO4/VKScHlbmFBdV1Z6LXnLO+ZR4VMtypudUdfwtKxUN3TQcNFIHLwKtrUbDyHN4/GycY9+oRGZ2XMXYPw==} resolution: {integrity: sha512-jscxIO4/VKScHlbmFBdV1Z6LXnLO+ZR4VMtypudUdfwtKxUN3TQcNFIHLwKtrUbDyHN4/GycY9+oRGZ2XMXYPw==}
object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
object-inspect@1.12.3: object-inspect@1.12.3:
resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==}
@ -5468,10 +5467,10 @@ packages:
react-css-styled@1.1.9: react-css-styled@1.1.9:
resolution: {integrity: sha512-M7fJZ3IWFaIHcZEkoFOnkjdiUFmwd8d+gTh2bpqMOcnxy/0Gsykw4dsL4QBiKsxcGow6tETUa4NAUcmJF+/nfw==} resolution: {integrity: sha512-M7fJZ3IWFaIHcZEkoFOnkjdiUFmwd8d+gTh2bpqMOcnxy/0Gsykw4dsL4QBiKsxcGow6tETUa4NAUcmJF+/nfw==}
react-dom@17.0.2: react-dom@18.3.1:
resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
peerDependencies: peerDependencies:
react: 17.0.2 react: ^18.3.1
react-is@17.0.2: react-is@17.0.2:
resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
@ -5489,8 +5488,8 @@ packages:
react-selecto@1.26.0: react-selecto@1.26.0:
resolution: {integrity: sha512-aBTZEYA68uE+o8TytNjTb2GpIn4oKEv0U4LIow3cspJQlF/PdAnBwkq9UuiKVuFluu5kfLQ7Keu3S2Tihlmw0g==} resolution: {integrity: sha512-aBTZEYA68uE+o8TytNjTb2GpIn4oKEv0U4LIow3cspJQlF/PdAnBwkq9UuiKVuFluu5kfLQ7Keu3S2Tihlmw0g==}
react@17.0.2: react@18.3.1:
resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
read-pkg-up@10.1.0: read-pkg-up@10.1.0:
@ -5662,8 +5661,8 @@ packages:
scenejs@1.9.4: scenejs@1.9.4:
resolution: {integrity: sha512-/DajsY2fwaOgWKOPNV2nP/eE2+zF+q2tE4aYOSteg7JWrzHPXTXG1ds4Ah09nImznJ5rPnZOm1/gX451we2WvQ==} resolution: {integrity: sha512-/DajsY2fwaOgWKOPNV2nP/eE2+zF+q2tE4aYOSteg7JWrzHPXTXG1ds4Ah09nImznJ5rPnZOm1/gX451we2WvQ==}
scheduler@0.20.2: scheduler@0.23.2:
resolution: {integrity: sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==} resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
scule@1.0.0: scule@1.0.0:
resolution: {integrity: sha512-4AsO/FrViE/iDNEPaAQlb77tf0csuq27EsVpy6ett584EcRTp6pTDLoGWVxCD77y5iU5FauOvhsI4o1APwPoSQ==} resolution: {integrity: sha512-4AsO/FrViE/iDNEPaAQlb77tf0csuq27EsVpy6ett584EcRTp6pTDLoGWVxCD77y5iU5FauOvhsI4o1APwPoSQ==}
@ -7781,9 +7780,9 @@ snapshots:
'@docsearch/css@3.6.0': {} '@docsearch/css@3.6.0': {}
'@docsearch/js@3.6.0(@algolia/client-search@4.23.3)(@types/react@17.0.37)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(search-insights@2.9.0)': '@docsearch/js@3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)':
dependencies: dependencies:
'@docsearch/react': 3.6.0(@algolia/client-search@4.23.3)(@types/react@17.0.37)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(search-insights@2.9.0) '@docsearch/react': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)
preact: 10.13.2 preact: 10.13.2
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search' - '@algolia/client-search'
@ -7792,16 +7791,16 @@ snapshots:
- react-dom - react-dom
- search-insights - search-insights
'@docsearch/react@3.6.0(@algolia/client-search@4.23.3)(@types/react@17.0.37)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(search-insights@2.9.0)': '@docsearch/react@3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)':
dependencies: dependencies:
'@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.20.0)(search-insights@2.9.0) '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.20.0)(search-insights@2.9.0)
'@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.20.0) '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.20.0)
'@docsearch/css': 3.6.0 '@docsearch/css': 3.6.0
algoliasearch: 4.20.0 algoliasearch: 4.20.0
optionalDependencies: optionalDependencies:
'@types/react': 17.0.37 '@types/react': 18.3.3
react: 17.0.2 react: 18.3.1
react-dom: 17.0.2(react@17.0.2) react-dom: 18.3.1(react@18.3.1)
search-insights: 2.9.0 search-insights: 2.9.0
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search' - '@algolia/client-search'
@ -8410,14 +8409,14 @@ snapshots:
- '@tmagic/data-source' - '@tmagic/data-source'
- typescript - typescript
'@tmagic/ui-react@1.4.6(dayjs@1.11.11)(qrcode@1.5.0)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)': '@tmagic/ui-react@1.4.6(dayjs@1.11.11)(qrcode@1.5.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies: dependencies:
'@tmagic/core': 1.4.4(dayjs@1.11.11) '@tmagic/core': 1.4.4(dayjs@1.11.11)
'@tmagic/schema': 1.4.4 '@tmagic/schema': 1.4.4
'@tmagic/utils': 1.4.4(dayjs@1.11.11) '@tmagic/utils': 1.4.4(dayjs@1.11.11)
qrcode: 1.5.0 qrcode: 1.5.0
react: 17.0.2 react: 18.3.1
react-dom: 17.0.2(react@17.0.2) react-dom: 18.3.1(react@18.3.1)
transitivePeerDependencies: transitivePeerDependencies:
- dayjs - dayjs
@ -8555,17 +8554,14 @@ snapshots:
dependencies: dependencies:
'@types/node': 18.19.3 '@types/node': 18.19.3
'@types/react-dom@17.0.11': '@types/react-dom@18.3.0':
dependencies: dependencies:
'@types/react': 17.0.37 '@types/react': 18.3.3
'@types/react@17.0.37': '@types/react@18.3.3':
dependencies: dependencies:
'@types/prop-types': 15.7.5 '@types/prop-types': 15.7.5
'@types/scheduler': 0.16.3 csstype: 3.1.3
csstype: 3.1.2
'@types/scheduler@0.16.3': {}
'@types/semver@7.3.13': {} '@types/semver@7.3.13': {}
@ -11165,8 +11161,6 @@ snapshots:
nwsapi@2.2.3: {} nwsapi@2.2.3: {}
object-assign@4.1.1: {}
object-inspect@1.12.3: {} object-inspect@1.12.3: {}
object-keys@1.1.1: {} object-keys@1.1.1: {}
@ -11425,12 +11419,11 @@ snapshots:
css-styled: 1.0.8 css-styled: 1.0.8
framework-utils: 1.1.0 framework-utils: 1.1.0
react-dom@17.0.2(react@17.0.2): react-dom@18.3.1(react@18.3.1):
dependencies: dependencies:
loose-envify: 1.4.0 loose-envify: 1.4.0
object-assign: 4.1.1 react: 18.3.1
react: 17.0.2 scheduler: 0.23.2
scheduler: 0.20.2
react-is@17.0.2: {} react-is@17.0.2: {}
@ -11458,10 +11451,9 @@ snapshots:
dependencies: dependencies:
selecto: 1.26.0 selecto: 1.26.0
react@17.0.2: react@18.3.1:
dependencies: dependencies:
loose-envify: 1.4.0 loose-envify: 1.4.0
object-assign: 4.1.1
read-pkg-up@10.1.0: read-pkg-up@10.1.0:
dependencies: dependencies:
@ -11673,10 +11665,9 @@ snapshots:
css-styled: 1.0.8 css-styled: 1.0.8
order-map: 0.2.2(@daybrush/utils@1.13.0) order-map: 0.2.2(@daybrush/utils@1.13.0)
scheduler@0.20.2: scheduler@0.23.2:
dependencies: dependencies:
loose-envify: 1.4.0 loose-envify: 1.4.0
object-assign: 4.1.1
scule@1.0.0: {} scule@1.0.0: {}
@ -12212,10 +12203,10 @@ snapshots:
sass: 1.77.0 sass: 1.77.0
terser: 5.31.0 terser: 5.31.0
vitepress@1.2.2(@algolia/client-search@4.23.3)(@types/node@18.19.3)(@types/react@17.0.37)(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(async-validator@4.2.5)(axios@0.25.0)(postcss@8.4.38)(qrcode@1.5.0)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(sass@1.77.0)(search-insights@2.9.0)(sortablejs@1.15.2)(terser@5.31.0)(typescript@5.4.5): vitepress@1.2.2(@algolia/client-search@4.23.3)(@types/node@18.19.3)(@types/react@18.3.3)(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(async-validator@4.2.5)(axios@0.25.0)(postcss@8.4.38)(qrcode@1.5.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.0)(search-insights@2.9.0)(sortablejs@1.15.2)(terser@5.31.0)(typescript@5.4.5):
dependencies: dependencies:
'@docsearch/css': 3.6.0 '@docsearch/css': 3.6.0
'@docsearch/js': 3.6.0(@algolia/client-search@4.23.3)(@types/react@17.0.37)(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(search-insights@2.9.0) '@docsearch/js': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)
'@shikijs/core': 1.6.0 '@shikijs/core': 1.6.0
'@shikijs/transformers': 1.6.0 '@shikijs/transformers': 1.6.0
'@types/markdown-it': 14.1.1 '@types/markdown-it': 14.1.1

View File

@ -32,6 +32,7 @@ export default defineConfig({
find: /^@tmagic\/utils\/resetcss.css/, find: /^@tmagic\/utils\/resetcss.css/,
replacement: path.join(__dirname, '../../packages/utils/src/resetcss.css'), replacement: path.join(__dirname, '../../packages/utils/src/resetcss.css'),
}, },
{ find: /^@tmagic\/ui-react/, replacement: path.join(__dirname, '../../packages/ui-react/src/index.ts') },
{ find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') },
{ find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') },
{ find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') },

View File

@ -19,7 +19,6 @@
"build:ds:event": "vite build --config build.vite.config.ts --mode ds:event" "build:ds:event": "vite build --config build.vite.config.ts --mode ds:event"
}, },
"dependencies": { "dependencies": {
"@tmagic/cli": "1.4.6",
"@tmagic/core": "1.4.6", "@tmagic/core": "1.4.6",
"@tmagic/data-source": "1.4.6", "@tmagic/data-source": "1.4.6",
"@tmagic/ui-react": "1.4.6", "@tmagic/ui-react": "1.4.6",
@ -29,17 +28,14 @@
"axios": "^0.25.0", "axios": "^0.25.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"terser": "^5.31.0", "terser": "^5.31.0",
"react": "^17.0.2", "react": "^18.3.1",
"react-dom": "^17.0.2" "react-dom": "^18.3.1"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}, },
"devDependencies": { "devDependencies": {
"@tmagic/cli": "1.4.6",
"@types/lodash-es": "^4.17.4", "@types/lodash-es": "^4.17.4",
"@types/react": "^17.0.37", "@types/react": "^18.3.3",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^18.3.0",
"@vitejs/plugin-legacy": "^5.4.0", "@vitejs/plugin-legacy": "^5.4.0",
"@vitejs/plugin-react-refresh": "^1.3.1", "@vitejs/plugin-react-refresh": "^1.3.1",
"typescript": "^5.4.5", "typescript": "^5.4.5",

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import { createRoot } from 'react-dom/client';
import Core from '@tmagic/core'; import Core from '@tmagic/core';
import { DataSourceManager } from '@tmagic/data-source'; import { DataSourceManager } from '@tmagic/data-source';
@ -31,6 +31,7 @@ import plugins from '../.tmagic/plugin-entry';
import App from './App'; import App from './App';
import '@tmagic/utils/resetcss.css'; import '@tmagic/utils/resetcss.css';
declare global { declare global {
interface Window { interface Window {
magicDSL: MApp[]; magicDSL: MApp[];
@ -69,14 +70,14 @@ app.setDesignWidth(app.env.isWeb ? window.document.documentElement.getBoundingCl
Object.keys(components).forEach((type: string) => app.registerComponent(type, components[type])); Object.keys(components).forEach((type: string) => app.registerComponent(type, components[type]));
Object.values(plugins).forEach((plugin: any) => { Object.values(plugins).forEach((plugin: any) => {
plugin.install(app); plugin.install({ app });
}); });
ReactDOM.render( const root = createRoot(document.getElementById('root')!);
root.render(
<React.StrictMode> <React.StrictMode>
<AppContent.Provider value={app}> <AppContent.Provider value={app}>
<App /> <App />
</AppContent.Provider> </AppContent.Provider>
</React.StrictMode>, </React.StrictMode>,
document.getElementById('root'),
); );

View File

@ -17,7 +17,7 @@
*/ */
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import { createRoot } from 'react-dom/client';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import Core from '@tmagic/core'; import Core from '@tmagic/core';
@ -64,13 +64,13 @@ const updateConfig = (root: MApp) => {
}; };
const renderDom = () => { const renderDom = () => {
ReactDOM.render( const root = createRoot(document.getElementById('root')!);
root.render(
<React.StrictMode> <React.StrictMode>
<AppContent.Provider value={app}> <AppContent.Provider value={app}>
<App /> <App />
</AppContent.Provider> </AppContent.Provider>
</React.StrictMode>, </React.StrictMode>,
document.getElementById('root'),
); );
setTimeout(() => { setTimeout(() => {
@ -113,7 +113,7 @@ const operations = {
updateConfig(root); updateConfig(root);
}, },
update({ config, root, parentId}: UpdateData) { update({ config, root, parentId }: UpdateData) {
const newNode = app.dataSourceManager?.compiledNode(config, undefined, true) || config; const newNode = app.dataSourceManager?.compiledNode(config, undefined, true) || config;
replaceChildNode(newNode, [root], parentId); replaceChildNode(newNode, [root], parentId);
updateConfig(cloneDeep(root)); updateConfig(cloneDeep(root));
@ -131,7 +131,7 @@ const operations = {
Object.keys(components).forEach((type: string) => app.registerComponent(type, components[type])); Object.keys(components).forEach((type: string) => app.registerComponent(type, components[type]));
Object.values(plugins).forEach((plugin: any) => { Object.values(plugins).forEach((plugin: any) => {
plugin.install(app); plugin.install({ app });
}); });
// @ts-ignore // @ts-ignore

View File

@ -19,7 +19,6 @@
"build:ds:event": "vite build --config build.vite.config.ts --mode ds:event" "build:ds:event": "vite build --config build.vite.config.ts --mode ds:event"
}, },
"dependencies": { "dependencies": {
"@tmagic/cli": "1.4.6",
"@tmagic/core": "1.4.6", "@tmagic/core": "1.4.6",
"@tmagic/data-source": "1.4.6", "@tmagic/data-source": "1.4.6",
"@tmagic/ui-vue2": "1.4.6", "@tmagic/ui-vue2": "1.4.6",
@ -31,6 +30,7 @@
"vue": "^2.7.4" "vue": "^2.7.4"
}, },
"devDependencies": { "devDependencies": {
"@tmagic/cli": "1.4.6",
"@types/events": "^3.0.0", "@types/events": "^3.0.0",
"axios": "^0.27.2", "axios": "^0.27.2",
"rollup": "^4.17.2", "rollup": "^4.17.2",