@hw-component/table 0.0.8-beta-v3 → 0.0.8-beta-v6
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/es/HTableBody/Options/Content.js +9 -2
- package/es/HTableBody/Options/utils.d.ts +1130 -1
- package/es/HTableBody/Options/utils.js +32 -19
- package/lib/HTableBody/Options/Content.js +9 -2
- package/lib/HTableBody/Options/utils.d.ts +1130 -1
- package/lib/HTableBody/Options/utils.js +32 -18
- package/package.json +1 -1
- package/src/components/HTableBody/Options/Content.tsx +7 -2
- package/src/components/HTableBody/Options/utils.ts +18 -17
- package/src/pages/Table/index.tsx +1 -1
|
@@ -1,36 +1,52 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
4
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
5
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
7
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
|
|
8
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
|
|
9
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
|
|
3
10
|
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
11
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
4
13
|
require('core-js/modules/es.object.to-string.js');
|
|
5
14
|
require('core-js/modules/es.regexp.to-string.js');
|
|
6
15
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
7
16
|
var _keysInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/keys');
|
|
8
17
|
var React = require('react');
|
|
9
18
|
|
|
10
|
-
var
|
|
11
|
-
|
|
19
|
+
var _excluded = ["dataIndex", "title", "titleStr"];
|
|
20
|
+
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
|
+
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; }
|
|
22
|
+
var getItemValue = function getItemValue(data) {
|
|
23
|
+
var dataIndex = data.dataIndex,
|
|
24
|
+
title = data.title,
|
|
25
|
+
titleStr = data.titleStr,
|
|
26
|
+
oData = _objectWithoutProperties(data, _excluded);
|
|
27
|
+
var resultTitle = /*#__PURE__*/React.isValidElement(title) ? title.props.children : title;
|
|
28
|
+
if (titleStr) {
|
|
29
|
+
resultTitle = titleStr;
|
|
30
|
+
}
|
|
31
|
+
return _objectSpread({
|
|
32
|
+
title: resultTitle,
|
|
33
|
+
dataIndex: dataIndex
|
|
34
|
+
}, oData);
|
|
12
35
|
};
|
|
13
36
|
var childDataIndexProvider = function childDataIndexProvider(data, title) {
|
|
14
37
|
var keys = [];
|
|
15
38
|
var cols = [];
|
|
16
|
-
var titleStr = getTitle(title);
|
|
17
39
|
_forEachInstanceProperty(data).call(data, function (value) {
|
|
18
40
|
if (typeof value === "string") {
|
|
19
41
|
keys.push(value);
|
|
20
|
-
cols.push({
|
|
21
|
-
title:
|
|
42
|
+
cols.push(getItemValue({
|
|
43
|
+
title: title,
|
|
22
44
|
dataIndex: value
|
|
23
|
-
});
|
|
45
|
+
}));
|
|
24
46
|
return;
|
|
25
47
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
cuTitleStr = value.titleStr;
|
|
29
|
-
keys.push(dataIndex);
|
|
30
|
-
cols.push({
|
|
31
|
-
title: getTitle(cuTitleStr || title),
|
|
32
|
-
dataIndex: dataIndex
|
|
33
|
-
});
|
|
48
|
+
keys.push(value.dataIndex);
|
|
49
|
+
cols.push(getItemValue(value));
|
|
34
50
|
});
|
|
35
51
|
return {
|
|
36
52
|
keys: keys,
|
|
@@ -60,10 +76,7 @@ var defaultKeys = function defaultKeys(cols) {
|
|
|
60
76
|
return;
|
|
61
77
|
}
|
|
62
78
|
allKeys.push(dataIndex.toString());
|
|
63
|
-
checkCols.push(
|
|
64
|
-
title: getTitle(titleStr || title),
|
|
65
|
-
dataIndex: dataIndex
|
|
66
|
-
});
|
|
79
|
+
checkCols.push(getItemValue(value));
|
|
67
80
|
});
|
|
68
81
|
return {
|
|
69
82
|
keys: keys,
|
|
@@ -73,4 +86,5 @@ var defaultKeys = function defaultKeys(cols) {
|
|
|
73
86
|
};
|
|
74
87
|
|
|
75
88
|
exports.defaultKeys = defaultKeys;
|
|
89
|
+
exports.getItemValue = getItemValue;
|
|
76
90
|
// powered by h
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { useMemo } from "react";
|
|
|
3
3
|
import type { ConfigDataModal } from "../../modal";
|
|
4
4
|
import { Tree } from "antd";
|
|
5
5
|
import type { ItemProps } from "./modal";
|
|
6
|
+
import {getItemValue} from "./utils";
|
|
6
7
|
|
|
7
8
|
export const ColsSettingContent = ({
|
|
8
9
|
columns,
|
|
@@ -14,10 +15,14 @@ export const ColsSettingContent = ({
|
|
|
14
15
|
const treeClass = useClassName("hw-table-body-option-tree");
|
|
15
16
|
const contentTreeData = useMemo(() => {
|
|
16
17
|
const treeData: ConfigDataModal = [];
|
|
17
|
-
columns.forEach(({ dataIndex, title }) => {
|
|
18
|
+
columns.forEach(({ dataIndex, title,titleStr }) => {
|
|
18
19
|
if (dataIndex) {
|
|
20
|
+
const {title:cuTitleStr}=getItemValue({
|
|
21
|
+
titleStr,
|
|
22
|
+
title,
|
|
23
|
+
})
|
|
19
24
|
treeData.push({
|
|
20
|
-
title: <div className={titleClass}>{
|
|
25
|
+
title: <div className={titleClass}>{cuTitleStr}</div>,
|
|
21
26
|
key: dataIndex.toString(),
|
|
22
27
|
});
|
|
23
28
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { ConfigDataModal, ConfigItemModal } from "../../modal";
|
|
2
2
|
import React from "react";
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
export const getItemValue= (data:ConfigItemModal) => {
|
|
4
|
+
const {dataIndex,title,titleStr,...oData}=data;
|
|
5
|
+
let resultTitle=React.isValidElement(title)?title.props.children:title;
|
|
6
|
+
if (titleStr){
|
|
7
|
+
resultTitle =titleStr;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
title:resultTitle,
|
|
11
|
+
dataIndex,
|
|
12
|
+
...oData
|
|
13
|
+
}
|
|
5
14
|
}
|
|
6
15
|
const childDataIndexProvider = (
|
|
7
16
|
data: ConfigItemModal[] | string[],
|
|
@@ -9,22 +18,17 @@ const childDataIndexProvider = (
|
|
|
9
18
|
) => {
|
|
10
19
|
const keys: string[] = [];
|
|
11
20
|
const cols: ConfigDataModal = [];
|
|
12
|
-
const titleStr=getTitle(title);
|
|
13
21
|
data.forEach((value) => {
|
|
14
22
|
if (typeof value === "string") {
|
|
15
23
|
keys.push(value);
|
|
16
|
-
cols.push({
|
|
17
|
-
title
|
|
18
|
-
dataIndex:
|
|
19
|
-
});
|
|
24
|
+
cols.push(getItemValue({
|
|
25
|
+
title,
|
|
26
|
+
dataIndex:value
|
|
27
|
+
}));
|
|
20
28
|
return;
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
cols.push({
|
|
25
|
-
title:getTitle(cuTitleStr||title),
|
|
26
|
-
dataIndex
|
|
27
|
-
});
|
|
30
|
+
keys.push(value.dataIndex);
|
|
31
|
+
cols.push(getItemValue(value));
|
|
28
32
|
});
|
|
29
33
|
return {
|
|
30
34
|
keys,
|
|
@@ -51,10 +55,7 @@ export const defaultKeys = (cols: ConfigDataModal) => {
|
|
|
51
55
|
return;
|
|
52
56
|
}
|
|
53
57
|
allKeys.push(dataIndex.toString());
|
|
54
|
-
checkCols.push(
|
|
55
|
-
title:getTitle(titleStr||title),
|
|
56
|
-
dataIndex
|
|
57
|
-
});
|
|
58
|
+
checkCols.push(getItemValue(value));
|
|
58
59
|
});
|
|
59
60
|
return {
|
|
60
61
|
keys,
|