@faasjs/ant-design 0.0.3-beta.3 → 0.0.3-beta.30

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 CHANGED
@@ -30,11 +30,13 @@ __export(src_exports, {
30
30
  ConfigContext: () => ConfigContext,
31
31
  ConfigProvider: () => ConfigProvider,
32
32
  Description: () => Description,
33
- Drawer: () => import_antd4.Drawer,
33
+ Drawer: () => import_antd5.Drawer,
34
+ FaasDataWrapper: () => FaasDataWrapper,
34
35
  Form: () => Form,
35
36
  FormItem: () => FormItem,
36
37
  Link: () => Link,
37
- Modal: () => import_antd8.Modal,
38
+ Loading: () => Loading,
39
+ Modal: () => import_antd9.Modal,
38
40
  PageNotFound: () => PageNotFound,
39
41
  Routes: () => Routes,
40
42
  Table: () => Table,
@@ -51,12 +53,11 @@ module.exports = __toCommonJS(src_exports);
51
53
  var import_react = __toESM(require("react"));
52
54
 
53
55
  // src/Blank.tsx
54
- var import_antd2 = require("antd");
56
+ var import_antd = require("antd");
55
57
  var import_lodash_es2 = require("lodash-es");
56
58
 
57
59
  // src/Config.tsx
58
60
  var import_react2 = require("react");
59
- var import_antd = require("antd");
60
61
  var import_lodash_es = require("lodash-es");
61
62
  var import_jsx_runtime = require("react/jsx-runtime");
62
63
  var isZH = /^zh/i.test(navigator.language);
@@ -116,10 +117,7 @@ function ConfigProvider({
116
117
  }, []);
117
118
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
118
119
  value: values,
119
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
120
- ...config.antd,
121
- children
122
- })
120
+ children
123
121
  });
124
122
  }
125
123
  function useConfigContext() {
@@ -130,7 +128,7 @@ function useConfigContext() {
130
128
  var import_jsx_runtime = require("react/jsx-runtime");
131
129
  function Blank(options) {
132
130
  const { Blank: Blank2 } = useConfigContext();
133
- return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Typography.Text, {
131
+ return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, {
134
132
  disabled: true,
135
133
  children: (options == null ? void 0 : options.text) || Blank2.text
136
134
  }) : options.value;
@@ -165,15 +163,49 @@ function transferValue(type, value) {
165
163
 
166
164
  // src/Description.tsx
167
165
  var import_icons = require("@ant-design/icons");
168
- var import_antd3 = require("antd");
166
+ var import_antd4 = require("antd");
169
167
  var import_lodash_es4 = require("lodash-es");
170
- var import_react3 = require("react");
171
- var import_react4 = require("@faasjs/react");
168
+ var import_react4 = require("react");
169
+
170
+ // src/FaasDataWrapper.tsx
171
+ var import_react3 = require("@faasjs/react");
172
+
173
+ // src/Loading.tsx
174
+ var import_antd2 = require("antd");
175
+ var import_jsx_runtime = require("react/jsx-runtime");
176
+ function Loading(props) {
177
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
178
+ style: {
179
+ ...props.style || {},
180
+ ...!props.size || props.size === "large" ? {
181
+ margin: "20vh auto",
182
+ textAlign: "center"
183
+ } : {}
184
+ },
185
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Spin, {
186
+ size: props.size || "large"
187
+ })
188
+ });
189
+ }
190
+
191
+ // src/FaasDataWrapper.tsx
192
+ var import_antd3 = require("antd");
193
+ var import_jsx_runtime = require("react/jsx-runtime");
194
+ function FaasDataWrapper(props) {
195
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Alert.ErrorBoundary, {
196
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react3.FaasDataWrapper, {
197
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}),
198
+ ...props
199
+ })
200
+ });
201
+ }
202
+
203
+ // src/Description.tsx
172
204
  var import_jsx_runtime = require("react/jsx-runtime");
