@zat-design/sisyphus-react 4.0.0-beta.3 → 4.0.0-beta.4

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 (243) hide show
  1. package/babel.config.js +7 -30
  2. package/dist/esm/index.d.ts +5 -0
  3. package/dist/esm/index.js +5 -0
  4. package/dist/esm/regExp/index.d.ts +19 -0
  5. package/dist/esm/regExp/index.js +73 -0
  6. package/dist/esm/tools/calc/index.d.ts +4 -0
  7. package/dist/esm/tools/calc/index.js +67 -0
  8. package/dist/esm/tools/dateUtils.d.ts +7 -0
  9. package/dist/esm/tools/dateUtils.js +23 -0
  10. package/dist/esm/tools/disableDate/index.d.ts +9 -0
  11. package/dist/esm/tools/disableDate/index.js +43 -0
  12. package/dist/esm/tools/disableTimeRange/index.d.ts +9 -0
  13. package/dist/esm/tools/disableTimeRange/index.js +121 -0
  14. package/dist/esm/tools/formatAmount/index.d.ts +7 -0
  15. package/dist/esm/tools/formatAmount/index.js +14 -0
  16. package/dist/esm/tools/formatPerMill/index.d.ts +7 -0
  17. package/dist/esm/tools/formatPerMill/index.js +11 -0
  18. package/dist/esm/tools/formatPercent/index.d.ts +7 -0
  19. package/dist/esm/tools/formatPercent/index.js +11 -0
  20. package/dist/esm/tools/getDataByIdCard/index.d.ts +16 -0
  21. package/dist/esm/tools/getDataByIdCard/index.js +65 -0
  22. package/dist/esm/tools/index.d.ts +12 -0
  23. package/dist/esm/tools/index.js +14 -0
  24. package/dist/esm/tools/sumAmount/index.d.ts +16 -0
  25. package/dist/esm/tools/sumAmount/index.js +40 -0
  26. package/dist/esm/tools/toChineseNum/index.d.ts +7 -0
  27. package/dist/esm/tools/toChineseNum/index.js +103 -0
  28. package/dist/esm/tools/toFixed/index.d.ts +2 -0
  29. package/dist/esm/tools/toFixed/index.js +5 -0
  30. package/dist/esm/tools/transformDataName/index.d.ts +12 -0
  31. package/dist/esm/tools/transformDataName/index.js +37 -0
  32. package/dist/esm/transforms/dateTransformer/index.d.ts +24 -0
  33. package/dist/esm/transforms/dateTransformer/index.js +67 -0
  34. package/dist/esm/transforms/index.d.ts +6 -0
  35. package/dist/esm/transforms/index.js +6 -0
  36. package/dist/esm/transforms/propTypes.d.ts +7 -0
  37. package/dist/esm/transforms/propTypes.js +1 -0
  38. package/dist/esm/transforms/transformDate/index.d.ts +21 -0
  39. package/dist/esm/transforms/transformDate/index.js +141 -0
  40. package/dist/esm/transforms/transformDatePicker/index.d.ts +12 -0
  41. package/dist/esm/transforms/transformDatePicker/index.js +24 -0
  42. package/dist/esm/transforms/transformRangePicker/index.d.ts +29 -0
  43. package/dist/esm/transforms/transformRangePicker/index.js +61 -0
  44. package/dist/esm/transforms/transformSwitch/index.d.ts +13 -0
  45. package/dist/esm/transforms/transformSwitch/index.js +35 -0
  46. package/dist/esm/transforms/utils.d.ts +2 -0
  47. package/dist/esm/transforms/utils.js +8 -0
  48. package/dist/esm/validate/index.d.ts +107 -0
  49. package/dist/esm/validate/index.js +284 -0
  50. package/es/ProAction/index.less +0 -2
  51. package/es/ProConfigProvider/index.d.ts +1 -0
  52. package/es/ProConfigProvider/index.js +4 -5
  53. package/es/ProDownload/style/index.less +0 -2
  54. package/es/ProDrawerForm/index.js +33 -29
  55. package/es/ProDrawerForm/style/index.less +0 -2
  56. package/es/ProEditLabel/style/index.less +0 -2
  57. package/es/ProEditTable/components/RcTable/DraggableTable.js +1 -1
  58. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -2
  59. package/es/ProEditTable/propsType.d.ts +1 -1
  60. package/es/ProEditTable/style/index.less +2 -4
  61. package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
  62. package/es/ProEditTable/utils/diffOriginal.js +68 -1
  63. package/es/ProEnum/hooks/useEnum.js +5 -0
  64. package/es/ProEnum/style/index.less +0 -2
  65. package/es/ProForm/components/FormFooter/index.js +6 -6
  66. package/es/ProForm/components/base/DatePicker/index.js +19 -34
  67. package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  68. package/es/ProForm/components/base/TextArea/index.less +0 -2
  69. package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
  70. package/es/ProForm/components/combination/Container/style/index.less +0 -2
  71. package/es/ProForm/components/combination/FormList/style/index.less +0 -2
  72. package/es/ProForm/components/combination/Group/component/ComRender.js +9 -8
  73. package/es/ProForm/components/combination/Group/hooks/index.js +17 -4
  74. package/es/ProForm/components/combination/Group/index.d.ts +8 -2
  75. package/es/ProForm/components/combination/Group/index.js +10 -16
  76. package/es/ProForm/components/combination/ProCascader/index.js +106 -52
  77. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
  78. package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
  79. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
  80. package/es/ProForm/components/combination/ProModalSelect/index.js +38 -64
  81. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  82. package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
  83. package/es/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
  84. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
  85. package/es/ProForm/components/render/ChangedWrapper.js +2 -2
  86. package/es/ProForm/components/render/Render.js +17 -5
  87. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  88. package/es/ProForm/components/render/RenderFields.js +4 -2
  89. package/es/ProForm/components/render/propsType.d.ts +1 -0
  90. package/es/ProForm/index.d.ts +2 -2
  91. package/es/ProForm/index.js +5 -2
  92. package/es/ProForm/propsType.d.ts +2 -0
  93. package/es/ProForm/style/index.less +0 -2
  94. package/es/ProForm/utils/diffOriginal.d.ts +1 -0
  95. package/es/ProForm/utils/diffOriginal.js +66 -1
  96. package/es/ProForm/utils/index.js +1 -1
  97. package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
  98. package/es/ProForm/utils/useShouldUpdate.js +89 -3
  99. package/es/ProIcon/style/index.less +0 -2
  100. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +60 -8
  101. package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
  102. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +25 -3
  103. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
  104. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
  105. package/es/ProLayout/components/Layout/Menu/index.js +4 -1
  106. package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
  107. package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
  108. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
  109. package/es/ProLayout/components/ProCollapse/index.js +27 -3
  110. package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
  111. package/es/ProLayout/components/ProFooter/style/index.less +0 -2
  112. package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
  113. package/es/ProLayout/components/ProHeader/style/index.less +0 -2
  114. package/es/ProLayout/index.d.ts +0 -11
  115. package/es/ProLayout/index.js +60 -32
  116. package/es/ProLayout/propTypes.d.ts +9 -0
  117. package/es/ProLayout/style/index.less +0 -2
  118. package/es/ProLayout/utils/index.d.ts +7 -0
  119. package/es/ProLayout/utils/index.js +30 -0
  120. package/es/ProSelect/index.less +0 -2
  121. package/es/ProSelect/utils/index.js +62 -1
  122. package/es/ProStep/components/Item/index.js +1 -2
  123. package/es/ProStep/style/index.less +0 -2
  124. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
  125. package/es/ProTable/hooks/useAntdTable.d.ts +3 -0
  126. package/es/ProTable/hooks/useAntdTable.js +92 -64
  127. package/es/ProTable/index.d.ts +3 -7
  128. package/es/ProTable/index.js +14 -14
  129. package/es/ProTable/propsType.d.ts +3 -2
  130. package/es/ProTable/style/index.less +4 -6
  131. package/es/ProTabs/style/index.less +0 -2
  132. package/es/ProThemeTools/index.d.ts +0 -7
  133. package/es/ProThemeTools/index.js +10 -12
  134. package/es/ProThemeTools/style/index.less +0 -2
  135. package/es/ProTooltip/style/index.less +0 -2
  136. package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
  137. package/es/ProTree/style/index.less +0 -2
  138. package/es/ProTreeModal/style/index.less +0 -2
  139. package/es/ProUpload/style/index.less +0 -2
  140. package/es/ProViewer/style/index.less +0 -2
  141. package/es/style/theme/antd.less +0 -2
  142. package/jest.config.js +46 -4
  143. package/lib/ProAction/index.less +0 -2
  144. package/lib/ProConfigProvider/index.d.ts +1 -0
  145. package/lib/ProConfigProvider/index.js +4 -3
  146. package/lib/ProDownload/style/index.less +0 -2
  147. package/lib/ProDrawerForm/index.js +25 -28
  148. package/lib/ProDrawerForm/style/index.less +0 -2
  149. package/lib/ProEditLabel/style/index.less +0 -2
  150. package/lib/ProEditTable/components/RcTable/DraggableTable.js +1 -1
  151. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -2
  152. package/lib/ProEditTable/propsType.d.ts +1 -1
  153. package/lib/ProEditTable/style/index.less +2 -4
  154. package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
  155. package/lib/ProEditTable/utils/diffOriginal.js +48 -1
  156. package/lib/ProEnum/hooks/useEnum.js +3 -0
  157. package/lib/ProEnum/style/index.less +0 -2
  158. package/lib/ProForm/components/FormFooter/index.js +6 -5
  159. package/lib/ProForm/components/base/DatePicker/index.js +21 -33
  160. package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  161. package/lib/ProForm/components/base/TextArea/index.less +0 -2
  162. package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
  163. package/lib/ProForm/components/combination/Container/style/index.less +0 -2
  164. package/lib/ProForm/components/combination/FormList/style/index.less +0 -2
  165. package/lib/ProForm/components/combination/Group/component/ComRender.js +8 -7
  166. package/lib/ProForm/components/combination/Group/hooks/index.js +8 -2
  167. package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
  168. package/lib/ProForm/components/combination/Group/index.js +8 -13
  169. package/lib/ProForm/components/combination/ProCascader/index.js +73 -16
  170. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
  171. package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
  172. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -2
  173. package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -52
  174. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  175. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
  176. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
  177. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
  178. package/lib/ProForm/components/render/ChangedWrapper.js +2 -2
  179. package/lib/ProForm/components/render/Render.js +11 -3
  180. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  181. package/lib/ProForm/components/render/RenderFields.js +4 -2
  182. package/lib/ProForm/components/render/propsType.d.ts +1 -0
  183. package/lib/ProForm/index.d.ts +2 -2
  184. package/lib/ProForm/index.js +3 -1
  185. package/lib/ProForm/propsType.d.ts +2 -0
  186. package/lib/ProForm/style/index.less +0 -2
  187. package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
  188. package/lib/ProForm/utils/diffOriginal.js +48 -1
  189. package/lib/ProForm/utils/index.js +1 -1
  190. package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
  191. package/lib/ProForm/utils/useShouldUpdate.js +50 -1
  192. package/lib/ProIcon/style/index.less +0 -2
  193. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +33 -4
  194. package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
  195. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +7 -2
  196. package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +2 -1
  197. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
  198. package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
  199. package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
  200. package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
  201. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
  202. package/lib/ProLayout/components/ProCollapse/index.js +27 -3
  203. package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
  204. package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
  205. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
  206. package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
  207. package/lib/ProLayout/index.d.ts +0 -11
  208. package/lib/ProLayout/index.js +51 -32
  209. package/lib/ProLayout/propTypes.d.ts +9 -0
  210. package/lib/ProLayout/style/index.less +0 -2
  211. package/lib/ProLayout/utils/index.d.ts +7 -0
  212. package/lib/ProLayout/utils/index.js +15 -0
  213. package/lib/ProSelect/index.less +0 -2
  214. package/lib/ProSelect/utils/index.js +34 -5
  215. package/lib/ProStep/components/Item/index.js +1 -2
  216. package/lib/ProStep/style/index.less +0 -2
  217. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
  218. package/lib/ProTable/hooks/useAntdTable.d.ts +3 -0
  219. package/lib/ProTable/hooks/useAntdTable.js +71 -36
  220. package/lib/ProTable/index.d.ts +3 -7
  221. package/lib/ProTable/index.js +8 -13
  222. package/lib/ProTable/propsType.d.ts +3 -2
  223. package/lib/ProTable/style/index.less +4 -6
  224. package/lib/ProTabs/style/index.less +0 -2
  225. package/lib/ProThemeTools/index.d.ts +0 -7
  226. package/lib/ProThemeTools/index.js +5 -12
  227. package/lib/ProThemeTools/style/index.less +0 -2
  228. package/lib/ProTooltip/style/index.less +0 -2
  229. package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
  230. package/lib/ProTree/style/index.less +0 -2
  231. package/lib/ProTreeModal/style/index.less +0 -2
  232. package/lib/ProUpload/style/index.less +0 -2
  233. package/lib/ProViewer/style/index.less +0 -2
  234. package/lib/style/theme/antd.less +0 -2
  235. package/package.json +7 -6
  236. package/tests/__mocks__/fileMock.js +1 -0
  237. package/tests/__mocks__/zatUtils.js +27 -0
  238. package/tests/setup.ts +484 -0
  239. package/tests/test-utils.tsx +81 -0
  240. package/dist/index.esm.css +0 -6445
  241. package/dist/index.esm.js +0 -3
  242. package/dist/less.esm.css +0 -5871
  243. package/dist/less.esm.js +0 -3
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-select-ellipse {
5
3
  display: block;
@@ -44,23 +44,52 @@ var findSelectNameValues = ({
44
44
  }) => {
45
45
  let selectValues = [];
46
46
  list.forEach((item) => {
47
- let result = item;
47
+ let result2 = item;
48
48
  if (!item || !Object.keys(item).length || Object.keys(item).length === 1 && "rowKey" in item) {
49
49
  return false;
50
50
  }
51
51
  for (const key of selectName) {
52
- result = result[key];
52
+ result2 = result2[key];
53
53
  }
54
54
  if (mode === "multiple") {
55
- selectValues = [...selectValues, ...result || []];
55
+ selectValues = [...selectValues, ...result2 || []];
56
56
  } else {
57
- selectValues.push(result);
57
+ selectValues.push(result2);
58
58
  }
59
59
  });
60
60
  const diffList = import_lodash.default.difference(selectValues, mode === "multiple" ? value : [value]);
61
- return dataSource.filter(
61
+ const result = dataSource.filter(
62
62
  (item) => !diffList.includes(labelInValue ? item : item[fieldNames == null ? void 0 : fieldNames.value] || (item == null ? void 0 : item.value))
63
63
  );
64
+ const isSingle = list == null ? void 0 : list.find((item) => item == null ? void 0 : item._isEditing);
65
+ if (mode === "multiple" && isSingle) {
66
+ const editingRow = list.find((item) => item == null ? void 0 : item._isEditing);
67
+ const otherRowsValues = [];
68
+ list.forEach((item) => {
69
+ if (item !== editingRow) {
70
+ let result2 = item;
71
+ for (const key of selectName) {
72
+ result2 = result2[key];
73
+ }
74
+ if (result2) {
75
+ otherRowsValues.push(...Array.isArray(result2) ? result2 : [result2]);
76
+ }
77
+ }
78
+ });
79
+ let currentRowValues = [];
80
+ if (editingRow) {
81
+ let result2 = editingRow;
82
+ for (const key of selectName) {
83
+ result2 = result2[key];
84
+ }
85
+ currentRowValues = Array.isArray(result2) ? result2 : result2 ? [result2] : [];
86
+ }
87
+ const diffList2 = import_lodash.default.difference(otherRowsValues, currentRowValues);
88
+ return dataSource.filter(
89
+ (item) => !diffList2.includes(labelInValue ? item : item[fieldNames == null ? void 0 : fieldNames.value] || (item == null ? void 0 : item.value))
90
+ );
91
+ }
92
+ return result;
64
93
  };
65
94
  var getSelectList = ({
66
95
  otherProps,
@@ -73,8 +73,7 @@ var ProStepItem = ({
73
73
  const renderChildren = () => {
74
74
  if (lazyLoad) {
75
75
  const lazyLoadProps = (0, import_lodash.isBoolean)(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
76
- const LazyLoadComponent = import_react_lazyload.default;
77
- return /* @__PURE__ */ React.createElement(LazyLoadComponent, { ...lazyLoadProps, classNamePrefix: id }, children);
76
+ return /* @__PURE__ */ React.createElement(import_react_lazyload.default, { ...lazyLoadProps, classNamePrefix: id }, children);
78
77
  }
79
78
  return children;
80
79
  };
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-step-wrapper {
5
3
  padding-right: 48px;
@@ -57,7 +57,7 @@ var Row = (props) => {
57
57
  if (index === 0) {
58
58
  const { render, record, renderIndex } = (child == null ? void 0 : child.props) || {};
59
59
  return import_react.default.cloneElement(child, {
60
- children: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: `drag-wrapper${props["data-hide"] ? " no-check" : ""}` }, /* @__PURE__ */ import_react.default.createElement(
60
+ children: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: `pro-table-drag-wrapper${props["data-hide"] ? " no-check" : ""}` }, /* @__PURE__ */ import_react.default.createElement(
61
61
  import_ProIcon.default,
62
62
  {
63
63
  className: "drag-icon",
@@ -1,4 +1,7 @@
1
1
  import { useRequest } from 'ahooks';
2
2
  import type { ProTableRequestOptionsType, ProTableServiceType } from '../propsType';
3
+ export declare const SELECTION_ALL = "SELECTION_ALL";
4
+ export declare const CURRENT_PAGE = "CURRENT_PAGE";
5
+ export declare const UNCHECK_ALL = "UNCHECK_ALL";
3
6
  declare function useAntdTable<I, R extends Record<string, any>, S extends ProTableServiceType<I, R>>(service: S, options?: ProTableRequestOptionsType<I, R>, useRequestOptions?: Parameters<typeof useRequest>[1]): any;
4
7
  export default useAntdTable;
@@ -29,6 +29,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/ProTable/hooks/useAntdTable.ts
30
30
  var useAntdTable_exports = {};
31
31
  __export(useAntdTable_exports, {
32
+ CURRENT_PAGE: () => CURRENT_PAGE,
33
+ SELECTION_ALL: () => SELECTION_ALL,
34
+ UNCHECK_ALL: () => UNCHECK_ALL,
32
35
  default: () => useAntdTable_default
33
36
  });
34
37
  module.exports = __toCommonJS(useAntdTable_exports);
@@ -49,6 +52,9 @@ var useDefaultOptions = (options) => {
49
52
  };
50
53
  };
51
54
  var previousSearchValues = null;
55
+ var SELECTION_ALL = "SELECTION_ALL";
56
+ var CURRENT_PAGE = "CURRENT_PAGE";
57
+ var UNCHECK_ALL = "UNCHECK_ALL";
52
58
  function useAntdTable(service, options, useRequestOptions) {
53
59
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
54
60
  const [
@@ -319,6 +325,63 @@ function useAntdTable(service, options, useRequestOptions) {
319
325
  const res = await refreshAsync();
320
326
  refreshPage(res);
321
327
  };
328
+ const defaultSelections = [
329
+ {
330
+ key: "currentPage",
331
+ text: (0, import_locale.formatMessage)((_b = (_a = import_locale.default) == null ? void 0 : _a.ProTable) == null ? void 0 : _b.selectCurPage, { total: (data == null ? void 0 : data.length) || 0 }),
332
+ onSelect: (changeableRowKeys) => {
333
+ setState({
334
+ allSelected: false,
335
+ selectedRecords: [...data],
336
+ selectedRowKeys: changeableRowKeys
337
+ });
338
+ }
339
+ },
340
+ {
341
+ key: "all",
342
+ text: (0, import_locale.formatMessage)((_d = (_c = import_locale.default) == null ? void 0 : _c.ProTable) == null ? void 0 : _d.selectAll, { total }),
343
+ onSelect: async (changeableRowKeys) => {
344
+ setState({
345
+ allSelected: true,
346
+ selectedRecords: [...data],
347
+ selectedRowKeys: changeableRowKeys
348
+ });
349
+ }
350
+ },
351
+ {
352
+ key: "uncheckAll",
353
+ text: (_f = (_e = import_locale.default) == null ? void 0 : _e.ProTable) == null ? void 0 : _f.deselect,
354
+ onSelect: async () => {
355
+ setState({
356
+ allSelected: false,
357
+ selectedRecords: [],
358
+ selectedRowKeys: []
359
+ });
360
+ }
361
+ }
362
+ ];
363
+ const selections = (0, import_react.useMemo)(() => {
364
+ if (rowSelections === true) {
365
+ return defaultSelections;
366
+ }
367
+ if (Array.isArray(rowSelections)) {
368
+ return rowSelections.map((item) => {
369
+ if (typeof item === "string") {
370
+ if (item === CURRENT_PAGE) {
371
+ return defaultSelections[0];
372
+ }
373
+ if (item === SELECTION_ALL) {
374
+ return defaultSelections[1];
375
+ }
376
+ if (item === UNCHECK_ALL) {
377
+ return defaultSelections[2];
378
+ }
379
+ }
380
+ return item;
381
+ });
382
+ }
383
+ return false;
384
+ }, [rowSelections]);
322
385
  const _rowSelection = {
323
386
  fixed: true,
324
387
  type: rowSelectType,
@@ -336,7 +399,7 @@ function useAntdTable(service, options, useRequestOptions) {
336
399
  return acc;
337
400
  }, {});
338
401
  setState({
339
- selectedRecords: newSelectedKeys == null ? void 0 : newSelectedKeys.map((item) => selectedRecordObj == null ? void 0 : selectedRecordObj[item]),
402
+ selectedRecords: newSelectedKeys == null ? void 0 : newSelectedKeys.map((item) => selectedRecordObj == null ? void 0 : selectedRecordObj[String(item)]),
340
403
  selectedRowKeys: newSelectedKeys
341
404
  });
342
405
  } else {
@@ -358,41 +421,7 @@ function useAntdTable(service, options, useRequestOptions) {
358
421
  getCheckboxProps: (record) => ({
359
422
  className: allSelected && rowSelections ? "checkbox-disabled" : ""
360
423
  }),
361
- selections: rowSelections ? [
362
- {
363
- key: "currentPage",
364
- text: (0, import_locale.formatMessage)((_b = (_a = import_locale.default) == null ? void 0 : _a.ProTable) == null ? void 0 : _b.selectCurPage, { total: (data == null ? void 0 : data.length) || 0 }),
365
- onSelect: (changeableRowKeys) => {
366
- setState({
367
- allSelected: false,
368
- selectedRecords: [...data],
369
- selectedRowKeys: changeableRowKeys
370
- });
371
- }
372
- },
373
- {
374
- key: "all",
375
- text: (0, import_locale.formatMessage)((_d = (_c = import_locale.default) == null ? void 0 : _c.ProTable) == null ? void 0 : _d.selectAll, { total }),
376
- onSelect: async (changeableRowKeys) => {
377
- setState({
378
- allSelected: true,
379
- selectedRecords: [...data],
380
- selectedRowKeys: changeableRowKeys
381
- });
382
- }
383
- },
384
- {
385
- key: "uncheckAll",
386
- text: (_f = (_e = import_locale.default) == null ? void 0 : _e.ProTable) == null ? void 0 : _f.deselect,
387
- onSelect: async () => {
388
- setState({
389
- allSelected: false,
390
- selectedRecords: [],
391
- selectedRowKeys: []
392
- });
393
- }
394
- }
395
- ] : false
424
+ selections
396
425
  };
397
426
  const rowSelection = (0, import_lodash.isObject)(returnRowSelection) ? (0, import_lodash.merge)(_rowSelection, returnRowSelection) : _rowSelection;
398
427
  if ((0, import_lodash.isObject)(returnRowSelection) && !(0, import_lodash.isEqual)(rowSelection, _rowSelection)) {
@@ -466,3 +495,9 @@ function useAntdTable(service, options, useRequestOptions) {
466
495
  return useAntdTableProps;
467
496
  }
468
497
  var useAntdTable_default = useAntdTable;
498
+ // Annotate the CommonJS export names for ESM import in node:
499
+ 0 && (module.exports = {
500
+ CURRENT_PAGE,
501
+ SELECTION_ALL,
502
+ UNCHECK_ALL
503
+ });
@@ -8,13 +8,9 @@ export declare const defaultPage: {
8
8
  };
9
9
  declare const ProTable: {
10
10
  (props: ProTableType): import("react/jsx-runtime").JSX.Element;
11
- defaultProps: {
12
- quickConfig: boolean;
13
- stripe: boolean;
14
- draggable: boolean;
15
- disabled: boolean;
16
- isView: boolean;
17
- };
18
11
  useAntdTable: typeof useAntdTable;
12
+ SELECTION_ALL: string;
13
+ CURRENT_PAGE: string;
14
+ UNCHECK_ALL: string;
19
15
  };
20
16
  export default ProTable;
@@ -66,13 +66,13 @@ var ProTable = (props) => {
66
66
  tableId,
67
67
  headerRender,
68
68
  footerRender,
69
- quickConfig,
70
- stripe,
69
+ quickConfig = false,
70
+ stripe = true,
71
71
  columns: propsColumns = [],
72
72
  className,
73
- draggable,
74
- disabled,
75
- isView,
73
+ draggable = false,
74
+ disabled = false,
75
+ isView = false,
76
76
  rowDisabled,
77
77
  summary,
78
78
  emptyText = (_b = (_a = import_locale.default) == null ? void 0 : _a.ProTable) == null ? void 0 : _b.noData,
@@ -427,15 +427,10 @@ var ProTable = (props) => {
427
427
  ))
428
428
  );
429
429
  };
430
- ProTable.defaultProps = {
431
- quickConfig: false,
432
- // 默认关闭快速配置
433
- stripe: true,
434
- draggable: false,
435
- disabled: false,
436
- isView: false
437
- };
438
430
  ProTable.useAntdTable = import_useAntdTable.default;
431
+ ProTable.SELECTION_ALL = import_useAntdTable.SELECTION_ALL;
432
+ ProTable.CURRENT_PAGE = import_useAntdTable.CURRENT_PAGE;
433
+ ProTable.UNCHECK_ALL = import_useAntdTable.UNCHECK_ALL;
439
434
  var ProTable_default = ProTable;
440
435
  // Annotate the CommonJS export names for ESM import in node:
441
436
  0 && (module.exports = {
@@ -1,6 +1,7 @@
1
1
  import { Key, ReactNode } from 'react';
2
- import type { TableProps, FormInstance, TooltipProps } from 'antd';
2
+ import type { TableProps, TooltipProps } from 'antd';
3
3
  import { NamePath } from 'antd/es/form/interface';
4
+ import { FormInstance } from 'antd/es/form/Form';
4
5
  import { ColumnType, GetRowKey, RowSelectionType } from 'antd/es/table/interface';
5
6
  import type { TabsProps } from 'antd/es/tabs';
6
7
  /**
@@ -607,7 +608,7 @@ export interface ProTableRequestOptionsType<T, R> {
607
608
  * @description 启用选择当前页、选择全部、取消选择下拉菜单
608
609
  * @default false
609
610
  */
610
- rowSelections?: boolean;
611
+ rowSelections?: boolean | object[];
611
612
  /**
612
613
  * 额外参数
613
614
  * @description 无法通过搜索表单设置的值,此值变更时也会重新发起请求,重置表单不会被清空
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-table {
5
3
  .pro-tooltip .singleLine {
@@ -96,9 +94,9 @@
96
94
  }
97
95
  }
98
96
  }
99
- .drag-wrapper {
100
- display: inline-flex;
101
- width: auto;
97
+ .pro-table-drag-wrapper {
98
+ display: flex;
99
+ justify-content: flex-end;
102
100
  margin-right: 8px;
103
101
  .anticon {
104
102
  cursor: pointer;
@@ -107,7 +105,7 @@
107
105
  }
108
106
  }
109
107
  }
110
- .drag-wrapper.no-check {
108
+ .pro-table-drag-wrapper.no-check {
111
109
  .anticon {
112
110
  margin-right: 0;
113
111
  }
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-tabs {
5
3
  .@{ant-prefix}-tabs .@{ant-prefix}-tabs-nav-list .@{ant-prefix}-tabs-tab {
@@ -1,13 +1,6 @@
1
1
  import type { ProThemeToolsType } from './propsType';
2
2
  declare const ProThemeTools: {
3
3
  ({ size, className, cacheTime, color, mode, iconFollowTheme, prefixCls, tableBorder, tableStripe, theme, onChange, ...props }: ProThemeToolsType): import("react/jsx-runtime").JSX.Element;
4
- defaultProps: {
5
- size: number;
6
- mode: string;
7
- color: string;
8
- iconFollowTheme: boolean;
9
- cacheTime: boolean;
10
- };
11
4
  setThemes: (themes: import("./utils/index").ThemesProps) => boolean;
12
5
  };
13
6
  export default ProThemeTools;
@@ -70,12 +70,12 @@ var defaultThemeConfig = {
70
70
  zauiStripe: true
71
71
  };
72
72
  var ProThemeTools = ({
73
- size,
73
+ size = 24,
74
74
  className,
75
- cacheTime,
76
- color,
77
- mode,
78
- iconFollowTheme,
75
+ cacheTime = false,
76
+ color = "#343434",
77
+ mode = "prd",
78
+ iconFollowTheme = false,
79
79
  prefixCls = "ant",
80
80
  tableBorder = false,
81
81
  tableStripe = false,
@@ -224,13 +224,6 @@ var ProThemeTools = ({
224
224
  }
225
225
  ));
226
226
  };
227
- ProThemeTools.defaultProps = {
228
- size: 24,
229
- mode: "prd",
230
- color: "#343434",
231
- iconFollowTheme: false,
232
- cacheTime: false
233
- };
234
227
  ProThemeTools.setThemes = import_utils.setThemes;
235
228
  var ProThemeTools_default = ProThemeTools;
236
229
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  @import '../component/ProTools/style/index.less';
5
3
 
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-tooltip {
5
3
  cursor: pointer;
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-tree-select{
5
3
  .@{ant-prefix}-select-selector{
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-tree-wrap-ellipse {
5
3
  display: block;
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-tree-modal-container .@{ant-prefix}-modal-content .@{ant-prefix}-modal-body {
5
3
  max-height: 498px !important;
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-upload {
5
3
  // display: inline-flex;
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
 
4
2
  .pro-viewer {
5
3
  .@{ant-prefix}-image {
@@ -1,5 +1,3 @@
1
- /* @root-entry-name: 'default'; */
2
- /* @import (reference) '~antd/es/style/themes/index.less'; */
3
1
  @import './base';
4
2
 
5
3
  @zat-disabled-color: #bcbcbc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.0.0-beta.3",
3
+ "version": "4.0.0-beta.4",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -30,7 +30,7 @@
30
30
  "docs:deploy": "gh-pages -d docs-dist",
31
31
  "lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
32
32
  "lint-staged": "lint-staged",
33
- "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx",
33
+ "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx --ignore-pattern '**/__tests__/**' --ignore-pattern '**/*.test.*' --ignore-pattern '**/*.spec.*'",
34
34
  "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
35
35
  "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
36
36
  "lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
@@ -78,7 +78,7 @@
78
78
  "@dnd-kit/core": "^6.0.8",
79
79
  "@dnd-kit/sortable": "^7.0.2",
80
80
  "@dnd-kit/utilities": "^3.2.1",
81
- "@zat-design/utils": "4.0.0-beta.3",
81
+ "@zat-design/utils": "4.0.0-beta.4",
82
82
  "ahooks": "3.8.4",
83
83
  "antd": "^5.26.4",
84
84
  "big.js": "^6.2.1",
@@ -93,13 +93,14 @@
93
93
  "peerDependencies": {
94
94
  "antd": "^5.26.4",
95
95
  "react": ">=16.9.0",
96
- "react-dom": ">=16.9.0"
96
+ "react-dom": ">=16.9.0",
97
+ "react-router-dom": "^5.1.7 || ^6.0.0"
97
98
  },
98
99
  "devDependencies": {
99
100
  "@commitlint/cli": "^12.1.1",
100
101
  "@commitlint/config-conventional": "^12.1.1",
101
- "@testing-library/jest-dom": "6.2.0",
102
- "@testing-library/react": "12.1.5",
102
+ "@testing-library/jest-dom": "^6.0.0",
103
+ "@testing-library/react": "^14.0.0",
103
104
  "@types/classnames": "^2.3.1",
104
105
  "@types/jest": "^29.5.11",
105
106
  "@types/lodash": "^4.14.171",
@@ -0,0 +1 @@
1
+ module.exports = 'test-file-stub';
@@ -0,0 +1,27 @@
1
+ // Mock @zat-design/utils
2
+ module.exports = {
3
+ tools: {
4
+ isValidUrl: jest.fn(() => true),
5
+ formatCurrency: jest.fn((value) => `¥${value}`),
6
+ formatDate: jest.fn((date) => new Date(date).toLocaleDateString()),
7
+ },
8
+ transforms: {
9
+ transformDate: jest.fn((value, params) => {
10
+ if (!value) return '';
11
+ return new Date(value).toLocaleDateString();
12
+ }),
13
+ transformSwitch: jest.fn((value) => value ? '是' : '否'),
14
+ transformMoney: jest.fn((value) => `¥${value || 0}`),
15
+ transformPercent: jest.fn((value) => `${(value || 0) * 100}%`),
16
+ },
17
+ validate: {
18
+ isEmail: jest.fn((email) => /\S+@\S+\.\S+/.test(email)),
19
+ isPhone: jest.fn((phone) => /^1[3-9]\d{9}$/.test(phone)),
20
+ isIdCard: jest.fn(() => true),
21
+ },
22
+ validateNameMap: {
23
+ email: 'isEmail',
24
+ phone: 'isPhone',
25
+ idCard: 'isIdCard',
26
+ },
27
+ };