@pega/lists-core 9.0.0-build.13.2 → 9.0.0-build.14.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/src/core/features/featureFactory.d.ts +1 -1
- package/lib/src/core/features/featureFactory.d.ts.map +1 -1
- package/lib/src/core/features/featureFactory.js.map +1 -1
- package/lib/src/core/generators/RowGenerator.d.ts +1 -1
- package/lib/src/core/generators/RowGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/RowGenerator.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { State } from '
|
|
1
|
+
import type { State } from 'pega-repeating-structures-core/lib/types/State.types';
|
|
2
2
|
import type View from '../generators/ViewGenerator';
|
|
3
3
|
import type RsInternal from '../RsInternal';
|
|
4
4
|
import type RsProps from '../RsProps';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureFactory.d.ts","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"featureFactory.d.ts","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAElF,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAC;AAKpD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIvD,MAAM,MAAM,YAAY,CAAC,iBAAiB,SAAS,OAAO,GAAG,KAAK,IAAI;IACpE,gDAAgD;IAChD,OAAO,EAAE,MAAM,IAAI,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,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CAAC,UAAsB;IAC3D,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE3F,OAAO,GAAG,EAAE;QACT,qBAAkE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACpF,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC;oBACN,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;oBACnD,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,gBAAgB;oBACnE,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;iBACpD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAsB;IAEtB,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'packages/lists-rs-core/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n * @returns\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n * @returns\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver()!.getState,\n getOriginalState: rsInternal.getRsStateResolver()!.getOriginalState,\n dispatch: rsInternal.getRsStateResolver()!.dispatch\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n * @returns\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"featureFactory.js","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAaA,OAAO,UAAU,MAAM,cAAc,CAAC;AA6CtC,SAAS,aAAa;IACpB,MAAM,QAAQ,GAGV;QACF,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAChE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAClE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACpE,iGAAiG;IACjG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC/D,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAC1E,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IACnE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC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AC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'pega-repeating-structures-core/lib/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n * @returns\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n * @returns\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver()!.getState,\n getOriginalState: rsInternal.getRsStateResolver()!.getOriginalState,\n dispatch: rsInternal.getRsStateResolver()!.dispatch\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n * @returns\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DataError } from '
|
|
1
|
+
import type { DataError } from 'pega-repeating-structures-core/lib/types/State.types';
|
|
2
2
|
import type RsInternal from '../RsInternal';
|
|
3
3
|
import type View from './ViewGenerator';
|
|
4
4
|
import { dataKey, type DragProps, type DropProps, type RowContext, type RowData, type RowHeader, type RowOptions, type UIProps } from './RowGenerator.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowGenerator.d.ts","sourceRoot":"","sources":["../../../../src/core/generators/RowGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"RowGenerator.d.ts","sourceRoot":"","sources":["../../../../src/core/generators/RowGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EA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AAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI;YACzB,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;YACxC,mBAAmB,EAAE,CAAC,UAAmB,EAAE,EAAE;gBAC3C,OAAO,CACL,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,CACxC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAW,EAC5C,UAAU,CACX,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CACzB,CAAC;YACJ,CAAC;YACD,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS;YAClC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { DataError } from 'packages/lists-rs-core/types/State.types';\n\nimport { STATE, SELECTION_MODES } from '../constants';\nimport { compareObjects, deepCopy, isRowReorderFieldEnabled } from '../utils/util';\nimport { actionForceUpdate, actionRowSelectionUpdate } from '../actions/actions';\nimport type RsInternal from '../RsInternal';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Meta } from '../../../types/Meta.types';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type View from './ViewGenerator';\nimport {\n dataKey,\n type DragProps,\n type DropProps,\n type RowContext,\n type RowData,\n type RowHeader,\n type RowOptions,\n type UIProps\n} from './RowGenerator.types';\nimport type Column from './ColumnGenerator';\n/** A row model that represents row of a repeating structure component. */\nexport default class Row {\n /** A unique key to identify a row object. The value of this must be derived from one of the key of {@link rowData} */\n public key: string;\n /** Value for Html attribute 'role'.\n * @default 'row'\n */\n role: string;\n /** Value of Html attribute 'tabindex'.\n * @default 0\n */\n tabIndex: number;\n /** Properties related to dragging behavior. */\n public dragProps?: DragProps;\n /** Properties related to dropping behavior. */\n public dropProps?: DropProps;\n /** Represents the data of a row. */\n rowData: RowData;\n /** A unique key to identify a row object in case {@link key} is duplicate. This can be used in the dom to uniquely identify a row. */\n uniqueId?: string | null;\n /** A reference to {@link RsInternal} object. */\n #rsInternal: RsInternal;\n /**\n * Creates an instance of Row object for a repeating structure.\n * @param args Constructor arguments\n * @param args.key A unique key to identify a row object.\n * @param args.role Value for Html attribute 'role'. Default is 'row'\n * @param args.tabIndex Value of Html attribute 'tabindex'. Default is 0.\n * @param args.dragProps Properties related to dragging behavior.\n * @param args.dropProps Properties related to dropping behavior.\n * @param args.rowData Represents the data of a row.\n * @param args.uniqueId A unique key to identify a row object in case {@link key} is duplicate.\n * @param rsInternal A reference to {@link RsInternal} object.\n */\n constructor(\n { key, role = 'row', tabIndex = 0, dragProps, dropProps, rowData, uniqueId }: RowOptions,\n rsInternal: RsInternal\n ) {\n this.key = key;\n this.role = role;\n this.tabIndex = tabIndex;\n this.dragProps = dragProps;\n this.dropProps = dropProps;\n this.rowData = rowData;\n this.uniqueId = uniqueId;\n this.#rsInternal = rsInternal;\n\n /** IMP: For generator methods use traditional function syntax\n * rather than arrow function for memory efficiency\n * and bind 'this' to the methods which requires 'this' context. */\n this.getUIProps = this.getUIProps.bind(this);\n this.getContext = this.getContext.bind(this);\n this.updateRow = this.updateRow.bind(this);\n this.selectRow = this.selectRow.bind(this);\n\n this.setProp = this.setProp.bind(this);\n this.getRowError = this.getRowError.bind(this);\n this.getRowHeader = this.getRowHeader.bind(this);\n }\n\n /** A reference to {@link View} object. */\n get parent() {\n return this.#rsInternal.getView();\n }\n\n /**\n * This is majorly used by {@link setprop} function to create a new row object from existing row object.\n * @returns the row instance properties.\n */\n #get(): RowOptions & { className: string } {\n return {\n key: this.key,\n role: this.role,\n tabIndex: this.tabIndex,\n className: this.className,\n dragProps: this.dragProps,\n dropProps: this.dropProps,\n rowData: this.rowData,\n uniqueId: this.uniqueId\n };\n }\n\n /**\n * This property serves to uniquely identify a row's DOM element within a DOM hierarchy.\n * It plays a vital role in modern JavaScript frameworks such as React, where optimizing DOM manipulation requires unique keys.\n * The value is derived from either {@link key} or {@link uniqueId} if {@link key} is duplicate.\n */\n get reactKey() {\n return this.uniqueId || this.key;\n }\n\n /** The data for the row. */\n get data() {\n return this.rowData;\n }\n\n /** Value of HTMl attribute data-key. The value is derived from\n * either the value of {@link Meta.itemKey itemkey} in {@link data} or {@link key} */\n get [dataKey](): string {\n const keyData = this.data?.[this.parent.meta.itemKey];\n if (keyData) return keyData as string;\n return this.key;\n }\n\n /** A set of CSS class names for Row element. */\n get className() {\n const baseRowClass = this.getRowError()?.message ? 'row row-error' : 'row';\n if (this.parent.meta.selectionMode === SELECTION_MODES.multi_on_hover)\n return this.$selected ? `${baseRowClass} selected-row` : `${baseRowClass} row-on-hover`;\n\n return this.parent.onRowClickAction ? `${baseRowClass} click` : `${baseRowClass}`;\n }\n\n /** A transient value to signifies if a row is selected or not if selection mode is on. */\n get $selected(): RowContext['$selected'] {\n const temporaryChangeSetValue = this.parent.state.rowSelectionChangeSet?.[this.key]?.selected;\n const committedValue = this.parent.state.selectedRows?.includes(this.key);\n if (\n (temporaryChangeSetValue ?? committedValue) &&\n this.parent.meta.selectionMode === SELECTION_MODES.single &&\n this.uniqueId\n ) {\n /**\n * temporaryChangeSetValue ?? committedValue - Is current row selected\n * this.parent.meta.selectionMode === SELECTION_MODES.single - Is single select mode\n * this.uniqueId - unique id is present only in case of duplicate rows\n */\n if (this.parent.getSingleSelectionRowKey()) {\n // This block is to avoid duplicate radio button selection on user selection\n return this.parent.getSingleSelectionRowKey() === this.uniqueId;\n }\n for (let i = 0; i < this.parent.rows!.length; i += 1) {\n // This block is to avoid duplicate radio button selection onload / remount\n const row = this.parent.rows![i];\n const rowTemporaryChangeSetValue =\n this.parent.state.rowSelectionChangeSet?.[row.key]?.selected;\n const rowCommittedValue =\n this.parent.state.selectedRows && this.parent.state.selectedRows?.includes(row.key);\n if (rowTemporaryChangeSetValue ?? rowCommittedValue) {\n // 'row' - first selected row in this.parent.rows\n return this.uniqueId === row.uniqueId; // If 'row' is same as current object return true otherwise return false\n }\n }\n }\n return temporaryChangeSetValue ?? committedValue;\n }\n\n /**\n * This is used to create immutable objects of {@link Row} instance. Always call setProp if updating any properties of Row to make it immutable.\n * @param prop Either partial of row object or individual properties of row object.\n * @param [value] An optional parameter to provide value for {@link prop} in case prop is not of type {@link Row}\n */\n setProp(\n prop: Partial<RowOptions> | keyof RowOptions,\n value?: string | number | Date | boolean | DragProps | DropProps\n ) {\n const { getView } = this.#rsInternal;\n const index = getView().rows!.findIndex(r => r === this);\n let pObject = prop;\n if (typeof prop !== 'object') {\n pObject = { [prop]: value };\n }\n\n // Change object if any value changes actually.\n // @ts-expect-error utils should be converted to TS in order to resolve this.\n if (!compareObjects(this, pObject, Object.keys(pObject))) {\n const newRow = new Row(\n {\n ...this.#get(),\n ...(pObject as RowOptions)\n },\n this.#rsInternal\n );\n const cloned = [...getView().rows!];\n cloned.splice(index, 1, newRow);\n getView().rows = cloned;\n }\n }\n\n /** This fetches the latest data of the row using\n * {@link rsProps.apiContext.fetchRowData fetchRowData} and updates the same in the {@link View} and {@link Row}\n * @returns void\n */\n async updateRow(): Promise<void> {\n const { getView, getRsProps, getRsStateResolver, getRsStore } = this.#rsInternal;\n const rsProps = getRsProps();\n const { dispatch } = getRsStateResolver();\n const state = getRsStateResolver().getState();\n // TODO: Check if fetchRowData api is really needed? In case of grouped tables updating single row may cause issues. It is better to refresh whole view.\n const [rowData] =\n (await rsProps.apiContext.fetchRowData?.(\n deepCopy(state),\n getView().meta,\n getView().meta.itemKey,\n this[dataKey],\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n }\n )) || [];\n const dataIndex = getView().data!.findIndex(\n row => row[getView().meta.itemKey] === rowData[getView().meta.itemKey]\n );\n const rowIndex = getView().rows!.findIndex(row => row.key === rowData[getView().meta.itemKey]);\n if (dataIndex > -1) {\n getView().setProp({\n data: [\n ...getView().data!.slice(0, dataIndex),\n rowData,\n ...getView().data!.slice(dataIndex + 1)\n ],\n rows: [\n ...getView().rows!.slice(0, rowIndex),\n new Row(\n {\n key: rowData[getView().meta.itemKey] as string,\n rowData\n },\n this.#rsInternal\n ),\n ...getView().rows!.slice(rowIndex + 1)\n ]\n });\n dispatch(actionForceUpdate());\n }\n }\n\n /**\n * Used to select/deselect a {@link Row}.\n * @param selected Flag to indicate the row is selected or not.\n */\n selectRow(selected = true): void {\n const { getRsStateResolver } = this.#rsInternal;\n const { dispatch } = getRsStateResolver();\n this.parent.setSingleSelectionRowKey(this.uniqueId ?? (this.key as string));\n\n dispatch(\n actionRowSelectionUpdate({\n key: this.key as string,\n selected,\n data: this.data,\n status: STATE.NOT_STARTED,\n mode: this.parent.meta.selectionMode\n })\n );\n }\n\n /**\n * Returns the ui props for the {@link Row} that can be used to build a row in DOM.\n *\n */\n getUIProps(): UIProps {\n const { getView } = this.#rsInternal;\n return {\n className: this.className,\n 'data-error-message': this.getRowError()?.message,\n [dataKey]: this[dataKey],\n role: this.role,\n 'aria-rowindex':\n // eslint-disable-next-line no-unsafe-optional-chaining\n this.parent.state.paginationOptions?.rootVirtualiser?.startIndex! +\n this.parent.rows!.findIndex(r => r === this)! +\n 1,\n onClick: getView().onRowClickAction?.bind(this, this.data),\n ...(!isRowReorderFieldEnabled(getView().meta) ? this.dragProps : {}),\n ...this.dropProps\n };\n }\n\n /**\n *\n * @returns the errors on the row.\n */\n getRowError(): DataError[string | number] | undefined {\n return this.parent.state.errors?.dataErrors?.[this.key as string | number];\n }\n\n /**\n * Returns the current row Header field and value.\n * This api is exposed to the consumers of Repeating structures to access the row header information of the current row.\n *\n * @public\n */\n getRowHeader(): RowHeader | undefined {\n let rowHeaderColumn: Column | undefined;\n const columns = this.parent.getContext().getColumns();\n for (const column of columns!) {\n if (column.field.isRowHeader) {\n rowHeaderColumn = column;\n break;\n }\n if (column.isFirstDataColumn) {\n rowHeaderColumn = column;\n }\n }\n if (!rowHeaderColumn) {\n return undefined;\n }\n return {\n field: rowHeaderColumn as Column,\n getValue: () => rowHeaderColumn!.getContext().getValue()\n };\n }\n\n /**\n * Returns the current row context.\n * This api can be exposed to the consumers of Repeating structures to access the basic info regarding Row.\n *\n * @public\n */\n getContext(): RowContext {\n const { getRsProps, getView } = this.#rsInternal;\n const rsProps = getRsProps();\n return {\n name: 'row',\n getValue: () => this.data,\n getParentContext: this.parent.getContext,\n getRowActionDetails: (rowContext: RowData) => {\n return (\n rsProps.apiContext.fetchRowActionDetails?.(\n rowContext[getView().meta.itemKey] as string,\n rowContext\n ) ?? Promise.resolve([])\n );\n },\n getDragProps: () => this.dragProps,\n selectRow: this.selectRow,\n refreshRow: this.updateRow,\n $selected: this.$selected,\n getRowError: this.getRowError,\n getRowHeader: this.getRowHeader\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RowGenerator.js","sourceRoot":"","sources":["../../../../src/core/generators/RowGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAOjF,OAAO,EACL,OAAO,EAQR,MAAM,sBAAsB,CAAC;AAE9B,0EAA0E;AAC1E,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,sHAAsH;IAC/G,GAAG,CAAS;IACnB;;OAEG;IACH,IAAI,CAAS;IACb;;OAEG;IACH,QAAQ,CAAS;IACjB,+CAA+C;IACxC,SAAS,CAAa;IAC7B,+CAA+C;IACxC,SAAS,CAAa;IAC7B,oCAAoC;IACpC,OAAO,CAAU;IACjB,sIAAsI;IACtI,QAAQ,CAAiB;IACzB,gDAAgD;IAChD,WAAW,CAAa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E,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;QACjD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,OAAO;YACL,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI;YACzB,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;YACxC,mBAAmB,EAAE,CAAC,UAAmB,EAAE,EAAE;gBAC3C,OAAO,CACL,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,CACxC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAW,EAC5C,UAAU,CACX,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CACzB,CAAC;YACJ,CAAC;YACD,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS;YAClC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { DataError } from 'pega-repeating-structures-core/lib/types/State.types';\n\nimport { STATE, SELECTION_MODES } from '../constants';\nimport { compareObjects, deepCopy, isRowReorderFieldEnabled } from '../utils/util';\nimport { actionForceUpdate, actionRowSelectionUpdate } from '../actions/actions';\nimport type RsInternal from '../RsInternal';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Meta } from '../../../types/Meta.types';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type View from './ViewGenerator';\nimport {\n dataKey,\n type DragProps,\n type DropProps,\n type RowContext,\n type RowData,\n type RowHeader,\n type RowOptions,\n type UIProps\n} from './RowGenerator.types';\nimport type Column from './ColumnGenerator';\n/** A row model that represents row of a repeating structure component. */\nexport default class Row {\n /** A unique key to identify a row object. The value of this must be derived from one of the key of {@link rowData} */\n public key: string;\n /** Value for Html attribute 'role'.\n * @default 'row'\n */\n role: string;\n /** Value of Html attribute 'tabindex'.\n * @default 0\n */\n tabIndex: number;\n /** Properties related to dragging behavior. */\n public dragProps?: DragProps;\n /** Properties related to dropping behavior. */\n public dropProps?: DropProps;\n /** Represents the data of a row. */\n rowData: RowData;\n /** A unique key to identify a row object in case {@link key} is duplicate. This can be used in the dom to uniquely identify a row. */\n uniqueId?: string | null;\n /** A reference to {@link RsInternal} object. */\n #rsInternal: RsInternal;\n /**\n * Creates an instance of Row object for a repeating structure.\n * @param args Constructor arguments\n * @param args.key A unique key to identify a row object.\n * @param args.role Value for Html attribute 'role'. Default is 'row'\n * @param args.tabIndex Value of Html attribute 'tabindex'. Default is 0.\n * @param args.dragProps Properties related to dragging behavior.\n * @param args.dropProps Properties related to dropping behavior.\n * @param args.rowData Represents the data of a row.\n * @param args.uniqueId A unique key to identify a row object in case {@link key} is duplicate.\n * @param rsInternal A reference to {@link RsInternal} object.\n */\n constructor(\n { key, role = 'row', tabIndex = 0, dragProps, dropProps, rowData, uniqueId }: RowOptions,\n rsInternal: RsInternal\n ) {\n this.key = key;\n this.role = role;\n this.tabIndex = tabIndex;\n this.dragProps = dragProps;\n this.dropProps = dropProps;\n this.rowData = rowData;\n this.uniqueId = uniqueId;\n this.#rsInternal = rsInternal;\n\n /** IMP: For generator methods use traditional function syntax\n * rather than arrow function for memory efficiency\n * and bind 'this' to the methods which requires 'this' context. */\n this.getUIProps = this.getUIProps.bind(this);\n this.getContext = this.getContext.bind(this);\n this.updateRow = this.updateRow.bind(this);\n this.selectRow = this.selectRow.bind(this);\n\n this.setProp = this.setProp.bind(this);\n this.getRowError = this.getRowError.bind(this);\n this.getRowHeader = this.getRowHeader.bind(this);\n }\n\n /** A reference to {@link View} object. */\n get parent() {\n return this.#rsInternal.getView();\n }\n\n /**\n * This is majorly used by {@link setprop} function to create a new row object from existing row object.\n * @returns the row instance properties.\n */\n #get(): RowOptions & { className: string } {\n return {\n key: this.key,\n role: this.role,\n tabIndex: this.tabIndex,\n className: this.className,\n dragProps: this.dragProps,\n dropProps: this.dropProps,\n rowData: this.rowData,\n uniqueId: this.uniqueId\n };\n }\n\n /**\n * This property serves to uniquely identify a row's DOM element within a DOM hierarchy.\n * It plays a vital role in modern JavaScript frameworks such as React, where optimizing DOM manipulation requires unique keys.\n * The value is derived from either {@link key} or {@link uniqueId} if {@link key} is duplicate.\n */\n get reactKey() {\n return this.uniqueId || this.key;\n }\n\n /** The data for the row. */\n get data() {\n return this.rowData;\n }\n\n /** Value of HTMl attribute data-key. The value is derived from\n * either the value of {@link Meta.itemKey itemkey} in {@link data} or {@link key} */\n get [dataKey](): string {\n const keyData = this.data?.[this.parent.meta.itemKey];\n if (keyData) return keyData as string;\n return this.key;\n }\n\n /** A set of CSS class names for Row element. */\n get className() {\n const baseRowClass = this.getRowError()?.message ? 'row row-error' : 'row';\n if (this.parent.meta.selectionMode === SELECTION_MODES.multi_on_hover)\n return this.$selected ? `${baseRowClass} selected-row` : `${baseRowClass} row-on-hover`;\n\n return this.parent.onRowClickAction ? `${baseRowClass} click` : `${baseRowClass}`;\n }\n\n /** A transient value to signifies if a row is selected or not if selection mode is on. */\n get $selected(): RowContext['$selected'] {\n const temporaryChangeSetValue = this.parent.state.rowSelectionChangeSet?.[this.key]?.selected;\n const committedValue = this.parent.state.selectedRows?.includes(this.key);\n if (\n (temporaryChangeSetValue ?? committedValue) &&\n this.parent.meta.selectionMode === SELECTION_MODES.single &&\n this.uniqueId\n ) {\n /**\n * temporaryChangeSetValue ?? committedValue - Is current row selected\n * this.parent.meta.selectionMode === SELECTION_MODES.single - Is single select mode\n * this.uniqueId - unique id is present only in case of duplicate rows\n */\n if (this.parent.getSingleSelectionRowKey()) {\n // This block is to avoid duplicate radio button selection on user selection\n return this.parent.getSingleSelectionRowKey() === this.uniqueId;\n }\n for (let i = 0; i < this.parent.rows!.length; i += 1) {\n // This block is to avoid duplicate radio button selection onload / remount\n const row = this.parent.rows![i];\n const rowTemporaryChangeSetValue =\n this.parent.state.rowSelectionChangeSet?.[row.key]?.selected;\n const rowCommittedValue =\n this.parent.state.selectedRows && this.parent.state.selectedRows?.includes(row.key);\n if (rowTemporaryChangeSetValue ?? rowCommittedValue) {\n // 'row' - first selected row in this.parent.rows\n return this.uniqueId === row.uniqueId; // If 'row' is same as current object return true otherwise return false\n }\n }\n }\n return temporaryChangeSetValue ?? committedValue;\n }\n\n /**\n * This is used to create immutable objects of {@link Row} instance. Always call setProp if updating any properties of Row to make it immutable.\n * @param prop Either partial of row object or individual properties of row object.\n * @param [value] An optional parameter to provide value for {@link prop} in case prop is not of type {@link Row}\n */\n setProp(\n prop: Partial<RowOptions> | keyof RowOptions,\n value?: string | number | Date | boolean | DragProps | DropProps\n ) {\n const { getView } = this.#rsInternal;\n const index = getView().rows!.findIndex(r => r === this);\n let pObject = prop;\n if (typeof prop !== 'object') {\n pObject = { [prop]: value };\n }\n\n // Change object if any value changes actually.\n // @ts-expect-error utils should be converted to TS in order to resolve this.\n if (!compareObjects(this, pObject, Object.keys(pObject))) {\n const newRow = new Row(\n {\n ...this.#get(),\n ...(pObject as RowOptions)\n },\n this.#rsInternal\n );\n const cloned = [...getView().rows!];\n cloned.splice(index, 1, newRow);\n getView().rows = cloned;\n }\n }\n\n /** This fetches the latest data of the row using\n * {@link rsProps.apiContext.fetchRowData fetchRowData} and updates the same in the {@link View} and {@link Row}\n * @returns void\n */\n async updateRow(): Promise<void> {\n const { getView, getRsProps, getRsStateResolver, getRsStore } = this.#rsInternal;\n const rsProps = getRsProps();\n const { dispatch } = getRsStateResolver();\n const state = getRsStateResolver().getState();\n // TODO: Check if fetchRowData api is really needed? In case of grouped tables updating single row may cause issues. It is better to refresh whole view.\n const [rowData] =\n (await rsProps.apiContext.fetchRowData?.(\n deepCopy(state),\n getView().meta,\n getView().meta.itemKey,\n this[dataKey],\n {\n ...(getRsStore().refreshInProgress && {\n invalidateCache: true,\n invalidateCacheToken: getRsStore().refreshToken\n })\n }\n )) || [];\n const dataIndex = getView().data!.findIndex(\n row => row[getView().meta.itemKey] === rowData[getView().meta.itemKey]\n );\n const rowIndex = getView().rows!.findIndex(row => row.key === rowData[getView().meta.itemKey]);\n if (dataIndex > -1) {\n getView().setProp({\n data: [\n ...getView().data!.slice(0, dataIndex),\n rowData,\n ...getView().data!.slice(dataIndex + 1)\n ],\n rows: [\n ...getView().rows!.slice(0, rowIndex),\n new Row(\n {\n key: rowData[getView().meta.itemKey] as string,\n rowData\n },\n this.#rsInternal\n ),\n ...getView().rows!.slice(rowIndex + 1)\n ]\n });\n dispatch(actionForceUpdate());\n }\n }\n\n /**\n * Used to select/deselect a {@link Row}.\n * @param selected Flag to indicate the row is selected or not.\n */\n selectRow(selected = true): void {\n const { getRsStateResolver } = this.#rsInternal;\n const { dispatch } = getRsStateResolver();\n this.parent.setSingleSelectionRowKey(this.uniqueId ?? (this.key as string));\n\n dispatch(\n actionRowSelectionUpdate({\n key: this.key as string,\n selected,\n data: this.data,\n status: STATE.NOT_STARTED,\n mode: this.parent.meta.selectionMode\n })\n );\n }\n\n /**\n * Returns the ui props for the {@link Row} that can be used to build a row in DOM.\n *\n */\n getUIProps(): UIProps {\n const { getView } = this.#rsInternal;\n return {\n className: this.className,\n 'data-error-message': this.getRowError()?.message,\n [dataKey]: this[dataKey],\n role: this.role,\n 'aria-rowindex':\n // eslint-disable-next-line no-unsafe-optional-chaining\n this.parent.state.paginationOptions?.rootVirtualiser?.startIndex! +\n this.parent.rows!.findIndex(r => r === this)! +\n 1,\n onClick: getView().onRowClickAction?.bind(this, this.data),\n ...(!isRowReorderFieldEnabled(getView().meta) ? this.dragProps : {}),\n ...this.dropProps\n };\n }\n\n /**\n *\n * @returns the errors on the row.\n */\n getRowError(): DataError[string | number] | undefined {\n return this.parent.state.errors?.dataErrors?.[this.key as string | number];\n }\n\n /**\n * Returns the current row Header field and value.\n * This api is exposed to the consumers of Repeating structures to access the row header information of the current row.\n *\n * @public\n */\n getRowHeader(): RowHeader | undefined {\n let rowHeaderColumn: Column | undefined;\n const columns = this.parent.getContext().getColumns();\n for (const column of columns!) {\n if (column.field.isRowHeader) {\n rowHeaderColumn = column;\n break;\n }\n if (column.isFirstDataColumn) {\n rowHeaderColumn = column;\n }\n }\n if (!rowHeaderColumn) {\n return undefined;\n }\n return {\n field: rowHeaderColumn as Column,\n getValue: () => rowHeaderColumn!.getContext().getValue()\n };\n }\n\n /**\n * Returns the current row context.\n * This api can be exposed to the consumers of Repeating structures to access the basic info regarding Row.\n *\n * @public\n */\n getContext(): RowContext {\n const { getRsProps, getView } = this.#rsInternal;\n const rsProps = getRsProps();\n return {\n name: 'row',\n getValue: () => this.data,\n getParentContext: this.parent.getContext,\n getRowActionDetails: (rowContext: RowData) => {\n return (\n rsProps.apiContext.fetchRowActionDetails?.(\n rowContext[getView().meta.itemKey] as string,\n rowContext\n ) ?? Promise.resolve([])\n );\n },\n getDragProps: () => this.dragProps,\n selectRow: this.selectRow,\n refreshRow: this.updateRow,\n $selected: this.$selected,\n getRowError: this.getRowError,\n getRowHeader: this.getRowHeader\n };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-core",
|
|
3
|
-
"version": "9.0.0-build.
|
|
3
|
+
"version": "9.0.0-build.14.0",
|
|
4
4
|
"description": "Core headless UI library that the users can use to write their own UI and create repeating structures like table, gallery, timeline etc.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "9.0.0-build.
|
|
18
|
-
"@pega/cosmos-react-core": "9.0.0-build.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "9.0.0-build.14.0",
|
|
18
|
+
"@pega/cosmos-react-core": "9.0.0-build.14.0",
|
|
19
19
|
"@types/lodash.get": "^4.4.9",
|
|
20
20
|
"@types/uuid": "^9.0.0",
|
|
21
21
|
"dayjs": "^1.11.13",
|