dap-design-system 0.61.10 → 0.62.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.
@@ -33,6 +33,7 @@ type LoadingType = 'spinner' | 'skeleton';
33
33
  * @event {{ selection: RowSelectionState }} dds-selection-change - Fired when the selection of the table changes.
34
34
  * @event {{ pagination: PaginationState }} dds-pagination-change - Fired when the pagination of the table changes.
35
35
  * @event {{ row: Row<T> }} dds-row-click - Fired when a row is clicked.
36
+ * @event {{ columnSizing: Record<string, number> }} dds-column-sizing-change - Fired when the user resizes a column (at the end of a drag, on each resize-handle key press, and when a double-click resets the column).
36
37
  *
37
38
  * @slot loading - The loading content of the table.
38
39
  * @slot empty - The empty content of the table.
@@ -41,6 +42,7 @@ type LoadingType = 'spinner' | 'skeleton';
41
42
  * @csspart header - The header of the table.
42
43
  * @csspart header-row - The header row of the table.
43
44
  * @csspart header-cell - All cells of the header.
45
+ * @csspart resize-handle - The column resize handle at the right edge of a resizable header cell.
44
46
  * @csspart body - The body of the table.
45
47
  * @csspart empty - The empty content of the table.
46
48
  * @csspart loading - The loading content of the table.
@@ -77,6 +79,7 @@ type LoadingType = 'spinner' | 'skeleton';
77
79
  * @cssproperty --dds-datatable-max-height - Maximum height of the table. (default: none)
78
80
  * @cssproperty --dds-datatable-overflow-x - Horizontal overflow behavior. (default: auto)
79
81
  * @cssproperty --dds-datatable-overflow-y - Vertical overflow behavior. (default: auto)
82
+ * @cssproperty --dds-datatable-resize-handle-color - Color of the column resize indicator line on hover, focus and drag. (default: var(--dds-border-brand-base))
80
83
  */
81
84
  export default class DapDSDataTable<T> extends DdsElement {
82
85
  static tagName: string;
@@ -106,6 +109,11 @@ export default class DapDSDataTable<T> extends DdsElement {
106
109
  stickySelectionColumn: boolean;
107
110
  /** Enable sorting on the table */
108
111
  enableSorting: boolean;
112
+ /** Let the user resize columns by dragging (or arrow-keying) a handle at the
113
+ * right edge of each header cell. A column opts out with `enableResizing: false`
114
+ * in its definition; `minSize` / `maxSize` bound the width. Read the result from
115
+ * `dds-column-sizing-change` and pass it back through `columnSizing` to restore it. */
116
+ enableColumnResizing: boolean;
109
117
  /** Enable manual sorting on the table */
110
118
  manualSorting: boolean;
111
119
  /** Enables manual pagination. If this option is set to true, the table will not automatically paginate rows and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation. */
@@ -198,7 +206,8 @@ export default class DapDSDataTable<T> extends DdsElement {
198
206
  pagination: PaginationState;
199
207
  /** @ignore */
200
208
  private _pagination;
201
- /** Column sizing state of the table */
209
+ /** Column sizing state of the table: column id -> width in pixels. Overrides the
210
+ * column definition's `size`; columns missing from it keep their defined width. */
202
211
  columnSizing?: Record<string, number>;
203
212
  /** @ignore */
204
213
  private _columnSizing;
@@ -215,6 +224,7 @@ export default class DapDSDataTable<T> extends DdsElement {
215
224
  /** @ignore */
216
225
  debug: boolean;
217
226
  protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
227
+ protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
218
228
  protected updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
219
229
  /**
220
230
  * Cleanup resize observer
@@ -224,6 +234,16 @@ export default class DapDSDataTable<T> extends DdsElement {
224
234
  private computeStickyOffsets;
225
235
  private getStickyStyle;
226
236
  private renderHeaderCell;
237
+ private getHeaderCellId;
238
+ private getCanResize;
239
+ private getResizeBounds;
240
+ private getStartWidth;
241
+ private setColumnWidth;
242
+ private emitColumnSizingChange;
243
+ private handleResizePointerDown;
244
+ private handleResizeKeydown;
245
+ private handleResizeReset;
246
+ private renderResizeHandle;
227
247
  private renderHeaderCellContent;
228
248
  private getHeaderCellStyle;
229
249
  private getSortIcon;