From 1023ae8aa4ab72b6e6f9343ed539c112c899a3ac Mon Sep 17 00:00:00 2001 From: "zhili.wzl" Date: Tue, 24 Aug 2021 23:30:59 +0800 Subject: [PATCH] feat(react): support source icons --- packages/playground/src/main.tsx | 2 + packages/react/src/icons/index.ts | 1 + packages/react/src/icons/sources.tsx | 2329 +++++++++++++++++ .../src/widgets/DragSourceWidget/index.tsx | 7 +- .../react/src/widgets/IconWidget/index.tsx | 2 +- 5 files changed, 2334 insertions(+), 7 deletions(-) create mode 100644 packages/react/src/icons/sources.tsx diff --git a/packages/playground/src/main.tsx b/packages/playground/src/main.tsx index 1fbf84105..8532c5c35 100644 --- a/packages/playground/src/main.tsx +++ b/packages/playground/src/main.tsx @@ -39,6 +39,7 @@ GlobalRegistry.registerDesignerProps({ title: `components.${node.props['x-component']}`, draggable: true, inlineLayout: true, + sourceIcon: 'InputSource', propsSchema: { type: 'object', $namespace: 'Field', @@ -115,6 +116,7 @@ GlobalRegistry.registerDesignerProps({ Card: { title: 'components.Card', droppable: true, + sourceIcon: 'CardSource', inlineChildrenLayout: true, // allowAppend: (target, sources) => // sources.every((node) => node.componentName === 'Field'), diff --git a/packages/react/src/icons/index.ts b/packages/react/src/icons/index.ts index 2a5674189..e729cd7de 100644 --- a/packages/react/src/icons/index.ts +++ b/packages/react/src/icons/index.ts @@ -48,3 +48,4 @@ export * from './history' export * from './play' export * from './add' export * from './help' +export * from './sources' diff --git a/packages/react/src/icons/sources.tsx b/packages/react/src/icons/sources.tsx new file mode 100644 index 000000000..7a61c7516 --- /dev/null +++ b/packages/react/src/icons/sources.tsx @@ -0,0 +1,2329 @@ +import React from 'react' + +export const InputSource = ( + + + + + + +) + +export const TextAreaSource = ( + + + + +) + +export const SelectSource = ( + + + + + + + + +) +export const TreeSelectSource = ( + + + + + + + + + + + + + + + +) + +export const CascaderSource = ( + + + + + + + + + + + +) + +export const RadioGroupSource = ( + + + + + + + + + + + + + +) + +export const CheckboxGroupSource = ( + + + + + + + + +) + +export const SliderSource = ( + + + + + + + + +) + +export const RateSource = ( + + + + + +) +export const DatePickerSource = { + light: ( + + + + + + + + + + + + + + + + + + + + + + + ), + dark: ( + + + + + + + + + + + + + + + + + + + + + + + ), +} + +export const DateRangePickerSource = { + light: ( + + + + + + + + + + + + + + + + + + + + + + + ), + dark: ( + + + + + + + + + + + + + + + + + + + + + + + ), +} + +export const TimePickerSource = ( + + + + + + + + + +) + +export const TimeRangePickerSource = ( + + + + + + + + + + + + + + + + + +) + +export const NumberPickerSource = ( + + + + + + + + + + + +) + +export const PasswordSource = { + light: ( + + + + + + + + + + + + + ), + dark: ( + + + + + + + + + + + + + ), +} + +export const TransferSource = ( + + + + + + + + + +) + +export const UploadSource = ( + + + + + + +) + +export const UploadDraggerSource = ( + + + + + + + + + + +) + +export const SwitchSource = ( + + + + + +) + +export const ObjectSource = ( + + + + + + + + +) + +export const CardSource = { + light: ( + + + + + + + + + ), + dark: ( + + + + + + + + + ), +} + +export const GridSource = ( + + + + + + + + + + +) + +export const FormLayoutSource = ( + + + + + + + + + + + +) + +export const SpaceSource = ( + + + + + + + +) + +export const TabSource = { + light: ( + + + + + + + + + + + + + ), + dark: ( + + + + + + + + + + + + + ), +} + +export const CollapseSource = { + light: ( + + + + + + + + + + + + + ), + dark: ( + + + + + + + + + + + + + ), +} + +export const ArrayCardsSource = ( + + + + + + + + + +) + +export const ArrayTableSource = { + light: ( + + + + + + + + + + + + + + + ), + dark: ( + + + + + + + + + + + + + + + ), +} diff --git a/packages/react/src/widgets/DragSourceWidget/index.tsx b/packages/react/src/widgets/DragSourceWidget/index.tsx index 1dc4019f6..8b175a86a 100644 --- a/packages/react/src/widgets/DragSourceWidget/index.tsx +++ b/packages/react/src/widgets/DragSourceWidget/index.tsx @@ -34,12 +34,7 @@ export const DragSourceWidget: React.FC = observer( {node?.designerProps?.sourceIcon && ( )} {node?.designerProps?.title} diff --git a/packages/react/src/widgets/IconWidget/index.tsx b/packages/react/src/widgets/IconWidget/index.tsx index b9b276c36..77affe5fd 100644 --- a/packages/react/src/widgets/IconWidget/index.tsx +++ b/packages/react/src/widgets/IconWidget/index.tsx @@ -54,7 +54,7 @@ export const IconWidget: React.FC & { focusable: 'false', 'aria-hidden': 'true', }) - } else if (infer.type === 'path') { + } else if (infer.type === 'path' || infer.type === 'g') { return (