@zat-design/sisyphus-react 3.3.0 → 3.3.1-beta.10
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 +36 -11
- package/es/ProEditTable/components/RenderField/index.js +13 -10
- package/es/ProEditTable/index.js +47 -18
- package/es/ProEditTable/style/index.less +5 -0
- package/es/ProEnum/hooks/useEnumRequest.js +13 -1
- package/es/ProEnum/index.js +7 -18
- package/es/ProEnum/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +3 -4
- package/es/ProForm/components/combination/Group/style/index.less +26 -21
- package/es/ProForm/components/combination/Group/utils.d.ts +0 -2
- package/es/ProForm/components/combination/Group/utils.js +0 -13
- package/es/ProForm/components/combination/ProModalSelect/index.js +24 -27
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +9 -2
- package/es/ProForm/components/render/Render.js +19 -25
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/style/index.less +5 -4
- package/es/ProForm/utils/contrastOriginal.d.ts +0 -1
- package/es/ProForm/utils/contrastOriginal.js +0 -1
- package/es/ProForm/utils/rulesCreator.js +2 -1
- package/es/ProForm/utils/useChanged.d.ts +7 -14
- package/es/ProForm/utils/useChanged.js +13 -20
- package/es/ProForm/utils/useForm.js +15 -7
- package/es/ProForm/utils/useListChanged.d.ts +16 -0
- package/es/ProForm/utils/useListChanged.js +81 -0
- package/es/ProForm/utils/useRules.js +6 -5
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
- package/es/ProLayout/components/Layout/Menu/index.js +13 -10
- package/es/ProLayout/propTypes.d.ts +2 -0
- package/es/ProStep/index.js +2 -2
- package/es/ProTable/style/index.less +7 -6
- package/es/ProTooltip/index.js +14 -1
- package/es/ProTreeModal/components/Trigger.d.ts +1 -0
- package/es/ProTreeModal/components/Trigger.js +19 -8
- package/es/ProTreeModal/index.js +15 -5
- package/es/ProTreeModal/style/index.less +85 -84
- package/es/ProUpload/components/ImageRender.js +19 -10
- package/es/locale/en_US.d.ts +2 -0
- package/es/locale/en_US.js +3 -1
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +4 -1
- package/lib/ProEditTable/components/RenderField/index.js +13 -10
- package/lib/ProEditTable/index.js +46 -17
- package/lib/ProEditTable/style/index.less +5 -0
- package/lib/ProEnum/hooks/useEnumRequest.js +13 -1
- package/lib/ProEnum/index.js +6 -17
- package/lib/ProEnum/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +2 -3
- package/lib/ProForm/components/combination/Group/style/index.less +26 -21
- package/lib/ProForm/components/combination/Group/utils.d.ts +0 -2
- package/lib/ProForm/components/combination/Group/utils.js +1 -14
- package/lib/ProForm/components/combination/ProModalSelect/index.js +23 -26
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +9 -2
- package/lib/ProForm/components/render/Render.js +19 -25
- package/lib/ProForm/components/render/RenderFields.js +6 -2
- package/lib/ProForm/style/index.less +5 -4
- package/lib/ProForm/utils/contrastOriginal.d.ts +0 -1
- package/lib/ProForm/utils/contrastOriginal.js +0 -1
- package/lib/ProForm/utils/rulesCreator.js +2 -1
- package/lib/ProForm/utils/useChanged.d.ts +7 -14
- package/lib/ProForm/utils/useChanged.js +13 -20
- package/lib/ProForm/utils/useForm.js +15 -7
- package/lib/ProForm/utils/useListChanged.d.ts +16 -0
- package/lib/ProForm/utils/useListChanged.js +86 -0
- package/lib/ProForm/utils/useRules.js +5 -4
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
- package/lib/ProLayout/components/Layout/Menu/index.js +13 -10
- package/lib/ProLayout/propTypes.d.ts +2 -0
- package/lib/ProStep/index.js +1 -1
- package/lib/ProTable/style/index.less +7 -6
- package/lib/ProTooltip/index.js +14 -1
- package/lib/ProTreeModal/components/Trigger.d.ts +1 -0
- package/lib/ProTreeModal/components/Trigger.js +18 -7
- package/lib/ProTreeModal/index.js +15 -5
- package/lib/ProTreeModal/style/index.less +85 -84
- package/lib/ProUpload/components/ImageRender.js +18 -9
- package/lib/locale/en_US.d.ts +2 -0
- package/lib/locale/en_US.js +3 -1
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.js +4 -1
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -1629,6 +1629,13 @@
|
|
|
1629
1629
|
.pro-table .ant-table-tbody .ant-table-cell-fix-right {
|
|
1630
1630
|
background: unset !important;
|
|
1631
1631
|
}
|
|
1632
|
+
.pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell {
|
|
1633
|
+
background: #d2fff4 !important;
|
|
1634
|
+
}
|
|
1635
|
+
.pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell td {
|
|
1636
|
+
background: #d2fff4 !important;
|
|
1637
|
+
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
|
1638
|
+
}
|
|
1632
1639
|
.pro-table .ant-table-body .ant-table-cell .varied-cell {
|
|
1633
1640
|
margin-left: -8px;
|
|
1634
1641
|
background: var(--zaui-contract-bg, #fffaa1);
|
|
@@ -1996,11 +2003,11 @@ div.pro-textarea-view::after {
|
|
|
1996
2003
|
.pro-form-list-action .ant-btn-text:hover {
|
|
1997
2004
|
background: transparent;
|
|
1998
2005
|
}
|
|
1999
|
-
.ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input {
|
|
2006
|
+
.ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input {
|
|
2000
2007
|
background: var(--zaui-base-bg, #ffffff);
|
|
2001
2008
|
border-color: var(--ant-error-color);
|
|
2002
2009
|
}
|
|
2003
|
-
.ant-form-item-has-error .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input:focus {
|
|
2010
|
+
.ant-form-item-has-error .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input:focus {
|
|
2004
2011
|
border-color: var(--ant-error-color-hover);
|
|
2005
2012
|
border-right-width: 1px;
|
|
2006
2013
|
outline: 0;
|
|
@@ -2021,6 +2028,10 @@ span.ant-input-group-compact.pro-range-limit .ant-picker {
|
|
|
2021
2028
|
-ms-flex: 1;
|
|
2022
2029
|
flex: 1;
|
|
2023
2030
|
}
|
|
2031
|
+
span.ant-input-group-compact.pro-time-limit .ant-picker-focused,
|
|
2032
|
+
span.ant-input-group-compact.pro-range-limit .ant-picker-focused {
|
|
2033
|
+
z-index: 1;
|
|
2034
|
+
}
|
|
2024
2035
|
span.ant-input-group-compact.pro-time-limit .forever-checkbox,
|
|
2025
2036
|
span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
2026
2037
|
-webkit-box-flex: 0;
|
|
@@ -2238,14 +2249,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2238
2249
|
display: none;
|
|
2239
2250
|
}
|
|
2240
2251
|
.pro-group .ant-space-compact {
|
|
2241
|
-
-webkit-box-align: center;
|
|
2242
|
-
-webkit-align-items: center;
|
|
2243
|
-
-ms-flex-align: center;
|
|
2244
|
-
align-items: center;
|
|
2245
2252
|
-webkit-box-flex: 1;
|
|
2246
2253
|
-webkit-flex: auto;
|
|
2247
2254
|
-ms-flex: auto;
|
|
2248
2255
|
flex: auto;
|
|
2256
|
+
-webkit-box-align: center;
|
|
2257
|
+
-webkit-align-items: center;
|
|
2258
|
+
-ms-flex-align: center;
|
|
2259
|
+
align-items: center;
|
|
2249
2260
|
width: 100%;
|
|
2250
2261
|
}
|
|
2251
2262
|
.pro-group .ant-space-compact .ant-form-item {
|
|
@@ -2259,6 +2270,13 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2259
2270
|
border-start-start-radius: 0;
|
|
2260
2271
|
border-end-start-radius: 0;
|
|
2261
2272
|
}
|
|
2273
|
+
.pro-group .ant-space-compact .pro-modal-select {
|
|
2274
|
+
margin-left: -1px;
|
|
2275
|
+
}
|
|
2276
|
+
.pro-group .ant-space-compact .pro-modal-select .ant-input {
|
|
2277
|
+
border-start-start-radius: 0;
|
|
2278
|
+
border-end-start-radius: 0;
|
|
2279
|
+
}
|
|
2262
2280
|
.pro-group .ant-space-compact .ant-input-affix-wrapper,
|
|
2263
2281
|
.pro-group .ant-space-compact .ant-select {
|
|
2264
2282
|
border-start-end-radius: 0;
|
|
@@ -2266,8 +2284,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2266
2284
|
border-start-start-radius: 0;
|
|
2267
2285
|
border-end-start-radius: 0;
|
|
2268
2286
|
}
|
|
2269
|
-
.pro-group .ant-space-compact .ant-input-affix-wrapper:nth-child(n+2),
|
|
2270
|
-
.pro-group .ant-space-compact .ant-select:nth-child(n+2) {
|
|
2287
|
+
.pro-group .ant-space-compact .ant-input-affix-wrapper:nth-child(n + 2),
|
|
2288
|
+
.pro-group .ant-space-compact .ant-select:nth-child(n + 2) {
|
|
2271
2289
|
-webkit-margin-start: -1px;
|
|
2272
2290
|
margin-inline-start: -1px;
|
|
2273
2291
|
}
|
|
@@ -2296,8 +2314,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2296
2314
|
border-end-end-radius: var(--zaui-border-radius, 4px);
|
|
2297
2315
|
}
|
|
2298
2316
|
.pro-group .ant-space-compact .ant-input-affix-wrapper-status-error ~ .group-separator {
|
|
2299
|
-
border-color: var(--ant-error-color);
|
|
2300
2317
|
color: var(--ant-error-color);
|
|
2318
|
+
border-color: var(--ant-error-color);
|
|
2301
2319
|
}
|
|
2302
2320
|
.pro-container.pro-container-diy .pro-container-content {
|
|
2303
2321
|
display: -webkit-box;
|
|
@@ -2551,9 +2569,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2551
2569
|
.pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder {
|
|
2552
2570
|
z-index: 9;
|
|
2553
2571
|
}
|
|
2554
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content >
|
|
2555
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2572
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-form-view-container {
|
|
2556
2573
|
padding: 4px 8px;
|
|
2574
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
2557
2575
|
border-radius: 4px;
|
|
2558
2576
|
}
|
|
2559
2577
|
.pro-form .ant-form-item .ant-row {
|
|
@@ -3324,6 +3342,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3324
3342
|
}
|
|
3325
3343
|
.pro-tree-modal-checkbox-close {
|
|
3326
3344
|
padding-left: var(--zaui-space-size-sm, 8px);
|
|
3345
|
+
color: #c5c7cd;
|
|
3327
3346
|
font-size: var(--zaui-font-size-sm, 12px);
|
|
3328
3347
|
}
|
|
3329
3348
|
.pro-tree-modal-tree-node {
|
|
@@ -4172,6 +4191,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
4172
4191
|
.pro-edit-table .ant-table-pagination .ant-pagination-options .ant-select.ant-select-in-form-item {
|
|
4173
4192
|
width: auto;
|
|
4174
4193
|
}
|
|
4194
|
+
.pro-edit-table .is-new-row td,
|
|
4195
|
+
.pro-edit-table .is-new-row.ant-table-row:hover td,
|
|
4196
|
+
.pro-edit-table .is-new-row .ant-table-cell-row-hover,
|
|
4197
|
+
.pro-edit-table .is-new-row.ant-table-row:hover .ant-table-cell-row-hover {
|
|
4198
|
+
background: var(--ant-primary-2) !important;
|
|
4199
|
+
}
|
|
4175
4200
|
.pro-edit-table-header {
|
|
4176
4201
|
margin-bottom: calc(var(--zaui-space-size-md, 16px) * var(--zaui-size, 1));
|
|
4177
4202
|
}
|
|
@@ -25,7 +25,7 @@ import * as componentMap from '../../../ProForm/components';
|
|
|
25
25
|
import Container from '../../../ProForm/components/Container';
|
|
26
26
|
import transformNames from '../../../ProForm/utils/transformNames';
|
|
27
27
|
import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
|
|
28
|
-
import {
|
|
28
|
+
import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
29
29
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
30
|
import { isSelect } from '../../../ProForm/utils';
|
|
31
31
|
import locale from '../../../locale';
|
|
@@ -129,7 +129,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
129
129
|
names: names,
|
|
130
130
|
label: label,
|
|
131
131
|
labelRequired: labelRequired,
|
|
132
|
-
required: _required,
|
|
132
|
+
required: !isView && _required,
|
|
133
133
|
rules: isEditing ? _rules : [],
|
|
134
134
|
isSelect: isSelect({
|
|
135
135
|
dataSource: (_fieldProps4 = _fieldProps) === null || _fieldProps4 === void 0 ? void 0 : _fieldProps4.dataSource,
|
|
@@ -452,19 +452,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
452
452
|
};
|
|
453
453
|
}();
|
|
454
454
|
// 判断当前字段是否变更
|
|
455
|
-
var
|
|
455
|
+
var _useListChanged = useListChanged({
|
|
456
456
|
name: cellName,
|
|
457
457
|
names: names,
|
|
458
458
|
namesStr: [].concat(_toConsumableArray(baseName), [index, dataIndex]),
|
|
459
|
+
rowKeyPath: [].concat(_toConsumableArray(baseName), [index, 'rowKey']),
|
|
459
460
|
originalName: originalName,
|
|
460
461
|
originalNames: originalNames,
|
|
461
462
|
originalValues: originalValues,
|
|
462
463
|
form: form,
|
|
463
464
|
equalWith: equalWith
|
|
464
465
|
}),
|
|
465
|
-
|
|
466
|
-
changed =
|
|
467
|
-
originalValue =
|
|
466
|
+
_useListChanged2 = _slicedToArray(_useListChanged, 2),
|
|
467
|
+
changed = _useListChanged2[0],
|
|
468
|
+
originalValue = _useListChanged2[1];
|
|
468
469
|
var componentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
469
470
|
form: form,
|
|
470
471
|
name: cellName,
|
|
@@ -506,7 +507,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
506
507
|
delete _formItemProps.rules;
|
|
507
508
|
}
|
|
508
509
|
var _className = classNames((_classNames = {}, _defineProperty(_classNames, className, className), _defineProperty(_classNames, 'pro-form-item-changed', changed), _classNames));
|
|
509
|
-
var originalTitle = _jsxs(_Space, {
|
|
510
|
+
var originalTitle = originalTip ? _jsxs(_Space, {
|
|
510
511
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, omit(componentProps, ['onFieldChange'])), {}, {
|
|
511
512
|
isView: true,
|
|
512
513
|
value: originalValue,
|
|
@@ -516,14 +517,16 @@ var RenderField = function RenderField(_ref) {
|
|
|
516
517
|
value: originalValue,
|
|
517
518
|
checked: type === 'Switch' ? originalValue : undefined
|
|
518
519
|
}))]
|
|
519
|
-
});
|
|
520
|
-
var FormItem = _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
520
|
+
}) : null;
|
|
521
|
+
var FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
521
522
|
validateFirst: true
|
|
522
523
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
523
524
|
className: _className,
|
|
524
525
|
name: cellName,
|
|
525
526
|
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread({}, omit(componentProps, ['onFieldChange']))) : _jsx(TargetComponent, _objectSpread({}, omit(componentProps, ['onFieldChange'])))
|
|
526
|
-
}))
|
|
527
|
+
})) : _jsx(Container, {
|
|
528
|
+
viewEmpty: viewEmpty
|
|
529
|
+
});
|
|
527
530
|
return _jsx(FieldProvider, {
|
|
528
531
|
value: componentProps === null || componentProps === void 0 ? void 0 : componentProps.otherProps,
|
|
529
532
|
children: !originalTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -10,10 +10,10 @@ import _ConfigProvider from "antd/es/config-provider";
|
|
|
10
10
|
import "antd/es/form/style";
|
|
11
11
|
import _Form from "antd/es/form";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
|
-
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalTip"];
|
|
13
|
+
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalTip", "rowKey"];
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
16
|
-
import { isArray } from 'lodash';
|
|
16
|
+
import { get, isArray } from 'lodash';
|
|
17
17
|
import { useDebounceEffect, useSetState } from 'ahooks';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import { transformColumns } from './utils';
|
|
@@ -50,6 +50,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
50
50
|
pagination = _ref.pagination,
|
|
51
51
|
originalValues = _ref.originalValues,
|
|
52
52
|
originalTip = _ref.originalTip,
|
|
53
|
+
rowKey = _ref.rowKey,
|
|
53
54
|
resetProps = _objectWithoutProperties(_ref, _excluded);
|
|
54
55
|
// 上下文form
|
|
55
56
|
var contentForm = _Form.useFormInstance();
|
|
@@ -97,21 +98,23 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
97
98
|
'pro-table-no-stripe': !stripe,
|
|
98
99
|
className: className
|
|
99
100
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
var getRowKey = function getRowKey(record) {
|
|
102
|
+
var key = record.rowKey || getRandom();
|
|
103
|
+
if (rowKey) {
|
|
104
|
+
var _ref2;
|
|
105
|
+
key = (_ref2 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref2 !== void 0 ? _ref2 : key;
|
|
106
|
+
}
|
|
107
|
+
return key;
|
|
103
108
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
109
|
-
setState({
|
|
110
|
-
selectedRowKeys: selectedRowKeys,
|
|
111
|
-
selectedRows: selectedRows
|
|
112
|
-
});
|
|
109
|
+
var IsNew = function IsNew(preArr, record) {
|
|
110
|
+
var _preArr$find;
|
|
111
|
+
if (!(preArr === null || preArr === void 0 ? void 0 : preArr.length)) {
|
|
112
|
+
return false;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
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) {
|
|
115
|
+
return getRowKey(item) === getRowKey(record);
|
|
116
|
+
}));
|
|
117
|
+
};
|
|
115
118
|
var config = {
|
|
116
119
|
form: form,
|
|
117
120
|
mode: mode,
|
|
@@ -144,6 +147,27 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
144
147
|
originalTip: originalTip,
|
|
145
148
|
prefixCls: prefixCls
|
|
146
149
|
};
|
|
150
|
+
// 编辑行设置下样式
|
|
151
|
+
var _rowClassName = function _rowClassName(record) {
|
|
152
|
+
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|
|
153
|
+
var className = isEdit ? 'is-editing' : '';
|
|
154
|
+
var originalArr = get(originalValues, name);
|
|
155
|
+
if (!isEdit && IsNew(originalArr, record)) {
|
|
156
|
+
return "is-new-row ".concat(className);
|
|
157
|
+
}
|
|
158
|
+
return className;
|
|
159
|
+
};
|
|
160
|
+
// 复选框
|
|
161
|
+
var _rowSelection = _objectSpread({
|
|
162
|
+
fixed: true,
|
|
163
|
+
selectedRowKeys: selectedRowKeys,
|
|
164
|
+
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
165
|
+
setState({
|
|
166
|
+
selectedRowKeys: selectedRowKeys,
|
|
167
|
+
selectedRows: selectedRows
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}, rowSelection);
|
|
147
171
|
// 判断是否禁止添加、批量删除
|
|
148
172
|
var isForbiddenBtn = useCallback(function (type) {
|
|
149
173
|
// 当工具栏不渲染时,都不渲染
|
|
@@ -202,7 +226,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
202
226
|
return isForbiddenBtn('mulDelete') ? rowSelection : _rowSelection;
|
|
203
227
|
};
|
|
204
228
|
var setColumns = /*#__PURE__*/function () {
|
|
205
|
-
var
|
|
229
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
206
230
|
var nextColumns;
|
|
207
231
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
208
232
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -221,7 +245,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
221
245
|
}, _callee);
|
|
222
246
|
}));
|
|
223
247
|
return function setColumns() {
|
|
224
|
-
return
|
|
248
|
+
return _ref3.apply(this, arguments);
|
|
225
249
|
};
|
|
226
250
|
}();
|
|
227
251
|
useDebounceEffect(function () {
|
|
@@ -235,11 +259,16 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
235
259
|
var _value$;
|
|
236
260
|
// 初始化默认生成row-key
|
|
237
261
|
if ((value === null || value === void 0 ? void 0 : value.length) && !(value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey)) {
|
|
262
|
+
var _originalArr$forEach;
|
|
238
263
|
var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
|
|
239
264
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
240
|
-
rowKey:
|
|
265
|
+
rowKey: getRowKey(item)
|
|
241
266
|
});
|
|
242
267
|
});
|
|
268
|
+
var originalArr = get(originalValues, name);
|
|
269
|
+
originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$forEach = originalArr.forEach) === null || _originalArr$forEach === void 0 ? void 0 : _originalArr$forEach.call(originalArr, function (item) {
|
|
270
|
+
item.rowKey = getRowKey(item);
|
|
271
|
+
});
|
|
243
272
|
onChange(nextValues);
|
|
244
273
|
if (virtualKey) {
|
|
245
274
|
form.setFieldValue(virtualRowName, nextValues);
|
|
@@ -72,6 +72,18 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
72
72
|
case 9:
|
|
73
73
|
res.data = response;
|
|
74
74
|
case 10:
|
|
75
|
+
if (!(_typeof(response) !== 'object' || response === null)) {
|
|
76
|
+
_context.next = 12;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
throw Error('response enum data must be object');
|
|
80
|
+
case 12:
|
|
81
|
+
if (!(Object.keys(response).length === 0)) {
|
|
82
|
+
_context.next = 14;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
throw Error('Please return valid enumeration data');
|
|
86
|
+
case 14:
|
|
75
87
|
// 只返回fieldNames对象的key
|
|
76
88
|
if (clear) {
|
|
77
89
|
// 忽略清洗的 codes
|
|
@@ -106,7 +118,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
106
118
|
}, 10000);
|
|
107
119
|
}
|
|
108
120
|
return _context.abrupt("return", res);
|
|
109
|
-
case
|
|
121
|
+
case 21:
|
|
110
122
|
case "end":
|
|
111
123
|
return _context.stop();
|
|
112
124
|
}
|
package/es/ProEnum/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component
|
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
17
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
|
18
18
|
import React, { useState, useEffect, useMemo } from 'react';
|
|
19
|
-
import { cloneDeep, isFunction, isString, isArray } from 'lodash';
|
|
19
|
+
import { cloneDeep, isFunction, isString, isArray, omit } from 'lodash';
|
|
20
20
|
import ProSelect from '../ProSelect';
|
|
21
21
|
import { useProConfig } from '../ProConfigProvider';
|
|
22
22
|
import ProEnumTag from './components/Tag';
|
|
@@ -79,7 +79,6 @@ var ProEnum = function ProEnum(props) {
|
|
|
79
79
|
var _useProConfig = useProConfig('ProEnum'),
|
|
80
80
|
_useProConfig$dics = _useProConfig.dics,
|
|
81
81
|
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
82
|
-
// const enumList = dics?.[code] || [];
|
|
83
82
|
var _useRequestFunc = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
|
|
84
83
|
manual: true,
|
|
85
84
|
cacheTime: -1
|
|
@@ -173,26 +172,16 @@ var ProEnum = function ProEnum(props) {
|
|
|
173
172
|
onChange: onChange
|
|
174
173
|
}));
|
|
175
174
|
case 'Radio':
|
|
176
|
-
return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
175
|
+
return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
|
|
176
|
+
options: list,
|
|
177
177
|
value: value,
|
|
178
|
-
onChange: onChange
|
|
179
|
-
children: list.map(function (item) {
|
|
180
|
-
return _jsx(_Radio, {
|
|
181
|
-
value: item[fieldValue],
|
|
182
|
-
children: item[label]
|
|
183
|
-
}, item[fieldValue]);
|
|
184
|
-
})
|
|
178
|
+
onChange: onChange
|
|
185
179
|
}));
|
|
186
180
|
case 'Checkbox':
|
|
187
|
-
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
181
|
+
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
|
|
182
|
+
options: list,
|
|
188
183
|
value: value,
|
|
189
|
-
onChange: onChange
|
|
190
|
-
children: list.map(function (item) {
|
|
191
|
-
return _jsx(_Checkbox, {
|
|
192
|
-
value: item[fieldValue],
|
|
193
|
-
children: item[label]
|
|
194
|
-
}, item[fieldValue]);
|
|
195
|
-
})
|
|
184
|
+
onChange: onChange
|
|
196
185
|
}));
|
|
197
186
|
case 'Tag':
|
|
198
187
|
return _jsx(ProEnumTag, {
|
|
@@ -145,13 +145,13 @@ var ActionButton = function ActionButton(props) {
|
|
|
145
145
|
align: "start",
|
|
146
146
|
className: "pro-form-list-action",
|
|
147
147
|
children: actionProps === null || actionProps === void 0 ? void 0 : actionProps.map(function (item) {
|
|
148
|
-
if (item.show === false) return _jsx(
|
|
148
|
+
if (item.show === false) return _jsx("span", {}, "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
149
149
|
if (isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
|
|
150
150
|
namePath: namePath,
|
|
151
151
|
index: index,
|
|
152
152
|
form: form
|
|
153
153
|
})) {
|
|
154
|
-
return _jsx(
|
|
154
|
+
return _jsx("span", {}, "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
155
155
|
}
|
|
156
156
|
var label = item.label,
|
|
157
157
|
onClick = item.onClick,
|
|
@@ -62,7 +62,7 @@ var FormList = function FormList(props, ref) {
|
|
|
62
62
|
var handleDragEnd = function handleDragEnd(drag) {
|
|
63
63
|
var active = drag.active,
|
|
64
64
|
over = drag.over;
|
|
65
|
-
if (active.id !== over.id) {
|
|
65
|
+
if (_fields.length > 1 && active.id !== over.id) {
|
|
66
66
|
var activeIndex = _fields.findIndex(function (item) {
|
|
67
67
|
return item.key === active.id;
|
|
68
68
|
});
|
|
@@ -9,7 +9,7 @@ import { useMemo } from 'react';
|
|
|
9
9
|
import { omit } from 'lodash';
|
|
10
10
|
import classnames from 'classnames';
|
|
11
11
|
import RenderFields from '../../render/RenderFields';
|
|
12
|
-
import { insertSeparator
|
|
12
|
+
import { insertSeparator } from './utils';
|
|
13
13
|
import ProForm from '../../../../ProForm';
|
|
14
14
|
var Group = function Group(props) {
|
|
15
15
|
var columns = props.children,
|
|
@@ -27,7 +27,6 @@ var Group = function Group(props) {
|
|
|
27
27
|
if (!Array.isArray(names)) {
|
|
28
28
|
console.error('Warning: Composite form components whose type is Group must be configured with names');
|
|
29
29
|
}
|
|
30
|
-
var _parentNames = parseName(id);
|
|
31
30
|
var data = useMemo(function () {
|
|
32
31
|
var fieldList = [];
|
|
33
32
|
var result = columns.map(function (item) {
|
|
@@ -35,7 +34,7 @@ var Group = function Group(props) {
|
|
|
35
34
|
disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
|
|
36
35
|
}, item), {}, {
|
|
37
36
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
38
|
-
parentNames:
|
|
37
|
+
parentNames: id
|
|
39
38
|
});
|
|
40
39
|
});
|
|
41
40
|
var node = _jsx(_Button, {
|
|
@@ -46,7 +45,7 @@ var Group = function Group(props) {
|
|
|
46
45
|
columns: insertSeparator(result, space, node, otherProps),
|
|
47
46
|
fieldList: fieldList
|
|
48
47
|
};
|
|
49
|
-
}, [name, columns, space, props]);
|
|
48
|
+
}, [name, columns, space, props, names]);
|
|
50
49
|
var _className = classnames(_defineProperty({
|
|
51
50
|
'pro-group': true,
|
|
52
51
|
'pro-group-diy-width': columns.some(function (item) {
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
4
|
.border-radius(@start-end: 0, @end-end: 0, @start-start: 0, @end-start: 0) {
|
|
5
|
-
border-start-end-radius
|
|
6
|
-
border-end-end-radius
|
|
5
|
+
border-start-end-radius: @start-end;
|
|
6
|
+
border-end-end-radius: @end-end;
|
|
7
7
|
border-start-start-radius: @start-start;
|
|
8
|
-
border-end-start-radius
|
|
8
|
+
border-end-start-radius: @end-start;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.start-radius() {
|
|
12
12
|
border-start-start-radius: var(--zaui-border-radius, 4px);
|
|
13
|
-
border-end-start-radius
|
|
13
|
+
border-end-start-radius: var(--zaui-border-radius, 4px);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.end-radius() {
|
|
17
17
|
border-start-end-radius: var(--zaui-border-radius, 4px);
|
|
18
|
-
border-end-end-radius
|
|
18
|
+
border-end-end-radius: var(--zaui-border-radius, 4px);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.pro-group {
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.@{ant-prefix}-form-item {
|
|
42
|
-
|
|
43
42
|
margin-bottom: 0 !important;
|
|
44
43
|
}
|
|
45
44
|
}
|
|
@@ -49,19 +48,26 @@
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
.@{ant-prefix}-space-compact {
|
|
51
|
+
flex: auto;
|
|
52
52
|
align-items: center;
|
|
53
|
-
|
|
54
|
-
width : 100%;
|
|
53
|
+
width: 100%;
|
|
55
54
|
|
|
56
55
|
.@{ant-prefix}-form-item {
|
|
57
56
|
margin-bottom: 0 !important;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
.group-separator {
|
|
61
|
-
margin-inline-end
|
|
62
|
-
margin-inline-start
|
|
60
|
+
margin-inline-end: -2px;
|
|
61
|
+
margin-inline-start: -1px;
|
|
63
62
|
border-start-start-radius: 0;
|
|
64
|
-
border-end-start-radius
|
|
63
|
+
border-end-start-radius: 0;
|
|
64
|
+
}
|
|
65
|
+
.pro-modal-select {
|
|
66
|
+
margin-left: -1px;
|
|
67
|
+
.@{ant-prefix}-input{
|
|
68
|
+
border-start-start-radius: 0;
|
|
69
|
+
border-end-start-radius: 0;
|
|
70
|
+
}
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
// 定制内敛合并样式
|
|
@@ -69,16 +75,16 @@
|
|
|
69
75
|
.@{ant-prefix}-select {
|
|
70
76
|
.border-radius(0, 0, 0, 0);
|
|
71
77
|
|
|
72
|
-
&:nth-child(n+2) {
|
|
73
|
-
margin-inline-start: -1px
|
|
78
|
+
&:nth-child(n + 2) {
|
|
79
|
+
margin-inline-start: -1px;
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
&:first-child {
|
|
77
|
-
.start-radius()
|
|
83
|
+
.start-radius();
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
&:last-child {
|
|
81
|
-
.end-radius()
|
|
87
|
+
.end-radius();
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -89,22 +95,21 @@
|
|
|
89
95
|
|
|
90
96
|
&:first-child {
|
|
91
97
|
.@{ant-prefix}-select-selector {
|
|
92
|
-
.start-radius()
|
|
98
|
+
.start-radius();
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
&:last-child {
|
|
97
103
|
.@{ant-prefix}-select-selector {
|
|
98
|
-
.end-radius()
|
|
104
|
+
.end-radius();
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
|
-
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
// 报错样式定制
|
|
105
|
-
.@{ant-prefix}-input-affix-wrapper-status-error
|
|
110
|
+
.@{ant-prefix}-input-affix-wrapper-status-error ~ .group-separator {
|
|
111
|
+
color: var(--ant-error-color);
|
|
106
112
|
border-color: var(--ant-error-color);
|
|
107
|
-
color : var(--ant-error-color);
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
|
-
}
|
|
115
|
+
}
|
|
@@ -33,17 +33,4 @@ export var insertSeparator = function insertSeparator(columns, space, separatorN
|
|
|
33
33
|
}
|
|
34
34
|
return result;
|
|
35
35
|
}, []);
|
|
36
|
-
};
|
|
37
|
-
/** 解析name */
|
|
38
|
-
export var parseName = function parseName(name) {
|
|
39
|
-
var result = [];
|
|
40
|
-
var parts = name.split('_');
|
|
41
|
-
parts.forEach(function (part) {
|
|
42
|
-
if (!Number.isNaN(Number(part))) {
|
|
43
|
-
result.push(Number(part));
|
|
44
|
-
} else {
|
|
45
|
-
result.push(part);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return result;
|
|
49
36
|
};
|