@zat-design/sisyphus-react 4.1.3-beta.5 → 4.1.3-beta.7
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/ProEditTable/index.js +11 -7
- package/es/ProEditTable/utils/index.js +4 -0
- 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/ProEditTable/index.js +11 -7
- package/lib/ProEditTable/utils/index.js +4 -0
- 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
package/es/ProEditTable/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["value", "onChange", "onDrag", "onDragEnd", "className", "columns", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection", "diffConfig"],
|
|
2
|
-
_excluded2 = ["_dragIndex"];
|
|
2
|
+
_excluded2 = ["_dragIndex", "_rowIndex"];
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -427,14 +427,16 @@ var ProEditTable = (_ref, ref) => {
|
|
|
427
427
|
var TableComponent = draggable ? DraggableTable : BaseTable;
|
|
428
428
|
|
|
429
429
|
// 给每个 record 附加编辑状态标识,让 shouldCellUpdate 能检测到状态变化
|
|
430
|
-
//
|
|
430
|
+
// 始终注入 _rowIndex,供 shouldCellUpdate 感知行位置变化(增删行后同一行数据不变但位置变了)
|
|
431
|
+
// draggable 时同时注入 _dragIndex
|
|
431
432
|
var enrichedValue = useMemo(() => {
|
|
432
|
-
|
|
433
|
-
return value === null || value === void 0 ? void 0 : value.map((record, idx) => _objectSpread(_objectSpread(_objectSpread({}, record), virtualKey ? {
|
|
433
|
+
return value === null || value === void 0 ? void 0 : value.map((record, idx) => _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, record), virtualKey ? {
|
|
434
434
|
_isEditing: editingKeys.includes(record.rowKey) || record._addFlag
|
|
435
435
|
} : {}), draggable ? {
|
|
436
436
|
_dragIndex: idx
|
|
437
|
-
} : {})
|
|
437
|
+
} : {}), {}, {
|
|
438
|
+
_rowIndex: idx
|
|
439
|
+
}));
|
|
438
440
|
}, [value, virtualKey, editingKeys, draggable]);
|
|
439
441
|
var tableRowKey = useMemo(() => buildTableRowKey(rowKey), [rowKey]);
|
|
440
442
|
var tableProps = useMemo(() => ({
|
|
@@ -461,10 +463,12 @@ var ProEditTable = (_ref, ref) => {
|
|
|
461
463
|
handlePageChange
|
|
462
464
|
}), [_className, _columns, _rowClassName, disabled, editingKeys, formatMessage, handlePageChange, headerRender, isHideCheckBox, locale, page, pagination, renderRowSelection, rowDraggable, rowKey, tableRowKey, scroll, _summary, tableRef, enrichedValue, virtualKey]);
|
|
463
465
|
|
|
464
|
-
// 拖拽排序后,enrichedValue 中含 _dragIndex(内部字段),需清除后再传给外部 onChange
|
|
466
|
+
// 拖拽排序后,enrichedValue 中含 _dragIndex/_rowIndex(内部字段),需清除后再传给外部 onChange
|
|
465
467
|
var handleDragChange = useCallback(newValue => {
|
|
468
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
466
469
|
var cleanValue = newValue === null || newValue === void 0 ? void 0 : newValue.map(_ref6 => {
|
|
467
|
-
var
|
|
470
|
+
var _d = _ref6._dragIndex,
|
|
471
|
+
_r = _ref6._rowIndex,
|
|
468
472
|
rest = _objectWithoutProperties(_ref6, _excluded2);
|
|
469
473
|
return rest;
|
|
470
474
|
});
|
|
@@ -407,6 +407,10 @@ export var transformColumns = function transformColumns() {
|
|
|
407
407
|
if ((record === null || record === void 0 ? void 0 : record.rowKey) !== (prevRecord === null || prevRecord === void 0 ? void 0 : prevRecord.rowKey)) {
|
|
408
408
|
return true;
|
|
409
409
|
}
|
|
410
|
+
// 行位置变化时(增删其他行导致 index 移位),需强制重渲染以更新 Form.Item name 路径
|
|
411
|
+
if ((record === null || record === void 0 ? void 0 : record._rowIndex) !== (prevRecord === null || prevRecord === void 0 ? void 0 : prevRecord._rowIndex)) {
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
410
414
|
// 拖拽排序时,行数据不变但位置(_dragIndex)变化,需强制重渲染以更新 cellName(Form.Item name)
|
|
411
415
|
if ((record === null || record === void 0 ? void 0 : record._dragIndex) !== (prevRecord === null || prevRecord === void 0 ? void 0 : prevRecord._dragIndex)) {
|
|
412
416
|
return true;
|
|
@@ -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;
|
|
@@ -18,7 +18,7 @@ var _locale = _interopRequireWildcard(require("../locale"));
|
|
|
18
18
|
var _RcTable = require("./components/RcTable");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
var _excluded = ["value", "onChange", "onDrag", "onDragEnd", "className", "columns", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection", "diffConfig"],
|
|
21
|
-
_excluded2 = ["_dragIndex"];
|
|
21
|
+
_excluded2 = ["_dragIndex", "_rowIndex"];
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -434,14 +434,16 @@ var ProEditTable = (_ref, ref) => {
|
|
|
434
434
|
var TableComponent = draggable ? _RcTable.DraggableTable : _RcTable.BaseTable;
|
|
435
435
|
|
|
436
436
|
// 给每个 record 附加编辑状态标识,让 shouldCellUpdate 能检测到状态变化
|
|
437
|
-
//
|
|
437
|
+
// 始终注入 _rowIndex,供 shouldCellUpdate 感知行位置变化(增删行后同一行数据不变但位置变了)
|
|
438
|
+
// draggable 时同时注入 _dragIndex
|
|
438
439
|
var enrichedValue = (0, _react.useMemo)(() => {
|
|
439
|
-
|
|
440
|
-
return value === null || value === void 0 ? void 0 : value.map((record, idx) => _objectSpread(_objectSpread(_objectSpread({}, record), virtualKey ? {
|
|
440
|
+
return value === null || value === void 0 ? void 0 : value.map((record, idx) => _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, record), virtualKey ? {
|
|
441
441
|
_isEditing: editingKeys.includes(record.rowKey) || record._addFlag
|
|
442
442
|
} : {}), draggable ? {
|
|
443
443
|
_dragIndex: idx
|
|
444
|
-
} : {})
|
|
444
|
+
} : {}), {}, {
|
|
445
|
+
_rowIndex: idx
|
|
446
|
+
}));
|
|
445
447
|
}, [value, virtualKey, editingKeys, draggable]);
|
|
446
448
|
var tableRowKey = (0, _react.useMemo)(() => (0, _tools.buildTableRowKey)(rowKey), [rowKey]);
|
|
447
449
|
var tableProps = (0, _react.useMemo)(() => ({
|
|
@@ -468,10 +470,12 @@ var ProEditTable = (_ref, ref) => {
|
|
|
468
470
|
handlePageChange
|
|
469
471
|
}), [_className, _columns, _rowClassName, disabled, editingKeys, _locale.formatMessage, handlePageChange, headerRender, isHideCheckBox, _locale.default, page, pagination, renderRowSelection, rowDraggable, rowKey, tableRowKey, scroll, _summary, tableRef, enrichedValue, virtualKey]);
|
|
470
472
|
|
|
471
|
-
// 拖拽排序后,enrichedValue 中含 _dragIndex(内部字段),需清除后再传给外部 onChange
|
|
473
|
+
// 拖拽排序后,enrichedValue 中含 _dragIndex/_rowIndex(内部字段),需清除后再传给外部 onChange
|
|
472
474
|
var handleDragChange = (0, _react.useCallback)(newValue => {
|
|
475
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
473
476
|
var cleanValue = newValue === null || newValue === void 0 ? void 0 : newValue.map(_ref6 => {
|
|
474
|
-
var
|
|
477
|
+
var _d = _ref6._dragIndex,
|
|
478
|
+
_r = _ref6._rowIndex,
|
|
475
479
|
rest = _objectWithoutProperties(_ref6, _excluded2);
|
|
476
480
|
return rest;
|
|
477
481
|
});
|
|
@@ -413,6 +413,10 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
413
413
|
if ((record === null || record === void 0 ? void 0 : record.rowKey) !== (prevRecord === null || prevRecord === void 0 ? void 0 : prevRecord.rowKey)) {
|
|
414
414
|
return true;
|
|
415
415
|
}
|
|
416
|
+
// 行位置变化时(增删其他行导致 index 移位),需强制重渲染以更新 Form.Item name 路径
|
|
417
|
+
if ((record === null || record === void 0 ? void 0 : record._rowIndex) !== (prevRecord === null || prevRecord === void 0 ? void 0 : prevRecord._rowIndex)) {
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
416
420
|
// 拖拽排序时,行数据不变但位置(_dragIndex)变化,需强制重渲染以更新 cellName(Form.Item name)
|
|
417
421
|
if ((record === null || record === void 0 ? void 0 : record._dragIndex) !== (prevRecord === null || prevRecord === void 0 ? void 0 : prevRecord._dragIndex)) {
|
|
418
422
|
return true;
|
|
@@ -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;
|