@pega/lists-react 9.0.0-build.19.1 → 9.0.0-build.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Core/Components/Toolbar/hooks/useMore.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useMore.js +1 -3
- package/lib/Core/Components/Toolbar/hooks/useMore.js.map +1 -1
- package/lib/Core/Components/Virtualise/VirtualizeInfinite.js +8 -2
- package/lib/Core/Components/Virtualise/VirtualizeInfinite.js.map +1 -1
- package/lib/Core/Components/Virtualise/index.js +12 -3
- package/lib/Core/Components/Virtualise/index.js.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCard.js +8 -6
- package/lib/Core/Views/Gallery/Components/GalleryCard.js.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts +8 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js +25 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts +1 -2
- package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryHeader.js +4 -8
- package/lib/Core/Views/Gallery/Components/GalleryHeader.js.map +1 -1
- package/lib/Core/Views/Gallery/Gallery.types.d.ts +0 -1
- package/lib/Core/Views/Gallery/Gallery.types.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/Gallery.types.js.map +1 -1
- package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts +9 -0
- package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/hooks/useRowActions.js +25 -0
- package/lib/Core/Views/Gallery/hooks/useRowActions.js.map +1 -0
- package/lib/Core/Views/Gallery/index.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/index.js +10 -7
- package/lib/Core/Views/Gallery/index.js.map +1 -1
- package/lib/Core/Views/Gallery/utils.d.ts +15 -2
- package/lib/Core/Views/Gallery/utils.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/utils.js +21 -4
- package/lib/Core/Views/Gallery/utils.js.map +1 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.js +9 -12
- package/lib/Core/Views/Table/VirtualizeWrapper.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMore.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/hooks/useMore.jsx"],"names":[],"mappings":";AA4BA;;;;;;
|
|
1
|
+
{"version":3,"file":"useMore.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/hooks/useMore.jsx"],"names":[],"mappings":";AA4BA;;;;;;EAkYC"}
|
|
@@ -166,9 +166,7 @@ const useMore = ({ view }) => {
|
|
|
166
166
|
id: SetAsDefault,
|
|
167
167
|
icon: 'clipboard-check',
|
|
168
168
|
text: translate(SetAsDefault),
|
|
169
|
-
show: Boolean(
|
|
170
|
-
currentDefaultView !== currentActiveView &&
|
|
171
|
-
!isAppDefaultView),
|
|
169
|
+
show: Boolean(personalization && currentDefaultView !== currentActiveView && !isAppDefaultView),
|
|
172
170
|
onClick: () => view.type.setDefaultPersonalization(currentActiveView)
|
|
173
171
|
},
|
|
174
172
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMore.js","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/hooks/useMore.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA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AE;wBACf,IAAI;qBACL,CAAC;oBACJ,CAAC,CAAC,IAAI,CAAC;gBACT,MAAM;YAER,KAAK,IAAI;gBACP,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CACrC,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,GAAI,CACpF,CAAC,CAAC,CAAC,IAAI,CAAC;gBACT,MAAM;YAER;gBACE,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM;QACV,CAAC;IACH,CAAC;IACD,mGAAmG;IACnG,MAAM,qBAAqB,GACzB,SAAS,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CACjF,KAAC,OAAO,IACN,SAAS,EAAC,QAAQ,EAClB,KAAK,QACL,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAChC,SAAS,EAAC,YAAY,YAErB,SAAS,GACF,CACX,CAAC,CAAC,CAAC,CACF,SAAS,CACV,CAAC;IAEJ,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Popover, useElement, useModalManager } from '@pega/cosmos-react-core';\n\nimport useTranslate from '../../../Hooks/useTranslate';\nimport PersonalizationDeleteConfirmation from '../../DefaultComponents/PersonalizationDeleteConfirmation';\nimport ColumnSelector, { colsVisibility, pinning } from '../ColumnSelector';\nimport DebugInfo from '../DebugInfo';\nimport { useKeyboardA11y } from '../../../Hooks/a11y';\nimport { resolveViewComponent } from '../../RenderingEngine/ComponentResolverFactory';\n\nconst RowDensity = 'Row density';\n\nconst SaveViewChanges = 'Save changes';\nconst ViewAs = 'View as...';\nconst EditCustomizedView = 'Edit customized view';\nconst SetAsDefault = 'Set as default';\nconst MarkAsAppDefault = 'Mark as app default';\nconst DeleteCustomizedView = 'Delete customized view';\nconst ResetColumnWidths = 'Reset column widths';\nconst AutoSizeColumns = 'Auto size columns';\nconst ShowHeaderIcons = 'ShowHeaderIcons';\nconst Info = 'Query info';\nconst ImportCSVData = 'Import CSV data';\nconst ExportToExcel = 'Export to Excel';\nconst ExportToCSV = 'Export to CSV';\nconst Refresh = 'Refresh';\n\nconst useMore = ({ view }) => {\n const {\n meta: {\n displayDensity,\n toggleFieldVisibility,\n freezeFields,\n personalization,\n headerBar,\n enableAppDefault,\n enableFreezeColumns,\n autoSizeColumns,\n showQueryInfo,\n resetColumnWidths,\n rowDensity,\n showHeaderIcons: isHeaderIcons,\n showImportDataOption,\n showExportToExcelOption,\n showExportToCSVOption,\n allowRefresh\n },\n state: {\n showHeaderIcons,\n personalization: personalizationState,\n responsive: { sm: isSmallOrAbove } = {}\n } = {},\n type: { applyToggleVisibility, applyFreeze },\n toolBarOptions = [],\n columns,\n defaultPresetId,\n renderFactory,\n getContext\n } = view;\n\n const [popperRef, setPopperRef] = useElement();\n\n const actionsButtonRef = useRef(null);\n const [translate] = useTranslate();\n const { create } = useModalManager();\n const [moreContent, setMoreContent] = useState('default');\n const currentActiveView = personalizationState?.active;\n const currentDefaultView = personalizationState?.defaultPersonalization;\n const isAppDefaultView = currentActiveView === 'APP_DEFAULT';\n const isViewDirty = personalizationState?.dirty;\n const currentActiveViewName =\n personalizationState?.allPersonalizations?.[currentActiveView]?.name;\n const isPreset = !!personalizationState?.allPersonalizations?.[currentActiveView]?.isPreset;\n\n const onDeletePersonalization = useCallback(() => {\n create(\n PersonalizationDeleteConfirmation,\n {\n onSubmit: () => {\n view.type.deletePersonalization(currentActiveView);\n },\n currentActiveViewName,\n translate\n },\n {\n alert: true\n }\n );\n }, [create, currentActiveViewName, view.type, currentActiveView]);\n\n const [forceShowMenu, setForceShowMenu] = useState(false);\n\n const actions = useMemo(\n () => [\n [\n {\n id: colsVisibility,\n icon: 'eye-off',\n text: translate(colsVisibility),\n show: !!toggleFieldVisibility,\n onClick: () => {\n setMoreContent(colsVisibility);\n setForceShowMenu(true);\n }\n },\n {\n id: RowDensity,\n icon: 'row-insert',\n text: translate(RowDensity),\n show: displayDensity.length > 0 && rowDensity,\n onClick: () => {\n setMoreContent(RowDensity);\n setForceShowMenu(true);\n }\n },\n {\n id: pinning,\n icon: 'freeze-column',\n text: translate(pinning),\n show: !!freezeFields && !!enableFreezeColumns && isSmallOrAbove,\n onClick: () => {\n setMoreContent(pinning);\n setForceShowMenu(true);\n }\n },\n {\n id: ShowHeaderIcons,\n icon: 'picture',\n text: showHeaderIcons ? translate('Hide header icons') : translate('Show header icons'),\n show: isHeaderIcons,\n onClick: () => {\n view.type.updateHeaderIconsVisibility(!showHeaderIcons);\n }\n },\n {\n id: AutoSizeColumns,\n icon: 'scale-up',\n text: translate(AutoSizeColumns),\n show: autoSizeColumns,\n onClick: () => {\n view.applyColumnsAutoSize(false);\n }\n },\n {\n id: ResetColumnWidths,\n icon: 'scale-down',\n text: translate(ResetColumnWidths),\n show: resetColumnWidths,\n onClick: () => {\n view.applyColumnsAutoSize(true);\n }\n },\n {\n id: Info,\n icon: 'information',\n text: translate(Info),\n show: showQueryInfo,\n onClick: () => {\n setMoreContent(Info);\n setForceShowMenu(true);\n }\n }\n ],\n [\n {\n id: ViewAs,\n icon: 'columns',\n text: translate(ViewAs),\n show: Boolean(personalization && !headerBar),\n onClick: () => {\n setMoreContent(ViewAs);\n setForceShowMenu(true);\n }\n },\n {\n id: SaveViewChanges,\n icon: 'clipboard-plus',\n text: translate(SaveViewChanges),\n show: Boolean(\n personalization &&\n currentActiveView !== defaultPresetId &&\n (!isPreset || (isAppDefaultView && enableAppDefault)) &&\n isViewDirty\n ),\n onClick: () => {\n view.type.updatePersonalization(\n currentActiveView,\n currentDefaultView === currentActiveView,\n isAppDefaultView\n );\n }\n },\n {\n id: EditCustomizedView,\n icon: 'pencil',\n text: translate(EditCustomizedView),\n show: Boolean(\n personalization &&\n (!isPreset || (isAppDefaultView && enableAppDefault)) &&\n currentActiveView !== defaultPresetId\n ),\n onClick: () => {\n setMoreContent(EditCustomizedView);\n setForceShowMenu(true);\n }\n },\n {\n id: DeleteCustomizedView,\n icon: 'trash',\n text: translate(DeleteCustomizedView),\n show: Boolean(\n personalization &&\n !isPreset &&\n currentActiveView !== defaultPresetId &&\n !isAppDefaultView\n ),\n onClick: onDeletePersonalization\n },\n {\n id: SetAsDefault,\n icon: 'clipboard-check',\n text: translate(SetAsDefault),\n show: Boolean(\n (personalization || isPreset || currentActiveView === defaultPresetId) &&\n currentDefaultView !== currentActiveView &&\n !isAppDefaultView\n ),\n onClick: () => view.type.setDefaultPersonalization(currentActiveView)\n },\n {\n id: MarkAsAppDefault,\n icon: 'clipboard-check',\n text: translate(MarkAsAppDefault),\n show: Boolean(isPreset && enableAppDefault && personalization && !isAppDefaultView),\n onClick: () =>\n view.type.setAppDefaultPersonalization('APP_DEFAULT', currentActiveViewName)\n },\n {\n id: ImportCSVData,\n icon: 'document-xls',\n text: translate(ImportCSVData),\n show: Boolean(showImportDataOption),\n onClick: () => view.type.importCSVData(create)\n },\n {\n id: ExportToExcel,\n testId: 'export-to-excel',\n icon: 'document-xls',\n text: translate(ExportToExcel),\n show: Boolean(showExportToExcelOption),\n onClick: () => view.type.exportToExcel()\n },\n {\n id: ExportToCSV,\n icon: 'document-xls',\n text: translate(ExportToCSV),\n show: Boolean(showExportToCSVOption),\n onClick: () => view.type.exportToCSV()\n },\n {\n id: Refresh,\n testId: 'refresh',\n icon: 'reset',\n text: translate(Refresh),\n show: Boolean(allowRefresh),\n onClick: () => {\n view.type.forceRefresh();\n }\n }\n ],\n ...toolBarOptions\n ],\n [\n translate,\n toggleFieldVisibility,\n displayDensity.length,\n rowDensity,\n freezeFields,\n enableFreezeColumns,\n showHeaderIcons,\n isHeaderIcons,\n autoSizeColumns,\n showQueryInfo,\n resetColumnWidths,\n personalization,\n headerBar,\n currentActiveView,\n defaultPresetId,\n isPreset,\n isViewDirty,\n isAppDefaultView,\n showExportToExcelOption,\n showExportToCSVOption,\n onDeletePersonalization,\n currentDefaultView,\n toolBarOptions,\n currentActiveViewName,\n view,\n enableAppDefault,\n isSmallOrAbove\n ]\n );\n\n const filteredActions = useMemo(\n () =>\n actions\n .flat()\n .map(action => ({\n ...action,\n id: action.id.replaceAll(' ', '-')\n }))\n .filter(({ show = true }) => show),\n [actions]\n );\n\n const finishPopOver = () => {\n if (forceShowMenu) {\n setForceShowMenu(false);\n }\n };\n\n // setting focus on action button in different rendering cycle otherwise it will get lost due to re-render of toolbar\n useEffect(() => {\n if (!forceShowMenu && popperRef) {\n actionsButtonRef.current?.focus();\n }\n }, [forceShowMenu]);\n\n useKeyboardA11y({\n container: popperRef && forceShowMenu ? popperRef : null,\n onClose: popperRef && forceShowMenu ? finishPopOver : () => {}\n });\n\n let component;\n\n if (forceShowMenu) {\n switch (moreContent) {\n case colsVisibility:\n component = (\n <ColumnSelector\n dispatch={applyToggleVisibility}\n columns={columns}\n action={moreContent}\n finishPopOver={finishPopOver}\n />\n );\n break;\n\n case pinning:\n component = (\n <ColumnSelector\n dispatch={applyFreeze}\n columns={columns}\n action={moreContent}\n finishPopOver={finishPopOver}\n />\n );\n break;\n\n case RowDensity:\n component = resolveViewComponent('rowHeightRenderer', renderFactory, {\n ...getContext(),\n view,\n onClose: finishPopOver\n });\n break;\n\n case ViewAs:\n component = resolveViewComponent(\n 'personalizationSelectorRenderer',\n renderFactory,\n getContext()\n );\n break;\n\n case EditCustomizedView:\n component = actionsButtonRef.current\n ? resolveViewComponent('personalizationCreateEditRenderer', renderFactory, {\n onFinish: finishPopOver,\n editing: true,\n target: actionsButtonRef.current,\n ...getContext(),\n view\n })\n : null;\n break;\n\n case Info:\n component = actionsButtonRef.current ? (\n <DebugInfo view={view} target={actionsButtonRef.current} onClose={finishPopOver} />\n ) : null;\n break;\n\n default:\n component = null;\n break;\n }\n }\n // ColVisibility, pinning, RowDensity, ViewAs are all returning Menu, so popover is needed for them\n const selectedActionContent =\n component && [colsVisibility, pinning, RowDensity, ViewAs].includes(moreContent) ? (\n <Popover\n className='popper'\n arrow\n ref={setPopperRef}\n target={actionsButtonRef.current}\n placement='bottom-end'\n >\n {component}\n </Popover>\n ) : (\n component\n );\n\n return { actions: filteredActions, actionsButtonRef, selectedActionContent };\n};\n\nexport default useMore;\n"]}
|
|
1
|
+
{"version":3,"file":"useMore.js","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/hooks/useMore.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,iCAAiC,MAAM,2DAA2D,CAAC;AAC1G,OAAO,cAAc,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAEtF,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,MAAM,GAAG,YAAY,CAAC;AAC5B,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAClD,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAC/C,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AACtD,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAChD,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,M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qBAAqB,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Popover, useElement, useModalManager } from '@pega/cosmos-react-core';\n\nimport useTranslate from '../../../Hooks/useTranslate';\nimport PersonalizationDeleteConfirmation from '../../DefaultComponents/PersonalizationDeleteConfirmation';\nimport ColumnSelector, { colsVisibility, pinning } from '../ColumnSelector';\nimport DebugInfo from '../DebugInfo';\nimport { useKeyboardA11y } from '../../../Hooks/a11y';\nimport { resolveViewComponent } from '../../RenderingEngine/ComponentResolverFactory';\n\nconst RowDensity = 'Row density';\n\nconst SaveViewChanges = 'Save changes';\nconst ViewAs = 'View as...';\nconst EditCustomizedView = 'Edit customized view';\nconst SetAsDefault = 'Set as default';\nconst MarkAsAppDefault = 'Mark as app default';\nconst DeleteCustomizedView = 'Delete customized view';\nconst ResetColumnWidths = 'Reset column widths';\nconst AutoSizeColumns = 'Auto size columns';\nconst ShowHeaderIcons = 'ShowHeaderIcons';\nconst Info = 'Query info';\nconst ImportCSVData = 'Import CSV data';\nconst ExportToExcel = 'Export to Excel';\nconst ExportToCSV = 'Export to CSV';\nconst Refresh = 'Refresh';\n\nconst useMore = ({ view }) => {\n const {\n meta: {\n displayDensity,\n toggleFieldVisibility,\n freezeFields,\n personalization,\n headerBar,\n enableAppDefault,\n enableFreezeColumns,\n autoSizeColumns,\n showQueryInfo,\n resetColumnWidths,\n rowDensity,\n showHeaderIcons: isHeaderIcons,\n showImportDataOption,\n showExportToExcelOption,\n showExportToCSVOption,\n allowRefresh\n },\n state: {\n showHeaderIcons,\n personalization: personalizationState,\n responsive: { sm: isSmallOrAbove } = {}\n } = {},\n type: { applyToggleVisibility, applyFreeze },\n toolBarOptions = [],\n columns,\n defaultPresetId,\n renderFactory,\n getContext\n } = view;\n\n const [popperRef, setPopperRef] = useElement();\n\n const actionsButtonRef = useRef(null);\n const [translate] = useTranslate();\n const { create } = useModalManager();\n const [moreContent, setMoreContent] = useState('default');\n const currentActiveView = personalizationState?.active;\n const currentDefaultView = personalizationState?.defaultPersonalization;\n const isAppDefaultView = currentActiveView === 'APP_DEFAULT';\n const isViewDirty = personalizationState?.dirty;\n const currentActiveViewName =\n personalizationState?.allPersonalizations?.[currentActiveView]?.name;\n const isPreset = !!personalizationState?.allPersonalizations?.[currentActiveView]?.isPreset;\n\n const onDeletePersonalization = useCallback(() => {\n create(\n PersonalizationDeleteConfirmation,\n {\n onSubmit: () => {\n view.type.deletePersonalization(currentActiveView);\n },\n currentActiveViewName,\n translate\n },\n {\n alert: true\n }\n );\n }, [create, currentActiveViewName, view.type, currentActiveView]);\n\n const [forceShowMenu, setForceShowMenu] = useState(false);\n\n const actions = useMemo(\n () => [\n [\n {\n id: colsVisibility,\n icon: 'eye-off',\n text: translate(colsVisibility),\n show: !!toggleFieldVisibility,\n onClick: () => {\n setMoreContent(colsVisibility);\n setForceShowMenu(true);\n }\n },\n {\n id: RowDensity,\n icon: 'row-insert',\n text: translate(RowDensity),\n show: displayDensity.length > 0 && rowDensity,\n onClick: () => {\n setMoreContent(RowDensity);\n setForceShowMenu(true);\n }\n },\n {\n id: pinning,\n icon: 'freeze-column',\n text: translate(pinning),\n show: !!freezeFields && !!enableFreezeColumns && isSmallOrAbove,\n onClick: () => {\n setMoreContent(pinning);\n setForceShowMenu(true);\n }\n },\n {\n id: ShowHeaderIcons,\n icon: 'picture',\n text: showHeaderIcons ? translate('Hide header icons') : translate('Show header icons'),\n show: isHeaderIcons,\n onClick: () => {\n view.type.updateHeaderIconsVisibility(!showHeaderIcons);\n }\n },\n {\n id: AutoSizeColumns,\n icon: 'scale-up',\n text: translate(AutoSizeColumns),\n show: autoSizeColumns,\n onClick: () => {\n view.applyColumnsAutoSize(false);\n }\n },\n {\n id: ResetColumnWidths,\n icon: 'scale-down',\n text: translate(ResetColumnWidths),\n show: resetColumnWidths,\n onClick: () => {\n view.applyColumnsAutoSize(true);\n }\n },\n {\n id: Info,\n icon: 'information',\n text: translate(Info),\n show: showQueryInfo,\n onClick: () => {\n setMoreContent(Info);\n setForceShowMenu(true);\n }\n }\n ],\n [\n {\n id: ViewAs,\n icon: 'columns',\n text: translate(ViewAs),\n show: Boolean(personalization && !headerBar),\n onClick: () => {\n setMoreContent(ViewAs);\n setForceShowMenu(true);\n }\n },\n {\n id: SaveViewChanges,\n icon: 'clipboard-plus',\n text: translate(SaveViewChanges),\n show: Boolean(\n personalization &&\n currentActiveView !== defaultPresetId &&\n (!isPreset || (isAppDefaultView && enableAppDefault)) &&\n isViewDirty\n ),\n onClick: () => {\n view.type.updatePersonalization(\n currentActiveView,\n currentDefaultView === currentActiveView,\n isAppDefaultView\n );\n }\n },\n {\n id: EditCustomizedView,\n icon: 'pencil',\n text: translate(EditCustomizedView),\n show: Boolean(\n personalization &&\n (!isPreset || (isAppDefaultView && enableAppDefault)) &&\n currentActiveView !== defaultPresetId\n ),\n onClick: () => {\n setMoreContent(EditCustomizedView);\n setForceShowMenu(true);\n }\n },\n {\n id: DeleteCustomizedView,\n icon: 'trash',\n text: translate(DeleteCustomizedView),\n show: Boolean(\n personalization &&\n !isPreset &&\n currentActiveView !== defaultPresetId &&\n !isAppDefaultView\n ),\n onClick: onDeletePersonalization\n },\n {\n id: SetAsDefault,\n icon: 'clipboard-check',\n text: translate(SetAsDefault),\n show: Boolean(\n personalization && currentDefaultView !== currentActiveView && !isAppDefaultView\n ),\n onClick: () => view.type.setDefaultPersonalization(currentActiveView)\n },\n {\n id: MarkAsAppDefault,\n icon: 'clipboard-check',\n text: translate(MarkAsAppDefault),\n show: Boolean(isPreset && enableAppDefault && personalization && !isAppDefaultView),\n onClick: () =>\n view.type.setAppDefaultPersonalization('APP_DEFAULT', currentActiveViewName)\n },\n {\n id: ImportCSVData,\n icon: 'document-xls',\n text: translate(ImportCSVData),\n show: Boolean(showImportDataOption),\n onClick: () => view.type.importCSVData(create)\n },\n {\n id: ExportToExcel,\n testId: 'export-to-excel',\n icon: 'document-xls',\n text: translate(ExportToExcel),\n show: Boolean(showExportToExcelOption),\n onClick: () => view.type.exportToExcel()\n },\n {\n id: ExportToCSV,\n icon: 'document-xls',\n text: translate(ExportToCSV),\n show: Boolean(showExportToCSVOption),\n onClick: () => view.type.exportToCSV()\n },\n {\n id: Refresh,\n testId: 'refresh',\n icon: 'reset',\n text: translate(Refresh),\n show: Boolean(allowRefresh),\n onClick: () => {\n view.type.forceRefresh();\n }\n }\n ],\n ...toolBarOptions\n ],\n [\n translate,\n toggleFieldVisibility,\n displayDensity.length,\n rowDensity,\n freezeFields,\n enableFreezeColumns,\n showHeaderIcons,\n isHeaderIcons,\n autoSizeColumns,\n showQueryInfo,\n resetColumnWidths,\n personalization,\n headerBar,\n currentActiveView,\n defaultPresetId,\n isPreset,\n isViewDirty,\n isAppDefaultView,\n showExportToExcelOption,\n showExportToCSVOption,\n onDeletePersonalization,\n currentDefaultView,\n toolBarOptions,\n currentActiveViewName,\n view,\n enableAppDefault,\n isSmallOrAbove\n ]\n );\n\n const filteredActions = useMemo(\n () =>\n actions\n .flat()\n .map(action => ({\n ...action,\n id: action.id.replaceAll(' ', '-')\n }))\n .filter(({ show = true }) => show),\n [actions]\n );\n\n const finishPopOver = () => {\n if (forceShowMenu) {\n setForceShowMenu(false);\n }\n };\n\n // setting focus on action button in different rendering cycle otherwise it will get lost due to re-render of toolbar\n useEffect(() => {\n if (!forceShowMenu && popperRef) {\n actionsButtonRef.current?.focus();\n }\n }, [forceShowMenu]);\n\n useKeyboardA11y({\n container: popperRef && forceShowMenu ? popperRef : null,\n onClose: popperRef && forceShowMenu ? finishPopOver : () => {}\n });\n\n let component;\n\n if (forceShowMenu) {\n switch (moreContent) {\n case colsVisibility:\n component = (\n <ColumnSelector\n dispatch={applyToggleVisibility}\n columns={columns}\n action={moreContent}\n finishPopOver={finishPopOver}\n />\n );\n break;\n\n case pinning:\n component = (\n <ColumnSelector\n dispatch={applyFreeze}\n columns={columns}\n action={moreContent}\n finishPopOver={finishPopOver}\n />\n );\n break;\n\n case RowDensity:\n component = resolveViewComponent('rowHeightRenderer', renderFactory, {\n ...getContext(),\n view,\n onClose: finishPopOver\n });\n break;\n\n case ViewAs:\n component = resolveViewComponent(\n 'personalizationSelectorRenderer',\n renderFactory,\n getContext()\n );\n break;\n\n case EditCustomizedView:\n component = actionsButtonRef.current\n ? resolveViewComponent('personalizationCreateEditRenderer', renderFactory, {\n onFinish: finishPopOver,\n editing: true,\n target: actionsButtonRef.current,\n ...getContext(),\n view\n })\n : null;\n break;\n\n case Info:\n component = actionsButtonRef.current ? (\n <DebugInfo view={view} target={actionsButtonRef.current} onClose={finishPopOver} />\n ) : null;\n break;\n\n default:\n component = null;\n break;\n }\n }\n // ColVisibility, pinning, RowDensity, ViewAs are all returning Menu, so popover is needed for them\n const selectedActionContent =\n component && [colsVisibility, pinning, RowDensity, ViewAs].includes(moreContent) ? (\n <Popover\n className='popper'\n arrow\n ref={setPopperRef}\n target={actionsButtonRef.current}\n placement='bottom-end'\n >\n {component}\n </Popover>\n ) : (\n component\n );\n\n return { actions: filteredActions, actionsButtonRef, selectedActionContent };\n};\n\nexport default useMore;\n"]}
|
|
@@ -249,7 +249,7 @@ const VirtualizeInfinite = forwardRef(({ id, viewHeight, viewWidth, itemHeight,
|
|
|
249
249
|
]);
|
|
250
250
|
return (_jsxs(StyledPContainer, { "$style": {
|
|
251
251
|
maxHeight,
|
|
252
|
-
minHeight: vi.totalRowsLoaded
|
|
252
|
+
minHeight: !vi.totalRowsLoaded ? '100px' : 'auto',
|
|
253
253
|
renderFooter,
|
|
254
254
|
itemHeight,
|
|
255
255
|
height,
|
|
@@ -260,7 +260,13 @@ const VirtualizeInfinite = forwardRef(({ id, viewHeight, viewWidth, itemHeight,
|
|
|
260
260
|
vi.bContainer = c;
|
|
261
261
|
}, children: _jsxs("div", { className: `${rowContainerClass} row-container`, ref: c => {
|
|
262
262
|
vi.rContainer = c;
|
|
263
|
-
}, role: 'rowgroup', children: [
|
|
263
|
+
}, role: 'rowgroup', children: [vi.totalRowsLoaded >= 0 &&
|
|
264
|
+
showLoadingIndicator &&
|
|
265
|
+
isFetching &&
|
|
266
|
+
loadingIndicatorInfo.isScrollingUp && (_jsx(StyledLoader, { "$style": { bottom: '100%' }, children: _jsx(Progress, { className: 'above-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) })), children, vi.totalRowsLoaded >= 0 &&
|
|
267
|
+
showLoadingIndicator &&
|
|
268
|
+
isFetching &&
|
|
269
|
+
loadingIndicatorInfo.isScrollingDown && (_jsx(StyledLoader, { "$style": { top: '100%' }, children: _jsx(Progress, { className: 'below-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) }))] }) }), vi.totalRowsLoaded === 0 && !isFetching
|
|
264
270
|
? renderEmptyRecords && renderEmptyRecords()
|
|
265
271
|
: null, renderFooter && renderFooter()] }));
|
|
266
272
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizeInfinite.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/VirtualizeInfinite.jsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B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;IAChC,gBAAgB,EAAE,CAAC;IACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,EAAE;IACrB,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,aAAa,EAAE,SAAS;IACxB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,KAAK;IACjB,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC7B,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n isViewNotFilled,\n setAttributesOnItems,\n updateRowContainerTop\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n border-radius: inherit;\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n .bContainer {\n position: relative;\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n top: ${props => props.$style.top};\n bottom: ${props => props.$style.bottom};\n`;\n\nconst VirtualizeInfinite = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n itemHeight,\n callback,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n resetCount,\n countUpdateCallback,\n isFetching,\n hasMoreResults,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const rowBuffer = 5;\n\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {},\n totalRowsLoaded: undefined,\n isInitialized: false\n }).current;\n\n // tracking both state and pInfo.view to identify the initialization as in case of fullscreen, state will be available but pInfo.view won't\n const isInitialized = state && !!Object.keys(vi.pInfo.view ?? {}).length;\n\n const getTotalRowsIncludingBuffer = useCallback(() => {\n if (isEmpty(vi.totalRowsLoaded)) return;\n return hasMoreResults ? vi.totalRowsLoaded + rowBuffer : vi.totalRowsLoaded;\n }, [vi.totalRowsLoaded, hasMoreResults]);\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!isInitialized) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, getPContainer, callback, isInitialized]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but resting isFetch to false\n // goes to this method when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (!isFetching || resetIsFetchingWhenNoNewIndexes) {\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n isRefresh,\n true\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (\n isRefresh ||\n !state ||\n !(startIndex >= state.startIndex && endIndex <= state.endIndex)\n ) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n\n callback({ ...vi.pInfo.view, id });\n } else if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n }\n },\n [isFetching, getPContainer, getTotalRowsIncludingBuffer, vi, state, callback, id]\n );\n\n // update average stats for next calculation.\n const updateAvarageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h =\n (getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()) / itemCount) *\n rowContainerHeight;\n return h;\n },\n [getTotalRowsIncludingBuffer]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n getTotalRowsIncludingBuffer(),\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const rowElements = Array.from(getRowContainer().children || []).filter(a =>\n a.hasAttribute('data-key')\n );\n if (!rowElements.length) {\n vi.totalRowsLoaded = 0;\n return;\n }\n\n const lastRow = rowElements[rowElements.length - 1];\n const lastRowDataIndex = parseInt(lastRow.getAttribute('data-index'), 10);\n const newCount = hasMoreResults ? lastRowDataIndex + 1 + rowBuffer : lastRowDataIndex + 1;\n\n // if user is scrolling up/down within the already encountered records, the record count shouldn't update\n if (newCount < getTotalRowsIncludingBuffer() && !resetCount) return;\n\n vi.totalRowsLoaded = lastRowDataIndex + 1;\n countUpdateCallback(vi.totalRowsLoaded);\n }, [children, isFetching]);\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (!isInitialized) return;\n\n vi.currentEstimation = getCurrentEstimation(getRowContainer(), true);\n updateAvarageInVirtualizeInstance(vi.currentEstimation);\n const h = getBufferHeight(vi.currentEstimation);\n getBContainer().style.height = `${h}px`;\n }, [\n vi,\n children,\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n getTotalRowsIncludingBuffer,\n updateAvarageInVirtualizeInstance\n ]);\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (vi.pInfo.view.startIndex !== 0) pContainer.scrollTop = scrollTop;\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n state,\n pContainer,\n pContainer.scrollTop\n );\n }, [\n vi,\n state,\n isFetching,\n getScrollTop,\n getPContainer,\n updateScrollTop,\n getTotalRowsIncludingBuffer\n ]);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (isFetching) return;\n\n if (!isInitialized) {\n getPagination(true);\n return;\n }\n\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n getPContainer(),\n renderHeader\n )\n ) {\n getPagination(false, true);\n } else {\n setLoadingIndicatorInfo({});\n }\n }, [\n vi,\n isFetching,\n children,\n viewWidth,\n viewHeight,\n renderHeader,\n rContainerDimensionUpdate,\n getPagination,\n getPContainer,\n getTotalRowsIncludingBuffer\n ]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight: vi.totalRowsLoaded === 0 ? '100px' : 'auto',\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={vi.totalRowsLoaded}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader $style={{ bottom: '100%' }}>\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n {children}\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader $style={{ top: '100%' }}>\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n </div>\n {vi.totalRowsLoaded === 0 && !isFetching\n ? renderEmptyRecords && renderEmptyRecords()\n : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualizeInfinite.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n hasMoreResults: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n resetCount: PropTypes.bool,\n countUpdateCallback: PropTypes.func,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualizeInfinite.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n hasMoreResults: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n resetCount: false,\n countUpdateCallback: () => {},\n renderEmptyRecords: null\n};\n\nVirtualizeInfinite.displayName = 'VirtualizeInfinite';\n\nexport default memo(VirtualizeInfinite);\n"]}
|
|
1
|
+
{"version":3,"file":"VirtualizeInfinite.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/VirtualizeInfinite.jsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AA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U,EAAE,SAAS,CAAC,IAAI;IAC1B,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,kBAAkB,EAAE,SAAS,CAAC,IAAI;CACnC,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG;IAChC,gBAAgB,EAAE,CAAC;IACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,EAAE;IACrB,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,aAAa,EAAE,SAAS;IACxB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,KAAK;IACjB,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC7B,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n isViewNotFilled,\n setAttributesOnItems,\n updateRowContainerTop\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n border-radius: inherit;\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n .bContainer {\n position: relative;\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n top: ${props => props.$style.top};\n bottom: ${props => props.$style.bottom};\n`;\n\nconst VirtualizeInfinite = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n itemHeight,\n callback,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n resetCount,\n countUpdateCallback,\n isFetching,\n hasMoreResults,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const rowBuffer = 5;\n\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {},\n totalRowsLoaded: undefined,\n isInitialized: false\n }).current;\n\n // tracking both state and pInfo.view to identify the initialization as in case of fullscreen, state will be available but pInfo.view won't\n const isInitialized = state && !!Object.keys(vi.pInfo.view ?? {}).length;\n\n const getTotalRowsIncludingBuffer = useCallback(() => {\n if (isEmpty(vi.totalRowsLoaded)) return;\n return hasMoreResults ? vi.totalRowsLoaded + rowBuffer : vi.totalRowsLoaded;\n }, [vi.totalRowsLoaded, hasMoreResults]);\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!isInitialized) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, getPContainer, callback, isInitialized]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but resting isFetch to false\n // goes to this method when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (!isFetching || resetIsFetchingWhenNoNewIndexes) {\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n isRefresh,\n true\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (\n isRefresh ||\n !state ||\n !(startIndex >= state.startIndex && endIndex <= state.endIndex)\n ) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n\n callback({ ...vi.pInfo.view, id });\n } else if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n }\n },\n [isFetching, getPContainer, getTotalRowsIncludingBuffer, vi, state, callback, id]\n );\n\n // update average stats for next calculation.\n const updateAvarageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h =\n (getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()) / itemCount) *\n rowContainerHeight;\n return h;\n },\n [getTotalRowsIncludingBuffer]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n getTotalRowsIncludingBuffer(),\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const rowElements = Array.from(getRowContainer().children || []).filter(a =>\n a.hasAttribute('data-key')\n );\n if (!rowElements.length) {\n vi.totalRowsLoaded = 0;\n return;\n }\n\n const lastRow = rowElements[rowElements.length - 1];\n const lastRowDataIndex = parseInt(lastRow.getAttribute('data-index'), 10);\n const newCount = hasMoreResults ? lastRowDataIndex + 1 + rowBuffer : lastRowDataIndex + 1;\n\n // if user is scrolling up/down within the already encountered records, the record count shouldn't update\n if (newCount < getTotalRowsIncludingBuffer() && !resetCount) return;\n\n vi.totalRowsLoaded = lastRowDataIndex + 1;\n countUpdateCallback(vi.totalRowsLoaded);\n }, [children, isFetching]);\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (!isInitialized) return;\n\n vi.currentEstimation = getCurrentEstimation(getRowContainer(), true);\n updateAvarageInVirtualizeInstance(vi.currentEstimation);\n const h = getBufferHeight(vi.currentEstimation);\n getBContainer().style.height = `${h}px`;\n }, [\n vi,\n children,\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n getTotalRowsIncludingBuffer,\n updateAvarageInVirtualizeInstance\n ]);\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (vi.pInfo.view.startIndex !== 0) pContainer.scrollTop = scrollTop;\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n state,\n pContainer,\n pContainer.scrollTop\n );\n }, [\n vi,\n state,\n isFetching,\n getScrollTop,\n getPContainer,\n updateScrollTop,\n getTotalRowsIncludingBuffer\n ]);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (isFetching) return;\n\n if (!isInitialized) {\n getPagination(true);\n return;\n }\n\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n getPContainer(),\n renderHeader\n )\n ) {\n getPagination(false, true);\n } else {\n setLoadingIndicatorInfo({});\n }\n }, [\n vi,\n isFetching,\n children,\n viewWidth,\n viewHeight,\n renderHeader,\n rContainerDimensionUpdate,\n getPagination,\n getPContainer,\n getTotalRowsIncludingBuffer\n ]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight: !vi.totalRowsLoaded ? '100px' : 'auto',\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={vi.totalRowsLoaded}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {/* Show loader only when there are some rows otherwise the parent spinner on RS should appear.\n Since in case of infinite table, totalRowsLoaded is derived from the rows only, using totalRowsLoaded here. */}\n {vi.totalRowsLoaded >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader $style={{ bottom: '100%' }}>\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n {children}\n {vi.totalRowsLoaded >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader $style={{ top: '100%' }}>\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n </div>\n {vi.totalRowsLoaded === 0 && !isFetching\n ? renderEmptyRecords && renderEmptyRecords()\n : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualizeInfinite.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n hasMoreResults: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n resetCount: PropTypes.bool,\n countUpdateCallback: PropTypes.func,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualizeInfinite.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n hasMoreResults: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n resetCount: false,\n countUpdateCallback: () => {},\n renderEmptyRecords: null\n};\n\nVirtualizeInfinite.displayName = 'VirtualizeInfinite';\n\nexport default memo(VirtualizeInfinite);\n"]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* This component is only used for grouped table
|
|
4
|
+
*/
|
|
2
5
|
import { forwardRef, memo, useEffect, useRef, useCallback, useImperativeHandle, useMemo, useLayoutEffect, useState } from 'react';
|
|
3
6
|
import Styled from 'styled-components';
|
|
4
7
|
import PropTypes from 'prop-types';
|
|
@@ -83,7 +86,7 @@ const Virtualize = forwardRef(({ id, viewHeight, viewWidth, totalRecordCount, it
|
|
|
83
86
|
height: getValueWithUnit(viewHeight, 'auto')
|
|
84
87
|
}), [viewWidth, viewHeight]);
|
|
85
88
|
const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);
|
|
86
|
-
const minHeight = useMemo(() => (totalRecordCount
|
|
89
|
+
const minHeight = useMemo(() => (!totalRecordCount ? '100px' : 'auto'), [totalRecordCount]);
|
|
87
90
|
// Calculate the pagination indexes and notify callback.
|
|
88
91
|
// resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled
|
|
89
92
|
// If view is not filled, we want to call this but restting isFetch to false
|
|
@@ -259,12 +262,18 @@ const Virtualize = forwardRef(({ id, viewHeight, viewWidth, totalRecordCount, it
|
|
|
259
262
|
vi.pContainer = c;
|
|
260
263
|
}, children: [renderHeader && renderHeader(), _jsxs("div", { className: 'bContainer', ref: c => {
|
|
261
264
|
vi.bContainer = c;
|
|
262
|
-
}, children: [
|
|
265
|
+
}, children: [totalRecordCount >= 0 &&
|
|
266
|
+
showLoadingIndicator &&
|
|
267
|
+
isFetching &&
|
|
268
|
+
loadingIndicatorInfo.isScrollingUp && (_jsx(StyledLoader, { "$style": {
|
|
263
269
|
top: '--above-loader-top',
|
|
264
270
|
left: '--loader-left'
|
|
265
271
|
}, children: _jsx(Progress, { className: 'above-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) })), _jsx("div", { className: `${rowContainerClass} row-container`, ref: c => {
|
|
266
272
|
vi.rContainer = c;
|
|
267
|
-
}, role: 'rowgroup', children: totalRecordCount === 0 && !isFetching ? null : children }),
|
|
273
|
+
}, role: 'rowgroup', children: totalRecordCount === 0 && !isFetching ? null : children }), totalRecordCount >= 0 &&
|
|
274
|
+
showLoadingIndicator &&
|
|
275
|
+
isFetching &&
|
|
276
|
+
loadingIndicatorInfo.isScrollingDown && (_jsx(StyledLoader, { "$style": {
|
|
268
277
|
top: '--below-loader-top',
|
|
269
278
|
left: '--loader-left'
|
|
270
279
|
}, children: _jsx(Progress, { className: 'below-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) }))] }), totalRecordCount === 0 ? renderEmptyRecords && renderEmptyRecords() : null, renderFooter && renderFooter()] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/index.jsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAAS,sBAAsB,CAAC,KAAK;IACnC,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AAChG,CAAC;AAED,MAAM,gBAAgB,GAAG,MAAM,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AC;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,gBAAgB,EAAE,SAAS;IAC3B,aAAa,EAAE,SAAS;IACxB,oBAAoB,EAAE,KAAK;IAC3B,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n updateRowContainerTop,\n setAttributesOnItems,\n isViewNotFilled,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n getPContainerClientWidth\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n /**\n * When height and maxHeight is auto, virtualization is not going to happen and the scroll jump on row deletion scenario is not going to happen.\n * In such cases, using relative position as sticky was used to fix scroll jump in firefox during virtualization.\n */\n .bContainer {\n position: ${props =>\n props.$style.maxHeight?.startsWith?.('auto') &&\n props.$style.height?.startsWith?.('auto')\n ? 'relative'\n : 'sticky'};\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n left: ${props => `var(${props.$style.left})`};\n top: ${props => `var(${props.$style.top})`};\n`;\n\nconst Virtualize = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n totalRecordCount,\n itemHeight,\n callback,\n isFetching,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {}\n }).current;\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!state) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, state, getPContainer]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n const minHeight = useMemo(\n () => (totalRecordCount === 0 ? '100px' : 'auto'),\n [totalRecordCount]\n );\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but restting isFetch to false\n // goes to this methid when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n isRefresh\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (!state || !(startIndex >= state.startIndex && endIndex <= state.endIndex)) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }\n },\n [vi, totalRecordCount, state, callback, id, getPContainer]\n );\n\n // update average stats for next calculation.\n const updateAverageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h = (getRecordCountForLayoutPaint(totalRecordCount) / itemCount) * rowContainerHeight;\n return h;\n },\n [totalRecordCount]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n // observe on row container to adjust the buffer container height.\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n totalRecordCount,\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n vi.currentEstimation = getCurrentEstimation(getRowContainer());\n updateAverageInVirtualizeInstance(vi.currentEstimation);\n const h = Math.floor(getBufferHeight(vi.currentEstimation));\n const previousHeight = getBContainer().offsetHeight;\n\n getBContainer().style.height = `${h}px`;\n vi.bContainerHeight = h;\n\n // if there was no previous height, then keep the scrolltop to 0 by default\n if (h !== previousHeight && previousHeight) {\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (scrollTop >= 0) {\n pContainer.scrollTop = scrollTop;\n }\n }\n }\n }, [\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n state,\n totalRecordCount,\n updateAverageInVirtualizeInstance,\n vi,\n getPContainer,\n getScrollTop\n ]);\n\n // update parent scroll top and row container top.\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n const pContainer = getPContainer();\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(totalRecordCount),\n state,\n pContainer,\n pContainer.scrollTop\n );\n\n const topLoaderHeight = 80;\n let top = getRowContainer().style.top;\n if (!top) {\n top = 0;\n }\n getBContainer().style.setProperty(\n '--above-loader-top',\n `${parseInt(top, 10) - topLoaderHeight}px`\n );\n\n getBContainer().style.setProperty(\n '--below-loader-top',\n `${parseInt(top, 10) + getRowContainer().offsetHeight}px`\n );\n }\n }, [\n getPContainer,\n getScrollTop,\n state,\n updateScrollTop,\n vi,\n rContainerDimensionUpdate,\n totalRecordCount,\n getRowContainer,\n getBContainer\n ]);\n\n // Added this block to overcome clipping issue for group header.\n const onPContainerDimensionUpdate = useCallback(() => {\n getPContainer()?.style.setProperty(\n '--container-width',\n `${getPContainerClientWidth(getPContainer())}px`\n );\n }, [getPContainer]);\n\n // observe on pContainer to adjust the width of row container.\n useResizeObserver(getPContainer, onPContainerDimensionUpdate);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (state && !isFetching && !isEmpty(totalRecordCount)) {\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n getPContainer(),\n renderHeader\n )\n )\n getPagination(false, true);\n else {\n setLoadingIndicatorInfo({});\n }\n } else if (!state || !Object.keys(vi.pInfo).length) getPagination(true);\n }, [\n rContainerDimensionUpdate,\n state,\n vi,\n totalRecordCount,\n viewHeight,\n viewWidth,\n renderHeader,\n getPagination,\n getPContainer\n ]);\n\n useEffect(() => {\n if (!isFetching) return;\n getBContainer().style.setProperty('--loader-left', `${getPContainer().scrollLeft}px`);\n }, [isFetching, getPContainer()?.scrollLeft]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight,\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={totalRecordCount}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader\n $style={{\n top: '--above-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {/** Do not add any other element in row-container apart from the rows as it will generate incorrect estimations */}\n {totalRecordCount === 0 && !isFetching ? null : children}\n </div>\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader\n $style={{\n top: '--below-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n {totalRecordCount === 0 ? renderEmptyRecords && renderEmptyRecords() : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualize.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n totalRecordCount: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualize.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n totalRecordCount: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n renderEmptyRecords: null\n};\n\nVirtualize.displayName = 'Virtualize';\n\nexport default memo(Virtualize);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/index.jsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,iBAA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CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACxE,oBAAoB,EAAE,SAAS,CAAC,IAAI;IACpC,kBAAkB,EAAE,SAAS,CAAC,IAAI;CACnC,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG;IACxB,gBAAgB,EAAE,CAAC;IACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,UAAU,EAAE,KAAK;IACjB,iBAAiB,EAAE,EAAE;IACrB,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,gBAAgB,EAAE,SAAS;IAC3B,aAAa,EAAE,SAAS;IACxB,oBAAoB,EAAE,KAAK;IAC3B,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC","sourcesContent":["/**\n * This component is only used for grouped table\n */\n\nimport {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n updateRowContainerTop,\n setAttributesOnItems,\n isViewNotFilled,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n getPContainerClientWidth\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n /**\n * When height and maxHeight is auto, virtualization is not going to happen and the scroll jump on row deletion scenario is not going to happen.\n * In such cases, using relative position as sticky was used to fix scroll jump in firefox during virtualization.\n */\n .bContainer {\n position: ${props =>\n props.$style.maxHeight?.startsWith?.('auto') &&\n props.$style.height?.startsWith?.('auto')\n ? 'relative'\n : 'sticky'};\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n left: ${props => `var(${props.$style.left})`};\n top: ${props => `var(${props.$style.top})`};\n`;\n\nconst Virtualize = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n totalRecordCount,\n itemHeight,\n callback,\n isFetching,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {}\n }).current;\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!state) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, state, getPContainer]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n const minHeight = useMemo(() => (!totalRecordCount ? '100px' : 'auto'), [totalRecordCount]);\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but restting isFetch to false\n // goes to this methid when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n isRefresh\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (!state || !(startIndex >= state.startIndex && endIndex <= state.endIndex)) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }\n },\n [vi, totalRecordCount, state, callback, id, getPContainer]\n );\n\n // update average stats for next calculation.\n const updateAverageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h = (getRecordCountForLayoutPaint(totalRecordCount) / itemCount) * rowContainerHeight;\n return h;\n },\n [totalRecordCount]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n // observe on row container to adjust the buffer container height.\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n totalRecordCount,\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n vi.currentEstimation = getCurrentEstimation(getRowContainer());\n updateAverageInVirtualizeInstance(vi.currentEstimation);\n const h = Math.floor(getBufferHeight(vi.currentEstimation));\n const previousHeight = getBContainer().offsetHeight;\n\n getBContainer().style.height = `${h}px`;\n vi.bContainerHeight = h;\n\n // if there was no previous height, then keep the scrolltop to 0 by default\n if (h !== previousHeight && previousHeight) {\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (scrollTop >= 0) {\n pContainer.scrollTop = scrollTop;\n }\n }\n }\n }, [\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n state,\n totalRecordCount,\n updateAverageInVirtualizeInstance,\n vi,\n getPContainer,\n getScrollTop\n ]);\n\n // update parent scroll top and row container top.\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n const pContainer = getPContainer();\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(totalRecordCount),\n state,\n pContainer,\n pContainer.scrollTop\n );\n\n const topLoaderHeight = 80;\n let top = getRowContainer().style.top;\n if (!top) {\n top = 0;\n }\n getBContainer().style.setProperty(\n '--above-loader-top',\n `${parseInt(top, 10) - topLoaderHeight}px`\n );\n\n getBContainer().style.setProperty(\n '--below-loader-top',\n `${parseInt(top, 10) + getRowContainer().offsetHeight}px`\n );\n }\n }, [\n getPContainer,\n getScrollTop,\n state,\n updateScrollTop,\n vi,\n rContainerDimensionUpdate,\n totalRecordCount,\n getRowContainer,\n getBContainer\n ]);\n\n // Added this block to overcome clipping issue for group header.\n const onPContainerDimensionUpdate = useCallback(() => {\n getPContainer()?.style.setProperty(\n '--container-width',\n `${getPContainerClientWidth(getPContainer())}px`\n );\n }, [getPContainer]);\n\n // observe on pContainer to adjust the width of row container.\n useResizeObserver(getPContainer, onPContainerDimensionUpdate);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (state && !isFetching && !isEmpty(totalRecordCount)) {\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n getPContainer(),\n renderHeader\n )\n )\n getPagination(false, true);\n else {\n setLoadingIndicatorInfo({});\n }\n } else if (!state || !Object.keys(vi.pInfo).length) getPagination(true);\n }, [\n rContainerDimensionUpdate,\n state,\n vi,\n totalRecordCount,\n viewHeight,\n viewWidth,\n renderHeader,\n getPagination,\n getPContainer\n ]);\n\n useEffect(() => {\n if (!isFetching) return;\n getBContainer().style.setProperty('--loader-left', `${getPContainer().scrollLeft}px`);\n }, [isFetching, getPContainer()?.scrollLeft]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight,\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={totalRecordCount}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n {/* Show loader only when there are some rows otherwise the parent spinner on RS should appear.\n Since in case of grouped table, presence of totalRecordsCount is always available and is tied with the rows, using totalRecordsCount here. */}\n {totalRecordCount >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader\n $style={{\n top: '--above-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {/** Do not add any other element in row-container apart from the rows as it will generate incorrect estimations */}\n {totalRecordCount === 0 && !isFetching ? null : children}\n </div>\n {totalRecordCount >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader\n $style={{\n top: '--below-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n {totalRecordCount === 0 ? renderEmptyRecords && renderEmptyRecords() : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualize.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n totalRecordCount: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualize.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n totalRecordCount: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n renderEmptyRecords: null\n};\n\nVirtualize.displayName = 'Virtualize';\n\nexport default memo(Virtualize);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { GalleryCardProps } from '../Gallery.types';
|
|
2
|
-
declare const GalleryCard: import("react").MemoExoticComponent<({ headerColumn,
|
|
2
|
+
declare const GalleryCard: import("react").MemoExoticComponent<({ headerColumn, row, meta, visibleColumns }: GalleryCardProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default GalleryCard;
|
|
4
4
|
//# sourceMappingURL=GalleryCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryCard.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"GalleryCard.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,QAAA,MAAM,WAAW,oFAAsD,gBAAgB,6CA0BrF,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { SelectionCardDisplay } from '@pega/cosmos-react-core';
|
|
4
|
-
import { getCardData } from '../utils';
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { getCardData, getCardUIProps } from '../utils';
|
|
5
|
+
import useRowActions from '../hooks/useRowActions';
|
|
6
|
+
const GalleryCard = memo(({ headerColumn, row, meta, visibleColumns }) => {
|
|
7
|
+
const { label, image, fields, 'aria-label': ariaLabel } = getCardData({
|
|
7
8
|
row,
|
|
8
9
|
visibleColumns,
|
|
9
10
|
meta,
|
|
10
|
-
headerColumn
|
|
11
|
-
actionColumn
|
|
11
|
+
headerColumn
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
const uiProps = getCardUIProps({ row });
|
|
14
|
+
const fetchActionsCb = useRowActions({ row, meta });
|
|
15
|
+
return (_jsx(SelectionCardDisplay, { "aria-label": ariaLabel, label: label, image: image, fields: fields, actions: fetchActionsCb, ...uiProps }));
|
|
14
16
|
});
|
|
15
17
|
export default GalleryCard;
|
|
16
18
|
//# sourceMappingURL=GalleryCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryCard.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"GalleryCard.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAoB,EAAE,EAAE;IACzF,MAAM,EACJ,KAAK,EACL,KAAK,EACL,MAAM,EACN,YAAY,EAAE,SAAS,EACxB,GAAG,WAAW,CAAC;QACd,GAAG;QACH,cAAc;QACd,IAAI;QACJ,YAAY;KACb,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACxC,MAAM,cAAc,GAAG,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAEpD,OAAO,CACL,KAAC,oBAAoB,kBACP,SAAS,EACrB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,KACnB,OAAO,GACX,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { memo } from 'react';\n\nimport { SelectionCardDisplay } from '@pega/cosmos-react-core';\n\nimport type { GalleryCardProps } from '../Gallery.types';\nimport { getCardData, getCardUIProps } from '../utils';\nimport useRowActions from '../hooks/useRowActions';\n\nconst GalleryCard = memo(({ headerColumn, row, meta, visibleColumns }: GalleryCardProps) => {\n const {\n label,\n image,\n fields,\n 'aria-label': ariaLabel\n } = getCardData({\n row,\n visibleColumns,\n meta,\n headerColumn\n });\n\n const uiProps = getCardUIProps({ row });\n const fetchActionsCb = useRowActions({ row, meta });\n\n return (\n <SelectionCardDisplay\n aria-label={ariaLabel}\n label={label}\n image={image}\n fields={fields}\n actions={fetchActionsCb}\n {...uiProps}\n />\n );\n});\n\nexport default GalleryCard;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
+
import type { GalleryCardProps } from '../Gallery.types';
|
|
3
|
+
interface GalleryCheckboxCardProps extends GalleryCardProps {
|
|
4
|
+
selectionColumn: RsCoreTypes.Column;
|
|
5
|
+
}
|
|
6
|
+
declare const GalleryCheckboxCard: import("react").MemoExoticComponent<({ headerColumn, selectionColumn, row, meta, visibleColumns }: GalleryCheckboxCardProps) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export default GalleryCheckboxCard;
|
|
8
|
+
//# sourceMappingURL=GalleryCheckboxCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryCheckboxCard.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCheckboxCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,UAAU,wBAAyB,SAAQ,gBAAgB;IACzD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC;CACrC;AAED,QAAA,MAAM,mBAAmB,qGACwC,wBAAwB,6CA2CxF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from 'react';
|
|
3
|
+
import { CheckboxCard } from '@pega/cosmos-react-core';
|
|
4
|
+
import { getCardData, getCardUIProps } from '../utils';
|
|
5
|
+
import useRowActions from '../hooks/useRowActions';
|
|
6
|
+
const GalleryCheckboxCard = memo(({ headerColumn, selectionColumn, row, meta, visibleColumns }) => {
|
|
7
|
+
const { label, image, fields, 'aria-label': ariaLabel } = getCardData({
|
|
8
|
+
row,
|
|
9
|
+
visibleColumns,
|
|
10
|
+
meta,
|
|
11
|
+
headerColumn
|
|
12
|
+
});
|
|
13
|
+
const uiProps = getCardUIProps({ row });
|
|
14
|
+
const { selectRow, getContext } = row;
|
|
15
|
+
const disableSelectionOnLoad = selectionColumn
|
|
16
|
+
.getContext()
|
|
17
|
+
?.getRsMeta()?.disableSelectionOnLoad;
|
|
18
|
+
// TODO: identify the usecase for column.disableSelection. Keeping it for now to keep the behavior in sync with RowSelectionColumn in table.
|
|
19
|
+
const disableSelection = selectionColumn.disableSelection ?? disableSelectionOnLoad;
|
|
20
|
+
const handleChange = useCallback((event) => selectRow(event.target.checked), [row, selectRow]);
|
|
21
|
+
const fetchActionsCb = useRowActions({ row, meta });
|
|
22
|
+
return (_jsx(CheckboxCard, { "aria-label": ariaLabel, label: label, image: image, fields: fields, onChange: handleChange, checked: getContext()?.$selected, readOnly: disableSelection, ...uiProps, actions: fetchActionsCb }));
|
|
23
|
+
});
|
|
24
|
+
export default GalleryCheckboxCard;
|
|
25
|
+
//# sourceMappingURL=GalleryCheckboxCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryCheckboxCard.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCheckboxCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAoB,MAAM,OAAO,CAAC;AAG5D,OA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ACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { memo, useCallback, type ChangeEvent } from 'react';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport { CheckboxCard } from '@pega/cosmos-react-core';\n\nimport type { GalleryCardProps } from '../Gallery.types';\nimport { getCardData, getCardUIProps } from '../utils';\nimport useRowActions from '../hooks/useRowActions';\n\ninterface GalleryCheckboxCardProps extends GalleryCardProps {\n selectionColumn: RsCoreTypes.Column;\n}\n\nconst GalleryCheckboxCard = memo(\n ({ headerColumn, selectionColumn, row, meta, visibleColumns }: GalleryCheckboxCardProps) => {\n const {\n label,\n image,\n fields,\n 'aria-label': ariaLabel\n } = getCardData({\n row,\n visibleColumns,\n meta,\n headerColumn\n });\n\n const uiProps = getCardUIProps({ row });\n\n const { selectRow, getContext } = row;\n const disableSelectionOnLoad = selectionColumn\n .getContext()\n ?.getRsMeta()?.disableSelectionOnLoad;\n // TODO: identify the usecase for column.disableSelection. Keeping it for now to keep the behavior in sync with RowSelectionColumn in table.\n const disableSelection = selectionColumn.disableSelection ?? disableSelectionOnLoad;\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => selectRow(event.target.checked),\n [row, selectRow]\n );\n\n const fetchActionsCb = useRowActions({ row, meta });\n\n return (\n <CheckboxCard\n aria-label={ariaLabel}\n label={label}\n image={image}\n fields={fields}\n onChange={handleChange}\n checked={getContext()?.$selected}\n readOnly={disableSelection}\n {...uiProps}\n actions={fetchActionsCb}\n />\n );\n }\n);\n\nexport default GalleryCheckboxCard;\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
2
|
type GalleryHeaderProps = {
|
|
3
3
|
headerColumn?: RsCoreTypes.Column;
|
|
4
|
-
actionColumn?: RsCoreTypes.Column;
|
|
5
4
|
row: RsCoreTypes.Row;
|
|
6
5
|
};
|
|
7
|
-
declare function GalleryHeader({ headerColumn,
|
|
6
|
+
declare function GalleryHeader({ headerColumn, row }: GalleryHeaderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
7
|
export default GalleryHeader;
|
|
9
8
|
//# sourceMappingURL=GalleryHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryHeader.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,KAAK,kBAAkB,GAAG;IACxB,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;IAClC,
|
|
1
|
+
{"version":3,"file":"GalleryHeader.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,KAAK,kBAAkB,GAAG;IACxB,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC;CACtB,CAAC;AAMF,iBAAS,aAAa,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,kBAAkB,kDAY/D;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import RenderingEngine from '../../../Components/RenderingEngine/RenderCell';
|
|
4
4
|
const StyledHeaderContainer = styled.div `
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: 0.5rem;
|
|
8
5
|
word-break: break-word;
|
|
9
6
|
`;
|
|
10
|
-
function GalleryHeader({ headerColumn,
|
|
11
|
-
if (!
|
|
7
|
+
function GalleryHeader({ headerColumn, row }) {
|
|
8
|
+
if (!headerColumn) {
|
|
12
9
|
return null;
|
|
13
10
|
}
|
|
14
11
|
headerColumn?.setExecutionContext(row);
|
|
15
|
-
|
|
16
|
-
return (_jsxs(StyledHeaderContainer, { children: [headerColumn ? _jsx(RenderingEngine, { ...headerColumn.getRenderingEngineProps() }) : null, actionColumn ? _jsx(RenderingEngine, { ...actionColumn.getRenderingEngineProps() }) : null] }));
|
|
12
|
+
return (_jsx(StyledHeaderContainer, { children: _jsx(RenderingEngine, { ...headerColumn.getRenderingEngineProps() }) }));
|
|
17
13
|
}
|
|
18
14
|
export default GalleryHeader;
|
|
19
15
|
//# sourceMappingURL=GalleryHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryHeader.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAIvC,OAAO,eAAe,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"GalleryHeader.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAIvC,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAO7E,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEvC,CAAC;AAEF,SAAS,aAAa,CAAC,EAAE,YAAY,EAAE,GAAG,EAAsB;IAC9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAEvC,OAAO,CACL,KAAC,qBAAqB,cACpB,KAAC,eAAe,OAAK,YAAY,CAAC,uBAAuB,EAAE,GAAI,GACzC,CACzB,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC","sourcesContent":["import styled from 'styled-components';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport RenderingEngine from '../../../Components/RenderingEngine/RenderCell';\n\ntype GalleryHeaderProps = {\n headerColumn?: RsCoreTypes.Column;\n row: RsCoreTypes.Row;\n};\n\nconst StyledHeaderContainer = styled.div`\n word-break: break-word;\n`;\n\nfunction GalleryHeader({ headerColumn, row }: GalleryHeaderProps) {\n if (!headerColumn) {\n return null;\n }\n\n headerColumn?.setExecutionContext(row);\n\n return (\n <StyledHeaderContainer>\n <RenderingEngine {...headerColumn.getRenderingEngineProps()} />\n </StyledHeaderContainer>\n );\n}\n\nexport default GalleryHeader;\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
2
|
export interface GalleryCardProps {
|
|
3
3
|
headerColumn?: RsCoreTypes.Column;
|
|
4
|
-
actionColumn?: RsCoreTypes.Column;
|
|
5
4
|
row: RsCoreTypes.Row;
|
|
6
5
|
meta: RsCoreTypes.Meta;
|
|
7
6
|
visibleColumns: RsCoreTypes.Column[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gallery.types.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Gallery/Gallery.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;IAClC,
|
|
1
|
+
{"version":3,"file":"Gallery.types.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Gallery/Gallery.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;IACvB,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gallery.types.js","sourceRoot":"","sources":["../../../../Core/Views/Gallery/Gallery.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nexport interface GalleryCardProps {\n headerColumn?: RsCoreTypes.Column;\n
|
|
1
|
+
{"version":3,"file":"Gallery.types.js","sourceRoot":"","sources":["../../../../Core/Views/Gallery/Gallery.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nexport interface GalleryCardProps {\n headerColumn?: RsCoreTypes.Column;\n row: RsCoreTypes.Row;\n meta: RsCoreTypes.Meta;\n visibleColumns: RsCoreTypes.Column[];\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
+
import type { Action } from '@pega/cosmos-react-core';
|
|
3
|
+
interface UseRowActionsProps {
|
|
4
|
+
row: RsCoreTypes.Row;
|
|
5
|
+
meta: RsCoreTypes.Meta;
|
|
6
|
+
}
|
|
7
|
+
declare const useRowActions: ({ row, meta }: UseRowActionsProps) => (() => Promise<Action[]>) | undefined;
|
|
8
|
+
export default useRowActions;
|
|
9
|
+
//# sourceMappingURL=useRowActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRowActions.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/hooks/useRowActions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,UAAU,kBAAkB;IAC1B,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;CACxB;AAED,QAAA,MAAM,aAAa,GAAI,eAGpB,kBAAkB,KAAG,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAuBnD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
const useRowActions = ({ row, meta }) => {
|
|
3
|
+
const fetchActions = useCallback(async () => {
|
|
4
|
+
const rowContext = row.getContext();
|
|
5
|
+
let allActions = meta.rowActions ?? [];
|
|
6
|
+
try {
|
|
7
|
+
const dynamicActions = await rowContext.getRowActionDetails(rowContext.getValue());
|
|
8
|
+
if (Array.isArray(dynamicActions)) {
|
|
9
|
+
allActions = [...dynamicActions, ...allActions];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
// On error, fall back to static actions only
|
|
14
|
+
}
|
|
15
|
+
return allActions.map(action => ({
|
|
16
|
+
...action,
|
|
17
|
+
onClick: () => {
|
|
18
|
+
action.onClick(rowContext.getValue(), rowContext.refreshRow);
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
}, [row, meta.rowActions]);
|
|
22
|
+
return meta.editing || meta.deleting ? fetchActions : undefined;
|
|
23
|
+
};
|
|
24
|
+
export default useRowActions;
|
|
25
|
+
//# sourceMappingURL=useRowActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRowActions.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/hooks/useRowActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAUpC,MAAM,aAAa,GAAG,CAAC,EACrB,GAAG,EACH,IAAI,EACe,EAAyC,EAAE;IAC9D,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,IAAuB,EAAE;QAC7D,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;QAEvC,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,mBAAmB,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnF,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBAClC,UAAU,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,UAAU,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,6CAA6C;QAC/C,CAAC;QAED,OAAO,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC/B,GAAG,MAAM;YACT,OAAO,EAAE,GAAG,EAAE;gBACZ,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;YAC/D,CAAC;SACF,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAE3B,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useCallback } from 'react';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { Action } from '@pega/cosmos-react-core';\n\ninterface UseRowActionsProps {\n row: RsCoreTypes.Row;\n meta: RsCoreTypes.Meta;\n}\n\nconst useRowActions = ({\n row,\n meta\n}: UseRowActionsProps): (() => Promise<Action[]>) | undefined => {\n const fetchActions = useCallback(async (): Promise<Action[]> => {\n const rowContext = row.getContext();\n let allActions = meta.rowActions ?? [];\n\n try {\n const dynamicActions = await rowContext.getRowActionDetails(rowContext.getValue());\n if (Array.isArray(dynamicActions)) {\n allActions = [...dynamicActions, ...allActions];\n }\n } catch (error) {\n // On error, fall back to static actions only\n }\n\n return allActions.map(action => ({\n ...action,\n onClick: () => {\n action.onClick(rowContext.getValue(), rowContext.refreshRow);\n }\n }));\n }, [row, meta.rowActions]);\n\n return meta.editing || meta.deleting ? fetchActions : undefined;\n};\n\nexport default useRowActions;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Gallery/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Gallery/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAgB7E,iBAAS,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAA;CAAE,2CAsEpD;kBAtEQ,OAAO;;;AA0EhB,eAAe,OAAO,CAAC"}
|
|
@@ -2,28 +2,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { FieldType } from 'pega-repeating-structures-core';
|
|
4
4
|
import { useFullscreenContext } from '@pega/cosmos-react-core';
|
|
5
|
+
import { rowSelectColumnMeta } from 'pega-repeating-structures-core/lib/src/core/constants';
|
|
5
6
|
import Virtualiser from '../Table/VirtualizeWrapper';
|
|
6
7
|
import Toolbar from '../../Components/Toolbar';
|
|
7
8
|
import RenderView from '../../Components/RenderingEngine/RenderView';
|
|
8
|
-
import { EXTERNAL_FILTERS } from '../../constants';
|
|
9
|
+
import { EXTERNAL_FILTERS, SELECTION_MODES } from '../../constants';
|
|
9
10
|
import RsCardWrapper from '../RsCardWrapper';
|
|
11
|
+
import LoadingIndicator from '../../Components/LoadingIndicator';
|
|
10
12
|
import GalleryCard from './Components/GalleryCard';
|
|
13
|
+
import GalleryCheckboxCard from './Components/GalleryCheckboxCard';
|
|
11
14
|
import StyledGalleryContainer, { StyledVirtualizeContainer } from './StyledGalleryContainer';
|
|
12
15
|
import { isInlineImage } from './utils';
|
|
13
16
|
function Gallery({ view }) {
|
|
14
17
|
const isFullscreen = !!useFullscreenContext()?.[0];
|
|
15
18
|
const { columns = [], meta, rows } = view;
|
|
16
|
-
const { galleryConfig: { heroImage, header } = {} } = meta;
|
|
17
|
-
const headerColumn = useMemo(() => (header?.field ? columns.find(col => col.field.
|
|
18
|
-
const
|
|
19
|
+
const { galleryConfig: { heroImage, header } = {}, selectionMode } = meta;
|
|
20
|
+
const headerColumn = useMemo(() => (header?.field ? columns.find(col => col.field.id === header.field) : undefined), [header, columns]);
|
|
21
|
+
const selectionColumn = useMemo(() => columns.find(col => col.field.id === rowSelectColumnMeta.field.id), [columns]);
|
|
19
22
|
const visibleColumns = useMemo(() => {
|
|
20
23
|
const cols = [...columns].filter(col => !col.hidden && col.field.type !== FieldType.ACTION_FIELD_TYPE);
|
|
21
24
|
cols.sort((colA, colB) => (colA.order ?? 0) - (colB.order ?? 0));
|
|
22
25
|
return cols;
|
|
23
26
|
}, [columns]);
|
|
24
|
-
return (_jsx(RsCardWrapper, { children: _jsxs(StyledGalleryContainer, { "data-test-id": 'gallery', "data-testid": 'gallery', view: view, isFullscreen: isFullscreen, isInlineImage: isInlineImage(heroImage), children: [_jsx(Toolbar, { view: view }), _jsx(RenderView, { view: view, type: EXTERNAL_FILTERS }),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
return (_jsx(RsCardWrapper, { children: _jsxs(StyledGalleryContainer, { "data-test-id": 'gallery', "data-testid": 'gallery', view: view, isFullscreen: isFullscreen, isInlineImage: isInlineImage(heroImage), children: [_jsx(Toolbar, { view: view }), _jsx(RenderView, { view: view, type: EXTERNAL_FILTERS }), _jsxs(StyledVirtualizeContainer, { className: 'container', children: [_jsx(Virtualiser, { id: 'rootVirtualiser', rowContainerClass: 'grid-container', view: view, bufferMultiplier: 0.6, children: rows?.length
|
|
28
|
+
? rows.map(row => selectionMode === SELECTION_MODES.multi && selectionColumn ? (_jsx(GalleryCheckboxCard, { meta: meta, row: row, visibleColumns: visibleColumns, headerColumn: headerColumn, selectionColumn: selectionColumn }, row.reactKey)) : (_jsx(GalleryCard, { meta: meta, row: row, visibleColumns: visibleColumns, headerColumn: headerColumn }, row.reactKey)))
|
|
29
|
+
: [] }), _jsx(LoadingIndicator, { view: view, show: !rows || !!view.isLoading })] })] }) }));
|
|
27
30
|
}
|
|
28
31
|
Gallery.displayName = 'Gallery';
|
|
29
32
|
export default Gallery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Views/Gallery/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAoB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Views/Gallery/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAoB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAE5F,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,UAAU,MAAM,6CAA6C,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,mCAAmC,CAAC;AAEjE,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,mBAAmB,MAAM,kC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,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,GAAI,IACvC,IACL,GACX,CACjB,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAEhC,eAAe,OAAO,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport { FieldType, type RsCoreTypes } from 'pega-repeating-structures-core';\nimport { useFullscreenContext } from '@pega/cosmos-react-core';\nimport { rowSelectColumnMeta } from 'pega-repeating-structures-core/lib/src/core/constants';\n\nimport Virtualiser from '../Table/VirtualizeWrapper';\nimport Toolbar from '../../Components/Toolbar';\nimport RenderView from '../../Components/RenderingEngine/RenderView';\nimport { EXTERNAL_FILTERS, SELECTION_MODES } from '../../constants';\nimport RsCardWrapper from '../RsCardWrapper';\nimport LoadingIndicator from '../../Components/LoadingIndicator';\n\nimport GalleryCard from './Components/GalleryCard';\nimport GalleryCheckboxCard from './Components/GalleryCheckboxCard';\nimport StyledGalleryContainer, { StyledVirtualizeContainer } from './StyledGalleryContainer';\nimport { isInlineImage } from './utils';\n\nfunction Gallery({ view }: { view: RsCoreTypes.View }) {\n const isFullscreen = !!useFullscreenContext()?.[0];\n\n const { columns = [], meta, rows } = view;\n const { galleryConfig: { heroImage, header } = {}, selectionMode } = meta;\n\n const headerColumn = useMemo(\n () => (header?.field ? columns.find(col => col.field.id === header.field) : undefined),\n [header, columns]\n );\n\n const selectionColumn = useMemo(\n () => columns.find(col => col.field.id === rowSelectColumnMeta.field.id),\n [columns]\n );\n\n const visibleColumns = useMemo(() => {\n const cols = [...columns].filter(\n col => !col.hidden && col.field.type !== FieldType.ACTION_FIELD_TYPE\n );\n cols.sort((colA, colB) => (colA.order ?? 0) - (colB.order ?? 0));\n return cols;\n }, [columns]);\n\n return (\n <RsCardWrapper>\n <StyledGalleryContainer\n data-test-id='gallery'\n data-testid='gallery'\n view={view}\n isFullscreen={isFullscreen}\n isInlineImage={isInlineImage(heroImage)}\n >\n <Toolbar view={view} />\n <RenderView view={view} type={EXTERNAL_FILTERS} />\n <StyledVirtualizeContainer className='container'>\n <Virtualiser\n id='rootVirtualiser'\n rowContainerClass='grid-container'\n view={view}\n bufferMultiplier={0.6}\n >\n {rows?.length\n ? rows.map(row =>\n selectionMode === SELECTION_MODES.multi && selectionColumn ? (\n <GalleryCheckboxCard\n key={row.reactKey}\n meta={meta}\n row={row}\n visibleColumns={visibleColumns}\n headerColumn={headerColumn}\n selectionColumn={selectionColumn}\n />\n ) : (\n <GalleryCard\n key={row.reactKey}\n meta={meta}\n row={row}\n visibleColumns={visibleColumns}\n headerColumn={headerColumn}\n />\n )\n )\n : []}\n </Virtualiser>\n <LoadingIndicator view={view} show={!rows || !!view.isLoading} />\n </StyledVirtualizeContainer>\n </StyledGalleryContainer>\n </RsCardWrapper>\n );\n}\n\nGallery.displayName = 'Gallery';\n\nexport default Gallery;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
2
|
import type { SelectionCardDisplayProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { GalleryCardProps } from './Gallery.types';
|
|
4
4
|
/**
|
|
@@ -19,5 +19,18 @@ export declare function isInlineImage(heroImage?: RsCoreTypes.HeroImage): boolea
|
|
|
19
19
|
* @param props.actionColumn - The column used for card actions.
|
|
20
20
|
* @returns An object containing the card's label, image, and fields to be displayed.
|
|
21
21
|
*/
|
|
22
|
-
export declare function getCardData({ row, visibleColumns, meta, headerColumn
|
|
22
|
+
export declare function getCardData({ row, visibleColumns, meta, headerColumn }: GalleryCardProps): Pick<SelectionCardDisplayProps, 'label' | 'image' | 'fields' | 'aria-label'>;
|
|
23
|
+
/**
|
|
24
|
+
* Extracts UI-related props from a row for card components.
|
|
25
|
+
*
|
|
26
|
+
* @param props - The properties containing the row.
|
|
27
|
+
* @param props.row - The data row.
|
|
28
|
+
* @returns An object containing aria-rowindex and data-key for the card.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCardUIProps({ row }: {
|
|
31
|
+
row: RsCoreTypes.Row;
|
|
32
|
+
}): {
|
|
33
|
+
'aria-rowindex': number;
|
|
34
|
+
'data-key': string;
|
|
35
|
+
};
|
|
23
36
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Gallery/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Gallery/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAA6B,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAmDxD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,GAAG,OAAO,CAKxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,cAAc,EACd,IAAI,EACJ,YAAY,EACb,EAAE,gBAAgB,GAAG,IAAI,CAAC,yBAAyB,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC,CAkBjG;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,WAAW,CAAC,GAAG,CAAA;CAAE;;;EAM/D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isEmpty } from 'pega-repeating-structures-core';
|
|
2
3
|
import GalleryFieldValue from './Components/GalleryFieldValue';
|
|
3
4
|
import GalleryHeader from './Components/GalleryHeader';
|
|
4
5
|
const GALLERY_IMAGE_PLACEMENT_MAP = {
|
|
@@ -58,7 +59,7 @@ export function isInlineImage(heroImage) {
|
|
|
58
59
|
* @param props.actionColumn - The column used for card actions.
|
|
59
60
|
* @returns An object containing the card's label, image, and fields to be displayed.
|
|
60
61
|
*/
|
|
61
|
-
export function getCardData({ row, visibleColumns, meta, headerColumn
|
|
62
|
+
export function getCardData({ row, visibleColumns, meta, headerColumn }) {
|
|
62
63
|
const { galleryConfig: { heroImage, showFieldLabels = true } = {} } = meta;
|
|
63
64
|
const fields = visibleColumns.map(col => ({
|
|
64
65
|
id: col.field.id,
|
|
@@ -66,8 +67,24 @@ export function getCardData({ row, visibleColumns, meta, headerColumn, actionCol
|
|
|
66
67
|
value: _jsx(GalleryFieldValue, { column: col, row: row })
|
|
67
68
|
}));
|
|
68
69
|
const image = heroImage ? getImageData(meta, row) : undefined;
|
|
69
|
-
const label = _jsx(GalleryHeader, { headerColumn: headerColumn,
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const label = _jsx(GalleryHeader, { headerColumn: headerColumn, row: row });
|
|
71
|
+
const { getContext } = row;
|
|
72
|
+
const headerValue = getContext()?.getRowHeader()?.getValue();
|
|
73
|
+
const ariaLabel = !isEmpty(headerValue) ? String(headerValue) : undefined;
|
|
74
|
+
return { fields, image, label, 'aria-label': ariaLabel };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extracts UI-related props from a row for card components.
|
|
78
|
+
*
|
|
79
|
+
* @param props - The properties containing the row.
|
|
80
|
+
* @param props.row - The data row.
|
|
81
|
+
* @returns An object containing aria-rowindex and data-key for the card.
|
|
82
|
+
*/
|
|
83
|
+
export function getCardUIProps({ row }) {
|
|
84
|
+
const uiProps = row.getUIProps();
|
|
85
|
+
return {
|
|
86
|
+
'aria-rowindex': uiProps['aria-rowindex'],
|
|
87
|
+
'data-key': uiProps['data-key']
|
|
88
|
+
};
|
|
72
89
|
}
|
|
73
90
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../Core/Views/Gallery/utils.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../Core/Views/Gallery/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,gCAAgC,CAAC;AAI3E,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,MAAM,2BAA2B,GAA2D;IAC1F,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,YAAY;IACnB,GAAG,EAAE,aAAa;CACV,CAAC;AAEX,MAAM,iBAAiB,GAAqC,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AACvF,MAAM,uBAAuB,GAAmC,MAAM,CAAC;AACvE,MAAM,kBAAkB,GAAc,UAAU,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,SAAS,YAAY,CACnB,IAAsB,EACtB,GAAoB;IAOpB,MAAM,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IAC9F,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE5C,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;QAClC,YAAY,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChF,CAAC;SAAM,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;QACzC,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC;IAC/B,CAAC;IAED,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KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE9D,MAAM,KAAK,GAAG,KAAC,aAAa,IAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IAEtE,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;IAC3B,MAAM,WAAW,GAAG,UAAU,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC;IAC7D,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,GAAG,EAA4B;IAC9D,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;IACjC,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC;QACzC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;KAChC,CAAC;AACJ,CAAC","sourcesContent":["import { isEmpty, type RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { ImagePlacement, ImageSize, SelectionCardDisplayProps } from '@pega/cosmos-react-core';\n\nimport type { GalleryCardProps } from './Gallery.types';\nimport GalleryFieldValue from './Components/GalleryFieldValue';\nimport GalleryHeader from './Components/GalleryHeader';\n\nconst GALLERY_IMAGE_PLACEMENT_MAP: Record<RsCoreTypes.HeroImagePlacement, ImagePlacement> = {\n left: 'inline-start',\n right: 'inline-end',\n top: 'block-start'\n} as const;\n\nconst INLINE_PLACEMENTS: RsCoreTypes.HeroImagePlacement[] = ['left', 'right'] as const;\nconst DEFAULT_IMAGE_PLACEMENT: RsCoreTypes.HeroImagePlacement = 'left';\nconst DEFAULT_IMAGE_SIZE: ImageSize = 'flexible';\n\n/**\n * Extracts image data from the provided metadata and row context.\n *\n * @param meta - The metadata object containing gallery configuration.\n * @param row - The row object providing context and data values.\n * @returns An object containing:\n * - `src`: The image source URL.\n * - `alt`: The alternative text for the image.\n * - `placement`: The placement of the image within the gallery.\n * - `size`: The size of the image.\n */\nfunction getImageData(\n meta: RsCoreTypes.Meta,\n row: RsCoreTypes.Row\n): {\n src: string;\n alt: string;\n placement: ImagePlacement;\n size: ImageSize;\n} {\n const { galleryConfig: { heroImage: { source, altText, placement, size } = {} } = {} } = meta;\n const rowData = row.getContext().getValue();\n\n let altTextValue = '';\n if (altText && 'field' in altText) {\n altTextValue = altText.field in rowData ? String(rowData[altText.field]) : '';\n } else if (altText && 'value' in altText) {\n altTextValue = altText.value;\n }\n\n const imageUrl = source?.field && source?.field in rowData ? String(rowData[source.field]) : '';\n const imagePlacement = GALLERY_IMAGE_PLACEMENT_MAP[placement ?? DEFAULT_IMAGE_PLACEMENT];\n const imageSize = size || DEFAULT_IMAGE_SIZE;\n\n return { src: imageUrl, alt: altTextValue, placement: imagePlacement, size: imageSize };\n}\n\n/**\n * Determines if the provided hero image should be displayed inline based on its placement.\n *\n * @param heroImage - The hero image object.\n * @returns `true` if the image's placement is considered inline; otherwise, `false`.\n */\nexport function isInlineImage(heroImage?: RsCoreTypes.HeroImage): boolean {\n if (!heroImage?.source) return false;\n\n const placement = heroImage.placement ?? DEFAULT_IMAGE_PLACEMENT;\n return INLINE_PLACEMENTS.includes(placement);\n}\n\n/**\n * Generates the data required to display a card in the gallery view.\n *\n * @param props - The properties required to generate the card data.\n * @param props.row - The data for the current row.\n * @param props.visibleColumns - The columns that are visible in the gallery.\n * @param props.meta - Metadata including gallery configuration.\n * @param props.headerColumn - The column used for the card header.\n * @param props.actionColumn - The column used for card actions.\n * @returns An object containing the card's label, image, and fields to be displayed.\n */\nexport function getCardData({\n row,\n visibleColumns,\n meta,\n headerColumn\n}: GalleryCardProps): Pick<SelectionCardDisplayProps, 'label' | 'image' | 'fields' | 'aria-label'> {\n const { galleryConfig: { heroImage, showFieldLabels = true } = {} } = meta;\n\n const fields = visibleColumns.map(col => ({\n id: col.field.id,\n ...(showFieldLabels && { name: col.field.label }),\n value: <GalleryFieldValue column={col} row={row} />\n }));\n\n const image = heroImage ? getImageData(meta, row) : undefined;\n\n const label = <GalleryHeader headerColumn={headerColumn} row={row} />;\n\n const { getContext } = row;\n const headerValue = getContext()?.getRowHeader()?.getValue();\n const ariaLabel = !isEmpty(headerValue) ? String(headerValue) : undefined;\n\n return { fields, image, label, 'aria-label': ariaLabel };\n}\n\n/**\n * Extracts UI-related props from a row for card components.\n *\n * @param props - The properties containing the row.\n * @param props.row - The data row.\n * @returns An object containing aria-rowindex and data-key for the card.\n */\nexport function getCardUIProps({ row }: { row: RsCoreTypes.Row }) {\n const uiProps = row.getUIProps();\n return {\n 'aria-rowindex': uiProps['aria-rowindex'],\n 'data-key': uiProps['data-key']\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizeWrapper.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":"AAgBA;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"VirtualizeWrapper.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":"AAgBA;;;;;;;;;;4CA0JC;;;;;;;;;;;;;;;;;sBA1KqB,YAAY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
|
|
5
5
|
import Virtualize from '../../Components/Virtualise';
|
|
6
6
|
import VirtualizeInfinite from '../../Components/Virtualise/VirtualizeInfinite';
|
|
7
7
|
import VariableHeightVirtualizer from '../../Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer';
|
|
@@ -17,20 +17,16 @@ useVariableRowHeightVirtualization = false, bufferMultiplier }) {
|
|
|
17
17
|
const { state, meta } = view;
|
|
18
18
|
const { filterExpression, searchText, externalState } = state;
|
|
19
19
|
const [translate] = useTranslate();
|
|
20
|
-
const isProgressiveVirtualizerEverLoaded = useRef(false);
|
|
21
20
|
const paginationPayload = useRef({});
|
|
22
21
|
const [isFetching, setIsFetching] = useState(false);
|
|
23
22
|
const [hasMoreResults, setHasMoreResults] = useState(false);
|
|
24
|
-
const infiniteModeTable = isProgressiveVirtualizerEverLoaded.current
|
|
25
|
-
? false
|
|
26
|
-
: !view.state?.groups?.length && isEmpty(view.resultsCount);
|
|
27
|
-
if (!infiniteModeTable && !isProgressiveVirtualizerEverLoaded.current) {
|
|
28
|
-
isProgressiveVirtualizerEverLoaded.current = true;
|
|
29
|
-
}
|
|
30
23
|
const paginationCallback = useCallback((payload, payloadMeta) => {
|
|
31
24
|
paginationPayload.current = payload;
|
|
32
25
|
setIsFetching(true);
|
|
33
|
-
|
|
26
|
+
const updatedPayload = meta.template === REPEATING_STRUCTURE_TEMPLATES.GALLERY
|
|
27
|
+
? { ...payload, startIndex: 0 }
|
|
28
|
+
: payload;
|
|
29
|
+
view.type.onPaginate(updatedPayload, payloadMeta);
|
|
34
30
|
}, [view.type.onPaginate]);
|
|
35
31
|
const renderEmptyRecords = useCallback(() => (_jsx(EmptyContainer, { message: isFilterApplied({ filterExpression, searchText, externalState }, meta.externalFilters)
|
|
36
32
|
? translate('No records found')
|
|
@@ -55,16 +51,17 @@ useVariableRowHeightVirtualization = false, bufferMultiplier }) {
|
|
|
55
51
|
view.setScrollNode(r?.getBufferContainer());
|
|
56
52
|
}, viewMaxHeight: isFullscreen ? null : view.bodyHeight, minHeightWhenNoItemsRendered: '100px', children: view?.groupHeaders?.[0]?.getRows()?.map((row, index) => (_jsx(Row, { row: row, columns: view.columns, level: 0, dataIndex: paginationStartIndex + index }, row.reactKey))) }));
|
|
57
53
|
}
|
|
58
|
-
if (
|
|
54
|
+
if (meta.template === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {
|
|
59
55
|
return (_jsx(VirtualizeInfinite, { id: id, viewMaxHeight: isFullscreen ? null : view.bodyHeight, itemHeight: view.rowHeight, callback: paginationCallback, isFetching: isFetching, hasMoreResults: hasMoreResults, renderHeader: renderHeader, renderFooter: renderFooter, ref: r => {
|
|
60
56
|
view.putVirtualizeElement(id, r);
|
|
61
57
|
view.setScrollNode(r && r.vi && r.vi.bContainer);
|
|
62
|
-
}, rowContainerClass: `${rowContainerClass} ${view.rowHeightClass}`, state: view.state?.paginationOptions?.[id], resetCount: view.isCountUpdateRequired, showLoadingIndicator:
|
|
58
|
+
}, rowContainerClass: `${rowContainerClass} ${view.rowHeightClass}`, state: view.state?.paginationOptions?.[id], resetCount: view.isCountUpdateRequired, showLoadingIndicator: true, renderEmptyRecords: renderEmptyRecords, bufferMultiplier: bufferMultiplier, children: children }));
|
|
63
59
|
}
|
|
60
|
+
// Only used for grouped table
|
|
64
61
|
return (_jsx(Virtualize, { id: id, viewMaxHeight: isFullscreen ? null : view.bodyHeight, totalRecordCount: view.totalItemCount, itemHeight: view.rowHeight, callback: paginationCallback, isFetching: isFetching, renderHeader: renderHeader, renderFooter: renderFooter, ref: r => {
|
|
65
62
|
view.putVirtualizeElement(id, r);
|
|
66
63
|
view.setScrollNode(r && r.vi && r.vi.bContainer);
|
|
67
|
-
}, rowContainerClass: `${rowContainerClass} ${view.rowHeightClass}`, state: view.state?.paginationOptions?.[id], showLoadingIndicator:
|
|
64
|
+
}, rowContainerClass: `${rowContainerClass} ${view.rowHeightClass}`, state: view.state?.paginationOptions?.[id], showLoadingIndicator: true, renderEmptyRecords: renderEmptyRecords, bufferMultiplier: bufferMultiplier, children: children }));
|
|
68
65
|
}
|
|
69
66
|
VirtualizeWrapper.propTypes = {
|
|
70
67
|
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizeWrapper.js","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAExF,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,kBAAkB,MAAM,gDAAgD,CAAC;AAChF,OAAO,yBAAyB,MAAM,iFAAiF,CAAC;AACxH,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,YAAY,GAAG,IAAI,EACnB,iBAAiB,GAAG,EAAE,EACtB,YAAY,GAAG,IAAI,EACnB,YAAY,GAAG,KAAK;AACpB,sJAAsJ;AACtJ,kCAAkC,GAAG,KAAK,EAC1C,gBAAgB,EACjB;IACC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAC9D,MAAM,CAAC,SAAS,CAAC,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,kCAAkC,GAAG,MAAM,CAA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IAAI,CAAC,QAAQ,KAAK,6BAA6B,CAAC,KAAK,EAChF,kBAAkB,EAAE,kBAAkB,EACtC,gBAAgB,EAAE,gBAAgB,YAEjC,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAED,iBAAiB,CAAC,SAAS,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU;IAC7E,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;IACxE,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,iBAAiB,EAAE,SAAS,CAAC,MAAM;IACnC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;IAClD,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,kCAAkC,EAAE,SAAS,CAAC,IAAI;IAClD,gBAAgB,EAAE,SAAS,CAAC,MAAM;CACnC,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { isEmpty, REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport Virtualize from '../../Components/Virtualise';\nimport VirtualizeInfinite from '../../Components/Virtualise/VirtualizeInfinite';\nimport VariableHeightVirtualizer from '../../Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer';\nimport { isPaginationRequestCompleted } from '../../Components/Virtualise/utility';\nimport { isFilterApplied } from '../../Utils';\nimport EmptyContainer from '../../Components/DefaultComponents/EmptyContainer';\nimport useTranslate from '../../Hooks/useTranslate';\n\nimport Row from './Row';\nimport useCountChange from './useCountChange';\n\nexport default function VirtualizeWrapper({\n view,\n children,\n id,\n renderHeader = null,\n rowContainerClass = '',\n renderFooter = null,\n isFullscreen = false,\n // TODO: Remove this prop and deprecate older virtualizers once we fully migrate to variable row height virtualizer for gallery and grouped list views\n useVariableRowHeightVirtualization = false,\n bufferMultiplier\n}) {\n const { state, meta } = view;\n const { filterExpression, searchText, externalState } = state;\n const [translate] = useTranslate();\n const isProgressiveVirtualizerEverLoaded = useRef(false);\n const paginationPayload = useRef({});\n\n const [isFetching, setIsFetching] = useState(false);\n const [hasMoreResults, setHasMoreResults] = useState(false);\n\n const infiniteModeTable = isProgressiveVirtualizerEverLoaded.current\n ? false\n : !view.state?.groups?.length && isEmpty(view.resultsCount);\n\n if (!infiniteModeTable && !isProgressiveVirtualizerEverLoaded.current) {\n isProgressiveVirtualizerEverLoaded.current = true;\n }\n\n const paginationCallback = useCallback(\n (payload, payloadMeta) => {\n paginationPayload.current = payload;\n setIsFetching(true);\n view.type.onPaginate(payload, payloadMeta);\n },\n [view.type.onPaginate]\n );\n\n const renderEmptyRecords = useCallback(\n () => (\n <EmptyContainer\n message={\n isFilterApplied({ filterExpression, searchText, externalState }, meta.externalFilters)\n ? translate('No records found')\n : translate('No records')\n }\n />\n ),\n [filterExpression, searchText, externalState, meta.externalFilters]\n );\n\n useEffect(() => {\n if (view.isInstantRender) return;\n\n const isRequestComplete = isPaginationRequestCompleted(\n paginationPayload.current,\n view.state?.paginationOptions?.[id]\n );\n setIsFetching(!isRequestComplete);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useEffect(() => {\n if (view.isInstantRender || !paginationPayload.current) return;\n\n const requestedRows =\n paginationPayload.current.endIndex - paginationPayload.current.startIndex + 1;\n setHasMoreResults(view.rows?.length === requestedRows);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useCountChange(view, isFetching, view.getVirtualizeElement?.(id)?.notifyCountChange);\n\n if (useVariableRowHeightVirtualization) {\n const paginationStartIndex = view?.state?.paginationOptions?.rootVirtualiser?.startIndex || 0;\n return (\n <VariableHeightVirtualizer\n id={id}\n totalItemCount={view.totalItemCount}\n isDataFetching={isFetching}\n loadedDataRange={view?.state?.paginationOptions?.[id] || {}}\n apiCallback={paginationCallback}\n defaultItemHeight={40}\n maxItemsToPaint={5000}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n renderEmptyRecords={renderEmptyRecords}\n itemContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r?.getBufferContainer());\n }}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n minHeightWhenNoItemsRendered='100px'\n >\n {view?.groupHeaders?.[0]?.getRows()?.map((row, index) => (\n <Row\n key={row.reactKey}\n row={row}\n columns={view.columns}\n level={0}\n dataIndex={paginationStartIndex + index}\n />\n ))}\n </VariableHeightVirtualizer>\n );\n }\n\n if (infiniteModeTable) {\n return (\n <VirtualizeInfinite\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n hasMoreResults={hasMoreResults}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n resetCount={view.isCountUpdateRequired}\n showLoadingIndicator={view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TABLE}\n renderEmptyRecords={renderEmptyRecords}\n bufferMultiplier={bufferMultiplier}\n >\n {children}\n </VirtualizeInfinite>\n );\n }\n\n return (\n <Virtualize\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n totalRecordCount={view.totalItemCount}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n showLoadingIndicator={view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TABLE}\n renderEmptyRecords={renderEmptyRecords}\n bufferMultiplier={bufferMultiplier}\n >\n {children}\n </Virtualize>\n );\n}\n\nVirtualizeWrapper.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n rowContainerClass: PropTypes.string,\n view: PropTypes.objectOf(PropTypes.any).isRequired,\n isFullscreen: PropTypes.bool,\n useVariableRowHeightVirtualization: PropTypes.bool,\n bufferMultiplier: PropTypes.number\n};\n"]}
|
|
1
|
+
{"version":3,"file":"VirtualizeWrapper.js","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,kBAAkB,MAAM,gDAAgD,CAAC;AAChF,OAAO,yBAAyB,MAAM,iFAAiF,CAAC;AACxH,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,YAAY,GAAG,IAAI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AE,GAAG,iBAAiB,IAAI,IAAI,CAAC,cAAc,EAAE,EAChE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC,EAC1C,oBAAoB,QACpB,kBAAkB,EAAE,kBAAkB,EACtC,gBAAgB,EAAE,gBAAgB,YAEjC,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAED,iBAAiB,CAAC,SAAS,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU;IAC7E,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;IACxE,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,iBAAiB,EAAE,SAAS,CAAC,MAAM;IACnC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;IAClD,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,kCAAkC,EAAE,SAAS,CAAC,IAAI;IAClD,gBAAgB,EAAE,SAAS,CAAC,MAAM;CACnC,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport Virtualize from '../../Components/Virtualise';\nimport VirtualizeInfinite from '../../Components/Virtualise/VirtualizeInfinite';\nimport VariableHeightVirtualizer from '../../Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer';\nimport { isPaginationRequestCompleted } from '../../Components/Virtualise/utility';\nimport { isFilterApplied } from '../../Utils';\nimport EmptyContainer from '../../Components/DefaultComponents/EmptyContainer';\nimport useTranslate from '../../Hooks/useTranslate';\n\nimport Row from './Row';\nimport useCountChange from './useCountChange';\n\nexport default function VirtualizeWrapper({\n view,\n children,\n id,\n renderHeader = null,\n rowContainerClass = '',\n renderFooter = null,\n isFullscreen = false,\n // TODO: Remove this prop and deprecate older virtualizers once we fully migrate to variable row height virtualizer for gallery and grouped list views\n useVariableRowHeightVirtualization = false,\n bufferMultiplier\n}) {\n const { state, meta } = view;\n const { filterExpression, searchText, externalState } = state;\n const [translate] = useTranslate();\n const paginationPayload = useRef({});\n\n const [isFetching, setIsFetching] = useState(false);\n const [hasMoreResults, setHasMoreResults] = useState(false);\n\n const paginationCallback = useCallback(\n (payload, payloadMeta) => {\n paginationPayload.current = payload;\n setIsFetching(true);\n\n const updatedPayload =\n meta.template === REPEATING_STRUCTURE_TEMPLATES.GALLERY\n ? { ...payload, startIndex: 0 }\n : payload;\n\n view.type.onPaginate(updatedPayload, payloadMeta);\n },\n [view.type.onPaginate]\n );\n\n const renderEmptyRecords = useCallback(\n () => (\n <EmptyContainer\n message={\n isFilterApplied({ filterExpression, searchText, externalState }, meta.externalFilters)\n ? translate('No records found')\n : translate('No records')\n }\n />\n ),\n [filterExpression, searchText, externalState, meta.externalFilters]\n );\n\n useEffect(() => {\n if (view.isInstantRender) return;\n\n const isRequestComplete = isPaginationRequestCompleted(\n paginationPayload.current,\n view.state?.paginationOptions?.[id]\n );\n setIsFetching(!isRequestComplete);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useEffect(() => {\n if (view.isInstantRender || !paginationPayload.current) return;\n\n const requestedRows =\n paginationPayload.current.endIndex - paginationPayload.current.startIndex + 1;\n setHasMoreResults(view.rows?.length === requestedRows);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useCountChange(view, isFetching, view.getVirtualizeElement?.(id)?.notifyCountChange);\n\n if (useVariableRowHeightVirtualization) {\n const paginationStartIndex = view?.state?.paginationOptions?.rootVirtualiser?.startIndex || 0;\n return (\n <VariableHeightVirtualizer\n id={id}\n totalItemCount={view.totalItemCount}\n isDataFetching={isFetching}\n loadedDataRange={view?.state?.paginationOptions?.[id] || {}}\n apiCallback={paginationCallback}\n defaultItemHeight={40}\n maxItemsToPaint={5000}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n renderEmptyRecords={renderEmptyRecords}\n itemContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r?.getBufferContainer());\n }}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n minHeightWhenNoItemsRendered='100px'\n >\n {view?.groupHeaders?.[0]?.getRows()?.map((row, index) => (\n <Row\n key={row.reactKey}\n row={row}\n columns={view.columns}\n level={0}\n dataIndex={paginationStartIndex + index}\n />\n ))}\n </VariableHeightVirtualizer>\n );\n }\n\n if (meta.template === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {\n return (\n <VirtualizeInfinite\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n hasMoreResults={hasMoreResults}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n resetCount={view.isCountUpdateRequired}\n showLoadingIndicator\n renderEmptyRecords={renderEmptyRecords}\n bufferMultiplier={bufferMultiplier}\n >\n {children}\n </VirtualizeInfinite>\n );\n }\n\n // Only used for grouped table\n return (\n <Virtualize\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n totalRecordCount={view.totalItemCount}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n showLoadingIndicator\n renderEmptyRecords={renderEmptyRecords}\n bufferMultiplier={bufferMultiplier}\n >\n {children}\n </Virtualize>\n );\n}\n\nVirtualizeWrapper.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n rowContainerClass: PropTypes.string,\n view: PropTypes.objectOf(PropTypes.any).isRequired,\n isFullscreen: PropTypes.bool,\n useVariableRowHeightVirtualization: PropTypes.bool,\n bufferMultiplier: PropTypes.number\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-react",
|
|
3
|
-
"version": "9.0.0-build.19.
|
|
3
|
+
"version": "9.0.0-build.19.2",
|
|
4
4
|
"description": "Repeating view structures such as Table, Gallery(Repeating layouts), Kanban etc.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "9.0.0-build.19.
|
|
18
|
-
"@pega/cosmos-react-core": "9.0.0-build.19.
|
|
19
|
-
"@pega/cosmos-react-rte": "9.0.0-build.19.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "9.0.0-build.19.2",
|
|
18
|
+
"@pega/cosmos-react-core": "9.0.0-build.19.2",
|
|
19
|
+
"@pega/cosmos-react-rte": "9.0.0-build.19.2",
|
|
20
20
|
"@types/lodash-es": "^4.17.12",
|
|
21
21
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
22
22
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dayjs": "^1.11.13",
|
|
25
25
|
"fast-deep-equal": "^3.1.3",
|
|
26
26
|
"lodash-es": "^4.17.23",
|
|
27
|
-
"pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.19.
|
|
28
|
-
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.19.
|
|
27
|
+
"pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.19.2",
|
|
28
|
+
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.19.2",
|
|
29
29
|
"polished": "^4.1.0",
|
|
30
30
|
"prop-types": "^15.8.1",
|
|
31
31
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@testing-library/react": "^16.0.0",
|
|
45
45
|
"@testing-library/user-event": "^14.6.1",
|
|
46
46
|
"jest-axe": "^8.0.0",
|
|
47
|
-
"srs-utils": "9.0.0-build.19.
|
|
47
|
+
"srs-utils": "9.0.0-build.19.2",
|
|
48
48
|
"typescript": "~5.9.3"
|
|
49
49
|
}
|
|
50
50
|
}
|