@pega/lists-react 10.0.0-build.4.2 → 10.0.0-build.4.20
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/README.md +284 -83
- package/lib/Core/Components/Card/CardFieldValue.d.ts +8 -0
- package/lib/Core/Components/Card/CardFieldValue.d.ts.map +1 -0
- package/lib/Core/Components/Card/CardFieldValue.js +8 -0
- package/lib/Core/Components/Card/CardFieldValue.js.map +1 -0
- package/lib/Core/Components/Card/CardHeader.d.ts +9 -0
- package/lib/Core/Components/Card/CardHeader.d.ts.map +1 -0
- package/lib/Core/{Views/Gallery/Components/GalleryHeader.js → Components/Card/CardHeader.js} +5 -4
- package/lib/Core/Components/Card/CardHeader.js.map +1 -0
- package/lib/Core/Components/Card/CardSubHeading.d.ts +10 -0
- package/lib/Core/Components/Card/CardSubHeading.d.ts.map +1 -0
- package/lib/Core/Components/Card/CardSubHeading.js +9 -0
- package/lib/Core/Components/Card/CardSubHeading.js.map +1 -0
- package/lib/Core/Components/Card/cardData.d.ts +48 -0
- package/lib/Core/Components/Card/cardData.d.ts.map +1 -0
- package/lib/Core/{Views/Gallery/utils.js → Components/Card/cardData.js} +55 -52
- package/lib/Core/Components/Card/cardData.js.map +1 -0
- package/lib/Core/Components/Card/hooks/useRowActions.d.ts.map +1 -0
- package/lib/Core/Components/Card/hooks/useRowActions.js.map +1 -0
- package/lib/Core/Components/Card/index.d.ts +5 -0
- package/lib/Core/Components/Card/index.d.ts.map +1 -0
- package/lib/Core/Components/Card/index.js +5 -0
- package/lib/Core/Components/Card/index.js.map +1 -0
- package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts +2 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.js +3 -3
- package/lib/Core/Components/DefaultComponents/EmptyContainer.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.js +2 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/index.d.ts +2 -1
- package/lib/Core/Components/DefaultComponents/index.d.ts.map +1 -1
- package/lib/Core/Components/GroupRenderer/index.d.ts.map +1 -1
- package/lib/Core/Components/GroupRenderer/index.js +7 -2
- package/lib/Core/Components/GroupRenderer/index.js.map +1 -1
- package/lib/Core/Components/RSWrapper/index.d.ts.map +1 -1
- package/lib/Core/Components/RSWrapper/index.js +4 -0
- package/lib/Core/Components/RSWrapper/index.js.map +1 -1
- package/lib/Core/Components/Toolbar/AdvanceToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js +5 -2
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/RefreshBanner.d.ts +5 -1
- package/lib/Core/Components/Toolbar/RefreshBanner.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/RefreshBanner.js +22 -6
- package/lib/Core/Components/Toolbar/RefreshBanner.js.map +1 -1
- package/lib/Core/Components/Toolbar/SimpleToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/SimpleToolbar.js +2 -2
- package/lib/Core/Components/Toolbar/SimpleToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/utils/utils.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/utils/utils.js +10 -4
- package/lib/Core/Components/Toolbar/utils/utils.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 -7
- package/lib/Core/Views/Gallery/Components/GalleryCard.js.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js +3 -3
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js.map +1 -1
- package/lib/Core/Views/Gallery/Gallery.types.d.ts +1 -0
- 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/GalleryContainer.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/GalleryContainer.js +1 -1
- package/lib/Core/Views/Gallery/GalleryContainer.js.map +1 -1
- package/lib/Core/Views/Gallery/index.d.ts +1 -1
- package/lib/Core/Views/Gallery/index.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/index.js +6 -9
- package/lib/Core/Views/Gallery/index.js.map +1 -1
- package/lib/Core/Views/Kanban/Kanban.styles.d.ts +13 -0
- package/lib/Core/Views/Kanban/Kanban.styles.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/Kanban.styles.js +53 -0
- package/lib/Core/Views/Kanban/Kanban.styles.js.map +1 -0
- package/lib/Core/Views/Kanban/Kanban.types.d.ts +10 -0
- package/lib/Core/Views/Kanban/Kanban.types.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/Kanban.types.js +2 -0
- package/lib/Core/Views/Kanban/Kanban.types.js.map +1 -0
- package/lib/Core/Views/Kanban/KanbanCard.d.ts +7 -0
- package/lib/Core/Views/Kanban/KanbanCard.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/KanbanCard.js +20 -0
- package/lib/Core/Views/Kanban/KanbanCard.js.map +1 -0
- package/lib/Core/Views/Kanban/KanbanLane.d.ts +23 -0
- package/lib/Core/Views/Kanban/KanbanLane.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/KanbanLane.js +21 -0
- package/lib/Core/Views/Kanban/KanbanLane.js.map +1 -0
- package/lib/Core/Views/Kanban/KanbanLaneHeader.d.ts +12 -0
- package/lib/Core/Views/Kanban/KanbanLaneHeader.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/KanbanLaneHeader.js +16 -0
- package/lib/Core/Views/Kanban/KanbanLaneHeader.js.map +1 -0
- package/lib/Core/Views/Kanban/KanbanLaneVirtualizer.d.ts +20 -0
- package/lib/Core/Views/Kanban/KanbanLaneVirtualizer.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/KanbanLaneVirtualizer.js +37 -0
- package/lib/Core/Views/Kanban/KanbanLaneVirtualizer.js.map +1 -0
- package/lib/Core/Views/Kanban/hooks/useKanbanLanesVirtualization.d.ts +19 -0
- package/lib/Core/Views/Kanban/hooks/useKanbanLanesVirtualization.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/hooks/useKanbanLanesVirtualization.js +32 -0
- package/lib/Core/Views/Kanban/hooks/useKanbanLanesVirtualization.js.map +1 -0
- package/lib/Core/Views/Kanban/index.d.ts +9 -0
- package/lib/Core/Views/Kanban/index.d.ts.map +1 -0
- package/lib/Core/Views/Kanban/index.js +63 -0
- package/lib/Core/Views/Kanban/index.js.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.styles.d.ts +2 -2
- package/lib/Core/templateFeatureSupport.js +2 -2
- package/lib/Core/templateFeatureSupport.js.map +1 -1
- package/package.json +7 -7
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.d.ts +0 -8
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.d.ts.map +0 -1
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.js +0 -8
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.js.map +0 -1
- package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts +0 -8
- package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts.map +0 -1
- package/lib/Core/Views/Gallery/Components/GalleryHeader.js.map +0 -1
- package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts.map +0 -1
- package/lib/Core/Views/Gallery/hooks/useRowActions.js.map +0 -1
- package/lib/Core/Views/Gallery/utils.d.ts +0 -36
- package/lib/Core/Views/Gallery/utils.d.ts.map +0 -1
- package/lib/Core/Views/Gallery/utils.js.map +0 -1
- /package/lib/Core/{Views/Gallery → Components/Card}/hooks/useRowActions.d.ts +0 -0
- /package/lib/Core/{Views/Gallery → Components/Card}/hooks/useRowActions.js +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useItemIntersection } from '@pega/cosmos-react-core';
|
|
3
|
+
// Lanes mounted when a board or lane grouping is first displayed.
|
|
4
|
+
const INITIAL_LANE_COUNT = 3;
|
|
5
|
+
// Additional right-side lanes mounted when the current final lane enters the scrollport.
|
|
6
|
+
const APPEND_LANE_COUNT = 2;
|
|
7
|
+
// Minimum lanes to display so the intersection observer can always fire to trigger further loading.
|
|
8
|
+
const MINIMUM_OBSERVED_LANE_COUNT = 2;
|
|
9
|
+
/**
|
|
10
|
+
* Progressively mounts right-side Kanban lanes while retaining already mounted lanes and their
|
|
11
|
+
* vertical scroll positions. Resets the lane window for a new grouping or refreshed lane catalog.
|
|
12
|
+
*
|
|
13
|
+
* @param groupKey - Active lane grouping identifier.
|
|
14
|
+
* @param lanes - Lanes available for the active grouping.
|
|
15
|
+
*/
|
|
16
|
+
export default function useKanbanLanesVirtualization({ groupKey, lanes }) {
|
|
17
|
+
const boardRef = useRef(null);
|
|
18
|
+
const totalLaneCount = lanes.length;
|
|
19
|
+
const [mountedLaneCount, setMountedLaneCount] = useState(INITIAL_LANE_COUNT);
|
|
20
|
+
const clampLaneCount = useCallback((count) => Math.max(Math.min(count, totalLaneCount), Math.min(MINIMUM_OBSERVED_LANE_COUNT, totalLaneCount)), [totalLaneCount]);
|
|
21
|
+
// A new grouping or lane catalog starts with the initial lane window.
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setMountedLaneCount(INITIAL_LANE_COUNT);
|
|
24
|
+
}, [groupKey, totalLaneCount]);
|
|
25
|
+
const appendLanes = useCallback(() => {
|
|
26
|
+
// Keep prior lanes mounted so their independent vertical scroll positions are retained.
|
|
27
|
+
setMountedLaneCount(prev => clampLaneCount(prev + APPEND_LANE_COUNT));
|
|
28
|
+
}, [clampLaneCount]);
|
|
29
|
+
useItemIntersection(boardRef, mountedLaneCount - 1, appendLanes, ':scope > [data-kanban-lane]');
|
|
30
|
+
return { boardRef, visibleLanes: lanes.slice(0, mountedLaneCount) };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=useKanbanLanesVirtualization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKanbanLanesVirtualization.js","sourceRoot":"","sources":["../../../../../Core/Views/Kanban/hooks/useKanbanLanesVirtualization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,kEAAkE;AAClE,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,yFAAyF;AACzF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,oGAAoG;AACpG,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAYtC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,EACnD,QAAQ,EACR,KAAK,EAC+B;IACpC,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE9C,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC;IACpC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAE7E,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAAa,EAAU,EAAE,CACxB,IAAI,CAAC,GAAG,CACN,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,EAC/B,IAAI,CAAC,GAAG,CAAC,2BAA2B,EAAE,cAAc,CAAC,CACtD,EACH,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,sEAAsE;IACtE,SAAS,CAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;IAE/B,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,wFAAwF;QACxF,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,GAAG,iBAAiB,CAAC,CAAC,CAAC;IACxE,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,CAAC,EAAE,WAAW,EAAE,6BAA6B,CAAC,CAAC;IAEhG,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useItemIntersection } from '@pega/cosmos-react-core';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\n// Lanes mounted when a board or lane grouping is first displayed.\nconst INITIAL_LANE_COUNT = 3;\n// Additional right-side lanes mounted when the current final lane enters the scrollport.\nconst APPEND_LANE_COUNT = 2;\n// Minimum lanes to display so the intersection observer can always fire to trigger further loading.\nconst MINIMUM_OBSERVED_LANE_COUNT = 2;\n\ninterface UseKanbanLanesVirtualizationOptions {\n groupKey?: string;\n lanes: RsCoreTypes.GroupGenerator[];\n}\n\ninterface KanbanLanesVirtualization {\n boardRef: React.RefObject<HTMLDivElement>;\n visibleLanes: RsCoreTypes.GroupGenerator[];\n}\n\n/**\n * Progressively mounts right-side Kanban lanes while retaining already mounted lanes and their\n * vertical scroll positions. Resets the lane window for a new grouping or refreshed lane catalog.\n *\n * @param groupKey - Active lane grouping identifier.\n * @param lanes - Lanes available for the active grouping.\n */\nexport default function useKanbanLanesVirtualization({\n groupKey,\n lanes\n}: UseKanbanLanesVirtualizationOptions): KanbanLanesVirtualization {\n const boardRef = useRef<HTMLDivElement>(null);\n\n const totalLaneCount = lanes.length;\n const [mountedLaneCount, setMountedLaneCount] = useState(INITIAL_LANE_COUNT);\n\n const clampLaneCount = useCallback(\n (count: number): number =>\n Math.max(\n Math.min(count, totalLaneCount),\n Math.min(MINIMUM_OBSERVED_LANE_COUNT, totalLaneCount)\n ),\n [totalLaneCount]\n );\n\n // A new grouping or lane catalog starts with the initial lane window.\n useEffect(() => {\n setMountedLaneCount(INITIAL_LANE_COUNT);\n }, [groupKey, totalLaneCount]);\n\n const appendLanes = useCallback(() => {\n // Keep prior lanes mounted so their independent vertical scroll positions are retained.\n setMountedLaneCount(prev => clampLaneCount(prev + APPEND_LANE_COUNT));\n }, [clampLaneCount]);\n\n useItemIntersection(boardRef, mountedLaneCount - 1, appendLanes, ':scope > [data-kanban-lane]');\n\n return { boardRef, visibleLanes: lanes.slice(0, mountedLaneCount) };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
+
declare function Kanban({ view }: {
|
|
3
|
+
view: RsCoreTypes.View;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare namespace Kanban {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
export default Kanban;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Kanban/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAwB/E,iBAAS,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAA;CAAE,2CA8FnD;kBA9FQ,MAAM;;;AAkGf,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { usePrevious, useFullscreenContext, useTheme, Grid, isInstance } from '@pega/cosmos-react-core';
|
|
4
|
+
import { getGroupKey } from 'pega-repeating-structures-core';
|
|
5
|
+
import Toolbar from '../../Components/Toolbar';
|
|
6
|
+
import RenderView from '../../Components/RenderingEngine/RenderView';
|
|
7
|
+
import { EXTERNAL_FILTERS } from '../../constants';
|
|
8
|
+
import EmptyContainer from '../../Components/DefaultComponents/EmptyContainer';
|
|
9
|
+
import RsCardWrapper from '../RsCardWrapper';
|
|
10
|
+
import LoadingIndicator from '../../Components/LoadingIndicator';
|
|
11
|
+
import WarningBanner from '../../Components/WarningBanner';
|
|
12
|
+
import useTranslate from '../../Hooks/useTranslate';
|
|
13
|
+
import { isFilterApplied } from '../../Utils';
|
|
14
|
+
import { getCardColumns } from '../../Components/Card';
|
|
15
|
+
import KanbanLane, { EmptyKanbanLane } from './KanbanLane';
|
|
16
|
+
import { StyledKanbanBoard, StyledKanbanContainer } from './Kanban.styles';
|
|
17
|
+
import useKanbanLanesVirtualization from './hooks/useKanbanLanesVirtualization';
|
|
18
|
+
function getLaneId(laneColumn, value) {
|
|
19
|
+
return `${laneColumn?.field.id ?? ''}:${isInstance(value, Date) ? value.toISOString() : String(value)}`;
|
|
20
|
+
}
|
|
21
|
+
function Kanban({ view }) {
|
|
22
|
+
const { columns = [], groupHeaders = [], meta, rows } = view;
|
|
23
|
+
const { filterExpression, searchText, externalState, groups } = view.state ?? {};
|
|
24
|
+
const isFullscreen = !!useFullscreenContext()?.[0];
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
const [translate] = useTranslate();
|
|
27
|
+
// Lane configuration
|
|
28
|
+
const firstGroupHeader = groupHeaders[0];
|
|
29
|
+
const laneGroup = groups?.[0];
|
|
30
|
+
const laneColumn = useMemo(() => columns.find(column => String(column.field.id) === String(laneGroup?.columnId)), [columns, laneGroup]);
|
|
31
|
+
const hasLaneConfiguration = !!(laneColumn && laneGroup);
|
|
32
|
+
// RsCore returns empty groupHeader with groupBy = '' and count = 0 when there are no records to display.
|
|
33
|
+
const isEmptyLane = groupHeaders.length === 1 && firstGroupHeader?.groupBy === '' && firstGroupHeader.count === 0;
|
|
34
|
+
const shouldRenderEmptyLane = !!laneGroup && isEmptyLane;
|
|
35
|
+
// With instantRender from RSCore, state can contain the new groupBy while groupHeaders still reflect the previous grouping.
|
|
36
|
+
const laneGroupKey = laneGroup ? getGroupKey(laneGroup) : undefined;
|
|
37
|
+
const hasStaleLanes = !!firstGroupHeader?.groupBy && firstGroupHeader.groupBy !== laneGroupKey;
|
|
38
|
+
const lanes = hasLaneConfiguration && !hasStaleLanes ? groupHeaders : [];
|
|
39
|
+
const laneSourceKey = laneGroup ? `${laneGroupKey}:${laneGroup.order}` : undefined;
|
|
40
|
+
// Lanes virtualization
|
|
41
|
+
const { boardRef, visibleLanes } = useKanbanLanesVirtualization({
|
|
42
|
+
groupKey: laneSourceKey,
|
|
43
|
+
lanes
|
|
44
|
+
});
|
|
45
|
+
// Empty state configuration
|
|
46
|
+
const previousTotalItemCount = usePrevious(view.totalItemCount);
|
|
47
|
+
const emptyMessage = isFilterApplied({ filterExpression, searchText, externalState }, meta.externalFilters)
|
|
48
|
+
? translate('No records found')
|
|
49
|
+
: translate('No records');
|
|
50
|
+
const shouldAnnounceEmpty = (previousTotalItemCount ?? 0) > 0 && view.totalItemCount === 0;
|
|
51
|
+
const emptyState = (_jsx(EmptyContainer, { message: emptyMessage, shouldAnnounce: shouldAnnounceEmpty, domContainer: view.getDomContainer(), transparent: true }));
|
|
52
|
+
const { visibleColumns, headerColumn, subHeadingsColumns } = useMemo(() => getCardColumns(columns, meta.cardConfig ?? {}), [columns, meta.cardConfig]);
|
|
53
|
+
return (_jsx(RsCardWrapper, { children: _jsxs(StyledKanbanContainer, { "data-testid": 'kanban', view: view, isFullscreen: isFullscreen, children: [_jsx(WarningBanner, { warningMessages: view.warningMessages }), _jsx(Toolbar, { view: view }), _jsx(RenderView, { view: view, type: EXTERNAL_FILTERS }), _jsxs(Grid, { as: StyledKanbanBoard, ref: boardRef, role: 'list', "aria-label": meta.title ?? meta.name, container: {
|
|
54
|
+
autoFlow: 'column',
|
|
55
|
+
autoCols: `minmax(min(${theme.base['content-width'].sm}, 100%), 1fr)`,
|
|
56
|
+
gap: 1.5,
|
|
57
|
+
pad: 0.5
|
|
58
|
+
}, children: [!shouldRenderEmptyLane &&
|
|
59
|
+
visibleLanes.map(lane => (_jsx(KanbanLane, { laneId: getLaneId(laneColumn, lane.name), lane: lane, laneColumn: laneColumn, meta: meta, visibleColumns: visibleColumns, headerColumn: headerColumn, subHeadingsColumns: subHeadingsColumns, emptyState: emptyState }, getLaneId(laneColumn, lane.name)))), shouldRenderEmptyLane && _jsx(EmptyKanbanLane, { emptyState: emptyState }), _jsx(LoadingIndicator, { view: view, show: !rows || !!view.isLoading })] })] }) }));
|
|
60
|
+
}
|
|
61
|
+
Kanban.displayName = 'Kanban';
|
|
62
|
+
export default Kanban;
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Views/Kanban/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,IAAI,EACJ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAoB,MAAM,gCAAgC,CAAC;AAE/E,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,UAAU,MAAM,6CAA6C,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,mCAA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G;qBACT,aAEA,CAAC,qBAAqB;4BACrB,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACvB,KAAC,UAAU,IAET,MAAM,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,EACxC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,UAAU,IARjB,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CASrC,CACH,CAAC,EACH,qBAAqB,IAAI,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,GAAI,EACrE,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,GAAI,IAC5D,IACe,GACV,CACjB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,eAAe,MAAM,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport {\n usePrevious,\n useFullscreenContext,\n useTheme,\n Grid,\n isInstance\n} from '@pega/cosmos-react-core';\nimport { getGroupKey, type RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport Toolbar from '../../Components/Toolbar';\nimport RenderView from '../../Components/RenderingEngine/RenderView';\nimport { EXTERNAL_FILTERS } from '../../constants';\nimport EmptyContainer from '../../Components/DefaultComponents/EmptyContainer';\nimport RsCardWrapper from '../RsCardWrapper';\nimport LoadingIndicator from '../../Components/LoadingIndicator';\nimport WarningBanner from '../../Components/WarningBanner';\nimport useTranslate from '../../Hooks/useTranslate';\nimport { isFilterApplied } from '../../Utils';\nimport { getCardColumns } from '../../Components/Card';\n\nimport KanbanLane, { EmptyKanbanLane } from './KanbanLane';\nimport { StyledKanbanBoard, StyledKanbanContainer } from './Kanban.styles';\nimport useKanbanLanesVirtualization from './hooks/useKanbanLanesVirtualization';\n\nfunction getLaneId(\n laneColumn: RsCoreTypes.Column | undefined,\n value: RsCoreTypes.GroupGenerator['name']\n): string {\n return `${laneColumn?.field.id ?? ''}:${isInstance(value, Date) ? value.toISOString() : String(value)}`;\n}\n\nfunction Kanban({ view }: { view: RsCoreTypes.View }) {\n const { columns = [], groupHeaders = [], meta, rows } = view;\n const { filterExpression, searchText, externalState, groups } = view.state ?? {};\n const isFullscreen = !!useFullscreenContext()?.[0];\n const theme = useTheme();\n const [translate] = useTranslate();\n\n // Lane configuration\n const firstGroupHeader = groupHeaders[0];\n const laneGroup = groups?.[0];\n const laneColumn = useMemo(\n () => columns.find(column => String(column.field.id) === String(laneGroup?.columnId)),\n [columns, laneGroup]\n );\n const hasLaneConfiguration = !!(laneColumn && laneGroup);\n\n // RsCore returns empty groupHeader with groupBy = '' and count = 0 when there are no records to display.\n const isEmptyLane =\n groupHeaders.length === 1 && firstGroupHeader?.groupBy === '' && firstGroupHeader.count === 0;\n const shouldRenderEmptyLane = !!laneGroup && isEmptyLane;\n\n // With instantRender from RSCore, state can contain the new groupBy while groupHeaders still reflect the previous grouping.\n const laneGroupKey = laneGroup ? getGroupKey(laneGroup) : undefined;\n const hasStaleLanes = !!firstGroupHeader?.groupBy && firstGroupHeader.groupBy !== laneGroupKey;\n const lanes = hasLaneConfiguration && !hasStaleLanes ? groupHeaders : [];\n const laneSourceKey = laneGroup ? `${laneGroupKey}:${laneGroup.order}` : undefined;\n\n // Lanes virtualization\n const { boardRef, visibleLanes } = useKanbanLanesVirtualization({\n groupKey: laneSourceKey,\n lanes\n });\n\n // Empty state configuration\n const previousTotalItemCount = usePrevious(view.totalItemCount);\n const emptyMessage = isFilterApplied(\n { filterExpression, searchText, externalState },\n meta.externalFilters\n )\n ? translate('No records found')\n : translate('No records');\n const shouldAnnounceEmpty = (previousTotalItemCount ?? 0) > 0 && view.totalItemCount === 0;\n const emptyState = (\n <EmptyContainer\n message={emptyMessage}\n shouldAnnounce={shouldAnnounceEmpty}\n domContainer={view.getDomContainer()}\n transparent\n />\n );\n\n const { visibleColumns, headerColumn, subHeadingsColumns } = useMemo(\n () => getCardColumns(columns, meta.cardConfig ?? {}),\n [columns, meta.cardConfig]\n );\n\n return (\n <RsCardWrapper>\n <StyledKanbanContainer data-testid='kanban' view={view} isFullscreen={isFullscreen}>\n <WarningBanner warningMessages={view.warningMessages} />\n <Toolbar view={view} />\n <RenderView view={view} type={EXTERNAL_FILTERS} />\n <Grid\n as={StyledKanbanBoard}\n ref={boardRef}\n role='list'\n aria-label={meta.title ?? meta.name}\n container={{\n autoFlow: 'column',\n autoCols: `minmax(min(${theme.base['content-width'].sm}, 100%), 1fr)`,\n gap: 1.5,\n pad: 0.5\n }}\n >\n {!shouldRenderEmptyLane &&\n visibleLanes.map(lane => (\n <KanbanLane\n key={getLaneId(laneColumn, lane.name)}\n laneId={getLaneId(laneColumn, lane.name)}\n lane={lane}\n laneColumn={laneColumn}\n meta={meta}\n visibleColumns={visibleColumns}\n headerColumn={headerColumn}\n subHeadingsColumns={subHeadingsColumns}\n emptyState={emptyState}\n />\n ))}\n {shouldRenderEmptyLane && <EmptyKanbanLane emptyState={emptyState} />}\n <LoadingIndicator view={view} show={!rows || !!view.isLoading} />\n </Grid>\n </StyledKanbanContainer>\n </RsCardWrapper>\n );\n}\n\nKanban.displayName = 'Kanban';\n\nexport default Kanban;\n"]}
|
|
@@ -380,8 +380,8 @@ export declare const StyledGroupContentList: import("styled-components/dist/type
|
|
|
380
380
|
export declare const StyledTimelineListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
381
381
|
export declare const StyledTimelineEndMarker: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
382
382
|
export declare const StyledTimeline: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
|
|
383
|
-
export declare const StyledTime: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").DateTimeDisplayProps, "ref"> & import("react").RefAttributes<
|
|
384
|
-
ref?: ((instance:
|
|
383
|
+
export declare const StyledTime: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").DateTimeDisplayProps, "ref"> & import("react").RefAttributes<HTMLTimeElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
384
|
+
ref?: ((instance: HTMLTimeElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTimeElement> | null | undefined;
|
|
385
385
|
}, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").DateTimeDisplayProps>, keyof import("react").Component<any, {}, any>>;
|
|
386
386
|
export declare const StyledLoadingCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
387
387
|
export declare const timelineItemsGridProps: {
|
|
@@ -2,9 +2,9 @@ import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
|
|
|
2
2
|
// TODO: All such feature map support should be available at View object based via a feature in rs-core based on the template from meta.
|
|
3
3
|
// The consumer can pass along the resolved feature map to their component for decisioning.
|
|
4
4
|
const featureSupport = {
|
|
5
|
-
personalization: ['Table', 'Gallery', 'Timeline'],
|
|
5
|
+
personalization: ['Table', 'Gallery', 'Timeline', 'Kanban'],
|
|
6
6
|
group: ['Table', 'Timeline'],
|
|
7
|
-
showHideColumns: ['Table', 'Gallery'],
|
|
7
|
+
showHideColumns: ['Table', 'Gallery', 'Kanban'],
|
|
8
8
|
galleryLayout: ['Gallery'],
|
|
9
9
|
freezeColumns: ['Table'],
|
|
10
10
|
rowDensity: ['Table'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateFeatureSupport.js","sourceRoot":"","sources":["../../Core/templateFeatureSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAK/E,wIAAwI;AACxI,2FAA2F;AAC3F,MAAM,cAAc,GAA2C;IAC7D,eAAe,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"templateFeatureSupport.js","sourceRoot":"","sources":["../../Core/templateFeatureSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAK/E,wIAAwI;AACxI,2FAA2F;AAC3F,MAAM,cAAc,GAA2C;IAC7D,eAAe,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC;IAC3D,KAAK,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;IAC5B,eAAe,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC/C,aAAa,EAAE,CAAC,SAAS,CAAC;IAC1B,aAAa,EAAE,CAAC,OAAO,CAAC;IACxB,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,eAAe,EAAE,CAAC,OAAO,CAAC;IAC1B,eAAe,EAAE,CAAC,OAAO,CAAC;IAC1B,iBAAiB,EAAE,CAAC,OAAO,CAAC;IAC5B,IAAI,EAAE,CAAC,OAAO,CAAC;CAChB,CAAC;AAIF;;;;;;;GAOG;AACH,MAAM,sBAAsB,GAAG,CAAC,QAAuB,EAAE,OAAmB,EAAW,EAAE;IACvF,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\ntype TemplateValue =\n (typeof REPEATING_STRUCTURE_TEMPLATES)[keyof typeof REPEATING_STRUCTURE_TEMPLATES];\n\n// TODO: All such feature map support should be available at View object based via a feature in rs-core based on the template from meta.\n// The consumer can pass along the resolved feature map to their component for decisioning.\nconst featureSupport: { [feature: string]: TemplateValue[] } = {\n personalization: ['Table', 'Gallery', 'Timeline', 'Kanban'],\n group: ['Table', 'Timeline'],\n showHideColumns: ['Table', 'Gallery', 'Kanban'],\n galleryLayout: ['Gallery'],\n freezeColumns: ['Table'],\n rowDensity: ['Table'],\n showHeaderIcons: ['Table'],\n autoSizeColumns: ['Table'],\n resetColumnWidths: ['Table'],\n wrap: ['Table']\n};\n\ntype FeatureKey = keyof typeof featureSupport | string;\n\n/**\n * Check if a feature should show in toolbar for a given template.\n * Features not in the map are considered supported for all templates.\n *\n * @param template - The template type\n * @param feature - The feature identifier\n * @returns true if the feature should show in toolbar for the template\n */\nconst showFeatureForTemplate = (template: TemplateValue, feature: FeatureKey): boolean => {\n if (!featureSupport[feature]) {\n return true;\n }\n return featureSupport[feature].includes(template);\n};\n\nexport default showFeatureForTemplate;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-react",
|
|
3
|
-
"version": "10.0.0-build.4.
|
|
3
|
+
"version": "10.0.0-build.4.20",
|
|
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,17 +14,17 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "10.0.0-build.4.
|
|
18
|
-
"@pega/cosmos-react-core": "10.0.0-build.4.
|
|
19
|
-
"@pega/cosmos-react-rte": "10.0.0-build.4.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "10.0.0-build.4.20",
|
|
18
|
+
"@pega/cosmos-react-core": "10.0.0-build.4.20",
|
|
19
|
+
"@pega/cosmos-react-rte": "10.0.0-build.4.20",
|
|
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",
|
|
23
23
|
"dayjs": "^1.11.13",
|
|
24
24
|
"fast-deep-equal": "^3.1.3",
|
|
25
25
|
"lodash-es": "^4.18.1",
|
|
26
|
-
"pega-repeating-structures-core": "npm:@pega/lists-core@10.0.0-build.4.
|
|
27
|
-
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@10.0.0-build.4.
|
|
26
|
+
"pega-repeating-structures-core": "npm:@pega/lists-core@10.0.0-build.4.20",
|
|
27
|
+
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@10.0.0-build.4.20",
|
|
28
28
|
"polished": "^4.1.0",
|
|
29
29
|
"prop-types": "^15.8.1",
|
|
30
30
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@testing-library/react": "^16.0.0",
|
|
43
43
|
"@testing-library/user-event": "^14.6.1",
|
|
44
44
|
"jest-axe": "^8.0.0",
|
|
45
|
-
"srs-utils": "10.0.0-build.4.
|
|
45
|
+
"srs-utils": "10.0.0-build.4.20",
|
|
46
46
|
"typescript": "~6.0.3"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
-
interface GalleryFieldValueProps {
|
|
3
|
-
column: RsCoreTypes.Column;
|
|
4
|
-
row: RsCoreTypes.Row;
|
|
5
|
-
}
|
|
6
|
-
declare function GalleryFieldValue({ column, row }: GalleryFieldValueProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default GalleryFieldValue;
|
|
8
|
-
//# sourceMappingURL=GalleryFieldValue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryFieldValue.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryFieldValue.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,UAAU,sBAAsB;IAC9B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC;CACtB;AAED,iBAAS,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,sBAAsB,2CAIjE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import RenderingEngine from '../../../Components/RenderingEngine/RenderCell';
|
|
3
|
-
function GalleryFieldValue({ column, row }) {
|
|
4
|
-
column.setExecutionContext(row);
|
|
5
|
-
return _jsx(RenderingEngine, { ...column.getRenderingEngineProps(), highlighter: true });
|
|
6
|
-
}
|
|
7
|
-
export default GalleryFieldValue;
|
|
8
|
-
//# sourceMappingURL=GalleryFieldValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryFieldValue.js","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryFieldValue.tsx"],"names":[],"mappings":";AAEA,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAO7E,SAAS,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,EAA0B;IAChE,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,KAAC,eAAe,OAAK,MAAM,CAAC,uBAAuB,EAAE,EAAE,WAAW,SAAG,CAAC;AAC/E,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport RenderingEngine from '../../../Components/RenderingEngine/RenderCell';\n\ninterface GalleryFieldValueProps {\n column: RsCoreTypes.Column;\n row: RsCoreTypes.Row;\n}\n\nfunction GalleryFieldValue({ column, row }: GalleryFieldValueProps) {\n column.setExecutionContext(row);\n\n return <RenderingEngine {...column.getRenderingEngineProps()} highlighter />;\n}\n\nexport default GalleryFieldValue;\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
-
type GalleryHeaderProps = {
|
|
3
|
-
headerColumn?: RsCoreTypes.Column;
|
|
4
|
-
row: RsCoreTypes.Row;
|
|
5
|
-
};
|
|
6
|
-
declare function GalleryHeader({ headerColumn, row }: GalleryHeaderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export default GalleryHeader;
|
|
8
|
-
//# sourceMappingURL=GalleryHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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;A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AC,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,36 +0,0 @@
|
|
|
1
|
-
import { type RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
-
import type { ImageSize, SelectionCardDisplayProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import type { GalleryCardProps } from './Gallery.types';
|
|
4
|
-
export declare const GALLERY_IMAGE_PLACEMENT_MAP: {
|
|
5
|
-
readonly left: "inline-start";
|
|
6
|
-
readonly right: "inline-end";
|
|
7
|
-
readonly top: "block-start";
|
|
8
|
-
};
|
|
9
|
-
export declare const DEFAULT_IMAGE_PLACEMENT: RsCoreTypes.HeroImagePlacement;
|
|
10
|
-
export declare const DEFAULT_IMAGE_SIZE: ImageSize;
|
|
11
|
-
export declare const isInlinePlacement: (placement: RsCoreTypes.HeroImagePlacement) => placement is Extract<RsCoreTypes.HeroImagePlacement, "left" | "right">;
|
|
12
|
-
/**
|
|
13
|
-
* Generates the data required to display a card in the gallery view.
|
|
14
|
-
*
|
|
15
|
-
* @param props - The properties required to generate the card data.
|
|
16
|
-
* @param props.row - The data for the current row.
|
|
17
|
-
* @param props.visibleColumns - The columns that are visible in the gallery.
|
|
18
|
-
* @param props.meta - Metadata including gallery configuration.
|
|
19
|
-
* @param props.headerColumn - The column used for the card header.
|
|
20
|
-
* @param props.actionColumn - The column used for card actions.
|
|
21
|
-
* @returns An object containing the card's label, image, footer, and fields to be displayed.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getCardData({ row, visibleColumns, meta, headerColumn }: GalleryCardProps): Pick<SelectionCardDisplayProps, 'label' | 'image' | 'fields' | 'aria-label' | 'footer'>;
|
|
24
|
-
/**
|
|
25
|
-
* Extracts UI-related props from a row for card components.
|
|
26
|
-
*
|
|
27
|
-
* @param props - The properties containing the row.
|
|
28
|
-
* @param props.row - The data row.
|
|
29
|
-
* @returns An object containing card-safe row metadata.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getCardUIProps({ row }: {
|
|
32
|
-
row: RsCoreTypes.Row;
|
|
33
|
-
}): {
|
|
34
|
-
'data-key': string;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAkB,SAAS,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iB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;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,gBAAgB,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IAEvE,MAAM,KAAK,GAAG,KAAC,aAAa,IAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IAEtE,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC;IACjE,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,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,GAAG,EAA4B;IAC9D,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;IACjC,OAAO;QACL,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\nexport const GALLERY_IMAGE_PLACEMENT_MAP = {\n left: 'inline-start',\n right: 'inline-end',\n top: 'block-start'\n} as const satisfies Record<RsCoreTypes.HeroImagePlacement, ImagePlacement>;\n\nconst INLINE_PLACEMENTS: RsCoreTypes.HeroImagePlacement[] = ['left', 'right'] as const;\nexport const DEFAULT_IMAGE_PLACEMENT: RsCoreTypes.HeroImagePlacement = 'left';\nexport const DEFAULT_IMAGE_SIZE: ImageSize = 'flexible';\n\nexport const isInlinePlacement = (\n placement: RsCoreTypes.HeroImagePlacement\n): placement is Extract<RsCoreTypes.HeroImagePlacement, 'left' | 'right'> => {\n return INLINE_PLACEMENTS.includes(placement);\n};\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 * 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, footer, and fields to be displayed.\n */\nexport function getCardData({\n row,\n visibleColumns,\n meta,\n headerColumn\n}: GalleryCardProps): Pick<\n SelectionCardDisplayProps,\n 'label' | 'image' | 'fields' | 'aria-label' | 'footer'\n> {\n const { galleryConfig: { heroImage, tile: tileConfig, showFieldLabels = true } = {} } = meta;\n\n // Must set execution context for each column to ensure correct value retrieval\n visibleColumns.forEach(col => col.setExecutionContext(row));\n\n const rowData = row.getContext().getValue();\n\n const fields = visibleColumns.map(col => ({\n id: col.field.id,\n ...(showFieldLabels && { name: col.getContext()?.getLabel() }),\n ...(col.field.layoutMode && { variant: col.field.layoutMode }),\n // TODO: Add truncation for non-tile cards once `truncate` is typed at\n // the field-level API.\n ...(!heroImage && tileConfig\n ? { value: String(rowData[col.field.id] ?? ''), truncate: true }\n : { value: <GalleryFieldValue column={col} row={row} /> })\n }));\n\n const heroImageData = heroImage ? getImageData(meta, row) : undefined;\n\n let image: SelectionCardDisplayProps['image'] = heroImageData;\n\n if (!heroImage && tileConfig) {\n const foregroundColor =\n tileConfig.foregroundColor.field in rowData\n ? String(rowData[tileConfig.foregroundColor.field])\n : undefined;\n const backgroundColor =\n tileConfig.backgroundColor.field in rowData\n ? String(rowData[tileConfig.backgroundColor.field])\n : undefined;\n\n if (foregroundColor && backgroundColor) {\n const tileName =\n tileConfig.iconName && tileConfig.iconName.field in rowData\n ? String(rowData[tileConfig.iconName.field]) || undefined\n : undefined;\n const tileText =\n tileConfig.text && tileConfig.text.field in rowData\n ? String(rowData[tileConfig.text.field]) || undefined\n : undefined;\n\n const tileBase = {\n foregroundColor,\n backgroundColor\n };\n\n if (tileName) {\n image = { ...tileBase, icon: tileName };\n } else if (tileText) {\n image = { ...tileBase, text: tileText };\n }\n }\n }\n\n const footer = meta.galleryConfig?.renderCardFooter?.(rowData) ?? null;\n\n const label = <GalleryHeader headerColumn={headerColumn} row={row} />;\n\n const headerValue = row.getContext()?.getRowHeader()?.getValue();\n const ariaLabel = !isEmpty(headerValue) ? String(headerValue) : undefined;\n\n return { fields, image, footer, 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 card-safe row metadata.\n */\nexport function getCardUIProps({ row }: { row: RsCoreTypes.Row }) {\n const uiProps = row.getUIProps();\n return {\n 'data-key': uiProps['data-key']\n };\n}\n"]}
|
|
File without changes
|
|
File without changes
|