@fastkit/vui 0.6.28 → 0.6.33

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.
@@ -1,15 +1,16 @@
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
- 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';
4
+ import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
5
+ import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableInheritProps, VLink, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
6
+ import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, onMounted, onBeforeUnmount, Transition } from 'vue';
6
7
  import { useScopeColorClass, colorSchemeProps, useColorClasses, toScopeColorClass } from '@fastkit/vue-color-scheme';
7
8
  import { VProgressCircular } from '@fastkit/vue-loading';
8
9
  export * from '@fastkit/vue-loading';
9
10
  export { ICON_NAMES } from '@fastkit/icon-font';
10
11
  import { isPromise } from '@fastkit/helpers';
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'];
@@ -433,7 +434,7 @@ function resolveRawVButtonIcon(raw, type = 'main') {
433
434
  }
434
435
 
435
436
  const vueButtonProps = createPropsOptions$1({ ...colorSchemeProps(),
436
- ...navigationableProps,
437
+ ...navigationableInheritProps,
437
438
  spacer: [Boolean, String],
438
439
  loading: Boolean,
439
440
  rounded: Boolean,
@@ -449,9 +450,8 @@ const LOADING_SIZE_MAP = {
449
450
  };
450
451
  const VButton = defineComponent({
451
452
  name: 'VButton',
453
+ inheritAttrs: false,
452
454
  props: vueButtonProps,
453
- emits: { ...navigationableEmits
454
- },
455
455
 
456
456
  setup(props, ctx) {
457
457
  const vui = useVui();
@@ -477,48 +477,25 @@ const VButton = defineComponent({
477
477
  variant: () => props.variant || (icon.value ? vui.setting('plainVariant') : defaults.variant)
478
478
  });
479
479
  const isPlain = computed(() => color.variant.value.value === vui.setting('plainVariant') && color.color.value.value === defaults.color);
480
- const navigationable = useNavigationable(props);
481
- const isLoading = computed(() => props.loading);
482
- const isDisabled = computed(() => props.disabled);
480
+ const isLoading = computed(() => props.loading); // const isDisabled = computed(() => props.disabled);
481
+
483
482
  const isRounded = computed(() => props.rounded || !!icon.value);
484
483
  const spacer = computed(() => {
485
484
  const _spacer = props.spacer;
486
485
  if (!_spacer) return;
487
486
  return _spacer === true ? 'left' : _spacer;
488
487
  });
489
- const classes = computed(() => [color.colorClasses.value, navigationable.value.classes, spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, {
488
+ const classes = computed(() => [color.colorClasses.value, // navigationable.value.classes,
489
+ spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, {
490
490
  'v-button--loading': isLoading.value,
491
491
  'v-button--icon': !!icon.value,
492
492
  'v-button--rounded': isRounded.value,
493
493
  'v-button--plain': isPlain.value
494
494
  }]);
495
495
  return () => {
496
- const {
497
- Tag,
498
- attrs
499
- } = navigationable.value;
500
- const children = renderSlotOrEmpty$1(ctx.slots, 'default');
501
- const _attrs = { ...attrs
502
- };
503
-
504
- if (isDisabled.value) {
505
- _attrs.disabled = true;
506
- }
507
-
508
- return createVNode(Tag, mergeProps({
496
+ const children = renderSlotOrEmpty$1(ctx.slots);
497
+ return createVNode(VLink, mergeProps(ctx.attrs, {
509
498
  "class": ['v-button', classes.value]
510
- }, _attrs, {
511
- "onClick": ev => {
512
- if (isDisabled.value || isLoading.value) {
513
- ev.preventDefault();
514
-
515
- if (isDisabled.value) {
516
- return;
517
- }
518
- }
519
-
520
- ctx.emit('click', ev);
521
- }
522
499
  }), {
523
500
  default: () => [createVNode("span", {
524
501
  "class": "v-button__content"
@@ -533,7 +510,7 @@ const VButton = defineComponent({
533
510
 
534
511
  });
535
512
 
536
- function _isSlot$8(s) {
513
+ function _isSlot$c(s) {
537
514
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
538
515
  }
539
516
 
@@ -781,7 +758,7 @@ const VPagination = defineComponent({
781
758
  "class": classes,
782
759
  "to": to,
783
760
  "key": key
784
- }, _isSlot$8(children) ? children : {
761
+ }, _isSlot$c(children) ? children : {
785
762
  default: () => [children]
786
763
  });
787
764
  } else {
@@ -828,11 +805,11 @@ const VPagination = defineComponent({
828
805
 
829
806
  function createListTileProps() {
830
807
  const icon = rawIconProp();
831
- return { ...navigationableProps,
808
+ return { ...navigationableInheritProps,
832
809
  ...createPropsOptions$1({
833
810
  startIcon: icon,
834
811
  endIcon: icon,
835
- fallbackTag: {
812
+ linkFallbackTag: {
836
813
  type: String,
837
814
  default: 'div'
838
815
  },
@@ -842,11 +819,12 @@ function createListTileProps() {
842
819
  })
843
820
  };
844
821
  }
845
- const listTileEmits = { ...navigationableEmits,
822
+ const listTileEmits = {
846
823
  changeActive: isActive => true
847
824
  };
848
825
  const VListTile = defineComponent({
849
826
  name: 'VListTile',
827
+ inheritAttrs: false,
850
828
  props: createListTileProps(),
851
829
  emits: { ...listTileEmits
852
830
  },
@@ -862,10 +840,9 @@ const VListTile = defineComponent({
862
840
  return icon;
863
841
  });
864
842
  const endIcon = computed(() => resolveRawIconProp(false, props.endIcon));
865
- const navigationable = useNavigationable(props, () => props.fallbackTag, ctx);
866
- const hasTo = computed(() => !!props.to);
843
+ const hasTo = computed(() => !!ctx.attrs.to);
867
844
  const link = useLink({
868
- to: props.to || ''
845
+ to: ctx.attrs.to || ''
869
846
  });
870
847
  const isActive = computed(() => {
871
848
  if (!hasTo.value) return false;
@@ -875,10 +852,7 @@ const VListTile = defineComponent({
875
852
  const classes = computed(() => {
876
853
  const _color = color.value;
877
854
  const hasColor = !!_color.value;
878
- const _navigationable = navigationable.value;
879
- const clickable = _navigationable.clickable;
880
- return [color.value.className, _navigationable.classes, {
881
- 'v-list-tile--clickable': clickable,
855
+ return [color.value.className, {
882
856
  'v-list-tile--plain': !hasColor,
883
857
  'v-list-tile--has-color': hasColor,
884
858
  'v-list-tile--active': isActive.value
@@ -892,16 +866,9 @@ const VListTile = defineComponent({
892
866
  return () => {
893
867
  const _startIcon = startIcon.value;
894
868
  const _endIcon = endIcon.value;
895
- const {
896
- Tag,
897
- attrs
898
- } = navigationable.value;
899
- return createVNode(Tag, mergeProps({
900
- "class": ['v-list-tile', classes.value]
901
- }, attrs, {
902
- "onClick": ev => {
903
- ctx.emit('click', ev);
904
- }
869
+ return createVNode(VLink, mergeProps(ctx.attrs, {
870
+ "class": ['v-list-tile', classes.value],
871
+ "clickableClassName": "v-list-tile--clickable"
905
872
  }), {
906
873
  default: () => [_startIcon && createVNode("span", {
907
874
  "class": "v-list-tile__icon v-list-tile__icon--start"
@@ -946,7 +913,7 @@ const VDrawerLayout = defineComponent({
946
913
 
947
914
  });
948
915
 
949
- function _isSlot$7(s) {
916
+ function _isSlot$b(s) {
950
917
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
951
918
  }
952
919
 
@@ -981,7 +948,7 @@ const VHero = defineComponent({
981
948
  }, {
982
949
  default: () => [createVNode(HTagName, {
983
950
  "class": "v-hero__title"
984
- }, _isSlot$7(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
951
+ }, _isSlot$b(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
985
952
  default: () => [_slot]
986
953
  })]
987
954
  })]
@@ -991,13 +958,17 @@ const VHero = defineComponent({
991
958
 
992
959
  });
993
960
 
994
- function _isSlot$6(s) {
961
+ function _isSlot$a(s) {
995
962
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
996
963
  }
997
964
 
998
965
  function createNavigationItemProps() {
999
966
  return { ...createListTileProps(),
1000
- match: String
967
+ match: String // key: {
968
+ // type: [String, Number],
969
+ // required: true,
970
+ // },
971
+
1001
972
  };
1002
973
  }
1003
974
  function resolveNavigationItemInput(input) {
@@ -1022,7 +993,7 @@ function renderNavigationItemInput(input, extraProps) {
1022
993
  } = resolveNavigationItemInput(input);
1023
994
  return createVNode(VNavigationItem, { ...props,
1024
995
  ...extraProps
1025
- }, _isSlot$6(label) ? label : {
996
+ }, _isSlot$a(label) ? label : {
1026
997
  default: () => [label]
1027
998
  });
1028
999
  }
@@ -1042,7 +1013,7 @@ const VNavigationItem = defineComponent({
1042
1013
  const c = props.children;
1043
1014
  return c && c.length ? c : undefined;
1044
1015
  });
1045
- const to = computed(() => props.to);
1016
+ const to = computed(() => ctx.attrs.to);
1046
1017
  const match = computed(() => {
1047
1018
  const {
1048
1019
  match,
@@ -1117,6 +1088,7 @@ const VNavigationItem = defineComponent({
1117
1088
  });
1118
1089
 
1119
1090
  function open() {
1091
+ if (!children.value) return;
1120
1092
  opened.value = true;
1121
1093
  }
1122
1094
 
@@ -1130,10 +1102,13 @@ const VNavigationItem = defineComponent({
1130
1102
 
1131
1103
  const onClick = ev => {
1132
1104
  if (!to.value) {
1133
- toggle();
1105
+ return toggle();
1134
1106
  }
1135
1107
 
1136
- ctx.emit('click', ev);
1108
+ open(); // if (!to.value) {
1109
+ // toggle();
1110
+ // }
1111
+ // ctx.emit('click', ev);
1137
1112
  };
1138
1113
 
1139
1114
  const onChangeActive = isActive => {
@@ -1155,18 +1130,21 @@ const VNavigationItem = defineComponent({
1155
1130
  ctx.emit('changeActive', isActive);
1156
1131
  };
1157
1132
 
1133
+ ctx.expose({
1134
+ close
1135
+ });
1158
1136
  return () => {
1159
1137
  let _slot;
1160
1138
 
1161
1139
  const _children = children.value;
1162
1140
  const fallbackTag = _children ? 'button' : undefined;
1163
- return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(_props.value, {
1141
+ return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(ctx.attrs, _props.value, {
1164
1142
  "fallbackTag": fallbackTag,
1165
1143
  "endIcon": _props.value.endIcon,
1166
1144
  "class": ['v-navigation-item', classes.value],
1167
1145
  "onClick": onClick,
1168
1146
  "onChangeActive": onChangeActive
1169
- }), _isSlot$6(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
1147
+ }), _isSlot$a(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
1170
1148
  default: () => [_slot]
1171
1149
  }), _children && createVNode(VExpandTransition, null, {
1172
1150
  default: () => [withDirectives(createVNode("div", {
@@ -1206,6 +1184,28 @@ const VNavigation = defineComponent({
1206
1184
  const c = props.caption;
1207
1185
  return typeof c === 'function' ? c() : c;
1208
1186
  });
1187
+ const itemsRef = ref([]);
1188
+ onBeforeUpdate(() => {
1189
+ itemsRef.value = [];
1190
+ });
1191
+
1192
+ function setItemRef(item, itemRef) {
1193
+ itemsRef.value.push({
1194
+ key: item.key,
1195
+ ref: itemRef
1196
+ });
1197
+ }
1198
+
1199
+ function onItemActivated(item) {
1200
+ itemsRef.value.forEach(({
1201
+ key,
1202
+ ref
1203
+ }) => {
1204
+ if (key === item.key) return;
1205
+ ref.close();
1206
+ });
1207
+ }
1208
+
1209
1209
  return () => {
1210
1210
  const $caption = caption.value;
1211
1211
  return createVNode("nav", {
@@ -1214,7 +1214,17 @@ const VNavigation = defineComponent({
1214
1214
  "class": "v-navigation__caption"
1215
1215
  }, [$caption]), items.value.map(item => renderNavigationItemInput(item, {
1216
1216
  class: 'v-navigation__item',
1217
- startIconEmptySpace: startIconEmptySpace.value
1217
+ startIconEmptySpace: startIconEmptySpace.value,
1218
+ ref: ref => {
1219
+ setItemRef(item, ref);
1220
+ },
1221
+ onChangeActive: isActive => {
1222
+ if (isActive
1223
+ /* && item.children && item.children.length*/
1224
+ ) {
1225
+ onItemActivated(item);
1226
+ }
1227
+ }
1218
1228
  }))]);
1219
1229
  };
1220
1230
  }
@@ -1314,7 +1324,7 @@ const VCheckbox = defineComponent({
1314
1324
 
1315
1325
  });
1316
1326
 
1317
- function _isSlot$5(s) {
1327
+ function _isSlot$9(s) {
1318
1328
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1319
1329
  }
1320
1330
 
@@ -1326,7 +1336,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
1326
1336
  itemRenderer: ({
1327
1337
  attrs,
1328
1338
  slots
1329
- }) => createVNode(VCheckbox, attrs, _isSlot$5(slots) ? slots : {
1339
+ }) => createVNode(VCheckbox, attrs, _isSlot$9(slots) ? slots : {
1330
1340
  default: () => [slots]
1331
1341
  })
1332
1342
  });
@@ -1378,7 +1388,7 @@ const VRadio = defineComponent({
1378
1388
 
1379
1389
  });
1380
1390
 
1381
- function _isSlot$4(s) {
1391
+ function _isSlot$8(s) {
1382
1392
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1383
1393
  }
1384
1394
 
@@ -1389,7 +1399,7 @@ const VRadioGroup = defineFormSelectorComponent({
1389
1399
  itemRenderer: ({
1390
1400
  attrs,
1391
1401
  slots
1392
- }) => createVNode(VRadio, attrs, _isSlot$4(slots) ? slots : {
1402
+ }) => createVNode(VRadio, attrs, _isSlot$8(slots) ? slots : {
1393
1403
  default: () => [slots]
1394
1404
  })
1395
1405
  });
@@ -1451,7 +1461,7 @@ const VSwitch = defineComponent({
1451
1461
 
1452
1462
  });
1453
1463
 
1454
- function _isSlot$3(s) {
1464
+ function _isSlot$7(s) {
1455
1465
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1456
1466
  }
1457
1467
 
@@ -1463,7 +1473,7 @@ const VSwitchGroup = defineFormSelectorComponent({
1463
1473
  itemRenderer: ({
1464
1474
  attrs,
1465
1475
  slots
1466
- }) => createVNode(VSwitch, attrs, _isSlot$3(slots) ? slots : {
1476
+ }) => createVNode(VSwitch, attrs, _isSlot$7(slots) ? slots : {
1467
1477
  default: () => [slots]
1468
1478
  })
1469
1479
  });
@@ -2022,6 +2032,597 @@ const VForm = defineComponent({
2022
2032
 
2023
2033
  });
2024
2034
 
2035
+ function _isSlot$6(s) {
2036
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2037
+ }
2038
+
2039
+ const VTab = defineComponent({
2040
+ name: 'VTab',
2041
+ props: {
2042
+ value: {
2043
+ type: String,
2044
+ required: true
2045
+ },
2046
+ active: Boolean,
2047
+ to: [String, Object],
2048
+ icon: [String, Function]
2049
+ },
2050
+ emits: {
2051
+ click: ev => true
2052
+ },
2053
+
2054
+ setup(props, ctx) {
2055
+ const classesRef = computed(() => ({
2056
+ 'v-tab--active': props.active
2057
+ }));
2058
+ const exposeValues = {
2059
+ value: props.value,
2060
+ active: props.active
2061
+ };
2062
+ ctx.expose(exposeValues);
2063
+ return () => {
2064
+ const {
2065
+ to,
2066
+ value,
2067
+ icon,
2068
+ active
2069
+ } = props;
2070
+ const classes = ['v-tab', classesRef.value];
2071
+
2072
+ const children = createVNode("span", {
2073
+ "class": "v-tab__content"
2074
+ }, [icon && resolveRawIconProp(active, icon, {
2075
+ class: 'v-tab__icon'
2076
+ }), renderSlotOrEmpty$1(ctx.slots)]);
2077
+
2078
+ if (to) {
2079
+ const replace = typeof to === 'string' ? undefined : to.replace;
2080
+ return createVNode(RouterLink, {
2081
+ "class": classes,
2082
+ "to": to,
2083
+ "replace": replace
2084
+ }, _isSlot$6(children) ? children : {
2085
+ default: () => [children]
2086
+ });
2087
+ } else {
2088
+ return createVNode("button", {
2089
+ "class": classes,
2090
+ "type": "button",
2091
+ "value": value,
2092
+ "onClick": ev => {
2093
+ ctx.emit('click', ev);
2094
+ }
2095
+ }, [children]);
2096
+ }
2097
+ };
2098
+ }
2099
+
2100
+ });
2101
+
2102
+ function _isSlot$5(s) {
2103
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2104
+ }
2105
+
2106
+ const VTabs = defineComponent({
2107
+ name: 'VTabs',
2108
+ props: {
2109
+ modelValue: String,
2110
+ items: {
2111
+ type: Array,
2112
+ required: true // validator: (value: VTabsItem[]) => {
2113
+ // return Array.isArray(value) && value.length > 0;
2114
+ // },
2115
+
2116
+ },
2117
+
2118
+ /**
2119
+ * 自動スクロールする際の余剰オフセット幅(px)
2120
+ */
2121
+ autoScrollOffset: {
2122
+ type: Number,
2123
+ default: 20
2124
+ },
2125
+
2126
+ /**
2127
+ * ルーター同期する場合設定する
2128
+ */
2129
+ router: Function,
2130
+
2131
+ /**
2132
+ * ルーティング連携を行う際に、クエリベースのURLマッチングを行う
2133
+ * タブのURLが /page1?tab=xxx のようになる時に設定する
2134
+ */
2135
+ withQuery: Boolean,
2136
+ ...defineSlotsProps$1(),
2137
+ color: String
2138
+ },
2139
+ emits: {
2140
+ 'update:modelValue': newValue => true,
2141
+ change: newValue => true
2142
+ },
2143
+
2144
+ setup(props, ctx) {
2145
+ const vui = useVui();
2146
+ const internalValueRef = ref(null);
2147
+ const scrollerRef = useVScrollerRef();
2148
+ const elRef = ref(null);
2149
+ let scrollResult;
2150
+ const tabRefs = ref([]);
2151
+ const currentRef = computed({
2152
+ get: () => internalValueRef.value,
2153
+ set: value => {
2154
+ if (internalValueRef.value !== value) {
2155
+ internalValueRef.value = value;
2156
+ ctx.emit('update:modelValue', value);
2157
+ ctx.emit('change', value);
2158
+ }
2159
+ }
2160
+ });
2161
+ const colorScope = useScopeColorClass({
2162
+ color: () => props.color || vui.setting('tabDefault').color
2163
+ });
2164
+ const classes = computed(() => [colorScope.value.className]);
2165
+ const computedItemsRef = computed(() => {
2166
+ const current = currentRef.value;
2167
+ const {
2168
+ router
2169
+ } = props;
2170
+ return props.items.map(item => {
2171
+ const {
2172
+ value
2173
+ } = item;
2174
+ const active = current === value;
2175
+ let location;
2176
+
2177
+ if (router) {
2178
+ const to = router(value);
2179
+ const route = vui.router.resolve(to);
2180
+ location = {
2181
+ to,
2182
+ route
2183
+ };
2184
+ }
2185
+
2186
+ return { ...item,
2187
+ active,
2188
+ location
2189
+ };
2190
+ });
2191
+ });
2192
+
2193
+ const setTabRef = ref => {
2194
+ tabRefs.value.push(ref);
2195
+ }; // const isMountedRef = ref(false);
2196
+
2197
+
2198
+ function setupInternalValue(routable) {
2199
+ let value = props.modelValue;
2200
+
2201
+ if (value == null || value === '') {
2202
+ const firstItem = props.items[0];
2203
+ if (!firstItem) return;
2204
+ value = firstItem.value;
2205
+ }
2206
+
2207
+ if (internalValueRef.value !== value) {
2208
+ internalValueRef.value = value;
2209
+
2210
+ if (routable) {
2211
+ const {
2212
+ router
2213
+ } = props;
2214
+ if (!router) return;
2215
+ const hit = computedItemsRef.value.find(item => item.value === value);
2216
+ if (!hit) return;
2217
+ const {
2218
+ location
2219
+ } = hit;
2220
+ if (!location) return;
2221
+ const {
2222
+ to,
2223
+ route
2224
+ } = location;
2225
+ if (route.fullPath === vui.location.currentRoute.fullPath) return;
2226
+ vui.router[to.replace ? 'replace' : 'push'](to);
2227
+ } else if (!props.router && props.modelValue !== value) {
2228
+ ctx.emit('update:modelValue', value);
2229
+ ctx.emit('change', value);
2230
+ }
2231
+ }
2232
+ }
2233
+
2234
+ function to(value) {
2235
+ currentRef.value = value;
2236
+ }
2237
+
2238
+ function cancelScroll() {
2239
+ if (scrollResult) {
2240
+ scrollResult.cancel();
2241
+ scrollResult = undefined;
2242
+ }
2243
+ }
2244
+
2245
+ const findTab = tab => {
2246
+ return tabRefs.value.find(t => t.value === tab);
2247
+ };
2248
+
2249
+ function scrollToTab(tabValue) {
2250
+ const tab = findTab(tabValue);
2251
+ if (!tab) return;
2252
+ const $tab = tab.$el;
2253
+ if (!$tab) return;
2254
+ const scroller = scrollerRef.value;
2255
+ if (!scroller) return;
2256
+ const container = scroller.scroller.element();
2257
+ if (!container) return;
2258
+ const {
2259
+ autoScrollOffset
2260
+ } = props;
2261
+ const tabLeft = $tab.offsetLeft;
2262
+ const tabWidth = $tab.offsetWidth;
2263
+ const tabRight = tabLeft + tabWidth;
2264
+ let hiddenLeft = 0;
2265
+ let hiddenRight = 0;
2266
+ const {
2267
+ scrollLeft,
2268
+ offsetWidth: scrollerWidth
2269
+ } = container;
2270
+ hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
2271
+ hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
2272
+ if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
2273
+ if (hiddenRight > 0) hiddenRight += autoScrollOffset;
2274
+ let scrollAmmount = 0;
2275
+
2276
+ if (hiddenRight > 0) {
2277
+ scrollAmmount = hiddenRight;
2278
+ }
2279
+
2280
+ if (hiddenLeft > 0) {
2281
+ scrollAmmount = -hiddenLeft;
2282
+ }
2283
+
2284
+ if (Math.abs(scrollAmmount) > 0) {
2285
+ cancelScroll();
2286
+ scrollResult = scroller.scroller.by(scrollAmmount, 0, {
2287
+ duration: 150
2288
+ });
2289
+ }
2290
+ }
2291
+
2292
+ watch(() => props.modelValue, () => setupInternalValue(true));
2293
+ watch(() => props.items, () => setupInternalValue(), {
2294
+ deep: true
2295
+ });
2296
+ watch(() => internalValueRef.value, newValue => {
2297
+ scrollToTab(newValue);
2298
+ });
2299
+ vui.location.watchRoute(route => {
2300
+ if (!props.router) return;
2301
+ const path = props.withQuery ? route.fullPath : route.path;
2302
+ const hit = computedItemsRef.value.find(({
2303
+ location
2304
+ }) => {
2305
+ return location && location.route.fullPath === path;
2306
+ });
2307
+
2308
+ if (hit) {
2309
+ currentRef.value = hit.value;
2310
+ }
2311
+ }, {
2312
+ immediate: true
2313
+ });
2314
+ onMounted(() => {
2315
+ scrollToTab(currentRef.value);
2316
+ });
2317
+ onBeforeUnmount(() => {
2318
+ cancelScroll();
2319
+ });
2320
+ onBeforeUpdate(() => {
2321
+ tabRefs.value = [];
2322
+ });
2323
+ setupInternalValue();
2324
+ return () => {
2325
+ const items = computedItemsRef.value;
2326
+ const itemSlot = ctx.slots.item;
2327
+ const children = items.map(({
2328
+ value,
2329
+ active,
2330
+ label,
2331
+ icon,
2332
+ location
2333
+ }) => {
2334
+ if (!label) {
2335
+ label = itemSlot;
2336
+ }
2337
+
2338
+ const children = typeof label === 'function' ? label({
2339
+ value,
2340
+ active,
2341
+ vui
2342
+ }) : label;
2343
+
2344
+ const _to = location && location.to || undefined;
2345
+
2346
+ return createVNode(VTab, {
2347
+ "value": value,
2348
+ "to": _to,
2349
+ "icon": icon,
2350
+ "active": active,
2351
+ "ref": setTabRef,
2352
+ "onClick": e => {
2353
+ if (!e.defaultPrevented) {
2354
+ to(value);
2355
+ }
2356
+ }
2357
+ }, _isSlot$5(children) ? children : {
2358
+ default: () => [children]
2359
+ });
2360
+ });
2361
+ return createVNode("div", {
2362
+ "class": ['v-tabs', classes.value],
2363
+ "ref": elRef
2364
+ }, [createVNode(VScroller, {
2365
+ "class": "v-tabs__scroller",
2366
+ "containerClass": "v-tabs__scroller__container",
2367
+ "guide": true,
2368
+ "ref": scrollerRef
2369
+ }, {
2370
+ default: () => [createVNode("div", {
2371
+ "class": "v-tabs__content"
2372
+ }, [children])]
2373
+ })]);
2374
+ };
2375
+ }
2376
+
2377
+ });
2378
+
2379
+ function _isSlot$4(s) {
2380
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2381
+ }
2382
+
2383
+ const VBreadcrumbs = defineComponent({
2384
+ name: 'VBreadcrumbs',
2385
+ props: {
2386
+ items: {
2387
+ type: Array,
2388
+ default: () => []
2389
+ },
2390
+ divider: [String, Function] // ...defineSlotsProps<{}>(),
2391
+
2392
+ },
2393
+
2394
+ setup(props, ctx) {
2395
+ const vui = useVui();
2396
+ const computedItemsRef = computed(() => {
2397
+ const items = props.items.map(rawItem => {
2398
+ return typeof rawItem === 'string' ? {
2399
+ text: rawItem
2400
+ } : rawItem;
2401
+ });
2402
+ return items.map(item => {
2403
+ const {
2404
+ to,
2405
+ text
2406
+ } = item;
2407
+ const {
2408
+ disabled = vui.location.match(to) || !vui.location.isAvairable(to)
2409
+ } = item;
2410
+ return { ...item,
2411
+ disabled,
2412
+ text: typeof text === 'function' ? text(vui) : text
2413
+ };
2414
+ });
2415
+ });
2416
+ const lengthRef = computed(() => computedItemsRef.value.length);
2417
+
2418
+ const defaultDividerSlot = () => {
2419
+ return [createVNode("i", {
2420
+ "class": "v-breadcrumbs__divider__icon"
2421
+ }, null)];
2422
+ };
2423
+
2424
+ return () => {
2425
+ if (lengthRef.value < 1) return;
2426
+ let dividerSlot;
2427
+ const propDivider = props.divider;
2428
+
2429
+ if (propDivider) {
2430
+ dividerSlot = typeof propDivider === 'function' ? propDivider : () => propDivider;
2431
+ } else {
2432
+ dividerSlot = defaultDividerSlot;
2433
+ }
2434
+
2435
+ const children = [];
2436
+ computedItemsRef.value.forEach((item, index) => {
2437
+ const {
2438
+ text,
2439
+ icon,
2440
+ disabled,
2441
+ to
2442
+ } = item;
2443
+
2444
+ if (index > 0) {
2445
+ const divider = dividerSlot(vui);
2446
+
2447
+ if (divider) {
2448
+ children.push(createVNode("li", {
2449
+ "class": "v-breadcrumbs__divider",
2450
+ "key": `divider-${index}`
2451
+ }, [divider]));
2452
+ }
2453
+ }
2454
+
2455
+ const myChildren = [];
2456
+
2457
+ if (icon) {
2458
+ const $icon = resolveRawIconProp(false, icon, {
2459
+ class: 'v-breadcrumbs__icon'
2460
+ });
2461
+
2462
+ if ($icon) {
2463
+ myChildren.push($icon);
2464
+ }
2465
+ }
2466
+
2467
+ if (text) myChildren.push(text);
2468
+ const itemChild = to ? createVNode(VLink, {
2469
+ "class": "v-breadcrumbs__link",
2470
+ "to": to,
2471
+ "exactActiveClass": "v-breadcrumbs__link--active"
2472
+ }, _isSlot$4(myChildren) ? myChildren : {
2473
+ default: () => [myChildren]
2474
+ }) : myChildren;
2475
+ children.push(createVNode("li", {
2476
+ "class": ['v-breadcrumbs__item', {
2477
+ 'v-breadcrumbs__item--disabled': disabled
2478
+ }],
2479
+ "key": `link-${index}`
2480
+ }, [itemChild]));
2481
+ });
2482
+ return createVNode("nav", {
2483
+ "class": "v-breadcrumbs"
2484
+ }, [createVNode("ul", {
2485
+ "class": "v-breadcrumbs__list"
2486
+ }, [children])]);
2487
+ };
2488
+ }
2489
+
2490
+ });
2491
+
2492
+ function _isSlot$3(s) {
2493
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2494
+ }
2495
+
2496
+ const VContentSwitcher = defineComponent({
2497
+ name: 'VContentSwitcher',
2498
+ props: {
2499
+ modelValue: String,
2500
+ order: {
2501
+ type: Array,
2502
+ default: () => []
2503
+ },
2504
+ autotop: [Boolean, Object]
2505
+ },
2506
+ emits: {
2507
+ 'update:modelValue': modelValue => true
2508
+ },
2509
+
2510
+ setup(props, ctx) {
2511
+ const internalValueRef = ref('');
2512
+ const transitionRef = ref('');
2513
+ const elRef = ref(null);
2514
+ const anchorRef = ref(null);
2515
+ const computedOrderRef = computed(() => props.order.map(row => {
2516
+ return typeof row === 'string' ? row : row.value;
2517
+ }));
2518
+ const currentRef = computed({
2519
+ get: () => internalValueRef.value,
2520
+ set: current => {
2521
+ if (internalValueRef.value !== current) {
2522
+ internalValueRef.value = current;
2523
+ ctx.emit('update:modelValue', current);
2524
+ }
2525
+ }
2526
+ });
2527
+ const autotopSettingsRef = computed(() => {
2528
+ let {
2529
+ autotop: settings
2530
+ } = props;
2531
+ if (settings === true) settings = {};
2532
+ if (!settings) return;
2533
+ return { ...settings
2534
+ };
2535
+ });
2536
+
2537
+ function seeTop(options) {
2538
+ const scoller = getDocumentScroller$1();
2539
+ const {
2540
+ value: anchor
2541
+ } = anchorRef;
2542
+
2543
+ if (anchor) {
2544
+ scoller.toElement(anchor, options);
2545
+ }
2546
+ }
2547
+
2548
+ function getEl() {
2549
+ const el = elRef.value;
2550
+
2551
+ if (!el) {
2552
+ throw new Error('missing element');
2553
+ }
2554
+
2555
+ return el;
2556
+ }
2557
+
2558
+ watch(() => props.modelValue, (value, beforeValue) => {
2559
+ if (value == null) return;
2560
+ internalValueRef.value = value;
2561
+ if (beforeValue == null) return;
2562
+ const order = computedOrderRef.value;
2563
+ const index = order.indexOf(value);
2564
+ const beforeIndex = order.indexOf(beforeValue);
2565
+ let transition = 'fade';
2566
+
2567
+ if (index !== -1 && beforeIndex !== -1) {
2568
+ if (index > beforeIndex) transition = 'v-content-switcher-next';
2569
+ if (index < beforeIndex) transition = 'v-content-switcher-prev';
2570
+ }
2571
+
2572
+ transitionRef.value = transition;
2573
+ }, {
2574
+ immediate: true
2575
+ });
2576
+ watch(currentRef, () => {
2577
+ const autotopSettings = autotopSettingsRef.value;
2578
+
2579
+ if (autotopSettings && props.modelValue != null) {
2580
+ seeTop(autotopSettings);
2581
+ }
2582
+ });
2583
+ return () => {
2584
+ const current = currentRef.value;
2585
+ const children = renderSlotOrEmpty$1(ctx.slots) || [];
2586
+ const currentSlot = ctx.slots[current];
2587
+
2588
+ if (currentSlot) {
2589
+ children.push(createVNode("div", {
2590
+ "class": "v-content-switcher__content",
2591
+ "key": current
2592
+ }, [currentSlot(this)]));
2593
+ }
2594
+
2595
+ return createVNode("div", {
2596
+ "class": "v-content-switcher",
2597
+ "ref": elRef
2598
+ }, [createVNode("div", {
2599
+ "class": "v-content-switcher__anchor",
2600
+ "ref": anchorRef
2601
+ }, null), createVNode(Transition, {
2602
+ "name": transitionRef.value,
2603
+ "onBeforeLeave": el => {
2604
+ getEl().style.height = el.offsetHeight + 'px';
2605
+ },
2606
+ "onEnter": el => {
2607
+ getEl().style.height = el.offsetHeight + 'px';
2608
+ },
2609
+ "onAfterEnter": () => {
2610
+ getEl().style.height = '';
2611
+ },
2612
+ "onEnterCancelled": () => {
2613
+ getEl().style.height = '';
2614
+ },
2615
+ "onLeaveCancelled": () => {
2616
+ getEl().style.height = '';
2617
+ }
2618
+ }, _isSlot$3(children) ? children : {
2619
+ default: () => [children]
2620
+ })]);
2621
+ };
2622
+ }
2623
+
2624
+ });
2625
+
2025
2626
  const DATA_TABLE_DEFAULTS = {
2026
2627
  itemKey: 'id',
2027
2628
  pageQuery: 'page',
@@ -2794,6 +3395,7 @@ class VuiService {
2794
3395
  location;
2795
3396
  constructor(options) {
2796
3397
  this.options = options;
3398
+ this.configure();
2797
3399
  const { selectionSeparator = () => ', ', autoScrollToElementOffsetTop = DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP, textareaRows = DEFAULT_TEXTAREA_ROWS, requiredChip = () => '*', } = options;
2798
3400
  this.selectionSeparator = selectionSeparator;
2799
3401
  this.autoScrollToElementOffsetTop = autoScrollToElementOffsetTop;
@@ -2804,6 +3406,13 @@ class VuiService {
2804
3406
  router: this.router,
2805
3407
  });
2806
3408
  }
3409
+ configure(options) {
3410
+ options && Object.assign(this.options, options);
3411
+ setDefaultRouterLink(this.getRouterLink());
3412
+ }
3413
+ getRouterLink() {
3414
+ return this.options.RouterLink || RouterLink;
3415
+ }
2807
3416
  setting(key) {
2808
3417
  return this.options.uiSettings[key];
2809
3418
  }
@@ -2880,4 +3489,4 @@ function installVuiPlugin(app, opts) {
2880
3489
  return app.use(VuiPlugin, opts);
2881
3490
  }
2882
3491
 
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 };
3492
+ export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, 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 };