@antelopejs/dms 0.21.4-next.999.g264d3a3 → 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/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/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/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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AsYouType,
|
|
3
|
+
type CountryCode,
|
|
4
|
+
getCountries,
|
|
5
|
+
getCountryCallingCode,
|
|
6
|
+
isSupportedCountry,
|
|
7
|
+
parsePhoneNumberFromString,
|
|
8
|
+
} from "libphonenumber-js/min";
|
|
9
|
+
|
|
10
|
+
const PHONE_CHARACTERS = /^[+\d\s().\-/]+$/;
|
|
11
|
+
|
|
12
|
+
const INTERNATIONAL_PREFIX = /^(\+|00)/;
|
|
13
|
+
|
|
14
|
+
const E164 = /^\+[1-9]\d{1,14}$/;
|
|
15
|
+
|
|
16
|
+
/** A country the phone input offers: its ISO code and calling code. */
|
|
17
|
+
export interface PhoneCountry {
|
|
18
|
+
code: CountryCode;
|
|
19
|
+
/** Without its "+": "32". */
|
|
20
|
+
callingCode: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** What the user typed into a phone input, read in its selected country. */
|
|
24
|
+
export interface TypedPhone {
|
|
25
|
+
/** The text formatted as it is typed ("+32 494 66", "0494 66 94"). */
|
|
26
|
+
text: string;
|
|
27
|
+
/** The country a "+" or "00" prefix names, else the selected one. */
|
|
28
|
+
country?: CountryCode;
|
|
29
|
+
/** The value to store: E.164 when it is a possible number, else the text. */
|
|
30
|
+
value: string;
|
|
31
|
+
/** Whether `value` is a possible number, in E.164. */
|
|
32
|
+
isNumber: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The supported country an ISO 3166-1 alpha-2 code ("be", "BE") names. */
|
|
36
|
+
export function phoneCountry(
|
|
37
|
+
code: string | null | undefined,
|
|
38
|
+
): CountryCode | undefined {
|
|
39
|
+
const upper = code?.trim().toUpperCase();
|
|
40
|
+
return upper && isSupportedCountry(upper) ? upper : undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function phoneCountries(): PhoneCountry[] {
|
|
44
|
+
return getCountries().map((code) => ({
|
|
45
|
+
code,
|
|
46
|
+
callingCode: getCountryCallingCode(code),
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isInternational(text: string): boolean {
|
|
51
|
+
return INTERNATIONAL_PREFIX.test(text.trim());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function withPlus(text: string): string {
|
|
55
|
+
return text.trim().replace(INTERNATIONAL_PREFIX, "+");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function parse(text: string, country: CountryCode | undefined) {
|
|
59
|
+
if (!PHONE_CHARACTERS.test(text.trim())) return undefined;
|
|
60
|
+
return parsePhoneNumberFromString(
|
|
61
|
+
withPlus(text),
|
|
62
|
+
country ? { defaultCountry: country } : undefined,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The E.164 form ("+32494669443") of a phone number typed in any common way:
|
|
68
|
+
* a number without a "+" or "00" prefix reads in `country`. `undefined` when
|
|
69
|
+
* the text is not a possible number of its country.
|
|
70
|
+
*/
|
|
71
|
+
export function toE164(
|
|
72
|
+
text: string,
|
|
73
|
+
country?: CountryCode,
|
|
74
|
+
): string | undefined {
|
|
75
|
+
const parsed = parse(text, country);
|
|
76
|
+
return parsed?.isPossible() ? parsed.number : undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* How a stored phone number reads: an E.164 value in international format
|
|
81
|
+
* ("+32 494 66 94 43"), anything else as stored.
|
|
82
|
+
*/
|
|
83
|
+
export function formatPhone(value: string): string {
|
|
84
|
+
if (!E164.test(value)) return value;
|
|
85
|
+
return parsePhoneNumberFromString(value)?.formatInternational() ?? value;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The country a stored E.164 value belongs to. */
|
|
89
|
+
export function storedPhoneCountry(value: string): CountryCode | undefined {
|
|
90
|
+
if (!E164.test(value)) return undefined;
|
|
91
|
+
return parsePhoneNumberFromString(value)?.country;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function readTypedPhone(
|
|
95
|
+
text: string,
|
|
96
|
+
country: CountryCode | undefined,
|
|
97
|
+
): TypedPhone {
|
|
98
|
+
const value = toE164(text, country);
|
|
99
|
+
const isNumber = value !== undefined;
|
|
100
|
+
if (!PHONE_CHARACTERS.test(text.trim())) {
|
|
101
|
+
return { text, country, value: text, isNumber };
|
|
102
|
+
}
|
|
103
|
+
if (!isInternational(text)) {
|
|
104
|
+
const formatter = new AsYouType(country);
|
|
105
|
+
return {
|
|
106
|
+
text: formatter.input(text),
|
|
107
|
+
country,
|
|
108
|
+
value: value ?? text,
|
|
109
|
+
isNumber,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const formatter = new AsYouType();
|
|
113
|
+
const formatted = formatter.input(withPlus(text));
|
|
114
|
+
const callingCode = formatter.getCallingCode();
|
|
115
|
+
const keepsCountry =
|
|
116
|
+
country !== undefined &&
|
|
117
|
+
callingCode !== undefined &&
|
|
118
|
+
getCountryCallingCode(country) === callingCode;
|
|
119
|
+
return {
|
|
120
|
+
text: formatted,
|
|
121
|
+
country: formatter.getCountry() ?? (keepsCountry ? country : undefined),
|
|
122
|
+
value: value ?? text,
|
|
123
|
+
isNumber,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The number typed, moved to another country: an international number keeps
|
|
129
|
+
* its national part under the new calling code. A national number, or text
|
|
130
|
+
* that is no number, stays as typed, to be read in the new country.
|
|
131
|
+
*/
|
|
132
|
+
export function moveToCountry(
|
|
133
|
+
text: string,
|
|
134
|
+
from: CountryCode | undefined,
|
|
135
|
+
to: CountryCode,
|
|
136
|
+
): string {
|
|
137
|
+
if (!isInternational(text)) return text;
|
|
138
|
+
const parsed = parse(text, from);
|
|
139
|
+
if (!parsed) return text;
|
|
140
|
+
return new AsYouType().input(
|
|
141
|
+
`+${getCountryCallingCode(to)}${parsed.nationalNumber}`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -200,6 +200,7 @@ const forwarded = useForwardPropsEmits(convertedProps, wrappedEmits);
|
|
|
200
200
|
<template>
|
|
201
201
|
<UCalendar
|
|
202
202
|
v-bind="{ ...forwarded, ...ariaAttrs }"
|
|
203
|
+
:calendar-label="$t('dms.form.select_date')"
|
|
203
204
|
:week-starts-on="props.weekStartsOn ?? weekStartsOn"
|
|
204
205
|
:min-value="minValue"
|
|
205
206
|
:max-value="maxValue"
|
|
@@ -1,18 +1,170 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { useFormField } from "@nuxt/ui/composables/useFormField";
|
|
3
|
+
import type { CountryCode } from "libphonenumber-js/min";
|
|
4
|
+
import { useControlError } from "../../../composables/form/useControlError";
|
|
5
|
+
import {
|
|
6
|
+
formatPhone,
|
|
7
|
+
moveToCountry,
|
|
8
|
+
phoneCountries,
|
|
9
|
+
phoneCountry,
|
|
10
|
+
readTypedPhone,
|
|
11
|
+
storedPhoneCountry,
|
|
12
|
+
} from "../../../build/utils/phoneNumber";
|
|
13
|
+
|
|
14
|
+
const ITEM_HEIGHT = 32;
|
|
15
|
+
|
|
16
|
+
interface InputPhoneProps {
|
|
17
|
+
id?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Refuses a number typed without its country. */
|
|
21
|
+
requiredPrefix?: boolean;
|
|
22
|
+
/** ISO 3166-1 alpha-2 code the country selector starts on ("BE"). */
|
|
23
|
+
defaultCountry?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const props = defineProps<InputPhoneProps>();
|
|
27
|
+
const model = defineModel<string | null | undefined>();
|
|
28
|
+
const { t, te, locale } = useI18n();
|
|
29
|
+
const { report } = useControlError();
|
|
30
|
+
const {
|
|
31
|
+
id,
|
|
32
|
+
size,
|
|
33
|
+
color,
|
|
34
|
+
highlight,
|
|
35
|
+
disabled,
|
|
36
|
+
ariaAttrs,
|
|
37
|
+
emitFormBlur,
|
|
38
|
+
emitFormInput,
|
|
39
|
+
} = useFormField(props);
|
|
40
|
+
|
|
41
|
+
const isStrict = computed(
|
|
42
|
+
() => !!props.requiredPrefix || !!props.defaultCountry,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const text = ref("");
|
|
46
|
+
const country = ref<CountryCode>();
|
|
47
|
+
let emitted: string | null | undefined;
|
|
48
|
+
|
|
49
|
+
function show(value: string | null | undefined): void {
|
|
50
|
+
emitted = value;
|
|
51
|
+
const stored = value ?? "";
|
|
52
|
+
text.value = formatPhone(stored);
|
|
53
|
+
country.value =
|
|
54
|
+
storedPhoneCountry(stored) ??
|
|
55
|
+
(stored ? country.value : undefined) ??
|
|
56
|
+
phoneCountry(props.defaultCountry);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
show(model.value);
|
|
60
|
+
|
|
61
|
+
watch(model, (value) => {
|
|
62
|
+
if (value !== emitted) show(value);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function store(value: string): void {
|
|
66
|
+
emitted = value;
|
|
67
|
+
model.value = value;
|
|
68
|
+
emitFormInput();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function read(next: string, { isDeleting = false } = {}): void {
|
|
72
|
+
const typed = readTypedPhone(next, country.value);
|
|
73
|
+
text.value = isDeleting ? next : typed.text;
|
|
74
|
+
country.value = typed.country;
|
|
75
|
+
store(typed.value);
|
|
76
|
+
if (typed.isNumber || !next.trim()) report(undefined);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onInput(next: string | number | null | undefined): void {
|
|
80
|
+
const value = String(next ?? "");
|
|
81
|
+
read(value, { isDeleting: value.length < text.value.length });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function onBlur(): void {
|
|
85
|
+
const typed = readTypedPhone(text.value, country.value);
|
|
86
|
+
if (typed.isNumber) text.value = formatPhone(typed.value);
|
|
87
|
+
report(
|
|
88
|
+
isStrict.value && text.value.trim() && !typed.isNumber
|
|
89
|
+
? t("dms.field_errors.invalid_phone")
|
|
90
|
+
: undefined,
|
|
91
|
+
);
|
|
92
|
+
emitFormBlur();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function onCountry(next: CountryCode | undefined): void {
|
|
96
|
+
if (!next) return;
|
|
97
|
+
const moved = moveToCountry(text.value, country.value, next);
|
|
98
|
+
country.value = next;
|
|
99
|
+
read(moved);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const countryItems = computed(() =>
|
|
103
|
+
phoneCountries()
|
|
104
|
+
.filter((entry) => te(`country.${entry.code}`))
|
|
105
|
+
.map((entry) => ({
|
|
106
|
+
value: entry.code,
|
|
107
|
+
label: t(`country.${entry.code}`),
|
|
108
|
+
code: `+${entry.callingCode}`,
|
|
109
|
+
}))
|
|
110
|
+
.sort((a, b) => a.label.localeCompare(b.label, locale.value)),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const selected = computed(() =>
|
|
114
|
+
countryItems.value.find((item) => item.value === country.value),
|
|
115
|
+
);
|
|
14
116
|
</script>
|
|
15
117
|
|
|
16
118
|
<template>
|
|
17
|
-
<
|
|
119
|
+
<div class="flex w-full">
|
|
120
|
+
<USelectMenu
|
|
121
|
+
:model-value="country"
|
|
122
|
+
:items="countryItems"
|
|
123
|
+
value-key="value"
|
|
124
|
+
label-key="label"
|
|
125
|
+
:filter-fields="['label', 'value', 'code']"
|
|
126
|
+
:search-input="{ placeholder: t('dms.form.phone.country_search') }"
|
|
127
|
+
:virtualize="{ estimateSize: ITEM_HEIGHT }"
|
|
128
|
+
:size="size"
|
|
129
|
+
:color="color"
|
|
130
|
+
:highlight="highlight"
|
|
131
|
+
:disabled="disabled"
|
|
132
|
+
:aria-label="t('dms.form.phone.country')"
|
|
133
|
+
trailing-icon="i-ph-caret-down"
|
|
134
|
+
class="shrink-0 rounded-e-none"
|
|
135
|
+
:ui="{ content: 'min-w-72' }"
|
|
136
|
+
data-phone-country
|
|
137
|
+
@update:model-value="onCountry"
|
|
138
|
+
>
|
|
139
|
+
<span v-if="selected" class="tabular-nums">
|
|
140
|
+
{{ selected.value }} {{ selected.code }}
|
|
141
|
+
</span>
|
|
142
|
+
<UIcon v-else name="i-ph-globe" class="size-4" />
|
|
143
|
+
<template #empty="{ searchTerm }">
|
|
144
|
+
{{ t("dms.form.phone.country_none", { search: searchTerm }) }}
|
|
145
|
+
</template>
|
|
146
|
+
<template #item-trailing="{ item }">
|
|
147
|
+
<span class="text-dimmed text-[11px] tabular-nums">
|
|
148
|
+
{{ item.code }}
|
|
149
|
+
</span>
|
|
150
|
+
</template>
|
|
151
|
+
</USelectMenu>
|
|
152
|
+
<UInput
|
|
153
|
+
v-bind="ariaAttrs"
|
|
154
|
+
:id="id"
|
|
155
|
+
:model-value="text"
|
|
156
|
+
type="tel"
|
|
157
|
+
inputmode="tel"
|
|
158
|
+
autocomplete="tel"
|
|
159
|
+
:placeholder="props.placeholder"
|
|
160
|
+
:size="size"
|
|
161
|
+
:color="color"
|
|
162
|
+
:highlight="highlight"
|
|
163
|
+
:disabled="disabled"
|
|
164
|
+
class="min-w-0 flex-1"
|
|
165
|
+
:ui="{ base: 'rounded-s-none' }"
|
|
166
|
+
@update:model-value="onInput"
|
|
167
|
+
@blur="onBlur"
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
18
170
|
</template>
|
|
@@ -168,8 +168,9 @@ const canAdd = computed(
|
|
|
168
168
|
() =>
|
|
169
169
|
!!props.addForm &&
|
|
170
170
|
!!props.addForm.options?.submitUrl &&
|
|
171
|
-
(
|
|
172
|
-
props.addPermissionIds.some((id) => hasPermission(id))
|
|
171
|
+
(props.addPermissionIds?.length
|
|
172
|
+
? props.addPermissionIds.some((id) => hasPermission(id))
|
|
173
|
+
: hasPermission("*")),
|
|
173
174
|
);
|
|
174
175
|
|
|
175
176
|
interface RelationResponse {
|
|
@@ -11,6 +11,9 @@ import { fieldErrorPattern } from "../../../build/composables/form/formEntryCont
|
|
|
11
11
|
import { resolveDmsComponent } from "../../../composables/resolveDmsComponent";
|
|
12
12
|
import DmsRepeaterTable from "./RepeaterTable.vue";
|
|
13
13
|
import type { DataTypeFormatter } from "#dms-core/app/composables/data-types/useDataType";
|
|
14
|
+
import type { FormFieldValue } from "../../../composables/form/types/value";
|
|
15
|
+
import { FORM_FIELD_SAVED_KEY } from "../../../composables/form/types/field-saved";
|
|
16
|
+
import { cloneFormValue } from "../../../build/composables/form/useFormModel";
|
|
14
17
|
|
|
15
18
|
/** A field of the rows: one column. */
|
|
16
19
|
interface RepeaterColumn {
|
|
@@ -19,6 +22,8 @@ interface RepeaterColumn {
|
|
|
19
22
|
type?: string;
|
|
20
23
|
component: ComponentInfo;
|
|
21
24
|
required?: boolean;
|
|
25
|
+
/** The cell's value in a row added or created to reach `min`. */
|
|
26
|
+
defaultValue?: FormFieldValue;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
type RepeaterRow = NonNullable<Parameters<DataTypeFormatter>[3]>;
|
|
@@ -44,6 +49,7 @@ const { name: fieldName, emitFormChange } = useFormField();
|
|
|
44
49
|
const formBus = inject(formBusInjectionKey, null);
|
|
45
50
|
const formErrors = inject(formErrorsInjectionKey, null);
|
|
46
51
|
const formInputs = inject(formInputsInjectionKey, null);
|
|
52
|
+
const markFieldSaved = inject(FORM_FIELD_SAVED_KEY, null);
|
|
47
53
|
|
|
48
54
|
const rows = computed<RepeaterRow[]>(() =>
|
|
49
55
|
Array.isArray(model.value) ? model.value : [],
|
|
@@ -123,11 +129,36 @@ function setCell(
|
|
|
123
129
|
if (fieldName.value) formBus?.emit({ type: "change", name: rowName(index) });
|
|
124
130
|
}
|
|
125
131
|
|
|
132
|
+
/** A row as the user adds it: a copy of each column's `defaultValue`. */
|
|
133
|
+
function newRow(): RepeaterRow {
|
|
134
|
+
const row: RepeaterRow = {};
|
|
135
|
+
for (const column of props.columns)
|
|
136
|
+
if (column.defaultValue !== undefined)
|
|
137
|
+
row[column.id] = cloneFormValue(column.defaultValue);
|
|
138
|
+
return row;
|
|
139
|
+
}
|
|
140
|
+
|
|
126
141
|
function addRow(): void {
|
|
127
142
|
rowKeys.value.push(nextKey++);
|
|
128
|
-
emitRows([...rows.value,
|
|
143
|
+
emitRows([...rows.value, newRow()], false);
|
|
129
144
|
}
|
|
130
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Below `min`, the field gets the missing rows as the value it opens with:
|
|
148
|
+
* the form does not read them as a change to save.
|
|
149
|
+
*/
|
|
150
|
+
watch(
|
|
151
|
+
() => rows.value.length,
|
|
152
|
+
(length) => {
|
|
153
|
+
const missing = (props.min ?? 0) - length;
|
|
154
|
+
if (props.disabled || missing <= 0) return;
|
|
155
|
+
const next = [...rows.value, ...Array.from({ length: missing }, newRow)];
|
|
156
|
+
emitRows(next, false);
|
|
157
|
+
if (props.id) markFieldSaved?.(props.id, next);
|
|
158
|
+
},
|
|
159
|
+
{ immediate: true },
|
|
160
|
+
);
|
|
161
|
+
|
|
131
162
|
function removeRow(index: number): void {
|
|
132
163
|
rowKeys.value.splice(index, 1);
|
|
133
164
|
emitRows(rows.value.filter((_, at) => at !== index));
|
|
@@ -272,12 +272,7 @@ const isStat = computed(() => props.variant === "stat");
|
|
|
272
272
|
class="text-dimmed size-[15px] shrink-0"
|
|
273
273
|
:aria-hidden="true"
|
|
274
274
|
/>
|
|
275
|
-
<DmsEyebrowLabel
|
|
276
|
-
tone="muted"
|
|
277
|
-
truncate
|
|
278
|
-
class="max-sm:whitespace-normal"
|
|
279
|
-
:label="processI18n(title)"
|
|
280
|
-
/>
|
|
275
|
+
<DmsEyebrowLabel tone="muted" :label="processI18n(title)" />
|
|
281
276
|
</div>
|
|
282
277
|
<!-- The value's placeholder takes its 33px line. -->
|
|
283
278
|
<USkeleton
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "../../../build/components/button/DisabledReason.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../build/composables/global/shortcuts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../build/utils/phoneNumber";
|
|
@@ -22,6 +22,8 @@ export interface CustomRowAction {
|
|
|
22
22
|
/** Asked before the target runs: a fixed dialog, or `{ from }`. */
|
|
23
23
|
confirm?: ActionConfirm;
|
|
24
24
|
rule?: RowActionRule;
|
|
25
|
+
/** Shown on a row `rule` keeps the action off, which then stays disabled (`$`: i18n key). */
|
|
26
|
+
disabledReason?: string;
|
|
25
27
|
/** Inline button instead of a menu entry (the backend serializes `isVisible`). */
|
|
26
28
|
isVisible?: boolean;
|
|
27
29
|
/**
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
},
|
|
216
216
|
"pagination": {
|
|
217
217
|
"label": "Navigation",
|
|
218
|
-
"count": "{count} items",
|
|
218
|
+
"count": "{count} item | {count} items",
|
|
219
219
|
"size": "Displayed per {pageSize}",
|
|
220
220
|
"current_page": "Page {currentPage} of {totalPages}",
|
|
221
221
|
"first_page": "First page",
|
|
@@ -444,6 +444,11 @@
|
|
|
444
444
|
"invalid_email": "{value} isn’t a valid email address. | {value} aren’t valid email addresses.",
|
|
445
445
|
"remove": "Remove {value}"
|
|
446
446
|
},
|
|
447
|
+
"phone": {
|
|
448
|
+
"country": "Country",
|
|
449
|
+
"country_search": "Search a country or a code",
|
|
450
|
+
"country_none": "No country matches “{search}”."
|
|
451
|
+
},
|
|
447
452
|
"code": {
|
|
448
453
|
"completion_footer": "↵ insert · Esc close",
|
|
449
454
|
"complete": "complete",
|
|
@@ -521,6 +526,10 @@
|
|
|
521
526
|
"description": "Focus the page's own search",
|
|
522
527
|
"condition": "Settings pages with a search of their own, such as this one"
|
|
523
528
|
},
|
|
529
|
+
"question_mark": {
|
|
530
|
+
"description": "Open the keyboard shortcuts page",
|
|
531
|
+
"condition": "Outside a text field"
|
|
532
|
+
},
|
|
524
533
|
"escape": {
|
|
525
534
|
"description": "Close dialogs, menus and the palette"
|
|
526
535
|
}
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
},
|
|
216
216
|
"pagination": {
|
|
217
217
|
"label": "Navigation",
|
|
218
|
-
"count": "{count} éléments",
|
|
218
|
+
"count": "{count} élément | {count} éléments",
|
|
219
219
|
"size": "Affiché par {pageSize}",
|
|
220
220
|
"current_page": "Page {currentPage} sur {totalPages}",
|
|
221
221
|
"first_page": "Première page",
|
|
@@ -444,6 +444,11 @@
|
|
|
444
444
|
"invalid_email": "{value} n’est pas une adresse e-mail valide. | {value} ne sont pas des adresses e-mail valides.",
|
|
445
445
|
"remove": "Retirer {value}"
|
|
446
446
|
},
|
|
447
|
+
"phone": {
|
|
448
|
+
"country": "Pays",
|
|
449
|
+
"country_search": "Rechercher un pays ou un indicatif",
|
|
450
|
+
"country_none": "Aucun pays ne correspond à « {search} »."
|
|
451
|
+
},
|
|
447
452
|
"code": {
|
|
448
453
|
"completion_footer": "↵ insérer · Échap fermer",
|
|
449
454
|
"complete": "compléter",
|
|
@@ -521,6 +526,10 @@
|
|
|
521
526
|
"description": "Aller à la recherche propre à la page",
|
|
522
527
|
"condition": "Pages de paramètres qui ont leur propre recherche, comme celle-ci"
|
|
523
528
|
},
|
|
529
|
+
"question_mark": {
|
|
530
|
+
"description": "Ouvrir la page des raccourcis clavier",
|
|
531
|
+
"condition": "En dehors d'un champ de texte"
|
|
532
|
+
},
|
|
524
533
|
"escape": {
|
|
525
534
|
"description": "Fermer les dialogues, les menus et la palette"
|
|
526
535
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "AntelopeJS DMS. Plug in your PostgreSQL, MySQL, MariaDB, MongoDB or RethinkDB database and your coding agent builds a back office and analytics dashboard as typed TypeScript. Real-time updates on the data the DMS manages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -89,8 +89,6 @@
|
|
|
89
89
|
"@antelopejs/interface-data-api": ">=0.8.0 <0.9.0",
|
|
90
90
|
"@antelopejs/interface-database": ">=0.4.0 <0.5.0",
|
|
91
91
|
"@antelopejs/interface-database-decorators": ">=0.5.2 <0.6.0",
|
|
92
|
-
"@antelopejs/interface-dms": "0.14.7-next.999.g264d3a3",
|
|
93
|
-
"@antelopejs/interface-dms-builder": "0.6.2-next.987.gb437fd0",
|
|
94
92
|
"@antelopejs/interface-email": ">=0.2.1 <0.3.0",
|
|
95
93
|
"@antelopejs/interface-file-storage": ">=0.1.4 <0.2.0",
|
|
96
94
|
"@csstools/css-tokenizer": "4.0.0",
|
|
@@ -102,6 +100,7 @@
|
|
|
102
100
|
"dompurify": "^3.4.17",
|
|
103
101
|
"jsdom": "^29.1.1",
|
|
104
102
|
"jsonwebtoken": "^9.0.3",
|
|
103
|
+
"libphonenumber-js": "^1.13.16",
|
|
105
104
|
"mmdb-lib": "^3.0.3",
|
|
106
105
|
"node-cron": "^4.2.1",
|
|
107
106
|
"parse5": "^7.3.0",
|
|
@@ -112,7 +111,9 @@
|
|
|
112
111
|
"ts-morph": "^28.0.0",
|
|
113
112
|
"ua-parser-js": "^2.0.9",
|
|
114
113
|
"zod": "^3.25.0",
|
|
115
|
-
"zod-to-json-schema": "~3.24.6"
|
|
114
|
+
"zod-to-json-schema": "~3.24.6",
|
|
115
|
+
"@antelopejs/interface-dms": "^0.15.0",
|
|
116
|
+
"@antelopejs/interface-dms-builder": "^0.6.2"
|
|
116
117
|
},
|
|
117
118
|
"devDependencies": {
|
|
118
119
|
"@antelopejs/api": "~1.7.8",
|
|
@@ -212,7 +213,7 @@
|
|
|
212
213
|
"optional": true
|
|
213
214
|
}
|
|
214
215
|
},
|
|
215
|
-
"gitHead": "
|
|
216
|
+
"gitHead": "01eb08d8cc674e8b034fada65a3135d99ffdab09",
|
|
216
217
|
"scripts": {
|
|
217
218
|
"build": "pnpm --filter @antelopejs/interface-dms --filter @antelopejs/interface-dms-builder build && rimraf dist && antelopejs-tsc && tsc-alias && tsc -p e2e/tsconfig.types.json",
|
|
218
219
|
"dev": "ajs project run --inspect -w -p playground",
|