mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
chore(runtime): 使用DeepObservedData做完数据源事件模型
This commit is contained in:
parent
ac7bb93a37
commit
653cafbe81
@ -19,7 +19,7 @@ import React from 'react';
|
|||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
|
|
||||||
import Core from '@tmagic/core';
|
import Core from '@tmagic/core';
|
||||||
import { DataSourceManager } from '@tmagic/data-source';
|
import { DataSourceManager, DeepObservedData } from '@tmagic/data-source';
|
||||||
import type { MApp } from '@tmagic/schema';
|
import type { MApp } from '@tmagic/schema';
|
||||||
import { AppContent } from '@tmagic/ui-react';
|
import { AppContent } from '@tmagic/ui-react';
|
||||||
import { getUrlParam } from '@tmagic/utils';
|
import { getUrlParam } from '@tmagic/utils';
|
||||||
@ -41,6 +41,8 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataSourceManager.registerObservedData(DeepObservedData);
|
||||||
|
|
||||||
const getLocalConfig = (): MApp[] => {
|
const getLocalConfig = (): MApp[] => {
|
||||||
const configStr = localStorage.getItem('magicDSL');
|
const configStr = localStorage.getItem('magicDSL');
|
||||||
if (!configStr) return [];
|
if (!configStr) return [];
|
||||||
|
@ -21,7 +21,7 @@ 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';
|
||||||
import { DataSourceManager } from '@tmagic/data-source';
|
import { DataSourceManager, DeepObservedData } from '@tmagic/data-source';
|
||||||
import type { MApp } from '@tmagic/schema';
|
import type { MApp } from '@tmagic/schema';
|
||||||
import type { RemoveData, SortEventData, UpdateData } from '@tmagic/stage';
|
import type { RemoveData, SortEventData, UpdateData } from '@tmagic/stage';
|
||||||
import { AppContent } from '@tmagic/ui-react';
|
import { AppContent } from '@tmagic/ui-react';
|
||||||
@ -41,6 +41,8 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataSourceManager.registerObservedData(DeepObservedData);
|
||||||
|
|
||||||
Object.entries(dataSources).forEach(([type, ds]: [string, any]) => {
|
Object.entries(dataSources).forEach(([type, ds]: [string, any]) => {
|
||||||
DataSourceManager.register(type, ds);
|
DataSourceManager.register(type, ds);
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
import Core from '@tmagic/core';
|
import Core from '@tmagic/core';
|
||||||
import { DataSourceManager, registerDataSourceOnDemand } from '@tmagic/data-source';
|
import { DataSourceManager, DeepObservedData, registerDataSourceOnDemand } from '@tmagic/data-source';
|
||||||
import { getUrlParam } from '@tmagic/utils';
|
import { getUrlParam } from '@tmagic/utils';
|
||||||
|
|
||||||
import asyncDataSources from '../.tmagic/async-datasource-entry';
|
import asyncDataSources from '../.tmagic/async-datasource-entry';
|
||||||
@ -32,6 +32,8 @@ import { getLocalConfig } from './utils';
|
|||||||
|
|
||||||
import '@tmagic/utils/resetcss.css';
|
import '@tmagic/utils/resetcss.css';
|
||||||
|
|
||||||
|
DataSourceManager.registerObservedData(DeepObservedData);
|
||||||
|
|
||||||
Vue.use(request);
|
Vue.use(request);
|
||||||
|
|
||||||
const dsl = ((getUrlParam('localPreview') ? getLocalConfig() : window.magicDSL) || [])[0] || {};
|
const dsl = ((getUrlParam('localPreview') ? getLocalConfig() : window.magicDSL) || [])[0] || {};
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
import Core from '@tmagic/core';
|
import Core from '@tmagic/core';
|
||||||
import { DataSourceManager } from '@tmagic/data-source';
|
import { DataSourceManager, DeepObservedData } from '@tmagic/data-source';
|
||||||
|
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
import '@tmagic/utils/resetcss.css';
|
import '@tmagic/utils/resetcss.css';
|
||||||
|
|
||||||
|
DataSourceManager.registerObservedData(DeepObservedData);
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
import('../.tmagic/comp-entry'),
|
import('../.tmagic/comp-entry'),
|
||||||
import('../.tmagic/plugin-entry'),
|
import('../.tmagic/plugin-entry'),
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import { createApp, defineAsyncComponent } from 'vue';
|
import { createApp, defineAsyncComponent } from 'vue';
|
||||||
|
|
||||||
import Core from '@tmagic/core';
|
import Core from '@tmagic/core';
|
||||||
import { DataSourceManager, registerDataSourceOnDemand } from '@tmagic/data-source';
|
import { DataSourceManager, DeepObservedData, registerDataSourceOnDemand } from '@tmagic/data-source';
|
||||||
import { getUrlParam } from '@tmagic/utils';
|
import { getUrlParam } from '@tmagic/utils';
|
||||||
|
|
||||||
import components from '../.tmagic/async-comp-entry';
|
import components from '../.tmagic/async-comp-entry';
|
||||||
@ -32,6 +32,8 @@ import { getLocalConfig } from './utils';
|
|||||||
|
|
||||||
import '@tmagic/utils/resetcss.css';
|
import '@tmagic/utils/resetcss.css';
|
||||||
|
|
||||||
|
DataSourceManager.registerObservedData(DeepObservedData);
|
||||||
|
|
||||||
const vueApp = createApp(AppComponent);
|
const vueApp = createApp(AppComponent);
|
||||||
|
|
||||||
vueApp.use(request);
|
vueApp.use(request);
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
|
||||||
import Core from '@tmagic/core';
|
import Core from '@tmagic/core';
|
||||||
import { DataSourceManager } from '@tmagic/data-source';
|
import { DataSourceManager, DeepObservedData } from '@tmagic/data-source';
|
||||||
|
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
import '@tmagic/utils/resetcss.css';
|
import '@tmagic/utils/resetcss.css';
|
||||||
|
|
||||||
|
DataSourceManager.registerObservedData(DeepObservedData);
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
import('../.tmagic/comp-entry'),
|
import('../.tmagic/comp-entry'),
|
||||||
import('../.tmagic/plugin-entry'),
|
import('../.tmagic/plugin-entry'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user