@bsol-oss/react-datatable5 13.0.1-beta.35 → 13.0.1-beta.37

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
@@ -9,7 +9,7 @@ import { UseQueryResult } from '@tanstack/react-query';
9
9
  import { RankingInfo } from '@tanstack/match-sorter-utils';
10
10
  import { JSONSchema7 } from 'json-schema';
11
11
  import * as react_hook_form from 'react-hook-form';
12
- import { UseFormReturn, FieldValues, SubmitHandler } from 'react-hook-form';
12
+ import { UseFormReturn, FieldValues } from 'react-hook-form';
13
13
  import dayjs from 'dayjs';
14
14
 
15
15
  interface TableHeaderTexts {
@@ -700,7 +700,6 @@ interface FormRootProps<TData extends FieldValues> {
700
700
  setIdMap: Dispatch<SetStateAction<Record<string, unknown>>>;
701
701
  form: UseFormReturn<TData, any, TData>;
702
702
  children: ReactNode;
703
- onSubmit?: SubmitHandler<TData>;
704
703
  displayConfig?: {
705
704
  showSubmitButton?: boolean;
706
705
  showResetButton?: boolean;
@@ -721,7 +720,7 @@ interface CustomJSONSchema7Definition extends JSONSchema7 {
721
720
  customQueryFn: any;
722
721
  children: ReactNode;
723
722
  }
724
- 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;
723
+ declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, displayConfig, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => react_jsx_runtime.JSX.Element;
725
724
 
726
725
  interface DefaultFormProps<TData extends FieldValues> {
727
726
  formConfig: Omit<FormRootProps<TData>, "children">;
package/dist/index.js CHANGED
@@ -4191,8 +4191,8 @@ const SchemaFormContext = React.createContext({
4191
4191
  onSubmit: async () => { },
4192
4192
  timezone: 'Asia/Hong_Kong',
4193
4193
  displayConfig: {
4194
- showSubmitButton: true,
4195
- showResetButton: true,
4194
+ showSubmitButton: false,
4195
+ showResetButton: false,
4196
4196
  showTitle: true,
4197
4197
  },
4198
4198
  });
@@ -7087,34 +7087,6 @@ function DateTimePicker$1({ value, onChange, format = 'date-time', showSeconds =
7087
7087
  }
7088
7088
  };
7089
7089
  // Display text for buttons
7090
- React.useMemo(() => {
7091
- if (!selectedDate)
7092
- return labels?.selectDateLabel ?? 'Select date';
7093
- return dayjs(selectedDate).tz(tz).format('YYYY-MM-DD');
7094
- }, [selectedDate, tz, labels]);
7095
- React.useMemo(() => {
7096
- const selectTimeLabel = timePickerLabels?.selectTimeLabel ?? 'Select time';
7097
- if (hour === null || minute === null)
7098
- return selectTimeLabel;
7099
- if (is24Hour) {
7100
- // 24-hour format: never show meridiem, always use 24-hour format (0-23)
7101
- const hour24 = hour >= 0 && hour <= 23 ? hour : hour % 24;
7102
- const s = second ?? 0;
7103
- if (showSeconds) {
7104
- return `${hour24.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
7105
- }
7106
- return `${hour24.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`;
7107
- }
7108
- else {
7109
- // 12-hour format: always show meridiem (AM/PM)
7110
- const hour12 = hour >= 1 && hour <= 12 ? hour : hour % 12;
7111
- if (meridiem === null)
7112
- return selectTimeLabel;
7113
- const hourDisplay = hour12.toString();
7114
- const minuteDisplay = minute.toString().padStart(2, '0');
7115
- return `${hourDisplay}:${minuteDisplay} ${meridiem.toUpperCase()}`;
7116
- }
7117
- }, [hour, minute, second, meridiem, is24Hour, showSeconds, timePickerLabels]);
7118
7090
  const timezoneDisplayText = React.useMemo(() => {
7119
7091
  if (!showTimezoneSelector)
7120
7092
  return '';
@@ -7905,9 +7877,9 @@ const FormBody = () => {
7905
7877
  return null;
7906
7878
  }
7907
7879
  return (jsxRuntime.jsx(ColumnRenderer, { properties: properties, prefix: ``, parentRequired: schema.required, column }, `form-input-${column}`));
7908
- }) }), jsxRuntime.jsxs(react.Flex, { justifyContent: 'end', gap: "2", children: [showResetButton && (jsxRuntime.jsx(react.Button, { onClick: () => {
7880
+ }) }), (showResetButton || showSubmitButton) && (jsxRuntime.jsxs(react.Flex, { justifyContent: 'end', gap: "2", children: [showResetButton && (jsxRuntime.jsx(react.Button, { onClick: () => {
7909
7881
  methods.reset();
7910
- }, variant: 'subtle', children: formButtonLabels?.reset ?? 'Reset' })), showSubmitButton && jsxRuntime.jsx(SubmitButton, {})] })] }));
7882
+ }, variant: 'subtle', children: formButtonLabels?.reset ?? 'Reset' })), showSubmitButton && jsxRuntime.jsx(SubmitButton, {})] }))] }));
7911
7883
  };
7912
7884
 
7913
7885
  const FormTitle = () => {
@@ -7926,15 +7898,13 @@ const FormTitle = () => {
7926
7898
  return jsxRuntime.jsx(react.Heading, { children: schema.title ?? 'Form' });
7927
7899
  };
7928
7900
 
7929
- const FormRoot = ({ schema, idMap, setIdMap, form, children, onSubmit = undefined, displayConfig = {
7930
- showSubmitButton: true,
7931
- showResetButton: true,
7901
+ const FormRoot = ({ schema, idMap, setIdMap, form, children, displayConfig = {
7902
+ showSubmitButton: false,
7903
+ showResetButton: false,
7932
7904
  showTitle: true,
7933
7905
  }, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog = false, }) => {
7934
7906
  return (jsxRuntime.jsx(SchemaFormContext.Provider, { value: {
7935
7907
  schema,
7936
- // @ts-expect-error TODO: find appropriate types
7937
- onSubmit,
7938
7908
  idMap,
7939
7909
  setIdMap,
7940
7910
  displayConfig,
package/dist/index.mjs CHANGED
@@ -4171,8 +4171,8 @@ const SchemaFormContext = createContext({
4171
4171
  onSubmit: async () => { },
4172
4172
  timezone: 'Asia/Hong_Kong',
4173
4173
  displayConfig: {
4174
- showSubmitButton: true,
4175
- showResetButton: true,
4174
+ showSubmitButton: false,
4175
+ showResetButton: false,
4176
4176
  showTitle: true,
4177
4177
  },
4178
4178
  });
@@ -7067,34 +7067,6 @@ function DateTimePicker$1({ value, onChange, format = 'date-time', showSeconds =
7067
7067
  }
7068
7068
  };
7069
7069
  // Display text for buttons
7070
- useMemo(() => {
7071
- if (!selectedDate)
7072
- return labels?.selectDateLabel ?? 'Select date';
7073
- return dayjs(selectedDate).tz(tz).format('YYYY-MM-DD');
7074
- }, [selectedDate, tz, labels]);
7075
- useMemo(() => {
7076
- const selectTimeLabel = timePickerLabels?.selectTimeLabel ?? 'Select time';
7077
- if (hour === null || minute === null)
7078
- return selectTimeLabel;
7079
- if (is24Hour) {
7080
- // 24-hour format: never show meridiem, always use 24-hour format (0-23)
7081
- const hour24 = hour >= 0 && hour <= 23 ? hour : hour % 24;
7082
- const s = second ?? 0;
7083
- if (showSeconds) {
7084
- return `${hour24.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
7085
- }
7086
- return `${hour24.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`;
7087
- }
7088
- else {
7089
- // 12-hour format: always show meridiem (AM/PM)
7090
- const hour12 = hour >= 1 && hour <= 12 ? hour : hour % 12;
7091
- if (meridiem === null)
7092
- return selectTimeLabel;
7093
- const hourDisplay = hour12.toString();
7094
- const minuteDisplay = minute.toString().padStart(2, '0');
7095
- return `${hourDisplay}:${minuteDisplay} ${meridiem.toUpperCase()}`;
7096
- }
7097
- }, [hour, minute, second, meridiem, is24Hour, showSeconds, timePickerLabels]);
7098
7070
  const timezoneDisplayText = useMemo(() => {
7099
7071
  if (!showTimezoneSelector)
7100
7072
  return '';
@@ -7885,9 +7857,9 @@ const FormBody = () => {
7885
7857
  return null;
7886
7858
  }
7887
7859
  return (jsx(ColumnRenderer, { properties: properties, prefix: ``, parentRequired: schema.required, column }, `form-input-${column}`));
7888
- }) }), jsxs(Flex, { justifyContent: 'end', gap: "2", children: [showResetButton && (jsx(Button$1, { onClick: () => {
7860
+ }) }), (showResetButton || showSubmitButton) && (jsxs(Flex, { justifyContent: 'end', gap: "2", children: [showResetButton && (jsx(Button$1, { onClick: () => {
7889
7861
  methods.reset();
7890
- }, variant: 'subtle', children: formButtonLabels?.reset ?? 'Reset' })), showSubmitButton && jsx(SubmitButton, {})] })] }));
7862
+ }, variant: 'subtle', children: formButtonLabels?.reset ?? 'Reset' })), showSubmitButton && jsx(SubmitButton, {})] }))] }));
7891
7863
  };
