@faasjs/ant-design 8.0.0-beta.29 → 8.0.0-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/README.md CHANGED
@@ -39,12 +39,13 @@
39
39
  - [BaseItemProps](interfaces/BaseItemProps.md)
40
40
  - [BlankProps](interfaces/BlankProps.md)
41
41
  - [ConfigProviderProps](interfaces/ConfigProviderProps.md)
42
+ - [DescriptionCommonProps](interfaces/DescriptionCommonProps.md)
42
43
  - [DescriptionItemContentProps](interfaces/DescriptionItemContentProps.md)
43
44
  - [DescriptionItemProps](interfaces/DescriptionItemProps.md)
44
- - [DescriptionProps](interfaces/DescriptionProps.md)
45
+ - [DescriptionWithFaasProps](interfaces/DescriptionWithFaasProps.md)
46
+ - [DescriptionWithoutFaasProps](interfaces/DescriptionWithoutFaasProps.md)
45
47
  - [DrawerProps](interfaces/DrawerProps.md)
46
48
  - [ErrorBoundaryProps](interfaces/ErrorBoundaryProps.md)
47
- - [ExtendDescriptionTypeProps](interfaces/ExtendDescriptionTypeProps.md)
48
49
  - [ExtendFormItemProps](interfaces/ExtendFormItemProps.md)
49
50
  - [FaasDataWrapperProps](interfaces/FaasDataWrapperProps.md)
50
51
  - [FaasItemProps](interfaces/FaasItemProps.md)
@@ -61,8 +62,11 @@
61
62
 
62
63
  ## Type Aliases
63
64
 
65
+ - [BaseExtendTypeProps](type-aliases/BaseExtendTypeProps.md)
64
66
  - [BaseOption](type-aliases/BaseOption.md)
67
+ - [DescriptionProps](type-aliases/DescriptionProps.md)
65
68
  - [ExtendDescriptionItemProps](type-aliases/ExtendDescriptionItemProps.md)
69
+ - [ExtendDescriptionTypeProps](type-aliases/ExtendDescriptionTypeProps.md)
66
70
  - [ExtendFormTypeProps](type-aliases/ExtendFormTypeProps.md)
67
71
  - [ExtendTableItemProps](type-aliases/ExtendTableItemProps.md)
68
72
  - [ExtendTableTypeProps](type-aliases/ExtendTableTypeProps.md)
@@ -75,6 +79,8 @@
75
79
  - [FormFaasProps](type-aliases/FormFaasProps.md)
76
80
  - [FormProps](type-aliases/FormProps.md)
77
81
  - [FormSubmitProps](type-aliases/FormSubmitProps.md)
82
+ - [FormWithFaasProps](type-aliases/FormWithFaasProps.md)
83
+ - [FormWithoutFaasProps](type-aliases/FormWithoutFaasProps.md)
78
84
  - [LoadingProps](type-aliases/LoadingProps.md)
79
85
  - [ResolvedTheme](type-aliases/ResolvedTheme.md)
80
86
  - [setDrawerProps](type-aliases/setDrawerProps.md)
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from "@faasjs/react";
1
+ import { ErrorBoundaryProps, FaasDataInjection, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from "@faasjs/react";
2
2
  import { ButtonProps, ConfigProviderProps as ConfigProviderProps$1, DatePickerProps, DescriptionsProps, Drawer, DrawerProps as DrawerProps$1, FormInstance, FormItemProps as FormItemProps$1, FormProps as FormProps$1, GlobalToken, InputNumberProps, InputProps, Modal, ModalProps as ModalProps$1, RadioProps, SelectProps, SwitchProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, TabsProps as TabsProps$1 } from "antd";
3
3
  import { BrowserRouterProps, RouteProps } from "react-router-dom";
4
4
  import * as _$react from "react";
5
5
  import { CSSProperties, ComponentType, Dispatch, FC, JSX, LazyExoticComponent, ReactElement, ReactNode, SetStateAction, lazy } from "react";
6
6
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
7
  import { Dayjs } from "dayjs";
8
- import * as _$antd_es_form_FormItem0 from "antd/es/form/FormItem/index.js";
9
8
  import * as _$antd_es_form0 from "antd/es/form/index.js";
10
9
  import { RuleObject } from "antd/es/form/index.js";
11
10
  import { FilterValue, SorterResult, TableCurrentDataSource } from "antd/es/table/interface.js";
@@ -13,6 +12,7 @@ import * as _$antd_es_form_Form0 from "antd/es/form/Form.js";
13
12
  import * as _$antd_es_form_hooks_useFormInstance0 from "antd/es/form/hooks/useFormInstance.js";
14
13
  import * as _$_rc_component_form0 from "@rc-component/form";
15
14
  import * as _$antd_es_form_context0 from "antd/es/form/context.js";
15
+ import * as _$antd_es_form_FormItem0 from "antd/es/form/FormItem/index.js";
16
16
  import { Tab } from "@rc-component/tabs/lib/interface.js";
17
17
  import { MessageInstance } from "antd/es/message/interface.js";
18
18
  import { NotificationInstance } from "antd/es/notification/interface.js";
@@ -57,18 +57,11 @@ interface FaasActions {}
57
57
  */
58
58
  type FaasActionPaths = Extract<keyof FaasActions, string>;
59
59
  /**
60
- * Union type accepted by action helpers when callers pass either an action path or inferred data shape.
61
- */
62
- type FaasActionUnionType = Record<string, unknown> | string;
63
- /**
64
- * Infer the action path type.
65
- *
66
- * Returns the original type when `T` is a known action path,
67
- * otherwise falls back to `string`.
60
+ * Infer params type by action path.
68
61
  *
69
62
  * @template T - Candidate action path type.
70
63
  */
71
- type FaasAction<T = unknown> = T extends FaasActionPaths ? T : string;
64
+ type FaasParams<T = unknown> = T extends FaasActionPaths ? FaasActions[T]['Params'] : T extends string ? Record<string, unknown> : never;
72
65
  //#endregion
73
66
  //#region src/Loading/index.d.ts
74
67
  /**
@@ -114,18 +107,12 @@ type LoadingProps = {
114
107
  declare function Loading(props: LoadingProps): _$react_jsx_runtime0.JSX.Element;
115
108
  //#endregion
116
109
  //#region src/FaasDataWrapper/index.d.ts
117
- /**
118
- * Partial data injection exposed to wrapped Ant Design components.
119
- *
120
- * @template T - Action path or response data type used for inference.
121
- */
122
- type FaasDataInjection<T extends FaasActionUnionType = any> = Partial<FaasDataInjection$1<T>>;
123
110
  /**
124
111
  * Ant Design wrapper props for the underlying `@faasjs/react` data wrapper.
125
112
  *
126
113
  * @template T - Action path or response data type used for inference.
127
114
  */
128
- interface FaasDataWrapperProps<T extends FaasActionUnionType = any> extends FaasDataWrapperProps$1<T> {
115
+ interface FaasDataWrapperProps<T extends FaasActionPaths = any> extends FaasDataWrapperProps$1<T> {
129
116
  /** Props forwarded to the built-in {@link Loading} fallback. */
130
117
  loadingProps?: LoadingProps;
131
118
  /** Explicit loading element that overrides the built-in {@link Loading} fallback. */
@@ -213,14 +200,14 @@ interface FaasDataWrapperProps<T extends FaasActionUnionType = any> extends Faas
213
200
  * }
214
201
  * ```
215
202
  */
216
- declare function FaasDataWrapper<T extends FaasActionUnionType = any>(props: FaasDataWrapperProps<T>): JSX.Element;
203
+ declare function FaasDataWrapper<T extends FaasActionPaths = any>(props: FaasDataWrapperProps<T>): JSX.Element;
217
204
  /**
218
205
  * Wrap a component with {@link FaasDataWrapper} and its Ant Design loading fallback.
219
206
  *
220
- * @template PathOrData - Action path or response data type used for inference.
207
+ * @template Path - Action path or response data type used for inference.
221
208
  * @template TComponentProps - Component props including injected Faas data fields.
222
209
  * @param {React.FC<TComponentProps & Record<string, any>>} Component - Component that consumes injected Faas data props.
223
- * @param {FaasDataWrapperProps<PathOrData>} faasProps - Request configuration forwarded to {@link FaasDataWrapper}.
210
+ * @param {FaasDataWrapperProps<Path>} faasProps - Request configuration forwarded to {@link FaasDataWrapper}.
224
211
  * @returns Higher-order component that injects Faas data props.
225
212
  *
226
213
  * @example
@@ -238,7 +225,7 @@ declare function FaasDataWrapper<T extends FaasActionUnionType = any>(props: Faa
238
225
  * )
239
226
  * ```
240
227
  */
241
- declare function withFaasData<PathOrData extends FaasActionUnionType, TComponentProps extends Required<FaasDataInjection<PathOrData>> = Required<FaasDataInjection<PathOrData>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<PathOrData>): React.FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>;
228
+ declare function withFaasData<Path extends FaasActionPaths, TComponentProps extends Required<FaasDataInjection$1<Path>> = Required<FaasDataInjection$1<Path>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<Path>): React.FC<Omit<TComponentProps, keyof FaasDataInjection$1<Path>>>;
242
229
  //#endregion
