@lemon-fe/components 1.4.22-alpha.3 → 1.4.22-alpha.5
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/data-grid/components/custom-panel/field-modal.js +3 -1
- package/es/data-grid/index.less +6 -0
- package/es/data-grid/locale/en_US.js +1 -0
- package/es/data-grid/locale/locale.d.ts +1 -0
- package/es/data-grid/locale/vi.js +1 -0
- package/es/data-grid/locale/zh_CN.js +1 -0
- package/es/data-grid/locale/zh_Hant_HK.js +1 -0
- package/es/sider-tree/index.d.ts +8 -0
- package/es/sider-tree/index.js +55 -29
- package/es/sider-tree/tree-node-title.d.ts +1 -0
- package/es/sider-tree/tree-node-title.js +19 -4
- package/package.json +2 -2
|
@@ -282,5 +282,7 @@ export default function FieldModal(props) {
|
|
|
282
282
|
handleAddExp(item);
|
|
283
283
|
}
|
|
284
284
|
}, /*#__PURE__*/React.createElement(Icons.Plus, null)));
|
|
285
|
-
}))))
|
|
285
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
className: prefix('column-panel-modal-bottomtooltip')
|
|
287
|
+
}, fieldModal.bottomTooltip));
|
|
286
288
|
}
|
package/es/data-grid/index.less
CHANGED
|
@@ -40,6 +40,7 @@ var locale = {
|
|
|
40
40
|
dataSourceSummaryDataText: 'Total value calculated based on the formula from the data source',
|
|
41
41
|
addFieldText: 'Add Field',
|
|
42
42
|
idTooltip: 'Custom column name is not allowed to be the same as the existing field, if the history has been set with the same name field, it does not support export',
|
|
43
|
+
bottomTooltip: 'Note: Formulas only support calculation on numerical columns',
|
|
43
44
|
customColumnNameTextRequired: 'Please enter the custom column name'
|
|
44
45
|
},
|
|
45
46
|
maxWordText: '${headerName} can not exceed ${maxLength} words',
|
|
@@ -37,6 +37,7 @@ var locale = {
|
|
|
37
37
|
dataSourceSummaryDataText: 'Nguồn dữ liệu tính toán giá trị tổng cộng theo công thức tính toán',
|
|
38
38
|
addFieldText: 'Thêm trường',
|
|
39
39
|
idTooltip: 'Tên cột tùy chỉnh không được trùng với tên cột đã có, nếu cột đã có tên trùng đã được thiết lập thì không hỗ trợ xuất',
|
|
40
|
+
bottomTooltip: 'Lưu ý: Công thức chỉ hỗ trợ tính toán cho cột số liệu',
|
|
40
41
|
customColumnNameTextRequired: 'Vui lòng nhập tên cột tùy chỉnh'
|
|
41
42
|
},
|
|
42
43
|
validate: {
|
package/es/sider-tree/index.d.ts
CHANGED
|
@@ -20,6 +20,14 @@ interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | '
|
|
|
20
20
|
* @description 是否在搜索时保留父节点
|
|
21
21
|
*/
|
|
22
22
|
filterKeepParents?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @description 是否在搜索时保留子孙节点
|
|
25
|
+
*/
|
|
26
|
+
filterKeepDescendants?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @description 是否高亮关键词
|
|
29
|
+
*/
|
|
30
|
+
highlightKeywords?: boolean;
|
|
23
31
|
}
|
|
24
32
|
declare function SiderTreeTabs(props: {
|
|
25
33
|
tabs: {
|
package/es/sider-tree/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["tabs", "children"],
|
|
2
|
-
_excluded2 = ["data", "showSearch", "placeholder", "onSelect", "filterNode", "operation", "header", "footer", "height", "filterKeepParents"];
|
|
2
|
+
_excluded2 = ["data", "showSearch", "placeholder", "onSelect", "filterNode", "operation", "header", "footer", "height", "filterKeepParents", "filterKeepDescendants", "highlightKeywords"];
|
|
3
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -74,6 +74,8 @@ export default function SiderTree(props) {
|
|
|
74
74
|
footer = props.footer,
|
|
75
75
|
heightProp = props.height,
|
|
76
76
|
filterKeepParents = props.filterKeepParents,
|
|
77
|
+
filterKeepDescendants = props.filterKeepDescendants,
|
|
78
|
+
highlightKeywords = props.highlightKeywords,
|
|
77
79
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
78
80
|
var _useState = useState(''),
|
|
79
81
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -87,47 +89,70 @@ export default function SiderTree(props) {
|
|
|
87
89
|
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
88
90
|
SiderTreeLocale = _useLocaleReceiver2[0];
|
|
89
91
|
var tree = useMemo(function () {
|
|
90
|
-
var list = mData;
|
|
91
|
-
var items = new Set();
|
|
92
|
-
var addedNodes = new Set();
|
|
93
92
|
var shouldInclude = function shouldInclude(item) {
|
|
94
93
|
return filterNode ? filterNode(keywords, item) : item.title.toString().toLowerCase().includes(keywords.toLowerCase());
|
|
95
94
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
95
|
+
var matchedNodes = new Set();
|
|
96
|
+
var childrenIndex = new Map();
|
|
97
|
+
var nodesIndex = new Map();
|
|
98
|
+
var addedNodes = new Set();
|
|
99
|
+
var roots = [];
|
|
100
|
+
mData.forEach(function (item) {
|
|
101
|
+
var node = {
|
|
101
102
|
key: item.key,
|
|
102
103
|
parent: item.parent,
|
|
103
104
|
icon: item.icon,
|
|
104
105
|
data: item,
|
|
105
106
|
title: item.title
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
};
|
|
108
|
+
nodesIndex.set(item.key, node);
|
|
109
|
+
if (item.parent !== undefined) {
|
|
110
|
+
var children = childrenIndex.get(item.parent) || [];
|
|
111
|
+
children.push(node);
|
|
112
|
+
childrenIndex.set(item.parent, children);
|
|
113
|
+
}
|
|
114
|
+
if (!keywords || shouldInclude(item)) {
|
|
115
|
+
matchedNodes.add(node);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var collectAncestors = function collectAncestors(node) {
|
|
119
|
+
if (addedNodes.has(node.key)) {
|
|
110
120
|
return;
|
|
111
121
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (parent) {
|
|
120
|
-
parent.children = parent.children || [];
|
|
121
|
-
parent.children.push(node);
|
|
122
|
+
addedNodes.add(node.key);
|
|
123
|
+
if (node.parent !== undefined) {
|
|
124
|
+
var parentNode = nodesIndex.get(node.parent);
|
|
125
|
+
if (parentNode && (matchedNodes.has(parentNode) || filterKeepParents)) {
|
|
126
|
+
parentNode.children = parentNode.children || [];
|
|
127
|
+
parentNode.children.push(node);
|
|
128
|
+
collectAncestors(parentNode);
|
|
122
129
|
} else {
|
|
123
|
-
|
|
130
|
+
roots.push(node);
|
|
124
131
|
}
|
|
125
|
-
|
|
126
|
-
node
|
|
132
|
+
} else {
|
|
133
|
+
roots.push(node);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var collectChildren = function collectChildren(node) {
|
|
137
|
+
var children = childrenIndex.get(node.key) || [];
|
|
138
|
+
node.children = node.children || [];
|
|
139
|
+
children.forEach(function (child) {
|
|
140
|
+
if (addedNodes.has(child.key)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
node.children.push(child);
|
|
144
|
+
addedNodes.add(child.key);
|
|
145
|
+
collectChildren(child);
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
_toConsumableArray(matchedNodes).forEach(function (item) {
|
|
149
|
+
collectAncestors(item);
|
|
150
|
+
if (filterKeepDescendants) {
|
|
151
|
+
collectChildren(item);
|
|
127
152
|
}
|
|
128
153
|
});
|
|
129
|
-
return
|
|
130
|
-
}, [mData, keywords, filterKeepParents]);
|
|
154
|
+
return roots;
|
|
155
|
+
}, [mData, keywords, filterKeepParents, filterKeepDescendants]);
|
|
131
156
|
var handleChange = useDebounce(function (value) {
|
|
132
157
|
setKeywords(value);
|
|
133
158
|
}, 300);
|
|
@@ -156,7 +181,8 @@ export default function SiderTree(props) {
|
|
|
156
181
|
return /*#__PURE__*/React.createElement(TreeNodeTitle, {
|
|
157
182
|
operation: operation,
|
|
158
183
|
node: node.data,
|
|
159
|
-
prefixCls: prefixCls
|
|
184
|
+
prefixCls: prefixCls,
|
|
185
|
+
highlightKeywords: highlightKeywords ? keywords : undefined
|
|
160
186
|
});
|
|
161
187
|
},
|
|
162
188
|
onSelect: function onSelect(keys, info) {
|
|
@@ -8,10 +8,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import { Popover } from 'antd';
|
|
12
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
11
|
+
import { Popover, Typography } from 'antd';
|
|
12
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
13
13
|
import { useLocaleReceiver } from "../locale-receiver";
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
+
var Text = Typography.Text;
|
|
15
16
|
export default function TreeNodeTitle(props) {
|
|
16
17
|
var _operation$others;
|
|
17
18
|
var item = props.node,
|
|
@@ -46,17 +47,31 @@ export default function TreeNodeTitle(props) {
|
|
|
46
47
|
title = null;
|
|
47
48
|
};
|
|
48
49
|
}, []);
|
|
50
|
+
var title = useMemo(function () {
|
|
51
|
+
if (!props.highlightKeywords) {
|
|
52
|
+
return item.title;
|
|
53
|
+
}
|
|
54
|
+
var searchValue = props.highlightKeywords;
|
|
55
|
+
var strTitle = item.title.toString();
|
|
56
|
+
var index = strTitle.indexOf(searchValue);
|
|
57
|
+
if (index === -1) {
|
|
58
|
+
return strTitle;
|
|
59
|
+
}
|
|
60
|
+
return /*#__PURE__*/React.createElement("span", null, strTitle.slice(0, index), /*#__PURE__*/React.createElement(Text, {
|
|
61
|
+
type: "danger"
|
|
62
|
+
}, strTitle.substring(index, index + searchValue.length)), strTitle.slice(index + searchValue.length));
|
|
63
|
+
}, [item.title, props.highlightKeywords]);
|
|
49
64
|
if (!operation) {
|
|
50
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
66
|
className: "".concat(prefixCls, "-title-content")
|
|
52
|
-
},
|
|
67
|
+
}, title);
|
|
53
68
|
}
|
|
54
69
|
var others = (_operation$others = operation.others) === null || _operation$others === void 0 ? void 0 : _operation$others.call(operation, item);
|
|
55
70
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
56
71
|
className: "".concat(prefixCls, "-title-content"),
|
|
57
72
|
ref: trigger,
|
|
58
73
|
title: item.title.toString()
|
|
59
|
-
},
|
|
74
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
60
75
|
className: "".concat(prefixCls, "-title-operators"),
|
|
61
76
|
style: {
|
|
62
77
|
display: visible || show ? 'block' : 'none'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.4.22-alpha.
|
|
3
|
+
"version": "1.4.22-alpha.5",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"registry": "https://registry.npmjs.org"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "0c4dc48dacd31fd903bbcbad684f4da20b51b543"
|
|
62
62
|
}
|