173
205
  function DescriptionItemContent(props) {
174
206
  var _a;
175
- const [computedProps, setComputedProps] = (0, import_react3.useState)();
176
- (0, import_react3.useEffect)(() => {
207
+ const [computedProps, setComputedProps] = (0, import_react4.useState)();
208
+ (0, import_react4.useEffect)(() => {
177
209
  var _a2, _b;
178
210
  const propsCopy = { ...props };
179
211
  if (!propsCopy.item.title)
@@ -203,7 +235,7 @@ function DescriptionItemContent(props) {
203
235
  return null;
204
236
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
205
237
  if (computedProps.extendTypes[computedProps.item.type].children)
206
- return (0, import_react3.cloneElement)(
238
+ return (0, import_react4.cloneElement)(
207
239
  computedProps.extendTypes[computedProps.item.type].children,
208
240
  {
209
241
  value: computedProps.value,
@@ -217,7 +249,10 @@ function DescriptionItemContent(props) {
217
249
  else
218
250
  throw Error(computedProps.item.type + " requires children or render");
219
251
  if (computedProps.item.children)
220
- return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
252
+ return (0, import_react4.cloneElement)(computedProps.item.children, {
253
+ value: computedProps.value,
254
+ values: computedProps.values
255
+ });
221
256
  if (computedProps.item.render)
222
257
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
223
258
  children: computedProps.item.render(computedProps.value, computedProps.values)
@@ -266,7 +301,7 @@ function DescriptionItemContent(props) {
266
301
  case "object[]":
267
302
  if (!((_a = computedProps.value) == null ? void 0 : _a.length))
268
303
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
304
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Space, {
270
305
  direction: "vertical",
271
306
  children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
272
307
  items: computedProps.item.object,
@@ -280,11 +315,11 @@ function DescriptionItemContent(props) {
280
315
  }
281
316
  function Description(props) {
282
317
  if (!props.faasData)
283
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
318
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Descriptions, {
284
319
  ...props,
285
320
  title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
286
321
  children: props.items.map((item) => {
287
- return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
322
+ return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Descriptions.Item, {
288
323
  label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
289
324
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
290
325
  item,
@@ -295,16 +330,16 @@ function Description(props) {
295
330
  }, item.id) : null;
296
331
  }).filter(Boolean)
297
332
  });
298
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
299
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
333
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
334
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Skeleton, {
300
335
  active: true
301
336
  }),
302
337
  render: ({ data }) => {
303
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
338
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Descriptions, {
304
339
  ...props,
305
340
  title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
306
341
  children: props.items.map((item) => {
307
- return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
342
+ return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Descriptions.Item, {
308
343
  label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
309
344
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
310
345
  item,
@@ -321,7 +356,7 @@ function Description(props) {
321
356
  }
322
357
 
323
358
  // src/Drawer.tsx
324
- var import_antd4 = require("antd");
359
+ var import_antd5 = require("antd");
325
360
  var import_react5 = require("react");
326
361
  var import_jsx_runtime = require("react/jsx-runtime");
327
362
  function useDrawer(init) {
@@ -334,7 +369,7 @@ function useDrawer(init) {
334
369
  ...init
335
370
  });
336
371
  return {
337
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
372
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Drawer, {
338
373
  ...props
339
374
  }),
340
375
  drawerProps: props,
@@ -349,11 +384,11 @@ function useDrawer(init) {
349
384
 
350
385
  // src/Form.tsx
351
386
  var import_react7 = require("@faasjs/react");
352
- var import_antd6 = require("antd");
387
+ var import_antd7 = require("antd");
353
388
  var import_react8 = require("react");
354
389
 
355
390
  // src/FormItem.tsx
356
- var import_antd5 = require("antd");
391
+ var import_antd6 = require("antd");
357
392
  var import_icons2 = require("@ant-design/icons");
358
393
  var import_react6 = require("react");
359
394
  var import_lodash_es5 = require("lodash-es");
@@ -375,13 +410,13 @@ function processProps(propsCopy, config) {
375
410
  required: true,
376
411
  validator: async (_, values) => {
377
412
  if (!values || values.length < 1)
378
- return Promise.reject(Error(`${propsCopy.label || propsCopy.title} ${config.common.required}`));
413
+ return Promise.reject(Error(`${propsCopy.label || propsCopy.title} ${config.required}`));
379
414
  }
380
415
  });
381
416
  else
382
417
  propsCopy.rules.push({
383
418
  required: true,
384
- message: `${propsCopy.label || propsCopy.title} ${config.common.required}`
419
+ message: `${propsCopy.label || propsCopy.title} ${config.required}`
385
420
  });
386
421
  }
387
422
  if (!propsCopy.input)
@@ -408,8 +443,8 @@ function FormItem(props) {
408
443
  var _a;
409
444
  const [computedProps, setComputedProps] = (0, import_react6.useState)();
410
445
  const [extendTypes, setExtendTypes] = (0, import_react6.useState)();
411
- const config = useConfigContext();
412
- const [hidden, setHidden] = (0, import_react6.useState)(false);
446
+ const { common: common2 } = useConfigContext();
447
+ const [hidden, setHidden] = (0, import_react6.useState)(props.hidden || false);
413
448
  (0, import_react6.useEffect)(() => {
414
449
  const propsCopy = { ...props };
415
450
  if (propsCopy.extendTypes) {
@@ -418,61 +453,65 @@ function FormItem(props) {
418
453
  }
419
454
  if (propsCopy.if) {
420
455
  const condition = propsCopy.if;
421
- propsCopy.shouldUpdate = (_, cur) => {
456
+ const originShouldUpdate = propsCopy.shouldUpdate;
457
+ propsCopy.shouldUpdate = (prev, cur) => {
422
458
  const show = condition(cur);
459
+ const shouldUpdate = hidden !== show;
423
460
  setHidden(!show);
424
- return show;
461
+ const origin = originShouldUpdate ? typeof originShouldUpdate === "boolean" ? originShouldUpdate : originShouldUpdate(prev, cur, {}) : true;
462
+ return shouldUpdate || origin;
425
463
  };
426
464
  delete propsCopy.if;
465
+ delete propsCopy.hidden;
427
466
  }
428
- setComputedProps(processProps(propsCopy, config));
467
+ setComputedProps(processProps(propsCopy, common2));
429
468
  }, [props]);
430
469
  if (!computedProps)
431
470
  return null;
432
471
  if (hidden)
433
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
472
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
434
473
  ...computedProps,
435
474
  noStyle: true,
436
475
  rules: [],
437
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
476
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
438
477
  hidden: true
439
478
  })
440
479
  });
441
480
  if (extendTypes && extendTypes[computedProps.type])
442
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
481
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
443
482
  ...computedProps,
444
483
  children: extendTypes[computedProps.type].children
445
484
  });
446
485
  if (computedProps.children)
447
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
486
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
448
487
  ...computedProps,
449
488
  children: computedProps.children
450
489
  });
451
490
  if (computedProps.render)
452
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
491
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
453
492
  ...computedProps,
454
493
  children: computedProps.render()
455
494
  });
456
495
  switch (computedProps.type) {
457
496
  case "string":
458
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
497
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
459
498
  ...computedProps,
460
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
499
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
461
500
  ...computedProps.input
462
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
501
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
463
502
  ...computedProps.input
464
503
  })
465
504
  });
466
505
  case "string[]":
467
506
  if (computedProps.options)
468
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
507
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
469
508
  ...computedProps,
470
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
509
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
471
510
  mode: "multiple",
472
511
  ...computedProps.input
473
512
  })
474
513
  });
475
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
514
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.List, {
476
515
  name: computedProps.name,
477
516
  rules: computedProps.rules,
478
517
  children: (fields, { add, remove }, { errors }) => {
@@ -488,24 +527,24 @@ function FormItem(props) {
488
527
  }),
489
528
  fields.map((field) => {
490
529
  var _a3;
491
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
492
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
530
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
531
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Row, {
493
532
  gutter: 24,
494
533
  style: { flexFlow: "row nowrap" },
495
534
  children: [
496
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
535
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
497
536
  span: 23,
498
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
537
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
499
538
  ...field,
500
539
  noStyle: true,
501
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
540
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
502
541
  ...computedProps.input
503
542
  })
504
543
  })
505
544
  }),
