@bsol-oss/react-datatable5 11.0.0-beta.7 → 11.0.0-beta.9

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
@@ -467,6 +467,7 @@ interface FormProps<TData extends FieldValues> {
467
467
  translate: UseTranslationResponse<any, any>;
468
468
  order?: string[];
469
469
  ignore?: string[];
470
+ include?: string[];
470
471
  onSubmit?: SubmitHandler<TData>;
471
472
  rowNumber?: number | string;
472
473
  requestOptions?: AxiosRequestConfig;
@@ -485,7 +486,7 @@ declare const idPickerSanityCheck: (column: string, foreign_key?: {
485
486
  column?: string | undefined;
486
487
  display_column?: string | undefined;
487
488
  } | undefined) => void;
488
- declare const Form: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, order, ignore, onSubmit, rowNumber, requestOptions, }: FormProps<TData>) => react_jsx_runtime.JSX.Element;
489
+ declare const Form: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, order, ignore, include, onSubmit, rowNumber, requestOptions, }: FormProps<TData>) => react_jsx_runtime.JSX.Element;
489
490
 
490
491
  interface UseFormProps {
491
492
  preLoadedValues?: FieldValues | undefined;
package/dist/index.js CHANGED
@@ -3548,26 +3548,14 @@ const SchemaFormContext = React.createContext({
3548
3548
  requestUrl: "",
3549
3549
  order: [],
3550
3550
  ignore: [],
3551
+ include: [],
3551
3552
  onSubmit: async () => { },
3552
3553
  rowNumber: 0,
3553
3554
  requestOptions: {},
3554
3555
  });
3555
3556
 
3556
3557
  const useSchemaContext = () => {
3557
- const { schema, serverUrl, requestUrl, order, ignore, onSubmit, rowNumber, idMap, setIdMap, translate, requestOptions, } = React.useContext(SchemaFormContext);
3558
- return {
3559
- schema,
3560
- serverUrl,
3561
- requestUrl,
3562
- order,
3563
- ignore,
3564
- onSubmit,
3565
- rowNumber,
3566
- idMap,
3567
- setIdMap,
3568
- translate,
3569
- requestOptions,
3570
- };
3558
+ return React.useContext(SchemaFormContext);
3571
3559
  };
3572
3560
 
3573
3561
  const clearEmptyString = (object) => {
@@ -4258,13 +4246,38 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
4258
4246
  const dataList = data?.data ?? [];
4259
4247
  const count = data?.count ?? 0;
4260
4248
  const isDirty = (searchText?.length ?? 0) > 0;
4249
+ const watchId = watch(colLabel);
4250
+ const watchIds = (watch(colLabel) ?? []);
4251
+ reactQuery.useQuery({
4252
+ queryKey: [`idpicker`, { column, searchText, limit, page }],
4253
+ queryFn: async () => {
4254
+ const data = await getTableData({
4255
+ serverUrl,
4256
+ searching: watchId,
4257
+ in_table: table,
4258
+ limit: limit,
4259
+ offset: page * 10,
4260
+ });
4261
+ const newMap = Object.fromEntries((data ?? { data: [] }).data.map((item) => {
4262
+ return [
4263
+ item[column_ref],
4264
+ {
4265
+ ...item,
4266
+ },
4267
+ ];
4268
+ }));
4269
+ setIdMap((state) => {
4270
+ return { ...state, ...newMap };
4271
+ });
4272
+ return data;
4273
+ },
4274
+ staleTime: 300000,
4275
+ });
4261
4276
  const onSearchChange = async (event) => {
4262
4277
  setSearchText(event.target.value);
4263
4278
  setPage(0);
4264
4279
  setLimit(10);
4265
4280
  };
4266
- const watchId = watch(colLabel);
4267
- const watchIds = (watch(colLabel) ?? []);
4268
4281
  const getPickedValue = () => {
4269
4282
  if (Object.keys(idMap).length <= 0) {
4270
4283
  return "";
@@ -4293,7 +4306,7 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
4293
4306
  }, children: getPickedValue() })), jsxRuntime.jsxs(PopoverRoot, { open: openSearchResult, onOpenChange: (e) => setOpenSearchResult(e.open), closeOnInteractOutside: true, initialFocusEl: () => ref.current, positioning: { placement: "bottom-start", strategy: "fixed" }, children: [jsxRuntime.jsx(PopoverTrigger, {}), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs(PopoverBody, { display: "grid", gap: 1, children: [jsxRuntime.jsx(react.Input, { placeholder: translate.t(removeIndex(`${colLabel}.typeToSearch`)), onChange: (event) => {
4294
4307
  onSearchChange(event);
4295
4308
  setOpenSearchResult(true);
4296
- }, autoComplete: "off", ref: ref }), jsxRuntime.jsx(PopoverTitle, {}), (searchText?.length ?? 0) > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isFetching && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isFetching" }), isLoading && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isLoading" }), isPending && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isPending" }), isError && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isError" }), jsxRuntime.jsx(react.Text, { justifySelf: "center", children: `${translate.t(removeIndex(`${colLabel}.total`))} ${count}, ${translate.t(removeIndex(`${colLabel}.showing`))} ${limit}` }), jsxRuntime.jsxs(react.Grid, { gridTemplateColumns: "repeat(auto-fit, minmax(15rem, 1fr))", overflow: "auto", maxHeight: "50vh", children: [jsxRuntime.jsx(react.Flex, { flexFlow: "column wrap", children:
4309
+ }, autoComplete: "off", ref: ref }), jsxRuntime.jsx(PopoverTitle, {}), (searchText?.length ?? 0) > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isFetching && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isFetching" }), isLoading && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isLoading" }), isPending && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "isPending" }), (isFetching || isLoading || isPending) && jsxRuntime.jsx(react.Spinner, {}), isError && (jsxRuntime.jsx(react.Icon, { color: "red.400", children: jsxRuntime.jsx(bi.BiError, {}) })), jsxRuntime.jsx(react.Text, { justifySelf: "center", children: `${translate.t(removeIndex(`${colLabel}.total`))} ${count}, ${translate.t(removeIndex(`${colLabel}.showing`))} ${limit}` }), jsxRuntime.jsxs(react.Grid, { gridTemplateColumns: "repeat(auto-fit, minmax(15rem, 1fr))", overflow: "auto", maxHeight: "50vh", children: [jsxRuntime.jsx(react.Flex, { flexFlow: "column wrap", children:
4297
4310
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4298
4311
  dataList.map((item) => {
4299
4312
  const selected = isMultiple
@@ -4313,7 +4326,7 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
4313
4326
  }, opacity: 0.7, _hover: { opacity: 1 }, ...(selected ? { color: "gray.400/50" } : {}), children: !!renderDisplay === true
4314
4327
  ? renderDisplay(item)
4315
4328
  : item[display_column] }, item[column_ref]));
4316
- }) }), isDirty && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: dataList.length <= 0 && (jsxRuntime.jsx(react.Text, { children: translate.t(removeIndex(`${colLabel}.emptySearchResult`)) })) }))] }), jsxRuntime.jsx(PaginationRoot, { justifySelf: "center", count: query?.data?.count ?? 0, pageSize: 10, defaultPage: 1, page: page + 1, onPageChange: (e) => setPage(e.page - 1), children: jsxRuntime.jsxs(react.HStack, { gap: "4", children: [jsxRuntime.jsx(PaginationPrevTrigger, {}), jsxRuntime.jsx(PaginationPageText, {}), jsxRuntime.jsx(PaginationNextTrigger, {})] }) })] }))] }) })] }), errors[`${colLabel}`] && (jsxRuntime.jsx(react.Text, { color: "red.400", children: translate.t(removeIndex(`${colLabel}.fieldRequired`)) }))] }));
4329
+ }) }), isDirty && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: dataList.length <= 0 && (jsxRuntime.jsx(react.Text, { children: translate.t(removeIndex(`${colLabel}.emptySearchResult`)) })) }))] }), jsxRuntime.jsx(PaginationRoot, { justifySelf: "center", count: count, pageSize: 10, defaultPage: 1, page: page + 1, onPageChange: (e) => setPage(e.page - 1), children: jsxRuntime.jsxs(react.HStack, { gap: "4", children: [jsxRuntime.jsx(PaginationPrevTrigger, {}), count > 0 && jsxRuntime.jsx(PaginationPageText, {}), jsxRuntime.jsx(PaginationNextTrigger, {})] }) })] }))] }) })] }), errors[`${colLabel}`] && (jsxRuntime.jsx(react.Text, { color: "red.400", children: translate.t(removeIndex(`${colLabel}.fieldRequired`)) }))] }));
4317
4330
  };
