@zat-design/sisyphus-react 3.4.6-beta.1 → 3.4.6-beta.11
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 +12 -1
- package/dist/less.esm.css +12 -1
- package/es/ProEditTable/components/RenderField/index.js +1 -0
- package/es/ProEditTable/style/index.less +5 -2
- package/es/ProForm/components/base/TextArea/index.d.ts +1 -0
- package/es/ProForm/components/base/TextArea/index.js +4 -2
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +1 -1
- package/es/ProForm/components/combination/FormList/index.js +1 -0
- package/es/ProForm/components/combination/FormList/propsType.d.ts +1 -1
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.js +2 -2
- package/es/ProForm/components/combination/ProModalSelect/index.js +35 -29
- package/es/ProForm/components/render/Render.js +7 -7
- package/es/ProForm/components/render/RenderFields.js +1 -0
- package/es/ProForm/components/render/propsType.d.ts +2 -1
- package/es/ProForm/propsType.d.ts +1 -0
- package/es/ProForm/utils/index.d.ts +6 -1
- package/es/ProForm/utils/index.js +5 -5
- package/es/ProForm/utils/useForm.js +2 -1
- package/es/ProSelect/index.js +14 -2
- package/es/ProSelect/propsType.d.ts +2 -0
- package/es/ProSelect/utils/index.d.ts +9 -0
- package/es/ProSelect/utils/index.js +60 -0
- package/es/ProTree/components/ProTreeSelect/index.js +3 -3
- package/es/ProTree/components/ProTreeSelect/style/index.less +6 -8
- package/es/ProTree/style/index.less +15 -0
- package/es/ProUpload/propsType.d.ts +1 -1
- package/es/global.less +34 -25
- package/es/locale/zh_CN.js +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +1 -0
- package/lib/ProEditTable/style/index.less +5 -2
- package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
- package/lib/ProForm/components/base/TextArea/index.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +1 -1
- package/lib/ProForm/components/combination/FormList/index.js +1 -0
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +1 -1
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.js +2 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +35 -29
- package/lib/ProForm/components/render/Render.js +7 -7
- package/lib/ProForm/components/render/RenderFields.js +1 -0
- package/lib/ProForm/components/render/propsType.d.ts +2 -1
- package/lib/ProForm/propsType.d.ts +1 -0
- package/lib/ProForm/utils/index.d.ts +6 -1
- package/lib/ProForm/utils/index.js +5 -5
- package/lib/ProForm/utils/useForm.js +2 -1
- package/lib/ProSelect/index.js +14 -2
- package/lib/ProSelect/propsType.d.ts +2 -0
- package/lib/ProSelect/utils/index.d.ts +9 -0
- package/lib/ProSelect/utils/index.js +68 -0
- package/lib/ProTree/components/ProTreeSelect/index.js +3 -3
- package/lib/ProTree/components/ProTreeSelect/style/index.less +6 -8
- package/lib/ProTree/style/index.less +15 -0
- package/lib/ProUpload/propsType.d.ts +1 -1
- package/lib/global.less +34 -25
- package/lib/locale/zh_CN.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -3983,6 +3983,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3983
3983
|
.pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
|
|
3984
3984
|
height: 16px !important;
|
|
3985
3985
|
}
|
|
3986
|
+
.pro-tree-select .ant-select-selector .check-mark-icon,
|
|
3987
|
+
.pro-tree-select-drop-down-container .ant-select-selector .check-mark-icon {
|
|
3988
|
+
display: none;
|
|
3989
|
+
}
|
|
3990
|
+
.pro-tree-select.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon,
|
|
3991
|
+
.pro-tree-select-drop-down-container.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon {
|
|
3992
|
+
display: none;
|
|
3993
|
+
}
|
|
3986
3994
|
.pro-drawer .pro-drawer-close {
|
|
3987
3995
|
position: absolute;
|
|
3988
3996
|
top: 6px;
|
|
@@ -4138,6 +4146,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
4138
4146
|
-webkit-box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
|
|
4139
4147
|
box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
|
|
4140
4148
|
}
|
|
4149
|
+
.pro-edit-table td[rowspan] {
|
|
4150
|
+
vertical-align: middle !important;
|
|
4151
|
+
}
|
|
4141
4152
|
.pro-edit-table .pro-edit-table-tooltip {
|
|
4142
4153
|
display: -webkit-inline-box;
|
|
4143
4154
|
display: -webkit-inline-flex;
|
|
@@ -4204,7 +4215,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
4204
4215
|
display: -ms-flexbox;
|
|
4205
4216
|
display: flex;
|
|
4206
4217
|
}
|
|
4207
|
-
.pro-edit-table .drag-wrapper .
|
|
4218
|
+
.pro-edit-table .drag-wrapper .anticon {
|
|
4208
4219
|
margin-right: var(--zaui-space-size-md, 16px);
|
|
4209
4220
|
margin-left: var(--zaui-space-size-xs, 4px);
|
|
4210
4221
|
cursor: pointer;
|
package/dist/less.esm.css
CHANGED
|
@@ -3983,6 +3983,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3983
3983
|
.pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
|
|
3984
3984
|
height: 16px !important;
|
|
3985
3985
|
}
|
|
3986
|
+
.pro-tree-select .ant-select-selector .check-mark-icon,
|
|
3987
|
+
.pro-tree-select-drop-down-container .ant-select-selector .check-mark-icon {
|
|
3988
|
+
display: none;
|
|
3989
|
+
}
|
|
3990
|
+
.pro-tree-select.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon,
|
|
3991
|
+
.pro-tree-select-drop-down-container.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon {
|
|
3992
|
+
display: none;
|
|
3993
|
+
}
|
|
3986
3994
|
.pro-drawer .pro-drawer-close {
|
|
3987
3995
|
position: absolute;
|
|
3988
3996
|
top: 6px;
|
|
@@ -4138,6 +4146,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
4138
4146
|
-webkit-box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
|
|
4139
4147
|
box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
|
|
4140
4148
|
}
|
|
4149
|
+
.pro-edit-table td[rowspan] {
|
|
4150
|
+
vertical-align: middle !important;
|
|
4151
|
+
}
|
|
4141
4152
|
.pro-edit-table .pro-edit-table-tooltip {
|
|
4142
4153
|
display: -webkit-inline-box;
|
|
4143
4154
|
display: -webkit-inline-flex;
|
|
@@ -4204,7 +4215,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
4204
4215
|
display: -ms-flexbox;
|
|
4205
4216
|
display: flex;
|
|
4206
4217
|
}
|
|
4207
|
-
.pro-edit-table .drag-wrapper .
|
|
4218
|
+
.pro-edit-table .drag-wrapper .anticon {
|
|
4208
4219
|
margin-right: var(--zaui-space-size-md, 16px);
|
|
4209
4220
|
margin-left: var(--zaui-space-size-xs, 4px);
|
|
4210
4221
|
cursor: pointer;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
4
|
.pro-edit-table {
|
|
5
|
+
td[rowspan]{
|
|
6
|
+
vertical-align: middle !important;
|
|
7
|
+
}
|
|
5
8
|
.pro-edit-table-tooltip {
|
|
6
9
|
display : inline-flex;
|
|
7
10
|
align-items: center;
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
|
|
63
66
|
.drag-wrapper {
|
|
64
67
|
display: flex;
|
|
65
|
-
.
|
|
68
|
+
.anticon {
|
|
66
69
|
margin-right: var(--zaui-space-size-md, 16px);
|
|
67
70
|
margin-left: var(--zaui-space-size-xs, 4px);
|
|
68
71
|
cursor: pointer;
|
|
@@ -137,7 +140,7 @@
|
|
|
137
140
|
.@{ant-prefix}-table-cell-fix-left,
|
|
138
141
|
.@{ant-prefix}-table-cell-fix-right {
|
|
139
142
|
background-color: var(--zaui-table-header-bg, #f2f3f5);
|
|
140
|
-
|
|
143
|
+
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import "antd/es/input/style";
|
|
5
5
|
import _Input from "antd/es/input";
|
|
6
|
-
var _excluded = ["placeholder", "otherProps", "className"];
|
|
6
|
+
var _excluded = ["placeholder", "otherProps", "className", "tooltip"];
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { omit } from 'lodash';
|
|
9
9
|
import classnames from 'classnames';
|
|
@@ -17,6 +17,8 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
|
17
17
|
var placeholder = props.placeholder,
|
|
18
18
|
otherProps = props.otherProps,
|
|
19
19
|
className = props.className,
|
|
20
|
+
_props$tooltip = props.tooltip,
|
|
21
|
+
tooltip = _props$tooltip === void 0 ? true : _props$tooltip,
|
|
20
22
|
rest = _objectWithoutProperties(props, _excluded);
|
|
21
23
|
var _ref = ProForm.useFieldProps() || {},
|
|
22
24
|
label = _ref.label,
|
|
@@ -27,7 +29,7 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
|
27
29
|
if (isView) {
|
|
28
30
|
return _jsx(Container, {
|
|
29
31
|
nowrap: false,
|
|
30
|
-
tooltip:
|
|
32
|
+
tooltip: tooltip,
|
|
31
33
|
viewEmpty: viewEmpty,
|
|
32
34
|
children: rest.value
|
|
33
35
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ColProps, FormListFieldData } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { InternalNamePath } from 'antd/es/form/interface';
|
|
4
|
-
import type { levelType } from '
|
|
4
|
+
import type { levelType } from '../../../../../ProLayout/components/ProCollapse/PropTypes';
|
|
5
5
|
import type { FormListProps } from '../propsType';
|
|
6
6
|
interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
7
7
|
index: number;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { FormInstance } from 'antd/es/form/Form';
|
|
3
3
|
import type { ButtonProps, FormListFieldData, FormListOperation, PopconfirmProps } from 'antd';
|
|
4
4
|
import type { InternalNamePath } from 'antd/es/form/interface';
|
|
5
|
-
import type { levelType } from '
|
|
5
|
+
import type { levelType } from '../../../../ProLayout/components/ProCollapse/PropTypes';
|
|
6
6
|
import type { ProColumnProps, ProFormOtherProps } from '../../../propsType';
|
|
7
7
|
export type TitleRender = (record: Record<string, any>, index: number, form: FormInstance) => any;
|
|
8
8
|
export type TitleType = string | React.ReactNode | TitleRender;
|
|
@@ -3,8 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps"];
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import ConfirmWrapper from '
|
|
7
|
-
import { FieldProvider } from '
|
|
6
|
+
import ConfirmWrapper from '../../../../components/render/ConfirmWrapper';
|
|
7
|
+
import { FieldProvider } from '../../../../utils/useFieldProps';
|
|
8
8
|
import * as componentMap from '../../../../../index';
|
|
9
9
|
/** 渲染组件 */
|
|
10
10
|
var ComRender = function ComRender(props) {
|
|
@@ -295,58 +295,64 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
295
295
|
};
|
|
296
296
|
var handleFinish = /*#__PURE__*/function () {
|
|
297
297
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
298
|
-
var
|
|
298
|
+
var _nextSelectedRows, _nextSelectedRows2, nextSelectedRows, record, flag, res;
|
|
299
299
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
300
300
|
while (1) switch (_context2.prev = _context2.next) {
|
|
301
301
|
case 0:
|
|
302
302
|
_context2.prev = 0;
|
|
303
|
-
if (
|
|
303
|
+
if (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) {
|
|
304
304
|
_context2.next = 4;
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
307
|
_message.error(locale.ProModalSelect.checkMsg);
|
|
308
308
|
return _context2.abrupt("return", false);
|
|
309
309
|
case 4:
|
|
310
|
-
|
|
310
|
+
nextSelectedRows = selectedRows;
|
|
311
|
+
if (!((_nextSelectedRows = nextSelectedRows) === null || _nextSelectedRows === void 0 ? void 0 : _nextSelectedRows[0])) {
|
|
312
|
+
nextSelectedRows = data.filter(function (item) {
|
|
313
|
+
return selectedRowKeys.includes(item[valueKey]);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
record = isMultiple ? nextSelectedRows : (_nextSelectedRows2 = nextSelectedRows) === null || _nextSelectedRows2 === void 0 ? void 0 : _nextSelectedRows2[0];
|
|
311
317
|
if (!isMultiple) {
|
|
312
318
|
// @ts-ignore
|
|
313
|
-
|
|
319
|
+
record.value = record[valueKey];
|
|
314
320
|
// @ts-ignore
|
|
315
|
-
|
|
321
|
+
record.label = record[labelKey];
|
|
316
322
|
}
|
|
317
323
|
flag = true;
|
|
318
324
|
if (!onOk) {
|
|
319
|
-
_context2.next =
|
|
325
|
+
_context2.next = 14;
|
|
320
326
|
break;
|
|
321
327
|
}
|
|
322
|
-
_context2.next =
|
|
323
|
-
return onOk(
|
|
324
|
-
case
|
|
328
|
+
_context2.next = 12;
|
|
329
|
+
return onOk(record);
|
|
330
|
+
case 12:
|
|
325
331
|
res = _context2.sent;
|
|
326
332
|
if (res !== null && res !== undefined) {
|
|
327
333
|
// @ts-ignore
|
|
328
334
|
flag = res;
|
|
329
335
|
}
|
|
330
|
-
case
|
|
336
|
+
case 14:
|
|
331
337
|
if (flag) {
|
|
332
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ?
|
|
338
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
|
333
339
|
// 更新内部展示值
|
|
334
340
|
setState({
|
|
335
|
-
_value:
|
|
336
|
-
options: isArray(
|
|
341
|
+
_value: record,
|
|
342
|
+
options: isArray(record) ? record : [record]
|
|
337
343
|
});
|
|
338
344
|
handleClose();
|
|
339
345
|
}
|
|
340
346
|
return _context2.abrupt("return", flag);
|
|
341
|
-
case
|
|
342
|
-
_context2.prev =
|
|
347
|
+
case 18:
|
|
348
|
+
_context2.prev = 18;
|
|
343
349
|
_context2.t0 = _context2["catch"](0);
|
|
344
350
|
console.warn('error', _context2.t0);
|
|
345
|
-
case
|
|
351
|
+
case 21:
|
|
346
352
|
case "end":
|
|
347
353
|
return _context2.stop();
|
|
348
354
|
}
|
|
349
|
-
}, _callee2, null, [[0,
|
|
355
|
+
}, _callee2, null, [[0, 18]]);
|
|
350
356
|
}));
|
|
351
357
|
return function handleFinish() {
|
|
352
358
|
return _ref7.apply(this, arguments);
|
|
@@ -427,7 +433,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
427
433
|
// 初始化回显,当传入initParams时,前端用来回险
|
|
428
434
|
var getInitValues = /*#__PURE__*/function () {
|
|
429
435
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
430
|
-
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data2,
|
|
436
|
+
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data2, _data, nextSelectRowKeys;
|
|
431
437
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
432
438
|
while (1) switch (_context4.prev = _context4.next) {
|
|
433
439
|
case 0:
|
|
@@ -458,15 +464,15 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
458
464
|
} else {
|
|
459
465
|
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
|
460
466
|
}
|
|
461
|
-
|
|
462
|
-
if (
|
|
467
|
+
_data = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
|
|
468
|
+
if (_data) {
|
|
463
469
|
nextSelectRowKeys = isMultiple ? value : [value];
|
|
464
470
|
if (labelInValue) {
|
|
465
|
-
onChange(
|
|
471
|
+
onChange(_data);
|
|
466
472
|
}
|
|
467
473
|
// 更新内部展示值
|
|
468
474
|
setState({
|
|
469
|
-
_value:
|
|
475
|
+
_value: _data,
|
|
470
476
|
isInit: false,
|
|
471
477
|
selectedRows: list,
|
|
472
478
|
selectedRowKeys: nextSelectRowKeys
|
|
@@ -493,7 +499,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
493
499
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
|
494
500
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
495
501
|
var _useRequest$options4, _useRequest$options5;
|
|
496
|
-
var queryBean, page, params, res, _list2, list, _res$data3,
|
|
502
|
+
var queryBean, page, params, res, _list2, list, _res$data3, _data2, nextSelectRowKeys;
|
|
497
503
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
498
504
|
while (1) switch (_context5.prev = _context5.next) {
|
|
499
505
|
case 0:
|
|
@@ -517,18 +523,18 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
517
523
|
} else {
|
|
518
524
|
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
|
|
519
525
|
}
|
|
520
|
-
|
|
526
|
+
_data2 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
|
|
521
527
|
nextSelectRowKeys = isMultiple ? value : [value];
|
|
522
528
|
if (labelInValue) {
|
|
523
|
-
onChange(
|
|
529
|
+
onChange(_data2);
|
|
524
530
|
} else {
|
|
525
|
-
onChange(isMultiple ?
|
|
531
|
+
onChange(isMultiple ? _data2.map(function (item) {
|
|
526
532
|
return item[valueKey];
|
|
527
|
-
}) :
|
|
533
|
+
}) : _data2[valueKey]);
|
|
528
534
|
}
|
|
529
535
|
// 更新内部展示值
|
|
530
536
|
setState({
|
|
531
|
-
_value:
|
|
537
|
+
_value: _data2,
|
|
532
538
|
isInit: false,
|
|
533
539
|
selectedRows: list,
|
|
534
540
|
selectedRowKeys: nextSelectRowKeys
|
|
@@ -597,8 +603,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
597
603
|
nextState.selectedRows = value;
|
|
598
604
|
}
|
|
599
605
|
} else if (value) {
|
|
606
|
+
console.log('value', value);
|
|
600
607
|
nextState.selectedRowKeys = [value];
|
|
601
|
-
nextState.selectedRows = [_defineProperty({}, valueKey, value[valueKey])];
|
|
602
608
|
}
|
|
603
609
|
setState(nextState);
|
|
604
610
|
}
|
|
@@ -242,7 +242,7 @@ var Render = function Render(props) {
|
|
|
242
242
|
* onChange参数重置 (value, record, { form, index, namePath, option }) => void
|
|
243
243
|
*/
|
|
244
244
|
var handleChange = function handleChange() {
|
|
245
|
-
var
|
|
245
|
+
var _lastComponentProps$c2;
|
|
246
246
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
247
247
|
args[_key] = arguments[_key];
|
|
248
248
|
}
|
|
@@ -260,11 +260,11 @@ var Render = function Render(props) {
|
|
|
260
260
|
((_AutoComponent$props$ = (_AutoComponent$props = AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props)[changeKey]) === null || _AutoComponent$props$ === void 0 ? void 0 : _AutoComponent$props$.call.apply(_AutoComponent$props$, [_AutoComponent$props].concat(_toConsumableArray(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat(_toConsumableArray(_args))));
|
|
261
261
|
return false;
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
// FormList 和 Group场景 对比值改变的话, 回显到表单上
|
|
265
|
-
if (inList) {
|
|
266
|
-
|
|
267
|
-
}
|
|
263
|
+
// const inList = _otherFormItemProps?.namePath?.length;
|
|
264
|
+
// // FormList 和 Group场景 对比值改变的话, 回显到表单上
|
|
265
|
+
// if (inList) {
|
|
266
|
+
// form.setFieldsValue(_args[1]);
|
|
267
|
+
// }
|
|
268
268
|
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
269
269
|
if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
|
|
270
270
|
setTimeout(function () {
|
|
@@ -276,7 +276,7 @@ var Render = function Render(props) {
|
|
|
276
276
|
// ProTreeSelect返回option
|
|
277
277
|
if (['ProTree'].includes(type)) {
|
|
278
278
|
var _args2, _args2$;
|
|
279
|
-
_args[2].option = findOptionByValue(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0]);
|
|
279
|
+
_args[2].option = findOptionByValue(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0], (lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.fieldNames) || {});
|
|
280
280
|
}
|
|
281
281
|
(_lastComponentProps$c2 = lastComponentProps[changeKey]) === null || _lastComponentProps$c2 === void 0 ? void 0 : _lastComponentProps$c2.call.apply(_lastComponentProps$c2, [lastComponentProps].concat(_toConsumableArray(_args)));
|
|
282
282
|
};
|
|
@@ -208,6 +208,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
208
208
|
clearNotShow?: boolean;
|
|
209
209
|
index?: number;
|
|
210
210
|
namePath?: NamePath;
|
|
211
|
+
listName?: NamePath;
|
|
211
212
|
/** 表单前缀信息 */
|
|
212
213
|
before?: string | React.ReactNode;
|
|
213
214
|
/** 表单后缀信息 */
|
|
@@ -216,7 +217,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
216
217
|
extra?: string | React.ReactNode;
|
|
217
218
|
/** 是否固定字段, 不隐藏 */
|
|
218
219
|
fixed?: boolean;
|
|
219
|
-
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
|
|
220
|
+
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
|
|
220
221
|
}
|
|
221
222
|
export type ProColumnProps<T = any> = ProFormColumnProps<T> & ColumnPropsMap<T, 'ProForm'>;
|
|
222
223
|
/**
|
|
@@ -83,7 +83,12 @@ export declare const deleteForPath: (values: any, namePath: string | number | (s
|
|
|
83
83
|
* @param value 选中值
|
|
84
84
|
* @returns {}
|
|
85
85
|
*/
|
|
86
|
-
export declare const findOptionByValue: (treeData: any[], value: string | number
|
|
86
|
+
export declare const findOptionByValue: (treeData: any[], value: string | number, fieldNames: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
label?: string;
|
|
89
|
+
value?: string;
|
|
90
|
+
children?: string;
|
|
91
|
+
}) => any;
|
|
87
92
|
/**
|
|
88
93
|
* 对比依赖列表中的 值是否变更
|
|
89
94
|
*/
|
|
@@ -392,19 +392,19 @@ export var deleteForPath = function deleteForPath(values, namePath) {
|
|
|
392
392
|
* @param value 选中值
|
|
393
393
|
* @returns {}
|
|
394
394
|
*/
|
|
395
|
-
export var findOptionByValue = function findOptionByValue(treeData, value) {
|
|
395
|
+
export var findOptionByValue = function findOptionByValue(treeData, value, fieldNames) {
|
|
396
396
|
if (isObject(value)) {
|
|
397
397
|
return value;
|
|
398
398
|
}
|
|
399
399
|
for (var i = 0; i < (treeData === null || treeData === void 0 ? void 0 : treeData.length); i++) {
|
|
400
400
|
var node = treeData[i];
|
|
401
|
-
if (node.value === value) {
|
|
402
|
-
return omit(node, ['children']);
|
|
401
|
+
if (node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value'] === value) {
|
|
402
|
+
return omit(node, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
|
403
403
|
}
|
|
404
404
|
if (node.children) {
|
|
405
|
-
var foundNode = findOptionByValue(node.children, value);
|
|
405
|
+
var foundNode = findOptionByValue(node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], value, fieldNames);
|
|
406
406
|
if (foundNode) {
|
|
407
|
-
return omit(foundNode, ['children']);
|
|
407
|
+
return omit(foundNode, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
}
|
package/es/ProSelect/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
10
10
|
import "antd/es/select/style";
|
|
11
11
|
import _Select from "antd/es/select";
|
|
12
|
-
var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
|
|
12
|
+
var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
|
15
15
|
import React, { useImperativeHandle, useState, forwardRef } from 'react';
|
|
@@ -19,6 +19,7 @@ import Container from '../ProForm/components/Container';
|
|
|
19
19
|
import AdaptiveTooltip from './components/AdaptiveTooltip';
|
|
20
20
|
import { ProForm } from '..';
|
|
21
21
|
import locale from '../locale';
|
|
22
|
+
import { getSelectList } from './utils';
|
|
22
23
|
import './index.less';
|
|
23
24
|
var Option = _Select.Option;
|
|
24
25
|
export var ProSelect = function ProSelect(props, ref) {
|
|
@@ -41,6 +42,8 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
41
42
|
tooltip = _props$tooltip === void 0 ? false : _props$tooltip,
|
|
42
43
|
otherProps = props.otherProps,
|
|
43
44
|
labelInValue = props.labelInValue,
|
|
45
|
+
_props$filterInList = props.filterInList,
|
|
46
|
+
filterInList = _props$filterInList === void 0 ? false : _props$filterInList,
|
|
44
47
|
_props$scrollFollowPa = props.scrollFollowParent,
|
|
45
48
|
scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa,
|
|
46
49
|
defaultOne = props.defaultOne,
|
|
@@ -265,6 +268,15 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
265
268
|
}
|
|
266
269
|
return value;
|
|
267
270
|
};
|
|
271
|
+
var newSelectList = selectList;
|
|
272
|
+
if ((otherProps === null || otherProps === void 0 ? void 0 : otherProps.listName) && filterInList) {
|
|
273
|
+
newSelectList = getSelectList({
|
|
274
|
+
otherProps: otherProps,
|
|
275
|
+
value: props.value,
|
|
276
|
+
dataSource: selectList,
|
|
277
|
+
labelInValue: labelInValue
|
|
278
|
+
});
|
|
279
|
+
}
|
|
268
280
|
return _jsx(_Select, _objectSpread(_objectSpread({
|
|
269
281
|
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProSelect = locale.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
|
|
270
282
|
allowClear: true,
|
|
@@ -287,7 +299,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
287
299
|
}
|
|
288
300
|
}, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name'])), {}, {
|
|
289
301
|
value: transformValue(),
|
|
290
|
-
children: Array.isArray(
|
|
302
|
+
children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
|
|
291
303
|
return _jsx(Option, {
|
|
292
304
|
value: item[code],
|
|
293
305
|
record: item,
|
|
@@ -14,6 +14,8 @@ export interface PropSelectProps extends Omit<SelectProps, 'onSearch'> {
|
|
|
14
14
|
defaultOne?: boolean;
|
|
15
15
|
/** 数据源 */
|
|
16
16
|
dataSource?: DataOption[];
|
|
17
|
+
/** list场景中过滤掉已选择的值 */
|
|
18
|
+
filterInList?: boolean;
|
|
17
19
|
/** @deprecated 兼容 2.0 版本、3.0 使用view 模式 */
|
|
18
20
|
defaultDisableValue?: string;
|
|
19
21
|
/** 是否展示 tooltip、当 label 特别长的时候使用 */
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
/* eslint-disable no-restricted-syntax */
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
5
|
+
var list = _ref.list,
|
|
6
|
+
selectName = _ref.selectName,
|
|
7
|
+
value = _ref.value,
|
|
8
|
+
dataSource = _ref.dataSource,
|
|
9
|
+
labelInValue = _ref.labelInValue;
|
|
10
|
+
var selectValues = [];
|
|
11
|
+
list.forEach(function (item) {
|
|
12
|
+
var result = item;
|
|
13
|
+
if (!item || !Object.keys(item).length || Object.keys(item).length === 1 && 'rowKey' in item) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
var _iterator = _createForOfIteratorHelper(selectName),
|
|
17
|
+
_step;
|
|
18
|
+
try {
|
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
+
var key = _step.value;
|
|
21
|
+
result = result[key];
|
|
22
|
+
}
|
|
23
|
+
} catch (err) {
|
|
24
|
+
_iterator.e(err);
|
|
25
|
+
} finally {
|
|
26
|
+
_iterator.f();
|
|
27
|
+
}
|
|
28
|
+
selectValues.push(result);
|
|
29
|
+
});
|
|
30
|
+
var diffList = _.difference(selectValues, [value]);
|
|
31
|
+
return dataSource.filter(function (item) {
|
|
32
|
+
return !diffList.includes(labelInValue ? item : item.value);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 返回当前组件可以显示的数据源
|
|
37
|
+
*/
|
|
38
|
+
export var getSelectList = function getSelectList(_ref2) {
|
|
39
|
+
var otherProps = _ref2.otherProps,
|
|
40
|
+
value = _ref2.value,
|
|
41
|
+
dataSource = _ref2.dataSource,
|
|
42
|
+
labelInValue = _ref2.labelInValue;
|
|
43
|
+
if (!otherProps) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
var listName = otherProps.listName,
|
|
47
|
+
form = otherProps.form;
|
|
48
|
+
var firstNumberIndex = listName.findIndex(function (item) {
|
|
49
|
+
return typeof item === 'number';
|
|
50
|
+
});
|
|
51
|
+
var fatherName = listName.slice(0, firstNumberIndex);
|
|
52
|
+
var selectName = listName.slice(firstNumberIndex + 1);
|
|
53
|
+
return findSelectNameValues({
|
|
54
|
+
list: form.getFieldValue(fatherName),
|
|
55
|
+
selectName: selectName,
|
|
56
|
+
value: value,
|
|
57
|
+
dataSource: dataSource,
|
|
58
|
+
labelInValue: labelInValue
|
|
59
|
+
});
|
|
60
|
+
};
|
|
@@ -407,13 +407,13 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
407
407
|
}
|
|
408
408
|
return result;
|
|
409
409
|
}
|
|
410
|
-
var handleChange = function handleChange(newVal) {
|
|
410
|
+
var handleChange = function handleChange(newVal, label, extra) {
|
|
411
411
|
// newVal回来得一定是label、value
|
|
412
412
|
var result = newVal;
|
|
413
413
|
if (props === null || props === void 0 ? void 0 : props.labelInValue) {
|
|
414
414
|
result = getLabelByValue(selectList, newVal);
|
|
415
415
|
}
|
|
416
|
-
onChange && onChange(result,
|
|
416
|
+
onChange && onChange(result, label, extra);
|
|
417
417
|
// 重置搜索
|
|
418
418
|
showSearch && searchTreeEvent('');
|
|
419
419
|
};
|
|
@@ -486,7 +486,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
486
486
|
allowClear: allowClear || true,
|
|
487
487
|
showArrow: true,
|
|
488
488
|
treeNodeFilterProp: treeNodeFilterProp,
|
|
489
|
-
virtual:
|
|
489
|
+
virtual: true
|
|
490
490
|
}, selectProps);
|
|
491
491
|
if (value === null) {
|
|
492
492
|
delete treeProps.value;
|
|
@@ -40,6 +40,12 @@
|
|
|
40
40
|
color: red;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
// 隐藏单选下拉树后面勾号
|
|
44
|
+
.@{ant-prefix}-select-tree-node-content-wrapper{
|
|
45
|
+
.check-mark-icon{
|
|
46
|
+
display: none;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
43
49
|
// 单选
|
|
44
50
|
&.signal-tree{
|
|
45
51
|
.@{ant-prefix}-select-tree{
|
|
@@ -63,14 +69,6 @@
|
|
|
63
69
|
display: block;
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
|
-
.@{ant-prefix}-select-tree-node-content-wrapper{
|
|
67
|
-
background-color: transparent;
|
|
68
|
-
&.@{ant-prefix}-select-tree-node-selected{
|
|
69
|
-
.check-mark-icon{
|
|
70
|
-
display: block;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
72
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
75
73
|
background-color: #f5f5f5;
|
|
76
74
|
}
|