@zat-design/sisyphus-react 3.13.18-beta.1 → 3.13.18-beta.10

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 (37) hide show
  1. package/dist/index.esm.css +8 -2
  2. package/dist/less.esm.css +8 -2
  3. package/es/ProForm/components/base/DatePicker/index.js +16 -32
  4. package/es/ProForm/components/combination/Group/hooks/index.js +2 -7
  5. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
  6. package/es/ProForm/components/combination/ProModalSelect/index.js +41 -65
  7. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  8. package/es/ProForm/components/combination/ProModalSelect/style/index.less +2 -2
  9. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +57 -8
  10. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +23 -3
  11. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
  12. package/es/ProLayout/components/Layout/Menu/index.js +4 -1
  13. package/es/ProLayout/components/ProCollapse/style/index.less +14 -8
  14. package/es/ProLayout/index.js +3 -1
  15. package/es/ProLayout/propTypes.d.ts +9 -0
  16. package/es/ProLayout/utils/index.d.ts +7 -0
  17. package/es/ProLayout/utils/index.js +31 -1
  18. package/lib/ProForm/components/base/DatePicker/index.js +16 -32
  19. package/lib/ProForm/components/combination/Group/hooks/index.js +2 -7
  20. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
  21. package/lib/ProForm/components/combination/ProModalSelect/index.js +41 -65
  22. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  23. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +2 -2
  24. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +56 -7
  25. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +22 -2
  26. package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
  27. package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
  28. package/lib/ProLayout/components/ProCollapse/style/index.less +14 -8
  29. package/lib/ProLayout/index.js +3 -1
  30. package/lib/ProLayout/propTypes.d.ts +9 -0
  31. package/lib/ProLayout/utils/index.d.ts +7 -0
  32. package/lib/ProLayout/utils/index.js +30 -1
  33. package/package.json +1 -1
  34. package/es/ProForm/components/base/DatePicker/useDateLimit.d.ts +0 -9
  35. package/es/ProForm/components/base/DatePicker/useDateLimit.js +0 -15
  36. package/lib/ProForm/components/base/DatePicker/useDateLimit.d.ts +0 -9
  37. package/lib/ProForm/components/base/DatePicker/useDateLimit.js +0 -22
@@ -20,7 +20,8 @@ var _index2 = require("../../../../index");
20
20
  var _utils = require("../../../../utils");
21
21
  var FoldMenu = function FoldMenu(props) {
22
22
  var style = props.style,
23
- dataSource = props.dataSource;
23
+ dataSource = props.dataSource,
24
+ onMenuClick = props.onMenuClick;
24
25
  var menus = dataSource.menus,
25
26
  iconfontUrl = dataSource.iconfontUrl,
26
27
  notice = dataSource.notice,
@@ -89,7 +90,8 @@ var FoldMenu = function FoldMenu(props) {
89
90
  content: (0, _jsxRuntime.jsx)(_SideMenu.default, {
90
91
  dataSource: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataSource), {}, {
91
92
  menus: item
92
- })
93
+ }),
94
+ onMenuClick: onMenuClick
93
95
  }),
94
96
  color: "#fff",
95
97
  overlayClassName: noticeCls,
@@ -98,12 +100,42 @@ var FoldMenu = function FoldMenu(props) {
98
100
  height: "calc(100vh - ".concat(headerHeight + (notice ? 32 : 0), "px)")
99
101
  },
100
102
  placement: "rightTop",
