@zat-design/sisyphus-react 3.9.2 → 3.9.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/.vscode/extensions.json +5 -0
- package/dist/index.esm.css +21 -1
- package/dist/less.esm.css +21 -1
- package/es/ProConfigProvider/index.js +3 -3
- package/es/ProEditTable/components/RenderField/index.js +3 -2
- package/es/ProEditTable/index.js +20 -15
- package/es/ProEnum/hooks/useEnum.js +2 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +10 -7
- package/es/ProForm/components/combination/FormList/components/LineFields.js +2 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +6 -3
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +7 -3
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
- package/es/ProForm/components/render/ChangedWrapper.js +6 -4
- package/es/ProForm/components/render/Render.js +11 -7
- package/es/ProForm/index.js +11 -8
- package/es/ProForm/utils/diffOriginal.js +0 -1
- package/es/ProIcon/index.js +39 -22
- package/es/ProIcon/propsTypes.d.ts +2 -0
- package/es/ProTable/components/FormatColumn/index.js +69 -29
- package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/es/ProTable/components/RenderColumn/index.js +3 -5
- package/es/ProTable/propsType.d.ts +4 -5
- package/es/ProTable/style/index.less +27 -10
- package/es/ProTable/utils/index.d.ts +2 -0
- package/es/ProTable/utils/index.js +16 -3
- package/lib/ProConfigProvider/index.js +2 -2
- package/lib/ProEditTable/components/RenderField/index.js +3 -2
- package/lib/ProEditTable/index.js +19 -14
- package/lib/ProEnum/hooks/useEnum.js +2 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +9 -6
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +2 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -2
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +7 -3
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
- package/lib/ProForm/components/render/ChangedWrapper.js +6 -4
- package/lib/ProForm/components/render/Render.js +11 -7
- package/lib/ProForm/index.js +10 -7
- package/lib/ProForm/utils/diffOriginal.js +0 -1
- package/lib/ProIcon/index.js +37 -22
- package/lib/ProIcon/propsTypes.d.ts +2 -0
- package/lib/ProTable/components/FormatColumn/index.js +69 -29
- package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/lib/ProTable/components/RenderColumn/index.js +3 -5
- package/lib/ProTable/propsType.d.ts +4 -5
- package/lib/ProTable/style/index.less +27 -10
- package/lib/ProTable/utils/index.d.ts +2 -0
- package/lib/ProTable/utils/index.js +16 -3
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
@@ -1931,9 +1931,10 @@
|
|
1931
1931
|
}
|
1932
1932
|
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .varied-cell,
|
1933
1933
|
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .varied-cell {
|
1934
|
+
display: block;
|
1934
1935
|
margin-left: -8px;
|
1935
1936
|
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
1936
|
-
background: var(--zaui-contract-bg, #fffaa1) !important;
|
1937
|
+
background-color: var(--zaui-contract-bg, #fffaa1) !important;
|
1937
1938
|
border-radius: var(--zaui-border-radius, 8px);
|
1938
1939
|
}
|
1939
1940
|
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container,
|
@@ -1942,6 +1943,20 @@
|
|
1942
1943
|
white-space: nowrap;
|
1943
1944
|
text-overflow: ellipsis;
|
1944
1945
|
}
|
1946
|
+
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell,
|
1947
|
+
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell {
|
1948
|
+
display: block;
|
1949
|
+
margin-left: -8px;
|
1950
|
+
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
1951
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
1952
|
+
border-radius: var(--zaui-border-radius, 8px);
|
1953
|
+
}
|
1954
|
+
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container,
|
1955
|
+
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container {
|
1956
|
+
overflow: hidden;
|
1957
|
+
white-space: nowrap;
|
1958
|
+
text-overflow: ellipsis;
|
1959
|
+
}
|
1945
1960
|
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container,
|
1946
1961
|
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
|
1947
1962
|
overflow: hidden;
|
@@ -2185,6 +2200,11 @@
|
|
2185
2200
|
.ant-table .original-value-tooltip {
|
2186
2201
|
position: fixed;
|
2187
2202
|
}
|
2203
|
+
.ant-table .original-value-tooltip.ant-tooltip > ant-tooltip-content > ant-tooltip-inner {
|
2204
|
+
width: -webkit-max-content;
|
2205
|
+
width: -moz-max-content;
|
2206
|
+
width: max-content;
|
2207
|
+
}
|
2188
2208
|
.pro-tooltip {
|
2189
2209
|
cursor: pointer;
|
2190
2210
|
}
|
package/dist/less.esm.css
CHANGED
@@ -1931,9 +1931,10 @@
|
|
1931
1931
|
}
|
1932
1932
|
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .varied-cell,
|
1933
1933
|
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .varied-cell {
|
1934
|
+
display: block;
|
1934
1935
|
margin-left: -8px;
|
1935
1936
|
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
1936
|
-
background: var(--zaui-contract-bg, #fffaa1) !important;
|
1937
|
+
background-color: var(--zaui-contract-bg, #fffaa1) !important;
|
1937
1938
|
border-radius: var(--zaui-border-radius, 8px);
|
1938
1939
|
}
|
1939
1940
|
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container,
|
@@ -1942,6 +1943,20 @@
|
|
1942
1943
|
white-space: nowrap;
|
1943
1944
|
text-overflow: ellipsis;
|
1944
1945
|
}
|
1946
|
+
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell,
|
1947
|
+
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell {
|
1948
|
+
display: block;
|
1949
|
+
margin-left: -8px;
|
1950
|
+
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
1951
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
1952
|
+
border-radius: var(--zaui-border-radius, 8px);
|
1953
|
+
}
|
1954
|
+
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container,
|
1955
|
+
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container {
|
1956
|
+
overflow: hidden;
|
1957
|
+
white-space: nowrap;
|
1958
|
+
text-overflow: ellipsis;
|
1959
|
+
}
|
1945
1960
|
.pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container,
|
1946
1961
|
.pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
|
1947
1962
|
overflow: hidden;
|
@@ -2185,6 +2200,11 @@
|
|
2185
2200
|
.ant-table .original-value-tooltip {
|
2186
2201
|
position: fixed;
|
2187
2202
|
}
|
2203
|
+
.ant-table .original-value-tooltip.ant-tooltip > ant-tooltip-content > ant-tooltip-inner {
|
2204
|
+
width: -webkit-max-content;
|
2205
|
+
width: -moz-max-content;
|
2206
|
+
width: max-content;
|
2207
|
+
}
|
2188
2208
|
.pro-tooltip {
|
2189
2209
|
cursor: pointer;
|
2190
2210
|
}
|
@@ -2,7 +2,7 @@ import "antd/es/config-provider/style";
|
|
2
2
|
import _ConfigProvider from "antd/es/config-provider";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
5
|
-
import {
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
6
|
import React, { useContext, useEffect, useReducer } from 'react';
|
7
7
|
import zhCN from 'antd/es/locale/zh_CN';
|
8
8
|
import enUS from 'antd/es/locale/en_US';
|
@@ -105,8 +105,8 @@ export var ProConfigProvider = function ProConfigProvider(props) {
|
|
105
105
|
},
|
106
106
|
children: _jsx(_ConfigProvider, {
|
107
107
|
locale: antdLangMap[lang],
|
108
|
-
children:
|
109
|
-
children:
|
108
|
+
children: _jsx("div", {
|
109
|
+
children: props.children
|
110
110
|
})
|
111
111
|
})
|
112
112
|
});
|
@@ -75,7 +75,8 @@ var RenderField = function RenderField(_ref) {
|
|
75
75
|
_config$validateTrigg = config.validateTrigger,
|
76
76
|
validateTrigger = _config$validateTrigg === void 0 ? ['onChange', 'onBlur', 'onSubmit'] : _config$validateTrigg,
|
77
77
|
otherProps = config.otherProps,
|
78
|
-
diffConfig = config.diffConfig
|
78
|
+
diffConfig = config.diffConfig,
|
79
|
+
getIsNew = config.getIsNew;
|
79
80
|
var _fieldProps = fieldProps || formItemProps || {};
|
80
81
|
var _rules = rules || [];
|
81
82
|
var _required = required;
|
@@ -546,7 +547,7 @@ var RenderField = function RenderField(_ref) {
|
|
546
547
|
var _componentProps;
|
547
548
|
var FormItem = null;
|
548
549
|
var FieldComponent = /*#__PURE__*/React.isValidElement(TargetComponent) ? (/*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps));
|
549
|
-
if (originalValues) {
|
550
|
+
if (originalValues && !getIsNew(record)) {
|
550
551
|
FieldComponent = _jsx(ListChangedWrapper, {
|
551
552
|
name: cellName,
|
552
553
|
names: names,
|
package/es/ProEditTable/index.js
CHANGED
@@ -2,7 +2,6 @@ import "antd/es/affix/style";
|
|
2
2
|
import _Affix from "antd/es/affix";
|
3
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
5
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
6
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
6
|
import "antd/es/config-provider/style";
|
8
7
|
import _ConfigProvider from "antd/es/config-provider";
|
@@ -13,7 +12,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
13
12
|
var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection", "diffConfig"];
|
14
13
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
15
14
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
16
|
-
import { get, isArray, isBoolean } from 'lodash';
|
15
|
+
import { get, isArray, isBoolean, set } from 'lodash';
|
17
16
|
import { useDeepCompareEffect, useLocalStorageState, useSetState } from 'ahooks';
|
18
17
|
import classnames from 'classnames';
|
19
18
|
import { transformColumns } from './utils';
|
@@ -127,17 +126,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
127
126
|
}
|
128
127
|
return key;
|
129
128
|
};
|
130
|
-
var IsNew = function IsNew(preArr, record) {
|
131
|
-
var _preArr$find;
|
132
|
-
if (!(preArr === null || preArr === void 0 ? void 0 : preArr.length)) {
|
133
|
-
return false;
|
134
|
-
}
|
135
|
-
return !(preArr === null || preArr === void 0 ? void 0 : (_preArr$find = preArr.find) === null || _preArr$find === void 0 ? void 0 : _preArr$find.call(preArr, function (item) {
|
136
|
-
return getRowKey(item) === getRowKey(record);
|
137
|
-
}));
|
138
|
-
};
|
139
129
|
var originalValues = useMemo(function () {
|
140
130
|
var _originalArr$every, _originalArr$some;
|
131
|
+
var nextOriginalValues;
|
141
132
|
// 原始值也需要设置对应的rowkey,后续比对通过rowkey对比
|
142
133
|
var originalArr = get(resetProps === null || resetProps === void 0 ? void 0 : resetProps.originalValues, name);
|
143
134
|
var isOriginalAllHasKey = originalArr ? originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$every = originalArr.every) === null || _originalArr$every === void 0 ? void 0 : _originalArr$every.call(originalArr, function (item) {
|
@@ -153,8 +144,22 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
153
144
|
item.rowKey = getRowKey(item);
|
154
145
|
});
|
155
146
|
}
|
156
|
-
|
147
|
+
if (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) {
|
148
|
+
nextOriginalValues = {};
|
149
|
+
set(nextOriginalValues, name, originalArr);
|
150
|
+
}
|
151
|
+
return nextOriginalValues;
|
157
152
|
}, [resetProps === null || resetProps === void 0 ? void 0 : resetProps.originalValues]);
|
153
|
+
var getIsNew = function getIsNew(record) {
|
154
|
+
var _originalArr$find;
|
155
|
+
var originalArr = get(originalValues, name);
|
156
|
+
if (!(originalArr === null || originalArr === void 0 ? void 0 : originalArr.length)) {
|
157
|
+
return false;
|
158
|
+
}
|
159
|
+
return !(originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$find = originalArr.find) === null || _originalArr$find === void 0 ? void 0 : _originalArr$find.call(originalArr, function (item) {
|
160
|
+
return getRowKey(item) === getRowKey(record);
|
161
|
+
}));
|
162
|
+
};
|
158
163
|
var config = _objectSpread({
|
159
164
|
form: form,
|
160
165
|
mode: mode,
|
@@ -188,14 +193,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
188
193
|
prefixCls: prefixCls,
|
189
194
|
rowDisabled: rowDisabled,
|
190
195
|
actionDirection: actionDirection,
|
191
|
-
diffConfig: _objectSpread(_objectSpread({}, resetProps === null || resetProps === void 0 ? void 0 : (_resetProps$otherProp = resetProps.otherProps) === null || _resetProps$otherProp === void 0 ? void 0 : _resetProps$otherProp.diffConfig), diffConfig)
|
196
|
+
diffConfig: _objectSpread(_objectSpread({}, resetProps === null || resetProps === void 0 ? void 0 : (_resetProps$otherProp = resetProps.otherProps) === null || _resetProps$otherProp === void 0 ? void 0 : _resetProps$otherProp.diffConfig), diffConfig),
|
197
|
+
getIsNew: getIsNew
|
192
198
|
}, resetProps);
|
193
199
|
// 编辑行设置下样式
|
194
200
|
var _rowClassName = function _rowClassName(record) {
|
195
201
|
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|
196
202
|
var className = isEdit ? 'is-editing' : '';
|
197
|
-
|
198
|
-
if (IsNew(originalArr, record)) {
|
203
|
+
if (getIsNew(record)) {
|
199
204
|
return "is-new-row ".concat(className);
|
200
205
|
}
|
201
206
|
return className;
|
@@ -22,6 +22,8 @@ function useEnum(codes, value, compose) {
|
|
22
22
|
_ref3$clear = _ref3.clear,
|
23
23
|
clear = _ref3$clear === void 0 ? true : _ref3$clear;
|
24
24
|
var catchData = getEnumData(storage, cacheKey, baseEnumStorage);
|
25
|
+
// 默认枚举缓存数据
|
26
|
+
baseEnumStorage = catchData;
|
25
27
|
if (!codes) {
|
26
28
|
return catchData;
|
27
29
|
}
|
@@ -13,11 +13,12 @@ var _excluded = ["label", "onClick", "onHandle", "type", "needConfirm", "confirm
|
|
13
13
|
_excluded2 = ["onClick", "label"];
|
14
14
|
import { createElement as _createElement } from "react";
|
15
15
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
16
|
-
import { isFunction } from 'lodash';
|
16
|
+
import { isFunction, omit } from 'lodash';
|
17
17
|
import { useMemo } from 'react';
|
18
18
|
import { CopyOutlined, DownSquareOutlined, PlusSquareOutlined, UpSquareOutlined } from '@ant-design/icons';
|
19
19
|
import ProIcon from '../../../../../ProIcon';
|
20
20
|
import locale from '../../../../../locale';
|
21
|
+
var filterKeys = ['actionType'];
|
21
22
|
var getDefaultActions = function getDefaultActions(mode) {
|
22
23
|
var originActions = {
|
23
24
|
add: {
|
@@ -42,9 +43,11 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
42
43
|
label: "".concat(locale.ProForm.formListActions[1]),
|
43
44
|
icon: mode === 'less' ? _jsx(ProIcon, {
|
44
45
|
type: "solid-close",
|
45
|
-
className: "single-delete"
|
46
|
+
className: "single-delete",
|
47
|
+
buttonIcon: false
|
46
48
|
}) : _jsx(ProIcon, {
|
47
|
-
type: "delete"
|
49
|
+
type: "delete",
|
50
|
+
buttonIcon: false
|
48
51
|
})
|
49
52
|
},
|
50
53
|
copy: {
|
@@ -240,14 +243,14 @@ var ActionButton = function ActionButton(props) {
|
|
240
243
|
handleClick(internalOnClick, _onClick, index, item);
|
241
244
|
}
|
242
245
|
}, _confirmProps), {}, {
|
243
|
-
children: _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), rest), {}, {
|
246
|
+
children: _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), omit(rest, filterKeys)), {}, {
|
244
247
|
type: "text",
|
245
248
|
onClick: function onClick(e) {
|
246
249
|
return e.stopPropagation();
|
247
250
|
},
|
248
251
|
children: label || defaultLabel
|
249
252
|
}))
|
250
|
-
}), "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index)) : _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), rest), {}, {
|
253
|
+
}), "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index)) : _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), omit(rest, filterKeys)), {}, {
|
251
254
|
type: "text",
|
252
255
|
onClick: function onClick(e) {
|
253
256
|
e.stopPropagation();
|
@@ -265,14 +268,14 @@ var ActionButton = function ActionButton(props) {
|
|
265
268
|
return customClick(_onClick, index);
|
266
269
|
}
|
267
270
|
}, _confirmProps), {}, {
|
268
|
-
children: _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
|
271
|
+
children: _jsx(_Button, _objectSpread(_objectSpread({}, omit(rest, filterKeys)), {}, {
|
269
272
|
type: "text",
|
270
273
|
onClick: function onClick(e) {
|
271
274
|
return e.stopPropagation();
|
272
275
|
},
|
273
276
|
children: label
|
274
277
|
}))
|
275
|
-
}), "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index)) : (/*#__PURE__*/_createElement(_Button, _objectSpread(_objectSpread({}, rest), {}, {
|
278
|
+
}), "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index)) : (/*#__PURE__*/_createElement(_Button, _objectSpread(_objectSpread({}, omit(rest, filterKeys)), {}, {
|
276
279
|
key: "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index),
|
277
280
|
type: "text",
|
278
281
|
onClick: function onClick(e) {
|
@@ -10,8 +10,10 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
10
10
|
var _excluded = ["label", "onClick", "onHandle", "type"],
|
11
11
|
_excluded2 = ["onClick", "label"];
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
13
|
+
/* eslint-disable react/no-array-index-key */
|
14
|
+
|
13
15
|
import { PlusOutlined } from '@ant-design/icons';
|
14
|
-
import { isFunction } from 'lodash';
|
16
|
+
import { isFunction, omit } from 'lodash';
|
15
17
|
import { useMemo } from 'react';
|
16
18
|
import locale from '../../../../../locale';
|
17
19
|
var actions = {
|
@@ -27,6 +29,7 @@ var actions = {
|
|
27
29
|
var defaultActionProps = [{
|
28
30
|
type: 'add'
|
29
31
|
}];
|
32
|
+
var filterKeys = ['actionType'];
|
30
33
|
var ToolbarButton = function ToolbarButton(props) {
|
31
34
|
var namePath = props.namePath,
|
32
35
|
form = props.form,
|
@@ -128,7 +131,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
128
131
|
if (max && max <= fields.length && type === 'add') {
|
129
132
|
return false;
|
130
133
|
}
|
131
|
-
return _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, actions[type]), rest), {}, {
|
134
|
+
return _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, actions[type]), omit(rest, filterKeys)), {}, {
|
132
135
|
type: "link",
|
133
136
|
onClick: function onClick() {
|
134
137
|
return handleClick(internalOnClick, _onClick, item);
|
@@ -136,7 +139,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
136
139
|
children: label || defaultLabel
|
137
140
|
}), "".concat(type).concat(index));
|
138
141
|
}
|
139
|
-
return _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
|
142
|
+
return _jsx(_Button, _objectSpread(_objectSpread({}, omit(rest, filterKeys)), {}, {
|
140
143
|
type: "link",
|
141
144
|
onClick: function onClick() {
|
142
145
|
return customClick(_onClick2, item);
|
@@ -95,7 +95,7 @@ var FormList = function FormList(props, ref) {
|
|
95
95
|
}),
|
96
96
|
strategy: verticalListSortingStrategy,
|
97
97
|
children: [_fields.map(function (field, index) {
|
98
|
-
var namePath = [].concat(_toConsumableArray(_namePath), [
|
98
|
+
var namePath = [].concat(_toConsumableArray(_namePath), [field.name]);
|
99
99
|
var _columns = processColumns(index, namePath);
|
100
100
|
return mode === 'block' ? _jsx(BlockFields, _objectSpread(_objectSpread({}, props), {}, {
|
101
101
|
columns: _columns,
|
@@ -13,7 +13,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
13
13
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
14
14
|
import "antd/es/typography/style";
|
15
15
|
import _Typography from "antd/es/typography";
|
16
|
-
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator", "detailPlaceholder"];
|
16
|
+
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator", "detailPlaceholder", "scrollFollowParent"];
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
18
18
|
import { useEffect, useState, memo, useMemo } from 'react';
|
19
19
|
import { omit, find as _find } from 'lodash';
|
@@ -87,6 +87,7 @@ var ProCascader = function ProCascader(props) {
|
|
87
87
|
_props$separator = props.separator,
|
88
88
|
separator = _props$separator === void 0 ? '/' : _props$separator,
|
89
89
|
detailPlaceholder = props.detailPlaceholder,
|
90
|
+
scrollFollowParent = props.scrollFollowParent,
|
90
91
|
otherProps = _objectWithoutProperties(props, _excluded);
|
91
92
|
var _ref3 = ProForm.useFieldProps() || {},
|
92
93
|
isViewCon = _ref3.isView,
|
@@ -273,8 +274,11 @@ var ProCascader = function ProCascader(props) {
|
|
273
274
|
filter: handlefilter,
|
274
275
|
limit: 1000
|
275
276
|
},
|
276
|
-
onChange: handleChange
|
277
|
-
|
277
|
+
onChange: handleChange,
|
278
|
+
getPopupContainer: function getPopupContainer(trigger) {
|
279
|
+
return scrollFollowParent ? trigger.parentElement : document.body;
|
280
|
+
}
|
281
|
+
}, omit(otherProps, ['otherProps', 'scrollFollowParent']))), hasDetail && (tooltip && disabled && detail ? _jsx(_Tooltip, {
|
278
282
|
title: detail,
|
279
283
|
children: _jsx("span", {
|
280
284
|
className: "pro-address-detail",
|
@@ -13,6 +13,7 @@ import React, { useMemo } from 'react';
|
|
13
13
|
import { diffOriginal } from '../../utils/diffOriginal';
|
14
14
|
import { useProConfig } from '../../../ProConfigProvider';
|
15
15
|
import { isEmpty } from '../../../utils';
|
16
|
+
var componentsWithFloatWindow = ['Select', 'ProSelect', 'ProEnum', 'ProTimeLimit', 'ProModalSelect', 'ProCascader', 'DataPicker', 'RangePicker', 'TimePicker'];
|
16
17
|
var ChangedWrapper = function ChangedWrapper(props) {
|
17
18
|
var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
|
18
19
|
var name = props.name,
|
@@ -98,6 +99,9 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
98
99
|
'pro-form-item-add': isAdd
|
99
100
|
});
|
100
101
|
var open = tipOpenCalc();
|
102
|
+
var scrollFollowParentConfig = componentsWithFloatWindow.includes(type) ? {
|
103
|
+
scrollFollowParent: scrollFollowParent
|
104
|
+
} : {};
|
101
105
|
return _jsx(_Tooltip, {
|
102
106
|
open: open,
|
103
107
|
getPopupContainer: function getPopupContainer(trigger) {
|
@@ -115,8 +119,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
115
119
|
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
116
120
|
}), _showEllipse && _jsxs(_Space, {
|
117
121
|
className: "current-value-container",
|
118
|
-
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
119
|
-
scrollFollowParent: scrollFollowParent,
|
122
|
+
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, children.props), rest), scrollFollowParentConfig), {}, {
|
120
123
|
isView: true
|
121
124
|
})) : undefined]
|
122
125
|
})]
|
@@ -124,8 +127,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
124
127
|
children: _jsx("div", {
|
125
128
|
className: diffClassName,
|
126
129
|
style: style,
|
127
|
-
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
128
|
-
scrollFollowParent: scrollFollowParent,
|
130
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, children.props), rest), scrollFollowParentConfig), {}, {
|
129
131
|
otherProps: _objectSpread(_objectSpread({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
|
130
132
|
isDiffChange: isChanged
|
131
133
|
})
|
@@ -136,6 +136,12 @@ var Render = function Render(props) {
|
|
136
136
|
var transforms = Array.isArray(otherProps === null || otherProps === void 0 ? void 0 : otherProps.names) ? transformNames(_objectSpread(_objectSpread({}, otherFormItemProps), valueTypeTransform()),
|
137
137
|
// 合并valueType的transform
|
138
138
|
form, otherProps.names, namesStr, otherProps.type) : valueTypeTransform();
|
139
|
+
/**
|
140
|
+
* globalControl 全局控制优先
|
141
|
+
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
142
|
+
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
143
|
+
*/
|
144
|
+
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
|
139
145
|
// ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
|
140
146
|
Object.assign(otherFormItemProps, transforms, {
|
141
147
|
names: otherProps.names
|
@@ -148,6 +154,10 @@ var Render = function Render(props) {
|
|
148
154
|
} : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
|
149
155
|
_objectSpread({}, isUpperCase(type, upperCase)), {
|
150
156
|
validateFirst: true
|
157
|
+
},
|
158
|
+
// 当某一规则校验不通过时,是否停止剩下的规则的校验
|
159
|
+
{
|
160
|
+
disabled: lastDisabled
|
151
161
|
});
|
152
162
|
// 添加label宽度
|
153
163
|
if (labelWidth) {
|
@@ -157,12 +167,6 @@ var Render = function Render(props) {
|
|
157
167
|
}
|
158
168
|
/** 移除多余参数,防止透传给formItem报错 */
|
159
169
|
var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames']);
|
160
|
-
/**
|
161
|
-
* globalControl 全局控制优先
|
162
|
-
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
163
|
-
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
164
|
-
*/
|
165
|
-
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
|
166
170
|
/**
|
167
171
|
* 最新fieldProps: 更新后的组件Props
|
168
172
|
*/
|
@@ -401,7 +405,7 @@ var Render = function Render(props) {
|
|
401
405
|
};
|
402
406
|
}
|
403
407
|
// 需要过滤掉的form_item的key
|
404
|
-
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl', 'listName'];
|
408
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl', 'listName', 'fixed'];
|
405
409
|
if (type === 'FormList') {
|
406
410
|
lastComponentProps.disabled = lastDisabled;
|
407
411
|
var lessMode = lastComponentProps.mode === 'less';
|
package/es/ProForm/index.js
CHANGED
@@ -16,7 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
17
17
|
import classnames from 'classnames';
|
18
18
|
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
19
|
-
import { isObject, merge } from 'lodash';
|
19
|
+
import { isObject, merge, omit } from 'lodash';
|
20
20
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
21
21
|
import RenderFields from './components/render/RenderFields';
|
22
22
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
@@ -91,12 +91,15 @@ var ProForm = function ProForm(props, ref) {
|
|
91
91
|
useMemo(function () {
|
92
92
|
if (formKey && forms[formKey] !== form) {
|
93
93
|
forms[formKey] = form;
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
// fix: Cannot update a component (`ProConfigProvider`) while rendering a different component (`ForwardRef(ProForm)`).
|
95
|
+
setTimeout(function () {
|
96
|
+
dispatch({
|
97
|
+
type: 'set',
|
98
|
+
payload: {
|
99
|
+
forms: _objectSpread({}, forms)
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}, 300);
|
100
103
|
}
|
101
104
|
// 销毁
|
102
105
|
return function () {
|
@@ -237,7 +240,7 @@ var ProForm = function ProForm(props, ref) {
|
|
237
240
|
},
|
238
241
|
className: cls,
|
239
242
|
form: form
|
240
|
-
}, formProps), config), otherProps), {}, {
|
243
|
+
}, formProps), omit(config, ['isDiffAll'])), otherProps), {}, {
|
241
244
|
labelAlign: (_ref = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref !== void 0 ? _ref : 'left',
|
242
245
|
onValuesChange: handleValuesChange,
|
243
246
|
onFinish: handleFinish,
|
@@ -14,7 +14,6 @@ var filterObject = function filterObject(data) {
|
|
14
14
|
if (!Object.keys(resData).length) return null;
|
15
15
|
return resData;
|
16
16
|
};
|
17
|
-
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
18
17
|
export var diffOriginal = function diffOriginal(params) {
|
19
18
|
var originalValue = params.originalValue,
|
20
19
|
value = params.value,
|
package/es/ProIcon/index.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import "antd/es/space/style";
|
2
|
+
import _Space from "antd/es/space";
|
1
3
|
import "antd/es/button/style";
|
2
4
|
import _Button from "antd/es/button";
|
3
5
|
import "antd/es/tooltip/style";
|
@@ -5,7 +7,7 @@ import _Tooltip from "antd/es/tooltip";
|
|
5
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
7
9
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
8
|
-
var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip"];
|
10
|
+
var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip", "buttonIcon"];
|
9
11
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
10
12
|
import { useLocalStorageState, useSetState, useDeepCompareLayoutEffect } from 'ahooks';
|
11
13
|
import classNames from 'classnames';
|
@@ -50,6 +52,8 @@ var ProIcon = function ProIcon(props) {
|
|
50
52
|
src = _config.src,
|
51
53
|
actionMap = _config.actionMap,
|
52
54
|
tooltip = _config.tooltip,
|
55
|
+
_config$buttonIcon = _config.buttonIcon,
|
56
|
+
buttonIcon = _config$buttonIcon === void 0 ? true : _config$buttonIcon,
|
53
57
|
reset = _objectWithoutProperties(_config, _excluded);
|
54
58
|
var _useSetState = useSetState({
|
55
59
|
IconInstance: _jsx(_Fragment, {})
|
@@ -130,6 +134,25 @@ var ProIcon = function ProIcon(props) {
|
|
130
134
|
height: size
|
131
135
|
}, rotateStyle), style)
|
132
136
|
};
|
137
|
+
var icon = !src ? _jsx("svg", _objectSpread(_objectSpread({}, svgProps), {}, {
|
138
|
+
onClick: onClick,
|
139
|
+
"aria-hidden": "true",
|
140
|
+
children: _jsx("use", {
|
141
|
+
xlinkHref: "#icon-".concat(_type)
|
142
|
+
})
|
143
|
+
})) : _jsx(ReactSVG, _objectSpread(_objectSpread({}, svgProps), {}, {
|
144
|
+
// @ts-ignore
|
145
|
+
onClick: onClick,
|
146
|
+
"aria-hidden": "true",
|
147
|
+
src: src,
|
148
|
+
beforeInjection: function beforeInjection(svg) {
|
149
|
+
onBeforeInjection({
|
150
|
+
svg: svg,
|
151
|
+
actionMap: actionMap,
|
152
|
+
primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
|
153
|
+
});
|
154
|
+
}
|
155
|
+
}));
|
133
156
|
var RenderIcon = _jsx("span", _objectSpread(_objectSpread({
|
134
157
|
className: "anticon",
|
135
158
|
style: {
|
@@ -138,7 +161,7 @@ var ProIcon = function ProIcon(props) {
|
|
138
161
|
}, reset), {}, {
|
139
162
|
children: _jsx(_Tooltip, {
|
140
163
|
title: iconText,
|
141
|
-
children: _jsx(_Button, _objectSpread({
|
164
|
+
children: buttonIcon ? _jsx(_Button, _objectSpread({
|
142
165
|
style: {
|
143
166
|
width: size,
|
144
167
|
height: size,
|
@@ -148,26 +171,20 @@ var ProIcon = function ProIcon(props) {
|
|
148
171
|
verticalAlign: 'baseline'
|
149
172
|
},
|
150
173
|
type: "text",
|
151
|
-
icon:
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
actionMap: actionMap,
|
166
|
-
primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
|
167
|
-
});
|
168
|
-
}
|
169
|
-
}))
|
170
|
-
}, buttonProps))
|
174
|
+
icon: icon
|
175
|
+
}, buttonProps)) : _jsx(_Space, {
|
176
|
+
children: _jsx("span", {
|
177
|
+
style: {
|
178
|
+
width: size,
|
179
|
+
height: size,
|
180
|
+
border: 'none',
|
181
|
+
borderRadius: 0,
|
182
|
+
padding: 0,
|
183
|
+
verticalAlign: 'baseline'
|
184
|
+
},
|
185
|
+
children: icon
|
186
|
+
})
|
187
|
+
})
|
171
188
|
})
|
172
189
|
}));
|
173
190
|
useEffect(function () {
|