506
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
545
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
507
546
  span: 1,
508
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
547
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
509
548
  danger: true,
510
549
  type: "link",
511
550
  style: { float: "right" },
@@ -517,15 +556,15 @@ function FormItem(props) {
517
556
  })
518
557
  }, field.key);
519
558
  }),
520
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
559
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
521
560
  children: [
522
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
561
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
523
562
  type: "dashed",
524
563
  block: true,
525
564
  onClick: () => add(),
526
565
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
527
566
  }),
528
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
567
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.ErrorList, {
529
568
  errors
530
569
  })
531
570
  ]
@@ -535,25 +574,25 @@ function FormItem(props) {
535
574
  }
536
575
  });
537
576
  case "number":
538
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
577
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
539
578
  ...computedProps,
540
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
579
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
541
580
  ...computedProps.input
542
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
581
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.InputNumber, {
543
582
  style: { width: "100%" },
544
583
  ...computedProps.input
545
584
  })
546
585
  });
547
586
  case "number[]":
548
587
  if (computedProps.options)
549
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
588
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
550
589
  ...computedProps,
551
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
590
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
552
591
  mode: "multiple",
553
592
  ...computedProps.input
554
593
  })
555
594
  });
556
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
595
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.List, {
557
596
  name: computedProps.name,
558
597
  rules: computedProps.rules,
559
598
  children: (fields, { add, remove }, { errors }) => {
@@ -569,25 +608,25 @@ function FormItem(props) {
569
608
  }),
570
609
  fields.map((field) => {
571
610
  var _a3;
572
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
573
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
611
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
612
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Row, {
574
613
  gutter: 24,
575
614
  style: { flexFlow: "row nowrap" },
576
615
  children: [
577
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
616
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
578
617
  span: 23,
579
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
618
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
580
619
  ...field,
581
620
  noStyle: true,
582
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
621
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.InputNumber, {
583
622
  style: { width: "100%" },
584
623
  ...computedProps.input
585
624
  })
586
625
  })
587
626
  }),
