@atscript/vue-table 0.1.58
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/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/as-action-form-dialog.cjs +221 -0
- package/dist/as-action-form-dialog.d.cts +6 -0
- package/dist/as-action-form-dialog.d.mts +7 -0
- package/dist/as-action-form-dialog.mjs +221 -0
- package/dist/as-action-menu-content-CXsdPn42.mjs +104 -0
- package/dist/as-action-menu-content-CyUfBrWH.cjs +109 -0
- package/dist/as-cell-array-CXeZzZqt.cjs +69 -0
- package/dist/as-cell-array-DOQKR6t5.mjs +64 -0
- package/dist/as-cell-array.cjs +3 -0
- package/dist/as-cell-array.d.cts +2 -0
- package/dist/as-cell-array.d.mts +2 -0
- package/dist/as-cell-array.mjs +3 -0
- package/dist/as-cell-array.vue-DZGM2VHh.d.mts +12 -0
- package/dist/as-cell-array.vue-pFs5GcCR.d.cts +12 -0
- package/dist/as-cell-date-CTrvxS1h.cjs +78 -0
- package/dist/as-cell-date-Cq49RHmL.mjs +73 -0
- package/dist/as-cell-date.cjs +3 -0
- package/dist/as-cell-date.d.cts +2 -0
- package/dist/as-cell-date.d.mts +2 -0
- package/dist/as-cell-date.mjs +3 -0
- package/dist/as-cell-date.vue-BBSps2B2.d.cts +12 -0
- package/dist/as-cell-date.vue-Zlt4mHWb.d.mts +12 -0
- package/dist/as-cell-json-BynWIs1d.mjs +37 -0
- package/dist/as-cell-json-DvHvQ6IL.cjs +42 -0
- package/dist/as-cell-json-popover-BWdNs1YU.cjs +70 -0
- package/dist/as-cell-json-popover-DUq25I0L.mjs +65 -0
- package/dist/as-cell-json.cjs +3 -0
- package/dist/as-cell-json.d.cts +2 -0
- package/dist/as-cell-json.d.mts +2 -0
- package/dist/as-cell-json.mjs +3 -0
- package/dist/as-cell-json.vue-C6wg4ARZ.d.cts +12 -0
- package/dist/as-cell-json.vue-CESWuCer.d.mts +12 -0
- package/dist/as-cell-number-0_WrSCzu.cjs +76 -0
- package/dist/as-cell-number-Bc1C97Vg.mjs +71 -0
- package/dist/as-cell-number.cjs +3 -0
- package/dist/as-cell-number.d.cts +2 -0
- package/dist/as-cell-number.d.mts +2 -0
- package/dist/as-cell-number.mjs +3 -0
- package/dist/as-cell-number.vue-1Oq7nVI3.d.mts +12 -0
- package/dist/as-cell-number.vue-CJ2K5zeM.d.cts +12 -0
- package/dist/as-cell-union-C1w3B38J.mjs +88 -0
- package/dist/as-cell-union-CFAI0utz.cjs +93 -0
- package/dist/as-cell-union.cjs +4 -0
- package/dist/as-cell-union.d.cts +2 -0
- package/dist/as-cell-union.d.mts +2 -0
- package/dist/as-cell-union.mjs +4 -0
- package/dist/as-cell-union.vue-CslPM_c2.d.cts +12 -0
- package/dist/as-cell-union.vue-NnDmQZOA.d.mts +12 -0
- package/dist/as-column-menu-CH9Htz0Q.cjs +220 -0
- package/dist/as-column-menu-DCfhorMP.mjs +215 -0
- package/dist/as-column-menu.cjs +2 -0
- package/dist/as-column-menu.d.cts +2 -0
- package/dist/as-column-menu.d.mts +2 -0
- package/dist/as-column-menu.mjs +2 -0
- package/dist/as-column-menu.vue-C9e6wJ3z.d.mts +47 -0
- package/dist/as-column-menu.vue-o0qFdzoL.d.cts +47 -0
- package/dist/as-config-dialog-d2k7_l0U.cjs +699 -0
- package/dist/as-config-dialog-vRklaKbi.mjs +688 -0
- package/dist/as-config-dialog.cjs +3 -0
- package/dist/as-config-dialog.d.cts +2 -0
- package/dist/as-config-dialog.d.mts +2 -0
- package/dist/as-config-dialog.mjs +3 -0
- package/dist/as-config-dialog.vue-C6Q62xF5.d.mts +7 -0
- package/dist/as-config-dialog.vue-DvvJi3xx.d.cts +7 -0
- package/dist/as-confirm-dialog-BLh3Ju4-.mjs +52 -0
- package/dist/as-confirm-dialog-BgpIEE2z.cjs +57 -0
- package/dist/as-confirm-dialog.cjs +3 -0
- package/dist/as-confirm-dialog.d.cts +2 -0
- package/dist/as-confirm-dialog.d.mts +2 -0
- package/dist/as-confirm-dialog.mjs +3 -0
- package/dist/as-confirm-dialog.vue-CXxLpzbu.d.cts +7 -0
- package/dist/as-confirm-dialog.vue-pas8jGhv.d.mts +7 -0
- package/dist/as-filter-dialog-C0HMpUPT.mjs +610 -0
- package/dist/as-filter-dialog-DcGvIV3h.cjs +621 -0
- package/dist/as-filter-dialog.cjs +15 -0
- package/dist/as-filter-dialog.d.cts +2 -0
- package/dist/as-filter-dialog.d.mts +2 -0
- package/dist/as-filter-dialog.mjs +15 -0
- package/dist/as-filter-dialog.vue-BV2J8PgZ.d.cts +7 -0
- package/dist/as-filter-dialog.vue-RDZjp4gJ.d.mts +7 -0
- package/dist/as-filter-field-B_tYzvvl.cjs +984 -0
- package/dist/as-filter-field-Bqvu2ASN.mjs +943 -0
- package/dist/as-filter-field.cjs +9 -0
- package/dist/as-filter-field.d.cts +2 -0
- package/dist/as-filter-field.d.mts +2 -0
- package/dist/as-filter-field.mjs +9 -0
- package/dist/as-filter-field.vue-ByQ8xIGq.d.cts +11 -0
- package/dist/as-filter-field.vue-QY8wi5S5.d.mts +11 -0
- package/dist/as-filter-input--nr72iwX.cjs +106 -0
- package/dist/as-filter-input-P1i0CW2-.mjs +101 -0
- package/dist/as-filter-input.cjs +2 -0
- package/dist/as-filter-input.d.cts +2 -0
- package/dist/as-filter-input.d.mts +2 -0
- package/dist/as-filter-input.mjs +2 -0
- package/dist/as-filter-input.vue-CBQ71eNg.d.mts +18 -0
- package/dist/as-filter-input.vue-CS4nOk_Q.d.cts +18 -0
- package/dist/as-filters-Bxa9ZEMm.mjs +44 -0
- package/dist/as-filters-xRT2qv56.cjs +49 -0
- package/dist/as-filters.cjs +10 -0
- package/dist/as-filters.d.cts +2 -0
- package/dist/as-filters.d.mts +2 -0
- package/dist/as-filters.mjs +10 -0
- package/dist/as-filters.vue-BsMgYUcX.d.mts +10 -0
- package/dist/as-filters.vue-fv-tRL2H.d.cts +10 -0
- package/dist/as-preset-dialog-BaTfwMnh.cjs +569 -0
- package/dist/as-preset-dialog-BdDRgwf_.mjs +564 -0
- package/dist/as-preset-dialog.cjs +4 -0
- package/dist/as-preset-dialog.d.cts +2 -0
- package/dist/as-preset-dialog.d.mts +2 -0
- package/dist/as-preset-dialog.mjs +4 -0
- package/dist/as-preset-dialog.vue-Bzv-ON9W.d.mts +7 -0
- package/dist/as-preset-dialog.vue-DP9fy00Y.d.cts +7 -0
- package/dist/as-preset-picker-BQbNEiy9.mjs +427 -0
- package/dist/as-preset-picker-Ce3crTQy.cjs +432 -0
- package/dist/as-preset-picker.cjs +4 -0
- package/dist/as-preset-picker.d.cts +2 -0
- package/dist/as-preset-picker.d.mts +2 -0
- package/dist/as-preset-picker.mjs +4 -0
- package/dist/as-preset-picker.vue-CTBk6leV.d.mts +7 -0
- package/dist/as-preset-picker.vue-DfXS3pGl.d.cts +7 -0
- package/dist/as-row-actions-B6Kob6gt.cjs +120 -0
- package/dist/as-row-actions-CeWBBGqh.mjs +115 -0
- package/dist/as-row-actions.cjs +4 -0
- package/dist/as-row-actions.d.cts +2 -0
- package/dist/as-row-actions.d.mts +2 -0
- package/dist/as-row-actions.mjs +4 -0
- package/dist/as-row-actions.vue-BPaQfGev.d.mts +11 -0
- package/dist/as-row-actions.vue-Bvcc2tUN.d.cts +11 -0
- package/dist/as-table-Cnw2fOqZ.mjs +204 -0
- package/dist/as-table-DlDFxdXI.cjs +209 -0
- package/dist/as-table-actions-BK1Thy2G.cjs +142 -0
- package/dist/as-table-actions-BpMiNFni.mjs +137 -0
- package/dist/as-table-actions.cjs +4 -0
- package/dist/as-table-actions.d.cts +2 -0
- package/dist/as-table-actions.d.mts +2 -0
- package/dist/as-table-actions.mjs +4 -0
- package/dist/as-table-actions.vue-B7Q-JA3z.d.cts +47 -0
- package/dist/as-table-actions.vue-Bs1Jl1ep.d.mts +47 -0
- package/dist/as-table-base-D0k4k7k_.mjs +646 -0
- package/dist/as-table-base-VIz-B_6_.cjs +651 -0
- package/dist/as-table-cell-value-B1CiJYFn.mjs +26 -0
- package/dist/as-table-cell-value-CuxRtFn9.cjs +31 -0
- package/dist/as-table-cell-value.cjs +3 -0
- package/dist/as-table-cell-value.d.cts +2 -0
- package/dist/as-table-cell-value.d.mts +2 -0
- package/dist/as-table-cell-value.mjs +3 -0
- package/dist/as-table-cell-value.vue-BgFDv2JQ.d.cts +12 -0
- package/dist/as-table-cell-value.vue-BuPCQ8YA.d.mts +12 -0
- package/dist/as-table-header-cell-C3zeZUZo.cjs +117 -0
- package/dist/as-table-header-cell-CBn_ioCe.mjs +112 -0
- package/dist/as-table-header-cell.cjs +3 -0
- package/dist/as-table-header-cell.d.cts +2 -0
- package/dist/as-table-header-cell.d.mts +2 -0
- package/dist/as-table-header-cell.mjs +3 -0
- package/dist/as-table-header-cell.vue-Bc_DSsGY.d.cts +31 -0
- package/dist/as-table-header-cell.vue-DNMOHfek.d.mts +31 -0
- package/dist/as-table-root-Br6WcGRo.cjs +263 -0
- package/dist/as-table-root-gG7pTIdD.mjs +258 -0
- package/dist/as-table-root.cjs +28 -0
- package/dist/as-table-root.d.cts +2 -0
- package/dist/as-table-root.d.mts +2 -0
- package/dist/as-table-root.mjs +28 -0
- package/dist/as-table-root.vue-5_OhVwse.d.mts +2258 -0
- package/dist/as-table-root.vue-CSqEtIll.d.cts +2258 -0
- package/dist/as-table-status-BjRGGuhC.mjs +683 -0
- package/dist/as-table-status-DWYoJIMC.cjs +724 -0
- package/dist/as-table.cjs +10 -0
- package/dist/as-table.d.cts +2 -0
- package/dist/as-table.d.mts +2 -0
- package/dist/as-table.mjs +10 -0
- package/dist/as-table.vue-BTYg-e3Z.d.mts +81 -0
- package/dist/as-table.vue-wdRARLIe.d.cts +81 -0
- package/dist/as-window-table-CKIfo3M_.mjs +709 -0
- package/dist/as-window-table-DE7_NyEP.cjs +714 -0
- package/dist/as-window-table.cjs +9 -0
- package/dist/as-window-table.d.cts +2 -0
- package/dist/as-window-table.d.mts +2 -0
- package/dist/as-window-table.mjs +9 -0
- package/dist/as-window-table.vue-Bf8xGC9M.d.mts +86 -0
- package/dist/as-window-table.vue-CA8qsrz4.d.cts +86 -0
- package/dist/format-cell-B2xMDYO9.mjs +27 -0
- package/dist/format-cell-D4mqaN0E.cjs +32 -0
- package/dist/get-cell-value-CZSVfDLg.cjs +19 -0
- package/dist/get-cell-value-DiH84HKL.mjs +14 -0
- package/dist/index.cjs +598 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +505 -0
- package/dist/preset-aspect-display-BYeiSgcc.mjs +43 -0
- package/dist/preset-aspect-display-y8aal_EF.cjs +72 -0
- package/dist/types-BvvXN72P.d.mts +531 -0
- package/dist/types-CNMmF6W2.d.cts +531 -0
- package/dist/use-cell-locale-1uQaFTLQ.mjs +23 -0
- package/dist/use-cell-locale-B480_QYK.cjs +34 -0
- package/dist/use-table-column-handlers-CGYAY2xH.cjs +65 -0
- package/dist/use-table-column-handlers-t6xi1yCE.mjs +54 -0
- package/dist/use-table-state-C4JbonEZ.mjs +1822 -0
- package/dist/use-table-state-MU-vuzui.cjs +1917 -0
- package/package.json +195 -0
- package/styles.d.ts +2 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
const require_use_table_state = require("./use-table-state-MU-vuzui.cjs");
|
|
2
|
+
const require_as_table_status = require("./as-table-status-DWYoJIMC.cjs");
|
|
3
|
+
const require_use_table_column_handlers = require("./use-table-column-handlers-CGYAY2xH.cjs");
|
|
4
|
+
const require_get_cell_value = require("./get-cell-value-CZSVfDLg.cjs");
|
|
5
|
+
let vue = require("vue");
|
|
6
|
+
let _atscript_ui_table = require("@atscript/ui-table");
|
|
7
|
+
let _vueuse_core = require("@vueuse/core");
|
|
8
|
+
//#region src/components/internal/as-window-skeleton-row.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
const _hoisted_1$3 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "as-window-skeleton-cell"
|
|
12
|
+
};
|
|
13
|
+
const SHIMMER_DURATION_MS = 4200;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/internal/as-window-skeleton-row.vue
|
|
16
|
+
var as_window_skeleton_row_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
17
|
+
__name: "as-window-skeleton-row",
|
|
18
|
+
props: {
|
|
19
|
+
columns: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
rowHeight: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
hasSelect: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
required: false
|
|
30
|
+
},
|
|
31
|
+
errored: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
required: false
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
setup(__props) {
|
|
37
|
+
const props = __props;
|
|
38
|
+
const animationDelay = (0, vue.computed)(() => props.errored ? void 0 : `-${performance.now() % SHIMMER_DURATION_MS}ms`);
|
|
39
|
+
return (_ctx, _cache) => {
|
|
40
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("tr", {
|
|
41
|
+
class: (0, vue.normalizeClass)(__props.errored ? "as-window-empty-row" : "as-window-skeleton-row"),
|
|
42
|
+
style: (0, vue.normalizeStyle)({
|
|
43
|
+
height: `${__props.rowHeight}px`,
|
|
44
|
+
animationDelay: animationDelay.value
|
|
45
|
+
})
|
|
46
|
+
}, [
|
|
47
|
+
__props.hasSelect ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_1$3)) : (0, vue.createCommentVNode)("v-if", true),
|
|
48
|
+
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.columns, (col) => {
|
|
49
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("td", {
|
|
50
|
+
key: col.path,
|
|
51
|
+
class: "as-window-skeleton-cell"
|
|
52
|
+
});
|
|
53
|
+
}), 128)),
|
|
54
|
+
(0, vue.createCommentVNode)(" Stretch filler cell — mirrors the data row's `<td class=\"as-td-filler\" />`\n so the skeleton spans the full table width including the trailing\n expander column. Without this, table-fixed layout would leave the\n filler column blank on skeleton rows. "),
|
|
55
|
+
_cache[0] || (_cache[0] = (0, vue.createElementVNode)("td", { class: "as-td-filler" }, null, -1))
|
|
56
|
+
], 6);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/components/internal/as-window-scrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
62
|
+
const _hoisted_1$2 = {
|
|
63
|
+
key: 0,
|
|
64
|
+
class: "as-window-scrollbar"
|
|
65
|
+
};
|
|
66
|
+
const _hoisted_2$1 = ["data-active"];
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/components/internal/as-window-scrollbar.vue
|
|
69
|
+
var as_window_scrollbar_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
70
|
+
__name: "as-window-scrollbar",
|
|
71
|
+
props: {
|
|
72
|
+
topIndex: {
|
|
73
|
+
type: Number,
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
viewportRowCount: {
|
|
77
|
+
type: Number,
|
|
78
|
+
required: true
|
|
79
|
+
},
|
|
80
|
+
totalCount: {
|
|
81
|
+
type: Number,
|
|
82
|
+
required: true
|
|
83
|
+
},
|
|
84
|
+
thumbMinHeight: {
|
|
85
|
+
type: Number,
|
|
86
|
+
required: false,
|
|
87
|
+
default: 24
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
emits: ["top-index-change"],
|
|
91
|
+
setup(__props, { emit: __emit }) {
|
|
92
|
+
const props = __props;
|
|
93
|
+
const emit = __emit;
|
|
94
|
+
const trackEl = (0, vue.ref)(null);
|
|
95
|
+
const { height: trackHeight } = (0, _vueuse_core.useElementSize)(trackEl);
|
|
96
|
+
const dragging = (0, vue.ref)(false);
|
|
97
|
+
let dragStartY = 0;
|
|
98
|
+
let dragStartTopIndex = 0;
|
|
99
|
+
let activePointerId = null;
|
|
100
|
+
const maxIndex = (0, vue.computed)(() => Math.max(0, props.totalCount - props.viewportRowCount));
|
|
101
|
+
const visible = (0, vue.computed)(() => maxIndex.value > 0);
|
|
102
|
+
const thumbHeight = (0, vue.computed)(() => {
|
|
103
|
+
if (props.totalCount <= 0 || trackHeight.value <= 0) return props.thumbMinHeight;
|
|
104
|
+
const ideal = props.viewportRowCount / props.totalCount * trackHeight.value;
|
|
105
|
+
return Math.max(props.thumbMinHeight, ideal);
|
|
106
|
+
});
|
|
107
|
+
const thumbY = (0, vue.computed)(() => {
|
|
108
|
+
if (maxIndex.value <= 0 || trackHeight.value <= 0) return 0;
|
|
109
|
+
return props.topIndex / maxIndex.value * (trackHeight.value - thumbHeight.value);
|
|
110
|
+
});
|
|
111
|
+
function clamp(n) {
|
|
112
|
+
return (0, _atscript_ui_table.clampTopIndex)(n, props.totalCount, props.viewportRowCount);
|
|
113
|
+
}
|
|
114
|
+
const topIndexBatch = require_as_table_status.useRafBatch((next) => {
|
|
115
|
+
if (next !== props.topIndex) emit("top-index-change", next);
|
|
116
|
+
});
|
|
117
|
+
function onThumbPointerDown(event) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
dragging.value = true;
|
|
120
|
+
dragStartY = event.clientY;
|
|
121
|
+
dragStartTopIndex = props.topIndex;
|
|
122
|
+
activePointerId = event.pointerId;
|
|
123
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
124
|
+
}
|
|
125
|
+
function onThumbPointerMove(event) {
|
|
126
|
+
if (!dragging.value) return;
|
|
127
|
+
const span = trackHeight.value - thumbHeight.value;
|
|
128
|
+
if (span <= 0) return;
|
|
129
|
+
const delta = event.clientY - dragStartY;
|
|
130
|
+
const next = Math.round(dragStartTopIndex + delta * maxIndex.value / span);
|
|
131
|
+
topIndexBatch.schedule(clamp(next));
|
|
132
|
+
}
|
|
133
|
+
function endDrag(event) {
|
|
134
|
+
if (!dragging.value) return;
|
|
135
|
+
dragging.value = false;
|
|
136
|
+
if (event && activePointerId !== null) event.currentTarget.releasePointerCapture?.(activePointerId);
|
|
137
|
+
activePointerId = null;
|
|
138
|
+
}
|
|
139
|
+
function onTrackClick(event) {
|
|
140
|
+
if (dragging.value) return;
|
|
141
|
+
const rect = trackEl.value?.getBoundingClientRect();
|
|
142
|
+
if (!rect) return;
|
|
143
|
+
const direction = event.clientY - rect.top < thumbY.value + thumbHeight.value / 2 ? -1 : 1;
|
|
144
|
+
emit("top-index-change", clamp(props.topIndex + direction * props.viewportRowCount));
|
|
145
|
+
}
|
|
146
|
+
return (_ctx, _cache) => {
|
|
147
|
+
return visible.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$2, [(0, vue.createElementVNode)("div", {
|
|
148
|
+
ref_key: "trackEl",
|
|
149
|
+
ref: trackEl,
|
|
150
|
+
class: "as-window-scrollbar-track",
|
|
151
|
+
role: "scrollbar",
|
|
152
|
+
"aria-orientation": "vertical",
|
|
153
|
+
onClick: onTrackClick
|
|
154
|
+
}, [(0, vue.createElementVNode)("div", {
|
|
155
|
+
class: "as-window-scrollbar-thumb",
|
|
156
|
+
"data-active": dragging.value || void 0,
|
|
157
|
+
style: (0, vue.normalizeStyle)({
|
|
158
|
+
height: `${thumbHeight.value}px`,
|
|
159
|
+
top: `${thumbY.value}px`
|
|
160
|
+
}),
|
|
161
|
+
onPointerdown: onThumbPointerDown,
|
|
162
|
+
onPointermove: onThumbPointerMove,
|
|
163
|
+
onPointerup: endDrag,
|
|
164
|
+
onPointercancel: endDrag
|
|
165
|
+
}, null, 44, _hoisted_2$1)], 512)])) : (0, vue.createCommentVNode)("v-if", true);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/components/internal/as-window-table-base.vue?vue&type=script&setup=true&lang.ts
|
|
171
|
+
const _hoisted_1$1 = { class: "as-window-table-scroll-area" };
|
|
172
|
+
const _hoisted_2 = ["aria-rowcount", "aria-multiselectable"];
|
|
173
|
+
const _hoisted_3 = ["aria-activedescendant"];
|
|
174
|
+
const _hoisted_4 = [
|
|
175
|
+
"id",
|
|
176
|
+
"aria-rowindex",
|
|
177
|
+
"aria-selected",
|
|
178
|
+
"onClick",
|
|
179
|
+
"onDblclick"
|
|
180
|
+
];
|
|
181
|
+
const _hoisted_5 = {
|
|
182
|
+
key: 0,
|
|
183
|
+
class: "as-td-select",
|
|
184
|
+
role: "gridcell"
|
|
185
|
+
};
|
|
186
|
+
const _hoisted_6 = ["aria-checked"];
|
|
187
|
+
const _hoisted_7 = {
|
|
188
|
+
key: 0,
|
|
189
|
+
class: "as-table-checkbox-tick",
|
|
190
|
+
"aria-hidden": "true"
|
|
191
|
+
};
|
|
192
|
+
const _hoisted_8 = {
|
|
193
|
+
key: 0,
|
|
194
|
+
role: "gridcell"
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/components/internal/as-window-table-base.vue
|
|
198
|
+
var as_window_table_base_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
199
|
+
__name: "as-window-table-base",
|
|
200
|
+
props: {
|
|
201
|
+
rowHeight: {
|
|
202
|
+
type: Number,
|
|
203
|
+
required: true
|
|
204
|
+
},
|
|
205
|
+
wheelRowsPerTick: {
|
|
206
|
+
type: Number,
|
|
207
|
+
required: false,
|
|
208
|
+
default: 3
|
|
209
|
+
},
|
|
210
|
+
columnMenu: {
|
|
211
|
+
type: Object,
|
|
212
|
+
required: false
|
|
213
|
+
},
|
|
214
|
+
reorderable: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
required: false,
|
|
217
|
+
default: true
|
|
218
|
+
},
|
|
219
|
+
resizable: {
|
|
220
|
+
type: Boolean,
|
|
221
|
+
required: false,
|
|
222
|
+
default: true
|
|
223
|
+
},
|
|
224
|
+
columnMinWidth: {
|
|
225
|
+
type: Number,
|
|
226
|
+
required: false,
|
|
227
|
+
default: 48
|
|
228
|
+
},
|
|
229
|
+
select: {
|
|
230
|
+
type: String,
|
|
231
|
+
required: false,
|
|
232
|
+
default: "none"
|
|
233
|
+
},
|
|
234
|
+
enterAction: {
|
|
235
|
+
type: String,
|
|
236
|
+
required: false
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
emits: [
|
|
240
|
+
"row-click",
|
|
241
|
+
"row-dblclick",
|
|
242
|
+
"viewport-metrics-change"
|
|
243
|
+
],
|
|
244
|
+
setup(__props, { emit: __emit }) {
|
|
245
|
+
const props = __props;
|
|
246
|
+
const emit = __emit;
|
|
247
|
+
const slots = (0, vue.useSlots)();
|
|
248
|
+
const { state } = require_use_table_state.useTableContext();
|
|
249
|
+
const { resolve: cellResolver, hasAnyCellBindings } = require_as_table_status.useCellResolver(() => state.tableDef.value);
|
|
250
|
+
const cellComponents = require_as_table_status.useCellComponents(() => state.columns.value);
|
|
251
|
+
const hasValue = (0, vue.computed)(() => props.select !== "none");
|
|
252
|
+
const hasActiveFilters = (0, vue.computed)(() => (0, _atscript_ui_table.filledFilterCount)(state.filters.value) > 0);
|
|
253
|
+
const selectAllState = (0, vue.computed)(() => {
|
|
254
|
+
if (props.select !== "multi") return void 0;
|
|
255
|
+
return state.selectedRows.value.length === 0 ? "none" : "some";
|
|
256
|
+
});
|
|
257
|
+
const cellSlotFlags = (0, vue.computed)(() => {
|
|
258
|
+
const out = {};
|
|
259
|
+
for (const c of state.columns.value) out[c.path] = !!slots[`cell-${c.path}`];
|
|
260
|
+
return out;
|
|
261
|
+
});
|
|
262
|
+
const rowStyle = (0, vue.computed)(() => ({ height: `${props.rowHeight}px` }));
|
|
263
|
+
const visibleSlots = (0, vue.computed)(() => {
|
|
264
|
+
const viewport = state.viewportRowCount.value;
|
|
265
|
+
if (viewport <= 0) return [];
|
|
266
|
+
const total = state.totalCount.value;
|
|
267
|
+
const count = Math.min(viewport, Math.max(total, 0));
|
|
268
|
+
const top = state.topIndex.value;
|
|
269
|
+
const rowValueFn = state.rowValueFn;
|
|
270
|
+
const hasSelection = props.select !== "none";
|
|
271
|
+
const selectedSet = hasSelection ? new Set(state.selectedRows.value) : null;
|
|
272
|
+
const out = [];
|
|
273
|
+
for (let s = 0; s < count; s++) {
|
|
274
|
+
const abs = top + s;
|
|
275
|
+
const row = state.dataAt(abs);
|
|
276
|
+
const pk = row === void 0 ? void 0 : rowValueFn(row);
|
|
277
|
+
const selected = selectedSet !== null && row !== void 0 && selectedSet.has(pk);
|
|
278
|
+
out.push({
|
|
279
|
+
s,
|
|
280
|
+
row,
|
|
281
|
+
pk,
|
|
282
|
+
errored: row === void 0 && state.errorAt(abs) !== null,
|
|
283
|
+
selected,
|
|
284
|
+
ariaSelected: hasSelection ? selected ? "true" : "false" : void 0
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
return out;
|
|
288
|
+
});
|
|
289
|
+
function clamp(n) {
|
|
290
|
+
return (0, _atscript_ui_table.clampTopIndex)(n, state.totalCount.value, state.viewportRowCount.value);
|
|
291
|
+
}
|
|
292
|
+
let pendingTopIndex = null;
|
|
293
|
+
const topIndexBatch = require_as_table_status.useRafBatch((next) => {
|
|
294
|
+
pendingTopIndex = null;
|
|
295
|
+
if (next !== state.topIndex.value) state.topIndex.value = next;
|
|
296
|
+
});
|
|
297
|
+
function scheduleTopIndex(next) {
|
|
298
|
+
if (next === (pendingTopIndex ?? state.topIndex.value)) return;
|
|
299
|
+
pendingTopIndex = next;
|
|
300
|
+
topIndexBatch.schedule(next);
|
|
301
|
+
}
|
|
302
|
+
const prevNavMode = state.navMode.value;
|
|
303
|
+
state.navMode.value = "window";
|
|
304
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
305
|
+
state.viewportRowCount.value = 0;
|
|
306
|
+
state.navMode.value = prevNavMode;
|
|
307
|
+
});
|
|
308
|
+
function onWheel(event) {
|
|
309
|
+
event.preventDefault();
|
|
310
|
+
const delta = Math.sign(event.deltaY) * props.wheelRowsPerTick;
|
|
311
|
+
scheduleTopIndex(clamp((pendingTopIndex ?? state.topIndex.value) + delta));
|
|
312
|
+
}
|
|
313
|
+
function onKeydown(event) {
|
|
314
|
+
state.handleNavKey(event, {
|
|
315
|
+
enterAction: props.enterAction,
|
|
316
|
+
mode: props.select
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
(0, vue.watch)([() => state.activeIndex.value, () => state.viewportRowCount.value], ([idx, viewport]) => {
|
|
320
|
+
if (idx < 0) return;
|
|
321
|
+
if (viewport <= 0) return;
|
|
322
|
+
const top = pendingTopIndex ?? state.topIndex.value;
|
|
323
|
+
if (idx < top) scheduleTopIndex(clamp(idx));
|
|
324
|
+
else if (idx >= top + viewport) scheduleTopIndex(clamp(idx - viewport + 1));
|
|
325
|
+
});
|
|
326
|
+
let touchStartY = null;
|
|
327
|
+
let touchStartTopIndex = 0;
|
|
328
|
+
function onTouchStart(event) {
|
|
329
|
+
const touch = event.touches[0];
|
|
330
|
+
if (!touch) return;
|
|
331
|
+
touchStartY = touch.clientY;
|
|
332
|
+
touchStartTopIndex = state.topIndex.value;
|
|
333
|
+
}
|
|
334
|
+
function onTouchMove(event) {
|
|
335
|
+
const touch = event.touches[0];
|
|
336
|
+
if (touch === void 0 || touchStartY === null) return;
|
|
337
|
+
if (props.rowHeight <= 0) return;
|
|
338
|
+
const delta = touchStartY - touch.clientY;
|
|
339
|
+
const rowsDelta = Math.trunc(delta / props.rowHeight);
|
|
340
|
+
state.topIndex.value = clamp(touchStartTopIndex + rowsDelta);
|
|
341
|
+
}
|
|
342
|
+
function onTouchEnd() {
|
|
343
|
+
touchStartY = null;
|
|
344
|
+
}
|
|
345
|
+
function onRowClick(row, event, absIdx) {
|
|
346
|
+
emit("row-click", row, event);
|
|
347
|
+
state.setActive(absIdx);
|
|
348
|
+
if (props.select === "none") return;
|
|
349
|
+
state.toggleActiveSelection(props.select);
|
|
350
|
+
}
|
|
351
|
+
function onRowDblClick(row, event, absIdx) {
|
|
352
|
+
emit("row-dblclick", row, event);
|
|
353
|
+
state.setActive(absIdx);
|
|
354
|
+
state.requestMainAction(event);
|
|
355
|
+
}
|
|
356
|
+
function onSelectAllToggle(headerState) {
|
|
357
|
+
if (headerState === "none") {
|
|
358
|
+
const pks = [];
|
|
359
|
+
for (const row of state.windowCache.value.values()) pks.push(state.rowValueFn(row));
|
|
360
|
+
state.selectedRows.value = pks;
|
|
361
|
+
} else state.selectedRows.value = [];
|
|
362
|
+
}
|
|
363
|
+
const { onSort, onHide, onFilter, onFiltersOff, onResetWidth, onReorder, onClearFilters } = require_use_table_column_handlers.useTableColumnHandlers(state);
|
|
364
|
+
const wrapperRef = (0, vue.ref)(null);
|
|
365
|
+
const poolRef = (0, vue.ref)(null);
|
|
366
|
+
let recomputeScheduled = false;
|
|
367
|
+
function scheduleRecompute() {
|
|
368
|
+
if (recomputeScheduled) return;
|
|
369
|
+
recomputeScheduled = true;
|
|
370
|
+
(0, vue.nextTick)(() => {
|
|
371
|
+
recomputeScheduled = false;
|
|
372
|
+
recompute();
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function recompute() {
|
|
376
|
+
const wrapper = wrapperRef.value;
|
|
377
|
+
const tbody = poolRef.value;
|
|
378
|
+
if (!wrapper) return;
|
|
379
|
+
const wrapperClient = wrapper.clientHeight;
|
|
380
|
+
const wrapperOffset = wrapper.offsetHeight;
|
|
381
|
+
const hScrollbar = Math.max(0, wrapperOffset - wrapperClient);
|
|
382
|
+
const tbodyHeight = tbody?.offsetHeight ?? 0;
|
|
383
|
+
const table = tbody?.parentElement;
|
|
384
|
+
const tableHeight = table?.offsetHeight ?? 0;
|
|
385
|
+
const theadHeight = table && tbody ? Math.max(0, tableHeight - tbodyHeight) : wrapper.querySelector("thead")?.offsetHeight ?? 0;
|
|
386
|
+
const chromePx = theadHeight + hScrollbar;
|
|
387
|
+
const usable = Math.max(0, wrapperClient - theadHeight);
|
|
388
|
+
const rowCount = tbody?.children.length ?? 0;
|
|
389
|
+
const rowHeightPx = (rowCount > 0 && tbodyHeight > 0 ? Math.ceil(tbodyHeight / rowCount) : 0) || props.rowHeight;
|
|
390
|
+
emit("viewport-metrics-change", {
|
|
391
|
+
fits: Math.max(0, Math.floor(usable / rowHeightPx)),
|
|
392
|
+
rowHeightPx,
|
|
393
|
+
chromePx
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
(0, _vueuse_core.useResizeObserver)(wrapperRef, scheduleRecompute);
|
|
397
|
+
(0, _vueuse_core.useResizeObserver)(poolRef, scheduleRecompute);
|
|
398
|
+
(0, vue.onMounted)(() => {
|
|
399
|
+
(0, vue.nextTick)(() => recompute());
|
|
400
|
+
});
|
|
401
|
+
(0, vue.watch)(() => [props.rowHeight, state.columns.value], scheduleRecompute);
|
|
402
|
+
return (_ctx, _cache) => {
|
|
403
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$1, [(0, vue.createElementVNode)("div", {
|
|
404
|
+
ref_key: "wrapperRef",
|
|
405
|
+
ref: wrapperRef,
|
|
406
|
+
class: "as-window-table-wrapper"
|
|
407
|
+
}, [
|
|
408
|
+
(0, vue.createElementVNode)("table", {
|
|
409
|
+
class: "as-table as-table-stretch",
|
|
410
|
+
role: "grid",
|
|
411
|
+
"aria-rowcount": (0, vue.unref)(state).totalCount.value + 1,
|
|
412
|
+
"aria-multiselectable": __props.select === "multi" ? "true" : void 0
|
|
413
|
+
}, [(0, vue.createVNode)(require_as_table_status.as_table_header_default, {
|
|
414
|
+
columns: (0, vue.unref)(state).columns.value,
|
|
415
|
+
sorters: (0, vue.unref)(state).sorters.value,
|
|
416
|
+
filters: (0, vue.unref)(state).filters.value,
|
|
417
|
+
"column-menu": __props.columnMenu,
|
|
418
|
+
"column-widths": (0, vue.unref)(state).columnWidths.value,
|
|
419
|
+
reorderable: __props.reorderable,
|
|
420
|
+
resizable: __props.resizable,
|
|
421
|
+
"column-min-width": __props.columnMinWidth,
|
|
422
|
+
"has-select-column": hasValue.value,
|
|
423
|
+
"select-all-state": selectAllState.value,
|
|
424
|
+
"with-filler": true,
|
|
425
|
+
"enable-auto-fit": true,
|
|
426
|
+
"aria-rowindex": 1,
|
|
427
|
+
onSort: (0, vue.unref)(onSort),
|
|
428
|
+
onHide: (0, vue.unref)(onHide),
|
|
429
|
+
onFilter: (0, vue.unref)(onFilter),
|
|
430
|
+
onFiltersOff: (0, vue.unref)(onFiltersOff),
|
|
431
|
+
onResetWidth: (0, vue.unref)(onResetWidth),
|
|
432
|
+
onReorder: (0, vue.unref)(onReorder),
|
|
433
|
+
onResize: (0, vue.unref)(state).setColumnWidth,
|
|
434
|
+
onSelectAllToggle
|
|
435
|
+
}, (0, vue.createSlots)({ _: 2 }, [(0, vue.renderList)((0, vue.unref)(state).columns.value, (col) => {
|
|
436
|
+
return {
|
|
437
|
+
name: `header-${col.path}`,
|
|
438
|
+
fn: (0, vue.withCtx)((scope) => [(0, vue.renderSlot)(_ctx.$slots, `header-${col.path}`, (0, vue.normalizeProps)((0, vue.guardReactiveProps)(scope)))])
|
|
439
|
+
};
|
|
440
|
+
})]), 1032, [
|
|
441
|
+
"columns",
|
|
442
|
+
"sorters",
|
|
443
|
+
"filters",
|
|
444
|
+
"column-menu",
|
|
445
|
+
"column-widths",
|
|
446
|
+
"reorderable",
|
|
447
|
+
"resizable",
|
|
448
|
+
"column-min-width",
|
|
449
|
+
"has-select-column",
|
|
450
|
+
"select-all-state",
|
|
451
|
+
"onSort",
|
|
452
|
+
"onHide",
|
|
453
|
+
"onFilter",
|
|
454
|
+
"onFiltersOff",
|
|
455
|
+
"onResetWidth",
|
|
456
|
+
"onReorder",
|
|
457
|
+
"onResize"
|
|
458
|
+
]), (0, vue.createElementVNode)("tbody", {
|
|
459
|
+
ref_key: "poolRef",
|
|
460
|
+
ref: poolRef,
|
|
461
|
+
class: "as-window-row-pool",
|
|
462
|
+
tabindex: "0",
|
|
463
|
+
"aria-activedescendant": (0, vue.unref)(state).activeIndex.value >= 0 ? (0, vue.unref)(state).rowId((0, vue.unref)(state).activeIndex.value) : "",
|
|
464
|
+
onWheel,
|
|
465
|
+
onKeydown,
|
|
466
|
+
onTouchstart: onTouchStart,
|
|
467
|
+
onTouchmove: (0, vue.withModifiers)(onTouchMove, ["prevent"]),
|
|
468
|
+
onTouchend: onTouchEnd
|
|
469
|
+
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(visibleSlots.value, (slot) => {
|
|
470
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: `slot-${slot.s}` }, [slot.row !== void 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("tr", {
|
|
471
|
+
key: 0,
|
|
472
|
+
id: (0, vue.unref)(state).rowId((0, vue.unref)(state).topIndex.value + slot.s),
|
|
473
|
+
class: (0, vue.normalizeClass)(["as-window-data-row", { "as-table-row-active": (0, vue.unref)(state).activeIndex.value === (0, vue.unref)(state).topIndex.value + slot.s }]),
|
|
474
|
+
role: "row",
|
|
475
|
+
"aria-rowindex": (0, vue.unref)(state).topIndex.value + slot.s + 2,
|
|
476
|
+
"aria-selected": slot.ariaSelected,
|
|
477
|
+
style: (0, vue.normalizeStyle)(rowStyle.value),
|
|
478
|
+
onClick: ($event) => onRowClick(slot.row, $event, (0, vue.unref)(state).topIndex.value + slot.s),
|
|
479
|
+
onDblclick: ($event) => onRowDblClick(slot.row, $event, (0, vue.unref)(state).topIndex.value + slot.s)
|
|
480
|
+
}, [
|
|
481
|
+
hasValue.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_5, [(0, vue.createElementVNode)("span", {
|
|
482
|
+
class: (0, vue.normalizeClass)(["as-table-checkbox", { "as-table-checkbox-checked": slot.selected }]),
|
|
483
|
+
role: "checkbox",
|
|
484
|
+
tabindex: "0",
|
|
485
|
+
"aria-checked": slot.selected ? "true" : "false"
|
|
486
|
+
}, [slot.selected ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_7)) : (0, vue.createCommentVNode)("v-if", true)], 10, _hoisted_6)])) : (0, vue.createCommentVNode)("v-if", true),
|
|
487
|
+
(0, vue.unref)(hasAnyCellBindings) ? ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, (0, vue.renderList)((0, vue.unref)(state).columns.value, (col) => {
|
|
488
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: col.path }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)([(0, vue.unref)(cellResolver)(col, slot.row, (0, vue.unref)(state).topIndex.value + slot.s)], (bindings) => {
|
|
489
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [cellSlotFlags.value[col.path] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", (0, vue.mergeProps)({
|
|
490
|
+
key: 0,
|
|
491
|
+
role: "gridcell"
|
|
492
|
+
}, { ref_for: true }, bindings), [(0, vue.renderSlot)(_ctx.$slots, `cell-${col.path}`, {
|
|
493
|
+
row: slot.row,
|
|
494
|
+
value: (0, vue.unref)(require_get_cell_value.getCellValue)(slot.row, col.path),
|
|
495
|
+
column: col
|
|
496
|
+
})], 16)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(cellComponents)[col.path]), (0, vue.mergeProps)({
|
|
497
|
+
key: 1,
|
|
498
|
+
row: slot.row,
|
|
499
|
+
column: col,
|
|
500
|
+
role: "gridcell"
|
|
501
|
+
}, { ref_for: true }, bindings), null, 16, ["row", "column"]))], 64);
|
|
502
|
+
}), 128))], 64);
|
|
503
|
+
}), 128)) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, (0, vue.renderList)((0, vue.unref)(state).columns.value, (col) => {
|
|
504
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: col.path }, [cellSlotFlags.value[col.path] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_8, [(0, vue.renderSlot)(_ctx.$slots, `cell-${col.path}`, {
|
|
505
|
+
row: slot.row,
|
|
506
|
+
value: (0, vue.unref)(require_get_cell_value.getCellValue)(slot.row, col.path),
|
|
507
|
+
column: col
|
|
508
|
+
})])) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(cellComponents)[col.path]), {
|
|
509
|
+
key: 1,
|
|
510
|
+
row: slot.row,
|
|
511
|
+
column: col,
|
|
512
|
+
role: "gridcell"
|
|
513
|
+
}, null, 8, ["row", "column"]))], 64);
|
|
514
|
+
}), 128)),
|
|
515
|
+
_cache[1] || (_cache[1] = (0, vue.createElementVNode)("td", {
|
|
516
|
+
class: "as-td-filler",
|
|
517
|
+
role: "gridcell"
|
|
518
|
+
}, null, -1))
|
|
519
|
+
], 46, _hoisted_4)) : ((0, vue.openBlock)(), (0, vue.createBlock)(as_window_skeleton_row_default, {
|
|
520
|
+
key: 1,
|
|
521
|
+
columns: (0, vue.unref)(state).columns.value,
|
|
522
|
+
"row-height": __props.rowHeight,
|
|
523
|
+
"has-select": hasValue.value,
|
|
524
|
+
errored: slot.errored
|
|
525
|
+
}, null, 8, [
|
|
526
|
+
"columns",
|
|
527
|
+
"row-height",
|
|
528
|
+
"has-select",
|
|
529
|
+
"errored"
|
|
530
|
+
]))], 64);
|
|
531
|
+
}), 128))], 40, _hoisted_3)], 8, _hoisted_2),
|
|
532
|
+
(0, vue.createCommentVNode)(" Error / empty placeholders render INSIDE the wrapper so they cover\n the empty pool body when there's nothing to show; suppressed during\n a `querying` refresh because the full-table overlay covers that case. "),
|
|
533
|
+
(0, vue.createVNode)(require_as_table_status.as_table_status_default, {
|
|
534
|
+
"query-error": (0, vue.unref)(state).queryError.value,
|
|
535
|
+
"is-empty": (0, vue.unref)(state).totalCount.value === 0,
|
|
536
|
+
querying: (0, vue.unref)(state).querying.value,
|
|
537
|
+
columns: (0, vue.unref)(state).columns.value,
|
|
538
|
+
"search-term": (0, vue.unref)(state).searchTerm.value,
|
|
539
|
+
"has-active-filters": hasActiveFilters.value,
|
|
540
|
+
"on-clear-filters": (0, vue.unref)(onClearFilters),
|
|
541
|
+
"on-retry": (0, vue.unref)(state).query
|
|
542
|
+
}, {
|
|
543
|
+
error: (0, vue.withCtx)((scope) => [(0, vue.renderSlot)(_ctx.$slots, "error", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(scope)))]),
|
|
544
|
+
empty: (0, vue.withCtx)((scope) => [(0, vue.renderSlot)(_ctx.$slots, "empty", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(scope)))]),
|
|
545
|
+
_: 3
|
|
546
|
+
}, 8, [
|
|
547
|
+
"query-error",
|
|
548
|
+
"is-empty",
|
|
549
|
+
"querying",
|
|
550
|
+
"columns",
|
|
551
|
+
"search-term",
|
|
552
|
+
"has-active-filters",
|
|
553
|
+
"on-clear-filters",
|
|
554
|
+
"on-retry"
|
|
555
|
+
])
|
|
556
|
+
], 512), (0, vue.createVNode)(as_window_scrollbar_default, {
|
|
557
|
+
"top-index": (0, vue.unref)(state).topIndex.value,
|
|
558
|
+
"viewport-row-count": (0, vue.unref)(state).viewportRowCount.value,
|
|
559
|
+
"total-count": (0, vue.unref)(state).totalCount.value,
|
|
560
|
+
onTopIndexChange: _cache[0] || (_cache[0] = (v) => (0, vue.unref)(state).topIndex.value = v)
|
|
561
|
+
}, null, 8, [
|
|
562
|
+
"top-index",
|
|
563
|
+
"viewport-row-count",
|
|
564
|
+
"total-count"
|
|
565
|
+
])]);
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region src/components/as-window-table.vue?vue&type=script&setup=true&lang.ts
|
|
571
|
+
const _hoisted_1 = {
|
|
572
|
+
key: 0,
|
|
573
|
+
class: "as-table-query-overlay"
|
|
574
|
+
};
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/components/as-window-table.vue
|
|
577
|
+
var as_window_table_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
578
|
+
__name: "as-window-table",
|
|
579
|
+
props: {
|
|
580
|
+
rowHeight: {
|
|
581
|
+
type: Number,
|
|
582
|
+
required: false,
|
|
583
|
+
default: _atscript_ui_table.DEFAULT_ROW_HEIGHT_PX
|
|
584
|
+
},
|
|
585
|
+
wheelRowsPerTick: {
|
|
586
|
+
type: Number,
|
|
587
|
+
required: false,
|
|
588
|
+
default: 1
|
|
589
|
+
},
|
|
590
|
+
select: {
|
|
591
|
+
type: String,
|
|
592
|
+
required: false,
|
|
593
|
+
default: "none"
|
|
594
|
+
},
|
|
595
|
+
rows: {
|
|
596
|
+
type: Number,
|
|
597
|
+
required: false
|
|
598
|
+
},
|
|
599
|
+
minRows: {
|
|
600
|
+
type: Number,
|
|
601
|
+
required: false
|
|
602
|
+
},
|
|
603
|
+
maxRows: {
|
|
604
|
+
type: Number,
|
|
605
|
+
required: false
|
|
606
|
+
},
|
|
607
|
+
columnMenu: {
|
|
608
|
+
type: Object,
|
|
609
|
+
required: false
|
|
610
|
+
},
|
|
611
|
+
reorderable: {
|
|
612
|
+
type: Boolean,
|
|
613
|
+
required: false,
|
|
614
|
+
default: true
|
|
615
|
+
},
|
|
616
|
+
resizable: {
|
|
617
|
+
type: Boolean,
|
|
618
|
+
required: false,
|
|
619
|
+
default: true
|
|
620
|
+
},
|
|
621
|
+
columnMinWidth: {
|
|
622
|
+
type: Number,
|
|
623
|
+
required: false,
|
|
624
|
+
default: 48
|
|
625
|
+
},
|
|
626
|
+
enterAction: {
|
|
627
|
+
type: String,
|
|
628
|
+
required: false
|
|
629
|
+
},
|
|
630
|
+
rowDelete: {
|
|
631
|
+
type: [Boolean, Object],
|
|
632
|
+
required: false,
|
|
633
|
+
default: false
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
emits: [
|
|
637
|
+
"row-click",
|
|
638
|
+
"row-dblclick",
|
|
639
|
+
"main-action",
|
|
640
|
+
"error"
|
|
641
|
+
],
|
|
642
|
+
setup(__props, { emit: __emit }) {
|
|
643
|
+
const props = __props;
|
|
644
|
+
const emit = __emit;
|
|
645
|
+
const { state } = require_use_table_state.useTableContext();
|
|
646
|
+
(0, vue.watch)(() => props.rowDelete, (val) => {
|
|
647
|
+
state.rowDelete.value = val;
|
|
648
|
+
}, { immediate: true });
|
|
649
|
+
require_as_table_status.useSelectModeReset(state, () => props.select);
|
|
650
|
+
require_use_table_state.useRegisterMainActionListener(state, (req) => emit("main-action", req.row, req.absIndex, req.event), require_use_table_column_handlers.useHasEmitListener("onMainAction"));
|
|
651
|
+
const containerRef = (0, vue.ref)(null);
|
|
652
|
+
function onMetrics({ fits, rowHeightPx, chromePx }) {
|
|
653
|
+
const minR = props.rows ?? props.minRows;
|
|
654
|
+
const maxR = props.rows ?? props.maxRows;
|
|
655
|
+
let target = fits;
|
|
656
|
+
if (minR !== void 0 && target < minR) target = minR;
|
|
657
|
+
if (maxR !== void 0 && target > maxR) target = maxR;
|
|
658
|
+
state.viewportRowCount.value = target;
|
|
659
|
+
const clamped = (0, _atscript_ui_table.clampTopIndex)(state.topIndex.value, state.totalCount.value, target);
|
|
660
|
+
if (clamped !== state.topIndex.value) state.topIndex.value = clamped;
|
|
661
|
+
const container = containerRef.value;
|
|
662
|
+
if (!container) return;
|
|
663
|
+
const px = (n) => `${n * rowHeightPx + chromePx}px`;
|
|
664
|
+
container.style.minHeight = minR !== void 0 ? px(minR) : "";
|
|
665
|
+
container.style.maxHeight = maxR !== void 0 ? px(maxR) : "";
|
|
666
|
+
}
|
|
667
|
+
(0, vue.watch)(() => state.lastError.value, (info) => {
|
|
668
|
+
if (info) emit("error", info.error, info.kind);
|
|
669
|
+
});
|
|
670
|
+
return (_ctx, _cache) => {
|
|
671
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
672
|
+
ref_key: "containerRef",
|
|
673
|
+
ref: containerRef,
|
|
674
|
+
class: "as-table-outer-wrap"
|
|
675
|
+
}, [(0, vue.createVNode)(as_window_table_base_default, {
|
|
676
|
+
"row-height": __props.rowHeight,
|
|
677
|
+
"wheel-rows-per-tick": __props.wheelRowsPerTick,
|
|
678
|
+
"column-menu": __props.columnMenu,
|
|
679
|
+
reorderable: __props.reorderable,
|
|
680
|
+
resizable: __props.resizable,
|
|
681
|
+
"column-min-width": __props.columnMinWidth,
|
|
682
|
+
select: __props.select,
|
|
683
|
+
"enter-action": __props.enterAction,
|
|
684
|
+
onRowClick: _cache[0] || (_cache[0] = (row, ev) => emit("row-click", row, ev)),
|
|
685
|
+
onRowDblclick: _cache[1] || (_cache[1] = (row, ev) => emit("row-dblclick", row, ev)),
|
|
686
|
+
onViewportMetricsChange: onMetrics
|
|
687
|
+
}, (0, vue.createSlots)({ _: 2 }, [(0, vue.renderList)(_ctx.$slots, (_, name) => {
|
|
688
|
+
return {
|
|
689
|
+
name,
|
|
690
|
+
fn: (0, vue.withCtx)((slotProps) => [(0, vue.renderSlot)(_ctx.$slots, name, (0, vue.normalizeProps)((0, vue.guardReactiveProps)(slotProps ?? {})))])
|
|
691
|
+
};
|
|
692
|
+
})]), 1032, [
|
|
693
|
+
"row-height",
|
|
694
|
+
"wheel-rows-per-tick",
|
|
695
|
+
"column-menu",
|
|
696
|
+
"reorderable",
|
|
697
|
+
"resizable",
|
|
698
|
+
"column-min-width",
|
|
699
|
+
"select",
|
|
700
|
+
"enter-action"
|
|
701
|
+
]), (0, vue.unref)(state).querying.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1, [(0, vue.renderSlot)(_ctx.$slots, "query-loading", {}, () => [_cache[2] || (_cache[2] = (0, vue.createElementVNode)("span", {
|
|
702
|
+
class: "as-table-query-overlay-icon",
|
|
703
|
+
"aria-hidden": "true"
|
|
704
|
+
}, null, -1))])])) : (0, vue.createCommentVNode)("v-if", true)], 512);
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
//#endregion
|
|
709
|
+
Object.defineProperty(exports, "as_window_table_default", {
|
|
710
|
+
enumerable: true,
|
|
711
|
+
get: function() {
|
|
712
|
+
return as_window_table_default;
|
|
713
|
+
}
|
|
714
|
+
});
|