@kne/form-info 0.1.0-alpha.2 → 0.1.1
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/README.md +209 -38
- package/dist/index.css +5 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +458 -365
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +301 -237
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +11 -0
- package/dist/locale/en-US.js.map +1 -0
- package/dist/locale/en-US.modern.js +11 -0
- package/dist/locale/en-US.modern.js.map +1 -0
- package/dist/locale/zh-CN.js +11 -0
- package/dist/locale/zh-CN.js.map +1 -0
- package/dist/locale/zh-CN.modern.js +11 -0
- package/dist/locale/zh-CN.modern.js.map +1 -0
- package/package.json +9 -7
package/dist/index.modern.js
CHANGED
|
@@ -2,13 +2,14 @@ import '@kne/info-page/dist/index.css';
|
|
|
2
2
|
import '@kne/react-form-antd/dist/index.css';
|
|
3
3
|
import { FormAntd, CancelButton, SubmitButton } from '@kne/react-form-antd';
|
|
4
4
|
export * from '@kne/react-form-antd';
|
|
5
|
-
import
|
|
5
|
+
import { forwardRef, isValidElement, useRef, createElement, createContext, useContext } from 'react';
|
|
6
6
|
import InfoPage from '@kne/info-page';
|
|
7
7
|
import { useFlexBox } from '@kne/flex-box';
|
|
8
8
|
import { FormInfo as FormInfo$1, SubList, MultiField as MultiField$1, TableList as TableList$1 } from '@kne/react-form-plus';
|
|
9
9
|
import { Col, Row, Empty, Button, Divider, Modal, Flex, Steps } from 'antd';
|
|
10
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
11
|
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
11
|
-
import {
|
|
12
|
+
import { createWithIntlProvider, useIntl } from '@kne/react-intl';
|
|
12
13
|
import useControlValue from '@kne/use-control-value';
|
|
13
14
|
|
|
14
15
|
function _extends() {
|
|
@@ -24,7 +25,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
24
25
|
if (null == r) return {};
|
|
25
26
|
var t = {};
|
|
26
27
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
27
|
-
if (e.
|
|
28
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
28
29
|
t[n] = r[n];
|
|
29
30
|
}
|
|
30
31
|
return t;
|
|
@@ -112,7 +113,7 @@ var classnames = createCommonjsModule(function (module) {
|
|
|
112
113
|
}());
|
|
113
114
|
});
|
|
114
115
|
|
|
115
|
-
var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","react-form__field-label":"_UGjS9","multi-field-add-btn":"_rjVPh","table-list":"_r8-bn","table-list-field":"_Qkutm","table-list-header":"_9WdfD","is-req":"_CsPaL","table-options":"_8smwK","steps":"_IOdkE","steps-form-inner":"_uc1HZ","steps-modal":"_vWPQO"};
|
|
116
|
+
var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","react-form__field-label":"_UGjS9","multi-field-add-btn":"_rjVPh","table-list":"_r8-bn","table-list-field":"_Qkutm","table-list-header":"_9WdfD","is-req":"_CsPaL","table-options":"_8smwK","steps":"_IOdkE","steps-form-inner":"_uc1HZ","steps-modal":"_vWPQO","table-list-empty":"_DXskv"};
|
|
116
117
|
|
|
117
118
|
const _excluded$7 = ["className", "column", "list", "gap"];
|
|
118
119
|
const FormInfo = props => {
|
|
@@ -133,7 +134,7 @@ const FormInfo = props => {
|
|
|
133
134
|
column: flexBoxColumn
|
|
134
135
|
} = useFlexBox(isFlexBox ? column : {});
|
|
135
136
|
const renderInner = (column, notLayout) => {
|
|
136
|
-
return /*#__PURE__*/
|
|
137
|
+
return /*#__PURE__*/jsx(FormInfo$1, {
|
|
137
138
|
list: list,
|
|
138
139
|
column: column,
|
|
139
140
|
className: classnames({
|
|
@@ -141,20 +142,24 @@ const FormInfo = props => {
|
|
|
141
142
|
}),
|
|
142
143
|
itemRender: (children, props) => {
|
|
143
144
|
if (props.hidden) {
|
|
144
|
-
return /*#__PURE__*/
|
|
145
|
+
return /*#__PURE__*/jsx("div", {
|
|
145
146
|
style: {
|
|
146
147
|
display: 'none'
|
|
147
|
-
}
|
|
148
|
-
|
|
148
|
+
},
|
|
149
|
+
children: children
|
|
150
|
+
});
|
|
149
151
|
}
|
|
150
|
-
return /*#__PURE__*/
|
|
151
|
-
span: props.span
|
|
152
|
-
|
|
152
|
+
return /*#__PURE__*/jsx(Col, {
|
|
153
|
+
span: props.span,
|
|
154
|
+
children: children
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
children: children => {
|
|
158
|
+
return /*#__PURE__*/jsx(Row, {
|
|
159
|
+
gutter: [gap || 24, 0],
|
|
160
|
+
children: children
|
|
161
|
+
});
|
|
153
162
|
}
|
|
154
|
-
}, children => {
|
|
155
|
-
return /*#__PURE__*/React.createElement(Row, {
|
|
156
|
-
gutter: [gap || 24, 0]
|
|
157
|
-
}, children);
|
|
158
163
|
});
|
|
159
164
|
};
|
|
160
165
|
const renderColumn = () => {
|
|
@@ -166,34 +171,60 @@ const FormInfo = props => {
|
|
|
166
171
|
}
|
|
167
172
|
return renderInner(2, true);
|
|
168
173
|
};
|
|
169
|
-
return /*#__PURE__*/
|
|
170
|
-
className: classnames(className, style['form-info'])
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
+
return /*#__PURE__*/jsxs(InfoPage.Part, _extends({}, others, {
|
|
175
|
+
className: classnames(className, style['form-info']),
|
|
176
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
177
|
+
ref: flexBoxRef
|
|
178
|
+
}), renderColumn()]
|
|
179
|
+
}));
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const locale$1 = {
|
|
183
|
+
submit: '提交',
|
|
184
|
+
cancel: '取消',
|
|
185
|
+
complete: '完成',
|
|
186
|
+
next: '下一步',
|
|
187
|
+
addText: '添加',
|
|
188
|
+
deleteText: '删除'
|
|
174
189
|
};
|
|
175
190
|
|
|
191
|
+
const locale = {
|
|
192
|
+
submit: 'Submit',
|
|
193
|
+
cancel: 'Cancel',
|
|
194
|
+
complete: 'Complete',
|
|
195
|
+
next: 'Next',
|
|
196
|
+
addText: 'Add',
|
|
197
|
+
deleteText: 'Delete'
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const withLocale = createWithIntlProvider({
|
|
201
|
+
defaultLocale: 'zh-CN',
|
|
202
|
+
messages: {
|
|
203
|
+
'zh-CN': locale$1,
|
|
204
|
+
'en-US': locale
|
|
205
|
+
},
|
|
206
|
+
namespace: 'form-info'
|
|
207
|
+
});
|
|
208
|
+
|
|
176
209
|
const _excluded$6 = ["className", "itemClassName", "removeIcon", "removeText", "addText", "addIcon", "important", "title"],
|
|
177
210
|
_excluded2$2 = ["id", "allowRemove", "onRemove", "index", "groupArgs"];
|
|
178
|
-
const List = p => {
|
|
211
|
+
const List = withLocale(p => {
|
|
179
212
|
const {
|
|
180
|
-
|
|
181
|
-
} =
|
|
182
|
-
const locale = Object.assign({}, {
|
|
183
|
-
添加: '添加',
|
|
184
|
-
删除: '删除'
|
|
185
|
-
}, contextLocale, p.locale);
|
|
213
|
+
formatMessage
|
|
214
|
+
} = useIntl();
|
|
186
215
|
const _Object$assign = Object.assign({}, {
|
|
187
|
-
addText:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
216
|
+
addText: formatMessage({
|
|
217
|
+
id: 'addText'
|
|
218
|
+
}),
|
|
219
|
+
addIcon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
220
|
+
removeText: formatMessage({
|
|
221
|
+
id: 'deleteText'
|
|
222
|
+
}),
|
|
223
|
+
removeIcon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
224
|
+
empty: /*#__PURE__*/jsx(Empty, {
|
|
192
225
|
description: false
|
|
193
226
|
})
|
|
194
|
-
}, p,
|
|
195
|
-
locale
|
|
196
|
-
}),
|
|
227
|
+
}, p),
|
|
197
228
|
{
|
|
198
229
|
className,
|
|
199
230
|
itemClassName,
|
|
@@ -205,7 +236,7 @@ const List = p => {
|
|
|
205
236
|
title
|
|
206
237
|
} = _Object$assign,
|
|
207
238
|
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$6);
|
|
208
|
-
return /*#__PURE__*/
|
|
239
|
+
return /*#__PURE__*/jsx(SubList, _extends({}, others, {
|
|
209
240
|
className: classnames(className, style['list-part']),
|
|
210
241
|
listRender: _ref => {
|
|
211
242
|
let {
|
|
@@ -214,58 +245,59 @@ const List = p => {
|
|
|
214
245
|
onRemove
|
|
215
246
|
} = _ref,
|
|
216
247
|
props = _objectWithoutPropertiesLoose(_ref, _excluded2$2);
|
|
217
|
-
return /*#__PURE__*/
|
|
218
|
-
key: id,
|
|
248
|
+
return /*#__PURE__*/jsxs("div", {
|
|
219
249
|
className: classnames(style['list-item'], {
|
|
220
250
|
[style['is-important']]: important
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
251
|
+
}),
|
|
252
|
+
children: [/*#__PURE__*/jsx(FormInfo, _extends({}, props, {
|
|
253
|
+
className: style['list-item-part'],
|
|
254
|
+
gap: 16,
|
|
255
|
+
extra: allowRemove && /*#__PURE__*/jsx(Button, {
|
|
256
|
+
type: "link",
|
|
257
|
+
danger: true,
|
|
258
|
+
className: "btn-no-padding",
|
|
259
|
+
icon: removeIcon,
|
|
260
|
+
onClick: onRemove,
|
|
261
|
+
children: removeText
|
|
262
|
+
})
|
|
263
|
+
})), /*#__PURE__*/jsx(Divider, {})]
|
|
264
|
+
}, id);
|
|
265
|
+
},
|
|
266
|
+
children: (children, {
|
|
267
|
+
allowAdd,
|
|
268
|
+
onAdd
|
|
269
|
+
}) => {
|
|
270
|
+
return /*#__PURE__*/jsx(InfoPage.Part, {
|
|
271
|
+
className: itemClassName,
|
|
272
|
+
title: title,
|
|
273
|
+
extra: allowAdd && /*#__PURE__*/jsx(Button, {
|
|
274
|
+
className: style['extra-btn'],
|
|
275
|
+
icon: addIcon,
|
|
276
|
+
onClick: onAdd,
|
|
277
|
+
children: addText
|
|
278
|
+
}),
|
|
279
|
+
children: children
|
|
280
|
+
});
|
|
233
281
|
}
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
onAdd
|
|
237
|
-
}) => {
|
|
238
|
-
return /*#__PURE__*/React.createElement(InfoPage.Part, {
|
|
239
|
-
className: itemClassName,
|
|
240
|
-
title: title,
|
|
241
|
-
extra: allowAdd && /*#__PURE__*/React.createElement(Button, {
|
|
242
|
-
className: style['extra-btn'],
|
|
243
|
-
icon: addIcon,
|
|
244
|
-
onClick: onAdd
|
|
245
|
-
}, addText)
|
|
246
|
-
}, children);
|
|
247
|
-
});
|
|
248
|
-
};
|
|
282
|
+
}));
|
|
283
|
+
});
|
|
249
284
|
|
|
250
285
|
const _excluded$5 = ["className", "addText", "addIcon", "removeIcon", "removeText"];
|
|
251
|
-
const MultiField = p => {
|
|
286
|
+
const MultiField = withLocale(p => {
|
|
252
287
|
const {
|
|
253
|
-
|
|
254
|
-
} =
|
|
255
|
-
const locale = Object.assign({}, {
|
|
256
|
-
添加: '添加'
|
|
257
|
-
}, contextLocale, p.locale);
|
|
288
|
+
formatMessage
|
|
289
|
+
} = useIntl();
|
|
258
290
|
const _Object$assign = Object.assign({}, {
|
|
259
|
-
addText:
|
|
260
|
-
|
|
261
|
-
|
|
291
|
+
addText: formatMessage({
|
|
292
|
+
id: 'addText'
|
|
293
|
+
}),
|
|
294
|
+
addIcon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
295
|
+
removeIcon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
262
296
|
removeText: null,
|
|
263
|
-
empty: /*#__PURE__*/
|
|
297
|
+
empty: /*#__PURE__*/jsx(Empty, {
|
|
264
298
|
description: false
|
|
265
299
|
})
|
|
266
|
-
}, p,
|
|
267
|
-
locale
|
|
268
|
-
}),
|
|
300
|
+
}, p),
|
|
269
301
|
{
|
|
270
302
|
className,
|
|
271
303
|
addText,
|
|
@@ -274,56 +306,61 @@ const MultiField = p => {
|
|
|
274
306
|
removeText
|
|
275
307
|
} = _Object$assign,
|
|
276
308
|
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$5);
|
|
277
|
-
return /*#__PURE__*/
|
|
309
|
+
return /*#__PURE__*/jsx(MultiField$1, _extends({}, others, {
|
|
278
310
|
itemRender: (children, {
|
|
279
311
|
id,
|
|
280
312
|
allowRemove,
|
|
281
313
|
onRemove
|
|
282
314
|
}) => {
|
|
283
|
-
return /*#__PURE__*/
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
315
|
+
return /*#__PURE__*/jsxs("div", {
|
|
316
|
+
className: classnames('multi-field-item', style['multi-field-item']),
|
|
317
|
+
children: [children, /*#__PURE__*/jsxs("div", {
|
|
318
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
319
|
+
className: classnames(style['react-form__field-label'], 'react-form__field-label', 'multi-field-delete-label')
|
|
320
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
321
|
+
icon: removeIcon,
|
|
322
|
+
onClick: onRemove,
|
|
323
|
+
disabled: !allowRemove,
|
|
324
|
+
children: typeof removeText === 'function' ? removeText(others.label) : removeText
|
|
325
|
+
})]
|
|
326
|
+
})]
|
|
327
|
+
}, id);
|
|
328
|
+
},
|
|
329
|
+
children: (children, {
|
|
330
|
+
allowAdd,
|
|
331
|
+
onAdd
|
|
332
|
+
}) => /*#__PURE__*/jsxs("div", {
|
|
333
|
+
className: classnames(className, 'multi-field', style['multi-field']),
|
|
334
|
+
children: [children, allowAdd && /*#__PURE__*/jsx(Button, {
|
|
335
|
+
className: classnames('multi-field-add-btn', style['multi-field-add-btn']),
|
|
336
|
+
type: "dashed",
|
|
337
|
+
onClick: onAdd,
|
|
338
|
+
icon: addIcon,
|
|
339
|
+
children: typeof addText === 'function' ? addText(others.label) : `${addText}${others.label}`
|
|
340
|
+
})]
|
|
341
|
+
})
|
|
342
|
+
}));
|
|
343
|
+
});
|
|
306
344
|
|
|
307
345
|
const _excluded$4 = ["className", "addIcon", "addText", "removeIcon", "removeText", "title"];
|
|
308
|
-
const TableList = p => {
|
|
346
|
+
const TableList = withLocale(p => {
|
|
309
347
|
const {
|
|
310
|
-
|
|
311
|
-
} =
|
|
312
|
-
const locale = Object.assign({}, {
|
|
313
|
-
添加: '添加',
|
|
314
|
-
删除: '删除'
|
|
315
|
-
}, contextLocale, p.locale);
|
|
348
|
+
formatMessage
|
|
349
|
+
} = useIntl();
|
|
316
350
|
const _Object$assign = Object.assign({}, {
|
|
317
|
-
empty: /*#__PURE__*/
|
|
318
|
-
description: false
|
|
351
|
+
empty: /*#__PURE__*/jsx(Empty, {
|
|
352
|
+
description: false,
|
|
353
|
+
className: style['table-list-empty']
|
|
319
354
|
}),
|
|
320
|
-
addIcon: /*#__PURE__*/
|
|
321
|
-
addText:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
355
|
+
addIcon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
356
|
+
addText: formatMessage({
|
|
357
|
+
id: 'addText'
|
|
358
|
+
}),
|
|
359
|
+
removeIcon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
360
|
+
removeText: formatMessage({
|
|
361
|
+
id: 'deleteText'
|
|
362
|
+
})
|
|
363
|
+
}, p),
|
|
327
364
|
{
|
|
328
365
|
className,
|
|
329
366
|
addIcon,
|
|
@@ -333,36 +370,38 @@ const TableList = p => {
|
|
|
333
370
|
title
|
|
334
371
|
} = _Object$assign,
|
|
335
372
|
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$4);
|
|
336
|
-
return /*#__PURE__*/
|
|
373
|
+
return /*#__PURE__*/jsx(TableList$1, _extends({}, others, {
|
|
337
374
|
headerRender: (children, {
|
|
338
375
|
width
|
|
339
376
|
}) => {
|
|
340
|
-
return /*#__PURE__*/
|
|
377
|
+
return /*#__PURE__*/jsxs(Row, {
|
|
341
378
|
className: style['table-list-header'],
|
|
342
379
|
wrap: false,
|
|
343
380
|
style: {
|
|
344
381
|
'--col-width': width
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
382
|
+
},
|
|
383
|
+
children: [children, /*#__PURE__*/jsx(Col, {
|
|
384
|
+
className: style['table-options']
|
|
385
|
+
})]
|
|
386
|
+
});
|
|
349
387
|
},
|
|
350
388
|
headerItemRender: (children, {
|
|
351
389
|
id,
|
|
352
390
|
isReq
|
|
353
391
|
}) => {
|
|
354
|
-
return /*#__PURE__*/
|
|
392
|
+
return /*#__PURE__*/jsx(Col, {
|
|
355
393
|
className: classnames({
|
|
356
394
|
[style['is-req']]: isReq
|
|
357
395
|
}),
|
|
358
|
-
|
|
359
|
-
},
|
|
396
|
+
children: children
|
|
397
|
+
}, id);
|
|
360
398
|
},
|
|
361
399
|
itemRender: children => {
|
|
362
|
-
return /*#__PURE__*/
|
|
400
|
+
return /*#__PURE__*/jsx(Col, {
|
|
363
401
|
className: style['table-list-field'],
|
|
364
|
-
flex: 1
|
|
365
|
-
|
|
402
|
+
flex: 1,
|
|
403
|
+
children: children
|
|
404
|
+
});
|
|
366
405
|
},
|
|
367
406
|
listRender: (children, {
|
|
368
407
|
id,
|
|
@@ -370,43 +409,49 @@ const TableList = p => {
|
|
|
370
409
|
onRemove,
|
|
371
410
|
allowRemove
|
|
372
411
|
}) => {
|
|
373
|
-
return /*#__PURE__*/
|
|
374
|
-
key: id,
|
|
412
|
+
return /*#__PURE__*/jsxs(Row, {
|
|
375
413
|
wrap: false,
|
|
376
414
|
align: "top",
|
|
377
415
|
style: {
|
|
378
416
|
'--col-width': width
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
417
|
+
},
|
|
418
|
+
children: [children, /*#__PURE__*/jsx(Col, {
|
|
419
|
+
className: style['table-options'],
|
|
420
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
421
|
+
type: "link",
|
|
422
|
+
onClick: onRemove,
|
|
423
|
+
danger: true,
|
|
424
|
+
disabled: !allowRemove,
|
|
425
|
+
icon: removeIcon,
|
|
426
|
+
children: removeText
|
|
427
|
+
})
|
|
428
|
+
})]
|
|
429
|
+
}, id);
|
|
430
|
+
},
|
|
431
|
+
children: (children, {
|
|
432
|
+
onAdd,
|
|
433
|
+
allowAdd
|
|
434
|
+
}) => {
|
|
435
|
+
return /*#__PURE__*/jsx(InfoPage.Part, {
|
|
436
|
+
title: title,
|
|
437
|
+
className: classnames(className, style['table-list']),
|
|
438
|
+
extra: allowAdd && /*#__PURE__*/jsx(Button, {
|
|
439
|
+
className: style['extra-btn'],
|
|
440
|
+
icon: addIcon,
|
|
441
|
+
onClick: onAdd,
|
|
442
|
+
children: addText
|
|
443
|
+
}),
|
|
444
|
+
children: /*#__PURE__*/jsx("div", {
|
|
445
|
+
className: style['table-list-inner'],
|
|
446
|
+
children: children
|
|
447
|
+
})
|
|
448
|
+
});
|
|
389
449
|
}
|
|
390
|
-
})
|
|
391
|
-
|
|
392
|
-
allowAdd
|
|
393
|
-
}) => {
|
|
394
|
-
return /*#__PURE__*/React.createElement(InfoPage.Part, {
|
|
395
|
-
title: title,
|
|
396
|
-
className: classnames(className, style['table-list']),
|
|
397
|
-
extra: allowAdd && /*#__PURE__*/React.createElement(Button, {
|
|
398
|
-
className: style['extra-btn'],
|
|
399
|
-
icon: addIcon,
|
|
400
|
-
onClick: onAdd
|
|
401
|
-
}, addText)
|
|
402
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
403
|
-
className: style['table-list-inner']
|
|
404
|
-
}, children));
|
|
405
|
-
});
|
|
406
|
-
};
|
|
450
|
+
}));
|
|
451
|
+
});
|
|
407
452
|
|
|
408
453
|
const _excluded$3 = ["className", "children"];
|
|
409
|
-
const Form = forwardRef((props, ref) => {
|
|
454
|
+
const Form = /*#__PURE__*/forwardRef((props, ref) => {
|
|
410
455
|
const _Object$assign = Object.assign({}, {
|
|
411
456
|
type: 'inner'
|
|
412
457
|
}, props),
|
|
@@ -415,10 +460,13 @@ const Form = forwardRef((props, ref) => {
|
|
|
415
460
|
children
|
|
416
461
|
} = _Object$assign,
|
|
417
462
|
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$3);
|
|
418
|
-
return /*#__PURE__*/
|
|
463
|
+
return /*#__PURE__*/jsx(FormAntd, _extends({}, others, {
|
|
419
464
|
ref: ref,
|
|
420
|
-
className: classnames(className, style['form-outer'])
|
|
421
|
-
|
|
465
|
+
className: classnames(className, style['form-outer']),
|
|
466
|
+
children: /*#__PURE__*/jsx(InfoPage, {
|
|
467
|
+
children: children
|
|
468
|
+
})
|
|
469
|
+
}));
|
|
422
470
|
});
|
|
423
471
|
|
|
424
472
|
/**
|
|
@@ -3676,24 +3724,30 @@ const ModalFooter = props => {
|
|
|
3676
3724
|
okText
|
|
3677
3725
|
} = props,
|
|
3678
3726
|
others = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
3679
|
-
const defaultFooter = /*#__PURE__*/
|
|
3727
|
+
const defaultFooter = /*#__PURE__*/jsxs(Flex, {
|
|
3680
3728
|
justify: "space-between",
|
|
3681
|
-
gap: 8
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3729
|
+
gap: 8,
|
|
3730
|
+
children: [/*#__PURE__*/jsx("div", {}), /*#__PURE__*/jsxs(Flex, {
|
|
3731
|
+
gap: 8,
|
|
3732
|
+
children: [/*#__PURE__*/jsx(CancelButton, _extends({}, Object.assign({}, cancelButtonProps, {
|
|
3733
|
+
onClick: others.onCancel
|
|
3734
|
+
}), {
|
|
3735
|
+
children: cancelText
|
|
3736
|
+
})), /*#__PURE__*/jsx(SubmitButton, _extends({}, Object.assign({}, okButtonProps, {
|
|
3737
|
+
type: okType,
|
|
3738
|
+
onClick: onOk
|
|
3739
|
+
}), {
|
|
3740
|
+
children: okText
|
|
3741
|
+
}))]
|
|
3742
|
+
})]
|
|
3743
|
+
});
|
|
3690
3744
|
if (typeof children === 'function') {
|
|
3691
3745
|
return children({
|
|
3692
3746
|
defaultFooter,
|
|
3693
3747
|
props: omit_1(props, ['children'])
|
|
3694
3748
|
});
|
|
3695
3749
|
}
|
|
3696
|
-
if (isValidElement(children) || children === null) {
|
|
3750
|
+
if (/*#__PURE__*/isValidElement(children) || children === null) {
|
|
3697
3751
|
return children;
|
|
3698
3752
|
}
|
|
3699
3753
|
return defaultFooter;
|
|
@@ -3706,7 +3760,7 @@ const ModalForm = props => {
|
|
|
3706
3760
|
modalRender
|
|
3707
3761
|
} = props,
|
|
3708
3762
|
others = _objectWithoutPropertiesLoose(props, _excluded2$1);
|
|
3709
|
-
const formChildren = /*#__PURE__*/
|
|
3763
|
+
const formChildren = /*#__PURE__*/jsx(Form, _extends({}, Object.assign({}, formProps, {
|
|
3710
3764
|
onSubmit: async (data, ...args) => {
|
|
3711
3765
|
const res = await (formProps.onSubmit == null ? void 0 : formProps.onSubmit(data, {
|
|
3712
3766
|
close: others.onCancel
|
|
@@ -3716,31 +3770,31 @@ const ModalForm = props => {
|
|
|
3716
3770
|
}
|
|
3717
3771
|
autoClose && others.onCancel && others.onCancel();
|
|
3718
3772
|
}
|
|
3719
|
-
}),
|
|
3773
|
+
}), {
|
|
3774
|
+
children: children
|
|
3775
|
+
}));
|
|
3720
3776
|
return typeof modalRender === 'function' ? modalRender({
|
|
3721
3777
|
formChildren,
|
|
3722
3778
|
defaultChildren: children,
|
|
3723
3779
|
props: omit_1(props, ['children'])
|
|
3724
3780
|
}) : formChildren;
|
|
3725
3781
|
};
|
|
3726
|
-
const FormModal = p => {
|
|
3782
|
+
const FormModal = withLocale(p => {
|
|
3727
3783
|
const {
|
|
3728
|
-
|
|
3729
|
-
} =
|
|
3730
|
-
const locale = Object.assign({}, {
|
|
3731
|
-
提交: '提交',
|
|
3732
|
-
取消: '取消'
|
|
3733
|
-
}, contextLocale, p.locale);
|
|
3784
|
+
formatMessage
|
|
3785
|
+
} = useIntl();
|
|
3734
3786
|
const _Object$assign = Object.assign({}, {
|
|
3735
3787
|
formProps: {},
|
|
3736
3788
|
autoClose: true,
|
|
3737
3789
|
okType: 'primary',
|
|
3738
|
-
okText:
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3790
|
+
okText: formatMessage({
|
|
3791
|
+
id: 'submit'
|
|
3792
|
+
}),
|
|
3793
|
+
cancelText: formatMessage({
|
|
3794
|
+
id: 'cancel'
|
|
3795
|
+
}),
|
|
3796
|
+
renderModal: props => /*#__PURE__*/jsx(Modal, _extends({}, props))
|
|
3797
|
+
}, p),
|
|
3744
3798
|
{
|
|
3745
3799
|
formProps,
|
|
3746
3800
|
okType,
|
|
@@ -3756,14 +3810,14 @@ const FormModal = p => {
|
|
|
3756
3810
|
} = _Object$assign,
|
|
3757
3811
|
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded3$1);
|
|
3758
3812
|
return renderModal(Object.assign({}, others, {
|
|
3759
|
-
modalRender: children => /*#__PURE__*/
|
|
3813
|
+
modalRender: children => /*#__PURE__*/jsx(ModalForm, _extends({}, Object.assign({}, others, {
|
|
3760
3814
|
formProps,
|
|
3761
3815
|
autoClose,
|
|
3762
3816
|
children,
|
|
3763
3817
|
modalRender
|
|
3764
|
-
})),
|
|
3818
|
+
}))),
|
|
3765
3819
|
footer: () => {
|
|
3766
|
-
return /*#__PURE__*/
|
|
3820
|
+
return /*#__PURE__*/jsx(ModalFooter, _extends({}, Object.assign({}, others, {
|
|
3767
3821
|
children: footer,
|
|
3768
3822
|
cancelText,
|
|
3769
3823
|
cancelButtonProps,
|
|
@@ -3771,14 +3825,14 @@ const FormModal = p => {
|
|
|
3771
3825
|
okType,
|
|
3772
3826
|
onOk,
|
|
3773
3827
|
okText
|
|
3774
|
-
}));
|
|
3828
|
+
})));
|
|
3775
3829
|
}
|
|
3776
3830
|
}));
|
|
3777
|
-
};
|
|
3831
|
+
});
|
|
3778
3832
|
|
|
3779
3833
|
const _excluded$1 = ["className", "stepsClassName", "autoStep", "onComplete", "children"];
|
|
3780
3834
|
const FormSteps = p => {
|
|
3781
|
-
var _stepProps$items$curr, _stepProps$items$curr2;
|
|
3835
|
+
var _stepProps$items$curr, _stepProps$items$curr2, _stepCacheRef$current, _stepProps$items$curr3;
|
|
3782
3836
|
const _Object$assign = Object.assign({}, {
|
|
3783
3837
|
autoStep: true,
|
|
3784
3838
|
defaultCurrent: 0,
|
|
@@ -3799,19 +3853,23 @@ const FormSteps = p => {
|
|
|
3799
3853
|
});
|
|
3800
3854
|
const stepCacheRef = useRef([]);
|
|
3801
3855
|
const isLastStep = currentStep === stepProps.items.length - 1;
|
|
3802
|
-
const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps
|
|
3803
|
-
|
|
3856
|
+
const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps, {
|
|
3857
|
+
data: Object.assign({}, (_stepProps$items$curr2 = stepProps.items[currentStep]) == null || (_stepProps$items$curr2 = _stepProps$items$curr2.formProps) == null ? void 0 : _stepProps$items$curr2.data, (_stepCacheRef$current = stepCacheRef.current[currentStep]) == null ? void 0 : _stepCacheRef$current.formData)
|
|
3858
|
+
});
|
|
3859
|
+
const inner = /*#__PURE__*/jsxs(Flex, {
|
|
3804
3860
|
className: className,
|
|
3805
|
-
vertical: stepProps.direction !== 'vertical',
|
|
3806
|
-
gap: 24
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3861
|
+
vertical: stepProps.direction !== 'vertical' || stepProps.orientation !== 'vertical',
|
|
3862
|
+
gap: 24,
|
|
3863
|
+
children: [/*#__PURE__*/jsx(Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
|
|
3864
|
+
className: classnames(stepsClassName, style['steps']),
|
|
3865
|
+
items: stepProps.items.map(item => omit_1(item, ['formProps'])),
|
|
3866
|
+
current: currentStep
|
|
3867
|
+
})), /*#__PURE__*/jsx("div", {
|
|
3868
|
+
className: style['steps-form-inner'],
|
|
3869
|
+
children: (_stepProps$items$curr3 = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr3.children
|
|
3870
|
+
})]
|
|
3871
|
+
});
|
|
3872
|
+
return /*#__PURE__*/createElement(Form, _extends({}, Object.assign({}, currentFormProps, {
|
|
3815
3873
|
onSubmit: async (data, ...args) => {
|
|
3816
3874
|
if (!stepCacheRef.current[currentStep]) {
|
|
3817
3875
|
stepCacheRef.current[currentStep] = {};
|
|
@@ -3834,6 +3892,8 @@ const FormSteps = p => {
|
|
|
3834
3892
|
}
|
|
3835
3893
|
return res;
|
|
3836
3894
|
}
|
|
3895
|
+
}), {
|
|
3896
|
+
key: currentStep
|
|
3837
3897
|
}), typeof children === 'function' ? children({
|
|
3838
3898
|
children: inner,
|
|
3839
3899
|
isLastStep,
|
|
@@ -4216,12 +4276,12 @@ var merge_1 = merge;
|
|
|
4216
4276
|
const _excluded = ["completeText", "nextText"],
|
|
4217
4277
|
_excluded2 = ["modalProps", "completeText", "nextText", "className"],
|
|
4218
4278
|
_excluded3 = ["children"];
|
|
4219
|
-
const childrenContext = createContext({});
|
|
4279
|
+
const childrenContext = /*#__PURE__*/createContext({});
|
|
4220
4280
|
const {
|
|
4221
4281
|
Provider
|
|
4222
4282
|
} = childrenContext;
|
|
4223
4283
|
const useChildrenContext = () => {
|
|
4224
|
-
return useContext
|
|
4284
|
+
return useContext(childrenContext);
|
|
4225
4285
|
};
|
|
4226
4286
|
const StepChildren = () => {
|
|
4227
4287
|
const {
|
|
@@ -4239,25 +4299,26 @@ const StepFormFooter = p => {
|
|
|
4239
4299
|
const {
|
|
4240
4300
|
isLastStep
|
|
4241
4301
|
} = useChildrenContext();
|
|
4242
|
-
return /*#__PURE__*/
|
|
4302
|
+
return /*#__PURE__*/jsx(ModalFooter, _extends({}, props, {
|
|
4243
4303
|
okText: isLastStep ? completeText : nextText
|
|
4244
4304
|
}));
|
|
4245
4305
|
};
|
|
4246
|
-
const FormStepsModal = p => {
|
|
4247
|
-
const
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
}, p.locale);
|
|
4306
|
+
const FormStepsModal = withLocale(p => {
|
|
4307
|
+
const {
|
|
4308
|
+
formatMessage
|
|
4309
|
+
} = useIntl();
|
|
4251
4310
|
const _merge = merge_1({}, {
|
|
4252
4311
|
autoStep: true,
|
|
4253
4312
|
modalProps: {
|
|
4254
4313
|
autoClose: true
|
|
4255
4314
|
},
|
|
4256
|
-
completeText:
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4315
|
+
completeText: formatMessage({
|
|
4316
|
+
id: 'complete'
|
|
4317
|
+
}),
|
|
4318
|
+
nextText: formatMessage({
|
|
4319
|
+
id: 'next'
|
|
4320
|
+
})
|
|
4321
|
+
}, p),
|
|
4261
4322
|
{
|
|
4262
4323
|
modalProps,
|
|
4263
4324
|
completeText,
|
|
@@ -4265,11 +4326,11 @@ const FormStepsModal = p => {
|
|
|
4265
4326
|
className
|
|
4266
4327
|
} = _merge,
|
|
4267
4328
|
others = _objectWithoutPropertiesLoose(_merge, _excluded2);
|
|
4268
|
-
return /*#__PURE__*/
|
|
4329
|
+
return /*#__PURE__*/jsx(FormModal, _extends({}, modalProps, {
|
|
4269
4330
|
modalRender: ({
|
|
4270
4331
|
defaultChildren
|
|
4271
4332
|
}) => {
|
|
4272
|
-
return /*#__PURE__*/
|
|
4333
|
+
return /*#__PURE__*/jsx(FormSteps, _extends({}, Object.assign({}, others, {
|
|
4273
4334
|
items: others.items.map(item => {
|
|
4274
4335
|
return Object.assign({}, item, {
|
|
4275
4336
|
formProps: Object.assign({}, item.formProps, {
|
|
@@ -4287,29 +4348,32 @@ const FormStepsModal = p => {
|
|
|
4287
4348
|
onComplete: async data => {
|
|
4288
4349
|
const res = await (others.onComplete == null ? void 0 : others.onComplete(data));
|
|
4289
4350
|
modalProps.autoClose && res !== false && (modalProps.onCancel == null ? void 0 : modalProps.onCancel());
|
|
4351
|
+
},
|
|
4352
|
+
children: _ref => {
|
|
4353
|
+
let {
|
|
4354
|
+
children: stepChildren
|
|
4355
|
+
} = _ref,
|
|
4356
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded3);
|
|
4357
|
+
return /*#__PURE__*/jsx(Provider, {
|
|
4358
|
+
value: _extends({
|
|
4359
|
+
stepChildren
|
|
4360
|
+
}, props),
|
|
4361
|
+
children: defaultChildren
|
|
4362
|
+
});
|
|
4290
4363
|
}
|
|
4291
|
-
})
|
|
4292
|
-
let {
|
|
4293
|
-
children: stepChildren
|
|
4294
|
-
} = _ref,
|
|
4295
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded3);
|
|
4296
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
4297
|
-
value: _extends({
|
|
4298
|
-
stepChildren
|
|
4299
|
-
}, props)
|
|
4300
|
-
}, defaultChildren);
|
|
4301
|
-
});
|
|
4364
|
+
}));
|
|
4302
4365
|
},
|
|
4303
4366
|
footer: ({
|
|
4304
4367
|
props
|
|
4305
4368
|
}) => {
|
|
4306
|
-
return /*#__PURE__*/
|
|
4369
|
+
return /*#__PURE__*/jsx(StepFormFooter, _extends({}, props, {
|
|
4307
4370
|
completeText: completeText,
|
|
4308
4371
|
nextText: nextText
|
|
4309
4372
|
}));
|
|
4310
|
-
}
|
|
4311
|
-
|
|
4312
|
-
};
|
|
4373
|
+
},
|
|
4374
|
+
children: /*#__PURE__*/jsx(StepChildren, {})
|
|
4375
|
+
}));
|
|
4376
|
+
});
|
|
4313
4377
|
|
|
4314
4378
|
export { Form, FormModal, FormSteps, FormStepsModal, List, MultiField, List as SubList, TableList, FormInfo as default };
|
|
4315
4379
|
//# sourceMappingURL=index.modern.js.map
|