diff --git a/packages/arco-lib/src/components/Alert.tsx b/packages/arco-lib/src/components/Alert.tsx index f992d51c..f461a9c7 100644 --- a/packages/arco-lib/src/components/Alert.tsx +++ b/packages/arco-lib/src/components/Alert.tsx @@ -61,6 +61,4 @@ const options = { }, }; -export const Alert = implementRuntimeComponent(options)( - AlertImpl as any -); +export const Alert = implementRuntimeComponent(options)(AlertImpl); diff --git a/packages/arco-lib/src/components/Avatar.tsx b/packages/arco-lib/src/components/Avatar.tsx index 9f90c575..9a075159 100644 --- a/packages/arco-lib/src/components/Avatar.tsx +++ b/packages/arco-lib/src/components/Avatar.tsx @@ -1,9 +1,5 @@ import { Avatar as BaseAvatar } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; -import { createComponent } from "@sunmao-ui/core"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; @@ -15,9 +11,7 @@ const AvatarPropsSchema = Type.Object({ }); const AvatarStateSchema = Type.Object({}); -const AvatarImpl: ComponentImpl> = ( - props -) => { +const AvatarImpl: ComponentImpl> = (props) => { const { slotsElements, customStyle } = props; const { className, ...cProps } = getComponentProps(props); @@ -56,6 +50,4 @@ const options = { }, }; -export const Avatar = implementRuntimeComponent(options)( - AvatarImpl as typeof AvatarImpl & undefined -); +export const Avatar = implementRuntimeComponent(options)(AvatarImpl); diff --git a/packages/arco-lib/src/components/Badge.tsx b/packages/arco-lib/src/components/Badge.tsx index c163d123..b4950999 100644 --- a/packages/arco-lib/src/components/Badge.tsx +++ b/packages/arco-lib/src/components/Badge.tsx @@ -4,56 +4,25 @@ import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; import { BadgePropsSchema as BaseBadgePropsSchema } from "../generated/types/Badge"; -import { useState, useEffect } from "react"; const BadgePropsSchema = Type.Object(BaseBadgePropsSchema); -const BadgeStateSchema = Type.Object({ - count: Type.Number(), - text: Type.String(), -}); +const BadgeStateSchema = Type.Object({}); const BadgeImpl: ComponentImpl> = (props) => { - const { className, defaultCount, defaultText, ...cProps } = - getComponentProps(props); - const { mergeState, customStyle, subscribeMethods, slotsElements } = props; + const { className, ...cProps } = getComponentProps(props); + const { customStyle, slotsElements } = props; - const [count, _setCount] = useState(defaultCount); - const [text, _setText] = useState(defaultText); - - // TODO - // arco如果设置status和color,即使不设置dot=true也会是dot模式,这会造成一些迷惑,所以暂时在这里处理一下 - // 如果不设置dot=true,status和color就无效 + // TODO need to be optimized + // In arco-design, if `status` and `color` are set, even if `dot` is not set, it will be in dot mode + // which will cause some confusion and bug + // If `dot` is not set, delete status and color from props if (!cProps.dot) { Reflect.deleteProperty(cProps, "status"); Reflect.deleteProperty(cProps, "color"); } - useEffect(() => { - mergeState({ count }); - }, [count]); - - useEffect(() => { - mergeState({ text }); - }, [text]); - - useEffect(() => { - subscribeMethods({ - setCount({ count }) { - _setCount(count); - }, - setText({ text }) { - _setText(text); - }, - }); - }); - return ( - + {slotsElements.content} ); @@ -61,9 +30,9 @@ const BadgeImpl: ComponentImpl> = (props) => { const exampleProperties: Static = { // TODO handle dotStyle and color className: "", - defaultCount: 2, - defaultText: "", + text: "", dot: true, + count: 1, maxCount: 99, offset: [6, -2], status: "default", @@ -80,16 +49,11 @@ const options = { spec: { properties: BadgePropsSchema, state: BadgeStateSchema, - methods: { - setCount: Type.String(), - setText: Type.String(), - }, + methods: {}, slots: ["content"], styleSlots: ["content"], - events: [""], + events: [], }, }; -export const Badge = implementRuntimeComponent(options)( - BadgeImpl as typeof BadgeImpl & undefined -); +export const Badge = implementRuntimeComponent(options)(BadgeImpl); diff --git a/packages/arco-lib/src/components/Button.tsx b/packages/arco-lib/src/components/Button.tsx index 62a6dd97..23bbb475 100644 --- a/packages/arco-lib/src/components/Button.tsx +++ b/packages/arco-lib/src/components/Button.tsx @@ -1,8 +1,5 @@ import { Button as BaseButton } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; @@ -14,12 +11,10 @@ const ButtonPropsSchema = Type.Object({ }); const ButtonStateSchema = Type.Object({}); -const ButtonImpl: ComponentImpl> = ( - props -) => { +const ButtonImpl: ComponentImpl> = (props) => { const { slotsElements, customStyle, callbackMap } = props; const { className, ...cProps } = getComponentProps(props); - + return ( ; @@ -58,53 +64,72 @@ const convertArrToTree = (arr: Array>) => { const CascaderImpl: ComponentImpl> = ( props ) => { - const { placeholder, controlled, ...cProps } = getComponentProps(props); - const { - slotsElements, - customStyle, - className, - options, - } = props; + const { multiple, placeholder, ...cProps } = getComponentProps(props); + const { mergeState, slotsElements, customStyle, className, options } = props; const content = slotsElements.content && slotsElements.content[0]; + const mode: "multiple" | undefined = multiple ? "multiple" : undefined; + + let defaultValue = cProps.defaultValue; + if (mode === "multiple" && !Array.isArray(cProps.defaultValue[0])) { + defaultValue = [cProps.defaultValue as string[]]; + } + + const [value, _setValue] = useState(defaultValue); + + // optimize the display when switching from single selection to multiple selection + useEffect(() => { + if (mode === "multiple" && !Array.isArray(value[0])) { + _setValue([value as string[]]); + } + }, [mode]); + + useEffect(() => { + mergeState({ value }); + }, [value, mergeState]); + + const onChange = (value: (string | string[])[]) => { + _setValue(value); + }; + return ( {content} - ) + ); }; const CascaderExampleOptions = [ - ["北京", "朝阳", "大屯里"], - ["北京", "海淀", "smartx"], - ["北京", "昌平"], - ["北京", "望京", "望京soho"], - ["上海", "黄埔"], - ["上海", "浦口", "川沙", "迪士尼"], - ["江苏", "徐州"], - ["江苏", "苏州", "姑苏"], - ["江苏", "苏州", "工业园"], - ["江苏", "南京", "秦淮", "雨花台", "安德门"], - ["江苏", "南京", "秦淮", "雨花台", "铁心桥"], + ["beijing", "chaoyang", "datunli"], + ["beijing", "haidian", "smartx"], + ["beijing", "changping"], + ["beijing", "wangjing", "soho"], + ["shanghai", "huangpu"], + ["shanghai", "pukou", "chuansha", "disney"], + ["jiangsu", "nanjing", "qinhuai", "yuhuatai", "andemen"], + ["jiangsu", "nanjing", "qinhuai", "yuhuatai", "tiexinqiao"], ]; const exampleProperties: Static = { className: "", - defaultValue: ["北京", "海淀", "smartx"], + defaultValue: ["beijing", "haidian", "smartx"], expandTrigger: "click", changeOnSelect: false, unmountOnExit: true, - mode:'single' , + multiple: false, defaultPopupVisible: false, placeholder: "Please select ...", bordered: true, size: "default", - showSearch:false, + showSearch: false, disabled: false, error: false, loading: false, @@ -133,6 +158,4 @@ const options = { }, }; -export const Cascader = implementRuntimeComponent(options)( - CascaderImpl as typeof CascaderImpl & undefined -); +export const Cascader = implementRuntimeComponent(options)(CascaderImpl); diff --git a/packages/arco-lib/src/components/Collapse.tsx b/packages/arco-lib/src/components/Collapse.tsx index 3e2fe917..ae1c94fd 100644 --- a/packages/arco-lib/src/components/Collapse.tsx +++ b/packages/arco-lib/src/components/Collapse.tsx @@ -146,4 +146,4 @@ export const CollapseItem = implementRuntimeComponent({ styleSlots: ["content"], events: [], }, -})(CollapseItemImpl as typeof CollapseItemImpl & undefined); +})(CollapseItemImpl); diff --git a/packages/arco-lib/src/components/Divider.tsx b/packages/arco-lib/src/components/Divider.tsx index 0a77e965..4fdfda9b 100644 --- a/packages/arco-lib/src/components/Divider.tsx +++ b/packages/arco-lib/src/components/Divider.tsx @@ -1,9 +1,5 @@ import { Divider as BaseDivider } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; -import { createComponent } from "@sunmao-ui/core"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; @@ -15,9 +11,9 @@ const DividerPropsSchema = Type.Object({ }); const DividerStateSchema = Type.Object({}); -const DividerImpl: ComponentImpl< - Static -> = (props) => { +const DividerImpl: ComponentImpl> = ( + props +) => { const { customStyle } = props; const { className, ...cProps } = getComponentProps(props); @@ -53,6 +49,4 @@ const options = { }, }; -export const Divider = implementRuntimeComponent(options)( - DividerImpl as typeof DividerImpl & undefined -); +export const Divider = implementRuntimeComponent(options)(DividerImpl); diff --git a/packages/arco-lib/src/components/Dropdown.tsx b/packages/arco-lib/src/components/Dropdown.tsx index 26f4cb4b..d7560bd5 100644 --- a/packages/arco-lib/src/components/Dropdown.tsx +++ b/packages/arco-lib/src/components/Dropdown.tsx @@ -50,5 +50,5 @@ const options = { }; export const Dropdown = implementRuntimeComponent(options)( - DropdownImpl as typeof DropdownImpl & undefined + DropdownImpl ); diff --git a/packages/arco-lib/src/components/Image.tsx b/packages/arco-lib/src/components/Image.tsx index 7d7d2d15..afb8179f 100644 --- a/packages/arco-lib/src/components/Image.tsx +++ b/packages/arco-lib/src/components/Image.tsx @@ -3,7 +3,6 @@ import { ComponentImpl, implementRuntimeComponent, } from "@sunmao-ui/runtime"; -import { createComponent } from "@sunmao-ui/core"; import { css } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; @@ -53,4 +52,4 @@ const options = { events: [], }, }; -export const Image = implementRuntimeComponent(options)(ImageImpl as typeof ImageImpl & undefined); +export const Image = implementRuntimeComponent(options)(ImageImpl); diff --git a/packages/arco-lib/src/components/Input.tsx b/packages/arco-lib/src/components/Input.tsx index 08b364f7..71d5ece1 100644 --- a/packages/arco-lib/src/components/Input.tsx +++ b/packages/arco-lib/src/components/Input.tsx @@ -1,8 +1,5 @@ import { Input as BaseInput } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; @@ -17,9 +14,7 @@ const InputStateSchema = Type.Object({ value: Type.String(), }); -const InputImpl: ComponentImpl> = ( - props -) => { +const InputImpl: ComponentImpl> = (props) => { const { slotsElements, customStyle, callbackMap, mergeState } = props; const { className, defaultValue, ...cProps } = getComponentProps(props); const [value, setValue] = useState(defaultValue); @@ -78,6 +73,4 @@ const options = { }, }; -export const Input = implementRuntimeComponent(options)( - InputImpl as typeof InputImpl & undefined -); +export const Input = implementRuntimeComponent(options)(InputImpl); diff --git a/packages/arco-lib/src/components/Layout.tsx b/packages/arco-lib/src/components/Layout.tsx index 969d54ab..148dbb0d 100644 --- a/packages/arco-lib/src/components/Layout.tsx +++ b/packages/arco-lib/src/components/Layout.tsx @@ -2,10 +2,7 @@ import { Layout as BaseLayout } from "@arco-design/web-react"; import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; -import { - FALLBACK_METADATA, - getComponentProps, -} from "../sunmao-helper"; +import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; import { HeaderPropsSchema as BaseHeaderPropsSchema, FooterPropsSchema as BaseFooterPropsSchema, @@ -20,7 +17,6 @@ const LayoutStateSchema = Type.Object({}); const LayoutImpl: ComponentImpl> = (props) => { const { slotsElements, customStyle } = props; const cProps = getComponentProps(props); - console.log('layout', slotsElements) return ( {slotsElements.content} @@ -330,4 +326,4 @@ export const Sider = implementRuntimeComponent({ styleSlots: ["content"], events: [], }, -})(SiderImpl as typeof SiderImpl & undefined); +})(SiderImpl); diff --git a/packages/arco-lib/src/components/Link.tsx b/packages/arco-lib/src/components/Link.tsx index fe8e2804..04c5d3d7 100644 --- a/packages/arco-lib/src/components/Link.tsx +++ b/packages/arco-lib/src/components/Link.tsx @@ -51,6 +51,4 @@ const options = { }, }; -export const Link = implementRuntimeComponent(options)( - LinkImpl as typeof LinkImpl & undefined -); +export const Link = implementRuntimeComponent(options)(LinkImpl); diff --git a/packages/arco-lib/src/components/Mentions.tsx b/packages/arco-lib/src/components/Mentions.tsx index d78fa2d1..14e5cdff 100644 --- a/packages/arco-lib/src/components/Mentions.tsx +++ b/packages/arco-lib/src/components/Mentions.tsx @@ -81,6 +81,4 @@ const options = { }, }; -export const Mentions = implementRuntimeComponent(options)( - MentionsImpl as typeof MentionsImpl & undefined -); +export const Mentions = implementRuntimeComponent(options)(MentionsImpl); diff --git a/packages/arco-lib/src/components/Menu.tsx b/packages/arco-lib/src/components/Menu.tsx index 0fe7023e..e5c54980 100644 --- a/packages/arco-lib/src/components/Menu.tsx +++ b/packages/arco-lib/src/components/Menu.tsx @@ -1,8 +1,5 @@ import { Menu as BaseMenu } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; @@ -26,9 +23,7 @@ const MenuStateSchema = Type.Object({ activeKey: Type.Optional(Type.String()), }); -const MenuImpl: ComponentImpl> = ( - props -) => { +const MenuImpl: ComponentImpl> = (props) => { const { customStyle, callbackMap, mergeState } = props; const { items = [], className, ...cProps } = getComponentProps(props); const [activeKey, setActiveKey] = useState(); @@ -88,4 +83,4 @@ export const Menu = implementRuntimeComponent({ styleSlots: ["content"], events: ["onClick"], }, -})(MenuImpl as typeof MenuImpl & undefined); +})(MenuImpl); diff --git a/packages/arco-lib/src/components/Popover.tsx b/packages/arco-lib/src/components/Popover.tsx index 4bf24a11..45868b08 100644 --- a/packages/arco-lib/src/components/Popover.tsx +++ b/packages/arco-lib/src/components/Popover.tsx @@ -31,10 +31,10 @@ const PopoverImpl: ComponentImpl> = ( _setPopupVisible(!!visible); }, }); - }, []); + }, [subscribeMethods]); useEffect(() => { mergeState({ visible: popupVisible }); - }, [popupVisible]); + }, [popupVisible, mergeState]); // TODO only support arco componets slot now (same as Tooltip) const content = slotsElements.content && slotsElements.content[0]; @@ -45,11 +45,11 @@ const PopoverImpl: ComponentImpl> = ( {...cProps} content={slotsElements.popupContent} popupVisible={popupVisible} - onVisibleChange={(visible)=>{ - if(visible){ - _setPopupVisible(true) + onVisibleChange={(visible) => { + if (visible) { + _setPopupVisible(true); } - }} + }} > {content} @@ -76,7 +76,7 @@ const exampleProperties: Static = { content: "This is Popover", controlled: false, trigger: "hover", - title:'Title' + title: "Title", }; const options = { @@ -93,12 +93,10 @@ const options = { methods: { setPopupVisible: Type.String(), }, - slots: ["popupContent",'content'], + slots: ["popupContent", "content"], styleSlots: ["content"], events: [], }, }; -export const Popover = implementRuntimeComponent(options)( - PopoverImpl as typeof PopoverImpl & undefined -); +export const Popover = implementRuntimeComponent(options)(PopoverImpl); diff --git a/packages/arco-lib/src/components/Progress.tsx b/packages/arco-lib/src/components/Progress.tsx index 336ea9bf..bef30086 100644 --- a/packages/arco-lib/src/components/Progress.tsx +++ b/packages/arco-lib/src/components/Progress.tsx @@ -1,47 +1,31 @@ import { Progress as BaseProgress } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; import { ProgressPropsSchema as BaseProgressPropsSchema } from "../generated/types/Progress"; -import { useState, useEffect } from "react"; const ProgressPropsSchema = Type.Object(BaseProgressPropsSchema); -const ProgressStateSchema = Type.Object({ - percent: Type.String(), -}); +const ProgressStateSchema = Type.Object({}); -const ProgressImpl: ComponentImpl< - Static -> = (props) => { +const ProgressImpl: ComponentImpl> = ( + props +) => { const { className, ...cProps } = getComponentProps(props); - const { - mergeState, - defaultPercent, - customStyle, - subscribeMethods, - } = props; - const [percent, _setPercent] = useState(defaultPercent); + const { customStyle } = props; - useEffect(() => { - mergeState({percent}); - }, [percent]); - - subscribeMethods({ - setPercent({percent}) { - _setPercent(percent) - }, - }); + let steps = 0; + // step cannot be negative + if (cProps.steps && cProps.steps > 0) { + steps = cProps.steps; + } return ( - + ); }; const exampleProperties: Static = { @@ -53,7 +37,7 @@ const exampleProperties: Static = { color: "red", trailColor: "blue", showText: true, - defaultPercent: 0, + percent: 0, width: 100, size: "default", buffer: false, @@ -71,15 +55,11 @@ const options = { spec: { properties: ProgressPropsSchema, state: ProgressStateSchema, - methods: { - setPercent: Type.String(), - }, + methods: {}, slots: [], styleSlots: ["content"], - events: ["setPercent"], + events: [], }, }; -export const Progress = implementRuntimeComponent(options)( - ProgressImpl as typeof ProgressImpl & undefined -); +export const Progress = implementRuntimeComponent(options)(ProgressImpl); diff --git a/packages/arco-lib/src/components/Select.tsx b/packages/arco-lib/src/components/Select.tsx index a4061515..cebe15cf 100644 --- a/packages/arco-lib/src/components/Select.tsx +++ b/packages/arco-lib/src/components/Select.tsx @@ -101,4 +101,4 @@ export const Select = implementRuntimeComponent({ styleSlots: ["content"], events: ["onChange"], }, -})(SelectImpl as typeof SelectImpl & undefined); +})(SelectImpl); diff --git a/packages/arco-lib/src/components/Skeleton.tsx b/packages/arco-lib/src/components/Skeleton.tsx index 8f51f702..75c7c39c 100644 --- a/packages/arco-lib/src/components/Skeleton.tsx +++ b/packages/arco-lib/src/components/Skeleton.tsx @@ -4,44 +4,20 @@ import { css, cx } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { FALLBACK_METADATA, getComponentProps } from "../sunmao-helper"; import { SkeletonPropsSchema as BaseSkeletonPropsSchema } from "../generated/types/Skeleton"; -import { useState, useEffect } from "react"; const SkeletonPropsSchema = Type.Object(BaseSkeletonPropsSchema); -const SkeletonStateSchema = Type.Object({ - loading: Type.Boolean(), -}); +const SkeletonStateSchema = Type.Object({}); const SkeletonImpl: ComponentImpl> = ( props ) => { - const { defaultLoading, ...cProps } = getComponentProps(props); - const { - customStyle, - className, - slotsElements, - mergeState, - subscribeMethods, - } = props; - - const [loading, _setLoading] = useState(defaultLoading); - - useEffect(() => { - mergeState({ loading }); - }, [loading]); - - useEffect(() => { - subscribeMethods({ - setLoading({ loading }) { - _setLoading(loading); - }, - }); - }, []); + const { ...cProps } = getComponentProps(props); + const { customStyle, className, slotsElements } = props; return ( {slotsElements.content} @@ -51,7 +27,7 @@ const SkeletonImpl: ComponentImpl> = ( const exampleProperties: Static = { className: "", animation: true, - defaultLoading: true, + loading: true, image: false, text: { rows: 3, width: ["100%", 600, 400] }, }; @@ -67,15 +43,11 @@ const options = { spec: { properties: SkeletonPropsSchema, state: SkeletonStateSchema, - methods: { - setLoading: Type.String(), - }, + methods: {}, slots: ["content"], styleSlots: ["content"], events: [], }, }; -export const Skeleton = implementRuntimeComponent(options)( - SkeletonImpl as typeof SkeletonImpl & undefined -); +export const Skeleton = implementRuntimeComponent(options)(SkeletonImpl); diff --git a/packages/arco-lib/src/components/Space.tsx b/packages/arco-lib/src/components/Space.tsx index 013d270f..facb438d 100644 --- a/packages/arco-lib/src/components/Space.tsx +++ b/packages/arco-lib/src/components/Space.tsx @@ -1,8 +1,5 @@ import { Space as BaseSpace } from "@arco-design/web-react"; -import { - ComponentImpl, - implementRuntimeComponent, -} from "@sunmao-ui/runtime"; +import { ComponentImpl, implementRuntimeComponent } from "@sunmao-ui/runtime"; import { css } from "@emotion/css"; import { Type, Static } from "@sinclair/typebox"; import { @@ -21,9 +18,7 @@ const SpacePropsSchema = Type.Object({ }); const SpaceStateSchema = Type.Object({}); -const SpaceImpl: ComponentImpl> = ( - props -) => { +const SpaceImpl: ComponentImpl> = (props) => { const { slotsElements, customStyle } = props; const cProps = getComponentProps(props); @@ -56,4 +51,4 @@ export const Space = implementRuntimeComponent({ styleSlots: ["content"], events: ["onClick"], }, -})(SpaceImpl as typeof SpaceImpl & undefined); +})(SpaceImpl); diff --git a/packages/arco-lib/src/components/Timeline.tsx b/packages/arco-lib/src/components/Timeline.tsx index edd8292a..986e37f0 100644 --- a/packages/arco-lib/src/components/Timeline.tsx +++ b/packages/arco-lib/src/components/Timeline.tsx @@ -82,6 +82,4 @@ const options = { }, }; -export const Timeline = implementRuntimeComponent(options)( - TimelineImpl as typeof TimelineImpl & undefined -); +export const Timeline = implementRuntimeComponent(options)(TimelineImpl); diff --git a/packages/arco-lib/src/components/Tooltip.tsx b/packages/arco-lib/src/components/Tooltip.tsx index 1e02b89f..d4f4c466 100644 --- a/packages/arco-lib/src/components/Tooltip.tsx +++ b/packages/arco-lib/src/components/Tooltip.tsx @@ -70,7 +70,7 @@ const exampleProperties: Static = { disabled: false, content: "This is tooltip", controlled: false, - trigger:['hover','click'] + trigger: ["hover", "click"], }; const options = { @@ -93,6 +93,4 @@ const options = { }, }; -export const Tooltip = implementRuntimeComponent(options)( - TooltipImpl as typeof TooltipImpl & undefined -); +export const Tooltip = implementRuntimeComponent(options)(TooltipImpl); diff --git a/packages/arco-lib/src/components/TreeSelect.tsx b/packages/arco-lib/src/components/TreeSelect.tsx index 32662fe6..f99f0ea2 100644 --- a/packages/arco-lib/src/components/TreeSelect.tsx +++ b/packages/arco-lib/src/components/TreeSelect.tsx @@ -114,6 +114,4 @@ const options = { }, }; -export const TreeSelect = implementRuntimeComponent(options)( - TreeSelectImpl as typeof TreeSelectImpl & undefined -); +export const TreeSelect = implementRuntimeComponent(options)(TreeSelectImpl); diff --git a/packages/arco-lib/src/generated/types/Avatar.ts b/packages/arco-lib/src/generated/types/Avatar.ts index ac4e9a1a..b57c0907 100644 --- a/packages/arco-lib/src/generated/types/Avatar.ts +++ b/packages/arco-lib/src/generated/types/Avatar.ts @@ -1,6 +1,6 @@ import { Type } from "@sinclair/typebox"; -import { IntoStringUnion, StringUnion } from '../../sunmao-helper'; +import { StringUnion } from '../../sunmao-helper'; export const AvatarPropsSchema = { 'shape': Type.Optional(StringUnion(['circle', 'square'])), diff --git a/packages/arco-lib/src/generated/types/Badge.ts b/packages/arco-lib/src/generated/types/Badge.ts index e954e939..a0f05ec8 100644 --- a/packages/arco-lib/src/generated/types/Badge.ts +++ b/packages/arco-lib/src/generated/types/Badge.ts @@ -4,10 +4,9 @@ import { StringUnion } from '../../sunmao-helper'; export const BadgePropsSchema = { className: Type.Optional(Type.String()), - defaultCount: Type.Optional(Type.Number()), - defaultText: Type.Optional(Type.String()), + text:Type.Optional(Type.String()), + count:Type.Optional(Type.Number()), dot: Type.Optional(Type.Boolean()), - dotStyle: Type.Optional(Type.String()), maxCount: Type.Optional(Type.Number()), offset: Type.Optional(Type.Tuple([Type.Number(), Type.Number()])), color: Type.Optional(StringUnion(['red', 'orangered', 'orange', 'gold', 'lime', 'green', 'cyan', 'arcoblue', 'purple', 'pinkpurple', 'magenta', 'gray'])), diff --git a/packages/arco-lib/src/generated/types/Cascader.ts b/packages/arco-lib/src/generated/types/Cascader.ts index 9c982e0c..e90389d4 100644 --- a/packages/arco-lib/src/generated/types/Cascader.ts +++ b/packages/arco-lib/src/generated/types/Cascader.ts @@ -2,15 +2,16 @@ import { Type } from '@sinclair/typebox'; import { StringUnion } from '../../sunmao-helper'; +export const CascaderValueSchema = Type.Array(Type.Union([Type.String(), Type.Array(Type.String())])) + export const CascaderPropsSchema = { className: Type.Optional(Type.String()), - defaultValue: Type.Union([Type.String(), Type.Array(Type.String())]), - expandTrigger: StringUnion(['click','hover']), + expandTrigger: StringUnion(['click', 'hover']), changeOnSelect: Type.Optional(Type.Boolean()), unmountOnExit: Type.Optional(Type.Boolean()), - mode: StringUnion(['multiple','single']), + multiple: Type.Boolean(), defaultPopupVisible: Type.Optional(Type.Boolean()), - showSearch:Type.Optional(Type.Boolean()), + showSearch: Type.Optional(Type.Boolean()), placeholder: Type.Optional(Type.String()), bordered: Type.Optional(Type.Boolean()), size: Type.Optional(StringUnion(['mini', 'small', 'default', 'large'])), @@ -21,5 +22,6 @@ export const CascaderPropsSchema = { allowCreate: Type.Optional(Type.Boolean()), maxTagCount: Type.Optional(Type.Number()), animation: Type.Boolean(), + defaultValue: CascaderValueSchema, options: Type.Array(Type.Array(Type.String())), } \ No newline at end of file diff --git a/packages/arco-lib/src/generated/types/Progress.ts b/packages/arco-lib/src/generated/types/Progress.ts index 068451ac..16bfe2cf 100644 --- a/packages/arco-lib/src/generated/types/Progress.ts +++ b/packages/arco-lib/src/generated/types/Progress.ts @@ -12,7 +12,7 @@ export const ProgressPropsSchema = { color: Type.Optional(Type.Union([Type.String(), Type.Object({ key: Type.String() })])), trailColor:Type.Optional(Type.String()), showText:Type.Optional(Type.Boolean()), - defaultPercent: Type.Number(), + percent: Type.Number(), width:Type.Optional(Type.Union([Type.String(),Type.Number()])), size:Type.Optional(StringUnion(['small' , 'default' , 'mini' , 'large'])), buffer:Type.Optional(Type.Boolean()), diff --git a/packages/arco-lib/src/generated/types/Skeleton.ts b/packages/arco-lib/src/generated/types/Skeleton.ts index 4f2b0a49..84e9c9e8 100644 --- a/packages/arco-lib/src/generated/types/Skeleton.ts +++ b/packages/arco-lib/src/generated/types/Skeleton.ts @@ -21,7 +21,7 @@ export const SkeletonImagePropsSchema = { export const SkeletonPropsSchema = { className: Type.Optional(Type.String()), animation: Type.Optional(Type.Boolean()), - defaultLoading: Type.Optional(Type.Boolean()), + loading: Type.Optional(Type.Boolean()), image: Type.Optional(Type.Union([ Type.Boolean(), Type.Object(SkeletonImagePropsSchema)