@equinor/apollo-components 3.1.8-cell.0 → 3.2.0-beta.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
@@ -7,6 +7,8 @@ import * as _equinor_eds_core_react from '@equinor/eds-core-react';
7
7
  import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-core-react';
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;
@@ -38,8 +40,10 @@ declare function DynamicCell<T>({ cell, highlight, getStickyCellColor }: TableCe
38
40
 
39
41
  interface HeaderCellProps<TData, TValue> {
40
42
  header: Header<TData, TValue>;
43
+ /** Needed for column resizing */
44
+ table: Table<TData>;
41
45
  }
42
- declare const HeaderCell: <TData, TValue>({ header }: HeaderCellProps<TData, TValue>) => JSX.Element;
46
+ declare const HeaderCell: <TData, TValue>({ header, table }: HeaderCellProps<TData, TValue>) => JSX.Element;
43
47
 
44
48
  declare type HierarchyCellOptions = {
45
49
  getRowDepth?: () => number;
@@ -133,6 +137,7 @@ interface DataTableProps<T> {
133
137
  virtual?: boolean;
134
138
  getRowId?: (originalRow: T, index: number, parent: Row<T> | undefined) => string;
135
139
  getSubRows?: (originalRow: T) => T[] | undefined;
140
+ columnResizing?: boolean | TableOptions<T>['columnResizeMode'];
136
141
  rowSelection?: Partial<ControlledState<RowSelectionState>> & {
137
142
  mode?: RowSelectionMode;
138
143
  selectColumn?: 'default' | ((options?: Record<string, any>) => ColumnDef<T, any>);
@@ -157,7 +162,12 @@ interface DataTableProps<T> {
157
162
  enableGlobalFilterInput?: boolean;
158
163
  globalFilterPlaceholder?: string;
159
164
  filterFromLeafRows?: boolean;
165
+ /**
166
+ * @deprecated Use `customActionsLeft` instead
167
+ */
160
168
  customActions?: <T>(table: Table<T>) => ReactNode;
169
+ customActionsLeft?: <T>(table: Table<T>) => ReactNode;
170
+ customActionsRight?: <T>(table: Table<T>) => ReactNode;
161
171
  /**
162
172
  * Default 1rem
163
173
  * Accepts any CSS padding value
@@ -239,8 +249,13 @@ declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T
239
249
 
240
250
  interface EditableDateCellProps<T extends FormMeta> extends CellContext<T, unknown> {
241
251
  dateStringFormatter?: (date: string) => string;
252
+ /**
253
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
254
+ * react-hook-form's validation.
255
+ */
256
+ error?: FieldError;
242
257
  }
243
- declare function EditableDateCell<T extends FormMeta>(props: EditableDateCellProps<T>): JSX.Element;
258
+ declare function EditableDateCell<T extends FormMeta>({ dateStringFormatter, error: errorFromProps, ...context }: EditableDateCellProps<T>): JSX.Element;
244
259
 
245
260
  interface Option {
246
261
  label: string;
@@ -251,16 +266,40 @@ interface EditableDropdownSingleCellProps<T extends FormMeta> extends CellContex
251
266
  * `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
252
267
  */
253
268
  options: Option[];
269
+ /**
270
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
271
+ * react-hook-form's validation.
272
+ */
273
+ error?: FieldError;
254
274
  }
255
- declare function EditableDropdownSingleCell<T extends FormMeta>(props: EditableDropdownSingleCellProps<T>): JSX.Element;
275
+ declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, ...context }: EditableDropdownSingleCellProps<T>): JSX.Element;
256
276
 
257
- declare function EditableNumberCell<T extends FormMeta>(context: CellContext<T, number>): JSX.Element;
277
+ interface EditableNumberCellProps<T extends FormMeta> extends CellContext<T, number> {
278
+ /**
279
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
280
+ * react-hook-form's validation.
281
+ */
282
+ error?: FieldError;
283
+ }
284
+ declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableNumberCellProps<T>): JSX.Element;
258
285
 
259
286
  interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
260
287
  title: string;
288
+ /**
289
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
290
+ * react-hook-form's validation.
291
+ */
292
+ error?: FieldError;
261
293
  }
262
- declare function EditableTextAreaCell<T extends FormMeta>(props: EdtiableTextAreaProps<T>): JSX.Element;
294
+ declare function EditableTextAreaCell<T extends FormMeta>({ title, error: errorFromProps, ...context }: EdtiableTextAreaProps<T>): JSX.Element;
263
295
 
264
- declare function EditableTextFieldCell<T extends FormMeta>(context: CellContext<T, unknown>): JSX.Element;
296
+ interface EditableTextFieldCellProps<T extends FormMeta> extends CellContext<T, unknown> {
297
+ /**
298
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
299
+ * react-hook-form's validation.
300
+ */
301
+ error?: FieldError;
302
+ }
303
+ declare function EditableTextFieldCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableTextFieldCellProps<T>): JSX.Element;
265
304
 
266
305
  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 };