diff --git a/packages/icon/index.tsx b/packages/icon/index.tsx index cb4478967..0dd486418 100644 --- a/packages/icon/index.tsx +++ b/packages/icon/index.tsx @@ -15,6 +15,10 @@ export type IconProps = { classPrefix?: string; }; +export type IconEvents = { + onClick?(event: Event): void; +}; + const [sfc] = use('icon'); function Icon( @@ -55,4 +59,4 @@ Icon.props = { } }; -export default sfc(Icon); +export default sfc(Icon); diff --git a/packages/switch-cell/index.js b/packages/switch-cell/index.js deleted file mode 100644 index 367508ef1..000000000 --- a/packages/switch-cell/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import { use } from '../utils'; -import { inherit } from '../utils/functional'; -import Cell from '../cell'; -import Switch from '../switch'; -import { switchProps } from '../switch/shared'; - -const [sfc, bem] = use('switch-cell'); - -function SwitchCell(h, props, slots, ctx) { - return ( - - - - ); -} - -SwitchCell.props = { - ...switchProps, - title: String, - border: Boolean, - size: { - type: String, - default: '24px' - } -}; - -export default sfc(SwitchCell); diff --git a/packages/switch-cell/index.tsx b/packages/switch-cell/index.tsx new file mode 100644 index 000000000..2e9e04369 --- /dev/null +++ b/packages/switch-cell/index.tsx @@ -0,0 +1,48 @@ +import { use } from '../utils'; +import { inherit } from '../utils/functional'; +import Cell from '../cell'; +import Switch, { SwitchEvents } from '../switch'; +import { switchProps, SharedSwitchProps } from '../switch/shared'; + +// Types +import { CreateElement, RenderContext } from 'vue/types'; +import { DefaultSlots } from '../utils/use/sfc'; + +export type SwitchCellProps = SharedSwitchProps & { + size?: string; + title?: string; + border?: boolean; +}; + +const [sfc, bem] = use('switch-cell'); + +function SwitchCell( + h: CreateElement, + props: SwitchCellProps, + slots: DefaultSlots, + ctx: RenderContext +) { + return ( + + + + ); +} + +SwitchCell.props = { + ...switchProps, + title: String, + border: Boolean, + size: { + type: String, + default: '24px' + } +}; + +export default sfc(SwitchCell); diff --git a/packages/utils/use/sfc.ts b/packages/utils/use/sfc.ts index 9d13a2780..bd8495831 100644 --- a/packages/utils/use/sfc.ts +++ b/packages/utils/use/sfc.ts @@ -55,6 +55,8 @@ export type FunctionalComponent< export type TsxBaseProps = { class?: any; style?: any; + // hack for jsx prop spread + props?: any; }; export type TsxComponent = ( props: Props & Events & TsxBaseProps