@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.
- package/babel.config.js +7 -30
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/regExp/index.d.ts +19 -0
- package/dist/esm/regExp/index.js +73 -0
- package/dist/esm/tools/calc/index.d.ts +4 -0
- package/dist/esm/tools/calc/index.js +67 -0
- package/dist/esm/tools/dateUtils.d.ts +7 -0
- package/dist/esm/tools/dateUtils.js +23 -0
- package/dist/esm/tools/disableDate/index.d.ts +9 -0
- package/dist/esm/tools/disableDate/index.js +43 -0
- package/dist/esm/tools/disableTimeRange/index.d.ts +9 -0
- package/dist/esm/tools/disableTimeRange/index.js +121 -0
- package/dist/esm/tools/formatAmount/index.d.ts +7 -0
- package/dist/esm/tools/formatAmount/index.js +14 -0
- package/dist/esm/tools/formatPerMill/index.d.ts +7 -0
- package/dist/esm/tools/formatPerMill/index.js +11 -0
- package/dist/esm/tools/formatPercent/index.d.ts +7 -0
- package/dist/esm/tools/formatPercent/index.js +11 -0
- package/dist/esm/tools/getDataByIdCard/index.d.ts +16 -0
- package/dist/esm/tools/getDataByIdCard/index.js +65 -0
- package/dist/esm/tools/index.d.ts +12 -0
- package/dist/esm/tools/index.js +14 -0
- package/dist/esm/tools/sumAmount/index.d.ts +16 -0
- package/dist/esm/tools/sumAmount/index.js +40 -0
- package/dist/esm/tools/toChineseNum/index.d.ts +7 -0
- package/dist/esm/tools/toChineseNum/index.js +103 -0
- package/dist/esm/tools/toFixed/index.d.ts +2 -0
- package/dist/esm/tools/toFixed/index.js +5 -0
- package/dist/esm/tools/transformDataName/index.d.ts +12 -0
- package/dist/esm/tools/transformDataName/index.js +37 -0
- package/dist/esm/transforms/dateTransformer/index.d.ts +24 -0
- package/dist/esm/transforms/dateTransformer/index.js +67 -0
- package/dist/esm/transforms/index.d.ts +6 -0
- package/dist/esm/transforms/index.js +6 -0
- package/dist/esm/transforms/propTypes.d.ts +7 -0
- package/dist/esm/transforms/propTypes.js +1 -0
- package/dist/esm/transforms/transformDate/index.d.ts +21 -0
- package/dist/esm/transforms/transformDate/index.js +141 -0
- package/dist/esm/transforms/transformDatePicker/index.d.ts +12 -0
- package/dist/esm/transforms/transformDatePicker/index.js +24 -0
- package/dist/esm/transforms/transformRangePicker/index.d.ts +29 -0
- package/dist/esm/transforms/transformRangePicker/index.js +61 -0
- package/dist/esm/transforms/transformSwitch/index.d.ts +13 -0
- package/dist/esm/transforms/transformSwitch/index.js +35 -0
- package/dist/esm/transforms/utils.d.ts +2 -0
- package/dist/esm/transforms/utils.js +8 -0
- package/dist/esm/validate/index.d.ts +107 -0
- package/dist/esm/validate/index.js +284 -0
- package/es/ProAction/index.less +0 -2
- package/es/ProConfigProvider/index.d.ts +1 -0
- package/es/ProConfigProvider/index.js +4 -5
- package/es/ProDownload/style/index.less +0 -2
- package/es/ProDrawerForm/index.js +33 -29
- package/es/ProDrawerForm/style/index.less +0 -2
- package/es/ProEditLabel/style/index.less +0 -2
- package/es/ProEditTable/components/RcTable/DraggableTable.js +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -2
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +2 -4
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/es/ProEditTable/utils/diffOriginal.js +68 -1
- package/es/ProEnum/hooks/useEnum.js +5 -0
- package/es/ProEnum/style/index.less +0 -2
- package/es/ProForm/components/FormFooter/index.js +6 -6
- package/es/ProForm/components/base/DatePicker/index.js +19 -34
- package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
- package/es/ProForm/components/base/TextArea/index.less +0 -2
- package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/es/ProForm/components/combination/Container/style/index.less +0 -2
- package/es/ProForm/components/combination/FormList/style/index.less +0 -2
- package/es/ProForm/components/combination/Group/component/ComRender.js +9 -8
- package/es/ProForm/components/combination/Group/hooks/index.js +17 -4
- package/es/ProForm/components/combination/Group/index.d.ts +8 -2
- package/es/ProForm/components/combination/Group/index.js +10 -16
- package/es/ProForm/components/combination/ProCascader/index.js +106 -52
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
- package/es/ProForm/components/combination/ProModalSelect/index.js +38 -64
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
- package/es/ProForm/components/render/ChangedWrapper.js +2 -2
- package/es/ProForm/components/render/Render.js +17 -5
- package/es/ProForm/components/render/RenderFields.d.ts +1 -0
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -0
- package/es/ProForm/index.d.ts +2 -2
- package/es/ProForm/index.js +5 -2
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProForm/style/index.less +0 -2
- package/es/ProForm/utils/diffOriginal.d.ts +1 -0
- package/es/ProForm/utils/diffOriginal.js +66 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
- package/es/ProForm/utils/useShouldUpdate.js +89 -3
- package/es/ProIcon/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +60 -8
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +25 -3
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/index.js +4 -1
- package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/es/ProLayout/components/ProCollapse/index.js +27 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/es/ProLayout/components/ProFooter/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/style/index.less +0 -2
- package/es/ProLayout/index.d.ts +0 -11
- package/es/ProLayout/index.js +60 -32
- package/es/ProLayout/propTypes.d.ts +9 -0
- package/es/ProLayout/style/index.less +0 -2
- package/es/ProLayout/utils/index.d.ts +7 -0
- package/es/ProLayout/utils/index.js +30 -0
- package/es/ProSelect/index.less +0 -2
- package/es/ProSelect/utils/index.js +62 -1
- package/es/ProStep/components/Item/index.js +1 -2
- package/es/ProStep/style/index.less +0 -2
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
- package/es/ProTable/hooks/useAntdTable.d.ts +3 -0
- package/es/ProTable/hooks/useAntdTable.js +92 -64
- package/es/ProTable/index.d.ts +3 -7
- package/es/ProTable/index.js +14 -14
- package/es/ProTable/propsType.d.ts +3 -2
- package/es/ProTable/style/index.less +4 -6
- package/es/ProTabs/style/index.less +0 -2
- package/es/ProThemeTools/index.d.ts +0 -7
- package/es/ProThemeTools/index.js +10 -12
- package/es/ProThemeTools/style/index.less +0 -2
- package/es/ProTooltip/style/index.less +0 -2
- package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
- package/es/ProTree/style/index.less +0 -2
- package/es/ProTreeModal/style/index.less +0 -2
- package/es/ProUpload/style/index.less +0 -2
- package/es/ProViewer/style/index.less +0 -2
- package/es/style/theme/antd.less +0 -2
- package/jest.config.js +46 -4
- package/lib/ProAction/index.less +0 -2
- package/lib/ProConfigProvider/index.d.ts +1 -0
- package/lib/ProConfigProvider/index.js +4 -3
- package/lib/ProDownload/style/index.less +0 -2
- package/lib/ProDrawerForm/index.js +25 -28
- package/lib/ProDrawerForm/style/index.less +0 -2
- package/lib/ProEditLabel/style/index.less +0 -2
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -2
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +2 -4
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/lib/ProEditTable/utils/diffOriginal.js +48 -1
- package/lib/ProEnum/hooks/useEnum.js +3 -0
- package/lib/ProEnum/style/index.less +0 -2
- package/lib/ProForm/components/FormFooter/index.js +6 -5
- package/lib/ProForm/components/base/DatePicker/index.js +21 -33
- package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
- package/lib/ProForm/components/base/TextArea/index.less +0 -2
- package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/lib/ProForm/components/combination/Container/style/index.less +0 -2
- package/lib/ProForm/components/combination/FormList/style/index.less +0 -2
- package/lib/ProForm/components/combination/Group/component/ComRender.js +8 -7
- package/lib/ProForm/components/combination/Group/hooks/index.js +8 -2
- package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
- package/lib/ProForm/components/combination/Group/index.js +8 -13
- package/lib/ProForm/components/combination/ProCascader/index.js +73 -16
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -52
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
- package/lib/ProForm/components/render/ChangedWrapper.js +2 -2
- package/lib/ProForm/components/render/Render.js +11 -3
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -0
- package/lib/ProForm/index.d.ts +2 -2
- package/lib/ProForm/index.js +3 -1
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProForm/style/index.less +0 -2
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
- package/lib/ProForm/utils/diffOriginal.js +48 -1
- package/lib/ProForm/utils/index.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
- package/lib/ProForm/utils/useShouldUpdate.js +50 -1
- package/lib/ProIcon/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +33 -4
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +7 -2
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +2 -1
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
- package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/lib/ProLayout/components/ProCollapse/index.js +27 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
- package/lib/ProLayout/index.d.ts +0 -11
- package/lib/ProLayout/index.js +51 -32
- package/lib/ProLayout/propTypes.d.ts +9 -0
- package/lib/ProLayout/style/index.less +0 -2
- package/lib/ProLayout/utils/index.d.ts +7 -0
- package/lib/ProLayout/utils/index.js +15 -0
- package/lib/ProSelect/index.less +0 -2
- package/lib/ProSelect/utils/index.js +34 -5
- package/lib/ProStep/components/Item/index.js +1 -2
- package/lib/ProStep/style/index.less +0 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
- package/lib/ProTable/hooks/useAntdTable.d.ts +3 -0
- package/lib/ProTable/hooks/useAntdTable.js +71 -36
- package/lib/ProTable/index.d.ts +3 -7
- package/lib/ProTable/index.js +8 -13
- package/lib/ProTable/propsType.d.ts +3 -2
- package/lib/ProTable/style/index.less +4 -6
- package/lib/ProTabs/style/index.less +0 -2
- package/lib/ProThemeTools/index.d.ts +0 -7
- package/lib/ProThemeTools/index.js +5 -12
- package/lib/ProThemeTools/style/index.less +0 -2
- package/lib/ProTooltip/style/index.less +0 -2
- package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
- package/lib/ProTree/style/index.less +0 -2
- package/lib/ProTreeModal/style/index.less +0 -2
- package/lib/ProUpload/style/index.less +0 -2
- package/lib/ProViewer/style/index.less +0 -2
- package/lib/style/theme/antd.less +0 -2
- package/package.json +7 -6
- package/tests/__mocks__/fileMock.js +1 -0
- package/tests/__mocks__/zatUtils.js +27 -0
- package/tests/setup.ts +484 -0
- package/tests/test-utils.tsx +81 -0
- package/dist/index.esm.css +0 -6445
- package/dist/index.esm.js +0 -3
- package/dist/less.esm.css +0 -5871
- package/dist/less.esm.js +0 -3
package/lib/ProSelect/index.less
CHANGED
@@ -44,23 +44,52 @@ var findSelectNameValues = ({
|
|
44
44
|
}) => {
|
45
45
|
let selectValues = [];
|
46
46
|
list.forEach((item) => {
|
47
|
-
let
|
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
|
-
|
52
|
+
result2 = result2[key];
|
53
53
|
}
|
54
54
|
if (mode === "multiple") {
|
55
|
-
selectValues = [...selectValues, ...
|
55
|
+
selectValues = [...selectValues, ...result2 || []];
|
56
56
|
} else {
|
57
|
-
selectValues.push(
|
57
|
+
selectValues.push(result2);
|
58
58
|
}
|
59
59
|
});
|
60
60
|
const diffList = import_lodash.default.difference(selectValues, mode === "multiple" ? value : [value]);
|
61
|
-
|
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
|
-
|
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
|
};
|
package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js
CHANGED
@@ -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
|
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
|
+
});
|
package/lib/ProTable/index.d.ts
CHANGED
@@ -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;
|
package/lib/ProTable/index.js
CHANGED
@@ -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,
|
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:
|
101
|
-
|
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,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:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
3
|
-
"version": "4.0.0-beta.
|
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.
|
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.
|
102
|
-
"@testing-library/react": "
|
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
|
+
};
|