@hw-component/table 1.1.6 → 1.1.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/.eslintcache +1 -1
- package/es/HTableBody/Options/Content.d.ts +1 -1
- package/es/HTableBody/Options/Content.js +11 -25
- package/es/HTableBody/Options/Title.d.ts +1 -1
- package/es/HTableBody/Options/Title.js +25 -32
- package/es/HTableBody/Options/hooks.d.ts +2 -0
- package/es/HTableBody/Options/hooks.js +32 -0
- package/es/HTableBody/Options/index.d.ts +1 -1
- package/es/HTableBody/Options/index.js +14 -27
- package/es/HTableBody/Options/utils.d.ts +2 -7
- package/es/HTableBody/Options/utils.js +2 -57
- package/es/HTableBody/hooks.d.ts +13 -1
- package/es/HTableBody/hooks.js +52 -8
- package/es/HTableBody/index.d.ts +1 -1
- package/es/HTableBody/index.js +20 -6
- package/es/HTableBody/utils.d.ts +7 -0
- package/es/HTableBody/utils.js +99 -0
- package/es/hooks/useHTable.js +3 -1
- package/es/index.css +3 -0
- package/es/modal.d.ts +5 -4
- package/lib/HTableBody/Options/Content.d.ts +1 -1
- package/lib/HTableBody/Options/Content.js +11 -25
- package/lib/HTableBody/Options/Title.d.ts +1 -1
- package/lib/HTableBody/Options/Title.js +25 -32
- package/lib/HTableBody/Options/hooks.d.ts +2 -0
- package/lib/HTableBody/Options/hooks.js +33 -0
- package/lib/HTableBody/Options/index.d.ts +1 -1
- package/lib/HTableBody/Options/index.js +13 -26
- package/lib/HTableBody/Options/utils.d.ts +2 -7
- package/lib/HTableBody/Options/utils.js +1 -57
- package/lib/HTableBody/hooks.d.ts +13 -1
- package/lib/HTableBody/hooks.js +51 -6
- package/lib/HTableBody/index.d.ts +1 -1
- package/lib/HTableBody/index.js +19 -5
- package/lib/HTableBody/utils.d.ts +7 -0
- package/lib/HTableBody/utils.js +101 -0
- package/lib/hooks/useHTable.js +3 -1
- package/lib/index.css +3 -0
- package/lib/modal.d.ts +5 -4
- package/package.json +1 -1
- package/src/components/HTableBody/Options/Content.tsx +14 -18
- package/src/components/HTableBody/Options/Title.tsx +23 -22
- package/src/components/HTableBody/Options/hooks.ts +21 -0
- package/src/components/HTableBody/Options/index.tsx +8 -16
- package/src/components/HTableBody/Options/modal.d.ts +8 -2
- package/src/components/HTableBody/Options/utils.ts +2 -55
- package/src/components/HTableBody/hooks.tsx +47 -6
- package/src/components/HTableBody/index.tsx +13 -5
- package/src/components/HTableBody/utils.ts +91 -0
- package/src/components/Table.tsx +1 -0
- package/src/components/hooks/useHTable.tsx +3 -1
- package/src/components/index.less +3 -0
- package/src/components/modal.ts +5 -4
- package/src/pages/Table/index.tsx +10 -6
- package/src/pages/TableCustomize/index.tsx +12 -3
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
-
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
-
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
-
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
-
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
7
|
-
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
8
|
-
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
9
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
-
import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
|
|
11
2
|
import 'core-js/modules/es.object.to-string.js';
|
|
12
3
|
import 'core-js/modules/es.regexp.to-string.js';
|
|
13
4
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
@@ -18,11 +9,9 @@ import { useMemo } from 'react';
|
|
|
18
9
|
import { Tree } from 'antd';
|
|
19
10
|
import { getItemValue } from './utils.js';
|
|
20
11
|
|
|
21
|
-
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
12
|
var ColsSettingContent = function ColsSettingContent(_ref) {
|
|
24
13
|
var columns = _ref.columns,
|
|
25
|
-
|
|
14
|
+
onCheck = _ref.onCheck,
|
|
26
15
|
checkKeys = _ref.checkKeys;
|
|
27
16
|
var content = useClassName("hw-table-body-option-setting-content");
|
|
28
17
|
var titleClass = useClassName("hw-table-body-option-setting-content-title");
|
|
@@ -50,20 +39,17 @@ var ColsSettingContent = function ColsSettingContent(_ref) {
|
|
|
50
39
|
});
|
|
51
40
|
return treeData;
|
|
52
41
|
}, [columns]);
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
_forEachInstanceProperty(
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
var check = function check(keys) {
|
|
43
|
+
var notCheck = [];
|
|
44
|
+
_forEachInstanceProperty(contentTreeData).call(contentTreeData, function (_ref3) {
|
|
45
|
+
var key = _ref3.key;
|
|
46
|
+
var cuKey = key;
|
|
47
|
+
var index = _indexOfInstanceProperty(keys).call(keys, cuKey);
|
|
48
|
+
if (index === -1) {
|
|
49
|
+
notCheck.push(cuKey);
|
|
59
50
|
}
|
|
60
|
-
var strDataIndex = dataIndex.toString();
|
|
61
|
-
var item = newCols[index];
|
|
62
|
-
newCols[index] = _objectSpread(_objectSpread({}, item), {}, {
|
|
63
|
-
hideInTable: _indexOfInstanceProperty(key).call(key, strDataIndex) == -1
|
|
64
|
-
});
|
|
65
51
|
});
|
|
66
|
-
|
|
52
|
+
onCheck(keys, notCheck);
|
|
67
53
|
};
|
|
68
54
|
return jsx("div", {
|
|
69
55
|
className: content,
|
|
@@ -77,7 +63,7 @@ var ColsSettingContent = function ColsSettingContent(_ref) {
|
|
|
77
63
|
className: treeClass,
|
|
78
64
|
checkedKeys: checkKeys,
|
|
79
65
|
onCheck: function onCheck(key) {
|
|
80
|
-
|
|
66
|
+
check(key);
|
|
81
67
|
},
|
|
82
68
|
height: 268,
|
|
83
69
|
treeData: contentTreeData
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ItemProps } from "./modal";
|
|
2
|
-
export declare const Title: ({ columns,
|
|
2
|
+
export declare const Title: ({ columns, onCheck, checkKeys, reset }: ItemProps) => JSX.Element;
|
|
@@ -1,50 +1,39 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
2
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
3
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
|
5
4
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
6
|
-
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
7
|
-
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
8
|
-
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
9
|
-
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
10
|
-
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
11
|
-
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
12
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
6
|
import { useClassName } from '../../hooks/index.js';
|
|
14
7
|
import { Typography, Row, Space, Checkbox } from 'antd';
|
|
15
8
|
import { useMemo } from 'react';
|
|
16
9
|
|
|
17
|
-
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
10
|
var Link = Typography.Link;
|
|
20
11
|
var Title = function Title(_ref) {
|
|
21
12
|
var columns = _ref.columns,
|
|
22
|
-
|
|
23
|
-
checkKeys = _ref.checkKeys
|
|
13
|
+
onCheck = _ref.onCheck,
|
|
14
|
+
checkKeys = _ref.checkKeys,
|
|
15
|
+
reset = _ref.reset;
|
|
24
16
|
var title = useClassName("hw-table-body-option-setting-title");
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [columns]);
|
|
32
|
-
var allChange = function allChange(hideInTable) {
|
|
33
|
-
var newCols = _toConsumableArray(columns);
|
|
34
|
-
_forEachInstanceProperty(columns).call(columns, function (item, index) {
|
|
35
|
-
var dataIndex = item.dataIndex;
|
|
36
|
-
if (!dataIndex) {
|
|
17
|
+
var relArrayKeys = useMemo(function () {
|
|
18
|
+
var keys = [];
|
|
19
|
+
_forEachInstanceProperty(columns).call(columns, function (value) {
|
|
20
|
+
var dataIndex = value.dataIndex,
|
|
21
|
+
hideInTable = value.hideInTable;
|
|
22
|
+
if (hideInTable || !dataIndex) {
|
|
37
23
|
return;
|
|
38
24
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
25
|
+
var dataIndexStr = dataIndex.toString();
|
|
26
|
+
keys.push(dataIndexStr);
|
|
42
27
|
});
|
|
43
|
-
|
|
28
|
+
return keys;
|
|
29
|
+
}, [columns]);
|
|
30
|
+
var allCheck = function allCheck() {
|
|
31
|
+
onCheck(relArrayKeys, []);
|
|
44
32
|
};
|
|
45
|
-
var
|
|
46
|
-
|
|
33
|
+
var allNotCheck = function allNotCheck() {
|
|
34
|
+
onCheck([], relArrayKeys);
|
|
47
35
|
};
|
|
36
|
+
var relLen = relArrayKeys.length;
|
|
48
37
|
var indeterminate = relLen !== checkKeys.length && checkKeys.length > 0;
|
|
49
38
|
return jsxs(Row, {
|
|
50
39
|
className: title,
|
|
@@ -55,7 +44,11 @@ var Title = function Title(_ref) {
|
|
|
55
44
|
checked: relLen === checkKeys.length,
|
|
56
45
|
indeterminate: indeterminate,
|
|
57
46
|
onChange: function onChange(e) {
|
|
58
|
-
|
|
47
|
+
if (e.target.checked) {
|
|
48
|
+
allCheck();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
allNotCheck();
|
|
59
52
|
}
|
|
60
53
|
}), jsx("span", {
|
|
61
54
|
children: "\u5217\u5C55\u793A"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
3
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
|
4
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
var useCheckKeys = function useCheckKeys(_ref) {
|
|
8
|
+
var columns = _ref.columns,
|
|
9
|
+
colStatusValue = _ref.colStatusValue;
|
|
10
|
+
return useMemo(function () {
|
|
11
|
+
var keys = [];
|
|
12
|
+
_forEachInstanceProperty(columns).call(columns, function (value) {
|
|
13
|
+
var dataIndex = value.dataIndex,
|
|
14
|
+
hideInTable = value.hideInTable;
|
|
15
|
+
if (hideInTable || !dataIndex) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
var dataIndexStr = dataIndex.toString();
|
|
19
|
+
var _ref2 = colStatusValue[dataIndexStr] || {},
|
|
20
|
+
_ref2$show = _ref2.show,
|
|
21
|
+
show = _ref2$show === void 0 ? true : _ref2$show;
|
|
22
|
+
if (!show) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
keys.push(dataIndexStr);
|
|
26
|
+
});
|
|
27
|
+
return keys;
|
|
28
|
+
}, [colStatusValue, columns]);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { useCheckKeys };
|
|
32
|
+
// powered by hdj
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IProps } from "./modal";
|
|
2
|
-
declare const _default: ({ reload, size, density, setSizeChange, columns, onChange, }: IProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ reload, size, density, setSizeChange, columns, onChange, colStatusValue, reset }: IProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
|
-
import _keysInstanceProperty from '@babel/runtime-corejs3/core-js/instance/keys';
|
|
4
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
3
|
import { useClassName } from '../../hooks/index.js';
|
|
6
4
|
import { Row, Space, Tooltip, Dropdown, Popover, Menu } from 'antd';
|
|
7
5
|
import { ReloadOutlined, ColumnHeightOutlined, SettingOutlined } from '@ant-design/icons';
|
|
8
|
-
import { useRef
|
|
6
|
+
import { useRef } from 'react';
|
|
9
7
|
import { ColsSettingContent } from './Content.js';
|
|
10
8
|
import { Title } from './Title.js';
|
|
11
|
-
import {
|
|
12
|
-
import { defaultKeys } from './utils.js';
|
|
9
|
+
import { useCheckKeys } from './hooks.js';
|
|
13
10
|
|
|
14
11
|
var Options = (function (_ref) {
|
|
15
12
|
var reload = _ref.reload,
|
|
@@ -19,26 +16,15 @@ var Options = (function (_ref) {
|
|
|
19
16
|
density = _ref$density === void 0 ? true : _ref$density,
|
|
20
17
|
setSizeChange = _ref.setSizeChange,
|
|
21
18
|
columns = _ref.columns,
|
|
22
|
-
onChange = _ref.onChange
|
|
19
|
+
onChange = _ref.onChange,
|
|
20
|
+
colStatusValue = _ref.colStatusValue,
|
|
21
|
+
reset = _ref.reset;
|
|
23
22
|
var pointer = useClassName(["hw-table-pointer", "hw-table-body-option-icon"]);
|
|
24
23
|
var ref = useRef(null);
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var _useHTableContext = useHTableContext(),
|
|
30
|
-
tableInstance = _useHTableContext.tableInstance;
|
|
31
|
-
useEffect(function () {
|
|
32
|
-
var _defaultKeys = defaultKeys(columns),
|
|
33
|
-
changeKeys = _keysInstanceProperty(_defaultKeys),
|
|
34
|
-
allKeys = _defaultKeys.allKeys,
|
|
35
|
-
checkCols = _defaultKeys.checkCols;
|
|
36
|
-
tableInstance.table.settingKeys = {
|
|
37
|
-
keys: allKeys,
|
|
38
|
-
checkCols: checkCols
|
|
39
|
-
};
|
|
40
|
-
setKeys(changeKeys);
|
|
41
|
-
}, [columns]);
|
|
24
|
+
var checkKeys = useCheckKeys({
|
|
25
|
+
columns: columns,
|
|
26
|
+
colStatusValue: colStatusValue
|
|
27
|
+
});
|
|
42
28
|
var SizeItem = function SizeItem() {
|
|
43
29
|
var MenuComponent = Menu;
|
|
44
30
|
var MenuItem = Menu.Item;
|
|
@@ -99,13 +85,14 @@ var Options = (function (_ref) {
|
|
|
99
85
|
children: jsx(Popover, {
|
|
100
86
|
content: jsx(ColsSettingContent, {
|
|
101
87
|
columns: columns,
|
|
102
|
-
checkKeys:
|
|
103
|
-
|
|
88
|
+
checkKeys: checkKeys,
|
|
89
|
+
onCheck: onChange
|
|
104
90
|
}),
|
|
105
91
|
title: jsx(Title, {
|
|
106
92
|
columns: columns,
|
|
107
|
-
|
|
108
|
-
|
|
93
|
+
reset: reset,
|
|
94
|
+
checkKeys: checkKeys,
|
|
95
|
+
onCheck: onChange
|
|
109
96
|
}),
|
|
110
97
|
placement: "bottomLeft",
|
|
111
98
|
getPopupContainer: function getPopupContainer() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConfigItemModal } from "../../modal";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare const getItemValue: (data: ConfigItemModal) => {
|
|
4
4
|
name?: string | undefined;
|
|
@@ -1124,12 +1124,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
1124
1124
|
onChange?: ((color: string) => void) | undefined;
|
|
1125
1125
|
colors?: string[] | undefined;
|
|
1126
1126
|
}))) | undefined;
|
|
1127
|
-
childrenDataIndex?:
|
|
1127
|
+
childrenDataIndex?: string[] | ConfigItemModal[] | undefined;
|
|
1128
1128
|
title: any;
|
|
1129
1129
|
dataIndex: ((string | number | (string | number)[]) & import("rc-table/lib/interface").DataIndex) | undefined;
|
|
1130
1130
|
};
|
|
1131
|
-
export declare const defaultKeys: (cols: ConfigDataModal) => {
|
|
1132
|
-
keys: string[];
|
|
1133
|
-
allKeys: string[];
|
|
1134
|
-
checkCols: ConfigDataModal;
|
|
1135
|
-
};
|
|
@@ -3,16 +3,12 @@ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
|
3
3
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
4
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
5
|
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
6
7
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
7
8
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
8
9
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
9
|
-
import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
|
|
10
10
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
-
import 'core-js/modules/es.object.to-string.js';
|
|
13
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
|
14
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
15
|
-
import _keysInstanceProperty from '@babel/runtime-corejs3/core-js/instance/keys';
|
|
16
12
|
import React from 'react';
|
|
17
13
|
|
|
18
14
|
var _excluded = ["dataIndex", "title", "titleStr"];
|
|
@@ -32,57 +28,6 @@ var getItemValue = function getItemValue(data) {
|
|
|
32
28
|
dataIndex: dataIndex
|
|
33
29
|
}, oData);
|
|
34
30
|
};
|
|
35
|
-
var childDataIndexProvider = function childDataIndexProvider(data, title) {
|
|
36
|
-
var keys = [];
|
|
37
|
-
var cols = [];
|
|
38
|
-
_forEachInstanceProperty(data).call(data, function (value) {
|
|
39
|
-
if (typeof value === "string") {
|
|
40
|
-
keys.push(value);
|
|
41
|
-
cols.push(getItemValue({
|
|
42
|
-
title: title,
|
|
43
|
-
dataIndex: value
|
|
44
|
-
}));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
keys.push(value.dataIndex);
|
|
48
|
-
cols.push(getItemValue(value));
|
|
49
|
-
});
|
|
50
|
-
return {
|
|
51
|
-
keys: keys,
|
|
52
|
-
cols: cols
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
var defaultKeys = function defaultKeys(cols) {
|
|
56
|
-
var keys = [];
|
|
57
|
-
var allKeys = [];
|
|
58
|
-
var checkCols = [];
|
|
59
|
-
_forEachInstanceProperty(cols).call(cols, function (value) {
|
|
60
|
-
var title = value.title,
|
|
61
|
-
titleStr = value.titleStr,
|
|
62
|
-
dataIndex = value.dataIndex,
|
|
63
|
-
hideInTable = value.hideInTable,
|
|
64
|
-
childrenDataIndex = value.childrenDataIndex;
|
|
65
|
-
if (hideInTable || !dataIndex) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
keys.push(dataIndex.toString());
|
|
69
|
-
if (childrenDataIndex) {
|
|
70
|
-
var _childDataIndexProvid = childDataIndexProvider(childrenDataIndex, titleStr || title),
|
|
71
|
-
childKeys = _keysInstanceProperty(_childDataIndexProvid),
|
|
72
|
-
childCols = _childDataIndexProvid.cols;
|
|
73
|
-
allKeys.push.apply(allKeys, _toConsumableArray(childKeys));
|
|
74
|
-
checkCols.push.apply(checkCols, _toConsumableArray(childCols));
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
allKeys.push(dataIndex.toString());
|
|
78
|
-
checkCols.push(getItemValue(value));
|
|
79
|
-
});
|
|
80
|
-
return {
|
|
81
|
-
keys: keys,
|
|
82
|
-
allKeys: allKeys,
|
|
83
|
-
checkCols: checkCols
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
31
|
|
|
87
|
-
export {
|
|
32
|
+
export { getItemValue };
|
|
88
33
|
// powered by hdj
|
package/es/HTableBody/hooks.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import type { HTableProps, ConfigDataModal } from "../modal";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { GetRowKey } from "rc-table/lib/interface";
|
|
4
4
|
import type { SizeType } from "antd/lib/config-provider/SizeContext";
|
|
5
|
+
import { ColumnsStateType } from "@ant-design/pro-table/es/typing";
|
|
6
|
+
import { ColumnsState } from "@ant-design/pro-table/es/container";
|
|
5
7
|
export declare const useCols: ({ configData, rowSelection, table }: HTableProps) => {
|
|
6
8
|
cols: ConfigDataModal;
|
|
7
|
-
changeCols: (cuCols: ConfigDataModal) => void;
|
|
8
9
|
};
|
|
9
10
|
interface FilterKeysModal {
|
|
10
11
|
selectedRowKeys?: React.Key[];
|
|
@@ -16,4 +17,15 @@ export declare const useSize: (size: SizeType) => {
|
|
|
16
17
|
cuSize: "small" | "middle" | "large" | undefined;
|
|
17
18
|
setCuSize: React.Dispatch<React.SetStateAction<"small" | "middle" | "large" | undefined>>;
|
|
18
19
|
};
|
|
20
|
+
interface useColumnsStateTypeModal {
|
|
21
|
+
columnsState?: ColumnsStateType;
|
|
22
|
+
columns: ConfigDataModal;
|
|
23
|
+
}
|
|
24
|
+
export declare const useColumnsStateType: ({ columnsState, columns }: useColumnsStateTypeModal) => {
|
|
25
|
+
persistenceType: "localStorage" | "sessionStorage" | undefined;
|
|
26
|
+
persistenceKey: string | undefined;
|
|
27
|
+
value: Record<string, ColumnsState> | undefined;
|
|
28
|
+
onChange: (keys: string[], notCheck: string[]) => void;
|
|
29
|
+
reset: () => void;
|
|
30
|
+
};
|
|
19
31
|
export {};
|
package/es/HTableBody/hooks.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
3
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
4
|
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
5
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
6
5
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
7
6
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
8
7
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
@@ -12,10 +11,12 @@ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/fil
|
|
|
12
11
|
import _spliceInstanceProperty from '@babel/runtime-corejs3/core-js/instance/splice';
|
|
13
12
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
14
13
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/index-of';
|
|
14
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
15
15
|
import { jsx } from 'react/jsx-runtime';
|
|
16
|
-
import { useState, useEffect } from 'react';
|
|
16
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
17
17
|
import { useHTableContext } from '../context.js';
|
|
18
18
|
import { RowSelectionTitle, RowSelectionBox } from './RowSelection.js';
|
|
19
|
+
import { outColSetting, mkChangeValue } from './utils.js';
|
|
19
20
|
|
|
20
21
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -72,12 +73,8 @@ var useCols = function useCols(_ref2) {
|
|
|
72
73
|
useEffect(function () {
|
|
73
74
|
setCols(changeConfigData(configData));
|
|
74
75
|
}, [configData, table, rowSelection]);
|
|
75
|
-
var changeCols = function changeCols(cuCols) {
|
|
76
|
-
setCols(cuCols);
|
|
77
|
-
};
|
|
78
76
|
return {
|
|
79
|
-
cols: cols
|
|
80
|
-
changeCols: changeCols
|
|
77
|
+
cols: cols
|
|
81
78
|
};
|
|
82
79
|
};
|
|
83
80
|
var useSynchronousKeys = function useSynchronousKeys(_ref3) {
|
|
@@ -109,6 +106,53 @@ var useSize = function useSize(size) {
|
|
|
109
106
|
setCuSize: setCuSize
|
|
110
107
|
};
|
|
111
108
|
};
|
|
109
|
+
var useColumnsStateType = function useColumnsStateType(_ref4) {
|
|
110
|
+
var columnsState = _ref4.columnsState,
|
|
111
|
+
columns = _ref4.columns;
|
|
112
|
+
var _useHTableContext2 = useHTableContext(),
|
|
113
|
+
tableInstance = _useHTableContext2.tableInstance;
|
|
114
|
+
var _ref5 = columnsState || {},
|
|
115
|
+
persistenceType = _ref5.persistenceType,
|
|
116
|
+
persistenceKey = _ref5.persistenceKey,
|
|
117
|
+
value = _ref5.value,
|
|
118
|
+
defaultValue = _ref5.defaultValue,
|
|
119
|
+
onChange = _ref5.onChange;
|
|
120
|
+
var _useState5 = useState(defaultValue),
|
|
121
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
122
|
+
selfValue = _useState6[0],
|
|
123
|
+
setSelfValue = _useState6[1];
|
|
124
|
+
var initTableColsVal = useMemo(function () {
|
|
125
|
+
return selfValue;
|
|
126
|
+
}, []);
|
|
127
|
+
useEffect(function () {
|
|
128
|
+
tableInstance.table.getColSettingKeys = function () {
|
|
129
|
+
return outColSetting(columns, selfValue);
|
|
130
|
+
};
|
|
131
|
+
}, [selfValue]);
|
|
132
|
+
useEffect(function () {
|
|
133
|
+
setSelfValue(mkChangeValue(columnsState));
|
|
134
|
+
}, [value]);
|
|
135
|
+
var change = function change(keys, notCheck) {
|
|
136
|
+
var newObj = {};
|
|
137
|
+
_forEachInstanceProperty(notCheck).call(notCheck, function (key) {
|
|
138
|
+
newObj[key] = {
|
|
139
|
+
show: false
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
setSelfValue(newObj);
|
|
143
|
+
onChange === null || onChange === void 0 || onChange(newObj);
|
|
144
|
+
};
|
|
145
|
+
var reset = function reset() {
|
|
146
|
+
setSelfValue(initTableColsVal);
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
persistenceType: persistenceType,
|
|
150
|
+
persistenceKey: persistenceKey,
|
|
151
|
+
value: selfValue,
|
|
152
|
+
onChange: change,
|
|
153
|
+
reset: reset
|
|
154
|
+
};
|
|
155
|
+
};
|
|
112
156
|
|
|
113
|
-
export { useCols, useSize, useSynchronousKeys };
|
|
157
|
+
export { useCols, useColumnsStateType, useSize, useSynchronousKeys };
|
|
114
158
|
// powered by hdj
|
package/es/HTableBody/index.d.ts
CHANGED
|
@@ -17,5 +17,5 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
17
17
|
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
18
18
|
localSorter?: boolean;
|
|
19
19
|
}
|
|
20
|
-
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, paginationActionRender, localSorter, ...props }: HTableBodyProps) => JSX.Element;
|
|
20
|
+
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, paginationActionRender, localSorter, columnsState, ...props }: HTableBodyProps) => JSX.Element;
|
|
21
21
|
export default _default;
|
package/es/HTableBody/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
12
12
|
import _keysInstanceProperty from '@babel/runtime-corejs3/core-js/instance/keys';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
import ProTable from '@ant-design/pro-table';
|
|
15
|
-
import { useSize, useCols, useSynchronousKeys } from './hooks.js';
|
|
15
|
+
import { useSize, useCols, useColumnsStateType, useSynchronousKeys } from './hooks.js';
|
|
16
16
|
import { useHTableContext } from '../context.js';
|
|
17
17
|
import { Alert, ConfigProvider, Empty } from 'antd';
|
|
18
18
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
@@ -22,7 +22,8 @@ import AlertMsg from './AlertMsg.js';
|
|
|
22
22
|
import Options from './Options/index.js';
|
|
23
23
|
import HeaderTitle from './HeaderTitle/index.js';
|
|
24
24
|
|
|
25
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter"]
|
|
25
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState"],
|
|
26
|
+
_excluded2 = ["value", "onChange", "reset"];
|
|
26
27
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
29
|
var defaultRender = function defaultRender() {
|
|
@@ -58,6 +59,7 @@ var Body = (function (_ref) {
|
|
|
58
59
|
optionsRender = _ref.optionsRender,
|
|
59
60
|
paginationActionRender = _ref.paginationActionRender,
|
|
60
61
|
localSorter = _ref.localSorter,
|
|
62
|
+
columnsState = _ref.columnsState,
|
|
61
63
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
62
64
|
var _ref2 = rowSelection || {},
|
|
63
65
|
selectedRowKeys = _ref2.selectedRowKeys,
|
|
@@ -90,8 +92,15 @@ var Body = (function (_ref) {
|
|
|
90
92
|
table: tableInstance,
|
|
91
93
|
rowSelection: rowSelection
|
|
92
94
|
}),
|
|
93
|
-
cols = _useCols.cols
|
|
94
|
-
|
|
95
|
+
cols = _useCols.cols;
|
|
96
|
+
var _useColumnsStateType = useColumnsStateType({
|
|
97
|
+
columnsState: columnsState,
|
|
98
|
+
columns: cols
|
|
99
|
+
}),
|
|
100
|
+
value = _useColumnsStateType.value,
|
|
101
|
+
onChange = _useColumnsStateType.onChange,
|
|
102
|
+
reset = _useColumnsStateType.reset,
|
|
103
|
+
selfColStatus = _objectWithoutProperties(_useColumnsStateType, _excluded2);
|
|
95
104
|
useSynchronousKeys({
|
|
96
105
|
selectedRowKeys: selectedRowKeys,
|
|
97
106
|
records: records,
|
|
@@ -105,7 +114,9 @@ var Body = (function (_ref) {
|
|
|
105
114
|
size: cuSize,
|
|
106
115
|
columns: cols,
|
|
107
116
|
setSizeChange: setCuSize,
|
|
108
|
-
|
|
117
|
+
colStatusValue: value || {},
|
|
118
|
+
onChange: onChange,
|
|
119
|
+
reset: reset
|
|
109
120
|
}));
|
|
110
121
|
var _selectedRowData$keys = _keysInstanceProperty(selectedRowData),
|
|
111
122
|
keys = _selectedRowData$keys === void 0 ? [] : _selectedRowData$keys,
|
|
@@ -136,6 +147,9 @@ var Body = (function (_ref) {
|
|
|
136
147
|
return tableEmptyRender === null || tableEmptyRender === void 0 ? void 0 : tableEmptyRender(tableInstance);
|
|
137
148
|
},
|
|
138
149
|
children: [jsx(ProTable, _objectSpread(_objectSpread({}, props), {}, {
|
|
150
|
+
columnsState: _objectSpread(_objectSpread({}, selfColStatus), {}, {
|
|
151
|
+
value: value
|
|
152
|
+
}),
|
|
139
153
|
columns: cols,
|
|
140
154
|
size: cuSize,
|
|
141
155
|
search: false,
|
|
@@ -153,10 +167,10 @@ var Body = (function (_ref) {
|
|
|
153
167
|
asc: asc
|
|
154
168
|
});
|
|
155
169
|
},
|
|
156
|
-
options: false,
|
|
157
170
|
tableStyle: {
|
|
158
171
|
paddingBottom: 0
|
|
159
172
|
},
|
|
173
|
+
options: false,
|
|
160
174
|
rowSelection: false,
|
|
161
175
|
loading: loading,
|
|
162
176
|
rowKey: rowKey,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ColumnsStateType } from "@ant-design/pro-table/es/typing";
|
|
2
|
+
import { ConfigDataModal } from "@/components/modal";
|
|
3
|
+
export declare const mkChangeValue: (columnsState?: ColumnsStateType) => any;
|
|
4
|
+
export declare const outColSetting: (columns: ConfigDataModal, columnsState?: ColumnsStateType) => {
|
|
5
|
+
checkCols: ConfigDataModal;
|
|
6
|
+
keys: string[];
|
|
7
|
+
};
|