@equinor/apollo-components 3.1.8 → 3.2.0-beta.2
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 +54 -9
- package/dist/index.js +811 -739
- package/dist/index.mjs +785 -714
- package/package.json +7 -7
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>);
|
|
@@ -155,7 +162,12 @@ interface DataTableProps<T> {
|
|
|
155
162
|
enableGlobalFilterInput?: boolean;
|
|
156
163
|
globalFilterPlaceholder?: string;
|
|
157
164
|
filterFromLeafRows?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* @deprecated Use `customActionsLeft` instead
|
|
167
|
+
*/
|
|
158
168
|
customActions?: <T>(table: Table<T>) => ReactNode;
|
|
169
|
+
customActionsLeft?: <T>(table: Table<T>) => ReactNode;
|
|
170
|
+
customActionsRight?: <T>(table: Table<T>) => ReactNode;
|
|
159
171
|
/**
|
|
160
172
|
* Default 1rem
|
|
161
173
|
* Accepts any CSS padding value
|
|
@@ -235,10 +247,19 @@ declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
|
|
|
235
247
|
|
|
236
248
|
declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T, boolean>): JSX.Element;
|
|
237
249
|
|
|
238
|
-
interface EditableDateCellProps<T extends FormMeta> extends CellContext<T,
|
|
250
|
+
interface EditableDateCellProps<T extends FormMeta, Value> extends CellContext<T, Value> {
|
|
239
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;
|
|
257
|
+
/**
|
|
258
|
+
*
|
|
259
|
+
*/
|
|
260
|
+
onChange?: (value: Value, original: T) => void;
|
|
240
261
|
}
|
|
241
|
-
declare function EditableDateCell<T extends FormMeta>(
|
|
262
|
+
declare function EditableDateCell<T extends FormMeta, Value>({ dateStringFormatter, error: errorFromProps, ...context }: EditableDateCellProps<T, Value>): JSX.Element;
|
|
242
263
|
|
|
243
264
|
interface Option {
|
|
244
265
|
label: string;
|
|
@@ -249,16 +270,40 @@ interface EditableDropdownSingleCellProps<T extends FormMeta> extends CellContex
|
|
|
249
270
|
* `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
|
|
250
271
|
*/
|
|
251
272
|
options: Option[];
|
|
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;
|
|
252
278
|
}
|
|
253
|
-
declare function EditableDropdownSingleCell<T extends FormMeta>(
|
|
279
|
+
declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, ...context }: EditableDropdownSingleCellProps<T>): JSX.Element;
|
|
254
280
|
|
|
255
|
-
|
|
281
|
+
interface EditableNumberCellProps<T extends FormMeta> extends CellContext<T, number> {
|
|
282
|
+
/**
|
|
283
|
+
* FieldError object used to overwrite react-hook-form validation result. It is prioritized over
|
|
284
|
+
* react-hook-form's validation.
|
|
285
|
+
*/
|
|
286
|
+
error?: FieldError;
|
|
287
|
+
}
|
|
288
|
+
declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableNumberCellProps<T>): JSX.Element;
|
|
256
289
|
|
|
257
290
|
interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
|
|
258
291
|
title: string;
|
|
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;
|
|
259
297
|
}
|
|
260
|
-
declare function EditableTextAreaCell<T extends FormMeta>(
|
|
298
|
+
declare function EditableTextAreaCell<T extends FormMeta>({ title, error: errorFromProps, ...context }: EdtiableTextAreaProps<T>): JSX.Element;
|
|
261
299
|
|
|
262
|
-
|
|
300
|
+
interface EditableTextFieldCellProps<T extends FormMeta> extends CellContext<T, unknown> {
|
|
301
|
+
/**
|
|
302
|
+
* FieldError object used to overwrite react-hook-form validation result. It is prioritized over
|
|
303
|
+
* react-hook-form's validation.
|
|
304
|
+
*/
|
|
305
|
+
error?: FieldError;
|
|
306
|
+
}
|
|
307
|
+
declare function EditableTextFieldCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableTextFieldCellProps<T>): JSX.Element;
|
|
263
308
|
|
|
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 };
|
|
309
|
+
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 };
|