@masterteam/client-components 0.0.120 → 0.0.121
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.
|
@@ -1933,6 +1933,18 @@ function isDestructiveAction(action) {
|
|
|
1933
1933
|
return (action.color === 'danger' ||
|
|
1934
1934
|
action.confirmation?.confirmationType === 'delete');
|
|
1935
1935
|
}
|
|
1936
|
+
/**
|
|
1937
|
+
* Whether a menu draws a divider above `menu[index]`: at the first destructive
|
|
1938
|
+
* item, and under an item flagged `dividerAfter`. Never at the top, and never
|
|
1939
|
+
* at the bottom (a divider is always drawn above an item).
|
|
1940
|
+
*/
|
|
1941
|
+
function dividerAbove(menu, index) {
|
|
1942
|
+
if (index <= 0 || !menu[index]) {
|
|
1943
|
+
return false;
|
|
1944
|
+
}
|
|
1945
|
+
return (!!menu[index - 1]?.dividerAfter ||
|
|
1946
|
+
(isDestructiveAction(menu[index]) && !isDestructiveAction(menu[index - 1])));
|
|
1947
|
+
}
|
|
1936
1948
|
/**
|
|
1937
1949
|
* A row's menu actions: hidden ones dropped, destructive ones last (the ⋮
|
|
1938
1950
|
* menu's order), the page's order kept within each group.
|
|
@@ -2210,14 +2222,12 @@ class ClientListCardsView {
|
|
|
2210
2222
|
this.bucket().filterTerm.set('');
|
|
2211
2223
|
this.bucket().filters.set({});
|
|
2212
2224
|
}
|
|
2213
|
-
/**
|
|
2225
|
+
/**
|
|
2226
|
+
* Whether a divider is drawn above this item: the first destructive one, or
|
|
2227
|
+
* the one after an item flagged `dividerAfter`.
|
|
2228
|
+
*/
|
|
2214
2229
|
isFirstDestructiveCardAction(card, index) {
|
|
2215
|
-
|
|
2216
|
-
const action = menu[index];
|
|
2217
|
-
return (index > 0 &&
|
|
2218
|
-
!!action &&
|
|
2219
|
-
isDestructiveAction(action) &&
|
|
2220
|
-
!isDestructiveAction(menu[index - 1]));
|
|
2230
|
+
return dividerAbove(this.menuActionsForCard(card), index);
|
|
2221
2231
|
}
|
|
2222
2232
|
showCardActionsMenu(card) {
|
|
2223
2233
|
return (this.isCardActionsLoading(card) || this.actionsFor(card).menu.length > 0);
|
|
@@ -2878,12 +2888,12 @@ class ClientListRowMenu {
|
|
|
2878
2888
|
.then(() => navigator.clipboard.writeText(link))
|
|
2879
2889
|
.then(() => toast.success(this.transloco.translate(`${TEXT}.linkCopied`)), () => toast.error(this.transloco.translate(`${TEXT}.copyFailed`)));
|
|
2880
2890
|
}
|
|
2881
|
-
/**
|
|
2891
|
+
/**
|
|
2892
|
+
* A divider goes above the first destructive item and under an item flagged
|
|
2893
|
+
* `dividerAfter`; never at the top.
|
|
2894
|
+
*/
|
|
2882
2895
|
firstDestructive(index) {
|
|
2883
|
-
|
|
2884
|
-
return (index > 0 &&
|
|
2885
|
-
isDestructiveAction(menu[index]) &&
|
|
2886
|
-
!isDestructiveAction(menu[index - 1]));
|
|
2896
|
+
return dividerAbove(this.menuActions(), index);
|
|
2887
2897
|
}
|
|
2888
2898
|
/** The action is running (its `loading`), as the ⋮ menu shows it. */
|
|
2889
2899
|
busy(action) {
|