diff --git a/frontend/components/Domain/User/UserPasswordStrength.vue b/frontend/components/Domain/User/UserPasswordStrength.vue index 4e05d76c2..a4871ad14 100644 --- a/frontend/components/Domain/User/UserPasswordStrength.vue +++ b/frontend/components/Domain/User/UserPasswordStrength.vue @@ -1,5 +1,5 @@ + + + + diff --git a/frontend/components/global/AutoForm.vue b/frontend/components/global/AutoForm.vue index 95869f38b..27792d8ba 100644 --- a/frontend/components/global/AutoForm.vue +++ b/frontend/components/global/AutoForm.vue @@ -33,9 +33,10 @@ @@ -70,9 +71,9 @@ @@ -89,12 +90,11 @@ @@ -127,7 +127,7 @@ +
@@ -150,7 +151,7 @@

@@ -160,15 +161,15 @@ class="ml-5" x-small delete - @click="removeByIndex(modelValue[inputField.varName], idx)" + @click="removeByIndex(model[inputField.varName], idx)" />

@@ -176,7 +177,7 @@ {{ $t("general.new") }} @@ -197,7 +198,13 @@ const BLUR_EVENT = "blur"; type ValidatorKey = keyof typeof validators; // Use defineModel for v-model -const modelValue = defineModel<[object, Array]>(); +const modelValue = defineModel | any[]>({ + type: [Object, Array], + required: true, +}); + +// alias to avoid template TS complaining about possible undefined +const model = modelValue as any; const props = defineProps({ updateMode: { @@ -238,26 +245,39 @@ const emit = defineEmits(["blur", "update:modelValue"]); function rulesByKey(keys?: ValidatorKey[] | null) { if (keys === undefined || keys === null) { - return []; + return [] as any[]; } - const list = [] as ((v: string) => boolean | string)[]; + const list: any[] = []; keys.forEach((key) => { const split = key.split(":"); const validatorKey = split[0] as ValidatorKey; if (validatorKey in validators) { if (split.length === 1) { - list.push(validators[validatorKey]); + list.push((validators as any)[validatorKey]); } else { - list.push(validators[validatorKey](split[1])); + list.push((validators as any)[validatorKey](split[1] as any)); } } }); return list; } -const defaultRules = computed(() => rulesByKey(props.globalRules as ValidatorKey[])); +const defaultRules = computed(() => rulesByKey(props.globalRules as any)); + +// Combined state map for readonly and disabled fields +const fieldState = computed>(() => { + const map: Record = {}; + (props.items || []).forEach((field: any) => { + const base = (field.disableUpdate && props.updateMode) || (!props.updateMode && field.disableCreate); + map[field.varName] = { + readonly: base || !!props.readonlyFields?.includes(field.varName), + disabled: base || !!props.disabledFields?.includes(field.varName), + }; + }); + return map; +}); function removeByIndex(list: never[], index: number) { // Removes the item at the index diff --git a/frontend/components/global/BaseWizard.vue b/frontend/components/global/BaseWizard.vue deleted file mode 100644 index 102f068c8..000000000 --- a/frontend/components/global/BaseWizard.vue +++ /dev/null @@ -1,293 +0,0 @@ - - - - - diff --git a/frontend/pages/admin/setup.vue b/frontend/pages/admin/setup.vue index 31c5c3879..00970d191 100644 --- a/frontend/pages/admin/setup.vue +++ b/frontend/pages/admin/setup.vue @@ -1,115 +1,239 @@