@zat-design/sisyphus-react 3.13.4-beta.2 → 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.
@@ -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: "pro-modal-select ".concat(className !== null && className !== void 0 ? 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
- visible: visible
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
+ };
@@ -31,6 +31,12 @@
31
31
  }
32
32
  }
33
33
 
34
+ .pro-modal-select-parent-open .@{ant-prefix}-tooltip {
35
+ display: none !important;
36
+ }
37
+
38
+
39
+
34
40
  .@{ant-prefix}-form-item-control-input {
35
41
  flex-grow: 1;
36
42
  max-width: 100%;
@@ -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', 'TextArea', 'ProCombination'].includes(type) && _trim) {
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', 'TextArea', 'ProCombination'].includes(type) && upperCase) {
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,7 +125,7 @@ export var formatColumn = function formatColumn(_ref2) {
125
125
  var isInNewRowFlag = isInNewRow(record);
126
126
  var _isAddCell = isAddCell;
127
127
  otherProps.isChanged = isChanged;
128
- if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource) {
128
+ if (Array.isArray(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
129
129
  // 存在比对
130
130
  if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender)) {
131
131
  var _originalObj$record$r;
@@ -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: "pro-modal-select ".concat(className !== null && className !== void 0 ? 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
- visible: visible
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
+ };
@@ -31,6 +31,12 @@
31
31
  }
32
32
  }
33
33
 
34
+ .pro-modal-select-parent-open .@{ant-prefix}-tooltip {
35
+ display: none !important;
36
+ }
37
+
38
+
39
+
34
40
  .@{ant-prefix}-form-item-control-input {
35
41
  flex-grow: 1;
36
42
  max-width: 100%;
@@ -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', 'TextArea', 'ProCombination'].includes(type) && _trim) {
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', 'TextArea', 'ProCombination'].includes(type) && upperCase) {
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,7 +131,7 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
131
131
  var isInNewRowFlag = isInNewRow(record);
132
132
  var _isAddCell = isAddCell;
133
133
  otherProps.isChanged = isChanged;
134
- if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource) {
134
+ if (Array.isArray(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
135
135
  // 存在比对
136
136
  if ((0, _lodash.isFunction)(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender)) {
137
137
  var _originalObj$record$r;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.4-beta.2",
3
+ "version": "3.13.4-beta.3",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",