@zat-design/sisyphus-react 3.4.9 → 3.4.10-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.
Files changed (117) hide show
  1. package/dist/index.esm.css +66 -52
  2. package/dist/less.esm.css +66 -52
  3. package/es/ProEditTable/components/DndWrapper/index.d.ts +1 -0
  4. package/es/ProEditTable/components/DndWrapper/index.js +4 -3
  5. package/es/ProEditTable/components/RenderField/index.js +20 -1
  6. package/es/ProEditTable/index.js +49 -56
  7. package/es/ProEditTable/propsType.d.ts +7 -2
  8. package/es/ProEditTable/style/index.less +10 -0
  9. package/es/ProEditTable/utils/index.js +1 -0
  10. package/es/ProEnum/components/Group.d.ts +1 -0
  11. package/es/ProEnum/index.js +11 -5
  12. package/es/ProEnum/style/index.less +2 -2
  13. package/es/ProForm/components/base/InputNumber/index.js +41 -24
  14. package/es/ProForm/components/combination/FormList/components/ActionButton.js +83 -37
  15. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +72 -26
  16. package/es/ProForm/components/combination/FormList/propsType.d.ts +4 -4
  17. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +8 -0
  18. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +18 -0
  19. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.less +10 -0
  20. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +2 -0
  21. package/es/ProForm/components/combination/Group/component/ComRender.js +29 -13
  22. package/es/ProForm/components/combination/Group/index.d.ts +2 -2
  23. package/es/ProForm/components/combination/Group/index.js +7 -7
  24. package/es/ProForm/components/combination/Group/style/index.less +1 -1
  25. package/es/ProForm/components/combination/Group/utils.d.ts +1 -1
  26. package/es/ProForm/components/combination/Group/utils.js +23 -4
  27. package/es/ProForm/components/combination/ProCascader/index.js +2 -2
  28. package/es/ProForm/components/combination/ProCascader/utils/index.js +8 -3
  29. package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
  30. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
  31. package/es/ProForm/components/combination/ProRangeLimit/index.js +10 -5
  32. package/es/ProForm/components/render/RenderFields.js +4 -1
  33. package/es/ProForm/utils/useDeepCompareMemo.d.ts +1 -1
  34. package/es/ProForm/utils/useDeepCompareMemo.js +2 -1
  35. package/es/ProForm/utils/useForm.js +10 -1
  36. package/es/ProLayout/components/ProCollapse/style/index.less +5 -2
  37. package/es/ProLayout/style/index.less +1 -1
  38. package/es/ProSelect/index.js +6 -3
  39. package/es/ProSelect/utils/index.d.ts +2 -1
  40. package/es/ProSelect/utils/index.js +9 -6
  41. package/es/ProTree/components/ProTree.js +18 -10
  42. package/es/ProTree/components/ProTreeSelect/index.js +2 -2
  43. package/es/ProTree/components/Tree.js +15 -7
  44. package/es/ProTree/index.js +2 -1
  45. package/es/ProTree/propsType.d.ts +5 -0
  46. package/es/ProUpload/components/ButtonRender.d.ts +1 -0
  47. package/es/ProUpload/components/ButtonRender.js +3 -1
  48. package/es/ProUpload/components/FileItem.d.ts +1 -0
  49. package/es/ProUpload/components/FileItem.js +21 -3
  50. package/es/ProUpload/index.js +4 -2
  51. package/es/ProUpload/propsType.d.ts +5 -0
  52. package/es/ProUpload/style/index.less +101 -111
  53. package/lib/ProEditTable/components/DndWrapper/index.d.ts +1 -0
  54. package/lib/ProEditTable/components/DndWrapper/index.js +4 -3
  55. package/lib/ProEditTable/components/RenderField/index.js +20 -1
  56. package/lib/ProEditTable/index.js +48 -55
  57. package/lib/ProEditTable/propsType.d.ts +7 -2
  58. package/lib/ProEditTable/style/index.less +10 -0
  59. package/lib/ProEditTable/utils/index.js +1 -0
  60. package/lib/ProEnum/components/Group.d.ts +1 -0
  61. package/lib/ProEnum/index.js +11 -5
  62. package/lib/ProEnum/style/index.less +2 -2
  63. package/lib/ProForm/components/base/InputNumber/index.js +40 -23
  64. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +83 -37
  65. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +72 -26
  66. package/lib/ProForm/components/combination/FormList/propsType.d.ts +4 -4
  67. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +8 -0
  68. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +24 -0
  69. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.less +10 -0
  70. package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +2 -0
  71. package/lib/ProForm/components/combination/Group/component/ComRender.js +31 -15
  72. package/lib/ProForm/components/combination/Group/index.d.ts +2 -2
  73. package/lib/ProForm/components/combination/Group/index.js +6 -6
  74. package/lib/ProForm/components/combination/Group/style/index.less +1 -1
  75. package/lib/ProForm/components/combination/Group/utils.d.ts +1 -1
  76. package/lib/ProForm/components/combination/Group/utils.js +24 -5
  77. package/lib/ProForm/components/combination/ProCascader/index.js +1 -1
  78. package/lib/ProForm/components/combination/ProCascader/utils/index.js +8 -3
  79. package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
  80. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
  81. package/lib/ProForm/components/combination/ProRangeLimit/index.js +10 -5
  82. package/lib/ProForm/components/render/RenderFields.js +4 -1
  83. package/lib/ProForm/utils/useDeepCompareMemo.d.ts +1 -1
  84. package/lib/ProForm/utils/useDeepCompareMemo.js +2 -1
  85. package/lib/ProForm/utils/useForm.js +10 -1
  86. package/lib/ProLayout/components/ProCollapse/style/index.less +5 -2
  87. package/lib/ProLayout/style/index.less +1 -1
  88. package/lib/ProSelect/index.js +6 -3
  89. package/lib/ProSelect/utils/index.d.ts +2 -1
  90. package/lib/ProSelect/utils/index.js +9 -6
  91. package/lib/ProTree/components/ProTree.js +17 -9
  92. package/lib/ProTree/components/ProTreeSelect/index.js +2 -2
  93. package/lib/ProTree/components/Tree.js +15 -7
  94. package/lib/ProTree/index.js +2 -1
  95. package/lib/ProTree/propsType.d.ts +5 -0
  96. package/lib/ProUpload/components/ButtonRender.d.ts +1 -0
  97. package/lib/ProUpload/components/ButtonRender.js +3 -1
  98. package/lib/ProUpload/components/FileItem.d.ts +1 -0
  99. package/lib/ProUpload/components/FileItem.js +19 -3
  100. package/lib/ProUpload/index.js +4 -2
  101. package/lib/ProUpload/propsType.d.ts +5 -0
  102. package/lib/ProUpload/style/index.less +101 -111
  103. package/package.json +2 -2
  104. package/es/ProForm/components/combination/_Group/index.d.ts +0 -4
  105. package/es/ProForm/components/combination/_Group/index.js +0 -109
  106. package/es/ProForm/components/combination/_Group/propsType.d.ts +0 -35
  107. package/es/ProForm/components/combination/_Group/propsType.js +0 -1
  108. package/es/ProForm/components/combination/_Group/style/index.less +0 -131
  109. package/es/ProForm/components/combination/_Group/utils.d.ts +0 -10
  110. package/es/ProForm/components/combination/_Group/utils.js +0 -46
  111. package/lib/ProForm/components/combination/_Group/index.d.ts +0 -4
  112. package/lib/ProForm/components/combination/_Group/index.js +0 -113
  113. package/lib/ProForm/components/combination/_Group/propsType.d.ts +0 -35
  114. package/lib/ProForm/components/combination/_Group/propsType.js +0 -5
  115. package/lib/ProForm/components/combination/_Group/style/index.less +0 -131
  116. package/lib/ProForm/components/combination/_Group/utils.d.ts +0 -10
  117. package/lib/ProForm/components/combination/_Group/utils.js +0 -53