243
230
  //#region src/Config/index.d.ts
244
231
  /**
@@ -547,18 +534,8 @@ interface BlankProps {
547
534
  */
548
535
  declare function Blank(options?: BlankProps): JSX.Element;
549
536
  //#endregion
550
- //#region src/FormItem/index.d.ts
551
- /**
552
- * Custom renderer registration for a form item type.
553
- *
554
- * @template T - Value type rendered by the custom form item type.
555
- */
556
- type ExtendFormTypeProps<T = any> = {
557
- /** Custom element used to render the registered form item type. */children?: UnionFaasItemElement<T>;
558
- };
559
- /**
560
- * Map of custom form item type registrations.
561
- */
537
+ //#region src/FormItem/types.d.ts
538
+ type ExtendFormTypeProps<T = any> = BaseExtendTypeProps<T>;
562
539
  type ExtendTypes = {
563
540
  [type: string]: ExtendFormTypeProps;
564
541
  };
@@ -573,90 +550,27 @@ type InputTypeMap<T> = {
573
550
  object: never;
574
551
  'object[]': never;
575
552
  };
576
- /**
577
- * Item definition used by the `FormItem` and `Form` components.
578
- *
579
- * @template T - Value type rendered or edited by the form item.
580
- */
581
553
  interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
582
- /**
583
- * Built-in FaasJS field type used to choose the default Ant Design input.
584
- *
585
- * @default 'string'
586
- */
587
554
  type?: FaasItemType;
588
- /** Input props forwarded to the generated Ant Design control. */
589
555
  input?: InputTypeMap<T>[FaasItemType];
590
- /** Maximum item count allowed for list-style field types. */
591
556
  maxCount?: number;
592
- /** Nested field definitions used by `object` and `object[]` item types. */
593
557
  object?: FormItemProps[];
594
- /** Whether the generated field is disabled. */
595
558
  disabled?: boolean;
596
- /** Whether the generated field adds a required validation rule. */
597
559
  required?: boolean;
598
- /** Grid span used by surrounding object-list layouts. */
599
560
  col?: number;
600
- /** Generic custom field renderer or element. */
601
561
  children?: UnionFaasItemElement<T> | null;
602
- /** Form-specific custom field renderer or element. */
603
562
  formChildren?: UnionFaasItemElement<T> | null;
604
- /** Generic custom render callback. */
605
563
  render?: UnionFaasItemRender<T> | null;
606
- /** Form-specific custom render callback. */
607
564
  formRender?: UnionFaasItemRender<T> | null;
608
- /** Validation rules forwarded to Ant Design `Form.Item`. */
609
565
  rules?: RuleObject[];
610
- /** Label override, or `false` to hide the label completely. */
611
566
  label?: string | false;
612
- /** Custom form item type renderers keyed by type name. */
613
567
  extendTypes?: ExtendTypes;
614
- /** Callback invoked when this field's value changes. */
615
568
  onValueChange?: (value: T, values: any, form: FormInstance) => void;
616
- /** Predicate used to show or hide the item from the current form values. */
617
569
  if?: (values: Record<string, any>) => boolean;
618
570
  }
619
- /**
620
- * Item shape used to extend `Form` with custom type names.
621
- */
622
571
  interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
623
572
  type?: string;
624
573
  }
625
- /**
626
- * Render a FaasJS-aware Ant Design form field or nested field group.
627
- *
628
- * The component derives default labels from `id`, applies required validation messages from the
629
- * active theme, supports surface-specific union renderers, and can render nested `object` or
630
- * `object[]` field structures.
631
- *
632
- * @template T - Value type rendered or edited by the form item.
633
- * @param {FormItemProps<T>} props - Form item props including field metadata, rules, and custom renderers.
634
- *
635
- * @example
636
- * ```tsx
637
- * import { FormItem } from '@faasjs/ant-design'
638
- * import { Input } from 'antd'
639
- *
640
- * export function AccountFields() {
641
- * return (
642
- * <>
643
- * <FormItem id="name" type="string" />
644
- * <FormItem id="password">
645
- * <Input.Password />
646
- * </FormItem>
647
- * </>
648
- * )
649
- * }
650
- * ```
651
- */
652
- declare function FormItem<T = any>(props: FormItemProps<T>): _$react_jsx_runtime0.JSX.Element | null;
653
- declare namespace FormItem {
654
- var useStatus: () => {
655
- status?: _$antd_es_form_FormItem0.ValidateStatus;
656
- errors: React.ReactNode[];
657
- warnings: React.ReactNode[];
658
- };
659
- }
660
574
  //#endregion