588
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
627
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
589
628
  span: 1,
590
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
629
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
591
630
  danger: true,
592
631
  type: "link",
593
632
  style: { float: "right" },
@@ -599,15 +638,15 @@ function FormItem(props) {
599
638
  })
600
639
  }, field.key);
601
640
  }),
602
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
641
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
603
642
  children: [
604
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
643
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
605
644
  type: "dashed",
606
645
  block: true,
607
646
  onClick: () => add(),
608
647
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
609
648
  }),
610
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
649
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.ErrorList, {
611
650
  errors
612
651
  })
613
652
  ]
@@ -617,23 +656,23 @@ function FormItem(props) {
617
656
  }
618
657
  });
619
658
  case "boolean":
620
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
659
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
621
660
  ...computedProps,
622
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
661
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Switch, {
623
662
  ...computedProps.input
624
663
  })
625
664
  });
626
665
  case "date":
627
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
666
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
628
667
  ...computedProps,
629
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.DatePicker, {
668
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.DatePicker, {
630
669
  ...computedProps.input
631
670
  })
632
671
  });
633
672
  case "time":
634
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
673
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
635
674
  ...computedProps,
636
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.TimePicker, {
675
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.TimePicker, {
637
676
  ...computedProps.input
638
677
  })
639
678
  });
@@ -653,12 +692,12 @@ function FormItem(props) {
653
692
  ]
654
693
  });
655
694
  case "object[]":
656
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
695
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.List, {
657
696
  name: computedProps.name,
658
697
  rules: computedProps.rules,
659
698
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
660
699
  children: [
661
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
700
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
662
701
  style: { marginBottom: 0 },
663
702
  children: [
664
703
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -668,18 +707,18 @@ function FormItem(props) {
668
707
  computedProps.label,
669
708
  " ",
670
709
  field.name + 1,
671
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
710
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
672
711
  danger: true,
673
712
  type: "link",
674
713
  onClick: () => remove(field.name),
675
- children: config.common.delete
714
+ children: common2.delete
676
715
  })
677
716
  ]
678
717
  })
679
718
  }),
680
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
719
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Row, {
681
720
  gutter: 24,
682
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
721
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
683
722
  span: o.col || 24,
684
723
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
685
724
  ...o,
@@ -689,20 +728,20 @@ function FormItem(props) {
689
728
  })
690
729
  ]
691
730
  }, field.key)),
692
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
731
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
693
732
  children: [
694
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
733
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Button, {
695
734
  type: "dashed",
696
735
  block: true,
697
736
  onClick: () => add(),
698
737
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
699
738
  children: [
700
- config.common.add,
739
+ common2.add,
701
740
  " ",
702
741
  computedProps.label
703
742
  ]
704
743
  }),
705
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
744
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.ErrorList, {
706
745
  errors
707
746
  })
708
747
  ]
@@ -714,6 +753,7 @@ function FormItem(props) {
714
753
  return null;
715
754
  }
716
755
  }
756
+ FormItem.useStatus = import_antd6.Form.Item.useStatus;
717
757
 
718
758
  // src/Form.tsx
719
759
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -723,20 +763,28 @@ function Form(props) {
723
763
  const [computedProps, setComputedProps] = (0, import_react8.useState)();
724
764
  const config = useConfigContext();
725
765
  const [extendTypes, setExtendTypes] = (0, import_react8.useState)();
726
- const [form] = import_antd6.Form.useForm(props.form);
766
+ const [form] = import_antd7.Form.useForm(props.form);
727
767
  const [initialValues, setInitialValues] = (0, import_react8.useState)(props.initialValues);
728
768
  (0, import_react8.useEffect)(() => {
729
- var _a2, _b2;
769
+ var _a2, _b2, _c;
730
770
  const propsCopy = {
731
771
  ...props,
732
772
  form
733
773
  };
734
- if (propsCopy.initialValues) {
735
- for (const key in propsCopy.initialValues)
774
+ if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
775
+ for (const key in propsCopy.initialValues) {
736
776
  propsCopy.initialValues[key] = transferValue(
737
- (_a2 = propsCopy.items.find((item) => item.id === key)) == null ? void 0 : _a2.type,
777
+ (_b2 = propsCopy.items.find((item2) => item2.id === key)) == null ? void 0 : _b2.type,
738
778
  propsCopy.initialValues[key]
739
779
  );
780
+ const item = propsCopy.items.find((item2) => item2.id === key);
781
+ if (item == null ? void 0 : item.if)
782
+ item.hidden = !item.if(propsCopy.initialValues);
783
+ }
784
+ for (const item of propsCopy.items) {
785
+ if (item.if)
786
+ item.hidden = !item.if(propsCopy.initialValues);
787
+ }
740
788
  setInitialValues(propsCopy.initialValues);
741
789
  delete propsCopy.initialValues;
742
790
  }
@@ -757,13 +805,25 @@ function Form(props) {
757
805
  }
758
806
  setLoading(false);
759
807
  };
760
- } else if (propsCopy.submit && ((_b2 = propsCopy.submit.to) == null ? void 0 : _b2.action)) {
808
+ } else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
761
809
  propsCopy.onFinish = async (values) => {
762
810
  setLoading(true);
763
811
  return (0, import_react7.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
764
812
  ...values,
765
813
  ...propsCopy.submit.to.params
766
- } : values).finally(() => setLoading(false));
814
+ } : values).then((result) => {
815
+ if (propsCopy.submit.to.then)
816
+ propsCopy.submit.to.then(result);
817
+ return result;
818
+ }).catch((error) => {
819
+ if (propsCopy.submit.to.catch)
820
+ propsCopy.submit.to.catch(error);
821
+ return Promise.reject(error);
822
+ }).finally(() => {
823
+ if (propsCopy.submit.to.finally)
824
+ propsCopy.submit.to.finally();
825
+ setLoading(false);
826
+ });
767
827
  };
