chore(runtime): 使用DeepObservedData做完数据源事件模型

This commit is contained in:
roymondchen 2024-06-06 17:42:27 +08:00
parent ac7bb93a37
commit 653cafbe81
6 changed files with 18 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import React from 'react';
import { createRoot } from 'react-dom/client';
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 { AppContent } from '@tmagic/ui-react';
import { getUrlParam } from '@tmagic/utils';
@ -41,6 +41,8 @@ declare global {
}
}
DataSourceManager.registerObservedData(DeepObservedData);
const getLocalConfig = (): MApp[] => {
const configStr = localStorage.getItem('magicDSL');
if (!configStr) return [];

View File

@ -21,7 +21,7 @@ import { createRoot } from 'react-dom/client';
import { cloneDeep } from 'lodash-es';
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 { RemoveData, SortEventData, UpdateData } from '@tmagic/stage';
import { AppContent } from '@tmagic/ui-react';
@ -41,6 +41,8 @@ declare global {
}
}
DataSourceManager.registerObservedData(DeepObservedData);
Object.entries(dataSources).forEach(([type, ds]: [string, any]) => {
DataSourceManager.register(type, ds);
});

View File

@ -19,7 +19,7 @@
import Vue from 'vue';
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 asyncDataSources from '../.tmagic/async-datasource-entry';
@ -32,6 +32,8 @@ import { getLocalConfig } from './utils';
import '@tmagic/utils/resetcss.css';
DataSourceManager.registerObservedData(DeepObservedData);
Vue.use(request);
const dsl = ((getUrlParam('localPreview') ? getLocalConfig() : window.magicDSL) || [])[0] || {};

View File

@ -19,12 +19,14 @@
import Vue from 'vue';
import Core from '@tmagic/core';
import { DataSourceManager } from '@tmagic/data-source';
import { DataSourceManager, DeepObservedData } from '@tmagic/data-source';
import App from './App.vue';
import '@tmagic/utils/resetcss.css';
DataSourceManager.registerObservedData(DeepObservedData);
Promise.all([
import('../.tmagic/comp-entry'),
import('../.tmagic/plugin-entry'),

View File

@ -19,7 +19,7 @@
import { createApp, defineAsyncComponent } from 'vue';
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 components from '../.tmagic/async-comp-entry';
@ -32,6 +32,8 @@ import { getLocalConfig } from './utils';
import '@tmagic/utils/resetcss.css';
DataSourceManager.registerObservedData(DeepObservedData);
const vueApp = createApp(AppComponent);
vueApp.use(request);

View File

@ -19,12 +19,14 @@
import { createApp } from 'vue';
import Core from '@tmagic/core';
import { DataSourceManager } from '@tmagic/data-source';
import { DataSourceManager, DeepObservedData } from '@tmagic/data-source';
import App from './App.vue';
import '@tmagic/utils/resetcss.css';
DataSourceManager.registerObservedData(DeepObservedData);
Promise.all([
import('../.tmagic/comp-entry'),
import('../.tmagic/plugin-entry'),