@stenajs-webui/grid 17.5.0 → 17.8.0

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/components/GridHooksTable.d.ts +26 -26
  3. package/dist/config/TableConfig.d.ts +11 -11
  4. package/dist/features/grid-cell/hooks/UseEditableCell.d.ts +59 -59
  5. package/dist/features/grid-cell/hooks/UseGridCell.d.ts +64 -64
  6. package/dist/features/grid-cell/hooks/UseGridNavigation.d.ts +82 -82
  7. package/dist/features/grid-cell/hooks/UseGridNavigationOptionsFromContext.d.ts +2 -2
  8. package/dist/features/grid-cell/hooks/UseRevertableValue.d.ts +9 -9
  9. package/dist/features/{standard-table/features/sorting/__tests__/MultitypeComparator.test.d.ts → grid-cell/hooks/__tests__/TextInput.test.d.ts} +1 -1
  10. package/dist/features/standard-table/components/ColGroups.d.ts +5 -5
  11. package/dist/features/standard-table/components/StandardTable.d.ts +82 -82
  12. package/dist/features/standard-table/components/StandardTableCell.d.ts +11 -11
  13. package/dist/features/standard-table/components/StandardTableCellUi.d.ts +17 -17
  14. package/dist/features/standard-table/components/StandardTableContent.d.ts +7 -7
  15. package/dist/features/standard-table/components/StandardTableHeadItem.d.ts +9 -9
  16. package/dist/features/standard-table/components/StandardTableHeadRow.d.ts +7 -7
  17. package/dist/features/standard-table/components/StandardTableRow.d.ts +12 -12
  18. package/dist/features/standard-table/components/StandardTableRowExpansion.d.ts +6 -6
  19. package/dist/features/standard-table/components/StandardTableRowList.d.ts +10 -10
  20. package/dist/features/standard-table/components/TextCell.d.ts +6 -6
  21. package/dist/features/standard-table/components/TrWithHoverBackground.d.ts +11 -11
  22. package/dist/features/standard-table/config/StandardTableColumnConfig.d.ts +154 -154
  23. package/dist/features/standard-table/config/StandardTableColumnGroupConfig.d.ts +11 -11
  24. package/dist/features/standard-table/config/StandardTableConfig.d.ts +152 -152
  25. package/dist/features/standard-table/config/StandardTableInfiniteConfig.d.ts +2 -2
  26. package/dist/features/standard-table/context/GroupConfigsAndIdsForRowsContext.d.ts +5 -5
  27. package/dist/features/standard-table/context/OnKeyDownContext.d.ts +4 -4
  28. package/dist/features/standard-table/context/StandardTableColumnOrderContext.d.ts +4 -4
  29. package/dist/features/standard-table/context/StandardTableStateContext.d.ts +21 -21
  30. package/dist/features/standard-table/context/StandardTableVariantContext.d.ts +4 -4
  31. package/dist/features/standard-table/context/StickyPropsPerColumnContext.d.ts +4 -4
  32. package/dist/features/standard-table/context/TotalNumColumnsContext.d.ts +3 -3
  33. package/dist/features/standard-table/features/checkboxes/StandardTableRowCheckbox.d.ts +13 -13
  34. package/dist/features/standard-table/features/checkboxes/UseRowCheckbox.d.ts +5 -5
  35. package/dist/features/standard-table/features/checkboxes/UseTableHeadCheckbox.d.ts +5 -5
  36. package/dist/features/standard-table/features/column-groups/ColumnGroupFactory.d.ts +7 -7
  37. package/dist/features/standard-table/features/column-groups/ColumnGroupRow.d.ts +6 -6
  38. package/dist/features/standard-table/features/column-groups/ColumnInGroup.d.ts +12 -12
  39. package/dist/features/standard-table/features/column-groups/StickyHeaderPropsFactory.d.ts +2 -2
  40. package/dist/features/standard-table/features/column-index-per-column-id/ColumnIndexCalculator.d.ts +7 -7
  41. package/dist/features/standard-table/features/column-index-per-column-id/ColumnIndexPerColumnIdContext.d.ts +4 -4
  42. package/dist/features/standard-table/features/expand-collapse/StandardTableRowExpandButton.d.ts +9 -9
  43. package/dist/features/standard-table/features/expand-collapse/UseExpandCollapseActions.d.ts +4 -4
  44. package/dist/features/standard-table/features/expand-collapse/UseTableHeadExpandCollapse.d.ts +4 -4
  45. package/dist/features/standard-table/features/sorting/MultitypeComparator.d.ts +3 -3
  46. package/dist/features/standard-table/features/sorting/UseTableSortHeader.d.ts +9 -9
  47. package/dist/features/standard-table/features/sticky-columns/StickyColumnGroupOffsetCalculator.d.ts +10 -10
  48. package/dist/features/standard-table/features/sticky-columns/StickyColumnGroupValidator.d.ts +4 -4
  49. package/dist/features/standard-table/features/sticky-columns/StickyPropsPerColumnCalculator.d.ts +5 -5
  50. package/dist/features/standard-table/features/sticky-columns/types.d.ts +11 -11
  51. package/dist/features/standard-table/features/summary-row/SummaryCellColSpanCalculator.d.ts +7 -7
  52. package/dist/features/standard-table/features/summary-row/SummaryRowVisibilityCalculator.d.ts +3 -3
  53. package/dist/features/standard-table/features/summary-row/components/StandardTableSummaryRow.d.ts +6 -6
  54. package/dist/features/standard-table/features/summary-row/components/SummaryCell.d.ts +10 -10
  55. package/dist/features/standard-table/features/summary-row/components/SummaryRowSwitcher.d.ts +6 -6
  56. package/dist/features/standard-table/helpers/cell-renderers/editable-text-cell/EditableTextCell.d.ts +2 -2
  57. package/dist/features/standard-table/helpers/cell-renderers/editable-text-cell/EditableTextCellWithStatus.d.ts +3 -3
  58. package/dist/features/standard-table/hooks/UseCellBackground.d.ts +3 -3
  59. package/dist/features/standard-table/hooks/UseColumnConfigById.d.ts +4 -4
  60. package/dist/features/standard-table/hooks/UseColumnValueResolver.d.ts +1 -1
  61. package/dist/features/standard-table/hooks/UseLocalStateTableContext.d.ts +5 -5
  62. package/dist/features/standard-table/hooks/UseStandardTableConfig.d.ts +7 -7
  63. package/dist/features/standard-table/redux/ReducerIdFactory.d.ts +3 -3
  64. package/dist/features/standard-table/redux/StandardTableActionsAndSelectors.d.ts +19 -19
  65. package/dist/features/standard-table/redux/StandardTableReducer.d.ts +15 -15
  66. package/dist/features/standard-table/stories/StandardTableStoryHelper.d.ts +18 -18
  67. package/dist/features/standard-table/types/StandardTableOnKeyDown.d.ts +3 -3
  68. package/dist/features/standard-table/util/ActionsFactory.d.ts +14 -14
  69. package/dist/features/standard-table/util/CellBorderCalculator.d.ts +2 -2
  70. package/dist/features/standard-table/util/ColumnCounter.d.ts +2 -2
  71. package/dist/features/standard-table/util/FilterItemsOnEnabledCheckboxes.d.ts +2 -2
  72. package/dist/features/standard-table/util/IdListPartial.d.ts +1 -1
  73. package/dist/features/standard-table/util/LabelFormatter.d.ts +2 -2
  74. package/dist/features/table-ui/components/CrudStatusIndicator.d.ts +8 -8
  75. package/dist/features/table-ui/components/ModifiedField.d.ts +11 -11
  76. package/dist/features/table-ui/components/cells/EditableTextCellWithCrudAndModified.d.ts +19 -19
  77. package/dist/features/table-ui/components/table/SmallTableCell.d.ts +6 -6
  78. package/dist/features/table-ui/components/table/SmallTableHead.d.ts +6 -6
  79. package/dist/features/table-ui/components/table/SortOrderIcon.d.ts +11 -11
  80. package/dist/features/table-ui/components/table/TableCell.d.ts +5 -5
  81. package/dist/features/table-ui/components/table/TableColumnGroupHead.d.ts +10 -10
  82. package/dist/features/table-ui/components/table/TableHeadItem.d.ts +16 -16
  83. package/dist/features/table-ui/components/table/TableHeadRow.d.ts +7 -7
  84. package/dist/features/table-ui/components/table/TableRow.d.ts +7 -7
  85. package/dist/features/table-ui/hooks/UseSortOrderColumnHead.d.ts +11 -11
  86. package/dist/index.d.ts +49 -49
  87. package/dist/index.es.js +2722 -2236
  88. package/dist/index.es.js.map +1 -1
  89. package/dist/index.js +9 -2348
  90. package/dist/index.js.map +1 -1
  91. package/dist/storybook-helpers/storybook-controls.d.ts +46 -46
  92. package/dist/util/DirectionCalculator.d.ts +8 -8
  93. package/dist/util/DomIdValidator.d.ts +1 -1
  94. package/dist/util/GridHookOptionsValidator.d.ts +3 -3
  95. package/dist/util/NumberBoundsWrapper.d.ts +3 -3
  96. package/dist/util/bounds/NumberBoundsWrapper.d.ts +9 -9
  97. package/package.json +12 -13
  98. package/dist/features/standard-table/features/sticky-columns/__tests__/StickyColumnGroupOffsetCalculator.test.d.ts +0 -1
  99. package/dist/features/standard-table/features/sticky-columns/__tests__/StickyColumnGroupValidator.test.d.ts +0 -1
  100. package/dist/features/standard-table/features/summary-row/__tests__/SummaryCellColSpanCalculator.test.d.ts +0 -1
  101. package/dist/features/standard-table/stories/ExpandableRows.stories.d.ts +0 -8
  102. package/dist/features/standard-table/stories/FewColumns.stories.d.ts +0 -8
  103. package/dist/features/standard-table/stories/Fields.stories.d.ts +0 -9
  104. package/dist/features/standard-table/stories/GroupedColumns.stories.d.ts +0 -8
  105. package/dist/features/standard-table/stories/Sorting.stories.d.ts +0 -8
  106. package/dist/features/standard-table/stories/StandardTable.stories.d.ts +0 -13
  107. package/dist/features/standard-table/stories/StandardTableHorror.stories.d.ts +0 -35
  108. package/dist/features/standard-table/stories/States.stories.d.ts +0 -10
  109. package/dist/features/standard-table/stories/Sticky.stories.d.ts +0 -11
  110. package/dist/features/standard-table/stories/Waitlist.stories.d.ts +0 -6
  111. package/dist/features/standard-table/util/__tests__/IdListPartial.test.d.ts +0 -1
  112. package/dist/features/table-ui/stories/TableUi.stories.d.ts +0 -7
  113. package/dist/util/bounds/__tests__/NumberBoundsWrapper.test.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ # v17.8.0 (Fri Jul 01 2022)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Replace useDomId with useId [#476](https://github.com/StenaIT/stenajs-webui/pull/476) ([@lindskogen](https://github.com/lindskogen))