768
828
  }
769
829
  if (propsCopy.extendTypes) {
@@ -773,6 +833,7 @@ function Form(props) {
773
833
  setComputedProps(propsCopy);
774
834
  }, [props]);
775
835
  const onValuesChange = (0, import_react8.useCallback)((changedValues, allValues) => {
836
+ console.debug("Form:onValuesChange", changedValues, allValues);
776
837
  if (props.onValuesChange) {
777
838
  props.onValuesChange(changedValues, allValues);
778
839
  }
@@ -787,22 +848,23 @@ function Form(props) {
787
848
  (0, import_react8.useEffect)(() => {
788
849
  if (!initialValues)
789
850
  return;
851
+ console.debug("Form:initialValues", initialValues);
790
852
  form.setFieldsValue(initialValues);
791
853
  setInitialValues(null);
792
854
  }, [computedProps]);
793
855
  if (!computedProps)
794
856
  return null;
795
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
857
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd7.Form, {
796
858
  ...computedProps,
797
859
  onValuesChange,
798
860
  children: [
799
861
  computedProps.beforeItems,
800
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
862
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react8.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
801
863
  ...item,
802
864
  extendTypes
803
865
  }, item.id)),
804
866
  computedProps.children,
805
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
867
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
806
868
  htmlType: "submit",
807
869
  type: "primary",
808
870
  loading,
@@ -812,11 +874,17 @@ function Form(props) {
812
874
  ]
813
875
  });
814
876
  }
815
- Form.useForm = import_antd6.Form.useForm;
877
+ Form.useForm = import_antd7.Form.useForm;
878
+ Form.useFormInstance = import_antd7.Form.useFormInstance;
879
+ Form.useWatch = import_antd7.Form.useWatch;
880
+ Form.Item = FormItem;
881
+ Form.List = import_antd7.Form.List;
882
+ Form.ErrorList = import_antd7.Form.ErrorList;
883
+ Form.Provider = import_antd7.Form.Provider;
816
884
 
817
885
  // src/Link.tsx
818
886
  var import_react_router_dom = require("react-router-dom");
819
- var import_antd7 = require("antd");
887
+ var import_antd8 = require("antd");
820
888
  var import_jsx_runtime = require("react/jsx-runtime");
821
889
  function Link({
822
890
  href,
@@ -830,17 +898,15 @@ function Link({
830
898
  style = Object.assign({ cursor: "pointer" }, style);
831
899
  if (href.startsWith("http")) {
832
900
  if (button)
833
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
901
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
834
902
  ...button,
835
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
836
- href,
837
- target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
838
- style: {
839
- ...Link2.style,
840
- ...style || {}
841
- },
842
- children: text || children
843
- })
903
+ target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
904
+ style: {
905
+ ...Link2.style,
906
+ ...style || {}
907
+ },
908
+ href,
909
+ children: text != null ? text : children
844
910
  });
845
911
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
846
912
  href,
@@ -849,20 +915,20 @@ function Link({
849
915
  ...Link2.style,
850
916
  ...style || {}
851
917
  },
852
- children: text || children
918
+ children: text != null ? text : children
853
919
  });
854
920
  }
855
921
  if (button)
856
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
857
- ...button,
858
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
859
- to: href,
860
- target: target || (Link2 == null ? void 0 : Link2.target),
922
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
923
+ to: href,
924
+ target: target || (Link2 == null ? void 0 : Link2.target),
925
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
926
+ ...button,
861
927
  style: {
862
928
  ...Link2.style,
863
929
  ...style || {}
864
930
  },
