@para-ui/core 5.0.0-beta.12 → 5.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +315 -0
- package/AlignBox/component.json +89 -0
- package/Anchor/component.json +130 -0
- package/Argv/component.json +216 -0
- package/AutoBox/component.json +133 -0
- package/AutoButton/component.json +109 -0
- package/AutoTips/component.json +121 -0
- package/Badge/component.json +92 -0
- package/Breadcrumbs/component.json +142 -0
- package/Button/component.json +168 -0
- package/ButtonGroup/component.json +132 -0
- package/Card/component.json +162 -0
- package/Carousel/component.json +142 -0
- package/Cascader/component.json +196 -0
- package/Checkbox/component.json +138 -0
- package/CheckboxGroup/component.json +152 -0
- package/CodeEditor/component.json +189 -0
- package/Collapse/component.json +166 -0
- package/CollapseBox/component.json +84 -0
- package/CollapseLayout/component.json +155 -0
- package/ColorPicker/component.json +142 -0
- package/ComboSelect/component.json +181 -0
- package/Container/component.json +111 -0
- package/ContentBox/component.json +81 -0
- package/CopyText/component.json +118 -0
- package/CycleSelector/component.json +98 -0
- package/DatePicker/component.json +192 -0
- package/Descriptions/component.json +142 -0
- package/Desktop/component.json +171 -0
- package/DragVerify/component.json +114 -0
- package/Drawer/component.json +200 -0
- package/Dropdown/component.json +147 -0
- package/DynamicMultiBox/component.json +278 -0
- package/Empty/component.json +123 -0
- package/FieldForm/component.json +196 -0
- package/Form/component.json +161 -0
- package/FormItem/component.json +171 -0
- package/FunctionModal/component.json +197 -0
- package/Help/component.json +118 -0
- package/HelperText/component.json +126 -0
- package/Image/component.json +165 -0
- package/InputCode/component.json +191 -0
- package/InputLang/component.json +205 -0
- package/InputNumber/component.json +162 -0
- package/Label/component.json +126 -0
- package/Loading/component.json +91 -0
- package/Menu/component.json +180 -0
- package/Message/component.json +246 -0
- package/Modal/component.json +277 -0
- package/MultiBox/component.json +216 -0
- package/Notification/component.json +184 -0
- package/OperateBtn/component.json +134 -0
- package/PageHeader/component.json +112 -0
- package/Pagination/component.json +181 -0
- package/PasswordRules/component.json +105 -0
- package/PopConfirm/component.json +227 -0
- package/PopMenu/component.json +131 -0
- package/Popover/component.json +165 -0
- package/Progress/component.json +161 -0
- package/Prompt/component.json +144 -0
- package/Querying/component.json +96 -0
- package/QuickReply/component.json +129 -0
- package/Radio/component.json +136 -0
- package/RadioGroup/component.json +149 -0
- package/RangeInput/component.json +198 -0
- package/Result/component.json +104 -0
- package/ScrollBar/component.json +115 -0
- package/Search/component.json +177 -0
- package/Select/component.json +244 -0
- package/SelectInput/component.json +184 -0
- package/Selector/component.json +203 -0
- package/SelectorPicker/component.json +179 -0
- package/SingleBox/component.json +151 -0
- package/Slider/component.json +181 -0
- package/SortBox/component.json +108 -0
- package/Status/component.json +104 -0
- package/Stepper/component.json +129 -0
- package/Switch/component.json +207 -0
- package/Table/component.json +547 -0
- package/Tabs/component.json +227 -0
- package/Tag/component.json +221 -0
- package/TextEditor/component.json +186 -0
- package/TextField/component.json +290 -0
- package/TimePicker/component.json +176 -0
- package/Timeline/component.json +110 -0
- package/Title/component.json +156 -0
- package/ToggleButton/component.json +153 -0
- package/Tooltip/component.json +176 -0
- package/Transfer/component.json +157 -0
- package/Tree/component.json +512 -0
- package/Upload/component.json +450 -0
- package/ai-workflows/01-crud-list-multi-drawer.md +278 -0
- package/ai-workflows/02-rbac-operation-buttons.md +290 -0
- package/ai-workflows/03-complex-form-async-cascade.md +350 -0
- package/ai-workflows/04-array-field-form.md +281 -0
- package/ai-workflows/05-popconfirm-async-message-queue.md +333 -0
- package/ai-workflows/06-modal-drawer-form-workflow.md +385 -0
- package/ai-workflows/07-search-filter-table-trio.md +387 -0
- package/ai-workflows/08-table-advanced-features.md +365 -0
- package/ai-workflows/09-batch-operation-export-progress.md +367 -0
- package/ai-workflows/10-cross-component-state-coordination.md +412 -0
- package/es/AlignBox/component.json +89 -0
- package/es/AlignBox/index.css +1 -1
- package/es/AlignBox/index.d.ts +6 -2
- package/es/AlignBox/index.js +1 -1
- package/es/AlignBox/style/index.css +1 -1
- package/es/Anchor/anchorMenu/index.d.ts +2 -1
- package/es/Anchor/anchorMenu/index.js +36 -33
- package/es/Anchor/component.json +130 -0
- package/es/Anchor/index.js +50 -47
- package/es/Anchor/type.d.ts +8 -4
- package/es/Argv/component.json +216 -0
- package/es/Argv/index.d.ts +5 -6
- package/es/AutoBox/component.json +133 -0
- package/es/AutoBox/index.d.ts +3 -3
- package/es/AutoBox/index.js +1 -1
- package/es/AutoBox/protal.d.ts +2 -2
- package/es/AutoBox/protal.js +32 -29
- package/es/AutoButton/component.json +109 -0
- package/es/AutoButton/index.js +1 -1
- package/es/AutoTips/autoTipsMultiline/index.d.ts +1 -1
- package/es/AutoTips/autoTipsMultiline/index.js +1 -1
- package/es/AutoTips/component.json +121 -0
- package/es/Badge/component.json +92 -0
- package/es/Breadcrumbs/component.json +142 -0
- package/es/Breadcrumbs/index.js +1 -1
- package/es/Button/SplitButton.d.ts +2 -2
- package/es/Button/component.json +168 -0
- package/es/Button/index.js +44 -44
- package/es/ButtonGroup/component.json +132 -0
- package/es/ButtonGroup/index.d.ts +1 -1
- package/es/Card/component.json +162 -0
- package/es/Card/index.d.ts +2 -2
- package/es/Card/index.js +2 -2
- package/es/Carousel/component.json +142 -0
- package/es/Carousel/index.d.ts +1 -1
- package/es/Cascader/component.json +196 -0
- package/es/Cascader/hooks/useEntities.js +7 -7
- package/es/Cascader/interface.d.ts +1 -0
- package/es/Cascader/utils/commonUtil.d.ts +1 -1
- package/es/Cascader/utils/commonUtil.js +16 -16
- package/es/Cascader/utils/treeUtil.d.ts +14 -5
- package/es/Cascader/utils/treeUtil.js +1 -1
- package/es/Checkbox/component.json +138 -0
- package/es/CheckboxGroup/component.json +152 -0
- package/es/CodeEditor/component.json +189 -0
- package/es/CodeEditor/index.d.ts +10 -9
- package/es/Collapse/component.json +166 -0
- package/es/Collapse/index.d.ts +1 -1
- package/es/Collapse/index.js +23 -22
- package/es/CollapseBox/component.json +84 -0
- package/es/CollapseLayout/component.json +155 -0
- package/es/ColorPicker/component.json +142 -0
- package/es/ComboSelect/component.json +181 -0
- package/es/ComboSelect/index.js +73 -68
- package/es/ComboSelect/interface.d.ts +2 -2
- package/es/ComboSelect/utils.d.ts +3 -3
- package/es/ComboSelect/utils.js +1 -1
- package/es/Container/component.json +111 -0
- package/es/ContentBox/component.json +81 -0
- package/es/CopyText/component.json +118 -0
- package/es/CycleSelector/component.json +98 -0
- package/es/CycleSelector/index.js +14 -13
- package/es/DatePicker/component.json +192 -0
- package/es/DatePicker/generatePicker/generateRangePicker.js +10 -10
- package/es/DatePicker/generatePicker/generateSinglePicker.js +1 -1
- package/es/Descriptions/component.json +142 -0
- package/es/Descriptions/index.d.ts +1 -1
- package/es/Desktop/component.json +171 -0
- package/es/DragVerify/component.json +114 -0
- package/es/DragVerify/index.js +19 -19
- package/es/Drawer/component.json +200 -0
- package/es/Drawer/index.js +86 -86
- package/es/Drawer/interface.d.ts +1 -1
- package/es/Drawer/util.d.ts +1 -6
- package/es/Drawer/util.js +9 -6
- package/es/Dropdown/component.json +147 -0
- package/es/DynamicMultiBox/component.json +278 -0
- package/es/DynamicMultiBox/formItem.d.ts +1 -1
- package/es/DynamicMultiBox/rowForm.d.ts +2 -2
- package/es/Empty/component.json +123 -0
- package/es/Empty/index.css +1 -1
- package/es/Empty/index.d.ts +2 -2
- package/es/Empty/index.js +27 -26
- package/es/Empty/style/index.css +1 -1
- package/es/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
- package/es/FieldForm/FieldFormItem/index.d.ts +6 -6
- package/es/FieldForm/Form.d.ts +2 -2
- package/es/FieldForm/FormList.d.ts +2 -2
- package/es/FieldForm/component.json +196 -0
- package/es/FieldForm/context.d.ts +5 -1
- package/es/FieldForm/context.js +2 -2
- package/es/FieldForm/hooks/useForm.d.ts +4 -3
- package/es/FieldForm/hooks/useFormInstance.d.ts +1 -1
- package/es/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
- package/es/FieldForm/hooks/useFormItemStatus.js +2 -2
- package/es/FieldForm/hooks/useItemRef.d.ts +1 -1
- package/es/FieldForm/hooks/useItemRef.js +6 -6
- package/es/Form/component.json +161 -0
- package/es/Form/index.d.ts +52 -49
- package/es/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
- package/es/FormItem/compoments/defaultCompoments/index.js +12 -11
- package/es/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
- package/es/FormItem/compoments/formFile/index.js +8 -8
- package/es/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
- package/es/FormItem/compoments/formSelect/index.d.ts +1 -1
- package/es/FormItem/component.json +171 -0
- package/es/FormItem/index.d.ts +5 -5
- package/es/FormItem/index.js +23 -23
- package/es/FormItem/itemType.js +1 -1
- package/es/FunctionModal/component.json +197 -0
- package/es/FunctionModal/dialog.d.ts +1 -1
- package/es/FunctionModal/modalContext.d.ts +4 -1
- package/es/Help/component.json +118 -0
- package/es/HelperText/component.json +126 -0
- package/es/Image/component.json +165 -0
- package/es/InputCode/component.json +191 -0
- package/es/InputCode/index.d.ts +2 -2
- package/es/InputLang/component.json +205 -0
- package/es/InputLang/index.js +1 -1
- package/es/InputNumber/component.json +162 -0
- package/es/Label/component.json +126 -0
- package/es/Label/index.d.ts +2 -2
- package/es/Loading/component.json +91 -0
- package/es/Menu/component.json +180 -0
- package/es/Message/component.json +246 -0
- package/es/Message/index.d.ts +2 -2
- package/es/Message/index.js +2 -2
- package/es/Modal/Confirm/index.d.ts +1 -1
- package/es/Modal/component.json +277 -0
- package/es/Modal/index.d.ts +85 -5
- package/es/Modal/index.js +159 -122
- package/es/Modal/interface.d.ts +1 -0
- package/es/MultiBox/component.json +216 -0
- package/es/MultiBox/index.js +19 -14
- package/es/Notification/component.json +184 -0
- package/es/OperateBtn/component.json +134 -0
- package/es/OperateBtn/index.d.ts +3 -3
- package/es/PageHeader/component.json +112 -0
- package/es/Pagination/component.json +181 -0
- package/es/Pagination/index.js +15 -15
- package/es/PasswordRules/component.json +105 -0
- package/es/PasswordRules/index.d.ts +4 -4
- package/es/PopConfirm/component.json +227 -0
- package/es/PopConfirm/index.d.ts +1 -1
- package/es/PopConfirm/index.js +1 -1
- package/es/PopMenu/component.json +131 -0
- package/es/PopMenu/hooks.d.ts +1 -1
- package/es/PopMenu/index.js +8 -8
- package/es/Popover/component.json +165 -0
- package/es/Popover/index.js +1 -1
- package/es/Progress/component.json +161 -0
- package/es/Prompt/component.json +144 -0
- package/es/Querying/component.json +96 -0
- package/es/Querying/index.css +1 -1
- package/es/Querying/index.d.ts +2 -2
- package/es/Querying/index.js +20 -19
- package/es/Querying/style/index.css +1 -1
- package/es/QuickReply/component.json +129 -0
- package/es/QuickReply/index.d.ts +1 -1
- package/es/Radio/component.json +136 -0
- package/es/RadioGroup/component.json +149 -0
- package/es/RangeInput/component.json +198 -0
- package/es/RangeInput/index.js +1 -1
- package/es/Result/component.json +104 -0
- package/es/ScrollBar/component.json +115 -0
- package/es/Search/component.json +177 -0
- package/es/Search/index.d.ts +1 -1
- package/es/Select/component.json +244 -0
- package/es/Select/index.js +113 -113
- package/es/SelectInput/component.json +184 -0
- package/es/Selector/component.json +203 -0
- package/es/Selector/index.js +28 -27
- package/es/Selector/interface.d.ts +1 -1
- package/es/Selector/selectorMain/index.js +2 -2
- package/es/Selector/selectorNode/index.js +1 -1
- package/es/Selector/util.d.ts +2 -2
- package/es/SelectorPicker/component.json +179 -0
- package/es/SelectorPicker/index.d.ts +5 -5
- package/es/SelectorPicker/index.js +15 -15
- package/es/SingleBox/component.json +151 -0
- package/es/SingleBox/index.d.ts +2 -2
- package/es/Slider/component.json +181 -0
- package/es/SortBox/component.json +108 -0
- package/es/Status/component.json +104 -0
- package/es/Stepper/component.json +129 -0
- package/es/Stepper/index.d.ts +2 -2
- package/es/Switch/component.json +207 -0
- package/es/Switch/index.css +1 -1
- package/es/Switch/index.d.ts +3 -2
- package/es/Switch/index.js +60 -59
- package/es/Switch/style/index.css +1 -1
- package/es/Table/component.json +547 -0
- package/es/Table/index.d.ts +2 -2
- package/es/Table/index.js +414 -414
- package/es/Table/interface.d.ts +6 -0
- package/es/Tabs/component.json +227 -0
- package/es/Tag/component.json +221 -0
- package/es/Tag/index.css +1 -1
- package/es/Tag/index.d.ts +1 -1
- package/es/Tag/index.js +20 -20
- package/es/Tag/style/index.css +1 -1
- package/es/TextEditor/component.json +186 -0
- package/es/TextEditor/index.d.ts +5 -5
- package/es/TextField/component.json +290 -0
- package/es/TextField/index.d.ts +2 -2
- package/es/TimePicker/component.json +176 -0
- package/es/Timeline/component.json +110 -0
- package/es/Title/component.json +156 -0
- package/es/ToggleButton/component.json +153 -0
- package/es/Tooltip/component.json +176 -0
- package/es/Tooltip/index.js +58 -53
- package/es/Tooltip/interface.d.ts +14 -1
- package/es/Tooltip/utils.js +6 -6
- package/es/Transfer/component.json +157 -0
- package/es/Tree/component.json +512 -0
- package/es/Upload/component.json +450 -0
- package/es/Utils/type.d.ts +0 -2
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -1
- package/es/locale/en_US.d.ts +361 -0
- package/es/locale/en_US.js +364 -0
- package/es/locale/index.d.ts +1 -723
- package/es/locale/index2.js +10 -0
- package/es/locale/zh_CN.d.ts +361 -0
- package/es/locale/zh_CN.js +364 -0
- package/lib/AlignBox/component.json +89 -0
- package/lib/AlignBox/index.css +1 -1
- package/lib/AlignBox/index.d.ts +6 -2
- package/lib/AlignBox/index.js +1 -1
- package/lib/AlignBox/style/index.css +1 -1
- package/lib/Anchor/anchorMenu/index.d.ts +2 -1
- package/lib/Anchor/anchorMenu/index.js +1 -1
- package/lib/Anchor/component.json +130 -0
- package/lib/Anchor/index.js +1 -1
- package/lib/Anchor/type.d.ts +8 -4
- package/lib/Argv/component.json +216 -0
- package/lib/Argv/index.d.ts +5 -6
- package/lib/AutoBox/component.json +133 -0
- package/lib/AutoBox/index.d.ts +3 -3
- package/lib/AutoBox/index.js +1 -1
- package/lib/AutoBox/protal.d.ts +2 -2
- package/lib/AutoBox/protal.js +1 -1
- package/lib/AutoButton/component.json +109 -0
- package/lib/AutoButton/index.js +1 -1
- package/lib/AutoTips/autoTipsMultiline/index.d.ts +1 -1
- package/lib/AutoTips/autoTipsMultiline/index.js +1 -1
- package/lib/AutoTips/component.json +121 -0
- package/lib/Badge/component.json +92 -0
- package/lib/Breadcrumbs/component.json +142 -0
- package/lib/Breadcrumbs/index.js +1 -1
- package/lib/Button/SplitButton.d.ts +2 -2
- package/lib/Button/component.json +168 -0
- package/lib/Button/index.js +1 -1
- package/lib/ButtonGroup/component.json +132 -0
- package/lib/ButtonGroup/index.d.ts +1 -1
- package/lib/Card/component.json +162 -0
- package/lib/Card/index.d.ts +2 -2
- package/lib/Card/index.js +1 -1
- package/lib/Carousel/component.json +142 -0
- package/lib/Carousel/index.d.ts +1 -1
- package/lib/Cascader/component.json +196 -0
- package/lib/Cascader/hooks/useEntities.js +1 -1
- package/lib/Cascader/interface.d.ts +1 -0
- package/lib/Cascader/utils/commonUtil.d.ts +1 -1
- package/lib/Cascader/utils/commonUtil.js +1 -1
- package/lib/Cascader/utils/treeUtil.d.ts +14 -5
- package/lib/Cascader/utils/treeUtil.js +1 -1
- package/lib/Checkbox/component.json +138 -0
- package/lib/CheckboxGroup/component.json +152 -0
- package/lib/CodeEditor/component.json +189 -0
- package/lib/CodeEditor/index.d.ts +10 -9
- package/lib/Collapse/component.json +166 -0
- package/lib/Collapse/index.d.ts +1 -1
- package/lib/Collapse/index.js +1 -1
- package/lib/CollapseBox/component.json +84 -0
- package/lib/CollapseLayout/component.json +155 -0
- package/lib/ColorPicker/component.json +142 -0
- package/lib/ComboSelect/component.json +181 -0
- package/lib/ComboSelect/index.js +1 -1
- package/lib/ComboSelect/interface.d.ts +2 -2
- package/lib/ComboSelect/utils.d.ts +3 -3
- package/lib/ComboSelect/utils.js +1 -1
- package/lib/Container/component.json +111 -0
- package/lib/ContentBox/component.json +81 -0
- package/lib/CopyText/component.json +118 -0
- package/lib/CycleSelector/component.json +98 -0
- package/lib/CycleSelector/index.js +1 -1
- package/lib/DatePicker/component.json +192 -0
- package/lib/DatePicker/generatePicker/generateRangePicker.js +1 -1
- package/lib/DatePicker/generatePicker/generateSinglePicker.js +1 -1
- package/lib/Descriptions/component.json +142 -0
- package/lib/Descriptions/index.d.ts +1 -1
- package/lib/Desktop/component.json +171 -0
- package/lib/DragVerify/component.json +114 -0
- package/lib/DragVerify/index.js +1 -1
- package/lib/Drawer/component.json +200 -0
- package/lib/Drawer/index.js +1 -1
- package/lib/Drawer/interface.d.ts +1 -1
- package/lib/Drawer/util.d.ts +1 -6
- package/lib/Drawer/util.js +1 -1
- package/lib/Dropdown/component.json +147 -0
- package/lib/DynamicMultiBox/component.json +278 -0
- package/lib/DynamicMultiBox/formItem.d.ts +1 -1
- package/lib/DynamicMultiBox/rowForm.d.ts +2 -2
- package/lib/Empty/component.json +123 -0
- package/lib/Empty/index.css +1 -1
- package/lib/Empty/index.d.ts +2 -2
- package/lib/Empty/index.js +1 -1
- package/lib/Empty/style/index.css +1 -1
- package/lib/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
- package/lib/FieldForm/FieldFormItem/index.d.ts +6 -6
- package/lib/FieldForm/Form.d.ts +2 -2
- package/lib/FieldForm/FormList.d.ts +2 -2
- package/lib/FieldForm/component.json +196 -0
- package/lib/FieldForm/context.d.ts +5 -1
- package/lib/FieldForm/context.js +1 -1
- package/lib/FieldForm/hooks/useForm.d.ts +4 -3
- package/lib/FieldForm/hooks/useFormInstance.d.ts +1 -1
- package/lib/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
- package/lib/FieldForm/hooks/useFormItemStatus.js +1 -1
- package/lib/FieldForm/hooks/useItemRef.d.ts +1 -1
- package/lib/FieldForm/hooks/useItemRef.js +1 -1
- package/lib/Form/component.json +161 -0
- package/lib/Form/index.d.ts +52 -49
- package/lib/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
- package/lib/FormItem/compoments/defaultCompoments/index.js +1 -1
- package/lib/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
- package/lib/FormItem/compoments/formFile/index.js +1 -1
- package/lib/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
- package/lib/FormItem/compoments/formSelect/index.d.ts +1 -1
- package/lib/FormItem/component.json +171 -0
- package/lib/FormItem/index.d.ts +5 -5
- package/lib/FormItem/index.js +1 -1
- package/lib/FormItem/itemType.js +1 -1
- package/lib/FunctionModal/component.json +197 -0
- package/lib/FunctionModal/dialog.d.ts +1 -1
- package/lib/FunctionModal/modalContext.d.ts +4 -1
- package/lib/Help/component.json +118 -0
- package/lib/HelperText/component.json +126 -0
- package/lib/Image/component.json +165 -0
- package/lib/InputCode/component.json +191 -0
- package/lib/InputCode/index.d.ts +2 -2
- package/lib/InputLang/component.json +205 -0
- package/lib/InputLang/index.js +1 -1
- package/lib/InputNumber/component.json +162 -0
- package/lib/Label/component.json +126 -0
- package/lib/Label/index.d.ts +2 -2
- package/lib/Loading/component.json +91 -0
- package/lib/Menu/component.json +180 -0
- package/lib/Message/component.json +246 -0
- package/lib/Message/index.d.ts +2 -2
- package/lib/Message/index.js +1 -1
- package/lib/Modal/Confirm/index.d.ts +1 -1
- package/lib/Modal/component.json +277 -0
- package/lib/Modal/index.d.ts +85 -5
- package/lib/Modal/index.js +1 -1
- package/lib/Modal/interface.d.ts +1 -0
- package/lib/MultiBox/component.json +216 -0
- package/lib/MultiBox/index.js +1 -1
- package/lib/Notification/component.json +184 -0
- package/lib/OperateBtn/component.json +134 -0
- package/lib/OperateBtn/index.d.ts +3 -3
- package/lib/PageHeader/component.json +112 -0
- package/lib/Pagination/component.json +181 -0
- package/lib/Pagination/index.js +1 -1
- package/lib/PasswordRules/component.json +105 -0
- package/lib/PasswordRules/index.d.ts +4 -4
- package/lib/PopConfirm/component.json +227 -0
- package/lib/PopConfirm/index.d.ts +1 -1
- package/lib/PopConfirm/index.js +1 -1
- package/lib/PopMenu/component.json +131 -0
- package/lib/PopMenu/hooks.d.ts +1 -1
- package/lib/PopMenu/index.js +1 -1
- package/lib/Popover/component.json +165 -0
- package/lib/Popover/index.js +1 -1
- package/lib/Progress/component.json +161 -0
- package/lib/Prompt/component.json +144 -0
- package/lib/Querying/component.json +96 -0
- package/lib/Querying/index.css +1 -1
- package/lib/Querying/index.d.ts +2 -2
- package/lib/Querying/index.js +1 -1
- package/lib/Querying/style/index.css +1 -1
- package/lib/QuickReply/component.json +129 -0
- package/lib/QuickReply/index.d.ts +1 -1
- package/lib/Radio/component.json +136 -0
- package/lib/RadioGroup/component.json +149 -0
- package/lib/RangeInput/component.json +198 -0
- package/lib/RangeInput/index.js +1 -1
- package/lib/Result/component.json +104 -0
- package/lib/ScrollBar/component.json +115 -0
- package/lib/Search/component.json +177 -0
- package/lib/Search/index.d.ts +1 -1
- package/lib/Select/component.json +244 -0
- package/lib/Select/index.js +1 -1
- package/lib/SelectInput/component.json +184 -0
- package/lib/Selector/component.json +203 -0
- package/lib/Selector/index.js +1 -1
- package/lib/Selector/interface.d.ts +1 -1
- package/lib/Selector/selectorMain/index.js +1 -1
- package/lib/Selector/selectorNode/index.js +1 -1
- package/lib/Selector/util.d.ts +2 -2
- package/lib/SelectorPicker/component.json +179 -0
- package/lib/SelectorPicker/index.d.ts +5 -5
- package/lib/SelectorPicker/index.js +1 -1
- package/lib/SingleBox/component.json +151 -0
- package/lib/SingleBox/index.d.ts +2 -2
- package/lib/Slider/component.json +181 -0
- package/lib/SortBox/component.json +108 -0
- package/lib/Status/component.json +104 -0
- package/lib/Stepper/component.json +129 -0
- package/lib/Stepper/index.d.ts +2 -2
- package/lib/Switch/component.json +207 -0
- package/lib/Switch/index.css +1 -1
- package/lib/Switch/index.d.ts +3 -2
- package/lib/Switch/index.js +1 -1
- package/lib/Switch/style/index.css +1 -1
- package/lib/Table/component.json +547 -0
- package/lib/Table/index.d.ts +2 -2
- package/lib/Table/index.js +1 -1
- package/lib/Table/interface.d.ts +6 -0
- package/lib/Tabs/component.json +227 -0
- package/lib/Tag/component.json +221 -0
- package/lib/Tag/index.css +1 -1
- package/lib/Tag/index.d.ts +1 -1
- package/lib/Tag/index.js +1 -1
- package/lib/Tag/style/index.css +1 -1
- package/lib/TextEditor/component.json +186 -0
- package/lib/TextEditor/index.d.ts +5 -5
- package/lib/TextField/component.json +290 -0
- package/lib/TextField/index.d.ts +2 -2
- package/lib/TimePicker/component.json +176 -0
- package/lib/Timeline/component.json +110 -0
- package/lib/Title/component.json +156 -0
- package/lib/ToggleButton/component.json +153 -0
- package/lib/Tooltip/component.json +176 -0
- package/lib/Tooltip/index.js +1 -1
- package/lib/Tooltip/interface.d.ts +14 -1
- package/lib/Tooltip/utils.js +1 -1
- package/lib/Transfer/component.json +157 -0
- package/lib/Tree/component.json +512 -0
- package/lib/Upload/component.json +450 -0
- package/lib/Utils/type.d.ts +0 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/locale/en_US.d.ts +361 -0
- package/lib/locale/en_US.js +2 -0
- package/lib/locale/index.d.ts +1 -723
- package/lib/locale/index2.js +2 -0
- package/lib/locale/zh_CN.d.ts +361 -0
- package/lib/locale/zh_CN.js +2 -0
- package/package.json +9 -3
- /package/es/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
- /package/es/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
- /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
- /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AutoBox",
|
|
3
|
+
"category": "Layout",
|
|
4
|
+
"description": "自适应容器,根据容器宽度自动计算可见项数量,超出部分折叠到'更多'下拉弹层中展示",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"响应式布局",
|
|
8
|
+
"内容收纳"
|
|
9
|
+
],
|
|
10
|
+
"useCases": [
|
|
11
|
+
"工具栏",
|
|
12
|
+
"标签组",
|
|
13
|
+
"操作区"
|
|
14
|
+
],
|
|
15
|
+
"riskLevel": "low"
|
|
16
|
+
},
|
|
17
|
+
"variants": {
|
|
18
|
+
"default": {
|
|
19
|
+
"meaning": "默认样式"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"states": [
|
|
23
|
+
"default",
|
|
24
|
+
"expanded"
|
|
25
|
+
],
|
|
26
|
+
"idealProps": {
|
|
27
|
+
"list": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"description": "需要自适应容纳的子节点数组(ReactNode[]);事件挂在节点自身,AutoBox 不暴露 item-level onClick"
|
|
30
|
+
},
|
|
31
|
+
"showNum": {
|
|
32
|
+
"type": "number",
|
|
33
|
+
"description": "强制显示前 N 项(跳过自适应计算),溢出全部进'更多'"
|
|
34
|
+
},
|
|
35
|
+
"trigger": {
|
|
36
|
+
"type": "enum",
|
|
37
|
+
"values": [
|
|
38
|
+
"click",
|
|
39
|
+
"hover"
|
|
40
|
+
],
|
|
41
|
+
"default": "click",
|
|
42
|
+
"description": "'更多'弹层触发方式"
|
|
43
|
+
},
|
|
44
|
+
"placement": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"default": "bottomLeft",
|
|
47
|
+
"description": "'更多'弹层位置(透传 Popover placement)"
|
|
48
|
+
},
|
|
49
|
+
"hideMore": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"default": false,
|
|
52
|
+
"description": "隐藏内置'更多'按钮(配 anchorEl + openMore 自管理外置触发器)"
|
|
53
|
+
},
|
|
54
|
+
"moreCustomize": {
|
|
55
|
+
"type": "ReactNode",
|
|
56
|
+
"description": "自定义'更多'触发节点,替换默认 More 图标按钮"
|
|
57
|
+
},
|
|
58
|
+
"openMore": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"default": false,
|
|
61
|
+
"description": "外部受控弹层显隐"
|
|
62
|
+
},
|
|
63
|
+
"onShowMore": {
|
|
64
|
+
"type": "function",
|
|
65
|
+
"description": "(bol: boolean) => void 是否有溢出项的状态回调"
|
|
66
|
+
},
|
|
67
|
+
"onCloseMore": {
|
|
68
|
+
"type": "function",
|
|
69
|
+
"description": "() => void 受控弹层关闭回调"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"do": [
|
|
73
|
+
"用于空间有限需要收纳溢出内容的场景",
|
|
74
|
+
"配合 Popover 展示更多",
|
|
75
|
+
"list 中每个 ReactNode 自行绑定点击事件——AutoBox 只做布局计算和'更多'收纳"
|
|
76
|
+
],
|
|
77
|
+
"dont": [
|
|
78
|
+
"在固定宽度布局中滥用",
|
|
79
|
+
"列表项过多时不做分页",
|
|
80
|
+
"期望 AutoBox 暴露单项 onClick——事件需要挂在 list 元素自身上"
|
|
81
|
+
],
|
|
82
|
+
"events": {
|
|
83
|
+
"onShowMore": {
|
|
84
|
+
"signature": "(bol: boolean) => void",
|
|
85
|
+
"asyncSupported": false,
|
|
86
|
+
"examples": [
|
|
87
|
+
"bol=true 表示当前有溢出项(list.length > morePos),可用于显示/隐藏外部操作按钮",
|
|
88
|
+
"bol=false 表示所有项都可见,无需显示外部'更多'入口",
|
|
89
|
+
"配合 hideMore + openMore 实现外置触发器:onShowMore={setHasMore},只在 hasMore 时渲染自定义按钮"
|
|
90
|
+
],
|
|
91
|
+
"commonMistakes": [
|
|
92
|
+
"期望 onShowMore 返回具体溢出项数量——它只返回 boolean,溢出项数量需自行计算(list.length - morePos)",
|
|
93
|
+
"在 onShowMore 里 setState 引发重渲染后,AutoBox 内部 resize 可能再次触发 onShowMore,注意避免循环",
|
|
94
|
+
"onShowMore 在 list prop 变化或 window resize 后都会重新触发,不要依赖它的调用次数做副作用"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"onCloseMore": {
|
|
98
|
+
"signature": "() => void",
|
|
99
|
+
"asyncSupported": false,
|
|
100
|
+
"examples": [
|
|
101
|
+
"弹层关闭时同步外部受控状态:onCloseMore={() => setOpenMore(false)}",
|
|
102
|
+
"关闭时记录日志:onCloseMore={() => analytics.track('more_closed')}",
|
|
103
|
+
"配合 openMore 实现受控弹层:<AutoBox openMore={open} onCloseMore={() => setOpen(false)} />"
|
|
104
|
+
],
|
|
105
|
+
"commonMistakes": [
|
|
106
|
+
"传了 onCloseMore 但忘记传 openMore——二者需配合使用才能实现受控弹层",
|
|
107
|
+
"期望 onCloseMore 在用户点击弹层内容后也触发——只有弹层关闭时触发,内容点击需在 list 节点自身处理",
|
|
108
|
+
"期望 onCloseMore 携带关闭原因——回调无参数,无法区分是点击外部还是 ESC 关闭"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"typescriptPitfalls": [
|
|
113
|
+
{
|
|
114
|
+
"issue": "list 类型是 any[],但传入非 ReactNode 元素会导致 runtime 渲染异常",
|
|
115
|
+
"wrong": "// list 传了原始数据对象,忘记 map 成 ReactNode\n<AutoBox list={[{ id: 1, name: '标签' }]} /> // 对象不是合法 ReactNode,渲染报错",
|
|
116
|
+
"right": "// 先 map 成 ReactNode\n<AutoBox list={data.map(d => <Tag key={d.id}>{d.name}</Tag>)} />"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"issue": "moreCustomize 声明为 ReactNode,但 src 内部也处理了函数形式(typeof moreCustomize === 'function'),类型声明不完整",
|
|
120
|
+
"wrong": "// 传函数期望接收 morePos 参数,但 TypeScript 按 ReactNode 检查会报类型错误\nmoreCustomize={(morePos) => <span>+{morePos}</span>}",
|
|
121
|
+
"right": "// 如需传函数绕过类型检查需显式 as any,或直接传静态 ReactNode\nmoreCustomize={<span>更多</span>}"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"issue": "AutoBoxProps 有索引签名 [name: string]: any,传错误 prop 名不会报 TS 错误",
|
|
125
|
+
"wrong": "// 拼写错误不会被 TS 捕获\n<AutoBox list={list} closeMore={() => {}} /> // closeMore 应为 onCloseMore,静默失效",
|
|
126
|
+
"right": "// 注意使用正确 prop 名\n<AutoBox list={list} onCloseMore={() => {}} />"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"mapping": {
|
|
130
|
+
"realComponent": "AutoBox",
|
|
131
|
+
"adapter": null
|
|
132
|
+
}
|
|
133
|
+
}
|
package/lib/AutoBox/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface AutoBoxProps {
|
|
|
6
6
|
/** style */
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
8
|
/** list选项 */
|
|
9
|
-
list?:
|
|
9
|
+
list?: React.ReactNode[];
|
|
10
10
|
/** 指定渲染几项,存在这个参数,则不自适应 */
|
|
11
11
|
showNum?: number;
|
|
12
12
|
/** 下拉框样式 */
|
|
@@ -18,7 +18,7 @@ export interface AutoBoxProps {
|
|
|
18
18
|
/** 打开下拉框 */
|
|
19
19
|
openMore?: boolean;
|
|
20
20
|
/** 定位元素 */
|
|
21
|
-
anchorEl?:
|
|
21
|
+
anchorEl?: HTMLElement | null;
|
|
22
22
|
/** 关闭弹窗 */
|
|
23
23
|
onCloseMore?: () => void;
|
|
24
24
|
/** 显示更多 */
|
|
@@ -27,7 +27,7 @@ export interface AutoBoxProps {
|
|
|
27
27
|
trigger?: 'click' | 'hover';
|
|
28
28
|
/** 位置 */
|
|
29
29
|
placement?: TooltipPlacement;
|
|
30
|
-
[name: string]:
|
|
30
|
+
[name: string]: unknown;
|
|
31
31
|
}
|
|
32
32
|
export declare const AutoBox: FunctionComponent<AutoBoxProps>;
|
|
33
33
|
export default AutoBox;
|
package/lib/AutoBox/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const s=require("../_virtual/jsx-runtime.js"),t=require("react"),_=require("../Popover/index.js"),A=require("./protal.js"),F=require("../node_modules/@para-ui/icons/More/index.js"),N=require("../GlobalContext/constant.js");;/* empty css */const w=i=>{const{className:x,list:o=[],popoverClassName:p,moreCustomize:l,anchorEl:v,hideMore:q=!1,showNum:m,onCloseMore:j,onShowMore:u,style:P,trigger:S="click",placement:$="bottomLeft"}=i,M=t.useRef(null),[r,f]=t.useState(null),[E,d]=t.useState(!1),[h]=t.useState({}),z=t.useRef();t.useEffect(()=>{i.openMore!==void 0&&d(i.openMore)},[i.openMore]),t.useEffect(()=>{if(i.showNum===void 0)return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),clearTimeout(h.timer)}},[o]),t.useEffect(()=>{m!==void 0&&(f(m),window.removeEventListener("resize",a))},[m]),t.useEffect(()=>{r!==null&&o.length>r?u&&u(!0):u&&u(!1)},[o,r,u]);const y=e=>{if(e)return d(!0);c()},c=()=>{d(!1),j&&j()},D=()=>{c()},C=e=>{if(e===null||e===0)return;e===void 0&&(e=o.length);const n=M.current;if(n)if(n.scrollWidth>n.clientWidth){const b=Number(e)-1;f(b),C(b)}else o.length<=e&&D()},a=()=>{clearTimeout(h.timer),c(),h.timer=setTimeout(()=>{f(o.length),C()},100)},L=()=>{let e=`${N.$prefixCls}-auto-box`;return x&&(e+=` ${x}`),e},g=()=>{let e=`${N.$prefixCls}-auto-box-popover`;return p&&(e+=` ${p}`),e},R=()=>s.jsxRuntimeExports.jsx("div",{className:"auto-box-popover-content",children:o&&o.map((e,n)=>r!==null&&r>n?null:s.jsxRuntimeExports.jsx(t.Fragment,{children:e},n))}),T=()=>{if(r!==null&&o.length>r&&!q){const e=()=>l?typeof l=="function"?l(r):l:s.jsxRuntimeExports.jsx(F.More,{});return s.jsxRuntimeExports.jsx(_.Popover,{open:E,content:R(),overlayClassName:g(),placement:$,trigger:S,onVisibleChange:y,children:s.jsxRuntimeExports.jsx("div",{className:"auto-box-more",ref:z,children:e()})})}},B=()=>{if(v&&E)return s.jsxRuntimeExports.jsx(A.Protal,{className:g(),anchorEl:v,onClose:c,children:R()})};return s.jsxRuntimeExports.jsxs("div",{className:L(),style:P,ref:M,children:[o.map((e,n)=>r!==null&&r<=n?null:s.jsxRuntimeExports.jsx(t.Fragment,{children:e},n)),T(),B()]})};exports.AutoBox=w;exports.default=w;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const s=require("../_virtual/jsx-runtime.js"),t=require("react"),_=require("../Popover/index.js"),A=require("./protal.js"),F=require("../node_modules/@para-ui/icons/More/index.js"),N=require("../GlobalContext/constant.js");;/* empty css */const w=i=>{const{className:x,list:o=[],popoverClassName:p,moreCustomize:l,anchorEl:v,hideMore:q=!1,showNum:m,onCloseMore:j,onShowMore:u,style:P,trigger:S="click",placement:$="bottomLeft"}=i,M=t.useRef(null),[r,f]=t.useState(null),[E,d]=t.useState(!1),[h]=t.useState({}),z=t.useRef(null);t.useEffect(()=>{i.openMore!==void 0&&d(i.openMore)},[i.openMore]),t.useEffect(()=>{if(i.showNum===void 0)return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),clearTimeout(h.timer)}},[o]),t.useEffect(()=>{m!==void 0&&(f(m),window.removeEventListener("resize",a))},[m]),t.useEffect(()=>{r!==null&&o.length>r?u&&u(!0):u&&u(!1)},[o,r,u]);const y=e=>{if(e)return d(!0);c()},c=()=>{d(!1),j&&j()},D=()=>{c()},C=e=>{if(e===null||e===0)return;e===void 0&&(e=o.length);const n=M.current;if(n)if(n.scrollWidth>n.clientWidth){const b=Number(e)-1;f(b),C(b)}else o.length<=e&&D()},a=()=>{clearTimeout(h.timer),c(),h.timer=setTimeout(()=>{f(o.length),C()},100)},L=()=>{let e=`${N.$prefixCls}-auto-box`;return x&&(e+=` ${x}`),e},g=()=>{let e=`${N.$prefixCls}-auto-box-popover`;return p&&(e+=` ${p}`),e},R=()=>s.jsxRuntimeExports.jsx("div",{className:"auto-box-popover-content",children:o&&o.map((e,n)=>r!==null&&r>n?null:s.jsxRuntimeExports.jsx(t.Fragment,{children:e},n))}),T=()=>{if(r!==null&&o.length>r&&!q){const e=()=>l?typeof l=="function"?l(r):l:s.jsxRuntimeExports.jsx(F.More,{});return s.jsxRuntimeExports.jsx(_.Popover,{open:E,content:R(),overlayClassName:g(),placement:$,trigger:S,onVisibleChange:y,children:s.jsxRuntimeExports.jsx("div",{className:"auto-box-more",ref:z,children:e()})})}},B=()=>{if(v&&E)return s.jsxRuntimeExports.jsx(A.Protal,{className:g(),anchorEl:v,onClose:c,children:R()})};return s.jsxRuntimeExports.jsxs("div",{className:L(),style:P,ref:M,children:[o.map((e,n)=>r!==null&&r<=n?null:s.jsxRuntimeExports.jsx(t.Fragment,{children:e},n)),T(),B()]})};exports.AutoBox=w;exports.default=w;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/AutoBox/protal.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { FunctionComponent, ReactNode } from 'react';
|
|
|
2
2
|
export interface ProtalBoxProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
/** 定位元素 */
|
|
5
|
-
anchorEl?:
|
|
5
|
+
anchorEl?: HTMLElement | null;
|
|
6
6
|
/** 关闭事件 */
|
|
7
7
|
onClose?: () => void;
|
|
8
8
|
children?: ReactNode;
|
|
9
|
-
[name: string]:
|
|
9
|
+
[name: string]: unknown;
|
|
10
10
|
}
|
|
11
11
|
export declare const Protal: FunctionComponent<ProtalBoxProps>;
|
|
12
12
|
export default Protal;
|
package/lib/AutoBox/protal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../_virtual/jsx-runtime.js"),c=require("react"),C=require("react-dom"),S=require("@snack-kit/lib"),h=require("../GlobalContext/constant.js"),p=x=>{const{children:R,className:a,anchorEl:d,onClose:f}=x,[g,w]=c.useState({}),l=c.useRef({uuid:`${h.$prefixCls}-protal-box-content-${S.UUID()}`}),i=c.useRef(null),u=c.useRef(null);c.useEffect(()=>(E(),window.addEventListener("click",m),()=>{i&&i.current&&i.current.remove(),window.removeEventListener("click",m)}),[]);const j=(e,o)=>{if(!e)return null;const t=e,r=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;if(!r)return null;let n=e;for(;n&&!r.call(n,o);)n=n.parentElement;return n},m=e=>{if(!l.current)return;j(e.target,`.${l.current.uuid}`)||f&&f()},E=()=>{if(!d||!u.current)return;const e=d.getBoundingClientRect(),o=u.current.getBoundingClientRect(),t={opacity:1,left:e.left,top:e.top+e.height},r=window.innerHeight,n=window.innerWidth;t.left+o.width>n&&(t.left=n-o.width-8,t.left<0&&(t.left=0)),t.top+o.height>r&&(t.top=r-o.height-8,t.top<0&&(t.top=0)),w(t)},b=()=>{let e=`${h.$prefixCls}-protal-box`;return a&&(e+=` ${a}`),e},v=()=>s.jsxRuntimeExports.jsxs("div",{className:b(),ref:i,children:[s.jsxRuntimeExports.jsx("div",{className:"protal-mask"}),s.jsxRuntimeExports.jsx("div",{className:`protal-content ${l.current.uuid}`,style:g,ref:u,children:R})]});return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:C.createPortal(v(),document.getElementsByTagName("body")[0])})};exports.Protal=p;exports.default=p;
|
|
2
2
|
//# sourceMappingURL=protal.js.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AutoButton",
|
|
3
|
+
"category": "General",
|
|
4
|
+
"description": "自适应按钮组,根据容器宽度自动折叠超出的按钮到'更多'下拉弹层,list 每项支持 buttonType 切换图标/分割/普通三种形态",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"按钮收纳",
|
|
8
|
+
"响应式操作"
|
|
9
|
+
],
|
|
10
|
+
"useCases": [
|
|
11
|
+
"操作栏",
|
|
12
|
+
"批量操作",
|
|
13
|
+
"编辑器工具栏"
|
|
14
|
+
],
|
|
15
|
+
"riskLevel": "low"
|
|
16
|
+
},
|
|
17
|
+
"variants": {
|
|
18
|
+
"default": {
|
|
19
|
+
"meaning": "默认样式"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"states": [
|
|
23
|
+
"default",
|
|
24
|
+
"expanded"
|
|
25
|
+
],
|
|
26
|
+
"idealProps": {
|
|
27
|
+
"list": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"description": "按钮项数据数组,每项为 AutoButtonItemProps(union: ButtonProps | IconButtonProps | SplitButtonProps + 扩展 buttonType/popConfirmProps)"
|
|
30
|
+
},
|
|
31
|
+
"marginRight": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"default": "16px",
|
|
34
|
+
"description": "按钮间右间距"
|
|
35
|
+
},
|
|
36
|
+
"moreProps": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"objectShape": {
|
|
39
|
+
"buttonType": { "type": "'icon'", "description": "强制图标模式(不显示文字)" },
|
|
40
|
+
"icon": { "type": "ReactNode", "description": "自定义'更多'图标(默认 MoreVert)" },
|
|
41
|
+
"children": { "type": "ReactNode", "description": "自定义'更多'按钮文字内容" }
|
|
42
|
+
},
|
|
43
|
+
"description": "溢出折叠后'更多'按钮的展示形态({ buttonType?: 'icon'; icon?: ReactNode; children?: ReactNode })"
|
|
44
|
+
},
|
|
45
|
+
"morePlacement": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"default": "bottomLeft",
|
|
48
|
+
"description": "'更多'浮层弹出位置(透传 Dropdown placement)"
|
|
49
|
+
},
|
|
50
|
+
"moreMaxWidth": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"default": "500px",
|
|
53
|
+
"description": "'更多'浮层最大宽度,超出自动换行"
|
|
54
|
+
},
|
|
55
|
+
"trigger": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"default": "['hover']",
|
|
58
|
+
"description": "'更多'浮层触发方式数组('click' | 'hover' | 'contextMenu')[]"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"do": [
|
|
62
|
+
"在工具栏中使用收纳溢出按钮",
|
|
63
|
+
"保持主要操作可见,把低频操作放到 list 后面让其优先被折叠",
|
|
64
|
+
"每个 list 项用 buttonType 区分形态:不传=普通按钮 / 'icon'=图标按钮 / 'split'=分割按钮",
|
|
65
|
+
"需要二次确认时用 list 项的 popConfirmProps 属性透传 PopConfirm 参数"
|
|
66
|
+
],
|
|
67
|
+
"dont": [
|
|
68
|
+
"主要操作被收纳进更多(应调整 list 顺序)",
|
|
69
|
+
"按钮过多时不分优先级",
|
|
70
|
+
"在 list 每项上传 buttonType='split' 时忘记提供 options 字段——split 按钮的子项来自 options"
|
|
71
|
+
],
|
|
72
|
+
"events": {
|
|
73
|
+
"list[].onClick": {
|
|
74
|
+
"signature": "(event: React.MouseEvent<HTMLButtonElement>) => void",
|
|
75
|
+
"asyncSupported": false,
|
|
76
|
+
"examples": [
|
|
77
|
+
"每项 onClick 挂在 AutoButtonItemProps 上:list={[{ children: '编辑', onClick: handleEdit }]}",
|
|
78
|
+
"溢出后在'更多'弹层中点击时,AutoButton 内部会代理调用该项的 onClick",
|
|
79
|
+
"需要区分是哪个按钮被点击:在每项的 onClick 闭包里引用各自的业务 id"
|
|
80
|
+
],
|
|
81
|
+
"commonMistakes": [
|
|
82
|
+
"期望 AutoButton 暴露统一 onItemClick(index, item) 回调——AutoButton 无此 prop,onClick 挂在每项上",
|
|
83
|
+
"buttonType='split' 的子项点击时,src 会把 parentItem.onClick 也触发一次——注意避免重复处理",
|
|
84
|
+
"弹层中点击时 event.currentTarget 是弹层内 Button,不是原始按钮 DOM,不要依赖 currentTarget 做 DOM 查找"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"typescriptPitfalls": [
|
|
89
|
+
{
|
|
90
|
+
"issue": "AutoButtonItemProps 是 ButtonProps | IconButtonProps | SplitButtonProps 的 union,TypeScript 需要用 buttonType 做类型守卫",
|
|
91
|
+
"wrong": "// 直接访问 split 专属字段\nconst item: AutoButtonItemProps = { buttonType: 'split', options: [...] }; // options 不在 ButtonProps 上,TS 报错",
|
|
92
|
+
"right": "// 断言为具体类型\nimport type { SplitButtonProps } from '@para-ui/core/Button';\nconst item: AutoButtonItemProps = { buttonType: 'split', ...(splitProps as SplitButtonProps) };"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"issue": "trigger prop 是数组类型,不是字符串,与部分其他组件的字符串 trigger 不同",
|
|
96
|
+
"wrong": "<AutoButton list={list} trigger='hover' /> // 期望字符串,实际是 string[] 类型报错",
|
|
97
|
+
"right": "<AutoButton list={list} trigger={['hover']} /> // 数组形式"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"issue": "list 的 popConfirmProps 是可选字段,传了但 items 没有此字段时 TypeScript 不报错(union 类型),但 runtime 才生效",
|
|
101
|
+
"wrong": "// 误以为所有 list 项都有 popConfirmProps 类型定义,直接访问\nconst confirm = item.popConfirmProps; // 可能 undefined,需要 ?. 操作符",
|
|
102
|
+
"right": "const confirm = (item as AutoButtonItemProps).popConfirmProps; // 先断言再访问,配合 ?. 操作符"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"mapping": {
|
|
106
|
+
"realComponent": "AutoButton",
|
|
107
|
+
"adapter": null
|
|
108
|
+
}
|
|
109
|
+
}
|
package/lib/AutoButton/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../_virtual/jsx-runtime.js"),u=require("react"),l=require("../Button/index.js"),D=require("../AutoTips/index.js"),F=require("../PopConfirm/index.js"),S=require("../node_modules/@para-ui/icons/MoreVert/index.js"),g=require("../GlobalContext/constant.js"),w=require("../Dropdown/index.js"),I=require("../Tooltip/index.js"),E=require("clsx"),W=require("../GlobalContext/useFormatMessage.js"),O=require("./lang/index.js"),z=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../_virtual/jsx-runtime.js"),u=require("react"),l=require("../Button/index.js"),D=require("../AutoTips/index.js"),F=require("../PopConfirm/index.js"),S=require("../node_modules/@para-ui/icons/MoreVert/index.js"),g=require("../GlobalContext/constant.js"),w=require("../Dropdown/index.js"),I=require("../Tooltip/index.js"),E=require("clsx"),W=require("../GlobalContext/useFormatMessage.js"),O=require("./lang/index.js"),z=require("../Hooks/useResizeObserver.js");;/* empty css */const B=q=>{const{className:y,style:C,list:o,marginRight:x="16px",moreProps:v,morePlacement:P="bottomLeft",moreMaxWidth:M="500px",trigger:T=["hover"]}=q,N=W.default("AutoButton",O.default),[s,m]=u.useState(null),c=u.useRef(null),a=u.useRef({timer:null});z.default({dom:c.current,cb:()=>f()}),u.useEffect(()=>{f()},[o]);const f=()=>{a.current.timer&&clearTimeout(a.current.timer),a.current.timer=setTimeout(()=>{m(o.length),o.length>1&&j()},100)},j=t=>{if(t===null||t===0)return;t===void 0&&(t=o.length);const e=c.current;if(e&&e.scrollWidth>e.clientWidth){const n=Number(t)-1;m(n),j(n)}},_=(t,e,n)=>{if(n){n.onClick&&n.onClick(e);return}t.onClick&&t.onClick(e)},h=(t,e,n)=>r.jsxRuntimeExports.jsx(l.Button,{variant:"text",disabled:t.disabled,loading:t.loading,className:E("item-btn",{"item-btn-disabled":t.disabled}),onClick:i=>{t.disabled||_(t,i,n)},children:r.jsxRuntimeExports.jsx(D.default,{placement:"top-start",children:t[e]})}),b=(t,e,n)=>t.disabled&&t.disabledTooltip?r.jsxRuntimeExports.jsx(I.Tooltip,{disabled:!0,...t.disabledTooltip,children:h(t,e,n)}):h(t,e,n),$=()=>r.jsxRuntimeExports.jsx("div",{className:"auto-button-dropdown-content",style:{maxWidth:M},children:o&&o.map((t,e)=>s!==null&&s>e?null:t.buttonType!=="split"?r.jsxRuntimeExports.jsx(u.Fragment,{children:d(t,b(t,"children"))},e):r.jsxRuntimeExports.jsx(u.Fragment,{children:t.options?.map((n,i)=>Array.isArray(n)?null:r.jsxRuntimeExports.jsx(u.Fragment,{children:d(n,b(n,"label",t))},`${e}-${i}`))},e))}),k=()=>{if(!(s!==null&&o.length>s))return null;const{buttonType:t,icon:e=r.jsxRuntimeExports.jsx(S.MoreVert,{}),children:n=N({id:"more"})}=v||{};let i=r.jsxRuntimeExports.jsx(l.Button,{variant:"outlined",startIcon:e,className:"auto-button-more",children:n});return t==="icon"&&(i=r.jsxRuntimeExports.jsx(l.Button.IconButton,{variant:"outlined",className:"auto-button-more",children:e})),r.jsxRuntimeExports.jsx(w.Dropdown,{overlayClassName:`${g.$prefixCls}-auto-button-dropdown`,overlay:$(),placement:P,trigger:T,children:i})},d=(t,e)=>t.popConfirmProps?r.jsxRuntimeExports.jsx(F.PopConfirm,{...t.popConfirmProps,children:e}):e;return r.jsxRuntimeExports.jsxs("div",{className:E(y,`${g.$prefixCls}-auto-button`),style:C,ref:c,children:[o.map((t,e)=>{if(s!==null&&s<=e)return null;const{buttonType:n,popConfirmProps:i,...A}=t;let p=l.Button;const R={marginRight:s===e+1?0:x};return s!==null&&o.length>s&&(R.marginRight=x),n==="icon"&&(p=l.Button.IconButton),n==="split"&&(p=l.Button.SplitButton),r.jsxRuntimeExports.jsx(u.Fragment,{children:d(t,r.jsxRuntimeExports.jsx(p,{...A,style:R}))},e)}),k()]})};exports.AutoButton=B;exports.default=B;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,7 @@ export interface AutoTipsMultilineProps extends Omit<AutoTipsProps, 'children'>
|
|
|
6
6
|
/** 行数 */
|
|
7
7
|
line?: number;
|
|
8
8
|
/** 刷新 */
|
|
9
|
-
refresh?:
|
|
9
|
+
refresh?: () => void;
|
|
10
10
|
}
|
|
11
11
|
declare const AutoTipsMultiline: FunctionComponent<AutoTipsMultilineProps>;
|
|
12
12
|
export default AutoTipsMultiline;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../../_virtual/jsx-runtime.js"),l=require("react"),f=require("../../GlobalContext/constant.js"),M=require("../../Tooltip/index.js"),w=require("../../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../../_virtual/jsx-runtime.js"),l=require("react"),f=require("../../GlobalContext/constant.js"),M=require("../../Tooltip/index.js"),w=require("../../Hooks/useResizeObserver.js");;/* empty css */const y=v=>{const{children:t,arrow:b=!1,placement:E="bottom-start",tips:d="",className:h="",interactive:T=!0,tipMaxWidth:O,line:m=2,refresh:A,style:C}=v,a=l.useRef(null),u=l.useRef([]),[x,N]=l.useState(),o=l.useRef({line:m,tips:d});o.current.line=m,o.current.tips=d;const[W,g]=l.useState("");w.default({dom:a.current,cb:()=>R()}),l.useEffect(()=>{R()},[t,A]);const R=()=>{if(!t)return;const e=[];let s=!1;const i=a?.current?.clientWidth||0;let p=0,c=0;for(let n=0;n<u.current.length;n++){const j=u.current[n].offsetWidth;if(p+=j,p>i)if(e.length<o.current.line-1)e.push(t.slice(c,n)),c=n,p=j,n===u.current.length-1&&(e.length<o.current.line||(s=!0,g(o.current.tips||t)),e.push(t.slice(c,t.length)));else{s=!0,g(o.current.tips||t),e.push(t.slice(c,t.length));break}else n===u.current.length-1&&e.push(t.slice(c,t.length))}N({lineArr:e,showTooltip:s})},$=l.useMemo(()=>(u.current=[],r.jsxRuntimeExports.jsx("div",{className:"hidden",children:t?.split("").map((e,s)=>r.jsxRuntimeExports.jsx("span",{ref:i=>i&&u.current.push(i),children:e},s))})),[t]),q=()=>{if(navigator.userAgent.indexOf("Safari")>-1)return!0},S=()=>{let e=`${f.$prefixCls}-auto-tips-multiline`;return q()&&(e+=` ${f.$prefixCls}-auto-tips-multiline-safari`),h&&(e+=` ${h}`),e};return r.jsxRuntimeExports.jsx("div",{ref:a,className:S(),style:C,children:r.jsxRuntimeExports.jsx(M.Tooltip,{arrow:b,title:W,placement:E,interactive:T,boundariesElement:"viewport",overlayClassName:`${f.$prefixCls}-auto-tips-multiline-tooltip`,children:r.jsxRuntimeExports.jsxs("div",{className:"auto-tips-multiline-content-box",children:[r.jsxRuntimeExports.jsx("div",{className:"auto-tips-multiline-content",children:x?.lineArr.map((e,s)=>{let i="line-text";return s===x.lineArr.length-1&&(i+=" last-line"),r.jsxRuntimeExports.jsx("div",{className:i,children:e},s)})}),$]})})})};exports.default=y;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AutoTips",
|
|
3
|
+
"category": "Data Display",
|
|
4
|
+
"description": "文本溢出自动提示——内容超出容器宽度时自动弹出 Tooltip,不超出时不显示;beyondText 控制 Tooltip 显示文本还是原始 children 节点",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"溢出提示",
|
|
8
|
+
"文本截断"
|
|
9
|
+
],
|
|
10
|
+
"useCases": [
|
|
11
|
+
"表格单元格",
|
|
12
|
+
"列表项",
|
|
13
|
+
"标签"
|
|
14
|
+
],
|
|
15
|
+
"riskLevel": "low"
|
|
16
|
+
},
|
|
17
|
+
"variants": {
|
|
18
|
+
"default": {
|
|
19
|
+
"meaning": "默认样式"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"states": [
|
|
23
|
+
"default",
|
|
24
|
+
"overflow"
|
|
25
|
+
],
|
|
26
|
+
"idealProps": {
|
|
27
|
+
"children": {
|
|
28
|
+
"type": "ReactNode",
|
|
29
|
+
"description": "被截断的内容;单行模式不限制类型,多行模式(AutoTipsMultiline)限制为 string"
|
|
30
|
+
},
|
|
31
|
+
"tips": {
|
|
32
|
+
"type": "ReactNode",
|
|
33
|
+
"description": "超出时 Tooltip 显示的内容。**不传时**:beyondText=true(默认)显示 tipsElm.innerText;beyondText=false 显示原始 children。**传了 tips**:超出时直接显示 tips,忽略 beyondText"
|
|
34
|
+
},
|
|
35
|
+
"beyondText": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"default": true,
|
|
38
|
+
"description": "未传 tips 时的 Tooltip 内容:true=显示文本(innerText);false=显示原始 children 节点"
|
|
39
|
+
},
|
|
40
|
+
"placement": {
|
|
41
|
+
"type": "enum",
|
|
42
|
+
"values": [
|
|
43
|
+
"top",
|
|
44
|
+
"top-start",
|
|
45
|
+
"top-end",
|
|
46
|
+
"bottom",
|
|
47
|
+
"bottom-start",
|
|
48
|
+
"bottom-end",
|
|
49
|
+
"left",
|
|
50
|
+
"left-start",
|
|
51
|
+
"left-end",
|
|
52
|
+
"right",
|
|
53
|
+
"right-start",
|
|
54
|
+
"right-end"
|
|
55
|
+
],
|
|
56
|
+
"default": "bottom-start",
|
|
57
|
+
"description": "Tooltip 弹出方向(默认 bottom-start)"
|
|
58
|
+
},
|
|
59
|
+
"tipMaxWidth": {
|
|
60
|
+
"type": "number | string",
|
|
61
|
+
"description": "Tooltip 最大宽度"
|
|
62
|
+
},
|
|
63
|
+
"arrow": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"default": false,
|
|
66
|
+
"description": "Tooltip 是否显示箭头"
|
|
67
|
+
},
|
|
68
|
+
"interactive": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"default": true,
|
|
71
|
+
"description": "Tooltip 是否可交互(鼠标移入 Tooltip 不消失)"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"do": [
|
|
75
|
+
"在表格单元格中自动处理长文本截断+提示",
|
|
76
|
+
"设置合理的 tipMaxWidth 避免 Tooltip 过宽",
|
|
77
|
+
"多行截断场景使用导出的 AutoTipsMultiline 子组件(children 需为 string)"
|
|
78
|
+
],
|
|
79
|
+
"dont": [
|
|
80
|
+
"在短文本场景中滥用(AutoTips 每次 hover 都做宽度比较,短文本无截断时 Tooltip 不会弹,但有轻微性能开销)",
|
|
81
|
+
"tip 内容过于复杂(Tooltip 本身宽度有限,复杂节点用 Popover)",
|
|
82
|
+
"在多行模式(AutoTipsMultiline)下传 ReactNode 类型 children——多行限制为 string"
|
|
83
|
+
],
|
|
84
|
+
"events": {
|
|
85
|
+
"onMouseOver (内部)": {
|
|
86
|
+
"signature": "内部 onMouseOver 事件,无对外暴露",
|
|
87
|
+
"asyncSupported": false,
|
|
88
|
+
"examples": [
|
|
89
|
+
"鼠标悬停时 AutoTips 内部调用 mouseHover() 比较 tipsElm 与 textElm 宽度决定是否展示 Tooltip",
|
|
90
|
+
"超出宽度时自动设置 tTips state,Tooltip title 随之更新",
|
|
91
|
+
"不超出时 tTips 为空字符串,Tooltip 不渲染弹层"
|
|
92
|
+
],
|
|
93
|
+
"commonMistakes": [
|
|
94
|
+
"期望传 onOverflow 回调在超出时得到通知——AutoTips 不暴露此事件,如需监听请用 ResizeObserver 自行比较",
|
|
95
|
+
"期望 tips prop 变化时立即更新 Tooltip 内容——tips 变化会通过 useEffect 更新 tTips state,下次 hover 才生效",
|
|
96
|
+
"在 SSR 场景中使用 AutoTips——依赖 getBoundingClientRect(),SSR 下无 DOM 会报错"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"typescriptPitfalls": [
|
|
101
|
+
{
|
|
102
|
+
"issue": "placement 的完整枚举是带方向后缀的 MUI Popper 风格(如 'top-start'),不是简单的 'top'/'bottom'",
|
|
103
|
+
"wrong": "<AutoTips placement='topLeft'>...</AutoTips> // 'topLeft' 不在联合类型,TS 报错",
|
|
104
|
+
"right": "<AutoTips placement='top-start'>...</AutoTips> // 使用连字符形式"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"issue": "AutoTips 导出了 AutoTipsMultiline 子组件,但二者 props 不同——多行模式 children 必须为 string",
|
|
108
|
+
"wrong": "import AutoTips from '@para-ui/core/AutoTips';\n// 误用 AutoTips(单行)做多行截断\n<AutoTips style={{ WebkitLineClamp: 2 }}><ReactNode/></AutoTips> // 多行截断行为不可靠",
|
|
109
|
+
"right": "import { AutoTipsMultiline } from '@para-ui/core/AutoTips';\n<AutoTipsMultiline line={2}>{'长文本字符串'}</AutoTipsMultiline>"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"issue": "tips 不传时 tTips 由 mouseHover 计算,初始为空字符串——不要用 tips='' 期望清空提示",
|
|
113
|
+
"wrong": "<AutoTips tips=''>文本内容</AutoTips> // tips='' 等价于 tips=undefined,超出时仍显示 innerText",
|
|
114
|
+
"right": "// 不传 tips 让 AutoTips 自动提取文本\n<AutoTips>文本内容</AutoTips>"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"mapping": {
|
|
118
|
+
"realComponent": "AutoTips",
|
|
119
|
+
"adapter": null
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Badge",
|
|
3
|
+
"category": "Data Display",
|
|
4
|
+
"description": "出现在子元素角部的标记节点。**注意:不接受 antd 风格的 count / dot / maxCount / overflowCount 这些 prop**——本组件用 sign 作为核心标记内容(ReactNode),不传 sign 时退化为小圆点;传 null 时不显示",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"展示数量",
|
|
8
|
+
"展示状态",
|
|
9
|
+
"吸引注意"
|
|
10
|
+
],
|
|
11
|
+
"useCases": [
|
|
12
|
+
"消息计数",
|
|
13
|
+
"在线状态",
|
|
14
|
+
"新功能标记"
|
|
15
|
+
],
|
|
16
|
+
"riskLevel": "low"
|
|
17
|
+
},
|
|
18
|
+
"variants": {
|
|
19
|
+
"default": {
|
|
20
|
+
"meaning": "默认(带 sign 内容时按 sign 渲染;不传 sign 退化为小圆点)"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"states": [
|
|
24
|
+
"visible",
|
|
25
|
+
"hidden"
|
|
26
|
+
],
|
|
27
|
+
"idealProps": {
|
|
28
|
+
"children": {
|
|
29
|
+
"type": "ReactNode",
|
|
30
|
+
"description": "被徽标包裹的目标元素,Badge 会在其右上角(或 placement 指定位置)叠加徽标显示",
|
|
31
|
+
"required": false
|
|
32
|
+
},
|
|
33
|
+
"sign": {
|
|
34
|
+
"type": "ReactNode",
|
|
35
|
+
"description": "标记内容。**核心 prop**:传数字 / 字符串显示文本徽标;不传退化为小圆点;传 null 时整个徽标不显示(用于条件展示)"
|
|
36
|
+
},
|
|
37
|
+
"backgroundColor": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "徽标背景色(CSS 颜色字符串)"
|
|
40
|
+
},
|
|
41
|
+
"color": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "徽标文字色(CSS 颜色字符串)"
|
|
44
|
+
},
|
|
45
|
+
"offset": {
|
|
46
|
+
"type": "[number, number]",
|
|
47
|
+
"description": "徽标相对默认位置的像素偏移 [x, y]"
|
|
48
|
+
},
|
|
49
|
+
"placement": {
|
|
50
|
+
"type": "enum",
|
|
51
|
+
"values": [
|
|
52
|
+
"top-left",
|
|
53
|
+
"top-right",
|
|
54
|
+
"bottom-left",
|
|
55
|
+
"bottom-right"
|
|
56
|
+
],
|
|
57
|
+
"default": "top-right",
|
|
58
|
+
"description": "徽标在子元素四角的位置"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"do": [
|
|
62
|
+
"用 sign 传 ReactNode 作为标记(数字 / 短字符串 / 状态点)",
|
|
63
|
+
"条件展示:传 sign={null} 隐藏徽标但保留 children 占位",
|
|
64
|
+
"超过 999 的数字自动显示 '999+',无需业务方手动判断"
|
|
65
|
+
],
|
|
66
|
+
"dont": [
|
|
67
|
+
"传 count / dot / maxCount / overflowCount / status——这些 antd 风格 prop 不存在",
|
|
68
|
+
"把核心内容放到 children——children 是被标记的目标元素,不是徽标本身"
|
|
69
|
+
],
|
|
70
|
+
"events": {},
|
|
71
|
+
"typescriptPitfalls": [
|
|
72
|
+
{
|
|
73
|
+
"issue": "sign 是 ReactNode 而非数字,传 null 和不传 sign 含义不同",
|
|
74
|
+
"wrong": "// 期望隐藏徽标,传 sign={0} 却仍然显示数字 0\n<Badge sign={0}>图标</Badge> // 0 是数字,显示'0'文本徽标",
|
|
75
|
+
"right": "// 传 null 才能隐藏徽标\n<Badge sign={null}>图标</Badge> // handleType 返回 'null',handleSign 返回 null 不渲染"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"issue": "offset 是 [number, number] 元组,不是对象 { x, y }",
|
|
79
|
+
"wrong": "<Badge offset={{ x: 4, y: -4 }}>图标</Badge> // TS 类型报错:期望 [number, number]",
|
|
80
|
+
"right": "<Badge offset={[4, -4]}>图标</Badge> // [offsetX, offsetY],正数向右/向下"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"issue": "不要传 antd 风格的 count / dot / maxCount / overflowCount prop——它们不存在于 BadgeProps",
|
|
84
|
+
"wrong": "<Badge count={5} dot={false}>图标</Badge> // count/dot 不在 BadgeProps,静默失效",
|
|
85
|
+
"right": "<Badge sign={5}>图标</Badge> // para-ui 用 sign 作为核心标记内容"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"mapping": {
|
|
89
|
+
"realComponent": "Badge",
|
|
90
|
+
"adapter": null
|
|
91
|
+
}
|
|
92
|
+
}
|