6
+
7
+ #### Authors: 1
8
+
9
+ - Johan Lindskogen ([@lindskogen](https://github.com/lindskogen))
10
+
11
+ ---
12
+
13
+ # v17.7.0 (Fri Jul 01 2022)
14
+
15
+ #### 🚀 Enhancement
16
+
17
+ - Build packages with vite [#475](https://github.com/StenaIT/stenajs-webui/pull/475) ([@lindskogen](https://github.com/lindskogen))
18
+
19
+ #### Authors: 1
20
+
21
+ - Johan Lindskogen ([@lindskogen](https://github.com/lindskogen))
22
+
23
+ ---
24
+
25
+ # v17.6.0 (Fri Jul 01 2022)
26
+
27
+ #### 🚀 Enhancement
28
+
29
+ - Use Stena icons instead of Font Awesome icons [#471](https://github.com/StenaIT/stenajs-webui/pull/471) (david.zetterdahl@stenaline.com [@LordDz](https://github.com/LordDz) [@lindskogen](https://github.com/lindskogen))
30
+
31
+ #### Authors: 3
32
+
33
+ - David ([@LordDz](https://github.com/LordDz))
34
+ - David Zetterdahl (david.zetterdahl@stenaline.com)
35
+ - Johan Lindskogen ([@lindskogen](https://github.com/lindskogen))
36
+
37
+ ---
38
+
1
39
  # v17.1.2 (Mon Jun 27 2022)
2
40
 
3
41
  #### 🐛 Bug Fix
@@ -1,26 +1,26 @@
1
- import * as React from "react";
2
- import { ReactNode } from "react";
3
- interface GridHooksTableProps extends GridHooksContextValue {
4
- children?: ReactNode;
5
- }
6
- interface GridHooksContextValue {
7
- /**
8
- * Total number of rows in table. Must be set in cell hook or in GridHooksTable prop.
9
- */
10
- numRows?: number;
11
- /**
12
- * Total number of columns in table. Must be set in cell hook or in GridHooksTable prop.
13
- */
14
- numCols?: number;
15
- /**
16
- * An ID for the table, must be unique for every table in page. Must be set in cell hook or in GridHooksTable prop.
17
- */
18
- tableId?: string;
19
- /**
20
- * If true, navigation will wrap around the table. If false, navigation stops at table edge.
21
- */
22
- wrap?: boolean;
23
- }
24
- export declare const GridHooksContext: React.Context<GridHooksContextValue>;
25
- export declare const GridHooksTable: React.FC<GridHooksTableProps>;
26
- export {};
1
+ import * as React from "react";
2
+ import { ReactNode } from "react";
3
+ interface GridHooksTableProps extends GridHooksContextValue {
4
+ children?: ReactNode;
5
+ }
6
+ interface GridHooksContextValue {
7
+ /**
8
+ * Total number of rows in table. Must be set in cell hook or in GridHooksTable prop.
9
+ */
10
+ numRows?: number;
11
+ /**
12
+ * Total number of columns in table. Must be set in cell hook or in GridHooksTable prop.
13
+ */
14
+ numCols?: number;
15
+ /**
16
+ * An ID for the table, must be unique for every table in page. Must be set in cell hook or in GridHooksTable prop.
17
+ */
18
+ tableId?: string;
19
+ /**
20
+ * If true, navigation will wrap around the table. If false, navigation stops at table edge.
21
+ */
22
+ wrap?: boolean;
23
+ }
24
+ export declare const GridHooksContext: React.Context<GridHooksContextValue>;
25
+ export declare const GridHooksTable: React.FC<GridHooksTableProps>;
26
+ export {};
@@ -1,11 +1,11 @@
1
- export declare const tableBorderColor = "var(--lhds-color-ui-300)";
2
- export declare const tableBorderColorExpanded = "var(--lhds-color-blue-500)";
3
- export declare const tableBackgroundColorExpanded = "var(--lhds-color-blue-50)";
4
- export declare const tableBackgroundHoverColorExpanded = "var(--lhds-color-blue-100)";
5
- export declare const tableBorder: string;
6
- export declare const tableBorderHidden = "1px solid transparent";
7
- export declare const tableBorderLeft = "var(--swui-expand-highlight-border-width) solid transparent";
8
- export declare const tableBorderLeftExpanded: string;
9
- export declare const defaultTableRowHeight = "40px";
10
- export declare const defaultTableHeadRowHeight = "40px";
11
- export declare const smallTableRowWidth = "40px";
1
+ export declare const tableBorderColor = "var(--lhds-color-ui-300)";
2
+ export declare const tableBorderColorExpanded = "var(--lhds-color-blue-500)";
3
+ export declare const tableBackgroundColorExpanded = "var(--lhds-color-blue-50)";
4
+ export declare const tableBackgroundHoverColorExpanded = "var(--lhds-color-blue-100)";
5
+ export declare const tableBorder: string;
6
+ export declare const tableBorderHidden = "1px solid transparent";
7
+ export declare const tableBorderLeft = "var(--swui-expand-highlight-border-width) solid transparent";
8
+ export declare const tableBorderLeftExpanded: string;
9
+ export declare const defaultTableRowHeight = "40px";
10
+ export declare const defaultTableHeadRowHeight = "40px";
11
+ export declare const smallTableRowWidth = "40px";
@@ -1,59 +1,59 @@
1
- import * as React from "react";
2
- import { RevertableValue } from "./UseRevertableValue";
3
- export declare type AllowedInputType = "all" | "numeric" | "alphanumeric" | "letters" | "none";
4
- declare type OnStartEditingFunc = (keyEvent?: KeyDownEvent) => void;
5
- declare type TransformEnteredValueFunc<TValue> = (value?: string) => TValue;
6
- export interface UseEditableCellOptions<TValue> {
7
- /**
8
- * Specifies if cell is editable.
9
- */
10
- isEditable?: boolean;
11
- /**
12
- * Types of keyboard input that will start editing and pre-fill editor.
13
- */
14
- allowedInputType?: AllowedInputType;
15
- /**
16
- * Callback that is invoked when editing a cell is started.
17
- * @param keyEvent
18
- */
19
- onStartEditing?: OnStartEditingFunc;
20
- /**
21
- * Callback that is invoked when editing a cell stops.
22
- */
23
- onStopEditing?: () => void;
24
- /**
25
- * Callback that is invoked when editing a cell is finished with a value result.
26
- * @param value
27
- */
28
- onChange?: (value: TValue | undefined) => void;
29
- /**
30
- * Transform entered input to TValue.
31
- * @param value
32
- */
33
- transformEnteredValue?: TransformEnteredValueFunc<TValue>;
34
- }
35
- export interface UseEditableCellResult<TValue> {
36
- onKeyDown: React.KeyboardEventHandler;
37
- isEditing: boolean;
38
- startEditing: OnStartEditingFunc;
39
- stopEditing: () => void;
40
- stopEditingAndRevert: () => void;
41
- lastKeyEvent: KeyDownEvent | undefined;
42
- revertableValue: RevertableValue<TValue>;
43
- onDoubleClick: () => void;
44
- }
45
- export interface KeyDownEvent {
46
- altKey: boolean;
47
- charCode: number;
48
- ctrlKey: boolean;
49
- key: string;
50
- keyCode: number;
51
- locale: string;
52
- location: number;
53
- metaKey: boolean;
54
- repeat: boolean;
55
- shiftKey: boolean;
56
- which: number;
57
- }
58
- export declare const useEditableCell: <TValue>(value: TValue, { isEditable, allowedInputType, onChange, onStartEditing, onStopEditing, transformEnteredValue, }: UseEditableCellOptions<TValue>) => UseEditableCellResult<TValue>;
59
- export {};
1
+ import * as React from "react";
2
+ import { RevertableValue } from "./UseRevertableValue";
3
+ export declare type AllowedInputType = "all" | "numeric" | "alphanumeric" | "letters" | "none";
4
+ declare type OnStartEditingFunc = (keyEvent?: KeyDownEvent) => void;
5
+ declare type TransformEnteredValueFunc<TValue> = (value?: string) => TValue;
6
+ export interface UseEditableCellOptions<TValue> {
7
+ /**
8
+ * Specifies if cell is editable.
9
+ */
10
+ isEditable?: boolean;
11
+ /**
12
+ * Types of keyboard input that will start editing and pre-fill editor.
13
+ */
14
+ allowedInputType?: AllowedInputType;
15
+ /**
16
+ * Callback that is invoked when editing a cell is started.
17
+ * @param keyEvent
18
+ */
19
+ onStartEditing?: OnStartEditingFunc;
20
+ /**
21
+ * Callback that is invoked when editing a cell stops.
22
+ */
23
+ onStopEditing?: () => void;
24
+ /**
25
+ * Callback that is invoked when editing a cell is finished with a value result.
26
+ * @param value
27
+ */
28
+ onChange?: (value: TValue | undefined) => void;
29
+ /**
30
+ * Transform entered input to TValue.
31
+ * @param value
32
+ */
33
+ transformEnteredValue?: TransformEnteredValueFunc<TValue>;
34
+ }
35
+ export interface UseEditableCellResult<TValue> {
36
+ onKeyDown: React.KeyboardEventHandler;
37
+ isEditing: boolean;
38
+ startEditing: OnStartEditingFunc;
39
+ stopEditing: () => void;
40
+ stopEditingAndRevert: () => void;
41
+ lastKeyEvent: KeyDownEvent | undefined;
42
+ revertableValue: RevertableValue<TValue>;
43
+ onDoubleClick: () => void;
44
+ }
45
+ export interface KeyDownEvent {
46
+ altKey: boolean;
47
+ charCode: number;
48
+ ctrlKey: boolean;
49
+ key: string;
50
+ keyCode: number;
51
+ locale: string;
52
+ location: number;
53
+ metaKey: boolean;
54
+ repeat: boolean;
55
+ shiftKey: boolean;
56
+ which: number;
57
+ }
58
+ export declare const useEditableCell: <TValue>(value: TValue, { isEditable, allowedInputType, onChange, onStartEditing, onStopEditing, transformEnteredValue, }: UseEditableCellOptions<TValue>) => UseEditableCellResult<TValue>;
59
+ export {};
@@ -1,64 +1,64 @@
1
- import { KeyboardEventHandler } from "react";
2
- import { MoveDirection } from "../../../util/DirectionCalculator";
3
- import { KeyDownEvent, UseEditableCellOptions } from "./UseEditableCell";
4
- import { GridNavigationRequiredProps, UseGridNavigationOptions } from "./UseGridNavigation";
5
- export declare type UseGridCellOptions<TValue> = UseGridNavigationOptions & UseEditableCellOptions<TValue>;
6
- export interface UseGridCellResult<TValue> {
7
- /**
8
- * The current value in the editor. Pass this as value to form field components.
9
- */
10
- editorValue: TValue;
11
- /**
12
- * The setter for current value in the editor. Pass this as onChange to form field components.
13
- * @param editorValue
14
- */
15
- setEditorValue: (editorValue: TValue) => void;
16
- /**
17
- * Reverts the value of form field to the value before user started editing. This is invoked by stopEditingAndRevert.
18
- */
19
- revertEditorValue: () => void;
20
- /**
21
- * Props that must be passed to the cell DOM element which can be focused.
22
- */
23
- requiredProps: GridCellRequiredProps;
24
- /**
25
- * Moves focus to a new cell in the specified direction.
26
- * @param direction
27
- */
28
- move: (direction: MoveDirection) => void;
29
- /**
30
- * Opens the editor. invokes onStartEdit if provided.
31
- */
32
- startEditing: () => void;
33
- /**
34
- * Closes the editor and invokes onChange with the editor value entered by user.
35
- */
36
- stopEditing: () => void;
37
- /**
38
- * Closes the editor and reverts editor value to the previous value. Does not invoke onChange.
39
- */
40
- stopEditingAndRevert: () => void;
41
- /**
42
- * Closes the editor and moves focus to a new cell in the specified direction. Invokes onChange with editor value.
43
- * @param direction
44
- */
45
- stopEditingAndMove: (direction: MoveDirection) => void;
46
- /**
47
- * True if cell is currently in editing mode.
48
- */
49
- isEditing: boolean;
50
- /**
51
- * Contains last key event if editor was started by any key other than Enter.
52
- */
53
- lastKeyEvent: KeyDownEvent | undefined;
54
- }
55
- export interface GridCellRequiredProps extends Pick<GridNavigationRequiredProps, "tabIndex" | "id"> {
56
- onKeyDown: KeyboardEventHandler;
57
- onDoubleClick: () => void;
58
- }
59
- /**
60
- * Hook for cell in a grid. Combines navigation and editable cell.
61
- * @param value The value of the current cell.
62
- * @param options Options for hook.
63
- */
64
- export declare const useGridCell: <TValue>(value: TValue, options: UseGridCellOptions<TValue>) => UseGridCellResult<TValue>;
1
+ import { KeyboardEventHandler } from "react";
2
+ import { MoveDirection } from "../../../util/DirectionCalculator";
3
+ import { KeyDownEvent, UseEditableCellOptions } from "./UseEditableCell";
4
+ import { GridNavigationRequiredProps, UseGridNavigationOptions } from "./UseGridNavigation";
5
+ export declare type UseGridCellOptions<TValue> = UseGridNavigationOptions & UseEditableCellOptions<TValue>;
6
+ export interface UseGridCellResult<TValue> {
7
+ /**
8
+ * The current value in the editor. Pass this as value to form field components.
9
+ */
10
+ editorValue: TValue;
11
+ /**
12
+ * The setter for current value in the editor. Pass this as onChange to form field components.
13
+ * @param editorValue
14
+ */
15
+ setEditorValue: (editorValue: TValue) => void;
16
+ /**
17
+ * Reverts the value of form field to the value before user started editing. This is invoked by stopEditingAndRevert.
18
+ */
19
+ revertEditorValue: () => void;
20
+ /**
21
+ * Props that must be passed to the cell DOM element which can be focused.
22
+ */
23
+ requiredProps: GridCellRequiredProps;
24
+ /**
25
+ * Moves focus to a new cell in the specified direction.
26
+ * @param direction
27
+ */
28
+ move: (direction: MoveDirection) => void;
29
+ /**
30
+ * Opens the editor. invokes onStartEdit if provided.
31
+ */
32
+ startEditing: () => void;
33
+ /**
34
+ * Closes the editor and invokes onChange with the editor value entered by user.
35
+ */
36
+ stopEditing: () => void;
37
+ /**
38
+ * Closes the editor and reverts editor value to the previous value. Does not invoke onChange.
39
+ */
40
+ stopEditingAndRevert: () => void;
41
+ /**
42
+ * Closes the editor and moves focus to a new cell in the specified direction. Invokes onChange with editor value.
43
+ * @param direction
44
+ */
45
+ stopEditingAndMove: (direction: MoveDirection) => void;
46
+ /**
47
+ * True if cell is currently in editing mode.
48
+ */
49
+ isEditing: boolean;
50
+ /**
51
+ * Contains last key event if editor was started by any key other than Enter.
52
+ */
53
+ lastKeyEvent: KeyDownEvent | undefined;
54
+ }
55
+ export interface GridCellRequiredProps extends Pick<GridNavigationRequiredProps, "tabIndex" | "id"> {
56
+ onKeyDown: KeyboardEventHandler;
57
+ onDoubleClick: () => void;
58
+ }
59
+ /**
60
+ * Hook for cell in a grid. Combines navigation and editable cell.
61
+ * @param value The value of the current cell.
62
+ * @param options Options for hook.
63
+ */
64
+ export declare const useGridCell: <TValue>(value: TValue, options: UseGridCellOptions<TValue>) => UseGridCellResult<TValue>;
@@ -1,82 +1,82 @@
1
- import { KeyboardEvent } from "react";
2
- import { CellIndices, MoveDirection, TableEdgeMoveMode } from "../../../util/DirectionCalculator";
3
- export interface UseGridNavigationOptions {
4
- /**
5
- * The row index for current cell.
6
- */
7
- rowIndex: number;
8
- /**
9
- * The column index for current cell.
10
- */
11
- colIndex: number;
12
- /**
13
- * Total number of rows in table. Must be set in cell hook or in GridHooksTable prop.
14
- */
15
- numRows?: number;
16
- /**
17
- * Total number of columns in table. Must be set in cell hook or in GridHooksTable prop.
18
- */
19
- numCols?: number;
20
- /**
21
- * An ID for the table, must be unique for every table in page. Must be set in cell hook or in GridHooksTable prop.
22
- */
23
- tableId?: string;
24
- /**
25
- * Edge mode. Defines how to behave when user tries to navigate outside of the table.
26
- * Can be 'wrapped', 'clamped' or 'unlimited'.
27
- * wrapped = focuses on other side of table.
28
- * clamped = focus stays on same cell
29
- * unlimited = focus is not controlled, it will try to focus on next item.
30
- */
31
- edgeMode?: TableEdgeMoveMode;
32
- /**
33
- * Callback that is invoked when user navigates to new cell by keyboard.
34
- */
35
- onCellMove?: CellMoveHandler;
36
- /**
37
- * Callback that is invoked when user navigates but don't move to new cell by keyboard.
38
- */
39
- onCellNavigation?: CellNavigationHandler;
40
- }
41
- export interface ValidatedUseGridNavigationOptions {
42
- rowIndex: number;
43
- colIndex: number;
44
- numRows: number;
45
- numCols: number;
46
- tableId: string;
47
- edgeMode?: TableEdgeMoveMode;
48
- onCellMove?: CellMoveHandler;
49
- onCellNavigation?: CellNavigationHandler;
50
- }
51
- export interface UseGridNavigationResult {
52
- requiredProps: GridNavigationRequiredProps;
53
- moveHandler: MoveHandler;
54
- focusOnCell: FocusOnCellFunc;
55
- }
56
- /**
57
- * Props that must be passed to element with focus.
58
- */
59
- export interface GridNavigationRequiredProps {
60
- tabIndex: number;
61
- onKeyDown: (e: KeyboardEvent) => boolean;
62
- id: string;
63
- }
64
- export declare type CellMoveHandler = (event: OnCellMoveEvent) => void;
65
- export declare type CellNavigationHandler = (event: OnCellNavigationEvent) => void;
66
- export interface OnCellMoveEvent {
67
- direction: MoveDirection;
68
- fromRowIndex: number;
69
- fromColIndex: number;
70
- rowDidChange: boolean;
71
- colDidChange: boolean;
72
- rowIndex: number;
73
- colIndex: number;
74
- }
75
- export interface OnCellNavigationEvent extends OnCellMoveEvent {
76
- cellDidChange: boolean;
77
- }
78
- export declare const useGridNavigation: (options: UseGridNavigationOptions) => UseGridNavigationResult;
79
- declare type MoveHandler = (direction: MoveDirection) => void;
80
- declare type FocusOnCellFunc = (tableId: string, pos: CellIndices) => void;
81
- export declare const focusOnCell: FocusOnCellFunc;
82
- export {};
1
+ import { KeyboardEvent } from "react";
2
+ import { CellIndices, MoveDirection, TableEdgeMoveMode } from "../../../util/DirectionCalculator";
3
+ export interface UseGridNavigationOptions {
4
+ /**
5
+ * The row index for current cell.
6
+ */
7
+ rowIndex: number;
8
+ /**
9
+ * The column index for current cell.
10
+ */
11
+ colIndex: number;
12
+ /**
13
+ * Total number of rows in table. Must be set in cell hook or in GridHooksTable prop.
14
+ */
15
+ numRows?: number;
16
+ /**
17
+ * Total number of columns in table. Must be set in cell hook or in GridHooksTable prop.
18
+ */
19
+ numCols?: number;
20
+ /**
21
+ * An ID for the table, must be unique for every table in page. Must be set in cell hook or in GridHooksTable prop.
22
+ */
23
+ tableId?: string;
24
+ /**
25
+ * Edge mode. Defines how to behave when user tries to navigate outside of the table.
26
+ * Can be 'wrapped', 'clamped' or 'unlimited'.
27
+ * wrapped = focuses on other side of table.
28
+ * clamped = focus stays on same cell
29
+ * unlimited = focus is not controlled, it will try to focus on next item.
30
+ */
31
+ edgeMode?: TableEdgeMoveMode;
32
+ /**
33
+ * Callback that is invoked when user navigates to new cell by keyboard.
34
+ */
35
+ onCellMove?: CellMoveHandler;
36
+ /**
37
+ * Callback that is invoked when user navigates but don't move to new cell by keyboard.
38
+ */
39
+ onCellNavigation?: CellNavigationHandler;
40
+ }
41
+ export interface ValidatedUseGridNavigationOptions {
42
+ rowIndex: number;
43
+ colIndex: number;
44
+ numRows: number;
45
+ numCols: number;
46
+ tableId: string;
47
+ edgeMode?: TableEdgeMoveMode;
48
+ onCellMove?: CellMoveHandler;
49
+ onCellNavigation?: CellNavigationHandler;
50
+ }
51
+ export interface UseGridNavigationResult {
52
+ requiredProps: GridNavigationRequiredProps;
53
+ moveHandler: MoveHandler;
54
+ focusOnCell: FocusOnCellFunc;
55
+ }
56
+ /**
57
+ * Props that must be passed to element with focus.
58
+ */
59
+ export interface GridNavigationRequiredProps {
60
+ tabIndex: number;
61
+ onKeyDown: (e: KeyboardEvent) => boolean;
62
+ id: string;
63
+ }
64
+ export declare type CellMoveHandler = (event: OnCellMoveEvent) => void;
65
+ export declare type CellNavigationHandler = (event: OnCellNavigationEvent) => void;
66
+ export interface OnCellMoveEvent {
67
+ direction: MoveDirection;
68
+ fromRowIndex: number;
69
+ fromColIndex: number;
70
+ rowDidChange: boolean;
71
+ colDidChange: boolean;
72
+ rowIndex: number;
73
+ colIndex: number;
74
+ }
75
+ export interface OnCellNavigationEvent extends OnCellMoveEvent {
76
+ cellDidChange: boolean;
77
+ }
78
+ export declare const useGridNavigation: (options: UseGridNavigationOptions) => UseGridNavigationResult;
79
+ declare type MoveHandler = (direction: MoveDirection) => void;
80
+ declare type FocusOnCellFunc = (tableId: string, pos: CellIndices) => void;
81
+ export declare const focusOnCell: FocusOnCellFunc;
82
+ export {};
@@ -1,2 +1,2 @@
1
- import { UseGridNavigationOptions, ValidatedUseGridNavigationOptions } from "./UseGridNavigation";
2
- export declare const useGridNavigationOptionsFromContext: (options: UseGridNavigationOptions) => ValidatedUseGridNavigationOptions;
1
+ import { UseGridNavigationOptions, ValidatedUseGridNavigationOptions } from "./UseGridNavigation";
2
+ export declare const useGridNavigationOptionsFromContext: (options: UseGridNavigationOptions) => ValidatedUseGridNavigationOptions;
@@ -1,9 +1,9 @@
1
- export interface RevertableValue<TValue> {
2
- value: TValue;
3
- setValue: (value: TValue) => void;
4
- setRevertValue: (revertValue: TValue) => void;
5
- revert: () => void;
6
- commit: () => void;
7
- getValue: () => TValue;
8
- }
9
- export declare const useRevertableValue: <TValue>(initialValue: TValue) => RevertableValue<TValue>;
1
+ export interface RevertableValue<TValue> {
2
+ value: TValue;
3
+ setValue: (value: TValue) => void;
4
+ setRevertValue: (revertValue: TValue) => void;
5
+ revert: () => void;
6
+ commit: () => void;
7
+ getValue: () => TValue;
8
+ }
9
+ export declare const useRevertableValue: <TValue>(initialValue: TValue) => RevertableValue<TValue>;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- interface ColsProps {
3
- }
4
- export declare const ColGroups: React.FC<ColsProps>;
5
- export {};
1
+ import * as React from "react";
2
+ interface ColsProps {
3
+ }
4
+ export declare const ColGroups: React.FC<ColsProps>;
5
+ export {};