@sebgroup/green-core 3.17.0 → 3.17.1-rc.20260703085740229

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.
@@ -164,6 +164,7 @@ export declare class GdsTable<T extends Types.Row = Types.Row> extends GdsTable_
164
164
  private _onRowsChange;
165
165
  private _onColumnsChange;
166
166
  connectedCallback(): void;
167
+ private _handleLightDOMSlotsChange;
167
168
  updated(changedProperties: Map<string, unknown>): void;
168
169
  render(): any;
169
170
  /**
@@ -5,16 +5,19 @@ import {
5
5
  __privateMethod,
6
6
  __privateSet
7
7
  } from "../../chunks/chunk.CAV4X6PU.js";
8
- var _cache, _cacheDuration, _isResponsiveStacked, isResponsiveStacked_get, _isExpandableEnabled, isExpandableEnabled_get, _isSelectableEnabled, isSelectableEnabled_get, _Density, Density_get, _expandTransitionTimers, _expandedLoadingExitDuration, _hasSelection, hasSelection_get, _isAllSelected, isAllSelected_get, _isPartialSelection, isPartialSelection_get, _expandableIndices, expandableIndices_get, _isAllExpanded, isAllExpanded_get, _getCacheKey, getCacheKey_fn, _clearExpansionTransitionTimer, clearExpansionTransitionTimer_fn, _clearExpansionLoadingState, clearExpansionLoadingState_fn, _clearAllExpansionLoadingStates, clearAllExpansionLoadingStates_fn, _scheduleExpansionContentReveal, scheduleExpansionContentReveal_fn, _isCacheValid, isCacheValid_fn, _getControlledColumnSort, getControlledColumnSort_fn, _loadData, loadData_fn, _getStickyBorderKeys, getStickyBorderKeys_fn, _updateStickyOffsets, updateStickyOffsets_fn, _getRowKey, getRowKey_fn, _renderCellWrapped, renderCellWrapped_fn, _renderMobileLabel, renderMobileLabel_fn, _renderSlotElement, renderSlotElement_fn, _renderCellContent, renderCellContent_fn, _renderSortIcon, renderSortIcon_fn, _hasHeaderContent, hasHeaderContent_fn, _renderHeaderControls, renderHeaderControls_fn, _renderColumnHeader, renderColumnHeader_fn, _renderSelectableHeader, renderSelectableHeader_fn, _renderExpandableHeader, renderExpandableHeader_fn, _getRowSubRowsSource, getRowSubRowsSource_fn, _getRowFullContentSource, getRowFullContentSource_fn, _getExpandedRows, getExpandedRows_fn, _hasAsyncSubRows, hasAsyncSubRows_fn, _hasAsyncFullContent, hasAsyncFullContent_fn, _getSubRowCount, getSubRowCount_fn, _hasExpandedFullSlot, hasExpandedFullSlot_fn, _hasExpandedFullContent, hasExpandedFullContent_fn, _isRowExpandable, isRowExpandable_fn, _getExpandedGroupId, getExpandedGroupId_fn, _getRenderedColumnCount, getRenderedColumnCount_fn, _renderColumnHeaders, renderColumnHeaders_fn, _renderTableHeader, renderTableHeader_fn, _renderTableCell, renderTableCell_fn, _renderExpandableCell, renderExpandableCell_fn, _renderSelectableCell, renderSelectableCell_fn, _renderRowCells, renderRowCells_fn, _renderFullWidthDetailsRow, renderFullWidthDetailsRow_fn, _renderExpandedLoadingRow, renderExpandedLoadingRow_fn, _renderExpandedLoadingRows, renderExpandedLoadingRows_fn, _renderExpandedFullLoadingRow, renderExpandedFullLoadingRow_fn, _getExpandedChildRowClasses, getExpandedChildRowClasses_fn, _getTableRowClasses, getTableRowClasses_fn, _getRowAriaExpanded, getRowAriaExpanded_fn, _getTableRowPresentation, getTableRowPresentation_fn, _renderExpandedChildRow, renderExpandedChildRow_fn, _getRowExpansionLoadingKind, getRowExpansionLoadingKind_fn, _getRowExpansionState, getRowExpansionState_fn, _renderExpandedRowContent, renderExpandedRowContent_fn, _renderTableRow, renderTableRow_fn, _renderCheckbox, renderCheckbox_fn, _renderSkeletonCell, renderSkeletonCell_fn, _renderSkeletonRow, renderSkeletonRow_fn, _renderTableBody, renderTableBody_fn, _renderTableFoot, renderTableFoot_fn, _renderTable, renderTable_fn, _renderErrorState, renderErrorState_fn, _renderEmptyState, renderEmptyState_fn, _renderFooter, renderFooter_fn, _renderHeadline, renderHeadline_fn, _handleSearch, handleSearch_fn, _handleSearchClear, handleSearchClear_fn, _handleSort, handleSort_fn, _handlePageChange, handlePageChange_fn, _handlePageSizeChange, handlePageSizeChange_fn, _handleColumnVisibility, handleColumnVisibility_fn, _handleSelectAll, handleSelectAll_fn, _handleRowSelect, handleRowSelect_fn, _handleExpandToggle, handleExpandToggle_fn, _handleExpandAll, handleExpandAll_fn, _emitExpandChange, emitExpandChange_fn, _resolveExpandedContent, resolveExpandedContent_fn, _setRowExpanded, setRowExpanded_fn, _selectAllInternal, selectAllInternal_fn, _clearSelectionInternal, clearSelectionInternal_fn, _emitSelectionChange, emitSelectionChange_fn, _initializeScrollTracking, initializeScrollTracking_fn, _updateVerticalScrollState, updateVerticalScrollState_fn, _updateHorizontalScrollState, updateHorizontalScrollState_fn;
8
+ var _cache, _cacheDuration, _isResponsiveStacked, isResponsiveStacked_get, _isExpandableEnabled, isExpandableEnabled_get, _isSelectableEnabled, isSelectableEnabled_get, _Density, Density_get, _expandTransitionTimers, _expandedLoadingExitDuration, _expandedLoadingDelay, _expandedFullSlotKeys, _pendingExpandedFullSlotRefresh, _hasSelection, hasSelection_get, _isAllSelected, isAllSelected_get, _isPartialSelection, isPartialSelection_get, _expandableIndices, expandableIndices_get, _isAllExpanded, isAllExpanded_get, _getCacheKey, getCacheKey_fn, _clearExpansionTransitionTimer, clearExpansionTransitionTimer_fn, _clearExpansionLoadingState, clearExpansionLoadingState_fn, _clearAllExpansionLoadingStates, clearAllExpansionLoadingStates_fn, _scheduleExpansionContentReveal, scheduleExpansionContentReveal_fn, _isCacheValid, isCacheValid_fn, _getControlledColumnSort, getControlledColumnSort_fn, _loadData, loadData_fn, _queueExpandedFullSlotRefresh, queueExpandedFullSlotRefresh_fn, _getStickyBorderKeys, getStickyBorderKeys_fn, _updateStickyOffsets, updateStickyOffsets_fn, _getRowKey, getRowKey_fn, _renderCellWrapped, renderCellWrapped_fn, _renderMobileLabel, renderMobileLabel_fn, _renderSlotElement, renderSlotElement_fn, _renderCellContent, renderCellContent_fn, _renderSortIcon, renderSortIcon_fn, _hasHeaderContent, hasHeaderContent_fn, _renderHeaderControls, renderHeaderControls_fn, _renderColumnHeader, renderColumnHeader_fn, _renderSelectableHeader, renderSelectableHeader_fn, _renderExpandableHeader, renderExpandableHeader_fn, _getRowSubRowsSource, getRowSubRowsSource_fn, _getRowFullContentSource, getRowFullContentSource_fn, _getExpandedRows, getExpandedRows_fn, _hasAsyncSubRows, hasAsyncSubRows_fn, _hasAsyncFullContent, hasAsyncFullContent_fn, _getSubRowCount, getSubRowCount_fn, _hasExpandedFullSlot, hasExpandedFullSlot_fn, _hasExpandedFullContent, hasExpandedFullContent_fn, _refreshExpandedFullSlotKeys, refreshExpandedFullSlotKeys_fn, _isRowExpandable, isRowExpandable_fn, _getExpandedGroupId, getExpandedGroupId_fn, _getRenderedColumnCount, getRenderedColumnCount_fn, _renderColumnHeaders, renderColumnHeaders_fn, _renderTableHeader, renderTableHeader_fn, _renderTableCell, renderTableCell_fn, _renderExpandableCell, renderExpandableCell_fn, _renderSelectableCell, renderSelectableCell_fn, _renderRowCells, renderRowCells_fn, _renderFullWidthDetailsRow, renderFullWidthDetailsRow_fn, _renderExpandedLoadingRow, renderExpandedLoadingRow_fn, _renderExpandedLoadingRows, renderExpandedLoadingRows_fn, _renderExpandedFullLoadingRow, renderExpandedFullLoadingRow_fn, _getExpandedChildRowClasses, getExpandedChildRowClasses_fn, _getTableRowClasses, getTableRowClasses_fn, _getRowAriaExpanded, getRowAriaExpanded_fn, _getTableRowPresentation, getTableRowPresentation_fn, _renderExpandedChildRow, renderExpandedChildRow_fn, _getRowExpansionLoadingKind, getRowExpansionLoadingKind_fn, _getRowExpansionState, getRowExpansionState_fn, _renderExpandedRowContent, renderExpandedRowContent_fn, _renderTableRow, renderTableRow_fn, _renderCheckbox, renderCheckbox_fn, _renderSkeletonCell, renderSkeletonCell_fn, _renderSkeletonRow, renderSkeletonRow_fn, _renderTableBody, renderTableBody_fn, _renderTableFoot, renderTableFoot_fn, _renderTable, renderTable_fn, _renderErrorState, renderErrorState_fn, _renderEmptyState, renderEmptyState_fn, _renderFooter, renderFooter_fn, _renderHeadline, renderHeadline_fn, _handleSearch, handleSearch_fn, _handleSearchClear, handleSearchClear_fn, _handleSort, handleSort_fn, _handlePageChange, handlePageChange_fn, _handlePageSizeChange, handlePageSizeChange_fn, _handleColumnVisibility, handleColumnVisibility_fn, _handleSelectAll, handleSelectAll_fn, _handleRowSelect, handleRowSelect_fn, _handleExpandToggle, handleExpandToggle_fn, _handleExpandAll, handleExpandAll_fn, _emitExpandChange, emitExpandChange_fn, _resolveExpandedContent, resolveExpandedContent_fn, _setRowExpanded, setRowExpanded_fn, _selectAllInternal, selectAllInternal_fn, _clearSelectionInternal, clearSelectionInternal_fn, _emitSelectionChange, emitSelectionChange_fn, _initializeScrollTracking, initializeScrollTracking_fn, _updateVerticalScrollState, updateVerticalScrollState_fn, _updateHorizontalScrollState, updateHorizontalScrollState_fn;
9
9
  import { localized, msg } from "@lit/localize";
10
10
  import { property, state } from "lit/decorators.js";
11
11
  import { classMap } from "lit/directives/class-map.js";
12
+ import { guard } from "lit/directives/guard.js";
12
13
  import { ifDefined } from "lit/directives/if-defined.js";
14
+ import { repeat } from "lit/directives/repeat.js";
13
15
  import { styleMap } from "lit/directives/style-map.js";
14
16
  import { when } from "lit/directives/when.js";
15
17
  import { GdsElement } from "../../gds-element.js";
16
18
  import { watchMediaQuery } from "../../utils/decorators/index.js";
17
19
  import { ariaForwarding } from "../../utils/decorators/aria-forwarding.js";
20
+ import { observeLightDOM } from "../../utils/decorators/observe-light-dom.js";
18
21
  import { styleExpressionProperty } from "../../utils/decorators/style-expression-property.js";
19
22
  import { watch } from "../../utils/decorators/watch.js";
20
23
  import { forSpaceTokensAndCustomValues } from "../../utils/helpers/index.js";
@@ -55,6 +58,7 @@ let GdsTable = class extends withSizeXProps(
55
58
  __privateAdd(this, _isCacheValid);
56
59
  __privateAdd(this, _getControlledColumnSort);
57
60
  __privateAdd(this, _loadData);
61
+ __privateAdd(this, _queueExpandedFullSlotRefresh);
58
62
  /**
59
63
  * Returns the column keys for the rightmost sticky-left and leftmost sticky-right
60
64
  * visible columns — these are the ones that get the divider border.
@@ -99,6 +103,7 @@ let GdsTable = class extends withSizeXProps(
99
103
  __privateAdd(this, _getSubRowCount);
100
104
  __privateAdd(this, _hasExpandedFullSlot);
101
105
  __privateAdd(this, _hasExpandedFullContent);
106
+ __privateAdd(this, _refreshExpandedFullSlotKeys);
102
107
  __privateAdd(this, _isRowExpandable);
103
108
  __privateAdd(this, _getExpandedGroupId);
104
109
  __privateAdd(this, _getRenderedColumnCount);
@@ -241,6 +246,9 @@ let GdsTable = class extends withSizeXProps(
241
246
  this._error = null;
242
247
  __privateAdd(this, _expandTransitionTimers, /* @__PURE__ */ new Map());