865
- children: text || children
931
+ children: text != null ? text : children
866
932
  })
867
933
  });
868
934
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
@@ -872,12 +938,12 @@ function Link({
872
938
  ...Link2.style,
873
939
  ...style || {}
874
940
  },
875
- children: text || children
941
+ children: text != null ? text : children
876
942
  });
877
943
  }
878
944
 
879
945
  // src/Modal.tsx
880
- var import_antd8 = require("antd");
946
+ var import_antd9 = require("antd");
881
947
  var import_react9 = require("react");
882
948
  var import_jsx_runtime = require("react/jsx-runtime");
883
949
  function useModal(init) {
@@ -890,7 +956,7 @@ function useModal(init) {
890
956
  ...init
891
957
  });
892
958
  return {
893
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
959
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Modal, {
894
960
  ...props
895
961
  }),
896
962
  modalProps: props,
@@ -904,47 +970,48 @@ function useModal(init) {
904
970
  }
905
971
 
906
972
  // src/Routers.tsx
907
- var import_antd9 = require("antd");
973
+ var import_antd10 = require("antd");
908
974
  var import_react10 = require("react");
909
975
  var import_react_router_dom2 = require("react-router-dom");
910
976
  var import_jsx_runtime = require("react/jsx-runtime");
911
977
  function PageNotFound() {
912
978
  const config = useConfigContext();
913
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
979
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Result, {
914
980
  status: "404",
915
981
  title: config.common.pageNotFound
916
982
  });
917
983
  }
918
984
  function Routes(props) {
919
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
920
- children: [
921
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
922
- ...r,
923
- element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react10.Suspense, {
924
- fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
925
- style: { padding: "24px" },
926
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
927
- active: true
928
- })
929
- }),
930
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
931
- })
932
- }, r.path)),
933
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
934
- path: "*",
935
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
936
- }, "*")
937
- ]
985
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Alert.ErrorBoundary, {
986
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
987
+ children: [
988
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
989
+ ...r,
990
+ element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react10.Suspense, {
991
+ fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
992
+ style: { padding: "24px" },
993
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
994
+ active: true
995
+ })
996
+ }),
997
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
998
+ })
999
+ }, r.path)),
1000
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
1001
+ path: "*",
1002
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
1003
+ }, "*")
1004
+ ]
1005
+ })
938
1006
  });
939
1007
  }
940
1008
 
941
1009
  // src/Table.tsx
942
1010
  var import_react11 = require("react");
943
- var import_antd10 = require("antd");
1011
+ var import_antd11 = require("antd");
944
1012
  var import_dayjs2 = __toESM(require("dayjs"));
945
1013
  var import_icons3 = require("@ant-design/icons");
946
1014
  var import_lodash_es6 = require("lodash-es");
947
- var import_react12 = require("@faasjs/react");
948
1015
  var import_jsx_runtime = require("react/jsx-runtime");
949
1016
  function processValue(item, value) {
950
1017
  var _a;
@@ -989,10 +1056,19 @@ function Table(props) {
989
1056
  item.filters = item.options.map((o) => ({
990
1057
  text: o.label,
991
1058
  value: o.value
992
- }));
1059
+ })).concat({
1060
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1061
+ value: null
1062
+ });
993
1063
  }
994
1064
  if (item.children)
