@faasjs/ant-design 7.0.1 → 7.0.3

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.cjs CHANGED
@@ -190,14 +190,14 @@ function useModal(init) {
190
190
  setModalProps
191
191
  };
192
192
  }
193
- var AppContext = react.createSplittingContext({
194
- message: null,
195
- notification: null,
196
- modalProps: {},
197
- setModalProps: null,
198
- drawerProps: {},
199
- setDrawerProps: null
200
- });
193
+ var AppContext = react.createSplittingContext([
194
+ "message",
195
+ "notification",
196
+ "modalProps",
197
+ "setModalProps",
198
+ "drawerProps",
199
+ "setDrawerProps"
200
+ ]);
201
201
  function RoutesApp(props) {
202
202
  const location = reactRouterDom.useLocation();
203
203
  const { drawerProps, setDrawerProps, modalProps, setModalProps } = useApp();
@@ -292,6 +292,7 @@ function Blank(options) {
292
292
  }
293
293
  Blank.whyDidYouRender = true;
294
294
  function idToTitle(id) {
295
+ if (typeof id === "number") return id.toString();
295
296
  const splitted = id.split(/(\s|_|-)/).filter((word) => !/(\s|_|-)/.test(word)).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
296
297
  return splitted.charAt(0).toUpperCase() + splitted.slice(1);
297
298
  }
@@ -572,27 +573,36 @@ function FormItem(props) {
572
573
  }, [props]);
573
574
  if (!computedProps) return null;
574
575
  if (hidden)
575
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, noStyle: true, rules: [], children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { type: "hidden", hidden: true }) });
576
+ return /* @__PURE__ */ jsxRuntime.jsx(
577
+ antd.Form.Item,
578
+ {
579
+ ...computedProps,
580
+ id: computedProps.id.toString(),
581
+ noStyle: true,
582
+ rules: [],
583
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { type: "hidden", hidden: true })
584
+ }
585
+ );
576
586
  if (computedProps.formChildren === null || computedProps.children === null || computedProps.formRender === null || computedProps.render === null)
577
587
  return null;
578
588
  const children = computedProps.formChildren || computedProps.children;
579
589
  if (children)
580
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: cloneUnionFaasItemElement(children, { scene: "form" }) });
590
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: cloneUnionFaasItemElement(children, { scene: "form" }) });
581
591
  const render = computedProps.formRender || computedProps.render;
582
592
  if (render)
583
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: render(null, null, 0, "form") });
593
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: render(null, null, 0, "form") });
584
594
  if (extendTypes?.[computedProps.type])
585
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: cloneUnionFaasItemElement(extendTypes[computedProps.type].children, {
595
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: cloneUnionFaasItemElement(extendTypes[computedProps.type].children, {
586
596
  scene: "form"
587
597
  }) });
588
598
  switch (computedProps.type) {
589
599
  case "string":
590
600
  if (isOptionsProps(computedProps))
591
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: computedProps.options.length > 10 ? /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { ...computedProps.input }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Group, { ...computedProps.input }) });
592
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { ...computedProps.input }) });
601
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: computedProps.options.length > 10 ? /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { ...computedProps.input }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Group, { ...computedProps.input }) });
602
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { ...computedProps.input }) });
593
603
  case "string[]":
594
604
  if (isOptionsProps(computedProps))
595
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { mode: "multiple", ...computedProps.input }) });
605
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { mode: "multiple", ...computedProps.input }) });
596
606
  return /* @__PURE__ */ jsxRuntime.jsx(
597
607
  antd.Form.List,
598
608
  {
@@ -606,19 +616,22 @@ function FormItem(props) {
606
616
  children: computedProps.label
607
617
  }
608
618
  ) }),