661
575
  //#region src/Table/types.d.ts
662
576
  /**
@@ -678,15 +592,7 @@ interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T
678
592
  /** Nested item definitions used by `object` and `object[]` item types. */
679
593
  object?: TableItemProps<T>[];
680
594
  }
681
- /**
682
- * Custom renderer registration for a table item type.
683
- *
684
- * @template T - Row record type rendered by the custom table item type.
685
- */
686
- type ExtendTableTypeProps<T = any> = {
687
- /** Custom element used to render the registered table item type. */children?: UnionFaasItemElement<T>; /** Custom render callback used when `children` is not provided. */
688
- render?: UnionFaasItemRender<T>;
689
- };
595
+ type ExtendTableTypeProps<T = any> = BaseExtendTypeProps<T>;
690
596
  /**
691
597
  * Shared fields for extending table item unions.
692
598
  *
@@ -743,58 +649,8 @@ type TableFaasDataResponse<T = any> = {
743
649
  };
744
650
  };
745
651
  //#endregion
746
- //#region src/Table/table.d.ts
747
- /**
748
- * Render an Ant Design table from FaasJS item metadata.
749
- *
750
- * The component can render local `dataSource` rows or resolve remote rows through `faasData`. It
751
- * also generates default filters and sorters for built-in item types unless you disable them with
752
- * the corresponding Ant Design column props.
753
- *
754
- * @template T - Row record type rendered by the table.
755
- * @template ExtendTypes - Additional item prop shape accepted by `items`.
756
- * @param {TableProps<T, ExtendTypes>} props - Table props including columns, data source, and optional Faas data config.
757
- * @throws {Error} When an entry in `extendTypes` omits both `children` and `render`.
758
- *
759
- * @example
760
- * ```tsx
761
- * import { Table } from '@faasjs/ant-design'
762
- *
763
- * const rows = [
764
- * { id: 1, name: 'Alice', active: true },
765
- * { id: 2, name: 'Bob', active: false },
766
- * ]
767
- *
768
- * export function UserTable() {
769
- * return (
770
- * <Table
771
- * rowKey="id"
772
- * dataSource={rows}
773
- * items={[
774
- * { id: 'name', title: 'Name' },
775
- * { id: 'active', type: 'boolean', title: 'Active' },
776
- * ]}
777
- * />
778
- * )
779
- * }
780
- * ```
781
- */
782
- declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): _$react_jsx_runtime0.JSX.Element;
783
- //#endregion
784
- //#region src/data/render.d.ts
785
- declare function renderDisplayValue(type: FaasItemType, value: any, options?: {
786
- label: string;
787
- value?: string | number;
788
- }[]): JSX.Element | string | number | boolean | null;
789
- //#endregion
790
- //#region src/data/index.d.ts
791
- /**
792
- * Supported built-in field types shared by form, table, and description components.
793
- */
652
+ //#region src/data/types.d.ts
794
653
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
795
- /**
796
- * Runtime value mapping for each built-in {@link FaasItemType}.
797
- */
798
654
  type FaasItemTypeValue = {
799
655
  string: string;
800
656
  'string[]': string[];
@@ -806,254 +662,82 @@ type FaasItemTypeValue = {
806
662
  object: any;
807
663
  'object[]': any[];
808
664
  };
809
- /**
810
- * Option item accepted by built-in choice inputs.
811
- */
812
665
  type BaseOption = string | number | {
813
- /** Display label rendered by Ant Design controls. */label: string; /** Raw option value submitted or matched by components. */
666
+ label: string;
814
667
  value?: any;
815
668
  };
816
- /**
817
- * Common metadata shared by form, table, and description items.
818
- */
819
669
  interface BaseItemProps {
820
- /** Stable field identifier used as the default name and title source. */
821
670
  id: string | number;
822
- /** Human-readable title used for labels and table headers. */
823
671
  title?: string;
824
- /** Shared choice options used by select-like renderers. */
825
672
  options?: BaseOption[];
826
673
  }
827
- /**
828
- * Base item props plus the shared built-in value type selector.
829
- */
830
674
  interface FaasItemProps extends BaseItemProps {
831
- /**
832
- * Built-in FaasJS field type used to normalize and render values.
833
- *
834
- * @default 'string'
835
- */
836
675
  type?: FaasItemType;
837
676
  }
838
- /**
839
- * Convert a snake_case, kebab-case, or spaced identifier into a title-style label.
840
- *
841
- * @param {string | number} id - Identifier to convert.
842
- * @returns Generated label string.
843
- *
844
- * @example
845
- * ```ts
846
- * idToTitle('example_id') // 'Example Id'
847
- * ```
848
- */
849
- declare function idToTitle(id: string | number): string;
850
- /**
851
- * Normalize primitive options into explicit `{ label, value }` objects.
852
- *
853
- * String and number options are converted with {@link idToTitle}, while pre-shaped option objects
854
- * are returned as-is.
855
- *
856
- * @param {BaseOption[]} options - Raw option list to normalize.
857
- * @returns Normalized option list.
858
- *
859
- * @example
860
- * ```ts
861
- * import { transferOptions } from '@faasjs/ant-design'
862
- *
863
- * transferOptions(['draft', { label: 'Published', value: 'published' }])
864
- * // [
865
- * // { label: 'Draft', value: 'draft' },
866
- * // { label: 'Published', value: 'published' },
867
- * // ]
868
- * ```
869
- */
870
- declare function transferOptions(options: BaseOption[]): {
871
- label: string;
872
- value?: string | number;
873
- }[];
874
- /**
875
- * Normalize raw values into the runtime shape expected by FaasJS Ant Design components.
876
- *
877
- * Primitive strings such as `'null'` and `'undefined'` become `null`, comma-delimited array
878
- * strings are split into arrays, and date or time values are converted to `dayjs` objects.
879
- *
880
- * @param {FaasItemType | null | undefined} type - Target field type.
881
- * @param {any} value - Raw value to normalize.
882
- * @returns Normalized value for rendering or form initialization.
883
- *
884
- * @example
885
- * ```ts
886
- * import { transferValue } from '@faasjs/ant-design'
887
- *
888
- * transferValue('number', '42') // 42
889
- * transferValue('boolean', 'true') // true
890
- * transferValue('string[]', 'a,b') // ['a', 'b']
891
- * ```
892
- */
893
- declare function transferValue(type: FaasItemType | null | undefined, value: any): any;
894
- /**
895
- * Rendering surfaces supported by union item helpers.
896
- */
897
677
  type UnionScene = 'form' | 'description' | 'table';
898
- /**
899
- * Props injected into custom union item components.
900
- *
901
- * @template Value - Current item value type.
902
- * @template Values - Whole record or row type that contains the value.
903
- */
904
678
  type UnionFaasItemInjection<Value = any, Values = any> = {
905
- /** Rendering surface requesting the injected element. */scene?: UnionScene; /** Current field, cell, or item value. */
906
- value?: Value; /** Full record or row containing the current value. */
907
- values?: Values; /** Current row or list index when available. */
679
+ scene?: UnionScene;
680
+ value?: Value;
681
+ values?: Values;
908
682
  index?: number;
909
683
  };
910
- /**
911
- * Render callback signature shared by form, description, and table item definitions.
912
- *
913
- * @template Value - Current item value type.
914
- * @template Values - Whole record or row type that contains the value.
915
- *
916
- * @param {Value} value - Current item value.
917
- * @param {Values} values - Whole record or row containing the value.
918
- * @param {number} index - Current row or list index.
919
- * @param {UnionScene} scene - Rendering surface requesting the output.
920
- */
921
684
  type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
922
- /**
923
- * Custom React component or element accepted by union item definitions.
924
- *
925
- * @template Value - Current item value type.
926
- * @template Values - Whole record or row type that contains the value.
927
- */
928
685
  type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | FC<UnionFaasItemInjection<Value, Values>>;
929
- /**
930
- * Shared union item contract that can be reused across `Form`, `Description`, and `Table`.
931
- *
932
- * ### Render Priority Order
933
- *
934
- * 1. Component-specific null renderers hide the item for that surface.
935
- * 2. Component-specific children override generic `children`.
936
- * 3. Component-specific render callbacks override generic `render`.
937
- * 4. Registered extended types handle unmatched items.
938
- * 5. Built-in type renderers handle primitive and object values.
939
- *
940
- * @template Value - Current item value type.
941
- * @template Values - Whole record or row type that contains the value.
942
- */
943
686
  interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
944
- /** Shared custom element rendered when no surface-specific child overrides it. */
945
687
  children?: UnionFaasItemElement<Value, Values> | null;
946
- /** Shared render callback used when no surface-specific render overrides it. */
947
688
  render?: UnionFaasItemRender<Value, Values> | null;
948
- /** Nested item definitions used by `object` and `object[]` item types. */
949
689
  object?: UnionFaasItemProps<Value, Values>[];
950
690
  }
