@dolusoft/query-table 3.7.1 → 3.9.0
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/query-table.js +637 -132
- package/dist/query-table.js.map +1 -1
- package/dist/types/body/group-runs.d.ts +32 -0
- package/dist/types/contract.d.ts +46 -0
- package/dist/types/flash/use-change-flash.d.ts +2 -2
- package/dist/types/parts/table-body.vue.d.ts +6 -3
- package/dist/types/parts/table-footer.vue.d.ts +2 -0
- package/dist/types/parts/table-header.vue.d.ts +2 -0
- package/dist/types/pin/use-header-geometry.d.ts +5 -1
- package/dist/types/resize/measure-widths.d.ts +4 -1
- package/dist/types/resize/use-auto-width.d.ts +2 -0
- package/dist/types/resize/use-column-resize.d.ts +2 -0
- package/dist/types/scroll/use-scroll-body.d.ts +22 -0
- package/dist/types/virtual/use-load-more.d.ts +2 -2
- package/dist/types/virtual/use-row-window.d.ts +18 -5
- package/package.json +3 -3
package/dist/query-table.js
CHANGED
|
@@ -724,8 +724,16 @@ var useCellView = (options) => {
|
|
|
724
724
|
};
|
|
725
725
|
//#endregion
|
|
726
726
|
//#region src/parts/table-body.vue?vue&type=script&setup=true&lang.ts
|
|
727
|
-
var _hoisted_1$9 = ["
|
|
728
|
-
var _hoisted_2$5 = [
|
|
727
|
+
var _hoisted_1$9 = ["role"];
|
|
728
|
+
var _hoisted_2$5 = ["role"];
|
|
729
|
+
var _hoisted_3$5 = ["role", "aria-rowindex"];
|
|
730
|
+
var _hoisted_4$5 = [
|
|
731
|
+
"colspan",
|
|
732
|
+
"role",
|
|
733
|
+
"aria-colspan"
|
|
734
|
+
];
|
|
735
|
+
var _hoisted_5$2 = [
|
|
736
|
+
"role",
|
|
729
737
|
"data-row-index",
|
|
730
738
|
"aria-rowindex",
|
|
731
739
|
"data-pinned-row",
|
|
@@ -736,13 +744,13 @@ var _hoisted_2$5 = [
|
|
|
736
744
|
"onVnodeBeforeMount",
|
|
737
745
|
"onVnodeUpdated"
|
|
738
746
|
];
|
|
739
|
-
var
|
|
740
|
-
var
|
|
747
|
+
var _hoisted_6$2 = ["aria-label", "onClick"];
|
|
748
|
+
var _hoisted_7$2 = [
|
|
741
749
|
"aria-expanded",
|
|
742
750
|
"aria-label",
|
|
743
751
|
"onClick"
|
|
744
752
|
];
|
|
745
|
-
var
|
|
753
|
+
var _hoisted_8$2 = {
|
|
746
754
|
width: "14",
|
|
747
755
|
height: "14",
|
|
748
756
|
viewBox: "0 0 24 24",
|
|
@@ -753,38 +761,29 @@ var _hoisted_5$1 = {
|
|
|
753
761
|
"stroke-linejoin": "round",
|
|
754
762
|
"aria-hidden": "true"
|
|
755
763
|
};
|
|
756
|
-
var
|
|
764
|
+
var _hoisted_9$1 = {
|
|
757
765
|
key: 0,
|
|
758
766
|
points: "6 9 12 15 18 9"
|
|
759
767
|
};
|
|
760
|
-
var
|
|
768
|
+
var _hoisted_10 = {
|
|
761
769
|
key: 1,
|
|
762
770
|
points: "9 6 15 12 9 18"
|
|
763
771
|
};
|
|
764
|
-
var
|
|
772
|
+
var _hoisted_11 = [
|
|
765
773
|
"aria-label",
|
|
766
774
|
"checked",
|
|
767
775
|
"onChange"
|
|
768
776
|
];
|
|
769
|
-
var
|
|
770
|
-
var
|
|
771
|
-
var
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
var
|
|
778
|
-
var
|
|
779
|
-
key: 1,
|
|
780
|
-
class: "qt-empty-row"
|
|
781
|
-
};
|
|
782
|
-
var _hoisted_16 = ["colspan"];
|
|
783
|
-
var _hoisted_17 = {
|
|
784
|
-
key: 2,
|
|
785
|
-
class: "qt-load-more-row"
|
|
786
|
-
};
|
|
787
|
-
var _hoisted_18 = ["colspan"];
|
|
777
|
+
var _hoisted_12 = ["role", "data-flash"];
|
|
778
|
+
var _hoisted_13 = ["role", "data-flash"];
|
|
779
|
+
var _hoisted_14 = [
|
|
780
|
+
"role",
|
|
781
|
+
"aria-rowindex",
|
|
782
|
+
"data-pinned-row"
|
|
783
|
+
];
|
|
784
|
+
var _hoisted_15 = ["role"];
|
|
785
|
+
var _hoisted_16 = ["role"];
|
|
786
|
+
var _hoisted_17 = ["role"];
|
|
788
787
|
//#endregion
|
|
789
788
|
//#region src/parts/table-body.vue
|
|
790
789
|
var table_body_default = /* @__PURE__ */ defineComponent({
|
|
@@ -811,7 +810,8 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
811
810
|
labels: {},
|
|
812
811
|
hasContextMenuListener: { type: Function },
|
|
813
812
|
loadMore: {},
|
|
814
|
-
flash: {}
|
|
813
|
+
flash: {},
|
|
814
|
+
roles: { type: Boolean }
|
|
815
815
|
},
|
|
816
816
|
emits: ["rowRightPanelClick", "cellContextMenu"],
|
|
817
817
|
setup(__props, { emit: __emit }) {
|
|
@@ -827,11 +827,28 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
827
827
|
onContextMenu: (payload) => emit("cellContextMenu", payload),
|
|
828
828
|
pinRow: (row, index, position) => props.pinRow(row, index, position)
|
|
829
829
|
});
|
|
830
|
-
|
|
830
|
+
/** `role` of a row and of a cell with `scrollBody` (C-102). */
|
|
831
|
+
const rowRole = () => props.roles ? "row" : void 0;
|
|
832
|
+
const cellRole = () => props.roles ? "cell" : void 0;
|
|
833
|
+
/** A cell over every column; with `scrollBody` also its `aria-colspan`. */
|
|
834
|
+
const spanAttrs = () => ({
|
|
835
|
+
colspan: props.columnCount,
|
|
836
|
+
role: cellRole(),
|
|
837
|
+
"aria-colspan": props.roles ? props.columnCount : void 0
|
|
838
|
+
});
|
|
839
|
+
const utilityAttrs = (utility) => ({
|
|
840
|
+
role: cellRole(),
|
|
841
|
+
...pinAttrs(props.hasPinned ? "left" : false, props.offsets[utilityKey(utility)])
|
|
842
|
+
});
|
|
831
843
|
const rightPanelAttrs = () => utilityAttrs("right-panel");
|
|
832
844
|
const expandAttrs = () => utilityAttrs("subtable");
|
|
833
845
|
const selectAttrs = () => utilityAttrs("select");
|
|
834
846
|
const isSpacer = (item) => "spacer" in item;
|
|
847
|
+
const isGroup = (item) => "group" in item;
|
|
848
|
+
/** A data row: neither a spacer nor a group row. */
|
|
849
|
+
const isRow = (item) => !isSpacer(item) && !isGroup(item);
|
|
850
|
+
/** The identity of a body item in the `v-for`. */
|
|
851
|
+
const itemKey = (item) => isRow(item) ? props.keyOf(item.row, item.index) : item.key;
|
|
835
852
|
/** `data-row-kind` of a drawn row (C-97): no attribute for an empty kind. */
|
|
836
853
|
const kindOf = (item) => props.rowKind ? props.rowKind(item.row, item.index) || void 0 : void 0;
|
|
837
854
|
/** `aria-rowindex` of the subtable row under a drawn row (C-86). */
|
|
@@ -841,26 +858,46 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
841
858
|
expandedSnapshot = null;
|
|
842
859
|
});
|
|
843
860
|
const isRowExpanded = (item) => {
|
|
844
|
-
if (
|
|
861
|
+
if (!isRow(item)) return false;
|
|
845
862
|
if (!expandedSnapshot) {
|
|
846
863
|
const open = /* @__PURE__ */ new Map();
|
|
847
864
|
if (props.hasSubtable) {
|
|
848
|
-
for (const row of props.bodyRows) if (
|
|
865
|
+
for (const row of props.bodyRows) if (isRow(row)) open.set(String(props.keyOf(row.row, row.index)), props.isExpanded(row.row, row.index));
|
|
849
866
|
}
|
|
850
867
|
expandedSnapshot = open;
|
|
851
868
|
}
|
|
852
869
|
return expandedSnapshot.get(String(props.keyOf(item.row, item.index))) === true;
|
|
853
870
|
};
|
|
854
871
|
return (_ctx, _cache) => {
|
|
855
|
-
return openBlock(), createElementBlock("tbody", {
|
|
872
|
+
return openBlock(), createElementBlock("tbody", {
|
|
873
|
+
role: __props.roles ? "rowgroup" : void 0,
|
|
874
|
+
onContextmenu: _cache[0] || (_cache[0] = (...args) => unref(onContextMenu) && unref(onContextMenu)(...args))
|
|
875
|
+
}, [
|
|
856
876
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.bodyRows, (item) => {
|
|
857
|
-
return openBlock(), createElementBlock(Fragment, { key:
|
|
877
|
+
return openBlock(), createElementBlock(Fragment, { key: itemKey(item) }, [isSpacer(item) ? (openBlock(), createElementBlock("tr", {
|
|
858
878
|
key: 0,
|
|
859
879
|
class: "qt-virtual-spacer",
|
|
860
880
|
"aria-hidden": "true",
|
|
881
|
+
role: rowRole(),
|
|
861
882
|
style: normalizeStyle({ height: `${item.spacer}px` })
|
|
862
|
-
}, [createElementVNode("td", {
|
|
883
|
+
}, [createElementVNode("td", mergeProps({ ref_for: true }, spanAttrs()), null, 16)], 12, _hoisted_2$5)) : isGroup(item) ? (openBlock(), createElementBlock("tr", {
|
|
863
884
|
key: 1,
|
|
885
|
+
class: "qt-group-row",
|
|
886
|
+
role: rowRole(),
|
|
887
|
+
"aria-rowindex": item.aria
|
|
888
|
+
}, [createElementVNode("th", {
|
|
889
|
+
scope: "row",
|
|
890
|
+
colspan: __props.columnCount,
|
|
891
|
+
role: __props.roles ? "rowheader" : void 0,
|
|
892
|
+
"aria-colspan": __props.roles ? __props.columnCount : void 0
|
|
893
|
+
}, [renderSlot(_ctx.$slots, "group", {
|
|
894
|
+
groupKey: item.group.key,
|
|
895
|
+
count: item.group.count,
|
|
896
|
+
row: item.group.row,
|
|
897
|
+
rowIndex: item.group.index
|
|
898
|
+
}, () => [createTextVNode(toDisplayString(item.group.key), 1)])], 8, _hoisted_4$5)], 8, _hoisted_3$5)) : (openBlock(), createElementBlock("tr", {
|
|
899
|
+
key: 2,
|
|
900
|
+
role: rowRole(),
|
|
864
901
|
"data-row-index": item.index,
|
|
865
902
|
"aria-rowindex": item.aria,
|
|
866
903
|
"data-pinned-row": item.pinned || void 0,
|
|
@@ -898,7 +935,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
898
935
|
y1: "12",
|
|
899
936
|
x2: "19",
|
|
900
937
|
y2: "12"
|
|
901
|
-
})], -1)])], 8,
|
|
938
|
+
})], -1)])], 8, _hoisted_6$2)], 16)) : createCommentVNode("", true),
|
|
902
939
|
__props.hasSubtable ? (openBlock(), createElementBlock("td", mergeProps({
|
|
903
940
|
key: 1,
|
|
904
941
|
ref_for: true
|
|
@@ -909,7 +946,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
909
946
|
"aria-expanded": isRowExpanded(item),
|
|
910
947
|
"aria-label": __props.labels.expandRow,
|
|
911
948
|
onClick: ($event) => __props.toggle(item.row, item.index)
|
|
912
|
-
}, [(openBlock(), createElementBlock("svg",
|
|
949
|
+
}, [(openBlock(), createElementBlock("svg", _hoisted_8$2, [isRowExpanded(item) ? (openBlock(), createElementBlock("polyline", _hoisted_9$1)) : (openBlock(), createElementBlock("polyline", _hoisted_10))]))], 8, _hoisted_7$2)) : createCommentVNode("", true)], 16)) : createCommentVNode("", true),
|
|
913
950
|
__props.hasSelection ? (openBlock(), createElementBlock("td", mergeProps({
|
|
914
951
|
key: 2,
|
|
915
952
|
ref_for: true
|
|
@@ -919,38 +956,59 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
919
956
|
"aria-label": __props.labels.selectRow,
|
|
920
957
|
checked: __props.isSelected(item.row, item.index),
|
|
921
958
|
onChange: ($event) => __props.toggleSelected(item.row, item.index)
|
|
922
|
-
}, null, 40,
|
|
959
|
+
}, null, 40, _hoisted_11)], 16)) : createCommentVNode("", true),
|
|
923
960
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.entries, (entry) => {
|
|
924
961
|
return openBlock(), createElementBlock(Fragment, { key: entry.column.field }, [unref(hasCellSlot)(entry.column) ? (openBlock(), createElementBlock("td", mergeProps({
|
|
925
962
|
key: 0,
|
|
926
|
-
|
|
927
|
-
}, unref(cellAttrs)(entry), { "data-flash": __props.flash ? __props.flash.cell(item.row, item.index, entry.column.field) : void 0 }), [renderSlot(_ctx.$slots, `cell-${entry.column.field}`, mergeProps({ ref_for: true }, unref(slotProps)(item.row, entry.column, item.index, item.pinned)))], 16,
|
|
963
|
+
role: cellRole()
|
|
964
|
+
}, { ref_for: true }, unref(cellAttrs)(entry), { "data-flash": __props.flash ? __props.flash.cell(item.row, item.index, entry.column.field) : void 0 }), [renderSlot(_ctx.$slots, `cell-${entry.column.field}`, mergeProps({ ref_for: true }, unref(slotProps)(item.row, entry.column, item.index, item.pinned)))], 16, _hoisted_12)) : (openBlock(), createElementBlock("td", mergeProps({
|
|
928
965
|
key: 1,
|
|
929
|
-
|
|
930
|
-
}, unref(cellAttrs)(entry), { "data-flash": __props.flash ? __props.flash.cell(item.row, item.index, entry.column.field) : void 0 }), toDisplayString(unref(cellText)(item.row, entry.column)), 17,
|
|
966
|
+
role: cellRole()
|
|
967
|
+
}, { ref_for: true }, unref(cellAttrs)(entry), { "data-flash": __props.flash ? __props.flash.cell(item.row, item.index, entry.column.field) : void 0 }), toDisplayString(unref(cellText)(item.row, entry.column)), 17, _hoisted_13))], 64);
|
|
931
968
|
}), 128))
|
|
932
|
-
], 8,
|
|
933
|
-
key:
|
|
969
|
+
], 8, _hoisted_5$2)), isRow(item) && isRowExpanded(item) ? (openBlock(), createElementBlock("tr", {
|
|
970
|
+
key: 3,
|
|
934
971
|
class: "qt-subtable-row",
|
|
972
|
+
role: rowRole(),
|
|
935
973
|
"aria-rowindex": nextIndex(item.aria),
|
|
936
974
|
"data-pinned-row": item.pinned || void 0
|
|
937
|
-
}, [createElementVNode("td", {
|
|
975
|
+
}, [createElementVNode("td", mergeProps({ ref_for: true }, spanAttrs()), [renderSlot(_ctx.$slots, "subtable", {
|
|
938
976
|
row: item.row,
|
|
939
977
|
rowIndex: item.index
|
|
940
|
-
})],
|
|
978
|
+
})], 16)], 8, _hoisted_14)) : createCommentVNode("", true)], 64);
|
|
941
979
|
}), 128)),
|
|
942
|
-
__props.loading && slots.loading ? (openBlock(), createElementBlock("tr",
|
|
943
|
-
|
|
944
|
-
|
|
980
|
+
__props.loading && slots.loading ? (openBlock(), createElementBlock("tr", {
|
|
981
|
+
key: 0,
|
|
982
|
+
class: "qt-loading-row",
|
|
983
|
+
role: rowRole()
|
|
984
|
+
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "loading")], 16)], 8, _hoisted_15)) : !__props.loading && __props.rows.length === 0 && slots.empty ? (openBlock(), createElementBlock("tr", {
|
|
985
|
+
key: 1,
|
|
986
|
+
class: "qt-empty-row",
|
|
987
|
+
role: rowRole()
|
|
988
|
+
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "empty")], 16)], 8, _hoisted_16)) : createCommentVNode("", true),
|
|
989
|
+
!__props.loading && __props.rows.length > 0 && __props.loadMore && slots["load-more"] ? (openBlock(), createElementBlock("tr", {
|
|
990
|
+
key: 2,
|
|
991
|
+
class: "qt-load-more-row",
|
|
992
|
+
role: rowRole()
|
|
993
|
+
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "load-more", normalizeProps(guardReactiveProps(__props.loadMore)))], 16)], 8, _hoisted_17)) : createCommentVNode("", true)
|
|
994
|
+
], 40, _hoisted_1$9);
|
|
945
995
|
};
|
|
946
996
|
}
|
|
947
997
|
});
|
|
948
998
|
//#endregion
|
|
949
999
|
//#region src/parts/table-footer.vue?vue&type=script&setup=true&lang.ts
|
|
950
|
-
var _hoisted_1$8 =
|
|
951
|
-
var _hoisted_2$4 = ["aria-rowindex"];
|
|
952
|
-
var _hoisted_3$4 = [
|
|
953
|
-
|
|
1000
|
+
var _hoisted_1$8 = ["role"];
|
|
1001
|
+
var _hoisted_2$4 = ["role", "aria-rowindex"];
|
|
1002
|
+
var _hoisted_3$4 = [
|
|
1003
|
+
"colspan",
|
|
1004
|
+
"role",
|
|
1005
|
+
"aria-colspan"
|
|
1006
|
+
];
|
|
1007
|
+
var _hoisted_4$4 = [
|
|
1008
|
+
"data-field",
|
|
1009
|
+
"data-type",
|
|
1010
|
+
"role"
|
|
1011
|
+
];
|
|
954
1012
|
//#endregion
|
|
955
1013
|
//#region src/parts/table-footer.vue
|
|
956
1014
|
var table_footer_default = /* @__PURE__ */ defineComponent({
|
|
@@ -961,26 +1019,34 @@ var table_footer_default = /* @__PURE__ */ defineComponent({
|
|
|
961
1019
|
utilityCount: {},
|
|
962
1020
|
hasPinned: { type: Boolean },
|
|
963
1021
|
offsets: {},
|
|
964
|
-
firstRowIndex: {}
|
|
1022
|
+
firstRowIndex: {},
|
|
1023
|
+
roles: { type: Boolean }
|
|
965
1024
|
},
|
|
966
1025
|
setup(__props) {
|
|
967
1026
|
const footerText = (row, column) => row.cells.find((cell) => cell.field === column.field)?.text;
|
|
968
1027
|
return (_ctx, _cache) => {
|
|
969
|
-
return openBlock(), createElementBlock("tfoot",
|
|
1028
|
+
return openBlock(), createElementBlock("tfoot", {
|
|
1029
|
+
class: "qt-footer",
|
|
1030
|
+
role: __props.roles ? "rowgroup" : void 0
|
|
1031
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.footerRows, (footerRow, i) => {
|
|
970
1032
|
return openBlock(), createElementBlock("tr", {
|
|
971
1033
|
key: i,
|
|
1034
|
+
role: __props.roles ? "row" : void 0,
|
|
972
1035
|
"aria-rowindex": __props.firstRowIndex === void 0 ? void 0 : __props.firstRowIndex + i
|
|
973
1036
|
}, [__props.utilityCount > 0 ? (openBlock(), createElementBlock("td", mergeProps({
|
|
974
1037
|
key: 0,
|
|
975
|
-
colspan: __props.utilityCount
|
|
1038
|
+
colspan: __props.utilityCount,
|
|
1039
|
+
role: __props.roles ? "cell" : void 0,
|
|
1040
|
+
"aria-colspan": __props.roles ? __props.utilityCount : void 0
|
|
976
1041
|
}, { ref_for: true }, unref(pinAttrs)(__props.hasPinned ? "left" : false, 0)), null, 16, _hoisted_3$4)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.entries, (entry) => {
|
|
977
1042
|
return openBlock(), createElementBlock("td", mergeProps({
|
|
978
1043
|
key: entry.column.field,
|
|
979
1044
|
"data-field": entry.column.field,
|
|
980
|
-
"data-type": unref(columnTypeOf$1)(entry.column)
|
|
981
|
-
|
|
1045
|
+
"data-type": unref(columnTypeOf$1)(entry.column),
|
|
1046
|
+
role: __props.roles ? "cell" : void 0
|
|
1047
|
+
}, { ref_for: true }, unref(pinAttrs)(unref(sideOf)(entry.column), __props.offsets[entry.column.field])), toDisplayString(footerText(footerRow, entry.column)), 17, _hoisted_4$4);
|
|
982
1048
|
}), 128))], 8, _hoisted_2$4);
|
|
983
|
-
}), 128))]);
|
|
1049
|
+
}), 128))], 8, _hoisted_1$8);
|
|
984
1050
|
};
|
|
985
1051
|
}
|
|
986
1052
|
});
|
|
@@ -1041,15 +1107,15 @@ var _hoisted_3$3 = [
|
|
|
1041
1107
|
"value",
|
|
1042
1108
|
"readonly"
|
|
1043
1109
|
];
|
|
1044
|
-
var _hoisted_4$
|
|
1110
|
+
var _hoisted_4$3 = [
|
|
1045
1111
|
"aria-label",
|
|
1046
1112
|
"value",
|
|
1047
1113
|
"disabled"
|
|
1048
1114
|
];
|
|
1049
|
-
var _hoisted_5 = { value: "" };
|
|
1050
|
-
var _hoisted_6 = { value: "true" };
|
|
1051
|
-
var _hoisted_7 = { value: "false" };
|
|
1052
|
-
var _hoisted_8 = [
|
|
1115
|
+
var _hoisted_5$1 = { value: "" };
|
|
1116
|
+
var _hoisted_6$1 = { value: "true" };
|
|
1117
|
+
var _hoisted_7$1 = { value: "false" };
|
|
1118
|
+
var _hoisted_8$1 = [
|
|
1053
1119
|
"type",
|
|
1054
1120
|
"aria-label",
|
|
1055
1121
|
"value",
|
|
@@ -1145,10 +1211,10 @@ var filter_cell_default = /* @__PURE__ */ defineComponent({
|
|
|
1145
1211
|
disabled: unref(filters).multiOf(__props.column.field) > 0,
|
|
1146
1212
|
onChange: _cache[4] || (_cache[4] = ($event) => pick($event))
|
|
1147
1213
|
}, [
|
|
1148
|
-
createElementVNode("option", _hoisted_5, toDisplayString(unref(labels)().boolAll), 1),
|
|
1149
|
-
createElementVNode("option", _hoisted_6, toDisplayString(unref(labels)().boolTrue), 1),
|
|
1150
|
-
createElementVNode("option", _hoisted_7, toDisplayString(unref(labels)().boolFalse), 1)
|
|
1151
|
-
], 40, _hoisted_4$
|
|
1214
|
+
createElementVNode("option", _hoisted_5$1, toDisplayString(unref(labels)().boolAll), 1),
|
|
1215
|
+
createElementVNode("option", _hoisted_6$1, toDisplayString(unref(labels)().boolTrue), 1),
|
|
1216
|
+
createElementVNode("option", _hoisted_7$1, toDisplayString(unref(labels)().boolFalse), 1)
|
|
1217
|
+
], 40, _hoisted_4$3)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [_ctx.$slots["filter-datetime"] ? renderSlot(_ctx.$slots, "filter-datetime", normalizeProps(guardReactiveProps(datetimeProps())), void 0, void 0, 0) : (openBlock(), createElementBlock("input", {
|
|
1152
1218
|
key: 1,
|
|
1153
1219
|
type: unref(filters).multiOf(__props.column.field) ? "text" : "date",
|
|
1154
1220
|
class: "qt-filter-input",
|
|
@@ -1157,7 +1223,7 @@ var filter_cell_default = /* @__PURE__ */ defineComponent({
|
|
|
1157
1223
|
readonly: unref(filters).multiOf(__props.column.field) > 0,
|
|
1158
1224
|
onInput: _cache[5] || (_cache[5] = ($event) => unref(filters).setInput(__props.column.field, inputValue($event))),
|
|
1159
1225
|
onKeydown: _cache[6] || (_cache[6] = withKeys(($event) => unref(filters).apply(__props.column.field), ["enter"]))
|
|
1160
|
-
}, null, 40, _hoisted_8))], 64)),
|
|
1226
|
+
}, null, 40, _hoisted_8$1))], 64)),
|
|
1161
1227
|
__props.type !== "bool" ? renderSlot(_ctx.$slots, "filter-menu", normalizeProps(guardReactiveProps(menuProps())), void 0, void 0, 4) : createCommentVNode("", true),
|
|
1162
1228
|
labelOf() ? (openBlock(), createElementBlock("small", _hoisted_9, toDisplayString(labelOf()), 1)) : createCommentVNode("", true)
|
|
1163
1229
|
]);
|
|
@@ -1232,8 +1298,11 @@ var styleSwap = () => {
|
|
|
1232
1298
|
* between, and slot content that draws a block or a flex box counts with the
|
|
1233
1299
|
* width its content needs, not the width its cell gives it. Only `fields`
|
|
1234
1300
|
* when given; a column with no box (the table not displayed) is left out.
|
|
1301
|
+
* With `scrollBody` the data rows are in a table of their own, `body`
|
|
1302
|
+
* (C-101): it is laid out the same way, its `col` widths left out, and a
|
|
1303
|
+
* column takes the wider of its header cell and its body cells.
|
|
1235
1304
|
*/
|
|
1236
|
-
var measureColumnWidths = (table, fields) => {
|
|
1305
|
+
var measureColumnWidths = (table, fields, body) => {
|
|
1237
1306
|
const widths = {};
|
|
1238
1307
|
if (!table?.tHead) return widths;
|
|
1239
1308
|
const wanted = fields ? new Set(fields) : null;
|
|
@@ -1245,10 +1314,20 @@ var measureColumnWidths = (table, fields) => {
|
|
|
1245
1314
|
swap.set(table, "min-width", "0");
|
|
1246
1315
|
for (const th of headers) swap.set(th, "width", "auto");
|
|
1247
1316
|
for (const part of Array.from(table.querySelectorAll(notCounted))) swap.set(part, "display", "none");
|
|
1317
|
+
const split = body && body !== table ? body : null;
|
|
1318
|
+
if (split) {
|
|
1319
|
+
swap.set(split, "table-layout", "auto");
|
|
1320
|
+
swap.set(split, "width", "max-content");
|
|
1321
|
+
swap.set(split, "min-width", "0");
|
|
1322
|
+
for (const col of Array.from(split.querySelectorAll(":scope > colgroup > col"))) swap.set(col, "width", "auto");
|
|
1323
|
+
for (const part of Array.from(split.querySelectorAll(":scope > tbody > tr:not([data-row-index])"))) swap.set(part, "display", "none");
|
|
1324
|
+
}
|
|
1325
|
+
const firstRow = split?.querySelector(":scope > tbody > tr[data-row-index]");
|
|
1248
1326
|
for (const th of headers) {
|
|
1249
1327
|
const field = th.dataset.field;
|
|
1250
1328
|
if (field === void 0 || wanted && !wanted.has(field)) continue;
|
|
1251
|
-
const
|
|
1329
|
+
const cell = firstRow?.querySelector(`:scope > td[data-field="${CSS.escape(field)}"]`);
|
|
1330
|
+
const width = Math.max(th.getBoundingClientRect().width, cell?.getBoundingClientRect().width ?? 0);
|
|
1252
1331
|
if (width > 0) widths[field] = Math.ceil(width);
|
|
1253
1332
|
}
|
|
1254
1333
|
} finally {
|
|
@@ -1444,7 +1523,7 @@ var useColumnResize = (options) => {
|
|
|
1444
1523
|
const scale = scaleOf(th, column);
|
|
1445
1524
|
const from = scale.declared(drawn);
|
|
1446
1525
|
const step = scale.declared(Math.round(drawn) + sign * (event.shiftKey ? 50 : 10));
|
|
1447
|
-
const to = sign ? from + sign * Math.max(1, Math.abs(step - from)) : measureColumnWidths(th.closest("table"), [column.field])[column.field];
|
|
1526
|
+
const to = sign ? from + sign * Math.max(1, Math.abs(step - from)) : measureColumnWidths(th.closest("table"), [column.field], options.body())[column.field];
|
|
1448
1527
|
if (to !== void 0) commit(column, from, to);
|
|
1449
1528
|
}
|
|
1450
1529
|
};
|
|
@@ -1538,7 +1617,7 @@ var _hoisted_3$2 = {
|
|
|
1538
1617
|
viewBox: "0 0 16 16",
|
|
1539
1618
|
"aria-hidden": "true"
|
|
1540
1619
|
};
|
|
1541
|
-
var _hoisted_4$
|
|
1620
|
+
var _hoisted_4$2 = {
|
|
1542
1621
|
key: 2,
|
|
1543
1622
|
class: "qt-sort-icon",
|
|
1544
1623
|
width: "14",
|
|
@@ -1568,7 +1647,7 @@ var sort_button_default = /* @__PURE__ */ defineComponent({
|
|
|
1568
1647
|
}, null, -1)])])) : __props.direction === "desc" ? (openBlock(), createElementBlock("svg", _hoisted_3$2, [..._cache[2] || (_cache[2] = [createElementVNode("path", {
|
|
1569
1648
|
d: "M8 12.5L3.5 6.5H12.5L8 12.5Z",
|
|
1570
1649
|
fill: "currentColor"
|
|
1571
|
-
}, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_4$
|
|
1650
|
+
}, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_4$2, [..._cache[3] || (_cache[3] = [createElementVNode("path", {
|
|
1572
1651
|
d: "M8 3L11.5 7H4.5L8 3Z",
|
|
1573
1652
|
fill: "currentColor"
|
|
1574
1653
|
}, null, -1), createElementVNode("path", {
|
|
@@ -1584,17 +1663,22 @@ var sort_button_default = /* @__PURE__ */ defineComponent({
|
|
|
1584
1663
|
var ariaSort = (direction) => direction === "asc" ? "ascending" : direction === "desc" ? "descending" : void 0;
|
|
1585
1664
|
//#endregion
|
|
1586
1665
|
//#region src/parts/table-header.vue?vue&type=script&setup=true&lang.ts
|
|
1587
|
-
var _hoisted_1$2 = [
|
|
1666
|
+
var _hoisted_1$2 = ["role"];
|
|
1667
|
+
var _hoisted_2$1 = ["role"];
|
|
1668
|
+
var _hoisted_3$1 = [
|
|
1588
1669
|
"aria-label",
|
|
1589
1670
|
"checked",
|
|
1590
1671
|
"indeterminate"
|
|
1591
1672
|
];
|
|
1592
|
-
var
|
|
1673
|
+
var _hoisted_4$1 = ["role"];
|
|
1674
|
+
var _hoisted_5 = ["role"];
|
|
1675
|
+
var _hoisted_6 = [
|
|
1593
1676
|
"title",
|
|
1594
1677
|
"aria-label",
|
|
1595
1678
|
"disabled"
|
|
1596
1679
|
];
|
|
1597
|
-
var
|
|
1680
|
+
var _hoisted_7 = [
|
|
1681
|
+
"role",
|
|
1598
1682
|
"data-field",
|
|
1599
1683
|
"data-type",
|
|
1600
1684
|
"data-sort",
|
|
@@ -1602,7 +1686,7 @@ var _hoisted_3$1 = [
|
|
|
1602
1686
|
"data-filtered",
|
|
1603
1687
|
"aria-sort"
|
|
1604
1688
|
];
|
|
1605
|
-
var
|
|
1689
|
+
var _hoisted_8 = {
|
|
1606
1690
|
key: 3,
|
|
1607
1691
|
class: "qt-title"
|
|
1608
1692
|
};
|
|
@@ -1618,7 +1702,8 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
1618
1702
|
hasPinned: { type: Boolean },
|
|
1619
1703
|
offsets: {},
|
|
1620
1704
|
autoWidths: {},
|
|
1621
|
-
slotNames: {}
|
|
1705
|
+
slotNames: {},
|
|
1706
|
+
roles: { type: Boolean }
|
|
1622
1707
|
},
|
|
1623
1708
|
setup(__props) {
|
|
1624
1709
|
const props = __props;
|
|
@@ -1665,10 +1750,11 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
1665
1750
|
control: layout.controlOf(column.field)
|
|
1666
1751
|
});
|
|
1667
1752
|
return (_ctx, _cache) => {
|
|
1668
|
-
return openBlock(), createElementBlock("tr",
|
|
1753
|
+
return openBlock(), createElementBlock("tr", { role: __props.roles ? "row" : void 0 }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.utilities, (utility) => {
|
|
1669
1754
|
return openBlock(), createElementBlock(Fragment, { key: utility }, [utility === "select" ? (openBlock(), createElementBlock("th", mergeProps({
|
|
1670
1755
|
key: 0,
|
|
1671
|
-
scope: "col"
|
|
1756
|
+
scope: "col",
|
|
1757
|
+
role: __props.roles ? "columnheader" : void 0
|
|
1672
1758
|
}, { ref_for: true }, utilityAttrs(utility)), [createElementVNode("input", {
|
|
1673
1759
|
type: "checkbox",
|
|
1674
1760
|
class: "qt-select-all",
|
|
@@ -1676,12 +1762,13 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
1676
1762
|
checked: unref(selection).allSelected.value,
|
|
1677
1763
|
indeterminate: unref(selection).someSelected.value,
|
|
1678
1764
|
onChange: _cache[0] || (_cache[0] = ($event) => unref(selection).toggleAll($event.target.checked))
|
|
1679
|
-
}, null, 40,
|
|
1765
|
+
}, null, 40, _hoisted_3$1)], 16, _hoisted_2$1)) : !hostsClearAll(utility) ? (openBlock(), createElementBlock("td", mergeProps({
|
|
1680
1766
|
key: 1,
|
|
1681
|
-
|
|
1682
|
-
}, utilityAttrs(utility)), null, 16)) : (openBlock(), createElementBlock("th", mergeProps({
|
|
1767
|
+
role: __props.roles ? "cell" : void 0
|
|
1768
|
+
}, { ref_for: true }, utilityAttrs(utility)), null, 16, _hoisted_4$1)) : (openBlock(), createElementBlock("th", mergeProps({
|
|
1683
1769
|
key: 2,
|
|
1684
|
-
scope: "col"
|
|
1770
|
+
scope: "col",
|
|
1771
|
+
role: __props.roles ? "columnheader" : void 0
|
|
1685
1772
|
}, { ref_for: true }, utilityAttrs(utility)), [createElementVNode("button", {
|
|
1686
1773
|
type: "button",
|
|
1687
1774
|
class: "qt-clear-all-button",
|
|
@@ -1709,11 +1796,12 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
1709
1796
|
y1: "6",
|
|
1710
1797
|
x2: "18",
|
|
1711
1798
|
y2: "18"
|
|
1712
|
-
})], -1)])], 8,
|
|
1799
|
+
})], -1)])], 8, _hoisted_6)], 16, _hoisted_5))], 64);
|
|
1713
1800
|
}), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
|
|
1714
1801
|
return openBlock(), createElementBlock("th", mergeProps({
|
|
1715
1802
|
key: column.field,
|
|
1716
1803
|
scope: "col",
|
|
1804
|
+
role: __props.roles ? "columnheader" : void 0,
|
|
1717
1805
|
"data-field": column.field,
|
|
1718
1806
|
"data-type": unref(columnTypeOf$1)(column),
|
|
1719
1807
|
"data-sort": unref(sort).sortOf(column) ?? void 0,
|
|
@@ -1737,7 +1825,7 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
1737
1825
|
"column",
|
|
1738
1826
|
"direction",
|
|
1739
1827
|
"onClick"
|
|
1740
|
-
])) : (openBlock(), createElementBlock("span",
|
|
1828
|
+
])) : (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(column.title), 1)),
|
|
1741
1829
|
hasFilter(column) ? (openBlock(), createBlock(filter_cell_default, {
|
|
1742
1830
|
key: 4,
|
|
1743
1831
|
column,
|
|
@@ -1760,8 +1848,8 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
1760
1848
|
key: 5,
|
|
1761
1849
|
column
|
|
1762
1850
|
}, null, 8, ["column"])) : createCommentVNode("", true)
|
|
1763
|
-
], 16,
|
|
1764
|
-
}), 128))]);
|
|
1851
|
+
], 16, _hoisted_7);
|
|
1852
|
+
}), 128))], 8, _hoisted_1$2);
|
|
1765
1853
|
};
|
|
1766
1854
|
}
|
|
1767
1855
|
});
|
|
@@ -1804,6 +1892,11 @@ var useHeaderGeometry = (options) => {
|
|
|
1804
1892
|
* right-pinned one, by key, in pixels.
|
|
1805
1893
|
*/
|
|
1806
1894
|
const offsets = shallowRef({});
|
|
1895
|
+
/**
|
|
1896
|
+
* The exact width of every header cell, in drawing order: the `col` widths
|
|
1897
|
+
* of the body and footer tables with `scrollBody` (C-101).
|
|
1898
|
+
*/
|
|
1899
|
+
const columns = shallowRef([]);
|
|
1807
1900
|
let observer = null;
|
|
1808
1901
|
const headerCells = (table) => table.querySelectorAll(":scope > thead > tr > *");
|
|
1809
1902
|
const measure = (table) => {
|
|
@@ -1812,11 +1905,13 @@ var useHeaderGeometry = (options) => {
|
|
|
1812
1905
|
const next = {};
|
|
1813
1906
|
const nextOffsets = {};
|
|
1814
1907
|
const rights = [];
|
|
1908
|
+
const nextColumns = [];
|
|
1815
1909
|
let left = 0;
|
|
1816
1910
|
headerCells(table).forEach((cell, index) => {
|
|
1817
1911
|
const drawn = cells[index];
|
|
1818
1912
|
if (drawn) {
|
|
1819
1913
|
const exact = cell.getBoundingClientRect().width;
|
|
1914
|
+
nextColumns.push(exact);
|
|
1820
1915
|
next[drawn.key] = Math.round(exact);
|
|
1821
1916
|
if (drawn.side === "left") {
|
|
1822
1917
|
nextOffsets[drawn.key] = left;
|
|
@@ -1832,6 +1927,7 @@ var useHeaderGeometry = (options) => {
|
|
|
1832
1927
|
}
|
|
1833
1928
|
if (signature(next) !== signature(widths.value)) widths.value = next;
|
|
1834
1929
|
if (signature(nextOffsets) !== signature(offsets.value)) offsets.value = nextOffsets;
|
|
1930
|
+
if (signature(nextColumns) !== signature(columns.value)) columns.value = nextColumns;
|
|
1835
1931
|
};
|
|
1836
1932
|
const observe = () => {
|
|
1837
1933
|
observer?.disconnect();
|
|
@@ -1839,6 +1935,7 @@ var useHeaderGeometry = (options) => {
|
|
|
1839
1935
|
const table = options.table.value;
|
|
1840
1936
|
if (!table || !options.active() || typeof ResizeObserver === "undefined") {
|
|
1841
1937
|
if (Object.keys(offsets.value).length > 0) offsets.value = {};
|
|
1938
|
+
if (columns.value.length > 0) columns.value = [];
|
|
1842
1939
|
return;
|
|
1843
1940
|
}
|
|
1844
1941
|
const current = new ResizeObserver(() => {
|
|
@@ -1868,7 +1965,8 @@ var useHeaderGeometry = (options) => {
|
|
|
1868
1965
|
return {
|
|
1869
1966
|
widths,
|
|
1870
1967
|
tableWidth,
|
|
1871
|
-
offsets
|
|
1968
|
+
offsets,
|
|
1969
|
+
columns
|
|
1872
1970
|
};
|
|
1873
1971
|
};
|
|
1874
1972
|
//#endregion
|
|
@@ -2067,7 +2165,7 @@ var useAutoWidth = (options) => {
|
|
|
2067
2165
|
result = cloneQuery(query);
|
|
2068
2166
|
}
|
|
2069
2167
|
if (options.rows().length === 0) return;
|
|
2070
|
-
const measured = measureColumnWidths(table, columns.map((column) => column.field));
|
|
2168
|
+
const measured = measureColumnWidths(table, columns.map((column) => column.field), options.body());
|
|
2071
2169
|
if (Object.keys(measured).length === 0) {
|
|
2072
2170
|
waiting = true;
|
|
2073
2171
|
return;
|
|
@@ -2121,6 +2219,71 @@ var useAutoWidth = (options) => {
|
|
|
2121
2219
|
return { widths };
|
|
2122
2220
|
};
|
|
2123
2221
|
//#endregion
|
|
2222
|
+
//#region src/scroll/use-scroll-body.ts
|
|
2223
|
+
var isDevelopment$1 = () => {
|
|
2224
|
+
try {
|
|
2225
|
+
return process.env.NODE_ENV !== "production";
|
|
2226
|
+
} catch {
|
|
2227
|
+
return true;
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2230
|
+
/**
|
|
2231
|
+
* Header, body and footer of `scrollBody` scroll sideways together (C-101):
|
|
2232
|
+
* one passive `scroll` listener on each wrapper sets the `scrollLeft` of the
|
|
2233
|
+
* others to its own. A position written here is remembered, so the `scroll`
|
|
2234
|
+
* event it fires is not taken for one of the user's. The table writes no
|
|
2235
|
+
* style and no attribute to the wrappers. Off, nothing is listened to.
|
|
2236
|
+
*/
|
|
2237
|
+
var useScrollBody = (options) => {
|
|
2238
|
+
let attached = [];
|
|
2239
|
+
/** The `scrollLeft` this table wrote to a wrapper, until its event. */
|
|
2240
|
+
const written = /* @__PURE__ */ new WeakMap();
|
|
2241
|
+
let warned = false;
|
|
2242
|
+
let clamped = false;
|
|
2243
|
+
/** Every wrapper but `source` to `left`, remembering what was written. */
|
|
2244
|
+
const follow = (source, left) => {
|
|
2245
|
+
for (const element of attached) if (element !== source && element.scrollLeft !== left) {
|
|
2246
|
+
element.scrollLeft = left;
|
|
2247
|
+
written.set(element, element.scrollLeft);
|
|
2248
|
+
if (!clamped && source === options.wrappers().body && left - element.scrollLeft >= 1 && isDevelopment$1()) {
|
|
2249
|
+
clamped = true;
|
|
2250
|
+
console.warn("[QueryTable] `scrollBody`: `.qt-table-head` or `.qt-table-foot` cannot scroll sideways as far as `.qt-table-body`, so its columns end shifted. Give it a vertical scrollbar as wide as that of the body (`overflow-y: scroll`; a transparent `scrollbar-color` hides it) (C-101).");
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
const onScroll = (event) => {
|
|
2255
|
+
const source = event.currentTarget;
|
|
2256
|
+
const left = source.scrollLeft;
|
|
2257
|
+
const echo = written.get(source);
|
|
2258
|
+
written.delete(source);
|
|
2259
|
+
if (echo !== left) follow(source, left);
|
|
2260
|
+
};
|
|
2261
|
+
const detach = () => {
|
|
2262
|
+
for (const element of attached) element.removeEventListener("scroll", onScroll);
|
|
2263
|
+
attached = [];
|
|
2264
|
+
};
|
|
2265
|
+
watch(() => options.enabled() ? options.wrappers() : null, (wrappers) => {
|
|
2266
|
+
detach();
|
|
2267
|
+
if (!wrappers) return;
|
|
2268
|
+
attached = [
|
|
2269
|
+
wrappers.head,
|
|
2270
|
+
wrappers.body,
|
|
2271
|
+
wrappers.foot
|
|
2272
|
+
].filter((element) => element !== null);
|
|
2273
|
+
for (const element of attached) element.addEventListener("scroll", onScroll, { passive: true });
|
|
2274
|
+
if (wrappers.body) follow(wrappers.body, wrappers.body.scrollLeft);
|
|
2275
|
+
const table = options.bodyTable();
|
|
2276
|
+
if (table && !warned && isDevelopment$1() && getComputedStyle(table).tableLayout !== "fixed") {
|
|
2277
|
+
warned = true;
|
|
2278
|
+
console.warn("[QueryTable] `scrollBody` with `table-layout: auto` on the body table: its columns follow its rows, not the header. Set `table-layout: fixed` (C-101).");
|
|
2279
|
+
}
|
|
2280
|
+
}, {
|
|
2281
|
+
flush: "post",
|
|
2282
|
+
immediate: true
|
|
2283
|
+
});
|
|
2284
|
+
onBeforeUnmount(detach);
|
|
2285
|
+
};
|
|
2286
|
+
//#endregion
|
|
2124
2287
|
//#region src/use-query-table.ts
|
|
2125
2288
|
/** The TanStack features of a Query Table, the two plugins included. */
|
|
2126
2289
|
var features = tableFeatures({
|
|
@@ -2686,6 +2849,52 @@ var useLoadMore = (o) => {
|
|
|
2686
2849
|
};
|
|
2687
2850
|
};
|
|
2688
2851
|
//#endregion
|
|
2852
|
+
//#region src/body/group-runs.ts
|
|
2853
|
+
/** The runs as a string (start and count of each), or `null` without groups. */
|
|
2854
|
+
var groupShape = (groups) => groups ? groups.runs.map((run) => `${run.start}:${run.count}`).join(",") : null;
|
|
2855
|
+
/**
|
|
2856
|
+
* Splits `rows` into runs of consecutive rows with the same `groupBy` key
|
|
2857
|
+
* (C-103). The rows are not reordered: a key that comes back after another
|
|
2858
|
+
* starts a new run. `null` and `undefined` mean no group.
|
|
2859
|
+
*/
|
|
2860
|
+
var groupRuns = (rows, groupBy) => {
|
|
2861
|
+
const runs = [];
|
|
2862
|
+
const groupOf = new Int32Array(rows.length);
|
|
2863
|
+
const headersThrough = new Int32Array(rows.length);
|
|
2864
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2865
|
+
let current = null;
|
|
2866
|
+
for (let p = 0; p < rows.length; p++) {
|
|
2867
|
+
const { row, index } = rows[p];
|
|
2868
|
+
const key = groupBy(row, index);
|
|
2869
|
+
if (key === null || key === void 0 || Number.isNaN(key)) {
|
|
2870
|
+
current = null;
|
|
2871
|
+
groupOf[p] = -1;
|
|
2872
|
+
} else if (current && current.key === key) {
|
|
2873
|
+
current.count++;
|
|
2874
|
+
groupOf[p] = runs.length - 1;
|
|
2875
|
+
} else {
|
|
2876
|
+
const nth = seen.get(key) ?? 0;
|
|
2877
|
+
seen.set(key, nth + 1);
|
|
2878
|
+
current = {
|
|
2879
|
+
key,
|
|
2880
|
+
count: 1,
|
|
2881
|
+
row,
|
|
2882
|
+
index,
|
|
2883
|
+
start: p,
|
|
2884
|
+
id: `${typeof key}:${String(key)}#${nth}`
|
|
2885
|
+
};
|
|
2886
|
+
runs.push(current);
|
|
2887
|
+
groupOf[p] = runs.length - 1;
|
|
2888
|
+
}
|
|
2889
|
+
headersThrough[p] = runs.length;
|
|
2890
|
+
}
|
|
2891
|
+
return {
|
|
2892
|
+
runs,
|
|
2893
|
+
groupOf,
|
|
2894
|
+
headersThrough
|
|
2895
|
+
};
|
|
2896
|
+
};
|
|
2897
|
+
//#endregion
|
|
2689
2898
|
//#region src/virtual/compute-window.ts
|
|
2690
2899
|
/**
|
|
2691
2900
|
* Fills `offsets` from `heights`, starting at position `from` (the offsets
|
|
@@ -2794,7 +3003,7 @@ var useRowWindow = (o) => {
|
|
|
2794
3003
|
const settings = computed((previous) => {
|
|
2795
3004
|
const value = o.virtual();
|
|
2796
3005
|
const next = value === true ? {} : value || null;
|
|
2797
|
-
return previous && next && previous.overscan === next.overscan && previous.rowHeight === next.rowHeight && previous.estimateRowHeight === next.estimateRowHeight && previous.scrollElement === next.scrollElement ? previous : next;
|
|
3006
|
+
return previous && next && previous.overscan === next.overscan && previous.rowHeight === next.rowHeight && previous.estimateRowHeight === next.estimateRowHeight && previous.groupRowHeight === next.groupRowHeight && previous.scrollElement === next.scrollElement ? previous : next;
|
|
2798
3007
|
});
|
|
2799
3008
|
const enabled = () => settings.value !== null;
|
|
2800
3009
|
const overscan = () => Math.max(0, settings.value?.overscan ?? 10);
|
|
@@ -2813,6 +3022,44 @@ var useRowWindow = (o) => {
|
|
|
2813
3022
|
};
|
|
2814
3023
|
});
|
|
2815
3024
|
const center = () => parts.value.center;
|
|
3025
|
+
/** The groups of the center rows (C-103), or `null` without `groupBy`. */
|
|
3026
|
+
const groups = computed(() => {
|
|
3027
|
+
const groupBy = o.groupBy?.();
|
|
3028
|
+
return groupBy ? groupRuns(center(), groupBy) : null;
|
|
3029
|
+
});
|
|
3030
|
+
/** The center position starts a group: its group row is drawn above it. */
|
|
3031
|
+
const startsGroup = (position) => {
|
|
3032
|
+
const g = groups.value;
|
|
3033
|
+
if (!g) return false;
|
|
3034
|
+
const at = g.groupOf[position];
|
|
3035
|
+
return at >= 0 && g.runs[at].start === position;
|
|
3036
|
+
};
|
|
3037
|
+
let groupKeys = /* @__PURE__ */ new Map();
|
|
3038
|
+
watch(groups, (g) => {
|
|
3039
|
+
if (!g) {
|
|
3040
|
+
groupKeys = /* @__PURE__ */ new Map();
|
|
3041
|
+
return;
|
|
3042
|
+
}
|
|
3043
|
+
const kept = /* @__PURE__ */ new Map();
|
|
3044
|
+
for (const run of g.runs) {
|
|
3045
|
+
const known = groupKeys.get(run.id);
|
|
3046
|
+
if (known) kept.set(run.id, known);
|
|
3047
|
+
}
|
|
3048
|
+
groupKeys = kept;
|
|
3049
|
+
});
|
|
3050
|
+
const groupKey = (id) => {
|
|
3051
|
+
let key = groupKeys.get(id);
|
|
3052
|
+
if (!key) {
|
|
3053
|
+
key = Symbol(id);
|
|
3054
|
+
groupKeys.set(id, key);
|
|
3055
|
+
}
|
|
3056
|
+
return key;
|
|
3057
|
+
};
|
|
3058
|
+
const groupRowOf = (run, aria) => ({
|
|
3059
|
+
group: run,
|
|
3060
|
+
key: groupKey(run.id),
|
|
3061
|
+
aria
|
|
3062
|
+
});
|
|
2816
3063
|
/** Position of a row index among the center rows (ascending), or -1. */
|
|
2817
3064
|
const positionOf = (index) => {
|
|
2818
3065
|
const rows = center();
|
|
@@ -2829,7 +3076,11 @@ var useRowWindow = (o) => {
|
|
|
2829
3076
|
return -1;
|
|
2830
3077
|
};
|
|
2831
3078
|
let heights = /* @__PURE__ */ new Float64Array(0);
|
|
3079
|
+
/** Item heights without the group row above an item (C-104). */
|
|
3080
|
+
let base = /* @__PURE__ */ new Float64Array(0);
|
|
2832
3081
|
let measured = /* @__PURE__ */ new Uint8Array(0);
|
|
3082
|
+
/** The measured height of a group row, `0` until one is measured. */
|
|
3083
|
+
let groupMeasured = 0;
|
|
2833
3084
|
let offsets = /* @__PURE__ */ new Float64Array(1);
|
|
2834
3085
|
let byKey = /* @__PURE__ */ new Map();
|
|
2835
3086
|
/** The first measured height, the estimate when none is given. */
|
|
@@ -2837,25 +3088,34 @@ var useRowWindow = (o) => {
|
|
|
2837
3088
|
/** Bumped whenever `offsets` change, so the spacers are drawn again. */
|
|
2838
3089
|
const version = shallowRef(0);
|
|
2839
3090
|
const estimate = () => fixed() ?? settings.value?.estimateRowHeight ?? (firstMeasured || 32);
|
|
3091
|
+
/** Height counted for a group row (C-104). */
|
|
3092
|
+
const groupHeight = () => {
|
|
3093
|
+
const height = fixed();
|
|
3094
|
+
if (height !== void 0) return settings.value?.groupRowHeight ?? height;
|
|
3095
|
+
return groupMeasured || estimate();
|
|
3096
|
+
};
|
|
3097
|
+
/** An item's height: its row and, above it, its group row. */
|
|
3098
|
+
const withGroup = (position) => base[position] + (startsGroup(position) ? groupHeight() : 0);
|
|
2840
3099
|
const rebuild = () => {
|
|
2841
3100
|
const rows = enabled() ? center() : [];
|
|
2842
3101
|
const height = fixed();
|
|
2843
3102
|
heights = new Float64Array(rows.length);
|
|
3103
|
+
base = groups.value ? new Float64Array(rows.length) : heights;
|
|
2844
3104
|
measured = new Uint8Array(rows.length);
|
|
2845
3105
|
const kept = /* @__PURE__ */ new Map();
|
|
2846
3106
|
for (let i = 0; i < rows.length; i++) {
|
|
2847
|
-
if (height !== void 0)
|
|
2848
|
-
heights[i] = height;
|
|
2849
|
-
continue;
|
|
2850
|
-
}
|
|
2851
|
-
const key = o.keyOf(rows[i].row, rows[i].index);
|
|
2852
|
-
const known = byKey.get(key);
|
|
2853
|
-
if (known === void 0) heights[i] = estimate();
|
|
3107
|
+
if (height !== void 0) base[i] = height;
|
|
2854
3108
|
else {
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
3109
|
+
const key = o.keyOf(rows[i].row, rows[i].index);
|
|
3110
|
+
const known = byKey.get(key);
|
|
3111
|
+
if (known === void 0) base[i] = estimate();
|
|
3112
|
+
else {
|
|
3113
|
+
kept.set(key, known);
|
|
3114
|
+
base[i] = known;
|
|
3115
|
+
measured[i] = 1;
|
|
3116
|
+
}
|
|
2858
3117
|
}
|
|
3118
|
+
heights[i] = withGroup(i);
|
|
2859
3119
|
}
|
|
2860
3120
|
byKey = kept;
|
|
2861
3121
|
pending = null;
|
|
@@ -2880,6 +3140,14 @@ var useRowWindow = (o) => {
|
|
|
2880
3140
|
const rows = center();
|
|
2881
3141
|
let from = -1;
|
|
2882
3142
|
for (const tr of tbody.children) {
|
|
3143
|
+
if (groups.value && tr.classList.contains("qt-group-row")) {
|
|
3144
|
+
const height = tr.getBoundingClientRect().height;
|
|
3145
|
+
if (height > 0 && Math.abs(height - groupMeasured) > .5) {
|
|
3146
|
+
groupMeasured = height;
|
|
3147
|
+
from = 0;
|
|
3148
|
+
}
|
|
3149
|
+
continue;
|
|
3150
|
+
}
|
|
2883
3151
|
const at = tr.getAttribute("data-row-index");
|
|
2884
3152
|
if (at === null || tr.hasAttribute("data-pinned-row")) continue;
|
|
2885
3153
|
const position = positionOf(Number(at));
|
|
@@ -2887,17 +3155,18 @@ var useRowWindow = (o) => {
|
|
|
2887
3155
|
const height = itemHeight(tr);
|
|
2888
3156
|
if (!firstMeasured && height > 0 && settings.value?.estimateRowHeight === void 0) {
|
|
2889
3157
|
firstMeasured = height;
|
|
2890
|
-
for (let i = 0; i <
|
|
3158
|
+
for (let i = 0; i < base.length; i++) if (!measured[i]) base[i] = height;
|
|
2891
3159
|
from = 0;
|
|
2892
3160
|
}
|
|
2893
|
-
if (!measured[position] || Math.abs(
|
|
2894
|
-
|
|
3161
|
+
if (!measured[position] || Math.abs(base[position] - height) > .5) {
|
|
3162
|
+
base[position] = height;
|
|
2895
3163
|
measured[position] = 1;
|
|
2896
3164
|
byKey.set(o.keyOf(rows[position].row, rows[position].index), height);
|
|
2897
3165
|
from = from < 0 ? position : Math.min(from, position);
|
|
2898
3166
|
}
|
|
2899
3167
|
}
|
|
2900
3168
|
if (from >= 0) {
|
|
3169
|
+
for (let i = from; i < heights.length; i++) heights[i] = withGroup(i);
|
|
2901
3170
|
fillOffsets(heights, offsets, from);
|
|
2902
3171
|
version.value++;
|
|
2903
3172
|
return true;
|
|
@@ -2949,11 +3218,11 @@ var useRowWindow = (o) => {
|
|
|
2949
3218
|
});
|
|
2950
3219
|
};
|
|
2951
3220
|
/** How far to scroll to show an item at `top` (client) with `height`. */
|
|
2952
|
-
const alignDelta = (top, height, align) => {
|
|
3221
|
+
const alignDelta = (top, height, align, groupCover = 0) => {
|
|
2953
3222
|
const view = viewport();
|
|
2954
3223
|
const head = o.table.value?.tHead?.getBoundingClientRect();
|
|
2955
3224
|
const cover = head && head.top <= view.top + 1 && head.bottom > view.top ? head.bottom - view.top : 0;
|
|
2956
|
-
const viewTop = view.top + cover;
|
|
3225
|
+
const viewTop = view.top + cover + groupCover;
|
|
2957
3226
|
const viewBottom = view.top + view.height;
|
|
2958
3227
|
const bottom = top + height;
|
|
2959
3228
|
switch (align) {
|
|
@@ -2963,6 +3232,20 @@ var useRowWindow = (o) => {
|
|
|
2963
3232
|
default: return top < viewTop ? top - viewTop : bottom > viewBottom ? bottom - viewBottom : 0;
|
|
2964
3233
|
}
|
|
2965
3234
|
};
|
|
3235
|
+
/**
|
|
3236
|
+
* Height of a group row the consumer's CSS made sticky, which covers a
|
|
3237
|
+
* row aligned to the top of its group (C-104); `0` without one.
|
|
3238
|
+
*/
|
|
3239
|
+
const stickyGroupCover = (tbody) => {
|
|
3240
|
+
if (!groups.value) return 0;
|
|
3241
|
+
const cell = tbody.querySelector(":scope > tr.qt-group-row > th");
|
|
3242
|
+
return cell && getComputedStyle(cell).position === "sticky" ? cell.getBoundingClientRect().height : 0;
|
|
3243
|
+
};
|
|
3244
|
+
/** The sticky cover over a row: only a grouped row that does not start its group. */
|
|
3245
|
+
const coverOf = (position, tbody) => {
|
|
3246
|
+
const g = groups.value;
|
|
3247
|
+
return g && g.groupOf[position] >= 0 && !startsGroup(position) ? stickyGroupCover(tbody) : 0;
|
|
3248
|
+
};
|
|
2966
3249
|
/** After a render: correct the drift (C-84) or a `scrollToIndex` (C-87). */
|
|
2967
3250
|
const settle = () => {
|
|
2968
3251
|
const tbody = body();
|
|
@@ -2974,9 +3257,11 @@ var useRowWindow = (o) => {
|
|
|
2974
3257
|
if (pending) {
|
|
2975
3258
|
const tr = rowElement(tbody, pending.position);
|
|
2976
3259
|
if (tr) {
|
|
2977
|
-
const { align } = pending;
|
|
3260
|
+
const { align, position } = pending;
|
|
2978
3261
|
pending = null;
|
|
2979
|
-
|
|
3262
|
+
const above = startsGroup(position) ? tr.previousElementSibling : null;
|
|
3263
|
+
const head = above?.classList.contains("qt-group-row") ? above : null;
|
|
3264
|
+
scrollBy(alignDelta((head ?? tr).getBoundingClientRect().top, itemHeight(tr) + (head ? head.getBoundingClientRect().height : 0), align, head ? 0 : coverOf(position, tbody)));
|
|
2980
3265
|
return;
|
|
2981
3266
|
}
|
|
2982
3267
|
if (++pending.tries <= pendingFrames) {
|
|
@@ -3072,19 +3357,57 @@ var useRowWindow = (o) => {
|
|
|
3072
3357
|
for (let i = 0; i < all.length; i++) counts[i + 1] = counts[i] + (o.isExpanded(all[i].row, all[i].index) ? 1 : 0);
|
|
3073
3358
|
return counts;
|
|
3074
3359
|
});
|
|
3360
|
+
/** Group rows drawn up to and with the center position (C-104). */
|
|
3361
|
+
const groupsThrough = (position) => groups.value ? groups.value.headersThrough[position] : 0;
|
|
3362
|
+
const groupCount = () => groups.value?.runs.length ?? 0;
|
|
3075
3363
|
const drawn = computed(() => {
|
|
3076
3364
|
const { all, top } = parts.value;
|
|
3077
|
-
|
|
3365
|
+
const g = groups.value;
|
|
3366
|
+
if (!enabled()) {
|
|
3367
|
+
if (!g) return all;
|
|
3368
|
+
const out = [];
|
|
3369
|
+
for (let q = 0; q < all.length; q++) {
|
|
3370
|
+
const p = q - top;
|
|
3371
|
+
if (p >= 0 && p < g.groupOf.length && startsGroup(p)) out.push(groupRowOf(g.runs[g.groupOf[p]]));
|
|
3372
|
+
out.push(all[q]);
|
|
3373
|
+
}
|
|
3374
|
+
return out;
|
|
3375
|
+
}
|
|
3078
3376
|
version.value;
|
|
3079
3377
|
const rows = center();
|
|
3080
3378
|
const before = expandedBefore.value;
|
|
3379
|
+
const headersBefore = (q) => q < top ? 0 : q < top + rows.length ? groupsThrough(q - top) : groupCount();
|
|
3380
|
+
const ariaOf = (q) => q + before[q] + headersBefore(q) + 2;
|
|
3081
3381
|
const at = (q) => ({
|
|
3082
3382
|
...all[q],
|
|
3083
|
-
aria: q
|
|
3383
|
+
aria: ariaOf(q)
|
|
3084
3384
|
});
|
|
3085
3385
|
const out = [];
|
|
3386
|
+
/** The group whose row was drawn last, or -1. */
|
|
3387
|
+
let drawnGroup = -1;
|
|
3388
|
+
/** The center row at `p`, after its group row when it needs one. */
|
|
3389
|
+
const push = (p, carry) => {
|
|
3390
|
+
const group = g ? g.groupOf[p] : -1;
|
|
3391
|
+
if (g && group >= 0 && group !== drawnGroup) {
|
|
3392
|
+
const run = g.runs[group];
|
|
3393
|
+
if (run.start === p) out.push(groupRowOf(run, ariaOf(top + p) - 1));
|
|
3394
|
+
else if (carry) {
|
|
3395
|
+
const last = out[out.length - 1];
|
|
3396
|
+
if (last && "spacer" in last) {
|
|
3397
|
+
const height = Math.max(0, last.spacer - groupHeight());
|
|
3398
|
+
out[out.length - 1] = {
|
|
3399
|
+
spacer: height,
|
|
3400
|
+
key: last.key
|
|
3401
|
+
};
|
|
3402
|
+
}
|
|
3403
|
+
out.push(groupRowOf(run, ariaOf(top + run.start) - 1));
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
drawnGroup = group;
|
|
3407
|
+
out.push(at(top + p));
|
|
3408
|
+
};
|
|
3086
3409
|
for (let q = 0; q < top; q++) out.push(at(q));
|
|
3087
|
-
if (printing.value) for (let p = 0; p < rows.length; p++)
|
|
3410
|
+
if (printing.value) for (let p = 0; p < rows.length; p++) push(p, false);
|
|
3088
3411
|
else {
|
|
3089
3412
|
const end = Math.min(range.value.end, rows.length);
|
|
3090
3413
|
const win = {
|
|
@@ -3095,10 +3418,10 @@ var useRowWindow = (o) => {
|
|
|
3095
3418
|
spacer: segment.spacer,
|
|
3096
3419
|
key: spacerKeys[segment.slot]
|
|
3097
3420
|
});
|
|
3098
|
-
else for (let p = segment.from; p < segment.to; p++)
|
|
3421
|
+
else for (let p = segment.from; p < segment.to; p++) push(p, p === segment.from);
|
|
3099
3422
|
}
|
|
3100
3423
|
for (let q = top + rows.length; q < all.length; q++) out.push(at(q));
|
|
3101
|
-
return out;
|
|
3424
|
+
return g ? out.filter((item) => !("spacer" in item) || item.spacer > 0) : out;
|
|
3102
3425
|
});
|
|
3103
3426
|
let box = null;
|
|
3104
3427
|
let rowsObserver = null;
|
|
@@ -3191,6 +3514,8 @@ var useRowWindow = (o) => {
|
|
|
3191
3514
|
() => parts.value.center,
|
|
3192
3515
|
() => settings.value?.rowHeight,
|
|
3193
3516
|
() => settings.value?.estimateRowHeight,
|
|
3517
|
+
() => settings.value?.groupRowHeight,
|
|
3518
|
+
() => groupShape(groups.value),
|
|
3194
3519
|
enabled
|
|
3195
3520
|
], rebuild, { immediate: true });
|
|
3196
3521
|
watch([
|
|
@@ -3245,7 +3570,7 @@ var useRowWindow = (o) => {
|
|
|
3245
3570
|
align,
|
|
3246
3571
|
tries: 0
|
|
3247
3572
|
};
|
|
3248
|
-
scrollBy(alignDelta(itemsTop(tbody) + offsets[position], heights[position], align));
|
|
3573
|
+
scrollBy(alignDelta(itemsTop(tbody) + offsets[position], heights[position], align, coverOf(position, tbody)));
|
|
3249
3574
|
schedule();
|
|
3250
3575
|
};
|
|
3251
3576
|
return {
|
|
@@ -3255,6 +3580,8 @@ var useRowWindow = (o) => {
|
|
|
3255
3580
|
ready,
|
|
3256
3581
|
centerCount: () => center().length,
|
|
3257
3582
|
expandedCount: () => expandedBefore.value[expandedBefore.value.length - 1],
|
|
3583
|
+
/** Group rows of the body, drawn or not (C-104). */
|
|
3584
|
+
groupCount,
|
|
3258
3585
|
scrollToIndex,
|
|
3259
3586
|
onFocusIn,
|
|
3260
3587
|
onFocusOut
|
|
@@ -3267,8 +3594,12 @@ var _hoisted_1 = [
|
|
|
3267
3594
|
"data-loading",
|
|
3268
3595
|
"aria-busy"
|
|
3269
3596
|
];
|
|
3270
|
-
var _hoisted_2 =
|
|
3271
|
-
var _hoisted_3 =
|
|
3597
|
+
var _hoisted_2 = ["role", "aria-rowcount"];
|
|
3598
|
+
var _hoisted_3 = {
|
|
3599
|
+
class: "qt-table",
|
|
3600
|
+
role: "presentation"
|
|
3601
|
+
};
|
|
3602
|
+
var _hoisted_4 = ["aria-rowcount"];
|
|
3272
3603
|
//#endregion
|
|
3273
3604
|
//#region src/query-table.vue
|
|
3274
3605
|
var query_table_default = /* @__PURE__ */ defineComponent({
|
|
@@ -3323,6 +3654,10 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3323
3654
|
type: Function,
|
|
3324
3655
|
default: void 0
|
|
3325
3656
|
},
|
|
3657
|
+
groupBy: {
|
|
3658
|
+
type: Function,
|
|
3659
|
+
default: void 0
|
|
3660
|
+
},
|
|
3326
3661
|
hasRightPanel: {
|
|
3327
3662
|
type: Boolean,
|
|
3328
3663
|
default: false
|
|
@@ -3336,6 +3671,10 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3336
3671
|
type: [Boolean, Object],
|
|
3337
3672
|
default: false
|
|
3338
3673
|
},
|
|
3674
|
+
scrollBody: {
|
|
3675
|
+
type: Boolean,
|
|
3676
|
+
default: false
|
|
3677
|
+
},
|
|
3339
3678
|
infinite: {
|
|
3340
3679
|
type: [Boolean, Object],
|
|
3341
3680
|
default: false
|
|
@@ -3413,8 +3752,17 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3413
3752
|
const columnCount = computed(() => entries.value.length + utilityCount.value);
|
|
3414
3753
|
/** Utilities are pinned only with a left-pinned column (C-46, C-71). */
|
|
3415
3754
|
const utilitySide = () => hasPinned.value ? "left" : false;
|
|
3755
|
+
/** The table of the header: with `scrollBody` the first of three (C-101). */
|
|
3416
3756
|
const tableEl = shallowRef(null);
|
|
3417
|
-
const
|
|
3757
|
+
const bodyTableEl = shallowRef(null);
|
|
3758
|
+
const headWrap = shallowRef(null);
|
|
3759
|
+
const bodyWrap = shallowRef(null);
|
|
3760
|
+
const footWrap = shallowRef(null);
|
|
3761
|
+
/** The table of the body rows. */
|
|
3762
|
+
const bodyTable = computed(() => bodyTableEl.value ?? tableEl.value);
|
|
3763
|
+
/** With `scrollBody`, the body table to measure apart from the header. */
|
|
3764
|
+
const splitBody = () => props.scrollBody ? bodyTableEl.value : null;
|
|
3765
|
+
const { widths, tableWidth, offsets, columns: cellWidths } = useHeaderGeometry({
|
|
3418
3766
|
table: tableEl,
|
|
3419
3767
|
cells: () => [...utilities.value.map((utility) => ({
|
|
3420
3768
|
key: utilityKey(utility),
|
|
@@ -3423,12 +3771,24 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3423
3771
|
key: column.field,
|
|
3424
3772
|
side: sideOf(column)
|
|
3425
3773
|
}))],
|
|
3426
|
-
active: () => entries.value.some((entry) => sideOf(entry.column) !== false) || props.resizable && entries.value.some((entry) => entry.column.resizable !== false)
|
|
3774
|
+
active: () => props.scrollBody || entries.value.some((entry) => sideOf(entry.column) !== false) || props.resizable && entries.value.some((entry) => entry.column.resizable !== false)
|
|
3775
|
+
});
|
|
3776
|
+
/** The `col` widths of the body and footer tables (C-101), in pixels. */
|
|
3777
|
+
const colWidths = computed(() => Array.from({ length: columnCount.value }, (_, i) => cellWidths.value[i]));
|
|
3778
|
+
useScrollBody({
|
|
3779
|
+
enabled: () => props.scrollBody,
|
|
3780
|
+
wrappers: () => ({
|
|
3781
|
+
head: headWrap.value,
|
|
3782
|
+
body: bodyWrap.value,
|
|
3783
|
+
foot: footWrap.value
|
|
3784
|
+
}),
|
|
3785
|
+
bodyTable: () => bodyTableEl.value
|
|
3427
3786
|
});
|
|
3428
3787
|
const resize = useColumnResize({
|
|
3429
3788
|
resizable: () => props.resizable,
|
|
3430
3789
|
measuredWidth: (field) => widths.value[field],
|
|
3431
3790
|
tableWidth: () => tableWidth.value,
|
|
3791
|
+
body: splitBody,
|
|
3432
3792
|
emit: (payload) => {
|
|
3433
3793
|
emit("columnResize", payload);
|
|
3434
3794
|
const next = applyWidth(props.columns, payload.field, `${payload.width}px`);
|
|
@@ -3439,6 +3799,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3439
3799
|
enabled: () => props.autoWidth,
|
|
3440
3800
|
max: () => props.autoWidthMax,
|
|
3441
3801
|
table: tableEl,
|
|
3802
|
+
body: splitBody,
|
|
3442
3803
|
columns: () => visibleColumns.value,
|
|
3443
3804
|
rows: () => props.rows,
|
|
3444
3805
|
query: () => props.query,
|
|
@@ -3446,10 +3807,11 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3446
3807
|
});
|
|
3447
3808
|
const rowWindow = useRowWindow({
|
|
3448
3809
|
virtual: () => props.virtual,
|
|
3449
|
-
table:
|
|
3810
|
+
table: bodyTable,
|
|
3450
3811
|
bodyRows: () => state.rowPinning.rows.value,
|
|
3451
3812
|
keyOf: expansion.keyOf,
|
|
3452
|
-
isExpanded: expansion.isExpanded
|
|
3813
|
+
isExpanded: expansion.isExpanded,
|
|
3814
|
+
groupBy: () => props.groupBy
|
|
3453
3815
|
});
|
|
3454
3816
|
const infinite = useLoadMore({
|
|
3455
3817
|
infinite: () => props.infinite,
|
|
@@ -3460,7 +3822,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3460
3822
|
cursors: () => props.cursors,
|
|
3461
3823
|
loading: () => props.loading,
|
|
3462
3824
|
nextPage: () => paginationProps.value.nextPage(),
|
|
3463
|
-
table:
|
|
3825
|
+
table: bodyTable,
|
|
3464
3826
|
virtual: rowWindow.enabled,
|
|
3465
3827
|
window: () => rowWindow.ready.value ? {
|
|
3466
3828
|
end: rowWindow.range.value.end,
|
|
@@ -3478,11 +3840,11 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3478
3840
|
const ariaRowCount = computed(() => {
|
|
3479
3841
|
if (!rowWindow.enabled()) return;
|
|
3480
3842
|
const total = props.totalRows;
|
|
3481
|
-
if (growing() && total === null) return -1;
|
|
3482
|
-
return 1 + (growing() && total !== null ? total : props.rows.length) + rowWindow.expandedCount() + footerCount.value;
|
|
3843
|
+
if (growing() && (total === null || rowWindow.groupCount() > 0)) return -1;
|
|
3844
|
+
return 1 + (growing() && total !== null ? total : props.rows.length) + rowWindow.expandedCount() + rowWindow.groupCount() + footerCount.value;
|
|
3483
3845
|
});
|
|
3484
3846
|
/** `aria-rowindex` of the first footer row, or `undefined` (C-86). */
|
|
3485
|
-
const footerRowIndex = computed(() => !rowWindow.enabled() || growing() ? void 0 : 2 + props.rows.length + rowWindow.expandedCount());
|
|
3847
|
+
const footerRowIndex = computed(() => !rowWindow.enabled() || growing() ? void 0 : 2 + props.rows.length + rowWindow.expandedCount() + rowWindow.groupCount());
|
|
3486
3848
|
const flashView = useChangeFlash({
|
|
3487
3849
|
flash: () => props.flash,
|
|
3488
3850
|
rowsUpdate: () => props.rowsUpdate,
|
|
@@ -3491,7 +3853,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3491
3853
|
loading: () => props.loading,
|
|
3492
3854
|
fields: () => entries.value.map((entry) => entry.column.field),
|
|
3493
3855
|
rowKey: () => props.rowKey,
|
|
3494
|
-
table:
|
|
3856
|
+
table: bodyTable
|
|
3495
3857
|
});
|
|
3496
3858
|
const reorder = useColumnReorder({
|
|
3497
3859
|
reorderable: () => props.reorderable,
|
|
@@ -3521,7 +3883,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3521
3883
|
search.apply();
|
|
3522
3884
|
}
|
|
3523
3885
|
});
|
|
3524
|
-
const bodySlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("cell-") || name === "subtable" || name === "empty" || name === "loading" || name === "load-more");
|
|
3886
|
+
const bodySlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("cell-") || name === "subtable" || name === "empty" || name === "loading" || name === "load-more" || name === "group");
|
|
3525
3887
|
const headerSlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("header-") || name === "filter-datetime" || name === "filter-menu").sort().join(" ");
|
|
3526
3888
|
__expose({
|
|
3527
3889
|
collapseAll: expansion.collapseAll,
|
|
@@ -3532,7 +3894,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3532
3894
|
},
|
|
3533
3895
|
scrollToIndex: rowWindow.scrollToIndex,
|
|
3534
3896
|
loadMore: infinite.loadMore,
|
|
3535
|
-
measureColumnWidths: (fields) => measureColumnWidths(tableEl.value, fields)
|
|
3897
|
+
measureColumnWidths: (fields) => measureColumnWidths(tableEl.value, fields, splitBody())
|
|
3536
3898
|
});
|
|
3537
3899
|
return (_ctx, _cache) => {
|
|
3538
3900
|
return openBlock(), createElementBlock("div", {
|
|
@@ -3542,13 +3904,156 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3542
3904
|
"aria-busy": __props.loading ? "true" : void 0
|
|
3543
3905
|
}, [
|
|
3544
3906
|
renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbarProps()))),
|
|
3545
|
-
createElementVNode("div",
|
|
3907
|
+
createElementVNode("div", {
|
|
3908
|
+
class: "qt-table-responsive",
|
|
3909
|
+
role: __props.scrollBody ? "table" : void 0,
|
|
3910
|
+
"aria-rowcount": __props.scrollBody ? ariaRowCount.value : void 0
|
|
3911
|
+
}, [__props.scrollBody ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3912
|
+
createElementVNode("div", {
|
|
3913
|
+
ref_key: "headWrap",
|
|
3914
|
+
ref: headWrap,
|
|
3915
|
+
class: "qt-table-head"
|
|
3916
|
+
}, [createElementVNode("table", {
|
|
3917
|
+
ref_key: "tableEl",
|
|
3918
|
+
ref: tableEl,
|
|
3919
|
+
class: "qt-table",
|
|
3920
|
+
role: "presentation"
|
|
3921
|
+
}, [createElementVNode("thead", {
|
|
3922
|
+
role: "rowgroup",
|
|
3923
|
+
onContextmenu: _cache[0] || (_cache[0] = (...args) => unref(onHeaderContextMenu) && unref(onHeaderContextMenu)(...args))
|
|
3924
|
+
}, [createVNode(table_header_default, {
|
|
3925
|
+
columns: visibleColumns.value,
|
|
3926
|
+
query: __props.query,
|
|
3927
|
+
filterable: __props.filterable,
|
|
3928
|
+
utilities: utilities.value,
|
|
3929
|
+
"has-pinned": unref(hasPinned),
|
|
3930
|
+
offsets: unref(offsets),
|
|
3931
|
+
"auto-widths": unref(autoWidth).widths.value,
|
|
3932
|
+
"slot-names": headerSlotNames(),
|
|
3933
|
+
"aria-rowindex": unref(rowWindow).enabled() ? 1 : void 0,
|
|
3934
|
+
roles: ""
|
|
3935
|
+
}, {
|
|
3936
|
+
header: withCtx((p) => [renderSlot(_ctx.$slots, `header-${p.column.field}`, normalizeProps(guardReactiveProps(p)))]),
|
|
3937
|
+
"filter-datetime": withCtx((p) => [renderSlot(_ctx.$slots, "filter-datetime", normalizeProps(guardReactiveProps(p)))]),
|
|
3938
|
+
"filter-menu": withCtx((p) => [renderSlot(_ctx.$slots, "filter-menu", normalizeProps(guardReactiveProps(p)))]),
|
|
3939
|
+
_: 3
|
|
3940
|
+
}, 8, [
|
|
3941
|
+
"columns",
|
|
3942
|
+
"query",
|
|
3943
|
+
"filterable",
|
|
3944
|
+
"utilities",
|
|
3945
|
+
"has-pinned",
|
|
3946
|
+
"offsets",
|
|
3947
|
+
"auto-widths",
|
|
3948
|
+
"slot-names",
|
|
3949
|
+
"aria-rowindex"
|
|
3950
|
+
])], 32)], 512)], 512),
|
|
3951
|
+
createElementVNode("div", {
|
|
3952
|
+
ref_key: "bodyWrap",
|
|
3953
|
+
ref: bodyWrap,
|
|
3954
|
+
class: "qt-table-body"
|
|
3955
|
+
}, [createElementVNode("table", {
|
|
3956
|
+
ref_key: "bodyTableEl",
|
|
3957
|
+
ref: bodyTableEl,
|
|
3958
|
+
class: "qt-table",
|
|
3959
|
+
role: "presentation"
|
|
3960
|
+
}, [createElementVNode("colgroup", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(colWidths.value, (width, i) => {
|
|
3961
|
+
return openBlock(), createElementBlock("col", {
|
|
3962
|
+
key: i,
|
|
3963
|
+
style: normalizeStyle(width === void 0 ? void 0 : { width: `${width}px` })
|
|
3964
|
+
}, null, 4);
|
|
3965
|
+
}), 128))]), createVNode(table_body_default, {
|
|
3966
|
+
rows: __props.rows,
|
|
3967
|
+
"body-rows": unref(rowWindow).drawn.value,
|
|
3968
|
+
"pin-row": unref(state).rowPinning.pin,
|
|
3969
|
+
loading: __props.loading,
|
|
3970
|
+
entries: unref(entries),
|
|
3971
|
+
"column-count": columnCount.value,
|
|
3972
|
+
"has-subtable": __props.hasSubtable,
|
|
3973
|
+
"has-right-panel": __props.hasRightPanel,
|
|
3974
|
+
"has-selection": unref(rowSelection).enabled.value,
|
|
3975
|
+
"is-selected": unref(rowSelection).isSelected,
|
|
3976
|
+
"toggle-selected": unref(rowSelection).toggle,
|
|
3977
|
+
"has-pinned": unref(hasPinned),
|
|
3978
|
+
offsets: unref(offsets),
|
|
3979
|
+
"key-of": unref(expansion).keyOf,
|
|
3980
|
+
"can-expand": unref(expansion).canExpand,
|
|
3981
|
+
"is-expanded": unref(expansion).isExpanded,
|
|
3982
|
+
toggle: unref(expansion).toggle,
|
|
3983
|
+
"row-kind": __props.rowKind,
|
|
3984
|
+
labels: labels.value,
|
|
3985
|
+
"has-context-menu-listener": hasContextMenuListener,
|
|
3986
|
+
"load-more": loadMoreProps.value,
|
|
3987
|
+
flash: unref(flashView),
|
|
3988
|
+
roles: "",
|
|
3989
|
+
onRowRightPanelClick: _cache[1] || (_cache[1] = (row) => emit("rowRightPanelClick", row)),
|
|
3990
|
+
onCellContextMenu: _cache[2] || (_cache[2] = (payload) => emit("cellContextMenu", payload)),
|
|
3991
|
+
onFocusin: unref(rowWindow).onFocusIn,
|
|
3992
|
+
onFocusout: unref(rowWindow).onFocusOut
|
|
3993
|
+
}, createSlots({ _: 2 }, [renderList(bodySlotNames(), (name) => {
|
|
3994
|
+
return {
|
|
3995
|
+
name,
|
|
3996
|
+
fn: withCtx((p) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(p)))])
|
|
3997
|
+
};
|
|
3998
|
+
})]), 1032, [
|
|
3999
|
+
"rows",
|
|
4000
|
+
"body-rows",
|
|
4001
|
+
"pin-row",
|
|
4002
|
+
"loading",
|
|
4003
|
+
"entries",
|
|
4004
|
+
"column-count",
|
|
4005
|
+
"has-subtable",
|
|
4006
|
+
"has-right-panel",
|
|
4007
|
+
"has-selection",
|
|
4008
|
+
"is-selected",
|
|
4009
|
+
"toggle-selected",
|
|
4010
|
+
"has-pinned",
|
|
4011
|
+
"offsets",
|
|
4012
|
+
"key-of",
|
|
4013
|
+
"can-expand",
|
|
4014
|
+
"is-expanded",
|
|
4015
|
+
"toggle",
|
|
4016
|
+
"row-kind",
|
|
4017
|
+
"labels",
|
|
4018
|
+
"load-more",
|
|
4019
|
+
"flash",
|
|
4020
|
+
"onFocusin",
|
|
4021
|
+
"onFocusout"
|
|
4022
|
+
])], 512)], 512),
|
|
4023
|
+
__props.footerRows.length > 0 ? (openBlock(), createElementBlock("div", {
|
|
4024
|
+
key: 0,
|
|
4025
|
+
ref_key: "footWrap",
|
|
4026
|
+
ref: footWrap,
|
|
4027
|
+
class: "qt-table-foot"
|
|
4028
|
+
}, [createElementVNode("table", _hoisted_3, [createElementVNode("colgroup", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(colWidths.value, (width, i) => {
|
|
4029
|
+
return openBlock(), createElementBlock("col", {
|
|
4030
|
+
key: i,
|
|
4031
|
+
style: normalizeStyle(width === void 0 ? void 0 : { width: `${width}px` })
|
|
4032
|
+
}, null, 4);
|
|
4033
|
+
}), 128))]), createVNode(table_footer_default, {
|
|
4034
|
+
"footer-rows": __props.footerRows,
|
|
4035
|
+
entries: unref(entries),
|
|
4036
|
+
"utility-count": utilityCount.value,
|
|
4037
|
+
"has-pinned": unref(hasPinned),
|
|
4038
|
+
offsets: unref(offsets),
|
|
4039
|
+
"first-row-index": footerRowIndex.value,
|
|
4040
|
+
roles: ""
|
|
4041
|
+
}, null, 8, [
|
|
4042
|
+
"footer-rows",
|
|
4043
|
+
"entries",
|
|
4044
|
+
"utility-count",
|
|
4045
|
+
"has-pinned",
|
|
4046
|
+
"offsets",
|
|
4047
|
+
"first-row-index"
|
|
4048
|
+
])])], 512)) : createCommentVNode("", true)
|
|
4049
|
+
], 64)) : (openBlock(), createElementBlock("table", {
|
|
4050
|
+
key: 1,
|
|
3546
4051
|
ref_key: "tableEl",
|
|
3547
4052
|
ref: tableEl,
|
|
3548
4053
|
class: "qt-table",
|
|
3549
4054
|
"aria-rowcount": ariaRowCount.value
|
|
3550
4055
|
}, [
|
|
3551
|
-
createElementVNode("thead", { onContextmenu: _cache[
|
|
4056
|
+
createElementVNode("thead", { onContextmenu: _cache[3] || (_cache[3] = (...args) => unref(onHeaderContextMenu) && unref(onHeaderContextMenu)(...args)) }, [createVNode(table_header_default, {
|
|
3552
4057
|
columns: visibleColumns.value,
|
|
3553
4058
|
query: __props.query,
|
|
3554
4059
|
filterable: __props.filterable,
|
|
@@ -3597,8 +4102,8 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3597
4102
|
"has-context-menu-listener": hasContextMenuListener,
|
|
3598
4103
|
"load-more": loadMoreProps.value,
|
|
3599
4104
|
flash: unref(flashView),
|
|
3600
|
-
onRowRightPanelClick: _cache[
|
|
3601
|
-
onCellContextMenu: _cache[
|
|
4105
|
+
onRowRightPanelClick: _cache[4] || (_cache[4] = (row) => emit("rowRightPanelClick", row)),
|
|
4106
|
+
onCellContextMenu: _cache[5] || (_cache[5] = (payload) => emit("cellContextMenu", payload)),
|
|
3602
4107
|
onFocusin: unref(rowWindow).onFocusIn,
|
|
3603
4108
|
onFocusout: unref(rowWindow).onFocusOut
|
|
3604
4109
|
}, createSlots({ _: 2 }, [renderList(bodySlotNames(), (name) => {
|
|
@@ -3647,7 +4152,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3647
4152
|
"offsets",
|
|
3648
4153
|
"first-row-index"
|
|
3649
4154
|
])) : createCommentVNode("", true)
|
|
3650
|
-
], 8,
|
|
4155
|
+
], 8, _hoisted_4))], 8, _hoisted_2),
|
|
3651
4156
|
showPagination.value ? (openBlock(), createBlock(table_pagination_default, {
|
|
3652
4157
|
key: 0,
|
|
3653
4158
|
"pagination-props": unref(paginationProps)
|