@bsol-oss/react-datatable5 13.0.1-beta.26 → 13.0.1-beta.28
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.d.ts +9 -24
- package/dist/index.js +40 -350
- package/dist/index.mjs +41 -351
- package/dist/types/components/Form/SchemaFormContext.d.ts +1 -22
- package/dist/types/components/Form/components/core/FormRoot.d.ts +2 -12
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +2 -2
- package/dist/types/components/Form/useForm.d.ts +4 -9
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { TableHeaderProps as TableHeaderProps$1, TableRowProps, GridProps, Table
|
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
9
9
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
10
|
-
import { AxiosRequestConfig } from 'axios';
|
|
11
10
|
import { JSONSchema7 } from 'json-schema';
|
|
12
11
|
import * as react_hook_form from 'react-hook-form';
|
|
13
12
|
import { UseFormReturn, FieldValues, SubmitHandler } from 'react-hook-form';
|
|
@@ -591,7 +590,7 @@ interface CustomJSONSchema7 extends Omit<JSONSchema7, 'items' | 'additionalItems
|
|
|
591
590
|
gridColumn?: string;
|
|
592
591
|
gridRow?: string;
|
|
593
592
|
customQueryFn?: CustomQueryFn;
|
|
594
|
-
variant?: 'custom-input' | 'id-picker' | 'text-area' | 'media-library-browser' | 'tag-picker' | 'file-picker' | 'date-range' | 'enum-picker';
|
|
593
|
+
variant?: 'custom-input' | 'id-picker' | 'text-area' | 'media-library-browser' | 'tag-picker' | 'file-picker' | 'date-range' | 'enum-picker' | 'radio';
|
|
595
594
|
renderDisplay?: (item: unknown) => ReactNode;
|
|
596
595
|
itemToValue?: (item: unknown) => string;
|
|
597
596
|
loadInitialValues?: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
@@ -614,7 +613,7 @@ interface CustomJSONSchema7 extends Omit<JSONSchema7, 'items' | 'additionalItems
|
|
|
614
613
|
showLabel?: boolean;
|
|
615
614
|
formatOptions?: Intl.NumberFormatOptions;
|
|
616
615
|
numberStorageType?: 'string' | 'number';
|
|
617
|
-
|
|
616
|
+
errorMessage?: Record<Partial<ValidationErrorType> | string, string | Record<string, string>>;
|
|
618
617
|
filePicker?: FilePickerProps;
|
|
619
618
|
tagPicker?: {
|
|
620
619
|
queryFn?: (params: {
|
|
@@ -716,20 +715,11 @@ interface FormRootProps<TData extends FieldValues> {
|
|
|
716
715
|
* }
|
|
717
716
|
*/
|
|
718
717
|
schema: CustomJSONSchema7;
|
|
719
|
-
requestUrl?: string;
|
|
720
718
|
idMap: Record<string, object>;
|
|
721
719
|
setIdMap: Dispatch<SetStateAction<Record<string, object>>>;
|
|
722
|
-
form: UseFormReturn
|
|
720
|
+
form: UseFormReturn<TData, any, TData>;
|
|
723
721
|
children: ReactNode;
|
|
724
|
-
order?: string[];
|
|
725
|
-
ignore?: string[];
|
|
726
|
-
include?: string[];
|
|
727
722
|
onSubmit?: SubmitHandler<TData>;
|
|
728
|
-
rowNumber?: number | string;
|
|
729
|
-
requestOptions?: AxiosRequestConfig;
|
|
730
|
-
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
731
|
-
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
732
|
-
customSuccessRenderer?: (resetHandler: () => void | Promise<void>) => ReactNode;
|
|
733
723
|
displayConfig?: {
|
|
734
724
|
showSubmitButton?: boolean;
|
|
735
725
|
showResetButton?: boolean;
|
|
@@ -750,7 +740,7 @@ interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
|
750
740
|
customQueryFn: any;
|
|
751
741
|
children: ReactNode;
|
|
752
742
|
}
|
|
753
|
-
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children,
|
|
743
|
+
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, onSubmit, displayConfig, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
754
744
|
|
|
755
745
|
interface DefaultFormProps<TData extends FieldValues> {
|
|
756
746
|
formConfig: Omit<FormRootProps<TData>, "children">;
|
|
@@ -783,17 +773,12 @@ type MediaLibraryBrowserPropsMultiple = MediaLibraryBrowserPropsBase & {
|
|
|
783
773
|
type MediaLibraryBrowserProps = MediaLibraryBrowserPropsSingle | MediaLibraryBrowserPropsMultiple;
|
|
784
774
|
declare const MediaLibraryBrowser: ({ onFetchFiles, filterImageOnly, labels, enabled, multiple, onFileSelect, selectedFile: controlledSelectedFile, onSelectedFileChange, }: MediaLibraryBrowserProps) => react_jsx_runtime.JSX.Element | null;
|
|
785
775
|
|
|
786
|
-
interface
|
|
787
|
-
|
|
788
|
-
i18n?: any;
|
|
789
|
-
ready?: boolean;
|
|
790
|
-
}
|
|
791
|
-
interface UseFormProps {
|
|
792
|
-
preLoadedValues?: FieldValues | undefined;
|
|
776
|
+
interface UseFormProps<T> {
|
|
777
|
+
preLoadedValues?: T | undefined;
|
|
793
778
|
schema?: CustomJSONSchema7;
|
|
794
779
|
}
|
|
795
|
-
declare
|
|
796
|
-
form: react_hook_form.UseFormReturn<
|
|
780
|
+
declare function useForm<T extends FieldValues = any>({ preLoadedValues, schema, }: UseFormProps<T>): {
|
|
781
|
+
form: react_hook_form.UseFormReturn<T, any, T>;
|
|
797
782
|
idMap: Record<string, object>;
|
|
798
783
|
setIdMap: React$1.Dispatch<React$1.SetStateAction<Record<string, object>>>;
|
|
799
784
|
};
|
|
@@ -1259,4 +1244,4 @@ declare module '@tanstack/react-table' {
|
|
|
1259
1244
|
}
|
|
1260
1245
|
}
|
|
1261
1246
|
|
|
1262
|
-
export { CalendarDisplay, type CalendarDisplayProps, type CalendarEvent, type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, DatePickerContext, DatePickerInput, type DatePickerInputProps, type DatePickerLabels, type DatePickerProps, type DateTimePickerLabels, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DefaultTableServer, type DefaultTableServerProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, type EnumPickerLabels, ErrorAlert, type ErrorAlertProps, type FilePickerLabels, type FilePickerMediaFile, type FilePickerProps, FilterDialog, FormBody, type FormButtonLabels, FormRoot, type FormRootProps, FormTitle, type GetDateColorProps, type GetMultiDatesProps, type GetRangeDatesProps, type GetStyleProps, type GetVariantProps, GlobalFilter, type IdPickerLabels, type LoadInitialValuesParams, type LoadInitialValuesResult, MediaLibraryBrowser, type MediaLibraryBrowserProps, PageSizeControl, type PageSizeControlProps, Pagination, type QueryParams, type RangeCalendarProps, type RangeDatePickerLabels, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, SelectAllRowsToggle, type SelectAllRowsToggleProps, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, type TableDataDisplayProps, TableFilter, TableFilterTags, type TableFilterTagsProps, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, type TableHeaderTexts, TableLoadingComponent, type TableLoadingComponentProps, type TableProps, type TableRendererProps, type TableRowSelectorProps, TableSelector, TableSorter, TableViewer, type TagPickerProps, TextCell, type TextCellProps, type TimePickerLabels, type
|
|
1247
|
+
export { CalendarDisplay, type CalendarDisplayProps, type CalendarEvent, type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, DatePickerContext, DatePickerInput, type DatePickerInputProps, type DatePickerLabels, type DatePickerProps, type DateTimePickerLabels, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DefaultTableServer, type DefaultTableServerProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, type EnumPickerLabels, ErrorAlert, type ErrorAlertProps, type FilePickerLabels, type FilePickerMediaFile, type FilePickerProps, FilterDialog, FormBody, type FormButtonLabels, FormRoot, type FormRootProps, FormTitle, type GetDateColorProps, type GetMultiDatesProps, type GetRangeDatesProps, type GetStyleProps, type GetVariantProps, GlobalFilter, type IdPickerLabels, type LoadInitialValuesParams, type LoadInitialValuesResult, MediaLibraryBrowser, type MediaLibraryBrowserProps, PageSizeControl, type PageSizeControlProps, Pagination, type QueryParams, type RangeCalendarProps, type RangeDatePickerLabels, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, SelectAllRowsToggle, type SelectAllRowsToggleProps, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, type TableDataDisplayProps, TableFilter, TableFilterTags, type TableFilterTagsProps, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, type TableHeaderTexts, TableLoadingComponent, type TableLoadingComponentProps, type TableProps, type TableRendererProps, type TableRowSelectorProps, TableSelector, TableSorter, TableViewer, type TagPickerProps, TextCell, type TextCellProps, type TimePickerLabels, type UseDataTableProps, type UseDataTableReturn, type UseDataTableServerProps, type UseDataTableServerReturn, type UseFormProps, type ValidationErrorType, ViewDialog, defaultRenderDisplay, getMultiDates, getRangeDates, useDataTable, useDataTableContext, useDataTableServer, useForm };
|
package/dist/index.js
CHANGED
|
@@ -31,9 +31,7 @@ var customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
|
31
31
|
var timezone = require('dayjs/plugin/timezone');
|
|
32
32
|
var utc = require('dayjs/plugin/utc');
|
|
33
33
|
var ti = require('react-icons/ti');
|
|
34
|
-
var
|
|
35
|
-
var addFormats = require('ajv-formats');
|
|
36
|
-
var AjvErrors = require('ajv-errors');
|
|
34
|
+
var ajv = require('@hookform/resolvers/ajv');
|
|
37
35
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
38
36
|
|
|
39
37
|
function _interopNamespaceDefault(e) {
|
|
@@ -1153,7 +1151,7 @@ function getElementFromPointWithoutHoneypot(client) {
|
|
|
1153
1151
|
var maxZIndex = 2147483647;
|
|
1154
1152
|
|
|
1155
1153
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1156
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t),
|
|
1154
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1157
1155
|
var honeyPotSize = 2;
|
|
1158
1156
|
var halfHoneyPotSize = honeyPotSize / 2;
|
|
1159
1157
|
|
|
@@ -2258,8 +2256,8 @@ function addAttribute(element, _ref) {
|
|
|
2258
2256
|
}
|
|
2259
2257
|
|
|
2260
2258
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2261
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t),
|
|
2262
|
-
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e
|
|
2259
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2260
|
+
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2263
2261
|
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
|
|
2264
2262
|
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2265
2263
|
function copyReverse(array) {
|
|
@@ -2563,11 +2561,11 @@ function makeDropTarget(_ref) {
|
|
|
2563
2561
|
};
|
|
2564
2562
|
}
|
|
2565
2563
|
|
|
2566
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e
|
|
2564
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2567
2565
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
2568
2566
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2569
2567
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2570
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t),
|
|
2568
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2571
2569
|
function makeMonitor() {
|
|
2572
2570
|
var registry = new Set();
|
|
2573
2571
|
var dragging = null;
|
|
@@ -4189,20 +4187,13 @@ const useDataTableServer = (props) => {
|
|
|
4189
4187
|
//@ts-expect-error TODO: find appropriate type
|
|
4190
4188
|
const SchemaFormContext = React.createContext({
|
|
4191
4189
|
schema: {},
|
|
4192
|
-
requestUrl: '',
|
|
4193
|
-
order: [],
|
|
4194
|
-
ignore: [],
|
|
4195
|
-
include: [],
|
|
4196
4190
|
onSubmit: async () => { },
|
|
4197
|
-
rowNumber: 0,
|
|
4198
|
-
requestOptions: {},
|
|
4199
4191
|
timezone: 'Asia/Hong_Kong',
|
|
4200
4192
|
displayConfig: {
|
|
4201
4193
|
showSubmitButton: true,
|
|
4202
4194
|
showResetButton: true,
|
|
4203
4195
|
showTitle: true,
|
|
4204
4196
|
},
|
|
4205
|
-
onFormSubmit: async () => { },
|
|
4206
4197
|
});
|
|
4207
4198
|
|
|
4208
4199
|
const useSchemaContext = () => {
|
|
@@ -4231,8 +4222,8 @@ const useFormLabel = (column, prefix = '', schema) => {
|
|
|
4231
4222
|
prefix,
|
|
4232
4223
|
schema: {
|
|
4233
4224
|
type: schema.type,
|
|
4234
|
-
|
|
4235
|
-
? Object.keys(schema.
|
|
4225
|
+
errorMessage: schema.errorMessage
|
|
4226
|
+
? Object.keys(schema.errorMessage)
|
|
4236
4227
|
: undefined,
|
|
4237
4228
|
},
|
|
4238
4229
|
});
|
|
@@ -4244,8 +4235,8 @@ const useFormLabel = (column, prefix = '', schema) => {
|
|
|
4244
4235
|
|
|
4245
4236
|
const ArrayRenderer = ({ schema, column, prefix, }) => {
|
|
4246
4237
|
const { gridRow, gridColumn = '1/span 12', required, items } = schema;
|
|
4247
|
-
|
|
4248
|
-
const { type } =
|
|
4238
|
+
const itemsSchema = Array.isArray(items) ? items[0] : items;
|
|
4239
|
+
const { type } = itemsSchema ?? {};
|
|
4249
4240
|
const colLabel = `${prefix}${column}`;
|
|
4250
4241
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4251
4242
|
const formI18n = useFormLabel(column, prefix, schema);
|
|
@@ -4257,8 +4248,10 @@ const ArrayRenderer = ({ schema, column, prefix, }) => {
|
|
|
4257
4248
|
_dark: 'colorPalette.800',
|
|
4258
4249
|
}, children: [jsxRuntime.jsx(react.Grid, { gridTemplateColumns: 'repeat(12, 1fr)', autoFlow: 'row', children: jsxRuntime.jsx(SchemaRenderer, { column: `${index}`,
|
|
4259
4250
|
prefix: `${colLabel}.`,
|
|
4260
|
-
|
|
4261
|
-
|
|
4251
|
+
schema: {
|
|
4252
|
+
showLabel: false,
|
|
4253
|
+
...(Array.isArray(items) ? items[0] : items ?? {}),
|
|
4254
|
+
} }) }), jsxRuntime.jsx(react.Flex, { justifyContent: 'end', children: jsxRuntime.jsx(react.Button, { variant: 'ghost', onClick: () => {
|
|
4262
4255
|
setValue(colLabel, fields.filter((_, curIndex) => {
|
|
4263
4256
|
return curIndex !== index;
|
|
4264
4257
|
}));
|
|
@@ -5341,16 +5334,13 @@ const FileDropzone = ({ children = undefined, gridProps = {}, onDrop = () => { }
|
|
|
5341
5334
|
element: el,
|
|
5342
5335
|
onDragEnter: () => setIsDraggedOver(true),
|
|
5343
5336
|
onDragLeave: () => setIsDraggedOver(false),
|
|
5344
|
-
// canDrop: some(containsFiles, containsText),
|
|
5345
5337
|
onDrop: ({ source }) => {
|
|
5346
5338
|
const files = getFiles({ source });
|
|
5347
5339
|
const text = getText({ source });
|
|
5348
|
-
console.log(files, text, 'dfposa');
|
|
5349
5340
|
onDrop({ files, text });
|
|
5350
5341
|
},
|
|
5351
5342
|
});
|
|
5352
5343
|
}, [onDrop]);
|
|
5353
|
-
// const isDark = (location + location) % 2 === 1;
|
|
5354
5344
|
function getColor(isDraggedOver) {
|
|
5355
5345
|
if (isDraggedOver) {
|
|
5356
5346
|
return {
|
|
@@ -5360,7 +5350,6 @@ const FileDropzone = ({ children = undefined, gridProps = {}, onDrop = () => { }
|
|
|
5360
5350
|
},
|
|
5361
5351
|
};
|
|
5362
5352
|
}
|
|
5363
|
-
// return isDark ? "lightgrey" : "white";
|
|
5364
5353
|
return {
|
|
5365
5354
|
backgroundColor: undefined,
|
|
5366
5355
|
_dark: {
|
|
@@ -6243,11 +6232,9 @@ const ObjectInput = ({ schema, column, prefix }) => {
|
|
|
6243
6232
|
base: 'colorPalette.200',
|
|
6244
6233
|
_dark: 'colorPalette.800',
|
|
6245
6234
|
}, gap: "4", padding: '4', gridTemplateColumns: 'repeat(12, 1fr)', autoFlow: 'row', children: Object.keys(properties ?? {}).map((key) => {
|
|
6246
|
-
return (
|
|
6247
|
-
// @ts-expect-error find suitable types
|
|
6248
|
-
jsxRuntime.jsx(ColumnRenderer, { column: `${key}`,
|
|
6235
|
+
return (jsxRuntime.jsx(ColumnRenderer, { column: `${key}`,
|
|
6249
6236
|
prefix: `${prefix}${column}.`,
|
|
6250
|
-
properties,
|
|
6237
|
+
properties: properties ?? {},
|
|
6251
6238
|
parentRequired: required }, `form-${colLabel}-${key}`));
|
|
6252
6239
|
}) })] }));
|
|
6253
6240
|
};
|
|
@@ -7989,7 +7976,8 @@ const SchemaRenderer = ({ schema, prefix, column, }) => {
|
|
|
7989
7976
|
}
|
|
7990
7977
|
if (variant === 'enum-picker') {
|
|
7991
7978
|
const { items, title } = colSchema;
|
|
7992
|
-
const
|
|
7979
|
+
const itemsSchema = Array.isArray(items) ? items[0] : items;
|
|
7980
|
+
const { enum: enumItems } = itemsSchema ?? {};
|
|
7993
7981
|
// Use renderDisplay from parent schema only
|
|
7994
7982
|
const renderDisplay = colSchema.renderDisplay;
|
|
7995
7983
|
const enumSchema = {
|
|
@@ -8026,15 +8014,15 @@ const ColumnRenderer = ({ column, properties, prefix, parentRequired, }) => {
|
|
|
8026
8014
|
};
|
|
8027
8015
|
|
|
8028
8016
|
const SubmitButton = () => {
|
|
8029
|
-
const {
|
|
8017
|
+
const { onSubmit, formButtonLabels } = useSchemaContext();
|
|
8030
8018
|
const methods = reactHookForm.useFormContext();
|
|
8031
8019
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8032
|
-
const onValid = (data) => {
|
|
8020
|
+
const onValid = async (data) => {
|
|
8033
8021
|
// Validation is handled by react-hook-form
|
|
8034
8022
|
// This function will only be called if validation passes
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8023
|
+
if (onSubmit) {
|
|
8024
|
+
await onSubmit(data);
|
|
8025
|
+
}
|
|
8038
8026
|
};
|
|
8039
8027
|
return (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
8040
8028
|
methods.handleSubmit(onValid)();
|
|
@@ -8042,33 +8030,21 @@ const SubmitButton = () => {
|
|
|
8042
8030
|
};
|
|
8043
8031
|
|
|
8044
8032
|
const FormBody = () => {
|
|
8045
|
-
const { schema,
|
|
8033
|
+
const { schema, displayConfig, formButtonLabels } = useSchemaContext();
|
|
8046
8034
|
const { showSubmitButton, showResetButton } = displayConfig;
|
|
8047
8035
|
const methods = reactHookForm.useFormContext();
|
|
8048
|
-
console.log(methods.formState.errors);
|
|
8036
|
+
console.log('errors', methods.formState.errors);
|
|
8049
8037
|
const { properties } = schema;
|
|
8050
|
-
const
|
|
8051
|
-
const included = include.length > 0 ? include : keys;
|
|
8052
|
-
const not_exist = included.filter((columnA) => !order.some((columnB) => columnA === columnB));
|
|
8053
|
-
const ordered = [...order, ...not_exist];
|
|
8054
|
-
const ignored = ordered.filter((column) => !ignore.some((shouldIgnore) => column === shouldIgnore));
|
|
8055
|
-
return ignored;
|
|
8056
|
-
};
|
|
8057
|
-
const ordered = renderColumns({
|
|
8058
|
-
order,
|
|
8059
|
-
keys: Object.keys(properties),
|
|
8060
|
-
ignore,
|
|
8061
|
-
include,
|
|
8062
|
-
});
|
|
8038
|
+
const ordered = Object.keys(properties);
|
|
8063
8039
|
return (jsxRuntime.jsxs(react.Flex, { flexFlow: 'column', gap: "2", children: [jsxRuntime.jsx(react.Grid, { gap: "4", gridTemplateColumns: 'repeat(12, 1fr)', autoFlow: 'row', children: ordered.map((column) => {
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8040
|
+
if (!properties) {
|
|
8041
|
+
console.error('properties is undefined when using FormBody', schema);
|
|
8042
|
+
return null;
|
|
8043
|
+
}
|
|
8044
|
+
return (jsxRuntime.jsx(ColumnRenderer, { properties: properties, prefix: ``, parentRequired: schema.required, column }, `form-input-${column}`));
|
|
8069
8045
|
}) }), jsxRuntime.jsxs(react.Flex, { justifyContent: 'end', gap: "2", children: [showResetButton && (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
8070
8046
|
methods.reset();
|
|
8071
|
-
}, variant: 'subtle', children: formButtonLabels?.reset ?? 'Reset' })), showSubmitButton && jsxRuntime.jsx(SubmitButton, {})] })
|
|
8047
|
+
}, variant: 'subtle', children: formButtonLabels?.reset ?? 'Reset' })), showSubmitButton && jsxRuntime.jsx(SubmitButton, {})] })] }));
|
|
8072
8048
|
};
|
|
8073
8049
|
|
|
8074
8050
|
const FormTitle = () => {
|
|
@@ -8087,96 +8063,18 @@ const FormTitle = () => {
|
|
|
8087
8063
|
return jsxRuntime.jsx(react.Heading, { children: schema.title ?? 'Form' });
|
|
8088
8064
|
};
|
|
8089
8065
|
|
|
8090
|
-
const
|
|
8091
|
-
return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== ""));
|
|
8092
|
-
};
|
|
8093
|
-
|
|
8094
|
-
const FormRoot = ({ schema, idMap, setIdMap, form, children, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, getUpdatedData = () => { }, customErrorRenderer, customSuccessRenderer, displayConfig = {
|
|
8066
|
+
const FormRoot = ({ schema, idMap, setIdMap, form, children, onSubmit = undefined, displayConfig = {
|
|
8095
8067
|
showSubmitButton: true,
|
|
8096
8068
|
showResetButton: true,
|
|
8097
8069
|
showTitle: true,
|
|
8098
8070
|
}, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog = false, }) => {
|
|
8099
|
-
const [isSuccess, setIsSuccess] = React.useState(false);
|
|
8100
|
-
const [isError, setIsError] = React.useState(false);
|
|
8101
|
-
const [isSubmiting, setIsSubmiting] = React.useState(false);
|
|
8102
|
-
const [validatedData, setValidatedData] = React.useState();
|
|
8103
|
-
const [error, setError] = React.useState();
|
|
8104
|
-
const onBeforeSubmit = () => {
|
|
8105
|
-
setIsSubmiting(true);
|
|
8106
|
-
};
|
|
8107
|
-
const onAfterSubmit = () => {
|
|
8108
|
-
setIsSubmiting(false);
|
|
8109
|
-
};
|
|
8110
|
-
const onSubmitError = (error) => {
|
|
8111
|
-
setIsError(true);
|
|
8112
|
-
setError(error);
|
|
8113
|
-
};
|
|
8114
|
-
const onSubmitSuccess = () => {
|
|
8115
|
-
setIsSuccess(true);
|
|
8116
|
-
};
|
|
8117
|
-
const defaultOnSubmit = async (promise) => {
|
|
8118
|
-
try {
|
|
8119
|
-
console.log('onBeforeSubmit');
|
|
8120
|
-
onBeforeSubmit();
|
|
8121
|
-
await promise;
|
|
8122
|
-
console.log('onSubmitSuccess');
|
|
8123
|
-
onSubmitSuccess();
|
|
8124
|
-
}
|
|
8125
|
-
catch (error) {
|
|
8126
|
-
console.log('onSubmitError', error);
|
|
8127
|
-
onSubmitError(error);
|
|
8128
|
-
}
|
|
8129
|
-
finally {
|
|
8130
|
-
onAfterSubmit();
|
|
8131
|
-
}
|
|
8132
|
-
};
|
|
8133
|
-
const defaultSubmitPromise = (data) => {
|
|
8134
|
-
if (!requestOptions.url) {
|
|
8135
|
-
throw new Error('requestOptions.url is required when onSubmit is not provided');
|
|
8136
|
-
}
|
|
8137
|
-
const options = {
|
|
8138
|
-
method: 'POST',
|
|
8139
|
-
data: clearEmptyString(data),
|
|
8140
|
-
...requestOptions,
|
|
8141
|
-
};
|
|
8142
|
-
return axios.request(options);
|
|
8143
|
-
};
|
|
8144
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8145
|
-
const onFormSubmit = async (data) => {
|
|
8146
|
-
// Validation is handled by react-hook-form
|
|
8147
|
-
// This function will only be called if validation passes
|
|
8148
|
-
if (onSubmit === undefined) {
|
|
8149
|
-
await defaultOnSubmit(Promise.resolve(defaultSubmitPromise(data)));
|
|
8150
|
-
return;
|
|
8151
|
-
}
|
|
8152
|
-
await defaultOnSubmit(Promise.resolve(onSubmit(data)));
|
|
8153
|
-
};
|
|
8154
8071
|
return (jsxRuntime.jsx(SchemaFormContext.Provider, { value: {
|
|
8155
8072
|
schema,
|
|
8156
|
-
order,
|
|
8157
|
-
ignore,
|
|
8158
|
-
include,
|
|
8159
8073
|
// @ts-expect-error TODO: find appropriate types
|
|
8160
8074
|
onSubmit,
|
|
8161
|
-
rowNumber,
|
|
8162
8075
|
idMap,
|
|
8163
8076
|
setIdMap,
|
|
8164
|
-
requestOptions,
|
|
8165
|
-
isSuccess,
|
|
8166
|
-
setIsSuccess,
|
|
8167
|
-
isError,
|
|
8168
|
-
setIsError,
|
|
8169
|
-
isSubmiting,
|
|
8170
|
-
setIsSubmiting,
|
|
8171
|
-
validatedData,
|
|
8172
|
-
setValidatedData,
|
|
8173
|
-
error,
|
|
8174
|
-
setError,
|
|
8175
|
-
getUpdatedData,
|
|
8176
|
-
customErrorRenderer,
|
|
8177
|
-
customSuccessRenderer,
|
|
8178
8077
|
displayConfig,
|
|
8179
|
-
onFormSubmit,
|
|
8180
8078
|
dateTimePickerLabels,
|
|
8181
8079
|
idPickerLabels,
|
|
8182
8080
|
enumPickerLabels,
|
|
@@ -8192,223 +8090,15 @@ const DefaultForm = ({ formConfig, }) => {
|
|
|
8192
8090
|
return (jsxRuntime.jsx(FormRoot, { ...formConfig, children: jsxRuntime.jsxs(react.Grid, { gap: "2", children: [showTitle && jsxRuntime.jsx(FormTitle, {}), jsxRuntime.jsx(FormBody, {})] }) }));
|
|
8193
8091
|
};
|
|
8194
8092
|
|
|
8195
|
-
|
|
8196
|
-
const ajv = new Ajv({
|
|
8197
|
-
strict: false,
|
|
8198
|
-
allErrors: true,
|
|
8199
|
-
});
|
|
8200
|
-
addFormats(ajv);
|
|
8201
|
-
AjvErrors(ajv); // Load ajv-errors plugin to process errorMessage format
|
|
8202
|
-
const validate = ajv.compile(schema);
|
|
8203
|
-
const validationResult = validate(data);
|
|
8204
|
-
const errors = validate.errors;
|
|
8205
|
-
return {
|
|
8206
|
-
isValid: validationResult,
|
|
8207
|
-
validate,
|
|
8208
|
-
errors,
|
|
8209
|
-
};
|
|
8210
|
-
};
|
|
8211
|
-
|
|
8212
|
-
/**
|
|
8213
|
-
* Gets the schema node for a given field path
|
|
8214
|
-
*/
|
|
8215
|
-
const getSchemaNodeForField = (schema, fieldPath) => {
|
|
8216
|
-
if (!fieldPath || fieldPath === '') {
|
|
8217
|
-
return schema;
|
|
8218
|
-
}
|
|
8219
|
-
const pathParts = fieldPath.split('.');
|
|
8220
|
-
let currentSchema = schema;
|
|
8221
|
-
for (const part of pathParts) {
|
|
8222
|
-
if (currentSchema &&
|
|
8223
|
-
currentSchema.properties &&
|
|
8224
|
-
currentSchema.properties[part] &&
|
|
8225
|
-
typeof currentSchema.properties[part] === 'object' &&
|
|
8226
|
-
currentSchema.properties[part] !== null) {
|
|
8227
|
-
currentSchema = currentSchema.properties[part];
|
|
8228
|
-
}
|
|
8229
|
-
else {
|
|
8230
|
-
return undefined;
|
|
8231
|
-
}
|
|
8232
|
-
}
|
|
8233
|
-
return currentSchema;
|
|
8234
|
-
};
|
|
8235
|
-
/**
|
|
8236
|
-
* Strips null, undefined, and empty string values from an object
|
|
8237
|
-
*/
|
|
8238
|
-
const stripEmptyValues = (obj) => {
|
|
8239
|
-
if (obj === null || obj === undefined) {
|
|
8240
|
-
return undefined;
|
|
8241
|
-
}
|
|
8242
|
-
if (typeof obj === 'string' && obj.trim() === '') {
|
|
8243
|
-
return undefined;
|
|
8244
|
-
}
|
|
8245
|
-
if (Array.isArray(obj)) {
|
|
8246
|
-
const filtered = obj
|
|
8247
|
-
.map(stripEmptyValues)
|
|
8248
|
-
.filter((item) => item !== undefined);
|
|
8249
|
-
return filtered.length > 0 ? filtered : undefined;
|
|
8250
|
-
}
|
|
8251
|
-
if (typeof obj === 'object' && obj !== null) {
|
|
8252
|
-
const result = {};
|
|
8253
|
-
let hasValues = false;
|
|
8254
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
8255
|
-
const cleanedValue = stripEmptyValues(value);
|
|
8256
|
-
if (cleanedValue !== undefined) {
|
|
8257
|
-
result[key] = cleanedValue;
|
|
8258
|
-
hasValues = true;
|
|
8259
|
-
}
|
|
8260
|
-
}
|
|
8261
|
-
return hasValues ? result : undefined;
|
|
8262
|
-
}
|
|
8263
|
-
return obj;
|
|
8264
|
-
};
|
|
8265
|
-
/**
|
|
8266
|
-
* Converts AJV error objects to react-hook-form field errors format
|
|
8267
|
-
*/
|
|
8268
|
-
const convertAjvErrorsToFieldErrors = (errors, schema) => {
|
|
8269
|
-
if (!errors || errors.length === 0) {
|
|
8270
|
-
return {};
|
|
8271
|
-
}
|
|
8272
|
-
const fieldErrors = {};
|
|
8273
|
-
errors.forEach((error) => {
|
|
8274
|
-
let fieldName = '';
|
|
8275
|
-
// Special handling for required keyword: map to the specific missing property
|
|
8276
|
-
if (error.keyword === 'required') {
|
|
8277
|
-
const basePath = (error.instancePath || '')
|
|
8278
|
-
.replace(/^\//, '')
|
|
8279
|
-
.replace(/\//g, '.');
|
|
8280
|
-
const missingProperty = error.params && error.params.missingProperty;
|
|
8281
|
-
if (missingProperty) {
|
|
8282
|
-
fieldName = basePath
|
|
8283
|
-
? `${basePath}.${missingProperty}`
|
|
8284
|
-
: missingProperty;
|
|
8285
|
-
}
|
|
8286
|
-
else {
|
|
8287
|
-
// Fallback to schemaPath conversion if missingProperty is unavailable
|
|
8288
|
-
fieldName = (error.schemaPath || '')
|
|
8289
|
-
.replace(/^#\//, '#.')
|
|
8290
|
-
.replace(/\//g, '.');
|
|
8291
|
-
}
|
|
8292
|
-
}
|
|
8293
|
-
else {
|
|
8294
|
-
const fieldPath = error.instancePath || error.schemaPath;
|
|
8295
|
-
if (fieldPath) {
|
|
8296
|
-
fieldName = fieldPath.replace(/^\//, '').replace(/\//g, '.');
|
|
8297
|
-
}
|
|
8298
|
-
}
|
|
8299
|
-
if (fieldName) {
|
|
8300
|
-
// Get the schema node for this field to check for custom error messages
|
|
8301
|
-
const fieldSchema = getSchemaNodeForField(schema, fieldName);
|
|
8302
|
-
const customMessage = fieldSchema?.errorMessages?.[error.keyword];
|
|
8303
|
-
// Debug log when error message is missing
|
|
8304
|
-
if (!customMessage) {
|
|
8305
|
-
console.debug(`[Form Validation] Missing error message for field '${fieldName}' with keyword '${error.keyword}'. Add errorMessages.${error.keyword} to schema for field '${fieldName}'`, {
|
|
8306
|
-
fieldName,
|
|
8307
|
-
keyword: error.keyword,
|
|
8308
|
-
instancePath: error.instancePath,
|
|
8309
|
-
schemaPath: error.schemaPath,
|
|
8310
|
-
params: error.params,
|
|
8311
|
-
fieldSchema: fieldSchema
|
|
8312
|
-
? {
|
|
8313
|
-
type: fieldSchema.type,
|
|
8314
|
-
errorMessages: fieldSchema
|
|
8315
|
-
.errorMessages,
|
|
8316
|
-
}
|
|
8317
|
-
: undefined,
|
|
8318
|
-
});
|
|
8319
|
-
}
|
|
8320
|
-
// Provide helpful fallback message if no custom message is provided
|
|
8321
|
-
const fallbackMessage = customMessage ||
|
|
8322
|
-
`Missing error message for ${error.keyword}. Add errorMessages.${error.keyword} to schema for field '${fieldName}'`;
|
|
8323
|
-
if (error.keyword === 'required') {
|
|
8324
|
-
// Required errors override any existing non-required errors for this field
|
|
8325
|
-
fieldErrors[fieldName] = {
|
|
8326
|
-
type: 'required',
|
|
8327
|
-
keyword: error.keyword,
|
|
8328
|
-
params: error.params,
|
|
8329
|
-
message: fallbackMessage,
|
|
8330
|
-
};
|
|
8331
|
-
}
|
|
8332
|
-
else {
|
|
8333
|
-
const existing = fieldErrors[fieldName];
|
|
8334
|
-
if (existing) {
|
|
8335
|
-
// Do not override required errors
|
|
8336
|
-
if (existing.type === 'required') {
|
|
8337
|
-
return;
|
|
8338
|
-
}
|
|
8339
|
-
// Combine messages if multiple errors for same field
|
|
8340
|
-
existing.message = existing.message
|
|
8341
|
-
? `${existing.message}; ${fallbackMessage}`
|
|
8342
|
-
: fallbackMessage;
|
|
8343
|
-
}
|
|
8344
|
-
else {
|
|
8345
|
-
fieldErrors[fieldName] = {
|
|
8346
|
-
type: error.keyword,
|
|
8347
|
-
keyword: error.keyword,
|
|
8348
|
-
params: error.params,
|
|
8349
|
-
message: fallbackMessage,
|
|
8350
|
-
};
|
|
8351
|
-
}
|
|
8352
|
-
}
|
|
8353
|
-
}
|
|
8354
|
-
});
|
|
8355
|
-
return fieldErrors;
|
|
8356
|
-
};
|
|
8357
|
-
/**
|
|
8358
|
-
* AJV resolver for react-hook-form
|
|
8359
|
-
* Integrates AJV validation with react-hook-form's validation system
|
|
8360
|
-
*/
|
|
8361
|
-
const ajvResolver = (schema) => {
|
|
8362
|
-
return async (values) => {
|
|
8363
|
-
try {
|
|
8364
|
-
// Strip empty values before validation
|
|
8365
|
-
const cleanedValues = stripEmptyValues(values);
|
|
8366
|
-
// Use empty object for validation if all values were stripped
|
|
8367
|
-
const valuesToValidate = cleanedValues === undefined ? {} : cleanedValues;
|
|
8368
|
-
const { isValid, errors } = validateData(valuesToValidate, schema);
|
|
8369
|
-
console.debug('AJV Validation Result:', {
|
|
8370
|
-
isValid,
|
|
8371
|
-
errors,
|
|
8372
|
-
cleanedValues,
|
|
8373
|
-
valuesToValidate,
|
|
8374
|
-
});
|
|
8375
|
-
if (isValid) {
|
|
8376
|
-
return {
|
|
8377
|
-
values: (cleanedValues || {}),
|
|
8378
|
-
errors: {},
|
|
8379
|
-
};
|
|
8380
|
-
}
|
|
8381
|
-
const fieldErrors = convertAjvErrorsToFieldErrors(errors, schema);
|
|
8382
|
-
console.debug('AJV Validation Failed:', {
|
|
8383
|
-
errors,
|
|
8384
|
-
fieldErrors,
|
|
8385
|
-
cleanedValues,
|
|
8386
|
-
valuesToValidate,
|
|
8387
|
-
});
|
|
8388
|
-
return {
|
|
8389
|
-
values: {},
|
|
8390
|
-
errors: fieldErrors,
|
|
8391
|
-
};
|
|
8392
|
-
}
|
|
8393
|
-
catch (error) {
|
|
8394
|
-
return {
|
|
8395
|
-
values: {},
|
|
8396
|
-
errors: {
|
|
8397
|
-
root: {
|
|
8398
|
-
type: 'validation',
|
|
8399
|
-
message: error instanceof Error ? error.message : 'Validation failed',
|
|
8400
|
-
},
|
|
8401
|
-
},
|
|
8402
|
-
};
|
|
8403
|
-
}
|
|
8404
|
-
};
|
|
8405
|
-
};
|
|
8406
|
-
|
|
8407
|
-
const useForm = ({ preLoadedValues, schema }) => {
|
|
8093
|
+
function useForm({ preLoadedValues, schema, }) {
|
|
8408
8094
|
const form = reactHookForm.useForm({
|
|
8409
8095
|
values: preLoadedValues,
|
|
8410
8096
|
mode: 'onSubmit',
|
|
8411
|
-
resolver: schema
|
|
8097
|
+
resolver: schema
|
|
8098
|
+
? ajv.ajvResolver(schema, {
|
|
8099
|
+
strict: false,
|
|
8100
|
+
})
|
|
8101
|
+
: undefined,
|
|
8412
8102
|
reValidateMode: 'onChange',
|
|
8413
8103
|
});
|
|
8414
8104
|
const [idMap, setIdMap] = React.useState({});
|
|
@@ -8417,7 +8107,7 @@ const useForm = ({ preLoadedValues, schema }) => {
|
|
|
8417
8107
|
idMap,
|
|
8418
8108
|
setIdMap,
|
|
8419
8109
|
};
|
|
8420
|
-
}
|
|
8110
|
+
}
|
|
8421
8111
|
|
|
8422
8112
|
const getMultiDates = ({ selected, selectedDate, selectedDates, selectable, }) => {
|
|
8423
8113
|
if (!selectable) {
|