951
- /**
952
- * Clone a {@link UnionFaasItemElement} with FaasJS injection props.
953
- *
954
- * React elements are cloned directly, while component references are first wrapped with
955
- * `createElement`.
956
- *
957
- * @param {UnionFaasItemElement} element - Element or component to clone.
958
- * @param {any} props - Injection props such as `scene`, `value`, `values`, and `index`.
959
- * @returns Cloned React element ready for rendering.
960
- *
961
- * @example
962
- * ```tsx
963
- * import { cloneUnionFaasItemElement, type UnionFaasItemElement } from '@faasjs/ant-design'
964
- *
965
- * const Cell: UnionFaasItemElement<string> = ({ value }) => <span>{value}</span>
966
- *
967
- * const element = cloneUnionFaasItemElement(Cell, {
968
- * scene: 'table',
969
- * value: 'Hello',
970
- * index: 0,
971
- * })
972
- * ```
973
- */
974
- declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): ReactElement<UnionFaasItemInjection<any, any>, string | _$react.JSXElementConstructor<any>>;
975
- //#endregion
976
- //#region src/Description/index.d.ts
977
- /**
978
- * Custom renderer registration for a description item type.
979
- *
980
- * @template T - Value type rendered by the custom description item type.
981
- */
982
- interface ExtendDescriptionTypeProps<T = any> {
983
- /** Custom element used to render the registered description item type. */
691
+ type BaseExtendTypeProps<T = any> = {
984
692
  children?: UnionFaasItemElement<T>;
985
- /** Custom render callback used when `children` is not provided. */
986
693
  render?: UnionFaasItemRender<T>;
987
- }
988
- /**
989
- * Shared fields for extending description item unions.
990
- */
694
+ };
695
+ //#endregion
696
+ //#region src/Description/types.d.ts
697
+ type ExtendDescriptionTypeProps<T = any> = BaseExtendTypeProps<T>;
991
698
  type ExtendDescriptionItemProps = BaseItemProps;
992
- /**
993
- * Item definition used by {@link Description}.
994
- *
995
- * @template T - Value type rendered by the item.
996
- */
997
699
  interface DescriptionItemProps<T = any> extends FaasItemProps {
998
- /** Generic custom element rendered when no description-specific child overrides it. */
999
700
  children?: UnionFaasItemElement<T> | null;
1000
- /** Description-specific custom element. */
1001
701
  descriptionChildren?: UnionFaasItemElement<T> | null;
1002
- /** Generic custom render callback. */
1003
702
  render?: UnionFaasItemRender<T> | null;
1004
- /** Description-specific custom render callback. */
1005
703
  descriptionRender?: UnionFaasItemRender<T> | null;
1006
- /** Predicate used to hide the item for the current record. */
1007
704
  if?: (values: Record<string, any>) => boolean;
1008
- /** Nested item definitions used by `object` and `object[]` item types. */
1009
705
  object?: DescriptionItemProps<T>[];
1010
706
  }
1011
- /**
1012
- * Props for the {@link Description} component.
1013
- *
1014
- * @template T - Data record shape rendered by the component.
1015
- * @template ExtendItemProps - Additional item prop shape accepted by `items`.
1016
- */
1017
- interface DescriptionProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
1018
- /** Callback used to derive the rendered title from the current record. */
707
+ interface DescriptionCommonProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
1019
708
  renderTitle?(this: void, values: T): ReactNode;
1020
- /** Description item definitions rendered by the component. */
1021
709
  items: (DescriptionItemProps | ExtendItemProps)[];
1022
- /** Custom type renderers keyed by item type. */
1023
710
  extendTypes?: {
1024
711
  [key: string]: ExtendDescriptionTypeProps;
1025
712
  };
1026
- /** Local data record rendered directly by the component. */
713
+ }
714
+ interface DescriptionWithoutFaasProps<T = any, ExtendItemProps = any> extends DescriptionCommonProps<T, ExtendItemProps> {
1027
715
  dataSource?: T;
1028
- /** Request config used to fetch the record before rendering. */
1029
- faasData?: FaasDataWrapperProps<any>;
716
+ faasData?: never;
1030
717
  }
