@xleddyl/443-components-vue 0.0.0 → 0.2.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/README.md +81 -20
- package/dist/chart/BarChart.vue.d.ts +6 -6
- package/dist/chart/ChartLegend.vue.d.ts +16 -16
- package/dist/chart/ChartPanel.vue +10 -6
- package/dist/chart/ChartPanel.vue.d.ts +6 -8
- package/dist/chart/ChartSummary.vue.d.ts +6 -6
- package/dist/chart/DoughnutChart.vue.d.ts +6 -6
- package/dist/chart/LineChart.vue.d.ts +6 -6
- package/dist/components/core/Button.vue +3 -1
- package/dist/components/core/Button.vue.d.ts +6 -6
- package/dist/components/core/FormField.vue.d.ts +6 -6
- package/dist/components/core/Icon.vue +9 -1
- package/dist/components/core/Icon.vue.d.ts +4 -4
- package/dist/components/core/Input.vue +6 -3
- package/dist/components/core/Input.vue.d.ts +18 -19
- package/dist/components/core/Kbd.vue.d.ts +6 -6
- package/dist/components/core/Root.vue.d.ts +10 -10
- package/dist/components/core/Spinner.vue +7 -3
- package/dist/components/core/Spinner.vue.d.ts +6 -7
- package/dist/components/core/Textarea.vue +36 -23
- package/dist/components/core/Textarea.vue.d.ts +31 -21
- package/dist/components/core/VisuallyHidden.vue.d.ts +10 -10
- package/dist/components/data/Avatar.vue +4 -2
- package/dist/components/data/Avatar.vue.d.ts +6 -6
- package/dist/components/data/AvatarGroup.vue +5 -2
- package/dist/components/data/AvatarGroup.vue.d.ts +7 -8
- package/dist/components/data/Badge.vue.d.ts +6 -6
- package/dist/components/data/DescriptionList.vue +7 -3
- package/dist/components/data/DescriptionList.vue.d.ts +7 -8
- package/dist/components/data/FilterPills.vue +13 -4
- package/dist/components/data/FilterPills.vue.d.ts +16 -18
- package/dist/components/data/Pagination.vue +23 -14
- package/dist/components/data/Pagination.vue.d.ts +16 -23
- package/dist/components/data/Stat.vue +9 -6
- package/dist/components/data/Stat.vue.d.ts +10 -13
- package/dist/components/data/Table.vue +12 -7
- package/dist/components/data/Tag.vue +7 -4
- package/dist/components/data/Tag.vue.d.ts +16 -17
- package/dist/components/data/Timeline.vue.d.ts +6 -6
- package/dist/components/data/Tree.vue +5 -2
- package/dist/components/data/Tree.vue.d.ts +16 -17
- package/dist/components/feedback/Alert.vue +5 -2
- package/dist/components/feedback/Alert.vue.d.ts +14 -15
- package/dist/components/feedback/EmptyState.vue.d.ts +7 -7
- package/dist/components/feedback/LoadingOverlay.vue +8 -4
- package/dist/components/feedback/LoadingOverlay.vue.d.ts +6 -7
- package/dist/components/feedback/Meter.vue.d.ts +6 -6
- package/dist/components/feedback/Progress.vue +6 -3
- package/dist/components/feedback/Progress.vue.d.ts +6 -7
- package/dist/components/feedback/ProgressRing.vue +5 -2
- package/dist/components/feedback/ProgressRing.vue.d.ts +6 -7
- package/dist/components/feedback/Skeleton.vue.d.ts +6 -6
- package/dist/components/forms/Calendar.vue +16 -11
- package/dist/components/forms/Calendar.vue.d.ts +17 -21
- package/dist/components/forms/ColorInput.vue +8 -4
- package/dist/components/forms/ColorInput.vue.d.ts +18 -20
- package/dist/components/forms/Combobox.vue +31 -19
- package/dist/components/forms/Combobox.vue.d.ts +2 -2
- package/dist/components/forms/DateInput.vue.d.ts +16 -16
- package/dist/components/forms/DatePicker.vue +17 -11
- package/dist/components/forms/DatePicker.vue.d.ts +14 -18
- package/dist/components/forms/FileInput.vue +23 -13
- package/dist/components/forms/FileInput.vue.d.ts +17 -23
- package/dist/components/forms/InputAddon.vue.d.ts +6 -6
- package/dist/components/forms/InputGroup.vue.d.ts +6 -6
- package/dist/components/forms/NumberInput.vue +15 -10
- package/dist/components/forms/NumberInput.vue.d.ts +16 -19
- package/dist/components/forms/PasswordInput.vue +21 -13
- package/dist/components/forms/PasswordInput.vue.d.ts +14 -20
- package/dist/components/forms/PinInput.vue +7 -2
- package/dist/components/forms/PinInput.vue.d.ts +18 -16
- package/dist/components/forms/Radio.vue.d.ts +6 -6
- package/dist/components/forms/Slider.vue.d.ts +18 -18
- package/dist/components/forms/Switch.vue.d.ts +16 -16
- package/dist/components/forms/TimeInput.vue.d.ts +16 -16
- package/dist/components/layout/Accordion.vue.d.ts +16 -16
- package/dist/components/layout/AppShell.vue +11 -6
- package/dist/components/layout/AppShell.vue.d.ts +16 -19
- package/dist/components/layout/Breadcrumbs.vue +5 -2
- package/dist/components/layout/Breadcrumbs.vue.d.ts +6 -7
- package/dist/components/layout/Card.vue.d.ts +8 -8
- package/dist/components/layout/CopyButton.vue +11 -6
- package/dist/components/layout/CopyButton.vue.d.ts +16 -18
- package/dist/components/layout/Grid.vue.d.ts +7 -7
- package/dist/components/layout/NavLink.vue.d.ts +10 -10
- package/dist/components/layout/PageHeader.vue.d.ts +6 -6
- package/dist/components/layout/Separator.vue.d.ts +6 -6
- package/dist/components/layout/Sidebar.vue +10 -5
- package/dist/components/layout/Sidebar.vue.d.ts +7 -11
- package/dist/components/layout/SidebarSection.vue.d.ts +6 -6
- package/dist/components/layout/Stack.vue.d.ts +10 -10
- package/dist/components/layout/Tabs.vue.d.ts +16 -16
- package/dist/components/layout/ThemeSwitch.vue +12 -6
- package/dist/components/layout/ThemeSwitch.vue.d.ts +6 -7
- package/dist/components/layout/Toolbar.vue.d.ts +6 -6
- package/dist/components/overlays/CommandPalette.vue +38 -24
- package/dist/components/overlays/CommandPalette.vue.d.ts +18 -30
- package/dist/components/overlays/ConfirmDialog.vue +14 -9
- package/dist/components/overlays/ConfirmDialog.vue.d.ts +12 -15
- package/dist/components/overlays/ConfirmHost.vue +6 -3
- package/dist/components/overlays/ConfirmHost.vue.d.ts +16 -16
- package/dist/components/overlays/ContextMenu.vue +6 -3
- package/dist/components/overlays/ContextMenu.vue.d.ts +11 -13
- package/dist/components/overlays/Drawer.vue +1 -1
- package/dist/components/overlays/Drawer.vue.d.ts +10 -11
- package/dist/components/overlays/DropdownMenu.vue.d.ts +10 -10
- package/dist/components/overlays/HoverCard.vue.d.ts +16 -16
- package/dist/components/overlays/Modal.vue +1 -1
- package/dist/components/overlays/Modal.vue.d.ts +10 -11
- package/dist/components/overlays/OverlayHost.vue.d.ts +1 -1
- package/dist/components/overlays/Popover.vue.d.ts +16 -16
- package/dist/components/overlays/Toaster.vue +8 -4
- package/dist/components/overlays/Toaster.vue.d.ts +8 -10
- package/dist/components/overlays/Tooltip.vue.d.ts +6 -6
- package/dist/components/templates/AccountMenu.vue +5 -2
- package/dist/components/templates/AccountMenu.vue.d.ts +18 -19
- package/dist/components/templates/AppearanceSettings.vue +26 -12
- package/dist/components/templates/AppearanceSettings.vue.d.ts +7 -11
- package/dist/components/templates/AuthLayout.vue +11 -7
- package/dist/components/templates/AuthLayout.vue.d.ts +6 -9
- package/dist/components/templates/Brand.vue.d.ts +10 -10
- package/dist/components/templates/DashboardLayout.vue +25 -16
- package/dist/components/templates/DashboardLayout.vue.d.ts +12 -24
- package/dist/components/templates/DashboardPage.vue +7 -3
- package/dist/components/templates/DashboardPage.vue.d.ts +6 -7
- package/dist/components/templates/DetailPage.vue +14 -8
- package/dist/components/templates/DetailPage.vue.d.ts +14 -18
- package/dist/components/templates/EmptyPage.vue +15 -8
- package/dist/components/templates/EmptyPage.vue.d.ts +7 -11
- package/dist/components/templates/ErrorPage.vue +32 -25
- package/dist/components/templates/ErrorPage.vue.d.ts +6 -6
- package/dist/components/templates/FormPage.vue +19 -11
- package/dist/components/templates/FormPage.vue.d.ts +3 -3
- package/dist/components/templates/ListPage.vue +39 -23
- package/dist/components/templates/ListPage.vue.d.ts +2 -2
- package/dist/components/templates/NotFoundPage.vue +4 -4
- package/dist/components/templates/NotFoundPage.vue.d.ts +1 -1
- package/dist/components/templates/SaveBar.vue +20 -11
- package/dist/components/templates/SaveBar.vue.d.ts +16 -19
- package/dist/components/templates/SettingsGroup.vue.d.ts +7 -7
- package/dist/components/templates/SettingsModal.vue +29 -21
- package/dist/components/templates/SettingsModal.vue.d.ts +15 -25
- package/dist/components/templates/SettingsPage.vue +8 -5
- package/dist/components/templates/SettingsPage.vue.d.ts +18 -21
- package/dist/components/templates/SettingsSection.vue +7 -3
- package/dist/components/templates/SettingsSection.vue.d.ts +8 -9
- package/dist/composables/core.d.ts +1 -0
- package/dist/composables/core.mjs +1 -0
- package/dist/composables/useAlert.mjs +3 -1
- package/dist/composables/useConfirm.mjs +5 -3
- package/dist/composables/useDirtyGuard.mjs +7 -5
- package/dist/composables/useForm.d.ts +4 -1
- package/dist/composables/useForm.mjs +33 -16
- package/dist/composables/useIcons.d.ts +4 -0
- package/dist/composables/useIcons.mjs +10 -0
- package/dist/composables/useLocale.d.ts +11 -0
- package/dist/composables/useLocale.mjs +26 -0
- package/dist/composables/usePasswordStrength.mjs +11 -7
- package/dist/composables/usePrompt.mjs +3 -1
- package/dist/editor/RichTextEditor.vue +20 -14
- package/dist/editor/RichTextEditor.vue.d.ts +22 -15
- package/dist/editor/index.d.ts +0 -1
- package/dist/editor/index.mjs +0 -1
- package/dist/editor/types.d.ts +3 -18
- package/dist/grid/DataGrid.vue +11 -2
- package/dist/grid/GridToolbar.vue +6 -2
- package/dist/grid/GridToolbar.vue.d.ts +21 -20
- package/dist/grid/cells/BadgeCell.vue.d.ts +6 -6
- package/dist/grid/cells/BooleanCell.vue +5 -2
- package/dist/grid/cells/BooleanCell.vue.d.ts +6 -6
- package/dist/grid/cells/DateCell.vue +4 -1
- package/dist/grid/cells/DateCell.vue.d.ts +6 -6
- package/dist/grid/cells/ImageCell.vue.d.ts +6 -6
- package/dist/grid/cells/LinkCell.vue.d.ts +6 -6
- package/dist/grid/index.d.ts +0 -1
- package/dist/grid/index.mjs +0 -1
- package/dist/grid/types.d.ts +5 -17
- package/dist/icons/collections.d.ts +39 -0
- package/dist/icons/collections.mjs +67 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +11 -1
- package/dist/internal/feedback/LoadingHost.vue +6 -3
- package/dist/internal/feedback/LoadingHost.vue.d.ts +0 -1
- package/dist/internal/forms/files.mjs +1 -1
- package/dist/internal/forms/standard-schema.d.ts +26 -0
- package/dist/internal/forms/standard-schema.mjs +21 -0
- package/dist/internal/keys.d.ts +4 -1
- package/dist/internal/keys.mjs +2 -0
- package/dist/internal/overlays/DialogFrame.vue +5 -2
- package/dist/internal/overlays/DialogFrame.vue.d.ts +14 -14
- package/dist/internal/overlays/MenuList.vue.d.ts +16 -16
- package/dist/internal/overlays/OverlayView.vue.d.ts +16 -16
- package/dist/internal/overlays/confirm.d.ts +3 -0
- package/dist/locale/en.d.ts +2 -0
- package/dist/locale/en.mjs +284 -0
- package/dist/locale/index.d.ts +16 -0
- package/dist/locale/index.mjs +50 -0
- package/dist/locale/it.d.ts +2 -0
- package/dist/locale/it.mjs +284 -0
- package/dist/locale/types.d.ts +292 -0
- package/dist/locale/types.mjs +0 -0
- package/dist/nuxt/module.d.ts +14 -0
- package/dist/nuxt/module.mjs +136 -8
- package/dist/nuxt/runtime/layouts/auth.vue.d.ts +16 -16
- package/dist/nuxt/runtime/layouts/dashboard.vue.d.ts +16 -16
- package/dist/nuxt/runtime/locale.d.ts +2 -0
- package/dist/nuxt/runtime/locale.mjs +20 -0
- package/dist/styles/core/icon.css +4 -0
- package/dist/styles/core/textarea.css +21 -0
- package/package.json +1 -1
- package/dist/editor/messages.d.ts +0 -2
- package/dist/editor/messages.mjs +0 -18
- package/dist/grid/messages.d.ts +0 -3
- package/dist/grid/messages.mjs +0 -21
|
@@ -18,7 +18,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
18
18
|
account?: SettingsModalAccount;
|
|
19
19
|
presets?: readonly ThemePreset[] | false;
|
|
20
20
|
title?: string | undefined;
|
|
21
|
-
closeLabel?: string
|
|
21
|
+
closeLabel?: string;
|
|
22
22
|
navLabel?: string;
|
|
23
23
|
signOutLabel?: string;
|
|
24
24
|
sessionLabel?: string;
|
|
@@ -35,15 +35,18 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
35
35
|
open?: boolean | undefined;
|
|
36
36
|
section?: string;
|
|
37
37
|
key?: PropertyKey | undefined;
|
|
38
|
-
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
prefix?: "k-modal" | "k-drawer" | undefined;
|
|
40
|
+
style?: import("vue").StyleValue;
|
|
41
|
+
results?: (string | number) | undefined;
|
|
42
|
+
placeholder?: string | undefined;
|
|
39
43
|
description?: string;
|
|
44
|
+
size?: import("../overlays/types.ts").ModalSize;
|
|
40
45
|
ref?: import("vue").VNodeRef | undefined;
|
|
41
|
-
placeholder?: string | undefined;
|
|
42
46
|
class?: import("vue").ClassValue;
|
|
43
47
|
role?: string | undefined;
|
|
44
48
|
'aria-label'?: string | undefined;
|
|
45
49
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
46
|
-
style?: import("vue").StyleValue;
|
|
47
50
|
onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
48
51
|
onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
49
52
|
onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
@@ -206,7 +209,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
206
209
|
about?: string | undefined;
|
|
207
210
|
datatype?: string | undefined;
|
|
208
211
|
inlist?: any;
|
|
209
|
-
prefix?: "k-modal" | "k-drawer" | undefined;
|
|
210
212
|
property?: string | undefined;
|
|
211
213
|
resource?: string | undefined;
|
|
212
214
|
typeof?: string | undefined;
|
|
@@ -219,7 +221,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
219
221
|
itemtype?: string | undefined;
|
|
220
222
|
itemid?: string | undefined;
|
|
221
223
|
itemref?: string | undefined;
|
|
222
|
-
results?: (string | number) | undefined;
|
|
223
224
|
security?: string | undefined;
|
|
224
225
|
unselectable?: "on" | "off" | undefined;
|
|
225
226
|
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
@@ -227,7 +228,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
227
228
|
exportparts?: string;
|
|
228
229
|
part?: string;
|
|
229
230
|
popover?: import("../../index.ts").PopoverMode | "" | boolean;
|
|
230
|
-
loading?: boolean;
|
|
231
231
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
232
232
|
onVnodeBeforeMount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
233
233
|
onVnodeMounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
@@ -252,7 +252,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
252
252
|
account?: SettingsModalAccount;
|
|
253
253
|
presets?: readonly ThemePreset[] | false;
|
|
254
254
|
title?: string | undefined;
|
|
255
|
-
closeLabel?: string
|
|
255
|
+
closeLabel?: string;
|
|
256
256
|
navLabel?: string;
|
|
257
257
|
signOutLabel?: string;
|
|
258
258
|
sessionLabel?: string;
|
|
@@ -269,15 +269,18 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
269
269
|
open?: boolean | undefined;
|
|
270
270
|
section?: string;
|
|
271
271
|
key?: PropertyKey | undefined;
|
|
272
|
-
|
|
272
|
+
loading?: boolean;
|
|
273
|
+
prefix?: "k-modal" | "k-drawer" | undefined;
|
|
274
|
+
style?: import("vue").StyleValue;
|
|
275
|
+
results?: (string | number) | undefined;
|
|
276
|
+
placeholder?: string | undefined;
|
|
273
277
|
description?: string;
|
|
278
|
+
size?: import("../overlays/types.ts").ModalSize;
|
|
274
279
|
ref?: import("vue").VNodeRef | undefined;
|
|
275
|
-
placeholder?: string | undefined;
|
|
276
280
|
class?: import("vue").ClassValue;
|
|
277
281
|
role?: string | undefined;
|
|
278
282
|
'aria-label'?: string | undefined;
|
|
279
283
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
280
|
-
style?: import("vue").StyleValue;
|
|
281
284
|
onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
282
285
|
onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
283
286
|
onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
@@ -440,7 +443,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
440
443
|
about?: string | undefined;
|
|
441
444
|
datatype?: string | undefined;
|
|
442
445
|
inlist?: any;
|
|
443
|
-
prefix?: "k-modal" | "k-drawer" | undefined;
|
|
444
446
|
property?: string | undefined;
|
|
445
447
|
resource?: string | undefined;
|
|
446
448
|
typeof?: string | undefined;
|
|
@@ -453,7 +455,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
453
455
|
itemtype?: string | undefined;
|
|
454
456
|
itemid?: string | undefined;
|
|
455
457
|
itemref?: string | undefined;
|
|
456
|
-
results?: (string | number) | undefined;
|
|
457
458
|
security?: string | undefined;
|
|
458
459
|
unselectable?: "on" | "off" | undefined;
|
|
459
460
|
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
@@ -461,7 +462,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
461
462
|
exportparts?: string;
|
|
462
463
|
part?: string;
|
|
463
464
|
popover?: import("../../index.ts").PopoverMode | "" | boolean;
|
|
464
|
-
loading?: boolean;
|
|
465
465
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
466
466
|
onVnodeBeforeMount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
467
467
|
onVnodeMounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
@@ -482,22 +482,12 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
482
482
|
onAfterLeave?: (() => any) | undefined;
|
|
483
483
|
"onUpdate:section"?: ((value: string | undefined) => any) | undefined;
|
|
484
484
|
}>, {
|
|
485
|
-
|
|
486
|
-
closeLabel: string;
|
|
485
|
+
sections: SettingsModalSection[];
|
|
487
486
|
presets: false | readonly ThemePreset[];
|
|
488
487
|
themeLabel: string;
|
|
489
488
|
themeText: string;
|
|
490
489
|
presetLabel: string;
|
|
491
490
|
presetText: string;
|
|
492
|
-
sections: SettingsModalSection[];
|
|
493
|
-
navLabel: string;
|
|
494
|
-
signOutLabel: string;
|
|
495
|
-
sessionLabel: string;
|
|
496
|
-
sessionText: string;
|
|
497
|
-
accountLabel: string;
|
|
498
|
-
accountText: string;
|
|
499
|
-
appearanceLabel: string;
|
|
500
|
-
appearanceText: string;
|
|
501
491
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
502
492
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
503
493
|
declare const _default: typeof __VLS_export;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</PageHeader>
|
|
12
12
|
|
|
13
13
|
<div class="k-settings-layout" :class="{ 'has-nav': sections.length > 0 }">
|
|
14
|
-
<nav v-if="sections.length" class="k-settings-nav" :aria-label="
|
|
14
|
+
<nav v-if="sections.length" class="k-settings-nav" :aria-label="navText">
|
|
15
15
|
<ul role="list" class="k-settings-nav-list">
|
|
16
16
|
<li v-for="item in sections" :key="item.value">
|
|
17
17
|
<NavLink
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
|
|
76
76
|
<script setup>
|
|
77
77
|
import { computed, nextTick, useTemplateRef } from "vue";
|
|
78
|
+
import { useLocale } from "../../composables/useLocale";
|
|
78
79
|
import { matchesPath, targetPath, useCurrentPath } from "../../internal/layout/route";
|
|
79
80
|
import Icon from "../core/Icon.vue";
|
|
80
81
|
import NavLink from "../layout/NavLink.vue";
|
|
@@ -87,16 +88,18 @@ const props = defineProps({
|
|
|
87
88
|
breadcrumbs: { type: Array, required: false },
|
|
88
89
|
level: { type: Number, required: false, default: 1 },
|
|
89
90
|
sections: { type: Array, required: false, default: () => [] },
|
|
90
|
-
navLabel: { type: String, required: false
|
|
91
|
+
navLabel: { type: String, required: false },
|
|
91
92
|
currentPath: { type: String, required: false },
|
|
92
93
|
dirty: { type: Boolean, required: false },
|
|
93
94
|
saving: { type: Boolean, required: false },
|
|
94
95
|
saveBar: { type: Boolean, required: false, default: true },
|
|
95
|
-
dirtyMessage: { type: String, required: false
|
|
96
|
-
saveLabel: { type: String, required: false
|
|
97
|
-
discardLabel: { type: [String, Boolean], required: false, default:
|
|
96
|
+
dirtyMessage: { type: String, required: false },
|
|
97
|
+
saveLabel: { type: String, required: false },
|
|
98
|
+
discardLabel: { type: [String, Boolean], required: false, default: void 0 },
|
|
98
99
|
form: { type: String, required: false }
|
|
99
100
|
});
|
|
101
|
+
const { t } = useLocale();
|
|
102
|
+
const navText = computed(() => props.navLabel ?? t("settings.sections"));
|
|
100
103
|
const emit = defineEmits(["save", "discard"]);
|
|
101
104
|
defineSlots();
|
|
102
105
|
const section = defineModel("section", { type: String });
|
|
@@ -30,13 +30,15 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
30
30
|
form?: string;
|
|
31
31
|
section?: string;
|
|
32
32
|
key?: PropertyKey | undefined;
|
|
33
|
-
|
|
33
|
+
prefix?: string | undefined | undefined;
|
|
34
|
+
style?: import("vue").StyleValue;
|
|
35
|
+
results?: (string | number) | undefined;
|
|
34
36
|
placeholder?: string | undefined | undefined;
|
|
37
|
+
ref?: import("vue").VNodeRef | undefined;
|
|
35
38
|
class?: import("vue").ClassValue;
|
|
36
39
|
role?: string | undefined | undefined;
|
|
37
40
|
'aria-label'?: string | undefined | undefined;
|
|
38
41
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
39
|
-
style?: import("vue").StyleValue;
|
|
40
42
|
onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
41
43
|
onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
42
44
|
onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
@@ -145,7 +147,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
145
147
|
'aria-colindex'?: (string | number) | undefined;
|
|
146
148
|
'aria-colspan'?: (string | number) | undefined;
|
|
147
149
|
'aria-controls'?: string | undefined | undefined;
|
|
148
|
-
'aria-current'?: "location" | "time" | (boolean | "true" | "false") | "
|
|
150
|
+
'aria-current'?: "page" | "location" | "time" | (boolean | "true" | "false") | "step" | "date" | undefined;
|
|
149
151
|
'aria-describedby'?: string | undefined | undefined;
|
|
150
152
|
'aria-details'?: string | undefined | undefined;
|
|
151
153
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -154,7 +156,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
154
156
|
'aria-expanded'?: (boolean | "true" | "false") | undefined;
|
|
155
157
|
'aria-flowto'?: string | undefined | undefined;
|
|
156
158
|
'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
157
|
-
'aria-haspopup'?: "dialog" | "menu" | (boolean | "true" | "false") | "listbox" |
|
|
159
|
+
'aria-haspopup'?: "grid" | "tree" | "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | undefined;
|
|
158
160
|
'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling" | undefined;
|
|
159
161
|
'aria-keyshortcuts'?: string | undefined | undefined;
|
|
160
162
|
'aria-labelledby'?: string | undefined | undefined;
|
|
@@ -190,7 +192,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
190
192
|
dir?: string | undefined | undefined;
|
|
191
193
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
192
194
|
enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
193
|
-
enterKeyHint?: "search" | "done" | "
|
|
195
|
+
enterKeyHint?: "search" | "done" | "previous" | "next" | "enter" | "go" | "send" | undefined;
|
|
194
196
|
hidden?: "" | (boolean | "true" | "false") | "hidden" | "until-found" | undefined;
|
|
195
197
|
inert?: (boolean | "true" | "false") | undefined;
|
|
196
198
|
spellcheck?: (boolean | "true" | "false") | undefined;
|
|
@@ -199,7 +201,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
199
201
|
about?: string | undefined | undefined;
|
|
200
202
|
datatype?: string | undefined | undefined;
|
|
201
203
|
inlist?: any;
|
|
202
|
-
prefix?: string | undefined | undefined;
|
|
203
204
|
property?: string | undefined | undefined;
|
|
204
205
|
resource?: string | undefined | undefined;
|
|
205
206
|
typeof?: string | undefined | undefined;
|
|
@@ -212,7 +213,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
212
213
|
itemtype?: string | undefined | undefined;
|
|
213
214
|
itemid?: string | undefined | undefined;
|
|
214
215
|
itemref?: string | undefined | undefined;
|
|
215
|
-
results?: (string | number) | undefined;
|
|
216
216
|
security?: string | undefined | undefined;
|
|
217
217
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
218
218
|
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
@@ -221,9 +221,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
221
221
|
part?: string | undefined;
|
|
222
222
|
popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
|
|
223
223
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
224
|
-
"update:section": (value: string | undefined) => any;
|
|
225
224
|
save: () => any;
|
|
226
225
|
discard: () => any;
|
|
226
|
+
"update:section": (value: string | undefined) => any;
|
|
227
227
|
}, string, import("vue").PublicProps, Readonly<{
|
|
228
228
|
title?: string | undefined;
|
|
229
229
|
description?: string;
|
|
@@ -242,13 +242,15 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
242
242
|
form?: string;
|
|
243
243
|
section?: string;
|
|
244
244
|
key?: PropertyKey | undefined;
|
|
245
|
-
|
|
245
|
+
prefix?: string | undefined | undefined;
|
|
246
|
+
style?: import("vue").StyleValue;
|
|
247
|
+
results?: (string | number) | undefined;
|
|
246
248
|
placeholder?: string | undefined | undefined;
|
|
249
|
+
ref?: import("vue").VNodeRef | undefined;
|
|
247
250
|
class?: import("vue").ClassValue;
|
|
248
251
|
role?: string | undefined | undefined;
|
|
249
252
|
'aria-label'?: string | undefined | undefined;
|
|
250
253
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
251
|
-
style?: import("vue").StyleValue;
|
|
252
254
|
onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
253
255
|
onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
254
256
|
onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
@@ -357,7 +359,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
357
359
|
'aria-colindex'?: (string | number) | undefined;
|
|
358
360
|
'aria-colspan'?: (string | number) | undefined;
|
|
359
361
|
'aria-controls'?: string | undefined | undefined;
|
|
360
|
-
'aria-current'?: "location" | "time" | (boolean | "true" | "false") | "
|
|
362
|
+
'aria-current'?: "page" | "location" | "time" | (boolean | "true" | "false") | "step" | "date" | undefined;
|
|
361
363
|
'aria-describedby'?: string | undefined | undefined;
|
|
362
364
|
'aria-details'?: string | undefined | undefined;
|
|
363
365
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -366,7 +368,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
366
368
|
'aria-expanded'?: (boolean | "true" | "false") | undefined;
|
|
367
369
|
'aria-flowto'?: string | undefined | undefined;
|
|
368
370
|
'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
369
|
-
'aria-haspopup'?: "dialog" | "menu" | (boolean | "true" | "false") | "listbox" |
|
|
371
|
+
'aria-haspopup'?: "grid" | "tree" | "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | undefined;
|
|
370
372
|
'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling" | undefined;
|
|
371
373
|
'aria-keyshortcuts'?: string | undefined | undefined;
|
|
372
374
|
'aria-labelledby'?: string | undefined | undefined;
|
|
@@ -402,7 +404,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
402
404
|
dir?: string | undefined | undefined;
|
|
403
405
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
404
406
|
enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
405
|
-
enterKeyHint?: "search" | "done" | "
|
|
407
|
+
enterKeyHint?: "search" | "done" | "previous" | "next" | "enter" | "go" | "send" | undefined;
|
|
406
408
|
hidden?: "" | (boolean | "true" | "false") | "hidden" | "until-found" | undefined;
|
|
407
409
|
inert?: (boolean | "true" | "false") | undefined;
|
|
408
410
|
spellcheck?: (boolean | "true" | "false") | undefined;
|
|
@@ -411,7 +413,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
411
413
|
about?: string | undefined | undefined;
|
|
412
414
|
datatype?: string | undefined | undefined;
|
|
413
415
|
inlist?: any;
|
|
414
|
-
prefix?: string | undefined | undefined;
|
|
415
416
|
property?: string | undefined | undefined;
|
|
416
417
|
resource?: string | undefined | undefined;
|
|
417
418
|
typeof?: string | undefined | undefined;
|
|
@@ -424,7 +425,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
424
425
|
itemtype?: string | undefined | undefined;
|
|
425
426
|
itemid?: string | undefined | undefined;
|
|
426
427
|
itemref?: string | undefined | undefined;
|
|
427
|
-
results?: (string | number) | undefined;
|
|
428
428
|
security?: string | undefined | undefined;
|
|
429
429
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
430
430
|
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
@@ -433,17 +433,14 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
433
433
|
part?: string | undefined;
|
|
434
434
|
popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
|
|
435
435
|
}> & Readonly<{
|
|
436
|
-
"onUpdate:section"?: ((value: string | undefined) => any) | undefined;
|
|
437
436
|
onSave?: (() => any) | undefined;
|
|
438
437
|
onDiscard?: (() => any) | undefined;
|
|
438
|
+
"onUpdate:section"?: ((value: string | undefined) => any) | undefined;
|
|
439
439
|
}>, {
|
|
440
|
-
|
|
440
|
+
saveBar: boolean;
|
|
441
441
|
sections: SettingsNavItem[];
|
|
442
|
-
|
|
443
|
-
dirtyMessage: string;
|
|
444
|
-
saveLabel: string;
|
|
442
|
+
level: HeadingLevel;
|
|
445
443
|
discardLabel: string | false;
|
|
446
|
-
saveBar: boolean;
|
|
447
444
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
448
445
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
449
446
|
declare const _default: typeof __VLS_export;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
:loading="saving"
|
|
25
25
|
:disabled="saveDisabled"
|
|
26
26
|
@click="form ? void 0 : emit('save')"
|
|
27
|
-
>{{
|
|
27
|
+
>{{ saveText }}</Button
|
|
28
28
|
>
|
|
29
29
|
</slot>
|
|
30
30
|
</div>
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script setup>
|
|
36
|
+
import { computed } from "vue";
|
|
37
|
+
import { useLocale } from "../../composables/useLocale";
|
|
36
38
|
import Button from "../core/Button.vue";
|
|
37
39
|
import Card from "../layout/Card.vue";
|
|
38
|
-
defineProps({
|
|
40
|
+
const props = defineProps({
|
|
39
41
|
title: { type: String, required: false },
|
|
40
42
|
description: { type: String, required: false },
|
|
41
43
|
icon: { type: null, required: false },
|
|
@@ -43,9 +45,11 @@ defineProps({
|
|
|
43
45
|
saveable: { type: Boolean, required: false },
|
|
44
46
|
saving: { type: Boolean, required: false },
|
|
45
47
|
saveDisabled: { type: Boolean, required: false },
|
|
46
|
-
saveLabel: { type: String, required: false
|
|
48
|
+
saveLabel: { type: String, required: false },
|
|
47
49
|
form: { type: String, required: false },
|
|
48
50
|
level: { type: Number, required: false, default: 2 }
|
|
49
51
|
});
|
|
52
|
+
const { t } = useLocale();
|
|
53
|
+
const saveText = computed(() => props.saveLabel ?? t("common.save"));
|
|
50
54
|
const emit = defineEmits(["save"]);
|
|
51
55
|
</script>
|
|
@@ -22,16 +22,18 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
22
22
|
form?: string;
|
|
23
23
|
level?: HeadingLevel;
|
|
24
24
|
key?: PropertyKey | undefined;
|
|
25
|
+
prefix?: string | undefined;
|
|
26
|
+
style?: import("vue").StyleValue;
|
|
27
|
+
results?: (string | number) | undefined;
|
|
28
|
+
placeholder?: string | undefined;
|
|
25
29
|
bind?: Record<string, unknown>;
|
|
26
30
|
type?: string | undefined;
|
|
27
31
|
ref?: import("vue").VNodeRef | undefined;
|
|
28
|
-
placeholder?: string | undefined;
|
|
29
32
|
target?: string | undefined;
|
|
30
33
|
class?: import("vue").ClassValue;
|
|
31
34
|
role?: string | undefined;
|
|
32
35
|
'aria-label'?: string | undefined;
|
|
33
36
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
34
|
-
style?: import("vue").StyleValue;
|
|
35
37
|
onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
36
38
|
onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
37
39
|
onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
@@ -197,7 +199,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
197
199
|
about?: string | undefined;
|
|
198
200
|
datatype?: string | undefined;
|
|
199
201
|
inlist?: any;
|
|
200
|
-
prefix?: string | undefined;
|
|
201
202
|
property?: string | undefined;
|
|
202
203
|
resource?: string | undefined;
|
|
203
204
|
typeof?: string | undefined;
|
|
@@ -210,7 +211,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
210
211
|
itemtype?: string | undefined;
|
|
211
212
|
itemid?: string | undefined;
|
|
212
213
|
itemref?: string | undefined;
|
|
213
|
-
results?: (string | number) | undefined;
|
|
214
214
|
security?: string | undefined;
|
|
215
215
|
unselectable?: "on" | "off" | undefined;
|
|
216
216
|
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
@@ -247,16 +247,18 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
247
247
|
form?: string;
|
|
248
248
|
level?: HeadingLevel;
|
|
249
249
|
key?: PropertyKey | undefined;
|
|
250
|
+
prefix?: string | undefined;
|
|
251
|
+
style?: import("vue").StyleValue;
|
|
252
|
+
results?: (string | number) | undefined;
|
|
253
|
+
placeholder?: string | undefined;
|
|
250
254
|
bind?: Record<string, unknown>;
|
|
251
255
|
type?: string | undefined;
|
|
252
256
|
ref?: import("vue").VNodeRef | undefined;
|
|
253
|
-
placeholder?: string | undefined;
|
|
254
257
|
target?: string | undefined;
|
|
255
258
|
class?: import("vue").ClassValue;
|
|
256
259
|
role?: string | undefined;
|
|
257
260
|
'aria-label'?: string | undefined;
|
|
258
261
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
259
|
-
style?: import("vue").StyleValue;
|
|
260
262
|
onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
261
263
|
onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
262
264
|
onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
@@ -422,7 +424,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
422
424
|
about?: string | undefined;
|
|
423
425
|
datatype?: string | undefined;
|
|
424
426
|
inlist?: any;
|
|
425
|
-
prefix?: string | undefined;
|
|
426
427
|
property?: string | undefined;
|
|
427
428
|
resource?: string | undefined;
|
|
428
429
|
typeof?: string | undefined;
|
|
@@ -435,7 +436,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
435
436
|
itemtype?: string | undefined;
|
|
436
437
|
itemid?: string | undefined;
|
|
437
438
|
itemref?: string | undefined;
|
|
438
|
-
results?: (string | number) | undefined;
|
|
439
439
|
security?: string | undefined;
|
|
440
440
|
unselectable?: "on" | "off" | undefined;
|
|
441
441
|
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
@@ -462,7 +462,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
462
462
|
onSave?: (() => any) | undefined;
|
|
463
463
|
}>, {
|
|
464
464
|
level: HeadingLevel;
|
|
465
|
-
saveLabel: string;
|
|
466
465
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
467
466
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
468
467
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { useLocale } from "./useLocale.mjs";
|
|
1
2
|
import { confirmQueue, hasConfirmHost, nextConfirmId } from "../internal/overlays/confirm.mjs";
|
|
2
3
|
export function useAlert() {
|
|
4
|
+
const { t } = useLocale();
|
|
3
5
|
return function alert(input = {}) {
|
|
4
6
|
const options = typeof input === "string" ? { description: input } : input;
|
|
5
7
|
if (typeof window === "undefined") return Promise.resolve();
|
|
@@ -9,7 +11,7 @@ export function useAlert() {
|
|
|
9
11
|
}
|
|
10
12
|
return new Promise((resolve) => {
|
|
11
13
|
confirmQueue.push({
|
|
12
|
-
title: "
|
|
14
|
+
title: t("alert.title"),
|
|
13
15
|
...options,
|
|
14
16
|
kind: "alert",
|
|
15
17
|
id: nextConfirmId(),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { useLocale } from "./useLocale.mjs";
|
|
1
2
|
import { confirmQueue, hasConfirmHost, nextConfirmId } from "../internal/overlays/confirm.mjs";
|
|
2
|
-
async function nativeConfirm(options) {
|
|
3
|
+
async function nativeConfirm(options, fallback) {
|
|
3
4
|
const message = [options.title, options.description].filter(Boolean).join("\n\n");
|
|
4
|
-
if (!window.confirm(message ||
|
|
5
|
+
if (!window.confirm(message || fallback)) return false;
|
|
5
6
|
try {
|
|
6
7
|
await options.onConfirm?.();
|
|
7
8
|
return true;
|
|
@@ -10,10 +11,11 @@ async function nativeConfirm(options) {
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
export function useConfirm() {
|
|
14
|
+
const { t } = useLocale();
|
|
13
15
|
return function confirm(input = {}) {
|
|
14
16
|
const options = typeof input === "string" ? { description: input } : input;
|
|
15
17
|
if (typeof window === "undefined") return Promise.resolve(false);
|
|
16
|
-
if (!hasConfirmHost()) return nativeConfirm(options);
|
|
18
|
+
if (!hasConfirmHost()) return nativeConfirm(options, t("common.areYouSure"));
|
|
17
19
|
return new Promise((resolve) => {
|
|
18
20
|
confirmQueue.push({ ...options, kind: "confirm", id: nextConfirmId(), resolve });
|
|
19
21
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { onBeforeUnmount, onMounted, toValue } from "vue";
|
|
2
2
|
import { useRouterLike } from "../internal/layout/route.mjs";
|
|
3
|
+
import { useLocale } from "./useLocale.mjs";
|
|
3
4
|
import { useConfirm } from "./useConfirm.mjs";
|
|
4
5
|
export function useDirtyGuard(dirty, options = {}) {
|
|
5
6
|
const confirm = useConfirm();
|
|
7
|
+
const { t } = useLocale();
|
|
6
8
|
const router = useRouterLike();
|
|
7
9
|
let bypass = false;
|
|
8
10
|
let removeGuard;
|
|
@@ -14,12 +16,12 @@ export function useDirtyGuard(dirty, options = {}) {
|
|
|
14
16
|
function confirmLeave() {
|
|
15
17
|
if (!isBlocking()) return Promise.resolve(true);
|
|
16
18
|
return confirm({
|
|
17
|
-
title: "Discard unsaved changes?",
|
|
18
|
-
description: "The changes you made on this page will be lost.",
|
|
19
|
-
confirmLabel: "Discard changes",
|
|
20
|
-
cancelLabel: "Keep editing",
|
|
21
19
|
tone: "danger",
|
|
22
|
-
...confirmOptions
|
|
20
|
+
...confirmOptions,
|
|
21
|
+
title: confirmOptions.title ?? t("dirtyGuard.title"),
|
|
22
|
+
description: confirmOptions.description ?? t("dirtyGuard.description"),
|
|
23
|
+
confirmLabel: confirmOptions.confirmLabel ?? t("dirtyGuard.confirm"),
|
|
24
|
+
cancelLabel: confirmOptions.cancelLabel ?? t("dirtyGuard.cancel")
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
27
|
function allowNext() {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ComputedRef, Ref, UnwrapRef } from 'vue';
|
|
2
|
+
import type { StandardSchemaV1 } from '../internal/forms/standard-schema';
|
|
3
|
+
export type { StandardSchemaIssue, StandardSchemaResult, StandardSchemaV1, } from '../internal/forms/standard-schema';
|
|
2
4
|
export type FieldValidationResult = string | undefined | null | boolean;
|
|
3
5
|
export interface FieldDefinition<T = unknown> {
|
|
4
6
|
initial: T | (() => T);
|
|
@@ -9,6 +11,7 @@ export interface FieldDefinition<T = unknown> {
|
|
|
9
11
|
minLength?: number;
|
|
10
12
|
maxLength?: number;
|
|
11
13
|
pattern?: RegExp;
|
|
14
|
+
schema?: StandardSchemaV1;
|
|
12
15
|
validate?: (value: T, values: Record<string, unknown>) => FieldValidationResult | Promise<FieldValidationResult>;
|
|
13
16
|
messages?: Partial<FormMessages>;
|
|
14
17
|
}
|
|
@@ -33,10 +36,10 @@ export interface FormMessages {
|
|
|
33
36
|
pattern: (context: FormMessageContext) => string;
|
|
34
37
|
invalid: (context: FormMessageContext) => string;
|
|
35
38
|
}
|
|
36
|
-
export declare const defaultFormMessages: FormMessages;
|
|
37
39
|
export type FormValidationTrigger = 'submit' | 'blur' | 'input';
|
|
38
40
|
export interface UseFormOptions<S extends FormSchema> {
|
|
39
41
|
schema: S;
|
|
42
|
+
validator?: StandardSchemaV1;
|
|
40
43
|
messages?: Partial<FormMessages>;
|
|
41
44
|
validateOn?: FormValidationTrigger;
|
|
42
45
|
onSubmit?: (values: FormValues<S>) => unknown;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { computed, inject, reactive, ref, watch } from "vue";
|
|
2
|
+
import { issuesByField, runStandardSchema } from "../internal/forms/standard-schema.mjs";
|
|
2
3
|
import { FORM_KEY } from "../internal/keys.mjs";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import { useLocale } from "./useLocale.mjs";
|
|
5
|
+
function localeFormMessages(t) {
|
|
6
|
+
return {
|
|
7
|
+
required: () => t("form.required"),
|
|
8
|
+
min: ({ min }) => t("form.min", { min: min ?? "" }),
|
|
9
|
+
max: ({ max }) => t("form.max", { max: max ?? "" }),
|
|
10
|
+
minLength: ({ minLength = 0, value }) => t(Array.isArray(value) ? "form.minItems" : "form.minLength", { count: minLength }),
|
|
11
|
+
maxLength: ({ maxLength = 0, value }) => t(Array.isArray(value) ? "form.maxItems" : "form.maxLength", { count: maxLength }),
|
|
12
|
+
pattern: () => t("form.pattern"),
|
|
13
|
+
invalid: () => t("form.invalid")
|
|
14
|
+
};
|
|
15
|
+
}
|
|
12
16
|
export function isEmptyValue(value) {
|
|
13
17
|
if (value === null || value === void 0) return true;
|
|
14
18
|
if (typeof value === "string") return value.trim() === "";
|
|
@@ -53,7 +57,8 @@ function measure(value) {
|
|
|
53
57
|
export function useForm(options) {
|
|
54
58
|
const { schema } = options;
|
|
55
59
|
const names = Object.keys(schema);
|
|
56
|
-
const
|
|
60
|
+
const { t } = useLocale();
|
|
61
|
+
const messages = computed(() => ({ ...localeFormMessages(t), ...options.messages }));
|
|
57
62
|
const validateOn = options.validateOn ?? "submit";
|
|
58
63
|
const initialValues = () => Object.fromEntries(names.map((name) => [name, resolveInitial(schema[name])]));
|
|
59
64
|
let baseline = initialValues();
|
|
@@ -72,10 +77,14 @@ export function useForm(options) {
|
|
|
72
77
|
});
|
|
73
78
|
const dirty = computed(() => dirtyFields.value.length > 0);
|
|
74
79
|
const valid = computed(() => names.every((name) => !errors[name]));
|
|
75
|
-
async function
|
|
80
|
+
async function runValidator() {
|
|
81
|
+
if (!options.validator) return {};
|
|
82
|
+
return issuesByField(await runStandardSchema(options.validator, cloneValue(values)));
|
|
83
|
+
}
|
|
84
|
+
async function runRules(name, formIssues) {
|
|
76
85
|
const definition = schema[name];
|
|
77
86
|
const value = readValue(name);
|
|
78
|
-
const fieldMessages = { ...messages, ...definition.messages };
|
|
87
|
+
const fieldMessages = { ...messages.value, ...definition.messages };
|
|
79
88
|
const context = {
|
|
80
89
|
label: definition.label,
|
|
81
90
|
value,
|
|
@@ -110,15 +119,23 @@ export function useForm(options) {
|
|
|
110
119
|
if (typeof result === "string" && result) return result;
|
|
111
120
|
if (result === false) return fieldMessages.invalid(context);
|
|
112
121
|
}
|
|
113
|
-
|
|
122
|
+
if (definition.schema) {
|
|
123
|
+
const issues = await runStandardSchema(definition.schema, value);
|
|
124
|
+
if (issues.length) return issues[0].message || fieldMessages.invalid(context);
|
|
125
|
+
}
|
|
126
|
+
return formIssues[name];
|
|
114
127
|
}
|
|
115
|
-
async function
|
|
116
|
-
const message = await runRules(name);
|
|
128
|
+
async function applyField(name, formIssues) {
|
|
129
|
+
const message = await runRules(name, formIssues);
|
|
117
130
|
errors[name] = message;
|
|
118
131
|
return !message;
|
|
119
132
|
}
|
|
133
|
+
async function validateField(name) {
|
|
134
|
+
return applyField(name, await runValidator());
|
|
135
|
+
}
|
|
120
136
|
async function validate() {
|
|
121
|
-
const
|
|
137
|
+
const formIssues = await runValidator();
|
|
138
|
+
const results = await Promise.all(names.map((name) => applyField(name, formIssues)));
|
|
122
139
|
return results.every(Boolean);
|
|
123
140
|
}
|
|
124
141
|
function setError(name, message) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { App, Component } from 'vue';
|
|
2
2
|
import type { BuiltinIconName } from '../icons/builtin';
|
|
3
|
+
export { hasIconCollection, loadIconCollection, registerIconCollection, setDefaultIconCollection, } from '../icons/collections';
|
|
4
|
+
export type { IconCollectionSource, IconifyCollection, IconifyIcon } from '../icons/collections';
|
|
3
5
|
export type IconSource = Component | string;
|
|
4
6
|
export type IconRegistry = Readonly<Record<string, IconSource>>;
|
|
5
7
|
export type IconName = BuiltinIconName | (string & {});
|
|
@@ -16,6 +18,8 @@ export type ResolvedIcon = {
|
|
|
16
18
|
} | {
|
|
17
19
|
kind: 'svg';
|
|
18
20
|
svg: ParsedSvg;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'pending';
|
|
19
23
|
};
|
|
20
24
|
export declare function isBuiltinIcon(name: string): name is BuiltinIconName;
|
|
21
25
|
export declare function resolveIcon(name: string, registry: IconRegistry | null): ResolvedIcon | null;
|