add rule sameAsIgnoreCase for confirmation dialog

This commit is contained in:
Gauthier Roebroeck 2025-09-22 16:53:53 +08:00
parent f105fcebe6
commit 8653c4f3e8
2 changed files with 7 additions and 1 deletions

View file

@ -42,7 +42,7 @@
</slot>
<v-text-field
:rules="[['sameAs', validateText]]"
:rules="[['sameAsIgnoreCase', validateText]]"
hide-details
class="mt-2"
autofocus

View file

@ -79,6 +79,12 @@ export const vuetifyRulesPlugin = createRulesPlugin(
sameAs: (other?: string, err?: string) => {
return (v: unknown) => other === v || err || 'Field must have the same value'
},
sameAsIgnoreCase: (other?: string, err?: string) => {
return (v: unknown) =>
other?.localeCompare(String(v), undefined, { sensitivity: 'accent' }) == 0 ||
err ||
'Field must have the same value'
},
},
},
vuetify.locale,