@faasjs/ant-design 0.0.3-beta.2 → 0.0.3-beta.21

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,11 @@ __export(src_exports, {
30
30
  ConfigContext: () => ConfigContext,
31
31
  ConfigProvider: () => ConfigProvider,
32
32
  Description: () => Description,
33
- Drawer: () => import_antd4.Drawer,
33
+ Drawer: () => import_antd3.Drawer,
34
34
  Form: () => Form,
35
35
  FormItem: () => FormItem,
36
36
  Link: () => Link,
37
- Modal: () => import_antd8.Modal,
37
+ Modal: () => import_antd7.Modal,
38
38
  PageNotFound: () => PageNotFound,
39
39
  Routes: () => Routes,
40
40
  Table: () => Table,
@@ -51,12 +51,11 @@ module.exports = __toCommonJS(src_exports);
51
51
  var import_react = __toESM(require("react"));
52
52
 
53
53
  // src/Blank.tsx
54
- var import_antd2 = require("antd");
54
+ var import_antd = require("antd");
55
55
  var import_lodash_es2 = require("lodash-es");
56
56
 
57
57
  // src/Config.tsx
58
58
  var import_react2 = require("react");
59
- var import_antd = require("antd");
60
59
  var import_lodash_es = require("lodash-es");
61
60
  var import_jsx_runtime = require("react/jsx-runtime");
62
61
  var isZH = /^zh/i.test(navigator.language);
@@ -116,10 +115,7 @@ function ConfigProvider({
116
115
  }, []);
117
116
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
118
117
  value: values,
119
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
120
- ...config.antd,
121
- children
122
- })
118
+ children
123
119
  });
124
120
  }
