@bsol-oss/react-datatable5 12.0.0-beta.8 → 12.0.0-beta.80

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.
Files changed (127) hide show
  1. package/README.md +224 -5
  2. package/dist/index.d.ts +606 -96
  3. package/dist/index.js +2679 -610
  4. package/dist/index.mjs +2683 -619
  5. package/dist/types/components/DataTable/DataTable.d.ts +12 -7
  6. package/dist/types/components/DataTable/DataTableServer.d.ts +6 -4
  7. package/dist/types/components/DataTable/DefaultTable.d.ts +12 -14
  8. package/dist/types/components/DataTable/DefaultTableServer.d.ts +23 -0
  9. package/dist/types/components/DataTable/context/DataTableContext.d.ts +21 -3
  10. package/dist/types/components/DataTable/context/useDataTableContext.d.ts +2 -2
  11. package/dist/types/components/DataTable/controls/ReloadButton.d.ts +1 -2
  12. package/dist/types/components/DataTable/controls/ResetFilteringButton.d.ts +1 -4
  13. package/dist/types/components/DataTable/controls/ResetSelectionButton.d.ts +1 -4
  14. package/dist/types/components/DataTable/controls/ResetSortingButton.d.ts +1 -4
  15. package/dist/types/components/DataTable/controls/TableControls.d.ts +10 -2
  16. package/dist/types/components/DataTable/display/Table.d.ts +3 -3
  17. package/dist/types/components/DataTable/display/TableBody.d.ts +1 -2
  18. package/dist/types/components/DataTable/display/TableBodySkeleton.d.ts +5 -0
  19. package/dist/types/components/DataTable/display/TableCardContainer.d.ts +6 -3
  20. package/dist/types/components/DataTable/display/TableDataDisplay.d.ts +6 -1
  21. package/dist/types/components/DataTable/display/TableFooter.d.ts +1 -5
  22. package/dist/types/components/DataTable/display/TableHeader.d.ts +46 -8
  23. package/dist/types/components/DataTable/useDataTableServer.d.ts +55 -3
  24. package/dist/types/components/DatePicker/DatePicker.d.ts +23 -0
  25. package/dist/types/components/DatePicker/DateTimePicker.d.ts +11 -0
  26. package/dist/types/components/DatePicker/DurationPicker.d.ts +12 -0
  27. package/dist/types/components/DatePicker/IsoTimePicker.d.ts +16 -0
  28. package/dist/types/components/DatePicker/PickerDemo.d.ts +1 -0
  29. package/dist/types/components/DatePicker/UniversalPicker.d.ts +9 -0
  30. package/dist/types/components/DatePicker/index.d.ts +7 -0
  31. package/dist/types/components/Filter/TagFilter.d.ts +5 -1
  32. package/dist/types/components/Form/SchemaFormContext.d.ts +22 -6
  33. package/dist/types/components/Form/components/FileDropzone.d.ts +2 -2
  34. package/dist/types/components/Form/components/core/DefaultForm.d.ts +1 -0
  35. package/dist/types/components/Form/components/core/FormBody.d.ts +2 -1
  36. package/dist/types/components/Form/components/core/FormRoot.d.ts +21 -8
  37. package/dist/types/components/Form/components/fields/BooleanPicker.d.ts +1 -1
  38. package/dist/types/components/Form/components/fields/ColumnRenderer.d.ts +3 -2
  39. package/dist/types/components/Form/components/fields/CustomInput.d.ts +8 -0
  40. package/dist/types/components/Form/components/fields/DatePicker.d.ts +2 -7
  41. package/dist/types/components/Form/components/fields/DateRangePicker.d.ts +2 -0
  42. package/dist/types/components/Form/components/fields/DateTimePicker.d.ts +2 -0
  43. package/dist/types/components/Form/components/fields/EnumPicker.d.ts +3 -2
  44. package/dist/types/components/Form/components/fields/FilePicker.d.ts +2 -5
  45. package/dist/types/components/Form/components/fields/IdPicker.d.ts +1 -1
  46. package/dist/types/components/Form/components/fields/NumberInputField.d.ts +1 -1
  47. package/dist/types/components/Form/components/fields/ObjectInput.d.ts +1 -1
  48. package/dist/types/components/Form/components/fields/RecordInput.d.ts +1 -1
  49. package/dist/types/components/Form/components/fields/SchemaRenderer.d.ts +1 -1
  50. package/dist/types/components/Form/components/fields/StringInputField.d.ts +19 -5
  51. package/dist/types/components/Form/components/fields/TextAreaInput.d.ts +12 -0
  52. package/dist/types/components/Form/components/{DatePicker.d.ts → fields/TimePicker.d.ts} +2 -2
  53. package/dist/types/components/Form/components/fields/types.d.ts +6 -0
  54. package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +77 -4
  55. package/dist/types/components/Form/components/viewers/CustomViewer.d.ts +8 -0
  56. package/dist/types/components/Form/components/viewers/DateTimeViewer.d.ts +7 -0
  57. package/dist/types/components/Form/components/viewers/NumberViewer.d.ts +1 -1
  58. package/dist/types/components/Form/components/viewers/TextAreaViewer.d.ts +12 -0
  59. package/dist/types/components/Form/components/viewers/TimeViewer.d.ts +7 -0
  60. package/dist/types/components/Form/useForm.d.ts +6 -3
  61. package/dist/types/components/Form/utils/ajvResolver.d.ts +13 -0
  62. package/dist/types/components/Form/utils/buildErrorMessages.d.ts +223 -0
  63. package/dist/types/components/Form/utils/formatBytes.d.ts +6 -0
  64. package/dist/types/components/Form/utils/getFieldError.d.ts +6 -0
  65. package/dist/types/components/Form/utils/useFormI18n.d.ts +53 -0
  66. package/dist/types/components/Form/utils/validateData.d.ts +9 -0
  67. package/dist/types/components/TextArea/TextArea.d.ts +22 -0
  68. package/dist/types/components/TimePicker/TimePicker.d.ts +21 -0
  69. package/dist/types/components/ui/field.d.ts +3 -3
  70. package/dist/types/index.d.ts +19 -2
  71. package/package.json +18 -3
  72. package/dist/types/components/Controls/DensityFeature.d.ts +0 -23
  73. package/dist/types/components/Controls/DensityToggleButton.d.ts +0 -6
  74. package/dist/types/components/Controls/EditFilterButton.d.ts +0 -9
  75. package/dist/types/components/Controls/EditOrderButton.d.ts +0 -7
  76. package/dist/types/components/Controls/EditSortingButton.d.ts +0 -7
  77. package/dist/types/components/Controls/EditViewButton.d.ts +0 -7
  78. package/dist/types/components/Controls/FilterDialog.d.ts +0 -5
  79. package/dist/types/components/Controls/PageSizeControl.d.ts +0 -4
  80. package/dist/types/components/Controls/Pagination.d.ts +0 -1
  81. package/dist/types/components/Controls/ResetFilteringButton.d.ts +0 -4
  82. package/dist/types/components/Controls/ResetSelectionButton.d.ts +0 -4
  83. package/dist/types/components/Controls/ResetSortingButton.d.ts +0 -4
  84. package/dist/types/components/Controls/RowCountText.d.ts +0 -1
  85. package/dist/types/components/Controls/SelectAllRowsToggle.d.ts +0 -8
  86. package/dist/types/components/Controls/TablePagination.d.ts +0 -1
  87. package/dist/types/components/Controls/ViewDialog.d.ts +0 -5
  88. package/dist/types/components/DataTable/CardHeader.d.ts +0 -13
  89. package/dist/types/components/DataTable/DataDisplay.d.ts +0 -6
  90. package/dist/types/components/DataTable/ReloadButton.d.ts +0 -5
  91. package/dist/types/components/DataTable/Table.d.ts +0 -10
  92. package/dist/types/components/DataTable/TableBody.d.ts +0 -21
  93. package/dist/types/components/DataTable/TableCardContainer.d.ts +0 -7
  94. package/dist/types/components/DataTable/TableCards.d.ts +0 -11
  95. package/dist/types/components/DataTable/TableComponent.d.ts +0 -6
  96. package/dist/types/components/DataTable/TableControls.d.ts +0 -21
  97. package/dist/types/components/DataTable/TableFilter.d.ts +0 -1
  98. package/dist/types/components/DataTable/TableFilterTags.d.ts +0 -1
  99. package/dist/types/components/DataTable/TableFilters.d.ts +0 -1
  100. package/dist/types/components/DataTable/TableFooter.d.ts +0 -9
  101. package/dist/types/components/DataTable/TableHeader.d.ts +0 -13
  102. package/dist/types/components/DataTable/TableLoadingComponent.d.ts +0 -5
  103. package/dist/types/components/DataTable/TableOrderer.d.ts +0 -1
  104. package/dist/types/components/DataTable/TableSelector.d.ts +0 -1
  105. package/dist/types/components/DataTable/TableSorter.d.ts +0 -1
  106. package/dist/types/components/DataTable/TableViewer.d.ts +0 -1
  107. package/dist/types/components/DataTable/TextCell.d.ts +0 -10
  108. package/dist/types/components/DataTable/components/EmptyState.d.ts +0 -5
  109. package/dist/types/components/DataTable/components/ErrorAlert.d.ts +0 -4
  110. package/dist/types/components/DataTable/components/RecordDisplay.d.ts +0 -9
  111. package/dist/types/components/DataTable/components/TextCell.d.ts +0 -10
  112. package/dist/types/components/Filter/DateRangeFilter.d.ts +0 -9
  113. package/dist/types/components/Filter/FilterOptions.d.ts +0 -4
  114. package/dist/types/components/Form/Form.d.ts +0 -36
  115. package/dist/types/components/Form/components/ArrayRenderer.d.ts +0 -7
  116. package/dist/types/components/Form/components/BooleanPicker.d.ts +0 -7
  117. package/dist/types/components/Form/components/ColumnRenderer.d.ts +0 -7
  118. package/dist/types/components/Form/components/EnumPicker.d.ts +0 -8
  119. package/dist/types/components/Form/components/FilePicker.d.ts +0 -5
  120. package/dist/types/components/Form/components/IdPicker.d.ts +0 -8
  121. package/dist/types/components/Form/components/IdViewer.d.ts +0 -5
  122. package/dist/types/components/Form/components/NumberInputField.d.ts +0 -7
  123. package/dist/types/components/Form/components/ObjectInput.d.ts +0 -7
  124. package/dist/types/components/Form/components/RecordInput.d.ts +0 -7
  125. package/dist/types/components/Form/components/SchemaRenderer.d.ts +0 -7
  126. package/dist/types/components/Form/components/StringInputField.d.ts +0 -20
  127. package/dist/types/components/Form/components/TagPicker.d.ts +0 -30