7892
7864
 
7893
7865
  const FormTitle = () => {
@@ -7906,15 +7878,13 @@ const FormTitle = () => {
7906
7878
  return jsx(Heading, { children: schema.title ?? 'Form' });
7907
7879
  };
7908
7880
 
7909
- const FormRoot = ({ schema, idMap, setIdMap, form, children, onSubmit = undefined, displayConfig = {
7910
- showSubmitButton: true,
7911
- showResetButton: true,
7881
+ const FormRoot = ({ schema, idMap, setIdMap, form, children, displayConfig = {
7882
+ showSubmitButton: false,
7883
+ showResetButton: false,
7912
7884
  showTitle: true,
7913
7885
  }, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog = false, }) => {
7914
7886
  return (jsx(SchemaFormContext.Provider, { value: {
7915
7887
  schema,
7916
- // @ts-expect-error TODO: find appropriate types
7917
- onSubmit,
7918
7888
  idMap,
7919
7889
  setIdMap,
7920
7890
  displayConfig,
@@ -1,6 +1,6 @@
1
1
  import { JSONSchema7 } from 'json-schema';
2
2
  import { Dispatch, ReactNode, SetStateAction } from 'react';
3
- import { FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
3
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
4
4
  import { CustomJSONSchema7, DateTimePickerLabels, EnumPickerLabels, FilePickerLabels, FormButtonLabels, IdPickerLabels, TimePickerLabels } from '../types/CustomJSONSchema7';
5
5
  export interface FormRootProps<TData extends FieldValues> {
6
6
  /**
@@ -33,7 +33,6 @@ export interface FormRootProps<TData extends FieldValues> {
33
33
  setIdMap: Dispatch<SetStateAction<Record<string, unknown>>>;
34
34
  form: UseFormReturn<TData, any, TData>;
35
35
  children: ReactNode;
36
- onSubmit?: SubmitHandler<TData>;
37
36
  displayConfig?: {
38
37
  showSubmitButton?: boolean;
39
38
  showResetButton?: boolean;
@@ -54,4 +53,4 @@ export interface CustomJSONSchema7Definition extends JSONSchema7 {
54
53
  customQueryFn: any;
55
54
  children: ReactNode;
56
55
  }
57
- export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, onSubmit, displayConfig, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
56
+ export declare const FormRoot: <TData extends FieldValues>({ schema, idMap, setIdMap, form, children, displayConfig, dateTimePickerLabels, idPickerLabels, enumPickerLabels, filePickerLabels, formButtonLabels, timePickerLabels, insideDialog, }: FormRootProps<TData>) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsol-oss/react-datatable5",
3
- "version": "13.0.1-beta.35",
3
+ "version": "13.0.1-beta.37",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",