@dolusoft/query-table 3.8.0 → 3.10.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 +359 -65
- package/dist/query-table.js.map +1 -1
- package/dist/types/body/group-runs.d.ts +32 -0
- package/dist/types/contract.d.ts +35 -0
- package/dist/types/parts/table-body.vue.d.ts +4 -3
- package/dist/types/resize/measure-widths.d.ts +10 -1
- package/dist/types/virtual/use-row-window.d.ts +14 -1
- package/package.json +3 -3
package/dist/query-table.js
CHANGED
|
@@ -726,7 +726,13 @@ var useCellView = (options) => {
|
|
|
726
726
|
//#region src/parts/table-body.vue?vue&type=script&setup=true&lang.ts
|
|
727
727
|
var _hoisted_1$9 = ["role"];
|
|
728
728
|
var _hoisted_2$5 = ["role"];
|
|
729
|
-
var _hoisted_3$5 = [
|
|
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 = [
|
|
730
736
|
"role",
|
|
731
737
|
"data-row-index",
|
|
732
738
|
"aria-rowindex",
|
|
@@ -738,13 +744,13 @@ var _hoisted_3$5 = [
|
|
|
738
744
|
"onVnodeBeforeMount",
|
|
739
745
|
"onVnodeUpdated"
|
|
740
746
|
];
|
|
741
|
-
var
|
|
742
|
-
var
|
|
747
|
+
var _hoisted_6$2 = ["aria-label", "onClick"];
|
|
748
|
+
var _hoisted_7$2 = [
|
|
743
749
|
"aria-expanded",
|
|
744
750
|
"aria-label",
|
|
745
751
|
"onClick"
|
|
746
752
|
];
|
|
747
|
-
var
|
|
753
|
+
var _hoisted_8$2 = {
|
|
748
754
|
width: "14",
|
|
749
755
|
height: "14",
|
|
750
756
|
viewBox: "0 0 24 24",
|
|
@@ -755,29 +761,29 @@ var _hoisted_6$2 = {
|
|
|
755
761
|
"stroke-linejoin": "round",
|
|
756
762
|
"aria-hidden": "true"
|
|
757
763
|
};
|
|
758
|
-
var
|
|
764
|
+
var _hoisted_9$1 = {
|
|
759
765
|
key: 0,
|
|
760
766
|
points: "6 9 12 15 18 9"
|
|
761
767
|
};
|
|
762
|
-
var
|
|
768
|
+
var _hoisted_10 = {
|
|
763
769
|
key: 1,
|
|
764
770
|
points: "9 6 15 12 9 18"
|
|
765
771
|
};
|
|
766
|
-
var
|
|
772
|
+
var _hoisted_11 = [
|
|
767
773
|
"aria-label",
|
|
768
774
|
"checked",
|
|
769
775
|
"onChange"
|
|
770
776
|
];
|
|
771
|
-
var
|
|
772
|
-
var
|
|
773
|
-
var
|
|
777
|
+
var _hoisted_12 = ["role", "data-flash"];
|
|
778
|
+
var _hoisted_13 = ["role", "data-flash"];
|
|
779
|
+
var _hoisted_14 = [
|
|
774
780
|
"role",
|
|
775
781
|
"aria-rowindex",
|
|
776
782
|
"data-pinned-row"
|
|
777
783
|
];
|
|
778
|
-
var _hoisted_13 = ["role"];
|
|
779
|
-
var _hoisted_14 = ["role"];
|
|
780
784
|
var _hoisted_15 = ["role"];
|
|
785
|
+
var _hoisted_16 = ["role"];
|
|
786
|
+
var _hoisted_17 = ["role"];
|
|
781
787
|
//#endregion
|
|
782
788
|
//#region src/parts/table-body.vue
|
|
783
789
|
var table_body_default = /* @__PURE__ */ defineComponent({
|
|
@@ -838,6 +844,11 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
838
844
|
const expandAttrs = () => utilityAttrs("subtable");
|
|
839
845
|
const selectAttrs = () => utilityAttrs("select");
|
|
840
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;
|
|
841
852
|
/** `data-row-kind` of a drawn row (C-97): no attribute for an empty kind. */
|
|
842
853
|
const kindOf = (item) => props.rowKind ? props.rowKind(item.row, item.index) || void 0 : void 0;
|
|
843
854
|
/** `aria-rowindex` of the subtable row under a drawn row (C-86). */
|
|
@@ -847,11 +858,11 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
847
858
|
expandedSnapshot = null;
|
|
848
859
|
});
|
|
849
860
|
const isRowExpanded = (item) => {
|
|
850
|
-
if (
|
|
861
|
+
if (!isRow(item)) return false;
|
|
851
862
|
if (!expandedSnapshot) {
|
|
852
863
|
const open = /* @__PURE__ */ new Map();
|
|
853
864
|
if (props.hasSubtable) {
|
|
854
|
-
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));
|
|
855
866
|
}
|
|
856
867
|
expandedSnapshot = open;
|
|
857
868
|
}
|
|
@@ -863,14 +874,29 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
863
874
|
onContextmenu: _cache[0] || (_cache[0] = (...args) => unref(onContextMenu) && unref(onContextMenu)(...args))
|
|
864
875
|
}, [
|
|
865
876
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.bodyRows, (item) => {
|
|
866
|
-
return openBlock(), createElementBlock(Fragment, { key:
|
|
877
|
+
return openBlock(), createElementBlock(Fragment, { key: itemKey(item) }, [isSpacer(item) ? (openBlock(), createElementBlock("tr", {
|
|
867
878
|
key: 0,
|
|
868
879
|
class: "qt-virtual-spacer",
|
|
869
880
|
"aria-hidden": "true",
|
|
870
881
|
role: rowRole(),
|
|
871
882
|
style: normalizeStyle({ height: `${item.spacer}px` })
|
|
872
|
-
}, [createElementVNode("td", mergeProps({ ref_for: true }, spanAttrs()), null, 16)], 12, _hoisted_2$5)) : (openBlock(), createElementBlock("tr", {
|
|
883
|
+
}, [createElementVNode("td", mergeProps({ ref_for: true }, spanAttrs()), null, 16)], 12, _hoisted_2$5)) : isGroup(item) ? (openBlock(), createElementBlock("tr", {
|
|
873
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,
|
|
874
900
|
role: rowRole(),
|
|
875
901
|
"data-row-index": item.index,
|
|
876
902
|
"aria-rowindex": item.aria,
|
|
@@ -909,7 +935,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
909
935
|
y1: "12",
|
|
910
936
|
x2: "19",
|
|
911
937
|
y2: "12"
|
|
912
|
-
})], -1)])], 8,
|
|
938
|
+
})], -1)])], 8, _hoisted_6$2)], 16)) : createCommentVNode("", true),
|
|
913
939
|
__props.hasSubtable ? (openBlock(), createElementBlock("td", mergeProps({
|
|
914
940
|
key: 1,
|
|
915
941
|
ref_for: true
|
|
@@ -920,7 +946,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
920
946
|
"aria-expanded": isRowExpanded(item),
|
|
921
947
|
"aria-label": __props.labels.expandRow,
|
|
922
948
|
onClick: ($event) => __props.toggle(item.row, item.index)
|
|
923
|
-
}, [(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),
|
|
924
950
|
__props.hasSelection ? (openBlock(), createElementBlock("td", mergeProps({
|
|
925
951
|
key: 2,
|
|
926
952
|
ref_for: true
|
|
@@ -930,18 +956,18 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
930
956
|
"aria-label": __props.labels.selectRow,
|
|
931
957
|
checked: __props.isSelected(item.row, item.index),
|
|
932
958
|
onChange: ($event) => __props.toggleSelected(item.row, item.index)
|
|
933
|
-
}, null, 40,
|
|
959
|
+
}, null, 40, _hoisted_11)], 16)) : createCommentVNode("", true),
|
|
934
960
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.entries, (entry) => {
|
|
935
961
|
return openBlock(), createElementBlock(Fragment, { key: entry.column.field }, [unref(hasCellSlot)(entry.column) ? (openBlock(), createElementBlock("td", mergeProps({
|
|
936
962
|
key: 0,
|
|
937
963
|
role: cellRole()
|
|
938
|
-
}, { 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,
|
|
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({
|
|
939
965
|
key: 1,
|
|
940
966
|
role: cellRole()
|
|
941
|
-
}, { 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,
|
|
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);
|
|
942
968
|
}), 128))
|
|
943
|
-
], 8,
|
|
944
|
-
key:
|
|
969
|
+
], 8, _hoisted_5$2)), isRow(item) && isRowExpanded(item) ? (openBlock(), createElementBlock("tr", {
|
|
970
|
+
key: 3,
|
|
945
971
|
class: "qt-subtable-row",
|
|
946
972
|
role: rowRole(),
|
|
947
973
|
"aria-rowindex": nextIndex(item.aria),
|
|
@@ -949,22 +975,22 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
949
975
|
}, [createElementVNode("td", mergeProps({ ref_for: true }, spanAttrs()), [renderSlot(_ctx.$slots, "subtable", {
|
|
950
976
|
row: item.row,
|
|
951
977
|
rowIndex: item.index
|
|
952
|
-
})], 16)], 8,
|
|
978
|
+
})], 16)], 8, _hoisted_14)) : createCommentVNode("", true)], 64);
|
|
953
979
|
}), 128)),
|
|
954
980
|
__props.loading && slots.loading ? (openBlock(), createElementBlock("tr", {
|
|
955
981
|
key: 0,
|
|
956
982
|
class: "qt-loading-row",
|
|
957
983
|
role: rowRole()
|
|
958
|
-
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "loading")], 16)], 8,
|
|
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", {
|
|
959
985
|
key: 1,
|
|
960
986
|
class: "qt-empty-row",
|
|
961
987
|
role: rowRole()
|
|
962
|
-
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "empty")], 16)], 8,
|
|
988
|
+
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "empty")], 16)], 8, _hoisted_16)) : createCommentVNode("", true),
|
|
963
989
|
!__props.loading && __props.rows.length > 0 && __props.loadMore && slots["load-more"] ? (openBlock(), createElementBlock("tr", {
|
|
964
990
|
key: 2,
|
|
965
991
|
class: "qt-load-more-row",
|
|
966
992
|
role: rowRole()
|
|
967
|
-
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "load-more", normalizeProps(guardReactiveProps(__props.loadMore)))], 16)], 8,
|
|
993
|
+
}, [createElementVNode("td", normalizeProps(guardReactiveProps(spanAttrs())), [renderSlot(_ctx.$slots, "load-more", normalizeProps(guardReactiveProps(__props.loadMore)))], 16)], 8, _hoisted_17)) : createCommentVNode("", true)
|
|
968
994
|
], 40, _hoisted_1$9);
|
|
969
995
|
};
|
|
970
996
|
}
|
|
@@ -1235,12 +1261,19 @@ var reorder_handle_default = /* @__PURE__ */ defineComponent({
|
|
|
1235
1261
|
* load-more). A subtable or a spanning cell would otherwise widen the
|
|
1236
1262
|
* columns it spans with content that is not theirs.
|
|
1237
1263
|
*/
|
|
1238
|
-
var
|
|
1239
|
-
":scope > thead > tr > th[data-field] > .qt-filter",
|
|
1264
|
+
var notCountedParts = [
|
|
1240
1265
|
":scope > thead > tr > th[data-field] > .qt-resize-handle",
|
|
1241
1266
|
":scope > tbody > tr:not([data-row-index])",
|
|
1242
1267
|
":scope > tfoot"
|
|
1243
|
-
]
|
|
1268
|
+
];
|
|
1269
|
+
var filterRow = ":scope > thead > tr > th[data-field] > .qt-filter";
|
|
1270
|
+
var notCounted = [filterRow, ...notCountedParts].join(", ");
|
|
1271
|
+
var notCountedWithFilters = notCountedParts.join(", ");
|
|
1272
|
+
/**
|
|
1273
|
+
* The room a text, number or date filter input keeps for its text when the
|
|
1274
|
+
* filter row counts (C-100): six characters of the input's own font.
|
|
1275
|
+
*/
|
|
1276
|
+
var filterText = "6ch";
|
|
1244
1277
|
/**
|
|
1245
1278
|
* Sets inline declarations for one read and puts every `style` attribute
|
|
1246
1279
|
* back exactly as it was, absent included, so the markup after the call is
|
|
@@ -1276,7 +1309,7 @@ var styleSwap = () => {
|
|
|
1276
1309
|
* (C-101): it is laid out the same way, its `col` widths left out, and a
|
|
1277
1310
|
* column takes the wider of its header cell and its body cells.
|
|
1278
1311
|
*/
|
|
1279
|
-
var measureColumnWidths = (table, fields, body) => {
|
|
1312
|
+
var measureColumnWidths = (table, fields, body, options = {}) => {
|
|
1280
1313
|
const widths = {};
|
|
1281
1314
|
if (!table?.tHead) return widths;
|
|
1282
1315
|
const wanted = fields ? new Set(fields) : null;
|
|
@@ -1287,7 +1320,8 @@ var measureColumnWidths = (table, fields, body) => {
|
|
|
1287
1320
|
swap.set(table, "width", "max-content");
|
|
1288
1321
|
swap.set(table, "min-width", "0");
|
|
1289
1322
|
for (const th of headers) swap.set(th, "width", "auto");
|
|
1290
|
-
for (const part of Array.from(table.querySelectorAll(notCounted))) swap.set(part, "display", "none");
|
|
1323
|
+
for (const part of Array.from(table.querySelectorAll(options.filters ? notCountedWithFilters : notCounted))) swap.set(part, "display", "none");
|
|
1324
|
+
if (options.filters) countFilters(table, swap);
|
|
1291
1325
|
const split = body && body !== table ? body : null;
|
|
1292
1326
|
if (split) {
|
|
1293
1327
|
swap.set(split, "table-layout", "auto");
|
|
@@ -1297,18 +1331,109 @@ var measureColumnWidths = (table, fields, body) => {
|
|
|
1297
1331
|
for (const part of Array.from(split.querySelectorAll(":scope > tbody > tr:not([data-row-index])"))) swap.set(part, "display", "none");
|
|
1298
1332
|
}
|
|
1299
1333
|
const firstRow = split?.querySelector(":scope > tbody > tr[data-row-index]");
|
|
1334
|
+
const measured = [];
|
|
1300
1335
|
for (const th of headers) {
|
|
1301
1336
|
const field = th.dataset.field;
|
|
1302
1337
|
if (field === void 0 || wanted && !wanted.has(field)) continue;
|
|
1338
|
+
const own = th.getBoundingClientRect().width;
|
|
1339
|
+
if (own === 0) continue;
|
|
1303
1340
|
const cell = firstRow?.querySelector(`:scope > td[data-field="${CSS.escape(field)}"]`);
|
|
1304
|
-
|
|
1305
|
-
|
|
1341
|
+
measured.push([
|
|
1342
|
+
field,
|
|
1343
|
+
th,
|
|
1344
|
+
Math.max(own, cell?.getBoundingClientRect().width ?? 0)
|
|
1345
|
+
]);
|
|
1306
1346
|
}
|
|
1347
|
+
const floors = options.filters ? filterFloors(measured.map(([, th]) => th), swap) : null;
|
|
1348
|
+
for (const [field, th, width] of measured) widths[field] = Math.ceil(Math.max(width, floors?.get(th) ?? 0));
|
|
1307
1349
|
} finally {
|
|
1308
1350
|
swap.restore();
|
|
1309
1351
|
}
|
|
1310
1352
|
return widths;
|
|
1311
1353
|
};
|
|
1354
|
+
/**
|
|
1355
|
+
* Takes the filter rows out of the read (C-100): out of the cell's flow
|
|
1356
|
+
* (`position: absolute`), so nothing in them widens the column by being
|
|
1357
|
+
* there, and no size container, which would switch the row to its narrow
|
|
1358
|
+
* form. Each control of the table stops growing and shrinking: a text or
|
|
1359
|
+
* number input six characters wide (padding and border on top), a select
|
|
1360
|
+
* and a date or time input as wide as they draw themselves, a filter button
|
|
1361
|
+
* at its own width, back in the row's flow when a skin's narrow form laid it
|
|
1362
|
+
* `absolute` over the input. A control `fixed` over the page (a panel)
|
|
1363
|
+
* stays out.
|
|
1364
|
+
*/
|
|
1365
|
+
var countFilters = (table, swap) => {
|
|
1366
|
+
const rows = Array.from(table.querySelectorAll(filterRow));
|
|
1367
|
+
for (const row of rows) {
|
|
1368
|
+
swap.set(row, "position", "absolute");
|
|
1369
|
+
swap.set(row, "container-type", "normal");
|
|
1370
|
+
swap.set(row, "contain", "none");
|
|
1371
|
+
swap.set(row, "box-sizing", "content-box");
|
|
1372
|
+
for (const input of Array.from(row.querySelectorAll(":scope > .qt-filter-input"))) {
|
|
1373
|
+
swap.set(input, "flex", "none");
|
|
1374
|
+
swap.set(input, "min-width", "0");
|
|
1375
|
+
if (input instanceof HTMLInputElement && textTypes.has(input.type)) {
|
|
1376
|
+
swap.set(input, "box-sizing", "content-box");
|
|
1377
|
+
swap.set(input, "width", filterText);
|
|
1378
|
+
} else swap.set(input, "width", "auto");
|
|
1379
|
+
}
|
|
1380
|
+
for (const button of Array.from(row.querySelectorAll(":scope > .qt-filter-button"))) swap.set(button, "flex", "none");
|
|
1381
|
+
}
|
|
1382
|
+
for (const row of rows) for (const button of Array.from(row.querySelectorAll(":scope > .qt-filter-button"))) if (getComputedStyle(button).position === "absolute") swap.set(button, "position", "static");
|
|
1383
|
+
};
|
|
1384
|
+
/** The inputs that keep six characters of text; the others draw their own. */
|
|
1385
|
+
var textTypes = /* @__PURE__ */ new Set([
|
|
1386
|
+
"text",
|
|
1387
|
+
"number",
|
|
1388
|
+
"search"
|
|
1389
|
+
]);
|
|
1390
|
+
var horizontal = (style) => (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0) + (parseFloat(style.borderLeftWidth) || 0) + (parseFloat(style.borderRightWidth) || 0);
|
|
1391
|
+
/** The table's own filter controls, the row's children, that take room. */
|
|
1392
|
+
var controlsOf = (row) => Array.from(row.querySelectorAll(":scope > :is(.qt-filter-input, .qt-filter-button)")).filter((control) => {
|
|
1393
|
+
const { position } = getComputedStyle(control);
|
|
1394
|
+
return position !== "fixed" && position !== "absolute";
|
|
1395
|
+
});
|
|
1396
|
+
/** The row's content width the probes draw it at: `0` and this. */
|
|
1397
|
+
var probe = 1e3;
|
|
1398
|
+
/**
|
|
1399
|
+
* The width each header cell needs for its filter controls, from the
|
|
1400
|
+
* controls alone: the row's width is never read, so slot content in it
|
|
1401
|
+
* cannot count, by its own width or by a width it took from the column. The
|
|
1402
|
+
* controls are drawn side by side in rows `0` and `probe` pixels wide, and
|
|
1403
|
+
* each width (a control, the gap) is taken as a fixed part plus a share of
|
|
1404
|
+
* the row, which is what a percentage padding is. The row then needs `R`
|
|
1405
|
+
* with `R = fixed + share * R`, the cell `R` plus the row's and the cell's
|
|
1406
|
+
* padding and border.
|
|
1407
|
+
*/
|
|
1408
|
+
var filterFloors = (headers, swap) => {
|
|
1409
|
+
const rows = headers.flatMap((th) => {
|
|
1410
|
+
const row = th.querySelector(":scope > .qt-filter");
|
|
1411
|
+
const controls = row ? controlsOf(row) : [];
|
|
1412
|
+
return row && controls.length > 0 ? [{
|
|
1413
|
+
th,
|
|
1414
|
+
row,
|
|
1415
|
+
controls
|
|
1416
|
+
}] : [];
|
|
1417
|
+
});
|
|
1418
|
+
const read = (width) => {
|
|
1419
|
+
for (const { row } of rows) swap.set(row, "width", `${width}px`);
|
|
1420
|
+
return rows.map(({ row, controls }) => {
|
|
1421
|
+
const drawn = controls.map((control) => control.getBoundingClientRect().width).filter((each) => each > 0);
|
|
1422
|
+
const gap = parseFloat(getComputedStyle(row).columnGap) || 0;
|
|
1423
|
+
return drawn.length === 0 ? 0 : drawn.reduce((sum, each) => sum + each, 0) + gap * (drawn.length - 1);
|
|
1424
|
+
});
|
|
1425
|
+
};
|
|
1426
|
+
const atZero = read(0);
|
|
1427
|
+
const atProbe = read(probe);
|
|
1428
|
+
const floors = /* @__PURE__ */ new Map();
|
|
1429
|
+
rows.forEach(({ th, row }, index) => {
|
|
1430
|
+
const fixed = atZero[index];
|
|
1431
|
+
if (fixed === 0) return;
|
|
1432
|
+
const share = Math.min(.9, Math.max(0, (atProbe[index] - fixed) / probe));
|
|
1433
|
+
floors.set(th, fixed / (1 - share) + horizontal(getComputedStyle(row)) + horizontal(getComputedStyle(th)));
|
|
1434
|
+
});
|
|
1435
|
+
return floors;
|
|
1436
|
+
};
|
|
1312
1437
|
//#endregion
|
|
1313
1438
|
//#region src/resize/width-scale.ts
|
|
1314
1439
|
var same = (width) => width;
|
|
@@ -1497,7 +1622,7 @@ var useColumnResize = (options) => {
|
|
|
1497
1622
|
const scale = scaleOf(th, column);
|
|
1498
1623
|
const from = scale.declared(drawn);
|
|
1499
1624
|
const step = scale.declared(Math.round(drawn) + sign * (event.shiftKey ? 50 : 10));
|
|
1500
|
-
const to = sign ? from + sign * Math.max(1, Math.abs(step - from)) : measureColumnWidths(th.closest("table"), [column.field], options.body())[column.field];
|
|
1625
|
+
const to = sign ? from + sign * Math.max(1, Math.abs(step - from)) : measureColumnWidths(th.closest("table"), [column.field], options.body(), { filters: true })[column.field];
|
|
1501
1626
|
if (to !== void 0) commit(column, from, to);
|
|
1502
1627
|
}
|
|
1503
1628
|
};
|
|
@@ -2139,7 +2264,7 @@ var useAutoWidth = (options) => {
|
|
|
2139
2264
|
result = cloneQuery(query);
|
|
2140
2265
|
}
|
|
2141
2266
|
if (options.rows().length === 0) return;
|
|
2142
|
-
const measured = measureColumnWidths(table, columns.map((column) => column.field), options.body());
|
|
2267
|
+
const measured = measureColumnWidths(table, columns.map((column) => column.field), options.body(), { filters: true });
|
|
2143
2268
|
if (Object.keys(measured).length === 0) {
|
|
2144
2269
|
waiting = true;
|
|
2145
2270
|
return;
|
|
@@ -2823,6 +2948,52 @@ var useLoadMore = (o) => {
|
|
|
2823
2948
|
};
|
|
2824
2949
|
};
|
|
2825
2950
|
//#endregion
|
|
2951
|
+
//#region src/body/group-runs.ts
|
|
2952
|
+
/** The runs as a string (start and count of each), or `null` without groups. */
|
|
2953
|
+
var groupShape = (groups) => groups ? groups.runs.map((run) => `${run.start}:${run.count}`).join(",") : null;
|
|
2954
|
+
/**
|
|
2955
|
+
* Splits `rows` into runs of consecutive rows with the same `groupBy` key
|
|
2956
|
+
* (C-103). The rows are not reordered: a key that comes back after another
|
|
2957
|
+
* starts a new run. `null` and `undefined` mean no group.
|
|
2958
|
+
*/
|
|
2959
|
+
var groupRuns = (rows, groupBy) => {
|
|
2960
|
+
const runs = [];
|
|
2961
|
+
const groupOf = new Int32Array(rows.length);
|
|
2962
|
+
const headersThrough = new Int32Array(rows.length);
|
|
2963
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2964
|
+
let current = null;
|
|
2965
|
+
for (let p = 0; p < rows.length; p++) {
|
|
2966
|
+
const { row, index } = rows[p];
|
|
2967
|
+
const key = groupBy(row, index);
|
|
2968
|
+
if (key === null || key === void 0 || Number.isNaN(key)) {
|
|
2969
|
+
current = null;
|
|
2970
|
+
groupOf[p] = -1;
|
|
2971
|
+
} else if (current && current.key === key) {
|
|
2972
|
+
current.count++;
|
|
2973
|
+
groupOf[p] = runs.length - 1;
|
|
2974
|
+
} else {
|
|
2975
|
+
const nth = seen.get(key) ?? 0;
|
|
2976
|
+
seen.set(key, nth + 1);
|
|
2977
|
+
current = {
|
|
2978
|
+
key,
|
|
2979
|
+
count: 1,
|
|
2980
|
+
row,
|
|
2981
|
+
index,
|
|
2982
|
+
start: p,
|
|
2983
|
+
id: `${typeof key}:${String(key)}#${nth}`
|
|
2984
|
+
};
|
|
2985
|
+
runs.push(current);
|
|
2986
|
+
groupOf[p] = runs.length - 1;
|
|
2987
|
+
}
|
|
2988
|
+
headersThrough[p] = runs.length;
|
|
2989
|
+
}
|
|
2990
|
+
return {
|
|
2991
|
+
runs,
|
|
2992
|
+
groupOf,
|
|
2993
|
+
headersThrough
|
|
2994
|
+
};
|
|
2995
|
+
};
|
|
2996
|
+
//#endregion
|
|
2826
2997
|
//#region src/virtual/compute-window.ts
|
|
2827
2998
|
/**
|
|
2828
2999
|
* Fills `offsets` from `heights`, starting at position `from` (the offsets
|
|
@@ -2931,7 +3102,7 @@ var useRowWindow = (o) => {
|
|
|
2931
3102
|
const settings = computed((previous) => {
|
|
2932
3103
|
const value = o.virtual();
|
|
2933
3104
|
const next = value === true ? {} : value || null;
|
|
2934
|
-
return previous && next && previous.overscan === next.overscan && previous.rowHeight === next.rowHeight && previous.estimateRowHeight === next.estimateRowHeight && previous.scrollElement === next.scrollElement ? previous : next;
|
|
3105
|
+
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;
|
|
2935
3106
|
});
|
|
2936
3107
|
const enabled = () => settings.value !== null;
|
|
2937
3108
|
const overscan = () => Math.max(0, settings.value?.overscan ?? 10);
|
|
@@ -2950,6 +3121,44 @@ var useRowWindow = (o) => {
|
|
|
2950
3121
|
};
|
|
2951
3122
|
});
|
|
2952
3123
|
const center = () => parts.value.center;
|
|
3124
|
+
/** The groups of the center rows (C-103), or `null` without `groupBy`. */
|
|
3125
|
+
const groups = computed(() => {
|
|
3126
|
+
const groupBy = o.groupBy?.();
|
|
3127
|
+
return groupBy ? groupRuns(center(), groupBy) : null;
|
|
3128
|
+
});
|
|
3129
|
+
/** The center position starts a group: its group row is drawn above it. */
|
|
3130
|
+
const startsGroup = (position) => {
|
|
3131
|
+
const g = groups.value;
|
|
3132
|
+
if (!g) return false;
|
|
3133
|
+
const at = g.groupOf[position];
|
|
3134
|
+
return at >= 0 && g.runs[at].start === position;
|
|
3135
|
+
};
|
|
3136
|
+
let groupKeys = /* @__PURE__ */ new Map();
|
|
3137
|
+
watch(groups, (g) => {
|
|
3138
|
+
if (!g) {
|
|
3139
|
+
groupKeys = /* @__PURE__ */ new Map();
|
|
3140
|
+
return;
|
|
3141
|
+
}
|
|
3142
|
+
const kept = /* @__PURE__ */ new Map();
|
|
3143
|
+
for (const run of g.runs) {
|
|
3144
|
+
const known = groupKeys.get(run.id);
|
|
3145
|
+
if (known) kept.set(run.id, known);
|
|
3146
|
+
}
|
|
3147
|
+
groupKeys = kept;
|
|
3148
|
+
});
|
|
3149
|
+
const groupKey = (id) => {
|
|
3150
|
+
let key = groupKeys.get(id);
|
|
3151
|
+
if (!key) {
|
|
3152
|
+
key = Symbol(id);
|
|
3153
|
+
groupKeys.set(id, key);
|
|
3154
|
+
}
|
|
3155
|
+
return key;
|
|
3156
|
+
};
|
|
3157
|
+
const groupRowOf = (run, aria) => ({
|
|
3158
|
+
group: run,
|
|
3159
|
+
key: groupKey(run.id),
|
|
3160
|
+
aria
|
|
3161
|
+
});
|
|
2953
3162
|
/** Position of a row index among the center rows (ascending), or -1. */
|
|
2954
3163
|
const positionOf = (index) => {
|
|
2955
3164
|
const rows = center();
|
|
@@ -2966,7 +3175,11 @@ var useRowWindow = (o) => {
|
|
|
2966
3175
|
return -1;
|
|
2967
3176
|
};
|
|
2968
3177
|
let heights = /* @__PURE__ */ new Float64Array(0);
|
|
3178
|
+
/** Item heights without the group row above an item (C-104). */
|
|
3179
|
+
let base = /* @__PURE__ */ new Float64Array(0);
|
|
2969
3180
|
let measured = /* @__PURE__ */ new Uint8Array(0);
|
|
3181
|
+
/** The measured height of a group row, `0` until one is measured. */
|
|
3182
|
+
let groupMeasured = 0;
|
|
2970
3183
|
let offsets = /* @__PURE__ */ new Float64Array(1);
|
|
2971
3184
|
let byKey = /* @__PURE__ */ new Map();
|
|
2972
3185
|
/** The first measured height, the estimate when none is given. */
|
|
@@ -2974,25 +3187,34 @@ var useRowWindow = (o) => {
|
|
|
2974
3187
|
/** Bumped whenever `offsets` change, so the spacers are drawn again. */
|
|
2975
3188
|
const version = shallowRef(0);
|
|
2976
3189
|
const estimate = () => fixed() ?? settings.value?.estimateRowHeight ?? (firstMeasured || 32);
|
|
3190
|
+
/** Height counted for a group row (C-104). */
|
|
3191
|
+
const groupHeight = () => {
|
|
3192
|
+
const height = fixed();
|
|
3193
|
+
if (height !== void 0) return settings.value?.groupRowHeight ?? height;
|
|
3194
|
+
return groupMeasured || estimate();
|
|
3195
|
+
};
|
|
3196
|
+
/** An item's height: its row and, above it, its group row. */
|
|
3197
|
+
const withGroup = (position) => base[position] + (startsGroup(position) ? groupHeight() : 0);
|
|
2977
3198
|
const rebuild = () => {
|
|
2978
3199
|
const rows = enabled() ? center() : [];
|
|
2979
3200
|
const height = fixed();
|
|
2980
3201
|
heights = new Float64Array(rows.length);
|
|
3202
|
+
base = groups.value ? new Float64Array(rows.length) : heights;
|
|
2981
3203
|
measured = new Uint8Array(rows.length);
|
|
2982
3204
|
const kept = /* @__PURE__ */ new Map();
|
|
2983
3205
|
for (let i = 0; i < rows.length; i++) {
|
|
2984
|
-
if (height !== void 0)
|
|
2985
|
-
heights[i] = height;
|
|
2986
|
-
continue;
|
|
2987
|
-
}
|
|
2988
|
-
const key = o.keyOf(rows[i].row, rows[i].index);
|
|
2989
|
-
const known = byKey.get(key);
|
|
2990
|
-
if (known === void 0) heights[i] = estimate();
|
|
3206
|
+
if (height !== void 0) base[i] = height;
|
|
2991
3207
|
else {
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
3208
|
+
const key = o.keyOf(rows[i].row, rows[i].index);
|
|
3209
|
+
const known = byKey.get(key);
|
|
3210
|
+
if (known === void 0) base[i] = estimate();
|
|
3211
|
+
else {
|
|
3212
|
+
kept.set(key, known);
|
|
3213
|
+
base[i] = known;
|
|
3214
|
+
measured[i] = 1;
|
|
3215
|
+
}
|
|
2995
3216
|
}
|
|
3217
|
+
heights[i] = withGroup(i);
|
|
2996
3218
|
}
|
|
2997
3219
|
byKey = kept;
|
|
2998
3220
|
pending = null;
|
|
@@ -3017,6 +3239,14 @@ var useRowWindow = (o) => {
|
|
|
3017
3239
|
const rows = center();
|
|
3018
3240
|
let from = -1;
|
|
3019
3241
|
for (const tr of tbody.children) {
|
|
3242
|
+
if (groups.value && tr.classList.contains("qt-group-row")) {
|
|
3243
|
+
const height = tr.getBoundingClientRect().height;
|
|
3244
|
+
if (height > 0 && Math.abs(height - groupMeasured) > .5) {
|
|
3245
|
+
groupMeasured = height;
|
|
3246
|
+
from = 0;
|
|
3247
|
+
}
|
|
3248
|
+
continue;
|
|
3249
|
+
}
|
|
3020
3250
|
const at = tr.getAttribute("data-row-index");
|
|
3021
3251
|
if (at === null || tr.hasAttribute("data-pinned-row")) continue;
|
|
3022
3252
|
const position = positionOf(Number(at));
|
|
@@ -3024,17 +3254,18 @@ var useRowWindow = (o) => {
|
|
|
3024
3254
|
const height = itemHeight(tr);
|
|
3025
3255
|
if (!firstMeasured && height > 0 && settings.value?.estimateRowHeight === void 0) {
|
|
3026
3256
|
firstMeasured = height;
|
|
3027
|
-
for (let i = 0; i <
|
|
3257
|
+
for (let i = 0; i < base.length; i++) if (!measured[i]) base[i] = height;
|
|
3028
3258
|
from = 0;
|
|
3029
3259
|
}
|
|
3030
|
-
if (!measured[position] || Math.abs(
|
|
3031
|
-
|
|
3260
|
+
if (!measured[position] || Math.abs(base[position] - height) > .5) {
|
|
3261
|
+
base[position] = height;
|
|
3032
3262
|
measured[position] = 1;
|
|
3033
3263
|
byKey.set(o.keyOf(rows[position].row, rows[position].index), height);
|
|
3034
3264
|
from = from < 0 ? position : Math.min(from, position);
|
|
3035
3265
|
}
|
|
3036
3266
|
}
|
|
3037
3267
|
if (from >= 0) {
|
|
3268
|
+
for (let i = from; i < heights.length; i++) heights[i] = withGroup(i);
|
|
3038
3269
|
fillOffsets(heights, offsets, from);
|
|
3039
3270
|
version.value++;
|
|
3040
3271
|
return true;
|
|
@@ -3086,11 +3317,11 @@ var useRowWindow = (o) => {
|
|
|
3086
3317
|
});
|
|
3087
3318
|
};
|
|
3088
3319
|
/** How far to scroll to show an item at `top` (client) with `height`. */
|
|
3089
|
-
const alignDelta = (top, height, align) => {
|
|
3320
|
+
const alignDelta = (top, height, align, groupCover = 0) => {
|
|
3090
3321
|
const view = viewport();
|
|
3091
3322
|
const head = o.table.value?.tHead?.getBoundingClientRect();
|
|
3092
3323
|
const cover = head && head.top <= view.top + 1 && head.bottom > view.top ? head.bottom - view.top : 0;
|
|
3093
|
-
const viewTop = view.top + cover;
|
|
3324
|
+
const viewTop = view.top + cover + groupCover;
|
|
3094
3325
|
const viewBottom = view.top + view.height;
|
|
3095
3326
|
const bottom = top + height;
|
|
3096
3327
|
switch (align) {
|
|
@@ -3100,6 +3331,20 @@ var useRowWindow = (o) => {
|
|
|
3100
3331
|
default: return top < viewTop ? top - viewTop : bottom > viewBottom ? bottom - viewBottom : 0;
|
|
3101
3332
|
}
|
|
3102
3333
|
};
|
|
3334
|
+
/**
|
|
3335
|
+
* Height of a group row the consumer's CSS made sticky, which covers a
|
|
3336
|
+
* row aligned to the top of its group (C-104); `0` without one.
|
|
3337
|
+
*/
|
|
3338
|
+
const stickyGroupCover = (tbody) => {
|
|
3339
|
+
if (!groups.value) return 0;
|
|
3340
|
+
const cell = tbody.querySelector(":scope > tr.qt-group-row > th");
|
|
3341
|
+
return cell && getComputedStyle(cell).position === "sticky" ? cell.getBoundingClientRect().height : 0;
|
|
3342
|
+
};
|
|
3343
|
+
/** The sticky cover over a row: only a grouped row that does not start its group. */
|
|
3344
|
+
const coverOf = (position, tbody) => {
|
|
3345
|
+
const g = groups.value;
|
|
3346
|
+
return g && g.groupOf[position] >= 0 && !startsGroup(position) ? stickyGroupCover(tbody) : 0;
|
|
3347
|
+
};
|
|
3103
3348
|
/** After a render: correct the drift (C-84) or a `scrollToIndex` (C-87). */
|
|
3104
3349
|
const settle = () => {
|
|
3105
3350
|
const tbody = body();
|
|
@@ -3111,9 +3356,11 @@ var useRowWindow = (o) => {
|
|
|
3111
3356
|
if (pending) {
|
|
3112
3357
|
const tr = rowElement(tbody, pending.position);
|
|
3113
3358
|
if (tr) {
|
|
3114
|
-
const { align } = pending;
|
|
3359
|
+
const { align, position } = pending;
|
|
3115
3360
|
pending = null;
|
|
3116
|
-
|
|
3361
|
+
const above = startsGroup(position) ? tr.previousElementSibling : null;
|
|
3362
|
+
const head = above?.classList.contains("qt-group-row") ? above : null;
|
|
3363
|
+
scrollBy(alignDelta((head ?? tr).getBoundingClientRect().top, itemHeight(tr) + (head ? head.getBoundingClientRect().height : 0), align, head ? 0 : coverOf(position, tbody)));
|
|
3117
3364
|
return;
|
|
3118
3365
|
}
|
|
3119
3366
|
if (++pending.tries <= pendingFrames) {
|
|
@@ -3209,19 +3456,57 @@ var useRowWindow = (o) => {
|
|
|
3209
3456
|
for (let i = 0; i < all.length; i++) counts[i + 1] = counts[i] + (o.isExpanded(all[i].row, all[i].index) ? 1 : 0);
|
|
3210
3457
|
return counts;
|
|
3211
3458
|
});
|
|
3459
|
+
/** Group rows drawn up to and with the center position (C-104). */
|
|
3460
|
+
const groupsThrough = (position) => groups.value ? groups.value.headersThrough[position] : 0;
|
|
3461
|
+
const groupCount = () => groups.value?.runs.length ?? 0;
|
|
3212
3462
|
const drawn = computed(() => {
|
|
3213
3463
|
const { all, top } = parts.value;
|
|
3214
|
-
|
|
3464
|
+
const g = groups.value;
|
|
3465
|
+
if (!enabled()) {
|
|
3466
|
+
if (!g) return all;
|
|
3467
|
+
const out = [];
|
|
3468
|
+
for (let q = 0; q < all.length; q++) {
|
|
3469
|
+
const p = q - top;
|
|
3470
|
+
if (p >= 0 && p < g.groupOf.length && startsGroup(p)) out.push(groupRowOf(g.runs[g.groupOf[p]]));
|
|
3471
|
+
out.push(all[q]);
|
|
3472
|
+
}
|
|
3473
|
+
return out;
|
|
3474
|
+
}
|
|
3215
3475
|
version.value;
|
|
3216
3476
|
const rows = center();
|
|
3217
3477
|
const before = expandedBefore.value;
|
|
3478
|
+
const headersBefore = (q) => q < top ? 0 : q < top + rows.length ? groupsThrough(q - top) : groupCount();
|
|
3479
|
+
const ariaOf = (q) => q + before[q] + headersBefore(q) + 2;
|
|
3218
3480
|
const at = (q) => ({
|
|
3219
3481
|
...all[q],
|
|
3220
|
-
aria: q
|
|
3482
|
+
aria: ariaOf(q)
|
|
3221
3483
|
});
|
|
3222
3484
|
const out = [];
|
|
3485
|
+
/** The group whose row was drawn last, or -1. */
|
|
3486
|
+
let drawnGroup = -1;
|
|
3487
|
+
/** The center row at `p`, after its group row when it needs one. */
|
|
3488
|
+
const push = (p, carry) => {
|
|
3489
|
+
const group = g ? g.groupOf[p] : -1;
|
|
3490
|
+
if (g && group >= 0 && group !== drawnGroup) {
|
|
3491
|
+
const run = g.runs[group];
|
|
3492
|
+
if (run.start === p) out.push(groupRowOf(run, ariaOf(top + p) - 1));
|
|
3493
|
+
else if (carry) {
|
|
3494
|
+
const last = out[out.length - 1];
|
|
3495
|
+
if (last && "spacer" in last) {
|
|
3496
|
+
const height = Math.max(0, last.spacer - groupHeight());
|
|
3497
|
+
out[out.length - 1] = {
|
|
3498
|
+
spacer: height,
|
|
3499
|
+
key: last.key
|
|
3500
|
+
};
|
|
3501
|
+
}
|
|
3502
|
+
out.push(groupRowOf(run, ariaOf(top + run.start) - 1));
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
drawnGroup = group;
|
|
3506
|
+
out.push(at(top + p));
|
|
3507
|
+
};
|
|
3223
3508
|
for (let q = 0; q < top; q++) out.push(at(q));
|
|
3224
|
-
if (printing.value) for (let p = 0; p < rows.length; p++)
|
|
3509
|
+
if (printing.value) for (let p = 0; p < rows.length; p++) push(p, false);
|
|
3225
3510
|
else {
|
|
3226
3511
|
const end = Math.min(range.value.end, rows.length);
|
|
3227
3512
|
const win = {
|
|
@@ -3232,10 +3517,10 @@ var useRowWindow = (o) => {
|
|
|
3232
3517
|
spacer: segment.spacer,
|
|
3233
3518
|
key: spacerKeys[segment.slot]
|
|
3234
3519
|
});
|
|
3235
|
-
else for (let p = segment.from; p < segment.to; p++)
|
|
3520
|
+
else for (let p = segment.from; p < segment.to; p++) push(p, p === segment.from);
|
|
3236
3521
|
}
|
|
3237
3522
|
for (let q = top + rows.length; q < all.length; q++) out.push(at(q));
|
|
3238
|
-
return out;
|
|
3523
|
+
return g ? out.filter((item) => !("spacer" in item) || item.spacer > 0) : out;
|
|
3239
3524
|
});
|
|
3240
3525
|
let box = null;
|
|
3241
3526
|
let rowsObserver = null;
|
|
@@ -3328,6 +3613,8 @@ var useRowWindow = (o) => {
|
|
|
3328
3613
|
() => parts.value.center,
|
|
3329
3614
|
() => settings.value?.rowHeight,
|
|
3330
3615
|
() => settings.value?.estimateRowHeight,
|
|
3616
|
+
() => settings.value?.groupRowHeight,
|
|
3617
|
+
() => groupShape(groups.value),
|
|
3331
3618
|
enabled
|
|
3332
3619
|
], rebuild, { immediate: true });
|
|
3333
3620
|
watch([
|
|
@@ -3382,7 +3669,7 @@ var useRowWindow = (o) => {
|
|
|
3382
3669
|
align,
|
|
3383
3670
|
tries: 0
|
|
3384
3671
|
};
|
|
3385
|
-
scrollBy(alignDelta(itemsTop(tbody) + offsets[position], heights[position], align));
|
|
3672
|
+
scrollBy(alignDelta(itemsTop(tbody) + offsets[position], heights[position], align, coverOf(position, tbody)));
|
|
3386
3673
|
schedule();
|
|
3387
3674
|
};
|
|
3388
3675
|
return {
|
|
@@ -3392,6 +3679,8 @@ var useRowWindow = (o) => {
|
|
|
3392
3679
|
ready,
|
|
3393
3680
|
centerCount: () => center().length,
|
|
3394
3681
|
expandedCount: () => expandedBefore.value[expandedBefore.value.length - 1],
|
|
3682
|
+
/** Group rows of the body, drawn or not (C-104). */
|
|
3683
|
+
groupCount,
|
|
3395
3684
|
scrollToIndex,
|
|
3396
3685
|
onFocusIn,
|
|
3397
3686
|
onFocusOut
|
|
@@ -3464,6 +3753,10 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3464
3753
|
type: Function,
|
|
3465
3754
|
default: void 0
|
|
3466
3755
|
},
|
|
3756
|
+
groupBy: {
|
|
3757
|
+
type: Function,
|
|
3758
|
+
default: void 0
|
|
3759
|
+
},
|
|
3467
3760
|
hasRightPanel: {
|
|
3468
3761
|
type: Boolean,
|
|
3469
3762
|
default: false
|
|
@@ -3616,7 +3909,8 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3616
3909
|
table: bodyTable,
|
|
3617
3910
|
bodyRows: () => state.rowPinning.rows.value,
|
|
3618
3911
|
keyOf: expansion.keyOf,
|
|
3619
|
-
isExpanded: expansion.isExpanded
|
|
3912
|
+
isExpanded: expansion.isExpanded,
|
|
3913
|
+
groupBy: () => props.groupBy
|
|
3620
3914
|
});
|
|
3621
3915
|
const infinite = useLoadMore({
|
|
3622
3916
|
infinite: () => props.infinite,
|
|
@@ -3645,11 +3939,11 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3645
3939
|
const ariaRowCount = computed(() => {
|
|
3646
3940
|
if (!rowWindow.enabled()) return;
|
|
3647
3941
|
const total = props.totalRows;
|
|
3648
|
-
if (growing() && total === null) return -1;
|
|
3649
|
-
return 1 + (growing() && total !== null ? total : props.rows.length) + rowWindow.expandedCount() + footerCount.value;
|
|
3942
|
+
if (growing() && (total === null || rowWindow.groupCount() > 0)) return -1;
|
|
3943
|
+
return 1 + (growing() && total !== null ? total : props.rows.length) + rowWindow.expandedCount() + rowWindow.groupCount() + footerCount.value;
|
|
3650
3944
|
});
|
|
3651
3945
|
/** `aria-rowindex` of the first footer row, or `undefined` (C-86). */
|
|
3652
|
-
const footerRowIndex = computed(() => !rowWindow.enabled() || growing() ? void 0 : 2 + props.rows.length + rowWindow.expandedCount());
|
|
3946
|
+
const footerRowIndex = computed(() => !rowWindow.enabled() || growing() ? void 0 : 2 + props.rows.length + rowWindow.expandedCount() + rowWindow.groupCount());
|
|
3653
3947
|
const flashView = useChangeFlash({
|
|
3654
3948
|
flash: () => props.flash,
|
|
3655
3949
|
rowsUpdate: () => props.rowsUpdate,
|
|
@@ -3688,7 +3982,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
3688
3982
|
search.apply();
|
|
3689
3983
|
}
|
|
3690
3984
|
});
|
|
3691
|
-
const bodySlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("cell-") || name === "subtable" || name === "empty" || name === "loading" || name === "load-more");
|
|
3985
|
+
const bodySlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("cell-") || name === "subtable" || name === "empty" || name === "loading" || name === "load-more" || name === "group");
|
|
3692
3986
|
const headerSlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("header-") || name === "filter-datetime" || name === "filter-menu").sort().join(" ");
|
|
3693
3987
|
__expose({
|
|
3694
3988
|
collapseAll: expansion.collapseAll,
|