@ixfx/components 0.9.5 → 0.9.6

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.
@@ -102,6 +102,12 @@ type DataGridGroupChangeDetail = {
102
102
  readonly groupBy: DataGridGroupBy<unknown> | null;
103
103
  };
104
104
  type DataGridGroupChangeEvent = CustomEvent<DataGridGroupChangeDetail>;
105
+ type DataGridRowActivateDetail = {
106
+ readonly rowKey: string;
107
+ readonly row: unknown;
108
+ readonly rowIndex: number;
109
+ };
110
+ type DataGridRowActivateEvent = CustomEvent<DataGridRowActivateDetail>;
105
111
  interface DataGridElementEventMap {
106
112
  'datagrid-sort': DataGridSortEvent;
107
113
  'datagrid-select': DataGridSelectEvent;
@@ -111,6 +117,7 @@ interface DataGridElementEventMap {
111
117
  'datagrid-cell-click': DataGridCellClickEvent;
112
118
  'datagrid-cell-edit': DataGridCellEditEvent;
113
119
  'datagrid-group-change': DataGridGroupChangeEvent;
120
+ 'datagrid-row-activate': DataGridRowActivateEvent;
114
121
  'list-native-drag-start': ListNativeDragStartEvent<unknown>;
115
122
  }
116
123
  declare class DataGridElement extends LitElement {
@@ -246,6 +253,7 @@ declare class DataGridElement extends LitElement {
246
253
  private _isEditable;
247
254
  private _isTextEditor;
248
255
  private _isCellEditing;
256
+ private _activateRow;
249
257
  private _startEdit;
250
258
  /** Programmatic: put a single cell in edit mode. Works in manual/user/immediate (no-op if disabled or not editable). */
251
259
  startEdit(rowKey: string, colKey: string): void;
@@ -267,6 +275,8 @@ declare class DataGridElement extends LitElement {
267
275
  startCol: number;
268
276
  endCol: number;
269
277
  };
278
+ /** Row keys currently within the windowed/visible range, in display order. */
279
+ renderedKeys(): string[];
270
280
  private _findFirstVisibleCol;
271
281
  private _findLastVisibleCol;
272
282
  protected render(): import("lit").TemplateResult<1>;
@@ -281,5 +291,5 @@ interface DataGridElement {
281
291
  removeEventListener: (<K extends keyof DataGridElementEventMap>(type: K, listener: (this: DataGridElement, event: DataGridElementEventMap[K]) => void, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
282
292
  }
283
293
  //#endregion
284
- export { DataGridSortDetail as _, DataGridColumnReorderDetail as a, DataGridColumnResizeEvent as c, DataGridElement as d, DataGridElementEventMap as f, DataGridSelectEvent as g, DataGridSelectDetail as h, DataGridCellEditEvent as i, DataGridColumnVisibilityDetail as l, DataGridGroupChangeEvent as m, DataGridCellClickEvent as n, DataGridColumnReorderEvent as o, DataGridGroupChangeDetail as p, DataGridCellEditDetail as r, DataGridColumnResizeDetail as s, DataGridCellClickDetail as t, DataGridColumnVisibilityEvent as u, DataGridSortEvent as v };
285
- //# sourceMappingURL=data-grid-pp8WaKxG.d.ts.map
294
+ export { DataGridGroupBy as A, DataGridColumn as C, DataGridEditorFactory as D, DataGridEditorContext as E, DataGridSortState as F, GlobalFormatter as I, DataGridInteractionMode as M, DataGridSelectionMode as N, DataGridEditorType as O, DataGridSortDirection as P, BuiltInFormatterOptions as S, DataGridEditability as T, DataGridSelectDetail as _, DataGridColumnReorderDetail as a, DataGridSortEvent as b, DataGridColumnResizeEvent as c, DataGridElement as d, DataGridElementEventMap as f, DataGridRowActivateEvent as g, DataGridRowActivateDetail as h, DataGridCellEditEvent as i, DataGridGroupLabel as j, DataGridGetRowKey as k, DataGridColumnVisibilityDetail as l, DataGridGroupChangeEvent as m, DataGridCellClickEvent as n, DataGridColumnReorderEvent as o, DataGridGroupChangeDetail as p, DataGridCellEditDetail as r, DataGridColumnResizeDetail as s, DataGridCellClickDetail as t, DataGridColumnVisibilityEvent as u, DataGridSelectEvent as v, DataGridColumnMenu as w, BuiltInFormatterName as x, DataGridSortDetail as y };
295
+ //# sourceMappingURL=data-grid-DIHhfsqS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-grid-DIHhfsqS.d.ts","names":[],"sources":["../src/data-grid/types.ts","../src/data-grid/data-grid.ts"],"mappings":";;;;;;KA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OAAO,wBAAwB,aAAa,oBAAoB,mCAAmC,cAAc,UAAU,oCAAoC,oBAAoB"}
@@ -1,3 +1,3 @@
1
1
  import { F as ListDragSource, I as ListNativeDragStartDetail, L as ListNativeDragStartEvent, M as ListDragPreview, N as ListDragPreviewContext, P as ListDragPreviewRenderer, j as ListDragEntry } from "./tree-component-BW2iCFq9.js";
2
- import { _ as DataGridSortDetail, a as DataGridColumnReorderDetail, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridSelectEvent, h as DataGridSelectDetail, i as DataGridCellEditEvent, l as DataGridColumnVisibilityDetail, m as DataGridGroupChangeEvent, n as DataGridCellClickEvent, o as DataGridColumnReorderEvent, p as DataGridGroupChangeDetail, r as DataGridCellEditDetail, s as DataGridColumnResizeDetail, t as DataGridCellClickDetail, u as DataGridColumnVisibilityEvent, v as DataGridSortEvent } from "./data-grid-pp8WaKxG.js";
3
- export { DataGridCellClickDetail, DataGridCellClickEvent, DataGridCellEditDetail, DataGridCellEditEvent, DataGridColumnReorderDetail, DataGridColumnReorderEvent, DataGridColumnResizeDetail, DataGridColumnResizeEvent, DataGridColumnVisibilityDetail, DataGridColumnVisibilityEvent, DataGridElement, DataGridElementEventMap, DataGridGroupChangeDetail, DataGridGroupChangeEvent, DataGridSelectDetail, DataGridSelectEvent, DataGridSortDetail, DataGridSortEvent, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListNativeDragStartDetail, type ListNativeDragStartEvent };
2
+ import { A as DataGridGroupBy, C as DataGridColumn, D as DataGridEditorFactory, E as DataGridEditorContext, F as DataGridSortState, I as GlobalFormatter, M as DataGridInteractionMode, N as DataGridSelectionMode, O as DataGridEditorType, P as DataGridSortDirection, S as BuiltInFormatterOptions, T as DataGridEditability, _ as DataGridSelectDetail, a as DataGridColumnReorderDetail, b as DataGridSortEvent, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridRowActivateEvent, h as DataGridRowActivateDetail, i as DataGridCellEditEvent, j as DataGridGroupLabel, k as DataGridGetRowKey, l as DataGridColumnVisibilityDetail, m as DataGridGroupChangeEvent, n as DataGridCellClickEvent, o as DataGridColumnReorderEvent, p as DataGridGroupChangeDetail, r as DataGridCellEditDetail, s as DataGridColumnResizeDetail, t as DataGridCellClickDetail, u as DataGridColumnVisibilityEvent, v as DataGridSelectEvent, w as DataGridColumnMenu, x as BuiltInFormatterName, y as DataGridSortDetail } from "./data-grid-DIHhfsqS.js";
3
+ export { type BuiltInFormatterName, type BuiltInFormatterOptions, DataGridCellClickDetail, DataGridCellClickEvent, DataGridCellEditDetail, DataGridCellEditEvent, type DataGridColumn, type DataGridColumnMenu, DataGridColumnReorderDetail, DataGridColumnReorderEvent, DataGridColumnResizeDetail, DataGridColumnResizeEvent, DataGridColumnVisibilityDetail, DataGridColumnVisibilityEvent, type DataGridEditability, type DataGridEditorContext, type DataGridEditorFactory, type DataGridEditorType, DataGridElement, DataGridElementEventMap, type DataGridGetRowKey, type DataGridGroupBy, DataGridGroupChangeDetail, DataGridGroupChangeEvent, type DataGridGroupLabel, type DataGridInteractionMode, DataGridRowActivateDetail, DataGridRowActivateEvent, DataGridSelectDetail, DataGridSelectEvent, type DataGridSelectionMode, DataGridSortDetail, type DataGridSortDirection, DataGridSortEvent, type DataGridSortState, type GlobalFormatter, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListNativeDragStartDetail, type ListNativeDragStartEvent };
package/dist/data-grid.js CHANGED
@@ -225,6 +225,10 @@ let DataGridElement = class DataGridElement extends LitElement {
225
225
  }
226
226
  if (!this._editing) {
227
227
  const idx = this._sortedRows.findIndex((r, i) => this.getRowKey(r, i) === key);
228
+ if (this._selectedKeys.has(key)) {
229
+ this._activateRow(key, idx >= 0 ? this._sortedRows[idx] : void 0, idx);
230
+ break;
231
+ }
228
232
  if (this.interactionMode !== `manual` && this.interactionMode !== `checked`) this._replaceSelection(key);
229
233
  this.dispatchEvent(new CustomEvent(`datagrid-cell-click`, {
230
234
  detail: {
@@ -1059,6 +1063,17 @@ let DataGridElement = class DataGridElement extends LitElement {
1059
1063
  if (this._editingRow === rowKey) return this._isEditable(this._sortedRows.find((r, i) => this.getRowKey(r, i) === rowKey) ?? {}, this.columns.find((c) => c.key === colKey));
1060
1064
  return this._editing?.rowKey === rowKey && this._editing?.colKey === colKey;
1061
1065
  }
1066
+ _activateRow(rowKey, row, rowIndex) {
1067
+ this.dispatchEvent(new CustomEvent(`datagrid-row-activate`, {
1068
+ detail: {
1069
+ rowKey,
1070
+ row,
1071
+ rowIndex
1072
+ },
1073
+ bubbles: true,
1074
+ composed: true
1075
+ }));
1076
+ }
1062
1077
  _startEdit(rowKey, colKey) {
1063
1078
  if (this.editability === `disabled`) return;
1064
1079
  const row = this._sortedRows.find((r, i) => this.getRowKey(r, i) === rowKey);
@@ -1255,6 +1270,11 @@ let DataGridElement = class DataGridElement extends LitElement {
1255
1270
  endCol: this._findLastVisibleCol(this._scrollLeft + this._viewportW)
1256
1271
  };
1257
1272
  }
1273
+ /** Row keys currently within the windowed/visible range, in display order. */
1274
+ renderedKeys() {
1275
+ const { startRow, endRow } = this.getVisibleRange();
1276
+ return this._flat.slice(startRow, endRow).filter((f) => f.type === `row`).map((f) => f.key);
1277
+ }
1258
1278
  _findFirstVisibleCol(scrollLeft) {
1259
1279
  let lo = 0;
1260
1280
  let hi = this._colOffsets.length - 1;
@@ -1383,6 +1403,7 @@ let DataGridElement = class DataGridElement extends LitElement {
1383
1403
  @pointerleave=${() => this._tickled.clearTickled()}
1384
1404
  @dblclick=${() => {
1385
1405
  if (this._visibleColumns[0] && this._isEditable(row, this._visibleColumns[0])) this._startEdit(rowKey, this._visibleColumns[0].key);
1406
+ else this._activateRow(rowKey, row, absIdx2);
1386
1407
  }}>
1387
1408
  ${showCheckbox ? html`<div class="checkbox-col"><input type="checkbox" .checked=${selected} @click=${(e) => this._onCheckboxClick(rowKey, e)} /></div>` : nothing}
1388
1409
  ${repeat(this._visibleColumns, (c) => c.key, (col) => {