diff --git a/src/components/BackTop/index.tsx b/src/components/BackTop/index.tsx deleted file mode 100644 index 64126f0..0000000 --- a/src/components/BackTop/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { memo } from 'react'; -import { BackToTop, Icon } from 'zarm'; -import React from 'react'; -const themeObj = { - simple: { bgColor: '#fff', color: '#999' }, - black: { bgColor: '#000', color: '#fff' }, - danger: { bgColor: '#ff5050', color: '#fff' }, - primary: { bgColor: '#00bc71', color: '#fff' }, - blue: { bgColor: '#06c', color: '#fff' }, -}; -const BackTop = memo((props: { theme: keyof typeof themeObj }) => { - const { theme = 'simple' } = props; - - return ( - -
- -
-
- ); -}); - -export default BackTop; diff --git a/src/components/BasicShop/BasicComponents/List/schema.ts b/src/components/BasicShop/BasicComponents/List/schema.ts index 41f38e0..9529122 100644 --- a/src/components/BasicShop/BasicComponents/List/schema.ts +++ b/src/components/BasicShop/BasicComponents/List/schema.ts @@ -7,7 +7,7 @@ import { TDataListDefaultType, TNumberDefaultType, TSelectDefaultType, -} from '@/components/PanelComponents/FormEditor/types'; +} from '@/core/FormComponents/types'; import { baseConfig, baseDefault, ICommonBaseType } from '../../common'; export type TListSelectKeyType = '60' | '80' | '100' | '120' | '150'; export type TListEditData = Array< diff --git a/src/components/BasicShop/BasicComponents/LongText/schema.ts b/src/components/BasicShop/BasicComponents/LongText/schema.ts index e89dc95..1a2af73 100644 --- a/src/components/BasicShop/BasicComponents/LongText/schema.ts +++ b/src/components/BasicShop/BasicComponents/LongText/schema.ts @@ -7,7 +7,7 @@ import { TNumberDefaultType, TSelectDefaultType, TTextAreaDefaultType, -} from '@/components/PanelComponents/FormEditor/types'; +} from '@/core/FormComponents/types'; export type TLongTextSelectKeyType = 'left' | 'center' | 'right'; export type TLongTextEditData = Array< diff --git a/src/components/BasicShop/BasicComponents/Text/schema.ts b/src/components/BasicShop/BasicComponents/Text/schema.ts index f23ffc7..cbbea30 100644 --- a/src/components/BasicShop/BasicComponents/Text/schema.ts +++ b/src/components/BasicShop/BasicComponents/Text/schema.ts @@ -7,7 +7,7 @@ import { TNumberDefaultType, TSelectDefaultType, TTextDefaultType, -} from '@/components/PanelComponents/FormEditor/types'; +} from '@/core/FormComponents/types'; export type TTextSelectKeyType = 'left' | 'right' | 'center'; export type TTextEditData = Array< diff --git a/src/components/CommonComponents/BasicComponents/Notice/index.tsx b/src/components/CommonComponents/BasicComponents/Notice/index.tsx deleted file mode 100644 index dd3a702..0000000 --- a/src/components/CommonComponents/BasicComponents/Notice/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { NoticeBar } from 'zarm'; -import React, { memo } from 'react'; -import { INoticeConfig } from './schema'; -const Notice = memo((props: INoticeConfig) => { - const { text, speed, theme, isClose = false } = props; - return ( - - {text} - - ); -}); - -export default Notice; diff --git a/src/components/CommonComponents/BasicComponents/Notice/schema.ts b/src/components/CommonComponents/BasicComponents/Notice/schema.ts deleted file mode 100644 index 5d84168..0000000 --- a/src/components/CommonComponents/BasicComponents/Notice/schema.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { - INumberConfigType, - ISelectConfigType, - ISwitchConfigType, - ITextConfigType, - TNumberDefaultType, - TSelectDefaultType, - TSwitchDefaultType, - TTextDefaultType, -} from '@/components/PanelComponents/FormEditor/types'; - -export type TNoticeSelectKeyType = 'default' | 'warning' | 'primary' | 'success' | 'danger'; -export type TNoticeEditData = Array< - ITextConfigType | INumberConfigType | ISelectConfigType | ISwitchConfigType ->; -export interface INoticeConfig { - text: TTextDefaultType; - speed: TNumberDefaultType; - theme: TSelectDefaultType; - isClose: TSwitchDefaultType; -} - -export interface INoticeSchema { - editData: TNoticeEditData; - config: INoticeConfig; -} - -const Notice: INoticeSchema = { - editData: [ - { - key: 'text', - name: '文本', - type: 'Text', - }, - { - key: 'speed', - name: '滚动速度', - type: 'Number', - }, - { - key: 'theme', - name: '主题', - type: 'Select', - range: [ - { - key: 'default', - text: '默认', - }, - { - key: 'warning', - text: '警告', - }, - { - key: 'primary', - text: '主要', - }, - { - key: 'success', - text: '成功', - }, - { - key: 'danger', - text: '危险', - }, - ], - }, - { - key: 'isClose', - name: '是否可关闭', - type: 'Switch', - }, - ], - config: { - text: '通知栏: 趣谈前端上线啦', - speed: 50, - theme: 'warning', - isClose: false, - }, -}; - -export default Notice; diff --git a/src/components/CommonComponents/BasicComponents/Notice/template.ts b/src/components/CommonComponents/BasicComponents/Notice/template.ts deleted file mode 100644 index fd0e415..0000000 --- a/src/components/CommonComponents/BasicComponents/Notice/template.ts +++ /dev/null @@ -1,5 +0,0 @@ -const template = { - type: 'Notice', - h: 20, -}; -export default template; diff --git a/src/components/CommonComponents/BasicComponents/Tab/index.less b/src/components/CommonComponents/BasicComponents/Tab/index.less deleted file mode 100644 index 1583925..0000000 --- a/src/components/CommonComponents/BasicComponents/Tab/index.less +++ /dev/null @@ -1,27 +0,0 @@ -.tabWrap { - padding-top: 16px; - padding-bottom: 16px; - .content { - display: flex; - flex-wrap: wrap; - .item { - padding: 20px 20px 0; - width: 50%; - text-align: center; - justify-content: center; - .imgWrap { - display: inline-block; - width: 80%; - img { - border-radius: 6px; - width: 120px; - height: 120px; - object-fit: cover; - } - .title { - line-height: 2.4; - } - } - } - } -} diff --git a/src/components/CommonComponents/BasicComponents/Tab/index.tsx b/src/components/CommonComponents/BasicComponents/Tab/index.tsx deleted file mode 100644 index d4a6162..0000000 --- a/src/components/CommonComponents/BasicComponents/Tab/index.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React, { useEffect, useRef } from 'react'; -import { Tabs } from 'zarm'; -import styles from './index.less'; -import { ITabConfig } from './schema'; - -const { Panel } = Tabs; - -const XTab = (props: ITabConfig) => { - const { tabs = ['分类一', '分类二'], activeColor, color, fontSize, sourceData } = props; - - const tabWrapRef = useRef(null); - - useEffect(() => { - if (tabWrapRef.current) { - let res = tabWrapRef.current.querySelector('.za-tabs__line') as HTMLElement; - if (res) { - res.style.backgroundColor = activeColor; - } - } - }, [activeColor]); - - return ( -
- - {tabs.map((item, i) => { - return ( - -
- {sourceData - .filter(item => item.type === i) - .map((item, i) => { - return ( - - ); - })} -
-
- ); - })} -
-
- ); -}; - -export default XTab; diff --git a/src/components/CommonComponents/BasicComponents/Tab/schema.ts b/src/components/CommonComponents/BasicComponents/Tab/schema.ts deleted file mode 100644 index 9ba1794..0000000 --- a/src/components/CommonComponents/BasicComponents/Tab/schema.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { - IColorConfigType, - IDataListConfigType, - IMutiTextConfigType, - INumberConfigType, - TColorDefaultType, - TDataListDefaultType, - TMutiTextDefaultType, - TNumberDefaultType, -} from '@/components/PanelComponents/FormEditor/types'; - -export type TTabEditData = Array< - IMutiTextConfigType | IColorConfigType | INumberConfigType | IDataListConfigType ->; -export interface ITabConfig { - tabs: TMutiTextDefaultType; - color: TColorDefaultType; - activeColor: TColorDefaultType; - fontSize: TNumberDefaultType; - imgSize: TNumberDefaultType; - sourceData: TDataListDefaultType; -} - -export interface ITabSchema { - editData: TTabEditData; - config: ITabConfig; -} - -const Tab: ITabSchema = { - editData: [ - { - key: 'tabs', - name: '项目类别', - type: 'MutiText', - }, - { - key: 'activeColor', - name: '激活颜色', - type: 'Color', - }, - { - key: 'color', - name: '文字颜色', - type: 'Color', - }, - { - key: 'fontSize', - name: '文字大小', - type: 'Number', - }, - { - key: 'imgSize', - name: '图片大小', - type: 'Number', - }, - { - key: 'sourceData', - name: '数据源', - type: 'DataList', - }, - ], - config: { - tabs: ['类别一', '类别二'], - color: 'rgba(153,153,153,1)', - activeColor: 'rgba(0,102,204,1)', - fontSize: 16, - imgSize: 100, - sourceData: [ - { - id: '1', - title: '趣谈小课1', - desc: '致力于打造优质小课程', - link: 'xxxxx', - type: 0, - imgUrl: [ - { - uid: '001', - name: 'image.png', - status: 'done', - url: 'http://io.nainor.com/uploads/1_1740c6fbcd9.png', - }, - ], - }, - { - id: '2', - title: '趣谈小课2', - desc: '致力于打造优质小课程', - link: 'xxxxx', - type: 0, - imgUrl: [ - { - uid: '001', - name: 'image.png', - status: 'done', - url: 'http://io.nainor.com/uploads/2_1740c7033a9.png', - }, - ], - }, - { - id: '3', - title: '趣谈小课3', - desc: '致力于打造优质小课程', - link: 'xxxxx', - type: 1, - imgUrl: [ - { - uid: '001', - name: 'image.png', - status: 'done', - url: 'http://io.nainor.com/uploads/1_1740c6fbcd9.png', - }, - ], - }, - ], - }, -}; - -export default Tab; diff --git a/src/components/CommonComponents/BasicComponents/Tab/template.ts b/src/components/CommonComponents/BasicComponents/Tab/template.ts deleted file mode 100644 index dbab411..0000000 --- a/src/components/CommonComponents/BasicComponents/Tab/template.ts +++ /dev/null @@ -1,5 +0,0 @@ -const template = { - type: 'Tab', - h: 130, -}; -export default template; diff --git a/src/components/CommonComponents/BasicComponents/schema.ts b/src/components/CommonComponents/BasicComponents/schema.ts deleted file mode 100644 index 983dff2..0000000 --- a/src/components/CommonComponents/BasicComponents/schema.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Carousel from './Carousel/schema'; -import Footer from './Footer/schema'; -import Form from './Form/schema'; -import Header from './Header/schema'; -import Icon from './Icon/schema'; -import Image from './Image/schema'; -import List from './List/schema'; -import LongText from './LongText/schema'; -import Notice from './Notice/schema'; -import Qrcode from './Qrcode/schema'; -import Tab from './Tab/schema'; -import Text from './Text/schema'; - -const basicSchema = { - Carousel, - Footer, - Form, - Header, - Icon, - Image, - List, - LongText, - Notice, - Qrcode, - Tab, - Text, -}; -export default basicSchema; diff --git a/src/components/CommonComponents/BasicComponents/template.ts b/src/components/CommonComponents/BasicComponents/template.ts deleted file mode 100644 index ae567de..0000000 --- a/src/components/CommonComponents/BasicComponents/template.ts +++ /dev/null @@ -1,32 +0,0 @@ -import Carousel from './Carousel/template'; -import Footer from './Footer/template'; -import Form from './Form/template'; -import Header from './Header/template'; -import Icon from './Icon/template'; -import Image from './Image/template'; -import List from './List/template'; -import LongText from './LongText/template'; -import Notice from './Notice/template'; -import Qrcode from './Qrcode/template'; -import Tab from './Tab/template'; -import Text from './Text/template'; - -const basicTemplate = [ - Carousel, - Footer, - Form, - Header, - Icon, - Image, - List, - LongText, - Notice, - Qrcode, - Tab, - Text, -]; -const BasicTemplate = basicTemplate.map(v => { - return { ...v, category: 'base' }; -}); - -export default BasicTemplate; diff --git a/src/components/CommonComponents/VisualComponents/Carousel/index.less b/src/components/CommonComponents/VisualComponents/Carousel/index.less deleted file mode 100644 index 44c9f46..0000000 --- a/src/components/CommonComponents/VisualComponents/Carousel/index.less +++ /dev/null @@ -1,10 +0,0 @@ -.carousel__item__pic { - display: inline-block; - width: 100%; - max-height: 220px; - overflow: hidden; - vertical-align: top; - img { - width: 100%; - } -} diff --git a/src/components/CommonComponents/VisualComponents/Carousel/index.tsx b/src/components/CommonComponents/VisualComponents/Carousel/index.tsx deleted file mode 100644 index a2a5ee9..0000000 --- a/src/components/CommonComponents/VisualComponents/Carousel/index.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React, { memo, PropsWithChildren } from 'react'; -import { Carousel } from 'zarm'; -import styles from './index.less'; -import { ICarouselConfig } from './schema'; - -interface CarouselTypes extends ICarouselConfig { - isTpl: boolean; -} - -const XCarousel = memo((props: PropsWithChildren) => { - const { direction, swipeable, autoPlay, isTpl, imgList, tplImg } = props; - const contentRender = () => { - return imgList.map((item, i) => { - return ( -
- 0 ? item.imgUrl[0].url : ''} alt="" /> -
- ); - }); - }; - return ( -
- {isTpl ? ( -
- -
- ) : ( - { - // console.log(`onChange: ${index}`); - }} - direction={direction} - swipeable={swipeable} - autoPlay={autoPlay} - loop - > - {contentRender()} - - )} -
- ); -}); - -export default XCarousel; diff --git a/src/components/CommonComponents/VisualComponents/Carousel/schema.ts b/src/components/CommonComponents/VisualComponents/Carousel/schema.ts deleted file mode 100644 index a8ade45..0000000 --- a/src/components/CommonComponents/VisualComponents/Carousel/schema.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { - IDataListConfigType, - IRadioConfigType, - ISwitchConfigType, - TDataListDefaultType, - TRadioDefaultType, - TSwitchDefaultType, -} from '@/components/PanelComponents/FormEditor/types'; - -export type CarouselDirectionKeyType = 'down' | 'left'; - -export type TCarouselEditData = Array< - IRadioConfigType | ISwitchConfigType | IDataListConfigType ->; -export interface ICarouselConfig { - direction: TRadioDefaultType; - swipeable: TSwitchDefaultType; - autoPlay: TSwitchDefaultType; - imgList: TDataListDefaultType; - tplImg: string; -} - -export interface ICarouselSchema { - editData: TCarouselEditData; - config: ICarouselConfig; -} - -const Carousel: ICarouselSchema = { - editData: [ - { - key: 'direction', - name: '方向', - type: 'Radio', - range: [ - { - key: 'down', - text: '从上到下', - }, - { - key: 'left', - text: '从左到右', - }, - ], - }, - { - key: 'swipeable', - name: '是否可拖拽', - type: 'Switch', - }, - { - key: 'autoPlay', - name: '是否自动播放', - type: 'Switch', - }, - { - key: 'imgList', - name: '图片列表', - type: 'DataList', - }, - ], - config: { - direction: 'left', - swipeable: false, - autoPlay: false, - imgList: [ - { - id: '1', - title: '趣谈小课1', - desc: '致力于打造优质小课程', - link: 'xxxxx', - imgUrl: [ - { - uid: '001', - name: 'image.png', - status: 'done', - url: 'http://io.nainor.com/uploads/1_1740bd7c3dc.png', - }, - ], - }, - { - id: '2', - title: '趣谈小课1', - desc: '致力于打造优质小课程', - link: 'xxxxx', - imgUrl: [ - { - uid: '001', - name: 'image.png', - status: 'done', - url: 'http://io.nainor.com/uploads/2_1740bd8d525.png', - }, - ], - }, - ], - tplImg: 'http://io.nainor.com/uploads/carousal_17442e1420f.png', - }, -}; -export default Carousel; diff --git a/src/components/CommonComponents/VisualComponents/Carousel/template.ts b/src/components/CommonComponents/VisualComponents/Carousel/template.ts deleted file mode 100644 index b915ba4..0000000 --- a/src/components/CommonComponents/VisualComponents/Carousel/template.ts +++ /dev/null @@ -1,5 +0,0 @@ -const template = { - type: 'Carousel', - h: 82, -}; -export default template; diff --git a/src/components/CommonComponents/VisualComponents/Form/BaseForm.tsx b/src/components/CommonComponents/VisualComponents/Form/BaseForm.tsx deleted file mode 100644 index 78f4a3f..0000000 --- a/src/components/CommonComponents/VisualComponents/Form/BaseForm.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { Input, Cell, DateSelect, Radio, Select } from 'zarm'; -import styles from './baseForm.less'; -import React from 'react'; -import { - baseFormDateTpl, - baseFormMyRadioTpl, - baseFormMySelectTpl, - baseFormNumberTpl, - baseFormTextAreaTpl, - baseFormTextTpl, - baseFormUnionType, -} from '@/components/PanelComponents/FormEditor/types'; -// 维护表单控件, 提高form渲染性能 - -type TBaseForm = { - [key in baseFormUnionType]: any; -}; - -const BaseForm: TBaseForm = { - Text: (props: baseFormTextTpl & { onChange: (v: string | undefined) => void }) => { - const { label, placeholder, onChange } = props; - return ( - - - - ); - }, - Textarea: (props: baseFormTextAreaTpl & { onChange: (v: string | undefined) => void }) => { - const { label, placeholder, onChange } = props; - return ( - - - - ); - }, - Number: (props: baseFormNumberTpl & { onChange: (v: string | undefined | number) => void }) => { - const { label, placeholder, onChange } = props; - return ( - - - - ); - }, - MyRadio: (props: baseFormMyRadioTpl & { onChange: (v: string | undefined | number) => void }) => { - const { label, options, onChange } = props; - return ( -
-
{label}
- - - {options.map((item, i) => { - return ( - - {item.label} - - ); - })} - - -
- ); - }, - Date: (props: baseFormDateTpl & { onChange: (v: Date) => void }) => { - const { label, placeholder, onChange } = props; - return ( - - - - ); - }, - MySelect: ( - props: baseFormMySelectTpl & { onChange: ((v: Record) => void) | undefined }, - ) => { - const { label, options, onChange } = props; - return ( - -