@genesislcap/grid-pro 15.64.0 → 15.64.1-FUI-2629.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.
- package/dist/custom-elements.json +9496 -9470
- package/dist/dts/cell-renderers/actions-menu.renderer.d.ts +33 -3
- package/dist/dts/cell-renderers/actions-menu.renderer.d.ts.map +1 -1
- package/dist/dts/datasource/filter.utils.d.ts.map +1 -1
- package/dist/dts/datasource/infinite.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/infinite.resource.d.ts +3 -2
- package/dist/dts/datasource/infinite.resource.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.resource-base.d.ts +0 -4
- package/dist/dts/datasource/server-side.resource-base.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.resource-dataserver.d.ts.map +1 -1
- package/dist/dts/datasource/sort-index.utils.d.ts +17 -0
- package/dist/dts/datasource/sort-index.utils.d.ts.map +1 -0
- package/dist/dts/grid-pro.d.ts +9 -0
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/grid-pro.metadata-enrichment.d.ts +35 -0
- package/dist/dts/grid-pro.metadata-enrichment.d.ts.map +1 -0
- package/dist/dts/react.d.ts +58 -58
- package/dist/esm/cell-renderers/actions-menu.renderer.js +51 -2
- package/dist/esm/datasource/filter.utils.js +4 -5
- package/dist/esm/datasource/infinite.datasource.js +5 -10
- package/dist/esm/datasource/infinite.resource.js +10 -14
- package/dist/esm/datasource/server-side.datasource.js +5 -1
- package/dist/esm/datasource/server-side.resource-base.js +0 -10
- package/dist/esm/datasource/server-side.resource-dataserver.js +10 -9
- package/dist/esm/datasource/sort-index.utils.js +31 -0
- package/dist/esm/grid-pro.js +39 -10
- package/dist/esm/grid-pro.metadata-enrichment.js +75 -0
- package/dist/grid-pro.api.json +123 -19
- package/dist/grid-pro.d.ts +43 -3
- package/dist/react.cjs +39 -39
- package/dist/react.mjs +32 -32
- package/package.json +12 -12
|
@@ -10,6 +10,7 @@ import { filterDataserverResult } from './dataserver-result.filter';
|
|
|
10
10
|
import { getFilterByFieldType, getServerSideFilterParamsByFieldType, } from './server-side.grid-definitions';
|
|
11
11
|
import { DataserverServerSideDatasource } from './server-side.resource-dataserver';
|
|
12
12
|
import { ReqRepServerSideDatasource } from './server-side.resource-reqrep';
|
|
13
|
+
import { getIndexLeadingFields } from './sort-index.utils';
|
|
13
14
|
const criteriaDelimiter = ';';
|
|
14
15
|
const withoutColumnDefs = null;
|
|
15
16
|
/**
|
|
@@ -650,8 +651,11 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
650
651
|
getAgColumnDefs(fieldsMetadata) {
|
|
651
652
|
return __awaiter(this, void 0, void 0, function* () {
|
|
652
653
|
const colDefsFromGenesisData = this.generateColumnDefsFromMetadata(fieldsMetadata, getServerSideFilterParamsByFieldType, getFilterByFieldType);
|
|
654
|
+
const sortableFields = this.isRequestServer
|
|
655
|
+
? new Set([].concat(...this.indexes.values()))
|
|
656
|
+
: getIndexLeadingFields(this.indexes);
|
|
653
657
|
colDefsFromGenesisData.forEach((colDef) => {
|
|
654
|
-
colDef.sortable =
|
|
658
|
+
colDef.sortable = sortableFields.has(colDef.field);
|
|
655
659
|
if (this.datasource.criteriaOnlyRequest) {
|
|
656
660
|
colDef.filter = this.datasource.availableCriteriaFields.includes(colDef.field)
|
|
657
661
|
? colDef.filter
|
|
@@ -168,16 +168,6 @@ export class BaseServerSideDatasource {
|
|
|
168
168
|
this.setResourceParam('REVERSE', params.reverse);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
getOrderByAndToBeSortedColIds(map, searchValue) {
|
|
172
|
-
for (const [key, value] of map.entries()) {
|
|
173
|
-
const searchIndex = value.findIndex((x) => x === searchValue);
|
|
174
|
-
if (searchIndex !== -1) {
|
|
175
|
-
const copy = [...value];
|
|
176
|
-
const toBeSorted = copy.splice(searchIndex, 1);
|
|
177
|
-
return { orderBy: key, toBeSorted };
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
171
|
buildCriteriaMatchFromFilters() {
|
|
182
172
|
this.setResourceParam('CRITERIA_MATCH', this.originalCriteriaMatch);
|
|
183
173
|
let criteriaMatch = this.getResourceParam('CRITERIA_MATCH');
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { dataserverPagingStatus, describeDataserverPagingStop, MessageType, logger, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { DOM } from '@microsoft/fast-element';
|
|
4
|
-
import { getAvailableIndexes
|
|
4
|
+
import { getAvailableIndexes } from '../utils';
|
|
5
5
|
import { cachedRowKeyResolver, filterDataserverResult } from './dataserver-result.filter';
|
|
6
6
|
import { BaseServerSideDatasource } from './server-side.resource-base';
|
|
7
|
+
import { findIndexLedBy, getIndexLeadingFields } from './sort-index.utils';
|
|
7
8
|
/**
|
|
8
9
|
* The DATASERVER IServerSideDatasource implementation, used for SSRM (Server-Side Row Model) in the grid.
|
|
9
10
|
* @beta
|
|
@@ -366,13 +367,13 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
366
367
|
else if (toBeAppliedSortModel.length > 0) {
|
|
367
368
|
const coldIdBeingSorted = toBeAppliedSortModel[0].colId; // Not allowing multiple sorts by user
|
|
368
369
|
const sortTypeBeingApplied = toBeAppliedSortModel[0].sort;
|
|
369
|
-
const
|
|
370
|
-
if (!
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
logger.
|
|
374
|
-
|
|
375
|
-
|
|
370
|
+
const orderBy = findIndexLedBy(this.resourceIndexes, coldIdBeingSorted);
|
|
371
|
+
if (!orderBy) {
|
|
372
|
+
logger.warn(`The FIELD/column (${coldIdBeingSorted}) being sorted does not lead a named INDEX, required for the [orderBy] operation - ignoring this sort and loading unsorted data. See https://learn.genesis.global/docs/database/data-types/index-entities/`);
|
|
373
|
+
logger.debug('Available indexes:', getAvailableIndexes(this.resourceIndexes));
|
|
374
|
+
logger.debug('Columns that can be sorted with the available indexes:', [
|
|
375
|
+
...getIndexLeadingFields(this.resourceIndexes),
|
|
376
|
+
]);
|
|
376
377
|
// Ignore the un-sortable sort instead of failing - failing killed the entire
|
|
377
378
|
// first load when a restored workspace carried a sort on a non-indexed column.
|
|
378
379
|
const sortModelChanged = JSON.stringify(toBeAppliedSortModel) !== JSON.stringify(this.currentSortModel);
|
|
@@ -396,7 +397,7 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
396
397
|
}
|
|
397
398
|
else if (JSON.stringify(toBeAppliedSortModel) !== JSON.stringify(this.currentSortModel)) {
|
|
398
399
|
this.currentSortModel = toBeAppliedSortModel;
|
|
399
|
-
this.resourceParams.ORDER_BY =
|
|
400
|
+
this.resourceParams.ORDER_BY = orderBy;
|
|
400
401
|
this.resourceParams.REVERSE = sortTypeBeingApplied === 'desc' ? true : false;
|
|
401
402
|
yield this.refreshDatasource(params);
|
|
402
403
|
return true;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the index a DATASERVER can ORDER_BY to sort rows by `field`.
|
|
3
|
+
* @remarks ORDER_BY on an index orders rows by its fields in turn, so only an index that `field`
|
|
4
|
+
* leads orders by it; a trailing field is only ordered within groups of the fields before it. An
|
|
5
|
+
* index with no NAME cannot be named in ORDER_BY.
|
|
6
|
+
* @param indexes - The resource's indexes, keyed by name
|
|
7
|
+
* @param field - The field to sort by
|
|
8
|
+
* @returns The name of the first named index `field` leads, or undefined when it leads none
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export function findIndexLedBy(indexes, field) {
|
|
12
|
+
for (const [indexName, fields] of indexes) {
|
|
13
|
+
if (indexName && fields[0] === field) {
|
|
14
|
+
return indexName;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The fields a DATASERVER can sort by: those that lead a named index (see `findIndexLedBy`).
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export function getIndexLeadingFields(indexes) {
|
|
24
|
+
const leadingFields = new Set();
|
|
25
|
+
indexes.forEach((fields, indexName) => {
|
|
26
|
+
if (indexName && fields.length) {
|
|
27
|
+
leadingFields.add(fields[0]);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return leadingFields;
|
|
31
|
+
}
|
package/dist/esm/grid-pro.js
CHANGED
|
@@ -19,6 +19,7 @@ import { errorHandlerDialogStyles } from './datasource/error-handler.dialog';
|
|
|
19
19
|
import { GridProGenesisDatasource, gridProGenesisDatasourceEventNames, } from './grid-pro-genesis-datasource';
|
|
20
20
|
import { datasourceEventNames, } from './grid-pro-genesis-datasource/datasource-events.types';
|
|
21
21
|
import { AG_PROPERTIES, copyAttributesToGridOptions, DEBOUNCED_RESIZE_TIME, defaultGridProConfig, foundationGridProShadowOptions, gridProErrorNames, gridProEventNames, } from './grid-pro.definitions';
|
|
22
|
+
import { enrichColumnDefsFromMetadata, getMetadataSetFilterValues, isSetFilter, } from './grid-pro.metadata-enrichment';
|
|
22
23
|
import { agDragGhostShadowDomStyles, rowMatchAlertStyles } from './grid-pro.styles';
|
|
23
24
|
import { gridProTemplate as template } from './grid-pro.template';
|
|
24
25
|
import { DEFAULT_STATUS_BAR_CONFIG, EDITED_COLUMN_FIELD, ERROR_COLUMN_FIELD, GRID_READY_EVENT, GridOptionsConfig, GridProRendererTypes, GridProStatusBarTypes, } from './grid-pro.types';
|
|
@@ -622,16 +623,18 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
622
623
|
*/
|
|
623
624
|
processSchemaUpdate(_a) {
|
|
624
625
|
return __awaiter(this, arguments, void 0, function* ({ schema }) {
|
|
626
|
+
this.applyCommunityFilterFallbacks(schema);
|
|
625
627
|
// Only auto-generate columns from the datasource schema when the consumer has NOT already
|
|
626
628
|
// supplied their own column defs (e.g. via `gridOptions`/`deferredGridOptions.columnDefs` or
|
|
627
629
|
// `grid-pro-column` templates). Overwriting here would discard user-provided definitions —
|
|
628
630
|
// including `ColGroupDef` group structure and custom header names — and replace them with flat
|
|
629
|
-
// metadata columns. This mirrors the legacy `GridProLegacy` behaviour.
|
|
631
|
+
// metadata columns. This mirrors the legacy `GridProLegacy` behaviour. They are enriched
|
|
632
|
+
// instead, with what the server decides and the consumer left unset.
|
|
630
633
|
const preSetColumnDefs = this.gridApi.getColumnDefs();
|
|
631
634
|
if (preSetColumnDefs && preSetColumnDefs.length > 0) {
|
|
635
|
+
this.enrichPresetColumnDefs(schema);
|
|
632
636
|
return;
|
|
633
637
|
}
|
|
634
|
-
this.applyCommunityFilterFallbacks(schema);
|
|
635
638
|
// Merge with template definitions
|
|
636
639
|
const mergedColumnDefs = yield this.mergeAllColumnDefsAndStates(schema, true);
|
|
637
640
|
this.gridApi.setGridOption('columnDefs', mergedColumnDefs);
|
|
@@ -643,6 +646,36 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
643
646
|
this.restoreCachedFilterConfig();
|
|
644
647
|
});
|
|
645
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Fills the consumer's column defs with the sortability, filter and set-filter values the
|
|
651
|
+
* schema knows and they left unset.
|
|
652
|
+
* @remarks Reads `getGridOption('columnDefs')` - the defs as given - rather than
|
|
653
|
+
* `getColumnDefs()`, which merges in `defaultColDef`, so an unset `sortable` would already read
|
|
654
|
+
* as the datasource default.
|
|
655
|
+
* @internal
|
|
656
|
+
*/
|
|
657
|
+
enrichPresetColumnDefs(schema) {
|
|
658
|
+
const columnDefs = this.gridApi.getGridOption('columnDefs');
|
|
659
|
+
if (!(columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length)) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
// Client-side filters work on the rows, so the consumer's defaultColDef filter still serves.
|
|
663
|
+
const enrichedColumnDefs = enrichColumnDefsFromMetadata(columnDefs, schema, {
|
|
664
|
+
fillUnsetFilters: !this.isClientSideRowModel,
|
|
665
|
+
});
|
|
666
|
+
if (enrichedColumnDefs === columnDefs) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
// New defs reset the column order (no maintainColumnOrder), undoing the restored state, and a
|
|
670
|
+
// changed filter type drops that column's filter model.
|
|
671
|
+
const columnState = this.gridApi.getColumnState();
|
|
672
|
+
const filterModel = JSON.stringify(this.gridApi.getFilterModel());
|
|
673
|
+
this.gridApi.setGridOption('columnDefs', enrichedColumnDefs);
|
|
674
|
+
this.gridApi.applyColumnState({ state: columnState, applyOrder: true });
|
|
675
|
+
if (JSON.stringify(this.gridApi.getFilterModel()) !== filterModel) {
|
|
676
|
+
this.restoreCachedFilterConfig();
|
|
677
|
+
}
|
|
678
|
+
}
|
|
646
679
|
/**
|
|
647
680
|
* Downgrades enterprise filters in metadata-generated colDefs when their modules are not
|
|
648
681
|
* registered — from v35 AG Grid throws on unregistered filters instead of falling back.
|
|
@@ -1372,7 +1405,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
1372
1405
|
const templateColumnDefs = Array.from(this.querySelectorAll(this.columnComponentName))
|
|
1373
1406
|
.map((templateColumn) => templateColumn.definition)
|
|
1374
1407
|
.map((columnDef) => {
|
|
1375
|
-
var _a
|
|
1408
|
+
var _a;
|
|
1376
1409
|
// enable cell flashing for each column if unspecified on column level but enabled on grid level
|
|
1377
1410
|
if (this.enableCellFlashing && columnDef.enableCellChangeFlash === undefined) {
|
|
1378
1411
|
columnDef.enableCellChangeFlash = true;
|
|
@@ -1383,20 +1416,16 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
1383
1416
|
* respect that choice and don't inject metadata values. This allows consumers to
|
|
1384
1417
|
* opt out of metadata values and let AG Grid extract values from row data instead.
|
|
1385
1418
|
*/
|
|
1386
|
-
if (columnDef.filter
|
|
1387
|
-
columnDef.filter === GridProFilterTypes.enumFilter) {
|
|
1419
|
+
if (isSetFilter(columnDef.filter)) {
|
|
1388
1420
|
const hasExplicitValues = columnDef.filterParams != null && 'values' in columnDef.filterParams;
|
|
1389
1421
|
if (!hasExplicitValues) {
|
|
1390
|
-
const
|
|
1391
|
-
// Metadata enum values are flat ({ values }) on the server-side datasource path, but
|
|
1392
|
-
// nested inside a multi-filter's set sub-filter on the client-side datasource path.
|
|
1393
|
-
const metadataValues = (_b = metadataFilterParams === null || metadataFilterParams === void 0 ? void 0 : metadataFilterParams.values) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = metadataFilterParams === null || metadataFilterParams === void 0 ? void 0 : metadataFilterParams.filters) === null || _c === void 0 ? void 0 : _c.find((subFilter) => subFilter.filter === 'agSetColumnFilter')) === null || _d === void 0 ? void 0 : _d.filterParams) === null || _e === void 0 ? void 0 : _e.values;
|
|
1422
|
+
const metadataValues = getMetadataSetFilterValues(columnDefinitionsFromMetadata.find((colDef) => colDef.field === columnDef.field));
|
|
1394
1423
|
if (metadataValues) {
|
|
1395
1424
|
columnDef.filterParams = Object.assign(Object.assign({}, columnDef.filterParams), { values: metadataValues });
|
|
1396
1425
|
}
|
|
1397
1426
|
}
|
|
1398
1427
|
if (columnDef.filter === GridProFilterTypes.enumFilter) {
|
|
1399
|
-
(
|
|
1428
|
+
(_a = columnDef.floatingFilterComponent) !== null && _a !== void 0 ? _a : (columnDef.floatingFilterComponent = GridProFilterTypes.enumFloatingFilter);
|
|
1400
1429
|
}
|
|
1401
1430
|
}
|
|
1402
1431
|
if (columnDef.editable) {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { GridProFilterTypes } from './column-filters';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a column filter lists set values that metadata can supply.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export const isSetFilter = (filter) => filter === 'agSetColumnFilter' || filter === GridProFilterTypes.enumFilter;
|
|
7
|
+
/**
|
|
8
|
+
* The enum values datasource metadata gives a column's set filter.
|
|
9
|
+
* @remarks Flat (`{ values }`) on the server-side and infinite datasources, but nested in a multi
|
|
10
|
+
* filter's set sub-filter on the client-side datasource - an enum filter once
|
|
11
|
+
* `applyCommunityFilterFallbacks` has swapped out an unregistered set filter.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function getMetadataSetFilterValues(metadataColDef) {
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
|
+
const filterParams = metadataColDef === null || metadataColDef === void 0 ? void 0 : metadataColDef.filterParams;
|
|
17
|
+
return ((_a = filterParams === null || filterParams === void 0 ? void 0 : filterParams.values) !== null && _a !== void 0 ? _a : (_d = (_c = (_b = filterParams === null || filterParams === void 0 ? void 0 : filterParams.filters) === null || _b === void 0 ? void 0 : _b.find((subFilter) => isSetFilter(subFilter.filter))) === null || _c === void 0 ? void 0 : _c.filterParams) === null || _d === void 0 ? void 0 : _d.values);
|
|
18
|
+
}
|
|
19
|
+
function enrichColumnDef(colDef, metadataColDef, { fillUnsetFilters }) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const enriched = Object.assign({}, colDef);
|
|
22
|
+
let changed = false;
|
|
23
|
+
if (enriched.sortable === undefined && metadataColDef.sortable !== undefined) {
|
|
24
|
+
enriched.sortable = metadataColDef.sortable;
|
|
25
|
+
changed = true;
|
|
26
|
+
}
|
|
27
|
+
if (fillUnsetFilters &&
|
|
28
|
+
(enriched.filter === undefined || enriched.filter === true) &&
|
|
29
|
+
metadataColDef.filter !== undefined) {
|
|
30
|
+
enriched.filter = metadataColDef.filter;
|
|
31
|
+
if (metadataColDef.filterParams || enriched.filterParams) {
|
|
32
|
+
enriched.filterParams = Object.assign(Object.assign({}, metadataColDef.filterParams), enriched.filterParams);
|
|
33
|
+
}
|
|
34
|
+
if (metadataColDef.floatingFilterComponent) {
|
|
35
|
+
(_a = enriched.floatingFilterComponent) !== null && _a !== void 0 ? _a : (enriched.floatingFilterComponent = metadataColDef.floatingFilterComponent);
|
|
36
|
+
}
|
|
37
|
+
changed = true;
|
|
38
|
+
}
|
|
39
|
+
else if (isSetFilter(enriched.filter) && !('values' in ((_b = enriched.filterParams) !== null && _b !== void 0 ? _b : {}))) {
|
|
40
|
+
const values = getMetadataSetFilterValues(metadataColDef);
|
|
41
|
+
if (values) {
|
|
42
|
+
enriched.filterParams = Object.assign(Object.assign({}, enriched.filterParams), { values });
|
|
43
|
+
changed = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return changed ? enriched : colDef;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Fills what consumer-authored column defs leave unset from the datasource's metadata column defs.
|
|
50
|
+
* @remarks Only what the server decides is filled in: whether the column sorts (a DATASERVER can
|
|
51
|
+
* only order by an index), the filter its field type and transport support (when `filter` is
|
|
52
|
+
* unset or `true`, and `fillUnsetFilters` is set), and the enum values a set filter lists.
|
|
53
|
+
* Formatting, rendering and headers stay the consumer's. A column is matched on `field`, and only
|
|
54
|
+
* when its `colId` is unset or the same: the datasources send the column id as the server field
|
|
55
|
+
* in ORDER_BY and CRITERIA_MATCH.
|
|
56
|
+
* @returns The enriched column defs, or `columnDefs` itself when nothing was filled in
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export function enrichColumnDefsFromMetadata(columnDefs, metadataColDefs, options) {
|
|
60
|
+
const metadataByField = new Map(metadataColDefs.map((colDef) => [colDef.field, colDef]));
|
|
61
|
+
const enrich = (def) => {
|
|
62
|
+
if ('children' in def) {
|
|
63
|
+
const children = def.children.map(enrich);
|
|
64
|
+
return children.every((child, index) => child === def.children[index])
|
|
65
|
+
? def
|
|
66
|
+
: Object.assign(Object.assign({}, def), { children });
|
|
67
|
+
}
|
|
68
|
+
const metadataColDef = def.field && (def.colId == null || def.colId === def.field)
|
|
69
|
+
? metadataByField.get(def.field)
|
|
70
|
+
: undefined;
|
|
71
|
+
return metadataColDef ? enrichColumnDef(def, metadataColDef, options) : def;
|
|
72
|
+
};
|
|
73
|
+
const enriched = columnDefs.map(enrich);
|
|
74
|
+
return enriched.every((def, index) => def === columnDefs[index]) ? columnDefs : enriched;
|
|
75
|
+
}
|
package/dist/grid-pro.api.json
CHANGED
|
@@ -760,7 +760,7 @@
|
|
|
760
760
|
{
|
|
761
761
|
"kind": "Method",
|
|
762
762
|
"canonicalReference": "@genesislcap/grid-pro!ActionsMenuRenderer#refresh:member(1)",
|
|
763
|
-
"docComment": "",
|
|
763
|
+
"docComment": "/**\n * Hands the latest row data to the menu, so per-row actions and disabled states stay current.\n */\n",
|
|
764
764
|
"excerptTokens": [
|
|
765
765
|
{
|
|
766
766
|
"kind": "Content",
|
|
@@ -14322,7 +14322,7 @@
|
|
|
14322
14322
|
{
|
|
14323
14323
|
"kind": "Function",
|
|
14324
14324
|
"canonicalReference": "@genesislcap/grid-pro!getActionsMenuDef:function(1)",
|
|
14325
|
-
"docComment": "/**\n * Helper function to get ColDef {@link https://www.ag-grid.com/javascript-data-grid/column-properties/} for Actions Menu Renderer. Will take the parameter values for a base ColDef and merge them with the overrideDef (if specified).\n *\n * @param actions - Array of `ActionMenuItem` to be displayed in the menu.\n *\n * @param overrideDef - Optional override for the ColDef. Will override any of the default values. Default is an empty object.\n *\n * @param customActionsOpenerName - Optional custom name for the button that opens the menu. Default is '⋮'.\n *\n * @param isVertical - Optional flag to display the menu vertically. Default is false (displays the menu horizontally, follow the rowHeight).\n *\n * @param buttonAppearance - Optional appearance for the button that opens the menu. Default is 'outline'.\n *\n * @returns Merged ColDef (base ColDef created from the parameters + overrideDef) for Actions Menu Renderer.\n *\n * @example\n * ```ts\n * public exampleActionsMenuDef: ColDef = getActionsMenuDef(\n * [\n * {\n * name: 'View',\n * callback: (rowData) => logger.debug('VIEWW!!!', rowData),\n * },\n * {\n * name: 'Delete',\n * callback: (rowData) => logger.debug('DELETE!!!', rowData),\n * },\n * ],\n * {\n * headerName: 'Instrument Actions',\n * width: 180,\n * },\n * '+',\n * true,\n * 'primary-gradient'\n * );\n * ```\n *\n * @public\n */\n",
|
|
14325
|
+
"docComment": "/**\n * Helper function to get ColDef {@link https://www.ag-grid.com/javascript-data-grid/column-properties/} for Actions Menu Renderer. Will take the parameter values for a base ColDef and merge them with the overrideDef (if specified).\n *\n * @param actions - Array of `ActionMenuItem` to be displayed in the menu, or a function of the row data returning that array (for row-scoped eligibility/permission filtering).\n *\n * @param overrideDef - Optional override for the ColDef. Will override any of the default values. Default is an empty object.\n *\n * @param customActionsOpenerName - Optional custom name for the button that opens the menu. Default is '⋮'.\n *\n * @param isVertical - Optional flag to display the menu vertically. Default is false (displays the menu horizontally, follow the rowHeight).\n *\n * @param buttonAppearance - Optional appearance for the button that opens the menu. Default is 'outline'.\n *\n * @returns Merged ColDef (base ColDef created from the parameters + overrideDef) for Actions Menu Renderer.\n *\n * @example\n * ```ts\n * public exampleActionsMenuDef: ColDef = getActionsMenuDef(\n * [\n * {\n * name: 'View',\n * callback: (rowData) => logger.debug('VIEWW!!!', rowData),\n * },\n * {\n * name: 'Delete',\n * callback: (rowData) => logger.debug('DELETE!!!', rowData),\n * },\n * ],\n * {\n * headerName: 'Instrument Actions',\n * width: 180,\n * },\n * '+',\n * true,\n * 'primary-gradient'\n * );\n * ```\n *\n * @public\n */\n",
|
|
14326
14326
|
"excerptTokens": [
|
|
14327
14327
|
{
|
|
14328
14328
|
"kind": "Content",
|
|
@@ -14330,12 +14330,8 @@
|
|
|
14330
14330
|
},
|
|
14331
14331
|
{
|
|
14332
14332
|
"kind": "Reference",
|
|
14333
|
-
"text": "
|
|
14334
|
-
"canonicalReference": "@genesislcap/foundation-ui!
|
|
14335
|
-
},
|
|
14336
|
-
{
|
|
14337
|
-
"kind": "Content",
|
|
14338
|
-
"text": "[]"
|
|
14333
|
+
"text": "ActionMenuItems",
|
|
14334
|
+
"canonicalReference": "@genesislcap/foundation-ui!ActionMenuItems:type"
|
|
14339
14335
|
},
|
|
14340
14336
|
{
|
|
14341
14337
|
"kind": "Content",
|
|
@@ -14382,8 +14378,8 @@
|
|
|
14382
14378
|
],
|
|
14383
14379
|
"fileUrlPath": "src/cell-renderers/actions-menu.renderer.ts",
|
|
14384
14380
|
"returnTypeTokenRange": {
|
|
14385
|
-
"startIndex":
|
|
14386
|
-
"endIndex":
|
|
14381
|
+
"startIndex": 11,
|
|
14382
|
+
"endIndex": 12
|
|
14387
14383
|
},
|
|
14388
14384
|
"releaseTag": "Public",
|
|
14389
14385
|
"overloadIndex": 1,
|
|
@@ -14392,39 +14388,39 @@
|
|
|
14392
14388
|
"parameterName": "actions",
|
|
14393
14389
|
"parameterTypeTokenRange": {
|
|
14394
14390
|
"startIndex": 1,
|
|
14395
|
-
"endIndex":
|
|
14391
|
+
"endIndex": 2
|
|
14396
14392
|
},
|
|
14397
14393
|
"isOptional": false
|
|
14398
14394
|
},
|
|
14399
14395
|
{
|
|
14400
14396
|
"parameterName": "overrideDef",
|
|
14401
14397
|
"parameterTypeTokenRange": {
|
|
14402
|
-
"startIndex":
|
|
14403
|
-
"endIndex":
|
|
14398
|
+
"startIndex": 3,
|
|
14399
|
+
"endIndex": 4
|
|
14404
14400
|
},
|
|
14405
14401
|
"isOptional": true
|
|
14406
14402
|
},
|
|
14407
14403
|
{
|
|
14408
14404
|
"parameterName": "customActionsOpenerName",
|
|
14409
14405
|
"parameterTypeTokenRange": {
|
|
14410
|
-
"startIndex":
|
|
14411
|
-
"endIndex":
|
|
14406
|
+
"startIndex": 5,
|
|
14407
|
+
"endIndex": 6
|
|
14412
14408
|
},
|
|
14413
14409
|
"isOptional": true
|
|
14414
14410
|
},
|
|
14415
14411
|
{
|
|
14416
14412
|
"parameterName": "isVertical",
|
|
14417
14413
|
"parameterTypeTokenRange": {
|
|
14418
|
-
"startIndex":
|
|
14419
|
-
"endIndex":
|
|
14414
|
+
"startIndex": 7,
|
|
14415
|
+
"endIndex": 8
|
|
14420
14416
|
},
|
|
14421
14417
|
"isOptional": true
|
|
14422
14418
|
},
|
|
14423
14419
|
{
|
|
14424
14420
|
"parameterName": "buttonAppearance",
|
|
14425
14421
|
"parameterTypeTokenRange": {
|
|
14426
|
-
"startIndex":
|
|
14427
|
-
"endIndex":
|
|
14422
|
+
"startIndex": 9,
|
|
14423
|
+
"endIndex": 10
|
|
14428
14424
|
},
|
|
14429
14425
|
"isOptional": true
|
|
14430
14426
|
}
|
|
@@ -15678,6 +15674,114 @@
|
|
|
15678
15674
|
],
|
|
15679
15675
|
"name": "getTextRendererTemplate"
|
|
15680
15676
|
},
|
|
15677
|
+
{
|
|
15678
|
+
"kind": "Function",
|
|
15679
|
+
"canonicalReference": "@genesislcap/grid-pro!getVerticalDropdownMenuDef:function(1)",
|
|
15680
|
+
"docComment": "/**\n * Helper function to get ColDef {@link https://www.ag-grid.com/javascript-data-grid/column-properties/} for a vertical Actions Menu behind an icon-only \"kebab\" opener, for a pinned column of per-row actions. Will take the parameter values for a base ColDef and merge them with the overrideDef (if specified).\n *\n * @remarks\n *\n * The opener hides itself on rows with no actions, so it never opens an empty menu. The column has a `colId` but no `field`: AG Grid only refreshes a cell with a field when its value changes, and this column has no value, so a row update would leave stale actions.\n *\n * @param actions - Array of `ActionMenuItem` to be displayed in the menu, or a function of the row data returning that array (for row-scoped eligibility/permission filtering).\n *\n * @param overrideDef - Optional override for the ColDef. Will override any of the default values. Default is an empty object.\n *\n * @param iconName - Optional icon name for the opener. Default is `'ellipsis'` (horizontal dots); pass `'ellipsis-vertical'` for vertical ones.\n *\n * @param buttonAppearance - Optional appearance for the button that opens the menu.\n *\n * @param hideDisabled - Optional flag to hide disabled actions instead of greying them out. Default is false. When every action for a row is hidden, the opener hides too.\n *\n * @returns Merged ColDef (base ColDef created from the parameters + overrideDef) for Actions Menu Renderer.\n *\n * @example\n * ```ts\n * public exampleMoreColumnDef: ColDef = getVerticalDropdownMenuDef(\n * (rowData) => [\n * { name: 'Ping Trader', icon: { name: 'paper-plane' }, callback: (rowData) => pingTrader(rowData) },\n * { name: 'Assign', icon: { name: 'user' }, callback: (rowData) => assign(rowData) },\n * ],\n * { headerName: '', pinned: 'right' },\n * );\n * ```\n *\n * @public\n */\n",
|
|
15681
|
+
"excerptTokens": [
|
|
15682
|
+
{
|
|
15683
|
+
"kind": "Content",
|
|
15684
|
+
"text": "getVerticalDropdownMenuDef: (actions: "
|
|
15685
|
+
},
|
|
15686
|
+
{
|
|
15687
|
+
"kind": "Reference",
|
|
15688
|
+
"text": "ActionMenuItems",
|
|
15689
|
+
"canonicalReference": "@genesislcap/foundation-ui!ActionMenuItems:type"
|
|
15690
|
+
},
|
|
15691
|
+
{
|
|
15692
|
+
"kind": "Content",
|
|
15693
|
+
"text": ", overrideDef?: "
|
|
15694
|
+
},
|
|
15695
|
+
{
|
|
15696
|
+
"kind": "Reference",
|
|
15697
|
+
"text": "ColDef",
|
|
15698
|
+
"canonicalReference": "@ag-grid-community/core!ColDef:interface"
|
|
15699
|
+
},
|
|
15700
|
+
{
|
|
15701
|
+
"kind": "Content",
|
|
15702
|
+
"text": ", iconName?: "
|
|
15703
|
+
},
|
|
15704
|
+
{
|
|
15705
|
+
"kind": "Content",
|
|
15706
|
+
"text": "string"
|
|
15707
|
+
},
|
|
15708
|
+
{
|
|
15709
|
+
"kind": "Content",
|
|
15710
|
+
"text": ", buttonAppearance?: "
|
|
15711
|
+
},
|
|
15712
|
+
{
|
|
15713
|
+
"kind": "Content",
|
|
15714
|
+
"text": "string"
|
|
15715
|
+
},
|
|
15716
|
+
{
|
|
15717
|
+
"kind": "Content",
|
|
15718
|
+
"text": ", hideDisabled?: "
|
|
15719
|
+
},
|
|
15720
|
+
{
|
|
15721
|
+
"kind": "Content",
|
|
15722
|
+
"text": "boolean"
|
|
15723
|
+
},
|
|
15724
|
+
{
|
|
15725
|
+
"kind": "Content",
|
|
15726
|
+
"text": ") => "
|
|
15727
|
+
},
|
|
15728
|
+
{
|
|
15729
|
+
"kind": "Reference",
|
|
15730
|
+
"text": "ColDef",
|
|
15731
|
+
"canonicalReference": "@ag-grid-community/core!ColDef:interface"
|
|
15732
|
+
}
|
|
15733
|
+
],
|
|
15734
|
+
"fileUrlPath": "src/cell-renderers/actions-menu.renderer.ts",
|
|
15735
|
+
"returnTypeTokenRange": {
|
|
15736
|
+
"startIndex": 11,
|
|
15737
|
+
"endIndex": 12
|
|
15738
|
+
},
|
|
15739
|
+
"releaseTag": "Public",
|
|
15740
|
+
"overloadIndex": 1,
|
|
15741
|
+
"parameters": [
|
|
15742
|
+
{
|
|
15743
|
+
"parameterName": "actions",
|
|
15744
|
+
"parameterTypeTokenRange": {
|
|
15745
|
+
"startIndex": 1,
|
|
15746
|
+
"endIndex": 2
|
|
15747
|
+
},
|
|
15748
|
+
"isOptional": false
|
|
15749
|
+
},
|
|
15750
|
+
{
|
|
15751
|
+
"parameterName": "overrideDef",
|
|
15752
|
+
"parameterTypeTokenRange": {
|
|
15753
|
+
"startIndex": 3,
|
|
15754
|
+
"endIndex": 4
|
|
15755
|
+
},
|
|
15756
|
+
"isOptional": true
|
|
15757
|
+
},
|
|
15758
|
+
{
|
|
15759
|
+
"parameterName": "iconName",
|
|
15760
|
+
"parameterTypeTokenRange": {
|
|
15761
|
+
"startIndex": 5,
|
|
15762
|
+
"endIndex": 6
|
|
15763
|
+
},
|
|
15764
|
+
"isOptional": true
|
|
15765
|
+
},
|
|
15766
|
+
{
|
|
15767
|
+
"parameterName": "buttonAppearance",
|
|
15768
|
+
"parameterTypeTokenRange": {
|
|
15769
|
+
"startIndex": 7,
|
|
15770
|
+
"endIndex": 8
|
|
15771
|
+
},
|
|
15772
|
+
"isOptional": true
|
|
15773
|
+
},
|
|
15774
|
+
{
|
|
15775
|
+
"parameterName": "hideDisabled",
|
|
15776
|
+
"parameterTypeTokenRange": {
|
|
15777
|
+
"startIndex": 9,
|
|
15778
|
+
"endIndex": 10
|
|
15779
|
+
},
|
|
15780
|
+
"isOptional": true
|
|
15781
|
+
}
|
|
15782
|
+
],
|
|
15783
|
+
"name": "getVerticalDropdownMenuDef"
|
|
15784
|
+
},
|
|
15681
15785
|
{
|
|
15682
15786
|
"kind": "Variable",
|
|
15683
15787
|
"canonicalReference": "@genesislcap/grid-pro!GRID_PRO_COLUMN_DRAG_BRIDGE_CONTEXT_KEY:var",
|
package/dist/grid-pro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ActionMenuItems } from '@genesislcap/foundation-ui';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
3
|
import { Binding } from '@microsoft/fast-element';
|
|
4
4
|
import { CaptureType } from '@microsoft/fast-element';
|
|
@@ -251,6 +251,7 @@ export declare class ActionsMenuRenderer extends FoundationElement implements IC
|
|
|
251
251
|
params: ICellRendererParams;
|
|
252
252
|
init(params: ICellRendererParams): void;
|
|
253
253
|
getGui(): HTMLElement;
|
|
254
|
+
/** Hands the latest row data to the menu, so per-row actions and disabled states stay current. */
|
|
254
255
|
refresh(params: ICellRendererParams): boolean;
|
|
255
256
|
}
|
|
256
257
|
|
|
@@ -3378,7 +3379,8 @@ declare class GenesisInfiniteDatasource implements IDatasource {
|
|
|
3378
3379
|
/**
|
|
3379
3380
|
* Helper function to get ColDef {@link https://www.ag-grid.com/javascript-data-grid/column-properties/} for Actions Menu Renderer.
|
|
3380
3381
|
* Will take the parameter values for a base ColDef and merge them with the overrideDef (if specified).
|
|
3381
|
-
* @param actions - Array of `ActionMenuItem` to be displayed in the menu
|
|
3382
|
+
* @param actions - Array of `ActionMenuItem` to be displayed in the menu, or a function of the row data
|
|
3383
|
+
* returning that array (for row-scoped eligibility/permission filtering).
|
|
3382
3384
|
* @param overrideDef - Optional override for the ColDef. Will override any of the default values. Default is an empty object.
|
|
3383
3385
|
* @param customActionsOpenerName - Optional custom name for the button that opens the menu. Default is '⋮'.
|
|
3384
3386
|
* @param isVertical - Optional flag to display the menu vertically. Default is false (displays the menu horizontally, follow the rowHeight).
|
|
@@ -3408,7 +3410,7 @@ declare class GenesisInfiniteDatasource implements IDatasource {
|
|
|
3408
3410
|
* ```
|
|
3409
3411
|
* @public
|
|
3410
3412
|
*/
|
|
3411
|
-
export declare const getActionsMenuDef: (actions:
|
|
3413
|
+
export declare const getActionsMenuDef: (actions: ActionMenuItems, overrideDef?: ColDef, customActionsOpenerName?: string, isVertical?: boolean, buttonAppearance?: string) => ColDef;
|
|
3412
3414
|
|
|
3413
3415
|
/**
|
|
3414
3416
|
* Get a Design System prefixed Checkbox template.
|
|
@@ -3572,6 +3574,35 @@ export declare const getTextFieldRendererTemplate: (designSystem?: string) => Vi
|
|
|
3572
3574
|
*/
|
|
3573
3575
|
export declare const getTextRendererTemplate: (designSystem?: string) => ViewTemplate<AgTextFieldRenderer, any>;
|
|
3574
3576
|
|
|
3577
|
+
/**
|
|
3578
|
+
* Helper function to get ColDef {@link https://www.ag-grid.com/javascript-data-grid/column-properties/} for a
|
|
3579
|
+
* vertical Actions Menu behind an icon-only "kebab" opener, for a pinned column of per-row actions.
|
|
3580
|
+
* Will take the parameter values for a base ColDef and merge them with the overrideDef (if specified).
|
|
3581
|
+
* @remarks The opener hides itself on rows with no actions, so it never opens an empty menu. The
|
|
3582
|
+
* column has a `colId` but no `field`: AG Grid only refreshes a cell with a field when its value
|
|
3583
|
+
* changes, and this column has no value, so a row update would leave stale actions.
|
|
3584
|
+
* @param actions - Array of `ActionMenuItem` to be displayed in the menu, or a function of the row data
|
|
3585
|
+
* returning that array (for row-scoped eligibility/permission filtering).
|
|
3586
|
+
* @param overrideDef - Optional override for the ColDef. Will override any of the default values. Default is an empty object.
|
|
3587
|
+
* @param iconName - Optional icon name for the opener. Default is `'ellipsis'` (horizontal dots); pass `'ellipsis-vertical'` for vertical ones.
|
|
3588
|
+
* @param buttonAppearance - Optional appearance for the button that opens the menu.
|
|
3589
|
+
* @param hideDisabled - Optional flag to hide disabled actions instead of greying them out. Default is false.
|
|
3590
|
+
* When every action for a row is hidden, the opener hides too.
|
|
3591
|
+
* @returns Merged ColDef (base ColDef created from the parameters + overrideDef) for Actions Menu Renderer.
|
|
3592
|
+
* @example
|
|
3593
|
+
* ```ts
|
|
3594
|
+
* public exampleMoreColumnDef: ColDef = getVerticalDropdownMenuDef(
|
|
3595
|
+
* (rowData) => [
|
|
3596
|
+
* { name: 'Ping Trader', icon: { name: 'paper-plane' }, callback: (rowData) => pingTrader(rowData) },
|
|
3597
|
+
* { name: 'Assign', icon: { name: 'user' }, callback: (rowData) => assign(rowData) },
|
|
3598
|
+
* ],
|
|
3599
|
+
* { headerName: '', pinned: 'right' },
|
|
3600
|
+
* );
|
|
3601
|
+
* ```
|
|
3602
|
+
* @public
|
|
3603
|
+
*/
|
|
3604
|
+
export declare const getVerticalDropdownMenuDef: (actions: ActionMenuItems, overrideDef?: ColDef, iconName?: string, buttonAppearance?: string, hideDisabled?: boolean) => ColDef;
|
|
3605
|
+
|
|
3575
3606
|
/** Context key on `gridOptions.context` for AG column drag integration.
|
|
3576
3607
|
* @public
|
|
3577
3608
|
*/
|
|
@@ -3863,6 +3894,15 @@ export declare class GridPro extends GridPro_base {
|
|
|
3863
3894
|
* @internal
|
|
3864
3895
|
*/
|
|
3865
3896
|
private processSchemaUpdate;
|
|
3897
|
+
/**
|
|
3898
|
+
* Fills the consumer's column defs with the sortability, filter and set-filter values the
|
|
3899
|
+
* schema knows and they left unset.
|
|
3900
|
+
* @remarks Reads `getGridOption('columnDefs')` - the defs as given - rather than
|
|
3901
|
+
* `getColumnDefs()`, which merges in `defaultColDef`, so an unset `sortable` would already read
|
|
3902
|
+
* as the datasource default.
|
|
3903
|
+
* @internal
|
|
3904
|
+
*/
|
|
3905
|
+
private enrichPresetColumnDefs;
|
|
3866
3906
|
/**
|
|
3867
3907
|
* Downgrades enterprise filters in metadata-generated colDefs when their modules are not
|
|
3868
3908
|
* registered — from v35 AG Grid throws on unregistered filters instead of falling back.
|