Skip to content

Commit

Permalink
Δεν λειτουργεί η επικόλληση στα πεδία μετά τις τελευταίες αλλαγές
Browse files Browse the repository at this point in the history
Fixes #118
  • Loading branch information
parapente committed Oct 2, 2024
1 parent eda6006 commit 52a723d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
20 changes: 11 additions & 9 deletions resources/ts/components/composables/useOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
type FormFieldOptionsShowCriteria,
} from "@/fieldtype";
import { useFormStore } from "@/stores/formStore";
import type { Store } from "pinia";
import { nextTick, type Ref, ref, watch } from "vue";

function isUppercase(value: string) {
Expand Down Expand Up @@ -309,22 +308,25 @@ export function useOptions(
valueChecks.push(isInGreek);
}

if (options?.field_width_enabled && options?.field_width) {
valueChecks.push(matchesLength.bind(null, options.field_width));
}

if (options?.positive) {
valueChecks.push(isPositive);
}

if (
options?.regex_enabled &&
options?.regex &&
options?.regex_description
) {
validationChecks.push(
...valueChecks,
matchesRegex.bind(null, options.regex, options.regex_description)
);
}

if (options?.field_width_enabled && options?.field_width) {
valueChecks.push(matchesLength.bind(null, options.field_width));
}

if (options?.positive) {
valueChecks.push(isPositive);
} else {
validationChecks.push(...valueChecks);
}

if (options?.show_when && options?.show_when.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ export function useTextInputEventHandlers(
// Δεν είναι διαθέσιμο το selectionStart & selectionEnd
const match = options.valueMatch(pastedText);
errorRef.value = match.errorMessages;
const originalType = target.type;
target.type = "text";
console.log(target.selectionStart);
target.type = originalType;
if (!match.result) {
event.preventDefault();
return;
Expand Down
3 changes: 1 addition & 2 deletions resources/ts/components/frontend/form/field/Number.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ const validationCheck = () => {
}
const result = formStore.fieldOptions[props.field.id].validationCheck(
formStore.field[props.field.id] ?? ""
`${formStore.field[props.field.id]}` ?? ""
);
validationErrors.value = result.errorMessages;
emit("validationErrors", validationErrors.value);
Expand Down

0 comments on commit 52a723d

Please sign in to comment.