refactor: 将data-source,dep,schema,utils收敛到core,将form,table,stage,design,util收敛到editor
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue';
|
||||
|
||||
import { MForm } from '@tmagic/form';
|
||||
import { MForm } from '@tmagic/editor';
|
||||
|
||||
import { AppProps } from './types';
|
||||
import { useFormConfig } from './useFormConfig';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createForm } from '@tmagic/form';
|
||||
import { createForm } from '@tmagic/editor';
|
||||
|
||||
export default createForm([
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createForm } from '@tmagic/form';
|
||||
import { createForm } from '@tmagic/editor';
|
||||
|
||||
export default createForm([
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { createForm } from '@tmagic/form';
|
||||
import { createForm } from '@tmagic/editor';
|
||||
|
||||
export default createForm([]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { FormConfig } from '@tmagic/form';
|
||||
import type { FormConfig } from '@tmagic/editor';
|
||||
|
||||
import checkbox from './checkbox';
|
||||
import display from './display';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createForm } from '@tmagic/form';
|
||||
import { createForm } from '@tmagic/editor';
|
||||
|
||||
export default createForm([
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { createForm } from '@tmagic/form';
|
||||
import { createForm } from '@tmagic/editor';
|
||||
|
||||
export default createForm([]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createForm } from '@tmagic/form';
|
||||
import { createForm } from '@tmagic/editor';
|
||||
|
||||
export default createForm([
|
||||
{
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { createApp, onBeforeUnmount, Plugin } from 'vue';
|
||||
import cssStyle from 'element-plus/dist/index.css?raw';
|
||||
|
||||
import { editorService, Layout, propsService, uiService } from '@tmagic/editor';
|
||||
import MagicForm, { type FormConfig } from '@tmagic/form';
|
||||
import type StageCore from '@tmagic/stage';
|
||||
import { injectStyle } from '@tmagic/utils';
|
||||
import type { FormConfig, StageCore } from '@tmagic/editor';
|
||||
import { editorService, formPlugin, injectStyle, Layout, propsService, uiService } from '@tmagic/editor';
|
||||
|
||||
import commonConfig from './form-config/common';
|
||||
import App from './App.vue';
|
||||
@@ -52,7 +50,7 @@ export const useRuntime = ({
|
||||
stage,
|
||||
fillConfig,
|
||||
});
|
||||
vueApp.use(MagicForm);
|
||||
vueApp.use(formPlugin);
|
||||
plugins.forEach((plugin) => vueApp.use(plugin));
|
||||
vueApp.mount(el);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
import { type FormConfig, MForm } from '@tmagic/form';
|
||||
import type StageCore from '@tmagic/stage';
|
||||
import type { FormConfig, MForm, StageCore } from '@tmagic/editor';
|
||||
|
||||
export interface AppProps {
|
||||
stage: StageCore;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { computed, nextTick, onBeforeUnmount, reactive, ref } from 'vue';
|
||||
|
||||
import Core from '@tmagic/core';
|
||||
import { type FormConfig, initValue, MForm } from '@tmagic/form';
|
||||
import type { Id, MApp, MNode } from '@tmagic/schema';
|
||||
import type { RemoveData, UpdateData } from '@tmagic/stage';
|
||||
import { getElById, getNodePath, replaceChildNode } from '@tmagic/utils';
|
||||
import type { Id, MApp, MNode } from '@tmagic/core';
|
||||
import TMagicApp from '@tmagic/core';
|
||||
import type { FormConfig, MForm, RemoveData, UpdateData } from '@tmagic/editor';
|
||||
import { getElById, getNodePath, initValue, replaceChildNode } from '@tmagic/editor';
|
||||
|
||||
import { AppProps } from './types';
|
||||
|
||||
@@ -23,7 +22,7 @@ export const useFormConfig = (props: AppProps) => {
|
||||
// @ts-ignore
|
||||
const formConfig = computed(() => props.fillConfig((config.value?.items || []) as FormConfig, mForm));
|
||||
|
||||
let app: Core | undefined = new Core({
|
||||
let app: TMagicApp | undefined = new TMagicApp({
|
||||
ua: contentWindow?.navigator.userAgent,
|
||||
platform: 'editor',
|
||||
});
|
||||
@@ -137,6 +136,7 @@ export const useFormConfig = (props: AppProps) => {
|
||||
contentWindow?.addEventListener('message', runtimeReadyHandler);
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
app?.destroy();
|
||||
app = undefined;
|
||||
contentWindow?.removeEventListener('message', runtimeReadyHandler);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user