4318
4331
 
4319
4332
  const NumberInputRoot = React__namespace.forwardRef(function NumberInput(props, ref) {
@@ -4925,7 +4938,7 @@ const idPickerSanityCheck = (column, foreign_key) => {
4925
4938
  }
4926
4939
  };
4927
4940
  const FormInternal = () => {
4928
- const { schema, requestUrl, order, onSubmit, rowNumber, translate, requestOptions, } = useSchemaContext();
4941
+ const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, } = useSchemaContext();
4929
4942
  const methods = reactHookForm.useFormContext();
4930
4943
  const [isSuccess, setIsSuccess] = React.useState(false);
4931
4944
  const [isError, setIsError] = React.useState(false);
@@ -4984,11 +4997,19 @@ const FormInternal = () => {
4984
4997
  setIsError(false);
4985
4998
  setIsConfirming(true);
4986
4999
  };
4987
- const renderOrder = (order, origin_list) => {
4988
- const not_exist = origin_list.filter((columnA) => !order.some((columnB) => columnA === columnB));
4989
- return [...order, ...not_exist];
5000
+ const renderColumns = ({ order, keys, ignore, include, }) => {
5001
+ const included = include.length > 0 ? include : keys;
5002
+ const not_exist = included.filter((columnA) => !order.some((columnB) => columnA === columnB));
5003
+ const ordered = [...order, ...not_exist];
5004
+ const ignored = ordered.filter((column) => !ignore.some((shouldIgnore) => column === shouldIgnore));
5005
+ return ignored;
4990
5006
  };
4991
- const ordered = renderOrder(order, Object.keys(properties));
5007
+ const ordered = renderColumns({
5008
+ order,
5009
+ keys: Object.keys(properties),
5010
+ ignore,
5011
+ include,
5012
+ });
4992
5013
  if (isSuccess) {
4993
5014
  return (jsxRuntime.jsxs(react.Grid, { gap: 2, children: [jsxRuntime.jsx(react.Heading, { children: translate.t("title") }), jsxRuntime.jsxs(react.Alert.Root, { status: "success", children: [jsxRuntime.jsx(react.Alert.Indicator, {}), jsxRuntime.jsx(react.Alert.Title, { children: translate.t("submitSuccess") })] }), jsxRuntime.jsx(react.Flex, { justifyContent: "end", children: jsxRuntime.jsx(Button, { onClick: () => {
4994
5015
  setIsError(false);
@@ -5024,7 +5045,7 @@ const FormInternal = () => {
5024
5045
  methods.handleSubmit(onValid)();
5025
5046
  }, formNoValidate: true, children: translate.t("submit") })] })] }) }));
5026
5047
  };
