init component

This commit is contained in:
Robin COuret
2026-02-16 17:28:37 +01:00
parent 460c7a25e0
commit e0e50af706
4557 changed files with 666911 additions and 8 deletions

53
node_modules/buetify/lib/composables/model/useModel.js generated vendored Executable file
View File

@@ -0,0 +1,53 @@
import { constant, constVoid } from 'fp-ts/lib/function';
import { shallowRef, watch, toRef, computed } from 'vue';
import { exists, isObject } from '../../utils/helpers';
export function getUseModelPropsDefinition(valueKey = 'modelValue', updateKey = 'onUpdate:modelValue') {
return {
[valueKey]: null,
[updateKey]: {
type: Function,
default: constant(constVoid)
}
};
}
export function useModel(props, valueKey = 'modelValue', updateKey = 'onUpdate:modelValue') {
const internalValue = shallowRef(props[valueKey]);
watch(toRef(props, valueKey), newVal => {
internalValue.value = newVal;
});
const value = computed({
get() {
return internalValue.value;
},
set(val) {
internalValue.value = val;
if (val !== undefined) {
props[updateKey](val);
}
}
});
function onUpdate(e) {
// eslint-disable-next-line
// @ts-ignore-next-line
if (isObject(e.target) && exists(e.target.value)) {
// eslint-disable-next-line
// @ts-ignore-next-line
value.value = e.target.value;
}
}
function set(val) {
value.value = val;
}
return {
set,
modelValue: value,
onNativeInput: onUpdate
};
}
//# sourceMappingURL=useModel.js.map