609
- fields.map((field) => /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
610
- /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 23, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { ...computedProps.input }) }) }),
611
- /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
612
- antd.Button,
613
- {
614
- danger: true,
615
- type: "link",
616
- style: { float: "right" },
617
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
618
- onClick: () => remove(field.name)
619
- }
620
- ) })
621
- ] }) }, field.key)),
619
+ fields.map((field) => {
620
+ const { key, ...fieldProps } = field;
621
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { id: key.toString(), children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
622
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 23, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...fieldProps, noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { ...computedProps.input }) }) }),
623
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
624
+ antd.Button,
625
+ {
626
+ danger: true,
627
+ type: "link",
628
+ style: { float: "right" },
629
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
630
+ onClick: () => remove(field.name)
631
+ }
632
+ ) })
633
+ ] }) }, key);
634
+ }),
622
635
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { children: [
623
636
  !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxRuntime.jsx(
624
637
  antd.Button,
@@ -637,8 +650,8 @@ function FormItem(props) {
637
650
  );
638
651
  case "number":
639
652
  if (computedProps.options)
640
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: computedProps.options.length > 10 ? /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { ...computedProps.input }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Group, { ...computedProps.input }) });
641
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(
653
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: computedProps.options.length > 10 ? /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { ...computedProps.input }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Group, { ...computedProps.input }) });
654
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(
642
655
  antd.InputNumber,
643
656
  {
644
657
  style: { width: "100%" },
@@ -647,7 +660,7 @@ function FormItem(props) {
647
660
  ) });
648
661
  case "number[]":
649
662
  if (computedProps.options)
650
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { mode: "multiple", ...computedProps.input }) });
663
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { mode: "multiple", ...computedProps.input }) });
651
664
  return /* @__PURE__ */ jsxRuntime.jsx(
652
665
  antd.Form.List,
653
666
  {
@@ -663,25 +676,28 @@ function FormItem(props) {
663
676
  children: computedProps.label
664
677
  }
665
678
  ) }),
666
- fields.map((field) => /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
667
- /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 23, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(
668
- antd.InputNumber,
669
- {
670
- style: { width: "100%" },
671
- ...computedProps.input
672
- }
673
- ) }) }),
674
- /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
675
- antd.Button,
676
- {
677
- danger: true,
678
- type: "link",
679
- style: { float: "right" },
680
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
681
- onClick: () => remove(field.name)
682
- }
683
- ) })
684
- ] }) }, field.key)),
679
+ fields.map((field) => {
680
+ const { key, ...fieldProps } = field;
681
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { id: key.toString(), children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
682
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 23, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...fieldProps, noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(
683
+ antd.InputNumber,
684
+ {
685
+ style: { width: "100%" },
686
+ ...computedProps.input
687
+ }
688
+ ) }) }),
689
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
690
+ antd.Button,
691
+ {
692
+ danger: true,
693
+ type: "link",
694
+ style: { float: "right" },
695
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
696
+ onClick: () => remove(field.name)
697
+ }
698
+ ) })
699
+ ] }) }, key);
700
+ }),
685
701
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { children: [
686
702
  !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxRuntime.jsx(
687
703
  antd.Button,
@@ -699,11 +715,11 @@ function FormItem(props) {
699
715
  }
700
716
  );
701
717
  case "boolean":
702
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Switch, { ...computedProps.input }) });
718
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(antd.Switch, { ...computedProps.input }) });
703
719
  case "date":
704
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.DatePicker, { ...computedProps.input }) });
720
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(antd.DatePicker, { ...computedProps.input }) });
705
721
  case "time":