5027
- const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [], ignore = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, }) => {
5048
+ const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, }) => {
5028
5049
  const { properties } = schema;
5029
5050
  idListSanityCheck("order", order, properties);
5030
5051
  idListSanityCheck("ignore", ignore, properties);
@@ -5033,6 +5054,7 @@ const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [],
5033
5054
  serverUrl,
5034
5055
  order,
5035
5056
  ignore,
5057
+ include,
5036
5058
  // @ts-expect-error TODO: find appropriate types
5037
5059
  onSubmit,
5038
5060
  rowNumber,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { MdFilterAlt, MdArrowUpward, MdArrowDownward, MdOutlineMoveDown, MdOutli
7
7
  import { LuX, LuCheck, LuChevronRight, LuChevronDown } from 'react-icons/lu';
8
8
  import Dayzed from '@bsol-oss/dayzed-react19';
9
9
  import { FaUpDown, FaGripLinesVertical } from 'react-icons/fa6';
10
- import { BiDownArrow, BiUpArrow } from 'react-icons/bi';
10
+ import { BiDownArrow, BiUpArrow, BiError } from 'react-icons/bi';
11
11
  import { CgClose } from 'react-icons/cg';
12
12
  import { IoMdEye, IoMdCheckbox } from 'react-icons/io';
13
13
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -3528,26 +3528,14 @@ const SchemaFormContext = createContext({
3528
3528
  requestUrl: "",
3529
3529
  order: [],
3530
3530
  ignore: [],
3531
+ include: [],
3531
3532
  onSubmit: async () => { },
3532
3533
  rowNumber: 0,
3533
3534
  requestOptions: {},
3534
3535
  });
3535
3536
 
3536
3537
  const useSchemaContext = () => {
3537
- const { schema, serverUrl, requestUrl, order, ignore, onSubmit, rowNumber, idMap, setIdMap, translate, requestOptions, } = useContext(SchemaFormContext);
3538
- return {
3539
- schema,
3540
- serverUrl,
3541
- requestUrl,
3542
- order,
3543
- ignore,
3544
- onSubmit,
3545
- rowNumber,
3546
- idMap,
3547
- setIdMap,
3548
- translate,
3549
- requestOptions,
3550
- };
3538
+ return useContext(SchemaFormContext);
3551
3539
  };
3552
3540
 
3553
3541
  const clearEmptyString = (object) => {
@@ -4238,13 +4226,38 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
4238
4226
  const dataList = data?.data ?? [];
4239
4227
  const count = data?.count ?? 0;
4240
4228
  const isDirty = (searchText?.length ?? 0) > 0;
4229
+ const watchId = watch(colLabel);
4230
+ const watchIds = (watch(colLabel) ?? []);
4231
+ useQuery({
4232
+ queryKey: [`idpicker`, { column, searchText, limit, page }],
4233
+ queryFn: async () => {
4234
+ const data = await getTableData({
4235
+ serverUrl,
4236
+ searching: watchId,
4237
+ in_table: table,
4238
+ limit: limit,
4239
+ offset: page * 10,
4240
+ });
4241
+ const newMap = Object.fromEntries((data ?? { data: [] }).data.map((item) => {
4242
+ return [
4243
+ item[column_ref],
4244
+ {
4245
+ ...item,
4246
+ },
4247
+ ];
4248
+ }));
4249
+ setIdMap((state) => {
4250
+ return { ...state, ...newMap };
4251
+ });
4252
+ return data;
4253
+ },
4254
+ staleTime: 300000,
4255
+ });
4241
4256
  const onSearchChange = async (event) => {
4242
4257
  setSearchText(event.target.value);
4243
4258
  setPage(0);
4244
4259
  setLimit(10);
4245
4260
  };
4246
- const watchId = watch(colLabel);
4247
- const watchIds = (watch(colLabel) ?? []);
4248
4261
  const getPickedValue = () => {
4249
4262
  if (Object.keys(idMap).length <= 0) {
4250
4263
  return "";
@@ -4273,7 +4286,7 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
4273
4286
  }, children: getPickedValue() })), jsxs(PopoverRoot, { open: openSearchResult, onOpenChange: (e) => setOpenSearchResult(e.open), closeOnInteractOutside: true, initialFocusEl: () => ref.current, positioning: { placement: "bottom-start", strategy: "fixed" }, children: [jsx(PopoverTrigger, {}), jsx(PopoverContent, { children: jsxs(PopoverBody, { display: "grid", gap: 1, children: [jsx(Input, { placeholder: translate.t(removeIndex(`${colLabel}.typeToSearch`)), onChange: (event) => {
4274
4287
  onSearchChange(event);
4275
4288
  setOpenSearchResult(true);
4276
- }, autoComplete: "off", ref: ref }), jsx(PopoverTitle, {}), (searchText?.length ?? 0) > 0 && (jsxs(Fragment, { children: [isFetching && jsx(Fragment, { children: "isFetching" }), isLoading && jsx(Fragment, { children: "isLoading" }), isPending && jsx(Fragment, { children: "isPending" }), isError && jsx(Fragment, { children: "isError" }), jsx(Text, { justifySelf: "center", children: `${translate.t(removeIndex(`${colLabel}.total`))} ${count}, ${translate.t(removeIndex(`${colLabel}.showing`))} ${limit}` }), jsxs(Grid, { gridTemplateColumns: "repeat(auto-fit, minmax(15rem, 1fr))", overflow: "auto", maxHeight: "50vh", children: [jsx(Flex, { flexFlow: "column wrap", children:
4289
+ }, autoComplete: "off", ref: ref }), jsx(PopoverTitle, {}), (searchText?.length ?? 0) > 0 && (jsxs(Fragment, { children: [isFetching && jsx(Fragment, { children: "isFetching" }), isLoading && jsx(Fragment, { children: "isLoading" }), isPending && jsx(Fragment, { children: "isPending" }), (isFetching || isLoading || isPending) && jsx(Spinner, {}), isError && (jsx(Icon, { color: "red.400", children: jsx(BiError, {}) })), jsx(Text, { justifySelf: "center", children: `${translate.t(removeIndex(`${colLabel}.total`))} ${count}, ${translate.t(removeIndex(`${colLabel}.showing`))} ${limit}` }), jsxs(Grid, { gridTemplateColumns: "repeat(auto-fit, minmax(15rem, 1fr))", overflow: "auto", maxHeight: "50vh", children: [jsx(Flex, { flexFlow: "column wrap", children:
4277
4290
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4278
4291
  dataList.map((item) => {
4279
4292
  const selected = isMultiple
@@ -4293,7 +4306,7 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
4293
4306
  }, opacity: 0.7, _hover: { opacity: 1 }, ...(selected ? { color: "gray.400/50" } : {}), children: !!renderDisplay === true
4294
4307
  ? renderDisplay(item)
4295
4308
  : item[display_column] }, item[column_ref]));
4296
- }) }), isDirty && (jsx(Fragment, { children: dataList.length <= 0 && (jsx(Text, { children: translate.t(removeIndex(`${colLabel}.emptySearchResult`)) })) }))] }), jsx(PaginationRoot, { justifySelf: "center", count: query?.data?.count ?? 0, pageSize: 10, defaultPage: 1, page: page + 1, onPageChange: (e) => setPage(e.page - 1), children: jsxs(HStack, { gap: "4", children: [jsx(PaginationPrevTrigger, {}), jsx(PaginationPageText, {}), jsx(PaginationNextTrigger, {})] }) })] }))] }) })] }), errors[`${colLabel}`] && (jsx(Text, { color: "red.400", children: translate.t(removeIndex(`${colLabel}.fieldRequired`)) }))] }));
4309
+ }) }), isDirty && (jsx(Fragment, { children: dataList.length <= 0 && (jsx(Text, { children: translate.t(removeIndex(`${colLabel}.emptySearchResult`)) })) }))] }), jsx(PaginationRoot, { justifySelf: "center", count: count, pageSize: 10, defaultPage: 1, page: page + 1, onPageChange: (e) => setPage(e.page - 1), children: jsxs(HStack, { gap: "4", children: [jsx(PaginationPrevTrigger, {}), count > 0 && jsx(PaginationPageText, {}), jsx(PaginationNextTrigger, {})] }) })] }))] }) })] }), errors[`${colLabel}`] && (jsx(Text, { color: "red.400", children: translate.t(removeIndex(`${colLabel}.fieldRequired`)) }))] }));
4297
4310
  };