125
121
  function useConfigContext() {
@@ -130,7 +126,7 @@ function useConfigContext() {
130
126
  var import_jsx_runtime = require("react/jsx-runtime");
131
127
  function Blank(options) {
132
128
  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, {
129
+ 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
130
  disabled: true,
135
131
  children: (options == null ? void 0 : options.text) || Blank2.text
136
132
  }) : options.value;
@@ -165,7 +161,7 @@ function transferValue(type, value) {
165
161
 
166
162
  // src/Description.tsx
167
163
  var import_icons = require("@ant-design/icons");
168
- var import_antd3 = require("antd");
164
+ var import_antd2 = require("antd");
169
165
  var import_lodash_es4 = require("lodash-es");
170
166
  var import_react3 = require("react");
171
167
  var import_react4 = require("@faasjs/react");
@@ -217,7 +213,10 @@ function DescriptionItemContent(props) {
217
213
  else
218
214
  throw Error(computedProps.item.type + " requires children or render");
219
215
  if (computedProps.item.children)
220
- return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
216
+ return (0, import_react3.cloneElement)(computedProps.item.children, {
217
+ value: computedProps.value,
218
+ values: computedProps.values
219
+ });
221
220
  if (computedProps.item.render)
222
221
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
223
222
  children: computedProps.item.render(computedProps.value, computedProps.values)
@@ -266,7 +265,7 @@ function DescriptionItemContent(props) {
266
265
  case "object[]":
267
266
  if (!((_a = computedProps.value) == null ? void 0 : _a.length))
268
267
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
268
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Space, {
270
269
  direction: "vertical",
271
270
  children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
272
271
  items: computedProps.item.object,
@@ -280,11 +279,11 @@ function DescriptionItemContent(props) {
280
279
  }
281
280
  function Description(props) {
282
281
  if (!props.faasData)
283
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
282
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
284
283
  ...props,
285
284
  title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
286
285
  children: props.items.map((item) => {
287
- return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
286
+ return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
288
287
  label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
289
288
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
290
289
  item,
@@ -296,15 +295,15 @@ function Description(props) {
296
295
  }).filter(Boolean)
297
296
  });
298
297
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
299
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
298
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Skeleton, {
300
299
  active: true
301
300
  }),
302
301
  render: ({ data }) => {
303
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
302
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
304
303
  ...props,
305
304
  title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
306
305
  children: props.items.map((item) => {
307
- return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
306
+ return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
308
307
  label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
309
308
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
310
309
  item,
@@ -321,7 +320,7 @@ function Description(props) {
321
320
  }
322
321
 
323
322
  // src/Drawer.tsx
324
- var import_antd4 = require("antd");
323
+ var import_antd3 = require("antd");
325
324
  var import_react5 = require("react");
326
325
  var import_jsx_runtime = require("react/jsx-runtime");
327
326
  function useDrawer(init) {
@@ -334,7 +333,7 @@ function useDrawer(init) {
334
333
  ...init
335
334
  });
336
335
  return {
337
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
336
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Drawer, {
338
337
  ...props
339
338
  }),
340
339
  drawerProps: props,
@@ -349,11 +348,11 @@ function useDrawer(init) {
349
348
 
350
349
  // src/Form.tsx
351
350
  var import_react7 = require("@faasjs/react");
352
- var import_antd6 = require("antd");
351
+ var import_antd5 = require("antd");
353
352
  var import_react8 = require("react");
354
353
 
355
354
  // src/FormItem.tsx
356
- var import_antd5 = require("antd");
355
+ var import_antd4 = require("antd");
357
356
  var import_icons2 = require("@ant-design/icons");
358
357
  var import_react6 = require("react");
359
358
  var import_lodash_es5 = require("lodash-es");
@@ -375,13 +374,13 @@ function processProps(propsCopy, config) {
375
374
  required: true,
376
375
  validator: async (_, values) => {
377
376
  if (!values || values.length < 1)
378
- return Promise.reject(Error(`${propsCopy.label || propsCopy.title} ${config.common.required}`));
377
+ return Promise.reject(Error(`${propsCopy.label || propsCopy.title} ${config.required}`));
379
378
  }
380
379
  });
381
380
  else
382
381
  propsCopy.rules.push({
383
382
  required: true,
384
- message: `${propsCopy.label || propsCopy.title} ${config.common.required}`
383
+ message: `${propsCopy.label || propsCopy.title} ${config.required}`
385
384
  });
386
385
  }
387
386
  if (!propsCopy.input)
@@ -408,8 +407,8 @@ function FormItem(props) {
408
407
  var _a;
409
408
  const [computedProps, setComputedProps] = (0, import_react6.useState)();
410
409
  const [extendTypes, setExtendTypes] = (0, import_react6.useState)();
411
- const config = useConfigContext();
412
- const [hidden, setHidden] = (0, import_react6.useState)(false);
410
+ const { common: common2 } = useConfigContext();
411
+ const [hidden, setHidden] = (0, import_react6.useState)(props.hidden || false);
413
412
  (0, import_react6.useEffect)(() => {
414
413
  const propsCopy = { ...props };
415
414
  if (propsCopy.extendTypes) {
@@ -418,61 +417,65 @@ function FormItem(props) {
418
417
  }
419
418
  if (propsCopy.if) {
420
419
  const condition = propsCopy.if;
421
- propsCopy.shouldUpdate = (_, cur) => {
420
+ const originShouldUpdate = propsCopy.shouldUpdate;
421
+ propsCopy.shouldUpdate = (prev, cur) => {
422
422
  const show = condition(cur);
423
+ const shouldUpdate = hidden !== show;
423
424
  setHidden(!show);
424
- return show;
425
+ const origin = originShouldUpdate ? typeof originShouldUpdate === "boolean" ? originShouldUpdate : originShouldUpdate(prev, cur, {}) : true;
426
+ return shouldUpdate || origin;
425
427
  };
426
428
  delete propsCopy.if;
429
+ delete propsCopy.hidden;
427
430
  }
428
- setComputedProps(processProps(propsCopy, config));
431
+ setComputedProps(processProps(propsCopy, common2));
429
432
  }, [props]);
430
433
  if (!computedProps)
431
434
  return null;
432
435
  if (hidden)
433
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
436
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
434
437
  ...computedProps,
435
438
  noStyle: true,
436
439
  rules: [],
437
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
440
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
438
441
  hidden: true
439
442
  })
440
443
  });
441
444
  if (extendTypes && extendTypes[computedProps.type])
442
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
445
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
443
446
  ...computedProps,
444
447
  children: extendTypes[computedProps.type].children
445
448
  });
446
449
  if (computedProps.children)
447
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
450
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
448
451
  ...computedProps,
449
452
  children: computedProps.children
450
453
  });
451
454
  if (computedProps.render)
452
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
455
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
453
456
  ...computedProps,
454
457
  children: computedProps.render()
455
458
  });
