487 lines
13 KiB
JavaScript
487 lines
13 KiB
JavaScript
import {
|
|
makeDensityProps,
|
|
useDensity
|
|
} from "./chunk-VQPKT5F7.js";
|
|
import {
|
|
VIcon
|
|
} from "./chunk-IFUDBK56.js";
|
|
import {
|
|
VSlideYTransition
|
|
} from "./chunk-JVZUVJAC.js";
|
|
import {
|
|
MaybeTransition,
|
|
makeTransitionProps
|
|
} from "./chunk-XRWT7YWI.js";
|
|
import {
|
|
useTextColor
|
|
} from "./chunk-ZZ55KHRR.js";
|
|
import {
|
|
IconValue
|
|
} from "./chunk-472DNWSX.js";
|
|
import {
|
|
useLocale,
|
|
useRtl
|
|
} from "./chunk-IR5437QA.js";
|
|
import {
|
|
useProxiedModel,
|
|
useToggleScope
|
|
} from "./chunk-PVQHDZXM.js";
|
|
import {
|
|
EventProp,
|
|
genericComponent,
|
|
getCurrentInstanceName,
|
|
getUid,
|
|
makeComponentProps,
|
|
propsFactory,
|
|
useRender,
|
|
wrapInArray
|
|
} from "./chunk-I4KGD5X4.js";
|
|
import {
|
|
computed,
|
|
createVNode,
|
|
inject,
|
|
nextTick,
|
|
onBeforeMount,
|
|
onBeforeUnmount,
|
|
onMounted,
|
|
ref,
|
|
shallowRef,
|
|
unref,
|
|
watch
|
|
} from "./chunk-PD2AWGJV.js";
|
|
|
|
// node_modules/vuetify/lib/composables/focus.mjs
|
|
var makeFocusProps = propsFactory({
|
|
focused: Boolean,
|
|
"onUpdate:focused": EventProp()
|
|
}, "focus");
|
|
function useFocus(props) {
|
|
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
const isFocused = useProxiedModel(props, "focused");
|
|
const focusClasses = computed(() => {
|
|
return {
|
|
[`${name}--focused`]: isFocused.value
|
|
};
|
|
});
|
|
function focus() {
|
|
isFocused.value = true;
|
|
}
|
|
function blur() {
|
|
isFocused.value = false;
|
|
}
|
|
return {
|
|
focusClasses,
|
|
isFocused,
|
|
focus,
|
|
blur
|
|
};
|
|
}
|
|
|
|
// node_modules/vuetify/lib/composables/form.mjs
|
|
var FormKey = Symbol.for("vuetify:form");
|
|
var makeFormProps = propsFactory({
|
|
disabled: Boolean,
|
|
fastFail: Boolean,
|
|
readonly: Boolean,
|
|
modelValue: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
validateOn: {
|
|
type: String,
|
|
default: "input"
|
|
}
|
|
}, "form");
|
|
function useForm() {
|
|
return inject(FormKey, null);
|
|
}
|
|
|
|
// node_modules/vuetify/lib/components/VInput/VInput.mjs
|
|
import "C:/Users/Jeremy/Documents/Dev/Projects.cloudsucks.net/Vulture/VApp/node_modules/vuetify/lib/components/VInput/VInput.css";
|
|
|
|
// node_modules/vuetify/lib/components/VInput/InputIcon.mjs
|
|
function useInputIcon(props) {
|
|
const {
|
|
t
|
|
} = useLocale();
|
|
function InputIcon(_ref) {
|
|
let {
|
|
name
|
|
} = _ref;
|
|
const localeKey = {
|
|
prepend: "prependAction",
|
|
prependInner: "prependAction",
|
|
append: "appendAction",
|
|
appendInner: "appendAction",
|
|
clear: "clear"
|
|
}[name];
|
|
const listener = props[`onClick:${name}`];
|
|
const label = listener && localeKey ? t(`$vuetify.input.${localeKey}`, props.label ?? "") : void 0;
|
|
return createVNode(VIcon, {
|
|
"icon": props[`${name}Icon`],
|
|
"aria-label": label,
|
|
"onClick": listener
|
|
}, null);
|
|
}
|
|
return {
|
|
InputIcon
|
|
};
|
|
}
|
|
|
|
// node_modules/vuetify/lib/components/VMessages/VMessages.mjs
|
|
import "C:/Users/Jeremy/Documents/Dev/Projects.cloudsucks.net/Vulture/VApp/node_modules/vuetify/lib/components/VMessages/VMessages.css";
|
|
var makeVMessagesProps = propsFactory({
|
|
active: Boolean,
|
|
color: String,
|
|
messages: {
|
|
type: [Array, String],
|
|
default: () => []
|
|
},
|
|
...makeComponentProps(),
|
|
...makeTransitionProps({
|
|
transition: {
|
|
component: VSlideYTransition,
|
|
leaveAbsolute: true,
|
|
group: true
|
|
}
|
|
})
|
|
}, "VMessages");
|
|
var VMessages = genericComponent()({
|
|
name: "VMessages",
|
|
props: makeVMessagesProps(),
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const messages = computed(() => wrapInArray(props.messages));
|
|
const {
|
|
textColorClasses,
|
|
textColorStyles
|
|
} = useTextColor(computed(() => props.color));
|
|
useRender(() => createVNode(MaybeTransition, {
|
|
"transition": props.transition,
|
|
"tag": "div",
|
|
"class": ["v-messages", textColorClasses.value, props.class],
|
|
"style": [textColorStyles.value, props.style],
|
|
"role": "alert",
|
|
"aria-live": "polite"
|
|
}, {
|
|
default: () => [props.active && messages.value.map((message, i) => createVNode("div", {
|
|
"class": "v-messages__message",
|
|
"key": `${i}-${messages.value}`
|
|
}, [slots.message ? slots.message({
|
|
message
|
|
}) : message]))]
|
|
}));
|
|
return {};
|
|
}
|
|
});
|
|
|
|
// node_modules/vuetify/lib/composables/validation.mjs
|
|
var makeValidationProps = propsFactory({
|
|
disabled: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
error: Boolean,
|
|
errorMessages: {
|
|
type: [Array, String],
|
|
default: () => []
|
|
},
|
|
maxErrors: {
|
|
type: [Number, String],
|
|
default: 1
|
|
},
|
|
name: String,
|
|
label: String,
|
|
readonly: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
rules: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
modelValue: null,
|
|
validateOn: String,
|
|
validationValue: null,
|
|
...makeFocusProps()
|
|
}, "validation");
|
|
function useValidation(props) {
|
|
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
let id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : getUid();
|
|
const model = useProxiedModel(props, "modelValue");
|
|
const validationModel = computed(() => props.validationValue === void 0 ? model.value : props.validationValue);
|
|
const form = useForm();
|
|
const internalErrorMessages = ref([]);
|
|
const isPristine = shallowRef(true);
|
|
const isDirty = computed(() => !!(wrapInArray(model.value === "" ? null : model.value).length || wrapInArray(validationModel.value === "" ? null : validationModel.value).length));
|
|
const isDisabled = computed(() => !!(props.disabled ?? (form == null ? void 0 : form.isDisabled.value)));
|
|
const isReadonly = computed(() => !!(props.readonly ?? (form == null ? void 0 : form.isReadonly.value)));
|
|
const errorMessages = computed(() => {
|
|
var _a;
|
|
return ((_a = props.errorMessages) == null ? void 0 : _a.length) ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors)) : internalErrorMessages.value;
|
|
});
|
|
const validateOn = computed(() => {
|
|
let value = (props.validateOn ?? (form == null ? void 0 : form.validateOn.value)) || "input";
|
|
if (value === "lazy") value = "input lazy";
|
|
const set = new Set((value == null ? void 0 : value.split(" ")) ?? []);
|
|
return {
|
|
blur: set.has("blur") || set.has("input"),
|
|
input: set.has("input"),
|
|
submit: set.has("submit"),
|
|
lazy: set.has("lazy")
|
|
};
|
|
});
|
|
const isValid = computed(() => {
|
|
var _a;
|
|
if (props.error || ((_a = props.errorMessages) == null ? void 0 : _a.length)) return false;
|
|
if (!props.rules.length) return true;
|
|
if (isPristine.value) {
|
|
return internalErrorMessages.value.length || validateOn.value.lazy ? null : true;
|
|
} else {
|
|
return !internalErrorMessages.value.length;
|
|
}
|
|
});
|
|
const isValidating = shallowRef(false);
|
|
const validationClasses = computed(() => {
|
|
return {
|
|
[`${name}--error`]: isValid.value === false,
|
|
[`${name}--dirty`]: isDirty.value,
|
|
[`${name}--disabled`]: isDisabled.value,
|
|
[`${name}--readonly`]: isReadonly.value
|
|
};
|
|
});
|
|
const uid = computed(() => props.name ?? unref(id));
|
|
onBeforeMount(() => {
|
|
form == null ? void 0 : form.register({
|
|
id: uid.value,
|
|
validate,
|
|
reset,
|
|
resetValidation
|
|
});
|
|
});
|
|
onBeforeUnmount(() => {
|
|
form == null ? void 0 : form.unregister(uid.value);
|
|
});
|
|
onMounted(async () => {
|
|
if (!validateOn.value.lazy) {
|
|
await validate(true);
|
|
}
|
|
form == null ? void 0 : form.update(uid.value, isValid.value, errorMessages.value);
|
|
});
|
|
useToggleScope(() => validateOn.value.input, () => {
|
|
watch(validationModel, () => {
|
|
if (validationModel.value != null) {
|
|
validate();
|
|
} else if (props.focused) {
|
|
const unwatch = watch(() => props.focused, (val) => {
|
|
if (!val) validate();
|
|
unwatch();
|
|
});
|
|
}
|
|
});
|
|
});
|
|
useToggleScope(() => validateOn.value.blur, () => {
|
|
watch(() => props.focused, (val) => {
|
|
if (!val) validate();
|
|
});
|
|
});
|
|
watch([isValid, errorMessages], () => {
|
|
form == null ? void 0 : form.update(uid.value, isValid.value, errorMessages.value);
|
|
});
|
|
function reset() {
|
|
model.value = null;
|
|
nextTick(resetValidation);
|
|
}
|
|
function resetValidation() {
|
|
isPristine.value = true;
|
|
if (!validateOn.value.lazy) {
|
|
validate(true);
|
|
} else {
|
|
internalErrorMessages.value = [];
|
|
}
|
|
}
|
|
async function validate() {
|
|
let silent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
const results = [];
|
|
isValidating.value = true;
|
|
for (const rule of props.rules) {
|
|
if (results.length >= +(props.maxErrors ?? 1)) {
|
|
break;
|
|
}
|
|
const handler = typeof rule === "function" ? rule : () => rule;
|
|
const result = await handler(validationModel.value);
|
|
if (result === true) continue;
|
|
if (result !== false && typeof result !== "string") {
|
|
console.warn(`${result} is not a valid value. Rule functions must return boolean true or a string.`);
|
|
continue;
|
|
}
|
|
results.push(result || "");
|
|
}
|
|
internalErrorMessages.value = results;
|
|
isValidating.value = false;
|
|
isPristine.value = silent;
|
|
return internalErrorMessages.value;
|
|
}
|
|
return {
|
|
errorMessages,
|
|
isDirty,
|
|
isDisabled,
|
|
isReadonly,
|
|
isPristine,
|
|
isValid,
|
|
isValidating,
|
|
reset,
|
|
resetValidation,
|
|
validate,
|
|
validationClasses
|
|
};
|
|
}
|
|
|
|
// node_modules/vuetify/lib/components/VInput/VInput.mjs
|
|
var makeVInputProps = propsFactory({
|
|
id: String,
|
|
appendIcon: IconValue,
|
|
centerAffix: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
prependIcon: IconValue,
|
|
hideDetails: [Boolean, String],
|
|
hideSpinButtons: Boolean,
|
|
hint: String,
|
|
persistentHint: Boolean,
|
|
messages: {
|
|
type: [Array, String],
|
|
default: () => []
|
|
},
|
|
direction: {
|
|
type: String,
|
|
default: "horizontal",
|
|
validator: (v) => ["horizontal", "vertical"].includes(v)
|
|
},
|
|
"onClick:prepend": EventProp(),
|
|
"onClick:append": EventProp(),
|
|
...makeComponentProps(),
|
|
...makeDensityProps(),
|
|
...makeValidationProps()
|
|
}, "VInput");
|
|
var VInput = genericComponent()({
|
|
name: "VInput",
|
|
props: {
|
|
...makeVInputProps()
|
|
},
|
|
emits: {
|
|
"update:modelValue": (value) => true
|
|
},
|
|
setup(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots,
|
|
emit
|
|
} = _ref;
|
|
const {
|
|
densityClasses
|
|
} = useDensity(props);
|
|
const {
|
|
rtlClasses
|
|
} = useRtl();
|
|
const {
|
|
InputIcon
|
|
} = useInputIcon(props);
|
|
const uid = getUid();
|
|
const id = computed(() => props.id || `input-${uid}`);
|
|
const messagesId = computed(() => `${id.value}-messages`);
|
|
const {
|
|
errorMessages,
|
|
isDirty,
|
|
isDisabled,
|
|
isReadonly,
|
|
isPristine,
|
|
isValid,
|
|
isValidating,
|
|
reset,
|
|
resetValidation,
|
|
validate,
|
|
validationClasses
|
|
} = useValidation(props, "v-input", id);
|
|
const slotProps = computed(() => ({
|
|
id,
|
|
messagesId,
|
|
isDirty,
|
|
isDisabled,
|
|
isReadonly,
|
|
isPristine,
|
|
isValid,
|
|
isValidating,
|
|
reset,
|
|
resetValidation,
|
|
validate
|
|
}));
|
|
const messages = computed(() => {
|
|
var _a;
|
|
if (((_a = props.errorMessages) == null ? void 0 : _a.length) || !isPristine.value && errorMessages.value.length) {
|
|
return errorMessages.value;
|
|
} else if (props.hint && (props.persistentHint || props.focused)) {
|
|
return props.hint;
|
|
} else {
|
|
return props.messages;
|
|
}
|
|
});
|
|
useRender(() => {
|
|
var _a, _b, _c, _d;
|
|
const hasPrepend = !!(slots.prepend || props.prependIcon);
|
|
const hasAppend = !!(slots.append || props.appendIcon);
|
|
const hasMessages = messages.value.length > 0;
|
|
const hasDetails = !props.hideDetails || props.hideDetails === "auto" && (hasMessages || !!slots.details);
|
|
return createVNode("div", {
|
|
"class": ["v-input", `v-input--${props.direction}`, {
|
|
"v-input--center-affix": props.centerAffix,
|
|
"v-input--hide-spin-buttons": props.hideSpinButtons
|
|
}, densityClasses.value, rtlClasses.value, validationClasses.value, props.class],
|
|
"style": props.style
|
|
}, [hasPrepend && createVNode("div", {
|
|
"key": "prepend",
|
|
"class": "v-input__prepend"
|
|
}, [(_a = slots.prepend) == null ? void 0 : _a.call(slots, slotProps.value), props.prependIcon && createVNode(InputIcon, {
|
|
"key": "prepend-icon",
|
|
"name": "prepend"
|
|
}, null)]), slots.default && createVNode("div", {
|
|
"class": "v-input__control"
|
|
}, [(_b = slots.default) == null ? void 0 : _b.call(slots, slotProps.value)]), hasAppend && createVNode("div", {
|
|
"key": "append",
|
|
"class": "v-input__append"
|
|
}, [props.appendIcon && createVNode(InputIcon, {
|
|
"key": "append-icon",
|
|
"name": "append"
|
|
}, null), (_c = slots.append) == null ? void 0 : _c.call(slots, slotProps.value)]), hasDetails && createVNode("div", {
|
|
"class": "v-input__details"
|
|
}, [createVNode(VMessages, {
|
|
"id": messagesId.value,
|
|
"active": hasMessages,
|
|
"messages": messages.value
|
|
}, {
|
|
message: slots.message
|
|
}), (_d = slots.details) == null ? void 0 : _d.call(slots, slotProps.value)])]);
|
|
});
|
|
return {
|
|
reset,
|
|
resetValidation,
|
|
validate,
|
|
isValid,
|
|
errorMessages
|
|
};
|
|
}
|
|
});
|
|
|
|
export {
|
|
useInputIcon,
|
|
makeFocusProps,
|
|
useFocus,
|
|
useForm,
|
|
makeVInputProps,
|
|
VInput
|
|
};
|
|
//# sourceMappingURL=chunk-ZCXGZYP7.js.map
|