@pega/lists-core 9.25.0 → 9.25.1-10
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/actions/actionConstants.d.ts +2 -0
- package/lib/src/core/actions/actionConstants.d.ts.map +1 -1
- package/lib/src/core/actions/actionConstants.js +3 -1
- package/lib/src/core/actions/actionConstants.js.map +1 -1
- package/lib/src/core/actions/actions.d.ts +8 -1
- package/lib/src/core/actions/actions.d.ts.map +1 -1
- package/lib/src/core/actions/actions.js +11 -0
- package/lib/src/core/actions/actions.js.map +1 -1
- package/lib/src/core/actions/actions.types.d.ts +10 -0
- package/lib/src/core/actions/actions.types.d.ts.map +1 -1
- package/lib/src/core/actions/actions.types.js.map +1 -1
- package/lib/src/core/features/featureFactory.d.ts.map +1 -1
- package/lib/src/core/features/featureFactory.js +2 -0
- package/lib/src/core/features/featureFactory.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js +24 -9
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.js +5 -2
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/masterDetail.d.ts +11 -0
- package/lib/src/core/features/uIFeatures/beforeRender/masterDetail.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/masterDetail.js +97 -0
- package/lib/src/core/features/uIFeatures/beforeRender/masterDetail.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.js +2 -0
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.js.map +1 -1
- package/lib/src/core/features/uIFeatures/index.d.ts +2 -0
- package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/index.js +2 -0
- package/lib/src/core/features/uIFeatures/index.js.map +1 -1
- package/lib/src/core/generators/RowGenerator.d.ts +11 -1
- package/lib/src/core/generators/RowGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/RowGenerator.js +36 -2
- package/lib/src/core/generators/RowGenerator.js.map +1 -1
- package/lib/src/core/generators/RowGenerator.types.d.ts +13 -1
- package/lib/src/core/generators/RowGenerator.types.d.ts.map +1 -1
- package/lib/src/core/generators/RowGenerator.types.js.map +1 -1
- package/lib/src/core/generators/ViewGenerator.d.ts +3 -1
- package/lib/src/core/generators/ViewGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/ViewGenerator.js +7 -1
- package/lib/src/core/generators/ViewGenerator.js.map +1 -1
- package/lib/src/core/generators/ViewGenerator.types.d.ts +21 -1
- package/lib/src/core/generators/ViewGenerator.types.d.ts.map +1 -1
- package/lib/src/core/generators/ViewGenerator.types.js.map +1 -1
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts +5 -0
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts.map +1 -1
- package/lib/src/core/generators/viewUtilityMethods.d.ts +18 -0
- package/lib/src/core/generators/viewUtilityMethods.d.ts.map +1 -1
- package/lib/src/core/generators/viewUtilityMethods.js +91 -0
- package/lib/src/core/generators/viewUtilityMethods.js.map +1 -1
- package/lib/src/core/reducers/error.d.ts +1 -0
- package/lib/src/core/reducers/error.d.ts.map +1 -1
- package/lib/src/core/reducers/index.d.ts +1 -0
- package/lib/src/core/reducers/index.d.ts.map +1 -1
- package/lib/src/core/reducers/index.js +3 -1
- package/lib/src/core/reducers/index.js.map +1 -1
- package/lib/src/core/reducers/masterDetail.d.ts +4 -0
- package/lib/src/core/reducers/masterDetail.d.ts.map +1 -0
- package/lib/src/core/reducers/masterDetail.js +23 -0
- package/lib/src/core/reducers/masterDetail.js.map +1 -0
- package/lib/src/core/reducers/personalizationReducer.d.ts +1 -1
- package/lib/src/core/utils/masterDetail.d.ts +8 -0
- package/lib/src/core/utils/masterDetail.d.ts.map +1 -0
- package/lib/src/core/utils/masterDetail.js +25 -0
- package/lib/src/core/utils/masterDetail.js.map +1 -0
- package/lib/src/core/utils/util.d.ts.map +1 -1
- package/lib/src/core/utils/util.js +3 -0
- package/lib/src/core/utils/util.js.map +1 -1
- package/lib/types/Meta.types.d.ts +21 -3
- package/lib/types/Meta.types.d.ts.map +1 -1
- package/lib/types/Meta.types.js.map +1 -1
- package/lib/types/State.types.d.ts +9 -0
- package/lib/types/State.types.d.ts.map +1 -1
- package/lib/types/State.types.js.map +1 -1
- package/lib/types.d.ts +9 -4
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH;;;;;GAKG;AACH,MAAM,2BAA2B,GAAG,CAClC,OAAqC,EACrC,YAAkC,EAClC,EAAE;IACF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;Y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AC,MAAM,CAAC,CAAC;4BACpD,0BAA0B,GAAG,IAAI,CAAC;4BAClC,oBAAoB,GAAG,IAAI,CAAC;wBAC9B,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC,CAAC;gBACH,0BAA0B,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;gBACjD,oBAAoB,GAAG,YAAY,CAAC;YACtC,CAAC;YACD,OAAO;QACT,CAAC;QAED,yHAAyH;QACzH,uBAAuB,CACrB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,eAAe,EAAE,MAAM;YAC7B,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI;YAC3B,YAAY,CAAC,UAAU,EAAE,CAAC,iBAAiB;YAC3C,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,cAAc;YACpB,KAAK,CAAC,mBAAmB,EAAE,uBAAuB;SACnD,CACF,CAAC;QACF,iCAAiC,CAC/B,CAAC,YAAY,CAAC,EACd,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1D,CAAC;QACF,iCAAiC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n actionColumnResize,\n actionColumnsAutoSize,\n actionColumnAutoSize,\n actionForceUpdate\n} from '../../../../actions/actions';\nimport { TEMPLATES } from '../../../../constants';\nimport { OOTB_COLUMNS, withMemoization } from '../../../../utils/util';\nimport type { FeatureProps } from '../../../featureFactory';\nimport type View from '../../../../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { State } from '../../../../../../types/State.types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../../RsStore';\n\nimport { autoSizeOfColumns } from './autoSize';\n\n/*\n * If columnWidths are undefined, there is no active personalization invloved in the current view\n * So triggering auto column sizing, which depends on column content.\n * in case of nested groupings, skipping group headers from being counted as a row\n */\n/**\n * Checks if {@link View.domContainer dom container} has any rows with visible cells.\n * @param columns\n * @param domContainer\n * @returns true if dom container has any rows available, otherwise false.\n */\nconst checkDomContainerHasAnyRows = (\n columns: NonNullable<View['columns']>,\n domContainer: View['domContainer']\n) => {\n for (const column of columns) {\n if (!column.hidden) {\n const cells = domContainer\n ? domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`)\n : [];\n if (cells.length > 1) {\n return true;\n }\n }\n }\n return false;\n};\n\n/**\n * Checks if any data rows are available in dom container. It does not includes grouped rows.\n * @returns true if data rows are available, otherwise false.\n */\nconst checkDomContainerHasDataRows = (domContainer: View['domContainer']) => {\n return !!(domContainer && domContainer.querySelectorAll('.row[aria-rowindex]').length);\n};\n\n/**\n * Autosizes the first visual column to account meta fields like expand collapse button\n */\nfunction autoSizeFirstVisualColumn([featureProps]: [featureProps: FeatureProps]) {\n const { getView, dispatch } = featureProps;\n const { columns = [], getDomContainer } = getView();\n const firstVisualCol = columns.find(c => c.isFirstVisualColumn);\n const domContainer = getDomContainer();\n if (firstVisualCol && domContainer) {\n dispatch(actionColumnAutoSize(firstVisualCol, domContainer, true));\n }\n}\n\n/**\n * Runs autosizing on out-of-the-box (OOTB) action columns in the view.\n */\nconst autosizeOotbActionColumns = ([featureProps]: [featureProps: FeatureProps]) => {\n const { getView, dispatch } = featureProps;\n const { columns = [], getDomContainer } = getView();\n const ootbColumns = columns?.filter(col => OOTB_COLUMNS.includes(col.field.id));\n const domContainer = getDomContainer();\n if (ootbColumns.length && domContainer) {\n dispatch(actionColumnsAutoSize(ootbColumns, domContainer, true));\n }\n};\n\n/**\n * Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.\n * @param param featureProps\n */\nexport function runColumnSizing([{ getView, getRsStore, dispatch }]: [\n featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps' | 'browserContext'>\n]) {\n const { columns = [], getDomContainer } = getView();\n\n const rsStore = getRsStore();\n const domContainer = getDomContainer();\n const runColumnSizingOnRowsAvailable =\n !rsStore.columnSizingTriggerdOnRowsAvailable && checkDomContainerHasDataRows(domContainer);\n\n // if there is no group/data row to size in DOM, don't run column sizing\n if (\n !checkDomContainerHasAnyRows(columns, domContainer) ||\n (rsStore.autosizeTriggered && !runColumnSizingOnRowsAvailable)\n ) {\n // if in current render cycle the rows were not painted, check for autosizing in next cycle\n if (!rsStore.autosizeTriggered) {\n dispatch(actionForceUpdate(false, { forceCalculateAutoWidth: true }));\n }\n return;\n }\n\n rsStore.autosizeTriggered = true;\n // skipping column animation on next run if column size changed after personalization change or delete\n rsStore.skipColumnAnimationOnNextRun = true;\n\n if (runColumnSizingOnRowsAvailable) {\n // Fresh column sizing will run only once for a view when the rows are loaded for the first time in DOM\n rsStore.columnSizingTriggerdOnRowsAvailable = true;\n dispatch(actionColumnsAutoSize(columns, domContainer!, true));\n } else {\n // Incremental column sizing on show/hide of columns or table refresh or on view change with grouping applied\n dispatch(actionColumnResize(autoSizeOfColumns(columns, domContainer!)));\n }\n}\n\n/**\n * It resets the {@link RsStore.autosizeTriggered autosize status} on RsStore.\n * @param param featureProps\n */\nfunction resetAutosizeStatus([{ getRsStore }]: [featureProps: FeatureProps]) {\n // This parent flag checks if any type of sizing is triggered on the table including table header/groups/rows.\n getRsStore().autosizeTriggered = false;\n}\n\n/**\n * Manages the autosizing feature of columns in the view. This includes the following actions:\n * 1. **Executing Autosize for All Columns**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link View.rows}\n * - {@link RsStore.autosizeTriggered}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.forceUpdateFeatures.forceCalculateAutoWidth}\n * 2. **Resetting Autosize Status**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.customFields}\n *\n * 3. **Executing Autosize on First Visual Column**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.groups}\n * - {@link State.responsive.sm}\n */\nexport default () => {\n const memoizedRunColumnSizing = withMemoization(runColumnSizing);\n const memoizedResetAutosizeStatus = withMemoization(resetAutosizeStatus);\n const memoizedAutosizeFirstVisualColumn = withMemoization(autoSizeFirstVisualColumn);\n const memoizedAutosizeOotbActionColumns = withMemoization(autosizeOotbActionColumns);\n let domContainerResizeObserver: ResizeObserver | null = null;\n let observedDomContainer: Element | null = null;\n return function execute(featureProps: FeatureProps) {\n /**\n * Column sizing is Table-only. When template switches away from Table, clear any pending observer.\n * This prevents an observer created in a previous hidden-Table render from firing late and\n * triggering sizing work against the current non-Table template\n */\n if (featureProps.getView().template !== TEMPLATES.TABLE) {\n domContainerResizeObserver?.disconnect();\n domContainerResizeObserver = null;\n observedDomContainer = null;\n return;\n }\n const state = featureProps.getState();\n // AutoSize by default\n memoizedResetAutosizeStatus(\n [featureProps],\n [state.personalization?.active, state.refresh, state.hiddenColumns, state.customFields]\n );\n\n /**\n * If one of the table's ancestors is in a hidden state, the autosize calculations will not\n * function correctly since the domContainer's offsetWidth will be 0. A single ResizeObserver\n * is attached here (once per hidden period) and fires all sizing functions as soon as the\n * container gains width.\n *\n * The memoized versions are called intentionally so their dependency arrays are initialized\n * with the current state values. If the raw functions were called instead, the memoized\n * wrappers would still have no recorded deps and would re-run on the very next `execute`\n * cycle, causing each sizing function to fire twice.\n *\n * Any function that performs sizing calculations should be called within this observer callback.\n */\n const domContainer = featureProps.getView().getDomContainer();\n if (domContainer && domContainer.offsetWidth === 0) {\n if (domContainerResizeObserver && observedDomContainer !== domContainer) {\n // The DOM container was replaced while the observer was still pending (e.g. component remount).\n domContainerResizeObserver.disconnect();\n domContainerResizeObserver = null;\n observedDomContainer = null;\n }\n\n if (!domContainerResizeObserver) {\n domContainerResizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.contentRect.width > 0) {\n const currentState = featureProps.getState();\n memoizedRunColumnSizing(\n [featureProps],\n [\n currentState.personalization?.active,\n featureProps.getView().rows,\n featureProps.getRsStore().autosizeTriggered,\n currentState.refresh,\n currentState.visibleColumns,\n currentState.forceUpdateFeatures?.forceCalculateAutoWidth\n ]\n );\n memoizedAutosizeFirstVisualColumn(\n [featureProps],\n [currentState.groups, currentState.responsive?.sm, currentState.colOrder?.[0]]\n );\n memoizedAutosizeOotbActionColumns(\n [featureProps],\n [currentState.selectedHeightOption]\n );\n domContainerResizeObserver?.unobserve(entry.target);\n domContainerResizeObserver = null;\n observedDomContainer = null;\n }\n }\n });\n domContainerResizeObserver.observe(domContainer);\n observedDomContainer = domContainer;\n }\n return;\n }\n\n // These are still needed as the Resize observer will work only once but we need to run sizing on user operations as well\n memoizedRunColumnSizing(\n [featureProps],\n [\n state.personalization?.active,\n featureProps.getView().rows,\n featureProps.getRsStore().autosizeTriggered,\n state.refresh,\n state.visibleColumns,\n state.forceUpdateFeatures?.forceCalculateAutoWidth\n ]\n );\n memoizedAutosizeFirstVisualColumn(\n [featureProps],\n [state.groups, state.responsive?.sm, state.colOrder?.[0]]\n );\n memoizedAutosizeOotbActionColumns([featureProps], [state.selectedHeightOption]);\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;GAIG;AACH;;;;;GAKG;AACH,MAAM,2BAA2B,GAA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MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1D,CAAC;QACF,iCAAiC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n actionColumnResize,\n actionColumnsAutoSize,\n actionForceUpdate\n} from '../../../../actions/actions';\nimport { TEMPLATES } from '../../../../constants';\nimport { OOTB_COLUMNS, withMemoization } from '../../../../utils/util';\nimport type { FeatureProps } from '../../../featureFactory';\nimport type View from '../../../../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { State } from '../../../../../../types/State.types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../../RsStore';\n\nimport { autoSizeOfColumn, autoSizeOfColumns } from './autoSize';\n\n/*\n * If columnWidths are undefined, there is no active personalization invloved in the current view\n * So triggering auto column sizing, which depends on column content.\n * in case of nested groupings, skipping group headers from being counted as a row\n */\n/**\n * Checks if {@link View.domContainer dom container} has any rows with visible cells.\n * @param columns\n * @param domContainer\n * @returns true if dom container has any rows available, otherwise false.\n */\nconst checkDomContainerHasAnyRows = (\n columns: NonNullable<View['columns']>,\n domContainer: View['domContainer']\n) => {\n for (const column of columns) {\n if (!column.hidden) {\n const cells = domContainer\n ? domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`)\n : [];\n if (cells.length > 1) {\n return true;\n }\n }\n }\n return false;\n};\n\n/**\n * Checks if any data rows are available in dom container. It does not includes grouped rows.\n * @returns true if data rows are available, otherwise false.\n */\nconst checkDomContainerHasDataRows = (domContainer: View['domContainer']) => {\n return !!(domContainer && domContainer.querySelectorAll('.row[aria-rowindex]').length);\n};\n\n/**\n * Autosizes the first visual column to account meta fields like expand collapse button\n */\nfunction autoSizeFirstVisualColumnOnGroupChange([featureProps]: [featureProps: FeatureProps]) {\n const { getView, getState, dispatch } = featureProps;\n const { columns = [], getDomContainer } = getView();\n const groupingIsActive = Boolean(getState().groups?.length);\n\n if (!groupingIsActive) {\n return;\n }\n\n const firstVisualCol = columns.find(c => c.isFirstVisualColumn);\n const domContainer = getDomContainer();\n if (!firstVisualCol || !domContainer) {\n return;\n }\n\n const calculatedWidth = autoSizeOfColumn(firstVisualCol, domContainer, true);\n // If the calculated width is greater than the current width that means the column was not wide enough to accommodate the expand/collapse button(32px)\n // So we need to dispatch an action to update the column width.\n const shouldDispatch = calculatedWidth > (firstVisualCol.currentWidth ?? 0);\n\n // TODO: On removal of grouping, we should remove the extra width added to the first visual column. This cannot be handled reliably currently.\n // The correct architecture is to have a dedicated grouped-icon column, that will be shown/hidden based on grouping state, and will not affect the data column width.\n if (shouldDispatch) {\n dispatch(\n actionColumnResize({\n [firstVisualCol.field.id]: calculatedWidth\n })\n );\n }\n}\n\n/**\n * Runs autosizing on out-of-the-box (OOTB) action columns in the view.\n */\nconst autosizeOotbActionColumns = ([featureProps]: [featureProps: FeatureProps]) => {\n const { getView, dispatch } = featureProps;\n const { columns = [], getDomContainer } = getView();\n const ootbColumns = columns?.filter(col => OOTB_COLUMNS.includes(col.field.id));\n const domContainer = getDomContainer();\n if (ootbColumns.length && domContainer) {\n dispatch(actionColumnsAutoSize(ootbColumns, domContainer, true));\n }\n};\n\n/**\n * Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.\n * @param param featureProps\n */\nexport function runColumnSizing([{ getView, getRsStore, dispatch }]: [\n featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps' | 'browserContext'>\n]) {\n const { columns = [], getDomContainer } = getView();\n\n const rsStore = getRsStore();\n const domContainer = getDomContainer();\n const runColumnSizingOnRowsAvailable =\n !rsStore.columnSizingTriggerdOnRowsAvailable && checkDomContainerHasDataRows(domContainer);\n\n // if there is no group/data row to size in DOM, don't run column sizing\n if (\n !checkDomContainerHasAnyRows(columns, domContainer) ||\n (rsStore.autosizeTriggered && !runColumnSizingOnRowsAvailable)\n ) {\n // if in current render cycle the rows were not painted, check for autosizing in next cycle\n if (!rsStore.autosizeTriggered) {\n dispatch(actionForceUpdate(false, { forceCalculateAutoWidth: true }));\n }\n return;\n }\n\n rsStore.autosizeTriggered = true;\n // skipping column animation on next run if column size changed after personalization change or delete\n rsStore.skipColumnAnimationOnNextRun = true;\n\n if (runColumnSizingOnRowsAvailable) {\n // Fresh column sizing will run only once for a view when the rows are loaded for the first time in DOM\n rsStore.columnSizingTriggerdOnRowsAvailable = true;\n dispatch(actionColumnsAutoSize(columns, domContainer!, true));\n } else {\n // Incremental column sizing on show/hide of columns or table refresh or on view change with grouping applied\n dispatch(actionColumnResize(autoSizeOfColumns(columns, domContainer!)));\n }\n}\n\n/**\n * It resets the {@link RsStore.autosizeTriggered autosize status} on RsStore.\n * @param param featureProps\n */\nfunction resetAutosizeStatus([{ getRsStore }]: [featureProps: FeatureProps]) {\n // This parent flag checks if any type of sizing is triggered on the table including table header/groups/rows.\n getRsStore().autosizeTriggered = false;\n}\n\n/**\n * Manages the autosizing feature of columns in the view. This includes the following actions:\n * 1. **Executing Autosize for All Columns**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link View.rows}\n * - {@link RsStore.autosizeTriggered}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.forceUpdateFeatures.forceCalculateAutoWidth}\n * 2. **Resetting Autosize Status**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.customFields}\n *\n * 3. **Executing Autosize on First Visual Column**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.groups}\n * - {@link State.responsive.sm}\n */\nexport default () => {\n const memoizedRunColumnSizing = withMemoization(runColumnSizing);\n const memoizedResetAutosizeStatus = withMemoization(resetAutosizeStatus);\n const memoizedAutosizeFirstVisualColumnOnGroupChange = withMemoization(\n autoSizeFirstVisualColumnOnGroupChange\n );\n const memoizedAutosizeOotbActionColumns = withMemoization(autosizeOotbActionColumns);\n let domContainerResizeObserver: ResizeObserver | null = null;\n let observedDomContainer: Element | null = null;\n return function execute(featureProps: FeatureProps) {\n /**\n * Column sizing is Table-only. When template switches away from Table, clear any pending observer.\n * This prevents an observer created in a previous hidden-Table render from firing late and\n * triggering sizing work against the current non-Table template\n */\n if (featureProps.getView().template !== TEMPLATES.TABLE) {\n domContainerResizeObserver?.disconnect();\n domContainerResizeObserver = null;\n observedDomContainer = null;\n return;\n }\n const state = featureProps.getState();\n // AutoSize by default\n memoizedResetAutosizeStatus(\n [featureProps],\n [state.personalization?.active, state.refresh, state.hiddenColumns, state.customFields]\n );\n\n /**\n * If one of the table's ancestors is in a hidden state, the autosize calculations will not\n * function correctly since the domContainer's offsetWidth will be 0. A single ResizeObserver\n * is attached here (once per hidden period) and fires all sizing functions as soon as the\n * container gains width.\n *\n * The memoized versions are called intentionally so their dependency arrays are initialized\n * with the current state values. If the raw functions were called instead, the memoized\n * wrappers would still have no recorded deps and would re-run on the very next `execute`\n * cycle, causing each sizing function to fire twice.\n *\n * Any function that performs sizing calculations should be called within this observer callback.\n */\n const domContainer = featureProps.getView().getDomContainer();\n if (domContainer && domContainer.offsetWidth === 0) {\n if (domContainerResizeObserver && observedDomContainer !== domContainer) {\n // The DOM container was replaced while the observer was still pending (e.g. component remount).\n domContainerResizeObserver.disconnect();\n domContainerResizeObserver = null;\n observedDomContainer = null;\n }\n\n if (!domContainerResizeObserver) {\n domContainerResizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.contentRect.width > 0) {\n const currentState = featureProps.getState();\n memoizedRunColumnSizing(\n [featureProps],\n [\n currentState.personalization?.active,\n featureProps.getView().rows,\n featureProps.getRsStore().autosizeTriggered,\n currentState.refresh,\n currentState.visibleColumns,\n currentState.forceUpdateFeatures?.forceCalculateAutoWidth\n ]\n );\n memoizedAutosizeFirstVisualColumnOnGroupChange(\n [featureProps],\n [currentState.groups, currentState.responsive?.sm, currentState.colOrder?.[0]]\n );\n memoizedAutosizeOotbActionColumns(\n [featureProps],\n [currentState.selectedHeightOption]\n );\n domContainerResizeObserver?.unobserve(entry.target);\n domContainerResizeObserver = null;\n observedDomContainer = null;\n }\n }\n });\n domContainerResizeObserver.observe(domContainer);\n observedDomContainer = domContainer;\n }\n return;\n }\n\n // These are still needed as the Resize observer will work only once but we need to run sizing on user operations as well\n memoizedRunColumnSizing(\n [featureProps],\n [\n state.personalization?.active,\n featureProps.getView().rows,\n featureProps.getRsStore().autosizeTriggered,\n state.refresh,\n state.visibleColumns,\n state.forceUpdateFeatures?.forceCalculateAutoWidth\n ]\n );\n memoizedAutosizeFirstVisualColumnOnGroupChange(\n [featureProps],\n [state.groups, state.responsive?.sm, state.colOrder?.[0]]\n );\n memoizedAutosizeOotbActionColumns([featureProps], [state.selectedHeightOption]);\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeTemplate.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/changeTemplate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"changeTemplate.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/changeTemplate.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE;;;;;;;;GAQG;+BAgCuB,cAAc,wBAAwB;AA/BhE,wBAmCE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { REPEATING_STRUCTURE_TEMPLATES } from '../../../../../types/Meta.types';
|
|
2
|
-
import { actionAddGroups, actionSetGroupSnapshot } from '../../../actions/actions';
|
|
2
|
+
import { actionAddGroups, actionCloseMasterDetail, actionSetGroupSnapshot } from '../../../actions/actions';
|
|
3
3
|
import { withMemoization } from '../../../utils/util';
|
|
4
4
|
/**
|
|
5
5
|
* Synchronizes the runtime-only {@link State.currentTemplate currentTemplate} state slice
|
|
@@ -13,10 +13,13 @@ import { withMemoization } from '../../../utils/util';
|
|
|
13
13
|
export default () => {
|
|
14
14
|
const changeTemplate = ([{ getView, getState, dispatch }]) => {
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
-
const { currentTemplate, groups, _groupsSnapshot } = getState();
|
|
16
|
+
const { currentTemplate, groups, _groupsSnapshot, masterDetail } = getState();
|
|
17
17
|
const resolved = !getView().meta.allowSwitchTemplate
|
|
18
18
|
? getView().meta.template
|
|
19
19
|
: currentTemplate ?? getView().meta.template;
|
|
20
|
+
if (resolved !== REPEATING_STRUCTURE_TEMPLATES.TABLE && masterDetail) {
|
|
21
|
+
dispatch(actionCloseMasterDetail());
|
|
22
|
+
}
|
|
20
23
|
if (resolved === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {
|
|
21
24
|
if (groups?.length) {
|
|
22
25
|
dispatch(actionSetGroupSnapshot(groups));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeTemplate.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/changeTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"changeTemplate.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/changeTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;;;;;;;GAQG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,cAAc,GAAG,CAAC,C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,CAAC,QAAQ,EAAE,CAAC;QACtC,sBAAsB,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;IAClG,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { REPEATING_STRUCTURE_TEMPLATES } from '../../../../../types/Meta.types';\nimport {\n actionAddGroups,\n actionCloseMasterDetail,\n actionSetGroupSnapshot\n} from '../../../actions/actions';\nimport { withMemoization } from '../../../utils/util';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\n\n/**\n * Synchronizes the runtime-only {@link State.currentTemplate currentTemplate} state slice\n * onto the {@link View.template view.template} property.\n *\n * Gallery does not support grouping; on transition into Gallery any active\n * {@link State.groups groups} are snapshotted into {@link State._groupsSnapshot _groupsSnapshot}\n * and cleared, then restored when the user switches back to a grouping-capable template\n * (e.g. Table).\n */\nexport default () => {\n const changeTemplate = ([{ getView, getState, dispatch }]: [\n featureProps: BeforeRenderFeatureProps\n ]) => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { currentTemplate, groups, _groupsSnapshot, masterDetail } = getState();\n const resolved = !getView().meta.allowSwitchTemplate\n ? getView().meta.template\n : currentTemplate ?? getView().meta.template;\n\n if (resolved !== REPEATING_STRUCTURE_TEMPLATES.TABLE && masterDetail) {\n dispatch(actionCloseMasterDetail());\n }\n\n if (resolved === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {\n if (groups?.length) {\n dispatch(actionSetGroupSnapshot(groups));\n dispatch(actionAddGroups([]));\n }\n } else if (_groupsSnapshot?.length && resolved === REPEATING_STRUCTURE_TEMPLATES.TABLE) {\n dispatch(actionAddGroups(_groupsSnapshot));\n dispatch(actionSetGroupSnapshot(undefined));\n }\n\n if (resolved !== getView().template) {\n getView().setProp('template', resolved);\n }\n };\n\n const memoizedChangeTemplate = withMemoization(changeTemplate);\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const state = featureProps.getState();\n memoizedChangeTemplate([featureProps], [state.currentTemplate, state?.personalization?.active]);\n };\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type RsInternal from '../../../RsInternal';
|
|
2
|
+
import type { BeforeRenderFeatureProps } from '../../featureFactory';
|
|
3
|
+
/**
|
|
4
|
+
* 1. Synchronizes Master Detail selection from {@link State.masterDetail} into the generated
|
|
5
|
+
* {@link View.masterDetail View} and active Row when the state.masterDetail or meta.masterDetail changes.
|
|
6
|
+
* 2. Clears the generated selection when Master Detail configuration or state is absent.
|
|
7
|
+
* 3. Clears {@link State.masterDetail} after {@link AFTER_FETCH} when the selected Row is no
|
|
8
|
+
* longer generated.
|
|
9
|
+
*/
|
|
10
|
+
export default function masterDetail(rsInternal: RsInternal): (featureProps: BeforeRenderFeatureProps) => void;
|
|
11
|
+
//# sourceMappingURL=masterDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterDetail.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/masterDetail.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAsErE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,UAAU,EAAE,UAAU,IAwCjC,cAAc,wBAAwB,UAI/D"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { AFTER_FETCH } from '../../../pubSub/events';
|
|
2
|
+
import { actionCloseMasterDetail } from '../../../actions/actions';
|
|
3
|
+
import { deepEqual, withMemoization } from '../../../utils/util';
|
|
4
|
+
import getMasterDetailSelection, { isMasterDetailSupported } from '../../../utils/masterDetail';
|
|
5
|
+
/** Returns whether two selections have the same derived row and navigation state. */
|
|
6
|
+
function hasSameSelection(previous, next) {
|
|
7
|
+
return (previous?.rowKey === next.rowKey &&
|
|
8
|
+
previous?.row === next.row &&
|
|
9
|
+
previous?.hasPrevious === next.hasPrevious &&
|
|
10
|
+
previous?.hasNext === next.hasNext &&
|
|
11
|
+
previous?.nestedTarget === next.nestedTarget &&
|
|
12
|
+
previous?.viewName === next.viewName);
|
|
13
|
+
}
|
|
14
|
+
/** Moves the Master Detail active marker from the previous row to the selected row. */
|
|
15
|
+
function updateActiveRow(view, selectedRow) {
|
|
16
|
+
const activeRow = view.rows?.find(row => row.masterDetailActive);
|
|
17
|
+
if (activeRow && activeRow !== selectedRow) {
|
|
18
|
+
activeRow.setProp({ masterDetailActive: false });
|
|
19
|
+
}
|
|
20
|
+
if (selectedRow && !selectedRow.masterDetailActive) {
|
|
21
|
+
selectedRow.setProp({ masterDetailActive: true });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Clears the Master Detail selection from Row and View generators */
|
|
25
|
+
function clearMasterDetail(view) {
|
|
26
|
+
updateActiveRow(view, undefined);
|
|
27
|
+
if (view.masterDetail) {
|
|
28
|
+
view.setProp({ masterDetail: undefined });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Apply master detail information to Row and View generators. */
|
|
32
|
+
function applySelection(view, selection) {
|
|
33
|
+
updateActiveRow(view, selection.row);
|
|
34
|
+
// Navigation metadata is stored only on the View and must survive selection reconciliation.
|
|
35
|
+
const { nestedTarget, viewName } = view.masterDetail ?? {};
|
|
36
|
+
const nextSelection = { ...selection, nestedTarget, viewName };
|
|
37
|
+
// refreshKey is intentionally omitted from this comparison so a refresh signal is retained.
|
|
38
|
+
if (!hasSameSelection(view.masterDetail, nextSelection)) {
|
|
39
|
+
view.setProp({ masterDetail: nextSelection });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Synchronizes Master Detail state with the View and Row generators. */
|
|
43
|
+
function syncMasterDetail([featureProps]) {
|
|
44
|
+
const state = featureProps.getState();
|
|
45
|
+
if (!isMasterDetailSupported(featureProps.getView()) || !state.masterDetail) {
|
|
46
|
+
clearMasterDetail(featureProps.getView());
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const selection = getMasterDetailSelection(featureProps.getView(), state);
|
|
50
|
+
if (selection) {
|
|
51
|
+
applySelection(featureProps.getView(), selection);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 1. Synchronizes Master Detail selection from {@link State.masterDetail} into the generated
|
|
56
|
+
* {@link View.masterDetail View} and active Row when the state.masterDetail or meta.masterDetail changes.
|
|
57
|
+
* 2. Clears the generated selection when Master Detail configuration or state is absent.
|
|
58
|
+
* 3. Clears {@link State.masterDetail} after {@link AFTER_FETCH} when the selected Row is no
|
|
59
|
+
* longer generated.
|
|
60
|
+
*/
|
|
61
|
+
export default function masterDetail(rsInternal) {
|
|
62
|
+
/** Creates the complete feature context required by the after-fetch reconciliation. */
|
|
63
|
+
const getFeatureProps = () => ({
|
|
64
|
+
getState: rsInternal.getRsStateResolver().getState,
|
|
65
|
+
getView: rsInternal.getView,
|
|
66
|
+
getRsStore: rsInternal.getRsStore,
|
|
67
|
+
getRsProps: rsInternal.getRsProps,
|
|
68
|
+
getOriginalState: rsInternal.getRsStateResolver().getOriginalState,
|
|
69
|
+
dispatch: rsInternal.getRsStateResolver().dispatch,
|
|
70
|
+
queuedActions: [],
|
|
71
|
+
browserContext: rsInternal.getBrowserContext()
|
|
72
|
+
});
|
|
73
|
+
const memoizedSync = withMemoization(syncMasterDetail);
|
|
74
|
+
rsInternal.getPubSubUtils().subscribe(AFTER_FETCH, () => {
|
|
75
|
+
const featureProps = getFeatureProps();
|
|
76
|
+
const state = featureProps.getState();
|
|
77
|
+
if (!isMasterDetailSupported(featureProps.getView()) || !state.masterDetail) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const masterDetailRow = featureProps.getView().rows?.find(row => row.key === state.masterDetail?.rowKey &&
|
|
81
|
+
featureProps.getView().masterDetail?.rowKey === state.masterDetail?.rowKey &&
|
|
82
|
+
// Compare row data because index-based item keys can be reused after a row is removed.
|
|
83
|
+
deepEqual(row.data, featureProps.getView().masterDetail?.row.data));
|
|
84
|
+
// Clear Master Detail when its selected record is no longer in the generated rows.
|
|
85
|
+
if (!masterDetailRow) {
|
|
86
|
+
featureProps.dispatch(actionCloseMasterDetail());
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// If row is still present then call sync again to update any stale context if present(like hasNext/hasPrevious)
|
|
90
|
+
syncMasterDetail([featureProps]);
|
|
91
|
+
});
|
|
92
|
+
return function execute(featureProps) {
|
|
93
|
+
const state = featureProps.getState();
|
|
94
|
+
memoizedSync([featureProps], [state.masterDetail, featureProps.getView().meta.masterDetail]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=masterDetail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterDetail.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/masterDetail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,wBAAwB,EAAE,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMhG,qFAAqF;AACrF,SAAS,gBAAgB,CACvB,QAA2C,EAC3C,IAA2B;IAE3B,OAAO,CACL,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,MAAM;QAChC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG;QAC1B,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC,WAAW;QAC1C,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC,OAAO;QAClC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC,YAAY;QAC5C,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,QAAQ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ACtC,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YAC5E,OAAO;QACT,CAAC;QAED,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CACvD,GAAG,CAAC,EAAE,CACJ,GAAG,CAAC,GAAG,KAAK,KAAK,CAAC,YAAY,EAAE,MAAM;YACtC,YAAY,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,KAAK,CAAC,YAAY,EAAE,MAAM;YAC1E,uFAAuF;YACvF,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,CACrE,CAAC;QAEF,mFAAmF;QACnF,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,YAAY,CAAC,QAAQ,CAAC,uBAAuB,EAAE,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QAED,gHAAgH;QAChH,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,OAAO,CAAC,YAAsC;QAC5D,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,YAAY,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { AFTER_FETCH } from '../../../pubSub/events';\nimport { actionCloseMasterDetail } from '../../../actions/actions';\nimport { deepEqual, withMemoization } from '../../../utils/util';\nimport getMasterDetailSelection, { isMasterDetailSupported } from '../../../utils/masterDetail';\nimport type RsInternal from '../../../RsInternal';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\nimport type View from '../../../generators/ViewGenerator';\nimport type { MasterDetailSelection } from '../../../generators/ViewGenerator.types';\n\n/** Returns whether two selections have the same derived row and navigation state. */\nfunction hasSameSelection(\n previous: MasterDetailSelection | undefined,\n next: MasterDetailSelection\n): boolean {\n return (\n previous?.rowKey === next.rowKey &&\n previous?.row === next.row &&\n previous?.hasPrevious === next.hasPrevious &&\n previous?.hasNext === next.hasNext &&\n previous?.nestedTarget === next.nestedTarget &&\n previous?.viewName === next.viewName\n );\n}\n\n/** Moves the Master Detail active marker from the previous row to the selected row. */\nfunction updateActiveRow(view: View, selectedRow: MasterDetailSelection['row'] | undefined): void {\n const activeRow = view.rows?.find(row => row.masterDetailActive);\n\n if (activeRow && activeRow !== selectedRow) {\n activeRow.setProp({ masterDetailActive: false });\n }\n if (selectedRow && !selectedRow.masterDetailActive) {\n selectedRow.setProp({ masterDetailActive: true });\n }\n}\n\n/** Clears the Master Detail selection from Row and View generators */\nfunction clearMasterDetail(view: View): void {\n updateActiveRow(view, undefined);\n if (view.masterDetail) {\n view.setProp({ masterDetail: undefined });\n }\n}\n\n/** Apply master detail information to Row and View generators. */\nfunction applySelection(view: View, selection: MasterDetailSelection): void {\n updateActiveRow(view, selection.row);\n\n // Navigation metadata is stored only on the View and must survive selection reconciliation.\n const { nestedTarget, viewName } = view.masterDetail ?? {};\n const nextSelection = { ...selection, nestedTarget, viewName };\n\n // refreshKey is intentionally omitted from this comparison so a refresh signal is retained.\n if (!hasSameSelection(view.masterDetail, nextSelection)) {\n view.setProp({ masterDetail: nextSelection });\n }\n}\n\n/** Synchronizes Master Detail state with the View and Row generators. */\nfunction syncMasterDetail([featureProps]: [\n Pick<BeforeRenderFeatureProps, 'getState' | 'getView' | 'dispatch'>\n]): void {\n const state = featureProps.getState();\n\n if (!isMasterDetailSupported(featureProps.getView()) || !state.masterDetail) {\n clearMasterDetail(featureProps.getView());\n return;\n }\n\n const selection = getMasterDetailSelection(featureProps.getView(), state);\n if (selection) {\n applySelection(featureProps.getView(), selection);\n }\n}\n\n/**\n * 1. Synchronizes Master Detail selection from {@link State.masterDetail} into the generated\n * {@link View.masterDetail View} and active Row when the state.masterDetail or meta.masterDetail changes.\n * 2. Clears the generated selection when Master Detail configuration or state is absent.\n * 3. Clears {@link State.masterDetail} after {@link AFTER_FETCH} when the selected Row is no\n * longer generated.\n */\nexport default function masterDetail(rsInternal: RsInternal) {\n /** Creates the complete feature context required by the after-fetch reconciliation. */\n const getFeatureProps = (): BeforeRenderFeatureProps => ({\n getState: rsInternal.getRsStateResolver().getState,\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getOriginalState: rsInternal.getRsStateResolver().getOriginalState,\n dispatch: rsInternal.getRsStateResolver().dispatch,\n queuedActions: [],\n browserContext: rsInternal.getBrowserContext()\n });\n\n const memoizedSync = withMemoization(syncMasterDetail);\n\n rsInternal.getPubSubUtils().subscribe(AFTER_FETCH, () => {\n const featureProps = getFeatureProps();\n const state = featureProps.getState();\n if (!isMasterDetailSupported(featureProps.getView()) || !state.masterDetail) {\n return;\n }\n\n const masterDetailRow = featureProps.getView().rows?.find(\n row =>\n row.key === state.masterDetail?.rowKey &&\n featureProps.getView().masterDetail?.rowKey === state.masterDetail?.rowKey &&\n // Compare row data because index-based item keys can be reused after a row is removed.\n deepEqual(row.data, featureProps.getView().masterDetail?.row.data)\n );\n\n // Clear Master Detail when its selected record is no longer in the generated rows.\n if (!masterDetailRow) {\n featureProps.dispatch(actionCloseMasterDetail());\n return;\n }\n\n // If row is still present then call sync again to update any stale context if present(like hasNext/hasPrevious)\n syncMasterDetail([featureProps]);\n });\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const state = featureProps.getState();\n memoizedSync([featureProps], [state.masterDetail, featureProps.getView().meta.masterDetail]);\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareRows.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareRows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareRows.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareRows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAuBlD;;GAEG;yBACa,YAAY,UAAU;AAAtC,wBAKE"}
|
|
@@ -10,6 +10,7 @@ function prepareRows([rsInternal]) {
|
|
|
10
10
|
const key = String(itemKey ?? index);
|
|
11
11
|
// If the row already existed in the previous data and we have a row object for that, don't create new row.
|
|
12
12
|
// This will help in memoization and thus improving performance.
|
|
13
|
+
// In case of duplicate keys or empty itemKey, this optimization will never work since reactKey will be uniqueID and it will never match with key.
|
|
13
14
|
const existingRow = getView().rows?.find(r => r.reactKey === key && deepEqual(r.data, d));
|
|
14
15
|
if (existingRow)
|
|
15
16
|
return existingRow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareRows.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareRows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,GAAG,MAAM,kCAAkC,CAAC;AAKnD,SAAS,WAAW,CAAC,CAAC,UAAU,CAA2B;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAC/B,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC;IACvF,MAAM,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,IA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TER_FETCH } from '../../../pubSub/events';\nimport Row from '../../../generators/RowGenerator';\nimport type RsInternal from '../../../RsInternal';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type View from '../../../generators/ViewGenerator';\n\nfunction prepareRows([rsInternal]: [rsInternal: RsInternal]) {\n const { getView } = rsInternal;\n const itemKeys = getView().data?.map((d, index) => d[getView().meta.itemKey] ?? index);\n const hasDuplicateKeys = hasDuplicates(itemKeys);\n const rows = getView().data?.map((d, index) => {\n const itemKey = d[getView().meta.itemKey];\n const key = String(itemKey ?? index);\n // If the row already existed in the previous data and we have a row object for that, don't create new row.\n // This will help in memoization and thus improving performance.\n const existingRow = getView().rows?.find(r => r.reactKey === key && deepEqual(r.data, d));\n if (existingRow) return existingRow;\n\n const uniqueId = hasDuplicateKeys || isEmpty(itemKey) ? crypto.randomUUID() : null;\n return new Row({ key, rowData: d, uniqueId }, rsInternal);\n });\n getView().rows = rows;\n}\n\n/**\n * Prepare {@link View.rows rows} for the view from view {@link View.data data}. This is triggered on publish of `AFTER_FETCH` event.\n */\nexport default (rsInternal: RsInternal) => {\n const memoizedPrepareRows = withMemoization(prepareRows);\n rsInternal.getPubSubUtils().subscribe(AFTER_FETCH, () => {\n memoizedPrepareRows([rsInternal], [rsInternal, rsInternal.getView().data]);\n });\n};\n"]}
|
|
1
|
+
{"version":3,"file":"prepareRows.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/prepareRows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,GAAG,MAAM,kCAAkC,CAAC;AAKnD,SAAS,WAAW,CAAC,CAAC,UAAU,CAA2B;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAC/B,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC,I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AG,EAAE;QACtD,mBAAmB,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { withMemoization, hasDuplicates, deepEqual, isEmpty } from '../../../utils/util';\nimport { AFTER_FETCH } from '../../../pubSub/events';\nimport Row from '../../../generators/RowGenerator';\nimport type RsInternal from '../../../RsInternal';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type View from '../../../generators/ViewGenerator';\n\nfunction prepareRows([rsInternal]: [rsInternal: RsInternal]) {\n const { getView } = rsInternal;\n const itemKeys = getView().data?.map((d, index) => d[getView().meta.itemKey] ?? index);\n const hasDuplicateKeys = hasDuplicates(itemKeys);\n const rows = getView().data?.map((d, index) => {\n const itemKey = d[getView().meta.itemKey];\n const key = String(itemKey ?? index);\n // If the row already existed in the previous data and we have a row object for that, don't create new row.\n // This will help in memoization and thus improving performance.\n // In case of duplicate keys or empty itemKey, this optimization will never work since reactKey will be uniqueID and it will never match with key.\n const existingRow = getView().rows?.find(r => r.reactKey === key && deepEqual(r.data, d));\n if (existingRow) return existingRow;\n\n const uniqueId = hasDuplicateKeys || isEmpty(itemKey) ? crypto.randomUUID() : null;\n return new Row({ key, rowData: d, uniqueId }, rsInternal);\n });\n getView().rows = rows;\n}\n\n/**\n * Prepare {@link View.rows rows} for the view from view {@link View.data data}. This is triggered on publish of `AFTER_FETCH` event.\n */\nexport default (rsInternal: RsInternal) => {\n const memoizedPrepareRows = withMemoization(prepareRows);\n rsInternal.getPubSubUtils().subscribe(AFTER_FETCH, () => {\n memoizedPrepareRows([rsInternal], [rsInternal, rsInternal.getView().data]);\n });\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/refresh.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAMrE,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/refresh.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAMrE,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AA6BlD;;;;;;;;;;;GAWG;yBACa,YAAY,UAAU,MAIZ,cAAc,wBAAwB;AAJhE,wBAmBE"}
|
|
@@ -16,6 +16,8 @@ const resetRefresh = ({ getRsStore, getView }) => {
|
|
|
16
16
|
if (getRsStore().refreshInProgress) {
|
|
17
17
|
getRsStore().refreshInProgress = false;
|
|
18
18
|
getRsStore().refreshToken = undefined;
|
|
19
|
+
// A full refresh may change data rendered in Master Detail even if RS data is not changed.
|
|
20
|
+
getView().type.refreshMasterDetail();
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQtD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAA2C,EAAE,EAAE;IAC5E,MAAM,EACJ,IAAI,EAAE,EAAE,YAAY,EAAE,EACtB,mBAAmB,EACpB,GAAG,OAAO,EAAE,CAAC;IACd,IAAI,mBAAmB,EAAE,EAAE,EAAE,CAAC;QAC5B,YAAY,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAc,EAAE,EAAE;IAC3D,gEAAgE;IAChE,IAAI,OAAO,EAAE,CAAC,mBAAmB,EAAE,EAAE,IAAI,UAAU,EAAE,CAAC,iBAAiB,EAAE,CAAC;QACxE,OAAO,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;QACpD,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,yDAAyD;IACzD,IAAI,UAAU,EAAE,CAAC,iBAAiB,EAAE,CAAC;QACnC,UAAU,EAAE,CAAC,iBAAiB,GAAG,KAAK,CAAC;QACvC,UAAU,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQtD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAA2C,EAAE,EAAE;IAC5E,MAAM,EACJ,IAAI,EAAE,EAAE,YAAY,EAAE,EACtB,mBAAmB,EACpB,GAAG,OAAO,EAAE,CAAC;IACd,IAAI,mBAAmB,EAAE,EAAE,EAAE,CAAC;QAC5B,YAAY,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAc,EAAE,EAAE;IAC3D,gEAAgE;IAChE,IAAI,OAAO,EAAE,CAAC,mBAAmB,EAAE,EAAE,IAAI,UAAU,EAAE,CAAC,iBAAiB,EAAE,CAAC;QACxE,OAAO,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;QACpD,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,yDAAyD;IACzD,IAAI,UAAU,EAAE,CAAC,iBAAiB,EAAE,CAAC;QACnC,UAAU,EAAE,CAAC,iBAAiB,GAAG,KAAK,CAAC;QACvC,UAAU,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC;QACtC,2FAA2F;QAC3F,OAAO,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACvC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAe,CAAC,UAAsB,EAAE,EAAE;IACxC,UAAU,CAAC,cAAc,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;IACnF,MAAM,iBAAiB,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAErD,OAAO,SAAS,OAAO,CAAC,YAAsC;QAC5D,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,iBAAiB,CACf,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,gBAAgB;YACtB,KAAK,CAAC,MAAM,EAAE,KAAK;YACnB,KAAK,EAAE,YAAY;YACnB,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,iBAAiB;YACvB,KAAK,CAAC,eAAe;YACrB,KAAK,CAAC,MAAM;SACb,CACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { withMemoization } from '../../../utils/util';\nimport type { BeforeRenderFeatureProps } from '../../featureFactory';\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type View from '../../../generators/ViewGenerator';\nimport type { State } from '../../../../../types/State.types';\nimport type { UtilityFunctions } from '../../../generators/viewUtilityMethods';\n/* eslint-enable @typescript-eslint/no-unused-vars */\nimport type RsInternal from '../../../RsInternal';\nimport { AFTER_FETCH } from '../../../pubSub/events';\n\nconst onRefresh = ([{ getView }]: [featureProps: BeforeRenderFeatureProps]) => {\n const {\n type: { forceRefresh },\n refreshNotification\n } = getView();\n if (refreshNotification?.id) {\n forceRefresh();\n }\n};\n\nconst resetRefresh = ({ getRsStore, getView }: RsInternal) => {\n // Clear the refresh notification once the refresh is completed.\n if (getView().refreshNotification?.id && getRsStore().refreshInProgress) {\n getView().setProp('refreshNotification', undefined);\n getView().type.forceUpdate(false);\n }\n\n // Reset the refresh flags once the refresh is completed.\n if (getRsStore().refreshInProgress) {\n getRsStore().refreshInProgress = false;\n getRsStore().refreshToken = undefined;\n // A full refresh may change data rendered in Master Detail even if RS data is not changed.\n getView().type.refreshMasterDetail();\n }\n};\n\n/**\n * 1. Triggers {@link UtilityFunctions.forceRefresh forceRefresh} if {@link View.refreshNotification refresh notification} is on and any of the following state properties are changed:\n * - {@link State.filterExpression}\n * - `query` in {@link State.search}\n * - {@link State.sortingOrder}\n * - {@link State.groupToggle}\n * - {@link State.allGroupsExpanded}\n * - {@link State.aggregationInfo}\n * - {@link State.groups}\n * 2. Reset the refresh notification once the refresh is completed by subscribing to {@link AFTER_FETCH} event.\n * 3. Reset the `refreshInProgress` and `refreshToken` in {@link RsStore} once the refresh is completed.\n */\nexport default (rsInternal: RsInternal) => {\n rsInternal.getPubSubUtils().subscribe(AFTER_FETCH, () => resetRefresh(rsInternal));\n const memoizedOnRefresh = withMemoization(onRefresh);\n\n return function execute(featureProps: BeforeRenderFeatureProps) {\n const state = featureProps.getState();\n memoizedOnRefresh(\n [featureProps],\n [\n state.filterExpression,\n state.search?.query,\n state?.sortingOrder,\n state.groupToggle,\n state.allGroupsExpanded,\n state.aggregationInfo,\n state.groups\n ]\n );\n };\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import scrollToTop from './beforeRender/scrollToTop';
|
|
2
|
+
import masterDetail from './beforeRender/masterDetail';
|
|
2
3
|
declare const _default: {
|
|
3
4
|
beforeRender: {
|
|
4
5
|
busyIndicator: (rsInternal: import("../../RsInternal").default) => (featureProps: import("../featureFactory").BeforeRenderFeatureProps) => void;
|
|
@@ -22,6 +23,7 @@ declare const _default: {
|
|
|
22
23
|
aggregation: () => (featureProps: import("../featureFactory").BeforeRenderFeatureProps) => Promise<void>;
|
|
23
24
|
stateSanitization: () => (featureProps: import("../featureFactory").BeforeRenderFeatureProps) => void;
|
|
24
25
|
prepareRows: (rsInternal: import("../../RsInternal").default) => void;
|
|
26
|
+
masterDetail: typeof masterDetail;
|
|
25
27
|
prepareColumns: (rsInternal: import("../../RsInternal").default) => (featureProps: import("../featureFactory").BeforeRenderFeatureProps) => void;
|
|
26
28
|
columnFormatter: () => (featureProps: import("../featureFactory").BeforeRenderFeatureProps) => void;
|
|
27
29
|
ColumnDisplayMode: () => (featureProps: import("../featureFactory").BeforeRenderFeatureProps) => void;
|
|
@@ -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;;;
|
|
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;;;4EANd,kEAClB;6BAnBlB,kEAAsC;6BAyEgxG,kEAAsC;uBAbp1G,kEAGT;;0BAzDgD,kEAChB;;uBAYF,kEACR;6BAqDiiC,kEAAsC;;4BA3D7iC,kEACpC;8BA0DksM,kEAAsC;kCA7B1uM,kEAEZ;6BArC+B,kEAChB;2BAGgB,kEAC5B;2EA2D6vD,kEAAsC;yCAjDxxD,kEAAsC;+BAiDikL,kEAAsC;4BArD3nL,kEACd;kCAoDq0T,kEAAsC;;;6EAA/1L,kEAAsC;gCA/DpiI,kEACpB;kCAR2C,kEAC1C;4BAqES,kEAAsC;kCApEvC,kEAAsC;sCAQ/B,kEAC7B;+BAE2B,kEACZ;0EAwDmxP,kEAAsC;wEAA78I,kEAAsC;4BAVt5G,kEAEI;6BAtE8C,kEAC5B;sEA2BZ,kEAAsC;2BAkDlB,kEAAsC;4BA/DzD,kEACpB;;uCA8Do2B,kEAAsC;;;0BAAotD,sDAA0B;iCAAi8C,sDAA0B;yCA7D9iI,sDAC5B;;;AAaZ,wBA8CE"}
|
|
@@ -38,6 +38,7 @@ import resetFetch from './beforeRender/resetFetch';
|
|
|
38
38
|
import errorColumn from './beforeRender/errorColumn';
|
|
39
39
|
import scrollToTop from './beforeRender/scrollToTop';
|
|
40
40
|
import conditionalStyleFormat from './beforeRender/conditionalStyleFormat';
|
|
41
|
+
import masterDetail from './beforeRender/masterDetail';
|
|
41
42
|
export default {
|
|
42
43
|
beforeRender: {
|
|
43
44
|
busyIndicator,
|
|
@@ -61,6 +62,7 @@ export default {
|
|
|
61
62
|
aggregation,
|
|
62
63
|
stateSanitization,
|
|
63
64
|
prepareRows,
|
|
65
|
+
masterDetail,
|
|
64
66
|
prepareColumns,
|
|
65
67
|
columnFormatter,
|
|
66
68
|
ColumnDisplayMode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/features/uIFeatures/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAC7D,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAC7D,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,aAAa,MAAM,yBAAyB,CAAC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AACjD,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,YAAY,MAAM,6BAA6B,CAAC;AAEvD,eAAe;IACb,YAAY,EAAE;QACZ,aAAa;QACb,YAAY;QACZ,YAAY;QACZ,MAAM;QACN,SAAS,EAAE,YAAY;QACvB,SAAS;QACT,QAAQ;QACR,MAAM;QACN,YAAY;QACZ,eAAe;QACf,WAAW;QACX,aAAa;QACb,iBAAiB;QACjB,YAAY;QACZ,UAAU;QACV,YAAY;QACZ,wBAAwB;QACxB,cAAc;QACd,WAAW;QACX,iBAAiB;QACjB,WAAW;QACX,YAAY;QACZ,cAAc;QACd,eAAe;QACf,iBAAiB;QACjB,WAAW;QACX,iBAAiB;QACjB,qBAAqB;QACrB,cAAc;QACd,WAAW;QACX,SAAS;QACT,WAAW;QACX,YAAY;QACZ,OAAO;QACP,UAAU;QACV,WAAW;QACX,WAAW;QACX,sBAAsB;KACvB;IACD,WAAW,EAAE;QACX,SAAS,EAAE,aAAa;QACxB,gBAAgB;QAChB,wBAAwB;KACzB;CACF,CAAC","sourcesContent":["import freeze from './beforeRender/freeze';\nimport preAnimation from './beforeRender/animation';\nimport rowHeight from './beforeRender/rowHeight';\nimport columnOrder from './beforeRender/columnOrder';\nimport columnVisualOrder from './beforeRender/columnVisualOrder';\nimport columnReOrder from './beforeRender/columnReOrder';\nimport personalization from './beforeRender/personalization';\nimport customColumn from './beforeRender/customColumn';\nimport columnToggle from './beforeRender/columnToggle';\nimport columnSort from './beforeRender/columnSort';\nimport columnFormatter from './beforeRender/columnFormatter';\nimport ColumnDisplayMode from './beforeRender/columnDisplayMode';\nimport postAnimation from './afterRender/animation';\nimport customizeParentContainer from './afterRender/customizeParentContainer';\nimport columnSizing from './beforeRender/columnSizing';\nimport columnResize from './beforeRender/columnSizing/resize';\nimport grouping from './beforeRender/grouping';\nimport filter from './beforeRender/filter';\nimport adjustHeight from './beforeRender/adjustHeight';\nimport adjustHeightToFitRecords from './beforeRender/adjustHeightToFitRecords';\nimport stateHydration from './beforeRender/stateHydration';\nimport stateSanitization from './beforeRender/stateSanitization';\nimport aggregation from './beforeRender/aggregation';\nimport prepareRows from './beforeRender/prepareRows';\nimport prepareColumns from './beforeRender/prepareColumns';\nimport columnAlias from './beforeRender/columnAlias';\nimport busyIndicator from './beforeRender/busyIndicator';\nimport columnAutoSizing from './afterRender/columnSizing';\nimport rowDragDrop from './beforeRender/rowDragDrop';\nimport toggleHeaderIcons from './beforeRender/toggleHeaderIcons';\nimport changePersonalisation from './beforeRender/changePersonalisation';\nimport changeTemplate from './beforeRender/changeTemplate';\nimport rowSelect from './beforeRender/rowSelect';\nimport moveRecords from './beforeRender/moveListRecords';\nimport renderHeader from './beforeRender/renderHeader';\nimport refresh from './beforeRender/refresh';\nimport resetFetch from './beforeRender/resetFetch';\nimport errorColumn from './beforeRender/errorColumn';\nimport scrollToTop from './beforeRender/scrollToTop';\nimport conditionalStyleFormat from './beforeRender/conditionalStyleFormat';\nimport masterDetail from './beforeRender/masterDetail';\n\nexport default {\n beforeRender: {\n busyIndicator,\n columnSizing,\n columnResize,\n freeze,\n animation: preAnimation,\n rowHeight,\n grouping,\n filter,\n customColumn,\n personalization,\n columnOrder,\n columnReOrder,\n columnVisualOrder,\n columnToggle,\n columnSort,\n adjustHeight,\n adjustHeightToFitRecords,\n stateHydration,\n aggregation,\n stateSanitization,\n prepareRows,\n masterDetail,\n prepareColumns,\n columnFormatter,\n ColumnDisplayMode,\n columnAlias,\n toggleHeaderIcons,\n changePersonalisation,\n changeTemplate,\n rowDragDrop,\n rowSelect,\n moveRecords,\n renderHeader,\n refresh,\n resetFetch,\n errorColumn,\n scrollToTop,\n conditionalStyleFormat\n },\n afterRender: {\n animation: postAnimation,\n columnAutoSizing,\n customizeParentContainer\n }\n};\n"]}
|
|
@@ -23,6 +23,8 @@ export default class Row {
|
|
|
23
23
|
rowData: RowData;
|
|
24
24
|
/** 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. */
|
|
25
25
|
uniqueId?: string | null;
|
|
26
|
+
/** Generic interaction marker used by template renderers. */
|
|
27
|
+
masterDetailActive?: boolean;
|
|
26
28
|
/**
|
|
27
29
|
* Creates an instance of Row object for a repeating structure.
|
|
28
30
|
* @param args Constructor arguments
|
|
@@ -35,7 +37,7 @@ export default class Row {
|
|
|
35
37
|
* @param args.uniqueId A unique key to identify a row object in case {@link key} is duplicate.
|
|
36
38
|
* @param rsInternal A reference to {@link RsInternal} object.
|
|
37
39
|
*/
|
|
38
|
-
constructor({ key, role, tabIndex, dragProps, dropProps, rowData, uniqueId }: RowOptions, rsInternal: RsInternal);
|
|
40
|
+
constructor({ key, role, tabIndex, dragProps, dropProps, rowData, uniqueId, masterDetailActive }: RowOptions, rsInternal: RsInternal);
|
|
39
41
|
/** A reference to {@link View} object. */
|
|
40
42
|
get parent(): View;
|
|
41
43
|
/**
|
|
@@ -69,6 +71,14 @@ export default class Row {
|
|
|
69
71
|
* @param selected Flag to indicate the row is selected or not.
|
|
70
72
|
*/
|
|
71
73
|
selectRow(selected?: boolean): void;
|
|
74
|
+
/** Opens Master Detail for this row. */
|
|
75
|
+
openMasterDetail(nestedTarget?: Record<string, unknown>, viewName?: string): void;
|
|
76
|
+
/** Closes the active Master Detail item. */
|
|
77
|
+
closeMasterDetail(): void;
|
|
78
|
+
/** Clears the nested target set on this row's active Master Detail selection, without closing it. */
|
|
79
|
+
clearMasterDetailNestedTarget(): void;
|
|
80
|
+
/** Navigates from the active Master Detail item. */
|
|
81
|
+
navigateMasterDetail(direction: 'previous' | 'next'): void;
|
|
72
82
|
/**
|
|
73
83
|
* Returns the ui props for the {@link Row} that can be used to build a row in DOM.
|
|
74
84
|
*
|
|
@@ -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,sDAAsD,CAAC;AAKtF,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"RowGenerator.d.ts","sourceRoot":"","sources":["../../../../src/core/generators/RowGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AAKtF,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAM5C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EACL,OAAO,EACP,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAC;AAE9B,0EAA0E;AAC1E,MAAM,CAAC,OAAO,OAAO,GAAG;;IACtB,sHAAsH;IAC/G,GAAG,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IACxC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC7B,+CAA+C;IACxC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC7B,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG7B;;;;;;;;;;;OAWG;gBAED,EACE,GAAG,EACH,IAAY,EACZ,QAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ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|
2
2
|
import { compareObjects, deepCopy, isRowReorderFieldEnabled } from '../utils/util';
|
|
3
3
|
import { actionForceUpdate, actionRowSelectionUpdate } from '../actions/actions';
|
|
4
|
+
import { isMasterDetailSupported } from '../utils/masterDetail';
|
|
4
5
|
import { dataKey } from './RowGenerator.types';
|
|
5
6
|
/** A row model that represents row of a repeating structure component. */
|
|
6
7
|
export default class Row {
|
|
@@ -22,6 +23,8 @@ export default class Row {
|
|
|
22
23
|
rowData;
|
|
23
24
|
/** 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. */
|
|
24
25
|
uniqueId;
|
|
26
|
+
/** Generic interaction marker used by template renderers. */
|
|
27
|
+
masterDetailActive;
|
|
25
28
|
/** A reference to {@link RsInternal} object. */
|
|
26
29
|
#rsInternal;
|
|
27
30
|
/**
|
|
@@ -36,7 +39,7 @@ export default class Row {
|
|
|
36
39
|
* @param args.uniqueId A unique key to identify a row object in case {@link key} is duplicate.
|
|
37
40
|
* @param rsInternal A reference to {@link RsInternal} object.
|
|
38
41
|
*/
|
|
39
|
-
constructor({ key, role = 'row', tabIndex = 0, dragProps, dropProps, rowData, uniqueId }, rsInternal) {
|
|
42
|
+
constructor({ key, role = 'row', tabIndex = 0, dragProps, dropProps, rowData, uniqueId, masterDetailActive }, rsInternal) {
|
|
40
43
|
this.key = key;
|
|
41
44
|
this.role = role;
|
|
42
45
|
this.tabIndex = tabIndex;
|
|
@@ -44,6 +47,7 @@ export default class Row {
|
|
|
44
47
|
this.dropProps = dropProps;
|
|
45
48
|
this.rowData = rowData;
|
|
46
49
|
this.uniqueId = uniqueId;
|
|
50
|
+
this.masterDetailActive = masterDetailActive;
|
|
47
51
|
this.#rsInternal = rsInternal;
|
|
48
52
|
/** IMP: For generator methods use traditional function syntax
|
|
49
53
|
* rather than arrow function for memory efficiency
|
|
@@ -52,6 +56,10 @@ export default class Row {
|
|
|
52
56
|
this.getContext = this.getContext.bind(this);
|
|
53
57
|
this.updateRow = this.updateRow.bind(this);
|
|
54
58
|
this.selectRow = this.selectRow.bind(this);
|
|
59
|
+
this.openMasterDetail = this.openMasterDetail.bind(this);
|
|
60
|
+
this.closeMasterDetail = this.closeMasterDetail.bind(this);
|
|
61
|
+
this.clearMasterDetailNestedTarget = this.clearMasterDetailNestedTarget.bind(this);
|
|
62
|
+
this.navigateMasterDetail = this.navigateMasterDetail.bind(this);
|
|
55
63
|
this.setProp = this.setProp.bind(this);
|
|
56
64
|
this.getRowError = this.getRowError.bind(this);
|
|
57
65
|
this.getRowHeader = this.getRowHeader.bind(this);
|
|
@@ -73,7 +81,8 @@ export default class Row {
|
|
|
73
81
|
dragProps: this.dragProps,
|
|
74
82
|
dropProps: this.dropProps,
|
|
75
83
|
rowData: this.rowData,
|
|
76
|
-
uniqueId: this.uniqueId
|
|
84
|
+
uniqueId: this.uniqueId,
|
|
85
|
+
masterDetailActive: this.masterDetailActive
|
|
77
86
|
};
|
|
78
87
|
}
|
|
79
88
|
/**
|
|
@@ -190,6 +199,8 @@ export default class Row {
|
|
|
190
199
|
...getView().rows.slice(rowIndex + 1)
|
|
191
200
|
]
|
|
192
201
|
});
|
|
202
|
+
// Refresh the active detail as it may be stale even when the refreshed table row data is unchanged.
|
|
203
|
+
getView().type.refreshMasterDetail([this.key]);
|
|
193
204
|
dispatch(actionForceUpdate());
|
|
194
205
|
}
|
|
195
206
|
}
|
|
@@ -209,6 +220,22 @@ export default class Row {
|
|
|
209
220
|
mode: this.parent.meta.selectionMode
|
|
210
221
|
}));
|
|
211
222
|
}
|
|
223
|
+
/** Opens Master Detail for this row. */
|
|
224
|
+
openMasterDetail(nestedTarget, viewName) {
|
|
225
|
+
this.parent.type.openMasterDetail(this.key, nestedTarget, viewName);
|
|
226
|
+
}
|
|
227
|
+
/** Closes the active Master Detail item. */
|
|
228
|
+
closeMasterDetail() {
|
|
229
|
+
this.parent.type.closeMasterDetail();
|
|
230
|
+
}
|
|
231
|
+
/** Clears the nested target set on this row's active Master Detail selection, without closing it. */
|
|
232
|
+
clearMasterDetailNestedTarget() {
|
|
233
|
+
this.parent.type.clearMasterDetailNestedTarget(this.key);
|
|
234
|
+
}
|
|
235
|
+
/** Navigates from the active Master Detail item. */
|
|
236
|
+
navigateMasterDetail(direction) {
|
|
237
|
+
this.parent.type.navigateMasterDetail(direction);
|
|
238
|
+
}
|
|
212
239
|
/**
|
|
213
240
|
* Returns the ui props for the {@link Row} that can be used to build a row in DOM.
|
|
214
241
|
*
|
|
@@ -273,6 +300,7 @@ export default class Row {
|
|
|
273
300
|
const rsProps = getRsProps();
|
|
274
301
|
return {
|
|
275
302
|
name: 'row',
|
|
303
|
+
getRowKey: () => this.key,
|
|
276
304
|
getValue: () => this.data,
|
|
277
305
|
getParentContext: this.parent.getContext,
|
|
278
306
|
getRowActionDetails: (rowContext) => {
|
|
@@ -281,6 +309,12 @@ export default class Row {
|
|
|
281
309
|
getDragProps: () => this.dragProps,
|
|
282
310
|
selectRow: this.selectRow,
|
|
283
311
|
refreshRow: this.updateRow,
|
|
312
|
+
...(isMasterDetailSupported(getView()) && {
|
|
313
|
+
openMasterDetail: this.openMasterDetail,
|
|
314
|
+
closeMasterDetail: this.closeMasterDetail,
|
|
315
|
+
clearMasterDetailNestedTarget: this.clearMasterDetailNestedTarget,
|
|
316
|
+
navigateMasterDetail: this.navigateMasterDetail
|
|
317
|
+
}),
|
|
284
318
|
$selected: this.$selected,
|
|
285
319
|
getRowError: this.getRowError,
|
|
286
320
|
getRowHeader: this.getRowHeader
|