From 70777e80b6e44c365fa9c09482fcd3c1c55a9acd Mon Sep 17 00:00:00 2001 From: kangwei Date: Tue, 31 Mar 2020 22:13:53 +0800 Subject: [PATCH] refactor: move icons to local --- packages/designer/src/component-meta.ts | 10 +++++----- packages/{globals => designer}/src/icons/clone.tsx | 6 +++--- packages/{globals => designer}/src/icons/component.tsx | 6 +++--- packages/{globals => designer}/src/icons/container.tsx | 6 +++--- packages/{globals => designer}/src/icons/hidden.tsx | 6 +++--- packages/{globals => designer}/src/icons/page.tsx | 6 +++--- packages/{globals => designer}/src/icons/remove.tsx | 6 +++--- packages/{globals => designer}/src/icons/setting.tsx | 6 +++--- packages/globals/src/components/index.ts | 1 + .../{icons/icon-base.tsx => components/svg-icon.tsx} | 2 +- packages/globals/src/icons/index.ts | 8 -------- packages/globals/src/index.ts | 1 - packages/plugin-outline-pane/src/icons/arrow-right.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/cond.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/eye-close.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/eye.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/lock.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/loop.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/slot.tsx | 6 +++--- packages/plugin-outline-pane/src/icons/unlock.tsx | 6 +++--- packages/plugin-zh-en/src/icons/en.tsx | 6 +++--- packages/plugin-zh-en/src/icons/zh.tsx | 6 +++--- 22 files changed, 58 insertions(+), 66 deletions(-) rename packages/{globals => designer}/src/icons/clone.tsx (92%) rename packages/{globals => designer}/src/icons/component.tsx (92%) rename packages/{globals => designer}/src/icons/container.tsx (86%) rename packages/{globals => designer}/src/icons/hidden.tsx (93%) rename packages/{globals => designer}/src/icons/page.tsx (92%) rename packages/{globals => designer}/src/icons/remove.tsx (88%) rename packages/{globals => designer}/src/icons/setting.tsx (94%) rename packages/globals/src/{icons/icon-base.tsx => components/svg-icon.tsx} (96%) delete mode 100644 packages/globals/src/icons/index.ts diff --git a/packages/designer/src/component-meta.ts b/packages/designer/src/component-meta.ts index 37e25902d..4378fe013 100644 --- a/packages/designer/src/component-meta.ts +++ b/packages/designer/src/component-meta.ts @@ -1,9 +1,4 @@ import { - IconRemove, - IconClone, - IconPage, - IconContainer, - IconComponent, ComponentMetadata, NpmInfo, NodeData, @@ -18,6 +13,11 @@ import { import { Node, NodeParent } from './document'; import { Designer } from './designer'; import { intl } from './locale'; +import { IconContainer } from './icons/container'; +import { IconPage } from './icons/page'; +import { IconComponent } from './icons/component'; +import { IconRemove } from './icons/remove'; +import { IconClone } from './icons/clone'; function ensureAList(list?: string | string[]): string[] | null { if (!list) { diff --git a/packages/globals/src/icons/clone.tsx b/packages/designer/src/icons/clone.tsx similarity index 92% rename from packages/globals/src/icons/clone.tsx rename to packages/designer/src/icons/clone.tsx index 12b65a9c9..374f061df 100644 --- a/packages/globals/src/icons/clone.tsx +++ b/packages/designer/src/icons/clone.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from "./icon-base"; +import { SVGIcon, IconProps } from "@ali/lowcode-globals"; export function IconClone(props: IconProps) { return ( - + - + ); } diff --git a/packages/globals/src/icons/component.tsx b/packages/designer/src/icons/component.tsx similarity index 92% rename from packages/globals/src/icons/component.tsx rename to packages/designer/src/icons/component.tsx index a612a5be3..26b99e902 100644 --- a/packages/globals/src/icons/component.tsx +++ b/packages/designer/src/icons/component.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from "./icon-base"; +import { SVGIcon, IconProps } from "@ali/lowcode-globals"; export function IconComponent(props: IconProps) { return ( - + - + ); } IconComponent.displayName = 'Component'; diff --git a/packages/globals/src/icons/container.tsx b/packages/designer/src/icons/container.tsx similarity index 86% rename from packages/globals/src/icons/container.tsx rename to packages/designer/src/icons/container.tsx index c6a928ec5..62a8cffba 100644 --- a/packages/globals/src/icons/container.tsx +++ b/packages/designer/src/icons/container.tsx @@ -1,11 +1,11 @@ -import { IconBase, IconProps } from "./icon-base"; +import { SVGIcon, IconProps } from "@ali/lowcode-globals"; export function IconContainer(props: IconProps) { return ( - + - + ); } IconContainer.displayName = 'Container'; diff --git a/packages/globals/src/icons/hidden.tsx b/packages/designer/src/icons/hidden.tsx similarity index 93% rename from packages/globals/src/icons/hidden.tsx rename to packages/designer/src/icons/hidden.tsx index 85c38d177..e3a001ca4 100644 --- a/packages/globals/src/icons/hidden.tsx +++ b/packages/designer/src/icons/hidden.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from "./icon-base"; +import { SVGIcon, IconProps } from "@ali/lowcode-globals"; export function IconHidden(props: IconProps) { return ( - + - + ); } IconHidden.displayName = 'Hidden'; diff --git a/packages/globals/src/icons/page.tsx b/packages/designer/src/icons/page.tsx similarity index 92% rename from packages/globals/src/icons/page.tsx rename to packages/designer/src/icons/page.tsx index 8f5a770f6..1762b3d94 100644 --- a/packages/globals/src/icons/page.tsx +++ b/packages/designer/src/icons/page.tsx @@ -1,12 +1,12 @@ -import { IconBase, IconProps } from "./icon-base"; +import { SVGIcon, IconProps } from "@ali/lowcode-globals"; export function IconPage(props: IconProps) { return ( - + - + ); } IconPage.displayName = 'Page'; diff --git a/packages/globals/src/icons/remove.tsx b/packages/designer/src/icons/remove.tsx similarity index 88% rename from packages/globals/src/icons/remove.tsx rename to packages/designer/src/icons/remove.tsx index 4e454ac65..e10bd8e04 100644 --- a/packages/globals/src/icons/remove.tsx +++ b/packages/designer/src/icons/remove.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from './icon-base'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconRemove(props: IconProps) { return ( - + - + ); } IconRemove.displayName = 'Remove'; diff --git a/packages/globals/src/icons/setting.tsx b/packages/designer/src/icons/setting.tsx similarity index 94% rename from packages/globals/src/icons/setting.tsx rename to packages/designer/src/icons/setting.tsx index 8b1da4410..d928bda86 100644 --- a/packages/globals/src/icons/setting.tsx +++ b/packages/designer/src/icons/setting.tsx @@ -1,11 +1,11 @@ -import { IconBase, IconProps } from './icon-base'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconSetting(props: IconProps) { return ( - + - + ); } diff --git a/packages/globals/src/components/index.ts b/packages/globals/src/components/index.ts index f6eb9a1ff..196dee25a 100644 --- a/packages/globals/src/components/index.ts +++ b/packages/globals/src/components/index.ts @@ -1,2 +1,3 @@ export * from './tip'; export * from './title'; +export * from './svg-icon'; diff --git a/packages/globals/src/icons/icon-base.tsx b/packages/globals/src/components/svg-icon.tsx similarity index 96% rename from packages/globals/src/icons/icon-base.tsx rename to packages/globals/src/components/svg-icon.tsx index 778761ef0..f389606a8 100644 --- a/packages/globals/src/icons/icon-base.tsx +++ b/packages/globals/src/components/svg-icon.tsx @@ -16,7 +16,7 @@ export interface IconProps { style?: object; } -export function IconBase({ +export function SVGIcon({ fill, size = 'medium', viewBox, diff --git a/packages/globals/src/icons/index.ts b/packages/globals/src/icons/index.ts deleted file mode 100644 index ac8767dc0..000000000 --- a/packages/globals/src/icons/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './clone'; -export * from './hidden'; -export * from './remove'; -export * from './setting'; -export * from './icon-base'; -export * from './component'; -export * from './container'; -export * from './page'; diff --git a/packages/globals/src/index.ts b/packages/globals/src/index.ts index cd2456f92..51d80c5da 100644 --- a/packages/globals/src/index.ts +++ b/packages/globals/src/index.ts @@ -1,7 +1,6 @@ export * from './intl'; export * from './components'; export * from './utils'; -export * from './icons'; export * from './types'; export * from './di'; export * from './obx'; diff --git a/packages/plugin-outline-pane/src/icons/arrow-right.tsx b/packages/plugin-outline-pane/src/icons/arrow-right.tsx index b08be410b..78772d656 100644 --- a/packages/plugin-outline-pane/src/icons/arrow-right.tsx +++ b/packages/plugin-outline-pane/src/icons/arrow-right.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconArrowRight(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/cond.tsx b/packages/plugin-outline-pane/src/icons/cond.tsx index 01a5d6354..53ef29295 100644 --- a/packages/plugin-outline-pane/src/icons/cond.tsx +++ b/packages/plugin-outline-pane/src/icons/cond.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconCond(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/eye-close.tsx b/packages/plugin-outline-pane/src/icons/eye-close.tsx index f8a418a36..7eb56129e 100644 --- a/packages/plugin-outline-pane/src/icons/eye-close.tsx +++ b/packages/plugin-outline-pane/src/icons/eye-close.tsx @@ -1,11 +1,11 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconEyeClose(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/eye.tsx b/packages/plugin-outline-pane/src/icons/eye.tsx index 3a09071ce..aa2f16cd5 100644 --- a/packages/plugin-outline-pane/src/icons/eye.tsx +++ b/packages/plugin-outline-pane/src/icons/eye.tsx @@ -1,11 +1,11 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconEye(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/lock.tsx b/packages/plugin-outline-pane/src/icons/lock.tsx index c6cea059d..e123741d1 100644 --- a/packages/plugin-outline-pane/src/icons/lock.tsx +++ b/packages/plugin-outline-pane/src/icons/lock.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconLock(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/loop.tsx b/packages/plugin-outline-pane/src/icons/loop.tsx index 8e18a6504..85b184a32 100644 --- a/packages/plugin-outline-pane/src/icons/loop.tsx +++ b/packages/plugin-outline-pane/src/icons/loop.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconLoop(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/slot.tsx b/packages/plugin-outline-pane/src/icons/slot.tsx index 08b26951d..973bd3ecd 100644 --- a/packages/plugin-outline-pane/src/icons/slot.tsx +++ b/packages/plugin-outline-pane/src/icons/slot.tsx @@ -1,11 +1,11 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconSlot(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-outline-pane/src/icons/unlock.tsx b/packages/plugin-outline-pane/src/icons/unlock.tsx index f95484929..5384822fd 100644 --- a/packages/plugin-outline-pane/src/icons/unlock.tsx +++ b/packages/plugin-outline-pane/src/icons/unlock.tsx @@ -1,11 +1,11 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconUnlock(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-zh-en/src/icons/en.tsx b/packages/plugin-zh-en/src/icons/en.tsx index 44303ca21..b0c773309 100644 --- a/packages/plugin-zh-en/src/icons/en.tsx +++ b/packages/plugin-zh-en/src/icons/en.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconEn(props: IconProps) { return ( - + - + ); } diff --git a/packages/plugin-zh-en/src/icons/zh.tsx b/packages/plugin-zh-en/src/icons/zh.tsx index 4c4828411..98ddad296 100644 --- a/packages/plugin-zh-en/src/icons/zh.tsx +++ b/packages/plugin-zh-en/src/icons/zh.tsx @@ -1,10 +1,10 @@ -import { IconBase, IconProps } from '@ali/lowcode-globals'; +import { SVGIcon, IconProps } from '@ali/lowcode-globals'; export function IconZh(props: IconProps) { return ( - + - + ); }