@pega/cosmos-react-work 4.0.0-dev.2.0 → 4.0.0-dev.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +7 -21
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +2 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/Assignments/Assignments.d.ts +21 -0
- package/lib/components/Assignments/Assignments.d.ts.map +1 -0
- package/lib/components/Assignments/Assignments.js +20 -0
- package/lib/components/Assignments/Assignments.js.map +1 -0
- package/lib/components/Assignments/Assignments.styles.d.ts +8 -0
- package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -0
- package/lib/components/Assignments/Assignments.styles.js +41 -0
- package/lib/components/Assignments/Assignments.styles.js.map +1 -0
- package/lib/components/Assignments/index.d.ts +2 -0
- package/lib/components/Assignments/index.d.ts.map +1 -0
- package/lib/components/Assignments/index.js +2 -0
- package/lib/components/Assignments/index.js.map +1 -0
- package/lib/components/CasePreview/CasePreview.d.ts +9 -4
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +6 -9
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts +2 -0
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts.map +1 -0
- package/lib/components/CasePreview/CasePreview.test-ids.js +3 -0
- package/lib/components/CasePreview/CasePreview.test-ids.js.map +1 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +119 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -0
- package/lib/components/CaseView/CaseHeader/Summary.d.ts +6 -0
- package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader/Summary.js +182 -0
- package/lib/components/CaseView/CaseHeader/Summary.js.map +1 -0
- package/lib/components/CaseView/CaseSummary.d.ts.map +1 -1
- package/lib/components/CaseView/CaseSummary.js +9 -4
- package/lib/components/CaseView/CaseSummary.js.map +1 -1
- package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/CaseView/CaseSummaryFields.js +14 -4
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts +4 -2
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +183 -68
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +45 -19
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +324 -66
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.test-ids.d.ts +2 -0
- package/lib/components/CaseView/CaseView.test-ids.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.test-ids.js +17 -0
- package/lib/components/CaseView/CaseView.test-ids.js.map +1 -0
- package/lib/components/CaseView/CaseView.types.d.ts +27 -34
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts +0 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +4 -8
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +0 -5
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js +0 -4
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +1 -3
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js +2 -2
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +25 -16
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +6 -4
- package/lib/components/Details/Details.styles.d.ts.map +1 -1
- package/lib/components/Details/Details.styles.js +38 -101
- package/lib/components/Details/Details.styles.js.map +1 -1
- package/lib/components/Glimpse/Glimpse.d.ts +10 -10
- package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
- package/lib/components/Glimpse/Glimpse.js +7 -17
- package/lib/components/Glimpse/Glimpse.js.map +1 -1
- package/lib/components/Glimpse/index.d.ts +1 -1
- package/lib/components/Glimpse/index.d.ts.map +1 -1
- package/lib/components/Glimpse/index.js +0 -1
- package/lib/components/Glimpse/index.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +39 -43
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +3 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +137 -81
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +13 -9
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -1
- package/lib/components/Predictions/Predictions.d.ts +6 -0
- package/lib/components/Predictions/Predictions.d.ts.map +1 -0
- package/lib/components/Predictions/Predictions.js +60 -0
- package/lib/components/Predictions/Predictions.js.map +1 -0
- package/lib/components/Predictions/Predictions.types.d.ts +23 -0
- package/lib/components/Predictions/Predictions.types.d.ts.map +1 -0
- package/lib/components/Predictions/Predictions.types.js +2 -0
- package/lib/components/Predictions/Predictions.types.js.map +1 -0
- package/lib/components/Predictions/index.d.ts +3 -0
- package/lib/components/Predictions/index.d.ts.map +1 -0
- package/lib/components/Predictions/index.js +2 -0
- package/lib/components/Predictions/index.js.map +1 -0
- package/lib/components/SearchResults/SearchResults.types.d.ts +5 -5
- package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
- package/lib/components/Stages/StageGlimpse.d.ts +0 -2
- package/lib/components/Stages/StageGlimpse.d.ts.map +1 -1
- package/lib/components/Stages/StageGlimpse.js +4 -4
- package/lib/components/Stages/StageGlimpse.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +39 -58
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +0 -2
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +10 -18
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +2 -2
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.d.ts +5 -13
- package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts +1 -1
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js +5 -20
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +18 -7
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +48 -10
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts +21 -15
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +9 -9
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Tasks/Tasks.test-ids.d.ts +4 -0
- package/lib/components/Tasks/Tasks.test-ids.d.ts.map +1 -0
- package/lib/components/Tasks/Tasks.test-ids.js +5 -0
- package/lib/components/Tasks/Tasks.test-ids.js.map +1 -0
- package/lib/components/Tasks/index.d.ts +3 -5
- package/lib/components/Tasks/index.d.ts.map +1 -1
- package/lib/components/Tasks/index.js +1 -0
- package/lib/components/Tasks/index.js.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.js +14 -12
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +4 -5
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +34 -55
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/Timeline.types.d.ts +8 -8
- package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.types.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +19 -7
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/components/Timeline/utils.d.ts +1 -0
- package/lib/components/Timeline/utils.d.ts.map +1 -1
- package/lib/components/Timeline/utils.js +12 -0
- package/lib/components/Timeline/utils.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/package.json +8 -6
- package/lib/components/CaseView/CaseHeader.d.ts.map +0 -1
- package/lib/components/CaseView/CaseHeader.js +0 -49
- package/lib/components/CaseView/CaseHeader.js.map +0 -1
- package/lib/components/CaseView/MobileCaseView.d.ts +0 -13
- package/lib/components/CaseView/MobileCaseView.d.ts.map +0 -1
- package/lib/components/CaseView/MobileCaseView.js +0 -25
- package/lib/components/CaseView/MobileCaseView.js.map +0 -1
- /package/lib/components/CaseView/{CaseHeader.d.ts → CaseHeader/CaseHeader.d.ts} +0 -0
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useLayoutEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Flex, Grid, Icon, registerIcon, TabPanel, useBreakpoint, useScrollStick, useElement, Card, Drawer, useI18n, useDirection, Tabs, useAfterInitialEffect, windowIsAvailable, focusHeadingOrContainer, useConfiguration, useTestIds, withTestIds } from '@pega/cosmos-react-core';
|
|
4
4
|
import * as moveRightSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-right-solid.icon';
|
|
5
5
|
import * as moveLeftSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-left-solid.icon';
|
|
6
6
|
import CaseSummary from './CaseSummary';
|
|
7
7
|
import UtilitiesSummary from './UtilitiesSummary';
|
|
8
|
-
import { StyledCaseDrawer, StyledCaseDrawerContent, StyledCaseView, StyledWorkArea, StyledPersistentUtility, StyledSummary, StyledUtilities,
|
|
8
|
+
import { StyledCaseDrawer, StyledCaseDrawerContent, StyledCaseView, StyledWorkArea, StyledPersistentUtility, StyledSummary, StyledSummaryTabContent, StyledUtilities, StyledExpandCollapseUtilitiesButton, StyledUtilitiesHeading } from './CaseView.styles';
|
|
9
9
|
import CaseViewContext from './CaseView.context';
|
|
10
|
+
import CaseSummaryFields from './CaseSummaryFields';
|
|
11
|
+
import { getCaseViewTestIds } from './CaseView.test-ids';
|
|
10
12
|
registerIcon(moveRightSolidIcon, moveLeftSolidIcon);
|
|
11
|
-
|
|
13
|
+
// This function is responsible for auto sizing table height in case tab panels.
|
|
14
|
+
const resizeTable = (tabPanelEl, workAreaEl) => {
|
|
15
|
+
tabPanelEl.style.removeProperty('--content-height-in-view');
|
|
16
|
+
// .rs-wrapper is currently the class used by the table component which needs to be targeted.
|
|
17
|
+
const tables = Array.from(tabPanelEl.querySelectorAll('.rs-wrapper')).filter(table => table.getBoundingClientRect().width !== 0);
|
|
18
|
+
// Only perform this logic when there is a single table in a tab's panel.
|
|
19
|
+
if (tables.length !== 1)
|
|
20
|
+
return;
|
|
21
|
+
// This selector finds the table's root element as they are always wrapped in a Card.
|
|
22
|
+
const table = tables[0].closest('article');
|
|
23
|
+
if (!table)
|
|
24
|
+
return;
|
|
25
|
+
const tabPanelRect = tabPanelEl.getBoundingClientRect();
|
|
26
|
+
const tableRect = table.getBoundingClientRect();
|
|
27
|
+
const vpHeight = document.documentElement.clientHeight;
|
|
28
|
+
const tableRectOffsetTop = tableRect.top + window.scrollY;
|
|
29
|
+
const workAreaPaddingBlockEnd =
|
|
30
|
+
// px unit are required for proper CSS calc calculation.
|
|
31
|
+
window.getComputedStyle(workAreaEl).getPropertyValue('padding-block-end') || '0px';
|
|
32
|
+
// Accounts for content rendered after the table.
|
|
33
|
+
const tableBottomToTabPanelBottom = tabPanelRect.bottom - tableRect.bottom;
|
|
34
|
+
// Sets a CSS variable for available height based on screen size and view state.
|
|
35
|
+
// Defines an available minimum height of ~600px.
|
|
36
|
+
tabPanelEl.style.setProperty('--content-height-in-view', `max(calc(${vpHeight - tableRectOffsetTop - tableBottomToTabPanelBottom}px - ${workAreaPaddingBlockEnd}), 37.5rem)`);
|
|
37
|
+
};
|
|
38
|
+
const CaseView = ({ testId,
|
|
12
39
|
// Case data mostly visually related to the case header
|
|
13
40
|
caseId, heading, subheading, caseLink, parentCases, icon, followed, onFollowedChange, onEdit, actions, promotedActions,
|
|
14
41
|
// Summary content and state props
|
|
15
|
-
|
|
42
|
+
summaryFields, summaryExpanded: summaryExpandedProp = true, onToggleSummary,
|
|
16
43
|
// Case tabs
|
|
17
44
|
tabs: { currentTabId, items: tabItemsProp, onClick: onTabClick },
|
|
18
45
|
// Workarea related content props
|
|
@@ -21,30 +48,44 @@ banners, stages, tasks, tabContent: tabContentProp = [],
|
|
|
21
48
|
utilities, utilitiesSummaryItems, utilitiesExpanded: utilitiesExpandedProp = true, onToggleUtilities,
|
|
22
49
|
// Etc...
|
|
23
50
|
persistentUtility, intelligentGuidance, isPreview = false, ...restProps }) => {
|
|
51
|
+
const testIds = useTestIds(testId, getCaseViewTestIds);
|
|
24
52
|
// General util hooks
|
|
25
53
|
const t = useI18n();
|
|
26
54
|
const direction = useDirection();
|
|
55
|
+
const { loadedRef } = useConfiguration();
|
|
27
56
|
// Element refs
|
|
28
57
|
const caseViewRef = useRef(null);
|
|
29
58
|
const summaryRef = useRef(null);
|
|
59
|
+
// undefined used to allow ref to be mutable. Element set below in ref callback for scroll stick.
|
|
60
|
+
const workAreaRef = useRef();
|
|
30
61
|
// Tab content
|
|
31
62
|
const [tabContentEl, setTabContentEl] = useElement(null);
|
|
32
63
|
// Breakpoint booleans
|
|
64
|
+
const smOrAbove = useBreakpoint('sm');
|
|
33
65
|
const mdOrAbove = useBreakpoint('md', { breakpointRef: caseViewRef });
|
|
34
66
|
const lgOrAbove = useBreakpoint('lg', { breakpointRef: caseViewRef });
|
|
35
67
|
const xlOrAbove = useBreakpoint('xl', { breakpointRef: caseViewRef });
|
|
36
68
|
// DOM ids
|
|
69
|
+
const initialTabId = tabItemsProp[0]?.id;
|
|
37
70
|
const summaryTabId = `summary-${caseId}`;
|
|
38
71
|
const utilitiesTabId = `utilities-${caseId}`;
|
|
39
72
|
const persistentUtilityTabId = `persistent-utility-${caseId}`;
|
|
40
|
-
const summaryId = `summary-${caseId}`;
|
|
41
|
-
const utilitiesId = `utilities-${caseId}`;
|
|
42
|
-
const utilitiesDrawerId = `utilities-drawer-${caseId}`;
|
|
43
73
|
// Summary state handling
|
|
44
|
-
let summaryExpanded = !!summaryExpandedProp;
|
|
74
|
+
let summaryExpanded = !isPreview && !!summaryExpandedProp;
|
|
45
75
|
if (persistentUtility) {
|
|
46
76
|
summaryExpanded = xlOrAbove;
|
|
47
77
|
}
|
|
78
|
+
// Focus heading on initial mount
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!caseViewRef.current)
|
|
81
|
+
return;
|
|
82
|
+
if (loadedRef.current) {
|
|
83
|
+
focusHeadingOrContainer(caseViewRef.current, heading);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
loadedRef.current = true;
|
|
87
|
+
}
|
|
88
|
+
}, [caseId]);
|
|
48
89
|
// Utilities state handling
|
|
49
90
|
// Used in coordination with a layoutEffect below to determine the utilities state on initial render.
|
|
50
91
|
// Attempted with a ref but it did not work. Using state and enforcing a render in addition to the change render for lgOrAbove seems to fix...
|
|
@@ -73,54 +114,41 @@ persistentUtility, intelligentGuidance, isPreview = false, ...restProps }) => {
|
|
|
73
114
|
}
|
|
74
115
|
// Purposely not listing utilitiesExpanded as a dependency as it is not a trigger and will be captured when BPs change
|
|
75
116
|
}, [mdOrAbove, lgOrAbove]);
|
|
76
|
-
//
|
|
77
|
-
const tabItems = useMemo(() => {
|
|
78
|
-
const summaryTab = { id: summaryTabId, name: '
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (utilities)
|
|
86
|
-
utilityTabs.push({ id: utilitiesTabId, name: 'Utilities' });
|
|
87
|
-
if (persistentUtility && !mdOrAbove) {
|
|
88
|
-
utilityTabs.push({ id: persistentUtilityTabId, name: persistentUtility.title });
|
|
89
|
-
}
|
|
90
|
-
return [summaryTab, ...tabItemsProp, ...utilityTabs];
|
|
91
|
-
}, [
|
|
92
|
-
mdOrAbove,
|
|
93
|
-
xlOrAbove,
|
|
94
|
-
summaryTabId,
|
|
95
|
-
utilitiesTabId,
|
|
96
|
-
persistentUtilityTabId,
|
|
97
|
-
utilities,
|
|
98
|
-
persistentUtility,
|
|
99
|
-
tabItemsProp,
|
|
100
|
-
summaryExpanded
|
|
101
|
-
]);
|
|
102
|
-
// Setup tab content
|
|
103
|
-
const tabContent = useMemo(() => {
|
|
104
|
-
const summaryTabContent = { id: summaryTabId, content: _jsx(Card, { children: summary }) };
|
|
117
|
+
// Prepare tabs
|
|
118
|
+
const [tabItems, tabContent] = useMemo(() => {
|
|
119
|
+
const summaryTab = { id: summaryTabId, name: t('summary') };
|
|
120
|
+
const summaryTabContent = {
|
|
121
|
+
id: summaryTabId,
|
|
122
|
+
content: (_jsx(Card, { children: _jsx(StyledSummaryTabContent, { children: _jsx(CaseSummaryFields, { ...summaryFields }) }) }))
|
|
123
|
+
};
|
|
124
|
+
let items = tabItemsProp;
|
|
125
|
+
let content = tabContentProp;
|
|
105
126
|
if (mdOrAbove) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
127
|
+
if (!summaryExpanded || (persistentUtility && !xlOrAbove)) {
|
|
128
|
+
items = [summaryTab, ...tabItemsProp];
|
|
129
|
+
content = [summaryTabContent, ...tabContentProp];
|
|
130
|
+
}
|
|
131
|
+
return [items, content];
|
|
109
132
|
}
|
|
110
|
-
const
|
|
133
|
+
const utilityTabsItems = [];
|
|
134
|
+
const utilityTabsContent = [];
|
|
111
135
|
if (utilities) {
|
|
112
|
-
|
|
136
|
+
utilityTabsItems.push({ id: utilitiesTabId, name: t('utilities') });
|
|
137
|
+
utilityTabsContent.push({
|
|
113
138
|
id: utilitiesTabId,
|
|
114
139
|
content: _jsx(Flex, { container: { direction: 'column', gap: 2 }, children: utilities })
|
|
115
140
|
});
|
|
116
141
|
}
|
|
117
142
|
if (persistentUtility) {
|
|
118
|
-
|
|
143
|
+
utilityTabsItems.push({ id: persistentUtilityTabId, name: persistentUtility.title });
|
|
144
|
+
utilityTabsContent.push({ id: persistentUtilityTabId, content: persistentUtility?.content });
|
|
119
145
|
}
|
|
120
|
-
|
|
146
|
+
items = [summaryTab, ...tabItemsProp, ...utilityTabsItems];
|
|
147
|
+
content = [summaryTabContent, ...tabContentProp, ...utilityTabsContent];
|
|
148
|
+
return [items, content];
|
|
121
149
|
}, [
|
|
150
|
+
tabItemsProp,
|
|
122
151
|
summaryTabId,
|
|
123
|
-
summary,
|
|
124
152
|
mdOrAbove,
|
|
125
153
|
summaryExpanded,
|
|
126
154
|
persistentUtility,
|
|
@@ -195,6 +223,13 @@ persistentUtility, intelligentGuidance, isPreview = false, ...restProps }) => {
|
|
|
195
223
|
useScrollStick(
|
|
196
224
|
// isMediumOrAbove means side by side columns | | |
|
|
197
225
|
mdOrAbove ? { ...scrollStickOptions.current, offset: stickOffset } : undefined);
|
|
226
|
+
// Preview set summary tab active
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
if (isPreview) {
|
|
229
|
+
onTabClick(summaryTabId);
|
|
230
|
+
}
|
|
231
|
+
}, []);
|
|
232
|
+
// Initial tab selection
|
|
198
233
|
useEffect(() => {
|
|
199
234
|
if (mdOrAbove &&
|
|
200
235
|
summaryExpanded &&
|
|
@@ -202,11 +237,32 @@ persistentUtility, intelligentGuidance, isPreview = false, ...restProps }) => {
|
|
|
202
237
|
(currentTabId === summaryTabId || currentTabId === utilitiesTabId)) {
|
|
203
238
|
onTabClick(tabItemsProp[0]?.id);
|
|
204
239
|
}
|
|
205
|
-
|
|
240
|
+
// Toggle utilities tab selection
|
|
241
|
+
if (mdOrAbove && [utilitiesTabId, persistentUtilityTabId].includes(currentTabId)) {
|
|
242
|
+
onTabClick(initialTabId);
|
|
243
|
+
}
|
|
244
|
+
}, [mdOrAbove]);
|
|
245
|
+
// Initial / summary tab selection
|
|
206
246
|
useEffect(() => {
|
|
207
|
-
if (
|
|
247
|
+
if (!smOrAbove && currentTabId === initialTabId) {
|
|
208
248
|
onTabClick(summaryTabId);
|
|
209
|
-
|
|
249
|
+
}
|
|
250
|
+
else if (smOrAbove && currentTabId === summaryTabId) {
|
|
251
|
+
onTabClick(initialTabId);
|
|
252
|
+
}
|
|
253
|
+
}, [smOrAbove]);
|
|
254
|
+
// Summary tab selection
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
if (isPreview) {
|
|
257
|
+
onTabClick(summaryTabId);
|
|
258
|
+
}
|
|
259
|
+
}, [isPreview]);
|
|
260
|
+
// Initial tab selection
|
|
261
|
+
useEffect(() => {
|
|
262
|
+
if (summaryExpanded && currentTabId === summaryTabId) {
|
|
263
|
+
onTabClick(initialTabId);
|
|
264
|
+
}
|
|
265
|
+
}, [summaryExpanded]);
|
|
210
266
|
// Handles scrolling to tab content for newly clicked tab
|
|
211
267
|
useEffect(() => {
|
|
212
268
|
if (!tabContentEl)
|
|
@@ -228,7 +284,9 @@ persistentUtility, intelligentGuidance, isPreview = false, ...restProps }) => {
|
|
|
228
284
|
}, [summaryExpanded]);
|
|
229
285
|
// CaseView context value
|
|
230
286
|
// Choosing not to memo for now due to extent of deps and how often they change. Optimize as needed.
|
|
287
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
231
288
|
const ctxValue = {
|
|
289
|
+
testIds,
|
|
232
290
|
caseId,
|
|
233
291
|
heading,
|
|
234
292
|
subheading,
|
|
@@ -240,49 +298,106 @@ persistentUtility, intelligentGuidance, isPreview = false, ...restProps }) => {
|
|
|
240
298
|
actions,
|
|
241
299
|
promotedActions,
|
|
242
300
|
onEdit,
|
|
243
|
-
|
|
301
|
+
summaryFields,
|
|
244
302
|
tabs: {
|
|
245
303
|
items: tabItems,
|
|
246
304
|
onClick: onTabClick,
|
|
247
305
|
currentTabId
|
|
248
306
|
},
|
|
307
|
+
stages,
|
|
308
|
+
tasks,
|
|
249
309
|
persistentUtility,
|
|
250
310
|
intelligentGuidance,
|
|
251
|
-
summaryId,
|
|
252
311
|
summaryExpanded,
|
|
253
312
|
utilitiesExpanded,
|
|
254
313
|
onToggleSummary,
|
|
255
314
|
isPreview,
|
|
315
|
+
aboveSM: smOrAbove,
|
|
256
316
|
aboveMD: mdOrAbove,
|
|
257
317
|
aboveLG: lgOrAbove,
|
|
258
318
|
aboveXL: xlOrAbove
|
|
259
319
|
};
|
|
320
|
+
const currentTabPanelRef = useRef(null);
|
|
321
|
+
// The following effects are dedicated to resizeTable handling.
|
|
322
|
+
useLayoutEffect(() => {
|
|
323
|
+
if (!currentTabPanelRef.current || !workAreaRef.current)
|
|
324
|
+
return;
|
|
325
|
+
const currentTabPanelEl = currentTabPanelRef.current;
|
|
326
|
+
const workAreaEl = workAreaRef.current;
|
|
327
|
+
resizeTable(currentTabPanelEl, workAreaEl);
|
|
328
|
+
const onTabChange = () => {
|
|
329
|
+
resizeTable(currentTabPanelEl, workAreaEl);
|
|
330
|
+
};
|
|
331
|
+
// TODO: optimize
|
|
332
|
+
const mo = new MutationObserver(() => {
|
|
333
|
+
resizeTable(currentTabPanelEl, workAreaEl);
|
|
334
|
+
});
|
|
335
|
+
mo.observe(currentTabPanelEl, { childList: true, subtree: true });
|
|
336
|
+
currentTabPanelEl.addEventListener('cosmos-tab-changed', onTabChange);
|
|
337
|
+
return () => {
|
|
338
|
+
mo.disconnect();
|
|
339
|
+
currentTabPanelEl.removeEventListener('cosmos-tab-changed', onTabChange);
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
const [bannersStagesTasksEl, setBannersStagesTasksEl] = useElement(null);
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
if (!bannersStagesTasksEl)
|
|
345
|
+
return;
|
|
346
|
+
const observer = new ResizeObserver(() => {
|
|
347
|
+
if (!currentTabPanelRef.current || !workAreaRef.current)
|
|
348
|
+
return;
|
|
349
|
+
resizeTable(currentTabPanelRef.current, workAreaRef.current);
|
|
350
|
+
});
|
|
351
|
+
observer.observe(bannersStagesTasksEl);
|
|
352
|
+
return () => {
|
|
353
|
+
observer.disconnect();
|
|
354
|
+
};
|
|
355
|
+
}, [bannersStagesTasksEl]);
|
|
356
|
+
useEffect(() => {
|
|
357
|
+
const onResize = () => {
|
|
358
|
+
if (!currentTabPanelRef.current || !workAreaRef.current)
|
|
359
|
+
return;
|
|
360
|
+
resizeTable(currentTabPanelRef.current, workAreaRef.current);
|
|
361
|
+
};
|
|
362
|
+
window.addEventListener('resize', onResize);
|
|
363
|
+
return () => {
|
|
364
|
+
window.removeEventListener('resize', onResize);
|
|
365
|
+
};
|
|
366
|
+
}, []);
|
|
367
|
+
const utilitiesHeading = (_jsx(StyledUtilitiesHeading, { variant: 'h2', children: t('utilities') }));
|
|
368
|
+
const utilitiesToggleButton = (_jsx(StyledExpandCollapseUtilitiesButton, { compact: true, icon: true, label: t(utilitiesExpanded ? 'collapse' : 'expand'), "aria-label": t(utilitiesExpanded ? 'collapse_utilities_panel' : 'expand_utilities_panel'), onClick: () => {
|
|
369
|
+
if (!obeyUtilitiesExpandedProp && utilitiesExpandedProp) {
|
|
370
|
+
setObeyUtilitiesExpandedProp(true);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
onToggleUtilities?.();
|
|
374
|
+
}
|
|
375
|
+
}, children: _jsx(Icon, { name: 'arrow-micro-left' }) }));
|
|
260
376
|
// Here we go...
|
|
261
|
-
return (_jsxs(_Fragment, { children: [_jsx(CaseViewContext.Provider, { value: ctxValue, children: _jsxs(Grid, { as: StyledCaseView, ref: caseViewRef, container: caseViewGridContainer, item: { area: 'case-view' },
|
|
262
|
-
// Used for aria-controls on the toggle button
|
|
263
|
-
, {
|
|
264
|
-
// Used for aria-controls on the toggle button
|
|
265
|
-
id: summaryId, as: StyledSummary, item: { area: 'summary' }, desktop: mdOrAbove && (!persistentUtility || xlOrAbove) && !summaryExpanded, isLargeOrAbove: lgOrAbove, ref: summaryRef, children: _jsx(CaseSummary, {}) }), _jsxs(Flex, { container: {
|
|
377
|
+
return (_jsxs(_Fragment, { children: [_jsx(CaseViewContext.Provider, { value: ctxValue, children: _jsxs(Grid, { "data-testid": testIds.root, ...restProps, as: StyledCaseView, ref: caseViewRef, container: caseViewGridContainer, item: { area: 'case-view' }, children: [_jsx(Grid, { as: StyledSummary, item: { area: 'summary' }, desktop: mdOrAbove && (!persistentUtility || xlOrAbove) && !summaryExpanded, isLargeOrAbove: lgOrAbove, ref: summaryRef, children: _jsx(CaseSummary, {}) }), _jsxs(Flex, { container: {
|
|
266
378
|
direction: 'column',
|
|
267
379
|
alignContent: 'start',
|
|
268
380
|
rowGap: 2
|
|
269
|
-
}, as: StyledWorkArea, persistentUtility: Boolean(persistentUtility),
|
|
381
|
+
}, as: StyledWorkArea, persistentUtility: Boolean(persistentUtility), ref: (el) => {
|
|
382
|
+
workAreaRef.current = el;
|
|
383
|
+
if (el)
|
|
384
|
+
scrollStickOptions.current?.elements.push(el);
|
|
385
|
+
}, children: [(banners || stages || tasks) && (_jsxs(Flex, { container: {
|
|
386
|
+
direction: 'column',
|
|
387
|
+
alignContent: 'start',
|
|
388
|
+
rowGap: 2
|
|
389
|
+
}, ref: setBannersStagesTasksEl, children: [banners && _jsx("div", { "data-testid": testIds.banners, children: banners }), stages && _jsx("div", { "data-testid": testIds.stages, children: stages }), tasks && _jsx("div", { "data-testid": testIds.tasks, children: tasks })] })), (!mdOrAbove || (persistentUtility && !xlOrAbove) || !summaryExpanded) && (_jsx(Tabs, { "data-testid": testIds.tabs, tabs: tabItems, onTabClick: onTabClick, currentTabId: currentTabId })), _jsx("div", { ref: setTabContentEl, children: tabContent?.map(({ id, content }) => (_jsx(TabPanel, { "data-testid": currentTabId === id ? testIds.tabContent : undefined, currentTabId: currentTabId, tabId: id, ref: currentTabId === id ? currentTabPanelRef : undefined, children: content }, id))) })] }), persistentUtility && mdOrAbove && (_jsx(Grid, { as: StyledPersistentUtility, item: { area: 'persistentUtility' }, "data-app-region": true, children: persistentUtility.content })), utilities && mdOrAbove && !lgOrAbove && utilitiesExpanded && (_jsx(Drawer, { as: StyledCaseDrawer, open: utilitiesExpanded, position: 'fixed', placement: direction.end, shadow: true, nullWhenClosed: true, hasPersistentUtility: !!persistentUtility, children: _jsxs(Flex, { as: StyledCaseDrawerContent, container: { direction: 'column', gap: 2 }, "data-app-region": true, children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, children: [utilitiesHeading, utilitiesToggleButton] }), utilities] }) })), utilities && mdOrAbove && (_jsxs(Grid, { "data-testid": testIds.utilities, ref: (el) => {
|
|
270
390
|
if (el)
|
|
271
|
-
|
|
391
|
+
scrollStickOptions.current?.elements.push(el);
|
|
272
392
|
}, as: StyledUtilities, container: {
|
|
273
393
|
cols: 'minmax(0, 1fr)',
|
|
274
|
-
rowGap: 2
|
|
275
|
-
pad: [2, 0, 2]
|
|
394
|
+
rowGap: 2
|
|
276
395
|
}, item: {
|
|
277
396
|
area: 'utilities'
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
else {
|
|
283
|
-
onToggleUtilities?.();
|
|
284
|
-
}
|
|
285
|
-
}, as: StyledUtilToggle, label: t(utilitiesExpanded ? 'collapse_utilities_panel' : 'expand_utilities_panel'), children: _jsx(Icon, { name: `move-${utilitiesExpanded ? direction.end : direction.start}-solid` }) }) }), lgOrAbove && utilitiesExpanded && (_jsx(Flex, { container: { direction: 'column', gap: 2 }, id: utilitiesId, children: utilities })), (!utilitiesExpanded || (mdOrAbove && !lgOrAbove)) && (_jsx(UtilitiesSummary, { items: utilitiesSummaryItems, onClick: onToggleUtilities, "aria-expanded": utilitiesExpanded ? 'true' : 'false', "aria-controls": lgOrAbove ? utilitiesId : utilitiesDrawerId }))] }))] }) }), intelligentGuidance] }));
|
|
397
|
+
}, "data-app-region": lgOrAbove || !utilitiesExpanded || undefined, "aria-label": t('utilities_label'), children: [_jsxs(Flex, { container: {
|
|
398
|
+
alignItems: 'center',
|
|
399
|
+
justify: utilitiesExpanded ? 'between' : 'center'
|
|
400
|
+
}, children: [utilitiesHeading, utilitiesToggleButton] }), utilitiesExpanded && lgOrAbove && utilities, (!utilitiesExpanded || (mdOrAbove && !lgOrAbove)) && (_jsx(UtilitiesSummary, { items: utilitiesSummaryItems }))] }))] }) }), intelligentGuidance] }));
|
|
286
401
|
};
|
|
287
|
-
export default CaseView;
|
|
402
|
+
export default withTestIds(CaseView, getCaseViewTestIds);
|
|
288
403
|
//# sourceMappingURL=CaseView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElF,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,UAAU,EAEV,IAAI,EACJ,MAAM,EACN,OAAO,EACP,YAAY,EACZ,IAAI,EAEJ,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,kBAAkB,MAAM,yEAAyE,CAAC;AAC9G,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAE5G,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,YAAY,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAEpD,MAAM,QAAQ,GAAqC,CAAC;AAClD,uDAAuD;AACvD,MAAM,EACN,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,eAAe;AAEf,kCAAkC;AAClC,OAAO,EACP,eAAe,EAAE,mBAAmB,GAAG,IAAI,EAC3C,eAAe;AAEf,YAAY;AACZ,IAAI,EAAE,EAAE,YAAY,EAAE,KAAK,EA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,iBAAiB,mBACX,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,mBACpC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,GAC1D,CACH,IACI,CACR,IACI,GACkB,EAC1B,mBAAmB,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { FC, useEffect, useMemo, useRef, useLayoutEffect, useState } from 'react';\n\nimport {\n Button,\n Flex,\n Grid,\n Icon,\n registerIcon,\n TabPanel,\n useBreakpoint,\n useScrollStick,\n useElement,\n ForwardProps,\n Card,\n Drawer,\n useI18n,\n useDirection,\n Tabs,\n TabsProps,\n useAfterInitialEffect,\n windowIsAvailable\n} from '@pega/cosmos-react-core';\nimport { ScrollStickOptions } from '@pega/cosmos-react-core/lib/hooks/useScrollStick';\nimport * as moveRightSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-right-solid.icon';\nimport * as moveLeftSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-left-solid.icon';\n\nimport CaseSummary from './CaseSummary';\nimport UtilitiesSummary from './UtilitiesSummary';\nimport {\n StyledCaseDrawer,\n StyledCaseDrawerContent,\n StyledCaseView,\n StyledWorkArea,\n StyledPersistentUtility,\n StyledSummary,\n StyledUtilities,\n StyledUtilToggle\n} from './CaseView.styles';\nimport { CaseViewContextValue, CaseViewProps } from './CaseView.types';\nimport CaseViewContext from './CaseView.context';\n\nregisterIcon(moveRightSolidIcon, moveLeftSolidIcon);\n\nconst CaseView: FC<CaseViewProps & ForwardProps> = ({\n // Case data mostly visually related to the case header\n caseId,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n followed,\n onFollowedChange,\n onEdit,\n actions,\n promotedActions,\n\n // Summary content and state props\n summary,\n summaryExpanded: summaryExpandedProp = true,\n onToggleSummary,\n\n // Case tabs\n tabs: { currentTabId, items: tabItemsProp, onClick: onTabClick },\n\n // Workarea related content props\n banners,\n stages,\n tasks,\n tabContent: tabContentProp = [],\n\n // Utilities content and state props\n utilities,\n utilitiesSummaryItems,\n utilitiesExpanded: utilitiesExpandedProp = true,\n onToggleUtilities,\n\n // Etc...\n persistentUtility,\n intelligentGuidance,\n isPreview = false,\n ...restProps\n}: CaseViewProps) => {\n // General util hooks\n const t = useI18n();\n const direction = useDirection();\n\n // Element refs\n const caseViewRef = useRef<HTMLDivElement>(null);\n const summaryRef = useRef<HTMLDivElement>(null);\n\n // Tab content\n const [tabContentEl, setTabContentEl] = useElement<HTMLElement>(null);\n\n // Breakpoint booleans\n const mdOrAbove = useBreakpoint('md', { breakpointRef: caseViewRef });\n const lgOrAbove = useBreakpoint('lg', { breakpointRef: caseViewRef });\n const xlOrAbove = useBreakpoint('xl', { breakpointRef: caseViewRef });\n\n // DOM ids\n const summaryTabId = `summary-${caseId}`;\n const utilitiesTabId = `utilities-${caseId}`;\n const persistentUtilityTabId = `persistent-utility-${caseId}`;\n const summaryId = `summary-${caseId}`;\n const utilitiesId = `utilities-${caseId}`;\n const utilitiesDrawerId = `utilities-drawer-${caseId}`;\n\n // Summary state handling\n let summaryExpanded = !!summaryExpandedProp;\n if (persistentUtility) {\n summaryExpanded = xlOrAbove;\n }\n\n // Utilities state handling\n\n // Used in coordination with a layoutEffect below to determine the utilities state on initial render.\n // Attempted with a ref but it did not work. Using state and enforcing a render in addition to the change render for lgOrAbove seems to fix...\n const [obeyUtilitiesExpandedProp, setObeyUtilitiesExpandedProp] = useState(lgOrAbove);\n\n // Allow the utilitiesExpandedProp to drive the utilities' state after the initial render\n useLayoutEffect(() => {\n if (lgOrAbove) setObeyUtilitiesExpandedProp(true);\n }, [lgOrAbove]);\n\n // Tracks whether a resize forced the onToggleUtilities to close the utilities when it's a drawer\n const utilitiesToggledByResize = useRef(false);\n\n // If the initial render is within the MD size, where the utility drawer renders, it must begin collapsed\n const utilitiesExpanded = obeyUtilitiesExpandedProp ? utilitiesExpandedProp : false;\n\n // Handles utilities state based on breakpoint changes.\n useAfterInitialEffect(() => {\n // If we change into the MD breakpoint range and the utilities state is expanded call the toggle prop to collapse it with controlled state\n if (mdOrAbove && !lgOrAbove && utilitiesExpandedProp) {\n onToggleUtilities?.();\n utilitiesToggledByResize.current = true;\n }\n\n if (lgOrAbove) {\n if (utilitiesToggledByResize.current && !utilitiesExpandedProp) {\n onToggleUtilities?.();\n }\n\n utilitiesToggledByResize.current = false;\n }\n // Purposely not listing utilitiesExpanded as a dependency as it is not a trigger and will be captured when BPs change\n }, [mdOrAbove, lgOrAbove]);\n\n // Generate the tab items based on props and viewport conditions\n const tabItems: TabsProps['tabs'] = useMemo(() => {\n const summaryTab = { id: summaryTabId, name: 'Summary' };\n if (mdOrAbove) {\n return !summaryExpanded || (persistentUtility && !xlOrAbove)\n ? [summaryTab, ...tabItemsProp]\n : tabItemsProp;\n }\n const utilityTabs = [];\n if (utilities) utilityTabs.push({ id: utilitiesTabId, name: 'Utilities' });\n if (persistentUtility && !mdOrAbove) {\n utilityTabs.push({ id: persistentUtilityTabId, name: persistentUtility.title });\n }\n\n return [summaryTab, ...tabItemsProp, ...utilityTabs];\n }, [\n mdOrAbove,\n xlOrAbove,\n summaryTabId,\n utilitiesTabId,\n persistentUtilityTabId,\n utilities,\n persistentUtility,\n tabItemsProp,\n summaryExpanded\n ]);\n\n // Setup tab content\n const tabContent = useMemo(() => {\n const summaryTabContent = { id: summaryTabId, content: <Card>{summary}</Card> };\n\n if (mdOrAbove) {\n return !summaryExpanded || (persistentUtility && !xlOrAbove)\n ? [summaryTabContent, ...tabContentProp]\n : tabContentProp;\n }\n\n const utilityTabs = [];\n\n if (utilities) {\n utilityTabs.push({\n id: utilitiesTabId,\n content: <Flex container={{ direction: 'column', gap: 2 }}>{utilities}</Flex>\n });\n }\n\n if (persistentUtility) {\n utilityTabs.push({ id: persistentUtilityTabId, content: persistentUtility?.content });\n }\n\n return [summaryTabContent, ...tabContentProp, ...utilityTabs];\n }, [\n summaryTabId,\n summary,\n mdOrAbove,\n summaryExpanded,\n persistentUtility,\n xlOrAbove,\n tabContentProp,\n utilities,\n utilitiesTabId,\n persistentUtilityTabId\n ]);\n\n // Grid layout props\n let caseViewGridContainer = {\n cols: 'minmax(0, 1fr)',\n colGap: 0,\n rows: 'minmax(0, max-content) auto',\n areas: `\n \"summary\"\n \"work-area\"\n `\n };\n\n const sharedGridProps = {\n colGap: 2,\n rows: caseViewGridContainer.rows\n };\n\n if (persistentUtility) {\n if (xlOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, max-content) minmax(0, 1fr) repeat(2, minmax(0, max-content))',\n areas: '\"summary work-area persistentUtility utilities\"'\n };\n } else if (mdOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, 1fr) repeat(2, minmax(0, max-content))',\n areas: `\n \"summary summary summary\"\n \"work-area persistentUtility utilities\"\n `\n };\n }\n } else if (summaryExpanded) {\n if (mdOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content)',\n areas: '\"summary work-area utilities\"'\n };\n }\n } else if (mdOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, 1fr) minmax(0, max-content)',\n areas: `\n \"summary summary\"\n \"work-area utilities\"\n `\n };\n }\n\n // Apply sticky columns\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n const stickOffset = useMemo(() => {\n if (windowIsAvailable && caseViewRef.current) {\n return parseFloat(\n window.getComputedStyle(caseViewRef.current).getPropertyValue('--appshell-offset')\n );\n }\n\n return 0;\n }, [caseViewRef.current]);\n\n useScrollStick(\n // isMediumOrAbove means side by side columns | | |\n mdOrAbove ? { ...scrollStickOptions.current, offset: stickOffset } : undefined\n );\n\n useEffect(() => {\n if (\n mdOrAbove &&\n summaryExpanded &&\n !persistentUtility &&\n (currentTabId === summaryTabId || currentTabId === utilitiesTabId)\n ) {\n onTabClick(tabItemsProp[0]?.id);\n }\n }, [mdOrAbove, summaryExpanded]);\n\n useEffect(() => {\n if (persistentUtility && currentTabId === persistentUtilityTabId) onTabClick(summaryTabId);\n }, [persistentUtility]);\n\n // Handles scrolling to tab content for newly clicked tab\n useEffect(() => {\n if (!tabContentEl) return;\n const scrollPos = window.scrollY;\n const windowHeight = document.documentElement.clientHeight;\n const bottomPos = scrollPos + windowHeight * 0.8;\n const tabContentPos = tabContentEl.offsetTop;\n if (tabContentPos > bottomPos) {\n const top = tabContentPos - windowHeight * 0.2;\n window.scrollTo({ top, behavior: 'smooth' });\n }\n }, [currentTabId]);\n\n // We need a css variable for the height of the case summary when it is collapsed into a header like layout\n useLayoutEffect(() => {\n if (!caseViewRef.current || !summaryRef.current) return;\n\n caseViewRef.current.style.setProperty(\n '--summary-height',\n `${!summaryExpanded ? summaryRef.current.offsetHeight : 0}px`\n );\n }, [summaryExpanded]);\n\n // CaseView context value\n // Choosing not to memo for now due to extent of deps and how often they change. Optimize as needed.\n const ctxValue: CaseViewContextValue = {\n caseId,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n followed,\n onFollowedChange,\n actions,\n promotedActions,\n onEdit,\n summary,\n tabs: {\n items: tabItems,\n onClick: onTabClick,\n currentTabId\n },\n persistentUtility,\n intelligentGuidance,\n summaryId,\n summaryExpanded,\n utilitiesExpanded,\n onToggleSummary,\n isPreview,\n aboveMD: mdOrAbove,\n aboveLG: lgOrAbove,\n aboveXL: xlOrAbove\n };\n\n // Here we go...\n return (\n <>\n <CaseViewContext.Provider value={ctxValue}>\n {/* Root element */}\n <Grid\n as={StyledCaseView}\n ref={caseViewRef}\n container={caseViewGridContainer}\n item={{ area: 'case-view' }}\n {...restProps}\n >\n {/* Summary */}\n <Grid\n // Used for aria-controls on the toggle button\n id={summaryId}\n as={StyledSummary}\n item={{ area: 'summary' }}\n desktop={mdOrAbove && (!persistentUtility || xlOrAbove) && !summaryExpanded}\n isLargeOrAbove={lgOrAbove}\n ref={summaryRef}\n >\n <CaseSummary />\n </Grid>\n\n {/* Work area */}\n <Flex\n container={{\n direction: 'column',\n alignContent: 'start',\n rowGap: 2\n }}\n as={StyledWorkArea}\n persistentUtility={Boolean(persistentUtility)}\n >\n {banners && <div>{banners}</div>}\n {stages && <div>{stages}</div>}\n {tasks && <div>{tasks}</div>}\n\n {(!mdOrAbove || (persistentUtility && !xlOrAbove) || !summaryExpanded) && (\n <Tabs tabs={tabItems} onTabClick={onTabClick} currentTabId={currentTabId} />\n )}\n\n <div ref={setTabContentEl}>\n {tabContent?.map(({ id, content }) => (\n <TabPanel currentTabId={currentTabId} tabId={id} key={id}>\n {content}\n </TabPanel>\n ))}\n </div>\n </Flex>\n\n {/* Persistent utility column */}\n {persistentUtility && mdOrAbove && (\n <Grid as={StyledPersistentUtility} item={{ area: 'persistentUtility' }}>\n {persistentUtility.content}\n </Grid>\n )}\n\n {/* Utility drawer */}\n {utilities && mdOrAbove && !lgOrAbove && utilitiesExpanded && (\n <Drawer\n as={StyledCaseDrawer}\n open={utilitiesExpanded}\n position='fixed'\n placement={direction.end}\n shadow\n nullWhenClosed\n hasPersistentUtility={!!persistentUtility}\n >\n <Flex\n as={StyledCaseDrawerContent}\n container={{ direction: 'column', gap: 2 }}\n id={utilitiesDrawerId}\n >\n <Flex container={{ justify: 'end' }}>\n <Button\n aria-expanded={utilitiesExpanded ? 'true' : 'false'}\n aria-controls={utilitiesDrawerId}\n variant='simple'\n icon\n onClick={onToggleUtilities}\n as={StyledUtilToggle}\n label={t('collapse_utilities_panel')}\n >\n <Icon name={`move-${direction.end}-solid`} />\n </Button>\n </Flex>\n {utilities}\n </Flex>\n </Drawer>\n )}\n\n {/* Utilities */}\n {utilities && mdOrAbove && (\n <Grid\n ref={(el: HTMLDivElement) => {\n if (el) (scrollStickOptions.current?.elements).push(el);\n }}\n as={StyledUtilities}\n container={{\n cols: 'minmax(0, 1fr)',\n rowGap: 2,\n pad: [2, 0, 2]\n }}\n item={{\n area: 'utilities'\n }}\n >\n <Flex container={{ justify: utilitiesExpanded ? 'end' : 'center' }}>\n <Button\n aria-expanded={utilitiesExpanded ? 'true' : 'false'}\n aria-controls={lgOrAbove ? utilitiesId : utilitiesDrawerId}\n variant='simple'\n icon\n onClick={() => {\n if (!obeyUtilitiesExpandedProp && utilitiesExpandedProp) {\n setObeyUtilitiesExpandedProp(true);\n } else {\n onToggleUtilities?.();\n }\n }}\n as={StyledUtilToggle}\n label={t(\n utilitiesExpanded ? 'collapse_utilities_panel' : 'expand_utilities_panel'\n )}\n >\n <Icon\n name={`move-${utilitiesExpanded ? direction.end : direction.start}-solid`}\n />\n </Button>\n </Flex>\n\n {lgOrAbove && utilitiesExpanded && (\n <Flex container={{ direction: 'column', gap: 2 }} id={utilitiesId}>\n {utilities}\n </Flex>\n )}\n\n {(!utilitiesExpanded || (mdOrAbove && !lgOrAbove)) && (\n <UtilitiesSummary\n items={utilitiesSummaryItems}\n onClick={onToggleUtilities}\n aria-expanded={utilitiesExpanded ? 'true' : 'false'}\n aria-controls={lgOrAbove ? utilitiesId : utilitiesDrawerId}\n />\n )}\n </Grid>\n )}\n </Grid>\n </CaseViewContext.Provider>\n {intelligentGuidance}\n </>\n );\n};\n\nexport default CaseView;\n"]}
|
|
1
|
+
{"version":3,"file":"CaseView.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElF,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,UAAU,EAEV,IAAI,EACJ,MAAM,EACN,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB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AAC;4BACxD,CAAC,EACD,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,MAAM,EAAE,CAAC;6BACV,EACD,IAAI,EAAE;gCACJ,IAAI,EAAE,WAAW;6BAClB,qBACgB,SAAS,IAAI,CAAC,iBAAiB,IAAI,SAAS,gBACjD,CAAC,CAAC,iBAAiB,CAAC,aAEhC,MAAC,IAAI,IACH,SAAS,EAAE;wCACT,UAAU,EAAE,QAAQ;wCACpB,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;qCAClD,aAEA,gBAAgB,EAChB,qBAAqB,IACjB,EAEN,iBAAiB,IAAI,SAAS,IAAI,SAAS,EAE3C,CAAC,CAAC,iBAAiB,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CACpD,KAAC,gBAAgB,IAAC,KAAK,EAAE,qBAAqB,GAAI,CACnD,IACI,CACR,IACI,GACkB,EAC1B,mBAAmB,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { FC, useEffect, useMemo, useRef, useLayoutEffect, useState } from 'react';\n\nimport {\n Flex,\n Grid,\n Icon,\n registerIcon,\n TabPanel,\n useBreakpoint,\n useScrollStick,\n useElement,\n ForwardProps,\n Card,\n Drawer,\n useI18n,\n useDirection,\n Tabs,\n useAfterInitialEffect,\n windowIsAvailable,\n focusHeadingOrContainer,\n useConfiguration,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport { ScrollStickOptions } from '@pega/cosmos-react-core/lib/hooks/useScrollStick';\nimport * as moveRightSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-right-solid.icon';\nimport * as moveLeftSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-left-solid.icon';\n\nimport CaseSummary from './CaseSummary';\nimport UtilitiesSummary from './UtilitiesSummary';\nimport {\n StyledCaseDrawer,\n StyledCaseDrawerContent,\n StyledCaseView,\n StyledWorkArea,\n StyledPersistentUtility,\n StyledSummary,\n StyledSummaryTabContent,\n StyledUtilities,\n StyledExpandCollapseUtilitiesButton,\n StyledUtilitiesHeading\n} from './CaseView.styles';\nimport { CaseViewContextValue, CaseViewProps } from './CaseView.types';\nimport CaseViewContext from './CaseView.context';\nimport CaseSummaryFields from './CaseSummaryFields';\nimport { getCaseViewTestIds } from './CaseView.test-ids';\n\nregisterIcon(moveRightSolidIcon, moveLeftSolidIcon);\n\n// This function is responsible for auto sizing table height in case tab panels.\nconst resizeTable = (tabPanelEl: HTMLDivElement, workAreaEl: HTMLDivElement) => {\n tabPanelEl.style.removeProperty('--content-height-in-view');\n\n // .rs-wrapper is currently the class used by the table component which needs to be targeted.\n const tables = Array.from(tabPanelEl.querySelectorAll('.rs-wrapper')).filter(\n table => table.getBoundingClientRect().width !== 0\n );\n\n // Only perform this logic when there is a single table in a tab's panel.\n if (tables.length !== 1) return;\n\n // This selector finds the table's root element as they are always wrapped in a Card.\n const table = tables[0].closest('article');\n\n if (!table) return;\n\n const tabPanelRect = tabPanelEl.getBoundingClientRect();\n const tableRect = table.getBoundingClientRect();\n const vpHeight = document.documentElement.clientHeight;\n const tableRectOffsetTop = tableRect.top + window.scrollY;\n const workAreaPaddingBlockEnd =\n // px unit are required for proper CSS calc calculation.\n window.getComputedStyle(workAreaEl).getPropertyValue('padding-block-end') || '0px';\n\n // Accounts for content rendered after the table.\n const tableBottomToTabPanelBottom = tabPanelRect.bottom - tableRect.bottom;\n\n // Sets a CSS variable for available height based on screen size and view state.\n // Defines an available minimum height of ~600px.\n tabPanelEl.style.setProperty(\n '--content-height-in-view',\n `max(calc(${\n vpHeight - tableRectOffsetTop - tableBottomToTabPanelBottom\n }px - ${workAreaPaddingBlockEnd}), 37.5rem)`\n );\n};\n\nconst CaseView: FC<CaseViewProps & ForwardProps> = ({\n testId,\n\n // Case data mostly visually related to the case header\n caseId,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n followed,\n onFollowedChange,\n onEdit,\n actions,\n promotedActions,\n\n // Summary content and state props\n summaryFields,\n summaryExpanded: summaryExpandedProp = true,\n onToggleSummary,\n\n // Case tabs\n tabs: { currentTabId, items: tabItemsProp, onClick: onTabClick },\n\n // Workarea related content props\n banners,\n stages,\n tasks,\n tabContent: tabContentProp = [],\n\n // Utilities content and state props\n utilities,\n utilitiesSummaryItems,\n utilitiesExpanded: utilitiesExpandedProp = true,\n onToggleUtilities,\n\n // Etc...\n persistentUtility,\n intelligentGuidance,\n isPreview = false,\n ...restProps\n}: CaseViewProps) => {\n const testIds = useTestIds(testId, getCaseViewTestIds);\n\n // General util hooks\n const t = useI18n();\n const direction = useDirection();\n const { loadedRef } = useConfiguration();\n\n // Element refs\n const caseViewRef = useRef<HTMLDivElement>(null);\n const summaryRef = useRef<HTMLDivElement>(null);\n // undefined used to allow ref to be mutable. Element set below in ref callback for scroll stick.\n const workAreaRef = useRef<HTMLDivElement | undefined>();\n\n // Tab content\n const [tabContentEl, setTabContentEl] = useElement<HTMLElement>(null);\n\n // Breakpoint booleans\n const smOrAbove = useBreakpoint('sm');\n const mdOrAbove = useBreakpoint('md', { breakpointRef: caseViewRef });\n const lgOrAbove = useBreakpoint('lg', { breakpointRef: caseViewRef });\n const xlOrAbove = useBreakpoint('xl', { breakpointRef: caseViewRef });\n\n // DOM ids\n const initialTabId = tabItemsProp[0]?.id;\n const summaryTabId = `summary-${caseId}`;\n const utilitiesTabId = `utilities-${caseId}`;\n const persistentUtilityTabId = `persistent-utility-${caseId}`;\n\n // Summary state handling\n let summaryExpanded = !isPreview && !!summaryExpandedProp;\n\n if (persistentUtility) {\n summaryExpanded = xlOrAbove;\n }\n\n // Focus heading on initial mount\n useEffect(() => {\n if (!caseViewRef.current) return;\n\n if (loadedRef.current) {\n focusHeadingOrContainer(caseViewRef.current, heading);\n } else {\n loadedRef.current = true;\n }\n }, [caseId]);\n\n // Utilities state handling\n\n // Used in coordination with a layoutEffect below to determine the utilities state on initial render.\n // Attempted with a ref but it did not work. Using state and enforcing a render in addition to the change render for lgOrAbove seems to fix...\n const [obeyUtilitiesExpandedProp, setObeyUtilitiesExpandedProp] = useState(lgOrAbove);\n\n // Allow the utilitiesExpandedProp to drive the utilities' state after the initial render\n useLayoutEffect(() => {\n if (lgOrAbove) setObeyUtilitiesExpandedProp(true);\n }, [lgOrAbove]);\n\n // Tracks whether a resize forced the onToggleUtilities to close the utilities when it's a drawer\n const utilitiesToggledByResize = useRef(false);\n\n // If the initial render is within the MD size, where the utility drawer renders, it must begin collapsed\n const utilitiesExpanded = obeyUtilitiesExpandedProp ? utilitiesExpandedProp : false;\n\n // Handles utilities state based on breakpoint changes.\n useAfterInitialEffect(() => {\n // If we change into the MD breakpoint range and the utilities state is expanded call the toggle prop to collapse it with controlled state\n if (mdOrAbove && !lgOrAbove && utilitiesExpandedProp) {\n onToggleUtilities?.();\n utilitiesToggledByResize.current = true;\n }\n\n if (lgOrAbove) {\n if (utilitiesToggledByResize.current && !utilitiesExpandedProp) {\n onToggleUtilities?.();\n }\n\n utilitiesToggledByResize.current = false;\n }\n // Purposely not listing utilitiesExpanded as a dependency as it is not a trigger and will be captured when BPs change\n }, [mdOrAbove, lgOrAbove]);\n\n // Prepare tabs\n const [tabItems, tabContent] = useMemo(() => {\n const summaryTab = { id: summaryTabId, name: t('summary') };\n const summaryTabContent = {\n id: summaryTabId,\n content: (\n <Card>\n <StyledSummaryTabContent>\n <CaseSummaryFields {...summaryFields} />\n </StyledSummaryTabContent>\n </Card>\n )\n };\n\n let items = tabItemsProp;\n let content = tabContentProp;\n\n if (mdOrAbove) {\n if (!summaryExpanded || (persistentUtility && !xlOrAbove)) {\n items = [summaryTab, ...tabItemsProp];\n content = [summaryTabContent, ...tabContentProp];\n }\n\n return [items, content];\n }\n\n const utilityTabsItems = [];\n const utilityTabsContent = [];\n\n if (utilities) {\n utilityTabsItems.push({ id: utilitiesTabId, name: t('utilities') });\n utilityTabsContent.push({\n id: utilitiesTabId,\n content: <Flex container={{ direction: 'column', gap: 2 }}>{utilities}</Flex>\n });\n }\n\n if (persistentUtility) {\n utilityTabsItems.push({ id: persistentUtilityTabId, name: persistentUtility.title });\n utilityTabsContent.push({ id: persistentUtilityTabId, content: persistentUtility?.content });\n }\n\n items = [summaryTab, ...tabItemsProp, ...utilityTabsItems];\n content = [summaryTabContent, ...tabContentProp, ...utilityTabsContent];\n\n return [items, content];\n }, [\n tabItemsProp,\n summaryTabId,\n mdOrAbove,\n summaryExpanded,\n persistentUtility,\n xlOrAbove,\n tabContentProp,\n utilities,\n utilitiesTabId,\n persistentUtilityTabId\n ]);\n\n // Grid layout props\n let caseViewGridContainer = {\n cols: 'minmax(0, 1fr)',\n colGap: 0,\n rows: 'minmax(0, max-content) auto',\n areas: `\n \"summary\"\n \"work-area\"\n `\n };\n\n const sharedGridProps = {\n colGap: 2,\n rows: caseViewGridContainer.rows\n };\n\n if (persistentUtility) {\n if (xlOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, max-content) minmax(0, 1fr) repeat(2, minmax(0, max-content))',\n areas: '\"summary work-area persistentUtility utilities\"'\n };\n } else if (mdOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, 1fr) repeat(2, minmax(0, max-content))',\n areas: `\n \"summary summary summary\"\n \"work-area persistentUtility utilities\"\n `\n };\n }\n } else if (summaryExpanded) {\n if (mdOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content)',\n areas: '\"summary work-area utilities\"'\n };\n }\n } else if (mdOrAbove) {\n caseViewGridContainer = {\n ...sharedGridProps,\n cols: 'minmax(0, 1fr) minmax(0, max-content)',\n areas: `\n \"summary summary\"\n \"work-area utilities\"\n `\n };\n }\n\n // Apply sticky columns\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n const stickOffset = useMemo(() => {\n if (windowIsAvailable && caseViewRef.current) {\n return parseFloat(\n window.getComputedStyle(caseViewRef.current).getPropertyValue('--appshell-offset')\n );\n }\n\n return 0;\n }, [caseViewRef.current]);\n\n useScrollStick(\n // isMediumOrAbove means side by side columns | | |\n mdOrAbove ? { ...scrollStickOptions.current, offset: stickOffset } : undefined\n );\n\n // Preview set summary tab active\n useEffect(() => {\n if (isPreview) {\n onTabClick(summaryTabId);\n }\n }, []);\n\n // Initial tab selection\n useEffect(() => {\n if (\n mdOrAbove &&\n summaryExpanded &&\n !persistentUtility &&\n (currentTabId === summaryTabId || currentTabId === utilitiesTabId)\n ) {\n onTabClick(tabItemsProp[0]?.id);\n }\n // Toggle utilities tab selection\n if (mdOrAbove && [utilitiesTabId, persistentUtilityTabId].includes(currentTabId)) {\n onTabClick(initialTabId);\n }\n }, [mdOrAbove]);\n\n // Initial / summary tab selection\n useEffect(() => {\n if (!smOrAbove && currentTabId === initialTabId) {\n onTabClick(summaryTabId);\n } else if (smOrAbove && currentTabId === summaryTabId) {\n onTabClick(initialTabId);\n }\n }, [smOrAbove]);\n\n // Summary tab selection\n useEffect(() => {\n if (isPreview) {\n onTabClick(summaryTabId);\n }\n }, [isPreview]);\n\n // Initial tab selection\n useEffect(() => {\n if (summaryExpanded && currentTabId === summaryTabId) {\n onTabClick(initialTabId);\n }\n }, [summaryExpanded]);\n\n // Handles scrolling to tab content for newly clicked tab\n useEffect(() => {\n if (!tabContentEl) return;\n const scrollPos = window.scrollY;\n const windowHeight = document.documentElement.clientHeight;\n const bottomPos = scrollPos + windowHeight * 0.8;\n const tabContentPos = tabContentEl.offsetTop;\n if (tabContentPos > bottomPos) {\n const top = tabContentPos - windowHeight * 0.2;\n window.scrollTo({ top, behavior: 'smooth' });\n }\n }, [currentTabId]);\n\n // We need a css variable for the height of the case summary when it is collapsed into a header like layout\n useLayoutEffect(() => {\n if (!caseViewRef.current || !summaryRef.current) return;\n\n caseViewRef.current.style.setProperty(\n '--summary-height',\n `${!summaryExpanded ? summaryRef.current.offsetHeight : 0}px`\n );\n }, [summaryExpanded]);\n\n // CaseView context value\n // Choosing not to memo for now due to extent of deps and how often they change. Optimize as needed.\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const ctxValue: CaseViewContextValue = {\n testIds,\n caseId,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n followed,\n onFollowedChange,\n actions,\n promotedActions,\n onEdit,\n summaryFields,\n tabs: {\n items: tabItems,\n onClick: onTabClick,\n currentTabId\n },\n stages,\n tasks,\n persistentUtility,\n intelligentGuidance,\n summaryExpanded,\n utilitiesExpanded,\n onToggleSummary,\n isPreview,\n aboveSM: smOrAbove,\n aboveMD: mdOrAbove,\n aboveLG: lgOrAbove,\n aboveXL: xlOrAbove\n };\n\n const currentTabPanelRef = useRef<HTMLDivElement>(null);\n\n // The following effects are dedicated to resizeTable handling.\n useLayoutEffect(() => {\n if (!currentTabPanelRef.current || !workAreaRef.current) return;\n\n const currentTabPanelEl = currentTabPanelRef.current;\n const workAreaEl = workAreaRef.current;\n\n resizeTable(currentTabPanelEl, workAreaEl);\n\n const onTabChange = () => {\n resizeTable(currentTabPanelEl, workAreaEl);\n };\n\n // TODO: optimize\n const mo = new MutationObserver(() => {\n resizeTable(currentTabPanelEl, workAreaEl);\n });\n\n mo.observe(currentTabPanelEl, { childList: true, subtree: true });\n\n currentTabPanelEl.addEventListener('cosmos-tab-changed', onTabChange);\n\n return () => {\n mo.disconnect();\n currentTabPanelEl.removeEventListener('cosmos-tab-changed', onTabChange);\n };\n });\n\n const [bannersStagesTasksEl, setBannersStagesTasksEl] = useElement<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!bannersStagesTasksEl) return;\n\n const observer = new ResizeObserver(() => {\n if (!currentTabPanelRef.current || !workAreaRef.current) return;\n\n resizeTable(currentTabPanelRef.current, workAreaRef.current);\n });\n\n observer.observe(bannersStagesTasksEl);\n\n return () => {\n observer.disconnect();\n };\n }, [bannersStagesTasksEl]);\n\n useEffect(() => {\n const onResize = () => {\n if (!currentTabPanelRef.current || !workAreaRef.current) return;\n\n resizeTable(currentTabPanelRef.current, workAreaRef.current);\n };\n\n window.addEventListener('resize', onResize);\n\n return () => {\n window.removeEventListener('resize', onResize);\n };\n }, []);\n\n const utilitiesHeading = (\n <StyledUtilitiesHeading variant='h2'>{t('utilities')}</StyledUtilitiesHeading>\n );\n\n const utilitiesToggleButton = (\n <StyledExpandCollapseUtilitiesButton\n compact\n icon\n label={t(utilitiesExpanded ? 'collapse' : 'expand')}\n aria-label={t(utilitiesExpanded ? 'collapse_utilities_panel' : 'expand_utilities_panel')}\n onClick={() => {\n if (!obeyUtilitiesExpandedProp && utilitiesExpandedProp) {\n setObeyUtilitiesExpandedProp(true);\n } else {\n onToggleUtilities?.();\n }\n }}\n >\n <Icon name='arrow-micro-left' />\n </StyledExpandCollapseUtilitiesButton>\n );\n\n // Here we go...\n return (\n <>\n <CaseViewContext.Provider value={ctxValue}>\n {/* Root element */}\n <Grid\n data-testid={testIds.root}\n {...restProps}\n as={StyledCaseView}\n ref={caseViewRef}\n container={caseViewGridContainer}\n item={{ area: 'case-view' }}\n >\n {/* Summary */}\n <Grid\n as={StyledSummary}\n item={{ area: 'summary' }}\n desktop={mdOrAbove && (!persistentUtility || xlOrAbove) && !summaryExpanded}\n isLargeOrAbove={lgOrAbove}\n ref={summaryRef}\n >\n <CaseSummary />\n </Grid>\n\n {/* Work area */}\n <Flex\n container={{\n direction: 'column',\n alignContent: 'start',\n rowGap: 2\n }}\n as={StyledWorkArea}\n persistentUtility={Boolean(persistentUtility)}\n ref={(el: HTMLDivElement) => {\n workAreaRef.current = el;\n if (el) scrollStickOptions.current?.elements.push(el);\n }}\n >\n {(banners || stages || tasks) && (\n <Flex\n container={{\n direction: 'column',\n alignContent: 'start',\n rowGap: 2\n }}\n ref={setBannersStagesTasksEl}\n >\n {banners && <div data-testid={testIds.banners}>{banners}</div>}\n {stages && <div data-testid={testIds.stages}>{stages}</div>}\n {tasks && <div data-testid={testIds.tasks}>{tasks}</div>}\n </Flex>\n )}\n\n {(!mdOrAbove || (persistentUtility && !xlOrAbove) || !summaryExpanded) && (\n <Tabs\n data-testid={testIds.tabs}\n tabs={tabItems}\n onTabClick={onTabClick}\n currentTabId={currentTabId}\n />\n )}\n\n <div ref={setTabContentEl}>\n {tabContent?.map(({ id, content }) => (\n <TabPanel\n data-testid={currentTabId === id ? testIds.tabContent : undefined}\n currentTabId={currentTabId}\n tabId={id}\n key={id}\n ref={currentTabId === id ? currentTabPanelRef : undefined}\n >\n {content}\n </TabPanel>\n ))}\n </div>\n </Flex>\n\n {/* Persistent utility column */}\n {persistentUtility && mdOrAbove && (\n <Grid as={StyledPersistentUtility} item={{ area: 'persistentUtility' }} data-app-region>\n {persistentUtility.content}\n </Grid>\n )}\n\n {/* Utility drawer */}\n {utilities && mdOrAbove && !lgOrAbove && utilitiesExpanded && (\n <Drawer\n as={StyledCaseDrawer}\n open={utilitiesExpanded}\n position='fixed'\n placement={direction.end}\n shadow\n nullWhenClosed\n hasPersistentUtility={!!persistentUtility}\n >\n <Flex\n as={StyledCaseDrawerContent}\n container={{ direction: 'column', gap: 2 }}\n data-app-region\n >\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {utilitiesHeading}\n {utilitiesToggleButton}\n </Flex>\n\n {utilities}\n </Flex>\n </Drawer>\n )}\n\n {/* Utilities */}\n {utilities && mdOrAbove && (\n <Grid\n data-testid={testIds.utilities}\n ref={(el: HTMLDivElement) => {\n if (el) scrollStickOptions.current?.elements.push(el);\n }}\n as={StyledUtilities}\n container={{\n cols: 'minmax(0, 1fr)',\n rowGap: 2\n }}\n item={{\n area: 'utilities'\n }}\n data-app-region={lgOrAbove || !utilitiesExpanded || undefined}\n aria-label={t('utilities_label')}\n >\n <Flex\n container={{\n alignItems: 'center',\n justify: utilitiesExpanded ? 'between' : 'center'\n }}\n >\n {utilitiesHeading}\n {utilitiesToggleButton}\n </Flex>\n\n {utilitiesExpanded && lgOrAbove && utilities}\n\n {(!utilitiesExpanded || (mdOrAbove && !lgOrAbove)) && (\n <UtilitiesSummary items={utilitiesSummaryItems} />\n )}\n </Grid>\n )}\n </Grid>\n </CaseViewContext.Provider>\n {intelligentGuidance}\n </>\n );\n};\n\nexport default withTestIds(CaseView, getCaseViewTestIds);\n"]}
|
|
@@ -1,20 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export declare const
|
|
1
|
+
import { DefaultTheme } from 'styled-components';
|
|
2
|
+
export declare const StyledCaseSummaryFields: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
3
|
+
export declare const StyledSummaryPrimaryList: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").FieldValueListProps & import("@pega/cosmos-react-core").ForwardProps> & {
|
|
4
|
+
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
5
|
+
}, DefaultTheme, {
|
|
6
|
+
wrapped?: boolean | undefined;
|
|
7
|
+
}, never>;
|
|
8
|
+
export declare const StyledSummarySecondaryList: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").FieldValueListProps & import("@pega/cosmos-react-core").ForwardProps> & {
|
|
9
|
+
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
10
|
+
}, DefaultTheme, {}, never>;
|
|
11
|
+
export declare const StyledSummaryTabContent: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardContentProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
12
|
+
export declare const StyledCaseHeader: import("styled-components").StyledComponent<"header", DefaultTheme, {}, never>;
|
|
13
|
+
export declare const StyledCaseIconWrap: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
14
|
+
export declare const StyledFollowIconWrap: import("styled-components").StyledComponent<"label", DefaultTheme, {}, never>;
|
|
15
|
+
export declare const StyledSubheading: import("styled-components").StyledComponent<"p", DefaultTheme, {}, never>;
|
|
16
|
+
export declare const StyledHeaderActions: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
17
|
+
offsetEnd: boolean;
|
|
18
|
+
}, never>;
|
|
19
|
+
export declare const StyledCaseHeaderText: import("styled-components").StyledComponent<"hgroup", DefaultTheme, {}, never>;
|
|
20
|
+
export declare const StyledCaseHeaderPromotedAction: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
21
|
+
export declare const StyledHeaderSummaryBlock: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
22
|
+
hasItems: boolean;
|
|
23
|
+
}, never>;
|
|
24
|
+
export declare const StyledHeaderSummary: import("styled-components").StyledComponent<"dl", DefaultTheme, {}, never>;
|
|
25
|
+
export declare const StyledHeaderSummaryValue: import("styled-components").StyledComponent<"dd", DefaultTheme, {
|
|
26
|
+
bold?: boolean | undefined;
|
|
27
|
+
truncate?: boolean | undefined;
|
|
28
|
+
theme: DefaultTheme;
|
|
29
|
+
}, never>;
|
|
30
|
+
export declare const StyledCaseSummaryInfo: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
31
|
+
export declare const StyledCaseSummaryContainer: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
32
|
+
export declare const StyledExpandCollapseButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
33
|
+
export declare const StyledExpandCollapseSummaryButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
34
|
+
export declare const StyledCaseSummary: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
35
|
+
export declare const StyledWorkArea: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
36
|
+
export declare const StyledUtilitiesHeading: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
37
|
+
export declare const StyledExpandCollapseUtilitiesButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
38
|
+
export declare const StyledUtilities: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
39
|
+
export declare const StyledSummary: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
40
|
+
export declare const StyledCaseDrawer: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
41
|
+
export declare const StyledCaseDrawerContent: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
42
|
+
export declare const StyledPersistentUtility: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
43
|
+
export declare const ScrollStick: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
44
|
+
export declare const StyledCaseView: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
45
|
+
export declare const StyledUtilitiesHeader: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
|
|
20
46
|
//# sourceMappingURL=CaseView.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseView.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA6C9D,eAAO,MAAM,uBAAuB,6EAAe,CAAC;AAIpD,eAAO,MAAM,wBAAwB;;;;SAmBpC,CAAC;AAIF,eAAO,MAAM,0BAA0B;;2BAMrC,CAAC;AAEH,eAAO,MAAM,uBAAuB,8MAkBlC,CAAC;AAIH,eAAO,MAAM,gBAAgB,gFAmB3B,CAAC;AAIH,eAAO,MAAM,kBAAkB,6EAoB7B,CAAC;AAIH,eAAO,MAAM,oBAAoB,+EAShC,CAAC;AAIF,eAAO,MAAM,gBAAgB,2EAAa,CAAC;AAI3C,eAAO,MAAM,mBAAmB;eAA2B,OAAO;SAWhE,CAAC;AAIH,eAAO,MAAM,oBAAoB,gFAgD/B,CAAC;AAIH,eAAO,MAAM,8BAA8B,yMA8BzC,CAAC;AAIH,eAAO,MAAM,wBAAwB;cAA0B,OAAO;SAqBpE,CAAC;AAiCH,eAAO,MAAM,mBAAmB,4EA0C9B,CAAC;AAIH,eAAO,MAAM,wBAAwB;;;WACsC,YAAY;SAmCtF,CAAC;AAIF,eAAO,MAAM,qBAAqB,6EAYhC,CAAC;AAIH,eAAO,MAAM,0BAA0B,6EAIrC,CAAC;AAIH,eAAO,MAAM,0BAA0B,yMASrC,CAAC;AAIH,eAAO,MAAM,iCAAiC,yMA2C5C,CAAC;AAIH,eAAO,MAAM,iBAAiB,6EAY5B,CAAC;AAEH,eAAO,MAAM,cAAc,6EAwDzB,CAAC;AAIH,eAAO,MAAM,sBAAsB,uMAAiB,CAAC;AAErD,eAAO,MAAM,mCAAmC,yMAk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