From 120980cb5c11641da447b527e56893942eed9d07 Mon Sep 17 00:00:00 2001 From: bqy_fe <1743369777@qq.com> Date: Fri, 18 Mar 2022 09:30:37 +0800 Subject: [PATCH] feat(components): export multiple components props (#5353) --- components/affix/index.tsx | 2 +- components/anchor/AnchorLink.tsx | 2 +- components/auto-complete/index.tsx | 2 +- components/badge/Ribbon.tsx | 2 +- components/breadcrumb/Breadcrumb.tsx | 2 +- components/breadcrumb/BreadcrumbItem.tsx | 2 +- components/breadcrumb/BreadcrumbSeparator.tsx | 2 +- components/button/buttonTypes.ts | 2 +- components/card/Card.tsx | 2 +- components/descriptions/index.tsx | 2 +- components/drawer/index.tsx | 2 +- components/grid/Col.tsx | 2 +- components/mentions/index.tsx | 2 +- components/menu/src/ItemGroup.tsx | 2 +- components/menu/src/MenuItem.tsx | 2 +- components/menu/src/SubMenu.tsx | 2 +- components/progress/Line.tsx | 2 +- components/progress/Steps.tsx | 2 +- components/radio/Group.tsx | 2 +- components/space/index.tsx | 2 +- components/switch/index.tsx | 2 +- components/tabs/src/TabNavList/OperationNode.tsx | 2 +- components/tabs/src/TabNavList/index.tsx | 2 +- components/tag/index.tsx | 2 +- components/time-picker/time-picker.tsx | 2 +- components/tree/DirectoryTree.tsx | 2 +- components/vc-align/Align.tsx | 2 +- components/vc-checkbox/Checkbox.tsx | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/components/affix/index.tsx b/components/affix/index.tsx index aa451f51f..cbb066658 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -41,7 +41,7 @@ export interface AffixState { } // Affix -const affixProps = { +export const affixProps = { /** * 距离窗口顶部达到指定偏移量后触发 */ diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 88a78ce1e..6981e0a07 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -6,7 +6,7 @@ import classNames from '../_util/classNames'; import useConfigInject from '../_util/hooks/useConfigInject'; import { useInjectAnchor } from './context'; -const anchorLinkProps = { +export const anchorLinkProps = { prefixCls: PropTypes.string, href: PropTypes.string.def('#'), title: PropTypes.any, diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index bfcdb2313..6ce8ef91f 100644 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -13,7 +13,7 @@ function isSelectOptionOrSelectOptGroup(child: any): boolean { return child?.type?.isSelectOption || child?.type?.isSelectOptGroup; } -const autoCompleteProps = { +export const autoCompleteProps = { ...omit(selectProps(), ['loading', 'mode', 'optionLabelProp', 'labelInValue']), dataSource: PropTypes.array, dropdownMenuStyle: PropTypes.style, diff --git a/components/badge/Ribbon.tsx b/components/badge/Ribbon.tsx index f33704322..58d0f6aae 100644 --- a/components/badge/Ribbon.tsx +++ b/components/badge/Ribbon.tsx @@ -7,7 +7,7 @@ import { defineComponent, computed } from 'vue'; import PropTypes from '../_util/vue-types'; import useConfigInject from '../_util/hooks/useConfigInject'; -const ribbonProps = { +export const ribbonProps = { prefix: PropTypes.string, color: { type: String as PropType> }, text: PropTypes.any, diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index ca09e0ab4..c305ed977 100644 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -14,7 +14,7 @@ export interface Route { children?: Omit[]; } -const breadcrumbProps = { +export const breadcrumbProps = { prefixCls: PropTypes.string, routes: { type: Array as PropType }, params: PropTypes.any, diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index 3f58bd597..89c7b9b2d 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -6,7 +6,7 @@ import DropDown from '../dropdown/dropdown'; import DownOutlined from '@ant-design/icons-vue/DownOutlined'; import useConfigInject from '../_util/hooks/useConfigInject'; -const breadcrumbItemProps = { +export const breadcrumbItemProps = { prefixCls: PropTypes.string, href: PropTypes.string, separator: PropTypes.any, diff --git a/components/breadcrumb/BreadcrumbSeparator.tsx b/components/breadcrumb/BreadcrumbSeparator.tsx index caccfd2bd..6d2c44310 100644 --- a/components/breadcrumb/BreadcrumbSeparator.tsx +++ b/components/breadcrumb/BreadcrumbSeparator.tsx @@ -4,7 +4,7 @@ import PropTypes from '../_util/vue-types'; import { flattenChildren } from '../_util/props-util'; import useConfigInject from '../_util/hooks/useConfigInject'; -const breadcrumbSeparatorProps = { +export const breadcrumbSeparatorProps = { prefixCls: PropTypes.string, }; export type BreadcrumbSeparatorProps = Partial>; diff --git a/components/button/buttonTypes.ts b/components/button/buttonTypes.ts index d668cad10..4d097fa0a 100644 --- a/components/button/buttonTypes.ts +++ b/components/button/buttonTypes.ts @@ -20,7 +20,7 @@ export function convertLegacyProps(type?: LegacyButtonType): ButtonProps { return { type }; } -const buttonProps = () => ({ +export const buttonProps = () => ({ prefixCls: PropTypes.string, type: PropTypes.oneOf(ButtonTypes), htmlType: PropTypes.oneOf(ButtonHTMLTypes).def('button'), diff --git a/components/card/Card.tsx b/components/card/Card.tsx index e968d7999..434c616b4 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -23,7 +23,7 @@ export type CardSize = 'default' | 'small'; const { TabPane } = Tabs; -const cardProps = () => ({ +export const cardProps = () => ({ prefixCls: PropTypes.string, title: PropTypes.any, extra: PropTypes.any, diff --git a/components/descriptions/index.tsx b/components/descriptions/index.tsx index 4f782e381..43522abb2 100644 --- a/components/descriptions/index.tsx +++ b/components/descriptions/index.tsx @@ -128,7 +128,7 @@ function getRows(children: VNode[], column: number) { return rows; } -const descriptionsProps = { +export const descriptionsProps = { prefixCls: PropTypes.string, bordered: PropTypes.looseBool, size: PropTypes.oneOf(tuple('default', 'middle', 'small')).def('default'), diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 232646954..29c08b6f7 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -34,7 +34,7 @@ export interface PushState { const defaultPushState: PushState = { distance: 180 }; -const drawerProps = () => ({ +export const drawerProps = () => ({ autofocus: PropTypes.looseBool, closable: PropTypes.looseBool, closeIcon: PropTypes.any, diff --git a/components/grid/Col.tsx b/components/grid/Col.tsx index 0f28612c6..f3056fa3e 100644 --- a/components/grid/Col.tsx +++ b/components/grid/Col.tsx @@ -28,7 +28,7 @@ function parseFlex(flex: FlexType): string { return flex; } -const colProps = () => ({ +export const colProps = () => ({ span: [String, Number], order: [String, Number], offset: [String, Number], diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx index 81089b4ac..f62f085a2 100644 --- a/components/mentions/index.tsx +++ b/components/mentions/index.tsx @@ -58,7 +58,7 @@ const getMentions = (value = '', config: MentionsConfig = {}): MentionsEntity[] .filter((entity): entity is MentionsEntity => !!entity && !!entity.value); }; -const mentionsProps = { +export const mentionsProps = { ...baseMentionsProps, loading: PropTypes.looseBool, onFocus: { diff --git a/components/menu/src/ItemGroup.tsx b/components/menu/src/ItemGroup.tsx index 589e4117a..ba8d2d660 100644 --- a/components/menu/src/ItemGroup.tsx +++ b/components/menu/src/ItemGroup.tsx @@ -5,7 +5,7 @@ import PropTypes from '../../_util/vue-types'; import { useInjectMenu } from './hooks/useMenuContext'; import { useMeasure } from './hooks/useKeyPath'; -const menuItemGroupProps = { +export const menuItemGroupProps = { title: PropTypes.any, }; diff --git a/components/menu/src/MenuItem.tsx b/components/menu/src/MenuItem.tsx index c973e1677..2cd39b881 100644 --- a/components/menu/src/MenuItem.tsx +++ b/components/menu/src/MenuItem.tsx @@ -13,7 +13,7 @@ import Overflow from '../../vc-overflow'; import devWarning from '../../vc-util/devWarning'; let indexGuid = 0; -const menuItemProps = { +export const menuItemProps = { id: String, role: String, disabled: Boolean, diff --git a/components/menu/src/SubMenu.tsx b/components/menu/src/SubMenu.tsx index cd313ce12..a8c2d5664 100644 --- a/components/menu/src/SubMenu.tsx +++ b/components/menu/src/SubMenu.tsx @@ -22,7 +22,7 @@ import isValid from '../../_util/isValid'; let indexGuid = 0; -const subMenuProps = { +export const subMenuProps = { icon: PropTypes.any, title: PropTypes.any, disabled: Boolean, diff --git a/components/progress/Line.tsx b/components/progress/Line.tsx index 924bfc6b1..c00a19ece 100644 --- a/components/progress/Line.tsx +++ b/components/progress/Line.tsx @@ -7,7 +7,7 @@ import type { StringGradients, ProgressGradient } from './props'; import { progressProps } from './props'; import { getSuccessPercent, validProgress } from './utils'; -const lineProps = { +export const lineProps = { ...progressProps(), prefixCls: PropTypes.string, direction: { diff --git a/components/progress/Steps.tsx b/components/progress/Steps.tsx index 805e59a57..06fe17bbe 100644 --- a/components/progress/Steps.tsx +++ b/components/progress/Steps.tsx @@ -5,7 +5,7 @@ import PropTypes from '../_util/vue-types'; import type { ProgressSize } from './props'; import { progressProps } from './props'; -const stepsProps = { +export const stepsProps = { ...progressProps(), steps: PropTypes.number, size: { diff --git a/components/radio/Group.tsx b/components/radio/Group.tsx index e0aeac03c..b7bbb274f 100644 --- a/components/radio/Group.tsx +++ b/components/radio/Group.tsx @@ -22,7 +22,7 @@ export type RadioGroupChildOption = { disabled?: boolean; }; -const radioGroupProps = { +export const radioGroupProps = { prefixCls: PropTypes.string, value: PropTypes.any, size: PropTypes.oneOf(RadioGroupSizeTypes).def('default'), diff --git a/components/space/index.tsx b/components/space/index.tsx index a14eb8acf..1d81119d2 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -14,7 +14,7 @@ const spaceSize = { middle: 16, large: 24, }; -const spaceProps = { +export const spaceProps = { prefixCls: PropTypes.string, size: { type: [String, Number, Array] as PropType, diff --git a/components/switch/index.tsx b/components/switch/index.tsx index 260a77674..2dffd7022 100644 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -13,7 +13,7 @@ import omit from '../_util/omit'; export const SwitchSizes = tuple('small', 'default'); type CheckedType = boolean | string | number; -const switchProps = { +export const switchProps = { id: PropTypes.string, prefixCls: PropTypes.string, size: PropTypes.oneOf(SwitchSizes), diff --git a/components/tabs/src/TabNavList/OperationNode.tsx b/components/tabs/src/TabNavList/OperationNode.tsx index 6ef15dc30..5f6453c56 100644 --- a/components/tabs/src/TabNavList/OperationNode.tsx +++ b/components/tabs/src/TabNavList/OperationNode.tsx @@ -11,7 +11,7 @@ import PropTypes from '../../../_util/vue-types'; import useState from '../../../_util/hooks/useState'; import { EllipsisOutlined } from '@ant-design/icons-vue'; -const operationNodeProps = { +export const operationNodeProps = { prefixCls: { type: String }, id: { type: String }, tabs: { type: Object as PropType }, diff --git a/components/tabs/src/TabNavList/index.tsx b/components/tabs/src/TabNavList/index.tsx index 664bd7cb9..ff30e15d9 100644 --- a/components/tabs/src/TabNavList/index.tsx +++ b/components/tabs/src/TabNavList/index.tsx @@ -30,7 +30,7 @@ import useRefs from '../../../_util/hooks/useRefs'; import pick from 'lodash-es/pick'; const DEFAULT_SIZE = { width: 0, height: 0, left: 0, top: 0, right: 0 }; -const tabNavListProps = () => { +export const tabNavListProps = () => { return { id: { type: String }, tabPosition: { type: String as PropType }, diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 12bb29abf..cb2f86382 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -13,7 +13,7 @@ import useConfigInject from '../_util/hooks/useConfigInject'; const PresetColorRegex = new RegExp(`^(${PresetColorTypes.join('|')})(-inverse)?$`); const PresetStatusColorRegex = new RegExp(`^(${PresetStatusColorTypes.join('|')})$`); -const tagProps = { +export const tagProps = { prefixCls: PropTypes.string, color: { type: String as PropType>, diff --git a/components/time-picker/time-picker.tsx b/components/time-picker/time-picker.tsx index c349f69f6..2de81357f 100644 --- a/components/time-picker/time-picker.tsx +++ b/components/time-picker/time-picker.tsx @@ -19,7 +19,7 @@ export interface TimePickerLocale { rangePlaceholder?: [string, string]; } -const timePickerProps = { +export const timePickerProps = { format: String, showNow: { type: Boolean, default: undefined }, showHour: { type: Boolean, default: undefined }, diff --git a/components/tree/DirectoryTree.tsx b/components/tree/DirectoryTree.tsx index 63cd337c4..e9fcd9eb3 100644 --- a/components/tree/DirectoryTree.tsx +++ b/components/tree/DirectoryTree.tsx @@ -21,7 +21,7 @@ import { filterEmpty } from '../_util/props-util'; export type ExpandAction = false | 'click' | 'doubleclick' | 'dblclick'; -const directoryTreeProps = { +export const directoryTreeProps = { ...treeProps(), expandAction: { type: [Boolean, String] as PropType }, }; diff --git a/components/vc-align/Align.tsx b/components/vc-align/Align.tsx index 2ac328952..d7ce12f36 100644 --- a/components/vc-align/Align.tsx +++ b/components/vc-align/Align.tsx @@ -30,7 +30,7 @@ export interface AlignProps { disabled?: boolean; } -const alignProps = { +export const alignProps = { align: Object as PropType, target: [Object, Function] as PropType, onAlign: Function as PropType, diff --git a/components/vc-checkbox/Checkbox.tsx b/components/vc-checkbox/Checkbox.tsx index 0ee483514..a8b7ea89a 100644 --- a/components/vc-checkbox/Checkbox.tsx +++ b/components/vc-checkbox/Checkbox.tsx @@ -5,7 +5,7 @@ import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; import { initDefaultProps } from '../_util/props-util'; -const checkboxProps = { +export const checkboxProps = { prefixCls: String, name: String, id: String,