456
459
  switch (computedProps.type) {
457
460
  case "string":
458
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
461
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
459
462
  ...computedProps,
460
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
463
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
461
464
  ...computedProps.input
462
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
465
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
463
466
  ...computedProps.input
464
467
  })
465
468
  });
466
469
  case "string[]":
467
470
  if (computedProps.options)
468
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
471
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
469
472
  ...computedProps,
470
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
473
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
471
474
  mode: "multiple",
472
475
  ...computedProps.input
473
476
  })
474
477
  });
475
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
478
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
476
479
  name: computedProps.name,
477
480
  rules: computedProps.rules,
478
481
  children: (fields, { add, remove }, { errors }) => {
@@ -488,24 +491,24 @@ function FormItem(props) {
488
491
  }),
489
492
  fields.map((field) => {
490
493
  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, {
494
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
495
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
493
496
  gutter: 24,
494
497
  style: { flexFlow: "row nowrap" },
495
498
  children: [
496
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
499
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
497
500
  span: 23,
498
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
501
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
499
502
  ...field,
500
503
  noStyle: true,
501
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
504
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
502
505
  ...computedProps.input
503
506
  })
504
507
  })
505
508
  }),
506
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
509
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
507
510
  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, {
511
+ 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_antd4.Button, {
509
512
  danger: true,
510
513
  type: "link",
511
514
  style: { float: "right" },
@@ -517,15 +520,15 @@ function FormItem(props) {
517
520
  })
518
521
  }, field.key);
519
522
  }),
520
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
523
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
521
524
  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, {
525
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
523
526
  type: "dashed",
524
527
  block: true,
525
528
  onClick: () => add(),
526
529
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
527
530
  }),
528
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
531
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
529
532
  errors
530
533
  })
531
534
  ]
@@ -535,25 +538,25 @@ function FormItem(props) {
535
538
  }
536
539
  });
537
540
  case "number":
538
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
541
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
539
542
  ...computedProps,
540
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
543
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
541
544
  ...computedProps.input
542
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
545
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
543
546
  style: { width: "100%" },
544
547
  ...computedProps.input
545
548
  })
546
549
  });
547
550
  case "number[]":
548
551
  if (computedProps.options)
549
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
552
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
550
553
  ...computedProps,
551
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
554
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
552
555
  mode: "multiple",
553
556
  ...computedProps.input
554
557
  })
555
558
  });
556
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
559
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
557
560
  name: computedProps.name,
558
561
  rules: computedProps.rules,
559
562
  children: (fields, { add, remove }, { errors }) => {
@@ -569,25 +572,25 @@ function FormItem(props) {
569
572
  }),
570
573
  fields.map((field) => {
571
574
  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, {
575
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
576
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
574
577
  gutter: 24,
575
578
  style: { flexFlow: "row nowrap" },
576
579
  children: [
577
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
580
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
578
581
  span: 23,
579
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
582
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
580
583
  ...field,
581
584
  noStyle: true,
582
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
585
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
583
586
  style: { width: "100%" },
584
587
  ...computedProps.input
585
588
  })
586
589
  })
587
590
  }),
588
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
591
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
589
592
  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, {
593
+ 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_antd4.Button, {
591
594
  danger: true,
592
595
  type: "link",
593
596
  style: { float: "right" },
@@ -599,15 +602,15 @@ function FormItem(props) {
599
602
  })
600
603
  }, field.key);
601
604
  }),
602
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
605
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
603
606
  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, {
607
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
605
608
  type: "dashed",
606
609
  block: true,
607
610
  onClick: () => add(),
608
611
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
609
612
  }),
610
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
613
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
611
614
  errors
612
615
  })
613
616
  ]
@@ -617,23 +620,23 @@ function FormItem(props) {
617
620
  }
618
621
  });
619
622
  case "boolean":
620
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
623
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
621
624
  ...computedProps,
622
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
625
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Switch, {
623
626
  ...computedProps.input
624
627
  })
625
628
  });
626
629
  case "date":
627
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
630
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
628
631
  ...computedProps,
629
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.DatePicker, {
632
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.DatePicker, {
630
633
  ...computedProps.input
631
634
  })
632
635
  });
633
636
  case "time":
