@fastkit/vui 0.6.20 → 0.6.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,16 @@
1
- import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useInjectTheme, VStackRoot, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
1
+ import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
2
2
  export * from '@fastkit/vue-kit';
3
3
  export { VDialog, VMenu, VSnackbar } from '@fastkit/vue-kit';
4
- import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, vModelSelect } from 'vue';
4
+ import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
5
+ import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableInheritProps, VLink, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
6
+ import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, onMounted, onBeforeUnmount, Transition } from 'vue';
5
7
  import { useScopeColorClass, colorSchemeProps, useColorClasses, toScopeColorClass } from '@fastkit/vue-color-scheme';
6
- import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableProps, navigationableEmits, useNavigationable, rawNumberPropType, resolveNumberish, getRouteQuery, resizeDirectiveArgument, getQueryMergedLocation, VExpandTransition } from '@fastkit/vue-utils';
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 { range, isPromise } from '@fastkit/helpers';
11
- import { useRouter, useRoute, RouterLink, useLink } from 'vue-router';
12
- import { VAppContainer } from '@fastkit/vue-app-layout';
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';
13
14
 
14
15
  const CONTROL_SIZES = ['sm', 'md', 'lg'];
15
16
  const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
@@ -163,7 +164,7 @@ const VFormControl = defineComponent({
163
164
  }
164
165
  }, [label, control.required && vui.getRequiredChip()]), createVNode("div", {
165
166
  "class": "v-form-control__body"
166
- }, [renderSlotOrEmpty(ctx.slots, 'default', control), createVNode("div", {
167
+ }, [renderSlotOrEmpty(ctx.slots, 'default', control), !props.hiddenInfo && createVNode("div", {
167
168
  "class": "v-form-control__info"
168
169
  }, [!!message && createVNode("div", {
169
170
  "class": "v-form-control__message"
@@ -216,6 +217,7 @@ function defineFormSelectorComponent(opts) {
216
217
  return createVNode(VFormControl, {
217
218
  "nodeControl": this.nodeControl,
218
219
  "focused": this.nodeControl.focused,
220
+ "hiddenInfo": this.hiddenInfo,
219
221
  "class": ['v-form-selector', className, { ...this.classes,
220
222
  'v-form-selector--stacked': this.stacked
221
223
  }],
@@ -432,7 +434,7 @@ function resolveRawVButtonIcon(raw, type = 'main') {
432
434
  }
433
435
 
434
436
  const vueButtonProps = createPropsOptions$1({ ...colorSchemeProps(),
435
- ...navigationableProps,
437
+ ...navigationableInheritProps,
436
438
  spacer: [Boolean, String],
437
439
  loading: Boolean,
438
440
  rounded: Boolean,
@@ -448,9 +450,8 @@ const LOADING_SIZE_MAP = {
448
450
  };
449
451
  const VButton = defineComponent({
450
452
  name: 'VButton',
453
+ inheritAttrs: false,
451
454
  props: vueButtonProps,
452
- emits: { ...navigationableEmits
453
- },
454
455
 
455
456
  setup(props, ctx) {
456
457
  const vui = useVui();
@@ -476,48 +477,25 @@ const VButton = defineComponent({
476
477
  variant: () => props.variant || (icon.value ? vui.setting('plainVariant') : defaults.variant)
477
478
  });
478
479
  const isPlain = computed(() => color.variant.value.value === vui.setting('plainVariant') && color.color.value.value === defaults.color);
479
- const navigationable = useNavigationable(props);
480
- const isLoading = computed(() => props.loading);
481
- const isDisabled = computed(() => props.disabled);
480
+ const isLoading = computed(() => props.loading); // const isDisabled = computed(() => props.disabled);
481
+
482
482
  const isRounded = computed(() => props.rounded || !!icon.value);
483
483
  const spacer = computed(() => {
484
484
  const _spacer = props.spacer;
485
485
  if (!_spacer) return;
486
486
  return _spacer === true ? 'left' : _spacer;
487
487
  });
488
- 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}`, {
489
490
  'v-button--loading': isLoading.value,
490
491
  'v-button--icon': !!icon.value,
491
492
  'v-button--rounded': isRounded.value,
492
493
  'v-button--plain': isPlain.value
493
494
  }]);
494
495
  return () => {
495
- const {
496
- Tag,
497
- attrs
498
- } = navigationable.value;
499
- const children = renderSlotOrEmpty$1(ctx.slots, 'default');
500
- const _attrs = { ...attrs
501
- };
502
-
503
- if (isDisabled.value) {
504
- _attrs.disabled = true;
505
- }
506
-
507
- return createVNode(Tag, mergeProps({
496
+ const children = renderSlotOrEmpty$1(ctx.slots);
497
+ return createVNode(VLink, mergeProps(ctx.attrs, {
508
498
  "class": ['v-button', classes.value]
509
- }, _attrs, {
510
- "onClick": ev => {
511
- if (isDisabled.value || isLoading.value) {
512
- ev.preventDefault();
513
-
514
- if (isDisabled.value) {
515
- return;
516
- }
517
- }
518
-
519
- ctx.emit('click', ev);
520
- }
521
499
  }), {
522
500
  default: () => [createVNode("span", {
523
501
  "class": "v-button__content"
@@ -532,7 +510,7 @@ const VButton = defineComponent({
532
510
 
533
511
  });
534
512
 
535
- function _isSlot$8(s) {
513
+ function _isSlot$c(s) {
536
514
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
537
515
  }
538
516
 
@@ -589,7 +567,6 @@ const VPagination = defineComponent({
589
567
  const vui = useVui();
590
568
  const elRef = ref(null);
591
569
  const router = useRouter();
592
- const route = useRoute();
593
570
  const internalValue = ref(1);
594
571
  const containerWidth = ref(0);
595
572
  const itemSize = ref(0);
@@ -610,13 +587,22 @@ const VPagination = defineComponent({
610
587
  } = props;
611
588
 
612
589
  if (routeQuery) {
613
- return getRouteQuery(route.query, routeQuery, Number, 1);
590
+ return vui.location.getQuery(routeQuery, Number, 1);
614
591
  }
615
592
 
616
593
  return internalValue.value;
617
594
  });
618
595
 
619
- const _range = (from, to) => range(to - from, from);
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
+ };
620
606
 
621
607
  const computedItems = computed(() => {
622
608
  const maxButtons = computedNumbersLength.value;
@@ -652,10 +638,7 @@ const VPagination = defineComponent({
652
638
  const {
653
639
  routeQuery
654
640
  } = props;
655
- if (!routeQuery) return false; // @TODO
656
- // return this.$location.isQueryOnlyTransitioning(routeQuery);
657
-
658
- return false;
641
+ return vui.location.isQueryOnlyTransitioning(routeQuery);
659
642
  });
660
643
  const isDisabled = computed(() => props.disabled || isTransitioning.value);
661
644
  const classes = computed(() => [{
@@ -728,9 +711,9 @@ const VPagination = defineComponent({
728
711
  }
729
712
 
730
713
  function createRoutableLocationByPage(page, routeQuery) {
731
- return getQueryMergedLocation({
714
+ return vui.location.getQueryMergedLocation({
732
715
  [routeQuery]: page
733
- }, route);
716
+ });
734
717
  }
735
718
 
736
719
  function genItem(source, index) {
@@ -740,8 +723,7 @@ const VPagination = defineComponent({
740
723
  active,
741
724
  disabled
742
725
  } = createPageInfo(source);
743
- const type = number ? 'num' : source; // const staticClass = `pagination__item`;
744
-
726
+ const type = number ? 'num' : source;
745
727
  const classes = ['v-pagination__item', {
746
728
  [`v-pagination__item--${type}`]: true,
747
729
  'v-pagination__item--active': active,
@@ -753,11 +735,10 @@ const VPagination = defineComponent({
753
735
  }
754
736
 
755
737
  const isPrev = type === 'prev';
756
- const name = isPrev ? 'chevron-left' : 'chevron-right';
757
- return createVNode(VIcon, {
758
- "class": "v-pagination__item__icon",
759
- "name": name
760
- }, null);
738
+ const icon = isPrev ? vui.icon('prev') : vui.icon('next');
739
+ return resolveRawIconProp(false, icon, {
740
+ class: 'v-pagination__item__icon'
741
+ });
761
742
  })();
762
743
 
763
744
  const onClick = ev => {
@@ -777,7 +758,7 @@ const VPagination = defineComponent({
777
758
  "class": classes,
778
759
  "to": to,
779
760
  "key": key
780
- }, _isSlot$8(children) ? children : {
761
+ }, _isSlot$c(children) ? children : {
781
762
  default: () => [children]
782
763
  });
783
764
  } else {
@@ -824,11 +805,11 @@ const VPagination = defineComponent({
824
805
 
825
806
  function createListTileProps() {
826
807
  const icon = rawIconProp();
827
- return { ...navigationableProps,
808
+ return { ...navigationableInheritProps,
828
809
  ...createPropsOptions$1({
829
810
  startIcon: icon,
830
811
  endIcon: icon,
831
- fallbackTag: {
812
+ linkFallbackTag: {
832
813
  type: String,
833
814
  default: 'div'
834
815
  },
@@ -838,11 +819,12 @@ function createListTileProps() {
838
819
  })
839
820
  };
840
821
  }
841
- const listTileEmits = { ...navigationableEmits,
822
+ const listTileEmits = {
842
823
  changeActive: isActive => true
843
824
  };
844
825
  const VListTile = defineComponent({
845
826
  name: 'VListTile',
827
+ inheritAttrs: false,
846
828
  props: createListTileProps(),
847
829
  emits: { ...listTileEmits
848
830
  },
@@ -858,10 +840,9 @@ const VListTile = defineComponent({
858
840
  return icon;
859
841
  });
860
842
  const endIcon = computed(() => resolveRawIconProp(false, props.endIcon));
861
- const navigationable = useNavigationable(props, () => props.fallbackTag, ctx);
862
- const hasTo = computed(() => !!props.to);
843
+ const hasTo = computed(() => !!ctx.attrs.to);
863
844
  const link = useLink({
864
- to: props.to || ''
845
+ to: ctx.attrs.to || ''
865
846
  });
866
847
  const isActive = computed(() => {
867
848
  if (!hasTo.value) return false;
@@ -871,10 +852,7 @@ const VListTile = defineComponent({
871
852
  const classes = computed(() => {
872
853
  const _color = color.value;
873
854
  const hasColor = !!_color.value;
874
- const _navigationable = navigationable.value;
875
- const clickable = _navigationable.clickable;
876
- return [color.value.className, _navigationable.classes, {
877
- 'v-list-tile--clickable': clickable,
855
+ return [color.value.className, {
878
856
  'v-list-tile--plain': !hasColor,
879
857
  'v-list-tile--has-color': hasColor,
880
858
  'v-list-tile--active': isActive.value
@@ -888,16 +866,9 @@ const VListTile = defineComponent({
888
866
  return () => {
889
867
  const _startIcon = startIcon.value;
890
868
  const _endIcon = endIcon.value;
891
- const {
892
- Tag,
893
- attrs
894
- } = navigationable.value;
895
- return createVNode(Tag, mergeProps({
896
- "class": ['v-list-tile', classes.value]
897
- }, attrs, {
898
- "onClick": ev => {
899
- ctx.emit('click', ev);
900
- }
869
+ return createVNode(VLink, mergeProps(ctx.attrs, {
870
+ "class": ['v-list-tile', classes.value],
871
+ "clickableClassName": "v-list-tile--clickable"
901
872
  }), {
902
873
  default: () => [_startIcon && createVNode("span", {
903
874
  "class": "v-list-tile__icon v-list-tile__icon--start"
@@ -942,7 +913,7 @@ const VDrawerLayout = defineComponent({
942
913
 
943
914
  });
944
915
 
945
- function _isSlot$7(s) {
916
+ function _isSlot$b(s) {
946
917
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
947
918
  }
948
919
 
@@ -977,7 +948,7 @@ const VHero = defineComponent({
977
948
  }, {
978
949
  default: () => [createVNode(HTagName, {
979
950
  "class": "v-hero__title"
980
- }, _isSlot$7(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
951
+ }, _isSlot$b(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
981
952
  default: () => [_slot]
982
953
  })]
983
954
  })]
@@ -987,13 +958,17 @@ const VHero = defineComponent({
987
958
 
988
959
  });
989
960
 
990
- function _isSlot$6(s) {
961
+ function _isSlot$a(s) {
991
962
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
992
963
  }
993
964
 
994
965
  function createNavigationItemProps() {
995
966
  return { ...createListTileProps(),
996
- match: String
967
+ match: String // key: {
968
+ // type: [String, Number],
969
+ // required: true,
970
+ // },
971
+
997
972
  };
998
973
  }
999
974
  function resolveNavigationItemInput(input) {
@@ -1018,7 +993,7 @@ function renderNavigationItemInput(input, extraProps) {
1018
993
  } = resolveNavigationItemInput(input);
1019
994
  return createVNode(VNavigationItem, { ...props,
1020
995
  ...extraProps
1021
- }, _isSlot$6(label) ? label : {
996
+ }, _isSlot$a(label) ? label : {
1022
997
  default: () => [label]
1023
998
  });
1024
999
  }
@@ -1038,7 +1013,7 @@ const VNavigationItem = defineComponent({
1038
1013
  const c = props.children;
1039
1014
  return c && c.length ? c : undefined;
1040
1015
  });
1041
- const to = computed(() => props.to);
1016
+ const to = computed(() => ctx.attrs.to);
1042
1017
  const match = computed(() => {
1043
1018
  const {
1044
1019
  match,
@@ -1113,6 +1088,7 @@ const VNavigationItem = defineComponent({
1113
1088
  });
1114
1089
 
1115
1090
  function open() {
1091
+ if (!children.value) return;
1116
1092
  opened.value = true;
1117
1093
  }
1118
1094
 
@@ -1126,10 +1102,13 @@ const VNavigationItem = defineComponent({
1126
1102
 
1127
1103
  const onClick = ev => {
1128
1104
  if (!to.value) {
1129
- toggle();
1105
+ return toggle();
1130
1106
  }
1131
1107
 
1132
- ctx.emit('click', ev);
1108
+ open(); // if (!to.value) {
1109
+ // toggle();
1110
+ // }
1111
+ // ctx.emit('click', ev);
1133
1112
  };
1134
1113
 
1135
1114
  const onChangeActive = isActive => {
@@ -1151,18 +1130,21 @@ const VNavigationItem = defineComponent({
1151
1130
  ctx.emit('changeActive', isActive);
1152
1131
  };
1153
1132
 
1133
+ ctx.expose({
1134
+ close
1135
+ });
1154
1136
  return () => {
1155
1137
  let _slot;
1156
1138
 
1157
1139
  const _children = children.value;
1158
1140
  const fallbackTag = _children ? 'button' : undefined;
1159
- return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(_props.value, {
1141
+ return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(ctx.attrs, _props.value, {
1160
1142
  "fallbackTag": fallbackTag,
1161
1143
  "endIcon": _props.value.endIcon,
1162
1144
  "class": ['v-navigation-item', classes.value],
1163
1145
  "onClick": onClick,
1164
1146
  "onChangeActive": onChangeActive
1165
- }), _isSlot$6(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
1147
+ }), _isSlot$a(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
1166
1148
  default: () => [_slot]
1167
1149
  }), _children && createVNode(VExpandTransition, null, {
1168
1150
  default: () => [withDirectives(createVNode("div", {
@@ -1202,6 +1184,28 @@ const VNavigation = defineComponent({
1202
1184
  const c = props.caption;
1203
1185
  return typeof c === 'function' ? c() : c;
1204
1186
  });
1187
+ const itemsRef = ref([]);
1188
+ onBeforeUpdate(() => {
1189
+ itemsRef.value = [];
1190
+ });
1191
+
1192
+ function setItemRef(item, itemRef) {
1193
+ itemsRef.value.push({
1194
+ key: item.key,
1195
+ ref: itemRef
1196
+ });
1197
+ }
1198
+
1199
+ function onItemActivated(item) {
1200
+ itemsRef.value.forEach(({
1201
+ key,
1202
+ ref
1203
+ }) => {
1204
+ if (key === item.key) return;
1205
+ ref.close();
1206
+ });
1207
+ }
1208
+
1205
1209
  return () => {
1206
1210
  const $caption = caption.value;
1207
1211
  return createVNode("nav", {
@@ -1210,7 +1214,17 @@ const VNavigation = defineComponent({
1210
1214
  "class": "v-navigation__caption"
1211
1215
  }, [$caption]), items.value.map(item => renderNavigationItemInput(item, {
1212
1216
  class: 'v-navigation__item',
1213
- startIconEmptySpace: startIconEmptySpace.value
1217
+ startIconEmptySpace: startIconEmptySpace.value,
1218
+ ref: ref => {
1219
+ setItemRef(item, ref);
1220
+ },
1221
+ onChangeActive: isActive => {
1222
+ if (isActive
1223
+ /* && item.children && item.children.length*/
1224
+ ) {
1225
+ onItemActivated(item);
1226
+ }
1227
+ }
1214
1228
  }))]);
1215
1229
  };
1216
1230
  }
@@ -1310,7 +1324,7 @@ const VCheckbox = defineComponent({
1310
1324
 
1311
1325
  });
1312
1326
 
1313
- function _isSlot$5(s) {
1327
+ function _isSlot$9(s) {
1314
1328
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1315
1329
  }
1316
1330
 
@@ -1322,7 +1336,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
1322
1336
  itemRenderer: ({
1323
1337
  attrs,
1324
1338
  slots
1325
- }) => createVNode(VCheckbox, attrs, _isSlot$5(slots) ? slots : {
1339
+ }) => createVNode(VCheckbox, attrs, _isSlot$9(slots) ? slots : {
1326
1340
  default: () => [slots]
1327
1341
  })
1328
1342
  });
@@ -1374,7 +1388,7 @@ const VRadio = defineComponent({
1374
1388
 
1375
1389
  });
1376
1390
 
1377
- function _isSlot$4(s) {
1391
+ function _isSlot$8(s) {
1378
1392
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1379
1393
  }
1380
1394
 
@@ -1385,7 +1399,7 @@ const VRadioGroup = defineFormSelectorComponent({
1385
1399
  itemRenderer: ({
1386
1400
  attrs,
1387
1401
  slots
1388
- }) => createVNode(VRadio, attrs, _isSlot$4(slots) ? slots : {
1402
+ }) => createVNode(VRadio, attrs, _isSlot$8(slots) ? slots : {
1389
1403
  default: () => [slots]
1390
1404
  })
1391
1405
  });
@@ -1447,7 +1461,7 @@ const VSwitch = defineComponent({
1447
1461
 
1448
1462
  });
1449
1463
 
1450
- function _isSlot$3(s) {
1464
+ function _isSlot$7(s) {
1451
1465
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1452
1466
  }
1453
1467
 
@@ -1459,7 +1473,7 @@ const VSwitchGroup = defineFormSelectorComponent({
1459
1473
  itemRenderer: ({
1460
1474
  attrs,
1461
1475
  slots
1462
- }) => createVNode(VSwitch, attrs, _isSlot$3(slots) ? slots : {
1476
+ }) => createVNode(VSwitch, attrs, _isSlot$7(slots) ? slots : {
1463
1477
  default: () => [slots]
1464
1478
  })
1465
1479
  });
@@ -1743,6 +1757,7 @@ const VSelect = defineComponent({
1743
1757
  "class": ['v-select', this.classes],
1744
1758
  "label": this.label,
1745
1759
  "hint": this.hint,
1760
+ "hiddenInfo": this.hiddenInfo,
1746
1761
  "onClickLabel": ev => {
1747
1762
  this.focus();
1748
1763
  }
@@ -1769,7 +1784,20 @@ const VSelect = defineComponent({
1769
1784
  "focused": this.menuOpened,
1770
1785
  "onClick": ev => {
1771
1786
  if (this.canOperation && !control.isActive) {
1772
- control.show(ev);
1787
+ let t = ev.target;
1788
+ const count = 0;
1789
+ let hit = false;
1790
+
1791
+ while (count < 5) {
1792
+ if (t.classList.contains('v-select__input')) {
1793
+ hit = true;
1794
+ break;
1795
+ }
1796
+
1797
+ t = t.parentElement;
1798
+ }
1799
+
1800
+ control.show(hit ? t : ev);
1773
1801
  }
1774
1802
  }
1775
1803
  }, { ...this.$slots,
@@ -1854,6 +1882,7 @@ const VTextField = defineComponent({
1854
1882
  return createVNode(VFormControl, {
1855
1883
  "nodeControl": this.nodeControl,
1856
1884
  "focused": this.nodeControl.focused,
1885
+ "hiddenInfo": this.hiddenInfo,
1857
1886
  "class": ['v-text-field', this.classes],
1858
1887
  "label": this.label,
1859
1888
  "hint": this.hint,
@@ -1917,6 +1946,7 @@ const VTextarea = defineComponent({
1917
1946
  "class": ['v-textarea', this.classes],
1918
1947
  "label": this.label,
1919
1948
  "hint": this.hint,
1949
+ "hiddenInfo": this.hiddenInfo,
1920
1950
  "onClickLabel": ev => {
1921
1951
  this.focus();
1922
1952
  }
@@ -2002,6 +2032,1224 @@ const VForm = defineComponent({
2002
2032
 
2003
2033
  });
2004
2034
 
2035
+ function _isSlot$6(s) {
2036
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2037
+ }
2038
+
2039
+ const VTab = defineComponent({
2040
+ name: 'VTab',
2041
+ props: {
2042
+ value: {
2043
+ type: String,
2044
+ required: true
2045
+ },
2046
+ active: Boolean,
2047
+ to: [String, Object],
2048
+ icon: [String, Function]
2049
+ },
2050
+ emits: {
2051
+ click: ev => true
2052
+ },
2053
+
2054
+ setup(props, ctx) {
2055
+ const classesRef = computed(() => ({
2056
+ 'v-tab--active': props.active
2057
+ }));
2058
+ const exposeValues = {
2059
+ value: props.value,
2060
+ active: props.active
2061
+ };
2062
+ ctx.expose(exposeValues);
2063
+ return () => {
2064
+ const {
2065
+ to,
2066
+ value,
2067
+ icon,
2068
+ active
2069
+ } = props;
2070
+ const classes = ['v-tab', classesRef.value];
2071
+
2072
+ const children = createVNode("span", {
2073
+ "class": "v-tab__content"
2074
+ }, [icon && resolveRawIconProp(active, icon, {
2075
+ class: 'v-tab__icon'
2076
+ }), renderSlotOrEmpty$1(ctx.slots)]);
2077
+
2078
+ if (to) {
2079
+ const replace = typeof to === 'string' ? undefined : to.replace;
2080
+ return createVNode(RouterLink, {
2081
+ "class": classes,
2082
+ "to": to,
2083
+ "replace": replace
2084
+ }, _isSlot$6(children) ? children : {
2085
+ default: () => [children]
2086
+ });
2087
+ } else {
2088
+ return createVNode("button", {
2089
+ "class": classes,
2090
+ "type": "button",
2091
+ "value": value,
2092
+ "onClick": ev => {
2093
+ ctx.emit('click', ev);
2094
+ }
2095
+ }, [children]);
2096
+ }
2097
+ };
2098
+ }
2099
+
2100
+ });
2101
+
2102
+ function _isSlot$5(s) {
2103
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2104
+ }
2105
+
2106
+ const VTabs = defineComponent({
2107
+ name: 'VTabs',
2108
+ props: {
2109
+ modelValue: String,
2110
+ items: {
2111
+ type: Array,
2112
+ required: true // validator: (value: VTabsItem[]) => {
2113
+ // return Array.isArray(value) && value.length > 0;
2114
+ // },
2115
+
2116
+ },
2117
+
2118
+ /**
2119
+ * 自動スクロールする際の余剰オフセット幅(px)
2120
+ */
2121
+ autoScrollOffset: {
2122
+ type: Number,
2123
+ default: 20
2124
+ },
2125
+
2126
+ /**
2127
+ * ルーター同期する場合設定する
2128
+ */
2129
+ router: Function,
2130
+
2131
+ /**
2132
+ * ルーティング連携を行う際に、クエリベースのURLマッチングを行う
2133
+ * タブのURLが /page1?tab=xxx のようになる時に設定する
2134
+ */
2135
+ withQuery: Boolean,
2136
+ ...defineSlotsProps$1(),
2137
+ color: String
2138
+ },
2139
+ emits: {
2140
+ 'update:modelValue': newValue => true,
2141
+ change: newValue => true
2142
+ },
2143
+
2144
+ setup(props, ctx) {
2145
+ const vui = useVui();
2146
+ const internalValueRef = ref(null);
2147
+ const scrollerRef = useVScrollerRef();
2148
+ const elRef = ref(null);
2149
+ let scrollResult;
2150
+ const tabRefs = ref([]);
2151
+ const currentRef = computed({
2152
+ get: () => internalValueRef.value,
2153
+ set: value => {
2154
+ if (internalValueRef.value !== value) {
2155
+ internalValueRef.value = value;
2156
+ ctx.emit('update:modelValue', value);
2157
+ ctx.emit('change', value);
2158
+ }
2159
+ }
2160
+ });
2161
+ const colorScope = useScopeColorClass({
2162
+ color: () => props.color || vui.setting('tabDefault').color
2163
+ });
2164
+ const classes = computed(() => [colorScope.value.className]);
2165
+ const computedItemsRef = computed(() => {
2166
+ const current = currentRef.value;
2167
+ const {
2168
+ router
2169
+ } = props;
2170
+ return props.items.map(item => {
2171
+ const {
2172
+ value
2173
+ } = item;
2174
+ const active = current === value;
2175
+ let location;
2176
+
2177
+ if (router) {
2178
+ const to = router(value);
2179
+ const route = vui.router.resolve(to);
2180
+ location = {
2181
+ to,
2182
+ route
2183
+ };
2184
+ }
2185
+
2186
+ return { ...item,
2187
+ active,
2188
+ location
2189
+ };
2190
+ });
2191
+ });
2192
+
2193
+ const setTabRef = ref => {
2194
+ tabRefs.value.push(ref);
2195
+ }; // const isMountedRef = ref(false);
2196
+
2197
+
2198
+ function setupInternalValue(routable) {
2199
+ let value = props.modelValue;
2200
+
2201
+ if (value == null || value === '') {
2202
+ const firstItem = props.items[0];
2203
+ if (!firstItem) return;
2204
+ value = firstItem.value;
2205
+ }
2206
+
2207
+ if (internalValueRef.value !== value) {
2208
+ internalValueRef.value = value;
2209
+
2210
+ if (routable) {
2211
+ const {
2212
+ router
2213
+ } = props;
2214
+ if (!router) return;
2215
+ const hit = computedItemsRef.value.find(item => item.value === value);
2216
+ if (!hit) return;
2217
+ const {
2218
+ location
2219
+ } = hit;
2220
+ if (!location) return;
2221
+ const {
2222
+ to,
2223
+ route
2224
+ } = location;
2225
+ if (route.fullPath === vui.location.currentRoute.fullPath) return;
2226
+ vui.router[to.replace ? 'replace' : 'push'](to);
2227
+ } else if (!props.router && props.modelValue !== value) {
2228
+ ctx.emit('update:modelValue', value);
2229
+ ctx.emit('change', value);
2230
+ }
2231
+ }
2232
+ }
2233
+
2234
+ function to(value) {
2235
+ currentRef.value = value;
2236
+ }
2237
+
2238
+ function cancelScroll() {
2239
+ if (scrollResult) {
2240
+ scrollResult.cancel();
2241
+ scrollResult = undefined;
2242
+ }
2243
+ }
2244
+
2245
+ const findTab = tab => {
2246
+ return tabRefs.value.find(t => t.value === tab);
2247
+ };
2248
+
2249
+ function scrollToTab(tabValue) {
2250
+ const tab = findTab(tabValue);
2251
+ if (!tab) return;
2252
+ const $tab = tab.$el;
2253
+ if (!$tab) return;
2254
+ const scroller = scrollerRef.value;
2255
+ if (!scroller) return;
2256
+ const container = scroller.scroller.element();
2257
+ if (!container) return;
2258
+ const {
2259
+ autoScrollOffset
2260
+ } = props;
2261
+ const tabLeft = $tab.offsetLeft;
2262
+ const tabWidth = $tab.offsetWidth;
2263
+ const tabRight = tabLeft + tabWidth;
2264
+ let hiddenLeft = 0;
2265
+ let hiddenRight = 0;
2266
+ const {
2267
+ scrollLeft,
2268
+ offsetWidth: scrollerWidth
2269
+ } = container;
2270
+ hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
2271
+ hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
2272
+ if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
2273
+ if (hiddenRight > 0) hiddenRight += autoScrollOffset;
2274
+ let scrollAmmount = 0;
2275
+
2276
+ if (hiddenRight > 0) {
2277
+ scrollAmmount = hiddenRight;
2278
+ }
2279
+
2280
+ if (hiddenLeft > 0) {
2281
+ scrollAmmount = -hiddenLeft;
2282
+ }
2283
+
2284
+ if (Math.abs(scrollAmmount) > 0) {
2285
+ cancelScroll();
2286
+ scrollResult = scroller.scroller.by(scrollAmmount, 0, {
2287
+ duration: 150
2288
+ });
2289
+ }
2290
+ }
2291
+
2292
+ watch(() => props.modelValue, () => setupInternalValue(true));
2293
+ watch(() => props.items, () => setupInternalValue(), {
2294
+ deep: true
2295
+ });
2296
+ watch(() => internalValueRef.value, newValue => {
2297
+ scrollToTab(newValue);
2298
+ });
2299
+ vui.location.watchRoute(route => {
2300
+ if (!props.router) return;
2301
+ const path = props.withQuery ? route.fullPath : route.path;
2302
+ const hit = computedItemsRef.value.find(({
2303
+ location
2304
+ }) => {
2305
+ return location && location.route.fullPath === path;
2306
+ });
2307
+
2308
+ if (hit) {
2309
+ currentRef.value = hit.value;
2310
+ }
2311
+ }, {
2312
+ immediate: true
2313
+ });
2314
+ onMounted(() => {
2315
+ scrollToTab(currentRef.value);
2316
+ });
2317
+ onBeforeUnmount(() => {
2318
+ cancelScroll();
2319
+ });
2320
+ onBeforeUpdate(() => {
2321
+ tabRefs.value = [];
2322
+ });
2323
+ setupInternalValue();
2324
+ return () => {
2325
+ const items = computedItemsRef.value;
2326
+ const itemSlot = ctx.slots.item;
2327
+ const children = items.map(({
2328
+ value,
2329
+ active,
2330
+ label,
2331
+ icon,
2332
+ location
2333
+ }) => {
2334
+ if (!label) {
2335
+ label = itemSlot;
2336
+ }
2337
+
2338
+ const children = typeof label === 'function' ? label({
2339
+ value,
2340
+ active,
2341
+ vui
2342
+ }) : label;
2343
+
2344
+ const _to = location && location.to || undefined;
2345
+
2346
+ return createVNode(VTab, {
2347
+ "value": value,
2348
+ "to": _to,
2349
+ "icon": icon,
2350
+ "active": active,
2351
+ "ref": setTabRef,
2352
+ "onClick": e => {
2353
+ if (!e.defaultPrevented) {
2354
+ to(value);
2355
+ }
2356
+ }
2357
+ }, _isSlot$5(children) ? children : {
2358
+ default: () => [children]
2359
+ });
2360
+ });
2361
+ return createVNode("div", {
2362
+ "class": ['v-tabs', classes.value],
2363
+ "ref": elRef
2364
+ }, [createVNode(VScroller, {
2365
+ "class": "v-tabs__scroller",
2366
+ "containerClass": "v-tabs__scroller__container",
2367
+ "guide": true,
2368
+ "ref": scrollerRef
2369
+ }, {
2370
+ default: () => [createVNode("div", {
2371
+ "class": "v-tabs__content"
2372
+ }, [children])]
2373
+ })]);
2374
+ };
2375
+ }
2376
+
2377
+ });
2378
+
2379
+ function _isSlot$4(s) {
2380
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2381
+ }
2382
+
2383
+ const VBreadcrumbs = defineComponent({
2384
+ name: 'VBreadcrumbs',
2385
+ props: {
2386
+ items: {
2387
+ type: Array,
2388
+ default: () => []
2389
+ },
2390
+ divider: [String, Function] // ...defineSlotsProps<{}>(),
2391
+
2392
+ },
2393
+
2394
+ setup(props, ctx) {
2395
+ const vui = useVui();
2396
+ const computedItemsRef = computed(() => {
2397
+ const items = props.items.map(rawItem => {
2398
+ return typeof rawItem === 'string' ? {
2399
+ text: rawItem
2400
+ } : rawItem;
2401
+ });
2402
+ return items.map(item => {
2403
+ const {
2404
+ to,
2405
+ text
2406
+ } = item;
2407
+ const {
2408
+ disabled = vui.location.match(to) || !vui.location.isAvairable(to)
2409
+ } = item;
2410
+ return { ...item,
2411
+ disabled,
2412
+ text: typeof text === 'function' ? text(vui) : text
2413
+ };
2414
+ });
2415
+ });
2416
+ const lengthRef = computed(() => computedItemsRef.value.length);
2417
+
2418
+ const defaultDividerSlot = () => {
2419
+ return [createVNode("i", {
2420
+ "class": "v-breadcrumbs__divider__icon"
2421
+ }, null)];
2422
+ };
2423
+
2424
+ return () => {
2425
+ if (lengthRef.value < 1) return;
2426
+ let dividerSlot;
2427
+ const propDivider = props.divider;
2428
+
2429
+ if (propDivider) {
2430
+ dividerSlot = typeof propDivider === 'function' ? propDivider : () => propDivider;
2431
+ } else {
2432
+ dividerSlot = defaultDividerSlot;
2433
+ }
2434
+
2435
+ const children = [];
2436
+ computedItemsRef.value.forEach((item, index) => {
2437
+ const {
2438
+ text,
2439
+ icon,
2440
+ disabled,
2441
+ to
2442
+ } = item;
2443
+
2444
+ if (index > 0) {
2445
+ const divider = dividerSlot(vui);
2446
+
2447
+ if (divider) {
2448
+ children.push(createVNode("li", {
2449
+ "class": "v-breadcrumbs__divider",
2450
+ "key": `divider-${index}`
2451
+ }, [divider]));
2452
+ }
2453
+ }
2454
+
2455
+ const myChildren = [];
2456
+
2457
+ if (icon) {
2458
+ const $icon = resolveRawIconProp(false, icon, {
2459
+ class: 'v-breadcrumbs__icon'
2460
+ });
2461
+
2462
+ if ($icon) {
2463
+ myChildren.push($icon);
2464
+ }
2465
+ }
2466
+
2467
+ if (text) myChildren.push(text);
2468
+ const itemChild = to ? createVNode(VLink, {
2469
+ "class": "v-breadcrumbs__link",
2470
+ "to": to,
2471
+ "exactActiveClass": "v-breadcrumbs__link--active"
2472
+ }, _isSlot$4(myChildren) ? myChildren : {
2473
+ default: () => [myChildren]
2474
+ }) : myChildren;
2475
+ children.push(createVNode("li", {
2476
+ "class": ['v-breadcrumbs__item', {
2477
+ 'v-breadcrumbs__item--disabled': disabled
2478
+ }],
2479
+ "key": `link-${index}`
2480
+ }, [itemChild]));
2481
+ });
2482
+ return createVNode("nav", {
2483
+ "class": "v-breadcrumbs"
2484
+ }, [createVNode("ul", {
2485
+ "class": "v-breadcrumbs__list"
2486
+ }, [children])]);
2487
+ };
2488
+ }
2489
+
2490
+ });
2491
+
2492
+ function _isSlot$3(s) {
2493
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2494
+ }
2495
+
2496
+ const VContentSwitcher = defineComponent({
2497
+ name: 'VContentSwitcher',
2498
+ props: {
2499
+ modelValue: String,
2500
+ order: {
2501
+ type: Array,
2502
+ default: () => []
2503
+ },
2504
+ autotop: [Boolean, Object]
2505
+ },
2506
+ emits: {
2507
+ 'update:modelValue': modelValue => true
2508
+ },
2509
+
2510
+ setup(props, ctx) {
2511
+ const internalValueRef = ref('');
2512
+ const transitionRef = ref('');
2513
+ const elRef = ref(null);
2514
+ const anchorRef = ref(null);
2515
+ const computedOrderRef = computed(() => props.order.map(row => {
2516
+ return typeof row === 'string' ? row : row.value;
2517
+ }));
2518
+ const currentRef = computed({
2519
+ get: () => internalValueRef.value,
2520
+ set: current => {
2521
+ if (internalValueRef.value !== current) {
2522
+ internalValueRef.value = current;
2523
+ ctx.emit('update:modelValue', current);
2524
+ }
2525
+ }
2526
+ });
2527
+ const autotopSettingsRef = computed(() => {
2528
+ let {
2529
+ autotop: settings
2530
+ } = props;
2531
+ if (settings === true) settings = {};
2532
+ if (!settings) return;
2533
+ return { ...settings
2534
+ };
2535
+ });
2536
+
2537
+ function seeTop(options) {
2538
+ const scoller = getDocumentScroller$1();
2539
+ const {
2540
+ value: anchor
2541
+ } = anchorRef;
2542
+
2543
+ if (anchor) {
2544
+ scoller.toElement(anchor, options);
2545
+ }
2546
+ }
2547
+
2548
+ function getEl() {
2549
+ const el = elRef.value;
2550
+
2551
+ if (!el) {
2552
+ throw new Error('missing element');
2553
+ }
2554
+
2555
+ return el;
2556
+ }
2557
+
2558
+ watch(() => props.modelValue, (value, beforeValue) => {
2559
+ if (value == null) return;
2560
+ internalValueRef.value = value;
2561
+ if (beforeValue == null) return;
2562
+ const order = computedOrderRef.value;
2563
+ const index = order.indexOf(value);
2564
+ const beforeIndex = order.indexOf(beforeValue);
2565
+ let transition = 'fade';
2566
+
2567
+ if (index !== -1 && beforeIndex !== -1) {
2568
+ if (index > beforeIndex) transition = 'v-content-switcher-next';
2569
+ if (index < beforeIndex) transition = 'v-content-switcher-prev';
2570
+ }
2571
+
2572
+ transitionRef.value = transition;
2573
+ }, {
2574
+ immediate: true
2575
+ });
2576
+ watch(currentRef, () => {
2577
+ const autotopSettings = autotopSettingsRef.value;
2578
+
2579
+ if (autotopSettings && props.modelValue != null) {
2580
+ seeTop(autotopSettings);
2581
+ }
2582
+ });
2583
+ return () => {
2584
+ const current = currentRef.value;
2585
+ const children = renderSlotOrEmpty$1(ctx.slots) || [];
2586
+ const currentSlot = ctx.slots[current];
2587
+
2588
+ if (currentSlot) {
2589
+ children.push(createVNode("div", {
2590
+ "class": "v-content-switcher__content",
2591
+ "key": current
2592
+ }, [currentSlot(this)]));
2593
+ }
2594
+
2595
+ return createVNode("div", {
2596
+ "class": "v-content-switcher",
2597
+ "ref": elRef
2598
+ }, [createVNode("div", {
2599
+ "class": "v-content-switcher__anchor",
2600
+ "ref": anchorRef
2601
+ }, null), createVNode(Transition, {
2602
+ "name": transitionRef.value,
2603
+ "onBeforeLeave": el => {
2604
+ getEl().style.height = el.offsetHeight + 'px';
2605
+ },
2606
+ "onEnter": el => {
2607
+ getEl().style.height = el.offsetHeight + 'px';
2608
+ },
2609
+ "onAfterEnter": () => {
2610
+ getEl().style.height = '';
2611
+ },
2612
+ "onEnterCancelled": () => {
2613
+ getEl().style.height = '';
2614
+ },
2615
+ "onLeaveCancelled": () => {
2616
+ getEl().style.height = '';
2617
+ }
2618
+ }, _isSlot$3(children) ? children : {
2619
+ default: () => [children]
2620
+ })]);
2621
+ };
2622
+ }
2623
+
2624
+ });
2625
+
2626
+ const DATA_TABLE_DEFAULTS = {
2627
+ itemKey: 'id',
2628
+ pageQuery: 'page',
2629
+ sortQuery: 'sort',
2630
+ orderQuery: 'order',
2631
+ limitQuery: 'limit',
2632
+ defaultOrder: 'ASC',
2633
+ ascQueryValue: 'ASC',
2634
+ descQueryValue: 'DESC',
2635
+ limits: [5, 10, 20, 50, 100],
2636
+ limitDefault: 20,
2637
+ contorolThreshold: 10
2638
+ };
2639
+ function configureDataTableDefaults(defaults) {
2640
+ Object.assign(DATA_TABLE_DEFAULTS, defaults);
2641
+
2642
+ if (!defaults.defaultOrder && defaults.ascQueryValue) {
2643
+ DATA_TABLE_DEFAULTS.defaultOrder = defaults.ascQueryValue;
2644
+ }
2645
+ }
2646
+ const SELECTABLE_HEADER_SYMBOL = '__selectable_header__';
2647
+ const VDataTable = defineComponent({
2648
+ name: 'VDataTable',
2649
+ props: {
2650
+ /** 選択中のkeyの配列 */
2651
+ modelValue: {
2652
+ type: Array,
2653
+ default: () => []
2654
+ },
2655
+ itemKey: {
2656
+ type: String,
2657
+ default: () => DATA_TABLE_DEFAULTS.itemKey
2658
+ },
2659
+
2660
+ /**
2661
+ * ページネーションクエリ名
2662
+ */
2663
+ pageQuery: {
2664
+ type: String,
2665
+ default: () => DATA_TABLE_DEFAULTS.pageQuery
2666
+ },
2667
+
2668
+ /**
2669
+ * ソートクエリ名
2670
+ */
2671
+ sortQuery: {
2672
+ type: String,
2673
+ default: () => DATA_TABLE_DEFAULTS.sortQuery
2674
+ },
2675
+
2676
+ /**
2677
+ * 表示順クエリ名
2678
+ */
2679
+ orderQuery: {
2680
+ type: String,
2681
+ default: () => DATA_TABLE_DEFAULTS.orderQuery
2682
+ },
2683
+
2684
+ /**
2685
+ * リミット件数クエリ名
2686
+ */
2687
+ limitQuery: {
2688
+ type: String,
2689
+ default: () => DATA_TABLE_DEFAULTS.limitQuery
2690
+ },
2691
+ defaultOrder: {
2692
+ type: String,
2693
+ default: () => DATA_TABLE_DEFAULTS.defaultOrder
2694
+ },
2695
+ ascQueryValue: {
2696
+ type: String,
2697
+ default: () => DATA_TABLE_DEFAULTS.ascQueryValue
2698
+ },
2699
+ descQueryValue: {
2700
+ type: String,
2701
+ default: () => DATA_TABLE_DEFAULTS.descQueryValue
2702
+ },
2703
+ limits: {
2704
+ type: Array,
2705
+ default: () => DATA_TABLE_DEFAULTS.limits
2706
+ },
2707
+ limitDefault: {
2708
+ type: Number,
2709
+ default: () => DATA_TABLE_DEFAULTS.limitDefault
2710
+ },
2711
+ contorolThreshold: {
2712
+ type: Number,
2713
+ default: () => DATA_TABLE_DEFAULTS.contorolThreshold
2714
+ },
2715
+ headers: {
2716
+ type: Array,
2717
+ required: true
2718
+ },
2719
+ items: {
2720
+ type: Array,
2721
+ default: () => []
2722
+ },
2723
+ total: {
2724
+ type: Number,
2725
+ default: 0
2726
+ },
2727
+ selectable: Boolean,
2728
+ fixedHeader: Boolean,
2729
+ maxHeight: [Number, String]
2730
+ },
2731
+ emits: {
2732
+ input: selecteds => true
2733
+ },
2734
+
2735
+ setup(props, ctx) {
2736
+ const vui = useVui();
2737
+ const bootedRef = ref(false);
2738
+ const footerHeightRef = ref(0);
2739
+ const internalValues = ref(props.modelValue.slice());
2740
+ const sortedItemKeysRef = computed(() => props.items.map(item => item[props.itemKey]));
2741
+ const isEmptyRef = computed(() => props.items.length === 0);
2742
+ const headersRef = computed(() => {
2743
+ const {
2744
+ headers,
2745
+ selectable
2746
+ } = props;
2747
+ const ret = [];
2748
+
2749
+ if (selectable) {
2750
+ ret.push({
2751
+ key: SELECTABLE_HEADER_SYMBOL
2752
+ });
2753
+ }
2754
+
2755
+ ret.push(...headers.filter(h => !h.hidden));
2756
+ return ret;
2757
+ });
2758
+ const classesRef = computed(() => [{
2759
+ 'v-data-table--fixed-header': props.fixedHeader
2760
+ }]);
2761
+ const layout = VAppLayoutControl.use();
2762
+ const bodyInnerStylesRef = computed(() => {
2763
+ if (!bootedRef.value) return;
2764
+ const {
2765
+ fixedHeader,
2766
+ maxHeight
2767
+ } = props;
2768
+ const footerHeight = footerHeightRef.value;
2769
+
2770
+ const _maxHeight = maxHeight || (fixedHeader ? '100%' : maxHeight);
2771
+
2772
+ if (!_maxHeight) {
2773
+ return;
2774
+ }
2775
+
2776
+ return {
2777
+ maxHeight: layout.calicurateViewHeight(_maxHeight, -footerHeight - 100, 200)
2778
+ };
2779
+ });
2780
+ const defaultOrderQueryRef = computed(() => props.defaultOrder === props.ascQueryValue ? props.ascQueryValue : props.descQueryValue);
2781
+ const isTransitioningRef = computed(() => {
2782
+ return vui.location.isQueryOnlyTransitioning([props.pageQuery, props.sortQuery, props.orderQuery, props.limitQuery]);
2783
+ });
2784
+ const pageRef = computed(() => vui.location.getQuery(props.pageQuery, Number, 1));
2785
+ const needShowHeaderControlRef = computed(() => props.items.length > props.contorolThreshold);
2786
+ const sortByRef = computed({
2787
+ get: () => {
2788
+ return vui.location.getQuery(props.sortQuery);
2789
+ },
2790
+
2791
+ set(value) {
2792
+ vui.location.pushQuery({
2793
+ [props.sortQuery]: value || null,
2794
+ [props.pageQuery]: 1
2795
+ });
2796
+ }
2797
+
2798
+ });
2799
+ const ordersRef = computed(() => [props.ascQueryValue, props.descQueryValue]);
2800
+ const usePaigingRef = computed(() => props.limits.length > 0);
2801
+ const orderByRef = computed({
2802
+ get: () => {
2803
+ const value = vui.location.getQuery(props.orderQuery);
2804
+
2805
+ if (typeof value !== 'string' || !ordersRef.value.includes(value)) {
2806
+ return;
2807
+ }
2808
+
2809
+ return value;
2810
+ },
2811
+
2812
+ set(value) {
2813
+ vui.location.pushQuery({
2814
+ [props.orderQuery]: value || null,
2815
+ [props.pageQuery]: 1
2816
+ });
2817
+ }
2818
+
2819
+ });
2820
+ const offsetRef = computed(() => (pageRef.value - 1) * limitRef.value);
2821
+ const limitRef = computed({
2822
+ get: () => vui.location.getQuery(props.limitQuery, Number, props.limitDefault),
2823
+ set: value => {
2824
+ const page = Math.floor(offsetRef.value / value) + 1;
2825
+ vui.location.pushQuery({
2826
+ [props.limitQuery]: value,
2827
+ [props.pageQuery]: page
2828
+ });
2829
+ }
2830
+ });
2831
+ const pageLengthRef = computed(() => {
2832
+ const {
2833
+ total
2834
+ } = props;
2835
+ const _limit = limitRef.value;
2836
+ if (!total) return 0;
2837
+ return Math.ceil(total / _limit);
2838
+ });
2839
+ const lengthRef = computed(() => props.items.length);
2840
+ const isASCRef = computed(() => orderByRef.value === props.ascQueryValue); // const isDESCRef = computed(() => orderByRef.value === props.descQueryValue);
2841
+
2842
+ const sortIconRef = computed(() => {
2843
+ let icon = vui.icon('sort');
2844
+
2845
+ if (typeof icon === 'string') {
2846
+ const name = icon;
2847
+
2848
+ icon = gen => {
2849
+ return gen({
2850
+ name,
2851
+ rotate: isASCRef.value ? 180 : 0
2852
+ });
2853
+ };
2854
+ }
2855
+
2856
+ return icon;
2857
+ });
2858
+ const isIndeterminateRef = computed(() => {
2859
+ const {
2860
+ length
2861
+ } = internalValues.value;
2862
+ return length > 0 && length < sortedItemKeysRef.value.length;
2863
+ });
2864
+ const isAllSelectedRef = computed(() => internalValues.value.length === sortedItemKeysRef.value.length);
2865
+
2866
+ function setSort(settings) {
2867
+ const {
2868
+ sort,
2869
+ order
2870
+ } = settings;
2871
+ if ((sort === undefined || sortByRef.value === sort) && (order === undefined || orderByRef.value === order)) return;
2872
+ const queries = {};
2873
+
2874
+ if (sort) {
2875
+ queries[props.sortQuery] = sort;
2876
+ }
2877
+
2878
+ if (order) {
2879
+ queries[props.orderQuery] = order;
2880
+ }
2881
+
2882
+ vui.location.pushQuery({ ...queries,
2883
+ [props.pageQuery]: 1
2884
+ });
2885
+ }
2886
+
2887
+ function toggleOrderBy() {
2888
+ return setSort({
2889
+ order: orderByRef.value === props.ascQueryValue ? props.descQueryValue : props.ascQueryValue
2890
+ });
2891
+ }
2892
+
2893
+ function isSelected(key) {
2894
+ return internalValues.value.includes(key);
2895
+ }
2896
+
2897
+ function select(key) {
2898
+ if (!internalValues.value.includes(key)) {
2899
+ const values = internalValues.value.slice();
2900
+ values.push(key);
2901
+ const sortedKeys = sortedItemKeysRef.value;
2902
+ values.sort((a, b) => {
2903
+ const ai = sortedKeys.indexOf(a);
2904
+ const bi = sortedKeys.indexOf(b);
2905
+ if (ai < bi) return -1;
2906
+ if (ai > bi) return 1;
2907
+ return 0;
2908
+ });
2909
+ internalValues.value = values;
2910
+ ctx.emit('input', values);
2911
+ }
2912
+ }
2913
+
2914
+ function selectAll() {
2915
+ if (!isAllSelectedRef.value) {
2916
+ const values = sortedItemKeysRef.value.slice();
2917
+ internalValues.value = values;
2918
+ ctx.emit('input', values);
2919
+ }
2920
+ }
2921
+
2922
+ function deselectAll() {
2923
+ if (internalValues.value.length) {
2924
+ const values = [];
2925
+ internalValues.value = values;
2926
+ ctx.emit('input', values);
2927
+ }
2928
+ }
2929
+
2930
+ function deselect(key) {
2931
+ const values = internalValues.value.slice();
2932
+ const index = values.indexOf(key);
2933
+
2934
+ if (index !== -1) {
2935
+ values.splice(index, 1);
2936
+ internalValues.value = values;
2937
+ ctx.emit('input', values);
2938
+ }
2939
+ }
2940
+
2941
+ function handleClickSortHeader(header, ev) {
2942
+ const {
2943
+ sortQuery
2944
+ } = header;
2945
+ if (!sortQuery) return;
2946
+
2947
+ if (sortByRef.value === sortQuery) {
2948
+ return toggleOrderBy();
2949
+ }
2950
+
2951
+ return setSort({
2952
+ sort: sortQuery,
2953
+ order: defaultOrderQueryRef.value
2954
+ });
2955
+ }
2956
+
2957
+ function genPagination() {
2958
+ return createVNode(VPagination, {
2959
+ "class": "v-data-table__pagination",
2960
+ "dense": true,
2961
+ "align": "right",
2962
+ "routeQuery": props.pageQuery,
2963
+ "modelValue": pageRef.value,
2964
+ "length": pageLengthRef.value
2965
+ }, null);
2966
+ }
2967
+
2968
+ function genControls() {
2969
+ const {
2970
+ total
2971
+ } = props;
2972
+ const offset = offsetRef.value;
2973
+ const length = lengthRef.value;
2974
+ return createVNode("div", {
2975
+ "class": "v-data-table__controls"
2976
+ }, [createVNode("div", {
2977
+ "class": "v-data-table__controls__info"
2978
+ }, [createVNode("small", {
2979
+ "class": "v-data-table__controls__info__length"
2980
+ }, [createTextVNode("\u5168 "), total, createTextVNode(" \u4EF6\u4E2D "), offset + 1, createTextVNode(" \u4EF6 \u301C "), offset + length, createTextVNode(" \u4EF6\u3092\u8868\u793A")])]), createVNode("div", {
2981
+ "class": "v-data-table__controls__select-limit"
2982
+ }, [createVNode("span", {
2983
+ "class": "v-data-table__controls__select-limit__prefix"
2984
+ }, [createTextVNode("1\u30DA\u30FC\u30B8\u306B")]), createVNode(VSelect, {
2985
+ "class": "v-data-table__controls__select-limit__node",
2986
+ "size": "sm",
2987
+ "hiddenInfo": true,
2988
+ "disabled": isTransitioningRef.value,
2989
+ "items": props.limits.map(limit => {
2990
+ return {
2991
+ label: `${limit}件`,
2992
+ value: limit
2993
+ };
2994
+ }),
2995
+ "modelValue": limitRef.value,
2996
+ "onUpdate:modelValue": $event => limitRef.value = $event
2997
+ }, null)]), createVNode("div", {
2998
+ "class": "v-data-table__controls__pagination"
2999
+ }, [genPagination()])]);
3000
+ }
3001
+
3002
+ function genTableHeader() {
3003
+ const sortBy = sortByRef.value;
3004
+ const isIndeterminate = isIndeterminateRef.value;
3005
+ const isAllSelected = isAllSelectedRef.value;
3006
+ const {
3007
+ defaultOrder,
3008
+ ascQueryValue
3009
+ } = props;
3010
+ const usePaiging = usePaigingRef.value;
3011
+ const children = headersRef.value.map(header => {
3012
+ const {
3013
+ label,
3014
+ sortQuery,
3015
+ align,
3016
+ key
3017
+ } = header;
3018
+ const headerChildren = [];
3019
+
3020
+ if (label != null && typeof label !== 'boolean') {
3021
+ let _children = typeof label === 'function' ? label(vui) : label;
3022
+
3023
+ if (_children && !Array.isArray(_children) && typeof _children === 'object') {
3024
+ _children = JSON.stringify(_children);
3025
+ }
3026
+
3027
+ headerChildren.push(_children);
3028
+ }
3029
+
3030
+ if (key === SELECTABLE_HEADER_SYMBOL) {
3031
+ headerChildren.push(createVNode(VCheckbox, {
3032
+ "modelValue": isAllSelected,
3033
+ "indeterminate": isIndeterminate,
3034
+ "onChange": ev => {
3035
+ if (isAllSelectedRef.value) {
3036
+ deselectAll();
3037
+ } else {
3038
+ selectAll();
3039
+ }
3040
+ }
3041
+ }, null));
3042
+ } // if (key === DELETOR_HEADER_SYMBOL) {
3043
+ // headerChildren.push('削除');
3044
+ // }
3045
+
3046
+
3047
+ const sortActive = sortBy === sortQuery;
3048
+
3049
+ if (sortQuery && usePaiging) {
3050
+ const isASC = sortActive ? isASCRef.value : defaultOrder === ascQueryValue;
3051
+ headerChildren.unshift(createVNode(VIcon, {
3052
+ "class": "v-data-table__table__sort-icon v-data-table__table__sort-icon--empty",
3053
+ "name": "$empty"
3054
+ }, null));
3055
+ headerChildren.push(resolveRawIconProp(false, sortIconRef.value, {
3056
+ class: ['v-data-table__table__sort-icon v-data-table__table__sort-icon--arrow', {
3057
+ 'v-data-table__table__sort-icon--asc': isASC,
3058
+ 'v-data-table__table__sort-icon--desc': !isASC
3059
+ }]
3060
+ }));
3061
+ }
3062
+
3063
+ const classes = ['v-data-table__table__cell', {
3064
+ 'v-data-table__table__cell--active': sortActive
3065
+ }];
3066
+
3067
+ if (align) {
3068
+ classes.push(`v-data-table__table__cell--${align}`);
3069
+ }
3070
+
3071
+ return createVNode("th", {
3072
+ "class": classes,
3073
+ "key": header.key,
3074
+ "tabindex": sortQuery && usePaiging ? 0 : undefined,
3075
+ "onClick": ev => {
3076
+ if (!sortQuery || !usePaiging) return;
3077
+ handleClickSortHeader(header);
3078
+ }
3079
+ }, [createVNode("div", {
3080
+ "class": "v-data-table__table__cell__tile"
3081
+ }, [headerChildren])]);
3082
+ });
3083
+ return createVNode("thead", {
3084
+ "class": "v-data-table__table__header"
3085
+ }, [createVNode("tr", null, [children])]);
3086
+ }
3087
+
3088
+ function toggleSelect(key) {
3089
+ return isSelected(key) ? deselect(key) : select(key);
3090
+ }
3091
+
3092
+ function defaultItemSlot(payload) {
3093
+ const {
3094
+ key,
3095
+ item,
3096
+ selected
3097
+ } = payload;
3098
+ const headers = headersRef.value; // const { $scopedSlots, $createElement, deletor } = this;
3099
+
3100
+ const children = headers.map(header => {
3101
+ const {
3102
+ cell,
3103
+ align,
3104
+ key: headerKey
3105
+ } = header;
3106
+ const cellSlot = cell || ctx.slots.cell;
3107
+ let cellChildren;
3108
+
3109
+ if (cellSlot) {
3110
+ const cellPayload = {
3111
+ vui,
3112
+ item,
3113
+ selected
3114
+ };
3115
+
3116
+ let _children = cellSlot(cellPayload);
3117
+
3118
+ if (_children && !Array.isArray(_children) && typeof _children === 'object') {
3119
+ _children = JSON.stringify(_children);
3120
+ }
3121
+
3122
+ cellChildren = _children;
3123
+ }
3124
+
3125
+ if (!cellChildren) {
3126
+ switch (headerKey) {
3127
+ case SELECTABLE_HEADER_SYMBOL:
3128
+ {
3129
+ cellChildren = [createVNode(VCheckbox, {
3130
+ "modelValue": selected,
3131
+ "onChange": ev => {
3132
+ toggleSelect(key);
3133
+ }
3134
+ }, null)];
3135
+ break;
3136
+ }
3137
+ // case DELETOR_HEADER_SYMBOL: {
3138
+ // if (deletor) {
3139
+ // const onClick = async (event: MouseEvent) => {
3140
+ // if (
3141
+ // await this.$confirm(`${key}を削除します。よろしいですか?`)
3142
+ // ) {
3143
+ // this.deletingTargets.push(key);
3144
+ // await deletor(item);
3145
+ // this.deletingTargets.splice(
3146
+ // this.deletingTargets.indexOf(key),
3147
+ // 1,
3148
+ // );
3149
+ // }
3150
+ // };
3151
+ // cellChildren = [
3152
+ // <VBtn
3153
+ // icon="trush"
3154
+ // onClick={onClick}
3155
+ // disabled={this.deletingTargets.includes(key)}
3156
+ // />,
3157
+ // ];
3158
+ // }
3159
+ // break;
3160
+ // }
3161
+ }
3162
+ }
3163
+
3164
+ const classes = align ? {
3165
+ [`v-data-table__table__cell--${align}`]: true
3166
+ } : undefined;
3167
+ return createVNode("td", {
3168
+ "class": ['v-data-table__table__cell', classes],
3169
+ "key": header.key
3170
+ }, [cellChildren]);
3171
+ });
3172
+ return createVNode("tr", {
3173
+ "class": ['v-data-table__table__item', {
3174
+ 'v-data-table__table__item--selected': selected
3175
+ }],
3176
+ "key": key
3177
+ }, [children]);
3178
+ }
3179
+
3180
+ function genBody() {
3181
+ const {
3182
+ items,
3183
+ itemKey
3184
+ } = props;
3185
+ const {
3186
+ item: itemSlot = defaultItemSlot
3187
+ } = ctx.slots;
3188
+ const children = items.map(item => {
3189
+ const key = item[itemKey];
3190
+ const payload = {
3191
+ key,
3192
+ item,
3193
+ selected: isSelected(key)
3194
+ };
3195
+ return itemSlot(payload);
3196
+ });
3197
+ return createVNode("tbody", {
3198
+ "class": "v-data-table__table__body"
3199
+ }, [children]);
3200
+ }
3201
+
3202
+ watch(() => props.modelValue, modelValue => {
3203
+ internalValues.value = modelValue.slice();
3204
+ });
3205
+ watch(() => props.items, items => {
3206
+ internalValues.value = internalValues.value.filter(key => {
3207
+ return sortedItemKeysRef.value.includes(key);
3208
+ });
3209
+ });
3210
+ onMounted(() => {
3211
+ bootedRef.value = true;
3212
+ });
3213
+ return () => {
3214
+ const isEmpty = isEmptyRef.value;
3215
+ const usePaiging = usePaigingRef.value;
3216
+ return createVNode("div", {
3217
+ "class": ['v-data-table', classesRef.value]
3218
+ }, [!isEmpty && usePaiging && needShowHeaderControlRef.value && createVNode("div", {
3219
+ "class": "v-data-table__header"
3220
+ }, [genControls()]), createVNode("div", {
3221
+ "class": "v-data-table__body container-pull"
3222
+ }, [isEmpty ? createVNode("div", {
3223
+ "class": "v-data-table__empty--message"
3224
+ }, null) : createVNode(VPaper, {
3225
+ "class": "v-data-table__body__inner",
3226
+ "style": bodyInnerStylesRef.value
3227
+ }, {
3228
+ default: () => [createVNode("div", {
3229
+ "class": "v-data-table__table-wrapper"
3230
+ }, [createVNode("table", {
3231
+ "class": "v-data-table__table"
3232
+ }, [genTableHeader(), genBody()])])]
3233
+ }), createVNode(Transition, {
3234
+ "name": "fade"
3235
+ }, {
3236
+ default: () => [isTransitioningRef.value && createVNode("div", {
3237
+ "class": "v-data-table__loading"
3238
+ }, [createVNode(VProgressCircular, {
3239
+ "indeterminate": true
3240
+ }, null)])]
3241
+ })]), !isEmpty && usePaiging && withDirectives(createVNode("div", {
3242
+ "class": "v-data-table__footer"
3243
+ }, [genControls()]), [resizeDirectiveArgument(({
3244
+ height
3245
+ }) => {
3246
+ footerHeightRef.value = height;
3247
+ })])]);
3248
+ };
3249
+ }
3250
+
3251
+ });
3252
+
2005
3253
  function _isSlot$2(s) {
2006
3254
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2007
3255
  }
@@ -2143,13 +3391,27 @@ class VuiService {
2143
3391
  autoScrollToElementOffsetTop;
2144
3392
  textareaRows;
2145
3393
  requiredChip;
3394
+ router;
3395
+ location;
2146
3396
  constructor(options) {
2147
3397
  this.options = options;
3398
+ this.configure();
2148
3399
  const { selectionSeparator = () => ', ', autoScrollToElementOffsetTop = DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP, textareaRows = DEFAULT_TEXTAREA_ROWS, requiredChip = () => '*', } = options;
2149
3400
  this.selectionSeparator = selectionSeparator;
2150
3401
  this.autoScrollToElementOffsetTop = autoScrollToElementOffsetTop;
2151
3402
  this.textareaRows = textareaRows;
2152
3403
  this.requiredChip = requiredChip;
3404
+ this.router = options.router;
3405
+ this.location = new LocationService({
3406
+ router: this.router,
3407
+ });
3408
+ }
3409
+ configure(options) {
3410
+ options && Object.assign(this.options, options);
3411
+ setDefaultRouterLink(this.getRouterLink());
3412
+ }
3413
+ getRouterLink() {
3414
+ return this.options.RouterLink || RouterLink;
2153
3415
  }
2154
3416
  setting(key) {
2155
3417
  return this.options.uiSettings[key];
@@ -2227,4 +3489,4 @@ function installVuiPlugin(app, opts) {
2227
3489
  return app.use(VuiPlugin, opts);
2228
3490
  }
2229
3491
 
2230
- export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VDrawerLayout, VForm, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
3492
+ export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };