@para-ui/core 4.0.15 → 4.0.16

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.
Files changed (95) hide show
  1. package/Cascader/index.js +7 -6
  2. package/ComboSelect/index.js +7 -3
  3. package/CycleSelector/index.js +1 -2
  4. package/DatePicker/index.js +1 -2
  5. package/DynamicMultiBox/index.js +8 -5
  6. package/Form/index.js +8 -4
  7. package/FormItem/index.js +8 -4
  8. package/FunctionModal/index.js +2 -2
  9. package/PopMenu/context.d.ts +33 -0
  10. package/PopMenu/hooks.d.ts +5 -0
  11. package/PopMenu/index.d.ts +5 -0
  12. package/PopMenu/index.js +288 -0
  13. package/PopMenu/interface.d.ts +61 -0
  14. package/PopMenu/item.d.ts +4 -0
  15. package/PopMenu/list.d.ts +4 -0
  16. package/Popover/index.js +10 -1
  17. package/QuickReply/index.js +1 -1
  18. package/README.md +4 -0
  19. package/Selector/index.js +4 -326
  20. package/SelectorPicker/index.js +4 -2
  21. package/TimePicker/index.js +1 -2
  22. package/Tooltip/index.js +7 -3
  23. package/Tooltip/interface.d.ts +2 -0
  24. package/Tree/index.js +8 -4
  25. package/Upload/index.js +2 -1
  26. package/_verture/{defineProperty-1d116156.js → defineProperty-51493dbe.js} +10 -2
  27. package/_verture/{index-79cebfc8.js → index-06069532.js} +1 -1
  28. package/_verture/{index-767e63dd.js → index-0ad6af26.js} +394 -313
  29. package/_verture/index-287ae1b3.js +327 -0
  30. package/_verture/{index-9784b09c.js → index-782e05bf.js} +5 -20
  31. package/_verture/{slicedToArray-8223a2ef.js → slicedToArray-a8206399.js} +2 -15
  32. package/_verture/toConsumableArray-8f4c9589.js +19 -0
  33. package/_verture/unsupportedIterableToArray-cb478f24.js +16 -0
  34. package/index.d.ts +2 -0
  35. package/index.js +12 -9
  36. package/package.json +1 -1
  37. package/umd/AutoBox.js +1 -1
  38. package/umd/AutoTips.js +1 -1
  39. package/umd/Breadcrumbs.js +1 -1
  40. package/umd/Button.js +1 -1
  41. package/umd/ButtonGroup.js +1 -1
  42. package/umd/Cascader.js +1 -1
  43. package/umd/Checkbox.js +1 -1
  44. package/umd/CheckboxGroup.js +1 -1
  45. package/umd/ComboSelect.js +1 -1
  46. package/umd/CopyText.js +1 -1
  47. package/umd/CycleSelector.js +1 -1
  48. package/umd/DatePicker.js +1 -1
  49. package/umd/Descriptions.js +1 -1
  50. package/umd/Desktop.js +1 -1
  51. package/umd/Drawer.js +1 -1
  52. package/umd/DynamicMultiBox.js +1 -1
  53. package/umd/Form.js +1 -1
  54. package/umd/FormItem.js +1 -1
  55. package/umd/FunctionModal.js +1 -1
  56. package/umd/Help.js +1 -1
  57. package/umd/InputLang.js +1 -1
  58. package/umd/InputNumber.js +1 -1
  59. package/umd/Label.js +1 -1
  60. package/umd/Menu.js +1 -1
  61. package/umd/Modal.js +1 -1
  62. package/umd/MultiBox.js +1 -1
  63. package/umd/OperateBtn.js +1 -1
  64. package/umd/PageHeader.js +1 -1
  65. package/umd/Pagination.js +1 -1
  66. package/umd/PopConfirm.js +1 -1
  67. package/umd/PopMenu.js +43 -0
  68. package/umd/Popover.js +1 -1
  69. package/umd/QuickReply.js +1 -1
  70. package/umd/Radio.js +1 -1
  71. package/umd/RadioGroup.js +1 -1
  72. package/umd/Search.js +1 -1
  73. package/umd/Select.js +1 -1
  74. package/umd/SelectInput.js +1 -1
  75. package/umd/Selector.js +1 -1
  76. package/umd/SelectorPicker.js +1 -1
  77. package/umd/SingleBox.js +1 -1
  78. package/umd/Stepper.js +1 -1
  79. package/umd/Switch.js +1 -1
  80. package/umd/Table.js +1 -1
  81. package/umd/Tabs.js +1 -1
  82. package/umd/Tag.js +1 -1
  83. package/umd/TextEditor.js +1 -1
  84. package/umd/TextField.js +1 -1
  85. package/umd/TimePicker.js +1 -1
  86. package/umd/Title.js +1 -1
  87. package/umd/ToggleButton.js +1 -1
  88. package/umd/Tooltip.js +1 -1
  89. package/umd/Transfer.js +1 -1
  90. package/umd/Tree.js +1 -1
  91. package/umd/Upload.js +1 -1
  92. package/_verture/typeof-adeedc13.js +0 -11
  93. /package/_verture/{index-28a6bc3a.js → index-9bef932a.js} +0 -0
  94. /package/_verture/{modalContext-7380ea41.js → modalContext-b101ffaa.js} +0 -0
  95. /package/_verture/{typeof-c310ee4a.js → typeof-6ec38efd.js} +0 -0