706
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(
722
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsxRuntime.jsx(
707
723
  antd.DatePicker,
708
724
  {
709
725
  ...{ ...computedProps.input, showTime: true }
@@ -727,23 +743,31 @@ function FormItem(props) {
727
743
  name: computedProps.name,
728
744
  rules: computedProps.rules,
729
745
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
730
- fields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { style: { marginBottom: 0 }, children: [
731
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
732
- computedProps.label,
733
- " ",
734
- field.name + 1,
735
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
736
- antd.Button,
737
- {
738
- danger: true,
739
- type: "link",
740
- onClick: () => remove(field.name),
741
- children: theme2.common.delete
742
- }
743
- )
744
- ] }) }),
745
- /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: o.col || 24, children: /* @__PURE__ */ jsxRuntime.jsx(FormItem, { ...o, name: [field.name, o.id] }) }, o.id)) })
746
- ] }, field.key)),
746
+ fields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs(
747
+ antd.Form.Item,
748
+ {
749
+ id: field.key.toString(),
750
+ style: { marginBottom: 0 },
751
+ children: [
752
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
753
+ computedProps.label,
754
+ " ",
755
+ field.name + 1,
756
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
757
+ antd.Button,
758
+ {
759
+ danger: true,
760
+ type: "link",
761
+ onClick: () => remove(field.name),
762
+ children: theme2.common.delete
763
+ }
764
+ )
765
+ ] }) }),
766
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: o.col || 24, children: /* @__PURE__ */ jsxRuntime.jsx(FormItem, { ...o, name: [field.name, o.id] }) }, o.id)) })
767
+ ]
768
+ },
769
+ field.key
770
+ )),
747
771
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { children: [
748
772
  !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxRuntime.jsxs(
749
773
  antd.Button,
@@ -1418,10 +1442,12 @@ function Table(props) {
1418
1442
  if (!props.dataSource || !columns) return;
1419
1443
  for (const column of columns) {
1420
1444
  if (column.optionsType === "auto" && !column.options && !column.filters) {
1421
- const options = lodashEs.uniqBy(props.dataSource, column.id).map((v) => ({
1422
- label: v[column.id],
1423
- value: v[column.id]
1424
- }));
1445
+ const options = lodashEs.uniqBy(props.dataSource, column.id).map(
1446
+ (v) => ({
1447
+ label: v[column.id],
1448
+ value: v[column.id]
1449
+ })
1450
+ );
1425
1451
  if (options.length)
1426
1452
  setColumns((prev) => {
1427
1453
  const newColumns = [...prev];
@@ -1474,10 +1500,12 @@ function FaasDataTable({
1474
1500
  continue;
1475
1501
  }
1476
1502
  if (column.optionsType === "auto" && !column.options && !column.filters) {
1477
- const filters = lodashEs.uniqBy(props.dataSource, column.id).map((v) => ({
1478
- text: v[column.id],
1479
- value: v[column.id]
1480
- }));
1503
+ const filters = lodashEs.uniqBy(props.dataSource, column.id).map(
1504
+ (v) => ({
1505
+ text: v[column.id],
1506
+ value: v[column.id]
1507
+ })
1508
+ );
1481
1509
  if (filters.length)
1482
1510
  column.filters = filters.concat({
1483
1511
  text: /* @__PURE__ */ jsxRuntime.jsx(Blank, {}),
@@ -1544,7 +1572,6 @@ function FaasDataTable({
1544
1572
  }
1545
1573
  );
1546
1574
  }
1547
- Table.whyDidYouRender = true;
1548
1575
  function Tabs(props) {
1549
1576
  return /* @__PURE__ */ jsxRuntime.jsx(
1550
1577
  antd.Tabs,
package/dist/index.d.ts CHANGED
@@ -15,14 +15,14 @@ import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
15
15
  import { FaasActionUnionType, FaasAction } from '@faasjs/types';
16
16
  import { Dayjs } from 'dayjs';
17
17
  import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
18
- import { RuleObject } from 'rc-field-form/lib/interface';
18
+ import * as antd_es_form from 'antd/es/form';
19
+ import { RuleObject } from 'antd/es/form';
19
20
  import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
20
21
  import * as antd_es_form_context from 'antd/es/form/context';
21
- import * as antd_es_form from 'antd/es/form';
22
- import * as rc_field_form from 'rc-field-form';
22
+ import * as _rc_component_form from '@rc-component/form';
23
23
  import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
24
24
  import * as antd_es_form_Form from 'antd/es/form/Form';
25
- import { Tab } from 'rc-tabs/es/interface';
25
+ import { Tab } from '@rc-component/tabs/lib/interface';
26
26
 
27
27
  type LoadingProps = {
28
28
  style?: React.CSSProperties;
@@ -454,9 +454,6 @@ type TableFaasDataResponse<T = any> = {
454
454
  * - Auto generate sorter (disable with `sorter: false`).
455
455
  */
456
456
  declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
457
- declare namespace Table {
458
- var whyDidYouRender: boolean;
459
- }
460
457
 
461
458
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
462
459
  /** FaasItemType's value type */
@@ -476,7 +473,7 @@ type BaseOption = string | number | {
476
473
  value?: any;
477
474
  };
478
475
  interface BaseItemProps {
479
- id: string;
476
+ id: string | number;
480
477
  title?: string;
481
478
  options?: BaseOption[];
482
479
  }
@@ -501,7 +498,7 @@ interface FaasItemProps extends BaseItemProps {
501
498
  * idToTitle('example_id'); // returns 'ExampleId'
502
499
  * ```
503
500
  */
504
- declare function idToTitle(id: string): string;
501
+ declare function idToTitle(id: string | number): string;
505
502
  /**
506
503
  * convert string[] or number[] to { label, value }[]
507
504
  */
@@ -795,7 +792,7 @@ declare namespace Form {
795
792
  var whyDidYouRender: boolean;
796
793
  var useForm: typeof antd_es_form_Form.useForm;
797
794
  var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
798
- var useWatch: typeof rc_field_form.useWatch;
795
+ var useWatch: typeof _rc_component_form.useWatch;
799
796
  var Item: typeof FormItem;
800
797
  var List: react.FC<antd_es_form.FormListProps>;
801
798
  var ErrorList: react.FC<antd_es_form.ErrorListProps>;
package/dist/index.mjs CHANGED
@@ -186,14 +186,14 @@ function useModal(init) {
186
186
  setModalProps
187
187
  };
188
188
  }
189
- var AppContext = createSplittingContext({
190
- message: null,
191
- notification: null,
192
- modalProps: {},
193
- setModalProps: null,
194
- drawerProps: {},
195
- setDrawerProps: null
196
- });
189
+ var AppContext = createSplittingContext([
190
+ "message",
191
+ "notification",
192
+ "modalProps",
193
+ "setModalProps",
194
+ "drawerProps",
195
+ "setDrawerProps"
196
+ ]);
197
197
  function RoutesApp(props) {
198
198
  const location = useLocation();
199
199
  const { drawerProps, setDrawerProps, modalProps, setModalProps } = useApp();
@@ -288,6 +288,7 @@ function Blank(options) {
288
288
  }
289
289
  Blank.whyDidYouRender = true;
290
290
  function idToTitle(id) {
291
+ if (typeof id === "number") return id.toString();
291
292
  const splitted = id.split(/(\s|_|-)/).filter((word) => !/(\s|_|-)/.test(word)).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
292
293
  return splitted.charAt(0).toUpperCase() + splitted.slice(1);
293
294
  }
@@ -568,27 +569,36 @@ function FormItem(props) {
568
569
  }, [props]);
569
570
  if (!computedProps) return null;
570
571
  if (hidden)
571
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, noStyle: true, rules: [], children: /* @__PURE__ */ jsx(Input, { type: "hidden", hidden: true }) });
572
+ return /* @__PURE__ */ jsx(
573
+ Form$1.Item,
574
+ {
575
+ ...computedProps,
576
+ id: computedProps.id.toString(),
577
+ noStyle: true,
578
+ rules: [],
579
+ children: /* @__PURE__ */ jsx(Input, { type: "hidden", hidden: true })
580
+ }
581
+ );
572
582
  if (computedProps.formChildren === null || computedProps.children === null || computedProps.formRender === null || computedProps.render === null)
573
583
  return null;
574
584
  const children = computedProps.formChildren || computedProps.children;
575
585
  if (children)
576
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: cloneUnionFaasItemElement(children, { scene: "form" }) });
586
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: cloneUnionFaasItemElement(children, { scene: "form" }) });
577
587
  const render = computedProps.formRender || computedProps.render;
578
588
  if (render)
579
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: render(null, null, 0, "form") });
589
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: render(null, null, 0, "form") });
580
590
  if (extendTypes?.[computedProps.type])
581
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: cloneUnionFaasItemElement(extendTypes[computedProps.type].children, {
591
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: cloneUnionFaasItemElement(extendTypes[computedProps.type].children, {
582
592
  scene: "form"
583
593
  }) });
584
594
  switch (computedProps.type) {
585
595
  case "string":
586
596
  if (isOptionsProps(computedProps))
587
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: computedProps.options.length > 10 ? /* @__PURE__ */ jsx(Select, { ...computedProps.input }) : /* @__PURE__ */ jsx(Radio.Group, { ...computedProps.input }) });
588
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Input, { ...computedProps.input }) });
597
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: computedProps.options.length > 10 ? /* @__PURE__ */ jsx(Select, { ...computedProps.input }) : /* @__PURE__ */ jsx(Radio.Group, { ...computedProps.input }) });
598
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(Input, { ...computedProps.input }) });
589
599
  case "string[]":
590
600
  if (isOptionsProps(computedProps))
591
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Select, { mode: "multiple", ...computedProps.input }) });
601
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(Select, { mode: "multiple", ...computedProps.input }) });
592
602
  return /* @__PURE__ */ jsx(
593
603
  Form$1.List,
594
604
  {
@@ -602,19 +612,22 @@ function FormItem(props) {
602
612
  children: computedProps.label
603
613
  }
604
614
  ) }),
605
- fields.map((field) => /* @__PURE__ */ jsx(Form$1.Item, { children: /* @__PURE__ */ jsxs(Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
606
- /* @__PURE__ */ jsx(Col, { span: 23, children: /* @__PURE__ */ jsx(Form$1.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsx(Input, { ...computedProps.input }) }) }),
607
- /* @__PURE__ */ jsx(Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
608
- Button,
609
- {
610
- danger: true,
611
- type: "link",
612
- style: { float: "right" },
613
- icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
614
- onClick: () => remove(field.name)
615
- }
616
- ) })
617
- ] }) }, field.key)),
615
+ fields.map((field) => {
616
+ const { key, ...fieldProps } = field;
617
+ return /* @__PURE__ */ jsx(Form$1.Item, { id: key.toString(), children: /* @__PURE__ */ jsxs(Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
618
+ /* @__PURE__ */ jsx(Col, { span: 23, children: /* @__PURE__ */ jsx(Form$1.Item, { ...fieldProps, noStyle: true, children: /* @__PURE__ */ jsx(Input, { ...computedProps.input }) }) }),
619
+ /* @__PURE__ */ jsx(Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(
620
+ Button,
621
+ {
622
+ danger: true,
623
+ type: "link",
624
+ style: { float: "right" },
625
+ icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
626
+ onClick: () => remove(field.name)
627
+ }
628
+ ) })
629
+ ] }) }, key);
630
+ }),
618
631
  /* @__PURE__ */ jsxs(Form$1.Item, { children: [
619
632
  !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(
620
633
  Button,
@@ -633,8 +646,8 @@ function FormItem(props) {
633
646
  );
634
647
  case "number":
635
648
  if (computedProps.options)
636
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: computedProps.options.length > 10 ? /* @__PURE__ */ jsx(Select, { ...computedProps.input }) : /* @__PURE__ */ jsx(Radio.Group, { ...computedProps.input }) });
637
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(
649
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: computedProps.options.length > 10 ? /* @__PURE__ */ jsx(Select, { ...computedProps.input }) : /* @__PURE__ */ jsx(Radio.Group, { ...computedProps.input }) });
650
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(
638
651
  InputNumber,
639
652
  {
640
653
  style: { width: "100%" },
@@ -643,7 +656,7 @@ function FormItem(props) {
643
656
  ) });
644
657
  case "number[]":
645
658
  if (computedProps.options)
646
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Select, { mode: "multiple", ...computedProps.input }) });
659
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(Select, { mode: "multiple", ...computedProps.input }) });
647
660
  return /* @__PURE__ */ jsx(
648
661
  Form$1.List,
649
662
  {
@@ -659,25 +672,28 @@ function FormItem(props) {
659
672
  children: computedProps.label
660
673
  }
661
674
  ) }),
662
- fields.map((field) => /* @__PURE__ */ jsx(Form$1.Item, { children: /* @__PURE__ */ jsxs(Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
663
- /* @__PURE__ */ jsx(Col, { span: 23, children: /* @__PURE__ */ jsx(Form$1.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsx(
664
- InputNumber,
665
- {
666
- style: { width: "100%" },
667
- ...computedProps.input
668
- }
669
- ) }) }),
670
- /* @__PURE__ */ jsx(Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
671
- Button,
672
- {
673
- danger: true,
674
- type: "link",
675
- style: { float: "right" },
676
- icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
677
- onClick: () => remove(field.name)
678
- }
679
- ) })
680
- ] }) }, field.key)),
675
+ fields.map((field) => {
676
+ const { key, ...fieldProps } = field;
677
+ return /* @__PURE__ */ jsx(Form$1.Item, { id: key.toString(), children: /* @__PURE__ */ jsxs(Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
678
+ /* @__PURE__ */ jsx(Col, { span: 23, children: /* @__PURE__ */ jsx(Form$1.Item, { ...fieldProps, noStyle: true, children: /* @__PURE__ */ jsx(
679
+ InputNumber,
680
+ {
681
+ style: { width: "100%" },
682
+ ...computedProps.input
683
+ }
684
+ ) }) }),
685
+ /* @__PURE__ */ jsx(Col, { span: 1, children: !computedProps.input?.disabled && (!computedProps.rules.find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(
686
+ Button,
687
+ {
688
+ danger: true,
689
+ type: "link",
690
+ style: { float: "right" },
691
+ icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
692
+ onClick: () => remove(field.name)
693
+ }
694
+ ) })
695
+ ] }) }, key);
696
+ }),
681
697
  /* @__PURE__ */ jsxs(Form$1.Item, { children: [
682
698
  !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(
683
699
  Button,
@@ -695,11 +711,11 @@ function FormItem(props) {
695
711
  }
696
712
  );
697
713
  case "boolean":
698
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Switch, { ...computedProps.input }) });
714
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(Switch, { ...computedProps.input }) });
699
715
  case "date":
700
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(DatePicker, { ...computedProps.input }) });
716
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(DatePicker, { ...computedProps.input }) });
701
717
  case "time":
702
- return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(
718
+ return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, id: computedProps.id.toString(), children: /* @__PURE__ */ jsx(
703
719
  DatePicker,
704
720
  {
705
721
  ...{ ...computedProps.input, showTime: true }
@@ -723,23 +739,31 @@ function FormItem(props) {
723
739
  name: computedProps.name,
724
740
  rules: computedProps.rules,
725
741
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
726
- fields.map((field) => /* @__PURE__ */ jsxs(Form$1.Item, { style: { marginBottom: 0 }, children: [
727
- /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxs("label", { children: [
728
- computedProps.label,
729
- " ",
730
- field.name + 1,
731
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
732
- Button,
733
- {
734
- danger: true,
735
- type: "link",
736
- onClick: () => remove(field.name),
737
- children: theme2.common.delete
738
- }
739
- )
740
- ] }) }),
741
- /* @__PURE__ */ jsx(Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsx(Col, { span: o.col || 24, children: /* @__PURE__ */ jsx(FormItem, { ...o, name: [field.name, o.id] }) }, o.id)) })
742
- ] }, field.key)),
742
+ fields.map((field) => /* @__PURE__ */ jsxs(
743
+ Form$1.Item,
744
+ {
745
+ id: field.key.toString(),
746
+ style: { marginBottom: 0 },
747
+ children: [
748
+ /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxs("label", { children: [
749
+ computedProps.label,
750
+ " ",
751
+ field.name + 1,
752
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
753
+ Button,
754
+ {
755
+ danger: true,
756
+ type: "link",
757
+ onClick: () => remove(field.name),
758
+ children: theme2.common.delete
759
+ }
760
+ )
761
+ ] }) }),
762
+ /* @__PURE__ */ jsx(Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsx(Col, { span: o.col || 24, children: /* @__PURE__ */ jsx(FormItem, { ...o, name: [field.name, o.id] }) }, o.id)) })
763
+ ]
764
+ },
765
+ field.key
766
+ )),
743
767
  /* @__PURE__ */ jsxs(Form$1.Item, { children: [
744
768
  !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(
745
769
  Button,
@@ -1414,10 +1438,12 @@ function Table(props) {
1414
1438
  if (!props.dataSource || !columns) return;
1415
1439
  for (const column of columns) {
1416
1440
  if (column.optionsType === "auto" && !column.options && !column.filters) {
1417
- const options = uniqBy(props.dataSource, column.id).map((v) => ({
1418
- label: v[column.id],
1419
- value: v[column.id]
1420
- }));
1441
+ const options = uniqBy(props.dataSource, column.id).map(
1442
+ (v) => ({
1443
+ label: v[column.id],
1444
+ value: v[column.id]
1445
+ })
1446
+ );
1421
1447
  if (options.length)
1422
1448
  setColumns((prev) => {
1423
1449
  const newColumns = [...prev];
@@ -1470,10 +1496,12 @@ function FaasDataTable({
1470
1496
  continue;
1471
1497
  }
1472
1498
  if (column.optionsType === "auto" && !column.options && !column.filters) {
1473
- const filters = uniqBy(props.dataSource, column.id).map((v) => ({
1474
- text: v[column.id],
1475
- value: v[column.id]
1476
- }));
1499
+ const filters = uniqBy(props.dataSource, column.id).map(
1500
+ (v) => ({
1501
+ text: v[column.id],
1502
+ value: v[column.id]
1503
+ })
1504
+ );
1477
1505
  if (filters.length)
1478
1506
  column.filters = filters.concat({
1479
1507
  text: /* @__PURE__ */ jsx(Blank, {}),
@@ -1540,7 +1568,6 @@ function FaasDataTable({
1540
1568
  }
1541
1569
  );
1542
1570
  }
1543
- Table.whyDidYouRender = true;
1544
1571
  function Tabs(props) {
1545
1572
  return /* @__PURE__ */ jsx(
1546
1573
  Tabs$1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "peerDependencies": {
33
- "@faasjs/react": ">=7.0.1",
33
+ "@faasjs/react": ">=7.0.3",
34
34
  "antd": "*",
35
35
  "@ant-design/icons": "*",
36
36
  "lodash-es": "*",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/lodash-es": "*",
43
- "@faasjs/react": ">=7.0.1",
43
+ "@faasjs/react": ">=7.0.3",
44
44
  "antd": "*",
45
45
  "@ant-design/icons": "*",
46
46
  "lodash-es": "*",
@@ -49,7 +49,7 @@
49
49
  "react-router-dom": "*"
50
50
  },
51
51
  "engines": {
52
- "node": ">=22.0.0",
52
+ "node": ">=24.0.0",
53
53
  "npm": ">=11.0.0"
54
54
  }
55
55
  }