@fastkit/vui 0.6.18 → 0.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,15 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vueKit = require('@fastkit/vue-kit');
6
+ var vueUtils = require('@fastkit/vue-utils');
6
7
  var vue = require('vue');
7
8
  var vueColorScheme = require('@fastkit/vue-color-scheme');
8
- var vueUtils = require('@fastkit/vue-utils');
9
9
  var vueLoading = require('@fastkit/vue-loading');
10
10
  var iconFont = require('@fastkit/icon-font');
11
+ var helpers = require('@fastkit/helpers');
11
12
  var vueRouter = require('vue-router');
13
+ var vueAppLayout = require('@fastkit/vue-app-layout');
14
+ var vueScroller = require('@fastkit/vue-scroller');
12
15
 
13
16
  const CONTROL_SIZES = ['sm', 'md', 'lg'];
14
17
  const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
@@ -162,7 +165,7 @@ const VFormControl = vue.defineComponent({
162
165
  }
163
166
  }, [label, control.required && vui.getRequiredChip()]), vue.createVNode("div", {
164
167
  "class": "v-form-control__body"
165
- }, [vueKit.renderSlotOrEmpty(ctx.slots, 'default', control), vue.createVNode("div", {
168
+ }, [vueKit.renderSlotOrEmpty(ctx.slots, 'default', control), !props.hiddenInfo && vue.createVNode("div", {
166
169
  "class": "v-form-control__info"
167
170
  }, [!!message && vue.createVNode("div", {
168
171
  "class": "v-form-control__message"
@@ -215,6 +218,7 @@ function defineFormSelectorComponent(opts) {
215
218
  return vue.createVNode(VFormControl, {
216
219
  "nodeControl": this.nodeControl,
217
220
  "focused": this.nodeControl.focused,
221
+ "hiddenInfo": this.hiddenInfo,
218
222
  "class": ['v-form-selector', className, { ...this.classes,
219
223
  'v-form-selector--stacked': this.stacked
220
224
  }],
@@ -531,6 +535,299 @@ const VButton = vue.defineComponent({
531
535
 
532
536
  });
533
537
 
538
+ function _isSlot$b(s) {
539
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
540
+ }
541
+
542
+ const PAGINATION_ALIGNS = ['left', 'center', 'right'];
543
+ function paginationProps() {
544
+ return vueUtils.createPropsOptions({
545
+ /**
546
+ * Active Pages
547
+ */
548
+ modelValue: {
549
+ type: vueUtils.rawNumberPropType,
550
+ default: 1
551
+ },
552
+
553
+ /**
554
+ * Total number of pages
555
+ */
556
+ length: {
557
+ type: vueUtils.rawNumberPropType,
558
+ default: 0
559
+ },
560
+
561
+ /**
562
+ * Maximum number of links to display.
563
+ */
564
+ totalVisible: vueUtils.rawNumberPropType,
565
+
566
+ /**
567
+ * true when narrowing
568
+ */
569
+ dense: Boolean,
570
+ disabled: Boolean,
571
+ align: {
572
+ type: String,
573
+ default: 'center'
574
+ },
575
+
576
+ /**
577
+ * To synchronize with a query, use the query name
578
+ */
579
+ routeQuery: String,
580
+ beforeChange: Function,
581
+ color: String
582
+ });
583
+ }
584
+ const VPagination = vue.defineComponent({
585
+ name: 'VPagination',
586
+ props: paginationProps(),
587
+ emits: {
588
+ change: page => true
589
+ },
590
+
591
+ setup(props, ctx) {
592
+ const vui = useVui();
593
+ const elRef = vue.ref(null);
594
+ const router = vueRouter.useRouter();
595
+ const internalValue = vue.ref(1);
596
+ const containerWidth = vue.ref(0);
597
+ const itemSize = vue.ref(0);
598
+ const capacityLength = vue.computed(() => {
599
+ const _itemSize = itemSize.value;
600
+ if (!_itemSize) return 0;
601
+ return Math.floor(containerWidth.value / _itemSize);
602
+ });
603
+ const colorScope = vueColorScheme.useScopeColorClass({
604
+ color: () => props.color || vui.setting('primaryScope')
605
+ });
606
+ const computedLength = vue.computed(() => vueUtils.resolveNumberish(props.length));
607
+ const computedTotalVisible = vue.computed(() => vueUtils.resolveNumberish(props.totalVisible));
608
+ const computedNumbersLength = vue.computed(() => capacityLength.value - 2 - 2);
609
+ const computedPage = vue.computed(() => {
610
+ const {
611
+ routeQuery
612
+ } = props;
613
+
614
+ if (routeQuery) {
615
+ return vui.location.getQuery(routeQuery, Number, 1);
616
+ }
617
+
618
+ return internalValue.value;
619
+ });
620
+
621
+ const _range = (from, to) => {
622
+ const range = [];
623
+ from = from > 0 ? from : 1;
624
+
625
+ for (let i = from; i <= to; i++) {
626
+ range.push(i);
627
+ }
628
+
629
+ return range;
630
+ };
631
+
632
+ const computedItems = vue.computed(() => {
633
+ const maxButtons = computedNumbersLength.value;
634
+ const totalVisible = computedTotalVisible.value;
635
+ const length = computedLength.value;
636
+ const pageValue = computedPage.value;
637
+ const maxLength = Math.min(Math.max(0, totalVisible || 0) || length, Math.max(0, maxButtons) || length, length);
638
+
639
+ if (length <= maxLength) {
640
+ return _range(1, length);
641
+ }
642
+
643
+ const even = maxLength % 2 === 0 ? 1 : 0;
644
+ const left = Math.floor(maxLength / 2);
645
+ const right = length - left + 1 + even;
646
+
647
+ if (pageValue > left && pageValue < right) {
648
+ const start = pageValue - left + 2;
649
+ const end = pageValue + left - 2 - even;
650
+ return [1, 'truncate', ..._range(start, end), 'truncate', length];
651
+ } else if (pageValue === left) {
652
+ const end = pageValue + left - 1 - even;
653
+ return [..._range(1, end), 'truncate', length];
654
+ } else if (pageValue === right) {
655
+ const start = pageValue - left + 1;
656
+ return [1, 'truncate', ..._range(start, length)];
657
+ } else {
658
+ return [..._range(1, left), 'truncate', ..._range(right, length)];
659
+ }
660
+ });
661
+ const isActive = vue.computed(() => computedLength.value > 1);
662
+ const isTransitioning = vue.computed(() => {
663
+ const {
664
+ routeQuery
665
+ } = props;
666
+ return vui.location.isQueryOnlyTransitioning(routeQuery);
667
+ });
668
+ const isDisabled = vue.computed(() => props.disabled || isTransitioning.value);
669
+ const classes = vue.computed(() => [{
670
+ 'v-pagination--disabled': isDisabled.value,
671
+ 'v-pagination--dense': props.dense,
672
+ [`v-pagination--${props.align}`]: true
673
+ }, colorScope.value.className]);
674
+
675
+ async function setPage(value) {
676
+ if (isDisabled.value) return;
677
+ const {
678
+ beforeChange,
679
+ routeQuery
680
+ } = props;
681
+ const newPage = vueUtils.resolveNumberish(value);
682
+ if (computedPage.value === newPage) return;
683
+
684
+ if (beforeChange) {
685
+ try {
686
+ let result = beforeChange(newPage);
687
+ if (helpers.isPromise(result)) result = await result;
688
+ if (result === false) return;
689
+ } catch (e) {}
690
+ }
691
+
692
+ if (routeQuery) {
693
+ const to = createRoutableLocationByPage(newPage, routeQuery);
694
+ return router.push(to).then(failure => {
695
+ !failure && ctx.emit('change', newPage);
696
+ });
697
+ } else {
698
+ internalValue.value = newPage;
699
+ ctx.emit('update:modelValue', newPage);
700
+ ctx.emit('change', newPage);
701
+ }
702
+ }
703
+
704
+ function createPageInfo(source) {
705
+ const currentPage = computedPage.value;
706
+ const length = computedLength.value;
707
+ let number;
708
+ let page;
709
+ let active;
710
+ let disabled;
711
+
712
+ if (typeof source === 'number') {
713
+ number = true;
714
+ page = source;
715
+ active = currentPage === page;
716
+ disabled = false;
717
+ } else if (source === 'truncate') {
718
+ number = false;
719
+ active = false;
720
+ disabled = false;
721
+ } else {
722
+ number = false;
723
+ const isPrev = source === 'prev';
724
+ const ammount = isPrev ? -1 : 1;
725
+ page = currentPage + ammount;
726
+ active = false;
727
+ disabled = page < 1 || page > length;
728
+ }
729
+
730
+ return {
731
+ number,
732
+ page,
733
+ active,
734
+ disabled
735
+ };
736
+ }
737
+
738
+ function createRoutableLocationByPage(page, routeQuery) {
739
+ return vui.location.getQueryMergedLocation({
740
+ [routeQuery]: page
741
+ });
742
+ }
743
+
744
+ function genItem(source, index) {
745
+ const {
746
+ number,
747
+ page,
748
+ active,
749
+ disabled
750
+ } = createPageInfo(source);
751
+ const type = number ? 'num' : source;
752
+ const classes = ['v-pagination__item', {
753
+ [`v-pagination__item--${type}`]: true,
754
+ 'v-pagination__item--active': active,
755
+ 'v-pagination__item--disabled': disabled
756
+ }];
757
+ const children = number ? page : (() => {
758
+ if (type === 'truncate') {
759
+ return vue.createVNode("span", null, [vue.createTextVNode("...")]);
760
+ }
761
+
762
+ const isPrev = type === 'prev';
763
+ const icon = isPrev ? vui.icon('prev') : vui.icon('next');
764
+ return resolveRawIconProp(false, icon, {
765
+ class: 'v-pagination__item__icon'
766
+ });
767
+ })();
768
+
769
+ const onClick = ev => {
770
+ ev.preventDefault();
771
+ if (page === undefined || active || disabled) return;
772
+ setPage(page);
773
+ };
774
+
775
+ const key = `${source}-${index}`;
776
+ const {
777
+ routeQuery
778
+ } = props;
779
+
780
+ if (page !== undefined && routeQuery) {
781
+ const to = createRoutableLocationByPage(page, routeQuery);
782
+ return vue.createVNode(vueRouter.RouterLink, {
783
+ "class": classes,
784
+ "to": to,
785
+ "key": key
786
+ }, _isSlot$b(children) ? children : {
787
+ default: () => [children]
788
+ });
789
+ } else {
790
+ return vue.createVNode("button", {
791
+ "class": classes,
792
+ "type": "button",
793
+ "value": page,
794
+ "onClick": onClick,
795
+ "key": key
796
+ }, [children]);
797
+ }
798
+ }
799
+
800
+ vue.watch(() => props.modelValue, modelValue => {
801
+ internalValue.value = vueUtils.resolveNumberish(modelValue);
802
+ }, {
803
+ immediate: true
804
+ });
805
+ return () => {
806
+ if (!isActive.value) return undefined;
807
+ const $items = ['prev', ...computedItems.value, 'next'].map((i, index) => genItem(i, index));
808
+ return vue.withDirectives(vue.createVNode("nav", {
809
+ "class": ['v-pagination', classes.value],
810
+ "ref": elRef
811
+ }, [$items]), [vueUtils.resizeDirectiveArgument(({
812
+ width
813
+ }) => {
814
+ const el = elRef.value;
815
+
816
+ if (el) {
817
+ const style = window.getComputedStyle(el, 'before');
818
+ const width = style.getPropertyValue('width');
819
+ const margin = style.getPropertyValue('margin');
820
+ const size = parseFloat(width) + parseFloat(margin) * 0.5;
821
+ itemSize.value = size;
822
+ }
823
+
824
+ containerWidth.value = width;
825
+ })]);
826
+ };
827
+ }
828
+
829
+ });
830
+
534
831
  function createListTileProps() {
535
832
  const icon = rawIconProp();
536
833
  return { ...vueUtils.navigationableProps,
@@ -542,7 +839,8 @@ function createListTileProps() {
542
839
  default: 'div'
543
840
  },
544
841
  startIconEmptySpace: Boolean,
545
- color: String
842
+ color: String,
843
+ exactMatch: Boolean
546
844
  })
547
845
  };
548
846
  }
@@ -573,7 +871,7 @@ const VListTile = vue.defineComponent({
573
871
  });
574
872
  const isActive = vue.computed(() => {
575
873
  if (!hasTo.value) return false;
576
- return link.isActive.value;
874
+ return props.exactMatch ? link.isExactActive.value : link.isActive.value;
577
875
  });
578
876
  const color = vueColorScheme.useScopeColorClass(props);
579
877
  const classes = vue.computed(() => {
@@ -650,7 +948,52 @@ const VDrawerLayout = vue.defineComponent({
650
948
 
651
949
  });
652
950
 
653
- function _isSlot$5(s) {
951
+ function _isSlot$a(s) {
952
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
953
+ }
954
+
955
+ const VHero = vue.defineComponent({
956
+ name: 'VHero',
957
+ props: {
958
+ color: {
959
+ type: String,
960
+ default: 'primary'
961
+ },
962
+ tag: {
963
+ type: String,
964
+ default: 'header'
965
+ },
966
+ hTag: {
967
+ type: String,
968
+ default: 'h1'
969
+ }
970
+ },
971
+
972
+ setup(props, ctx) {
973
+ return () => {
974
+ let _slot;
975
+
976
+ const TagName = props.tag;
977
+ const HTagName = props.hTag;
978
+ return vue.createVNode(vueAppLayout.VAppContainer, {
979
+ "pulled": true
980
+ }, {
981
+ default: () => [vue.createVNode(TagName, {
982
+ "class": ['v-hero', vueColorScheme.toScopeColorClass(props.color)]
983
+ }, {
984
+ default: () => [vue.createVNode(HTagName, {
985
+ "class": "v-hero__title"
986
+ }, _isSlot$a(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
987
+ default: () => [_slot]
988
+ })]
989
+ })]
990
+ });
991
+ };
992
+ }
993
+
994
+ });
995
+
996
+ function _isSlot$9(s) {
654
997
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
655
998
  }
656
999
 
@@ -681,7 +1024,7 @@ function renderNavigationItemInput(input, extraProps) {
681
1024
  } = resolveNavigationItemInput(input);
682
1025
  return vue.createVNode(VNavigationItem, { ...props,
683
1026
  ...extraProps
684
- }, _isSlot$5(label) ? label : {
1027
+ }, _isSlot$9(label) ? label : {
685
1028
  default: () => [label]
686
1029
  });
687
1030
  }
@@ -825,7 +1168,7 @@ const VNavigationItem = vue.defineComponent({
825
1168
  "class": ['v-navigation-item', classes.value],
826
1169
  "onClick": onClick,
827
1170
  "onChangeActive": onChangeActive
828
- }), _isSlot$5(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
1171
+ }), _isSlot$9(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
829
1172
  default: () => [_slot]
830
1173
  }), _children && vue.createVNode(vueUtils.VExpandTransition, null, {
831
1174
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -973,7 +1316,7 @@ const VCheckbox = vue.defineComponent({
973
1316
 
974
1317
  });
975
1318
 
976
- function _isSlot$4(s) {
1319
+ function _isSlot$8(s) {
977
1320
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
978
1321
  }
979
1322
 
@@ -985,7 +1328,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
985
1328
  itemRenderer: ({
986
1329
  attrs,
987
1330
  slots
988
- }) => vue.createVNode(VCheckbox, attrs, _isSlot$4(slots) ? slots : {
1331
+ }) => vue.createVNode(VCheckbox, attrs, _isSlot$8(slots) ? slots : {
989
1332
  default: () => [slots]
990
1333
  })
991
1334
  });
@@ -1037,7 +1380,7 @@ const VRadio = vue.defineComponent({
1037
1380
 
1038
1381
  });
1039
1382
 
1040
- function _isSlot$3(s) {
1383
+ function _isSlot$7(s) {
1041
1384
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1042
1385
  }
1043
1386
 
@@ -1048,7 +1391,7 @@ const VRadioGroup = defineFormSelectorComponent({
1048
1391
  itemRenderer: ({
1049
1392
  attrs,
1050
1393
  slots
1051
- }) => vue.createVNode(VRadio, attrs, _isSlot$3(slots) ? slots : {
1394
+ }) => vue.createVNode(VRadio, attrs, _isSlot$7(slots) ? slots : {
1052
1395
  default: () => [slots]
1053
1396
  })
1054
1397
  });
@@ -1110,7 +1453,7 @@ const VSwitch = vue.defineComponent({
1110
1453
 
1111
1454
  });
1112
1455
 
1113
- function _isSlot$2(s) {
1456
+ function _isSlot$6(s) {
1114
1457
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1115
1458
  }
1116
1459
 
@@ -1122,7 +1465,7 @@ const VSwitchGroup = defineFormSelectorComponent({
1122
1465
  itemRenderer: ({
1123
1466
  attrs,
1124
1467
  slots
1125
- }) => vue.createVNode(VSwitch, attrs, _isSlot$2(slots) ? slots : {
1468
+ }) => vue.createVNode(VSwitch, attrs, _isSlot$6(slots) ? slots : {
1126
1469
  default: () => [slots]
1127
1470
  })
1128
1471
  });
@@ -1406,6 +1749,7 @@ const VSelect = vue.defineComponent({
1406
1749
  "class": ['v-select', this.classes],
1407
1750
  "label": this.label,
1408
1751
  "hint": this.hint,
1752
+ "hiddenInfo": this.hiddenInfo,
1409
1753
  "onClickLabel": ev => {
1410
1754
  this.focus();
1411
1755
  }
@@ -1432,7 +1776,20 @@ const VSelect = vue.defineComponent({
1432
1776
  "focused": this.menuOpened,
1433
1777
  "onClick": ev => {
1434
1778
  if (this.canOperation && !control.isActive) {
1435
- control.show(ev);
1779
+ let t = ev.target;
1780
+ const count = 0;
1781
+ let hit = false;
1782
+
1783
+ while (count < 5) {
1784
+ if (t.classList.contains('v-select__input')) {
1785
+ hit = true;
1786
+ break;
1787
+ }
1788
+
1789
+ t = t.parentElement;
1790
+ }
1791
+
1792
+ control.show(hit ? t : ev);
1436
1793
  }
1437
1794
  }
1438
1795
  }, { ...this.$slots,
@@ -1517,6 +1874,7 @@ const VTextField = vue.defineComponent({
1517
1874
  return vue.createVNode(VFormControl, {
1518
1875
  "nodeControl": this.nodeControl,
1519
1876
  "focused": this.nodeControl.focused,
1877
+ "hiddenInfo": this.hiddenInfo,
1520
1878
  "class": ['v-text-field', this.classes],
1521
1879
  "label": this.label,
1522
1880
  "hint": this.hint,
@@ -1580,6 +1938,7 @@ const VTextarea = vue.defineComponent({
1580
1938
  "class": ['v-textarea', this.classes],
1581
1939
  "label": this.label,
1582
1940
  "hint": this.hint,
1941
+ "hiddenInfo": this.hiddenInfo,
1583
1942
  "onClickLabel": ev => {
1584
1943
  this.focus();
1585
1944
  }
@@ -1665,7 +2024,1112 @@ const VForm = vue.defineComponent({
1665
2024
 
1666
2025
  });
1667
2026
 
1668
- function _isSlot$1(s) {
2027
+ function _isSlot$5(s) {
2028
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2029
+ }
2030
+
2031
+ const VTab = vue.defineComponent({
2032
+ name: 'VTab',
2033
+ props: {
2034
+ value: {
2035
+ type: String,
2036
+ required: true
2037
+ },
2038
+ active: Boolean,
2039
+ to: [String, Object],
2040
+ icon: [String, Function]
2041
+ },
2042
+ emits: {
2043
+ click: ev => true
2044
+ },
2045
+
2046
+ setup(props, ctx) {
2047
+ const classesRef = vue.computed(() => ({
2048
+ 'v-tab--active': props.active
2049
+ }));
2050
+ const exposeValues = {
2051
+ value: props.value,
2052
+ active: props.active
2053
+ };
2054
+ ctx.expose(exposeValues);
2055
+ return () => {
2056
+ const {
2057
+ to,
2058
+ value,
2059
+ icon,
2060
+ active
2061
+ } = props;
2062
+ const classes = ['v-tab', classesRef.value];
2063
+
2064
+ const children = vue.createVNode("span", {
2065
+ "class": "v-tab__content"
2066
+ }, [icon && resolveRawIconProp(active, icon, {
2067
+ class: 'v-tab__icon'
2068
+ }), vueUtils.renderSlotOrEmpty(ctx.slots)]);
2069
+
2070
+ if (to) {
2071
+ const replace = typeof to === 'string' ? undefined : to.replace;
2072
+ return vue.createVNode(vueRouter.RouterLink, {
2073
+ "class": classes,
2074
+ "to": to,
2075
+ "replace": replace
2076
+ }, _isSlot$5(children) ? children : {
2077
+ default: () => [children]
2078
+ });
2079
+ } else {
2080
+ return vue.createVNode("button", {
2081
+ "class": classes,
2082
+ "type": "button",
2083
+ "value": value,
2084
+ "onClick": ev => {
2085
+ ctx.emit('click', ev);
2086
+ }
2087
+ }, [children]);
2088
+ }
2089
+ };
2090
+ }
2091
+
2092
+ });
2093
+
2094
+ function _isSlot$4(s) {
2095
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2096
+ }
2097
+
2098
+ const VTabs = vue.defineComponent({
2099
+ name: 'VTabs',
2100
+ props: {
2101
+ modelValue: String,
2102
+ items: {
2103
+ type: Array,
2104
+ required: true // validator: (value: VTabsItem[]) => {
2105
+ // return Array.isArray(value) && value.length > 0;
2106
+ // },
2107
+
2108
+ },
2109
+
2110
+ /**
2111
+ * 自動スクロールする際の余剰オフセット幅(px)
2112
+ */
2113
+ autoScrollOffset: {
2114
+ type: Number,
2115
+ default: 20
2116
+ },
2117
+
2118
+ /**
2119
+ * ルーター同期する場合設定する
2120
+ */
2121
+ router: Function,
2122
+
2123
+ /**
2124
+ * ルーティング連携を行う際に、クエリベースのURLマッチングを行う
2125
+ * タブのURLが /page1?tab=xxx のようになる時に設定する
2126
+ */
2127
+ withQuery: Boolean,
2128
+ ...vueUtils.defineSlotsProps(),
2129
+ color: String
2130
+ },
2131
+ emits: {
2132
+ 'update:modelValue': newValue => true,
2133
+ change: newValue => true
2134
+ },
2135
+
2136
+ setup(props, ctx) {
2137
+ const vui = useVui();
2138
+ const internalValueRef = vue.ref(null);
2139
+ const scrollerRef = vueKit.useVScrollerRef();
2140
+ const elRef = vue.ref(null);
2141
+ let scrollResult;
2142
+ const tabRefs = vue.ref([]);
2143
+ const currentRef = vue.computed({
2144
+ get: () => internalValueRef.value,
2145
+ set: value => {
2146
+ if (internalValueRef.value !== value) {
2147
+ internalValueRef.value = value;
2148
+ ctx.emit('update:modelValue', value);
2149
+ ctx.emit('change', value);
2150
+ }
2151
+ }
2152
+ });
2153
+ const colorScope = vueColorScheme.useScopeColorClass({
2154
+ color: () => props.color || vui.setting('tabDefault').color
2155
+ });
2156
+ const classes = vue.computed(() => [colorScope.value.className]);
2157
+ const computedItemsRef = vue.computed(() => {
2158
+ const current = currentRef.value;
2159
+ const {
2160
+ router
2161
+ } = props;
2162
+ return props.items.map(item => {
2163
+ const {
2164
+ value
2165
+ } = item;
2166
+ const active = current === value;
2167
+ let location;
2168
+
2169
+ if (router) {
2170
+ const to = router(value);
2171
+ const route = vui.router.resolve(to);
2172
+ location = {
2173
+ to,
2174
+ route
2175
+ };
2176
+ }
2177
+
2178
+ return { ...item,
2179
+ active,
2180
+ location
2181
+ };
2182
+ });
2183
+ });
2184
+
2185
+ const setTabRef = ref => {
2186
+ tabRefs.value.push(ref);
2187
+ }; // const isMountedRef = ref(false);
2188
+
2189
+
2190
+ function setupInternalValue(routable) {
2191
+ let value = props.modelValue;
2192
+
2193
+ if (value == null || value === '') {
2194
+ const firstItem = props.items[0];
2195
+ if (!firstItem) return;
2196
+ value = firstItem.value;
2197
+ }
2198
+
2199
+ if (internalValueRef.value !== value) {
2200
+ internalValueRef.value = value;
2201
+
2202
+ if (routable) {
2203
+ const {
2204
+ router
2205
+ } = props;
2206
+ if (!router) return;
2207
+ const hit = computedItemsRef.value.find(item => item.value === value);
2208
+ if (!hit) return;
2209
+ const {
2210
+ location
2211
+ } = hit;
2212
+ if (!location) return;
2213
+ const {
2214
+ to,
2215
+ route
2216
+ } = location;
2217
+ if (route.fullPath === vui.location.currentRoute.fullPath) return;
2218
+ vui.router[to.replace ? 'replace' : 'push'](to);
2219
+ } else if (!props.router && props.modelValue !== value) {
2220
+ ctx.emit('update:modelValue', value);
2221
+ ctx.emit('change', value);
2222
+ }
2223
+ }
2224
+ }
2225
+
2226
+ function to(value) {
2227
+ currentRef.value = value;
2228
+ }
2229
+
2230
+ function cancelScroll() {
2231
+ if (scrollResult) {
2232
+ scrollResult.cancel();
2233
+ scrollResult = undefined;
2234
+ }
2235
+ }
2236
+
2237
+ const findTab = tab => {
2238
+ return tabRefs.value.find(t => t.value === tab);
2239
+ };
2240
+
2241
+ function scrollToTab(tabValue) {
2242
+ const tab = findTab(tabValue);
2243
+ if (!tab) return;
2244
+ const $tab = tab.$el;
2245
+ if (!$tab) return;
2246
+ const scroller = scrollerRef.value;
2247
+ if (!scroller) return;
2248
+ const container = scroller.scroller.element();
2249
+ if (!container) return;
2250
+ const {
2251
+ autoScrollOffset
2252
+ } = props;
2253
+ const tabLeft = $tab.offsetLeft;
2254
+ const tabWidth = $tab.offsetWidth;
2255
+ const tabRight = tabLeft + tabWidth;
2256
+ let hiddenLeft = 0;
2257
+ let hiddenRight = 0;
2258
+ const {
2259
+ scrollLeft,
2260
+ offsetWidth: scrollerWidth
2261
+ } = container;
2262
+ hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
2263
+ hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
2264
+ if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
2265
+ if (hiddenRight > 0) hiddenRight += autoScrollOffset;
2266
+ let scrollAmmount = 0;
2267
+
2268
+ if (hiddenRight > 0) {
2269
+ scrollAmmount = hiddenRight;
2270
+ }
2271
+
2272
+ if (hiddenLeft > 0) {
2273
+ scrollAmmount = -hiddenLeft;
2274
+ }
2275
+
2276
+ if (Math.abs(scrollAmmount) > 0) {
2277
+ cancelScroll();
2278
+ scrollResult = scroller.scroller.by(scrollAmmount, 0, {
2279
+ duration: 150
2280
+ });
2281
+ }
2282
+ }
2283
+
2284
+ vue.watch(() => props.modelValue, () => setupInternalValue(true));
2285
+ vue.watch(() => props.items, () => setupInternalValue(), {
2286
+ deep: true
2287
+ });
2288
+ vue.watch(() => internalValueRef.value, newValue => {
2289
+ scrollToTab(newValue);
2290
+ });
2291
+ vui.location.watchRoute(route => {
2292
+ if (!props.router) return;
2293
+ const path = props.withQuery ? route.fullPath : route.path;
2294
+ const hit = computedItemsRef.value.find(({
2295
+ location
2296
+ }) => {
2297
+ return location && location.route.fullPath === path;
2298
+ });
2299
+
2300
+ if (hit) {
2301
+ currentRef.value = hit.value;
2302
+ }
2303
+ }, {
2304
+ immediate: true
2305
+ });
2306
+ vue.onMounted(() => {
2307
+ scrollToTab(currentRef.value);
2308
+ });
2309
+ vue.onBeforeUnmount(() => {
2310
+ cancelScroll();
2311
+ });
2312
+ vue.onBeforeUpdate(() => {
2313
+ tabRefs.value = [];
2314
+ });
2315
+ setupInternalValue();
2316
+ return () => {
2317
+ const items = computedItemsRef.value;
2318
+ const itemSlot = ctx.slots.item;
2319
+ const children = items.map(({
2320
+ value,
2321
+ active,
2322
+ label,
2323
+ icon,
2324
+ location
2325
+ }) => {
2326
+ if (!label) {
2327
+ label = itemSlot;
2328
+ }
2329
+
2330
+ const children = typeof label === 'function' ? label({
2331
+ value,
2332
+ active,
2333
+ vui
2334
+ }) : label;
2335
+
2336
+ const _to = location && location.to || undefined;
2337
+
2338
+ return vue.createVNode(VTab, {
2339
+ "value": value,
2340
+ "to": _to,
2341
+ "icon": icon,
2342
+ "active": active,
2343
+ "ref": setTabRef,
2344
+ "onClick": e => {
2345
+ if (!e.defaultPrevented) {
2346
+ to(value);
2347
+ }
2348
+ }
2349
+ }, _isSlot$4(children) ? children : {
2350
+ default: () => [children]
2351
+ });
2352
+ });
2353
+ return vue.createVNode("div", {
2354
+ "class": ['v-tabs', classes.value],
2355
+ "ref": elRef
2356
+ }, [vue.createVNode(vueKit.VScroller, {
2357
+ "class": "v-tabs__scroller",
2358
+ "containerClass": "v-tabs__scroller__container",
2359
+ "guide": true,
2360
+ "ref": scrollerRef
2361
+ }, {
2362
+ default: () => [vue.createVNode("div", {
2363
+ "class": "v-tabs__content"
2364
+ }, [children])]
2365
+ })]);
2366
+ };
2367
+ }
2368
+
2369
+ });
2370
+
2371
+ function _isSlot$3(s) {
2372
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2373
+ }
2374
+
2375
+ const VContentSwitcher = vue.defineComponent({
2376
+ name: 'VContentSwitcher',
2377
+ props: {
2378
+ modelValue: String,
2379
+ order: {
2380
+ type: Array,
2381
+ default: () => []
2382
+ },
2383
+ autotop: [Boolean, Object]
2384
+ },
2385
+ emits: {
2386
+ 'update:modelValue': modelValue => true
2387
+ },
2388
+
2389
+ setup(props, ctx) {
2390
+ const internalValueRef = vue.ref('');
2391
+ const transitionRef = vue.ref('');
2392
+ const elRef = vue.ref(null);
2393
+ const anchorRef = vue.ref(null);
2394
+ const computedOrderRef = vue.computed(() => props.order.map(row => {
2395
+ return typeof row === 'string' ? row : row.value;
2396
+ }));
2397
+ const currentRef = vue.computed({
2398
+ get: () => internalValueRef.value,
2399
+ set: current => {
2400
+ if (internalValueRef.value !== current) {
2401
+ internalValueRef.value = current;
2402
+ ctx.emit('update:modelValue', current);
2403
+ }
2404
+ }
2405
+ });
2406
+ const autotopSettingsRef = vue.computed(() => {
2407
+ let {
2408
+ autotop: settings
2409
+ } = props;
2410
+ if (settings === true) settings = {};
2411
+ if (!settings) return;
2412
+ return { ...settings
2413
+ };
2414
+ });
2415
+
2416
+ function seeTop(options) {
2417
+ const scoller = vueScroller.getDocumentScroller();
2418
+ const {
2419
+ value: anchor
2420
+ } = anchorRef;
2421
+
2422
+ if (anchor) {
2423
+ scoller.toElement(anchor, options);
2424
+ }
2425
+ }
2426
+
2427
+ function getEl() {
2428
+ const el = elRef.value;
2429
+
2430
+ if (!el) {
2431
+ throw new Error('missing element');
2432
+ }
2433
+
2434
+ return el;
2435
+ }
2436
+
2437
+ vue.watch(() => props.modelValue, (value, beforeValue) => {
2438
+ if (value == null) return;
2439
+ internalValueRef.value = value;
2440
+ if (beforeValue == null) return;
2441
+ const order = computedOrderRef.value;
2442
+ const index = order.indexOf(value);
2443
+ const beforeIndex = order.indexOf(beforeValue);
2444
+ let transition = 'fade';
2445
+
2446
+ if (index !== -1 && beforeIndex !== -1) {
2447
+ if (index > beforeIndex) transition = 'v-content-switcher-next';
2448
+ if (index < beforeIndex) transition = 'v-content-switcher-prev';
2449
+ }
2450
+
2451
+ transitionRef.value = transition;
2452
+ }, {
2453
+ immediate: true
2454
+ });
2455
+ vue.watch(currentRef, () => {
2456
+ const autotopSettings = autotopSettingsRef.value;
2457
+
2458
+ if (autotopSettings && props.modelValue != null) {
2459
+ seeTop(autotopSettings);
2460
+ }
2461
+ });
2462
+ return () => {
2463
+ const current = currentRef.value;
2464
+ const children = vueUtils.renderSlotOrEmpty(ctx.slots) || [];
2465
+ const currentSlot = ctx.slots[current];
2466
+
2467
+ if (currentSlot) {
2468
+ children.push(vue.createVNode("div", {
2469
+ "class": "v-content-switcher__content",
2470
+ "key": current
2471
+ }, [currentSlot(this)]));
2472
+ }
2473
+
2474
+ return vue.createVNode("div", {
2475
+ "class": "v-content-switcher",
2476
+ "ref": elRef
2477
+ }, [vue.createVNode("div", {
2478
+ "class": "v-content-switcher__anchor",
2479
+ "ref": anchorRef
2480
+ }, null), vue.createVNode(vue.Transition, {
2481
+ "name": transitionRef.value,
2482
+ "onBeforeLeave": el => {
2483
+ getEl().style.height = el.offsetHeight + 'px';
2484
+ },
2485
+ "onEnter": el => {
2486
+ getEl().style.height = el.offsetHeight + 'px';
2487
+ },
2488
+ "onAfterEnter": () => {
2489
+ getEl().style.height = '';
2490
+ },
2491
+ "onEnterCancelled": () => {
2492
+ getEl().style.height = '';
2493
+ },
2494
+ "onLeaveCancelled": () => {
2495
+ getEl().style.height = '';
2496
+ }
2497
+ }, _isSlot$3(children) ? children : {
2498
+ default: () => [children]
2499
+ })]);
2500
+ };
2501
+ }
2502
+
2503
+ });
2504
+
2505
+ const DATA_TABLE_DEFAULTS = {
2506
+ itemKey: 'id',
2507
+ pageQuery: 'page',
2508
+ sortQuery: 'sort',
2509
+ orderQuery: 'order',
2510
+ limitQuery: 'limit',
2511
+ defaultOrder: 'ASC',
2512
+ ascQueryValue: 'ASC',
2513
+ descQueryValue: 'DESC',
2514
+ limits: [5, 10, 20, 50, 100],
2515
+ limitDefault: 20,
2516
+ contorolThreshold: 10
2517
+ };
2518
+ function configureDataTableDefaults(defaults) {
2519
+ Object.assign(DATA_TABLE_DEFAULTS, defaults);
2520
+
2521
+ if (!defaults.defaultOrder && defaults.ascQueryValue) {
2522
+ DATA_TABLE_DEFAULTS.defaultOrder = defaults.ascQueryValue;
2523
+ }
2524
+ }
2525
+ const SELECTABLE_HEADER_SYMBOL = '__selectable_header__';
2526
+ const VDataTable = vue.defineComponent({
2527
+ name: 'VDataTable',
2528
+ props: {
2529
+ /** 選択中のkeyの配列 */
2530
+ modelValue: {
2531
+ type: Array,
2532
+ default: () => []
2533
+ },
2534
+ itemKey: {
2535
+ type: String,
2536
+ default: () => DATA_TABLE_DEFAULTS.itemKey
2537
+ },
2538
+
2539
+ /**
2540
+ * ページネーションクエリ名
2541
+ */
2542
+ pageQuery: {
2543
+ type: String,
2544
+ default: () => DATA_TABLE_DEFAULTS.pageQuery
2545
+ },
2546
+
2547
+ /**
2548
+ * ソートクエリ名
2549
+ */
2550
+ sortQuery: {
2551
+ type: String,
2552
+ default: () => DATA_TABLE_DEFAULTS.sortQuery
2553
+ },
2554
+
2555
+ /**
2556
+ * 表示順クエリ名
2557
+ */
2558
+ orderQuery: {
2559
+ type: String,
2560
+ default: () => DATA_TABLE_DEFAULTS.orderQuery
2561
+ },
2562
+
2563
+ /**
2564
+ * リミット件数クエリ名
2565
+ */
2566
+ limitQuery: {
2567
+ type: String,
2568
+ default: () => DATA_TABLE_DEFAULTS.limitQuery
2569
+ },
2570
+ defaultOrder: {
2571
+ type: String,
2572
+ default: () => DATA_TABLE_DEFAULTS.defaultOrder
2573
+ },
2574
+ ascQueryValue: {
2575
+ type: String,
2576
+ default: () => DATA_TABLE_DEFAULTS.ascQueryValue
2577
+ },
2578
+ descQueryValue: {
2579
+ type: String,
2580
+ default: () => DATA_TABLE_DEFAULTS.descQueryValue
2581
+ },
2582
+ limits: {
2583
+ type: Array,
2584
+ default: () => DATA_TABLE_DEFAULTS.limits
2585
+ },
2586
+ limitDefault: {
2587
+ type: Number,
2588
+ default: () => DATA_TABLE_DEFAULTS.limitDefault
2589
+ },
2590
+ contorolThreshold: {
2591
+ type: Number,
2592
+ default: () => DATA_TABLE_DEFAULTS.contorolThreshold
2593
+ },
2594
+ headers: {
2595
+ type: Array,
2596
+ required: true
2597
+ },
2598
+ items: {
2599
+ type: Array,
2600
+ default: () => []
2601
+ },
2602
+ total: {
2603
+ type: Number,
2604
+ default: 0
2605
+ },
2606
+ selectable: Boolean,
2607
+ fixedHeader: Boolean,
2608
+ maxHeight: [Number, String]
2609
+ },
2610
+ emits: {
2611
+ input: selecteds => true
2612
+ },
2613
+
2614
+ setup(props, ctx) {
2615
+ const vui = useVui();
2616
+ const bootedRef = vue.ref(false);
2617
+ const footerHeightRef = vue.ref(0);
2618
+ const internalValues = vue.ref(props.modelValue.slice());
2619
+ const sortedItemKeysRef = vue.computed(() => props.items.map(item => item[props.itemKey]));
2620
+ const isEmptyRef = vue.computed(() => props.items.length === 0);
2621
+ const headersRef = vue.computed(() => {
2622
+ const {
2623
+ headers,
2624
+ selectable
2625
+ } = props;
2626
+ const ret = [];
2627
+
2628
+ if (selectable) {
2629
+ ret.push({
2630
+ key: SELECTABLE_HEADER_SYMBOL
2631
+ });
2632
+ }
2633
+
2634
+ ret.push(...headers.filter(h => !h.hidden));
2635
+ return ret;
2636
+ });
2637
+ const classesRef = vue.computed(() => [{
2638
+ 'v-data-table--fixed-header': props.fixedHeader
2639
+ }]);
2640
+ const layout = vueAppLayout.VAppLayoutControl.use();
2641
+ const bodyInnerStylesRef = vue.computed(() => {
2642
+ if (!bootedRef.value) return;
2643
+ const {
2644
+ fixedHeader,
2645
+ maxHeight
2646
+ } = props;
2647
+ const footerHeight = footerHeightRef.value;
2648
+
2649
+ const _maxHeight = maxHeight || (fixedHeader ? '100%' : maxHeight);
2650
+
2651
+ if (!_maxHeight) {
2652
+ return;
2653
+ }
2654
+
2655
+ return {
2656
+ maxHeight: layout.calicurateViewHeight(_maxHeight, -footerHeight - 100, 200)
2657
+ };
2658
+ });
2659
+ const defaultOrderQueryRef = vue.computed(() => props.defaultOrder === props.ascQueryValue ? props.ascQueryValue : props.descQueryValue);
2660
+ const isTransitioningRef = vue.computed(() => {
2661
+ return vui.location.isQueryOnlyTransitioning([props.pageQuery, props.sortQuery, props.orderQuery, props.limitQuery]);
2662
+ });
2663
+ const pageRef = vue.computed(() => vui.location.getQuery(props.pageQuery, Number, 1));
2664
+ const needShowHeaderControlRef = vue.computed(() => props.items.length > props.contorolThreshold);
2665
+ const sortByRef = vue.computed({
2666
+ get: () => {
2667
+ return vui.location.getQuery(props.sortQuery);
2668
+ },
2669
+
2670
+ set(value) {
2671
+ vui.location.pushQuery({
2672
+ [props.sortQuery]: value || null,
2673
+ [props.pageQuery]: 1
2674
+ });
2675
+ }
2676
+
2677
+ });
2678
+ const ordersRef = vue.computed(() => [props.ascQueryValue, props.descQueryValue]);
2679
+ const usePaigingRef = vue.computed(() => props.limits.length > 0);
2680
+ const orderByRef = vue.computed({
2681
+ get: () => {
2682
+ const value = vui.location.getQuery(props.orderQuery);
2683
+
2684
+ if (typeof value !== 'string' || !ordersRef.value.includes(value)) {
2685
+ return;
2686
+ }
2687
+
2688
+ return value;
2689
+ },
2690
+
2691
+ set(value) {
2692
+ vui.location.pushQuery({
2693
+ [props.orderQuery]: value || null,
2694
+ [props.pageQuery]: 1
2695
+ });
2696
+ }
2697
+
2698
+ });
2699
+ const offsetRef = vue.computed(() => (pageRef.value - 1) * limitRef.value);
2700
+ const limitRef = vue.computed({
2701
+ get: () => vui.location.getQuery(props.limitQuery, Number, props.limitDefault),
2702
+ set: value => {
2703
+ const page = Math.floor(offsetRef.value / value) + 1;
2704
+ vui.location.pushQuery({
2705
+ [props.limitQuery]: value,
2706
+ [props.pageQuery]: page
2707
+ });
2708
+ }
2709
+ });
2710
+ const pageLengthRef = vue.computed(() => {
2711
+ const {
2712
+ total
2713
+ } = props;
2714
+ const _limit = limitRef.value;
2715
+ if (!total) return 0;
2716
+ return Math.ceil(total / _limit);
2717
+ });
2718
+ const lengthRef = vue.computed(() => props.items.length);
2719
+ const isASCRef = vue.computed(() => orderByRef.value === props.ascQueryValue); // const isDESCRef = computed(() => orderByRef.value === props.descQueryValue);
2720
+
2721
+ const sortIconRef = vue.computed(() => {
2722
+ let icon = vui.icon('sort');
2723
+
2724
+ if (typeof icon === 'string') {
2725
+ const name = icon;
2726
+
2727
+ icon = gen => {
2728
+ return gen({
2729
+ name,
2730
+ rotate: isASCRef.value ? 180 : 0
2731
+ });
2732
+ };
2733
+ }
2734
+
2735
+ return icon;
2736
+ });
2737
+ const isIndeterminateRef = vue.computed(() => {
2738
+ const {
2739
+ length
2740
+ } = internalValues.value;
2741
+ return length > 0 && length < sortedItemKeysRef.value.length;
2742
+ });
2743
+ const isAllSelectedRef = vue.computed(() => internalValues.value.length === sortedItemKeysRef.value.length);
2744
+
2745
+ function setSort(settings) {
2746
+ const {
2747
+ sort,
2748
+ order
2749
+ } = settings;
2750
+ if ((sort === undefined || sortByRef.value === sort) && (order === undefined || orderByRef.value === order)) return;
2751
+ const queries = {};
2752
+
2753
+ if (sort) {
2754
+ queries[props.sortQuery] = sort;
2755
+ }
2756
+
2757
+ if (order) {
2758
+ queries[props.orderQuery] = order;
2759
+ }
2760
+
2761
+ vui.location.pushQuery({ ...queries,
2762
+ [props.pageQuery]: 1
2763
+ });
2764
+ }
2765
+
2766
+ function toggleOrderBy() {
2767
+ return setSort({
2768
+ order: orderByRef.value === props.ascQueryValue ? props.descQueryValue : props.ascQueryValue
2769
+ });
2770
+ }
2771
+
2772
+ function isSelected(key) {
2773
+ return internalValues.value.includes(key);
2774
+ }
2775
+
2776
+ function select(key) {
2777
+ if (!internalValues.value.includes(key)) {
2778
+ const values = internalValues.value.slice();
2779
+ values.push(key);
2780
+ const sortedKeys = sortedItemKeysRef.value;
2781
+ values.sort((a, b) => {
2782
+ const ai = sortedKeys.indexOf(a);
2783
+ const bi = sortedKeys.indexOf(b);
2784
+ if (ai < bi) return -1;
2785
+ if (ai > bi) return 1;
2786
+ return 0;
2787
+ });
2788
+ internalValues.value = values;
2789
+ ctx.emit('input', values);
2790
+ }
2791
+ }
2792
+
2793
+ function selectAll() {
2794
+ if (!isAllSelectedRef.value) {
2795
+ const values = sortedItemKeysRef.value.slice();
2796
+ internalValues.value = values;
2797
+ ctx.emit('input', values);
2798
+ }
2799
+ }
2800
+
2801
+ function deselectAll() {
2802
+ if (internalValues.value.length) {
2803
+ const values = [];
2804
+ internalValues.value = values;
2805
+ ctx.emit('input', values);
2806
+ }
2807
+ }
2808
+
2809
+ function deselect(key) {
2810
+ const values = internalValues.value.slice();
2811
+ const index = values.indexOf(key);
2812
+
2813
+ if (index !== -1) {
2814
+ values.splice(index, 1);
2815
+ internalValues.value = values;
2816
+ ctx.emit('input', values);
2817
+ }
2818
+ }
2819
+
2820
+ function handleClickSortHeader(header, ev) {
2821
+ const {
2822
+ sortQuery
2823
+ } = header;
2824
+ if (!sortQuery) return;
2825
+
2826
+ if (sortByRef.value === sortQuery) {
2827
+ return toggleOrderBy();
2828
+ }
2829
+
2830
+ return setSort({
2831
+ sort: sortQuery,
2832
+ order: defaultOrderQueryRef.value
2833
+ });
2834
+ }
2835
+
2836
+ function genPagination() {
2837
+ return vue.createVNode(VPagination, {
2838
+ "class": "v-data-table__pagination",
2839
+ "dense": true,
2840
+ "align": "right",
2841
+ "routeQuery": props.pageQuery,
2842
+ "modelValue": pageRef.value,
2843
+ "length": pageLengthRef.value
2844
+ }, null);
2845
+ }
2846
+
2847
+ function genControls() {
2848
+ const {
2849
+ total
2850
+ } = props;
2851
+ const offset = offsetRef.value;
2852
+ const length = lengthRef.value;
2853
+ return vue.createVNode("div", {
2854
+ "class": "v-data-table__controls"
2855
+ }, [vue.createVNode("div", {
2856
+ "class": "v-data-table__controls__info"
2857
+ }, [vue.createVNode("small", {
2858
+ "class": "v-data-table__controls__info__length"
2859
+ }, [vue.createTextVNode("\u5168 "), total, vue.createTextVNode(" \u4EF6\u4E2D "), offset + 1, vue.createTextVNode(" \u4EF6 \u301C "), offset + length, vue.createTextVNode(" \u4EF6\u3092\u8868\u793A")])]), vue.createVNode("div", {
2860
+ "class": "v-data-table__controls__select-limit"
2861
+ }, [vue.createVNode("span", {
2862
+ "class": "v-data-table__controls__select-limit__prefix"
2863
+ }, [vue.createTextVNode("1\u30DA\u30FC\u30B8\u306B")]), vue.createVNode(VSelect, {
2864
+ "class": "v-data-table__controls__select-limit__node",
2865
+ "size": "sm",
2866
+ "hiddenInfo": true,
2867
+ "disabled": isTransitioningRef.value,
2868
+ "items": props.limits.map(limit => {
2869
+ return {
2870
+ label: `${limit}件`,
2871
+ value: limit
2872
+ };
2873
+ }),
2874
+ "modelValue": limitRef.value,
2875
+ "onUpdate:modelValue": $event => limitRef.value = $event
2876
+ }, null)]), vue.createVNode("div", {
2877
+ "class": "v-data-table__controls__pagination"
2878
+ }, [genPagination()])]);
2879
+ }
2880
+
2881
+ function genTableHeader() {
2882
+ const sortBy = sortByRef.value;
2883
+ const isIndeterminate = isIndeterminateRef.value;
2884
+ const isAllSelected = isAllSelectedRef.value;
2885
+ const {
2886
+ defaultOrder,
2887
+ ascQueryValue
2888
+ } = props;
2889
+ const usePaiging = usePaigingRef.value;
2890
+ const children = headersRef.value.map(header => {
2891
+ const {
2892
+ label,
2893
+ sortQuery,
2894
+ align,
2895
+ key
2896
+ } = header;
2897
+ const headerChildren = [];
2898
+
2899
+ if (label != null && typeof label !== 'boolean') {
2900
+ let _children = typeof label === 'function' ? label(vui) : label;
2901
+
2902
+ if (_children && !Array.isArray(_children) && typeof _children === 'object') {
2903
+ _children = JSON.stringify(_children);
2904
+ }
2905
+
2906
+ headerChildren.push(_children);
2907
+ }
2908
+
2909
+ if (key === SELECTABLE_HEADER_SYMBOL) {
2910
+ headerChildren.push(vue.createVNode(VCheckbox, {
2911
+ "modelValue": isAllSelected,
2912
+ "indeterminate": isIndeterminate,
2913
+ "onChange": ev => {
2914
+ if (isAllSelectedRef.value) {
2915
+ deselectAll();
2916
+ } else {
2917
+ selectAll();
2918
+ }
2919
+ }
2920
+ }, null));
2921
+ } // if (key === DELETOR_HEADER_SYMBOL) {
2922
+ // headerChildren.push('削除');
2923
+ // }
2924
+
2925
+
2926
+ const sortActive = sortBy === sortQuery;
2927
+
2928
+ if (sortQuery && usePaiging) {
2929
+ const isASC = sortActive ? isASCRef.value : defaultOrder === ascQueryValue;
2930
+ headerChildren.unshift(vue.createVNode(VIcon, {
2931
+ "class": "v-data-table__table__sort-icon v-data-table__table__sort-icon--empty",
2932
+ "name": "$empty"
2933
+ }, null));
2934
+ headerChildren.push(resolveRawIconProp(false, sortIconRef.value, {
2935
+ class: ['v-data-table__table__sort-icon v-data-table__table__sort-icon--arrow', {
2936
+ 'v-data-table__table__sort-icon--asc': isASC,
2937
+ 'v-data-table__table__sort-icon--desc': !isASC
2938
+ }]
2939
+ }));
2940
+ }
2941
+
2942
+ const classes = ['v-data-table__table__cell', {
2943
+ 'v-data-table__table__cell--active': sortActive
2944
+ }];
2945
+
2946
+ if (align) {
2947
+ classes.push(`v-data-table__table__cell--${align}`);
2948
+ }
2949
+
2950
+ return vue.createVNode("th", {
2951
+ "class": classes,
2952
+ "key": header.key,
2953
+ "tabindex": sortQuery && usePaiging ? 0 : undefined,
2954
+ "onClick": ev => {
2955
+ if (!sortQuery || !usePaiging) return;
2956
+ handleClickSortHeader(header);
2957
+ }
2958
+ }, [vue.createVNode("div", {
2959
+ "class": "v-data-table__table__cell__tile"
2960
+ }, [headerChildren])]);
2961
+ });
2962
+ return vue.createVNode("thead", {
2963
+ "class": "v-data-table__table__header"
2964
+ }, [vue.createVNode("tr", null, [children])]);
2965
+ }
2966
+
2967
+ function toggleSelect(key) {
2968
+ return isSelected(key) ? deselect(key) : select(key);
2969
+ }
2970
+
2971
+ function defaultItemSlot(payload) {
2972
+ const {
2973
+ key,
2974
+ item,
2975
+ selected
2976
+ } = payload;
2977
+ const headers = headersRef.value; // const { $scopedSlots, $createElement, deletor } = this;
2978
+
2979
+ const children = headers.map(header => {
2980
+ const {
2981
+ cell,
2982
+ align,
2983
+ key: headerKey
2984
+ } = header;
2985
+ const cellSlot = cell || ctx.slots.cell;
2986
+ let cellChildren;
2987
+
2988
+ if (cellSlot) {
2989
+ const cellPayload = {
2990
+ vui,
2991
+ item,
2992
+ selected
2993
+ };
2994
+
2995
+ let _children = cellSlot(cellPayload);
2996
+
2997
+ if (_children && !Array.isArray(_children) && typeof _children === 'object') {
2998
+ _children = JSON.stringify(_children);
2999
+ }
3000
+
3001
+ cellChildren = _children;
3002
+ }
3003
+
3004
+ if (!cellChildren) {
3005
+ switch (headerKey) {
3006
+ case SELECTABLE_HEADER_SYMBOL:
3007
+ {
3008
+ cellChildren = [vue.createVNode(VCheckbox, {
3009
+ "modelValue": selected,
3010
+ "onChange": ev => {
3011
+ toggleSelect(key);
3012
+ }
3013
+ }, null)];
3014
+ break;
3015
+ }
3016
+ // case DELETOR_HEADER_SYMBOL: {
3017
+ // if (deletor) {
3018
+ // const onClick = async (event: MouseEvent) => {
3019
+ // if (
3020
+ // await this.$confirm(`${key}を削除します。よろしいですか?`)
3021
+ // ) {
3022
+ // this.deletingTargets.push(key);
3023
+ // await deletor(item);
3024
+ // this.deletingTargets.splice(
3025
+ // this.deletingTargets.indexOf(key),
3026
+ // 1,
3027
+ // );
3028
+ // }
3029
+ // };
3030
+ // cellChildren = [
3031
+ // <VBtn
3032
+ // icon="trush"
3033
+ // onClick={onClick}
3034
+ // disabled={this.deletingTargets.includes(key)}
3035
+ // />,
3036
+ // ];
3037
+ // }
3038
+ // break;
3039
+ // }
3040
+ }
3041
+ }
3042
+
3043
+ const classes = align ? {
3044
+ [`v-data-table__table__cell--${align}`]: true
3045
+ } : undefined;
3046
+ return vue.createVNode("td", {
3047
+ "class": ['v-data-table__table__cell', classes],
3048
+ "key": header.key
3049
+ }, [cellChildren]);
3050
+ });
3051
+ return vue.createVNode("tr", {
3052
+ "class": ['v-data-table__table__item', {
3053
+ 'v-data-table__table__item--selected': selected
3054
+ }],
3055
+ "key": key
3056
+ }, [children]);
3057
+ }
3058
+
3059
+ function genBody() {
3060
+ const {
3061
+ items,
3062
+ itemKey
3063
+ } = props;
3064
+ const {
3065
+ item: itemSlot = defaultItemSlot
3066
+ } = ctx.slots;
3067
+ const children = items.map(item => {
3068
+ const key = item[itemKey];
3069
+ const payload = {
3070
+ key,
3071
+ item,
3072
+ selected: isSelected(key)
3073
+ };
3074
+ return itemSlot(payload);
3075
+ });
3076
+ return vue.createVNode("tbody", {
3077
+ "class": "v-data-table__table__body"
3078
+ }, [children]);
3079
+ }
3080
+
3081
+ vue.watch(() => props.modelValue, modelValue => {
3082
+ internalValues.value = modelValue.slice();
3083
+ });
3084
+ vue.watch(() => props.items, items => {
3085
+ internalValues.value = internalValues.value.filter(key => {
3086
+ return sortedItemKeysRef.value.includes(key);
3087
+ });
3088
+ });
3089
+ vue.onMounted(() => {
3090
+ bootedRef.value = true;
3091
+ });
3092
+ return () => {
3093
+ const isEmpty = isEmptyRef.value;
3094
+ const usePaiging = usePaigingRef.value;
3095
+ return vue.createVNode("div", {
3096
+ "class": ['v-data-table', classesRef.value]
3097
+ }, [!isEmpty && usePaiging && needShowHeaderControlRef.value && vue.createVNode("div", {
3098
+ "class": "v-data-table__header"
3099
+ }, [genControls()]), vue.createVNode("div", {
3100
+ "class": "v-data-table__body container-pull"
3101
+ }, [isEmpty ? vue.createVNode("div", {
3102
+ "class": "v-data-table__empty--message"
3103
+ }, null) : vue.createVNode(VPaper, {
3104
+ "class": "v-data-table__body__inner",
3105
+ "style": bodyInnerStylesRef.value
3106
+ }, {
3107
+ default: () => [vue.createVNode("div", {
3108
+ "class": "v-data-table__table-wrapper"
3109
+ }, [vue.createVNode("table", {
3110
+ "class": "v-data-table__table"
3111
+ }, [genTableHeader(), genBody()])])]
3112
+ }), vue.createVNode(vue.Transition, {
3113
+ "name": "fade"
3114
+ }, {
3115
+ default: () => [isTransitioningRef.value && vue.createVNode("div", {
3116
+ "class": "v-data-table__loading"
3117
+ }, [vue.createVNode(vueLoading.VProgressCircular, {
3118
+ "indeterminate": true
3119
+ }, null)])]
3120
+ })]), !isEmpty && usePaiging && vue.withDirectives(vue.createVNode("div", {
3121
+ "class": "v-data-table__footer"
3122
+ }, [genControls()]), [vueUtils.resizeDirectiveArgument(({
3123
+ height
3124
+ }) => {
3125
+ footerHeightRef.value = height;
3126
+ })])]);
3127
+ };
3128
+ }
3129
+
3130
+ });
3131
+
3132
+ function _isSlot$2(s) {
1669
3133
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1670
3134
  }
1671
3135
 
@@ -1677,7 +3141,7 @@ const VApp = vue.defineComponent({
1677
3141
  return () => {
1678
3142
  let _slot;
1679
3143
 
1680
- return vue.createVNode(vueKit.VStackRoot, null, _isSlot$1(_slot = vueKit.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
3144
+ return vue.createVNode(vueKit.VStackRoot, null, _isSlot$2(_slot = vueKit.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
1681
3145
  default: () => [_slot]
1682
3146
  });
1683
3147
  };
@@ -1717,8 +3181,35 @@ const VToolbar = vue.defineComponent({
1717
3181
 
1718
3182
  });
1719
3183
 
3184
+ function _isSlot$1(s) {
3185
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
3186
+ }
3187
+
1720
3188
  const VToolbarMenu = vue.defineComponent({
1721
3189
  name: 'VToolbarMenu',
3190
+ inheritAttrs: false,
3191
+ props: {},
3192
+
3193
+ setup(props, ctx) {
3194
+ const vui = useVui();
3195
+ const plain = vui.setting('plainVariant');
3196
+ return () => {
3197
+ let _slot;
3198
+
3199
+ const variant = props.variant || plain;
3200
+ return vue.createVNode(VButton, vue.mergeProps(ctx.attrs, {
3201
+ "variant": variant,
3202
+ "class": ['v-toolbar-menu']
3203
+ }), _isSlot$1(_slot = vueUtils.renderSlotOrEmpty(ctx.slots)) ? _slot : {
3204
+ default: () => [_slot]
3205
+ });
3206
+ };
3207
+ }
3208
+
3209
+ });
3210
+
3211
+ const VToolbarEdge = vue.defineComponent({
3212
+ name: 'VToolbarEdge',
1722
3213
  props: {
1723
3214
  edge: {
1724
3215
  type: String,
@@ -1732,8 +3223,8 @@ const VToolbarMenu = vue.defineComponent({
1732
3223
  const children = vueUtils.renderSlotOrEmpty(ctx.slots, 'default');
1733
3224
  const hasChildren = !!children && children.length > 0;
1734
3225
  return vue.createVNode("div", {
1735
- "class": ['v-toolbar-menu', `v-toolbar-menu--${edge.value}`, {
1736
- [`v-toolbar-menu--empty`]: !hasChildren
3226
+ "class": ['v-toolbar-edge', `v-toolbar-edge--${edge.value}`, {
3227
+ [`v-toolbar-edge--empty`]: !hasChildren
1737
3228
  }]
1738
3229
  }, [children]);
1739
3230
  };
@@ -1779,6 +3270,8 @@ class VuiService {
1779
3270
  autoScrollToElementOffsetTop;
1780
3271
  textareaRows;
1781
3272
  requiredChip;
3273
+ router;
3274
+ location;
1782
3275
  constructor(options) {
1783
3276
  this.options = options;
1784
3277
  const { selectionSeparator = () => ', ', autoScrollToElementOffsetTop = DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP, textareaRows = DEFAULT_TEXTAREA_ROWS, requiredChip = () => '*', } = options;
@@ -1786,6 +3279,10 @@ class VuiService {
1786
3279
  this.autoScrollToElementOffsetTop = autoScrollToElementOffsetTop;
1787
3280
  this.textareaRows = textareaRows;
1788
3281
  this.requiredChip = requiredChip;
3282
+ this.router = options.router;
3283
+ this.location = new vueUtils.LocationService({
3284
+ router: this.router,
3285
+ });
1789
3286
  }
1790
3287
  setting(key) {
1791
3288
  return this.options.uiSettings[key];
@@ -1869,6 +3366,7 @@ exports.VSnackbar = vueKit.VSnackbar;
1869
3366
  exports.ICON_NAMES = iconFont.ICON_NAMES;
1870
3367
  exports.CONTROL_FIELD_VARIANTS = CONTROL_FIELD_VARIANTS;
1871
3368
  exports.CONTROL_SIZES = CONTROL_SIZES;
3369
+ exports.PAGINATION_ALIGNS = PAGINATION_ALIGNS;
1872
3370
  exports.VApp = VApp;
1873
3371
  exports.VButton = VButton;
1874
3372
  exports.VCard = VCard;
@@ -1876,23 +3374,29 @@ exports.VCardActions = VCardActions;
1876
3374
  exports.VCardContent = VCardContent;
1877
3375
  exports.VCheckbox = VCheckbox;
1878
3376
  exports.VCheckboxGroup = VCheckboxGroup;
3377
+ exports.VContentSwitcher = VContentSwitcher;
3378
+ exports.VDataTable = VDataTable;
1879
3379
  exports.VDrawerLayout = VDrawerLayout;
1880
3380
  exports.VForm = VForm;
3381
+ exports.VHero = VHero;
1881
3382
  exports.VIcon = VIcon;
1882
3383
  exports.VListTile = VListTile;
1883
3384
  exports.VNavigation = VNavigation;
1884
3385
  exports.VNavigationItem = VNavigationItem;
1885
3386
  exports.VOption = VOption;
1886
3387
  exports.VOptionGroup = VOptionGroup;
3388
+ exports.VPagination = VPagination;
1887
3389
  exports.VPaper = VPaper;
1888
3390
  exports.VRadio = VRadio;
1889
3391
  exports.VRadioGroup = VRadioGroup;
1890
3392
  exports.VSelect = VSelect;
1891
3393
  exports.VSwitch = VSwitch;
1892
3394
  exports.VSwitchGroup = VSwitchGroup;
3395
+ exports.VTabs = VTabs;
1893
3396
  exports.VTextField = VTextField;
1894
3397
  exports.VTextarea = VTextarea;
1895
3398
  exports.VToolbar = VToolbar;
3399
+ exports.VToolbarEdge = VToolbarEdge;
1896
3400
  exports.VToolbarMenu = VToolbarMenu;
1897
3401
  exports.VToolbarTitle = VToolbarTitle;
1898
3402
  exports.VUI_CHECKBOX_GROUP_SYMBOL = VUI_CHECKBOX_GROUP_SYMBOL;
@@ -1912,6 +3416,7 @@ exports.VuiControlInjectionKey = VuiControlInjectionKey;
1912
3416
  exports.VuiInjectionKey = VuiInjectionKey;
1913
3417
  exports.VuiPlugin = VuiPlugin;
1914
3418
  exports.VuiService = VuiService;
3419
+ exports.configureDataTableDefaults = configureDataTableDefaults;
1915
3420
  exports.createCardProps = createCardProps;
1916
3421
  exports.createControlFieldProviderProps = createControlFieldProviderProps;
1917
3422
  exports.createControlProps = createControlProps;
@@ -1924,6 +3429,7 @@ exports.defineFormSelectorComponent = defineFormSelectorComponent;
1924
3429
  exports.iconProps = iconProps;
1925
3430
  exports.installVuiPlugin = installVuiPlugin;
1926
3431
  exports.listTileEmits = listTileEmits;
3432
+ exports.paginationProps = paginationProps;
1927
3433
  exports.rawIconProp = rawIconProp;
1928
3434
  exports.renderNavigationItemInput = renderNavigationItemInput;
1929
3435
  exports.resolveNavigationItemInput = resolveNavigationItemInput;