634
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
637
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
635
638
  ...computedProps,
636
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.TimePicker, {
639
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.TimePicker, {
637
640
  ...computedProps.input
638
641
  })
639
642
  });
@@ -653,12 +656,12 @@ function FormItem(props) {
653
656
  ]
654
657
  });
655
658
  case "object[]":
656
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
659
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
657
660
  name: computedProps.name,
658
661
  rules: computedProps.rules,
659
662
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
660
663
  children: [
661
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
664
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
662
665
  style: { marginBottom: 0 },
663
666
  children: [
664
667
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -668,18 +671,18 @@ function FormItem(props) {
668
671
  computedProps.label,
669
672
  " ",
670
673
  field.name + 1,
671
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
674
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
672
675
  danger: true,
673
676
  type: "link",
674
677
  onClick: () => remove(field.name),
675
- children: config.common.delete
678
+ children: common2.delete
676
679
  })
677
680
  ]
678
681
  })
679
682
  }),
680
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
683
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Row, {
681
684
  gutter: 24,
682
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
685
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
683
686
  span: o.col || 24,
684
687
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
685
688
  ...o,
@@ -689,20 +692,20 @@ function FormItem(props) {
689
692
  })
690
693
  ]
691
694
  }, field.key)),
692
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
695
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
693
696
  children: [
694
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
697
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Button, {
695
698
  type: "dashed",
696
699
  block: true,
697
700
  onClick: () => add(),
698
701
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
699
702
  children: [
700
- config.common.add,
703
+ common2.add,
701
704
  " ",
702
705
  computedProps.label
703
706
  ]
704
707
  }),
705
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
708
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
706
709
  errors
707
710
  })
708
711
  ]
@@ -723,7 +726,7 @@ function Form(props) {
723
726
  const [computedProps, setComputedProps] = (0, import_react8.useState)();
724
727
  const config = useConfigContext();
725
728
  const [extendTypes, setExtendTypes] = (0, import_react8.useState)();
726
- const [form] = import_antd6.Form.useForm(props.form);
729
+ const [form] = import_antd5.Form.useForm(props.form);
727
730
  const [initialValues, setInitialValues] = (0, import_react8.useState)(props.initialValues);
728
731
  (0, import_react8.useEffect)(() => {
729
732
  var _a2, _b2;
@@ -732,11 +735,19 @@ function Form(props) {
732
735
  form
733
736
  };
734
737
  if (propsCopy.initialValues) {
735
- for (const key in propsCopy.initialValues)
738
+ for (const key in propsCopy.initialValues) {
736
739
  propsCopy.initialValues[key] = transferValue(
737
- (_a2 = propsCopy.items.find((item) => item.id === key)) == null ? void 0 : _a2.type,
740
+ (_a2 = propsCopy.items.find((item2) => item2.id === key)) == null ? void 0 : _a2.type,
738
741
  propsCopy.initialValues[key]
739
742
  );
743
+ const item = propsCopy.items.find((item2) => item2.id === key);
744
+ if (item == null ? void 0 : item.if)
745
+ item.hidden = !item.if(propsCopy.initialValues);
746
+ }
747
+ for (const item of propsCopy.items) {
748
+ if (item.if)
749
+ item.hidden = !item.if(propsCopy.initialValues);
750
+ }
740
751
  setInitialValues(propsCopy.initialValues);
741
752
  delete propsCopy.initialValues;
742
753
  }
@@ -773,6 +784,7 @@ function Form(props) {
773
784
  setComputedProps(propsCopy);
774
785
  }, [props]);
775
786
  const onValuesChange = (0, import_react8.useCallback)((changedValues, allValues) => {
787
+ console.debug("Form:onValuesChange", changedValues, allValues);
776
788
  if (props.onValuesChange) {
777
789
  props.onValuesChange(changedValues, allValues);
778
790
  }
@@ -787,22 +799,23 @@ function Form(props) {
787
799
  (0, import_react8.useEffect)(() => {
788
800
  if (!initialValues)
789
801
  return;
802
+ console.debug("Form:initialValues", initialValues);
790
803
  form.setFieldsValue(initialValues);
791
804
  setInitialValues(null);
792
805
  }, [computedProps]);
793
806
  if (!computedProps)
794
807
  return null;
795
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
808
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form, {
796
809
  ...computedProps,
797
810
  onValuesChange,
798
811
  children: [
799
812
  computedProps.beforeItems,
800
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
813
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react8.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
801
814
  ...item,
802
815
  extendTypes
803
816
  }, item.id)),
804
817
  computedProps.children,
805
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
818
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
806
819
  htmlType: "submit",
807
820
  type: "primary",
808
821
  loading,
@@ -812,11 +825,11 @@ function Form(props) {
812
825
  ]
813
826
  });
814
827
  }
815
- Form.useForm = import_antd6.Form.useForm;
828
+ Form.useForm = import_antd5.Form.useForm;
816
829
 
817
830
  // src/Link.tsx
818
831
  var import_react_router_dom = require("react-router-dom");
819
- var import_antd7 = require("antd");
832
+ var import_antd6 = require("antd");
820
833
  var import_jsx_runtime = require("react/jsx-runtime");
821
834
  function Link({
822
835
  href,
@@ -830,17 +843,15 @@ function Link({
830
843
  style = Object.assign({ cursor: "pointer" }, style);
831
844
  if (href.startsWith("http")) {
832
845
  if (button)
833
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
846
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
834
847
  ...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
- })
848
+ target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
849
+ style: {
850
+ ...Link2.style,
851
+ ...style || {}
852
+ },
853
+ href,
854
+ children: text != null ? text : children
844
855
  });
845
856
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
846
857
  href,
@@ -849,20 +860,20 @@ function Link({
849
860
  ...Link2.style,
850
861
  ...style || {}
851
862
  },
852
- children: text || children
863
+ children: text != null ? text : children
853
864
  });
854
865
  }
