@oc-digital/react-component-library 8.17.2-beta.0 → 8.17.3

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.
@@ -1,5 +1,5 @@
1
1
  import { IAuthoriserProp } from "../globals";
2
- import type { ButtonProps } from "@mui/material";
2
+ import type { ButtonProps } from "@mui/material/Button";
3
3
  export type IButtonProps<C extends React.ElementType = React.ElementType> = ButtonProps<C, {
4
4
  component?: C;
5
5
  }> & IAuthoriserProp & {
@@ -1,5 +1,5 @@
1
- import type { DatePickerProps } from "@mui/x-date-pickers";
2
- import type { IAuthoriserProp } from "../globals";
1
+ import { DatePickerProps } from "@mui/x-date-pickers/DatePicker";
2
+ import { IAuthoriserProp } from "../globals";
3
3
  export type IDatePickerProps = DatePickerProps<Date> & IAuthoriserProp & {
4
4
  styling?: string;
5
5
  };
@@ -5,56 +5,51 @@ export type IAlignment = "left" | "right" | "inherit" | "center" | "justify";
5
5
  export type RowData = {
6
6
  [key: string]: any;
7
7
  };
8
- /** @deprecated old legacy type - doesn't support recursive nested columns */
9
- type IBaseTableHeader = {
8
+ export type ITableHeader = {
10
9
  Header: string | JSX.Element;
11
- stickyColumn?: boolean;
12
- textAlign?: IAlignment;
13
- };
14
- /** @deprecated old legacy type - doesn't support recursive nested columns */
15
- export type ITableHeader = IBaseTableHeader & {
16
10
  accessor: string;
11
+ textAlign?: IAlignment;
12
+ stickyCell?: boolean;
17
13
  shadedHeader?: boolean;
18
14
  linkedStatusColumn?: string;
19
15
  };
20
- /** @deprecated old legacy type - doesn't support recursive nested columns */
21
- export type ITableHeaderComplexAccessor = IBaseTableHeader & {
16
+ export type ITableHeaderComplexAccessor = {
17
+ Header: string | JSX.Element;
22
18
  id: string;
23
19
  accessor: (originalRow: any, rowIndex: any) => any;
20
+ textAlign?: IAlignment;
21
+ stickyCell?: boolean;
24
22
  shadedHeader?: boolean;
25
23
  };
26
- type SharedHeaderStructure = {
24
+ export type IColumnsTableHeader = {
27
25
  Header: string | JSX.Element;
28
26
  textAlign?: IAlignment;
27
+ stickyCell?: boolean;
29
28
  shadedHeaderGroup?: boolean;
30
- };
31
- type TopLevelOnlyFields = {
32
29
  accessor?: any;
33
- stickyColumn?: boolean;
34
- shadedHeader?: boolean;
35
- };
36
- type LowerLevelOnlyFields = {
37
- linkedStatusColumn?: string;
38
- } & ({
39
- id: string;
40
- accessor: (originalRow: any, rowIndex: any) => any;
41
- } | {
42
- accessor?: string;
43
- });
44
- type TableHeaderWithSubColumns = LowerLevelOnlyFields & {
45
- id?: string;
46
- accessor?: never;
47
- columns: (RecursiveTableHeader & LowerLevelOnlyFields)[];
30
+ columns: {
31
+ Header: string | JSX.Element;
32
+ shadedHeaderGroup?: boolean;
33
+ accessor: string;
34
+ textAlign?: IAlignment;
35
+ linkedStatusColumn?: string;
36
+ }[];
48
37
  };
49
- type TableHeaderWithAccessor = LowerLevelOnlyFields & {
50
- accessor: LowerLevelOnlyFields["accessor"];
51
- columns?: never;
38
+ export type IColumnsTableHeaderComplexAccessor = {
39
+ Header: string | JSX.Element;
40
+ textAlign?: IAlignment;
41
+ stickyCell?: boolean;
42
+ shadedHeaderGroup?: boolean;
43
+ accessor?: any;
44
+ columns: {
45
+ Header: string | JSX.Element;
46
+ id: string;
47
+ shadedHeaderGroup?: boolean;
48
+ accessor: (originalRow: any, rowIndex: any) => any;
49
+ textAlign?: IAlignment;
50
+ linkedStatusColumn?: string;
51
+ }[];
52
52
  };
53
- type RecursiveTableHeader = SharedHeaderStructure & (TableHeaderWithSubColumns | TableHeaderWithAccessor);
54
- export type IColumnsTableHeader = RecursiveTableHeader & TopLevelOnlyFields;
55
- /** @deprecated old legacy type - doesn't support recursive nested columns */
56
- export type IColumnsTableHeaderComplexAccessor = IColumnsTableHeader;
57
- /** @deprecated old legacy type - use IColumnsTableHeader directly */
58
53
  export type ITableHeaders = ITableHeader | ITableHeaderComplexAccessor | IColumnsTableHeader | IColumnsTableHeaderComplexAccessor;
59
54
  export type TableCellValues = null | undefined | string | number | Date | boolean | string[];
60
55
  export type SynchCellWithStateFn = (rowIndex: number, columnId: string, value: TableCellValues, errorStatus: boolean, forceUpdate?: boolean, original?: RowData) => void;
@@ -62,35 +57,31 @@ export type SortMeta = {
62
57
  sortingColumnId: string;
63
58
  asc: boolean;
64
59
  };
65
- type EditableTableFieldConfiguration = {
66
- validationRule?: SchemaOf<any>;
67
- dependentValidationRule?: (values: {
68
- [key: string]: any;
69
- }) => SchemaOf<any>;
70
- customRenderFn?: (args: ICustomRenderFnProps) => JSX.Element;
71
- prefix?: React.ReactNode | React.JSXElementConstructor<any>;
72
- suffix?: React.ReactNode | React.JSXElementConstructor<any>;
73
- textAlign?: IAlignment;
74
- onBlur?: (args: {
75
- rowIndex: number;
76
- value: string;
77
- setRows: React.Dispatch<React.SetStateAction<RowData[] | null>>;
78
- values: RowData;
79
- }) => Promise<void>;
80
- isCheckbox?: boolean;
81
- isDateField?: boolean;
82
- onChangeValueModifier?: (value: string) => TableCellValues;
83
- getCalculatedValue?: (values: RowData) => TableCellValues;
84
- isReadOnly?: boolean;
85
- total?: boolean;
86
- canUserSort?: boolean;
87
- sortCompareFn?: (a: any, b: any) => number;
88
- };
89
60
  export type FieldConfig = {
90
- [key: string]: EditableTableFieldConfiguration;
91
- };
92
- export type TypedFieldConfiguration<T> = {
93
- [key in keyof T]?: EditableTableFieldConfiguration;
61
+ [key: string]: {
62
+ validationRule?: SchemaOf<any>;
63
+ dependentValidationRule?: (values: {
64
+ [key: string]: any;
65
+ }) => SchemaOf<any>;
66
+ customRenderFn?: (args: ICustomRenderFnProps) => JSX.Element;
67
+ prefix?: React.ReactNode | React.JSXElementConstructor<any>;
68
+ suffix?: React.ReactNode | React.JSXElementConstructor<any>;
69
+ textAlign?: IAlignment;
70
+ onBlur?: (args: {
71
+ rowIndex: number;
72
+ value: string;
73
+ setRows: React.Dispatch<React.SetStateAction<RowData[] | null>>;
74
+ values: RowData;
75
+ }) => Promise<void>;
76
+ isCheckbox?: boolean;
77
+ isDateField?: boolean;
78
+ onChangeValueModifier?: (value: string) => TableCellValues;
79
+ getCalculatedValue?: (values: RowData) => TableCellValues;
80
+ isReadOnly?: boolean;
81
+ total?: boolean;
82
+ canUserSort?: boolean;
83
+ sortCompareFn?: (a: any, b: any) => number;
84
+ };
94
85
  };
95
86
  export interface IEditableTableProps {
96
87
  tableRows: RowData[] | null;
@@ -118,8 +109,6 @@ export interface IEditableTableProps {
118
109
  includeGlobalSearch?: boolean;
119
110
  disableHeaderSelect?: boolean;
120
111
  defaultSortMeta?: SortMeta | null;
121
- shadedHeaderLeadingColumns?: 1 | 2;
122
- freezeHeader?: boolean;
123
112
  }
124
113
  export interface IEditableTableRef {
125
114
  setValue: (rowIndex: number, columnId: string, value: TableCellValues) => void;
@@ -164,8 +153,6 @@ export interface ITableContentProps extends Pick<IEditableTableProps, "disabled"
164
153
  sortMeta: SortMeta | null;
165
154
  setSortMeta: React.Dispatch<React.SetStateAction<SortMeta | null>>;
166
155
  allColumns: ColumnInstance<RowData>[];
167
- shadedHeaderLeadingColumns?: 1 | 2;
168
- freezeHeader: boolean;
169
156
  }
170
157
  export interface IGlobalFilterProps {
171
158
  preGlobalFilteredRows: RowData[];
@@ -1,5 +1,5 @@
1
- import type { DatePickerProps } from "@mui/x-date-pickers";
2
- import type { IAuthoriserProp } from "../globals";
1
+ import { DatePickerProps } from "@mui/x-date-pickers/DatePicker";
2
+ import { IAuthoriserProp } from "../globals";
3
3
  export interface IDatePickerProps extends IAuthoriserProp, DatePickerProps<Date> {
4
4
  styling?: string;
5
5
  }
@@ -71,6 +71,7 @@ interface ISecondaryConfig {
71
71
  titleColor?: string;
72
72
  titleIconColor?: string;
73
73
  sortByStartDate?: boolean;
74
+ disableSubItemCount?: boolean;
74
75
  }
75
76
  export interface ISideNavConfig {
76
77
  rootRouteName: string;
@@ -85,6 +86,7 @@ export interface ILeftNavigationProps<T = any> {
85
86
  export interface IListItemProps extends ISecondaryNavigationItem {
86
87
  config: ISideNavConfig;
87
88
  Icon: React.FC<ISvgComponentProps>;
89
+ disableSubItemCount?: boolean;
88
90
  }
89
91
  export interface INavListItemStyleProps extends ISecondaryMainConfig, ISecondarySubConfig {
90
92
  }
@@ -1,5 +1,5 @@
1
- import type { MobileDatePickerProps } from "@mui/x-date-pickers";
2
- import type { IAuthoriserProp } from "../globals";
1
+ import { MobileDatePickerProps } from "@mui/x-date-pickers/MobileDatePicker";
2
+ import { IAuthoriserProp } from "../globals";
3
3
  export type IMobileDatePickerProps = MobileDatePickerProps<Date> & IAuthoriserProp & {
4
4
  styling?: string;
5
5
  };
package/build/index.d.ts CHANGED
@@ -17,8 +17,7 @@ import DatePicker from "./DatePicker/DatePicker";
17
17
  import KeyboardDatePicker from "./KeyboardDatePicker/KeyboardDatePicker";
18
18
  import ButtonWithConfirm from "./ButtonWithConfirm/ButtonWithConfirm";
19
19
  import EditableTable from "./EditableTable/EditableTable";
20
- import { useElementDimensions } from "./hooks/useElementDimensions";
21
- import { FieldConfig, TypedFieldConfiguration, RowData, ITableHeader, ITableHeaderComplexAccessor, IColumnsTableHeader, IColumnsTableHeaderComplexAccessor, ITableHeaders, TableCellValues, SynchCellWithStateFn, ICustomRenderFnProps, IEssentialRenderFnProps, SortMeta, IEditableTableRef } from "./EditableTable/EditableTable.types";
20
+ import { FieldConfig, RowData, ITableHeader, ITableHeaderComplexAccessor, IColumnsTableHeader, IColumnsTableHeaderComplexAccessor, ITableHeaders, TableCellValues, SynchCellWithStateFn, ICustomRenderFnProps, IEssentialRenderFnProps, SortMeta, IEditableTableRef } from "./EditableTable/EditableTable.types";
22
21
  import { tableNumericStringField, tableNumericStringFixedDecimalField, tableDateField, tableCheckbox, TableSelect, TableMultipleSelect, NonEditableField } from "./EditableTable/defaultCells";
23
22
  import { useDebounceEffect, useInterval, useWhyDidYouUpdate } from "./hooks";
24
23
  import { didCellValueChange } from "./utils";
@@ -37,5 +36,5 @@ import { TableDateInput } from "./EditableTable/components/TableDateInput";
37
36
  import { TableTextInput } from "./EditableTable/components/TableTextInput";
38
37
  import type { ITableTextInputProps } from "./EditableTable/components/TableTextInput";
39
38
  import type { ISideNavConfig, ISecondaryNavigationElement, ISecondaryNavigationElements } from "./LeftNavigation/LeftNavigation.types";
40
- export { ImageDisplayAndUpload, Alert, Button, ContentLabel, ContentBox, StaticTable, LoadingSpinner, Breadcrumbs, EntityList, ErrorIndicator, LeftNavigation, MainLayout, SearchBar, TextField, Select, DatePicker, AutoSaveTextField, AutoSaveSelectField, KeyboardDatePicker, MobileDatePicker, ButtonWithConfirm, EditableTable, TableSelect, TableMultipleSelect, NonEditableField, TableDateInput as TableDatePicker, TableTextInput as TableTextField, tableNumericStringField, tableNumericStringFixedDecimalField, tableDateField, tableCheckbox, didCellValueChange, useDebounceEffect, useInterval, useWhyDidYouUpdate, useElementDimensions, AlphabeticalList, NumberFormatField, NavbarLayout, OptionalTooltip, FORM_SUCCESS, FORM_ERROR, FORM_LOADING, FORM_ENABLED, FORM_WARNING, FORM_INFO, FORM_DELETING, };
41
- export type { FieldConfig, TypedFieldConfiguration, RowData, ITableHeader, TableCellValues, SynchCellWithStateFn, ICustomRenderFnProps, IEssentialRenderFnProps, ISelectProps, IEntity, INavigationLink, ISecondaryNavigationItem, ISecondaryNavigationSubItem, NavbarLayoutTabs, FormStatuses, ITableTextInputProps, ISideNavConfig, ITableHeaderComplexAccessor, IColumnsTableHeader, IColumnsTableHeaderComplexAccessor, ITableHeaders, SortMeta, IEditableTableRef, IAlertProps, ISecondaryNavigationElement, ISecondaryNavigationElements, };
39
+ export { ImageDisplayAndUpload, Alert, Button, ContentLabel, ContentBox, StaticTable, LoadingSpinner, Breadcrumbs, EntityList, ErrorIndicator, LeftNavigation, MainLayout, SearchBar, TextField, Select, DatePicker, AutoSaveTextField, AutoSaveSelectField, KeyboardDatePicker, MobileDatePicker, ButtonWithConfirm, EditableTable, TableSelect, TableMultipleSelect, NonEditableField, TableDateInput as TableDatePicker, TableTextInput as TableTextField, tableNumericStringField, tableNumericStringFixedDecimalField, tableDateField, tableCheckbox, didCellValueChange, useDebounceEffect, useInterval, useWhyDidYouUpdate, AlphabeticalList, NumberFormatField, NavbarLayout, OptionalTooltip, FORM_SUCCESS, FORM_ERROR, FORM_LOADING, FORM_ENABLED, FORM_WARNING, FORM_INFO, FORM_DELETING, };
40
+ export type { FieldConfig, RowData, ITableHeader, TableCellValues, SynchCellWithStateFn, ICustomRenderFnProps, IEssentialRenderFnProps, ISelectProps, IEntity, INavigationLink, ISecondaryNavigationItem, ISecondaryNavigationSubItem, NavbarLayoutTabs, FormStatuses, ITableTextInputProps, ISideNavConfig, ITableHeaderComplexAccessor, IColumnsTableHeader, IColumnsTableHeaderComplexAccessor, ITableHeaders, SortMeta, IEditableTableRef, IAlertProps, ISecondaryNavigationElement, ISecondaryNavigationElements, };