package/Cascader/index.js CHANGED
@@ -1,15 +1,16 @@
1
- import { C as Cascader } from '../_verture/index-9784b09c.js';
2
- export { C as default } from '../_verture/index-9784b09c.js';
1
+ import { C as Cascader } from '../_verture/index-782e05bf.js';
2
+ export { C as default } from '../_verture/index-782e05bf.js';
3
3
  import '../_verture/tslib.es6-55ed4bd2.js';
4
4
  import 'react/jsx-runtime';
5
- import '../_verture/slicedToArray-8223a2ef.js';
6
- import '../_verture/defineProperty-1d116156.js';
7
- import '../_verture/typeof-adeedc13.js';
5
+ import '../_verture/toConsumableArray-8f4c9589.js';
6
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
7
+ import '../_verture/defineProperty-51493dbe.js';
8
+ import '../_verture/slicedToArray-a8206399.js';
8
9
  import 'react';
9
10
  import 'react-dom';
10
11
  import 'rc-motion';
11
12
  import 'clsx';
12
- import '../_verture/typeof-c310ee4a.js';
13
+ import '../_verture/typeof-6ec38efd.js';
13
14
  import 'rc-tree/lib/utils/conductUtil';
14
15
  import '@para-ui/icons/Right';
15
16
  import '@para-ui/icons/Down';
@@ -6,7 +6,7 @@ import SearchIcon from '@para-ui/icons/Search';
6
6
  import CloseIcon from '@para-ui/icons/Close';
7
7
  import CloseCircleF from '@para-ui/icons/CloseCircleF';
8
8
  import Table from '../Table/index.js';
9
- import { T as Tree } from '../_verture/index-767e63dd.js';
9
+ import { T as Tree } from '../_verture/index-0ad6af26.js';
10
10
  import { Button } from '../Button/index.js';
11
11
  import { D as Dropdown } from '../_verture/index-389675ab.js';
12
12
  import { Popover } from '../Popover/index.js';
@@ -56,10 +56,14 @@ import 'rc-pagination';
56
56
  import '@para-ui/icons/Right';
57
57
  import '@para-ui/icons/DoubleLeft';
58
58
  import '@para-ui/icons/DoubleRight';
59
+ import '../_verture/toConsumableArray-8f4c9589.js';
60
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
61
+ import '../_verture/defineProperty-51493dbe.js';
62
+ import '../_verture/slicedToArray-a8206399.js';
63
+ import '../_verture/index-287ae1b3.js';
64
+ import '../_verture/typeof-6ec38efd.js';
59
65
  import 'rc-tree';
60
- import '../_verture/typeof-adeedc13.js';
61
66
  import '@para-ui/icons/Document';
62
- import '../_verture/slicedToArray-8223a2ef.js';
63
67
  import 'react-dom';
64
68
  import '@para-ui/icons/EditFile';
65
69
  import '@para-ui/icons/PlusCircle';
@@ -27,8 +27,7 @@ import '@para-ui/icons/Forbid';
27
27
  import '@paraview/lib';
28
28
  import '../_verture/tinycolor-ece3542d.js';