855
866
  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),
867
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
868
+ to: href,
869
+ target: target || (Link2 == null ? void 0 : Link2.target),
870
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
871
+ ...button,
861
872
  style: {
862
873
  ...Link2.style,
863
874
  ...style || {}
864
875
  },
865
- children: text || children
876
+ children: text != null ? text : children
866
877
  })
867
878
  });
868
879
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
@@ -872,12 +883,12 @@ function Link({
872
883
  ...Link2.style,
873
884
  ...style || {}
874
885
  },
875
- children: text || children
886
+ children: text != null ? text : children
876
887
  });
877
888
  }
878
889
 
879
890
  // src/Modal.tsx
880
- var import_antd8 = require("antd");
891
+ var import_antd7 = require("antd");
881
892
  var import_react9 = require("react");
882
893
  var import_jsx_runtime = require("react/jsx-runtime");
883
894
  function useModal(init) {
@@ -890,7 +901,7 @@ function useModal(init) {
890
901
  ...init
891
902
  });
892
903
  return {
893
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
904
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Modal, {
894
905
  ...props
895
906
  }),
896
907
  modalProps: props,
@@ -904,13 +915,13 @@ function useModal(init) {
904
915
  }
905
916
 
906
917
  // src/Routers.tsx
907
- var import_antd9 = require("antd");
918
+ var import_antd8 = require("antd");
908
919
  var import_react10 = require("react");
909
920
  var import_react_router_dom2 = require("react-router-dom");
910
921
  var import_jsx_runtime = require("react/jsx-runtime");
911
922
  function PageNotFound() {
912
923
  const config = useConfigContext();
913
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
924
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Result, {
914
925
  status: "404",
915
926
  title: config.common.pageNotFound
916
927
  });
@@ -923,7 +934,7 @@ function Routes(props) {
923
934
  element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react10.Suspense, {
924
935
  fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
925
936
  style: { padding: "24px" },
926
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
937
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
927
938
  active: true
928
939
  })
929
940
  }),
@@ -940,7 +951,7 @@ function Routes(props) {
940
951
 
941
952
  // src/Table.tsx
942
953
  var import_react11 = require("react");
943
- var import_antd10 = require("antd");
954
+ var import_antd9 = require("antd");
944
955
  var import_dayjs2 = __toESM(require("dayjs"));
945
956
  var import_icons3 = require("@ant-design/icons");
946
957
  var import_lodash_es6 = require("lodash-es");
@@ -989,10 +1000,19 @@ function Table(props) {
989
1000
  item.filters = item.options.map((o) => ({
990
1001
  text: o.label,
991
1002
  value: o.value
992
- }));
1003
+ })).concat({
1004
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1005
+ value: null
1006
+ });
993
1007
  }
