@faasjs/ant-design 0.0.3-beta.5 → 0.0.3-beta.51
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 +199 -271
- package/dist/index.d.ts +270 -200
- package/dist/index.js +488 -283
- package/dist/index.mjs +505 -305
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
useEffect,
|
|
13
13
|
useState
|
|
14
14
|
} from "react";
|
|
15
|
-
import { ConfigProvider as AntdConfigProvider } from "antd";
|
|
16
15
|
import { defaultsDeep } from "lodash-es";
|
|
17
16
|
import { jsx } from "react/jsx-runtime";
|
|
18
17
|
var isZH = /^zh/i.test(navigator.language);
|
|
@@ -68,14 +67,11 @@ function ConfigProvider({
|
|
|
68
67
|
Form: { submit: { text: zh.submit } }
|
|
69
68
|
}, baseConfig));
|
|
70
69
|
} else
|
|
71
|
-
setValues(values);
|
|
70
|
+
setValues(defaultsDeep(config, values));
|
|
72
71
|
}, []);
|
|
73
72
|
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
74
73
|
value: values,
|
|
75
|
-
children
|
|
76
|
-
...config.antd,
|
|
77
|
-
children
|
|
78
|
-
})
|
|
74
|
+
children
|
|
79
75
|
});
|
|
80
76
|
}
|
|
81
77
|
function useConfigContext() {
|
|
@@ -123,7 +119,6 @@ function transferValue(type, value) {
|
|
|
123
119
|
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
124
120
|
import {
|
|
125
121
|
Descriptions,
|
|
126
|
-
Skeleton,
|
|
127
122
|
Space
|
|
128
123
|
} from "antd";
|
|
129
124
|
import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
@@ -132,8 +127,45 @@ import {
|
|
|
132
127
|
useEffect as useEffect2,
|
|
133
128
|
useState as useState2
|
|
134
129
|
} from "react";
|
|
135
|
-
|
|
130
|
+
|
|
131
|
+
// src/FaasDataWrapper.tsx
|
|
132
|
+
import { FaasDataWrapper as Origin } from "@faasjs/react";
|
|
133
|
+
|
|
134
|
+
// src/Loading.tsx
|
|
135
|
+
import { Spin } from "antd";
|
|
136
136
|
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
137
|
+
function Loading(props) {
|
|
138
|
+
if (props.loading === false)
|
|
139
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
140
|
+
children: props.children
|
|
141
|
+
});
|
|
142
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
143
|
+
style: {
|
|
144
|
+
...props.style || {},
|
|
145
|
+
...!props.size || props.size === "large" ? {
|
|
146
|
+
margin: "20vh auto",
|
|
147
|
+
textAlign: "center"
|
|
148
|
+
} : {}
|
|
149
|
+
},
|
|
150
|
+
children: /* @__PURE__ */ jsx3(Spin, {
|
|
151
|
+
size: props.size || "large"
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/FaasDataWrapper.tsx
|
|
157
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
158
|
+
function FaasDataWrapper(props) {
|
|
159
|
+
return /* @__PURE__ */ jsx4(Origin, {
|
|
160
|
+
fallback: props.loading || /* @__PURE__ */ jsx4(Loading, {
|
|
161
|
+
...props.loadingProps
|
|
162
|
+
}),
|
|
163
|
+
...props
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/Description.tsx
|
|
168
|
+
import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
|
|
137
169
|
function DescriptionItemContent(props) {
|
|
138
170
|
var _a;
|
|
139
171
|
const [computedProps, setComputedProps] = useState2();
|
|
@@ -170,69 +202,84 @@ function DescriptionItemContent(props) {
|
|
|
170
202
|
return cloneElement(
|
|
171
203
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
172
204
|
{
|
|
205
|
+
scene: "description",
|
|
173
206
|
value: computedProps.value,
|
|
174
207
|
values: computedProps.values
|
|
175
208
|
}
|
|
176
209
|
);
|
|
177
210
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
|
|
211
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
212
|
+
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
180
213
|
});
|
|
181
214
|
else
|
|
182
215
|
throw Error(computedProps.item.type + " requires children or render");
|
|
216
|
+
if (computedProps.item.descriptionChildren === null)
|
|
217
|
+
return null;
|
|
218
|
+
if (computedProps.item.descriptionChildren)
|
|
219
|
+
return cloneElement(computedProps.item.descriptionChildren, {
|
|
220
|
+
scene: "description",
|
|
221
|
+
value: computedProps.value,
|
|
222
|
+
values: computedProps.values
|
|
223
|
+
});
|
|
224
|
+
if (computedProps.item.children === null)
|
|
225
|
+
return null;
|
|
183
226
|
if (computedProps.item.children)
|
|
184
|
-
return cloneElement(computedProps.item.children, {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
227
|
+
return cloneElement(computedProps.item.children, {
|
|
228
|
+
scene: "description",
|
|
229
|
+
value: computedProps.value,
|
|
230
|
+
values: computedProps.values
|
|
188
231
|
});
|
|
232
|
+
if (computedProps.item.descriptionRender)
|
|
233
|
+
return computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description");
|
|
234
|
+
if (computedProps.item.render)
|
|
235
|
+
return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
|
|
189
236
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
190
|
-
return /* @__PURE__ */
|
|
237
|
+
return /* @__PURE__ */ jsx5(Blank, {});
|
|
191
238
|
switch (computedProps.item.type) {
|
|
192
239
|
case "string[]":
|
|
193
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
194
241
|
children: computedProps.value.join(", ")
|
|
195
242
|
});
|
|
196
243
|
case "number":
|
|
197
244
|
return computedProps.value || null;
|
|
198
245
|
case "number[]":
|
|
199
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
200
247
|
children: computedProps.value.join(", ")
|
|
201
248
|
});
|
|
202
249
|
case "boolean":
|
|
203
|
-
return computedProps.value ? /* @__PURE__ */
|
|
250
|
+
return computedProps.value ? /* @__PURE__ */ jsx5(CheckOutlined, {
|
|
204
251
|
style: {
|
|
205
252
|
marginTop: "4px",
|
|
206
253
|
color: "#52c41a"
|
|
207
254
|
}
|
|
208
|
-
}) : /* @__PURE__ */
|
|
255
|
+
}) : /* @__PURE__ */ jsx5(CloseOutlined, {
|
|
209
256
|
style: {
|
|
210
257
|
marginTop: "4px",
|
|
211
258
|
color: "#ff4d4f"
|
|
212
259
|
}
|
|
213
260
|
});
|
|
214
261
|
case "time":
|
|
215
|
-
return /* @__PURE__ */
|
|
262
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
216
263
|
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
217
264
|
});
|
|
218
265
|
case "date":
|
|
219
|
-
return /* @__PURE__ */
|
|
266
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
220
267
|
children: computedProps.value.format("YYYY-MM-DD")
|
|
221
268
|
});
|
|
222
269
|
case "object":
|
|
223
270
|
if (!computedProps.value)
|
|
224
|
-
return /* @__PURE__ */
|
|
225
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ jsx5(Blank, {});
|
|
272
|
+
return /* @__PURE__ */ jsx5(Description, {
|
|
226
273
|
items: computedProps.item.object,
|
|
227
274
|
dataSource: computedProps.value,
|
|
228
275
|
column: 1
|
|
229
276
|
});
|
|
230
277
|
case "object[]":
|
|
231
278
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
232
|
-
return /* @__PURE__ */
|
|
233
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ jsx5(Blank, {});
|
|
280
|
+
return /* @__PURE__ */ jsx5(Space, {
|
|
234
281
|
direction: "vertical",
|
|
235
|
-
children: computedProps.value.map((value, index) => /* @__PURE__ */
|
|
282
|
+
children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx5(Description, {
|
|
236
283
|
items: computedProps.item.object,
|
|
237
284
|
dataSource: value,
|
|
238
285
|
column: 1
|
|
@@ -243,14 +290,14 @@ function DescriptionItemContent(props) {
|
|
|
243
290
|
}
|
|
244
291
|
}
|
|
245
292
|
function Description(props) {
|
|
246
|
-
if (
|
|
247
|
-
return /* @__PURE__ */
|
|
293
|
+
if (props.dataSource)
|
|
294
|
+
return /* @__PURE__ */ jsx5(Descriptions, {
|
|
248
295
|
...props,
|
|
249
296
|
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
250
297
|
children: props.items.map((item) => {
|
|
251
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */
|
|
298
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx5(Descriptions.Item, {
|
|
252
299
|
label: item.title || upperFirst2(item.id),
|
|
253
|
-
children: /* @__PURE__ */
|
|
300
|
+
children: /* @__PURE__ */ jsx5(DescriptionItemContent, {
|
|
254
301
|
item,
|
|
255
302
|
value: props.dataSource[item.id],
|
|
256
303
|
values: props.dataSource,
|
|
@@ -259,18 +306,15 @@ function Description(props) {
|
|
|
259
306
|
}, item.id) : null;
|
|
260
307
|
}).filter(Boolean)
|
|
261
308
|
});
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ jsx3(Skeleton, {
|
|
264
|
-
active: true
|
|
265
|
-
}),
|
|
309
|
+
return /* @__PURE__ */ jsx5(FaasDataWrapper, {
|
|
266
310
|
render: ({ data }) => {
|
|
267
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ jsx5(Descriptions, {
|
|
268
312
|
...props,
|
|
269
313
|
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
270
314
|
children: props.items.map((item) => {
|
|
271
|
-
return !item.if || item.if(data) ? /* @__PURE__ */
|
|
315
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ jsx5(Descriptions.Item, {
|
|
272
316
|
label: item.title || upperFirst2(item.id),
|
|
273
|
-
children: /* @__PURE__ */
|
|
317
|
+
children: /* @__PURE__ */ jsx5(DescriptionItemContent, {
|
|
274
318
|
item,
|
|
275
319
|
value: data[item.id],
|
|
276
320
|
values: data,
|
|
@@ -287,7 +331,7 @@ function Description(props) {
|
|
|
287
331
|
// src/Drawer.tsx
|
|
288
332
|
import { Drawer } from "antd";
|
|
289
333
|
import { useState as useState3 } from "react";
|
|
290
|
-
import { jsx as
|
|
334
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
291
335
|
function useDrawer(init) {
|
|
292
336
|
const [props, setProps] = useState3({
|
|
293
337
|
open: false,
|
|
@@ -298,7 +342,7 @@ function useDrawer(init) {
|
|
|
298
342
|
...init
|
|
299
343
|
});
|
|
300
344
|
return {
|
|
301
|
-
drawer: /* @__PURE__ */
|
|
345
|
+
drawer: /* @__PURE__ */ jsx6(Drawer, {
|
|
302
346
|
...props
|
|
303
347
|
}),
|
|
304
348
|
drawerProps: props,
|
|
@@ -311,6 +355,53 @@ function useDrawer(init) {
|
|
|
311
355
|
};
|
|
312
356
|
}
|
|
313
357
|
|
|
358
|
+
// src/ErrorBoundary.tsx
|
|
359
|
+
import { Component } from "react";
|
|
360
|
+
import { Alert } from "antd";
|
|
361
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
362
|
+
var ErrorBoundary = class extends Component {
|
|
363
|
+
constructor(props) {
|
|
364
|
+
super(props);
|
|
365
|
+
this.state = {
|
|
366
|
+
error: void 0,
|
|
367
|
+
info: { componentStack: "" }
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
componentDidCatch(error, info) {
|
|
371
|
+
this.setState({
|
|
372
|
+
error,
|
|
373
|
+
info
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
render() {
|
|
377
|
+
const {
|
|
378
|
+
message,
|
|
379
|
+
description,
|
|
380
|
+
children
|
|
381
|
+
} = this.props;
|
|
382
|
+
const { error, info } = this.state;
|
|
383
|
+
const componentStack = info && info.componentStack ? info.componentStack : null;
|
|
384
|
+
const errorMessage = typeof message === "undefined" ? (error || "").toString() : message;
|
|
385
|
+
const errorDescription = typeof description === "undefined" ? componentStack : description;
|
|
386
|
+
if (error) {
|
|
387
|
+
if (this.props.onError)
|
|
388
|
+
return this.props.onError(error, info);
|
|
389
|
+
return /* @__PURE__ */ jsx7(Alert, {
|
|
390
|
+
type: "error",
|
|
391
|
+
message: errorMessage,
|
|
392
|
+
description: /* @__PURE__ */ jsx7("pre", {
|
|
393
|
+
style: {
|
|
394
|
+
fontSize: "0.9em",
|
|
395
|
+
overflowX: "auto"
|
|
396
|
+
},
|
|
397
|
+
children: errorDescription
|
|
398
|
+
})
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return children;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
314
405
|
// src/Form.tsx
|
|
315
406
|
import { faas } from "@faasjs/react";
|
|
316
407
|
import {
|
|
@@ -339,11 +430,12 @@ import {
|
|
|
339
430
|
} from "antd";
|
|
340
431
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
341
432
|
import {
|
|
433
|
+
cloneElement as cloneElement2,
|
|
342
434
|
useEffect as useEffect3,
|
|
343
435
|
useState as useState4
|
|
344
436
|
} from "react";
|
|
345
437
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
346
|
-
import { Fragment as
|
|
438
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
347
439
|
function processProps(propsCopy, config) {
|
|
348
440
|
if (!propsCopy.title)
|
|
349
441
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -404,98 +496,116 @@ function FormItem(props) {
|
|
|
404
496
|
}
|
|
405
497
|
if (propsCopy.if) {
|
|
406
498
|
const condition = propsCopy.if;
|
|
407
|
-
propsCopy.shouldUpdate
|
|
499
|
+
const originShouldUpdate = propsCopy.shouldUpdate;
|
|
500
|
+
propsCopy.shouldUpdate = (prev, cur) => {
|
|
408
501
|
const show = condition(cur);
|
|
502
|
+
const shouldUpdate = hidden !== show;
|
|
409
503
|
setHidden(!show);
|
|
410
|
-
|
|
504
|
+
const origin = originShouldUpdate ? typeof originShouldUpdate === "boolean" ? originShouldUpdate : originShouldUpdate(prev, cur, {}) : true;
|
|
505
|
+
return shouldUpdate || origin;
|
|
411
506
|
};
|
|
412
507
|
delete propsCopy.if;
|
|
508
|
+
delete propsCopy.hidden;
|
|
413
509
|
}
|
|
414
510
|
setComputedProps(processProps(propsCopy, common2));
|
|
415
511
|
}, [props]);
|
|
416
512
|
if (!computedProps)
|
|
417
513
|
return null;
|
|
418
514
|
if (hidden)
|
|
419
|
-
return /* @__PURE__ */
|
|
515
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
420
516
|
...computedProps,
|
|
421
517
|
noStyle: true,
|
|
422
518
|
rules: [],
|
|
423
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
424
520
|
hidden: true
|
|
425
521
|
})
|
|
426
522
|
});
|
|
427
523
|
if (extendTypes && extendTypes[computedProps.type])
|
|
428
|
-
return /* @__PURE__ */
|
|
524
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
429
525
|
...computedProps,
|
|
430
526
|
children: extendTypes[computedProps.type].children
|
|
431
527
|
});
|
|
528
|
+
if (computedProps.formChildren === null)
|
|
529
|
+
return null;
|
|
530
|
+
if (computedProps.formChildren)
|
|
531
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
532
|
+
...computedProps,
|
|
533
|
+
children: cloneElement2(computedProps.formChildren, { scene: "form" })
|
|
534
|
+
});
|
|
535
|
+
if (computedProps.children === null)
|
|
536
|
+
return null;
|
|
432
537
|
if (computedProps.children)
|
|
433
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
539
|
+
...computedProps,
|
|
540
|
+
children: cloneElement2(computedProps.children, { scene: "form" })
|
|
541
|
+
});
|
|
542
|
+
if (computedProps.formRender)
|
|
543
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
434
544
|
...computedProps,
|
|
435
|
-
children: computedProps.
|
|
545
|
+
children: computedProps.formRender(null, null, 0, "form")
|
|
436
546
|
});
|
|
437
547
|
if (computedProps.render)
|
|
438
|
-
return /* @__PURE__ */
|
|
548
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
439
549
|
...computedProps,
|
|
440
|
-
children: computedProps.render()
|
|
550
|
+
children: computedProps.render(null, null, 0, "form")
|
|
441
551
|
});
|
|
442
552
|
switch (computedProps.type) {
|
|
443
553
|
case "string":
|
|
444
|
-
return /* @__PURE__ */
|
|
554
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
445
555
|
...computedProps,
|
|
446
|
-
children: computedProps.options ? /* @__PURE__ */
|
|
556
|
+
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
447
557
|
...computedProps.input
|
|
448
|
-
}) : /* @__PURE__ */
|
|
558
|
+
}) : /* @__PURE__ */ jsx8(Input, {
|
|
449
559
|
...computedProps.input
|
|
450
560
|
})
|
|
451
561
|
});
|
|
452
562
|
case "string[]":
|
|
453
563
|
if (computedProps.options)
|
|
454
|
-
return /* @__PURE__ */
|
|
564
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
455
565
|
...computedProps,
|
|
456
|
-
children: /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ jsx8(Select, {
|
|
457
567
|
mode: "multiple",
|
|
458
568
|
...computedProps.input
|
|
459
569
|
})
|
|
460
570
|
});
|
|
461
|
-
return /* @__PURE__ */
|
|
571
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
462
572
|
name: computedProps.name,
|
|
463
573
|
rules: computedProps.rules,
|
|
464
574
|
children: (fields, { add, remove }, { errors }) => {
|
|
465
575
|
var _a2;
|
|
466
|
-
return /* @__PURE__ */ jsxs(
|
|
576
|
+
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
467
577
|
children: [
|
|
468
|
-
computedProps.label && /* @__PURE__ */
|
|
578
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
469
579
|
className: "ant-form-item-label",
|
|
470
|
-
children: /* @__PURE__ */
|
|
580
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
471
581
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
472
582
|
children: computedProps.label
|
|
473
583
|
})
|
|
474
584
|
}),
|
|
475
585
|
fields.map((field) => {
|
|
476
586
|
var _a3;
|
|
477
|
-
return /* @__PURE__ */
|
|
587
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
478
588
|
children: /* @__PURE__ */ jsxs(Row, {
|
|
479
589
|
gutter: 24,
|
|
480
590
|
style: { flexFlow: "row nowrap" },
|
|
481
591
|
children: [
|
|
482
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
483
593
|
span: 23,
|
|
484
|
-
children: /* @__PURE__ */
|
|
594
|
+
children: /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
485
595
|
...field,
|
|
486
596
|
noStyle: true,
|
|
487
|
-
children: /* @__PURE__ */
|
|
597
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
488
598
|
...computedProps.input
|
|
489
599
|
})
|
|
490
600
|
})
|
|
491
601
|
}),
|
|
492
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
493
603
|
span: 1,
|
|
494
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
604
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
495
605
|
danger: true,
|
|
496
606
|
type: "link",
|
|
497
607
|
style: { float: "right" },
|
|
498
|
-
icon: /* @__PURE__ */
|
|
608
|
+
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
499
609
|
onClick: () => remove(field.name)
|
|
500
610
|
})
|
|
501
611
|
})
|
|
@@ -505,13 +615,17 @@ function FormItem(props) {
|
|
|
505
615
|
}),
|
|
506
616
|
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
507
617
|
children: [
|
|
508
|
-
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
618
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
|
|
509
619
|
type: "dashed",
|
|
510
620
|
block: true,
|
|
511
621
|
onClick: () => add(),
|
|
512
|
-
icon: /* @__PURE__ */
|
|
622
|
+
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
623
|
+
}),
|
|
624
|
+
computedProps.extra && /* @__PURE__ */ jsx8("div", {
|
|
625
|
+
className: "ant-form-item-extra",
|
|
626
|
+
children: computedProps.extra
|
|
513
627
|
}),
|
|
514
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
515
629
|
errors
|
|
516
630
|
})
|
|
517
631
|
]
|
|
@@ -521,63 +635,63 @@ function FormItem(props) {
|
|
|
521
635
|
}
|
|
522
636
|
});
|
|
523
637
|
case "number":
|
|
524
|
-
return /* @__PURE__ */
|
|
638
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
525
639
|
...computedProps,
|
|
526
|
-
children: computedProps.options ? /* @__PURE__ */
|
|
640
|
+
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
527
641
|
...computedProps.input
|
|
528
|
-
}) : /* @__PURE__ */
|
|
642
|
+
}) : /* @__PURE__ */ jsx8(InputNumber, {
|
|
529
643
|
style: { width: "100%" },
|
|
530
644
|
...computedProps.input
|
|
531
645
|
})
|
|
532
646
|
});
|
|
533
647
|
case "number[]":
|
|
534
648
|
if (computedProps.options)
|
|
535
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
536
650
|
...computedProps,
|
|
537
|
-
children: /* @__PURE__ */
|
|
651
|
+
children: /* @__PURE__ */ jsx8(Select, {
|
|
538
652
|
mode: "multiple",
|
|
539
653
|
...computedProps.input
|
|
540
654
|
})
|
|
541
655
|
});
|
|
542
|
-
return /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
543
657
|
name: computedProps.name,
|
|
544
658
|
rules: computedProps.rules,
|
|
545
659
|
children: (fields, { add, remove }, { errors }) => {
|
|
546
660
|
var _a2, _b;
|
|
547
|
-
return /* @__PURE__ */ jsxs(
|
|
661
|
+
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
548
662
|
children: [
|
|
549
|
-
computedProps.label && /* @__PURE__ */
|
|
663
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
550
664
|
className: "ant-form-item-label",
|
|
551
|
-
children: /* @__PURE__ */
|
|
665
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
552
666
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
553
667
|
children: computedProps.label
|
|
554
668
|
})
|
|
555
669
|
}),
|
|
556
670
|
fields.map((field) => {
|
|
557
671
|
var _a3;
|
|
558
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
559
673
|
children: /* @__PURE__ */ jsxs(Row, {
|
|
560
674
|
gutter: 24,
|
|
561
675
|
style: { flexFlow: "row nowrap" },
|
|
562
676
|
children: [
|
|
563
|
-
/* @__PURE__ */
|
|
677
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
564
678
|
span: 23,
|
|
565
|
-
children: /* @__PURE__ */
|
|
679
|
+
children: /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
566
680
|
...field,
|
|
567
681
|
noStyle: true,
|
|
568
|
-
children: /* @__PURE__ */
|
|
682
|
+
children: /* @__PURE__ */ jsx8(InputNumber, {
|
|
569
683
|
style: { width: "100%" },
|
|
570
684
|
...computedProps.input
|
|
571
685
|
})
|
|
572
686
|
})
|
|
573
687
|
}),
|
|
574
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
575
689
|
span: 1,
|
|
576
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
690
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
577
691
|
danger: true,
|
|
578
692
|
type: "link",
|
|
579
693
|
style: { float: "right" },
|
|
580
|
-
icon: /* @__PURE__ */
|
|
694
|
+
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
581
695
|
onClick: () => remove(field.name)
|
|
582
696
|
})
|
|
583
697
|
})
|
|
@@ -587,13 +701,17 @@ function FormItem(props) {
|
|
|
587
701
|
}),
|
|
588
702
|
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
589
703
|
children: [
|
|
590
|
-
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
704
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
|
|
591
705
|
type: "dashed",
|
|
592
706
|
block: true,
|
|
593
707
|
onClick: () => add(),
|
|
594
|
-
icon: /* @__PURE__ */
|
|
708
|
+
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
595
709
|
}),
|
|
596
|
-
/* @__PURE__ */
|
|
710
|
+
computedProps.extra && /* @__PURE__ */ jsx8("div", {
|
|
711
|
+
className: "ant-form-item-extra",
|
|
712
|
+
children: computedProps.extra
|
|
713
|
+
}),
|
|
714
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
597
715
|
errors
|
|
598
716
|
})
|
|
599
717
|
]
|
|
@@ -603,58 +721,58 @@ function FormItem(props) {
|
|
|
603
721
|
}
|
|
604
722
|
});
|
|
605
723
|
case "boolean":
|
|
606
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
607
725
|
...computedProps,
|
|
608
|
-
children: /* @__PURE__ */
|
|
726
|
+
children: /* @__PURE__ */ jsx8(Switch, {
|
|
609
727
|
...computedProps.input
|
|
610
728
|
})
|
|
611
729
|
});
|
|
612
730
|
case "date":
|
|
613
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
614
732
|
...computedProps,
|
|
615
|
-
children: /* @__PURE__ */
|
|
733
|
+
children: /* @__PURE__ */ jsx8(DatePicker, {
|
|
616
734
|
...computedProps.input
|
|
617
735
|
})
|
|
618
736
|
});
|
|
619
737
|
case "time":
|
|
620
|
-
return /* @__PURE__ */
|
|
738
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
621
739
|
...computedProps,
|
|
622
|
-
children: /* @__PURE__ */
|
|
740
|
+
children: /* @__PURE__ */ jsx8(TimePicker, {
|
|
623
741
|
...computedProps.input
|
|
624
742
|
})
|
|
625
743
|
});
|
|
626
744
|
case "object":
|
|
627
|
-
return /* @__PURE__ */ jsxs(
|
|
745
|
+
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
628
746
|
children: [
|
|
629
|
-
computedProps.label && /* @__PURE__ */
|
|
747
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
630
748
|
className: "ant-form-item-label",
|
|
631
|
-
children: /* @__PURE__ */
|
|
749
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
632
750
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
633
751
|
children: computedProps.label
|
|
634
752
|
})
|
|
635
753
|
}),
|
|
636
|
-
computedProps.object.map((o) => /* @__PURE__ */
|
|
754
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx8(FormItem, {
|
|
637
755
|
...o
|
|
638
756
|
}, o.id))
|
|
639
757
|
]
|
|
640
758
|
});
|
|
641
759
|
case "object[]":
|
|
642
|
-
return /* @__PURE__ */
|
|
760
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
643
761
|
name: computedProps.name,
|
|
644
762
|
rules: computedProps.rules,
|
|
645
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(
|
|
763
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment3, {
|
|
646
764
|
children: [
|
|
647
765
|
fields.map((field) => /* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
648
766
|
style: { marginBottom: 0 },
|
|
649
767
|
children: [
|
|
650
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ jsx8("div", {
|
|
651
769
|
className: "ant-form-item-label",
|
|
652
770
|
children: /* @__PURE__ */ jsxs("label", {
|
|
653
771
|
children: [
|
|
654
772
|
computedProps.label,
|
|
655
773
|
" ",
|
|
656
774
|
field.name + 1,
|
|
657
|
-
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
775
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
658
776
|
danger: true,
|
|
659
777
|
type: "link",
|
|
660
778
|
onClick: () => remove(field.name),
|
|
@@ -663,11 +781,11 @@ function FormItem(props) {
|
|
|
663
781
|
]
|
|
664
782
|
})
|
|
665
783
|
}),
|
|
666
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsx8(Row, {
|
|
667
785
|
gutter: 24,
|
|
668
|
-
children: computedProps.object.map((o) => /* @__PURE__ */
|
|
786
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ jsx8(Col, {
|
|
669
787
|
span: o.col || 24,
|
|
670
|
-
children: /* @__PURE__ */
|
|
788
|
+
children: /* @__PURE__ */ jsx8(FormItem, {
|
|
671
789
|
...o,
|
|
672
790
|
name: [field.name, o.id]
|
|
673
791
|
})
|
|
@@ -681,14 +799,18 @@ function FormItem(props) {
|
|
|
681
799
|
type: "dashed",
|
|
682
800
|
block: true,
|
|
683
801
|
onClick: () => add(),
|
|
684
|
-
icon: /* @__PURE__ */
|
|
802
|
+
icon: /* @__PURE__ */ jsx8(PlusOutlined, {}),
|
|
685
803
|
children: [
|
|
686
804
|
common2.add,
|
|
687
805
|
" ",
|
|
688
806
|
computedProps.label
|
|
689
807
|
]
|
|
690
808
|
}),
|
|
691
|
-
/* @__PURE__ */
|
|
809
|
+
computedProps.extra && /* @__PURE__ */ jsx8("div", {
|
|
810
|
+
className: "ant-form-item-extra",
|
|
811
|
+
children: computedProps.extra
|
|
812
|
+
}),
|
|
813
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
692
814
|
errors
|
|
693
815
|
})
|
|
694
816
|
]
|
|
@@ -700,9 +822,10 @@ function FormItem(props) {
|
|
|
700
822
|
return null;
|
|
701
823
|
}
|
|
702
824
|
}
|
|
825
|
+
FormItem.useStatus = AntdForm.Item.useStatus;
|
|
703
826
|
|
|
704
827
|
// src/Form.tsx
|
|
705
|
-
import { jsx as
|
|
828
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
706
829
|
function Form(props) {
|
|
707
830
|
var _a, _b;
|
|
708
831
|
const [loading, setLoading] = useState5(false);
|
|
@@ -712,15 +835,15 @@ function Form(props) {
|
|
|
712
835
|
const [form] = AntdForm2.useForm(props.form);
|
|
713
836
|
const [initialValues, setInitialValues] = useState5(props.initialValues);
|
|
714
837
|
useEffect4(() => {
|
|
715
|
-
var _a2, _b2;
|
|
838
|
+
var _a2, _b2, _c;
|
|
716
839
|
const propsCopy = {
|
|
717
840
|
...props,
|
|
718
841
|
form
|
|
719
842
|
};
|
|
720
|
-
if (propsCopy.initialValues) {
|
|
843
|
+
if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
|
|
721
844
|
for (const key in propsCopy.initialValues) {
|
|
722
845
|
propsCopy.initialValues[key] = transferValue(
|
|
723
|
-
(
|
|
846
|
+
(_b2 = propsCopy.items.find((item2) => item2.id === key)) == null ? void 0 : _b2.type,
|
|
724
847
|
propsCopy.initialValues[key]
|
|
725
848
|
);
|
|
726
849
|
const item = propsCopy.items.find((item2) => item2.id === key);
|
|
@@ -751,13 +874,25 @@ function Form(props) {
|
|
|
751
874
|
}
|
|
752
875
|
setLoading(false);
|
|
753
876
|
};
|
|
754
|
-
} else if (propsCopy.submit && ((
|
|
877
|
+
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
755
878
|
propsCopy.onFinish = async (values) => {
|
|
756
879
|
setLoading(true);
|
|
757
880
|
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
758
881
|
...values,
|
|
759
882
|
...propsCopy.submit.to.params
|
|
760
|
-
} : values).
|
|
883
|
+
} : values).then((result) => {
|
|
884
|
+
if (propsCopy.submit.to.then)
|
|
885
|
+
propsCopy.submit.to.then(result);
|
|
886
|
+
return result;
|
|
887
|
+
}).catch((error) => {
|
|
888
|
+
if (propsCopy.submit.to.catch)
|
|
889
|
+
propsCopy.submit.to.catch(error);
|
|
890
|
+
return Promise.reject(error);
|
|
891
|
+
}).finally(() => {
|
|
892
|
+
if (propsCopy.submit.to.finally)
|
|
893
|
+
propsCopy.submit.to.finally();
|
|
894
|
+
setLoading(false);
|
|
895
|
+
});
|
|
761
896
|
};
|
|
762
897
|
}
|
|
763
898
|
if (propsCopy.extendTypes) {
|
|
@@ -793,12 +928,12 @@ function Form(props) {
|
|
|
793
928
|
onValuesChange,
|
|
794
929
|
children: [
|
|
795
930
|
computedProps.beforeItems,
|
|
796
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */
|
|
931
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx9(FormItem, {
|
|
797
932
|
...item,
|
|
798
933
|
extendTypes
|
|
799
934
|
}, item.id)),
|
|
800
935
|
computedProps.children,
|
|
801
|
-
computedProps.submit !== false && /* @__PURE__ */
|
|
936
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx9(Button2, {
|
|
802
937
|
htmlType: "submit",
|
|
803
938
|
type: "primary",
|
|
804
939
|
loading,
|
|
@@ -809,73 +944,68 @@ function Form(props) {
|
|
|
809
944
|
});
|
|
810
945
|
}
|
|
811
946
|
Form.useForm = AntdForm2.useForm;
|
|
947
|
+
Form.useFormInstance = AntdForm2.useFormInstance;
|
|
948
|
+
Form.useWatch = AntdForm2.useWatch;
|
|
949
|
+
Form.Item = FormItem;
|
|
950
|
+
Form.List = AntdForm2.List;
|
|
951
|
+
Form.ErrorList = AntdForm2.ErrorList;
|
|
952
|
+
Form.Provider = AntdForm2.Provider;
|
|
812
953
|
|
|
813
954
|
// src/Link.tsx
|
|
814
955
|
import { Link as RouterLink } from "react-router-dom";
|
|
815
956
|
import { Button as Button3 } from "antd";
|
|
816
|
-
import { jsx as
|
|
817
|
-
function Link({
|
|
818
|
-
|
|
819
|
-
target,
|
|
820
|
-
text,
|
|
821
|
-
children,
|
|
822
|
-
style,
|
|
823
|
-
button
|
|
824
|
-
}) {
|
|
957
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
958
|
+
function Link(props) {
|
|
959
|
+
var _a, _b, _c, _d;
|
|
825
960
|
const { Link: Link2 } = useConfigContext();
|
|
826
|
-
style =
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
961
|
+
let style = {
|
|
962
|
+
...Link2.style || {},
|
|
963
|
+
cursor: "pointer",
|
|
964
|
+
...props.style
|
|
965
|
+
};
|
|
966
|
+
if (props.block)
|
|
967
|
+
style = Object.assign({
|
|
968
|
+
display: "block",
|
|
969
|
+
width: "100%"
|
|
970
|
+
}, style);
|
|
971
|
+
if (props.href.startsWith("http")) {
|
|
972
|
+
if (props.button)
|
|
973
|
+
return /* @__PURE__ */ jsx10(Button3, {
|
|
974
|
+
...props.button,
|
|
975
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
976
|
+
style,
|
|
977
|
+
href: props.href,
|
|
978
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
840
979
|
});
|
|
841
|
-
return /* @__PURE__ */
|
|
842
|
-
href,
|
|
843
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
844
|
-
style
|
|
845
|
-
|
|
846
|
-
...style || {}
|
|
847
|
-
},
|
|
848
|
-
children: text || children
|
|
980
|
+
return /* @__PURE__ */ jsx10("a", {
|
|
981
|
+
href: props.href,
|
|
982
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
983
|
+
style,
|
|
984
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
849
985
|
});
|
|
850
986
|
}
|
|
851
|
-
if (button)
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
style
|
|
858
|
-
|
|
859
|
-
...style || {}
|
|
860
|
-
},
|
|
861
|
-
children: text || children
|
|
987
|
+
if (props.button)
|
|
988
|
+
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
989
|
+
to: props.href,
|
|
990
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
991
|
+
children: /* @__PURE__ */ jsx10(Button3, {
|
|
992
|
+
...props.button,
|
|
993
|
+
style,
|
|
994
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
862
995
|
})
|
|
863
996
|
});
|
|
864
|
-
return /* @__PURE__ */
|
|
865
|
-
to: href,
|
|
866
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
867
|
-
style
|
|
868
|
-
|
|
869
|
-
...style || {}
|
|
870
|
-
},
|
|
871
|
-
children: text || children
|
|
997
|
+
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
998
|
+
to: props.href,
|
|
999
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1000
|
+
style,
|
|
1001
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
872
1002
|
});
|
|
873
1003
|
}
|
|
874
1004
|
|
|
875
1005
|
// src/Modal.tsx
|
|
876
1006
|
import { Modal } from "antd";
|
|
877
1007
|
import { useState as useState6 } from "react";
|
|
878
|
-
import { jsx as
|
|
1008
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
879
1009
|
function useModal(init) {
|
|
880
1010
|
const [props, setProps] = useState6({
|
|
881
1011
|
open: false,
|
|
@@ -886,7 +1016,7 @@ function useModal(init) {
|
|
|
886
1016
|
...init
|
|
887
1017
|
});
|
|
888
1018
|
return {
|
|
889
|
-
modal: /* @__PURE__ */
|
|
1019
|
+
modal: /* @__PURE__ */ jsx11(Modal, {
|
|
890
1020
|
...props
|
|
891
1021
|
}),
|
|
892
1022
|
modalProps: props,
|
|
@@ -900,7 +1030,7 @@ function useModal(init) {
|
|
|
900
1030
|
}
|
|
901
1031
|
|
|
902
1032
|
// src/Routers.tsx
|
|
903
|
-
import { Result, Skeleton
|
|
1033
|
+
import { Result, Skeleton } from "antd";
|
|
904
1034
|
import {
|
|
905
1035
|
Suspense
|
|
906
1036
|
} from "react";
|
|
@@ -908,10 +1038,10 @@ import {
|
|
|
908
1038
|
Routes as OriginRoutes,
|
|
909
1039
|
Route
|
|
910
1040
|
} from "react-router-dom";
|
|
911
|
-
import { jsx as
|
|
1041
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
912
1042
|
function PageNotFound() {
|
|
913
1043
|
const config = useConfigContext();
|
|
914
|
-
return /* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ jsx12(Result, {
|
|
915
1045
|
status: "404",
|
|
916
1046
|
title: config.common.pageNotFound
|
|
917
1047
|
});
|
|
@@ -919,21 +1049,21 @@ function PageNotFound() {
|
|
|
919
1049
|
function Routes(props) {
|
|
920
1050
|
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
921
1051
|
children: [
|
|
922
|
-
props.routes.map((r) => /* @__PURE__ */
|
|
1052
|
+
props.routes.map((r) => /* @__PURE__ */ jsx12(Route, {
|
|
923
1053
|
...r,
|
|
924
|
-
element: r.element || /* @__PURE__ */
|
|
925
|
-
fallback: props.fallback || /* @__PURE__ */
|
|
1054
|
+
element: r.element || /* @__PURE__ */ jsx12(Suspense, {
|
|
1055
|
+
fallback: props.fallback || /* @__PURE__ */ jsx12("div", {
|
|
926
1056
|
style: { padding: "24px" },
|
|
927
|
-
children: /* @__PURE__ */
|
|
1057
|
+
children: /* @__PURE__ */ jsx12(Skeleton, {
|
|
928
1058
|
active: true
|
|
929
1059
|
})
|
|
930
1060
|
}),
|
|
931
|
-
children: /* @__PURE__ */
|
|
1061
|
+
children: /* @__PURE__ */ jsx12(r.page, {})
|
|
932
1062
|
})
|
|
933
1063
|
}, r.path)),
|
|
934
|
-
/* @__PURE__ */
|
|
1064
|
+
/* @__PURE__ */ jsx12(Route, {
|
|
935
1065
|
path: "*",
|
|
936
|
-
element: props.notFound || /* @__PURE__ */
|
|
1066
|
+
element: props.notFound || /* @__PURE__ */ jsx12(PageNotFound, {})
|
|
937
1067
|
}, "*")
|
|
938
1068
|
]
|
|
939
1069
|
});
|
|
@@ -943,14 +1073,12 @@ function Routes(props) {
|
|
|
943
1073
|
import {
|
|
944
1074
|
useState as useState7,
|
|
945
1075
|
useEffect as useEffect5,
|
|
946
|
-
cloneElement as
|
|
1076
|
+
cloneElement as cloneElement3
|
|
947
1077
|
} from "react";
|
|
948
1078
|
import {
|
|
949
1079
|
Table as AntdTable,
|
|
950
1080
|
Radio,
|
|
951
|
-
|
|
952
|
-
Input as Input2,
|
|
953
|
-
ConfigProvider as ConfigProvider2
|
|
1081
|
+
Input as Input2
|
|
954
1082
|
} from "antd";
|
|
955
1083
|
import dayjs2 from "dayjs";
|
|
956
1084
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
@@ -959,13 +1087,12 @@ import {
|
|
|
959
1087
|
uniqBy,
|
|
960
1088
|
upperFirst as upperFirst4
|
|
961
1089
|
} from "lodash-es";
|
|
962
|
-
import {
|
|
963
|
-
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1090
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
964
1091
|
function processValue(item, value) {
|
|
965
1092
|
var _a;
|
|
966
1093
|
const transferred = transferValue(item.type, value);
|
|
967
1094
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
968
|
-
return /* @__PURE__ */
|
|
1095
|
+
return /* @__PURE__ */ jsx13(Blank, {});
|
|
969
1096
|
if (item.options) {
|
|
970
1097
|
if (item.type.endsWith("[]"))
|
|
971
1098
|
return transferred.map((v) => {
|
|
@@ -987,7 +1114,7 @@ function processValue(item, value) {
|
|
|
987
1114
|
}
|
|
988
1115
|
function Table(props) {
|
|
989
1116
|
const [columns, setColumns] = useState7();
|
|
990
|
-
const { common: common2
|
|
1117
|
+
const { common: common2 } = useConfigContext();
|
|
991
1118
|
useEffect5(() => {
|
|
992
1119
|
var _a;
|
|
993
1120
|
for (const item of props.items) {
|
|
@@ -1004,15 +1131,39 @@ function Table(props) {
|
|
|
1004
1131
|
item.filters = item.options.map((o) => ({
|
|
1005
1132
|
text: o.label,
|
|
1006
1133
|
value: o.value
|
|
1007
|
-
}))
|
|
1134
|
+
})).concat({
|
|
1135
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1136
|
+
value: null
|
|
1137
|
+
});
|
|
1008
1138
|
}
|
|
1009
|
-
if (item.
|
|
1010
|
-
|
|
1139
|
+
if (item.tableChildren === null)
|
|
1140
|
+
item.render = () => null;
|
|
1141
|
+
else if (item.tableChildren)
|
|
1142
|
+
item.render = (value, values) => cloneElement3(
|
|
1143
|
+
item.tableChildren,
|
|
1144
|
+
{
|
|
1145
|
+
scene: "table",
|
|
1146
|
+
value,
|
|
1147
|
+
values
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
else if (item.children === null)
|
|
1151
|
+
item.render = () => null;
|
|
1152
|
+
else if (item.children)
|
|
1153
|
+
item.render = (value, values) => cloneElement3(
|
|
1154
|
+
item.children,
|
|
1155
|
+
{
|
|
1156
|
+
scene: "table",
|
|
1157
|
+
value,
|
|
1158
|
+
values
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1011
1161
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1012
1162
|
if (props.extendTypes[item.type].children)
|
|
1013
|
-
item.render = (value, values) =>
|
|
1163
|
+
item.render = (value, values) => cloneElement3(
|
|
1014
1164
|
props.extendTypes[item.type].children,
|
|
1015
1165
|
{
|
|
1166
|
+
scene: "table",
|
|
1016
1167
|
value,
|
|
1017
1168
|
values
|
|
1018
1169
|
}
|
|
@@ -1040,7 +1191,7 @@ function Table(props) {
|
|
|
1040
1191
|
setSelectedKeys,
|
|
1041
1192
|
confirm,
|
|
1042
1193
|
clearFilters
|
|
1043
|
-
}) => /* @__PURE__ */
|
|
1194
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1044
1195
|
placeholder: `${common2.search} ${item.title}`,
|
|
1045
1196
|
allowClear: true,
|
|
1046
1197
|
onSearch: (v) => {
|
|
@@ -1070,7 +1221,7 @@ function Table(props) {
|
|
|
1070
1221
|
setSelectedKeys,
|
|
1071
1222
|
confirm,
|
|
1072
1223
|
clearFilters
|
|
1073
|
-
}) => /* @__PURE__ */
|
|
1224
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1074
1225
|
placeholder: `${common2.search} ${item.title}`,
|
|
1075
1226
|
allowClear: true,
|
|
1076
1227
|
onSearch: (v) => {
|
|
@@ -1093,14 +1244,14 @@ function Table(props) {
|
|
|
1093
1244
|
item.onFilter = (value, row) => {
|
|
1094
1245
|
if (value === null && isNil2(row[item.id]))
|
|
1095
1246
|
return true;
|
|
1096
|
-
return value
|
|
1247
|
+
return value == row[item.id];
|
|
1097
1248
|
};
|
|
1098
1249
|
if (!item.filters && item.filterDropdown !== false)
|
|
1099
1250
|
item.filterDropdown = ({
|
|
1100
1251
|
setSelectedKeys,
|
|
1101
1252
|
confirm,
|
|
1102
1253
|
clearFilters
|
|
1103
|
-
}) => /* @__PURE__ */
|
|
1254
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1104
1255
|
placeholder: `${common2.search} ${item.title}`,
|
|
1105
1256
|
allowClear: true,
|
|
1106
1257
|
onSearch: (v) => {
|
|
@@ -1123,14 +1274,14 @@ function Table(props) {
|
|
|
1123
1274
|
return true;
|
|
1124
1275
|
if (!row[item.id] || !row[item.id].length)
|
|
1125
1276
|
return false;
|
|
1126
|
-
return row[item.id].includes(value);
|
|
1277
|
+
return row[item.id].includes(Number(value));
|
|
1127
1278
|
};
|
|
1128
1279
|
if (!item.filters && item.filterDropdown !== false)
|
|
1129
1280
|
item.filterDropdown = ({
|
|
1130
1281
|
setSelectedKeys,
|
|
1131
1282
|
confirm,
|
|
1132
1283
|
clearFilters
|
|
1133
|
-
}) => /* @__PURE__ */
|
|
1284
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1134
1285
|
placeholder: `${common2.search} ${item.title}`,
|
|
1135
1286
|
allowClear: true,
|
|
1136
1287
|
onSearch: (v) => {
|
|
@@ -1146,12 +1297,12 @@ function Table(props) {
|
|
|
1146
1297
|
break;
|
|
1147
1298
|
case "boolean":
|
|
1148
1299
|
if (!item.render)
|
|
1149
|
-
item.render = (value) =>
|
|
1300
|
+
item.render = (value) => isNil2(value) ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1150
1301
|
style: {
|
|
1151
1302
|
marginTop: "4px",
|
|
1152
1303
|
color: "#52c41a"
|
|
1153
1304
|
}
|
|
1154
|
-
}) : /* @__PURE__ */
|
|
1305
|
+
}) : /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1155
1306
|
style: {
|
|
1156
1307
|
marginTop: "4px",
|
|
1157
1308
|
color: "#ff4d4f"
|
|
@@ -1167,33 +1318,38 @@ function Table(props) {
|
|
|
1167
1318
|
buttonStyle: "solid",
|
|
1168
1319
|
value: selectedKeys[0],
|
|
1169
1320
|
onChange: (e) => {
|
|
1170
|
-
|
|
1321
|
+
const Values = {
|
|
1322
|
+
true: true,
|
|
1323
|
+
false: false,
|
|
1324
|
+
null: null
|
|
1325
|
+
};
|
|
1326
|
+
setSelectedKeys(e.target.value ? [Values[e.target.value]] : []);
|
|
1171
1327
|
confirm();
|
|
1172
1328
|
},
|
|
1173
1329
|
children: [
|
|
1174
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1175
1331
|
children: common2.all
|
|
1176
1332
|
}),
|
|
1177
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1178
1334
|
value: "true",
|
|
1179
|
-
children: /* @__PURE__ */
|
|
1335
|
+
children: /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1180
1336
|
style: {
|
|
1181
1337
|
color: "#52c41a",
|
|
1182
1338
|
verticalAlign: "middle"
|
|
1183
1339
|
}
|
|
1184
1340
|
})
|
|
1185
1341
|
}),
|
|
1186
|
-
/* @__PURE__ */
|
|
1342
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1187
1343
|
value: "false",
|
|
1188
|
-
children: /* @__PURE__ */
|
|
1344
|
+
children: /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1189
1345
|
style: {
|
|
1190
1346
|
verticalAlign: "middle",
|
|
1191
1347
|
color: "#ff4d4f"
|
|
1192
1348
|
}
|
|
1193
1349
|
})
|
|
1194
1350
|
}),
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
value: "
|
|
1351
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1352
|
+
value: "null",
|
|
1197
1353
|
children: common2.blank
|
|
1198
1354
|
})
|
|
1199
1355
|
]
|
|
@@ -1201,14 +1357,12 @@ function Table(props) {
|
|
|
1201
1357
|
if (!item.onFilter)
|
|
1202
1358
|
item.onFilter = (value, row) => {
|
|
1203
1359
|
switch (value) {
|
|
1204
|
-
case
|
|
1205
|
-
return !isNil2(row[item.id]) &&
|
|
1206
|
-
case
|
|
1360
|
+
case true:
|
|
1361
|
+
return !isNil2(row[item.id]) && row[item.id] !== false;
|
|
1362
|
+
case false:
|
|
1207
1363
|
return !isNil2(row[item.id]) && !row[item.id];
|
|
1208
|
-
case "empty":
|
|
1209
|
-
return isNil2(row[item.id]);
|
|
1210
1364
|
default:
|
|
1211
|
-
return
|
|
1365
|
+
return isNil2(row[item.id]);
|
|
1212
1366
|
}
|
|
1213
1367
|
};
|
|
1214
1368
|
break;
|
|
@@ -1216,9 +1370,15 @@ function Table(props) {
|
|
|
1216
1370
|
if (!item.render)
|
|
1217
1371
|
item.render = (value) => processValue(item, value);
|
|
1218
1372
|
if (!item.onFilter)
|
|
1219
|
-
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
1373
|
+
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value), "date");
|
|
1220
1374
|
if (!item.sorter)
|
|
1221
|
-
item.sorter = (a, b) =>
|
|
1375
|
+
item.sorter = (a, b, order) => {
|
|
1376
|
+
if (isNil2(a[item.id]))
|
|
1377
|
+
return order === "ascend" ? 1 : -1;
|
|
1378
|
+
if (isNil2(b[item.id]))
|
|
1379
|
+
return order === "ascend" ? -1 : 1;
|
|
1380
|
+
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1381
|
+
};
|
|
1222
1382
|
break;
|
|
1223
1383
|
case "time":
|
|
1224
1384
|
if (!item.render)
|
|
@@ -1226,11 +1386,17 @@ function Table(props) {
|
|
|
1226
1386
|
if (!item.onFilter)
|
|
1227
1387
|
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
1228
1388
|
if (!item.sorter)
|
|
1229
|
-
item.sorter = (a, b) =>
|
|
1389
|
+
item.sorter = (a, b, order) => {
|
|
1390
|
+
if (isNil2(a[item.id]))
|
|
1391
|
+
return order === "ascend" ? 1 : -1;
|
|
1392
|
+
if (isNil2(b[item.id]))
|
|
1393
|
+
return order === "ascend" ? -1 : 1;
|
|
1394
|
+
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1395
|
+
};
|
|
1230
1396
|
break;
|
|
1231
1397
|
case "object":
|
|
1232
1398
|
if (!item.render)
|
|
1233
|
-
item.render = (value) => /* @__PURE__ */
|
|
1399
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Description, {
|
|
1234
1400
|
items: item.object,
|
|
1235
1401
|
dataSource: value || {},
|
|
1236
1402
|
column: 1
|
|
@@ -1238,11 +1404,13 @@ function Table(props) {
|
|
|
1238
1404
|
break;
|
|
1239
1405
|
case "object[]":
|
|
1240
1406
|
if (!item.render)
|
|
1241
|
-
item.render = (value) =>
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1407
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
|
|
1408
|
+
children: value.map((v, i) => /* @__PURE__ */ jsx13(Description, {
|
|
1409
|
+
items: item.object,
|
|
1410
|
+
dataSource: v || [],
|
|
1411
|
+
column: 1
|
|
1412
|
+
}, i))
|
|
1413
|
+
});
|
|
1246
1414
|
break;
|
|
1247
1415
|
default:
|
|
1248
1416
|
if (!item.render)
|
|
@@ -1263,101 +1431,130 @@ function Table(props) {
|
|
|
1263
1431
|
return;
|
|
1264
1432
|
for (const column of columns) {
|
|
1265
1433
|
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1434
|
+
const filters = uniqBy(props.dataSource, column.id).map((v) => ({
|
|
1435
|
+
text: v[column.id],
|
|
1436
|
+
value: v[column.id]
|
|
1437
|
+
}));
|
|
1438
|
+
if (filters.length)
|
|
1439
|
+
setColumns((prev) => {
|
|
1440
|
+
const newColumns = [...prev];
|
|
1441
|
+
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1442
|
+
newColumns[index].filters = filters.concat({
|
|
1443
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1444
|
+
value: null
|
|
1445
|
+
});
|
|
1446
|
+
return newColumns;
|
|
1275
1447
|
});
|
|
1276
|
-
return newColumns;
|
|
1277
|
-
});
|
|
1278
1448
|
}
|
|
1279
1449
|
}
|
|
1280
1450
|
}, [props.dataSource, columns]);
|
|
1281
1451
|
if (!columns)
|
|
1282
1452
|
return null;
|
|
1283
|
-
if (
|
|
1284
|
-
return /* @__PURE__ */
|
|
1285
|
-
...
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
columns,
|
|
1290
|
-
dataSource: props.dataSource
|
|
1291
|
-
})
|
|
1453
|
+
if (props.dataSource)
|
|
1454
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1455
|
+
...props,
|
|
1456
|
+
rowKey: props.rowKey || "id",
|
|
1457
|
+
columns,
|
|
1458
|
+
dataSource: props.dataSource
|
|
1292
1459
|
});
|
|
1293
|
-
return /* @__PURE__ */
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
})
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
pagination: processed.pagination,
|
|
1339
|
-
filters: processed.filters,
|
|
1340
|
-
sorter: processed.sorter
|
|
1341
|
-
});
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
reload({
|
|
1345
|
-
...params,
|
|
1346
|
-
pagination,
|
|
1347
|
-
filters,
|
|
1348
|
-
sorter
|
|
1460
|
+
return /* @__PURE__ */ jsx13(FaasDataWrapper, {
|
|
1461
|
+
...props.faasData,
|
|
1462
|
+
children: /* @__PURE__ */ jsx13(FaasDataTable, {
|
|
1463
|
+
props,
|
|
1464
|
+
columns
|
|
1465
|
+
})
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
function FaasDataTable({
|
|
1469
|
+
props,
|
|
1470
|
+
columns,
|
|
1471
|
+
data,
|
|
1472
|
+
params,
|
|
1473
|
+
reload
|
|
1474
|
+
}) {
|
|
1475
|
+
const [currentColumns, setCurrentColumns] = useState7(columns);
|
|
1476
|
+
useEffect5(() => {
|
|
1477
|
+
if (!data || Array.isArray(data))
|
|
1478
|
+
return;
|
|
1479
|
+
setCurrentColumns((prev) => {
|
|
1480
|
+
const newColumns = [...prev];
|
|
1481
|
+
for (const column of newColumns) {
|
|
1482
|
+
if (data["options"] && data.options[column.id]) {
|
|
1483
|
+
column.options = data["options"][column.id];
|
|
1484
|
+
column.filters = data["options"][column.id].map((v) => ({
|
|
1485
|
+
text: v.label,
|
|
1486
|
+
value: v.value
|
|
1487
|
+
})).concat({
|
|
1488
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1489
|
+
value: null
|
|
1490
|
+
});
|
|
1491
|
+
column.render = (value) => processValue(column, value);
|
|
1492
|
+
if (column.filterDropdown)
|
|
1493
|
+
delete column.filterDropdown;
|
|
1494
|
+
continue;
|
|
1495
|
+
}
|
|
1496
|
+
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1497
|
+
const filters = uniqBy(props.dataSource, column.id).map((v) => ({
|
|
1498
|
+
text: v[column.id],
|
|
1499
|
+
value: v[column.id]
|
|
1500
|
+
}));
|
|
1501
|
+
if (filters.length)
|
|
1502
|
+
column.filters = filters.concat({
|
|
1503
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1504
|
+
value: null
|
|
1349
1505
|
});
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return newColumns;
|
|
1509
|
+
});
|
|
1510
|
+
}, [columns, data]);
|
|
1511
|
+
if (!data)
|
|
1512
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1513
|
+
...props,
|
|
1514
|
+
rowKey: props.rowKey || "id",
|
|
1515
|
+
columns: currentColumns,
|
|
1516
|
+
dataSource: []
|
|
1517
|
+
});
|
|
1518
|
+
if (Array.isArray(data))
|
|
1519
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1520
|
+
...props,
|
|
1521
|
+
rowKey: props.rowKey || "id",
|
|
1522
|
+
columns: currentColumns,
|
|
1523
|
+
dataSource: data
|
|
1524
|
+
});
|
|
1525
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1526
|
+
...props,
|
|
1527
|
+
rowKey: props.rowKey || "id",
|
|
1528
|
+
columns: currentColumns,
|
|
1529
|
+
dataSource: data.rows,
|
|
1530
|
+
pagination: {
|
|
1531
|
+
...props.pagination,
|
|
1532
|
+
...data.pagination
|
|
1353
1533
|
},
|
|
1354
|
-
|
|
1534
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1535
|
+
if (props.onChange) {
|
|
1536
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1537
|
+
reload({
|
|
1538
|
+
...params,
|
|
1539
|
+
pagination: processed.pagination,
|
|
1540
|
+
filters: processed.filters,
|
|
1541
|
+
sorter: processed.sorter
|
|
1542
|
+
});
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
reload({
|
|
1546
|
+
...params,
|
|
1547
|
+
pagination,
|
|
1548
|
+
filters,
|
|
1549
|
+
sorter
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1355
1552
|
});
|
|
1356
1553
|
}
|
|
1357
1554
|
|
|
1358
1555
|
// src/Title.tsx
|
|
1359
|
-
import { useEffect as useEffect6, cloneElement as
|
|
1360
|
-
import { Fragment as
|
|
1556
|
+
import { useEffect as useEffect6, cloneElement as cloneElement4 } from "react";
|
|
1557
|
+
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1361
1558
|
function Title(props) {
|
|
1362
1559
|
const { Title: Title2 } = useConfigContext();
|
|
1363
1560
|
useEffect6(() => {
|
|
@@ -1366,21 +1563,21 @@ function Title(props) {
|
|
|
1366
1563
|
}, [props]);
|
|
1367
1564
|
if (props.h1) {
|
|
1368
1565
|
if (typeof props.h1 === "boolean")
|
|
1369
|
-
return /* @__PURE__ */
|
|
1566
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1370
1567
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1371
1568
|
});
|
|
1372
|
-
return /* @__PURE__ */
|
|
1569
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1373
1570
|
className: props.h1.className,
|
|
1374
1571
|
style: props.h1.style,
|
|
1375
1572
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1376
1573
|
});
|
|
1377
1574
|
}
|
|
1378
1575
|
if (props.plain)
|
|
1379
|
-
return /* @__PURE__ */
|
|
1576
|
+
return /* @__PURE__ */ jsx14(Fragment5, {
|
|
1380
1577
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1381
1578
|
});
|
|
1382
1579
|
if (props.children)
|
|
1383
|
-
return
|
|
1580
|
+
return cloneElement4(props.children, { title: props.title });
|
|
1384
1581
|
return null;
|
|
1385
1582
|
}
|
|
1386
1583
|
export {
|
|
@@ -1389,9 +1586,12 @@ export {
|
|
|
1389
1586
|
ConfigProvider,
|
|
1390
1587
|
Description,
|
|
1391
1588
|
Drawer,
|
|
1589
|
+
ErrorBoundary,
|
|
1590
|
+
FaasDataWrapper,
|
|
1392
1591
|
Form,
|
|
1393
1592
|
FormItem,
|
|
1394
1593
|
Link,
|
|
1594
|
+
Loading,
|
|
1395
1595
|
Modal,
|
|
1396
1596
|
PageNotFound,
|
|
1397
1597
|
Routes,
|