29
29
  import '@para-ui/icons/Plus';
30
- import '../_verture/defineProperty-1d116156.js';
31
- import '../_verture/typeof-adeedc13.js';
30
+ import '../_verture/defineProperty-51493dbe.js';
32
31
  import 'rc-picker';
33
32
  import '@para-ui/icons/CloseCircleF';
34
33
  import '@para-ui/icons/Calendar';
@@ -2,7 +2,7 @@ import dayjsGenerateConfig from 'rc-picker/es/generate/dayjs';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Button } from '../Button/index.js';
4
4
  import { Tag } from '../Tag/index.js';
5
- import { _ as _defineProperty } from '../_verture/defineProperty-1d116156.js';
5
+ import { _ as _defineProperty } from '../_verture/defineProperty-51493dbe.js';
6
6
  import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
7
7
  import React__default, { forwardRef, useImperativeHandle } from 'react';
8
8
  import clsx from 'clsx';
@@ -35,7 +35,6 @@ import '@para-ui/icons/Close';
35
35
  import '@para-ui/icons/EditOutline';
36
36
  import '../_verture/tinycolor-ece3542d.js';
37
37
  import '@para-ui/icons/Plus';
38
- import '../_verture/typeof-adeedc13.js';
39
38
  import '../Help/index.js';
40
39
  import '@para-ui/icons/Help';
41
40
 
@@ -17,7 +17,7 @@ import { ComboSelect } from '../ComboSelect/index.js';
17
17
  import DatePicker from '../DatePicker/index.js';
18
18
  import AutoTips from '../AutoTips/index.js';
19
19
  import { UUID } from '@paraview/lib';
20
- import { d as dist } from '../_verture/index-28a6bc3a.js';
20
+ import { d as dist } from '../_verture/index-9bef932a.js';
21
21
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
22
22
  import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
23
23
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
@@ -70,11 +70,15 @@ import 'rc-pagination';
70
70
  import '@para-ui/icons/Right';
71
71
  import '@para-ui/icons/DoubleLeft';
72
72
  import '@para-ui/icons/DoubleRight';
73
- import '../_verture/index-767e63dd.js';
73
+ import '../_verture/index-0ad6af26.js';
74
+ import '../_verture/toConsumableArray-8f4c9589.js';
75
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
76
+ import '../_verture/defineProperty-51493dbe.js';
77
+ import '../_verture/slicedToArray-a8206399.js';
78
+ import '../_verture/index-287ae1b3.js';
79
+ import '../_verture/typeof-6ec38efd.js';
74
80
  import 'rc-tree';
75
- import '../_verture/typeof-adeedc13.js';
76
81
  import '@para-ui/icons/Document';
77
- import '../_verture/slicedToArray-8223a2ef.js';
78
82
  import 'react-dom';
79
83
  import '@para-ui/icons/EditFile';
80
84
  import '@para-ui/icons/PlusCircle';
@@ -86,7 +90,6 @@ import '../Tag/index.js';
86
90
  import '@para-ui/icons/EditOutline';
87
91
  import '../_verture/tinycolor-ece3542d.js';
88
92
  import '@para-ui/icons/Plus';
89
- import '../_verture/defineProperty-1d116156.js';
90
93
  import 'rc-picker';
91
94
  import '@para-ui/icons/Calendar';
92
95
  import '@para-ui/icons/Time';
package/Form/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { DeepClone } from '@paraview/lib';
3
3
  import React__default from 'react';
4
- import { F as FormItem, l as localeJson, v as validate } from '../_verture/index-79cebfc8.js';
4
+ import { F as FormItem, l as localeJson, v as validate } from '../_verture/index-06069532.js';
5
5
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
6
6
  import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
7
7
  import '../TextField/index.js';
@@ -28,7 +28,8 @@ import '../_verture/index-389675ab.js';
28
28
  import 'rc-dropdown';
29
29
  import '../_verture/usePopupContainer-635f66f4.js';
30
30
  import 'dayjs';
31
- import '../_verture/slicedToArray-8223a2ef.js';
31
+ import '../_verture/slicedToArray-a8206399.js';
32
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
32
33
  import '../RadioGroup/index.js';
33
34
  import '../Radio/index.js';
34
35
  import '../Select/index.js';
