@zat-design/sisyphus-react 3.13.6 → 3.13.7-beta.1
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/ProAction/components/CheckModalContent/index.d.ts +8 -0
- package/es/ProAction/components/CheckModalContent/index.js +44 -0
- package/es/ProAction/components/CheckModalContent/index.less +29 -0
- package/es/ProAction/index.js +38 -38
- package/es/ProAction/propsType.d.ts +7 -0
- package/es/ProTable/components/FormatColumn/index.js +4 -4
- package/es/ProTable/hooks/useAntdTable.js +28 -19
- package/es/ProTable/propsType.d.ts +2 -2
- package/es/ProTable/utils/index.js +2 -2
- package/es/ProTree/components/AdaptiveTooltip.js +4 -30
- package/es/ProTree/components/ProTree.js +0 -1
- package/es/ProTree/components/ProTreeSelect/index.js +52 -12
- package/es/locale/en_US.d.ts +1 -0
- package/es/locale/en_US.js +1 -0
- package/es/locale/zh_CN.d.ts +1 -0
- package/es/locale/zh_CN.js +1 -0
- package/lib/ProAction/components/CheckModalContent/index.d.ts +8 -0
- package/lib/ProAction/components/CheckModalContent/index.js +49 -0
- package/lib/ProAction/components/CheckModalContent/index.less +29 -0
- package/lib/ProAction/index.js +38 -38
- package/lib/ProAction/propsType.d.ts +7 -0
- package/lib/ProTable/components/FormatColumn/index.js +4 -4
- package/lib/ProTable/hooks/useAntdTable.js +25 -18
- package/lib/ProTable/propsType.d.ts +2 -2
- package/lib/ProTable/utils/index.js +2 -2
- package/lib/ProTree/components/AdaptiveTooltip.js +3 -30
- package/lib/ProTree/components/ProTree.js +0 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +51 -11
- package/lib/locale/en_US.d.ts +1 -0
- package/lib/locale/en_US.js +1 -0
- package/lib/locale/zh_CN.d.ts +1 -0
- package/lib/locale/zh_CN.js +1 -0
- package/package.json +1 -1
@@ -17,15 +17,17 @@ var _antd = require("antd");
|
|
17
17
|
var _classnames3 = _interopRequireDefault(require("classnames"));
|
18
18
|
var _react = require("react");
|
19
19
|
var _lodash = require("lodash");
|
20
|
+
var _locale = _interopRequireDefault(require("../../../locale"));
|
20
21
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
21
22
|
var _Container = _interopRequireDefault(require("../../../ProForm/components/Container"));
|
22
23
|
var _AdaptiveTooltip = _interopRequireDefault(require("../AdaptiveTooltip"));
|
23
|
-
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"],
|
24
|
+
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "placeholder", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"],
|
24
25
|
_excluded2 = ["children"];
|
25
26
|
/* eslint-disable react/no-danger */
|
26
27
|
/* eslint-disable react/jsx-closing-tag-location */
|
27
28
|
var SHOW_PARENT = _antd.TreeSelect.SHOW_PARENT;
|
28
29
|
var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
30
|
+
var _useRequest$options;
|
29
31
|
// 全局属性配置在ConfigProvider
|
30
32
|
var _ref = (0, _ProConfigProvider.useProConfig)('ProTreeSelect') || {},
|
31
33
|
_ref$fieldNames = _ref.fieldNames,
|
@@ -50,6 +52,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
50
52
|
useRequest = props.useRequest,
|
51
53
|
transformResponse = props.transformResponse,
|
52
54
|
fieldNames = props.fieldNames,
|
55
|
+
placeholder = props.placeholder,
|
53
56
|
_props$tooltip = props.tooltip,
|
54
57
|
tooltip = _props$tooltip === void 0 ? false : _props$tooltip,
|
55
58
|
_props$showSearch = props.showSearch,
|
@@ -168,11 +171,26 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
168
171
|
origDataSource: resultData || []
|
169
172
|
});
|
170
173
|
};
|
174
|
+
var successTransformDataHandle = (0, _react.useCallback)(function (res) {
|
175
|
+
if (transformResponse && typeof transformResponse === 'function') {
|
176
|
+
return transformResponse(res);
|
177
|
+
}
|
178
|
+
var _ref4 = res || {},
|
179
|
+
_ref4$status = _ref4.status,
|
180
|
+
status = _ref4$status === void 0 ? 200 : _ref4$status,
|
181
|
+
msg = _ref4.message,
|
182
|
+
data = _ref4.data;
|
183
|
+
if (status !== 200) {
|
184
|
+
_antd.message.error(msg);
|
185
|
+
return;
|
186
|
+
}
|
187
|
+
return data;
|
188
|
+
}, []);
|
171
189
|
// 配置了异步数据源,拉取枚举数据逻辑 如果有code不掉接口从local里根据code取值
|
172
190
|
var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)({
|
173
191
|
manual: true,
|
192
|
+
debounceWait: 300,
|
174
193
|
onSuccess: function onSuccess(data) {
|
175
|
-
// 用户配置了处理枚举函数
|
176
194
|
if (transformResponse && typeof transformResponse === 'function') {
|
177
195
|
var responseData = transformResponse(data);
|
178
196
|
var resultData = transferDataSource(responseData, showCodeName);
|
@@ -181,16 +199,33 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
181
199
|
origDataSource: resultData
|
182
200
|
});
|
183
201
|
} else {
|
184
|
-
defaultOnSuccessFun(data);
|
202
|
+
defaultOnSuccessFun(fetchFunction.data);
|
185
203
|
}
|
186
|
-
}
|
187
|
-
debounceWait: 300
|
204
|
+
}
|
188
205
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
206
|
+
var cacheList = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.cacheKey) ? successTransformDataHandle(fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) : [];
|
189
207
|
(0, _react.useImperativeHandle)(ref, function () {
|
190
208
|
return {
|
191
209
|
useRequestRef: fetchFunction
|
192
210
|
};
|
193
211
|
});
|
212
|
+
// 设置cacheKey后使用缓存的数据
|
213
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
214
|
+
var _useRequest$options2;
|
215
|
+
if (fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.cacheKey) {
|
216
|
+
if (transformResponse && typeof transformResponse === 'function') {
|
217
|
+
var responseData = transformResponse(fetchFunction.data);
|
218
|
+
// debugger;
|
219
|
+
var resultData = transferDataSource(responseData, showCodeName);
|
220
|
+
setState({
|
221
|
+
selectList: countChild(resultData),
|
222
|
+
origDataSource: resultData
|
223
|
+
});
|
224
|
+
} else {
|
225
|
+
defaultOnSuccessFun(fetchFunction.data);
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}, [fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data]);
|
194
229
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
195
230
|
if (enumCode) {
|
196
231
|
var dictEnum = dics[enumCode] || [];
|
@@ -212,17 +247,21 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
212
247
|
if (enumCode || dataSource) {
|
213
248
|
return undefined;
|
214
249
|
}
|
250
|
+
// 如果配置手动加载,不执行请求
|
251
|
+
var _ref5 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
252
|
+
defaultParams = _ref5.defaultParams,
|
253
|
+
manual = _ref5.manual;
|
215
254
|
// disabled 状态时,不查询接口
|
216
255
|
if (defaultDisableValue || !useRequest) {
|
217
256
|
return undefined;
|
218
257
|
}
|
219
|
-
|
220
|
-
|
221
|
-
|
258
|
+
if (manual || (cacheList === null || cacheList === void 0 ? void 0 : cacheList.length)) {
|
259
|
+
return;
|
260
|
+
}
|
222
261
|
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
223
262
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
224
263
|
fetchFunction.run(params);
|
225
|
-
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.
|
264
|
+
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options, defaultDisableValue]);
|
226
265
|
// disable默认值
|
227
266
|
if (defaultDisableValue) {
|
228
267
|
return (0, _jsxRuntime.jsx)("span", {
|
@@ -399,7 +438,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
399
438
|
return sourceList;
|
400
439
|
}
|
401
440
|
var searchTreeEvent = (0, _lodash.debounce)(/*#__PURE__*/function () {
|
402
|
-
var
|
441
|
+
var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(searchVal) {
|
403
442
|
var result;
|
404
443
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
405
444
|
while (1) switch (_context.prev = _context.next) {
|
@@ -424,7 +463,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
424
463
|
}, _callee);
|
425
464
|
}));
|
426
465
|
return function (_x) {
|
427
|
-
return
|
466
|
+
return _ref6.apply(this, arguments);
|
428
467
|
};
|
429
468
|
}(), 500);
|
430
469
|
function findTreeNode(treeList, nodeValue) {
|
@@ -565,6 +604,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
565
604
|
onClick: nodeChangeEvent,
|
566
605
|
className: cls,
|
567
606
|
children: (0, _jsxRuntime.jsx)(_antd.TreeSelect, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
607
|
+
placeholder: placeholder || _locale.default.ProForm.treeSelectPlaceholder,
|
568
608
|
maxTagPlaceholder: function maxTagPlaceholder(rest) {
|
569
609
|
var _rest = rest.map(function (tag) {
|
570
610
|
var _tag$label, _tag$label$props, _tag$label2, _tag$label2$props, _tag$label2$props$chi, _tag$label2$props$chi2, _tag$label2$props$chi3, _tag$label3, _tag$label3$props, _tag$label3$props$dan;
|
package/lib/locale/en_US.d.ts
CHANGED
package/lib/locale/en_US.js
CHANGED
@@ -31,6 +31,7 @@ var _default = exports.default = {
|
|
31
31
|
unfold: 'Unfold',
|
32
32
|
packUp: 'PackUp',
|
33
33
|
inputPlaceholder: 'Please enter',
|
34
|
+
treeSelectPlaceholder: 'Please select',
|
34
35
|
selectPlaceHolder: 'Please select',
|
35
36
|
switchText: ['Yes', 'No'],
|
36
37
|
ruleStartEndText: ['start value', 'end value'],
|
package/lib/locale/zh_CN.d.ts
CHANGED
package/lib/locale/zh_CN.js
CHANGED