@digital-ai/dot-components 3.19.0 → 3.20.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/index.esm.js
CHANGED
|
@@ -11602,13 +11602,15 @@ function DotDashboardOptionsMenu({
|
|
|
11602
11602
|
});
|
|
11603
11603
|
}
|
|
11604
11604
|
if (onDetails) {
|
|
11605
|
-
menuItems.
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11605
|
+
if (menuItems.length > 0) {
|
|
11606
|
+
menuItems.push({
|
|
11607
|
+
children: jsx("div", {
|
|
11608
|
+
className: "dashboard-details-border"
|
|
11609
|
+
}),
|
|
11610
|
+
disabled: true,
|
|
11611
|
+
key: 'dashboard-details-border'
|
|
11612
|
+
});
|
|
11613
|
+
}
|
|
11612
11614
|
menuItems.push({
|
|
11613
11615
|
children: jsxs(DotLink, {
|
|
11614
11616
|
ariaLabel: "Dashboard details",
|
|
@@ -11817,6 +11819,7 @@ function DotDashboardActions({
|
|
|
11817
11819
|
const handleStartDuplicateIfConfig = onDuplicated ? handleStartDuplicate : undefined;
|
|
11818
11820
|
const handleStartStatusChangeIfConfig = onStatusChanged ? handleStartStatusChange : undefined;
|
|
11819
11821
|
const handleStartDeleteIfConfig = onDeleted ? handleStartDelete : undefined;
|
|
11822
|
+
const handleViewModeIfConfig = onViewMode && canEdit ? onViewMode : undefined;
|
|
11820
11823
|
return jsxs(StyledDashboardActions, {
|
|
11821
11824
|
"data-testid": "dot-dashboard-actions",
|
|
11822
11825
|
children: [jsx(DotDashboardPublishConfirm, {
|
|
@@ -11843,11 +11846,11 @@ function DotDashboardActions({
|
|
|
11843
11846
|
}), onFavorite && jsx(FavoriteButton, {
|
|
11844
11847
|
dashboard: dashboard,
|
|
11845
11848
|
onFavorite: onFavorite
|
|
11846
|
-
}),
|
|
11849
|
+
}), jsx(DotDashboardOptionsMenu, {
|
|
11847
11850
|
dashboard: dashboard,
|
|
11848
11851
|
isEdit: isEdit,
|
|
11849
11852
|
menuPlacement: "bottom-start",
|
|
11850
|
-
onViewMode:
|
|
11853
|
+
onViewMode: handleViewModeIfConfig,
|
|
11851
11854
|
onStartStatusChange: handleStartStatusChangeIfConfig,
|
|
11852
11855
|
onStartDuplicate: handleStartDuplicateIfConfig,
|
|
11853
11856
|
onStartDelete: handleStartDeleteIfConfig,
|
|
@@ -11869,6 +11872,15 @@ const StyledDashboardHeader = styled(DotActionToolbar)`
|
|
|
11869
11872
|
padding: ${theme.spacing(0, 2)};
|
|
11870
11873
|
`}
|
|
11871
11874
|
`;
|
|
11875
|
+
const StyledDashboardHeaderTitleSection = styled.div`
|
|
11876
|
+
${({
|
|
11877
|
+
theme
|
|
11878
|
+
}) => css`
|
|
11879
|
+
display: flex;
|
|
11880
|
+
align-items: center;
|
|
11881
|
+
gap: ${theme.spacing(2)};
|
|
11882
|
+
`}
|
|
11883
|
+
`;
|
|
11872
11884
|
|
|
11873
11885
|
function DotDashboardHeader({
|
|
11874
11886
|
accountId,
|
|
@@ -11880,7 +11892,8 @@ function DotDashboardHeader({
|
|
|
11880
11892
|
onStatusChanged,
|
|
11881
11893
|
onDeleted,
|
|
11882
11894
|
onDuplicated,
|
|
11883
|
-
onViewMode
|
|
11895
|
+
onViewMode,
|
|
11896
|
+
showStatus = false
|
|
11884
11897
|
}) {
|
|
11885
11898
|
const {
|
|
11886
11899
|
applications,
|
|
@@ -11898,10 +11911,14 @@ function DotDashboardHeader({
|
|
|
11898
11911
|
loadApplications(accountId);
|
|
11899
11912
|
}, []);
|
|
11900
11913
|
return jsxs(StyledDashboardHeader, {
|
|
11901
|
-
children: [
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11914
|
+
children: [jsxs(StyledDashboardHeaderTitleSection, {
|
|
11915
|
+
children: [jsx(DotTypography, {
|
|
11916
|
+
component: "h2",
|
|
11917
|
+
variant: "h2",
|
|
11918
|
+
children: dashboard === null || dashboard === void 0 ? void 0 : dashboard.name
|
|
11919
|
+
}), showStatus && jsx(DotDashboardStatusPill, {
|
|
11920
|
+
status: dashboard.lifecycle_state
|
|
11921
|
+
})]
|
|
11905
11922
|
}), jsx(DotDashboardActions, {
|
|
11906
11923
|
applications: applications,
|
|
11907
11924
|
canEdit: canEdit,
|
|
@@ -16208,7 +16225,16 @@ const DotTableActions = ({
|
|
|
16208
16225
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
16209
16226
|
const [showMenu, setShowMenu] = useState(false);
|
|
16210
16227
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
16228
|
+
const [_resizeListener, setResizeListener] = useState(null);
|
|
16211
16229
|
useEffect(() => {
|
|
16230
|
+
const checkForOverflowing = () => {
|
|
16231
|
+
if (actions.length > 1) {
|
|
16232
|
+
const actionIcons = document.getElementsByClassName('dot-table-action-icon');
|
|
16233
|
+
const actionTableCellWidth = 3 * (actionIcons.length > 0 && actionIcons[0].clientWidth);
|
|
16234
|
+
const isOverflowing = actionTableCellWidth > (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current.clientWidth);
|
|
16235
|
+
setShowMenu(isOverflowing);
|
|
16236
|
+
}
|
|
16237
|
+
};
|
|
16212
16238
|
const items = actions.map(action => ({
|
|
16213
16239
|
ariaLabel: action.ariaLabel,
|
|
16214
16240
|
children: getMenuItem(action),
|
|
@@ -16222,35 +16248,33 @@ const DotTableActions = ({
|
|
|
16222
16248
|
});
|
|
16223
16249
|
setSelectionMap(map);
|
|
16224
16250
|
checkForOverflowing();
|
|
16225
|
-
|
|
16251
|
+
setResizeListener(orig => {
|
|
16252
|
+
if (orig) {
|
|
16253
|
+
window.removeEventListener('resize', orig);
|
|
16254
|
+
}
|
|
16255
|
+
window.addEventListener('resize', checkForOverflowing);
|
|
16256
|
+
return checkForOverflowing;
|
|
16257
|
+
});
|
|
16226
16258
|
return () => {
|
|
16227
16259
|
window.removeEventListener('resize', checkForOverflowing);
|
|
16228
16260
|
};
|
|
16229
|
-
}, []);
|
|
16230
|
-
const
|
|
16231
|
-
if (actions.length > 1) {
|
|
16232
|
-
const actionIcons = document.getElementsByClassName('dot-table-action-icon');
|
|
16233
|
-
const actionTableCellWidth = 3 * (actionIcons.length > 0 && actionIcons[0].clientWidth);
|
|
16234
|
-
const isOverflowing = actionTableCellWidth > (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current.clientWidth);
|
|
16235
|
-
setShowMenu(isOverflowing);
|
|
16236
|
-
}
|
|
16237
|
-
};
|
|
16238
|
-
const toggleMenu = event => {
|
|
16261
|
+
}, [actions]);
|
|
16262
|
+
const toggleMenu = useCallback(event => {
|
|
16239
16263
|
event.stopPropagation();
|
|
16240
16264
|
setAnchorEl(event.currentTarget);
|
|
16241
|
-
setMenuOpen(!
|
|
16242
|
-
};
|
|
16243
|
-
const onSelect = (event, _menuId, itemKey) => {
|
|
16265
|
+
setMenuOpen(wasOpen => !wasOpen);
|
|
16266
|
+
}, []);
|
|
16267
|
+
const onSelect = useCallback((event, _menuId, itemKey) => {
|
|
16244
16268
|
event.stopPropagation();
|
|
16245
16269
|
selectionMap[itemKey].onClick(null);
|
|
16246
|
-
};
|
|
16247
|
-
const onLeave = () => {
|
|
16270
|
+
}, [selectionMap]);
|
|
16271
|
+
const onLeave = useCallback(() => {
|
|
16248
16272
|
setMenuOpen(false);
|
|
16249
|
-
};
|
|
16250
|
-
const handleTableActionClick = (event, action) => {
|
|
16273
|
+
}, []);
|
|
16274
|
+
const handleTableActionClick = useCallback((event, action) => {
|
|
16251
16275
|
event.stopPropagation();
|
|
16252
16276
|
action.onClick(event);
|
|
16253
|
-
};
|
|
16277
|
+
}, []);
|
|
16254
16278
|
const renderTableActions = () => {
|
|
16255
16279
|
return actions && actions.map((action, index) => index < 2 && jsx(DotTableAction, {
|
|
16256
16280
|
"data-testid": action['data-testid'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DashboardActionsCommonProps } from '../dashboard-actions/DashboardActions';
|
|
2
2
|
interface DashboardHeaderProps extends DashboardActionsCommonProps {
|
|
3
3
|
accountId?: string;
|
|
4
|
+
showStatus?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare function DotDashboardHeader({ accountId, dashboard, isEdit, canEdit, onClose, onFavorite, onStatusChanged, onDeleted, onDuplicated, onViewMode, }: DashboardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DotDashboardHeader({ accountId, dashboard, isEdit, canEdit, onClose, onFavorite, onStatusChanged, onDeleted, onDuplicated, onViewMode, showStatus, }: DashboardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export { DashboardHeaderProps, DotDashboardHeader };
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const StyledDashboardHeader: import("styled-components").StyledComponent<({ ariaLabel, children, className, "data-testid": dataTestId, variant, }: import("../../action-toolbar/ActionToolbar").DotActionBarProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
2
|
+
export declare const StyledDashboardHeaderTitleSection: import("styled-components").StyledComponent<"div", any, {}, never>;
|