4298
4311
 
4299
4312
  const NumberInputRoot = React.forwardRef(function NumberInput$1(props, ref) {
@@ -4905,7 +4918,7 @@ const idPickerSanityCheck = (column, foreign_key) => {
4905
4918
  }
4906
4919
  };
4907
4920
  const FormInternal = () => {
4908
- const { schema, requestUrl, order, onSubmit, rowNumber, translate, requestOptions, } = useSchemaContext();
4921
+ const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, } = useSchemaContext();
4909
4922
  const methods = useFormContext();
4910
4923
  const [isSuccess, setIsSuccess] = useState(false);
4911
4924
  const [isError, setIsError] = useState(false);
@@ -4964,11 +4977,19 @@ const FormInternal = () => {
4964
4977
  setIsError(false);
4965
4978
  setIsConfirming(true);
4966
4979
  };
4967
- const renderOrder = (order, origin_list) => {
4968
- const not_exist = origin_list.filter((columnA) => !order.some((columnB) => columnA === columnB));
4969
- return [...order, ...not_exist];
4980
+ const renderColumns = ({ order, keys, ignore, include, }) => {
4981
+ const included = include.length > 0 ? include : keys;
4982
+ const not_exist = included.filter((columnA) => !order.some((columnB) => columnA === columnB));
4983
+ const ordered = [...order, ...not_exist];
4984
+ const ignored = ordered.filter((column) => !ignore.some((shouldIgnore) => column === shouldIgnore));
4985
+ return ignored;
4970
4986
  };
4971
- const ordered = renderOrder(order, Object.keys(properties));
4987
+ const ordered = renderColumns({
4988
+ order,
4989
+ keys: Object.keys(properties),
4990
+ ignore,
4991
+ include,
4992
+ });
4972
4993
  if (isSuccess) {
4973
4994
  return (jsxs(Grid, { gap: 2, children: [jsx(Heading, { children: translate.t("title") }), jsxs(Alert.Root, { status: "success", children: [jsx(Alert.Indicator, {}), jsx(Alert.Title, { children: translate.t("submitSuccess") })] }), jsx(Flex, { justifyContent: "end", children: jsx(Button, { onClick: () => {
4974
4995
  setIsError(false);
@@ -5004,7 +5025,7 @@ const FormInternal = () => {
5004
5025
  methods.handleSubmit(onValid)();
5005
5026
  }, formNoValidate: true, children: translate.t("submit") })] })] }) }));
5006
5027
  };
