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