995
- delete item.children;
1065
+ item.render = (value, values) => (0, import_react11.cloneElement)(
1066
+ item.children,
1067
+ {
1068
+ value,
1069
+ values
1070
+ }
1071
+ );
996
1072
  if (props.extendTypes && props.extendTypes[item.type]) {
997
1073
  if (props.extendTypes[item.type].children)
998
1074
  item.render = (value, values) => (0, import_react11.cloneElement)(
@@ -1025,7 +1101,7 @@ function Table(props) {
1025
1101
  setSelectedKeys,
1026
1102
  confirm,
1027
1103
  clearFilters
1028
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1104
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1029
1105
  placeholder: `${common2.search} ${item.title}`,
1030
1106
  allowClear: true,
1031
1107
  onSearch: (v) => {
@@ -1055,7 +1131,7 @@ function Table(props) {
1055
1131
  setSelectedKeys,
1056
1132
  confirm,
1057
1133
  clearFilters
1058
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1134
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1059
1135
  placeholder: `${common2.search} ${item.title}`,
1060
1136
  allowClear: true,
1061
1137
  onSearch: (v) => {
@@ -1078,14 +1154,14 @@ function Table(props) {
1078
1154
  item.onFilter = (value, row) => {
1079
1155
  if (value === null && (0, import_lodash_es6.isNil)(row[item.id]))
1080
1156
  return true;
1081
- return value === row[item.id];
1157
+ return value == row[item.id];
1082
1158
  };
1083
1159
  if (!item.filters && item.filterDropdown !== false)
1084
1160
  item.filterDropdown = ({
1085
1161
  setSelectedKeys,
1086
1162
  confirm,
1087
1163
  clearFilters
1088
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1164
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1089
1165
  placeholder: `${common2.search} ${item.title}`,
1090
1166
  allowClear: true,
1091
1167
  onSearch: (v) => {
@@ -1108,14 +1184,14 @@ function Table(props) {
1108
1184
  return true;
1109
1185
  if (!row[item.id] || !row[item.id].length)
1110
1186
  return false;
1111
- return row[item.id].includes(value);
1187
+ return row[item.id].includes(Number(value));
1112
1188
  };
1113
1189
  if (!item.filters && item.filterDropdown !== false)
1114
1190
  item.filterDropdown = ({
1115
1191
  setSelectedKeys,
1116
1192
  confirm,
1117
1193
  clearFilters
1118
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1194
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1119
1195
  placeholder: `${common2.search} ${item.title}`,
1120
1196
  allowClear: true,
1121
1197
  onSearch: (v) => {
@@ -1147,7 +1223,7 @@ function Table(props) {
1147
1223
  setSelectedKeys,
1148
1224
  selectedKeys,
1149
1225
  confirm
1150
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
1226
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd11.Radio.Group, {
1151
1227
  style: { padding: 8 },
1152
1228
  buttonStyle: "solid",
1153
1229
  value: selectedKeys[0],
@@ -1156,10 +1232,10 @@ function Table(props) {
1156
1232
  confirm();
1157
1233
  },
1158
1234
  children: [
1159
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1160
1236
  children: common2.all
1161
1237
  }),
1162
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1238
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1163
1239
  value: "true",
1164
1240
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1165
1241
  style: {
@@ -1168,7 +1244,7 @@ function Table(props) {
1168
1244
  }
1169
1245
  })
1170
1246
  }),
1171
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1247
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1172
1248
  value: "false",
1173
1249
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1174
1250
  style: {
@@ -1177,7 +1253,7 @@ function Table(props) {
1177
1253
  }
1178
1254
  })
1179
1255
  }),
1180
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1181
1257
  value: "empty",
1182
1258
  children: common2.blank
1183
1259
  })
@@ -1248,92 +1324,136 @@ function Table(props) {
1248
1324
  return;
1249
1325
  for (const column of columns) {
1250
1326
  if (column.optionsType === "auto" && !column.options && !column.filters) {
1251
- setColumns((prev) => {
1252
- const newColumns = [...prev];
1253
- const index = newColumns.findIndex((item) => item.id === column.id);
1254
- newColumns[index].filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
1255
- text: v[column.id],
1256
- value: v[column.id]
1257
- })).concat({
1258
- text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1259
- value: null
1327
+ const filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
1328
+ text: v[column.id],
1329
+ value: v[column.id]
1330
+ }));
1331
+ if (filters.length)
1332
+ setColumns((prev) => {
1333
+ const newColumns = [...prev];
1334
+ const index = newColumns.findIndex((item) => item.id === column.id);
1335
+ newColumns[index].filters = filters.concat({
1336
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1337
+ value: null
1338
+ });
1339
+ return newColumns;
1260
1340
  });
1261
- return newColumns;
1262
- });
1263
1341
  }
1264
1342
  }
1265
1343
  }, [props.dataSource, columns]);
1266
1344
  if (!columns)
1267
1345
  return null;
1268
1346
  if (!props.faasData)
1269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1347
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1270
1348
  ...props,
1271
1349
  rowKey: props.rowKey || "id",
1272
1350
  columns,
1273
1351
  dataSource: props.dataSource
1274
1352
  });
1275
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react12.FaasDataWrapper, {
1276
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1353
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
1354
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Skeleton, {
1277
1355
  active: true
1278
1356
  }),
