@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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../../../_virtual/jsx-runtime.js"),s=require("react"),f=l=>{const{error:n,placeholder:a,defaultValue:e,disabled:i,onChange:c,inputProps:d,moudle:m}=l,[p,t]=s.useState(e);return s.useEffect(()=>{t(e)},[e]),o.jsxRuntimeExports.jsx(o.jsxRuntimeExports.Fragment,{children:m({error:n,placeholder:a,value:p,disabled:i,hideErrorDom:null,...d,onChange:u=>{const r=u?.target?.value??u;t(r),c(r)}})})};exports.default=f;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { CheckboxGroupProps } from '../../../CheckboxGroup';
|
|
3
3
|
export interface FormCheckboxGroupProps extends CheckboxGroupProps {
|
|
4
|
-
defaultValue?:
|
|
5
|
-
change?: (value:
|
|
4
|
+
defaultValue?: (string | number)[];
|
|
5
|
+
change?: (value: unknown) => unknown;
|
|
6
6
|
}
|
|
7
7
|
declare const FormCheckboxGroup: FC<FormCheckboxGroupProps>;
|
|
8
8
|
export default FormCheckboxGroup;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const e=require("../../../_virtual/jsx-runtime.js"),u=require("react"),E=require("../../../node_modules/@para-ui/icons/Delete/index.js"),h=require("../../../node_modules/@para-ui/icons/LinkGroup/index.js"),q=require("../../../AutoTips/index.js"),F=require("../../../Button/index.js"),g=require("../../../node_modules/@para-ui/icons/UploadFile/index.js"),b=require("../../../GlobalContext/useFormatMessage.js"),v=require("../../lang/index.js");;/* empty css */const y=a=>{const{fileType:n="",defaultValue:t,onChange:c,disabled:r,buttonLabel:p,inputProps:f,buttonProps:j}=a,m=b.default("FormItem",v.default),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const e=require("../../../_virtual/jsx-runtime.js"),u=require("react"),E=require("../../../node_modules/@para-ui/icons/Delete/index.js"),h=require("../../../node_modules/@para-ui/icons/LinkGroup/index.js"),q=require("../../../AutoTips/index.js"),F=require("../../../Button/index.js"),g=require("../../../node_modules/@para-ui/icons/UploadFile/index.js"),b=require("../../../GlobalContext/useFormatMessage.js"),v=require("../../lang/index.js");;/* empty css */const y=a=>{const{fileType:n="",defaultValue:t,onChange:c,disabled:r,buttonLabel:p,inputProps:f,buttonProps:j}=a,m=b.default("FormItem",v.default),s=u.useRef(null),R=()=>{s.current?.click()},x=o=>{const d=o!==void 0?o:s.current?.files??null;l(d),c&&c(d),o===null&&s.current&&(s.current.value="")},[i,l]=u.useState();return u.useEffect(()=>{t&&l(t)},[t]),e.jsxRuntimeExports.jsxs("div",{className:"form-file",children:[!r&&e.jsxRuntimeExports.jsx(F.Button,{variant:"outlined",...j,startIcon:e.jsxRuntimeExports.jsx(g.UploadFile,{}),onClick:R,children:p||m({id:"chooseFile"})}),e.jsxRuntimeExports.jsx("input",{...f,ref:s,type:"file",onInput:()=>x(),hidden:!0,accept:typeof n=="string"?n:n.join(",")}),i&&i[0]&&e.jsxRuntimeExports.jsx("div",{className:`file-tips ${r&&"file-tips-disabled"||""}`,children:e.jsxRuntimeExports.jsxs("div",{className:"file-tips-item",children:[e.jsxRuntimeExports.jsx(h.LinkGroup,{}),e.jsxRuntimeExports.jsx("span",{className:"file-tips-context",children:e.jsxRuntimeExports.jsx(q.default,{children:typeof i=="string"?i:i[0].name})}),!r&&e.jsxRuntimeExports.jsx(E.Delete,{onClick:()=>x(null)})]})})]})};exports.default=y;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { RadioGroupProps } from '../../../RadioGroup';
|
|
3
3
|
export interface FormRadioGroupProps extends RadioGroupProps {
|
|
4
4
|
defaultValue?: string;
|
|
5
|
-
change?: (value:
|
|
5
|
+
change?: (value: unknown) => unknown;
|
|
6
6
|
}
|
|
7
7
|
declare const FormRadioGroup: FC<FormRadioGroupProps>;
|
|
8
8
|
export default FormRadioGroup;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "FormItem",
|
|
3
|
+
"category": "Data Entry",
|
|
4
|
+
"description": "表单项,通常作 FieldForm 子组件使用,形成\"校验/收集值/提交\"链路。可独立用但脱离 FieldForm 时不会自动校验。需 FormItem 自渲染控件请用 InputType prop。",
|
|
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
|
+
"error",
|
|
25
|
+
"validating"
|
|
26
|
+
],
|
|
27
|
+
"idealProps": {
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "字段名(**仅 string,不支持 array 路径写法**)。需在 Form/FieldForm 上下文中保持唯一;不要传 `['user','address','city']`——会触发 TS2322。\n\n**字符串点路径协议**:`name` 可以写成 `'user.address.city'` 形式(TS 合法,不报错),但 FormItem 和 Form 均**不解析点路径**——表单聚合值是 `{ 'user.address.city': value }`(扁平 key,含字面量点),而**不是** `{ user: { address: { city: value } } }`(深度嵌套对象)。点路径字段可以正常传值、校验、回填,仅聚合 key 保持原字符串。这与 antd / rc-field-form 的 `name=['a','b','c']` 深度路径解析行为**不同**——本组件不做路径解析,只做 key 直传。若业务提交需要深度嵌套对象,在提交前自行将扁平结果转换(如 `{ 'user.address.city': 'Beijing' }` → `{ user: { address: { city: 'Beijing' } } }`),或改用 `FieldForm.Item`(支持 `name={['user','address','city']}` 数组路径)。"
|
|
31
|
+
},
|
|
32
|
+
"label": {
|
|
33
|
+
"type": "string | (props: FormItemProps) => ReactNode",
|
|
34
|
+
"description": "标签文案;可传字符串或函数式渲染。**不支持 null**——传 label={null} 会触发 TS2322。要『无 label』请使用 hideLabel。"
|
|
35
|
+
},
|
|
36
|
+
"hideLabel": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"default": false,
|
|
39
|
+
"description": "隐藏 label 区块(连同 label 占位一起去掉)。这是『无 label 字段』的正确写法。"
|
|
40
|
+
},
|
|
41
|
+
"rules": {
|
|
42
|
+
"type": "ruleType",
|
|
43
|
+
"description": "校验规则。**这是单个对象不是数组**(与 antd 的 rules: Rule[] 不同)。结构为 `{ validate: { required, maxlength, minLength, pattern, min, max, disOnlySpace, [自定义key]: fn }, message?: { required: '...', pattern: '...' } }`。 message 与 validate 中的 key 一一对应。校验函数签名 `(item, val, intl) => true | string`:返回 true 表示通过、返回字符串表示报错文案。**⚠️ 重要:脱离 FieldForm 独立使用时,rules 不会自动触发校验**——rules 仅渲染必填红星等视觉提示,required/pattern 等不会在 children 失焦/变更时执行;完整校验链路必须配合 FieldForm 上下文。"
|
|
44
|
+
},
|
|
45
|
+
"InputType": {
|
|
46
|
+
"type": "'default' | 'select' | 'switch' | 'textarea' | 'number' | 'file' | 'radioGroup' | 'checkGroup' | 'comboSelect' | ReactNode | FC",
|
|
47
|
+
"description": "FormItem 自动渲染输入控件的类型;不传 children 时按此类型渲染对应 paraui 组件。传 children 时 InputType 不生效(外部受控)。"
|
|
48
|
+
},
|
|
49
|
+
"inputProps": {
|
|
50
|
+
"type": "Record<string, any>",
|
|
51
|
+
"description": "InputType 渲染的内部控件透传 props(如 placeholder、options 等)。"
|
|
52
|
+
},
|
|
53
|
+
"type": {
|
|
54
|
+
"type": "'horizontal' | 'vertical'",
|
|
55
|
+
"values": [
|
|
56
|
+
"horizontal",
|
|
57
|
+
"vertical"
|
|
58
|
+
],
|
|
59
|
+
"default": "'horizontal'",
|
|
60
|
+
"description": "label 与表单项的横纵布局。"
|
|
61
|
+
},
|
|
62
|
+
"labelWidth": {
|
|
63
|
+
"type": "number",
|
|
64
|
+
"description": "label 区块宽度(仅 type='vertical' 时生效)。"
|
|
65
|
+
},
|
|
66
|
+
"tips": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "label 旁的 tooltip 提示文案。"
|
|
69
|
+
},
|
|
70
|
+
"hideError": {
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"default": false,
|
|
73
|
+
"description": "隐藏校验错误提示(不影响校验逻辑本身)。"
|
|
74
|
+
},
|
|
75
|
+
"defaultValue": {
|
|
76
|
+
"type": "any",
|
|
77
|
+
"description": "默认值。会被 FieldForm 的回填数据 backData 覆盖。"
|
|
78
|
+
},
|
|
79
|
+
"disabled": {
|
|
80
|
+
"type": "boolean",
|
|
81
|
+
"description": "InputType 渲染的控件是否禁用(仅自动渲染场景生效)。"
|
|
82
|
+
},
|
|
83
|
+
"change": {
|
|
84
|
+
"type": "(value: any) => void",
|
|
85
|
+
"description": "值变化回调(仅 InputType 自动渲染场景由内部 ItemType 触发;外部 children 受控时不会自动触发——需自己监听)。"
|
|
86
|
+
},
|
|
87
|
+
"children": {
|
|
88
|
+
"type": "ReactNode",
|
|
89
|
+
"description": "自定义渲染输入控件——FormItem **不会自动注入 value/onChange**,使用方需自行受控。传了 children 时 InputType 自动渲染分支会被跳过。"
|
|
90
|
+
},
|
|
91
|
+
"errorMessage": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "**脱离 FieldForm 独立使用时的受控错误文案(父组件接管 pattern)**。独立使用时 FormItem 不会自动触发 rules 校验——rules 仅渲染必填红星。错误文案必须由父组件主动驱动:① 父组件自行执行校验逻辑(如在 onBlur 中判断);② 把校验结果写入 `errorMessage` prop(非空字符串 → 显示错误外壳;`''`/`null`/`undefined` → 清除错误状态)。不要同时传 `error` 或 `helperText`——独立使用场景统一用 `errorMessage`。"
|
|
94
|
+
},
|
|
95
|
+
"hide": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "是否隐藏该表单项(src/FormItem/index.tsx:109 interface 实证)。hide=true 时 FormItem 不渲染(不占位),且 form.current.check() 和 form.current.getValidValues() 会跳过该字段。**与 CSS display:none 不同**——hide=true 时字段值不参与校验也不出现在提交结果中"
|
|
98
|
+
},
|
|
99
|
+
"className": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "表单项容器自定义类名(src/FormItem/index.tsx:170 interface 实证)"
|
|
102
|
+
},
|
|
103
|
+
"itemType": {
|
|
104
|
+
"type": "'default' | 'select' | 'switch' | 'textarea' | 'number' | 'file' | 'radioGroup' | 'checkGroup' | 'comboSelect' | ReactNode | FC",
|
|
105
|
+
"description": "InputType 的别名(src/FormItem/index.tsx:74 interface 实证:itemType 与 InputType 同义,src 内部两者都检查)。**推荐用 InputType**——itemType 是历史命名,两者功能完全相同"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"do": [
|
|
109
|
+
"把 FormItem 作为 FieldForm 的子组件使用——形成完整的校验 + 提交链路",
|
|
110
|
+
"字段名仅传 string;嵌套字段在 FieldForm 层面用 schema 表达",
|
|
111
|
+
"校验规则用 paraui 自有 schema:`{ validate: { required: true, minLength: 8 }, message: { required: '请输入', minLength: '至少 8 位' } }`,不要传 `[{ required, message }]` 数组形式(会触发 TS2559)",
|
|
112
|
+
"无 label 字段使用 `hideLabel` 而不是 `label={null}`",
|
|
113
|
+
"需要自定义控件时把控件放在 children;需要自动渲染时用 InputType + inputProps",
|
|
114
|
+
"脱离 FieldForm 独立使用时:由父组件管理 children 的 value/onChange + 在父组件主动调用业务校验函数,把校验结果写入 FormItem 的 `errorMessage` prop 受控显示"
|
|
115
|
+
],
|
|
116
|
+
"dont": [
|
|
117
|
+
"不要嵌套 FormItem",
|
|
118
|
+
"不要传 `name={['user', 'address', 'city']}`——name 仅 string",
|
|
119
|
+
"不要传 `label={null}`——会触发 TS2322;要无 label 用 `hideLabel`",
|
|
120
|
+
"不要按 antd 风格写 `rules={[{ required: true, message: '...' }]}`——会触发 TS2559;本组件 rules 是单对象 ruleType",
|
|
121
|
+
"不要假设 FormItem 自动给 children cloneElement 注入 value/onChange——本组件不做注入",
|
|
122
|
+
"不要期望 FormItem 在脱离 FieldForm 时自动触发 rules.validate.required 等校验——独立模式下 rules 仅作类型描述,业务校验需父组件主动驱动"
|
|
123
|
+
],
|
|
124
|
+
"events": {
|
|
125
|
+
"change": {
|
|
126
|
+
"signature": "(value: any) => void",
|
|
127
|
+
"asyncSupported": false,
|
|
128
|
+
"examples": [
|
|
129
|
+
"change={(val) => setValue(val)} — 仅 InputType 自动渲染场景由内部 ItemType 触发;外部 children 受控时不会自动触发",
|
|
130
|
+
"InputType='select' 时 change 在用户选中选项时触发,value 为选中项的 value 字段值",
|
|
131
|
+
"InputType='switch' 时 change 在用户 toggle 时触发,value 为布尔值 true/false"
|
|
132
|
+
],
|
|
133
|
+
"commonMistakes": [
|
|
134
|
+
"传了 children 还期望 change 自动触发——children 受控时 ItemType 不渲染,change 永不触发,需在 children 中自己监听",
|
|
135
|
+
"假设 change 签名与 onChange 相同是 (e) => void 原生事件——实际签名是 (value: any) => void,直接是值而非 event",
|
|
136
|
+
"脱离 FieldForm 独立使用时期望 change 携带字段名——change 只传 value,字段名需父组件通过 name 自行关联"
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"typescriptPitfalls": [
|
|
141
|
+
{
|
|
142
|
+
"issue": "FormItem.name 只接受 string,不能传数组路径",
|
|
143
|
+
"wrong": "const fieldName: string[] = ['user', 'address']; <FormItem name={fieldName} /> // TS2322 string[] 不能赋给 string",
|
|
144
|
+
"right": "<FormItem name='user.address' /> // 点路径字符串是合法的 string,但不会被解析为嵌套对象,聚合 key 保持原字符串形态"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"issue": "rules 是单对象不是数组——antd 风格写法 rules={[{required}]} 触发 TS2559",
|
|
148
|
+
"wrong": "<FormItem name='email' rules={[{ required: true, message: '必填' }]} /> // TS2559: Type '...[]' has no properties in common with ruleType",
|
|
149
|
+
"right": "<FormItem name='email' rules={{ validate: { required: true }, message: { required: '必填' } }} />"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"issue": "label 不支持传 null,要无 label 应用 hideLabel",
|
|
153
|
+
"wrong": "<FormItem name='code' label={null} /> // TS2322: Type 'null' is not assignable to 'string | (props: FormItemProps) => ReactNode'",
|
|
154
|
+
"right": "<FormItem name='code' hideLabel /> // 正确隐藏 label 区块"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"issue": "InputType 和 itemType 同时存在时,src 优先取 InputType(itemType 是别名)",
|
|
158
|
+
"wrong": "// 同时传两个不同值,期望 itemType 生效\n<FormItem name='x' itemType='select' InputType='default' /> // InputType 优先,select 不生效",
|
|
159
|
+
"right": "// 统一用 InputType,itemType 是历史别名\n<FormItem name='x' InputType='select' />"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"issue": "select 子项的 list 字段用 value,radioGroup/checkGroup 用 name——混用导致选中后 change 不传值",
|
|
163
|
+
"wrong": "InputType='select' list={[{label: 'A', name: 'a'}]} // select 读 value 字段,name 被忽略",
|
|
164
|
+
"right": "InputType='select' list={[{label: 'A', value: 'a'}]} // 而 radioGroup/checkGroup 用 name 字段"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"mapping": {
|
|
168
|
+
"realComponent": "FormItem",
|
|
169
|
+
"adapter": null
|
|
170
|
+
}
|
|
171
|
+
}
|
package/lib/FormItem/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type formInputType = 'checkGroup' | 'select' | 'radioGroup' | 'textarea'
|
|
|
8
8
|
* 表单操作项的其他配置
|
|
9
9
|
*/
|
|
10
10
|
interface inputProps {
|
|
11
|
-
[name: string]:
|
|
11
|
+
[name: string]: unknown;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* 校验规则
|
|
@@ -73,7 +73,7 @@ export interface FormItemProps {
|
|
|
73
73
|
/**
|
|
74
74
|
* 值改变传出
|
|
75
75
|
*/
|
|
76
|
-
change?: (value:
|
|
76
|
+
change?: (value: unknown) => void;
|
|
77
77
|
/**
|
|
78
78
|
* 不显示 该选项
|
|
79
79
|
*/
|
|
@@ -114,7 +114,7 @@ export interface FormItemProps {
|
|
|
114
114
|
* 回填数据
|
|
115
115
|
*/
|
|
116
116
|
backData?: {
|
|
117
|
-
[name: string]:
|
|
117
|
+
[name: string]: unknown;
|
|
118
118
|
};
|
|
119
119
|
/**
|
|
120
120
|
* 是否启用必填框,不允许输入纯空格
|
|
@@ -131,7 +131,7 @@ export interface FormItemProps {
|
|
|
131
131
|
/**
|
|
132
132
|
* 其他配置
|
|
133
133
|
*/
|
|
134
|
-
[name: string]:
|
|
134
|
+
[name: string]: unknown;
|
|
135
135
|
/**
|
|
136
136
|
* 自定义class
|
|
137
137
|
*/
|
|
@@ -140,7 +140,7 @@ export interface FormItemProps {
|
|
|
140
140
|
* 默认值
|
|
141
141
|
* 会被backData,回填数据替换
|
|
142
142
|
*/
|
|
143
|
-
defaultValue?:
|
|
143
|
+
defaultValue?: unknown;
|
|
144
144
|
/**
|
|
145
145
|
* 是否是paraui表单组件
|
|
146
146
|
* */
|
package/lib/FormItem/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const e=require("../_virtual/jsx-runtime.js"),f=require("react"),w=require("./itemType.js"),I=require("./errorTips.js"),p=require("clsx"),L=require("../Label/index.js"),u=require("../GlobalContext/constant.js");;/* empty css */const S={checkGroup:!0,select:!0,radioGroup:!0,textarea:!0,default:!0,switch:!0,number:!0,file:!0,comboSelect:!0},k=s=>{const{type:o="horizontal",labelWidth:c,tips:m,label:i,itemType:h,InputType:l=h,setValue:j,errorMessage:x,hideLabel:b,backData:n={},defaultValue:E,name:t,hideError:$=!1,className:d="",labelProps:v,helperTextProps:R,requiredElement:y,disRequiredElement:q=!1}=s;n[t]===void 0&&(n[t]=E);const a=f.useRef(),T=r=>{a.current&&a.current(r)},g=r=>o==="vertical"?e.jsxRuntimeExports.jsx("div",{className:`form-content-vertical form-content-vertical-${t}`,style:{width:`calc(100% - ${c}px)`},children:r.children}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:r.children}),N=f.useCallback(()=>i?typeof i=="string"?i:i(s):"",[i]),C=()=>{let r=`${u.$prefixCls}-form-item ${u.$prefixCls}-form-item-${t}`;return d&&(r+=` ${d}`),typeof l=="string"&&S[l]&&(r+=` ${u.$prefixCls}-form-item-${l}`),r};return e.jsxRuntimeExports.jsxs("div",{className:C(),children:[!b&&e.jsxRuntimeExports.jsx("div",{className:p(`form-label form-label-${t}`,o==="vertical"&&"form-label-vertical"),style:{width:o==="vertical"?`${c}px`:""},children:e.jsxRuntimeExports.jsx(L.default,{className:p("form-labe-text",m&&"form-labe-text-hastips"),label:N(),required:!!s?.rules?.validate?.required,tooltip:m,tooltipIcon:q?"":y,...v})}),e.jsxRuntimeExports.jsxs(g,{children:[e.jsxRuntimeExports.jsx("div",{className:`form-edit form-edit-${t}`,children:s.children?s.children:e.jsxRuntimeExports.jsx(w.default,{setError:T,error:!!x,itemType:l,backData:n,...s,setValue:j})}),!$&&e.jsxRuntimeExports.jsx("div",{className:`form-error form-error-${t}`,children:e.jsxRuntimeExports.jsx(I.default,{getSetError:r=>a.current=r,helperTextProps:R,errorMessage:x})})]})]})};exports.default=k;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/FormItem/itemType.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../_virtual/jsx-runtime.js"),h=require("react"),g=require("../TextField/index.js"),y=require("./compoments/formRadioGroup/index.js"),F=require("./compoments/formSelect/index.js"),$=require("./compoments/formCheckboxGroup/index.js"),v=require("./validateFunction.js"),_=require("../Switch/index.js"),w=require("./compoments/formFile/index.js"),I=require("../InputNumber/index.js"),M=require("../ComboSelect/index.js"),k=require("./compoments/defaultCompoments/index.js"),D=require("../GlobalContext/useFormatMessage.js"),G=require("./lang/index.js"),N=o=>{const{itemType:l,error:p,placeholder:E,label:q,inputProps:i,name:t,rules:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../_virtual/jsx-runtime.js"),h=require("react"),g=require("../TextField/index.js"),y=require("./compoments/formRadioGroup/index.js"),F=require("./compoments/formSelect/index.js"),$=require("./compoments/formCheckboxGroup/index.js"),v=require("./validateFunction.js"),_=require("../Switch/index.js"),w=require("./compoments/formFile/index.js"),I=require("../InputNumber/index.js"),M=require("../ComboSelect/index.js"),k=require("./compoments/defaultCompoments/index.js"),D=require("../GlobalContext/useFormatMessage.js"),G=require("./lang/index.js"),N=o=>{const{itemType:l,error:p,placeholder:E,label:q,inputProps:i,name:t,rules:C,setValue:u,setError:m,backData:r,disabled:s,change:j,isComponent:V}=o,b=D.default("FormItem",G.default),d=E||`${q}`,[c,R]=h.useState(!!p),n=e=>{if(u&&u(t,"value",e),j&&j(e),!C)return;const S={...o,setErrorMsg:x,setAndValidateValue:f},T=v.default(S,e,b)||"";x(T)},f=n,x=h.useCallback(e=>{m&&m(e),R(!!e),u&&u(t,"message",e)},[t,m,u]);return h.useEffect(()=>{const e={...o,setErrorMsg:x,setAndValidateValue:f};u&&u(t,"item",e)},[t,o,x,u]),(()=>{if(!V&&l&&typeof l!="string"&&(!l.name||l.name==="InputType")){const e={...o,setErrorMsg:x,setAndValidateValue:f};return l(e)}switch(l){case"file":return a.jsxRuntimeExports.jsx(w.default,{...o,defaultValue:r[t],disabled:s,onChange:e=>{n(e)}});case"switch":return r[t]===void 0&&u&&u(t,"initValue",!!r[t]),a.jsxRuntimeExports.jsx(_.Switch,{defaultChecked:!!r[t],onChange:e=>{n(e)},...i,disabled:s});case"checkGroup":return a.jsxRuntimeExports.jsx($.default,{error:c,defaultValue:r[t],change:e=>{n(e)},list:o.list,...i,disabled:s});case"select":return a.jsxRuntimeExports.jsx(F.default,{placeholder:d,defaultValue:r[t],error:c,change:e=>{n(e)},list:o.list,disabled:s,...i});case"radioGroup":return a.jsxRuntimeExports.jsx(y.default,{error:c,defaultValue:r[t],change:e=>{n(e)},list:o.list,disabled:s,...i});case"textarea":return a.jsxRuntimeExports.jsx(g.TextField,{error:c,placeholder:d,defaultValue:r[t]||"",disabled:s,multiline:!0,rows:3,name:t,hideErrorDom:null,onChange:e=>{n(e.target.value)},...i});case"number":return a.jsxRuntimeExports.jsx(I.InputNumber,{error:c,placeholder:d,defaultValue:r[t],disabled:s,name:t,hideErrorDom:null,onChange:e=>{n(e)},...i});case"comboSelect":return a.jsxRuntimeExports.jsx(M.ComboSelect,{error:c,placeholder:d,defaultValue:r[t],disabled:s,onChange:e=>{n(e)},...i});default:return l&&typeof l!="string"?a.jsxRuntimeExports.jsx(k.default,{moudle:l,error:c,placeholder:d,defaultValue:r[t],disabled:s,onChange:e=>{n(e)},inputProps:i}):a.jsxRuntimeExports.jsx(g.TextField,{defaultValue:r[t]||"",autoComplete:"off",error:c,placeholder:d,onChange:e=>{n(e.target.value)},name:t,hideErrorDom:null,disabled:s,...i})}})()};exports.default=N;
|
|
2
2
|
//# sourceMappingURL=itemType.js.map
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "FunctionModal",
|
|
3
|
+
"category": "Feedback",
|
|
4
|
+
"description": "函数式弹窗(命令式 Modal)。**通过 React Hook + Promise 工作,不是命令式静态方法**。典型场景:确认对话框、信息提示、错误警告、表单二次确认。**关键:必须先用 FunctionModalProvider 包裹应用根节点,然后在子组件用 useModal() Hook 拿到调用函数,调用返回 Promise<boolean>**",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"命令式确认弹窗",
|
|
8
|
+
"Promise 驱动的对话流",
|
|
9
|
+
"全局唯一挂载点的临时 Modal"
|
|
10
|
+
],
|
|
11
|
+
"useCases": [
|
|
12
|
+
"确认删除 / 重要操作前的二次确认",
|
|
13
|
+
"成功 / 失败 / 警告等系统通知",
|
|
14
|
+
"异步操作前的用户确认(checkFunction 拦截)",
|
|
15
|
+
"需要自动关闭 / 超时关闭的提示弹窗(getClose)"
|
|
16
|
+
],
|
|
17
|
+
"riskLevel": "normal"
|
|
18
|
+
},
|
|
19
|
+
"protocolSummary": "**Hook + Provider + Promise 三件套**。不是 `FunctionModal({...})` 命令式调用!正确流程:\n1. 应用根节点用 `<FunctionModalProvider>{App}</FunctionModalProvider>` 包裹(挂载点,无之则 useModal 拿到 reject Promise)\n2. 子组件 `const modal = useModal();` 拿到调用函数\n3. `modal({ title, content, ... })` 触发,返回 `Promise<boolean>`(确认=true,取消=false)\n4. 用 `.then(ok => ...)` 或 `await modal({...})` 拿用户选择\n5. **不要传 onOk / onCancel**——FDialog 内部已硬接管点击事件,外部回调会被忽略(常见误解 M1)",
|
|
20
|
+
"controlledChannels": {
|
|
21
|
+
"openApi": {
|
|
22
|
+
"entryPoint": "import FunctionModal, { FunctionModalProvider } from '@para-ui/core/FunctionModal'",
|
|
23
|
+
"defaultExport": "FunctionModal 的 default export 实际就是 useModal —— 写 `import { useModal } from '@para-ui/core/FunctionModal'` 或 `import useModal from '@para-ui/core/FunctionModal'` 等效",
|
|
24
|
+
"callPattern": "const modal = useModal(); await modal({ title, content }); // 不是 FunctionModal({...})!",
|
|
25
|
+
"returnValue": "Promise<boolean> —— 用户点确定 resolve(true),点取消 / 关闭按钮 resolve(false)(除非 disCatchOnCancel=true 强制 true)"
|
|
26
|
+
},
|
|
27
|
+
"providerSetup": {
|
|
28
|
+
"where": "应用根节点(App.tsx / index.tsx),通常和路由 Provider 同层",
|
|
29
|
+
"code": "<FunctionModalProvider><App /></FunctionModalProvider>",
|
|
30
|
+
"ifMissing": "useModal() 返回的函数实际是 Promise.reject —— 调用任何 modal({...}) 都立即 reject,且无 UI 弹出"
|
|
31
|
+
},
|
|
32
|
+
"closeAllApi": {
|
|
33
|
+
"import": "import { useClose } from '@para-ui/core/FunctionModal'",
|
|
34
|
+
"signature": "const closeAll = useClose(); closeAll(); // 关闭页面上所有 FunctionModal 实例",
|
|
35
|
+
"useCase": "路由切换 / 全局登出时清空所有遗留弹窗"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"variants": {
|
|
39
|
+
"default": {
|
|
40
|
+
"meaning": "默认样式(无 variant 切换)"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"states": [
|
|
44
|
+
"open",
|
|
45
|
+
"closed"
|
|
46
|
+
],
|
|
47
|
+
"idealProps": {
|
|
48
|
+
"title": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "弹窗标题(注意 type 是 string,不是 ReactNode—— FDialog 内部把它当 string 传给底层 Modal)"
|
|
51
|
+
},
|
|
52
|
+
"content": {
|
|
53
|
+
"type": "ReactElement",
|
|
54
|
+
"description": "弹窗主体内容(可以是任意 JSX),与 context 字段二选一(context 是早期遗留命名,优先用 content)"
|
|
55
|
+
},
|
|
56
|
+
"context": {
|
|
57
|
+
"type": "ReactElement",
|
|
58
|
+
"description": "等价于 content(早期命名遗留),如果同时传 content 和 context,content 优先"
|
|
59
|
+
},
|
|
60
|
+
"size": {
|
|
61
|
+
"type": "enum",
|
|
62
|
+
"values": [
|
|
63
|
+
"sm",
|
|
64
|
+
"md",
|
|
65
|
+
"lg",
|
|
66
|
+
"auto",
|
|
67
|
+
"fullScreen"
|
|
68
|
+
],
|
|
69
|
+
"default": "md",
|
|
70
|
+
"description": "弹窗尺寸,透传给底层 Modal 组件"
|
|
71
|
+
},
|
|
72
|
+
"checkFunction": {
|
|
73
|
+
"type": "() => boolean | Promise<boolean>",
|
|
74
|
+
"description": "**用户点确定按钮时先执行此函数,返回 true 才真正关闭弹窗 + resolve(true);返回 false 不关闭(可用于表单校验失败拦截)**。支持异步:return await api.validate()",
|
|
75
|
+
"useCase": "异步校验、二次拦截、表单提交前的服务端检查"
|
|
76
|
+
},
|
|
77
|
+
"getClose": {
|
|
78
|
+
"type": "(close: Function) => void",
|
|
79
|
+
"description": "**回调拿到这个弹窗实例的 close 方法**。用法:`getClose: (close) => { setTimeout(() => close(), 3000); }` 实现定时自动关闭。close 调用等价于用户点取消(resolve(false),除非 disCatchOnCancel)",
|
|
80
|
+
"useCase": "成功提示自动消失 / 外部主动关闭单个实例(不影响其他弹窗)"
|
|
81
|
+
},
|
|
82
|
+
"disCatchOnCancel": {
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"default": false,
|
|
85
|
+
"description": "**默认 false**:取消 / 关闭按钮触发 resolve(false)。设为 true:取消也 resolve(true)(异常关闭仍按确认处理)",
|
|
86
|
+
"useCase": "非常用,默认就够"
|
|
87
|
+
},
|
|
88
|
+
"ModalProps": {
|
|
89
|
+
"type": "ModalProps",
|
|
90
|
+
"description": "透传给底层 Modal 组件的完整 props,用于调整 mask / okText / cancelText / okButtonProps 等。**注意**:Modal 的 onClose / onOk / onCancel 已被 FDialog 硬接管,在 ModalProps 里写也无效"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"commonMisconceptions": {
|
|
94
|
+
"M1": {
|
|
95
|
+
"wrong": "把 FunctionModal 当 antd 的 Modal.confirm() 命令式静态方法用: `FunctionModal({ title, content, onOk })` 直接调用",
|
|
96
|
+
"result": "**TS 报错 TS2554 'Expected 0 arguments, but got 1'**——FunctionModal 的 default export 是 useModal Hook(无参函数),不接受参数。R20-R23 ai-test 100% fail 都是这个原因",
|
|
97
|
+
"fix": "改用 Hook 模式: `const modal = useModal(); modal({title, content})`。完整流程见 protocolSummary + completeExample"
|
|
98
|
+
},
|
|
99
|
+
"M2": {
|
|
100
|
+
"wrong": "在 modalOptions 里传 onOk / onCancel: `modal({ title, content, onOk: handleOk, onCancel: handleCancel })`",
|
|
101
|
+
"result": "**外部传的 onOk / onCancel 被 FDialog 内部硬覆盖**(`onCancel={() => onClose(listIndex)}` 强制接管),回调不触发。R20-R23 报告里 4 个 high 困惑都是这个",
|
|
102
|
+
"fix": "用 Promise 返回值: `modal({title, content}).then(ok => ok ? handleOk() : handleCancel())` 或 `const ok = await modal({...}); if (ok) handleOk(); else handleCancel();`"
|
|
103
|
+
},
|
|
104
|
+
"M3": {
|
|
105
|
+
"wrong": "忘记在应用根节点挂 `<FunctionModalProvider>`,直接在某个子组件用 useModal()",
|
|
106
|
+
"result": "**useModal() 拿到的是 Promise.reject 函数**——任何 modal({...}) 调用都立即 reject,且无 UI 弹出,且无报错(Promise reject 默认静默)",
|
|
107
|
+
"fix": "在 App.tsx 或 index.tsx 顶层加 `<FunctionModalProvider>{children}</FunctionModalProvider>` 包裹"
|
|
108
|
+
},
|
|
109
|
+
"M4": {
|
|
110
|
+
"wrong": "想要弹窗自动关闭就给 modalOptions 加 duration / autoClose 字段: `modal({ title, content, duration: 3000 })`",
|
|
111
|
+
"result": "**modalOptions 没有 duration / autoClose 字段**——TS 报错或字段被忽略",
|
|
112
|
+
"fix": "用 getClose 拿到 close handle 后自己定时: `modal({ title, content, getClose: (close) => setTimeout(close, 3000) })`(见 completeExample 的自动关闭用例)"
|
|
113
|
+
},
|
|
114
|
+
"M5": {
|
|
115
|
+
"wrong": "把 title 传 ReactNode: `modal({ title: <span>富文本</span>, content: ... })`",
|
|
116
|
+
"result": "title 的类型签名是 string,传 ReactNode 会渲染异常或 TS 报错",
|
|
117
|
+
"fix": "title 只用纯字符串。富文本标题放到 content 顶部用大字号样式区分"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"completeExample": "// 1. App 根节点挂 Provider (一次性)\n// App.tsx\nimport { FunctionModalProvider } from '@para-ui/core/FunctionModal';\nconst App: React.FC = () => (\n <FunctionModalProvider>\n <YourRoutesAndPages />\n </FunctionModalProvider>\n);\n\n// 2. 子组件用 useModal + Promise\nimport useModal from '@para-ui/core/FunctionModal';\nimport Button from '@para-ui/core/Button';\n\nconst DeleteButton: React.FC<{ onConfirm: () => void }> = ({ onConfirm }) => {\n const modal = useModal();\n const handleClick = async () => {\n const ok = await modal({\n title: '确认删除',\n content: <span>此操作不可恢复,确定要删除吗?</span>,\n size: 'sm'\n });\n if (ok) onConfirm();\n // 不需要 else 分支,取消时无操作\n };\n return <Button danger onClick={handleClick}>删除</Button>;\n};\n\n// 3. 进阶:自动关闭 + 异步校验\nconst AdvancedDemo: React.FC = () => {\n const modal = useModal();\n const showAutoClose = () => {\n modal({\n title: '操作成功',\n content: '3 秒后自动关闭',\n getClose: (close) => setTimeout(close, 3000)\n });\n };\n const showWithCheck = async () => {\n const ok = await modal({\n title: '提交订单',\n content: '提交后需调用支付接口',\n checkFunction: async () => {\n const result = await api.validatePayment();\n return result.canProceed; // false 时弹窗不关闭\n }\n });\n if (ok) console.log('支付成功');\n };\n return (\n <>\n <Button onClick={showAutoClose}>成功提示</Button>\n <Button onClick={showWithCheck}>带校验的确认</Button>\n </>\n );\n};",
|
|
121
|
+
"do": [
|
|
122
|
+
"**先在 App 根节点挂 `<FunctionModalProvider>` 一次**,然后在任何子组件用 useModal()",
|
|
123
|
+
"**用 Promise 返回值拿用户选择**:`const ok = await modal({...})` 或 `modal({...}).then(ok => ...)`",
|
|
124
|
+
"异步校验拦截关闭:用 `checkFunction: async () => boolean`",
|
|
125
|
+
"自动关闭:`getClose: (close) => setTimeout(close, ms)`",
|
|
126
|
+
"全局清空所有弹窗:`const closeAll = useClose(); closeAll();`(路由切换时调用)"
|
|
127
|
+
],
|
|
128
|
+
"dont": [
|
|
129
|
+
"**不要**直接调用 `FunctionModal({title, ...})`——它是 Hook,不是命令式函数(M1)",
|
|
130
|
+
"**不要**传 onOk / onCancel——内部硬接管,不会触发(M2)",
|
|
131
|
+
"**不要**忘记挂 FunctionModalProvider——会导致 Promise 静默 reject(M3)",
|
|
132
|
+
"**不要**期望 modalOptions 有 duration / autoClose 字段——用 getClose 实现(M4)",
|
|
133
|
+
"**不要**给 title 传 ReactNode——title 类型是 string(M5)",
|
|
134
|
+
"复杂表单场景请用 Modal 直接控制 open/close,不要用 FunctionModal"
|
|
135
|
+
],
|
|
136
|
+
"events": {
|
|
137
|
+
"useModal": {
|
|
138
|
+
"signature": "() => (options: modalOptions) => Promise<boolean>",
|
|
139
|
+
"asyncSupported": true,
|
|
140
|
+
"examples": [
|
|
141
|
+
"const modal = useModal(); const ok = await modal({ title: '确认删除', content: <span>操作不可撤销</span> }); if (ok) doDelete(); — 标准 await 用法",
|
|
142
|
+
"modal({ title: '提示', content: '操作完成', getClose: (close) => setTimeout(close, 3000) }) — 自动关闭不需要等待 Promise",
|
|
143
|
+
"const ok = await modal({ title: '提交', content: '...', checkFunction: async () => await api.validate() }); — checkFunction 拦截异步校验"
|
|
144
|
+
],
|
|
145
|
+
"commonMistakes": [
|
|
146
|
+
"直接调用 FunctionModal({...}) 而不是先 useModal() 再调用——FunctionModal default export 是 Hook 本身,不是可调用函数",
|
|
147
|
+
"在 modalOptions 里传 onOk/onCancel 期望回调——FDialog 内部硬接管,回调不触发,应用 Promise 返回值",
|
|
148
|
+
"忘记在 App 根节点挂 <FunctionModalProvider>——useModal() 返回的函数是 Promise.reject,调用时立即 reject 且无 UI"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"useClose": {
|
|
152
|
+
"signature": "() => () => void",
|
|
153
|
+
"asyncSupported": false,
|
|
154
|
+
"examples": [
|
|
155
|
+
"const closeAll = useClose(); closeAll(); — 关闭当前页面所有 FunctionModal 实例",
|
|
156
|
+
"路由切换时调用:useEffect(() => { return () => closeAll(); }, [pathname]); — 离开页面清空遗留弹窗",
|
|
157
|
+
"登出时全局清空:const closeAll = useClose(); onLogout(() => closeAll());"
|
|
158
|
+
],
|
|
159
|
+
"commonMistakes": [
|
|
160
|
+
"期望 useClose 关闭单个弹窗——useClose 关闭所有实例,关闭单个需用 getClose 拿到单实例 close 函数",
|
|
161
|
+
"在 FunctionModalProvider 外部调用 useClose——useClose 内部引用 setState 模块变量,Provider 未挂载时 setState 为 undefined,调用报错",
|
|
162
|
+
"多次调用 useClose() 拿多个 closeAll 函数——结果等价,均是同一 setState 引用"
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"typescriptPitfalls": [
|
|
167
|
+
{
|
|
168
|
+
"issue": "FunctionModal default export 是 useModal Hook,不能当命令式函数直接调用",
|
|
169
|
+
"wrong": "import FunctionModal from '@para-ui/core/FunctionModal'; FunctionModal({ title: '确认', content: <p>内容</p> }); // TS2554: Expected 0 arguments, but got 1",
|
|
170
|
+
"right": "import useModal from '@para-ui/core/FunctionModal'; const modal = useModal(); await modal({ title: '确认', content: <p>内容</p> });"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"issue": "modalOptions.title 类型是 string,不是 ReactNode,传 JSX 会报 TS 错误",
|
|
174
|
+
"wrong": "modal({ title: <span>富文本<b>标题</b></span>, content: <p>内容</p> }); // title 类型签名是 string",
|
|
175
|
+
"right": "modal({ title: '标题', content: <><h3>富文本标题</h3><p>内容</p></> }); // 把富文本放到 content 顶部"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"issue": "checkFunction 返回 false 不关闭弹窗,但异步返回 void/undefined 等同于 falsy 也不关闭",
|
|
179
|
+
"wrong": "checkFunction={async () => { await doSomething(); }} // 没有 return,隐式返回 undefined → 弹窗不关闭",
|
|
180
|
+
"right": "checkFunction={async () => { await doSomething(); return true; }} // 明确 return true 才关闭"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"issue": "modalOptions 不包含 duration/autoClose 字段——自动关闭需用 getClose 回调",
|
|
184
|
+
"wrong": "modal({ title: '成功', content: '已保存', duration: 2000 }); // TS2353: duration does not exist in type modalOptions",
|
|
185
|
+
"right": "modal({ title: '成功', content: '已保存', getClose: (close) => setTimeout(close, 2000) }); // 用 getClose + setTimeout 实现"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"issue": "useModal 在 FunctionModalProvider 外部调用返回的函数立即 reject,无 UI 弹出",
|
|
189
|
+
"wrong": "// 忘记在 App 根包 Provider,子组件直接用 useModal\nconst modal = useModal(); modal({...}); // 静默 reject,Promise rejected 但没有 catch 不报错",
|
|
190
|
+
"right": "// App.tsx 包 Provider 后子组件才能正常用\n<FunctionModalProvider><App /></FunctionModalProvider>"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"mapping": {
|
|
194
|
+
"realComponent": "FunctionModal",
|
|
195
|
+
"adapter": null
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { modalOptions } from './dialog';
|
|
2
3
|
/**
|
|
3
4
|
* 弹出框组件
|
|
@@ -10,5 +11,7 @@ export declare const useModal: () => (options: modalOptions) => Promise<boolean>
|
|
|
10
11
|
/**
|
|
11
12
|
* 函数弹窗组件Provider
|
|
12
13
|
*/
|
|
13
|
-
export declare const FunctionModalProvider: ({ children }:
|
|
14
|
+
export declare const FunctionModalProvider: ({ children }: {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
17
|
export declare const useClose: () => Function;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../Modal/lang/index.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../Modal/lang/index.js"),r=require("../Utils/snack-kit-shims.js");let e={...n.default.zh};const i=(c,o)=>{const t=c.Confirm;t?e={...e,...t}:(o||(o=r.GetLanguage()),e={...n.default?.[o]||n.default.zh||{}})},a=()=>e;exports.changeConfirmLocale=i;exports.getConfirmLocale=a;
|
|
2
2
|
//# sourceMappingURL=confirmLocale.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),i=require("./intl.js"),e=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),i=require("./intl.js"),e=require("../Utils/snack-kit-shims.js"),t=require("./confirmLocale.js"),l=c.createContext({language:e.GetLanguage(),intlFormat:(u,n)=>(o,a)=>{const r=e.GetLanguage();return i.i18nIntl({ops:o,i18nData:{},lang:r,params:a,defI18nData:n})},componentsProps:{}});exports.changeConfirmLocale=t.changeConfirmLocale;exports.getConfirmLocale=t.getConfirmLocale;exports.default=l;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|