@digital-ai/dot-components 3.17.0 → 3.17.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
@@ -9715,7 +9715,9 @@ const DotMetadataApiProvider = ({
9715
9715
  setAccountIdHeader(accountId);
9716
9716
  return cancelablePromise(DashboardsService.deleteDashboardsService(dashboardId)).then(() => {
9717
9717
  setDashboardsError(null);
9718
- setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardId));
9718
+ if (dashboards) {
9719
+ setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardId));
9720
+ }
9719
9721
  return true;
9720
9722
  }).catch(error => {
9721
9723
  setDashboardsError(error);
@@ -10892,7 +10894,7 @@ function HighImpact({
10892
10894
  const defaultMessage = useMemo(() => jsxs(DotTypography, {
10893
10895
  className: "high-impact-default-content",
10894
10896
  variant: "body1",
10895
- children: ["This action cannot be undone. This will permanently", ' ', action.toUpperCase(), objectType && ' the ', jsx("span", {
10897
+ children: ["This action cannot be undone. This will permanently", ' ', action.toUpperCase(), objectType ? ' the ' : ' ', jsx("span", {
10896
10898
  className: "item-name",
10897
10899
  children: record
10898
10900
  }), objectType && ` ${objectType}`, ". Some data may be lost."]
@@ -11457,6 +11459,7 @@ const StyledDotMenu = styled(DotMenu)`
11457
11459
  function DotDashboardOptionsMenu({
11458
11460
  dashboard,
11459
11461
  isEdit = false,
11462
+ menuPlacement,
11460
11463
  onStartDelete,
11461
11464
  onStartDuplicate,
11462
11465
  onStartStatusChange,
@@ -11577,6 +11580,16 @@ function DotDashboardOptionsMenu({
11577
11580
  onClick: () => onDetails(dashboard)
11578
11581
  });
11579
11582
  }
11583
+ // useful since most of the screen is generally an iframe
11584
+ const blurHandler = useCallback(() => {
11585
+ setOpen(false);
11586
+ }, []);
11587
+ useEffect(() => {
11588
+ window.addEventListener('blur', blurHandler);
11589
+ return () => {
11590
+ window.removeEventListener('blur', blurHandler);
11591
+ };
11592
+ }, []);
11580
11593
  return menuItems.length > 0 ? jsxs(Fragment, {
11581
11594
  children: [jsx(DotIconButton, {
11582
11595
  className: "expand-button",
@@ -11591,6 +11604,7 @@ function DotDashboardOptionsMenu({
11591
11604
  id: "card-header-action-menu",
11592
11605
  menuItemHeight: "auto",
11593
11606
  menuItems: menuItems,
11607
+ menuPlacement: menuPlacement,
11594
11608
  open: open,
11595
11609
  onLeave: handleMenuClose
11596
11610
  })]
@@ -11777,7 +11791,8 @@ function DotDashboardActions({
11777
11791
  }), dashboardToDelete && jsx(DotImpactDialog, {
11778
11792
  onCancel: handleDeleteClose,
11779
11793
  onSubmit: handleDeleteSubmit,
11780
- record: dashboardToDelete === null || dashboardToDelete === void 0 ? void 0 : dashboardToDelete.name,
11794
+ record: dashboardToDelete.name,
11795
+ impact: dashboardToDelete.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED ? 'high' : 'medium',
11781
11796
  open: true
11782
11797
  }), jsx(HelpButton, {
11783
11798
  dashboard: dashboard
@@ -11787,6 +11802,7 @@ function DotDashboardActions({
11787
11802
  }), canEdit && jsx(DotDashboardOptionsMenu, {
11788
11803
  dashboard: dashboard,
11789
11804
  isEdit: isEdit,
11805
+ menuPlacement: "bottom-start",
11790
11806
  onViewMode: onViewMode,
11791
11807
  onStartStatusChange: handleStartStatusChangeIfConfig,
11792
11808
  onStartDuplicate: handleStartDuplicateIfConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "3.17.0",
3
+ "version": "3.17.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -1,12 +1,14 @@
1
+ import { PopperPlacement } from '../../menu/Menu';
1
2
  import { DashboardView } from '../metadata-api/openapi';
2
3
  interface DashboardOptionsMenuProps {
3
4
  dashboard: DashboardView;
4
5
  isEdit?: boolean;
6
+ menuPlacement?: PopperPlacement;
5
7
  onDetails?: (dashboard: DashboardView) => void;
6
8
  onStartDelete?: (dashboard: DashboardView) => void;
7
9
  onStartDuplicate?: (dashboard: DashboardView) => void;
8
10
  onStartStatusChange?: (dashboard: DashboardView, status: DashboardView.lifecycle_state) => void;
9
11
  onViewMode?: (dashboard: DashboardView, mode: string) => void;
10
12
  }
11
- export declare function DotDashboardOptionsMenu({ dashboard, isEdit, onStartDelete, onStartDuplicate, onStartStatusChange, onViewMode, onDetails, }: DashboardOptionsMenuProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function DotDashboardOptionsMenu({ dashboard, isEdit, menuPlacement, onStartDelete, onStartDuplicate, onStartStatusChange, onViewMode, onDetails, }: DashboardOptionsMenuProps): import("react/jsx-runtime").JSX.Element;
12
14
  export {};