@para-ui/core 5.0.0-beta.8 → 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/README.md +0 -5
- 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.d.ts +2 -2
- package/es/DynamicMultiBox/index.js +1 -1
- package/es/DynamicMultiBox/interface.d.ts +76 -76
- 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.d.ts +2 -2
- package/lib/DynamicMultiBox/index.js +1 -1
- package/lib/DynamicMultiBox/interface.d.ts +76 -76
- package/lib/DynamicMultiBox/rowForm.d.ts +2 -2
- package/lib/Empty/component.json +123 -0
- package/lib/Empty/index.css +1 -1
- package/lib/Empty/index.d.ts +2 -2
- package/lib/Empty/index.js +1 -1
- package/lib/Empty/style/index.css +1 -1
- package/lib/ExpressionInput/HighlightOverlay.d.ts +8 -0
- package/lib/ExpressionInput/HighlightOverlay.js +2 -0
- package/lib/ExpressionInput/Popup.d.ts +19 -0
- package/lib/ExpressionInput/Popup.js +2 -0
- package/lib/ExpressionInput/component.json +79 -0
- package/lib/ExpressionInput/detectChainAtCursor.d.ts +17 -0
- package/lib/ExpressionInput/detectChainAtCursor.js +2 -0
- package/lib/ExpressionInput/filterCandidatesByPartial.d.ts +2 -0
- package/lib/ExpressionInput/filterCandidatesByPartial.js +2 -0
- package/lib/ExpressionInput/highlightSegments.d.ts +9 -0
- package/lib/ExpressionInput/highlightSegments.js +2 -0
- package/lib/ExpressionInput/index.css +1 -0
- package/lib/ExpressionInput/index.d.ts +5 -0
- package/lib/ExpressionInput/index.js +2 -0
- package/lib/ExpressionInput/interface.d.ts +52 -0
- package/lib/ExpressionInput/isExpressionValue.d.ts +5 -0
- package/lib/ExpressionInput/isExpressionValue.js +2 -0
- package/lib/ExpressionInput/lang/en_US.d.ts +4 -0
- package/lib/ExpressionInput/lang/en_US.js +2 -0
- package/lib/ExpressionInput/lang/index.d.ts +9 -0
- package/lib/ExpressionInput/lang/index.js +2 -0
- package/lib/ExpressionInput/lang/zh_CN.d.ts +4 -0
- package/lib/ExpressionInput/lang/zh_CN.js +2 -0
- package/lib/ExpressionInput/style/css.js +1 -0
- package/lib/ExpressionInput/style/index.css +1 -0
- package/lib/ExpressionInput/style/index.js +1 -0
- package/lib/ExpressionInput/useExpressionInput.d.ts +26 -0
- package/lib/ExpressionInput/useExpressionInput.js +2 -0
- package/lib/FieldForm/FieldFormItem/ItemHolder.js +1 -1
- package/lib/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
- package/lib/FieldForm/FieldFormItem/StatusProvider.js +1 -1
- package/lib/FieldForm/FieldFormItem/index.d.ts +6 -6
- package/lib/FieldForm/Form.d.ts +2 -2
- package/lib/FieldForm/Form.js +1 -1
- package/lib/FieldForm/FormItemInput.js +1 -1
- package/lib/FieldForm/FormItemLabel.js +1 -1
- package/lib/FieldForm/FormList.d.ts +2 -2
- package/lib/FieldForm/component.json +196 -0
- package/lib/FieldForm/context.d.ts +5 -1
- package/lib/FieldForm/context.js +1 -1
- package/lib/FieldForm/hooks/useForm.d.ts +4 -3
- package/lib/FieldForm/hooks/useFormInstance.d.ts +1 -1
- package/lib/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
- package/lib/FieldForm/hooks/useFormItemStatus.js +1 -1
- package/lib/FieldForm/hooks/useItemRef.d.ts +1 -1
- package/lib/FieldForm/hooks/useItemRef.js +1 -1
- package/lib/Form/component.json +161 -0
- package/lib/Form/index.d.ts +52 -49
- package/lib/Form/index.js +1 -1
- package/lib/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
- package/lib/FormItem/compoments/defaultCompoments/index.js +1 -1
- package/lib/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
- package/lib/FormItem/compoments/formFile/index.js +1 -1
- package/lib/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
- package/lib/FormItem/compoments/formSelect/index.d.ts +1 -1
- package/lib/FormItem/component.json +171 -0
- package/lib/FormItem/index.d.ts +5 -5
- package/lib/FormItem/index.js +1 -1
- package/lib/FormItem/itemType.js +1 -1
- package/lib/FunctionModal/component.json +197 -0
- package/lib/FunctionModal/dialog.d.ts +1 -1
- package/lib/FunctionModal/modalContext.d.ts +4 -1
- package/lib/GlobalContext/confirmLocale.js +1 -1
- package/lib/GlobalContext/index.js +1 -1
- package/lib/Help/component.json +118 -0
- package/lib/HelperText/component.json +126 -0
- package/lib/Image/PreviewGroup.js +1 -1
- package/lib/Image/component.json +165 -0
- package/lib/Image/index.js +1 -1
- package/lib/InputCode/component.json +191 -0
- package/lib/InputCode/index.d.ts +2 -2
- package/lib/InputLang/component.json +205 -0
- package/lib/InputLang/index.js +1 -1
- package/lib/InputNumber/component.json +162 -0
- package/lib/InputNumber/index.d.ts +13 -7
- package/lib/InputNumber/index.js +1 -1
- package/lib/Label/component.json +126 -0
- package/lib/Label/index.d.ts +2 -2
- package/lib/Loading/component.json +91 -0
- package/lib/Menu/component.json +180 -0
- package/lib/Menu/verticalMenuList.js +1 -1
- package/lib/Message/component.json +246 -0
- package/lib/Message/index.d.ts +2 -2
- package/lib/Message/index.js +1 -1
- package/lib/Modal/Confirm/index.d.ts +1 -1
- package/lib/Modal/Confirm/index.js +1 -1
- package/lib/Modal/component.json +277 -0
- package/lib/Modal/index.d.ts +85 -5
- package/lib/Modal/index.js +1 -1
- package/lib/Modal/interface.d.ts +1 -0
- package/lib/MultiBox/component.json +216 -0
- package/lib/MultiBox/index.js +1 -1
- package/lib/Notification/component.json +184 -0
- package/lib/OperateBtn/component.json +134 -0
- package/lib/OperateBtn/index.d.ts +3 -3
- package/lib/PageHeader/component.json +112 -0
- package/lib/PageHeader/horizontalMeun.js +1 -1
- package/lib/PageHeader/horizontalMeunRight.js +1 -1
- package/lib/Pagination/component.json +181 -0
- package/lib/Pagination/index.js +1 -1
- package/lib/ParauiProvider/index.js +1 -1
- package/lib/PasswordRules/component.json +105 -0
- package/lib/PasswordRules/index.d.ts +4 -4
- package/lib/PopConfirm/component.json +227 -0
- package/lib/PopConfirm/index.d.ts +1 -1
- package/lib/PopConfirm/index.js +1 -1
- package/lib/PopMenu/component.json +131 -0
- package/lib/PopMenu/hooks.d.ts +1 -1
- package/lib/PopMenu/index.js +1 -1
- package/lib/Popover/component.json +165 -0
- package/lib/Popover/index.js +1 -1
- package/lib/Progress/component.json +161 -0
- package/lib/Prompt/component.json +144 -0
- package/lib/Querying/component.json +96 -0
- package/lib/Querying/index.css +1 -1
- package/lib/Querying/index.d.ts +2 -2
- package/lib/Querying/index.js +1 -1
- package/lib/Querying/style/index.css +1 -1
- package/lib/QuickReply/QuickReplyCode/index.js +1 -1
- package/lib/QuickReply/component.json +129 -0
- package/lib/QuickReply/index.d.ts +1 -1
- package/lib/Radio/component.json +136 -0
- package/lib/RadioGroup/component.json +149 -0
- package/lib/RangeInput/component.json +198 -0
- package/lib/RangeInput/index.d.ts +15 -7
- package/lib/RangeInput/index.js +1 -1
- package/lib/Result/component.json +104 -0
- package/lib/ScrollBar/component.json +115 -0
- package/lib/Search/component.json +177 -0
- package/lib/Search/index.d.ts +1 -1
- package/lib/Select/component.json +244 -0
- package/lib/Select/index.d.ts +11 -8
- package/lib/Select/index.js +1 -1
- package/lib/SelectInput/component.json +184 -0
- package/lib/SelectInput/index.d.ts +4 -4
- package/lib/SelectInput/index.js +1 -1
- package/lib/Selector/component.json +203 -0
- package/lib/Selector/index.js +1 -1
- package/lib/Selector/interface.d.ts +2 -2
- package/lib/Selector/selectorData/index.js +1 -1
- package/lib/Selector/selectorMain/index.js +1 -1
- package/lib/Selector/selectorNode/index.js +1 -1
- package/lib/Selector/util.d.ts +3 -3
- package/lib/Selector/util.js +1 -1
- package/lib/SelectorPicker/component.json +179 -0
- package/lib/SelectorPicker/index.d.ts +5 -5
- package/lib/SelectorPicker/index.js +1 -1
- package/lib/SingleBox/component.json +151 -0
- package/lib/SingleBox/index.d.ts +2 -2
- package/lib/Slider/component.json +181 -0
- package/lib/SortBox/component.json +108 -0
- package/lib/Status/component.json +104 -0
- package/lib/Stepper/component.json +129 -0
- package/lib/Stepper/index.d.ts +2 -2
- package/lib/Switch/component.json +207 -0
- package/lib/Switch/index.css +1 -1
- package/lib/Switch/index.d.ts +3 -2
- package/lib/Switch/index.js +1 -1
- package/lib/Switch/style/index.css +1 -1
- package/lib/Table/component.json +547 -0
- package/lib/Table/index.d.ts +2 -2
- package/lib/Table/index.js +1 -1
- package/lib/Table/interface.d.ts +30 -0
- package/lib/Table/tableHead.js +1 -1
- package/lib/Table/util.d.ts +1 -1
- package/lib/Table/util.js +1 -1
- package/lib/Tabs/component.json +227 -0
- package/lib/Tag/component.json +221 -0
- package/lib/Tag/index.css +1 -1
- package/lib/Tag/index.d.ts +1 -1
- package/lib/Tag/index.js +1 -1
- package/lib/Tag/style/index.css +1 -1
- package/lib/TextEditor/component.json +186 -0
- package/lib/TextEditor/index.d.ts +5 -5
- package/lib/TextEditor/index.js +1 -1
- package/lib/TextField/component.json +290 -0
- package/lib/TextField/index.d.ts +2 -2
- package/lib/TextField/index.js +1 -1
- package/lib/TimePicker/component.json +176 -0
- package/lib/Timeline/component.json +110 -0
- package/lib/Title/component.json +156 -0
- package/lib/ToggleButton/component.json +153 -0
- package/lib/ToggleButton/index.js +1 -1
- package/lib/Tooltip/component.json +176 -0
- package/lib/Tooltip/index.js +1 -1
- package/lib/Tooltip/interface.d.ts +14 -1
- package/lib/Tooltip/utils.js +1 -1
- package/lib/Transfer/component.json +157 -0
- package/lib/Tree/OperateBar/index.js +2 -2
- package/lib/Tree/Tree.js +1 -1
- package/lib/Tree/component.json +512 -0
- package/lib/Tree/interface.d.ts +1 -1
- package/lib/Upload/component.json +450 -0
- package/lib/Upload/util.js +1 -1
- package/lib/Utils/snack-kit-shims.d.ts +18 -0
- package/lib/Utils/snack-kit-shims.js +2 -0
- package/lib/Utils/type.d.ts +0 -6
- package/lib/_virtual/index.js +1 -1
- package/lib/_virtual/index2.js +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +1 -1
- package/lib/locale/en-US.d.ts +3 -0
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/en_US.d.ts +361 -0
- package/lib/locale/en_US.js +2 -0
- package/lib/locale/index.d.ts +1 -723
- package/lib/locale/index2.js +2 -0
- package/lib/locale/zh-CN.d.ts +3 -0
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh_CN.d.ts +361 -0
- package/lib/locale/zh_CN.js +2 -0
- package/lib/node_modules/classnames/index.js +1 -1
- package/package.json +24 -4
- package/es/_virtual/index3.js +0 -5
- package/es/_virtual/index4.js +0 -5
- package/es/node_modules/@para-snack/core/dist/index.js +0 -5231
- package/lib/_virtual/index3.js +0 -2
- package/lib/_virtual/index4.js +0 -2
- package/lib/node_modules/@para-snack/core/dist/index.js +0 -20
- /package/es/{InputCode → CodeEditor}/index.css +0 -0
- /package/es/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
- /package/es/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
- /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
- /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Desktop",
|
|
3
|
+
"category": "Layout",
|
|
4
|
+
"description": "桌面布局组件,支持拖拽排序的网格布局。**API 设计上有 3 个已知硬约束**(见 limitations):1) onClick/onSort 回调返回完整数组而非单项;2) icon 只接受 base64 string 不接受 ReactNode;3) 无 children / render prop 不支持任意内容渲染",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"拖拽排序的应用网格",
|
|
8
|
+
"可自定义顺序的图标列表",
|
|
9
|
+
"持久化用户布局偏好"
|
|
10
|
+
],
|
|
11
|
+
"useCases": [
|
|
12
|
+
"工作台(可拖拽的应用入口集合)",
|
|
13
|
+
"仪表盘首页(应用列表,需要内容用 base64 icon)",
|
|
14
|
+
"个性化首页(顺序持久化到 localStorage)"
|
|
15
|
+
],
|
|
16
|
+
"riskLevel": "low"
|
|
17
|
+
},
|
|
18
|
+
"limitations": {
|
|
19
|
+
"L1_onClick_returns_full_array": {
|
|
20
|
+
"issue": "**onClick(data) 的 data 是完整 DesktopDataItem 数组,不是被点击的单个 item**。无法直接知道用户点的是第几项",
|
|
21
|
+
"rootCause": "src/Desktop/index.tsx:44 实证:click handler 传 `[...data]` 给外部",
|
|
22
|
+
"workaround": "在 data 项挂 _payload 扩展字段(如 _index / _app),配合 onSort 维护当前顺序的引用,在 onClick 内根据 e.target.closest('[data-key]') 或自维护的 currentClickedKey 反查 —— 但**Desktop 内部没有暴露 click 时的 key,只能改用 data[0] 假设是被点击项或外部加 React 事件代理**。**结构性限制,docs 救不了**",
|
|
23
|
+
"alternative": "**强烈建议**:如果业务需要识别点击项,改用 Container + Card 自行实现网格 + onClick,或者只用 Desktop 做'排序'功能,'打开应用'功能由 data 项上的 children 字段(若需嵌入按钮)在外层另起 UI"
|
|
24
|
+
},
|
|
25
|
+
"L2_icon_no_reactnode": {
|
|
26
|
+
"issue": "**icon 字段只接受 base64 string,不接受 React.ReactNode**(SVG 组件 / 图标组件等)",
|
|
27
|
+
"rootCause": "Desktop 内部用 `<img src={icon} />` 渲染,React.ReactNode 会触发 TypeScript 类型错误或运行时 ReactNode-as-string 错误",
|
|
28
|
+
"workaround": "**适配上层 AppItem.icon: ReactNode 接口的 3 种方式**:\n1. **改业务接口**(推荐):AppItem.icon 改成 `string | { reactNode: ReactNode }`,Desktop 只读 string 分支\n2. **运行时转换**:用 dom-to-image / html-to-image 把 ReactNode 渲染成 base64(performance 代价大)\n3. **降级**:typeof icon === 'string' 时透传,否则不传 icon 字段(显示无图标,只显示 name)\n\n业务方常踩坑写 `<Desktop data={[{key, name, icon: <Icon />}]} />` 直接传 ReactNode,会 tsc 报错",
|
|
29
|
+
"alternative": "需要任意 ReactNode 渲染:换用 Container + 自实现网格,或者 RcDraggable 类组件"
|
|
30
|
+
},
|
|
31
|
+
"L3_no_children_render": {
|
|
32
|
+
"issue": "**Desktop 不支持 children / render prop / itemRender 自定义格子内容**。每个格子只能渲染 icon (img) + name (text)",
|
|
33
|
+
"rootCause": "src/Desktop/index.tsx:33 - DesktopProps 无 children / renderItem / itemRender 等字段",
|
|
34
|
+
"workaround": "无 —— 这是结构性限制",
|
|
35
|
+
"alternative": "需要每格放 React 组件(如 Widget / Card / 按钮组):**不要用 Desktop**,改用 Container + 自己用 react-grid-layout / dnd-kit 实现拖拽网格"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"adaptationPatterns": {
|
|
39
|
+
"patternA_localStorageOrder": "**持久化排序到 localStorage**(主流场景):\n```ts\n// 1. 读初始顺序\nconst orderKey = 'myApp:desktopOrder';\nconst initialOrder: string[] = JSON.parse(localStorage.getItem(orderKey) || '[]');\n// 2. 按持久化顺序对业务数据排序\nconst orderedApps = useMemo(() => {\n if (!initialOrder.length) return apps;\n return [...apps].sort((a, b) => initialOrder.indexOf(a.id) - initialOrder.indexOf(b.id));\n}, [apps, initialOrder]);\n// 3. onSort 时只保存 key 序列,sort prop 保持 {}\nconst handleSort = (nextData) => {\n setApps(nextData.map(d => d._app));\n localStorage.setItem(orderKey, JSON.stringify(nextData.map(d => d.key)));\n};\n```\n**关键:sort prop 只在'恢复历史 sort 对象'场景才需要,正常持久化 key 序列就够**",
|
|
40
|
+
"patternB_clickIdentification": "**识别点击项 (workaround,有限可靠)**:\nDesktop 的 onClick(data) 不告诉你点了哪项,只能用 DOM 事件代理:\n```ts\n<div onClick={(e) => {\n const cell = (e.target as HTMLElement).closest('[data-id]');\n const id = cell?.getAttribute('data-id');\n if (id) handleAppClick(id);\n}}>\n <Desktop data={dataWithDataIdAttr} ... />\n</div>\n```\n或更**推荐:不依赖 Desktop.onClick,Desktop 只管排序,'打开应用'的点击行为另起方案**",
|
|
41
|
+
"patternC_reactNodeIcon": "**业务接口声明 icon: ReactNode 的衔接**:\n```ts\ninterface BusinessApp { id: string; name: string; icon: ReactNode; iconUrl?: string; }\n// 映射时只取 iconUrl(base64),不传 ReactNode\nconst desktopData = apps.map(app => ({\n key: app.id,\n name: app.name,\n icon: app.iconUrl // 只透传 string,ReactNode 不传\n}));\n```"
|
|
42
|
+
},
|
|
43
|
+
"variants": {
|
|
44
|
+
"default": {
|
|
45
|
+
"meaning": "默认样式"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"states": [
|
|
49
|
+
"default",
|
|
50
|
+
"dragging"
|
|
51
|
+
],
|
|
52
|
+
"idealProps": {
|
|
53
|
+
"data": {
|
|
54
|
+
"type": "Array<DesktopDataItem>",
|
|
55
|
+
"required": true,
|
|
56
|
+
"description": "拖拽列表数据;DesktopDataItem 接口 src/Desktop/index.tsx:23 已 export,字段:key(string 必填 唯一)、name(string?)、disable(boolean?)、icon(string? base64,**不支持 React.ReactNode** —— 见 limitations.L2)、disabledTooltip(TooltipProps?)、可挂任意扩展字段(`[k]: string|boolean|number|...`,常用 _payload / _app 挂业务模型)"
|
|
57
|
+
},
|
|
58
|
+
"sort": {
|
|
59
|
+
"type": "{ [key: string]: mapProps[] }",
|
|
60
|
+
"description": "排序映射,**可选受控**;value 为内部 mapProps[](opaque),`interface mapProps` 未 export,**调用方不应手动构造**。**典型用法 1**:首次渲染传 `{}`,组件按 data 顺序推导默认排序(推荐,99% 场景)。**典型用法 2**:从 localStorage 反序列化某次 onSort 后保存的 sort 对象再透传(罕见,通常直接持久化 key 序列即可)。**onSort 回调后通常无需更新 sort prop** —— 组件会基于新 data 顺序自动重排"
|
|
61
|
+
},
|
|
62
|
+
"onSort": {
|
|
63
|
+
"type": "(data: Array<DesktopDataItem>) => void",
|
|
64
|
+
"signature": "(data: Array<DesktopDataItem>) => void",
|
|
65
|
+
"description": "排序变化回调;**⚠️ data 参数为【排序后的完整 DesktopDataItem 数组】,不是 sort 映射对象,也不是 diff**。src/Desktop/index.tsx:42 实证;持久化新顺序时:**推荐保存 data.map(d => d.key) 数组**(简单稳定),而不是 sort 对象(opaque + 易过期)"
|
|
66
|
+
},
|
|
67
|
+
"onClick": {
|
|
68
|
+
"type": "(data: Array<DesktopDataItem>) => void",
|
|
69
|
+
"signature": "(data: Array<DesktopDataItem>) => void",
|
|
70
|
+
"description": "点击回调;**⚠️ data 参数为【完整 DesktopDataItem 数组】,不是被点击的单个 item**(已知 API 限制,见 limitations.L1)。**workaround**:在 Desktop 外层 div 用 React 事件代理 + 自维护 data-id 属性(见 adaptationPatterns.patternB)。**或不用 onClick**——只用 Desktop 排序,'打开应用'另起方案"
|
|
71
|
+
},
|
|
72
|
+
"tipMaxWidth": {
|
|
73
|
+
"type": "number",
|
|
74
|
+
"description": "禁用项 Tooltip 的最大宽度(px);仅在 DesktopDataItem 设置了 disable=true + disabledTooltip 字段时生效"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"commonMisconceptions": {
|
|
78
|
+
"M1": {
|
|
79
|
+
"wrong": "把 onSort(data) 的 data 当成 sort 映射对象处理:`onSort: (sortObj) => setSort(sortObj)`",
|
|
80
|
+
"result": "**data 实际是数组**,setSort 收到数组而期望对象 → TS 类型错误 + sort prop 状态混乱",
|
|
81
|
+
"fix": "改成 `onSort: (nextData) => setData(nextData)` —— data 是【排序后的完整 DesktopDataItem 数组】。sort prop 通常不需要在 onSort 回调里更新,保持 {} 即可"
|
|
82
|
+
},
|
|
83
|
+
"M2": {
|
|
84
|
+
"wrong": "在 data 项的 icon 字段传 React.ReactNode: `<Desktop data={[{key, name, icon: <Icon />}]} />`",
|
|
85
|
+
"result": "**TS 报错**(icon: string 字段类型不匹配) 或 runtime 渲染 [object Object]",
|
|
86
|
+
"fix": "icon 必须是 base64 string。需要 SVG / 图标组件:**预先用工具转 base64**(`btoa` + SVG 字符串),或**不传 icon**(显示无图标,只显示 name)。见 adaptationPatterns.patternC"
|
|
87
|
+
},
|
|
88
|
+
"M3": {
|
|
89
|
+
"wrong": "期望 onClick(data) 的 data 就是被点击的单项: `onClick: (item) => openApp(item.key)`",
|
|
90
|
+
"result": "**item 实际是完整数组**,`item.key` 是 undefined,openApp(undefined) 触发空指针",
|
|
91
|
+
"fix": "Desktop **结构性不支持识别单项点击**(L1)。两种 workaround:1) 外层 div 事件代理 + data-id(patternB);2) 不依赖 Desktop.onClick,改用 Desktop 仅管排序,点击行为另起 UI"
|
|
92
|
+
},
|
|
93
|
+
"M4": {
|
|
94
|
+
"wrong": "期望 Desktop 接受 children / renderItem 自定义格子内容: `<Desktop>{apps.map(...)}</Desktop>` 或 `<Desktop renderItem={...} />`",
|
|
95
|
+
"result": "**DesktopProps 无 children / renderItem 字段**,传入被静默忽略,格子仍只渲染 icon + name",
|
|
96
|
+
"fix": "需要每格放 React 组件:**不要用 Desktop**,改 Container + react-grid-layout / dnd-kit"
|
|
97
|
+
},
|
|
98
|
+
"M5": {
|
|
99
|
+
"wrong": "手动构造 sort prop 的 mapProps[] 形态: `sort={{ 'group-1': [{type: 'app', key: 'a', index: 0, ...}] }}`",
|
|
100
|
+
"result": "mapProps 接口未 export,字段会变(opaque),手动构造容易引发不可预期的渲染状态",
|
|
101
|
+
"fix": "sort 只用两种值:`{}` (默认,组件按 data 顺序推导) 或 上次 onSort 后从 localStorage 反序列化的整个 sort 对象。**永远不手动写 sort 字面量**"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"do": [
|
|
105
|
+
"**默认用法**:`<Desktop data={data} sort={{}} onSort={setData} />`(sort 用空对象,Desktop 自动推导)",
|
|
106
|
+
"用户排序偏好:保存 `nextData.map(d => d.key)` 到 localStorage(而非 sort 对象,见 patternA)",
|
|
107
|
+
"业务模型挂在 data 项的扩展字段(`_app`, `_payload` 等),onSort 时 map(_app) 取回",
|
|
108
|
+
"上层接口 icon 是 ReactNode 时:映射时只取 string 字段(iconUrl / iconBase64),不传 ReactNode(patternC)",
|
|
109
|
+
"需要识别点击项:外层 div 事件代理 + data-id 自维护(patternB);或不用 Desktop.onClick"
|
|
110
|
+
],
|
|
111
|
+
"dont": [
|
|
112
|
+
"**不要**把 onSort 的参数当 sort 对象处理——是数组(M1)",
|
|
113
|
+
"**不要**给 icon 传 React.ReactNode——只接受 base64 string(M2,L2)",
|
|
114
|
+
"**不要**期望 onClick 知道点的是哪一项——是数组(M3,L1)",
|
|
115
|
+
"**不要**用 children / renderItem 自定义格子——不存在(M4,L3)",
|
|
116
|
+
"**不要**手动构造 sort prop 的 mapProps 字面量——opaque(M5)",
|
|
117
|
+
"**不要**在每格需要嵌入任意 React 组件的场景使用 Desktop——换 Container + dnd-kit",
|
|
118
|
+
"拖拽项过多(>100)导致性能问题"
|
|
119
|
+
],
|
|
120
|
+
"events": {
|
|
121
|
+
"onSort": {
|
|
122
|
+
"signature": "(data: Array<DesktopDataItem>) => void",
|
|
123
|
+
"asyncSupported": false,
|
|
124
|
+
"examples": [
|
|
125
|
+
"基本排序:<Desktop data={data} sort={{}} onSort={(nextData) => setData(nextData)} />",
|
|
126
|
+
"持久化排序:onSort={(nextData) => { setData(nextData); localStorage.setItem('order', JSON.stringify(nextData.map(d => d.key))); }}",
|
|
127
|
+
"onSort 的 data 参数是排序后的完整 DesktopDataItem 数组(不是 diff,不是 sort 映射对象)"
|
|
128
|
+
],
|
|
129
|
+
"commonMistakes": [
|
|
130
|
+
"把 onSort(data) 的 data 当 sort 映射对象处理:setSort(data)——data 是数组,sort 期望 { [key]: mapProps[] }",
|
|
131
|
+
"期望 onSort 在初始化时触发——只有用户拖拽后才触发",
|
|
132
|
+
"持久化保存整个 data 数组(含业务 _payload 字段)——推荐只保存 data.map(d => d.key) 的 key 序列"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"onClick": {
|
|
136
|
+
"signature": "(data: Array<DesktopDataItem>) => void",
|
|
137
|
+
"asyncSupported": false,
|
|
138
|
+
"examples": [
|
|
139
|
+
"注意:data 是完整数组,不是被点击的单项——识别点击项需要外层事件代理",
|
|
140
|
+
"外层事件代理识别点击项:通过 e.target.closest('[data-id]') 反查 id",
|
|
141
|
+
"若不需要识别单项:仅用 onClick 感知'有项被点击'的触发,具体 item 由 sort 顺序推断"
|
|
142
|
+
],
|
|
143
|
+
"commonMistakes": [
|
|
144
|
+
"期望 onClick(item) 的 item 是被点击的单个 DesktopDataItem——实际是完整数组",
|
|
145
|
+
"item.key 是 undefined(因为 item 是数组):openApp(item.key) 触发空指针",
|
|
146
|
+
"期望通过 children/renderItem 自定义格子点击行为——Desktop 不支持 children/renderItem"
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"typescriptPitfalls": [
|
|
151
|
+
{
|
|
152
|
+
"issue": "icon 字段只接受 base64 string,传 ReactNode 会 TS 报错或运行时渲染 [object Object]",
|
|
153
|
+
"wrong": "data={[{ key: 'app1', name: '应用1', icon: <AppIcon /> }]} // TS 报错:icon: string 类型不匹配",
|
|
154
|
+
"right": "// icon 必须是 base64 字符串,ReactNode 图标需预先转 base64\ndata={[{ key: 'app1', name: '应用1', icon: 'data:image/png;base64,...' }]}"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"issue": "onSort/onClick 的参数 data 是完整数组,不是单个 item,类型声明也是 Array<DesktopDataItem>",
|
|
158
|
+
"wrong": "onClick={(item) => openApp(item.key)} // item 实际是数组,item.key 是 undefined",
|
|
159
|
+
"right": "// Desktop 不支持识别单项点击,只能用事件代理:\n<div onClick={(e) => { const id = (e.target as HTMLElement).closest('[data-id]')?.getAttribute('data-id'); }}>\n <Desktop ... />\n</div>"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"issue": "sort prop 的 mapProps[] 接口未 export,不能手动构造 sort 字面量",
|
|
163
|
+
"wrong": "sort={{ 'group-1': [{ type: 'app', key: 'a', index: 0 }] }} // mapProps 接口未公开,字段会变",
|
|
164
|
+
"right": "sort={{}} // 传空对象,Desktop 自动按 data 顺序推导"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"mapping": {
|
|
168
|
+
"realComponent": "Desktop",
|
|
169
|
+
"adapter": null
|
|
170
|
+
}
|
|
171
|
+
}
|
package/lib/Desktop/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const s=require("../_virtual/jsx-runtime.js"),k=require("react"),ft=require("../TextField/index.js"),St=require("@paraview/lib"),et=require("../GlobalContext/constant.js"),U=require("../AutoTips/index.js"),Rt=require("../node_modules/@para-ui/icons/Left/index.js"),vt=require("../Button/index.js"),gt=require("react-dom"),qt=require("../Tooltip/index.js"),jt=require("../GlobalContext/useFormatMessage.js"),Dt=require("./lang/index.js");;/* empty css */const bt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJsAAACbCAYAAAB1YemMAAAgAElEQVR4nO2dB5jc1L32f9LMVtu7XveGAWNMgiEYQguEEmwMtjFggimB0Lmk3EAogfRiIEBukksJuUAI5KN3MNhgG0ILLXRi0ww24IYrrrve3RnpfI800syRRtJImrKzxu/zaFfl6Oico3f+7RQpbAXTaKwDRkrbMGAIMBRoAZqtradPa62XttX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ehgKq1Q/tRp0f7Wowkr2Tlj/jer/3LLPuoRodLVkk/EUiQNXI6ZvQvSOMqo3aPaWl4pVqkQVlkJCFsrP2hYChwx1LRPfFehSySZjHNrzA6HvEJR7FRTh55kGjfoI47W60dWSJ04eIfMzVuyeNhR2qAaiUU2STcazKLtsRExfByMKSbKgiTF+0q2YSTJEkDxd5Szo8BKZkbVlDdJGRVWSzcaz8L318Md26FGqUb02GatFFZbSWdBhmQ6nDzF8rypEVZPNwIugpuGqDXBuGmqjeqp+NlzYGfXuc+79KiHkBh1+MhhuoopR9WSz8TLUp+EvrfBdzUW6QqrTL013dxZ0WKfDHwbDFXQDdBuy2XgVkhpcsRm+r1nqNSrpyhl788uvlKTWYaUOvx4EN+a3UPWi25FNxutwVgp+1mk5EkEz6v22anEWCuUhzI8O87qAnwyC5wq3TvWhW5PNxtvwFR2u1OFQHRoLeaZuB6KabTMdVutwvw6/HGR8KqobY4sgm4x3YbKASwTsqUJdUDdWtToLOqzX4RkdfjMQ/hO9FaoTWxzZZMyHsQqcq8I3FegT1J9aCmchKE3QdQG6lglbzDIM/oHwUXE1r05s0WST8Qn0VOGMBExJwC5J6FMDald01GuQ1mG5gJd1uEvAowMqNKasK/GlIZsXVsC+KhydhN1rYIcEDFShUbW68YpVp3qGVBt1+FzARzq8IODh/rCgYpWsInypyeaHtdBTga8pMFrAUMVYXQJarIXJMT9skmm7TgGtImO4GysBGCGJBcI0HfmgX4nnXXZrAP8fU2SSHI+S6FwAAAAASUVORK5CYII=",h={width:190,height:150,gapX:20,gapY:20};let o=[],nt,Et,i=null;const Gt=.3;let Z=!1,m=null,D=null;const Zt=()=>s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100",height:"70",viewBox:"0 0 100 70",children:[s.jsxRuntimeExports.jsx("path",{id:"路径_18399","data-name":"路径 18399",d:"M3.188,0H43.825c1.76,0,3.079,1.075,3.707,3.307L50,12H0V3.311A3.251,3.251,0,0,1,3.188,0Z",fill:"#2e65e6"}),s.jsxRuntimeExports.jsx("path",{id:"路径_18400","data-name":"路径 18400",d:"M0,0H96.887A3,3,0,0,1,100,2.864V55.136A3,3,0,0,1,96.887,58H3.113A3,3,0,0,1,0,55.136Z",transform:"translate(0 12)",fill:"#d5e0fa"})]})}),it=x=>{const M=k.useRef(null),S=k.useRef(null),{sort:b={},tipMaxWidth:w=500}=x,[v,F]=k.useState(0),[z,rt]=k.useState([]),[p,H]=k.useState("_"),[I,W]=k.useState(!1),[N,Y]=k.useState(""),B=b[p]||[],J=jt.default("Drawer",Dt.default),f={createDir:J({id:"createDir"}),save:J({id:"save"}),outDir:J({id:"outDir"})};k.useEffect(()=>{document.addEventListener("resize",()=>{clearTimeout(nt),nt=setTimeout(()=>{F(K())},200)}),window.addEventListener("mousedown",t=>{t.target?.closest(".menu-list")||S.current&&(S.current.style.display="none")})},[]),k.useEffect(()=>{F(K()),rt(x.data)},[x.data]);const K=()=>{const t=M.current;return t?t.getBoundingClientRect().width/(h.width+h.gapX)|0:1},st=t=>{if(Z)return;const e=t.currentTarget.getAttribute("data-key"),n=L(e??void 0);if(!n||n.disable)return!1;if(n.type!=="dir")return x.onClick&&x.onClick(n),!1;m=n,H(String(n.key))},ot=t=>{if(p==="_"||(t.preventDefault(),Z))return;const e=t.currentTarget.getAttribute("data-key");D=L(e??void 0),y(S.current,t.pageX,t.pageY),S.current&&(S.current.style.display="block")},at=()=>{if(p==="_"||!m||!D)return;const t=_(m.key);if(t){if(t.children=t.children.filter(e=>D&&e!==String(D.key)),V(),t.children.length>0){const e=g(D.key);e&&(e.style.display="none");let n=D.index;const r=o.length-1;for(;n<r;n++){const a=o[n+1];G(a,n)}o.pop()}else o.pop(),delete b[m.key],C();S.current&&(S.current.style.display="none")}},C=()=>{m=null,W(!1),H("_")},A=t=>s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:"item-dir-body",children:s.jsxRuntimeExports.jsx(Zt,{})}),s.jsxRuntimeExports.jsx(U.default,{className:"item-dir-name",placement:"top-start",tipMaxWidth:w,children:t||f.createDir})]}),E=(t,e,n)=>{o[e]=lt(t,e,n),t=o[e];const r={left:`${o[e].point.x}px`,top:`${o[e].point.y}px`,width:h.width,height:h.height};return s.jsxRuntimeExports.jsx(qt.Tooltip,{followCursor:t.disable,disabled:t.disable,...t.disabledTooltip,children:s.jsxRuntimeExports.jsx("div",{className:`desktop-item${t.type==="dir"?" desktop-dir":""}${t.disable?" item-disable":""}`,onContextMenu:ot,onClick:st,style:r,"data-key":t.key,"data-index":e,children:n==="dir"?A(t.displayName||""):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:"item-body",children:s.jsxRuntimeExports.jsx("img",{src:t.icon||bt,alt:"icon"})}),s.jsxRuntimeExports.jsx(U.default,{className:"item-name",placement:"top-start",tipMaxWidth:w,children:t.displayName||f.createDir})]})},p+t.key+e+v)},p+t.key+e+v)},lt=(t,e,n)=>{const r=d=>d.data!==void 0,a=r(t)?t.data:t,l=r(t)?t.displayName:t.name;return{index:e,data:a,key:t.key,icon:t.icon,disable:t.disable||!1,type:n||"item",displayName:l,point:T(e),children:t.children||[],disabledTooltip:t.disabledTooltip||{}}},T=t=>{const e=h.width+h.gapX,n=h.height+h.gapY,r=t%v,a=t/v|0;return{x:r*e,y:a*n,width:h.width,height:h.height}},Q=()=>{const t={};return x.data.forEach(e=>{(p==="_"||m&&m.children.indexOf(e.key)!==-1)&&(t[e.key]=e)}),t},dt=k.useMemo(()=>{if(v===0)return null;if(o=[],B.length>0){const t=Q();let e=0,n=B.map(a=>{const{key:l,type:d}=a;if(!t[l]&&d!=="dir")return;const c={...t[l]};delete t[l];let u;if(d==="dir"){let j=!0;if(a.children.forEach(R=>{t[R]&&(j=!1,delete t[R])}),j)return null;u=E(a,e,d)}else u=E(c,e);return e++,u});const r=Object.keys(t);if(r.length>0){const a=r.map(l=>{const d=t[l];return E(d,o.length)});n=[...n,...a]}return n}if(p!=="_"&&m){const t=Q();let e=0;return m.children.map(n=>{if(!t[n])return null;const r=E(t[n],e);return e++,r})}return x.data.map((t,e)=>E(t,e))},[z,v,p]),ct=t=>{if(Z)return;const e=t.target.closest(".desktop-item");if(!e)return;const n=e.getAttribute("data-index");if(!n)return;const r=parseInt(n,10);i={...o[r],target:e,start:{x:t.pageX,y:t.pageY}},e.setAttribute("drag-item","true"),window.addEventListener("mousemove",O),window.addEventListener("mouseup",X)},O=t=>{if(!i)return;Math.abs(i.start.x-t.pageX)>3&&(Z=!0);const e=i.point.x+(t.pageX-i.start.x),n=i.point.y+(t.pageY-i.start.y)+(M.current?.scrollTop||0);y(i.target,e,n);const r={x:e,y:n,w:i.point.x+i.point.width,h:i.point.y+i.point.height,width:i.point.width,height:i.point.height},a={x:r.x+r.width/2,y:r.y+r.height/2};for(let l=0,d=o.length;l<d;l++){const c=o[l];if(!c||String(c.key)===String(i.key)||c.parent&&p!==c.parent)continue;const u={x:c.point.x,y:c.point.y,w:c.point.x+c.point.width,h:c.point.y+c.point.height};let j=Gt;if(ut(a,u)){const R=g(c.key);if(!R)continue;q("impact"),R.setAttribute("impact","true"),i.impact={data:c,rect:u},i.impact={data:c,rect:u},(i.data.type==="dir"||p!=="_")&&(j=.5);const $={x:r.x+r.width/2},tt=c.point.width;$.x<u.x+tt*j?(i.position="left",y(R,u.x+50)):$.x>u.w-tt*j?(i.position="right",y(R,u.x-50)):(i.position="centre",y(R,u.x));break}else q("impact")}},ut=(t,e)=>{if(t.x>e.x&&t.y>e.y&&t.x<e.w&&t.y<e.h)return t},X=()=>{if(window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",X),setTimeout(()=>{Z=!1},100),!!i){if(i.impact){const t={...o[i.index]},e=i.impact.data,n=g(e.key);if(e.index-i.index===-1&&i.position==="right"||e.index-i.index===1&&i.position==="left"||i.type==="dir"&&i.position==="centre"){y(i.target,i.point.x,i.point.y),q();return}let r=e.index,a,l=i.index,d=r;r>i.index?(a="R",i.position==="left"&&(d--,y(n,e.point.x,e.point.y),r--)):(a="L",i.position==="right"&&(d++,y(n,e.point.x,e.point.y),r++)),{...o[r]};let c;if(i.position==="centre"){for(d=i.index,l=o.length-1;d<l;d++){const u=o[d+1];G(u,d)}o.pop()}else{if(c={...o[l]},a==="R")for(;l<d;l++){const u=o[l+1];G(u,l)}if(a==="L")for(;l>d;l--){const u=o[l-1];G(u,l)}G(c,d)}i.position==="centre"&&(e.type==="dir"?mt(e,t):pt(e,t,a)),q("end");return}else y(i.target,i.point.x,i.point.y);q()}},pt=(t,e,n)=>{n==="R"&&t.index--;const r=`dir_${t.key}${Math.random()*1e6|0}`;o[t.index]={...t,key:r,point:T(t.index),type:"dir",displayName:f.createDir,children:[String(t.key),String(e.key)]};const a=g(t.key);a?.setAttribute("data-key",r),a?.classList.add("desktop-dir"),gt.render(A(o[t.index].displayName||""),a),g(String(e.key))?.setAttribute("in-dir","true")},mt=(t,e)=>{const n=L(t.key);if(!n||!i)return;n.children.push(String(e.key)),g(i.key)?.setAttribute("in-dir","true")},L=t=>{if(!t)return null;for(let e=0,n=o.length;e<n;e++)if(String(o[e].key)===String(t))return o[e];return null},G=(t,e,n)=>{if(!t)return;n||(n=T(e));const r=g(String(t.key));r&&(y(r,n?.x,n?.y),o[e]={...t},o[e].index=e,o[e].point=n,r?.setAttribute("data-index",String(e)))},q=t=>{switch(t){case"impact":const e=document.querySelector('[impact="true"]');if(!e)return;i&&i.impact&&(y(e,i.impact.rect.x,i.impact.rect.y),delete i.impact),e?.removeAttribute("impact");break;case"end":i=null,document.querySelector('[impact="true"]')?.removeAttribute("impact"),document.querySelector('[drag-item="true"]')?.removeAttribute("drag-item"),clearTimeout(Et),V();break;default:q("impact"),i=null,document.querySelector('[drag-item="true"]')?.removeAttribute("drag-item"),window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",X)}},y=(t,e,n)=>{t&&((e!==void 0||e!==null)&&(t.style.left=`${e}px`),(n!==void 0||n!==null)&&(t.style.top=`${n}px`))},V=()=>{if(!x.onSort)return;const t=[];let e=0;o.forEach(r=>{t[e]={key:r.key,type:r.type},r.displayName!==void 0&&(t[e].displayName=r.displayName),r.children.length>0&&(t[e].children=r.children),r.parent!==void 0&&(t[e].parent=r.parent),e++});const n=St.DeepClone(b);t.length>0&&(n[p]=t),x.onSort&&x.onSort(n)},xt=()=>{W(!0),Y(m?.displayName||f.createDir)},P=()=>{if(!m)return;m.displayName=N||f.createDir,W(!1);const t=_(m.key);t&&(t.displayName=N||f.createDir),V()},_=t=>{const e=b._||[];for(let n=0,r=e.length;n<r;n++){const a=e[n];if(a.key===t)return a}},kt=k.useMemo(()=>p!=="_"&&s.jsxRuntimeExports.jsx("div",{className:"desktop-title",children:s.jsxRuntimeExports.jsxs("div",{className:"desktop-backlist",children:[s.jsxRuntimeExports.jsx("div",{className:"desktop-back-hotarea",onClick:C,children:s.jsxRuntimeExports.jsx(Rt.Left,{size:"medium"})}),s.jsxRuntimeExports.jsx("div",{className:"desktop-title-wrapper",children:I?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(ft.TextField,{className:"desktop-title-input",value:N,autoFocus:!0,onChange:t=>Y(t.target.value),onBlur:()=>{P()},onEnter:P}),s.jsxRuntimeExports.jsx(vt.Button,{className:"desktop-title-input-btn",onClick:P,children:f.save})]}):s.jsxRuntimeExports.jsx(U.default,{tipMaxWidth:w,style:{maxWidth:"calc(100% - 78px)"},className:`${et.$prefixCls}-cp`,children:s.jsxRuntimeExports.jsx("span",{onDoubleClick:xt,children:m?.displayName||f.createDir})})})]})}),[p,I,N]),yt=k.useMemo(()=>s.jsxRuntimeExports.jsx("div",{ref:M,className:"desktop-box",onMouseDown:ct,children:dt}),[v,z,p,b]),ht=()=>{let t=`${et.$prefixCls}-desktop`;return x.className&&(t+=` ${x.className}`),t},g=t=>M.current?.querySelector(`.desktop-item[data-key="${t}"]`);return s.jsxRuntimeExports.jsxs("div",{className:ht(),style:x.style,children:[kt,s.jsxRuntimeExports.jsx("div",{className:`${p!=="_"?"pd-lr38":""}`,children:yt}),s.jsxRuntimeExports.jsx("div",{ref:S,className:"menu-list",children:s.jsxRuntimeExports.jsx("div",{className:"menu-item",onClick:at,children:f.outDir})})]})};exports.Desktop=it;exports.default=it;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const s=require("../_virtual/jsx-runtime.js"),k=require("react"),ft=require("../TextField/index.js"),St=require("@snack-kit/lib"),et=require("../GlobalContext/constant.js"),U=require("../AutoTips/index.js"),Rt=require("../node_modules/@para-ui/icons/Left/index.js"),vt=require("../Button/index.js"),gt=require("react-dom"),jt=require("../Tooltip/index.js"),qt=require("../GlobalContext/useFormatMessage.js"),Dt=require("./lang/index.js");;/* empty css */const bt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJsAAACbCAYAAAB1YemMAAAgAElEQVR4nO2dB5jc1L32f9LMVtu7XveGAWNMgiEYQguEEmwMtjFggimB0Lmk3EAogfRiIEBukksJuUAI5KN3MNhgG0ILLXRi0ww24IYrrrve3RnpfI800syRRtJImrKzxu/zaFfl6Oico3f+7RQpbAXTaKwDRkrbMGAIMBRoAZqtradPa62XttXAcmAJsBj4CFgAfPJr2tJf5tb+0pFtGo2NwJ7AN4AxwG7AKCBR5kd3AO8D7wCvA68Y+7+mLVXm51YNtniyTaOxHtgPGGdte1SAWHlQENYpxfprHrcDLwJPK/BP4LVfsFmvdNkqhS2SbNNo7AMcARwNjAd6VOrZPqSSrnvvW2lXAo8Djxr/f0Z7RyXKXClsMWSzJNhk4GRgIpAs5/OKJFWYtBuA6QrcATx1Me3dXuJ1e7JNo3EX4AfASUBTqfPPEENxHdv77rRe93pfL3QviOw5JeNo3ArcfBEdiyNWoWrQLck2jcakpSJ/BBxYijyrhFSF0mrAQ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TL013dxZ0WKfDHwbDFXQDdBuy2XgVkhpcsRm+r1nqNSrpyhl788uvlKTWYaUOvx4EN+a3UPWi25FNxutwVgp+1mk5EkEz6v22anEWCuUhzI8O87qAnwyC5wq3TvWhW5PNxtvwFR2u1OFQHRoLeaZuB6KabTMdVutwvw6/HGR8KqobY4sgm4x3YbKASwTsqUJdUDdWtToLOqzX4RkdfjMQ/hO9FaoTWxzZZMyHsQqcq8I3FegT1J9aCmchKE3QdQG6lglbzDIM/oHwUXE1r05s0WST8Qn0VOGMBExJwC5J6FMDald01GuQ1mG5gJd1uEvAowMqNKasK/GlIZsXVsC+KhydhN1rYIcEDFShUbW68YpVp3qGVBt1+FzARzq8IODh/rCgYpWsInypyeaHtdBTga8pMFrAUMVYXQJarIXJMT9skmm7TgGtImO4GysBGCGJBcI0HfmgX4nnXXZrAP8fU2SSHI+S6FwAAAAASUVORK5CYII=",h={width:190,height:150,gapX:20,gapY:20};let o=[],nt,Et,i=null;const Gt=.3;let Z=!1,m=null,D=null;const Zt=()=>s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100",height:"70",viewBox:"0 0 100 70",children:[s.jsxRuntimeExports.jsx("path",{id:"路径_18399","data-name":"路径 18399",d:"M3.188,0H43.825c1.76,0,3.079,1.075,3.707,3.307L50,12H0V3.311A3.251,3.251,0,0,1,3.188,0Z",fill:"#2e65e6"}),s.jsxRuntimeExports.jsx("path",{id:"路径_18400","data-name":"路径 18400",d:"M0,0H96.887A3,3,0,0,1,100,2.864V55.136A3,3,0,0,1,96.887,58H3.113A3,3,0,0,1,0,55.136Z",transform:"translate(0 12)",fill:"#d5e0fa"})]})}),it=x=>{const M=k.useRef(null),S=k.useRef(null),{sort:b={},tipMaxWidth:w=500}=x,[v,F]=k.useState(0),[z,rt]=k.useState([]),[p,H]=k.useState("_"),[I,W]=k.useState(!1),[N,Y]=k.useState(""),B=b[p]||[],J=qt.default("Drawer",Dt.default),f={createDir:J({id:"createDir"}),save:J({id:"save"}),outDir:J({id:"outDir"})};k.useEffect(()=>{document.addEventListener("resize",()=>{clearTimeout(nt),nt=setTimeout(()=>{F(K())},200)}),window.addEventListener("mousedown",t=>{t.target?.closest(".menu-list")||S.current&&(S.current.style.display="none")})},[]),k.useEffect(()=>{F(K()),rt(x.data)},[x.data]);const K=()=>{const t=M.current;return t?t.getBoundingClientRect().width/(h.width+h.gapX)|0:1},st=t=>{if(Z)return;const e=t.currentTarget.getAttribute("data-key"),n=L(e??void 0);if(!n||n.disable)return!1;if(n.type!=="dir")return x.onClick&&x.onClick(n),!1;m=n,H(String(n.key))},ot=t=>{if(p==="_"||(t.preventDefault(),Z))return;const e=t.currentTarget.getAttribute("data-key");D=L(e??void 0),y(S.current,t.pageX,t.pageY),S.current&&(S.current.style.display="block")},at=()=>{if(p==="_"||!m||!D)return;const t=_(m.key);if(t){if(t.children=t.children.filter(e=>D&&e!==String(D.key)),V(),t.children.length>0){const e=g(D.key);e&&(e.style.display="none");let n=D.index;const r=o.length-1;for(;n<r;n++){const a=o[n+1];G(a,n)}o.pop()}else o.pop(),delete b[m.key],C();S.current&&(S.current.style.display="none")}},C=()=>{m=null,W(!1),H("_")},A=t=>s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:"item-dir-body",children:s.jsxRuntimeExports.jsx(Zt,{})}),s.jsxRuntimeExports.jsx(U.default,{className:"item-dir-name",placement:"top-start",tipMaxWidth:w,children:t||f.createDir})]}),E=(t,e,n)=>{o[e]=lt(t,e,n),t=o[e];const r={left:`${o[e].point.x}px`,top:`${o[e].point.y}px`,width:h.width,height:h.height};return s.jsxRuntimeExports.jsx(jt.Tooltip,{followCursor:t.disable,disabled:t.disable,...t.disabledTooltip,children:s.jsxRuntimeExports.jsx("div",{className:`desktop-item${t.type==="dir"?" desktop-dir":""}${t.disable?" item-disable":""}`,onContextMenu:ot,onClick:st,style:r,"data-key":t.key,"data-index":e,children:n==="dir"?A(t.displayName||""):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:"item-body",children:s.jsxRuntimeExports.jsx("img",{src:t.icon||bt,alt:"icon"})}),s.jsxRuntimeExports.jsx(U.default,{className:"item-name",placement:"top-start",tipMaxWidth:w,children:t.displayName||f.createDir})]})},p+t.key+e+v)},p+t.key+e+v)},lt=(t,e,n)=>{const r=d=>d.data!==void 0,a=r(t)?t.data:t,l=r(t)?t.displayName:t.name;return{index:e,data:a,key:t.key,icon:t.icon,disable:t.disable||!1,type:n||"item",displayName:l,point:T(e),children:t.children||[],disabledTooltip:t.disabledTooltip||{}}},T=t=>{const e=h.width+h.gapX,n=h.height+h.gapY,r=t%v,a=t/v|0;return{x:r*e,y:a*n,width:h.width,height:h.height}},Q=()=>{const t={};return x.data.forEach(e=>{(p==="_"||m&&m.children.indexOf(e.key)!==-1)&&(t[e.key]=e)}),t},dt=k.useMemo(()=>{if(v===0)return null;if(o=[],B.length>0){const t=Q();let e=0,n=B.map(a=>{const{key:l,type:d}=a;if(!t[l]&&d!=="dir")return;const c={...t[l]};delete t[l];let u;if(d==="dir"){let q=!0;if(a.children.forEach(R=>{t[R]&&(q=!1,delete t[R])}),q)return null;u=E(a,e,d)}else u=E(c,e);return e++,u});const r=Object.keys(t);if(r.length>0){const a=r.map(l=>{const d=t[l];return E(d,o.length)});n=[...n,...a]}return n}if(p!=="_"&&m){const t=Q();let e=0;return m.children.map(n=>{if(!t[n])return null;const r=E(t[n],e);return e++,r})}return x.data.map((t,e)=>E(t,e))},[z,v,p]),ct=t=>{if(Z)return;const e=t.target.closest(".desktop-item");if(!e)return;const n=e.getAttribute("data-index");if(!n)return;const r=parseInt(n,10);i={...o[r],target:e,start:{x:t.pageX,y:t.pageY}},e.setAttribute("drag-item","true"),window.addEventListener("mousemove",O),window.addEventListener("mouseup",X)},O=t=>{if(!i)return;Math.abs(i.start.x-t.pageX)>3&&(Z=!0);const e=i.point.x+(t.pageX-i.start.x),n=i.point.y+(t.pageY-i.start.y)+(M.current?.scrollTop||0);y(i.target,e,n);const r={x:e,y:n,w:i.point.x+i.point.width,h:i.point.y+i.point.height,width:i.point.width,height:i.point.height},a={x:r.x+r.width/2,y:r.y+r.height/2};for(let l=0,d=o.length;l<d;l++){const c=o[l];if(!c||String(c.key)===String(i.key)||c.parent&&p!==c.parent)continue;const u={x:c.point.x,y:c.point.y,w:c.point.x+c.point.width,h:c.point.y+c.point.height};let q=Gt;if(ut(a,u)){const R=g(c.key);if(!R)continue;j("impact"),R.setAttribute("impact","true"),i.impact={data:c,rect:u},i.impact={data:c,rect:u},(i.data.type==="dir"||p!=="_")&&(q=.5);const $={x:r.x+r.width/2},tt=c.point.width;$.x<u.x+tt*q?(i.position="left",y(R,u.x+50)):$.x>u.w-tt*q?(i.position="right",y(R,u.x-50)):(i.position="centre",y(R,u.x));break}else j("impact")}},ut=(t,e)=>{if(t.x>e.x&&t.y>e.y&&t.x<e.w&&t.y<e.h)return t},X=()=>{if(window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",X),setTimeout(()=>{Z=!1},100),!!i){if(i.impact){const t={...o[i.index]},e=i.impact.data,n=g(e.key);if(e.index-i.index===-1&&i.position==="right"||e.index-i.index===1&&i.position==="left"||i.type==="dir"&&i.position==="centre"){y(i.target,i.point.x,i.point.y),j();return}let r=e.index,a,l=i.index,d=r;r>i.index?(a="R",i.position==="left"&&(d--,y(n,e.point.x,e.point.y),r--)):(a="L",i.position==="right"&&(d++,y(n,e.point.x,e.point.y),r++)),{...o[r]};let c;if(i.position==="centre"){for(d=i.index,l=o.length-1;d<l;d++){const u=o[d+1];G(u,d)}o.pop()}else{if(c={...o[l]},a==="R")for(;l<d;l++){const u=o[l+1];G(u,l)}if(a==="L")for(;l>d;l--){const u=o[l-1];G(u,l)}G(c,d)}i.position==="centre"&&(e.type==="dir"?mt(e,t):pt(e,t,a)),j("end");return}else y(i.target,i.point.x,i.point.y);j()}},pt=(t,e,n)=>{n==="R"&&t.index--;const r=`dir_${t.key}${Math.random()*1e6|0}`;o[t.index]={...t,key:r,point:T(t.index),type:"dir",displayName:f.createDir,children:[String(t.key),String(e.key)]};const a=g(t.key);a?.setAttribute("data-key",r),a?.classList.add("desktop-dir"),gt.render(A(o[t.index].displayName||""),a),g(String(e.key))?.setAttribute("in-dir","true")},mt=(t,e)=>{const n=L(t.key);if(!n||!i)return;n.children.push(String(e.key)),g(i.key)?.setAttribute("in-dir","true")},L=t=>{if(!t)return null;for(let e=0,n=o.length;e<n;e++)if(String(o[e].key)===String(t))return o[e];return null},G=(t,e,n)=>{if(!t)return;n||(n=T(e));const r=g(String(t.key));r&&(y(r,n?.x,n?.y),o[e]={...t},o[e].index=e,o[e].point=n,r?.setAttribute("data-index",String(e)))},j=t=>{switch(t){case"impact":const e=document.querySelector('[impact="true"]');if(!e)return;i&&i.impact&&(y(e,i.impact.rect.x,i.impact.rect.y),delete i.impact),e?.removeAttribute("impact");break;case"end":i=null,document.querySelector('[impact="true"]')?.removeAttribute("impact"),document.querySelector('[drag-item="true"]')?.removeAttribute("drag-item"),clearTimeout(Et),V();break;default:j("impact"),i=null,document.querySelector('[drag-item="true"]')?.removeAttribute("drag-item"),window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",X)}},y=(t,e,n)=>{t&&((e!==void 0||e!==null)&&(t.style.left=`${e}px`),(n!==void 0||n!==null)&&(t.style.top=`${n}px`))},V=()=>{if(!x.onSort)return;const t=[];let e=0;o.forEach(r=>{t[e]={key:r.key,type:r.type},r.displayName!==void 0&&(t[e].displayName=r.displayName),r.children.length>0&&(t[e].children=r.children),r.parent!==void 0&&(t[e].parent=r.parent),e++});const n=St.DeepClone(b);t.length>0&&(n[p]=t),x.onSort&&x.onSort(n)},xt=()=>{W(!0),Y(m?.displayName||f.createDir)},P=()=>{if(!m)return;m.displayName=N||f.createDir,W(!1);const t=_(m.key);t&&(t.displayName=N||f.createDir),V()},_=t=>{const e=b._||[];for(let n=0,r=e.length;n<r;n++){const a=e[n];if(a.key===t)return a}},kt=k.useMemo(()=>p!=="_"&&s.jsxRuntimeExports.jsx("div",{className:"desktop-title",children:s.jsxRuntimeExports.jsxs("div",{className:"desktop-backlist",children:[s.jsxRuntimeExports.jsx("div",{className:"desktop-back-hotarea",onClick:C,children:s.jsxRuntimeExports.jsx(Rt.Left,{size:"medium"})}),s.jsxRuntimeExports.jsx("div",{className:"desktop-title-wrapper",children:I?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(ft.TextField,{className:"desktop-title-input",value:N,autoFocus:!0,onChange:t=>Y(t.target.value),onBlur:()=>{P()},onEnter:P}),s.jsxRuntimeExports.jsx(vt.Button,{className:"desktop-title-input-btn",onClick:P,children:f.save})]}):s.jsxRuntimeExports.jsx(U.default,{tipMaxWidth:w,style:{maxWidth:"calc(100% - 78px)"},className:`${et.$prefixCls}-cp`,children:s.jsxRuntimeExports.jsx("span",{onDoubleClick:xt,children:m?.displayName||f.createDir})})})]})}),[p,I,N]),yt=k.useMemo(()=>s.jsxRuntimeExports.jsx("div",{ref:M,className:"desktop-box",onMouseDown:ct,children:dt}),[v,z,p,b]),ht=()=>{let t=`${et.$prefixCls}-desktop`;return x.className&&(t+=` ${x.className}`),t},g=t=>M.current?.querySelector(`.desktop-item[data-key="${t}"]`);return s.jsxRuntimeExports.jsxs("div",{className:ht(),style:x.style,children:[kt,s.jsxRuntimeExports.jsx("div",{className:`${p!=="_"?"pd-lr38":""}`,children:yt}),s.jsxRuntimeExports.jsx("div",{ref:S,className:"menu-list",children:s.jsxRuntimeExports.jsx("div",{className:"menu-item",onClick:at,children:f.outDir})})]})};exports.Desktop=it;exports.default=it;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "DragVerify",
|
|
3
|
+
"category": "Data Entry",
|
|
4
|
+
"description": "拖拽验证,用于人机验证",
|
|
5
|
+
"semantic": {
|
|
6
|
+
"intent": [
|
|
7
|
+
"人机验证",
|
|
8
|
+
"安全校验"
|
|
9
|
+
],
|
|
10
|
+
"useCases": [
|
|
11
|
+
"登录验证",
|
|
12
|
+
"表单提交",
|
|
13
|
+
"敏感操作"
|
|
14
|
+
],
|
|
15
|
+
"riskLevel": "high"
|
|
16
|
+
},
|
|
17
|
+
"variants": {
|
|
18
|
+
"default": {
|
|
19
|
+
"meaning": "默认样式"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"states": [
|
|
23
|
+
"default",
|
|
24
|
+
"success",
|
|
25
|
+
"error"
|
|
26
|
+
],
|
|
27
|
+
"idealProps": {
|
|
28
|
+
"getImgInfo": {
|
|
29
|
+
"type": "function",
|
|
30
|
+
"signature": "() => Promise<DragVerifyImgProps> | DragVerifyImgProps",
|
|
31
|
+
"required": true,
|
|
32
|
+
"description": "获取图片接口;返回 DragVerifyImgProps 接口(src/DragVerify/index.tsx:18 已 export),字段:sourceImage(string? 背景图 URL)、newImage(string? 滑块拼图 URL)、y(number? Y 轴目标位置 px,src 内部用 `imgInfo.y!/imgScale` 定位,**不传会 NaN**)、可挂任意扩展字段(`[k]: string|number|undefined`)。⚠️ 业务侧常错猜字段名 bgUrl/sliderUrl/xPos — 实际是 sourceImage/newImage/y。组件在挂载与 refresh 变化时调用此接口"
|
|
33
|
+
},
|
|
34
|
+
"verify": {
|
|
35
|
+
"type": "function",
|
|
36
|
+
"signature": "(xPos: number, imgInfo: DragVerifyImgProps) => Promise<boolean> | boolean",
|
|
37
|
+
"required": true,
|
|
38
|
+
"description": "提交校验接口;xPos = 用户滑动落点的 x 坐标(已按图片真实尺寸缩放回原图坐标);⚠️ 返回 **true = 通过 / false = 不通过**(src/DragVerify/index.tsx:42-46 注释实证)。组件根据返回值切换 success/error class。**目前无 onSuccess/onError 回调 prop**,父组件感知验证结果的唯一办法是在 verify 内部包装一层拦截返回值(见 codeString.ts verifyWithCallback 示例);后续可能升级,见 discussions/DragVerify-onSuccess-onError-callback-epic.md"
|
|
39
|
+
},
|
|
40
|
+
"refresh": {
|
|
41
|
+
"type": "string | number",
|
|
42
|
+
"description": "刷新触发器;⚠️ 实际类型 string|number(组件 src/DragVerify/index.tsx:39 实证,旧 api.ts 写 any 不准);组件 useEffect 监听该值,值变化即重新调用 getImgInfo 并复位 state。典型用法:外层 useState<number> 自增"
|
|
43
|
+
},
|
|
44
|
+
"width": {
|
|
45
|
+
"type": "number | string",
|
|
46
|
+
"description": "图片框宽度;number 视为 px(如 300 → 300px),string 直接透传(支持 '100%' / '80vw' 等响应式单位,src handStyle 实证);未传则 CSS 默认"
|
|
47
|
+
},
|
|
48
|
+
"height": {
|
|
49
|
+
"type": "number | string",
|
|
50
|
+
"description": "图片框高度;number 视为 px,string 直接透传;未传则 CSS 默认"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"do": [
|
|
54
|
+
"在需要防止机器人的场景使用(登录/注册/敏感操作)",
|
|
55
|
+
"提供刷新和重试机制:父组件维护 useState<number> 计数器,每次刷新时 setRefresh(n+1) 触发组件重新获取图片",
|
|
56
|
+
"通过 verify 包装层感知验证结果(组件无 onSuccess/onError 回调,在 verify 内拦截返回值):verify={async (x, info) => { const ok = await api.check(x, info); if (ok) toast('验证通过'); return ok; }}",
|
|
57
|
+
"若 API 返回字段名不是 sourceImage/newImage/y:在 getImgInfo 内部做字段映射后返回标准 DragVerifyImgProps"
|
|
58
|
+
],
|
|
59
|
+
"dont": [
|
|
60
|
+
"在低风险操作中使用(增加用户摩擦,适用登录/支付/批量操作等场景)",
|
|
61
|
+
"猜测 DragVerifyImgProps 字段名为 bgUrl/sliderUrl/xPos——实际是 sourceImage/newImage/y(见 src/DragVerify/index.tsx:18 interface 实证)",
|
|
62
|
+
"在 verify 内总是 return true——绕过验证,失去安全意义"
|
|
63
|
+
],
|
|
64
|
+
"events": {
|
|
65
|
+
"getImgInfo": {
|
|
66
|
+
"signature": "() => Promise<DragVerifyImgProps> | DragVerifyImgProps",
|
|
67
|
+
"asyncSupported": true,
|
|
68
|
+
"examples": [
|
|
69
|
+
"异步获取:getImgInfo={async () => { const res = await api.getCaptcha(); return { sourceImage: res.bg, newImage: res.slider, y: res.yPos }; }}",
|
|
70
|
+
"组件在挂载时和 refresh prop 变化时自动调用此函数",
|
|
71
|
+
"返回值字段:sourceImage(背景图 URL)、newImage(滑块图 URL)、y(滑块 Y 轴位置 px)"
|
|
72
|
+
],
|
|
73
|
+
"commonMistakes": [
|
|
74
|
+
"直接返回 API 响应对象未映射字段名——API 字段 bgUrl/sliderImg/yOffset 需映射为 sourceImage/newImage/y",
|
|
75
|
+
"y 字段不传导致 NaN——src 内部用 imgInfo.y!/imgScale 定位,缺失 y 会 NaN,滑块位置异常",
|
|
76
|
+
"期望 getImgInfo 在用户刷新时自动调用——刷新需要父组件修改 refresh prop 值"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"verify": {
|
|
80
|
+
"signature": "(xPos: number, imgInfo: DragVerifyImgProps) => Promise<boolean> | boolean",
|
|
81
|
+
"asyncSupported": true,
|
|
82
|
+
"examples": [
|
|
83
|
+
"API 校验:verify={async (x, info) => { const ok = await api.verify({ x, ...info }); return ok; }}",
|
|
84
|
+
"返回 true=通过(组件显示成功状态),返回 false=失败(组件显示错误状态并自动重置)",
|
|
85
|
+
"在 verify 内包装 onSuccess 回调:verify={async (x, info) => { const ok = await check(x); if (ok) onSuccess(); return ok; }}"
|
|
86
|
+
],
|
|
87
|
+
"commonMistakes": [
|
|
88
|
+
"期望通过 verify 回调外的 onSuccess prop 感知成功——组件无 onSuccess/onError prop,需在 verify 内包装",
|
|
89
|
+
"返回非 boolean 类型(如 '1'/'0' 字符串)——truthiness 判断可能意外通过,必须返回 boolean"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"typescriptPitfalls": [
|
|
94
|
+
{
|
|
95
|
+
"issue": "DragVerifyImgProps 字段名是 sourceImage/newImage/y,不是 bgUrl/sliderUrl/xPos",
|
|
96
|
+
"wrong": "getImgInfo={async () => ({ bgUrl: res.bg, sliderUrl: res.slider, yPos: res.y })} // 字段名不匹配,图片不显示",
|
|
97
|
+
"right": "getImgInfo={async () => ({ sourceImage: res.bg, newImage: res.slider, y: res.y })} // 正确字段名"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"issue": "getImgInfo 和 verify 是必填 prop(无问号),不传会 TS 报错",
|
|
101
|
+
"wrong": "<DragVerify /> // 缺少必填 getImgInfo 和 verify",
|
|
102
|
+
"right": "<DragVerify getImgInfo={fetchCaptcha} verify={verifyCaptcha} />"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"issue": "refresh prop 的实际类型是 string|number,不是 any",
|
|
106
|
+
"wrong": "const [refresh, setRefresh] = useState<boolean>(false); // boolean 类型赋给 string|number 会 TS 报错",
|
|
107
|
+
"right": "const [refresh, setRefresh] = useState<number>(0);\n// 刷新时:setRefresh(prev => prev + 1)"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"mapping": {
|
|
111
|
+
"realComponent": "DragVerify",
|
|
112
|
+
"adapter": null
|
|
113
|
+
}
|
|
114
|
+
}
|
package/lib/DragVerify/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const o=require("../_virtual/jsx-runtime.js"),m=require("react"),_=require("clsx"),O=require("../node_modules/@para-ui/icons/DoubleRight/index.js"),z=require("../node_modules/@para-ui/icons/Close/index.js"),G=require("../node_modules/@para-ui/icons/Check/index.js"),J=require("../node_modules/@para-ui/icons/Refresh/index.js"),K=require("../GlobalContext/constant.js"),Q=require("../GlobalContext/useFormatMessage.js"),U=require("./lang/index.js"),Y=require("../Loading/index.js");;/* empty css */const $=I=>{const{className:L,style:N,refresh:k,getImgInfo:j,verify:R,width:a,height:g}=I,v=Q.default("DragVerify",U.default),[D,C]=m.useState(),[M,q]=m.useState(!1),c=m.useRef(null),t=m.useRef({getImgInfo:j,verify:R}),l=`${K.$prefixCls}-drag-verify`;t.current.getImgInfo=j,t.current.verify=R,m.useEffect(()=>(w(),S(),()=>{clearTimeout(t.current.timerError),clearTimeout(t.current.timerSuccess)}),[k,D]);const S=async()=>{t.current.padding=!0,q(!0);const e=await t.current.getImgInfo();t.current.imgInfo=e,H()},T=async(e,s)=>{const r=await t.current.verify(e,t.current.imgInfo);s(r)},H=()=>{if(!c.current)return;const e=document.createElement("img");e.setAttribute("src",t.current.imgInfo?.sourceImage),e.style.display="none";const s=document.createElement("img");t.current.imgMove=s,s.className="slider-img-move",s.style.display="none";const r=c.current.querySelector(".slider-img"),i=c.current.querySelector(".refresh");!r||!i||(i.style.display="none",r.innerHTML="",r.append(e),e.onload=()=>{e.style.display="inline-block",s.setAttribute("src",t.current.imgInfo?.newImage);const p=e.width;if(e.className="slider-img-bg",e.style.display="inline-block",!c.current)return;const f=c.current.querySelector(".slider-img"),x=f?.clientWidth;t.current.imgScale=p/x,f?.append(s),s.onload=()=>{t.current.padding=!1,s.style.display="inline-block",i.style.display="inline-block",s.width=s.width/t.current.imgScale,s.style.top=`${t.current.imgInfo?.y/t.current.imgScale}px`,q(!1)}},W(e,s))},W=(e,s)=>{const r=c.current;if(!r)return;const i=r.querySelector(".slider-move-box"),p=r.querySelector(".slider-move-mask"),f=r.querySelector(".slider-move"),x=r.querySelector(".slider-move-text"),A=f.getBoundingClientRect(),h=i.getBoundingClientRect().width,B=A.width,E=(u,d)=>{let n=u.pageX-d.pageX;n<0&&(n=0),n+h>e.width&&(n=e.width-h),i.style.left=`${n-1}px`,p.style.width=`${n<2?2:n}px`;const y=n/(B-h),V=(e.width-s.width)*y;s.style.left=`${V}px`,x.innerHTML=""},b=()=>{r.classList.remove(`${l}-move`),t.current.padding=!0;const d=parseFloat(s.style.left)*t.current.imgScale;T(d,n=>{if(!n){r.classList.add(`${l}-error`),t.current.timerError=setTimeout(()=>{t.current.padding=!1,w(),x.innerHTML=v({id:"tryAgain"}),S()},1e3);return}r.classList.add(`${l}-success`)})};i.onmousedown=u=>{t.current.padding||(r.classList.add(`${l}-move`),document.onmousemove=d=>{E(d,u)},document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,b()})},i.ontouchstart=u=>{if(u.preventDefault(),t.current.padding)return!1;const d=u.touches[0];return r.classList.add(`${l}-move`),document.ontouchmove=n=>{n.preventDefault();const y=n.touches[0];return E(y,d),!1},document.ontouchend=()=>{document.ontouchmove=null,document.ontouchend=null,b()},!1}},w=()=>{const e=c.current;if(!e)return;e.classList.remove(`${l}-success`),e.classList.remove(`${l}-error`);const s=e.querySelector(".slider-move-box"),r=e.querySelector(".slider-move-mask"),i=e.querySelector(".slider-move-text");i.innerHTML=v({id:"swipe"}),s.style.left="-1px",r.style.width="0px",t.current.imgMove&&(t.current.imgMove.style.left="0px")},X=()=>{C(Math.random())},F=()=>{const e={};if(a){let s=a;typeof a=="number"&&(s=`${a}px`),e.width=s}if(g){let s=g;typeof g=="number"&&(s=`${g}px`),e.height=s}return e},P=()=>_(l,L);return o.jsxRuntimeExports.jsxs("div",{className:P(),style:N,ref:c,children:[o.jsxRuntimeExports.jsx(J.Refresh,{onClick:X,className:"refresh"}),o.jsxRuntimeExports.jsx("div",{className:"slider-img",style:F()}),o.jsxRuntimeExports.jsxs("div",{className:"slider-move",children:[o.jsxRuntimeExports.jsx("div",{className:"slider-move-bg"}),o.jsxRuntimeExports.jsx("div",{className:"slider-move-mask",children:o.jsxRuntimeExports.jsxs("div",{className:"slider-move-box",draggable:!1,children:[o.jsxRuntimeExports.jsx(O.DoubleRight,{className:"svg-right"}),o.jsxRuntimeExports.jsx(z.Close,{className:"svg-close"}),o.jsxRuntimeExports.jsx(G.Check,{className:"svg-check"})]})}),o.jsxRuntimeExports.jsx("span",{className:"slider-move-text",children:v({id:"swipe"})})]}),M&&o.jsxRuntimeExports.jsx(Y.Loading,{})]})};exports.DragVerify=$;exports.default=$;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const o=require("../_virtual/jsx-runtime.js"),m=require("react"),_=require("clsx"),O=require("../node_modules/@para-ui/icons/DoubleRight/index.js"),z=require("../node_modules/@para-ui/icons/Close/index.js"),G=require("../node_modules/@para-ui/icons/Check/index.js"),J=require("../node_modules/@para-ui/icons/Refresh/index.js"),K=require("../GlobalContext/constant.js"),Q=require("../GlobalContext/useFormatMessage.js"),U=require("./lang/index.js"),Y=require("../Loading/index.js");;/* empty css */const $=I=>{const{className:L,style:N,refresh:k,getImgInfo:j,verify:R,width:a,height:g}=I,v=Q.default("DragVerify",U.default),[D,C]=m.useState(),[M,q]=m.useState(!1),c=m.useRef(null),t=m.useRef({getImgInfo:j,verify:R}),l=`${K.$prefixCls}-drag-verify`;t.current.getImgInfo=j,t.current.verify=R,m.useEffect(()=>(w(),S(),()=>{clearTimeout(t.current.timerError??void 0),clearTimeout(t.current.timerSuccess??void 0)}),[k,D]);const S=async()=>{t.current.padding=!0,q(!0);const e=await t.current.getImgInfo();t.current.imgInfo=e,H()},T=async(e,s)=>{const r=await t.current.verify(e,t.current.imgInfo);s(r)},H=()=>{if(!c.current)return;const e=document.createElement("img");e.setAttribute("src",t.current.imgInfo?.sourceImage),e.style.display="none";const s=document.createElement("img");t.current.imgMove=s,s.className="slider-img-move",s.style.display="none";const r=c.current.querySelector(".slider-img"),i=c.current.querySelector(".refresh");!r||!i||(i.style.display="none",r.innerHTML="",r.append(e),e.onload=()=>{e.style.display="inline-block",s.setAttribute("src",t.current.imgInfo?.newImage);const p=e.width;if(e.className="slider-img-bg",e.style.display="inline-block",!c.current)return;const f=c.current.querySelector(".slider-img"),x=f?.clientWidth;t.current.imgScale=p/x,f?.append(s),s.onload=()=>{t.current.padding=!1,s.style.display="inline-block",i.style.display="inline-block",s.width=s.width/t.current.imgScale,s.style.top=`${t.current.imgInfo?.y/t.current.imgScale}px`,q(!1)}},W(e,s))},W=(e,s)=>{const r=c.current;if(!r)return;const i=r.querySelector(".slider-move-box"),p=r.querySelector(".slider-move-mask"),f=r.querySelector(".slider-move"),x=r.querySelector(".slider-move-text"),A=f.getBoundingClientRect(),h=i.getBoundingClientRect().width,B=A.width,E=(u,d)=>{let n=u.pageX-d.pageX;n<0&&(n=0),n+h>e.width&&(n=e.width-h),i.style.left=`${n-1}px`,p.style.width=`${n<2?2:n}px`;const y=n/(B-h),V=(e.width-s.width)*y;s.style.left=`${V}px`,x.innerHTML=""},b=()=>{r.classList.remove(`${l}-move`),t.current.padding=!0;const d=parseFloat(s.style.left)*t.current.imgScale;T(d,n=>{if(!n){r.classList.add(`${l}-error`),t.current.timerError=setTimeout(()=>{t.current.padding=!1,w(),x.innerHTML=v({id:"tryAgain"}),S()},1e3);return}r.classList.add(`${l}-success`)})};i.onmousedown=u=>{t.current.padding||(r.classList.add(`${l}-move`),document.onmousemove=d=>{E(d,u)},document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,b()})},i.ontouchstart=u=>{if(u.preventDefault(),t.current.padding)return!1;const d=u.touches[0];return r.classList.add(`${l}-move`),document.ontouchmove=n=>{n.preventDefault();const y=n.touches[0];return E(y,d),!1},document.ontouchend=()=>{document.ontouchmove=null,document.ontouchend=null,b()},!1}},w=()=>{const e=c.current;if(!e)return;e.classList.remove(`${l}-success`),e.classList.remove(`${l}-error`);const s=e.querySelector(".slider-move-box"),r=e.querySelector(".slider-move-mask"),i=e.querySelector(".slider-move-text");i.innerHTML=v({id:"swipe"}),s.style.left="-1px",r.style.width="0px",t.current.imgMove&&(t.current.imgMove.style.left="0px")},X=()=>{C(Math.random())},F=()=>{const e={};if(a){let s=a;typeof a=="number"&&(s=`${a}px`),e.width=s}if(g){let s=g;typeof g=="number"&&(s=`${g}px`),e.height=s}return e},P=()=>_(l,L);return o.jsxRuntimeExports.jsxs("div",{className:P(),style:N,ref:c,children:[o.jsxRuntimeExports.jsx(J.Refresh,{onClick:X,className:"refresh"}),o.jsxRuntimeExports.jsx("div",{className:"slider-img",style:F()}),o.jsxRuntimeExports.jsxs("div",{className:"slider-move",children:[o.jsxRuntimeExports.jsx("div",{className:"slider-move-bg"}),o.jsxRuntimeExports.jsx("div",{className:"slider-move-mask",children:o.jsxRuntimeExports.jsxs("div",{className:"slider-move-box",draggable:!1,children:[o.jsxRuntimeExports.jsx(O.DoubleRight,{className:"svg-right"}),o.jsxRuntimeExports.jsx(z.Close,{className:"svg-close"}),o.jsxRuntimeExports.jsx(G.Check,{className:"svg-check"})]})}),o.jsxRuntimeExports.jsx("span",{className:"slider-move-text",children:v({id:"swipe"})})]}),M&&o.jsxRuntimeExports.jsx(Y.Loading,{})]})};exports.DragVerify=$;exports.default=$;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|