@drivenets/design-system 0.16.0 → 0.18.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.
- package/CHANGELOG.md +31 -0
- package/dist/index.cjs +1893 -824
- package/dist/index.d.cts +363 -247
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +363 -247
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1896 -829
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +25 -25
- package/src/components/ds-alert-banner/ds-alert-banner-global.figma.ts +49 -0
- package/src/components/ds-alert-banner/ds-alert-banner.figma.ts +51 -0
- package/src/components/ds-alert-banner/ds-alert-banner.tsx +7 -6
- package/src/components/ds-autocomplete/ds-autocomplete.figma.ts +2 -2
- package/src/components/ds-autocomplete/ds-autocomplete.module.scss +15 -4
- package/src/components/ds-autocomplete/ds-autocomplete.tsx +10 -3
- package/src/components/ds-autocomplete/ds-autocomplete.types.ts +8 -0
- package/src/components/ds-avatar/ds-avatar.figma.ts +2 -2
- package/src/components/ds-avatar-group/ds-avatar-group.figma.ts +2 -2
- package/src/components/ds-breadcrumb/ds-breadcrumb.figma.ts +2 -2
- package/src/components/ds-button-v3/ds-button-v3.figma.ts +7 -5
- package/src/components/ds-button-v3/ds-button-v3.module.scss +84 -17
- package/src/components/ds-button-v3/ds-button-v3.tsx +2 -0
- package/src/components/ds-button-v3/ds-button-v3.types.ts +11 -2
- package/src/components/ds-button-v3/ds-button-v4.figma.ts +121 -0
- package/src/components/ds-card/figma/ds-card-content.figma.ts +2 -2
- package/src/components/ds-card/figma/ds-card-footer.figma.ts +2 -2
- package/src/components/ds-card/figma/ds-card-header.figma.ts +2 -2
- package/src/components/ds-card/figma/ds-card.figma.ts +2 -2
- package/src/components/ds-catalog-layout/ds-catalog-layout.figma.ts +51 -0
- package/src/components/ds-catalog-layout/ds-catalog-layout.tsx +9 -8
- package/src/components/ds-checkbox/ds-checkbox-level-2.figma.ts +2 -2
- package/src/components/ds-checkbox/ds-checkbox.figma.ts +2 -2
- package/src/components/ds-checkbox-group/ds-checkbox-group.figma.ts +2 -2
- package/src/components/ds-comment-bubble/ds-comment-bubble.figma.ts +52 -0
- package/src/components/ds-comment-card/ds-comment-card.figma.ts +36 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.figma.ts +32 -0
- package/src/components/ds-comments-drawer/components/comments-filter-modal/index.ts +0 -1
- package/src/components/ds-comments-drawer/ds-comments-drawer.figma.ts +19 -0
- package/src/components/ds-confirmation/ds-confirmation.tsx +13 -11
- package/src/components/ds-date-picker/ds-date-picker.figma.ts +2 -2
- package/src/components/ds-divider/ds-divider.figma.ts +2 -2
- package/src/components/ds-drawer/ds-drawer.tsx +11 -10
- package/src/components/ds-drawer/figma/ds-drawer-content.figma.ts +2 -2
- package/src/components/ds-drawer/figma/ds-drawer-footer.figma.ts +2 -2
- package/src/components/ds-drawer/figma/ds-drawer-header.figma.ts +2 -2
- package/src/components/ds-drawer/figma/ds-drawer.figma.ts +2 -2
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-footer.figma.ts +2 -2
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-group.figma.ts +2 -2
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-item.figma.ts +2 -2
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-separator.figma.ts +2 -2
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu.figma.ts +2 -2
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.figma.ts +2 -2
- package/src/components/ds-file-upload/components/file-upload-item/index.ts +0 -1
- package/src/components/ds-file-upload/ds-file-upload.figma.ts +2 -2
- package/src/components/ds-filter-status-icon/ds-filter-status-icon.figma.ts +2 -2
- package/src/components/ds-form-control/ds-form-control.figma.ts +2 -2
- package/src/components/ds-form-control/ds-form-control.tsx +15 -13
- package/src/components/ds-icon/figma/ds-icon-material.figma.batch.ts +1 -1
- package/src/components/ds-icon/figma/ds-icon-special.figma.batch.ts +1 -1
- package/src/components/ds-key-value-pair/ds-key-value-pair.figma.ts +2 -2
- package/src/components/ds-loader/ds-loader.figma.ts +2 -2
- package/src/components/ds-modal/ds-modal.tsx +10 -9
- package/src/components/ds-modal/figma/ds-modal-content.figma.ts +2 -2
- package/src/components/ds-modal/figma/ds-modal-footer.figma.ts +2 -2
- package/src/components/ds-modal/figma/ds-modal-header.figma.ts +2 -2
- package/src/components/ds-modal/figma/ds-modal.figma.ts +2 -2
- package/src/components/ds-number-input/ds-number-input.tsx +1 -0
- package/src/components/ds-panel/ds-panel.figma.ts +2 -2
- package/src/components/ds-popover/figma/ds-popover-content-item.figma.ts +2 -2
- package/src/components/ds-popover/figma/ds-popover-content.figma.ts +2 -2
- package/src/components/ds-popover/figma/ds-popover-footer.figma.ts +2 -2
- package/src/components/ds-popover/figma/ds-popover-header.figma.ts +2 -2
- package/src/components/ds-popover/figma/ds-popover.figma.ts +2 -2
- package/src/components/ds-progress-arc/ds-progress-arc.figma.ts +2 -2
- package/src/components/ds-progress-donut/ds-progress-donut.figma.ts +2 -2
- package/src/components/ds-progress-linear/ds-progress-linear.figma.ts +2 -2
- package/src/components/ds-progress-task-bar/ds-progress-task-bar.figma.ts +2 -2
- package/src/components/ds-radio-group/figma/ds-radio-group-item.figma.ts +2 -2
- package/src/components/ds-radio-group/figma/ds-radio-group.figma.ts +2 -2
- package/src/components/ds-segment-group/figma/ds-segment-group-item.figma.ts +2 -2
- package/src/components/ds-segment-group/figma/ds-segment-group.figma.ts +2 -2
- package/src/components/ds-select/ds-select.figma.ts +4 -3
- package/src/components/ds-select/ds-select.tsx +6 -1
- package/src/components/ds-select/ds-select.types.ts +2 -1
- package/src/components/ds-site-node/ds-site-node.figma.ts +2 -2
- package/src/components/ds-slider/ds-slider.figma.ts +29 -0
- package/src/components/ds-slider/ds-slider.module.scss +104 -0
- package/src/components/ds-slider/ds-slider.tsx +118 -0
- package/src/components/ds-slider/ds-slider.types.ts +102 -0
- package/src/components/ds-slider/ds-slider.utils.ts +14 -0
- package/src/components/ds-slider/index.ts +11 -0
- package/src/components/ds-smart-tabs/ds-smart-tabs.tsx +5 -4
- package/src/components/ds-smart-tabs/figma/ds-smart-tabs-tab.figma.ts +83 -0
- package/src/components/ds-smart-tabs/figma/ds-smart-tabs.figma.ts +23 -0
- package/src/components/ds-spinner/ds-spinner.figma.ts +2 -2
- package/src/components/ds-split-button/ds-split-button.figma.ts +2 -2
- package/src/components/ds-status-badge-v2/ds-status-badge-v2.figma.ts +2 -2
- package/src/components/ds-stepper/ds-stepper.figma.ts +2 -2
- package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.module.scss +5 -1
- package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.tsx +15 -3
- package/src/components/ds-table/components/ds-table-group-header-cell/index.ts +0 -1
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +17 -3
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +30 -9
- package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.module.scss +23 -0
- package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.tsx +218 -0
- package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.types.ts +14 -0
- package/src/components/ds-table/components/ds-table-resize-handle/index.ts +1 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.module.scss +18 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.tsx +16 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.types.ts +13 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/index.ts +1 -0
- package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +1 -1
- package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +9 -2
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +2 -1
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +9 -2
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-checkbox.tsx +2 -2
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-date.tsx +2 -1
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-number.tsx +2 -1
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-select.tsx +2 -1
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-text.tsx +2 -1
- package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.tsx +12 -3
- package/src/components/ds-table/context/ds-table-context.tsx +208 -0
- package/src/components/ds-table/ds-table-defaults.ts +42 -0
- package/src/components/ds-table/ds-table.module.scss +19 -1
- package/src/components/ds-table/ds-table.tsx +163 -235
- package/src/components/ds-table/ds-table.types.ts +59 -47
- package/src/components/ds-table/figma/ds-table-expandable.figma.ts +2 -2
- package/src/components/ds-table/figma/ds-table.figma.ts +2 -2
- package/src/components/ds-table/grouping/utils/column-group.ts +7 -5
- package/src/components/ds-table/hooks/use-cell-editor.ts +5 -1
- package/src/components/ds-table/hooks/use-column-resize.ts +385 -0
- package/src/components/ds-table/hooks/use-editing-state.ts +190 -0
- package/src/components/ds-table/index.ts +1 -0
- package/src/components/ds-table/styles/_variables.scss +2 -1
- package/src/components/ds-table/utils/column-size-meta.augmentation.ts +16 -0
- package/src/components/ds-table/utils/column-size.ts +213 -10
- package/src/components/ds-table/utils/column-size.unit.test.ts +213 -0
- package/src/components/ds-table/utils/constants.ts +28 -0
- package/src/components/ds-table/utils/frozen-body.ts +33 -0
- package/src/components/ds-table/utils/frozen-body.unit.test.ts +44 -0
- package/src/components/ds-table/utils/table-api.ts +42 -0
- package/src/components/ds-table/utils/table-api.unit.test.ts +82 -0
- package/src/components/ds-table/utils/table-columns.tsx +119 -0
- package/src/components/ds-table/utils/table-columns.unit.test.ts +199 -0
- package/src/components/ds-tabs/figma/ds-tabs-tab-vertical.figma.ts +2 -2
- package/src/components/ds-tabs/figma/ds-tabs-tab.figma.ts +2 -2
- package/src/components/ds-tabs/figma/ds-tabs-vertical.figma.ts +2 -2
- package/src/components/ds-tabs/figma/ds-tabs.figma.ts +2 -2
- package/src/components/ds-tag/ds-tag.figma.ts +51 -0
- package/src/components/ds-tag-filter/ds-tag-filter.figma.ts +16 -0
- package/src/components/ds-text-input/ds-input-field-v02.figma.ts +31 -6
- package/src/components/ds-text-input/ds-text-input.figma.ts +5 -4
- package/src/components/ds-text-input/ds-text-input.tsx +1 -0
- package/src/components/ds-text-input/ds-text-input.types.ts +1 -1
- package/src/components/ds-time-picker/ds-time-picker.figma.ts +2 -2
- package/src/components/ds-toast/ds-toast.figma.ts +3 -3
- package/src/components/ds-toggle/ds-toggle.figma.ts +2 -2
- package/src/components/ds-tooltip/ds-tooltip.figma.ts +2 -2
- package/src/components/ds-tree/ds-tree.figma.ts +54 -0
- package/src/components/ds-tree/ds-tree.module.scss +2 -2
- package/src/components/ds-tree/ds-tree.tsx +6 -0
- package/src/components/ds-tree/ds-tree.types.ts +16 -0
- package/src/components/ds-typography/ds-typography.figma.ts +2 -2
- package/src/components/ds-user-card/ds-user-card.figma.ts +2 -2
- package/src/components/ds-vertical-tabs/ds-vertical-tabs.tsx +13 -6
- package/src/components/ds-workspace-layout/ds-workspace-layout.figma.ts +99 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.module.scss +1 -8
- package/src/components/ds-workspace-layout/ds-workspace-layout.tsx +11 -10
- package/src/index.ts +1 -0
- package/src/styles/_gradients.scss +19 -0
- package/src/styles/_root.scss +39 -15
- package/src/styles/_typography.scss +1 -0
- package/src/styles/shared/_input.scss +10 -0
- package/src/styles/styles.scss +1 -0
- package/src/components/ds-table/context/ds-table-context.ts +0 -112
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo, type ReactNode, type RefObject } from 'react';
|
|
2
|
+
import type { DsDataTableProps, DsTableRowSize } from '../ds-table.types';
|
|
3
|
+
import type { DsTablePropsWithDefaults } from '../ds-table-defaults';
|
|
4
|
+
import type { DsTableResizeContextSlice } from '../hooks/use-column-resize';
|
|
5
|
+
import { useEditingState, type UseEditingStateResult } from '../hooks/use-editing-state';
|
|
6
|
+
|
|
7
|
+
/** Visual phase of the full-height column-resize divider. */
|
|
8
|
+
export type DsTableResizePhase = 'hover' | 'dragging';
|
|
9
|
+
|
|
10
|
+
export interface DsTableContextType<TData, TValue>
|
|
11
|
+
extends Partial<DsDataTableProps<TData, TValue>>, UseEditingStateResult<TData, TValue> {
|
|
12
|
+
/**
|
|
13
|
+
* Whether the table is virtualized
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
virtualized?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Row size variant
|
|
19
|
+
* @default 'medium'
|
|
20
|
+
*/
|
|
21
|
+
rowSize: DsTableRowSize;
|
|
22
|
+
/**
|
|
23
|
+
* ID of the currently active row
|
|
24
|
+
*/
|
|
25
|
+
activeRowId?: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Toggles the collapsed state of a column group by its id.
|
|
28
|
+
*/
|
|
29
|
+
onToggleColumnGroup?: (groupId: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Ref to the scroll container, used to anchor the full-height resize drag
|
|
32
|
+
* indicator and to measure boundary offsets while resizing.
|
|
33
|
+
*/
|
|
34
|
+
resizeContainerRef?: RefObject<HTMLDivElement | null>;
|
|
35
|
+
/**
|
|
36
|
+
* True once every visible leaf has a `columnSizing` entry (snapshotted or
|
|
37
|
+
* user-resized), so cells should read widths from CSS variables.
|
|
38
|
+
*/
|
|
39
|
+
resizeSizingReady?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Reports hover on a resize handle. Pass the column id and boundary x-offset
|
|
42
|
+
* (relative to the scroll container), or `null` to clear.
|
|
43
|
+
*/
|
|
44
|
+
onResizeHover?: (columnId: string | null, offset: number | null) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Captures the cell right-edge offset at pointer-down so the overlay can
|
|
47
|
+
* follow `columnSizingInfo.deltaOffset` without extra context updates.
|
|
48
|
+
*/
|
|
49
|
+
onResizeDragStart?: (offset: number) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Restores snapshotted (or `columnDef.size`) widths for the given leaf ids.
|
|
52
|
+
*/
|
|
53
|
+
onResizeReset?: (columnIds: string[]) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Keyboard resize for a focused handle: signed px `delta` applied to the
|
|
56
|
+
* boundary header's column (leaf or group). Clamps and fires persist.
|
|
57
|
+
*/
|
|
58
|
+
onResizeKeyboardNudge?: (columnId: string, delta: number) => void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
const DsTableContext = createContext<DsTableContextType<any, any> | null>(null);
|
|
63
|
+
|
|
64
|
+
export const useDsTableContext = <TData, TValue>(): DsTableContextType<TData, TValue> => {
|
|
65
|
+
const context = useContext(DsTableContext);
|
|
66
|
+
if (!context) {
|
|
67
|
+
throw new Error('useDsTableContext must be used within DsTable');
|
|
68
|
+
}
|
|
69
|
+
return context as DsTableContextType<TData, TValue>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
interface DsTableContextProviderDerived {
|
|
73
|
+
grouping: {
|
|
74
|
+
collapsedColumnGroups: string[];
|
|
75
|
+
onToggleColumnGroup: (groupId: string) => void;
|
|
76
|
+
};
|
|
77
|
+
resize: DsTableResizeContextSlice;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface DsTableContextProviderProps<TData, TValue> {
|
|
81
|
+
tableProps: DsTablePropsWithDefaults<TData, TValue>;
|
|
82
|
+
derived: DsTableContextProviderDerived;
|
|
83
|
+
children: ReactNode;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Assembles {@link DsTableContext} from public table props plus derived grouping
|
|
88
|
+
* and resize slices. Owns inline-edit state. Picks context fields from
|
|
89
|
+
* `tableProps` and ignores the rest (`columns`, `data`, etc.).
|
|
90
|
+
*/
|
|
91
|
+
export const DsTableContextProvider = <TData, TValue>({
|
|
92
|
+
tableProps,
|
|
93
|
+
derived,
|
|
94
|
+
children,
|
|
95
|
+
}: DsTableContextProviderProps<TData, TValue>) => {
|
|
96
|
+
const {
|
|
97
|
+
stickyHeader,
|
|
98
|
+
bordered,
|
|
99
|
+
fullWidth,
|
|
100
|
+
rowSize,
|
|
101
|
+
expandable,
|
|
102
|
+
selectable,
|
|
103
|
+
reorderable,
|
|
104
|
+
showSelectAllCheckbox,
|
|
105
|
+
loading,
|
|
106
|
+
onRowClick,
|
|
107
|
+
onRowDoubleClick,
|
|
108
|
+
primaryRowActions,
|
|
109
|
+
secondaryRowActions,
|
|
110
|
+
renderExpandedRow,
|
|
111
|
+
virtualized,
|
|
112
|
+
activeRowId,
|
|
113
|
+
locale,
|
|
114
|
+
onCellEdit,
|
|
115
|
+
onCellValidate,
|
|
116
|
+
} = tableProps;
|
|
117
|
+
|
|
118
|
+
const { collapsedColumnGroups, onToggleColumnGroup } = derived.grouping;
|
|
119
|
+
const {
|
|
120
|
+
resizableColumns,
|
|
121
|
+
resizeSizingReady,
|
|
122
|
+
resizeContainerRef,
|
|
123
|
+
onResizeHover,
|
|
124
|
+
onResizeDragStart,
|
|
125
|
+
onResizeReset,
|
|
126
|
+
onResizeKeyboardNudge,
|
|
127
|
+
} = derived.resize;
|
|
128
|
+
|
|
129
|
+
const { editing, beginEdit, setDraft, commit, cancel } = useEditingState<TData, TValue>(
|
|
130
|
+
onCellEdit,
|
|
131
|
+
onCellValidate,
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const contextValue: DsTableContextType<TData, TValue> = useMemo(
|
|
135
|
+
() => ({
|
|
136
|
+
stickyHeader,
|
|
137
|
+
bordered,
|
|
138
|
+
fullWidth,
|
|
139
|
+
rowSize,
|
|
140
|
+
expandable,
|
|
141
|
+
selectable,
|
|
142
|
+
reorderable,
|
|
143
|
+
showSelectAllCheckbox,
|
|
144
|
+
loading,
|
|
145
|
+
onRowClick: loading ? undefined : onRowClick,
|
|
146
|
+
onRowDoubleClick: loading ? undefined : onRowDoubleClick,
|
|
147
|
+
primaryRowActions,
|
|
148
|
+
secondaryRowActions,
|
|
149
|
+
renderExpandedRow,
|
|
150
|
+
virtualized,
|
|
151
|
+
activeRowId,
|
|
152
|
+
collapsedColumnGroups,
|
|
153
|
+
onToggleColumnGroup,
|
|
154
|
+
locale,
|
|
155
|
+
onCellEdit,
|
|
156
|
+
resizableColumns,
|
|
157
|
+
resizeSizingReady,
|
|
158
|
+
resizeContainerRef,
|
|
159
|
+
onResizeHover,
|
|
160
|
+
onResizeDragStart,
|
|
161
|
+
onResizeReset,
|
|
162
|
+
onResizeKeyboardNudge,
|
|
163
|
+
editing,
|
|
164
|
+
beginEdit,
|
|
165
|
+
setDraft,
|
|
166
|
+
commit,
|
|
167
|
+
cancel,
|
|
168
|
+
}),
|
|
169
|
+
[
|
|
170
|
+
stickyHeader,
|
|
171
|
+
bordered,
|
|
172
|
+
fullWidth,
|
|
173
|
+
rowSize,
|
|
174
|
+
expandable,
|
|
175
|
+
selectable,
|
|
176
|
+
reorderable,
|
|
177
|
+
showSelectAllCheckbox,
|
|
178
|
+
loading,
|
|
179
|
+
onRowClick,
|
|
180
|
+
onRowDoubleClick,
|
|
181
|
+
primaryRowActions,
|
|
182
|
+
secondaryRowActions,
|
|
183
|
+
renderExpandedRow,
|
|
184
|
+
virtualized,
|
|
185
|
+
activeRowId,
|
|
186
|
+
collapsedColumnGroups,
|
|
187
|
+
onToggleColumnGroup,
|
|
188
|
+
locale,
|
|
189
|
+
onCellEdit,
|
|
190
|
+
resizableColumns,
|
|
191
|
+
resizeSizingReady,
|
|
192
|
+
resizeContainerRef,
|
|
193
|
+
onResizeHover,
|
|
194
|
+
onResizeDragStart,
|
|
195
|
+
onResizeReset,
|
|
196
|
+
onResizeKeyboardNudge,
|
|
197
|
+
editing,
|
|
198
|
+
beginEdit,
|
|
199
|
+
setDraft,
|
|
200
|
+
commit,
|
|
201
|
+
cancel,
|
|
202
|
+
],
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
return <DsTableContext.Provider value={contextValue}>{children}</DsTableContext.Provider>;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
DsTableContextProvider.displayName = 'DsTableContextProvider';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DsDataTableProps } from './ds-table.types';
|
|
2
|
+
|
|
3
|
+
type DefaultedDsTableProp =
|
|
4
|
+
| 'virtualized'
|
|
5
|
+
| 'stickyHeader'
|
|
6
|
+
| 'bordered'
|
|
7
|
+
| 'fullWidth'
|
|
8
|
+
| 'rowSize'
|
|
9
|
+
| 'loading'
|
|
10
|
+
| 'expandable'
|
|
11
|
+
| 'selectable'
|
|
12
|
+
| 'showSelectAllCheckbox'
|
|
13
|
+
| 'primaryRowActions'
|
|
14
|
+
| 'actions'
|
|
15
|
+
| 'reorderable'
|
|
16
|
+
| 'resizableColumns';
|
|
17
|
+
|
|
18
|
+
export type DsTablePropsWithDefaults<TData, TValue> = DsDataTableProps<TData, TValue> &
|
|
19
|
+
Required<Pick<DsDataTableProps<TData, TValue>, DefaultedDsTableProp>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Applies the documented `DsTable` prop defaults. Call once at the table
|
|
23
|
+
* boundary so orchestration and context see the same resolved values.
|
|
24
|
+
*/
|
|
25
|
+
export const applyDsTableDefaults = <TData, TValue>(
|
|
26
|
+
props: DsDataTableProps<TData, TValue>,
|
|
27
|
+
): DsTablePropsWithDefaults<TData, TValue> => ({
|
|
28
|
+
...props,
|
|
29
|
+
virtualized: props.virtualized ?? false,
|
|
30
|
+
stickyHeader: props.stickyHeader ?? true,
|
|
31
|
+
bordered: props.bordered ?? true,
|
|
32
|
+
fullWidth: props.fullWidth ?? true,
|
|
33
|
+
rowSize: props.rowSize ?? 'medium',
|
|
34
|
+
loading: props.loading ?? false,
|
|
35
|
+
expandable: props.expandable ?? false,
|
|
36
|
+
selectable: props.selectable ?? false,
|
|
37
|
+
showSelectAllCheckbox: props.showSelectAllCheckbox ?? true,
|
|
38
|
+
primaryRowActions: props.primaryRowActions ?? [],
|
|
39
|
+
actions: props.actions ?? [],
|
|
40
|
+
reorderable: props.reorderable ?? false,
|
|
41
|
+
resizableColumns: props.resizableColumns ?? false,
|
|
42
|
+
});
|
|
@@ -18,9 +18,26 @@ $bulk-actions-reserved-space: 80px;
|
|
|
18
18
|
border-style: solid;
|
|
19
19
|
border-color: var(--color-dap-gray-400);
|
|
20
20
|
background: var(--background);
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
height: 100%;
|
|
24
|
+
max-height: 100%;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.controls {
|
|
29
|
+
background: var(--background);
|
|
30
|
+
border-bottom: 1px solid var(--border);
|
|
31
|
+
padding: var(--xs) var(--standard);
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
flex-shrink: 0;
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
.dataTableContainer {
|
|
38
|
+
position: relative;
|
|
39
|
+
flex: 1;
|
|
40
|
+
min-height: 0;
|
|
24
41
|
max-height: 100%;
|
|
25
42
|
overflow-x: auto;
|
|
26
43
|
overflow-y: hidden;
|
|
@@ -50,6 +67,7 @@ $bulk-actions-reserved-space: 80px;
|
|
|
50
67
|
tbody {
|
|
51
68
|
display: block;
|
|
52
69
|
overflow-y: auto;
|
|
70
|
+
overflow-x: hidden;
|
|
53
71
|
flex: 1;
|
|
54
72
|
min-height: 0;
|
|
55
73
|
scrollbar-gutter: stable;
|
|
@@ -107,11 +125,11 @@ $bulk-actions-reserved-space: 80px;
|
|
|
107
125
|
|
|
108
126
|
.virtualizedContainer {
|
|
109
127
|
position: relative;
|
|
110
|
-
height: vars.$virtualized-height;
|
|
111
128
|
overflow-x: auto;
|
|
112
129
|
overflow-y: hidden;
|
|
113
130
|
display: flex;
|
|
114
131
|
flex-direction: column;
|
|
132
|
+
flex: 1;
|
|
115
133
|
|
|
116
134
|
@include scrollbars.scrollbar-on-hover;
|
|
117
135
|
|