@@ -1,11 +1,12 @@
1
- import { ForeignKeyProps } from "@/components/Form/components/fields/StringInputField";
2
- import { AxiosRequestConfig } from "axios";
3
- import { JSONSchema7 } from "json-schema";
4
- import { Dispatch, ReactNode, SetStateAction } from "react";
5
- import { FieldValues, SubmitHandler, UseFormReturn } from "react-hook-form";
6
- import { UseTranslationResponse } from "react-i18next";
1
+ import { ForeignKeyProps } from '@/components/Form/components/fields/StringInputField';
2
+ import { AxiosRequestConfig } from 'axios';
3
+ import { JSONSchema7 } from 'json-schema';
4
+ import { Dispatch, ReactNode, SetStateAction } from 'react';
5
+ import { FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
6
+ import { UseTranslationResponse } from 'react-i18next';
7
+ import { CustomJSONSchema7, DateTimePickerLabels, IdPickerLabels, EnumPickerLabels, FilePickerLabels } from '../types/CustomJSONSchema7';
7
8
  export interface FormRootProps<TData extends FieldValues> {
8
- schema: JSONSchema7;
9
+ schema: CustomJSONSchema7;
9
10
  serverUrl: string;
10
11
  requestUrl?: string;
11
12
  idMap: Record<string, object>;
@@ -20,6 +21,18 @@ export interface FormRootProps<TData extends FieldValues> {
20
21
  rowNumber?: number | string;
21
22
  requestOptions?: AxiosRequestConfig;
22
23
  getUpdatedData?: () => TData | Promise<TData> | void;
24
+ customErrorRenderer?: (error: unknown) => ReactNode;
25
+ customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
26
+ displayConfig?: {
27
+ showSubmitButton?: boolean;
28
+ showResetButton?: boolean;
29
+ showTitle?: boolean;
30
+ };
31
+ requireConfirmation?: boolean;
32
+ dateTimePickerLabels?: DateTimePickerLabels;
33
+ idPickerLabels?: IdPickerLabels;
34
+ enumPickerLabels?: EnumPickerLabels;
35
+ filePickerLabels?: FilePickerLabels;
23
36
  }
24
37
  export interface CustomJSONSchema7Definition extends JSONSchema7 {
25
38
  variant: string;
@@ -36,4 +49,4 @@ export declare const idPickerSanityCheck: (column: string, foreign_key?: {
36
49
  column?: string | undefined;
37
50
  display_column?: string | undefined;
38
51
  } | undefined) => void;
39
- export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, customSuccessRenderer, displayConfig, requireConfirmation, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface DatePickerProps {
3
3
  column: string;
4
4
  schema: CustomJSONSchema7;
@@ -1,7 +1,8 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface ColumnRendererProps {
3
3
  column: string;
4
4
  properties: Record<string, CustomJSONSchema7>;
5
5
  prefix: string;
6
+ parentRequired?: string[];
6
7
  }
7
- export declare const ColumnRenderer: ({ column, properties, prefix, }: ColumnRendererProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const ColumnRenderer: ({ column, properties, prefix, parentRequired, }: ColumnRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
3
+ export interface DatePickerProps {
4
+ column: string;
5
+ schema: CustomJSONSchema7;
6
+ prefix: string;
7
+ }
8
+ export declare const CustomInput: ({ column, schema, prefix }: DatePickerProps) => import("react").ReactNode;
@@ -1,7 +1,2 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
2
- export interface DatePickerProps {
3
- column: string;
4
- schema: CustomJSONSchema7;
5
- prefix: string;
6
- }
7
- export declare const DatePicker: ({ column, schema, prefix }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { InputDefaultProps } from './types';
2
+ export declare const DatePicker: ({ column, schema, prefix }: InputDefaultProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { InputDefaultProps } from './types';
2
+ export declare const DateRangePicker: ({ column, schema, prefix, }: InputDefaultProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { InputDefaultProps } from './types';
2
+ export declare const DateTimePicker: ({ column, schema, prefix, }: InputDefaultProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface IdPickerProps {
3
3
  column: string;
4
4
  isMultiple?: boolean;
5
5
  schema: CustomJSONSchema7;
6
6
  prefix: string;
7
+ showTotalAndLimit?: boolean;
7
8
  }
8
- export declare const EnumPicker: ({ column, isMultiple, schema, prefix, }: IdPickerProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const EnumPicker: ({ column, isMultiple, schema, prefix, showTotalAndLimit, }: IdPickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,2 @@
1
- export declare const FilePicker: ({ column, schema, prefix }: {
2
- column: any;
3
- schema: any;
4
- prefix: any;
5
- }) => import("react/jsx-runtime").JSX.Element;
1
+ import { InputDefaultProps } from './types';
2
+ export declare const FilePicker: ({ column, schema, prefix }: InputDefaultProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface IdPickerProps {
3
3
  column: string;
4
4
  schema: CustomJSONSchema7;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface NumberInputFieldProps {
3
3
  column: string;
4
4
  schema: CustomJSONSchema7;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface ObjectInputProps {
3
3
  schema: CustomJSONSchema7;
4
4
  column: string;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface DatePickerProps {
3
3
  schema: CustomJSONSchema7;
4
4
  column: string;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface SchemaRendererProps {
3
3
  column: string;
4
4
  schema: CustomJSONSchema7;
@@ -1,12 +1,26 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
2
- export interface StringInputFieldProps {
3
- column: string;
4
- schema: CustomJSONSchema7;
5
- prefix: string;
1
+ import { InputDefaultProps } from './types';
2
+ export interface StringInputFieldProps extends InputDefaultProps {
3
+ }
4
+ export interface CustomQueryFnResponse {
5
+ /**
6
+ * The data of the query
7
+ */
8
+ data: any;
9
+ /**
10
+ * The id map of the data
11
+ */
12
+ idMap: Record<string, any>;
13
+ }
14
+ export interface CustomQueryFnParams {
15
+ searching: string;
16
+ limit: number;
17
+ offset: number;
6
18
  }
19
+ export type CustomQueryFn = (params: CustomQueryFnParams) => Promise<CustomQueryFnResponse>;
7
20
  export interface ForeignKeyProps {
8
21
  column: string;
9
22
  table: string;
10
23
  display_column: string;
24
+ customQueryFn?: CustomQueryFn;
11
25
  }
12
26
  export declare const StringInputField: ({ column, schema, prefix, }: StringInputFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
+ export interface TextAreaInputProps {
3
+ column: string;
4
+ schema: CustomJSONSchema7;
5
+ prefix: string;
6
+ }
7
+ export interface ForeignKeyProps {
8
+ column: string;
9
+ table: string;
10
+ display_column: string;
11
+ }
12
+ export declare const TextAreaInput: ({ column, schema, prefix, }: TextAreaInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import { CustomJSONSchema7 } from "./StringInputField";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface DatePickerProps {
3
3
  column: string;
4
4
  schema: CustomJSONSchema7;
5
5
  prefix: string;
6
6
  }
7
- export declare const DatePicker: ({ column, schema, prefix }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const TimePicker: ({ column, schema, prefix }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
2
+ export type InputDefaultProps = {
3
+ column: string;
4
+ schema: CustomJSONSchema7;
5
+ prefix: string;
6
+ };
@@ -1,15 +1,88 @@
1
- import { JSONSchema7 } from "json-schema";
2
- import { ReactNode } from "react";
3
- import { ForeignKeyProps } from "../fields/StringInputField";
1
+ import { JSONSchema7 } from 'json-schema';
2
+ import { ReactNode } from 'react';
3
+ import { ForeignKeyProps } from '../fields/StringInputField';
4
+ import { UseFormReturn } from 'react-hook-form';
5
+ import { ValidationErrorType } from '../../utils/buildErrorMessages';
6
+ export interface DateTimePickerLabels {
7
+ monthNamesShort?: string[];
8
+ weekdayNamesShort?: string[];
9
+ backButtonLabel?: string;
10
+ forwardButtonLabel?: string;
11
+ }
12
+ export interface IdPickerLabels {
13
+ undefined?: string;
14
+ addMore?: string;
15
+ typeToSearch?: string;
16
+ total?: string;
17
+ showing?: string;
18
+ perPage?: string;
19
+ emptySearchResult?: string;
20
+ initialResults?: string;
21
+ }
22
+ export interface EnumPickerLabels {
23
+ undefined?: string;
24
+ addMore?: string;
25
+ typeToSearch?: string;
26
+ total?: string;
27
+ showing?: string;
28
+ perPage?: string;
29
+ emptySearchResult?: string;
30
+ initialResults?: string;
31
+ }
32
+ export interface FilePickerLabels {
33
+ fileDropzone?: string;
34
+ browseLibrary?: string;
35
+ dialogTitle?: string;
36
+ searchPlaceholder?: string;
37
+ loading?: string;
38
+ loadingFailed?: string;
39
+ noFilesFound?: string;
40
+ cancel?: string;
41
+ select?: string;
42
+ }
4
43
  export interface CustomJSONSchema7 extends JSONSchema7 {
5
44
  gridColumn?: string;
6
45
  gridRow?: string;
7
46
  foreign_key?: ForeignKeyProps;
8
47
  variant?: string;
9
- renderDisplay: (item: unknown) => ReactNode;
48
+ renderDisplay?: (item: unknown) => ReactNode;
49
+ inputRender?: (props: {
50
+ column: string;
51
+ schema: CustomJSONSchema7;
52
+ prefix: string;
53
+ formContext: UseFormReturn;
54
+ }) => ReactNode;
55
+ inputViewerRender?: (props: {
56
+ column: string;
57
+ schema: CustomJSONSchema7;
58
+ prefix: string;
59
+ formContext: UseFormReturn;
60
+ }) => ReactNode;
61
+ dateFormat?: string;
62
+ displayDateFormat?: string;
63
+ timeFormat?: string;
64
+ displayTimeFormat?: string;
65
+ showLabel?: boolean;
66
+ formatOptions?: Intl.NumberFormatOptions;
67
+ numberStorageType?: 'string' | 'number';
68
+ errorMessages?: Partial<Record<ValidationErrorType | string, string>>;
69
+ filePicker?: FilePickerProps;
10
70
  }
11
71
  export interface TagPickerProps {
12
72
  column: string;
13
73
  schema: CustomJSONSchema7;
14
74
  prefix: string;
15
75
  }
76
+ export interface FilePickerMediaFile {
77
+ id: string;
78
+ name: string;
79
+ url?: string;
80
+ size?: string | number;
81
+ comment?: string;
82
+ type?: string;
83
+ }
84
+ export interface FilePickerProps {
85
+ onFetchFiles?: (search: string) => Promise<FilePickerMediaFile[]>;
86
+ enableMediaLibrary?: boolean;
87
+ filterImageOnly?: boolean;
88
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
3
+ export interface DatePickerProps {
4
+ column: string;
5
+ schema: CustomJSONSchema7;
6
+ prefix: string;
7
+ }
8
+ export declare const CustomViewer: ({ column, schema, prefix }: DatePickerProps) => import("react").ReactNode;
@@ -0,0 +1,7 @@
1
+ import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
2
+ export interface DateViewerProps {
3
+ column: string;
4
+ schema: CustomJSONSchema7;
5
+ prefix: string;
6
+ }
7
+ export declare const DateTimeViewer: ({ column, schema, prefix }: DateViewerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
1
+ import { CustomJSONSchema7 } from '../types/CustomJSONSchema7';
2
2
  export interface NumberInputFieldProps {
3
3
  column: string;
4
4
  schema: CustomJSONSchema7;
@@ -0,0 +1,12 @@
1
+ import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
2
+ export interface TextAreaViewerProps {
3
+ column: string;
4
+ schema: CustomJSONSchema7;
5
+ prefix: string;
6
+ }
7
+ export interface ForeignKeyProps {
8
+ column: string;
9
+ table: string;
10
+ display_column: string;
11
+ }
12
+ export declare const TextAreaViewer: ({ column, schema, prefix, }: TextAreaViewerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { CustomJSONSchema7 } from "../types/CustomJSONSchema7";
2
+ export interface TimeViewerProps {
3
+ column: string;
4
+ schema: CustomJSONSchema7;
5
+ prefix: string;
6
+ }
7
+ export declare const TimeViewer: ({ column, schema, prefix }: TimeViewerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,15 @@
1
1
  /// <reference types="react" />
2
- import { FieldValues } from "react-hook-form";
2
+ import { FieldValues } from 'react-hook-form';
3
+ import { JSONSchema7 } from 'json-schema';
3
4
  export interface UseFormProps {
4
5
  preLoadedValues?: FieldValues | undefined;
5
6
  keyPrefix?: string;
7
+ namespace?: string;
8
+ schema?: JSONSchema7;
6
9
  }
7
- export declare const useForm: ({ preLoadedValues, keyPrefix }: UseFormProps) => {
10
+ export declare const useForm: ({ preLoadedValues, keyPrefix, namespace, schema, }: UseFormProps) => {
8
11
  form: import("react-hook-form").UseFormReturn<FieldValues, any, undefined>;
9
12
  idMap: Record<string, object>;
10
13
  setIdMap: import("react").Dispatch<import("react").SetStateAction<Record<string, object>>>;
11
- translate: import("react-i18next").UseTranslationResponse<"", string>;
14
+ translate: import("react-i18next").UseTranslationResponse<string, string>;
12
15
  };
@@ -0,0 +1,13 @@
1
+ import { FieldValues, Resolver } from 'react-hook-form';
2
+ import { ErrorObject } from 'ajv';
3
+ import { CustomJSONSchema7 } from '../components/types/CustomJSONSchema7';
4
+ /**
5
+ * Converts AJV error objects to react-hook-form field errors format
6
+ */
7
+ export declare const convertAjvErrorsToFieldErrors: (errors: ErrorObject<string, Record<string, unknown>, unknown>[] | null | undefined, schema: CustomJSONSchema7) => Record<string, {
8
+ type: string;
9
+ keyword: string;
10
+ params?: Record<string, unknown>;
11
+ message?: string;
12
+ }>;
13
+ export declare const ajvResolver: <T extends FieldValues>(schema: CustomJSONSchema7) => Resolver<T>;
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Type definitions for error message configuration
3
+ */
4
+ /**
5
+ * Common validation error types that can be customized
6
+ */
7
+ export type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
8
+ /**
9
+ * Configuration for field-specific validation errors
10
+ */
11
+ export type FieldErrorConfig = Partial<Record<ValidationErrorType, string>>;
12
+ /**
13
+ * Configuration for building error messages
14
+ */
15
+ export interface ErrorMessageConfig {
16
+ /**
17
+ * Required field error messages
18
+ * Maps field names to their required error messages
19
+ * Supports both plain strings and i18n translation keys
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * required: {
24
+ * username: "Username is required", // plain string
25
+ * email: "user.email.field_required" // i18n key
26
+ * }
27
+ * ```
28
+ */
29
+ required?: Record<string, string>;
30
+ /**
31
+ * Field-specific validation error messages
32
+ * Maps field names to their validation error configurations
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * properties: {
37
+ * username: {
38
+ * minLength: "Username must be at least 3 characters",
39
+ * pattern: "Username can only contain letters and numbers"
40
+ * },
41
+ * age: {
42
+ * minimum: "Age must be at least 18",
43
+ * maximum: "Age cannot exceed 120"
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ properties?: Record<string, FieldErrorConfig>;
49
+ /**
50
+ * Global fallback error messages for validation types
51
+ * These are used when no field-specific message is provided
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * {
56
+ * minLength: "This field is too short",
57
+ * minimum: "Value is too small"
58
+ * }
59
+ * ```
60
+ */
61
+ [key: string]: any;
62
+ }
63
+ /**
64
+ * Result of buildErrorMessages that follows ajv-errors format
65
+ */
66
+ export interface ErrorMessageResult {
67
+ required?: Record<string, string>;
68
+ properties?: Record<string, FieldErrorConfig>;
69
+ [key: string]: any;
70
+ }
71
+ /**
72
+ * Schema-level error message builder
73
+ *
74
+ * Builds a complete errorMessage object compatible with ajv-errors plugin.
75
+ * Supports both i18n translation keys and plain string messages.
76
+ *
77
+ * @param config - Error message configuration
78
+ * @returns Complete errorMessage object for JSON Schema
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * // Simple required field errors
83
+ * const errorMessage = buildErrorMessages({
84
+ * required: {
85
+ * username: "Username is required",
86
+ * email: "user.email.field_required" // i18n key
87
+ * }
88
+ * });
89
+ *
90
+ * // With validation rules
91
+ * const errorMessage = buildErrorMessages({
92
+ * required: {
93
+ * password: "Password is required"
94
+ * },
95
+ * properties: {
96
+ * password: {
97
+ * minLength: "Password must be at least 8 characters",
98
+ * pattern: "Password must contain letters and numbers"
99
+ * },
100
+ * age: {
101
+ * minimum: "Must be 18 or older",
102
+ * maximum: "Must be under 120"
103
+ * }
104
+ * }
105
+ * });
106
+ *
107
+ * // With global fallbacks
108
+ * const errorMessage = buildErrorMessages({
109
+ * required: {
110
+ * email: "Email is required"
111
+ * },
112
+ * minLength: "This field is too short", // applies to all fields
113
+ * minimum: "Value is too small"
114
+ * });
115
+ * ```
116
+ */
117
+ export declare const buildErrorMessages: (config: ErrorMessageConfig) => ErrorMessageResult;
118
+ /**
119
+ * Converts buildErrorMessages result to ajv-errors compatible format
120
+ */
121
+ export declare const convertToAjvErrorsFormat: (errorMessages: ErrorMessageResult) => Record<string, any>;
122
+ /**
123
+ * Helper function to build required field errors
124
+ *
125
+ * Simplifies creating required field error messages, especially useful
126
+ * for generating i18n translation keys following a pattern.
127
+ *
128
+ * @param fields - Array of required field names
129
+ * @param messageOrGenerator - Either a string template or function to generate messages
130
+ * @returns Required field error configuration
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * // Plain string messages
135
+ * const required = buildRequiredErrors(
136
+ * ["username", "email", "password"],
137
+ * (field) => `${field} is required`
138
+ * );
139
+ * // Result: { username: "username is required", email: "email is required", ... }
140
+ *
141
+ * // i18n translation keys
142
+ * const required = buildRequiredErrors(
143
+ * ["username", "email"],
144
+ * (field) => `user.${field}.field_required`
145
+ * );
146
+ * // Result: { username: "user.username.field_required", email: "user.email.field_required" }
147
+ *
148
+ * // Same message for all fields
149
+ * const required = buildRequiredErrors(
150
+ * ["username", "email"],
151
+ * "This field is required"
152
+ * );
153
+ * // Result: { username: "This field is required", email: "This field is required" }
154
+ *
155
+ * // With keyPrefix for i18n
156
+ * const required = buildRequiredErrors(
157
+ * ["username", "email"],
158
+ * (field) => `${field}.field_required`,
159
+ * "user"
160
+ * );
161
+ * // Result: { username: "user.username.field_required", email: "user.email.field_required" }
162
+ * ```
163
+ */
164
+ export declare const buildRequiredErrors: (fields: string[], messageOrGenerator: string | ((field: string) => string), keyPrefix?: string) => Record<string, string>;
165
+ /**
166
+ * Helper function to build field-specific validation errors
167
+ *
168
+ * Creates property-specific error messages for multiple fields at once.
169
+ *
170
+ * @param config - Maps field names to their validation error configurations
171
+ * @returns Properties error configuration
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const properties = buildFieldErrors({
176
+ * username: {
177
+ * minLength: "Username must be at least 3 characters",
178
+ * pattern: "Username can only contain letters and numbers"
179
+ * },
180
+ * age: {
181
+ * minimum: "Must be 18 or older",
182
+ * maximum: "Must be under 120"
183
+ * },
184
+ * email: {
185
+ * format: "Please enter a valid email address"
186
+ * }
187
+ * });
188
+ * ```
189
+ */
190
+ export declare const buildFieldErrors: (config: Record<string, FieldErrorConfig>) => Record<string, FieldErrorConfig>;
191
+ /**
192
+ * Helper function to create a complete error message configuration in one call
193
+ *
194
+ * Convenient wrapper that combines required and validation errors.
195
+ *
196
+ * @param required - Required field error messages
197
+ * @param properties - Field-specific validation error messages
198
+ * @param globalFallbacks - Global fallback error messages
199
+ * @returns Complete error message configuration
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * const errorMessage = createErrorMessage(
204
+ * {
205
+ * username: "Username is required",
206
+ * email: "Email is required"
207
+ * },
208
+ * {
209
+ * username: {
210
+ * minLength: "Username must be at least 3 characters"
211
+ * },
212
+ * email: {
213
+ * format: "Please enter a valid email"
214
+ * }
215
+ * },
216
+ * {
217
+ * minLength: "This field is too short",
218
+ * format: "Invalid format"
219
+ * }
220
+ * );
221
+ * ```
222
+ */
223
+ export declare const createErrorMessage: (required?: Record<string, string>, properties?: Record<string, FieldErrorConfig>, globalFallbacks?: Partial<Record<ValidationErrorType, string>>) => ErrorMessageResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Format bytes to human-readable string
3
+ * @param bytes - The number of bytes to format
4
+ * @returns Formatted string (e.g., "1.5 KB", "2.3 MB")
5
+ */
6
+ export declare function formatBytes(bytes: number): string;
@@ -0,0 +1,6 @@
1
+ import { FieldErrors } from 'react-hook-form';
2
+ /**
3
+ * Gets the error message for a specific field from react-hook-form errors
4
+ * Prioritizes required errors (#.required) over field-specific validation errors
5
+ */
6
+ export declare const getFieldError: (errors: FieldErrors, fieldName: string) => string | undefined;