101
- children: LiNode
103
+ children: (0, _jsxRuntime.jsx)("span", {
104
+ onClick: function onClick() {
105
+ // 查找完整的菜单项数据
106
+ var menuItem = (0, _utils.findMenuItemByKey)(menus, String(id));
107
+ var menuKeyPath = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map(function (id) {
108
+ return String(id);
109
+ }) : [String(id)];
110
+ // 调用用户传入的onMenuClick回调
111
+ if (onMenuClick) {
112
+ onMenuClick({
113
+ item: menuItem,
114
+ key: String(id),
115
+ keyPath: menuKeyPath
116
+ });
117
+ }
118
+ },
119
+ children: LiNode
120
+ })
102
121
  }, "".concat(id, "-").concat(name)) : !collapsed ? (0, _jsxRuntime.jsx)(_tooltip.default, {
103
122
  placement: "right",
104
123
  title: name,
105
124
  children: (0, _jsxRuntime.jsx)("span", {
106
125
  onClick: function onClick() {
126
+ // 查找完整的菜单项数据
127
+ var menuItem = (0, _utils.findMenuItemByKey)(menus, String(id));
128
+ var menuKeyPath = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map(function (id) {
129
+ return String(id);
130
+ }) : [String(id)];
131
+ // 调用用户传入的onMenuClick回调
132
+ if (onMenuClick) {
133
+ onMenuClick({
134
+ item: menuItem,
135
+ key: String(id),
136
+ keyPath: menuKeyPath
137
+ });
138
+ }
107
139
  onSelected({
108
140
  selectedPath: toPath
109
141
  });
@@ -113,10 +145,27 @@ var FoldMenu = function FoldMenu(props) {
113
145
  children: LiNode
114
146
  }, toPath)
115
147
  })
116
- }, toPath) : (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
117
- to: toPath,
118
- children: LiNode
119
- }, toPath);
148
+ }, toPath) : (0, _jsxRuntime.jsx)("span", {
149
+ onClick: function onClick() {
150
+ // 查找完整的菜单项数据
151
+ var menuItem = (0, _utils.findMenuItemByKey)(menus, String(id));
152
+ var menuKeyPath = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map(function (id) {
153
+ return String(id);
154
+ }) : [String(id)];
155
+ // 调用用户传入的onMenuClick回调
156
+ if (onMenuClick) {
157
+ onMenuClick({
158
+ item: menuItem,
159
+ key: String(id),
160
+ keyPath: menuKeyPath
161
+ });
162
+ }
163
+ },
164
+ children: (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
165
+ to: toPath,
166
+ children: LiNode
167
+ }, toPath)
168
+ });
120
169
  })
121
170
  })
122
171
  });