243
248
  __privateAdd(this, _expandedLoadingExitDuration, 140);
249
+ __privateAdd(this, _expandedLoadingDelay, 100);
250
+ __privateAdd(this, _expandedFullSlotKeys, /* @__PURE__ */ new Set());
251
+ __privateAdd(this, _pendingExpandedFullSlotRefresh, false);
244
252
  }
245
253
  _handleMobile(matches) {
246
254
  this._isMobile = matches;
@@ -282,8 +290,12 @@ let GdsTable = class extends withSizeXProps(
282
290
  this.updateComplete.then(() => {
283
291
  __privateMethod(this, _initializeScrollTracking, initializeScrollTracking_fn).call(this);
284
292
  __privateMethod(this, _updateStickyOffsets, updateStickyOffsets_fn).call(this);
293
+ __privateMethod(this, _refreshExpandedFullSlotKeys, refreshExpandedFullSlotKeys_fn).call(this);
285
294
  });
286
295
  }
296
+ _handleLightDOMSlotsChange() {
297
+ __privateMethod(this, _queueExpandedFullSlotRefresh, queueExpandedFullSlotRefresh_fn).call(this);
298
+ }
287
299
  updated(changedProperties) {
288
300
  super.updated(changedProperties);
289
301
  __privateMethod(this, _updateStickyOffsets, updateStickyOffsets_fn).call(this);
@@ -399,6 +411,9 @@ Density_get = function() {
399
411
  };
400
412
  _expandTransitionTimers = new WeakMap();
401
413
  _expandedLoadingExitDuration = new WeakMap();
414
+ _expandedLoadingDelay = new WeakMap();
415
+ _expandedFullSlotKeys = new WeakMap();
416
+ _pendingExpandedFullSlotRefresh = new WeakMap();
402
417
  _hasSelection = new WeakSet();
403
418
  hasSelection_get = function() {
404
419
  return this._selected.size > 0;
@@ -565,6 +580,16 @@ loadData_fn = async function() {
565
580
  this._loading = false;
566
581
  }
567
582
  };
583
+ _queueExpandedFullSlotRefresh = new WeakSet();
584
+ queueExpandedFullSlotRefresh_fn = function() {
585
+ if (__privateGet(this, _pendingExpandedFullSlotRefresh))
586
+ return;
587
+ __privateSet(this, _pendingExpandedFullSlotRefresh, true);
588
+ queueMicrotask(() => {
589
+ __privateSet(this, _pendingExpandedFullSlotRefresh, false);
590
+ __privateMethod(this, _refreshExpandedFullSlotKeys, refreshExpandedFullSlotKeys_fn).call(this);
591
+ });
592
+ };
568
593
  _getStickyBorderKeys = new WeakSet();
569
594
  getStickyBorderKeys_fn = function() {
570
595
  const visible = this.columns.filter(
@@ -883,13 +908,35 @@ getSubRowCount_fn = function(row, index) {
883
908
  };
884
909
  _hasExpandedFullSlot = new WeakSet();
885
910
  hasExpandedFullSlot_fn = function(row, index) {
886
- const rowKey = __privateMethod(this, _getRowKey, getRowKey_fn).call(this, row, index);
887
- return Boolean(this.querySelector(`[slot="expand:${rowKey}:full"]`));
911
+ const rowKey = String(__privateMethod(this, _getRowKey, getRowKey_fn).call(this, row, index));
912
+ return __privateGet(this, _expandedFullSlotKeys).has(rowKey);
888
913
  };
889
914
  _hasExpandedFullContent = new WeakSet();
890
915
  hasExpandedFullContent_fn = function(row, index) {
891
916
  return __privateMethod(this, _hasExpandedFullSlot, hasExpandedFullSlot_fn).call(this, row, index);
892
917
  };
918
+ _refreshExpandedFullSlotKeys = new WeakSet();
919
+ refreshExpandedFullSlotKeys_fn = function() {
920
+ const keys = /* @__PURE__ */ new Set();
921
+ this.querySelectorAll(
922
+ '[slot^="expand:"][slot$=":full"]'
923
+ ).forEach((el) => {
924
+ const slotName = el.getAttribute("slot");
925
+ if (!slotName)
926
+ return;
927
+ if (!slotName.startsWith("expand:") || !slotName.endsWith(":full")) {
928
+ return;
929
+ }
930
+ const rowKey = slotName.slice("expand:".length, -":full".length);
931
+ if (rowKey)
932
+ keys.add(rowKey);
933
+ });
934
+ const hasChanged = keys.size !== __privateGet(this, _expandedFullSlotKeys).size || [...keys].some((key) => !__privateGet(this, _expandedFullSlotKeys).has(key));
935
+ if (!hasChanged)
936
+ return;
937
+ __privateSet(this, _expandedFullSlotKeys, keys);
938
+ this.requestUpdate();
939
+ };
893
940
  _isRowExpandable = new WeakSet();
894
941
  isRowExpandable_fn = function(row, index) {
895
942
  if (__privateGet(this, _isResponsiveStacked, isResponsiveStacked_get))
@@ -1311,7 +1358,22 @@ renderTableBody_fn = function() {
1311
1358
  }
1312
1359
  return html`
1313
1360
  <tbody aria-live="polite">
1314
- ${this._rowsState.map((row, index) => __privateMethod(this, _renderTableRow, renderTableRow_fn).call(this, row, index))}
1361
+ ${repeat(
1362
+ this._rowsState,
1363
+ (row, index) => __privateMethod(this, _getRowKey, getRowKey_fn).call(this, row, index),
1364
+ (row, index) => guard(
1365
+ [
1366
+ row,
1367
+ this._selected.has(index),
1368
+ this._expanded.has(index),
1369
+ this._expanding.has(index),
1370
+ this._completingExpansion.has(index),
1371
+ this._expandedRowsCache.get(index),
1372
+ this._expandedFullContentResolved.has(index)
1373
+ ],
1374
+ () => __privateMethod(this, _renderTableRow, renderTableRow_fn).call(this, row, index)
1375
+ )
1376
+ )}
1315
1377
  </tbody>
1316
1378
  `;
1317
1379
  };
@@ -1670,10 +1732,19 @@ resolveExpandedContent_fn = async function(row, index) {
1670
1732
  const fullPromise = hasFullContent ? fullContentSource() : void 0;
1671
1733
  const hasAsyncContent = Boolean(rowsPromise || fullPromise);
1672
1734
  let resolved = false;
1673
- const nextExpanding = new Set(this._expanding);
1674
- nextExpanding.add(index);
1675
- this._expanding = nextExpanding;
1676
- this.requestUpdate();
1735
+ let didShowLoading = false;
1736
+ let loadingTimer;
1737
+ if (hasAsyncContent) {
1738
+ loadingTimer = window.setTimeout(() => {
1739
+ if (!this._expanded.has(index))
1740
+ return;
1741
+ const nextExpanding = new Set(this._expanding);
1742
+ nextExpanding.add(index);
1743
+ this._expanding = nextExpanding;
1744
+ didShowLoading = true;
1745
+ this.requestUpdate();
1746
+ }, __privateGet(this, _expandedLoadingDelay));
1747
+ }
1677
1748
  try {
1678
1749
  if (rowsPromise) {
1679
1750
  const rows = await rowsPromise;
@@ -1696,7 +1767,10 @@ resolveExpandedContent_fn = async function(row, index) {
1696
1767
  this._expandedRowsCache = nextCache;
1697
1768
  }
1698
1769
  } finally {
1699
- if (hasAsyncContent && resolved) {
1770
+ if (loadingTimer !== void 0) {
1771
+ window.clearTimeout(loadingTimer);
1772
+ }
1773
+ if (hasAsyncContent && resolved && didShowLoading) {
1700
1774
  __privateMethod(this, _scheduleExpansionContentReveal, scheduleExpansionContentReveal_fn).call(this, index);
1701
1775
  } else {
1702
1776
  __privateMethod(this, _clearExpansionLoadingState, clearExpansionLoadingState_fn).call(this, index);
@@ -1940,6 +2014,14 @@ __decorateClass([
1940
2014
  __decorateClass([
1941
2015
  watch("columns")
1942
2016
  ], GdsTable.prototype, "_onColumnsChange", 1);
2017
+ __decorateClass([
2018
+ observeLightDOM({
2019
+ childList: true,
2020
+ attributes: true,
2021
+ attributeFilter: ["slot"],
2022
+ attributeOldValue: true
2023
+ })
2024
+ ], GdsTable.prototype, "_handleLightDOMSlotsChange", 1);
1943
2025
  GdsTable = __decorateClass([
1944
2026
  localized(),
1945
2027
  gdsCustomElement("gds-table", {
@@ -1,6 +1,5 @@
1
1
  import { GdsBadge, GdsButton, GdsContextMenu, GdsDivider, GdsDropdown, GdsFlex, GdsImg, GdsInput, GdsLink, GdsMenuItem, IconCrossSmall } from '../../pure';
2
2
  import { GdsPagination } from '../pagination/pagination.component';
3
3
  export { checkboxToggle as Checkbox } from '../../shared-styles/rbcb-toggle.template';
4
- export { accountsFormats as FormatAccount, dateTimeFormats as FormatDate, numberFormats as FormatNumber, } from '../formatted-text/formatters';
5
4
  export declare const Styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
6
5
  export declare const Dependencies: (typeof GdsMenuItem | typeof GdsButton | typeof IconCrossSmall | typeof GdsFlex | typeof GdsBadge | typeof GdsLink | typeof GdsContextMenu | typeof GdsDropdown | typeof GdsDivider | typeof GdsImg | typeof GdsPagination | typeof GdsInput)[];
@@ -30,11 +30,6 @@ import { tokens } from "../../tokens.style.js";
30
30
  import { GdsPagination } from "../pagination/pagination.component.js";
31
31
  import { TableStyles } from "./table.styles.js";
32
32
  import { checkboxToggle } from "../../shared-styles/rbcb-toggle.template.js";
33
- import {
34
- accountsFormats,
35
- dateTimeFormats,
36
- numberFormats
37
- } from "../formatted-text/formatters.js";
38
33
  const Styles = [tokens, checkboxStyles, TableStyles];
39
34
  const Dependencies = [
40
35
  GdsButton,
@@ -66,8 +61,5 @@ const Dependencies = [
66
61
  export {
67
62
  checkboxToggle as Checkbox,
68
63
  Dependencies,
69
- accountsFormats as FormatAccount,
70
- dateTimeFormats as FormatDate,
71
- numberFormats as FormatNumber,
72
64
  Styles
73
65
  };
@@ -40,3 +40,8 @@ export declare const ExpandableFinance: {
40
40
  SlotContent: (rows: any[]) => TemplateResult;
41
41
  TfootSlotContent: (rows: any[]) => TemplateResult;
42
42
  };
43
+ export declare const Performance: {
44
+ Columns: TableColumn[];
45
+ Data: (rowCount: number) => (request: TableRequest) => Promise<TableResponse<any>>;
46
+ SlotContent: (rows: any[]) => TemplateResult;
47
+ };