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