@@ -68,9 +69,12 @@ import 'rc-pagination';
68
69
  import '@para-ui/icons/Right';
69
70
  import '@para-ui/icons/DoubleLeft';
70
71
  import '@para-ui/icons/DoubleRight';
71
- import '../_verture/index-767e63dd.js';
72
+ import '../_verture/index-0ad6af26.js';
73
+ import '../_verture/toConsumableArray-8f4c9589.js';
74
+ import '../_verture/defineProperty-51493dbe.js';
75
+ import '../_verture/index-287ae1b3.js';
76
+ import '../_verture/typeof-6ec38efd.js';
72
77
  import 'rc-tree';
73
- import '../_verture/typeof-adeedc13.js';
74
78
  import '@para-ui/icons/Document';
75
79
  import 'react-dom';
76
80
  import '@para-ui/icons/EditFile';
package/FormItem/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'react';
3
- export { F as default } from '../_verture/index-79cebfc8.js';
3
+ export { F as default } from '../_verture/index-06069532.js';
4
4
  import 'clsx';
5
5
  import '../Label/index.js';
6
6
  import '../_verture/constant-5317fc89.js';
@@ -27,7 +27,8 @@ import '../_verture/usePopupContainer-635f66f4.js';
27
27
  import 'dayjs';
28
28
  import '../Help/index.js';
29
29
  import '@para-ui/icons/Help';
30
- import '../_verture/slicedToArray-8223a2ef.js';
30
+ import '../_verture/slicedToArray-a8206399.js';
31
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
31
32
  import '../RadioGroup/index.js';
32
33
  import '../Radio/index.js';
33
34
  import '../Select/index.js';
@@ -68,9 +69,12 @@ import 'rc-pagination';
68
69
  import '@para-ui/icons/Right';
69
70
  import '@para-ui/icons/DoubleLeft';
70
71
  import '@para-ui/icons/DoubleRight';
71
- import '../_verture/index-767e63dd.js';
72
+ import '../_verture/index-0ad6af26.js';
73
+ import '../_verture/toConsumableArray-8f4c9589.js';
74
+ import '../_verture/defineProperty-51493dbe.js';
75
+ import '../_verture/index-287ae1b3.js';
76
+ import '../_verture/typeof-6ec38efd.js';
72
77
  import 'rc-tree';
73
- import '../_verture/typeof-adeedc13.js';
74
78
  import '@para-ui/icons/Document';
75
79
  import 'react-dom';
76
80
  import '@para-ui/icons/EditFile';
@@ -1,5 +1,5 @@
1
- import { u as useModal } from '../_verture/modalContext-7380ea41.js';
2
- export { F as FunctionModalProvider, u as default, a as useClose } from '../_verture/modalContext-7380ea41.js';
1
+ import { u as useModal } from '../_verture/modalContext-b101ffaa.js';
2
+ export { F as FunctionModalProvider, u as default, a as useClose } from '../_verture/modalContext-b101ffaa.js';
3
3
  import '../_verture/tslib.es6-55ed4bd2.js';
4
4
  import 'react/jsx-runtime';
