chore: Minor optimizations
- Optimize code, update a validation message and fix code inspection warning
This commit is contained in:
parent
e7ada4b47d
commit
b0650a5bf4
2 changed files with 4 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, useId, useTemplateRef } from "vue";
|
import { ref, useId, useTemplateRef } from "vue";
|
||||||
import CountryListItem from "./CountryListItem.vue";
|
import CountryListItem from "./CountryListItem.vue";
|
||||||
import { Country, getAvailableCountries } from "../utils/countries";
|
import { type Country, getAvailableCountries } from "../utils/countries.ts";
|
||||||
|
|
||||||
const formModel = ref(false);
|
const formModel = ref(false);
|
||||||
const formRef = useTemplateRef("form");
|
const formRef = useTemplateRef("form");
|
||||||
|
@ -22,10 +22,7 @@ const state = ref("");
|
||||||
const locality = ref("");
|
const locality = ref("");
|
||||||
|
|
||||||
// Countries data for autocomplete
|
// Countries data for autocomplete
|
||||||
const countries = ref<(Country | { divider: boolean; header: string })[]>([]);
|
const countries = ref(getAvailableCountries());
|
||||||
|
|
||||||
// Initialize countries list
|
|
||||||
countries.value = getAvailableCountries();
|
|
||||||
|
|
||||||
// Certificate settings
|
// Certificate settings
|
||||||
const keyLength = ref(4096);
|
const keyLength = ref(4096);
|
||||||
|
@ -35,7 +32,7 @@ const noExpiry = ref(false);
|
||||||
// Validation rules
|
// Validation rules
|
||||||
const domainRules = [
|
const domainRules = [
|
||||||
(value: string) => !!value || "A value must be provided to add the domain.",
|
(value: string) => !!value || "A value must be provided to add the domain.",
|
||||||
(value: string) => new RegExp("^[a-z0-9][a-z0-9.]+$").test(value) || "Invalid domain characters provided. (To use some characters, convert the domain to xn-domain format.)",
|
(value: string) => /^[a-z0-9][a-z0-9.\-_]+$|^xn--[a-z0-9.\-_]+$/i.test(value) || "Invalid domain characters provided. (To use some special characters, convert the domain to xn-domain format.)",
|
||||||
]
|
]
|
||||||
|
|
||||||
const emailRules = [
|
const emailRules = [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
"include": ["env.d.ts", "src/**/*", "src/**/*.ts", "src/**/*.vue"],
|
||||||
"exclude": ["src/**/__tests__/*"],
|
"exclude": ["src/**/__tests__/*"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue