fan-standard-comp 3.2.10 → 3.2.12
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/dist/fan-standard-comp.umd.js +150 -150
- package/es/FormComp/FieldComponent/RefactorTreeSelect.d.ts +4 -0
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +96 -202
- package/es/FormComp/FieldComponent/index.js +1 -1
- package/es/RefactorTree/util.d.ts +4 -3
- package/es/RefactorTree/util.js +52 -8
- package/es/hooks/use-language.d.ts +2 -0
- package/es/hooks/use-language.js +44 -0
- package/es/hooks/use-throttle.d.ts +1 -0
- package/es/hooks/use-throttle.js +33 -0
- package/es/locales/bn-BD/settings.d.ts +34 -0
- package/es/locales/bn-BD/settings.js +36 -0
- package/es/locales/bn-BD.d.ts +35 -0
- package/es/locales/bn-BD.js +4 -0
- package/es/locales/en-US/settings.d.ts +34 -0
- package/es/locales/en-US/settings.js +36 -0
- package/es/locales/en-US.d.ts +35 -0
- package/es/locales/en-US.js +4 -0
- package/es/locales/fa-IR/settings.d.ts +34 -0
- package/es/locales/fa-IR/settings.js +36 -0
- package/es/locales/fa-IR.d.ts +35 -0
- package/es/locales/fa-IR.js +4 -0
- package/es/locales/id-ID/settings.d.ts +34 -0
- package/es/locales/id-ID/settings.js +36 -0
- package/es/locales/id-ID.d.ts +35 -0
- package/es/locales/id-ID.js +4 -0
- package/es/locales/ja-JP/settings.d.ts +33 -0
- package/es/locales/ja-JP/settings.js +35 -0
- package/es/locales/ja-JP.d.ts +34 -0
- package/es/locales/ja-JP.js +4 -0
- package/es/locales/pt-BR/settings.d.ts +34 -0
- package/es/locales/pt-BR/settings.js +36 -0
- package/es/locales/pt-BR.d.ts +35 -0
- package/es/locales/pt-BR.js +4 -0
- package/es/locales/zh-CN/settings.d.ts +34 -0
- package/es/locales/zh-CN/settings.js +36 -0
- package/es/locales/zh-CN.d.ts +35 -0
- package/es/locales/zh-CN.js +4 -0
- package/es/locales/zh-TW/settings.d.ts +34 -0
- package/es/locales/zh-TW/settings.js +36 -0
- package/es/locales/zh-TW.d.ts +34 -0
- package/es/locales/zh-TW.js +2 -0
- package/es/utils/getParentNodes.d.ts +109 -0
- package/es/utils/getParentNodes.js +119 -20
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.d.ts +4 -0
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +94 -199
- package/lib/FormComp/FieldComponent/index.js +1 -1
- package/lib/RefactorTree/util.d.ts +4 -3
- package/lib/RefactorTree/util.js +51 -9
- package/lib/hooks/use-language.d.ts +2 -0
- package/lib/hooks/use-language.js +51 -0
- package/lib/hooks/use-throttle.d.ts +1 -0
- package/lib/hooks/use-throttle.js +38 -0
- package/lib/locales/bn-BD/settings.d.ts +34 -0
- package/lib/locales/bn-BD/settings.js +42 -0
- package/lib/locales/bn-BD.d.ts +35 -0
- package/lib/locales/bn-BD.js +11 -0
- package/lib/locales/en-US/settings.d.ts +34 -0
- package/lib/locales/en-US/settings.js +42 -0
- package/lib/locales/en-US.d.ts +35 -0
- package/lib/locales/en-US.js +11 -0
- package/lib/locales/fa-IR/settings.d.ts +34 -0
- package/lib/locales/fa-IR/settings.js +42 -0
- package/lib/locales/fa-IR.d.ts +35 -0
- package/lib/locales/fa-IR.js +11 -0
- package/lib/locales/id-ID/settings.d.ts +34 -0
- package/lib/locales/id-ID/settings.js +42 -0
- package/lib/locales/id-ID.d.ts +35 -0
- package/lib/locales/id-ID.js +11 -0
- package/lib/locales/ja-JP/settings.d.ts +33 -0
- package/lib/locales/ja-JP/settings.js +41 -0
- package/lib/locales/ja-JP.d.ts +34 -0
- package/lib/locales/ja-JP.js +11 -0
- package/lib/locales/pt-BR/settings.d.ts +34 -0
- package/lib/locales/pt-BR/settings.js +42 -0
- package/lib/locales/pt-BR.d.ts +35 -0
- package/lib/locales/pt-BR.js +11 -0
- package/lib/locales/zh-CN/settings.d.ts +34 -0
- package/lib/locales/zh-CN/settings.js +42 -0
- package/lib/locales/zh-CN.d.ts +35 -0
- package/lib/locales/zh-CN.js +11 -0
- package/lib/locales/zh-TW/settings.d.ts +34 -0
- package/lib/locales/zh-TW/settings.js +42 -0
- package/lib/locales/zh-TW.d.ts +34 -0
- package/lib/locales/zh-TW.js +9 -0
- package/lib/utils/getParentNodes.d.ts +109 -0
- package/lib/utils/getParentNodes.js +118 -22
- package/package.json +1 -1
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
import "antd/es/popover/style";
|
|
3
|
-
import _Popover from "antd/es/popover";
|
|
4
|
-
import "antd/es/tag/style";
|
|
5
|
-
import _Tag from "antd/es/tag";
|
|
6
1
|
import "antd/es/tree-select/style";
|
|
7
2
|
import _TreeSelect from "antd/es/tree-select";
|
|
8
|
-
var _excluded = ["treeData", "value", "showFullLevel", "separator", "disabled", "disabledFields", "fieldStatus", "treeOptionName", "placeholder", "protoTreeNode", "onSelect", "labelInValue"];
|
|
9
|
-
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
10
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
3
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
5
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
20
7
|
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; } }
|
|
21
8
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import React, { useRef, useState, useEffect } from "react";
|
|
9
|
+
import { __rest } from "tslib";
|
|
10
|
+
import React, { useMemo, useState } from "react";
|
|
25
11
|
import './style/index.less';
|
|
26
|
-
import
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import _ from 'lodash';
|
|
14
|
+
import { getParentNodes, getNodePaths } from '../../utils';
|
|
27
15
|
import { UpOutlined, DownOutlined } from "@ant-design/icons";
|
|
28
|
-
|
|
16
|
+
import { transDataParam } from '../../RefactorTree/util';
|
|
17
|
+
import { useLanguageObject } from "../../hooks/use-language";
|
|
29
18
|
var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
30
19
|
var _props$treeData = props.treeData,
|
|
31
20
|
treeData = _props$treeData === void 0 ? [] : _props$treeData,
|
|
@@ -39,6 +28,7 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
39
28
|
_props$treeOptionName = props.treeOptionName,
|
|
40
29
|
treeOptionName = _props$treeOptionName === void 0 ? {
|
|
41
30
|
title: 'title',
|
|
31
|
+
label: 'label',
|
|
42
32
|
value: 'value',
|
|
43
33
|
children: 'children',
|
|
44
34
|
disabled: 'disabled'
|
|
@@ -47,220 +37,124 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
47
37
|
protoTreeNode = props.protoTreeNode,
|
|
48
38
|
_onSelect = props.onSelect,
|
|
49
39
|
labelInValue = props.labelInValue,
|
|
50
|
-
otherProps =
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
console.log(convertToArray(treeData))
|
|
66
|
-
// 还需要按showCheckedStrategy判断选择的节点数量
|
|
67
|
-
otherProps?.onChange(convertToArray(treeData).map(item=> item[treeOptionName.value]))
|
|
68
|
-
} else {
|
|
69
|
-
otherProps?.onChange([])
|
|
70
|
-
}
|
|
71
|
-
}*/
|
|
72
|
-
|
|
73
|
-
var _renderTreeNode = function renderTreeNode(data, dataOptionName) {
|
|
74
|
-
var nodeProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
75
|
-
return data.map(function (dataItem) {
|
|
76
|
-
var prevDataItem = _objectSpread({}, dataItem);
|
|
77
|
-
var item = _extends({}, (_objectDestructuringEmpty(prevDataItem), prevDataItem));
|
|
78
|
-
// 筛选与禁用字段内值相同的节点进行禁用
|
|
79
|
-
var resetByDisabledFields = function resetByDisabledFields(initItem) {
|
|
80
|
-
var oldItem = _objectSpread({}, initItem);
|
|
81
|
-
var nodeItem = _extends({}, (_objectDestructuringEmpty(oldItem), oldItem));
|
|
82
|
-
Object.keys(nodeItem).forEach(function (itemKeyName) {
|
|
83
|
-
var isMatch = disabledFields.find(function (fItem) {
|
|
84
|
-
return fItem.key === itemKeyName;
|
|
85
|
-
});
|
|
86
|
-
if (isMatch) {
|
|
87
|
-
var _isMatch$value$split;
|
|
88
|
-
// 确认是否匹配数据,进行设置 disabled
|
|
89
|
-
if ((_isMatch$value$split = isMatch.value.split(',')) === null || _isMatch$value$split === void 0 ? void 0 : _isMatch$value$split.includes(nodeItem[itemKeyName])) {
|
|
90
|
-
nodeItem.disabled = true;
|
|
91
|
-
} else if (nodeItem.hasOwnProperty(dataOptionName.disabled || 'disabled')) {
|
|
92
|
-
nodeItem.disabled = nodeItem[dataOptionName.disabled || 'disabled'];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return nodeItem;
|
|
97
|
-
};
|
|
98
|
-
if (disabledFields && Array.isArray(disabledFields)) {
|
|
99
|
-
item = resetByDisabledFields(item);
|
|
100
|
-
}
|
|
101
|
-
if (item[dataOptionName.children] && item[dataOptionName.children].length > 0) {
|
|
102
|
-
return /*#__PURE__*/React.createElement(TreeNode, _extends({
|
|
103
|
-
title: item[dataOptionName.title],
|
|
104
|
-
key: item[dataOptionName.value],
|
|
105
|
-
value: item[dataOptionName.value],
|
|
106
|
-
selectable: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.selectable) || 'selectable'],
|
|
107
|
-
checkable: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.checkable) || 'checkable'],
|
|
108
|
-
disableCheckbox: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.disableCheckbox) || 'disableCheckbox'],
|
|
109
|
-
disabled: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.disabled) || 'disabled']
|
|
110
|
-
}, nodeProps), _renderTreeNode(item[dataOptionName.children], dataOptionName));
|
|
111
|
-
}
|
|
112
|
-
return /*#__PURE__*/React.createElement(TreeNode, _extends({
|
|
113
|
-
title: item[dataOptionName.title],
|
|
114
|
-
key: item[dataOptionName.value],
|
|
115
|
-
value: item[dataOptionName.value],
|
|
116
|
-
selectable: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.selectable) || 'selectable'],
|
|
117
|
-
checkable: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.checkable) || 'checkable'],
|
|
118
|
-
disableCheckbox: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.disableCheckbox) || 'disableCheckbox'],
|
|
119
|
-
disabled: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.disabled) || 'disabled']
|
|
120
|
-
}, nodeProps));
|
|
121
|
-
});
|
|
40
|
+
otherProps = __rest(props, ["treeData", "value", "showFullLevel", "separator", "disabled", "disabledFields", "fieldStatus", "treeOptionName", "placeholder", "protoTreeNode", "onSelect", "labelInValue"]);
|
|
41
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
42
|
+
var componentName = 'refactor-tree-select';
|
|
43
|
+
// 重组数据
|
|
44
|
+
var transTreeData = useMemo(function () {
|
|
45
|
+
var newTree = _.cloneDeep(treeData || []);
|
|
46
|
+
return transDataParam(newTree, (otherProps === null || otherProps === void 0 ? void 0 : otherProps.fieldNames) || treeOptionName, {
|
|
47
|
+
separator: separator,
|
|
48
|
+
disabledFields: disabledFields
|
|
49
|
+
}); // 通过转换后的数据
|
|
50
|
+
}, [treeData, treeOptionName, otherProps.fieldNames, separator, disabledFields]);
|
|
51
|
+
// 设置名称字段值
|
|
52
|
+
var setLabelKeyName = function setLabelKeyName() {
|
|
53
|
+
var _a;
|
|
54
|
+
return showFullLevelKeyName || ((_a = otherProps.fieldNames) === null || _a === void 0 ? void 0 : _a.label) || treeOptionName.title || treeOptionName.label;
|
|
122
55
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else {
|
|
132
|
-
// value,无值时
|
|
133
|
-
setFullLevelName(null);
|
|
134
|
-
}
|
|
135
|
-
}, [value, treeData, fieldStatus]);
|
|
136
|
-
var renderParenName = function renderParenName(selectNodeInfo) {
|
|
137
|
-
// 有父级节点,及当前模式是showFullLevel时,渲染名称为完整层级名称,否则为当前节点名称
|
|
138
|
-
var parentItems = selectNodeInfo.nodeParent;
|
|
139
|
-
if (parentItems.length > 0 && showFullLevel && !otherProps.showCheckedStrategy) {
|
|
140
|
-
// 当前查找到的父级节点拼合当前节点的标题字段值进行显示
|
|
141
|
-
return parentItems.reverse().map(function (item) {
|
|
142
|
-
return item[treeOptionName.title];
|
|
143
|
-
}).concat(selectNodeInfo.matchNode[0][treeOptionName.title]).join(separator);
|
|
144
|
-
}
|
|
145
|
-
if (Array.isArray(value)) {
|
|
146
|
-
return selectNodeInfo.matchNode.length > 0 ? selectNodeInfo.matchNode.map(function (item) {
|
|
147
|
-
return item[treeOptionName.title] || item[treeOptionName.value];
|
|
148
|
-
}).join(',') : null;
|
|
149
|
-
}
|
|
150
|
-
return selectNodeInfo.matchNode.length > 0 ? selectNodeInfo.matchNode[0][treeOptionName.title] : null;
|
|
151
|
-
};
|
|
152
|
-
var renderTreeSelectNode = function renderTreeSelectNode() {
|
|
153
|
-
// 限制显示多个tag
|
|
154
|
-
if (otherProps.treeCheckable && otherProps.maxTagCount) {
|
|
155
|
-
// 未自行配置`maxTagPlaceholder`时,使用当前结构,点击"+xxx"后,浮层将显示对应的标签
|
|
156
|
-
if (!otherProps.hasOwnProperty('maxTagPlaceholder')) {
|
|
157
|
-
otherProps.maxTagPlaceholder = function (omittedValues) {
|
|
158
|
-
return /*#__PURE__*/React.createElement(_Popover, {
|
|
159
|
-
zIndex: 10000,
|
|
160
|
-
content: /*#__PURE__*/React.createElement("div", {
|
|
161
|
-
style: {
|
|
162
|
-
maxWidth: '350px'
|
|
163
|
-
}
|
|
164
|
-
}, omittedValues.map(function (item) {
|
|
165
|
-
return /*#__PURE__*/React.createElement(_Tag, {
|
|
166
|
-
key: item.value
|
|
167
|
-
}, item.label);
|
|
168
|
-
}))
|
|
169
|
-
}, "+", omittedValues.length);
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return /*#__PURE__*/React.createElement(_TreeSelect, _extends({
|
|
174
|
-
placeholder: placeholder,
|
|
175
|
-
value: value,
|
|
176
|
-
ref: ref
|
|
177
|
-
}, otherProps, {
|
|
178
|
-
labelInValue: labelInValue,
|
|
179
|
-
title: otherProps.title || ((disabled || fieldStatus === 'disabled') && !otherProps.treeCheckable ? fullLevelName : null),
|
|
180
|
-
showCheckedStrategy: otherProps.showCheckedStrategy,
|
|
181
|
-
disabled: disabled,
|
|
182
|
-
onSelect: function onSelect(value, node, extra) {
|
|
183
|
-
var newNodeInfo = getParentNodes(treeData, value, {
|
|
184
|
-
childrenParam: treeOptionName.children,
|
|
185
|
-
keyParam: treeOptionName.value
|
|
186
|
-
});
|
|
187
|
-
setFullLevelName(renderParenName(newNodeInfo));
|
|
188
|
-
if (_onSelect) _onSelect(value, _objectSpread(_objectSpread({}, node), newNodeInfo.matchNode[0]), extra, newNodeInfo.nodeParent);
|
|
189
|
-
}
|
|
190
|
-
// 下拉浮层中显示"全选"按钮
|
|
191
|
-
// dropdownRender={(originNode) => {
|
|
192
|
-
// return otherProps?.dropdownRender ? otherProps?.dropdownRender(originNode, <div>
|
|
193
|
-
// <div>
|
|
194
|
-
// <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
|
|
195
|
-
// 全选
|
|
196
|
-
// </Checkbox> <span>已选{value?.length}</span></div>
|
|
197
|
-
// </div>) : originNode
|
|
198
|
-
// }}
|
|
199
|
-
}), _renderTreeNode(treeData, treeOptionName, protoTreeNode || {}));
|
|
200
|
-
};
|
|
201
|
-
var _useState3 = useState(false),
|
|
202
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
203
|
-
showAllPath = _useState4[0],
|
|
204
|
-
setShowAllPath = _useState4[1]; // 显示所有树选择路径
|
|
56
|
+
// 判断是否指定显示完整名称
|
|
57
|
+
var showFullLevelKeyName = useMemo(function () {
|
|
58
|
+
return showFullLevel ? 'treeFullLevelName' : otherProps === null || otherProps === void 0 ? void 0 : otherProps.treeNodeLabelProp;
|
|
59
|
+
}, [showFullLevel, otherProps === null || otherProps === void 0 ? void 0 : otherProps.treeNodeLabelProp]);
|
|
60
|
+
var _useState = useState(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
showAllPath = _useState2[0],
|
|
63
|
+
setShowAllPath = _useState2[1]; // 显示所有树选择路径
|
|
205
64
|
var renderTreeSelectNodePath = function renderTreeSelectNodePath() {
|
|
206
65
|
//获取节点路径
|
|
207
|
-
var pathNodes = getNodePaths(
|
|
66
|
+
var pathNodes = getNodePaths(transTreeData, value, {
|
|
208
67
|
childrenParam: treeOptionName.children,
|
|
209
68
|
keyParam: treeOptionName.value
|
|
210
|
-
},
|
|
69
|
+
}, Object.assign({}, otherProps));
|
|
211
70
|
var togglePath = function togglePath() {
|
|
212
71
|
setShowAllPath(!showAllPath);
|
|
213
72
|
};
|
|
214
73
|
if (pathNodes.length > 0) {
|
|
215
74
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
216
75
|
className: "tree-select-viewonly-list ".concat(showAllPath ? 'collapsed' : '')
|
|
217
|
-
},
|
|
76
|
+
},
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
pathNodes.map(function (item, index) {
|
|
218
79
|
if (item.length > 0) {
|
|
219
80
|
// 超过2个且不显示所有
|
|
220
|
-
if (index > 1 && !showAllPath) return;
|
|
81
|
+
if (index > 1 && !showAllPath) return '';
|
|
221
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
222
83
|
className: 'tree-select-viewonly-item',
|
|
223
84
|
key: index
|
|
224
85
|
}, /*#__PURE__*/React.createElement("b", null, "\xB7 "), item.map(function (i) {
|
|
225
|
-
return i[
|
|
86
|
+
return i[setLabelKeyName()];
|
|
226
87
|
}).join(separator));
|
|
227
88
|
}
|
|
228
|
-
}), pathNodes.length > 2 ? /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
}), pathNodes.length > 2 ? (/*#__PURE__*/React.createElement("div", {
|
|
229
90
|
className: "toggle-icon",
|
|
230
91
|
onClick: togglePath
|
|
231
|
-
}, !showAllPath ? /*#__PURE__*/React.createElement(React.Fragment, null, "
|
|
92
|
+
}, !showAllPath ? /*#__PURE__*/React.createElement(React.Fragment, null, (lang === null || lang === void 0 ? void 0 : lang['field.expand']) || '展开', " ", /*#__PURE__*/React.createElement(DownOutlined, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, (lang === null || lang === void 0 ? void 0 : lang['field.collapse']) || '收起', " ", /*#__PURE__*/React.createElement(UpOutlined, null)))) : null));
|
|
232
93
|
} else {
|
|
233
94
|
return '-';
|
|
234
95
|
}
|
|
235
96
|
};
|
|
236
97
|
if (fieldStatus === 'viewOnly') {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: classNames(componentName, otherProps === null || otherProps === void 0 ? void 0 : otherProps.className, componentName + '-viewOnly')
|
|
100
|
+
}, function () {
|
|
101
|
+
var _a;
|
|
102
|
+
//多选下拉框 详情展示 showCheckedStrategy 有值且显示完整路径时
|
|
103
|
+
if (otherProps.showCheckedStrategy && showFullLevelKeyName) {
|
|
104
|
+
return renderTreeSelectNodePath();
|
|
105
|
+
}
|
|
106
|
+
// 多选状态
|
|
107
|
+
if (otherProps.multiple) {
|
|
108
|
+
if (labelInValue) {
|
|
109
|
+
return value && value.length > 0 ? value.map(function (item) {
|
|
110
|
+
return item[setLabelKeyName()] || item['title'] || item['label'];
|
|
111
|
+
}).join(',') : '-';
|
|
112
|
+
}
|
|
113
|
+
var pathNodes = getNodePaths(transTreeData, value, {
|
|
114
|
+
childrenParam: treeOptionName.children,
|
|
115
|
+
keyParam: treeOptionName.value
|
|
116
|
+
}, Object.assign({}, otherProps));
|
|
117
|
+
return pathNodes.length > 0 ? pathNodes.map(function (nItem) {
|
|
118
|
+
var _a;
|
|
119
|
+
return (_a = nItem[nItem.length - 1]) === null || _a === void 0 ? void 0 : _a[setLabelKeyName()];
|
|
246
120
|
}).join(',') : '-';
|
|
247
121
|
}
|
|
248
|
-
var
|
|
122
|
+
var nodeInfo = getParentNodes(transTreeData, labelInValue ? value.value : value, {
|
|
249
123
|
childrenParam: treeOptionName.children,
|
|
250
124
|
keyParam: treeOptionName.value
|
|
251
|
-
},
|
|
252
|
-
return
|
|
253
|
-
|
|
254
|
-
return (_nItem = nItem[nItem.length - 1]) === null || _nItem === void 0 ? void 0 : _nItem[treeOptionName.title];
|
|
255
|
-
}).join(',') : '-';
|
|
256
|
-
}
|
|
257
|
-
return fullLevelName || '-'; // 只读显示时,只返回文本
|
|
125
|
+
}, Object.assign({}, otherProps));
|
|
126
|
+
return ((_a = nodeInfo === null || nodeInfo === void 0 ? void 0 : nodeInfo.matchNode[0]) === null || _a === void 0 ? void 0 : _a[setLabelKeyName()]) || '-'; // 只读显示时,只返回文本
|
|
127
|
+
}());
|
|
258
128
|
}
|
|
259
|
-
return /*#__PURE__*/React.createElement(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
129
|
+
return /*#__PURE__*/React.createElement(_TreeSelect, Object.assign({
|
|
130
|
+
placeholder: placeholder,
|
|
131
|
+
value: value,
|
|
132
|
+
ref: ref
|
|
133
|
+
}, otherProps, {
|
|
134
|
+
treeNodeLabelProp: showFullLevel ? 'treeFullLevelName' : otherProps === null || otherProps === void 0 ? void 0 : otherProps.treeNodeLabelProp,
|
|
135
|
+
className: classNames(componentName, otherProps === null || otherProps === void 0 ? void 0 : otherProps.className),
|
|
136
|
+
labelInValue: labelInValue,
|
|
137
|
+
showCheckedStrategy: otherProps.showCheckedStrategy,
|
|
138
|
+
disabled: disabled,
|
|
139
|
+
onSelect: function onSelect(value, node, extra) {
|
|
140
|
+
var newNodeInfo = getParentNodes(transTreeData, value, {
|
|
141
|
+
childrenParam: treeOptionName.children,
|
|
142
|
+
keyParam: treeOptionName.value
|
|
143
|
+
});
|
|
144
|
+
if (_onSelect) _onSelect(value, Object.assign(Object.assign({}, node), newNodeInfo.matchNode[0]), extra, newNodeInfo.nodeParent);
|
|
145
|
+
},
|
|
146
|
+
onDropdownVisibleChange: function onDropdownVisibleChange(open) {
|
|
147
|
+
var _a;
|
|
148
|
+
(_a = otherProps === null || otherProps === void 0 ? void 0 : otherProps.onDropdownVisibleChange) === null || _a === void 0 ? void 0 : _a.call(otherProps, open);
|
|
149
|
+
},
|
|
150
|
+
onSearch: function onSearch(value) {
|
|
151
|
+
var _a;
|
|
152
|
+
(_a = otherProps === null || otherProps === void 0 ? void 0 : otherProps.onSearch) === null || _a === void 0 ? void 0 : _a.call(otherProps, value);
|
|
153
|
+
},
|
|
154
|
+
treeData: transTreeData,
|
|
155
|
+
fieldNames: Object.assign(Object.assign(Object.assign({}, treeOptionName), {
|
|
156
|
+
label: (treeOptionName === null || treeOptionName === void 0 ? void 0 : treeOptionName.title) || (treeOptionName === null || treeOptionName === void 0 ? void 0 : treeOptionName.label)
|
|
157
|
+
}), (otherProps === null || otherProps === void 0 ? void 0 : otherProps.fieldNames) || {})
|
|
158
|
+
}));
|
|
265
159
|
});
|
|
266
160
|
export default RefactorTreeSelect;
|
|
@@ -27,7 +27,7 @@ import _Input from "antd/es/input";
|
|
|
27
27
|
import React, { useContext } from "react";
|
|
28
28
|
import Uploader from '../Uploader';
|
|
29
29
|
import SpecIcon from '../../SpecIcon';
|
|
30
|
-
import RefactorTreeSelect from './RefactorTreeSelect
|
|
30
|
+
import RefactorTreeSelect from './RefactorTreeSelect';
|
|
31
31
|
import { setSelectValue, setDatePickerValue, setTimePickerValue, setCascaderValue } from './setReadonlyValues.js';
|
|
32
32
|
import TitleNode from './TitleNode';
|
|
33
33
|
import ReUpload from './ReUpload';
|
|
@@ -5,15 +5,16 @@ interface optionNameProps {
|
|
|
5
5
|
children?: string;
|
|
6
6
|
disabled?: string;
|
|
7
7
|
selectable?: string;
|
|
8
|
+
label?: string;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* transDataParam 根据指定选项字段名重组数据
|
|
11
12
|
*
|
|
12
13
|
* @params {array} array 树数据集合
|
|
13
|
-
* @params {object} optionName 选项字段值
|
|
14
|
+
* @params {object} optionName 选项字段值(tree-select的标题使用的是label字段)
|
|
14
15
|
*
|
|
15
16
|
* */
|
|
16
|
-
export declare function transDataParam(array
|
|
17
|
+
export declare function transDataParam(array: any[], optionName?: optionNameProps, extra?: any): any[];
|
|
17
18
|
/**
|
|
18
19
|
* 根据限制字段limitKey进行重组数据
|
|
19
20
|
*
|
|
@@ -25,7 +26,7 @@ export declare function transDataParam(array?: any[], optionName?: optionNamePro
|
|
|
25
26
|
* @Return {array} 返回结果数据
|
|
26
27
|
*
|
|
27
28
|
* */
|
|
28
|
-
export declare function resetDataWithLimit(hasKeys: any[], list: any[], optionName
|
|
29
|
+
export declare function resetDataWithLimit(hasKeys: any[], list: any[], optionName: optionNameProps, limitKey: string): any[];
|
|
29
30
|
/**
|
|
30
31
|
* 根据指定禁用字段 disabledFields 进行重组数据
|
|
31
32
|
*
|
package/es/RefactorTree/util.js
CHANGED
|
@@ -5,11 +5,14 @@ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Sym
|
|
|
5
5
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
7
|
import { __rest } from "tslib";
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
// import * as React from 'react';
|
|
10
|
+
import { getNodePaths, getParentNodes } from '../utils/getParentNodes';
|
|
8
11
|
/**
|
|
9
12
|
* transDataParam 根据指定选项字段名重组数据
|
|
10
13
|
*
|
|
11
14
|
* @params {array} array 树数据集合
|
|
12
|
-
* @params {object} optionName 选项字段值
|
|
15
|
+
* @params {object} optionName 选项字段值(tree-select的标题使用的是label字段)
|
|
13
16
|
*
|
|
14
17
|
* */
|
|
15
18
|
export function transDataParam(array) {
|
|
@@ -17,29 +20,70 @@ export function transDataParam(array) {
|
|
|
17
20
|
key: 'key',
|
|
18
21
|
value: 'key',
|
|
19
22
|
title: 'title',
|
|
23
|
+
label: 'label',
|
|
20
24
|
children: 'children',
|
|
21
25
|
disabled: 'disabled',
|
|
22
26
|
selectable: 'selectable'
|
|
23
27
|
};
|
|
28
|
+
var extra = arguments.length > 2 ? arguments[2] : undefined;
|
|
24
29
|
var _trans = function trans(list) {
|
|
25
|
-
if (!list) return
|
|
30
|
+
if (!list) return [];
|
|
26
31
|
return list.map(function (item) {
|
|
27
32
|
if (item.hasOwnProperty(optionName.disabled || 'disabled')) {
|
|
28
|
-
item.disabled = item[optionName.disabled || 'disabled'];
|
|
33
|
+
item[optionName.disabled || 'disabled'] = item[optionName.disabled || 'disabled'];
|
|
29
34
|
}
|
|
30
35
|
if (item.hasOwnProperty(optionName.selectable || 'selectable')) {
|
|
31
|
-
item.selectable = item[optionName.selectable || 'selectable'];
|
|
36
|
+
item[optionName.selectable || 'selectable'] = item[optionName.selectable || 'selectable'];
|
|
32
37
|
}
|
|
33
38
|
if (item.hasOwnProperty(optionName.children || 'children')) {
|
|
34
39
|
item.children = item[optionName.children || 'children'] ? _trans(item[optionName.children || 'children']) : [];
|
|
40
|
+
item[optionName.children || 'children'] = item[optionName.children || 'children'] ? _trans(item[optionName.children || 'children']) : [];
|
|
41
|
+
}
|
|
42
|
+
var newNodeInfo = getParentNodes(array, item[optionName.value || optionName.key || 'key'], {
|
|
43
|
+
childrenParam: (optionName === null || optionName === void 0 ? void 0 : optionName.children) || 'children',
|
|
44
|
+
keyParam: optionName.value || optionName.key || 'key'
|
|
45
|
+
});
|
|
46
|
+
var pathNodes = getNodePaths(array, item[optionName.value || optionName.key || 'key'], {
|
|
47
|
+
childrenParam: (optionName === null || optionName === void 0 ? void 0 : optionName.children) || 'children',
|
|
48
|
+
keyParam: optionName.value || optionName.key || 'key'
|
|
49
|
+
}, {});
|
|
50
|
+
/// disabledFields:指定禁用节点
|
|
51
|
+
var resetByDisabledFields = function resetByDisabledFields(initItem) {
|
|
52
|
+
var oldItem = Object.assign({}, initItem);
|
|
53
|
+
var nodeItem = __rest(oldItem, []);
|
|
54
|
+
Object.keys(nodeItem).forEach(function (itemKeyName) {
|
|
55
|
+
var _a;
|
|
56
|
+
var isMatch = extra.disabledFields.find(function (fItem) {
|
|
57
|
+
return fItem.key === itemKeyName;
|
|
58
|
+
});
|
|
59
|
+
if (isMatch) {
|
|
60
|
+
// 确认是否匹配数据,进行设置 disabled
|
|
61
|
+
if ((_a = isMatch.value.split(',')) === null || _a === void 0 ? void 0 : _a.includes(nodeItem[itemKeyName])) {
|
|
62
|
+
nodeItem[optionName.disabled || 'disabled'] = true;
|
|
63
|
+
} else if (nodeItem.hasOwnProperty(optionName.disabled || 'disabled')) {
|
|
64
|
+
nodeItem[optionName.disabled || 'disabled'] = nodeItem[optionName.disabled || 'disabled'];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return nodeItem;
|
|
69
|
+
};
|
|
70
|
+
if ((extra === null || extra === void 0 ? void 0 : extra.disabledFields) && Array.isArray(extra === null || extra === void 0 ? void 0 : extra.disabledFields)) {
|
|
71
|
+
item = resetByDisabledFields(item);
|
|
35
72
|
}
|
|
36
73
|
return Object.assign(Object.assign({}, item), {
|
|
37
74
|
key: item[optionName.value || optionName.key || 'key'],
|
|
38
|
-
title: item[optionName.title || 'title']
|
|
75
|
+
title: item[optionName.title || optionName.label || 'label' || 'title'],
|
|
76
|
+
label: item[optionName.title || optionName.label || 'label' || 'title'],
|
|
77
|
+
treeFullLevelNamePath: pathNodes,
|
|
78
|
+
treeFullLevelName: pathNodes.map(function (item) {
|
|
79
|
+
return item[optionName.title || optionName.label || 'label' || 'title'];
|
|
80
|
+
}).join((extra === null || extra === void 0 ? void 0 : extra.separator) || '/'),
|
|
81
|
+
treeParentKeys: newNodeInfo.parentKeys.reverse(),
|
|
82
|
+
treeParentNodes: newNodeInfo.nodeParent.reverse()
|
|
39
83
|
});
|
|
40
84
|
});
|
|
41
85
|
};
|
|
42
|
-
return _trans(array);
|
|
86
|
+
return _trans(array || []);
|
|
43
87
|
}
|
|
44
88
|
/**
|
|
45
89
|
* 根据限制字段limitKey进行重组数据
|
|
@@ -81,7 +125,7 @@ export function resetDataWithLimit(hasKeys, list) {
|
|
|
81
125
|
var _filterResetSameLevel = function filterResetSameLevel(preList, matchDataValue) {
|
|
82
126
|
if (!preList) return [];
|
|
83
127
|
if (!matchDataValue) return preList;
|
|
84
|
-
return preList
|
|
128
|
+
return (preList || []).map(function (preItem) {
|
|
85
129
|
var oldItem = Object.assign({}, preItem);
|
|
86
130
|
var item = __rest(oldItem, []);
|
|
87
131
|
if (item[limitKey] !== matchDataValue) {
|
|
@@ -128,7 +172,7 @@ export function resetDataWithDisabled(list, optionName, disabledFields) {
|
|
|
128
172
|
var item = __rest(oldItem, []);
|
|
129
173
|
Object.keys(item).forEach(function (itemKeyName) {
|
|
130
174
|
var _a;
|
|
131
|
-
var isMatch = fields.find(function (fItem) {
|
|
175
|
+
var isMatch = (fields || []).find(function (fItem) {
|
|
132
176
|
return fItem.key === itemKeyName;
|
|
133
177
|
});
|
|
134
178
|
if (isMatch) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { FanContext } from "../ConfigContext";
|
|
3
|
+
import bnBD from '../locales/bn-BD';
|
|
4
|
+
import enUS from '../locales/en-US';
|
|
5
|
+
import faIR from '../locales/fa-IR';
|
|
6
|
+
import idID from '../locales/id-ID';
|
|
7
|
+
import jaJP from '../locales/ja-JP';
|
|
8
|
+
import ptBR from '../locales/pt-BR';
|
|
9
|
+
import zhCN from '../locales/zh-CN';
|
|
10
|
+
import zhTW from '../locales/zh-TW';
|
|
11
|
+
var langCompare = {
|
|
12
|
+
'bn': 'bn-BD',
|
|
13
|
+
'en': 'en-US',
|
|
14
|
+
'fa': 'fa-IR',
|
|
15
|
+
'id': 'id-ID',
|
|
16
|
+
'ja': 'ja-JP',
|
|
17
|
+
'pt': 'pt-BR',
|
|
18
|
+
'zh-cn': 'zh-CN',
|
|
19
|
+
'zh-tw': 'zh-TW'
|
|
20
|
+
};
|
|
21
|
+
// 'bn-BD', 'en-US', 'fa-IR', 'id-ID', 'ja-JP', 'pt-BR', 'zh-CN', 'zh-TW'
|
|
22
|
+
export var renderLangObject = function renderLangObject(obj, language) {
|
|
23
|
+
if (!obj) return {};
|
|
24
|
+
if (obj === null || obj === void 0 ? void 0 : obj[language.replace('-', '')]) return obj[language.replace('-', '')];
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
if ((langCompare === null || langCompare === void 0 ? void 0 : langCompare[language]) && (obj === null || obj === void 0 ? void 0 : obj[langCompare === null || langCompare === void 0 ? void 0 : langCompare[language].replace('-', '')])) return obj[langCompare[language].replace('-', '')];
|
|
27
|
+
return obj.zhCN; // Object.values(obj)[0] // 默认使用中文
|
|
28
|
+
};
|
|
29
|
+
export var useLanguageObject = function useLanguageObject() {
|
|
30
|
+
var _a;
|
|
31
|
+
var InitFanContext = useContext(FanContext);
|
|
32
|
+
var language = ((_a = InitFanContext === null || InitFanContext === void 0 ? void 0 : InitFanContext.locale) === null || _a === void 0 ? void 0 : _a.locale) || 'zh-CN';
|
|
33
|
+
var customObj = (InitFanContext === null || InitFanContext === void 0 ? void 0 : InitFanContext.locale) || {}; // 里面可以配置扩展语言包或者替换原来的语言包
|
|
34
|
+
return renderLangObject(Object.assign({
|
|
35
|
+
zhCN: zhCN,
|
|
36
|
+
enUS: enUS,
|
|
37
|
+
bnBD: bnBD,
|
|
38
|
+
faIR: faIR,
|
|
39
|
+
idID: idID,
|
|
40
|
+
jaJP: jaJP,
|
|
41
|
+
ptBR: ptBR,
|
|
42
|
+
zhTW: zhTW
|
|
43
|
+
}, customObj), language);
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useThrottle: (callback: any, delay: any) => (boolean | ((...args: any) => void))[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
// @ts-nocheck
|
|
8
|
+
import { useCallback, useState, useRef, useEffect } from 'react';
|
|
9
|
+
// 自定义节流Hook
|
|
10
|
+
export var useThrottle = function useThrottle(callback, delay) {
|
|
11
|
+
var _useState = useState(true),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
isReady = _useState2[0],
|
|
14
|
+
setIsReady = _useState2[1];
|
|
15
|
+
var timerRef = useRef(null);
|
|
16
|
+
var throttledFn = useCallback(function () {
|
|
17
|
+
if (isReady) {
|
|
18
|
+
setIsReady(false);
|
|
19
|
+
callback === null || callback === void 0 ? void 0 : callback.apply(void 0, arguments); // 执行回调
|
|
20
|
+
//
|
|
21
|
+
timerRef.current = setTimeout(function () {
|
|
22
|
+
setIsReady(true);
|
|
23
|
+
}, delay);
|
|
24
|
+
}
|
|
25
|
+
}, [callback, delay, isReady]);
|
|
26
|
+
// 清理定时器
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
return function () {
|
|
29
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return [throttledFn, isReady]; // 返回函数和就绪状态
|
|
33
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'filed.upload.limit.tips': string;
|
|
12
|
+
'filed.upload.limit.tips.prefix': string;
|
|
13
|
+
'filed.upload.limit.tips.postfix': string;
|
|
14
|
+
'filed.upload.fileType.tips': string;
|
|
15
|
+
'filed.varTemplate.enter': string;
|
|
16
|
+
'filed.varTemplate.words': string;
|
|
17
|
+
'field.expand': string;
|
|
18
|
+
'field.collapse': string;
|
|
19
|
+
'filter.submit': string;
|
|
20
|
+
'filter.reset': string;
|
|
21
|
+
'table.order': string;
|
|
22
|
+
'table.column.action': string;
|
|
23
|
+
'table.pagination.unit': string;
|
|
24
|
+
'table.pagination.total': string;
|
|
25
|
+
'global.confirm.text': string;
|
|
26
|
+
'global.reset.text': string;
|
|
27
|
+
'global.cancel.text': string;
|
|
28
|
+
'global.empty.text': string;
|
|
29
|
+
'global.prev.text': string;
|
|
30
|
+
'global.next.text': string;
|
|
31
|
+
'global.more.text': string;
|
|
32
|
+
'global.delete.confirm': string;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|