@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/tool/index.js
CHANGED
|
@@ -26,6 +26,7 @@ const TEMPLATE = `
|
|
|
26
26
|
import '@fastkit/vue-stack/dist/vue-stack.css';
|
|
27
27
|
import '@fastkit/vue-app-layout/dist/vue-app-layout.css';
|
|
28
28
|
import '@fastkit/vue-loading/dist/vue-loading.css';
|
|
29
|
+
import '@fastkit/vue-scroller/dist/vue-scroller.css';
|
|
29
30
|
import '@fastkit/vui/dist/vui.css';
|
|
30
31
|
<% } %>
|
|
31
32
|
import './setup.scss';
|
|
@@ -94,6 +95,9 @@ function viteVuiPlugin(options = {}) {
|
|
|
94
95
|
color: 'base',
|
|
95
96
|
variant: 'contained',
|
|
96
97
|
},
|
|
98
|
+
tabDefault: {
|
|
99
|
+
color: 'accent',
|
|
100
|
+
},
|
|
97
101
|
dialogOk: {
|
|
98
102
|
color: 'primary',
|
|
99
103
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vui/src/tool/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAK9B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vui/src/tool/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAK9B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAsF/C,MAAM,WAAW,oBACf,SAAQ,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,CAAC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAGD,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,OAAO,CAAC;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,aAAa,CAC3B,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CA6IrB"}
|
package/dist/vui.cjs.js
CHANGED
|
@@ -11,6 +11,7 @@ var iconFont = require('@fastkit/icon-font');
|
|
|
11
11
|
var helpers = require('@fastkit/helpers');
|
|
12
12
|
var vueRouter = require('vue-router');
|
|
13
13
|
var vueAppLayout = require('@fastkit/vue-app-layout');
|
|
14
|
+
var vueScroller = require('@fastkit/vue-scroller');
|
|
14
15
|
|
|
15
16
|
const CONTROL_SIZES = ['sm', 'md', 'lg'];
|
|
16
17
|
const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
|
|
@@ -534,7 +535,7 @@ const VButton = vue.defineComponent({
|
|
|
534
535
|
|
|
535
536
|
});
|
|
536
537
|
|
|
537
|
-
function _isSlot$
|
|
538
|
+
function _isSlot$b(s) {
|
|
538
539
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
539
540
|
}
|
|
540
541
|
|
|
@@ -782,7 +783,7 @@ const VPagination = vue.defineComponent({
|
|
|
782
783
|
"class": classes,
|
|
783
784
|
"to": to,
|
|
784
785
|
"key": key
|
|
785
|
-
}, _isSlot$
|
|
786
|
+
}, _isSlot$b(children) ? children : {
|
|
786
787
|
default: () => [children]
|
|
787
788
|
});
|
|
788
789
|
} else {
|
|
@@ -947,7 +948,7 @@ const VDrawerLayout = vue.defineComponent({
|
|
|
947
948
|
|
|
948
949
|
});
|
|
949
950
|
|
|
950
|
-
function _isSlot$
|
|
951
|
+
function _isSlot$a(s) {
|
|
951
952
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
952
953
|
}
|
|
953
954
|
|
|
@@ -982,7 +983,7 @@ const VHero = vue.defineComponent({
|
|
|
982
983
|
}, {
|
|
983
984
|
default: () => [vue.createVNode(HTagName, {
|
|
984
985
|
"class": "v-hero__title"
|
|
985
|
-
}, _isSlot$
|
|
986
|
+
}, _isSlot$a(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
|
|
986
987
|
default: () => [_slot]
|
|
987
988
|
})]
|
|
988
989
|
})]
|
|
@@ -992,7 +993,7 @@ const VHero = vue.defineComponent({
|
|
|
992
993
|
|
|
993
994
|
});
|
|
994
995
|
|
|
995
|
-
function _isSlot$
|
|
996
|
+
function _isSlot$9(s) {
|
|
996
997
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
997
998
|
}
|
|
998
999
|
|
|
@@ -1023,7 +1024,7 @@ function renderNavigationItemInput(input, extraProps) {
|
|
|
1023
1024
|
} = resolveNavigationItemInput(input);
|
|
1024
1025
|
return vue.createVNode(VNavigationItem, { ...props,
|
|
1025
1026
|
...extraProps
|
|
1026
|
-
}, _isSlot$
|
|
1027
|
+
}, _isSlot$9(label) ? label : {
|
|
1027
1028
|
default: () => [label]
|
|
1028
1029
|
});
|
|
1029
1030
|
}
|
|
@@ -1167,7 +1168,7 @@ const VNavigationItem = vue.defineComponent({
|
|
|
1167
1168
|
"class": ['v-navigation-item', classes.value],
|
|
1168
1169
|
"onClick": onClick,
|
|
1169
1170
|
"onChangeActive": onChangeActive
|
|
1170
|
-
}), _isSlot$
|
|
1171
|
+
}), _isSlot$9(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
|
|
1171
1172
|
default: () => [_slot]
|
|
1172
1173
|
}), _children && vue.createVNode(vueUtils.VExpandTransition, null, {
|
|
1173
1174
|
default: () => [vue.withDirectives(vue.createVNode("div", {
|
|
@@ -1315,7 +1316,7 @@ const VCheckbox = vue.defineComponent({
|
|
|
1315
1316
|
|
|
1316
1317
|
});
|
|
1317
1318
|
|
|
1318
|
-
function _isSlot$
|
|
1319
|
+
function _isSlot$8(s) {
|
|
1319
1320
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
1320
1321
|
}
|
|
1321
1322
|
|
|
@@ -1327,7 +1328,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
|
|
|
1327
1328
|
itemRenderer: ({
|
|
1328
1329
|
attrs,
|
|
1329
1330
|
slots
|
|
1330
|
-
}) => vue.createVNode(VCheckbox, attrs, _isSlot$
|
|
1331
|
+
}) => vue.createVNode(VCheckbox, attrs, _isSlot$8(slots) ? slots : {
|
|
1331
1332
|
default: () => [slots]
|
|
1332
1333
|
})
|
|
1333
1334
|
});
|
|
@@ -1379,7 +1380,7 @@ const VRadio = vue.defineComponent({
|
|
|
1379
1380
|
|
|
1380
1381
|
});
|
|
1381
1382
|
|
|
1382
|
-
function _isSlot$
|
|
1383
|
+
function _isSlot$7(s) {
|
|
1383
1384
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
1384
1385
|
}
|
|
1385
1386
|
|
|
@@ -1390,7 +1391,7 @@ const VRadioGroup = defineFormSelectorComponent({
|
|
|
1390
1391
|
itemRenderer: ({
|
|
1391
1392
|
attrs,
|
|
1392
1393
|
slots
|
|
1393
|
-
}) => vue.createVNode(VRadio, attrs, _isSlot$
|
|
1394
|
+
}) => vue.createVNode(VRadio, attrs, _isSlot$7(slots) ? slots : {
|
|
1394
1395
|
default: () => [slots]
|
|
1395
1396
|
})
|
|
1396
1397
|
});
|
|
@@ -1452,7 +1453,7 @@ const VSwitch = vue.defineComponent({
|
|
|
1452
1453
|
|
|
1453
1454
|
});
|
|
1454
1455
|
|
|
1455
|
-
function _isSlot$
|
|
1456
|
+
function _isSlot$6(s) {
|
|
1456
1457
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
1457
1458
|
}
|
|
1458
1459
|
|
|
@@ -1464,7 +1465,7 @@ const VSwitchGroup = defineFormSelectorComponent({
|
|
|
1464
1465
|
itemRenderer: ({
|
|
1465
1466
|
attrs,
|
|
1466
1467
|
slots
|
|
1467
|
-
}) => vue.createVNode(VSwitch, attrs, _isSlot$
|
|
1468
|
+
}) => vue.createVNode(VSwitch, attrs, _isSlot$6(slots) ? slots : {
|
|
1468
1469
|
default: () => [slots]
|
|
1469
1470
|
})
|
|
1470
1471
|
});
|
|
@@ -2023,6 +2024,484 @@ const VForm = vue.defineComponent({
|
|
|
2023
2024
|
|
|
2024
2025
|
});
|
|
2025
2026
|
|
|
2027
|
+
function _isSlot$5(s) {
|
|
2028
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
const VTab = vue.defineComponent({
|
|
2032
|
+
name: 'VTab',
|
|
2033
|
+
props: {
|
|
2034
|
+
value: {
|
|
2035
|
+
type: String,
|
|
2036
|
+
required: true
|
|
2037
|
+
},
|
|
2038
|
+
active: Boolean,
|
|
2039
|
+
to: [String, Object],
|
|
2040
|
+
icon: [String, Function]
|
|
2041
|
+
},
|
|
2042
|
+
emits: {
|
|
2043
|
+
click: ev => true
|
|
2044
|
+
},
|
|
2045
|
+
|
|
2046
|
+
setup(props, ctx) {
|
|
2047
|
+
const classesRef = vue.computed(() => ({
|
|
2048
|
+
'v-tab--active': props.active
|
|
2049
|
+
}));
|
|
2050
|
+
const exposeValues = {
|
|
2051
|
+
value: props.value,
|
|
2052
|
+
active: props.active
|
|
2053
|
+
};
|
|
2054
|
+
ctx.expose(exposeValues);
|
|
2055
|
+
return () => {
|
|
2056
|
+
const {
|
|
2057
|
+
to,
|
|
2058
|
+
value,
|
|
2059
|
+
icon,
|
|
2060
|
+
active
|
|
2061
|
+
} = props;
|
|
2062
|
+
const classes = ['v-tab', classesRef.value];
|
|
2063
|
+
|
|
2064
|
+
const children = vue.createVNode("span", {
|
|
2065
|
+
"class": "v-tab__content"
|
|
2066
|
+
}, [icon && resolveRawIconProp(active, icon, {
|
|
2067
|
+
class: 'v-tab__icon'
|
|
2068
|
+
}), vueUtils.renderSlotOrEmpty(ctx.slots)]);
|
|
2069
|
+
|
|
2070
|
+
if (to) {
|
|
2071
|
+
const replace = typeof to === 'string' ? undefined : to.replace;
|
|
2072
|
+
return vue.createVNode(vueRouter.RouterLink, {
|
|
2073
|
+
"class": classes,
|
|
2074
|
+
"to": to,
|
|
2075
|
+
"replace": replace
|
|
2076
|
+
}, _isSlot$5(children) ? children : {
|
|
2077
|
+
default: () => [children]
|
|
2078
|
+
});
|
|
2079
|
+
} else {
|
|
2080
|
+
return vue.createVNode("button", {
|
|
2081
|
+
"class": classes,
|
|
2082
|
+
"type": "button",
|
|
2083
|
+
"value": value,
|
|
2084
|
+
"onClick": ev => {
|
|
2085
|
+
ctx.emit('click', ev);
|
|
2086
|
+
}
|
|
2087
|
+
}, [children]);
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
});
|
|
2093
|
+
|
|
2094
|
+
function _isSlot$4(s) {
|
|
2095
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
const VTabs = vue.defineComponent({
|
|
2099
|
+
name: 'VTabs',
|
|
2100
|
+
props: {
|
|
2101
|
+
modelValue: String,
|
|
2102
|
+
items: {
|
|
2103
|
+
type: Array,
|
|
2104
|
+
required: true // validator: (value: VTabsItem[]) => {
|
|
2105
|
+
// return Array.isArray(value) && value.length > 0;
|
|
2106
|
+
// },
|
|
2107
|
+
|
|
2108
|
+
},
|
|
2109
|
+
|
|
2110
|
+
/**
|
|
2111
|
+
* 自動スクロールする際の余剰オフセット幅(px)
|
|
2112
|
+
*/
|
|
2113
|
+
autoScrollOffset: {
|
|
2114
|
+
type: Number,
|
|
2115
|
+
default: 20
|
|
2116
|
+
},
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* ルーター同期する場合設定する
|
|
2120
|
+
*/
|
|
2121
|
+
router: Function,
|
|
2122
|
+
|
|
2123
|
+
/**
|
|
2124
|
+
* ルーティング連携を行う際に、クエリベースのURLマッチングを行う
|
|
2125
|
+
* タブのURLが /page1?tab=xxx のようになる時に設定する
|
|
2126
|
+
*/
|
|
2127
|
+
withQuery: Boolean,
|
|
2128
|
+
...vueUtils.defineSlotsProps(),
|
|
2129
|
+
color: String
|
|
2130
|
+
},
|
|
2131
|
+
emits: {
|
|
2132
|
+
'update:modelValue': newValue => true,
|
|
2133
|
+
change: newValue => true
|
|
2134
|
+
},
|
|
2135
|
+
|
|
2136
|
+
setup(props, ctx) {
|
|
2137
|
+
const vui = useVui();
|
|
2138
|
+
const internalValueRef = vue.ref(null);
|
|
2139
|
+
const scrollerRef = vueKit.useVScrollerRef();
|
|
2140
|
+
const elRef = vue.ref(null);
|
|
2141
|
+
let scrollResult;
|
|
2142
|
+
const tabRefs = vue.ref([]);
|
|
2143
|
+
const currentRef = vue.computed({
|
|
2144
|
+
get: () => internalValueRef.value,
|
|
2145
|
+
set: value => {
|
|
2146
|
+
if (internalValueRef.value !== value) {
|
|
2147
|
+
internalValueRef.value = value;
|
|
2148
|
+
ctx.emit('update:modelValue', value);
|
|
2149
|
+
ctx.emit('change', value);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
const colorScope = vueColorScheme.useScopeColorClass({
|
|
2154
|
+
color: () => props.color || vui.setting('tabDefault').color
|
|
2155
|
+
});
|
|
2156
|
+
const classes = vue.computed(() => [colorScope.value.className]);
|
|
2157
|
+
const computedItemsRef = vue.computed(() => {
|
|
2158
|
+
const current = currentRef.value;
|
|
2159
|
+
const {
|
|
2160
|
+
router
|
|
2161
|
+
} = props;
|
|
2162
|
+
return props.items.map(item => {
|
|
2163
|
+
const {
|
|
2164
|
+
value
|
|
2165
|
+
} = item;
|
|
2166
|
+
const active = current === value;
|
|
2167
|
+
let location;
|
|
2168
|
+
|
|
2169
|
+
if (router) {
|
|
2170
|
+
const to = router(value);
|
|
2171
|
+
const route = vui.router.resolve(to);
|
|
2172
|
+
location = {
|
|
2173
|
+
to,
|
|
2174
|
+
route
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
return { ...item,
|
|
2179
|
+
active,
|
|
2180
|
+
location
|
|
2181
|
+
};
|
|
2182
|
+
});
|
|
2183
|
+
});
|
|
2184
|
+
|
|
2185
|
+
const setTabRef = ref => {
|
|
2186
|
+
tabRefs.value.push(ref);
|
|
2187
|
+
}; // const isMountedRef = ref(false);
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
function setupInternalValue(routable) {
|
|
2191
|
+
let value = props.modelValue;
|
|
2192
|
+
|
|
2193
|
+
if (value == null || value === '') {
|
|
2194
|
+
const firstItem = props.items[0];
|
|
2195
|
+
if (!firstItem) return;
|
|
2196
|
+
value = firstItem.value;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
if (internalValueRef.value !== value) {
|
|
2200
|
+
internalValueRef.value = value;
|
|
2201
|
+
|
|
2202
|
+
if (routable) {
|
|
2203
|
+
const {
|
|
2204
|
+
router
|
|
2205
|
+
} = props;
|
|
2206
|
+
if (!router) return;
|
|
2207
|
+
const hit = computedItemsRef.value.find(item => item.value === value);
|
|
2208
|
+
if (!hit) return;
|
|
2209
|
+
const {
|
|
2210
|
+
location
|
|
2211
|
+
} = hit;
|
|
2212
|
+
if (!location) return;
|
|
2213
|
+
const {
|
|
2214
|
+
to,
|
|
2215
|
+
route
|
|
2216
|
+
} = location;
|
|
2217
|
+
if (route.fullPath === vui.location.currentRoute.fullPath) return;
|
|
2218
|
+
vui.router[to.replace ? 'replace' : 'push'](to);
|
|
2219
|
+
} else if (!props.router && props.modelValue !== value) {
|
|
2220
|
+
ctx.emit('update:modelValue', value);
|
|
2221
|
+
ctx.emit('change', value);
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
function to(value) {
|
|
2227
|
+
currentRef.value = value;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
function cancelScroll() {
|
|
2231
|
+
if (scrollResult) {
|
|
2232
|
+
scrollResult.cancel();
|
|
2233
|
+
scrollResult = undefined;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
const findTab = tab => {
|
|
2238
|
+
return tabRefs.value.find(t => t.value === tab);
|
|
2239
|
+
};
|
|
2240
|
+
|
|
2241
|
+
function scrollToTab(tabValue) {
|
|
2242
|
+
const tab = findTab(tabValue);
|
|
2243
|
+
if (!tab) return;
|
|
2244
|
+
const $tab = tab.$el;
|
|
2245
|
+
if (!$tab) return;
|
|
2246
|
+
const scroller = scrollerRef.value;
|
|
2247
|
+
if (!scroller) return;
|
|
2248
|
+
const container = scroller.scroller.element();
|
|
2249
|
+
if (!container) return;
|
|
2250
|
+
const {
|
|
2251
|
+
autoScrollOffset
|
|
2252
|
+
} = props;
|
|
2253
|
+
const tabLeft = $tab.offsetLeft;
|
|
2254
|
+
const tabWidth = $tab.offsetWidth;
|
|
2255
|
+
const tabRight = tabLeft + tabWidth;
|
|
2256
|
+
let hiddenLeft = 0;
|
|
2257
|
+
let hiddenRight = 0;
|
|
2258
|
+
const {
|
|
2259
|
+
scrollLeft,
|
|
2260
|
+
offsetWidth: scrollerWidth
|
|
2261
|
+
} = container;
|
|
2262
|
+
hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
|
|
2263
|
+
hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
|
|
2264
|
+
if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
|
|
2265
|
+
if (hiddenRight > 0) hiddenRight += autoScrollOffset;
|
|
2266
|
+
let scrollAmmount = 0;
|
|
2267
|
+
|
|
2268
|
+
if (hiddenRight > 0) {
|
|
2269
|
+
scrollAmmount = hiddenRight;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
if (hiddenLeft > 0) {
|
|
2273
|
+
scrollAmmount = -hiddenLeft;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
if (Math.abs(scrollAmmount) > 0) {
|
|
2277
|
+
cancelScroll();
|
|
2278
|
+
scrollResult = scroller.scroller.by(scrollAmmount, 0, {
|
|
2279
|
+
duration: 150
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
vue.watch(() => props.modelValue, () => setupInternalValue(true));
|
|
2285
|
+
vue.watch(() => props.items, () => setupInternalValue(), {
|
|
2286
|
+
deep: true
|
|
2287
|
+
});
|
|
2288
|
+
vue.watch(() => internalValueRef.value, newValue => {
|
|
2289
|
+
scrollToTab(newValue);
|
|
2290
|
+
});
|
|
2291
|
+
vui.location.watchRoute(route => {
|
|
2292
|
+
if (!props.router) return;
|
|
2293
|
+
const path = props.withQuery ? route.fullPath : route.path;
|
|
2294
|
+
const hit = computedItemsRef.value.find(({
|
|
2295
|
+
location
|
|
2296
|
+
}) => {
|
|
2297
|
+
return location && location.route.fullPath === path;
|
|
2298
|
+
});
|
|
2299
|
+
|
|
2300
|
+
if (hit) {
|
|
2301
|
+
currentRef.value = hit.value;
|
|
2302
|
+
}
|
|
2303
|
+
}, {
|
|
2304
|
+
immediate: true
|
|
2305
|
+
});
|
|
2306
|
+
vue.onMounted(() => {
|
|
2307
|
+
scrollToTab(currentRef.value);
|
|
2308
|
+
});
|
|
2309
|
+
vue.onBeforeUnmount(() => {
|
|
2310
|
+
cancelScroll();
|
|
2311
|
+
});
|
|
2312
|
+
vue.onBeforeUpdate(() => {
|
|
2313
|
+
tabRefs.value = [];
|
|
2314
|
+
});
|
|
2315
|
+
setupInternalValue();
|
|
2316
|
+
return () => {
|
|
2317
|
+
const items = computedItemsRef.value;
|
|
2318
|
+
const itemSlot = ctx.slots.item;
|
|
2319
|
+
const children = items.map(({
|
|
2320
|
+
value,
|
|
2321
|
+
active,
|
|
2322
|
+
label,
|
|
2323
|
+
icon,
|
|
2324
|
+
location
|
|
2325
|
+
}) => {
|
|
2326
|
+
if (!label) {
|
|
2327
|
+
label = itemSlot;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
const children = typeof label === 'function' ? label({
|
|
2331
|
+
value,
|
|
2332
|
+
active,
|
|
2333
|
+
vui
|
|
2334
|
+
}) : label;
|
|
2335
|
+
|
|
2336
|
+
const _to = location && location.to || undefined;
|
|
2337
|
+
|
|
2338
|
+
return vue.createVNode(VTab, {
|
|
2339
|
+
"value": value,
|
|
2340
|
+
"to": _to,
|
|
2341
|
+
"icon": icon,
|
|
2342
|
+
"active": active,
|
|
2343
|
+
"ref": setTabRef,
|
|
2344
|
+
"onClick": e => {
|
|
2345
|
+
if (!e.defaultPrevented) {
|
|
2346
|
+
to(value);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
}, _isSlot$4(children) ? children : {
|
|
2350
|
+
default: () => [children]
|
|
2351
|
+
});
|
|
2352
|
+
});
|
|
2353
|
+
return vue.createVNode("div", {
|
|
2354
|
+
"class": ['v-tabs', classes.value],
|
|
2355
|
+
"ref": elRef
|
|
2356
|
+
}, [vue.createVNode(vueKit.VScroller, {
|
|
2357
|
+
"class": "v-tabs__scroller",
|
|
2358
|
+
"containerClass": "v-tabs__scroller__container",
|
|
2359
|
+
"guide": true,
|
|
2360
|
+
"ref": scrollerRef
|
|
2361
|
+
}, {
|
|
2362
|
+
default: () => [vue.createVNode("div", {
|
|
2363
|
+
"class": "v-tabs__content"
|
|
2364
|
+
}, [children])]
|
|
2365
|
+
})]);
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
});
|
|
2370
|
+
|
|
2371
|
+
function _isSlot$3(s) {
|
|
2372
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
const VContentSwitcher = vue.defineComponent({
|
|
2376
|
+
name: 'VContentSwitcher',
|
|
2377
|
+
props: {
|
|
2378
|
+
modelValue: String,
|
|
2379
|
+
order: {
|
|
2380
|
+
type: Array,
|
|
2381
|
+
default: () => []
|
|
2382
|
+
},
|
|
2383
|
+
autotop: [Boolean, Object]
|
|
2384
|
+
},
|
|
2385
|
+
emits: {
|
|
2386
|
+
'update:modelValue': modelValue => true
|
|
2387
|
+
},
|
|
2388
|
+
|
|
2389
|
+
setup(props, ctx) {
|
|
2390
|
+
const internalValueRef = vue.ref('');
|
|
2391
|
+
const transitionRef = vue.ref('');
|
|
2392
|
+
const elRef = vue.ref(null);
|
|
2393
|
+
const anchorRef = vue.ref(null);
|
|
2394
|
+
const computedOrderRef = vue.computed(() => props.order.map(row => {
|
|
2395
|
+
return typeof row === 'string' ? row : row.value;
|
|
2396
|
+
}));
|
|
2397
|
+
const currentRef = vue.computed({
|
|
2398
|
+
get: () => internalValueRef.value,
|
|
2399
|
+
set: current => {
|
|
2400
|
+
if (internalValueRef.value !== current) {
|
|
2401
|
+
internalValueRef.value = current;
|
|
2402
|
+
ctx.emit('update:modelValue', current);
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2406
|
+
const autotopSettingsRef = vue.computed(() => {
|
|
2407
|
+
let {
|
|
2408
|
+
autotop: settings
|
|
2409
|
+
} = props;
|
|
2410
|
+
if (settings === true) settings = {};
|
|
2411
|
+
if (!settings) return;
|
|
2412
|
+
return { ...settings
|
|
2413
|
+
};
|
|
2414
|
+
});
|
|
2415
|
+
|
|
2416
|
+
function seeTop(options) {
|
|
2417
|
+
const scoller = vueScroller.getDocumentScroller();
|
|
2418
|
+
const {
|
|
2419
|
+
value: anchor
|
|
2420
|
+
} = anchorRef;
|
|
2421
|
+
|
|
2422
|
+
if (anchor) {
|
|
2423
|
+
scoller.toElement(anchor, options);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
function getEl() {
|
|
2428
|
+
const el = elRef.value;
|
|
2429
|
+
|
|
2430
|
+
if (!el) {
|
|
2431
|
+
throw new Error('missing element');
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
return el;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
vue.watch(() => props.modelValue, (value, beforeValue) => {
|
|
2438
|
+
if (value == null) return;
|
|
2439
|
+
internalValueRef.value = value;
|
|
2440
|
+
if (beforeValue == null) return;
|
|
2441
|
+
const order = computedOrderRef.value;
|
|
2442
|
+
const index = order.indexOf(value);
|
|
2443
|
+
const beforeIndex = order.indexOf(beforeValue);
|
|
2444
|
+
let transition = 'fade';
|
|
2445
|
+
|
|
2446
|
+
if (index !== -1 && beforeIndex !== -1) {
|
|
2447
|
+
if (index > beforeIndex) transition = 'v-content-switcher-next';
|
|
2448
|
+
if (index < beforeIndex) transition = 'v-content-switcher-prev';
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
transitionRef.value = transition;
|
|
2452
|
+
}, {
|
|
2453
|
+
immediate: true
|
|
2454
|
+
});
|
|
2455
|
+
vue.watch(currentRef, () => {
|
|
2456
|
+
const autotopSettings = autotopSettingsRef.value;
|
|
2457
|
+
|
|
2458
|
+
if (autotopSettings && props.modelValue != null) {
|
|
2459
|
+
seeTop(autotopSettings);
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
return () => {
|
|
2463
|
+
const current = currentRef.value;
|
|
2464
|
+
const children = vueUtils.renderSlotOrEmpty(ctx.slots) || [];
|
|
2465
|
+
const currentSlot = ctx.slots[current];
|
|
2466
|
+
|
|
2467
|
+
if (currentSlot) {
|
|
2468
|
+
children.push(vue.createVNode("div", {
|
|
2469
|
+
"class": "v-content-switcher__content",
|
|
2470
|
+
"key": current
|
|
2471
|
+
}, [currentSlot(this)]));
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
return vue.createVNode("div", {
|
|
2475
|
+
"class": "v-content-switcher",
|
|
2476
|
+
"ref": elRef
|
|
2477
|
+
}, [vue.createVNode("div", {
|
|
2478
|
+
"class": "v-content-switcher__anchor",
|
|
2479
|
+
"ref": anchorRef
|
|
2480
|
+
}, null), vue.createVNode(vue.Transition, {
|
|
2481
|
+
"name": transitionRef.value,
|
|
2482
|
+
"onBeforeLeave": el => {
|
|
2483
|
+
getEl().style.height = el.offsetHeight + 'px';
|
|
2484
|
+
},
|
|
2485
|
+
"onEnter": el => {
|
|
2486
|
+
getEl().style.height = el.offsetHeight + 'px';
|
|
2487
|
+
},
|
|
2488
|
+
"onAfterEnter": () => {
|
|
2489
|
+
getEl().style.height = '';
|
|
2490
|
+
},
|
|
2491
|
+
"onEnterCancelled": () => {
|
|
2492
|
+
getEl().style.height = '';
|
|
2493
|
+
},
|
|
2494
|
+
"onLeaveCancelled": () => {
|
|
2495
|
+
getEl().style.height = '';
|
|
2496
|
+
}
|
|
2497
|
+
}, _isSlot$3(children) ? children : {
|
|
2498
|
+
default: () => [children]
|
|
2499
|
+
})]);
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
});
|
|
2504
|
+
|
|
2026
2505
|
const DATA_TABLE_DEFAULTS = {
|
|
2027
2506
|
itemKey: 'id',
|
|
2028
2507
|
pageQuery: 'page',
|
|
@@ -2895,6 +3374,7 @@ exports.VCardActions = VCardActions;
|
|
|
2895
3374
|
exports.VCardContent = VCardContent;
|
|
2896
3375
|
exports.VCheckbox = VCheckbox;
|
|
2897
3376
|
exports.VCheckboxGroup = VCheckboxGroup;
|
|
3377
|
+
exports.VContentSwitcher = VContentSwitcher;
|
|
2898
3378
|
exports.VDataTable = VDataTable;
|
|
2899
3379
|
exports.VDrawerLayout = VDrawerLayout;
|
|
2900
3380
|
exports.VForm = VForm;
|
|
@@ -2912,6 +3392,7 @@ exports.VRadioGroup = VRadioGroup;
|
|
|
2912
3392
|
exports.VSelect = VSelect;
|
|
2913
3393
|
exports.VSwitch = VSwitch;
|
|
2914
3394
|
exports.VSwitchGroup = VSwitchGroup;
|
|
3395
|
+
exports.VTabs = VTabs;
|
|
2915
3396
|
exports.VTextField = VTextField;
|
|
2916
3397
|
exports.VTextarea = VTextarea;
|
|
2917
3398
|
exports.VToolbar = VToolbar;
|