994
1008
  if (item.children)
995
- delete item.children;
1009
+ item.render = (value, values) => (0, import_react11.cloneElement)(
1010
+ item.children,
1011
+ {
1012
+ value,
1013
+ values
1014
+ }
1015
+ );
996
1016
  if (props.extendTypes && props.extendTypes[item.type]) {
997
1017
  if (props.extendTypes[item.type].children)
998
1018
  item.render = (value, values) => (0, import_react11.cloneElement)(
@@ -1012,8 +1032,10 @@ function Table(props) {
1012
1032
  case "string":
1013
1033
  if (!item.render)
1014
1034
  item.render = (value) => processValue(item, value);
1015
- if (!item.onFilter)
1035
+ if (!props.faasData && !item.onFilter)
1016
1036
  item.onFilter = (value, row) => {
1037
+ if (value === null && (0, import_lodash_es6.isNil)(row[item.id]))
1038
+ return true;
1017
1039
  if (!row[item.id])
1018
1040
  return false;
1019
1041
  return row[item.id].toLowerCase().includes(value.toLowerCase());
@@ -1023,7 +1045,7 @@ function Table(props) {
1023
1045
  setSelectedKeys,
1024
1046
  confirm,
1025
1047
  clearFilters
1026
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1048
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Input.Search, {
1027
1049
  placeholder: `${common2.search} ${item.title}`,
1028
1050
  allowClear: true,
1029
1051
  onSearch: (v) => {
@@ -1040,8 +1062,10 @@ function Table(props) {
1040
1062
  case "string[]":
1041
1063
  if (!item.render)
1042
1064
  item.render = (value) => processValue(item, value);
1043
- if (!item.onFilter)
1065
+ if (!props.faasData && !item.onFilter)
1044
1066
  item.onFilter = (value, row) => {
1067
+ if (value === null && (!row[item.id] || !row[item.id].length))
1068
+ return true;
1045
1069
  if (!row[item.id] || !row[item.id].length)
1046
1070
  return false;
1047
1071
  return row[item.id].some((v) => v.toLowerCase().includes(value.toLowerCase()));
@@ -1051,7 +1075,7 @@ function Table(props) {
1051
1075
  setSelectedKeys,
1052
1076
  confirm,
1053
1077
  clearFilters
1054
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1078
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Input.Search, {
1055
1079
  placeholder: `${common2.search} ${item.title}`,
1056
1080
  allowClear: true,
1057
1081
  onSearch: (v) => {
@@ -1070,14 +1094,18 @@ function Table(props) {
1070
1094
  item.render = (value) => processValue(item, value);
1071
1095
  if (!item.sorter)
1072
1096
  item.sorter = (a, b) => a[item.id] - b[item.id];
1073
- if (!item.onFilter)
1074
- item.onFilter = (value, row) => value === row[item.id];
1097
+ if (!props.faasData && !item.onFilter)
1098
+ item.onFilter = (value, row) => {
1099
+ if (value === null && (0, import_lodash_es6.isNil)(row[item.id]))
1100
+ return true;
1101
+ return value == row[item.id];
1102
+ };
1075
1103
  if (!item.filters && item.filterDropdown !== false)
1076
1104
  item.filterDropdown = ({
1077
1105
  setSelectedKeys,
1078
1106
  confirm,
1079
1107
  clearFilters
1080
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1108
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Input.Search, {
1081
1109
  placeholder: `${common2.search} ${item.title}`,
1082
1110
  allowClear: true,
1083
1111
  onSearch: (v) => {
@@ -1094,14 +1122,20 @@ function Table(props) {
1094
1122
  case "number[]":
1095
1123
  if (!item.render)
1096
1124
  item.render = (value) => processValue(item, value).join(", ");
1097
- if (!item.onFilter)
1098
- item.onFilter = (value, row) => row[item.id].includes(value);
1125
+ if (!props.faasData && !item.onFilter)
1126
+ item.onFilter = (value, row) => {
1127
+ if (value === null && (!row[item.id] || !row[item.id].length))
1128
+ return true;
1129
+ if (!row[item.id] || !row[item.id].length)
1130
+ return false;
1131
+ return row[item.id].includes(Number(value));
1132
+ };
1099
1133
  if (!item.filters && item.filterDropdown !== false)
1100
1134
  item.filterDropdown = ({
1101
1135
  setSelectedKeys,
1102
1136
  confirm,
1103
1137
  clearFilters
1104
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1138
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Input.Search, {
1105
1139
  placeholder: `${common2.search} ${item.title}`,
1106
1140
  allowClear: true,
1107
1141
  onSearch: (v) => {
@@ -1133,7 +1167,7 @@ function Table(props) {
1133
1167
  setSelectedKeys,
1134
1168
  selectedKeys,
1135
1169
  confirm
1136
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
1170
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd9.Radio.Group, {
1137
1171
  style: { padding: 8 },
1138
1172
  buttonStyle: "solid",
1139
1173
  value: selectedKeys[0],
@@ -1142,10 +1176,10 @@ function Table(props) {
1142
1176
  confirm();
1143
1177
  },
1144
1178
  children: [
1145
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1179
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
1146
1180
  children: common2.all
1147
1181
  }),
1148
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1182
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
1149
1183
  value: "true",
1150
1184
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1151
1185
  style: {
@@ -1154,7 +1188,7 @@ function Table(props) {
1154
1188
  }
1155
1189
  })
1156
1190
  }),
1157
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
1158
1192
  value: "false",
1159
1193
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1160
1194
  style: {
@@ -1163,13 +1197,13 @@ function Table(props) {
1163
1197
  }
1164
1198
  })
1165
1199
  }),
1166
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
1167
1201
  value: "empty",
1168
1202
  children: common2.blank
1169
1203
  })
1170
1204
  ]
1171
1205
  });
1172
- if (!item.onFilter)
1206
+ if (!props.faasData && !item.onFilter)
1173
1207
  item.onFilter = (value, row) => {
1174
1208
  switch (value) {
1175
1209
  case "true":
@@ -1186,7 +1220,7 @@ function Table(props) {
1186
1220
  case "date":
1187
1221
  if (!item.render)
1188
1222
  item.render = (value) => processValue(item, value);
1189
- if (!item.onFilter)
1223
+ if (!props.faasData && !item.onFilter)
1190
1224
  item.onFilter = (value, row) => (0, import_dayjs2.default)(row[item.id]).isSame((0, import_dayjs2.default)(value));
1191
1225
  if (!item.sorter)
1192
1226
  item.sorter = (a, b) => (0, import_dayjs2.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
@@ -1194,7 +1228,7 @@ function Table(props) {
1194
1228
  case "time":
1195
1229
  if (!item.render)
1196
1230
  item.render = (value) => processValue(item, value);
1197
- if (!item.onFilter)
1231
+ if (!props.faasData && !item.onFilter)
1198
1232
  item.onFilter = (value, row) => (0, import_dayjs2.default)(row[item.id]).isSame((0, import_dayjs2.default)(value));
1199
1233
  if (!item.sorter)
1200
1234
  item.sorter = (a, b) => (0, import_dayjs2.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
@@ -1219,7 +1253,11 @@ function Table(props) {
1219
1253
  if (!item.render)
1220
1254
  item.render = (value) => processValue(item, value);
1221
1255
  if (!item.onFilter)
1222
- item.onFilter = (value, row) => value === row[item.id];
1256
+ item.onFilter = (value, row) => {
1257
+ if (value === null && (0, import_lodash_es6.isNil)(row[item.id]))
1258
+ return true;
1259
+ return value === row[item.id];
1260
+ };
1223
1261
  break;
1224
1262
  }
1225
1263
  }
@@ -1236,7 +1274,10 @@ function Table(props) {
1236
1274
  newColumns[index].filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
1237
1275
  text: v[column.id],
1238
1276
  value: v[column.id]
1239
- }));
1277
+ })).concat({
1278
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1279
+ value: null
1280
+ });
1240
1281
  return newColumns;
1241
1282
  });
1242
1283
  }
@@ -1245,65 +1286,105 @@ function Table(props) {
1245
1286
  if (!columns)
1246
1287
  return null;
1247
1288
  if (!props.faasData)
1248
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1289
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1249
1290
  ...props,
1250
1291
  rowKey: props.rowKey || "id",
1251
1292
  columns,
1252
1293
  dataSource: props.dataSource
1253
1294
  });
1254
1295
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react12.FaasDataWrapper, {
1255
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1296
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
1256
1297
  active: true
1257
1298
  }),
1258
- render: ({
1259
- data,
1260
- params,
1261
- reload
1262
- }) => {
1263
- if (!data)
1264
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1265
- ...props,
1266
- rowKey: props.rowKey || "id",
1267
- columns,
1268
- dataSource: []
1269
- });
1270
- if (Array.isArray(data))
1271
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1272
- ...props,
1273
- rowKey: props.rowKey || "id",
1274
- columns,
1275
- dataSource: data
1276
- });
1277
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1278
- ...props,
1279
- rowKey: props.rowKey || "id",
1280
- columns,
1281
- dataSource: data.rows,
1282
- pagination: {
1283
- ...props.pagination,
1284
- ...data.pagination
1285
- },
1286
- onChange: (pagination, filters, sorter, extra) => {
1287
- if (props.onChange) {
1288
- const processed = props.onChange(pagination, filters, sorter, extra);
1289
- reload({
1290
- ...params,
1291
- pagination: processed.pagination,
1292
- filters: processed.filters,
1293
- sorter: processed.sorter
1294
- });
1295
- return;
1296
- }
1297
- reload({
1298
- ...params,
1299
- pagination,
1300
- filters,
1301
- sorter
1299
+ ...props.faasData,
1300
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataTable, {
1301
+ props,
1302
+ columns
1303
+ })
1304
+ });
1305
+ }
1306
+ function FaasDataTable({
1307
+ props,
1308
+ columns,
1309
+ data,
1310
+ params,
1311
+ reload
1312
+ }) {
1313
+ const [currentColumns, setCurrentColumns] = (0, import_react11.useState)(columns);
1314
+ (0, import_react11.useEffect)(() => {
1315
+ if (!data || Array.isArray(data))
1316
+ return;
1317
+ setCurrentColumns((prev) => {
1318
+ const newColumns = [...prev];
1319
+ for (const column of newColumns) {
1320
+ if (data["options"][column.id]) {
1321
+ column.options = data["options"][column.id];
1322
+ column.filters = data["options"][column.id].map((v) => ({
1323
+ text: v.label,
1324
+ value: v.value
1325
+ })).concat({
1326
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1327
+ value: null
1302
1328
  });
1329
+ column.render = (value) => processValue(column, value);
1330
+ if (column.filterDropdown)
1331
+ delete column.filterDropdown;
1332
+ continue;
1303
1333
  }
1304
- });
1334
+ if (column.optionsType === "auto" && !column.options && !column.filters) {
1335
+ column.filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
1336
+ text: v[column.id],
1337
+ value: v[column.id]
1338
+ })).concat({
1339
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1340
+ value: null
1341
+ });
1342
+ }
1343
+ }
1344
+ return newColumns;
1345
+ });
1346
+ }, [columns, data]);
1347
+ if (!data)
1348
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1349
+ ...props,
1350
+ rowKey: props.rowKey || "id",
1351
+ columns: currentColumns,
1352
+ dataSource: []
1353
+ });
1354
+ if (Array.isArray(data))
1355
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1356
+ ...props,
1357
+ rowKey: props.rowKey || "id",
1358
+ columns: currentColumns,
1359
+ dataSource: data
1360
+ });
1361
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1362
+ ...props,
1363
+ rowKey: props.rowKey || "id",
1364
+ columns: currentColumns,
1365
+ dataSource: data.rows,
1366
+ pagination: {
1367
+ ...props.pagination,
1368
+ ...data.pagination
1305
1369
  },
1306
- ...props.faasData
1370
+ onChange: (pagination, filters, sorter, extra) => {
1371
+ if (props.onChange) {
1372
+ const processed = props.onChange(pagination, filters, sorter, extra);
1373
+ reload({
1374
+ ...params,
1375
+ pagination: processed.pagination,
1376
+ filters: processed.filters,
1377
+ sorter: processed.sorter
1378
+ });
1379
+ return;
1380
+ }
1381
+ reload({
1382
+ ...params,
1383
+ pagination,
1384
+ filters,
1385
+ sorter
1386
+ });
1387
+ }
1307
1388
  });
1308
1389
  }
1309
1390