@pega/cosmos-react-work 8.21.7 → 8.21.9
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/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +2 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +2 -2
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +3 -1
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +2 -2
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/package.json +3 -3
|
@@ -20,6 +20,8 @@ export interface AssignmentProps {
|
|
|
20
20
|
onAssigneeClick: (assigneeId: AssignmentProps['assigneeId'], e: MouseEvent<HTMLButtonElement>) => void;
|
|
21
21
|
/** Callback fired from the Go button */
|
|
22
22
|
onOpen?: (id: AssignmentProps['id'], e: MouseEvent<HTMLButtonElement>) => void;
|
|
23
|
+
/** Case identifier */
|
|
24
|
+
caseId?: string;
|
|
23
25
|
}
|
|
24
26
|
export interface ItemsProps extends NoChildrenProp {
|
|
25
27
|
/** An array of assignment details to be rendered as Assignment details */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalAssignments.types.d.ts","sourceRoot":"","sources":["../../../src/components/HierarchicalAssignments/HierarchicalAssignments.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,eAAe,EAAE,CACf,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,EACzC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAC7B,IAAI,CAAC;IACV,wCAAwC;IACxC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"HierarchicalAssignments.types.d.ts","sourceRoot":"","sources":["../../../src/components/HierarchicalAssignments/HierarchicalAssignments.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAA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CAAC,EAAE,CACR,CAAC,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,EACpD,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,KACpB,IAAI,CAAC;KACX,CAAC;CACH;AAED,MAAM,WAAW,2BACf,SAAQ,UAAU,CAAC,UAAU,EAAE,mBAAmB,CAAC,EACjD,UAAU;IACZ;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2DAA2D;IAC3D,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,iCAAiC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalAssignments.types.js","sourceRoot":"","sources":["../../../src/components/HierarchicalAssignments/HierarchicalAssignments.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, Ref } from 'react';\n\nimport type {\n LinkProps,\n NoChildrenProp,\n OmitStrict,\n StatusProps,\n TestIdProp\n} from '@pega/cosmos-react-core';\n\nimport type { TaskItemProps } from '../Tasks';\n\nexport interface AssignmentProps {\n /** Unique Id of the assignment */\n id: string;\n /** Assignment name shown in Assignment's description */\n name: string;\n /** Process Name for the assignment. */\n processName?: string;\n /** Service Level Agreement for the assignment. */\n sla?: string;\n /** Number to defined the Urgency of assignment */\n urgency: number;\n /** Assignee's Id, passed on callback of onAssigneeClick */\n assigneeId: string;\n /** Assignee's Name of the assignment */\n assigneeName: string;\n /** Callback fired when click of Assignee Name to show Glimpse component */\n onAssigneeClick: (\n assigneeId: AssignmentProps['assigneeId'],\n e: MouseEvent<HTMLButtonElement>\n ) => void;\n /** Callback fired from the Go button */\n onOpen?: (id: AssignmentProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport interface ItemsProps extends NoChildrenProp {\n /** An array of assignment details to be rendered as Assignment details */\n assignments?: AssignmentProps[];\n /** An array of child cases to be rendered as case details */\n childCases?: CaseListProps[];\n /** Callback on toggle of ExpandCollapseButton of each Case, with arguments current expanded state of toggler and case id */\n onToggleCollapsed?: (value: boolean, id: string) => void;\n}\nexport interface CaseListProps extends NoChildrenProp, ItemsProps {\n /** Name of the task group displayed in the list. */\n name: string;\n /** Unique Id of the childcase */\n id: string;\n /** status details for the case */\n status: {\n text: string;\n variant: StatusProps['variant'];\n };\n /** Meta details of link to navigate to the case */\n link: {\n onPreview: LinkProps['onPreview'];\n href: LinkProps['href'];\n target?: LinkProps['target'];\n onClick?: (\n e: MouseEvent<HTMLAnchorElement | HTMLButtonElement>,\n id: CaseListProps['id']\n ) => void;\n };\n}\n\nexport interface HierarchicalAssignmentProps\n extends OmitStrict<ItemsProps, 'onToggleCollapsed'>,\n TestIdProp {\n /**\n * Hierarchical Assignment widget's title\n * @default 'Assignment'\n */\n name?: string;\n /** Boolean refers to state of the progress in assignment widget */\n progress?: boolean;\n /** Task Content to be rendered on click of Go Action button */\n openItem?: TaskItemProps;\n /**\n * Boolean that refers the state of the ExpandButton.\n * @default false\n */\n collapsed?: boolean;\n /** Callback on toggle of Top level ExpandCollapseButton */\n onToggleCollapsed: (collapsed: boolean) => void;\n /** Ref placed on the element. */\n ref?: Ref<HTMLDivElement>;\n /** Boolean that refers the state of the Case expand */\n expandAllCases?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"HierarchicalAssignments.types.js","sourceRoot":"","sources":["../../../src/components/HierarchicalAssignments/HierarchicalAssignments.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, Ref } from 'react';\n\nimport type {\n LinkProps,\n NoChildrenProp,\n OmitStrict,\n StatusProps,\n TestIdProp\n} from '@pega/cosmos-react-core';\n\nimport type { TaskItemProps } from '../Tasks';\n\nexport interface AssignmentProps {\n /** Unique Id of the assignment */\n id: string;\n /** Assignment name shown in Assignment's description */\n name: string;\n /** Process Name for the assignment. */\n processName?: string;\n /** Service Level Agreement for the assignment. */\n sla?: string;\n /** Number to defined the Urgency of assignment */\n urgency: number;\n /** Assignee's Id, passed on callback of onAssigneeClick */\n assigneeId: string;\n /** Assignee's Name of the assignment */\n assigneeName: string;\n /** Callback fired when click of Assignee Name to show Glimpse component */\n onAssigneeClick: (\n assigneeId: AssignmentProps['assigneeId'],\n e: MouseEvent<HTMLButtonElement>\n ) => void;\n /** Callback fired from the Go button */\n onOpen?: (id: AssignmentProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n /** Case identifier */\n caseId?: string;\n}\n\nexport interface ItemsProps extends NoChildrenProp {\n /** An array of assignment details to be rendered as Assignment details */\n assignments?: AssignmentProps[];\n /** An array of child cases to be rendered as case details */\n childCases?: CaseListProps[];\n /** Callback on toggle of ExpandCollapseButton of each Case, with arguments current expanded state of toggler and case id */\n onToggleCollapsed?: (value: boolean, id: string) => void;\n}\nexport interface CaseListProps extends NoChildrenProp, ItemsProps {\n /** Name of the task group displayed in the list. */\n name: string;\n /** Unique Id of the childcase */\n id: string;\n /** status details for the case */\n status: {\n text: string;\n variant: StatusProps['variant'];\n };\n /** Meta details of link to navigate to the case */\n link: {\n onPreview: LinkProps['onPreview'];\n href: LinkProps['href'];\n target?: LinkProps['target'];\n onClick?: (\n e: MouseEvent<HTMLAnchorElement | HTMLButtonElement>,\n id: CaseListProps['id']\n ) => void;\n };\n}\n\nexport interface HierarchicalAssignmentProps\n extends OmitStrict<ItemsProps, 'onToggleCollapsed'>,\n TestIdProp {\n /**\n * Hierarchical Assignment widget's title\n * @default 'Assignment'\n */\n name?: string;\n /** Boolean refers to state of the progress in assignment widget */\n progress?: boolean;\n /** Task Content to be rendered on click of Go Action button */\n openItem?: TaskItemProps;\n /**\n * Boolean that refers the state of the ExpandButton.\n * @default false\n */\n collapsed?: boolean;\n /** Callback on toggle of Top level ExpandCollapseButton */\n onToggleCollapsed: (collapsed: boolean) => void;\n /** Ref placed on the element. */\n ref?: Ref<HTMLDivElement>;\n /** Boolean that refers the state of the Case expand */\n expandAllCases?: boolean;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ interface AssignmentItemProps extends AssignmentProps {
|
|
|
11
11
|
export declare const PauseTextNode: ({ children }: {
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
declare const _default: (({ name, processName, assigneeName, urgency, sla, depth, id, assigneeId, onOpen, onAssigneeClick, setSize, posInset }: AssignmentItemProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
14
|
+
declare const _default: (({ name, processName, assigneeName, urgency, sla, depth, id, assigneeId, onOpen, onAssigneeClick, caseId, setSize, posInset }: AssignmentItemProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
15
15
|
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["label", "assignee", "urgency", "action", "sla"]>;
|
|
16
16
|
};
|
|
17
17
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignmentItem.d.ts","sourceRoot":"","sources":["../../../../src/components/HierarchicalAssignments/nodeItems/AssignmentItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,SAAS,EAAc,MAAM,OAAO,CAAC;AAgC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAQxE,UAAU,mBAAoB,SAAQ,eAAe;IACnD,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAOlE,CAAC;
|
|
1
|
+
{"version":3,"file":"AssignmentItem.d.ts","sourceRoot":"","sources":["../../../../src/components/HierarchicalAssignments/nodeItems/AssignmentItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,SAAS,EAAc,MAAM,OAAO,CAAC;AAgC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAQxE,UAAU,mBAAoB,SAAQ,eAAe;IACnD,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAOlE,CAAC;wJAgBC,mBAAmB;;;AA0NtB,wBAAiE"}
|
|
@@ -17,7 +17,7 @@ const StyledVisuallyHiddenText = styled(VisuallyHiddenText) `
|
|
|
17
17
|
export const PauseTextNode = ({ children }) => {
|
|
18
18
|
return (_jsxs(_Fragment, { children: [children, _jsx(StyledHiddenText, { children: ", " })] }));
|
|
19
19
|
};
|
|
20
|
-
const AssignmentItem = ({ name, processName, assigneeName, urgency, sla, depth, id, assigneeId, onOpen, onAssigneeClick, setSize, posInset }) => {
|
|
20
|
+
const AssignmentItem = ({ name, processName, assigneeName, urgency, sla, depth, id, assigneeId, onOpen, onAssigneeClick, caseId, setSize, posInset }) => {
|
|
21
21
|
const { firstNodeId, focusedNodeId, lastNodeId, changeFocusHandler, caseIdExpandList, isMediumOrAbove, parentRef, nodeInternalFocus, setNodeInternalFocusHandler, reverseTabFlow } = useContext(AssignmentTreeContext);
|
|
22
22
|
const assignmentRef = useRef(null);
|
|
23
23
|
const firstLevelAssignment = depth === initialDepth;
|
|
@@ -110,7 +110,7 @@ const AssignmentItem = ({ name, processName, assigneeName, urgency, sla, depth,
|
|
|
110
110
|
})
|
|
111
111
|
])) : (_jsx(NoValue, {})) }) })),
|
|
112
112
|
_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'secondary', as: StyledLabelContainer, "data-testid": testIds.urgency, children: t('assignment_item_urgency') }), _jsx(Text, { variant: 'secondary', children: _jsx(PauseTextNode, { children: urgency }) })] })
|
|
113
|
-
] }) }), _jsx(Flex, { as: StyledActionContainer, container: { justify: 'end' }, isMediumOrAbove: isMediumOrAbove, children: onOpen && (_jsx(Button, { "data-testid": testIds.action, compact: true, variant: 'primary', onClick: (e) => onOpen(id, e), tabIndex: childElementsTabIndex, "aria-label": t('
|
|
113
|
+
] }) }), _jsx(Flex, { as: StyledActionContainer, container: { justify: 'end' }, isMediumOrAbove: isMediumOrAbove, children: onOpen && (_jsx(Button, { "data-testid": testIds.action, compact: true, variant: 'primary', onClick: (e) => onOpen(id, e), tabIndex: childElementsTabIndex, "aria-label": `${t('go')} - ${assignmentDetail}${caseId ? ` ${caseId}` : ''}`, children: t('go') })) })] }) }));
|
|
114
114
|
};
|
|
115
115
|
export default withTestIds(AssignmentItem, getAssignmentTestIds);
|
|
116
116
|
//# sourceMappingURL=AssignmentItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignmentItem.js","sourceRoot":"","sources":["../../../../src/components/HierarchicalAssignments/nodeItems/AssignmentItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,WAAW,EACX,UAAU,EACV,GAAG,EACH,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,OAAO,EACR,MAAM,yBAAyB,CAAC;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C,CAAC,CACF,KAAC,OAAO,KAAG,CACZ,GACa,GACX,CACR;4BACD,8BACE,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,EAAC,EAAE,EAAE,oBAAoB,iBAAe,OAAO,CAAC,OAAO,YAC7E,CAAC,CAAC,yBAAyB,CAAC,GACxB,EACP,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YACvB,KAAC,aAAa,cAAE,OAAO,GAAiB,GACnC,IACN;yBACJ,GACD,GACG,EACP,KAAC,IAAI,IACH,EAAE,EAAE,qBAAqB,EACzB,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAC7B,eAAe,EAAE,eAAe,YAE/B,MAAM,IAAI,CACT,KAAC,MAAM,mBACQ,OAAO,CAAC,MAAM,EAC3B,OAAO,QACP,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAC5D,QAAQ,EAAE,qBAAqB,gBACnB,CAAC,CAAC,mCAAmC,EAAE,CAAC,gBAAgB,CAAC,CAAC,YAErE,CAAC,CAAC,IAAI,CAAC,GACD,CACV,GACI,IACF,GACI,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { useRef, useContext, useCallback } from 'react';\nimport type { MouseEvent, KeyboardEvent, ReactNode, FocusEvent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Grid,\n Flex,\n Button,\n useI18n,\n withTestIds,\n useTestIds,\n cap,\n useDirection,\n Text,\n VisuallyHiddenText,\n useElement,\n Tooltip,\n formatDateTime,\n useConfiguration,\n parseToDate,\n NoValue\n} from '@pega/cosmos-react-core';\n\nimport {\n StyledAssignmentItem,\n StyledProcessContainer,\n StyledActionContainer,\n StyledAssigneeContainer,\n StyledLabelContainer,\n StyledNode,\n StyledAssigneeText,\n StyledAssignmentItemMetaList\n} from '../Assignments.styles';\nimport type { AssignmentProps } from '../HierarchicalAssignments.types';\nimport { getAssignmentTestIds } from '../HierarchicalAssignments.test-ids';\nimport AssignmentTreeContext from '../AssignmentContext';\nimport AssignmentDetails from '../AssignmentDetail';\nimport { restrictDepth, initialDepth } from '../helpers';\n\nimport useNodeFocus from './useNodeFocus';\n\ninterface AssignmentItemProps extends AssignmentProps {\n /** Property defines the node's level */\n depth: number;\n /** total the number of items in the current set of treeitems */\n setSize?: number;\n /** the position of the element within the whole set of treeitems */\n posInset?: number;\n}\n\nconst StyledHiddenText = styled(VisuallyHiddenText)`\n width: 0;\n`;\n\nconst StyledVisuallyHiddenText = styled(VisuallyHiddenText)`\n position: fixed;\n`;\n\nexport const PauseTextNode = ({ children }: { children: ReactNode }) => {\n return (\n <>\n {children}\n <StyledHiddenText>, </StyledHiddenText>\n </>\n );\n};\n\nconst AssignmentItem = ({\n name,\n processName,\n assigneeName,\n urgency,\n sla,\n depth,\n id,\n assigneeId,\n onOpen,\n onAssigneeClick,\n setSize,\n posInset\n}: AssignmentItemProps) => {\n const {\n firstNodeId,\n focusedNodeId,\n lastNodeId,\n changeFocusHandler,\n caseIdExpandList,\n isMediumOrAbove,\n parentRef,\n nodeInternalFocus,\n setNodeInternalFocusHandler,\n reverseTabFlow\n } = useContext(AssignmentTreeContext);\n const assignmentRef = useRef<HTMLLIElement>(null);\n const firstLevelAssignment = depth === initialDepth;\n const styledElementDepth = restrictDepth(depth);\n const childElementsTabIndex = nodeInternalFocus ? 0 : -1;\n\n const { parentNodeTabIndex, lastNode, escapeNodeHandler } = useNodeFocus(\n id,\n assignmentRef,\n parentRef,\n {\n firstNodeId,\n focusedNodeId,\n lastNodeId,\n nodeInternalFocus,\n reverseTabFlow\n }\n );\n\n const { start } = useDirection();\n\n const t = useI18n();\n const { locale } = useConfiguration();\n const [assigneeEl, setAssigneeElement] = useElement<HTMLElement>();\n const testIds = useTestIds('', getAssignmentTestIds);\n\n const navigationHandler = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) e.preventDefault();\n switch (e.key) {\n case 'ArrowUp':\n changeFocusHandler(id, 'up', caseIdExpandList);\n break;\n case 'ArrowDown':\n changeFocusHandler(id, 'down', caseIdExpandList);\n break;\n case `Arrow${cap(start)}`:\n if (!firstLevelAssignment) {\n changeFocusHandler(id, 'left', caseIdExpandList);\n }\n break;\n case 'Home':\n if (firstNodeId) changeFocusHandler(firstNodeId);\n break;\n case 'End':\n if (lastNodeId) changeFocusHandler(lastNodeId);\n break;\n default:\n }\n },\n [id, firstNodeId, lastNodeId, firstLevelAssignment, caseIdExpandList]\n );\n const assignmentDetail = processName ? `${processName} - ${name}` : name;\n\n return (\n <StyledNode\n data-testid={testIds.root}\n role='treeitem'\n aria-selected={parentNodeTabIndex === 0}\n aria-labelledby={id}\n ref={assignmentRef}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !nodeInternalFocus) {\n setNodeInternalFocusHandler?.(true);\n reverseTabFlow.current = false;\n return;\n }\n\n if (e.key === 'Escape' && nodeInternalFocus) {\n changeFocusHandler(id);\n setNodeInternalFocusHandler?.(false);\n escapeNodeHandler();\n reverseTabFlow.current = false;\n return;\n }\n\n if (e.shiftKey && e.key === 'Tab' && nodeInternalFocus) {\n reverseTabFlow.current = true;\n } else if (e.key === 'Tab' && nodeInternalFocus) {\n reverseTabFlow.current = false;\n }\n\n if (!nodeInternalFocus) {\n navigationHandler(e);\n }\n }}\n onClick={(e: MouseEvent<HTMLLIElement>) => {\n e.stopPropagation();\n reverseTabFlow.current = false;\n changeFocusHandler(id);\n }}\n tabIndex={nodeInternalFocus ? -1 : parentNodeTabIndex}\n isFocus={nodeInternalFocus ? false : parentNodeTabIndex === 0}\n lastNode={lastNode}\n depth={styledElementDepth}\n onFocus={(e: FocusEvent<HTMLElement>) => {\n e.stopPropagation();\n changeFocusHandler(id);\n }}\n aria-level={depth}\n aria-setsize={setSize}\n aria-posinset={posInset}\n isFirstAssignmentChild={posInset === 1}\n >\n <Grid\n container={{\n alignItems: 'center',\n cols: isMediumOrAbove ? '2fr 2fr auto' : '2fr 0.5fr',\n colGap: isMediumOrAbove ? 3 : 0,\n rows: isMediumOrAbove ? 'repeat(1, auto)' : 'repeat(2, auto)'\n }}\n as={StyledAssignmentItem}\n >\n <StyledVisuallyHiddenText>{`${t('assignment_announcement_label')}`}</StyledVisuallyHiddenText>\n <Flex\n data-testid={testIds.label}\n container={{ alignItems: 'center' }}\n as={StyledProcessContainer}\n depth={styledElementDepth}\n >\n <PauseTextNode>\n <AssignmentDetails processName={processName} name={name} />\n </PauseTextNode>\n </Flex>\n <Flex\n data-testid={testIds.assignee}\n container={{ justify: isMediumOrAbove ? 'end' : 'start' }}\n as={StyledAssigneeContainer}\n isMediumOrAbove={isMediumOrAbove}\n depth={styledElementDepth}\n variant='secondary'\n >\n <StyledAssignmentItemMetaList\n wrapItems\n isMediumOrAbove={isMediumOrAbove}\n items={[\n <>\n <StyledAssigneeText\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onAssigneeClick(assigneeId, e);\n }}\n variant='link'\n ref={setAssigneeElement}\n data-testid={testIds.assignee}\n tabIndex={childElementsTabIndex}\n isMediumOrAbove={isMediumOrAbove}\n >\n <PauseTextNode>{assigneeName}</PauseTextNode>\n </StyledAssigneeText>\n <Tooltip target={assigneeEl} smart>\n {assigneeName}\n </Tooltip>\n </>,\n sla && (\n <Text variant='secondary' data-testid={testIds.sla}>\n <PauseTextNode>\n {Date.parse(sla) ? (\n t('assignments_sla', [\n formatDateTime(parseToDate(sla), {\n t,\n locale,\n format: 'medium',\n variant: 'relative'\n })\n ])\n ) : (\n <NoValue />\n )}\n </PauseTextNode>\n </Text>\n ),\n <>\n <Text variant='secondary' as={StyledLabelContainer} data-testid={testIds.urgency}>\n {t('assignment_item_urgency')}\n </Text>\n <Text variant='secondary'>\n <PauseTextNode>{urgency}</PauseTextNode>\n </Text>\n </>\n ]}\n />\n </Flex>\n <Flex\n as={StyledActionContainer}\n container={{ justify: 'end' }}\n isMediumOrAbove={isMediumOrAbove}\n >\n {onOpen && (\n <Button\n data-testid={testIds.action}\n compact\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => onOpen(id, e)}\n tabIndex={childElementsTabIndex}\n aria-label={t('assignments_go_announcement_label', [assignmentDetail])}\n >\n {t('go')}\n </Button>\n )}\n </Flex>\n </Grid>\n </StyledNode>\n );\n};\n\nexport default withTestIds(AssignmentItem, getAssignmentTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"AssignmentItem.js","sourceRoot":"","sources":["../../../../src/components/HierarchicalAssignments/nodeItems/AssignmentItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,WAAW,EACX,UAAU,EACV,GAAG,EACH,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,OAAO,EACR,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,qBAAqB,MAAM,sBAAsB,CAAC;AACzD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAW1C,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,C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AAI,CACT,KAAC,MAAM,mBACQ,OAAO,CAAC,MAAM,EAC3B,OAAO,QACP,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAC5D,QAAQ,EAAE,qBAAqB,gBACnB,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,YAE1E,CAAC,CAAC,IAAI,CAAC,GACD,CACV,GACI,IACF,GACI,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { useRef, useContext, useCallback } from 'react';\nimport type { MouseEvent, KeyboardEvent, ReactNode, FocusEvent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Grid,\n Flex,\n Button,\n useI18n,\n withTestIds,\n useTestIds,\n cap,\n useDirection,\n Text,\n VisuallyHiddenText,\n useElement,\n Tooltip,\n formatDateTime,\n useConfiguration,\n parseToDate,\n NoValue\n} from '@pega/cosmos-react-core';\n\nimport {\n StyledAssignmentItem,\n StyledProcessContainer,\n StyledActionContainer,\n StyledAssigneeContainer,\n StyledLabelContainer,\n StyledNode,\n StyledAssigneeText,\n StyledAssignmentItemMetaList\n} from '../Assignments.styles';\nimport type { AssignmentProps } from '../HierarchicalAssignments.types';\nimport { getAssignmentTestIds } from '../HierarchicalAssignments.test-ids';\nimport AssignmentTreeContext from '../AssignmentContext';\nimport AssignmentDetails from '../AssignmentDetail';\nimport { restrictDepth, initialDepth } from '../helpers';\n\nimport useNodeFocus from './useNodeFocus';\n\ninterface AssignmentItemProps extends AssignmentProps {\n /** Property defines the node's level */\n depth: number;\n /** total the number of items in the current set of treeitems */\n setSize?: number;\n /** the position of the element within the whole set of treeitems */\n posInset?: number;\n}\n\nconst StyledHiddenText = styled(VisuallyHiddenText)`\n width: 0;\n`;\n\nconst StyledVisuallyHiddenText = styled(VisuallyHiddenText)`\n position: fixed;\n`;\n\nexport const PauseTextNode = ({ children }: { children: ReactNode }) => {\n return (\n <>\n {children}\n <StyledHiddenText>, </StyledHiddenText>\n </>\n );\n};\n\nconst AssignmentItem = ({\n name,\n processName,\n assigneeName,\n urgency,\n sla,\n depth,\n id,\n assigneeId,\n onOpen,\n onAssigneeClick,\n caseId,\n setSize,\n posInset\n}: AssignmentItemProps) => {\n const {\n firstNodeId,\n focusedNodeId,\n lastNodeId,\n changeFocusHandler,\n caseIdExpandList,\n isMediumOrAbove,\n parentRef,\n nodeInternalFocus,\n setNodeInternalFocusHandler,\n reverseTabFlow\n } = useContext(AssignmentTreeContext);\n const assignmentRef = useRef<HTMLLIElement>(null);\n const firstLevelAssignment = depth === initialDepth;\n const styledElementDepth = restrictDepth(depth);\n const childElementsTabIndex = nodeInternalFocus ? 0 : -1;\n\n const { parentNodeTabIndex, lastNode, escapeNodeHandler } = useNodeFocus(\n id,\n assignmentRef,\n parentRef,\n {\n firstNodeId,\n focusedNodeId,\n lastNodeId,\n nodeInternalFocus,\n reverseTabFlow\n }\n );\n\n const { start } = useDirection();\n\n const t = useI18n();\n const { locale } = useConfiguration();\n const [assigneeEl, setAssigneeElement] = useElement<HTMLElement>();\n const testIds = useTestIds('', getAssignmentTestIds);\n\n const navigationHandler = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) e.preventDefault();\n switch (e.key) {\n case 'ArrowUp':\n changeFocusHandler(id, 'up', caseIdExpandList);\n break;\n case 'ArrowDown':\n changeFocusHandler(id, 'down', caseIdExpandList);\n break;\n case `Arrow${cap(start)}`:\n if (!firstLevelAssignment) {\n changeFocusHandler(id, 'left', caseIdExpandList);\n }\n break;\n case 'Home':\n if (firstNodeId) changeFocusHandler(firstNodeId);\n break;\n case 'End':\n if (lastNodeId) changeFocusHandler(lastNodeId);\n break;\n default:\n }\n },\n [id, firstNodeId, lastNodeId, firstLevelAssignment, caseIdExpandList]\n );\n const assignmentDetail = processName ? `${processName} - ${name}` : name;\n\n return (\n <StyledNode\n data-testid={testIds.root}\n role='treeitem'\n aria-selected={parentNodeTabIndex === 0}\n aria-labelledby={id}\n ref={assignmentRef}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !nodeInternalFocus) {\n setNodeInternalFocusHandler?.(true);\n reverseTabFlow.current = false;\n return;\n }\n\n if (e.key === 'Escape' && nodeInternalFocus) {\n changeFocusHandler(id);\n setNodeInternalFocusHandler?.(false);\n escapeNodeHandler();\n reverseTabFlow.current = false;\n return;\n }\n\n if (e.shiftKey && e.key === 'Tab' && nodeInternalFocus) {\n reverseTabFlow.current = true;\n } else if (e.key === 'Tab' && nodeInternalFocus) {\n reverseTabFlow.current = false;\n }\n\n if (!nodeInternalFocus) {\n navigationHandler(e);\n }\n }}\n onClick={(e: MouseEvent<HTMLLIElement>) => {\n e.stopPropagation();\n reverseTabFlow.current = false;\n changeFocusHandler(id);\n }}\n tabIndex={nodeInternalFocus ? -1 : parentNodeTabIndex}\n isFocus={nodeInternalFocus ? false : parentNodeTabIndex === 0}\n lastNode={lastNode}\n depth={styledElementDepth}\n onFocus={(e: FocusEvent<HTMLElement>) => {\n e.stopPropagation();\n changeFocusHandler(id);\n }}\n aria-level={depth}\n aria-setsize={setSize}\n aria-posinset={posInset}\n isFirstAssignmentChild={posInset === 1}\n >\n <Grid\n container={{\n alignItems: 'center',\n cols: isMediumOrAbove ? '2fr 2fr auto' : '2fr 0.5fr',\n colGap: isMediumOrAbove ? 3 : 0,\n rows: isMediumOrAbove ? 'repeat(1, auto)' : 'repeat(2, auto)'\n }}\n as={StyledAssignmentItem}\n >\n <StyledVisuallyHiddenText>{`${t('assignment_announcement_label')}`}</StyledVisuallyHiddenText>\n <Flex\n data-testid={testIds.label}\n container={{ alignItems: 'center' }}\n as={StyledProcessContainer}\n depth={styledElementDepth}\n >\n <PauseTextNode>\n <AssignmentDetails processName={processName} name={name} />\n </PauseTextNode>\n </Flex>\n <Flex\n data-testid={testIds.assignee}\n container={{ justify: isMediumOrAbove ? 'end' : 'start' }}\n as={StyledAssigneeContainer}\n isMediumOrAbove={isMediumOrAbove}\n depth={styledElementDepth}\n variant='secondary'\n >\n <StyledAssignmentItemMetaList\n wrapItems\n isMediumOrAbove={isMediumOrAbove}\n items={[\n <>\n <StyledAssigneeText\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onAssigneeClick(assigneeId, e);\n }}\n variant='link'\n ref={setAssigneeElement}\n data-testid={testIds.assignee}\n tabIndex={childElementsTabIndex}\n isMediumOrAbove={isMediumOrAbove}\n >\n <PauseTextNode>{assigneeName}</PauseTextNode>\n </StyledAssigneeText>\n <Tooltip target={assigneeEl} smart>\n {assigneeName}\n </Tooltip>\n </>,\n sla && (\n <Text variant='secondary' data-testid={testIds.sla}>\n <PauseTextNode>\n {Date.parse(sla) ? (\n t('assignments_sla', [\n formatDateTime(parseToDate(sla), {\n t,\n locale,\n format: 'medium',\n variant: 'relative'\n })\n ])\n ) : (\n <NoValue />\n )}\n </PauseTextNode>\n </Text>\n ),\n <>\n <Text variant='secondary' as={StyledLabelContainer} data-testid={testIds.urgency}>\n {t('assignment_item_urgency')}\n </Text>\n <Text variant='secondary'>\n <PauseTextNode>{urgency}</PauseTextNode>\n </Text>\n </>\n ]}\n />\n </Flex>\n <Flex\n as={StyledActionContainer}\n container={{ justify: 'end' }}\n isMediumOrAbove={isMediumOrAbove}\n >\n {onOpen && (\n <Button\n data-testid={testIds.action}\n compact\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => onOpen(id, e)}\n tabIndex={childElementsTabIndex}\n aria-label={`${t('go')} - ${assignmentDetail}${caseId ? ` ${caseId}` : ''}`}\n >\n {t('go')}\n </Button>\n )}\n </Flex>\n </Grid>\n </StyledNode>\n );\n};\n\nexport default withTestIds(AssignmentItem, getAssignmentTestIds);\n"]}
|
|
@@ -14,6 +14,8 @@ export interface TaskItemProps extends TestIdProp {
|
|
|
14
14
|
meta?: ReactNode;
|
|
15
15
|
/** Provide a callback to render a button for a task. */
|
|
16
16
|
onOpen?: (id: TaskItemProps['id'], e: MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
/** Case identifier */
|
|
18
|
+
caseId?: string;
|
|
17
19
|
/** Content for the task when open. */
|
|
18
20
|
content?: ReactNode;
|
|
19
21
|
/** An array of actions to add to open task. */
|
|
@@ -32,7 +34,7 @@ interface Announcement {
|
|
|
32
34
|
export declare const StyledTaskList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {
|
|
33
35
|
hasFooter: boolean;
|
|
34
36
|
}, never>;
|
|
35
|
-
export declare const TaskItem: (({ testId, id, name, avatar, meta, processName, onOpen, content, headingTag, addAnnouncement, additionalActions, ...restProps }: TaskItemProps & {
|
|
37
|
+
export declare const TaskItem: (({ testId, id, name, avatar, meta, processName, onOpen, caseId, content, headingTag, addAnnouncement, additionalActions, ...restProps }: TaskItemProps & {
|
|
36
38
|
addAnnouncement?: (announcement: Announcement) => void;
|
|
37
39
|
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
38
40
|
getTestIds: (testIdProp?: TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["open-task"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAsBzE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMpF,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;I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AE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,sDAAsD;IACtD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7E,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc;eAA0B,OAAO;SAY1D,CAAC;AAoBH,eAAO,MAAM,QAAQ,4IAehB,aAAa,GAAG;IAAE,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE;;CA4E9E,CAAC;;;;AAgEF,wBAAyD"}
|
|
@@ -33,7 +33,7 @@ const StyledSummaryItem = styled(SummaryItem)(({ hasProcessName }) => {
|
|
|
33
33
|
`
|
|
34
34
|
: null;
|
|
35
35
|
});
|
|
36
|
-
export const TaskItem = withTestIds(({ testId, id, name, avatar, meta, processName, onOpen, content, headingTag, addAnnouncement, additionalActions, ...restProps }) => {
|
|
36
|
+
export const TaskItem = withTestIds(({ testId, id, name, avatar, meta, processName, onOpen, caseId, content, headingTag, addAnnouncement, additionalActions, ...restProps }) => {
|
|
37
37
|
const testIds = useTestIds(testId, getTaskItemTestIds);
|
|
38
38
|
const t = useI18n();
|
|
39
39
|
const { components: { 'case-view': { summary: { detached } } } } = useTheme();
|
|
@@ -52,7 +52,7 @@ export const TaskItem = withTestIds(({ testId, id, name, avatar, meta, processNa
|
|
|
52
52
|
}
|
|
53
53
|
const summary = (_jsx(StyledSummaryItem, { visual: avatar, hasProcessName: processName, primary: primaryValue, secondary: meta, actions: content
|
|
54
54
|
? additionalActions && _jsx(Actions, { menuAt: 1, items: additionalActions })
|
|
55
|
-
: onOpen && (_jsxs(Button, { "data-testid": testIds.openTask, variant: 'primary', compact: detached, onClick: (e) => onOpen(id, e), children: [_jsx("span", { children: t('go') }), _jsx(VisuallyHiddenText, { children:
|
|
55
|
+
: onOpen && (_jsxs(Button, { "data-testid": testIds.openTask, variant: 'primary', compact: detached, onClick: (e) => onOpen(id, e), children: [_jsx("span", { children: t('go') }), _jsx(VisuallyHiddenText, { children: ` - ${processName ? `${processName} ` : ''}${name}${caseId ? ` ${caseId}` : ''}` })] })) }));
|
|
56
56
|
return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { direction: 'column', gap: 2 }, item: { grow: 1 }, as: content ? undefined : StyledSummaryListItem, forwardedAs: content ? 'div' : 'li', children: [summary, content] }));
|
|
57
57
|
}, getTaskItemTestIds);
|
|
58
58
|
const TaskList = forwardRef(function TaskList({ testId, items, hasFooter = false }, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.js","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CA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c,EAClB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,YAEP,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,eAAC,QAAQ,OAAK,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAI,CACvE,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef } from 'react';\nimport type { PropsWithoutRef, ReactNode, Ref, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\nimport {\n SummaryItem,\n StyledSummaryListItem,\n Flex,\n defaultThemeProp,\n Button,\n Text,\n useI18n,\n VisuallyHiddenText,\n useTestIds,\n useLiveLog,\n debounce,\n Actions,\n withTestIds,\n StyledPrimary,\n StyledText,\n useTheme\n} from '@pega/cosmos-react-core';\nimport type { TestIdProp, ActionsProps, HeadingTag } from '@pega/cosmos-react-core';\n\nimport AssignmentDetails from '../HierarchicalAssignments/AssignmentDetail';\n\nimport { getTaskListTestIds, getTaskItemTestIds } from './Tasks.test-ids';\n\nexport interface TaskItemProps extends TestIdProp {\n id: string;\n /** Name of the task displayed in the list. */\n name: string;\n /** Name of the process for the task. */\n processName?: string;\n /** The heading tag to render task name and process as. */\n headingTag?: HeadingTag;\n /** Avatar element to represent the task's assignee. */\n avatar?: ReactNode;\n /** MetaList element with info related to the task. */\n meta?: ReactNode;\n /** Provide a callback to render a button for a task. */\n onOpen?: (id: TaskItemProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n /** Content for the task when open. */\n content?: ReactNode;\n /** An array of actions to add to open task. */\n additionalActions?: ActionsProps['items'];\n}\n\nexport interface TaskListProps extends TestIdProp {\n items: TaskItemProps[];\n hasFooter?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\ninterface Announcement {\n name: string;\n status: 'removed' | 'added';\n}\n\nexport const StyledTaskList = styled.ul<{ hasFooter: boolean }>(({ theme, hasFooter }) => {\n return css`\n > li:last-child {\n ${hasFooter\n ? css`\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n `\n : css`\n padding-block-end: 0;\n `}\n }\n `;\n});\n\nStyledTaskList.defaultProps = defaultThemeProp;\n\nconst StyledSummaryItem = styled(SummaryItem)<{ hasProcessName?: boolean }>(({\n hasProcessName\n}) => {\n return hasProcessName\n ? css`\n ${StyledPrimary} {\n display: contents;\n\n & > ${StyledText} {\n ${ellipsisOverflow};\n }\n }\n `\n : null;\n});\n\nexport const TaskItem = withTestIds(\n ({\n testId,\n id,\n name,\n avatar,\n meta,\n processName,\n onOpen,\n content,\n headingTag,\n addAnnouncement,\n additionalActions,\n ...restProps\n }: TaskItemProps & { addAnnouncement?: (announcement: Announcement) => void }) => {\n const testIds = useTestIds(testId, getTaskItemTestIds);\n const t = useI18n();\n const {\n components: {\n 'case-view': {\n summary: { detached }\n }\n }\n } = useTheme();\n\n useEffect(() => {\n addAnnouncement?.({ name, status: 'added' });\n\n return () => {\n addAnnouncement?.({ name, status: 'removed' });\n };\n }, []);\n\n let primaryValue;\n if (processName) {\n primaryValue = (\n <AssignmentDetails\n name={name}\n headingTag={headingTag}\n processName={processName}\n active={!!content}\n />\n );\n } else {\n primaryValue = (\n <Text variant={headingTag} data-focusable-form-heading={content ? '' : undefined}>\n {name}\n </Text>\n );\n }\n\n const summary = (\n <StyledSummaryItem\n visual={avatar}\n hasProcessName={processName}\n primary={primaryValue}\n secondary={meta}\n actions={\n content\n ? additionalActions && <Actions menuAt={1} items={additionalActions} />\n : onOpen && (\n <Button\n data-testid={testIds.openTask}\n variant='primary'\n compact={detached}\n onClick={(e: MouseEvent<HTMLButtonElement>) => onOpen(id, e)}\n >\n <span>{t('go')}</span>\n <VisuallyHiddenText>{`-${processName ?? ''} ${name}`}</VisuallyHiddenText>\n </Button>\n )\n }\n />\n );\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ direction: 'column', gap: 2 }}\n item={{ grow: 1 }}\n as={content ? undefined : StyledSummaryListItem}\n forwardedAs={content ? 'div' : 'li'}\n >\n {summary}\n {content}\n </Flex>\n );\n },\n getTaskItemTestIds\n);\n\nconst TaskList = forwardRef(function TaskList(\n { testId, items, hasFooter = false }: PropsWithoutRef<TaskListProps>,\n ref: TaskListProps['ref']\n) {\n const testIds = useTestIds(testId, getTaskListTestIds);\n const t = useI18n();\n const { announcePolite } = useLiveLog();\n const announcements = useRef<Announcement[]>([]);\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const debouncedAnnounce = debounce(() => {\n if (announcements.current.length > 0) {\n let tasksAdded = 0;\n let tasksRemoved = 0;\n announcements.current.forEach(item => {\n if (item.status === 'removed') {\n tasksRemoved += 1;\n } else {\n tasksAdded += 1;\n }\n });\n let message = tasksAdded ? t('tasks_added', [tasksAdded], { count: tasksAdded }) : '';\n if (tasksRemoved) {\n message += t('tasks_removed', [tasksRemoved], { count: tasksRemoved });\n }\n\n if (mounted.current) {\n announcePolite({ message });\n }\n\n announcements.current = [];\n }\n }, 2000);\n\n const addAnnouncement = (announcement: Announcement) => {\n announcements.current = [...announcements.current, announcement];\n debouncedAnnounce();\n };\n\n return (\n <Flex\n data-testid={testIds.root}\n container={{ direction: 'column' }}\n as={StyledTaskList}\n hasFooter={hasFooter}\n ref={ref}\n >\n {items.map(item => (\n <TaskItem {...item} addAnnouncement={addAnnouncement} key={item.id} />\n ))}\n </Flex>\n );\n});\n\nexport default withTestIds(TaskList, getTaskListTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"TaskList.js","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MA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;QACrD,aAAa,CAAC,OAAO,GAAG,CAAC,GAAG,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACjE,iBAAiB,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,mBACU,OAAO,CAAC,IAAI,EACzB,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,EAAE,EAAE,cAAc,EAClB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,YAEP,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,eAAC,QAAQ,OAAK,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAI,CACvE,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef } from 'react';\nimport type { PropsWithoutRef, ReactNode, Ref, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\nimport {\n SummaryItem,\n StyledSummaryListItem,\n Flex,\n defaultThemeProp,\n Button,\n Text,\n useI18n,\n VisuallyHiddenText,\n useTestIds,\n useLiveLog,\n debounce,\n Actions,\n withTestIds,\n StyledPrimary,\n StyledText,\n useTheme\n} from '@pega/cosmos-react-core';\nimport type { TestIdProp, ActionsProps, HeadingTag } from '@pega/cosmos-react-core';\n\nimport AssignmentDetails from '../HierarchicalAssignments/AssignmentDetail';\n\nimport { getTaskListTestIds, getTaskItemTestIds } from './Tasks.test-ids';\n\nexport interface TaskItemProps extends TestIdProp {\n id: string;\n /** Name of the task displayed in the list. */\n name: string;\n /** Name of the process for the task. */\n processName?: string;\n /** The heading tag to render task name and process as. */\n headingTag?: HeadingTag;\n /** Avatar element to represent the task's assignee. */\n avatar?: ReactNode;\n /** MetaList element with info related to the task. */\n meta?: ReactNode;\n /** Provide a callback to render a button for a task. */\n onOpen?: (id: TaskItemProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n /** Case identifier */\n caseId?: string;\n /** Content for the task when open. */\n content?: ReactNode;\n /** An array of actions to add to open task. */\n additionalActions?: ActionsProps['items'];\n}\n\nexport interface TaskListProps extends TestIdProp {\n items: TaskItemProps[];\n hasFooter?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\ninterface Announcement {\n name: string;\n status: 'removed' | 'added';\n}\n\nexport const StyledTaskList = styled.ul<{ hasFooter: boolean }>(({ theme, hasFooter }) => {\n return css`\n > li:last-child {\n ${hasFooter\n ? css`\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n `\n : css`\n padding-block-end: 0;\n `}\n }\n `;\n});\n\nStyledTaskList.defaultProps = defaultThemeProp;\n\nconst StyledSummaryItem = styled(SummaryItem)<{ hasProcessName?: boolean }>(({\n hasProcessName\n}) => {\n return hasProcessName\n ? css`\n ${StyledPrimary} {\n display: contents;\n\n & > ${StyledText} {\n ${ellipsisOverflow};\n }\n }\n `\n : null;\n});\n\nexport const TaskItem = withTestIds(\n ({\n testId,\n id,\n name,\n avatar,\n meta,\n processName,\n onOpen,\n caseId,\n content,\n headingTag,\n addAnnouncement,\n additionalActions,\n ...restProps\n }: TaskItemProps & { addAnnouncement?: (announcement: Announcement) => void }) => {\n const testIds = useTestIds(testId, getTaskItemTestIds);\n const t = useI18n();\n const {\n components: {\n 'case-view': {\n summary: { detached }\n }\n }\n } = useTheme();\n\n useEffect(() => {\n addAnnouncement?.({ name, status: 'added' });\n\n return () => {\n addAnnouncement?.({ name, status: 'removed' });\n };\n }, []);\n\n let primaryValue;\n if (processName) {\n primaryValue = (\n <AssignmentDetails\n name={name}\n headingTag={headingTag}\n processName={processName}\n active={!!content}\n />\n );\n } else {\n primaryValue = (\n <Text variant={headingTag} data-focusable-form-heading={content ? '' : undefined}>\n {name}\n </Text>\n );\n }\n\n const summary = (\n <StyledSummaryItem\n visual={avatar}\n hasProcessName={processName}\n primary={primaryValue}\n secondary={meta}\n actions={\n content\n ? additionalActions && <Actions menuAt={1} items={additionalActions} />\n : onOpen && (\n <Button\n data-testid={testIds.openTask}\n variant='primary'\n compact={detached}\n onClick={(e: MouseEvent<HTMLButtonElement>) => onOpen(id, e)}\n >\n <span>{t('go')}</span>\n <VisuallyHiddenText>{` - ${processName ? `${processName} ` : ''}${name}${caseId ? ` ${caseId}` : ''}`}</VisuallyHiddenText>\n </Button>\n )\n }\n />\n );\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ direction: 'column', gap: 2 }}\n item={{ grow: 1 }}\n as={content ? undefined : StyledSummaryListItem}\n forwardedAs={content ? 'div' : 'li'}\n >\n {summary}\n {content}\n </Flex>\n );\n },\n getTaskItemTestIds\n);\n\nconst TaskList = forwardRef(function TaskList(\n { testId, items, hasFooter = false }: PropsWithoutRef<TaskListProps>,\n ref: TaskListProps['ref']\n) {\n const testIds = useTestIds(testId, getTaskListTestIds);\n const t = useI18n();\n const { announcePolite } = useLiveLog();\n const announcements = useRef<Announcement[]>([]);\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const debouncedAnnounce = debounce(() => {\n if (announcements.current.length > 0) {\n let tasksAdded = 0;\n let tasksRemoved = 0;\n announcements.current.forEach(item => {\n if (item.status === 'removed') {\n tasksRemoved += 1;\n } else {\n tasksAdded += 1;\n }\n });\n let message = tasksAdded ? t('tasks_added', [tasksAdded], { count: tasksAdded }) : '';\n if (tasksRemoved) {\n message += t('tasks_removed', [tasksRemoved], { count: tasksRemoved });\n }\n\n if (mounted.current) {\n announcePolite({ message });\n }\n\n announcements.current = [];\n }\n }, 2000);\n\n const addAnnouncement = (announcement: Announcement) => {\n announcements.current = [...announcements.current, announcement];\n debouncedAnnounce();\n };\n\n return (\n <Flex\n data-testid={testIds.root}\n container={{ direction: 'column' }}\n as={StyledTaskList}\n hasFooter={hasFooter}\n ref={ref}\n >\n {items.map(item => (\n <TaskItem {...item} addAnnouncement={addAnnouncement} key={item.id} />\n ))}\n </Flex>\n );\n});\n\nexport default withTestIds(TaskList, getTaskListTestIds);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-work",
|
|
3
|
-
"version": "8.21.
|
|
3
|
+
"version": "8.21.9",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-core": "8.21.
|
|
18
|
-
"@pega/cosmos-react-rte": "8.21.
|
|
17
|
+
"@pega/cosmos-react-core": "8.21.9",
|
|
18
|
+
"@pega/cosmos-react-rte": "8.21.9",
|
|
19
19
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
20
20
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
21
21
|
"@types/styled-components": "^5.1.26",
|