udp-stencil-component-library 26.4.0-beta.13 → 26.4.0-beta.15
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/dist/cjs/ag-grid-base_63.cjs.entry.js +101 -15
- package/dist/collection/components/grid/new-grid/gridFunctions/bulkActions.js +102 -15
- package/dist/components/ag-grid-base2.js +1 -1
- package/dist/components/api-method-instance-grid.js +1 -1
- package/dist/components/search-method-grid2.js +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/ag-grid-base_63.entry.js +102 -16
- package/dist/stencil-library/ag-grid-base_63.entry.js +1 -1
- package/dist/types/components/grid/new-grid/gridFunctions/bulkActions.d.ts +17 -20
- package/dist/types/components/map/udp-map/utils/udp-map-utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ var apiUtils = require('./apiUtils-CizHWZU8.js');
|
|
|
6
6
|
var lookupHelper = require('./lookupHelper-UyFRGwLL.js');
|
|
7
7
|
var tenantUtils = require('./tenantUtils-BCKSE0vq.js');
|
|
8
8
|
var searchObject = require('./searchObject-DeDFFGcx.js');
|
|
9
|
+
var searchObjectHelper = require('./searchObjectHelper-a5QztNDL.js');
|
|
9
10
|
var statusRenderer = require('./status-renderer-9CQ-hhq8.js');
|
|
10
11
|
var configureUdpColumnMods = require('./configureUdpColumnMods-ZrZ1hJX-.js');
|
|
11
12
|
var lodashEs = require('lodash-es');
|
|
@@ -1210,6 +1211,9 @@ class AgGridAutoSizeColumns {
|
|
|
1210
1211
|
}
|
|
1211
1212
|
}
|
|
1212
1213
|
|
|
1214
|
+
function capitalize(str) {
|
|
1215
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1216
|
+
}
|
|
1213
1217
|
function intentToAppearance(intent) {
|
|
1214
1218
|
switch (intent) {
|
|
1215
1219
|
case 'primary':
|
|
@@ -1242,23 +1246,11 @@ class BulkActions {
|
|
|
1242
1246
|
this.selectedRowCount = selectAll
|
|
1243
1247
|
? Math.max(total - toggledNodes.length, 0)
|
|
1244
1248
|
: toggledNodes.length;
|
|
1245
|
-
this.selectionState = {
|
|
1246
|
-
rowModelType: 'serverSide',
|
|
1247
|
-
selectAll,
|
|
1248
|
-
toggledNodes,
|
|
1249
|
-
selectedCount: this.selectedRowCount,
|
|
1250
|
-
};
|
|
1251
1249
|
}
|
|
1252
1250
|
else {
|
|
1253
1251
|
const rows = this.api.getSelectedRows();
|
|
1254
1252
|
this.selectedRows = rows;
|
|
1255
1253
|
this.selectedRowCount = rows.length;
|
|
1256
|
-
this.selectionState = {
|
|
1257
|
-
rowModelType: 'clientSide',
|
|
1258
|
-
selectAll: false,
|
|
1259
|
-
toggledNodes: [],
|
|
1260
|
-
selectedCount: rows.length,
|
|
1261
|
-
};
|
|
1262
1254
|
}
|
|
1263
1255
|
this.refresh();
|
|
1264
1256
|
});
|
|
@@ -1288,13 +1280,13 @@ class BulkActions {
|
|
|
1288
1280
|
this.executeLocalFunction = (functionName) => {
|
|
1289
1281
|
const selectedFunction = this.localFunctions.find(f => f.label === functionName);
|
|
1290
1282
|
if (selectedFunction) {
|
|
1291
|
-
selectedFunction.callback(this.selectedRows, this.
|
|
1283
|
+
selectedFunction.callback(this.selectedRows, this.buildSelectionSearch());
|
|
1292
1284
|
}
|
|
1293
1285
|
this.refresh();
|
|
1294
1286
|
};
|
|
1295
1287
|
this.executeActionProviderAction = (actionId) => {
|
|
1296
1288
|
if (this.actionProviderCallback) {
|
|
1297
|
-
this.actionProviderCallback(actionId, this.selectedRows
|
|
1289
|
+
this.actionProviderCallback(actionId, this.selectedRows);
|
|
1298
1290
|
}
|
|
1299
1291
|
this.refresh();
|
|
1300
1292
|
};
|
|
@@ -1309,6 +1301,7 @@ class BulkActions {
|
|
|
1309
1301
|
this.actionProviderCallback =
|
|
1310
1302
|
params === null || params === void 0 ? void 0 : params.actionProviderCallback;
|
|
1311
1303
|
this.localFunctions = (_a = params === null || params === void 0 ? void 0 : params.localFunctions) !== null && _a !== void 0 ? _a : [];
|
|
1304
|
+
this.idField = params === null || params === void 0 ? void 0 : params.idField;
|
|
1312
1305
|
const modelType = this.api.getGridOption('rowModelType');
|
|
1313
1306
|
if (modelType === 'clientSide') {
|
|
1314
1307
|
this.api.setGridOption('rowSelection', { mode: 'multiRow', checkboxes: true });
|
|
@@ -1342,9 +1335,10 @@ class BulkActions {
|
|
|
1342
1335
|
this.api.addEventListener('selectionChanged', this.onRowSelectionChanged);
|
|
1343
1336
|
}
|
|
1344
1337
|
update(params) {
|
|
1345
|
-
var _a, _b;
|
|
1338
|
+
var _a, _b, _c;
|
|
1346
1339
|
this.localFunctions = (_a = params === null || params === void 0 ? void 0 : params.localFunctions) !== null && _a !== void 0 ? _a : [];
|
|
1347
1340
|
this.actionProviderCallback = (_b = params === null || params === void 0 ? void 0 : params.actionProviderCallback) !== null && _b !== void 0 ? _b : this.actionProviderCallback;
|
|
1341
|
+
this.idField = (_c = params === null || params === void 0 ? void 0 : params.idField) !== null && _c !== void 0 ? _c : this.idField;
|
|
1348
1342
|
this.setBulkActions(this.serverActionData);
|
|
1349
1343
|
}
|
|
1350
1344
|
onAction(name) {
|
|
@@ -1362,6 +1356,98 @@ class BulkActions {
|
|
|
1362
1356
|
console.error(err);
|
|
1363
1357
|
}
|
|
1364
1358
|
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Resolves the current selection into a single filter-only {@link Search} that,
|
|
1361
|
+
* when executed by the backend, returns exactly the selected rows. This is the
|
|
1362
|
+
* canonical contract handed to bulk-action callbacks: a backend author runs one
|
|
1363
|
+
* Search regardless of how the user selected — SSRM select-all (with optional
|
|
1364
|
+
* exclusions), individual SSRM picks, or a client-side selection. Pagination,
|
|
1365
|
+
* sort, and grouping are stripped and `getAll` is set so it spans every match.
|
|
1366
|
+
*
|
|
1367
|
+
* Returns `undefined` when no `idField` param was supplied — without the backend
|
|
1368
|
+
* identity column the selection can't be expressed as a filter, and callers must
|
|
1369
|
+
* fall back to `selectedRows`.
|
|
1370
|
+
*/
|
|
1371
|
+
buildSelectionSearch() {
|
|
1372
|
+
var _a, _b;
|
|
1373
|
+
if (!this.idField)
|
|
1374
|
+
return undefined;
|
|
1375
|
+
const field = capitalize(this.idField);
|
|
1376
|
+
if (this.api.getGridOption('rowModelType') === 'serverSide') {
|
|
1377
|
+
const state = this.api.getServerSideSelectionState();
|
|
1378
|
+
if (state === null || state === void 0 ? void 0 : state.selectAll) {
|
|
1379
|
+
// "All matching rows" = the grid's current filter, minus any individually
|
|
1380
|
+
// deselected ids. Read the live filter forest the datasource last sent
|
|
1381
|
+
// (context.searchObject) and add the exclusion as its own composed group so
|
|
1382
|
+
// it can't collide with that forest's group ids.
|
|
1383
|
+
const current = (_a = this.api.getGridOption('context')) === null || _a === void 0 ? void 0 : _a.searchObject;
|
|
1384
|
+
const toggledNodes = (_b = state.toggledNodes) !== null && _b !== void 0 ? _b : [];
|
|
1385
|
+
const fragments = [
|
|
1386
|
+
{
|
|
1387
|
+
filterElements: current === null || current === void 0 ? void 0 : current.filterElements,
|
|
1388
|
+
filterGroups: current === null || current === void 0 ? void 0 : current.filterGroups,
|
|
1389
|
+
logicalSearchOperator: current === null || current === void 0 ? void 0 : current.logicalSearchOperator,
|
|
1390
|
+
},
|
|
1391
|
+
];
|
|
1392
|
+
if (toggledNodes.length) {
|
|
1393
|
+
this.warnIfOverInClause(toggledNodes.length);
|
|
1394
|
+
fragments.push({
|
|
1395
|
+
filterElements: [
|
|
1396
|
+
{
|
|
1397
|
+
searchField: field,
|
|
1398
|
+
searchOperator: searchObject.SearchOperators.NOT_IN,
|
|
1399
|
+
searchValue: toggledNodes.join(),
|
|
1400
|
+
groupId: null,
|
|
1401
|
+
},
|
|
1402
|
+
],
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
return this.toFilterOnlySearch(searchObjectHelper.composeSearchFragments(fragments));
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
// Individual SSRM picks and client-side selections: an IN over the selected row
|
|
1409
|
+
// ids (node ids are the values produced by the grid's `getRowId`).
|
|
1410
|
+
const ids = this.api
|
|
1411
|
+
.getSelectedNodes()
|
|
1412
|
+
.map(node => node.id)
|
|
1413
|
+
.filter((id) => !!id);
|
|
1414
|
+
this.warnIfOverInClause(ids.length);
|
|
1415
|
+
return this.toFilterOnlySearch({
|
|
1416
|
+
filterElements: ids.length
|
|
1417
|
+
? [
|
|
1418
|
+
{
|
|
1419
|
+
searchField: field,
|
|
1420
|
+
searchOperator: searchObject.SearchOperators.IN,
|
|
1421
|
+
searchValue: ids.join(),
|
|
1422
|
+
groupId: null,
|
|
1423
|
+
},
|
|
1424
|
+
]
|
|
1425
|
+
: [],
|
|
1426
|
+
filterGroups: [],
|
|
1427
|
+
logicalSearchOperator: searchObject.LogicalSearchOperator.AND,
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
toFilterOnlySearch(parts) {
|
|
1431
|
+
var _a, _b, _c;
|
|
1432
|
+
return {
|
|
1433
|
+
pageNumber: 1,
|
|
1434
|
+
pageSize: searchObject.SearchConstants.MAX_PAGE_SIZE,
|
|
1435
|
+
getAll: true,
|
|
1436
|
+
orderElements: [],
|
|
1437
|
+
groupOperationList: [],
|
|
1438
|
+
groupProperty: [],
|
|
1439
|
+
groupingType: '',
|
|
1440
|
+
filterElements: (_a = parts.filterElements) !== null && _a !== void 0 ? _a : [],
|
|
1441
|
+
filterGroups: (_b = parts.filterGroups) !== null && _b !== void 0 ? _b : [],
|
|
1442
|
+
logicalSearchOperator: (_c = parts.logicalSearchOperator) !== null && _c !== void 0 ? _c : searchObject.LogicalSearchOperator.AND,
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
warnIfOverInClause(count) {
|
|
1446
|
+
if (count > searchObject.SearchConstants.IN_CLAUSE_MAX_ELEMENTS) {
|
|
1447
|
+
console.warn(`[bulkActions] selection resolves to ${count} ids, exceeding the backend ` +
|
|
1448
|
+
`IN/NOTIN clause limit of ${searchObject.SearchConstants.IN_CLAUSE_MAX_ELEMENTS}. The query may be rejected.`);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1365
1451
|
isActive() {
|
|
1366
1452
|
return this.selectedRowCount > 0;
|
|
1367
1453
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { getAvailableGridActions } from "../../../../udp-utilities/api-udp/apiUtils";
|
|
3
3
|
import { startGuardedTransition } from "../helperFunctions/guardedViewTransitions";
|
|
4
|
+
import { SearchOperators, LogicalSearchOperator, SearchConstants, } from "../../../../udp-utilities/search/searchObject";
|
|
5
|
+
import { composeSearchFragments } from "../helperFunctions/searchObjectHelper";
|
|
6
|
+
function capitalize(str) {
|
|
7
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
8
|
+
}
|
|
4
9
|
function intentToAppearance(intent) {
|
|
5
10
|
switch (intent) {
|
|
6
11
|
case 'primary':
|
|
@@ -33,23 +38,11 @@ export class BulkActions {
|
|
|
33
38
|
this.selectedRowCount = selectAll
|
|
34
39
|
? Math.max(total - toggledNodes.length, 0)
|
|
35
40
|
: toggledNodes.length;
|
|
36
|
-
this.selectionState = {
|
|
37
|
-
rowModelType: 'serverSide',
|
|
38
|
-
selectAll,
|
|
39
|
-
toggledNodes,
|
|
40
|
-
selectedCount: this.selectedRowCount,
|
|
41
|
-
};
|
|
42
41
|
}
|
|
43
42
|
else {
|
|
44
43
|
const rows = this.api.getSelectedRows();
|
|
45
44
|
this.selectedRows = rows;
|
|
46
45
|
this.selectedRowCount = rows.length;
|
|
47
|
-
this.selectionState = {
|
|
48
|
-
rowModelType: 'clientSide',
|
|
49
|
-
selectAll: false,
|
|
50
|
-
toggledNodes: [],
|
|
51
|
-
selectedCount: rows.length,
|
|
52
|
-
};
|
|
53
46
|
}
|
|
54
47
|
this.refresh();
|
|
55
48
|
});
|
|
@@ -79,13 +72,13 @@ export class BulkActions {
|
|
|
79
72
|
this.executeLocalFunction = (functionName) => {
|
|
80
73
|
const selectedFunction = this.localFunctions.find(f => f.label === functionName);
|
|
81
74
|
if (selectedFunction) {
|
|
82
|
-
selectedFunction.callback(this.selectedRows, this.
|
|
75
|
+
selectedFunction.callback(this.selectedRows, this.buildSelectionSearch());
|
|
83
76
|
}
|
|
84
77
|
this.refresh();
|
|
85
78
|
};
|
|
86
79
|
this.executeActionProviderAction = (actionId) => {
|
|
87
80
|
if (this.actionProviderCallback) {
|
|
88
|
-
this.actionProviderCallback(actionId, this.selectedRows
|
|
81
|
+
this.actionProviderCallback(actionId, this.selectedRows);
|
|
89
82
|
}
|
|
90
83
|
this.refresh();
|
|
91
84
|
};
|
|
@@ -100,6 +93,7 @@ export class BulkActions {
|
|
|
100
93
|
this.actionProviderCallback =
|
|
101
94
|
params === null || params === void 0 ? void 0 : params.actionProviderCallback;
|
|
102
95
|
this.localFunctions = (_a = params === null || params === void 0 ? void 0 : params.localFunctions) !== null && _a !== void 0 ? _a : [];
|
|
96
|
+
this.idField = params === null || params === void 0 ? void 0 : params.idField;
|
|
103
97
|
const modelType = this.api.getGridOption('rowModelType');
|
|
104
98
|
if (modelType === 'clientSide') {
|
|
105
99
|
this.api.setGridOption('rowSelection', { mode: 'multiRow', checkboxes: true });
|
|
@@ -133,9 +127,10 @@ export class BulkActions {
|
|
|
133
127
|
this.api.addEventListener('selectionChanged', this.onRowSelectionChanged);
|
|
134
128
|
}
|
|
135
129
|
update(params) {
|
|
136
|
-
var _a, _b;
|
|
130
|
+
var _a, _b, _c;
|
|
137
131
|
this.localFunctions = (_a = params === null || params === void 0 ? void 0 : params.localFunctions) !== null && _a !== void 0 ? _a : [];
|
|
138
132
|
this.actionProviderCallback = (_b = params === null || params === void 0 ? void 0 : params.actionProviderCallback) !== null && _b !== void 0 ? _b : this.actionProviderCallback;
|
|
133
|
+
this.idField = (_c = params === null || params === void 0 ? void 0 : params.idField) !== null && _c !== void 0 ? _c : this.idField;
|
|
139
134
|
this.setBulkActions(this.serverActionData);
|
|
140
135
|
}
|
|
141
136
|
onAction(name) {
|
|
@@ -153,6 +148,98 @@ export class BulkActions {
|
|
|
153
148
|
console.error(err);
|
|
154
149
|
}
|
|
155
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Resolves the current selection into a single filter-only {@link Search} that,
|
|
153
|
+
* when executed by the backend, returns exactly the selected rows. This is the
|
|
154
|
+
* canonical contract handed to bulk-action callbacks: a backend author runs one
|
|
155
|
+
* Search regardless of how the user selected — SSRM select-all (with optional
|
|
156
|
+
* exclusions), individual SSRM picks, or a client-side selection. Pagination,
|
|
157
|
+
* sort, and grouping are stripped and `getAll` is set so it spans every match.
|
|
158
|
+
*
|
|
159
|
+
* Returns `undefined` when no `idField` param was supplied — without the backend
|
|
160
|
+
* identity column the selection can't be expressed as a filter, and callers must
|
|
161
|
+
* fall back to `selectedRows`.
|
|
162
|
+
*/
|
|
163
|
+
buildSelectionSearch() {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
if (!this.idField)
|
|
166
|
+
return undefined;
|
|
167
|
+
const field = capitalize(this.idField);
|
|
168
|
+
if (this.api.getGridOption('rowModelType') === 'serverSide') {
|
|
169
|
+
const state = this.api.getServerSideSelectionState();
|
|
170
|
+
if (state === null || state === void 0 ? void 0 : state.selectAll) {
|
|
171
|
+
// "All matching rows" = the grid's current filter, minus any individually
|
|
172
|
+
// deselected ids. Read the live filter forest the datasource last sent
|
|
173
|
+
// (context.searchObject) and add the exclusion as its own composed group so
|
|
174
|
+
// it can't collide with that forest's group ids.
|
|
175
|
+
const current = (_a = this.api.getGridOption('context')) === null || _a === void 0 ? void 0 : _a.searchObject;
|
|
176
|
+
const toggledNodes = (_b = state.toggledNodes) !== null && _b !== void 0 ? _b : [];
|
|
177
|
+
const fragments = [
|
|
178
|
+
{
|
|
179
|
+
filterElements: current === null || current === void 0 ? void 0 : current.filterElements,
|
|
180
|
+
filterGroups: current === null || current === void 0 ? void 0 : current.filterGroups,
|
|
181
|
+
logicalSearchOperator: current === null || current === void 0 ? void 0 : current.logicalSearchOperator,
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
if (toggledNodes.length) {
|
|
185
|
+
this.warnIfOverInClause(toggledNodes.length);
|
|
186
|
+
fragments.push({
|
|
187
|
+
filterElements: [
|
|
188
|
+
{
|
|
189
|
+
searchField: field,
|
|
190
|
+
searchOperator: SearchOperators.NOT_IN,
|
|
191
|
+
searchValue: toggledNodes.join(),
|
|
192
|
+
groupId: null,
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return this.toFilterOnlySearch(composeSearchFragments(fragments));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Individual SSRM picks and client-side selections: an IN over the selected row
|
|
201
|
+
// ids (node ids are the values produced by the grid's `getRowId`).
|
|
202
|
+
const ids = this.api
|
|
203
|
+
.getSelectedNodes()
|
|
204
|
+
.map(node => node.id)
|
|
205
|
+
.filter((id) => !!id);
|
|
206
|
+
this.warnIfOverInClause(ids.length);
|
|
207
|
+
return this.toFilterOnlySearch({
|
|
208
|
+
filterElements: ids.length
|
|
209
|
+
? [
|
|
210
|
+
{
|
|
211
|
+
searchField: field,
|
|
212
|
+
searchOperator: SearchOperators.IN,
|
|
213
|
+
searchValue: ids.join(),
|
|
214
|
+
groupId: null,
|
|
215
|
+
},
|
|
216
|
+
]
|
|
217
|
+
: [],
|
|
218
|
+
filterGroups: [],
|
|
219
|
+
logicalSearchOperator: LogicalSearchOperator.AND,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
toFilterOnlySearch(parts) {
|
|
223
|
+
var _a, _b, _c;
|
|
224
|
+
return {
|
|
225
|
+
pageNumber: 1,
|
|
226
|
+
pageSize: SearchConstants.MAX_PAGE_SIZE,
|
|
227
|
+
getAll: true,
|
|
228
|
+
orderElements: [],
|
|
229
|
+
groupOperationList: [],
|
|
230
|
+
groupProperty: [],
|
|
231
|
+
groupingType: '',
|
|
232
|
+
filterElements: (_a = parts.filterElements) !== null && _a !== void 0 ? _a : [],
|
|
233
|
+
filterGroups: (_b = parts.filterGroups) !== null && _b !== void 0 ? _b : [],
|
|
234
|
+
logicalSearchOperator: (_c = parts.logicalSearchOperator) !== null && _c !== void 0 ? _c : LogicalSearchOperator.AND,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
warnIfOverInClause(count) {
|
|
238
|
+
if (count > SearchConstants.IN_CLAUSE_MAX_ELEMENTS) {
|
|
239
|
+
console.warn(`[bulkActions] selection resolves to ${count} ids, exceeding the backend ` +
|
|
240
|
+
`IN/NOTIN clause limit of ${SearchConstants.IN_CLAUSE_MAX_ELEMENTS}. The query may be rejected.`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
156
243
|
isActive() {
|
|
157
244
|
return this.selectedRowCount > 0;
|
|
158
245
|
}
|