@fastkit/vui 0.6.19 → 0.6.31

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,13 +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 { inject, computed, provide, defineComponent, createVNode, mergeProps, watch, isVNode, ref, Fragment, withDirectives, vShow, vModelSelect, createTextVNode } from 'vue';
5
- import { useScopeColorClass, colorSchemeProps, useColorClasses } from '@fastkit/vue-color-scheme';
6
- import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableProps, navigationableEmits, useNavigationable, VExpandTransition } from '@fastkit/vue-utils';
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, vModelSelect, onMounted, onBeforeUnmount, onBeforeUpdate, Transition } from 'vue';
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
- import { useLink, useRoute } from 'vue-router';
11
+ import { isPromise } from '@fastkit/helpers';
12
+ import { VAppContainer, VAppLayoutControl } from '@fastkit/vue-app-layout';
13
+ import { getDocumentScroller as getDocumentScroller$1 } from '@fastkit/vue-scroller';
11
14
 
12
15
  const CONTROL_SIZES = ['sm', 'md', 'lg'];
13
16
  const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
@@ -161,7 +164,7 @@ const VFormControl = defineComponent({
161
164
  }
162
165
  }, [label, control.required && vui.getRequiredChip()]), createVNode("div", {
163
166
  "class": "v-form-control__body"
164
- }, [renderSlotOrEmpty(ctx.slots, 'default', control), createVNode("div", {
167
+ }, [renderSlotOrEmpty(ctx.slots, 'default', control), !props.hiddenInfo && createVNode("div", {
165
168
  "class": "v-form-control__info"
166
169
  }, [!!message && createVNode("div", {
167
170
  "class": "v-form-control__message"
@@ -214,6 +217,7 @@ function defineFormSelectorComponent(opts) {
214
217
  return createVNode(VFormControl, {
215
218
  "nodeControl": this.nodeControl,
216
219
  "focused": this.nodeControl.focused,
220
+ "hiddenInfo": this.hiddenInfo,
217
221
  "class": ['v-form-selector', className, { ...this.classes,
218
222
  'v-form-selector--stacked': this.stacked
219
223
  }],
@@ -430,7 +434,7 @@ function resolveRawVButtonIcon(raw, type = 'main') {
430
434
  }
431
435
 
432
436
  const vueButtonProps = createPropsOptions$1({ ...colorSchemeProps(),
433
- ...navigationableProps,
437
+ ...navigationableInheritProps,
434
438
  spacer: [Boolean, String],
435
439
  loading: Boolean,
436
440
  rounded: Boolean,
@@ -446,9 +450,8 @@ const LOADING_SIZE_MAP = {
446
450
  };
447
451
  const VButton = defineComponent({
448
452
  name: 'VButton',
453
+ inheritAttrs: false,
449
454
  props: vueButtonProps,
450
- emits: { ...navigationableEmits
451
- },
452
455
 
453
456
  setup(props, ctx) {
454
457
  const vui = useVui();
@@ -474,48 +477,25 @@ const VButton = defineComponent({
474
477
  variant: () => props.variant || (icon.value ? vui.setting('plainVariant') : defaults.variant)
475
478
  });
476
479
  const isPlain = computed(() => color.variant.value.value === vui.setting('plainVariant') && color.color.value.value === defaults.color);
477
- const navigationable = useNavigationable(props);
478
- const isLoading = computed(() => props.loading);
479
- const isDisabled = computed(() => props.disabled);
480
+ const isLoading = computed(() => props.loading); // const isDisabled = computed(() => props.disabled);
481
+
480
482
  const isRounded = computed(() => props.rounded || !!icon.value);
481
483
  const spacer = computed(() => {
482
484
  const _spacer = props.spacer;
483
485
  if (!_spacer) return;
484
486
  return _spacer === true ? 'left' : _spacer;
485
487
  });
486
- 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}`, {
487
490
  'v-button--loading': isLoading.value,
488
491
  'v-button--icon': !!icon.value,
489
492
  'v-button--rounded': isRounded.value,
490
493
  'v-button--plain': isPlain.value
491
494
  }]);
492
495
  return () => {
493
- const {
494
- Tag,
495
- attrs
496
- } = navigationable.value;
497
- const children = renderSlotOrEmpty$1(ctx.slots, 'default');
498
- const _attrs = { ...attrs
499
- };
500
-
501
- if (isDisabled.value) {
502
- _attrs.disabled = true;
503
- }
504
-
505
- return createVNode(Tag, mergeProps({
496
+ const children = renderSlotOrEmpty$1(ctx.slots);
497
+ return createVNode(VLink, mergeProps(ctx.attrs, {
506
498
  "class": ['v-button', classes.value]
507
- }, _attrs, {
508
- "onClick": ev => {
509
- if (isDisabled.value || isLoading.value) {
510
- ev.preventDefault();
511
-
512
- if (isDisabled.value) {
513
- return;
514
- }
515
- }
516
-
517
- ctx.emit('click', ev);
518
- }
519
499
  }), {
520
500
  default: () => [createVNode("span", {
521
501
  "class": "v-button__content"
@@ -530,13 +510,306 @@ const VButton = defineComponent({
530
510
 
531
511
  });
532
512
 
513
+ function _isSlot$c(s) {
514
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
515
+ }
516
+
517
+ const PAGINATION_ALIGNS = ['left', 'center', 'right'];
518
+ function paginationProps() {
519
+ return createPropsOptions$1({
520
+ /**
521
+ * Active Pages
522
+ */
523
+ modelValue: {
524
+ type: rawNumberPropType,
525
+ default: 1
526
+ },
527
+
528
+ /**
529
+ * Total number of pages
530
+ */
531
+ length: {
532
+ type: rawNumberPropType,
533
+ default: 0
534
+ },
535
+
536
+ /**
537
+ * Maximum number of links to display.
538
+ */
539
+ totalVisible: rawNumberPropType,
540
+
541
+ /**
542
+ * true when narrowing
543
+ */
544
+ dense: Boolean,
545
+ disabled: Boolean,
546
+ align: {
547
+ type: String,
548
+ default: 'center'
549
+ },
550
+
551
+ /**
552
+ * To synchronize with a query, use the query name
553
+ */
554
+ routeQuery: String,
555
+ beforeChange: Function,
556
+ color: String
557
+ });
558
+ }
559
+ const VPagination = defineComponent({
560
+ name: 'VPagination',
561
+ props: paginationProps(),
562
+ emits: {
563
+ change: page => true
564
+ },
565
+
566
+ setup(props, ctx) {
567
+ const vui = useVui();
568
+ const elRef = ref(null);
569
+ const router = useRouter();
570
+ const internalValue = ref(1);
571
+ const containerWidth = ref(0);
572
+ const itemSize = ref(0);
573
+ const capacityLength = computed(() => {
574
+ const _itemSize = itemSize.value;
575
+ if (!_itemSize) return 0;
576
+ return Math.floor(containerWidth.value / _itemSize);
577
+ });
578
+ const colorScope = useScopeColorClass({
579
+ color: () => props.color || vui.setting('primaryScope')
580
+ });
581
+ const computedLength = computed(() => resolveNumberish(props.length));
582
+ const computedTotalVisible = computed(() => resolveNumberish(props.totalVisible));
583
+ const computedNumbersLength = computed(() => capacityLength.value - 2 - 2);
584
+ const computedPage = computed(() => {
585
+ const {
586
+ routeQuery
587
+ } = props;
588
+
589
+ if (routeQuery) {
590
+ return vui.location.getQuery(routeQuery, Number, 1);
591
+ }
592
+
593
+ return internalValue.value;
594
+ });
595
+
596
+ const _range = (from, to) => {
597
+ const range = [];
598
+ from = from > 0 ? from : 1;
599
+
600
+ for (let i = from; i <= to; i++) {
601
+ range.push(i);
602
+ }
603
+
604
+ return range;
605
+ };
606
+
607
+ const computedItems = computed(() => {
608
+ const maxButtons = computedNumbersLength.value;
609
+ const totalVisible = computedTotalVisible.value;
610
+ const length = computedLength.value;
611
+ const pageValue = computedPage.value;
612
+ const maxLength = Math.min(Math.max(0, totalVisible || 0) || length, Math.max(0, maxButtons) || length, length);
613
+
614
+ if (length <= maxLength) {
615
+ return _range(1, length);
616
+ }
617
+
618
+ const even = maxLength % 2 === 0 ? 1 : 0;
619
+ const left = Math.floor(maxLength / 2);
620
+ const right = length - left + 1 + even;
621
+
622
+ if (pageValue > left && pageValue < right) {
623
+ const start = pageValue - left + 2;
624
+ const end = pageValue + left - 2 - even;
625
+ return [1, 'truncate', ..._range(start, end), 'truncate', length];
626
+ } else if (pageValue === left) {
627
+ const end = pageValue + left - 1 - even;
628
+ return [..._range(1, end), 'truncate', length];
629
+ } else if (pageValue === right) {
630
+ const start = pageValue - left + 1;
631
+ return [1, 'truncate', ..._range(start, length)];
632
+ } else {
633
+ return [..._range(1, left), 'truncate', ..._range(right, length)];
634
+ }
635
+ });
636
+ const isActive = computed(() => computedLength.value > 1);
637
+ const isTransitioning = computed(() => {
638
+ const {
639
+ routeQuery
640
+ } = props;
641
+ return vui.location.isQueryOnlyTransitioning(routeQuery);
642
+ });
643
+ const isDisabled = computed(() => props.disabled || isTransitioning.value);
644
+ const classes = computed(() => [{
645
+ 'v-pagination--disabled': isDisabled.value,
646
+ 'v-pagination--dense': props.dense,
647
+ [`v-pagination--${props.align}`]: true
648
+ }, colorScope.value.className]);
649
+
650
+ async function setPage(value) {
651
+ if (isDisabled.value) return;
652
+ const {
653
+ beforeChange,
654
+ routeQuery
655
+ } = props;
656
+ const newPage = resolveNumberish(value);
657
+ if (computedPage.value === newPage) return;
658
+
659
+ if (beforeChange) {
660
+ try {
661
+ let result = beforeChange(newPage);
662
+ if (isPromise(result)) result = await result;
663
+ if (result === false) return;
664
+ } catch (e) {}
665
+ }
666
+
667
+ if (routeQuery) {
668
+ const to = createRoutableLocationByPage(newPage, routeQuery);
669
+ return router.push(to).then(failure => {
670
+ !failure && ctx.emit('change', newPage);
671
+ });
672
+ } else {
673
+ internalValue.value = newPage;
674
+ ctx.emit('update:modelValue', newPage);
675
+ ctx.emit('change', newPage);
676
+ }
677
+ }
678
+
679
+ function createPageInfo(source) {
680
+ const currentPage = computedPage.value;
681
+ const length = computedLength.value;
682
+ let number;
683
+ let page;
684
+ let active;
685
+ let disabled;
686
+
687
+ if (typeof source === 'number') {
688
+ number = true;
689
+ page = source;
690
+ active = currentPage === page;
691
+ disabled = false;
692
+ } else if (source === 'truncate') {
693
+ number = false;
694
+ active = false;
695
+ disabled = false;
696
+ } else {
697
+ number = false;
698
+ const isPrev = source === 'prev';
699
+ const ammount = isPrev ? -1 : 1;
700
+ page = currentPage + ammount;
701
+ active = false;
702
+ disabled = page < 1 || page > length;
703
+ }
704
+
705
+ return {
706
+ number,
707
+ page,
708
+ active,
709
+ disabled
710
+ };
711
+ }
712
+
713
+ function createRoutableLocationByPage(page, routeQuery) {
714
+ return vui.location.getQueryMergedLocation({
715
+ [routeQuery]: page
716
+ });
717
+ }
718
+
719
+ function genItem(source, index) {
720
+ const {
721
+ number,
722
+ page,
723
+ active,
724
+ disabled
725
+ } = createPageInfo(source);
726
+ const type = number ? 'num' : source;
727
+ const classes = ['v-pagination__item', {
728
+ [`v-pagination__item--${type}`]: true,
729
+ 'v-pagination__item--active': active,
730
+ 'v-pagination__item--disabled': disabled
731
+ }];
732
+ const children = number ? page : (() => {
733
+ if (type === 'truncate') {
734
+ return createVNode("span", null, [createTextVNode("...")]);
735
+ }
736
+
737
+ const isPrev = type === 'prev';
738
+ const icon = isPrev ? vui.icon('prev') : vui.icon('next');
739
+ return resolveRawIconProp(false, icon, {
740
+ class: 'v-pagination__item__icon'
741
+ });
742
+ })();
743
+
744
+ const onClick = ev => {
745
+ ev.preventDefault();
746
+ if (page === undefined || active || disabled) return;
747
+ setPage(page);
748
+ };
749
+
750
+ const key = `${source}-${index}`;
751
+ const {
752
+ routeQuery
753
+ } = props;
754
+
755
+ if (page !== undefined && routeQuery) {
756
+ const to = createRoutableLocationByPage(page, routeQuery);
757
+ return createVNode(RouterLink, {
758
+ "class": classes,
759
+ "to": to,
760
+ "key": key
761
+ }, _isSlot$c(children) ? children : {
762
+ default: () => [children]
763
+ });
764
+ } else {
765
+ return createVNode("button", {
766
+ "class": classes,
767
+ "type": "button",
768
+ "value": page,
769
+ "onClick": onClick,
770
+ "key": key
771
+ }, [children]);
772
+ }
773
+ }
774
+
775
+ watch(() => props.modelValue, modelValue => {
776
+ internalValue.value = resolveNumberish(modelValue);
777
+ }, {
778
+ immediate: true
779
+ });
780
+ return () => {
781
+ if (!isActive.value) return undefined;
782
+ const $items = ['prev', ...computedItems.value, 'next'].map((i, index) => genItem(i, index));
783
+ return withDirectives(createVNode("nav", {
784
+ "class": ['v-pagination', classes.value],
785
+ "ref": elRef
786
+ }, [$items]), [resizeDirectiveArgument(({
787
+ width
788
+ }) => {
789
+ const el = elRef.value;
790
+
791
+ if (el) {
792
+ const style = window.getComputedStyle(el, 'before');
793
+ const width = style.getPropertyValue('width');
794
+ const margin = style.getPropertyValue('margin');
795
+ const size = parseFloat(width) + parseFloat(margin) * 0.5;
796
+ itemSize.value = size;
797
+ }
798
+
799
+ containerWidth.value = width;
800
+ })]);
801
+ };
802
+ }
803
+
804
+ });
805
+
533
806
  function createListTileProps() {
534
807
  const icon = rawIconProp();
535
- return { ...navigationableProps,
808
+ return { ...navigationableInheritProps,
536
809
  ...createPropsOptions$1({
537
810
  startIcon: icon,
538
811
  endIcon: icon,
539
- fallbackTag: {
812
+ linkFallbackTag: {
540
813
  type: String,
541
814
  default: 'div'
542
815
  },
@@ -546,11 +819,12 @@ function createListTileProps() {
546
819
  })
547
820
  };
548
821
  }
549
- const listTileEmits = { ...navigationableEmits,
822
+ const listTileEmits = {
550
823
  changeActive: isActive => true
551
824
  };
552
825
  const VListTile = defineComponent({
553
826
  name: 'VListTile',
827
+ inheritAttrs: false,
554
828
  props: createListTileProps(),
555
829
  emits: { ...listTileEmits
556
830
  },
@@ -566,7 +840,6 @@ const VListTile = defineComponent({
566
840
  return icon;
567
841
  });
568
842
  const endIcon = computed(() => resolveRawIconProp(false, props.endIcon));
569
- const navigationable = useNavigationable(props, () => props.fallbackTag, ctx);
570
843
  const hasTo = computed(() => !!props.to);
571
844
  const link = useLink({
572
845
  to: props.to || ''
@@ -579,10 +852,7 @@ const VListTile = defineComponent({
579
852
  const classes = computed(() => {
580
853
  const _color = color.value;
581
854
  const hasColor = !!_color.value;
582
- const _navigationable = navigationable.value;
583
- const clickable = _navigationable.clickable;
584
- return [color.value.className, _navigationable.classes, {
585
- 'v-list-tile--clickable': clickable,
855
+ return [color.value.className, {
586
856
  'v-list-tile--plain': !hasColor,
587
857
  'v-list-tile--has-color': hasColor,
588
858
  'v-list-tile--active': isActive.value
@@ -596,16 +866,9 @@ const VListTile = defineComponent({
596
866
  return () => {
597
867
  const _startIcon = startIcon.value;
598
868
  const _endIcon = endIcon.value;
599
- const {
600
- Tag,
601
- attrs
602
- } = navigationable.value;
603
- return createVNode(Tag, mergeProps({
604
- "class": ['v-list-tile', classes.value]
605
- }, attrs, {
606
- "onClick": ev => {
607
- ctx.emit('click', ev);
608
- }
869
+ return createVNode(VLink, mergeProps(ctx.attrs, {
870
+ "class": ['v-list-tile', classes.value],
871
+ "clickableClassName": "v-list-tile--clickable"
609
872
  }), {
610
873
  default: () => [_startIcon && createVNode("span", {
611
874
  "class": "v-list-tile__icon v-list-tile__icon--start"
@@ -650,7 +913,52 @@ const VDrawerLayout = defineComponent({
650
913
 
651
914
  });
652
915
 
653
- function _isSlot$6(s) {
916
+ function _isSlot$b(s) {
917
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
918
+ }
919
+
920
+ const VHero = defineComponent({
921
+ name: 'VHero',
922
+ props: {
923
+ color: {
924
+ type: String,
925
+ default: 'primary'
926
+ },
927
+ tag: {
928
+ type: String,
929
+ default: 'header'
930
+ },
931
+ hTag: {
932
+ type: String,
933
+ default: 'h1'
934
+ }
935
+ },
936
+
937
+ setup(props, ctx) {
938
+ return () => {
939
+ let _slot;
940
+
941
+ const TagName = props.tag;
942
+ const HTagName = props.hTag;
943
+ return createVNode(VAppContainer, {
944
+ "pulled": true
945
+ }, {
946
+ default: () => [createVNode(TagName, {
947
+ "class": ['v-hero', toScopeColorClass(props.color)]
948
+ }, {
949
+ default: () => [createVNode(HTagName, {
950
+ "class": "v-hero__title"
951
+ }, _isSlot$b(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
952
+ default: () => [_slot]
953
+ })]
954
+ })]
955
+ });
956
+ };
957
+ }
958
+
959
+ });
960
+
961
+ function _isSlot$a(s) {
654
962
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
655
963
  }
656
964
 
@@ -681,7 +989,7 @@ function renderNavigationItemInput(input, extraProps) {
681
989
  } = resolveNavigationItemInput(input);
682
990
  return createVNode(VNavigationItem, { ...props,
683
991
  ...extraProps
684
- }, _isSlot$6(label) ? label : {
992
+ }, _isSlot$a(label) ? label : {
685
993
  default: () => [label]
686
994
  });
687
995
  }
@@ -790,9 +1098,8 @@ const VNavigationItem = defineComponent({
790
1098
  const onClick = ev => {
791
1099
  if (!to.value) {
792
1100
  toggle();
793
- }
1101
+ } // ctx.emit('click', ev);
794
1102
 
795
- ctx.emit('click', ev);
796
1103
  };
797
1104
 
798
1105
  const onChangeActive = isActive => {
@@ -819,13 +1126,13 @@ const VNavigationItem = defineComponent({
819
1126
 
820
1127
  const _children = children.value;
821
1128
  const fallbackTag = _children ? 'button' : undefined;
822
- return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(_props.value, {
1129
+ return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(ctx.attrs, _props.value, {
823
1130
  "fallbackTag": fallbackTag,
824
1131
  "endIcon": _props.value.endIcon,
825
1132
  "class": ['v-navigation-item', classes.value],
826
1133
  "onClick": onClick,
827
1134
  "onChangeActive": onChangeActive
828
- }), _isSlot$6(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
1135
+ }), _isSlot$a(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
829
1136
  default: () => [_slot]
830
1137
  }), _children && createVNode(VExpandTransition, null, {
831
1138
  default: () => [withDirectives(createVNode("div", {
@@ -973,7 +1280,7 @@ const VCheckbox = defineComponent({
973
1280
 
974
1281
  });
975
1282
 
976
- function _isSlot$5(s) {
1283
+ function _isSlot$9(s) {
977
1284
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
978
1285
  }
979
1286
 
@@ -985,7 +1292,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
985
1292
  itemRenderer: ({
986
1293
  attrs,
987
1294
  slots
988
- }) => createVNode(VCheckbox, attrs, _isSlot$5(slots) ? slots : {
1295
+ }) => createVNode(VCheckbox, attrs, _isSlot$9(slots) ? slots : {
989
1296
  default: () => [slots]
990
1297
  })
991
1298
  });
@@ -1037,7 +1344,7 @@ const VRadio = defineComponent({
1037
1344
 
1038
1345
  });
1039
1346
 
1040
- function _isSlot$4(s) {
1347
+ function _isSlot$8(s) {
1041
1348
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1042
1349
  }
1043
1350
 
@@ -1048,7 +1355,7 @@ const VRadioGroup = defineFormSelectorComponent({
1048
1355
  itemRenderer: ({
1049
1356
  attrs,
1050
1357
  slots
1051
- }) => createVNode(VRadio, attrs, _isSlot$4(slots) ? slots : {
1358
+ }) => createVNode(VRadio, attrs, _isSlot$8(slots) ? slots : {
1052
1359
  default: () => [slots]
1053
1360
  })
1054
1361
  });
@@ -1110,7 +1417,7 @@ const VSwitch = defineComponent({
1110
1417
 
1111
1418
  });
1112
1419
 
1113
- function _isSlot$3(s) {
1420
+ function _isSlot$7(s) {
1114
1421
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1115
1422
  }
1116
1423
 
@@ -1122,7 +1429,7 @@ const VSwitchGroup = defineFormSelectorComponent({
1122
1429
  itemRenderer: ({
1123
1430
  attrs,
1124
1431
  slots
1125
- }) => createVNode(VSwitch, attrs, _isSlot$3(slots) ? slots : {
1432
+ }) => createVNode(VSwitch, attrs, _isSlot$7(slots) ? slots : {
1126
1433
  default: () => [slots]
1127
1434
  })
1128
1435
  });
@@ -1406,6 +1713,7 @@ const VSelect = defineComponent({
1406
1713
  "class": ['v-select', this.classes],
1407
1714
  "label": this.label,
1408
1715
  "hint": this.hint,
1716
+ "hiddenInfo": this.hiddenInfo,
1409
1717
  "onClickLabel": ev => {
1410
1718
  this.focus();
1411
1719
  }
@@ -1432,7 +1740,20 @@ const VSelect = defineComponent({
1432
1740
  "focused": this.menuOpened,
1433
1741
  "onClick": ev => {
1434
1742
  if (this.canOperation && !control.isActive) {
1435
- control.show(ev);
1743
+ let t = ev.target;
1744
+ const count = 0;
1745
+ let hit = false;
1746
+
1747
+ while (count < 5) {
1748
+ if (t.classList.contains('v-select__input')) {
1749
+ hit = true;
1750
+ break;
1751
+ }
1752
+
1753
+ t = t.parentElement;
1754
+ }
1755
+
1756
+ control.show(hit ? t : ev);
1436
1757
  }
1437
1758
  }
1438
1759
  }, { ...this.$slots,
@@ -1517,6 +1838,7 @@ const VTextField = defineComponent({
1517
1838
  return createVNode(VFormControl, {
1518
1839
  "nodeControl": this.nodeControl,
1519
1840
  "focused": this.nodeControl.focused,
1841
+ "hiddenInfo": this.hiddenInfo,
1520
1842
  "class": ['v-text-field', this.classes],
1521
1843
  "label": this.label,
1522
1844
  "hint": this.hint,
@@ -1580,6 +1902,7 @@ const VTextarea = defineComponent({
1580
1902
  "class": ['v-textarea', this.classes],
1581
1903
  "label": this.label,
1582
1904
  "hint": this.hint,
1905
+ "hiddenInfo": this.hiddenInfo,
1583
1906
  "onClickLabel": ev => {
1584
1907
  this.focus();
1585
1908
  }
@@ -1665,98 +1988,1316 @@ const VForm = defineComponent({
1665
1988
 
1666
1989
  });
1667
1990
 
1668
- function _isSlot$2(s) {
1991
+ function _isSlot$6(s) {
1669
1992
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1670
1993
  }
1671
1994
 
1672
- const VApp = defineComponent({
1673
- name: 'VApp',
1995
+ const VTab = defineComponent({
1996
+ name: 'VTab',
1997
+ props: {
1998
+ value: {
1999
+ type: String,
2000
+ required: true
2001
+ },
2002
+ active: Boolean,
2003
+ to: [String, Object],
2004
+ icon: [String, Function]
2005
+ },
2006
+ emits: {
2007
+ click: ev => true
2008
+ },
1674
2009
 
1675
2010
  setup(props, ctx) {
1676
- useInjectTheme();
2011
+ const classesRef = computed(() => ({
2012
+ 'v-tab--active': props.active
2013
+ }));
2014
+ const exposeValues = {
2015
+ value: props.value,
2016
+ active: props.active
2017
+ };
2018
+ ctx.expose(exposeValues);
1677
2019
  return () => {
1678
- let _slot;
1679
-
1680
- return createVNode(VStackRoot, null, _isSlot$2(_slot = renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
1681
- default: () => [_slot]
1682
- });
2020
+ const {
2021
+ to,
2022
+ value,
2023
+ icon,
2024
+ active
2025
+ } = props;
2026
+ const classes = ['v-tab', classesRef.value];
2027
+
2028
+ const children = createVNode("span", {
2029
+ "class": "v-tab__content"
2030
+ }, [icon && resolveRawIconProp(active, icon, {
2031
+ class: 'v-tab__icon'
2032
+ }), renderSlotOrEmpty$1(ctx.slots)]);
2033
+
2034
+ if (to) {
2035
+ const replace = typeof to === 'string' ? undefined : to.replace;
2036
+ return createVNode(RouterLink, {
2037
+ "class": classes,
2038
+ "to": to,
2039
+ "replace": replace
2040
+ }, _isSlot$6(children) ? children : {
2041
+ default: () => [children]
2042
+ });
2043
+ } else {
2044
+ return createVNode("button", {
2045
+ "class": classes,
2046
+ "type": "button",
2047
+ "value": value,
2048
+ "onClick": ev => {
2049
+ ctx.emit('click', ev);
2050
+ }
2051
+ }, [children]);
2052
+ }
1683
2053
  };
1684
2054
  }
1685
2055
 
1686
2056
  });
1687
2057
 
1688
- const VToolbar = defineComponent({
1689
- name: 'VToolbar',
1690
- props: { ...createElevationProps(),
1691
- ...colorSchemeProps(),
1692
- dense: Boolean
2058
+ function _isSlot$5(s) {
2059
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2060
+ }
2061
+
2062
+ const VTabs = defineComponent({
2063
+ name: 'VTabs',
2064
+ props: {
2065
+ modelValue: String,
2066
+ items: {
2067
+ type: Array,
2068
+ required: true // validator: (value: VTabsItem[]) => {
2069
+ // return Array.isArray(value) && value.length > 0;
2070
+ // },
2071
+
2072
+ },
2073
+
2074
+ /**
2075
+ * 自動スクロールする際の余剰オフセット幅(px)
2076
+ */
2077
+ autoScrollOffset: {
2078
+ type: Number,
2079
+ default: 20
2080
+ },
2081
+
2082
+ /**
2083
+ * ルーター同期する場合設定する
2084
+ */
2085
+ router: Function,
2086
+
2087
+ /**
2088
+ * ルーティング連携を行う際に、クエリベースのURLマッチングを行う
2089
+ * タブのURLが /page1?tab=xxx のようになる時に設定する
2090
+ */
2091
+ withQuery: Boolean,
2092
+ ...defineSlotsProps$1(),
2093
+ color: String
2094
+ },
2095
+ emits: {
2096
+ 'update:modelValue': newValue => true,
2097
+ change: newValue => true
1693
2098
  },
1694
2099
 
1695
2100
  setup(props, ctx) {
1696
2101
  const vui = useVui();
1697
- const elevation = useElevation(props, {
1698
- defaultValue: 4
2102
+ const internalValueRef = ref(null);
2103
+ const scrollerRef = useVScrollerRef();
2104
+ const elRef = ref(null);
2105
+ let scrollResult;
2106
+ const tabRefs = ref([]);
2107
+ const currentRef = computed({
2108
+ get: () => internalValueRef.value,
2109
+ set: value => {
2110
+ if (internalValueRef.value !== value) {
2111
+ internalValueRef.value = value;
2112
+ ctx.emit('update:modelValue', value);
2113
+ ctx.emit('change', value);
2114
+ }
2115
+ }
1699
2116
  });
1700
- const dense = computed(() => props.dense);
1701
- const color = useColorClasses({
1702
- color: () => props.color,
1703
- variant: () => props.variant || vui.setting('containedVariant')
2117
+ const colorScope = useScopeColorClass({
2118
+ color: () => props.color || vui.setting('tabDefault').color
1704
2119
  });
1705
- const classes = computed(() => {
1706
- return [elevation.elevationClassName.value, color.colorClasses.value, {
1707
- 'v-toolbar--plain': !color.color.value.value,
1708
- 'v-toolbar--dense': dense.value
1709
- }];
2120
+ const classes = computed(() => [colorScope.value.className]);
2121
+ const computedItemsRef = computed(() => {
2122
+ const current = currentRef.value;
2123
+ const {
2124
+ router
2125
+ } = props;
2126
+ return props.items.map(item => {
2127
+ const {
2128
+ value
2129
+ } = item;
2130
+ const active = current === value;
2131
+ let location;
2132
+
2133
+ if (router) {
2134
+ const to = router(value);
2135
+ const route = vui.router.resolve(to);
2136
+ location = {
2137
+ to,
2138
+ route
2139
+ };
2140
+ }
2141
+
2142
+ return { ...item,
2143
+ active,
2144
+ location
2145
+ };
2146
+ });
1710
2147
  });
1711
- return () => {
1712
- return createVNode("div", {
1713
- "class": ['v-toolbar', classes.value]
1714
- }, [renderSlotOrEmpty$1(ctx.slots, 'default')]);
1715
- };
1716
- }
1717
2148
 
1718
- });
2149
+ const setTabRef = ref => {
2150
+ tabRefs.value.push(ref);
2151
+ }; // const isMountedRef = ref(false);
1719
2152
 
1720
- function _isSlot$1(s) {
1721
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1722
- }
1723
2153
 
1724
- const VToolbarMenu = defineComponent({
1725
- name: 'VToolbarMenu',
1726
- inheritAttrs: false,
1727
- props: {},
2154
+ function setupInternalValue(routable) {
2155
+ let value = props.modelValue;
1728
2156
 
1729
- setup(props, ctx) {
1730
- const vui = useVui();
1731
- const plain = vui.setting('plainVariant');
1732
- return () => {
1733
- let _slot;
2157
+ if (value == null || value === '') {
2158
+ const firstItem = props.items[0];
2159
+ if (!firstItem) return;
2160
+ value = firstItem.value;
2161
+ }
1734
2162
 
1735
- const variant = props.variant || plain;
1736
- return createVNode(VButton, mergeProps(ctx.attrs, {
1737
- "variant": variant,
1738
- "class": ['v-toolbar-menu']
1739
- }), _isSlot$1(_slot = renderSlotOrEmpty$1(ctx.slots)) ? _slot : {
1740
- default: () => [_slot]
1741
- });
1742
- };
1743
- }
2163
+ if (internalValueRef.value !== value) {
2164
+ internalValueRef.value = value;
2165
+
2166
+ if (routable) {
2167
+ const {
2168
+ router
2169
+ } = props;
2170
+ if (!router) return;
2171
+ const hit = computedItemsRef.value.find(item => item.value === value);
2172
+ if (!hit) return;
2173
+ const {
2174
+ location
2175
+ } = hit;
2176
+ if (!location) return;
2177
+ const {
2178
+ to,
2179
+ route
2180
+ } = location;
2181
+ if (route.fullPath === vui.location.currentRoute.fullPath) return;
2182
+ vui.router[to.replace ? 'replace' : 'push'](to);
2183
+ } else if (!props.router && props.modelValue !== value) {
2184
+ ctx.emit('update:modelValue', value);
2185
+ ctx.emit('change', value);
2186
+ }
2187
+ }
2188
+ }
1744
2189
 
1745
- });
2190
+ function to(value) {
2191
+ currentRef.value = value;
2192
+ }
1746
2193
 
1747
- const VToolbarEdge = defineComponent({
1748
- name: 'VToolbarEdge',
1749
- props: {
1750
- edge: {
1751
- type: String,
1752
- required: true
2194
+ function cancelScroll() {
2195
+ if (scrollResult) {
2196
+ scrollResult.cancel();
2197
+ scrollResult = undefined;
2198
+ }
1753
2199
  }
1754
- },
1755
2200
 
1756
- setup(props, ctx) {
1757
- const edge = computed(() => props.edge);
1758
- return () => {
1759
- const children = renderSlotOrEmpty$1(ctx.slots, 'default');
2201
+ const findTab = tab => {
2202
+ return tabRefs.value.find(t => t.value === tab);
2203
+ };
2204
+
2205
+ function scrollToTab(tabValue) {
2206
+ const tab = findTab(tabValue);
2207
+ if (!tab) return;
2208
+ const $tab = tab.$el;
2209
+ if (!$tab) return;
2210
+ const scroller = scrollerRef.value;
2211
+ if (!scroller) return;
2212
+ const container = scroller.scroller.element();
2213
+ if (!container) return;
2214
+ const {
2215
+ autoScrollOffset
2216
+ } = props;
2217
+ const tabLeft = $tab.offsetLeft;
2218
+ const tabWidth = $tab.offsetWidth;
2219
+ const tabRight = tabLeft + tabWidth;
2220
+ let hiddenLeft = 0;
2221
+ let hiddenRight = 0;
2222
+ const {
2223
+ scrollLeft,
2224
+ offsetWidth: scrollerWidth
2225
+ } = container;
2226
+ hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
2227
+ hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
2228
+ if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
2229
+ if (hiddenRight > 0) hiddenRight += autoScrollOffset;
2230
+ let scrollAmmount = 0;
2231
+
2232
+ if (hiddenRight > 0) {
2233
+ scrollAmmount = hiddenRight;
2234
+ }
2235
+
2236
+ if (hiddenLeft > 0) {
2237
+ scrollAmmount = -hiddenLeft;
2238
+ }
2239
+
2240
+ if (Math.abs(scrollAmmount) > 0) {
2241
+ cancelScroll();
2242
+ scrollResult = scroller.scroller.by(scrollAmmount, 0, {
2243
+ duration: 150
2244
+ });
2245
+ }
2246
+ }
2247
+
2248
+ watch(() => props.modelValue, () => setupInternalValue(true));
2249
+ watch(() => props.items, () => setupInternalValue(), {
2250
+ deep: true
2251
+ });
2252
+ watch(() => internalValueRef.value, newValue => {
2253
+ scrollToTab(newValue);
2254
+ });
2255
+ vui.location.watchRoute(route => {
2256
+ if (!props.router) return;
2257
+ const path = props.withQuery ? route.fullPath : route.path;
2258
+ const hit = computedItemsRef.value.find(({
2259
+ location
2260
+ }) => {
2261
+ return location && location.route.fullPath === path;
2262
+ });
2263
+
2264
+ if (hit) {
2265
+ currentRef.value = hit.value;
2266
+ }
2267
+ }, {
2268
+ immediate: true
2269
+ });
2270
+ onMounted(() => {
2271
+ scrollToTab(currentRef.value);
2272
+ });
2273
+ onBeforeUnmount(() => {
2274
+ cancelScroll();
2275
+ });
2276
+ onBeforeUpdate(() => {
2277
+ tabRefs.value = [];
2278
+ });
2279
+ setupInternalValue();
2280
+ return () => {
2281
+ const items = computedItemsRef.value;
2282
+ const itemSlot = ctx.slots.item;
2283
+ const children = items.map(({
2284
+ value,
2285
+ active,
2286
+ label,
2287
+ icon,
2288
+ location
2289
+ }) => {
2290
+ if (!label) {
2291
+ label = itemSlot;
2292
+ }
2293
+
2294
+ const children = typeof label === 'function' ? label({
2295
+ value,
2296
+ active,
2297
+ vui
2298
+ }) : label;
2299
+
2300
+ const _to = location && location.to || undefined;
2301
+
2302
+ return createVNode(VTab, {
2303
+ "value": value,
2304
+ "to": _to,
2305
+ "icon": icon,
2306
+ "active": active,
2307
+ "ref": setTabRef,
2308
+ "onClick": e => {
2309
+ if (!e.defaultPrevented) {
2310
+ to(value);
2311
+ }
2312
+ }
2313
+ }, _isSlot$5(children) ? children : {
2314
+ default: () => [children]
2315
+ });
2316
+ });
2317
+ return createVNode("div", {
2318
+ "class": ['v-tabs', classes.value],
2319
+ "ref": elRef
2320
+ }, [createVNode(VScroller, {
2321
+ "class": "v-tabs__scroller",
2322
+ "containerClass": "v-tabs__scroller__container",
2323
+ "guide": true,
2324
+ "ref": scrollerRef
2325
+ }, {
2326
+ default: () => [createVNode("div", {
2327
+ "class": "v-tabs__content"
2328
+ }, [children])]
2329
+ })]);
2330
+ };
2331
+ }
2332
+
2333
+ });
2334
+
2335
+ function _isSlot$4(s) {
2336
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2337
+ }
2338
+
2339
+ const VBreadcrumbs = defineComponent({
2340
+ name: 'VBreadcrumbs',
2341
+ props: {
2342
+ items: {
2343
+ type: Array,
2344
+ default: () => []
2345
+ },
2346
+ divider: [String, Function] // ...defineSlotsProps<{}>(),
2347
+
2348
+ },
2349
+
2350
+ setup(props, ctx) {
2351
+ const vui = useVui();
2352
+ const computedItemsRef = computed(() => {
2353
+ const items = props.items.map(rawItem => {
2354
+ return typeof rawItem === 'string' ? {
2355
+ text: rawItem
2356
+ } : rawItem;
2357
+ });
2358
+ return items.map(item => {
2359
+ const {
2360
+ to,
2361
+ text
2362
+ } = item;
2363
+ const {
2364
+ disabled = vui.location.match(to) || !vui.location.isAvairable(to)
2365
+ } = item;
2366
+ return { ...item,
2367
+ disabled,
2368
+ text: typeof text === 'function' ? text(vui) : text
2369
+ };
2370
+ });
2371
+ });
2372
+ const lengthRef = computed(() => computedItemsRef.value.length);
2373
+
2374
+ const defaultDividerSlot = () => {
2375
+ return [createVNode("i", {
2376
+ "class": "v-breadcrumbs__divider__icon"
2377
+ }, null)];
2378
+ };
2379
+
2380
+ return () => {
2381
+ if (lengthRef.value < 1) return;
2382
+ let dividerSlot;
2383
+ const propDivider = props.divider;
2384
+
2385
+ if (propDivider) {
2386
+ dividerSlot = typeof propDivider === 'function' ? propDivider : () => propDivider;
2387
+ } else {
2388
+ dividerSlot = defaultDividerSlot;
2389
+ }
2390
+
2391
+ const children = [];
2392
+ computedItemsRef.value.forEach((item, index) => {
2393
+ const {
2394
+ text,
2395
+ icon,
2396
+ disabled,
2397
+ to
2398
+ } = item;
2399
+
2400
+ if (index > 0) {
2401
+ const divider = dividerSlot(vui);
2402
+
2403
+ if (divider) {
2404
+ children.push(createVNode("li", {
2405
+ "class": "v-breadcrumbs__divider",
2406
+ "key": `divider-${index}`
2407
+ }, [divider]));
2408
+ }
2409
+ }
2410
+
2411
+ const myChildren = [];
2412
+
2413
+ if (icon) {
2414
+ const $icon = resolveRawIconProp(false, icon, {
2415
+ class: 'v-breadcrumbs__icon'
2416
+ });
2417
+
2418
+ if ($icon) {
2419
+ myChildren.push($icon);
2420
+ }
2421
+ }
2422
+
2423
+ if (text) myChildren.push(text);
2424
+ const itemChild = to ? createVNode(VLink, {
2425
+ "class": "v-breadcrumbs__link",
2426
+ "to": to,
2427
+ "exactActiveClass": "v-breadcrumbs__link--active"
2428
+ }, _isSlot$4(myChildren) ? myChildren : {
2429
+ default: () => [myChildren]
2430
+ }) : myChildren;
2431
+ children.push(createVNode("li", {
2432
+ "class": ['v-breadcrumbs__item', {
2433
+ 'v-breadcrumbs__item--disabled': disabled
2434
+ }],
2435
+ "key": `link-${index}`
2436
+ }, [itemChild]));
2437
+ });
2438
+ return createVNode("nav", {
2439
+ "class": "v-breadcrumbs"
2440
+ }, [createVNode("ul", {
2441
+ "class": "v-breadcrumbs__list"
2442
+ }, [children])]);
2443
+ };
2444
+ }
2445
+
2446
+ });
2447
+
2448
+ function _isSlot$3(s) {
2449
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2450
+ }
2451
+
2452
+ const VContentSwitcher = defineComponent({
2453
+ name: 'VContentSwitcher',
2454
+ props: {
2455
+ modelValue: String,
2456
+ order: {
2457
+ type: Array,
2458
+ default: () => []
2459
+ },
2460
+ autotop: [Boolean, Object]
2461
+ },
2462
+ emits: {
2463
+ 'update:modelValue': modelValue => true
2464
+ },
2465
+
2466
+ setup(props, ctx) {
2467
+ const internalValueRef = ref('');
2468
+ const transitionRef = ref('');
2469
+ const elRef = ref(null);
2470
+ const anchorRef = ref(null);
2471
+ const computedOrderRef = computed(() => props.order.map(row => {
2472
+ return typeof row === 'string' ? row : row.value;
2473
+ }));
2474
+ const currentRef = computed({
2475
+ get: () => internalValueRef.value,
2476
+ set: current => {
2477
+ if (internalValueRef.value !== current) {
2478
+ internalValueRef.value = current;
2479
+ ctx.emit('update:modelValue', current);
2480
+ }
2481
+ }
2482
+ });
2483
+ const autotopSettingsRef = computed(() => {
2484
+ let {
2485
+ autotop: settings
2486
+ } = props;
2487
+ if (settings === true) settings = {};
2488
+ if (!settings) return;
2489
+ return { ...settings
2490
+ };
2491
+ });
2492
+
2493
+ function seeTop(options) {
2494
+ const scoller = getDocumentScroller$1();
2495
+ const {
2496
+ value: anchor
2497
+ } = anchorRef;
2498
+
2499
+ if (anchor) {
2500
+ scoller.toElement(anchor, options);
2501
+ }
2502
+ }
2503
+
2504
+ function getEl() {
2505
+ const el = elRef.value;
2506
+
2507
+ if (!el) {
2508
+ throw new Error('missing element');
2509
+ }
2510
+
2511
+ return el;
2512
+ }
2513
+
2514
+ watch(() => props.modelValue, (value, beforeValue) => {
2515
+ if (value == null) return;
2516
+ internalValueRef.value = value;
2517
+ if (beforeValue == null) return;
2518
+ const order = computedOrderRef.value;
2519
+ const index = order.indexOf(value);
2520
+ const beforeIndex = order.indexOf(beforeValue);
2521
+ let transition = 'fade';
2522
+
2523
+ if (index !== -1 && beforeIndex !== -1) {
2524
+ if (index > beforeIndex) transition = 'v-content-switcher-next';
2525
+ if (index < beforeIndex) transition = 'v-content-switcher-prev';
2526
+ }
2527
+
2528
+ transitionRef.value = transition;
2529
+ }, {
2530
+ immediate: true
2531
+ });
2532
+ watch(currentRef, () => {
2533
+ const autotopSettings = autotopSettingsRef.value;
2534
+
2535
+ if (autotopSettings && props.modelValue != null) {
2536
+ seeTop(autotopSettings);
2537
+ }
2538
+ });
2539
+ return () => {
2540
+ const current = currentRef.value;
2541
+ const children = renderSlotOrEmpty$1(ctx.slots) || [];
2542
+ const currentSlot = ctx.slots[current];
2543
+
2544
+ if (currentSlot) {
2545
+ children.push(createVNode("div", {
2546
+ "class": "v-content-switcher__content",
2547
+ "key": current
2548
+ }, [currentSlot(this)]));
2549
+ }
2550
+
2551
+ return createVNode("div", {
2552
+ "class": "v-content-switcher",
2553
+ "ref": elRef
2554
+ }, [createVNode("div", {
2555
+ "class": "v-content-switcher__anchor",
2556
+ "ref": anchorRef
2557
+ }, null), createVNode(Transition, {
2558
+ "name": transitionRef.value,
2559
+ "onBeforeLeave": el => {
2560
+ getEl().style.height = el.offsetHeight + 'px';
2561
+ },
2562
+ "onEnter": el => {
2563
+ getEl().style.height = el.offsetHeight + 'px';
2564
+ },
2565
+ "onAfterEnter": () => {
2566
+ getEl().style.height = '';
2567
+ },
2568
+ "onEnterCancelled": () => {
2569
+ getEl().style.height = '';
2570
+ },
2571
+ "onLeaveCancelled": () => {
2572
+ getEl().style.height = '';
2573
+ }
2574
+ }, _isSlot$3(children) ? children : {
2575
+ default: () => [children]
2576
+ })]);
2577
+ };
2578
+ }
2579
+
2580
+ });
2581
+
2582
+ const DATA_TABLE_DEFAULTS = {
2583
+ itemKey: 'id',
2584
+ pageQuery: 'page',
2585
+ sortQuery: 'sort',
2586
+ orderQuery: 'order',
2587
+ limitQuery: 'limit',
2588
+ defaultOrder: 'ASC',
2589
+ ascQueryValue: 'ASC',
2590
+ descQueryValue: 'DESC',
2591
+ limits: [5, 10, 20, 50, 100],
2592
+ limitDefault: 20,
2593
+ contorolThreshold: 10
2594
+ };
2595
+ function configureDataTableDefaults(defaults) {
2596
+ Object.assign(DATA_TABLE_DEFAULTS, defaults);
2597
+
2598
+ if (!defaults.defaultOrder && defaults.ascQueryValue) {
2599
+ DATA_TABLE_DEFAULTS.defaultOrder = defaults.ascQueryValue;
2600
+ }
2601
+ }
2602
+ const SELECTABLE_HEADER_SYMBOL = '__selectable_header__';
2603
+ const VDataTable = defineComponent({
2604
+ name: 'VDataTable',
2605
+ props: {
2606
+ /** 選択中のkeyの配列 */
2607
+ modelValue: {
2608
+ type: Array,
2609
+ default: () => []
2610
+ },
2611
+ itemKey: {
2612
+ type: String,
2613
+ default: () => DATA_TABLE_DEFAULTS.itemKey
2614
+ },
2615
+
2616
+ /**
2617
+ * ページネーションクエリ名
2618
+ */
2619
+ pageQuery: {
2620
+ type: String,
2621
+ default: () => DATA_TABLE_DEFAULTS.pageQuery
2622
+ },
2623
+
2624
+ /**
2625
+ * ソートクエリ名
2626
+ */
2627
+ sortQuery: {
2628
+ type: String,
2629
+ default: () => DATA_TABLE_DEFAULTS.sortQuery
2630
+ },
2631
+
2632
+ /**
2633
+ * 表示順クエリ名
2634
+ */
2635
+ orderQuery: {
2636
+ type: String,
2637
+ default: () => DATA_TABLE_DEFAULTS.orderQuery
2638
+ },
2639
+
2640
+ /**
2641
+ * リミット件数クエリ名
2642
+ */
2643
+ limitQuery: {
2644
+ type: String,
2645
+ default: () => DATA_TABLE_DEFAULTS.limitQuery
2646
+ },
2647
+ defaultOrder: {
2648
+ type: String,
2649
+ default: () => DATA_TABLE_DEFAULTS.defaultOrder
2650
+ },
2651
+ ascQueryValue: {
2652
+ type: String,
2653
+ default: () => DATA_TABLE_DEFAULTS.ascQueryValue
2654
+ },
2655
+ descQueryValue: {
2656
+ type: String,
2657
+ default: () => DATA_TABLE_DEFAULTS.descQueryValue
2658
+ },
2659
+ limits: {
2660
+ type: Array,
2661
+ default: () => DATA_TABLE_DEFAULTS.limits
2662
+ },
2663
+ limitDefault: {
2664
+ type: Number,
2665
+ default: () => DATA_TABLE_DEFAULTS.limitDefault
2666
+ },
2667
+ contorolThreshold: {
2668
+ type: Number,
2669
+ default: () => DATA_TABLE_DEFAULTS.contorolThreshold
2670
+ },
2671
+ headers: {
2672
+ type: Array,
2673
+ required: true
2674
+ },
2675
+ items: {
2676
+ type: Array,
2677
+ default: () => []
2678
+ },
2679
+ total: {
2680
+ type: Number,
2681
+ default: 0
2682
+ },
2683
+ selectable: Boolean,
2684
+ fixedHeader: Boolean,
2685
+ maxHeight: [Number, String]
2686
+ },
2687
+ emits: {
2688
+ input: selecteds => true
2689
+ },
2690
+
2691
+ setup(props, ctx) {
2692
+ const vui = useVui();
2693
+ const bootedRef = ref(false);
2694
+ const footerHeightRef = ref(0);
2695
+ const internalValues = ref(props.modelValue.slice());
2696
+ const sortedItemKeysRef = computed(() => props.items.map(item => item[props.itemKey]));
2697
+ const isEmptyRef = computed(() => props.items.length === 0);
2698
+ const headersRef = computed(() => {
2699
+ const {
2700
+ headers,
2701
+ selectable
2702
+ } = props;
2703
+ const ret = [];
2704
+
2705
+ if (selectable) {
2706
+ ret.push({
2707
+ key: SELECTABLE_HEADER_SYMBOL
2708
+ });
2709
+ }
2710
+
2711
+ ret.push(...headers.filter(h => !h.hidden));
2712
+ return ret;
2713
+ });
2714
+ const classesRef = computed(() => [{
2715
+ 'v-data-table--fixed-header': props.fixedHeader
2716
+ }]);
2717
+ const layout = VAppLayoutControl.use();
2718
+ const bodyInnerStylesRef = computed(() => {
2719
+ if (!bootedRef.value) return;
2720
+ const {
2721
+ fixedHeader,
2722
+ maxHeight
2723
+ } = props;
2724
+ const footerHeight = footerHeightRef.value;
2725
+
2726
+ const _maxHeight = maxHeight || (fixedHeader ? '100%' : maxHeight);
2727
+
2728
+ if (!_maxHeight) {
2729
+ return;
2730
+ }
2731
+
2732
+ return {
2733
+ maxHeight: layout.calicurateViewHeight(_maxHeight, -footerHeight - 100, 200)
2734
+ };
2735
+ });
2736
+ const defaultOrderQueryRef = computed(() => props.defaultOrder === props.ascQueryValue ? props.ascQueryValue : props.descQueryValue);
2737
+ const isTransitioningRef = computed(() => {
2738
+ return vui.location.isQueryOnlyTransitioning([props.pageQuery, props.sortQuery, props.orderQuery, props.limitQuery]);
2739
+ });
2740
+ const pageRef = computed(() => vui.location.getQuery(props.pageQuery, Number, 1));
2741
+ const needShowHeaderControlRef = computed(() => props.items.length > props.contorolThreshold);
2742
+ const sortByRef = computed({
2743
+ get: () => {
2744
+ return vui.location.getQuery(props.sortQuery);
2745
+ },
2746
+
2747
+ set(value) {
2748
+ vui.location.pushQuery({
2749
+ [props.sortQuery]: value || null,
2750
+ [props.pageQuery]: 1
2751
+ });
2752
+ }
2753
+
2754
+ });
2755
+ const ordersRef = computed(() => [props.ascQueryValue, props.descQueryValue]);
2756
+ const usePaigingRef = computed(() => props.limits.length > 0);
2757
+ const orderByRef = computed({
2758
+ get: () => {
2759
+ const value = vui.location.getQuery(props.orderQuery);
2760
+
2761
+ if (typeof value !== 'string' || !ordersRef.value.includes(value)) {
2762
+ return;
2763
+ }
2764
+
2765
+ return value;
2766
+ },
2767
+
2768
+ set(value) {
2769
+ vui.location.pushQuery({
2770
+ [props.orderQuery]: value || null,
2771
+ [props.pageQuery]: 1
2772
+ });
2773
+ }
2774
+
2775
+ });
2776
+ const offsetRef = computed(() => (pageRef.value - 1) * limitRef.value);
2777
+ const limitRef = computed({
2778
+ get: () => vui.location.getQuery(props.limitQuery, Number, props.limitDefault),
2779
+ set: value => {
2780
+ const page = Math.floor(offsetRef.value / value) + 1;
2781
+ vui.location.pushQuery({
2782
+ [props.limitQuery]: value,
2783
+ [props.pageQuery]: page
2784
+ });
2785
+ }
2786
+ });
2787
+ const pageLengthRef = computed(() => {
2788
+ const {
2789
+ total
2790
+ } = props;
2791
+ const _limit = limitRef.value;
2792
+ if (!total) return 0;
2793
+ return Math.ceil(total / _limit);
2794
+ });
2795
+ const lengthRef = computed(() => props.items.length);
2796
+ const isASCRef = computed(() => orderByRef.value === props.ascQueryValue); // const isDESCRef = computed(() => orderByRef.value === props.descQueryValue);
2797
+
2798
+ const sortIconRef = computed(() => {
2799
+ let icon = vui.icon('sort');
2800
+
2801
+ if (typeof icon === 'string') {
2802
+ const name = icon;
2803
+
2804
+ icon = gen => {
2805
+ return gen({
2806
+ name,
2807
+ rotate: isASCRef.value ? 180 : 0
2808
+ });
2809
+ };
2810
+ }
2811
+
2812
+ return icon;
2813
+ });
2814
+ const isIndeterminateRef = computed(() => {
2815
+ const {
2816
+ length
2817
+ } = internalValues.value;
2818
+ return length > 0 && length < sortedItemKeysRef.value.length;
2819
+ });
2820
+ const isAllSelectedRef = computed(() => internalValues.value.length === sortedItemKeysRef.value.length);
2821
+
2822
+ function setSort(settings) {
2823
+ const {
2824
+ sort,
2825
+ order
2826
+ } = settings;
2827
+ if ((sort === undefined || sortByRef.value === sort) && (order === undefined || orderByRef.value === order)) return;
2828
+ const queries = {};
2829
+
2830
+ if (sort) {
2831
+ queries[props.sortQuery] = sort;
2832
+ }
2833
+
2834
+ if (order) {
2835
+ queries[props.orderQuery] = order;
2836
+ }
2837
+
2838
+ vui.location.pushQuery({ ...queries,
2839
+ [props.pageQuery]: 1
2840
+ });
2841
+ }
2842
+
2843
+ function toggleOrderBy() {
2844
+ return setSort({
2845
+ order: orderByRef.value === props.ascQueryValue ? props.descQueryValue : props.ascQueryValue
2846
+ });
2847
+ }
2848
+
2849
+ function isSelected(key) {
2850
+ return internalValues.value.includes(key);
2851
+ }
2852
+
2853
+ function select(key) {
2854
+ if (!internalValues.value.includes(key)) {
2855
+ const values = internalValues.value.slice();
2856
+ values.push(key);
2857
+ const sortedKeys = sortedItemKeysRef.value;
2858
+ values.sort((a, b) => {
2859
+ const ai = sortedKeys.indexOf(a);
2860
+ const bi = sortedKeys.indexOf(b);
2861
+ if (ai < bi) return -1;
2862
+ if (ai > bi) return 1;
2863
+ return 0;
2864
+ });
2865
+ internalValues.value = values;
2866
+ ctx.emit('input', values);
2867
+ }
2868
+ }
2869
+
2870
+ function selectAll() {
2871
+ if (!isAllSelectedRef.value) {
2872
+ const values = sortedItemKeysRef.value.slice();
2873
+ internalValues.value = values;
2874
+ ctx.emit('input', values);
2875
+ }
2876
+ }
2877
+
2878
+ function deselectAll() {
2879
+ if (internalValues.value.length) {
2880
+ const values = [];
2881
+ internalValues.value = values;
2882
+ ctx.emit('input', values);
2883
+ }
2884
+ }
2885
+
2886
+ function deselect(key) {
2887
+ const values = internalValues.value.slice();
2888
+ const index = values.indexOf(key);
2889
+
2890
+ if (index !== -1) {
2891
+ values.splice(index, 1);
2892
+ internalValues.value = values;
2893
+ ctx.emit('input', values);
2894
+ }
2895
+ }
2896
+
2897
+ function handleClickSortHeader(header, ev) {
2898
+ const {
2899
+ sortQuery
2900
+ } = header;
2901
+ if (!sortQuery) return;
2902
+
2903
+ if (sortByRef.value === sortQuery) {
2904
+ return toggleOrderBy();
2905
+ }
2906
+
2907
+ return setSort({
2908
+ sort: sortQuery,
2909
+ order: defaultOrderQueryRef.value
2910
+ });
2911
+ }
2912
+
2913
+ function genPagination() {
2914
+ return createVNode(VPagination, {
2915
+ "class": "v-data-table__pagination",
2916
+ "dense": true,
2917
+ "align": "right",
2918
+ "routeQuery": props.pageQuery,
2919
+ "modelValue": pageRef.value,
2920
+ "length": pageLengthRef.value
2921
+ }, null);
2922
+ }
2923
+
2924
+ function genControls() {
2925
+ const {
2926
+ total
2927
+ } = props;
2928
+ const offset = offsetRef.value;
2929
+ const length = lengthRef.value;
2930
+ return createVNode("div", {
2931
+ "class": "v-data-table__controls"
2932
+ }, [createVNode("div", {
2933
+ "class": "v-data-table__controls__info"
2934
+ }, [createVNode("small", {
2935
+ "class": "v-data-table__controls__info__length"
2936
+ }, [createTextVNode("\u5168 "), total, createTextVNode(" \u4EF6\u4E2D "), offset + 1, createTextVNode(" \u4EF6 \u301C "), offset + length, createTextVNode(" \u4EF6\u3092\u8868\u793A")])]), createVNode("div", {
2937
+ "class": "v-data-table__controls__select-limit"
2938
+ }, [createVNode("span", {
2939
+ "class": "v-data-table__controls__select-limit__prefix"
2940
+ }, [createTextVNode("1\u30DA\u30FC\u30B8\u306B")]), createVNode(VSelect, {
2941
+ "class": "v-data-table__controls__select-limit__node",
2942
+ "size": "sm",
2943
+ "hiddenInfo": true,
2944
+ "disabled": isTransitioningRef.value,
2945
+ "items": props.limits.map(limit => {
2946
+ return {
2947
+ label: `${limit}件`,
2948
+ value: limit
2949
+ };
2950
+ }),
2951
+ "modelValue": limitRef.value,
2952
+ "onUpdate:modelValue": $event => limitRef.value = $event
2953
+ }, null)]), createVNode("div", {
2954
+ "class": "v-data-table__controls__pagination"
2955
+ }, [genPagination()])]);
2956
+ }
2957
+
2958
+ function genTableHeader() {
2959
+ const sortBy = sortByRef.value;
2960
+ const isIndeterminate = isIndeterminateRef.value;
2961
+ const isAllSelected = isAllSelectedRef.value;
2962
+ const {
2963
+ defaultOrder,
2964
+ ascQueryValue
2965
+ } = props;
2966
+ const usePaiging = usePaigingRef.value;
2967
+ const children = headersRef.value.map(header => {
2968
+ const {
2969
+ label,
2970
+ sortQuery,
2971
+ align,
2972
+ key
2973
+ } = header;
2974
+ const headerChildren = [];
2975
+
2976
+ if (label != null && typeof label !== 'boolean') {
2977
+ let _children = typeof label === 'function' ? label(vui) : label;
2978
+
2979
+ if (_children && !Array.isArray(_children) && typeof _children === 'object') {
2980
+ _children = JSON.stringify(_children);
2981
+ }
2982
+
2983
+ headerChildren.push(_children);
2984
+ }
2985
+
2986
+ if (key === SELECTABLE_HEADER_SYMBOL) {
2987
+ headerChildren.push(createVNode(VCheckbox, {
2988
+ "modelValue": isAllSelected,
2989
+ "indeterminate": isIndeterminate,
2990
+ "onChange": ev => {
2991
+ if (isAllSelectedRef.value) {
2992
+ deselectAll();
2993
+ } else {
2994
+ selectAll();
2995
+ }
2996
+ }
2997
+ }, null));
2998
+ } // if (key === DELETOR_HEADER_SYMBOL) {
2999
+ // headerChildren.push('削除');
3000
+ // }
3001
+
3002
+
3003
+ const sortActive = sortBy === sortQuery;
3004
+
3005
+ if (sortQuery && usePaiging) {
3006
+ const isASC = sortActive ? isASCRef.value : defaultOrder === ascQueryValue;
3007
+ headerChildren.unshift(createVNode(VIcon, {
3008
+ "class": "v-data-table__table__sort-icon v-data-table__table__sort-icon--empty",
3009
+ "name": "$empty"
3010
+ }, null));
3011
+ headerChildren.push(resolveRawIconProp(false, sortIconRef.value, {
3012
+ class: ['v-data-table__table__sort-icon v-data-table__table__sort-icon--arrow', {
3013
+ 'v-data-table__table__sort-icon--asc': isASC,
3014
+ 'v-data-table__table__sort-icon--desc': !isASC
3015
+ }]
3016
+ }));
3017
+ }
3018
+
3019
+ const classes = ['v-data-table__table__cell', {
3020
+ 'v-data-table__table__cell--active': sortActive
3021
+ }];
3022
+
3023
+ if (align) {
3024
+ classes.push(`v-data-table__table__cell--${align}`);
3025
+ }
3026
+
3027
+ return createVNode("th", {
3028
+ "class": classes,
3029
+ "key": header.key,
3030
+ "tabindex": sortQuery && usePaiging ? 0 : undefined,
3031
+ "onClick": ev => {
3032
+ if (!sortQuery || !usePaiging) return;
3033
+ handleClickSortHeader(header);
3034
+ }
3035
+ }, [createVNode("div", {
3036
+ "class": "v-data-table__table__cell__tile"
3037
+ }, [headerChildren])]);
3038
+ });
3039
+ return createVNode("thead", {
3040
+ "class": "v-data-table__table__header"
3041
+ }, [createVNode("tr", null, [children])]);
3042
+ }
3043
+
3044
+ function toggleSelect(key) {
3045
+ return isSelected(key) ? deselect(key) : select(key);
3046
+ }
3047
+
3048
+ function defaultItemSlot(payload) {
3049
+ const {
3050
+ key,
3051
+ item,
3052
+ selected
3053
+ } = payload;
3054
+ const headers = headersRef.value; // const { $scopedSlots, $createElement, deletor } = this;
3055
+
3056
+ const children = headers.map(header => {
3057
+ const {
3058
+ cell,
3059
+ align,
3060
+ key: headerKey
3061
+ } = header;
3062
+ const cellSlot = cell || ctx.slots.cell;
3063
+ let cellChildren;
3064
+
3065
+ if (cellSlot) {
3066
+ const cellPayload = {
3067
+ vui,
3068
+ item,
3069
+ selected
3070
+ };
3071
+
3072
+ let _children = cellSlot(cellPayload);
3073
+
3074
+ if (_children && !Array.isArray(_children) && typeof _children === 'object') {
3075
+ _children = JSON.stringify(_children);
3076
+ }
3077
+
3078
+ cellChildren = _children;
3079
+ }
3080
+
3081
+ if (!cellChildren) {
3082
+ switch (headerKey) {
3083
+ case SELECTABLE_HEADER_SYMBOL:
3084
+ {
3085
+ cellChildren = [createVNode(VCheckbox, {
3086
+ "modelValue": selected,
3087
+ "onChange": ev => {
3088
+ toggleSelect(key);
3089
+ }
3090
+ }, null)];
3091
+ break;
3092
+ }
3093
+ // case DELETOR_HEADER_SYMBOL: {
3094
+ // if (deletor) {
3095
+ // const onClick = async (event: MouseEvent) => {
3096
+ // if (
3097
+ // await this.$confirm(`${key}を削除します。よろしいですか?`)
3098
+ // ) {
3099
+ // this.deletingTargets.push(key);
3100
+ // await deletor(item);
3101
+ // this.deletingTargets.splice(
3102
+ // this.deletingTargets.indexOf(key),
3103
+ // 1,
3104
+ // );
3105
+ // }
3106
+ // };
3107
+ // cellChildren = [
3108
+ // <VBtn
3109
+ // icon="trush"
3110
+ // onClick={onClick}
3111
+ // disabled={this.deletingTargets.includes(key)}
3112
+ // />,
3113
+ // ];
3114
+ // }
3115
+ // break;
3116
+ // }
3117
+ }
3118
+ }
3119
+
3120
+ const classes = align ? {
3121
+ [`v-data-table__table__cell--${align}`]: true
3122
+ } : undefined;
3123
+ return createVNode("td", {
3124
+ "class": ['v-data-table__table__cell', classes],
3125
+ "key": header.key
3126
+ }, [cellChildren]);
3127
+ });
3128
+ return createVNode("tr", {
3129
+ "class": ['v-data-table__table__item', {
3130
+ 'v-data-table__table__item--selected': selected
3131
+ }],
3132
+ "key": key
3133
+ }, [children]);
3134
+ }
3135
+
3136
+ function genBody() {
3137
+ const {
3138
+ items,
3139
+ itemKey
3140
+ } = props;
3141
+ const {
3142
+ item: itemSlot = defaultItemSlot
3143
+ } = ctx.slots;
3144
+ const children = items.map(item => {
3145
+ const key = item[itemKey];
3146
+ const payload = {
3147
+ key,
3148
+ item,
3149
+ selected: isSelected(key)
3150
+ };
3151
+ return itemSlot(payload);
3152
+ });
3153
+ return createVNode("tbody", {
3154
+ "class": "v-data-table__table__body"
3155
+ }, [children]);
3156
+ }
3157
+
3158
+ watch(() => props.modelValue, modelValue => {
3159
+ internalValues.value = modelValue.slice();
3160
+ });
3161
+ watch(() => props.items, items => {
3162
+ internalValues.value = internalValues.value.filter(key => {
3163
+ return sortedItemKeysRef.value.includes(key);
3164
+ });
3165
+ });
3166
+ onMounted(() => {
3167
+ bootedRef.value = true;
3168
+ });
3169
+ return () => {
3170
+ const isEmpty = isEmptyRef.value;
3171
+ const usePaiging = usePaigingRef.value;
3172
+ return createVNode("div", {
3173
+ "class": ['v-data-table', classesRef.value]
3174
+ }, [!isEmpty && usePaiging && needShowHeaderControlRef.value && createVNode("div", {
3175
+ "class": "v-data-table__header"
3176
+ }, [genControls()]), createVNode("div", {
3177
+ "class": "v-data-table__body container-pull"
3178
+ }, [isEmpty ? createVNode("div", {
3179
+ "class": "v-data-table__empty--message"
3180
+ }, null) : createVNode(VPaper, {
3181
+ "class": "v-data-table__body__inner",
3182
+ "style": bodyInnerStylesRef.value
3183
+ }, {
3184
+ default: () => [createVNode("div", {
3185
+ "class": "v-data-table__table-wrapper"
3186
+ }, [createVNode("table", {
3187
+ "class": "v-data-table__table"
3188
+ }, [genTableHeader(), genBody()])])]
3189
+ }), createVNode(Transition, {
3190
+ "name": "fade"
3191
+ }, {
3192
+ default: () => [isTransitioningRef.value && createVNode("div", {
3193
+ "class": "v-data-table__loading"
3194
+ }, [createVNode(VProgressCircular, {
3195
+ "indeterminate": true
3196
+ }, null)])]
3197
+ })]), !isEmpty && usePaiging && withDirectives(createVNode("div", {
3198
+ "class": "v-data-table__footer"
3199
+ }, [genControls()]), [resizeDirectiveArgument(({
3200
+ height
3201
+ }) => {
3202
+ footerHeightRef.value = height;
3203
+ })])]);
3204
+ };
3205
+ }
3206
+
3207
+ });
3208
+
3209
+ function _isSlot$2(s) {
3210
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3211
+ }
3212
+
3213
+ const VApp = defineComponent({
3214
+ name: 'VApp',
3215
+
3216
+ setup(props, ctx) {
3217
+ useInjectTheme();
3218
+ return () => {
3219
+ let _slot;
3220
+
3221
+ return createVNode(VStackRoot, null, _isSlot$2(_slot = renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
3222
+ default: () => [_slot]
3223
+ });
3224
+ };
3225
+ }
3226
+
3227
+ });
3228
+
3229
+ const VToolbar = defineComponent({
3230
+ name: 'VToolbar',
3231
+ props: { ...createElevationProps(),
3232
+ ...colorSchemeProps(),
3233
+ dense: Boolean
3234
+ },
3235
+
3236
+ setup(props, ctx) {
3237
+ const vui = useVui();
3238
+ const elevation = useElevation(props, {
3239
+ defaultValue: 4
3240
+ });
3241
+ const dense = computed(() => props.dense);
3242
+ const color = useColorClasses({
3243
+ color: () => props.color,
3244
+ variant: () => props.variant || vui.setting('containedVariant')
3245
+ });
3246
+ const classes = computed(() => {
3247
+ return [elevation.elevationClassName.value, color.colorClasses.value, {
3248
+ 'v-toolbar--plain': !color.color.value.value,
3249
+ 'v-toolbar--dense': dense.value
3250
+ }];
3251
+ });
3252
+ return () => {
3253
+ return createVNode("div", {
3254
+ "class": ['v-toolbar', classes.value]
3255
+ }, [renderSlotOrEmpty$1(ctx.slots, 'default')]);
3256
+ };
3257
+ }
3258
+
3259
+ });
3260
+
3261
+ function _isSlot$1(s) {
3262
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3263
+ }
3264
+
3265
+ const VToolbarMenu = defineComponent({
3266
+ name: 'VToolbarMenu',
3267
+ inheritAttrs: false,
3268
+ props: {},
3269
+
3270
+ setup(props, ctx) {
3271
+ const vui = useVui();
3272
+ const plain = vui.setting('plainVariant');
3273
+ return () => {
3274
+ let _slot;
3275
+
3276
+ const variant = props.variant || plain;
3277
+ return createVNode(VButton, mergeProps(ctx.attrs, {
3278
+ "variant": variant,
3279
+ "class": ['v-toolbar-menu']
3280
+ }), _isSlot$1(_slot = renderSlotOrEmpty$1(ctx.slots)) ? _slot : {
3281
+ default: () => [_slot]
3282
+ });
3283
+ };
3284
+ }
3285
+
3286
+ });
3287
+
3288
+ const VToolbarEdge = defineComponent({
3289
+ name: 'VToolbarEdge',
3290
+ props: {
3291
+ edge: {
3292
+ type: String,
3293
+ required: true
3294
+ }
3295
+ },
3296
+
3297
+ setup(props, ctx) {
3298
+ const edge = computed(() => props.edge);
3299
+ return () => {
3300
+ const children = renderSlotOrEmpty$1(ctx.slots, 'default');
1760
3301
  const hasChildren = !!children && children.length > 0;
1761
3302
  return createVNode("div", {
1762
3303
  "class": ['v-toolbar-edge', `v-toolbar-edge--${edge.value}`, {
@@ -1806,13 +3347,27 @@ class VuiService {
1806
3347
  autoScrollToElementOffsetTop;
1807
3348
  textareaRows;
1808
3349
  requiredChip;
3350
+ router;
3351
+ location;
1809
3352
  constructor(options) {
1810
3353
  this.options = options;
3354
+ this.configure();
1811
3355
  const { selectionSeparator = () => ', ', autoScrollToElementOffsetTop = DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP, textareaRows = DEFAULT_TEXTAREA_ROWS, requiredChip = () => '*', } = options;
1812
3356
  this.selectionSeparator = selectionSeparator;
1813
3357
  this.autoScrollToElementOffsetTop = autoScrollToElementOffsetTop;
1814
3358
  this.textareaRows = textareaRows;
1815
3359
  this.requiredChip = requiredChip;
3360
+ this.router = options.router;
3361
+ this.location = new LocationService({
3362
+ router: this.router,
3363
+ });
3364
+ }
3365
+ configure(options) {
3366
+ options && Object.assign(this.options, options);
3367
+ setDefaultRouterLink(this.getRouterLink());
3368
+ }
3369
+ getRouterLink() {
3370
+ return this.options.RouterLink || RouterLink;
1816
3371
  }
1817
3372
  setting(key) {
1818
3373
  return this.options.uiSettings[key];
@@ -1890,4 +3445,4 @@ function installVuiPlugin(app, opts) {
1890
3445
  return app.use(VuiPlugin, opts);
1891
3446
  }
1892
3447
 
1893
- export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, VApp, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VDrawerLayout, VForm, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, 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, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
3448
+ 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 };