Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove legacy useVModel leftover code #1073

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/oruga/src/components/autocomplete/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ defineOptions({
inheritAttrs: false,
});

type ModelValue = AutocompleteProps<T>["modelValue"];

const props = withDefaults(defineProps<AutocompleteProps<T>>(), {
override: undefined,
modelValue: undefined,
Expand Down Expand Up @@ -111,8 +113,6 @@ const props = withDefaults(defineProps<AutocompleteProps<T>>(), {
inputClasses: () => getOption("autocomplete.inputClasses", {}),
});

type ModelValue = AutocompleteProps<T>["modelValue"];

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/datepicker/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ defineOptions({
configField: "datepicker",
});

type ModelValue = DatepickerProps<IsRange, IsMultiple>["modelValue"];

const props = withDefaults(
defineProps<DatepickerProps<IsRange, IsMultiple>>(),
{
Expand Down Expand Up @@ -100,8 +102,6 @@ const props = withDefaults(
},
);

type ModelValue = DatepickerProps<IsRange, IsMultiple>["modelValue"];

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ defineOptions({
configField: "dropdown",
});

type ModelValue = DropdownProps<T, IsMultiple>["modelValue"];

const props = withDefaults(defineProps<DropdownProps<T, IsMultiple>>(), {
override: undefined,
modelValue: undefined,
Expand Down Expand Up @@ -81,8 +83,6 @@ const props = withDefaults(defineProps<DropdownProps<T, IsMultiple>>(), {
teleport: () => getOption("dropdown.teleport", false),
});

type ModelValue = DropdownProps<T, IsMultiple>["modelValue"];

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ defineOptions({
inheritAttrs: false,
});

type ModelValue = InputProps<IsNumber>["modelValue"];

const props = withDefaults(defineProps<InputProps<IsNumber>>(), {
override: undefined,
modelValue: undefined,
Expand Down Expand Up @@ -63,8 +65,6 @@ const props = withDefaults(defineProps<InputProps<IsNumber>>(), {
customValidity: "",
});

type ModelValue = typeof props.modelValue;

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/select/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ defineOptions({
inheritAttrs: false,
});

type ModelValue = SelectProps<T, IsMultiple>["modelValue"];

const props = withDefaults(defineProps<SelectProps<T, IsMultiple>>(), {
override: undefined,
modelValue: undefined,
Expand All @@ -60,8 +62,6 @@ const props = withDefaults(defineProps<SelectProps<T, IsMultiple>>(), {
statusIcon: () => getOption("statusIcon", true),
});

type ModelValue = typeof props.modelValue;

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/slider/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ defineOptions({
configField: "slider",
});

type ModelValue = SliderProps<IsRange>["modelValue"];

const props = withDefaults(defineProps<SliderProps<IsRange>>(), {
override: undefined,
modelValue: undefined,
Expand All @@ -47,8 +49,6 @@ const props = withDefaults(defineProps<SliderProps<IsRange>>(), {
ariaLabel: () => getOption("slider.ariaLabel"),
});

type ModelValue = typeof props.modelValue;

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/steps/Steps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ defineOptions({
configField: "steps",
});

type ModelValue = StepsProps<T>["modelValue"];

const props = withDefaults(defineProps<StepsProps<T>>(), {
override: undefined,
modelValue: undefined,
Expand Down Expand Up @@ -59,8 +61,6 @@ const props = withDefaults(defineProps<StepsProps<T>>(), {
ariaPreviousLabel: () => getOption("steps.ariaPreviousLabel", "Previous"),
});

type ModelValue = StepsProps<T>["modelValue"];

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/switch/Switch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed, ref, useAttrs, useId, type PropType } from "vue";

import { getOption } from "@/utils/config";
import { defineClasses, useInputHandler, useVModel } from "@/composables";
import { defineClasses, useInputHandler } from "@/composables";

import { injectField } from "../field/fieldInjection";

Expand Down Expand Up @@ -212,7 +212,7 @@ const { onBlur, onFocus, onInvalid, setFocus } = useInputHandler(
const { parentField } = injectField();

// const vmodel = defineModel<T>({ default: undefined });
const vmodel = useVModel<T>();
const vmodel = defineModel<T>({ default: undefined });

// if not `label` is given and `id` is given set as `for` property on o-field wrapper
if (!props.label && props.id) parentField?.value?.setInputId(props.id);
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/tabs/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ defineOptions({
configField: "tabs",
});

type ModelValue = TabsProps<T>["modelValue"];

const props = withDefaults(defineProps<TabsProps<T>>(), {
override: undefined,
modelValue: undefined,
Expand All @@ -59,8 +61,6 @@ const props = withDefaults(defineProps<TabsProps<T>>(), {
multiline: false,
});

type ModelValue = TabsProps<T>["modelValue"];

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/components/taginput/Taginput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ defineOptions({
inheritAttrs: false,
});

type ModelValue = TaginputProps<T>["modelValue"];

const props = withDefaults(defineProps<TaginputProps<T>>(), {
override: undefined,
modelValue: undefined,
Expand Down Expand Up @@ -71,8 +73,6 @@ const props = withDefaults(defineProps<TaginputProps<T>>(), {
autocompleteClasses: () => getOption("taginput.autocompleteClasses", {}),
});

type ModelValue = TaginputProps<T>["modelValue"];

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down
6 changes: 3 additions & 3 deletions packages/oruga/src/components/upload/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ defineOptions({
inheritAttrs: false,
});

type ModelValue = UploadProps<T, IsMultiple>["modelValue"];

const props = withDefaults(defineProps<UploadProps<T, IsMultiple>>(), {
override: undefined,
modelValue: undefined,
Expand All @@ -42,8 +44,6 @@ const props = withDefaults(defineProps<UploadProps<T, IsMultiple>>(), {
customValidity: "",
});

type ModelValue = typeof props.modelValue;

const emits = defineEmits<{
/**
* modelValue prop two-way binding
Expand Down Expand Up @@ -76,7 +76,7 @@ const { checkHtml5Validity, onFocus, onBlur, onInvalid, isValid, setFocus } =
// inject parent field component if used inside one
const { parentField } = injectField();

const vmodel = defineModel<ModelValue>({ default: null });
const vmodel = defineModel<ModelValue>({ default: undefined });

const dragDropFocus = ref(false);

Expand Down
1 change: 0 additions & 1 deletion packages/oruga/src/composables/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export * from "./useParentProvider";
export * from "./useClickOutside";
export * from "./useScrollingParent";
export * from "./useObjectMap";
export * from "./useVModel";
export * from "./useOptions";
export * from "./usePreventScrolling";
64 changes: 0 additions & 64 deletions packages/oruga/src/composables/useVModel.ts

This file was deleted.