@antelopejs/dms 0.21.4-next.998.gc2b0d73 → 0.22.0
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/CHANGELOG.md +114 -0
- package/README.md +2 -2
- package/dist/e2e/mongo.d.mts +5 -5
- package/dist/e2e/processes.d.mts +18 -4
- package/dist/implementations/dms/page/preview-models.d.ts +0 -2
- package/dist/implementations/dms-base/phone-number.d.ts +1 -0
- package/dist/implementations/dms-base/phone-number.js +17 -0
- package/dist/implementations/dms-base/phone-number.js.map +1 -0
- package/dist/implementations/dms-notifications/index.d.ts +5 -1
- package/dist/implementations/dms-notifications/index.js +39 -11
- package/dist/implementations/dms-notifications/index.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/page-verify/accounts.d.ts +2 -2
- package/dist/mcp/page-verify/accounts.js +21 -13
- package/dist/mcp/page-verify/accounts.js.map +1 -1
- package/dist/pages/settings/users/invite-resend.d.ts +4 -0
- package/dist/pages/settings/users/invite-resend.js +27 -19
- package/dist/pages/settings/users/invite-resend.js.map +1 -1
- package/dist/pages/settings/users/invites.d.ts +2 -4
- package/dist/pages/settings/users/invites.js +4 -17
- package/dist/pages/settings/users/invites.js.map +1 -1
- package/dist/pages/settings/users/notifications.d.ts +4 -1
- package/dist/pages/settings/users/notifications.js +12 -4
- package/dist/pages/settings/users/notifications.js.map +1 -1
- package/dist/store/internal/frontend/dev-reload.d.ts +7 -4
- package/dist/store/internal/frontend/dev-reload.js +16 -17
- package/dist/store/internal/frontend/dev-reload.js.map +1 -1
- package/dist/utils/notification-email.d.ts +13 -0
- package/dist/utils/notification-email.js +37 -0
- package/dist/utils/notification-email.js.map +1 -0
- package/dist/utils/notification-registry/index.d.ts +1 -0
- package/dist/utils/notification-registry/index.js +1 -0
- package/dist/utils/notification-registry/index.js.map +1 -1
- package/e2e/database.mjs +9 -3
- package/e2e/mongo.mjs +5 -5
- package/e2e/processes.mjs +32 -9
- package/e2e/run-state.mjs +40 -2
- package/frontend-vue/eslint-globals.generated.mjs +17 -17
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +20 -14
- package/frontend-vue/layers/dms-core/app/types/page.ts +1 -0
- package/frontend-vue/layers/dms-core/app/types/row-action.ts +2 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +1 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +1 -0
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +30 -29
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +4 -8
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +10 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationInboxItem.vue +8 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixSubject.vue +32 -1
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationPreferencesForm.vue +11 -1
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/notificationDisplay.ts +13 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationCatalog.ts +16 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationPreferences.ts +38 -3
- package/frontend-vue/layers/dms-layout/app/components/layout/DashboardSearch.vue +10 -0
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +4 -1
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +4 -1
- package/frontend-vue/layers/dms-ui/app/build/components/button/DisabledReason.vue +27 -0
- package/frontend-vue/layers/dms-ui/app/build/components/containers/TargetComponentTree.vue +2 -0
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/build/components/stat/StatCell.vue +2 -11
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +17 -17
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +19 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/fetchedConfirmDialog.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +12 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/global/shortcuts.ts +14 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/page/pageUrlValues.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +47 -31
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionRendering.ts +19 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnTypes.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/build/types/tree.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/phoneNumber.ts +143 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/DatePicker.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputCalendar.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputPhone.vue +165 -13
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputRelation.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputRepeater.vue +32 -1
- package/frontend-vue/layers/dms-ui/app/components/kpi/KpiCard.vue +1 -6
- package/frontend-vue/layers/dms-ui/app/entries/components/button/DisabledReason.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/components/stat/StatCell.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/global/shortcuts.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/phoneNumber.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/types/row-action.ts +2 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +10 -1
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +10 -1
- package/frontend-vue/package.json +1 -0
- package/package.json +6 -5
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { pageRoutePath } from "#dms-core/app/utils/pageRoutes";
|
|
2
2
|
import type { SaveStatusState } from "#dms-ui/app/components/save-bar/SaveStatus.vue";
|
|
3
3
|
import { useInstantSave } from "#dms-ui/app/entries/composables/instant-save/useInstantSave";
|
|
4
|
+
import { combineSaveStates } from "#dms-ui/app/composables/layout/useInstantSaveHeader";
|
|
4
5
|
import {
|
|
6
|
+
emailPreferenceKey,
|
|
5
7
|
hasFailed,
|
|
6
8
|
type NotificationCategory,
|
|
7
9
|
type NotificationSubject,
|
|
@@ -51,8 +53,23 @@ export const useNotificationPreferences = (
|
|
|
51
53
|
() => !(isStoredRead.value && catalog.isLoaded.value) && !loadFailed.value,
|
|
52
54
|
);
|
|
53
55
|
|
|
56
|
+
/** What an e-mail switch the user never touched reads, by its key. */
|
|
57
|
+
const emailDefaults = computed<PreferenceMap>(() =>
|
|
58
|
+
Object.fromEntries(
|
|
59
|
+
catalog.subjects.value.flatMap((subject) =>
|
|
60
|
+
subject.email
|
|
61
|
+
? [[emailPreferenceKey(subject), subject.email.defaultOn]]
|
|
62
|
+
: [],
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/** What a switch reads: the stored choice, else its default. */
|
|
68
|
+
const read = (key: string) =>
|
|
69
|
+
preferences.value[key] ?? emailDefaults.value[key] ?? true;
|
|
70
|
+
|
|
54
71
|
const instant = useInstantSave<PreferenceMap>({
|
|
55
|
-
read
|
|
72
|
+
read,
|
|
56
73
|
write: (key, enabled) => {
|
|
57
74
|
preferences.value = { ...preferences.value, [key]: enabled };
|
|
58
75
|
},
|
|
@@ -61,10 +78,22 @@ export const useNotificationPreferences = (
|
|
|
61
78
|
});
|
|
62
79
|
|
|
63
80
|
const isEnabled = (subject: NotificationSubject) =>
|
|
64
|
-
|
|
81
|
+
read(subjectPreferenceKey(subject));
|
|
65
82
|
|
|
83
|
+
/**
|
|
84
|
+
* As the server sends it: a locked subject is mailed whatever is stored,
|
|
85
|
+
* and a subject off in the app is not mailed at all.
|
|
86
|
+
*/
|
|
87
|
+
const isEmailEnabled = (subject: NotificationSubject) =>
|
|
88
|
+
subject.locked === true ||
|
|
89
|
+
(isEnabled(subject) && read(emailPreferenceKey(subject)));
|
|
90
|
+
|
|
91
|
+
/** The row's state cell sums up its in-app and e-mail switches. */
|
|
66
92
|
const rowState = (subject: NotificationSubject): SaveStatusState =>
|
|
67
|
-
|
|
93
|
+
combineSaveStates([
|
|
94
|
+
instant.states[subjectPreferenceKey(subject)],
|
|
95
|
+
instant.states[emailPreferenceKey(subject)],
|
|
96
|
+
]);
|
|
68
97
|
|
|
69
98
|
const toggleableSubjectsOf = (category: NotificationCategory) =>
|
|
70
99
|
catalog.subjectsOf(category.id).filter((subject) => !subject.locked);
|
|
@@ -72,6 +101,9 @@ export const useNotificationPreferences = (
|
|
|
72
101
|
const toggleSubject = (subject: NotificationSubject, enabled: boolean) =>
|
|
73
102
|
instant.change(subjectPreferenceKey(subject), enabled);
|
|
74
103
|
|
|
104
|
+
const toggleEmail = (subject: NotificationSubject, enabled: boolean) =>
|
|
105
|
+
instant.change(emailPreferenceKey(subject), enabled);
|
|
106
|
+
|
|
75
107
|
const toggleCategory = (category: NotificationCategory, enabled: boolean) =>
|
|
76
108
|
instant.changeMany(
|
|
77
109
|
Object.fromEntries(
|
|
@@ -95,6 +127,9 @@ export const useNotificationPreferences = (
|
|
|
95
127
|
return {
|
|
96
128
|
categories: catalog.categories,
|
|
97
129
|
subjectsOf: catalog.subjectsOf,
|
|
130
|
+
hasEmailChannel: catalog.hasEmailChannel,
|
|
131
|
+
isEmailEnabled,
|
|
132
|
+
toggleEmail,
|
|
98
133
|
preferences,
|
|
99
134
|
failedChanges: instant.failed,
|
|
100
135
|
saveState: instant.state,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import CommandPaletteAssistantAnswer from "../../build/components/layout/CommandPaletteAssistantAnswer.vue";
|
|
10
10
|
import { ASSISTANT_MODE_KEY } from "../../build/composables/command-palette/assistantGroups";
|
|
11
11
|
import { useCommandPaletteAssistantMode } from "../../build/composables/command-palette/useCommandPaletteAssistantMode";
|
|
12
|
+
import { SHORTCUTS_PAGE_SHORTCUT } from "#dms-ui/app/entries/composables/global/shortcuts";
|
|
12
13
|
|
|
13
14
|
const { t } = useI18n();
|
|
14
15
|
const appConfig = useDmsAppConfig();
|
|
@@ -61,6 +62,15 @@ function close(): void {
|
|
|
61
62
|
isOpen.value = false;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/** The page "?" opens: the keyboard shortcuts, in the user's settings. */
|
|
66
|
+
const SHORTCUTS_PAGE_PATH = "/settings/user/shortcuts";
|
|
67
|
+
|
|
68
|
+
defineShortcuts({
|
|
69
|
+
[SHORTCUTS_PAGE_SHORTCUT]: () => {
|
|
70
|
+
void navigateDms(SHORTCUTS_PAGE_PATH);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
64
74
|
/**
|
|
65
75
|
* Set on `<html>` while the palette is mounted, which is while its ⌘ K /
|
|
66
76
|
* Ctrl K shortcut listens. The palette renders nothing until opened and
|
|
@@ -174,6 +174,9 @@
|
|
|
174
174
|
"category_collapse": "Hide {name} notifications",
|
|
175
175
|
"locked_hint": "Required for account safety",
|
|
176
176
|
"email_hint": "Only in-app notifications are available today. Email delivery is on the way.",
|
|
177
|
+
"email_hint_active": "Subjects with a switch in the Email column can also reach you by email, on top of the app.",
|
|
178
|
+
"email_switch": "Email: {name}",
|
|
179
|
+
"email_needs_in_app": "Turn the in-app notification on to also receive it by email.",
|
|
177
180
|
"save_failed_on": "Couldn’t save — the switch was turned back on.",
|
|
178
181
|
"save_failed_off": "Couldn’t save — the switch was turned back off.",
|
|
179
182
|
"save_failed_many": "Couldn’t save — the switches were turned back.",
|
|
@@ -429,7 +432,7 @@
|
|
|
429
432
|
"cancel_confirm_title": "Cancel invitation",
|
|
430
433
|
"cancel_confirm_description": "Are you sure you want to cancel this invitation? The invite link will no longer work.",
|
|
431
434
|
"copy_link": "Copy link",
|
|
432
|
-
"copy_link_success": "
|
|
435
|
+
"copy_link_success": "New invitation link copied. Earlier links no longer work",
|
|
433
436
|
"edit": "Edit invitation",
|
|
434
437
|
"revoke": "Revoke",
|
|
435
438
|
"revoke_confirm_title": "Revoke the invitation to {email}?",
|
|
@@ -174,6 +174,9 @@
|
|
|
174
174
|
"category_collapse": "Masquer les notifications {name}",
|
|
175
175
|
"locked_hint": "Requis pour la sécurité du compte",
|
|
176
176
|
"email_hint": "Seules les notifications dans l’app sont disponibles aujourd’hui. L’envoi par e-mail arrive bientôt.",
|
|
177
|
+
"email_hint_active": "Les sujets marqués d’un interrupteur dans la colonne E-mail peuvent aussi vous parvenir par e-mail, en plus de l’app.",
|
|
178
|
+
"email_switch": "E-mail : {name}",
|
|
179
|
+
"email_needs_in_app": "Activez la notification dans l’app pour la recevoir aussi par e-mail.",
|
|
177
180
|
"save_failed_on": "Échec de l’enregistrement — l’interrupteur a été réactivé.",
|
|
178
181
|
"save_failed_off": "Échec de l’enregistrement — l’interrupteur a été désactivé à nouveau.",
|
|
179
182
|
"save_failed_many": "Échec de l’enregistrement — les interrupteurs ont été rétablis.",
|
|
@@ -429,7 +432,7 @@
|
|
|
429
432
|
"cancel_confirm_title": "Annuler l'invitation",
|
|
430
433
|
"cancel_confirm_description": "Êtes-vous sûr de vouloir annuler cette invitation ? Le lien d'invitation ne fonctionnera plus.",
|
|
431
434
|
"copy_link": "Copier le lien",
|
|
432
|
-
"copy_link_success": "
|
|
435
|
+
"copy_link_success": "Nouveau lien d’invitation copié. Les liens précédents ne fonctionnent plus",
|
|
433
436
|
"edit": "Modifier l’invitation",
|
|
434
437
|
"revoke": "Révoquer",
|
|
435
438
|
"revoke_confirm_title": "Révoquer l’invitation à {email} ?",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Slot } from "vue";
|
|
3
|
+
|
|
4
|
+
interface DisabledReasonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Why the wrapped button is disabled, shown in a tooltip on a focusable
|
|
7
|
+
* wrapper: a disabled button fires no pointer event, and the wrapper also
|
|
8
|
+
* brings the reason to keyboard users. Without one the button is drawn alone.
|
|
9
|
+
*/
|
|
10
|
+
reason?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface DisabledReasonSlots {
|
|
14
|
+
/** The disabled button. */
|
|
15
|
+
default?: () => ReturnType<Slot>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const props = defineProps<DisabledReasonProps>();
|
|
19
|
+
defineSlots<DisabledReasonSlots>();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<UTooltip v-if="props.reason" :text="props.reason">
|
|
24
|
+
<span tabindex="0" class="inline-flex"><slot /></span>
|
|
25
|
+
</UTooltip>
|
|
26
|
+
<slot v-else />
|
|
27
|
+
</template>
|
|
@@ -10,6 +10,7 @@ interface Props {
|
|
|
10
10
|
targetTree: ResolvedComponentInfo;
|
|
11
11
|
pageId: string;
|
|
12
12
|
componentId: string;
|
|
13
|
+
routeParams?: Record<string, string>;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
defineProps<Props>();
|
|
@@ -23,5 +24,6 @@ const attrs = useAttrs();
|
|
|
23
24
|
:page-id="pageId"
|
|
24
25
|
:component-id="componentId"
|
|
25
26
|
:root-props="attrs"
|
|
27
|
+
:route-params="routeParams"
|
|
26
28
|
/>
|
|
27
29
|
</template>
|
|
@@ -209,6 +209,7 @@ const weekStart = computed(
|
|
|
209
209
|
v-slot="{ grid, weekDays }"
|
|
210
210
|
:model-value="rekaValue"
|
|
211
211
|
:placeholder="placeholder"
|
|
212
|
+
:calendar-label="$t('dms.period.popover.custom_range')"
|
|
212
213
|
:locale="locale"
|
|
213
214
|
:week-starts-on="weekStart"
|
|
214
215
|
:number-of-months="numberOfMonths"
|
|
@@ -36,8 +36,7 @@ interface StatCellProps {
|
|
|
36
36
|
refreshing?: boolean;
|
|
37
37
|
/**
|
|
38
38
|
* `md` only. Under 28rem of the enclosing `@container` (two cards side by
|
|
39
|
-
* side on a phone) the well goes on top
|
|
40
|
-
* label wraps on phones only.
|
|
39
|
+
* side on a phone) the well goes on top of the lines.
|
|
41
40
|
*/
|
|
42
41
|
stack?: boolean;
|
|
43
42
|
}
|
|
@@ -71,9 +70,6 @@ const MD_STACK = "@max-md:flex-col @max-md:items-start @max-md:gap-2.5";
|
|
|
71
70
|
const SM_CELL = "flex min-w-0 items-start gap-3 px-4 py-3.5";
|
|
72
71
|
|
|
73
72
|
const isMd = computed(() => props.size === "md");
|
|
74
|
-
const wraps = computed(() =>
|
|
75
|
-
props.stack ? "@max-md:whitespace-normal" : "max-sm:whitespace-normal",
|
|
76
|
-
);
|
|
77
73
|
const cellClass = computed(() => {
|
|
78
74
|
if (!isMd.value) {
|
|
79
75
|
return [SM_CELL, props.to && "hover:bg-elevated transition-colors"];
|
|
@@ -124,12 +120,7 @@ const { t } = useI18n();
|
|
|
124
120
|
/>
|
|
125
121
|
</div>
|
|
126
122
|
<div v-else class="grid min-w-0 flex-1 gap-[3px]">
|
|
127
|
-
<DmsEyebrowLabel
|
|
128
|
-
tone="muted"
|
|
129
|
-
truncate
|
|
130
|
-
:class="wraps"
|
|
131
|
-
:label="props.eyebrow"
|
|
132
|
-
/>
|
|
123
|
+
<DmsEyebrowLabel tone="muted" :label="props.eyebrow" />
|
|
133
124
|
<USkeleton
|
|
134
125
|
v-if="props.loading"
|
|
135
126
|
:aria-label="t('dms.a11y.loading')"
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
type ResolvedQuickFilter,
|
|
25
25
|
} from "../../composables/table-view/utils/quickFilters";
|
|
26
26
|
import DmsSearchInput from "../form/SearchInput.vue";
|
|
27
|
+
import DmsDisabledReason from "../button/DisabledReason.vue";
|
|
27
28
|
|
|
28
29
|
export interface TableActionsProps {
|
|
29
30
|
canAddRow?: boolean;
|
|
@@ -590,26 +591,25 @@ const uiTableActions = computed(() => uiTableActionsVariant());
|
|
|
590
591
|
@click="showArchived = !showArchived"
|
|
591
592
|
/>
|
|
592
593
|
|
|
593
|
-
|
|
594
|
-
wrapper, focusable so the reason also reaches keyboard users. -->
|
|
595
|
-
<UTooltip
|
|
594
|
+
<DmsDisabledReason
|
|
596
595
|
v-for="(button, index) in customButtons"
|
|
597
596
|
:key="`custom-btn-${index}`"
|
|
598
|
-
:
|
|
599
|
-
|
|
597
|
+
:reason="
|
|
598
|
+
button.disabled && button.disabledReason
|
|
599
|
+
? processI18n(button.disabledReason)
|
|
600
|
+
: undefined
|
|
601
|
+
"
|
|
600
602
|
>
|
|
601
|
-
<
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
</span>
|
|
612
|
-
</UTooltip>
|
|
603
|
+
<UButton
|
|
604
|
+
:label="processI18n(button.label)"
|
|
605
|
+
:icon="button.icon"
|
|
606
|
+
:variant="button.variant ?? 'outline'"
|
|
607
|
+
:color="button.color ?? 'neutral'"
|
|
608
|
+
:disabled="button.disabled"
|
|
609
|
+
size="sm"
|
|
610
|
+
@click="props.onCustomButton?.(button)"
|
|
611
|
+
/>
|
|
612
|
+
</DmsDisabledReason>
|
|
613
613
|
|
|
614
614
|
<UButton
|
|
615
615
|
v-if="canAddRow"
|
|
@@ -93,7 +93,7 @@ export function createTargetHandlers(
|
|
|
93
93
|
quickAction: (target) => {
|
|
94
94
|
const { id } = target;
|
|
95
95
|
const quickAction = findServedQuickAction(
|
|
96
|
-
|
|
96
|
+
servedQuickActions()?.actions,
|
|
97
97
|
id,
|
|
98
98
|
);
|
|
99
99
|
if (quickAction) dispatchQuickActionTarget(quickAction.target);
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type WrittenRecord,
|
|
13
13
|
} from "../table-view/utils/recordLink";
|
|
14
14
|
import { fillRowChildren, fillRowOptions } from "./rowComponentOptions";
|
|
15
|
+
import { currentPageUrlValues } from "../page/pageUrlValues";
|
|
15
16
|
import { resolveComponentChildren } from "../../../utils/componentTree";
|
|
16
17
|
import TargetComponentTree from "../../components/containers/TargetComponentTree.vue";
|
|
17
18
|
import { resolveConfirmText } from "../confirm/confirmDialogTexts";
|
|
@@ -87,7 +88,10 @@ export function createTargetRows(config: ActionTargetsConfig) {
|
|
|
87
88
|
const id = rowIdOf(row);
|
|
88
89
|
const tokens = row && id !== undefined ? { ...row, id } : row;
|
|
89
90
|
const declared = component?.options ?? {};
|
|
90
|
-
const options =
|
|
91
|
+
const options = {
|
|
92
|
+
...(tokens ? fillRowOptions(declared, tokens) : declared),
|
|
93
|
+
routeParams: currentPageUrlValues().routeParams,
|
|
94
|
+
};
|
|
91
95
|
const children = component?.children;
|
|
92
96
|
if (!component?.componentName || !children?.length) return options;
|
|
93
97
|
const targetTree: ResolvedComponentInfo = {
|
package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts
CHANGED
|
@@ -121,19 +121,29 @@ export function useMockupViewerShortcuts(
|
|
|
121
121
|
return matchShortcuts(event, view.value).some((id) => actions[id]());
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
/**
|
|
125
|
-
function
|
|
126
|
-
if (
|
|
127
|
-
|
|
124
|
+
/** A key pressed outside a field, seen before the page's other listeners: once a shortcut acts, none of them sees it. */
|
|
125
|
+
function onKeydown(event: KeyboardEvent): void {
|
|
126
|
+
if (isFieldKey(event.target) || !run(event)) return;
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
event.stopPropagation();
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (
|
|
131
|
+
/** An Escape a field of the inspector left, with a block selected to step back from, once the field had its turn. */
|
|
132
|
+
function onFieldEscape(event: KeyboardEvent): void {
|
|
133
|
+
if (!isFieldKey(event.target) || editing.selection.value === undefined) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (isInspectorEscape(event) && run(event)) event.preventDefault();
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
onMounted(() =>
|
|
136
|
-
|
|
139
|
+
onMounted(() => {
|
|
140
|
+
window.addEventListener("keydown", onKeydown, true);
|
|
141
|
+
window.addEventListener("keydown", onFieldEscape);
|
|
142
|
+
});
|
|
143
|
+
onBeforeUnmount(() => {
|
|
144
|
+
window.removeEventListener("keydown", onKeydown, true);
|
|
145
|
+
window.removeEventListener("keydown", onFieldEscape);
|
|
146
|
+
});
|
|
137
147
|
|
|
138
148
|
return { undo, redo, run };
|
|
139
149
|
}
|
|
@@ -44,7 +44,7 @@ const REQUEST_FREE_INPUTS: ReadonlyMap<string, ReadonlySet<string>> = new Map(
|
|
|
44
44
|
"dms-input-email": ["placeholder"],
|
|
45
45
|
"dms-input-number": NUMBER_KEYS,
|
|
46
46
|
"dms-input-percentage": NUMBER_KEYS,
|
|
47
|
-
"dms-input-phone": ["placeholder", "requiredPrefix"],
|
|
47
|
+
"dms-input-phone": ["placeholder", "requiredPrefix", "defaultCountry"],
|
|
48
48
|
"dms-input-password": [
|
|
49
49
|
"placeholder",
|
|
50
50
|
"minLength",
|
package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
DataType,
|
|
3
3
|
DataTypeFormatter,
|
|
4
4
|
} from "#dms-core/app/composables/data-types/useDataType";
|
|
5
|
-
import { isObject } from "#dms-core/app/utils/type-check";
|
|
5
|
+
import { isObject, isString } from "#dms-core/app/utils/type-check";
|
|
6
6
|
import UIcon from "@nuxt/ui/runtime/vue/components/Icon.vue";
|
|
7
7
|
import { childOf, readRowTone, type Row } from "./cellHelpers";
|
|
8
8
|
import {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../table/utils/filterEditorValue";
|
|
12
12
|
import { formatDuration } from "#dms-core/app/utils/formatter";
|
|
13
13
|
import { withNumberSuffix } from "./numberSuffix";
|
|
14
|
+
import { formatPhone } from "../../utils/phoneNumber";
|
|
14
15
|
import { DMS_TONE_TEXT } from "../../utils/tone";
|
|
15
16
|
import { getAppTranslation } from "../../../../../dms-core/app/composables/translation/useTranslation";
|
|
16
17
|
|
|
@@ -66,8 +67,7 @@ function formatAddress(value: CellValue): string {
|
|
|
66
67
|
const parts = [
|
|
67
68
|
street,
|
|
68
69
|
addr.addressLine2,
|
|
69
|
-
addr.postalCode,
|
|
70
|
-
addr.city,
|
|
70
|
+
[addr.postalCode, addr.city].filter(Boolean).join(" "),
|
|
71
71
|
addr.countrySubdivision,
|
|
72
72
|
countryName,
|
|
73
73
|
].filter(Boolean);
|
|
@@ -112,6 +112,15 @@ export const registerPrimitiveTypes = (
|
|
|
112
112
|
id: "string",
|
|
113
113
|
formatter: { default: renderText },
|
|
114
114
|
});
|
|
115
|
+
registerDataType({
|
|
116
|
+
id: "phone",
|
|
117
|
+
formatter: {
|
|
118
|
+
default: (value) => {
|
|
119
|
+
if (value === "") return null;
|
|
120
|
+
return isString(value) ? formatPhone(value) : value;
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
115
124
|
registerDataType({
|
|
116
125
|
id: "price",
|
|
117
126
|
formatter: { default: withNumberSuffix(formatPrice) },
|
|
@@ -12,6 +12,19 @@ export const GLOBAL_META_K_METADATA: ShortcutMetadata = {
|
|
|
12
12
|
component: GLOBAL_COMPONENT,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
/** The key that opens the keyboard shortcuts page. */
|
|
16
|
+
export const SHORTCUTS_PAGE_SHORTCUT = "?";
|
|
17
|
+
|
|
18
|
+
/** Opens the keyboard shortcuts page from anywhere outside a text field. */
|
|
19
|
+
export const GLOBAL_QUESTION_MARK_METADATA: ShortcutMetadata = {
|
|
20
|
+
key: [SHORTCUTS_PAGE_SHORTCUT],
|
|
21
|
+
descriptionKey: "$dms.shortcuts.global.question_mark.description",
|
|
22
|
+
component: GLOBAL_COMPONENT,
|
|
23
|
+
condition: {
|
|
24
|
+
descriptionKey: "$dms.shortcuts.global.question_mark.condition",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
15
28
|
/** Closes the topmost dialog, menu or the command palette. */
|
|
16
29
|
export const GLOBAL_ESCAPE_METADATA: ShortcutMetadata = {
|
|
17
30
|
key: ["$keyboard.escape"],
|
|
@@ -27,5 +40,6 @@ export const GLOBAL_SHORTCUTS_METADATA = [
|
|
|
27
40
|
GLOBAL_META_K_METADATA,
|
|
28
41
|
GLOBAL_SLASH_METADATA,
|
|
29
42
|
GLOBAL_META_SLASH_METADATA,
|
|
43
|
+
GLOBAL_QUESTION_MARK_METADATA,
|
|
30
44
|
GLOBAL_ESCAPE_METADATA,
|
|
31
45
|
];
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
export function currentPageUrlValues(): ReplaceUrlVariablesContext {
|
|
14
14
|
const route = useDmsRoute();
|
|
15
15
|
return {
|
|
16
|
-
routeParams:
|
|
16
|
+
routeParams: findPageRoute(route.path)?.params,
|
|
17
17
|
routeQuery: route.query,
|
|
18
18
|
};
|
|
19
19
|
}
|
package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts
CHANGED
|
@@ -76,18 +76,6 @@ const isRuleBlocked = <T extends Data>(
|
|
|
76
76
|
return listed === undefined || !evaluateRowActionRule(rule, listed);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const isActionDisabled = <T extends Data>(
|
|
80
|
-
context: TableColumnContext<T>,
|
|
81
|
-
actionConfig: boolean | RowActionConfig | undefined,
|
|
82
|
-
rowData: Data,
|
|
83
|
-
): boolean => {
|
|
84
|
-
const actionConfigNormalized = normalizeActionConfig(actionConfig);
|
|
85
|
-
if (!actionConfigNormalized.isEnabled) return true;
|
|
86
|
-
if (!actionConfigNormalized.rule) return false;
|
|
87
|
-
|
|
88
|
-
return isRuleBlocked(context, actionConfigNormalized.rule, rowData);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
79
|
const rowText = <T extends Data>(
|
|
92
80
|
context: TableColumnContext<T>,
|
|
93
81
|
text: string,
|
|
@@ -97,6 +85,38 @@ const rowText = <T extends Data>(
|
|
|
97
85
|
return resolveConfirmText(text, rowData, t);
|
|
98
86
|
};
|
|
99
87
|
|
|
88
|
+
type Availability = Pick<RowActionDescriptor, "disabled" | "disabledReason">;
|
|
89
|
+
|
|
90
|
+
const ruleAvailability = <T extends Data>(
|
|
91
|
+
context: TableColumnContext<T>,
|
|
92
|
+
declared: Pick<RowActionConfig, "rule" | "disabledReason">,
|
|
93
|
+
rowData: Data,
|
|
94
|
+
): Availability => {
|
|
95
|
+
if (!declared.rule || !isRuleBlocked(context, declared.rule, rowData)) {
|
|
96
|
+
return { disabled: false };
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
disabled: true,
|
|
100
|
+
disabledReason:
|
|
101
|
+
declared.disabledReason &&
|
|
102
|
+
rowText(context, declared.disabledReason, rowData),
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const actionAvailability = <T extends Data>(
|
|
107
|
+
context: TableColumnContext<T>,
|
|
108
|
+
actionConfig: boolean | RowActionConfig | undefined,
|
|
109
|
+
rowData: Data,
|
|
110
|
+
): Availability => {
|
|
111
|
+
const normalized = normalizeActionConfig(actionConfig);
|
|
112
|
+
if (!normalized.isEnabled) return { disabled: true };
|
|
113
|
+
return ruleAvailability(context, normalized, rowData);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** Whether a row shows the action: enabled, or kept off with a reason to show. */
|
|
117
|
+
export const isOffered = (descriptor: RowActionDescriptor): boolean =>
|
|
118
|
+
!descriptor.disabled || !!descriptor.disabledReason;
|
|
119
|
+
|
|
100
120
|
export const menuLabel = <T extends Data>(
|
|
101
121
|
context: TableColumnContext<T>,
|
|
102
122
|
rowData: T,
|
|
@@ -113,16 +133,6 @@ export const menuLabel = <T extends Data>(
|
|
|
113
133
|
: t("dms.table.row_actions");
|
|
114
134
|
};
|
|
115
135
|
|
|
116
|
-
const isCustomActionDisabled = <T extends Data>(
|
|
117
|
-
context: TableColumnContext<T>,
|
|
118
|
-
action: CustomRowAction,
|
|
119
|
-
rowData: Data,
|
|
120
|
-
): boolean => {
|
|
121
|
-
if (!action.rule) return false;
|
|
122
|
-
|
|
123
|
-
return isRuleBlocked(context, action.rule, rowData);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
136
|
const buildCopyLinkOnSelect = <T extends Data>(
|
|
127
137
|
context: TableColumnContext<T>,
|
|
128
138
|
rowData: T,
|
|
@@ -193,7 +203,7 @@ const buildCustomActionDescriptors = <T extends Data>(
|
|
|
193
203
|
|
|
194
204
|
icon: action.icon || (action.showLabel ? "" : "i-ph-lightning"),
|
|
195
205
|
onSelect: onRow(rowData, (row) => config.onCustomRowAction?.(action, row)),
|
|
196
|
-
|
|
206
|
+
...ruleAvailability(context, action, shown),
|
|
197
207
|
visible: isCustomActionInline(action),
|
|
198
208
|
color: action.color,
|
|
199
209
|
variant: action.variant,
|
|
@@ -232,7 +242,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
232
242
|
label: builtInLabel(context, "copyLink", t("dms.button.copy_link")),
|
|
233
243
|
icon: builtInIcon(context, "copyLink", "i-ph-link"),
|
|
234
244
|
onSelect: onRow(rowData, (row) => copyLinkAfterConfirm(context, row)),
|
|
235
|
-
|
|
245
|
+
...actionAvailability(context, config.rowActions?.copyLink, shown),
|
|
236
246
|
visible: isActionVisible(config.rowActions?.copyLink),
|
|
237
247
|
},
|
|
238
248
|
{
|
|
@@ -240,7 +250,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
240
250
|
label: builtInLabel(context, "details", t("dms.button.details")),
|
|
241
251
|
icon: builtInIcon(context, "details", "i-ph-info"),
|
|
242
252
|
onSelect: onRow(rowData, (row) => config.emits("details", row)),
|
|
243
|
-
|
|
253
|
+
...actionAvailability(context, config.rowActions?.details, shown),
|
|
244
254
|
visible: isActionVisible(config.rowActions?.details),
|
|
245
255
|
},
|
|
246
256
|
{
|
|
@@ -248,7 +258,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
248
258
|
label: builtInLabel(context, "edit", t("dms.button.edit")),
|
|
249
259
|
icon: builtInIcon(context, "edit", "i-ph-pencil"),
|
|
250
260
|
onSelect: onRow(rowData, (row) => config.emits("edit", row)),
|
|
251
|
-
|
|
261
|
+
...actionAvailability(context, config.rowActions?.edit, shown),
|
|
252
262
|
visible: isActionVisible(config.rowActions?.edit),
|
|
253
263
|
},
|
|
254
264
|
{
|
|
@@ -258,7 +268,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
258
268
|
onSelect: onRow(rowData, (row) =>
|
|
259
269
|
config.emits("duplicate", rowIdOf(row, config.rowIdKey)),
|
|
260
270
|
),
|
|
261
|
-
|
|
271
|
+
...actionAvailability(context, config.rowActions?.duplicate, shown),
|
|
262
272
|
visible: isActionVisible(config.rowActions?.duplicate),
|
|
263
273
|
},
|
|
264
274
|
{
|
|
@@ -268,7 +278,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
268
278
|
onSelect: onRow(rowData, (row) =>
|
|
269
279
|
config.emits("delete", [rowIdOf(row, config.rowIdKey)]),
|
|
270
280
|
),
|
|
271
|
-
|
|
281
|
+
...actionAvailability(context, config.rowActions?.delete, shown),
|
|
272
282
|
visible: isActionVisible(config.rowActions?.delete),
|
|
273
283
|
color: Color.error,
|
|
274
284
|
},
|
|
@@ -279,7 +289,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
279
289
|
onSelect: onRow(rowData, (row) =>
|
|
280
290
|
config.emits("archive", [rowIdOf(row, config.rowIdKey)]),
|
|
281
291
|
),
|
|
282
|
-
|
|
292
|
+
...actionAvailability(context, config.rowActions?.archive, shown),
|
|
283
293
|
visible: isActionVisible(config.rowActions?.archive),
|
|
284
294
|
},
|
|
285
295
|
{
|
|
@@ -289,7 +299,7 @@ const buildBuiltInActionDescriptors = <T extends Data>(
|
|
|
289
299
|
onSelect: onRow(rowData, (row) =>
|
|
290
300
|
config.emits("restore", [rowIdOf(row, config.rowIdKey)]),
|
|
291
301
|
),
|
|
292
|
-
|
|
302
|
+
...actionAvailability(context, config.rowActions?.restore, shown),
|
|
293
303
|
visible: isActionVisible(config.rowActions?.restore),
|
|
294
304
|
},
|
|
295
305
|
];
|
|
@@ -318,6 +328,12 @@ export const descriptorToMenuItem = (
|
|
|
318
328
|
descriptor.label,
|
|
319
329
|
descriptor.icon,
|
|
320
330
|
descriptor.onSelect,
|
|
321
|
-
|
|
331
|
+
{
|
|
332
|
+
...(descriptor.color && { color: descriptor.color }),
|
|
333
|
+
...(descriptor.disabled && {
|
|
334
|
+
disabled: true,
|
|
335
|
+
description: descriptor.disabledReason,
|
|
336
|
+
}),
|
|
337
|
+
},
|
|
322
338
|
);
|
|
323
339
|
};
|