@hw-component/table 1.9.91 → 1.9.92
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 +93 -85
- package/es/HTableBody/Options/ContentTree.d.ts +7 -0
- package/es/HTableBody/Options/ContentTree.js +41 -0
- package/es/HTableBody/Options/Title.d.ts +1 -1
- package/es/HTableBody/Options/hooks.d.ts +17 -0
- package/es/HTableBody/Options/hooks.js +53 -1
- package/es/HTableBody/Options/index.d.ts +1 -1
- package/es/HTableBody/Options/utils.d.ts +8 -1
- package/es/HTableBody/Options/utils.js +29 -2
- package/es/HTableBody/hooks/useColData.d.ts +2 -1
- package/es/HTableBody/hooks/useColData.js +7 -3
- package/es/HTableBody/index.js +8 -4
- package/es/index.css +4 -0
- package/lib/HTableBody/Options/Content.d.ts +1 -1
- package/lib/HTableBody/Options/Content.js +91 -83
- package/lib/HTableBody/Options/ContentTree.d.ts +7 -0
- package/lib/HTableBody/Options/ContentTree.js +44 -0
- package/lib/HTableBody/Options/Title.d.ts +1 -1
- package/lib/HTableBody/Options/hooks.d.ts +17 -0
- package/lib/HTableBody/Options/hooks.js +54 -0
- package/lib/HTableBody/Options/index.d.ts +1 -1
- package/lib/HTableBody/Options/utils.d.ts +8 -1
- package/lib/HTableBody/Options/utils.js +29 -1
- package/lib/HTableBody/hooks/useColData.d.ts +2 -1
- package/lib/HTableBody/hooks/useColData.js +7 -3
- package/lib/HTableBody/index.js +8 -4
- package/lib/index.css +4 -0
- package/package.json +1 -1
- package/src/components/HTableBody/Options/Content.tsx +81 -76
- package/src/components/HTableBody/Options/ContentTree.tsx +38 -0
- package/src/components/HTableBody/Options/Title.tsx +6 -1
- package/src/components/HTableBody/Options/hooks.tsx +79 -0
- package/src/components/HTableBody/Options/index.tsx +1 -3
- package/src/components/HTableBody/Options/modal.d.ts +2 -2
- package/src/components/HTableBody/Options/utils.ts +28 -0
- package/src/components/HTableBody/hooks/useColData.tsx +12 -7
- package/src/components/HTableBody/index.tsx +11 -7
- package/src/components/index.less +4 -0
- package/src/pages/Table/index.tsx +36 -5
- package/src/components/HTableBody/Options/hooks.ts +0 -24
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ItemProps } from "./modal";
|
|
3
|
-
export declare const Title: ({ columns, onCheck, checkKeys, reset }: Omit<ItemProps, "onDrop">) => JSX.Element;
|
|
3
|
+
export declare const Title: ({ columns, onCheck, checkKeys, reset, }: Omit<ItemProps, "onDrop">) => JSX.Element;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { IProps } from "@/components/HTableBody/Options/modal";
|
|
3
|
+
import type { ConfigDataModal } from "@/components/modal";
|
|
2
4
|
export declare const useCheckKeys: ({ columns, colStatusValue, }: Pick<IProps, "colStatusValue" | "columns">) => string[];
|
|
5
|
+
interface UseContentTreeModal {
|
|
6
|
+
columns: ConfigDataModal;
|
|
7
|
+
matchKey?: "right" | "left";
|
|
8
|
+
}
|
|
9
|
+
interface ColDataNode {
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
key: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const useContentTree: ({ columns, matchKey }: UseContentTreeModal) => ColDataNode[];
|
|
14
|
+
interface UseTreeKeysModal {
|
|
15
|
+
treeData: ColDataNode[];
|
|
16
|
+
checkKeys: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const useTreeKeys: ({ treeData, checkKeys, }: UseTreeKeysModal) => string[];
|
|
19
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
2
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
3
|
+
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
5
|
import { useMemo } from 'react';
|
|
6
|
+
import { getItemValue } from './utils.js';
|
|
7
|
+
import { useClassName } from '../../hooks/index.js';
|
|
4
8
|
|
|
5
9
|
var useCheckKeys = function useCheckKeys(_ref) {
|
|
6
10
|
var columns = _ref.columns,
|
|
@@ -25,6 +29,54 @@ var useCheckKeys = function useCheckKeys(_ref) {
|
|
|
25
29
|
return keys;
|
|
26
30
|
}, [colStatusValue, columns]);
|
|
27
31
|
};
|
|
32
|
+
var useContentTree = function useContentTree(_ref3) {
|
|
33
|
+
var columns = _ref3.columns,
|
|
34
|
+
matchKey = _ref3.matchKey;
|
|
35
|
+
var titleClass = useClassName("hw-table-body-option-setting-content-title");
|
|
36
|
+
return useMemo(function () {
|
|
37
|
+
var treeData = [];
|
|
38
|
+
_forEachInstanceProperty(columns).call(columns, function (_ref4) {
|
|
39
|
+
var dataIndex = _ref4.dataIndex,
|
|
40
|
+
title = _ref4.title,
|
|
41
|
+
titleStr = _ref4.titleStr,
|
|
42
|
+
fixed = _ref4.fixed;
|
|
43
|
+
if (!dataIndex) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (fixed !== matchKey) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var _getItemValue = getItemValue({
|
|
50
|
+
titleStr: titleStr,
|
|
51
|
+
title: title
|
|
52
|
+
}),
|
|
53
|
+
cuTitleStr = _getItemValue.title;
|
|
54
|
+
treeData.push({
|
|
55
|
+
title: jsx("div", {
|
|
56
|
+
className: titleClass,
|
|
57
|
+
children: cuTitleStr
|
|
58
|
+
}),
|
|
59
|
+
key: dataIndex.toString()
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
return treeData;
|
|
63
|
+
}, [columns]);
|
|
64
|
+
};
|
|
65
|
+
var useTreeKeys = function useTreeKeys(_ref5) {
|
|
66
|
+
var treeData = _ref5.treeData,
|
|
67
|
+
checkKeys = _ref5.checkKeys;
|
|
68
|
+
return useMemo(function () {
|
|
69
|
+
var newKeys = [];
|
|
70
|
+
_forEachInstanceProperty(treeData).call(treeData, function (_ref6) {
|
|
71
|
+
var key = _ref6.key;
|
|
72
|
+
var index = _indexOfInstanceProperty(checkKeys).call(checkKeys, key);
|
|
73
|
+
if (index !== -1) {
|
|
74
|
+
newKeys.push(key);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return newKeys;
|
|
78
|
+
}, [treeData, checkKeys]);
|
|
79
|
+
};
|
|
28
80
|
|
|
29
|
-
export { useCheckKeys };
|
|
81
|
+
export { useCheckKeys, useContentTree, useTreeKeys };
|
|
30
82
|
// powered by hdj
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IProps } from "./modal";
|
|
3
|
-
declare const _default: ({ reload, size, density, setSizeChange, columns, onChange, colStatusValue, reset, settingRender, onDrop }: IProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ reload, size, density, setSizeChange, columns, onChange, colStatusValue, reset, settingRender, onDrop, }: IProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigItemModal } from "../../modal";
|
|
1
|
+
import type { ConfigDataModal, ConfigItemModal } from "../../modal";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare const getItemValue: (data: ConfigItemModal) => {
|
|
4
4
|
name?: string | any[] | undefined;
|
|
@@ -806,3 +806,10 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
806
806
|
title: any;
|
|
807
807
|
dataIndex: ((string | number | (string | number)[]) & import("rc-table/lib/interface").DataIndex) | undefined;
|
|
808
808
|
};
|
|
809
|
+
interface MoveColProps {
|
|
810
|
+
startKey: string;
|
|
811
|
+
endKey: string;
|
|
812
|
+
data: ConfigDataModal;
|
|
813
|
+
}
|
|
814
|
+
export declare const moveCol: ({ startKey, endKey, data }: MoveColProps) => ConfigItemModal[];
|
|
815
|
+
export {};
|
|
@@ -3,12 +3,14 @@ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
|
3
3
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
4
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
5
5
|
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
6
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
7
6
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
8
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
9
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/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 _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
13
|
+
import _spliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/splice';
|
|
12
14
|
import React from 'react';
|
|
13
15
|
|
|
14
16
|
var _excluded = ["dataIndex", "title", "titleStr"];
|
|
@@ -28,6 +30,31 @@ var getItemValue = function getItemValue(data) {
|
|
|
28
30
|
dataIndex: dataIndex
|
|
29
31
|
}, oData);
|
|
30
32
|
};
|
|
33
|
+
var moveCol = function moveCol(_ref) {
|
|
34
|
+
var startKey = _ref.startKey,
|
|
35
|
+
endKey = _ref.endKey,
|
|
36
|
+
data = _ref.data;
|
|
37
|
+
var indexArray = [-1, -1];
|
|
38
|
+
_forEachInstanceProperty(data).call(data, function (item, index) {
|
|
39
|
+
var dataIndex = item.dataIndex;
|
|
40
|
+
if (!dataIndex) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (dataIndex === startKey) {
|
|
44
|
+
indexArray[0] = index;
|
|
45
|
+
}
|
|
46
|
+
if (dataIndex === endKey) {
|
|
47
|
+
indexArray[1] = index;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var oldIndex = indexArray[0],
|
|
51
|
+
newIndex = indexArray[1];
|
|
52
|
+
var newData = _toConsumableArray(data);
|
|
53
|
+
var oldItem = data[oldIndex];
|
|
54
|
+
_spliceInstanceProperty(newData).call(newData, oldIndex, 1);
|
|
55
|
+
_spliceInstanceProperty(newData).call(newData, newIndex, 0, oldItem);
|
|
56
|
+
return newData;
|
|
57
|
+
};
|
|
31
58
|
|
|
32
|
-
export { getItemValue };
|
|
59
|
+
export { getItemValue, moveCol };
|
|
33
60
|
// powered by hdj
|
|
@@ -5,6 +5,7 @@ import type { ColumnsStateType } from "@ant-design/pro-table/es/typing";
|
|
|
5
5
|
export declare const useCols: ({ configData, rowSelection, table, bordered, }: HTableProps) => {
|
|
6
6
|
cols: ConfigDataModal;
|
|
7
7
|
setCols: import("react").Dispatch<import("react").SetStateAction<ConfigDataModal>>;
|
|
8
|
+
resetCols: () => void;
|
|
8
9
|
};
|
|
9
10
|
interface useColumnsStateTypeModal {
|
|
10
11
|
columnsState?: ColumnsStateType;
|
|
@@ -15,6 +16,6 @@ export declare const useColumnsStateType: ({ columnsState, columns, }: useColumn
|
|
|
15
16
|
persistenceKey: string | undefined;
|
|
16
17
|
value: Record<string, ColumnsState> | undefined;
|
|
17
18
|
onChange: (keys: string[], notCheck: string[]) => void;
|
|
18
|
-
|
|
19
|
+
resetCheckCol: () => void;
|
|
19
20
|
};
|
|
20
21
|
export {};
|
|
@@ -92,9 +92,13 @@ var useCols = function useCols(_ref) {
|
|
|
92
92
|
useEffect(function () {
|
|
93
93
|
setCols(changeConfigData(configData));
|
|
94
94
|
}, [configData, table, rowSelection]);
|
|
95
|
+
var resetCols = function resetCols() {
|
|
96
|
+
setCols(changeConfigData(configData));
|
|
97
|
+
};
|
|
95
98
|
return {
|
|
96
99
|
cols: cols,
|
|
97
|
-
setCols: setCols
|
|
100
|
+
setCols: setCols,
|
|
101
|
+
resetCols: resetCols
|
|
98
102
|
};
|
|
99
103
|
};
|
|
100
104
|
var useColumnsStateType = function useColumnsStateType(_ref3) {
|
|
@@ -133,7 +137,7 @@ var useColumnsStateType = function useColumnsStateType(_ref3) {
|
|
|
133
137
|
setSelfValue(newObj);
|
|
134
138
|
onChange === null || onChange === void 0 || onChange(newObj);
|
|
135
139
|
};
|
|
136
|
-
var
|
|
140
|
+
var resetCheckCol = function resetCheckCol() {
|
|
137
141
|
setSelfValue(initTableColsVal);
|
|
138
142
|
};
|
|
139
143
|
return {
|
|
@@ -141,7 +145,7 @@ var useColumnsStateType = function useColumnsStateType(_ref3) {
|
|
|
141
145
|
persistenceKey: persistenceKey,
|
|
142
146
|
value: selfValue,
|
|
143
147
|
onChange: change,
|
|
144
|
-
|
|
148
|
+
resetCheckCol: resetCheckCol
|
|
145
149
|
};
|
|
146
150
|
};
|
|
147
151
|
|
package/es/HTableBody/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { emptyDefaultRender, errorDefaultRender } from './defaultRender.js';
|
|
|
25
25
|
import useRowClassName from './hooks/useRowClassName.js';
|
|
26
26
|
|
|
27
27
|
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange", "bordered", "rowClassName"],
|
|
28
|
-
_excluded2 = ["value", "onChange", "
|
|
28
|
+
_excluded2 = ["value", "onChange", "resetCheckCol"];
|
|
29
29
|
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; }
|
|
30
30
|
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; }
|
|
31
31
|
var Body = (function (bodyProps) {
|
|
@@ -90,14 +90,15 @@ var Body = (function (bodyProps) {
|
|
|
90
90
|
bordered: bordered
|
|
91
91
|
}),
|
|
92
92
|
cols = _useCols.cols,
|
|
93
|
-
setCols = _useCols.setCols
|
|
93
|
+
setCols = _useCols.setCols,
|
|
94
|
+
resetCols = _useCols.resetCols;
|
|
94
95
|
var _useColumnsStateType = useColumnsStateType({
|
|
95
96
|
columnsState: columnsState,
|
|
96
97
|
columns: cols
|
|
97
98
|
}),
|
|
98
99
|
value = _useColumnsStateType.value,
|
|
99
100
|
onChange = _useColumnsStateType.onChange,
|
|
100
|
-
|
|
101
|
+
resetCheckCol = _useColumnsStateType.resetCheckCol,
|
|
101
102
|
selfColStatus = _objectWithoutProperties(_useColumnsStateType, _excluded2);
|
|
102
103
|
useSynchronousKeys({
|
|
103
104
|
selectedRowKeys: selectedRowKeys,
|
|
@@ -114,7 +115,10 @@ var Body = (function (bodyProps) {
|
|
|
114
115
|
setSizeChange: setCuSize,
|
|
115
116
|
colStatusValue: value || {},
|
|
116
117
|
onChange: onChange,
|
|
117
|
-
reset: reset
|
|
118
|
+
reset: function reset() {
|
|
119
|
+
resetCheckCol();
|
|
120
|
+
resetCols();
|
|
121
|
+
},
|
|
118
122
|
onDrop: setCols
|
|
119
123
|
}));
|
|
120
124
|
var defaultOptionsNode = optionsRender ? optionsRender(optionsNode) : optionsNode;
|
package/es/index.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ItemProps } from "./modal";
|
|
3
|
-
export declare const ColsSettingContent: ({ columns, onCheck, checkKeys, onDrop }: ItemProps) => JSX.Element;
|
|
3
|
+
export declare const ColsSettingContent: ({ columns, onCheck, checkKeys, onDrop, }: ItemProps) => JSX.Element;
|
|
@@ -2,75 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
4
|
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
5
6
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
6
|
-
var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/splice');
|
|
7
7
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var index = require('../../hooks/index.js');
|
|
10
|
-
var React = require('react');
|
|
11
|
-
var antd = require('antd');
|
|
12
10
|
var utils = require('./utils.js');
|
|
11
|
+
var ContentTree = require('./ContentTree.js');
|
|
12
|
+
var hooks = require('./hooks.js');
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_forEachInstanceProperty(data).call(data, function (item, index) {
|
|
20
|
-
var dataIndex = item.dataIndex;
|
|
21
|
-
if (!dataIndex) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (dataIndex === startKey) {
|
|
25
|
-
indexArray[0] = index;
|
|
26
|
-
}
|
|
27
|
-
if (dataIndex === endKey) {
|
|
28
|
-
indexArray[1] = index;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
var oldIndex = indexArray[0],
|
|
32
|
-
newIndex = indexArray[1];
|
|
33
|
-
var newData = _toConsumableArray(data);
|
|
34
|
-
var oldItem = data[oldIndex];
|
|
35
|
-
_spliceInstanceProperty(newData).call(newData, oldIndex, 1);
|
|
36
|
-
_spliceInstanceProperty(newData).call(newData, newIndex, 0, oldItem);
|
|
37
|
-
return newData;
|
|
38
|
-
};
|
|
39
|
-
var ColsSettingContent = function ColsSettingContent(_ref2) {
|
|
40
|
-
var columns = _ref2.columns,
|
|
41
|
-
onCheck = _ref2.onCheck,
|
|
42
|
-
checkKeys = _ref2.checkKeys,
|
|
43
|
-
onDrop = _ref2.onDrop;
|
|
14
|
+
var ColsSettingContent = function ColsSettingContent(_ref) {
|
|
15
|
+
var columns = _ref.columns,
|
|
16
|
+
onCheck = _ref.onCheck,
|
|
17
|
+
checkKeys = _ref.checkKeys,
|
|
18
|
+
onDrop = _ref.onDrop;
|
|
44
19
|
var content = index.useClassName("hw-table-body-option-setting-content");
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return treeData;
|
|
69
|
-
}, [columns]);
|
|
20
|
+
var norContentTreeData = hooks.useContentTree({
|
|
21
|
+
columns: columns
|
|
22
|
+
});
|
|
23
|
+
var leftContentTreeData = hooks.useContentTree({
|
|
24
|
+
columns: columns,
|
|
25
|
+
matchKey: "left"
|
|
26
|
+
});
|
|
27
|
+
var rightContentTreeData = hooks.useContentTree({
|
|
28
|
+
columns: columns,
|
|
29
|
+
matchKey: "right"
|
|
30
|
+
});
|
|
31
|
+
var norCheckKeys = hooks.useTreeKeys({
|
|
32
|
+
treeData: norContentTreeData,
|
|
33
|
+
checkKeys: checkKeys
|
|
34
|
+
});
|
|
35
|
+
var leftCheckKeys = hooks.useTreeKeys({
|
|
36
|
+
treeData: leftContentTreeData,
|
|
37
|
+
checkKeys: checkKeys
|
|
38
|
+
});
|
|
39
|
+
var rightCheckKeys = hooks.useTreeKeys({
|
|
40
|
+
treeData: rightContentTreeData,
|
|
41
|
+
checkKeys: checkKeys
|
|
42
|
+
});
|
|
70
43
|
var check = function check(keys) {
|
|
44
|
+
var _context;
|
|
71
45
|
var notCheck = [];
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
var allTreeData = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(leftContentTreeData), _toConsumableArray(norContentTreeData), _toConsumableArray(rightContentTreeData));
|
|
47
|
+
_forEachInstanceProperty(allTreeData).call(allTreeData, function (_ref2) {
|
|
48
|
+
var key = _ref2.key;
|
|
74
49
|
var cuKey = key;
|
|
75
50
|
var index = _indexOfInstanceProperty(keys).call(keys, cuKey);
|
|
76
51
|
if (index === -1) {
|
|
@@ -79,42 +54,75 @@ var ColsSettingContent = function ColsSettingContent(_ref2) {
|
|
|
79
54
|
});
|
|
80
55
|
onCheck(keys, notCheck);
|
|
81
56
|
};
|
|
82
|
-
var onDropEnd = function onDropEnd(
|
|
83
|
-
var
|
|
84
|
-
|
|
57
|
+
var onDropEnd = function onDropEnd(_ref3) {
|
|
58
|
+
var _context2;
|
|
59
|
+
var dragNodesKeys = _ref3.dragNodesKeys,
|
|
60
|
+
dropPosition = _ref3.dropPosition;
|
|
85
61
|
if (dropPosition < 1) {
|
|
86
62
|
return;
|
|
87
63
|
}
|
|
64
|
+
var allTreeData = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(leftContentTreeData), _toConsumableArray(norContentTreeData), _toConsumableArray(rightContentTreeData));
|
|
88
65
|
var _dragNodesKeys = _slicedToArray(dragNodesKeys, 1),
|
|
89
66
|
key = _dragNodesKeys[0];
|
|
90
|
-
var sourceKey =
|
|
91
|
-
var newData =
|
|
67
|
+
var sourceKey = allTreeData[dropPosition - 1].key;
|
|
68
|
+
var newData = utils.moveCol({
|
|
92
69
|
startKey: key,
|
|
93
70
|
endKey: sourceKey,
|
|
94
71
|
data: columns
|
|
95
72
|
});
|
|
96
73
|
onDrop(newData);
|
|
97
74
|
};
|
|
98
|
-
return jsxRuntime.
|
|
75
|
+
return jsxRuntime.jsxs("div", {
|
|
99
76
|
className: content,
|
|
100
|
-
children: jsxRuntime.jsx(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
77
|
+
children: [jsxRuntime.jsx(ContentTree.default, {
|
|
78
|
+
title: "\u56FA\u5B9A\u5728\u5DE6\u4FA7",
|
|
79
|
+
treeData: leftContentTreeData,
|
|
80
|
+
checkedKeys: leftCheckKeys,
|
|
81
|
+
onDrop: onDropEnd,
|
|
82
|
+
onCheck: function onCheck(key) {
|
|
83
|
+
var _context3;
|
|
84
|
+
var curKey = key;
|
|
85
|
+
check(_concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(curKey), _toConsumableArray(norCheckKeys), _toConsumableArray(rightCheckKeys)));
|
|
86
|
+
}
|
|
87
|
+
}), jsxRuntime.jsx(ContentTree.default, {
|
|
88
|
+
title: "\u4E0D\u56FA\u5B9A",
|
|
89
|
+
treeData: norContentTreeData,
|
|
90
|
+
checkedKeys: norCheckKeys,
|
|
91
|
+
onDrop: function onDrop(_ref4) {
|
|
92
|
+
var dragNodesKeys = _ref4.dragNodesKeys,
|
|
93
|
+
dropPosition = _ref4.dropPosition;
|
|
94
|
+
var cuDropPosition = leftContentTreeData.length + dropPosition;
|
|
95
|
+
onDropEnd({
|
|
96
|
+
dragNodesKeys: dragNodesKeys,
|
|
97
|
+
dropPosition: cuDropPosition
|
|
98
|
+
});
|
|
104
99
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
100
|
+
onCheck: function onCheck(key) {
|
|
101
|
+
var _context4;
|
|
102
|
+
var curKey = key;
|
|
103
|
+
check(_concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(leftCheckKeys), _toConsumableArray(curKey), _toConsumableArray(rightCheckKeys)));
|
|
104
|
+
}
|
|
105
|
+
}), jsxRuntime.jsx(ContentTree.default, {
|
|
106
|
+
title: "\u56FA\u5B9A\u5728\u53F3\u4FA7",
|
|
107
|
+
treeData: rightContentTreeData,
|
|
108
|
+
checkedKeys: rightCheckKeys,
|
|
109
|
+
onDrop: function onDrop(_ref5) {
|
|
110
|
+
var dragNodesKeys = _ref5.dragNodesKeys,
|
|
111
|
+
dropPosition = _ref5.dropPosition;
|
|
112
|
+
var leftLen = leftContentTreeData.length;
|
|
113
|
+
var norLen = norContentTreeData.length;
|
|
114
|
+
var cuDropPosition = leftLen + norLen + dropPosition;
|
|
115
|
+
onDropEnd({
|
|
116
|
+
dragNodesKeys: dragNodesKeys,
|
|
117
|
+
dropPosition: cuDropPosition
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
onCheck: function onCheck(key) {
|
|
121
|
+
var _context5;
|
|
122
|
+
var curKey = key;
|
|
123
|
+
check(_concatInstanceProperty(_context5 = []).call(_context5, _toConsumableArray(leftCheckKeys), _toConsumableArray(norCheckKeys), _toConsumableArray(curKey)));
|
|
124
|
+
}
|
|
125
|
+
})]
|
|
118
126
|
});
|
|
119
127
|
};
|
|
120
128
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TreeProps } from "antd/lib/tree/Tree";
|
|
3
|
+
interface IProps extends TreeProps {
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: ({ treeData, checkedKeys, onDrop, onCheck, title }: IProps) => JSX.Element | null;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var index = require('../../hooks/index.js');
|
|
8
|
+
|
|
9
|
+
var ContentTree = (function (_ref) {
|
|
10
|
+
var treeData = _ref.treeData,
|
|
11
|
+
checkedKeys = _ref.checkedKeys,
|
|
12
|
+
onDrop = _ref.onDrop,
|
|
13
|
+
onCheck = _ref.onCheck,
|
|
14
|
+
title = _ref.title;
|
|
15
|
+
var treeClass = index.useClassName("hw-table-body-option-tree");
|
|
16
|
+
var treeItemContent = index.useClassName("hw-table-op-tree-content");
|
|
17
|
+
if (!(treeData !== null && treeData !== void 0 && treeData.length)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return jsxRuntime.jsxs(antd.Space, {
|
|
21
|
+
className: treeItemContent,
|
|
22
|
+
direction: "vertical",
|
|
23
|
+
size: 12,
|
|
24
|
+
children: [jsxRuntime.jsx(antd.Typography.Text, {
|
|
25
|
+
type: "secondary",
|
|
26
|
+
style: {
|
|
27
|
+
paddingLeft: 24
|
|
28
|
+
},
|
|
29
|
+
children: title
|
|
30
|
+
}), jsxRuntime.jsx(antd.Tree, {
|
|
31
|
+
checkable: true,
|
|
32
|
+
className: treeClass,
|
|
33
|
+
draggable: true,
|
|
34
|
+
checkedKeys: checkedKeys,
|
|
35
|
+
onDrop: onDrop,
|
|
36
|
+
onCheck: onCheck,
|
|
37
|
+
height: 268,
|
|
38
|
+
treeData: treeData
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
exports.default = ContentTree;
|
|
44
|
+
// powered by h
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ItemProps } from "./modal";
|
|
3
|
-
export declare const Title: ({ columns, onCheck, checkKeys, reset }: Omit<ItemProps, "onDrop">) => JSX.Element;
|
|
3
|
+
export declare const Title: ({ columns, onCheck, checkKeys, reset, }: Omit<ItemProps, "onDrop">) => JSX.Element;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { IProps } from "@/components/HTableBody/Options/modal";
|
|
3
|
+
import type { ConfigDataModal } from "@/components/modal";
|
|
2
4
|
export declare const useCheckKeys: ({ columns, colStatusValue, }: Pick<IProps, "colStatusValue" | "columns">) => string[];
|
|
5
|
+
interface UseContentTreeModal {
|
|
6
|
+
columns: ConfigDataModal;
|
|
7
|
+
matchKey?: "right" | "left";
|
|
8
|
+
}
|
|
9
|
+
interface ColDataNode {
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
key: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const useContentTree: ({ columns, matchKey }: UseContentTreeModal) => ColDataNode[];
|
|
14
|
+
interface UseTreeKeysModal {
|
|
15
|
+
treeData: ColDataNode[];
|
|
16
|
+
checkKeys: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const useTreeKeys: ({ treeData, checkKeys, }: UseTreeKeysModal) => string[];
|
|
19
|
+
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
4
|
+
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
6
|
var React = require('react');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
var index = require('../../hooks/index.js');
|
|
5
9
|
|
|
6
10
|
var useCheckKeys = function useCheckKeys(_ref) {
|
|
7
11
|
var columns = _ref.columns,
|
|
@@ -26,6 +30,56 @@ var useCheckKeys = function useCheckKeys(_ref) {
|
|
|
26
30
|
return keys;
|
|
27
31
|
}, [colStatusValue, columns]);
|
|
28
32
|
};
|
|
33
|
+
var useContentTree = function useContentTree(_ref3) {
|
|
34
|
+
var columns = _ref3.columns,
|
|
35
|
+
matchKey = _ref3.matchKey;
|
|
36
|
+
var titleClass = index.useClassName("hw-table-body-option-setting-content-title");
|
|
37
|
+
return React.useMemo(function () {
|
|
38
|
+
var treeData = [];
|
|
39
|
+
_forEachInstanceProperty(columns).call(columns, function (_ref4) {
|
|
40
|
+
var dataIndex = _ref4.dataIndex,
|
|
41
|
+
title = _ref4.title,
|
|
42
|
+
titleStr = _ref4.titleStr,
|
|
43
|
+
fixed = _ref4.fixed;
|
|
44
|
+
if (!dataIndex) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (fixed !== matchKey) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
var _getItemValue = utils.getItemValue({
|
|
51
|
+
titleStr: titleStr,
|
|
52
|
+
title: title
|
|
53
|
+
}),
|
|
54
|
+
cuTitleStr = _getItemValue.title;
|
|
55
|
+
treeData.push({
|
|
56
|
+
title: jsxRuntime.jsx("div", {
|
|
57
|
+
className: titleClass,
|
|
58
|
+
children: cuTitleStr
|
|
59
|
+
}),
|
|
60
|
+
key: dataIndex.toString()
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return treeData;
|
|
64
|
+
}, [columns]);
|
|
65
|
+
};
|
|
66
|
+
var useTreeKeys = function useTreeKeys(_ref5) {
|
|
67
|
+
var treeData = _ref5.treeData,
|
|
68
|
+
checkKeys = _ref5.checkKeys;
|
|
69
|
+
return React.useMemo(function () {
|
|
70
|
+
var newKeys = [];
|
|
71
|
+
_forEachInstanceProperty(treeData).call(treeData, function (_ref6) {
|
|
72
|
+
var key = _ref6.key;
|
|
73
|
+
var index = _indexOfInstanceProperty(checkKeys).call(checkKeys, key);
|
|
74
|
+
if (index !== -1) {
|
|
75
|
+
newKeys.push(key);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return newKeys;
|
|
79
|
+
}, [treeData, checkKeys]);
|
|
80
|
+
};
|
|
29
81
|
|
|
30
82
|
exports.useCheckKeys = useCheckKeys;
|
|
83
|
+
exports.useContentTree = useContentTree;
|
|
84
|
+
exports.useTreeKeys = useTreeKeys;
|
|
31
85
|
// powered by h
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IProps } from "./modal";
|
|
3
|
-
declare const _default: ({ reload, size, density, setSizeChange, columns, onChange, colStatusValue, reset, settingRender, onDrop }: IProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ reload, size, density, setSizeChange, columns, onChange, colStatusValue, reset, settingRender, onDrop, }: IProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigItemModal } from "../../modal";
|
|
1
|
+
import type { ConfigDataModal, ConfigItemModal } from "../../modal";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare const getItemValue: (data: ConfigItemModal) => {
|
|
4
4
|
name?: string | any[] | undefined;
|
|
@@ -806,3 +806,10 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
806
806
|
title: any;
|
|
807
807
|
dataIndex: ((string | number | (string | number)[]) & import("rc-table/lib/interface").DataIndex) | undefined;
|
|
808
808
|
};
|
|
809
|
+
interface MoveColProps {
|
|
810
|
+
startKey: string;
|
|
811
|
+
endKey: string;
|
|
812
|
+
data: ConfigDataModal;
|
|
813
|
+
}
|
|
814
|
+
export declare const moveCol: ({ startKey, endKey, data }: MoveColProps) => ConfigItemModal[];
|
|
815
|
+
export {};
|