1279
- render: ({
1280
- data,
1281
- params,
1282
- reload
1283
- }) => {
1284
- if (!data)
1285
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1286
- ...props,
1287
- rowKey: props.rowKey || "id",
1288
- columns,
1289
- dataSource: []
1290
- });
1291
- if (Array.isArray(data))
1292
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1293
- ...props,
1294
- rowKey: props.rowKey || "id",
1295
- columns,
1296
- dataSource: data
1297
- });
1298
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1299
- ...props,
1300
- rowKey: props.rowKey || "id",
1301
- columns,
1302
- dataSource: data.rows,
1303
- pagination: {
1304
- ...props.pagination,
1305
- ...data.pagination
1306
- },
1307
- onChange: (pagination, filters, sorter, extra) => {
1308
- if (props.onChange) {
1309
- const processed = props.onChange(pagination, filters, sorter, extra);
1310
- reload({
1311
- ...params,
1312
- pagination: processed.pagination,
1313
- filters: processed.filters,
1314
- sorter: processed.sorter
1315
- });
1316
- return;
1317
- }
1318
- reload({
1319
- ...params,
1320
- pagination,
1321
- filters,
1322
- sorter
1357
+ ...props.faasData,
1358
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataTable, {
1359
+ props,
1360
+ columns
1361
+ })
1362
+ });
1363
+ }
1364
+ function FaasDataTable({
1365
+ props,
1366
+ columns,
1367
+ data,
1368
+ params,
1369
+ reload
1370
+ }) {
1371
+ const [currentColumns, setCurrentColumns] = (0, import_react11.useState)(columns);
1372
+ (0, import_react11.useEffect)(() => {
1373
+ if (!data || Array.isArray(data))
1374
+ return;
1375
+ setCurrentColumns((prev) => {
1376
+ const newColumns = [...prev];
1377
+ for (const column of newColumns) {
1378
+ if (data["options"] && data.options[column.id]) {
1379
+ column.options = data["options"][column.id];
1380
+ column.filters = data["options"][column.id].map((v) => ({
1381
+ text: v.label,
1382
+ value: v.value
1383
+ })).concat({
1384
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1385
+ value: null
1323
1386
  });
1387
+ column.render = (value) => processValue(column, value);
1388
+ if (column.filterDropdown)
1389
+ delete column.filterDropdown;
1390
+ continue;
1324
1391
  }
1325
- });
1392
+ if (column.optionsType === "auto" && !column.options && !column.filters) {
1393
+ const filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
1394
+ text: v[column.id],
1395
+ value: v[column.id]
1396
+ }));
1397
+ if (filters.length)
1398
+ column.filters = filters.concat({
1399
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1400
+ value: null
1401
+ });
1402
+ }
1403
+ }
1404
+ return newColumns;
1405
+ });
1406
+ }, [columns, data]);
1407
+ if (!data)
1408
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1409
+ ...props,
1410
+ rowKey: props.rowKey || "id",
1411
+ columns: currentColumns,
1412
+ dataSource: []
1413
+ });
1414
+ if (Array.isArray(data))
1415
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1416
+ ...props,
1417
+ rowKey: props.rowKey || "id",
1418
+ columns: currentColumns,
1419
+ dataSource: data
1420
+ });
1421
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1422
+ ...props,
1423
+ rowKey: props.rowKey || "id",
1424
+ columns: currentColumns,
1425
+ dataSource: data.rows,
1426
+ pagination: {
1427
+ ...props.pagination,
1428
+ ...data.pagination
1326
1429
  },
1327
- ...props.faasData
1430
+ onChange: (pagination, filters, sorter, extra) => {
1431
+ if (props.onChange) {
1432
+ const processed = props.onChange(pagination, filters, sorter, extra);
1433
+ reload({
1434
+ ...params,
1435
+ pagination: processed.pagination,
1436
+ filters: processed.filters,
1437
+ sorter: processed.sorter
1438
+ });
1439
+ return;
1440
+ }
1441
+ reload({
1442
+ ...params,
1443
+ pagination,
1444
+ filters,
1445
+ sorter
1446
+ });
1447
+ }
1328
1448
  });
1329
1449
  }
1330
1450
 
1331
1451
  // src/Title.tsx
1332
- var import_react13 = require("react");
1452
+ var import_react12 = require("react");
1333
1453
  var import_jsx_runtime = require("react/jsx-runtime");
1334
1454
  function Title(props) {
1335
1455
  const { Title: Title2 } = useConfigContext();
1336
- (0, import_react13.useEffect)(() => {
1456
+ (0, import_react12.useEffect)(() => {
1337
1457
  const title = Array.isArray(props.title) ? props.title : [props.title];
1338
1458
  document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1339
1459
  }, [props]);
@@ -1353,7 +1473,7 @@ function Title(props) {
1353
1473
  children: Array.isArray(props.title) ? props.title[0] : props.title
1354
1474
  });
1355
1475
  if (props.children)
1356
- return (0, import_react13.cloneElement)(props.children, { title: props.title });
1476
+ return (0, import_react12.cloneElement)(props.children, { title: props.title });
1357
1477
  return null;
1358
1478
  }
1359
1479
  // Annotate the CommonJS export names for ESM import in node:
@@ -1363,9 +1483,11 @@ function Title(props) {
1363
1483
  ConfigProvider,
1364
1484
  Description,
1365
1485
  Drawer,
1486
+ FaasDataWrapper,
1366
1487
  Form,
1367
1488
  FormItem,
1368
1489
  Link,
1490
+ Loading,
1369
1491
  Modal,
1370
1492
  PageNotFound,
1371
1493
  Routes,