@digital-ai/dot-components 3.16.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
|
-
|
|
9718
|
+
if (dashboards) {
|
|
9719
|
+
setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardId));
|
|
9720
|
+
}
|
|
9719
9721
|
return true;
|
|
9720
9722
|
}).catch(error => {
|
|
9721
9723
|
setDashboardsError(error);
|
|
@@ -9923,6 +9925,7 @@ const DotSnackbar = ({
|
|
|
9923
9925
|
anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
|
|
9924
9926
|
anchorOriginTop = 108,
|
|
9925
9927
|
ariaLabel,
|
|
9928
|
+
autoCloseOnAction = false,
|
|
9926
9929
|
autoHideDuration,
|
|
9927
9930
|
children,
|
|
9928
9931
|
className,
|
|
@@ -9943,6 +9946,17 @@ const DotSnackbar = ({
|
|
|
9943
9946
|
onClose();
|
|
9944
9947
|
}
|
|
9945
9948
|
};
|
|
9949
|
+
const handlePrimaryActionClick = () => {
|
|
9950
|
+
primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.onClick();
|
|
9951
|
+
if (autoCloseOnAction) {
|
|
9952
|
+
onClose();
|
|
9953
|
+
}
|
|
9954
|
+
};
|
|
9955
|
+
const handleSecondaryActionClick = () => {
|
|
9956
|
+
if (autoCloseOnAction) {
|
|
9957
|
+
onClose();
|
|
9958
|
+
}
|
|
9959
|
+
};
|
|
9946
9960
|
return jsx(StyledSnackbar, {
|
|
9947
9961
|
anchorOrigin: anchorOrigin,
|
|
9948
9962
|
"$anchorOriginTop": anchorOriginTop,
|
|
@@ -9978,14 +9992,15 @@ const DotSnackbar = ({
|
|
|
9978
9992
|
children: [primaryAction && jsx(DotButton, {
|
|
9979
9993
|
className: "primary-action-btn",
|
|
9980
9994
|
"data-testid": "primary-action-btn",
|
|
9981
|
-
onClick:
|
|
9995
|
+
onClick: handlePrimaryActionClick,
|
|
9982
9996
|
size: "small",
|
|
9983
9997
|
type: "outlined",
|
|
9984
9998
|
children: primaryAction.label
|
|
9985
9999
|
}), secondaryAction && jsx(DotLink, {
|
|
10000
|
+
color: "inherit",
|
|
9986
10001
|
"data-testid": "secondary-action-link",
|
|
9987
10002
|
href: secondaryAction.href,
|
|
9988
|
-
|
|
10003
|
+
onClick: handleSecondaryActionClick,
|
|
9989
10004
|
children: secondaryAction.label
|
|
9990
10005
|
})]
|
|
9991
10006
|
})]
|
|
@@ -10017,6 +10032,7 @@ const DotSnackbarContext = createContext({
|
|
|
10017
10032
|
removeMessage: _id => null
|
|
10018
10033
|
});
|
|
10019
10034
|
const DotSnackbarContainer = ({
|
|
10035
|
+
autoCloseOnAction,
|
|
10020
10036
|
hideOnClickAway
|
|
10021
10037
|
}) => {
|
|
10022
10038
|
const {
|
|
@@ -10035,6 +10051,7 @@ const DotSnackbarContainer = ({
|
|
|
10035
10051
|
"data-testid": rootClassName$F,
|
|
10036
10052
|
children: alerts.slice().reverse().map(alert => {
|
|
10037
10053
|
return jsx(DotSnackbar, {
|
|
10054
|
+
autoCloseOnAction: autoCloseOnAction,
|
|
10038
10055
|
autoHideDuration: alert.autoHideDuration,
|
|
10039
10056
|
hideOnClickAway: hideOnClickAway,
|
|
10040
10057
|
onClose: handleClose(alert.id),
|
|
@@ -10049,6 +10066,7 @@ const DotSnackbarContainer = ({
|
|
|
10049
10066
|
});
|
|
10050
10067
|
};
|
|
10051
10068
|
const DotSnackbarProvider = ({
|
|
10069
|
+
autoCloseOnAction = false,
|
|
10052
10070
|
children,
|
|
10053
10071
|
hideOnClickAway = true
|
|
10054
10072
|
}) => {
|
|
@@ -10087,6 +10105,7 @@ const DotSnackbarProvider = ({
|
|
|
10087
10105
|
return jsxs(DotSnackbarContext.Provider, {
|
|
10088
10106
|
value: memoizedValues,
|
|
10089
10107
|
children: [jsx(DotSnackbarContainer, {
|
|
10108
|
+
autoCloseOnAction: autoCloseOnAction,
|
|
10090
10109
|
hideOnClickAway: hideOnClickAway
|
|
10091
10110
|
}), children]
|
|
10092
10111
|
});
|
|
@@ -10875,7 +10894,7 @@ function HighImpact({
|
|
|
10875
10894
|
const defaultMessage = useMemo(() => jsxs(DotTypography, {
|
|
10876
10895
|
className: "high-impact-default-content",
|
|
10877
10896
|
variant: "body1",
|
|
10878
|
-
children: ["This action cannot be undone. This will permanently", ' ', action.toUpperCase(), objectType
|
|
10897
|
+
children: ["This action cannot be undone. This will permanently", ' ', action.toUpperCase(), objectType ? ' the ' : ' ', jsx("span", {
|
|
10879
10898
|
className: "item-name",
|
|
10880
10899
|
children: record
|
|
10881
10900
|
}), objectType && ` ${objectType}`, ". Some data may be lost."]
|
|
@@ -11440,6 +11459,7 @@ const StyledDotMenu = styled(DotMenu)`
|
|
|
11440
11459
|
function DotDashboardOptionsMenu({
|
|
11441
11460
|
dashboard,
|
|
11442
11461
|
isEdit = false,
|
|
11462
|
+
menuPlacement,
|
|
11443
11463
|
onStartDelete,
|
|
11444
11464
|
onStartDuplicate,
|
|
11445
11465
|
onStartStatusChange,
|
|
@@ -11560,6 +11580,16 @@ function DotDashboardOptionsMenu({
|
|
|
11560
11580
|
onClick: () => onDetails(dashboard)
|
|
11561
11581
|
});
|
|
11562
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
|
+
}, []);
|
|
11563
11593
|
return menuItems.length > 0 ? jsxs(Fragment, {
|
|
11564
11594
|
children: [jsx(DotIconButton, {
|
|
11565
11595
|
className: "expand-button",
|
|
@@ -11574,6 +11604,7 @@ function DotDashboardOptionsMenu({
|
|
|
11574
11604
|
id: "card-header-action-menu",
|
|
11575
11605
|
menuItemHeight: "auto",
|
|
11576
11606
|
menuItems: menuItems,
|
|
11607
|
+
menuPlacement: menuPlacement,
|
|
11577
11608
|
open: open,
|
|
11578
11609
|
onLeave: handleMenuClose
|
|
11579
11610
|
})]
|
|
@@ -11760,7 +11791,8 @@ function DotDashboardActions({
|
|
|
11760
11791
|
}), dashboardToDelete && jsx(DotImpactDialog, {
|
|
11761
11792
|
onCancel: handleDeleteClose,
|
|
11762
11793
|
onSubmit: handleDeleteSubmit,
|
|
11763
|
-
record: dashboardToDelete
|
|
11794
|
+
record: dashboardToDelete.name,
|
|
11795
|
+
impact: dashboardToDelete.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED ? 'high' : 'medium',
|
|
11764
11796
|
open: true
|
|
11765
11797
|
}), jsx(HelpButton, {
|
|
11766
11798
|
dashboard: dashboard
|
|
@@ -11770,6 +11802,7 @@ function DotDashboardActions({
|
|
|
11770
11802
|
}), canEdit && jsx(DotDashboardOptionsMenu, {
|
|
11771
11803
|
dashboard: dashboard,
|
|
11772
11804
|
isEdit: isEdit,
|
|
11805
|
+
menuPlacement: "bottom-start",
|
|
11773
11806
|
onViewMode: onViewMode,
|
|
11774
11807
|
onStartStatusChange: handleStartStatusChangeIfConfig,
|
|
11775
11808
|
onStartDuplicate: handleStartDuplicateIfConfig,
|
|
@@ -13448,34 +13481,25 @@ const getWarningAdornment = () => {
|
|
|
13448
13481
|
};
|
|
13449
13482
|
const applyBindings = (bindings, inlineEditText) => {
|
|
13450
13483
|
if (!bindings || !bindings.length || !inlineEditText) return;
|
|
13451
|
-
let
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
bindingStringIndex = text.indexOf(stringBinding);
|
|
13469
|
-
// Add nodes to array
|
|
13470
|
-
boundNode = [boundNode, previousText, className ? jsx("span", {
|
|
13471
|
-
className: className,
|
|
13472
|
-
children: value
|
|
13473
|
-
}, `${index}-${key}`) : value];
|
|
13474
|
-
}
|
|
13484
|
+
let result = [inlineEditText];
|
|
13485
|
+
const getBoundSpan = (value, className, key) => className ? jsx("span", {
|
|
13486
|
+
className: className,
|
|
13487
|
+
children: value
|
|
13488
|
+
}, key) : value;
|
|
13489
|
+
bindings.forEach(({
|
|
13490
|
+
binding,
|
|
13491
|
+
className,
|
|
13492
|
+
value
|
|
13493
|
+
}, index) => {
|
|
13494
|
+
result = result.flatMap((part, i) => {
|
|
13495
|
+
if (typeof part === 'string') {
|
|
13496
|
+
// Split the text by the binding and interleave with the replacement value
|
|
13497
|
+
return part.split(binding).flatMap((textPart, j, arr) => [textPart, j < arr.length - 1 ? getBoundSpan(value, className, `${index}-${i}-${j}`) : null]);
|
|
13498
|
+
}
|
|
13499
|
+
return part;
|
|
13500
|
+
});
|
|
13475
13501
|
});
|
|
13476
|
-
|
|
13477
|
-
boundNode = [boundNode, text];
|
|
13478
|
-
return boundNode;
|
|
13502
|
+
return result;
|
|
13479
13503
|
};
|
|
13480
13504
|
const checkIfEmptyValue = inputValue => inputValue.trim() === '';
|
|
13481
13505
|
|
package/package.json
CHANGED
|
@@ -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 {};
|
|
@@ -15,6 +15,8 @@ export interface SnackbarProps extends CommonProps {
|
|
|
15
15
|
anchorOrigin?: SnackbarOrigin;
|
|
16
16
|
/** When specified, will set `top` property (in pixels) only for the vertical top origins */
|
|
17
17
|
anchorOriginTop?: number;
|
|
18
|
+
/** Automatically triggers onClose handler when primary or secondary action has been clicked */
|
|
19
|
+
autoCloseOnAction?: boolean;
|
|
18
20
|
/** The number of milliseconds to wait before automatically closing the snackbar. If null is passed, then the snackbar never automatically closes. If the prop is not passed at all, then snackbars close after 10 seconds (except error snackbar which never closes automatically). */
|
|
19
21
|
autoHideDuration?: number | null;
|
|
20
22
|
/** The message the user sees once the alert displays. */
|
|
@@ -34,4 +36,4 @@ export interface SnackbarProps extends CommonProps {
|
|
|
34
36
|
/** Width of the encapsulated Alert component. */
|
|
35
37
|
width?: string;
|
|
36
38
|
}
|
|
37
|
-
export declare const DotSnackbar: ({ anchorOrigin, anchorOriginTop, ariaLabel, autoHideDuration, children, className, "data-testid": dataTestId, hideOnClickAway, onClose, open, primaryAction, secondaryAction, severity, width, }: SnackbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const DotSnackbar: ({ anchorOrigin, anchorOriginTop, ariaLabel, autoCloseOnAction, autoHideDuration, children, className, "data-testid": dataTestId, hideOnClickAway, onClose, open, primaryAction, secondaryAction, severity, width, }: SnackbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,11 +11,13 @@ declare const initialState: {
|
|
|
11
11
|
secondaryAction: SnackbarSecondaryAction;
|
|
12
12
|
}[];
|
|
13
13
|
export interface SnackbarProviderProps {
|
|
14
|
+
autoCloseOnAction?: boolean;
|
|
14
15
|
/** The components or string that load inside the snackbar provider. */
|
|
15
16
|
children: ReactNode;
|
|
16
17
|
hideOnClickAway?: boolean;
|
|
17
18
|
}
|
|
18
19
|
interface SnackbarContainerProps {
|
|
20
|
+
autoCloseOnAction?: boolean;
|
|
19
21
|
hideOnClickAway?: boolean;
|
|
20
22
|
}
|
|
21
23
|
interface DotSnackbarProps {
|
|
@@ -24,8 +26,8 @@ interface DotSnackbarProps {
|
|
|
24
26
|
removeMessage: (id: string) => void;
|
|
25
27
|
}
|
|
26
28
|
export declare const DotSnackbarContext: import("react").Context<DotSnackbarProps>;
|
|
27
|
-
export declare const DotSnackbarContainer: ({ hideOnClickAway, }: SnackbarContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export declare const DotSnackbarProvider: ({ children, hideOnClickAway, }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const DotSnackbarContainer: ({ autoCloseOnAction, hideOnClickAway, }: SnackbarContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const DotSnackbarProvider: ({ autoCloseOnAction, children, hideOnClickAway, }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
31
|
export declare const useDotSnackbarContext: () => DotSnackbarProps;
|
|
30
32
|
export declare const useEnqueueErrorMessage: (error: GenericApiError | Error) => void;
|
|
31
33
|
export {};
|