1031
- /**
1032
- * Props passed to the exported `DescriptionItemContent` helper shape.
1033
- *
1034
- * @template T - Value type rendered by the item content.
1035
- */
718
+ interface DescriptionWithFaasProps<Path extends FaasActionPaths = any, T = any, ExtendItemProps = any> extends DescriptionCommonProps<T, ExtendItemProps> {
719
+ dataSource?: never;
720
+ faasData?: FaasDataWrapperProps<Path>;
721
+ }
722
+ type DescriptionProps<T = any, ExtendItemProps = any> = DescriptionWithoutFaasProps<T, ExtendItemProps> | DescriptionWithFaasProps<any, T, ExtendItemProps>;
1036
723
  interface DescriptionItemContentProps<T = any> {
1037
- /** Item definition describing how the value should render. */
1038
724
  item: DescriptionItemProps;
1039
- /** Current item value. */
1040
725
  value: T;
1041
- /** Full record containing the current value. */
1042
726
  values?: any;
1043
- /** Custom type renderers keyed by item type. */
1044
727
  extendTypes?: {
1045
728
  [key: string]: ExtendDescriptionTypeProps;
1046
729
  };
1047
730
  }
731
+ //#endregion
732
+ //#region src/Description/index.d.ts
1048
733
  /**
1049
- * Render an Ant Design description list from FaasJS item metadata.
734
+ * Render an Ant Design description list from a local data source.
1050
735
  *
1051
- * The component can render a local `dataSource` directly or resolve one through `faasData`, and
1052
- * it applies the same item type normalization helpers used by the form and table components.
736
+ * The component applies FaasJS item type normalization helpers to render item metadata with
737
+ * appropriate display formatting.
1053
738
  *
1054
739
  * @template T - Data record shape rendered by the component.
1055
- * @param {DescriptionProps<T>} props - Description props including items, data source, and optional Faas data config.
1056
- * @throws {Error} When an entry in `extendTypes` omits both `children` and `render`.
740
+ * @param {DescriptionWithoutFaasProps<T>} props - Description props including items and a local data source.
1057
741
  *
1058
742
  * @example
1059
743
  * ```tsx
@@ -1064,11 +748,7 @@ interface DescriptionItemContentProps<T = any> {
1064
748
  * <Description
1065
749
  * title="Title"
1066
750
  * items={[
1067
- * {
1068
- * id: 'id',
1069
- * title: 'Title',
1070
- * type: 'string',
1071
- * },
751
+ * { id: 'id', title: 'Title', type: 'string' },
1072
752
  * ]}
1073
753
  * dataSource={{ id: 'value' }}
1074
754
  * />
@@ -1076,7 +756,45 @@ interface DescriptionItemContentProps<T = any> {
1076
756
  * }
1077
757
  * ```
1078
758
  */
1079
- declare function Description<T extends Record<string, any> = any>(props: DescriptionProps<T>): _$react_jsx_runtime0.JSX.Element;
759
+ declare function Description<T extends Record<string, any> = any>(props: DescriptionWithoutFaasProps<T>): JSX.Element;
760
+ /**
761
+ * Render an Ant Design description list with fetched FaasJS data.
762
+ *
763
+ * The component fetches data via `faasData` and applies FaasJS item type normalization helpers
764
+ * to render item metadata with appropriate display formatting.
765
+ *
766
+ * When `Path` is provided, the `action` and `params` in `faasData` are strongly typed from the
767
+ * {@link FaasActions} type augmentation.
768
+ *
769
+ * @template Path - Action path type inferred from `faasData.action` for strong typing.
770
+ * @template T - Data record shape rendered by the component.
771
+ * @param {DescriptionWithFaasProps<Path, T>} props - Description props including items and FaasJS data config.
772
+ *
773
+ * @example
774
+ * ```tsx
775
+ * import { Description } from '@faasjs/ant-design'
776
+ *
777
+ * export function Detail() {
778
+ * return (
779
+ * <Description
780
+ * title="Title"
781
+ * items={[
782
+ * { id: 'id', title: 'Title', type: 'string' },
783
+ * ]}
784
+ * faasData={{
785
+ * action: 'user/get',
786
+ * params: { id: 1 },
787
+ * }}
788
+ * />
789
+ * )
790
+ * }
791
+ * ```
792
+ */
793
+ declare function Description<Path extends FaasActionPaths, T extends Record<string, any> = any>(props: DescriptionWithFaasProps<Path, T>): JSX.Element;
794
+ /**
795
+ * Render an Ant Design description list (catch-all overload for backward compatibility).
796
+ */
797
+ declare function Description<T extends Record<string, any> = any>(props: DescriptionProps<T>): JSX.Element;
1080
798
  declare namespace Description {
1081
799
  var displayName: string;
1082
800
  }
@@ -1127,57 +845,99 @@ declare function useDrawer(init?: DrawerProps): {
1127
845
  setDrawerProps: setDrawerProps;
1128
846
  };
1129
847
  //#endregion
1130
- //#region src/Form/index.d.ts
848
+ //#region src/data/render.d.ts
849
+ declare function renderDisplayValue(type: FaasItemType, value: any, options?: {
850
+ label: string;
851
+ value?: string | number;
852
+ }[]): JSX.Element | string | number | boolean | null;
853
+ //#endregion
854
+ //#region src/data/utils.d.ts
855
+ declare function idToTitle(id: string | number): string;
856
+ declare function transferOptions(options: BaseOption[]): {
857
+ label: string;
858
+ value?: string | number;
859
+ }[];
860
+ declare function transferValue(type: FaasItemType | null | undefined, value: any): any;
861
+ declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): _$react.ReactElement<UnionFaasItemInjection<any, any>, string | _$react.JSXElementConstructor<any>>;
862
+ //#endregion
863
+ //#region src/FormItem/index.d.ts
1131
864
  /**
1132
- * Props for the built-in submit button rendered by {@link Form}.
865
+ * Render a FaasJS-aware Ant Design form field or nested field group.
866
+ *
867
+ * The component derives default labels from `id`, applies required validation messages from the
868
+ * active theme, supports surface-specific union renderers, and can render nested `object` or
869
+ * `object[]` field structures.
870
+ *
871
+ * @template T - Value type rendered or edited by the form item.
872
+ * @param {FormItemProps<T>} props - Form item props including field metadata, rules, and custom renderers.
873
+ *
874
+ * @example
875
+ * ```tsx
876
+ * import { FormItem } from '@faasjs/ant-design'
877
+ * import { Input } from 'antd'
878
+ *
879
+ * export function AccountFields() {
880
+ * return (
881
+ * <>
882
+ * <FormItem id="name" type="string" />
883
+ * <FormItem id="password">
884
+ * <Input.Password />
885
+ * </FormItem>
886
+ * </>
887
+ * )
888
+ * }
889
+ * ```
1133
890
  */
