@pega/lists-react 10.0.0-build.9.0 → 10.0.0-build.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Core/Components/Card/hooks/useRowActions.d.ts.map +1 -1
- package/lib/Core/Components/Card/hooks/useRowActions.js +8 -1
- package/lib/Core/Components/Card/hooks/useRowActions.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.js +28 -11
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.js +12 -2
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.js.map +1 -1
- package/lib/Core/Components/Toolbar/AdvanceToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js +8 -2
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/Map/MapToolbar.d.ts +2 -2
- package/lib/Core/Components/Toolbar/Map/MapToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/Map/MapToolbar.js +17 -18
- package/lib/Core/Components/Toolbar/Map/MapToolbar.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRowActions.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Card/hooks/useRowActions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,UAAU,kBAAkB;IAC1B,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;CACxB;AAED,QAAA,MAAM,aAAa,GAAI,eAGpB,kBAAkB,KAAG,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"useRowActions.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Card/hooks/useRowActions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,UAAU,kBAAkB;IAC1B,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;CACxB;AAED,QAAA,MAAM,aAAa,GAAI,eAGpB,kBAAkB,KAAG,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SA+BnD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -3,6 +3,13 @@ const useRowActions = ({ row, meta }) => {
|
|
|
3
3
|
const fetchActions = useCallback(async () => {
|
|
4
4
|
const rowContext = row.getContext();
|
|
5
5
|
let allActions = meta.rowActions ?? [];
|
|
6
|
+
// Row header cells share one mutable Column instance whose execution context is rebound to
|
|
7
|
+
// whichever row is currently rendering, so its value must be read now - before the await
|
|
8
|
+
// below - rather than deferred until the returned onClick fires.
|
|
9
|
+
const rowMeta = {
|
|
10
|
+
rowHeader: rowContext.getRowHeader?.()?.getValue(),
|
|
11
|
+
rowIndex: rowContext.getRowIndex?.() ?? -1
|
|
12
|
+
};
|
|
6
13
|
try {
|
|
7
14
|
const dynamicActions = await rowContext.getRowActionDetails(rowContext.getValue());
|
|
8
15
|
if (Array.isArray(dynamicActions)) {
|
|
@@ -15,7 +22,7 @@ const useRowActions = ({ row, meta }) => {
|
|
|
15
22
|
return allActions.map(action => ({
|
|
16
23
|
...action,
|
|
17
24
|
onClick: () => {
|
|
18
|
-
action.onClick(rowContext.getValue(), rowContext.refreshRow);
|
|
25
|
+
action.onClick(rowContext.getValue(), rowContext.refreshRow, rowMeta);
|
|
19
26
|
}
|
|
20
27
|
}));
|
|
21
28
|
}, [row, meta.rowActions]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRowActions.js","sourceRoot":"","sources":["../../../../../Core/Components/Card/hooks/useRowActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAUpC,MAAM,aAAa,GAAG,CAAC,EACrB,GAAG,EACH,IAAI,EACe,EAAyC,EAAE;IAC9D,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,IAAuB,EAAE;QAC7D,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;QAEvC,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,mBAAmB,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnF,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBAClC,UAAU,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,UAAU,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,6CAA6C;QAC/C,CAAC;QAED,OAAO,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC/B,GAAG,MAAM;YACT,OAAO,EAAE,GAAG,EAAE;gBACZ,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useRowActions.js","sourceRoot":"","sources":["../../../../../Core/Components/Card/hooks/useRowActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAUpC,MAAM,aAAa,GAAG,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cesContent":["import { useCallback } from 'react';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { Action } from '@pega/cosmos-react-core';\n\ninterface UseRowActionsProps {\n row: RsCoreTypes.Row;\n meta: RsCoreTypes.Meta;\n}\n\nconst useRowActions = ({\n row,\n meta\n}: UseRowActionsProps): (() => Promise<Action[]>) | undefined => {\n const fetchActions = useCallback(async (): Promise<Action[]> => {\n const rowContext = row.getContext();\n let allActions = meta.rowActions ?? [];\n\n // Row header cells share one mutable Column instance whose execution context is rebound to\n // whichever row is currently rendering, so its value must be read now - before the await\n // below - rather than deferred until the returned onClick fires.\n const rowMeta = {\n rowHeader: rowContext.getRowHeader?.()?.getValue(),\n rowIndex: rowContext.getRowIndex?.() ?? -1\n };\n\n try {\n const dynamicActions = await rowContext.getRowActionDetails(rowContext.getValue());\n if (Array.isArray(dynamicActions)) {\n allActions = [...dynamicActions, ...allActions];\n }\n } catch (error) {\n // On error, fall back to static actions only\n }\n\n return allActions.map(action => ({\n ...action,\n onClick: () => {\n action.onClick(rowContext.getValue(), rowContext.refreshRow, rowMeta);\n }\n }));\n }, [row, meta.rowActions]);\n\n return meta.editing || meta.deleting ? fetchActions : undefined;\n};\n\nexport default useRowActions;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowActionMenu.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowActionMenu.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"RowActionMenu.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowActionMenu.jsx"],"names":[],"mappings":";AA8DA;;;;4CAsEC;;;;;;;sBAnIqB,YAAY"}
|
|
@@ -4,12 +4,13 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { MenuButton } from '@pega/cosmos-react-core';
|
|
5
5
|
import { ROW_DENSITY } from 'pega-repeating-structures-core';
|
|
6
6
|
import useTranslate from '../../../Hooks/useTranslate';
|
|
7
|
-
const hydrateActions = (actions,
|
|
7
|
+
const hydrateActions = (actions, getActionContext) => {
|
|
8
8
|
return actions.map(action => ({
|
|
9
9
|
...action,
|
|
10
10
|
primary: action.text,
|
|
11
11
|
onClick: () => {
|
|
12
|
-
|
|
12
|
+
const { rowContext, refreshRow, rowMeta } = getActionContext();
|
|
13
|
+
action.onClick(rowContext, refreshRow, rowMeta);
|
|
13
14
|
}
|
|
14
15
|
}));
|
|
15
16
|
};
|
|
@@ -21,7 +22,15 @@ const isVisibleInMenu = (actionConfig, rowContext) => {
|
|
|
21
22
|
actionConfig.placement === 'menu' &&
|
|
22
23
|
actionConfig.isVisible?.(rowContext));
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
// Row header cells share one mutable Column instance whose execution context is rebound to
|
|
26
|
+
// whichever row is currently rendering, so its value must be read now - not later inside onClick.
|
|
27
|
+
const resolveRowMeta = executionContext => {
|
|
28
|
+
return {
|
|
29
|
+
rowHeader: executionContext?.getRowHeader?.()?.getValue(),
|
|
30
|
+
rowIndex: executionContext?.getRowIndex?.() ?? -1
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const getConfigActions = ({ editing, deleting }, rowContext, translate) => {
|
|
25
34
|
const actions = [];
|
|
26
35
|
if (isVisibleInMenu(editing, rowContext) && typeof editing.onClick === 'function') {
|
|
27
36
|
actions.push({
|
|
@@ -37,27 +46,35 @@ const getConfigActions = ({ editing, deleting }, rowContext, refreshRow, transla
|
|
|
37
46
|
onClick: deleting.onClick
|
|
38
47
|
});
|
|
39
48
|
}
|
|
40
|
-
return
|
|
49
|
+
return actions;
|
|
41
50
|
};
|
|
42
51
|
function RowActionMenu({ getRsMeta, getExecutionContext, getParentContext }) {
|
|
43
52
|
const [translate] = useTranslate();
|
|
44
|
-
const {
|
|
53
|
+
const { getRowActionDetails } = getExecutionContext();
|
|
45
54
|
const [rowActions, setRowActions] = useState([]);
|
|
46
55
|
const [actionsFetched, setActionsFetched] = useState(false);
|
|
47
|
-
const rowContext = getValue();
|
|
48
56
|
const rsMeta = getRsMeta();
|
|
49
57
|
const { rowActions: tableMetaRowActions } = rsMeta;
|
|
50
|
-
const
|
|
58
|
+
const getLatestActionContext = () => {
|
|
59
|
+
const latestExecutionContext = getExecutionContext();
|
|
60
|
+
const latestRowContext = latestExecutionContext?.getValue();
|
|
61
|
+
return {
|
|
62
|
+
rowContext: latestRowContext,
|
|
63
|
+
refreshRow: latestExecutionContext?.refreshRow?.bind(null, latestRowContext),
|
|
64
|
+
rowMeta: resolveRowMeta(latestExecutionContext)
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const staticActions = useMemo(() => hydrateActions(tableMetaRowActions ?? [], getLatestActionContext), [tableMetaRowActions, getExecutionContext]);
|
|
51
68
|
const fetchCaseDeatils = () => {
|
|
52
69
|
setActionsFetched(false);
|
|
53
|
-
const
|
|
70
|
+
const latestExecutionContext = getExecutionContext();
|
|
71
|
+
const currentRowContext = latestExecutionContext?.getValue();
|
|
54
72
|
let actions = [];
|
|
55
|
-
const configActions = getConfigActions(rsMeta,
|
|
73
|
+
const configActions = hydrateActions(getConfigActions(rsMeta, currentRowContext, translate), getLatestActionContext);
|
|
56
74
|
getRowActionDetails(currentRowContext)
|
|
57
75
|
.then(response => {
|
|
58
76
|
if (Array.isArray(response)) {
|
|
59
|
-
|
|
60
|
-
actions = hydrateActions(response, latestRowContext, refreshRow.bind(null, latestRowContext));
|
|
77
|
+
actions = hydrateActions(response, getLatestActionContext);
|
|
61
78
|
}
|
|
62
79
|
})
|
|
63
80
|
.finally(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowActionMenu.js","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowActionMenu.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,U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PropTypes from 'prop-types';\n\nimport { MenuButton } from '@pega/cosmos-react-core';\nimport { ROW_DENSITY } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../../Hooks/useTranslate';\n\nconst hydrateActions = (actions, getActionContext) => {\n return actions.map(action => ({\n ...action,\n primary: action.text,\n onClick: () => {\n const { rowContext, refreshRow, rowMeta } = getActionContext();\n action.onClick(rowContext, refreshRow, rowMeta);\n }\n }));\n};\n\nconst isActionConfig = actionConfig => {\n return !!actionConfig && typeof actionConfig === 'object';\n};\n\nconst isVisibleInMenu = (actionConfig, rowContext) => {\n return (\n isActionConfig(actionConfig) &&\n actionConfig.placement === 'menu' &&\n actionConfig.isVisible?.(rowContext)\n );\n};\n\n// Row header cells share one mutable Column instance whose execution context is rebound to\n// whichever row is currently rendering, so its value must be read now - not later inside onClick.\nconst resolveRowMeta = executionContext => {\n return {\n rowHeader: executionContext?.getRowHeader?.()?.getValue(),\n rowIndex: executionContext?.getRowIndex?.() ?? -1\n };\n};\n\nconst getConfigActions = ({ editing, deleting }, rowContext, translate) => {\n const actions = [];\n\n if (isVisibleInMenu(editing, rowContext) && typeof editing.onClick === 'function') {\n actions.push({\n text: translate('Edit'),\n id: 'edit',\n onClick: editing.onClick\n });\n }\n\n if (isVisibleInMenu(deleting, rowContext) && typeof deleting.onClick === 'function') {\n actions.push({\n text: translate('Delete'),\n id: 'delete',\n onClick: deleting.onClick\n });\n }\n\n return actions;\n};\n\nfunction RowActionMenu({ getRsMeta, getExecutionContext, getParentContext }) {\n const [translate] = useTranslate();\n const { getRowActionDetails } = getExecutionContext();\n const [rowActions, setRowActions] = useState([]);\n const [actionsFetched, setActionsFetched] = useState(false);\n const rsMeta = getRsMeta();\n const { rowActions: tableMetaRowActions } = rsMeta;\n\n const getLatestActionContext = () => {\n const latestExecutionContext = getExecutionContext();\n const latestRowContext = latestExecutionContext?.getValue();\n\n return {\n rowContext: latestRowContext,\n refreshRow: latestExecutionContext?.refreshRow?.bind(null, latestRowContext),\n rowMeta: resolveRowMeta(latestExecutionContext)\n };\n };\n\n const staticActions = useMemo(\n () => hydrateActions(tableMetaRowActions ?? [], getLatestActionContext),\n [tableMetaRowActions, getExecutionContext]\n );\n\n const fetchCaseDeatils = () => {\n setActionsFetched(false);\n const latestExecutionContext = getExecutionContext();\n const currentRowContext = latestExecutionContext?.getValue();\n let actions = [];\n const configActions = hydrateActions(\n getConfigActions(rsMeta, currentRowContext, translate),\n getLatestActionContext\n );\n getRowActionDetails(currentRowContext)\n .then(response => {\n if (Array.isArray(response)) {\n actions = hydrateActions(response, getLatestActionContext);\n }\n })\n .finally(() => {\n setRowActions([...configActions, ...actions, ...staticActions]);\n setActionsFetched(true);\n });\n };\n const rowHeaderValue = getExecutionContext().getRowHeader()?.getValue();\n const translatedActionsText = translate('Actions');\n\n return (\n <MenuButton\n text={translatedActionsText}\n iconOnly\n variant='simple'\n compact={getParentContext().getRowDensity() === ROW_DENSITY.SHORT}\n tabIndex={-1}\n menu={{\n items: actionsFetched ? rowActions : [],\n emptyText: translate('No actions available'),\n loading: !actionsFetched\n }}\n aria-label={\n rowHeaderValue ? `${translatedActionsText} - ${rowHeaderValue}` : `${translatedActionsText}`\n }\n onClick={fetchCaseDeatils}\n placement='bottom-end'\n popover={{\n portal: true\n }}\n icon='more'\n />\n );\n}\n\nRowActionMenu.propTypes = {\n getRsMeta: PropTypes.func.isRequired,\n getExecutionContext: PropTypes.func.isRequired\n};\n\nexport default RowActionMenu;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowDeleteAction.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,UAAU,cAAc;IACtB,mBAAmB,EAAE,WAAW,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IACtE,SAAS,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,GAAG;QACpE,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC;KACpC,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"RowDeleteAction.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,UAAU,cAAc;IACtB,mBAAmB,EAAE,WAAW,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IACtE,SAAS,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,GAAG;QACpE,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC;KACpC,CAAC;CACH;AAuBD,iBAAS,eAAe,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAE,EAAE,cAAc,2CAuC1E;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -5,6 +5,14 @@ import useTranslate from '../../../Hooks/useTranslate';
|
|
|
5
5
|
const StyledButton = styled(Button)(({ $isVisible }) => css `
|
|
6
6
|
visibility: ${$isVisible ? 'visible' : 'hidden'};
|
|
7
7
|
`);
|
|
8
|
+
// Row header cells share one mutable Column instance whose execution context is rebound to
|
|
9
|
+
// whichever row is currently rendering, so its value must be read now - not later inside onClick.
|
|
10
|
+
const resolveRowMeta = (executionContext) => {
|
|
11
|
+
return {
|
|
12
|
+
rowHeader: executionContext?.getRowHeader?.()?.getValue(),
|
|
13
|
+
rowIndex: executionContext?.getRowIndex?.() ?? -1
|
|
14
|
+
};
|
|
15
|
+
};
|
|
8
16
|
function RowDeleteAction({ getExecutionContext, getRsMeta }) {
|
|
9
17
|
const [translate] = useTranslate();
|
|
10
18
|
const executionContext = getExecutionContext();
|
|
@@ -15,11 +23,13 @@ function RowDeleteAction({ getExecutionContext, getRsMeta }) {
|
|
|
15
23
|
// RowDelete renderer only mounts for delete-column configuration.
|
|
16
24
|
const isVisibleFromMeta = rowContext ? deletingConfig.isVisible(rowContext) : false;
|
|
17
25
|
const handleDelete = () => {
|
|
18
|
-
|
|
26
|
+
const latestExecutionContext = getExecutionContext();
|
|
27
|
+
const latestRowContext = latestExecutionContext?.getValue();
|
|
28
|
+
if (!latestRowContext) {
|
|
19
29
|
return;
|
|
20
30
|
}
|
|
21
31
|
// RowDelete uses action-config callback for delete behavior.
|
|
22
|
-
deletingConfig.onClick(
|
|
32
|
+
deletingConfig.onClick(latestRowContext, latestExecutionContext?.refreshRow, resolveRowMeta(latestExecutionContext));
|
|
23
33
|
};
|
|
24
34
|
return (_jsx(StyledButton, { variant: 'simple', icon: true, "$isVisible": isVisibleFromMeta, ...(!isVisibleFromMeta && { tabIndex: -1 }), label: deleteText, "aria-label": rowHeaderValue ? `${deleteText} - ${rowHeaderValue}` : deleteText, onClick: isVisibleFromMeta ? handleDelete : undefined, children: _jsx(Icon, { name: 'trash' }) }));
|
|
25
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowDeleteAction.js","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,YAAY,MAAM,6BAA6B,CAAC;AAavD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CACjC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;kBACP,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;GAChD,CACF,CAAC;AAEF,SAAS,eAAe,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAkB;IACzE,MAAM,CAAC,SAAS,CAAC,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,UAAU,GAAG,gBAAgB,EAAE,QAAQ,EAAE,CAAC;IAChD,MAAM,cAAc,GAAG,gBAAgB,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IACtE,MAAM,UAAU,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAChD,MAAM,cAAc,GAAG,SAAS,EAAE,CAAC,QAAQ,CAAC;IAE5C,kEAAkE;IAClE,MAAM,iBAAiB,GAAG,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpF,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"RowDeleteAction.js","sourceRoot":"","sources":["../../../../../Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,YAAY,MAAM,6BAA6B,CAAC;AAavD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CACjC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;kBACP,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;GAChD,CACF,CAAC;AAEF,2FAA2F;AAC3F,kGAAkG;AAClG,MAAM,cAAc,GAAG,CACrB,gBAA8E,EAC9E,EAAE;IACF,OAAO;QACL,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE;QACzD,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;KAClD,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,EAAE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AI,EAAC,OAAO,GAAG,GACR,CAChB,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Button, Icon } from '@pega/cosmos-react-core';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../../Hooks/useTranslate';\n\ninterface RowDeleteProps {\n getExecutionContext: RsCoreTypes.ColumnContext['getExecutionContext'];\n getRsMeta: () => ReturnType<RsCoreTypes.ColumnContext['getRsMeta']> & {\n deleting: RsCoreTypes.ActionConfig;\n };\n}\n\ninterface StyledButtonProps {\n $isVisible: boolean;\n}\n\nconst StyledButton = styled(Button)<StyledButtonProps>(\n ({ $isVisible }) => css`\n visibility: ${$isVisible ? 'visible' : 'hidden'};\n `\n);\n\n// Row header cells share one mutable Column instance whose execution context is rebound to\n// whichever row is currently rendering, so its value must be read now - not later inside onClick.\nconst resolveRowMeta = (\n executionContext: ReturnType<RsCoreTypes.ColumnContext['getExecutionContext']>\n) => {\n return {\n rowHeader: executionContext?.getRowHeader?.()?.getValue(),\n rowIndex: executionContext?.getRowIndex?.() ?? -1\n };\n};\n\nfunction RowDeleteAction({ getExecutionContext, getRsMeta }: RowDeleteProps) {\n const [translate] = useTranslate();\n const executionContext = getExecutionContext();\n const rowContext = executionContext?.getValue();\n const rowHeaderValue = executionContext?.getRowHeader?.()?.getValue();\n const deleteText = translate('Delete this row');\n const deletingConfig = getRsMeta().deleting;\n\n // RowDelete renderer only mounts for delete-column configuration.\n const isVisibleFromMeta = rowContext ? deletingConfig.isVisible(rowContext) : false;\n\n const handleDelete = () => {\n const latestExecutionContext = getExecutionContext();\n const latestRowContext = latestExecutionContext?.getValue();\n if (!latestRowContext) {\n return;\n }\n\n // RowDelete uses action-config callback for delete behavior.\n deletingConfig.onClick(\n latestRowContext,\n latestExecutionContext?.refreshRow,\n resolveRowMeta(latestExecutionContext)\n );\n };\n\n return (\n <StyledButton\n variant='simple'\n icon\n $isVisible={isVisibleFromMeta}\n {...(!isVisibleFromMeta && { tabIndex: -1 })}\n label={deleteText}\n aria-label={rowHeaderValue ? `${deleteText} - ${rowHeaderValue}` : deleteText}\n onClick={isVisibleFromMeta ? handleDelete : undefined}\n >\n <Icon name='trash' />\n </StyledButton>\n );\n}\n\nexport default RowDeleteAction;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdvanceToolbar.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/AdvanceToolbar.jsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AdvanceToolbar.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/AdvanceToolbar.jsx"],"names":[],"mappings":"AAyBA;;4CAiIC;;;;;;;;;sBA1JqB,YAAY"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { ListToolbar, useBreakpoint } from '@pega/cosmos-react-core';
|
|
4
5
|
import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
|
|
5
6
|
import { SELECTION_MODES } from '../../constants';
|
|
6
7
|
import showFeatureForTemplate from '../../templateFeatureSupport';
|
|
@@ -20,6 +21,10 @@ import ValidateMessage from './ValidateMessage';
|
|
|
20
21
|
import useFormControlProps from './hooks/useFormControlProps';
|
|
21
22
|
import useWrapAction from './hooks/useWrapAction';
|
|
22
23
|
export default function AdvanceToolbar({ view }) {
|
|
24
|
+
const toolbarRef = useRef(null);
|
|
25
|
+
// additionalActions (bulk actions/toolbar actions) should stay hidden on mobile until a
|
|
26
|
+
// selection is active; that decision lives here, in the parent, not in ListToolbar.
|
|
27
|
+
const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: toolbarRef });
|
|
23
28
|
const { selectedRecordsCount, meta: { basicMode, selectionMode, title, showTitle, headingTag, toolbarActions, allowBulkActions, allowRefresh, mapFieldIds } = {}, rows, state, getContext, isLoading, showCount, refreshNotification, type: { forceRefresh }, announceCount, template } = view;
|
|
24
29
|
const { getRequiredDef } = getContext();
|
|
25
30
|
const { validatemessage } = getRequiredDef() || {};
|
|
@@ -37,6 +42,7 @@ export default function AdvanceToolbar({ view }) {
|
|
|
37
42
|
const formControlProps = useFormControlProps(view);
|
|
38
43
|
const wrapAction = useWrapAction(view);
|
|
39
44
|
const additionalActions = (_jsxs(_Fragment, { children: [basicMode && (_jsx(ToolbarActions, { toolbarActions: toolbarActions?.filter(action => !action.id.startsWith('Add')) })), allowBulkActions && template !== REPEATING_STRUCTURE_TEMPLATES.TIMELINE && (_jsx(ActionsMenu, { enableActionsMenu: enableActionsMenu, view: view }))] }));
|
|
45
|
+
const responsiveAdditionalActions = isSmallOrAbove || enableActionsMenu ? additionalActions : undefined;
|
|
40
46
|
const createNewAction = toolbarActions?.find(action => action.id.startsWith('Add'));
|
|
41
47
|
const createNew = createNewAction && basicMode
|
|
42
48
|
? {
|
|
@@ -44,7 +50,7 @@ export default function AdvanceToolbar({ view }) {
|
|
|
44
50
|
onClick: createNewAction.onClick
|
|
45
51
|
}
|
|
46
52
|
: undefined;
|
|
47
|
-
const Toolbar = template === REPEATING_STRUCTURE_TEMPLATES.MAP ? (_jsx(MapToolbar, { locationFieldId: mapFieldIds?.location, name: title, showName: showTitle, headingTag: headingTag, formControlProps: formControlProps, rows: rows, count: count, createNew: createNew, additionalActions:
|
|
53
|
+
const Toolbar = template === REPEATING_STRUCTURE_TEMPLATES.MAP ? (_jsx(MapToolbar, { locationFieldId: mapFieldIds?.location, name: title, showName: showTitle, headingTag: headingTag, formControlProps: formControlProps, rows: rows, count: count, createNew: createNew, additionalActions: responsiveAdditionalActions, ref: toolbarRef })) : (_jsxs(_Fragment, { children: [_jsx(ListToolbar, { name: title, showName: showTitle, headingTag: headingTag, formControlProps: formControlProps, viewSelector: viewSelector, search: search, count: count, additionalActions: responsiveAdditionalActions, filter: filter, group: showFeatureForTemplate(template, 'group') && group, sort: sort, actions: actions, actionsButtonRef: actionsButtonRef, createNew: createNew, wrap: wrapAction, ref: toolbarRef }), selectedActionContent, createEditViewContent] }));
|
|
48
54
|
return (_jsxs(AnnounceRowsCount, { state: state, count: count, isLoading: isLoading, announceCount: announceCount, children: [_jsx(ValidateMessage, { message: validatemessage, children: Toolbar }), refreshNotification && (_jsx(RefreshBanner, { refreshNotification: refreshNotification, forceRefresh: forceRefresh, viewName: viewName, allowRefresh: allowRefresh }))] }));
|
|
49
55
|
}
|
|
50
56
|
AdvanceToolbar.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdvanceToolbar.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/AdvanceToolbar.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"AdvanceToolbar.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/AdvanceToolbar.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,sBAAsB,MAAM,8BAA8B,CAAC;AAElE,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,OAAO,MAAM,iBAAiB,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ACf,EACD,qBAAqB,EACrB,qBAAqB,IACrB,CACJ,CAAC;IAEJ,OAAO,CACL,MAAC,iBAAiB,IAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,aAE5B,KAAC,eAAe,IAAC,OAAO,EAAE,eAAe,YACtC,OAAO,GAEQ,EACjB,mBAAmB,IAAI,CACtB,KAAC,aAAa,IACZ,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,GAC1B,CACH,IACiB,CACrB,CAAC;AACJ,CAAC;AAED,cAAc,CAAC,SAAS,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;CACnD,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { useRef } from 'react';\n\nimport { ListToolbar, useBreakpoint } from '@pega/cosmos-react-core';\nimport { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport { SELECTION_MODES } from '../../constants';\nimport showFeatureForTemplate from '../../templateFeatureSupport';\n\nimport ActionsMenu from './ActionsMenu';\nimport MapToolbar from './Map/MapToolbar';\nimport ToolbarActions from './ToolbarActions';\nimport useSearch from './hooks/useSearch';\nimport useFilter from './hooks/useFilter';\nimport usePersonalization from './hooks/usePersonalization';\nimport useMore from './hooks/useMore';\nimport useGroup from './hooks/useGroup/useGroup';\nimport useSort from './hooks/useSort/useSort';\nimport getCount from './utils/getCount';\nimport RefreshBanner from './RefreshBanner';\nimport AnnounceRowsCount from './AnnounceRowsCount';\nimport ValidateMessage from './ValidateMessage';\nimport useFormControlProps from './hooks/useFormControlProps';\nimport useWrapAction from './hooks/useWrapAction';\n\nexport default function AdvanceToolbar({ view }) {\n const toolbarRef = useRef(null);\n // additionalActions (bulk actions/toolbar actions) should stay hidden on mobile until a\n // selection is active; that decision lives here, in the parent, not in ListToolbar.\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: toolbarRef });\n const {\n selectedRecordsCount,\n meta: {\n basicMode,\n selectionMode,\n title,\n showTitle,\n headingTag,\n toolbarActions,\n allowBulkActions,\n allowRefresh,\n mapFieldIds\n } = {},\n rows,\n state,\n getContext,\n isLoading,\n showCount,\n refreshNotification,\n type: { forceRefresh },\n announceCount,\n template\n } = view;\n const { getRequiredDef } = getContext();\n const { validatemessage } = getRequiredDef() || {};\n const { viewSelector, createEditViewContent } = usePersonalization({ view });\n const search = useSearch({ view });\n const count = showCount ? getCount({ view }) : undefined;\n const filter = useFilter({ view });\n const group = useGroup({ view });\n const sort = useSort({ view });\n const { actions, actionsButtonRef, selectedActionContent } = useMore({ view });\n const enableActionsMenu = selectionMode === SELECTION_MODES.multi && selectedRecordsCount !== 0;\n const activePersonalization = state.personalization?.active;\n const activePersonalizationName =\n state.personalization?.allPersonalizations?.[activePersonalization]?.name;\n const viewName = activePersonalizationName ? `${title}: ${activePersonalizationName}` : title;\n const formControlProps = useFormControlProps(view);\n const wrapAction = useWrapAction(view);\n\n const additionalActions = (\n <>\n {basicMode && (\n <ToolbarActions\n toolbarActions={toolbarActions?.filter(action => !action.id.startsWith('Add'))}\n />\n )}\n {allowBulkActions && template !== REPEATING_STRUCTURE_TEMPLATES.TIMELINE && (\n <ActionsMenu enableActionsMenu={enableActionsMenu} view={view} />\n )}\n </>\n );\n const responsiveAdditionalActions =\n isSmallOrAbove || enableActionsMenu ? additionalActions : undefined;\n\n const createNewAction = toolbarActions?.find(action => action.id.startsWith('Add'));\n const createNew =\n createNewAction && basicMode\n ? {\n label: createNewAction?.text,\n onClick: createNewAction.onClick\n }\n : undefined;\n\n const Toolbar =\n template === REPEATING_STRUCTURE_TEMPLATES.MAP ? (\n <MapToolbar\n locationFieldId={mapFieldIds?.location}\n name={title}\n showName={showTitle}\n headingTag={headingTag}\n formControlProps={formControlProps}\n rows={rows}\n count={count}\n createNew={createNew}\n additionalActions={responsiveAdditionalActions}\n ref={toolbarRef}\n />\n ) : (\n <>\n <ListToolbar\n name={title}\n showName={showTitle}\n headingTag={headingTag}\n formControlProps={formControlProps}\n viewSelector={viewSelector}\n search={search}\n count={count}\n additionalActions={responsiveAdditionalActions}\n filter={filter}\n group={showFeatureForTemplate(template, 'group') && group}\n sort={sort}\n actions={actions}\n actionsButtonRef={actionsButtonRef}\n createNew={createNew}\n wrap={wrapAction}\n ref={toolbarRef}\n />\n {selectedActionContent}\n {createEditViewContent}\n </>\n );\n\n return (\n <AnnounceRowsCount\n state={state}\n count={count}\n isLoading={isLoading}\n announceCount={announceCount}\n >\n <ValidateMessage message={validatemessage}>\n {Toolbar}\n {/* FIXME: This implementation of error status should be considered temporary until an official, and properly accessible, spec is determined. */}\n </ValidateMessage>\n {refreshNotification && (\n <RefreshBanner\n refreshNotification={refreshNotification}\n forceRefresh={forceRefresh}\n viewName={viewName}\n allowRefresh={allowRefresh}\n />\n )}\n </AnnounceRowsCount>\n );\n}\n\nAdvanceToolbar.propTypes = {\n view: PropTypes.objectOf(PropTypes.any).isRequired\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ListToolbarProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent, ListToolbarProps } from '@pega/cosmos-react-core';
|
|
2
2
|
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
3
3
|
interface MapToolbarProps extends ListToolbarProps {
|
|
4
4
|
locationFieldId: NonNullable<RsCoreTypes.View['meta']['mapFieldIds']>['location'];
|
|
5
5
|
rows: RsCoreTypes.View['rows'];
|
|
6
6
|
}
|
|
7
|
-
declare const MapToolbar:
|
|
7
|
+
declare const MapToolbar: ForwardRefForwardPropsComponent<MapToolbarProps>;
|
|
8
8
|
export default MapToolbar;
|
|
9
9
|
//# sourceMappingURL=MapToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapToolbar.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/Map/MapToolbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapToolbar.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/Map/MapToolbar.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,UAAU,eAAgB,SAAQ,gBAAgB;IAChD,eAAe,EAAE,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAClF,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;CAChC;AAMD,QAAA,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CA2C/D,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { getGoogleMapsDirHref, ListToolbar, useI18n } from '@pega/cosmos-react-core';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import { Button, Flex, getGoogleMapsDirHref, Icon, ListToolbar, useI18n } from '@pega/cosmos-react-core';
|
|
4
4
|
import getValue from '../../../Views/Map/utils';
|
|
5
|
-
|
|
5
|
+
// getValue stringifies missing/nullish field values (e.g. to 'undefined' or 'null'), so those must be filtered out explicitly.
|
|
6
|
+
const isValidLocation = (location) => Boolean(location) && location !== 'undefined' && location !== 'null';
|
|
7
|
+
const MapToolbar = forwardRef(function MapToolbar({ locationFieldId, rows, additionalActions, ...restProps }, ref) {
|
|
6
8
|
const t = useI18n();
|
|
7
9
|
const routeHref = useMemo(() => {
|
|
8
10
|
if (!rows || rows.length < 1 || !locationFieldId)
|
|
9
11
|
return '';
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
+
const locations = rows
|
|
13
|
+
.map(({ rowData }) => getValue(rowData, locationFieldId))
|
|
14
|
+
.filter(isValidLocation);
|
|
15
|
+
if (locations.length < 1)
|
|
16
|
+
return '';
|
|
17
|
+
const waypoints = locations.slice(0, -1);
|
|
18
|
+
const [destination] = locations.slice(-1);
|
|
12
19
|
return getGoogleMapsDirHref(destination, waypoints);
|
|
13
20
|
}, [rows, locationFieldId]);
|
|
14
|
-
return (_jsx(ListToolbar, { ...restProps,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
href: routeHref,
|
|
19
|
-
onClick: (id, e) => {
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
window.open(routeHref, '_blank');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
] }));
|
|
25
|
-
};
|
|
21
|
+
return (_jsx(ListToolbar, { ...restProps, ref: ref, additionalActions: _jsxs(_Fragment, { children: [additionalActions, _jsx(Button, { disabled: !routeHref, ...(routeHref
|
|
22
|
+
? { href: routeHref, target: '_blank', rel: 'noopener noreferrer' }
|
|
23
|
+
: {}), children: _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Icon, { name: 'route' }), t('get_directions')] }) })] }) }));
|
|
24
|
+
});
|
|
26
25
|
export default MapToolbar;
|
|
27
26
|
//# sourceMappingURL=MapToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapToolbar.js","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/Map/MapToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MapToolbar.js","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/Map/MapToolbar.tsx"],"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;IAE5B,OAAO,CACL,KAAC,WAAW,OACN,SAAS,EACb,GAAG,EAAE,GAAG,EACR,iBAAiB,EACf,8BACG,iBAAiB,EAClB,KAAC,MAAM,IACL,QAAQ,EAAE,CAAC,SAAS,KAChB,CAAC,SAAS;wBACZ,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,qBAAqB,EAAE;wBACnE,CAAC,CAAC,EAAE,CAAC,YAEP,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAC,MAAM,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,EACpB,CAAC,CAAC,gBAAgB,CAAC,IACf,GACA,IACR,GAEL,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useMemo } from 'react';\n\nimport {\n Button,\n Flex,\n getGoogleMapsDirHref,\n Icon,\n ListToolbar,\n useI18n\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ListToolbarProps } from '@pega/cosmos-react-core';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport getValue from '../../../Views/Map/utils';\n\ninterface MapToolbarProps extends ListToolbarProps {\n locationFieldId: NonNullable<RsCoreTypes.View['meta']['mapFieldIds']>['location'];\n rows: RsCoreTypes.View['rows'];\n}\n\n// getValue stringifies missing/nullish field values (e.g. to 'undefined' or 'null'), so those must be filtered out explicitly.\nconst isValidLocation = (location: string): boolean =>\n Boolean(location) && location !== 'undefined' && location !== 'null';\n\nconst MapToolbar: ForwardRefForwardPropsComponent<MapToolbarProps> = forwardRef(function MapToolbar(\n { locationFieldId, rows, additionalActions, ...restProps }: MapToolbarProps,\n ref: MapToolbarProps['ref']\n) {\n const t = useI18n();\n\n const routeHref = useMemo(() => {\n if (!rows || rows.length < 1 || !locationFieldId) return '';\n\n const locations = rows\n .map(({ rowData }) => getValue(rowData, locationFieldId))\n .filter(isValidLocation);\n\n if (locations.length < 1) return '';\n\n const waypoints = locations.slice(0, -1);\n const [destination] = locations.slice(-1);\n\n return getGoogleMapsDirHref(destination, waypoints);\n }, [rows, locationFieldId]);\n\n return (\n <ListToolbar\n {...restProps}\n ref={ref}\n additionalActions={\n <>\n {additionalActions}\n <Button\n disabled={!routeHref}\n {...(routeHref\n ? { href: routeHref, target: '_blank', rel: 'noopener noreferrer' }\n : {})}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='route' />\n {t('get_directions')}\n </Flex>\n </Button>\n </>\n }\n />\n );\n});\n\nexport default MapToolbar;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-react",
|
|
3
|
-
"version": "10.0.0-build.9.
|
|
3
|
+
"version": "10.0.0-build.9.1",
|
|
4
4
|
"description": "Repeating view structures such as Table, Gallery(Repeating layouts), Kanban etc.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "10.0.0-build.9.
|
|
18
|
-
"@pega/cosmos-react-core": "10.0.0-build.9.
|
|
19
|
-
"@pega/cosmos-react-rte": "10.0.0-build.9.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "10.0.0-build.9.1",
|
|
18
|
+
"@pega/cosmos-react-core": "10.0.0-build.9.1",
|
|
19
|
+
"@pega/cosmos-react-rte": "10.0.0-build.9.1",
|
|
20
20
|
"@types/lodash-es": "^4.17.12",
|
|
21
21
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
22
22
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
23
23
|
"dayjs": "^1.11.13",
|
|
24
24
|
"fast-deep-equal": "^3.1.3",
|
|
25
25
|
"lodash-es": "^4.18.1",
|
|
26
|
-
"pega-repeating-structures-core": "npm:@pega/lists-core@10.0.0-build.9.
|
|
27
|
-
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@10.0.0-build.9.
|
|
26
|
+
"pega-repeating-structures-core": "npm:@pega/lists-core@10.0.0-build.9.1",
|
|
27
|
+
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@10.0.0-build.9.1",
|
|
28
28
|
"polished": "^4.1.0",
|
|
29
29
|
"prop-types": "^15.8.1",
|
|
30
30
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@testing-library/react": "^16.0.0",
|
|
43
43
|
"@testing-library/user-event": "^14.6.1",
|
|
44
44
|
"jest-axe": "^8.0.0",
|
|
45
|
-
"srs-utils": "10.0.0-build.9.
|
|
45
|
+
"srs-utils": "10.0.0-build.9.1",
|
|
46
46
|
"typescript": "~6.0.3"
|
|
47
47
|
}
|
|
48
48
|
}
|