@zat-design/sisyphus-react 3.3.1-beta.9 → 3.3.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/dist/index.esm.css +9 -0
- package/es/ProForm/components/combination/Group/style/index.less +12 -0
- package/es/ProForm/components/render/Render.js +13 -8
- package/es/ProForm/components/render/RenderFields.js +2 -1
- package/es/ProForm/utils/useShouldUpdate.js +17 -3
- package/es/ProTooltip/index.js +6 -17
- package/es/ProUpload/components/ImageRender.js +17 -7
- package/lib/ProForm/components/combination/Group/style/index.less +12 -0
- package/lib/ProForm/components/render/Render.js +13 -8
- package/lib/ProForm/components/render/RenderFields.js +2 -1
- package/lib/ProForm/utils/useShouldUpdate.js +17 -3
- package/lib/ProTooltip/index.js +5 -16
- package/lib/ProUpload/components/ImageRender.js +16 -6
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -2259,6 +2259,15 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2259
2259
|
align-items: center;
|
|
2260
2260
|
width: 100%;
|
|
2261
2261
|
}
|
|
2262
|
+
.pro-group .ant-space-compact > .ant-input-number:first-child {
|
|
2263
|
+
border-end-end-radius: 0;
|
|
2264
|
+
border-start-end-radius: 0;
|
|
2265
|
+
}
|
|
2266
|
+
.pro-group .ant-space-compact > .ant-input-number:last-child {
|
|
2267
|
+
border-start-start-radius: 0;
|
|
2268
|
+
border-end-start-radius: 0;
|
|
2269
|
+
margin-left: -1px;
|
|
2270
|
+
}
|
|
2262
2271
|
.pro-group .ant-space-compact .ant-form-item {
|
|
2263
2272
|
margin-bottom: 0 !important;
|
|
2264
2273
|
}
|
|
@@ -52,6 +52,18 @@
|
|
|
52
52
|
align-items: center;
|
|
53
53
|
width: 100%;
|
|
54
54
|
|
|
55
|
+
&>.@{ant-prefix}-input-number{
|
|
56
|
+
&:first-child{
|
|
57
|
+
border-end-end-radius: 0;
|
|
58
|
+
border-start-end-radius: 0;
|
|
59
|
+
}
|
|
60
|
+
&:last-child{
|
|
61
|
+
border-start-start-radius: 0;
|
|
62
|
+
border-end-start-radius: 0;
|
|
63
|
+
margin-left: -1px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
.@{ant-prefix}-form-item {
|
|
56
68
|
margin-bottom: 0 !important;
|
|
57
69
|
}
|
|
@@ -33,7 +33,7 @@ import tipSvg from '../../../assets/tip.svg';
|
|
|
33
33
|
import useRules from '../../utils/useRules';
|
|
34
34
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
35
35
|
var Render = function Render(props) {
|
|
36
|
-
var _classNames, _otherProps$names2;
|
|
36
|
+
var _ref2, _classNames, _otherProps$names2;
|
|
37
37
|
var component = props.component,
|
|
38
38
|
originComponent = props.originComponent,
|
|
39
39
|
_props$formItemProps = props.formItemProps,
|
|
@@ -163,8 +163,8 @@ var Render = function Render(props) {
|
|
|
163
163
|
}
|
|
164
164
|
/** 移除多余参数,防止透传给formItem报错 */
|
|
165
165
|
var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
|
|
166
|
-
//
|
|
167
|
-
var lastDisabled = componentProps.disabledStrictly ?
|
|
166
|
+
// 优先取组件上的disabled, 最后取formDisabled(全局
|
|
167
|
+
var lastDisabled = componentProps.disabledStrictly ? (_ref2 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : formDisabled : false;
|
|
168
168
|
/**
|
|
169
169
|
* 最新fieldProps: 更新后的组件Props
|
|
170
170
|
*/
|
|
@@ -192,8 +192,8 @@ var Render = function Render(props) {
|
|
|
192
192
|
var functionArgs = function functionArgs(args) {
|
|
193
193
|
var _otherFormItemProps$n;
|
|
194
194
|
var _args = _toConsumableArray(args);
|
|
195
|
-
var
|
|
196
|
-
valueType =
|
|
195
|
+
var _ref3 = otherProps || {},
|
|
196
|
+
valueType = _ref3.valueType;
|
|
197
197
|
_args[1] = form.getFieldsValue();
|
|
198
198
|
_args[2] = {
|
|
199
199
|
form: form
|
|
@@ -269,7 +269,7 @@ var Render = function Render(props) {
|
|
|
269
269
|
* onBlur参数重置 (value, record, { form, index, namePath, option }) => void
|
|
270
270
|
*/
|
|
271
271
|
var handleBlur = /*#__PURE__*/function () {
|
|
272
|
-
var
|
|
272
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
273
273
|
var _len2,
|
|
274
274
|
args,
|
|
275
275
|
_key2,
|
|
@@ -296,7 +296,7 @@ var Render = function Render(props) {
|
|
|
296
296
|
}, _callee);
|
|
297
297
|
}));
|
|
298
298
|
return function handleBlur() {
|
|
299
|
-
return
|
|
299
|
+
return _ref4.apply(this, arguments);
|
|
300
300
|
};
|
|
301
301
|
}();
|
|
302
302
|
var renderItem = function renderItem() {
|
|
@@ -404,7 +404,12 @@ var Render = function Render(props) {
|
|
|
404
404
|
shouldUpdate: _otherFormItemProps.shouldUpdate,
|
|
405
405
|
noStyle: true,
|
|
406
406
|
children: function children() {
|
|
407
|
-
return
|
|
407
|
+
return _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
408
|
+
// @ts-ignore
|
|
409
|
+
_internalItemRender: internalItemRender,
|
|
410
|
+
className: _className,
|
|
411
|
+
children: child
|
|
412
|
+
}));
|
|
408
413
|
}
|
|
409
414
|
});
|
|
410
415
|
}
|
|
@@ -44,6 +44,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
var comList = columns.flatMap(function (column, index) {
|
|
47
|
+
var _ref, _formItemProps$disabl;
|
|
47
48
|
if (!!expand && !openState) {
|
|
48
49
|
// expand为Number时 过滤掉大于expand 且 非fixed的column
|
|
49
50
|
if (typeof expand === 'number') {
|
|
@@ -122,7 +123,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
122
123
|
placeholder = formItemChildProps.placeholder,
|
|
123
124
|
dataSource = formItemChildProps.dataSource;
|
|
124
125
|
var formLabel = _formItemProps.label;
|
|
125
|
-
var comDisabled =
|
|
126
|
+
var comDisabled = (_ref = (_formItemProps$disabl = _formItemProps === null || _formItemProps === void 0 ? void 0 : _formItemProps.disabled) !== null && _formItemProps$disabl !== void 0 ? _formItemProps$disabl : fieldProps.disabled) !== null && _ref !== void 0 ? _ref : disabled;
|
|
126
127
|
var _disabled = comDisabled === undefined ? formDisabled : comDisabled;
|
|
127
128
|
// 当前组件是不是一个选择组件
|
|
128
129
|
var _isSelect = isSelect({
|
|
@@ -13,7 +13,8 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
13
13
|
required = props.required,
|
|
14
14
|
fieldProps = props.fieldProps,
|
|
15
15
|
component = props.component,
|
|
16
|
-
originComponent = props.originComponent
|
|
16
|
+
originComponent = props.originComponent,
|
|
17
|
+
type = props.type;
|
|
17
18
|
var _shouldUpdate = formItemProps.shouldUpdate,
|
|
18
19
|
name = formItemProps.name,
|
|
19
20
|
clearNotShow = formItemProps.clearNotShow,
|
|
@@ -60,11 +61,24 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
60
61
|
showRef.current = show;
|
|
61
62
|
}
|
|
62
63
|
if (isFunction(disabled)) {
|
|
63
|
-
|
|
64
|
+
// RangePicker返回数组时,特殊处理
|
|
65
|
+
if (type === 'RangePicker' && Array.isArray(disabled(values, {
|
|
64
66
|
form: form,
|
|
65
67
|
index: index,
|
|
66
68
|
namePath: namePath
|
|
67
|
-
}))
|
|
69
|
+
}))) {
|
|
70
|
+
disabledRef.current = disabled(values, {
|
|
71
|
+
form: form,
|
|
72
|
+
index: index,
|
|
73
|
+
namePath: namePath
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
disabledRef.current = Boolean(disabled(values, {
|
|
77
|
+
form: form,
|
|
78
|
+
index: index,
|
|
79
|
+
namePath: namePath
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
68
82
|
} else {
|
|
69
83
|
disabledRef.current = disabled;
|
|
70
84
|
}
|
package/es/ProTooltip/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
7
|
var _excluded = ["text", "mode", "width", "line", "isResponsiveWidth", "className", "style", "lineHeight"];
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { useSize, useSetState, useDebounce } from 'ahooks';
|
|
9
|
+
import { useSize, useSetState, useDebounce, useDebounceEffect } from 'ahooks';
|
|
10
10
|
import { useEffect, useRef } from 'react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import './style/index.less';
|
|
@@ -135,25 +135,12 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
135
135
|
}
|
|
136
136
|
return line > 1 ? _jsx(AutoMixinMulti, {}) : _jsx(AutoMixinSingle, {});
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
useDebounceEffect(function () {
|
|
139
139
|
if (isResponsiveWidth && parentElement) {
|
|
140
|
-
var _contentDom$style$wid;
|
|
141
140
|
var cWidth = parentElement.clientWidth - 32;
|
|
142
141
|
var contentDom = childRef.current;
|
|
143
|
-
var flag = false;
|
|
144
|
-
var styleWidth = Number((_contentDom$style$wid = contentDom.style.width) === null || _contentDom$style$wid === void 0 ? void 0 : _contentDom$style$wid.replace('px', ''));
|
|
145
|
-
if (contentDom.offsetWidth < styleWidth) {
|
|
146
|
-
flag = contentDom.scrollWidth > styleWidth;
|
|
147
|
-
} else if (contentDom.offsetWidth === styleWidth && contentDom.scrollWidth === styleWidth && contentDom.clientWidth === styleWidth) {
|
|
148
|
-
flag = false;
|
|
149
|
-
} else {
|
|
150
|
-
flag = contentDom.scrollWidth > contentDom.clientWidth;
|
|
151
|
-
}
|
|
152
|
-
if (parentElement.scrollWidth > parentElement.clientWidth) {
|
|
153
|
-
flag = true;
|
|
154
|
-
}
|
|
155
142
|
setState({
|
|
156
|
-
isShowToolTip:
|
|
143
|
+
isShowToolTip: contentDom.scrollWidth > contentDom.offsetWidth,
|
|
157
144
|
localWidth: cWidth
|
|
158
145
|
});
|
|
159
146
|
}
|
|
@@ -162,7 +149,9 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
162
149
|
localWidth: _width
|
|
163
150
|
});
|
|
164
151
|
}
|
|
165
|
-
}, [isResponsiveWidth, size]
|
|
152
|
+
}, [isResponsiveWidth, size], {
|
|
153
|
+
wait: 300
|
|
154
|
+
});
|
|
166
155
|
useEffect(function () {
|
|
167
156
|
if (mode === 'auto' && line === 1) {
|
|
168
157
|
var localDom = ref.current;
|
|
@@ -17,12 +17,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
17
17
|
* @Author: wangshengqiang
|
|
18
18
|
* @Date: 2023-07-27 20:13:07
|
|
19
19
|
* @LastEditors: wangshengqiang
|
|
20
|
-
* @LastEditTime: 2023-11-
|
|
20
|
+
* @LastEditTime: 2023-11-29 19:33:04
|
|
21
21
|
* @Description: 图片类型
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import { useState } from 'react';
|
|
25
|
+
import { useRef, useState } from 'react';
|
|
26
26
|
import { DndContext } from '@dnd-kit/core';
|
|
27
27
|
import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
|
|
28
28
|
import { ReactSVG } from 'react-svg';
|
|
@@ -34,6 +34,9 @@ import lookSvg from '../../assets/look.svg';
|
|
|
34
34
|
import deleteSvg from '../../assets/delete.svg';
|
|
35
35
|
import downloadSvg from '../../assets/download.svg';
|
|
36
36
|
import locale from '../../locale';
|
|
37
|
+
var isImgage = function isImgage(_fileExt) {
|
|
38
|
+
return ['.PNG', '.JPG', '.JPEG', '.GIF', '.BMP', '.JPE'].includes(_fileExt.toLocaleUpperCase());
|
|
39
|
+
};
|
|
37
40
|
/* 按钮类型 */
|
|
38
41
|
var ImageRender = function ImageRender(props) {
|
|
39
42
|
var _locale$ProUpload4;
|
|
@@ -41,6 +44,7 @@ var ImageRender = function ImageRender(props) {
|
|
|
41
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
45
|
previewImg = _useState2[0],
|
|
43
46
|
setPreviewImg = _useState2[1];
|
|
47
|
+
var proViewerRef = useRef(null);
|
|
44
48
|
var isView = props.isView,
|
|
45
49
|
disabled = props.disabled,
|
|
46
50
|
headerRender = props.headerRender,
|
|
@@ -67,7 +71,13 @@ var ImageRender = function ImageRender(props) {
|
|
|
67
71
|
if (onPreview) {
|
|
68
72
|
onPreview(file);
|
|
69
73
|
} else {
|
|
70
|
-
|
|
74
|
+
var _file$url;
|
|
75
|
+
var _fileExt = getFileExt(file.name || (file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('?')[0]));
|
|
76
|
+
if (isImgage(_fileExt)) {
|
|
77
|
+
setPreviewImg(file);
|
|
78
|
+
} else {
|
|
79
|
+
window.open(file.url, '_blank');
|
|
80
|
+
}
|
|
71
81
|
}
|
|
72
82
|
};
|
|
73
83
|
/**
|
|
@@ -96,12 +106,12 @@ var ImageRender = function ImageRender(props) {
|
|
|
96
106
|
openFileDialogOnClick: !showDraggerSingleRender,
|
|
97
107
|
disabled: disabled || isView,
|
|
98
108
|
itemRender: function itemRender(originNode, file, fileList, actions) {
|
|
99
|
-
var _file$
|
|
109
|
+
var _file$url2, _locale$ProUpload, _locale$ProUpload2, _locale$ProUpload3;
|
|
100
110
|
var _isShowDownload = !!onDownload && file.status === 'done';
|
|
101
|
-
var _fileExt = getFileExt(file.name || (file === null || file === void 0 ? void 0 : (_file$
|
|
111
|
+
var _fileExt = getFileExt(file.name || (file === null || file === void 0 ? void 0 : (_file$url2 = file.url) === null || _file$url2 === void 0 ? void 0 : _file$url2.split('?')[0]));
|
|
102
112
|
var _fileIcon = getFileIcon(_fileExt);
|
|
103
|
-
var isImg =
|
|
104
|
-
var _showPreview = isImg;
|
|
113
|
+
var isImg = isImgage(_fileExt);
|
|
114
|
+
var _showPreview = isImg || file.status === 'done';
|
|
105
115
|
return _jsx(DraggableUploadListItem, {
|
|
106
116
|
file: file,
|
|
107
117
|
children: _jsxs("div", {
|
|
@@ -52,6 +52,18 @@
|
|
|
52
52
|
align-items: center;
|
|
53
53
|
width: 100%;
|
|
54
54
|
|
|
55
|
+
&>.@{ant-prefix}-input-number{
|
|
56
|
+
&:first-child{
|
|
57
|
+
border-end-end-radius: 0;
|
|
58
|
+
border-start-end-radius: 0;
|
|
59
|
+
}
|
|
60
|
+
&:last-child{
|
|
61
|
+
border-start-start-radius: 0;
|
|
62
|
+
border-end-start-radius: 0;
|
|
63
|
+
margin-left: -1px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
.@{ant-prefix}-form-item {
|
|
56
68
|
margin-bottom: 0 !important;
|
|
57
69
|
}
|
|
@@ -31,7 +31,7 @@ var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className",
|
|
|
31
31
|
/* eslint-disable prefer-destructuring */
|
|
32
32
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
33
33
|
var Render = function Render(props) {
|
|
34
|
-
var _classNames, _otherProps$names2;
|
|
34
|
+
var _ref2, _classNames, _otherProps$names2;
|
|
35
35
|
var component = props.component,
|
|
36
36
|
originComponent = props.originComponent,
|
|
37
37
|
_props$formItemProps = props.formItemProps,
|
|
@@ -161,8 +161,8 @@ var Render = function Render(props) {
|
|
|
161
161
|
}
|
|
162
162
|
/** 移除多余参数,防止透传给formItem报错 */
|
|
163
163
|
var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
|
|
164
|
-
//
|
|
165
|
-
var lastDisabled = componentProps.disabledStrictly ?
|
|
164
|
+
// 优先取组件上的disabled, 最后取formDisabled(全局
|
|
165
|
+
var lastDisabled = componentProps.disabledStrictly ? (_ref2 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : formDisabled : false;
|
|
166
166
|
/**
|
|
167
167
|
* 最新fieldProps: 更新后的组件Props
|
|
168
168
|
*/
|
|
@@ -190,8 +190,8 @@ var Render = function Render(props) {
|
|
|
190
190
|
var functionArgs = function functionArgs(args) {
|
|
191
191
|
var _otherFormItemProps$n;
|
|
192
192
|
var _args = (0, _toConsumableArray2.default)(args);
|
|
193
|
-
var
|
|
194
|
-
valueType =
|
|
193
|
+
var _ref3 = otherProps || {},
|
|
194
|
+
valueType = _ref3.valueType;
|
|
195
195
|
_args[1] = form.getFieldsValue();
|
|
196
196
|
_args[2] = {
|
|
197
197
|
form: form
|
|
@@ -267,7 +267,7 @@ var Render = function Render(props) {
|
|
|
267
267
|
* onBlur参数重置 (value, record, { form, index, namePath, option }) => void
|
|
268
268
|
*/
|
|
269
269
|
var handleBlur = /*#__PURE__*/function () {
|
|
270
|
-
var
|
|
270
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
271
271
|
var _len2,
|
|
272
272
|
args,
|
|
273
273
|
_key2,
|
|
@@ -294,7 +294,7 @@ var Render = function Render(props) {
|
|
|
294
294
|
}, _callee);
|
|
295
295
|
}));
|
|
296
296
|
return function handleBlur() {
|
|
297
|
-
return
|
|
297
|
+
return _ref4.apply(this, arguments);
|
|
298
298
|
};
|
|
299
299
|
}();
|
|
300
300
|
var renderItem = function renderItem() {
|
|
@@ -402,7 +402,12 @@ var Render = function Render(props) {
|
|
|
402
402
|
shouldUpdate: _otherFormItemProps.shouldUpdate,
|
|
403
403
|
noStyle: true,
|
|
404
404
|
children: function children() {
|
|
405
|
-
return
|
|
405
|
+
return (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
406
|
+
// @ts-ignore
|
|
407
|
+
_internalItemRender: internalItemRender,
|
|
408
|
+
className: _className,
|
|
409
|
+
children: child
|
|
410
|
+
}));
|
|
406
411
|
}
|
|
407
412
|
});
|
|
408
413
|
}
|
|
@@ -52,6 +52,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
var comList = columns.flatMap(function (column, index) {
|
|
55
|
+
var _ref, _formItemProps$disabl;
|
|
55
56
|
if (!!expand && !openState) {
|
|
56
57
|
// expand为Number时 过滤掉大于expand 且 非fixed的column
|
|
57
58
|
if (typeof expand === 'number') {
|
|
@@ -130,7 +131,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
130
131
|
placeholder = formItemChildProps.placeholder,
|
|
131
132
|
dataSource = formItemChildProps.dataSource;
|
|
132
133
|
var formLabel = _formItemProps.label;
|
|
133
|
-
var comDisabled =
|
|
134
|
+
var comDisabled = (_ref = (_formItemProps$disabl = _formItemProps === null || _formItemProps === void 0 ? void 0 : _formItemProps.disabled) !== null && _formItemProps$disabl !== void 0 ? _formItemProps$disabl : fieldProps.disabled) !== null && _ref !== void 0 ? _ref : disabled;
|
|
134
135
|
var _disabled = comDisabled === undefined ? formDisabled : comDisabled;
|
|
135
136
|
// 当前组件是不是一个选择组件
|
|
136
137
|
var _isSelect = (0, _utils.isSelect)({
|
|
@@ -20,7 +20,8 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
20
20
|
required = props.required,
|
|
21
21
|
fieldProps = props.fieldProps,
|
|
22
22
|
component = props.component,
|
|
23
|
-
originComponent = props.originComponent
|
|
23
|
+
originComponent = props.originComponent,
|
|
24
|
+
type = props.type;
|
|
24
25
|
var _shouldUpdate = formItemProps.shouldUpdate,
|
|
25
26
|
name = formItemProps.name,
|
|
26
27
|
clearNotShow = formItemProps.clearNotShow,
|
|
@@ -67,11 +68,24 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
67
68
|
showRef.current = show;
|
|
68
69
|
}
|
|
69
70
|
if ((0, _lodash.isFunction)(disabled)) {
|
|
70
|
-
|
|
71
|
+
// RangePicker返回数组时,特殊处理
|
|
72
|
+
if (type === 'RangePicker' && Array.isArray(disabled(values, {
|
|
71
73
|
form: form,
|
|
72
74
|
index: index,
|
|
73
75
|
namePath: namePath
|
|
74
|
-
}))
|
|
76
|
+
}))) {
|
|
77
|
+
disabledRef.current = disabled(values, {
|
|
78
|
+
form: form,
|
|
79
|
+
index: index,
|
|
80
|
+
namePath: namePath
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
disabledRef.current = Boolean(disabled(values, {
|
|
84
|
+
form: form,
|
|
85
|
+
index: index,
|
|
86
|
+
namePath: namePath
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
75
89
|
} else {
|
|
76
90
|
disabledRef.current = disabled;
|
|
77
91
|
}
|
package/lib/ProTooltip/index.js
CHANGED
|
@@ -141,25 +141,12 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
141
141
|
}
|
|
142
142
|
return line > 1 ? (0, _jsxRuntime.jsx)(AutoMixinMulti, {}) : (0, _jsxRuntime.jsx)(AutoMixinSingle, {});
|
|
143
143
|
};
|
|
144
|
-
(0,
|
|
144
|
+
(0, _ahooks.useDebounceEffect)(function () {
|
|
145
145
|
if (isResponsiveWidth && parentElement) {
|
|
146
|
-
var _contentDom$style$wid;
|
|
147
146
|
var cWidth = parentElement.clientWidth - 32;
|
|
148
147
|
var contentDom = childRef.current;
|
|
149
|
-
var flag = false;
|
|
150
|
-
var styleWidth = Number((_contentDom$style$wid = contentDom.style.width) === null || _contentDom$style$wid === void 0 ? void 0 : _contentDom$style$wid.replace('px', ''));
|
|
151
|
-
if (contentDom.offsetWidth < styleWidth) {
|
|
152
|
-
flag = contentDom.scrollWidth > styleWidth;
|
|
153
|
-
} else if (contentDom.offsetWidth === styleWidth && contentDom.scrollWidth === styleWidth && contentDom.clientWidth === styleWidth) {
|
|
154
|
-
flag = false;
|
|
155
|
-
} else {
|
|
156
|
-
flag = contentDom.scrollWidth > contentDom.clientWidth;
|
|
157
|
-
}
|
|
158
|
-
if (parentElement.scrollWidth > parentElement.clientWidth) {
|
|
159
|
-
flag = true;
|
|
160
|
-
}
|
|
161
148
|
setState({
|
|
162
|
-
isShowToolTip:
|
|
149
|
+
isShowToolTip: contentDom.scrollWidth > contentDom.offsetWidth,
|
|
163
150
|
localWidth: cWidth
|
|
164
151
|
});
|
|
165
152
|
}
|
|
@@ -168,7 +155,9 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
168
155
|
localWidth: _width
|
|
169
156
|
});
|
|
170
157
|
}
|
|
171
|
-
}, [isResponsiveWidth, size]
|
|
158
|
+
}, [isResponsiveWidth, size], {
|
|
159
|
+
wait: 300
|
|
160
|
+
});
|
|
172
161
|
(0, _react.useEffect)(function () {
|
|
173
162
|
if (mode === 'auto' && line === 1) {
|
|
174
163
|
var localDom = ref.current;
|
|
@@ -27,11 +27,14 @@ var _locale = _interopRequireDefault(require("../../locale"));
|
|
|
27
27
|
* @Author: wangshengqiang
|
|
28
28
|
* @Date: 2023-07-27 20:13:07
|
|
29
29
|
* @LastEditors: wangshengqiang
|
|
30
|
-
* @LastEditTime: 2023-11-
|
|
30
|
+
* @LastEditTime: 2023-11-29 19:33:04
|
|
31
31
|
* @Description: 图片类型
|
|
32
32
|
*
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
var isImgage = function isImgage(_fileExt) {
|
|
36
|
+
return ['.PNG', '.JPG', '.JPEG', '.GIF', '.BMP', '.JPE'].includes(_fileExt.toLocaleUpperCase());
|
|
37
|
+
};
|
|
35
38
|
/* 按钮类型 */
|
|
36
39
|
var ImageRender = function ImageRender(props) {
|
|
37
40
|
var _locale$ProUpload4;
|
|
@@ -39,6 +42,7 @@ var ImageRender = function ImageRender(props) {
|
|
|
39
42
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
40
43
|
previewImg = _useState2[0],
|
|
41
44
|
setPreviewImg = _useState2[1];
|
|
45
|
+
var proViewerRef = (0, _react.useRef)(null);
|
|
42
46
|
var isView = props.isView,
|
|
43
47
|
disabled = props.disabled,
|
|
44
48
|
headerRender = props.headerRender,
|
|
@@ -65,7 +69,13 @@ var ImageRender = function ImageRender(props) {
|
|
|
65
69
|
if (onPreview) {
|
|
66
70
|
onPreview(file);
|
|
67
71
|
} else {
|
|
68
|
-
|
|
72
|
+
var _file$url;
|
|
73
|
+
var _fileExt = (0, _FileItem.getFileExt)(file.name || (file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('?')[0]));
|
|
74
|
+
if (isImgage(_fileExt)) {
|
|
75
|
+
setPreviewImg(file);
|
|
76
|
+
} else {
|
|
77
|
+
window.open(file.url, '_blank');
|
|
78
|
+
}
|
|
69
79
|
}
|
|
70
80
|
};
|
|
71
81
|
/**
|
|
@@ -94,12 +104,12 @@ var ImageRender = function ImageRender(props) {
|
|
|
94
104
|
openFileDialogOnClick: !showDraggerSingleRender,
|
|
95
105
|
disabled: disabled || isView,
|
|
96
106
|
itemRender: function itemRender(originNode, file, fileList, actions) {
|
|
97
|
-
var _file$
|
|
107
|
+
var _file$url2, _locale$ProUpload, _locale$ProUpload2, _locale$ProUpload3;
|
|
98
108
|
var _isShowDownload = !!onDownload && file.status === 'done';
|
|
99
|
-
var _fileExt = (0, _FileItem.getFileExt)(file.name || (file === null || file === void 0 ? void 0 : (_file$
|
|
109
|
+
var _fileExt = (0, _FileItem.getFileExt)(file.name || (file === null || file === void 0 ? void 0 : (_file$url2 = file.url) === null || _file$url2 === void 0 ? void 0 : _file$url2.split('?')[0]));
|
|
100
110
|
var _fileIcon = (0, _FileItem.getFileIcon)(_fileExt);
|
|
101
|
-
var isImg =
|
|
102
|
-
var _showPreview = isImg;
|
|
111
|
+
var isImg = isImgage(_fileExt);
|
|
112
|
+
var _showPreview = isImg || file.status === 'done';
|
|
103
113
|
return (0, _jsxRuntime.jsx)(_DraggableUploadListItem.DraggableUploadListItem, {
|
|
104
114
|
file: file,
|
|
105
115
|
children: (0, _jsxRuntime.jsxs)("div", {
|