@pega/lists-core 9.0.0-build.28.5 → 9.0.0-build.28.7
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/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js +16 -12
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts +6 -4
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js +16 -6
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js.map +1 -1
- package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -1
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts.map +1 -1
- package/lib/src/core/generators/viewUtilityMethods.d.ts.map +1 -1
- package/lib/src/core/generators/viewUtilityMethods.js +11 -1
- package/lib/src/core/generators/viewUtilityMethods.js.map +1 -1
- package/lib/src/core/utils/condition-utils.d.ts.map +1 -1
- package/lib/src/core/utils/condition-utils.js +1 -1
- package/lib/src/core/utils/condition-utils.js.map +1 -1
- package/lib/types/ApiContext.types.d.ts +2 -1
- package/lib/types/ApiContext.types.d.ts.map +1 -1
- package/lib/types/ApiContext.types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/beforeRender/columnSizing/resize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAGjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,EAClC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,QAGd;
|
|
1
|
+
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/beforeRender/columnSizing/resize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAGjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,EAClC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,QAGd;AAqBD,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,EAChB,gBAAe,KAAK,CAAC,eAAe,CAAM,aAU3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,mCAAmC,CACpE,wBAAwB,CACzB;qBAoFyB,UAAU;CAuCnC,CAAC;+BAKwB,cAAc,wBAAwB;AAHhE,wBAWE"}
|
|
@@ -7,9 +7,10 @@ export function setColumnStyle(domContainer, style, columnId, value) {
|
|
|
7
7
|
domContainer?.style?.setProperty(`--col-${style}-${columnId}`, `${value}px`);
|
|
8
8
|
}
|
|
9
9
|
const getResizedColumnWidth = (column, distanceDragged, currentCell) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const renderedWidth = currentCell?.offsetWidth;
|
|
11
|
+
// Use measured width when available; otherwise use configured/stored width.
|
|
12
|
+
const measuredWidth = renderedWidth && renderedWidth > 0 ? renderedWidth : undefined;
|
|
13
|
+
const currentWidth = measuredWidth ?? column.currentWidth ?? column.field.width ?? column.field.minWidth ?? 0;
|
|
13
14
|
let width = currentWidth + distanceDragged;
|
|
14
15
|
// TODO: confirm with designers if we want to limit the column sizing within the maxWidth(if defined on fieldDef). Currently only minWidth is getting honored.
|
|
15
16
|
if (width < (column.field.minWidth ?? 0)) {
|
|
@@ -36,6 +37,7 @@ export const columnResizerProps = ([{ getState, getView, dispatch }]) => {
|
|
|
36
37
|
let currentCell = null;
|
|
37
38
|
let currentCellOccupiedWidthBeforeResize = 0;
|
|
38
39
|
let nextFrozenColumns = [];
|
|
40
|
+
let resizeDocument = null;
|
|
39
41
|
const updateWidth = (distance) => {
|
|
40
42
|
if (!column)
|
|
41
43
|
return;
|
|
@@ -79,19 +81,19 @@ export const columnResizerProps = ([{ getState, getView, dispatch }]) => {
|
|
|
79
81
|
};
|
|
80
82
|
const resizeEndHandler = (e) => {
|
|
81
83
|
e.preventDefault();
|
|
82
|
-
|
|
83
|
-
if (!domContainer || !currentCell || !column)
|
|
84
|
+
if (!currentCell || !column)
|
|
84
85
|
return;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
domContainer.removeEventListener('mouseleave', resizeEndHandler);
|
|
86
|
+
resizeDocument?.removeEventListener('mousemove', resizeHandler);
|
|
87
|
+
resizeDocument?.removeEventListener('mouseup', resizeEndHandler);
|
|
88
88
|
if (resized) {
|
|
89
89
|
dispatch(actionColumnResize({ [column.field.id]: updatedWidth }));
|
|
90
90
|
resized = false;
|
|
91
91
|
}
|
|
92
92
|
currentCell.style.pointerEvents = 'auto';
|
|
93
93
|
currentCell.classList.toggle(COLUMN_RESIZING_CLASS);
|
|
94
|
-
|
|
94
|
+
getView().getDomContainer()?.classList.toggle(COLUMN_RESIZING_CLASS);
|
|
95
|
+
// Reset the temporary body cursor override when resize interaction ends.
|
|
96
|
+
resizeDocument?.body?.style.setProperty('cursor', '');
|
|
95
97
|
};
|
|
96
98
|
const onMouseDown = (e) => {
|
|
97
99
|
if (!isInstance(e.target, HTMLElement))
|
|
@@ -101,9 +103,9 @@ export const columnResizerProps = ([{ getState, getView, dispatch }]) => {
|
|
|
101
103
|
const domContainer = getView().getDomContainer();
|
|
102
104
|
if (!domContainer)
|
|
103
105
|
return;
|
|
104
|
-
domContainer.
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
resizeDocument = domContainer.ownerDocument;
|
|
107
|
+
resizeDocument.addEventListener('mousemove', resizeHandler);
|
|
108
|
+
resizeDocument.addEventListener('mouseup', resizeEndHandler);
|
|
107
109
|
currentCell = e.target.closest('.cell');
|
|
108
110
|
if (!currentCell)
|
|
109
111
|
return;
|
|
@@ -118,6 +120,8 @@ export const columnResizerProps = ([{ getState, getView, dispatch }]) => {
|
|
|
118
120
|
}
|
|
119
121
|
currentCell.classList.toggle(COLUMN_RESIZING_CLASS);
|
|
120
122
|
domContainer.classList.toggle(COLUMN_RESIZING_CLASS);
|
|
123
|
+
// Keep resize cursor visible even when pointer moves outside the handle.
|
|
124
|
+
resizeDocument.body.style.setProperty('cursor', 'col-resize');
|
|
121
125
|
// TODO: getState().freezeColumns should
|
|
122
126
|
// give latest state after the action triggered from current feature only on above lines. Check this.
|
|
123
127
|
nextFrozenColumns = getNextFrozenColumns(currentCell.dataset.colId, getState().freezeColumns);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/beforeRender/columnSizing/resize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGvF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD,MAAM,UAAU,cAAc,CAC5B,YAAkC,EAClC,KAAa,EACb,QAAgB,EAChB,KA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AAC;QAChF,YAAY;aACT,UAAU,EAAE;aACZ,qBAAqB,CACpB,oBAAoB,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,CACpF,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { isInstance } from '@pega/cosmos-react-core';\n\nimport type { State } from '../../../../../../types/State.types';\nimport { actionColumnResize, actionColumnAutoSize } from '../../../../actions/actions';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\nimport { withMemoization } from '../../../../utils/util';\nimport type { BeforeRenderFeatureProps } from '../../../featureFactory';\nimport { calculateFieldLeft } from '../freeze';\n\nexport const COLUMN_RESIZING_CLASS = 'column-resizing';\n\nexport function setColumnStyle(\n domContainer: View['domContainer'],\n style: string,\n columnId: number,\n value: number\n) {\n domContainer?.style?.setProperty(`--col-${style}-${columnId}`, `${value}px`);\n}\n\nconst getResizedColumnWidth = (\n column: Column,\n distanceDragged: number,\n currentCell: HTMLElement | null\n): number => {\n const currentWidth = column.field.fillAvailableSpace\n ? currentCell?.offsetWidth ?? 0\n : column.currentWidth ?? column.field.width ?? column.field.minWidth ?? 0;\n\n let width = currentWidth + distanceDragged;\n // TODO: confirm with designers if we want to limit the column sizing within the maxWidth(if defined on fieldDef). Currently only minWidth is getting honored.\n if (width < (column.field.minWidth ?? 0)) {\n width = column.field.minWidth ?? 0;\n }\n return width;\n};\n\nexport const getNextFrozenColumns = (\n columnId: string,\n freezeColumns: State['freezeColumns'] = []\n) => {\n const nextFrozenColumns = [];\n const freezeColIndex = freezeColumns.indexOf(columnId); // If current column freezed\n if (freezeColIndex > -1) {\n for (let i = freezeColIndex + 1; i < freezeColumns.length; i += 1) {\n nextFrozenColumns.push(freezeColumns[i]);\n }\n }\n return nextFrozenColumns;\n};\n\nexport const columnResizerProps = ([{ getState, getView, dispatch }]: [\n BeforeRenderFeatureProps\n]) => {\n const { freezeColumns, hiddenColumns, columnWidths = {} } = getState();\n let column: Column | undefined;\n let startPosition = 0;\n let resized = false;\n let updatedWidth = 0;\n let currentCell: HTMLElement | null = null;\n let currentCellOccupiedWidthBeforeResize = 0;\n let nextFrozenColumns: string[] = [];\n\n const updateWidth = (distance: number) => {\n if (!column) return;\n updatedWidth = getResizedColumnWidth(\n { ...column, currentWidth: column.currentWidth } as Column,\n distance,\n currentCell\n );\n column = column.setProp('currentWidth', updatedWidth);\n setColumnStyle(getView().getDomContainer(), 'width', column.field.idHash!, updatedWidth);\n };\n\n /**\n * Update left positions to frozen columns or right of this column.\n */\n const updateLefts = () => {\n nextFrozenColumns.forEach(colId => {\n const left = calculateFieldLeft(\n colId,\n getView().columns,\n freezeColumns,\n hiddenColumns,\n column ? { ...columnWidths, [column.field.id]: updatedWidth } : columnWidths // injecting the resized width to current column\n );\n const nextFrozenColumn = getView().columns?.find(c => `${c.field.id}` === colId);\n setColumnStyle(getView().getDomContainer(), 'left', nextFrozenColumn!.field.idHash!, left);\n });\n };\n\n const resizeHandler = (e: MouseEvent) => {\n if (!currentCell || !column) return;\n e.preventDefault();\n\n const distance = e.clientX - startPosition;\n const parentContainer = getView().getVirtualizeElement('rootVirtualiser')?.getParentContainer();\n const clientWidth = parentContainer?.clientWidth ?? 0;\n const scrollWidth = parentContainer?.scrollWidth ?? 0;\n\n // Prevent reducing size for fillAvailableSpace column if the size reduction will introduce empty space in the table.\n const preventSizeReductionForFillAvailableSpaceColumn =\n column.field.fillAvailableSpace &&\n distance <= 0 &&\n currentCellOccupiedWidthBeforeResize <= (currentCell.offsetWidth ?? 0) &&\n clientWidth === scrollWidth;\n\n if (preventSizeReductionForFillAvailableSpaceColumn) {\n return;\n }\n\n if (distance !== 0) {\n updateWidth(distance);\n updateLefts();\n resized = true;\n }\n startPosition = e.clientX;\n };\n\n const resizeEndHandler = (e: MouseEvent) => {\n e.preventDefault();\n const domContainer = getView().getDomContainer();\n if (!domContainer || !currentCell || !column) return;\n\n domContainer.removeEventListener('mousemove', resizeHandler);\n domContainer.removeEventListener('mouseup', resizeEndHandler);\n domContainer.removeEventListener('mouseleave', resizeEndHandler);\n if (resized) {\n dispatch(actionColumnResize({ [column.field.id]: updatedWidth }));\n resized = false;\n }\n currentCell.style.pointerEvents = 'auto';\n currentCell.classList.toggle(COLUMN_RESIZING_CLASS);\n domContainer.classList.toggle(COLUMN_RESIZING_CLASS);\n };\n\n const onMouseDown = (e: MouseEvent) => {\n if (!isInstance(e.target, HTMLElement)) return;\n\n e.preventDefault();\n e.stopPropagation();\n\n const domContainer = getView().getDomContainer();\n if (!domContainer) return;\n\n domContainer.addEventListener('mousemove', resizeHandler);\n domContainer.addEventListener('mouseup', resizeEndHandler);\n domContainer.addEventListener('mouseleave', resizeEndHandler);\n\n currentCell = e.target.closest('.cell');\n if (!currentCell) return;\n currentCell.style.pointerEvents = 'none';\n\n column = getView().columns?.find(c => `${c.field.id}` === currentCell?.dataset.colId);\n\n if (!column) return;\n\n startPosition = e.clientX;\n currentCellOccupiedWidthBeforeResize = currentCell.offsetWidth ?? 0;\n\n if (e.detail >= 2 && column.field.resize) {\n dispatch(actionColumnAutoSize(column, domContainer, true));\n }\n\n currentCell.classList.toggle(COLUMN_RESIZING_CLASS);\n domContainer.classList.toggle(COLUMN_RESIZING_CLASS);\n // TODO: getState().freezeColumns should\n // give latest state after the action triggered from current feature only on above lines. Check this.\n nextFrozenColumns = getNextFrozenColumns(currentCell.dataset.colId!, getState().freezeColumns);\n };\n\n return { onMouseDown };\n};\n\nexport default () => {\n const memoizedColumnResize = withMemoization(columnResizerProps);\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const { freezeColumns, visibleColumns, columnWidths } = featureProps.getState();\n featureProps\n .getRsStore()\n .setColumnResizerProps(\n memoizedColumnResize([featureProps], [freezeColumns, visibleColumns, columnWidths])\n );\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/beforeRender/columnS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AC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACrD,yEAAyE;QACzE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC9D,wCAAwC;QACxC,qGAAqG;QACrG,iBAAiB,GAAG,oBAAoB,CAAC,WAAW,CAAC,OAAO,CAAC,KAAM,EAAE,QAAQ,EAAE,CAAC,aAAa,CAAC,CAAC;IACjG,CAAC,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF,eAAe,GAAG,EAAE;IAClB,MAAM,oBAAoB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAEjE,OAAO,SAAS,OAAO,CAAC,YAAsC;QAC5D,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QAChF,YAAY;aACT,UAAU,EAAE;aACZ,qBAAqB,CACpB,oBAAoB,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,CACpF,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { isInstance } from '@pega/cosmos-react-core';\n\nimport type { State } from '../../../../../../types/State.types';\nimport { actionColumnResize, actionColumnAutoSize } from '../../../../actions/actions';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\nimport { withMemoization } from '../../../../utils/util';\nimport type { BeforeRenderFeatureProps } from '../../../featureFactory';\nimport { calculateFieldLeft } from '../freeze';\n\nexport const COLUMN_RESIZING_CLASS = 'column-resizing';\n\nexport function setColumnStyle(\n domContainer: View['domContainer'],\n style: string,\n columnId: number,\n value: number\n) {\n domContainer?.style?.setProperty(`--col-${style}-${columnId}`, `${value}px`);\n}\n\nconst getResizedColumnWidth = (\n column: Column,\n distanceDragged: number,\n currentCell: HTMLElement | null\n): number => {\n const renderedWidth = currentCell?.offsetWidth;\n // Use measured width when available; otherwise use configured/stored width.\n const measuredWidth = renderedWidth && renderedWidth > 0 ? renderedWidth : undefined;\n const currentWidth =\n measuredWidth ?? column.currentWidth ?? column.field.width ?? column.field.minWidth ?? 0;\n\n let width = currentWidth + distanceDragged;\n // TODO: confirm with designers if we want to limit the column sizing within the maxWidth(if defined on fieldDef). Currently only minWidth is getting honored.\n if (width < (column.field.minWidth ?? 0)) {\n width = column.field.minWidth ?? 0;\n }\n return width;\n};\n\nexport const getNextFrozenColumns = (\n columnId: string,\n freezeColumns: State['freezeColumns'] = []\n) => {\n const nextFrozenColumns = [];\n const freezeColIndex = freezeColumns.indexOf(columnId); // If current column freezed\n if (freezeColIndex > -1) {\n for (let i = freezeColIndex + 1; i < freezeColumns.length; i += 1) {\n nextFrozenColumns.push(freezeColumns[i]);\n }\n }\n return nextFrozenColumns;\n};\n\nexport const columnResizerProps = ([{ getState, getView, dispatch }]: [\n BeforeRenderFeatureProps\n]) => {\n const { freezeColumns, hiddenColumns, columnWidths = {} } = getState();\n let column: Column | undefined;\n let startPosition = 0;\n let resized = false;\n let updatedWidth = 0;\n let currentCell: HTMLElement | null = null;\n let currentCellOccupiedWidthBeforeResize = 0;\n let nextFrozenColumns: string[] = [];\n let resizeDocument: Document | null = null;\n\n const updateWidth = (distance: number) => {\n if (!column) return;\n updatedWidth = getResizedColumnWidth(\n { ...column, currentWidth: column.currentWidth } as Column,\n distance,\n currentCell\n );\n column = column.setProp('currentWidth', updatedWidth);\n setColumnStyle(getView().getDomContainer(), 'width', column.field.idHash!, updatedWidth);\n };\n\n /**\n * Update left positions to frozen columns or right of this column.\n */\n const updateLefts = () => {\n nextFrozenColumns.forEach(colId => {\n const left = calculateFieldLeft(\n colId,\n getView().columns,\n freezeColumns,\n hiddenColumns,\n column ? { ...columnWidths, [column.field.id]: updatedWidth } : columnWidths // injecting the resized width to current column\n );\n const nextFrozenColumn = getView().columns?.find(c => `${c.field.id}` === colId);\n setColumnStyle(getView().getDomContainer(), 'left', nextFrozenColumn!.field.idHash!, left);\n });\n };\n\n const resizeHandler = (e: MouseEvent) => {\n if (!currentCell || !column) return;\n e.preventDefault();\n\n const distance = e.clientX - startPosition;\n const parentContainer = getView().getVirtualizeElement('rootVirtualiser')?.getParentContainer();\n const clientWidth = parentContainer?.clientWidth ?? 0;\n const scrollWidth = parentContainer?.scrollWidth ?? 0;\n\n // Prevent reducing size for fillAvailableSpace column if the size reduction will introduce empty space in the table.\n const preventSizeReductionForFillAvailableSpaceColumn =\n column.field.fillAvailableSpace &&\n distance <= 0 &&\n currentCellOccupiedWidthBeforeResize <= (currentCell.offsetWidth ?? 0) &&\n clientWidth === scrollWidth;\n\n if (preventSizeReductionForFillAvailableSpaceColumn) {\n return;\n }\n\n if (distance !== 0) {\n updateWidth(distance);\n updateLefts();\n resized = true;\n }\n startPosition = e.clientX;\n };\n\n const resizeEndHandler = (e: MouseEvent) => {\n e.preventDefault();\n if (!currentCell || !column) return;\n\n resizeDocument?.removeEventListener('mousemove', resizeHandler);\n resizeDocument?.removeEventListener('mouseup', resizeEndHandler);\n if (resized) {\n dispatch(actionColumnResize({ [column.field.id]: updatedWidth }));\n resized = false;\n }\n currentCell.style.pointerEvents = 'auto';\n currentCell.classList.toggle(COLUMN_RESIZING_CLASS);\n getView().getDomContainer()?.classList.toggle(COLUMN_RESIZING_CLASS);\n // Reset the temporary body cursor override when resize interaction ends.\n resizeDocument?.body?.style.setProperty('cursor', '');\n };\n\n const onMouseDown = (e: MouseEvent) => {\n if (!isInstance(e.target, HTMLElement)) return;\n\n e.preventDefault();\n e.stopPropagation();\n\n const domContainer = getView().getDomContainer();\n if (!domContainer) return;\n\n resizeDocument = domContainer.ownerDocument;\n\n resizeDocument.addEventListener('mousemove', resizeHandler);\n resizeDocument.addEventListener('mouseup', resizeEndHandler);\n\n currentCell = e.target.closest('.cell');\n if (!currentCell) return;\n currentCell.style.pointerEvents = 'none';\n\n column = getView().columns?.find(c => `${c.field.id}` === currentCell?.dataset.colId);\n\n if (!column) return;\n\n startPosition = e.clientX;\n currentCellOccupiedWidthBeforeResize = currentCell.offsetWidth ?? 0;\n\n if (e.detail >= 2 && column.field.resize) {\n dispatch(actionColumnAutoSize(column, domContainer, true));\n }\n\n currentCell.classList.toggle(COLUMN_RESIZING_CLASS);\n domContainer.classList.toggle(COLUMN_RESIZING_CLASS);\n // Keep resize cursor visible even when pointer moves outside the handle.\n resizeDocument.body.style.setProperty('cursor', 'col-resize');\n // TODO: getState().freezeColumns should\n // give latest state after the action triggered from current feature only on above lines. Check this.\n nextFrozenColumns = getNextFrozenColumns(currentCell.dataset.colId!, getState().freezeColumns);\n };\n\n return { onMouseDown };\n};\n\nexport default () => {\n const memoizedColumnResize = withMemoization(columnResizerProps);\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const { freezeColumns, visibleColumns, columnWidths } = featureProps.getState();\n featureProps\n .getRsStore()\n .setColumnResizerProps(\n memoizedColumnResize([featureProps], [freezeColumns, visibleColumns, columnWidths])\n );\n };\n};\n"]}
|
|
@@ -4,14 +4,16 @@ import type { BeforeRenderFeatureProps } from '../../featureFactory';
|
|
|
4
4
|
import type { State } from '../../../../../types/State.types';
|
|
5
5
|
export declare const isTranslationKey: (key: string) => key is keyof typeof defaultTranslations;
|
|
6
6
|
/**
|
|
7
|
-
* Prepares newly visible and
|
|
7
|
+
* Prepares newly visible, grouped, and custom-field-dependent {@link Column columns} for the view.
|
|
8
8
|
*
|
|
9
|
-
* Runs on {@link State.visibleColumns visibleColumns}
|
|
10
|
-
*
|
|
9
|
+
* Runs on {@link State.visibleColumns visibleColumns}, {@link State.groups groups},
|
|
10
|
+
* and {@link State.customFields customFields} state changes.
|
|
11
|
+
* Finds column IDs that are present in `visibleColumns`, `groups`, or referenced in
|
|
12
|
+
* `customFields` expressions but not yet in {@link View.columns view.columns},
|
|
11
13
|
* creates a {@link Column} for each using the corresponding {@link FieldDef} from the store.
|
|
12
14
|
*
|
|
13
15
|
* @param rsInternal - The internal RS object used to access the view and store.
|
|
14
|
-
* @param state - The current RS state containing `visibleColumns` and `
|
|
16
|
+
* @param state - The current RS state containing `visibleColumns`, `groups`, and `customFields`.
|
|
15
17
|
*/
|
|
16
18
|
export declare function prepareNewlyVisibleAndReferredColumns([rsInternal, state]: [
|
|
17
19
|
rsInternal: RsInternal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareColumns.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareColumns.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAelD,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAqB9D,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,GAAG,IAAI,MAAM,OAAO,mBAElE,CAAC;AA4IF
|
|
1
|
+
{"version":3,"file":"prepareColumns.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareColumns.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAelD,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAqB9D,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,GAAG,IAAI,MAAM,OAAO,mBAElE,CAAC;AA4IF;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;IACzE,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,KAAK;CACb,QAyCA;AAED;;GAEG;yBACa,YAAY,UAAU,MAMZ,cAAc,wBAAwB;AANhE,wBAeE"}
|
|
@@ -118,22 +118,32 @@ function prepareColumns([rsInternal]) {
|
|
|
118
118
|
rsInternal.getView().setProp({ columns });
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
|
-
* Prepares newly visible and
|
|
121
|
+
* Prepares newly visible, grouped, and custom-field-dependent {@link Column columns} for the view.
|
|
122
122
|
*
|
|
123
|
-
* Runs on {@link State.visibleColumns visibleColumns}
|
|
124
|
-
*
|
|
123
|
+
* Runs on {@link State.visibleColumns visibleColumns}, {@link State.groups groups},
|
|
124
|
+
* and {@link State.customFields customFields} state changes.
|
|
125
|
+
* Finds column IDs that are present in `visibleColumns`, `groups`, or referenced in
|
|
126
|
+
* `customFields` expressions but not yet in {@link View.columns view.columns},
|
|
125
127
|
* creates a {@link Column} for each using the corresponding {@link FieldDef} from the store.
|
|
126
128
|
*
|
|
127
129
|
* @param rsInternal - The internal RS object used to access the view and store.
|
|
128
|
-
* @param state - The current RS state containing `visibleColumns` and `
|
|
130
|
+
* @param state - The current RS state containing `visibleColumns`, `groups`, and `customFields`.
|
|
129
131
|
*/
|
|
130
132
|
export function prepareNewlyVisibleAndReferredColumns([rsInternal, state]) {
|
|
131
133
|
const rsStore = rsInternal.getRsStore();
|
|
132
134
|
const groupColumnIds = state.groups?.map(group => group.columnId) ?? [];
|
|
133
135
|
const groupAdditionalFieldIds = state.groups?.flatMap(group => group.additionalFields?.map(field => field.id) ?? []) ?? [];
|
|
136
|
+
// Custom field expressions reference dependent column IDs as plain strings.
|
|
137
|
+
// These columns may be hidden but still need Column generators for rendering.
|
|
138
|
+
const customFieldDependentColumnIds = state.customFields?.flatMap(cf => cf.expression.filter((e) => typeof e === 'string')) ?? [];
|
|
134
139
|
// Grouped columns are also created for group headers and labels.
|
|
135
140
|
const visibleAndGroupedColumns = [
|
|
136
|
-
...new Set([
|
|
141
|
+
...new Set([
|
|
142
|
+
...(state.visibleColumns ?? []),
|
|
143
|
+
...groupColumnIds,
|
|
144
|
+
...groupAdditionalFieldIds,
|
|
145
|
+
...customFieldDependentColumnIds
|
|
146
|
+
])
|
|
137
147
|
];
|
|
138
148
|
// Finding columns that are newly added in visibleColumns and groups, which are not yet present in view.columns.
|
|
139
149
|
const newlyAddedColumns = visibleAndGroupedColumns.filter(columnId => !rsInternal.getView().columns?.some(col => col.field.id === columnId));
|
|
@@ -160,7 +170,7 @@ export default (rsInternal) => {
|
|
|
160
170
|
return function execute(featureProps) {
|
|
161
171
|
const state = featureProps.getState();
|
|
162
172
|
memoizedPrepareColumns([rsInternal], [rsInternal.getView().meta]);
|
|
163
|
-
memoizedPrepareNewlyVisibleAndReferredColumns([rsInternal, state], [state.visibleColumns, state.groups]);
|
|
173
|
+
memoizedPrepareNewlyVisibleAndReferredColumns([rsInternal, state], [state.visibleColumns, state.groups, state.customFields]);
|
|
164
174
|
memoizedPrepareOOTBColumns([rsInternal], [rsInternal.getView().meta]);
|
|
165
175
|
};
|
|
166
176
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareColumns.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareColumns.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EACL,6BAA6B,EAG9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAG/D,OAAO,MAAM,MAAM,qCAAqC,CAAC;AAEzD,MAAM,sBAAsB,GAAG,CAC7B,UAAsB,EACtB,KAAe,EACf,OAA0C,EAC1C,KAAa,EACb,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,UAAU,CAAC;IACnD,MAAM,EAAE,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AC;IACF,MAAM,0BAA0B,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACvE,OAAO,SAAS,OAAO,CAAC,YAAsC;QAC5D,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAClE,6CAA6C,CAC3C,CAAC,UAAU,EAAE,KAAK,CAAC,EACnB,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CACrC,CAAC;QACF,0BAA0B,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n isRowActionFieldEnabled,\n isRowErrorFieldEnabled,\n isRowReorderFieldEnabled,\n isRowSelectFieldEnabled,\n withMemoization\n} from '../../../utils/util';\nimport type RsInternal from '../../../RsInternal';\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type View from '../../../generators/ViewGenerator';\nimport {\n REPEATING_STRUCTURE_TEMPLATES,\n type FieldDef,\n type Meta\n} from '../../../../../types/Meta.types';\nimport {\n rowActionColumnMeta,\n rowDragDropColumnMeta,\n rowErrorColumnMeta,\n rowSelectColumnMeta\n} from '../../../constants';\nimport type { ColumnConfig } from '../../../generators/ColumnGenerator.types';\nimport defaultTranslations from '../../../defaultTranslations';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport type { State } from '../../../../../types/State.types';\nimport Column from '../../../generators/ColumnGenerator';\n\nconst addFrozenColumnAtIndex = (\n rsInternal: RsInternal,\n field: FieldDef,\n options: OmitStrict<ColumnConfig, 'field'>,\n index: number\n) => {\n const { getView, getRsStateResolver } = rsInternal;\n const { getState } = getRsStateResolver();\n const addedColumn = getView().addColumn(\n // error column initially should be hidden and will be displayed only when there are errors in state, unless consumer needs to display it on load.\n field,\n options\n );\n if (!getState().freezeColumns?.includes(field.id)) {\n addedColumn.applyFreezeAtIndex(index);\n }\n};\n\nexport const isTranslationKey = (key: string): key is keyof typeof defaultTranslations => {\n return key in defaultTranslations;\n};\n\n/**\n * Returns true if a column should still be created for the given fieldDef\n * even when the field is not visible (`show = false`).\n *\n * This happens when the field is required by the current template configuration\n * (e.g., Timeline, Gallery, Map) or when it is marked as a row header.\n *\n * TODO: Refactor, move template-field resolution into the RS layer (e.g. `useRepeat`).\n */\nconst shouldCreateColumnForField = (meta: Meta, fieldDef: FieldDef): boolean => {\n if (fieldDef.isRowHeader) return true;\n\n if (fieldDef.filterPickList) return true;\n\n const template = meta.template;\n\n if (template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE) {\n const { timelineFields = {} } = meta;\n\n const referenceNames = [\n timelineFields.title?.name,\n timelineFields.date?.name,\n timelineFields.content?.name,\n timelineFields.status?.name,\n timelineFields.icon?.name\n ].filter(Boolean);\n\n return referenceNames.includes(fieldDef.name);\n }\n\n if (template === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {\n const { galleryConfig = {} } = meta;\n\n const referenceIds = [\n galleryConfig.header?.field,\n galleryConfig.heroImage?.source?.field\n ].filter(Boolean);\n\n return referenceIds.includes(fieldDef.id);\n }\n\n if (template === REPEATING_STRUCTURE_TEMPLATES.MAP) {\n const { mapFieldIds = {} } = meta;\n\n const referenceIds = [mapFieldIds.location, mapFieldIds.label, mapFieldIds.content].filter(\n Boolean\n );\n\n return referenceIds.includes(fieldDef.id);\n }\n\n return false;\n};\n\nconst prepareOOTBColumns = ([rsInternal]: [rsInternal: RsInternal]) => {\n const { getView } = rsInternal;\n const translate = rsInternal.getRsStore().translate;\n let ootColumnsIndex = 0;\n // Add error column.\n if (isRowErrorFieldEnabled(getView().meta)) {\n addFrozenColumnAtIndex(\n rsInternal,\n // Error column is added as a hidden column. Toggles based on state.errors.dataErrors\n {\n ...rowErrorColumnMeta.field,\n label: isTranslationKey(rowErrorColumnMeta.field.label)\n ? translate(rowErrorColumnMeta.field.label)\n : rowErrorColumnMeta.field.label,\n show: getView().meta.rowErrorField?.show ?? false\n },\n rowErrorColumnMeta.options,\n ootColumnsIndex\n );\n ootColumnsIndex += 1;\n }\n // Add row drag drop column.\n if (isRowReorderFieldEnabled(getView().meta)) {\n addFrozenColumnAtIndex(\n rsInternal,\n {\n ...rowDragDropColumnMeta.field,\n label: isTranslationKey(rowDragDropColumnMeta.field.label)\n ? translate(rowDragDropColumnMeta.field.label)\n : rowDragDropColumnMeta.field.label,\n show: getView().meta.rowReorderField?.show ?? true\n },\n rowDragDropColumnMeta.options,\n ootColumnsIndex\n );\n ootColumnsIndex += 1;\n }\n // Add selection column.\n if (isRowSelectFieldEnabled(getView().meta)) {\n addFrozenColumnAtIndex(\n rsInternal,\n {\n ...rowSelectColumnMeta.field,\n label: isTranslationKey(rowSelectColumnMeta.field.label)\n ? translate(rowSelectColumnMeta.field.label)\n : rowSelectColumnMeta.field.label\n },\n rowSelectColumnMeta.options,\n ootColumnsIndex\n );\n }\n\n // Add row action column.\n if (isRowActionFieldEnabled(getView().meta)) {\n getView().addColumn(\n {\n ...rowActionColumnMeta.field,\n label: isTranslationKey(rowActionColumnMeta.field.label)\n ? translate(rowActionColumnMeta.field.label)\n : rowActionColumnMeta.field.label\n },\n rowActionColumnMeta.options\n );\n }\n};\n\n/**\n * Prepares {@link Column columns} for the view on initial load.\n * Creates columns only for {@link FieldDef fieldDefs} that are visible or row headers.\n *\n * @param rsInternal - The internal RS object used to access the view and store.\n */\nfunction prepareColumns([rsInternal]: [rsInternal: RsInternal]) {\n const { fieldDefs } = rsInternal.getView().meta;\n\n const columns = fieldDefs\n .filter(\n fieldDef => fieldDef.show || shouldCreateColumnForField(rsInternal.getView().meta, fieldDef)\n )\n .map(fieldDef => new Column({ field: fieldDef }, rsInternal));\n\n rsInternal.getView().setProp({ columns });\n}\n\n/**\n * Prepares newly visible and grouped {@link Column columns} for the view.\n *\n * Runs on {@link State.visibleColumns visibleColumns} and {@link State.groups groups} state changes.\n * Finds column IDs that are present in `visibleColumns` or `groups` but not yet in {@link View.columns view.columns},\n * creates a {@link Column} for each using the corresponding {@link FieldDef} from the store.\n *\n * @param rsInternal - The internal RS object used to access the view and store.\n * @param state - The current RS state containing `visibleColumns` and `groups`.\n */\nexport function prepareNewlyVisibleAndReferredColumns([rsInternal, state]: [\n rsInternal: RsInternal,\n state: State\n]) {\n const rsStore = rsInternal.getRsStore();\n const groupColumnIds = state.groups?.map(group => group.columnId) ?? [];\n const groupAdditionalFieldIds =\n state.groups?.flatMap(group => group.additionalFields?.map(field => field.id) ?? []) ?? [];\n\n // Grouped columns are also created for group headers and labels.\n const visibleAndGroupedColumns = [\n ...new Set([...(state.visibleColumns ?? []), ...groupColumnIds, ...groupAdditionalFieldIds])\n ];\n\n // Finding columns that are newly added in visibleColumns and groups, which are not yet present in view.columns.\n const newlyAddedColumns = visibleAndGroupedColumns.filter(\n columnId => !rsInternal.getView().columns?.some(col => col.field.id === columnId)\n );\n\n if (!newlyAddedColumns.length) return;\n\n const createdColumns = newlyAddedColumns.reduce<Column[]>((acc, columnId) => {\n const fieldDef = rsStore.getFieldDefById(columnId);\n if (fieldDef) {\n acc.push(new Column({ field: fieldDef }, rsInternal));\n }\n return acc;\n }, []);\n\n rsInternal.getView().setProp({\n columns: [...(rsInternal.getView().columns ?? []), ...createdColumns]\n });\n}\n\n/**\n * Prepares {@link View.columns columns} for the view from {@link Meta.fieldDefs fieldDefs}.\n */\nexport default (rsInternal: RsInternal) => {\n const memoizedPrepareColumns = withMemoization(prepareColumns);\n const memoizedPrepareNewlyVisibleAndReferredColumns = withMemoization(\n prepareNewlyVisibleAndReferredColumns\n );\n const memoizedPrepareOOTBColumns = withMemoization(prepareOOTBColumns);\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const state = featureProps.getState();\n memoizedPrepareColumns([rsInternal], [rsInternal.getView().meta]);\n memoizedPrepareNewlyVisibleAndReferredColumns(\n [rsInternal, state],\n [state.visibleColumns, state.groups]\n );\n memoizedPrepareOOTBColumns([rsInternal], [rsInternal.getView().meta]);\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"prepareColumns.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareColumns.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EACL,6BAA6B,EAG9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAG/D,OAAO,MAAM,MAAM,qCAAqC,CAAC;AAEzD,MAAM,sBAAsB,GAAG,CAC7B,UAAsB,EACtB,KAAe,EACf,OAA0C,EAC1C,KAAa,EACb,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,UAAU,CAAC;IACnD,MAAM,EAAE,QAAQ,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAC1C,MAAM,WAAW,GAAG,OAAO,EAAE,CAAC,SAAS;IACrC,kJAAkJ;IAClJ,KAAK,EACL,OAAO,CACR,CAAC;IACF,IAAI,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAA2C,EAAE;IACvF,OAAO,GAAG,IAAI,mBAAmB,CAAC;AACpC,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,0BAA0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,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAClE,6CAA6C,CAC3C,CAAC,UAAU,EAAE,KAAK,CAAC,EACnB,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CACzD,CAAC;QACF,0BAA0B,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n isRowActionFieldEnabled,\n isRowErrorFieldEnabled,\n isRowReorderFieldEnabled,\n isRowSelectFieldEnabled,\n withMemoization\n} from '../../../utils/util';\nimport type RsInternal from '../../../RsInternal';\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type View from '../../../generators/ViewGenerator';\nimport {\n REPEATING_STRUCTURE_TEMPLATES,\n type FieldDef,\n type Meta\n} from '../../../../../types/Meta.types';\nimport {\n rowActionColumnMeta,\n rowDragDropColumnMeta,\n rowErrorColumnMeta,\n rowSelectColumnMeta\n} from '../../../constants';\nimport type { ColumnConfig } from '../../../generators/ColumnGenerator.types';\nimport defaultTranslations from '../../../defaultTranslations';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport type { State } from '../../../../../types/State.types';\nimport Column from '../../../generators/ColumnGenerator';\n\nconst addFrozenColumnAtIndex = (\n rsInternal: RsInternal,\n field: FieldDef,\n options: OmitStrict<ColumnConfig, 'field'>,\n index: number\n) => {\n const { getView, getRsStateResolver } = rsInternal;\n const { getState } = getRsStateResolver();\n const addedColumn = getView().addColumn(\n // error column initially should be hidden and will be displayed only when there are errors in state, unless consumer needs to display it on load.\n field,\n options\n );\n if (!getState().freezeColumns?.includes(field.id)) {\n addedColumn.applyFreezeAtIndex(index);\n }\n};\n\nexport const isTranslationKey = (key: string): key is keyof typeof defaultTranslations => {\n return key in defaultTranslations;\n};\n\n/**\n * Returns true if a column should still be created for the given fieldDef\n * even when the field is not visible (`show = false`).\n *\n * This happens when the field is required by the current template configuration\n * (e.g., Timeline, Gallery, Map) or when it is marked as a row header.\n *\n * TODO: Refactor, move template-field resolution into the RS layer (e.g. `useRepeat`).\n */\nconst shouldCreateColumnForField = (meta: Meta, fieldDef: FieldDef): boolean => {\n if (fieldDef.isRowHeader) return true;\n\n if (fieldDef.filterPickList) return true;\n\n const template = meta.template;\n\n if (template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE) {\n const { timelineFields = {} } = meta;\n\n const referenceNames = [\n timelineFields.title?.name,\n timelineFields.date?.name,\n timelineFields.content?.name,\n timelineFields.status?.name,\n timelineFields.icon?.name\n ].filter(Boolean);\n\n return referenceNames.includes(fieldDef.name);\n }\n\n if (template === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {\n const { galleryConfig = {} } = meta;\n\n const referenceIds = [\n galleryConfig.header?.field,\n galleryConfig.heroImage?.source?.field\n ].filter(Boolean);\n\n return referenceIds.includes(fieldDef.id);\n }\n\n if (template === REPEATING_STRUCTURE_TEMPLATES.MAP) {\n const { mapFieldIds = {} } = meta;\n\n const referenceIds = [mapFieldIds.location, mapFieldIds.label, mapFieldIds.content].filter(\n Boolean\n );\n\n return referenceIds.includes(fieldDef.id);\n }\n\n return false;\n};\n\nconst prepareOOTBColumns = ([rsInternal]: [rsInternal: RsInternal]) => {\n const { getView } = rsInternal;\n const translate = rsInternal.getRsStore().translate;\n let ootColumnsIndex = 0;\n // Add error column.\n if (isRowErrorFieldEnabled(getView().meta)) {\n addFrozenColumnAtIndex(\n rsInternal,\n // Error column is added as a hidden column. Toggles based on state.errors.dataErrors\n {\n ...rowErrorColumnMeta.field,\n label: isTranslationKey(rowErrorColumnMeta.field.label)\n ? translate(rowErrorColumnMeta.field.label)\n : rowErrorColumnMeta.field.label,\n show: getView().meta.rowErrorField?.show ?? false\n },\n rowErrorColumnMeta.options,\n ootColumnsIndex\n );\n ootColumnsIndex += 1;\n }\n // Add row drag drop column.\n if (isRowReorderFieldEnabled(getView().meta)) {\n addFrozenColumnAtIndex(\n rsInternal,\n {\n ...rowDragDropColumnMeta.field,\n label: isTranslationKey(rowDragDropColumnMeta.field.label)\n ? translate(rowDragDropColumnMeta.field.label)\n : rowDragDropColumnMeta.field.label,\n show: getView().meta.rowReorderField?.show ?? true\n },\n rowDragDropColumnMeta.options,\n ootColumnsIndex\n );\n ootColumnsIndex += 1;\n }\n // Add selection column.\n if (isRowSelectFieldEnabled(getView().meta)) {\n addFrozenColumnAtIndex(\n rsInternal,\n {\n ...rowSelectColumnMeta.field,\n label: isTranslationKey(rowSelectColumnMeta.field.label)\n ? translate(rowSelectColumnMeta.field.label)\n : rowSelectColumnMeta.field.label\n },\n rowSelectColumnMeta.options,\n ootColumnsIndex\n );\n }\n\n // Add row action column.\n if (isRowActionFieldEnabled(getView().meta)) {\n getView().addColumn(\n {\n ...rowActionColumnMeta.field,\n label: isTranslationKey(rowActionColumnMeta.field.label)\n ? translate(rowActionColumnMeta.field.label)\n : rowActionColumnMeta.field.label\n },\n rowActionColumnMeta.options\n );\n }\n};\n\n/**\n * Prepares {@link Column columns} for the view on initial load.\n * Creates columns only for {@link FieldDef fieldDefs} that are visible or row headers.\n *\n * @param rsInternal - The internal RS object used to access the view and store.\n */\nfunction prepareColumns([rsInternal]: [rsInternal: RsInternal]) {\n const { fieldDefs } = rsInternal.getView().meta;\n\n const columns = fieldDefs\n .filter(\n fieldDef => fieldDef.show || shouldCreateColumnForField(rsInternal.getView().meta, fieldDef)\n )\n .map(fieldDef => new Column({ field: fieldDef }, rsInternal));\n\n rsInternal.getView().setProp({ columns });\n}\n\n/**\n * Prepares newly visible, grouped, and custom-field-dependent {@link Column columns} for the view.\n *\n * Runs on {@link State.visibleColumns visibleColumns}, {@link State.groups groups},\n * and {@link State.customFields customFields} state changes.\n * Finds column IDs that are present in `visibleColumns`, `groups`, or referenced in\n * `customFields` expressions but not yet in {@link View.columns view.columns},\n * creates a {@link Column} for each using the corresponding {@link FieldDef} from the store.\n *\n * @param rsInternal - The internal RS object used to access the view and store.\n * @param state - The current RS state containing `visibleColumns`, `groups`, and `customFields`.\n */\nexport function prepareNewlyVisibleAndReferredColumns([rsInternal, state]: [\n rsInternal: RsInternal,\n state: State\n]) {\n const rsStore = rsInternal.getRsStore();\n const groupColumnIds = state.groups?.map(group => group.columnId) ?? [];\n const groupAdditionalFieldIds =\n state.groups?.flatMap(group => group.additionalFields?.map(field => field.id) ?? []) ?? [];\n\n // Custom field expressions reference dependent column IDs as plain strings.\n // These columns may be hidden but still need Column generators for rendering.\n const customFieldDependentColumnIds =\n state.customFields?.flatMap(cf =>\n cf.expression.filter((e): e is string => typeof e === 'string')\n ) ?? [];\n\n // Grouped columns are also created for group headers and labels.\n const visibleAndGroupedColumns = [\n ...new Set([\n ...(state.visibleColumns ?? []),\n ...groupColumnIds,\n ...groupAdditionalFieldIds,\n ...customFieldDependentColumnIds\n ])\n ];\n\n // Finding columns that are newly added in visibleColumns and groups, which are not yet present in view.columns.\n const newlyAddedColumns = visibleAndGroupedColumns.filter(\n columnId => !rsInternal.getView().columns?.some(col => col.field.id === columnId)\n );\n\n if (!newlyAddedColumns.length) return;\n\n const createdColumns = newlyAddedColumns.reduce<Column[]>((acc, columnId) => {\n const fieldDef = rsStore.getFieldDefById(columnId);\n if (fieldDef) {\n acc.push(new Column({ field: fieldDef }, rsInternal));\n }\n return acc;\n }, []);\n\n rsInternal.getView().setProp({\n columns: [...(rsInternal.getView().columns ?? []), ...createdColumns]\n });\n}\n\n/**\n * Prepares {@link View.columns columns} for the view from {@link Meta.fieldDefs fieldDefs}.\n */\nexport default (rsInternal: RsInternal) => {\n const memoizedPrepareColumns = withMemoization(prepareColumns);\n const memoizedPrepareNewlyVisibleAndReferredColumns = withMemoization(\n prepareNewlyVisibleAndReferredColumns\n );\n const memoizedPrepareOOTBColumns = withMemoization(prepareOOTBColumns);\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const state = featureProps.getState();\n memoizedPrepareColumns([rsInternal], [rsInternal.getView().meta]);\n memoizedPrepareNewlyVisibleAndReferredColumns(\n [rsInternal, state],\n [state.visibleColumns, state.groups, state.customFields]\n );\n memoizedPrepareOOTBColumns([rsInternal], [rsInternal.getView().meta]);\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/features/uIFeatures/index.ts"],"names":[],"mappings":"AAuCA,OAAO,WAAW,MAAM,4BAA4B,CAAC;;;4EALhC,kEACpB;6BAnBI,kEAAsC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/features/uIFeatures/index.ts"],"names":[],"mappings":"AAuCA,OAAO,WAAW,MAAM,4BAA4B,CAAC;;;4EALhC,kEACpB;6BAnBI,kEAAsC;6BAyEqwG,kEAAsC;uBAf5zG,kEAG1B;;0BAvDoD,kEAChB;;uBAYxB,kEAAsC;6BAsDw+B,kEAAsC;;4BA3D5gC,kEACpC;8BA0Dw5L,kEAAsC;kCA9Bp8L,kEAEV;6BApCiC,kEAChB;2BAGgB,kEAC5B;2EA2Du8C,kEAAsC;yCAjDp+C,kEAAsC;+BAiD85K,kEAAsC;4BArDt/K,kEAAsC;kCAqDusT,kEAAsC;;6EAAlgJ,kEAAsC;gCA/DvxK,kEACpB;kCAR2C,kEAC1C;4BAkEY,kEAGE;kCApEN,kEAAsC;sCAQ/B,kEAC7B;+BADwD,kEAC5B;0EA2Dq8O,kEAAsC;wEAA7qI,kEAAsC;wCA5C73G,kEAEC;4BA8BG,kEAGR;6BArE8D,kEAC5B;sEAwBtB,kEACR;2BAoDK,kEAAsC;4BA/DxB,kEACpB;;uCA8Dm0B,kEAAsC;;;0BAAynD,sDAA0B;iCAA+wC,sDAA0B;yCA7DhwH,sDAC5B;;;AAaZ,wBA8CE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewUtilityMockSetup.d.ts","sourceRoot":"","sources":["../../../../../src/core/generators/__tests__/viewUtilityMockSetup.js"],"names":[],"mappings":"AAGA;;;;;
|
|
1
|
+
{"version":3,"file":"viewUtilityMockSetup.d.ts","sourceRoot":"","sources":["../../../../../src/core/generators/__tests__/viewUtilityMockSetup.js"],"names":[],"mappings":"AAGA;;;;;iBAcinJ,CAAC;0BAA4C,CAAC;gCAAoD,CAAC;qCAA+D,CAAC;oBAAkD,CAAC;;;;;;;;;;;;;;;;;sBAAm6R,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAD1ub"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewUtilityMethods.d.ts","sourceRoot":"","sources":["../../../../src/core/generators/viewUtilityMethods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AAEzG,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAMhE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAQ,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,KAAK,EACV,UAAU,EACV,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACd,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"viewUtilityMethods.d.ts","sourceRoot":"","sources":["../../../../src/core/generators/viewUtilityMethods.ts"],"names":[],"mappings":"AAAA,OAAO,KA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AEG;;IAiCH;;OAEG;;IAkBH;;;OAGG;qCAC8B;QAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;KAAE;wDAKxC,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAKxE;;;;;OAKG;6BACsB,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;EAMzD;AACD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -535,13 +535,23 @@ export default function viewUtilityMethods(rsInternal) {
|
|
|
535
535
|
* Triggers {@link ApiContext.exportData exportData} api.
|
|
536
536
|
*/
|
|
537
537
|
exportToExcel() {
|
|
538
|
+
function getVisibleColumnFormatters() {
|
|
539
|
+
const visibleColumns = getView().getVisibleColumns();
|
|
540
|
+
const formatters = {};
|
|
541
|
+
visibleColumns?.forEach(column => {
|
|
542
|
+
if (column.formatterConfig) {
|
|
543
|
+
formatters[column.field.id] = column.formatterConfig;
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
return formatters;
|
|
547
|
+
}
|
|
538
548
|
return getRsProps()
|
|
539
549
|
.apiContext.exportData?.(deepCopy(getView().state), getView().meta, {
|
|
540
550
|
...(getRsStore().refreshInProgress && {
|
|
541
551
|
invalidateCache: true,
|
|
542
552
|
invalidateCacheToken: getRsStore().refreshToken
|
|
543
553
|
})
|
|
544
|
-
})
|
|
554
|
+
}, getVisibleColumnFormatters())
|
|
545
555
|
.catch(err => {
|
|
546
556
|
getRsStateResolver().dispatch(actions.actionNotificationAdd({
|
|
547
557
|
content: err
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewUtilityMethods.js","sourceRoot":"","sources":["../../../../src/core/generators/viewUtilityMethods.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,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AAC;oBAC5B,OAAO,EAAE,GAAG;iBACb,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACP,CAAC;QAED;;;WAGG;QACH,uBAAuB,CAAC,OAA2C;YACjE,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1E,CAAC;QAED,0BAA0B,CACxB,uBAAsE;YAEtE,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,0BAA0B,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC7F,CAAC;QAED;;;;;WAKG;QACH,cAAc,CAAC,QAAuC;YACpD,IAAI,OAAO,EAAE,CAAC,IAAI,CAAC,mBAAmB,KAAK,KAAK;gBAAE,OAAO;YACzD,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxE,CAAC;KACF,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\nimport type { ModalManagerContextValue } from '@pega/cosmos-react-core/lib/components/Modal/Modal.types';\n\nimport type RsInternal from '../RsInternal';\nimport ActionTypes from '../actions/actionConstants';\nimport * as actions from '../actions/actions';\nimport { rowSelectColumnMeta } from '../constants';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { SUPPORTED_AVOIDABLE_FEATURES, SUPPORTED_FLUSH_KEYS } from '../constants';\nimport { validateAction, passablePromise, deepCopy, deepEqual } from '../utils/util';\nimport type { Errors, State } from '../../../types/State.types';\n// This is being used in JSdoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ApiContext, ApiOptions } from '../../../types/ApiContext.types';\n// This is being used in JSdoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef, GalleryLayout, Meta, ROW_DENSITY } from '../../../types/Meta.types';\nimport type {\n ActionMeta,\n ApplyAliasesActionPayload,\n ColumnFilteringActionPayload,\n ExpandCollapsePayload,\n PaginationPayload\n} from '../actions/actions.types';\n\nimport type View from './ViewGenerator';\nimport type { RowData } from './RowGenerator.types';\nimport type {\n DebugInfo,\n RefreshNotification,\n RequiredDefinition,\n WarningDetail\n} from './ViewGenerator.types';\n\nexport type RefreshNotificationForConsumer = OmitStrict<RefreshNotification, 'id'>;\n\nexport type SupportedConsumerPayloads = {\n [ActionTypes.USER_CONFIRMATION_ACTION]: OmitStrict<\n NonNullable<View['confirmationActionDetails']>,\n 'onSubmit' | 'onCancel'\n >;\n [ActionTypes.UPDATE_DEBUG_INFO]: DebugInfo;\n [ActionTypes.TOGGLE_DISABLE_SELECTION]: boolean;\n [ActionTypes.TOGGLE_REQUIRED]: RequiredDefinition;\n [ActionTypes.NOTIFY_DATA_REFRESH]: RefreshNotificationForConsumer;\n [ActionTypes.SET_IN_EXTERNAL_STATE]: NonNullable<State['externalState']>;\n [ActionTypes.UPDATE_SELECTED_ROWS]: undefined;\n [ActionTypes.SET_WARNING_MESSAGES]: WarningDetail[];\n};\n\nexport type SupportedConsumerActionType = keyof SupportedConsumerPayloads;\n\nfunction syncData(key: string, sourceArray: RowData[], modifiedArray: RowData[]) {\n return sourceArray.map(item => {\n const item2 = modifiedArray.find(i2 => i2[key] === item[key]);\n return item2 || item;\n });\n}\n\nexport default function viewUtilityMethods(rsInternal: RsInternal) {\n const { getRsProps, getRsStateResolver, getView, getRsStore } = rsInternal;\n\n const utilMethods = {\n /**\n * Dispatches an action that creates a new state object without any internal modifications.\n *\n * If {@link instantRender} is false and {@link forceUpdateFeatures} are provided,\n * it updates the {@link State.forceUpdateFeatures forceUpdateFeatures} slice in the state.\n *\n * @param instantRender - Determines if the render should happen instantly.\n * @param forceUpdateFeatures - The features to force update in the state on next render cycle.\n */\n forceUpdate(instantRender?: boolean, forceUpdateFeatures?: State['forceUpdateFeatures']) {\n getRsStateResolver().dispatch(actions.actionForceUpdate(instantRender, forceUpdateFeatures));\n },\n\n /**\n * Handles the reordering of rows.\n *\n * If {@link Meta.moveListRecords moveListRecords} is set to true in Meta, it dispatches an action\n * that updates the keys of the {@link sourceKey source} row and the {@link destinationKey destination} row\n * in the {@link State.sourceKey sourceKey} and {@link State.destinationKey destinationKey} state slices, respectively.\n *\n * Otherwise, it calls {@link ApiContext.applyRowReorder applyRowReorder} from the apiContext and triggers\n * a {@link utilMethods.forceRefresh forceRefresh} on the state.\n *\n * @param sourceKey - The itemKey for the row being dragged.\n * @param destinationKey - The itemKey for the row on which it is dropped.\n */\n handleRowReorder(sourceKey: string, destinationKey: string) {\n if (getView()?.meta?.moveListRecords) {\n getRsStateResolver().dispatch(\n actions.actionMoveRecordKeysUpdate({\n sourceKey,\n destinationKey\n })\n );\n return;\n }\n getRsProps()\n .apiContext.applyRowReorder?.(sourceKey, destinationKey)\n .then(() => {\n utilMethods.forceRefresh();\n });\n },\n\n /**\n * Sets the count-related information onto the {@link View view} via {@link View.setProp setProp} and triggers {@link utilMethods.forceUpdate forceUpdate}.\n *\n * @param args - The count information object.\n * @param args.count - The total record count of the view, including group headers.\n * @param args.hasMoreResults - Indicates if the view has more records.\n * @param args.selectedRecordsCount - The total count of selected records.\n * @param args._countGeneratedInternally - Indicates if the count is generated internally. This is used for RS core internal purposes. Setting this from apiContext might lead to erroneous behavior.\n * @returns void\n */\n setRecordCount({\n count,\n hasMoreResults,\n selectedRecordsCount,\n _countGeneratedInternally,\n announce\n }: {\n count?: View['resultsCount'];\n hasMoreResults?: View['hasMoreResults'];\n selectedRecordsCount?: View['selectedRecordsCount'];\n _countGeneratedInternally?: View['countGeneratedInternally'];\n announce?: View['announceCount'];\n }) {\n // NOTE: setRecordCount can be called with partial props. So while doing setProp we need to make sure to check the existence of incoming prop value.\n // If incoming prop is undefined then it should have a fallback otherwise it will override existing value on view to undefined.\n getView().setProp({\n countGeneratedInternally: !!_countGeneratedInternally,\n hasMoreResults: hasMoreResults ?? false,\n resultsCount: count,\n selectedRecordsCount: selectedRecordsCount ?? getView().selectedRecordsCount,\n showCount: !Number.isFinite(count) ? false : !_countGeneratedInternally,\n announceCount: announce\n });\n // If count is not finite then do instantRender as we want to hide the count immediately and don't want the StateResolver queue to be empty.\n // Else the count will be displayed after the StateResolver queue becomes empty.\n const instantRender = !Number.isFinite(count);\n utilMethods.forceUpdate(instantRender);\n },\n\n /**\n * Dispatches an action to interact with repeating structures, allowing consumers\n * to perform operations using standard actions and payloads.\n *\n * @param action The action to be dispatched.\n * @param payload The payload associated with the action.\n * @returns The return value after the action has been processed by the repeating structure.\n */\n // TODO Refactor- this method to have only one parameter action object that contains type and payload. Maintenance of it will be easy.\n // TODO Make it generic specific.\n dispatchAction<T extends SupportedConsumerActionType>(\n action: T,\n payload?: SupportedConsumerPayloads[T]\n ): Promise<any> | undefined {\n const { dispatch } = getRsStateResolver();\n validateAction(action, payload, getView().externalStateKeys);\n\n let actionReturnValue;\n switch (action) {\n case ActionTypes.USER_CONFIRMATION_ACTION:\n // eslint-disable-next-line no-case-declarations\n const [promise, onSubmit, onCancel] = passablePromise<any>();\n getView().setProp({\n confirmationActionDetails: {\n onSubmit,\n onCancel,\n ...(payload as OmitStrict<\n NonNullable<View['confirmationActionDetails']>,\n 'onSubmit' | 'onCancel'\n >)\n }\n });\n dispatch(actions.showConfirmationAction());\n actionReturnValue = promise;\n break;\n case ActionTypes.UPDATE_DEBUG_INFO:\n getView().setProp({ debugInfo: [payload as DebugInfo] });\n utilMethods.forceUpdate(false);\n break;\n case ActionTypes.TOGGLE_DISABLE_SELECTION: {\n let rowSelectColumn = getView().columns?.find(\n column => column.field.id === rowSelectColumnMeta.field.id\n );\n if (rowSelectColumn) {\n rowSelectColumn = rowSelectColumn.setProp({\n disableSelection: payload as boolean\n });\n utilMethods.forceUpdate(false);\n }\n break;\n }\n case ActionTypes.TOGGLE_REQUIRED:\n getView().setProp({ requiredDef: payload as RequiredDefinition });\n utilMethods.forceUpdate(false);\n break;\n case ActionTypes.NOTIFY_DATA_REFRESH:\n getView().setProp('refreshNotification', {\n id: Date.now(),\n ...(payload as RefreshNotificationForConsumer)\n });\n utilMethods.forceUpdate(false);\n break;\n case ActionTypes.SET_IN_EXTERNAL_STATE:\n dispatch(actions.setExternalState(payload as NonNullable<State['externalState']>));\n break;\n case ActionTypes.UPDATE_SELECTED_ROWS:\n utilMethods.forceUpdate(false, {\n updateSelectedRows: new Date().getTime()\n });\n break;\n case ActionTypes.SET_WARNING_MESSAGES:\n if (!deepEqual(getView().getWarningMessages(), payload)) {\n getView().setProp({ warningMessages: payload as WarningDetail[] });\n utilMethods.forceUpdate(false);\n }\n break;\n default:\n }\n return actionReturnValue;\n },\n\n /** Returns the Html events required for reordering a column. */\n getFieldReorderProps() {\n return getRsStore().getFieldReorderProps?.();\n },\n\n // TODO: this should be moved to group generator instance.\n /**\n * Triggers the expand or collapse action for a group header.\n * Dispatches an action to update the {@link State.groupToggle groupToggle} slices in the state.\n *\n * @param payload The data related to the groups.\n */\n toggleGroupExpansion(payload: OmitStrict<ExpandCollapsePayload, 'groups'>) {\n getRsStateResolver().dispatch(actions.actionToggleExpandCollpase(payload));\n },\n\n /**\n * Clears hierarchical groups by dispatching an action to reset the {@link State.hierarchicalGroup hierarchicalGroup} slice in the state.\n */\n clearHierarchicalGroup() {\n getRsStore().groupingInfo = [];\n getRsStateResolver().dispatch(actions.actionUpdateDisplayMode({}));\n },\n\n /**\n * Dispatches a pagination action to update {@link State.paginationOptions paginationOptions} in the state slice.\n *\n * @param payload - The pagination options to update.\n * @param actionMeta - The action metadata.\n */\n onPaginate(payload: PaginationPayload, actionMeta?: ActionMeta) {\n getRsStateResolver().dispatch(actions.actionPaginate(payload, actionMeta));\n },\n\n /**\n * Removes a notification message.\n * Dispatches an action to update the {@link State.notifications notifications} slice in the state.\n *\n * @param payload The notification messages to be removed.\n */\n removeNotification(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionNotificationRemove(payload));\n },\n\n /**\n * Applies a filter to the repeating structures.\n * Dispatches an action that updates the {@link State.filterExpression filterExpression} in the state.\n *\n * @param params The filter expression to apply.\n */\n applyFilter(params: ColumnFilteringActionPayload) {\n getRsStateResolver().dispatch(actions.actionColumnFiltering(params));\n },\n\n /**\n * Dispatches an action to replace the {@link State.columnAlias columnAlias} slice in the state.\n *\n * @param params - Parameters for the action. Specify the necessary details.\n */\n applyAliases(params: ApplyAliasesActionPayload) {\n getRsStateResolver().dispatch(actions.actionReplaceLabels(params));\n },\n\n /**\n * Clears filters for the specified {@link columnId}.\n * Dispatches an action to update the {@link State.clearColFilter clearColFilter} slice in the state.\n * @param columnId - The column on which the filter should be cleared.\n */\n clearFilter(columnId: string) {\n getRsStateResolver().dispatch(actions.actionClearFiltering(columnId));\n },\n\n /**\n * Applies grouping to repeating structures.\n * Dispatches an action that adds {@link State.groups groups} in the state.\n * @param payload\n */\n applyGrouping(payload: NonNullable<State['groups']>) {\n getRsStateResolver().dispatch(actions.actionAddGroups(payload));\n },\n\n /**\n * Applies sorting the repeating structures.\n * Dispatches an action that adds {@link State.sortingOrder sortingOrder} in state.\n * @param payload\n */\n applySorting(payload: NonNullable<State['sortingOrder']>) {\n getRsStateResolver().dispatch(actions.actionUpdateSort(payload));\n },\n\n /**\n * Toggles the visibility of header icons.\n * Dispatches an action to update {@link State.showHeaderIcons} in the state.\n *\n * @param status The status indicating whether to show or hide header icons.\n */\n updateHeaderIconsVisibility(status: NonNullable<State['showHeaderIcons']>) {\n getRsStateResolver().dispatch(actions.actionShowHeaderIcons(status));\n },\n\n /**\n * Applies freezing to a set of columns.\n * Dispatches an action to update {@link State.freezeColumns freezeColumns} in the state.\n *\n * @param payload The payload containing information about the columns to freeze.\n */\n applyFreeze(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionColumnPin(payload));\n },\n\n /**\n * Toggles the visibility of columns.\n * Dispatches an action that updates {@link State.hiddenColumns hiddenColumns} in the state.\n * @param payload\n */\n applyToggleVisibility(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionColumnToggle(payload));\n },\n\n /**\n * Sets the {@link State.hiddenColumns hiddenColumns} in the state, including out-of-the-box columns like dragHandle.\n *\n * @param payload - The payload containing columns to hide.\n * @param ootbColumns - The out-of-the-box columns to include in {@link State.hiddenColumns hiddenColumns}.\n */\n applyHiddenColumns(payload: string[], ootbColumns?: { dragHandle?: boolean }) {\n getRsStateResolver().dispatch(actions.actionHiddenColumnUpdate(payload, ootbColumns));\n },\n\n /**\n * Sets the {@link State.visibleColumns visibleColumns} in the state.\n * @param columnId - A single column ID or an array of column IDs to make visible.\n */\n applyVisibleColumns(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionVisibleColumnUpdate(payload));\n },\n\n /**\n * Dispatches an action that replace {@link State.aggregationInfo aggregationInfo} slice in the state with the given {@link payload}.\n * @param payload\n */\n applyAggregations(payload: NonNullable<State['aggregationInfo']>) {\n getRsStateResolver().dispatch(actions.actionUpdateAggregations(payload));\n },\n\n /**\n * Applies order to columns of a repeatings structure with the given {@link payload}.\n * Dispatches an action that sets {@link State.colOrder columnOrder} in the state with the given {@link payload}.\n * @param payload\n */\n applyOrder(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionNewColumnOrder(payload));\n },\n\n /**\n * Saves the current personalization state.\n * Dispatches an action that invokes {@link ApiContext.updatePersonalization} to persist the changes.\n *\n * @param personalizationKey The key representing the current personalization.\n * @param markAsDefault Whether to mark the current personalization as default.\n * @param markAsAppDefault Whether to mark the current personalization as app default.\n */\n updatePersonalization(\n personalizationKey: string,\n markAsDefault: boolean,\n markAsAppDefault: boolean\n ) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationUpdate(personalizationKey, markAsDefault, markAsAppDefault)\n );\n },\n\n /**\n * Sets the selected personalization state as the current state of the repeating structures.\n * Dispatches an action to update the {@link State} of the repeating structures with the selected personalization state,\n * and updates the active personalization in the {@link State.personalization personalization} state slice.\n *\n * @param args Method arguments.\n * @param args.id ID of the personalization to be set active.\n * @param args.isPreset Indicates if the personalization is preset.\n */\n applyActivePersonalization({ id, isPreset = false }: { id: string; isPreset: boolean }) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationSetActive({\n id,\n isPreset\n })\n );\n getRsStateResolver().dispatch(actions.actionUpdateStateVersion());\n },\n\n /**\n * Creates a new personalization in the state.\n * Dispatches an action that calls {@link ApiContext.createPersonalization createPersonalization} API to create\n * a new personalization with the provided name and saves it in the {@link State.personalization personalization}.\n *\n * @param name The name of the personalization.\n * @param markAsDefault Indicates whether the new personalization should be marked as default.\n */\n createPersonalization(name: string, markAsDefault: boolean) {\n getRsStateResolver().dispatch(actions.actionPersonalizationCreate(name, markAsDefault));\n },\n\n /**\n * Updates the name, markAsDefault, and markAsAppDefault flags of the current personalization.\n *\n * @param active The current active personalization key.\n * @param name The updated name.\n * @param markAsDefault Indicates whether the current personalization should be marked as default.\n * @param markAsAppDefault Indicates whether the current personalization should be marked as app default.\n */\n editPersonalization(\n active: string,\n name: string,\n markAsDefault: boolean,\n markAsAppDefault: boolean\n ) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationEdit(active, name, markAsDefault, markAsAppDefault)\n );\n },\n\n /**\n * Deletes the current personalization identified by the given key.\n * Dispatches an action that calls {@link ApiContext.deletePersonalization deletePersonalization} API\n * and updates the {@link State.personalization personalization} state by removing the deleted personalization.\n *\n * @param personalizationKey - The key or ID of the personalization to be deleted.\n */\n deletePersonalization(personalizationKey: string) {\n getRsStateResolver().dispatch(actions.actionPersonalizationDelete(personalizationKey));\n },\n\n /**\n * Sets the current personalization key as the default personalization.\n * Dispatches an action to update `defaultPersonalization` in the `personalization` state slice\n * and calls {@link ApiContext.updatePersonalization updatePersonalization} API.\n *\n * @param personalizationKey - The key identifying the personalization to set as default.\n */\n setDefaultPersonalization(personalizationKey: string) {\n getRsStateResolver().dispatch(actions.actionPersonalizationSetDefault(personalizationKey));\n },\n\n /**\n * Sets the current {@link personalizationKey} as the app's default personalization.\n * Dispatches an action that invokes {@link ApiContext.updatePersonalization updatePersonalization} api with markAsAppDefault=true for the current personalization.\n *\n * @param personalizationKey The key of the personalization to set as default.\n * @param trimmedName The name of the personalization to update.\n */\n setAppDefaultPersonalization(personalizationKey: string, trimmedName: string) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationSetAppDefault(personalizationKey, trimmedName)\n );\n },\n\n /**\n * Applies the provided search value as a filter expression in the state,\n * using an OR condition with a contains clause.\n *\n * @param value The search value to apply.\n */\n\n applySearch(value: string) {\n getRsStateResolver().dispatch(actions.actionSearchGlobal(value));\n },\n\n /**\n * Applies the given row density in {@link State.selectedHeightOption selectedHeightOption} state slice.\n *\n * @param payload the row density id.\n */\n applyRowHeight(payload: (typeof ROW_DENSITY)[keyof typeof ROW_DENSITY]) {\n getRsStateResolver().dispatch(actions.actionRowHeightChange(payload));\n },\n\n /**\n * Applies gallery layout on the current view.\n *\n * @param layout - Gallery layout mode.\n */\n applyGalleryLayout(layout: GalleryLayout) {\n getRsStateResolver().dispatch(actions.actionGalleryLayoutChange(layout));\n },\n\n /**\n * Sets the {@link State.bootstrap bootstrap} status of repeating structures and update the {@link State.version version}in state.\n */\n doBootstrap() {\n getRsStateResolver().dispatch(actions.actionBootstrap());\n getRsStateResolver().dispatch(actions.actionUpdateStateVersion());\n },\n\n /**\n * Triggers a refresh of data in repeating structures.\n * Dispatches an action that injects {@link State.refresh refresh} flag in the state.\n * @param flushState The state slice that needs to be reset on refresh. See {@link SUPPORTED_AVOIDABLE_FEATURES}.\n * @param featuresToAvoid The features that should not run as part of refresh. See {@link SUPPORTED_FLUSH_KEYS}.\n */\n forceRefresh(flushState: { [k: string]: boolean } = {}, featuresToAvoid: string[] = []) {\n // If a refresh is in progress, don't trigger another refresh.\n if (getRsStore().refreshInProgress) return;\n\n // Communicate forceRefresh to apiContext via ApiOptions.\n getRsStore().refreshInProgress = true;\n getRsStore().refreshToken = Date.now();\n // Communicate forceRefresh to apiContext via callback.\n getRsProps().apiContext.onBeforeRefresh?.();\n\n getRsStateResolver().dispatch(actions.actionForceRefresh(flushState, featuresToAvoid));\n },\n\n /**\n * Fetches actions for the {@link selectedItems} using {@link ApiContext.fetchActions fetchActions} api.\n * @param selectedItems\n */\n fetchActions(selectedItems: string[]) {\n return getRsProps().apiContext.fetchActions?.(selectedItems);\n },\n\n /**\n * This resets the selection and refreshes the {@link rows} data.\n * @param rows\n */\n async clearSelectionAndRefreshRows(rows: string[]) {\n await Promise.allSettled([utilMethods.selectAllRows(false), utilMethods.refreshRows(rows)]);\n },\n\n /**\n * This removes {@link State.showConfirmationAction confirmationAction} from the state.\n */\n completeConfirmationAction() {\n getRsStateResolver().dispatch(actions.completeConfirmationAction());\n },\n\n /**\n * This sets the {@link State.errors errors} in the state.\n * @param payload\n */\n setErrors(payload: Errors) {\n if (payload.dataErrors) {\n getRsStateResolver().dispatch(actions.setDataErrors(payload.dataErrors));\n }\n },\n /**\n * Dispatches the dom container responsive breakpoints to state.\n * @param breakpoint\n * @param value\n */\n setDomContainerResponsiveBreakpoints(breakpoint: string, value: boolean) {\n const payload = { breakpoint, value };\n getRsStateResolver().dispatch(actions.setDomContainerResponsiveBreakpoints(payload));\n },\n\n /**\n * Refreshes the {@link View.data data} for {@link rows} by calling {@link ApiContext.fetchRowsData fetchRowsData} api.\n * It also calls {@link utilMethods.forceUpdate forceUpdate } to trigger state change for re-rendering.\n * @param rows\n */\n async refreshRows(rows: string[] = []) {\n const rsProps = getRsProps();\n if (rows.length === 0) {\n return;\n }\n const state = getRsStateResolver().getState();\n const { fetchRowsData } = rsProps.apiContext;\n const response = await fetchRowsData?.(\n deepCopy(state),\n getView().meta,\n rows,\n getView().meta.itemKey,\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n }\n );\n\n const data = syncData(getView().meta.itemKey, getView().data!, response!);\n getView().setProp({\n data: [...data]\n });\n utilMethods.forceUpdate(false, { forceRenderOnNextRun: true });\n },\n\n /**\n * Select/Deselect all rows(all pages in case of paginated data) by calling {@link ApiContext.setSelectedRows setSelectedRows}/ {@link ApiContext.clearSelectedRows clearSelectedRows} api.\n * It also updates the selected rows received from {@link ApiContext.getSelectedRows getSelectedRows} api in {@link State.selectedRows selectedRows} state slice.\n * @param isSelected\n */\n async selectAllRows(isSelected: boolean) {\n const rsProps = getRsProps();\n let selectedRows: (RowData & { $selected: boolean })[] = [];\n if (isSelected) {\n const response = await rsProps.apiContext.fetchData(\n {\n ...getRsStateResolver().getState(),\n paginationOptions: {\n rootVirtualiser: {\n startIndex: 0,\n endIndex: getView().resultsCount! - 1\n }\n },\n // passing groups and groupFilters as undefined to get all rows\n groups: undefined,\n groupFilters: undefined\n },\n getView().meta,\n {}\n );\n if (response) {\n const { data = [] } = response;\n selectedRows = data.map(item => ({ ...item, $selected: true })) || [];\n }\n try {\n await rsProps.apiContext.setSelectedRows?.(selectedRows);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('setSelectedRows api resulting into error.', e);\n }\n } else {\n // clear all selections when selectAll is unchecked\n await rsProps.apiContext.clearSelectedRows?.();\n }\n\n const rows = await rsProps.apiContext.getSelectedRows?.();\n\n if (rows)\n getRsStateResolver().dispatch(\n actions.actionRowSelectionItemsUpdate({\n selectedRows: rows,\n mode: getView().meta.selectionMode!\n })\n );\n },\n\n /**\n * Triggers {@link ApiContext.importCSVData importCSVData} api.\n * @param create\n */\n importCSVData(create: ModalManagerContextValue['create']) {\n return getRsProps()\n .apiContext.importCSVData?.(create)\n .catch(err => {\n getRsStateResolver().dispatch(\n actions.actionNotificationAdd({\n content: err\n })\n );\n });\n },\n\n /**\n * Triggers {@link ApiContext.exportData exportData} api.\n */\n exportToExcel() {\n return getRsProps()\n .apiContext.exportData?.(deepCopy(getView().state), getView().meta, {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n })\n .catch(err => {\n getRsStateResolver().dispatch(\n actions.actionNotificationAdd({\n content: err\n })\n );\n });\n },\n\n /**\n * Triggers {@link ApiContext.exportDataToCSV exportDataToCSV} api.\n */\n exportToCSV() {\n return getRsProps()\n .apiContext.exportDataToCSV?.(deepCopy(getView().state), getView().meta, {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n })\n .catch(err => {\n getRsStateResolver().dispatch(\n actions.actionNotificationAdd({\n content: err\n })\n );\n });\n },\n\n /**\n * Updates the visibility of columns by modifying {@link State.hiddenColumns}.\n * @param columns - An object mapping column IDs to their visibility status. `true` indicates the column is visible, and `false` means it is hidden.\n */\n updateColumnsVisibility(columns: { [key: FieldDef['id']]: boolean }) {\n getRsStateResolver().dispatch(actions.updateColumnsVisibility(columns));\n },\n\n setConditionalStyleFormats(\n conditionalStyleFormats: NonNullable<State['conditionalStyleFormats']>\n ) {\n getRsStateResolver().dispatch(actions.setConditionalStyleFormats(conditionalStyleFormats));\n },\n\n /**\n * Switches the active template for the view at runtime\n * (e.g. when the user toggles between Table and Gallery from the toolbar).\n *\n * @param template The target template to switch to.\n */\n changeTemplate(template: NonNullable<View['template']>) {\n if (getView().meta.allowSwitchTemplate === false) return;\n getRsStateResolver().dispatch(actions.actionChangeTemplate(template));\n }\n };\n return utilMethods;\n}\nexport type UtilityFunctions = ReturnType<typeof viewUtilityMethods>;\n"]}
|
|
1
|
+
{"version":3,"file":"viewUtilityMethods.js","sourceRoot":"","sources":["../../../../src/core/generators/viewUtilityMethods.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AA4CrF,SAAS,QAAQ,CAAC,GAAW,EAAE,WAAsB,EAAE,aAAwB;IAC7E,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC5B,MAAM,KAAK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EAAE,CAAC,YAAY;iBAChD,CAAC;aACH,CAAC;iBACD,KAAK,CAAC,GAAG,CAAC,EAAE;gBACX,kBAAkB,EAAE,CAAC,QAAQ,CAC3B,OAAO,CAAC,qBAAqB,CAAC;oBAC5B,OAAO,EAAE,GAAG;iBACb,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACP,CAAC;QAED;;;WAGG;QACH,uBAAuB,CAAC,OAA2C;YACjE,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1E,CAAC;QAED,0BAA0B,CACxB,uBAAsE;YAEtE,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,0BAA0B,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC7F,CAAC;QAED;;;;;WAKG;QACH,cAAc,CAAC,QAAuC;YACpD,IAAI,OAAO,EAAE,CAAC,IAAI,CAAC,mBAAmB,KAAK,KAAK;gBAAE,OAAO;YACzD,kBAAkB,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxE,CAAC;KACF,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\nimport type { ModalManagerContextValue } from '@pega/cosmos-react-core/lib/components/Modal/Modal.types';\n\nimport type RsInternal from '../RsInternal';\nimport ActionTypes from '../actions/actionConstants';\nimport * as actions from '../actions/actions';\nimport { rowSelectColumnMeta } from '../constants';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { SUPPORTED_AVOIDABLE_FEATURES, SUPPORTED_FLUSH_KEYS } from '../constants';\nimport { validateAction, passablePromise, deepCopy, deepEqual } from '../utils/util';\nimport type { Errors, State } from '../../../types/State.types';\n// This is being used in JSdoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ApiContext, ApiOptions } from '../../../types/ApiContext.types';\n// This is being used in JSdoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef, GalleryLayout, Meta, ROW_DENSITY } from '../../../types/Meta.types';\nimport type {\n ActionMeta,\n ApplyAliasesActionPayload,\n ColumnFilteringActionPayload,\n ExpandCollapsePayload,\n PaginationPayload\n} from '../actions/actions.types';\n\nimport type View from './ViewGenerator';\nimport type { RowData } from './RowGenerator.types';\nimport type {\n DebugInfo,\n RefreshNotification,\n RequiredDefinition,\n WarningDetail\n} from './ViewGenerator.types';\nimport type Column from './ColumnGenerator';\n\nexport type RefreshNotificationForConsumer = OmitStrict<RefreshNotification, 'id'>;\n\nexport type SupportedConsumerPayloads = {\n [ActionTypes.USER_CONFIRMATION_ACTION]: OmitStrict<\n NonNullable<View['confirmationActionDetails']>,\n 'onSubmit' | 'onCancel'\n >;\n [ActionTypes.UPDATE_DEBUG_INFO]: DebugInfo;\n [ActionTypes.TOGGLE_DISABLE_SELECTION]: boolean;\n [ActionTypes.TOGGLE_REQUIRED]: RequiredDefinition;\n [ActionTypes.NOTIFY_DATA_REFRESH]: RefreshNotificationForConsumer;\n [ActionTypes.SET_IN_EXTERNAL_STATE]: NonNullable<State['externalState']>;\n [ActionTypes.UPDATE_SELECTED_ROWS]: undefined;\n [ActionTypes.SET_WARNING_MESSAGES]: WarningDetail[];\n};\n\nexport type SupportedConsumerActionType = keyof SupportedConsumerPayloads;\n\nfunction syncData(key: string, sourceArray: RowData[], modifiedArray: RowData[]) {\n return sourceArray.map(item => {\n const item2 = modifiedArray.find(i2 => i2[key] === item[key]);\n return item2 || item;\n });\n}\n\nexport default function viewUtilityMethods(rsInternal: RsInternal) {\n const { getRsProps, getRsStateResolver, getView, getRsStore } = rsInternal;\n\n const utilMethods = {\n /**\n * Dispatches an action that creates a new state object without any internal modifications.\n *\n * If {@link instantRender} is false and {@link forceUpdateFeatures} are provided,\n * it updates the {@link State.forceUpdateFeatures forceUpdateFeatures} slice in the state.\n *\n * @param instantRender - Determines if the render should happen instantly.\n * @param forceUpdateFeatures - The features to force update in the state on next render cycle.\n */\n forceUpdate(instantRender?: boolean, forceUpdateFeatures?: State['forceUpdateFeatures']) {\n getRsStateResolver().dispatch(actions.actionForceUpdate(instantRender, forceUpdateFeatures));\n },\n\n /**\n * Handles the reordering of rows.\n *\n * If {@link Meta.moveListRecords moveListRecords} is set to true in Meta, it dispatches an action\n * that updates the keys of the {@link sourceKey source} row and the {@link destinationKey destination} row\n * in the {@link State.sourceKey sourceKey} and {@link State.destinationKey destinationKey} state slices, respectively.\n *\n * Otherwise, it calls {@link ApiContext.applyRowReorder applyRowReorder} from the apiContext and triggers\n * a {@link utilMethods.forceRefresh forceRefresh} on the state.\n *\n * @param sourceKey - The itemKey for the row being dragged.\n * @param destinationKey - The itemKey for the row on which it is dropped.\n */\n handleRowReorder(sourceKey: string, destinationKey: string) {\n if (getView()?.meta?.moveListRecords) {\n getRsStateResolver().dispatch(\n actions.actionMoveRecordKeysUpdate({\n sourceKey,\n destinationKey\n })\n );\n return;\n }\n getRsProps()\n .apiContext.applyRowReorder?.(sourceKey, destinationKey)\n .then(() => {\n utilMethods.forceRefresh();\n });\n },\n\n /**\n * Sets the count-related information onto the {@link View view} via {@link View.setProp setProp} and triggers {@link utilMethods.forceUpdate forceUpdate}.\n *\n * @param args - The count information object.\n * @param args.count - The total record count of the view, including group headers.\n * @param args.hasMoreResults - Indicates if the view has more records.\n * @param args.selectedRecordsCount - The total count of selected records.\n * @param args._countGeneratedInternally - Indicates if the count is generated internally. This is used for RS core internal purposes. Setting this from apiContext might lead to erroneous behavior.\n * @returns void\n */\n setRecordCount({\n count,\n hasMoreResults,\n selectedRecordsCount,\n _countGeneratedInternally,\n announce\n }: {\n count?: View['resultsCount'];\n hasMoreResults?: View['hasMoreResults'];\n selectedRecordsCount?: View['selectedRecordsCount'];\n _countGeneratedInternally?: View['countGeneratedInternally'];\n announce?: View['announceCount'];\n }) {\n // NOTE: setRecordCount can be called with partial props. So while doing setProp we need to make sure to check the existence of incoming prop value.\n // If incoming prop is undefined then it should have a fallback otherwise it will override existing value on view to undefined.\n getView().setProp({\n countGeneratedInternally: !!_countGeneratedInternally,\n hasMoreResults: hasMoreResults ?? false,\n resultsCount: count,\n selectedRecordsCount: selectedRecordsCount ?? getView().selectedRecordsCount,\n showCount: !Number.isFinite(count) ? false : !_countGeneratedInternally,\n announceCount: announce\n });\n // If count is not finite then do instantRender as we want to hide the count immediately and don't want the StateResolver queue to be empty.\n // Else the count will be displayed after the StateResolver queue becomes empty.\n const instantRender = !Number.isFinite(count);\n utilMethods.forceUpdate(instantRender);\n },\n\n /**\n * Dispatches an action to interact with repeating structures, allowing consumers\n * to perform operations using standard actions and payloads.\n *\n * @param action The action to be dispatched.\n * @param payload The payload associated with the action.\n * @returns The return value after the action has been processed by the repeating structure.\n */\n // TODO Refactor- this method to have only one parameter action object that contains type and payload. Maintenance of it will be easy.\n // TODO Make it generic specific.\n dispatchAction<T extends SupportedConsumerActionType>(\n action: T,\n payload?: SupportedConsumerPayloads[T]\n ): Promise<any> | undefined {\n const { dispatch } = getRsStateResolver();\n validateAction(action, payload, getView().externalStateKeys);\n\n let actionReturnValue;\n switch (action) {\n case ActionTypes.USER_CONFIRMATION_ACTION:\n // eslint-disable-next-line no-case-declarations\n const [promise, onSubmit, onCancel] = passablePromise<any>();\n getView().setProp({\n confirmationActionDetails: {\n onSubmit,\n onCancel,\n ...(payload as OmitStrict<\n NonNullable<View['confirmationActionDetails']>,\n 'onSubmit' | 'onCancel'\n >)\n }\n });\n dispatch(actions.showConfirmationAction());\n actionReturnValue = promise;\n break;\n case ActionTypes.UPDATE_DEBUG_INFO:\n getView().setProp({ debugInfo: [payload as DebugInfo] });\n utilMethods.forceUpdate(false);\n break;\n case ActionTypes.TOGGLE_DISABLE_SELECTION: {\n let rowSelectColumn = getView().columns?.find(\n column => column.field.id === rowSelectColumnMeta.field.id\n );\n if (rowSelectColumn) {\n rowSelectColumn = rowSelectColumn.setProp({\n disableSelection: payload as boolean\n });\n utilMethods.forceUpdate(false);\n }\n break;\n }\n case ActionTypes.TOGGLE_REQUIRED:\n getView().setProp({ requiredDef: payload as RequiredDefinition });\n utilMethods.forceUpdate(false);\n break;\n case ActionTypes.NOTIFY_DATA_REFRESH:\n getView().setProp('refreshNotification', {\n id: Date.now(),\n ...(payload as RefreshNotificationForConsumer)\n });\n utilMethods.forceUpdate(false);\n break;\n case ActionTypes.SET_IN_EXTERNAL_STATE:\n dispatch(actions.setExternalState(payload as NonNullable<State['externalState']>));\n break;\n case ActionTypes.UPDATE_SELECTED_ROWS:\n utilMethods.forceUpdate(false, {\n updateSelectedRows: new Date().getTime()\n });\n break;\n case ActionTypes.SET_WARNING_MESSAGES:\n if (!deepEqual(getView().getWarningMessages(), payload)) {\n getView().setProp({ warningMessages: payload as WarningDetail[] });\n utilMethods.forceUpdate(false);\n }\n break;\n default:\n }\n return actionReturnValue;\n },\n\n /** Returns the Html events required for reordering a column. */\n getFieldReorderProps() {\n return getRsStore().getFieldReorderProps?.();\n },\n\n // TODO: this should be moved to group generator instance.\n /**\n * Triggers the expand or collapse action for a group header.\n * Dispatches an action to update the {@link State.groupToggle groupToggle} slices in the state.\n *\n * @param payload The data related to the groups.\n */\n toggleGroupExpansion(payload: OmitStrict<ExpandCollapsePayload, 'groups'>) {\n getRsStateResolver().dispatch(actions.actionToggleExpandCollpase(payload));\n },\n\n /**\n * Clears hierarchical groups by dispatching an action to reset the {@link State.hierarchicalGroup hierarchicalGroup} slice in the state.\n */\n clearHierarchicalGroup() {\n getRsStore().groupingInfo = [];\n getRsStateResolver().dispatch(actions.actionUpdateDisplayMode({}));\n },\n\n /**\n * Dispatches a pagination action to update {@link State.paginationOptions paginationOptions} in the state slice.\n *\n * @param payload - The pagination options to update.\n * @param actionMeta - The action metadata.\n */\n onPaginate(payload: PaginationPayload, actionMeta?: ActionMeta) {\n getRsStateResolver().dispatch(actions.actionPaginate(payload, actionMeta));\n },\n\n /**\n * Removes a notification message.\n * Dispatches an action to update the {@link State.notifications notifications} slice in the state.\n *\n * @param payload The notification messages to be removed.\n */\n removeNotification(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionNotificationRemove(payload));\n },\n\n /**\n * Applies a filter to the repeating structures.\n * Dispatches an action that updates the {@link State.filterExpression filterExpression} in the state.\n *\n * @param params The filter expression to apply.\n */\n applyFilter(params: ColumnFilteringActionPayload) {\n getRsStateResolver().dispatch(actions.actionColumnFiltering(params));\n },\n\n /**\n * Dispatches an action to replace the {@link State.columnAlias columnAlias} slice in the state.\n *\n * @param params - Parameters for the action. Specify the necessary details.\n */\n applyAliases(params: ApplyAliasesActionPayload) {\n getRsStateResolver().dispatch(actions.actionReplaceLabels(params));\n },\n\n /**\n * Clears filters for the specified {@link columnId}.\n * Dispatches an action to update the {@link State.clearColFilter clearColFilter} slice in the state.\n * @param columnId - The column on which the filter should be cleared.\n */\n clearFilter(columnId: string) {\n getRsStateResolver().dispatch(actions.actionClearFiltering(columnId));\n },\n\n /**\n * Applies grouping to repeating structures.\n * Dispatches an action that adds {@link State.groups groups} in the state.\n * @param payload\n */\n applyGrouping(payload: NonNullable<State['groups']>) {\n getRsStateResolver().dispatch(actions.actionAddGroups(payload));\n },\n\n /**\n * Applies sorting the repeating structures.\n * Dispatches an action that adds {@link State.sortingOrder sortingOrder} in state.\n * @param payload\n */\n applySorting(payload: NonNullable<State['sortingOrder']>) {\n getRsStateResolver().dispatch(actions.actionUpdateSort(payload));\n },\n\n /**\n * Toggles the visibility of header icons.\n * Dispatches an action to update {@link State.showHeaderIcons} in the state.\n *\n * @param status The status indicating whether to show or hide header icons.\n */\n updateHeaderIconsVisibility(status: NonNullable<State['showHeaderIcons']>) {\n getRsStateResolver().dispatch(actions.actionShowHeaderIcons(status));\n },\n\n /**\n * Applies freezing to a set of columns.\n * Dispatches an action to update {@link State.freezeColumns freezeColumns} in the state.\n *\n * @param payload The payload containing information about the columns to freeze.\n */\n applyFreeze(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionColumnPin(payload));\n },\n\n /**\n * Toggles the visibility of columns.\n * Dispatches an action that updates {@link State.hiddenColumns hiddenColumns} in the state.\n * @param payload\n */\n applyToggleVisibility(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionColumnToggle(payload));\n },\n\n /**\n * Sets the {@link State.hiddenColumns hiddenColumns} in the state, including out-of-the-box columns like dragHandle.\n *\n * @param payload - The payload containing columns to hide.\n * @param ootbColumns - The out-of-the-box columns to include in {@link State.hiddenColumns hiddenColumns}.\n */\n applyHiddenColumns(payload: string[], ootbColumns?: { dragHandle?: boolean }) {\n getRsStateResolver().dispatch(actions.actionHiddenColumnUpdate(payload, ootbColumns));\n },\n\n /**\n * Sets the {@link State.visibleColumns visibleColumns} in the state.\n * @param columnId - A single column ID or an array of column IDs to make visible.\n */\n applyVisibleColumns(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionVisibleColumnUpdate(payload));\n },\n\n /**\n * Dispatches an action that replace {@link State.aggregationInfo aggregationInfo} slice in the state with the given {@link payload}.\n * @param payload\n */\n applyAggregations(payload: NonNullable<State['aggregationInfo']>) {\n getRsStateResolver().dispatch(actions.actionUpdateAggregations(payload));\n },\n\n /**\n * Applies order to columns of a repeatings structure with the given {@link payload}.\n * Dispatches an action that sets {@link State.colOrder columnOrder} in the state with the given {@link payload}.\n * @param payload\n */\n applyOrder(payload: string[]) {\n getRsStateResolver().dispatch(actions.actionNewColumnOrder(payload));\n },\n\n /**\n * Saves the current personalization state.\n * Dispatches an action that invokes {@link ApiContext.updatePersonalization} to persist the changes.\n *\n * @param personalizationKey The key representing the current personalization.\n * @param markAsDefault Whether to mark the current personalization as default.\n * @param markAsAppDefault Whether to mark the current personalization as app default.\n */\n updatePersonalization(\n personalizationKey: string,\n markAsDefault: boolean,\n markAsAppDefault: boolean\n ) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationUpdate(personalizationKey, markAsDefault, markAsAppDefault)\n );\n },\n\n /**\n * Sets the selected personalization state as the current state of the repeating structures.\n * Dispatches an action to update the {@link State} of the repeating structures with the selected personalization state,\n * and updates the active personalization in the {@link State.personalization personalization} state slice.\n *\n * @param args Method arguments.\n * @param args.id ID of the personalization to be set active.\n * @param args.isPreset Indicates if the personalization is preset.\n */\n applyActivePersonalization({ id, isPreset = false }: { id: string; isPreset: boolean }) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationSetActive({\n id,\n isPreset\n })\n );\n getRsStateResolver().dispatch(actions.actionUpdateStateVersion());\n },\n\n /**\n * Creates a new personalization in the state.\n * Dispatches an action that calls {@link ApiContext.createPersonalization createPersonalization} API to create\n * a new personalization with the provided name and saves it in the {@link State.personalization personalization}.\n *\n * @param name The name of the personalization.\n * @param markAsDefault Indicates whether the new personalization should be marked as default.\n */\n createPersonalization(name: string, markAsDefault: boolean) {\n getRsStateResolver().dispatch(actions.actionPersonalizationCreate(name, markAsDefault));\n },\n\n /**\n * Updates the name, markAsDefault, and markAsAppDefault flags of the current personalization.\n *\n * @param active The current active personalization key.\n * @param name The updated name.\n * @param markAsDefault Indicates whether the current personalization should be marked as default.\n * @param markAsAppDefault Indicates whether the current personalization should be marked as app default.\n */\n editPersonalization(\n active: string,\n name: string,\n markAsDefault: boolean,\n markAsAppDefault: boolean\n ) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationEdit(active, name, markAsDefault, markAsAppDefault)\n );\n },\n\n /**\n * Deletes the current personalization identified by the given key.\n * Dispatches an action that calls {@link ApiContext.deletePersonalization deletePersonalization} API\n * and updates the {@link State.personalization personalization} state by removing the deleted personalization.\n *\n * @param personalizationKey - The key or ID of the personalization to be deleted.\n */\n deletePersonalization(personalizationKey: string) {\n getRsStateResolver().dispatch(actions.actionPersonalizationDelete(personalizationKey));\n },\n\n /**\n * Sets the current personalization key as the default personalization.\n * Dispatches an action to update `defaultPersonalization` in the `personalization` state slice\n * and calls {@link ApiContext.updatePersonalization updatePersonalization} API.\n *\n * @param personalizationKey - The key identifying the personalization to set as default.\n */\n setDefaultPersonalization(personalizationKey: string) {\n getRsStateResolver().dispatch(actions.actionPersonalizationSetDefault(personalizationKey));\n },\n\n /**\n * Sets the current {@link personalizationKey} as the app's default personalization.\n * Dispatches an action that invokes {@link ApiContext.updatePersonalization updatePersonalization} api with markAsAppDefault=true for the current personalization.\n *\n * @param personalizationKey The key of the personalization to set as default.\n * @param trimmedName The name of the personalization to update.\n */\n setAppDefaultPersonalization(personalizationKey: string, trimmedName: string) {\n getRsStateResolver().dispatch(\n actions.actionPersonalizationSetAppDefault(personalizationKey, trimmedName)\n );\n },\n\n /**\n * Applies the provided search value as a filter expression in the state,\n * using an OR condition with a contains clause.\n *\n * @param value The search value to apply.\n */\n\n applySearch(value: string) {\n getRsStateResolver().dispatch(actions.actionSearchGlobal(value));\n },\n\n /**\n * Applies the given row density in {@link State.selectedHeightOption selectedHeightOption} state slice.\n *\n * @param payload the row density id.\n */\n applyRowHeight(payload: (typeof ROW_DENSITY)[keyof typeof ROW_DENSITY]) {\n getRsStateResolver().dispatch(actions.actionRowHeightChange(payload));\n },\n\n /**\n * Applies gallery layout on the current view.\n *\n * @param layout - Gallery layout mode.\n */\n applyGalleryLayout(layout: GalleryLayout) {\n getRsStateResolver().dispatch(actions.actionGalleryLayoutChange(layout));\n },\n\n /**\n * Sets the {@link State.bootstrap bootstrap} status of repeating structures and update the {@link State.version version}in state.\n */\n doBootstrap() {\n getRsStateResolver().dispatch(actions.actionBootstrap());\n getRsStateResolver().dispatch(actions.actionUpdateStateVersion());\n },\n\n /**\n * Triggers a refresh of data in repeating structures.\n * Dispatches an action that injects {@link State.refresh refresh} flag in the state.\n * @param flushState The state slice that needs to be reset on refresh. See {@link SUPPORTED_AVOIDABLE_FEATURES}.\n * @param featuresToAvoid The features that should not run as part of refresh. See {@link SUPPORTED_FLUSH_KEYS}.\n */\n forceRefresh(flushState: { [k: string]: boolean } = {}, featuresToAvoid: string[] = []) {\n // If a refresh is in progress, don't trigger another refresh.\n if (getRsStore().refreshInProgress) return;\n\n // Communicate forceRefresh to apiContext via ApiOptions.\n getRsStore().refreshInProgress = true;\n getRsStore().refreshToken = Date.now();\n // Communicate forceRefresh to apiContext via callback.\n getRsProps().apiContext.onBeforeRefresh?.();\n\n getRsStateResolver().dispatch(actions.actionForceRefresh(flushState, featuresToAvoid));\n },\n\n /**\n * Fetches actions for the {@link selectedItems} using {@link ApiContext.fetchActions fetchActions} api.\n * @param selectedItems\n */\n fetchActions(selectedItems: string[]) {\n return getRsProps().apiContext.fetchActions?.(selectedItems);\n },\n\n /**\n * This resets the selection and refreshes the {@link rows} data.\n * @param rows\n */\n async clearSelectionAndRefreshRows(rows: string[]) {\n await Promise.allSettled([utilMethods.selectAllRows(false), utilMethods.refreshRows(rows)]);\n },\n\n /**\n * This removes {@link State.showConfirmationAction confirmationAction} from the state.\n */\n completeConfirmationAction() {\n getRsStateResolver().dispatch(actions.completeConfirmationAction());\n },\n\n /**\n * This sets the {@link State.errors errors} in the state.\n * @param payload\n */\n setErrors(payload: Errors) {\n if (payload.dataErrors) {\n getRsStateResolver().dispatch(actions.setDataErrors(payload.dataErrors));\n }\n },\n /**\n * Dispatches the dom container responsive breakpoints to state.\n * @param breakpoint\n * @param value\n */\n setDomContainerResponsiveBreakpoints(breakpoint: string, value: boolean) {\n const payload = { breakpoint, value };\n getRsStateResolver().dispatch(actions.setDomContainerResponsiveBreakpoints(payload));\n },\n\n /**\n * Refreshes the {@link View.data data} for {@link rows} by calling {@link ApiContext.fetchRowsData fetchRowsData} api.\n * It also calls {@link utilMethods.forceUpdate forceUpdate } to trigger state change for re-rendering.\n * @param rows\n */\n async refreshRows(rows: string[] = []) {\n const rsProps = getRsProps();\n if (rows.length === 0) {\n return;\n }\n const state = getRsStateResolver().getState();\n const { fetchRowsData } = rsProps.apiContext;\n const response = await fetchRowsData?.(\n deepCopy(state),\n getView().meta,\n rows,\n getView().meta.itemKey,\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n }\n );\n\n const data = syncData(getView().meta.itemKey, getView().data!, response!);\n getView().setProp({\n data: [...data]\n });\n utilMethods.forceUpdate(false, { forceRenderOnNextRun: true });\n },\n\n /**\n * Select/Deselect all rows(all pages in case of paginated data) by calling {@link ApiContext.setSelectedRows setSelectedRows}/ {@link ApiContext.clearSelectedRows clearSelectedRows} api.\n * It also updates the selected rows received from {@link ApiContext.getSelectedRows getSelectedRows} api in {@link State.selectedRows selectedRows} state slice.\n * @param isSelected\n */\n async selectAllRows(isSelected: boolean) {\n const rsProps = getRsProps();\n let selectedRows: (RowData & { $selected: boolean })[] = [];\n if (isSelected) {\n const response = await rsProps.apiContext.fetchData(\n {\n ...getRsStateResolver().getState(),\n paginationOptions: {\n rootVirtualiser: {\n startIndex: 0,\n endIndex: getView().resultsCount! - 1\n }\n },\n // passing groups and groupFilters as undefined to get all rows\n groups: undefined,\n groupFilters: undefined\n },\n getView().meta,\n {}\n );\n if (response) {\n const { data = [] } = response;\n selectedRows = data.map(item => ({ ...item, $selected: true })) || [];\n }\n try {\n await rsProps.apiContext.setSelectedRows?.(selectedRows);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('setSelectedRows api resulting into error.', e);\n }\n } else {\n // clear all selections when selectAll is unchecked\n await rsProps.apiContext.clearSelectedRows?.();\n }\n\n const rows = await rsProps.apiContext.getSelectedRows?.();\n\n if (rows)\n getRsStateResolver().dispatch(\n actions.actionRowSelectionItemsUpdate({\n selectedRows: rows,\n mode: getView().meta.selectionMode!\n })\n );\n },\n\n /**\n * Triggers {@link ApiContext.importCSVData importCSVData} api.\n * @param create\n */\n importCSVData(create: ModalManagerContextValue['create']) {\n return getRsProps()\n .apiContext.importCSVData?.(create)\n .catch(err => {\n getRsStateResolver().dispatch(\n actions.actionNotificationAdd({\n content: err\n })\n );\n });\n },\n\n /**\n * Triggers {@link ApiContext.exportData exportData} api.\n */\n exportToExcel() {\n function getVisibleColumnFormatters() {\n const visibleColumns = getView().getVisibleColumns();\n const formatters: Record<string, Column['formatterConfig']> = {};\n visibleColumns?.forEach(column => {\n if (column.formatterConfig) {\n formatters[column.field.id] = column.formatterConfig;\n }\n });\n return formatters;\n }\n return getRsProps()\n .apiContext.exportData?.(\n deepCopy(getView().state),\n getView().meta,\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n },\n getVisibleColumnFormatters()\n )\n .catch(err => {\n getRsStateResolver().dispatch(\n actions.actionNotificationAdd({\n content: err\n })\n );\n });\n },\n\n /**\n * Triggers {@link ApiContext.exportDataToCSV exportDataToCSV} api.\n */\n exportToCSV() {\n return getRsProps()\n .apiContext.exportDataToCSV?.(deepCopy(getView().state), getView().meta, {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n })\n .catch(err => {\n getRsStateResolver().dispatch(\n actions.actionNotificationAdd({\n content: err\n })\n );\n });\n },\n\n /**\n * Updates the visibility of columns by modifying {@link State.hiddenColumns}.\n * @param columns - An object mapping column IDs to their visibility status. `true` indicates the column is visible, and `false` means it is hidden.\n */\n updateColumnsVisibility(columns: { [key: FieldDef['id']]: boolean }) {\n getRsStateResolver().dispatch(actions.updateColumnsVisibility(columns));\n },\n\n setConditionalStyleFormats(\n conditionalStyleFormats: NonNullable<State['conditionalStyleFormats']>\n ) {\n getRsStateResolver().dispatch(actions.setConditionalStyleFormats(conditionalStyleFormats));\n },\n\n /**\n * Switches the active template for the view at runtime\n * (e.g. when the user toggles between Table and Gallery from the toolbar).\n *\n * @param template The target template to switch to.\n */\n changeTemplate(template: NonNullable<View['template']>) {\n if (getView().meta.allowSwitchTemplate === false) return;\n getRsStateResolver().dispatch(actions.actionChangeTemplate(template));\n }\n };\n return utilMethods;\n}\nexport type UtilityFunctions = ReturnType<typeof viewUtilityMethods>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-utils.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAY,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAOxD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO/C,CAAC;
|
|
1
|
+
{"version":3,"file":"condition-utils.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAY,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAOxD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO/C,CAAC;AAyHX;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,GAC9C,WAAW,SAAS,EACpB,gBAAgB,KAAK,CAAC,gBAAgB,CAAC,KACtC,MAAM,EAIR,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAI,EAAE,IAAI,EACV,eAAe,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GACvD,OAAO,CAcT"}
|
|
@@ -85,7 +85,7 @@ function transformCondition(condition, meta, conditionBuilderFieldsConfig) {
|
|
|
85
85
|
const { conditionBuilderFields: fields, conditionBuilderFieldsTypeMap: fieldsTypeMap } = conditionBuilderFieldsConfig;
|
|
86
86
|
// cspell:ignore DDTHH
|
|
87
87
|
const currentDateTimeWithTimeZone = dayjs().tz(meta.timezone).format('YYYY-MM-DDTHH:mm:ss.SSS');
|
|
88
|
-
condition = transformComplexCondition(condition, fields, true, currentDateTimeWithTimeZone);
|
|
88
|
+
condition = transformComplexCondition(condition, fields, { transformRelativeDate: true }, currentDateTimeWithTimeZone);
|
|
89
89
|
const { logic, conditions } = splitConditionTree(condition);
|
|
90
90
|
Object.entries(conditions).forEach(([, singleCondition]) => {
|
|
91
91
|
transformConditionBasedOnType(singleCondition, fieldsTypeMap, meta);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-utils.js","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAC7C,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAK1B,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAElB,MAAM,CAAC,MAAM,kBAAkB,GAA8B;IAC3D,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;CACT,CAAC;AAEX,MAAM,+BAA+B,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,GAAG,CAAC;AAO1B,SAAS,4BAA4B,CAAC,SAAoB,EAAE,eAA4B,IAAI,GAAG,EAAE;IAC/F,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;Q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EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAU,EACV,eAAwD;IAExD,IAAI,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;IACjC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAC7D,iCAAiC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAE1D,oEAAoE;IACpE,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;QACxD,sBAAsB;QACtB,6BAA6B;KAC9B,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE,aAAa,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport tZone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n\nimport {\n evaluateCondition as evaluateConditionUtility,\n parseLogicString,\n splitConditionTree,\n transformComplexCondition,\n type Condition,\n type Field,\n type LeafCondition,\n type FieldType\n} from '@pega/cosmos-react-condition-builder';\n\nimport type { FieldDef, Meta } from '../../../types/Meta.types';\nimport type { RowData } from '../generators/RowGenerator.types';\nimport type { State } from '../../../types/State.types';\n\nimport { deepCopy } from './util';\n\ndayjs.extend(tZone);\ndayjs.extend(utc);\n\nexport const RsToCBFieldTypeMap: Record<string, FieldType> = {\n text: 'TEXT',\n number: 'DECIMAL',\n boolean: 'BOOLEAN',\n datetime: 'DATE_TIME',\n date: 'DATE_ONLY',\n time: 'TIME_ONLY'\n} as const;\n\nconst DateFunctionsWithRhsAsDateInput = ['HOURS', 'MINUTES'];\nconst DOT_DELIMITER = '.';\n\ntype ConditionBuilderFieldsConfig = {\n conditionBuilderFields: Field[];\n conditionBuilderFieldsTypeMap: Record<string, FieldType>;\n};\n\nfunction getUniqueFieldsFromCondition(condition: Condition, uniqueFields: Set<string> = new Set()) {\n if ('AND' in condition) {\n condition.AND.forEach(andCondition => getUniqueFieldsFromCondition(andCondition, uniqueFields));\n } else if ('OR' in condition) {\n condition.OR.forEach(orCondition => getUniqueFieldsFromCondition(orCondition, uniqueFields));\n } else if ('NOT' in condition) {\n getUniqueFieldsFromCondition(condition.NOT, uniqueFields);\n } else {\n const leaf = condition.condition;\n uniqueFields.add(leaf.lhs.field);\n if (leaf.rhs && 'field' in leaf.rhs) {\n uniqueFields.add(leaf.rhs.field);\n }\n }\n return uniqueFields;\n}\n\n/**\n * This api is used to transform the fields present in {@link condition} to a condition builder fields structure\n * @param condition\n * @param fieldDefs meta fieldDefs which needs to be transformed to condition builder fields structure\n * @returns condition builder fields structure\n */\nfunction getConditionBuilderFieldsContract(\n condition: Condition,\n fieldDefs: FieldDef[]\n): ConditionBuilderFieldsConfig {\n const uniqueFieldsInCondition = getUniqueFieldsFromCondition(condition);\n const fieldDefsForFieldInConditions = fieldDefs.filter(field =>\n uniqueFieldsInCondition.has(field.name)\n );\n const conditionBuilderFields = [] as Field[];\n const conditionBuilderFieldsTypeMap = {} as Record<string, FieldType>;\n\n fieldDefsForFieldInConditions.forEach(field => {\n const type = RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n conditionBuilderFields.push({\n id: field.name ? field.name : field.label,\n primary: field.name ? field.name : field.label,\n type\n });\n conditionBuilderFieldsTypeMap[field.name] =\n RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n });\n\n return { conditionBuilderFields, conditionBuilderFieldsTypeMap };\n}\n\nfunction transformConditionForDateTimeType(condition: LeafCondition, timezone: string) {\n const { rhs } = condition;\n\n if (!rhs || !('value' in rhs)) return;\n\n if ('dateFunction' in rhs && rhs.dateFunction === 'HOURS_OF_DAY') {\n rhs.value = Number(rhs.value).toString().padStart(2, '0');\n return;\n }\n // Adjusting the date inputs for timezone offset.\n // For dateFunctionsWithRhsAsDateInput(HOURS, MINUTES) a date input is present in rhs, so it also needs to be adjusted.\n if (!('dateFunction' in rhs) || DateFunctionsWithRhsAsDateInput.includes(rhs.dateFunction)) {\n const isoDateString = dayjs.tz(rhs.value, timezone).toISOString();\n rhs.value = isoDateString;\n }\n}\n\nfunction transformConditionBasedOnType(\n condition: LeafCondition,\n fieldTypeMap: Record<string, FieldType>,\n meta: Meta\n) {\n const {\n lhs: { field }\n } = condition;\n const type = fieldTypeMap[field];\n const { timezone } = meta;\n\n // For date time the rhs values need to be adjusted for timezone offset.\n if (type === 'DATE_TIME') {\n transformConditionForDateTimeType(condition, timezone!);\n }\n}\n\nfunction transformCondition(\n condition: Condition,\n meta: Meta,\n conditionBuilderFieldsConfig: ConditionBuilderFieldsConfig\n): Condition {\n const { conditionBuilderFields: fields, conditionBuilderFieldsTypeMap: fieldsTypeMap } =\n conditionBuilderFieldsConfig;\n // cspell:ignore DDTHH\n const currentDateTimeWithTimeZone = dayjs().tz(meta.timezone).format('YYYY-MM-DDTHH:mm:ss.SSS');\n\n condition = transformComplexCondition(condition, fields, true, currentDateTimeWithTimeZone);\n const { logic, conditions } = splitConditionTree(condition);\n\n Object.entries(conditions).forEach(([, singleCondition]) => {\n transformConditionBasedOnType(singleCondition, fieldsTypeMap, meta);\n });\n\n return (\n parseLogicString(logic, conditions) as {\n condition: Condition;\n }\n ).condition;\n}\n\n/**\n * Retrieves columns that are referenced in the given condition but are hidden.\n * @param condition - The condition\n * @param hiddenColumns - An array of hidden columns\n * @returns An array of hidden columns that are referenced in the condition.\n */\nexport const getHiddenColumnsReferredInCondition = (\n condition: Condition,\n visibleColumns: State['visibleColumns']\n): string[] => {\n if (!visibleColumns) return [];\n const fields = getUniqueFieldsFromCondition(condition);\n return [...fields].filter(field => !visibleColumns?.includes(field));\n};\n\n/**\n * Evaluates whether the the `data` specified in {@link conditionConfig} satisfies the `condition`.\n * @param meta - Repeating structures meta\n * @param conditionConfig - condition config.\n * @returns true if the data satisfies condition, otherwise false.\n */\nexport default function evaluateCondition(\n meta: Meta,\n conditionConfig: { condition: Condition; data: RowData }\n): boolean {\n let { condition } = conditionConfig;\n const { data } = conditionConfig;\n const { fieldDefs } = meta;\n const { conditionBuilderFields, conditionBuilderFieldsTypeMap } =\n getConditionBuilderFieldsContract(condition, fieldDefs);\n\n // TODO: Remove this once evaluateCondition handles Timezone offset.\n condition = transformCondition(deepCopy(condition), meta, {\n conditionBuilderFields,\n conditionBuilderFieldsTypeMap\n });\n\n return evaluateConditionUtility(condition, data, conditionBuilderFields, DOT_DELIMITER);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"condition-utils.js","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAC7C,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAK1B,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAElB,MAAM,CAAC,MAAM,kBAAkB,GAA8B;IAC3D,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;CAC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AAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,OACE,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAGnC,CAAC,SAAS,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,SAAoB,EACpB,cAAuC,EAC7B,EAAE;IACZ,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAU,EACV,eAAwD;IAExD,IAAI,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;IACjC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAC7D,iCAAiC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAE1D,oEAAoE;IACpE,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;QACxD,sBAAsB;QACtB,6BAA6B;KAC9B,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE,aAAa,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport tZone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n\nimport {\n evaluateCondition as evaluateConditionUtility,\n parseLogicString,\n splitConditionTree,\n transformComplexCondition,\n type Condition,\n type Field,\n type LeafCondition,\n type FieldType\n} from '@pega/cosmos-react-condition-builder';\n\nimport type { FieldDef, Meta } from '../../../types/Meta.types';\nimport type { RowData } from '../generators/RowGenerator.types';\nimport type { State } from '../../../types/State.types';\n\nimport { deepCopy } from './util';\n\ndayjs.extend(tZone);\ndayjs.extend(utc);\n\nexport const RsToCBFieldTypeMap: Record<string, FieldType> = {\n text: 'TEXT',\n number: 'DECIMAL',\n boolean: 'BOOLEAN',\n datetime: 'DATE_TIME',\n date: 'DATE_ONLY',\n time: 'TIME_ONLY'\n} as const;\n\nconst DateFunctionsWithRhsAsDateInput = ['HOURS', 'MINUTES'];\nconst DOT_DELIMITER = '.';\n\ntype ConditionBuilderFieldsConfig = {\n conditionBuilderFields: Field[];\n conditionBuilderFieldsTypeMap: Record<string, FieldType>;\n};\n\nfunction getUniqueFieldsFromCondition(condition: Condition, uniqueFields: Set<string> = new Set()) {\n if ('AND' in condition) {\n condition.AND.forEach(andCondition => getUniqueFieldsFromCondition(andCondition, uniqueFields));\n } else if ('OR' in condition) {\n condition.OR.forEach(orCondition => getUniqueFieldsFromCondition(orCondition, uniqueFields));\n } else if ('NOT' in condition) {\n getUniqueFieldsFromCondition(condition.NOT, uniqueFields);\n } else {\n const leaf = condition.condition;\n uniqueFields.add(leaf.lhs.field);\n if (leaf.rhs && 'field' in leaf.rhs) {\n uniqueFields.add(leaf.rhs.field);\n }\n }\n return uniqueFields;\n}\n\n/**\n * This api is used to transform the fields present in {@link condition} to a condition builder fields structure\n * @param condition\n * @param fieldDefs meta fieldDefs which needs to be transformed to condition builder fields structure\n * @returns condition builder fields structure\n */\nfunction getConditionBuilderFieldsContract(\n condition: Condition,\n fieldDefs: FieldDef[]\n): ConditionBuilderFieldsConfig {\n const uniqueFieldsInCondition = getUniqueFieldsFromCondition(condition);\n const fieldDefsForFieldInConditions = fieldDefs.filter(field =>\n uniqueFieldsInCondition.has(field.name)\n );\n const conditionBuilderFields = [] as Field[];\n const conditionBuilderFieldsTypeMap = {} as Record<string, FieldType>;\n\n fieldDefsForFieldInConditions.forEach(field => {\n const type = RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n conditionBuilderFields.push({\n id: field.name ? field.name : field.label,\n primary: field.name ? field.name : field.label,\n type\n });\n conditionBuilderFieldsTypeMap[field.name] =\n RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n });\n\n return { conditionBuilderFields, conditionBuilderFieldsTypeMap };\n}\n\nfunction transformConditionForDateTimeType(condition: LeafCondition, timezone: string) {\n const { rhs } = condition;\n\n if (!rhs || !('value' in rhs)) return;\n\n if ('dateFunction' in rhs && rhs.dateFunction === 'HOURS_OF_DAY') {\n rhs.value = Number(rhs.value).toString().padStart(2, '0');\n return;\n }\n // Adjusting the date inputs for timezone offset.\n // For dateFunctionsWithRhsAsDateInput(HOURS, MINUTES) a date input is present in rhs, so it also needs to be adjusted.\n if (!('dateFunction' in rhs) || DateFunctionsWithRhsAsDateInput.includes(rhs.dateFunction)) {\n const isoDateString = dayjs.tz(rhs.value, timezone).toISOString();\n rhs.value = isoDateString;\n }\n}\n\nfunction transformConditionBasedOnType(\n condition: LeafCondition,\n fieldTypeMap: Record<string, FieldType>,\n meta: Meta\n) {\n const {\n lhs: { field }\n } = condition;\n const type = fieldTypeMap[field];\n const { timezone } = meta;\n\n // For date time the rhs values need to be adjusted for timezone offset.\n if (type === 'DATE_TIME') {\n transformConditionForDateTimeType(condition, timezone!);\n }\n}\n\nfunction transformCondition(\n condition: Condition,\n meta: Meta,\n conditionBuilderFieldsConfig: ConditionBuilderFieldsConfig\n): Condition {\n const { conditionBuilderFields: fields, conditionBuilderFieldsTypeMap: fieldsTypeMap } =\n conditionBuilderFieldsConfig;\n // cspell:ignore DDTHH\n const currentDateTimeWithTimeZone = dayjs().tz(meta.timezone).format('YYYY-MM-DDTHH:mm:ss.SSS');\n\n condition = transformComplexCondition(\n condition,\n fields,\n { transformRelativeDate: true },\n currentDateTimeWithTimeZone\n );\n const { logic, conditions } = splitConditionTree(condition);\n\n Object.entries(conditions).forEach(([, singleCondition]) => {\n transformConditionBasedOnType(singleCondition, fieldsTypeMap, meta);\n });\n\n return (\n parseLogicString(logic, conditions) as {\n condition: Condition;\n }\n ).condition;\n}\n\n/**\n * Retrieves columns that are referenced in the given condition but are hidden.\n * @param condition - The condition\n * @param hiddenColumns - An array of hidden columns\n * @returns An array of hidden columns that are referenced in the condition.\n */\nexport const getHiddenColumnsReferredInCondition = (\n condition: Condition,\n visibleColumns: State['visibleColumns']\n): string[] => {\n if (!visibleColumns) return [];\n const fields = getUniqueFieldsFromCondition(condition);\n return [...fields].filter(field => !visibleColumns?.includes(field));\n};\n\n/**\n * Evaluates whether the the `data` specified in {@link conditionConfig} satisfies the `condition`.\n * @param meta - Repeating structures meta\n * @param conditionConfig - condition config.\n * @returns true if the data satisfies condition, otherwise false.\n */\nexport default function evaluateCondition(\n meta: Meta,\n conditionConfig: { condition: Condition; data: RowData }\n): boolean {\n let { condition } = conditionConfig;\n const { data } = conditionConfig;\n const { fieldDefs } = meta;\n const { conditionBuilderFields, conditionBuilderFieldsTypeMap } =\n getConditionBuilderFieldsContract(condition, fieldDefs);\n\n // TODO: Remove this once evaluateCondition handles Timezone offset.\n condition = transformCondition(deepCopy(condition), meta, {\n conditionBuilderFields,\n conditionBuilderFieldsTypeMap\n });\n\n return evaluateConditionUtility(condition, data, conditionBuilderFields, DOT_DELIMITER);\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import type { ModalManagerContextValue } from '@pega/cosmos-react-core/lib/compo
|
|
|
2
2
|
import type { Condition } from '@pega/cosmos-react-condition-builder';
|
|
3
3
|
import type { RowData } from '../src/core/generators/RowGenerator.types';
|
|
4
4
|
import type { UtilityFunctions } from '../src/core/generators/viewUtilityMethods';
|
|
5
|
+
import type Column from '../src/core/generators/ColumnGenerator';
|
|
5
6
|
import type { Personalization, PersonalizationInfo, PersonalizedState, State, Group, GroupFilter, GroupAdditionalField } from './State.types';
|
|
6
7
|
import type { Meta, RowAction, FieldDef } from './Meta.types';
|
|
7
8
|
/**
|
|
@@ -488,7 +489,7 @@ export interface ApiContext {
|
|
|
488
489
|
* @param {Meta} rsMeta - Repeating structures meta {@link Meta}.
|
|
489
490
|
* @returns {void} void
|
|
490
491
|
*/
|
|
491
|
-
exportData?: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions) => Promise<void>;
|
|
492
|
+
exportData?: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions, renderFormatters?: Record<string, Column['formatterConfig']>) => Promise<void>;
|
|
492
493
|
/** This api is called on click of 'Export to CSV' option in repeating structures toolbar and should export the data into a CSV file.
|
|
493
494
|
* @requireWhen {@link Meta.showExportToCSVOption showExportToCSVOption} is set to true in Meta.
|
|
494
495
|
* @invokedWhen "Export to CSV" button is clicked in the repeating structures toolbar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiContext.types.d.ts","sourceRoot":"","sources":["../../types/ApiContext.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACzG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiContext.types.d.ts","sourceRoot":"","sources":["../../types/ApiContext.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACzG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AAEjE,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,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AC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/E;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC;IAEvF;;;;;;;;;OASG;IACH,qCAAqC,CAAC,EAAE,CACtC,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,EACpC,OAAO,EAAE,KAAK,EACd,MAAM,EAAE,IAAI,EACZ,OAAO,CAAC,EAAE,UAAU,KACjB,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAE/C;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiContext.types.js","sourceRoot":"","sources":["../../types/ApiContext.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ModalManagerContextValue } from '@pega/cosmos-react-core/lib/components/Modal/Modal.types';\nimport type { Condition } from '@pega/cosmos-react-condition-builder';\n\nimport type { RowData } from '../src/core/generators/RowGenerator.types';\nimport type { UtilityFunctions } from '../src/core/generators/viewUtilityMethods';\n\nimport type {\n Personalization,\n PersonalizationInfo,\n PersonalizedState,\n State,\n Group,\n /* eslint-disable @typescript-eslint/no-unused-vars */\n DateGroupAdditionalField,\n NumberGroupAdditionalField,\n GroupFilter,\n GroupAdditionalField\n /* eslint-enable @typescript-eslint/no-unused-vars */\n} from './State.types';\nimport type {\n Meta,\n RowAction,\n FieldDef,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n FieldType\n} from './Meta.types';\n\n/**\n * Represents information about the currently active view in the repeating structures.\n */\ntype ActiveViewInfo = {\n /**\n * The unique identifier of the active view.\n */\n id: string | undefined;\n\n /**\n * The name of the active view.\n */\n name: string | undefined;\n\n /**\n * Indicates whether the active view has unsaved changes.\n */\n isDirty: boolean;\n};\n\nexport type RsApi = {\n /**\n * Refreshes the current view.\n * @see {@link UtilityFunctions.refreshView}\n */\n refreshView: UtilityFunctions['forceRefresh'];\n\n /**\n * Sets the record count in the view.\n * @see {@link UtilityFunctions.setRecordCount}\n */\n setRecordCount: UtilityFunctions['setRecordCount'];\n\n /**\n * Dispatches an action to the repeating structures with an payload.\n * @see {@link UtilityFunctions.dispatchAction}\n */\n dispatchAction: UtilityFunctions['dispatchAction'];\n\n /**\n * Retrieves information about the currently active view.\n * @returns The {@link ActiveViewInfo active view information} or `void` if unavailable.\n */\n getActiveViewInfo: () => ActiveViewInfo | void;\n\n /**\n * Sets hidden columns of the view.\n * @param columns - An array of column IDs to hide.\n * @param ootbColumns - .\n * @param ootbColumns.dragHandle - Whether to hide the drag-and-drop column.\n */\n setHiddenColumns?: (columns: string[], ootbColumns?: { dragHandle: boolean }) => void;\n\n /**\n * Sets Column order of the view.\n * @param columns - An array of column IDs to reorder.\n */\n setColumnOrder?: (columns: string[]) => void;\n\n /**\n * Sets the filters of the view.\n * @param filter - The filter condition to apply.\n */\n setFilter: (filter: Condition) => void;\n\n /**\n * Sets the groups of the view.\n * @param groups - The grouping configuration.\n */\n setGrouping?: (groups: Group[]) => void;\n\n /**\n * Sets the sorting order of the view.\n * @param {NonNullable<State['sortingOrder']>} sorts - The sorting configuration.\n */\n setSorting: (sorts: NonNullable<State['sortingOrder']>) => void;\n\n /**\n * Sets the column aliases of the view.\n * @param aliases - The column alias configuration.\n */\n setAliases: (aliases: State['columnAlias']) => void;\n\n /**\n * Sets the aggregation information of the view.\n * @param {State['aggregationInfo']} agg - The aggregation configuration.\n */\n setAggregations: (agg: State['aggregationInfo']) => void;\n\n /**\n * Sets the visibility of the row reorder field.\n * @param {boolean} visibility - Whether the row reorder field should be visible.\n */\n setRowReorderFieldVisibility: (visibility: boolean) => void;\n\n /**\n * Updates the visibility of specific columns.\n * @param {Object} columns - A mapping of column IDs to their visibility state.\n */\n updateColumnsVisibility: (columns: { [key: FieldDef['id']]: boolean }) => void;\n\n /**\n * Sets the `renderFormatter` for the given column.\n * @param columnId - Column ID\n * @param formatterName - ID of the formatter/renderer\n */\n setRenderFormatter: (\n columnId: string,\n formatter: string | { type: string; config: unknown }\n ) => void;\n\n /**\n * Removes the `renderFormatter` for the given column.\n * @param columnId - Column ID\n */\n removeRenderFormatter: (columnId: string) => void;\n\n /**\n * Sets the conditional style formats of the view.\n * @param conditionalStyleFormats - The conditional style formats to apply.\n */\n setConditionalStyleFormats: (\n conditionalStyleFormats: NonNullable<State['conditionalStyleFormats']>\n ) => void;\n};\n\nexport interface ApiOptions {\n signal?: AbortSignal;\n /** Indicates that the current API call should invalidate the cache and reload the data.\n *\n * @remarks\n * There is an alternative method for signaling the `ApiContext` to invalidate the cache and refresh the data:\n * - The {@link ApiContext.onBeforeRefresh onBeforeRefresh} API in {@link ApiContext}, which is invoked just prior to refreshing the data.\n * Consumers have the option to use either of these methods to invalidate the cache and refresh the data. Prefer `onBeforeRefresh` when using a class-based API context with centralized cache invalidation; use api options for stateless or function-based APIs.\n */\n invalidateCache?: boolean;\n /** A unique token or version identifier that changes whenever a refresh is triggered. Unlike a boolean `invalidateCache` flag, the `invalidateCacheToken` ensures that multiple APIs triggered\n in the same refresh cycle receive the same identifier. */\n invalidateCacheToken?: number;\n}\n// Aggregation response type\ntype AggregationTypeResp = 'avg' | 'max' | 'min' | 'nonNullCount' | 'sum' | 'distinctCount';\n/** An object with key equal to {@link AggregationTypeResp aggregation type} and value is equal to the actual value of that aggregation type */\ntype AggregationOptions = {\n [agg in AggregationTypeResp]?: number | null;\n};\n/** An object where key is equal to the column id (i.e. {@link FieldDef.id id} in FieldDef) and value is equal to its {@link AggregationOptions Aggregation values} */\nexport type AggregationResp = {\n [columnId: string]: AggregationOptions;\n};\n\nexport type AdditionalFieldData = {\n /** {@link FieldDef.id Field Id} of the additional field. */\n id: string;\n /** Value of the additional field that should be displayed for additional field.\n * The value can represent:\n * - An aggregated value (e.g., sum, max, min, avg) for {@link FieldType.NUMBER number} type fields when\n * {@link NumberGroupAdditionalField.aggregation aggregation} is selected in additional fields meta.\n * - A date function value (e.g., Day, Month, Year) for {@link FieldType.DATE 'date'} / {@link FieldType.DATE_TIME 'datetime'}\n * fields when a {@link DateGroupAdditionalField.dateFunction date function} is selected in the additional fields metadata..\n * - A scalar or single value for the additional field.\n */\n value: null | string | number | boolean | Date;\n /** Represents the distinct count of\n * occurrences for the additional field data. This is generally required,\n * but may be omitted if {@link NumberGroupAdditionalField.aggregation aggregation} is selected for number type fields\n * in the additional fields metadata. */\n count?: number;\n};\n\n// Grouping response type\nexport interface GroupedInfo {\n /** Value for the current group node. */\n name: null | string | number | boolean | Date; // Value for the current node\n /** # of data rows in this node */\n count: number;\n /** An optional data row from the group node that is used to process extra information required by group node */\n data?: RowData;\n /** Additional fields data for the current group node */\n additionalFieldsData?: AdditionalFieldData[];\n /** Aggregation values of a column if applied */\n agg?: AggregationResp;\n /** Nested groups within the parent group node */\n children?: GroupedInfo[];\n}\n\nexport interface HierarchicalGroupedInfo extends Pick<GroupedInfo, 'count' | 'agg'> {\n info: RowData;\n children?: HierarchicalGroupedInfo[];\n}\n\nexport type AggregateValueResponse = {\n [columnId: string]: number | null;\n};\n/** An object where key is equal to column id i.e. {@link FieldDef.id id key in fieldDef} and value is equal to the aggregation value for the given aggregation */\nexport type AggregationResult = {\n [columnId: string]: number;\n};\n\nexport interface FetchDataResponse {\n /** An array of {@link RowData} */\n data: RowData[];\n /** An optional parameter to provide the total record count for a given Repeating structures with a given filter criteria in the query. If not provided, use callback setRecordCount */\n totalRecordCount?: number;\n /** @deprecated An optional parameter to provide the total record count for a given Repeating structures with a given filter criteria in the query. If not provided, use callback setRecordCount */\n filteredRecordCount?: number;\n}\n\ntype BulkAction = Pick<RowAction, 'id' | 'text'> & {\n /**\n * @param rowIds - The values for the {@link Meta.itemKey 'itemkey'} for given rows.\n * @param clearSelectionAndRefreshRowsCallback - A callback used to trigger deselection of all the selected rows and then call\n * {@link ApiContext.fetchRowsData 'fetchRowsData'} api of to fetch latest data for given rows, after action is completed.\n * @return {void} - void\n */\n onClick: (rowIds: string[], clearSelectionAndRefreshRowsCallback: () => void) => void;\n};\n\ninterface ConditionConfig {\n condition: Condition;\n data: RowData;\n}\n\nexport type PersonalizationResponse = Pick<Personalization, 'defaultPersonalization'> & {\n allPersonalizations: {\n [personalizationKey: string]: Pick<PersonalizationInfo, 'name'> & {\n personalizationState: PersonalizedState;\n };\n };\n};\n\nexport interface GroupAdditionalFieldUniqueValues {\n /** Unique values for the group additional field. */\n values: (string | number | boolean | Date)[];\n /** Indicates if there are more values. */\n hasMore: boolean;\n}\n\nexport interface ApiContext {\n /**\n * This api is used to fetch a list of raw data rows (excluding aggregations) for a given group or at the top level when no groups.\n *Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#29) documentation** for more details.\n * @requireWhen Always\n * @invokedWhen filters are changed OR\\\n * search criteria is changed OR\\\n end user scrolls through the RS records OR\\\n sorting is changed OR\\\n forceRefresh is triggered by consumer OR\\\n groups are changed OR\\\n hierarchicalGroups are changed OR\\\n hiddenColumns are changed\n * @param {State} rsState - Current repeating structures {@link State}. Majorly used to build the criteria for query(e.g. filter, sort, group criteria, paginationOptions).\n * @param {Meta} rsMeta - Repeating structures {@link Meta}. Majorly used to determine the fields for which data needs to be fetched.\n * @param {ApiOptions} apiOptions - Extra api options provided by repeating structures,\n * for instance, abort signal handler is sent which can be attached to the native fetch call or any framework like axios. Repeating structures will use to cancel the api calls which might be using stale state, e.g. in case of progressive scroll.\n * @returns {Promise<FetchDataResponse>} - It should return a promise of type {@link FetchDataResponse} that should contain data as one key of type Array<{@link RowData}> to provide data for given query.\n */\n fetchData: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions) => Promise<FetchDataResponse>;\n\n /**\n * This api is used to fetch details for any group/sub-group ribbons in the RS. Should return labels, counts, aggregation values at each group node.This can sometimes be called even when there are no groups. Avoid running into exceptions in those cases.\n * Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#59) documentation** for more details.\n * @requireWhen {@link Meta.grouping 'grouping'} key is set to true in\n * @invokedWhen Grouping is applied on any {@link FieldDef fieldDef} OR\\\n * filters are changed OR\\\n * search criteria is changed OR\\\n * personalization is toggled. OR\\\n * aggregation is changed OR\\\n * hiddenColumns are changed OR\\\n * forceRefresh of RS is triggered by consumer.\n * @param {State} rsState - Current repeating structures {@link State}. Majorly used to build the criteria for query. For e.g. use rsState.groups and rsState.aggregationInfo to determine the query.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}. Majorly used to determine the fields info for which data needs to be fetched.\n * @returns {GroupedInfo[]} - It should return a promise of type array of all the {@link GroupedInfo } for the specific field. It can also include nested groups in children key.\n */\n fetchGroupedInfo?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions\n ) => Promise<GroupedInfo[]>;\n\n /**\n * This api is used to fetch aggregation results for a given aggregation type(sum/min/max/count) on a field. This is called when aggregations are configured on one or more column.\n * Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#84) documentation** for more details.\n * @requireWhen {@link FieldDef.aggregation 'aggregation'} key is set to true for at least one FieldDef AND {@link FieldDef.type 'type'} key in FieldDef should be of number for that particular fieldDef.\n * @invokedWhen When aggregation is applied on any {@link FieldDef fieldDef} OR\\\n * filters are changed OR\\\n * search criteria is changed OR\\\n * personalization is toggled. OR\\\n * hiddenColumns are changed.\n * @param {State} rsState - Current repeating structures {@link State}. Majorly used to get current aggregations applied on the RS from aggregationInfo key in state. Apart from this current filters and search criteria can also be picked from state.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}. Majorly used to determine the fields for which data needs to be fetched.\n * @returns {Promise<AggregationResult>} - It should return a promise of type {@link AggregationResult}\n */\n fetchAggregatedValues?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions\n ) => Promise<AggregationResult>;\n\n /**\n * This api is used to fetch unique values available for a particular field. It is generally called for a field which has {@link FieldDef.filterPickList filterPickList} key set to true.The unique values are presented to the user while filtering.\n * Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#99) documentation** for more details.\n * @requireWhen {@link FieldDef.filterPickList filterPickList} key set to true for at least one FieldDef\n * @invokedWhen Picklist Filter is invoked by end user from FieldDef header action menu.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param {string} columnId - This is equal to { @link FieldDef.id 'id'} key of the field for which unique values needs to be fetched.\n * @returns {Promise<Array<string | number | boolean | Date>>} It should return a promise of type array of unique values for a given fieldDef id.\n */\n fetchUniqueColValues?: (\n rsState: State,\n rsMeta: Meta,\n columnId: string,\n apiOptions: ApiOptions\n ) => Promise<(string | number | boolean | Date)[]>;\n\n /**\n * This api is used to fetch the latest data for a given row identified uniquely by {@link FieldDef.itemKey itemKey}.\n * @requireWhen {@link Meta.editing 'editing'} OR {@link Meta.deleting 'deleting'} is set to true\n * @invokedWhen A {@link Meta.rowActions rowAction} is submitted by consumer of RS, as part of {@link RowAction. rowAction.onClick} 'refresRow' callback.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param {string} key - A unique identifier for a given row. This is equal to {@link Meta.itemKey 'itemKey'}\n * @param {string} value - The value for the given {@link Meta.itemKey 'itemKey'} for given row.\n * @param {RowData} existingRowData - Existing row data for the given row.\n * @returns {Promise<RowData[]>} It should return a promise of type {@link RowData} array containing the data for a given row.Only 0th index is considered from the array.\n */\n fetchRowData?: (\n rsState: State,\n rsMeta: Meta,\n key: string,\n value: string,\n existingRowData: RowData,\n apiOptions: ApiOptions\n ) => Promise<RowData[]>;\n\n /**\n * This api is used to fetch the latest data for given set of rows identified uniquely by itemKey in {@link FieldDef}. This is passed as callback to all the {@link BulkAction.onClick bulk actions 'onClick'} method with {@link ApiContext.clearSelectedRows clearSelectedRows} api.\n * @requireWhen {@link Meta.allowBulkActions 'allowBulkActions'} is set to true.\n * @invokedWhen The bulk action is submitted, this can be called by bulk actions {@link BulkAction.onClick 'onClick'} method by RS consumer.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param {Array<string | number | boolean | Date>} rowIds - The values for the given {@link Meta.itemKey 'itemKey'} for given rows.\n * @param itemKey - A unique identifier for a given row. This is equal to {@link Meta.itemKey 'itemKey'}\n * @returns {Promise<RowData[]>} It should return a promise of type {@link RowData} array containing the data for given rows.\n */\n fetchRowsData?: (\n rsState: State,\n rsMeta: Meta,\n rowIds: string[],\n itemKey: string,\n apiOptions: ApiOptions\n ) => Promise<RowData[]>;\n\n /**\n * This api is used to fetch the actions that is supported on rows of Repeating Structure. It is generally called when {@link Meta.editing 'editing'} is set to true.\n * @requireWhen {@link Meta.editing 'editing'} OR {@link Meta.deleting 'deleting'} is set to true\n * @invokedWhen The end user clicks on 'RowActionMenu'.Once fetched it is not refetched.\n * @param {} uniqueKey - A unique identifier for a given row. This is equal to value for {@link Meta.itemKey 'itemKey'} in {@link RowData} data.\n * @returns - A promise of type Array of {@link RowAction}\n */\n fetchRowActionDetails?: (uniqueKey: string, rowContext: RowData) => Promise<RowAction[]>;\n\n /**\n * This api is used to submit the updated row data to apiContext. It is generally called when {@link FieldDef.editable 'editable'} key is set to true for at least one FieldDef to enable inline editing for a cell.\n * @requireWhen {@link FieldDef.editable 'editable'} key is set to true for at least one FieldDef.\n * @invokedWhen The end user is done editing the cell using inline editing.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param dataToSubmit - Updated row data to be submitted to apiContext\n * @returns It should return a promise of type {@link RowData} with the updated contents that is passed in {@link dataToSubmit} param.\n */\n submitData?: (\n rsState: State,\n rsMeta: Meta,\n dataToSubmit: RowData\n ) => Promise<{ rowData: RowData }>;\n\n /**\n * This api is used to submit moved records in a repeating structure. It is called when {@link Meta.moveListRecords 'moveListRecords'} is set to true. Repeating structure allow moving of records based on it's value.\n * @requireWhen {@link Meta.moveListRecords 'moveListRecords'} is set to true\n * @invokedWhen The move process is completed by end user this api is called to provide the info related to move records.\n * @param moveInfo - It is an object that contains sourceID(the data of {@link Meta.itemKey 'itemKey'} for the given row) that user has selected to move and\n * destinationID(the data of {@link Meta.itemKey 'itemKey'} for the given row) where the user has dropped the source row.\n * @returns It should return a promise of type object that contains a refresh key if set to true, repeating structures will trigger a refresh and fetch the whole data agin using {@link ApiContext.fetchData 'fetchData'} api\n */\n moveListRecords?: (moveInfo: {\n sourceID: string;\n destinationID: string;\n }) => Promise<{ refresh: boolean }>;\n\n /**\n * This api is used to fetch the bulkActions for a repeating structures if {@link Meta.allowBulkActions 'allowBulkActions'} is set to true.\n * This is called on demand, when the bulk action button in repeating structures is clicked. The button will be disabled till the time at least one record is not selected in repeating structures to trigger bulk action.\n * @requireWhen {@link Meta.allowBulkActions 'allowBulkActions'} is set to true.\n * @invokedWhen End user clicks on 'Bulk actions' button in RS Toolbar.Once fetched it is not refetched.\n * @param {Array<string>} rowIds - The values for the given {@link Meta.itemKey 'itemKey'} for given rows.\n * @returns A promise of type Array of {@link BulkAction}\n */\n fetchActions?: (rowIds: string[]) => Promise<BulkAction[]>;\n\n /**\n * This API is used to pass utility callbacks to the consumer. Consumers can use these callbacks at any point in the lifecycle of Repeating Structures to interact with them.\n *\n * @returns {void} This function does not return any value.\n */\n addCallbacks?: (\n /**\n * @param rsUtilityCallbacks - A set of callbacks exposed by Repeating Structures, including methods for interacting with the view and managing state.\n * See {@link RsApi} for the list of available callbacks.\n *\n */\n rsUtilityCallbacks: RsApi & {\n /**\n * @deprecated This method will be removed in future versions. Please use {@link RsApi.refreshView refreshView} instead.\n *\n * It is used to trigger a force refresh the data and re-fetch selections using apiContext.getSelectedRows api (if any of the selection mode is enabled) of repeating structures\n * @returns {void} void\n */\n forceRefresh: UtilityFunctions['forceRefresh'];\n }\n ) => void;\n\n /**\n * This api passes a unique identifier to apiContext to identify a repeating structure instance. This can be used to uniquely identify a RS instance in case of multiple RS instances.\n * @requireWhen Optional\n * @invokedWhen On Repeating structures mount to share current repeating structure instance identifier.\n * @param {string} rsID - A unique identifier\n * @returns {void} void\n */\n setRsID?: (rsID: string) => void;\n\n /**\n * This api is called to fetch all the personalizations for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen On Repeating structures mount to fetch all personalizations.\n * @returns {PersonalizationResponse} It should return all the personalizations.\n */\n fetchPersonalizations?: () => Promise<PersonalizationResponse>;\n\n /**\n * This api is called to update the personalization for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen End user deletes a personalization.\n * @param {string} personalizationKey - Unique identifier for the personalization.\n * @param personalization - The updated personalization state.\n * @returns {void} void\n */\n updatePersonalization?: (\n personalizationKey: string,\n personalization: {\n markAsDefault?: boolean;\n markAsAppDefault?: boolean;\n name?: string;\n personalizationState?: PersonalizedState;\n }\n ) => Promise<void>;\n\n /**\n * This api is called to delete the personalization for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen End user deletes a personalization.\n * @param personalizationKey - Unique identifier for a personalization.\n * @returns {void} void\n */\n deletePersonalization?: (personalizationKey: string) => Promise<void>;\n\n /**\n * This api is called to create the personalization for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen End user create a new personalization.\n * @param {string} personalizationKey - Unique identifier for the personalization.\n * @param personalization - The personalization state to be saved\n * @returns {void} void\n */\n createPersonalization?: (\n personalizationKey: string,\n personalization: {\n markAsDefault: boolean;\n name: string;\n personalizationState: PersonalizedState;\n }\n ) => Promise<string> | Promise<{ data: string }>;\n\n /**\n * This api is used to communicate selectedRows in the repeating structures to the consumer.\n * @requireWhen {@link Meta.selectionMode 'selectionMode'} key is set to true.\n * @invokedWhen {@link Meta.selectionMode 'selectionMode'} key is set to true and whenever selection changes in RS.\n * @param {Array<RowData & { $selected: boolean }>} selectedRows The selectedRows that needs to be communicated.\n * @returns {Promise<void>} A promise\n */\n setSelectedRows?: (selectedRows: (RowData & { $selected: boolean })[]) => Promise<void>;\n\n /**\n * This api is used to get the selectedRows for the repeating structures from the consumer, to populate the selections in RS.\n * @requireWhen {@link Meta.selectionMode 'selectionMode'} key is set to true.\n * @invokedWhen {@link Meta.selectionMode 'selectionMode'} key is set to true and RS requires current selected rows from the consumer.\n * @returns {Promise<Array<string>>} A promise of type array of unique identifiers for all the row. It is value of {@link Meta.itemKey 'itemKey'}\n */\n getSelectedRows?: () => Promise<string[]>;\n\n /** This api is used to communicate the clearance of all the selectedRows for the repeating structures to the consumer.\n * This is also passed as callback to all the {@link BulkAction.onClick bulk actions 'onClick'} method with {@link ApiContext.fetchRowsData fetchRowsData} api.\n * @requireWhen {@link Meta.selectionMode 'selectionMode'} key is set to true.\n * @invokedWhen In case of {@link Meta.selectionMode \"multi\"} selection mode, while toggling all the selections OR\\\n * while switching personalizations OR\\\n * when the bulk action is submitted, this can be called by bulk actions {@link BulkAction.onClick 'onClick'} method by RS consumer.\n * @returns {Promise<void>} A promise\n */\n clearSelectedRows?: () => Promise<void>;\n\n /**\n * This api is used to fetch the hierarchical groups for an RS if {@link FieldDef.hierarchicalInfo 'hierarchicalInfo'} key is set to true for at least one FieldDef.\n * @requireWhen {@link FieldDef.hierarchicalInfo 'hierarchicalInfo'} key is set to true for at least one FieldDef\n * @invokedWhen Any change in filters, search criteria, hierarchichal groups, aggregations is detected in RS state or personalizations are toggled.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @returns {HierarchicalGroupedInfo[]} - It should return a promise of type array of all the {@link HierarchicalGroupedInfo } for the specific field. It can also include nested hierarchical groups in children key.\n */\n fetchHierarchicalGroupedInfo?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions\n ) => Promise<HierarchicalGroupedInfo[]>;\n\n /**\n * This api is used to communicate repeating structure state to the consumer. It also includes visibleColumns apart from regular repeating structure state.\n * @requireWhen Optional\n * @invokedWhen After any action performed on Repeating structures that results in updating of state.\n * @param state Repeating structure state\n * @returns {void} void\n */\n stateUpdateCallback?: (state: PersonalizedState & { visibleColumns?: string[] }) => void;\n\n /**\n * This api is used to communicate repeating structure state to the consumer. It also includes active personalization in RS apart from regular repeating structure state.\n * @requireWhen Optional\n * @param state Repeating structure state\n * @returns {void} void\n */\n setComponentState?: (state: PersonalizedState & { activePersonalization?: string }) => void;\n /**\n * This api is used to communicate repeating structure state to RS from consumer.\n * @requireWhen Optional\n * @returns RS state.\n */\n getComponentState?: () => Promise<PersonalizedState & { activePersonalization?: string }>;\n /** This api is called on click of 'Import data' option in repeating structures toolbar and should open a modal to allow import of data from a CSV file.\n * @requireWhen {@link Meta.showImportDataOption showImportDataOption} is set to true in Meta.\n * @invokedWhen \"Import data\" button is clicked in the repeating structures toolbar\n * @param {ModalManagerContextValue['create']} create - The function to create a modal in the current context {@link ModalManagerContextValue['create']}.\n * @returns {void} void\n */\n importCSVData?: (create: ModalManagerContextValue['create']) => Promise<void>;\n /** This api is called on click of 'Export to excel' option in repeating structures toolbar and should export the data into a excel file.\n * @requireWhen {@link Meta.showExportToExcelOption showExportToExcelOption} is set to true in Meta.\n * @invokedWhen \"Export to excel\" button is clicked in the repeating structures toolbar\n * @param {State} rsState - Current repeating structures state {@link State}.\n * @param {Meta} rsMeta - Repeating structures meta {@link Meta}.\n * @returns {void} void\n */\n exportData?: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions) => Promise<void>;\n\n /** This api is called on click of 'Export to CSV' option in repeating structures toolbar and should export the data into a CSV file.\n * @requireWhen {@link Meta.showExportToCSVOption showExportToCSVOption} is set to true in Meta.\n * @invokedWhen \"Export to CSV\" button is clicked in the repeating structures toolbar\n * @param {State} rsState - Current repeating structures state {@link State}.\n * @param {Meta} rsMeta - Repeating structures meta {@link Meta}.\n * @returns {void} void\n */\n exportDataToCSV?: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions) => Promise<void>;\n\n /** This api is used to communicate source and destinaltion row keys to apiContext during row-reordering operation.\n * @requireWhen {@link Meta.reorderItems reorderItems} is set to true and {@link Meta.moveListRecords moveListRecords} is set to false in Meta.\n * @invokedWhen Reordering operations is being performed on rows.\n * @param {string} sourceKey - the value of {@link Meta.itemKey 'itemKey'} for the given row that user has selected to move.\n * @param {string} destinationKey - the value of {@link Meta.itemKey 'itemKey'} for the given row where the user has dropped the source row.\n * @returns {void} void\n */\n applyRowReorder?: (sourceKey: string, destinationKey: string) => Promise<void>;\n\n /**\n * This API allows Repeating Structures to determine if a given `data` meets a specified `condition`. It is utilized in the following features if provided:\n * - `Conditional Formatting` - Optional. If `evaluateCondition` is not provided, Repeating Structures will evaluate the row condition on their own. Otherwise, this function will be used.\n *\n * @param {State} rsState - The state of the Repeating Structures.\n * @param {Meta} rsMeta - The meta information of the Repeating Structures.\n * @param {ConditionConfig} config - The configuration for the condition.\n * @returns {Promise<boolean> | boolean} - Returns `true` if the data satisfies the condition, otherwise `false`.\n */\n evaluateCondition?: (rsState: State, rsMeta: Meta, config: ConditionConfig) => boolean;\n\n /**\n * This api is used to fetch unique values for a particular group additional field. It is generally called for a group additional field which has more than 1 value.\n * It should return unique values for the additional field along with hasMore flag to indicate if there are more values.\n * @param additionalField - The group additional field for which unique values needs to be fetched.\n * @param groupFilters - The current group filters on which the additional field is set.\n * @param rsState - The state of the Repeating Structures.\n * @param rsMeta - The meta information of the Repeating Structures.\n * @param options - Extra api options provided by repeating structures.\n * @returns GroupAdditionalFieldUniqueValues - It should return a promise of type {@link GroupAdditionalFieldUniqueValues}\n */\n fetchGroupAdditionalFieldUniqueValues?: (\n additionalField: GroupAdditionalField,\n groupFilters: GroupFilter['filters'],\n rsState: State,\n rsMeta: Meta,\n options?: ApiOptions\n ) => Promise<GroupAdditionalFieldUniqueValues>;\n\n /**\n * This API is invoked just before refreshing the data in repeating structures. The refresh in Repeating Structures can occur in two ways:\n * - Through the Refresh button in the Toolbar.\n * - By clicking the refresh notification dispatched via the NOTIFY_DATA_REFRESH action.\n * The implementation of this method should include clearing any caches maintained by the consumer to ensure that fresh data is fetched when the repeating structures refresh the data.\n * @requireWhen Optional\n * @invokedWhen Before Repeating Structures refresh the data.\n * @returns void\n *\n * @remarks\n * There is an alternative way for signaling the `ApiContext` to invalidate the cache is available.\n * - The `invalidateCache` or `invalidateCacheToken` boolean flag in {@link ApiOptions} indicates that the current API call should invalidate the cache, as it is triggered by the refresh of the Repeating Structures.\n * Consumers can choose to implement either of the two approaches to clear their caches. Prefer `onBeforeRefresh` when using a class-based API context with centralized cache invalidation; use api options for stateless or function-based APIs.\n */\n onBeforeRefresh?: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ApiContext.types.js","sourceRoot":"","sources":["../../types/ApiContext.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ModalManagerContextValue } from '@pega/cosmos-react-core/lib/components/Modal/Modal.types';\nimport type { Condition } from '@pega/cosmos-react-condition-builder';\n\nimport type { RowData } from '../src/core/generators/RowGenerator.types';\nimport type { UtilityFunctions } from '../src/core/generators/viewUtilityMethods';\nimport type Column from '../src/core/generators/ColumnGenerator';\n\nimport type {\n Personalization,\n PersonalizationInfo,\n PersonalizedState,\n State,\n Group,\n /* eslint-disable @typescript-eslint/no-unused-vars */\n DateGroupAdditionalField,\n NumberGroupAdditionalField,\n GroupFilter,\n GroupAdditionalField\n /* eslint-enable @typescript-eslint/no-unused-vars */\n} from './State.types';\nimport type {\n Meta,\n RowAction,\n FieldDef,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n FieldType\n} from './Meta.types';\n\n/**\n * Represents information about the currently active view in the repeating structures.\n */\ntype ActiveViewInfo = {\n /**\n * The unique identifier of the active view.\n */\n id: string | undefined;\n\n /**\n * The name of the active view.\n */\n name: string | undefined;\n\n /**\n * Indicates whether the active view has unsaved changes.\n */\n isDirty: boolean;\n};\n\nexport type RsApi = {\n /**\n * Refreshes the current view.\n * @see {@link UtilityFunctions.refreshView}\n */\n refreshView: UtilityFunctions['forceRefresh'];\n\n /**\n * Sets the record count in the view.\n * @see {@link UtilityFunctions.setRecordCount}\n */\n setRecordCount: UtilityFunctions['setRecordCount'];\n\n /**\n * Dispatches an action to the repeating structures with an payload.\n * @see {@link UtilityFunctions.dispatchAction}\n */\n dispatchAction: UtilityFunctions['dispatchAction'];\n\n /**\n * Retrieves information about the currently active view.\n * @returns The {@link ActiveViewInfo active view information} or `void` if unavailable.\n */\n getActiveViewInfo: () => ActiveViewInfo | void;\n\n /**\n * Sets hidden columns of the view.\n * @param columns - An array of column IDs to hide.\n * @param ootbColumns - .\n * @param ootbColumns.dragHandle - Whether to hide the drag-and-drop column.\n */\n setHiddenColumns?: (columns: string[], ootbColumns?: { dragHandle: boolean }) => void;\n\n /**\n * Sets Column order of the view.\n * @param columns - An array of column IDs to reorder.\n */\n setColumnOrder?: (columns: string[]) => void;\n\n /**\n * Sets the filters of the view.\n * @param filter - The filter condition to apply.\n */\n setFilter: (filter: Condition) => void;\n\n /**\n * Sets the groups of the view.\n * @param groups - The grouping configuration.\n */\n setGrouping?: (groups: Group[]) => void;\n\n /**\n * Sets the sorting order of the view.\n * @param {NonNullable<State['sortingOrder']>} sorts - The sorting configuration.\n */\n setSorting: (sorts: NonNullable<State['sortingOrder']>) => void;\n\n /**\n * Sets the column aliases of the view.\n * @param aliases - The column alias configuration.\n */\n setAliases: (aliases: State['columnAlias']) => void;\n\n /**\n * Sets the aggregation information of the view.\n * @param {State['aggregationInfo']} agg - The aggregation configuration.\n */\n setAggregations: (agg: State['aggregationInfo']) => void;\n\n /**\n * Sets the visibility of the row reorder field.\n * @param {boolean} visibility - Whether the row reorder field should be visible.\n */\n setRowReorderFieldVisibility: (visibility: boolean) => void;\n\n /**\n * Updates the visibility of specific columns.\n * @param {Object} columns - A mapping of column IDs to their visibility state.\n */\n updateColumnsVisibility: (columns: { [key: FieldDef['id']]: boolean }) => void;\n\n /**\n * Sets the `renderFormatter` for the given column.\n * @param columnId - Column ID\n * @param formatterName - ID of the formatter/renderer\n */\n setRenderFormatter: (\n columnId: string,\n formatter: string | { type: string; config: unknown }\n ) => void;\n\n /**\n * Removes the `renderFormatter` for the given column.\n * @param columnId - Column ID\n */\n removeRenderFormatter: (columnId: string) => void;\n\n /**\n * Sets the conditional style formats of the view.\n * @param conditionalStyleFormats - The conditional style formats to apply.\n */\n setConditionalStyleFormats: (\n conditionalStyleFormats: NonNullable<State['conditionalStyleFormats']>\n ) => void;\n};\n\nexport interface ApiOptions {\n signal?: AbortSignal;\n /** Indicates that the current API call should invalidate the cache and reload the data.\n *\n * @remarks\n * There is an alternative method for signaling the `ApiContext` to invalidate the cache and refresh the data:\n * - The {@link ApiContext.onBeforeRefresh onBeforeRefresh} API in {@link ApiContext}, which is invoked just prior to refreshing the data.\n * Consumers have the option to use either of these methods to invalidate the cache and refresh the data. Prefer `onBeforeRefresh` when using a class-based API context with centralized cache invalidation; use api options for stateless or function-based APIs.\n */\n invalidateCache?: boolean;\n /** A unique token or version identifier that changes whenever a refresh is triggered. Unlike a boolean `invalidateCache` flag, the `invalidateCacheToken` ensures that multiple APIs triggered\n in the same refresh cycle receive the same identifier. */\n invalidateCacheToken?: number;\n}\n// Aggregation response type\ntype AggregationTypeResp = 'avg' | 'max' | 'min' | 'nonNullCount' | 'sum' | 'distinctCount';\n/** An object with key equal to {@link AggregationTypeResp aggregation type} and value is equal to the actual value of that aggregation type */\ntype AggregationOptions = {\n [agg in AggregationTypeResp]?: number | null;\n};\n/** An object where key is equal to the column id (i.e. {@link FieldDef.id id} in FieldDef) and value is equal to its {@link AggregationOptions Aggregation values} */\nexport type AggregationResp = {\n [columnId: string]: AggregationOptions;\n};\n\nexport type AdditionalFieldData = {\n /** {@link FieldDef.id Field Id} of the additional field. */\n id: string;\n /** Value of the additional field that should be displayed for additional field.\n * The value can represent:\n * - An aggregated value (e.g., sum, max, min, avg) for {@link FieldType.NUMBER number} type fields when\n * {@link NumberGroupAdditionalField.aggregation aggregation} is selected in additional fields meta.\n * - A date function value (e.g., Day, Month, Year) for {@link FieldType.DATE 'date'} / {@link FieldType.DATE_TIME 'datetime'}\n * fields when a {@link DateGroupAdditionalField.dateFunction date function} is selected in the additional fields metadata..\n * - A scalar or single value for the additional field.\n */\n value: null | string | number | boolean | Date;\n /** Represents the distinct count of\n * occurrences for the additional field data. This is generally required,\n * but may be omitted if {@link NumberGroupAdditionalField.aggregation aggregation} is selected for number type fields\n * in the additional fields metadata. */\n count?: number;\n};\n\n// Grouping response type\nexport interface GroupedInfo {\n /** Value for the current group node. */\n name: null | string | number | boolean | Date; // Value for the current node\n /** # of data rows in this node */\n count: number;\n /** An optional data row from the group node that is used to process extra information required by group node */\n data?: RowData;\n /** Additional fields data for the current group node */\n additionalFieldsData?: AdditionalFieldData[];\n /** Aggregation values of a column if applied */\n agg?: AggregationResp;\n /** Nested groups within the parent group node */\n children?: GroupedInfo[];\n}\n\nexport interface HierarchicalGroupedInfo extends Pick<GroupedInfo, 'count' | 'agg'> {\n info: RowData;\n children?: HierarchicalGroupedInfo[];\n}\n\nexport type AggregateValueResponse = {\n [columnId: string]: number | null;\n};\n/** An object where key is equal to column id i.e. {@link FieldDef.id id key in fieldDef} and value is equal to the aggregation value for the given aggregation */\nexport type AggregationResult = {\n [columnId: string]: number;\n};\n\nexport interface FetchDataResponse {\n /** An array of {@link RowData} */\n data: RowData[];\n /** An optional parameter to provide the total record count for a given Repeating structures with a given filter criteria in the query. If not provided, use callback setRecordCount */\n totalRecordCount?: number;\n /** @deprecated An optional parameter to provide the total record count for a given Repeating structures with a given filter criteria in the query. If not provided, use callback setRecordCount */\n filteredRecordCount?: number;\n}\n\ntype BulkAction = Pick<RowAction, 'id' | 'text'> & {\n /**\n * @param rowIds - The values for the {@link Meta.itemKey 'itemkey'} for given rows.\n * @param clearSelectionAndRefreshRowsCallback - A callback used to trigger deselection of all the selected rows and then call\n * {@link ApiContext.fetchRowsData 'fetchRowsData'} api of to fetch latest data for given rows, after action is completed.\n * @return {void} - void\n */\n onClick: (rowIds: string[], clearSelectionAndRefreshRowsCallback: () => void) => void;\n};\n\ninterface ConditionConfig {\n condition: Condition;\n data: RowData;\n}\n\nexport type PersonalizationResponse = Pick<Personalization, 'defaultPersonalization'> & {\n allPersonalizations: {\n [personalizationKey: string]: Pick<PersonalizationInfo, 'name'> & {\n personalizationState: PersonalizedState;\n };\n };\n};\n\nexport interface GroupAdditionalFieldUniqueValues {\n /** Unique values for the group additional field. */\n values: (string | number | boolean | Date)[];\n /** Indicates if there are more values. */\n hasMore: boolean;\n}\n\nexport interface ApiContext {\n /**\n * This api is used to fetch a list of raw data rows (excluding aggregations) for a given group or at the top level when no groups.\n *Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#29) documentation** for more details.\n * @requireWhen Always\n * @invokedWhen filters are changed OR\\\n * search criteria is changed OR\\\n end user scrolls through the RS records OR\\\n sorting is changed OR\\\n forceRefresh is triggered by consumer OR\\\n groups are changed OR\\\n hierarchicalGroups are changed OR\\\n hiddenColumns are changed\n * @param {State} rsState - Current repeating structures {@link State}. Majorly used to build the criteria for query(e.g. filter, sort, group criteria, paginationOptions).\n * @param {Meta} rsMeta - Repeating structures {@link Meta}. Majorly used to determine the fields for which data needs to be fetched.\n * @param {ApiOptions} apiOptions - Extra api options provided by repeating structures,\n * for instance, abort signal handler is sent which can be attached to the native fetch call or any framework like axios. Repeating structures will use to cancel the api calls which might be using stale state, e.g. in case of progressive scroll.\n * @returns {Promise<FetchDataResponse>} - It should return a promise of type {@link FetchDataResponse} that should contain data as one key of type Array<{@link RowData}> to provide data for given query.\n */\n fetchData: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions) => Promise<FetchDataResponse>;\n\n /**\n * This api is used to fetch details for any group/sub-group ribbons in the RS. Should return labels, counts, aggregation values at each group node.This can sometimes be called even when there are no groups. Avoid running into exceptions in those cases.\n * Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#59) documentation** for more details.\n * @requireWhen {@link Meta.grouping 'grouping'} key is set to true in\n * @invokedWhen Grouping is applied on any {@link FieldDef fieldDef} OR\\\n * filters are changed OR\\\n * search criteria is changed OR\\\n * personalization is toggled. OR\\\n * aggregation is changed OR\\\n * hiddenColumns are changed OR\\\n * forceRefresh of RS is triggered by consumer.\n * @param {State} rsState - Current repeating structures {@link State}. Majorly used to build the criteria for query. For e.g. use rsState.groups and rsState.aggregationInfo to determine the query.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}. Majorly used to determine the fields info for which data needs to be fetched.\n * @returns {GroupedInfo[]} - It should return a promise of type array of all the {@link GroupedInfo } for the specific field. It can also include nested groups in children key.\n */\n fetchGroupedInfo?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions\n ) => Promise<GroupedInfo[]>;\n\n /**\n * This api is used to fetch aggregation results for a given aggregation type(sum/min/max/count) on a field. This is called when aggregations are configured on one or more column.\n * Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#84) documentation** for more details.\n * @requireWhen {@link FieldDef.aggregation 'aggregation'} key is set to true for at least one FieldDef AND {@link FieldDef.type 'type'} key in FieldDef should be of number for that particular fieldDef.\n * @invokedWhen When aggregation is applied on any {@link FieldDef fieldDef} OR\\\n * filters are changed OR\\\n * search criteria is changed OR\\\n * personalization is toggled. OR\\\n * hiddenColumns are changed.\n * @param {State} rsState - Current repeating structures {@link State}. Majorly used to get current aggregations applied on the RS from aggregationInfo key in state. Apart from this current filters and search criteria can also be picked from state.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}. Majorly used to determine the fields for which data needs to be fetched.\n * @returns {Promise<AggregationResult>} - It should return a promise of type {@link AggregationResult}\n */\n fetchAggregatedValues?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions\n ) => Promise<AggregationResult>;\n\n /**\n * This api is used to fetch unique values available for a particular field. It is generally called for a field which has {@link FieldDef.filterPickList filterPickList} key set to true.The unique values are presented to the user while filtering.\n * Refer **[apiContext](https://git.pega.io/projects/PS/repos/ui-lists-lib/browse/docs/apiContext.md?useDefaultHandler=true#99) documentation** for more details.\n * @requireWhen {@link FieldDef.filterPickList filterPickList} key set to true for at least one FieldDef\n * @invokedWhen Picklist Filter is invoked by end user from FieldDef header action menu.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param {string} columnId - This is equal to { @link FieldDef.id 'id'} key of the field for which unique values needs to be fetched.\n * @returns {Promise<Array<string | number | boolean | Date>>} It should return a promise of type array of unique values for a given fieldDef id.\n */\n fetchUniqueColValues?: (\n rsState: State,\n rsMeta: Meta,\n columnId: string,\n apiOptions: ApiOptions\n ) => Promise<(string | number | boolean | Date)[]>;\n\n /**\n * This api is used to fetch the latest data for a given row identified uniquely by {@link FieldDef.itemKey itemKey}.\n * @requireWhen {@link Meta.editing 'editing'} OR {@link Meta.deleting 'deleting'} is set to true\n * @invokedWhen A {@link Meta.rowActions rowAction} is submitted by consumer of RS, as part of {@link RowAction. rowAction.onClick} 'refresRow' callback.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param {string} key - A unique identifier for a given row. This is equal to {@link Meta.itemKey 'itemKey'}\n * @param {string} value - The value for the given {@link Meta.itemKey 'itemKey'} for given row.\n * @param {RowData} existingRowData - Existing row data for the given row.\n * @returns {Promise<RowData[]>} It should return a promise of type {@link RowData} array containing the data for a given row.Only 0th index is considered from the array.\n */\n fetchRowData?: (\n rsState: State,\n rsMeta: Meta,\n key: string,\n value: string,\n existingRowData: RowData,\n apiOptions: ApiOptions\n ) => Promise<RowData[]>;\n\n /**\n * This api is used to fetch the latest data for given set of rows identified uniquely by itemKey in {@link FieldDef}. This is passed as callback to all the {@link BulkAction.onClick bulk actions 'onClick'} method with {@link ApiContext.clearSelectedRows clearSelectedRows} api.\n * @requireWhen {@link Meta.allowBulkActions 'allowBulkActions'} is set to true.\n * @invokedWhen The bulk action is submitted, this can be called by bulk actions {@link BulkAction.onClick 'onClick'} method by RS consumer.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param {Array<string | number | boolean | Date>} rowIds - The values for the given {@link Meta.itemKey 'itemKey'} for given rows.\n * @param itemKey - A unique identifier for a given row. This is equal to {@link Meta.itemKey 'itemKey'}\n * @returns {Promise<RowData[]>} It should return a promise of type {@link RowData} array containing the data for given rows.\n */\n fetchRowsData?: (\n rsState: State,\n rsMeta: Meta,\n rowIds: string[],\n itemKey: string,\n apiOptions: ApiOptions\n ) => Promise<RowData[]>;\n\n /**\n * This api is used to fetch the actions that is supported on rows of Repeating Structure. It is generally called when {@link Meta.editing 'editing'} is set to true.\n * @requireWhen {@link Meta.editing 'editing'} OR {@link Meta.deleting 'deleting'} is set to true\n * @invokedWhen The end user clicks on 'RowActionMenu'.Once fetched it is not refetched.\n * @param {} uniqueKey - A unique identifier for a given row. This is equal to value for {@link Meta.itemKey 'itemKey'} in {@link RowData} data.\n * @returns - A promise of type Array of {@link RowAction}\n */\n fetchRowActionDetails?: (uniqueKey: string, rowContext: RowData) => Promise<RowAction[]>;\n\n /**\n * This api is used to submit the updated row data to apiContext. It is generally called when {@link FieldDef.editable 'editable'} key is set to true for at least one FieldDef to enable inline editing for a cell.\n * @requireWhen {@link FieldDef.editable 'editable'} key is set to true for at least one FieldDef.\n * @invokedWhen The end user is done editing the cell using inline editing.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @param dataToSubmit - Updated row data to be submitted to apiContext\n * @returns It should return a promise of type {@link RowData} with the updated contents that is passed in {@link dataToSubmit} param.\n */\n submitData?: (\n rsState: State,\n rsMeta: Meta,\n dataToSubmit: RowData\n ) => Promise<{ rowData: RowData }>;\n\n /**\n * This api is used to submit moved records in a repeating structure. It is called when {@link Meta.moveListRecords 'moveListRecords'} is set to true. Repeating structure allow moving of records based on it's value.\n * @requireWhen {@link Meta.moveListRecords 'moveListRecords'} is set to true\n * @invokedWhen The move process is completed by end user this api is called to provide the info related to move records.\n * @param moveInfo - It is an object that contains sourceID(the data of {@link Meta.itemKey 'itemKey'} for the given row) that user has selected to move and\n * destinationID(the data of {@link Meta.itemKey 'itemKey'} for the given row) where the user has dropped the source row.\n * @returns It should return a promise of type object that contains a refresh key if set to true, repeating structures will trigger a refresh and fetch the whole data agin using {@link ApiContext.fetchData 'fetchData'} api\n */\n moveListRecords?: (moveInfo: {\n sourceID: string;\n destinationID: string;\n }) => Promise<{ refresh: boolean }>;\n\n /**\n * This api is used to fetch the bulkActions for a repeating structures if {@link Meta.allowBulkActions 'allowBulkActions'} is set to true.\n * This is called on demand, when the bulk action button in repeating structures is clicked. The button will be disabled till the time at least one record is not selected in repeating structures to trigger bulk action.\n * @requireWhen {@link Meta.allowBulkActions 'allowBulkActions'} is set to true.\n * @invokedWhen End user clicks on 'Bulk actions' button in RS Toolbar.Once fetched it is not refetched.\n * @param {Array<string>} rowIds - The values for the given {@link Meta.itemKey 'itemKey'} for given rows.\n * @returns A promise of type Array of {@link BulkAction}\n */\n fetchActions?: (rowIds: string[]) => Promise<BulkAction[]>;\n\n /**\n * This API is used to pass utility callbacks to the consumer. Consumers can use these callbacks at any point in the lifecycle of Repeating Structures to interact with them.\n *\n * @returns {void} This function does not return any value.\n */\n addCallbacks?: (\n /**\n * @param rsUtilityCallbacks - A set of callbacks exposed by Repeating Structures, including methods for interacting with the view and managing state.\n * See {@link RsApi} for the list of available callbacks.\n *\n */\n rsUtilityCallbacks: RsApi & {\n /**\n * @deprecated This method will be removed in future versions. Please use {@link RsApi.refreshView refreshView} instead.\n *\n * It is used to trigger a force refresh the data and re-fetch selections using apiContext.getSelectedRows api (if any of the selection mode is enabled) of repeating structures\n * @returns {void} void\n */\n forceRefresh: UtilityFunctions['forceRefresh'];\n }\n ) => void;\n\n /**\n * This api passes a unique identifier to apiContext to identify a repeating structure instance. This can be used to uniquely identify a RS instance in case of multiple RS instances.\n * @requireWhen Optional\n * @invokedWhen On Repeating structures mount to share current repeating structure instance identifier.\n * @param {string} rsID - A unique identifier\n * @returns {void} void\n */\n setRsID?: (rsID: string) => void;\n\n /**\n * This api is called to fetch all the personalizations for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen On Repeating structures mount to fetch all personalizations.\n * @returns {PersonalizationResponse} It should return all the personalizations.\n */\n fetchPersonalizations?: () => Promise<PersonalizationResponse>;\n\n /**\n * This api is called to update the personalization for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen End user deletes a personalization.\n * @param {string} personalizationKey - Unique identifier for the personalization.\n * @param personalization - The updated personalization state.\n * @returns {void} void\n */\n updatePersonalization?: (\n personalizationKey: string,\n personalization: {\n markAsDefault?: boolean;\n markAsAppDefault?: boolean;\n name?: string;\n personalizationState?: PersonalizedState;\n }\n ) => Promise<void>;\n\n /**\n * This api is called to delete the personalization for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen End user deletes a personalization.\n * @param personalizationKey - Unique identifier for a personalization.\n * @returns {void} void\n */\n deletePersonalization?: (personalizationKey: string) => Promise<void>;\n\n /**\n * This api is called to create the personalization for a repeating structure.\n * @requireWhen {@link Meta.personalization 'personalization'} key is set to true.\n * @invokedWhen End user create a new personalization.\n * @param {string} personalizationKey - Unique identifier for the personalization.\n * @param personalization - The personalization state to be saved\n * @returns {void} void\n */\n createPersonalization?: (\n personalizationKey: string,\n personalization: {\n markAsDefault: boolean;\n name: string;\n personalizationState: PersonalizedState;\n }\n ) => Promise<string> | Promise<{ data: string }>;\n\n /**\n * This api is used to communicate selectedRows in the repeating structures to the consumer.\n * @requireWhen {@link Meta.selectionMode 'selectionMode'} key is set to true.\n * @invokedWhen {@link Meta.selectionMode 'selectionMode'} key is set to true and whenever selection changes in RS.\n * @param {Array<RowData & { $selected: boolean }>} selectedRows The selectedRows that needs to be communicated.\n * @returns {Promise<void>} A promise\n */\n setSelectedRows?: (selectedRows: (RowData & { $selected: boolean })[]) => Promise<void>;\n\n /**\n * This api is used to get the selectedRows for the repeating structures from the consumer, to populate the selections in RS.\n * @requireWhen {@link Meta.selectionMode 'selectionMode'} key is set to true.\n * @invokedWhen {@link Meta.selectionMode 'selectionMode'} key is set to true and RS requires current selected rows from the consumer.\n * @returns {Promise<Array<string>>} A promise of type array of unique identifiers for all the row. It is value of {@link Meta.itemKey 'itemKey'}\n */\n getSelectedRows?: () => Promise<string[]>;\n\n /** This api is used to communicate the clearance of all the selectedRows for the repeating structures to the consumer.\n * This is also passed as callback to all the {@link BulkAction.onClick bulk actions 'onClick'} method with {@link ApiContext.fetchRowsData fetchRowsData} api.\n * @requireWhen {@link Meta.selectionMode 'selectionMode'} key is set to true.\n * @invokedWhen In case of {@link Meta.selectionMode \"multi\"} selection mode, while toggling all the selections OR\\\n * while switching personalizations OR\\\n * when the bulk action is submitted, this can be called by bulk actions {@link BulkAction.onClick 'onClick'} method by RS consumer.\n * @returns {Promise<void>} A promise\n */\n clearSelectedRows?: () => Promise<void>;\n\n /**\n * This api is used to fetch the hierarchical groups for an RS if {@link FieldDef.hierarchicalInfo 'hierarchicalInfo'} key is set to true for at least one FieldDef.\n * @requireWhen {@link FieldDef.hierarchicalInfo 'hierarchicalInfo'} key is set to true for at least one FieldDef\n * @invokedWhen Any change in filters, search criteria, hierarchichal groups, aggregations is detected in RS state or personalizations are toggled.\n * @param {State} rsState - Current repeating structures {@link State}.\n * @param {Meta} rsMeta - Repeating structures {@link Meta}.\n * @returns {HierarchicalGroupedInfo[]} - It should return a promise of type array of all the {@link HierarchicalGroupedInfo } for the specific field. It can also include nested hierarchical groups in children key.\n */\n fetchHierarchicalGroupedInfo?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions\n ) => Promise<HierarchicalGroupedInfo[]>;\n\n /**\n * This api is used to communicate repeating structure state to the consumer. It also includes visibleColumns apart from regular repeating structure state.\n * @requireWhen Optional\n * @invokedWhen After any action performed on Repeating structures that results in updating of state.\n * @param state Repeating structure state\n * @returns {void} void\n */\n stateUpdateCallback?: (state: PersonalizedState & { visibleColumns?: string[] }) => void;\n\n /**\n * This api is used to communicate repeating structure state to the consumer. It also includes active personalization in RS apart from regular repeating structure state.\n * @requireWhen Optional\n * @param state Repeating structure state\n * @returns {void} void\n */\n setComponentState?: (state: PersonalizedState & { activePersonalization?: string }) => void;\n /**\n * This api is used to communicate repeating structure state to RS from consumer.\n * @requireWhen Optional\n * @returns RS state.\n */\n getComponentState?: () => Promise<PersonalizedState & { activePersonalization?: string }>;\n /** This api is called on click of 'Import data' option in repeating structures toolbar and should open a modal to allow import of data from a CSV file.\n * @requireWhen {@link Meta.showImportDataOption showImportDataOption} is set to true in Meta.\n * @invokedWhen \"Import data\" button is clicked in the repeating structures toolbar\n * @param {ModalManagerContextValue['create']} create - The function to create a modal in the current context {@link ModalManagerContextValue['create']}.\n * @returns {void} void\n */\n importCSVData?: (create: ModalManagerContextValue['create']) => Promise<void>;\n /** This api is called on click of 'Export to excel' option in repeating structures toolbar and should export the data into a excel file.\n * @requireWhen {@link Meta.showExportToExcelOption showExportToExcelOption} is set to true in Meta.\n * @invokedWhen \"Export to excel\" button is clicked in the repeating structures toolbar\n * @param {State} rsState - Current repeating structures state {@link State}.\n * @param {Meta} rsMeta - Repeating structures meta {@link Meta}.\n * @returns {void} void\n */\n exportData?: (\n rsState: State,\n rsMeta: Meta,\n apiOptions: ApiOptions,\n renderFormatters?: Record<string, Column['formatterConfig']>\n ) => Promise<void>;\n\n /** This api is called on click of 'Export to CSV' option in repeating structures toolbar and should export the data into a CSV file.\n * @requireWhen {@link Meta.showExportToCSVOption showExportToCSVOption} is set to true in Meta.\n * @invokedWhen \"Export to CSV\" button is clicked in the repeating structures toolbar\n * @param {State} rsState - Current repeating structures state {@link State}.\n * @param {Meta} rsMeta - Repeating structures meta {@link Meta}.\n * @returns {void} void\n */\n exportDataToCSV?: (rsState: State, rsMeta: Meta, apiOptions: ApiOptions) => Promise<void>;\n\n /** This api is used to communicate source and destinaltion row keys to apiContext during row-reordering operation.\n * @requireWhen {@link Meta.reorderItems reorderItems} is set to true and {@link Meta.moveListRecords moveListRecords} is set to false in Meta.\n * @invokedWhen Reordering operations is being performed on rows.\n * @param {string} sourceKey - the value of {@link Meta.itemKey 'itemKey'} for the given row that user has selected to move.\n * @param {string} destinationKey - the value of {@link Meta.itemKey 'itemKey'} for the given row where the user has dropped the source row.\n * @returns {void} void\n */\n applyRowReorder?: (sourceKey: string, destinationKey: string) => Promise<void>;\n\n /**\n * This API allows Repeating Structures to determine if a given `data` meets a specified `condition`. It is utilized in the following features if provided:\n * - `Conditional Formatting` - Optional. If `evaluateCondition` is not provided, Repeating Structures will evaluate the row condition on their own. Otherwise, this function will be used.\n *\n * @param {State} rsState - The state of the Repeating Structures.\n * @param {Meta} rsMeta - The meta information of the Repeating Structures.\n * @param {ConditionConfig} config - The configuration for the condition.\n * @returns {Promise<boolean> | boolean} - Returns `true` if the data satisfies the condition, otherwise `false`.\n */\n evaluateCondition?: (rsState: State, rsMeta: Meta, config: ConditionConfig) => boolean;\n\n /**\n * This api is used to fetch unique values for a particular group additional field. It is generally called for a group additional field which has more than 1 value.\n * It should return unique values for the additional field along with hasMore flag to indicate if there are more values.\n * @param additionalField - The group additional field for which unique values needs to be fetched.\n * @param groupFilters - The current group filters on which the additional field is set.\n * @param rsState - The state of the Repeating Structures.\n * @param rsMeta - The meta information of the Repeating Structures.\n * @param options - Extra api options provided by repeating structures.\n * @returns GroupAdditionalFieldUniqueValues - It should return a promise of type {@link GroupAdditionalFieldUniqueValues}\n */\n fetchGroupAdditionalFieldUniqueValues?: (\n additionalField: GroupAdditionalField,\n groupFilters: GroupFilter['filters'],\n rsState: State,\n rsMeta: Meta,\n options?: ApiOptions\n ) => Promise<GroupAdditionalFieldUniqueValues>;\n\n /**\n * This API is invoked just before refreshing the data in repeating structures. The refresh in Repeating Structures can occur in two ways:\n * - Through the Refresh button in the Toolbar.\n * - By clicking the refresh notification dispatched via the NOTIFY_DATA_REFRESH action.\n * The implementation of this method should include clearing any caches maintained by the consumer to ensure that fresh data is fetched when the repeating structures refresh the data.\n * @requireWhen Optional\n * @invokedWhen Before Repeating Structures refresh the data.\n * @returns void\n *\n * @remarks\n * There is an alternative way for signaling the `ApiContext` to invalidate the cache is available.\n * - The `invalidateCache` or `invalidateCacheToken` boolean flag in {@link ApiOptions} indicates that the current API call should invalidate the cache, as it is triggered by the refresh of the Repeating Structures.\n * Consumers can choose to implement either of the two approaches to clear their caches. Prefer `onBeforeRefresh` when using a class-based API context with centralized cache invalidation; use api options for stateless or function-based APIs.\n */\n onBeforeRefresh?: () => void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-core",
|
|
3
|
-
"version": "9.0.0-build.28.
|
|
3
|
+
"version": "9.0.0-build.28.7",
|
|
4
4
|
"description": "Core headless UI library that the users can use to write their own UI and create repeating structures like table, gallery, timeline etc.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "9.0.0-build.28.
|
|
18
|
-
"@pega/cosmos-react-core": "9.0.0-build.28.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "9.0.0-build.28.7",
|
|
18
|
+
"@pega/cosmos-react-core": "9.0.0-build.28.7",
|
|
19
19
|
"@types/lodash-es": "^4.17.12",
|
|
20
20
|
"dayjs": "^1.11.13",
|
|
21
21
|
"fast-deep-equal": "^3.1.3",
|