routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
||||
// Components
|
||||
import { makeVWindowProps, VWindow } from "../VWindow/VWindow.js"; // Composables
|
||||
import { useProxiedModel } from "../../composables/proxiedModel.js"; // Utilities
|
||||
import { computed, inject } from 'vue';
|
||||
import { genericComponent, omit, propsFactory, useRender } from "../../util/index.js"; // Types
|
||||
import { VTabsSymbol } from "./shared.js";
|
||||
export const makeVTabsWindowProps = propsFactory({
|
||||
...omit(makeVWindowProps(), ['continuous', 'nextIcon', 'prevIcon', 'showArrows', 'touch', 'mandatory'])
|
||||
}, 'VTabsWindow');
|
||||
export const VTabsWindow = genericComponent()({
|
||||
name: 'VTabsWindow',
|
||||
props: makeVTabsWindowProps(),
|
||||
emits: {
|
||||
'update:modelValue': v => true
|
||||
},
|
||||
setup(props, {
|
||||
slots
|
||||
}) {
|
||||
const group = inject(VTabsSymbol, null);
|
||||
const _model = useProxiedModel(props, 'modelValue');
|
||||
const model = computed({
|
||||
get() {
|
||||
// Always return modelValue if defined
|
||||
// or if not within a VTabs group
|
||||
if (_model.value != null || !group) return _model.value;
|
||||
|
||||
// If inside of a VTabs, find the currently selected
|
||||
// item by id. Item value may be assigned by its index
|
||||
return group.items.value.find(item => group.selected.value.includes(item.id))?.value;
|
||||
},
|
||||
set(val) {
|
||||
_model.value = val;
|
||||
}
|
||||
});
|
||||
useRender(() => {
|
||||
const windowProps = VWindow.filterProps(props);
|
||||
return _createVNode(VWindow, _mergeProps({
|
||||
"_as": "VTabsWindow"
|
||||
}, windowProps, {
|
||||
"modelValue": model.value,
|
||||
"onUpdate:modelValue": $event => model.value = $event,
|
||||
"class": ['v-tabs-window', props.class],
|
||||
"style": props.style,
|
||||
"mandatory": false,
|
||||
"touch": false
|
||||
}), slots);
|
||||
});
|
||||
return {};
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VTabsWindow.js.map
|
||||
Reference in New Issue
Block a user