@@ -21,7 +21,7 @@ var _ButtonRender = _interopRequireDefault(require("./components/ButtonRender"))
21
21
  var _ImageRender = _interopRequireDefault(require("./components/ImageRender"));
22
22
  var _uitls = require("./uitls");
23
23
  var _locale = _interopRequireDefault(require("../locale"));
24
- var _excluded = ["value", "size", "action", "maxCount", "headerRender", "footerRender", "disabled", "uploadType", "buttonProps", "accept", "extraTipText", "beforeUpload", "onChange", "onDownload", "onPreview", "onRemove", "filterOriginFileObj", "method", "className", "dataParams", "name", "showExampleContent", "showUploadList", "otherProps", "transformResponse", "exampleTitle", "exampleContent", "exampleModalProps", "buttonText", "afterRender", "fieldNames"];
24
+ var _excluded = ["value", "size", "action", "maxCount", "headerRender", "footerRender", "disabled", "uploadType", "buttonProps", "accept", "extraTipText", "beforeUpload", "onChange", "onDownload", "onPreview", "onRemove", "filterOriginFileObj", "method", "className", "dataParams", "name", "showExampleContent", "showUploadList", "otherProps", "transformResponse", "exampleTitle", "exampleContent", "exampleModalProps", "buttonText", "afterRender", "fieldNames", "isConfirmDelete"];
25
25
  /*
26
26
  * @Author: wangshengqiang
27
27
  * @Date: 2023-02-03 14:18:59
@@ -75,6 +75,7 @@ var ProUpload = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
75
75
  buttonText = props.buttonText,
76
76
  afterRender = props.afterRender,
77
77
  fieldNames = props.fieldNames,
78
+ isConfirmDelete = props.isConfirmDelete,
78
79
  residueProps = (0, _objectWithoutProperties2.default)(props, _excluded);
79
80
  var isView = otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView;
80
81
  var sensor = (0, _core.useSensor)(_core.PointerSensor, {
@@ -270,7 +271,8 @@ var ProUpload = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
270
271
  disabled: disabled || isView,
271
272
  buttonText: buttonText,
272
273
  extraTipText: extraTipText,
273
- afterRender: afterRender
274
+ afterRender: afterRender,
275
+ isConfirmDelete: isConfirmDelete
274
276
  };
275
277
  (0, _react.useEffect)(function () {
276
278
  if (fieldNames && value.length > 0) {
@@ -184,6 +184,11 @@ export interface ProUploadProps {
184
184
  * @default true
185
185
  */