@@ -25,7 +25,8 @@ var OpenMenu = function OpenMenu(props) {
25
25
  dataSource = props.dataSource,
26
26
  style = props.style,
27
27
  _props$theme = props.theme,
28
- theme = _props$theme === void 0 ? 'dark' : _props$theme;
28
+ theme = _props$theme === void 0 ? 'dark' : _props$theme,
29
+ onMenuClick = props.onMenuClick;
29
30
  var _ref = dataSource || {},
30
31
  menus = _ref.menus,
31
32
  sideMenu = _ref.sideMenu;
@@ -149,7 +150,26 @@ var OpenMenu = function OpenMenu(props) {
149
150
  onClick: function onClick(_ref2) {
150
151
  var _item$props, _item$props2;
151
152
  var item = _ref2.item,
152
- keyPath = _ref2.keyPath;
153
+ keyPath = _ref2.keyPath,
154
+ key = _ref2.key,
155
+ domEvent = _ref2.domEvent;
156
+ // console.log('item', item);
157
+ // console.log('keyPath', keyPath);
158
+ // console.log('key', key);
159
+ // console.log('domEvent', domEvent);
160
+ // 查找完整的菜单项数据
161
+ var menuItem = (0, _utils.findMenuItemByKey)(menus, key);
162
+ var menuKeyPath = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map(function (id) {
163
+ return String(id);
164
+ }) : keyPath;
165
+ // 调用用户传入的onMenuClick回调
166
+ if (onMenuClick) {
167
+ onMenuClick({
168
+ item: menuItem,
169
+ key: key,
170
+ keyPath: menuKeyPath
171
+ });
172
+ }
153
173
  setState({
154
174
  selectedKeys: keyPath,
155
175
  router: item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.router
@@ -11,7 +11,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _ahooks = require("ahooks");
12
12
  var _OpenMenu = _interopRequireDefault(require("../OpenMenu"));
13
13
  var SideMenu = function SideMenu(props) {
14
- var dataSource = props.dataSource;
14
+ var dataSource = props.dataSource,
15
+ onMenuClick = props.onMenuClick;
15
16
  var ref = (0, _react.useRef)(null);
16
17
  var size = (0, _ahooks.useSize)(ref);
17
18
  var menus = dataSource.menus,
@@ -31,6 +32,7 @@ var SideMenu = function SideMenu(props) {
31
32
  children: (0, _jsxRuntime.jsx)(_OpenMenu.default, {
32
33
  className: "pro-layout-sider-menu-list",
33
34
  theme: "light",
35
+ onMenuClick: onMenuClick,
34
36
  dataSource: {
35
37
  menus: (menus === null || menus === void 0 ? void 0 : menus.children) || [],
36
38
  iconfontUrl: iconfontUrl,
@@ -21,7 +21,8 @@ var Menu = function Menu(props) {
21
21
  pure = _ref.pure,
22
22
  theme = _ref.theme,
23
23
  sideMenuFooterRender = _ref.sideMenuFooterRender,
24
- sideMenuHeaderRender = _ref.sideMenuHeaderRender;
24
+ sideMenuHeaderRender = _ref.sideMenuHeaderRender,
25
+ onMenuClick = _ref.onMenuClick;
25
26
  var menus = [];
26
27
  var menuCls = (0, _classnames.default)({
27
28
  'pro-layout-menu': true,
@@ -47,6 +48,7 @@ var Menu = function Menu(props) {
47
48
  height: headerHeight + (notice ? 32 : 0) + 48
48
49
  },
49
50
  theme: theme,
51
+ onMenuClick: onMenuClick,
50
52
  style: {
51
53
  display: collapsed ? 'block' : 'none'
52
54
  }
@@ -59,6 +61,7 @@ var Menu = function Menu(props) {
59
61
  collapsed: collapsed,
60
62
  headerHeight: headerHeight
61
63
  },
64
+ onMenuClick: onMenuClick,
62
65
  style: {
63
66
  display: collapsed ? 'none' : 'block',
64
67
  height: "calc(100vh - ".concat(headerHeight + (notice ? 32 : 0) + 48 || 0, "px)")
@@ -99,7 +99,7 @@
99
99
  }
100
100
 
101
101
  .pro-collapse-content {
102
- padding: var(--zaui-space-size-sm, 8px) 0 !important;
102
+ padding: var(--zaui-space-size-md, 16px) !important;
103
103
  }
104
104
 
105
105
  .pro-collapse-level2-collapse {
@@ -150,6 +150,9 @@
150
150
  .@{ant-prefix}-collapse-expand-icon {
151
151
  display: none;
152
152
  }
153
+ .pro-collapse-content{
154
+ padding: var(--zaui-space-size-sm, 8px) 0 !important;
155
+ }
153
156
  }
154
157
  }
155
158
 
@@ -254,7 +257,11 @@
254
257
  }
255
258
  }
256
259
 
257
-
260
+ .pro-collapse-level3-no-collapse{
261
+ .@{ant-prefix}-collapse-header{
262
+ padding: 0 !important;
263
+ }
264
+ }
258
265
 
259
266
  .@{ant-prefix}-collapse-header {
260
267
  height: 48px !important;
@@ -332,10 +339,9 @@
332
339
  background: #F8F8F8 !important;
333
340
  }
334
341
  }
335
- // 当pro-collapse-content直接包含level3且不包含level2时,添加padding
336
- .pro-collapse-content:has(> .pro-collapse-level3):not(:has(> .pro-collapse-level2)) {
337
- padding: var(--zaui-space-size-md, 16px) !important;
338
- padding-right: 0 !important;
339
- }
340
-
342
+ // 当pro-collapse-content直接包含level3且不包含level2时,添加padding
343
+ .pro-collapse-level2 .pro-collapse-content:has(.pro-collapse-level3) {
344
+ padding: var(--zaui-space-size-md, 16px) !important;
345
+ padding-right: 0 !important;
346
+ }
341
347
  }
@@ -37,7 +37,8 @@ var ProLayout = function ProLayout(props) {
37
37
  pathPrefix = _props$pathPrefix === void 0 ? '' : _props$pathPrefix,
38
38
  theme = props.theme,
39
39
  target = props.target,
40
- onCollapsedChange = props.onCollapsedChange;
40
+ onCollapsedChange = props.onCollapsedChange,
41
+ onMenuClick = props.onMenuClick;
41
42
  var _useSetState = (0, _ahooks.useSetState)({
42
43
  notice: headerNotice || noticeIn,
43
44
  menus: [],
@@ -102,6 +103,7 @@ var ProLayout = function ProLayout(props) {
102
103
  } : menus,
103
104
  notice: notice,
104
105
  collapsed: collapsed,
106
+ onMenuClick: onMenuClick,
105
107
  onToggle: function onToggle() {
106
108
  toggle();
107
109
  onCollapsedChange && onCollapsedChange(!collapsed);
@@ -180,6 +180,15 @@ export interface ProLayoutType {
180
180
  * @default -
181
181
  */
182
182
  onCollapsedChange?: (collapsed: boolean) => void;
183
+ /**
184
+ * @description 菜单点击回调事件,返回命中的菜单项数据和完整路径
185
+ * @default -
186
+ */
187
+ onMenuClick?: (params: {
188
+ item: MenusType | null;
189
+ key: string;
190
+ keyPath: string[];
191
+ }) => void;
183
192
  /**
184
193
  * @description 规定在何处打开被链接文档
185
194
  * @default "_self"
@@ -34,3 +34,10 @@ export declare const getPathNameKey: ({ menus, pathName, }: {
34
34
  menus: any[];
35
35
  pathName: string;
36
36
  }) => any;
37
+ /**
38
+ * 根据key查找完整的菜单项数据
39
+ * @param menus 菜单数据数组
40
+ * @param key 要查找的菜单项key
41
+ * @returns 找到的菜单项数据或null
42
+ */
43
+ export declare const findMenuItemByKey: (menus: any[], key: string) => any;
@@ -4,9 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getPathNameKey = exports.getIdsByPathName = void 0;
7
+ exports.getPathNameKey = exports.getIdsByPathName = exports.findMenuItemByKey = void 0;
8
8
  exports.getUrlParams = getUrlParams;
9
9
  exports.transformMenus = exports.transformMenu = void 0;
10
+ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
10
11
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
13
  var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
@@ -168,4 +169,32 @@ var getPathNameKey = exports.getPathNameKey = function getPathNameKey(_ref) {
168
169
  };
169
170
  _menuDeep3(menus);
170
171
  return result;
172
+ };
173
+ /**
174
+ * 根据key查找完整的菜单项数据
175
+ * @param menus 菜单数据数组
176
+ * @param key 要查找的菜单项key
177
+ * @returns 找到的菜单项数据或null
178
+ */
179
+ var _findMenuItemByKey = exports.findMenuItemByKey = function findMenuItemByKey(menus, key) {
180
+ // eslint-disable-next-line no-restricted-syntax
181
+ var _iterator = (0, _createForOfIteratorHelper2.default)(menus),
182
+ _step;
183
+ try {
184
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
185
+ var item = _step.value;
186
+ if (String(item.id) === key) {
187
+ return item;
188
+ }
189
+ if (Array.isArray(item.children) && item.children.length) {
190
+ var found = _findMenuItemByKey(item.children, key);
191
+ if (found) return found;
192
+ }
193
+ }
194
+ } catch (err) {
195
+ _iterator.e(err);
196
+ } finally {
197
+ _iterator.f();
198
+ }
199
+ return null;
171
200
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.18-beta.1",
3
+ "version": "3.13.18-beta.10",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,9 +0,0 @@
1
- import { DurationInputArg1, DurationInputArg2, Moment } from 'moment';
2
- interface Props {
3
- range?: [Moment?, Moment?];
4
- limit?: [DurationInputArg1, DurationInputArg2];
5
- }
6
- export declare const useDateLimit: (props: Props) => {
7
- onCalendarChange: (val: any) => void;
8
- };
9
- export {};
@@ -1,15 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { useState } from 'react';
3
- export var useDateLimit = function useDateLimit(props) {
4
- var range = props.range,
5
- limit = props.limit;
6
- var _useState = useState(),
7
- _useState2 = _slicedToArray(_useState, 2),
8
- dates = _useState2[0],
9
- setDates = _useState2[1];
10
- return {
11
- onCalendarChange: function onCalendarChange(val) {
12
- return setDates(val);
13
- }
14
- };
15
- };
@@ -1,9 +0,0 @@
1
- import { DurationInputArg1, DurationInputArg2, Moment } from 'moment';
2
- interface Props {
3
- range?: [Moment?, Moment?];
4
- limit?: [DurationInputArg1, DurationInputArg2];
5
- }
6
- export declare const useDateLimit: (props: Props) => {
7
- onCalendarChange: (val: any) => void;
8
- };
9
- export {};
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.useDateLimit = void 0;
8
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _react = require("react");
10
- var useDateLimit = exports.useDateLimit = function useDateLimit(props) {
11
- var range = props.range,
12
- limit = props.limit;
13
- var _useState = (0, _react.useState)(),
14
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
15
- dates = _useState2[0],
16
- setDates = _useState2[1];
17
- return {
18
- onCalendarChange: function onCalendarChange(val) {
19
- return setDates(val);
20
- }
21
- };
22
- };