@zat-design/sisyphus-react 4.1.3-beta.5 → 4.1.3-beta.6
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/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProTreeModal/components/Tree.js +11 -2
- package/es/ProTreeModal/components/Trigger.js +13 -5
- package/es/ProTreeModal/index.js +3 -3
- package/es/ProTreeModal/style/index.less +21 -1
- package/lib/ProTreeModal/components/Tree.js +9 -0
- package/lib/ProTreeModal/components/Trigger.js +13 -5
- package/lib/ProTreeModal/index.js +3 -3
- package/lib/ProTreeModal/style/index.less +21 -1
- package/package.json +1 -1
|
@@ -13,12 +13,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
15
|
/* eslint-disable no-plusplus */
|
|
16
|
-
import React, { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import React, { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
17
|
import { Tree } from 'antd';
|
|
18
18
|
import ListComponent from "./List";
|
|
19
19
|
import SearchTitle from "./SearchTitle";
|
|
20
20
|
import CloseIcon from "./CloseIcon";
|
|
21
|
-
import { filterCheckedNodes, getParentKey } from "../utils";
|
|
21
|
+
import { filterCheckedNodes, getAllKeys, getParentKey } from "../utils";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -53,6 +53,7 @@ function List(props, ref) {
|
|
|
53
53
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
54
|
autoExpandParent = _useState4[0],
|
|
55
55
|
setAutoExpandParent = _useState4[1];
|
|
56
|
+
var hasInitializedExpand = useRef(false);
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
if (searchStr) {
|
|
58
59
|
var newExpandedKeys = flatTreeData.map(item => {
|
|
@@ -66,6 +67,14 @@ function List(props, ref) {
|
|
|
66
67
|
setAutoExpandParent(true);
|
|
67
68
|
}
|
|
68
69
|
}, [searchStr]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!searchStr && !hasInitializedExpand.current && originalTreeData !== null && originalTreeData !== void 0 && originalTreeData.length) {
|
|
72
|
+
var defaultExpandedKeys = getAllKeys(originalTreeData || [], fieldNames);
|
|
73
|
+
setExpandedKeys(defaultExpandedKeys);
|
|
74
|
+
setAutoExpandParent(true);
|
|
75
|
+
hasInitializedExpand.current = true;
|
|
76
|
+
}
|
|
77
|
+
}, [originalTreeData, fieldNames, searchStr]);
|
|
69
78
|
var _treeData = useMemo(() => {
|
|
70
79
|
function fn() {
|
|
71
80
|
var loop = (data, index) => {
|
|
@@ -62,13 +62,21 @@ function Trigger(props) {
|
|
|
62
62
|
mode: 'appoint'
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
}, [checkAll]);
|
|
65
|
+
}, [allValue, value, appoint, checkAll]);
|
|
66
66
|
var onIconClick = () => {
|
|
67
67
|
if (appoint && state.mode === 'all') {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
handleClick();
|
|
71
71
|
};
|
|
72
|
+
var viewIconClassName = classNames('pro-tree-modal-view-svg', {
|
|
73
|
+
'pro-tree-modal-view-svg-active': !!isView && checkedValues.length > 0 && state.mode !== 'all' && !afterDisabled,
|
|
74
|
+
'pro-tree-modal-view-svg-not-allowed': appoint && state.mode === 'all'
|
|
75
|
+
});
|
|
76
|
+
var addonAfterClassName = classNames('pro-enum-input-addonAfter', {
|
|
77
|
+
'pro-enum-input-addonAfter-not-allowed': appoint && state.mode === 'all',
|
|
78
|
+
'trigger-no-hover': afterDisabled
|
|
79
|
+
});
|
|
72
80
|
if (isView) {
|
|
73
81
|
var _locale$ProTreeModal;
|
|
74
82
|
return /*#__PURE__*/_jsxs("div", {
|
|
@@ -80,9 +88,9 @@ function Trigger(props) {
|
|
|
80
88
|
num: checkedValues.length
|
|
81
89
|
})
|
|
82
90
|
}), /*#__PURE__*/_jsx("div", {
|
|
83
|
-
className:
|
|
91
|
+
className: addonAfterClassName,
|
|
84
92
|
children: /*#__PURE__*/_jsx(ReactSVG, {
|
|
85
|
-
className:
|
|
93
|
+
className: viewIconClassName,
|
|
86
94
|
src: viewSvg,
|
|
87
95
|
onClick: onIconClick
|
|
88
96
|
})
|
|
@@ -161,14 +169,14 @@ function Trigger(props) {
|
|
|
161
169
|
flex: 1
|
|
162
170
|
})
|
|
163
171
|
})), /*#__PURE__*/_jsxs("div", {
|
|
164
|
-
className:
|
|
172
|
+
className: addonAfterClassName,
|
|
165
173
|
children: [checkedValues.length > 0 && !afterDisabled && /*#__PURE__*/_jsx("span", {
|
|
166
174
|
className: "close-icon",
|
|
167
175
|
children: /*#__PURE__*/_jsx(CloseOutlined, {
|
|
168
176
|
onClick: handleClearAll
|
|
169
177
|
})
|
|
170
178
|
}), /*#__PURE__*/_jsx(ReactSVG, {
|
|
171
|
-
className:
|
|
179
|
+
className: viewIconClassName,
|
|
172
180
|
src: viewSvg,
|
|
173
181
|
onClick: onIconClick
|
|
174
182
|
})]
|
package/es/ProTreeModal/index.js
CHANGED
|
@@ -780,7 +780,7 @@ var ProTreeModal = props => {
|
|
|
780
780
|
title: title,
|
|
781
781
|
mode: "Modal",
|
|
782
782
|
className: "pro-tree-modal-container",
|
|
783
|
-
extraLeft: allValue !== undefined ? /*#__PURE__*/_jsx(Checkbox, {
|
|
783
|
+
extraLeft: allValue !== undefined && !isView ? /*#__PURE__*/_jsx(Checkbox, {
|
|
784
784
|
checked: state.checkAll,
|
|
785
785
|
disabled: disabled,
|
|
786
786
|
onChange: handleAllCheck,
|
|
@@ -811,12 +811,12 @@ var ProTreeModal = props => {
|
|
|
811
811
|
className: "pro-tree-modal-box-header",
|
|
812
812
|
children: [/*#__PURE__*/_jsxs("span", {
|
|
813
813
|
children: [locale === null || locale === void 0 || (_locale$ProTreeModal11 = locale.ProTreeModal) === null || _locale$ProTreeModal11 === void 0 ? void 0 : _locale$ProTreeModal11.check, " (", state.checkedValues.length, "/", max || state.flatTreeData.length, ")"]
|
|
814
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
814
|
+
}), !isView ? /*#__PURE__*/_jsx(Button, {
|
|
815
815
|
disabled: disabled,
|
|
816
816
|
type: "link",
|
|
817
817
|
onClick: handleClearAll,
|
|
818
818
|
children: locale === null || locale === void 0 || (_locale$ProTreeModal12 = locale.ProTreeModal) === null || _locale$ProTreeModal12 === void 0 ? void 0 : _locale$ProTreeModal12.clearAll
|
|
819
|
-
})]
|
|
819
|
+
}) : null]
|
|
820
820
|
}), /*#__PURE__*/_jsx("div", {
|
|
821
821
|
className: "pro-tree-modal-tree-warp pro-transfer-right",
|
|
822
822
|
children: renderView()
|
|
@@ -53,10 +53,13 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&:hover{
|
|
56
|
-
.pro-enum-input-addonAfter {
|
|
56
|
+
.pro-enum-input-addonAfter:not(.trigger-no-hover):not(.pro-enum-input-addonAfter-not-allowed) {
|
|
57
57
|
border-color: var(--zaui-brand-hover, #3387ff);
|
|
58
58
|
color: var(--zaui-brand-hover, #3387ff);
|
|
59
59
|
}
|
|
60
|
+
.pro-enum-input-addonAfter:not(.trigger-no-hover):not(.pro-enum-input-addonAfter-not-allowed) .pro-tree-modal-view-svg-active {
|
|
61
|
+
color: var(--zaui-brand-hover, #3387ff);
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
&-placeholder {
|
|
62
65
|
color: #939499;
|
|
@@ -72,11 +75,28 @@
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
.pro-tree-modal-view-svg {
|
|
78
|
+
color: inherit;
|
|
75
79
|
div {
|
|
76
80
|
display: flex;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
.pro-tree-modal-view-svg-active {
|
|
85
|
+
color: var(--zaui-brand, #006aff);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pro-tree-modal-view-svg-not-allowed {
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
div,
|
|
91
|
+
svg {
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.pro-enum-input-addonAfter-not-allowed {
|
|
97
|
+
cursor: not-allowed;
|
|
98
|
+
}
|
|
99
|
+
|
|
80
100
|
&-content {
|
|
81
101
|
display: flex;
|
|
82
102
|
flex-direction: row;
|
|
@@ -60,6 +60,7 @@ function List(props, ref) {
|
|
|
60
60
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
61
61
|
autoExpandParent = _useState4[0],
|
|
62
62
|
setAutoExpandParent = _useState4[1];
|
|
63
|
+
var hasInitializedExpand = (0, _react.useRef)(false);
|
|
63
64
|
(0, _react.useEffect)(() => {
|
|
64
65
|
if (searchStr) {
|
|
65
66
|
var newExpandedKeys = flatTreeData.map(item => {
|
|
@@ -73,6 +74,14 @@ function List(props, ref) {
|
|
|
73
74
|
setAutoExpandParent(true);
|
|
74
75
|
}
|
|
75
76
|
}, [searchStr]);
|
|
77
|
+
(0, _react.useEffect)(() => {
|
|
78
|
+
if (!searchStr && !hasInitializedExpand.current && originalTreeData !== null && originalTreeData !== void 0 && originalTreeData.length) {
|
|
79
|
+
var defaultExpandedKeys = (0, _utils.getAllKeys)(originalTreeData || [], fieldNames);
|
|
80
|
+
setExpandedKeys(defaultExpandedKeys);
|
|
81
|
+
setAutoExpandParent(true);
|
|
82
|
+
hasInitializedExpand.current = true;
|
|
83
|
+
}
|
|
84
|
+
}, [originalTreeData, fieldNames, searchStr]);
|
|
76
85
|
var _treeData = (0, _react.useMemo)(() => {
|
|
77
86
|
function fn() {
|
|
78
87
|
var loop = (data, index) => {
|
|
@@ -70,13 +70,21 @@ function Trigger(props) {
|
|
|
70
70
|
mode: 'appoint'
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
}, [checkAll]);
|
|
73
|
+
}, [allValue, value, appoint, checkAll]);
|
|
74
74
|
var onIconClick = () => {
|
|
75
75
|
if (appoint && state.mode === 'all') {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
handleClick();
|
|
79
79
|
};
|
|
80
|
+
var viewIconClassName = (0, _classnames.default)('pro-tree-modal-view-svg', {
|
|
81
|
+
'pro-tree-modal-view-svg-active': !!isView && checkedValues.length > 0 && state.mode !== 'all' && !afterDisabled,
|
|
82
|
+
'pro-tree-modal-view-svg-not-allowed': appoint && state.mode === 'all'
|
|
83
|
+
});
|
|
84
|
+
var addonAfterClassName = (0, _classnames.default)('pro-enum-input-addonAfter', {
|
|
85
|
+
'pro-enum-input-addonAfter-not-allowed': appoint && state.mode === 'all',
|
|
86
|
+
'trigger-no-hover': afterDisabled
|
|
87
|
+
});
|
|
80
88
|
if (isView) {
|
|
81
89
|
var _locale$ProTreeModal;
|
|
82
90
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -88,9 +96,9 @@ function Trigger(props) {
|
|
|
88
96
|
num: checkedValues.length
|
|
89
97
|
})
|
|
90
98
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
91
|
-
className:
|
|
99
|
+
className: addonAfterClassName,
|
|
92
100
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
|
93
|
-
className:
|
|
101
|
+
className: viewIconClassName,
|
|
94
102
|
src: _view.default,
|
|
95
103
|
onClick: onIconClick
|
|
96
104
|
})
|
|
@@ -169,14 +177,14 @@ function Trigger(props) {
|
|
|
169
177
|
flex: 1
|
|
170
178
|
})
|
|
171
179
|
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
172
|
-
className:
|
|
180
|
+
className: addonAfterClassName,
|
|
173
181
|
children: [checkedValues.length > 0 && !afterDisabled && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
174
182
|
className: "close-icon",
|
|
175
183
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CloseOutlined, {
|
|
176
184
|
onClick: handleClearAll
|
|
177
185
|
})
|
|
178
186
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
|
179
|
-
className:
|
|
187
|
+
className: viewIconClassName,
|
|
180
188
|
src: _view.default,
|
|
181
189
|
onClick: onIconClick
|
|
182
190
|
})]
|
|
@@ -787,7 +787,7 @@ var ProTreeModal = props => {
|
|
|
787
787
|
title: title,
|
|
788
788
|
mode: "Modal",
|
|
789
789
|
className: "pro-tree-modal-container",
|
|
790
|
-
extraLeft: allValue !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
|
|
790
|
+
extraLeft: allValue !== undefined && !isView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
|
|
791
791
|
checked: state.checkAll,
|
|
792
792
|
disabled: disabled,
|
|
793
793
|
onChange: handleAllCheck,
|
|
@@ -818,12 +818,12 @@ var ProTreeModal = props => {
|
|
|
818
818
|
className: "pro-tree-modal-box-header",
|
|
819
819
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
820
820
|
children: [_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal11 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal11 === void 0 ? void 0 : _locale$ProTreeModal11.check, " (", state.checkedValues.length, "/", max || state.flatTreeData.length, ")"]
|
|
821
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
821
|
+
}), !isView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
822
822
|
disabled: disabled,
|
|
823
823
|
type: "link",
|
|
824
824
|
onClick: handleClearAll,
|
|
825
825
|
children: _locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal12 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal12 === void 0 ? void 0 : _locale$ProTreeModal12.clearAll
|
|
826
|
-
})]
|
|
826
|
+
}) : null]
|
|
827
827
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
828
828
|
className: "pro-tree-modal-tree-warp pro-transfer-right",
|
|
829
829
|
children: renderView()
|
|
@@ -53,10 +53,13 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&:hover{
|
|
56
|
-
.pro-enum-input-addonAfter {
|
|
56
|
+
.pro-enum-input-addonAfter:not(.trigger-no-hover):not(.pro-enum-input-addonAfter-not-allowed) {
|
|
57
57
|
border-color: var(--zaui-brand-hover, #3387ff);
|
|
58
58
|
color: var(--zaui-brand-hover, #3387ff);
|
|
59
59
|
}
|
|
60
|
+
.pro-enum-input-addonAfter:not(.trigger-no-hover):not(.pro-enum-input-addonAfter-not-allowed) .pro-tree-modal-view-svg-active {
|
|
61
|
+
color: var(--zaui-brand-hover, #3387ff);
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
&-placeholder {
|
|
62
65
|
color: #939499;
|
|
@@ -72,11 +75,28 @@
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
.pro-tree-modal-view-svg {
|
|
78
|
+
color: inherit;
|
|
75
79
|
div {
|
|
76
80
|
display: flex;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
.pro-tree-modal-view-svg-active {
|
|
85
|
+
color: var(--zaui-brand, #006aff);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pro-tree-modal-view-svg-not-allowed {
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
div,
|
|
91
|
+
svg {
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.pro-enum-input-addonAfter-not-allowed {
|
|
97
|
+
cursor: not-allowed;
|
|
98
|
+
}
|
|
99
|
+
|
|
80
100
|
&-content {
|
|
81
101
|
display: flex;
|
|
82
102
|
flex-direction: row;
|