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