@zat-design/sisyphus-react 3.13.6-beta.1 → 3.13.6-beta.2
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/ProTree/components/AdaptiveTooltip.js +4 -30
- package/es/ProTree/components/ProTree.js +0 -1
- package/es/ProTree/components/ProTreeSelect/index.js +19 -13
- 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/ProTree/components/AdaptiveTooltip.js +3 -30
- package/lib/ProTree/components/ProTree.js +0 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +19 -13
- 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
@@ -1,45 +1,19 @@
|
|
1
1
|
import "antd/es/tooltip/style";
|
2
2
|
import _Tooltip from "antd/es/tooltip";
|
3
|
-
import
|
4
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
5
|
-
import { useEffect, useState } from 'react';
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
4
|
var AdaptiveTooltip = function AdaptiveTooltip(_ref) {
|
7
5
|
var children = _ref.children;
|
8
|
-
var _useState = useState('right'),
|
9
|
-
_useState2 = _slicedToArray(_useState, 2),
|
10
|
-
placement = _useState2[0],
|
11
|
-
setPlacement = _useState2[1];
|
12
|
-
useEffect(function () {
|
13
|
-
var handleResize = function handleResize() {
|
14
|
-
var tooltipElement = document.getElementById('adaptive-tooltip');
|
15
|
-
if (tooltipElement) {
|
16
|
-
var boundingRect = tooltipElement.getBoundingClientRect();
|
17
|
-
var windowWidth = window.innerWidth;
|
18
|
-
if (windowWidth - boundingRect.right < 150) {
|
19
|
-
setPlacement('left');
|
20
|
-
} else {
|
21
|
-
setPlacement('right');
|
22
|
-
}
|
23
|
-
}
|
24
|
-
};
|
25
|
-
window.addEventListener('resize', handleResize);
|
26
|
-
handleResize();
|
27
|
-
return function () {
|
28
|
-
window.removeEventListener('resize', handleResize);
|
29
|
-
};
|
30
|
-
}, [children]);
|
31
6
|
return _jsx(_Tooltip, {
|
32
|
-
placement:
|
7
|
+
placement: "rightTop",
|
33
8
|
title: _jsx("div", {
|
34
9
|
onMouseDown: function onMouseDown(e) {
|
35
10
|
return e.stopPropagation();
|
36
11
|
},
|
37
12
|
children: children
|
38
13
|
}),
|
39
|
-
|
40
|
-
children: _jsxs("span", {
|
14
|
+
children: _jsx("span", {
|
41
15
|
className: "pro-tree-wrap-ellipse",
|
42
|
-
children:
|
16
|
+
children: children
|
43
17
|
})
|
44
18
|
});
|
45
19
|
};
|
@@ -75,7 +75,6 @@ var ProTree = function ProTree(props) {
|
|
75
75
|
showExpand = _props$showExpand === void 0 ? false : _props$showExpand,
|
76
76
|
defaultExpandAll = props.defaultExpandAll,
|
77
77
|
other = _objectWithoutProperties(props, _excluded);
|
78
|
-
var fieldNameLabel = fieldNames.label;
|
79
78
|
var fieldNameValue = fieldNames.value;
|
80
79
|
var _useSetState = useSetState({
|
81
80
|
open: false,
|
@@ -12,7 +12,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
13
13
|
import "antd/es/tree-select/style";
|
14
14
|
import _TreeSelect from "antd/es/tree-select";
|
15
|
-
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"],
|
15
|
+
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"],
|
16
16
|
_excluded2 = ["children"];
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
18
18
|
/* eslint-disable react/no-danger */
|
@@ -21,6 +21,7 @@ import { useDeepCompareEffect, useRequest as useRequestFunc, useSetState } from
|
|
21
21
|
import classnames from 'classnames';
|
22
22
|
import { useImperativeHandle, forwardRef } from 'react';
|
23
23
|
import { cloneDeep, debounce } from 'lodash';
|
24
|
+
import locale from '../../../locale';
|
24
25
|
import { useProConfig } from '../../../ProConfigProvider';
|
25
26
|
import Container from '../../../ProForm/components/Container';
|
26
27
|
import AdaptiveTooltip from '../AdaptiveTooltip';
|
@@ -50,6 +51,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
50
51
|
useRequest = props.useRequest,
|
51
52
|
transformResponse = props.transformResponse,
|
52
53
|
fieldNames = props.fieldNames,
|
54
|
+
placeholder = props.placeholder,
|
53
55
|
_props$tooltip = props.tooltip,
|
54
56
|
tooltip = _props$tooltip === void 0 ? false : _props$tooltip,
|
55
57
|
_props$showSearch = props.showSearch,
|
@@ -171,26 +173,29 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
171
173
|
// 配置了异步数据源,拉取枚举数据逻辑 如果有code不掉接口从local里根据code取值
|
172
174
|
var fetchFunction = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread({
|
173
175
|
manual: true,
|
174
|
-
|
175
|
-
|
176
|
+
debounceWait: 300
|
177
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
178
|
+
useImperativeHandle(ref, function () {
|
179
|
+
return {
|
180
|
+
useRequestRef: fetchFunction
|
181
|
+
};
|
182
|
+
});
|
183
|
+
// 请求成功
|
184
|
+
useDeepCompareEffect(function () {
|
185
|
+
if (fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) {
|
176
186
|
if (transformResponse && typeof transformResponse === 'function') {
|
177
|
-
var responseData = transformResponse(data);
|
187
|
+
var responseData = transformResponse(fetchFunction.data);
|
188
|
+
// debugger;
|
178
189
|
var resultData = transferDataSource(responseData, showCodeName);
|
179
190
|
setState({
|
180
191
|
selectList: countChild(resultData),
|
181
192
|
origDataSource: resultData
|
182
193
|
});
|
183
194
|
} else {
|
184
|
-
defaultOnSuccessFun(data);
|
195
|
+
defaultOnSuccessFun(fetchFunction.data);
|
185
196
|
}
|
186
|
-
}
|
187
|
-
|
188
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
189
|
-
useImperativeHandle(ref, function () {
|
190
|
-
return {
|
191
|
-
useRequestRef: fetchFunction
|
192
|
-
};
|
193
|
-
});
|
197
|
+
}
|
198
|
+
}, [fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data]);
|
194
199
|
useDeepCompareEffect(function () {
|
195
200
|
if (enumCode) {
|
196
201
|
var dictEnum = dics[enumCode] || [];
|
@@ -565,6 +570,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
565
570
|
onClick: nodeChangeEvent,
|
566
571
|
className: cls,
|
567
572
|
children: _jsx(_TreeSelect, _objectSpread(_objectSpread({
|
573
|
+
placeholder: placeholder || locale.ProForm.treeSelectPlaceholder,
|
568
574
|
maxTagPlaceholder: function maxTagPlaceholder(rest) {
|
569
575
|
var _rest = rest.map(function (tag) {
|
570
576
|
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/es/locale/en_US.d.ts
CHANGED
package/es/locale/en_US.js
CHANGED
package/es/locale/zh_CN.d.ts
CHANGED
package/es/locale/zh_CN.js
CHANGED
@@ -1,51 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
5
4
|
value: true
|
6
5
|
});
|
7
6
|
exports.default = void 0;
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
10
8
|
var _antd = require("antd");
|
11
|
-
var _react = require("react");
|
12
9
|
var AdaptiveTooltip = function AdaptiveTooltip(_ref) {
|
13
10
|
var children = _ref.children;
|
14
|
-
var _useState = (0, _react.useState)('right'),
|
15
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
16
|
-
placement = _useState2[0],
|
17
|
-
setPlacement = _useState2[1];
|
18
|
-
(0, _react.useEffect)(function () {
|
19
|
-
var handleResize = function handleResize() {
|
20
|
-
var tooltipElement = document.getElementById('adaptive-tooltip');
|
21
|
-
if (tooltipElement) {
|
22
|
-
var boundingRect = tooltipElement.getBoundingClientRect();
|
23
|
-
var windowWidth = window.innerWidth;
|
24
|
-
if (windowWidth - boundingRect.right < 150) {
|
25
|
-
setPlacement('left');
|
26
|
-
} else {
|
27
|
-
setPlacement('right');
|
28
|
-
}
|
29
|
-
}
|
30
|
-
};
|
31
|
-
window.addEventListener('resize', handleResize);
|
32
|
-
handleResize();
|
33
|
-
return function () {
|
34
|
-
window.removeEventListener('resize', handleResize);
|
35
|
-
};
|
36
|
-
}, [children]);
|
37
11
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
38
|
-
placement:
|
12
|
+
placement: "rightTop",
|
39
13
|
title: (0, _jsxRuntime.jsx)("div", {
|
40
14
|
onMouseDown: function onMouseDown(e) {
|
41
15
|
return e.stopPropagation();
|
42
16
|
},
|
43
17
|
children: children
|
44
18
|
}),
|
45
|
-
|
46
|
-
children: (0, _jsxRuntime.jsxs)("span", {
|
19
|
+
children: (0, _jsxRuntime.jsx)("span", {
|
47
20
|
className: "pro-tree-wrap-ellipse",
|
48
|
-
children:
|
21
|
+
children: children
|
49
22
|
})
|
50
23
|
});
|
51
24
|
};
|
@@ -75,7 +75,6 @@ var ProTree = function ProTree(props) {
|
|
75
75
|
showExpand = _props$showExpand === void 0 ? false : _props$showExpand,
|
76
76
|
defaultExpandAll = props.defaultExpandAll,
|
77
77
|
other = (0, _objectWithoutProperties2.default)(props, _excluded);
|
78
|
-
var fieldNameLabel = fieldNames.label;
|
79
78
|
var fieldNameValue = fieldNames.value;
|
80
79
|
var _useSetState = (0, _ahooks.useSetState)({
|
81
80
|
open: false,
|
@@ -17,10 +17,11 @@ 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 */
|
@@ -50,6 +51,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
50
51
|
useRequest = props.useRequest,
|
51
52
|
transformResponse = props.transformResponse,
|
52
53
|
fieldNames = props.fieldNames,
|
54
|
+
placeholder = props.placeholder,
|
53
55
|
_props$tooltip = props.tooltip,
|
54
56
|
tooltip = _props$tooltip === void 0 ? false : _props$tooltip,
|
55
57
|
_props$showSearch = props.showSearch,
|
@@ -171,26 +173,29 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
171
173
|
// 配置了异步数据源,拉取枚举数据逻辑 如果有code不掉接口从local里根据code取值
|
172
174
|
var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)({
|
173
175
|
manual: true,
|
174
|
-
|
175
|
-
|
176
|
+
debounceWait: 300
|
177
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
178
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
179
|
+
return {
|
180
|
+
useRequestRef: fetchFunction
|
181
|
+
};
|
182
|
+
});
|
183
|
+
// 请求成功
|
184
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
185
|
+
if (fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) {
|
176
186
|
if (transformResponse && typeof transformResponse === 'function') {
|
177
|
-
var responseData = transformResponse(data);
|
187
|
+
var responseData = transformResponse(fetchFunction.data);
|
188
|
+
// debugger;
|
178
189
|
var resultData = transferDataSource(responseData, showCodeName);
|
179
190
|
setState({
|
180
191
|
selectList: countChild(resultData),
|
181
192
|
origDataSource: resultData
|
182
193
|
});
|
183
194
|
} else {
|
184
|
-
defaultOnSuccessFun(data);
|
195
|
+
defaultOnSuccessFun(fetchFunction.data);
|
185
196
|
}
|
186
|
-
}
|
187
|
-
|
188
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
189
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
190
|
-
return {
|
191
|
-
useRequestRef: fetchFunction
|
192
|
-
};
|
193
|
-
});
|
197
|
+
}
|
198
|
+
}, [fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data]);
|
194
199
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
195
200
|
if (enumCode) {
|
196
201
|
var dictEnum = dics[enumCode] || [];
|
@@ -565,6 +570,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
565
570
|
onClick: nodeChangeEvent,
|
566
571
|
className: cls,
|
567
572
|
children: (0, _jsxRuntime.jsx)(_antd.TreeSelect, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
573
|
+
placeholder: placeholder || _locale.default.ProForm.treeSelectPlaceholder,
|
568
574
|
maxTagPlaceholder: function maxTagPlaceholder(rest) {
|
569
575
|
var _rest = rest.map(function (tag) {
|
570
576
|
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