@pega/lists-core 10.0.0-build.4.2 → 10.0.0-build.4.21

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.
Files changed (78) hide show
  1. package/lib/src/core/RsStore.d.ts +10 -0
  2. package/lib/src/core/RsStore.d.ts.map +1 -1
  3. package/lib/src/core/RsStore.js +2 -0
  4. package/lib/src/core/RsStore.js.map +1 -1
  5. package/lib/src/core/StateResolver.js +1 -1
  6. package/lib/src/core/StateResolver.js.map +1 -1
  7. package/lib/src/core/actions/actions.d.ts +1 -1
  8. package/lib/src/core/actions/actions.d.ts.map +1 -1
  9. package/lib/src/core/actions/actions.js +3 -3
  10. package/lib/src/core/actions/actions.js.map +1 -1
  11. package/lib/src/core/actions/actions.types.d.ts +1 -1
  12. package/lib/src/core/actions/actions.types.d.ts.map +1 -1
  13. package/lib/src/core/constants.d.ts +1 -0
  14. package/lib/src/core/constants.d.ts.map +1 -1
  15. package/lib/src/core/constants.js +1 -0
  16. package/lib/src/core/constants.js.map +1 -1
  17. package/lib/src/core/features/uIFeatures/afterRender/animation.d.ts +1 -1
  18. package/lib/src/core/features/uIFeatures/afterRender/animation.js +2 -2
  19. package/lib/src/core/features/uIFeatures/afterRender/animation.js.map +1 -1
  20. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts +2 -2
  21. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts.map +1 -1
  22. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js +5 -5
  23. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js.map +1 -1
  24. package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.d.ts +1 -1
  25. package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js +1 -1
  26. package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js.map +1 -1
  27. package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js +2 -2
  28. package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js.map +1 -1
  29. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts.map +1 -1
  30. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js +2 -1
  31. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js.map +1 -1
  32. package/lib/src/core/features/uIFeatures/beforeRender/grouping.d.ts +5 -0
  33. package/lib/src/core/features/uIFeatures/beforeRender/grouping.d.ts.map +1 -1
  34. package/lib/src/core/features/uIFeatures/beforeRender/grouping.js +195 -23
  35. package/lib/src/core/features/uIFeatures/beforeRender/grouping.js.map +1 -1
  36. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts.map +1 -1
  37. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js +9 -2
  38. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js.map +1 -1
  39. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts.map +1 -1
  40. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js +21 -15
  41. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js.map +1 -1
  42. package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -1
  43. package/lib/src/core/generators/ViewGenerator.d.ts.map +1 -1
  44. package/lib/src/core/generators/ViewGenerator.js +4 -3
  45. package/lib/src/core/generators/ViewGenerator.js.map +1 -1
  46. package/lib/src/core/generators/ViewGenerator.types.d.ts +2 -0
  47. package/lib/src/core/generators/ViewGenerator.types.d.ts.map +1 -1
  48. package/lib/src/core/generators/ViewGenerator.types.js.map +1 -1
  49. package/lib/src/core/reducers/error.d.ts.map +1 -1
  50. package/lib/src/core/reducers/index.d.ts.map +1 -1
  51. package/lib/src/core/reducers/personalizationDirtyReducer.d.ts.map +1 -1
  52. package/lib/src/core/reducers/personalizationDirtyReducer.js +18 -3
  53. package/lib/src/core/reducers/personalizationDirtyReducer.js.map +1 -1
  54. package/lib/src/core/reducers/personalizationReducer.d.ts +1 -1
  55. package/lib/src/core/reducers/visibility.d.ts.map +1 -1
  56. package/lib/src/core/reducers/visibility.js +5 -3
  57. package/lib/src/core/reducers/visibility.js.map +1 -1
  58. package/lib/src/core/utils/util.d.ts +22 -5
  59. package/lib/src/core/utils/util.d.ts.map +1 -1
  60. package/lib/src/core/utils/util.js +75 -18
  61. package/lib/src/core/utils/util.js.map +1 -1
  62. package/lib/types/ApiContext.types.d.ts +8 -4
  63. package/lib/types/ApiContext.types.d.ts.map +1 -1
  64. package/lib/types/ApiContext.types.js +2 -1
  65. package/lib/types/ApiContext.types.js.map +1 -1
  66. package/lib/types/Meta.types.d.ts +123 -64
  67. package/lib/types/Meta.types.d.ts.map +1 -1
  68. package/lib/types/Meta.types.js +2 -1
  69. package/lib/types/Meta.types.js.map +1 -1
  70. package/lib/types/RsCoreBootArgs.types.d.ts +1 -1
  71. package/lib/types/RsCoreBootArgs.types.js.map +1 -1
  72. package/lib/types/State.types.d.ts +2 -1
  73. package/lib/types/State.types.d.ts.map +1 -1
  74. package/lib/types/State.types.js.map +1 -1
  75. package/lib/types.d.ts +2 -1
  76. package/lib/types.d.ts.map +1 -1
  77. package/lib/types.js.map +1 -1
  78. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { getGroupKey, getGroupFromKey, withMemoization, compareArray, dateFunctionLabels, deepCopy, isEmpty } from '../../../utils/util';
1
+ import { getGroupKey, getGroupFromKey, isKanbanTemplate, withMemoization, compareArray, dateFunctionLabels, deepCopy, isEmpty } from '../../../utils/util';
2
2
  import { actionGroupingExpandCollapseAll } from '../../../actions/actions';
3
3
  import { AFTER_FETCH } from '../../../pubSub/events';
4
4
  import { REPEATING_STRUCTURE_TEMPLATES } from '../../../../../types/Meta.types';
@@ -20,6 +20,105 @@ const getLabel = (view, groupBy, getState) => {
20
20
  }
21
21
  return label;
22
22
  };
23
+ /**
24
+ * Creates a cache key for the Kanban lane group.
25
+ *
26
+ * @param laneGroup - Level-0 group that defines the Kanban lanes.
27
+ * @returns A key that identifies the current lane source.
28
+ */
29
+ function getKanbanLaneSourceKey(laneGroup) {
30
+ return `${getGroupKey(laneGroup)}:${laneGroup.order}`;
31
+ }
32
+ /**
33
+ * Builds the complete Kanban lane catalog from text custom grouping.
34
+ *
35
+ * Includes the aggregate ungrouped lane and applies the resolved lane order.
36
+ *
37
+ * @param laneGroup - Level-0 group that may define text custom lanes.
38
+ * @param sourceKey - Cache key for the resulting lane catalog.
39
+ * @returns The custom lane catalog, or `undefined` for non-text grouping.
40
+ */
41
+ function getKanbanLaneInfoFromCustomGrouping(laneGroup, sourceKey) {
42
+ const customGrouping = laneGroup.customFunction;
43
+ // Kanban lanes only support text custom grouping (enforced during meta normalization).
44
+ if (customGrouping?.type !== 'TEXT_GROUPING')
45
+ return undefined;
46
+ const names = customGrouping.groups.map(group => group.label);
47
+ if (customGrouping.ungrouped.mode === 'aggregate') {
48
+ names.push(customGrouping.ungrouped.label);
49
+ }
50
+ if (laneGroup.order === 'asc') {
51
+ names.sort((first, second) => first.localeCompare(second));
52
+ }
53
+ else if (laneGroup.order === 'desc') {
54
+ names.sort((first, second) => second.localeCompare(first));
55
+ }
56
+ return {
57
+ sourceKey,
58
+ lanes: names
59
+ };
60
+ }
61
+ function getApiOptions(rsStore) {
62
+ return {
63
+ ...(rsStore.refreshInProgress && {
64
+ invalidateCache: true,
65
+ invalidateCacheToken: rsStore.refreshToken
66
+ })
67
+ };
68
+ }
69
+ /**
70
+ * Creates grouping information for a lane with no matching records.
71
+ *
72
+ * @param name - Lane name.
73
+ * @returns Empty grouping information for the lane.
74
+ */
75
+ function createEmptyLaneGroup(name, laneGroup) {
76
+ return {
77
+ name,
78
+ count: 0,
79
+ groupBy: getGroupKey(laneGroup),
80
+ level: laneGroup.level,
81
+ hierarchy: name === null ? [] : [name],
82
+ data: {},
83
+ additionalFieldsData: [],
84
+ agg: {},
85
+ children: []
86
+ };
87
+ }
88
+ /**
89
+ * Merges the current top-level lane groups with the complete lane catalog.
90
+ *
91
+ * @param groupingInfo - Grouping information returned for the current state.
92
+ * @param laneInfo - Complete lane catalog.
93
+ * @param laneGroup - The level-0 group that defines the Kanban lanes.
94
+ * @returns Top-level lane groups in catalog order.
95
+ */
96
+ function mergeKanbanGroupingInfo(groupingInfo, laneInfo, laneGroup) {
97
+ const laneKey = (value) => (value instanceof Date ? value.getTime() : value);
98
+ const groupsByLaneKey = new Map(groupingInfo.map(group => [laneKey(group.name), group]));
99
+ return laneInfo.lanes.map(name => groupsByLaneKey.get(laneKey(name)) ?? createEmptyLaneGroup(name, laneGroup));
100
+ }
101
+ /**
102
+ * Processes grouping information for the active template.
103
+ *
104
+ * For Kanban, merges the grouped result with the matching cached lane catalog.
105
+ * Returns the input unchanged when no matching Kanban lane catalog is available.
106
+ *
107
+ * @param groupingInfo - Grouping information returned for the current state.
108
+ * @param meta - Metadata for the current view.
109
+ * @param groups - Active grouping definitions.
110
+ * @param rsStore - Repeating-structure store containing the lane catalog.
111
+ * @returns Processed grouping information.
112
+ */
113
+ function processGroupingInfo(groupingInfo, meta, groups, rsStore) {
114
+ if (!isKanbanTemplate(meta) || !rsStore.kanbanLaneInfo)
115
+ return groupingInfo;
116
+ const laneGroup = groups?.[0];
117
+ if (!laneGroup || rsStore.kanbanLaneInfo.sourceKey !== getKanbanLaneSourceKey(laneGroup)) {
118
+ return groupingInfo;
119
+ }
120
+ return mergeKanbanGroupingInfo(groupingInfo, rsStore.kanbanLaneInfo, laneGroup);
121
+ }
23
122
  // This function checks if hierarchy exists or not.