186
186
  fieldNames?: fieldNamesProps;
187
+ /**
188
+ * @description 删除已经上传的文件时是否二次提示
189
+ * @default false
190
+ */
191
+ isConfirmDelete?: boolean;
187
192
  }
188
193
  export interface DraggableUploadListItemProps {
189
194
  file: UploadFile<any>;
@@ -7,70 +7,67 @@
7
7
  // 拖拽上传
8
8
  .pro-upload-dragger {
9
9
  .pro-upload-handle-box {
10
- background : #F8F9FA;
10
+ padding: var(--zaui-space-size-sm, 8px);
11
+ background: #f8f9fa;
11
12
  border-radius: var(--zaui-border-radius, 8px);
12
- padding : var(--zaui-space-size-sm, 8px);
13
13
 
14
14
  .@{ant-prefix}-upload.@{ant-prefix}-upload-drag {
15
15
  background-color: var(--zaui-base-bg, #fff);
16
16
  }
17
17
 
18
18
  .drag-upload-inner {
19
- min-width : 392px;
20
- height : 110px;
21
- display : flex;
22
- align-items : center;
19
+ display: flex;
20
+ align-items: center;
23
21
  justify-content: center;
22
+ min-width: 392px;
23
+ height: 110px;
24
24
 
25
25
  .upload-dragger-control {
26
26
  background-color: var(--zaui-base-bg, #fff);
27
27
 
28
28
  .dragger-txt-line1 {
29
- display : flex;
30
- line-height: 26px;
29
+ display: flex;
31
30
  align-items: center;
31
+ line-height: 26px;
32
32
 
33
33
  .icon-upload {
34
- display : inline-block;
34
+ display: inline-block;
35
+ color: #c5c7cd;
35
36
  font-size: 30px;
36
- color : #C5C7CD;
37
37
  }
38
38
 
39
39
  .dragger-txt {
40
40
  margin-left: 9px;
41
- font-size : var(--zaui-font-size, 14px);
42
41
 
43
-
44
- color : rgba(0, 0, 0, 0.85);
42
+ color: rgba(0, 0, 0, 0.85);
43
+ font-size: var(--zaui-font-size, 14px);
45
44
  line-height: 20px;
46
45
  }
47
46
 
48
47
  .click-txt {
49
- color: var(--zaui-brand, #006AFF);
48
+ color: var(--zaui-brand, #006aff);
50
49
  }
51
50
  }
52
51
 
53
52
  .file-ext {
54
- text-align: center;
55
53
  margin-top: 10px;
56
- font-size : var(--zaui-font-size-sm, 12px);
57
54
 
58
-
59
- color : #939599;
55
+ color: #939599;
56
+ font-size: var(--zaui-font-size-sm, 12px);
60
57
  line-height: 14px;
61
-
58
+ text-align: center;
62
59
  }
63
60
  }
64
61
 
65
62
  // 单个文件展示样式
66
63
  .dragger-single-file {
67
- display : flex;
64
+ display: flex;
65
+ flex-direction: column;
68
66
  justify-content: center;
69
- flex-direction : column;
70
- padding : 0 var(--zaui-space-size-lg, 32px);
67
+ padding: 0 var(--zaui-space-size-lg, 32px);
71
68
 
72
69
  .file-type-icon {
73
- width : 18px;
70
+ width: 18px;
74
71
  height: 22px;
75
72
  margin: 0 auto;
76
73
  }
@@ -79,21 +76,20 @@
79
76
  padding: 0 var(--zaui-space-size-lg, 32px);
80
77
  }
81
78
 
82
-
83
79
  .file-info-box {
80
+ display: flex;
84
81
  margin-top: 11px;
85
- display : flex;
86
82
 
87
83
  &.file-box-error {
88
84
  color: var(--zaui-danger);
89
85
  }
90
86
 
91
87
  .file-name {
92
- display : box;
93
- overflow : hidden;
88
+ display: box;
89
+ overflow: hidden;
90
+ word-break: break-all;
94
91
  line-clamp: 1;
95
92
  box-orient: vertical;
96
- word-break: break-all;
97
93
  }
98
94
 
99
95
  .file-ext {
@@ -104,148 +100,143 @@
104
100
  word-break: keep-all;
105
101
  }
106
102
 
107
-
108
103
  .file-download {
109
104
  margin-left: var(--zaui-space-size-sm, 8px);
110
105
  }
111
106
  }
112
107
 
113
108
  .file-action-box {
114
- display : flex;
109
+ display: flex;
115
110
  justify-content: center;
116
- margin-top : 3px;
117
-
111
+ margin-top: 3px;
112
+ color: #1890ff;
113
+ & > div {
114
+ cursor: pointer;
115
+ }
118
116
  .file-del {
119
- margin-left: 30px
117
+ margin-left: 30px;
120
118
  }
121
119
  }
122
120
  }
123
-
124
121
  }
125
122
  }
126
-
127
123
  }
128
124
 
129
125
  // 按钮上传
130
126
  .pro-upload-button {
131
127
  display: flex;
132
128
 
133
- >span {
134
- width : 100%;
129
+ > span {
135
130
  display: block;
131
+ width: 100%;
136
132
  }
137
133
 
138
134
  .pro-upload-button-inner {
139
135
  display: flex;
140
136
 
141
137
  .pro-upload-button-inner-right {
142
- line-height: 32px;
143
138
  margin-left: 10px;
139
+ line-height: 32px;
144
140
  }
145
141
  }
146
142
 
147
143
  .upload-tip-txt {
148
144
  margin-left: 10px;
149
- line-height: 32px;
150
- font-size : var(--zaui-font-size-sm, 12px);
151
-
152
145
 
153
146
  color: #939599;
147
+ font-size: var(--zaui-font-size-sm, 12px);
148
+ line-height: 32px;
154
149
  }
155
150
  }
156
151
 
157
-
158
152
  // 图片
159
153
  .pro-upload-image {
160
-
161
154
  position: relative;
162
- display : inline-flex;
155
+ display: inline-flex;
163
156
 
164
157
  .@{ant-prefix}-upload-list-picture-card-container,
165
158
  .@{ant-prefix}-upload-select-picture-card {
166
- width : 126px;
159
+ width: 126px;
167
160
  height: 126px;
168
161
  }
169
162
 
170
163
  .image-example {
171
- position : absolute;
172
- word-break : keep-all;
173
- top : 0;
174
- right : -10px;
175
- width : 88px;
176
- height : 32px;
177
- transform : translate(100%, 0);
178
- text-align : center;
179
- line-height : 32px;
180
- background : #FFFFFF;
164
+ position: absolute;
165
+ top: 0;
166
+ right: -10px;
167
+ width: 88px;
168
+ height: 32px;
169
+ line-height: 32px;
170
+ text-align: center;
171
+ word-break: keep-all;
172
+ background: #ffffff;
173
+ border: 1px solid #dcdcdc;
181
174
  border-radius: var(--zaui-border-radius, 8px);
182
- border : 1px solid #DCDCDC;
183
-
175
+ transform: translate(100%, 0);
184
176
  }
185
177
 
186
178
  .file-item-image {
187
- position : relative;
188
- overflow : hidden;
179
+ position: relative;
180
+ width: 126px;
189
181
  // height : 100%;
190
- height : 126px;
191
- width : 126px;
192
- border : 1px dashed #d9d9d9;
193
- overflow : hidden;
194
- border-radius : 8px;
182
+ height: 126px;
183
+ overflow: hidden;
184
+ overflow: hidden;
185
+ border: 1px dashed #d9d9d9;
186
+ border-radius: 8px;
195
187
 
196
188
  .file-type-icon-img {
197
- position : absolute;
198
- width : 30px;
199
- top : 50%;
200
- left : 50%;
189
+ position: absolute;
190
+ top: 50%;
191
+ left: 50%;
192
+ width: 30px;
201
193
  transform: translate(-50%, -50%);
202
-
203
194
  }
204
195
 
205
196
  .image-con {
206
197
  display: block;
207
- width : 100%;
208
- height : 100%;
198
+ width: 100%;
199
+ height: 100%;
209
200
  }
210
201
 
211
202
  &:hover .actions-wrap {
212
- display : block;
203
+ display: block;
213
204
  background-color: rgba(0, 0, 0, 0.75);
214
205
  }
215
206
 
216
207
  .actions-wrap {
217
- transition : all 2s;
218
- position : absolute;
219
- display : none;
220
- width : 100%;
221
- top : 0;
222
- bottom : 0;
208
+ position: absolute;
209
+ top: 0;
210
+ bottom: 0;
211
+ display: none;
212
+ width: 100%;
223
213
  background-color: rgba(0, 0, 0, 0.5);
214
+ transition: all 2s;
224
215
 
225
216
  .action-top {
226
- flex : 1;
227
- display : flex;
228
- align-items : center;
229
- flex-direction : column;
230
- height : calc(100% - 36px);
217
+ display: flex;
218
+ flex: 1;
219
+ flex-direction: column;
220
+ align-items: center;
231
221
  justify-content: center;
222
+ height: calc(100% - 36px);
232
223
  }
233
224
 
234
225
  .action-button {
235
- height : 36px;
226
+ height: 36px;
236
227
  line-height: 36px;
237
- background : #FFFFFF;
238
- text-align : center;
228
+ text-align: center;
229
+ background: #ffffff;
239
230
  }
240
231
 
241
232
  .action-item {
242
- color : #fff;
233
+ color: #fff;
243
234
  font-size: var(--zaui-font-size-sm, 12px);
244
- opacity : 0.8;
235
+ opacity: 0.8;
245
236
 
246
237
  .action-icon {
247
238
  margin-right: 10px;
248
- transform : translate(0, 3px);
239
+ transform: translate(0, 3px);
249
240
  }
250
241
 
251
242
  &:hover {
@@ -255,21 +246,21 @@
255
246
 
256
247
  .action-button {
257
248
  .action-item {
258
- color: var(--zaui-danger, #FF005F);
249
+ color: var(--zaui-danger, #ff005f);
259
250
  }
260
251
  }
261
252
  }
262
253
  }
263
254
 
264
255
  .file-item-image.actions-wrap-error {
265
- border: 1px solid #FF005F;
256
+ border: 1px solid #ff005f;
266
257
  }
267
258
 
268
259
  .image-uploading {
269
- padding : 20px;
270
- display : flex;
260
+ display: flex;
271
261
  align-items: center;
272
- height : inherit;
262
+ height: inherit;
263
+ padding: 20px;
273
264
  }
274
265
  }
275
266
 
@@ -289,38 +280,37 @@
289
280
  }
290
281
 
291
282
  .action-icon {
292
- display : inline-flex;
293
- align-items : center;
294
- color : inherit;
295
- font-style : normal;
296
- text-align : center;
283
+ display: inline-flex;
284
+ align-items: center;
285
+ color: inherit;
286
+ font-style: normal;
287
+ text-align: center;
297
288
  text-transform: none;
298
289
  vertical-align: -0.15em;
299
290
  text-rendering: optimizeLegibility;
300
291
 
301
292
  span {
302
- display : inline-flex;
303
- align-items : center;
304
- color : inherit;
305
- font-style : normal;
306
- text-align : center;
293
+ display: inline-flex;
294
+ align-items: center;
295
+ color: inherit;
296
+ font-style: normal;
297
+ text-align: center;
307
298
  text-transform: none;
308
299
  vertical-align: -0.15em;
309
300
  text-rendering: optimizeLegibility;
310
301
  }
311
-
312
302
  }
313
303
  }
314
304
  }
315
305
 
316
306
  .pro-upload-example {
317
- width : 100%;
318
- max-height : 400px;
319
- min-height : 200px;
320
- overflow-y : auto;
321
- display : flex;
322
- align-items : center;
307
+ display: flex;
308
+ align-items: center;
323
309
  justify-content: center;
310
+ width: 100%;
311
+ min-height: 200px;
312
+ max-height: 400px;
313
+ overflow-y: auto;
324
314
  }
325
315
 
326
316
  .proupload-modal-preview {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.9",
3
+ "version": "3.4.10-beta.10",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -58,7 +58,7 @@
58
58
  "@dnd-kit/sortable": "^7.0.2",
59
59
  "@dnd-kit/utilities": "^3.2.1",
60
60
  "@pansy/react-watermark": "^3.1.13",
61
- "@zat-design/utils": "^1.1.20",
61
+ "@zat-design/utils": "^1.1.22",
62
62
  "ahooks": "3.7.4",
63
63
  "antd": "4.24.8",
64
64
  "big.js": "^6.2.1",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { GroupProps } from './propsType';
3
- declare const Group: React.FC<GroupProps>;
4
- export default Group;
@@ -1,109 +0,0 @@
1
- import "antd/es/space/style";
2
- import _Space from "antd/es/space";
3
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- import "antd/es/button/style";
5
- import _Button from "antd/es/button";
6
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { useMemo } from 'react';
9
- import { omit, isFunction, union, isNumber } from 'lodash';
10
- import { useDeepCompareEffect } from 'ahooks';
11
- import classnames from 'classnames';
12
- import RenderFields from '../../render/RenderFields';
13
- import { insertSeparator, transformNamesString } from './utils';
14
- import ProForm from '../../../../ProForm';
15
- var Group = function Group(props) {
16
- var columns = props.children,
17
- otherProps = props.otherProps,
18
- className = props.className,
19
- _props$space = props.space,
20
- space = _props$space === void 0 ? {
21
- size: 12
22
- } : _props$space,
23
- id = props.id,
24
- value = props.value,
25
- isView = props.isView,
26
- index = props.index,
27
- onFieldChange = props.onFieldChange,
28
- namePath = props.namePath;
29
- var _ref = ProForm.useFieldProps() || {},
30
- names = _ref.names,
31
- name = _ref.name,
32
- form = _ref.form,
33
- _namePath = _ref.namePath;
34
- var newNamePath = namePath || _namePath || [];
35
- if (!Array.isArray(names)) {
36
- console.error('Warning: Composite form components whose type is Group must be configured with names');
37
- }
38
- var data = useMemo(function () {
39
- var fieldList = [];
40
- var result = columns.map(function (item) {
41
- return _objectSpread(_objectSpread({
42
- disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
43
- }, item), {}, {
44
- isView: isView !== null && isView !== void 0 ? isView : item.isView,
45
- noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
46
- parentNames: id,
47
- namePath: newNamePath
48
- });
49
- });
50
- var node = _jsx(_Button, {
51
- className: "group-separator",
52
- children: space.separator
53
- });
54
- return {
55
- columns: insertSeparator(result, space, node, otherProps),
56
- fieldList: fieldList
57
- };
58
- }, [name, columns, space, props, names]);
59
- var _className = classnames(_defineProperty({
60
- 'pro-group': true,
61
- 'pro-group-diy-width': columns.some(function (item) {
62
- var _item$fieldProps, _item$fieldProps$styl;
63
- return item === null || item === void 0 ? void 0 : (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : (_item$fieldProps$styl = _item$fieldProps.style) === null || _item$fieldProps$styl === void 0 ? void 0 : _item$fieldProps$styl.width;
64
- }),
65
- 'pro-group-width-auto': columns.some(function (item) {
66
- return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
67
- })
68
- }, "".concat(className), className));
69
- // 用于formList场景下names移除掉了前缀,需要再次合并回来
70
- var _names = names.map(function (item) {
71
- if (isNumber(item === null || item === void 0 ? void 0 : item[0])) {
72
- return union(newNamePath, item);
73
- }
74
- return item;
75
- });
76
- useDeepCompareEffect(function () {
77
- var _document, _document$activeEleme;
78
- // 焦点激活的表单
79
- var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
80
- // 模拟change,初始化不执行onFieldChange
81
- if (isFunction(onFieldChange) && form.isFieldsTouched(_names) && transformNamesString(_names).includes(touchName)) {
82
- onFieldChange(value, (newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.length) ? form.getFieldValue(newNamePath, true) : form.getFieldsValue(), {
83
- form: form,
84
- namePath: newNamePath,
85
- index: index
86
- });
87
- }
88
- }, [value]);
89
- var _otherProps = omit(otherProps, ['colProps', 'required']);
90
- return _jsx("div", {
91
- className: _className,
92
- children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
93
- children: _jsx(RenderFields, _objectSpread({
94
- columns: data.columns,
95
- form: form
96
- }, _otherProps))
97
- }) : _jsx(_Space, _objectSpread(_objectSpread({
98
- align: "start"
99
- }, omit(space, ['separator', 'compact'])), {}, {
100
- children: data.columns.map(function (column, index) {
101
- return _jsx(RenderFields, _objectSpread({
102
- columns: [column],
103
- form: form
104
- }, _otherProps), (column === null || column === void 0 ? void 0 : column.name) || index);
105
- })
106
- }))
107
- });
108
- };
109
- export default Group;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { RowProps, SpaceProps } from 'antd';
3
- import { FormInstance } from 'antd/es/form/Form';
4
- import { NamePath } from 'antd/lib/form/interface';
5
- import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
6
- export interface SpaceType extends SpaceProps {
7
- /**
8
- * 是否紧凑合并
9
- */
10
- compact?: Boolean;
11
- /**
12
- * 分隔符
13
- */
14
- separator?: string | React.ReactNode;
15
- /** 间隔距离 */
16
- size?: number;
17
- }
18
- export interface GroupProps {
19
- children?: ProColumnProps[];
20
- space?: SpaceType;
21
- otherProps?: ProFormOtherProps;
22
- rowProps?: RowProps;
23
- className?: string;
24
- value?: any;
25
- id?: string;
26
- disabled?: boolean | (() => void);
27
- isView?: boolean;
28
- namePath?: NamePath;
29
- index?: number;
30
- onFieldChange?: (value: any[] | null, record: any, { form, }: {
31
- form: FormInstance;
32
- namePath?: NamePath;
33
- index?: number;
34
- }) => any;
35
- }
@@ -1 +0,0 @@
1
- export {};