@pega/lists-core 9.0.0-build.6.0 → 9.0.0-build.6.2
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.
|
@@ -470,9 +470,9 @@ export default function viewUtilityMethods(rsInternal) {
|
|
|
470
470
|
endIndex: getView().resultsCount - 1
|
|
471
471
|
}
|
|
472
472
|
},
|
|
473
|
-
// passing groups as
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
// passing groups and groupFilters as undefined to get all rows
|
|
474
|
+
groups: undefined,
|
|
475
|
+
groupFilters: undefined
|
|
476
476
|
}, getView().meta, {});
|
|
477
477
|
if (response) {
|
|
478
478
|
const { data = [] } = response;
|
|
@@ -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,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAqC1E,SAAS,QAAQ,CAAC,GAAW,EAAE,WAAsB,EAAE,aAAwB;IAC7E,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC5B,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,OAAO,KAAK,IAAI,IAAI,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,UAAsB;IAC/D,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;IAE3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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;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 } 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, 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 { DebugInfo, RefreshNotification, RequiredDefinition } 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};\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 * @returns\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.name === rowSelectColumnMeta.field.name\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\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 * 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 * 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 getRsStore().refreshInProgress = true;\n getRsStore().refreshToken = Date.now();\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 * @returns\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 /**\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 * @returns\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 as null to get all rows irrespective of groupfilters\n // @ts-expect-error Why groups is set to null? it should be set as undefined.\n groups: null\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 * @returns\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 * @returns\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 * @returns\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 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;AAC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AC,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,WAAW;YACT,OAAO,UAAU,EAAE;iBAChB,UAAU,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE;gBACvE,GAAG,CAAC,UAAU,EAAE,CAAC,iBAAiB,IAAI;oBACpC,eAAe,EAAE,IAAI;oBACrB,oBAAoB,EAAE,UAAU,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;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 } 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, 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 { DebugInfo, RefreshNotification, RequiredDefinition } 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};\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 * @returns\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.name === rowSelectColumnMeta.field.name\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\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 * 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 * 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 getRsStore().refreshInProgress = true;\n getRsStore().refreshToken = Date.now();\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 * @returns\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 /**\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 * @returns\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 * @returns\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 * @returns\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 * @returns\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 return utilMethods;\n}\nexport type UtilityFunctions = ReturnType<typeof viewUtilityMethods>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-core",
|
|
3
|
-
"version": "9.0.0-build.6.
|
|
3
|
+
"version": "9.0.0-build.6.2",
|
|
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,9 +14,9 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "9.0.0-build.6.
|
|
18
|
-
"@pega/cosmos-react-core": "9.0.0-build.6.
|
|
19
|
-
"@pega/cosmos-react-work": "9.0.0-build.6.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "9.0.0-build.6.2",
|
|
18
|
+
"@pega/cosmos-react-core": "9.0.0-build.6.2",
|
|
19
|
+
"@pega/cosmos-react-work": "9.0.0-build.6.2",
|
|
20
20
|
"@types/lodash.get": "^4.4.9",
|
|
21
21
|
"@types/uuid": "^9.0.0",
|
|
22
22
|
"dayjs": "^1.11.13",
|