udp-stencil-component-library 26.3.0-beta.20 → 26.3.0-beta.22

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.
@@ -1075,9 +1075,37 @@ class BulkActions {
1075
1075
  this.onRowSelectionChanged = () => {
1076
1076
  var _a;
1077
1077
  startGuardedTransition(() => {
1078
- const rows = this.api.getSelectedRows();
1079
- this.selectedRows = rows;
1080
- this.selectedRowCount = rows.length;
1078
+ var _a, _b, _c, _d;
1079
+ if (this.api.getGridOption('rowModelType') === 'serverSide') {
1080
+ // SSRM: selection is a rule, not a row list. Derive the count from the
1081
+ // rule. getSelectedRows() must NOT be called while select-all is active
1082
+ // (AG Grid warning #199), so only read concrete rows for explicit picks.
1083
+ const state = this.api.getServerSideSelectionState();
1084
+ const total = (_b = (_a = this.api.getGridOption('context')) === null || _a === void 0 ? void 0 : _a.rowCount) !== null && _b !== void 0 ? _b : 0;
1085
+ const toggledNodes = (_c = state === null || state === void 0 ? void 0 : state.toggledNodes) !== null && _c !== void 0 ? _c : [];
1086
+ const selectAll = (_d = state === null || state === void 0 ? void 0 : state.selectAll) !== null && _d !== void 0 ? _d : false;
1087
+ this.selectedRows = selectAll ? [] : this.api.getSelectedRows();
1088
+ this.selectedRowCount = selectAll
1089
+ ? Math.max(total - toggledNodes.length, 0)
1090
+ : toggledNodes.length;
1091
+ this.selectionState = {
1092
+ rowModelType: 'serverSide',
1093
+ selectAll,
1094
+ toggledNodes,
1095
+ selectedCount: this.selectedRowCount,
1096
+ };
1097
+ }
1098
+ else {
1099
+ const rows = this.api.getSelectedRows();
1100
+ this.selectedRows = rows;
1101
+ this.selectedRowCount = rows.length;
1102
+ this.selectionState = {
1103
+ rowModelType: 'clientSide',
1104
+ selectAll: false,
1105
+ toggledNodes: [],
1106
+ selectedCount: rows.length,
1107
+ };
1108
+ }
1081
1109
  this.refresh();
1082
1110
  });
1083
1111
  //Refetch server action if gridId has changed, or fetch has not happened
@@ -1106,13 +1134,13 @@ class BulkActions {
1106
1134
  this.executeLocalFunction = (functionName) => {
1107
1135
  const selectedFunction = this.localFunctions.find(f => f.label === functionName);
1108
1136
  if (selectedFunction) {
1109
- selectedFunction.callback(this.selectedRows);
1137
+ selectedFunction.callback(this.selectedRows, this.selectionState);
1110
1138
  }
1111
1139
  this.refresh();
1112
1140
  };
1113
1141
  this.executeActionProviderAction = (actionId) => {
1114
1142
  if (this.actionProviderCallback) {
1115
- this.actionProviderCallback(actionId, this.selectedRows);
1143
+ this.actionProviderCallback(actionId, this.selectedRows, this.selectionState);
1116
1144
  }
1117
1145
  this.refresh();
1118
1146
  };
@@ -1132,11 +1160,22 @@ class BulkActions {
1132
1160
  this.api.setGridOption('rowSelection', { mode: 'multiRow', enableClickSelection: true });
1133
1161
  }
1134
1162
  else {
1163
+ // SSRM: the header checkbox selects ALL matching rows (every page), stored
1164
+ // as a selection rule ({ selectAll, toggledNodes }) — not a row list.
1165
+ // 'currentPage'/'filtered' are invalid for SSRM and silently fall back to
1166
+ // 'all', so we leave selectAll at its default. Selection is read from
1167
+ // getServerSideSelectionState() in onRowSelectionChanged.
1135
1168
  this.api.setGridOption('rowSelection', {
1136
1169
  mode: 'multiRow',
1137
1170
  enableClickSelection: true,
1138
- headerCheckbox: false,
1171
+ headerCheckbox: true,
1139
1172
  });
1173
+ // SSRM row selection requires Row IDs; without getRowId the select-all
1174
+ // state and selection tracking are unreliable.
1175
+ if (!this.api.getGridOption('getRowId')) {
1176
+ console.warn('[bulkActions] Server-side row selection requires `getRowId` in gridOptions. ' +
1177
+ 'Without it the header checkbox select-all and selection state are unreliable.');
1178
+ }
1140
1179
  }
1141
1180
  //Get gridId from context and fetch bulk actions, or set empty server actions if no gridId
1142
1181
  this.gridId = (_b = this.api.getGridOption('context')) === null || _b === void 0 ? void 0 : _b.gridId;