@pega/lists-core 10.0.0-build.10.2 → 10.0.0-build.11.0
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/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/src/core/StateResolver.d.ts.map +1 -1
- package/lib/src/core/StateResolver.js +4 -0
- package/lib/src/core/StateResolver.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts +2 -2
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js +16 -2
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.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 +3 -13
- package/lib/src/core/generators/viewUtilityMethods.js.map +1 -1
- package/lib/src/core/reducers/personalizationReducer.d.ts.map +1 -1
- package/lib/src/core/reducers/personalizationReducer.js +5 -1
- package/lib/src/core/reducers/personalizationReducer.js.map +1 -1
- package/lib/types/ApiContext.types.d.ts +1 -2
- package/lib/types/ApiContext.types.d.ts.map +1 -1
- package/lib/types/ApiContext.types.js.map +1 -1
- package/lib/types/Meta.types.d.ts +30 -3
- package/lib/types/Meta.types.d.ts.map +1 -1
- package/lib/types/Meta.types.js +19 -0
- package/lib/types/Meta.types.js.map +1 -1
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { getMockColumn } from './src/core/test/junitMocks';
|
|
|
8
8
|
export { getGroupKey, getGroupFromKey } from './src/core/utils/util';
|
|
9
9
|
export { default as BaseA11y } from './src/core/a11y/BaseA11y';
|
|
10
10
|
export type { RsCoreTypes } from './types';
|
|
11
|
-
export { ROW_DENSITY, FieldType } from './types/Meta.types';
|
|
11
|
+
export { ROW_DENSITY, FieldType, PRESET_STATE_KEYS } from './types/Meta.types';
|
|
12
12
|
export { REPEATING_STRUCTURE_TEMPLATES, cellUpdateTrigger } from './types/Meta.types';
|
|
13
13
|
export { sanitizeConditionalStyleFormats } from './src/core/features/uIFeatures/beforeRender/stateSanitization';
|
|
14
14
|
export { rowSelectColumnMeta } from './src/core/constants';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEtF,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,eAAO,MACL,iBAAiB,qBACjB,wBAAwB,4BACxB,eAAe,oBACf,mBAAmB,uBACnB,wBAAwB,4BACxB,qBAAqB,wBACrB,oBAAoB,wBACpB,oBAAoB,sBACP,CAAC;AAEhB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA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AO,EAAE,+BAA+B,EAAE,MAAM,+DAA+D,CAAC;AAEhH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export const { UPDATE_DEBUG_INFO, TOGGLE_DISABLE_SELECTION, TOGGLE_REQUIRED, NOT
|
|
|
9
9
|
export { getMockColumn } from './src/core/test/junitMocks';
|
|
10
10
|
export { getGroupKey, getGroupFromKey } from './src/core/utils/util';
|
|
11
11
|
export { default as BaseA11y } from './src/core/a11y/BaseA11y';
|
|
12
|
-
export { ROW_DENSITY, FieldType } from './types/Meta.types';
|
|
12
|
+
export { ROW_DENSITY, FieldType, PRESET_STATE_KEYS } from './types/Meta.types';
|
|
13
13
|
export { REPEATING_STRUCTURE_TEMPLATES, cellUpdateTrigger } from './types/Meta.types';
|
|
14
14
|
export { sanitizeConditionalStyleFormats } from './src/core/features/uIFeatures/beforeRender/stateSanitization';
|
|
15
15
|
export { rowSelectColumnMeta } from './src/core/constants';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,+BAA+B;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEtF,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,iBAAiB,EACjB,qBA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ACpB,oBAAoB,EACrB,GAAG,WAAW,CAAC;AAEhB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+DAA+D,CAAC;AAEhH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["import ActionTypes from './src/core/actions/actionConstants';\n\nexport { default as initializeRsCore } from './src/core/index';\n\n// FIXME: revisit below exports\nexport { convertMetaIntoState } from './src/core/features/uIFeatures/beforeRender/stateHydration';\n\nexport { filterParams, typeMap, comparatorMap } from './src/core/config/filterConfig';\n\nexport {\n getVisibleFields,\n dateFunctionLabels,\n getScrollbarWidth,\n getScrollerElem,\n getRowContextData,\n getFilterInitializers,\n getFilterConditions,\n isFilterApplied,\n addFilter,\n getFilters,\n removeEmptyValues,\n isEmpty,\n normalizeMeta\n} from './src/core/utils/util';\n\nexport {\n ACTION_FIELD_TYPE,\n expandCollapseAllMeta,\n rowErrorColumnMeta,\n rowDragDropColumnMeta,\n rowDeleteColumnMeta\n} from './src/core/constants';\nexport const {\n UPDATE_DEBUG_INFO,\n TOGGLE_DISABLE_SELECTION,\n TOGGLE_REQUIRED,\n NOTIFY_DATA_REFRESH,\n USER_CONFIRMATION_ACTION,\n SET_IN_EXTERNAL_STATE,\n UPDATE_SELECTED_ROWS,\n SET_WARNING_MESSAGES\n} = ActionTypes;\n\nexport { getMockColumn } from './src/core/test/junitMocks';\nexport { getGroupKey, getGroupFromKey } from './src/core/utils/util';\n\nexport { default as BaseA11y } from './src/core/a11y/BaseA11y';\n\nexport type { RsCoreTypes } from './types';\n\nexport { ROW_DENSITY, FieldType, PRESET_STATE_KEYS } from './types/Meta.types';\n\nexport { REPEATING_STRUCTURE_TEMPLATES, cellUpdateTrigger } from './types/Meta.types';\n\nexport { sanitizeConditionalStyleFormats } from './src/core/features/uIFeatures/beforeRender/stateSanitization';\n\nexport { rowSelectColumnMeta } from './src/core/constants';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateResolver.d.ts","sourceRoot":"","sources":["../../../src/core/StateResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,EAAc,UAAU,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAgB9F,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,2BAA2B,CAAC;AAC7F,OAAO,KAAK,EAAoB,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGpF,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,KAAK,KAAK,CAAC;AAC9F,MAAM,MAAM,gBAAgB,GAAG,CAC7B,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,UAAU,KACzB,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChC,kCAAkC;AAClC,MAAM,CAAC,OAAO,OAAO,aAAa;;IAwChC,6CAA6C;IAC7C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;OAKG;gBAED,QAAQ,EAAE,eAAe,EACzB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"StateResolver.d.ts","sourceRoot":"","sources":["../../../src/core/StateResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA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|
|
57
|
+
// A late (e.g. debounced) dispatch on an unmounted instance must not report its stale state
|
|
58
|
+
// through an `apiContext` that a newer instance may now share.
|
|
59
|
+
if (!this.#rsInternal.getRsStore().isMounted)
|
|
60
|
+
return;
|
|
57
61
|
if (apiContext?.stateUpdateCallback) {
|
|
58
62
|
apiContext.stateUpdateCallback({
|
|
59
63
|
...pickProperties(this.getState(), personalizationProps)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateResolver.js","sourceRoot":"","sources":["../../../src/core/StateResolver.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EACL,sCAAsC,EACtC,8BAA8B,EAC9B,OAAO,EACP,uBAAuB,EACvB,mBAAmB,IAAI,0BAA0B,EACjD,aAAa,EACb,cAAc,EACd,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,WAAW,MAAM,2BAA2B,CAAC;AAapD,kCAAkC;AAClC,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,gDAAgD;IAChD,WAAW,CAAa;IAExB,0EAA0E;IAC1E,SAAS,CAAkB;IAE3B,8CAA8C;IAC9C,YAAY,CAAkE;IAE9E,yFAAyF;IACzF,iBAAiB,CAAmB;IAEpC,iEAAiE;IACjE,MAAM,CAAQ;IAEd,mFAAmF;IACnF,aAAa,CAAQ;IAErB,sDAAsD;IACtD,aAAa,CAAQ;IAErB,iDAAiD;IACjD,cAAc,CAAW;IAEzB,0CAA0C;IAC1C,4BAA4B,CAAW;IAEvC,kEAAkE;IAClE,iBAAiB,CAAwC;IAEzD,6FAA6F;IAC7F,cAAc,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE/C,gFAAgF;IAChF,qBAAqB,GAAG,KAAK,CAAC;IAE9B,kEAAkE;IAClE,gBAAgB,CAAmB;IAEnC,6CAA6C;IAC7C,mB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IAEH,OAAO,KAAK,EAAE,KAAY,EAAE,gBAA4B,EAAE,EAAE;QAC1D;;;;;WAKG;QACH,QAAQ,CAAC,IAAI,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,IAAK,CAAC;QAC/C,MAAM,YAAY,CAChB,CAAC,KAAK,EAAE,gBAAgB,CAAC,EACzB;YACE,KAAK,CAAC,gBAAgB;YACtB,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,iBAAiB;YACvB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,iBAAiB;YACvB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,cAAc;SACrB,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport type { State } from '../../types/State.types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ApiContext, ApiOptions, FetchDataResponse } from '../../types/ApiContext.types';\n\nimport { AFTER_FETCH, BEFORE_FETCH } from './pubSub/events';\nimport {\n clearProcessedActionsFromLatestActions,\n isSignificantPaginationOverlap,\n isEmpty,\n isFilterCriteriaChanged,\n isSameActionPresent as isSameActionPresentInQueue,\n isStaleAction,\n pickProperties,\n withMemoization\n} from './utils/util';\nimport { personalizationProps } from './reducers/personalizationReducer';\nimport ActionTypes from './actions/actionConstants';\nimport type { ActionType } from './actions/actionConstants';\nimport type RsInternal from './RsInternal';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { MiddleWareFeatureProps, UIFeatures, Feature } from './features/featureFactory';\nimport type { ActionAsFunction, BaseAction, Action } from './actions/actions.types';\nimport type RsProps from './RsProps';\n\nexport type ReducerFunction = (state: State, action: Action, rsInternal: RsInternal) => State;\nexport type FetchDataHandler = (\n state: State,\n fetchDataOptions: ApiOptions\n) => Promise<FetchDataResponse>;\n/** It manages state of RsCore. */\nexport default class StateResolver {\n /** A reference to {@link RsInternal} object. */\n #rsInternal: RsInternal;\n\n /** Reducer function to reduce RS Core actions to its respective state. */\n #reducers: ReducerFunction;\n\n /** A reference to beforeRender UI features */\n #middlewares?: (featureProps: MiddleWareFeatureProps) => Promise<void | null>;\n\n /** Handler to fetch and manage data using {@link ApiContext.fetchData fetchData} api. */\n #fetchDataHandler: FetchDataHandler;\n\n /** previously dispatched stable state excluding instant state */\n #state: State;\n\n /** Intermittent state generated based upon the processed actions from the queue */\n #currentState: State;\n\n /** State generated via actions with instantRender. */\n #instantState: State;\n\n /** Queue holding actions that are dispatched. */\n #queuedActions: Action[];\n\n /** Holds the action that is executed. */\n #previousExecutedActionQueue: Action[];\n\n /** It contains registered api's provided by consumer of RsCore */\n #externalStoreRef: NonNullable<RsProps['externalStore']>;\n\n /** Keep track of latest action of a type of that action is marked to ignore stale actions */\n #latestActions = new Map<ActionType, Action>();\n\n /** Indicates if an external dispatch to RS core consumer should ber skipped. */\n #skipExternalDispatch = false;\n\n /** Abort controller to abort the fetchData requests in transit */\n #abortController?: AbortController;\n\n /** Indicates if fetchData is in progress. */\n fetchDataInProgress?: boolean;\n\n /**\n * Create an instance of {@link StateResolver} class.\n * @param reducers Reducer function to reduce state for a given action\n * @param fetchDataHandler Fetch Data handler function to fetch the data of RSCore when required.\n * @param rsInternal Reference to {@link RsInternal} object.\n */\n constructor(\n reducers: ReducerFunction,\n fetchDataHandler: FetchDataHandler,\n rsInternal: RsInternal\n ) {\n this.#reducers = reducers;\n this.#fetchDataHandler = fetchDataHandler;\n this.#rsInternal = rsInternal;\n\n this.#externalStoreRef = rsInternal.getRsProps().externalStore!;\n\n this.#state = {};\n this.#currentState = {};\n this.#instantState = {};\n this.#queuedActions = [];\n this.#previousExecutedActionQueue = [];\n }\n\n /**\n * Executes {@link ApiContext.stateUpdateCallback stateUpdateCallback} and {@link ApiContext.setComponentState setComponentState} api with latest state.\n */\n #executePostStateUpdateCallbacks = () => {\n const { apiContext } = this.#rsInternal.getRsProps();\n if (apiContext?.stateUpdateCallback) {\n apiContext.stateUpdateCallback({\n ...pickProperties(this.getState(), personalizationProps)\n });\n }\n if (apiContext?.setComponentState && this.getState().personalization?.active) {\n apiContext.setComponentState({\n ...pickProperties(this.getState(), personalizationProps),\n activePersonalization: this.getState().personalization?.active\n });\n }\n };\n\n /**\n * Dispatches given {@link action} to update the RsCore {@link State state} based on the provided action type. Multiple actions are queued in the action queue.\n * It will further triggers various {@link UIFeatures features} and fetches data using {@link FetchDataHandler} according to the state changes.\n *\n * @param action - The action to be dispatched.\n */\n dispatch = (action: BaseAction): void => {\n if ('takeLatestAction' in action && action.takeLatestAction) {\n if (isSameActionPresentInQueue(action, this.#latestActions)) return;\n this.#latestActions.set(action.type, action);\n if (isSignificantPaginationOverlap(this.#latestActions, this.#previousExecutedActionQueue)) {\n this.#abortController?.abort();\n }\n }\n if (typeof action === 'function')\n return (action as ActionAsFunction)(\n this.dispatch,\n this.getState,\n this.#rsInternal.getView().meta,\n this.#rsInternal.getRsStore\n );\n if (!this.#queuedActions.length && !this.fetchDataInProgress) {\n // Don't do deep copy as we don't do deep comparison for arrays and objects in memoization in feature files\n this.#currentState = { ...this.#state };\n }\n\n if ('instantRender' in action && action.instantRender) {\n if (this.#rsInternal.getRsProps().mode === 'debug') {\n console.warn(\n 'Doing instant render. This might introduce performance issues. Check if this is really needed.'\n );\n }\n this.#instantState = this.#reducers(this.#instantState, action, this.#rsInternal);\n this.#rsInternal.getView().setProp({\n state: { ...this.getState(), ...this.#instantState },\n isInstantRender: true\n });\n this.#externalStoreRef.dispatch({\n ...this.#instantState\n });\n this.#executePostStateUpdateCallbacks();\n\n return;\n }\n if ('skipActionQueue' in action && action.skipActionQueue) {\n this.#currentState = this.#reducers(this.#currentState, action, this.#rsInternal);\n return;\n }\n\n this.#queuedActions.push(action);\n // We run next batch only after completing first batch, Fetch call should get completed.\n if (this.#queuedActions.length === 1 && !this.#previousExecutedActionQueue.length) {\n this.#runQueuedActions();\n }\n };\n\n /**\n * Returns the current state that is built using the {@link dispatch dispatched} action.\n */\n getState = () => {\n return Object.keys(this.#currentState).length > 0 ? this.#currentState : this.#state;\n };\n\n /**\n * Returns a snapshot of the previous stable state before the action queue starts executing via {@link dispatch}.\n */\n getOriginalState = () => {\n return this.#state;\n };\n\n /**\n * Sets a function to execute a set of {@link Feature features} before triggering a render.\n * The provided function will be called with the {@link MiddleWareFeatureProps featureProps}\n * @param middlewares - A function that executes a set of {@link Feature features} before rendering.\n */\n setMiddlewares = (\n middlewares: (featureProps: MiddleWareFeatureProps) => Promise<void | null>\n ) => {\n if (this.#middlewares) return;\n this.#middlewares = middlewares;\n };\n\n /**\n * Returns true if the lone queued FORCE_UPDATE action should be skipped (no-op optimization).\n */\n #skipForceUpdateAction = (): boolean => {\n if (this.#queuedActions.length !== 1) return false;\n const action = this.#queuedActions[0];\n if (action?.type !== ActionTypes.FORCE_UPDATE) return false;\n if (!('payload' in action)) return false;\n return !Object.keys(action.payload.forceUpdateFeatures ?? {}).length;\n };\n\n /** This will reduce the RsCore {@link State state} for a {@link StateResolver.dispatch dispatched} action .\n * Additionally it will also run middlewares, fetches latest data using {@link FetchDataHandler} and executes post state update callback with latest reduced state.\n */\n #runQueuedActions = async () => {\n const queuedAction = this.#queuedActions[0];\n if (queuedAction) {\n const skipStaleActionExecution =\n 'takeLatestAction' in queuedAction &&\n queuedAction.takeLatestAction &&\n isStaleAction(queuedAction, this.#latestActions);\n\n if (skipStaleActionExecution) {\n this.#queuedActions.shift();\n await this.#runQueuedActions();\n return;\n }\n\n this.#previousExecutedActionQueue.push(queuedAction);\n this.#currentState = this.#reducers(this.#currentState, queuedAction, this.#rsInternal);\n await this.#middlewares!({\n rsInternal: this.#rsInternal,\n getState: this.getState,\n getOriginalState: this.getOriginalState,\n dispatch: this.dispatch,\n queuedActions: [queuedAction]\n });\n this.#queuedActions.shift();\n await this.#runQueuedActions();\n } else if (this.#rsInternal.getRsStore().isMounted) {\n this.fetchDataInProgress = true;\n\n await this.#fetchData({\n ...this.#currentState,\n ...this.#instantState\n });\n\n // if the processed action and latest action has same payload, delete the latestAction as all the actions have been processed.\n clearProcessedActionsFromLatestActions(\n this.#latestActions,\n this.#previousExecutedActionQueue\n );\n\n // if data has been ignored, don't dispatch to view layer as the there is no change in rows\n if (!this.#skipExternalDispatch) {\n await this.#externalStoreRef.dispatch({\n ...this.#currentState\n });\n }\n this.#skipExternalDispatch = false;\n this.fetchDataInProgress = false;\n this.#previousExecutedActionQueue = [];\n\n // this happens in cases of dispatches like query info. In that case, the props have been set on view directly and the dispatch has already happened\n // This will prevent unnecessary renders in case of server side table\n\n // Avoid skipping FORCE_UPDATE action in case feature has triggered it and is relying on forceUpdatedFeatures slice of state.\n // forceUpdateFeatures slice is generally used by features when they are not able to perform their task if the rendering cycle is not complete.\n // For eg.renderHeader and autosize feature set forceRenderOnNextRun and forceCalculateAutoWidth in this slice so that they will get executed after the existing rendering cycle is complete and the rows are rendered on DOM.\n // If we skip these types of FORCE_UPDATE action then the corresponding features execution will also be skipped.\n if (this.#skipForceUpdateAction()) {\n this.#queuedActions.shift();\n }\n if (this.#queuedActions.length) {\n this.#runQueuedActions();\n } else {\n this.#state = { ...this.#currentState };\n this.#currentState = {};\n this.#executePostStateUpdateCallbacks();\n }\n }\n };\n\n /**\n * Calls the {@link FetchDataHandler fetchDataHandler} and updates the latest data in the {@link View}\n * @param latestState - Current state.\n */\n #fetchData = async (latestState: State) => {\n this.#abortController = new AbortController();\n const signal = this.#abortController.signal;\n this.#rsInternal.getPubSubUtils().publish(BEFORE_FETCH);\n\n const derivedState = {\n ...latestState,\n groupFilters: this.#rsInternal.getRsStore().groupFilters\n };\n // TODO: No need to fetch data if all the groups are collapsed.\n const res = await this.#fetchDataHandler(derivedState, {\n signal,\n ...(this.#rsInternal.getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: this.#rsInternal.getRsStore().refreshToken\n })\n });\n if (res) {\n const { totalRecordCount, filteredRecordCount, data = [] } = res;\n\n if (!isEmpty(totalRecordCount) || !isEmpty(filteredRecordCount)) {\n this.#rsInternal.getView().setProp({\n resultsCount: totalRecordCount || filteredRecordCount,\n countGeneratedInternally: false,\n showCount: true\n });\n }\n\n if (isSignificantPaginationOverlap(this.#latestActions, this.#previousExecutedActionQueue)) {\n this.#skipExternalDispatch = true;\n } else {\n this.#rsInternal.getView().setProp({\n data,\n isCountUpdateRequired:\n isFilterCriteriaChanged(this.#rsInternal.getRsStore().meta, this.#state, latestState) ||\n latestState.refresh !== this.#state.refresh\n });\n }\n }\n\n this.#rsInternal.getPubSubUtils().publish(AFTER_FETCH);\n this.#rsInternal.getView().setProp({ state: latestState, isInstantRender: false });\n };\n}\n\n/** Initializes handler for {@link ApiContext.fetchData fetchData} api. */\nexport function initializeFetchDataHandler(rsCoreInternal: RsInternal) {\n let response = {} as FetchDataResponse;\n const fetchWrapper = withMemoization(async ([state, fetchDataOptions]: [State, ApiOptions]) => {\n try {\n response = await rsCoreInternal\n .getRsProps()\n .apiContext.fetchData(state, rsCoreInternal.getRsStore().meta, fetchDataOptions);\n } catch (err: any) {\n if (!['AbortError', 'CanceledError'].includes(err.name)) {\n console.error('API call failed', err);\n }\n }\n });\n\n return async (state: State, fetchDataOptions: ApiOptions) => {\n /**\n * Returning default data from getView() in case the actual apiContext.getData() doesn't get called.\n *\n * BUG-811621: in case of bulk actions and inline edit, the updated rows come from separate apiContext APIs\n * and the memo of below function won't break, so, it will give stale data. Using getView().data as the default fallback for such cases.\n */\n response.data = rsCoreInternal.getView().data!;\n await fetchWrapper(\n [state, fetchDataOptions],\n [\n state.filterExpression,\n state.search,\n state.paginationOptions,\n state.sortingOrder,\n state.refresh,\n state.groups,\n state.hierarchicalGroup,\n state.groupFilters,\n state.visibleColumns\n ]\n );\n return response;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StateResolver.js","sourceRoot":"","sources":["../../../src/core/StateResolver.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,M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YACvB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,iBAAiB;YACvB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,cAAc;SACrB,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport type { State } from '../../types/State.types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ApiContext, ApiOptions, FetchDataResponse } from '../../types/ApiContext.types';\n\nimport { AFTER_FETCH, BEFORE_FETCH } from './pubSub/events';\nimport {\n clearProcessedActionsFromLatestActions,\n isSignificantPaginationOverlap,\n isEmpty,\n isFilterCriteriaChanged,\n isSameActionPresent as isSameActionPresentInQueue,\n isStaleAction,\n pickProperties,\n withMemoization\n} from './utils/util';\nimport { personalizationProps } from './reducers/personalizationReducer';\nimport ActionTypes from './actions/actionConstants';\nimport type { ActionType } from './actions/actionConstants';\nimport type RsInternal from './RsInternal';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { MiddleWareFeatureProps, UIFeatures, Feature } from './features/featureFactory';\nimport type { ActionAsFunction, BaseAction, Action } from './actions/actions.types';\nimport type RsProps from './RsProps';\n\nexport type ReducerFunction = (state: State, action: Action, rsInternal: RsInternal) => State;\nexport type FetchDataHandler = (\n state: State,\n fetchDataOptions: ApiOptions\n) => Promise<FetchDataResponse>;\n/** It manages state of RsCore. */\nexport default class StateResolver {\n /** A reference to {@link RsInternal} object. */\n #rsInternal: RsInternal;\n\n /** Reducer function to reduce RS Core actions to its respective state. */\n #reducers: ReducerFunction;\n\n /** A reference to beforeRender UI features */\n #middlewares?: (featureProps: MiddleWareFeatureProps) => Promise<void | null>;\n\n /** Handler to fetch and manage data using {@link ApiContext.fetchData fetchData} api. */\n #fetchDataHandler: FetchDataHandler;\n\n /** previously dispatched stable state excluding instant state */\n #state: State;\n\n /** Intermittent state generated based upon the processed actions from the queue */\n #currentState: State;\n\n /** State generated via actions with instantRender. */\n #instantState: State;\n\n /** Queue holding actions that are dispatched. */\n #queuedActions: Action[];\n\n /** Holds the action that is executed. */\n #previousExecutedActionQueue: Action[];\n\n /** It contains registered api's provided by consumer of RsCore */\n #externalStoreRef: NonNullable<RsProps['externalStore']>;\n\n /** Keep track of latest action of a type of that action is marked to ignore stale actions */\n #latestActions = new Map<ActionType, Action>();\n\n /** Indicates if an external dispatch to RS core consumer should ber skipped. */\n #skipExternalDispatch = false;\n\n /** Abort controller to abort the fetchData requests in transit */\n #abortController?: AbortController;\n\n /** Indicates if fetchData is in progress. */\n fetchDataInProgress?: boolean;\n\n /**\n * Create an instance of {@link StateResolver} class.\n * @param reducers Reducer function to reduce state for a given action\n * @param fetchDataHandler Fetch Data handler function to fetch the data of RSCore when required.\n * @param rsInternal Reference to {@link RsInternal} object.\n */\n constructor(\n reducers: ReducerFunction,\n fetchDataHandler: FetchDataHandler,\n rsInternal: RsInternal\n ) {\n this.#reducers = reducers;\n this.#fetchDataHandler = fetchDataHandler;\n this.#rsInternal = rsInternal;\n\n this.#externalStoreRef = rsInternal.getRsProps().externalStore!;\n\n this.#state = {};\n this.#currentState = {};\n this.#instantState = {};\n this.#queuedActions = [];\n this.#previousExecutedActionQueue = [];\n }\n\n /**\n * Executes {@link ApiContext.stateUpdateCallback stateUpdateCallback} and {@link ApiContext.setComponentState setComponentState} api with latest state.\n */\n #executePostStateUpdateCallbacks = () => {\n const { apiContext } = this.#rsInternal.getRsProps();\n // A late (e.g. debounced) dispatch on an unmounted instance must not report its stale state\n // through an `apiContext` that a newer instance may now share.\n if (!this.#rsInternal.getRsStore().isMounted) return;\n if (apiContext?.stateUpdateCallback) {\n apiContext.stateUpdateCallback({\n ...pickProperties(this.getState(), personalizationProps)\n });\n }\n if (apiContext?.setComponentState && this.getState().personalization?.active) {\n apiContext.setComponentState({\n ...pickProperties(this.getState(), personalizationProps),\n activePersonalization: this.getState().personalization?.active\n });\n }\n };\n\n /**\n * Dispatches given {@link action} to update the RsCore {@link State state} based on the provided action type. Multiple actions are queued in the action queue.\n * It will further triggers various {@link UIFeatures features} and fetches data using {@link FetchDataHandler} according to the state changes.\n *\n * @param action - The action to be dispatched.\n */\n dispatch = (action: BaseAction): void => {\n if ('takeLatestAction' in action && action.takeLatestAction) {\n if (isSameActionPresentInQueue(action, this.#latestActions)) return;\n this.#latestActions.set(action.type, action);\n if (isSignificantPaginationOverlap(this.#latestActions, this.#previousExecutedActionQueue)) {\n this.#abortController?.abort();\n }\n }\n if (typeof action === 'function')\n return (action as ActionAsFunction)(\n this.dispatch,\n this.getState,\n this.#rsInternal.getView().meta,\n this.#rsInternal.getRsStore\n );\n if (!this.#queuedActions.length && !this.fetchDataInProgress) {\n // Don't do deep copy as we don't do deep comparison for arrays and objects in memoization in feature files\n this.#currentState = { ...this.#state };\n }\n\n if ('instantRender' in action && action.instantRender) {\n if (this.#rsInternal.getRsProps().mode === 'debug') {\n console.warn(\n 'Doing instant render. This might introduce performance issues. Check if this is really needed.'\n );\n }\n this.#instantState = this.#reducers(this.#instantState, action, this.#rsInternal);\n this.#rsInternal.getView().setProp({\n state: { ...this.getState(), ...this.#instantState },\n isInstantRender: true\n });\n this.#externalStoreRef.dispatch({\n ...this.#instantState\n });\n this.#executePostStateUpdateCallbacks();\n\n return;\n }\n if ('skipActionQueue' in action && action.skipActionQueue) {\n this.#currentState = this.#reducers(this.#currentState, action, this.#rsInternal);\n return;\n }\n\n this.#queuedActions.push(action);\n // We run next batch only after completing first batch, Fetch call should get completed.\n if (this.#queuedActions.length === 1 && !this.#previousExecutedActionQueue.length) {\n this.#runQueuedActions();\n }\n };\n\n /**\n * Returns the current state that is built using the {@link dispatch dispatched} action.\n */\n getState = () => {\n return Object.keys(this.#currentState).length > 0 ? this.#currentState : this.#state;\n };\n\n /**\n * Returns a snapshot of the previous stable state before the action queue starts executing via {@link dispatch}.\n */\n getOriginalState = () => {\n return this.#state;\n };\n\n /**\n * Sets a function to execute a set of {@link Feature features} before triggering a render.\n * The provided function will be called with the {@link MiddleWareFeatureProps featureProps}\n * @param middlewares - A function that executes a set of {@link Feature features} before rendering.\n */\n setMiddlewares = (\n middlewares: (featureProps: MiddleWareFeatureProps) => Promise<void | null>\n ) => {\n if (this.#middlewares) return;\n this.#middlewares = middlewares;\n };\n\n /**\n * Returns true if the lone queued FORCE_UPDATE action should be skipped (no-op optimization).\n */\n #skipForceUpdateAction = (): boolean => {\n if (this.#queuedActions.length !== 1) return false;\n const action = this.#queuedActions[0];\n if (action?.type !== ActionTypes.FORCE_UPDATE) return false;\n if (!('payload' in action)) return false;\n return !Object.keys(action.payload.forceUpdateFeatures ?? {}).length;\n };\n\n /** This will reduce the RsCore {@link State state} for a {@link StateResolver.dispatch dispatched} action .\n * Additionally it will also run middlewares, fetches latest data using {@link FetchDataHandler} and executes post state update callback with latest reduced state.\n */\n #runQueuedActions = async () => {\n const queuedAction = this.#queuedActions[0];\n if (queuedAction) {\n const skipStaleActionExecution =\n 'takeLatestAction' in queuedAction &&\n queuedAction.takeLatestAction &&\n isStaleAction(queuedAction, this.#latestActions);\n\n if (skipStaleActionExecution) {\n this.#queuedActions.shift();\n await this.#runQueuedActions();\n return;\n }\n\n this.#previousExecutedActionQueue.push(queuedAction);\n this.#currentState = this.#reducers(this.#currentState, queuedAction, this.#rsInternal);\n await this.#middlewares!({\n rsInternal: this.#rsInternal,\n getState: this.getState,\n getOriginalState: this.getOriginalState,\n dispatch: this.dispatch,\n queuedActions: [queuedAction]\n });\n this.#queuedActions.shift();\n await this.#runQueuedActions();\n } else if (this.#rsInternal.getRsStore().isMounted) {\n this.fetchDataInProgress = true;\n\n await this.#fetchData({\n ...this.#currentState,\n ...this.#instantState\n });\n\n // if the processed action and latest action has same payload, delete the latestAction as all the actions have been processed.\n clearProcessedActionsFromLatestActions(\n this.#latestActions,\n this.#previousExecutedActionQueue\n );\n\n // if data has been ignored, don't dispatch to view layer as the there is no change in rows\n if (!this.#skipExternalDispatch) {\n await this.#externalStoreRef.dispatch({\n ...this.#currentState\n });\n }\n this.#skipExternalDispatch = false;\n this.fetchDataInProgress = false;\n this.#previousExecutedActionQueue = [];\n\n // this happens in cases of dispatches like query info. In that case, the props have been set on view directly and the dispatch has already happened\n // This will prevent unnecessary renders in case of server side table\n\n // Avoid skipping FORCE_UPDATE action in case feature has triggered it and is relying on forceUpdatedFeatures slice of state.\n // forceUpdateFeatures slice is generally used by features when they are not able to perform their task if the rendering cycle is not complete.\n // For eg.renderHeader and autosize feature set forceRenderOnNextRun and forceCalculateAutoWidth in this slice so that they will get executed after the existing rendering cycle is complete and the rows are rendered on DOM.\n // If we skip these types of FORCE_UPDATE action then the corresponding features execution will also be skipped.\n if (this.#skipForceUpdateAction()) {\n this.#queuedActions.shift();\n }\n if (this.#queuedActions.length) {\n this.#runQueuedActions();\n } else {\n this.#state = { ...this.#currentState };\n this.#currentState = {};\n this.#executePostStateUpdateCallbacks();\n }\n }\n };\n\n /**\n * Calls the {@link FetchDataHandler fetchDataHandler} and updates the latest data in the {@link View}\n * @param latestState - Current state.\n */\n #fetchData = async (latestState: State) => {\n this.#abortController = new AbortController();\n const signal = this.#abortController.signal;\n this.#rsInternal.getPubSubUtils().publish(BEFORE_FETCH);\n\n const derivedState = {\n ...latestState,\n groupFilters: this.#rsInternal.getRsStore().groupFilters\n };\n // TODO: No need to fetch data if all the groups are collapsed.\n const res = await this.#fetchDataHandler(derivedState, {\n signal,\n ...(this.#rsInternal.getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: this.#rsInternal.getRsStore().refreshToken\n })\n });\n if (res) {\n const { totalRecordCount, filteredRecordCount, data = [] } = res;\n\n if (!isEmpty(totalRecordCount) || !isEmpty(filteredRecordCount)) {\n this.#rsInternal.getView().setProp({\n resultsCount: totalRecordCount || filteredRecordCount,\n countGeneratedInternally: false,\n showCount: true\n });\n }\n\n if (isSignificantPaginationOverlap(this.#latestActions, this.#previousExecutedActionQueue)) {\n this.#skipExternalDispatch = true;\n } else {\n this.#rsInternal.getView().setProp({\n data,\n isCountUpdateRequired:\n isFilterCriteriaChanged(this.#rsInternal.getRsStore().meta, this.#state, latestState) ||\n latestState.refresh !== this.#state.refresh\n });\n }\n }\n\n this.#rsInternal.getPubSubUtils().publish(AFTER_FETCH);\n this.#rsInternal.getView().setProp({ state: latestState, isInstantRender: false });\n };\n}\n\n/** Initializes handler for {@link ApiContext.fetchData fetchData} api. */\nexport function initializeFetchDataHandler(rsCoreInternal: RsInternal) {\n let response = {} as FetchDataResponse;\n const fetchWrapper = withMemoization(async ([state, fetchDataOptions]: [State, ApiOptions]) => {\n try {\n response = await rsCoreInternal\n .getRsProps()\n .apiContext.fetchData(state, rsCoreInternal.getRsStore().meta, fetchDataOptions);\n } catch (err: any) {\n if (!['AbortError', 'CanceledError'].includes(err.name)) {\n console.error('API call failed', err);\n }\n }\n });\n\n return async (state: State, fetchDataOptions: ApiOptions) => {\n /**\n * Returning default data from getView() in case the actual apiContext.getData() doesn't get called.\n *\n * BUG-811621: in case of bulk actions and inline edit, the updated rows come from separate apiContext APIs\n * and the memo of below function won't break, so, it will give stale data. Using getView().data as the default fallback for such cases.\n */\n response.data = rsCoreInternal.getView().data!;\n await fetchWrapper(\n [state, fetchDataOptions],\n [\n state.filterExpression,\n state.search,\n state.paginationOptions,\n state.sortingOrder,\n state.refresh,\n state.groups,\n state.hierarchicalGroup,\n state.groupFilters,\n state.visibleColumns\n ]\n );\n return response;\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BeforeRenderFeatureProps } from '../../featureFactory';
|
|
2
|
-
import type
|
|
2
|
+
import { type Meta } from '../../../../../types/Meta.types';
|
|
3
3
|
import type { State } from '../../../../../types/State.types';
|
|
4
4
|
/**
|
|
5
5
|
* Returns visible OOTB column IDs.
|
|
@@ -24,7 +24,7 @@ export declare function convertMetaIntoState(meta: Meta): State;
|
|
|
24
24
|
* 1. {@link RsProps.persistedInfo}
|
|
25
25
|
* 2. Component state from {@link ApiContext.getComponentState}
|
|
26
26
|
* 3. Personalized state from the preset
|
|
27
|
-
* 4. {@link Meta}
|
|
27
|
+
* 4. {@link Meta} (including {@link Meta.presetState})
|
|
28
28
|
*/
|
|
29
29
|
declare const _default: () => (featureProps: BeforeRenderFeatureProps) => void;
|
|
30
30
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateHydration.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/stateHydration.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"stateHydration.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/stateHydration.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAqB,KAAK,IAAI,EAAoB,MAAM,iCAAiC,CAAC;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAO9D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAU1D;AACD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAuB/E;AAaD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CA4FtD;AA+ED;;;;;;GAMG;+BAKuB,cAAc,wBAAwB;AAJhE,wBAQE"}
|
|
@@ -2,6 +2,7 @@ import { actionHydrateState } from '../../../actions/actions';
|
|
|
2
2
|
import { withMemoization, pickProperties, isEmpty, isRowDeleteFieldVisible, isRowSelectFieldEnabled, getVisibleColumnsFromHidden, getVisibleColumnsFromFieldDefs, isRowReorderFieldVisible, isRowErrorFieldVisible, isRowActionFieldEnabled } from '../../../utils/util';
|
|
3
3
|
import { personalizationProps } from '../../../reducers/personalizationReducer';
|
|
4
4
|
import { rowActionColumnMeta, rowDeleteColumnMeta, rowDragDropColumnMeta, rowErrorColumnMeta, rowSelectColumnMeta, TEMPLATES } from '../../../constants';
|
|
5
|
+
import { PRESET_STATE_KEYS } from '../../../../../types/Meta.types';
|
|
5
6
|
import { getCurrentVersionedState } from '../../../reducers/versioning';
|
|
6
7
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
7
8
|
/**
|
|
@@ -49,6 +50,18 @@ export function hydrateVisibleColumnsStateSlice(meta, state) {
|
|
|
49
50
|
visibleColumns
|
|
50
51
|
};
|
|
51
52
|
}
|
|
53
|
+
// Runtime whitelist: type checks alone don't stop JS consumers or intermediate values from
|
|
54
|
+
// passing keys (e.g. `template`) that must stay controlled by meta. Undefined values are skipped.
|
|
55
|
+
const pickPresetState = (presetState) => {
|
|
56
|
+
const picked = {};
|
|
57
|
+
if (!presetState)
|
|
58
|
+
return picked;
|
|
59
|
+
PRESET_STATE_KEYS.forEach(key => {
|
|
60
|
+
if (presetState[key] !== undefined)
|
|
61
|
+
Object.assign(picked, { [key]: presetState[key] });
|
|
62
|
+
});
|
|
63
|
+
return picked;
|
|
64
|
+
};
|
|
52
65
|
/**
|
|
53
66
|
* Converts given meta into the state structure.
|
|
54
67
|
*/
|
|
@@ -132,7 +145,8 @@ export function convertMetaIntoState(meta) {
|
|
|
132
145
|
showHeaderIcons,
|
|
133
146
|
selectedHeightOption,
|
|
134
147
|
conditionalStyleFormats,
|
|
135
|
-
visibleColumns
|
|
148
|
+
visibleColumns,
|
|
149
|
+
...pickPresetState(meta.presetState)
|
|
136
150
|
};
|
|
137
151
|
}
|
|
138
152
|
const hydrateComponentState = async ([{ getRsProps, getRsStore, dispatch, getState, getView }]) => {
|
|
@@ -204,7 +218,7 @@ const hydrate = ([{ getRsStore, getRsProps, getView, dispatch, getState }]) => {
|
|
|
204
218
|
* 1. {@link RsProps.persistedInfo}
|
|
205
219
|
* 2. Component state from {@link ApiContext.getComponentState}
|
|
206
220
|
* 3. Personalized state from the preset
|
|
207
|
-
* 4. {@link Meta}
|
|
221
|
+
* 4. {@link Meta} (including {@link Meta.presetState})
|
|
208
222
|
*/
|
|
209
223
|
export default () => {
|
|
210
224
|
const memoizedHydrateComponentState = withMemoization(hydrateComponentState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateHydration.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/stateHydration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,cAAc,EACd,OAAO,EACP,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACV,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,qDAAqD;AAErD;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAU;IAC9C,MAAM,WAAW,GAAG;QAClB,EAAE,OAAO,EAAE,sBAAsB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;QAC1E,EAAE,OAAO,EAAE,wBAAwB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAE,EAAE;QAC/E,EAAE,OAAO,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,mBAAmB,CAAC,KAAK,CAAC,EAAE,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AAE,CAAC;QAC3C,0EAA0E;QAC1E,aAAa,GAAG;YACd,QAAQ,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ;YACjC,QAAQ,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE;YAC3B,GAAG,oBAAoB,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;SACxC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,GAAG,wBAAwB,CACtC,+BAA+B,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAC/D,CAAC;IACF,OAAO,QAAQ,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,6BAA6B,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC7E,MAAM,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEjD,OAAO,SAAS,OAAO,CAAC,YAAsC;QAC5D,6BAA6B,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,eAAe,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { actionHydrateState } from '../../../actions/actions';\nimport {\n withMemoization,\n pickProperties,\n isEmpty,\n isRowDeleteFieldVisible,\n isRowSelectFieldEnabled,\n getVisibleColumnsFromHidden,\n getVisibleColumnsFromFieldDefs,\n isRowReorderFieldVisible,\n isRowErrorFieldVisible,\n isRowActionFieldEnabled\n} from '../../../utils/util';\nimport { personalizationProps } from '../../../reducers/personalizationReducer';\nimport {\n rowActionColumnMeta,\n rowDeleteColumnMeta,\n rowDragDropColumnMeta,\n rowErrorColumnMeta,\n rowSelectColumnMeta,\n TEMPLATES\n} from '../../../constants';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport type { Meta } from '../../../../../types/Meta.types';\nimport type { State } from '../../../../../types/State.types';\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type RsProps from '../../../RsProps';\nimport type { ApiContext } from '../../../../../types/ApiContext.types';\nimport { getCurrentVersionedState } from '../../../reducers/versioning';\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/**\n * Returns visible OOTB column IDs.\n *\n * @param meta - View meta containing field configuration.\n * @returns Array of visible OOTB column IDs.\n */\nexport function getVisibleOotbColumns(meta: Meta): string[] {\n const ootbColumns = [\n { enabled: isRowErrorFieldVisible(meta), id: rowErrorColumnMeta.field.id },\n { enabled: isRowReorderFieldVisible(meta), id: rowDragDropColumnMeta.field.id },\n { enabled: isRowSelectFieldEnabled(meta), id: rowSelectColumnMeta.field.id },\n { enabled: isRowActionFieldEnabled(meta), id: rowActionColumnMeta.field.id },\n { enabled: isRowDeleteFieldVisible(meta), id: rowDeleteColumnMeta.field.id }\n ] as const;\n\n return ootbColumns.filter(({ enabled }) => enabled).map(({ id }) => id);\n}\n/**\n * Resolves `visibleColumns` from state and appends enabled OOTB columns.\n *\n * @param meta - View meta containing fieldDefs and OOTB field config.\n * @param state - Current state to hydrate into.\n */\nexport function hydrateVisibleColumnsStateSlice(meta: Meta, state: State): State {\n let visibleColumns: string[];\n\n if (state.visibleColumns !== undefined) {\n // Use explicitly saved visibleColumns as-is.\n visibleColumns = [...state.visibleColumns];\n } else if (state.hiddenColumns !== undefined) {\n // Derive visibleColumns from fieldDefs minus hiddenColumns.\n visibleColumns = getVisibleColumnsFromHidden(meta, state.hiddenColumns);\n } else {\n // Fall back to fieldDefs where show is true.\n visibleColumns = getVisibleColumnsFromFieldDefs(meta);\n }\n\n // Append enabled OOTB columns that are not hidden.\n const ootbColumnIds = getVisibleOotbColumns(meta);\n visibleColumns.push(...ootbColumnIds);\n\n // TODO OOTB columns should not be part of the state.\n return {\n ...state,\n visibleColumns\n };\n}\n\n/**\n * Converts given meta into the state structure.\n */\nexport function convertMetaIntoState(meta: Meta): State {\n const sortingOrder: State['sortingOrder'] = [];\n const hiddenColumns: State['hiddenColumns'] = [];\n const visibleColumns: State['visibleColumns'] = [];\n let groups: NonNullable<State['groups']> = [];\n const aggregationInfo: State['aggregationInfo'] = [];\n const conditionalStyleFormats: State['conditionalStyleFormats'] = [];\n const { filterExpression, showHeaderIcons, defaultRowHeight } = meta;\n\n // default RowHeight as short\n // update selectedHeightOption if defaultRowHeight is set in meta\n const selectedHeightOption = meta.template === TEMPLATES.TABLE ? defaultRowHeight : undefined;\n\n // hydrate state with meta.fieldDefs\n meta.fieldDefs.forEach(fieldDef => {\n // hydrating sorting\n if (fieldDef.sort && fieldDef.sortPriority && fieldDef.sortDirection)\n sortingOrder.push({\n columnId: fieldDef.id,\n order: fieldDef.sortDirection,\n sequence: fieldDef.sortPriority\n });\n\n // hydrating column visibility\n // TODO: when hiddenColumns is deprecated removed it.\n if (!fieldDef.show) hiddenColumns.push(fieldDef.id);\n\n // hydrating visible columns\n if (fieldDef.show) visibleColumns.push(fieldDef.id);\n\n // hydrating aggregated Fields\n if (fieldDef.aggregated && (fieldDef.type === 'number' || fieldDef.type === 'currency')) {\n const aggregationType = meta.aggregateOptions?.[fieldDef.type]?.[0];\n\n if (aggregationType) {\n aggregationInfo.push({\n columnId: fieldDef.id,\n type: aggregationType\n });\n }\n }\n\n // hydrating grouping\n // consider sort direction of column for group order if its provided otherwise default to ascending.\n if (meta.grouping && fieldDef.grouping && fieldDef.grouped) {\n const level = fieldDef.groupOrder ?? groups.length;\n let order: NonNullable<State['groups']>[number]['order'] = 'asc';\n if (fieldDef.customGrouping) {\n order = 'custom';\n } else if (fieldDef.sort && fieldDef.sortDirection) {\n order = fieldDef.sortDirection;\n }\n groups.splice(level, 0, {\n columnId: fieldDef.id,\n order,\n level,\n dateFunction: fieldDef.groupedDateFunction,\n additionalFields: fieldDef.groupedAdditionalFields,\n customFunction: fieldDef.customGrouping\n });\n }\n\n if (fieldDef.conditionalStyleFormats) {\n conditionalStyleFormats.push(\n ...fieldDef.conditionalStyleFormats.map(conditionalStyleFormat => ({\n ...conditionalStyleFormat,\n fieldName: fieldDef.name\n }))\n );\n }\n });\n\n // BUG-752261 Maintaining sort sequence in state\n sortingOrder.sort((col1, col2) => col1.sequence - col2.sequence);\n\n if (meta.grouping === undefined) groups = [];\n\n return {\n ...(meta.template === TEMPLATES.GALLERY && {\n galleryLayout: meta.galleryConfig?.layout\n }),\n sortingOrder,\n hiddenColumns,\n groups,\n aggregationInfo,\n filterExpression,\n showHeaderIcons,\n selectedHeightOption,\n conditionalStyleFormats,\n visibleColumns\n };\n}\n\nconst hydrateComponentState = async ([{ getRsProps, getRsStore, dispatch, getState, getView }]: [\n featureProps: BeforeRenderFeatureProps\n]) => {\n let componentState;\n const rsProps = getRsProps();\n const rsStore = getRsStore();\n rsStore.componentState = null;\n if (rsProps?.apiContext?.getComponentState) {\n componentState = await rsProps?.apiContext?.getComponentState();\n }\n const { personalization } = getState();\n // if client set component state somewhere for persisting changes\n if (\n componentState &&\n Object.keys(componentState).length &&\n personalization &&\n componentState.activePersonalization\n ) {\n rsStore.componentState = componentState;\n const activeComponentState = pickProperties(componentState, personalizationProps);\n let hydratedState: State = {\n personalization: {\n ...personalization,\n active: componentState.activePersonalization\n },\n ...activeComponentState\n };\n\n // Resolve visible columns then apply OOTB column visibility.\n hydratedState = hydrateVisibleColumnsStateSlice(getView().meta, hydratedState);\n dispatch(actionHydrateState(hydratedState));\n }\n};\n\n// Todo: onLoad sorting, filterBy, GroupBy, Freeze, HiddenColumn,\n// the structure in meta and hydration of state from it\nconst hydrate = ([{ getRsStore, getRsProps, getView, dispatch, getState }]: [\n featureProps: BeforeRenderFeatureProps\n]) => {\n const state = getState();\n const rsStore = getRsStore();\n const rsProps = getRsProps();\n const activePersonalization =\n state.personalization?.allPersonalizations?.[state.personalization?.active];\n\n let hydratedState: State = {};\n\n if (rsProps.persistedInfo && rsStore.presets[0].id === state.personalization?.active) {\n // Hydrate from persisted info.\n hydratedState = rsProps.persistedInfo;\n } else if (rsStore.componentState) {\n // Component state already applied by hydrateComponentState ,clear and skip.\n rsStore.componentState = null;\n return null;\n } else if (\n activePersonalization?.isPreset &&\n !isEmpty(activePersonalization.personalizationState ?? {})\n ) {\n // Preset has its own saved personalization,use it directly.\n hydratedState = activePersonalization.personalizationState ?? {};\n } else if (activePersonalization?.isPreset) {\n // If Preset has no saved personalization, derive initial state from meta.\n hydratedState = {\n template: getView().meta.template,\n presetId: getView().meta.id,\n ...convertMetaIntoState(getView().meta)\n };\n } else {\n return null;\n }\n\n hydratedState = getCurrentVersionedState(\n hydrateVisibleColumnsStateSlice(getView().meta, hydratedState)\n );\n return dispatch(actionHydrateState(hydratedState));\n};\n\n/**\n * Hydrates the repeating structure state on bootstrap, following this priority order:\n * 1. {@link RsProps.persistedInfo}\n * 2. Component state from {@link ApiContext.getComponentState}\n * 3. Personalized state from the preset\n * 4. {@link Meta}\n */\nexport default () => {\n const memoizedHydrateComponentState = withMemoization(hydrateComponentState);\n const memoizedHydrate = withMemoization(hydrate);\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n memoizedHydrateComponentState([featureProps], []);\n memoizedHydrate([featureProps], [featureProps.getView().meta]);\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"stateHydration.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/stateHydration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,cAAc,EACd,OAAO,EACP,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EACL,mBAAmB,EACnB,mBA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CAAC,IAAI,CAAC,EAAE;YAC3B,GAAG,oBAAoB,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;SACxC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,GAAG,wBAAwB,CACtC,+BAA+B,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAC/D,CAAC;IACF,OAAO,QAAQ,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,6BAA6B,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC7E,MAAM,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEjD,OAAO,SAAS,OAAO,CAAC,YAAsC;QAC5D,6BAA6B,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,eAAe,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { actionHydrateState } from '../../../actions/actions';\nimport {\n withMemoization,\n pickProperties,\n isEmpty,\n isRowDeleteFieldVisible,\n isRowSelectFieldEnabled,\n getVisibleColumnsFromHidden,\n getVisibleColumnsFromFieldDefs,\n isRowReorderFieldVisible,\n isRowErrorFieldVisible,\n isRowActionFieldEnabled\n} from '../../../utils/util';\nimport { personalizationProps } from '../../../reducers/personalizationReducer';\nimport {\n rowActionColumnMeta,\n rowDeleteColumnMeta,\n rowDragDropColumnMeta,\n rowErrorColumnMeta,\n rowSelectColumnMeta,\n TEMPLATES\n} from '../../../constants';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport { PRESET_STATE_KEYS, type Meta, type PresetState } from '../../../../../types/Meta.types';\nimport type { State } from '../../../../../types/State.types';\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type RsProps from '../../../RsProps';\nimport type { ApiContext } from '../../../../../types/ApiContext.types';\nimport { getCurrentVersionedState } from '../../../reducers/versioning';\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/**\n * Returns visible OOTB column IDs.\n *\n * @param meta - View meta containing field configuration.\n * @returns Array of visible OOTB column IDs.\n */\nexport function getVisibleOotbColumns(meta: Meta): string[] {\n const ootbColumns = [\n { enabled: isRowErrorFieldVisible(meta), id: rowErrorColumnMeta.field.id },\n { enabled: isRowReorderFieldVisible(meta), id: rowDragDropColumnMeta.field.id },\n { enabled: isRowSelectFieldEnabled(meta), id: rowSelectColumnMeta.field.id },\n { enabled: isRowActionFieldEnabled(meta), id: rowActionColumnMeta.field.id },\n { enabled: isRowDeleteFieldVisible(meta), id: rowDeleteColumnMeta.field.id }\n ] as const;\n\n return ootbColumns.filter(({ enabled }) => enabled).map(({ id }) => id);\n}\n/**\n * Resolves `visibleColumns` from state and appends enabled OOTB columns.\n *\n * @param meta - View meta containing fieldDefs and OOTB field config.\n * @param state - Current state to hydrate into.\n */\nexport function hydrateVisibleColumnsStateSlice(meta: Meta, state: State): State {\n let visibleColumns: string[];\n\n if (state.visibleColumns !== undefined) {\n // Use explicitly saved visibleColumns as-is.\n visibleColumns = [...state.visibleColumns];\n } else if (state.hiddenColumns !== undefined) {\n // Derive visibleColumns from fieldDefs minus hiddenColumns.\n visibleColumns = getVisibleColumnsFromHidden(meta, state.hiddenColumns);\n } else {\n // Fall back to fieldDefs where show is true.\n visibleColumns = getVisibleColumnsFromFieldDefs(meta);\n }\n\n // Append enabled OOTB columns that are not hidden.\n const ootbColumnIds = getVisibleOotbColumns(meta);\n visibleColumns.push(...ootbColumnIds);\n\n // TODO OOTB columns should not be part of the state.\n return {\n ...state,\n visibleColumns\n };\n}\n\n// Runtime whitelist: type checks alone don't stop JS consumers or intermediate values from\n// passing keys (e.g. `template`) that must stay controlled by meta. Undefined values are skipped.\nconst pickPresetState = (presetState: Meta['presetState']): PresetState => {\n const picked: PresetState = {};\n if (!presetState) return picked;\n PRESET_STATE_KEYS.forEach(key => {\n if (presetState[key] !== undefined) Object.assign(picked, { [key]: presetState[key] });\n });\n return picked;\n};\n\n/**\n * Converts given meta into the state structure.\n */\nexport function convertMetaIntoState(meta: Meta): State {\n const sortingOrder: State['sortingOrder'] = [];\n const hiddenColumns: State['hiddenColumns'] = [];\n const visibleColumns: State['visibleColumns'] = [];\n let groups: NonNullable<State['groups']> = [];\n const aggregationInfo: State['aggregationInfo'] = [];\n const conditionalStyleFormats: State['conditionalStyleFormats'] = [];\n const { filterExpression, showHeaderIcons, defaultRowHeight } = meta;\n\n // default RowHeight as short\n // update selectedHeightOption if defaultRowHeight is set in meta\n const selectedHeightOption = meta.template === TEMPLATES.TABLE ? defaultRowHeight : undefined;\n\n // hydrate state with meta.fieldDefs\n meta.fieldDefs.forEach(fieldDef => {\n // hydrating sorting\n if (fieldDef.sort && fieldDef.sortPriority && fieldDef.sortDirection)\n sortingOrder.push({\n columnId: fieldDef.id,\n order: fieldDef.sortDirection,\n sequence: fieldDef.sortPriority\n });\n\n // hydrating column visibility\n // TODO: when hiddenColumns is deprecated removed it.\n if (!fieldDef.show) hiddenColumns.push(fieldDef.id);\n\n // hydrating visible columns\n if (fieldDef.show) visibleColumns.push(fieldDef.id);\n\n // hydrating aggregated Fields\n if (fieldDef.aggregated && (fieldDef.type === 'number' || fieldDef.type === 'currency')) {\n const aggregationType = meta.aggregateOptions?.[fieldDef.type]?.[0];\n\n if (aggregationType) {\n aggregationInfo.push({\n columnId: fieldDef.id,\n type: aggregationType\n });\n }\n }\n\n // hydrating grouping\n // consider sort direction of column for group order if its provided otherwise default to ascending.\n if (meta.grouping && fieldDef.grouping && fieldDef.grouped) {\n const level = fieldDef.groupOrder ?? groups.length;\n let order: NonNullable<State['groups']>[number]['order'] = 'asc';\n if (fieldDef.customGrouping) {\n order = 'custom';\n } else if (fieldDef.sort && fieldDef.sortDirection) {\n order = fieldDef.sortDirection;\n }\n groups.splice(level, 0, {\n columnId: fieldDef.id,\n order,\n level,\n dateFunction: fieldDef.groupedDateFunction,\n additionalFields: fieldDef.groupedAdditionalFields,\n customFunction: fieldDef.customGrouping\n });\n }\n\n if (fieldDef.conditionalStyleFormats) {\n conditionalStyleFormats.push(\n ...fieldDef.conditionalStyleFormats.map(conditionalStyleFormat => ({\n ...conditionalStyleFormat,\n fieldName: fieldDef.name\n }))\n );\n }\n });\n\n // BUG-752261 Maintaining sort sequence in state\n sortingOrder.sort((col1, col2) => col1.sequence - col2.sequence);\n\n if (meta.grouping === undefined) groups = [];\n\n return {\n ...(meta.template === TEMPLATES.GALLERY && {\n galleryLayout: meta.galleryConfig?.layout\n }),\n sortingOrder,\n hiddenColumns,\n groups,\n aggregationInfo,\n filterExpression,\n showHeaderIcons,\n selectedHeightOption,\n conditionalStyleFormats,\n visibleColumns,\n ...pickPresetState(meta.presetState)\n };\n}\n\nconst hydrateComponentState = async ([{ getRsProps, getRsStore, dispatch, getState, getView }]: [\n featureProps: BeforeRenderFeatureProps\n]) => {\n let componentState;\n const rsProps = getRsProps();\n const rsStore = getRsStore();\n rsStore.componentState = null;\n if (rsProps?.apiContext?.getComponentState) {\n componentState = await rsProps?.apiContext?.getComponentState();\n }\n const { personalization } = getState();\n // if client set component state somewhere for persisting changes\n if (\n componentState &&\n Object.keys(componentState).length &&\n personalization &&\n componentState.activePersonalization\n ) {\n rsStore.componentState = componentState;\n const activeComponentState = pickProperties(componentState, personalizationProps);\n let hydratedState: State = {\n personalization: {\n ...personalization,\n active: componentState.activePersonalization\n },\n ...activeComponentState\n };\n\n // Resolve visible columns then apply OOTB column visibility.\n hydratedState = hydrateVisibleColumnsStateSlice(getView().meta, hydratedState);\n dispatch(actionHydrateState(hydratedState));\n }\n};\n\n// Todo: onLoad sorting, filterBy, GroupBy, Freeze, HiddenColumn,\n// the structure in meta and hydration of state from it\nconst hydrate = ([{ getRsStore, getRsProps, getView, dispatch, getState }]: [\n featureProps: BeforeRenderFeatureProps\n]) => {\n const state = getState();\n const rsStore = getRsStore();\n const rsProps = getRsProps();\n const activePersonalization =\n state.personalization?.allPersonalizations?.[state.personalization?.active];\n\n let hydratedState: State = {};\n\n if (rsProps.persistedInfo && rsStore.presets[0].id === state.personalization?.active) {\n // Hydrate from persisted info.\n hydratedState = rsProps.persistedInfo;\n } else if (rsStore.componentState) {\n // Component state already applied by hydrateComponentState ,clear and skip.\n rsStore.componentState = null;\n return null;\n } else if (\n activePersonalization?.isPreset &&\n !isEmpty(activePersonalization.personalizationState ?? {})\n ) {\n // Preset has its own saved personalization,use it directly.\n hydratedState = activePersonalization.personalizationState ?? {};\n } else if (activePersonalization?.isPreset) {\n // If Preset has no saved personalization, derive initial state from meta.\n hydratedState = {\n template: getView().meta.template,\n presetId: getView().meta.id,\n ...convertMetaIntoState(getView().meta)\n };\n } else {\n return null;\n }\n\n hydratedState = getCurrentVersionedState(\n hydrateVisibleColumnsStateSlice(getView().meta, hydratedState)\n );\n return dispatch(actionHydrateState(hydratedState));\n};\n\n/**\n * Hydrates the repeating structure state on bootstrap, following this priority order:\n * 1. {@link RsProps.persistedInfo}\n * 2. Component state from {@link ApiContext.getComponentState}\n * 3. Personalized state from the preset\n * 4. {@link Meta} (including {@link Meta.presetState})\n */\nexport default () => {\n const memoizedHydrateComponentState = withMemoization(hydrateComponentState);\n const memoizedHydrate = withMemoization(hydrate);\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n memoizedHydrateComponentState([featureProps], []);\n memoizedHydrate([featureProps], [featureProps.getView().meta]);\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/features/uIFeatures/index.ts"],"names":[],"mappings":"AAsCA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,OAAO,YAAY,MAAM,6BAA6B,CAAC;;;4EAJrD,kEAAsC;6BApBnC,kEAAsC;6BAyEkxG,kEAAsC;uBAbt1G,kEAGT;;0BAzDgD,kEAChB;;uBAaM,kEACd;6BAoD4mC,kEAAsC;;4BA3D1nC,kEACpC;8BA0D0pO,kEAAsC;kCA7BlsO,kEAEZ;6BArC+B,kEAChB;2BAGgB,kEAC5B;2EA2DgsE,kEAAsC;yCAjD3tE,kEAAsC;+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/features/uIFeatures/index.ts"],"names":[],"mappings":"AAsCA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,OAAO,YAAY,MAAM,6BAA6B,CAAC;;;4EAJrD,kEAAsC;6BApBnC,kEAAsC;6BAyEkxG,kEAAsC;uBAbt1G,kEAGT;;0BAzDgD,kEAChB;;uBAaM,kEACd;6BAoD4mC,kEAAsC;;4BA3D1nC,kEACpC;8BA0D0pO,kEAAsC;kCA7BlsO,kEAEZ;6BArC+B,kEAChB;2BAGgB,kEAC5B;2EA2DgsE,kEAAsC;yCAjD3tE,kEAAsC;+BAiDw2M,kEAAsC;4BArDl6M,kEACd;kCAoDgwU,kEAAsC;;;6EAA1xM,kEAAsC;gCA/DpiI,kEACpB;kCAR2C,kEAC1C;4BAqES,kEAAsC;kCApEvC,kEAAsC;sCAQ/B,kEAC7B;+BAE2B,kEACZ;0EAwDmxP,kEAAsC;wEAA78I,kEAAsC;4BAA13F,kEAAsC;6BA9EhhB,kEAC5B;sEA2BZ,kEAAsC;2BAkDlB,kEAAsC;4BA/DzD,kEACpB;;uCA8Do2B,kEAAsC;;;0BAAqtD,sDAA0B;iCAAq9C,sDAA0B;yCA7DlkI,sDAC5B;;;AAab,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;;;;;iBAc2jJ,CAAC;0BAA4C,CAAC;gCAAoD,CAAC;qCAA+D,CAAC;oBAAkD,CAAC;;;;;;;;;;;;;;;;;sBAAm6R,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EADprb"}
|
|
@@ -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;AAOrD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,KAAK,EACV,UAAU,EACV,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,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,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,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CAAC;IAKxE;;;;;;;;OAQG;6BACsB,MAAM,iBAAiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,MAAM;IA6B1F,4CAA4C;;IAK5C,4GAA4G;0CACtE,MAAM;IAQ5C,wFAAwF;kCAC1D,MAAM,EAAE;IAWtC,oEAAoE;oCACpC,UAAU,GAAG,MAAM;IAkCnD;;;;;OAKG;6BACsB,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;EAMzD;AACD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -538,23 +538,13 @@ export default function viewUtilityMethods(rsInternal) {
|
|
|
538
538
|
* Triggers {@link ApiContext.exportData exportData} api.
|
|
539
539
|
*/
|
|
540
540
|
exportToExcel() {
|
|
541
|
-
function getVisibleColumnFormatters() {
|
|
542
|
-
const visibleColumns = getView().getVisibleColumns();
|
|
543
|
-
const formatters = {};
|
|
544
|
-
visibleColumns?.forEach(column => {
|
|
545
|
-
if (column.formatterConfig) {
|
|
546
|
-
formatters[column.field.id] = column.formatterConfig;
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
return formatters;
|
|
550
|
-
}
|
|
551
541
|
return getRsProps()
|
|
552
|
-
.apiContext.exportData?.(deepCopy(
|
|
542
|
+
.apiContext.exportData?.(deepCopy(getRsStateResolver().getState()), getView().meta, {
|
|
553
543
|
...(getRsStore().refreshInProgress && {
|
|
554
544
|
invalidateCache: true,
|
|
555
545
|
invalidateCacheToken: getRsStore().refreshToken
|
|
556
546
|
})
|
|
557
|
-
}
|
|
547
|
+
})
|
|
558
548
|
.catch(err => {
|
|
559
549
|
getRsStateResolver().dispatch(actions.actionNotificationAdd({
|
|
560
550
|
content: err
|
|
@@ -566,7 +556,7 @@ export default function viewUtilityMethods(rsInternal) {
|
|
|
566
556
|
*/
|
|
567
557
|
exportToCSV() {
|
|
568
558
|
return getRsProps()
|
|
569
|
-
.apiContext.exportDataToCSV?.(deepCopy(
|
|
559
|
+
.apiContext.exportDataToCSV?.(deepCopy(getRsStateResolver().getState()), getView().meta, {
|
|
570
560
|
...(getRsStore().refreshInProgress && {
|
|
571
561
|
invalidateCache: true,
|
|
572
562
|
invalidateCacheToken: getRsStore().refreshToken
|