@m3ui-vue/m3ui-vue 1.6.1 → 1.7.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/dist/API.md +649 -28
- package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
- package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
- package/dist/MColorPickerModal-BKM1CHxr.js +577 -0
- package/dist/MColorPickerModal-BKM1CHxr.js.map +1 -0
- package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
- package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
- package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
- package/dist/MListItem-BU5KDRCB.js.map +1 -0
- package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
- package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
- package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
- package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
- package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
- package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
- package/dist/MSlider-BCeVIxcq.js +739 -0
- package/dist/MSlider-BCeVIxcq.js.map +1 -0
- package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
- package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
- package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
- package/dist/MTextField-NaFbMkjv.js.map +1 -0
- package/dist/MTooltip-CK39Zon4.js +183 -0
- package/dist/MTooltip-CK39Zon4.js.map +1 -0
- package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
- package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +184 -103
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +18 -3
- package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAutocomplete.vue.d.ts +22 -3
- package/dist/components/MCheckbox.vue.d.ts +23 -1
- package/dist/components/MCodeEditor.vue.d.ts +23 -1
- package/dist/components/MColorPicker.vue.d.ts +24 -3
- package/dist/components/MConfirmDialog.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +13 -2
- package/dist/components/MCreditCardInput.vue.d.ts +33 -0
- package/dist/components/MCronField.vue.d.ts +23 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDatePicker.vue.d.ts +24 -3
- package/dist/components/MDateRangePicker.vue.d.ts +24 -3
- package/dist/components/MFileUpload.vue.d.ts +23 -2
- package/dist/components/MForm.vue.d.ts +61 -0
- package/dist/components/MJsonEditor.vue.d.ts +23 -1
- package/dist/components/MMapRoute.vue.d.ts +168 -0
- package/dist/components/MMaskField.vue.d.ts +20 -2
- package/dist/components/MMentionField.vue.d.ts +13 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
- package/dist/components/MMultiSelect.vue.d.ts +22 -3
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +2 -2
- package/dist/components/MNumberField.vue.d.ts +20 -2
- package/dist/components/MPhoneInput.vue.d.ts +19 -4
- package/dist/components/MPinInput.vue.d.ts +24 -3
- package/dist/components/MPosKeypad.vue.d.ts +2 -2
- package/dist/components/MRadioGroup.vue.d.ts +23 -1
- package/dist/components/MRating.vue.d.ts +23 -1
- package/dist/components/MRichTextEditor.vue.d.ts +23 -1
- package/dist/components/MSearchBar.vue.d.ts +1 -1
- package/dist/components/MSegmentedButton.vue.d.ts +23 -2
- package/dist/components/MSelect.vue.d.ts +22 -3
- package/dist/components/MSignaturePad.vue.d.ts +19 -0
- package/dist/components/MSlider.vue.d.ts +23 -1
- package/dist/components/MSwitch.vue.d.ts +23 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +20 -2
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +26 -3
- package/dist/components/MTimePicker.vue.d.ts +24 -3
- package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
- package/dist/components/MTour.vue.d.ts +2 -2
- package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
- package/dist/components/MWindow.vue.d.ts +2 -2
- package/dist/composables/_routeGeometry.d.ts +26 -0
- package/dist/composables/_useFieldValidation.d.ts +91 -0
- package/dist/composables/mapRouting.d.ts +35 -0
- package/dist/composables/useLocale.d.ts +23 -0
- package/dist/composables/validation.d.ts +82 -0
- package/dist/draw.js +27 -26
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/locales/index.js +154 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7350 -6183
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.js +1319 -867
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +189 -146
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MForm.test.ts +325 -0
- package/src/__tests__/MMapRoute.test.ts +384 -0
- package/src/__tests__/MPhoneInput.test.ts +5 -2
- package/src/__tests__/MRichTextEditor.test.ts +2 -1
- package/src/__tests__/MTrackingTimeline.test.ts +66 -0
- package/src/__tests__/_fakeMaplibre.ts +4 -1
- package/src/__tests__/_osrmRoutes.ts +10 -0
- package/src/__tests__/attrsFallthrough.test.ts +11 -0
- package/src/__tests__/fieldsValidation.test.ts +229 -0
- package/src/__tests__/ssr.test.ts +1 -0
- package/src/__tests__/validation.test.ts +77 -0
- package/src/components/MAddressField.vue +45 -8
- package/src/components/MAudioRecorder.vue +9 -9
- package/src/components/MAutocomplete.vue +69 -23
- package/src/components/MCheckbox.vue +80 -17
- package/src/components/MCodeEditor.vue +59 -2
- package/src/components/MColorPicker.vue +65 -16
- package/src/components/MCountrySelect.vue +17 -3
- package/src/components/MCreditCardInput.vue +76 -7
- package/src/components/MCronField.vue +60 -10
- package/src/components/MDatePicker.vue +65 -16
- package/src/components/MDateRangePicker.vue +66 -16
- package/src/components/MFileUpload.vue +71 -8
- package/src/components/MForm.vue +208 -0
- package/src/components/MJsonEditor.vue +57 -3
- package/src/components/MMapBaseLayers.vue +29 -28
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMapRoute.vue +470 -0
- package/src/components/MMaskField.vue +55 -13
- package/src/components/MMentionField.vue +17 -2
- package/src/components/MMultiAutocomplete.vue +70 -23
- package/src/components/MMultiSelect.vue +70 -23
- package/src/components/MNumberField.vue +58 -16
- package/src/components/MPhoneInput.vue +60 -18
- package/src/components/MPinInput.vue +58 -10
- package/src/components/MRadioGroup.vue +65 -4
- package/src/components/MRating.vue +62 -6
- package/src/components/MRichTextEditor.vue +64 -4
- package/src/components/MSegmentedButton.vue +59 -2
- package/src/components/MSelect.vue +72 -26
- package/src/components/MSignaturePad.vue +71 -6
- package/src/components/MSlider.vue +61 -10
- package/src/components/MSwitch.vue +63 -8
- package/src/components/MTagInput.vue +67 -25
- package/src/components/MTextField.vue +68 -14
- package/src/components/MTimePicker.vue +65 -16
- package/src/components/MTimezoneSelect.vue +17 -3
- package/src/components/MTrackingTimeline.vue +257 -0
- package/src/composables/_routeGeometry.ts +140 -0
- package/src/composables/_useFieldValidation.ts +287 -0
- package/src/composables/mapRouting.ts +55 -0
- package/src/composables/useLocale.ts +46 -0
- package/src/composables/validation.ts +178 -0
- package/src/index.ts +5 -0
- package/src/locales/de.ts +21 -0
- package/src/locales/es.ts +28 -7
- package/src/locales/fr.ts +21 -0
- package/src/locales/ja.ts +21 -0
- package/src/locales/ko.ts +21 -0
- package/src/locales/pt.ts +21 -0
- package/src/locales/zh.ts +21 -0
- package/src/map.ts +4 -0
- package/dist/MListItem-D2cNUyzP.js.map +0 -1
- package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
- package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
- package/dist/MSlider-BIkA6DiE.js +0 -690
- package/dist/MSlider-BIkA6DiE.js.map +0 -1
- package/dist/MTextField-CNH-byir.js.map +0 -1
- package/dist/MTooltip-Dd5g2zhh.js +0 -754
- package/dist/MTooltip-Dd5g2zhh.js.map +0 -1
- package/dist/useLocale-DaVSTdm0.js.map +0 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { computed, inject, nextTick, onBeforeUnmount, onMounted, ref, useId, watch, type InjectionKey } from 'vue'
|
|
2
|
+
import { useLocale } from './useLocale'
|
|
3
|
+
import { REQUIRED_RULE, isEmpty, runRules, type ValidateOn, type ValidationRule } from './validation'
|
|
4
|
+
|
|
5
|
+
/** @internal What a field registers with its `MForm` */
|
|
6
|
+
export interface FormField {
|
|
7
|
+
name: () => string | undefined
|
|
8
|
+
value: () => unknown
|
|
9
|
+
/** Checks the rules, shows the result, resolves to whether its own rules pass */
|
|
10
|
+
validate: () => Promise<boolean>
|
|
11
|
+
resetValidation: () => void
|
|
12
|
+
reset: () => Promise<void>
|
|
13
|
+
focus: () => void
|
|
14
|
+
el: () => Element | null | undefined
|
|
15
|
+
/** The message on display, if any */
|
|
16
|
+
error: () => string | null
|
|
17
|
+
/** Whether its rules pass right now (checked silently, whether or not it's shown yet) */
|
|
18
|
+
valid: () => boolean
|
|
19
|
+
pending: () => boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @internal Provided by `MForm` */
|
|
23
|
+
export interface FormContext {
|
|
24
|
+
register: (field: FormField) => () => void
|
|
25
|
+
/** Every named field's value, by name */
|
|
26
|
+
values: () => Record<string, unknown>
|
|
27
|
+
/** An error given from outside (`MForm`'s `errors` prop) */
|
|
28
|
+
externalError: (name: string) => string | null
|
|
29
|
+
hasSchema: () => boolean
|
|
30
|
+
/** The form schema's first issue for this field */
|
|
31
|
+
schemaError: (name: string) => Promise<string | null>
|
|
32
|
+
validateOn: () => ValidateOn | undefined
|
|
33
|
+
/** Default debounce (ms) for re-checks while the value changes */
|
|
34
|
+
validateDebounce: () => number | undefined
|
|
35
|
+
/** The `errors` object itself: a new one (a new server response) shows its errors again */
|
|
36
|
+
externalErrorsKey: () => unknown
|
|
37
|
+
/** Keep an outside error after its field changes, instead of hiding it */
|
|
38
|
+
keepErrors: () => boolean
|
|
39
|
+
disabled: () => boolean
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const FORM_KEY: InjectionKey<FormContext> = Symbol('m3-form')
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @internal "Blur" for a field made of several focusable parts (stepper buttons, chips, a popup panel): calls
|
|
47
|
+
* `onLeave` once focus has left `root` for good, not while it moves between its parts or while `open` (its
|
|
48
|
+
* teleported panel, which sits outside `root` in the DOM) is showing. Closing the panel with focus outside
|
|
49
|
+
* counts as leaving. Bind the returned handler to the root's `@focusout`.
|
|
50
|
+
*/
|
|
51
|
+
export function useFocusLeave(root: () => Element | null | undefined, onLeave: () => void, open?: () => boolean) {
|
|
52
|
+
function check() {
|
|
53
|
+
if (open?.()) return
|
|
54
|
+
const r = root()
|
|
55
|
+
const active = document.activeElement
|
|
56
|
+
if (r && active && r.contains(active)) return
|
|
57
|
+
onLeave()
|
|
58
|
+
}
|
|
59
|
+
if (open) watch(open, (now, was) => { if (!now && was) setTimeout(check) })
|
|
60
|
+
// Focus lands on its next element after focusout: look once it has
|
|
61
|
+
return () => { setTimeout(check) }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface FieldValidationOptions {
|
|
65
|
+
value: () => unknown
|
|
66
|
+
rules: () => ValidationRule | ValidationRule[] | undefined
|
|
67
|
+
required: () => boolean | undefined
|
|
68
|
+
error: () => boolean | string | undefined
|
|
69
|
+
errorLabel: () => string | undefined
|
|
70
|
+
name: () => string | undefined
|
|
71
|
+
validateOn: () => ValidateOn | undefined
|
|
72
|
+
/** Wait this long (ms) after the value stops changing before re-checking (async rules: one request, not one per key) */
|
|
73
|
+
validateDebounce?: () => number | undefined
|
|
74
|
+
disabled: () => boolean | undefined
|
|
75
|
+
focus: () => void
|
|
76
|
+
el: () => Element | null | undefined
|
|
77
|
+
/** Writes a value back through v-model (used by `MForm`'s `reset()`) */
|
|
78
|
+
setValue?: (value: unknown) => void
|
|
79
|
+
/** What "not filled in" means for `required`, when `isEmpty` isn't it (a date range needs both ends) */
|
|
80
|
+
isEmpty?: (value: unknown) => boolean
|
|
81
|
+
/** Called when the field is validated on demand (`validate()`, an `MForm` submit), to reveal sub-parts' own errors */
|
|
82
|
+
onValidate?: () => void
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @internal The validation every form field shares: its own `rules` (plus `required` inside an `MForm` or
|
|
87
|
+
* next to other rules), errors from outside (the `error` prop, `MForm`'s `errors`, its `schema`), when to show
|
|
88
|
+
* them (`validateOn`), and registration with the surrounding `MForm`.
|
|
89
|
+
*
|
|
90
|
+
* Priority of what's shown: a string `error` → `error: true` with `errorLabel` → `MForm`'s `errors[name]`
|
|
91
|
+
* → the field's own rules.
|
|
92
|
+
*/
|
|
93
|
+
export function useFieldValidation(opts: FieldValidationOptions) {
|
|
94
|
+
const form = inject(FORM_KEY, null)
|
|
95
|
+
const locale = useLocale()
|
|
96
|
+
const messageId = useId()
|
|
97
|
+
|
|
98
|
+
const disabled = computed(() => !!opts.disabled() || !!form?.disabled())
|
|
99
|
+
|
|
100
|
+
const ruleList = computed<ValidationRule[]>(() => {
|
|
101
|
+
const r = opts.rules()
|
|
102
|
+
const list = r ? (Array.isArray(r) ? r : [r]) : []
|
|
103
|
+
// `required` only validates where validation is in use, so a plain field keeps today's behavior
|
|
104
|
+
// (just the asterisk and the native attribute)
|
|
105
|
+
const empty = opts.isEmpty ?? isEmpty
|
|
106
|
+
// A `required()` in the rules: use the field's own "empty" with its message, instead of a second check
|
|
107
|
+
const own = list.map((r) => {
|
|
108
|
+
const mark = (r as any)?.[REQUIRED_RULE]
|
|
109
|
+
if (mark === undefined || !opts.isEmpty) return r
|
|
110
|
+
const fieldRequired: ValidationRule = (value, { locale }) => !empty(value) || (typeof mark === 'string' ? mark : locale.validationRequired)
|
|
111
|
+
;(fieldRequired as any)[REQUIRED_RULE] = mark
|
|
112
|
+
return fieldRequired
|
|
113
|
+
})
|
|
114
|
+
if (!(opts.required() && (form || own.length))) return own
|
|
115
|
+
if (own.some((r) => (r as any)?.[REQUIRED_RULE] !== undefined)) return own
|
|
116
|
+
const required: ValidationRule = (value, { locale }) => !empty(value) || locale.validationRequired
|
|
117
|
+
return [required, ...own]
|
|
118
|
+
})
|
|
119
|
+
const active = computed(() => ruleList.value.length > 0 || (!!form && !!opts.name() && form.hasSchema()))
|
|
120
|
+
|
|
121
|
+
/** The rules' verdict, kept up to date silently; only displayed once `shown` */
|
|
122
|
+
const result = ref<string | null>(null)
|
|
123
|
+
const shown = ref(false)
|
|
124
|
+
const pending = ref(false)
|
|
125
|
+
/** Names of other fields the rules read through `ctx.values` (e.g. `sameAs('password')`) */
|
|
126
|
+
const deps = ref<string[]>([])
|
|
127
|
+
let token = 0
|
|
128
|
+
|
|
129
|
+
async function run(): Promise<string | null> {
|
|
130
|
+
const t = ++token
|
|
131
|
+
if (disabled.value || !active.value) {
|
|
132
|
+
result.value = null
|
|
133
|
+
pending.value = false
|
|
134
|
+
return null
|
|
135
|
+
}
|
|
136
|
+
pending.value = true
|
|
137
|
+
const read = new Set<string>()
|
|
138
|
+
const all = form?.values() ?? {}
|
|
139
|
+
const values = new Proxy(all, {
|
|
140
|
+
get(target, key) {
|
|
141
|
+
if (typeof key === 'string') read.add(key)
|
|
142
|
+
return Reflect.get(target, key)
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
let message: string | null = null
|
|
146
|
+
try {
|
|
147
|
+
message = await runRules(ruleList.value, opts.value(), { locale, values })
|
|
148
|
+
const name = opts.name()
|
|
149
|
+
if (!message && form && name && form.hasSchema()) message = await form.schemaError(name)
|
|
150
|
+
} catch (e) {
|
|
151
|
+
console.error('[m3ui] a validation rule threw:', e)
|
|
152
|
+
}
|
|
153
|
+
if (t === token) {
|
|
154
|
+
result.value = message
|
|
155
|
+
pending.value = false
|
|
156
|
+
const next = [...read]
|
|
157
|
+
// Only a real change: a new array every run would re-trigger the deps watcher below, forever
|
|
158
|
+
if (next.length !== deps.value.length || next.some((k, i) => k !== deps.value[i])) deps.value = next
|
|
159
|
+
}
|
|
160
|
+
return message
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const mode = () => opts.validateOn() ?? form?.validateOn() ?? 'blur'
|
|
164
|
+
let resetting = false
|
|
165
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
166
|
+
const debounceMs = () => opts.validateDebounce?.() ?? form?.validateDebounce() ?? 0
|
|
167
|
+
/** Re-checks now, or after the debounce while the value keeps changing (pending meanwhile) */
|
|
168
|
+
function schedule() {
|
|
169
|
+
clearTimeout(timer)
|
|
170
|
+
const ms = debounceMs()
|
|
171
|
+
if (ms <= 0 || !active.value || disabled.value) return run()
|
|
172
|
+
pending.value = true
|
|
173
|
+
token++ // a check already running is stale now
|
|
174
|
+
timer = setTimeout(run, ms)
|
|
175
|
+
}
|
|
176
|
+
onBeforeUnmount(() => clearTimeout(timer))
|
|
177
|
+
|
|
178
|
+
/** An outside error (MForm `errors`) hides once its field changes, until a new `errors` object comes */
|
|
179
|
+
const dismissed = ref(false)
|
|
180
|
+
if (form) watch(() => form.externalErrorsKey(), () => (dismissed.value = false))
|
|
181
|
+
|
|
182
|
+
watch(opts.value, () => {
|
|
183
|
+
if (mode() === 'input' && !resetting) shown.value = true
|
|
184
|
+
if (form && !form.keepErrors() && !resetting) dismissed.value = true
|
|
185
|
+
schedule()
|
|
186
|
+
}, { deep: true })
|
|
187
|
+
// Not the rules array itself: an inline `:rules="[...]"` is a new array on every render of the parent, and
|
|
188
|
+
// re-checking then would re-run every field's (async) rules on any keystroke anywhere. Its length changes when
|
|
189
|
+
// rules are really swapped (`:rules="company ? [required()] : []"`); `required` and `disabled` are watched too
|
|
190
|
+
watch([() => ruleList.value.length, () => !!opts.required(), disabled], () => run())
|
|
191
|
+
// Cross-field rules: re-check when a field they read changes, but only once this one is on display
|
|
192
|
+
// (compared value by value: the getter returns a new array whenever any field of the form changes)
|
|
193
|
+
watch(
|
|
194
|
+
() => (form ? deps.value.map((k) => form.values()[k]) : []),
|
|
195
|
+
(now, before) => {
|
|
196
|
+
const changed = now.length !== before.length || now.some((v, i) => !Object.is(v, before[i]))
|
|
197
|
+
if (changed && shown.value) run()
|
|
198
|
+
},
|
|
199
|
+
)
|
|
200
|
+
onMounted(run)
|
|
201
|
+
|
|
202
|
+
function onBlur() {
|
|
203
|
+
if (mode() !== 'submit') shown.value = true
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async function validate(): Promise<boolean> {
|
|
207
|
+
clearTimeout(timer)
|
|
208
|
+
shown.value = true
|
|
209
|
+
opts.onValidate?.()
|
|
210
|
+
return !(await run())
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function resetValidation() {
|
|
214
|
+
clearTimeout(timer)
|
|
215
|
+
token++
|
|
216
|
+
shown.value = false
|
|
217
|
+
pending.value = false
|
|
218
|
+
run()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const initial = (() => {
|
|
222
|
+
const v = opts.value()
|
|
223
|
+
return Array.isArray(v) ? [...v] : v
|
|
224
|
+
})()
|
|
225
|
+
|
|
226
|
+
async function reset() {
|
|
227
|
+
if (opts.setValue) {
|
|
228
|
+
resetting = true
|
|
229
|
+
opts.setValue(Array.isArray(initial) ? [...initial] : initial)
|
|
230
|
+
await nextTick()
|
|
231
|
+
resetting = false
|
|
232
|
+
}
|
|
233
|
+
resetValidation()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const external = computed(() => {
|
|
237
|
+
const name = opts.name()
|
|
238
|
+
return form && name && !dismissed.value ? form.externalError(name) : null
|
|
239
|
+
})
|
|
240
|
+
const own = computed(() => (shown.value ? result.value : null))
|
|
241
|
+
|
|
242
|
+
/** The message to show under the field (null = none) */
|
|
243
|
+
const message = computed<string | null>(() => {
|
|
244
|
+
const e = opts.error()
|
|
245
|
+
if (typeof e === 'string' && e) return e
|
|
246
|
+
if (e === true) return opts.errorLabel() || own.value || external.value
|
|
247
|
+
return external.value || own.value
|
|
248
|
+
})
|
|
249
|
+
const hasError = computed(() => !!opts.error() || !!external.value || !!own.value)
|
|
250
|
+
|
|
251
|
+
if (form) {
|
|
252
|
+
let unregister: (() => void) | undefined
|
|
253
|
+
onMounted(() => {
|
|
254
|
+
unregister = form.register({
|
|
255
|
+
name: opts.name,
|
|
256
|
+
value: opts.value,
|
|
257
|
+
validate,
|
|
258
|
+
resetValidation,
|
|
259
|
+
reset,
|
|
260
|
+
focus: opts.focus,
|
|
261
|
+
el: opts.el,
|
|
262
|
+
error: () => (hasError.value ? message.value ?? '' : null),
|
|
263
|
+
valid: () => !result.value && !pending.value,
|
|
264
|
+
pending: () => pending.value,
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
onBeforeUnmount(() => unregister?.())
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return {
|
|
271
|
+
/** Error state (red border/label) */
|
|
272
|
+
hasError,
|
|
273
|
+
/** Message under the field, or null */
|
|
274
|
+
message,
|
|
275
|
+
/** id for the message element, to point `aria-describedby` at */
|
|
276
|
+
messageId,
|
|
277
|
+
/** Whether async rules are still running */
|
|
278
|
+
pending,
|
|
279
|
+
/** The field's own disabled state merged with its `MForm`'s */
|
|
280
|
+
disabled,
|
|
281
|
+
/** Call from the field's blur */
|
|
282
|
+
onBlur,
|
|
283
|
+
validate,
|
|
284
|
+
resetValidation,
|
|
285
|
+
reset,
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { LngLat } from './_mapGeometry'
|
|
2
|
+
|
|
3
|
+
/** A route between waypoints, as a routing service returns it. */
|
|
4
|
+
export interface MapRouteResult {
|
|
5
|
+
/** The road to follow, `[lng, lat][]`: the streets' real shape (curves, roundabouts), one-way streets respected */
|
|
6
|
+
path: LngLat[]
|
|
7
|
+
/** Length in meters */
|
|
8
|
+
distance: number
|
|
9
|
+
/** Expected travel time in seconds */
|
|
10
|
+
duration: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Where `MMapRoute` gets its road from when you give it `stops` but no `path`: any function from waypoints to a route.
|
|
15
|
+
* `osrmRouteProvider()` ships; GraphHopper, Valhalla, OpenRouteService, Mapbox Directions or your own backend fit
|
|
16
|
+
* the same shape. Gets an `AbortSignal`: a newer request cancels the older one.
|
|
17
|
+
*/
|
|
18
|
+
export type MapRouteProvider = (waypoints: LngLat[], options: { signal?: AbortSignal }) => Promise<MapRouteResult>
|
|
19
|
+
|
|
20
|
+
export interface OsrmRouteOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The OSRM server. Defaults to the project's public demo server, which is meant for light use only (see its usage
|
|
23
|
+
* policy): run your own (`osrm-backend` in Docker) or use a hosted one in production
|
|
24
|
+
*/
|
|
25
|
+
url?: string
|
|
26
|
+
/** The routing profile in the URL: `driving` (the demo server has only this one), `cycling`, `walking`, or your server's own */
|
|
27
|
+
profile?: string
|
|
28
|
+
/** More query parameters for OSRM (`exclude=toll`, `alternatives`…) */
|
|
29
|
+
params?: Record<string, string>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Routes through an OSRM server (Open Source Routing Machine, on OpenStreetMap data): the path follows the streets
|
|
34
|
+
* as they are, and the car profile respects one-way streets and turn restrictions. Available from the `/map` entry
|
|
35
|
+
* point.
|
|
36
|
+
*/
|
|
37
|
+
export function osrmRouteProvider(options: OsrmRouteOptions = {}): MapRouteProvider {
|
|
38
|
+
const url = (options.url ?? 'https://router.project-osrm.org').replace(/\/$/, '')
|
|
39
|
+
const profile = options.profile ?? 'driving'
|
|
40
|
+
return async (waypoints, { signal }) => {
|
|
41
|
+
if (waypoints.length < 2) return { path: [...waypoints], distance: 0, duration: 0 }
|
|
42
|
+
const coords = waypoints.map(([lng, lat]) => `${lng},${lat}`).join(';')
|
|
43
|
+
const query = new URLSearchParams({ overview: 'full', geometries: 'geojson', ...options.params })
|
|
44
|
+
const res = await fetch(`${url}/route/v1/${profile}/${coords}?${query}`, { signal })
|
|
45
|
+
if (!res.ok) throw new Error(`OSRM ${res.status}`)
|
|
46
|
+
const data = (await res.json()) as {
|
|
47
|
+
code: string
|
|
48
|
+
message?: string
|
|
49
|
+
routes?: { geometry: { coordinates: LngLat[] }; distance: number; duration: number }[]
|
|
50
|
+
}
|
|
51
|
+
const route = data.routes?.[0]
|
|
52
|
+
if (data.code !== 'Ok' || !route) throw new Error(`OSRM: ${data.message ?? data.code}`)
|
|
53
|
+
return { path: route.geometry.coordinates, distance: route.distance, duration: route.duration }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -263,6 +263,18 @@ export interface M3Locale {
|
|
|
263
263
|
mapPressEnterToSearch: string
|
|
264
264
|
mapSearching: string
|
|
265
265
|
mapNoPlaces: string
|
|
266
|
+
/** MMapRoute: a stop's name when it has no label (followed by its number) */
|
|
267
|
+
mapRouteStop: string
|
|
268
|
+
/** MMapRoute: the vehicle marker's accessible name */
|
|
269
|
+
mapRouteVehicle: string
|
|
270
|
+
// MTrackingTimeline ({time} is a clock time)
|
|
271
|
+
trackingArrives: string
|
|
272
|
+
trackingArrivingNow: string
|
|
273
|
+
trackingDelivered: string
|
|
274
|
+
trackingDelayed: string
|
|
275
|
+
trackingCanceled: string
|
|
276
|
+
trackingShowDetails: string
|
|
277
|
+
trackingHideDetails: string
|
|
266
278
|
filterMatchAll: string
|
|
267
279
|
filterMatchAny: string
|
|
268
280
|
filterAddCondition: string
|
|
@@ -594,6 +606,19 @@ export interface M3Locale {
|
|
|
594
606
|
cardInvalidNumber: string
|
|
595
607
|
cardInvalidExpiry: string
|
|
596
608
|
cardInvalidCvc: string
|
|
609
|
+
// Form validation (MForm, field `rules`)
|
|
610
|
+
validationRequired: string
|
|
611
|
+
validationInvalid: string
|
|
612
|
+
validationEmail: string
|
|
613
|
+
validationUrl: string
|
|
614
|
+
validationMinLength: string
|
|
615
|
+
validationMaxLength: string
|
|
616
|
+
validationMinItems: string
|
|
617
|
+
validationMaxItems: string
|
|
618
|
+
validationMin: string
|
|
619
|
+
validationMax: string
|
|
620
|
+
validationPattern: string
|
|
621
|
+
validationSameAs: string
|
|
597
622
|
// MPosKeypad
|
|
598
623
|
keypadDelete: string
|
|
599
624
|
keypadClear: string
|
|
@@ -962,6 +987,15 @@ export const defaultLocale: M3Locale = {
|
|
|
962
987
|
mapPressEnterToSearch: 'Press Enter to search',
|
|
963
988
|
mapSearching: 'Searching…',
|
|
964
989
|
mapNoPlaces: 'No places found',
|
|
990
|
+
mapRouteStop: 'Stop',
|
|
991
|
+
mapRouteVehicle: 'Vehicle',
|
|
992
|
+
trackingArrives: 'Arrives {time}',
|
|
993
|
+
trackingArrivingNow: 'Arriving now',
|
|
994
|
+
trackingDelivered: 'Delivered',
|
|
995
|
+
trackingDelayed: 'Delayed',
|
|
996
|
+
trackingCanceled: 'Canceled',
|
|
997
|
+
trackingShowDetails: 'Show details',
|
|
998
|
+
trackingHideDetails: 'Hide details',
|
|
965
999
|
filterMatchAll: 'All',
|
|
966
1000
|
filterMatchAny: 'Any',
|
|
967
1001
|
filterAddCondition: 'Add condition',
|
|
@@ -1287,6 +1321,18 @@ export const defaultLocale: M3Locale = {
|
|
|
1287
1321
|
cardInvalidNumber: 'Invalid card number',
|
|
1288
1322
|
cardInvalidExpiry: 'Invalid or expired date',
|
|
1289
1323
|
cardInvalidCvc: 'Invalid security code',
|
|
1324
|
+
validationRequired: 'This field is required',
|
|
1325
|
+
validationInvalid: 'Invalid value',
|
|
1326
|
+
validationEmail: 'Enter a valid email address',
|
|
1327
|
+
validationUrl: 'Enter a valid URL',
|
|
1328
|
+
validationMinLength: 'Enter at least {min} characters',
|
|
1329
|
+
validationMaxLength: 'Enter at most {max} characters',
|
|
1330
|
+
validationMinItems: 'Choose at least {min}',
|
|
1331
|
+
validationMaxItems: 'Choose at most {max}',
|
|
1332
|
+
validationMin: 'Must be at least {min}',
|
|
1333
|
+
validationMax: 'Must be at most {max}',
|
|
1334
|
+
validationPattern: 'Invalid format',
|
|
1335
|
+
validationSameAs: 'Values don\'t match',
|
|
1290
1336
|
keypadDelete: 'Delete',
|
|
1291
1337
|
keypadClear: 'Clear',
|
|
1292
1338
|
keypadChange: 'Change',
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { M3Locale } from './useLocale'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The Standard Schema interface (https://standardschema.dev), implemented by zod (3.24+), valibot (1.0+),
|
|
5
|
+
* arktype, yup (1.7+) and others. A copy of the spec's types, so the lib doesn't depend on any of them:
|
|
6
|
+
* pass a schema straight to a field's `rules` or to `MForm`'s `schema`.
|
|
7
|
+
*/
|
|
8
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
9
|
+
readonly '~standard': {
|
|
10
|
+
readonly version: 1
|
|
11
|
+
readonly vendor: string
|
|
12
|
+
readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>
|
|
13
|
+
readonly types?: { readonly input: Input; readonly output: Output }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface StandardSchemaIssue {
|
|
18
|
+
readonly message: string
|
|
19
|
+
readonly path?: ReadonlyArray<PropertyKey | { readonly key: PropertyKey }>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type StandardSchemaResult<Output> =
|
|
23
|
+
| { readonly value: Output; readonly issues?: undefined }
|
|
24
|
+
| { readonly issues: ReadonlyArray<StandardSchemaIssue> }
|
|
25
|
+
|
|
26
|
+
/** What a rule receives besides the value */
|
|
27
|
+
export interface ValidationContext {
|
|
28
|
+
/** The active locale, for messages */
|
|
29
|
+
locale: M3Locale
|
|
30
|
+
/** The values of every named field of the surrounding `MForm` (empty outside one) */
|
|
31
|
+
values: Record<string, unknown>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* `true`, `undefined` or `null` = valid; a string = invalid with that message; `false` = invalid with the
|
|
36
|
+
* locale's generic `validationInvalid` message
|
|
37
|
+
*/
|
|
38
|
+
export type ValidationResult = boolean | string | null | undefined
|
|
39
|
+
|
|
40
|
+
/** A function `(value, ctx) => true | 'message'` (may be async), or a Standard Schema (zod, valibot…) */
|
|
41
|
+
export type ValidationRule<T = any> =
|
|
42
|
+
| ((value: T, ctx: ValidationContext) => ValidationResult | Promise<ValidationResult>)
|
|
43
|
+
| StandardSchemaV1
|
|
44
|
+
|
|
45
|
+
/** When a field checks its rules and shows the result */
|
|
46
|
+
export type ValidateOn = 'blur' | 'input' | 'submit'
|
|
47
|
+
|
|
48
|
+
export function isStandardSchema(rule: unknown): rule is StandardSchemaV1 {
|
|
49
|
+
return typeof rule === 'object' && rule !== null && '~standard' in rule
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The key of a Standard Schema issue path segment */
|
|
53
|
+
export function issueKey(segment: PropertyKey | { readonly key: PropertyKey }): PropertyKey {
|
|
54
|
+
return typeof segment === 'object' && segment !== null ? segment.key : segment
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Runs one rule: the error message, or null when it passes */
|
|
58
|
+
export async function runRule(rule: ValidationRule, value: unknown, ctx: ValidationContext): Promise<string | null> {
|
|
59
|
+
if (isStandardSchema(rule)) {
|
|
60
|
+
const result = await rule['~standard'].validate(value)
|
|
61
|
+
const issue = result.issues?.[0]
|
|
62
|
+
return issue ? issue.message || ctx.locale.validationInvalid : null
|
|
63
|
+
}
|
|
64
|
+
const result = await rule(value, ctx)
|
|
65
|
+
if (result === true || result === undefined || result === null) return null
|
|
66
|
+
if (result === false) return ctx.locale.validationInvalid
|
|
67
|
+
return result || ctx.locale.validationInvalid
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Runs rules in order and stops at the first that fails */
|
|
71
|
+
export async function runRules(rules: ValidationRule[], value: unknown, ctx: ValidationContext): Promise<string | null> {
|
|
72
|
+
for (const rule of rules) {
|
|
73
|
+
const message = await runRule(rule, value, ctx)
|
|
74
|
+
if (message) return message
|
|
75
|
+
}
|
|
76
|
+
return null
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Whether a value counts as "not filled in": null/undefined, blank string, empty array, `false` (an unticked checkbox) */
|
|
80
|
+
export function isEmpty(value: unknown): boolean {
|
|
81
|
+
if (value === null || value === undefined || value === false) return true
|
|
82
|
+
if (typeof value === 'string') return value.trim() === ''
|
|
83
|
+
if (Array.isArray(value)) return value.length === 0
|
|
84
|
+
if (value instanceof Set || value instanceof Map) return value.size === 0
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function lengthOf(value: unknown): number {
|
|
89
|
+
if (typeof value === 'string' || Array.isArray(value)) return value.length
|
|
90
|
+
if (value instanceof Set || value instanceof Map) return value.size
|
|
91
|
+
return String(value).length
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function toNumber(value: unknown): number {
|
|
95
|
+
return typeof value === 'number' ? value : Number(String(value).trim())
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Built-in rules. Every one but `required` passes on an empty value, so an optional field stays optional:
|
|
99
|
+
// `[email()]` accepts '' and `[required(), email()]` doesn't.
|
|
100
|
+
|
|
101
|
+
/** Marks the rules `required()` makes, so a field's `required` prop doesn't add a second one in front */
|
|
102
|
+
export const REQUIRED_RULE = Symbol('m3-required-rule')
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The value must be filled in (see `isEmpty`; a field may define its own "empty", e.g. a date range needs both
|
|
106
|
+
* ends). Given in `rules`, it replaces the check the field's `required` prop adds, so its message is the one shown
|
|
107
|
+
*/
|
|
108
|
+
export function required(message?: string): ValidationRule {
|
|
109
|
+
const rule: ValidationRule = (value, { locale }) => !isEmpty(value) || message || locale.validationRequired
|
|
110
|
+
// Its message (or true): a field with its own "empty" test rebuilds the check with it
|
|
111
|
+
;(rule as any)[REQUIRED_RULE] = message ?? true
|
|
112
|
+
return rule
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Same pattern as the browser's own <input type="email"> check (WHATWG), which is what users expect
|
|
116
|
+
const EMAIL_RE = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/
|
|
117
|
+
|
|
118
|
+
/** An email address (the browser's own rule, plus a dot in the domain) */
|
|
119
|
+
export function email(message?: string): ValidationRule {
|
|
120
|
+
return (value, { locale }) => isEmpty(value) || EMAIL_RE.test(String(value).trim()) || message || locale.validationEmail
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** An absolute http(s) URL */
|
|
124
|
+
export function url(message?: string): ValidationRule {
|
|
125
|
+
return (value, { locale }) => {
|
|
126
|
+
if (isEmpty(value)) return true
|
|
127
|
+
try {
|
|
128
|
+
const u = new URL(String(value).trim())
|
|
129
|
+
if (u.protocol === 'http:' || u.protocol === 'https:') return true
|
|
130
|
+
} catch { /* invalid */ }
|
|
131
|
+
return message || locale.validationUrl
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** At least `min` characters (strings) or items (arrays) */
|
|
136
|
+
export function minLength(min: number, message?: string): ValidationRule {
|
|
137
|
+
return (value, { locale }) =>
|
|
138
|
+
isEmpty(value) || lengthOf(value) >= min ||
|
|
139
|
+
message || (Array.isArray(value) ? locale.validationMinItems : locale.validationMinLength).replace('{min}', String(min))
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** At most `max` characters (strings) or items (arrays) */
|
|
143
|
+
export function maxLength(max: number, message?: string): ValidationRule {
|
|
144
|
+
return (value, { locale }) =>
|
|
145
|
+
isEmpty(value) || lengthOf(value) <= max ||
|
|
146
|
+
message || (Array.isArray(value) ? locale.validationMaxItems : locale.validationMaxLength).replace('{max}', String(max))
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** A number (or numeric string) of at least `min` */
|
|
150
|
+
export function min(min: number, message?: string): ValidationRule {
|
|
151
|
+
return (value, { locale }) => isEmpty(value) || toNumber(value) >= min || message || locale.validationMin.replace('{min}', String(min))
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** A number (or numeric string) of at most `max` */
|
|
155
|
+
export function max(max: number, message?: string): ValidationRule {
|
|
156
|
+
return (value, { locale }) => isEmpty(value) || toNumber(value) <= max || message || locale.validationMax.replace('{max}', String(max))
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Matches a regular expression */
|
|
160
|
+
export function pattern(re: RegExp, message?: string): ValidationRule {
|
|
161
|
+
return (value, { locale }) => {
|
|
162
|
+
if (isEmpty(value)) return true
|
|
163
|
+
re.lastIndex = 0 // a /g or /y regex keeps state between test() calls
|
|
164
|
+
return re.test(String(value)) || message || locale.validationPattern
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Equals another value: the name of a field in the same `MForm` (e.g. 'password' for a confirmation field),
|
|
170
|
+
* or a getter
|
|
171
|
+
*/
|
|
172
|
+
export function sameAs(other: string | (() => unknown), message?: string): ValidationRule {
|
|
173
|
+
return (value, { locale, values }) => {
|
|
174
|
+
if (isEmpty(value)) return true
|
|
175
|
+
const target = typeof other === 'function' ? other() : values[other]
|
|
176
|
+
return value === target || message || locale.validationSameAs
|
|
177
|
+
}
|
|
178
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -40,6 +40,8 @@ export type { WidthSizeClass, HeightSizeClass, WindowSizeClassInfo } from './com
|
|
|
40
40
|
export { useNotification } from './composables/useNotification'
|
|
41
41
|
export type { Notification, NotificationVariant, NotificationPosition, NotificationOptions } from './composables/useNotification'
|
|
42
42
|
export { useDebounce } from './composables/useDebounce'
|
|
43
|
+
export { required, email, url, minLength, maxLength, min, max, pattern, sameAs, isEmpty } from './composables/validation'
|
|
44
|
+
export type { ValidationRule, ValidationResult, ValidationContext, ValidateOn, StandardSchemaV1, StandardSchemaIssue, StandardSchemaResult } from './composables/validation'
|
|
43
45
|
export { usePageProgress } from './composables/usePageProgress'
|
|
44
46
|
export { useSpring } from './composables/_useSpring'
|
|
45
47
|
export { motionSprings, motionEasings, motionDurations, cubicBezier } from './composables/motion'
|
|
@@ -134,6 +136,7 @@ export { default as MExportButton } from './components/MExportButton.vue'
|
|
|
134
136
|
export { default as MFab } from './components/MFab.vue'
|
|
135
137
|
export { default as MFabMenu } from './components/MFabMenu.vue'
|
|
136
138
|
export { default as MFileUpload } from './components/MFileUpload.vue'
|
|
139
|
+
export { default as MForm } from './components/MForm.vue'
|
|
137
140
|
export { default as MFloorPlan } from './components/MFloorPlan.vue'
|
|
138
141
|
export { default as MFloorPlanToolbar } from './components/MFloorPlanToolbar.vue'
|
|
139
142
|
export type { FloorTablePreset } from './components/MFloorPlanToolbar.vue'
|
|
@@ -303,6 +306,7 @@ export { default as MTabs } from './components/MTabs.vue'
|
|
|
303
306
|
export { default as MText } from './components/MText.vue'
|
|
304
307
|
export { default as MTextField } from './components/MTextField.vue'
|
|
305
308
|
export { default as MTimeline } from './components/MTimeline.vue'
|
|
309
|
+
export { default as MTrackingTimeline } from './components/MTrackingTimeline.vue'
|
|
306
310
|
export { default as MTimePicker } from './components/MTimePicker.vue'
|
|
307
311
|
export { default as MTimePickerModal } from './components/MTimePickerModal.vue'
|
|
308
312
|
export { default as MTimeScroll } from './components/MTimeScroll.vue'
|
|
@@ -348,6 +352,7 @@ export type { StepItem } from './components/MStepper.vue'
|
|
|
348
352
|
export type { CommandItem } from './components/MCommandPalette.vue'
|
|
349
353
|
export type { TableFetchParams } from './components/MTable.vue'
|
|
350
354
|
export type { TimelineItem, TimelineStatus } from './components/MTimeline.vue'
|
|
355
|
+
export type { TrackingStep, TrackingStatus } from './components/MTrackingTimeline.vue'
|
|
351
356
|
export type { TourStep } from './components/MTour.vue'
|
|
352
357
|
export type { TransferItem } from './components/MTransferList.vue'
|
|
353
358
|
export type { TreeNode } from './components/MTree.vue'
|
package/src/locales/de.ts
CHANGED
|
@@ -244,6 +244,15 @@ export const deLocale: M3Locale = {
|
|
|
244
244
|
mapPressEnterToSearch: 'Zum Suchen Enter drücken',
|
|
245
245
|
mapSearching: 'Suche läuft…',
|
|
246
246
|
mapNoPlaces: 'Keine Orte gefunden',
|
|
247
|
+
mapRouteStop: 'Halt',
|
|
248
|
+
mapRouteVehicle: 'Fahrzeug',
|
|
249
|
+
trackingArrives: 'Ankunft {time}',
|
|
250
|
+
trackingArrivingNow: 'Kommt gleich',
|
|
251
|
+
trackingDelivered: 'Zugestellt',
|
|
252
|
+
trackingDelayed: 'Verspätet',
|
|
253
|
+
trackingCanceled: 'Storniert',
|
|
254
|
+
trackingShowDetails: 'Details anzeigen',
|
|
255
|
+
trackingHideDetails: 'Details ausblenden',
|
|
247
256
|
filterMatchAll: 'Alle',
|
|
248
257
|
filterMatchAny: 'Eine',
|
|
249
258
|
filterAddCondition: 'Bedingung hinzufügen',
|
|
@@ -569,6 +578,18 @@ export const deLocale: M3Locale = {
|
|
|
569
578
|
cardInvalidNumber: 'Ungültige Kartennummer',
|
|
570
579
|
cardInvalidExpiry: 'Ungültiges oder abgelaufenes Datum',
|
|
571
580
|
cardInvalidCvc: 'Ungültiger Sicherheitscode',
|
|
581
|
+
validationRequired: 'Dieses Feld ist erforderlich',
|
|
582
|
+
validationInvalid: 'Ungültiger Wert',
|
|
583
|
+
validationEmail: 'Gib eine gültige E-Mail-Adresse ein',
|
|
584
|
+
validationUrl: 'Gib eine gültige URL ein',
|
|
585
|
+
validationMinLength: 'Gib mindestens {min} Zeichen ein',
|
|
586
|
+
validationMaxLength: 'Gib höchstens {max} Zeichen ein',
|
|
587
|
+
validationMinItems: 'Wähle mindestens {min}',
|
|
588
|
+
validationMaxItems: 'Wähle höchstens {max}',
|
|
589
|
+
validationMin: 'Muss mindestens {min} sein',
|
|
590
|
+
validationMax: 'Darf höchstens {max} sein',
|
|
591
|
+
validationPattern: 'Ungültiges Format',
|
|
592
|
+
validationSameAs: 'Die Werte stimmen nicht überein',
|
|
572
593
|
keypadDelete: 'Löschen',
|
|
573
594
|
keypadClear: 'Leeren',
|
|
574
595
|
keypadChange: 'Rückgeld',
|