@faasjs/ant-design 0.0.2-beta.453 → 0.0.2-beta.454
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +336 -288
- package/dist/index.mjs +225 -184
- package/package.json +3 -5
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
1
|
// react-shim.js
|
|
22
2
|
import React from "react";
|
|
23
3
|
|
|
@@ -92,9 +72,10 @@ function ConfigProvider({
|
|
|
92
72
|
}, []);
|
|
93
73
|
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
94
74
|
value: values,
|
|
95
|
-
children: /* @__PURE__ */ jsx(AntdConfigProvider,
|
|
75
|
+
children: /* @__PURE__ */ jsx(AntdConfigProvider, {
|
|
76
|
+
...config.antd,
|
|
96
77
|
children
|
|
97
|
-
})
|
|
78
|
+
})
|
|
98
79
|
});
|
|
99
80
|
}
|
|
100
81
|
function useConfigContext() {
|
|
@@ -160,46 +141,17 @@ import {
|
|
|
160
141
|
import { isFunction, upperFirst as upperFirst2 } from "lodash";
|
|
161
142
|
import {
|
|
162
143
|
cloneElement,
|
|
163
|
-
useEffect as useEffect3,
|
|
164
|
-
useState as useState3
|
|
165
|
-
} from "react";
|
|
166
|
-
|
|
167
|
-
// ../react/src/index.tsx
|
|
168
|
-
import {
|
|
169
|
-
useState as useState2,
|
|
170
144
|
useEffect as useEffect2,
|
|
171
|
-
|
|
145
|
+
useState as useState2
|
|
172
146
|
} from "react";
|
|
173
|
-
|
|
174
|
-
function getClient(domain) {
|
|
175
|
-
const client = clients[domain || Object.keys(clients)[0]];
|
|
176
|
-
if (!client)
|
|
177
|
-
throw Error("FaasReactClient is not initialized");
|
|
178
|
-
return client;
|
|
179
|
-
}
|
|
180
|
-
async function faas(action, params) {
|
|
181
|
-
return getClient().faas(action, params);
|
|
182
|
-
}
|
|
183
|
-
function FaasDataWrapper(props) {
|
|
184
|
-
const [client, setClient] = useState2();
|
|
185
|
-
useEffect2(() => {
|
|
186
|
-
if (client)
|
|
187
|
-
return;
|
|
188
|
-
setClient(getClient());
|
|
189
|
-
}, []);
|
|
190
|
-
if (!client)
|
|
191
|
-
return props.fallback || null;
|
|
192
|
-
return createElement(client.FaasDataWrapper, props);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// src/Description.tsx
|
|
147
|
+
import { FaasDataWrapper } from "@faasjs/react";
|
|
196
148
|
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
197
149
|
function DescriptionItemContent(props) {
|
|
198
150
|
var _a;
|
|
199
|
-
const [computedProps, setComputedProps] =
|
|
200
|
-
|
|
151
|
+
const [computedProps, setComputedProps] = useState2();
|
|
152
|
+
useEffect2(() => {
|
|
201
153
|
var _a2, _b;
|
|
202
|
-
const propsCopy =
|
|
154
|
+
const propsCopy = { ...props };
|
|
203
155
|
if (!propsCopy.item.title)
|
|
204
156
|
propsCopy.item.title = upperFirst2(propsCopy.item.id);
|
|
205
157
|
if (!propsCopy.item.type)
|
|
@@ -302,7 +254,8 @@ function DescriptionItemContent(props) {
|
|
|
302
254
|
}
|
|
303
255
|
function Description(props) {
|
|
304
256
|
if (!props.faasData)
|
|
305
|
-
return /* @__PURE__ */ jsx3(Descriptions,
|
|
257
|
+
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
258
|
+
...props,
|
|
306
259
|
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
307
260
|
children: props.items.map((item) => {
|
|
308
261
|
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
@@ -315,13 +268,14 @@ function Description(props) {
|
|
|
315
268
|
})
|
|
316
269
|
}, item.id) : null;
|
|
317
270
|
}).filter(Boolean)
|
|
318
|
-
})
|
|
319
|
-
return /* @__PURE__ */ jsx3(FaasDataWrapper,
|
|
271
|
+
});
|
|
272
|
+
return /* @__PURE__ */ jsx3(FaasDataWrapper, {
|
|
320
273
|
fallback: props.faasData.fallback || /* @__PURE__ */ jsx3(Skeleton, {
|
|
321
274
|
active: true
|
|
322
275
|
}),
|
|
323
276
|
render: ({ data }) => {
|
|
324
|
-
return /* @__PURE__ */ jsx3(Descriptions,
|
|
277
|
+
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
278
|
+
...props,
|
|
325
279
|
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
326
280
|
children: props.items.map((item) => {
|
|
327
281
|
return !item.if || item.if(data) ? /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
@@ -334,39 +288,48 @@ function Description(props) {
|
|
|
334
288
|
})
|
|
335
289
|
}, item.id) : null;
|
|
336
290
|
}).filter(Boolean)
|
|
337
|
-
})
|
|
338
|
-
}
|
|
339
|
-
|
|
291
|
+
});
|
|
292
|
+
},
|
|
293
|
+
...props.faasData
|
|
294
|
+
});
|
|
340
295
|
}
|
|
341
296
|
|
|
342
297
|
// src/Drawer.tsx
|
|
343
298
|
import { Drawer } from "antd";
|
|
344
|
-
import { useState as
|
|
299
|
+
import { useState as useState3 } from "react";
|
|
345
300
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
346
301
|
function useDrawer(init) {
|
|
347
|
-
const [props, setProps] =
|
|
302
|
+
const [props, setProps] = useState3({
|
|
348
303
|
open: false,
|
|
349
|
-
onClose: () => setProps((prev) =>
|
|
304
|
+
onClose: () => setProps((prev) => ({
|
|
305
|
+
...prev,
|
|
350
306
|
open: false
|
|
351
|
-
}))
|
|
352
|
-
|
|
307
|
+
})),
|
|
308
|
+
...init
|
|
309
|
+
});
|
|
353
310
|
return {
|
|
354
|
-
drawer: /* @__PURE__ */ jsx4(Drawer,
|
|
311
|
+
drawer: /* @__PURE__ */ jsx4(Drawer, {
|
|
312
|
+
...props
|
|
313
|
+
}),
|
|
355
314
|
drawerProps: props,
|
|
356
315
|
setDrawerProps(changes) {
|
|
357
|
-
setProps((prev) =>
|
|
316
|
+
setProps((prev) => ({
|
|
317
|
+
...prev,
|
|
318
|
+
...changes
|
|
319
|
+
}));
|
|
358
320
|
}
|
|
359
321
|
};
|
|
360
322
|
}
|
|
361
323
|
|
|
362
324
|
// src/Form.tsx
|
|
325
|
+
import { faas } from "@faasjs/react";
|
|
363
326
|
import {
|
|
364
327
|
Button as Button2,
|
|
365
328
|
Form as AntdForm2
|
|
366
329
|
} from "antd";
|
|
367
330
|
import {
|
|
368
|
-
useEffect as
|
|
369
|
-
useState as
|
|
331
|
+
useEffect as useEffect4,
|
|
332
|
+
useState as useState5,
|
|
370
333
|
useCallback
|
|
371
334
|
} from "react";
|
|
372
335
|
|
|
@@ -383,8 +346,8 @@ import {
|
|
|
383
346
|
} from "antd";
|
|
384
347
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
385
348
|
import {
|
|
386
|
-
useEffect as
|
|
387
|
-
useState as
|
|
349
|
+
useEffect as useEffect3,
|
|
350
|
+
useState as useState4
|
|
388
351
|
} from "react";
|
|
389
352
|
import { upperFirst as upperFirst3 } from "lodash";
|
|
390
353
|
|
|
@@ -392,11 +355,12 @@ import { upperFirst as upperFirst3 } from "lodash";
|
|
|
392
355
|
import { forwardRef } from "react";
|
|
393
356
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
394
357
|
var TimePicker = forwardRef((props, ref) => {
|
|
395
|
-
return /* @__PURE__ */ jsx5(DatePicker,
|
|
358
|
+
return /* @__PURE__ */ jsx5(DatePicker, {
|
|
359
|
+
...props,
|
|
396
360
|
picker: "time",
|
|
397
361
|
mode: void 0,
|
|
398
362
|
ref
|
|
399
|
-
})
|
|
363
|
+
});
|
|
400
364
|
});
|
|
401
365
|
TimePicker.displayName = "TimePicker";
|
|
402
366
|
|
|
@@ -450,12 +414,12 @@ function processProps(propsCopy, config) {
|
|
|
450
414
|
}
|
|
451
415
|
function FormItem(props) {
|
|
452
416
|
var _a;
|
|
453
|
-
const [computedProps, setComputedProps] =
|
|
454
|
-
const [extendTypes, setExtendTypes] =
|
|
417
|
+
const [computedProps, setComputedProps] = useState4();
|
|
418
|
+
const [extendTypes, setExtendTypes] = useState4();
|
|
455
419
|
const config = useConfigContext();
|
|
456
|
-
const [hidden, setHidden] =
|
|
457
|
-
|
|
458
|
-
const propsCopy =
|
|
420
|
+
const [hidden, setHidden] = useState4(false);
|
|
421
|
+
useEffect3(() => {
|
|
422
|
+
const propsCopy = { ...props };
|
|
459
423
|
if (propsCopy.extendTypes) {
|
|
460
424
|
setExtendTypes(propsCopy.extendTypes);
|
|
461
425
|
delete propsCopy.extendTypes;
|
|
@@ -474,36 +438,47 @@ function FormItem(props) {
|
|
|
474
438
|
if (!computedProps)
|
|
475
439
|
return null;
|
|
476
440
|
if (hidden)
|
|
477
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
441
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
442
|
+
...computedProps,
|
|
478
443
|
noStyle: true,
|
|
479
444
|
children: /* @__PURE__ */ jsx6(Input, {
|
|
480
445
|
hidden: true
|
|
481
446
|
})
|
|
482
|
-
})
|
|
447
|
+
});
|
|
483
448
|
if (extendTypes && extendTypes[computedProps.type])
|
|
484
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
449
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
450
|
+
...computedProps,
|
|
485
451
|
children: extendTypes[computedProps.type].children
|
|
486
|
-
})
|
|
452
|
+
});
|
|
487
453
|
if (computedProps.children)
|
|
488
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
454
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
455
|
+
...computedProps,
|
|
489
456
|
children: computedProps.children
|
|
490
|
-
})
|
|
457
|
+
});
|
|
491
458
|
if (computedProps.render)
|
|
492
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
459
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
460
|
+
...computedProps,
|
|
493
461
|
children: computedProps.render()
|
|
494
|
-
})
|
|
462
|
+
});
|
|
495
463
|
switch (computedProps.type) {
|
|
496
464
|
case "string":
|
|
497
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
498
|
-
|
|
499
|
-
|
|
465
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
466
|
+
...computedProps,
|
|
467
|
+
children: computedProps.options ? /* @__PURE__ */ jsx6(Select, {
|
|
468
|
+
...computedProps.input
|
|
469
|
+
}) : /* @__PURE__ */ jsx6(Input, {
|
|
470
|
+
...computedProps.input
|
|
471
|
+
})
|
|
472
|
+
});
|
|
500
473
|
case "string[]":
|
|
501
474
|
if (computedProps.options)
|
|
502
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
475
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
476
|
+
...computedProps,
|
|
477
|
+
children: /* @__PURE__ */ jsx6(Select, {
|
|
478
|
+
mode: "multiple",
|
|
479
|
+
...computedProps.input
|
|
480
|
+
})
|
|
481
|
+
});
|
|
507
482
|
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
508
483
|
name: computedProps.name,
|
|
509
484
|
rules: computedProps.rules,
|
|
@@ -527,10 +502,13 @@ function FormItem(props) {
|
|
|
527
502
|
children: [
|
|
528
503
|
/* @__PURE__ */ jsx6(Col, {
|
|
529
504
|
span: 23,
|
|
530
|
-
children: /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
505
|
+
children: /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
506
|
+
...field,
|
|
531
507
|
noStyle: true,
|
|
532
|
-
children: /* @__PURE__ */ jsx6(Input,
|
|
533
|
-
|
|
508
|
+
children: /* @__PURE__ */ jsx6(Input, {
|
|
509
|
+
...computedProps.input
|
|
510
|
+
})
|
|
511
|
+
})
|
|
534
512
|
}),
|
|
535
513
|
/* @__PURE__ */ jsx6(Col, {
|
|
536
514
|
span: 1,
|
|
@@ -564,18 +542,24 @@ function FormItem(props) {
|
|
|
564
542
|
}
|
|
565
543
|
});
|
|
566
544
|
case "number":
|
|
567
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
545
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
546
|
+
...computedProps,
|
|
547
|
+
children: computedProps.options ? /* @__PURE__ */ jsx6(Select, {
|
|
548
|
+
...computedProps.input
|
|
549
|
+
}) : /* @__PURE__ */ jsx6(InputNumber, {
|
|
550
|
+
style: { width: "100%" },
|
|
551
|
+
...computedProps.input
|
|
552
|
+
})
|
|
553
|
+
});
|
|
572
554
|
case "number[]":
|
|
573
555
|
if (computedProps.options)
|
|
574
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
556
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
557
|
+
...computedProps,
|
|
558
|
+
children: /* @__PURE__ */ jsx6(Select, {
|
|
559
|
+
mode: "multiple",
|
|
560
|
+
...computedProps.input
|
|
561
|
+
})
|
|
562
|
+
});
|
|
579
563
|
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
580
564
|
name: computedProps.name,
|
|
581
565
|
rules: computedProps.rules,
|
|
@@ -599,12 +583,14 @@ function FormItem(props) {
|
|
|
599
583
|
children: [
|
|
600
584
|
/* @__PURE__ */ jsx6(Col, {
|
|
601
585
|
span: 23,
|
|
602
|
-
children: /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
586
|
+
children: /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
587
|
+
...field,
|
|
603
588
|
noStyle: true,
|
|
604
|
-
children: /* @__PURE__ */ jsx6(InputNumber,
|
|
605
|
-
style: { width: "100%" }
|
|
606
|
-
|
|
607
|
-
|
|
589
|
+
children: /* @__PURE__ */ jsx6(InputNumber, {
|
|
590
|
+
style: { width: "100%" },
|
|
591
|
+
...computedProps.input
|
|
592
|
+
})
|
|
593
|
+
})
|
|
608
594
|
}),
|
|
609
595
|
/* @__PURE__ */ jsx6(Col, {
|
|
610
596
|
span: 1,
|
|
@@ -638,17 +624,26 @@ function FormItem(props) {
|
|
|
638
624
|
}
|
|
639
625
|
});
|
|
640
626
|
case "boolean":
|
|
641
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
642
|
-
|
|
643
|
-
|
|
627
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
628
|
+
...computedProps,
|
|
629
|
+
children: /* @__PURE__ */ jsx6(Switch, {
|
|
630
|
+
...computedProps.input
|
|
631
|
+
})
|
|
632
|
+
});
|
|
644
633
|
case "date":
|
|
645
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
646
|
-
|
|
647
|
-
|
|
634
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
635
|
+
...computedProps,
|
|
636
|
+
children: /* @__PURE__ */ jsx6(DatePicker, {
|
|
637
|
+
...computedProps.input
|
|
638
|
+
})
|
|
639
|
+
});
|
|
648
640
|
case "time":
|
|
649
|
-
return /* @__PURE__ */ jsx6(AntdForm.Item,
|
|
650
|
-
|
|
651
|
-
|
|
641
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
642
|
+
...computedProps,
|
|
643
|
+
children: /* @__PURE__ */ jsx6(TimePicker, {
|
|
644
|
+
...computedProps.input
|
|
645
|
+
})
|
|
646
|
+
});
|
|
652
647
|
case "object":
|
|
653
648
|
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
654
649
|
children: [
|
|
@@ -659,7 +654,9 @@ function FormItem(props) {
|
|
|
659
654
|
children: computedProps.label
|
|
660
655
|
})
|
|
661
656
|
}),
|
|
662
|
-
computedProps.object.map((o) => /* @__PURE__ */ jsx6(FormItem,
|
|
657
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx6(FormItem, {
|
|
658
|
+
...o
|
|
659
|
+
}, o.id))
|
|
663
660
|
]
|
|
664
661
|
});
|
|
665
662
|
case "object[]":
|
|
@@ -691,9 +688,10 @@ function FormItem(props) {
|
|
|
691
688
|
gutter: 24,
|
|
692
689
|
children: computedProps.object.map((o) => /* @__PURE__ */ jsx6(Col, {
|
|
693
690
|
span: o.col || 24,
|
|
694
|
-
children: /* @__PURE__ */ jsx6(FormItem,
|
|
691
|
+
children: /* @__PURE__ */ jsx6(FormItem, {
|
|
692
|
+
...o,
|
|
695
693
|
name: [field.name, o.id]
|
|
696
|
-
})
|
|
694
|
+
})
|
|
697
695
|
}, o.id))
|
|
698
696
|
})
|
|
699
697
|
]
|
|
@@ -728,17 +726,18 @@ function FormItem(props) {
|
|
|
728
726
|
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
729
727
|
function Form(props) {
|
|
730
728
|
var _a, _b;
|
|
731
|
-
const [loading, setLoading] =
|
|
732
|
-
const [computedProps, setComputedProps] =
|
|
729
|
+
const [loading, setLoading] = useState5(false);
|
|
730
|
+
const [computedProps, setComputedProps] = useState5();
|
|
733
731
|
const config = useConfigContext();
|
|
734
|
-
const [extendTypes, setExtendTypes] =
|
|
732
|
+
const [extendTypes, setExtendTypes] = useState5();
|
|
735
733
|
const [form] = AntdForm2.useForm(props.form);
|
|
736
|
-
const [initialValues, setInitialValues] =
|
|
737
|
-
|
|
734
|
+
const [initialValues, setInitialValues] = useState5(props.initialValues);
|
|
735
|
+
useEffect4(() => {
|
|
738
736
|
var _a2, _b2;
|
|
739
|
-
const propsCopy =
|
|
737
|
+
const propsCopy = {
|
|
738
|
+
...props,
|
|
740
739
|
form
|
|
741
|
-
}
|
|
740
|
+
};
|
|
742
741
|
if (propsCopy.initialValues) {
|
|
743
742
|
for (const key in propsCopy.initialValues)
|
|
744
743
|
propsCopy.initialValues[key] = transferValue(
|
|
@@ -754,7 +753,10 @@ function Form(props) {
|
|
|
754
753
|
setLoading(true);
|
|
755
754
|
try {
|
|
756
755
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
757
|
-
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ?
|
|
756
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
757
|
+
...values2,
|
|
758
|
+
...propsCopy.submit.to.params
|
|
759
|
+
} : values2));
|
|
758
760
|
} else
|
|
759
761
|
await props.onFinish(values);
|
|
760
762
|
} catch (error) {
|
|
@@ -765,7 +767,10 @@ function Form(props) {
|
|
|
765
767
|
} else if (propsCopy.submit && ((_b2 = propsCopy.submit.to) == null ? void 0 : _b2.action)) {
|
|
766
768
|
propsCopy.onFinish = async (values) => {
|
|
767
769
|
setLoading(true);
|
|
768
|
-
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ?
|
|
770
|
+
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
771
|
+
...values,
|
|
772
|
+
...propsCopy.submit.to.params
|
|
773
|
+
} : values).finally(() => setLoading(false));
|
|
769
774
|
};
|
|
770
775
|
}
|
|
771
776
|
if (propsCopy.extendTypes) {
|
|
@@ -786,7 +791,7 @@ function Form(props) {
|
|
|
786
791
|
item.onValueChange(changedValues[key], allValues, form);
|
|
787
792
|
}
|
|
788
793
|
}, [computedProps]);
|
|
789
|
-
|
|
794
|
+
useEffect4(() => {
|
|
790
795
|
if (!initialValues)
|
|
791
796
|
return;
|
|
792
797
|
form.setFieldsValue(initialValues);
|
|
@@ -794,13 +799,15 @@ function Form(props) {
|
|
|
794
799
|
}, [computedProps]);
|
|
795
800
|
if (!computedProps)
|
|
796
801
|
return null;
|
|
797
|
-
return /* @__PURE__ */ jsxs2(AntdForm2,
|
|
802
|
+
return /* @__PURE__ */ jsxs2(AntdForm2, {
|
|
803
|
+
...computedProps,
|
|
798
804
|
onValuesChange,
|
|
799
805
|
children: [
|
|
800
806
|
computedProps.beforeItems,
|
|
801
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx7(FormItem,
|
|
807
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx7(FormItem, {
|
|
808
|
+
...item,
|
|
802
809
|
extendTypes
|
|
803
|
-
}
|
|
810
|
+
}, item.id)),
|
|
804
811
|
computedProps.children,
|
|
805
812
|
computedProps.submit !== false && /* @__PURE__ */ jsx7(Button2, {
|
|
806
813
|
htmlType: "submit",
|
|
@@ -810,7 +817,7 @@ function Form(props) {
|
|
|
810
817
|
}),
|
|
811
818
|
computedProps.footer
|
|
812
819
|
]
|
|
813
|
-
})
|
|
820
|
+
});
|
|
814
821
|
}
|
|
815
822
|
Form.useForm = AntdForm2.useForm;
|
|
816
823
|
|
|
@@ -830,54 +837,75 @@ function Link({
|
|
|
830
837
|
style = Object.assign({ cursor: "pointer" }, style);
|
|
831
838
|
if (href.startsWith("http")) {
|
|
832
839
|
if (button)
|
|
833
|
-
return /* @__PURE__ */ jsx8(Button3,
|
|
840
|
+
return /* @__PURE__ */ jsx8(Button3, {
|
|
841
|
+
...button,
|
|
834
842
|
children: /* @__PURE__ */ jsx8("a", {
|
|
835
843
|
href,
|
|
836
844
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
837
|
-
style:
|
|
845
|
+
style: {
|
|
846
|
+
...Link2.style,
|
|
847
|
+
...style || {}
|
|
848
|
+
},
|
|
838
849
|
children: text || children
|
|
839
850
|
})
|
|
840
|
-
})
|
|
851
|
+
});
|
|
841
852
|
return /* @__PURE__ */ jsx8("a", {
|
|
842
853
|
href,
|
|
843
854
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
844
|
-
style:
|
|
855
|
+
style: {
|
|
856
|
+
...Link2.style,
|
|
857
|
+
...style || {}
|
|
858
|
+
},
|
|
845
859
|
children: text || children
|
|
846
860
|
});
|
|
847
861
|
}
|
|
848
862
|
if (button)
|
|
849
|
-
return /* @__PURE__ */ jsx8(Button3,
|
|
863
|
+
return /* @__PURE__ */ jsx8(Button3, {
|
|
864
|
+
...button,
|
|
850
865
|
children: /* @__PURE__ */ jsx8(RouterLink, {
|
|
851
866
|
to: href,
|
|
852
867
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
853
|
-
style:
|
|
868
|
+
style: {
|
|
869
|
+
...Link2.style,
|
|
870
|
+
...style || {}
|
|
871
|
+
},
|
|
854
872
|
children: text || children
|
|
855
873
|
})
|
|
856
|
-
})
|
|
874
|
+
});
|
|
857
875
|
return /* @__PURE__ */ jsx8(RouterLink, {
|
|
858
876
|
to: href,
|
|
859
877
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
860
|
-
style:
|
|
878
|
+
style: {
|
|
879
|
+
...Link2.style,
|
|
880
|
+
...style || {}
|
|
881
|
+
},
|
|
861
882
|
children: text || children
|
|
862
883
|
});
|
|
863
884
|
}
|
|
864
885
|
|
|
865
886
|
// src/Modal.tsx
|
|
866
887
|
import { Modal } from "antd";
|
|
867
|
-
import { useState as
|
|
888
|
+
import { useState as useState6 } from "react";
|
|
868
889
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
869
890
|
function useModal(init) {
|
|
870
|
-
const [props, setProps] =
|
|
891
|
+
const [props, setProps] = useState6({
|
|
871
892
|
open: false,
|
|
872
|
-
onCancel: () => setProps((prev) =>
|
|
893
|
+
onCancel: () => setProps((prev) => ({
|
|
894
|
+
...prev,
|
|
873
895
|
open: false
|
|
874
|
-
}))
|
|
875
|
-
|
|
896
|
+
})),
|
|
897
|
+
...init
|
|
898
|
+
});
|
|
876
899
|
return {
|
|
877
|
-
modal: /* @__PURE__ */ jsx9(Modal,
|
|
900
|
+
modal: /* @__PURE__ */ jsx9(Modal, {
|
|
901
|
+
...props
|
|
902
|
+
}),
|
|
878
903
|
modalProps: props,
|
|
879
904
|
setModalProps(changes) {
|
|
880
|
-
setProps((prev) =>
|
|
905
|
+
setProps((prev) => ({
|
|
906
|
+
...prev,
|
|
907
|
+
...changes
|
|
908
|
+
}));
|
|
881
909
|
}
|
|
882
910
|
};
|
|
883
911
|
}
|
|
@@ -902,7 +930,8 @@ function PageNotFound() {
|
|
|
902
930
|
function Routes(props) {
|
|
903
931
|
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
904
932
|
children: [
|
|
905
|
-
props.routes.map((r) => /* @__PURE__ */ jsx10(Route,
|
|
933
|
+
props.routes.map((r) => /* @__PURE__ */ jsx10(Route, {
|
|
934
|
+
...r,
|
|
906
935
|
element: r.element || /* @__PURE__ */ jsx10(Suspense, {
|
|
907
936
|
fallback: props.fallback || /* @__PURE__ */ jsx10("div", {
|
|
908
937
|
style: { padding: "24px" },
|
|
@@ -912,7 +941,7 @@ function Routes(props) {
|
|
|
912
941
|
}),
|
|
913
942
|
children: /* @__PURE__ */ jsx10(r.page, {})
|
|
914
943
|
})
|
|
915
|
-
}
|
|
944
|
+
}, r.path)),
|
|
916
945
|
/* @__PURE__ */ jsx10(Route, {
|
|
917
946
|
path: "*",
|
|
918
947
|
element: props.notFound || /* @__PURE__ */ jsx10(PageNotFound, {})
|
|
@@ -923,8 +952,8 @@ function Routes(props) {
|
|
|
923
952
|
|
|
924
953
|
// src/Table.tsx
|
|
925
954
|
import {
|
|
926
|
-
useState as
|
|
927
|
-
useEffect as
|
|
955
|
+
useState as useState7,
|
|
956
|
+
useEffect as useEffect5,
|
|
928
957
|
cloneElement as cloneElement2
|
|
929
958
|
} from "react";
|
|
930
959
|
import {
|
|
@@ -940,6 +969,7 @@ import {
|
|
|
940
969
|
uniqBy,
|
|
941
970
|
upperFirst as upperFirst4
|
|
942
971
|
} from "lodash";
|
|
972
|
+
import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
|
|
943
973
|
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
944
974
|
function processValue(item, value) {
|
|
945
975
|
var _a;
|
|
@@ -966,9 +996,9 @@ function processValue(item, value) {
|
|
|
966
996
|
return value;
|
|
967
997
|
}
|
|
968
998
|
function Table(props) {
|
|
969
|
-
const [columns, setColumns] =
|
|
999
|
+
const [columns, setColumns] = useState7();
|
|
970
1000
|
const { common: common2 } = useConfigContext();
|
|
971
|
-
|
|
1001
|
+
useEffect5(() => {
|
|
972
1002
|
var _a;
|
|
973
1003
|
for (const item of props.items) {
|
|
974
1004
|
if (!item.key)
|
|
@@ -1220,7 +1250,7 @@ function Table(props) {
|
|
|
1220
1250
|
}
|
|
1221
1251
|
setColumns(props.items);
|
|
1222
1252
|
}, [props.items]);
|
|
1223
|
-
|
|
1253
|
+
useEffect5(() => {
|
|
1224
1254
|
if (!props.dataSource || !columns)
|
|
1225
1255
|
return;
|
|
1226
1256
|
for (const column of columns) {
|
|
@@ -1240,12 +1270,13 @@ function Table(props) {
|
|
|
1240
1270
|
if (!columns)
|
|
1241
1271
|
return null;
|
|
1242
1272
|
if (!props.faasData)
|
|
1243
|
-
return /* @__PURE__ */ jsx11(AntdTable,
|
|
1273
|
+
return /* @__PURE__ */ jsx11(AntdTable, {
|
|
1274
|
+
...props,
|
|
1244
1275
|
rowKey: props.rowKey || "id",
|
|
1245
1276
|
columns,
|
|
1246
1277
|
dataSource: props.dataSource
|
|
1247
|
-
})
|
|
1248
|
-
return /* @__PURE__ */ jsx11(
|
|
1278
|
+
});
|
|
1279
|
+
return /* @__PURE__ */ jsx11(FaasDataWrapper2, {
|
|
1249
1280
|
fallback: props.faasData.fallback || /* @__PURE__ */ jsx11(Skeleton3, {
|
|
1250
1281
|
active: true
|
|
1251
1282
|
}),
|
|
@@ -1255,50 +1286,59 @@ function Table(props) {
|
|
|
1255
1286
|
reload
|
|
1256
1287
|
}) => {
|
|
1257
1288
|
if (!data)
|
|
1258
|
-
return /* @__PURE__ */ jsx11(AntdTable,
|
|
1289
|
+
return /* @__PURE__ */ jsx11(AntdTable, {
|
|
1290
|
+
...props,
|
|
1259
1291
|
rowKey: props.rowKey || "id",
|
|
1260
1292
|
columns,
|
|
1261
1293
|
dataSource: []
|
|
1262
|
-
})
|
|
1294
|
+
});
|
|
1263
1295
|
if (Array.isArray(data))
|
|
1264
|
-
return /* @__PURE__ */ jsx11(AntdTable,
|
|
1296
|
+
return /* @__PURE__ */ jsx11(AntdTable, {
|
|
1297
|
+
...props,
|
|
1265
1298
|
rowKey: props.rowKey || "id",
|
|
1266
1299
|
columns,
|
|
1267
1300
|
dataSource: data
|
|
1268
|
-
})
|
|
1269
|
-
return /* @__PURE__ */ jsx11(AntdTable,
|
|
1301
|
+
});
|
|
1302
|
+
return /* @__PURE__ */ jsx11(AntdTable, {
|
|
1303
|
+
...props,
|
|
1270
1304
|
rowKey: props.rowKey || "id",
|
|
1271
1305
|
columns,
|
|
1272
1306
|
dataSource: data.rows,
|
|
1273
|
-
pagination:
|
|
1307
|
+
pagination: {
|
|
1308
|
+
...props.pagination,
|
|
1309
|
+
...data.pagination
|
|
1310
|
+
},
|
|
1274
1311
|
onChange: (pagination, filters, sorter, extra) => {
|
|
1275
1312
|
if (props.onChange) {
|
|
1276
1313
|
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1277
|
-
reload(
|
|
1314
|
+
reload({
|
|
1315
|
+
...params,
|
|
1278
1316
|
pagination: processed.pagination,
|
|
1279
1317
|
filters: processed.filters,
|
|
1280
1318
|
sorter: processed.sorter
|
|
1281
|
-
})
|
|
1319
|
+
});
|
|
1282
1320
|
return;
|
|
1283
1321
|
}
|
|
1284
|
-
reload(
|
|
1322
|
+
reload({
|
|
1323
|
+
...params,
|
|
1285
1324
|
pagination,
|
|
1286
1325
|
filters,
|
|
1287
1326
|
sorter
|
|
1288
|
-
})
|
|
1327
|
+
});
|
|
1289
1328
|
}
|
|
1290
|
-
})
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1329
|
+
});
|
|
1330
|
+
},
|
|
1331
|
+
...props.faasData
|
|
1332
|
+
});
|
|
1293
1333
|
}
|
|
1294
1334
|
|
|
1295
1335
|
// src/Title.tsx
|
|
1296
|
-
import { useEffect as
|
|
1336
|
+
import { useEffect as useEffect6, cloneElement as cloneElement3 } from "react";
|
|
1297
1337
|
import { PageHeader } from "antd";
|
|
1298
1338
|
import { Fragment as Fragment3, jsx as jsx12 } from "react/jsx-runtime";
|
|
1299
1339
|
function Title(props) {
|
|
1300
1340
|
const { Title: Title2 } = useConfigContext();
|
|
1301
|
-
|
|
1341
|
+
useEffect6(() => {
|
|
1302
1342
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1303
1343
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1304
1344
|
}, [props]);
|
|
@@ -1318,9 +1358,10 @@ function Title(props) {
|
|
|
1318
1358
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1319
1359
|
});
|
|
1320
1360
|
if (props.header)
|
|
1321
|
-
return /* @__PURE__ */ jsx12(PageHeader,
|
|
1322
|
-
title: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1323
|
-
|
|
1361
|
+
return /* @__PURE__ */ jsx12(PageHeader, {
|
|
1362
|
+
title: Array.isArray(props.title) ? props.title[0] : props.title,
|
|
1363
|
+
...props.header
|
|
1364
|
+
});
|
|
1324
1365
|
if (props.children)
|
|
1325
1366
|
return cloneElement3(props.children, { title: props.title });
|
|
1326
1367
|
return null;
|