@bsol-oss/react-datatable5 12.0.0-beta.55 → 12.0.0-beta.56
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
CHANGED
|
@@ -546,6 +546,7 @@ interface FormRootProps<TData extends FieldValues> {
|
|
|
546
546
|
rowNumber?: number | string;
|
|
547
547
|
requestOptions?: AxiosRequestConfig;
|
|
548
548
|
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
549
|
+
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
549
550
|
}
|
|
550
551
|
interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
551
552
|
variant: string;
|
|
@@ -562,7 +563,7 @@ declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
|
562
563
|
column?: string | undefined;
|
|
563
564
|
display_column?: string | undefined;
|
|
564
565
|
} | undefined) => void;
|
|
565
|
-
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
566
|
+
declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
566
567
|
|
|
567
568
|
interface DefaultFormProps<TData extends FieldValues> {
|
|
568
569
|
formConfig: Omit<FormRootProps<TData>, "children">;
|
package/dist/index.js
CHANGED
|
@@ -3160,7 +3160,9 @@ const TableBody = ({ showSelector = false, canResize = true, }) => {
|
|
|
3160
3160
|
return (jsxRuntime.jsxs(react.Table.Row, { display: "flex", zIndex: 1, onMouseEnter: () => handleRowHover(index), onMouseLeave: () => handleRowHover(-1), ...getTrProps({ hoveredRow, index }), children: [showSelector && (jsxRuntime.jsx(TableRowSelector, { index: index, row: row, hoveredRow: hoveredRow })), row.getVisibleCells().map((cell, index) => {
|
|
3161
3161
|
return (jsxRuntime.jsx(react.Table.Cell, { padding: `${table.getDensityValue()}px`,
|
|
3162
3162
|
// styling resize and pinning start
|
|
3163
|
-
flex: `${canResize ? "0" : "1"} 0 ${cell.column.getSize()}px`,
|
|
3163
|
+
flex: `${canResize ? "0" : "1"} 0 ${cell.column.getSize()}px`,
|
|
3164
|
+
// this is to avoid the cell from being too wide
|
|
3165
|
+
minWidth: `0`, color: {
|
|
3164
3166
|
base: "colorPalette.900",
|
|
3165
3167
|
_dark: "colorPalette.100",
|
|
3166
3168
|
},
|
|
@@ -3711,7 +3713,7 @@ const idPickerSanityCheck = (column, foreign_key) => {
|
|
|
3711
3713
|
throw new Error(`The key column does not exist in properties of column ${column} when using id-picker.`);
|
|
3712
3714
|
}
|
|
3713
3715
|
};
|
|
3714
|
-
const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, children, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, getUpdatedData = () => { }, }) => {
|
|
3716
|
+
const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, children, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, getUpdatedData = () => { }, customErrorRenderer, }) => {
|
|
3715
3717
|
const [isSuccess, setIsSuccess] = React.useState(false);
|
|
3716
3718
|
const [isError, setIsError] = React.useState(false);
|
|
3717
3719
|
const [isSubmiting, setIsSubmiting] = React.useState(false);
|
|
@@ -3744,6 +3746,7 @@ const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, childre
|
|
|
3744
3746
|
error,
|
|
3745
3747
|
setError,
|
|
3746
3748
|
getUpdatedData,
|
|
3749
|
+
customErrorRenderer,
|
|
3747
3750
|
}, children: jsxRuntime.jsx(reactHookForm.FormProvider, { ...form, children: children }) }));
|
|
3748
3751
|
};
|
|
3749
3752
|
|
|
@@ -5481,7 +5484,7 @@ const SubmitButton = () => {
|
|
|
5481
5484
|
};
|
|
5482
5485
|
|
|
5483
5486
|
const FormBody = () => {
|
|
5484
|
-
const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, isSuccess, setIsSuccess, isError, setIsError, isSubmiting, setIsSubmiting, isConfirming, setIsConfirming, validatedData, setValidatedData, error, setError, getUpdatedData, } = useSchemaContext();
|
|
5487
|
+
const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, isSuccess, setIsSuccess, isError, setIsError, isSubmiting, setIsSubmiting, isConfirming, setIsConfirming, validatedData, setValidatedData, error, setError, getUpdatedData, customErrorRenderer, } = useSchemaContext();
|
|
5485
5488
|
const methods = reactHookForm.useFormContext();
|
|
5486
5489
|
const { properties } = schema;
|
|
5487
5490
|
const onBeforeSubmit = () => {
|
|
@@ -5562,7 +5565,7 @@ const FormBody = () => {
|
|
|
5562
5565
|
setIsConfirming(false);
|
|
5563
5566
|
}, variant: "subtle", children: translate.t("cancel") }), jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
5564
5567
|
onFormSubmit(validatedData);
|
|
5565
|
-
}, children: translate.t("confirm") })] }), isSubmiting && (jsxRuntime.jsx(react.Box, { pos: "absolute", inset: "0", bg: "bg/80", children: jsxRuntime.jsx(react.Center, { h: "full", children: jsxRuntime.jsx(react.Spinner, { color: "teal.500" }) }) })), isError && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(react.Alert.Root, { status: "error", children: jsxRuntime.jsx(react.Alert.Title, { children: jsxRuntime.jsx(AccordionRoot, { collapsible: true, defaultValue: [], children: jsxRuntime.jsxs(AccordionItem, { value: "b", children: [jsxRuntime.jsxs(AccordionItemTrigger, { children: [jsxRuntime.jsx(react.Alert.Indicator, {}), `${error}`] }), jsxRuntime.jsx(AccordionItemContent, { children: `${JSON.stringify(error)}` })] }) }) }) }) }))] }));
|
|
5568
|
+
}, children: translate.t("confirm") })] }), isSubmiting && (jsxRuntime.jsx(react.Box, { pos: "absolute", inset: "0", bg: "bg/80", children: jsxRuntime.jsx(react.Center, { h: "full", children: jsxRuntime.jsx(react.Spinner, { color: "teal.500" }) }) })), isError && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: customErrorRenderer ? (customErrorRenderer(error)) : (jsxRuntime.jsx(react.Alert.Root, { status: "error", children: jsxRuntime.jsx(react.Alert.Title, { children: jsxRuntime.jsx(AccordionRoot, { collapsible: true, defaultValue: [], children: jsxRuntime.jsxs(AccordionItem, { value: "b", children: [jsxRuntime.jsxs(AccordionItemTrigger, { children: [jsxRuntime.jsx(react.Alert.Indicator, {}), `${error}`] }), jsxRuntime.jsx(AccordionItemContent, { children: `${JSON.stringify(error)}` })] }) }) }) })) }))] }));
|
|
5566
5569
|
}
|
|
5567
5570
|
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) => {
|
|
5568
5571
|
return (jsxRuntime.jsx(ColumnRenderer
|
package/dist/index.mjs
CHANGED
|
@@ -3140,7 +3140,9 @@ const TableBody = ({ showSelector = false, canResize = true, }) => {
|
|
|
3140
3140
|
return (jsxs(Table$1.Row, { display: "flex", zIndex: 1, onMouseEnter: () => handleRowHover(index), onMouseLeave: () => handleRowHover(-1), ...getTrProps({ hoveredRow, index }), children: [showSelector && (jsx(TableRowSelector, { index: index, row: row, hoveredRow: hoveredRow })), row.getVisibleCells().map((cell, index) => {
|
|
3141
3141
|
return (jsx(Table$1.Cell, { padding: `${table.getDensityValue()}px`,
|
|
3142
3142
|
// styling resize and pinning start
|
|
3143
|
-
flex: `${canResize ? "0" : "1"} 0 ${cell.column.getSize()}px`,
|
|
3143
|
+
flex: `${canResize ? "0" : "1"} 0 ${cell.column.getSize()}px`,
|
|
3144
|
+
// this is to avoid the cell from being too wide
|
|
3145
|
+
minWidth: `0`, color: {
|
|
3144
3146
|
base: "colorPalette.900",
|
|
3145
3147
|
_dark: "colorPalette.100",
|
|
3146
3148
|
},
|
|
@@ -3691,7 +3693,7 @@ const idPickerSanityCheck = (column, foreign_key) => {
|
|
|
3691
3693
|
throw new Error(`The key column does not exist in properties of column ${column} when using id-picker.`);
|
|
3692
3694
|
}
|
|
3693
3695
|
};
|
|
3694
|
-
const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, children, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, getUpdatedData = () => { }, }) => {
|
|
3696
|
+
const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, children, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, getUpdatedData = () => { }, customErrorRenderer, }) => {
|
|
3695
3697
|
const [isSuccess, setIsSuccess] = useState(false);
|
|
3696
3698
|
const [isError, setIsError] = useState(false);
|
|
3697
3699
|
const [isSubmiting, setIsSubmiting] = useState(false);
|
|
@@ -3724,6 +3726,7 @@ const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, childre
|
|
|
3724
3726
|
error,
|
|
3725
3727
|
setError,
|
|
3726
3728
|
getUpdatedData,
|
|
3729
|
+
customErrorRenderer,
|
|
3727
3730
|
}, children: jsx(FormProvider, { ...form, children: children }) }));
|
|
3728
3731
|
};
|
|
3729
3732
|
|
|
@@ -5461,7 +5464,7 @@ const SubmitButton = () => {
|
|
|
5461
5464
|
};
|
|
5462
5465
|
|
|
5463
5466
|
const FormBody = () => {
|
|
5464
|
-
const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, isSuccess, setIsSuccess, isError, setIsError, isSubmiting, setIsSubmiting, isConfirming, setIsConfirming, validatedData, setValidatedData, error, setError, getUpdatedData, } = useSchemaContext();
|
|
5467
|
+
const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, isSuccess, setIsSuccess, isError, setIsError, isSubmiting, setIsSubmiting, isConfirming, setIsConfirming, validatedData, setValidatedData, error, setError, getUpdatedData, customErrorRenderer, } = useSchemaContext();
|
|
5465
5468
|
const methods = useFormContext();
|
|
5466
5469
|
const { properties } = schema;
|
|
5467
5470
|
const onBeforeSubmit = () => {
|
|
@@ -5542,7 +5545,7 @@ const FormBody = () => {
|
|
|
5542
5545
|
setIsConfirming(false);
|
|
5543
5546
|
}, variant: "subtle", children: translate.t("cancel") }), jsx(Button$1, { onClick: () => {
|
|
5544
5547
|
onFormSubmit(validatedData);
|
|
5545
|
-
}, children: translate.t("confirm") })] }), isSubmiting && (jsx(Box, { pos: "absolute", inset: "0", bg: "bg/80", children: jsx(Center, { h: "full", children: jsx(Spinner, { color: "teal.500" }) }) })), isError && (jsx(Fragment, { children: jsx(Alert.Root, { status: "error", children: jsx(Alert.Title, { children: jsx(AccordionRoot, { collapsible: true, defaultValue: [], children: jsxs(AccordionItem, { value: "b", children: [jsxs(AccordionItemTrigger, { children: [jsx(Alert.Indicator, {}), `${error}`] }), jsx(AccordionItemContent, { children: `${JSON.stringify(error)}` })] }) }) }) }) }))] }));
|
|
5548
|
+
}, children: translate.t("confirm") })] }), isSubmiting && (jsx(Box, { pos: "absolute", inset: "0", bg: "bg/80", children: jsx(Center, { h: "full", children: jsx(Spinner, { color: "teal.500" }) }) })), isError && (jsx(Fragment, { children: customErrorRenderer ? (customErrorRenderer(error)) : (jsx(Alert.Root, { status: "error", children: jsx(Alert.Title, { children: jsx(AccordionRoot, { collapsible: true, defaultValue: [], children: jsxs(AccordionItem, { value: "b", children: [jsxs(AccordionItemTrigger, { children: [jsx(Alert.Indicator, {}), `${error}`] }), jsx(AccordionItemContent, { children: `${JSON.stringify(error)}` })] }) }) }) })) }))] }));
|
|
5546
5549
|
}
|
|
5547
5550
|
return (jsxs(Flex, { flexFlow: "column", gap: "2", children: [jsx(Grid, { gap: "4", gridTemplateColumns: "repeat(12, 1fr)", autoFlow: "row", children: ordered.map((column) => {
|
|
5548
5551
|
return (jsx(ColumnRenderer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
2
|
import { JSONSchema7 } from "json-schema";
|
|
3
|
-
import { Dispatch, SetStateAction } from "react";
|
|
3
|
+
import { Dispatch, ReactNode, SetStateAction } from "react";
|
|
4
4
|
import { FieldValues } from "react-hook-form";
|
|
5
5
|
import { UseTranslationResponse } from "react-i18next";
|
|
6
6
|
export interface SchemaFormContext<TData extends FieldValues> {
|
|
@@ -29,5 +29,6 @@ export interface SchemaFormContext<TData extends FieldValues> {
|
|
|
29
29
|
error: unknown;
|
|
30
30
|
setError: Dispatch<SetStateAction<unknown>>;
|
|
31
31
|
getUpdatedData: () => TData | Promise<TData>;
|
|
32
|
+
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
32
33
|
}
|
|
33
34
|
export declare const SchemaFormContext: import("react").Context<SchemaFormContext<unknown>>;
|
|
@@ -21,6 +21,7 @@ export interface FormRootProps<TData extends FieldValues> {
|
|
|
21
21
|
rowNumber?: number | string;
|
|
22
22
|
requestOptions?: AxiosRequestConfig;
|
|
23
23
|
getUpdatedData?: () => TData | Promise<TData> | void;
|
|
24
|
+
customErrorRenderer?: (error: unknown) => ReactNode;
|
|
24
25
|
}
|
|
25
26
|
export interface CustomJSONSchema7Definition extends JSONSchema7 {
|
|
26
27
|
variant: string;
|
|
@@ -37,4 +38,4 @@ export declare const idPickerSanityCheck: (column: string, foreign_key?: {
|
|
|
37
38
|
column?: string | undefined;
|
|
38
39
|
display_column?: string | undefined;
|
|
39
40
|
} | undefined) => void;
|
|
40
|
-
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;
|
|
41
|
+
export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, children, order, ignore, include, onSubmit, rowNumber, requestOptions, getUpdatedData, customErrorRenderer, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
|