891
+ declare function FormItem<T = any>(props: FormItemProps<T>): _$react_jsx_runtime0.JSX.Element | null;
892
+ declare namespace FormItem {
893
+ var useStatus: () => {
894
+ status?: _$antd_es_form_FormItem0.ValidateStatus;
895
+ errors: React.ReactNode[];
896
+ warnings: React.ReactNode[];
897
+ };
898
+ }
899
+ //#endregion
900
+ //#region src/Form/types.d.ts
1134
901
  type FormSubmitProps = {
1135
- /** Text rendered by the built-in submit button. */text?: string; /** Additional props forwarded to the built-in submit button. */
902
+ text?: string;
1136
903
  buttonProps?: ButtonProps;
1137
904
  };
1138
- /**
1139
- * Built-in FaasJS submit handler configuration for {@link Form}.
1140
- *
1141
- * @template Values - Form values shape used by submit handlers.
1142
- */
1143
- type FormFaasProps<Values extends Record<string, any> = any> = {
1144
- /** Action name submitted through `faas()`. */action: FaasAction; /** Extra params merged into the submitted payload after `transformValues` runs. */
1145
- params?: Record<string, any> | ((values: Record<string, any>) => Record<string, any>); /** Transform form values before sending the request. */
1146
- transformValues?: (values: Values) => Record<string, any> | Promise<Record<string, any>>; /** Callback invoked when the request succeeds. */
1147
- onSuccess?: (result: any, values: Record<string, any>) => void; /** Callback invoked when the request fails. */
1148
- onError?: (error: any, values: Record<string, any>) => void; /** Callback invoked after the request settles. */
905
+ type FormFaasProps<Values extends Record<string, any> = any, Path extends FaasActionPaths = any> = {
906
+ action: Path;
907
+ params?: FaasParams<Path> | ((values: Record<string, any>) => FaasParams<Path>);
908
+ transformValues?: (values: Values) => Record<string, any> | Promise<Record<string, any>>;
909
+ onSuccess?: (result: any, values: Record<string, any>) => void;
910
+ onError?: (error: any, values: Record<string, any>) => void;
1149
911
  onFinally?: () => void;
1150
912
  };
1151
- /**
1152
- * Props for the FaasJS Ant Design {@link Form} component.
1153
- *
1154
- * @template Values - Form values shape.
1155
- * @template ExtendItemProps - Additional item prop shape accepted by `items`.
1156
- */
1157
- type FormProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> & {
1158
- /** Form item definitions or custom JSX blocks rendered inside the form. */items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[]; /** Built-in submit button config, or `false` to disable the generated submit button. */
1159
- submit?: false | FormSubmitProps; /** Extra content rendered before generated items. */
1160
- beforeItems?: JSX.Element | JSX.Element[]; /** Extra content rendered after generated items. */
1161
- footer?: JSX.Element | JSX.Element[]; /** Custom form item type renderers keyed by type name. */
1162
- extendTypes?: ExtendTypes; /** Additional custom content rendered inside the form. */
1163
- children?: ReactNode; /** Initial values applied to the underlying Ant Design form. */
913
+ type FormCommonProps<Values extends Record<string, any>, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> & {
914
+ items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
915
+ submit?: false | FormSubmitProps;
916
+ beforeItems?: JSX.Element | JSX.Element[];
917
+ footer?: JSX.Element | JSX.Element[];
918
+ extendTypes?: ExtendTypes;
919
+ children?: ReactNode;
1164
920
  initialValues?: Partial<Values>;
1165
- } & ({
1166
- /** Built-in FaasJS submit handler, ignored when `onFinish` is provided. */faas?: FormFaasProps<Values>;
1167
- onFinish?: never;
1168
- } | {
1169
- faas?: never; /** Custom submit handler used instead of the built-in FaasJS submit flow. */
921
+ };
922
+ type FormWithoutFaasProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormCommonProps<Values, ExtendItemProps> & {
923
+ faas?: never;
1170
924
  onFinish?: (values: Values) => void | Promise<void>;
1171
- });
925
+ };
926
+ type FormWithFaasProps<Path extends FaasActionPaths = any, Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormCommonProps<Values, ExtendItemProps> & {
927
+ faas?: FormFaasProps<Values, Path>;
928
+ onFinish?: never;
929
+ };
930
+ type FormProps<Values extends Record<string, any> = any, Path extends FaasActionPaths = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormWithoutFaasProps<Values, ExtendItemProps> | FormWithFaasProps<Path, Values, ExtendItemProps>;
931
+ //#endregion
932
+ //#region src/Form/index.d.ts
1172
933
  /**
1173
- * Render a data-aware Ant Design form with optional FaasJS submission helpers.
934
+ * Render a data-aware Ant Design form without the built-in FaasJS submit handler.
1174
935
  *
1175
936
  * The component normalizes `initialValues` with {@link transferValue}, renders item definitions
1176
- * through {@link FormItem}, and can either delegate submission to a custom `onFinish` handler or
1177
- * the built-in FaasJS request flow configured by `faas`.
937
+ * through {@link FormItem}, and delegates submission to the custom `onFinish` handler.
1178
938
  *
1179
939
  * @template Values - Form values shape.
1180
- * @param {FormProps<Values>} props - Form props including items, submit behavior, and FaasJS integration.
940
+ * @param {FormWithoutFaasProps<Values>} props - Form props including items, submit behavior, and a custom `onFinish` handler.
1181
941
  *
1182
942
  * @example
1183
943
  * ```tsx
@@ -1197,6 +957,20 @@ type FormProps<Values extends Record<string, any> = any, ExtendItemProps extends
1197
957
  * )
1198
958
  * }
1199
959
  * ```
960
+ */
961
+ declare function Form<Values extends Record<string, any> = any>(props: FormWithoutFaasProps<Values>): JSX.Element;
962
+ /**
963
+ * Render a data-aware Ant Design form with the built-in FaasJS submit handler.
964
+ *
965
+ * The component normalizes `initialValues` with {@link transferValue}, renders item definitions
966
+ * through {@link FormItem}, and submits via the built-in FaasJS request flow configured by `faas`.
967
+ *
968
+ * When `Path` is provided, the `action` and `params` in `faas` are strongly typed from the
969
+ * {@link FaasActions} type augmentation.
970
+ *
971
+ * @template Path - Action path type inferred from `faas.action` for strong typing.
972
+ * @template Values - Form values shape.
973
+ * @param {FormWithFaasProps<Path, Values>} props - Form props including items, submit behavior, and FaasJS integration.
1200
974
  *
1201
975
  * @example
1202
976
  * ```tsx
@@ -1221,7 +995,11 @@ type FormProps<Values extends Record<string, any> = any, ExtendItemProps extends
1221
995
  * }
1222
996
  * ```
1223
997
  */
1224
- declare function Form<Values extends Record<string, any> = any>(props: FormProps<Values>): _$react_jsx_runtime0.JSX.Element | null;
998
+ declare function Form<Path extends FaasActionPaths, Values extends Record<string, any> = any>(props: FormWithFaasProps<Path, Values>): JSX.Element;
999
+ /**
1000
+ * Render a data-aware Ant Design form (catch-all overload for backward compatibility).
1001
+ */
1002
+ declare function Form<Values extends Record<string, any> = any, Path extends FaasActionPaths = any>(props: FormProps<Values, Path>): JSX.Element;
1225
1003
  declare namespace Form {
1226
1004
  var useForm: typeof _$antd_es_form_Form0.useForm;
1227
1005
  var useFormInstance: typeof _$antd_es_form_hooks_useFormInstance0.default;
@@ -1391,6 +1169,44 @@ interface RoutesProps {
1391
1169
  */
1392
1170
  declare function Routes(props: RoutesProps): _$react_jsx_runtime0.JSX.Element;
1393
1171
  //#endregion
1172
+ //#region src/Table/table.d.ts
1173
+ /**
1174
+ * Render an Ant Design table from FaasJS item metadata.
1175
+ *
1176
+ * The component can render local `dataSource` rows or resolve remote rows through `faasData`. It
1177
+ * also generates default filters and sorters for built-in item types unless you disable them with
1178
+ * the corresponding Ant Design column props.
1179
+ *
1180
+ * @template T - Row record type rendered by the table.
1181
+ * @template ExtendTypes - Additional item prop shape accepted by `items`.
1182
+ * @param {TableProps<T, ExtendTypes>} props - Table props including columns, data source, and optional Faas data config.
1183
+ * @throws {Error} When an entry in `extendTypes` omits both `children` and `render`.
1184
+ *
1185
+ * @example
1186
+ * ```tsx
1187
+ * import { Table } from '@faasjs/ant-design'
1188
+ *
1189
+ * const rows = [
1190
+ * { id: 1, name: 'Alice', active: true },
1191
+ * { id: 2, name: 'Bob', active: false },
1192
+ * ]
1193
+ *
1194
+ * export function UserTable() {
1195
+ * return (
1196
+ * <Table
1197
+ * rowKey="id"
1198
+ * dataSource={rows}
1199
+ * items={[
1200
+ * { id: 'name', title: 'Name' },
1201
+ * { id: 'active', type: 'boolean', title: 'Active' },
1202
+ * ]}
1203
+ * />
1204
+ * )
1205
+ * }
1206
+ * ```
1207
+ */
1208
+ declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): _$react_jsx_runtime0.JSX.Element;
1209
+ //#endregion
1394
1210
  //#region src/Tabs/index.d.ts
1395
1211
  /**
1396
1212
  * Tab item accepted by the FaasJS Ant Design {@link Tabs} wrapper.
@@ -1573,4 +1389,4 @@ declare function useApp<NewT extends useAppProps = useAppProps>(this: void): Rea
1573
1389
  */
1574
1390
  declare function useThemeToken(): GlobalToken;
1575
1391
  //#endregion
1576
- export { App, AppContext, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, FormFaasProps, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, createOnErrorHandler, faas, idToTitle, lazy, renderDisplayValue, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
1392
+ export { App, AppContext, AppProps, BaseExtendTypeProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, type DescriptionCommonProps, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DescriptionWithFaasProps, type DescriptionWithoutFaasProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, type FormFaasProps, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, type FormWithFaasProps, type FormWithoutFaasProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, createOnErrorHandler, faas, idToTitle, lazy, renderDisplayValue, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
package/dist/index.mjs CHANGED
@@ -4,8 +4,8 @@ import { BrowserRouter, Route, Routes as Routes$1, useLocation, useNavigate } fr
4
4
  import { cloneDeep, defaultsDeep, isNil, uniqBy } from "lodash-es";
5
5
  import { Suspense, cloneElement, createContext, createElement, isValidElement, lazy, useContext, useState } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
- import dayjs from "dayjs";
8
7
  import { CheckOutlined, CloseOutlined, MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
8
+ import dayjs from "dayjs";
9
9
  //#region src/Loading/index.tsx
10
10
  /**
11
11
  * Render an Ant Design loading spinner with an optional content fallback.
@@ -134,10 +134,10 @@ function FaasDataWrapper(props) {
134
134
  /**
135
135
  * Wrap a component with {@link FaasDataWrapper} and its Ant Design loading fallback.
136
136
  *
137
- * @template PathOrData - Action path or response data type used for inference.
137
+ * @template Path - Action path or response data type used for inference.
138
138
  * @template TComponentProps - Component props including injected Faas data fields.
139
139
  * @param {React.FC<TComponentProps & Record<string, any>>} Component - Component that consumes injected Faas data props.
140
- * @param {FaasDataWrapperProps<PathOrData>} faasProps - Request configuration forwarded to {@link FaasDataWrapper}.
140
+ * @param {FaasDataWrapperProps<Path>} faasProps - Request configuration forwarded to {@link FaasDataWrapper}.
141
141
  * @returns Higher-order component that injects Faas data props.
142
142
  *
143
143
  * @example
@@ -674,43 +674,12 @@ function renderDisplayValue(type, value, options) {
674
674
  }
675
675
  }
676
676
  //#endregion
677
- //#region src/data/index.ts
678
- /**
679
- * Convert a snake_case, kebab-case, or spaced identifier into a title-style label.
680
- *
681
- * @param {string | number} id - Identifier to convert.
682
- * @returns Generated label string.
683
- *
684
- * @example
685
- * ```ts
686
- * idToTitle('example_id') // 'Example Id'
687
- * ```
688
- */
677
+ //#region src/data/utils.ts
689
678
  function idToTitle(id) {
690
679
  if (typeof id === "number") return id.toString();
691
680
  const splitted = id.split(/(\s|_|-)/).filter((word) => !/(\s|_|-)/.test(word)).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
692
681
  return splitted.charAt(0).toUpperCase() + splitted.slice(1);
693
682
  }
694
- /**
695
- * Normalize primitive options into explicit `{ label, value }` objects.
696
- *
697
- * String and number options are converted with {@link idToTitle}, while pre-shaped option objects
698
- * are returned as-is.
699
- *
700
- * @param {BaseOption[]} options - Raw option list to normalize.
701
- * @returns Normalized option list.
702
- *
703
- * @example
704
- * ```ts
705
- * import { transferOptions } from '@faasjs/ant-design'
706
- *
707
- * transferOptions(['draft', { label: 'Published', value: 'published' }])
708
- * // [
709
- * // { label: 'Draft', value: 'draft' },
710
- * // { label: 'Published', value: 'published' },
711
- * // ]
712
- * ```
713
- */
714
683
  function transferOptions(options) {
715
684
  if (!options) return [];
716
685
  return options.map((item) => typeof item === "object" ? item : {
@@ -718,25 +687,6 @@ function transferOptions(options) {
718
687
  value: item
719
688
  });
720
689
  }
721
- /**
722
- * Normalize raw values into the runtime shape expected by FaasJS Ant Design components.
723
- *
724
- * Primitive strings such as `'null'` and `'undefined'` become `null`, comma-delimited array
725
- * strings are split into arrays, and date or time values are converted to `dayjs` objects.
726
- *
727
- * @param {FaasItemType | null | undefined} type - Target field type.
728
- * @param {any} value - Raw value to normalize.
729
- * @returns Normalized value for rendering or form initialization.
730
- *
731
- * @example
732
- * ```ts
733
- * import { transferValue } from '@faasjs/ant-design'
734
- *
735
- * transferValue('number', '42') // 42
736
- * transferValue('boolean', 'true') // true
737
- * transferValue('string[]', 'a,b') // ['a', 'b']
738
- * ```
739
- */
740
690
  function transferValue(type, value) {
741
691
  if (!type) type = "string";
742
692
  if (!type.endsWith("[]") && (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined")) return null;
@@ -761,29 +711,6 @@ function transferValue(type, value) {
761
711
  }
762
712
  return value;
763
713
  }
764
- /**
765
- * Clone a {@link UnionFaasItemElement} with FaasJS injection props.
766
- *
767
- * React elements are cloned directly, while component references are first wrapped with
768
- * `createElement`.
769
- *
770
- * @param {UnionFaasItemElement} element - Element or component to clone.
771
- * @param {any} props - Injection props such as `scene`, `value`, `values`, and `index`.
772
- * @returns Cloned React element ready for rendering.
773
- *
774
- * @example
775
- * ```tsx
776
- * import { cloneUnionFaasItemElement, type UnionFaasItemElement } from '@faasjs/ant-design'
777
- *
778
- * const Cell: UnionFaasItemElement<string> = ({ value }) => <span>{value}</span>
779
- *
780
- * const element = cloneUnionFaasItemElement(Cell, {
781
- * scene: 'table',
782
- * value: 'Hello',
783
- * index: 0,
784
- * })
785
- * ```
786
- */
787
714
  function cloneUnionFaasItemElement(element, props) {
788
715
  return cloneElement(isValidElement(element) ? element : createElement(element), props);
789
716
  }
@@ -836,37 +763,6 @@ function DescriptionItemContent(props) {
836
763
  return /* @__PURE__ */ jsx(Fragment, { children: renderDisplayValue(type, value, options) });
837
764
  }
838
765
  DescriptionItemContent.displayName = "DescriptionItemContent";
839
- /**
840
- * Render an Ant Design description list from FaasJS item metadata.
841
- *
842
- * The component can render a local `dataSource` directly or resolve one through `faasData`, and
843
- * it applies the same item type normalization helpers used by the form and table components.
844
- *
845
- * @template T - Data record shape rendered by the component.
846
- * @param {DescriptionProps<T>} props - Description props including items, data source, and optional Faas data config.
847
- * @throws {Error} When an entry in `extendTypes` omits both `children` and `render`.
848
- *
849
- * @example
850
- * ```tsx
851
- * import { Description } from '@faasjs/ant-design'
852
- *
853
- * export function Detail() {
854
- * return (
855
- * <Description
856
- * title="Title"
857
- * items={[
858
- * {
859
- * id: 'id',
860
- * title: 'Title',
861
- * type: 'string',
862
- * },
863
- * ]}
864
- * dataSource={{ id: 'value' }}
865
- * />
866
- * )
867
- * }
868
- * ```
869
- */
870
766
  function Description(props) {
871
767
  const { faasData, dataSource, renderTitle, extendTypes, ...descriptionProps } = props;
872
768
  if (faasData && !dataSource) {
@@ -1213,58 +1109,6 @@ FormItem.useStatus = Form$1.Item.useStatus;
1213
1109
  function isFormItemProps(item) {
1214
1110
  return item.id !== void 0;
1215
1111
  }
1216
- /**
1217
- * Render a data-aware Ant Design form with optional FaasJS submission helpers.
1218
- *
1219
- * The component normalizes `initialValues` with {@link transferValue}, renders item definitions
1220
- * through {@link FormItem}, and can either delegate submission to a custom `onFinish` handler or
1221
- * the built-in FaasJS request flow configured by `faas`.
1222
- *
1223
- * @template Values - Form values shape.
1224
- * @param {FormProps<Values>} props - Form props including items, submit behavior, and FaasJS integration.
1225
- *
1226
- * @example
1227
- * ```tsx
1228
- * import { Form } from '@faasjs/ant-design'
1229
- *
1230
- * export function ProfileForm() {
1231
- * return (
1232
- * <Form
1233
- * items={[
1234
- * { id: 'name', required: true },
1235
- * { id: 'email', required: true },
1236
- * ]}
1237
- * onFinish={async (values) => {
1238
- * console.log(values)
1239
- * }}
1240
- * />
1241
- * )
1242
- * }
1243
- * ```
1244
- *
1245
- * @example
1246
- * ```tsx
1247
- * import { Form } from '@faasjs/ant-design'
1248
- *
1249
- * export function CreateUserForm() {
1250
- * return (
1251
- * <Form
1252
- * initialValues={{ role: 'user' }}
1253
- * items={[
1254
- * { id: 'name', required: true },
1255
- * { id: 'role', options: ['user', 'admin'] },
1256
- * ]}
1257
- * faas={{
1258
- * action: 'user/create',
1259
- * params: (values) => ({
1260
- * role: values.role || 'user',
1261
- * }),
1262
- * }}
1263
- * />
1264
- * )
1265
- * }
1266
- * ```
1267
- */
1268
1112
  function Form(props) {
1269
1113
  const [loading, setLoading] = useState(false);
1270
1114
  const [antdProps, setAntdProps] = useState();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "8.0.0-beta.29",
3
+ "version": "8.0.0-beta.30",
4
4
  "homepage": "https://faasjs.com/doc/ant-design",
5
5
  "bugs": {
6
6
  "url": "https://github.com/faasjs/faasjs/issues"
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@ant-design/icons": "*",
30
- "@faasjs/react": ">=8.0.0-beta.29",
30
+ "@faasjs/react": ">=8.0.0-beta.30",
31
31
  "@types/lodash-es": "*",
32
32
  "@types/react": "^19.0.0",
33
33
  "@types/react-dom": "^19.0.0",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@ant-design/icons": "*",
42
- "@faasjs/react": ">=8.0.0-beta.29",
42
+ "@faasjs/react": ">=8.0.0-beta.30",
43
43
  "antd": "^6.0.0",
44
44
  "lodash-es": "*",
45
45
  "react": "^19.0.0",