1
0
mirror of synced 2026-03-23 02:58:34 +08:00

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

@@ -32,6 +32,7 @@ export default defineConfig({
find: /^@tmagic\/utils\/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\/core/, replacement: path.join(__dirname, '../../packages/core/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"
},
"dependencies": {
"@tmagic/cli": "1.4.6",
"@tmagic/core": "1.4.6",
"@tmagic/data-source": "1.4.6",
"@tmagic/ui-react": "1.4.6",
@@ -29,17 +28,14 @@
"axios": "^0.25.0",
"lodash-es": "^4.17.21",
"terser": "^5.31.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@tmagic/cli": "1.4.6",
"@types/lodash-es": "^4.17.4",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-legacy": "^5.4.0",
"@vitejs/plugin-react-refresh": "^1.3.1",
"typescript": "^5.4.5",

View File

@@ -16,7 +16,7 @@
* limitations under the License.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import Core from '@tmagic/core';
import { DataSourceManager } from '@tmagic/data-source';
@@ -31,6 +31,7 @@ import plugins from '../.tmagic/plugin-entry';
import App from './App';
import '@tmagic/utils/resetcss.css';
declare global {
interface Window {
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.values(plugins).forEach((plugin: any) => {
plugin.install(app);
plugin.install({ app });
});
ReactDOM.render(
const root = createRoot(document.getElementById('root')!);
root.render(
<React.StrictMode>
<AppContent.Provider value={app}>
<App />
</AppContent.Provider>
</React.StrictMode>,
document.getElementById('root'),
);

View File

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

View File

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