@dolusoft/query-table 3.18.0 → 3.20.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 +218 -0
- package/dist/cells.js.map +1 -0
- package/dist/data-table.js +283 -0
- package/dist/data-table.js.map +1 -0
- package/dist/local-DDJEp4Nn.js +88 -0
- package/dist/local-DDJEp4Nn.js.map +1 -0
- package/dist/local.js +1 -87
- package/dist/query-table.js +1 -4833
- package/dist/src-Cam4kRTd.js +4919 -0
- package/dist/src-Cam4kRTd.js.map +1 -0
- package/dist/table-context-Duuqp9Jq.js +28 -0
- package/dist/table-context-Duuqp9Jq.js.map +1 -0
- package/dist/types/cells/cell-action.vue.d.ts +16 -0
- package/dist/types/cells/cell-actions.vue.d.ts +13 -0
- package/dist/types/cells/cell-badge.vue.d.ts +17 -0
- package/dist/types/cells/cell-copy.vue.d.ts +8 -0
- package/dist/types/cells/cell-preview.vue.d.ts +8 -0
- package/dist/types/cells/cell-stack.vue.d.ts +16 -0
- package/dist/types/cells/cell-value.vue.d.ts +4 -0
- package/dist/types/cells/contract.d.ts +44 -0
- package/dist/types/cells/index.d.ts +8 -0
- package/dist/types/contract.d.ts +59 -1
- package/dist/types/core/cell-labels.d.ts +10 -0
- package/dist/types/core/table-context.d.ts +2 -0
- package/dist/types/core/table-labels.d.ts +9 -0
- package/dist/types/data-table/contract.d.ts +64 -0
- package/dist/types/data-table/data-table.vue.d.ts +31 -0
- package/dist/types/data-table/derive-dataset.d.ts +32 -0
- package/dist/types/data-table/index.d.ts +4 -0
- package/dist/types/query-table.vue.d.ts +2 -1
- package/dist/types/use-query-table.d.ts +21 -3
- package/dist/types/virtual/use-row-window.d.ts +2 -0
- package/package.json +11 -3
- package/dist/local.js.map +0 -1
- package/dist/query-table.js.map +0 -1
package/dist/cells.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { i as cellLabelDefaults, n as tableContextKey } from "./table-context-Duuqp9Jq.js";
|
|
2
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, openBlock, renderSlot, toDisplayString, unref, useSlots } from "vue";
|
|
3
|
+
//#region src/cells/cell-action.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var _hoisted_1$6 = ["data-kind"];
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/cells/cell-action.vue
|
|
7
|
+
var cell_action_default = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "CellAction",
|
|
9
|
+
__name: "cell-action",
|
|
10
|
+
props: { kind: { default: "default" } },
|
|
11
|
+
setup(__props) {
|
|
12
|
+
return (_ctx, _cache) => {
|
|
13
|
+
return openBlock(), createElementBlock("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
class: "qt-cell-action",
|
|
16
|
+
"data-kind": __props.kind
|
|
17
|
+
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$6);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/cells/cell-actions.vue?vue&type=script&setup=true&lang.ts
|
|
23
|
+
var _hoisted_1$5 = { class: "qt-cell-actions" };
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/cells/cell-actions.vue
|
|
26
|
+
var cell_actions_default = /* @__PURE__ */ defineComponent({
|
|
27
|
+
name: "CellActions",
|
|
28
|
+
__name: "cell-actions",
|
|
29
|
+
setup(__props) {
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return openBlock(), createElementBlock("span", _hoisted_1$5, [renderSlot(_ctx.$slots, "default")]);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/cells/cell-badge.vue?vue&type=script&setup=true&lang.ts
|
|
37
|
+
var _hoisted_1$4 = ["data-tone"];
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/cells/cell-badge.vue
|
|
40
|
+
var cell_badge_default = /* @__PURE__ */ defineComponent({
|
|
41
|
+
name: "CellBadge",
|
|
42
|
+
__name: "cell-badge",
|
|
43
|
+
props: {
|
|
44
|
+
text: { default: void 0 },
|
|
45
|
+
tone: { default: "neutral" }
|
|
46
|
+
},
|
|
47
|
+
setup(__props) {
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return openBlock(), createElementBlock("span", {
|
|
50
|
+
class: "qt-cell-badge",
|
|
51
|
+
"data-tone": __props.tone
|
|
52
|
+
}, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.text), 1)])], 8, _hoisted_1$4);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/core/table-labels.ts
|
|
58
|
+
/**
|
|
59
|
+
* The cell labels of the table a component sits in, read again on every
|
|
60
|
+
* call so they follow the table's `labels` prop. An entry the table leaves
|
|
61
|
+
* out, or gives as `undefined`, is the English default; outside a table
|
|
62
|
+
* every entry is (C-129). The one module of the main part the cell
|
|
63
|
+
* components import (ADR 0022, K320-6).
|
|
64
|
+
*/
|
|
65
|
+
var useCellLabels = () => {
|
|
66
|
+
const context = inject(tableContextKey, null);
|
|
67
|
+
if (!context) return () => cellLabelDefaults;
|
|
68
|
+
return () => {
|
|
69
|
+
const labels = context.labels();
|
|
70
|
+
return {
|
|
71
|
+
copyValue: labels.copyValue ?? cellLabelDefaults.copyValue,
|
|
72
|
+
previewValue: labels.previewValue ?? cellLabelDefaults.previewValue,
|
|
73
|
+
emptyValue: labels.emptyValue ?? cellLabelDefaults.emptyValue
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/cells/cell-copy.vue?vue&type=script&setup=true&lang.ts
|
|
79
|
+
var _hoisted_1$3 = { class: "qt-cell-copy" };
|
|
80
|
+
var _hoisted_2$2 = { class: "qt-cell-copy-text" };
|
|
81
|
+
var _hoisted_3$2 = ["aria-label", "title"];
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/cells/cell-copy.vue
|
|
84
|
+
var cell_copy_default = /* @__PURE__ */ defineComponent({
|
|
85
|
+
name: "CellCopy",
|
|
86
|
+
__name: "cell-copy",
|
|
87
|
+
props: { value: {} },
|
|
88
|
+
emits: ["copy"],
|
|
89
|
+
setup(__props, { emit: __emit }) {
|
|
90
|
+
const props = __props;
|
|
91
|
+
const emit = __emit;
|
|
92
|
+
const labels = useCellLabels();
|
|
93
|
+
const text = () => String(props.value);
|
|
94
|
+
const name = computed(() => labels().copyValue(text()));
|
|
95
|
+
return (_ctx, _cache) => {
|
|
96
|
+
return openBlock(), createElementBlock("span", _hoisted_1$3, [createElementVNode("code", _hoisted_2$2, toDisplayString(__props.value), 1), createElementVNode("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
class: "qt-cell-copy-button",
|
|
99
|
+
"aria-label": name.value,
|
|
100
|
+
title: name.value,
|
|
101
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("copy", text()))
|
|
102
|
+
}, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
|
|
103
|
+
class: "qt-cell-icon",
|
|
104
|
+
width: "14",
|
|
105
|
+
height: "14",
|
|
106
|
+
viewBox: "0 0 16 16",
|
|
107
|
+
fill: "none",
|
|
108
|
+
stroke: "currentColor",
|
|
109
|
+
"stroke-width": "1.5",
|
|
110
|
+
"stroke-linecap": "round",
|
|
111
|
+
"stroke-linejoin": "round",
|
|
112
|
+
"aria-hidden": "true"
|
|
113
|
+
}, [createElementVNode("rect", {
|
|
114
|
+
x: "5.5",
|
|
115
|
+
y: "5.5",
|
|
116
|
+
width: "7.5",
|
|
117
|
+
height: "7.5",
|
|
118
|
+
rx: "1.5"
|
|
119
|
+
}), createElementVNode("path", { d: "M3 10.5V4a1 1 0 0 1 1-1h6.5" })], -1)])], 8, _hoisted_3$2)]);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/cells/cell-preview.vue?vue&type=script&setup=true&lang.ts
|
|
125
|
+
var _hoisted_1$2 = { class: "qt-cell-preview" };
|
|
126
|
+
var _hoisted_2$1 = { class: "qt-cell-preview-text" };
|
|
127
|
+
var _hoisted_3$1 = ["aria-label", "title"];
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/cells/cell-preview.vue
|
|
130
|
+
var cell_preview_default = /* @__PURE__ */ defineComponent({
|
|
131
|
+
name: "CellPreview",
|
|
132
|
+
__name: "cell-preview",
|
|
133
|
+
props: { text: {} },
|
|
134
|
+
emits: ["preview"],
|
|
135
|
+
setup(__props, { emit: __emit }) {
|
|
136
|
+
const props = __props;
|
|
137
|
+
const emit = __emit;
|
|
138
|
+
const labels = useCellLabels();
|
|
139
|
+
const value = () => String(props.text);
|
|
140
|
+
const name = computed(() => labels().previewValue(value()));
|
|
141
|
+
return (_ctx, _cache) => {
|
|
142
|
+
return openBlock(), createElementBlock("span", _hoisted_1$2, [createElementVNode("span", _hoisted_2$1, toDisplayString(__props.text), 1), createElementVNode("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
class: "qt-cell-preview-button",
|
|
145
|
+
"aria-label": name.value,
|
|
146
|
+
title: name.value,
|
|
147
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("preview", value()))
|
|
148
|
+
}, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
|
|
149
|
+
class: "qt-cell-icon",
|
|
150
|
+
width: "14",
|
|
151
|
+
height: "14",
|
|
152
|
+
viewBox: "0 0 16 16",
|
|
153
|
+
fill: "none",
|
|
154
|
+
stroke: "currentColor",
|
|
155
|
+
"stroke-width": "1.5",
|
|
156
|
+
"stroke-linecap": "round",
|
|
157
|
+
"stroke-linejoin": "round",
|
|
158
|
+
"aria-hidden": "true"
|
|
159
|
+
}, [createElementVNode("path", { d: "M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8Z" }), createElementVNode("circle", {
|
|
160
|
+
cx: "8",
|
|
161
|
+
cy: "8",
|
|
162
|
+
r: "1.75"
|
|
163
|
+
})], -1)])], 8, _hoisted_3$1)]);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/cells/cell-stack.vue?vue&type=script&setup=true&lang.ts
|
|
169
|
+
var _hoisted_1$1 = { class: "qt-cell-stack" };
|
|
170
|
+
var _hoisted_2 = { class: "qt-cell-primary" };
|
|
171
|
+
var _hoisted_3 = {
|
|
172
|
+
key: 0,
|
|
173
|
+
class: "qt-cell-secondary"
|
|
174
|
+
};
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/cells/cell-stack.vue
|
|
177
|
+
var cell_stack_default = /* @__PURE__ */ defineComponent({
|
|
178
|
+
name: "CellStack",
|
|
179
|
+
__name: "cell-stack",
|
|
180
|
+
props: {
|
|
181
|
+
primary: {},
|
|
182
|
+
secondary: {}
|
|
183
|
+
},
|
|
184
|
+
setup(__props) {
|
|
185
|
+
const props = __props;
|
|
186
|
+
const slots = useSlots();
|
|
187
|
+
const hasSecondary = () => slots.secondary !== void 0 || props.secondary !== void 0 && props.secondary !== null && props.secondary !== "";
|
|
188
|
+
return (_ctx, _cache) => {
|
|
189
|
+
return openBlock(), createElementBlock("span", _hoisted_1$1, [createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "primary", {}, () => [createTextVNode(toDisplayString(__props.primary), 1)])]), hasSecondary() ? (openBlock(), createElementBlock("span", _hoisted_3, [renderSlot(_ctx.$slots, "secondary", {}, () => [createTextVNode(toDisplayString(__props.secondary), 1)])])) : createCommentVNode("", true)]);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/cells/cell-value.vue?vue&type=script&setup=true&lang.ts
|
|
195
|
+
var _hoisted_1 = {
|
|
196
|
+
key: 0,
|
|
197
|
+
class: "qt-cell-empty"
|
|
198
|
+
};
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/cells/cell-value.vue
|
|
201
|
+
var cell_value_default = /* @__PURE__ */ defineComponent({
|
|
202
|
+
name: "CellValue",
|
|
203
|
+
inheritAttrs: false,
|
|
204
|
+
__name: "cell-value",
|
|
205
|
+
props: { value: {} },
|
|
206
|
+
setup(__props) {
|
|
207
|
+
const props = __props;
|
|
208
|
+
const labels = useCellLabels();
|
|
209
|
+
const empty = () => props.value === null || props.value === void 0 || props.value === "";
|
|
210
|
+
return (_ctx, _cache) => {
|
|
211
|
+
return empty() ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(labels)().emptyValue), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(String(__props.value)), 1)], 64));
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
//#endregion
|
|
216
|
+
export { cell_action_default as CellAction, cell_actions_default as CellActions, cell_badge_default as CellBadge, cell_copy_default as CellCopy, cell_preview_default as CellPreview, cell_stack_default as CellStack, cell_value_default as CellValue };
|
|
217
|
+
|
|
218
|
+
//# sourceMappingURL=cells.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cells.js","names":["_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_createTextVNode","_toDisplayString","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_sfc_main","_hoisted_1","_useSlots","_openBlock","_createElementBlock","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode","_sfc_main","_openBlock","_createElementBlock","_toDisplayString","_unref","_Fragment","_createTextVNode","_sfc_main"],"sources":["../src/cells/cell-action.vue","../src/cells/cell-action.vue","../src/cells/cell-actions.vue","../src/cells/cell-actions.vue","../src/cells/cell-badge.vue","../src/cells/cell-badge.vue","../src/core/table-labels.ts","../src/cells/cell-copy.vue","../src/cells/cell-copy.vue","../src/cells/cell-preview.vue","../src/cells/cell-preview.vue","../src/cells/cell-stack.vue","../src/cells/cell-stack.vue","../src/cells/cell-value.vue","../src/cells/cell-value.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CellActionProps } from './contract'\n\n// Attributes and listeners (`onClick`, `aria-label`, `disabled`) fall\n// through to the button: the action is the consumer's.\ndefineOptions({ name: 'CellAction' })\n\nwithDefaults(defineProps<CellActionProps>(), { kind: 'default' })\n\ndefineSlots<{\n /** The button's text, the consumer's content (C-129). */\n default?(): unknown\n}>()\n</script>\n\n<template>\n <button type=\"button\" class=\"qt-cell-action\" :data-kind=\"kind\">\n <slot />\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport type { CellActionProps } from './contract'\n\n// Attributes and listeners (`onClick`, `aria-label`, `disabled`) fall\n// through to the button: the action is the consumer's.\ndefineOptions({ name: 'CellAction' })\n\nwithDefaults(defineProps<CellActionProps>(), { kind: 'default' })\n\ndefineSlots<{\n /** The button's text, the consumer's content (C-129). */\n default?(): unknown\n}>()\n</script>\n\n<template>\n <button type=\"button\" class=\"qt-cell-action\" :data-kind=\"kind\">\n <slot />\n </button>\n</template>\n","<script setup lang=\"ts\">\ndefineOptions({ name: 'CellActions' })\n\ndefineSlots<{\n /** The `CellAction` buttons. */\n default?(): unknown\n}>()\n</script>\n\n<template>\n <span class=\"qt-cell-actions\"><slot /></span>\n</template>\n","<script setup lang=\"ts\">\ndefineOptions({ name: 'CellActions' })\n\ndefineSlots<{\n /** The `CellAction` buttons. */\n default?(): unknown\n}>()\n</script>\n\n<template>\n <span class=\"qt-cell-actions\"><slot /></span>\n</template>\n","<script setup lang=\"ts\">\nimport type { CellBadgeProps } from './contract'\n\ndefineOptions({ name: 'CellBadge' })\n\nwithDefaults(defineProps<CellBadgeProps>(), {\n text: undefined,\n tone: 'neutral'\n})\n\ndefineSlots<{\n /** Replaces `text`. */\n default?(): unknown\n}>()\n</script>\n\n<template>\n <span class=\"qt-cell-badge\" :data-tone=\"tone\"\n ><slot>{{ text }}</slot></span\n >\n</template>\n","<script setup lang=\"ts\">\nimport type { CellBadgeProps } from './contract'\n\ndefineOptions({ name: 'CellBadge' })\n\nwithDefaults(defineProps<CellBadgeProps>(), {\n text: undefined,\n tone: 'neutral'\n})\n\ndefineSlots<{\n /** Replaces `text`. */\n default?(): unknown\n}>()\n</script>\n\n<template>\n <span class=\"qt-cell-badge\" :data-tone=\"tone\"\n ><slot>{{ text }}</slot></span\n >\n</template>\n","import { inject } from 'vue'\n\nimport { cellLabelDefaults, type CellLabels } from './cell-labels'\nimport { tableContextKey } from './table-context'\n\n/**\n * The cell labels of the table a component sits in, read again on every\n * call so they follow the table's `labels` prop. An entry the table leaves\n * out, or gives as `undefined`, is the English default; outside a table\n * every entry is (C-129). The one module of the main part the cell\n * components import (ADR 0022, K320-6).\n */\nexport const useCellLabels = (): (() => CellLabels) => {\n const context = inject(tableContextKey, null)\n if (!context) {\n return () => cellLabelDefaults\n }\n return () => {\n const labels: Partial<CellLabels> = context.labels()\n return {\n copyValue: labels.copyValue ?? cellLabelDefaults.copyValue,\n previewValue: labels.previewValue ?? cellLabelDefaults.previewValue,\n emptyValue: labels.emptyValue ?? cellLabelDefaults.emptyValue\n }\n }\n}\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport type { CellCopyProps } from './contract'\nimport { useCellLabels } from '../core/table-labels'\n\ndefineOptions({ name: 'CellCopy' })\n\nconst props = defineProps<CellCopyProps>()\n\nconst emit = defineEmits<{\n /** The button was pressed. Writing the clipboard is the consumer's (C-129). */\n copy: [value: string]\n}>()\n\nconst labels = useCellLabels()\nconst text = () => String(props.value)\n// One name for `aria-label` and `title`, computed once per change.\nconst name = computed(() => labels().copyValue(text()))\n</script>\n\n<template>\n <span class=\"qt-cell-copy\">\n <code class=\"qt-cell-copy-text\">{{ value }}</code>\n <button\n type=\"button\"\n class=\"qt-cell-copy-button\"\n :aria-label=\"name\"\n :title=\"name\"\n @click=\"emit('copy', text())\"\n >\n <svg\n class=\"qt-cell-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect x=\"5.5\" y=\"5.5\" width=\"7.5\" height=\"7.5\" rx=\"1.5\" />\n <path d=\"M3 10.5V4a1 1 0 0 1 1-1h6.5\" />\n </svg>\n </button>\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport type { CellCopyProps } from './contract'\nimport { useCellLabels } from '../core/table-labels'\n\ndefineOptions({ name: 'CellCopy' })\n\nconst props = defineProps<CellCopyProps>()\n\nconst emit = defineEmits<{\n /** The button was pressed. Writing the clipboard is the consumer's (C-129). */\n copy: [value: string]\n}>()\n\nconst labels = useCellLabels()\nconst text = () => String(props.value)\n// One name for `aria-label` and `title`, computed once per change.\nconst name = computed(() => labels().copyValue(text()))\n</script>\n\n<template>\n <span class=\"qt-cell-copy\">\n <code class=\"qt-cell-copy-text\">{{ value }}</code>\n <button\n type=\"button\"\n class=\"qt-cell-copy-button\"\n :aria-label=\"name\"\n :title=\"name\"\n @click=\"emit('copy', text())\"\n >\n <svg\n class=\"qt-cell-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect x=\"5.5\" y=\"5.5\" width=\"7.5\" height=\"7.5\" rx=\"1.5\" />\n <path d=\"M3 10.5V4a1 1 0 0 1 1-1h6.5\" />\n </svg>\n </button>\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport type { CellPreviewProps } from './contract'\nimport { useCellLabels } from '../core/table-labels'\n\ndefineOptions({ name: 'CellPreview' })\n\nconst props = defineProps<CellPreviewProps>()\n\nconst emit = defineEmits<{\n /** The button was pressed. Showing the preview is the consumer's (C-129). */\n preview: [text: string]\n}>()\n\nconst labels = useCellLabels()\nconst value = () => String(props.text)\n// One name for `aria-label` and `title`, computed once per change.\nconst name = computed(() => labels().previewValue(value()))\n</script>\n\n<template>\n <span class=\"qt-cell-preview\">\n <span class=\"qt-cell-preview-text\">{{ text }}</span>\n <button\n type=\"button\"\n class=\"qt-cell-preview-button\"\n :aria-label=\"name\"\n :title=\"name\"\n @click=\"emit('preview', value())\"\n >\n <svg\n class=\"qt-cell-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8Z\"\n />\n <circle cx=\"8\" cy=\"8\" r=\"1.75\" />\n </svg>\n </button>\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport type { CellPreviewProps } from './contract'\nimport { useCellLabels } from '../core/table-labels'\n\ndefineOptions({ name: 'CellPreview' })\n\nconst props = defineProps<CellPreviewProps>()\n\nconst emit = defineEmits<{\n /** The button was pressed. Showing the preview is the consumer's (C-129). */\n preview: [text: string]\n}>()\n\nconst labels = useCellLabels()\nconst value = () => String(props.text)\n// One name for `aria-label` and `title`, computed once per change.\nconst name = computed(() => labels().previewValue(value()))\n</script>\n\n<template>\n <span class=\"qt-cell-preview\">\n <span class=\"qt-cell-preview-text\">{{ text }}</span>\n <button\n type=\"button\"\n class=\"qt-cell-preview-button\"\n :aria-label=\"name\"\n :title=\"name\"\n @click=\"emit('preview', value())\"\n >\n <svg\n class=\"qt-cell-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8Z\"\n />\n <circle cx=\"8\" cy=\"8\" r=\"1.75\" />\n </svg>\n </button>\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport type { CellStackProps } from './contract'\n\ndefineOptions({ name: 'CellStack' })\n\nconst props = defineProps<CellStackProps>()\n\nconst slots = defineSlots<{\n /** Replaces `primary`. */\n primary?(): unknown\n /** Replaces `secondary`. */\n secondary?(): unknown\n}>()\n\nconst hasSecondary = () =>\n slots.secondary !== undefined ||\n (props.secondary !== undefined &&\n props.secondary !== null &&\n props.secondary !== '')\n</script>\n\n<template>\n <span class=\"qt-cell-stack\">\n <span class=\"qt-cell-primary\"\n ><slot name=\"primary\">{{ primary }}</slot></span\n >\n <span v-if=\"hasSecondary()\" class=\"qt-cell-secondary\"\n ><slot name=\"secondary\">{{ secondary }}</slot></span\n >\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport type { CellStackProps } from './contract'\n\ndefineOptions({ name: 'CellStack' })\n\nconst props = defineProps<CellStackProps>()\n\nconst slots = defineSlots<{\n /** Replaces `primary`. */\n primary?(): unknown\n /** Replaces `secondary`. */\n secondary?(): unknown\n}>()\n\nconst hasSecondary = () =>\n slots.secondary !== undefined ||\n (props.secondary !== undefined &&\n props.secondary !== null &&\n props.secondary !== '')\n</script>\n\n<template>\n <span class=\"qt-cell-stack\">\n <span class=\"qt-cell-primary\"\n ><slot name=\"primary\">{{ primary }}</slot></span\n >\n <span v-if=\"hasSecondary()\" class=\"qt-cell-secondary\"\n ><slot name=\"secondary\">{{ secondary }}</slot></span\n >\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport type { CellValueProps } from './contract'\nimport { useCellLabels } from '../core/table-labels'\n\n// A value is drawn as bare text, which cannot carry an attribute, so\n// CellValue takes none, whether the value is empty or not (C-128): the same\n// markup for every row, and no warning for an attribute dropped.\ndefineOptions({ name: 'CellValue', inheritAttrs: false })\n\nconst props = defineProps<CellValueProps>()\n\nconst labels = useCellLabels()\nconst empty = () =>\n props.value === null || props.value === undefined || props.value === ''\n</script>\n\n<template>\n <span v-if=\"empty()\" class=\"qt-cell-empty\">{{ labels().emptyValue }}</span>\n <template v-else>{{ String(value) }}</template>\n</template>\n","<script setup lang=\"ts\">\nimport type { CellValueProps } from './contract'\nimport { useCellLabels } from '../core/table-labels'\n\n// A value is drawn as bare text, which cannot carry an attribute, so\n// CellValue takes none, whether the value is empty or not (C-128): the same\n// markup for every row, and no warning for an attribute dropped.\ndefineOptions({ name: 'CellValue', inheritAttrs: false })\n\nconst props = defineProps<CellValueProps>()\n\nconst labels = useCellLabels()\nconst empty = () =>\n props.value === null || props.value === undefined || props.value === ''\n</script>\n\n<template>\n <span v-if=\"empty()\" class=\"qt-cell-empty\">{{ labels().emptyValue }}</span>\n <template v-else>{{ String(value) }}</template>\n</template>\n"],"mappings":";;;;;;;;;;;;GAgBE,OAAAC,UAAA,GAAAC,mBAES,UAAA;IAFD,MAAK;IAAS,OAAM;IAAkB,aAAW,QAAA;GACvDC,GAAAA,CAAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,GAAA,YAAA;;;;;;;;;;;;;;GEPV,OAAAG,UAAA,GAAAC,mBAA6C,QAA7CF,cAA6C,CAAfG,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;GEOtC,OAAAG,UAAA,GAAAC,mBAEC,QAAA;IAFK,OAAM;IAAiB,aAAW,QAAA;GACrCC,GAAAA,CAAAA,WAAuB,KAAA,QAAA,WAAA,CAAA,SAAA,CAAdC,gBAAAC,g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,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;EElB1C,MAAM,QAAQ;EAEd,MAAM,SAAS,cAAc;EAC7B,MAAM,cACJ,MAAM,UAAU,QAAQ,MAAM,UAAU,KAAA,KAAa,MAAM,UAAU;;GAIzD,OAAA,MAAK,KAAjBG,UAAA,GAAAC,mBAA2E,QAA3E,YAA2EC,gBAA7BC,MAAA,MAAA,CAAM,CAAA,CAAA,CAAG,UAAU,GAAA,CAAA,MACjEH,UAAA,GAAAC,mBAA+CG,UAAA,EAAA,KAAA,EAAA,GAAA,CAA3BC,gBAAAH,gBAAA,OAAO,QAAA,KAAK,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { r as query_table_default } from "./src-Cam4kRTd.js";
|
|
2
|
+
import { t as useLocalQuery } from "./local-DDJEp4Nn.js";
|
|
3
|
+
import { camelize, computed, createBlock, createSlots, defineComponent, getCurrentInstance, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderList, renderSlot, shallowRef, unref, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
4
|
+
import { columnTypeOf, sameQuery } from "@dolusoft/query-protocol";
|
|
5
|
+
import { defineDataset } from "@dolusoft/query-protocol/local";
|
|
6
|
+
//#region src/data-table/derive-dataset.ts
|
|
7
|
+
/**
|
|
8
|
+
* The spec of the columns: one field per column `field` (the first column of
|
|
9
|
+
* a name wins), hidden ones included, `ip` columns left out (C-118).
|
|
10
|
+
*/
|
|
11
|
+
var datasetSpecOf = (source) => {
|
|
12
|
+
const fields = [];
|
|
13
|
+
const ip = [];
|
|
14
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15
|
+
for (const column of source.columns) {
|
|
16
|
+
if (seen.has(column.field)) continue;
|
|
17
|
+
seen.add(column.field);
|
|
18
|
+
const type = columnTypeOf(column);
|
|
19
|
+
if (type === "ip") {
|
|
20
|
+
ip.push(column.field);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
fields.push({
|
|
24
|
+
name: column.field,
|
|
25
|
+
type,
|
|
26
|
+
sortable: source.sortable && column.sortable !== false,
|
|
27
|
+
filterable: source.filterable && column.filterable !== false
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const byName = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
31
|
+
fields.sort((a, b) => byName(a.name, b.name));
|
|
32
|
+
return {
|
|
33
|
+
key: source.rowKey,
|
|
34
|
+
search: [...new Set(source.search ?? [])].sort(byName),
|
|
35
|
+
fields,
|
|
36
|
+
ip: ip.sort(byName)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** Equal specs build the same dataset. */
|
|
40
|
+
var sameSpec = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
41
|
+
/** The dataset of a spec. Throws a `TypeError` for a malformed one (C-126). */
|
|
42
|
+
var datasetOf = (spec) => {
|
|
43
|
+
if (spec.key.includes(".")) throw new TypeError(`DataTable: the rowKey "${spec.key}" is not a top-level field`);
|
|
44
|
+
const fields = Object.create(null);
|
|
45
|
+
for (const field of spec.fields) fields[field.name] = {
|
|
46
|
+
type: field.type,
|
|
47
|
+
sortable: field.sortable,
|
|
48
|
+
filterable: field.filterable
|
|
49
|
+
};
|
|
50
|
+
for (const name of spec.search) {
|
|
51
|
+
if (!Object.prototype.hasOwnProperty.call(fields, name)) throw new TypeError(spec.ip.includes(name) ? `DataTable: the search field "${name}" is an ip column; only string columns are searched` : `DataTable: the search field "${name}" is not a column`);
|
|
52
|
+
fields[name] = {
|
|
53
|
+
...fields[name],
|
|
54
|
+
search: true
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return defineDataset({
|
|
58
|
+
key: spec.key,
|
|
59
|
+
fields
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/data-table/data-table.vue
|
|
64
|
+
var data_table_default = /* @__PURE__ */ defineComponent({
|
|
65
|
+
name: "DataTable",
|
|
66
|
+
inheritAttrs: false,
|
|
67
|
+
__name: "data-table",
|
|
68
|
+
props: {
|
|
69
|
+
query: { default: void 0 },
|
|
70
|
+
rows: {},
|
|
71
|
+
rowKey: {},
|
|
72
|
+
profile: { default: "tr-2" },
|
|
73
|
+
search: { default: void 0 },
|
|
74
|
+
paginate: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true
|
|
77
|
+
},
|
|
78
|
+
dataset: { default: void 0 },
|
|
79
|
+
selection: {},
|
|
80
|
+
rowPinning: {},
|
|
81
|
+
searchDebounce: {},
|
|
82
|
+
columns: {},
|
|
83
|
+
footerRows: {},
|
|
84
|
+
loading: { type: Boolean },
|
|
85
|
+
sortable: { type: Boolean },
|
|
86
|
+
filterable: { type: Boolean },
|
|
87
|
+
resizable: { type: Boolean },
|
|
88
|
+
autoWidth: { type: Boolean },
|
|
89
|
+
autoWidthMax: {},
|
|
90
|
+
reorderable: { type: Boolean },
|
|
91
|
+
filterDebounce: {},
|
|
92
|
+
pagination: {},
|
|
93
|
+
hasSubtable: { type: Boolean },
|
|
94
|
+
rowExpandable: {},
|
|
95
|
+
expandMode: {},
|
|
96
|
+
rowKind: {},
|
|
97
|
+
groupBy: {},
|
|
98
|
+
hasRightPanel: { type: Boolean },
|
|
99
|
+
labels: {},
|
|
100
|
+
virtual: { type: [Boolean, Object] },
|
|
101
|
+
rowNavigation: { type: [Boolean, Object] },
|
|
102
|
+
scrollBody: { type: Boolean },
|
|
103
|
+
header: { type: Boolean },
|
|
104
|
+
flash: { type: [Boolean, Object] }
|
|
105
|
+
},
|
|
106
|
+
emits: [
|
|
107
|
+
"update:query",
|
|
108
|
+
"update:selection",
|
|
109
|
+
"rowRightPanelClick",
|
|
110
|
+
"cellContextMenu",
|
|
111
|
+
"headerContextMenu",
|
|
112
|
+
"columnResize",
|
|
113
|
+
"update:columns",
|
|
114
|
+
"update:rowPinning",
|
|
115
|
+
"rowFocus",
|
|
116
|
+
"rowExpansionChange"
|
|
117
|
+
],
|
|
118
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
119
|
+
const props = __props;
|
|
120
|
+
const emit = __emit;
|
|
121
|
+
const slots = useSlots();
|
|
122
|
+
const start = computed((previous) => {
|
|
123
|
+
const pageSize = props.pagination?.pageSizeOptions?.[0] ?? 10;
|
|
124
|
+
return previous?.pageSize === pageSize ? previous : {
|
|
125
|
+
page: 1,
|
|
126
|
+
pageSize,
|
|
127
|
+
sort: null,
|
|
128
|
+
filters: []
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
const held = shallowRef(null);
|
|
132
|
+
watch(() => props.query !== void 0, (given) => {
|
|
133
|
+
if (given) held.value = null;
|
|
134
|
+
});
|
|
135
|
+
const query = computed(() => props.query ?? held.value ?? start.value);
|
|
136
|
+
const onQuery = (next, reason) => {
|
|
137
|
+
if (props.query === void 0) held.value = next;
|
|
138
|
+
emit("update:query", next, reason);
|
|
139
|
+
};
|
|
140
|
+
const spec = computed((previous) => {
|
|
141
|
+
const next = datasetSpecOf({
|
|
142
|
+
rowKey: props.rowKey,
|
|
143
|
+
columns: props.columns,
|
|
144
|
+
search: props.search,
|
|
145
|
+
sortable: props.sortable,
|
|
146
|
+
filterable: props.filterable
|
|
147
|
+
});
|
|
148
|
+
return previous && sameSpec(previous, next) ? previous : next;
|
|
149
|
+
});
|
|
150
|
+
const derived = computed(() => datasetOf(spec.value));
|
|
151
|
+
const dataset = computed(() => props.dataset ?? derived.value);
|
|
152
|
+
const local = useLocalQuery({
|
|
153
|
+
allRows: () => props.rows,
|
|
154
|
+
query,
|
|
155
|
+
dataset,
|
|
156
|
+
get profile() {
|
|
157
|
+
return props.profile;
|
|
158
|
+
},
|
|
159
|
+
paginate: () => props.paginate
|
|
160
|
+
});
|
|
161
|
+
const drawn = computed((previous) => {
|
|
162
|
+
const context = {
|
|
163
|
+
query: query.value,
|
|
164
|
+
dataset: dataset.value,
|
|
165
|
+
profile: props.profile,
|
|
166
|
+
paginate: props.paginate
|
|
167
|
+
};
|
|
168
|
+
const before = previous?.context;
|
|
169
|
+
const same = before !== void 0 && sameQuery(before.query, context.query) && before.dataset === context.dataset && before.profile === context.profile && before.paginate === context.paginate;
|
|
170
|
+
return {
|
|
171
|
+
rows: local.rows.value,
|
|
172
|
+
hint: same ? "live" : "snapshot",
|
|
173
|
+
context
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
const isIp = (column) => columnTypeOf(column) === "ip";
|
|
177
|
+
const closed = (column) => isIp(column) && (column.sortable !== false || column.filterable !== false);
|
|
178
|
+
const columns = computed(() => props.columns.some(closed) ? props.columns.map((column) => closed(column) ? {
|
|
179
|
+
...column,
|
|
180
|
+
sortable: false,
|
|
181
|
+
filterable: false
|
|
182
|
+
} : column) : props.columns);
|
|
183
|
+
const onColumns = (next, reason) => {
|
|
184
|
+
const drawnColumns = columns.value;
|
|
185
|
+
const originals = new Map(props.columns.filter(closed).map((column) => [column.field, column]));
|
|
186
|
+
const restored = next.map((column) => {
|
|
187
|
+
const original = originals.get(column.field);
|
|
188
|
+
if (!original || !isIp(column)) return column;
|
|
189
|
+
if (drawnColumns.includes(column)) return original;
|
|
190
|
+
const copy = { ...column };
|
|
191
|
+
for (const key of ["sortable", "filterable"]) if (key in original) copy[key] = original[key];
|
|
192
|
+
else delete copy[key];
|
|
193
|
+
return copy;
|
|
194
|
+
});
|
|
195
|
+
emit("update:columns", restored, reason);
|
|
196
|
+
};
|
|
197
|
+
const instance = getCurrentInstance();
|
|
198
|
+
const own = /* @__PURE__ */ new Set([
|
|
199
|
+
"columns",
|
|
200
|
+
"query",
|
|
201
|
+
"rows",
|
|
202
|
+
"profile",
|
|
203
|
+
"search",
|
|
204
|
+
"paginate",
|
|
205
|
+
"dataset",
|
|
206
|
+
"totalRows",
|
|
207
|
+
"cursors",
|
|
208
|
+
"infinite",
|
|
209
|
+
"rowsUpdate"
|
|
210
|
+
]);
|
|
211
|
+
const reserved = /* @__PURE__ */ new Set([
|
|
212
|
+
"key",
|
|
213
|
+
"ref",
|
|
214
|
+
"ref_for",
|
|
215
|
+
"ref_key"
|
|
216
|
+
]);
|
|
217
|
+
const passed = () => {
|
|
218
|
+
const raw = instance.vnode.props ?? {};
|
|
219
|
+
const declared = props;
|
|
220
|
+
const out = {};
|
|
221
|
+
for (const key of Object.keys(raw)) {
|
|
222
|
+
if (reserved.has(key) || key.startsWith("onVnode")) continue;
|
|
223
|
+
if (/^on[A-Z]/.test(key)) {
|
|
224
|
+
if (!/^onUpdate:(query|columns)/.test(key)) out[key] = raw[key];
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const name = camelize(key);
|
|
228
|
+
if (own.has(name)) continue;
|
|
229
|
+
if (name in declared) out[name] = declared[name];
|
|
230
|
+
else out[key] = raw[key];
|
|
231
|
+
}
|
|
232
|
+
return out;
|
|
233
|
+
};
|
|
234
|
+
const showError = () => local.error.value !== null && slots.error !== void 0;
|
|
235
|
+
const slotNames = () => Object.keys(slots).filter((name) => name !== "error" && !(name === "pagination" && !props.paginate) && !(name === "empty" && showError()));
|
|
236
|
+
const table = useTemplateRef("table");
|
|
237
|
+
__expose({
|
|
238
|
+
collapseAll: () => table.value?.collapseAll(),
|
|
239
|
+
expandAll: () => table.value?.expandAll(),
|
|
240
|
+
focusFilter: (field) => table.value?.focusFilter(field) ?? false,
|
|
241
|
+
flushPendingFilters: () => table.value?.flushPendingFilters(),
|
|
242
|
+
scrollToIndex: (index, options) => table.value?.scrollToIndex(index, options),
|
|
243
|
+
loadMore: () => table.value?.loadMore(),
|
|
244
|
+
measureColumnWidths: (fields) => table.value?.measureColumnWidths(fields) ?? {}
|
|
245
|
+
});
|
|
246
|
+
return (_ctx, _cache) => {
|
|
247
|
+
return openBlock(), createBlock(unref(query_table_default), mergeProps({
|
|
248
|
+
ref_key: "table",
|
|
249
|
+
ref: table
|
|
250
|
+
}, passed(), {
|
|
251
|
+
columns: columns.value,
|
|
252
|
+
query: query.value,
|
|
253
|
+
rows: drawn.value.rows,
|
|
254
|
+
"total-rows": unref(local).totalRows.value,
|
|
255
|
+
"rows-update": drawn.value.hint,
|
|
256
|
+
"onUpdate:query": onQuery,
|
|
257
|
+
"onUpdate:columns": onColumns
|
|
258
|
+
}), createSlots({ _: 2 }, [renderList(slotNames(), (name) => {
|
|
259
|
+
return {
|
|
260
|
+
name,
|
|
261
|
+
fn: withCtx((scope) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(scope ?? {})))])
|
|
262
|
+
};
|
|
263
|
+
}), showError() ? {
|
|
264
|
+
name: "empty",
|
|
265
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "error", { error: unref(local).error.value })]),
|
|
266
|
+
key: "0"
|
|
267
|
+
} : void 0]), 1040, [
|
|
268
|
+
"columns",
|
|
269
|
+
"query",
|
|
270
|
+
"rows",
|
|
271
|
+
"total-rows",
|
|
272
|
+
"rows-update"
|
|
273
|
+
]);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/data-table/index.ts
|
|
279
|
+
var data_table_default$1 = data_table_default;
|
|
280
|
+
//#endregion
|
|
281
|
+
export { data_table_default as DataTable, data_table_default$1 as default };
|
|
282
|
+
|
|
283
|
+
//# sourceMappingURL=data-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.js","names":["_useSlots","_openBlock","_createBlock","_unref","QueryTable","_mergeProps","_createSlots","_renderList","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_sfc_main","DataTable"],"sources":["../src/data-table/derive-dataset.ts","../src/data-table/data-table.vue","../src/data-table/data-table.vue","../src/data-table/index.ts"],"sourcesContent":["import { columnTypeOf, type ColumnType } from '@dolusoft/query-protocol'\nimport {\n defineDataset,\n type Dataset,\n type DatasetField\n} from '@dolusoft/query-protocol/local'\n\nimport type { Column } from '../contract'\n\n/** What the dataset of a `DataTable` is built from, and nothing else (C-126). */\nexport interface DatasetSpec {\n key: string\n search: string[]\n fields: Array<{\n name: string\n type: ColumnType\n sortable: boolean\n filterable: boolean\n }>\n /** The `ip` columns, left out of the fields (C-118). */\n ip: string[]\n}\n\nexport interface DatasetSource {\n rowKey: string\n columns: readonly Column[]\n search: readonly string[] | undefined\n sortable: boolean\n filterable: boolean\n}\n\n/**\n * The spec of the columns: one field per column `field` (the first column of\n * a name wins), hidden ones included, `ip` columns left out (C-118).\n */\nexport const datasetSpecOf = (source: DatasetSource): DatasetSpec => {\n const fields: DatasetSpec['fields'] = []\n const ip: string[] = []\n const seen = new Set<string>()\n for (const column of source.columns) {\n if (seen.has(column.field)) {\n continue\n }\n seen.add(column.field)\n const type = columnTypeOf(column)\n if (type === 'ip') {\n ip.push(column.field)\n continue\n }\n fields.push({\n name: column.field,\n type,\n sortable: source.sortable && column.sortable !== false,\n filterable: source.filterable && column.filterable !== false\n })\n }\n // The order of the fields and of the search means nothing to the\n // evaluator: sorted, a reordered column list gives an equal spec.\n const byName = (a: string, b: string) => (a < b ? -1 : a > b ? 1 : 0)\n fields.sort((a, b) => byName(a.name, b.name))\n return {\n key: source.rowKey,\n search: [...new Set(source.search ?? [])].sort(byName),\n fields,\n ip: ip.sort(byName)\n }\n}\n\n/** Equal specs build the same dataset. */\nexport const sameSpec = (a: DatasetSpec, b: DatasetSpec): boolean =>\n JSON.stringify(a) === JSON.stringify(b)\n\n/** The dataset of a spec. Throws a `TypeError` for a malformed one (C-126). */\nexport const datasetOf = <T>(spec: DatasetSpec): Dataset<T> => {\n // QueryTable reads `row[rowKey]` (C-26) while the evaluator reads a dotted\n // path: only a top-level name means the same field to both.\n if (spec.key.includes('.')) {\n throw new TypeError(\n `DataTable: the rowKey \"${spec.key}\" is not a top-level field`\n )\n }\n // No prototype: a field named `__proto__` or `toString` stays a field.\n const fields = Object.create(null) as Record<string, DatasetField<T>>\n for (const field of spec.fields) {\n fields[field.name] = {\n type: field.type,\n sortable: field.sortable,\n filterable: field.filterable\n }\n }\n for (const name of spec.search) {\n if (!Object.prototype.hasOwnProperty.call(fields, name)) {\n throw new TypeError(\n spec.ip.includes(name)\n ? `DataTable: the search field \"${name}\" is an ip column; only string columns are searched`\n : `DataTable: the search field \"${name}\" is not a column`\n )\n }\n fields[name] = { ...fields[name], search: true }\n }\n return defineDataset<T>({ key: spec.key, fields })\n}\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { columnTypeOf, sameQuery } from '@dolusoft/query-protocol'\nimport type { Dataset, SemanticsProfile } from '@dolusoft/query-protocol/local'\nimport {\n camelize,\n computed,\n getCurrentInstance,\n shallowRef,\n useTemplateRef,\n watch\n} from 'vue'\n\nimport type { DataTableEmits, DataTableProps, DataTableSlots } from './contract'\nimport {\n datasetOf,\n datasetSpecOf,\n sameSpec,\n type DatasetSpec\n} from './derive-dataset'\nimport type {\n Column,\n ColumnChangeReason,\n QueryChangeReason,\n QueryTableExpose,\n RowsUpdate,\n TableQuery\n} from '../contract'\nimport { QueryTable } from '../index'\nimport { useLocalQuery } from '../local'\n\n// `useLocalQuery` and `QueryTable` side by side (ADR 0021, K319-1): no\n// markup, no table state and no table behavior of its own.\ndefineOptions({ name: 'DataTable', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DataTableProps<T>>(), {\n query: undefined,\n profile: 'tr-2',\n search: undefined,\n paginate: true,\n dataset: undefined\n})\n\nconst emit = defineEmits<DataTableEmits<T>>()\n\nconst slots = defineSlots<DataTableSlots<T>>()\n\n// The query (C-125): the consumer's when given, else held here. Until the\n// first update the held query is the start query, which follows\n// `pageSizeOptions`; while the consumer gives one, the held query is dropped.\nconst start = computed<TableQuery>(previous => {\n const pageSize = props.pagination?.pageSizeOptions?.[0] ?? 10\n return previous?.pageSize === pageSize\n ? previous\n : { page: 1, pageSize, sort: null, filters: [] }\n})\nconst held = shallowRef<TableQuery | null>(null)\nwatch(\n () => props.query !== undefined,\n given => {\n if (given) {\n held.value = null\n }\n }\n)\nconst query = computed(() => props.query ?? held.value ?? start.value)\nconst onQuery = (next: TableQuery, reason: QueryChangeReason) => {\n if (props.query === undefined) {\n held.value = next\n }\n emit('update:query', next, reason)\n}\n\n// The dataset (C-126): built again only when what it is built from changes,\n// compared by value.\nconst spec = computed<DatasetSpec>(previous => {\n const next = datasetSpecOf({\n rowKey: props.rowKey,\n columns: props.columns,\n search: props.search,\n sortable: props.sortable,\n filterable: props.filterable\n })\n return previous && sameSpec(previous, next) ? previous : next\n})\nconst derived = computed(() => datasetOf<T>(spec.value))\nconst dataset = computed(() => props.dataset ?? derived.value)\n\nconst local = useLocalQuery<T>({\n allRows: () => props.rows,\n query,\n dataset,\n // Read on every evaluation, so a new profile evaluates again.\n get profile() {\n return props.profile\n },\n paginate: () => props.paginate\n})\n\n// The flash hint (C-124): a new context is a snapshot; a new page in the\n// same context comes from the source. The query is compared by value, so a\n// new but equal query object is the same context.\ninterface Context {\n query: TableQuery\n dataset: Dataset<T>\n profile: SemanticsProfile\n paginate: boolean\n}\nconst drawn = computed<{ rows: T[]; hint: RowsUpdate; context: Context }>(\n previous => {\n const context: Context = {\n query: query.value,\n dataset: dataset.value,\n profile: props.profile,\n paginate: props.paginate\n }\n const before = previous?.context\n const same =\n before !== undefined &&\n sameQuery(before.query, context.query) &&\n before.dataset === context.dataset &&\n before.profile === context.profile &&\n before.paginate === context.paginate\n return { rows: local.rows.value, hint: same ? 'live' : 'snapshot', context }\n }\n)\n\n// An `ip` column is not a field (C-118, C-126), so the table offers no sort\n// and no filter on it. `update:columns` gives the consumer's own `sortable`\n// and `filterable` back, so the change never reaches the consumer's columns.\nconst isIp = (column: Column) => columnTypeOf(column) === 'ip'\nconst closed = (column: Column) =>\n isIp(column) && (column.sortable !== false || column.filterable !== false)\nconst columns = computed(() =>\n props.columns.some(closed)\n ? props.columns.map(column =>\n closed(column)\n ? { ...column, sortable: false, filterable: false }\n : column\n )\n : props.columns\n)\nconst onColumns = (next: Column[], reason: ColumnChangeReason) => {\n const drawnColumns = columns.value\n const originals = new Map(\n props.columns.filter(closed).map(column => [column.field, column])\n )\n const restored = next.map(column => {\n const original = originals.get(column.field)\n if (!original || !isIp(column)) {\n return column\n }\n if (drawnColumns.includes(column)) {\n return original\n }\n const copy: Column = { ...column }\n for (const key of ['sortable', 'filterable'] as const) {\n if (key in original) {\n copy[key] = original[key]\n } else {\n delete copy[key]\n }\n }\n return copy\n })\n emit('update:columns', restored, reason)\n}\n\n// What the consumer gave reaches QueryTable as given; what it left out is\n// left out, so QueryTable applies its own default (C-124). A declared prop\n// is passed as Vue read it (`sortable=\"\"` is `true`); any other attribute\n// keeps its name (`data-testid`, `aria-label`).\nconst instance = getCurrentInstance()!\nconst own = new Set([\n 'columns',\n 'query',\n 'rows',\n 'profile',\n 'search',\n 'paginate',\n 'dataset',\n 'totalRows',\n 'cursors',\n 'infinite',\n 'rowsUpdate'\n])\nconst reserved = new Set(['key', 'ref', 'ref_for', 'ref_key'])\nconst passed = (): Record<string, unknown> => {\n const raw = instance.vnode.props ?? {}\n const declared = props as Record<string, unknown>\n const out: Record<string, unknown> = {}\n for (const key of Object.keys(raw)) {\n if (reserved.has(key) || key.startsWith('onVnode')) {\n continue\n }\n if (/^on[A-Z]/.test(key)) {\n // `update:query` and `update:columns`, `.once` included, are emitted\n // by DataTable itself.\n if (!/^onUpdate:(query|columns)/.test(key)) {\n out[key] = raw[key]\n }\n continue\n }\n const name = camelize(key)\n if (own.has(name)) {\n continue\n }\n if (name in declared) {\n out[name] = declared[name]\n } else {\n out[key] = raw[key]\n }\n }\n return out\n}\n\n// The slots QueryTable gets: the consumer's, without `error`, without\n// `pagination` when nothing is paged, and with `empty` replaced while the\n// evaluator reports an error and an `error` slot is given.\nconst showError = () => local.error.value !== null && slots.error !== undefined\nconst slotNames = () =>\n Object.keys(slots).filter(\n name =>\n name !== 'error' &&\n !(name === 'pagination' && !props.paginate) &&\n !(name === 'empty' && showError())\n ) as Array<keyof DataTableSlots<T>>\n\nconst table = useTemplateRef<QueryTableExpose>('table')\nconst exposed: QueryTableExpose = {\n collapseAll: () => table.value?.collapseAll(),\n expandAll: () => table.value?.expandAll(),\n focusFilter: field => table.value?.focusFilter(field) ?? false,\n flushPendingFilters: () => table.value?.flushPendingFilters(),\n scrollToIndex: (index, options) => table.value?.scrollToIndex(index, options),\n loadMore: () => table.value?.loadMore(),\n measureColumnWidths: fields => table.value?.measureColumnWidths(fields) ?? {}\n}\ndefineExpose(exposed)\n</script>\n\n<template>\n <QueryTable\n ref=\"table\"\n v-bind=\"passed()\"\n :columns=\"columns\"\n :query=\"query\"\n :rows=\"drawn.rows\"\n :total-rows=\"local.totalRows.value\"\n :rows-update=\"drawn.hint\"\n @update:query=\"onQuery\"\n @update:columns=\"onColumns\"\n >\n <template v-for=\"name in slotNames()\" :key=\"name\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope ?? {}\" />\n </template>\n <template v-if=\"showError()\" #empty>\n <slot name=\"error\" :error=\"local.error.value!\" />\n </template>\n </QueryTable>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { columnTypeOf, sameQuery } from '@dolusoft/query-protocol'\nimport type { Dataset, SemanticsProfile } from '@dolusoft/query-protocol/local'\nimport {\n camelize,\n computed,\n getCurrentInstance,\n shallowRef,\n useTemplateRef,\n watch\n} from 'vue'\n\nimport type { DataTableEmits, DataTableProps, DataTableSlots } from './contract'\nimport {\n datasetOf,\n datasetSpecOf,\n sameSpec,\n type DatasetSpec\n} from './derive-dataset'\nimport type {\n Column,\n ColumnChangeReason,\n QueryChangeReason,\n QueryTableExpose,\n RowsUpdate,\n TableQuery\n} from '../contract'\nimport { QueryTable } from '../index'\nimport { useLocalQuery } from '../local'\n\n// `useLocalQuery` and `QueryTable` side by side (ADR 0021, K319-1): no\n// markup, no table state and no table behavior of its own.\ndefineOptions({ name: 'DataTable', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DataTableProps<T>>(), {\n query: undefined,\n profile: 'tr-2',\n search: undefined,\n paginate: true,\n dataset: undefined\n})\n\nconst emit = defineEmits<DataTableEmits<T>>()\n\nconst slots = defineSlots<DataTableSlots<T>>()\n\n// The query (C-125): the consumer's when given, else held here. Until the\n// first update the held query is the start query, which follows\n// `pageSizeOptions`; while the consumer gives one, the held query is dropped.\nconst start = computed<TableQuery>(previous => {\n const pageSize = props.pagination?.pageSizeOptions?.[0] ?? 10\n return previous?.pageSize === pageSize\n ? previous\n : { page: 1, pageSize, sort: null, filters: [] }\n})\nconst held = shallowRef<TableQuery | null>(null)\nwatch(\n () => props.query !== undefined,\n given => {\n if (given) {\n held.value = null\n }\n }\n)\nconst query = computed(() => props.query ?? held.value ?? start.value)\nconst onQuery = (next: TableQuery, reason: QueryChangeReason) => {\n if (props.query === undefined) {\n held.value = next\n }\n emit('update:query', next, reason)\n}\n\n// The dataset (C-126): built again only when what it is built from changes,\n// compared by value.\nconst spec = computed<DatasetSpec>(previous => {\n const next = datasetSpecOf({\n rowKey: props.rowKey,\n columns: props.columns,\n search: props.search,\n sortable: props.sortable,\n filterable: props.filterable\n })\n return previous && sameSpec(previous, next) ? previous : next\n})\nconst derived = computed(() => datasetOf<T>(spec.value))\nconst dataset = computed(() => props.dataset ?? derived.value)\n\nconst local = useLocalQuery<T>({\n allRows: () => props.rows,\n query,\n dataset,\n // Read on every evaluation, so a new profile evaluates again.\n get profile() {\n return props.profile\n },\n paginate: () => props.paginate\n})\n\n// The flash hint (C-124): a new context is a snapshot; a new page in the\n// same context comes from the source. The query is compared by value, so a\n// new but equal query object is the same context.\ninterface Context {\n query: TableQuery\n dataset: Dataset<T>\n profile: SemanticsProfile\n paginate: boolean\n}\nconst drawn = computed<{ rows: T[]; hint: RowsUpdate; context: Context }>(\n previous => {\n const context: Context = {\n query: query.value,\n dataset: dataset.value,\n profile: props.profile,\n paginate: props.paginate\n }\n const before = previous?.context\n const same =\n before !== undefined &&\n sameQuery(before.query, context.query) &&\n before.dataset === context.dataset &&\n before.profile === context.profile &&\n before.paginate === context.paginate\n return { rows: local.rows.value, hint: same ? 'live' : 'snapshot', context }\n }\n)\n\n// An `ip` column is not a field (C-118, C-126), so the table offers no sort\n// and no filter on it. `update:columns` gives the consumer's own `sortable`\n// and `filterable` back, so the change never reaches the consumer's columns.\nconst isIp = (column: Column) => columnTypeOf(column) === 'ip'\nconst closed = (column: Column) =>\n isIp(column) && (column.sortable !== false || column.filterable !== false)\nconst columns = computed(() =>\n props.columns.some(closed)\n ? props.columns.map(column =>\n closed(column)\n ? { ...column, sortable: false, filterable: false }\n : column\n )\n : props.columns\n)\nconst onColumns = (next: Column[], reason: ColumnChangeReason) => {\n const drawnColumns = columns.value\n const originals = new Map(\n props.columns.filter(closed).map(column => [column.field, column])\n )\n const restored = next.map(column => {\n const original = originals.get(column.field)\n if (!original || !isIp(column)) {\n return column\n }\n if (drawnColumns.includes(column)) {\n return original\n }\n const copy: Column = { ...column }\n for (const key of ['sortable', 'filterable'] as const) {\n if (key in original) {\n copy[key] = original[key]\n } else {\n delete copy[key]\n }\n }\n return copy\n })\n emit('update:columns', restored, reason)\n}\n\n// What the consumer gave reaches QueryTable as given; what it left out is\n// left out, so QueryTable applies its own default (C-124). A declared prop\n// is passed as Vue read it (`sortable=\"\"` is `true`); any other attribute\n// keeps its name (`data-testid`, `aria-label`).\nconst instance = getCurrentInstance()!\nconst own = new Set([\n 'columns',\n 'query',\n 'rows',\n 'profile',\n 'search',\n 'paginate',\n 'dataset',\n 'totalRows',\n 'cursors',\n 'infinite',\n 'rowsUpdate'\n])\nconst reserved = new Set(['key', 'ref', 'ref_for', 'ref_key'])\nconst passed = (): Record<string, unknown> => {\n const raw = instance.vnode.props ?? {}\n const declared = props as Record<string, unknown>\n const out: Record<string, unknown> = {}\n for (const key of Object.keys(raw)) {\n if (reserved.has(key) || key.startsWith('onVnode')) {\n continue\n }\n if (/^on[A-Z]/.test(key)) {\n // `update:query` and `update:columns`, `.once` included, are emitted\n // by DataTable itself.\n if (!/^onUpdate:(query|columns)/.test(key)) {\n out[key] = raw[key]\n }\n continue\n }\n const name = camelize(key)\n if (own.has(name)) {\n continue\n }\n if (name in declared) {\n out[name] = declared[name]\n } else {\n out[key] = raw[key]\n }\n }\n return out\n}\n\n// The slots QueryTable gets: the consumer's, without `error`, without\n// `pagination` when nothing is paged, and with `empty` replaced while the\n// evaluator reports an error and an `error` slot is given.\nconst showError = () => local.error.value !== null && slots.error !== undefined\nconst slotNames = () =>\n Object.keys(slots).filter(\n name =>\n name !== 'error' &&\n !(name === 'pagination' && !props.paginate) &&\n !(name === 'empty' && showError())\n ) as Array<keyof DataTableSlots<T>>\n\nconst table = useTemplateRef<QueryTableExpose>('table')\nconst exposed: QueryTableExpose = {\n collapseAll: () => table.value?.collapseAll(),\n expandAll: () => table.value?.expandAll(),\n focusFilter: field => table.value?.focusFilter(field) ?? false,\n flushPendingFilters: () => table.value?.flushPendingFilters(),\n scrollToIndex: (index, options) => table.value?.scrollToIndex(index, options),\n loadMore: () => table.value?.loadMore(),\n measureColumnWidths: fields => table.value?.measureColumnWidths(fields) ?? {}\n}\ndefineExpose(exposed)\n</script>\n\n<template>\n <QueryTable\n ref=\"table\"\n v-bind=\"passed()\"\n :columns=\"columns\"\n :query=\"query\"\n :rows=\"drawn.rows\"\n :total-rows=\"local.totalRows.value\"\n :rows-update=\"drawn.hint\"\n @update:query=\"onQuery\"\n @update:columns=\"onColumns\"\n >\n <template v-for=\"name in slotNames()\" :key=\"name\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope ?? {}\" />\n </template>\n <template v-if=\"showError()\" #empty>\n <slot name=\"error\" :error=\"local.error.value!\" />\n </template>\n </QueryTable>\n</template>\n","// `DataTable`: a table for rows held in the page, `useLocalQuery` and\n// `QueryTable` composed behind their own entry (ADR 0021, P9, P14). The\n// default entry and `/local` never import it.\nimport DataTable from './data-table.vue'\n\nexport { DataTable }\nexport default DataTable\n\nexport type {\n DataTableEmits,\n DataTableOmittedProp,\n DataTableProps,\n DataTableSlots,\n ErrorSlotProps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