@para-ui/core 5.0.0-beta.11 → 5.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +315 -0
- package/AlignBox/component.json +89 -0
- package/Anchor/component.json +130 -0
- package/Argv/component.json +216 -0
- package/AutoBox/component.json +133 -0
- package/AutoButton/component.json +109 -0
- package/AutoTips/component.json +121 -0
- package/Badge/component.json +92 -0
- package/Breadcrumbs/component.json +142 -0
- package/Button/component.json +168 -0
- package/ButtonGroup/component.json +132 -0
- package/Card/component.json +162 -0
- package/Carousel/component.json +142 -0
- package/Cascader/component.json +196 -0
- package/Checkbox/component.json +138 -0
- package/CheckboxGroup/component.json +152 -0
- package/CodeEditor/component.json +189 -0
- package/Collapse/component.json +166 -0
- package/CollapseBox/component.json +84 -0
- package/CollapseLayout/component.json +155 -0
- package/ColorPicker/component.json +142 -0
- package/ComboSelect/component.json +181 -0
- package/Container/component.json +111 -0
- package/ContentBox/component.json +81 -0
- package/CopyText/component.json +118 -0
- package/CycleSelector/component.json +98 -0
- package/DatePicker/component.json +192 -0
- package/Descriptions/component.json +142 -0
- package/Desktop/component.json +171 -0
- package/DragVerify/component.json +114 -0
- package/Drawer/component.json +200 -0
- package/Dropdown/component.json +147 -0
- package/DynamicMultiBox/component.json +278 -0
- package/Empty/component.json +123 -0
- package/FieldForm/component.json +196 -0
- package/Form/component.json +161 -0
- package/FormItem/component.json +171 -0
- package/FunctionModal/component.json +197 -0
- package/Help/component.json +118 -0
- package/HelperText/component.json +126 -0
- package/Image/component.json +165 -0
- package/InputCode/component.json +191 -0
- package/InputLang/component.json +205 -0
- package/InputNumber/component.json +162 -0
- package/Label/component.json +126 -0
- package/Loading/component.json +91 -0
- package/Menu/component.json +180 -0
- package/Message/component.json +246 -0
- package/Modal/component.json +277 -0
- package/MultiBox/component.json +216 -0
- package/Notification/component.json +184 -0
- package/OperateBtn/component.json +134 -0
- package/PageHeader/component.json +112 -0
- package/Pagination/component.json +181 -0
- package/PasswordRules/component.json +105 -0
- package/PopConfirm/component.json +227 -0
- package/PopMenu/component.json +131 -0
- package/Popover/component.json +165 -0
- package/Progress/component.json +161 -0
- package/Prompt/component.json +144 -0
- package/Querying/component.json +96 -0
- package/QuickReply/component.json +129 -0
- package/Radio/component.json +136 -0
- package/RadioGroup/component.json +149 -0
- package/RangeInput/component.json +198 -0
- package/Result/component.json +104 -0
- package/ScrollBar/component.json +115 -0
- package/Search/component.json +177 -0
- package/Select/component.json +244 -0
- package/SelectInput/component.json +184 -0
- package/Selector/component.json +203 -0
- package/SelectorPicker/component.json +179 -0
- package/SingleBox/component.json +151 -0
- package/Slider/component.json +181 -0
- package/SortBox/component.json +108 -0
- package/Status/component.json +104 -0
- package/Stepper/component.json +129 -0
- package/Switch/component.json +207 -0
- package/Table/component.json +547 -0
- package/Tabs/component.json +227 -0
- package/Tag/component.json +221 -0
- package/TextEditor/component.json +186 -0
- package/TextField/component.json +290 -0
- package/TimePicker/component.json +176 -0
- package/Timeline/component.json +110 -0
- package/Title/component.json +156 -0
- package/ToggleButton/component.json +153 -0
- package/Tooltip/component.json +176 -0
- package/Transfer/component.json +157 -0
- package/Tree/component.json +512 -0
- package/Upload/component.json +450 -0
- package/ai-workflows/01-crud-list-multi-drawer.md +278 -0
- package/ai-workflows/02-rbac-operation-buttons.md +290 -0
- package/ai-workflows/03-complex-form-async-cascade.md +350 -0
- package/ai-workflows/04-array-field-form.md +281 -0
- package/ai-workflows/05-popconfirm-async-message-queue.md +333 -0
- package/ai-workflows/06-modal-drawer-form-workflow.md +385 -0
- package/ai-workflows/07-search-filter-table-trio.md +387 -0
- package/ai-workflows/08-table-advanced-features.md +365 -0
- package/ai-workflows/09-batch-operation-export-progress.md +367 -0
- package/ai-workflows/10-cross-component-state-coordination.md +412 -0
- package/es/AlignBox/component.json +89 -0
- package/es/AlignBox/index.css +1 -1
- package/es/AlignBox/index.d.ts +6 -2
- package/es/AlignBox/index.js +1 -1
- package/es/AlignBox/style/index.css +1 -1
- package/es/Anchor/anchorMenu/index.d.ts +2 -1
- package/es/Anchor/anchorMenu/index.js +36 -33
- package/es/Anchor/component.json +130 -0
- package/es/Anchor/index.js +52 -49
- package/es/Anchor/type.d.ts +8 -4
- 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 +19 -19
- 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/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/InputLang/component.json +205 -0
- package/es/InputLang/index.js +2 -2
- package/es/InputNumber/component.json +162 -0
- package/es/Label/component.json +126 -0
- package/es/Label/index.d.ts +2 -2
- package/es/Loading/component.json +91 -0
- package/es/Menu/component.json +180 -0
- package/es/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 +2 -2
- 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.js +20 -20
- package/es/Result/component.json +104 -0
- package/es/ScrollBar/component.json +115 -0
- package/es/Search/component.json +177 -0
- package/es/Search/index.d.ts +1 -1
- package/es/Select/component.json +244 -0
- package/es/Select/index.js +114 -114
- package/es/SelectInput/component.json +184 -0
- 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 -2
- package/es/_virtual/index.js +5 -3
- package/es/_virtual/index2.js +2 -5
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -1
- package/es/locale/en_US.d.ts +361 -0
- package/es/locale/en_US.js +364 -0
- package/es/locale/index.d.ts +1 -723
- package/es/locale/index2.js +10 -0
- package/es/locale/zh_CN.d.ts +361 -0
- package/es/locale/zh_CN.js +364 -0
- package/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/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/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.js +1 -1
- package/lib/Result/component.json +104 -0
- package/lib/ScrollBar/component.json +115 -0
- package/lib/Search/component.json +177 -0
- package/lib/Search/index.d.ts +1 -1
- package/lib/Select/component.json +244 -0
- package/lib/Select/index.js +1 -1
- package/lib/SelectInput/component.json +184 -0
- package/lib/Selector/component.json +203 -0
- package/lib/Selector/index.js +1 -1
- package/lib/Selector/interface.d.ts +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 -2
- package/lib/_virtual/index.js +1 -1
- package/lib/_virtual/index2.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/locale/en_US.d.ts +361 -0
- package/lib/locale/en_US.js +2 -0
- package/lib/locale/index.d.ts +1 -723
- package/lib/locale/index2.js +2 -0
- package/lib/locale/zh_CN.d.ts +361 -0
- package/lib/locale/zh_CN.js +2 -0
- package/lib/node_modules/classnames/index.js +1 -1
- package/package.json +11 -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/{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,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Dropdown",
|
|
3
|
+
"category": "Navigation",
|
|
4
|
+
"description": "下拉菜单浮层。children 必须是**单一 React 元素**(rc-dropdown 内部需挂 ref);overlay 必须是**单一 ReactElement**(不接受 ReactNode/字符串/数组/Fragment),不传则不渲染浮层。",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"下拉选择",
|
|
8
|
+
"菜单展示"
|
|
9
|
+
],
|
|
10
|
+
"useCases": [
|
|
11
|
+
"用户操作菜单",
|
|
12
|
+
"导航下拉",
|
|
13
|
+
"右键上下文菜单",
|
|
14
|
+
"快捷操作"
|
|
15
|
+
],
|
|
16
|
+
"riskLevel": "low"
|
|
17
|
+
},
|
|
18
|
+
"variants": {
|
|
19
|
+
"default": {
|
|
20
|
+
"meaning": "默认样式"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"states": [
|
|
24
|
+
"open",
|
|
25
|
+
"closed"
|
|
26
|
+
],
|
|
27
|
+
"idealProps": {
|
|
28
|
+
"overlay": {
|
|
29
|
+
"type": "React.ReactElement | (() => React.ReactElement)",
|
|
30
|
+
"description": "下拉浮层内容。**必须是单个 JSX 元素或返回单个 JSX 元素的函数**——不接受字符串/数字/数组/Fragment/ReactNode(否则 TS2322)。要传多个节点请用单一容器(如 `<div>` / `<ul>`)包裹。**如封装组件以 `ReactNode` 类型 prop 接收浮层内容,推荐封装写法:`overlay={<div>{contentProp}</div>}`**——额外的 div 容器不影响 rc-dropdown 内部定位。"
|
|
31
|
+
},
|
|
32
|
+
"children": {
|
|
33
|
+
"type": "React.ReactElement",
|
|
34
|
+
"description": "触发浮层的目标节点(必填,**单一可接收 ref 的 React 元素**)。传 string / Fragment / 数组会触发 TS2322;如需多节点触发器,外层包一层 `<span>` 或具体组件即可。**如封装组件以 `ReactNode` 类型 prop 接收触发器内容,推荐封装写法:`<Dropdown ...><span>{triggerNodeProp}</span></Dropdown>`**——`<span>` 容器可正常挂 ref,不影响触发行为。"
|
|
35
|
+
},
|
|
36
|
+
"trigger": {
|
|
37
|
+
"type": "('click' | 'hover' | 'contextMenu')[]",
|
|
38
|
+
"values": ["click", "hover", "contextMenu"],
|
|
39
|
+
"default": ["hover"],
|
|
40
|
+
"description": "触发下拉的行为列表;数组形式可同时启用多种触发(如 ['click','hover'])。'contextMenu' 用于右键上下文菜单场景。"
|
|
41
|
+
},
|
|
42
|
+
"placement": {
|
|
43
|
+
"type": "'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight'",
|
|
44
|
+
"values": ["top", "topLeft", "topRight", "bottom", "bottomLeft", "bottomRight"],
|
|
45
|
+
"default": "bottomLeft",
|
|
46
|
+
"description": "菜单弹出位置;6 枚举值已展开。默认 'bottomLeft'(左对齐从下方弹出);'bottom' 为居中对齐,'bottomRight' 为右对齐。"
|
|
47
|
+
},
|
|
48
|
+
"visible": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"description": "受控显示状态;传值则交由外部控制开合,不传走非受控由 trigger 触发。"
|
|
51
|
+
},
|
|
52
|
+
"onVisibleChange": {
|
|
53
|
+
"type": "(visible: boolean) => void",
|
|
54
|
+
"description": "菜单显隐切换回调;受控/非受控均会触发,可用作 visible 同步源。"
|
|
55
|
+
},
|
|
56
|
+
"destroyPopupOnHide": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"default": false,
|
|
59
|
+
"description": "关闭时是否销毁浮层 DOM(避免后台仍渲染)。"
|
|
60
|
+
},
|
|
61
|
+
"overlayClassName": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "浮层最外层 class 名"
|
|
64
|
+
},
|
|
65
|
+
"overlayStyle": {
|
|
66
|
+
"type": "React.CSSProperties",
|
|
67
|
+
"description": "浮层最外层样式"
|
|
68
|
+
},
|
|
69
|
+
"mouseEnterDelay": {
|
|
70
|
+
"type": "number",
|
|
71
|
+
"description": "trigger='hover' 鼠标进入延迟(秒)"
|
|
72
|
+
},
|
|
73
|
+
"mouseLeaveDelay": {
|
|
74
|
+
"type": "number",
|
|
75
|
+
"description": "trigger='hover' 鼠标移出延迟(秒)"
|
|
76
|
+
},
|
|
77
|
+
"getPopupContainer": {
|
|
78
|
+
"type": "(triggerNode: HTMLElement) => HTMLElement",
|
|
79
|
+
"description": "浮层渲染容器;默认 body,可指定挂载到自定义 DOM 节点(滚动容器场景常用)"
|
|
80
|
+
},
|
|
81
|
+
"forceRender": {
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"default": false,
|
|
84
|
+
"description": "首次渲染前强制创建浮层 DOM(SSR / 首次过渡动画场景)"
|
|
85
|
+
},
|
|
86
|
+
"isolationPopupOnHide": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"default": false,
|
|
89
|
+
"description": "关闭时把浮层定位至屏幕之外,隔离 DOM 污染(默认 false)"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"do": [
|
|
93
|
+
"overlay 包成单一 JSX 元素(<div>/<ul>/自定义浮层组件),不要传字符串或多节点数组",
|
|
94
|
+
"children 必须是单一可挂 ref 的元素;非组件节点用 <span> 包裹",
|
|
95
|
+
"封装 Dropdown 时,外部 prop 类型为 ReactNode → children 传 `<span>{prop}</span>`,overlay 传 `<div>{prop}</div>`——这是官方推荐封装模式,不影响定位和 ref 挂载",
|
|
96
|
+
"右键上下文菜单场景用 trigger={['contextMenu']}",
|
|
97
|
+
"需要受控开合时同时传 visible + onVisibleChange,保证状态来源唯一"
|
|
98
|
+
],
|
|
99
|
+
"dont": [
|
|
100
|
+
"不要给 overlay 传 ReactNode/字符串/数组/Fragment——overlay 必须是单个 ReactElement(JSX 元素)",
|
|
101
|
+
"不要给 children 传字符串/Fragment/数组——会因无法挂 ref 导致触发不生效",
|
|
102
|
+
"不要在 overlay 里依赖 children 的 onClick——点击事件需在 overlay 内部自行处理",
|
|
103
|
+
"不要嵌套过深的 Dropdown(下拉里再下拉),交互复杂且不利于键盘可达性"
|
|
104
|
+
],
|
|
105
|
+
"events": {
|
|
106
|
+
"onVisibleChange": {
|
|
107
|
+
"signature": "(visible: boolean) => void",
|
|
108
|
+
"asyncSupported": false,
|
|
109
|
+
"examples": [
|
|
110
|
+
"受控模式:onVisibleChange={v => setOpen(v)},配合 visible={open} 实现完全受控",
|
|
111
|
+
"非受控模式:onVisibleChange={v => console.log('dropdown', v ? '打开' : '关闭')},不传 visible 由 trigger 控制",
|
|
112
|
+
"点击外部关闭时 onVisibleChange(false) 也会触发"
|
|
113
|
+
],
|
|
114
|
+
"commonMistakes": [
|
|
115
|
+
"只传 visible 不传 onVisibleChange → 受控模式下下拉无法关闭(visible 永远不更新)",
|
|
116
|
+
"假设 onVisibleChange 接受 (visible, event) 两个参数 → 实际只有一个 boolean 参数",
|
|
117
|
+
"在 onVisibleChange 里直接修改 overlay 内容期望触发重渲染 → overlay 变化不会重触发 onVisibleChange"
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"typescriptPitfalls": [
|
|
122
|
+
{
|
|
123
|
+
"issue": "overlay 类型是 React.ReactElement | (() => React.ReactElement),不是 ReactNode",
|
|
124
|
+
"wrong": "overlay={<><div>A</div><div>B</div></>} // Fragment 作为 overlay 会触发 TS2322 类型错",
|
|
125
|
+
"right": "overlay={<div><div>A</div><div>B</div></div>} // 用单一容器元素包裹多节点"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"issue": "children 类型是 React.ReactElement,不是 ReactNode,传字符串或 Fragment 会 TS 报错",
|
|
129
|
+
"wrong": "<Dropdown overlay={menu}>触发文字</Dropdown> // 字符串不是 ReactElement,TS2322",
|
|
130
|
+
"right": "<Dropdown overlay={menu}><span>触发文字</span></Dropdown> // 用 span 包裹字符串"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"issue": "trigger prop 是数组类型,不是字符串",
|
|
134
|
+
"wrong": "trigger='click' // TS2322: Type 'string' is not assignable to type '...'",
|
|
135
|
+
"right": "trigger={['click']} // 数组形式,支持 ['click'] / ['hover'] / ['click', 'hover']"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"issue": "Placement 枚举只有 6 个有效值,不包含 'left' / 'right'",
|
|
139
|
+
"wrong": "placement='left' // TS 报错:不在 Placement 枚举中",
|
|
140
|
+
"right": "placement='bottomLeft' // 合法值: 'top'|'topLeft'|'topRight'|'bottom'|'bottomLeft'|'bottomRight'"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"mapping": {
|
|
144
|
+
"realComponent": "Dropdown",
|
|
145
|
+
"adapter": null
|
|
146
|
+
}
|
|
147
|
+
}
|
package/lib/Dropdown/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 l=require("../_virtual/jsx-runtime.js"),s=require("react"),a=require("rc-dropdown"),i=require("../GlobalContext/constant.js"),c=require("../GlobalContext/usePopupContainer.js"),d=require("clsx"),p=require("../DatePicker/util.js"),g=require("@snack-kit/lib");;/* empty css */const m=e=>({top:{offset:[0,-8]},topLeft:{offset:[0,-8]},topRight:{offset:[0,-8]},bottom:{offset:[0,8]},bottomRight:{offset:[0,8]},bottomLeft:{offset:[0,8]}})[e]?.offset??[0,0],o=e=>{const t=s.useRef(null),u=c.default(t,e.getPopupContainer),n=s.useRef(g.UUID()),f=r=>{e.onVisibleChange?.(r),e.isolationPopupOnHide&&p.isolationPopupPollution(r,n.current)};return l.jsxRuntimeExports.jsx(a,{...e,prefixCls:`${i.$rcPrefixCls}-dropdown`,overlayClassName:d(`${i.$prefixCls}-dropdown`,e.overlayClassName,n.current),animation:"slide-up",align:{offset:m(e.placement)},getPopupContainer:u,ref:t,onVisibleChange:f,children:e.children})};o.defaultProps={mouseEnterDelay:.15,mouseLeaveDelay:.1,trigger:["hover"],placement:"bottomRight",isolationPopupOnHide:!1};exports.Dropdown=o;exports.default=o;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "DynamicMultiBox",
|
|
3
|
+
"category": "Data Entry",
|
|
4
|
+
"description": "动态多行表单,支持动态增删行 + 拖拽排序 + 字段级错误反馈。**封装协议:外部以业务对象数组传入,内部维护 valueList + errors 双 state(必须双 state,见 commonPatterns.wrapperPattern)**",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"动态表单",
|
|
8
|
+
"多行录入",
|
|
9
|
+
"支持拖拽 + 行级错误反馈"
|
|
10
|
+
],
|
|
11
|
+
"useCases": [
|
|
12
|
+
"批量参数 / 联系人录入",
|
|
13
|
+
"规则配置(条件 → 动作)",
|
|
14
|
+
"可排序步骤配置(工作流)",
|
|
15
|
+
"动态字段表单(字段配置由父组件传入)"
|
|
16
|
+
],
|
|
17
|
+
"riskLevel": "normal"
|
|
18
|
+
},
|
|
19
|
+
"r23FailingScenarios": {
|
|
20
|
+
"scenario_003_TS2538_undefined_index": {
|
|
21
|
+
"failedRequirement": "DynamicMultiBox-003 可拖拽排序的步骤配置",
|
|
22
|
+
"wrongCode": "const errRow: IErrors = { id: s.id };\nfieldConfig.forEach((cfg: IConfig) => {\n errRow[cfg.name] = ''; // ❌ TS2538 'Type undefined cannot be used as an index type'\n});",
|
|
23
|
+
"rootCause": "**IConfig.name 在 v5.x 类型严格化后是 `string | undefined`**(非必填字段)。直接用 cfg.name 做对象索引时 TS 拒绝(undefined 不能作为索引)",
|
|
24
|
+
"fixedCode": "const errRow: IErrors = { id: s.id };\nfieldConfig.forEach((cfg: IConfig) => {\n if (cfg.name) errRow[cfg.name] = ''; // ✅ narrow 后再索引\n});",
|
|
25
|
+
"alternativeFix": "// 或用 ! 非空断言(已知 config 项必有 name):\nfieldConfig.forEach((cfg: IConfig) => {\n errRow[cfg.name!] = '';\n});"
|
|
26
|
+
},
|
|
27
|
+
"scenario_006_TS2352_rest_spread_unknown": {
|
|
28
|
+
"failedRequirement": "DynamicMultiBox-006 标准联系人录入",
|
|
29
|
+
"wrongCode": "interface Contact { name: string; phone: string; email: string; }\nconst valueListToContacts = (valueList: IValueList[]): Contact[] =>\n valueList.map(({ id, ...rest }) => rest as Contact); // ❌ TS2352",
|
|
30
|
+
"rootCause": "对 IValueList 做 `{id, ...rest}` 解构后,TS 把 rest 推断为 `{[x: string]: unknown}`(索引签名)。**unknown 索引签名 → 具体业务类型** 直接 `as Contact` 被 TS 5.x 拒绝(类型不充分重叠)",
|
|
31
|
+
"fixedCode": "const valueListToContacts = (valueList: IValueList[]): Contact[] =>\n valueList.map(({ id, ...rest }) => rest as unknown as Contact); // ✅ unknown 中转",
|
|
32
|
+
"alternativeFix": "// 或显式字段映射(更类型安全):\nconst valueListToContacts = (valueList: IValueList[]): Contact[] =>\n valueList.map(({ name, phone, email }) => ({ name, phone, email } as Contact));"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"titleModeBehavior": {
|
|
36
|
+
"all": "**默认值**。每列在表格顶部独立显示 IConfig.label —— '第一数据行上方有列标题'就是 all。典型表格效果",
|
|
37
|
+
"none": "完全隐藏所有标题。所有列单元格直接从表顶开始,无任何 label",
|
|
38
|
+
"single": "**整张表只有 1 个合并标题行**(跨所有列居中显示 singleTitle.label),不是'只在第一行显示列标题'。配合 singleTitle prop = `{ label: ReactNode, required: boolean }` 配置文案。**误解警告**:需求描述'只在第一行显示标题'通常想要的是 all(每列独立标题),不是 single(整表 1 个合并标题)",
|
|
39
|
+
"domStructure": "// all:\n// <thead>列1 label | 列2 label | 列3 label</thead>\n// <tbody>行 1 数据 | 行 2 数据 | ...</tbody>\n//\n// single:\n// <thead>singleTitle.label (跨列居中)</thead>\n// <tbody>行 1 数据 | 行 2 数据 | ...</tbody>\n//\n// none:\n// <tbody>行 1 数据 | 行 2 数据 | ...</tbody>(无 thead)"
|
|
40
|
+
},
|
|
41
|
+
"variants": {
|
|
42
|
+
"default": {
|
|
43
|
+
"meaning": "默认样式"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"states": [
|
|
47
|
+
"default",
|
|
48
|
+
"error"
|
|
49
|
+
],
|
|
50
|
+
"idealProps": {
|
|
51
|
+
"config": {
|
|
52
|
+
"type": "IConfig[]",
|
|
53
|
+
"description": "每列配置数组:[{ name, label, inputType, isFixed, required, list?, customRender? }];**name 必须等于 valueList[*][name] —— 否则该列读不到值**。注意 IConfig.name 类型签名是 `string | undefined`(R23 003 fail 根因 —— 见 r23FailingScenarios)。**inputType 是 IInputType 严格 union(必须 PascalCase · 不是 HTML lowercase)**:`'TextField' | 'Select' | 'Switch' | 'InputNumber' | 'InputLang' | 'ComboSelect' | 'DatePicker' | 'custom'`。⚠️ **不要写 inputType: 'text' / 'date' / 'select'(HTML 风格 · TS 编译报错 · runtime 不渲染)**。完整 schema 签名见 `dist/es/DynamicMultiBox/interface.d.ts`(发布产物)",
|
|
54
|
+
"required": true
|
|
55
|
+
},
|
|
56
|
+
"valueList": {
|
|
57
|
+
"type": "IValueList[]",
|
|
58
|
+
"description": "受控值集合 [{ id: string, [name]: any }];初始 id 由调用方维护;点击新增时组件 UUID 自动生成新行 id 并通过 onAdd 回填",
|
|
59
|
+
"required": true
|
|
60
|
+
},
|
|
61
|
+
"errors": {
|
|
62
|
+
"type": "IErrors[]",
|
|
63
|
+
"description": "每行错误集合,结构同 valueList,**按 id 一一对应**;无错误字段留空字符串占位。**调用方必须维护 errors state**,在 onAdd/onDelete 回调里用第二参数同步(见 wrapperPattern)"
|
|
64
|
+
},
|
|
65
|
+
"onChange": {
|
|
66
|
+
"type": "(valueList, currentItem) => void",
|
|
67
|
+
"description": "单元格值变化回调(不在新增/删除/拖拽时触发);currentItem 含 id/name/value/rowIndex 用于行内校验"
|
|
68
|
+
},
|
|
69
|
+
"onAdd": {
|
|
70
|
+
"type": "(valueList, errors) => void",
|
|
71
|
+
"description": "点击新增按钮触发;valueList 已含新行(id 由组件生成);**回调第二参数已是同步后的新 errors(含新行空占位),不要忽略**"
|
|
72
|
+
},
|
|
73
|
+
"onDelete": {
|
|
74
|
+
"type": "(valueList, errors) => void",
|
|
75
|
+
"description": "点击删除按钮触发;valueList 已剔除该行;errors 同步剔除对应行"
|
|
76
|
+
},
|
|
77
|
+
"titleMode": {
|
|
78
|
+
"type": "enum",
|
|
79
|
+
"values": [
|
|
80
|
+
"none",
|
|
81
|
+
"single",
|
|
82
|
+
"all"
|
|
83
|
+
],
|
|
84
|
+
"default": "all",
|
|
85
|
+
"description": "见 titleModeBehavior:all=每列独立 label(常见表格效果);none=隐藏所有标题;**single=整表 1 个合并标题**(不是'只在第一行显示列标题',此处常被误解)"
|
|
86
|
+
},
|
|
87
|
+
"singleTitle": {
|
|
88
|
+
"type": "{ label: ReactNode, required: boolean }",
|
|
89
|
+
"description": "titleMode='single' 时的合并标题配置(必须传)"
|
|
90
|
+
},
|
|
91
|
+
"isSort": {
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"default": false,
|
|
94
|
+
"description": "true 启用拖拽排序;需配合 onSort 接收新顺序;拖拽时不触发 onChange"
|
|
95
|
+
},
|
|
96
|
+
"onSort": {
|
|
97
|
+
"type": "(newValueList, swapIds) => void",
|
|
98
|
+
"description": "排序回调;swapIds 是位置变动行的下标集合,非 [from,to] 对"
|
|
99
|
+
},
|
|
100
|
+
"initValue": {
|
|
101
|
+
"type": "Record<string, any>",
|
|
102
|
+
"description": "新增行字段默认值(不含 id)"
|
|
103
|
+
},
|
|
104
|
+
"isFilter": {
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"default": false,
|
|
107
|
+
"description": "true 启用列筛选下拉(用户可在 UI 中切换显示哪些列)"
|
|
108
|
+
},
|
|
109
|
+
"checkedValue": {
|
|
110
|
+
"type": "string[]",
|
|
111
|
+
"description": "配合 isFilter=true 使用 —— 当前筛选下拉中'已勾选展示'的列 key 数组。`isFilter=false`(默认)时无需传"
|
|
112
|
+
},
|
|
113
|
+
"filterConfig": {
|
|
114
|
+
"type": "IConfig[]",
|
|
115
|
+
"description": "筛选下拉中可勾选的可选列(结构同 IConfig),配合 isFilter=true + checkedValue 使用"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"commonMisconceptions": {
|
|
119
|
+
"M1": {
|
|
120
|
+
"wrong": "对 IConfig.name 直接做对象索引: `errRow[cfg.name] = ''`",
|
|
121
|
+
"result": "**TS2538 'Type undefined cannot be used as an index type'** —— IConfig.name 类型 `string | undefined`(R23 DynamicMultiBox-003 fail 根因)",
|
|
122
|
+
"fix": "narrow 后再索引: `if (cfg.name) errRow[cfg.name] = ''` 或 `errRow[cfg.name!] = ''`(非空断言)"
|
|
123
|
+
},
|
|
124
|
+
"M2": {
|
|
125
|
+
"wrong": "用 `{id, ...rest} = item; rest as Contact` 把 IValueList 转业务类型",
|
|
126
|
+
"result": "**TS2352 'Conversion may be a mistake because neither type sufficiently overlaps'** —— rest 是 unknown 索引签名,直接 as 业务类型被 TS 5.x 拒绝(R23 DynamicMultiBox-006 fail 根因)",
|
|
127
|
+
"fix": "用 `as unknown as Contact` 中转,或显式字段映射 `({ name, phone, email })`"
|
|
128
|
+
},
|
|
129
|
+
"M3": {
|
|
130
|
+
"wrong": "onAdd / onDelete 只接受单参数 valueList: `onAdd={(valueList) => setValueList(valueList)}`",
|
|
131
|
+
"result": "**errors state 与 valueList 不同步** —— 新行没有对应 errors 占位,该行渲染时查 errors 失败显示异常",
|
|
132
|
+
"fix": "双参数 + 双 setState: `onAdd={(valueList, errors) => { setValueList(valueList); setErrors(errors); }}`"
|
|
133
|
+
},
|
|
134
|
+
"M4": {
|
|
135
|
+
"wrong": "把 titleMode='single' 当成'只在第一行显示列标题',期望第 1 行上方有列标题、其余行无",
|
|
136
|
+
"result": "**single 实际是'整表 1 个合并标题'**(跨所有列居中),不是按行/列粒度的控制",
|
|
137
|
+
"fix": "需要'每列独立标题'(常见表格):用默认的 titleMode='all'(或不传)。需要'整表 1 合并标题':用 single + singleTitle prop"
|
|
138
|
+
},
|
|
139
|
+
"M5": {
|
|
140
|
+
"wrong": "在 fieldConfig 变化时不重置 errors state,继续用旧 errors",
|
|
141
|
+
"result": "字段集合变化后,errors 旧 key 残留,新 key 缺占位 → 渲染异常",
|
|
142
|
+
"fix": "用 useMemo 或 useEffect 监听 fieldConfig 变化,重新调用 buildEmptyErrors(valueList, fieldConfig) 重建 errors"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"do": [
|
|
146
|
+
"封装包装组件时,valueList + errors 都必须维护 state(双 state 联动 — 见 commonPatterns.wrapperPattern)",
|
|
147
|
+
"**onAdd / onDelete 必须接受双参数**(valueList, errors)并同时 setValueList + setErrors(M3)",
|
|
148
|
+
"**初始化 errors** 时用 narrow 写法: `if (cfg.name) errRow[cfg.name] = ''`(M1,R23 003 fail 修复)",
|
|
149
|
+
"**业务类型转换** rest 解构后用 `as unknown as Contact` 中转(M2,R23 006 fail 修复)",
|
|
150
|
+
"fieldConfig 动态变化时:重新计算 errors,避免 key 不对齐(M5)",
|
|
151
|
+
"需要每列独立标题用 titleMode='all',需要整表合并 1 个标题用 'single' + singleTitle(M4)"
|
|
152
|
+
],
|
|
153
|
+
"dont": [
|
|
154
|
+
"行数过多时不分页",
|
|
155
|
+
"每行字段过多导致布局拥挤",
|
|
156
|
+
"**onAdd / onDelete 只接受 valueList 一个参数**(M3,errors 不同步)",
|
|
157
|
+
"**直接 `errRow[cfg.name] = ''` 不做 narrow**(M1,TS2538)",
|
|
158
|
+
"**`valueList.map(({ id, ...rest }) => rest as Contact)`** 缺 unknown 中转(M2,TS2352)",
|
|
159
|
+
"**把 titleMode='single' 当作'只第一行有标题'**(M4)"
|
|
160
|
+
],
|
|
161
|
+
"commonPatterns": {
|
|
162
|
+
"wrapperPattern": {
|
|
163
|
+
"scenario": "封装 DynamicMultiBox 为业务组件(如 SortableStepsForm / ContactsEntryForm),外部以业务对象数组传入,内部维护 valueList + errors 双 state",
|
|
164
|
+
"code": "import React, { FC, useState, useMemo } from 'react';\nimport DynamicMultiBox from '@para-ui/core/DynamicMultiBox';\nimport type { IConfig, IErrors, IValueList } from '@para-ui/core/DynamicMultiBox/interface';\n\ninterface SortableStepsFormProps {\n fieldConfig: IConfig[];\n steps: Array<Record<string, any>>;\n onStepsChange: (next: Array<Record<string, any>>) => void;\n}\n\n// 工具:把 fieldConfig 转为 errors 空占位行(M1 narrow 修法)\nconst buildEmptyErrors = (valueList: IValueList[], fieldConfig: IConfig[]): IErrors[] =>\n valueList.map(row => {\n const errRow: IErrors = { id: row.id };\n fieldConfig.forEach(cfg => {\n if (cfg.name) errRow[cfg.name] = ''; // ⚠️ narrow:cfg.name 是 string | undefined\n });\n return errRow;\n });\n\nconst SortableStepsForm: FC<SortableStepsFormProps> = ({ fieldConfig, steps, onStepsChange }) => {\n const [valueList, setValueList] = useState<IValueList[]>(steps as IValueList[]);\n const [errors, setErrors] = useState<IErrors[]>(\n () => buildEmptyErrors(steps as IValueList[], fieldConfig)\n );\n\n return (\n <DynamicMultiBox\n config={fieldConfig}\n valueList={valueList}\n errors={errors}\n isSort\n onChange={(next) => { setValueList(next); onStepsChange(next); }}\n onAdd={(next, nextErrors) => { // ✅ 必须接受双参数\n setValueList(next);\n setErrors(nextErrors); // ✅ errors 同步\n onStepsChange(next);\n }}\n onDelete={(next, nextErrors) => { // ✅ 必须接受双参数\n setValueList(next);\n setErrors(nextErrors);\n onStepsChange(next);\n }}\n onSort={(newList) => { setValueList(newList); onStepsChange(newList); }}\n />\n );\n};\n"
|
|
165
|
+
},
|
|
166
|
+
"businessTypeMappingPattern": {
|
|
167
|
+
"scenario": "外部以业务 Contact[] 类型受控,IValueList[] 与 Contact[] 双向映射(R23 DynamicMultiBox-006 fail 修复版本)",
|
|
168
|
+
"code": "interface Contact { name: string; phone: string; email: string; }\n\n// IN: Contact[] → IValueList[](补 id)\nconst contactsToValueList = (contacts: Contact[]): IValueList[] =>\n contacts.map((c, i) => ({ id: String(i + 1), ...c }));\n\n// OUT: IValueList[] → Contact[](剔除 id,业务类型转换)\n// ⚠️ 关键:rest 解构后 TS 推断为 { [x: string]: unknown },要 as unknown 中转\nconst valueListToContacts = (valueList: IValueList[]): Contact[] =>\n valueList.map(({ id, ...rest }) => rest as unknown as Contact);\n\n// 替代:显式字段映射(更类型安全,IDE 跳转友好)\nconst valueListToContactsExplicit = (valueList: IValueList[]): Contact[] =>\n valueList.map(({ name, phone, email }) => ({ name, phone, email } as Contact));\n"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"events": {
|
|
172
|
+
"onChange": {
|
|
173
|
+
"signature": "(valueList: IValueList<T>[], currentItem?: ICurrentItem<T>) => void",
|
|
174
|
+
"asyncSupported": false,
|
|
175
|
+
"examples": [
|
|
176
|
+
"同步整表值:onChange={(list) => setValueList(list)}",
|
|
177
|
+
"利用 currentItem 做行内校验:onChange={(list, cur) => { setValueList(list); validateRow(cur.rowIndex, cur.name, cur.value); }}",
|
|
178
|
+
"currentItem 包含 { name, value, rowIndex, id }——可精确定位是哪行哪字段发生了变化"
|
|
179
|
+
],
|
|
180
|
+
"commonMistakes": [
|
|
181
|
+
"在 onChange 里同时 setErrors——onChange 只在单元格值变化时触发,不涉及 errors;errors 同步在 onAdd/onDelete 完成",
|
|
182
|
+
"假设 onChange 在新增/删除/拖拽时也触发——这三种操作分别走 onAdd/onDelete/onSort 回调",
|
|
183
|
+
"onChange 第二参数 currentItem 的 name 是 keyof T & string——与 IConfig.name 类型一致,可直接做对象索引"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"onAdd": {
|
|
187
|
+
"signature": "(valueList: IValueList<T>[], errors: IErrors<T>[]) => void",
|
|
188
|
+
"asyncSupported": false,
|
|
189
|
+
"examples": [
|
|
190
|
+
"双 state 同步(必须):onAdd={(list, errs) => { setValueList(list); setErrors(errs); }}",
|
|
191
|
+
"同时通知父组件:onAdd={(list, errs) => { setValueList(list); setErrors(errs); onStepsChange(list); }}"
|
|
192
|
+
],
|
|
193
|
+
"commonMistakes": [
|
|
194
|
+
"只接受一个参数 valueList,忽略 errors——errors 不同步导致新行渲染异常(TS 签名有第二参数)",
|
|
195
|
+
"在 onAdd 里手动构造 errors 新行——组件已帮你构造好新行空占位 errors,直接 setErrors(errs) 即可",
|
|
196
|
+
"期望 onAdd 触发后 valueList 还是旧数据加上新行——onAdd 第一参数已是含新行的新数组"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"onDelete": {
|
|
200
|
+
"signature": "(valueList: IValueList<T>[], errors: IErrors<T>[]) => void",
|
|
201
|
+
"asyncSupported": false,
|
|
202
|
+
"examples": [
|
|
203
|
+
"双 state 同步:onDelete={(list, errs) => { setValueList(list); setErrors(errs); }}",
|
|
204
|
+
"配合业务通知:onDelete={(list, errs) => { setValueList(list); setErrors(errs); onStepsChange(list); }}"
|
|
205
|
+
],
|
|
206
|
+
"commonMistakes": [
|
|
207
|
+
"只接受 valueList 忽略 errors 第二参数——errors 不同步,行对应关系错位(id 对不上)",
|
|
208
|
+
"期望 keepLastItem=true 时最后一行也能删——keepLastItem=true(默认)时只剩 1 行时删除图标隐藏,onDelete 不触发"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"onSort": {
|
|
212
|
+
"signature": "(newValueList: IValueList<T>[], swapIds?: number[]) => void",
|
|
213
|
+
"asyncSupported": false,
|
|
214
|
+
"examples": [
|
|
215
|
+
"同步排序后的顺序:onSort={(newList) => setValueList(newList)}",
|
|
216
|
+
"swapIds 是位置变动行的下标集合,不是 [from, to] 对:onSort={(newList, swapIds) => console.log(swapIds)}"
|
|
217
|
+
],
|
|
218
|
+
"commonMistakes": [
|
|
219
|
+
"把 swapIds 当作 [fromIndex, toIndex] 对使用——实际是所有位置变动行的下标集合",
|
|
220
|
+
"onSort 里同时重建 errors——拖拽排序不改变行数,errors 的行数不变;只需按 newList 顺序重排 errors(用 rowKey 映射)",
|
|
221
|
+
"期望 isSort=true 自动维护排序——isSort 只开启 UI 拖拽,newList 必须通过 onSort 回调同步到父组件 state"
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
"onFilter": {
|
|
225
|
+
"signature": "(data: IFilterParams<T>) => void",
|
|
226
|
+
"asyncSupported": false,
|
|
227
|
+
"examples": [
|
|
228
|
+
"监听筛选变化:onFilter={(data) => console.log(data.checkedVal, data.valueList)}",
|
|
229
|
+
"data 包含 { name, checkedVal, valueList, errors }——列筛选变化时的完整快照"
|
|
230
|
+
],
|
|
231
|
+
"commonMistakes": [
|
|
232
|
+
"期望 isFilter=false 时 onFilter 也触发——isFilter 必须为 true 才显示筛选 UI",
|
|
233
|
+
"假设 onFilter 替代 onChange——onFilter 只在列筛选器操作时触发,单元格值变化走 onChange"
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"typescriptPitfalls": [
|
|
238
|
+
{
|
|
239
|
+
"issue": "IConfig.name 类型是 keyof T & string(可能含 undefined),直接用作对象索引报 TS2538",
|
|
240
|
+
"wrong": "const errRow: IErrors = { id: s.id };\nfieldConfig.forEach((cfg: IConfig) => {\n errRow[cfg.name] = ''; // TS2538: 'undefined' cannot be used as an index type\n});",
|
|
241
|
+
"right": "fieldConfig.forEach((cfg: IConfig) => {\n if (cfg.name) errRow[cfg.name] = ''; // narrow 后再索引\n // 或:errRow[cfg.name!] = ''; // 非空断言(已知 name 必有值时)\n});"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"issue": "IValueList 解构后 rest 是 unknown 索引签名,直接 as 具体类型被 TS 5.x 拒绝",
|
|
245
|
+
"wrong": "const toContact = (item: IValueList): Contact =>\n (({ id, ...rest }) => rest as Contact)(item); // TS2352: not sufficiently overlapping",
|
|
246
|
+
"right": "const toContact = (item: IValueList): Contact =>\n (({ id, ...rest }) => rest as unknown as Contact)(item); // 先转 unknown 再转目标类型"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"issue": "IConfig.inputType 只接受 PascalCase 严格枚举,不接受 HTML 小写风格",
|
|
250
|
+
"wrong": "{ inputType: 'text' } // 或 'date'、'select'——TS 报错,runtime 不渲染",
|
|
251
|
+
"right": "{ inputType: 'TextField' } // 或 'Select'、'DatePicker'、'Switch'、'InputNumber'——PascalCase"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"issue": "onAdd/onDelete 是双参数签名,只声明单参数会导致 errors 不同步(TS 不会报错但逻辑错误)",
|
|
255
|
+
"wrong": "onAdd={(valueList) => setValueList(valueList)} // errors 参数丢失,新行无占位",
|
|
256
|
+
"right": "onAdd={(valueList, errors) => { setValueList(valueList); setErrors(errors); }} // 两个 state 同时同步"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"issue": "IMultiValueProps 是泛型 <T extends Record<string, unknown>>,使用具体业务类型时需传泛型参数",
|
|
260
|
+
"wrong": "// 不传泛型,render/onChange 里 row/currentItem 的字段是 unknown\n<DynamicMultiBox config={config} valueList={valueList} />",
|
|
261
|
+
"right": "// 传泛型,类型推断正确\nconst config: IConfig<Contact>[] = [...];\nconst valueList: IValueList<Contact>[] = [...];\n<DynamicMultiBox<Contact> config={config} valueList={valueList} />"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"issue": "泛型 T 必须满足 Record<string, unknown> 约束,普通 interface 没有 index signature 会报 TS2344",
|
|
265
|
+
"wrong": "interface Param { foo: string } // 没有 index signature\n<DynamicMultiBox<Param> ... /> // TS2344: Type 'Param' does not satisfy the constraint 'Record<string, unknown>'. Index signature for type 'string' is missing in type 'Param'.",
|
|
266
|
+
"right": "interface Param { foo: string; [key: string]: unknown } // 加 index signature\n// 或用 type 别名: type Param = { foo: string } & Record<string, unknown>\n<DynamicMultiBox<Param> ... /> // 编译通过"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"issue": "IConfig / IValueList 等类型必须从 @para-ui/core/DynamicMultiBox 导入,不是子路径 /interface",
|
|
270
|
+
"wrong": "import type { IConfig } from '@para-ui/core/DynamicMultiBox/interface'; // TS2307: Cannot find module",
|
|
271
|
+
"right": "import type { IConfig, IValueList } from '@para-ui/core/DynamicMultiBox';"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"mapping": {
|
|
275
|
+
"realComponent": "DynamicMultiBox",
|
|
276
|
+
"adapter": null
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -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 n=require("../_virtual/jsx-runtime.js"),m=require("react"),Ne=require("../Popover/index.js"),re=require("../Label/index.js"),Ae=require("../CheckboxGroup/index.js"),ke=require("../node_modules/@para-ui/icons/Panel/index.js"),qe=require("../node_modules/@para-ui/icons/PlusCircleF/index.js"),ye=require("../node_modules/@para-ui/icons/Delete/index.js"),De=require("../node_modules/@para-ui/icons/Drag/index.js"),Se=require("./rowForm.js"),Be=require("@snack-kit/lib"),$e=require("react-sortablejs"),oe=require("../GlobalContext/constant.js"),Fe=require("../GlobalContext/useFormatMessage.js"),Te=require("./lang/index.js");;/* empty css */const ie=require("../Tooltip/index.js"),we=le=>{const{rowKey:u="id",valueList:i=[],config:g=[],errors:R=[],isSort:v=!1,isFilter:S=!1,className:P,disabledAdd:H=!1,disabledAddTooltip:B,titleMode:$="all",checkedValue:F,icon:ce,deleteDisable:b=[],singleTitle:O,initValue:ae,popoverClassName:_,operationButtons:C=[],onChange:U,onAdd:z,onFilter:q,onDelete:G,deleteRender:T,onSort:K,keepLastItem:N=!0}=le,y=Fe.default("DynamicMultiBox",Te.default),[p,w]=m.useState([]),W=m.useRef(null),V=m.useRef(null),[A,ue]=m.useState([]),[k,J]=m.useState([]),L=m.useRef({});m.useEffect(()=>(window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D),clearTimeout(L.current.timerScroll)}),[]),m.useEffect(()=>{F&&w(F)},[F]),m.useEffect(()=>{if(!g?.length)return;const e=g?.filter(t=>t.isFixed)||[];ue(e)},[g]),m.useEffect(()=>{if(!g?.length)return;const e=g?.filter(t=>!t.isFixed&&p?.includes(t.name))||[];J(e)},[g,p]);const Q=e=>{const t=e?.length>p?.length,s=ve(e,p);let r=[...i],o=[...R];t?(r=I(r,s),o=I(o,s)):(Z(r,s),Z(o,s)),w(e),q&&q({name:s,checkedVal:e,valueList:r,errors:o}),D()},D=()=>{const e=W?.current;if(!e)return;const t=e.querySelector(".multi-value-content");if(!t)return;const s=e.querySelector(".add-button");s&&(clearTimeout(L.current.timerScroll),L.current.timerScroll=setTimeout(()=>{t.offsetWidth<t.scrollWidth?s.classList.add("add-button-scroll"):s.classList.remove("add-button-scroll")},50))},X=()=>{if(!p?.length)return;const e=[...i],t=[...R];Y(e,p),Y(t,p),w([]),J([]),q&&q({valueList:e,errors:t}),D()},Y=(e,t)=>{e.forEach(s=>{for(const r in s)t.includes(r)&&delete s[r]})},Z=(e=[],t)=>{e.forEach(s=>{for(const r in s)r===t&&delete s[r]})},I=(e,t)=>e.map(s=>({...s,[t]:""})),de=()=>{const e=g.filter(t=>!t.isFixed);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e&&e?.length>0?n.jsxRuntimeExports.jsxs("div",{className:"filter-config",children:[n.jsxRuntimeExports.jsxs("div",{className:"check-list",children:[n.jsxRuntimeExports.jsx("div",{className:"title",children:y({id:"titleForm"})}),n.jsxRuntimeExports.jsx(Ae.CheckboxGroup,{list:e,row:!1,value:p,onChange:Q})]}),n.jsxRuntimeExports.jsx("div",{className:"restore-default",onClick:X,children:y({id:"default"})})]}):n.jsxRuntimeExports.jsx("div",{className:"no-other-property",children:y({id:"noData"})})})},xe=()=>{let e=`${oe.$prefixCls}-dynamic-multi-box-popover`;return _&&(e+=` ${_}`),e},ee=()=>{let e=!0;if(i.length>b.length)return!1;for(let t=0,s=i?.length;t<s;t++){const r=i[t]?.[u];if(r&&b.indexOf(r)===-1){e=!1;break}}return e},me=(e,t,s)=>{const{key:r,icon:o,text:a,disabled:c,onClick:E,render:d,className:h,tooltip:f}=e;if(d)return n.jsxRuntimeExports.jsx("div",{className:`operator-column-icon operation-button ${h||""}`,children:d(t,s,i)},r);const j=typeof c=="function"?c(t,s,i):c,l=n.jsxRuntimeExports.jsxs("div",{className:`operator-column-icon operation-button ${h||""} ${j?"disabled-operation":""}`,onClick:()=>!j&&E(t,s,i),children:[o,a&&n.jsxRuntimeExports.jsx("span",{className:"operation-text",children:a})]});return f?n.jsxRuntimeExports.jsx(ie.Tooltip,{disabled:j,placement:f.placement||"top",...f,children:l},r):l},fe=(e,t,s,r)=>{const o=[],a=[...C].sort((l,x)=>(l.order||3)-(x.order||3)),c=[],E=[],d=[],h=[];a.forEach(l=>{const x=me(l,e,t);switch(l.order!==void 0?l.order:3){case 0:c.push(x);break;case 1:E.push(x);break;case 2:d.push(x);break;default:h.push(x);break}}),c.forEach(l=>{o.push(l)});const f=n.jsxRuntimeExports.jsx("div",{className:`operator-column-icon delete-icon ${!s||b.includes(t?.[u]||"")?"hidden-icon":""}`,onClick:()=>je(e),children:T?T(e,t,i):n.jsxRuntimeExports.jsx(ye.Delete,{})},"delete-button");if(s&&!b.includes(t[u])&&o.push(f),E.forEach(l=>{o.push(l)}),v&&s){const l=n.jsxRuntimeExports.jsx("div",{className:`sort-handler operator-column-icon ${s?"":"hidden-icon"}`,children:n.jsxRuntimeExports.jsx(De.Drag,{})},"sort-handler");o.push(l)}d.forEach(l=>{o.push(l)}),h.forEach(l=>{o.push(l)});const j=[];return o.forEach((l,x)=>{j.push(l),x<o.length-1&&j.push(n.jsxRuntimeExports.jsx("div",{className:"center-line",children:n.jsxRuntimeExports.jsx("div",{className:"line"})},`divider-${x}`))}),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:j})},M=(e,t,s,r,o=!1)=>{const a=i.length===1&&s===0;let c=0;return o||!a?((!N||i.length>1)&&c++,v&&c++,c+=C?.length||0):(e&&!b.includes(r[u]||"")&&c++,v&&e&&c++,c+=C?.length||0),pe(c)},pe=e=>{switch(e){case 0:case 1:return"operator-column-40";case 2:return"operator-column-80";case 3:return"operator-column-120";case 4:return"operator-column-160";default:return"operator-column-200"}},he=m.useMemo(()=>{const e=[...A,...k];if(!e?.length)return null;const t=N?i.length>1:!0,s=ee();let r="operator-column-40";return i.length===1?r=M(t,s,0,i[0],!1):r=M(t,s,0,i[0],!0),n.jsxRuntimeExports.jsxs("div",{className:"title-config",children:[$==="all"?n.jsxRuntimeExports.jsx("div",{className:"title-config-row",children:e?.map((o,a)=>{const{label:c,required:E,className:d,inputType:h,style:f,labelProps:j}=o;let l="title-config-row-item";h==="Switch"&&(l+=" row-form-switch"),d&&(l+=` ${d}`);const x={...f};return!f?.width&&!f?.flex&&(x.flex=1),n.jsxRuntimeExports.jsx("div",{className:l,style:x,children:n.jsxRuntimeExports.jsx(re.default,{required:E,label:c,...j})},a)})}):$==="single"?n.jsxRuntimeExports.jsx(re.default,{required:O?.required,label:O?.label}):null,n.jsxRuntimeExports.jsxs("div",{className:r,children:[v&&n.jsxRuntimeExports.jsx("div",{className:"blank-block"}),S&&n.jsxRuntimeExports.jsx(Ne.Popover,{placement:"bottom-end",content:de(),getPopupContainer:()=>V.current||document.body,overlayClassName:xe(),children:n.jsxRuntimeExports.jsx("div",{className:"operator-column-icon-panel",ref:V,children:n.jsxRuntimeExports.jsx("div",{className:"svg-box",children:n.jsxRuntimeExports.jsx(ke.Panel,{})})})})]})]})},[$,A,k,v,S,p,Q,X,u,N,i,b,C]),te=m.useMemo(()=>{if(i&&i?.length>0){const e=N?i.length>1:!0,t=[...A,...k],s=ee();return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:i.map((r,o)=>{const a=r[u],c=R?.filter(d=>d[u]===a)?.[0],E=M(e,s,o,r);return n.jsxRuntimeExports.jsxs("div",{className:"content-row-form",children:[n.jsxRuntimeExports.jsx(Se.default,{rowIndex:o,valueList:i,errors:R,rowError:c,onFormItemChange:(d,h,f)=>Ee(d,h,f,o),icon:ce,config:t}),n.jsxRuntimeExports.jsx("div",{className:E,children:fe(o,r,e)})]},a)})})}},[i,v,S,R,A,k,N,T,u,b,C]),je=e=>{const t=[...i],s=[...R];t.splice(e,1),s.splice(e,1),G&&G(t,s)},Ee=(e,t,s,r)=>{const o=[...i];Object.keys(o[r]).forEach(a=>{e===a&&(o[r][a]=s)}),U&&U(o,{name:e,id:t,value:s,rowIndex:r})},ge=()=>{if(H)return;const e=[...i||[]],t=[...R],s=Be.UUID(),r=[...A,...k];e.push({...se(r,"value"),[u]:s}),t.push({...se(r,"error"),[u]:s}),z&&z(e,t)},se=(e,t)=>e.reduce((s,r)=>({...s,[r.name]:t==="value"?ae?.[r.name]:""}),{}),Re=e=>{const t=e.reduce((r,o,a)=>({...r,[o[u]]:a}),{}),s=[];i.forEach((r,o)=>{o!==t[r[u]]&&s.push(o)}),K&&K(e,s)},ve=(e,t)=>e.concat(t).filter(s=>!e.includes(s)||!t.includes(s))[0],ne=()=>n.jsxRuntimeExports.jsxs("div",{className:`add-button ${H?"disabled-add":"normal-button"}`,onClick:ge,children:[n.jsxRuntimeExports.jsx(qe.PlusCircleF,{}),n.jsxRuntimeExports.jsx("span",{className:"text",children:y({id:"add"})})]}),be=()=>B?n.jsxRuntimeExports.jsx(ie.Tooltip,{disabled:!0,placement:B.placement||"top",...B,children:ne()}):ne(),Ce=()=>{let e=`${oe.$prefixCls}-dynamic-multi-box`;return P&&(e+=` ${P}`),e};return n.jsxRuntimeExports.jsxs("div",{className:Ce(),ref:W,children:[n.jsxRuntimeExports.jsxs("div",{className:"multi-value-content",children:[he,v&&Array.isArray(i)&&i.length>0?n.jsxRuntimeExports.jsx($e.ReactSortable,{id:u,list:i,handle:".sort-handler",animation:150,setList:Re,children:te}):te]}),be()]})};exports.default=we;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -18,9 +18,9 @@ export interface IRowForm {
|
|
|
18
18
|
* @param value 当前组件value值
|
|
19
19
|
* @param name 当前组件name
|
|
20
20
|
* */
|
|
21
|
-
onFormItemChange?: (name: string, id: string, value:
|
|
21
|
+
onFormItemChange?: (name: string, id: string, value: unknown) => void;
|
|
22
22
|
/**其他*/
|
|
23
|
-
[name: string]:
|
|
23
|
+
[name: string]: unknown;
|
|
24
24
|
}
|
|
25
25
|
declare const RowForm: (props: IRowForm) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
export default RowForm;
|