@economic/taco 2.15.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Drawer/Drawer.d.ts +5 -1
- package/dist/components/Provider/Localization.d.ts +19 -0
- package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
- package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
- package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
- package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
- package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
- package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
- package/dist/components/Table3/components/rows/Row.d.ts +2 -0
- package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
- package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
- package/dist/components/Table3/hooks/features/usePauseShortcuts.d.ts +5 -0
- package/dist/components/Table3/hooks/features/useSearch.d.ts +2 -0
- package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
- package/dist/components/Table3/hooks/useTable.d.ts +4 -0
- package/dist/components/Table3/types.d.ts +26 -1
- package/dist/components/Table3/util/editing.d.ts +6 -0
- package/dist/esm/index.css +108 -33
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +4 -0
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +7 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +51 -6
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +7 -55
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +69 -37
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +17 -17
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +21 -12
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +57 -17
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +39 -31
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +8 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +48 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +8 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/index.css +108 -33
- package/dist/taco.cjs.development.js +2605 -1970
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +10973 -7880
@@ -36,8 +36,12 @@ export declare type DrawerProps = Omit<DialogProps, 'draggable' | 'size'> & {
|
|
36
36
|
focusTrap?: boolean;
|
37
37
|
/** When 'true' renders close button in topr right cornenr of drawer content */
|
38
38
|
showCloseButton?: boolean;
|
39
|
+
/** Target specific named outlet allowing you to render a drawer to a specific outlet */
|
40
|
+
outletName?: string;
|
41
|
+
};
|
42
|
+
export declare type OutletProps = React.HTMLAttributes<HTMLDivElement> & {
|
43
|
+
name?: string;
|
39
44
|
};
|
40
|
-
export declare type OutletProps = React.HTMLAttributes<HTMLDivElement>;
|
41
45
|
export declare type ForwardedDrawerWithStatics = React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLElement>> & {
|
42
46
|
Trigger: React.ForwardRefExoticComponent<DrawerTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
43
47
|
Content: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
|
@@ -202,6 +202,12 @@ export declare const defaultLocalisationTexts: {
|
|
202
202
|
progress: string;
|
203
203
|
complete: string;
|
204
204
|
};
|
205
|
+
clearChangesConfirmationDialog: {
|
206
|
+
title: string;
|
207
|
+
description: string;
|
208
|
+
cancel: string;
|
209
|
+
confirm: string;
|
210
|
+
};
|
205
211
|
};
|
206
212
|
filters: {
|
207
213
|
button: string;
|
@@ -302,6 +308,19 @@ export declare const defaultLocalisationTexts: {
|
|
302
308
|
otherOptions: {
|
303
309
|
tooltip: string;
|
304
310
|
};
|
311
|
+
validation: {
|
312
|
+
index: string;
|
313
|
+
alert: {
|
314
|
+
unsavedEntries: (count?: number) => "unsaved entry:" | "unsaved entries:";
|
315
|
+
incompleteAndHavntBeenSaved: (count?: number) => "is incomplete and haven’t been saved." | "are incomplete and haven’t been saved.";
|
316
|
+
};
|
317
|
+
resetFiltersDialog: {
|
318
|
+
title: string;
|
319
|
+
description: string;
|
320
|
+
cancel: string;
|
321
|
+
confirm: string;
|
322
|
+
};
|
323
|
+
};
|
305
324
|
};
|
306
325
|
searchInput: {
|
307
326
|
button: string;
|
@@ -3,6 +3,7 @@ import { KeyDownHandlerOptions } from '../../utils/keyboard';
|
|
3
3
|
interface CommonSearchInput2Props extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {
|
4
4
|
loading?: boolean;
|
5
5
|
onChange: (value: string) => void;
|
6
|
+
onClear?: () => void;
|
6
7
|
settingsContent?: JSX.Element;
|
7
8
|
shortcut?: string | KeyDownHandlerOptions;
|
8
9
|
value?: string;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Table as RTable } from '@tanstack/react-table';
|
2
|
+
import { TableStrategy } from '../../types';
|
3
|
+
import React from 'react';
|
4
|
+
export declare type ErrorAlertProps<TType = unknown> = {
|
5
|
+
table: RTable<TType>;
|
6
|
+
tableRef: React.RefObject<HTMLDivElement>;
|
7
|
+
scrollToIndex: TableStrategy['scrollToIndex'];
|
8
|
+
rowIdentifier?: string;
|
9
|
+
};
|
10
|
+
export declare function ErrorAlert<TType = unknown>(props: ErrorAlertProps<TType>): JSX.Element;
|
@@ -2,8 +2,11 @@ import React from 'react';
|
|
2
2
|
import { CellContext } from '@tanstack/react-table';
|
3
3
|
import { Table3ColumnAlignment } from '../../../types';
|
4
4
|
export declare type DisplayCellProps<TType = unknown> = CellContext<TType, unknown> & {
|
5
|
+
highlighted?: boolean;
|
6
|
+
highlightedAsCurrent?: boolean;
|
5
7
|
children?: string | JSX.Element;
|
6
8
|
className?: string;
|
9
|
+
value?: any;
|
7
10
|
};
|
8
11
|
export declare function DisplayCell<TType = unknown>(props: DisplayCellProps<TType>): JSX.Element;
|
9
12
|
export declare type MemoedDisplayCellProps<TType = unknown> = {
|
@@ -14,8 +17,8 @@ export declare type MemoedDisplayCellProps<TType = unknown> = {
|
|
14
17
|
debug?: boolean;
|
15
18
|
enableTruncate?: boolean;
|
16
19
|
frozenColumnIndex?: number;
|
17
|
-
highlighted
|
18
|
-
highlightedAsCurrent
|
20
|
+
highlighted?: boolean;
|
21
|
+
highlightedAsCurrent?: boolean;
|
19
22
|
id: string;
|
20
23
|
index: number;
|
21
24
|
tableRef: React.RefObject<HTMLDivElement>;
|
@@ -1,10 +1,13 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { TableMeta, CellContext } from '@tanstack/react-table';
|
3
3
|
export declare type EditingCellProps<TType = unknown> = CellContext<TType, unknown> & {
|
4
|
+
highlighted?: boolean;
|
5
|
+
highlightedAsCurrent?: boolean;
|
4
6
|
children?: string | JSX.Element;
|
5
7
|
};
|
6
8
|
export declare function EditingCell<TType = unknown>(props: EditingCellProps<TType>): JSX.Element;
|
7
9
|
export declare type MemoedEditingCellProps<TType = unknown> = EditingCellProps<TType> & {
|
8
10
|
isHovered: boolean;
|
9
11
|
tableMeta: TableMeta<TType>;
|
12
|
+
error?: string;
|
10
13
|
};
|
@@ -5,4 +5,4 @@ export declare type EditingActionsProps<TType = unknown> = CellContext<TType, un
|
|
5
5
|
};
|
6
6
|
export declare const COLUMN_ID = "__editing_actions";
|
7
7
|
export declare const EDITING_ACTIONS_WIDTH = 60;
|
8
|
-
export declare function createRowEditingActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown>;
|
8
|
+
export declare function createRowEditingActionsColumn<TType = unknown>(rowIdentifier?: string): DisplayColumnDef<TType, unknown>;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Row as RTRow, Table as RTable } from '@tanstack/react-table';
|
3
3
|
import { Table3RowClickHandler, Table3RowDropHandler } from '../../types';
|
4
|
+
import { LastCellIndex } from '../../util/editing';
|
4
5
|
declare type RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {
|
5
6
|
index: number;
|
6
7
|
isLastRow: boolean;
|
@@ -12,6 +13,7 @@ declare type RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElemen
|
|
12
13
|
tableRef: React.RefObject<HTMLDivElement>;
|
13
14
|
};
|
14
15
|
export declare function Row<TType = unknown>(props: RowProps<TType>): JSX.Element;
|
16
|
+
export declare const lastCellIndex: LastCellIndex;
|
15
17
|
export declare type MemoedRowProps<TType = unknown> = RowProps<TType> & {
|
16
18
|
'aria-grabbed'?: boolean;
|
17
19
|
'data-current': boolean;
|
@@ -3,6 +3,7 @@ declare type RowContextValue = {
|
|
3
3
|
isHovered: boolean;
|
4
4
|
setIsHovered: (value: boolean) => void;
|
5
5
|
rowIndex: number;
|
6
|
+
hasError: boolean;
|
6
7
|
};
|
7
8
|
export declare const RowContext: React.Context<RowContextValue>;
|
8
9
|
export declare const useRowContext: () => RowContextValue;
|
@@ -1,30 +1,31 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Cell as RTCell } from '@tanstack/react-table';
|
3
|
+
import { Table3SaveHandler } from '../../types';
|
3
4
|
import { IndicatorReason } from '../../components/columns/cell/Indicator';
|
4
|
-
|
5
|
+
import { Table3Validation } from './useValidation';
|
6
|
+
export declare enum SavingStatusValue {
|
5
7
|
Saving = "saving",
|
6
8
|
Saved = "saved",
|
7
9
|
Error = "error"
|
8
10
|
}
|
9
|
-
export declare
|
10
|
-
state: SavingStateValue;
|
11
|
-
};
|
12
|
-
export declare function useEditing<TType = unknown>(isEnabled: boolean, onSave?: (row: TType) => void): {
|
11
|
+
export declare function useEditing<TType = unknown>(isEnabled: boolean, validation: Table3Validation<TType>, onSave?: Table3SaveHandler<TType>): {
|
13
12
|
isEnabled: boolean;
|
14
13
|
isEditing: boolean;
|
15
14
|
toggleEditing: React.Dispatch<React.SetStateAction<boolean>>;
|
16
|
-
changes:
|
15
|
+
changes: EditingState<TType>;
|
17
16
|
getCellValue: <T extends TType>(cell: RTCell<T, unknown>) => any;
|
18
17
|
setCellValue: <T_1 extends TType>(cell: RTCell<T_1, unknown>, value: unknown) => void;
|
19
18
|
saveChangesIfNeeded: () => Promise<void>;
|
20
19
|
detailModeEditing: boolean;
|
21
20
|
setDetailModeEditing: React.Dispatch<React.SetStateAction<boolean>>;
|
22
|
-
rowMoveReason: Record<string, IndicatorReason | null
|
23
|
-
setRowMoveReason: React.Dispatch<React.SetStateAction<Record<string, IndicatorReason | null
|
24
|
-
removeRowMoveReason: (
|
21
|
+
rowMoveReason: Record<string, IndicatorReason | null> | null;
|
22
|
+
setRowMoveReason: React.Dispatch<React.SetStateAction<Record<string, IndicatorReason | null> | null>>;
|
23
|
+
removeRowMoveReason: () => void;
|
25
24
|
handleKeyDown: (event: KeyboardEvent) => void;
|
26
25
|
handleBlur: (event: React.FocusEvent) => void;
|
27
26
|
resetChange: (rowId: string) => void;
|
28
|
-
|
29
|
-
|
27
|
+
getSavingStatus: (rowId: string) => SavingStatusValue | null;
|
28
|
+
resetSavingStatus: (rowId: string) => void;
|
30
29
|
};
|
30
|
+
declare type EditingState<TType = unknown> = Record<string, TType> | null;
|
31
|
+
export {};
|
@@ -13,4 +13,6 @@ export declare function useSearch(isEnabled: boolean, excludeUnmatchedResultsInS
|
|
13
13
|
currentHighlightColumnIndex: number | undefined;
|
14
14
|
setCurrentHighlightColumnIndex: React.Dispatch<React.SetStateAction<number | undefined>>;
|
15
15
|
loadAll: Table3LoadAllHandler | undefined;
|
16
|
+
isSearching: boolean;
|
17
|
+
setIsSearching: React.Dispatch<React.SetStateAction<boolean>>;
|
16
18
|
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Cell as RTCell } from '@tanstack/react-table';
|
2
|
+
import { RowErrors, Table3CellValidationHandler, Table3RowValidationHandler } from '../../types';
|
3
|
+
export declare type Table3Validation<TType = unknown> = {
|
4
|
+
validate: (rowId: string, row: TType, cellId?: string) => Promise<void | RowErrors>;
|
5
|
+
setCellError: (rowId: string, cellId: string, error: string) => void;
|
6
|
+
setRowErrors: (rowId: string, errors: Record<string, string>) => void;
|
7
|
+
confirmErrors: (rowId: string) => void;
|
8
|
+
getCellError: <T extends TType>(cell: RTCell<T, unknown>) => string | undefined;
|
9
|
+
resetErrors: (rowId: string, cellId?: string) => void;
|
10
|
+
errors: Record<string, RowErrors> | null;
|
11
|
+
draftErrors: Record<string, RowErrors> | null;
|
12
|
+
};
|
13
|
+
export declare function useValidation<TType = unknown>(onCellValidate?: Table3CellValidationHandler<TType>, onRowValidate?: Table3RowValidationHandler<TType>): Table3Validation<TType>;
|
@@ -16,6 +16,8 @@ import { usePrinting } from './features/usePrinting';
|
|
16
16
|
import { useRowGoto } from './features/useRowGoto';
|
17
17
|
import { useSearch } from './features/useSearch';
|
18
18
|
import { useRowActions } from './features/useRowActions';
|
19
|
+
import { Table3Validation } from './features/useValidation';
|
20
|
+
import { usePauseShortcuts } from './features/usePauseShortcuts';
|
19
21
|
declare module '@tanstack/table-core' {
|
20
22
|
interface TableMeta<TData extends RowData> {
|
21
23
|
columnFreezing: ReturnType<typeof useColumnFreezing>;
|
@@ -37,6 +39,8 @@ declare module '@tanstack/table-core' {
|
|
37
39
|
rowHeight: ReturnType<typeof useRowHeight>;
|
38
40
|
rowSelection: ReturnType<typeof useRowSelection>;
|
39
41
|
search: ReturnType<typeof useSearch>;
|
42
|
+
shortcutsState: ReturnType<typeof usePauseShortcuts>;
|
43
|
+
validation: Table3Validation<TData>;
|
40
44
|
}
|
41
45
|
interface ColumnMeta<TData extends RowData, TValue> {
|
42
46
|
align?: Table3ColumnAlignment;
|
@@ -17,7 +17,7 @@ export declare type Table3ColumnControlProps = {
|
|
17
17
|
onBlur?: (value: any) => void;
|
18
18
|
onFocus?: React.FocusEventHandler;
|
19
19
|
readOnly?: boolean;
|
20
|
-
ref: React.RefObject<HTMLElement
|
20
|
+
ref: React.RefObject<HTMLElement> | ((instance: HTMLElement | null | undefined) => void);
|
21
21
|
setValue: (value: any) => void;
|
22
22
|
value: any;
|
23
23
|
};
|
@@ -112,6 +112,9 @@ export declare type Table3LoadAllHandler = (sorting: Table3ColumnSort[], filters
|
|
112
112
|
export declare type Table3RowGotoHandler = (column: string, query: string, sorting: Table3ColumnSort[], filters: ColumnFilter[], search: string | undefined) => Promise<number>;
|
113
113
|
export declare type Table3ColumnSort = RTTableColumnSort;
|
114
114
|
export declare type Table3SortHandler = (sorting: Table3ColumnSort[]) => void;
|
115
|
+
export declare type RowErrors = Record<string, string>;
|
116
|
+
export declare type Table3CellValidationHandler<TType = unknown> = (cellValue: any, cellId: string, row: TType) => Promise<RowErrors | undefined | void>;
|
117
|
+
export declare type Table3RowValidationHandler<TType = unknown> = (row: TType) => Promise<RowErrors | undefined | void>;
|
115
118
|
export declare type TableStrategy = {
|
116
119
|
renderBody: () => JSX.Element | JSX.Element[] | null;
|
117
120
|
scrollToIndex: (index: number, options?: {
|
@@ -169,10 +172,13 @@ export declare type Table3CommonProps<TType = unknown> = Partial<Table3Options>
|
|
169
172
|
onFilter?: Table3FilterHandler;
|
170
173
|
onSave?: Table3SaveHandler<TType>;
|
171
174
|
onSort?: Table3SortHandler;
|
175
|
+
onCellValidate?: Table3CellValidationHandler<TType>;
|
176
|
+
onRowValidate?: Table3RowValidationHandler<TType>;
|
172
177
|
preset?: Table3Preset;
|
173
178
|
shortcuts?: Table3Shortcuts<TType>;
|
174
179
|
toolbarLeft?: JSX.Element;
|
175
180
|
toolbarRight?: JSX.Element;
|
181
|
+
rowIdentifier?: string;
|
176
182
|
};
|
177
183
|
interface Table3ClientProps<TType = unknown> extends Table3CommonProps<TType> {
|
178
184
|
length?: never;
|
@@ -262,6 +268,12 @@ export declare type Table3Texts = {
|
|
262
268
|
progress: string;
|
263
269
|
complete: string;
|
264
270
|
};
|
271
|
+
clearChangesConfirmationDialog: {
|
272
|
+
title: string;
|
273
|
+
description: string;
|
274
|
+
cancel: string;
|
275
|
+
confirm: string;
|
276
|
+
};
|
265
277
|
};
|
266
278
|
filters: {
|
267
279
|
button: string;
|
@@ -344,5 +356,18 @@ export declare type Table3Texts = {
|
|
344
356
|
otherOptions: {
|
345
357
|
tooltip: string;
|
346
358
|
};
|
359
|
+
validation: {
|
360
|
+
index: string;
|
361
|
+
alert: {
|
362
|
+
unsavedEntries: (count?: number) => string;
|
363
|
+
incompleteAndHavntBeenSaved: (count?: number) => string;
|
364
|
+
};
|
365
|
+
resetFiltersDialog: {
|
366
|
+
title: string;
|
367
|
+
description: string;
|
368
|
+
cancel: string;
|
369
|
+
confirm: string;
|
370
|
+
};
|
371
|
+
};
|
347
372
|
};
|
348
373
|
export {};
|
@@ -2,3 +2,9 @@ export declare const focussableNodeNames: string[];
|
|
2
2
|
export declare const focusableSelector: string;
|
3
3
|
export declare const hasChanged: (value: any, newValue: any) => boolean;
|
4
4
|
export declare const willRowMoveAfterSorting: (value: any, cell: any, rowIndex: any, rows: any, desc: any) => boolean;
|
5
|
+
export declare class LastCellIndex {
|
6
|
+
_value: string | null | undefined;
|
7
|
+
get value(): string | null | undefined;
|
8
|
+
set value(val: string | null | undefined);
|
9
|
+
}
|
10
|
+
export declare function getColumnIndex(element: Element): string | null | undefined;
|
package/dist/esm/index.css
CHANGED
@@ -705,94 +705,108 @@
|
|
705
705
|
}
|
706
706
|
|
707
707
|
/* normal rows */
|
708
|
-
[role='row']:not([data-selected='true']):not([data-
|
708
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true']) [role='cell'] {
|
709
709
|
@apply bg-white;
|
710
710
|
}
|
711
|
-
[role='row']:not([data-selected='true']):not([data-
|
711
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true']):hover [role='cell'] {
|
712
712
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
713
713
|
@apply bg-grey-100;
|
714
714
|
}
|
715
|
-
[role='row']:not([data-selected='true']):not([data-
|
715
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true'])[data-current='true'] [role='cell'] {
|
716
716
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
717
717
|
@apply bg-grey-100;
|
718
718
|
}
|
719
|
-
[role='row']:not([data-selected='true']):not([data-
|
719
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true'])[data-current='true']:hover [role='cell'] {
|
720
720
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
721
721
|
@apply bg-grey-100;
|
722
722
|
}
|
723
|
+
/* Fields shouldn’t have white background when not in current row and hovered*/
|
724
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true'])[data-current='false']:hover [role='cell'] .bg-white {
|
725
|
+
@apply !bg-grey-100;
|
726
|
+
}
|
723
727
|
/* normal rows when focus is inside the table */
|
724
728
|
[data-taco='table2']:focus-within
|
725
|
-
[role='row'][data-current='true']:not([data-selected='true']):not([data-
|
729
|
+
[role='row'][data-current='true']:not([data-selected='true']):not([data-invalid='true'])
|
726
730
|
[role='cell'] {
|
727
731
|
--table3-row-actions-shadow: theme(colors.grey.200);
|
728
732
|
@apply bg-grey-200;
|
729
733
|
}
|
730
734
|
/* normal rows when hover is paused */
|
731
|
-
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-
|
735
|
+
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-invalid='true']):hover:not([data-current='true']) [role='cell'] {
|
732
736
|
--table3-row-actions-shadow: theme(colors.white);
|
733
737
|
@apply !bg-white;
|
734
738
|
}
|
735
|
-
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-
|
739
|
+
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-invalid='true']):hover[data-current='true'] [role='cell'] {
|
736
740
|
--table3-row-actions-shadow: theme(colors.grey.200);
|
737
741
|
@apply !bg-grey-200;
|
738
742
|
}
|
739
743
|
|
740
744
|
/* selected rows */
|
741
|
-
[role='row'][data-selected='true']:not([data-
|
745
|
+
[role='row'][data-selected='true']:not([data-invalid='true']) [role='cell'] {
|
742
746
|
@apply bg-blue-100;
|
743
747
|
}
|
744
|
-
[role='row'][data-selected='true']:not([data-
|
748
|
+
[role='row'][data-selected='true']:not([data-invalid='true']):hover [role='cell'] {
|
745
749
|
--table3-row-actions-shadow: #d6e3f6;
|
746
750
|
@apply bg-[#D6E3F6];
|
747
751
|
}
|
748
|
-
[role='row'][data-selected='true']:not([data-
|
752
|
+
[role='row'][data-selected='true']:not([data-invalid='true'])[data-current='true']:hover [role='cell'],
|
749
753
|
|
750
|
-
[role='row'][data-selected='true']:not([data-
|
754
|
+
[role='row'][data-selected='true']:not([data-invalid='true'])[data-current='true'] [role='cell'] {
|
751
755
|
--table3-row-actions-shadow: #d6e3f6;
|
752
756
|
@apply bg-[#D6E3F6];
|
753
757
|
}
|
754
758
|
/* selected rows when focus is inside the table */
|
755
|
-
[data-taco='table2']:focus-within
|
759
|
+
[data-taco='table2']:focus-within
|
760
|
+
[role='row'][data-current='true'][data-selected='true']:not([data-invalid='true'])
|
761
|
+
[role='cell'] {
|
756
762
|
--table3-row-actions-shadow: #ccd8eb;
|
757
763
|
@apply bg-[#CCD8EB];
|
758
764
|
}
|
759
765
|
/* selected rows when hover is paused */
|
760
|
-
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-
|
766
|
+
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-invalid='true']):hover:not([data-current='true']) [role='cell'] {
|
761
767
|
--table3-row-actions-shadow: theme(colors.blue.100);
|
762
768
|
@apply !bg-blue-100;
|
763
769
|
}
|
764
|
-
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-
|
770
|
+
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-invalid='true']):hover[data-current='true'] [role='cell'] {
|
765
771
|
--table3-row-actions-shadow: #ccd8eb;
|
766
772
|
@apply !bg-[#CCD8EB];
|
767
773
|
}
|
768
774
|
|
769
775
|
/* error rows */
|
770
|
-
[role='row'][data-
|
776
|
+
[role='row'][data-invalid='true'] [role='cell'] {
|
771
777
|
@apply bg-[#FFEDE9];
|
772
778
|
}
|
773
|
-
[role='row'][data-
|
779
|
+
[role='row'][data-invalid='true']:hover [role='cell'] {
|
774
780
|
--table3-row-actions-shadow: #ffe4de;
|
775
781
|
@apply bg-[#FFE4DE];
|
776
782
|
}
|
777
|
-
[role='row'][data-
|
783
|
+
[role='row'][data-invalid='true'][data-current='true'] [role='cell'] {
|
778
784
|
--table3-row-actions-shadow: theme(colors.red.100);
|
779
785
|
@apply bg-red-100;
|
780
786
|
}
|
781
|
-
[role='row'][data-
|
787
|
+
[role='row'][data-invalid='true'][data-current='true']:hover [role='cell'] {
|
782
788
|
--table3-row-actions-shadow: #ffe4de;
|
783
789
|
@apply bg-[#FFE4DE];
|
784
790
|
}
|
791
|
+
/* Fields with errors shouldn’t have white background when not in current row */
|
792
|
+
[role='row'][data-invalid='true'][data-current='false'] [role='cell'] .bg-white {
|
793
|
+
@apply !bg-[#FFEDE9];
|
794
|
+
}
|
795
|
+
/* Request from UX: In error state, input backgroud color should be the same as row background color */
|
796
|
+
[role='row'][data-invalid='true'][data-current='false']:hover [role='cell'] .bg-white {
|
797
|
+
@apply !bg-[#FFE4DE];
|
798
|
+
}
|
785
799
|
/* error rows when focus is inside the table */
|
786
|
-
[data-taco='table2']:focus-within [role='row'][data-current='true'][data-
|
800
|
+
[data-taco='table2']:focus-within [role='row'][data-current='true'][data-invalid='true'] [role='cell'] {
|
787
801
|
--table3-row-actions-shadow: theme(colors.red.100);
|
788
802
|
@apply bg-red-100;
|
789
803
|
}
|
790
804
|
/* error rows when hover is paused */
|
791
|
-
[data-pause-hover='true'] [role='row'][data-
|
805
|
+
[data-pause-hover='true'] [role='row'][data-invalid='true']:hover:not([data-current='true']) [role='cell'] {
|
792
806
|
--table3-row-actions-shadow: #ffede9;
|
793
807
|
@apply !bg-[#FFEDE9];
|
794
808
|
}
|
795
|
-
[data-pause-hover='true'] [role='row'][data-
|
809
|
+
[data-pause-hover='true'] [role='row'][data-invalid='true']:hover[data-current='true'] [role='cell'] {
|
796
810
|
--table3-row-actions-shadow: theme(colors.red.100);
|
797
811
|
@apply !bg-red-100;
|
798
812
|
}
|
@@ -806,6 +820,12 @@
|
|
806
820
|
@apply !wcag-blue-500;
|
807
821
|
}
|
808
822
|
|
823
|
+
/* error row */
|
824
|
+
/*!!!!*/
|
825
|
+
[data-taco='table2-body'] [role='row'][data-invalid='true'] [role='cell'] {
|
826
|
+
/*@apply !bg-[#FFF5F2];*/
|
827
|
+
}
|
828
|
+
|
809
829
|
/* cell component overrides */
|
810
830
|
|
811
831
|
/* small font size */
|
@@ -824,7 +844,9 @@
|
|
824
844
|
}
|
825
845
|
|
826
846
|
[data-font-size='small'] [role='cell'] [data-taco='badge'],
|
827
|
-
[data-font-size='small'] [role='cell'] [data-taco='badge-icon']
|
847
|
+
[data-font-size='small'] [role='cell'] [data-taco='badge-icon'],
|
848
|
+
[data-font-size='small'] [role='cell'] [data-taco='icon'],
|
849
|
+
[data-font-size='small'] [role='cell'] [data-taco='spinner'] {
|
828
850
|
@apply !-my-0.5 !text-xs;
|
829
851
|
}
|
830
852
|
|
@@ -832,11 +854,21 @@
|
|
832
854
|
@apply !-my-1;
|
833
855
|
}
|
834
856
|
|
835
|
-
[data-font-size='small'] [role='cell'] [data-taco='
|
836
|
-
[data-font-size='small'] [role='cell'] [data-taco='
|
857
|
+
[data-font-size='small'] [role='cell'] [data-taco='Select2'],
|
858
|
+
[data-font-size='small'] [role='cell'] [data-taco='input-container'] {
|
837
859
|
@apply !-my-[3px];
|
838
860
|
}
|
839
861
|
|
862
|
+
/* from validation */
|
863
|
+
[data-font-size='small'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='Select2'],
|
864
|
+
[data-font-size='small'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='input-container'],
|
865
|
+
[data-font-size='small'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='Select2'],
|
866
|
+
[data-font-size='small'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='input-container'] {
|
867
|
+
@apply !-mt-1;
|
868
|
+
@apply !mb-0;
|
869
|
+
}
|
870
|
+
/*---*/
|
871
|
+
|
840
872
|
[data-font-size='small'] [role='cell'] [data-taco='input'],
|
841
873
|
[data-font-size='small'] [role='cell'] [data-taco='Select2'],
|
842
874
|
[data-font-size='small'] [role='cell'] [data-taco='textarea'] {
|
@@ -863,9 +895,18 @@
|
|
863
895
|
@apply !my-0;
|
864
896
|
}
|
865
897
|
|
866
|
-
|
867
|
-
|
868
|
-
|
898
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
899
|
+
|
900
|
+
[data-font-size='small'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
901
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_6px)];
|
902
|
+
}
|
903
|
+
|
904
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
905
|
+
because it should take all the available space in the cell */
|
906
|
+
|
907
|
+
[data-font-size='small'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
908
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_6px)];
|
909
|
+
}
|
869
910
|
|
870
911
|
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
|
871
912
|
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
@@ -893,9 +934,18 @@
|
|
893
934
|
@apply !-my-[5px];
|
894
935
|
}
|
895
936
|
|
896
|
-
|
897
|
-
|
898
|
-
|
937
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
938
|
+
|
939
|
+
[data-font-size='medium'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
940
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_8px)];
|
941
|
+
}
|
942
|
+
|
943
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
944
|
+
because it should take all the available space in the cell */
|
945
|
+
|
946
|
+
[data-font-size='medium'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
947
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_8px)];
|
948
|
+
}
|
899
949
|
|
900
950
|
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
|
901
951
|
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
@@ -904,6 +954,14 @@
|
|
904
954
|
@apply !mx-[calc(var(--table3-cell-padding-x)_-_3px)] !mt-px;
|
905
955
|
}
|
906
956
|
|
957
|
+
[data-font-size='medium'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='Select2'],
|
958
|
+
[data-font-size='medium'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='input-container'],
|
959
|
+
[data-font-size='medium'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='Select2'],
|
960
|
+
[data-font-size='medium'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='input-container'] {
|
961
|
+
@apply !-mt-1.5;
|
962
|
+
@apply !mb-0;
|
963
|
+
}
|
964
|
+
|
907
965
|
/* large font size */
|
908
966
|
[data-font-size='large'] [role='cell'] > [data-taco='button'],
|
909
967
|
[data-font-size='large'] [role='cell'] > [data-taco='icon-button'] {
|
@@ -923,6 +981,14 @@
|
|
923
981
|
@apply !-my-[7.5px];
|
924
982
|
}
|
925
983
|
|
984
|
+
[data-font-size='large'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='Select2'],
|
985
|
+
[data-font-size='large'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='input-container'],
|
986
|
+
[data-font-size='large'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='Select2'],
|
987
|
+
[data-font-size='large'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='input-container'] {
|
988
|
+
@apply !-mt-2;
|
989
|
+
@apply !mb-0;
|
990
|
+
}
|
991
|
+
|
926
992
|
[data-font-size='large'] [role='cell'] [data-taco='input'],
|
927
993
|
[data-font-size='large'] [role='cell'] [data-taco='Select2'],
|
928
994
|
[data-font-size='large'] [role='cell'] [data-taco='textarea'] {
|
@@ -937,9 +1003,18 @@
|
|
937
1003
|
@apply !h-6 !w-6;
|
938
1004
|
}
|
939
1005
|
|
940
|
-
|
941
|
-
|
942
|
-
|
1006
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
1007
|
+
|
1008
|
+
[data-font-size='large'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
1009
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_10px)];
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
1013
|
+
because it should take all the available space in the cell */
|
1014
|
+
|
1015
|
+
[data-font-size='large'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
1016
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_10px)];
|
1017
|
+
}
|
943
1018
|
|
944
1019
|
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
|
945
1020
|
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
@@ -6,11 +6,14 @@ import { Content, InnerContent, Title, Footer, Close, Actions } from './componen
|
|
6
6
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
7
7
|
import { Trigger } from './components/Trigger.js';
|
8
8
|
|
9
|
+
const DEFAULT_OUTLET_NAME = 'default';
|
9
10
|
const Outlet = /*#__PURE__*/forwardRef(function Outlet(props, ref) {
|
11
|
+
var _props$name;
|
10
12
|
const className = cn('h-full ml-auto overflow-hidden flex-shrink-0', props.className);
|
11
13
|
return /*#__PURE__*/createElement("div", Object.assign({}, props, {
|
12
14
|
className: className,
|
13
15
|
"data-taco": "drawer-outlet",
|
16
|
+
"data-taco-outlet-name": (_props$name = props.name) !== null && _props$name !== void 0 ? _props$name : DEFAULT_OUTLET_NAME,
|
14
17
|
ref: ref
|
15
18
|
}));
|
16
19
|
});
|
@@ -34,6 +37,7 @@ const Drawer = /*#__PURE__*/forwardRef(function Drawer(props, ref) {
|
|
34
37
|
children,
|
35
38
|
focusTrap = props.focusTrap === undefined && props.variant === 'overlay' ? true : props.focusTrap,
|
36
39
|
showCloseButton = true,
|
40
|
+
outletName,
|
37
41
|
...otherProps
|
38
42
|
} = props;
|
39
43
|
const [open, setOpen] = useControllableState({
|
@@ -63,9 +67,10 @@ const Drawer = /*#__PURE__*/forwardRef(function Drawer(props, ref) {
|
|
63
67
|
}, []);
|
64
68
|
useEffect(() => {
|
65
69
|
var _document$querySelect;
|
66
|
-
const
|
70
|
+
const outletSelector = `[data-taco="drawer-outlet"][data-taco-outlet-name="${outletName !== null && outletName !== void 0 ? outletName : DEFAULT_OUTLET_NAME}"]`;
|
71
|
+
const outletElement = (_document$querySelect = document.querySelector(outletSelector)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.body;
|
67
72
|
setOutlet(outletElement);
|
68
|
-
}, []);
|
73
|
+
}, [outletName]);
|
69
74
|
useEffect(() => {
|
70
75
|
if (open) {
|
71
76
|
// if drawerStack is defined, this means that another drawer was opened before
|