@zat-design/sisyphus-react 3.6.7-beta.7 → 3.6.7-beta.8
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/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/{lib/ProTable/utils.d.ts → es/ProTable/components/FormatColumn/index.d.ts} +1 -11
- package/es/ProTable/{utils.js → components/FormatColumn/index.js} +7 -57
- package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +11 -0
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +43 -0
- package/es/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/index.js +1 -4
- package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +11 -0
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +52 -0
- package/es/ProTable/components/RcTable/index.d.ts +4 -0
- package/es/ProTable/components/RcTable/index.js +4 -0
- package/es/ProTable/components/RenderEmptyText/index.d.ts +3 -0
- package/es/ProTable/components/RenderEmptyText/index.js +22 -0
- package/es/ProTable/components/RenderFooter/index.d.ts +2 -0
- package/es/ProTable/components/RenderFooter/index.js +12 -0
- package/es/ProTable/components/RenderSummary/index.d.ts +3 -0
- package/es/ProTable/components/RenderSummary/index.js +55 -0
- package/es/ProTable/components/RenderTableHeader/index.d.ts +2 -0
- package/es/ProTable/components/RenderTableHeader/index.js +61 -0
- package/es/ProTable/components/TableResizable/index.js +1 -9
- package/es/ProTable/components/index.d.ts +4 -2
- package/es/ProTable/components/index.js +4 -2
- package/es/ProTable/{useAntdTable.d.ts → hooks/useAntdTable.d.ts} +1 -1
- package/es/ProTable/{useAntdTable.js → hooks/useAntdTable.js} +3 -3
- package/es/ProTable/index.d.ts +1 -1
- package/es/ProTable/index.js +67 -156
- package/es/ProTable/utils/index.d.ts +26 -0
- package/es/ProTable/utils/index.js +51 -0
- package/{es/ProTable/utils.d.ts → lib/ProTable/components/FormatColumn/index.d.ts} +1 -11
- package/lib/ProTable/{utils.js → components/FormatColumn/index.js} +17 -68
- package/lib/ProTable/components/RcTable/components/BaseTable/index.d.ts +11 -0
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +49 -0
- package/lib/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/index.js +1 -4
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.d.ts +11 -0
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +59 -0
- package/lib/ProTable/components/RcTable/index.d.ts +4 -0
- package/lib/ProTable/components/RcTable/index.js +20 -0
- package/lib/ProTable/components/RenderEmptyText/index.d.ts +3 -0
- package/lib/ProTable/components/RenderEmptyText/index.js +28 -0
- package/lib/ProTable/components/RenderFooter/index.d.ts +2 -0
- package/lib/ProTable/components/RenderFooter/index.js +18 -0
- package/lib/ProTable/components/RenderSummary/index.d.ts +3 -0
- package/lib/ProTable/components/RenderSummary/index.js +61 -0
- package/lib/ProTable/components/RenderTableHeader/index.d.ts +2 -0
- package/lib/ProTable/components/RenderTableHeader/index.js +66 -0
- package/lib/ProTable/components/TableResizable/index.js +3 -11
- package/lib/ProTable/components/index.d.ts +4 -2
- package/lib/ProTable/components/index.js +16 -9
- package/lib/ProTable/{useAntdTable.d.ts → hooks/useAntdTable.d.ts} +1 -1
- package/lib/ProTable/{useAntdTable.js → hooks/useAntdTable.js} +3 -3
- package/lib/ProTable/index.d.ts +1 -1
- package/lib/ProTable/index.js +72 -158
- package/lib/ProTable/utils/index.d.ts +26 -0
- package/lib/ProTable/utils/index.js +57 -0
- package/package.json +1 -1
- package/es/ProTable/components/ResizableLine/index.d.ts +0 -2
- package/es/ProTable/components/ResizableLine/index.js +0 -10
- package/lib/ProTable/components/ResizableLine/index.d.ts +0 -2
- package/lib/ProTable/components/ResizableLine/index.js +0 -16
- /package/es/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/index.d.ts +0 -0
- /package/es/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/index.d.ts +0 -0
- /package/es/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/index.js +0 -0
- /package/es/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/propsType.d.ts +0 -0
- /package/es/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/propsType.js +0 -0
- /package/lib/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/index.d.ts +0 -0
- /package/lib/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/index.d.ts +0 -0
- /package/lib/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/index.js +0 -0
- /package/lib/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/propsType.d.ts +0 -0
- /package/lib/ProTable/components/{DndWrapper → RcTable/components/DraggableTable/components/DndWrapper}/utils/propsType.js +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "antd/es/button/style";
|
|
2
|
+
import _Button from "antd/es/button";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ReactSVG } from 'react-svg';
|
|
5
|
+
import { ProTreeModal } from '../../../index';
|
|
6
|
+
var RenderTableHeader = function RenderTableHeader(props) {
|
|
7
|
+
var _locale$ProTable, _locale$ProTable2, _locale$ProTable3;
|
|
8
|
+
var dataSource = props.dataSource;
|
|
9
|
+
var _ref = dataSource || {},
|
|
10
|
+
headerRender = _ref.headerRender,
|
|
11
|
+
columnConfig = _ref.columnConfig,
|
|
12
|
+
resizeColumn = _ref.resizeColumn,
|
|
13
|
+
resetSvg = _ref.resetSvg,
|
|
14
|
+
resetColumnWidth = _ref.resetColumnWidth,
|
|
15
|
+
locale = _ref.locale,
|
|
16
|
+
customColumns = _ref.customColumns,
|
|
17
|
+
checkColumns = _ref.checkColumns,
|
|
18
|
+
handleColumnConfig = _ref.handleColumnConfig,
|
|
19
|
+
customColumnSvg = _ref.customColumnSvg;
|
|
20
|
+
// 没有数据时,不展示tableHeader
|
|
21
|
+
if (!(headerRender || columnConfig || resizeColumn)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return _jsxs("div", {
|
|
25
|
+
className: "column-config",
|
|
26
|
+
children: [_jsx("div", {
|
|
27
|
+
className: "left-contain",
|
|
28
|
+
children: headerRender ? typeof headerRender === 'function' ? headerRender() : headerRender : null
|
|
29
|
+
}), _jsxs("div", {
|
|
30
|
+
className: "right-actions",
|
|
31
|
+
children: [resizeColumn && _jsx(_Button, {
|
|
32
|
+
icon: _jsx(ReactSVG, {
|
|
33
|
+
className: "anticon",
|
|
34
|
+
wrapper: "span",
|
|
35
|
+
src: resetSvg
|
|
36
|
+
}),
|
|
37
|
+
onClick: resetColumnWidth,
|
|
38
|
+
children: locale === null || locale === void 0 ? void 0 : (_locale$ProTable = locale.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.resetColumnWidth
|
|
39
|
+
}), columnConfig && _jsx(ProTreeModal, {
|
|
40
|
+
title: locale === null || locale === void 0 ? void 0 : (_locale$ProTable2 = locale.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.customColumns,
|
|
41
|
+
span: 8,
|
|
42
|
+
mode: "list",
|
|
43
|
+
draggable: true,
|
|
44
|
+
dataSource: customColumns,
|
|
45
|
+
value: checkColumns,
|
|
46
|
+
allValue: "all",
|
|
47
|
+
onChange: handleColumnConfig,
|
|
48
|
+
trigger: _jsx(_Button, {
|
|
49
|
+
className: "custom-column-btn",
|
|
50
|
+
icon: _jsx(ReactSVG, {
|
|
51
|
+
className: "anticon",
|
|
52
|
+
wrapper: "span",
|
|
53
|
+
src: customColumnSvg
|
|
54
|
+
}),
|
|
55
|
+
children: locale === null || locale === void 0 ? void 0 : (_locale$ProTable3 = locale.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.customColumns
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export default RenderTableHeader;
|
|
@@ -3,19 +3,11 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["onDrag", "width", "minwidth"];
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
/*
|
|
7
|
-
* @Author: chongyang wanchongyang@zhongan.io
|
|
8
|
-
* @Date: 2023-02-23 17:47:46
|
|
9
|
-
* @LastEditors: chongyang wanchongyang@zhongan.io
|
|
10
|
-
* @LastEditTime: 2023-03-07 20:18:22
|
|
11
|
-
* @FilePath: /za-material-warehouse/src/ProTable/TableResizable.tsx
|
|
12
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
13
|
-
*/
|
|
14
6
|
import { useState, useContext } from 'react';
|
|
15
7
|
import { Resizable } from 'react-resizable';
|
|
16
8
|
import classnames from 'classnames';
|
|
17
9
|
import { TableContext } from '../../index';
|
|
18
|
-
import { getParentElement } from '
|
|
10
|
+
import { getParentElement } from '../FormatColumn';
|
|
19
11
|
var ResizableTitle = function ResizableTitle(props) {
|
|
20
12
|
var _restProps$className;
|
|
21
13
|
var onDrag = props.onDrag,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { default as ResizableLine } from './ResizableLine';
|
|
2
1
|
export { default as TableResizable } from './TableResizable';
|
|
3
|
-
export { default as
|
|
2
|
+
export { default as RenderEmptyText } from './RenderEmptyText';
|
|
3
|
+
export { default as RenderSummary } from './RenderSummary';
|
|
4
|
+
export { default as RenderTableHeader } from './RenderTableHeader';
|
|
5
|
+
export { default as RenderFooter } from './RenderFooter';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { default as ResizableLine } from './ResizableLine';
|
|
2
1
|
export { default as TableResizable } from './TableResizable';
|
|
3
|
-
export { default as
|
|
2
|
+
export { default as RenderEmptyText } from './RenderEmptyText';
|
|
3
|
+
export { default as RenderSummary } from './RenderSummary';
|
|
4
|
+
export { default as RenderTableHeader } from './RenderTableHeader';
|
|
5
|
+
export { default as RenderFooter } from './RenderFooter';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Key } from 'react';
|
|
2
2
|
import { useRequest } from 'ahooks';
|
|
3
|
-
import { RequestOptions, Service } from '
|
|
3
|
+
import { RequestOptions, Service } from '../propsType';
|
|
4
4
|
declare function useAntdTable<I, R extends Record<string, any>, S extends Service<I, R>>(service: S, options?: RequestOptions<I, R>, useRequestOptions?: Parameters<typeof useRequest>[1]): {
|
|
5
5
|
data: R[];
|
|
6
6
|
params: any;
|
|
@@ -10,9 +10,9 @@ var _excluded = ["page", "filters", "sorter"];
|
|
|
10
10
|
import { useCallback, useMemo, useState } from 'react';
|
|
11
11
|
import { useRequest, useSetState, useDeepCompareEffect } from 'ahooks';
|
|
12
12
|
import { pickBy, isObject, merge, set, isEqual } from 'lodash';
|
|
13
|
-
import { defaultPage } from '
|
|
14
|
-
import { isListResult } from '
|
|
15
|
-
import locale, { formatMessage } from '
|
|
13
|
+
import { defaultPage } from '../index';
|
|
14
|
+
import { isListResult } from '../utils';
|
|
15
|
+
import locale, { formatMessage } from '../../locale';
|
|
16
16
|
var useDefaultOptions = function useDefaultOptions(options) {
|
|
17
17
|
var _useState = useState((options === null || options === void 0 ? void 0 : options.page) || defaultPage),
|
|
18
18
|
_useState2 = _slicedToArray(_useState, 2),
|
package/es/ProTable/index.d.ts
CHANGED
package/es/ProTable/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import "antd/es/button/style";
|
|
3
|
-
import _Button from "antd/es/button";
|
|
4
|
-
import "antd/es/table/style";
|
|
5
|
-
import _Table from "antd/es/table";
|
|
6
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
7
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
8
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
@@ -12,21 +7,20 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
12
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
8
|
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource"],
|
|
14
9
|
_excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
|
|
15
|
-
import {
|
|
10
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
11
|
import { useEffect, useMemo, useState, createContext } from 'react';
|
|
17
12
|
import { get, keyBy, assign, isObject } from 'lodash';
|
|
18
13
|
import { useDebounceEffect, useDeepCompareEffect, useSetState } from 'ahooks';
|
|
19
|
-
import { ReactSVG } from 'react-svg';
|
|
20
14
|
import classnames from 'classnames';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
15
|
+
import { useProConfig } from '../index';
|
|
16
|
+
import { RenderTableHeader, RenderFooter } from './components';
|
|
17
|
+
import useAntdTable from './hooks/useAntdTable';
|
|
18
|
+
import { BaseTable, DraggableTable } from './components/RcTable';
|
|
19
|
+
import { formatColumn } from './components/FormatColumn';
|
|
26
20
|
import empty from '../assets/empty.png';
|
|
27
21
|
import resetSvg from '../assets/reset.svg';
|
|
28
22
|
import customColumnSvg from '../assets/customColumn.svg';
|
|
29
|
-
import {
|
|
23
|
+
import { getColumnDataIndex, getRowKey } from './utils';
|
|
30
24
|
import locale from '../locale';
|
|
31
25
|
var defaultCacheTime = 1; // columns 配置保存时间为一天
|
|
32
26
|
// 全局上下文
|
|
@@ -36,7 +30,7 @@ export var defaultPage = {
|
|
|
36
30
|
pageSize: 10
|
|
37
31
|
};
|
|
38
32
|
function ProTable(props) {
|
|
39
|
-
var _locale$ProTable, _curTableConfig$pathK
|
|
33
|
+
var _locale$ProTable, _curTableConfig$pathK;
|
|
40
34
|
var _ref = useProConfig('globalConfig') || {},
|
|
41
35
|
configStorage = _ref.storage; // 获取全局缓存位置配置
|
|
42
36
|
var _ref2 = useProConfig('ProTable') || {},
|
|
@@ -61,7 +55,6 @@ function ProTable(props) {
|
|
|
61
55
|
originalDataSource = props.originalDataSource,
|
|
62
56
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
63
57
|
var quickTableConfig = quickConfig ? _objectSpread({
|
|
64
|
-
// resizeColumn: true,
|
|
65
58
|
columnConfig: true,
|
|
66
59
|
cacheTime: true
|
|
67
60
|
}, restProps) : (restProps === null || restProps === void 0 ? void 0 : restProps.columnConfig) ? _objectSpread({
|
|
@@ -268,53 +261,6 @@ function ProTable(props) {
|
|
|
268
261
|
return item === null || item === void 0 ? void 0 : item.dataIndex;
|
|
269
262
|
});
|
|
270
263
|
}, [curColumns]);
|
|
271
|
-
var renderSummary = function renderSummary() {
|
|
272
|
-
var _ref6 = summary || {},
|
|
273
|
-
columns = _ref6.columns,
|
|
274
|
-
_ref6$total = _ref6.total,
|
|
275
|
-
total = _ref6$total === void 0 ? true : _ref6$total,
|
|
276
|
-
_ref6$fixed = _ref6.fixed,
|
|
277
|
-
fixed = _ref6$fixed === void 0 ? true : _ref6$fixed;
|
|
278
|
-
var _ref7 = tableProps || {},
|
|
279
|
-
dataSource = _ref7.dataSource;
|
|
280
|
-
// 没有数据时,不展示合计栏
|
|
281
|
-
if (!(_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.length)) {
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
return _jsx(_Table.Summary, {
|
|
285
|
-
fixed: fixed,
|
|
286
|
-
children: _jsx(_Table.Summary.Row, {
|
|
287
|
-
children: columns === null || columns === void 0 ? void 0 : columns.map(function (_ref8) {
|
|
288
|
-
var key = _ref8.key,
|
|
289
|
-
index = _ref8.index,
|
|
290
|
-
colSpan = _ref8.colSpan,
|
|
291
|
-
prefix = _ref8.prefix,
|
|
292
|
-
suffix = _ref8.suffix,
|
|
293
|
-
title = _ref8.title,
|
|
294
|
-
precision = _ref8.precision,
|
|
295
|
-
valueType = _ref8.valueType;
|
|
296
|
-
var text = null;
|
|
297
|
-
if (title) {
|
|
298
|
-
text = title;
|
|
299
|
-
} else if (total && key) {
|
|
300
|
-
var _dataSource$reduce;
|
|
301
|
-
var format = valueTypeRender === null || valueTypeRender === void 0 ? void 0 : valueTypeRender[valueType];
|
|
302
|
-
var sum = _dataSource === null || _dataSource === void 0 ? void 0 : (_dataSource$reduce = _dataSource.reduce) === null || _dataSource$reduce === void 0 ? void 0 : _dataSource$reduce.call(_dataSource, function (pre, cur) {
|
|
303
|
-
var _get;
|
|
304
|
-
return tools.calc(pre, '+', (_get = get(cur, key)) !== null && _get !== void 0 ? _get : 0);
|
|
305
|
-
}, 0);
|
|
306
|
-
text = format ? format(sum, precision !== null && precision !== void 0 ? precision : 2) : sum;
|
|
307
|
-
}
|
|
308
|
-
var _key = key;
|
|
309
|
-
return _jsxs(_Table.Summary.Cell, {
|
|
310
|
-
index: index,
|
|
311
|
-
colSpan: colSpan,
|
|
312
|
-
children: [prefix, text, suffix]
|
|
313
|
-
}, _key);
|
|
314
|
-
})
|
|
315
|
-
})
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
264
|
var cls = classnames(_defineProperty({
|
|
319
265
|
'pro-table': true,
|
|
320
266
|
'pro-table-no-stripe': !stripe,
|
|
@@ -354,7 +300,7 @@ function ProTable(props) {
|
|
|
354
300
|
return _rowSelection;
|
|
355
301
|
};
|
|
356
302
|
var onDataSourceChange = /*#__PURE__*/function () {
|
|
357
|
-
var
|
|
303
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(nextDataSource) {
|
|
358
304
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
359
305
|
while (1) switch (_context2.prev = _context2.next) {
|
|
360
306
|
case 0:
|
|
@@ -370,111 +316,76 @@ function ProTable(props) {
|
|
|
370
316
|
}, _callee2);
|
|
371
317
|
}));
|
|
372
318
|
return function onDataSourceChange(_x2) {
|
|
373
|
-
return
|
|
319
|
+
return _ref6.apply(this, arguments);
|
|
374
320
|
};
|
|
375
321
|
}();
|
|
376
|
-
var
|
|
377
|
-
if (
|
|
378
|
-
return
|
|
379
|
-
body: {
|
|
380
|
-
row: Row
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
if (resizeColumn) {
|
|
385
|
-
return TableResizable.components;
|
|
322
|
+
var _rowClassName = function _rowClassName(record, index) {
|
|
323
|
+
if (originalDataSource && !originalObj.hasOwnProperty(get(record, 'rowKey'))) {
|
|
324
|
+
return 'new-cell';
|
|
386
325
|
}
|
|
387
|
-
return null;
|
|
388
326
|
};
|
|
327
|
+
var TableComponent = draggable ? DraggableTable : BaseTable;
|
|
389
328
|
return _jsx(TableContext.Provider, {
|
|
390
329
|
value: {
|
|
391
330
|
pathKey: pathKey,
|
|
392
331
|
tableConfig: tableConfig,
|
|
393
332
|
Storage: Storage
|
|
394
333
|
},
|
|
395
|
-
children:
|
|
334
|
+
children: _jsxs("div", {
|
|
396
335
|
className: cls,
|
|
397
|
-
children:
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
mode: "list",
|
|
422
|
-
draggable: true,
|
|
423
|
-
dataSource: customColumns,
|
|
424
|
-
value: checkColumns,
|
|
425
|
-
allValue: "all",
|
|
426
|
-
onChange: handleColumnConfig,
|
|
427
|
-
trigger: _jsx(_Button, {
|
|
428
|
-
className: "custom-column-btn",
|
|
429
|
-
icon: _jsx(ReactSVG, {
|
|
430
|
-
className: "anticon",
|
|
431
|
-
wrapper: "span",
|
|
432
|
-
src: customColumnSvg
|
|
433
|
-
}),
|
|
434
|
-
children: locale === null || locale === void 0 ? void 0 : (_locale$ProTable4 = locale.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.customColumns
|
|
435
|
-
})
|
|
436
|
-
})]
|
|
437
|
-
})]
|
|
438
|
-
}), _jsxs("div", {
|
|
439
|
-
className: "pro-table-container",
|
|
440
|
-
children: [_jsx(_Table, _objectSpread(_objectSpread({
|
|
441
|
-
className: draggable ? 'pro-edit-table-drag' : '',
|
|
442
|
-
// components={resizeColumn ? TableResizable.components : undefined}
|
|
443
|
-
components: renderComponents(),
|
|
444
|
-
// @ts-ignore
|
|
336
|
+
children: [_jsx(RenderTableHeader, {
|
|
337
|
+
dataSource: {
|
|
338
|
+
headerRender: headerRender,
|
|
339
|
+
columnConfig: columnConfig,
|
|
340
|
+
resizeColumn: resizeColumn,
|
|
341
|
+
resetSvg: resetSvg,
|
|
342
|
+
resetColumnWidth: resetColumnWidth,
|
|
343
|
+
locale: locale,
|
|
344
|
+
customColumns: customColumns,
|
|
345
|
+
checkColumns: checkColumns,
|
|
346
|
+
handleColumnConfig: handleColumnConfig,
|
|
347
|
+
customColumnSvg: customColumnSvg
|
|
348
|
+
}
|
|
349
|
+
}), _jsxs("div", {
|
|
350
|
+
className: "pro-table-container",
|
|
351
|
+
children: [_jsx(TableComponent, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
352
|
+
draggableProps: {
|
|
353
|
+
onChange: onDataSourceChange,
|
|
354
|
+
draggable: draggable,
|
|
355
|
+
rowKey: rowKey
|
|
356
|
+
},
|
|
357
|
+
tableProps: {
|
|
358
|
+
value: _dataSource,
|
|
359
|
+
headerRender: headerRender,
|
|
445
360
|
columns: columns,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
className: "pro-table-footer ".concat(pagination && !!(_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.length) ? 'has-page' : 'no-page'),
|
|
475
|
-
children: typeof footerRender === 'function' ? footerRender() : footerRender
|
|
476
|
-
}) : null]
|
|
477
|
-
})
|
|
361
|
+
renderRowSelection: renderRowSelection,
|
|
362
|
+
rowClassName: _rowClassName,
|
|
363
|
+
disabled: disabled,
|
|
364
|
+
resizeColumn: resizeColumn
|
|
365
|
+
},
|
|
366
|
+
emptyTextProps: {
|
|
367
|
+
empty: empty,
|
|
368
|
+
locale: locale,
|
|
369
|
+
emptyText: emptyText
|
|
370
|
+
},
|
|
371
|
+
summaryProps: {
|
|
372
|
+
summary: summary,
|
|
373
|
+
dataSource: _dataSource
|
|
374
|
+
},
|
|
375
|
+
dataSource: _dataSource
|
|
376
|
+
})), _jsx("span", {
|
|
377
|
+
className: "pro-table-resizable-line",
|
|
378
|
+
style: {
|
|
379
|
+
display: 'none'
|
|
380
|
+
}
|
|
381
|
+
})]
|
|
382
|
+
}), _jsx(RenderFooter, {
|
|
383
|
+
dataSource: {
|
|
384
|
+
footerRender: footerRender,
|
|
385
|
+
pagination: pagination,
|
|
386
|
+
_dataSource: _dataSource
|
|
387
|
+
}
|
|
388
|
+
})]
|
|
478
389
|
})
|
|
479
390
|
});
|
|
480
391
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取小数点后的位数
|
|
3
|
+
* @param num 数字
|
|
4
|
+
* @returns 位数
|
|
5
|
+
*/
|
|
6
|
+
export declare const getDecimalDigits: (num?: number) => number;
|
|
7
|
+
/**
|
|
8
|
+
* @description: 获取初始值
|
|
9
|
+
* @author: xiangchengli
|
|
10
|
+
* @param {any} rowKey
|
|
11
|
+
* @param any value
|
|
12
|
+
* @param any originalObj
|
|
13
|
+
* @param {any} dataIndex
|
|
14
|
+
* @return {any}
|
|
15
|
+
*/
|
|
16
|
+
export declare const getOriginalValue: (value: any, record: any, originalObj: any, rowKey: any, dataIndex: any) => any;
|
|
17
|
+
export declare const getColumnDataIndex: (dataIndex: string | string[]) => string;
|
|
18
|
+
/**
|
|
19
|
+
* 判断数据是否为Response<List<any>>结构
|
|
20
|
+
* @param data { [key: string]: any } 需要判断数据
|
|
21
|
+
* @returns boolean 是否
|
|
22
|
+
*/
|
|
23
|
+
export declare const isListResult: (data: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}) => boolean;
|
|
26
|
+
export declare const getRowKey: (rowKey: any, record: any) => any;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { get, isEqual } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* 获取小数点后的位数
|
|
4
|
+
* @param num 数字
|
|
5
|
+
* @returns 位数
|
|
6
|
+
*/
|
|
7
|
+
export var getDecimalDigits = function getDecimalDigits() {
|
|
8
|
+
var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
9
|
+
var match = Number(num).toString().match(/\.(\d+)/);
|
|
10
|
+
return match ? match[1].length : 0;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @description: 获取初始值
|
|
14
|
+
* @author: xiangchengli
|
|
15
|
+
* @param {any} rowKey
|
|
16
|
+
* @param any value
|
|
17
|
+
* @param any originalObj
|
|
18
|
+
* @param {any} dataIndex
|
|
19
|
+
* @return {any}
|
|
20
|
+
*/
|
|
21
|
+
export var getOriginalValue = function getOriginalValue(value, record, originalObj, rowKey, dataIndex) {
|
|
22
|
+
if (!originalObj) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
var originalRecord = get(originalObj, get(record, rowKey));
|
|
26
|
+
var originalValue = get(originalRecord, dataIndex);
|
|
27
|
+
if (!isEqual(originalValue, value)) {
|
|
28
|
+
return originalValue;
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
export var getColumnDataIndex = function getColumnDataIndex(dataIndex) {
|
|
33
|
+
return typeof dataIndex === 'string' ? dataIndex : dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.join('-');
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 判断数据是否为Response<List<any>>结构
|
|
37
|
+
* @param data { [key: string]: any } 需要判断数据
|
|
38
|
+
* @returns boolean 是否
|
|
39
|
+
*/
|
|
40
|
+
export var isListResult = function isListResult(data) {
|
|
41
|
+
return data.hasOwnProperty('total') && data.hasOwnProperty('list');
|
|
42
|
+
};
|
|
43
|
+
export var getRowKey = function getRowKey(rowKey, record) {
|
|
44
|
+
// 默认取id
|
|
45
|
+
var key = record.rowKey || 'id';
|
|
46
|
+
if (rowKey) {
|
|
47
|
+
var _ref;
|
|
48
|
+
key = (_ref = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref !== void 0 ? _ref : key;
|
|
49
|
+
}
|
|
50
|
+
return key;
|
|
51
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ProTableColumn } from '
|
|
2
|
+
import { ProTableColumn } from '../../propsType';
|
|
3
3
|
export declare const formatColumn: (column: ProTableColumn, originalObj: any, dataSourceObj: any, rowKey: any) => void;
|
|
4
|
-
export declare const getColumnDataIndex: (dataIndex: string | string[]) => string;
|
|
5
4
|
/**
|
|
6
5
|
* 查找最近的父级className
|
|
7
6
|
* @param element 当前node节点
|
|
@@ -10,12 +9,3 @@ export declare const getColumnDataIndex: (dataIndex: string | string[]) => strin
|
|
|
10
9
|
* @returns ReactNode 父级element
|
|
11
10
|
*/
|
|
12
11
|
export declare const getParentElement: (element: any, name: any, type?: string) => React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* 判断数据是否为Response<List<any>>结构
|
|
15
|
-
* @param data { [key: string]: any } 需要判断数据
|
|
16
|
-
* @returns boolean 是否
|
|
17
|
-
*/
|
|
18
|
-
export declare const isListResult: (data: {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}) => boolean;
|
|
21
|
-
export declare const getRowKey: (rowKey: any, record: any) => any;
|