From dcfef5ddb6ab123e6ad4d33bbcab3e2fe555d31f Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Wed, 1 Jun 2022 21:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=E7=A4=BA=E4=BE=8B=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=B7=91=E8=B5=B7=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/components/App.tsx | 4 +- examples/components/Doc.tsx | 2 +- examples/components/ECharts.tsx | 2 +- examples/components/Editor.jsx | 6 +- examples/components/Example.jsx | 3 - examples/components/Form/Custom.jsx | 2 +- examples/components/Form/Schem.jsx | 2 +- examples/components/MdRenderer.jsx | 9 +- examples/components/Play.jsx | 12 +- examples/components/SchemaRender.jsx | 8 +- examples/embed.tsx | 8 +- examples/index.html | 128 +++++++++--------- examples/mobile.jsx | 2 +- examples/style.scss | 6 +- package.json | 16 +++ packages/amis-core/package.json | 4 +- packages/amis-core/src/Root.tsx | 1 + packages/amis-core/src/index.tsx | 6 +- packages/amis-core/src/theme.tsx | 4 +- .../amis-core/src/utils/attachmentAdpator.ts | 4 +- packages/amis-core/src/utils/helper.ts | 2 +- packages/amis-core/src/utils/index.ts | 64 ++++++--- packages/amis-core/src/utils/markdown.ts | 12 +- packages/amis-core/src/utils/position.ts | 7 +- packages/amis-ui/package.json | 6 + packages/amis-ui/rollup.config.js | 83 +++++++++--- packages/amis-ui/scss/_thirds.scss | 12 +- 27 files changed, 249 insertions(+), 166 deletions(-) diff --git a/examples/components/App.tsx b/examples/components/App.tsx index 263d94252..718cd767d 100644 --- a/examples/components/App.tsx +++ b/examples/components/App.tsx @@ -11,8 +11,8 @@ import { Select, InputBox } from 'amis'; -import {eachTree, mapTree} from 'amis/lib/utils/helper'; -import 'amis/lib/locale/en-US'; +import {eachTree, mapTree} from 'amis-core'; +import 'amis-ui/lib/locale/en-US'; import {withRouter} from 'react-router'; import DocSearch from './DocSearch'; import Doc from './Doc'; diff --git a/examples/components/Doc.tsx b/examples/components/Doc.tsx index 102d9ac69..53fd66a10 100644 --- a/examples/components/Doc.tsx +++ b/examples/components/Doc.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {Switch} from 'react-router-dom'; -import {flattenTree, filterTree, mapTree} from 'amis/lib/utils/helper'; +import {flattenTree, filterTree, mapTree} from 'amis-core'; import {navigations2route} from './App'; import DocNavCN from './DocNavCN'; diff --git a/examples/components/ECharts.tsx b/examples/components/ECharts.tsx index 22ddd1db1..7b2a51c40 100644 --- a/examples/components/ECharts.tsx +++ b/examples/components/ECharts.tsx @@ -7,7 +7,7 @@ import example from './EChartsEditor/Example'; import {lazyData} from './LazyData'; import React from 'react'; -import Spinner from 'amis/lib/components/Spinner'; +import {Spinner} from 'amis-ui'; const LazyComponent = lazyData( async () => diff --git a/examples/components/Editor.jsx b/examples/components/Editor.jsx index 820c1c472..24c4de86d 100644 --- a/examples/components/Editor.jsx +++ b/examples/components/Editor.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import Editor from 'amis/editor/Editor'; -import Switch from 'amis/components/Switch'; -import Button from 'amis/components/Button'; +import {Editor} from 'amis-ui'; +import {Switch} from 'amis-ui'; +import {Button} from 'amis-ui'; import schema from './Form/Test'; import Portal from 'react-overlays/Portal'; diff --git a/examples/components/Example.jsx b/examples/components/Example.jsx index e3f8c699d..44f03389c 100644 --- a/examples/components/Example.jsx +++ b/examples/components/Example.jsx @@ -117,9 +117,6 @@ import Tab1Schema from './Tabs/Tab1'; import Tab2Schema from './Tabs/Tab2'; import Tab3Schema from './Tabs/Tab3'; -import TestComponent from './Test'; - -import {normalizeLink} from 'amis/utils/normalizeLink'; import {Switch} from 'react-router-dom'; import {navigations2route} from './App'; diff --git a/examples/components/Form/Custom.jsx b/examples/components/Form/Custom.jsx index e7f540ca7..9b0be6cf0 100644 --- a/examples/components/Form/Custom.jsx +++ b/examples/components/Form/Custom.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import {FormItem, Renderer} from 'amis'; +import {FormItem, Renderer} from 'amis-core'; @FormItem({ type: 'my-custom' diff --git a/examples/components/Form/Schem.jsx b/examples/components/Form/Schem.jsx index 498442ef9..0e5a4235e 100644 --- a/examples/components/Form/Schem.jsx +++ b/examples/components/Form/Schem.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import TitleBar from 'amis/components/TitleBar'; +import {TitleBar} from 'amis-ui'; import {render} from 'amis'; const Schema = { diff --git a/examples/components/MdRenderer.jsx b/examples/components/MdRenderer.jsx index 7cf4837cf..76f71dee2 100644 --- a/examples/components/MdRenderer.jsx +++ b/examples/components/MdRenderer.jsx @@ -3,12 +3,9 @@ import React from 'react'; import {findDOMNode} from 'react-dom'; import {createRoot} from 'react-dom/client'; import {getTheme, render} from 'amis'; -import axios from 'axios'; -import TitleBar from 'amis/lib/components/TitleBar'; -import LazyComponent from 'amis/lib/components/LazyComponent'; -import Overlay from 'amis/lib/components/Overlay'; -import PopOver from 'amis/lib/components/PopOver'; -import NestedLinks from 'amis/lib/components/AsideNav'; +import {LazyComponent} from 'amis-core'; +import {Overlay} from 'amis-ui'; +import {PopOver} from 'amis-ui'; import classnames from 'classnames'; import {Link} from 'react-router-dom'; import Play from './Play'; diff --git a/examples/components/Play.jsx b/examples/components/Play.jsx index be344ee75..a58584e29 100644 --- a/examples/components/Play.jsx +++ b/examples/components/Play.jsx @@ -1,15 +1,15 @@ import React from 'react'; import {toast, render, makeTranslator} from 'amis'; -import {normalizeLink} from 'amis/lib/utils/normalizeLink'; -import {isMobile} from 'amis/lib/utils/helper'; -import attachmentAdpator from 'amis/lib/utils/attachmentAdpator'; -import {alert, confirm} from 'amis/lib/components/Alert'; +import {normalizeLink} from 'amis-core'; +import {isMobile} from 'amis-core'; +import {attachmentAdpator} from 'amis-core'; +import {alert, confirm} from 'amis-ui'; import axios from 'axios'; import JSON5 from 'json5'; -import CodeEditor from 'amis/lib/components/Editor'; +import {Editor as CodeEditor} from 'amis-ui'; import copy from 'copy-to-clipboard'; import {matchPath} from 'react-router-dom'; -import Drawer from 'amis/lib/components/Drawer'; +import {Drawer} from 'amis-ui'; const DEFAULT_CONTENT = `{ "$schema": "/schemas/page.json#", diff --git a/examples/components/SchemaRender.jsx b/examples/components/SchemaRender.jsx index a649b0562..65f58fe13 100644 --- a/examples/components/SchemaRender.jsx +++ b/examples/components/SchemaRender.jsx @@ -3,16 +3,14 @@ import {render, toast, Button, LazyComponent, Drawer} from 'amis'; import axios from 'axios'; import Portal from 'react-overlays/Portal'; import {toast} from 'amis'; -import {normalizeLink} from 'amis/lib/utils/normalizeLink'; +import {normalizeLink} from 'amis-core'; import {withRouter} from 'react-router'; -import {matchPath} from 'react-router-dom'; import copy from 'copy-to-clipboard'; -import {qsparse} from 'amis/lib/utils/helper'; +import {qsparse} from 'amis-core'; function loadEditor() { return new Promise(resolve => - require(['amis/lib/components/Editor'], component => - resolve(component.default)) + require(['amis-ui'], component => resolve(component.Editor)) ); } diff --git a/examples/embed.tsx b/examples/embed.tsx index 433419144..6b3607fc5 100644 --- a/examples/embed.tsx +++ b/examples/embed.tsx @@ -4,7 +4,7 @@ import {createRoot} from 'react-dom/client'; import axios from 'axios'; import {match} from 'path-to-regexp'; import copy from 'copy-to-clipboard'; -import {normalizeLink} from 'amis/lib/utils/normalizeLink'; +import {normalizeLink} from 'amis-core'; import qs from 'qs'; import { @@ -17,11 +17,11 @@ import { makeTranslator } from 'amis'; -import 'amis/lib/locale/en-US'; +import 'amis-ui/lib/locale/en-US'; import 'history'; -import attachmentAdpator from 'amis/lib/utils/attachmentAdpator'; +import {attachmentAdpator} from 'amis-core'; -import type {ToastLevel, ToastConf} from 'amis/lib/components/Toast'; +import type {ToastLevel, ToastConf} from 'amis-ui/lib/components/Toast'; export function embed( container: string | HTMLElement, diff --git a/examples/index.html b/examples/index.html index 77123d0f9..491551bf6 100644 --- a/examples/index.html +++ b/examples/index.html @@ -1,36 +1,31 @@ -
- -