@adapttable/naive-ui 0.5.0 → 0.6.1
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/README.md +6 -6
- package/dist/{NaiveRowActions-BR140413.cjs → NaiveRowActions-DUlkorWa.cjs} +2 -2
- package/dist/NaiveRowActions-DUlkorWa.cjs.map +1 -0
- package/dist/{NaiveRowActions-DVyMXQJq.js → NaiveRowActions-DdHuWGCQ.js} +2 -2
- package/dist/NaiveRowActions-DdHuWGCQ.js.map +1 -0
- package/dist/assistant.cjs +360 -5
- package/dist/assistant.cjs.map +1 -0
- package/dist/assistant.js +356 -1
- package/dist/assistant.js.map +1 -0
- package/dist/batch-editing.cjs +1 -1
- package/dist/batch-editing.d.cts +1 -1
- package/dist/batch-editing.d.ts +1 -1
- package/dist/batch-editing.js +1 -1
- package/dist/cell-navigation.cjs.map +1 -1
- package/dist/cell-navigation.d.cts +1 -1
- package/dist/cell-navigation.d.cts.map +1 -1
- package/dist/cell-navigation.d.ts +1 -1
- package/dist/cell-navigation.d.ts.map +1 -1
- package/dist/cell-navigation.js.map +1 -1
- package/dist/column-layout.cjs +24 -0
- package/dist/column-layout.cjs.map +1 -0
- package/dist/column-layout.d.cts +12 -0
- package/dist/column-layout.d.cts.map +1 -0
- package/dist/column-layout.d.ts +12 -0
- package/dist/column-layout.d.ts.map +1 -0
- package/dist/column-layout.js +22 -0
- package/dist/column-layout.js.map +1 -0
- package/dist/{column-menu-GUeADLrH.cjs → column-menu-B-EhL5Ih.cjs} +3 -3
- package/dist/{column-menu-GUeADLrH.cjs.map → column-menu-B-EhL5Ih.cjs.map} +1 -1
- package/dist/{column-menu-BeNblq2u.js → column-menu-BwKtCGEo.js} +3 -3
- package/dist/{column-menu-BeNblq2u.js.map → column-menu-BwKtCGEo.js.map} +1 -1
- package/dist/column-menu.cjs +1 -1
- package/dist/column-menu.d.cts +24 -2
- package/dist/column-menu.d.cts.map +1 -0
- package/dist/column-menu.d.ts +24 -2
- package/dist/column-menu.d.ts.map +1 -0
- package/dist/column-menu.js +1 -1
- package/dist/command-palette.cjs +112 -2
- package/dist/command-palette.cjs.map +1 -0
- package/dist/command-palette.js +111 -1
- package/dist/command-palette.js.map +1 -0
- package/dist/context-menu.cjs +140 -2
- package/dist/context-menu.cjs.map +1 -0
- package/dist/context-menu.js +139 -1
- package/dist/context-menu.js.map +1 -0
- package/dist/{editing-DTOBwNI6.js → editing-Btr52gcG.js} +19 -5
- package/dist/{editing-DTOBwNI6.js.map → editing-Btr52gcG.js.map} +1 -1
- package/dist/{editing-BAUOl5Ox.cjs → editing-CIvf43jv.cjs} +23 -3
- package/dist/editing-CIvf43jv.cjs.map +1 -0
- package/dist/{editing-Dho3Y2RK.d.ts → editing-dN16BK0k.d.ts} +10 -2
- package/dist/{editing-Dho3Y2RK.d.ts.map → editing-dN16BK0k.d.ts.map} +1 -1
- package/dist/{editing-CdIoFGiK.d.cts → editing-xDGCcasQ.d.cts} +10 -2
- package/dist/{editing-CdIoFGiK.d.cts.map → editing-xDGCcasQ.d.cts.map} +1 -1
- package/dist/editing.cjs +4 -13
- package/dist/editing.d.cts +2 -2
- package/dist/editing.d.ts +2 -2
- package/dist/editing.js +2 -2
- package/dist/export-DLLCc4Lb.js +10 -0
- package/dist/export-DLLCc4Lb.js.map +1 -0
- package/dist/{export-csv.cjs → export-fT_9Xp5t.cjs} +7 -3
- package/dist/export-fT_9Xp5t.cjs.map +1 -0
- package/dist/export.cjs +2 -2
- package/dist/export.d.cts +9 -2
- package/dist/export.d.cts.map +1 -0
- package/dist/export.d.ts +9 -2
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +1 -1
- package/dist/filtering.cjs +22 -0
- package/dist/filtering.cjs.map +1 -0
- package/dist/filtering.d.cts +13 -0
- package/dist/filtering.d.cts.map +1 -0
- package/dist/filtering.d.ts +13 -0
- package/dist/filtering.d.ts.map +1 -0
- package/dist/filtering.js +21 -0
- package/dist/filtering.js.map +1 -0
- package/dist/{filters-Cy170_qU.js → filters-BxRu0r4j.js} +6 -5
- package/dist/filters-BxRu0r4j.js.map +1 -0
- package/dist/{filters-DIlfaXQJ.cjs → filters-U0LYOQjA.cjs} +5 -4
- package/dist/filters-U0LYOQjA.cjs.map +1 -0
- package/dist/filters.cjs +1 -1
- package/dist/filters.d.cts +90 -2
- package/dist/filters.d.cts.map +1 -0
- package/dist/filters.d.ts +90 -2
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +1 -1
- package/dist/grouping-panel.cjs +146 -3
- package/dist/grouping-panel.cjs.map +1 -0
- package/dist/grouping-panel.js +145 -2
- package/dist/grouping-panel.js.map +1 -0
- package/dist/header-filters.d.cts +52 -2
- package/dist/header-filters.d.cts.map +1 -0
- package/dist/header-filters.d.ts +52 -2
- package/dist/header-filters.d.ts.map +1 -0
- package/dist/index.cjs +2 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -27
- package/dist/index.js.map +1 -1
- package/dist/preset.cjs +8 -9
- package/dist/preset.cjs.map +1 -1
- package/dist/preset.js +7 -8
- package/dist/preset.js.map +1 -1
- package/dist/row-actions.cjs +1 -1
- package/dist/row-actions.js +1 -1
- package/dist/row-pinning.cjs +1 -1
- package/dist/row-pinning.js +1 -1
- package/dist/row-reorder.cjs +185 -2
- package/dist/row-reorder.cjs.map +1 -0
- package/dist/row-reorder.d.cts +2 -1
- package/dist/row-reorder.d.cts.map +1 -1
- package/dist/row-reorder.d.ts +2 -1
- package/dist/row-reorder.d.ts.map +1 -1
- package/dist/row-reorder.js +185 -1
- package/dist/row-reorder.js.map +1 -0
- package/dist/selection.cjs +8 -0
- package/dist/selection.d.cts +2 -0
- package/dist/selection.d.ts +2 -0
- package/dist/selection.js +2 -0
- package/dist/side-panel.cjs +59 -2
- package/dist/side-panel.cjs.map +1 -0
- package/dist/side-panel.js +58 -1
- package/dist/side-panel.js.map +1 -0
- package/dist/styles.css +39 -39
- package/package.json +33 -23
- package/dist/NaiveRowActions-BR140413.cjs.map +0 -1
- package/dist/NaiveRowActions-DVyMXQJq.js.map +0 -1
- package/dist/assistant-DppW6EN1.cjs +0 -380
- package/dist/assistant-DppW6EN1.cjs.map +0 -1
- package/dist/assistant-_SYRZCOi.js +0 -357
- package/dist/assistant-_SYRZCOi.js.map +0 -1
- package/dist/column-menu-DdWVP1hz.d.cts +0 -23
- package/dist/column-menu-DdWVP1hz.d.cts.map +0 -1
- package/dist/column-menu-DdWVP1hz.d.ts +0 -23
- package/dist/column-menu-DdWVP1hz.d.ts.map +0 -1
- package/dist/command-palette-4qS9viir.cjs +0 -117
- package/dist/command-palette-4qS9viir.cjs.map +0 -1
- package/dist/command-palette-CSI-tgcP.js +0 -112
- package/dist/command-palette-CSI-tgcP.js.map +0 -1
- package/dist/context-menu-CsbLaMcR.js +0 -140
- package/dist/context-menu-CsbLaMcR.js.map +0 -1
- package/dist/context-menu-qVwE9S2V.cjs +0 -145
- package/dist/context-menu-qVwE9S2V.cjs.map +0 -1
- package/dist/editing-BAUOl5Ox.cjs.map +0 -1
- package/dist/export-csv-BU39yRSN.d.ts +0 -9
- package/dist/export-csv-BU39yRSN.d.ts.map +0 -1
- package/dist/export-csv-DRDjZuQj.d.cts +0 -9
- package/dist/export-csv-DRDjZuQj.d.cts.map +0 -1
- package/dist/export-csv.cjs.map +0 -1
- package/dist/export-csv.d.cts +0 -2
- package/dist/export-csv.d.ts +0 -2
- package/dist/export-csv.js +0 -10
- package/dist/export-csv.js.map +0 -1
- package/dist/features.cjs +0 -225
- package/dist/features.d.cts +0 -41
- package/dist/features.d.ts +0 -41
- package/dist/features.js +0 -37
- package/dist/filters-ClqB1_n4.d.cts +0 -90
- package/dist/filters-ClqB1_n4.d.cts.map +0 -1
- package/dist/filters-Cy170_qU.js.map +0 -1
- package/dist/filters-DIlfaXQJ.cjs.map +0 -1
- package/dist/filters-b2ZuVZPI.d.ts +0 -90
- package/dist/filters-b2ZuVZPI.d.ts.map +0 -1
- package/dist/grouping-panel-BPaPG49S.cjs +0 -151
- package/dist/grouping-panel-BPaPG49S.cjs.map +0 -1
- package/dist/grouping-panel-CYUPSa0u.js +0 -146
- package/dist/grouping-panel-CYUPSa0u.js.map +0 -1
- package/dist/header-filters-CQg6clum.d.cts +0 -52
- package/dist/header-filters-CQg6clum.d.cts.map +0 -1
- package/dist/header-filters-CQg6clum.d.ts +0 -52
- package/dist/header-filters-CQg6clum.d.ts.map +0 -1
- package/dist/row-reorder-2Ztn7QRu.cjs +0 -191
- package/dist/row-reorder-2Ztn7QRu.cjs.map +0 -1
- package/dist/row-reorder-DBzbJ20V.js +0 -186
- package/dist/row-reorder-DBzbJ20V.js.map +0 -1
- package/dist/side-panel-Bf4zBlYZ.cjs +0 -64
- package/dist/side-panel-Bf4zBlYZ.cjs.map +0 -1
- package/dist/side-panel-CLTgXUnb.js +0 -59
- package/dist/side-panel-CLTgXUnb.js.map +0 -1
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import { r as htmlRoot, t as naiveButton } from "./button-BxXdDW7A.js";
|
|
2
|
-
import { t as naiveInput } from "./input-YgQ2d8K9.js";
|
|
3
|
-
import { t as naiveSelect } from "./select-Bgc5ttop.js";
|
|
4
|
-
import { AgentApprovalChrome, TableAssistantChrome, createAdapterAgentApprovalFeature, createAdapterTableAssistantFeature, createMenuNavigation, scheduleTick, useScopeActivity } from "@adapttable/vue/adapter";
|
|
5
|
-
import { defineComponent, h, shallowRef, watch } from "vue";
|
|
6
|
-
import { NCard, NDrawer, NDrawerContent, NPopover, NTag, useThemeVars } from "naive-ui";
|
|
7
|
-
//#region src/assistant/ExamplesMenu.ts
|
|
8
|
-
/** One shortcut as a menu item: its icon, title and optional description. */
|
|
9
|
-
function shortcut(item, choose) {
|
|
10
|
-
return naiveButton({
|
|
11
|
-
key: item.id,
|
|
12
|
-
role: "menuitem",
|
|
13
|
-
tabindex: -1,
|
|
14
|
-
"data-adapttable-part": item.part,
|
|
15
|
-
class: "adapttable-naive-assistant-shortcut",
|
|
16
|
-
onClick: () => choose(item.id)
|
|
17
|
-
}, [item.icon, h("span", [h("strong", item.title), item.description ? h("small", item.description) : null])], { text: true });
|
|
18
|
-
}
|
|
19
|
-
/** The open menu: a Naive UI card holding one menu item per shortcut. */
|
|
20
|
-
function menuCard(props, card, keydown, choose) {
|
|
21
|
-
const items = props.items.map((item) => shortcut(item, choose));
|
|
22
|
-
return h(NCard, {
|
|
23
|
-
ref: card,
|
|
24
|
-
size: "small",
|
|
25
|
-
role: "menu",
|
|
26
|
-
"aria-label": props.label,
|
|
27
|
-
class: "adapttable-naive-assistant-menu",
|
|
28
|
-
contentStyle: {
|
|
29
|
-
display: "flex",
|
|
30
|
-
flexDirection: "column",
|
|
31
|
-
gap: "4px"
|
|
32
|
-
},
|
|
33
|
-
style: {
|
|
34
|
-
maxHeight: props.maxHeight,
|
|
35
|
-
overflowY: "auto"
|
|
36
|
-
},
|
|
37
|
-
onKeydown: keydown
|
|
38
|
-
}, { default: () => items });
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The assistant's shortcuts in a Naive UI popover menu under its trigger.
|
|
42
|
-
* The shared menu navigation moves focus; Escape and Tab close the menu and
|
|
43
|
-
* Escape returns focus to the trigger.
|
|
44
|
-
*/
|
|
45
|
-
const NaiveExamplesMenu = defineComponent((props) => {
|
|
46
|
-
const active = useScopeActivity();
|
|
47
|
-
const open = shallowRef(false);
|
|
48
|
-
const trigger = shallowRef(null);
|
|
49
|
-
const card = shallowRef(null);
|
|
50
|
-
const navigation = createMenuNavigation();
|
|
51
|
-
let generation = 0;
|
|
52
|
-
watch([
|
|
53
|
-
active,
|
|
54
|
-
() => props.disabled,
|
|
55
|
-
() => props.items,
|
|
56
|
-
() => props.onSelect
|
|
57
|
-
], () => {
|
|
58
|
-
generation++;
|
|
59
|
-
open.value = false;
|
|
60
|
-
}, { flush: "sync" });
|
|
61
|
-
watch(open, (expanded) => {
|
|
62
|
-
navigation.reset();
|
|
63
|
-
if (!expanded) return;
|
|
64
|
-
scheduleTick(() => {
|
|
65
|
-
(card.value ? htmlRoot(card.value) : null)?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: true });
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
const close = (restore) => {
|
|
69
|
-
open.value = false;
|
|
70
|
-
if (restore) trigger.value?.focus({ preventScroll: true });
|
|
71
|
-
};
|
|
72
|
-
const keydown = (event) => {
|
|
73
|
-
const panel = event.currentTarget;
|
|
74
|
-
if (!(panel instanceof HTMLElement)) return;
|
|
75
|
-
const items = [...panel.querySelectorAll("[role=\"menuitem\"]")];
|
|
76
|
-
const focusTargets = items;
|
|
77
|
-
const action = navigation.key(event, items.map((item) => ({
|
|
78
|
-
label: item.textContent ?? "",
|
|
79
|
-
disabled: item.disabled
|
|
80
|
-
})), focusTargets.indexOf(panel.ownerDocument.activeElement));
|
|
81
|
-
if (!action) return;
|
|
82
|
-
if (action.kind !== "close" || action.key !== "Tab") event.preventDefault();
|
|
83
|
-
event.stopPropagation();
|
|
84
|
-
if (action.kind === "close") close(action.key === "Escape");
|
|
85
|
-
else items[action.index]?.focus({ preventScroll: true });
|
|
86
|
-
};
|
|
87
|
-
return () => {
|
|
88
|
-
if (!active.value) return null;
|
|
89
|
-
const ticket = generation;
|
|
90
|
-
const choose = (id) => {
|
|
91
|
-
if (!active.value || props.disabled || ticket !== generation || !props.items.some((item) => item.id === id)) return;
|
|
92
|
-
close(false);
|
|
93
|
-
props.onSelect(id);
|
|
94
|
-
};
|
|
95
|
-
return h(NPopover, {
|
|
96
|
-
trigger: "manual",
|
|
97
|
-
show: open.value,
|
|
98
|
-
placement: "bottom-start",
|
|
99
|
-
showArrow: false,
|
|
100
|
-
raw: true,
|
|
101
|
-
onClickoutside: (event) => {
|
|
102
|
-
if (event.target instanceof Node && trigger.value?.contains(event.target)) return;
|
|
103
|
-
close(false);
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
trigger: () => naiveButton({
|
|
107
|
-
ref: (element) => {
|
|
108
|
-
trigger.value = element;
|
|
109
|
-
},
|
|
110
|
-
disabled: props.disabled,
|
|
111
|
-
"aria-label": props.label,
|
|
112
|
-
"aria-haspopup": "menu",
|
|
113
|
-
"aria-expanded": open.value,
|
|
114
|
-
title: props.label,
|
|
115
|
-
class: props.className,
|
|
116
|
-
"data-adapttable-part": props.part,
|
|
117
|
-
onClick: () => {
|
|
118
|
-
if (active.value && !props.disabled) open.value = !open.value;
|
|
119
|
-
}
|
|
120
|
-
}, [props.icon ?? props.label]),
|
|
121
|
-
default: () => menuCard(props, card, keydown, choose)
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
}, {
|
|
125
|
-
name: "NaiveExamplesMenu",
|
|
126
|
-
props: {
|
|
127
|
-
label: { type: String },
|
|
128
|
-
part: { type: String },
|
|
129
|
-
className: { type: String },
|
|
130
|
-
icon: {
|
|
131
|
-
type: [
|
|
132
|
-
String,
|
|
133
|
-
Number,
|
|
134
|
-
Boolean,
|
|
135
|
-
Array,
|
|
136
|
-
Object
|
|
137
|
-
],
|
|
138
|
-
default: void 0
|
|
139
|
-
},
|
|
140
|
-
disabled: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
default: void 0
|
|
143
|
-
},
|
|
144
|
-
items: { type: Array },
|
|
145
|
-
onSelect: { type: Function },
|
|
146
|
-
maxHeight: { type: String }
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/assistant/Sheet.ts
|
|
151
|
-
/**
|
|
152
|
-
* Chrome chooses initial and return focus; NDrawer contains focus and owns
|
|
153
|
-
* the portal. Escape and mask dismissal become one close request to the
|
|
154
|
-
* host, and the drawer stays open until the host closes it.
|
|
155
|
-
*/
|
|
156
|
-
const NaiveAssistantSheet = defineComponent((props) => {
|
|
157
|
-
const active = useScopeActivity();
|
|
158
|
-
const requestClose = () => {
|
|
159
|
-
if (active.value && props.open) props.onClose();
|
|
160
|
-
};
|
|
161
|
-
const keydown = (event) => {
|
|
162
|
-
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing) return;
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
event.stopPropagation();
|
|
165
|
-
requestClose();
|
|
166
|
-
};
|
|
167
|
-
return () => {
|
|
168
|
-
if (!active.value) return null;
|
|
169
|
-
return h(NDrawer, {
|
|
170
|
-
show: props.open,
|
|
171
|
-
placement: props.dir === "rtl" ? "left" : "right",
|
|
172
|
-
width: "min(28rem, 100vw)",
|
|
173
|
-
autoFocus: false,
|
|
174
|
-
closeOnEsc: false,
|
|
175
|
-
maskClosable: false,
|
|
176
|
-
role: "dialog",
|
|
177
|
-
"aria-modal": "true",
|
|
178
|
-
"aria-label": props.label,
|
|
179
|
-
dir: props.dir,
|
|
180
|
-
class: ["adapttable-naive-assistant-sheet", props.className],
|
|
181
|
-
"data-adapttable-part": props.part,
|
|
182
|
-
onKeydown: keydown,
|
|
183
|
-
onMaskClick: requestClose
|
|
184
|
-
}, { default: () => h(NDrawerContent, {}, { default: () => props.children }) });
|
|
185
|
-
};
|
|
186
|
-
}, {
|
|
187
|
-
name: "NaiveAssistantSheet",
|
|
188
|
-
props: {
|
|
189
|
-
label: { type: String },
|
|
190
|
-
part: { type: String },
|
|
191
|
-
className: { type: String },
|
|
192
|
-
dir: { type: String },
|
|
193
|
-
open: {
|
|
194
|
-
type: Boolean,
|
|
195
|
-
default: void 0
|
|
196
|
-
},
|
|
197
|
-
onClose: { type: Function },
|
|
198
|
-
children: {
|
|
199
|
-
type: [
|
|
200
|
-
String,
|
|
201
|
-
Number,
|
|
202
|
-
Boolean,
|
|
203
|
-
Array,
|
|
204
|
-
Object
|
|
205
|
-
],
|
|
206
|
-
default: void 0
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/assistant/controls.ts
|
|
212
|
-
/** Naive UI tag types for the assistant's status tones. */
|
|
213
|
-
const TAG_TYPE = {
|
|
214
|
-
neutral: "default",
|
|
215
|
-
busy: "info",
|
|
216
|
-
warning: "warning",
|
|
217
|
-
danger: "error"
|
|
218
|
-
};
|
|
219
|
-
const surface = (props, classes) => h(NCard, {
|
|
220
|
-
size: "small",
|
|
221
|
-
role: "region",
|
|
222
|
-
"data-adapttable-part": props.part,
|
|
223
|
-
"aria-label": props.label,
|
|
224
|
-
class: classes,
|
|
225
|
-
style: props.style,
|
|
226
|
-
contentStyle: {
|
|
227
|
-
display: "flex",
|
|
228
|
-
flexDirection: "column",
|
|
229
|
-
minHeight: 0
|
|
230
|
-
}
|
|
231
|
-
}, { default: () => props.children });
|
|
232
|
-
const naiveAssistantControls = {
|
|
233
|
-
Button: (props) => naiveButton({
|
|
234
|
-
"data-adapttable-part": props.part,
|
|
235
|
-
"aria-label": props.label,
|
|
236
|
-
"aria-expanded": props.expanded,
|
|
237
|
-
title: props.tooltip,
|
|
238
|
-
class: props.className,
|
|
239
|
-
disabled: props.disabled,
|
|
240
|
-
onClick: props.onClick
|
|
241
|
-
}, [props.icon, props.iconOnly && props.icon ? null : props.children ?? props.label], { size: props.part === "assistant-launcher" ? "medium" : "small" }),
|
|
242
|
-
Composer: (props) => naiveInput({
|
|
243
|
-
type: "textarea",
|
|
244
|
-
value: props.value,
|
|
245
|
-
themeOverrides: { placeholderColor: "var(--n-text-color)" },
|
|
246
|
-
attrs: {
|
|
247
|
-
"data-adapttable-part": props.part,
|
|
248
|
-
"aria-label": props.label,
|
|
249
|
-
placeholder: props.placeholder,
|
|
250
|
-
class: props.className,
|
|
251
|
-
disabled: props.disabled,
|
|
252
|
-
rows: 1,
|
|
253
|
-
onKeydown: props.onKeyDown
|
|
254
|
-
},
|
|
255
|
-
onChange: props.onChange
|
|
256
|
-
}),
|
|
257
|
-
Badge: (props) => h(NTag, {
|
|
258
|
-
"data-adapttable-part": props.part,
|
|
259
|
-
"data-tone": props.tone,
|
|
260
|
-
type: TAG_TYPE[props.tone],
|
|
261
|
-
style: props.tone === "warning" ? { color: "inherit" } : void 0,
|
|
262
|
-
size: "small",
|
|
263
|
-
bordered: false,
|
|
264
|
-
class: props.className
|
|
265
|
-
}, { default: () => props.label }),
|
|
266
|
-
Panel: (props) => surface(props, ["adapttable-naive-assistant-panel", props.className]),
|
|
267
|
-
Window: (props) => surface(props, ["adapttable-naive-assistant-window", props.className]),
|
|
268
|
-
Sheet: (props) => h(NaiveAssistantSheet, {
|
|
269
|
-
...props,
|
|
270
|
-
key: props.part
|
|
271
|
-
}),
|
|
272
|
-
Menu: (props) => h(NaiveExamplesMenu, props),
|
|
273
|
-
LanguageChip: (props) => naiveSelect({
|
|
274
|
-
attrs: {
|
|
275
|
-
"data-adapttable-part": props.part,
|
|
276
|
-
"aria-label": props.label,
|
|
277
|
-
class: props.className,
|
|
278
|
-
disabled: props.disabled
|
|
279
|
-
},
|
|
280
|
-
value: props.value,
|
|
281
|
-
options: props.options,
|
|
282
|
-
onChange: props.onChange
|
|
283
|
-
})
|
|
284
|
-
};
|
|
285
|
-
const naiveApprovalControls = {
|
|
286
|
-
Approve: naiveAssistantControls.Button,
|
|
287
|
-
Reject: naiveAssistantControls.Button,
|
|
288
|
-
Action: naiveAssistantControls.Button,
|
|
289
|
-
List: (props) => h("ul", {
|
|
290
|
-
"data-adapttable-part": props.part,
|
|
291
|
-
"aria-label": props.label,
|
|
292
|
-
class: ["adapttable-naive-approval-list", props.className]
|
|
293
|
-
}, [props.children])
|
|
294
|
-
};
|
|
295
|
-
//#endregion
|
|
296
|
-
//#region src/assistant.ts
|
|
297
|
-
const TableAssistant = defineComponent((props) => {
|
|
298
|
-
const theme = useThemeVars();
|
|
299
|
-
return () => h(TableAssistantChrome, {
|
|
300
|
-
...props,
|
|
301
|
-
accent: props.accent ?? theme.value.primaryColor,
|
|
302
|
-
slots: naiveAssistantControls
|
|
303
|
-
});
|
|
304
|
-
}, {
|
|
305
|
-
name: "NaiveTableAssistant",
|
|
306
|
-
props: {
|
|
307
|
-
assistant: { type: Object },
|
|
308
|
-
speech: { type: Object },
|
|
309
|
-
open: {
|
|
310
|
-
type: Boolean,
|
|
311
|
-
default: void 0
|
|
312
|
-
},
|
|
313
|
-
onOpenChange: { type: Function },
|
|
314
|
-
presentation: { type: String },
|
|
315
|
-
labels: { type: Object },
|
|
316
|
-
accent: { type: String },
|
|
317
|
-
receipts: {
|
|
318
|
-
type: Boolean,
|
|
319
|
-
default: void 0
|
|
320
|
-
},
|
|
321
|
-
className: { type: String },
|
|
322
|
-
launcher: {
|
|
323
|
-
type: Boolean,
|
|
324
|
-
default: void 0
|
|
325
|
-
},
|
|
326
|
-
onSettings: { type: Function },
|
|
327
|
-
boundary: { type: [String, Object] },
|
|
328
|
-
note: { type: String },
|
|
329
|
-
greeting: { type: String },
|
|
330
|
-
avatars: { type: Object },
|
|
331
|
-
messageAction: { type: Function },
|
|
332
|
-
approval: { type: Object },
|
|
333
|
-
dir: { type: String }
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
const AgentApproval = defineComponent((props) => () => h(AgentApprovalChrome, {
|
|
337
|
-
...props,
|
|
338
|
-
slots: naiveApprovalControls
|
|
339
|
-
}), {
|
|
340
|
-
name: "NaiveAgentApproval",
|
|
341
|
-
props: {
|
|
342
|
-
pending: { type: Object },
|
|
343
|
-
labels: { type: Object },
|
|
344
|
-
className: { type: String },
|
|
345
|
-
buttonClassName: { type: String }
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
function tableAssistant() {
|
|
349
|
-
return createAdapterTableAssistantFeature((props) => h(TableAssistant, props));
|
|
350
|
-
}
|
|
351
|
-
function agentApproval() {
|
|
352
|
-
return createAdapterAgentApprovalFeature((props) => h(AgentApproval, props));
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
export { tableAssistant as i, TableAssistant as n, agentApproval as r, AgentApproval as t };
|
|
356
|
-
|
|
357
|
-
//# sourceMappingURL=assistant-_SYRZCOi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-_SYRZCOi.js","names":[],"sources":["../src/assistant/ExamplesMenu.ts","../src/assistant/Sheet.ts","../src/assistant/controls.ts","../src/assistant.ts"],"sourcesContent":["import {\n createMenuNavigation,\n scheduleTick,\n type TableAssistantMenuProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport { NCard, NPopover } from \"naive-ui\";\nimport {\n type ComponentPublicInstance,\n defineComponent,\n h,\n type PropType,\n type ShallowRef,\n shallowRef,\n watch,\n} from \"vue\";\n\nimport { naiveButton } from \"../controls/button\";\nimport { htmlRoot } from \"../controls/elementTarget\";\n\n/** One shortcut as a menu item: its icon, title and optional description. */\nfunction shortcut(\n item: TableAssistantMenuProps[\"items\"][number],\n choose: (id: string) => void\n) {\n return naiveButton(\n {\n key: item.id,\n role: \"menuitem\",\n tabindex: -1,\n \"data-adapttable-part\": item.part,\n class: \"adapttable-naive-assistant-shortcut\",\n onClick: () => choose(item.id),\n },\n [\n item.icon,\n h(\"span\", [\n h(\"strong\", item.title),\n item.description ? h(\"small\", item.description) : null,\n ]),\n ],\n { text: true }\n );\n}\n\n/** The open menu: a Naive UI card holding one menu item per shortcut. */\nfunction menuCard(\n props: TableAssistantMenuProps,\n card: ShallowRef<ComponentPublicInstance | null>,\n keydown: (event: KeyboardEvent) => void,\n choose: (id: string) => void\n) {\n const items = props.items.map((item) => shortcut(item, choose));\n return h(\n NCard,\n {\n ref: card,\n size: \"small\",\n role: \"menu\",\n \"aria-label\": props.label,\n class: \"adapttable-naive-assistant-menu\",\n contentStyle: { display: \"flex\", flexDirection: \"column\", gap: \"4px\" },\n style: { maxHeight: props.maxHeight, overflowY: \"auto\" },\n onKeydown: keydown,\n },\n { default: () => items }\n );\n}\n\n/**\n * The assistant's shortcuts in a Naive UI popover menu under its trigger.\n * The shared menu navigation moves focus; Escape and Tab close the menu and\n * Escape returns focus to the trigger.\n */\nexport const NaiveExamplesMenu = defineComponent(\n (props: TableAssistantMenuProps) => {\n const active = useScopeActivity();\n const open = shallowRef(false);\n const trigger = shallowRef<HTMLElement | null>(null);\n const card = shallowRef<ComponentPublicInstance | null>(null);\n const navigation = createMenuNavigation();\n let generation = 0;\n watch(\n [active, () => props.disabled, () => props.items, () => props.onSelect],\n () => {\n generation++;\n open.value = false;\n },\n { flush: \"sync\" }\n );\n watch(open, (expanded) => {\n navigation.reset();\n if (!expanded) return;\n scheduleTick(() => {\n const panel = card.value ? htmlRoot(card.value) : null;\n panel\n ?.querySelector<HTMLElement>('[role=\"menuitem\"]')\n ?.focus({ preventScroll: true });\n });\n });\n const close = (restore: boolean) => {\n open.value = false;\n if (restore) trigger.value?.focus({ preventScroll: true });\n };\n const keydown = (event: KeyboardEvent) => {\n const panel = event.currentTarget;\n if (!(panel instanceof HTMLElement)) return;\n const items = [\n ...panel.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]'),\n ];\n const focusTargets: readonly (EventTarget | null | undefined)[] = items;\n const action = navigation.key(\n event,\n items.map((item) => ({\n label: item.textContent ?? \"\",\n disabled: item.disabled,\n })),\n focusTargets.indexOf(panel.ownerDocument.activeElement)\n );\n if (!action) return;\n if (action.kind !== \"close\" || action.key !== \"Tab\")\n event.preventDefault();\n event.stopPropagation();\n if (action.kind === \"close\") close(action.key === \"Escape\");\n else items[action.index]?.focus({ preventScroll: true });\n };\n return () => {\n if (!active.value) return null;\n const ticket = generation;\n const choose = (id: string) => {\n if (\n !active.value ||\n props.disabled ||\n ticket !== generation ||\n !props.items.some((item) => item.id === id)\n )\n return;\n close(false);\n props.onSelect(id);\n };\n return h(\n NPopover,\n {\n trigger: \"manual\",\n show: open.value,\n placement: \"bottom-start\",\n showArrow: false,\n raw: true,\n onClickoutside: (event: MouseEvent) => {\n if (\n event.target instanceof Node &&\n trigger.value?.contains(event.target)\n )\n return;\n close(false);\n },\n },\n {\n trigger: () =>\n naiveButton(\n {\n ref: (element: HTMLElement | null) => {\n trigger.value = element;\n },\n disabled: props.disabled,\n \"aria-label\": props.label,\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": open.value,\n title: props.label,\n class: props.className,\n \"data-adapttable-part\": props.part,\n onClick: () => {\n if (active.value && !props.disabled) open.value = !open.value;\n },\n },\n [props.icon ?? props.label]\n ),\n default: () => menuCard(props, card, keydown, choose),\n }\n );\n };\n },\n {\n name: \"NaiveExamplesMenu\",\n props: {\n label: { type: String as PropType<TableAssistantMenuProps[\"label\"]> },\n part: { type: String as PropType<TableAssistantMenuProps[\"part\"]> },\n className: {\n type: String as PropType<TableAssistantMenuProps[\"className\"]>,\n },\n icon: {\n type: [String, Number, Boolean, Array, Object] as PropType<\n TableAssistantMenuProps[\"icon\"]\n >,\n default: undefined,\n },\n disabled: {\n type: Boolean as PropType<TableAssistantMenuProps[\"disabled\"]>,\n default: undefined,\n },\n items: { type: Array as PropType<TableAssistantMenuProps[\"items\"]> },\n onSelect: {\n type: Function as PropType<TableAssistantMenuProps[\"onSelect\"]>,\n },\n maxHeight: {\n type: String as PropType<TableAssistantMenuProps[\"maxHeight\"]>,\n },\n },\n }\n);\n","import {\n type TableAssistantSheetProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport { NDrawer, NDrawerContent } from \"naive-ui\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\n/**\n * Chrome chooses initial and return focus; NDrawer contains focus and owns\n * the portal. Escape and mask dismissal become one close request to the\n * host, and the drawer stays open until the host closes it.\n */\nexport const NaiveAssistantSheet = defineComponent(\n (props: TableAssistantSheetProps) => {\n const active = useScopeActivity();\n const requestClose = () => {\n if (active.value && props.open) props.onClose();\n };\n const keydown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || event.isComposing)\n return;\n event.preventDefault();\n event.stopPropagation();\n requestClose();\n };\n return () => {\n if (!active.value) return null;\n return h(\n NDrawer,\n {\n show: props.open,\n placement: props.dir === \"rtl\" ? \"left\" : \"right\",\n width: \"min(28rem, 100vw)\",\n autoFocus: false,\n closeOnEsc: false,\n maskClosable: false,\n role: \"dialog\",\n \"aria-modal\": \"true\",\n \"aria-label\": props.label,\n dir: props.dir,\n class: [\"adapttable-naive-assistant-sheet\", props.className],\n \"data-adapttable-part\": props.part,\n onKeydown: keydown,\n onMaskClick: requestClose,\n },\n {\n default: () =>\n h(NDrawerContent, {}, { default: () => props.children }),\n }\n );\n };\n },\n {\n name: \"NaiveAssistantSheet\",\n props: {\n label: { type: String as PropType<TableAssistantSheetProps[\"label\"]> },\n part: { type: String as PropType<TableAssistantSheetProps[\"part\"]> },\n className: {\n type: String as PropType<TableAssistantSheetProps[\"className\"]>,\n },\n dir: { type: String as PropType<TableAssistantSheetProps[\"dir\"]> },\n open: {\n type: Boolean as PropType<TableAssistantSheetProps[\"open\"]>,\n default: undefined,\n },\n onClose: {\n type: Function as PropType<TableAssistantSheetProps[\"onClose\"]>,\n },\n children: {\n type: [String, Number, Boolean, Array, Object] as PropType<\n TableAssistantSheetProps[\"children\"]\n >,\n default: undefined,\n },\n },\n }\n);\n","import type {\n ApprovalReviewSlots,\n TableAssistantSlots,\n} from \"@adapttable/vue/adapter\";\nimport { NCard, NTag } from \"naive-ui\";\nimport { h, type StyleValue, type VNodeChild } from \"vue\";\n\nimport { naiveButton } from \"../controls/button\";\nimport { naiveInput } from \"../controls/input\";\nimport { naiveSelect } from \"../controls/select\";\nimport { NaiveExamplesMenu } from \"./ExamplesMenu\";\nimport { NaiveAssistantSheet } from \"./Sheet\";\n\n/** Naive UI tag types for the assistant's status tones. */\nconst TAG_TYPE = {\n neutral: \"default\",\n busy: \"info\",\n warning: \"warning\",\n danger: \"error\",\n} as const;\n\nconst surface = (\n props: {\n readonly part: string;\n readonly label: string;\n readonly children: VNodeChild;\n readonly style?: StyleValue;\n },\n classes: readonly (string | undefined)[]\n) =>\n h(\n NCard,\n {\n size: \"small\",\n role: \"region\",\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: classes,\n style: props.style,\n contentStyle: { display: \"flex\", flexDirection: \"column\", minHeight: 0 },\n },\n { default: () => props.children }\n );\n\nexport const naiveAssistantControls: TableAssistantSlots = {\n Button: (props) =>\n naiveButton(\n {\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n \"aria-expanded\": props.expanded,\n title: props.tooltip,\n class: props.className,\n disabled: props.disabled,\n onClick: props.onClick,\n },\n [\n props.icon,\n props.iconOnly && props.icon ? null : (props.children ?? props.label),\n ],\n { size: props.part === \"assistant-launcher\" ? \"medium\" : \"small\" }\n ),\n Composer: (props) =>\n naiveInput({\n type: \"textarea\",\n value: props.value,\n themeOverrides: { placeholderColor: \"var(--n-text-color)\" },\n attrs: {\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n placeholder: props.placeholder,\n class: props.className,\n disabled: props.disabled,\n rows: 1,\n onKeydown: props.onKeyDown,\n },\n onChange: props.onChange,\n }),\n Badge: (props) =>\n h(\n NTag,\n {\n \"data-adapttable-part\": props.part,\n \"data-tone\": props.tone,\n type: TAG_TYPE[props.tone],\n style: props.tone === \"warning\" ? { color: \"inherit\" } : undefined,\n size: \"small\",\n bordered: false,\n class: props.className,\n },\n { default: () => props.label }\n ),\n Panel: (props) =>\n surface(props, [\"adapttable-naive-assistant-panel\", props.className]),\n Window: (props) =>\n surface(props, [\"adapttable-naive-assistant-window\", props.className]),\n Sheet: (props) => h(NaiveAssistantSheet, { ...props, key: props.part }),\n Menu: (props) => h(NaiveExamplesMenu, props),\n LanguageChip: (props) =>\n naiveSelect({\n attrs: {\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: props.className,\n disabled: props.disabled,\n },\n value: props.value,\n options: props.options,\n onChange: props.onChange,\n }),\n};\n\nexport const naiveApprovalControls: ApprovalReviewSlots = {\n Approve: naiveAssistantControls.Button,\n Reject: naiveAssistantControls.Button,\n Action: naiveAssistantControls.Button,\n List: (props) =>\n h(\n \"ul\",\n {\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: [\"adapttable-naive-approval-list\", props.className],\n },\n [props.children]\n ),\n};\n","/** Optional assistant presentation; all conversation and approval state stays in the binding. */\nimport \"./assistant/assistant.css\";\n\nimport type { StaticTableFeature } from \"@adapttable/vue\";\nimport {\n AgentApprovalChrome,\n type AgentApprovalProps,\n createAdapterAgentApprovalFeature,\n createAdapterTableAssistantFeature,\n TableAssistantChrome,\n type TableAssistantProps,\n} from \"@adapttable/vue/adapter\";\nimport { useThemeVars } from \"naive-ui\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\nimport {\n naiveApprovalControls,\n naiveAssistantControls,\n} from \"./assistant/controls\";\n\nexport const TableAssistant = defineComponent(\n (props: TableAssistantProps) => {\n const theme = useThemeVars();\n return () =>\n h(TableAssistantChrome, {\n ...props,\n accent: props.accent ?? theme.value.primaryColor,\n slots: naiveAssistantControls,\n });\n },\n {\n name: \"NaiveTableAssistant\",\n props: {\n assistant: { type: Object as PropType<TableAssistantProps[\"assistant\"]> },\n speech: { type: Object as PropType<TableAssistantProps[\"speech\"]> },\n open: {\n type: Boolean as PropType<TableAssistantProps[\"open\"]>,\n default: undefined,\n },\n onOpenChange: {\n type: Function as PropType<TableAssistantProps[\"onOpenChange\"]>,\n },\n presentation: {\n type: String as PropType<TableAssistantProps[\"presentation\"]>,\n },\n labels: { type: Object as PropType<TableAssistantProps[\"labels\"]> },\n accent: { type: String as PropType<TableAssistantProps[\"accent\"]> },\n receipts: {\n type: Boolean as PropType<TableAssistantProps[\"receipts\"]>,\n default: undefined,\n },\n className: { type: String as PropType<TableAssistantProps[\"className\"]> },\n launcher: {\n type: Boolean as PropType<TableAssistantProps[\"launcher\"]>,\n default: undefined,\n },\n onSettings: {\n type: Function as PropType<TableAssistantProps[\"onSettings\"]>,\n },\n boundary: {\n type: [String, Object] as PropType<TableAssistantProps[\"boundary\"]>,\n },\n note: { type: String as PropType<TableAssistantProps[\"note\"]> },\n greeting: { type: String as PropType<TableAssistantProps[\"greeting\"]> },\n avatars: { type: Object as PropType<TableAssistantProps[\"avatars\"]> },\n messageAction: {\n type: Function as PropType<TableAssistantProps[\"messageAction\"]>,\n },\n approval: { type: Object as PropType<TableAssistantProps[\"approval\"]> },\n dir: { type: String as PropType<TableAssistantProps[\"dir\"]> },\n },\n }\n);\nexport const AgentApproval = defineComponent(\n (props: AgentApprovalProps) => () =>\n h(AgentApprovalChrome, { ...props, slots: naiveApprovalControls }),\n {\n name: \"NaiveAgentApproval\",\n props: {\n pending: { type: Object as PropType<AgentApprovalProps[\"pending\"]> },\n labels: { type: Object as PropType<AgentApprovalProps[\"labels\"]> },\n className: { type: String as PropType<AgentApprovalProps[\"className\"]> },\n buttonClassName: {\n type: String as PropType<AgentApprovalProps[\"buttonClassName\"]>,\n },\n },\n }\n);\nexport function tableAssistant(): StaticTableFeature {\n return createAdapterTableAssistantFeature((props) =>\n h(TableAssistant, props)\n );\n}\nexport function agentApproval(): StaticTableFeature {\n return createAdapterAgentApprovalFeature((props) => h(AgentApproval, props));\n}\nexport type {\n AgentApprovalProps,\n TableAssistantProps,\n} from \"@adapttable/vue/adapter\";\n"],"mappings":";;;;;;;;AAqBA,SAAS,SACP,MACA,QACA;CACA,OAAO,YACL;EACE,KAAK,KAAK;EACV,MAAM;EACN,UAAU;EACV,wBAAwB,KAAK;EAC7B,OAAO;EACP,eAAe,OAAO,KAAK,EAAE;CAC/B,GACA,CACE,KAAK,MACL,EAAE,QAAQ,CACR,EAAE,UAAU,KAAK,KAAK,GACtB,KAAK,cAAc,EAAE,SAAS,KAAK,WAAW,IAAI,IACpD,CAAC,CACH,GACA,EAAE,MAAM,KAAK,CACf;AACF;;AAGA,SAAS,SACP,OACA,MACA,SACA,QACA;CACA,MAAM,QAAQ,MAAM,MAAM,KAAK,SAAS,SAAS,MAAM,MAAM,CAAC;CAC9D,OAAO,EACL,OACA;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,cAAc,MAAM;EACpB,OAAO;EACP,cAAc;GAAE,SAAS;GAAQ,eAAe;GA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O;EACL,SAAS,EAAE,MAAM,OAAkD;EACnE,QAAQ,EAAE,MAAM,OAAiD;EACjE,WAAW,EAAE,MAAM,OAAoD;EACvE,iBAAiB,EACf,MAAM,OACR;CACF;AACF,CACF;AACA,SAAgB,iBAAqC;CACnD,OAAO,oCAAoC,UACzC,EAAE,gBAAgB,KAAK,CACzB;AACF;AACA,SAAgB,gBAAoC;CAClD,OAAO,mCAAmC,UAAU,EAAE,eAAe,KAAK,CAAC;AAC7E"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StaticTableFeature } from "@adapttable/vue";
|
|
2
|
-
import { ColumnMenuSlotProps, ColumnMenuSlotProps as ColumnMenuSlotProps$1 } from "@adapttable/vue/adapter";
|
|
3
|
-
//#region src/columns/ColumnMenu.vue.d.ts
|
|
4
|
-
declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<ColumnMenuSlotProps<TRow>> & (typeof globalThis extends {
|
|
6
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
-
} ? P : {});
|
|
8
|
-
expose: (exposed: {}) => void;
|
|
9
|
-
attrs: any;
|
|
10
|
-
slots: {};
|
|
11
|
-
emit: {};
|
|
12
|
-
}>) => import("vue").VNode & {
|
|
13
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/column-menu.d.ts
|
|
19
|
-
/** Shared column state and rename editors with genuine Naive UI controls. */
|
|
20
|
-
declare function columnMenu(): StaticTableFeature;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { columnMenu as n, _default as r, ColumnMenuSlotProps$1 as t };
|
|
23
|
-
//# sourceMappingURL=column-menu-DdWVP1hz.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-menu-DdWVP1hz.d.cts","names":[],"sources":["../src/columns/ColumnMenu.vue","../src/column-menu.ts"],"mappings":";;;cA0BM,eAAiB,MACtB,aAAa,YAAY,eAAe,wBACxC,YAAY,oBAAoB,KAAK,YAAY,eAAe,6CAChE,gBAAgB,YAAY,eAAe,yBAC3C,cAAA;EAiCO,qBAAc,cAAc,oBAAmB,oBAAA,iBAA8B;IAAqB,4BAA4B;MAAM;EACnI,SAAC;EACF;EACA;EACD;qBAGmB;EAAU,QAAQ,YAAY,eAAe;;cAClD,iBAAO;KACvB,oBAAoB,MAAM,mBAAmB,WAAW,IAAI,EAAE,WAAW,WAAW,KAAK,IAAI,EAAE;;;;iBCzDpF,cAAc"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StaticTableFeature } from "@adapttable/vue";
|
|
2
|
-
import { ColumnMenuSlotProps, ColumnMenuSlotProps as ColumnMenuSlotProps$1 } from "@adapttable/vue/adapter";
|
|
3
|
-
//#region src/columns/ColumnMenu.vue.d.ts
|
|
4
|
-
declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<ColumnMenuSlotProps<TRow>> & (typeof globalThis extends {
|
|
6
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
-
} ? P : {});
|
|
8
|
-
expose: (exposed: {}) => void;
|
|
9
|
-
attrs: any;
|
|
10
|
-
slots: {};
|
|
11
|
-
emit: {};
|
|
12
|
-
}>) => import("vue").VNode & {
|
|
13
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/column-menu.d.ts
|
|
19
|
-
/** Shared column state and rename editors with genuine Naive UI controls. */
|
|
20
|
-
declare function columnMenu(): StaticTableFeature;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { columnMenu as n, _default as r, ColumnMenuSlotProps$1 as t };
|
|
23
|
-
//# sourceMappingURL=column-menu-DdWVP1hz.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-menu-DdWVP1hz.d.ts","names":[],"sources":["../src/columns/ColumnMenu.vue","../src/column-menu.ts"],"mappings":";;;cA0BM,eAAiB,MACtB,aAAa,YAAY,eAAe,wBACxC,YAAY,oBAAoB,KAAK,YAAY,eAAe,6CAChE,gBAAgB,YAAY,eAAe,yBAC3C,cAAA;EAiCO,qBAAc,cAAc,oBAAmB,oBAAA,iBAA8B;IAAqB,4BAA4B;MAAM;EACnI,SAAC;EACF;EACA;EACD;qBAGmB;EAAU,QAAQ,YAAY,eAAe;;cAClD,iBAAO;KACvB,oBAAoB,MAAM,mBAAmB,WAAW,IAAI,EAAE,WAAW,WAAW,KAAK,IAAI,EAAE;;;;iBCzDpF,cAAc"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
const require_button = require("./button-CaakTzYM.cjs");
|
|
2
|
-
const require_input = require("./input-DZV2IoAG.cjs");
|
|
3
|
-
const require_modalEscape = require("./modalEscape-Dgmkd7NP.cjs");
|
|
4
|
-
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
5
|
-
let _adapttable_vue_features = require("@adapttable/vue/features");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
let naive_ui = require("naive-ui");
|
|
8
|
-
//#region src/actions/NaivePaletteSurface.ts
|
|
9
|
-
/** Naive owns modal autofocus, Tab trapping, and focus restoration. */
|
|
10
|
-
const NaivePaletteSurface = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
11
|
-
const card = (0, vue.shallowRef)(null);
|
|
12
|
-
const escape = require_modalEscape.useNaiveModalEscape(() => card.value ? require_button.htmlRoot(card.value) : null);
|
|
13
|
-
return () => {
|
|
14
|
-
const owner = props.control;
|
|
15
|
-
const close = () => {
|
|
16
|
-
if (owner.open && owner.isCurrent()) owner.onClose();
|
|
17
|
-
};
|
|
18
|
-
return (0, vue.h)(naive_ui.NModal, {
|
|
19
|
-
show: owner.open && owner.isCurrent(),
|
|
20
|
-
to: props.container,
|
|
21
|
-
autoFocus: true,
|
|
22
|
-
trapFocus: true,
|
|
23
|
-
"onUpdate:show": (show) => {
|
|
24
|
-
if (!show && escape.allow()) close();
|
|
25
|
-
}
|
|
26
|
-
}, { default: () => (0, vue.h)(naive_ui.NCard, {
|
|
27
|
-
ref: card,
|
|
28
|
-
role: "dialog",
|
|
29
|
-
dir: props.dir,
|
|
30
|
-
onKeydownCapture: escape.capture,
|
|
31
|
-
"aria-modal": true,
|
|
32
|
-
"aria-label": owner.label,
|
|
33
|
-
"data-adapttable-part": "command-palette",
|
|
34
|
-
class: owner.className,
|
|
35
|
-
style: {
|
|
36
|
-
width: "min(40rem,calc(100vw - 2rem))",
|
|
37
|
-
maxHeight: "75dvh",
|
|
38
|
-
overflow: "auto"
|
|
39
|
-
}
|
|
40
|
-
}, { default: () => owner.children }) });
|
|
41
|
-
};
|
|
42
|
-
}, {
|
|
43
|
-
name: "NaivePaletteSurface",
|
|
44
|
-
props: {
|
|
45
|
-
control: { type: Object },
|
|
46
|
-
container: { type: Object },
|
|
47
|
-
dir: { type: String }
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/command-palette.ts
|
|
52
|
-
const NaiveCommandPalette = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
53
|
-
const slots = {
|
|
54
|
-
Surface: (0, _adapttable_vue_adapter.managedCommandPaletteSurface)((control) => (0, vue.h)(NaivePaletteSurface, {
|
|
55
|
-
control,
|
|
56
|
-
container: props.container,
|
|
57
|
-
dir: props.dir
|
|
58
|
-
})),
|
|
59
|
-
Input: ({ inputProps }) => {
|
|
60
|
-
const { value, onChange, ref, ...attrs } = inputProps;
|
|
61
|
-
return require_input.naiveInput({
|
|
62
|
-
value,
|
|
63
|
-
onChange,
|
|
64
|
-
attrs: {
|
|
65
|
-
...(0, _adapttable_vue_adapter.toVueAttrs)(attrs),
|
|
66
|
-
ref,
|
|
67
|
-
class: props.classNames?.commandInput
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
Item: (control) => require_button.naiveButton({
|
|
72
|
-
...(0, _adapttable_vue_adapter.toVueAttrs)(control.itemProps),
|
|
73
|
-
class: props.classNames?.commandItem,
|
|
74
|
-
tabindex: -1,
|
|
75
|
-
disabled: control.command.disabled
|
|
76
|
-
}, control.command.label),
|
|
77
|
-
Empty: (control) => (0, vue.h)(naive_ui.NText, {
|
|
78
|
-
"data-adapttable-part": "command-empty",
|
|
79
|
-
class: props.classNames?.commandEmpty
|
|
80
|
-
}, { default: () => control.message })
|
|
81
|
-
};
|
|
82
|
-
return () => [props.model.button ? require_button.naiveButton({
|
|
83
|
-
"data-adapttable-part": "command-palette-button",
|
|
84
|
-
"aria-haspopup": "dialog",
|
|
85
|
-
"aria-expanded": props.model.open,
|
|
86
|
-
class: props.classNames?.commandPaletteButton,
|
|
87
|
-
onClick: props.model.show
|
|
88
|
-
}, props.labels.commandPalette) : null, (0, vue.h)(_adapttable_vue_adapter.CommandPaletteChrome, {
|
|
89
|
-
commands: props.model.commands,
|
|
90
|
-
open: props.model.open,
|
|
91
|
-
onClose: props.model.close,
|
|
92
|
-
labels: props.labels,
|
|
93
|
-
className: props.classNames?.commandPalette,
|
|
94
|
-
slots
|
|
95
|
-
})];
|
|
96
|
-
}, {
|
|
97
|
-
name: "NaiveCommandPalette",
|
|
98
|
-
props: {
|
|
99
|
-
model: { type: Object },
|
|
100
|
-
labels: { type: Object },
|
|
101
|
-
dir: { type: String },
|
|
102
|
-
classNames: { type: Object },
|
|
103
|
-
container: { type: Object }
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
function commandPalette(options = true) {
|
|
107
|
-
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.commandPalette)(options), [(0, _adapttable_vue_adapter.slotRender)(_adapttable_vue_adapter.COMMAND_PALETTE_CONTROL, (props) => (0, vue.h)(NaiveCommandPalette, props))]);
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
Object.defineProperty(exports, "commandPalette", {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function() {
|
|
113
|
-
return commandPalette;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
//# sourceMappingURL=command-palette-4qS9viir.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette-4qS9viir.cjs","names":["shallowRef","useNaiveModalEscape","htmlRoot","h","NModal","NCard","managedCommandPaletteSurface","h","naiveInput","toVueAttrs","naiveButton","NText","CommandPaletteChrome","extendFeature","bindingCommandPalette","slotRender","COMMAND_PALETTE_CONTROL"],"sources":["../src/actions/NaivePaletteSurface.ts","../src/command-palette.ts"],"sourcesContent":["import type { Direction } from \"@adapttable/vue\";\nimport type { ManagedCommandPaletteSurfaceProps } from \"@adapttable/vue/adapter\";\nimport { NCard, NModal } from \"naive-ui\";\nimport {\n type ComponentPublicInstance,\n defineComponent,\n h,\n type PropType,\n shallowRef,\n} from \"vue\";\n\nimport { htmlRoot } from \"../controls/elementTarget\";\nimport { useNaiveModalEscape } from \"../controls/modalEscape\";\n\n/** Naive owns modal autofocus, Tab trapping, and focus restoration. */\nexport const NaivePaletteSurface = /*#__PURE__*/ defineComponent(\n (props: {\n readonly control: ManagedCommandPaletteSurfaceProps;\n readonly container?: HTMLElement;\n readonly dir: Direction;\n }) => {\n const card = shallowRef<ComponentPublicInstance | null>(null);\n const escape = useNaiveModalEscape(() =>\n card.value ? htmlRoot(card.value) : null\n );\n return () => {\n const owner = props.control;\n const close = () => {\n if (owner.open && owner.isCurrent()) owner.onClose();\n };\n return h(\n NModal,\n {\n show: owner.open && owner.isCurrent(),\n to: props.container,\n autoFocus: true,\n trapFocus: true,\n \"onUpdate:show\": (show: boolean) => {\n if (!show && escape.allow()) close();\n },\n },\n {\n default: () =>\n h(\n NCard,\n {\n ref: card,\n role: \"dialog\",\n dir: props.dir,\n onKeydownCapture: escape.capture,\n \"aria-modal\": true,\n \"aria-label\": owner.label,\n \"data-adapttable-part\": \"command-palette\",\n class: owner.className,\n style: {\n width: \"min(40rem,calc(100vw - 2rem))\",\n maxHeight: \"75dvh\",\n overflow: \"auto\",\n },\n },\n { default: () => owner.children }\n ),\n }\n );\n };\n },\n {\n name: \"NaivePaletteSurface\",\n props: {\n control: { type: Object as PropType<ManagedCommandPaletteSurfaceProps> },\n container: { type: Object as PropType<HTMLElement | undefined> },\n dir: { type: String as PropType<Direction> },\n },\n }\n);\n","import type { StaticTableFeature } from \"@adapttable/vue\";\nimport {\n type ActionPresentation,\n COMMAND_PALETTE_CONTROL,\n CommandPaletteChrome,\n type CommandPaletteModel,\n type CommandPaletteSlots,\n extendFeature,\n managedCommandPaletteSurface,\n slotRender,\n toVueAttrs,\n} from \"@adapttable/vue/adapter\";\nimport { commandPalette as bindingCommandPalette } from \"@adapttable/vue/features\";\nimport { NText } from \"naive-ui\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\nimport { NaivePaletteSurface } from \"./actions/NaivePaletteSurface\";\nimport { naiveButton } from \"./controls/button\";\nimport { naiveInput } from \"./controls/input\";\n\nconst NaiveCommandPalette = /*#__PURE__*/ defineComponent(\n (props: ActionPresentation & { readonly model: CommandPaletteModel }) => {\n // A stable surface identity lets the shared controller retain queued actions.\n const slots: CommandPaletteSlots = {\n Surface: managedCommandPaletteSurface((control) =>\n h(NaivePaletteSurface, {\n control,\n container: props.container,\n dir: props.dir,\n })\n ),\n Input: ({ inputProps }) => {\n const { value, onChange, ref, ...attrs } = inputProps;\n return naiveInput({\n value,\n onChange,\n attrs: {\n ...toVueAttrs(attrs),\n ref,\n class: props.classNames?.commandInput,\n },\n });\n },\n Item: (control) =>\n naiveButton(\n {\n ...toVueAttrs(control.itemProps),\n class: props.classNames?.commandItem,\n tabindex: -1,\n disabled: control.command.disabled,\n },\n control.command.label\n ),\n Empty: (control) =>\n h(\n NText,\n {\n \"data-adapttable-part\": \"command-empty\",\n class: props.classNames?.commandEmpty,\n },\n { default: () => control.message }\n ),\n };\n return () => [\n props.model.button\n ? naiveButton(\n {\n \"data-adapttable-part\": \"command-palette-button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": props.model.open,\n class: props.classNames?.commandPaletteButton,\n onClick: props.model.show,\n },\n props.labels.commandPalette\n )\n : null,\n h(CommandPaletteChrome, {\n commands: props.model.commands,\n open: props.model.open,\n onClose: props.model.close,\n labels: props.labels,\n className: props.classNames?.commandPalette,\n slots,\n }),\n ];\n },\n {\n name: \"NaiveCommandPalette\",\n props: {\n model: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"model\"]\n >,\n },\n labels: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"labels\"]\n >,\n },\n dir: {\n type: String as PropType<\n (ActionPresentation & { readonly model: CommandPaletteModel })[\"dir\"]\n >,\n },\n classNames: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"classNames\"]\n >,\n },\n container: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"container\"]\n >,\n },\n },\n }\n);\nexport function commandPalette(\n options: Parameters<typeof bindingCommandPalette>[0] = true\n): StaticTableFeature {\n return extendFeature(bindingCommandPalette(options), [\n slotRender(COMMAND_PALETTE_CONTROL, (props) =>\n h(NaiveCommandPalette, props)\n ),\n ]);\n}\nexport type { CommandPaletteOptions } from \"@adapttable/vue/features\";\n"],"mappings":";;;;;;;;;AAeA,MAAa,sBAAoC,eAAA,GAAA,IAAA,gBAAA,EAC9C,UAIK;CACJ,MAAM,QAAA,GAAOA,IAAAA,WAAAA,CAA2C,IAAI;CAC5D,MAAM,SAASC,oBAAAA,0BACb,KAAK,QAAQC,eAAAA,SAAS,KAAK,KAAK,IAAI,IACtC;CACA,aAAa;EACX,MAAM,QAAQ,MAAM;EACpB,MAAM,cAAc;GAClB,IAAI,MAAM,QAAQ,MAAM,UAAU,GAAG,MAAM,QAAQ;EACrD;EACA,QAAA,GAAOC,IAAAA,EAAAA,CACLC,SAAAA,QACA;GACE,MAAM,MAAM,QAAQ,MAAM,UAAU;GACpC,IAAI,MAAM;GACV,WAAW;GACX,WAAW;GACX,kBAAkB,SAAkB;IAClC,IAAI,CAAC,QAAQ,OAAO,MAAM,GAAG,MAAM;GACrC;EACF,GACA,EACE,gBAAA,GACED,IAAAA,EAAAA,CACEE,SAAAA,OACA;GACE,KAAK;GACL,MAAM;GACN,KAAK,MAAM;GACX,kBAAkB,OAAO;GACzB,cAAc;GACd,cAAc,MAAM;GACpB,wBAAwB;GACxB,OAAO,MAAM;GACb,OAAO;IACL,OAAO;IACP,WAAW;IACX,UAAU;GACZ;EACF,GACA,EAAE,eAAe,MAAM,SAAS,CAClC,EACJ,CACF;CACF;AACF,GACA;CACE,MAAM;CACN,OAAO;EACL,SAAS,EAAE,MAAM,OAAsD;EACvE,WAAW,EAAE,MAAM,OAA4C;EAC/D,KAAK,EAAE,MAAM,OAA8B;CAC7C;AACF,CACF;;;ACtDA,MAAM,s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