@digital-ai/dot-components 3.20.0 → 3.20.2
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 +39 -29
- package/package.json +1 -1
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",
|
|
@@ -11773,7 +11775,7 @@ function DotDashboardActions({
|
|
|
11773
11775
|
setDashboardToPublish(null);
|
|
11774
11776
|
setDashboardToUnpublish(null);
|
|
11775
11777
|
onStatusChanged && onStatusChanged(publishedDashboard);
|
|
11776
|
-
}, []);
|
|
11778
|
+
}, [onStatusChanged]);
|
|
11777
11779
|
const handlePublishConfirmClose = useCallback(() => {
|
|
11778
11780
|
setDashboardToPublish(null);
|
|
11779
11781
|
setDashboardToUnpublish(null);
|
|
@@ -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,
|
|
@@ -16222,7 +16225,16 @@ const DotTableActions = ({
|
|
|
16222
16225
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
16223
16226
|
const [showMenu, setShowMenu] = useState(false);
|
|
16224
16227
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
16228
|
+
const [_resizeListener, setResizeListener] = useState(null);
|
|
16225
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
|
+
};
|
|
16226
16238
|
const items = actions.map(action => ({
|
|
16227
16239
|
ariaLabel: action.ariaLabel,
|
|
16228
16240
|
children: getMenuItem(action),
|
|
@@ -16236,35 +16248,33 @@ const DotTableActions = ({
|
|
|
16236
16248
|
});
|
|
16237
16249
|
setSelectionMap(map);
|
|
16238
16250
|
checkForOverflowing();
|
|
16239
|
-
|
|
16251
|
+
setResizeListener(orig => {
|
|
16252
|
+
if (orig) {
|
|
16253
|
+
window.removeEventListener('resize', orig);
|
|
16254
|
+
}
|
|
16255
|
+
window.addEventListener('resize', checkForOverflowing);
|
|
16256
|
+
return checkForOverflowing;
|
|
16257
|
+
});
|
|
16240
16258
|
return () => {
|
|
16241
16259
|
window.removeEventListener('resize', checkForOverflowing);
|
|
16242
16260
|
};
|
|
16243
|
-
}, []);
|
|
16244
|
-
const
|
|
16245
|
-
if (actions.length > 1) {
|
|
16246
|
-
const actionIcons = document.getElementsByClassName('dot-table-action-icon');
|
|
16247
|
-
const actionTableCellWidth = 3 * (actionIcons.length > 0 && actionIcons[0].clientWidth);
|
|
16248
|
-
const isOverflowing = actionTableCellWidth > (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current.clientWidth);
|
|
16249
|
-
setShowMenu(isOverflowing);
|
|
16250
|
-
}
|
|
16251
|
-
};
|
|
16252
|
-
const toggleMenu = event => {
|
|
16261
|
+
}, [actions]);
|
|
16262
|
+
const toggleMenu = useCallback(event => {
|
|
16253
16263
|
event.stopPropagation();
|
|
16254
16264
|
setAnchorEl(event.currentTarget);
|
|
16255
|
-
setMenuOpen(!
|
|
16256
|
-
};
|
|
16257
|
-
const onSelect = (event, _menuId, itemKey) => {
|
|
16265
|
+
setMenuOpen(wasOpen => !wasOpen);
|
|
16266
|
+
}, []);
|
|
16267
|
+
const onSelect = useCallback((event, _menuId, itemKey) => {
|
|
16258
16268
|
event.stopPropagation();
|
|
16259
16269
|
selectionMap[itemKey].onClick(null);
|
|
16260
|
-
};
|
|
16261
|
-
const onLeave = () => {
|
|
16270
|
+
}, [selectionMap]);
|
|
16271
|
+
const onLeave = useCallback(() => {
|
|
16262
16272
|
setMenuOpen(false);
|
|
16263
|
-
};
|
|
16264
|
-
const handleTableActionClick = (event, action) => {
|
|
16273
|
+
}, []);
|
|
16274
|
+
const handleTableActionClick = useCallback((event, action) => {
|
|
16265
16275
|
event.stopPropagation();
|
|
16266
16276
|
action.onClick(event);
|
|
16267
|
-
};
|
|
16277
|
+
}, []);
|
|
16268
16278
|
const renderTableActions = () => {
|
|
16269
16279
|
return actions && actions.map((action, index) => index < 2 && jsx(DotTableAction, {
|
|
16270
16280
|
"data-testid": action['data-testid'],
|