@zat-design/sisyphus-react 3.13.4-beta.1 → 3.13.4-beta.3
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 +3 -0
- package/dist/less.esm.css +3 -0
- package/es/ProEditTable/utils/useEditTableError.js +0 -1
- package/es/ProForm/components/base/Input/index.js +2 -2
- package/es/ProForm/components/base/TextArea/index.js +1 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +13 -2
- package/es/ProForm/components/combination/ProModalSelect/utils/index.d.ts +1 -0
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +21 -0
- package/es/ProForm/style/index.less +6 -0
- package/es/ProForm/utils/index.js +2 -2
- package/es/ProTable/components/FormatColumn/index.js +49 -47
- package/es/ProTable/utils/index.js +11 -1
- package/lib/ProEditTable/utils/useEditTableError.js +0 -1
- package/lib/ProForm/components/base/Input/index.js +2 -2
- package/lib/ProForm/components/base/TextArea/index.js +1 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +13 -2
- package/lib/ProForm/components/combination/ProModalSelect/utils/index.d.ts +1 -0
- package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +27 -0
- package/lib/ProForm/style/index.less +6 -0
- package/lib/ProForm/utils/index.js +2 -2
- package/lib/ProTable/components/FormatColumn/index.js +49 -47
- package/lib/ProTable/utils/index.js +11 -1
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
@@ -2943,6 +2943,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
2943
2943
|
-ms-flex-align: normal;
|
2944
2944
|
align-items: normal;
|
2945
2945
|
}
|
2946
|
+
.pro-form .pro-modal-select-parent-open .ant-tooltip {
|
2947
|
+
display: none !important;
|
2948
|
+
}
|
2946
2949
|
.pro-form .ant-form-item-control-input {
|
2947
2950
|
-webkit-box-flex: 1;
|
2948
2951
|
-webkit-flex-grow: 1;
|
package/dist/less.esm.css
CHANGED
@@ -2943,6 +2943,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
2943
2943
|
-ms-flex-align: normal;
|
2944
2944
|
align-items: normal;
|
2945
2945
|
}
|
2946
|
+
.pro-form .pro-modal-select-parent-open .ant-tooltip {
|
2947
|
+
display: none !important;
|
2948
|
+
}
|
2946
2949
|
.pro-form .ant-form-item-control-input {
|
2947
2950
|
-webkit-box-flex: 1;
|
2948
2951
|
-webkit-flex-grow: 1;
|
@@ -27,7 +27,6 @@ var useEditTableError = function useEditTableError(_ref) {
|
|
27
27
|
if (target.classList.contains(className)) {
|
28
28
|
// 查找所有包含 className 的节点
|
29
29
|
var errorNodes = containerNode.querySelectorAll(".".concat(className));
|
30
|
-
// debugger;
|
31
30
|
// 过滤这些节点,只保留那些类名完全为 `ant-form-item-explain-error` 的节点
|
32
31
|
var validErrorNodes = Array.from(errorNodes).filter(function (node) {
|
33
32
|
return node.classList.length === 1 && node.classList.contains('ant-form-item-explain-error');
|
@@ -49,7 +49,7 @@ var Input = function Input(props) {
|
|
49
49
|
allowClear: true,
|
50
50
|
autoComplete: "off",
|
51
51
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder)
|
52
|
-
}, omit(initialConfig, ['trim'])), rest));
|
52
|
+
}, omit(initialConfig, ['trim', 'upperCase'])), rest));
|
53
53
|
// 仅查看模式下进行数据脱敏
|
54
54
|
if ((desensitization === null || desensitization === void 0 ? void 0 : desensitization.length) && (props === null || props === void 0 ? void 0 : props.disabled)) {
|
55
55
|
var _isDesensit = sessionStorage.getItem(otherProps === null || otherProps === void 0 ? void 0 : otherProps.desensitizationKey);
|
@@ -62,7 +62,7 @@ var Input = function Input(props) {
|
|
62
62
|
allowClear: true,
|
63
63
|
autoComplete: 'off',
|
64
64
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder)
|
65
|
-
}, omit(initialConfig, ['trim'])), rest), {}, {
|
65
|
+
}, omit(initialConfig, ['trim', 'upperCase'])), rest), {}, {
|
66
66
|
value: maskStringRangeWithRegex(rest.value, desensitization)
|
67
67
|
}));
|
68
68
|
}
|
@@ -44,7 +44,7 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
44
44
|
autoComplete: "off",
|
45
45
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder).concat(label || ''),
|
46
46
|
autoSize: !(props === null || props === void 0 ? void 0 : (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.height)
|
47
|
-
}, omit(initialConfig, ['trim'])), rest), {}, {
|
47
|
+
}, omit(initialConfig, ['trim', 'upperCase'])), rest), {}, {
|
48
48
|
className: _className
|
49
49
|
}));
|
50
50
|
};
|
@@ -26,6 +26,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
26
26
|
import { SearchOutlined } from '@ant-design/icons';
|
27
27
|
import { useDebounceEffect, useDeepCompareEffect, useMount, useSetState } from 'ahooks';
|
28
28
|
import { debounce, isArray, isEqual, isFunction } from 'lodash';
|
29
|
+
import classNames from 'classnames';
|
29
30
|
import { ReactSVG } from 'react-svg';
|
30
31
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
31
32
|
import { ProForm, ProDrawerForm, ProTable, useProConfig, ProSelect } from '../../../../index';
|
@@ -33,6 +34,7 @@ import Container from '../../Container';
|
|
33
34
|
import viewSvg from '../../../../assets/view.svg';
|
34
35
|
import useRequestList from './hooks/useRequestList';
|
35
36
|
import locale from '../../../../locale';
|
37
|
+
import { hideTooltipIfOpen } from './utils';
|
36
38
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
37
39
|
var _useRequest$options, _useRequest$options2, _useRequest$options2$, _useRequest$options3, _formColumns$;
|
38
40
|
var value = props.value,
|
@@ -107,6 +109,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
107
109
|
rowSelection = _ref4.rowSelection,
|
108
110
|
restTableProps = _objectWithoutProperties(_ref4, _excluded3);
|
109
111
|
var preValue = useRef(value);
|
112
|
+
// 表单项的ref
|
113
|
+
var fieldRef = useRef(null);
|
110
114
|
var defaultParams = Array.isArray(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams) ? useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : (_useRequest$options2$ = _useRequest$options2.defaultParams) === null || _useRequest$options2$ === void 0 ? void 0 : _useRequest$options2$[0] : (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams) || {};
|
111
115
|
var defaultParamsRef = useRef(defaultParams); // 缓存 defaultParams 的引用
|
112
116
|
var _useSetState = useSetState({
|
@@ -652,6 +656,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
652
656
|
setState(nextState);
|
653
657
|
}
|
654
658
|
}, [onOff, visible, JSON.stringify(value)]);
|
659
|
+
useEffect(function () {
|
660
|
+
hideTooltipIfOpen(fieldRef.current, visible);
|
661
|
+
}, [visible]);
|
655
662
|
useEffect(function () {
|
656
663
|
if (value && !visible && isInit && !readOnly) {
|
657
664
|
getInitValues();
|
@@ -851,11 +858,15 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
851
858
|
children: "".concat(viewText)
|
852
859
|
});
|
853
860
|
}
|
861
|
+
var _className = classNames(_defineProperty(_defineProperty({
|
862
|
+
'pro-modal-select': true
|
863
|
+
}, props.className, props.className), 'pro-modal-select-open', visible));
|
854
864
|
return _jsxs(_Fragment, {
|
855
865
|
children: [_jsx("div", {
|
856
866
|
id: uuid,
|
857
|
-
className:
|
867
|
+
className: _className,
|
858
868
|
style: style,
|
869
|
+
ref: fieldRef,
|
859
870
|
children: isTooltip && viewText ? _jsx(_Tooltip, {
|
860
871
|
placement: "topLeft",
|
861
872
|
open: open,
|
@@ -868,7 +879,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
868
879
|
onOk: handleFinish,
|
869
880
|
// @ts-ignore
|
870
881
|
onCancel: handleClose,
|
871
|
-
|
882
|
+
open: visible
|
872
883
|
}, restModalProps), {}, {
|
873
884
|
children: [_jsx(ProForm, {
|
874
885
|
submitOnEnter: true,
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const hideTooltipIfOpen: (dom: HTMLElement, open: boolean) => void;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/* eslint-disable no-restricted-syntax */
|
2
|
+
export var hideTooltipIfOpen = function hideTooltipIfOpen(dom, open) {
|
3
|
+
if (!open && document.querySelector('.pro-modal-select-parent-open') && dom) {
|
4
|
+
var _parent = dom.closest('.pro-form-item-changed');
|
5
|
+
var _grandParent = _parent.parentElement;
|
6
|
+
_parent.className = 'pro-form-item-changed';
|
7
|
+
_grandParent === null || _grandParent === void 0 ? void 0 : _grandParent.classList.remove('pro-modal-select-parent-open');
|
8
|
+
var tooltip = _grandParent.querySelector('.ant-tooltip');
|
9
|
+
if (tooltip) {
|
10
|
+
tooltip.classList.add('ant-tooltip-hidden');
|
11
|
+
}
|
12
|
+
}
|
13
|
+
if (!dom) return;
|
14
|
+
var modal = dom.className.includes('pro-modal-select-open');
|
15
|
+
if (!modal) return;
|
16
|
+
var parent = dom.closest('.pro-form-item-changed');
|
17
|
+
var grandParent = parent.parentElement;
|
18
|
+
if (open) {
|
19
|
+
grandParent.classList.add('pro-modal-select-parent-open');
|
20
|
+
}
|
21
|
+
};
|
@@ -57,7 +57,7 @@ export var isTrim = function isTrim(type, trim, configData) {
|
|
57
57
|
_ref$state = _ref.state,
|
58
58
|
state = _ref$state === void 0 ? {} : _ref$state;
|
59
59
|
var _trim = trim || (state === null || state === void 0 ? void 0 : (_state$type = state[type]) === null || _state$type === void 0 ? void 0 : _state$type.trim);
|
60
|
-
if (['Input', '
|
60
|
+
if (['Input', 'ProCombination'].includes(type) && _trim) {
|
61
61
|
result.getValueFromEvent = function (event) {
|
62
62
|
var _event$target$value;
|
63
63
|
if (Array.isArray(event)) {
|
@@ -78,7 +78,7 @@ export var isTrim = function isTrim(type, trim, configData) {
|
|
78
78
|
*/
|
79
79
|
export var isUpperCase = function isUpperCase(type, upperCase) {
|
80
80
|
var result = {};
|
81
|
-
if (['Input', '
|
81
|
+
if (['Input', 'ProCombination'].includes(type) && upperCase) {
|
82
82
|
result.getValueFromEvent = function (event) {
|
83
83
|
var _event$target, _event$target$value2;
|
84
84
|
if (Array.isArray(event)) {
|
@@ -125,65 +125,67 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
125
125
|
var isInNewRowFlag = isInNewRow(record);
|
126
126
|
var _isAddCell = isAddCell;
|
127
127
|
otherProps.isChanged = isChanged;
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
if (
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
128
|
+
if (Array.isArray(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
|
129
|
+
// 存在比对
|
130
|
+
if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender)) {
|
131
|
+
var _originalObj$record$r;
|
132
|
+
var diffResult = otherProps.viewRender({
|
133
|
+
originalValue: originalValue,
|
134
|
+
originalRecord: (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {},
|
135
|
+
value: value,
|
136
|
+
record: record,
|
137
|
+
index: index
|
138
|
+
});
|
139
|
+
// viewRender 返回值为 false 时,不显示对比
|
140
|
+
if (isBoolean(diffResult)) {
|
141
|
+
if (!diffResult) {
|
142
|
+
otherProps.isChanged = false;
|
143
|
+
_isAddCell = false;
|
144
|
+
} else {
|
145
|
+
otherProps.isChanged = true;
|
146
|
+
_isAddCell = false;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
// 指定返回相同了
|
150
|
+
if (typeof diffResult === 'string') {
|
151
|
+
if (diffResult === 'changed') {
|
152
|
+
_isAddCell = false;
|
153
|
+
otherProps.isChanged = true;
|
154
|
+
}
|
155
|
+
if (diffResult === 'same') {
|
156
|
+
_isAddCell = false;
|
157
|
+
otherProps.isChanged = false;
|
158
|
+
}
|
159
|
+
if (diffResult === 'add') {
|
160
|
+
_isAddCell = true;
|
161
|
+
otherProps.isChanged = false;
|
162
|
+
}
|
146
163
|
}
|
164
|
+
originalValue = diffResult;
|
147
165
|
}
|
148
|
-
//
|
149
|
-
if (
|
150
|
-
|
166
|
+
// 存在自定义onDiff比对
|
167
|
+
if (isFunction(onDiff)) {
|
168
|
+
var _originalObj$record$r2;
|
169
|
+
var _diffResult = onDiff({
|
170
|
+
originalValue: originalValue,
|
171
|
+
originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
|
172
|
+
value: value,
|
173
|
+
record: record,
|
174
|
+
index: index
|
175
|
+
});
|
176
|
+
if (_diffResult === 'changed') {
|
151
177
|
_isAddCell = false;
|
152
178
|
otherProps.isChanged = true;
|
153
179
|
}
|
154
|
-
if (
|
180
|
+
if (_diffResult === 'same') {
|
155
181
|
_isAddCell = false;
|
156
182
|
otherProps.isChanged = false;
|
157
183
|
}
|
158
|
-
if (
|
184
|
+
if (_diffResult === 'add') {
|
159
185
|
_isAddCell = true;
|
160
186
|
otherProps.isChanged = false;
|
161
187
|
}
|
162
188
|
}
|
163
|
-
originalValue = diffResult;
|
164
|
-
}
|
165
|
-
// 存在自定义onDiff比对
|
166
|
-
if (isFunction(onDiff)) {
|
167
|
-
var _originalObj$record$r2;
|
168
|
-
var _diffResult = onDiff({
|
169
|
-
originalValue: originalValue,
|
170
|
-
originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
|
171
|
-
value: value,
|
172
|
-
record: record,
|
173
|
-
index: index
|
174
|
-
});
|
175
|
-
if (_diffResult === 'changed') {
|
176
|
-
_isAddCell = false;
|
177
|
-
otherProps.isChanged = true;
|
178
|
-
}
|
179
|
-
if (_diffResult === 'same') {
|
180
|
-
_isAddCell = false;
|
181
|
-
otherProps.isChanged = false;
|
182
|
-
}
|
183
|
-
if (_diffResult === 'add') {
|
184
|
-
_isAddCell = true;
|
185
|
-
otherProps.isChanged = false;
|
186
|
-
}
|
187
189
|
}
|
188
190
|
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
189
191
|
valueType: valueType,
|
@@ -85,7 +85,17 @@ export var removeEmptyKeys = function removeEmptyKeys(obj) {
|
|
85
85
|
return !isEmpty(value);
|
86
86
|
});
|
87
87
|
// 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
|
88
|
-
|
88
|
+
var nextObj = Object.fromEntries(filteredEntries);
|
89
|
+
// 空对象的移除出去
|
90
|
+
Object.keys(nextObj).forEach(function (key) {
|
91
|
+
var _Object$values;
|
92
|
+
if (nextObj[key] && _typeof(nextObj[key]) === 'object' && ((_Object$values = Object.values(nextObj[key])) === null || _Object$values === void 0 ? void 0 : _Object$values.every(function (item) {
|
93
|
+
return [null, undefined, ''].includes(item);
|
94
|
+
}))) {
|
95
|
+
nextObj[key] = undefined;
|
96
|
+
}
|
97
|
+
});
|
98
|
+
return nextObj;
|
89
99
|
};
|
90
100
|
/** 判断是有值的对象 */
|
91
101
|
export var isNonEmptyObject = function isNonEmptyObject(obj) {
|
@@ -34,7 +34,6 @@ var useEditTableError = function useEditTableError(_ref) {
|
|
34
34
|
if (target.classList.contains(className)) {
|
35
35
|
// 查找所有包含 className 的节点
|
36
36
|
var errorNodes = containerNode.querySelectorAll(".".concat(className));
|
37
|
-
// debugger;
|
38
37
|
// 过滤这些节点,只保留那些类名完全为 `ant-form-item-explain-error` 的节点
|
39
38
|
var validErrorNodes = Array.from(errorNodes).filter(function (node) {
|
40
39
|
return node.classList.length === 1 && node.classList.contains('ant-form-item-explain-error');
|
@@ -55,7 +55,7 @@ var Input = function Input(props) {
|
|
55
55
|
allowClear: true,
|
56
56
|
autoComplete: "off",
|
57
57
|
placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder)
|
58
|
-
}, (0, _lodash.omit)(initialConfig, ['trim'])), rest));
|
58
|
+
}, (0, _lodash.omit)(initialConfig, ['trim', 'upperCase'])), rest));
|
59
59
|
// 仅查看模式下进行数据脱敏
|
60
60
|
if ((desensitization === null || desensitization === void 0 ? void 0 : desensitization.length) && (props === null || props === void 0 ? void 0 : props.disabled)) {
|
61
61
|
var _isDesensit = sessionStorage.getItem(otherProps === null || otherProps === void 0 ? void 0 : otherProps.desensitizationKey);
|
@@ -68,7 +68,7 @@ var Input = function Input(props) {
|
|
68
68
|
allowClear: true,
|
69
69
|
autoComplete: 'off',
|
70
70
|
placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder)
|
71
|
-
}, (0, _lodash.omit)(initialConfig, ['trim'])), rest), {}, {
|
71
|
+
}, (0, _lodash.omit)(initialConfig, ['trim', 'upperCase'])), rest), {}, {
|
72
72
|
value: (0, _valueType.maskStringRangeWithRegex)(rest.value, desensitization)
|
73
73
|
}));
|
74
74
|
}
|
@@ -50,7 +50,7 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
50
50
|
autoComplete: "off",
|
51
51
|
placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder).concat(label || ''),
|
52
52
|
autoSize: !(props === null || props === void 0 ? void 0 : (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.height)
|
53
|
-
}, (0, _lodash.omit)(initialConfig, ['trim'])), rest), {}, {
|
53
|
+
}, (0, _lodash.omit)(initialConfig, ['trim', 'upperCase'])), rest), {}, {
|
54
54
|
className: _className
|
55
55
|
}));
|
56
56
|
};
|
@@ -18,6 +18,7 @@ var _icons = require("@ant-design/icons");
|
|
18
18
|
var _ahooks = require("ahooks");
|
19
19
|
var _antd = require("antd");
|
20
20
|
var _lodash = require("lodash");
|
21
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
21
22
|
var _reactSvg = require("react-svg");
|
22
23
|
var _react = _interopRequireWildcard(require("react"));
|
23
24
|
var _index = require("../../../../index");
|
@@ -25,6 +26,7 @@ var _Container = _interopRequireDefault(require("../../Container"));
|
|
25
26
|
var _view = _interopRequireDefault(require("../../../../assets/view.svg"));
|
26
27
|
var _useRequestList3 = _interopRequireDefault(require("./hooks/useRequestList"));
|
27
28
|
var _locale = _interopRequireDefault(require("../../../../locale"));
|
29
|
+
var _utils = require("./utils");
|
28
30
|
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne", "otherProps"],
|
29
31
|
_excluded2 = ["onOk"],
|
30
32
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
@@ -102,6 +104,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
102
104
|
rowSelection = _ref4.rowSelection,
|
103
105
|
restTableProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
|
104
106
|
var preValue = (0, _react.useRef)(value);
|
107
|
+
// 表单项的ref
|
108
|
+
var fieldRef = (0, _react.useRef)(null);
|
105
109
|
var defaultParams = Array.isArray(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams) ? useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : (_useRequest$options2$ = _useRequest$options2.defaultParams) === null || _useRequest$options2$ === void 0 ? void 0 : _useRequest$options2$[0] : (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams) || {};
|
106
110
|
var defaultParamsRef = (0, _react.useRef)(defaultParams); // 缓存 defaultParams 的引用
|
107
111
|
var _useSetState = (0, _ahooks.useSetState)({
|
@@ -647,6 +651,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
647
651
|
setState(nextState);
|
648
652
|
}
|
649
653
|
}, [onOff, visible, JSON.stringify(value)]);
|
654
|
+
(0, _react.useEffect)(function () {
|
655
|
+
(0, _utils.hideTooltipIfOpen)(fieldRef.current, visible);
|
656
|
+
}, [visible]);
|
650
657
|
(0, _react.useEffect)(function () {
|
651
658
|
if (value && !visible && isInit && !readOnly) {
|
652
659
|
getInitValues();
|
@@ -846,11 +853,15 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
846
853
|
children: "".concat(viewText)
|
847
854
|
});
|
848
855
|
}
|
856
|
+
var _className = (0, _classnames.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
857
|
+
'pro-modal-select': true
|
858
|
+
}, props.className, props.className), 'pro-modal-select-open', visible));
|
849
859
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
850
860
|
children: [(0, _jsxRuntime.jsx)("div", {
|
851
861
|
id: uuid,
|
852
|
-
className:
|
862
|
+
className: _className,
|
853
863
|
style: style,
|
864
|
+
ref: fieldRef,
|
854
865
|
children: isTooltip && viewText ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
855
866
|
placement: "topLeft",
|
856
867
|
open: open,
|
@@ -863,7 +874,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
863
874
|
onOk: handleFinish,
|
864
875
|
// @ts-ignore
|
865
876
|
onCancel: handleClose,
|
866
|
-
|
877
|
+
open: visible
|
867
878
|
}, restModalProps), {}, {
|
868
879
|
children: [(0, _jsxRuntime.jsx)(_index.ProForm, {
|
869
880
|
submitOnEnter: true,
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const hideTooltipIfOpen: (dom: HTMLElement, open: boolean) => void;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.hideTooltipIfOpen = void 0;
|
7
|
+
/* eslint-disable no-restricted-syntax */
|
8
|
+
var hideTooltipIfOpen = exports.hideTooltipIfOpen = function hideTooltipIfOpen(dom, open) {
|
9
|
+
if (!open && document.querySelector('.pro-modal-select-parent-open') && dom) {
|
10
|
+
var _parent = dom.closest('.pro-form-item-changed');
|
11
|
+
var _grandParent = _parent.parentElement;
|
12
|
+
_parent.className = 'pro-form-item-changed';
|
13
|
+
_grandParent === null || _grandParent === void 0 ? void 0 : _grandParent.classList.remove('pro-modal-select-parent-open');
|
14
|
+
var tooltip = _grandParent.querySelector('.ant-tooltip');
|
15
|
+
if (tooltip) {
|
16
|
+
tooltip.classList.add('ant-tooltip-hidden');
|
17
|
+
}
|
18
|
+
}
|
19
|
+
if (!dom) return;
|
20
|
+
var modal = dom.className.includes('pro-modal-select-open');
|
21
|
+
if (!modal) return;
|
22
|
+
var parent = dom.closest('.pro-form-item-changed');
|
23
|
+
var grandParent = parent.parentElement;
|
24
|
+
if (open) {
|
25
|
+
grandParent.classList.add('pro-modal-select-parent-open');
|
26
|
+
}
|
27
|
+
};
|
@@ -73,7 +73,7 @@ var isTrim = exports.isTrim = function isTrim(type, trim, configData) {
|
|
73
73
|
_ref$state = _ref.state,
|
74
74
|
state = _ref$state === void 0 ? {} : _ref$state;
|
75
75
|
var _trim = trim || (state === null || state === void 0 ? void 0 : (_state$type = state[type]) === null || _state$type === void 0 ? void 0 : _state$type.trim);
|
76
|
-
if (['Input', '
|
76
|
+
if (['Input', 'ProCombination'].includes(type) && _trim) {
|
77
77
|
result.getValueFromEvent = function (event) {
|
78
78
|
var _event$target$value;
|
79
79
|
if (Array.isArray(event)) {
|
@@ -94,7 +94,7 @@ var isTrim = exports.isTrim = function isTrim(type, trim, configData) {
|
|
94
94
|
*/
|
95
95
|
var isUpperCase = exports.isUpperCase = function isUpperCase(type, upperCase) {
|
96
96
|
var result = {};
|
97
|
-
if (['Input', '
|
97
|
+
if (['Input', 'ProCombination'].includes(type) && upperCase) {
|
98
98
|
result.getValueFromEvent = function (event) {
|
99
99
|
var _event$target, _event$target$value2;
|
100
100
|
if (Array.isArray(event)) {
|
@@ -131,65 +131,67 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
|
|
131
131
|
var isInNewRowFlag = isInNewRow(record);
|
132
132
|
var _isAddCell = isAddCell;
|
133
133
|
otherProps.isChanged = isChanged;
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
if (
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
134
|
+
if (Array.isArray(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
|
135
|
+
// 存在比对
|
136
|
+
if ((0, _lodash.isFunction)(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender)) {
|
137
|
+
var _originalObj$record$r;
|
138
|
+
var diffResult = otherProps.viewRender({
|
139
|
+
originalValue: originalValue,
|
140
|
+
originalRecord: (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {},
|
141
|
+
value: value,
|
142
|
+
record: record,
|
143
|
+
index: index
|
144
|
+
});
|
145
|
+
// viewRender 返回值为 false 时,不显示对比
|
146
|
+
if ((0, _lodash.isBoolean)(diffResult)) {
|
147
|
+
if (!diffResult) {
|
148
|
+
otherProps.isChanged = false;
|
149
|
+
_isAddCell = false;
|
150
|
+
} else {
|
151
|
+
otherProps.isChanged = true;
|
152
|
+
_isAddCell = false;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
// 指定返回相同了
|
156
|
+
if (typeof diffResult === 'string') {
|
157
|
+
if (diffResult === 'changed') {
|
158
|
+
_isAddCell = false;
|
159
|
+
otherProps.isChanged = true;
|
160
|
+
}
|
161
|
+
if (diffResult === 'same') {
|
162
|
+
_isAddCell = false;
|
163
|
+
otherProps.isChanged = false;
|
164
|
+
}
|
165
|
+
if (diffResult === 'add') {
|
166
|
+
_isAddCell = true;
|
167
|
+
otherProps.isChanged = false;
|
168
|
+
}
|
152
169
|
}
|
170
|
+
originalValue = diffResult;
|
153
171
|
}
|
154
|
-
//
|
155
|
-
if (
|
156
|
-
|
172
|
+
// 存在自定义onDiff比对
|
173
|
+
if ((0, _lodash.isFunction)(onDiff)) {
|
174
|
+
var _originalObj$record$r2;
|
175
|
+
var _diffResult = onDiff({
|
176
|
+
originalValue: originalValue,
|
177
|
+
originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
|
178
|
+
value: value,
|
179
|
+
record: record,
|
180
|
+
index: index
|
181
|
+
});
|
182
|
+
if (_diffResult === 'changed') {
|
157
183
|
_isAddCell = false;
|
158
184
|
otherProps.isChanged = true;
|
159
185
|
}
|
160
|
-
if (
|
186
|
+
if (_diffResult === 'same') {
|
161
187
|
_isAddCell = false;
|
162
188
|
otherProps.isChanged = false;
|
163
189
|
}
|
164
|
-
if (
|
190
|
+
if (_diffResult === 'add') {
|
165
191
|
_isAddCell = true;
|
166
192
|
otherProps.isChanged = false;
|
167
193
|
}
|
168
194
|
}
|
169
|
-
originalValue = diffResult;
|
170
|
-
}
|
171
|
-
// 存在自定义onDiff比对
|
172
|
-
if ((0, _lodash.isFunction)(onDiff)) {
|
173
|
-
var _originalObj$record$r2;
|
174
|
-
var _diffResult = onDiff({
|
175
|
-
originalValue: originalValue,
|
176
|
-
originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
|
177
|
-
value: value,
|
178
|
-
record: record,
|
179
|
-
index: index
|
180
|
-
});
|
181
|
-
if (_diffResult === 'changed') {
|
182
|
-
_isAddCell = false;
|
183
|
-
otherProps.isChanged = true;
|
184
|
-
}
|
185
|
-
if (_diffResult === 'same') {
|
186
|
-
_isAddCell = false;
|
187
|
-
otherProps.isChanged = false;
|
188
|
-
}
|
189
|
-
if (_diffResult === 'add') {
|
190
|
-
_isAddCell = true;
|
191
|
-
otherProps.isChanged = false;
|
192
|
-
}
|
193
195
|
}
|
194
196
|
return (0, _jsxRuntime.jsx)(_RenderColumn.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, otherProps), {}, {
|
195
197
|
valueType: valueType,
|
@@ -92,7 +92,17 @@ var removeEmptyKeys = exports.removeEmptyKeys = function removeEmptyKeys(obj) {
|
|
92
92
|
return !isEmpty(value);
|
93
93
|
});
|
94
94
|
// 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
|
95
|
-
|
95
|
+
var nextObj = Object.fromEntries(filteredEntries);
|
96
|
+
// 空对象的移除出去
|
97
|
+
Object.keys(nextObj).forEach(function (key) {
|
98
|
+
var _Object$values;
|
99
|
+
if (nextObj[key] && (0, _typeof2.default)(nextObj[key]) === 'object' && ((_Object$values = Object.values(nextObj[key])) === null || _Object$values === void 0 ? void 0 : _Object$values.every(function (item) {
|
100
|
+
return [null, undefined, ''].includes(item);
|
101
|
+
}))) {
|
102
|
+
nextObj[key] = undefined;
|
103
|
+
}
|
104
|
+
});
|
105
|
+
return nextObj;
|
96
106
|
};
|
97
107
|
/** 判断是有值的对象 */
|
98
108
|
var isNonEmptyObject = exports.isNonEmptyObject = function isNonEmptyObject(obj) {
|