From 72d5b88736f8873bd0247d6f9cfa18620c6f3fd6 Mon Sep 17 00:00:00 2001 From: mokinzhao Date: Sat, 27 Mar 2021 14:05:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9Acore=20dir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/index.ts | 4 ++++ src/core/{ => renderer}/FormRender.tsx | 18 +++++++++--------- src/core/{ => renderer}/ViewRender.tsx | 0 src/core/{ => renderer}/viewRender.less | 0 src/pages/editor/Container.tsx | 2 +- src/pages/editor/SourceBox.tsx | 2 +- src/pages/editor/preview.tsx | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 src/core/index.ts rename src/core/{ => renderer}/FormRender.tsx (92%) rename src/core/{ => renderer}/ViewRender.tsx (100%) rename src/core/{ => renderer}/viewRender.less (100%) diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 00000000..9131a54a --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,4 @@ +import DynamicEngine from './DynamicEngine'; +import ViewRender from './renderer/ViewRender'; +import FormRender from './renderer/FormRender'; +export { DynamicEngine, ViewRender, FormRender }; diff --git a/src/core/FormRender.tsx b/src/core/renderer/FormRender.tsx similarity index 92% rename from src/core/FormRender.tsx rename to src/core/renderer/FormRender.tsx index 8a924cd9..75ea83d1 100644 --- a/src/core/FormRender.tsx +++ b/src/core/renderer/FormRender.tsx @@ -1,15 +1,15 @@ import React, { memo, RefObject, useEffect } from 'react'; import { Form, Select, InputNumber, Input, Switch, Radio } from 'antd'; -import Upload from './FormComponents/Upload'; -import DataList from './FormComponents/DataList'; -import MutiText from './FormComponents/MutiText'; -import Color from './FormComponents/Color'; -import CardPicker from './FormComponents/CardPicker'; -import Table from './FormComponents/Table'; -import Pos from './FormComponents/Pos'; +import Upload from '../FormComponents/Upload'; +import DataList from '../FormComponents/DataList'; +import MutiText from '../FormComponents/MutiText'; +import Color from '../FormComponents/Color'; +import CardPicker from '../FormComponents/CardPicker'; +import Table from '../FormComponents/Table'; +import Pos from '../FormComponents/Pos'; import { Store } from 'antd/lib/form/interface'; -import RichText from './FormComponents/XEditor'; -import FormItems from './FormComponents/FormItems'; +import RichText from '../FormComponents/XEditor'; +import FormItems from '../FormComponents/FormItems'; const normFile = (e: any) => { console.log('Upload event:', e); if (Array.isArray(e)) { diff --git a/src/core/ViewRender.tsx b/src/core/renderer/ViewRender.tsx similarity index 100% rename from src/core/ViewRender.tsx rename to src/core/renderer/ViewRender.tsx diff --git a/src/core/viewRender.less b/src/core/renderer/viewRender.less similarity index 100% rename from src/core/viewRender.less rename to src/core/renderer/viewRender.less diff --git a/src/pages/editor/Container.tsx b/src/pages/editor/Container.tsx index 56eed21a..acba0644 100644 --- a/src/pages/editor/Container.tsx +++ b/src/pages/editor/Container.tsx @@ -14,7 +14,7 @@ import SourceBox from './SourceBox'; import TargetBox from './TargetBox'; import Calibration from 'components/Calibration'; import DynamicEngine, { componentsType } from '@/core/DynamicEngine'; -import FormRender from '@/core/FormRender'; +import { FormRender } from '@/core'; import template from 'components/BasicShop/BasicComponents/template'; import mediaTpl from 'components/BasicShop/MediaComponents/template'; diff --git a/src/pages/editor/SourceBox.tsx b/src/pages/editor/SourceBox.tsx index ece11182..b91079da 100644 --- a/src/pages/editor/SourceBox.tsx +++ b/src/pages/editor/SourceBox.tsx @@ -3,7 +3,7 @@ import { useDrop } from 'react-dnd'; import Draggable, { DraggableData, DraggableEvent } from 'react-draggable'; import { ItemCallback } from 'react-grid-layout'; import { connect } from 'dva'; -import ViewRender from '@/core/ViewRender'; +import { ViewRender } from '@/core'; import styles from './index.less'; import { uuid } from '@/utils/tool'; import { Dispatch } from 'umi'; diff --git a/src/pages/editor/preview.tsx b/src/pages/editor/preview.tsx index 8356185d..7187734e 100644 --- a/src/pages/editor/preview.tsx +++ b/src/pages/editor/preview.tsx @@ -1,5 +1,5 @@ import React, { CSSProperties, memo, useEffect, useMemo, useRef, useState } from 'react'; -import ViewRender from '@/core/ViewRender'; +import { ViewRender } from '@/core'; import domtoimage from 'dom-to-image'; import req from '@/utils/req'; import { useGetScrollBarWidth } from '@/utils/tool';