@dolusoft/query-table 3.20.0 → 3.21.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/cells.js +42 -57
- package/dist/cells.js.map +1 -1
- package/dist/data-table.js +2 -1
- package/dist/data-table.js.map +1 -1
- package/dist/query-table.js +1 -1
- package/dist/{src-Cam4kRTd.js → src-DvUx4ur-.js} +454 -75
- package/dist/src-DvUx4ur-.js.map +1 -0
- package/dist/table-labels-DYrDE2Sq.js +58 -0
- package/dist/table-labels-DYrDE2Sq.js.map +1 -0
- package/dist/types/contract.d.ts +48 -0
- package/dist/types/core/table-context.d.ts +19 -3
- package/dist/types/core/table-labels.d.ts +13 -2
- package/dist/types/parts/table-body.vue.d.ts +2 -0
- package/dist/types/parts/table-row.d.ts +17 -1
- package/dist/types/resize/grow-shares.d.ts +29 -0
- package/dist/types/resize/use-column-resize.d.ts +7 -0
- package/dist/types/resize/use-growing-columns.d.ts +37 -0
- package/dist/types/use-query-table.d.ts +23 -3
- package/package.json +3 -3
- package/dist/src-Cam4kRTd.js.map +0 -1
- package/dist/table-context-Duuqp9Jq.js +0 -28
- package/dist/table-context-Duuqp9Jq.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots,
|
|
1
|
+
import { a as cellLabelDefaults, i as useTableContext, r as provideTableContext, t as IconSlot } from "./table-labels-DYrDE2Sq.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, effectScope, getCurrentInstance, getCurrentScope, guardReactiveProps, h, mergeProps, nextTick, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onBeforeUpdate, onDeactivated, onMounted, onScopeDispose, openBlock, renderList, renderSlot, shallowRef, toDisplayString, toHandlers, toValue, unref, useSlots, watch, watchEffect, withCtx, withKeys, withModifiers } from "vue";
|
|
3
3
|
import { cloneQuery, columnTypeOf, columnTypeOf as columnTypeOf$1, conditionArity, conditionLabel, conditionOptions, isCursorQuery, parseFilterInput, rulesOf, sameQuery, searchOf } from "@dolusoft/query-protocol";
|
|
4
4
|
import { createRowChangeTracker } from "@dolusoft/query-table-core/row-changes";
|
|
5
5
|
import { dispose, filterInputFeature, projectServerQuery, serverQueryFeature } from "@dolusoft/query-table-core";
|
|
@@ -940,6 +940,7 @@ var expandDynamic = [
|
|
|
940
940
|
var selectDynamic = [
|
|
941
941
|
"aria-label",
|
|
942
942
|
"checked",
|
|
943
|
+
"disabled",
|
|
943
944
|
"onChange"
|
|
944
945
|
];
|
|
945
946
|
/** Text of a cell, whole: the table never cuts it. */
|
|
@@ -971,6 +972,8 @@ var tableRow = defineComponent({
|
|
|
971
972
|
/** `data-row-kind` (C-97); `undefined` for none. */
|
|
972
973
|
kind: value(),
|
|
973
974
|
selected: needed(),
|
|
975
|
+
/** The checkbox can be used; `disabled` otherwise (C-130). */
|
|
976
|
+
selectable: needed(),
|
|
974
977
|
expanded: needed(),
|
|
975
978
|
/** An expand button is drawn (C-98). */
|
|
976
979
|
expandable: needed(),
|
|
@@ -1017,25 +1020,26 @@ var tableRow = defineComponent({
|
|
|
1017
1020
|
onVnodeBeforeMount: props.flashBind ? bind : void 0,
|
|
1018
1021
|
onVnodeUpdated: props.flashBind ? bind : void 0
|
|
1019
1022
|
}, [
|
|
1020
|
-
utilities.panel ? (openBlock(), createElementBlock("td", mergeProps({ key: 0 }, utilities.panel), [createElementVNode("button", {
|
|
1023
|
+
utilities.panel ? (openBlock(), createElementBlock("td", mergeProps({ key: utilities.panelSlot ? 3 : 0 }, utilities.panel), [createElementVNode("button", {
|
|
1021
1024
|
type: "button",
|
|
1022
1025
|
class: "qt-right-panel-button",
|
|
1023
1026
|
"aria-label": props.labelPanel,
|
|
1024
1027
|
onClick: onPanel
|
|
1025
|
-
}, [...panelCache ??= [panelIcon()]], 8, panelDynamic)], 16)) : off(),
|
|
1026
|
-
utilities.expand ? (openBlock(), createElementBlock("td", mergeProps({ key: 1 }, utilities.expand), [props.expandable ? (openBlock(), createElementBlock("button", {
|
|
1028
|
+
}, utilities.panelSlot ? [renderSlot(utilities.iconSlots, "icon-right-panel")] : [...panelCache ??= [panelIcon()]], 8, panelDynamic)], 16)) : off(),
|
|
1029
|
+
utilities.expand ? (openBlock(), createElementBlock("td", mergeProps({ key: utilities.expandSlot ? 4 : 1 }, utilities.expand), [props.expandable ? (openBlock(), createElementBlock("button", {
|
|
1027
1030
|
key: 0,
|
|
1028
1031
|
type: "button",
|
|
1029
1032
|
class: "qt-expand",
|
|
1030
1033
|
"aria-expanded": props.expanded,
|
|
1031
1034
|
"aria-label": props.labelExpand,
|
|
1032
1035
|
onClick: onToggle
|
|
1033
|
-
}, [(openBlock(), createElementBlock("svg", expandIcon, [props.expanded ? (openBlock(), createElementBlock("polyline", chevronDown)) : (openBlock(), createElementBlock("polyline", chevronRight))]))], 8, expandDynamic)) : off()], 16)) : off(),
|
|
1036
|
+
}, [utilities.expandSlot ? renderSlot(utilities.iconSlots, "icon-expand", { expanded: props.expanded }) : (openBlock(), createElementBlock("svg", expandIcon, [props.expanded ? (openBlock(), createElementBlock("polyline", chevronDown)) : (openBlock(), createElementBlock("polyline", chevronRight))]))], 8, expandDynamic)) : off()], 16)) : off(),
|
|
1034
1037
|
utilities.select ? (openBlock(), createElementBlock("td", mergeProps({ key: 2 }, utilities.select), [createElementVNode("input", {
|
|
1035
1038
|
type: "checkbox",
|
|
1036
1039
|
class: "qt-select-row",
|
|
1037
1040
|
"aria-label": props.labelSelect,
|
|
1038
1041
|
checked: props.selected,
|
|
1042
|
+
disabled: !props.selectable,
|
|
1039
1043
|
onChange: onSelect
|
|
1040
1044
|
}, null, 40, selectDynamic)], 16)) : off(),
|
|
1041
1045
|
(openBlock(true), createElementBlock(Fragment, null, renderList(cells, (cell) => (openBlock(), createElementBlock(Fragment, { key: cell.field }, [cell.slot ? (openBlock(), createElementBlock("td", mergeProps({ key: 0 }, cell.attrs, { "data-flash": cellFlash?.[cell.field] }), [renderSlot(slots, cell.slot, {
|
|
@@ -1103,6 +1107,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
1103
1107
|
hasRightPanel: { type: Boolean },
|
|
1104
1108
|
hasSelection: { type: Boolean },
|
|
1105
1109
|
isSelected: { type: Function },
|
|
1110
|
+
canSelect: { type: Function },
|
|
1106
1111
|
toggleSelected: { type: Function },
|
|
1107
1112
|
hasPinned: { type: Boolean },
|
|
1108
1113
|
offsets: {},
|
|
@@ -1175,15 +1180,18 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
1175
1180
|
});
|
|
1176
1181
|
return same && previous ? previous : next;
|
|
1177
1182
|
});
|
|
1183
|
+
const { icons } = useTableContext();
|
|
1178
1184
|
const utilities = computed((previous) => {
|
|
1179
1185
|
const role = cellRole();
|
|
1180
1186
|
const side = props.hasPinned ? "left" : false;
|
|
1181
1187
|
const offsetOf = (utility) => props.offsets[utilityKey(utility)];
|
|
1188
|
+
const panelSlot = props.hasRightPanel && icons.has("right-panel");
|
|
1189
|
+
const expandSlot = props.hasSubtable && icons.has("expand");
|
|
1182
1190
|
const signature = [
|
|
1183
1191
|
role,
|
|
1184
1192
|
side,
|
|
1185
|
-
props.hasRightPanel && `p${offsetOf("right-panel")}`,
|
|
1186
|
-
props.hasSubtable && `e${offsetOf("subtable")}`,
|
|
1193
|
+
props.hasRightPanel && `p${offsetOf("right-panel")}${panelSlot ? "i" : ""}`,
|
|
1194
|
+
props.hasSubtable && `e${offsetOf("subtable")}${expandSlot ? "i" : ""}`,
|
|
1187
1195
|
props.hasSelection && `s${offsetOf("select")}`
|
|
1188
1196
|
].join("|");
|
|
1189
1197
|
if (previous?.signature === signature) return previous;
|
|
@@ -1195,6 +1203,9 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
1195
1203
|
panel: attrs(props.hasRightPanel, "right-panel"),
|
|
1196
1204
|
expand: attrs(props.hasSubtable, "subtable"),
|
|
1197
1205
|
select: attrs(props.hasSelection, "select"),
|
|
1206
|
+
iconSlots: panelSlot || expandSlot ? icons.slots : null,
|
|
1207
|
+
panelSlot,
|
|
1208
|
+
expandSlot,
|
|
1198
1209
|
signature
|
|
1199
1210
|
};
|
|
1200
1211
|
});
|
|
@@ -1259,6 +1270,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
1259
1270
|
pinned: item.pinned,
|
|
1260
1271
|
kind: kindOf(item),
|
|
1261
1272
|
selected: __props.hasSelection && __props.isSelected(item.row, item.index),
|
|
1273
|
+
selectable: !__props.hasSelection || __props.canSelect(item.row, item.index),
|
|
1262
1274
|
expanded: isRowExpanded(item),
|
|
1263
1275
|
expandable: __props.hasSubtable && __props.canExpand(item.row, item.index),
|
|
1264
1276
|
flash: __props.flash ? __props.flash.of(__props.keyOf(item.row, item.index)) : void 0,
|
|
@@ -1282,6 +1294,7 @@ var table_body_default = /* @__PURE__ */ defineComponent({
|
|
|
1282
1294
|
"pinned",
|
|
1283
1295
|
"kind",
|
|
1284
1296
|
"selected",
|
|
1297
|
+
"selectable",
|
|
1285
1298
|
"expanded",
|
|
1286
1299
|
"expandable",
|
|
1287
1300
|
"flash",
|
|
@@ -1391,17 +1404,23 @@ var filter_icon_default = /* @__PURE__ */ defineComponent({
|
|
|
1391
1404
|
props: { filled: { type: Boolean } },
|
|
1392
1405
|
setup(__props) {
|
|
1393
1406
|
return (_ctx, _cache) => {
|
|
1394
|
-
return openBlock(),
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1407
|
+
return openBlock(), createBlock(unref(IconSlot), {
|
|
1408
|
+
name: "filter",
|
|
1409
|
+
state: { filled: __props.filled }
|
|
1410
|
+
}, {
|
|
1411
|
+
default: withCtx(() => [(openBlock(), createElementBlock("svg", {
|
|
1412
|
+
viewBox: "0 0 24 24",
|
|
1413
|
+
width: "14",
|
|
1414
|
+
height: "14",
|
|
1415
|
+
stroke: "currentColor",
|
|
1416
|
+
"stroke-width": "1.5",
|
|
1417
|
+
fill: __props.filled ? "currentColor" : "none",
|
|
1418
|
+
"stroke-linecap": "round",
|
|
1419
|
+
"stroke-linejoin": "round",
|
|
1420
|
+
"aria-hidden": "true"
|
|
1421
|
+
}, [..._cache[0] || (_cache[0] = [createElementVNode("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" }, null, -1)])], 8, _hoisted_1$7))]),
|
|
1422
|
+
_: 1
|
|
1423
|
+
}, 8, ["state"]);
|
|
1405
1424
|
};
|
|
1406
1425
|
}
|
|
1407
1426
|
});
|
|
@@ -1659,7 +1678,47 @@ var reorder_handle_default = /* @__PURE__ */ defineComponent({
|
|
|
1659
1678
|
class: "qt-reorder-handle",
|
|
1660
1679
|
"aria-label": unref(labels)().moveColumn(unref(columnName)(__props.column)),
|
|
1661
1680
|
"aria-keyshortcuts": "ArrowLeft ArrowRight Home End"
|
|
1662
|
-
}, toHandlers(unref(on), true)), [
|
|
1681
|
+
}, toHandlers(unref(on), true)), [createVNode(unref(IconSlot), { name: "reorder" }, {
|
|
1682
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
1683
|
+
width: "14",
|
|
1684
|
+
height: "14",
|
|
1685
|
+
viewBox: "0 0 24 24",
|
|
1686
|
+
fill: "currentColor",
|
|
1687
|
+
"aria-hidden": "true"
|
|
1688
|
+
}, [
|
|
1689
|
+
createElementVNode("circle", {
|
|
1690
|
+
cx: "9",
|
|
1691
|
+
cy: "6",
|
|
1692
|
+
r: "1.5"
|
|
1693
|
+
}),
|
|
1694
|
+
createElementVNode("circle", {
|
|
1695
|
+
cx: "15",
|
|
1696
|
+
cy: "6",
|
|
1697
|
+
r: "1.5"
|
|
1698
|
+
}),
|
|
1699
|
+
createElementVNode("circle", {
|
|
1700
|
+
cx: "9",
|
|
1701
|
+
cy: "12",
|
|
1702
|
+
r: "1.5"
|
|
1703
|
+
}),
|
|
1704
|
+
createElementVNode("circle", {
|
|
1705
|
+
cx: "15",
|
|
1706
|
+
cy: "12",
|
|
1707
|
+
r: "1.5"
|
|
1708
|
+
}),
|
|
1709
|
+
createElementVNode("circle", {
|
|
1710
|
+
cx: "9",
|
|
1711
|
+
cy: "18",
|
|
1712
|
+
r: "1.5"
|
|
1713
|
+
}),
|
|
1714
|
+
createElementVNode("circle", {
|
|
1715
|
+
cx: "15",
|
|
1716
|
+
cy: "18",
|
|
1717
|
+
r: "1.5"
|
|
1718
|
+
})
|
|
1719
|
+
], -1)])]),
|
|
1720
|
+
_: 1
|
|
1721
|
+
})], 16, _hoisted_1$5);
|
|
1663
1722
|
};
|
|
1664
1723
|
}
|
|
1665
1724
|
});
|
|
@@ -1937,11 +1996,6 @@ var cellOf = (event) => event.currentTarget.closest("th");
|
|
|
1937
1996
|
*/
|
|
1938
1997
|
var edgeOf = (column) => column.pinned === "right" ? -1 : 1;
|
|
1939
1998
|
/**
|
|
1940
|
-
* The scale of a column's widths, read from the layout once per drag or key:
|
|
1941
|
-
* a table stretched to its container draws a column wider than declared.
|
|
1942
|
-
*/
|
|
1943
|
-
var scaleOf = (th, column) => measureWidthScale(th, clampWidth(column, 0));
|
|
1944
|
-
/**
|
|
1945
1999
|
* Resizing a column (C-48 to C-50). The table holds a width only while a
|
|
1946
2000
|
* drag is under way (the preview, P2); every committed width goes out as a
|
|
1947
2001
|
* `columnResize` event and comes back, if the consumer wants it, as
|
|
@@ -1955,12 +2009,24 @@ var useColumnResize = (options) => {
|
|
|
1955
2009
|
const preview = shallowRef(null);
|
|
1956
2010
|
let drag = null;
|
|
1957
2011
|
const isResizable = (column) => options.resizable() && column.resizable !== false;
|
|
2012
|
+
/**
|
|
2013
|
+
* The scale of a column's widths, read from the layout once per drag or
|
|
2014
|
+
* key: a table stretched to its container draws a column wider than
|
|
2015
|
+
* declared. A table whose growing columns take the room is not stretched:
|
|
2016
|
+
* they take the difference instead (C-132).
|
|
2017
|
+
*/
|
|
2018
|
+
const scaleOf = (th, column) => options.growing?.() ? identityScale : measureWidthScale(th, clampWidth(column, 0));
|
|
1958
2019
|
/** The width the header shows: the preview while dragging, else measured. */
|
|
1959
2020
|
const widthOf = (column) => preview.value?.field === column.field ? preview.value.rendered : Math.round(options.measuredWidth(column.field) ?? 0);
|
|
1960
|
-
/**
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
2021
|
+
/** What a declared width `width` is emitted as (C-132, D-05). */
|
|
2022
|
+
const out = (column, width) => options.emitted ? options.emitted(column.field, width) : width;
|
|
2023
|
+
/**
|
|
2024
|
+
* Emits the declared width `width`, unless it is the declared `from`.
|
|
2025
|
+
* `fitted` is a width already emitted as it is: autofit's.
|
|
2026
|
+
*/
|
|
2027
|
+
const commit = (column, from, width, fitted = false) => {
|
|
2028
|
+
const next = clampWidth(column, fitted ? width : out(column, width));
|
|
2029
|
+
if (next !== Math.round(out(column, from))) options.emit({
|
|
1964
2030
|
field: column.field,
|
|
1965
2031
|
width: next
|
|
1966
2032
|
});
|
|
@@ -2034,7 +2100,7 @@ var useColumnResize = (options) => {
|
|
|
2034
2100
|
const from = scale.declared(drawn);
|
|
2035
2101
|
const step = scale.declared(Math.round(drawn) + sign * (event.shiftKey ? 50 : 10));
|
|
2036
2102
|
const to = sign ? from + sign * Math.max(1, Math.abs(step - from)) : measureColumnWidths(th.closest("table"), [column.field], options.body(), { filters: true })[column.field];
|
|
2037
|
-
if (to !== void 0) commit(column, from, to);
|
|
2103
|
+
if (to !== void 0) commit(column, from, to, !sign);
|
|
2038
2104
|
}
|
|
2039
2105
|
};
|
|
2040
2106
|
/**
|
|
@@ -2151,19 +2217,25 @@ var sort_button_default = /* @__PURE__ */ defineComponent({
|
|
|
2151
2217
|
class: "qt-sort",
|
|
2152
2218
|
"aria-label": __props.column.title ? void 0 : __props.column.field,
|
|
2153
2219
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click"))
|
|
2154
|
-
}, [createTextVNode(toDisplayString(__props.column.title) + " ", 1),
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
},
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2220
|
+
}, [createTextVNode(toDisplayString(__props.column.title) + " ", 1), createVNode(unref(IconSlot), {
|
|
2221
|
+
name: "sort",
|
|
2222
|
+
state: { direction: __props.direction ?? false }
|
|
2223
|
+
}, {
|
|
2224
|
+
default: withCtx(() => [__props.direction === "asc" ? (openBlock(), createElementBlock("svg", _hoisted_2$2, [..._cache[1] || (_cache[1] = [createElementVNode("path", {
|
|
2225
|
+
d: "M8 3.5L12.5 9.5H3.5L8 3.5Z",
|
|
2226
|
+
fill: "currentColor"
|
|
2227
|
+
}, null, -1)])])) : __props.direction === "desc" ? (openBlock(), createElementBlock("svg", _hoisted_3$2, [..._cache[2] || (_cache[2] = [createElementVNode("path", {
|
|
2228
|
+
d: "M8 12.5L3.5 6.5H12.5L8 12.5Z",
|
|
2229
|
+
fill: "currentColor"
|
|
2230
|
+
}, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_4$2, [..._cache[3] || (_cache[3] = [createElementVNode("path", {
|
|
2231
|
+
d: "M8 3L11.5 7H4.5L8 3Z",
|
|
2232
|
+
fill: "currentColor"
|
|
2233
|
+
}, null, -1), createElementVNode("path", {
|
|
2234
|
+
d: "M8 13L4.5 9H11.5L8 13Z",
|
|
2235
|
+
fill: "currentColor"
|
|
2236
|
+
}, null, -1)])]))]),
|
|
2237
|
+
_: 1
|
|
2238
|
+
}, 8, ["state"])], 8, _hoisted_1$3);
|
|
2167
2239
|
};
|
|
2168
2240
|
}
|
|
2169
2241
|
});
|
|
@@ -2178,7 +2250,8 @@ var _hoisted_2$1 = ["role"];
|
|
|
2178
2250
|
var _hoisted_3$1 = [
|
|
2179
2251
|
"aria-label",
|
|
2180
2252
|
"checked",
|
|
2181
|
-
"indeterminate"
|
|
2253
|
+
"indeterminate",
|
|
2254
|
+
"disabled"
|
|
2182
2255
|
];
|
|
2183
2256
|
var _hoisted_4$1 = ["role"];
|
|
2184
2257
|
var _hoisted_5$1 = ["role"];
|
|
@@ -2218,7 +2291,7 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
2218
2291
|
setup(__props) {
|
|
2219
2292
|
const props = __props;
|
|
2220
2293
|
const given = (name) => props.slotNames.split("\n").includes(name);
|
|
2221
|
-
const { filters, sort, layout, resize, reorder, selection, labels } = useTableContext();
|
|
2294
|
+
const { filters, sort, layout, resize, reorder, selection, labels, grow } = useTableContext();
|
|
2222
2295
|
const dragAttrs = (column) => {
|
|
2223
2296
|
const drag = reorder.dragging.value;
|
|
2224
2297
|
return {
|
|
@@ -2242,6 +2315,8 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
2242
2315
|
const hostsClearAll = (utility) => props.filterable && utility === props.utilities.find((candidate) => candidate !== "select");
|
|
2243
2316
|
const utilityAttrs = (utility) => pinAttrs(props.hasPinned ? "left" : false, props.offsets[utilityKey(utility)]);
|
|
2244
2317
|
const widthOf = (column) => {
|
|
2318
|
+
const grown = grow.widthOf(column.field);
|
|
2319
|
+
if (grown !== void 0) return `${grown}px`;
|
|
2245
2320
|
if (column.width) return column.width;
|
|
2246
2321
|
const auto = props.autoWidths[column.field];
|
|
2247
2322
|
return auto === void 0 ? void 0 : `${auto}px`;
|
|
@@ -2271,6 +2346,7 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
2271
2346
|
"aria-label": unref(labels)().selectAllRows,
|
|
2272
2347
|
checked: unref(selection).allSelected.value,
|
|
2273
2348
|
indeterminate: unref(selection).someSelected.value,
|
|
2349
|
+
disabled: !unref(selection).canToggleAll.value,
|
|
2274
2350
|
onChange: _cache[0] || (_cache[0] = ($event) => unref(selection).toggleAll($event.target.checked))
|
|
2275
2351
|
}, null, 40, _hoisted_3$1)], 16, _hoisted_2$1)) : !hostsClearAll(utility) ? (openBlock(), createElementBlock("td", mergeProps({
|
|
2276
2352
|
key: 1,
|
|
@@ -2286,27 +2362,30 @@ var table_header_default = /* @__PURE__ */ defineComponent({
|
|
|
2286
2362
|
"aria-label": unref(labels)().clearAllFilters,
|
|
2287
2363
|
disabled: !canClearAll.value,
|
|
2288
2364
|
onClick: withModifiers(onClearAll, ["stop"])
|
|
2289
|
-
}, [
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2365
|
+
}, [createVNode(unref(IconSlot), { name: "clear-all" }, {
|
|
2366
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
|
|
2367
|
+
width: "14",
|
|
2368
|
+
height: "14",
|
|
2369
|
+
viewBox: "0 0 24 24",
|
|
2370
|
+
fill: "none",
|
|
2371
|
+
stroke: "currentColor",
|
|
2372
|
+
"stroke-width": "2",
|
|
2373
|
+
"stroke-linecap": "round",
|
|
2374
|
+
"stroke-linejoin": "round",
|
|
2375
|
+
"aria-hidden": "true"
|
|
2376
|
+
}, [createElementVNode("line", {
|
|
2377
|
+
x1: "18",
|
|
2378
|
+
y1: "6",
|
|
2379
|
+
x2: "6",
|
|
2380
|
+
y2: "18"
|
|
2381
|
+
}), createElementVNode("line", {
|
|
2382
|
+
x1: "6",
|
|
2383
|
+
y1: "6",
|
|
2384
|
+
x2: "18",
|
|
2385
|
+
y2: "18"
|
|
2386
|
+
})], -1)])]),
|
|
2387
|
+
_: 1
|
|
2388
|
+
})], 8, _hoisted_6)], 16, _hoisted_5$1))], 64);
|
|
2310
2389
|
}), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
|
|
2311
2390
|
return openBlock(), createElementBlock("th", mergeProps({
|
|
2312
2391
|
key: column.field,
|
|
@@ -2637,7 +2716,7 @@ var sameWidths = (a, b) => {
|
|
|
2637
2716
|
const keys = Object.keys(a);
|
|
2638
2717
|
return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);
|
|
2639
2718
|
};
|
|
2640
|
-
var none = Object.freeze({});
|
|
2719
|
+
var none$1 = Object.freeze({});
|
|
2641
2720
|
/**
|
|
2642
2721
|
* Automatic column widths (C-100, ADR 0014). With `autoWidth`, every visible
|
|
2643
2722
|
* column without `Column.width` is measured (C-99) after the drawn rows
|
|
@@ -2648,7 +2727,7 @@ var none = Object.freeze({});
|
|
|
2648
2727
|
* page, a sort or a live tick never narrows a column.
|
|
2649
2728
|
*/
|
|
2650
2729
|
var useAutoWidth = (options) => {
|
|
2651
|
-
const widths = shallowRef(none);
|
|
2730
|
+
const widths = shallowRef(none$1);
|
|
2652
2731
|
/** The result the widths were last measured for, `null` before one. */
|
|
2653
2732
|
let result = null;
|
|
2654
2733
|
/** The next measure starts over: the result moved before it could run. */
|
|
@@ -2658,7 +2737,7 @@ var useAutoWidth = (options) => {
|
|
|
2658
2737
|
let observer = null;
|
|
2659
2738
|
const autoColumns = () => options.columns().filter((column) => !column.width);
|
|
2660
2739
|
const clear = () => {
|
|
2661
|
-
widths.value = none;
|
|
2740
|
+
widths.value = none$1;
|
|
2662
2741
|
result = null;
|
|
2663
2742
|
fromScratch = false;
|
|
2664
2743
|
waiting = false;
|
|
@@ -2729,6 +2808,264 @@ var useAutoWidth = (options) => {
|
|
|
2729
2808
|
return { widths };
|
|
2730
2809
|
};
|
|
2731
2810
|
//#endregion
|
|
2811
|
+
//#region src/resize/grow-shares.ts
|
|
2812
|
+
/**
|
|
2813
|
+
* The share of `room` each growing column takes, by `field`, in whole
|
|
2814
|
+
* pixels (K321-2). The room is divided by the weights; a column that would
|
|
2815
|
+
* pass its `max` stops there and the others divide what it leaves, as
|
|
2816
|
+
* flexbox does. Each share is rounded down and the pixels the rounding
|
|
2817
|
+
* leaves go to the last column that is not at its `max`, so the shares add up
|
|
2818
|
+
* to the whole pixels of the room. When every column is at its `max`, what is
|
|
2819
|
+
* left is not given out. No room, no shares.
|
|
2820
|
+
*/
|
|
2821
|
+
var divideRoom = (room, columns) => {
|
|
2822
|
+
const shares = {};
|
|
2823
|
+
if (!(room >= 1) || columns.length === 0) return shares;
|
|
2824
|
+
const exact = /* @__PURE__ */ new Map();
|
|
2825
|
+
let open = columns.filter((column) => column.weight > 0);
|
|
2826
|
+
let left = room;
|
|
2827
|
+
for (;;) {
|
|
2828
|
+
const total = open.reduce((sum, column) => sum + column.weight, 0);
|
|
2829
|
+
const capped = open.find((column) => column.max !== void 0 && column.base + left * column.weight / total > column.max);
|
|
2830
|
+
if (!capped) {
|
|
2831
|
+
for (const column of open) exact.set(column.field, left * column.weight / total);
|
|
2832
|
+
break;
|
|
2833
|
+
}
|
|
2834
|
+
const share = Math.max(0, (capped.max ?? capped.base) - capped.base);
|
|
2835
|
+
exact.set(capped.field, share);
|
|
2836
|
+
left -= share;
|
|
2837
|
+
open = open.filter((column) => column !== capped);
|
|
2838
|
+
if (open.length === 0) break;
|
|
2839
|
+
}
|
|
2840
|
+
let given = 0;
|
|
2841
|
+
for (const column of columns) {
|
|
2842
|
+
const share = Math.floor(exact.get(column.field) ?? 0);
|
|
2843
|
+
shares[column.field] = share;
|
|
2844
|
+
given += share;
|
|
2845
|
+
}
|
|
2846
|
+
const last = open.at(-1);
|
|
2847
|
+
if (last) {
|
|
2848
|
+
const whole = Math.floor([...exact.values()].reduce((sum, share) => sum + share, 0));
|
|
2849
|
+
shares[last.field] += Math.max(0, whole - given);
|
|
2850
|
+
}
|
|
2851
|
+
return shares;
|
|
2852
|
+
};
|
|
2853
|
+
/**
|
|
2854
|
+
* The base that draws a growing column `drawn` pixels wide once the room is
|
|
2855
|
+
* divided again with it growing (ADR 0024, amendment, #136 D-05). `room` is
|
|
2856
|
+
* the room with the column's base taken out, `weight` its weight and `total`
|
|
2857
|
+
* the weights of every growing column. Alone, or wider than the room, the
|
|
2858
|
+
* column's base is the drawn width; the other columns' `max` is not solved
|
|
2859
|
+
* for.
|
|
2860
|
+
*/
|
|
2861
|
+
var baseAt = (drawn, room, weight, total) => total - weight <= 0 || drawn > room ? drawn : (drawn * total - room * weight) / (total - weight);
|
|
2862
|
+
//#endregion
|
|
2863
|
+
//#region src/resize/use-growing-columns.ts
|
|
2864
|
+
var isDevelopment$2 = () => {
|
|
2865
|
+
try {
|
|
2866
|
+
return process.env.NODE_ENV !== "production";
|
|
2867
|
+
} catch {
|
|
2868
|
+
return true;
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
/** `Column.grow` when it is a weight above `0`, else `0` (K321-1). */
|
|
2872
|
+
var growOf = (column) => typeof column.grow === "number" && Number.isFinite(column.grow) && column.grow > 0 ? column.grow : 0;
|
|
2873
|
+
/** A CSS length in pixels (`'180px'`), else `undefined`. */
|
|
2874
|
+
var pixels = (width) => {
|
|
2875
|
+
const match = width === void 0 ? null : /^(\d+(?:\.\d+)?)px$/.exec(width);
|
|
2876
|
+
return match ? Number(match[1]) : void 0;
|
|
2877
|
+
};
|
|
2878
|
+
var none = Object.freeze({});
|
|
2879
|
+
/** The content width of the container: inside its scrollbar and padding. */
|
|
2880
|
+
var innerWidth = (element) => {
|
|
2881
|
+
const style = getComputedStyle(element);
|
|
2882
|
+
return element.clientWidth - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0);
|
|
2883
|
+
};
|
|
2884
|
+
/**
|
|
2885
|
+
* Growing columns (C-132, ADR 0024). The room of a container wider than the
|
|
2886
|
+
* table goes to the columns with `grow`, by their weights, on top of their
|
|
2887
|
+
* bases; the table is then as wide as the container and the browser spreads
|
|
2888
|
+
* nothing. The shares are UI state (P2): drawn as the header cell's `width`,
|
|
2889
|
+
* never emitted, never written to `columns`. The table reads its natural
|
|
2890
|
+
* width once per change of its columns; a change of the container's width
|
|
2891
|
+
* only divides the room again.
|
|
2892
|
+
*/
|
|
2893
|
+
var useGrowingColumns = (options) => {
|
|
2894
|
+
const reading = shallowRef(null);
|
|
2895
|
+
const container = shallowRef(0);
|
|
2896
|
+
/** A read found the table not displayed: read once it is. */
|
|
2897
|
+
let waiting = false;
|
|
2898
|
+
let warned = false;
|
|
2899
|
+
let observer = null;
|
|
2900
|
+
const growing = () => options.columns().filter((column) => growOf(column) > 0);
|
|
2901
|
+
/**
|
|
2902
|
+
* K321-9: a visible column that does not grow and has no width, given or
|
|
2903
|
+
* automatic, takes what is left in a fixed layout, so no share is drawn.
|
|
2904
|
+
*/
|
|
2905
|
+
const blocked = () => {
|
|
2906
|
+
const auto = options.autoWidths();
|
|
2907
|
+
return options.columns().some((column) => growOf(column) === 0 && !column.width && auto[column.field] === void 0);
|
|
2908
|
+
};
|
|
2909
|
+
/**
|
|
2910
|
+
* The width `column` is drawn at in the read, a growing one at its base, in
|
|
2911
|
+
* pixels. Drawn, not declared: a skin's own limits (a `min-width` on the
|
|
2912
|
+
* header cells) can draw a column wider than declared, and the room is
|
|
2913
|
+
* what the drawn widths leave. Its declared width when it has no box.
|
|
2914
|
+
*/
|
|
2915
|
+
const drawnOf = (column, read) => read.drawn[column.field] ?? pixels(column.width) ?? options.autoWidths()[column.field] ?? (growOf(column) > 0 ? minWidthOf(column) : 0);
|
|
2916
|
+
/** The width a growing column is read at: its base (K321-3). */
|
|
2917
|
+
const baseCss = (column) => {
|
|
2918
|
+
if (column.width) return column.width;
|
|
2919
|
+
return `${options.autoWidths()[column.field] ?? minWidthOf(column)}px`;
|
|
2920
|
+
};
|
|
2921
|
+
const clear = () => {
|
|
2922
|
+
reading.value = null;
|
|
2923
|
+
waiting = false;
|
|
2924
|
+
observer?.disconnect();
|
|
2925
|
+
observer = null;
|
|
2926
|
+
};
|
|
2927
|
+
const read = () => {
|
|
2928
|
+
const table = options.table.value;
|
|
2929
|
+
const parent = table?.parentElement;
|
|
2930
|
+
if (!table || !parent) return;
|
|
2931
|
+
const byField = new Map(options.columns().map((column) => [column.field, column]));
|
|
2932
|
+
const headers = Array.from(table.querySelectorAll(":scope > thead > tr > th[data-field]"));
|
|
2933
|
+
const swap = styleSwap();
|
|
2934
|
+
let natural = 0;
|
|
2935
|
+
const drawn = {};
|
|
2936
|
+
try {
|
|
2937
|
+
swap.set(table, "min-width", "0");
|
|
2938
|
+
swap.set(table, "width", "max-content");
|
|
2939
|
+
for (const th of headers) {
|
|
2940
|
+
const column = byField.get(th.dataset.field ?? "");
|
|
2941
|
+
if (column && growOf(column) > 0) swap.set(th, "width", baseCss(column));
|
|
2942
|
+
}
|
|
2943
|
+
natural = table.getBoundingClientRect().width;
|
|
2944
|
+
for (const th of headers) drawn[th.dataset.field ?? ""] = th.getBoundingClientRect().width;
|
|
2945
|
+
} finally {
|
|
2946
|
+
swap.restore();
|
|
2947
|
+
}
|
|
2948
|
+
const inner = innerWidth(parent);
|
|
2949
|
+
if (natural === 0 || inner <= 0) {
|
|
2950
|
+
waiting = true;
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
waiting = false;
|
|
2954
|
+
container.value = inner;
|
|
2955
|
+
reading.value = {
|
|
2956
|
+
natural,
|
|
2957
|
+
drawn
|
|
2958
|
+
};
|
|
2959
|
+
};
|
|
2960
|
+
const shares = computed(() => {
|
|
2961
|
+
const current = reading.value;
|
|
2962
|
+
if (!current || !options.enabled()) return none;
|
|
2963
|
+
let natural = current.natural;
|
|
2964
|
+
let columns = growing();
|
|
2965
|
+
const preview = options.preview();
|
|
2966
|
+
if (preview) {
|
|
2967
|
+
const column = options.columns().find((candidate) => candidate.field === preview.field);
|
|
2968
|
+
if (column) {
|
|
2969
|
+
natural += preview.width - drawnOf(column, current);
|
|
2970
|
+
columns = columns.filter((candidate) => candidate !== column);
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
return divideRoom(container.value - natural, columns.map((column) => ({
|
|
2974
|
+
field: column.field,
|
|
2975
|
+
weight: growOf(column),
|
|
2976
|
+
base: drawnOf(column, current),
|
|
2977
|
+
max: limitOf(column.maxWidth)
|
|
2978
|
+
})));
|
|
2979
|
+
});
|
|
2980
|
+
/** The shares are drawn: the table is as wide as its container. */
|
|
2981
|
+
const active = computed(() => Object.values(shares.value).some((share) => share > 0));
|
|
2982
|
+
/** The width the shares make the table: to tell a change we did not make. */
|
|
2983
|
+
const expected = () => {
|
|
2984
|
+
const current = reading.value;
|
|
2985
|
+
if (!current) return;
|
|
2986
|
+
return current.natural + Object.values(shares.value).reduce((sum, share) => sum + share, 0);
|
|
2987
|
+
};
|
|
2988
|
+
const observe = (table) => {
|
|
2989
|
+
observer?.disconnect();
|
|
2990
|
+
observer = null;
|
|
2991
|
+
const parent = table?.parentElement;
|
|
2992
|
+
if (!table || !parent || typeof ResizeObserver === "undefined") return;
|
|
2993
|
+
observer = new ResizeObserver(() => {
|
|
2994
|
+
if (waiting) {
|
|
2995
|
+
read();
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
container.value = innerWidth(parent);
|
|
2999
|
+
const want = expected();
|
|
3000
|
+
if (want !== void 0 && !options.preview() && Math.abs(table.getBoundingClientRect().width - want) > 1 && Object.keys(shares.value).length > 0) read();
|
|
3001
|
+
});
|
|
3002
|
+
observer.observe(parent);
|
|
3003
|
+
observer.observe(table);
|
|
3004
|
+
};
|
|
3005
|
+
watch([
|
|
3006
|
+
() => options.enabled(),
|
|
3007
|
+
() => options.table.value,
|
|
3008
|
+
() => options.columns().map((column) => [
|
|
3009
|
+
column.field,
|
|
3010
|
+
column.width ?? "",
|
|
3011
|
+
growOf(column),
|
|
3012
|
+
column.minWidth ?? "",
|
|
3013
|
+
column.maxWidth ?? ""
|
|
3014
|
+
].join(" ")).join("|"),
|
|
3015
|
+
() => JSON.stringify(options.autoWidths()),
|
|
3016
|
+
() => options.utilities()
|
|
3017
|
+
], ([enabled, table], [, oldTable]) => {
|
|
3018
|
+
if (!enabled || growing().length === 0) {
|
|
3019
|
+
clear();
|
|
3020
|
+
return;
|
|
3021
|
+
}
|
|
3022
|
+
if (blocked()) {
|
|
3023
|
+
clear();
|
|
3024
|
+
if (!options.autoWidth() && !warned && isDevelopment$2()) {
|
|
3025
|
+
warned = true;
|
|
3026
|
+
console.warn("[QueryTable] `grow`: a visible column that does not grow has no `width`, so the room is not divided. Give that column a `width` or turn `autoWidth` on (C-132).");
|
|
3027
|
+
}
|
|
3028
|
+
return;
|
|
3029
|
+
}
|
|
3030
|
+
if (table !== oldTable || !observer) observe(table);
|
|
3031
|
+
read();
|
|
3032
|
+
}, {
|
|
3033
|
+
immediate: true,
|
|
3034
|
+
flush: "post"
|
|
3035
|
+
});
|
|
3036
|
+
/** The width a column is drawn at, or `undefined` to draw it as declared. */
|
|
3037
|
+
const widthOf = (field) => {
|
|
3038
|
+
const share = shares.value[field];
|
|
3039
|
+
const current = reading.value;
|
|
3040
|
+
if (!share || !current) return;
|
|
3041
|
+
const column = options.columns().find((candidate) => candidate.field === field);
|
|
3042
|
+
return column ? drawnOf(column, current) + share : void 0;
|
|
3043
|
+
};
|
|
3044
|
+
/**
|
|
3045
|
+
* The width a resize of `field` emits for the drawn width `drawn`: the base
|
|
3046
|
+
* that keeps a growing column there once the room is divided again (D-05),
|
|
3047
|
+
* else `drawn`.
|
|
3048
|
+
*/
|
|
3049
|
+
const emitted = (field, drawn) => {
|
|
3050
|
+
const current = reading.value;
|
|
3051
|
+
const column = options.columns().find((candidate) => candidate.field === field);
|
|
3052
|
+
if (!current || !column || growOf(column) === 0 || !active.value) return drawn;
|
|
3053
|
+
const all = growing();
|
|
3054
|
+
const base = drawnOf(column, current);
|
|
3055
|
+
return baseAt(drawn, container.value - (current.natural - base), growOf(column), all.reduce((sum, candidate) => sum + growOf(candidate), 0));
|
|
3056
|
+
};
|
|
3057
|
+
onBeforeUnmount(() => {
|
|
3058
|
+
observer?.disconnect();
|
|
3059
|
+
observer = null;
|
|
3060
|
+
});
|
|
3061
|
+
return {
|
|
3062
|
+
shares,
|
|
3063
|
+
active,
|
|
3064
|
+
widthOf,
|
|
3065
|
+
emitted
|
|
3066
|
+
};
|
|
3067
|
+
};
|
|
3068
|
+
//#endregion
|
|
2732
3069
|
//#region src/scroll/use-scroll-body.ts
|
|
2733
3070
|
var isDevelopment$1 = () => {
|
|
2734
3071
|
try {
|
|
@@ -2878,6 +3215,11 @@ function useQueryTable(options) {
|
|
|
2878
3215
|
const expandable = toValue(options.rowExpandable);
|
|
2879
3216
|
return expandable === void 0 || expandable(row, index);
|
|
2880
3217
|
};
|
|
3218
|
+
const canSelect = (row, index) => {
|
|
3219
|
+
const selectable = toValue(options.rowSelectable);
|
|
3220
|
+
return selectable === void 0 || selectable(row, index);
|
|
3221
|
+
};
|
|
3222
|
+
const enableRowSelection = computed(() => toValue(options.rowSelectable) === void 0 ? true : (row) => canSelect(row.original, row.index));
|
|
2881
3223
|
const pinnedRows = () => toValue(options.rowPinning);
|
|
2882
3224
|
const pinningEnabled = computed(() => rowKey() !== void 0 && pinnedRows() !== void 0);
|
|
2883
3225
|
const rowPinningState = computed(() => {
|
|
@@ -2949,7 +3291,9 @@ function useQueryTable(options) {
|
|
|
2949
3291
|
get filterDebounce() {
|
|
2950
3292
|
return toValue(options.filterDebounce) ?? 100;
|
|
2951
3293
|
},
|
|
2952
|
-
enableRowSelection
|
|
3294
|
+
get enableRowSelection() {
|
|
3295
|
+
return enableRowSelection.value;
|
|
3296
|
+
},
|
|
2953
3297
|
manualExpanding: true,
|
|
2954
3298
|
getRowCanExpand: (row) => canExpand(row.original, row.index),
|
|
2955
3299
|
onRowSelectionChange: (updater) => {
|
|
@@ -3289,10 +3633,13 @@ function useQueryTable(options) {
|
|
|
3289
3633
|
watch(single, (isSingle) => {
|
|
3290
3634
|
if (isSingle) setExpanded((state) => keepFirstOpen(state, rows()));
|
|
3291
3635
|
});
|
|
3636
|
+
const allSelected = computed(() => table.getIsAllPageRowsSelected());
|
|
3292
3637
|
const selection = {
|
|
3293
3638
|
enabled: computed(() => toValue(options.selection) !== void 0),
|
|
3639
|
+
canSelect,
|
|
3294
3640
|
isSelected: (row, index) => !!toValue(options.selection)?.[idOf(row, index)],
|
|
3295
3641
|
toggle: (row, index) => {
|
|
3642
|
+
if (!canSelect(row, index)) return;
|
|
3296
3643
|
const id = idOf(row, index);
|
|
3297
3644
|
table.setRowSelection((old) => {
|
|
3298
3645
|
const next = { ...old };
|
|
@@ -3301,8 +3648,9 @@ function useQueryTable(options) {
|
|
|
3301
3648
|
return next;
|
|
3302
3649
|
});
|
|
3303
3650
|
},
|
|
3304
|
-
allSelected
|
|
3305
|
-
someSelected: computed(() => table.getIsSomePageRowsSelected()),
|
|
3651
|
+
allSelected,
|
|
3652
|
+
someSelected: computed(() => !allSelected.value && table.getIsSomePageRowsSelected()),
|
|
3653
|
+
canToggleAll: computed(() => toValue(options.rowSelectable) === void 0 || rows().some((row, index) => canSelect(row, index))),
|
|
3306
3654
|
toggleAll: (value) => table.toggleAllPageRowsSelected(value)
|
|
3307
3655
|
};
|
|
3308
3656
|
const bodyRows = computed(() => {
|
|
@@ -4268,6 +4616,10 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4268
4616
|
query: {},
|
|
4269
4617
|
cursors: { default: null },
|
|
4270
4618
|
selection: { default: void 0 },
|
|
4619
|
+
rowSelectable: {
|
|
4620
|
+
type: Function,
|
|
4621
|
+
default: void 0
|
|
4622
|
+
},
|
|
4271
4623
|
rowPinning: { default: void 0 },
|
|
4272
4624
|
searchDebounce: { default: 300 },
|
|
4273
4625
|
columns: {},
|
|
@@ -4370,6 +4722,15 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4370
4722
|
const emit = __emit;
|
|
4371
4723
|
const slots = useSlots();
|
|
4372
4724
|
const rawSlots = useSlots();
|
|
4725
|
+
const iconSlotNames = () => Object.keys(rawSlots).filter((name) => name.startsWith("icon-")).sort().join("\n");
|
|
4726
|
+
const givenIcons = shallowRef(iconSlotNames());
|
|
4727
|
+
onBeforeUpdate(() => {
|
|
4728
|
+
givenIcons.value = iconSlotNames();
|
|
4729
|
+
});
|
|
4730
|
+
const icons = {
|
|
4731
|
+
has: (name) => givenIcons.value.split("\n").includes(`icon-${name}`),
|
|
4732
|
+
slots: rawSlots
|
|
4733
|
+
};
|
|
4373
4734
|
const split = () => props.header && props.scrollBody;
|
|
4374
4735
|
/** Rows of the header in the row count (C-86): none without it. */
|
|
4375
4736
|
const headerRows = () => props.header ? 1 : 0;
|
|
@@ -4389,6 +4750,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4389
4750
|
filterDebounce: () => props.filterDebounce,
|
|
4390
4751
|
searchDebounce: () => props.searchDebounce,
|
|
4391
4752
|
selection: () => props.selection,
|
|
4753
|
+
rowSelectable: () => props.rowSelectable,
|
|
4392
4754
|
rowPinning: () => props.rowPinning,
|
|
4393
4755
|
rowKey: () => props.rowKey,
|
|
4394
4756
|
hasSubtable: () => props.hasSubtable,
|
|
@@ -4477,7 +4839,9 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4477
4839
|
emit("columnResize", payload);
|
|
4478
4840
|
const next = applyWidth(props.columns, payload.field, `${payload.width}px`);
|
|
4479
4841
|
if (next) emit("update:columns", next, "resize");
|
|
4480
|
-
}
|
|
4842
|
+
},
|
|
4843
|
+
growing: () => grow.active.value,
|
|
4844
|
+
emitted: (field, drawn) => grow.emitted(field, drawn)
|
|
4481
4845
|
});
|
|
4482
4846
|
const autoWidth = useAutoWidth({
|
|
4483
4847
|
enabled: () => props.header && props.autoWidth,
|
|
@@ -4489,6 +4853,15 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4489
4853
|
query: () => props.query,
|
|
4490
4854
|
rowsUpdate: () => props.rowsUpdate
|
|
4491
4855
|
});
|
|
4856
|
+
const grow = useGrowingColumns({
|
|
4857
|
+
enabled: () => props.header,
|
|
4858
|
+
table: tableEl,
|
|
4859
|
+
columns: () => visibleColumns.value,
|
|
4860
|
+
autoWidth: () => props.autoWidth,
|
|
4861
|
+
autoWidths: () => autoWidth.widths.value,
|
|
4862
|
+
utilities: () => utilities.value.join(" "),
|
|
4863
|
+
preview: () => resize.preview.value
|
|
4864
|
+
});
|
|
4492
4865
|
const rowWindow = useRowWindow({
|
|
4493
4866
|
virtual: () => props.virtual,
|
|
4494
4867
|
table: bodyTable,
|
|
@@ -4569,7 +4942,9 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4569
4942
|
resize,
|
|
4570
4943
|
reorder,
|
|
4571
4944
|
selection: rowSelection,
|
|
4572
|
-
labels: () => labels.value
|
|
4945
|
+
labels: () => labels.value,
|
|
4946
|
+
icons,
|
|
4947
|
+
grow
|
|
4573
4948
|
});
|
|
4574
4949
|
const showPagination = computed(() => !!slots.pagination && (props.rows.length > 0 || (props.totalRows ?? 0) > 0 || (props.pagination?.alwaysShow ?? false)));
|
|
4575
4950
|
const canClearFilters = computed(() => filters.canClearAll());
|
|
@@ -4676,6 +5051,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4676
5051
|
"has-right-panel": __props.hasRightPanel,
|
|
4677
5052
|
"has-selection": unref(rowSelection).enabled.value,
|
|
4678
5053
|
"is-selected": unref(rowSelection).isSelected,
|
|
5054
|
+
"can-select": unref(rowSelection).canSelect,
|
|
4679
5055
|
"toggle-selected": unref(rowSelection).toggle,
|
|
4680
5056
|
"has-pinned": unref(hasPinned),
|
|
4681
5057
|
offsets: unref(offsets),
|
|
@@ -4710,6 +5086,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4710
5086
|
"has-right-panel",
|
|
4711
5087
|
"has-selection",
|
|
4712
5088
|
"is-selected",
|
|
5089
|
+
"can-select",
|
|
4713
5090
|
"toggle-selected",
|
|
4714
5091
|
"has-pinned",
|
|
4715
5092
|
"offsets",
|
|
@@ -4805,6 +5182,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4805
5182
|
"has-right-panel": __props.hasRightPanel,
|
|
4806
5183
|
"has-selection": unref(rowSelection).enabled.value,
|
|
4807
5184
|
"is-selected": unref(rowSelection).isSelected,
|
|
5185
|
+
"can-select": unref(rowSelection).canSelect,
|
|
4808
5186
|
"toggle-selected": unref(rowSelection).toggle,
|
|
4809
5187
|
"has-pinned": unref(hasPinned),
|
|
4810
5188
|
offsets: unref(offsets),
|
|
@@ -4838,6 +5216,7 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4838
5216
|
"has-right-panel",
|
|
4839
5217
|
"has-selection",
|
|
4840
5218
|
"is-selected",
|
|
5219
|
+
"can-select",
|
|
4841
5220
|
"toggle-selected",
|
|
4842
5221
|
"has-pinned",
|
|
4843
5222
|
"offsets",
|
|
@@ -4916,4 +5295,4 @@ var src_default = query_table_default;
|
|
|
4916
5295
|
//#endregion
|
|
4917
5296
|
export { useQueryTable as i, parseFilterInput$1 as n, query_table_default as r, src_default as t };
|
|
4918
5297
|
|
|
4919
|
-
//# sourceMappingURL=src-
|
|
5298
|
+
//# sourceMappingURL=src-DvUx4ur-.js.map
|