@hw-component/table 1.9.90 → 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/HeaderTitle/hooks.d.ts +2 -2
- package/es/HTableBody/Options/Content.d.ts +1 -1
- package/es/HTableBody/Options/Content.js +103 -48
- 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/index.js +4 -2
- package/es/HTableBody/Options/utils.d.ts +8 -1
- package/es/HTableBody/Options/utils.js +29 -2
- package/es/HTableBody/RowCheckBox/RowItem.d.ts +1 -1
- package/es/HTableBody/RowCheckBox/hooks.d.ts +1 -1
- package/es/HTableBody/RowRadioBoxSelection.d.ts +1 -1
- package/es/HTableBody/hooks/useColData.d.ts +4 -1
- package/es/HTableBody/hooks/useColData.js +8 -3
- package/es/HTableBody/index.js +10 -4
- package/es/HTableBody/modal.d.ts +2 -1
- package/es/index.css +4 -0
- package/es/modal.d.ts +2 -1
- package/lib/HTableBody/HeaderTitle/hooks.d.ts +2 -2
- package/lib/HTableBody/Options/Content.d.ts +1 -1
- package/lib/HTableBody/Options/Content.js +101 -46
- 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/index.js +4 -2
- package/lib/HTableBody/Options/utils.d.ts +8 -1
- package/lib/HTableBody/Options/utils.js +29 -1
- package/lib/HTableBody/RowCheckBox/RowItem.d.ts +1 -1
- package/lib/HTableBody/RowCheckBox/hooks.d.ts +1 -1
- package/lib/HTableBody/RowRadioBoxSelection.d.ts +1 -1
- package/lib/HTableBody/hooks/useColData.d.ts +4 -1
- package/lib/HTableBody/hooks/useColData.js +8 -3
- package/lib/HTableBody/index.js +10 -4
- package/lib/HTableBody/modal.d.ts +2 -1
- package/lib/index.css +4 -0
- package/lib/modal.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/HTableBody/HeaderTitle/hooks.ts +47 -42
- package/src/components/HTableBody/HeaderTitle/index.tsx +7 -5
- package/src/components/HTableBody/Options/Content.tsx +82 -35
- package/src/components/HTableBody/Options/ContentTree.tsx +38 -0
- package/src/components/HTableBody/Options/Title.tsx +7 -2
- package/src/components/HTableBody/Options/hooks.tsx +79 -0
- package/src/components/HTableBody/Options/index.tsx +3 -0
- package/src/components/HTableBody/Options/modal.d.ts +2 -0
- package/src/components/HTableBody/Options/utils.ts +28 -0
- package/src/components/HTableBody/RowCheckBox/RowItem.tsx +1 -1
- package/src/components/HTableBody/RowCheckBox/hooks.ts +1 -1
- package/src/components/HTableBody/RowRadioBoxSelection.tsx +1 -1
- package/src/components/HTableBody/hooks/useColData.tsx +9 -2
- package/src/components/HTableBody/index.tsx +14 -9
- package/src/components/HTableBody/modal.ts +4 -3
- package/src/components/hooks/useRowObj.ts +1 -1
- package/src/components/index.less +4 -0
- package/src/components/modal.ts +3 -2
- package/src/pages/Table/index.tsx +50 -20
- package/src/components/HTableBody/Options/hooks.ts +0 -24
|
@@ -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, }: 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;
|
|
@@ -19,7 +19,8 @@ var Options = (function (_ref) {
|
|
|
19
19
|
onChange = _ref.onChange,
|
|
20
20
|
colStatusValue = _ref.colStatusValue,
|
|
21
21
|
reset = _ref.reset,
|
|
22
|
-
settingRender = _ref.settingRender
|
|
22
|
+
settingRender = _ref.settingRender,
|
|
23
|
+
onDrop = _ref.onDrop;
|
|
23
24
|
var pointer = useClassName(["hw-table-pointer", "hw-table-body-option-icon"]);
|
|
24
25
|
var ref = useRef(null);
|
|
25
26
|
var checkKeys = useCheckKeys({
|
|
@@ -84,7 +85,8 @@ var Options = (function (_ref) {
|
|
|
84
85
|
content: jsx(ColsSettingContent, {
|
|
85
86
|
columns: columns,
|
|
86
87
|
checkKeys: checkKeys,
|
|
87
|
-
onCheck: onChange
|
|
88
|
+
onCheck: onChange,
|
|
89
|
+
onDrop: onDrop
|
|
88
90
|
}),
|
|
89
91
|
title: jsx(Title, {
|
|
90
92
|
columns: columns,
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { RowRadioSelectionProps } from "@/components/HTableBody/modal";
|
|
2
|
+
import type { RowRadioSelectionProps } from "@/components/HTableBody/modal";
|
|
3
3
|
declare const _default: ({ data, onChange, index, getCheckboxProps, }: RowRadioSelectionProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Key } from "react";
|
|
2
|
-
import { RowRadioSelectionProps } from
|
|
2
|
+
import type { RowRadioSelectionProps } from "../modal";
|
|
3
3
|
export declare const useAllChecked: (keys?: Key[], data?: any[]) => boolean;
|
|
4
4
|
export declare const useCheckControl: (data: any[] | undefined, onChange: RowRadioSelectionProps["onChange"]) => {
|
|
5
5
|
checkChange: (e: any) => void;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { ConfigDataModal, HTableProps } from "@/components/modal";
|
|
2
3
|
import type { ColumnsState } from "@ant-design/pro-table/es/container";
|
|
3
4
|
import type { ColumnsStateType } from "@ant-design/pro-table/es/typing";
|
|
4
5
|
export declare const useCols: ({ configData, rowSelection, table, bordered, }: HTableProps) => {
|
|
5
6
|
cols: ConfigDataModal;
|
|
7
|
+
setCols: import("react").Dispatch<import("react").SetStateAction<ConfigDataModal>>;
|
|
8
|
+
resetCols: () => void;
|
|
6
9
|
};
|
|
7
10
|
interface useColumnsStateTypeModal {
|
|
8
11
|
columnsState?: ColumnsStateType;
|
|
@@ -13,6 +16,6 @@ export declare const useColumnsStateType: ({ columnsState, columns, }: useColumn
|
|
|
13
16
|
persistenceKey: string | undefined;
|
|
14
17
|
value: Record<string, ColumnsState> | undefined;
|
|
15
18
|
onChange: (keys: string[], notCheck: string[]) => void;
|
|
16
|
-
|
|
19
|
+
resetCheckCol: () => void;
|
|
17
20
|
};
|
|
18
21
|
export {};
|
|
@@ -92,8 +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
|
-
cols: cols
|
|
99
|
+
cols: cols,
|
|
100
|
+
setCols: setCols,
|
|
101
|
+
resetCols: resetCols
|
|
97
102
|
};
|
|
98
103
|
};
|
|
99
104
|
var useColumnsStateType = function useColumnsStateType(_ref3) {
|
|
@@ -132,7 +137,7 @@ var useColumnsStateType = function useColumnsStateType(_ref3) {
|
|
|
132
137
|
setSelfValue(newObj);
|
|
133
138
|
onChange === null || onChange === void 0 || onChange(newObj);
|
|
134
139
|
};
|
|
135
|
-
var
|
|
140
|
+
var resetCheckCol = function resetCheckCol() {
|
|
136
141
|
setSelfValue(initTableColsVal);
|
|
137
142
|
};
|
|
138
143
|
return {
|
|
@@ -140,7 +145,7 @@ var useColumnsStateType = function useColumnsStateType(_ref3) {
|
|
|
140
145
|
persistenceKey: persistenceKey,
|
|
141
146
|
value: selfValue,
|
|
142
147
|
onChange: change,
|
|
143
|
-
|
|
148
|
+
resetCheckCol: resetCheckCol
|
|
144
149
|
};
|
|
145
150
|
};
|
|
146
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) {
|
|
@@ -89,14 +89,16 @@ var Body = (function (bodyProps) {
|
|
|
89
89
|
rowSelection: rowSelection,
|
|
90
90
|
bordered: bordered
|
|
91
91
|
}),
|
|
92
|
-
cols = _useCols.cols
|
|
92
|
+
cols = _useCols.cols,
|
|
93
|
+
setCols = _useCols.setCols,
|
|
94
|
+
resetCols = _useCols.resetCols;
|
|
93
95
|
var _useColumnsStateType = useColumnsStateType({
|
|
94
96
|
columnsState: columnsState,
|
|
95
97
|
columns: cols
|
|
96
98
|
}),
|
|
97
99
|
value = _useColumnsStateType.value,
|
|
98
100
|
onChange = _useColumnsStateType.onChange,
|
|
99
|
-
|
|
101
|
+
resetCheckCol = _useColumnsStateType.resetCheckCol,
|
|
100
102
|
selfColStatus = _objectWithoutProperties(_useColumnsStateType, _excluded2);
|
|
101
103
|
useSynchronousKeys({
|
|
102
104
|
selectedRowKeys: selectedRowKeys,
|
|
@@ -113,7 +115,11 @@ var Body = (function (bodyProps) {
|
|
|
113
115
|
setSizeChange: setCuSize,
|
|
114
116
|
colStatusValue: value || {},
|
|
115
117
|
onChange: onChange,
|
|
116
|
-
reset: reset
|
|
118
|
+
reset: function reset() {
|
|
119
|
+
resetCheckCol();
|
|
120
|
+
resetCols();
|
|
121
|
+
},
|
|
122
|
+
onDrop: setCols
|
|
117
123
|
}));
|
|
118
124
|
var defaultOptionsNode = optionsRender ? optionsRender(optionsNode) : optionsNode;
|
|
119
125
|
var alwaysShowAlert = useAlwaysShowAlert(selectedRowData, configAlwaysShowAlert);
|
package/es/HTableBody/modal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
|
|
2
|
-
import
|
|
2
|
+
import type { Key } from "react";
|
|
3
|
+
import type React from "react";
|
|
3
4
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
4
5
|
import type { ActionRenderFn, ConfigDataModal, HRowSelection, HTableInstance, ParamsModal } from "@/components/modal";
|
|
5
6
|
import type { AffixProps } from "antd/lib/affix";
|
package/es/index.css
CHANGED
package/es/modal.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { ProColumns } from "@ant-design/pro-table/lib/typing";
|
|
|
2
2
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
3
3
|
import type { HItemProps, HFormInstance } from "@hw-component/form/es/Form/modal";
|
|
4
4
|
import type { ColProps, FormInstance } from "antd";
|
|
5
|
-
import
|
|
5
|
+
import type { Key } from "react";
|
|
6
|
+
import type React from "react";
|
|
6
7
|
import type { ModalProps } from "antd";
|
|
7
8
|
import type { TableProps } from "antd/lib/table";
|
|
8
9
|
import type { AffixProps } from "antd/lib/affix";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MutableRefObject } from "react";
|
|
1
|
+
import type { MutableRefObject } from "react";
|
|
2
2
|
interface HeaderStyleParams {
|
|
3
3
|
bodyRef: MutableRefObject<HTMLDivElement | null>;
|
|
4
4
|
titleContentRef: MutableRefObject<HTMLDivElement | null>;
|
|
5
5
|
rightNodeRef: MutableRefObject<HTMLDivElement | null>;
|
|
6
6
|
}
|
|
7
|
-
export declare const useHeaderStyle: ({ bodyRef, titleContentRef, rightNodeRef }: HeaderStyleParams) => {};
|
|
7
|
+
export declare const useHeaderStyle: ({ bodyRef, titleContentRef, rightNodeRef, }: HeaderStyleParams) => {};
|
|
8
8
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ItemProps } from "./modal";
|
|
3
|
-
export declare const ColsSettingContent: ({ columns, onCheck, checkKeys, }: ItemProps) => JSX.Element;
|
|
3
|
+
export declare const ColsSettingContent: ({ columns, onCheck, checkKeys, onDrop, }: ItemProps) => JSX.Element;
|
|
@@ -1,47 +1,51 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
|
+
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
3
6
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
4
7
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
5
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
9
|
var index = require('../../hooks/index.js');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var antd = require('antd');
|
|
9
10
|
var utils = require('./utils.js');
|
|
11
|
+
var ContentTree = require('./ContentTree.js');
|
|
12
|
+
var hooks = require('./hooks.js');
|
|
10
13
|
|
|
11
14
|
var ColsSettingContent = function ColsSettingContent(_ref) {
|
|
12
15
|
var columns = _ref.columns,
|
|
13
16
|
onCheck = _ref.onCheck,
|
|
14
|
-
checkKeys = _ref.checkKeys
|
|
17
|
+
checkKeys = _ref.checkKeys,
|
|
18
|
+
onDrop = _ref.onDrop;
|
|
15
19
|
var content = index.useClassName("hw-table-body-option-setting-content");
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return treeData;
|
|
40
|
-
}, [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
|
+
});
|
|
41
43
|
var check = function check(keys) {
|
|
44
|
+
var _context;
|
|
42
45
|
var notCheck = [];
|
|
43
|
-
|
|
44
|
-
|
|
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;
|
|
45
49
|
var cuKey = key;
|
|
46
50
|
var index = _indexOfInstanceProperty(keys).call(keys, cuKey);
|
|
47
51
|
if (index === -1) {
|
|
@@ -50,24 +54,75 @@ var ColsSettingContent = function ColsSettingContent(_ref) {
|
|
|
50
54
|
});
|
|
51
55
|
onCheck(keys, notCheck);
|
|
52
56
|
};
|
|
53
|
-
|
|
57
|
+
var onDropEnd = function onDropEnd(_ref3) {
|
|
58
|
+
var _context2;
|
|
59
|
+
var dragNodesKeys = _ref3.dragNodesKeys,
|
|
60
|
+
dropPosition = _ref3.dropPosition;
|
|
61
|
+
if (dropPosition < 1) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
var allTreeData = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(leftContentTreeData), _toConsumableArray(norContentTreeData), _toConsumableArray(rightContentTreeData));
|
|
65
|
+
var _dragNodesKeys = _slicedToArray(dragNodesKeys, 1),
|
|
66
|
+
key = _dragNodesKeys[0];
|
|
67
|
+
var sourceKey = allTreeData[dropPosition - 1].key;
|
|
68
|
+
var newData = utils.moveCol({
|
|
69
|
+
startKey: key,
|
|
70
|
+
endKey: sourceKey,
|
|
71
|
+
data: columns
|
|
72
|
+
});
|
|
73
|
+
onDrop(newData);
|
|
74
|
+
};
|
|
75
|
+
return jsxRuntime.jsxs("div", {
|
|
54
76
|
className: content,
|
|
55
|
-
children: jsxRuntime.jsx(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
});
|
|
59
99
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
+
})]
|
|
71
126
|
});
|
|
72
127
|
};
|
|
73
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 }: ItemProps) => 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 {};
|