5007
- const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [], ignore = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, }) => {
5028
+ const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, }) => {
5008
5029
  const { properties } = schema;
5009
5030
  idListSanityCheck("order", order, properties);
5010
5031
  idListSanityCheck("ignore", ignore, properties);
@@ -5013,6 +5034,7 @@ const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [],
5013
5034
  serverUrl,
5014
5035
  order,
5015
5036
  ignore,
5037
+ include,
5016
5038
  // @ts-expect-error TODO: find appropriate types
5017
5039
  onSubmit,
5018
5040
  rowNumber,
@@ -14,6 +14,7 @@ export interface FormProps<TData extends FieldValues> {
14
14
  translate: UseTranslationResponse<any, any>;
15
15
  order?: string[];
16
16
  ignore?: string[];
17
+ include?: string[];
17
18
  onSubmit?: SubmitHandler<TData>;
18
19
  rowNumber?: number | string;
19
20
  requestOptions?: AxiosRequestConfig;
@@ -32,4 +33,4 @@ export declare const idPickerSanityCheck: (column: string, foreign_key?: {
32
33
  column?: string | undefined;
33
34
  display_column?: string | undefined;
34
35
  } | undefined) => void;
35
- export declare const Form: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, order, ignore, onSubmit, rowNumber, requestOptions, }: FormProps<TData>) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const Form: <TData extends FieldValues>({ schema, idMap, setIdMap, form, serverUrl, translate, order, ignore, include, onSubmit, rowNumber, requestOptions, }: FormProps<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,7 @@ export interface SchemaFormContext<TData extends FieldValues> {
9
9
  requestUrl: string;
10
10
  order: string[];
11
11
  ignore: string[];
12
+ include: string[];
12
13
  onSubmit?: (data: TData) => Promise<void>;
13
14
  rowNumber?: number | string;
14
15
  idMap: Record<string, object>;
@@ -1,14 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const useSchemaContext: () => {
3
- schema: import("json-schema").JSONSchema7;
4
- serverUrl: string;
5
- requestUrl: string;
6
- order: string[];
7
- ignore: string[];
8
- onSubmit: ((data: unknown) => Promise<void>) | undefined;
9
- rowNumber: string | number | undefined;
10
- idMap: Record<string, object>;
11
- setIdMap: import("react").Dispatch<import("react").SetStateAction<Record<string, object>>>;
12
- translate: import("react-i18next").UseTranslationResponse<any, any>;
13
- requestOptions: import("axios").AxiosRequestConfig<any>;
14
- };
1
+ import { SchemaFormContext } from "./SchemaFormContext";
2
+ export declare const useSchemaContext: () => SchemaFormContext<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsol-oss/react-datatable5",
3
- "version": "11.0.0-beta.7",
3
+ "version": "11.0.0-beta.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -49,12 +49,11 @@
49
49
  "react": "^19.0.0",
50
50
  "react-dom": "^19.0.0",
51
51
  "react-hook-form": "^7.54.2",
52
+ "react-i18next": "^15.4.1",
52
53
  "react-icons": "^5.4.0",
53
- "tiny-invariant": "^1.3.3",
54
- "react-i18next": "^15.4.1"
54
+ "tiny-invariant": "^1.3.3"
55
55
  },
56
56
  "devDependencies": {
57
- "@chromatic-com/storybook": "^3.2.3",
58
57
  "@rollup/plugin-alias": "^5.1.1",
59
58
  "@rollup/plugin-typescript": "^11.1.6",
60
59
  "@storybook/addon-essentials": "^8.4.7",