5
5
  import 'react';
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { IPopMenuHandler, PopMenuListItemProps, TPopMenuDirection } from './interface';
3
+ import { PopoverProps } from '../Popover';
4
+ export declare const PopMenuContext: React.Context<{
5
+ direction: TPopMenuDirection;
6
+ props: PopoverProps;
7
+ handle: IPopMenuHandler;
8
+ menuIndex: number;
9
+ path: string[];
10
+ value: string[];
11
+ onChange: (value: string[]) => void;
12
+ onClick: (name: string, item?: PopMenuListItemProps, path?: string[]) => void;
13
+ }>;
14
+ export declare const PopMenuProvider: React.Provider<{
15
+ direction: TPopMenuDirection;
16
+ props: PopoverProps;
17
+ handle: IPopMenuHandler;
18
+ menuIndex: number;
19
+ path: string[];
20
+ value: string[];
21
+ onChange: (value: string[]) => void;
22
+ onClick: (name: string, item?: PopMenuListItemProps, path?: string[]) => void;
23
+ }>;
24
+ export declare const usePopMenuContext: () => {
25
+ direction: TPopMenuDirection;
26
+ props: PopoverProps;
27
+ handle: IPopMenuHandler;
28
+ menuIndex: number;
29
+ path: string[];
30
+ value: string[];
31
+ onChange: (value: string[]) => void;
32
+ onClick: (name: string, item?: PopMenuListItemProps, path?: string[]) => void;
33
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const useComponentWidth: (efts: any[]) => {
3
+ width: number;
4
+ ref: React.RefObject<HTMLDivElement>;
5
+ };
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './index.scss';
3
+ import { PopMenuProps } from './interface';
4
+ export declare const PopMenu: FC<PopMenuProps>;
5
+ export default PopMenu;
@@ -0,0 +1,288 @@
1
+ import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import React__default, { useState, useRef, useEffect } from 'react';
5
+ import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
6
+ import { Popover } from '../Popover/index.js';
7
+ import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
8
+ import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
9
+ import Right from '@para-ui/icons/Right';
10
+ import AutoTips from '../AutoTips/index.js';
11
+ import { Tooltip } from '../Tooltip/index.js';
12
+ import Help from '../Help/index.js';
13
+ import '../_verture/usePopupContainer-635f66f4.js';
14
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
15
+ import '@paraview/lib';
16
+ import 'rc-tooltip';
17
+ import 'rc-tooltip/lib/placements';
18
+ import '@para-ui/icons/Forbid';
19
+ import '@para-ui/icons/Help';
20
+
21
+ /*
22
+ * @Author: ygj
23
+ * @Date: 2024-04-08 09:54:49
24
+ * @LastEditTime: 2024-04-09 16:04:55
25
+ * @LastEditors: ygj
26
+ * @Description:
27
+ * @FilePath: /para-ui-core/src/PopMenu/context.ts
28
+ */
29
+ const PopMenuContext = /*#__PURE__*/React__default.createContext({
30
+ direction: 'left',
31
+ props: {},
32
+ handle: {},
33
+ // 记录当前菜单层级
34
+ menuIndex: -1,
35
+ path: [],
36
+ value: [],
37
+ onChange: value => {},
38
+ onClick: (name, item, path) => {}
39
+ });
40
+ const PopMenuProvider = PopMenuContext.Provider;
41
+ const usePopMenuContext = () => {
42
+ return React__default.useContext(PopMenuContext);
43
+ };
44
+
45
+ /*
46
+ * @Author: ygj
47
+ * @Date: 2024-04-08 10:09:01
48
+ * @LastEditTime: 2024-04-09 10:13:36
49
+ * @LastEditors: ygj
50
+ * @Description:
51
+ * @FilePath: /para-ui-core/src/PopMenu/hooks.ts
52
+ */
53
+ // 获取组件宽度
54
+ const useComponentWidth = efts => {
55
+ const [width, setWidth] = useState(0);
56
+ const ref = useRef(null);
57
+ useEffect(() => {
58
+ var _a;
59
+ // 获取 children 的宽度设置为最小宽度
60
+ const childrenWidth = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) || 0;
61
+ setWidth(childrenWidth);
62
+ }, [ref.current, ...efts]);
63
+ return {
64
+ width,
65
+ ref
66
+ };
67
+ };
68
+
69
+ var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-pop-menu-content {\n display: inline-block;\n}\n.paraui-v4-pop-menu-item-content {\n display: flex;\n width: 100%;\n}\n.paraui-v4-pop-menu .pop-menu-separator:after {\n content: \"\";\n position: absolute;\n height: 1px;\n background: rgb(234, 236, 241);\n left: 10px;\n right: 10px;\n bottom: 0;\n}\n.paraui-v4-pop-menu .pop-menu-list {\n padding: 4px 0;\n overflow: hidden;\n position: relative;\n max-width: 500px;\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item {\n display: flex;\n width: 100%;\n align-items: center;\n height: 30px;\n cursor: pointer;\n padding: 0 10px;\n overflow: hidden;\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item .item-help {\n margin-left: 4px;\n display: flex;\n align-items: center;\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item .item-help:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item .item-arrow {\n margin-left: auto;\n padding-left: 10px;\n display: flex;\n align-items: center;\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item .item-arrow svg {\n width: 18px;\n height: 18px;\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item:hover {\n background: rgb(247, 248, 250);\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item-select {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item-select .item-arrow svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item-disabled {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-pop-menu .pop-menu-list .pop-menu-item-disabled svg {\n color: rgb(161, 168, 179);\n}";
70
+ styleInject(css_248z);
71
+
72
+ var PopMenuItem = function PopMenuItem(p) {
73
+ var title = p.title,
74
+ children = p.children,
75
+ disabled = p.disabled;
76
+ var _usePopMenuContext = usePopMenuContext(),
77
+ direction = _usePopMenuContext.direction,
78
+ props = _usePopMenuContext.props,
79
+ handle = _usePopMenuContext.handle,
80
+ menuIndex = _usePopMenuContext.menuIndex,
81
+ value = _usePopMenuContext.value,
82
+ onChange = _usePopMenuContext.onChange,
83
+ path = _usePopMenuContext.path,
84
+ onClick = _usePopMenuContext.onClick;
85
+ var getArrow = function getArrow() {
86
+ return jsx("div", Object.assign({
87
+ className: 'item-arrow'
88
+ }, {
89
+ children: jsx(Right, {})
90
+ }));
91
+ };
92
+ var currentValue = value === null || value === void 0 ? void 0 : value[menuIndex];
93
+ // 点击菜单项
94
+ var clickItem = function clickItem(item, close) {
95
+ // 点击有子菜单的菜单项,不关闭菜单
96
+ if (close) {
97
+ handle.closeMenu();
98
+ var newValue = _toConsumableArray(path);
99
+ newValue[menuIndex] = item.name;
100
+ onChange(newValue);
101
+ if (item.onClick) {
102
+ item.onClick(item.name, item, path);
103
+ }
104
+ onClick === null || onClick === void 0 ? void 0 : onClick(item.name, item, path);
105
+ }
106
+ };
107
+ /** 是否点击关闭 */
108
+ var getItem = function getItem(item, close) {
109
+ if (item.render) {
110
+ return item === null || item === void 0 ? void 0 : item.render(handle);
111
+ } else {
112
+ var contents = jsxs(Fragment, {
113
+ children: [jsx(AutoTips, {
114
+ children: title
115
+ }), item.help && jsx(Help, {
116
+ className: "item-help",
117
+ title: item.help
118
+ }), children ? getArrow() : null]
119
+ });
120
+ if (item.disabled) {
121
+ return jsx(Tooltip, Object.assign({
122
+ title: item.disabledTip,
123
+ disabled: item.disabled,
124
+ className: "pop-menu-item"
125
+ }, {
126
+ children: jsx("div", Object.assign({
127
+ className: "pop-menu-item pop-menu-item-disabled"
128
+ }, {
129
+ children: contents
130
+ }))
131
+ }));
132
+ }
133
+ return jsx("div", Object.assign({
134
+ className: clsx('pop-menu-item', {
135
+ 'pop-menu-item-select': currentValue === item.name
136
+ }),
137
+ onClick: function onClick() {
138
+ return clickItem(item, close);
139
+ }
140
+ }, {
141
+ children: contents
142
+ }));
143
+ }
144
+ };
145
+ if (children && !disabled) {
146
+ return jsx(PopMenu, Object.assign({}, props, {
147
+ data: children,
148
+ placement: direction === 'right' ? 'right-start' : 'left-start',
149
+ className: clsx("".concat($prefixCls, "-pop-menu-item-content"), props.contentClassName),
150
+ overlayInnerStyle: Object.assign({
151
+ minWidth: 'auto'
152
+ }, props.overlayInnerStyle),
153
+ contentClassName: 'item-content',
154
+ offset: [direction === 'right' ? 4 : -4, 0],
155
+ path: [].concat(_toConsumableArray(path), [p.name])
156
+ }, {
157
+ children: getItem(p, false)
158
+ }));
159
+ }
160
+ return getItem(p, true);
161
+ };
162
+
163
+ const PopMenuList = _ref => {
164
+ let {
165
+ list,
166
+ className,
167
+ style
168
+ } = _ref;
169
+ return jsx("div", Object.assign({
170
+ className: clsx('pop-menu-list', className),
171
+ style: style
172
+ }, {
173
+ children: list.map(item => {
174
+ if ( /*#__PURE__*/React__default.isValidElement(item)) {
175
+ return item;
176
+ }
177
+ const newItem = item;
178
+ return jsx(PopMenuItem, Object.assign({}, newItem), newItem.name);
179
+ })
180
+ }));
181
+ };
182
+
183
+ //popover
184
+ const PopMenu = props => {
185
+ const {
186
+ overlayClassName,
187
+ data,
188
+ children,
189
+ menuClassName,
190
+ menuStyle,
191
+ contentClassName,
192
+ contentStyle,
193
+ value,
194
+ onChange,
195
+ onClick,
196
+ path
197
+ } = props,
198
+ restProps = __rest(props, ["overlayClassName", "data", "children", "menuClassName", "menuStyle", "contentClassName", "contentStyle", "value", "onChange", "onClick", "path"]);
199
+ const {
200
+ width,
201
+ ref
202
+ } = useComponentWidth([children]);
203
+ const wrapRef = React__default.useRef();
204
+ const {
205
+ handle,
206
+ menuIndex
207
+ } = usePopMenuContext();
208
+ const getContent = () => {
209
+ var _a;
210
+ // 已分组数据
211
+ const groups = [];
212
+ // 未分组数据
213
+ const unGroup = {
214
+ list: []
215
+ };
216
+ // 生成分组数据
217
+ data.forEach(item => {
218
+ if (typeof item === 'object' && item !== null && 'list' in item) {
219
+ groups.push(item);
220
+ } else {
221
+ unGroup.list.push(item);
222
+ }
223
+ });
224
+ ((_a = unGroup.list) === null || _a === void 0 ? void 0 : _a.length) && groups.push(unGroup);
225
+ return jsx(Fragment, {
226
+ children: groups.map((group, index) => {
227
+ return jsx(PopMenuList, {
228
+ direction: restProps.direction,
229
+ list: group.list,
230
+ className: clsx(menuClassName, {
231
+ 'pop-menu-separator': index !== groups.length - 1
232
+ }),
233
+ style: menuStyle
234
+ }, index);
235
+ })
236
+ });
237
+ };
238
+ const getPlacement = () => {
239
+ if (restProps.placement) {
240
+ return restProps.placement;
241
+ }
242
+ return restProps.direction === 'right' ? 'bottomLeft' : 'bottomRight';
243
+ };
244
+ return jsx(PopMenuProvider, Object.assign({
245
+ value: {
246
+ // 当前菜单层级
247
+ menuIndex: menuIndex + 1,
248
+ // 菜单路径,(不包含当前)
249
+ path: path || [],
250
+ direction: restProps.direction || 'left',
251
+ props,
252
+ value: value || [],
253
+ onChange: onChange || (() => {}),
254
+ onClick: onClick || (() => {}),
255
+ handle: {
256
+ closeMenu: () => {
257
+ var _a, _b;
258
+ if (typeof (restProps === null || restProps === void 0 ? void 0 : restProps.visible) === 'undefined') {
259
+ (_a = wrapRef === null || wrapRef === void 0 ? void 0 : wrapRef.current) === null || _a === void 0 ? void 0 : _a.close();
260
+ handle && ((_b = handle === null || handle === void 0 ? void 0 : handle.closeMenu) === null || _b === void 0 ? void 0 : _b.call(handle));
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }, {
266
+ children: jsx(Popover, Object.assign({}, restProps, {
267
+ isPopover: true,
268
+ ref: wrapRef,
269
+ overlayClassName: clsx("".concat($prefixCls, "-pop-menu"), overlayClassName),
270
+ overlayInnerStyle: Object.assign({
271
+ minWidth: width
272
+ }, restProps.overlayInnerStyle),
273
+ content: getContent(),
274
+ placement: getPlacement()
275
+ }, {
276
+ children: jsx("div", Object.assign({
277
+ ref: ref,
278
+ className: clsx("".concat($prefixCls, "-pop-menu-content"), contentClassName),
279
+ style: contentStyle
280
+ }, {
281
+ children: children
282
+ }))
283
+ }))
284
+ }));
285
+ };
286
+ PopMenu.displayName = 'PopMenu';
287
+
288
+ export { PopMenu, PopMenu as default };
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { PopoverProps } from '../Popover';
3
+ export type TPopMenuDirection = 'left' | 'right';
4
+ export interface PopMenuListItemProps {
5
+ /** 禁用 */
6
+ disabled?: boolean;
7
+ /** 禁用提示 */
8
+ disabledTip?: string;
9
+ /** key */
10
+ name: string;
11
+ /** title */
12
+ title?: string;
13
+ /** 帮助提示 */
14
+ help?: string;
15
+ /** 自定义渲染 */
16
+ render?: (handle: IPopMenuHandler) => React.ReactElement;
17
+ /** 菜单点击事件 */
18
+ onClick?: (name: string, item?: PopMenuListItemProps, path?: string[]) => void;
19
+ /** 子菜单 */
20
+ children?: PopMenuListItemProps[];
21
+ }
22
+ export interface IPopMenuHandler {
23
+ /** 关闭菜单的方法 */
24
+ closeMenu: () => void;
25
+ }
26
+ export type PopMenuGroupItemProps = {
27
+ list: PopMenuListItemProps[];
28
+ };
29
+ export interface PopMenuListProps {
30
+ /** 菜单方向 左,右 */
31
+ direction?: TPopMenuDirection;
32
+ /** 菜单列表 */
33
+ list: PopMenuListItemProps[];
34
+ /** className */
35
+ className?: string;
36
+ /** style */
37
+ style?: React.CSSProperties;
38
+ }
39
+ export type TPopMenuValue = string[];
40
+ export interface PopMenuProps extends PopoverProps {
41
+ /** 菜单方向 左,右 */
42
+ direction?: TPopMenuDirection;
43
+ /** 菜单数据源 */
44
+ data: PopMenuListItemProps[] | PopMenuGroupItemProps[];
45
+ /** menu className */
46
+ menuClassName?: string;
47
+ /** menu style */
48
+ menuStyle?: React.CSSProperties;
49
+ /** content className */
50
+ contentClassName?: string;
51
+ /** content style */
52
+ contentStyle?: React.CSSProperties;
53
+ /** value */
54
+ value?: TPopMenuValue;
55
+ /** onChange */
56
+ onChange?: (value: TPopMenuValue) => void;
57
+ /** path,记录菜单路径 */
58
+ path?: string[];
59
+ /** 点击事件 */
60
+ onClick?: (name: string, item?: PopMenuListItemProps, path?: string[]) => void;
61
+ }
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { PopMenuListItemProps } from './interface';
3
+ declare const PopMenuItem: FC<PopMenuListItemProps>;
4
+ export default PopMenuItem;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { PopMenuListProps } from './interface';
3
+ declare const PopMenuList: FC<PopMenuListProps>;
4
+ export default PopMenuList;
package/Popover/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import React__default from 'react';
3
+ import React__default, { useEffect } from 'react';
4
4
  import { Tooltip } from '../Tooltip/index.js';
5
5
  import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-5317fc89.js';
6
6
  import { u as usePopupContainer } from '../_verture/usePopupContainer-635f66f4.js';
@@ -22,6 +22,15 @@ const Popover = /*#__PURE__*/React__default.forwardRef((props, ref) => {
22
22
  restProps = __rest(props, ["title", "content"]);
23
23
  const wrapRef = React__default.useRef();
24
24
  const getPopupContainer = usePopupContainer(wrapRef, props.getPopupContainer);
25
+ useEffect(() => {
26
+ if (ref) {
27
+ if (typeof ref === 'function') {
28
+ ref(wrapRef.current);
29
+ } else {
30
+ ref.current = wrapRef.current;
31
+ }
32
+ }
33
+ }, [wrapRef.current]);
25
34
  //浮层
26
35
  const getOverlay = prefixCls => {
27
36
  if (!title && !content) return null;
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { useState, useRef } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
5
- import { d as dist } from '../_verture/index-28a6bc3a.js';
5
+ import { d as dist } from '../_verture/index-9bef932a.js';
6
6
  import { Button } from '../Button/index.js';
7
7
  import { Checkbox } from '../Checkbox/index.js';
8
8
  import { TextField } from '../TextField/index.js';
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 版本: 4.0.16
2
+ para-ui/core@4.0.16 发布
3
+ 【级联下拉菜单-PopMenu】组件新增
4
+
1
5
  ## 版本: 4.0.15
2
6
  para-ui/core@4.0.15 发布
3
7
  【下拉框-Select】修复输入框长度占满整个空白区域,防止点击输入框后面空白区域,焦点消失