@equinor/apollo-components 3.1.8 → 3.2.0-fix.1

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
@@ -1,12 +1,14 @@
1
1
  import { IconData } from '@equinor/eds-icons';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, ReactElement, HTMLProps, MutableRefObject, Dispatch, SetStateAction, SyntheticEvent } from 'react';
4
+ import { CellContext, Cell, Header, Table, Row, SortingState, OnChangeFn, ColumnDef, RowSelectionState, ExpandedState, VisibilityState, HeaderContext } from '@tanstack/react-table';
4
5
  import * as styled_components from 'styled-components';
5
6
  import * as _equinor_eds_core_react from '@equinor/eds-core-react';
6
7
  import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-core-react';
7
- import { Cell, Header, CellContext, Table, Row, SortingState, OnChangeFn, ColumnDef, RowSelectionState, ExpandedState, VisibilityState, HeaderContext } from '@tanstack/react-table';
8
8
  import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
9
9
  import { SetRequired } from 'type-fest';
10
+ import { TableOptions } from '@tanstack/table-core/build/lib/types';
11
+ import { FieldError } from 'react-hook-form';
10
12
 
11
13
  interface AppShellProps {
12
14
  children?: ReactNode;
@@ -18,6 +20,8 @@ declare const AppShell: ({ children, icon, title, sidebar }: AppShellProps) => J
18
20
 
19
21
  declare function AppSidebar(): JSX.Element;
20
22
 
23
+ declare function CheckboxCell<T>(context: CellContext<T, boolean>): JSX.Element;
24
+
21
25
  declare const ChipsCell: (props: {
22
26
  values?: string[];
23
27
  }) => JSX.Element;
@@ -36,8 +40,10 @@ declare function DynamicCell<T>({ cell, highlight, getStickyCellColor }: TableCe
36
40
 
37
41
  interface HeaderCellProps<TData, TValue> {
38
42
  header: Header<TData, TValue>;
43
+ /** Needed for column resizing */
44
+ table: Table<TData>;
39
45
  }
40
- declare const HeaderCell: <TData, TValue>({ header }: HeaderCellProps<TData, TValue>) => JSX.Element;
46
+ declare const HeaderCell: <TData, TValue>({ header, table }: HeaderCellProps<TData, TValue>) => JSX.Element;
41
47
 
42
48
  declare type HierarchyCellOptions = {
43
49
  getRowDepth?: () => number;
@@ -131,6 +137,7 @@ interface DataTableProps<T> {
131
137
  virtual?: boolean;
132
138
  getRowId?: (originalRow: T, index: number, parent: Row<T> | undefined) => string;
133
139
  getSubRows?: (originalRow: T) => T[] | undefined;
140
+ columnResizing?: boolean | TableOptions<T>['columnResizeMode'];
134
141
  rowSelection?: Partial<ControlledState<RowSelectionState>> & {
135
142
  mode?: RowSelectionMode;
136
143
  selectColumn?: 'default' | ((options?: Record<string, any>) => ColumnDef<T, any>);
@@ -237,8 +244,13 @@ declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T
237
244
 
238
245
  interface EditableDateCellProps<T extends FormMeta> extends CellContext<T, unknown> {
239
246
  dateStringFormatter?: (date: string) => string;
247
+ /**
248
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
249
+ * react-hook-form's validation.
250
+ */
251
+ error?: FieldError;
240
252
  }
241
- declare function EditableDateCell<T extends FormMeta>(props: EditableDateCellProps<T>): JSX.Element;
253
+ declare function EditableDateCell<T extends FormMeta>({ dateStringFormatter, error: errorFromProps, ...context }: EditableDateCellProps<T>): JSX.Element;
242
254
 
243
255
  interface Option {
244
256
  label: string;
@@ -249,16 +261,40 @@ interface EditableDropdownSingleCellProps<T extends FormMeta> extends CellContex
249
261
  * `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
250
262
  */
251
263
  options: Option[];
264
+ /**
265
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
266
+ * react-hook-form's validation.
267
+ */
268
+ error?: FieldError;
252
269
  }
253
- declare function EditableDropdownSingleCell<T extends FormMeta>(props: EditableDropdownSingleCellProps<T>): JSX.Element;
270
+ declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, ...context }: EditableDropdownSingleCellProps<T>): JSX.Element;
254
271
 
255
- declare function EditableNumberCell<T extends FormMeta>(context: CellContext<T, number>): JSX.Element;
272
+ interface EditableNumberCellProps<T extends FormMeta> extends CellContext<T, number> {
273
+ /**
274
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
275
+ * react-hook-form's validation.
276
+ */
277
+ error?: FieldError;
278
+ }
279
+ declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableNumberCellProps<T>): JSX.Element;
256
280
 
257
281
  interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
258
282
  title: string;
283
+ /**
284
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
285
+ * react-hook-form's validation.
286
+ */
287
+ error?: FieldError;
259
288
  }
260
- declare function EditableTextAreaCell<T extends FormMeta>(props: EdtiableTextAreaProps<T>): JSX.Element;
289
+ declare function EditableTextAreaCell<T extends FormMeta>({ title, error: errorFromProps, ...context }: EdtiableTextAreaProps<T>): JSX.Element;
261
290
 
262
- declare function EditableTextFieldCell<T extends FormMeta>(context: CellContext<T, unknown>): JSX.Element;
291
+ interface EditableTextFieldCellProps<T extends FormMeta> extends CellContext<T, unknown> {
292
+ /**
293
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
294
+ * react-hook-form's validation.
295
+ */
296
+ error?: FieldError;
297
+ }
298
+ declare function EditableTextFieldCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableTextFieldCellProps<T>): JSX.Element;
263
299
 
264
- export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableProps, DynamicCell, EditableCheckboxCell, EditableDateCell, EditableDateCellProps, EditableDropdownSingleCell, EditableDropdownSingleCellProps, EditableNumberCell, EditableTextAreaCell, EditableTextFieldCell, FormMeta, HTMLPropsRef, HeaderCell, HierarchyCell, InfiniteScrollConfig, Option, PopoverCell, RowConfig, RowSelectionMode, SelectColumnDef, SortConfig, StickyCell, StickyHeaderCell, StyledStickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, TypographyCustom, TypographyProps, WithoutFormMeta, addFormMeta, capitalizeHeader, leftCellShadow, prependSelectColumn, removeFormMeta, stopPropagation, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };
300
+ export { AppShell, AppSidebar, CellConfig, CheckboxCell, ChipsCell, ColumnSelect, DataTable, DataTableProps, DynamicCell, EditableCheckboxCell, EditableDateCell, EditableDateCellProps, EditableDropdownSingleCell, EditableDropdownSingleCellProps, EditableNumberCell, EditableTextAreaCell, EditableTextFieldCell, FormMeta, HTMLPropsRef, HeaderCell, HierarchyCell, InfiniteScrollConfig, Option, PopoverCell, RowConfig, RowSelectionMode, SelectColumnDef, SortConfig, StickyCell, StickyHeaderCell, StyledStickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, TypographyCustom, TypographyProps, WithoutFormMeta, addFormMeta, capitalizeHeader, leftCellShadow, prependSelectColumn, removeFormMeta, stopPropagation, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };