@fastkit/vui 0.6.28 → 0.6.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tool/index.js +4 -0
- package/dist/tool/vite-plugin.d.ts.map +1 -1
- package/dist/vui.cjs.js +494 -13
- package/dist/vui.cjs.prod.js +494 -13
- package/dist/vui.css +181 -0
- package/dist/vui.d.ts +110 -0
- package/dist/vui.esm-bundler.js +495 -16
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/package.json +6 -6
package/dist/vui.esm-bundler.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useInjectTheme, VStackRoot, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
1
|
+
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
2
2
|
export * from '@fastkit/vue-kit';
|
|
3
3
|
export { VDialog, VMenu, VSnackbar } from '@fastkit/vue-kit';
|
|
4
4
|
import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableProps, navigationableEmits, useNavigationable, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService } from '@fastkit/vue-utils';
|
|
5
|
-
import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, vModelSelect, onMounted, Transition } from 'vue';
|
|
5
|
+
import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, vModelSelect, onMounted, onBeforeUnmount, onBeforeUpdate, Transition } from 'vue';
|
|
6
6
|
import { useScopeColorClass, colorSchemeProps, useColorClasses, toScopeColorClass } from '@fastkit/vue-color-scheme';
|
|
7
7
|
import { VProgressCircular } from '@fastkit/vue-loading';
|
|
8
8
|
export * from '@fastkit/vue-loading';
|
|
@@ -10,6 +10,7 @@ export { ICON_NAMES } from '@fastkit/icon-font';
|
|
|
10
10
|
import { isPromise } from '@fastkit/helpers';
|
|
11
11
|
import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
|
|
12
12
|
import { VAppContainer, VAppLayoutControl } from '@fastkit/vue-app-layout';
|
|
13
|
+
import { getDocumentScroller as getDocumentScroller$1 } from '@fastkit/vue-scroller';
|
|
13
14
|
|
|
14
15
|
const CONTROL_SIZES = ['sm', 'md', 'lg'];
|
|
15
16
|
const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
|
|
@@ -533,7 +534,7 @@ const VButton = defineComponent({
|
|
|
533
534
|
|
|
534
535
|
});
|
|
535
536
|
|
|
536
|
-
function _isSlot$
|
|
537
|
+
function _isSlot$b(s) {
|
|
537
538
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
538
539
|
}
|
|
539
540
|
|
|
@@ -781,7 +782,7 @@ const VPagination = defineComponent({
|
|
|
781
782
|
"class": classes,
|
|
782
783
|
"to": to,
|
|
783
784
|
"key": key
|
|
784
|
-
}, _isSlot$
|
|
785
|
+
}, _isSlot$b(children) ? children : {
|
|
785
786
|
default: () => [children]
|
|
786
787
|
});
|
|
787
788
|
} else {
|
|
@@ -946,7 +947,7 @@ const VDrawerLayout = defineComponent({
|
|
|
946
947
|
|
|
947
948
|
});
|
|
948
949
|
|
|
949
|
-
function _isSlot$
|
|
950
|
+
function _isSlot$a(s) {
|
|
950
951
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
951
952
|
}
|
|
952
953
|
|
|
@@ -981,7 +982,7 @@ const VHero = defineComponent({
|
|
|
981
982
|
}, {
|
|
982
983
|
default: () => [createVNode(HTagName, {
|
|
983
984
|
"class": "v-hero__title"
|
|
984
|
-
}, _isSlot$
|
|
985
|
+
}, _isSlot$a(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
985
986
|
default: () => [_slot]
|
|
986
987
|
})]
|
|
987
988
|
})]
|
|
@@ -991,7 +992,7 @@ const VHero = defineComponent({
|
|
|
991
992
|
|
|
992
993
|
});
|
|
993
994
|
|
|
994
|
-
function _isSlot$
|
|
995
|
+
function _isSlot$9(s) {
|
|
995
996
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
996
997
|
}
|
|
997
998
|
|
|
@@ -1022,7 +1023,7 @@ function renderNavigationItemInput(input, extraProps) {
|
|
|
1022
1023
|
} = resolveNavigationItemInput(input);
|
|
1023
1024
|
return createVNode(VNavigationItem, { ...props,
|
|
1024
1025
|
...extraProps
|
|
1025
|
-
}, _isSlot$
|
|
1026
|
+
}, _isSlot$9(label) ? label : {
|
|
1026
1027
|
default: () => [label]
|
|
1027
1028
|
});
|
|
1028
1029
|
}
|
|
@@ -1166,7 +1167,7 @@ const VNavigationItem = defineComponent({
|
|
|
1166
1167
|
"class": ['v-navigation-item', classes.value],
|
|
1167
1168
|
"onClick": onClick,
|
|
1168
1169
|
"onChangeActive": onChangeActive
|
|
1169
|
-
}), _isSlot$
|
|
1170
|
+
}), _isSlot$9(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
1170
1171
|
default: () => [_slot]
|
|
1171
1172
|
}), _children && createVNode(VExpandTransition, null, {
|
|
1172
1173
|
default: () => [withDirectives(createVNode("div", {
|
|
@@ -1314,7 +1315,7 @@ const VCheckbox = defineComponent({
|
|
|
1314
1315
|
|
|
1315
1316
|
});
|
|
1316
1317
|
|
|
1317
|
-
function _isSlot$
|
|
1318
|
+
function _isSlot$8(s) {
|
|
1318
1319
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1319
1320
|
}
|
|
1320
1321
|
|
|
@@ -1326,7 +1327,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
|
|
|
1326
1327
|
itemRenderer: ({
|
|
1327
1328
|
attrs,
|
|
1328
1329
|
slots
|
|
1329
|
-
}) => createVNode(VCheckbox, attrs, _isSlot$
|
|
1330
|
+
}) => createVNode(VCheckbox, attrs, _isSlot$8(slots) ? slots : {
|
|
1330
1331
|
default: () => [slots]
|
|
1331
1332
|
})
|
|
1332
1333
|
});
|
|
@@ -1378,7 +1379,7 @@ const VRadio = defineComponent({
|
|
|
1378
1379
|
|
|
1379
1380
|
});
|
|
1380
1381
|
|
|
1381
|
-
function _isSlot$
|
|
1382
|
+
function _isSlot$7(s) {
|
|
1382
1383
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1383
1384
|
}
|
|
1384
1385
|
|
|
@@ -1389,7 +1390,7 @@ const VRadioGroup = defineFormSelectorComponent({
|
|
|
1389
1390
|
itemRenderer: ({
|
|
1390
1391
|
attrs,
|
|
1391
1392
|
slots
|
|
1392
|
-
}) => createVNode(VRadio, attrs, _isSlot$
|
|
1393
|
+
}) => createVNode(VRadio, attrs, _isSlot$7(slots) ? slots : {
|
|
1393
1394
|
default: () => [slots]
|
|
1394
1395
|
})
|
|
1395
1396
|
});
|
|
@@ -1451,7 +1452,7 @@ const VSwitch = defineComponent({
|
|
|
1451
1452
|
|
|
1452
1453
|
});
|
|
1453
1454
|
|
|
1454
|
-
function _isSlot$
|
|
1455
|
+
function _isSlot$6(s) {
|
|
1455
1456
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1456
1457
|
}
|
|
1457
1458
|
|
|
@@ -1463,7 +1464,7 @@ const VSwitchGroup = defineFormSelectorComponent({
|
|
|
1463
1464
|
itemRenderer: ({
|
|
1464
1465
|
attrs,
|
|
1465
1466
|
slots
|
|
1466
|
-
}) => createVNode(VSwitch, attrs, _isSlot$
|
|
1467
|
+
}) => createVNode(VSwitch, attrs, _isSlot$6(slots) ? slots : {
|
|
1467
1468
|
default: () => [slots]
|
|
1468
1469
|
})
|
|
1469
1470
|
});
|
|
@@ -2022,6 +2023,484 @@ const VForm = defineComponent({
|
|
|
2022
2023
|
|
|
2023
2024
|
});
|
|
2024
2025
|
|
|
2026
|
+
function _isSlot$5(s) {
|
|
2027
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
const VTab = defineComponent({
|
|
2031
|
+
name: 'VTab',
|
|
2032
|
+
props: {
|
|
2033
|
+
value: {
|
|
2034
|
+
type: String,
|
|
2035
|
+
required: true
|
|
2036
|
+
},
|
|
2037
|
+
active: Boolean,
|
|
2038
|
+
to: [String, Object],
|
|
2039
|
+
icon: [String, Function]
|
|
2040
|
+
},
|
|
2041
|
+
emits: {
|
|
2042
|
+
click: ev => true
|
|
2043
|
+
},
|
|
2044
|
+
|
|
2045
|
+
setup(props, ctx) {
|
|
2046
|
+
const classesRef = computed(() => ({
|
|
2047
|
+
'v-tab--active': props.active
|
|
2048
|
+
}));
|
|
2049
|
+
const exposeValues = {
|
|
2050
|
+
value: props.value,
|
|
2051
|
+
active: props.active
|
|
2052
|
+
};
|
|
2053
|
+
ctx.expose(exposeValues);
|
|
2054
|
+
return () => {
|
|
2055
|
+
const {
|
|
2056
|
+
to,
|
|
2057
|
+
value,
|
|
2058
|
+
icon,
|
|
2059
|
+
active
|
|
2060
|
+
} = props;
|
|
2061
|
+
const classes = ['v-tab', classesRef.value];
|
|
2062
|
+
|
|
2063
|
+
const children = createVNode("span", {
|
|
2064
|
+
"class": "v-tab__content"
|
|
2065
|
+
}, [icon && resolveRawIconProp(active, icon, {
|
|
2066
|
+
class: 'v-tab__icon'
|
|
2067
|
+
}), renderSlotOrEmpty$1(ctx.slots)]);
|
|
2068
|
+
|
|
2069
|
+
if (to) {
|
|
2070
|
+
const replace = typeof to === 'string' ? undefined : to.replace;
|
|
2071
|
+
return createVNode(RouterLink, {
|
|
2072
|
+
"class": classes,
|
|
2073
|
+
"to": to,
|
|
2074
|
+
"replace": replace
|
|
2075
|
+
}, _isSlot$5(children) ? children : {
|
|
2076
|
+
default: () => [children]
|
|
2077
|
+
});
|
|
2078
|
+
} else {
|
|
2079
|
+
return createVNode("button", {
|
|
2080
|
+
"class": classes,
|
|
2081
|
+
"type": "button",
|
|
2082
|
+
"value": value,
|
|
2083
|
+
"onClick": ev => {
|
|
2084
|
+
ctx.emit('click', ev);
|
|
2085
|
+
}
|
|
2086
|
+
}, [children]);
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
});
|
|
2092
|
+
|
|
2093
|
+
function _isSlot$4(s) {
|
|
2094
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
const VTabs = defineComponent({
|
|
2098
|
+
name: 'VTabs',
|
|
2099
|
+
props: {
|
|
2100
|
+
modelValue: String,
|
|
2101
|
+
items: {
|
|
2102
|
+
type: Array,
|
|
2103
|
+
required: true // validator: (value: VTabsItem[]) => {
|
|
2104
|
+
// return Array.isArray(value) && value.length > 0;
|
|
2105
|
+
// },
|
|
2106
|
+
|
|
2107
|
+
},
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* 自動スクロールする際の余剰オフセット幅(px)
|
|
2111
|
+
*/
|
|
2112
|
+
autoScrollOffset: {
|
|
2113
|
+
type: Number,
|
|
2114
|
+
default: 20
|
|
2115
|
+
},
|
|
2116
|
+
|
|
2117
|
+
/**
|
|
2118
|
+
* ルーター同期する場合設定する
|
|
2119
|
+
*/
|
|
2120
|
+
router: Function,
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* ルーティング連携を行う際に、クエリベースのURLマッチングを行う
|
|
2124
|
+
* タブのURLが /page1?tab=xxx のようになる時に設定する
|
|
2125
|
+
*/
|
|
2126
|
+
withQuery: Boolean,
|
|
2127
|
+
...defineSlotsProps$1(),
|
|
2128
|
+
color: String
|
|
2129
|
+
},
|
|
2130
|
+
emits: {
|
|
2131
|
+
'update:modelValue': newValue => true,
|
|
2132
|
+
change: newValue => true
|
|
2133
|
+
},
|
|
2134
|
+
|
|
2135
|
+
setup(props, ctx) {
|
|
2136
|
+
const vui = useVui();
|
|
2137
|
+
const internalValueRef = ref(null);
|
|
2138
|
+
const scrollerRef = useVScrollerRef();
|
|
2139
|
+
const elRef = ref(null);
|
|
2140
|
+
let scrollResult;
|
|
2141
|
+
const tabRefs = ref([]);
|
|
2142
|
+
const currentRef = computed({
|
|
2143
|
+
get: () => internalValueRef.value,
|
|
2144
|
+
set: value => {
|
|
2145
|
+
if (internalValueRef.value !== value) {
|
|
2146
|
+
internalValueRef.value = value;
|
|
2147
|
+
ctx.emit('update:modelValue', value);
|
|
2148
|
+
ctx.emit('change', value);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
const colorScope = useScopeColorClass({
|
|
2153
|
+
color: () => props.color || vui.setting('tabDefault').color
|
|
2154
|
+
});
|
|
2155
|
+
const classes = computed(() => [colorScope.value.className]);
|
|
2156
|
+
const computedItemsRef = computed(() => {
|
|
2157
|
+
const current = currentRef.value;
|
|
2158
|
+
const {
|
|
2159
|
+
router
|
|
2160
|
+
} = props;
|
|
2161
|
+
return props.items.map(item => {
|
|
2162
|
+
const {
|
|
2163
|
+
value
|
|
2164
|
+
} = item;
|
|
2165
|
+
const active = current === value;
|
|
2166
|
+
let location;
|
|
2167
|
+
|
|
2168
|
+
if (router) {
|
|
2169
|
+
const to = router(value);
|
|
2170
|
+
const route = vui.router.resolve(to);
|
|
2171
|
+
location = {
|
|
2172
|
+
to,
|
|
2173
|
+
route
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
return { ...item,
|
|
2178
|
+
active,
|
|
2179
|
+
location
|
|
2180
|
+
};
|
|
2181
|
+
});
|
|
2182
|
+
});
|
|
2183
|
+
|
|
2184
|
+
const setTabRef = ref => {
|
|
2185
|
+
tabRefs.value.push(ref);
|
|
2186
|
+
}; // const isMountedRef = ref(false);
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
function setupInternalValue(routable) {
|
|
2190
|
+
let value = props.modelValue;
|
|
2191
|
+
|
|
2192
|
+
if (value == null || value === '') {
|
|
2193
|
+
const firstItem = props.items[0];
|
|
2194
|
+
if (!firstItem) return;
|
|
2195
|
+
value = firstItem.value;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
if (internalValueRef.value !== value) {
|
|
2199
|
+
internalValueRef.value = value;
|
|
2200
|
+
|
|
2201
|
+
if (routable) {
|
|
2202
|
+
const {
|
|
2203
|
+
router
|
|
2204
|
+
} = props;
|
|
2205
|
+
if (!router) return;
|
|
2206
|
+
const hit = computedItemsRef.value.find(item => item.value === value);
|
|
2207
|
+
if (!hit) return;
|
|
2208
|
+
const {
|
|
2209
|
+
location
|
|
2210
|
+
} = hit;
|
|
2211
|
+
if (!location) return;
|
|
2212
|
+
const {
|
|
2213
|
+
to,
|
|
2214
|
+
route
|
|
2215
|
+
} = location;
|
|
2216
|
+
if (route.fullPath === vui.location.currentRoute.fullPath) return;
|
|
2217
|
+
vui.router[to.replace ? 'replace' : 'push'](to);
|
|
2218
|
+
} else if (!props.router && props.modelValue !== value) {
|
|
2219
|
+
ctx.emit('update:modelValue', value);
|
|
2220
|
+
ctx.emit('change', value);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
function to(value) {
|
|
2226
|
+
currentRef.value = value;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
function cancelScroll() {
|
|
2230
|
+
if (scrollResult) {
|
|
2231
|
+
scrollResult.cancel();
|
|
2232
|
+
scrollResult = undefined;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
const findTab = tab => {
|
|
2237
|
+
return tabRefs.value.find(t => t.value === tab);
|
|
2238
|
+
};
|
|
2239
|
+
|
|
2240
|
+
function scrollToTab(tabValue) {
|
|
2241
|
+
const tab = findTab(tabValue);
|
|
2242
|
+
if (!tab) return;
|
|
2243
|
+
const $tab = tab.$el;
|
|
2244
|
+
if (!$tab) return;
|
|
2245
|
+
const scroller = scrollerRef.value;
|
|
2246
|
+
if (!scroller) return;
|
|
2247
|
+
const container = scroller.scroller.element();
|
|
2248
|
+
if (!container) return;
|
|
2249
|
+
const {
|
|
2250
|
+
autoScrollOffset
|
|
2251
|
+
} = props;
|
|
2252
|
+
const tabLeft = $tab.offsetLeft;
|
|
2253
|
+
const tabWidth = $tab.offsetWidth;
|
|
2254
|
+
const tabRight = tabLeft + tabWidth;
|
|
2255
|
+
let hiddenLeft = 0;
|
|
2256
|
+
let hiddenRight = 0;
|
|
2257
|
+
const {
|
|
2258
|
+
scrollLeft,
|
|
2259
|
+
offsetWidth: scrollerWidth
|
|
2260
|
+
} = container;
|
|
2261
|
+
hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
|
|
2262
|
+
hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
|
|
2263
|
+
if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
|
|
2264
|
+
if (hiddenRight > 0) hiddenRight += autoScrollOffset;
|
|
2265
|
+
let scrollAmmount = 0;
|
|
2266
|
+
|
|
2267
|
+
if (hiddenRight > 0) {
|
|
2268
|
+
scrollAmmount = hiddenRight;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
if (hiddenLeft > 0) {
|
|
2272
|
+
scrollAmmount = -hiddenLeft;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
if (Math.abs(scrollAmmount) > 0) {
|
|
2276
|
+
cancelScroll();
|
|
2277
|
+
scrollResult = scroller.scroller.by(scrollAmmount, 0, {
|
|
2278
|
+
duration: 150
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
watch(() => props.modelValue, () => setupInternalValue(true));
|
|
2284
|
+
watch(() => props.items, () => setupInternalValue(), {
|
|
2285
|
+
deep: true
|
|
2286
|
+
});
|
|
2287
|
+
watch(() => internalValueRef.value, newValue => {
|
|
2288
|
+
scrollToTab(newValue);
|
|
2289
|
+
});
|
|
2290
|
+
vui.location.watchRoute(route => {
|
|
2291
|
+
if (!props.router) return;
|
|
2292
|
+
const path = props.withQuery ? route.fullPath : route.path;
|
|
2293
|
+
const hit = computedItemsRef.value.find(({
|
|
2294
|
+
location
|
|
2295
|
+
}) => {
|
|
2296
|
+
return location && location.route.fullPath === path;
|
|
2297
|
+
});
|
|
2298
|
+
|
|
2299
|
+
if (hit) {
|
|
2300
|
+
currentRef.value = hit.value;
|
|
2301
|
+
}
|
|
2302
|
+
}, {
|
|
2303
|
+
immediate: true
|
|
2304
|
+
});
|
|
2305
|
+
onMounted(() => {
|
|
2306
|
+
scrollToTab(currentRef.value);
|
|
2307
|
+
});
|
|
2308
|
+
onBeforeUnmount(() => {
|
|
2309
|
+
cancelScroll();
|
|
2310
|
+
});
|
|
2311
|
+
onBeforeUpdate(() => {
|
|
2312
|
+
tabRefs.value = [];
|
|
2313
|
+
});
|
|
2314
|
+
setupInternalValue();
|
|
2315
|
+
return () => {
|
|
2316
|
+
const items = computedItemsRef.value;
|
|
2317
|
+
const itemSlot = ctx.slots.item;
|
|
2318
|
+
const children = items.map(({
|
|
2319
|
+
value,
|
|
2320
|
+
active,
|
|
2321
|
+
label,
|
|
2322
|
+
icon,
|
|
2323
|
+
location
|
|
2324
|
+
}) => {
|
|
2325
|
+
if (!label) {
|
|
2326
|
+
label = itemSlot;
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
const children = typeof label === 'function' ? label({
|
|
2330
|
+
value,
|
|
2331
|
+
active,
|
|
2332
|
+
vui
|
|
2333
|
+
}) : label;
|
|
2334
|
+
|
|
2335
|
+
const _to = location && location.to || undefined;
|
|
2336
|
+
|
|
2337
|
+
return createVNode(VTab, {
|
|
2338
|
+
"value": value,
|
|
2339
|
+
"to": _to,
|
|
2340
|
+
"icon": icon,
|
|
2341
|
+
"active": active,
|
|
2342
|
+
"ref": setTabRef,
|
|
2343
|
+
"onClick": e => {
|
|
2344
|
+
if (!e.defaultPrevented) {
|
|
2345
|
+
to(value);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
}, _isSlot$4(children) ? children : {
|
|
2349
|
+
default: () => [children]
|
|
2350
|
+
});
|
|
2351
|
+
});
|
|
2352
|
+
return createVNode("div", {
|
|
2353
|
+
"class": ['v-tabs', classes.value],
|
|
2354
|
+
"ref": elRef
|
|
2355
|
+
}, [createVNode(VScroller, {
|
|
2356
|
+
"class": "v-tabs__scroller",
|
|
2357
|
+
"containerClass": "v-tabs__scroller__container",
|
|
2358
|
+
"guide": true,
|
|
2359
|
+
"ref": scrollerRef
|
|
2360
|
+
}, {
|
|
2361
|
+
default: () => [createVNode("div", {
|
|
2362
|
+
"class": "v-tabs__content"
|
|
2363
|
+
}, [children])]
|
|
2364
|
+
})]);
|
|
2365
|
+
};
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
});
|
|
2369
|
+
|
|
2370
|
+
function _isSlot$3(s) {
|
|
2371
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
const VContentSwitcher = defineComponent({
|
|
2375
|
+
name: 'VContentSwitcher',
|
|
2376
|
+
props: {
|
|
2377
|
+
modelValue: String,
|
|
2378
|
+
order: {
|
|
2379
|
+
type: Array,
|
|
2380
|
+
default: () => []
|
|
2381
|
+
},
|
|
2382
|
+
autotop: [Boolean, Object]
|
|
2383
|
+
},
|
|
2384
|
+
emits: {
|
|
2385
|
+
'update:modelValue': modelValue => true
|
|
2386
|
+
},
|
|
2387
|
+
|
|
2388
|
+
setup(props, ctx) {
|
|
2389
|
+
const internalValueRef = ref('');
|
|
2390
|
+
const transitionRef = ref('');
|
|
2391
|
+
const elRef = ref(null);
|
|
2392
|
+
const anchorRef = ref(null);
|
|
2393
|
+
const computedOrderRef = computed(() => props.order.map(row => {
|
|
2394
|
+
return typeof row === 'string' ? row : row.value;
|
|
2395
|
+
}));
|
|
2396
|
+
const currentRef = computed({
|
|
2397
|
+
get: () => internalValueRef.value,
|
|
2398
|
+
set: current => {
|
|
2399
|
+
if (internalValueRef.value !== current) {
|
|
2400
|
+
internalValueRef.value = current;
|
|
2401
|
+
ctx.emit('update:modelValue', current);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
});
|
|
2405
|
+
const autotopSettingsRef = computed(() => {
|
|
2406
|
+
let {
|
|
2407
|
+
autotop: settings
|
|
2408
|
+
} = props;
|
|
2409
|
+
if (settings === true) settings = {};
|
|
2410
|
+
if (!settings) return;
|
|
2411
|
+
return { ...settings
|
|
2412
|
+
};
|
|
2413
|
+
});
|
|
2414
|
+
|
|
2415
|
+
function seeTop(options) {
|
|
2416
|
+
const scoller = getDocumentScroller$1();
|
|
2417
|
+
const {
|
|
2418
|
+
value: anchor
|
|
2419
|
+
} = anchorRef;
|
|
2420
|
+
|
|
2421
|
+
if (anchor) {
|
|
2422
|
+
scoller.toElement(anchor, options);
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
function getEl() {
|
|
2427
|
+
const el = elRef.value;
|
|
2428
|
+
|
|
2429
|
+
if (!el) {
|
|
2430
|
+
throw new Error('missing element');
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
return el;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
watch(() => props.modelValue, (value, beforeValue) => {
|
|
2437
|
+
if (value == null) return;
|
|
2438
|
+
internalValueRef.value = value;
|
|
2439
|
+
if (beforeValue == null) return;
|
|
2440
|
+
const order = computedOrderRef.value;
|
|
2441
|
+
const index = order.indexOf(value);
|
|
2442
|
+
const beforeIndex = order.indexOf(beforeValue);
|
|
2443
|
+
let transition = 'fade';
|
|
2444
|
+
|
|
2445
|
+
if (index !== -1 && beforeIndex !== -1) {
|
|
2446
|
+
if (index > beforeIndex) transition = 'v-content-switcher-next';
|
|
2447
|
+
if (index < beforeIndex) transition = 'v-content-switcher-prev';
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
transitionRef.value = transition;
|
|
2451
|
+
}, {
|
|
2452
|
+
immediate: true
|
|
2453
|
+
});
|
|
2454
|
+
watch(currentRef, () => {
|
|
2455
|
+
const autotopSettings = autotopSettingsRef.value;
|
|
2456
|
+
|
|
2457
|
+
if (autotopSettings && props.modelValue != null) {
|
|
2458
|
+
seeTop(autotopSettings);
|
|
2459
|
+
}
|
|
2460
|
+
});
|
|
2461
|
+
return () => {
|
|
2462
|
+
const current = currentRef.value;
|
|
2463
|
+
const children = renderSlotOrEmpty$1(ctx.slots) || [];
|
|
2464
|
+
const currentSlot = ctx.slots[current];
|
|
2465
|
+
|
|
2466
|
+
if (currentSlot) {
|
|
2467
|
+
children.push(createVNode("div", {
|
|
2468
|
+
"class": "v-content-switcher__content",
|
|
2469
|
+
"key": current
|
|
2470
|
+
}, [currentSlot(this)]));
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
return createVNode("div", {
|
|
2474
|
+
"class": "v-content-switcher",
|
|
2475
|
+
"ref": elRef
|
|
2476
|
+
}, [createVNode("div", {
|
|
2477
|
+
"class": "v-content-switcher__anchor",
|
|
2478
|
+
"ref": anchorRef
|
|
2479
|
+
}, null), createVNode(Transition, {
|
|
2480
|
+
"name": transitionRef.value,
|
|
2481
|
+
"onBeforeLeave": el => {
|
|
2482
|
+
getEl().style.height = el.offsetHeight + 'px';
|
|
2483
|
+
},
|
|
2484
|
+
"onEnter": el => {
|
|
2485
|
+
getEl().style.height = el.offsetHeight + 'px';
|
|
2486
|
+
},
|
|
2487
|
+
"onAfterEnter": () => {
|
|
2488
|
+
getEl().style.height = '';
|
|
2489
|
+
},
|
|
2490
|
+
"onEnterCancelled": () => {
|
|
2491
|
+
getEl().style.height = '';
|
|
2492
|
+
},
|
|
2493
|
+
"onLeaveCancelled": () => {
|
|
2494
|
+
getEl().style.height = '';
|
|
2495
|
+
}
|
|
2496
|
+
}, _isSlot$3(children) ? children : {
|
|
2497
|
+
default: () => [children]
|
|
2498
|
+
})]);
|
|
2499
|
+
};
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
});
|
|
2503
|
+
|
|
2025
2504
|
const DATA_TABLE_DEFAULTS = {
|
|
2026
2505
|
itemKey: 'id',
|
|
2027
2506
|
pageQuery: 'page',
|
|
@@ -2880,4 +3359,4 @@ function installVuiPlugin(app, opts) {
|
|
|
2880
3359
|
return app.use(VuiPlugin, opts);
|
|
2881
3360
|
}
|
|
2882
3361
|
|
|
2883
|
-
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VDataTable, VDrawerLayout, VForm, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
|
3362
|
+
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|