@fastkit/vui 0.6.17 → 0.6.28
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 +9 -4
- package/dist/tool/vite-plugin.d.ts.map +1 -1
- package/dist/vui.cjs.js +1043 -18
- package/dist/vui.cjs.prod.js +1043 -18
- package/dist/vui.css +331 -4
- package/dist/vui.d.ts +489 -3
- package/dist/vui.esm-bundler.js +1040 -22
- 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,15 @@
|
|
|
1
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';
|
|
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, 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';
|
|
11
13
|
|
|
12
14
|
const CONTROL_SIZES = ['sm', 'md', 'lg'];
|
|
13
15
|
const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
|
|
@@ -161,7 +163,7 @@ const VFormControl = defineComponent({
|
|
|
161
163
|
}
|
|
162
164
|
}, [label, control.required && vui.getRequiredChip()]), createVNode("div", {
|
|
163
165
|
"class": "v-form-control__body"
|
|
164
|
-
}, [renderSlotOrEmpty(ctx.slots, 'default', control), createVNode("div", {
|
|
166
|
+
}, [renderSlotOrEmpty(ctx.slots, 'default', control), !props.hiddenInfo && createVNode("div", {
|
|
165
167
|
"class": "v-form-control__info"
|
|
166
168
|
}, [!!message && createVNode("div", {
|
|
167
169
|
"class": "v-form-control__message"
|
|
@@ -214,6 +216,7 @@ function defineFormSelectorComponent(opts) {
|
|
|
214
216
|
return createVNode(VFormControl, {
|
|
215
217
|
"nodeControl": this.nodeControl,
|
|
216
218
|
"focused": this.nodeControl.focused,
|
|
219
|
+
"hiddenInfo": this.hiddenInfo,
|
|
217
220
|
"class": ['v-form-selector', className, { ...this.classes,
|
|
218
221
|
'v-form-selector--stacked': this.stacked
|
|
219
222
|
}],
|
|
@@ -530,6 +533,299 @@ const VButton = defineComponent({
|
|
|
530
533
|
|
|
531
534
|
});
|
|
532
535
|
|
|
536
|
+
function _isSlot$8(s) {
|
|
537
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
const PAGINATION_ALIGNS = ['left', 'center', 'right'];
|
|
541
|
+
function paginationProps() {
|
|
542
|
+
return createPropsOptions$1({
|
|
543
|
+
/**
|
|
544
|
+
* Active Pages
|
|
545
|
+
*/
|
|
546
|
+
modelValue: {
|
|
547
|
+
type: rawNumberPropType,
|
|
548
|
+
default: 1
|
|
549
|
+
},
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Total number of pages
|
|
553
|
+
*/
|
|
554
|
+
length: {
|
|
555
|
+
type: rawNumberPropType,
|
|
556
|
+
default: 0
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Maximum number of links to display.
|
|
561
|
+
*/
|
|
562
|
+
totalVisible: rawNumberPropType,
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* true when narrowing
|
|
566
|
+
*/
|
|
567
|
+
dense: Boolean,
|
|
568
|
+
disabled: Boolean,
|
|
569
|
+
align: {
|
|
570
|
+
type: String,
|
|
571
|
+
default: 'center'
|
|
572
|
+
},
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* To synchronize with a query, use the query name
|
|
576
|
+
*/
|
|
577
|
+
routeQuery: String,
|
|
578
|
+
beforeChange: Function,
|
|
579
|
+
color: String
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
const VPagination = defineComponent({
|
|
583
|
+
name: 'VPagination',
|
|
584
|
+
props: paginationProps(),
|
|
585
|
+
emits: {
|
|
586
|
+
change: page => true
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
setup(props, ctx) {
|
|
590
|
+
const vui = useVui();
|
|
591
|
+
const elRef = ref(null);
|
|
592
|
+
const router = useRouter();
|
|
593
|
+
const internalValue = ref(1);
|
|
594
|
+
const containerWidth = ref(0);
|
|
595
|
+
const itemSize = ref(0);
|
|
596
|
+
const capacityLength = computed(() => {
|
|
597
|
+
const _itemSize = itemSize.value;
|
|
598
|
+
if (!_itemSize) return 0;
|
|
599
|
+
return Math.floor(containerWidth.value / _itemSize);
|
|
600
|
+
});
|
|
601
|
+
const colorScope = useScopeColorClass({
|
|
602
|
+
color: () => props.color || vui.setting('primaryScope')
|
|
603
|
+
});
|
|
604
|
+
const computedLength = computed(() => resolveNumberish(props.length));
|
|
605
|
+
const computedTotalVisible = computed(() => resolveNumberish(props.totalVisible));
|
|
606
|
+
const computedNumbersLength = computed(() => capacityLength.value - 2 - 2);
|
|
607
|
+
const computedPage = computed(() => {
|
|
608
|
+
const {
|
|
609
|
+
routeQuery
|
|
610
|
+
} = props;
|
|
611
|
+
|
|
612
|
+
if (routeQuery) {
|
|
613
|
+
return vui.location.getQuery(routeQuery, Number, 1);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return internalValue.value;
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
const _range = (from, to) => {
|
|
620
|
+
const range = [];
|
|
621
|
+
from = from > 0 ? from : 1;
|
|
622
|
+
|
|
623
|
+
for (let i = from; i <= to; i++) {
|
|
624
|
+
range.push(i);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return range;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
const computedItems = computed(() => {
|
|
631
|
+
const maxButtons = computedNumbersLength.value;
|
|
632
|
+
const totalVisible = computedTotalVisible.value;
|
|
633
|
+
const length = computedLength.value;
|
|
634
|
+
const pageValue = computedPage.value;
|
|
635
|
+
const maxLength = Math.min(Math.max(0, totalVisible || 0) || length, Math.max(0, maxButtons) || length, length);
|
|
636
|
+
|
|
637
|
+
if (length <= maxLength) {
|
|
638
|
+
return _range(1, length);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
const even = maxLength % 2 === 0 ? 1 : 0;
|
|
642
|
+
const left = Math.floor(maxLength / 2);
|
|
643
|
+
const right = length - left + 1 + even;
|
|
644
|
+
|
|
645
|
+
if (pageValue > left && pageValue < right) {
|
|
646
|
+
const start = pageValue - left + 2;
|
|
647
|
+
const end = pageValue + left - 2 - even;
|
|
648
|
+
return [1, 'truncate', ..._range(start, end), 'truncate', length];
|
|
649
|
+
} else if (pageValue === left) {
|
|
650
|
+
const end = pageValue + left - 1 - even;
|
|
651
|
+
return [..._range(1, end), 'truncate', length];
|
|
652
|
+
} else if (pageValue === right) {
|
|
653
|
+
const start = pageValue - left + 1;
|
|
654
|
+
return [1, 'truncate', ..._range(start, length)];
|
|
655
|
+
} else {
|
|
656
|
+
return [..._range(1, left), 'truncate', ..._range(right, length)];
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
const isActive = computed(() => computedLength.value > 1);
|
|
660
|
+
const isTransitioning = computed(() => {
|
|
661
|
+
const {
|
|
662
|
+
routeQuery
|
|
663
|
+
} = props;
|
|
664
|
+
return vui.location.isQueryOnlyTransitioning(routeQuery);
|
|
665
|
+
});
|
|
666
|
+
const isDisabled = computed(() => props.disabled || isTransitioning.value);
|
|
667
|
+
const classes = computed(() => [{
|
|
668
|
+
'v-pagination--disabled': isDisabled.value,
|
|
669
|
+
'v-pagination--dense': props.dense,
|
|
670
|
+
[`v-pagination--${props.align}`]: true
|
|
671
|
+
}, colorScope.value.className]);
|
|
672
|
+
|
|
673
|
+
async function setPage(value) {
|
|
674
|
+
if (isDisabled.value) return;
|
|
675
|
+
const {
|
|
676
|
+
beforeChange,
|
|
677
|
+
routeQuery
|
|
678
|
+
} = props;
|
|
679
|
+
const newPage = resolveNumberish(value);
|
|
680
|
+
if (computedPage.value === newPage) return;
|
|
681
|
+
|
|
682
|
+
if (beforeChange) {
|
|
683
|
+
try {
|
|
684
|
+
let result = beforeChange(newPage);
|
|
685
|
+
if (isPromise(result)) result = await result;
|
|
686
|
+
if (result === false) return;
|
|
687
|
+
} catch (e) {}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
if (routeQuery) {
|
|
691
|
+
const to = createRoutableLocationByPage(newPage, routeQuery);
|
|
692
|
+
return router.push(to).then(failure => {
|
|
693
|
+
!failure && ctx.emit('change', newPage);
|
|
694
|
+
});
|
|
695
|
+
} else {
|
|
696
|
+
internalValue.value = newPage;
|
|
697
|
+
ctx.emit('update:modelValue', newPage);
|
|
698
|
+
ctx.emit('change', newPage);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function createPageInfo(source) {
|
|
703
|
+
const currentPage = computedPage.value;
|
|
704
|
+
const length = computedLength.value;
|
|
705
|
+
let number;
|
|
706
|
+
let page;
|
|
707
|
+
let active;
|
|
708
|
+
let disabled;
|
|
709
|
+
|
|
710
|
+
if (typeof source === 'number') {
|
|
711
|
+
number = true;
|
|
712
|
+
page = source;
|
|
713
|
+
active = currentPage === page;
|
|
714
|
+
disabled = false;
|
|
715
|
+
} else if (source === 'truncate') {
|
|
716
|
+
number = false;
|
|
717
|
+
active = false;
|
|
718
|
+
disabled = false;
|
|
719
|
+
} else {
|
|
720
|
+
number = false;
|
|
721
|
+
const isPrev = source === 'prev';
|
|
722
|
+
const ammount = isPrev ? -1 : 1;
|
|
723
|
+
page = currentPage + ammount;
|
|
724
|
+
active = false;
|
|
725
|
+
disabled = page < 1 || page > length;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
return {
|
|
729
|
+
number,
|
|
730
|
+
page,
|
|
731
|
+
active,
|
|
732
|
+
disabled
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function createRoutableLocationByPage(page, routeQuery) {
|
|
737
|
+
return vui.location.getQueryMergedLocation({
|
|
738
|
+
[routeQuery]: page
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function genItem(source, index) {
|
|
743
|
+
const {
|
|
744
|
+
number,
|
|
745
|
+
page,
|
|
746
|
+
active,
|
|
747
|
+
disabled
|
|
748
|
+
} = createPageInfo(source);
|
|
749
|
+
const type = number ? 'num' : source;
|
|
750
|
+
const classes = ['v-pagination__item', {
|
|
751
|
+
[`v-pagination__item--${type}`]: true,
|
|
752
|
+
'v-pagination__item--active': active,
|
|
753
|
+
'v-pagination__item--disabled': disabled
|
|
754
|
+
}];
|
|
755
|
+
const children = number ? page : (() => {
|
|
756
|
+
if (type === 'truncate') {
|
|
757
|
+
return createVNode("span", null, [createTextVNode("...")]);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
const isPrev = type === 'prev';
|
|
761
|
+
const icon = isPrev ? vui.icon('prev') : vui.icon('next');
|
|
762
|
+
return resolveRawIconProp(false, icon, {
|
|
763
|
+
class: 'v-pagination__item__icon'
|
|
764
|
+
});
|
|
765
|
+
})();
|
|
766
|
+
|
|
767
|
+
const onClick = ev => {
|
|
768
|
+
ev.preventDefault();
|
|
769
|
+
if (page === undefined || active || disabled) return;
|
|
770
|
+
setPage(page);
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
const key = `${source}-${index}`;
|
|
774
|
+
const {
|
|
775
|
+
routeQuery
|
|
776
|
+
} = props;
|
|
777
|
+
|
|
778
|
+
if (page !== undefined && routeQuery) {
|
|
779
|
+
const to = createRoutableLocationByPage(page, routeQuery);
|
|
780
|
+
return createVNode(RouterLink, {
|
|
781
|
+
"class": classes,
|
|
782
|
+
"to": to,
|
|
783
|
+
"key": key
|
|
784
|
+
}, _isSlot$8(children) ? children : {
|
|
785
|
+
default: () => [children]
|
|
786
|
+
});
|
|
787
|
+
} else {
|
|
788
|
+
return createVNode("button", {
|
|
789
|
+
"class": classes,
|
|
790
|
+
"type": "button",
|
|
791
|
+
"value": page,
|
|
792
|
+
"onClick": onClick,
|
|
793
|
+
"key": key
|
|
794
|
+
}, [children]);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
watch(() => props.modelValue, modelValue => {
|
|
799
|
+
internalValue.value = resolveNumberish(modelValue);
|
|
800
|
+
}, {
|
|
801
|
+
immediate: true
|
|
802
|
+
});
|
|
803
|
+
return () => {
|
|
804
|
+
if (!isActive.value) return undefined;
|
|
805
|
+
const $items = ['prev', ...computedItems.value, 'next'].map((i, index) => genItem(i, index));
|
|
806
|
+
return withDirectives(createVNode("nav", {
|
|
807
|
+
"class": ['v-pagination', classes.value],
|
|
808
|
+
"ref": elRef
|
|
809
|
+
}, [$items]), [resizeDirectiveArgument(({
|
|
810
|
+
width
|
|
811
|
+
}) => {
|
|
812
|
+
const el = elRef.value;
|
|
813
|
+
|
|
814
|
+
if (el) {
|
|
815
|
+
const style = window.getComputedStyle(el, 'before');
|
|
816
|
+
const width = style.getPropertyValue('width');
|
|
817
|
+
const margin = style.getPropertyValue('margin');
|
|
818
|
+
const size = parseFloat(width) + parseFloat(margin) * 0.5;
|
|
819
|
+
itemSize.value = size;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
containerWidth.value = width;
|
|
823
|
+
})]);
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
});
|
|
828
|
+
|
|
533
829
|
function createListTileProps() {
|
|
534
830
|
const icon = rawIconProp();
|
|
535
831
|
return { ...navigationableProps,
|
|
@@ -541,7 +837,8 @@ function createListTileProps() {
|
|
|
541
837
|
default: 'div'
|
|
542
838
|
},
|
|
543
839
|
startIconEmptySpace: Boolean,
|
|
544
|
-
color: String
|
|
840
|
+
color: String,
|
|
841
|
+
exactMatch: Boolean
|
|
545
842
|
})
|
|
546
843
|
};
|
|
547
844
|
}
|
|
@@ -572,7 +869,7 @@ const VListTile = defineComponent({
|
|
|
572
869
|
});
|
|
573
870
|
const isActive = computed(() => {
|
|
574
871
|
if (!hasTo.value) return false;
|
|
575
|
-
return link.isActive.value;
|
|
872
|
+
return props.exactMatch ? link.isExactActive.value : link.isActive.value;
|
|
576
873
|
});
|
|
577
874
|
const color = useScopeColorClass(props);
|
|
578
875
|
const classes = computed(() => {
|
|
@@ -649,7 +946,52 @@ const VDrawerLayout = defineComponent({
|
|
|
649
946
|
|
|
650
947
|
});
|
|
651
948
|
|
|
652
|
-
function _isSlot$
|
|
949
|
+
function _isSlot$7(s) {
|
|
950
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
const VHero = defineComponent({
|
|
954
|
+
name: 'VHero',
|
|
955
|
+
props: {
|
|
956
|
+
color: {
|
|
957
|
+
type: String,
|
|
958
|
+
default: 'primary'
|
|
959
|
+
},
|
|
960
|
+
tag: {
|
|
961
|
+
type: String,
|
|
962
|
+
default: 'header'
|
|
963
|
+
},
|
|
964
|
+
hTag: {
|
|
965
|
+
type: String,
|
|
966
|
+
default: 'h1'
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
|
|
970
|
+
setup(props, ctx) {
|
|
971
|
+
return () => {
|
|
972
|
+
let _slot;
|
|
973
|
+
|
|
974
|
+
const TagName = props.tag;
|
|
975
|
+
const HTagName = props.hTag;
|
|
976
|
+
return createVNode(VAppContainer, {
|
|
977
|
+
"pulled": true
|
|
978
|
+
}, {
|
|
979
|
+
default: () => [createVNode(TagName, {
|
|
980
|
+
"class": ['v-hero', toScopeColorClass(props.color)]
|
|
981
|
+
}, {
|
|
982
|
+
default: () => [createVNode(HTagName, {
|
|
983
|
+
"class": "v-hero__title"
|
|
984
|
+
}, _isSlot$7(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
985
|
+
default: () => [_slot]
|
|
986
|
+
})]
|
|
987
|
+
})]
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
function _isSlot$6(s) {
|
|
653
995
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
654
996
|
}
|
|
655
997
|
|
|
@@ -680,7 +1022,7 @@ function renderNavigationItemInput(input, extraProps) {
|
|
|
680
1022
|
} = resolveNavigationItemInput(input);
|
|
681
1023
|
return createVNode(VNavigationItem, { ...props,
|
|
682
1024
|
...extraProps
|
|
683
|
-
}, _isSlot$
|
|
1025
|
+
}, _isSlot$6(label) ? label : {
|
|
684
1026
|
default: () => [label]
|
|
685
1027
|
});
|
|
686
1028
|
}
|
|
@@ -824,7 +1166,7 @@ const VNavigationItem = defineComponent({
|
|
|
824
1166
|
"class": ['v-navigation-item', classes.value],
|
|
825
1167
|
"onClick": onClick,
|
|
826
1168
|
"onChangeActive": onChangeActive
|
|
827
|
-
}), _isSlot$
|
|
1169
|
+
}), _isSlot$6(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
828
1170
|
default: () => [_slot]
|
|
829
1171
|
}), _children && createVNode(VExpandTransition, null, {
|
|
830
1172
|
default: () => [withDirectives(createVNode("div", {
|
|
@@ -972,7 +1314,7 @@ const VCheckbox = defineComponent({
|
|
|
972
1314
|
|
|
973
1315
|
});
|
|
974
1316
|
|
|
975
|
-
function _isSlot$
|
|
1317
|
+
function _isSlot$5(s) {
|
|
976
1318
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
977
1319
|
}
|
|
978
1320
|
|
|
@@ -984,7 +1326,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
|
|
|
984
1326
|
itemRenderer: ({
|
|
985
1327
|
attrs,
|
|
986
1328
|
slots
|
|
987
|
-
}) => createVNode(VCheckbox, attrs, _isSlot$
|
|
1329
|
+
}) => createVNode(VCheckbox, attrs, _isSlot$5(slots) ? slots : {
|
|
988
1330
|
default: () => [slots]
|
|
989
1331
|
})
|
|
990
1332
|
});
|
|
@@ -1036,7 +1378,7 @@ const VRadio = defineComponent({
|
|
|
1036
1378
|
|
|
1037
1379
|
});
|
|
1038
1380
|
|
|
1039
|
-
function _isSlot$
|
|
1381
|
+
function _isSlot$4(s) {
|
|
1040
1382
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1041
1383
|
}
|
|
1042
1384
|
|
|
@@ -1047,7 +1389,7 @@ const VRadioGroup = defineFormSelectorComponent({
|
|
|
1047
1389
|
itemRenderer: ({
|
|
1048
1390
|
attrs,
|
|
1049
1391
|
slots
|
|
1050
|
-
}) => createVNode(VRadio, attrs, _isSlot$
|
|
1392
|
+
}) => createVNode(VRadio, attrs, _isSlot$4(slots) ? slots : {
|
|
1051
1393
|
default: () => [slots]
|
|
1052
1394
|
})
|
|
1053
1395
|
});
|
|
@@ -1109,7 +1451,7 @@ const VSwitch = defineComponent({
|
|
|
1109
1451
|
|
|
1110
1452
|
});
|
|
1111
1453
|
|
|
1112
|
-
function _isSlot$
|
|
1454
|
+
function _isSlot$3(s) {
|
|
1113
1455
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1114
1456
|
}
|
|
1115
1457
|
|
|
@@ -1121,7 +1463,7 @@ const VSwitchGroup = defineFormSelectorComponent({
|
|
|
1121
1463
|
itemRenderer: ({
|
|
1122
1464
|
attrs,
|
|
1123
1465
|
slots
|
|
1124
|
-
}) => createVNode(VSwitch, attrs, _isSlot$
|
|
1466
|
+
}) => createVNode(VSwitch, attrs, _isSlot$3(slots) ? slots : {
|
|
1125
1467
|
default: () => [slots]
|
|
1126
1468
|
})
|
|
1127
1469
|
});
|
|
@@ -1405,6 +1747,7 @@ const VSelect = defineComponent({
|
|
|
1405
1747
|
"class": ['v-select', this.classes],
|
|
1406
1748
|
"label": this.label,
|
|
1407
1749
|
"hint": this.hint,
|
|
1750
|
+
"hiddenInfo": this.hiddenInfo,
|
|
1408
1751
|
"onClickLabel": ev => {
|
|
1409
1752
|
this.focus();
|
|
1410
1753
|
}
|
|
@@ -1431,7 +1774,20 @@ const VSelect = defineComponent({
|
|
|
1431
1774
|
"focused": this.menuOpened,
|
|
1432
1775
|
"onClick": ev => {
|
|
1433
1776
|
if (this.canOperation && !control.isActive) {
|
|
1434
|
-
|
|
1777
|
+
let t = ev.target;
|
|
1778
|
+
const count = 0;
|
|
1779
|
+
let hit = false;
|
|
1780
|
+
|
|
1781
|
+
while (count < 5) {
|
|
1782
|
+
if (t.classList.contains('v-select__input')) {
|
|
1783
|
+
hit = true;
|
|
1784
|
+
break;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
t = t.parentElement;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
control.show(hit ? t : ev);
|
|
1435
1791
|
}
|
|
1436
1792
|
}
|
|
1437
1793
|
}, { ...this.$slots,
|
|
@@ -1516,6 +1872,7 @@ const VTextField = defineComponent({
|
|
|
1516
1872
|
return createVNode(VFormControl, {
|
|
1517
1873
|
"nodeControl": this.nodeControl,
|
|
1518
1874
|
"focused": this.nodeControl.focused,
|
|
1875
|
+
"hiddenInfo": this.hiddenInfo,
|
|
1519
1876
|
"class": ['v-text-field', this.classes],
|
|
1520
1877
|
"label": this.label,
|
|
1521
1878
|
"hint": this.hint,
|
|
@@ -1579,6 +1936,7 @@ const VTextarea = defineComponent({
|
|
|
1579
1936
|
"class": ['v-textarea', this.classes],
|
|
1580
1937
|
"label": this.label,
|
|
1581
1938
|
"hint": this.hint,
|
|
1939
|
+
"hiddenInfo": this.hiddenInfo,
|
|
1582
1940
|
"onClickLabel": ev => {
|
|
1583
1941
|
this.focus();
|
|
1584
1942
|
}
|
|
@@ -1664,7 +2022,634 @@ const VForm = defineComponent({
|
|
|
1664
2022
|
|
|
1665
2023
|
});
|
|
1666
2024
|
|
|
1667
|
-
|
|
2025
|
+
const DATA_TABLE_DEFAULTS = {
|
|
2026
|
+
itemKey: 'id',
|
|
2027
|
+
pageQuery: 'page',
|
|
2028
|
+
sortQuery: 'sort',
|
|
2029
|
+
orderQuery: 'order',
|
|
2030
|
+
limitQuery: 'limit',
|
|
2031
|
+
defaultOrder: 'ASC',
|
|
2032
|
+
ascQueryValue: 'ASC',
|
|
2033
|
+
descQueryValue: 'DESC',
|
|
2034
|
+
limits: [5, 10, 20, 50, 100],
|
|
2035
|
+
limitDefault: 20,
|
|
2036
|
+
contorolThreshold: 10
|
|
2037
|
+
};
|
|
2038
|
+
function configureDataTableDefaults(defaults) {
|
|
2039
|
+
Object.assign(DATA_TABLE_DEFAULTS, defaults);
|
|
2040
|
+
|
|
2041
|
+
if (!defaults.defaultOrder && defaults.ascQueryValue) {
|
|
2042
|
+
DATA_TABLE_DEFAULTS.defaultOrder = defaults.ascQueryValue;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
const SELECTABLE_HEADER_SYMBOL = '__selectable_header__';
|
|
2046
|
+
const VDataTable = defineComponent({
|
|
2047
|
+
name: 'VDataTable',
|
|
2048
|
+
props: {
|
|
2049
|
+
/** 選択中のkeyの配列 */
|
|
2050
|
+
modelValue: {
|
|
2051
|
+
type: Array,
|
|
2052
|
+
default: () => []
|
|
2053
|
+
},
|
|
2054
|
+
itemKey: {
|
|
2055
|
+
type: String,
|
|
2056
|
+
default: () => DATA_TABLE_DEFAULTS.itemKey
|
|
2057
|
+
},
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* ページネーションクエリ名
|
|
2061
|
+
*/
|
|
2062
|
+
pageQuery: {
|
|
2063
|
+
type: String,
|
|
2064
|
+
default: () => DATA_TABLE_DEFAULTS.pageQuery
|
|
2065
|
+
},
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* ソートクエリ名
|
|
2069
|
+
*/
|
|
2070
|
+
sortQuery: {
|
|
2071
|
+
type: String,
|
|
2072
|
+
default: () => DATA_TABLE_DEFAULTS.sortQuery
|
|
2073
|
+
},
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* 表示順クエリ名
|
|
2077
|
+
*/
|
|
2078
|
+
orderQuery: {
|
|
2079
|
+
type: String,
|
|
2080
|
+
default: () => DATA_TABLE_DEFAULTS.orderQuery
|
|
2081
|
+
},
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* リミット件数クエリ名
|
|
2085
|
+
*/
|
|
2086
|
+
limitQuery: {
|
|
2087
|
+
type: String,
|
|
2088
|
+
default: () => DATA_TABLE_DEFAULTS.limitQuery
|
|
2089
|
+
},
|
|
2090
|
+
defaultOrder: {
|
|
2091
|
+
type: String,
|
|
2092
|
+
default: () => DATA_TABLE_DEFAULTS.defaultOrder
|
|
2093
|
+
},
|
|
2094
|
+
ascQueryValue: {
|
|
2095
|
+
type: String,
|
|
2096
|
+
default: () => DATA_TABLE_DEFAULTS.ascQueryValue
|
|
2097
|
+
},
|
|
2098
|
+
descQueryValue: {
|
|
2099
|
+
type: String,
|
|
2100
|
+
default: () => DATA_TABLE_DEFAULTS.descQueryValue
|
|
2101
|
+
},
|
|
2102
|
+
limits: {
|
|
2103
|
+
type: Array,
|
|
2104
|
+
default: () => DATA_TABLE_DEFAULTS.limits
|
|
2105
|
+
},
|
|
2106
|
+
limitDefault: {
|
|
2107
|
+
type: Number,
|
|
2108
|
+
default: () => DATA_TABLE_DEFAULTS.limitDefault
|
|
2109
|
+
},
|
|
2110
|
+
contorolThreshold: {
|
|
2111
|
+
type: Number,
|
|
2112
|
+
default: () => DATA_TABLE_DEFAULTS.contorolThreshold
|
|
2113
|
+
},
|
|
2114
|
+
headers: {
|
|
2115
|
+
type: Array,
|
|
2116
|
+
required: true
|
|
2117
|
+
},
|
|
2118
|
+
items: {
|
|
2119
|
+
type: Array,
|
|
2120
|
+
default: () => []
|
|
2121
|
+
},
|
|
2122
|
+
total: {
|
|
2123
|
+
type: Number,
|
|
2124
|
+
default: 0
|
|
2125
|
+
},
|
|
2126
|
+
selectable: Boolean,
|
|
2127
|
+
fixedHeader: Boolean,
|
|
2128
|
+
maxHeight: [Number, String]
|
|
2129
|
+
},
|
|
2130
|
+
emits: {
|
|
2131
|
+
input: selecteds => true
|
|
2132
|
+
},
|
|
2133
|
+
|
|
2134
|
+
setup(props, ctx) {
|
|
2135
|
+
const vui = useVui();
|
|
2136
|
+
const bootedRef = ref(false);
|
|
2137
|
+
const footerHeightRef = ref(0);
|
|
2138
|
+
const internalValues = ref(props.modelValue.slice());
|
|
2139
|
+
const sortedItemKeysRef = computed(() => props.items.map(item => item[props.itemKey]));
|
|
2140
|
+
const isEmptyRef = computed(() => props.items.length === 0);
|
|
2141
|
+
const headersRef = computed(() => {
|
|
2142
|
+
const {
|
|
2143
|
+
headers,
|
|
2144
|
+
selectable
|
|
2145
|
+
} = props;
|
|
2146
|
+
const ret = [];
|
|
2147
|
+
|
|
2148
|
+
if (selectable) {
|
|
2149
|
+
ret.push({
|
|
2150
|
+
key: SELECTABLE_HEADER_SYMBOL
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
ret.push(...headers.filter(h => !h.hidden));
|
|
2155
|
+
return ret;
|
|
2156
|
+
});
|
|
2157
|
+
const classesRef = computed(() => [{
|
|
2158
|
+
'v-data-table--fixed-header': props.fixedHeader
|
|
2159
|
+
}]);
|
|
2160
|
+
const layout = VAppLayoutControl.use();
|
|
2161
|
+
const bodyInnerStylesRef = computed(() => {
|
|
2162
|
+
if (!bootedRef.value) return;
|
|
2163
|
+
const {
|
|
2164
|
+
fixedHeader,
|
|
2165
|
+
maxHeight
|
|
2166
|
+
} = props;
|
|
2167
|
+
const footerHeight = footerHeightRef.value;
|
|
2168
|
+
|
|
2169
|
+
const _maxHeight = maxHeight || (fixedHeader ? '100%' : maxHeight);
|
|
2170
|
+
|
|
2171
|
+
if (!_maxHeight) {
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
return {
|
|
2176
|
+
maxHeight: layout.calicurateViewHeight(_maxHeight, -footerHeight - 100, 200)
|
|
2177
|
+
};
|
|
2178
|
+
});
|
|
2179
|
+
const defaultOrderQueryRef = computed(() => props.defaultOrder === props.ascQueryValue ? props.ascQueryValue : props.descQueryValue);
|
|
2180
|
+
const isTransitioningRef = computed(() => {
|
|
2181
|
+
return vui.location.isQueryOnlyTransitioning([props.pageQuery, props.sortQuery, props.orderQuery, props.limitQuery]);
|
|
2182
|
+
});
|
|
2183
|
+
const pageRef = computed(() => vui.location.getQuery(props.pageQuery, Number, 1));
|
|
2184
|
+
const needShowHeaderControlRef = computed(() => props.items.length > props.contorolThreshold);
|
|
2185
|
+
const sortByRef = computed({
|
|
2186
|
+
get: () => {
|
|
2187
|
+
return vui.location.getQuery(props.sortQuery);
|
|
2188
|
+
},
|
|
2189
|
+
|
|
2190
|
+
set(value) {
|
|
2191
|
+
vui.location.pushQuery({
|
|
2192
|
+
[props.sortQuery]: value || null,
|
|
2193
|
+
[props.pageQuery]: 1
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
});
|
|
2198
|
+
const ordersRef = computed(() => [props.ascQueryValue, props.descQueryValue]);
|
|
2199
|
+
const usePaigingRef = computed(() => props.limits.length > 0);
|
|
2200
|
+
const orderByRef = computed({
|
|
2201
|
+
get: () => {
|
|
2202
|
+
const value = vui.location.getQuery(props.orderQuery);
|
|
2203
|
+
|
|
2204
|
+
if (typeof value !== 'string' || !ordersRef.value.includes(value)) {
|
|
2205
|
+
return;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
return value;
|
|
2209
|
+
},
|
|
2210
|
+
|
|
2211
|
+
set(value) {
|
|
2212
|
+
vui.location.pushQuery({
|
|
2213
|
+
[props.orderQuery]: value || null,
|
|
2214
|
+
[props.pageQuery]: 1
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
});
|
|
2219
|
+
const offsetRef = computed(() => (pageRef.value - 1) * limitRef.value);
|
|
2220
|
+
const limitRef = computed({
|
|
2221
|
+
get: () => vui.location.getQuery(props.limitQuery, Number, props.limitDefault),
|
|
2222
|
+
set: value => {
|
|
2223
|
+
const page = Math.floor(offsetRef.value / value) + 1;
|
|
2224
|
+
vui.location.pushQuery({
|
|
2225
|
+
[props.limitQuery]: value,
|
|
2226
|
+
[props.pageQuery]: page
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
const pageLengthRef = computed(() => {
|
|
2231
|
+
const {
|
|
2232
|
+
total
|
|
2233
|
+
} = props;
|
|
2234
|
+
const _limit = limitRef.value;
|
|
2235
|
+
if (!total) return 0;
|
|
2236
|
+
return Math.ceil(total / _limit);
|
|
2237
|
+
});
|
|
2238
|
+
const lengthRef = computed(() => props.items.length);
|
|
2239
|
+
const isASCRef = computed(() => orderByRef.value === props.ascQueryValue); // const isDESCRef = computed(() => orderByRef.value === props.descQueryValue);
|
|
2240
|
+
|
|
2241
|
+
const sortIconRef = computed(() => {
|
|
2242
|
+
let icon = vui.icon('sort');
|
|
2243
|
+
|
|
2244
|
+
if (typeof icon === 'string') {
|
|
2245
|
+
const name = icon;
|
|
2246
|
+
|
|
2247
|
+
icon = gen => {
|
|
2248
|
+
return gen({
|
|
2249
|
+
name,
|
|
2250
|
+
rotate: isASCRef.value ? 180 : 0
|
|
2251
|
+
});
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
return icon;
|
|
2256
|
+
});
|
|
2257
|
+
const isIndeterminateRef = computed(() => {
|
|
2258
|
+
const {
|
|
2259
|
+
length
|
|
2260
|
+
} = internalValues.value;
|
|
2261
|
+
return length > 0 && length < sortedItemKeysRef.value.length;
|
|
2262
|
+
});
|
|
2263
|
+
const isAllSelectedRef = computed(() => internalValues.value.length === sortedItemKeysRef.value.length);
|
|
2264
|
+
|
|
2265
|
+
function setSort(settings) {
|
|
2266
|
+
const {
|
|
2267
|
+
sort,
|
|
2268
|
+
order
|
|
2269
|
+
} = settings;
|
|
2270
|
+
if ((sort === undefined || sortByRef.value === sort) && (order === undefined || orderByRef.value === order)) return;
|
|
2271
|
+
const queries = {};
|
|
2272
|
+
|
|
2273
|
+
if (sort) {
|
|
2274
|
+
queries[props.sortQuery] = sort;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
if (order) {
|
|
2278
|
+
queries[props.orderQuery] = order;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
vui.location.pushQuery({ ...queries,
|
|
2282
|
+
[props.pageQuery]: 1
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
function toggleOrderBy() {
|
|
2287
|
+
return setSort({
|
|
2288
|
+
order: orderByRef.value === props.ascQueryValue ? props.descQueryValue : props.ascQueryValue
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
function isSelected(key) {
|
|
2293
|
+
return internalValues.value.includes(key);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
function select(key) {
|
|
2297
|
+
if (!internalValues.value.includes(key)) {
|
|
2298
|
+
const values = internalValues.value.slice();
|
|
2299
|
+
values.push(key);
|
|
2300
|
+
const sortedKeys = sortedItemKeysRef.value;
|
|
2301
|
+
values.sort((a, b) => {
|
|
2302
|
+
const ai = sortedKeys.indexOf(a);
|
|
2303
|
+
const bi = sortedKeys.indexOf(b);
|
|
2304
|
+
if (ai < bi) return -1;
|
|
2305
|
+
if (ai > bi) return 1;
|
|
2306
|
+
return 0;
|
|
2307
|
+
});
|
|
2308
|
+
internalValues.value = values;
|
|
2309
|
+
ctx.emit('input', values);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
function selectAll() {
|
|
2314
|
+
if (!isAllSelectedRef.value) {
|
|
2315
|
+
const values = sortedItemKeysRef.value.slice();
|
|
2316
|
+
internalValues.value = values;
|
|
2317
|
+
ctx.emit('input', values);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
function deselectAll() {
|
|
2322
|
+
if (internalValues.value.length) {
|
|
2323
|
+
const values = [];
|
|
2324
|
+
internalValues.value = values;
|
|
2325
|
+
ctx.emit('input', values);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
function deselect(key) {
|
|
2330
|
+
const values = internalValues.value.slice();
|
|
2331
|
+
const index = values.indexOf(key);
|
|
2332
|
+
|
|
2333
|
+
if (index !== -1) {
|
|
2334
|
+
values.splice(index, 1);
|
|
2335
|
+
internalValues.value = values;
|
|
2336
|
+
ctx.emit('input', values);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
function handleClickSortHeader(header, ev) {
|
|
2341
|
+
const {
|
|
2342
|
+
sortQuery
|
|
2343
|
+
} = header;
|
|
2344
|
+
if (!sortQuery) return;
|
|
2345
|
+
|
|
2346
|
+
if (sortByRef.value === sortQuery) {
|
|
2347
|
+
return toggleOrderBy();
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
return setSort({
|
|
2351
|
+
sort: sortQuery,
|
|
2352
|
+
order: defaultOrderQueryRef.value
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
function genPagination() {
|
|
2357
|
+
return createVNode(VPagination, {
|
|
2358
|
+
"class": "v-data-table__pagination",
|
|
2359
|
+
"dense": true,
|
|
2360
|
+
"align": "right",
|
|
2361
|
+
"routeQuery": props.pageQuery,
|
|
2362
|
+
"modelValue": pageRef.value,
|
|
2363
|
+
"length": pageLengthRef.value
|
|
2364
|
+
}, null);
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
function genControls() {
|
|
2368
|
+
const {
|
|
2369
|
+
total
|
|
2370
|
+
} = props;
|
|
2371
|
+
const offset = offsetRef.value;
|
|
2372
|
+
const length = lengthRef.value;
|
|
2373
|
+
return createVNode("div", {
|
|
2374
|
+
"class": "v-data-table__controls"
|
|
2375
|
+
}, [createVNode("div", {
|
|
2376
|
+
"class": "v-data-table__controls__info"
|
|
2377
|
+
}, [createVNode("small", {
|
|
2378
|
+
"class": "v-data-table__controls__info__length"
|
|
2379
|
+
}, [createTextVNode("\u5168 "), total, createTextVNode(" \u4EF6\u4E2D "), offset + 1, createTextVNode(" \u4EF6 \u301C "), offset + length, createTextVNode(" \u4EF6\u3092\u8868\u793A")])]), createVNode("div", {
|
|
2380
|
+
"class": "v-data-table__controls__select-limit"
|
|
2381
|
+
}, [createVNode("span", {
|
|
2382
|
+
"class": "v-data-table__controls__select-limit__prefix"
|
|
2383
|
+
}, [createTextVNode("1\u30DA\u30FC\u30B8\u306B")]), createVNode(VSelect, {
|
|
2384
|
+
"class": "v-data-table__controls__select-limit__node",
|
|
2385
|
+
"size": "sm",
|
|
2386
|
+
"hiddenInfo": true,
|
|
2387
|
+
"disabled": isTransitioningRef.value,
|
|
2388
|
+
"items": props.limits.map(limit => {
|
|
2389
|
+
return {
|
|
2390
|
+
label: `${limit}件`,
|
|
2391
|
+
value: limit
|
|
2392
|
+
};
|
|
2393
|
+
}),
|
|
2394
|
+
"modelValue": limitRef.value,
|
|
2395
|
+
"onUpdate:modelValue": $event => limitRef.value = $event
|
|
2396
|
+
}, null)]), createVNode("div", {
|
|
2397
|
+
"class": "v-data-table__controls__pagination"
|
|
2398
|
+
}, [genPagination()])]);
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
function genTableHeader() {
|
|
2402
|
+
const sortBy = sortByRef.value;
|
|
2403
|
+
const isIndeterminate = isIndeterminateRef.value;
|
|
2404
|
+
const isAllSelected = isAllSelectedRef.value;
|
|
2405
|
+
const {
|
|
2406
|
+
defaultOrder,
|
|
2407
|
+
ascQueryValue
|
|
2408
|
+
} = props;
|
|
2409
|
+
const usePaiging = usePaigingRef.value;
|
|
2410
|
+
const children = headersRef.value.map(header => {
|
|
2411
|
+
const {
|
|
2412
|
+
label,
|
|
2413
|
+
sortQuery,
|
|
2414
|
+
align,
|
|
2415
|
+
key
|
|
2416
|
+
} = header;
|
|
2417
|
+
const headerChildren = [];
|
|
2418
|
+
|
|
2419
|
+
if (label != null && typeof label !== 'boolean') {
|
|
2420
|
+
let _children = typeof label === 'function' ? label(vui) : label;
|
|
2421
|
+
|
|
2422
|
+
if (_children && !Array.isArray(_children) && typeof _children === 'object') {
|
|
2423
|
+
_children = JSON.stringify(_children);
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
headerChildren.push(_children);
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
if (key === SELECTABLE_HEADER_SYMBOL) {
|
|
2430
|
+
headerChildren.push(createVNode(VCheckbox, {
|
|
2431
|
+
"modelValue": isAllSelected,
|
|
2432
|
+
"indeterminate": isIndeterminate,
|
|
2433
|
+
"onChange": ev => {
|
|
2434
|
+
if (isAllSelectedRef.value) {
|
|
2435
|
+
deselectAll();
|
|
2436
|
+
} else {
|
|
2437
|
+
selectAll();
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}, null));
|
|
2441
|
+
} // if (key === DELETOR_HEADER_SYMBOL) {
|
|
2442
|
+
// headerChildren.push('削除');
|
|
2443
|
+
// }
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
const sortActive = sortBy === sortQuery;
|
|
2447
|
+
|
|
2448
|
+
if (sortQuery && usePaiging) {
|
|
2449
|
+
const isASC = sortActive ? isASCRef.value : defaultOrder === ascQueryValue;
|
|
2450
|
+
headerChildren.unshift(createVNode(VIcon, {
|
|
2451
|
+
"class": "v-data-table__table__sort-icon v-data-table__table__sort-icon--empty",
|
|
2452
|
+
"name": "$empty"
|
|
2453
|
+
}, null));
|
|
2454
|
+
headerChildren.push(resolveRawIconProp(false, sortIconRef.value, {
|
|
2455
|
+
class: ['v-data-table__table__sort-icon v-data-table__table__sort-icon--arrow', {
|
|
2456
|
+
'v-data-table__table__sort-icon--asc': isASC,
|
|
2457
|
+
'v-data-table__table__sort-icon--desc': !isASC
|
|
2458
|
+
}]
|
|
2459
|
+
}));
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
const classes = ['v-data-table__table__cell', {
|
|
2463
|
+
'v-data-table__table__cell--active': sortActive
|
|
2464
|
+
}];
|
|
2465
|
+
|
|
2466
|
+
if (align) {
|
|
2467
|
+
classes.push(`v-data-table__table__cell--${align}`);
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
return createVNode("th", {
|
|
2471
|
+
"class": classes,
|
|
2472
|
+
"key": header.key,
|
|
2473
|
+
"tabindex": sortQuery && usePaiging ? 0 : undefined,
|
|
2474
|
+
"onClick": ev => {
|
|
2475
|
+
if (!sortQuery || !usePaiging) return;
|
|
2476
|
+
handleClickSortHeader(header);
|
|
2477
|
+
}
|
|
2478
|
+
}, [createVNode("div", {
|
|
2479
|
+
"class": "v-data-table__table__cell__tile"
|
|
2480
|
+
}, [headerChildren])]);
|
|
2481
|
+
});
|
|
2482
|
+
return createVNode("thead", {
|
|
2483
|
+
"class": "v-data-table__table__header"
|
|
2484
|
+
}, [createVNode("tr", null, [children])]);
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
function toggleSelect(key) {
|
|
2488
|
+
return isSelected(key) ? deselect(key) : select(key);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
function defaultItemSlot(payload) {
|
|
2492
|
+
const {
|
|
2493
|
+
key,
|
|
2494
|
+
item,
|
|
2495
|
+
selected
|
|
2496
|
+
} = payload;
|
|
2497
|
+
const headers = headersRef.value; // const { $scopedSlots, $createElement, deletor } = this;
|
|
2498
|
+
|
|
2499
|
+
const children = headers.map(header => {
|
|
2500
|
+
const {
|
|
2501
|
+
cell,
|
|
2502
|
+
align,
|
|
2503
|
+
key: headerKey
|
|
2504
|
+
} = header;
|
|
2505
|
+
const cellSlot = cell || ctx.slots.cell;
|
|
2506
|
+
let cellChildren;
|
|
2507
|
+
|
|
2508
|
+
if (cellSlot) {
|
|
2509
|
+
const cellPayload = {
|
|
2510
|
+
vui,
|
|
2511
|
+
item,
|
|
2512
|
+
selected
|
|
2513
|
+
};
|
|
2514
|
+
|
|
2515
|
+
let _children = cellSlot(cellPayload);
|
|
2516
|
+
|
|
2517
|
+
if (_children && !Array.isArray(_children) && typeof _children === 'object') {
|
|
2518
|
+
_children = JSON.stringify(_children);
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
cellChildren = _children;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
if (!cellChildren) {
|
|
2525
|
+
switch (headerKey) {
|
|
2526
|
+
case SELECTABLE_HEADER_SYMBOL:
|
|
2527
|
+
{
|
|
2528
|
+
cellChildren = [createVNode(VCheckbox, {
|
|
2529
|
+
"modelValue": selected,
|
|
2530
|
+
"onChange": ev => {
|
|
2531
|
+
toggleSelect(key);
|
|
2532
|
+
}
|
|
2533
|
+
}, null)];
|
|
2534
|
+
break;
|
|
2535
|
+
}
|
|
2536
|
+
// case DELETOR_HEADER_SYMBOL: {
|
|
2537
|
+
// if (deletor) {
|
|
2538
|
+
// const onClick = async (event: MouseEvent) => {
|
|
2539
|
+
// if (
|
|
2540
|
+
// await this.$confirm(`${key}を削除します。よろしいですか?`)
|
|
2541
|
+
// ) {
|
|
2542
|
+
// this.deletingTargets.push(key);
|
|
2543
|
+
// await deletor(item);
|
|
2544
|
+
// this.deletingTargets.splice(
|
|
2545
|
+
// this.deletingTargets.indexOf(key),
|
|
2546
|
+
// 1,
|
|
2547
|
+
// );
|
|
2548
|
+
// }
|
|
2549
|
+
// };
|
|
2550
|
+
// cellChildren = [
|
|
2551
|
+
// <VBtn
|
|
2552
|
+
// icon="trush"
|
|
2553
|
+
// onClick={onClick}
|
|
2554
|
+
// disabled={this.deletingTargets.includes(key)}
|
|
2555
|
+
// />,
|
|
2556
|
+
// ];
|
|
2557
|
+
// }
|
|
2558
|
+
// break;
|
|
2559
|
+
// }
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
const classes = align ? {
|
|
2564
|
+
[`v-data-table__table__cell--${align}`]: true
|
|
2565
|
+
} : undefined;
|
|
2566
|
+
return createVNode("td", {
|
|
2567
|
+
"class": ['v-data-table__table__cell', classes],
|
|
2568
|
+
"key": header.key
|
|
2569
|
+
}, [cellChildren]);
|
|
2570
|
+
});
|
|
2571
|
+
return createVNode("tr", {
|
|
2572
|
+
"class": ['v-data-table__table__item', {
|
|
2573
|
+
'v-data-table__table__item--selected': selected
|
|
2574
|
+
}],
|
|
2575
|
+
"key": key
|
|
2576
|
+
}, [children]);
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
function genBody() {
|
|
2580
|
+
const {
|
|
2581
|
+
items,
|
|
2582
|
+
itemKey
|
|
2583
|
+
} = props;
|
|
2584
|
+
const {
|
|
2585
|
+
item: itemSlot = defaultItemSlot
|
|
2586
|
+
} = ctx.slots;
|
|
2587
|
+
const children = items.map(item => {
|
|
2588
|
+
const key = item[itemKey];
|
|
2589
|
+
const payload = {
|
|
2590
|
+
key,
|
|
2591
|
+
item,
|
|
2592
|
+
selected: isSelected(key)
|
|
2593
|
+
};
|
|
2594
|
+
return itemSlot(payload);
|
|
2595
|
+
});
|
|
2596
|
+
return createVNode("tbody", {
|
|
2597
|
+
"class": "v-data-table__table__body"
|
|
2598
|
+
}, [children]);
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
watch(() => props.modelValue, modelValue => {
|
|
2602
|
+
internalValues.value = modelValue.slice();
|
|
2603
|
+
});
|
|
2604
|
+
watch(() => props.items, items => {
|
|
2605
|
+
internalValues.value = internalValues.value.filter(key => {
|
|
2606
|
+
return sortedItemKeysRef.value.includes(key);
|
|
2607
|
+
});
|
|
2608
|
+
});
|
|
2609
|
+
onMounted(() => {
|
|
2610
|
+
bootedRef.value = true;
|
|
2611
|
+
});
|
|
2612
|
+
return () => {
|
|
2613
|
+
const isEmpty = isEmptyRef.value;
|
|
2614
|
+
const usePaiging = usePaigingRef.value;
|
|
2615
|
+
return createVNode("div", {
|
|
2616
|
+
"class": ['v-data-table', classesRef.value]
|
|
2617
|
+
}, [!isEmpty && usePaiging && needShowHeaderControlRef.value && createVNode("div", {
|
|
2618
|
+
"class": "v-data-table__header"
|
|
2619
|
+
}, [genControls()]), createVNode("div", {
|
|
2620
|
+
"class": "v-data-table__body container-pull"
|
|
2621
|
+
}, [isEmpty ? createVNode("div", {
|
|
2622
|
+
"class": "v-data-table__empty--message"
|
|
2623
|
+
}, null) : createVNode(VPaper, {
|
|
2624
|
+
"class": "v-data-table__body__inner",
|
|
2625
|
+
"style": bodyInnerStylesRef.value
|
|
2626
|
+
}, {
|
|
2627
|
+
default: () => [createVNode("div", {
|
|
2628
|
+
"class": "v-data-table__table-wrapper"
|
|
2629
|
+
}, [createVNode("table", {
|
|
2630
|
+
"class": "v-data-table__table"
|
|
2631
|
+
}, [genTableHeader(), genBody()])])]
|
|
2632
|
+
}), createVNode(Transition, {
|
|
2633
|
+
"name": "fade"
|
|
2634
|
+
}, {
|
|
2635
|
+
default: () => [isTransitioningRef.value && createVNode("div", {
|
|
2636
|
+
"class": "v-data-table__loading"
|
|
2637
|
+
}, [createVNode(VProgressCircular, {
|
|
2638
|
+
"indeterminate": true
|
|
2639
|
+
}, null)])]
|
|
2640
|
+
})]), !isEmpty && usePaiging && withDirectives(createVNode("div", {
|
|
2641
|
+
"class": "v-data-table__footer"
|
|
2642
|
+
}, [genControls()]), [resizeDirectiveArgument(({
|
|
2643
|
+
height
|
|
2644
|
+
}) => {
|
|
2645
|
+
footerHeightRef.value = height;
|
|
2646
|
+
})])]);
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
});
|
|
2651
|
+
|
|
2652
|
+
function _isSlot$2(s) {
|
|
1668
2653
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1669
2654
|
}
|
|
1670
2655
|
|
|
@@ -1676,7 +2661,7 @@ const VApp = defineComponent({
|
|
|
1676
2661
|
return () => {
|
|
1677
2662
|
let _slot;
|
|
1678
2663
|
|
|
1679
|
-
return createVNode(VStackRoot, null, _isSlot$
|
|
2664
|
+
return createVNode(VStackRoot, null, _isSlot$2(_slot = renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
|
|
1680
2665
|
default: () => [_slot]
|
|
1681
2666
|
});
|
|
1682
2667
|
};
|
|
@@ -1716,8 +2701,35 @@ const VToolbar = defineComponent({
|
|
|
1716
2701
|
|
|
1717
2702
|
});
|
|
1718
2703
|
|
|
2704
|
+
function _isSlot$1(s) {
|
|
2705
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2706
|
+
}
|
|
2707
|
+
|
|
1719
2708
|
const VToolbarMenu = defineComponent({
|
|
1720
2709
|
name: 'VToolbarMenu',
|
|
2710
|
+
inheritAttrs: false,
|
|
2711
|
+
props: {},
|
|
2712
|
+
|
|
2713
|
+
setup(props, ctx) {
|
|
2714
|
+
const vui = useVui();
|
|
2715
|
+
const plain = vui.setting('plainVariant');
|
|
2716
|
+
return () => {
|
|
2717
|
+
let _slot;
|
|
2718
|
+
|
|
2719
|
+
const variant = props.variant || plain;
|
|
2720
|
+
return createVNode(VButton, mergeProps(ctx.attrs, {
|
|
2721
|
+
"variant": variant,
|
|
2722
|
+
"class": ['v-toolbar-menu']
|
|
2723
|
+
}), _isSlot$1(_slot = renderSlotOrEmpty$1(ctx.slots)) ? _slot : {
|
|
2724
|
+
default: () => [_slot]
|
|
2725
|
+
});
|
|
2726
|
+
};
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
});
|
|
2730
|
+
|
|
2731
|
+
const VToolbarEdge = defineComponent({
|
|
2732
|
+
name: 'VToolbarEdge',
|
|
1721
2733
|
props: {
|
|
1722
2734
|
edge: {
|
|
1723
2735
|
type: String,
|
|
@@ -1731,8 +2743,8 @@ const VToolbarMenu = defineComponent({
|
|
|
1731
2743
|
const children = renderSlotOrEmpty$1(ctx.slots, 'default');
|
|
1732
2744
|
const hasChildren = !!children && children.length > 0;
|
|
1733
2745
|
return createVNode("div", {
|
|
1734
|
-
"class": ['v-toolbar-
|
|
1735
|
-
[`v-toolbar-
|
|
2746
|
+
"class": ['v-toolbar-edge', `v-toolbar-edge--${edge.value}`, {
|
|
2747
|
+
[`v-toolbar-edge--empty`]: !hasChildren
|
|
1736
2748
|
}]
|
|
1737
2749
|
}, [children]);
|
|
1738
2750
|
};
|
|
@@ -1778,6 +2790,8 @@ class VuiService {
|
|
|
1778
2790
|
autoScrollToElementOffsetTop;
|
|
1779
2791
|
textareaRows;
|
|
1780
2792
|
requiredChip;
|
|
2793
|
+
router;
|
|
2794
|
+
location;
|
|
1781
2795
|
constructor(options) {
|
|
1782
2796
|
this.options = options;
|
|
1783
2797
|
const { selectionSeparator = () => ', ', autoScrollToElementOffsetTop = DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP, textareaRows = DEFAULT_TEXTAREA_ROWS, requiredChip = () => '*', } = options;
|
|
@@ -1785,6 +2799,10 @@ class VuiService {
|
|
|
1785
2799
|
this.autoScrollToElementOffsetTop = autoScrollToElementOffsetTop;
|
|
1786
2800
|
this.textareaRows = textareaRows;
|
|
1787
2801
|
this.requiredChip = requiredChip;
|
|
2802
|
+
this.router = options.router;
|
|
2803
|
+
this.location = new LocationService({
|
|
2804
|
+
router: this.router,
|
|
2805
|
+
});
|
|
1788
2806
|
}
|
|
1789
2807
|
setting(key) {
|
|
1790
2808
|
return this.options.uiSettings[key];
|
|
@@ -1862,4 +2880,4 @@ function installVuiPlugin(app, opts) {
|
|
|
1862
2880
|
return app.use(VuiPlugin, opts);
|
|
1863
2881
|
}
|
|
1864
2882
|
|
|
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 };
|
|
2883
|
+
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VDataTable, VDrawerLayout, VForm, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|