refactor: 将data-source,dep,schema,utils收敛到core,将form,table,stage,design,util收敛到editor
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
import { inject, onBeforeUnmount, onMounted } from 'vue-demi';
|
||||
|
||||
import type TMagicApp from '@tmagic/core';
|
||||
import type { Id, MNodeInstance } from '@tmagic/schema';
|
||||
import { isDslNode } from '@tmagic/utils';
|
||||
import type { Id, MNodeInstance } from '@tmagic/core';
|
||||
import { isDslNode } from '@tmagic/core';
|
||||
|
||||
interface UseAppOptions<T extends MNodeInstance = MNodeInstance> {
|
||||
config: T;
|
||||
@@ -32,7 +32,7 @@ interface UseAppOptions<T extends MNodeInstance = MNodeInstance> {
|
||||
}
|
||||
|
||||
export const useApp = ({ methods = {}, config, iteratorContainerId, iteratorIndex }: UseAppOptions) => {
|
||||
const app: TMagicApp | undefined = inject('app');
|
||||
const app = inject<TMagicApp>('app');
|
||||
|
||||
const emitData = {
|
||||
config,
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
|
||||
import { inject } from 'vue-demi';
|
||||
|
||||
import type Core from '@tmagic/core';
|
||||
import { toLine } from '@tmagic/utils';
|
||||
import type TMagicApp from '@tmagic/core';
|
||||
import { toLine } from '@tmagic/core';
|
||||
|
||||
interface UseComponentOptions {
|
||||
/** 组件类型 */
|
||||
componentType?: string;
|
||||
/** App 实例 */
|
||||
app?: Core;
|
||||
app?: TMagicApp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ interface UseComponentOptions {
|
||||
*/
|
||||
export function useComponent<Component = any>(options: string | UseComponentOptions = '') {
|
||||
let componentType: string | undefined;
|
||||
let app: Core | undefined;
|
||||
let app: TMagicApp | undefined;
|
||||
let component: Component | undefined;
|
||||
|
||||
if (typeof options === 'string') {
|
||||
@@ -48,7 +48,7 @@ export function useComponent<Component = any>(options: string | UseComponentOpti
|
||||
componentType = 'container';
|
||||
}
|
||||
if (!app) {
|
||||
app = inject('app');
|
||||
app = inject<TMagicApp>('app');
|
||||
}
|
||||
|
||||
component = resolveComponent({ componentType, app });
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { nextTick, onBeforeUnmount, reactive, ref } from 'vue-demi';
|
||||
|
||||
import Core from '@tmagic/core';
|
||||
import type { ChangeEvent } from '@tmagic/data-source';
|
||||
import type { MNode } from '@tmagic/schema';
|
||||
import { isPage, replaceChildNode } from '@tmagic/utils';
|
||||
import type TMagicCore from '@tmagic/core';
|
||||
import type { ChangeEvent, MNode } from '@tmagic/core';
|
||||
import { isPage, replaceChildNode } from '@tmagic/core';
|
||||
|
||||
export const useDsl = (app: Core | undefined) => {
|
||||
export const useDsl = (app?: TMagicCore) => {
|
||||
const pageConfig = ref(app?.page?.data || {});
|
||||
|
||||
const updateDataHandler = (nodes: MNode[], sourceId: string, changeEvent: ChangeEvent) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue-demi';
|
||||
|
||||
import Core from '@tmagic/core';
|
||||
import type { Id, MApp, MNode } from '@tmagic/schema';
|
||||
import type TMagicApp from '@tmagic/core';
|
||||
import type { Id, MApp, MNode } from '@tmagic/core';
|
||||
import { getElById, getNodePath, replaceChildNode } from '@tmagic/core';
|
||||
import type { Magic, RemoveData, UpdateData } from '@tmagic/stage';
|
||||
import { getElById, getNodePath, replaceChildNode } from '@tmagic/utils';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -11,7 +11,7 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
export const useEditorDsl = (app: Core | undefined, win = window) => {
|
||||
export const useEditorDsl = (app: TMagicApp | undefined, win = window) => {
|
||||
const root = ref<MApp>();
|
||||
const curPageId = ref<Id>();
|
||||
const selectedId = ref<Id>();
|
||||
|
||||
Reference in New Issue
Block a user