@para-ui/core 5.0.0-beta.9 → 5.0.0
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/ExpressionInput/component.json +79 -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 +52 -49
- package/es/Anchor/type.d.ts +8 -4
- package/es/Argv/batchEdit/index.js +1 -1
- package/es/Argv/component.json +216 -0
- package/es/Argv/dataGenerator/index.js +1 -1
- package/es/Argv/index.d.ts +5 -6
- package/es/Argv/index.js +1 -1
- 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 +33 -30
- 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/AutoTips/index.js +1 -1
- 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/Cascader.js +1 -1
- package/es/Cascader/OptionList/Column.js +1 -1
- package/es/Cascader/OptionList/index.js +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/CheckboxGroup/index.js +1 -1
- package/es/CodeEditor/component.json +189 -0
- package/es/CodeEditor/index.d.ts +11 -10
- package/es/CodeEditor/index.js +25 -25
- 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 +115 -109
- 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 +11 -11
- package/es/DatePicker/generatePicker/generateSinglePicker.js +2 -2
- package/es/Descriptions/component.json +142 -0
- package/es/Descriptions/index.d.ts +1 -1
- package/es/Desktop/component.json +171 -0
- package/es/Desktop/index.js +1 -1
- 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/Dropdown/index.js +1 -1
- package/es/DynamicMultiBox/component.json +278 -0
- package/es/DynamicMultiBox/formItem.d.ts +1 -1
- package/es/DynamicMultiBox/index.js +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/ExpressionInput/HighlightOverlay.d.ts +8 -0
- package/es/ExpressionInput/HighlightOverlay.js +27 -0
- package/es/ExpressionInput/Popup.d.ts +19 -0
- package/es/ExpressionInput/Popup.js +93 -0
- package/es/ExpressionInput/component.json +79 -0
- package/es/ExpressionInput/detectChainAtCursor.d.ts +17 -0
- package/es/ExpressionInput/detectChainAtCursor.js +31 -0
- package/es/ExpressionInput/filterCandidatesByPartial.d.ts +2 -0
- package/es/ExpressionInput/filterCandidatesByPartial.js +15 -0
- package/es/ExpressionInput/highlightSegments.d.ts +9 -0
- package/es/ExpressionInput/highlightSegments.js +14 -0
- package/es/ExpressionInput/index.css +1 -0
- package/es/ExpressionInput/index.d.ts +5 -0
- package/es/ExpressionInput/index.js +178 -0
- package/es/ExpressionInput/interface.d.ts +52 -0
- package/es/ExpressionInput/isExpressionValue.d.ts +5 -0
- package/es/ExpressionInput/isExpressionValue.js +18 -0
- package/es/ExpressionInput/lang/en_US.d.ts +4 -0
- package/es/ExpressionInput/lang/en_US.js +7 -0
- package/es/ExpressionInput/lang/index.d.ts +9 -0
- package/es/ExpressionInput/lang/index.js +10 -0
- package/es/ExpressionInput/lang/zh_CN.d.ts +4 -0
- package/es/ExpressionInput/lang/zh_CN.js +7 -0
- package/es/ExpressionInput/style/css.js +1 -0
- package/es/ExpressionInput/style/index.css +1 -0
- package/es/ExpressionInput/style/index.js +1 -0
- package/es/ExpressionInput/useExpressionInput.d.ts +26 -0
- package/es/ExpressionInput/useExpressionInput.js +59 -0
- package/es/FieldForm/FieldFormItem/ItemHolder.js +1 -1
- package/es/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
- package/es/FieldForm/FieldFormItem/StatusProvider.js +1 -1
- package/es/FieldForm/FieldFormItem/index.d.ts +6 -6
- package/es/FieldForm/Form.d.ts +2 -2
- package/es/FieldForm/Form.js +1 -1
- package/es/FieldForm/FormItemInput.js +1 -1
- package/es/FieldForm/FormItemLabel.js +1 -1
- 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/Form/index.js +1 -1
- 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/GlobalContext/confirmLocale.js +1 -1
- package/es/GlobalContext/index.js +1 -1
- package/es/Help/component.json +118 -0
- package/es/HelperText/component.json +126 -0
- package/es/Image/PreviewGroup.js +1 -1
- package/es/Image/component.json +165 -0
- package/es/Image/index.js +1 -1
- package/es/InputCode/component.json +191 -0
- package/es/InputCode/index.d.ts +2 -2
- package/es/InputCode/index.js +1 -1
- package/es/InputLang/component.json +205 -0
- package/es/InputLang/index.js +2 -2
- package/es/InputNumber/component.json +162 -0
- package/es/InputNumber/index.d.ts +13 -7
- package/es/InputNumber/index.js +152 -144
- 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/Menu/verticalMenuList.js +1 -1
- package/es/Message/component.json +246 -0
- package/es/Message/index.d.ts +2 -2
- package/es/Message/index.js +19 -19
- package/es/Modal/Confirm/index.d.ts +1 -1
- package/es/Modal/Confirm/index.js +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/PageHeader/horizontalMeun.js +1 -1
- package/es/PageHeader/horizontalMeunRight.js +1 -1
- package/es/Pagination/component.json +181 -0
- package/es/Pagination/index.js +15 -15
- package/es/ParauiProvider/index.js +1 -1
- 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/QuickReplyCode/index.js +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.d.ts +15 -7
- package/es/RangeInput/index.js +120 -103
- 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.d.ts +11 -8
- package/es/Select/index.js +441 -438
- package/es/SelectInput/component.json +184 -0
- package/es/SelectInput/index.d.ts +4 -4
- package/es/SelectInput/index.js +8 -8
- package/es/Selector/component.json +203 -0
- package/es/Selector/index.js +56 -50
- package/es/Selector/interface.d.ts +2 -2
- package/es/Selector/selectorData/index.js +1 -1
- package/es/Selector/selectorMain/index.js +3 -3
- package/es/Selector/selectorNode/index.js +1 -1
- package/es/Selector/util.d.ts +3 -3
- package/es/Selector/util.js +6 -12
- 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 +385 -382
- package/es/Table/interface.d.ts +30 -0
- package/es/Table/tableHead.js +1 -1
- package/es/Table/util.d.ts +1 -1
- package/es/Table/util.js +3 -12
- 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/TextEditor/index.js +1 -1
- package/es/TextField/component.json +290 -0
- package/es/TextField/index.d.ts +2 -2
- package/es/TextField/index.js +1 -1
- 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/ToggleButton/index.js +1 -1
- 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/OperateBar/index.js +1 -1
- package/es/Tree/Tree.js +3 -3
- package/es/Tree/component.json +512 -0
- package/es/Tree/interface.d.ts +1 -1
- package/es/Upload/component.json +450 -0
- package/es/Upload/util.js +1 -1
- package/es/Utils/snack-kit-shims.d.ts +18 -0
- package/es/Utils/snack-kit-shims.js +19 -0
- package/es/Utils/type.d.ts +0 -6
- package/es/_virtual/index.js +5 -3
- package/es/_virtual/index2.js +2 -5
- package/es/index.d.ts +4 -0
- package/es/index.js +152 -150
- package/es/locale/en-US.d.ts +3 -0
- package/es/locale/en-US.js +3 -0
- 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 +3 -0
- package/es/locale/zh-CN.js +3 -0
- package/es/locale/zh_CN.d.ts +361 -0
- package/es/locale/zh_CN.js +364 -0
- package/es/node_modules/classnames/index.js +1 -1
- 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/dataGenerator/index.js +1 -1
- package/lib/Argv/index.d.ts +5 -6
- package/lib/Argv/index.js +1 -1
- 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/AutoTips/index.js +1 -1
- 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/Cascader.js +1 -1
- package/lib/Cascader/OptionList/Column.js +1 -1
- package/lib/Cascader/OptionList/index.js +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/CheckboxGroup/index.js +1 -1
- package/lib/CodeEditor/component.json +189 -0
- package/lib/CodeEditor/index.d.ts +11 -10
- package/lib/CodeEditor/index.js +1 -1
- 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/Desktop/index.js +1 -1
- 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/Dropdown/index.js +1 -1
- package/lib/DynamicMultiBox/component.json +278 -0
- package/lib/DynamicMultiBox/formItem.d.ts +1 -1
- package/lib/DynamicMultiBox/index.js +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/ExpressionInput/HighlightOverlay.d.ts +8 -0
- package/lib/ExpressionInput/HighlightOverlay.js +2 -0
- package/lib/ExpressionInput/Popup.d.ts +19 -0
- package/lib/ExpressionInput/Popup.js +2 -0
- package/lib/ExpressionInput/component.json +79 -0
- package/lib/ExpressionInput/detectChainAtCursor.d.ts +17 -0
- package/lib/ExpressionInput/detectChainAtCursor.js +2 -0
- package/lib/ExpressionInput/filterCandidatesByPartial.d.ts +2 -0
- package/lib/ExpressionInput/filterCandidatesByPartial.js +2 -0
- package/lib/ExpressionInput/highlightSegments.d.ts +9 -0
- package/lib/ExpressionInput/highlightSegments.js +2 -0
- package/lib/ExpressionInput/index.css +1 -0
- package/lib/ExpressionInput/index.d.ts +5 -0
- package/lib/ExpressionInput/index.js +2 -0
- package/lib/ExpressionInput/interface.d.ts +52 -0
- package/lib/ExpressionInput/isExpressionValue.d.ts +5 -0
- package/lib/ExpressionInput/isExpressionValue.js +2 -0
- package/lib/ExpressionInput/lang/en_US.d.ts +4 -0
- package/lib/ExpressionInput/lang/en_US.js +2 -0
- package/lib/ExpressionInput/lang/index.d.ts +9 -0
- package/lib/ExpressionInput/lang/index.js +2 -0
- package/lib/ExpressionInput/lang/zh_CN.d.ts +4 -0
- package/lib/ExpressionInput/lang/zh_CN.js +2 -0
- package/lib/ExpressionInput/style/css.js +1 -0
- package/lib/ExpressionInput/style/index.css +1 -0
- package/lib/ExpressionInput/style/index.js +1 -0
- package/lib/ExpressionInput/useExpressionInput.d.ts +26 -0
- package/lib/ExpressionInput/useExpressionInput.js +2 -0
- package/lib/FieldForm/FieldFormItem/ItemHolder.js +1 -1
- package/lib/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
- package/lib/FieldForm/FieldFormItem/StatusProvider.js +1 -1
- package/lib/FieldForm/FieldFormItem/index.d.ts +6 -6
- package/lib/FieldForm/Form.d.ts +2 -2
- package/lib/FieldForm/Form.js +1 -1
- package/lib/FieldForm/FormItemInput.js +1 -1
- package/lib/FieldForm/FormItemLabel.js +1 -1
- 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/Form/index.js +1 -1
- 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/GlobalContext/confirmLocale.js +1 -1
- package/lib/GlobalContext/index.js +1 -1
- package/lib/Help/component.json +118 -0
- package/lib/HelperText/component.json +126 -0
- package/lib/Image/PreviewGroup.js +1 -1
- package/lib/Image/component.json +165 -0
- package/lib/Image/index.js +1 -1
- 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/InputNumber/index.d.ts +13 -7
- package/lib/InputNumber/index.js +1 -1
- 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/Menu/verticalMenuList.js +1 -1
- 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/Confirm/index.js +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/PageHeader/horizontalMeun.js +1 -1
- package/lib/PageHeader/horizontalMeunRight.js +1 -1
- package/lib/Pagination/component.json +181 -0
- package/lib/Pagination/index.js +1 -1
- package/lib/ParauiProvider/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/QuickReplyCode/index.js +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.d.ts +15 -7
- 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.d.ts +11 -8
- package/lib/Select/index.js +1 -1
- package/lib/SelectInput/component.json +184 -0
- package/lib/SelectInput/index.d.ts +4 -4
- package/lib/SelectInput/index.js +1 -1
- package/lib/Selector/component.json +203 -0
- package/lib/Selector/index.js +1 -1
- package/lib/Selector/interface.d.ts +2 -2
- package/lib/Selector/selectorData/index.js +1 -1
- package/lib/Selector/selectorMain/index.js +1 -1
- package/lib/Selector/selectorNode/index.js +1 -1
- package/lib/Selector/util.d.ts +3 -3
- package/lib/Selector/util.js +1 -1
- 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 +30 -0
- package/lib/Table/tableHead.js +1 -1
- package/lib/Table/util.d.ts +1 -1
- package/lib/Table/util.js +1 -1
- 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/TextEditor/index.js +1 -1
- package/lib/TextField/component.json +290 -0
- package/lib/TextField/index.d.ts +2 -2
- package/lib/TextField/index.js +1 -1
- 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/ToggleButton/index.js +1 -1
- 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/OperateBar/index.js +2 -2
- package/lib/Tree/Tree.js +1 -1
- package/lib/Tree/component.json +512 -0
- package/lib/Tree/interface.d.ts +1 -1
- package/lib/Upload/component.json +450 -0
- package/lib/Upload/util.js +1 -1
- package/lib/Utils/snack-kit-shims.d.ts +18 -0
- package/lib/Utils/snack-kit-shims.js +2 -0
- package/lib/Utils/type.d.ts +0 -6
- package/lib/_virtual/index.js +1 -1
- package/lib/_virtual/index2.js +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +1 -1
- package/lib/locale/en-US.d.ts +3 -0
- package/lib/locale/en-US.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 +3 -0
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh_CN.d.ts +361 -0
- package/lib/locale/zh_CN.js +2 -0
- package/lib/node_modules/classnames/index.js +1 -1
- package/package.json +24 -4
- package/es/_virtual/index3.js +0 -5
- package/es/_virtual/index4.js +0 -5
- package/es/node_modules/@para-snack/core/dist/index.js +0 -5231
- package/lib/_virtual/index3.js +0 -2
- package/lib/_virtual/index4.js +0 -2
- package/lib/node_modules/@para-snack/core/dist/index.js +0 -20
- /package/es/{InputCode → CodeEditor}/index.css +0 -0
- /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,191 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "InputCode",
|
|
3
|
+
"category": "Data Entry",
|
|
4
|
+
"description": "验证码输入组件,分两个子组件:InputCode.Card(独立多格卡片/下划线样式)+ InputCode.Input(含获取验证码按钮的一行式输入框)。两者均支持受控/非受控、倒计时、错误提示",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"安全验证",
|
|
8
|
+
"验证码输入"
|
|
9
|
+
],
|
|
10
|
+
"useCases": [
|
|
11
|
+
"短信验证",
|
|
12
|
+
"邮箱验证",
|
|
13
|
+
"双因素认证"
|
|
14
|
+
],
|
|
15
|
+
"riskLevel": "high"
|
|
16
|
+
},
|
|
17
|
+
"protocolSummary": "**两个子组件差异对比**:\n- `InputCode.Card`:多格卡片式(每格一个字符),type='card'|'underline',value/onChange 是 string[],onFinish 在最后一格输入完成时触发,onReset 重新发送(返回 Promise<boolean>,true 才启动倒计时)\n- `InputCode.Input`:一体式(带获取验证码按钮),type='btnIntegrated'|'btnSplit',value/onChange 是 string(整串),onGetCode 点击获取验证码按钮时触发(返回 Promise<boolean>,true 才启动倒计时)\n\n**import 方式**: `import { InputCode } from '@para-ui/core'`,然后用 `<InputCode.Card />` 或 `<InputCode.Input />`",
|
|
18
|
+
"variants": {
|
|
19
|
+
"card": {
|
|
20
|
+
"meaning": "卡片样式(InputCode.Card type='card')"
|
|
21
|
+
},
|
|
22
|
+
"underline": {
|
|
23
|
+
"meaning": "下划线样式(InputCode.Card type='underline')"
|
|
24
|
+
},
|
|
25
|
+
"btnIntegrated": {
|
|
26
|
+
"meaning": "按钮与输入框合一(InputCode.Input type='btnIntegrated')"
|
|
27
|
+
},
|
|
28
|
+
"btnSplit": {
|
|
29
|
+
"meaning": "按钮与输入框分离(InputCode.Input type='btnSplit')"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"states": [
|
|
33
|
+
"default",
|
|
34
|
+
"error",
|
|
35
|
+
"countdown"
|
|
36
|
+
],
|
|
37
|
+
"subComponents": {
|
|
38
|
+
"InputCode.Card": {
|
|
39
|
+
"description": "多格卡片/下划线验证码输入;每格一字符,自动聚焦下一格,支持粘贴",
|
|
40
|
+
"props": "InputCodeCardProps",
|
|
41
|
+
"keyProps": "cardNumber(格数,默认6), type('card'|'underline'), value(string[]), onChange((val:string[])=>void), onFinish((val:string)=>void), onReset(()=>Promise<boolean>|boolean), refreshCountdown(触发倒计时), countdown(秒数), sendText(倒计时区域标题)"
|
|
42
|
+
},
|
|
43
|
+
"InputCode.Input": {
|
|
44
|
+
"description": "一行式验证码输入框 + 获取验证码按钮;value 是整串字符串",
|
|
45
|
+
"props": "InputCodeInputProps",
|
|
46
|
+
"keyProps": "type('btnIntegrated'|'btnSplit'), value(string), onChange((val:string)=>void), onGetCode(()=>Promise<boolean>|boolean), countdown(秒数), getCodeWidth(获取验证码按钮宽度), inputProps(TextField透传), label, required"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"idealProps": {
|
|
50
|
+
"cardNumber": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"default": 6,
|
|
53
|
+
"description": "(InputCode.Card)验证码格数"
|
|
54
|
+
},
|
|
55
|
+
"size": {
|
|
56
|
+
"type": "enum",
|
|
57
|
+
"values": [
|
|
58
|
+
"small",
|
|
59
|
+
"medium",
|
|
60
|
+
"large"
|
|
61
|
+
],
|
|
62
|
+
"default": "large",
|
|
63
|
+
"description": "大小"
|
|
64
|
+
},
|
|
65
|
+
"type": {
|
|
66
|
+
"type": "enum",
|
|
67
|
+
"values": [
|
|
68
|
+
"card",
|
|
69
|
+
"underline",
|
|
70
|
+
"btnIntegrated",
|
|
71
|
+
"btnSplit"
|
|
72
|
+
],
|
|
73
|
+
"default": "card",
|
|
74
|
+
"description": "样式类型:Card 子组件用 card/underline,Input 子组件用 btnIntegrated/btnSplit"
|
|
75
|
+
},
|
|
76
|
+
"value": {
|
|
77
|
+
"type": "string[] (Card) | string (Input)",
|
|
78
|
+
"description": "受控值:Card 是 string[](每格一项),Input 是 string(完整验证码串)"
|
|
79
|
+
},
|
|
80
|
+
"onChange": {
|
|
81
|
+
"type": "(val: string[]) => void (Card) | (val: string) => void (Input)",
|
|
82
|
+
"description": "值变化回调;类型随子组件不同"
|
|
83
|
+
},
|
|
84
|
+
"onFinish": {
|
|
85
|
+
"type": "(val: string) => void",
|
|
86
|
+
"description": "(InputCode.Card)最后一格输入完成时触发,val 是所有格拼接的完整字符串"
|
|
87
|
+
},
|
|
88
|
+
"onReset": {
|
|
89
|
+
"type": "() => Promise<boolean> | boolean",
|
|
90
|
+
"description": "(InputCode.Card)点击重新发送时触发;返回 true 才启动倒计时"
|
|
91
|
+
},
|
|
92
|
+
"onGetCode": {
|
|
93
|
+
"type": "() => Promise<boolean> | boolean",
|
|
94
|
+
"description": "(InputCode.Input)点击获取验证码按钮时触发;返回 true 才启动倒计时"
|
|
95
|
+
},
|
|
96
|
+
"countdown": {
|
|
97
|
+
"type": "number",
|
|
98
|
+
"default": 60,
|
|
99
|
+
"description": "倒计时秒数"
|
|
100
|
+
},
|
|
101
|
+
"refreshCountdown": {
|
|
102
|
+
"type": "number | undefined",
|
|
103
|
+
"description": "(InputCode.Card)变更为非 undefined 时触发倒计时重置;通常传递递增计数器触发"
|
|
104
|
+
},
|
|
105
|
+
"error": {
|
|
106
|
+
"type": "boolean",
|
|
107
|
+
"default": false,
|
|
108
|
+
"description": "错误态"
|
|
109
|
+
},
|
|
110
|
+
"helperText": {
|
|
111
|
+
"type": "ReactNode",
|
|
112
|
+
"description": "错误提示文案"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"do": [
|
|
116
|
+
"自动聚焦下一个输入框(InputCode.Card 内置行为)",
|
|
117
|
+
"支持粘贴完整验证码(InputCode.Card 自动拆分到各格)",
|
|
118
|
+
"验证码位数与后端接口保持一致,通过 cardNumber 配置",
|
|
119
|
+
"onReset/onGetCode 配合接口请求:return await sendSMS() 成功才启动倒计时"
|
|
120
|
+
],
|
|
121
|
+
"dont": [
|
|
122
|
+
"验证码位数与后端不一致——cardNumber 默认 6,后端 4 位时必须显式传 cardNumber={4}",
|
|
123
|
+
"没有倒计时限制——必须配置 countdown + onReset/onGetCode 防止频繁请求",
|
|
124
|
+
"Card 和 Input 子组件混用 value 类型——Card 是 string[],Input 是 string,混用导致类型错误"
|
|
125
|
+
],
|
|
126
|
+
"events": {
|
|
127
|
+
"onChange": {
|
|
128
|
+
"signature": "(val: string[]) => void (Card) | (val: string) => void (Input)",
|
|
129
|
+
"asyncSupported": false,
|
|
130
|
+
"examples": [
|
|
131
|
+
"InputCode.Card: onChange={(val) => setCode(val)} — val 是 string[],如 ['1','2','3','4','5','6']",
|
|
132
|
+
"InputCode.Input: onChange={(val) => setCode(val)} — val 是整串字符串,如 '123456'",
|
|
133
|
+
"受控模式:需同时传 value 和 onChange,否则输入会被重置"
|
|
134
|
+
],
|
|
135
|
+
"commonMistakes": [
|
|
136
|
+
"Card 子组件把 onChange 当 string 类型使用——Card.onChange 是 (val: string[]) => void 而不是 (val: string) => void",
|
|
137
|
+
"只传 onChange 不传 value 期望半受控——两者都传或都不传,半受控(有 onChange 无 value)在 rc 体系里行为不稳定",
|
|
138
|
+
"期望 onChange 在初始化时触发——组件 mount 时不触发 onChange,只在用户输入/粘贴时触发"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"onFinish": {
|
|
142
|
+
"signature": "(val: string) => void",
|
|
143
|
+
"asyncSupported": false,
|
|
144
|
+
"examples": [
|
|
145
|
+
"onFinish={(code) => verifyCode(code)} — 最后一格输入完成时触发,val 是 cardNumber 个字符拼接的字符串",
|
|
146
|
+
"onFinish={(code) => { if (code.length === cardNumber) submit(code); }} — 可在回调里额外校验长度",
|
|
147
|
+
"onFinish 不在 InputCode.Input 上——Input 子组件无 onFinish,需自己判断 onChange 的 val.length === 期望长度"
|
|
148
|
+
],
|
|
149
|
+
"commonMistakes": [
|
|
150
|
+
"在 InputCode.Input 上找 onFinish——Input 子组件没有 onFinish prop,只有 onChange",
|
|
151
|
+
"期望 onFinish 触发时验证码一定全填——用户可能粘贴后再清除,建议在 onFinish 里再次校验 val.length",
|
|
152
|
+
"传了 value 受控但 onFinish 里直接调接口不等 onChange 更新——受控模式 onChange 触发后父组件需更新 value,onFinish 里的 val 是当前内部状态"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"onReset": {
|
|
156
|
+
"signature": "() => Promise<boolean> | boolean",
|
|
157
|
+
"asyncSupported": true,
|
|
158
|
+
"examples": [
|
|
159
|
+
"onReset={async () => { const ok = await sendSMS(); return ok; }} — 返回 true 时启动倒计时,false 时不启动",
|
|
160
|
+
"onReset={() => true} — 测试用,直接返回 true 立即启动倒计时",
|
|
161
|
+
"onReset={async () => { try { await api.resend(); return true; } catch { return false; } }} — 接口失败时返回 false 不重置倒计时"
|
|
162
|
+
],
|
|
163
|
+
"commonMistakes": [
|
|
164
|
+
"onReset 没有 return 值——隐式返回 undefined,被当作 falsy,倒计时不启动",
|
|
165
|
+
"在 InputCode.Input 上传 onReset——Input 子组件的对应 prop 是 onGetCode,不是 onReset",
|
|
166
|
+
"期望 onReset 触发时自动清空验证码格——src 不自动清空 value,需父组件在 onReset 里手动 setValue(new Array(cardNumber).fill(''))"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"typescriptPitfalls": [
|
|
171
|
+
{
|
|
172
|
+
"issue": "InputCode.Card 和 InputCode.Input 的 value/onChange 类型不同,不能共用同一个 state",
|
|
173
|
+
"wrong": "const [code, setCode] = useState<string>(''); <InputCode.Card value={code} onChange={setCode} /> // Card value 是 string[],TS2322",
|
|
174
|
+
"right": "const [code, setCode] = useState<string[]>([]); <InputCode.Card value={code} onChange={setCode} /> // Card 用 string[]"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"issue": "onReset/onGetCode 返回类型是 Promise<boolean> | boolean,必须有明确返回值",
|
|
178
|
+
"wrong": "onReset={async () => { await sendSMS(); }} // 没有 return,隐式 undefined,倒计时不启动",
|
|
179
|
+
"right": "onReset={async () => { await sendSMS(); return true; }} // 明确 return true 才启动倒计时"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"issue": "refreshCountdown 触发倒计时的是「值变化」不是「变成非 undefined」,传固定值无效",
|
|
183
|
+
"wrong": "// 用 boolean 控制:refreshCountdown={shouldRefresh ? 1 : undefined} // 只在第一次 undefined→1 时触发,第二次不变",
|
|
184
|
+
"right": "const [counter, setCounter] = useState(0); // 每次重置递增\nonReset={async () => { setCounter(c => c+1); return true; }}\n<InputCode.Card refreshCountdown={counter} />"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"mapping": {
|
|
188
|
+
"realComponent": "InputCode",
|
|
189
|
+
"adapter": null
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "InputLang",
|
|
3
|
+
"category": "Data Entry",
|
|
4
|
+
"description": "多语言输入框,支持多语种内容录入 + 语种切换。内部维护多语对象 `{[langKey]: string}`,通过 typeOutput 控制输出形态(对象 / JSON 字符串)",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"多语言内容录入",
|
|
8
|
+
"国际化字段管理",
|
|
9
|
+
"翻译数据编辑"
|
|
10
|
+
],
|
|
11
|
+
"useCases": [
|
|
12
|
+
"i18n 产品名 / 标签 / 描述录入",
|
|
13
|
+
"翻译管理后台",
|
|
14
|
+
"多语种 SEO 字段"
|
|
15
|
+
],
|
|
16
|
+
"riskLevel": "normal"
|
|
17
|
+
},
|
|
18
|
+
"keyFormatBehavior": {
|
|
19
|
+
"supportedFormats": "**支持任意字符串作为 langKey**:短码('zh'/'en')、BCP 47('zh-CN'/'en-US'/'ja-JP')、自定义键名都可以。组件**不校验键名格式**,只把 langList 条目当作 value 对象的 key 使用",
|
|
20
|
+
"examples": "// 都合法:\n<InputLang langList={['zh', 'en']} value={{zh: '你好', en: 'Hello'}} />\n<InputLang langList={['zh-CN', 'en-US']} value={{'zh-CN': '你好', 'en-US': 'Hello'}} />\n<InputLang langList={['simplified', 'traditional']} value={{simplified: '你好', traditional: '妳好'}} />",
|
|
21
|
+
"warning": "**value 对象的 key 必须与 langList 字符串/value 字段完全匹配**(区分大小写 + 区分连字符)。例如 langList=['zh-CN'] 但 value={zh: '你好'} 时,InputLang 切到 zh-CN 标签后读不到值"
|
|
22
|
+
},
|
|
23
|
+
"langListDisplayBehavior": {
|
|
24
|
+
"stringMode": "**简写 string[] 模式**:每个字符串既是 value(内部 key)又是 label(弹层显示文本)。例 `langList={['zh-CN', 'en-US']}` 时,弹层切换 tab 显示的是 'zh-CN' / 'en-US' 字符串本身,**不是 '中文' / '英文' 本地化名称**",
|
|
25
|
+
"objectMode": "**对象 `{label, value}[]` 模式**:label 用于弹层显示,value 用于 value 对象的 key。例 `langList={[{label: '中文', value: 'zh-CN'}, {label: 'English', value: 'en-US'}]}`,弹层显示 '中文' / 'English' 友好文本,内部 value 对象用 'zh-CN' / 'en-US' 作 key",
|
|
26
|
+
"useWhen": "纯开发场景(配置 / 调试):用 string[] 简洁。**用户面向场景:用 {label, value}[] 配本地化文本**(string[] 显示原始 key 不友好)"
|
|
27
|
+
},
|
|
28
|
+
"variants": {
|
|
29
|
+
"default": {
|
|
30
|
+
"meaning": "默认样式"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"states": [
|
|
34
|
+
"default",
|
|
35
|
+
"disabled",
|
|
36
|
+
"error"
|
|
37
|
+
],
|
|
38
|
+
"idealProps": {
|
|
39
|
+
"size": {
|
|
40
|
+
"type": "enum",
|
|
41
|
+
"values": [
|
|
42
|
+
"small",
|
|
43
|
+
"medium",
|
|
44
|
+
"large"
|
|
45
|
+
],
|
|
46
|
+
"default": "large",
|
|
47
|
+
"description": "大小"
|
|
48
|
+
},
|
|
49
|
+
"label": {
|
|
50
|
+
"type": "ReactNode",
|
|
51
|
+
"description": "标题"
|
|
52
|
+
},
|
|
53
|
+
"labelTooltip": {
|
|
54
|
+
"type": "LabelTooltipProps",
|
|
55
|
+
"description": "标题旁帮助提示;对象,见 Label 组件 LabelTooltipProps"
|
|
56
|
+
},
|
|
57
|
+
"placeholder": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "输入值的提示语(非语言键)"
|
|
60
|
+
},
|
|
61
|
+
"placeholderKey": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "语言键侧的提示语;label='国际化' 模式常配合 placeholder 使用"
|
|
64
|
+
},
|
|
65
|
+
"placeholderValue": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "翻译值侧的提示语"
|
|
68
|
+
},
|
|
69
|
+
"langList": {
|
|
70
|
+
"type": "(string | { label: string; value: string })[]",
|
|
71
|
+
"default": "['zh', 'en']",
|
|
72
|
+
"description": "**支持的语种列表**。两种形态:① 简写 string[] 如 `['zh', 'en']` —— 弹层显示原始 key 字符串(非本地化名);② 对象 `{label, value}[]` 如 `[{label:'中文',value:'zh'}]` —— 弹层显示 label 文本,内部用 value 作 key。**任意字符串都可作 langKey**(短码 / BCP 47 / 自定义,见 keyFormatBehavior)"
|
|
73
|
+
},
|
|
74
|
+
"value": {
|
|
75
|
+
"type": "string | { [name: string]: string }",
|
|
76
|
+
"description": "**受控值,形态由 typeOutput 控制**:typeOutput='object'(默认)→ `{zh:'输入框', en:'...'}` 多语对象;typeOutput='string' → JSON 字符串如 `'{\"zh\":\"输入框\",\"en\":\"...\",\"_i18n\":1}'`。**注:不是 Record<string,string>**(虽然语义上等价,签名是 `{[name]: string}` 索引签名形态),业务用 Record<string,string> 时需要 `as unknown as` 中转"
|
|
77
|
+
},
|
|
78
|
+
"defaultValue": {
|
|
79
|
+
"type": "string | { [name: string]: string }",
|
|
80
|
+
"description": "非受控初始值;形态同 value。可与 langList string[] 简写组合使用(两者正交)"
|
|
81
|
+
},
|
|
82
|
+
"onChange": {
|
|
83
|
+
"type": "(val: string | { [name: string]: string }) => void",
|
|
84
|
+
"description": "值变化回调;val 形态随 typeOutput 变化(string 或对象)。**业务签名 (val: Record<string, string>) => void**:可用 typeof 守卫 + `as unknown as Record<string,string>` 处理"
|
|
85
|
+
},
|
|
86
|
+
"typeOutput": {
|
|
87
|
+
"type": "enum",
|
|
88
|
+
"values": [
|
|
89
|
+
"string",
|
|
90
|
+
"object"
|
|
91
|
+
],
|
|
92
|
+
"default": "object",
|
|
93
|
+
"description": "输出类型;'object' 输出多语对象,'string' 输出 JSON 字符串(含 _i18n 标识位)"
|
|
94
|
+
},
|
|
95
|
+
"required": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"default": "false",
|
|
98
|
+
"description": "是否必填"
|
|
99
|
+
},
|
|
100
|
+
"disabled": {
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"default": "false",
|
|
103
|
+
"description": "是否禁用"
|
|
104
|
+
},
|
|
105
|
+
"disabledTooltip": {
|
|
106
|
+
"type": "TooltipProps",
|
|
107
|
+
"description": "禁用态 hover 提示。**常用字段**:`title: ReactNode`(提示内容,最常用)、`placement?: 'top'|'bottom'|'left'|'right'|...`(方向)、`arrow?: boolean`(显示箭头)。完整字段见 Tooltip 组件文档"
|
|
108
|
+
},
|
|
109
|
+
"error": {
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"default": "false",
|
|
112
|
+
"description": "错误态视觉"
|
|
113
|
+
},
|
|
114
|
+
"helperText": {
|
|
115
|
+
"type": "ReactNode",
|
|
116
|
+
"description": "错误文本/辅助文本"
|
|
117
|
+
},
|
|
118
|
+
"hideErrorDom": {
|
|
119
|
+
"type": "boolean | null",
|
|
120
|
+
"description": "true=无错误时不渲染占位;false=都渲染;null=不渲染直接返回 null。见 HelperText 同名 prop"
|
|
121
|
+
},
|
|
122
|
+
"limitLength": {
|
|
123
|
+
"type": "number",
|
|
124
|
+
"description": "输入长度上限"
|
|
125
|
+
},
|
|
126
|
+
"i18n": {
|
|
127
|
+
"type": "boolean",
|
|
128
|
+
"description": "i18n 标识;typeOutput='string' 时默认 true(向输出 JSON 注入 _i18n=1)"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"commonMisconceptions": {
|
|
132
|
+
"M1": {
|
|
133
|
+
"wrong": "传 langList=['zh-CN', 'en-US'] 但 value={{ zh: '你好', en: 'Hello' }}(value 用短码 key)",
|
|
134
|
+
"result": "InputLang 切换到 'zh-CN' / 'en-US' 标签时读不到 value(因为 value 对象用的是 'zh'/'en' 短码 key) → 显示空内容",
|
|
135
|
+
"fix": "**langList 字符串/value 字段与 value 对象 key 必须完全一致**:要么都用短码(`langList=['zh','en']` + `value={{zh:'',en:''}}`),要么都用 BCP 47(`langList=['zh-CN','en-US']` + `value={{'zh-CN':'','en-US':''}}`)"
|
|
136
|
+
},
|
|
137
|
+
"M2": {
|
|
138
|
+
"wrong": "用 langList=['zh-CN', 'en-US'] 期望弹层显示 '中文' / 'English' 友好文本",
|
|
139
|
+
"result": "**string[] 简写模式弹层显示原始字符串**(显示 'zh-CN' / 'en-US' 而非翻译名)",
|
|
140
|
+
"fix": "用对象形式 `langList={[{label: '中文', value: 'zh-CN'}, {label: 'English', value: 'en-US'}]}` —— label 是显示文本,value 是内部 key"
|
|
141
|
+
},
|
|
142
|
+
"M3": {
|
|
143
|
+
"wrong": "在 onChange 回调签名是 `(val: Record<string, string>) => void` 的业务接口里直接接 InputLang.onChange,期望 TS 自动兼容",
|
|
144
|
+
"result": "**InputLang.onChange 签名是 `(val: string | { [name: string]: string }) => void`**,有 string 联合分支。直接传业务 callback 会因 string 分支不兼容 → TS 报错",
|
|
145
|
+
"fix": "用 typeof 守卫 + cast: `onChange={(val) => { if (typeof val !== 'string') businessCallback(val as unknown as Record<string, string>); }}` 或者用 typeOutput='object' 保证不会出现 string 分支"
|
|
146
|
+
},
|
|
147
|
+
"M4": {
|
|
148
|
+
"wrong": "假设 langList 默认值是空数组",
|
|
149
|
+
"result": "**默认值是 `['zh', 'en']`**(代码 L114 实证)。不传 langList 时 InputLang 仍然显示 zh/en 两个语种 tab",
|
|
150
|
+
"fix": "需要纯空白:显式传 `langList={[]}`(罕见)。需要完全自定义语种:传完整 langList 覆盖默认"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"do": [
|
|
154
|
+
"**langList 字符串/value 字段与 value 对象 key 一致**(全短码或全 BCP 47,见 M1)",
|
|
155
|
+
"**用户面向场景用对象形式 langList**(配 label 本地化文本,M2)",
|
|
156
|
+
"**业务 callback Record<string,string>**:typeof 守卫 + as unknown as 中转(M3)",
|
|
157
|
+
"**typeOutput 默认 'object'** —— 直接用对象形态;只在需要 JSON 持久化时用 'string'",
|
|
158
|
+
"禁用态配合 disabledTooltip={{title: '已归档,不可编辑'}} 给业务语义化提示"
|
|
159
|
+
],
|
|
160
|
+
"dont": [
|
|
161
|
+
"**不要**让 langList key 与 value 对象 key 不一致 —— 读不到值(M1)",
|
|
162
|
+
"**不要**用 string[] langList 期望本地化显示 —— 显示原始 key(M2)",
|
|
163
|
+
"**不要**直接对接 Record<string,string> 业务 callback —— 联合签名不兼容(M3)",
|
|
164
|
+
"**不要**忘记不传 langList 时默认 ['zh','en'] —— 不是空数组(M4)",
|
|
165
|
+
"语言列表过多(>5)导致下拉过长 —— 考虑分组",
|
|
166
|
+
"忽略默认语言设置"
|
|
167
|
+
],
|
|
168
|
+
"events": {
|
|
169
|
+
"onChange": {
|
|
170
|
+
"signature": "(val: string | { [name: string]: string }) => void",
|
|
171
|
+
"asyncSupported": false,
|
|
172
|
+
"examples": [
|
|
173
|
+
"typeOutput='object'(默认): onChange={(val) => { if (typeof val !== 'string') setState(val as Record<string,string>); }} — 对象形态,{zh:'内容', en:'content'}",
|
|
174
|
+
"typeOutput='string': onChange={(val) => { if (typeof val === 'string') setState(val); }} — JSON 字符串形态,'{\"zh\":\"内容\",\"_i18n\":1}'",
|
|
175
|
+
"弹窗关闭时触发(不是实时):用户在弹窗内修改其他语种值,关闭弹窗后 onChange 才触发一次完整 val"
|
|
176
|
+
],
|
|
177
|
+
"commonMistakes": [
|
|
178
|
+
"onChange 签名写成 (val: Record<string, string>) => void 直接接入——TypeScript 报错,InputLang.onChange 联合 string 分支,需 typeof 守卫",
|
|
179
|
+
"期望每次按键都触发 onChange——主语言(当前展示语言)实时触发,其他语言在弹窗关闭时批量触发一次",
|
|
180
|
+
"typeOutput='string' 时期望 onChange 返回的 val 是纯 JSON——实际含 _i18n 标识位,需 JSON.parse 后 delete _i18n 才是干净数据"
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"typescriptPitfalls": [
|
|
185
|
+
{
|
|
186
|
+
"issue": "onChange 签名是联合类型,直接接业务 Record<string,string> 回调触发 TS 不兼容",
|
|
187
|
+
"wrong": "const handler = (val: Record<string, string>) => setState(val); <InputLang onChange={handler} /> // 报 TS2322:string 分支和 Record 不兼容",
|
|
188
|
+
"right": "<InputLang onChange={(val) => { if (typeof val !== 'string') setState(val as unknown as Record<string,string>); }} />"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"issue": "value 类型签名是 `string | { [name: string]: string }` 不是 `Record<string, string>`,在 TS 5.x 可能触发 TS2352 直接 as cast 失败",
|
|
192
|
+
"wrong": "const data: Record<string,string> = {zh: '你好'}; <InputLang value={data as { [name: string]: string }} /> // TS5 strict 模式下拒绝结构兼容 as",
|
|
193
|
+
"right": "<InputLang value={data as unknown as { [name: string]: string }} /> // 用 unknown 中转"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"issue": "langList 默认值是 ['zh', 'en'],不传时已经有两个语种 tab,不是空列表",
|
|
197
|
+
"wrong": "// 期望没有多语切换,不传 langList\n<InputLang value={val} onChange={onChange} /> // 实际显示 zh/en 两个 tab,点击地球图标弹出语种选择",
|
|
198
|
+
"right": "// 需要禁用多语:传 langList={[]}(无弹出语种)或 disabledAdd + disabledDelete + disabledKey 锁定行为"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"mapping": {
|
|
202
|
+
"realComponent": "InputLang",
|
|
203
|
+
"adapter": null
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "InputNumber",
|
|
3
|
+
"category": "Data Entry",
|
|
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
|
+
"focus",
|
|
24
|
+
"blur",
|
|
25
|
+
"disabled",
|
|
26
|
+
"error"
|
|
27
|
+
],
|
|
28
|
+
"idealProps": {
|
|
29
|
+
"value": {
|
|
30
|
+
"type": "number | null | undefined",
|
|
31
|
+
"description": "受控值;clearable=true 时类型为 number | null,默认为 number | undefined"
|
|
32
|
+
},
|
|
33
|
+
"defaultValue": {
|
|
34
|
+
"type": "number | null | undefined",
|
|
35
|
+
"description": "非受控默认值;类型规则同 value"
|
|
36
|
+
},
|
|
37
|
+
"onChange": {
|
|
38
|
+
"type": "(value: number | null) => void",
|
|
39
|
+
"description": "值变化回调;clearable=true 时入参 number | null;默认时收敛为 number"
|
|
40
|
+
},
|
|
41
|
+
"clearable": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"default": false,
|
|
44
|
+
"description": "是否允许清空;true 时 onChange 入参 number | null;false(默认)时清空被拦截、失焦回填上一值。组件泛型 InputNumberProps<C extends boolean> 由该 prop 驱动"
|
|
45
|
+
},
|
|
46
|
+
"max": {
|
|
47
|
+
"type": "number",
|
|
48
|
+
"description": "最大值;超出后加按钮禁用,失焦回收"
|
|
49
|
+
},
|
|
50
|
+
"min": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"description": "最小值;低于后减按钮禁用,失焦回收"
|
|
53
|
+
},
|
|
54
|
+
"step": {
|
|
55
|
+
"type": "number",
|
|
56
|
+
"default": 1,
|
|
57
|
+
"description": "步进值"
|
|
58
|
+
},
|
|
59
|
+
"btnMode": {
|
|
60
|
+
"type": "'lr' | 'tb' | 'none'",
|
|
61
|
+
"values": ["lr", "tb", "none"],
|
|
62
|
+
"default": "tb",
|
|
63
|
+
"description": "按钮模式;lr=左右加减、tb=右侧上下加减、none=无按钮"
|
|
64
|
+
},
|
|
65
|
+
"formatter": {
|
|
66
|
+
"type": "(value: number | string, info: { userTyping: boolean; input: string }) => string",
|
|
67
|
+
"description": "数字 → 展示字符串;必须与 parser 配对"
|
|
68
|
+
},
|
|
69
|
+
"parser": {
|
|
70
|
+
"type": "(displayValue: string) => number",
|
|
71
|
+
"description": "展示字符串 → 数字;与 formatter 配对,返回值作为 onChange 入参"
|
|
72
|
+
},
|
|
73
|
+
"disabled": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"default": false,
|
|
76
|
+
"description": "是否禁用"
|
|
77
|
+
},
|
|
78
|
+
"size": {
|
|
79
|
+
"type": "'small' | 'medium' | 'large'",
|
|
80
|
+
"values": ["small", "medium", "large"],
|
|
81
|
+
"default": "large",
|
|
82
|
+
"description": "尺寸"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"do": [
|
|
86
|
+
"限制 min 和 max 以符合业务逻辑",
|
|
87
|
+
"需要小数精度时通过 formatter / parser 组合实现",
|
|
88
|
+
"受控模式必须同时传 value 和 onChange",
|
|
89
|
+
"需要清空场景显式传 clearable=true,并用 number | null 类型的 state"
|
|
90
|
+
],
|
|
91
|
+
"dont": [
|
|
92
|
+
"使用 Text Input 录入需要计算的数字",
|
|
93
|
+
"步进值 (step) 设置过大导致无法精确调节",
|
|
94
|
+
"clearable=false(默认)时把 state 初始化为 null —— 会触发类型错误",
|
|
95
|
+
"传 formatter 不传 parser(或反之)—— 二者必须配对"
|
|
96
|
+
],
|
|
97
|
+
"events": {
|
|
98
|
+
"onChange": {
|
|
99
|
+
"signature": "clearable=false: (value: number) => void | clearable=true: (value: number | null) => void",
|
|
100
|
+
"asyncSupported": false,
|
|
101
|
+
"examples": [
|
|
102
|
+
"clearable=false(默认): onChange={(val) => setState(val)} — val 是 number,清空被拦截,失焦时回填上一次有效值",
|
|
103
|
+
"clearable=true: onChange={(val) => setState(val)} — val 是 number | null,用户清空后 val=null 传出",
|
|
104
|
+
"加减按钮点击也触发 onChange,通过内部精度计算避免浮点误差(12位精度)"
|
|
105
|
+
],
|
|
106
|
+
"commonMistakes": [
|
|
107
|
+
"clearable=false 时把 state 类型声明为 number | null——ts 会报错 null 不符合 onChange 签名的 number 入参",
|
|
108
|
+
"期望 onChange 在 mount 时触发初始 defaultValue——组件不触发初始 onChange,只在用户交互时触发",
|
|
109
|
+
"使用受控 value 但不传 onChange——value 更新不回流到组件,显示值和 state 不同步"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"onBlur": {
|
|
113
|
+
"signature": "(event: React.FocusEvent<HTMLInputElement>) => void",
|
|
114
|
+
"asyncSupported": false,
|
|
115
|
+
"examples": [
|
|
116
|
+
"onBlur={(e) => validate(e.target.value)} — 失焦时校验",
|
|
117
|
+
"clearable=false 时 onBlur 之后组件内部回填上一次有效值(如用户清空输入框)——在 onBlur 里读 e.target.value 可能是回填前的空串",
|
|
118
|
+
"onBlur={(e) => setError(Number(e.target.value) < min ? '低于最小值' : '')} — 配合 min/max 做自定义错误提示"
|
|
119
|
+
],
|
|
120
|
+
"commonMistakes": [
|
|
121
|
+
"在 onBlur 里读 e.target.value 作为最终值——clearable=false 失焦会触发回填,此时 value 可能已被重写,应用 onChange 最新值或 ref 维护",
|
|
122
|
+
"期望 onBlur 和 onChange 同时触发——清空后失焦只触发 onBlur(onChange 被拦截了),需在 onBlur 里独立处理",
|
|
123
|
+
"期望 onBlur 的 e.target 是最终显示值——回填逻辑发生在 onBlur handler 内部,timing 依赖 dom.value 写入"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"onEnter": {
|
|
127
|
+
"signature": "(event: React.KeyboardEvent<HTMLInputElement>) => void",
|
|
128
|
+
"asyncSupported": false,
|
|
129
|
+
"examples": [
|
|
130
|
+
"onEnter={(e) => submitForm()} — 按回车提交表单",
|
|
131
|
+
"onEnter={(e) => { e.preventDefault(); nextFieldRef.current?.focus(); }} — 回车跳到下一字段",
|
|
132
|
+
"onEnter 和 onChange 独立触发——回车不会触发失焦,不会触发回填逻辑"
|
|
133
|
+
],
|
|
134
|
+
"commonMistakes": [
|
|
135
|
+
"在 onEnter 里读 e.target.value 期望是最终数字——回车时 rc-input-number 可能还没 commit 值,建议用受控 value 而非 target.value",
|
|
136
|
+
"期望 onEnter 代替 onBlur 触发校验——两者行为不同,回车不失焦,需独立监听",
|
|
137
|
+
"传 onKeyDown 期望捕获回车——底层用的是 onPressEnter(rc-input-number),应用 onEnter prop"
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"typescriptPitfalls": [
|
|
142
|
+
{
|
|
143
|
+
"issue": "InputNumber 是泛型组件 InputNumber<C extends boolean>,clearable 决定 onChange/value 类型,不传 clearable 时默认 false(number 类型)",
|
|
144
|
+
"wrong": "const [val, setVal] = useState<number | null>(null); <InputNumber value={val} onChange={setVal} /> // val 和 setVal 含 null,但 clearable 默认 false 不允许 null,TS 报错",
|
|
145
|
+
"right": "const [val, setVal] = useState<number | null>(null); <InputNumber<true> clearable value={val} onChange={setVal} /> // 显式泛型参数或 clearable=true 驱动类型"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"issue": "formatter 和 parser 必须成对使用,只传一个会导致显示和实际值不同步",
|
|
149
|
+
"wrong": "formatter={(val) => `${val}%`} // 没有 parser,用户看到 '50%' 但内部 onChange 收到 '50%' 字符串而非数字",
|
|
150
|
+
"right": "formatter={(val) => `${val}%`} parser={(val) => parseFloat(val.replace('%', '')) as any} // 成对,parser 把展示串转回数字"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"issue": "addonBefore/addonAfter 是 ReactNode,传字符串可能 TS 允许但布局与 ReactNode 写法不一致",
|
|
154
|
+
"wrong": "<InputNumber addonBefore='¥' /> // 字符串是合法 ReactNode,但建议显式包 span 控制样式",
|
|
155
|
+
"right": "<InputNumber addonBefore={<span>¥</span>} /> // 或直接字符串;字符串也 OK,仅风格建议"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"mapping": {
|
|
159
|
+
"realComponent": "InputNumber",
|
|
160
|
+
"adapter": null
|
|
161
|
+
}
|
|
162
|
+
}
|