24
123
  // which will decide whether start and end Index would be there on the leaf node or on the hierarchical node.
25
124
  const doesExistInViewInfo = (viewInfo, hierarchy = [], isHierarchical = false) => {
@@ -126,6 +225,21 @@ function includeGroup(group, groupFrom, groupTo, parentGroups, groupFilters) {
126
225
  group.groupTo = groupTo;
127
226
  groupFilters.push({ groupFrom, groupTo, filters: parentGroups });
128
227
  }
228
+ export function includeAllLeafGroups(group, parentGroup, groupFilters) {
229
+ group.forEach(groupInfo => {
230
+ const parentGroups = { ...parentGroup };
231
+ const currentGroup = groupInfo;
232
+ if (currentGroup.groupBy) {
233
+ parentGroups[currentGroup.groupBy] = currentGroup.name;
234
+ }
235
+ if (groupInfo.children?.length) {
236
+ includeAllLeafGroups(groupInfo.children, parentGroups, groupFilters);
237
+ }
238
+ else if (groupInfo.count > 0) {
239
+ includeGroup(groupInfo, 0, groupInfo.count, parentGroups, groupFilters);
240
+ }
241
+ });
242
+ }
129
243
  function getRecordsCount(group, count, includedRowCount, parentGroup, from, to, groupFilters, groupToggle, allGroupsExpanded, state, getView) {
130
244
  const { aggregationInfo } = state;
131
245
  // Timeline view manages visual collapse independently; rows must always be
@@ -202,7 +316,12 @@ function getRecordsCount(group, count, includedRowCount, parentGroup, from, to,
202
316
  }
203
317
  const constructGroupingPagination = (groupingInfo, groupToggle, paginationOptions, allGroupsExpanded, state, getView) => {
204
318
  const groupFilters = [];
205
- getRecordsCount(groupingInfo, 0, 0, {}, paginationOptions.startIndex, paginationOptions.endIndex, groupFilters, groupToggle, allGroupsExpanded, state, getView);
319
+ if (!paginationOptions) {
320
+ includeAllLeafGroups(groupingInfo, {}, groupFilters);
321
+ }
322
+ else {
323
+ getRecordsCount(groupingInfo, 0, 0, {}, paginationOptions.startIndex, paginationOptions.endIndex, groupFilters, groupToggle, allGroupsExpanded, state, getView);
324
+ }
206
325
  return groupFilters;
207
326
  };
208
327
  // This is basically used to update count on non-leaf node.
@@ -254,19 +373,21 @@ async function onGroupsChange([{ getRsProps, getRsStore, getView, getState }]) {
254
373
  const rsProps = getRsProps();
255
374
  const state = getState();
256
375
  const { groups } = state;
257
- if (groups?.length > 0 && getView().meta.grouping) {
376
+ const meta = getView().meta;
377
+ if (groups && groups.length > 0 && meta.grouping) {
258
378
  try {
259
- const groupingInfo = (await rsProps.apiContext.fetchGroupedInfo?.(deepCopy(state), getView().meta, {
379
+ const groupingInfo = (await rsProps.apiContext.fetchGroupedInfo?.(deepCopy(state), meta, {
260
380
  ...(getRsStore().refreshInProgress && {
261
381
  invalidateCache: true,
262
382
  invalidateCacheToken: getRsStore().refreshToken
263
383
  })
264
384
  })) || [];
385
+ const processedGroupingInfo = processGroupingInfo(groupingInfo, meta, groups, rsStore);
265
386
  // Here update group info with basic properties like level, group by, expand state etc.
266
387
  // to make calculation easy.
267
388
  // TODO: FIXME - Check if count on non leaf node is required
268
- updateCountOnNonLeafNode(groupingInfo);
269
- rsStore.groupingInfo = updateGroupInfo(groupingInfo, groups);
389
+ updateCountOnNonLeafNode(processedGroupingInfo);
390
+ rsStore.groupingInfo = updateGroupInfo(processedGroupingInfo, groups);
270
391
  // FIXME: once infinite virtualizer supports the grouping, we need not compute the count from grouping
271
392
  // Prepare the count from the groups count until the actual count returns
272
393
  updateCountFromGroupingInfo(getView, getRsStore);
@@ -283,6 +404,55 @@ async function onGroupsChange([{ getRsProps, getRsStore, getView, getState }]) {
283
404
  column = column.setProp('grouped', grouped);
284
405
  });
285
406
  }
407
+ /**
408
+ * Loads the complete Kanban lane catalog before grouped data is processed.
409
+ *
410
+ * @param featureProps - Dependencies for the grouping feature.
411
+ * @returns A promise that resolves after the lane information is stored.
412
+ */
413
+ async function loadKanbanLaneInfo([featureProps]) {
414
+ const { getRsProps, getRsStore, getState, getView } = featureProps;
415
+ const meta = getView().meta;
416
+ if (!isKanbanTemplate(meta))
417
+ return;
418
+ const state = getState();
419
+ // Wait for state hydration to add the level-0 lane group.
420
+ const groups = state.groups ?? [];
421
+ const laneGroup = groups[0];
422
+ if (!laneGroup)
423
+ return;
424
+ try {
425
+ const rsStore = getRsStore();
426
+ const sourceKey = getKanbanLaneSourceKey(laneGroup);
427
+ const customLaneInfo = getKanbanLaneInfoFromCustomGrouping(laneGroup, sourceKey);
428
+ // Custom text grouping defines the complete lanes within the grouping definition.
429
+ if (customLaneInfo) {
430
+ rsStore.kanbanLaneInfo = customLaneInfo;
431
+ return;
432
+ }
433
+ // Reuse the catalog unless a force refresh needs the latest lane domain.
434
+ if (rsStore.kanbanLaneInfo?.sourceKey === sourceKey && !rsStore.refreshInProgress)
435
+ return;
436
+ // Fetch and cache the complete default lane catalog.
437
+ const laneField = laneGroup.columnId;
438
+ const values = laneField
439
+ ? (await getRsProps().apiContext.fetchUniqueColValues?.(deepCopy({
440
+ ...state,
441
+ filterExpression: undefined,
442
+ groups: undefined,
443
+ search: undefined
444
+ }), meta, laneField, getApiOptions(rsStore))) ?? []
445
+ : [];
446
+ rsStore.kanbanLaneInfo = {
447
+ sourceKey,
448
+ lanes: values
449
+ };
450
+ }
451
+ catch (err) {
452
+ // eslint-disable-next-line no-console
453
+ console.error('API call failed', err);
454
+ }
455
+ }
286
456
  function autoExpandGroups([{ dispatch, getState }]) {
287
457
  const { allGroupsExpanded = true } = getState();
288
458
  dispatch(actionGroupingExpandCollapseAll(allGroupsExpanded));
@@ -366,13 +536,17 @@ const getTotalItemCount = (getView, state, groupingInfo) => {
366
536
  };
367
537
  const updateGroupFilters = ([{ getState, getRsStore, getView }]) => {
368
538
  const { paginationOptions, groupToggle, allGroupsExpanded } = getState();
539
+ // Kanban does not have paginationOptions. It should build all the groupFilters.
540
+ // For other templates, if paginationOptions is not present, then we should not build groupFilters.
541
+ if (!paginationOptions && getView().meta.template !== REPEATING_STRUCTURE_TEMPLATES.KANBAN)
542
+ return;
369
543
  const rsStore = getRsStore();
370
544
  const { groupingInfo } = rsStore;
371
545
  // group info is expected to be [] when there are no groups.
372
546
  if (groupingInfo) {
373
547
  if (!groupingInfo.length && rsStore.groupFilters && !rsStore.groupFilters.length)
374
548
  return;
375
- rsStore.groupFilters = constructGroupingPagination(groupingInfo, groupToggle, paginationOptions.rootVirtualiser, allGroupsExpanded, getState(), getView);
549
+ rsStore.groupFilters = constructGroupingPagination(groupingInfo, groupToggle, paginationOptions?.rootVirtualiser, allGroupsExpanded, getState(), getView);
376
550
  }
377
551
  };
378
552
  function postFetch(rsInternal, memoizedPrepareGroupHeaders) {
@@ -411,6 +585,7 @@ function postFetch(rsInternal, memoizedPrepareGroupHeaders) {
411
585
  */
412
586
  export default (rsInternal) => {
413
587
  const memoizedOnGroupsChange = withMemoization(onGroupsChange);
588
+ const memoizedLoadKanbanLaneInfo = withMemoization(loadKanbanLaneInfo);
414
589
  const memorizeOnHierarchicalGroupChange = withMemoization(onHierarchicalGroupChange);
415
590
  const memoizedUpdateGroupFilters = withMemoization(updateGroupFilters);
416
591
  const memoizedAutoExpandGroups = withMemoization(autoExpandGroups);
@@ -422,6 +597,7 @@ export default (rsInternal) => {
422
597
  async function execute(featureProps) {
423
598
  const { getState, getRsStore } = featureProps;
424
599
  const state = getState();
600
+ await memoizedLoadKanbanLaneInfo([featureProps], [state.groups, state.refresh]);
425
601
  // TOdo: Fixme ISSUE-76344... try to not rely on state.personalization?.active
426
602
  await memoizedOnGroupsChange([featureProps], [
427
603
  state.groups,
@@ -442,23 +618,19 @@ export default (rsInternal) => {
442
618
  ]);
443
619
  // In the new grouping, update group info in state.
444
620
  // Action dispatched for group info will prepare group headers.
445
- if (state.paginationOptions) {
446
- // TODO: use this comparator for optimization but isVisible calculated prop on grouping info needs to be handled.ISSUE-80012
447
- // const comparator =(prev, next) => {
448
- // if (prev[1] !== next[1] || prev[3] !== next[3]) return false;
449
- // return compareArray(prev[2], next[2], ['children', 'count', 'name']);
450
- // };
451
- memoizedUpdateGroupFilters([featureProps], [
452
- state.paginationOptions[Object.keys(state.paginationOptions || {})[0]],
453
- getRsStore().groupingInfo,
454
- state.groupToggle,
455
- state.allGroupsExpanded
456
- ]);
457
- }
621
+ // TODO: use this comparator for optimization but isVisible calculated prop on grouping info needs to be handled.ISSUE-80012
622
+ // const comparator =(prev, next) => {
623
+ // if (prev[1] !== next[1] || prev[3] !== next[3]) return false;
624
+ // return compareArray(prev[2], next[2], ['children', 'count', 'name']);
625
+ // };
626
+ memoizedUpdateGroupFilters([featureProps], [
627
+ state.paginationOptions?.[Object.keys(state.paginationOptions || {})[0]],
628
+ getRsStore().groupingInfo,
629
+ state.groupToggle,
630
+ state.allGroupsExpanded
631
+ ]);
458
632
  }
459
- // As we are generating one flow, this is required. TODO: Need to take decision
460
- // conditional block on UI or feature push though not enabled.
461
- if (rsInternal.getView().meta.grouping) {
633
+ if (rsInternal.getView().meta.grouping || isKanbanTemplate(rsInternal.getView().meta)) {
462
634
  return execute;
463
635
  }
464
636
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/grouping.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAqChE,SAAS,cAAc,CACrB,WAAoC,EACpC,IAA6C,EAC7C,YAAiC;IAEjC,oDAAoD;IACpD,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC,IAAI,CAAC,OAAQ,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,SAAU,CAAC,CAAC,CAAC;IACjG,MAAM,gBAAgB,GAAG,KAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IACtE,OAAO,gBAAgB,KAAK,IAAI,CAAC;AACnC,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAE,OAAe,EAAE,QAA8C,EAAE,EAAE;IAC/F,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,eAAe,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AAW;gBACjB,KAAK,CAAC,iBAAiB;aACxB,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,+EAA+E;IAC/E,8DAA8D;IAC9D,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n getGroupKey,\n getGroupFromKey,\n withMemoization,\n compareArray,\n dateFunctionLabels,\n deepCopy,\n isEmpty\n} from '../../../utils/util';\nimport { actionGroupingExpandCollapseAll } from '../../../actions/actions';\nimport { AFTER_FETCH } from '../../../pubSub/events';\nimport type RsInternal from '../../../RsInternal';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport type { MemoizedFunction } from '../../../utils/util.types';\nimport type { Group, GroupFilter, GroupToggle, State } from '../../../../../types/State.types';\nimport type { HierarchicalInfo } from '../../../../../types/Meta.types';\nimport { REPEATING_STRUCTURE_TEMPLATES } from '../../../../../types/Meta.types';\nimport GroupGenerator from '../../../generators/GroupGenerator';\nimport type View from '../../../generators/ViewGenerator';\nimport type RsStore from '../../../RsStore';\nimport type {\n GroupedInfo,\n HierarchicalGroupedInfo,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ApiContext\n} from '../../../../../types/ApiContext.types';\n\nexport interface CommonGroupingInfo {\n /** Id of the field on which grouping is applied. */\n groupBy: string;\n /** Current group level, starts with 0 for 1st level of grouping. */\n level: number;\n /** Path of the grouped column value. */\n hierarchy: (string | number | boolean | Date)[];\n visibleRow?: boolean;\n showHierarchicalFooter?: boolean;\n groupFrom?: number;\n groupTo?: number;\n isHierarchical?: boolean;\n}\n\nexport type GroupingInfo = OmitStrict<GroupedInfo, 'children'> &\n CommonGroupingInfo & {\n children?: GroupingInfo[];\n };\n\nexport type HierarchicalGroupingInfo = OmitStrict<HierarchicalGroupedInfo, 'children'> &\n CommonGroupingInfo & {\n children?: HierarchicalGroupingInfo[];\n parentId?: string;\n targetId?: string;\n name?: null | string | number | boolean | Date;\n };\n\nfunction isNodeExpanded(\n groupToggle: GroupToggle | undefined,\n node: GroupingInfo | HierarchicalGroupingInfo,\n defaultState: boolean | undefined\n): boolean {\n /** Groups with count 0 should not be expandable. */\n if (node.count === 0) {\n return false;\n }\n\n const index = groupToggle?.[node.groupBy!]?.findIndex(gct => compareArray(gct, node.hierarchy!));\n const childToggleState = index! >= 0 ? !defaultState : !!defaultState;\n return childToggleState === true;\n}\n\nconst getLabel = (view: View, groupBy: string, getState: BeforeRenderFeatureProps['getState']) => {\n const { columnId, dateFunction } = getGroupFromKey(groupBy, getState().groups)!;\n let { label } = view.columns!.find(column => column.field.id.toString() === columnId.toString())!;\n if (dateFunction) {\n label += ` (${dateFunctionLabels[dateFunction]})`;\n }\n return label;\n};\n\n// This function checks if hierarchy exists or not.\n// which will decide whether start and end Index would be there on the leaf node or on the hierarchical node.\nconst doesExistInViewInfo = (\n viewInfo: GroupFilter[],\n hierarchy: (string | number | boolean | Date)[] = [],\n isHierarchical = false\n) => {\n return viewInfo.some(v => {\n const filters = Object.values(v.filters);\n\n if (isHierarchical) {\n return filters.every(value => value === [...hierarchy].pop());\n }\n\n if (filters.length === hierarchy.length) {\n const tempHierarchy = [...hierarchy];\n // eslint-disable-next-line @typescript-eslint/require-array-sort-compare\n tempHierarchy.sort();\n // eslint-disable-next-line @typescript-eslint/require-array-sort-compare\n return filters.sort().every((value, index) => value === tempHierarchy[index]);\n }\n return false;\n });\n};\n\nconst prepareGroupHeaders = (\n props: [\n groupingInfo: RsStore['groupingInfo'],\n groupFilters: RsStore['groupFilters'],\n rsInternal: RsInternal,\n groupToggle?: State['groupToggle'],\n allGroupsExpanded?: boolean\n ]\n) => {\n const [groupingInfo = [], viewInfo = [], rsInternal, groupToggle = {}, allGroupsExpanded] = props;\n\n // If group and viewInfo are empty, prepare group header for top level leaf node.\n // This is for easing on UI , one contract whether grouping is in place/not.\n // TODO: support for enabling feature on view.\n const view = rsInternal.getView();\n const { getState } = rsInternal.getRsStateResolver();\n // Timeline view manages visual collapse independently; rows must always be\n // included in groupFilters so that rows.length stays accurate for infinite-scroll pagination.\n const isTimelineView = view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE;\n if (groupingInfo.length === 0) {\n // construct a view header object.\n\n const viewHeader = new GroupGenerator(\n {\n isVisible: false,\n isLeafNode: true,\n isExpanded: true,\n name: '',\n groupBy: '',\n level: 0,\n label: '',\n hierarchy: [],\n count: view.rows!.length\n },\n rsInternal\n );\n viewHeader.startIndex = 0;\n viewHeader.endIndex = view.rows ? view.rows.length : 0;\n view.setProp('groupHeaders', [viewHeader]);\n return;\n }\n // Creating flat objects from view group info using DFT.\n const result = [];\n let counter = 0;\n\n const stack = groupingInfo.map(v => ({ ...v }));\n let leafNodeCountInView = 0;\n let lastDataIndex = 0;\n while (stack.length) {\n const child = stack.shift();\n if (child) {\n const isExpanded = isNodeExpanded(groupToggle, child, allGroupsExpanded);\n const isSubGroupPresent = child.children && child.children.length;\n const label = child.isHierarchical ? '' : getLabel(view, child.groupBy!, getState);\n // construct a view header object.\n const viewHeader = new GroupGenerator(\n {\n isVisible: !!child.visibleRow,\n isLeafNode: !isSubGroupPresent,\n isExpanded,\n name: child.name!,\n groupBy: child.groupBy,\n level: child.level,\n label: label!,\n hierarchy: child.hierarchy,\n count: child.count,\n aggregation: child.agg,\n showHierarchicalFooter: child.showHierarchicalFooter,\n isHierarchical: child.isHierarchical,\n info: 'info' in child ? child.info : undefined,\n data: 'data' in child ? child.data : undefined,\n additionalFieldsData:\n 'additionalFieldsData' in child ? child.additionalFieldsData : undefined\n },\n rsInternal\n );\n // If the header node is a leaf node, then, add start index and endIndex to resolve data.\n if (\n (viewHeader.isLeafNode || viewHeader.isHierarchical) &&\n (viewHeader.isExpanded || isTimelineView) &&\n doesExistInViewInfo(viewInfo, viewHeader.hierarchy, viewHeader.isHierarchical)\n ) {\n const { groupFrom, groupTo } = viewInfo[leafNodeCountInView] || {};\n if (groupFrom >= 0 && groupTo >= 0) {\n viewHeader.startIndex = lastDataIndex;\n viewHeader.endIndex = viewHeader.startIndex + groupTo - groupFrom;\n lastDataIndex = viewHeader.endIndex;\n leafNodeCountInView += 1;\n }\n }\n // BUG-775861 - Adding index to visible groupHeaders so that this can be used to set the z-index for groupHeaders\n if (viewHeader.isVisible) {\n viewHeader.index = counter;\n counter += 1;\n }\n result.push(viewHeader);\n if ((isExpanded || (child.count > 0 && isTimelineView)) && isSubGroupPresent) {\n stack.unshift(...child.children!);\n }\n }\n }\n view.setProp('groupHeaders', result);\n};\n\nfunction includeGroup(\n group: GroupingInfo | HierarchicalGroupingInfo,\n groupFrom: number,\n groupTo: number,\n parentGroups: Record<string, any>,\n groupFilters: GroupFilter[]\n) {\n group.groupFrom = groupFrom;\n group.groupTo = groupTo;\n groupFilters.push({ groupFrom, groupTo, filters: parentGroups });\n}\n\nfunction getRecordsCount(\n group: NonNullable<RsStore['groupingInfo']>,\n count: number,\n includedRowCount: number,\n parentGroup: Record<string, any>,\n from: number,\n to: number,\n groupFilters: GroupFilter[],\n groupToggle: GroupToggle | undefined,\n allGroupsExpanded: boolean | undefined,\n state: State,\n getView: BeforeRenderFeatureProps['getView']\n): [count: number, includedRowCount: number] {\n const { aggregationInfo } = state;\n // Timeline view manages visual collapse independently; rows must always be\n // included in groupFilters so that rows.length stays accurate for infinite-scroll pagination.\n const isTimelineView = getView().meta.template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE;\n\n for (let i = 0; i < group.length; i += 1) {\n const parentGroups = { ...parentGroup };\n if (group[i].isHierarchical) {\n const currentGroup = group[i] as HierarchicalGroupingInfo;\n parentGroups[currentGroup.parentId!] = currentGroup.info![currentGroup.targetId!];\n } else {\n const currentGroup = group![i] as GroupingInfo;\n parentGroups[currentGroup.groupBy!] = currentGroup.name;\n }\n count += 1;\n // the group has subgroups and a group is expanded\n const isExpanded = isNodeExpanded(groupToggle, group[i], allGroupsExpanded);\n let includeThisGroup = false;\n if (count > from && count - 1 <= to) {\n includeThisGroup = true;\n includedRowCount += 1;\n }\n group[i].visibleRow = includeThisGroup;\n // Footer should be shown only if the node expands.\n // groupToggle will affect footer visibility so reset a footer flag.\n group[i].showHierarchicalFooter = false;\n\n if (group[i].children && (isExpanded || (group[i].count > 0 && isTimelineView))) {\n [count, includedRowCount] = getRecordsCount(\n group[i].children!,\n count,\n includedRowCount,\n parentGroups,\n from,\n to,\n groupFilters,\n groupToggle,\n allGroupsExpanded,\n state,\n getView\n );\n group[i].visibleRow =\n group[i].visibleRow ||\n !!group[i].children!.find(g => g.visibleRow && (g.isHierarchical || !g.children));\n } else if (!group[i].children && (isExpanded || (group[i].count > 0 && isTimelineView))) {\n // the group doesn't have subgroups and the group is expanded\n const innerCount = count + group[i].count;\n if (count <= to) {\n let groupFrom = 0;\n let groupTo = 0;\n if (innerCount >= from) {\n groupFrom = Math.max(from - count, 0);\n if (innerCount <= to + 1) {\n groupTo = group[i].count;\n } else {\n groupTo = groupFrom + (to + 1 - from - includedRowCount);\n }\n group[i].visibleRow = true;\n let updatedGroupFrom = groupFrom;\n // Sticky group header logic\n if (!includeThisGroup && groupTo > groupFrom + 2) {\n if (group[i].level! >= 1) {\n updatedGroupFrom = groupFrom + 2;\n } else {\n updatedGroupFrom = groupFrom + 1;\n }\n }\n includeGroup(group[i], updatedGroupFrom, groupTo, parentGroups, groupFilters);\n }\n includedRowCount += groupTo - groupFrom;\n }\n count = innerCount;\n }\n\n if (group[i].isHierarchical && aggregationInfo && aggregationInfo.length > 0 && isExpanded) {\n count += 1;\n group[i].showHierarchicalFooter = true;\n\n if (group[i].visibleRow && includedRowCount <= to) {\n includedRowCount += 1;\n }\n }\n }\n return [count, includedRowCount];\n}\n\nconst constructGroupingPagination = (\n groupingInfo: NonNullable<RsStore['groupingInfo']>,\n groupToggle: GroupToggle | undefined,\n paginationOptions: NonNullable<State['paginationOptions']>[keyof NonNullable<\n State['paginationOptions']\n >],\n allGroupsExpanded: boolean | undefined,\n state: State,\n getView: BeforeRenderFeatureProps['getView']\n) => {\n const groupFilters: GroupFilter[] = [];\n getRecordsCount(\n groupingInfo,\n 0,\n 0,\n {},\n paginationOptions.startIndex,\n paginationOptions.endIndex,\n groupFilters,\n groupToggle,\n allGroupsExpanded,\n state,\n getView\n );\n return groupFilters;\n};\n\n// This is basically used to update count on non-leaf node.\n// which is the sum of count of leaf node children in their hierarchy.\nfunction updateCountOnNonLeafNode(groupingInfo: GroupedInfo[]) {\n const updateCount = (child: GroupedInfo) => {\n if (child.count !== undefined) return child.count;\n child.count = child.children!.reduce((acc, c) => {\n acc += updateCount(c)!;\n return acc;\n }, 0);\n };\n groupingInfo.forEach(g => updateCount(g));\n}\n\nfunction updateGroupInfo(groupingInfo: GroupedInfo[], groups: Group[]): GroupingInfo[] {\n // iterate groupingInfo using BFS and update basic information.\n const queue = [...groupingInfo] as GroupingInfo[];\n while (queue.length) {\n const child = queue.pop();\n if (child) {\n if (!child.hierarchy) child.hierarchy = [child.name!];\n child.level = child.level || 0;\n const matchingGroup = groups.find(g => g.level === child.level);\n child.groupBy = getGroupKey(matchingGroup!);\n\n if (child.children) {\n // update level before pushing children to queue.\n child.children.forEach(c => {\n c.level = child.level + 1;\n c.hierarchy = [...child.hierarchy];\n c.hierarchy.push(c.name!);\n });\n queue.push(...child.children);\n }\n }\n }\n return groupingInfo as GroupingInfo[];\n}\n\nfunction updateCountFromGroupingInfo(\n getView: BeforeRenderFeatureProps['getView'],\n getRsStore: BeforeRenderFeatureProps['getRsStore']\n) {\n if (getView().countGeneratedInternally || isEmpty(getView().resultsCount)) {\n const countFromGroupingInfo = getRsStore().groupingInfo?.reduce(\n (acc, group) => (group.count ? acc + group.count : acc),\n 0\n );\n\n const countPayload = { count: countFromGroupingInfo, _countGeneratedInternally: true };\n getView().type.setRecordCount(countPayload);\n }\n}\n\nasync function onGroupsChange([{ getRsProps, getRsStore, getView, getState }]: [\n featureProps: BeforeRenderFeatureProps\n]) {\n const rsStore = getRsStore();\n const rsProps = getRsProps();\n const state = getState();\n const { groups } = state;\n\n if (groups?.length! > 0 && getView().meta.grouping) {\n try {\n const groupingInfo =\n (await rsProps.apiContext.fetchGroupedInfo?.(deepCopy(state), getView().meta, {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n })) || [];\n // Here update group info with basic properties like level, group by, expand state etc.\n // to make calculation easy.\n // TODO: FIXME - Check if count on non leaf node is required\n updateCountOnNonLeafNode(groupingInfo);\n rsStore.groupingInfo = updateGroupInfo(groupingInfo, groups!);\n\n // FIXME: once infinite virtualizer supports the grouping, we need not compute the count from grouping\n // Prepare the count from the groups count until the actual count returns\n updateCountFromGroupingInfo(getView, getRsStore);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('API call failed', err);\n }\n } else rsStore.groupingInfo = [];\n\n getView().columns!.forEach(column => {\n const grouped = groups?.findIndex(group => group.columnId === column.field.id)! >= 0;\n column = column.setProp('grouped', grouped);\n });\n}\n\nfunction autoExpandGroups([{ dispatch, getState }]: [featureProps: BeforeRenderFeatureProps]) {\n const { allGroupsExpanded = true } = getState();\n dispatch(actionGroupingExpandCollapseAll(allGroupsExpanded));\n}\n\nfunction updateHierarchicalGroupInfo(\n groupingInfo: HierarchicalGroupedInfo[],\n hierarchicalGroup: HierarchicalInfo\n) {\n const queue = [...groupingInfo] as HierarchicalGroupingInfo[];\n\n while (queue.length) {\n const child = queue.pop();\n const node = child!.info;\n\n if (child) {\n child.level = child.level || 0;\n child.isHierarchical = true;\n child.parentId = hierarchicalGroup.parentId;\n child.targetId = hierarchicalGroup.targetId;\n child.groupBy = (hierarchicalGroup.sortById || hierarchicalGroup.targetId)!;\n\n if (node) {\n child.name = node[(hierarchicalGroup.sortById || hierarchicalGroup.targetId)!] as string;\n child.hierarchy = [node[hierarchicalGroup.targetId!] as string];\n }\n\n if (child.children) {\n // update level before pushing children to queue.\n child.children.forEach(c => {\n c.level = child.level! + 1;\n });\n queue.push(...child.children);\n }\n }\n }\n}\n\nasync function onHierarchicalGroupChange([{ getState, getRsProps, getRsStore, getView }]: [\n featureProps: BeforeRenderFeatureProps\n]) {\n const { hierarchicalGroup } = getState();\n const rsProps = getRsProps();\n const rsStore = getRsStore();\n if (hierarchicalGroup && hierarchicalGroup.parentId) {\n try {\n const groupingInfo =\n (await rsProps.apiContext.fetchHierarchicalGroupedInfo?.(\n deepCopy(getState()),\n getView().meta,\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n }\n )) || [];\n\n getView().setProp('hierarchicalGroupEnabled', true);\n\n updateHierarchicalGroupInfo(groupingInfo, hierarchicalGroup);\n rsStore.groupingInfo = groupingInfo as HierarchicalGroupingInfo[];\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('API call failed', err);\n }\n } else {\n getView().setProp('hierarchicalGroupEnabled', false);\n }\n}\n\nconst getTotalItemCount = (\n getView: BeforeRenderFeatureProps['getView'],\n state: State,\n groupingInfo: NonNullable<RsStore['groupingInfo']>\n) => {\n // Calculate total group count and update instance.\n // and datanode count based on group expand state.\n let totalItemCount = 0;\n const stack = [...groupingInfo];\n const { groupToggle, allGroupsExpanded } = state;\n\n while (stack.length) {\n const child = stack.shift();\n // We are considering header count whether if it is of a hierarchical node or\n // a normal group node, and it has data associated with it in its hierarchy.\n if (child) {\n totalItemCount += 1;\n const isSubGroupPresent = child.children && child.children.length;\n const isExpanded = isNodeExpanded(groupToggle, child, allGroupsExpanded);\n if (isExpanded && isSubGroupPresent) {\n stack.unshift(...child.children!);\n } else if (isExpanded && !isSubGroupPresent) {\n totalItemCount += child.count;\n }\n\n if (child.showHierarchicalFooter) {\n totalItemCount += 1;\n }\n }\n }\n return totalItemCount;\n};\n\nconst updateGroupFilters = ([{ getState, getRsStore, getView }]: [\n featureProps: BeforeRenderFeatureProps\n]) => {\n const { paginationOptions, groupToggle, allGroupsExpanded } = getState();\n const rsStore = getRsStore();\n const { groupingInfo } = rsStore;\n // group info is expected to be [] when there are no groups.\n if (groupingInfo) {\n if (!groupingInfo.length && rsStore.groupFilters && !rsStore.groupFilters.length) return;\n rsStore.groupFilters = constructGroupingPagination(\n groupingInfo,\n groupToggle,\n paginationOptions!.rootVirtualiser,\n allGroupsExpanded,\n getState(),\n getView\n );\n }\n};\n\nfunction postFetch(\n rsInternal: RsInternal,\n memoizedPrepareGroupHeaders: MemoizedFunction<\n [\n groupingInfo: RsStore['groupingInfo'],\n groupFilters: RsStore['groupFilters'],\n rsInternal: RsInternal,\n groupToggle?: State['groupToggle'],\n allGroupsExpanded?: State['allGroupsExpanded']\n ],\n ReturnType<typeof prepareGroupHeaders>\n >\n) {\n const { getRsStore, getView, getRsStateResolver } = rsInternal;\n const rsStore = getRsStore();\n const { getState } = getRsStateResolver();\n if (!rsStore.groupingInfo || !rsStore.groupingInfo.length) {\n // As we are giving ways to always use header, though grouping is not in place\n // update total item count given by API.\n getView().setProp('totalItemCount', getView().resultsCount);\n memoizedPrepareGroupHeaders([[], [], rsInternal], [getView().rows!.length]);\n } else {\n // As our group headers are representing data in UI, so\n // like data after every fetch group headers should also change so that\n // UI get to know about the latest group.\n getView().setProp(\n 'totalItemCount',\n getTotalItemCount(getView, getState(), rsStore.groupingInfo)\n );\n memoizedPrepareGroupHeaders([\n rsStore.groupingInfo,\n rsStore.groupFilters,\n rsInternal,\n getState().groupToggle,\n getState().allGroupsExpanded\n ]);\n }\n}\n\n// TODO: Need to make changes in grouping to support 0 based indexing inclusive start and end index.\n/**\n * Handles the grouping feature for repeating structures.\n *\n * This method performs the following tasks:\n * - Fetches the grouping information, either via {@link ApiContext.fetchGroupedInfo} or {@link ApiContext.fetchHierarchicalGroupedInfo}, and stores the result in {@link RsStore.groupingInfo}.\n * - Prepares group filters based on the grouping information, then sets these filters in {@link RsStore.groupFilters}.\n * - Manages the automatic expansion of groups.\n * - Prepares group headers from the fetched grouping information and sets them in {@link View.groupHeaders}.\n */\nexport default (rsInternal: RsInternal) => {\n const memoizedOnGroupsChange = withMemoization(onGroupsChange);\n const memorizeOnHierarchicalGroupChange = withMemoization(onHierarchicalGroupChange);\n const memoizedUpdateGroupFilters = withMemoization(updateGroupFilters);\n const memoizedAutoExpandGroups = withMemoization(autoExpandGroups);\n\n // Prepare a group header even though groups are not present to have one flow.\n // depend on after fetch event as it depends on data when no grouping is there.\n rsInternal\n .getPubSubUtils()\n .subscribe(AFTER_FETCH, () => postFetch(rsInternal, withMemoization(prepareGroupHeaders)));\n\n async function execute(featureProps: BeforeRenderFeatureProps) {\n const { getState, getRsStore } = featureProps;\n const state = getState();\n\n // TOdo: Fixme ISSUE-76344... try to not rely on state.personalization?.active\n await memoizedOnGroupsChange(\n [featureProps],\n [\n state.groups,\n state.filterExpression,\n state.search?.query,\n state.personalization?.active,\n state.refresh,\n state.aggregationInfo,\n state.visibleColumns\n ]\n );\n\n memoizedAutoExpandGroups([featureProps], [state.personalization?.active]);\n\n await memorizeOnHierarchicalGroupChange(\n [featureProps],\n [\n state.hierarchicalGroup,\n state.filterExpression,\n state.search?.query,\n state.aggregationInfo,\n state.personalization?.active\n ]\n );\n // In the new grouping, update group info in state.\n // Action dispatched for group info will prepare group headers.\n if (state.paginationOptions) {\n // TODO: use this comparator for optimization but isVisible calculated prop on grouping info needs to be handled.ISSUE-80012\n // const comparator =(prev, next) => {\n // if (prev[1] !== next[1] || prev[3] !== next[3]) return false;\n // return compareArray(prev[2], next[2], ['children', 'count', 'name']);\n // };\n memoizedUpdateGroupFilters(\n [featureProps],\n [\n state.paginationOptions[Object.keys(state.paginationOptions || {})[0]],\n getRsStore().groupingInfo,\n state.groupToggle,\n state.allGroupsExpanded\n ]\n );\n }\n }\n\n // As we are generating one flow, this is required. TODO: Need to take decision\n // conditional block on UI or feature push though not enabled.\n if (rsInternal.getView().meta.grouping) {\n return execute;\n }\n\n return undefined;\n};\n"]}
1
+ {"version":3,"file":"gr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C;QACF,mDAAmD;QACnD,+DAA+D;QAC/D,4HAA4H;QAC5H,sCAAsC;QACtC,kEAAkE;QAClE,0EAA0E;QAC1E,KAAK;QACL,0BAA0B,CACxB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACxE,UAAU,EAAE,CAAC,YAAY;YACzB,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,iBAAiB;SACxB,CACF,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACtF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n getGroupKey,\n getGroupFromKey,\n isKanbanTemplate,\n withMemoization,\n compareArray,\n dateFunctionLabels,\n deepCopy,\n isEmpty\n} from '../../../utils/util';\nimport { actionGroupingExpandCollapseAll } from '../../../actions/actions';\nimport { AFTER_FETCH } from '../../../pubSub/events';\nimport type RsInternal from '../../../RsInternal';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport type { MemoizedFunction } from '../../../utils/util.types';\nimport type { Group, GroupFilter, GroupToggle, State } from '../../../../../types/State.types';\nimport {\n REPEATING_STRUCTURE_TEMPLATES,\n type HierarchicalInfo,\n type Meta\n} from '../../../../../types/Meta.types';\nimport GroupGenerator from '../../../generators/GroupGenerator';\nimport type View from '../../../generators/ViewGenerator';\nimport type RsStore from '../../../RsStore';\nimport type {\n ApiOptions,\n GroupedInfo,\n HierarchicalGroupedInfo,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ApiContext\n} from '../../../../../types/ApiContext.types';\n\ntype KanbanLaneInfo = NonNullable<RsStore['kanbanLaneInfo']>;\n\nexport interface CommonGroupingInfo {\n /** Id of the field on which grouping is applied. */\n groupBy: string;\n /** Current group level, starts with 0 for 1st level of grouping. */\n level: number;\n /** Path of the grouped column value. */\n hierarchy: (string | number | boolean | Date)[];\n visibleRow?: boolean;\n showHierarchicalFooter?: boolean;\n groupFrom?: number;\n groupTo?: number;\n isHierarchical?: boolean;\n}\n\nexport type GroupingInfo = OmitStrict<GroupedInfo, 'children'> &\n CommonGroupingInfo & {\n children?: GroupingInfo[];\n };\n\nexport type HierarchicalGroupingInfo = OmitStrict<HierarchicalGroupedInfo, 'children'> &\n CommonGroupingInfo & {\n children?: HierarchicalGroupingInfo[];\n parentId?: string;\n targetId?: string;\n name?: null | string | number | boolean | Date;\n };\n\nfunction isNodeExpanded(\n groupToggle: GroupToggle | undefined,\n node: GroupingInfo | HierarchicalGroupingInfo,\n defaultState: boolean | undefined\n): boolean {\n /** Groups with count 0 should not be expandable. */\n if (node.count === 0) {\n return false;\n }\n\n const index = groupToggle?.[node.groupBy!]?.findIndex(gct => compareArray(gct, node.hierarchy!));\n const childToggleState = index! >= 0 ? !defaultState : !!defaultState;\n return childToggleState === true;\n}\n\nconst getLabel = (view: View, groupBy: string, getState: BeforeRenderFeatureProps['getState']) => {\n const { columnId, dateFunction } = getGroupFromKey(groupBy, getState().groups)!;\n let { label } = view.columns!.find(column => column.field.id.toString() === columnId.toString())!;\n if (dateFunction) {\n label += ` (${dateFunctionLabels[dateFunction]})`;\n }\n return label;\n};\n\n/**\n * Creates a cache key for the Kanban lane group.\n *\n * @param laneGroup - Level-0 group that defines the Kanban lanes.\n * @returns A key that identifies the current lane source.\n */\nfunction getKanbanLaneSourceKey(laneGroup: Group): string {\n return `${getGroupKey(laneGroup)}:${laneGroup.order}`;\n}\n\n/**\n * Builds the complete Kanban lane catalog from text custom grouping.\n *\n * Includes the aggregate ungrouped lane and applies the resolved lane order.\n *\n * @param laneGroup - Level-0 group that may define text custom lanes.\n * @param sourceKey - Cache key for the resulting lane catalog.\n * @returns The custom lane catalog, or `undefined` for non-text grouping.\n */\nfunction getKanbanLaneInfoFromCustomGrouping(\n laneGroup: Group,\n sourceKey: string\n): KanbanLaneInfo | undefined {\n const customGrouping = laneGroup.customFunction;\n // Kanban lanes only support text custom grouping (enforced during meta normalization).\n if (customGrouping?.type !== 'TEXT_GROUPING') return undefined;\n\n const names = customGrouping.groups.map(group => group.label);\n if (customGrouping.ungrouped.mode === 'aggregate') {\n names.push(customGrouping.ungrouped.label);\n }\n\n if (laneGroup.order === 'asc') {\n names.sort((first, second) => first.localeCompare(second));\n } else if (laneGroup.order === 'desc') {\n names.sort((first, second) => second.localeCompare(first));\n }\n\n return {\n sourceKey,\n lanes: names\n };\n}\n\nfunction getApiOptions(rsStore: RsStore): ApiOptions {\n return {\n ...(rsStore.refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: rsStore.refreshToken\n })\n };\n}\n\n/**\n * Creates grouping information for a lane with no matching records.\n *\n * @param name - Lane name.\n * @returns Empty grouping information for the lane.\n */\nfunction createEmptyLaneGroup(name: GroupedInfo['name'], laneGroup: Group): GroupingInfo {\n return {\n name,\n count: 0,\n groupBy: getGroupKey(laneGroup),\n level: laneGroup.level,\n hierarchy: name === null ? [] : [name],\n data: {},\n additionalFieldsData: [],\n agg: {},\n children: []\n };\n}\n\n/**\n * Merges the current top-level lane groups with the complete lane catalog.\n *\n * @param groupingInfo - Grouping information returned for the current state.\n * @param laneInfo - Complete lane catalog.\n * @param laneGroup - The level-0 group that defines the Kanban lanes.\n * @returns Top-level lane groups in catalog order.\n */\nfunction mergeKanbanGroupingInfo(\n groupingInfo: GroupedInfo[],\n laneInfo: KanbanLaneInfo,\n laneGroup: Group\n): GroupedInfo[] {\n const laneKey = (value: GroupedInfo['name']) => (value instanceof Date ? value.getTime() : value);\n const groupsByLaneKey = new Map(groupingInfo.map(group => [laneKey(group.name), group]));\n\n return laneInfo.lanes.map(\n name => groupsByLaneKey.get(laneKey(name)) ?? createEmptyLaneGroup(name, laneGroup)\n );\n}\n\n/**\n * Processes grouping information for the active template.\n *\n * For Kanban, merges the grouped result with the matching cached lane catalog.\n * Returns the input unchanged when no matching Kanban lane catalog is available.\n *\n * @param groupingInfo - Grouping information returned for the current state.\n * @param meta - Metadata for the current view.\n * @param groups - Active grouping definitions.\n * @param rsStore - Repeating-structure store containing the lane catalog.\n * @returns Processed grouping information.\n */\nfunction processGroupingInfo(\n groupingInfo: GroupedInfo[],\n meta: Meta,\n groups: State['groups'],\n rsStore: RsStore\n): GroupedInfo[] {\n if (!isKanbanTemplate(meta) || !rsStore.kanbanLaneInfo) return groupingInfo;\n\n const laneGroup = groups?.[0];\n if (!laneGroup || rsStore.kanbanLaneInfo.sourceKey !== getKanbanLaneSourceKey(laneGroup)) {\n return groupingInfo;\n }\n\n return mergeKanbanGroupingInfo(groupingInfo, rsStore.kanbanLaneInfo, laneGroup);\n}\n\n// This function checks if hierarchy exists or not.\n// which will decide whether start and end Index would be there on the leaf node or on the hierarchical node.\nconst doesExistInViewInfo = (\n viewInfo: GroupFilter[],\n hierarchy: (string | number | boolean | Date)[] = [],\n isHierarchical = false\n) => {\n return viewInfo.some(v => {\n const filters = Object.values(v.filters);\n\n if (isHierarchical) {\n return filters.every(value => value === [...hierarchy].pop());\n }\n\n if (filters.length === hierarchy.length) {\n const tempHierarchy = [...hierarchy];\n // eslint-disable-next-line @typescript-eslint/require-array-sort-compare\n tempHierarchy.sort();\n // eslint-disable-next-line @typescript-eslint/require-array-sort-compare\n return filters.sort().every((value, index) => value === tempHierarchy[index]);\n }\n return false;\n });\n};\n\nconst prepareGroupHeaders = (\n props: [\n groupingInfo: RsStore['groupingInfo'],\n groupFilters: RsStore['groupFilters'],\n rsInternal: RsInternal,\n groupToggle?: State['groupToggle'],\n allGroupsExpanded?: boolean\n ]\n) => {\n const [groupingInfo = [], viewInfo = [], rsInternal, groupToggle = {}, allGroupsExpanded] = props;\n\n // If group and viewInfo are empty, prepare group header for top level leaf node.\n // This is for easing on UI , one contract whether grouping is in place/not.\n // TODO: support for enabling feature on view.\n const view = rsInternal.getView();\n const { getState } = rsInternal.getRsStateResolver();\n // Timeline view manages visual collapse independently; rows must always be\n // included in groupFilters so that rows.length stays accurate for infinite-scroll pagination.\n const isTimelineView = view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE;\n if (groupingInfo.length === 0) {\n // construct a view header object.\n\n const viewHeader = new GroupGenerator(\n {\n isVisible: false,\n isLeafNode: true,\n isExpanded: true,\n name: '',\n groupBy: '',\n level: 0,\n label: '',\n hierarchy: [],\n count: view.rows!.length\n },\n rsInternal\n );\n viewHeader.startIndex = 0;\n viewHeader.endIndex = view.rows ? view.rows.length : 0;\n view.setProp('groupHeaders', [viewHeader]);\n return;\n }\n // Creating flat objects from view group info using DFT.\n const result = [];\n let counter = 0;\n\n const stack = groupingInfo.map(v => ({ ...v }));\n let leafNodeCountInView = 0;\n let lastDataIndex = 0;\n while (stack.length) {\n const child = stack.shift();\n if (child) {\n const isExpanded = isNodeExpanded(groupToggle, child, allGroupsExpanded);\n const isSubGroupPresent = child.children && child.children.length;\n const label = child.isHierarchical ? '' : getLabel(view, child.groupBy!, getState);\n // construct a view header object.\n const viewHeader = new GroupGenerator(\n {\n isVisible: !!child.visibleRow,\n isLeafNode: !isSubGroupPresent,\n isExpanded,\n name: child.name!,\n groupBy: child.groupBy,\n level: child.level,\n label: label!,\n hierarchy: child.hierarchy,\n count: child.count,\n aggregation: child.agg,\n showHierarchicalFooter: child.showHierarchicalFooter,\n isHierarchical: child.isHierarchical,\n info: 'info' in child ? child.info : undefined,\n data: 'data' in child ? child.data : undefined,\n additionalFieldsData:\n 'additionalFieldsData' in child ? child.additionalFieldsData : undefined\n },\n rsInternal\n );\n // If the header node is a leaf node, then, add start index and endIndex to resolve data.\n if (\n (viewHeader.isLeafNode || viewHeader.isHierarchical) &&\n (viewHeader.isExpanded || isTimelineView) &&\n doesExistInViewInfo(viewInfo, viewHeader.hierarchy, viewHeader.isHierarchical)\n ) {\n const { groupFrom, groupTo } = viewInfo[leafNodeCountInView] || {};\n if (groupFrom >= 0 && groupTo >= 0) {\n viewHeader.startIndex = lastDataIndex;\n viewHeader.endIndex = viewHeader.startIndex + groupTo - groupFrom;\n lastDataIndex = viewHeader.endIndex;\n leafNodeCountInView += 1;\n }\n }\n // BUG-775861 - Adding index to visible groupHeaders so that this can be used to set the z-index for groupHeaders\n if (viewHeader.isVisible) {\n viewHeader.index = counter;\n counter += 1;\n }\n result.push(viewHeader);\n if ((isExpanded || (child.count > 0 && isTimelineView)) && isSubGroupPresent) {\n stack.unshift(...child.children!);\n }\n }\n }\n view.setProp('groupHeaders', result);\n};\n\nfunction includeGroup(\n group: GroupingInfo | HierarchicalGroupingInfo,\n groupFrom: number,\n groupTo: number,\n parentGroups: Record<string, any>,\n groupFilters: GroupFilter[]\n) {\n group.groupFrom = groupFrom;\n group.groupTo = groupTo;\n groupFilters.push({ groupFrom, groupTo, filters: parentGroups });\n}\n\ntype ParentGroups = Parameters<typeof includeGroup>[3];\n\nexport function includeAllLeafGroups(\n group: NonNullable<RsStore['groupingInfo']>,\n parentGroup: ParentGroups,\n groupFilters: GroupFilter[]\n) {\n group.forEach(groupInfo => {\n const parentGroups = { ...parentGroup };\n const currentGroup = groupInfo as GroupingInfo;\n if (currentGroup.groupBy) {\n parentGroups[currentGroup.groupBy] = currentGroup.name;\n }\n\n if (groupInfo.children?.length) {\n includeAllLeafGroups(groupInfo.children, parentGroups, groupFilters);\n } else if (groupInfo.count > 0) {\n includeGroup(groupInfo, 0, groupInfo.count, parentGroups, groupFilters);\n }\n });\n}\n\nfunction getRecordsCount(\n group: NonNullable<RsStore['groupingInfo']>,\n count: number,\n includedRowCount: number,\n parentGroup: Record<string, any>,\n from: number,\n to: number,\n groupFilters: GroupFilter[],\n groupToggle: GroupToggle | undefined,\n allGroupsExpanded: boolean | undefined,\n state: State,\n getView: BeforeRenderFeatureProps['getView']\n): [count: number, includedRowCount: number] {\n const { aggregationInfo } = state;\n // Timeline view manages visual collapse independently; rows must always be\n // included in groupFilters so that rows.length stays accurate for infinite-scroll pagination.\n const isTimelineView = getView().meta.template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE;\n\n for (let i = 0; i < group.length; i += 1) {\n const parentGroups = { ...parentGroup };\n if (group[i].isHierarchical) {\n const currentGroup = group[i] as HierarchicalGroupingInfo;\n parentGroups[currentGroup.parentId!] = currentGroup.info![currentGroup.targetId!];\n } else {\n const currentGroup = group![i] as GroupingInfo;\n parentGroups[currentGroup.groupBy!] = currentGroup.name;\n }\n count += 1;\n // the group has subgroups and a group is expanded\n const isExpanded = isNodeExpanded(groupToggle, group[i], allGroupsExpanded);\n let includeThisGroup = false;\n if (count > from && count - 1 <= to) {\n includeThisGroup = true;\n includedRowCount += 1;\n }\n group[i].visibleRow = includeThisGroup;\n // Footer should be shown only if the node expands.\n // groupToggle will affect footer visibility so reset a footer flag.\n group[i].showHierarchicalFooter = false;\n\n if (group[i].children && (isExpanded || (group[i].count > 0 && isTimelineView))) {\n [count, includedRowCount] = getRecordsCount(\n group[i].children!,\n count,\n includedRowCount,\n parentGroups,\n from,\n to,\n groupFilters,\n groupToggle,\n allGroupsExpanded,\n state,\n getView\n );\n group[i].visibleRow =\n group[i].visibleRow ||\n !!group[i].children!.find(g => g.visibleRow && (g.isHierarchical || !g.children));\n } else if (!group[i].children && (isExpanded || (group[i].count > 0 && isTimelineView))) {\n // the group doesn't have subgroups and the group is expanded\n const innerCount = count + group[i].count;\n if (count <= to) {\n let groupFrom = 0;\n let groupTo = 0;\n if (innerCount >= from) {\n groupFrom = Math.max(from - count, 0);\n if (innerCount <= to + 1) {\n groupTo = group[i].count;\n } else {\n groupTo = groupFrom + (to + 1 - from - includedRowCount);\n }\n group[i].visibleRow = true;\n let updatedGroupFrom = groupFrom;\n // Sticky group header logic\n if (!includeThisGroup && groupTo > groupFrom + 2) {\n if (group[i].level! >= 1) {\n updatedGroupFrom = groupFrom + 2;\n } else {\n updatedGroupFrom = groupFrom + 1;\n }\n }\n includeGroup(group[i], updatedGroupFrom, groupTo, parentGroups, groupFilters);\n }\n includedRowCount += groupTo - groupFrom;\n }\n count = innerCount;\n }\n\n if (group[i].isHierarchical && aggregationInfo && aggregationInfo.length > 0 && isExpanded) {\n count += 1;\n group[i].showHierarchicalFooter = true;\n\n if (group[i].visibleRow && includedRowCount <= to) {\n includedRowCount += 1;\n }\n }\n }\n return [count, includedRowCount];\n}\n\nconst constructGroupingPagination = (\n groupingInfo: NonNullable<RsStore['groupingInfo']>,\n groupToggle: GroupToggle | undefined,\n paginationOptions:\n | NonNullable<State['paginationOptions']>[keyof NonNullable<State['paginationOptions']>]\n | undefined,\n allGroupsExpanded: boolean | undefined,\n state: State,\n getView: BeforeRenderFeatureProps['getView']\n) => {\n const groupFilters: GroupFilter[] = [];\n if (!paginationOptions) {\n includeAllLeafGroups(groupingInfo, {}, groupFilters);\n } else {\n getRecordsCount(\n groupingInfo,\n 0,\n 0,\n {},\n paginationOptions.startIndex,\n paginationOptions.endIndex,\n groupFilters,\n groupToggle,\n allGroupsExpanded,\n state,\n getView\n );\n }\n return groupFilters;\n};\n\n// This is basically used to update count on non-leaf node.\n// which is the sum of count of leaf node children in their hierarchy.\nfunction updateCountOnNonLeafNode(groupingInfo: GroupedInfo[]) {\n const updateCount = (child: GroupedInfo) => {\n if (child.count !== undefined) return child.count;\n child.count = child.children!.reduce((acc, c) => {\n acc += updateCount(c)!;\n return acc;\n }, 0);\n };\n groupingInfo.forEach(g => updateCount(g));\n}\n\nfunction updateGroupInfo(groupingInfo: GroupedInfo[], groups: Group[]): GroupingInfo[] {\n // iterate groupingInfo using BFS and update basic information.\n const queue = [...groupingInfo] as GroupingInfo[];\n while (queue.length) {\n const child = queue.pop();\n if (child) {\n if (!child.hierarchy) child.hierarchy = [child.name!];\n child.level = child.level || 0;\n const matchingGroup = groups.find(g => g.level === child.level);\n child.groupBy = getGroupKey(matchingGroup!);\n\n if (child.children) {\n // update level before pushing children to queue.\n child.children.forEach(c => {\n c.level = child.level + 1;\n c.hierarchy = [...child.hierarchy];\n c.hierarchy.push(c.name!);\n });\n queue.push(...child.children);\n }\n }\n }\n return groupingInfo as GroupingInfo[];\n}\n\nfunction updateCountFromGroupingInfo(\n getView: BeforeRenderFeatureProps['getView'],\n getRsStore: BeforeRenderFeatureProps['getRsStore']\n) {\n if (getView().countGeneratedInternally || isEmpty(getView().resultsCount)) {\n const countFromGroupingInfo = getRsStore().groupingInfo?.reduce(\n (acc, group) => (group.count ? acc + group.count : acc),\n 0\n );\n\n const countPayload = { count: countFromGroupingInfo, _countGeneratedInternally: true };\n getView().type.setRecordCount(countPayload);\n }\n}\n\nasync function onGroupsChange([{ getRsProps, getRsStore, getView, getState }]: [\n featureProps: BeforeRenderFeatureProps\n]) {\n const rsStore = getRsStore();\n const rsProps = getRsProps();\n const state = getState();\n const { groups } = state;\n const meta = getView().meta;\n\n if (groups && groups.length > 0 && meta.grouping) {\n try {\n const groupingInfo =\n (await rsProps.apiContext.fetchGroupedInfo?.(deepCopy(state), meta, {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n })) || [];\n const processedGroupingInfo = processGroupingInfo(groupingInfo, meta, groups, rsStore);\n\n // Here update group info with basic properties like level, group by, expand state etc.\n // to make calculation easy.\n // TODO: FIXME - Check if count on non leaf node is required\n updateCountOnNonLeafNode(processedGroupingInfo);\n rsStore.groupingInfo = updateGroupInfo(processedGroupingInfo, groups);\n\n // FIXME: once infinite virtualizer supports the grouping, we need not compute the count from grouping\n // Prepare the count from the groups count until the actual count returns\n updateCountFromGroupingInfo(getView, getRsStore);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('API call failed', err);\n }\n } else rsStore.groupingInfo = [];\n\n getView().columns!.forEach(column => {\n const grouped = groups?.findIndex(group => group.columnId === column.field.id)! >= 0;\n column = column.setProp('grouped', grouped);\n });\n}\n\n/**\n * Loads the complete Kanban lane catalog before grouped data is processed.\n *\n * @param featureProps - Dependencies for the grouping feature.\n * @returns A promise that resolves after the lane information is stored.\n */\nasync function loadKanbanLaneInfo([featureProps]: [featureProps: BeforeRenderFeatureProps]) {\n const { getRsProps, getRsStore, getState, getView } = featureProps;\n const meta = getView().meta;\n if (!isKanbanTemplate(meta)) return;\n\n const state = getState();\n // Wait for state hydration to add the level-0 lane group.\n const groups = state.groups ?? [];\n const laneGroup = groups[0];\n if (!laneGroup) return;\n\n try {\n const rsStore = getRsStore();\n const sourceKey = getKanbanLaneSourceKey(laneGroup);\n const customLaneInfo = getKanbanLaneInfoFromCustomGrouping(laneGroup, sourceKey);\n\n // Custom text grouping defines the complete lanes within the grouping definition.\n if (customLaneInfo) {\n rsStore.kanbanLaneInfo = customLaneInfo;\n return;\n }\n\n // Reuse the catalog unless a force refresh needs the latest lane domain.\n if (rsStore.kanbanLaneInfo?.sourceKey === sourceKey && !rsStore.refreshInProgress) return;\n\n // Fetch and cache the complete default lane catalog.\n const laneField = laneGroup.columnId;\n const values = laneField\n ? (await getRsProps().apiContext.fetchUniqueColValues?.(\n deepCopy({\n ...state,\n filterExpression: undefined,\n groups: undefined,\n search: undefined\n }),\n meta,\n laneField,\n getApiOptions(rsStore)\n )) ?? []\n : [];\n rsStore.kanbanLaneInfo = {\n sourceKey,\n lanes: values\n };\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('API call failed', err);\n }\n}\n\nfunction autoExpandGroups([{ dispatch, getState }]: [featureProps: BeforeRenderFeatureProps]) {\n const { allGroupsExpanded = true } = getState();\n dispatch(actionGroupingExpandCollapseAll(allGroupsExpanded));\n}\n\nfunction updateHierarchicalGroupInfo(\n groupingInfo: HierarchicalGroupedInfo[],\n hierarchicalGroup: HierarchicalInfo\n) {\n const queue = [...groupingInfo] as HierarchicalGroupingInfo[];\n\n while (queue.length) {\n const child = queue.pop();\n const node = child!.info;\n\n if (child) {\n child.level = child.level || 0;\n child.isHierarchical = true;\n child.parentId = hierarchicalGroup.parentId;\n child.targetId = hierarchicalGroup.targetId;\n child.groupBy = (hierarchicalGroup.sortById || hierarchicalGroup.targetId)!;\n\n if (node) {\n child.name = node[(hierarchicalGroup.sortById || hierarchicalGroup.targetId)!] as string;\n child.hierarchy = [node[hierarchicalGroup.targetId!] as string];\n }\n\n if (child.children) {\n // update level before pushing children to queue.\n child.children.forEach(c => {\n c.level = child.level! + 1;\n });\n queue.push(...child.children);\n }\n }\n }\n}\n\nasync function onHierarchicalGroupChange([{ getState, getRsProps, getRsStore, getView }]: [\n featureProps: BeforeRenderFeatureProps\n]) {\n const { hierarchicalGroup } = getState();\n const rsProps = getRsProps();\n const rsStore = getRsStore();\n if (hierarchicalGroup && hierarchicalGroup.parentId) {\n try {\n const groupingInfo =\n (await rsProps.apiContext.fetchHierarchicalGroupedInfo?.(\n deepCopy(getState()),\n getView().meta,\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n }\n )) || [];\n\n getView().setProp('hierarchicalGroupEnabled', true);\n\n updateHierarchicalGroupInfo(groupingInfo, hierarchicalGroup);\n rsStore.groupingInfo = groupingInfo as HierarchicalGroupingInfo[];\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('API call failed', err);\n }\n } else {\n getView().setProp('hierarchicalGroupEnabled', false);\n }\n}\n\nconst getTotalItemCount = (\n getView: BeforeRenderFeatureProps['getView'],\n state: State,\n groupingInfo: NonNullable<RsStore['groupingInfo']>\n) => {\n // Calculate total group count and update instance.\n // and datanode count based on group expand state.\n let totalItemCount = 0;\n const stack = [...groupingInfo];\n const { groupToggle, allGroupsExpanded } = state;\n\n while (stack.length) {\n const child = stack.shift();\n // We are considering header count whether if it is of a hierarchical node or\n // a normal group node, and it has data associated with it in its hierarchy.\n if (child) {\n totalItemCount += 1;\n const isSubGroupPresent = child.children && child.children.length;\n const isExpanded = isNodeExpanded(groupToggle, child, allGroupsExpanded);\n if (isExpanded && isSubGroupPresent) {\n stack.unshift(...child.children!);\n } else if (isExpanded && !isSubGroupPresent) {\n totalItemCount += child.count;\n }\n\n if (child.showHierarchicalFooter) {\n totalItemCount += 1;\n }\n }\n }\n return totalItemCount;\n};\n\nconst updateGroupFilters = ([{ getState, getRsStore, getView }]: [\n featureProps: BeforeRenderFeatureProps\n]) => {\n const { paginationOptions, groupToggle, allGroupsExpanded } = getState();\n // Kanban does not have paginationOptions. It should build all the groupFilters.\n // For other templates, if paginationOptions is not present, then we should not build groupFilters.\n if (!paginationOptions && getView().meta.template !== REPEATING_STRUCTURE_TEMPLATES.KANBAN)\n return;\n const rsStore = getRsStore();\n const { groupingInfo } = rsStore;\n // group info is expected to be [] when there are no groups.\n if (groupingInfo) {\n if (!groupingInfo.length && rsStore.groupFilters && !rsStore.groupFilters.length) return;\n rsStore.groupFilters = constructGroupingPagination(\n groupingInfo,\n groupToggle,\n paginationOptions?.rootVirtualiser,\n allGroupsExpanded,\n getState(),\n getView\n );\n }\n};\n\nfunction postFetch(\n rsInternal: RsInternal,\n memoizedPrepareGroupHeaders: MemoizedFunction<\n [\n groupingInfo: RsStore['groupingInfo'],\n groupFilters: RsStore['groupFilters'],\n rsInternal: RsInternal,\n groupToggle?: State['groupToggle'],\n allGroupsExpanded?: State['allGroupsExpanded']\n ],\n ReturnType<typeof prepareGroupHeaders>\n >\n) {\n const { getRsStore, getView, getRsStateResolver } = rsInternal;\n const rsStore = getRsStore();\n const { getState } = getRsStateResolver();\n if (!rsStore.groupingInfo || !rsStore.groupingInfo.length) {\n // As we are giving ways to always use header, though grouping is not in place\n // update total item count given by API.\n getView().setProp('totalItemCount', getView().resultsCount);\n memoizedPrepareGroupHeaders([[], [], rsInternal], [getView().rows!.length]);\n } else {\n // As our group headers are representing data in UI, so\n // like data after every fetch group headers should also change so that\n // UI get to know about the latest group.\n getView().setProp(\n 'totalItemCount',\n getTotalItemCount(getView, getState(), rsStore.groupingInfo)\n );\n memoizedPrepareGroupHeaders([\n rsStore.groupingInfo,\n rsStore.groupFilters,\n rsInternal,\n getState().groupToggle,\n getState().allGroupsExpanded\n ]);\n }\n}\n\n// TODO: Need to make changes in grouping to support 0 based indexing inclusive start and end index.\n/**\n * Handles the grouping feature for repeating structures.\n *\n * This method performs the following tasks:\n * - Fetches the grouping information, either via {@link ApiContext.fetchGroupedInfo} or {@link ApiContext.fetchHierarchicalGroupedInfo}, and stores the result in {@link RsStore.groupingInfo}.\n * - Prepares group filters based on the grouping information, then sets these filters in {@link RsStore.groupFilters}.\n * - Manages the automatic expansion of groups.\n * - Prepares group headers from the fetched grouping information and sets them in {@link View.groupHeaders}.\n */\nexport default (rsInternal: RsInternal) => {\n const memoizedOnGroupsChange = withMemoization(onGroupsChange);\n const memoizedLoadKanbanLaneInfo = withMemoization(loadKanbanLaneInfo);\n const memorizeOnHierarchicalGroupChange = withMemoization(onHierarchicalGroupChange);\n const memoizedUpdateGroupFilters = withMemoization(updateGroupFilters);\n const memoizedAutoExpandGroups = withMemoization(autoExpandGroups);\n\n // Prepare a group header even though groups are not present to have one flow.\n // depend on after fetch event as it depends on data when no grouping is there.\n rsInternal\n .getPubSubUtils()\n .subscribe(AFTER_FETCH, () => postFetch(rsInternal, withMemoization(prepareGroupHeaders)));\n\n async function execute(featureProps: BeforeRenderFeatureProps) {\n const { getState, getRsStore } = featureProps;\n const state = getState();\n\n await memoizedLoadKanbanLaneInfo([featureProps], [state.groups, state.refresh]);\n\n // TOdo: Fixme ISSUE-76344... try to not rely on state.personalization?.active\n await memoizedOnGroupsChange(\n [featureProps],\n [\n state.groups,\n state.filterExpression,\n state.search?.query,\n state.personalization?.active,\n state.refresh,\n state.aggregationInfo,\n state.visibleColumns\n ]\n );\n\n memoizedAutoExpandGroups([featureProps], [state.personalization?.active]);\n\n await memorizeOnHierarchicalGroupChange(\n [featureProps],\n [\n state.hierarchicalGroup,\n state.filterExpression,\n state.search?.query,\n state.aggregationInfo,\n state.personalization?.active\n ]\n );\n // In the new grouping, update group info in state.\n // Action dispatched for group info will prepare group headers.\n // TODO: use this comparator for optimization but isVisible calculated prop on grouping info needs to be handled.ISSUE-80012\n // const comparator =(prev, next) => {\n // if (prev[1] !== next[1] || prev[3] !== next[3]) return false;\n // return compareArray(prev[2], next[2], ['children', 'count', 'name']);\n // };\n memoizedUpdateGroupFilters(\n [featureProps],\n [\n state.paginationOptions?.[Object.keys(state.paginationOptions || {})[0]],\n getRsStore().groupingInfo,\n state.groupToggle,\n state.allGroupsExpanded\n ]\n );\n }\n\n if (rsInternal.getView().meta.grouping || isKanbanTemplate(rsInternal.getView().meta)) {\n return execute;\n }\n\n return undefined;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stateHydration.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/stateHydration.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAO9D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAU1D;AACD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAuB/E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAqFtD;AA+ED;;;;;;GAMG;+BAKuB,cAAc,wBAAwB;AAJhE,wBAQE"}
1
+ {"version":3,"file":"stateHydration.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/stateHydration.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAO9D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAU1D;AACD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAuB/E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CA2FtD;AA+ED;;;;;;GAMG;+BAKuB,cAAc,wBAAwB;AAJhE,wBAQE"}
@@ -93,13 +93,20 @@ export function convertMetaIntoState(meta) {
93
93
  // consider sort direction of column for group order if its provided otherwise default to ascending.
94
94
  if (meta.grouping && fieldDef.grouping && fieldDef.grouped) {
95
95
  const level = fieldDef.groupOrder ?? groups.length;
96
- const order = fieldDef.sort && fieldDef.sortDirection ? fieldDef.sortDirection : 'asc';
96
+ let order = 'asc';
97
+ if (fieldDef.customGrouping) {
98
+ order = 'custom';
99
+ }
100
+ else if (fieldDef.sort && fieldDef.sortDirection) {
101
+ order = fieldDef.sortDirection;
102
+ }
97
103
  groups.splice(level, 0, {
98
104
  columnId: fieldDef.id,
99
105
  order,
100
106
  level,
101
107
  dateFunction: fieldDef.groupedDateFunction,
102
- additionalFields: fieldDef.groupedAdditionalFields
108
+ additionalFields: fieldDef.groupedAdditionalFields,
109
+ customFunction: fieldDef.customGrouping
103
110
  });
104
111
  }
105
112
  if (fieldDef.conditionalStyleFormats) {