@matdata/yasgui 4.7.4 → 4.8.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/build/ts/src/PersistentConfig.js +127 -0
- package/build/ts/src/PersistentConfig.js.map +1 -0
- package/build/ts/src/Tab.d.ts +2 -1
- package/build/ts/src/Tab.js +600 -0
- package/build/ts/src/Tab.js.map +1 -0
- package/build/ts/src/TabContextMenu.d.ts +1 -0
- package/build/ts/src/TabContextMenu.js +116 -0
- package/build/ts/src/TabContextMenu.js.map +1 -0
- package/build/ts/src/TabElements.d.ts +1 -0
- package/build/ts/src/TabElements.js +305 -0
- package/build/ts/src/TabElements.js.map +1 -0
- package/build/ts/src/TabSettingsModal.js +320 -0
- package/build/ts/src/TabSettingsModal.js.map +1 -0
- package/build/ts/src/defaults.js +59 -0
- package/build/ts/src/defaults.js.map +1 -0
- package/build/ts/src/endpointSelect.d.ts +1 -0
- package/build/ts/src/endpointSelect.js +242 -0
- package/build/ts/src/endpointSelect.js.map +1 -0
- package/build/ts/src/index.d.ts +2 -0
- package/build/ts/src/index.js +251 -0
- package/build/ts/src/index.js.map +1 -0
- package/build/ts/src/linkUtils.d.ts +1 -1
- package/build/ts/src/linkUtils.js +205 -0
- package/build/ts/src/linkUtils.js.map +1 -0
- package/build/yasgui.min.css +2 -2
- package/build/yasgui.min.css.map +7 -1
- package/build/yasgui.min.js +1125 -3
- package/build/yasgui.min.js.map +7 -1
- package/package.json +1 -1
- package/src/Tab.ts +20 -2
- package/src/TabContextMenu.ts +1 -1
- package/src/TabElements.ts +3 -3
- package/src/TabSettingsModal.ts +8 -8
- package/src/endpointSelect.ts +1 -1
- package/src/index.ts +2 -2
- package/src/linkUtils.ts +1 -1
- package/build/yasgui.html +0 -24
- package/build/yasgui.min.js.LICENSE.txt +0 -59
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { addClass, removeClass, drawSvgStringAsElement } from "@matdata/yasgui-utils";
|
|
2
|
+
import "./TabSettingsModal.scss";
|
|
3
|
+
const AcceptOptionsMap = [
|
|
4
|
+
{ key: "JSON", value: "application/sparql-results+json" },
|
|
5
|
+
{ key: "XML", value: "application/sparql-results+xml" },
|
|
6
|
+
{ key: "CSV", value: "text/csv" },
|
|
7
|
+
{ key: "TSV", value: "text/tab-separated-values" },
|
|
8
|
+
];
|
|
9
|
+
const AcceptHeaderGraphMap = [
|
|
10
|
+
{ key: "Turtle", value: "text/turtle,*/*;q=0.9" },
|
|
11
|
+
{ key: "JSON", value: "application/rdf+json,*/*;q=0.9" },
|
|
12
|
+
{ key: "RDF/XML", value: "application/rdf+xml,*/*;q=0.9" },
|
|
13
|
+
{ key: "TriG", value: "application/trig,*/*;q=0.9" },
|
|
14
|
+
{ key: "N-Triples", value: "application/n-triples,*/*;q=0.9" },
|
|
15
|
+
{ key: "N-Quads", value: "application/n-quads,*/*;q=0.9" },
|
|
16
|
+
{ key: "CSV", value: "text/csv,*/*;q=0.9" },
|
|
17
|
+
{ key: "TSV", value: "text/tab-separated-values,*/*;q=0.9" },
|
|
18
|
+
];
|
|
19
|
+
export default class TabSettingsModal {
|
|
20
|
+
constructor(tab, controlBarEl) {
|
|
21
|
+
this.tab = tab;
|
|
22
|
+
this.init(controlBarEl);
|
|
23
|
+
}
|
|
24
|
+
init(controlBarEl) {
|
|
25
|
+
this.settingsButton = document.createElement("button");
|
|
26
|
+
this.settingsButton.setAttribute("aria-label", "Settings");
|
|
27
|
+
this.settingsButton.title = "Settings";
|
|
28
|
+
this.settingsButton.appendChild(drawSvgStringAsElement(`<svg width="100.06" height="100.05" data-name="Layer 1" version="1.1" viewBox="0 0 100.06 100.05" xmlns="http://www.w3.org/2000/svg">
|
|
29
|
+
<title>Settings</title>
|
|
30
|
+
<path d="m95.868 58.018-3-3.24a42.5 42.5 0 0 0 0-9.43l3-3.22c1.79-1.91 5-4.44 4-6.85l-4.11-10c-1-2.41-5.08-1.91-7.69-2l-4.43-0.16a43.24 43.24 0 0 0-6.64-6.66l-0.14-4.43c-0.08-2.6 0.43-6.69-2-7.69l-10-4.15c-2.4-1-4.95 2.25-6.85 4l-3.23 3a42.49 42.49 0 0 0-9.44 0l-3.21-3c-1.9-1.78-4.44-5-6.85-4l-10 4.11c-2.41 1-1.9 5.09-2 7.69l-0.16 4.42a43.24 43.24 0 0 0-6.67 6.65l-4.42 0.14c-2.6 0.08-6.69-0.43-7.69 2l-4.15 10c-1 2.4 2.25 4.94 4 6.84l3 3.23a42.49 42.49 0 0 0 0 9.44l-3 3.22c-1.78 1.9-5 4.43-4 6.84l4.11 10c1 2.41 5.09 1.91 7.7 2l4.41 0.15a43.24 43.24 0 0 0 6.66 6.68l0.13 4.41c0.08 2.6-0.43 6.7 2 7.7l10 4.15c2.4 1 4.94-2.25 6.84-4l3.24-3a42.5 42.5 0 0 0 9.42 0l3.22 3c1.91 1.79 4.43 5 6.84 4l10-4.11c2.41-1 1.91-5.08 2-7.7l0.15-4.42a43.24 43.24 0 0 0 6.68-6.65l4.42-0.14c2.6-0.08 6.7 0.43 7.7-2l4.15-10c1.04-2.36-2.22-4.9-3.99-6.82zm-45.74 15.7c-12.66 0-22.91-10.61-22.91-23.7s10.25-23.7 22.91-23.7 22.91 10.61 22.91 23.7-10.25 23.7-22.91 23.7z"/>
|
|
31
|
+
</svg>`));
|
|
32
|
+
addClass(this.settingsButton, "tabContextButton");
|
|
33
|
+
controlBarEl.appendChild(this.settingsButton);
|
|
34
|
+
this.settingsButton.onclick = () => this.open();
|
|
35
|
+
this.prefixButton = document.createElement("button");
|
|
36
|
+
this.prefixButton.setAttribute("aria-label", "Insert Prefixes");
|
|
37
|
+
this.prefixButton.title = "Insert saved prefixes into query";
|
|
38
|
+
this.prefixButton.textContent = "PREFIX";
|
|
39
|
+
addClass(this.prefixButton, "tabPrefixButton");
|
|
40
|
+
controlBarEl.appendChild(this.prefixButton);
|
|
41
|
+
this.prefixButton.onclick = () => this.insertPrefixesIntoQuery();
|
|
42
|
+
this.createModal();
|
|
43
|
+
}
|
|
44
|
+
createModal() {
|
|
45
|
+
this.modalOverlay = document.createElement("div");
|
|
46
|
+
addClass(this.modalOverlay, "tabSettingsModalOverlay");
|
|
47
|
+
this.modalOverlay.onclick = () => this.close();
|
|
48
|
+
this.modalContent = document.createElement("div");
|
|
49
|
+
addClass(this.modalContent, "tabSettingsModal");
|
|
50
|
+
this.modalContent.onclick = (e) => e.stopPropagation();
|
|
51
|
+
const header = document.createElement("div");
|
|
52
|
+
addClass(header, "modalHeader");
|
|
53
|
+
const title = document.createElement("h2");
|
|
54
|
+
title.textContent = "Tab Settings";
|
|
55
|
+
header.appendChild(title);
|
|
56
|
+
const closeBtn = document.createElement("button");
|
|
57
|
+
closeBtn.textContent = "×";
|
|
58
|
+
addClass(closeBtn, "closeButton");
|
|
59
|
+
closeBtn.onclick = () => this.close();
|
|
60
|
+
header.appendChild(closeBtn);
|
|
61
|
+
this.modalContent.appendChild(header);
|
|
62
|
+
const body = document.createElement("div");
|
|
63
|
+
addClass(body, "modalBody");
|
|
64
|
+
const tabsContainer = document.createElement("div");
|
|
65
|
+
addClass(tabsContainer, "modalTabs");
|
|
66
|
+
const requestTab = document.createElement("button");
|
|
67
|
+
requestTab.textContent = "Request";
|
|
68
|
+
addClass(requestTab, "modalTabButton", "active");
|
|
69
|
+
requestTab.onclick = () => this.switchTab("request");
|
|
70
|
+
const prefixTab = document.createElement("button");
|
|
71
|
+
prefixTab.textContent = "Prefixes";
|
|
72
|
+
addClass(prefixTab, "modalTabButton");
|
|
73
|
+
prefixTab.onclick = () => this.switchTab("prefix");
|
|
74
|
+
tabsContainer.appendChild(requestTab);
|
|
75
|
+
tabsContainer.appendChild(prefixTab);
|
|
76
|
+
body.appendChild(tabsContainer);
|
|
77
|
+
const requestContent = document.createElement("div");
|
|
78
|
+
addClass(requestContent, "modalTabContent", "active");
|
|
79
|
+
requestContent.id = "request-content";
|
|
80
|
+
this.drawRequestSettings(requestContent);
|
|
81
|
+
const prefixContent = document.createElement("div");
|
|
82
|
+
addClass(prefixContent, "modalTabContent");
|
|
83
|
+
prefixContent.id = "prefix-content";
|
|
84
|
+
this.drawPrefixSettings(prefixContent);
|
|
85
|
+
body.appendChild(requestContent);
|
|
86
|
+
body.appendChild(prefixContent);
|
|
87
|
+
this.modalContent.appendChild(body);
|
|
88
|
+
const footer = document.createElement("div");
|
|
89
|
+
addClass(footer, "modalFooter");
|
|
90
|
+
const saveBtn = document.createElement("button");
|
|
91
|
+
saveBtn.textContent = "Save";
|
|
92
|
+
addClass(saveBtn, "primaryButton");
|
|
93
|
+
saveBtn.onclick = () => this.save();
|
|
94
|
+
const cancelBtn = document.createElement("button");
|
|
95
|
+
cancelBtn.textContent = "Cancel";
|
|
96
|
+
addClass(cancelBtn, "secondaryButton");
|
|
97
|
+
cancelBtn.onclick = () => this.close();
|
|
98
|
+
footer.appendChild(cancelBtn);
|
|
99
|
+
footer.appendChild(saveBtn);
|
|
100
|
+
this.modalContent.appendChild(footer);
|
|
101
|
+
this.modalOverlay.appendChild(this.modalContent);
|
|
102
|
+
document.body.appendChild(this.modalOverlay);
|
|
103
|
+
}
|
|
104
|
+
switchTab(tabName) {
|
|
105
|
+
const buttons = this.modalContent.querySelectorAll(".modalTabButton");
|
|
106
|
+
const contents = this.modalContent.querySelectorAll(".modalTabContent");
|
|
107
|
+
buttons.forEach((btn, index) => {
|
|
108
|
+
if ((tabName === "request" && index === 0) || (tabName === "prefix" && index === 1)) {
|
|
109
|
+
addClass(btn, "active");
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
removeClass(btn, "active");
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
contents.forEach((content) => {
|
|
116
|
+
if (content.id === `${tabName}-content`) {
|
|
117
|
+
addClass(content, "active");
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
removeClass(content, "active");
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
drawPrefixSettings(container) {
|
|
125
|
+
const section = document.createElement("div");
|
|
126
|
+
addClass(section, "settingsSection");
|
|
127
|
+
const label = document.createElement("label");
|
|
128
|
+
label.textContent = "Saved Prefixes";
|
|
129
|
+
addClass(label, "settingsLabel");
|
|
130
|
+
const help = document.createElement("div");
|
|
131
|
+
help.textContent = "Enter PREFIX declarations (one per line). These will be available for insertion into queries.";
|
|
132
|
+
addClass(help, "settingsHelp");
|
|
133
|
+
this.prefixTextarea = document.createElement("textarea");
|
|
134
|
+
addClass(this.prefixTextarea, "prefixTextarea");
|
|
135
|
+
this.prefixTextarea.placeholder =
|
|
136
|
+
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>";
|
|
137
|
+
this.prefixTextarea.rows = 10;
|
|
138
|
+
const checkboxContainer = document.createElement("div");
|
|
139
|
+
addClass(checkboxContainer, "checkboxContainer");
|
|
140
|
+
this.autoCaptureCheckbox = document.createElement("input");
|
|
141
|
+
this.autoCaptureCheckbox.type = "checkbox";
|
|
142
|
+
this.autoCaptureCheckbox.id = "autoCapturePrefixes";
|
|
143
|
+
const checkboxLabel = document.createElement("label");
|
|
144
|
+
checkboxLabel.htmlFor = "autoCapturePrefixes";
|
|
145
|
+
checkboxLabel.textContent = "Automatically capture new prefixes from query editor";
|
|
146
|
+
checkboxContainer.appendChild(this.autoCaptureCheckbox);
|
|
147
|
+
checkboxContainer.appendChild(checkboxLabel);
|
|
148
|
+
section.appendChild(label);
|
|
149
|
+
section.appendChild(help);
|
|
150
|
+
section.appendChild(this.prefixTextarea);
|
|
151
|
+
section.appendChild(checkboxContainer);
|
|
152
|
+
container.appendChild(section);
|
|
153
|
+
}
|
|
154
|
+
drawRequestSettings(container) {
|
|
155
|
+
const reqConfig = this.tab.getRequestConfig();
|
|
156
|
+
const methodSection = this.createSection("Request Method");
|
|
157
|
+
const methodSelect = this.createSelect(["GET", "POST"], typeof reqConfig.method === "function" ? "POST" : reqConfig.method);
|
|
158
|
+
methodSelect.setAttribute("data-config", "method");
|
|
159
|
+
methodSection.appendChild(methodSelect);
|
|
160
|
+
container.appendChild(methodSection);
|
|
161
|
+
const acceptSection = this.createSection("Accept Header (SELECT/ASK)");
|
|
162
|
+
const acceptSelect = this.createOptionsSelect(AcceptOptionsMap, reqConfig.acceptHeaderSelect);
|
|
163
|
+
acceptSelect.setAttribute("data-config", "acceptHeaderSelect");
|
|
164
|
+
acceptSection.appendChild(acceptSelect);
|
|
165
|
+
container.appendChild(acceptSection);
|
|
166
|
+
const acceptGraphSection = this.createSection("Accept Header (CONSTRUCT/DESCRIBE)");
|
|
167
|
+
const acceptGraphSelect = this.createOptionsSelect(AcceptHeaderGraphMap, reqConfig.acceptHeaderGraph);
|
|
168
|
+
acceptGraphSelect.setAttribute("data-config", "acceptHeaderGraph");
|
|
169
|
+
acceptGraphSection.appendChild(acceptGraphSelect);
|
|
170
|
+
container.appendChild(acceptGraphSection);
|
|
171
|
+
}
|
|
172
|
+
createSection(title) {
|
|
173
|
+
const section = document.createElement("div");
|
|
174
|
+
addClass(section, "settingsSection");
|
|
175
|
+
const label = document.createElement("div");
|
|
176
|
+
addClass(label, "settingsLabel");
|
|
177
|
+
label.textContent = title;
|
|
178
|
+
section.appendChild(label);
|
|
179
|
+
return section;
|
|
180
|
+
}
|
|
181
|
+
createSelect(options, selected) {
|
|
182
|
+
const select = document.createElement("select");
|
|
183
|
+
addClass(select, "settingsSelect");
|
|
184
|
+
options.forEach((opt) => {
|
|
185
|
+
const option = document.createElement("option");
|
|
186
|
+
option.value = opt;
|
|
187
|
+
option.textContent = opt;
|
|
188
|
+
if (opt === selected)
|
|
189
|
+
option.selected = true;
|
|
190
|
+
select.appendChild(option);
|
|
191
|
+
});
|
|
192
|
+
return select;
|
|
193
|
+
}
|
|
194
|
+
createOptionsSelect(options, selected) {
|
|
195
|
+
const select = document.createElement("select");
|
|
196
|
+
addClass(select, "settingsSelect");
|
|
197
|
+
options.forEach((opt) => {
|
|
198
|
+
const option = document.createElement("option");
|
|
199
|
+
option.value = opt.value;
|
|
200
|
+
option.textContent = opt.key;
|
|
201
|
+
if (opt.value === selected)
|
|
202
|
+
option.selected = true;
|
|
203
|
+
select.appendChild(option);
|
|
204
|
+
});
|
|
205
|
+
return select;
|
|
206
|
+
}
|
|
207
|
+
open() {
|
|
208
|
+
this.loadSettings();
|
|
209
|
+
addClass(this.modalOverlay, "open");
|
|
210
|
+
}
|
|
211
|
+
close() {
|
|
212
|
+
removeClass(this.modalOverlay, "open");
|
|
213
|
+
}
|
|
214
|
+
loadSettings() {
|
|
215
|
+
let prefixes = this.tab.yasgui.persistentConfig.getPrefixes();
|
|
216
|
+
const autoCapture = this.tab.yasgui.persistentConfig.getAutoCaptureEnabled();
|
|
217
|
+
if (!prefixes || prefixes.trim().length === 0) {
|
|
218
|
+
prefixes = `PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>`;
|
|
219
|
+
this.tab.yasgui.persistentConfig.setPrefixes(prefixes);
|
|
220
|
+
}
|
|
221
|
+
this.prefixTextarea.value = prefixes;
|
|
222
|
+
this.autoCaptureCheckbox.checked = autoCapture;
|
|
223
|
+
}
|
|
224
|
+
save() {
|
|
225
|
+
const prefixText = this.prefixTextarea.value;
|
|
226
|
+
const autoCapture = this.autoCaptureCheckbox.checked;
|
|
227
|
+
const deduplicated = this.deduplicatePrefixes(prefixText);
|
|
228
|
+
this.tab.yasgui.persistentConfig.setPrefixes(deduplicated);
|
|
229
|
+
this.tab.yasgui.persistentConfig.setAutoCaptureEnabled(autoCapture);
|
|
230
|
+
const requestContent = this.modalContent.querySelector("#request-content");
|
|
231
|
+
if (requestContent) {
|
|
232
|
+
const selects = requestContent.querySelectorAll("select[data-config]");
|
|
233
|
+
const updates = {};
|
|
234
|
+
selects.forEach((select) => {
|
|
235
|
+
const config = select.getAttribute("data-config");
|
|
236
|
+
if (config) {
|
|
237
|
+
updates[config] = select.value;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
this.tab.setRequestConfig(updates);
|
|
241
|
+
}
|
|
242
|
+
this.close();
|
|
243
|
+
}
|
|
244
|
+
deduplicatePrefixes(prefixText) {
|
|
245
|
+
const lines = prefixText.split("\n");
|
|
246
|
+
const seen = new Map();
|
|
247
|
+
const result = [];
|
|
248
|
+
for (const line of lines) {
|
|
249
|
+
const trimmed = line.trim();
|
|
250
|
+
if (!trimmed)
|
|
251
|
+
continue;
|
|
252
|
+
const match = trimmed.match(/^\s*PREFIX\s+(\w+):\s*<(.+)>\s*$/i);
|
|
253
|
+
if (match) {
|
|
254
|
+
const label = match[1].toLowerCase();
|
|
255
|
+
if (!seen.has(label)) {
|
|
256
|
+
seen.set(label, trimmed);
|
|
257
|
+
result.push(trimmed);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
result.push(trimmed);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return result.join("\n");
|
|
265
|
+
}
|
|
266
|
+
insertPrefixesIntoQuery() {
|
|
267
|
+
const yasqe = this.tab.getYasqe();
|
|
268
|
+
if (!yasqe)
|
|
269
|
+
return;
|
|
270
|
+
const savedPrefixes = this.tab.yasgui.persistentConfig.getPrefixes();
|
|
271
|
+
if (!savedPrefixes.trim())
|
|
272
|
+
return;
|
|
273
|
+
const currentQuery = yasqe.getValue();
|
|
274
|
+
const lines = currentQuery.split("\n");
|
|
275
|
+
let firstNonPrefixLine = 0;
|
|
276
|
+
for (let i = 0; i < lines.length; i++) {
|
|
277
|
+
const trimmed = lines[i].trim();
|
|
278
|
+
if (trimmed.length > 0 && !trimmed.toUpperCase().startsWith("PREFIX")) {
|
|
279
|
+
firstNonPrefixLine = i;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (firstNonPrefixLine === 0 && lines.length > 0) {
|
|
284
|
+
const hasContent = lines.some((line) => line.trim().length > 0);
|
|
285
|
+
if (!hasContent ||
|
|
286
|
+
lines.every((line) => line.trim().length === 0 || line.trim().toUpperCase().startsWith("PREFIX"))) {
|
|
287
|
+
firstNonPrefixLine = lines.length;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const restOfQuery = lines.slice(firstNonPrefixLine).join("\n").trim();
|
|
291
|
+
const newQuery = savedPrefixes + (restOfQuery ? "\n\n" + restOfQuery : "");
|
|
292
|
+
yasqe.setValue(newQuery);
|
|
293
|
+
yasqe.focus();
|
|
294
|
+
}
|
|
295
|
+
capturePrefixesFromQuery() {
|
|
296
|
+
const autoCapture = this.tab.yasgui.persistentConfig.getAutoCaptureEnabled();
|
|
297
|
+
if (!autoCapture)
|
|
298
|
+
return;
|
|
299
|
+
const yasqe = this.tab.getYasqe();
|
|
300
|
+
if (!yasqe)
|
|
301
|
+
return;
|
|
302
|
+
const queryPrefixes = yasqe.getPrefixesFromQuery();
|
|
303
|
+
if (!queryPrefixes || Object.keys(queryPrefixes).length === 0)
|
|
304
|
+
return;
|
|
305
|
+
const newPrefixLines = [];
|
|
306
|
+
for (const [label, uri] of Object.entries(queryPrefixes)) {
|
|
307
|
+
newPrefixLines.push(`PREFIX ${label}: <${uri}>`);
|
|
308
|
+
}
|
|
309
|
+
const existingPrefixes = this.tab.yasgui.persistentConfig.getPrefixes();
|
|
310
|
+
const combined = existingPrefixes + "\n" + newPrefixLines.join("\n");
|
|
311
|
+
const deduplicated = this.deduplicatePrefixes(combined);
|
|
312
|
+
this.tab.yasgui.persistentConfig.setPrefixes(deduplicated);
|
|
313
|
+
}
|
|
314
|
+
destroy() {
|
|
315
|
+
if (this.modalOverlay && this.modalOverlay.parentNode) {
|
|
316
|
+
this.modalOverlay.parentNode.removeChild(this.modalOverlay);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=TabSettingsModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabSettingsModal.js","sourceRoot":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rE,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAExD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC;IAEM,OAAO;QACZ,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;YACtD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Yasr from "@matdata/yasr";
|
|
2
|
+
import { default as Yasqe } from "@matdata/yasqe";
|
|
3
|
+
export default function initialize() {
|
|
4
|
+
return {
|
|
5
|
+
autofocus: true,
|
|
6
|
+
endpointInfo: undefined,
|
|
7
|
+
persistenceId: function (yasgui) {
|
|
8
|
+
var id = "";
|
|
9
|
+
var elem = yasgui.rootEl;
|
|
10
|
+
if (elem.id)
|
|
11
|
+
id = elem.id;
|
|
12
|
+
for (; elem && elem !== document; elem = elem.parentNode) {
|
|
13
|
+
if (elem) {
|
|
14
|
+
if (elem.id)
|
|
15
|
+
id = elem.id;
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return "yagui_" + id;
|
|
20
|
+
},
|
|
21
|
+
tabName: "Query",
|
|
22
|
+
corsProxy: undefined,
|
|
23
|
+
persistencyExpire: 60 * 60 * 24 * 30,
|
|
24
|
+
persistenceLabelResponse: "response",
|
|
25
|
+
persistenceLabelConfig: "config",
|
|
26
|
+
yasqe: Yasqe.defaults,
|
|
27
|
+
yasr: Yasr.defaults,
|
|
28
|
+
endpointCatalogueOptions: {
|
|
29
|
+
getData: () => {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
endpoint: "https://dbpedia.org/sparql",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
endpoint: "https://query.wikidata.org/bigdata/namespace/wdq/sparql",
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
},
|
|
39
|
+
keys: [],
|
|
40
|
+
renderItem: (data, source) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const contentDiv = document.createElement("div");
|
|
43
|
+
contentDiv.style.display = "flex";
|
|
44
|
+
contentDiv.style.flexDirection = "column";
|
|
45
|
+
const endpointSpan = document.createElement("span");
|
|
46
|
+
endpointSpan.innerHTML =
|
|
47
|
+
((_a = data.matches.endpoint) === null || _a === void 0 ? void 0 : _a.reduce((current, object) => (object.highlight ? current + object.text.bold() : current + object.text), "")) || "";
|
|
48
|
+
contentDiv.appendChild(endpointSpan);
|
|
49
|
+
source.appendChild(contentDiv);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
copyEndpointOnNewTab: true,
|
|
53
|
+
populateFromUrl: true,
|
|
54
|
+
autoAddOnInit: true,
|
|
55
|
+
requestConfig: Yasqe.defaults.requestConfig,
|
|
56
|
+
contextMenuContainer: undefined,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../../packages/yasgui/src/defaults.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,OAAO;QACL,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,UAAU,MAAM;YAG7B,IAAI,EAAE,GAAG,EAAE,CAAC;YACZ,IAAI,IAAI,GAAQ,MAAM,CAAC,MAAM,CAAC;YAC9B,IAAU,IAAK,CAAC,EAAE;gBAAE,EAAE,GAAS,IAAK,CAAC,EAAE,CAAC;YACxC,OAAO,IA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,CAAC,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EAC9F,EAAE,CACH,KAAI,EAAE,CAAC;gBACV,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;gBACrC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;SACF;QACD,oBAAoB,EAAE,IAAI;QAC1B,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa;QAC3C,oBAAoB,EAAE,SAAS;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Autocomplete from "@tarekraafat/autocomplete.js";
|
|
11
|
+
import { EventEmitter } from "events";
|
|
12
|
+
import { pick } from "lodash-es";
|
|
13
|
+
import { addClass } from "@matdata/yasgui-utils";
|
|
14
|
+
import "./endpointSelect.scss";
|
|
15
|
+
import parse from "autosuggest-highlight/parse";
|
|
16
|
+
import DOMPurify from "dompurify";
|
|
17
|
+
const { sanitize } = DOMPurify;
|
|
18
|
+
function listElementIsFullyVissible(el) {
|
|
19
|
+
const { top, bottom } = el.getBoundingClientRect();
|
|
20
|
+
if (bottom < 0)
|
|
21
|
+
return false;
|
|
22
|
+
if (top > document.documentElement.clientHeight)
|
|
23
|
+
return false;
|
|
24
|
+
const ulRect = el.parentNode.getBoundingClientRect();
|
|
25
|
+
if (bottom <= ulRect.bottom === false)
|
|
26
|
+
return false;
|
|
27
|
+
if (top <= ulRect.top)
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function splitSearchString(searchString) {
|
|
32
|
+
return searchString.match(/\S+/g) || [];
|
|
33
|
+
}
|
|
34
|
+
export class EndpointSelect extends EventEmitter {
|
|
35
|
+
constructor(initialValue, container, options, history) {
|
|
36
|
+
super();
|
|
37
|
+
this.clearListSuggestionList = () => {
|
|
38
|
+
const autocompleteList = this.container.querySelector(".autocompleteList");
|
|
39
|
+
if (autocompleteList)
|
|
40
|
+
autocompleteList.innerHTML = "";
|
|
41
|
+
};
|
|
42
|
+
this.container = container;
|
|
43
|
+
this.options = options;
|
|
44
|
+
this.value = initialValue;
|
|
45
|
+
this.history = history.map((endpoint) => {
|
|
46
|
+
return { endpoint: sanitize(endpoint), type: "history" };
|
|
47
|
+
});
|
|
48
|
+
if (this.options.keys.indexOf("endpoint") <= 0)
|
|
49
|
+
this.options.keys.push("endpoint");
|
|
50
|
+
this.draw();
|
|
51
|
+
}
|
|
52
|
+
draw() {
|
|
53
|
+
const autocompleteWrapper = document.createElement("div");
|
|
54
|
+
addClass(autocompleteWrapper, "autocompleteWrapper");
|
|
55
|
+
this.container.appendChild(autocompleteWrapper);
|
|
56
|
+
this.inputField = document.createElement("input");
|
|
57
|
+
addClass(this.inputField, "autocomplete");
|
|
58
|
+
this.inputField.value = this.value;
|
|
59
|
+
autocompleteWrapper.appendChild(this.inputField);
|
|
60
|
+
const clearBtn = document.createElement("button");
|
|
61
|
+
clearBtn.title = "Clear endpoint";
|
|
62
|
+
addClass(clearBtn, "clearEndpointBtn");
|
|
63
|
+
clearBtn.innerText = "✖";
|
|
64
|
+
clearBtn.addEventListener("click", () => {
|
|
65
|
+
this.inputField.value = "";
|
|
66
|
+
this.inputField.focus();
|
|
67
|
+
});
|
|
68
|
+
this.container.appendChild(clearBtn);
|
|
69
|
+
new Autocomplete({
|
|
70
|
+
placeholder: "Search or add an endpoint",
|
|
71
|
+
highlight: false,
|
|
72
|
+
maxResults: 100,
|
|
73
|
+
trigger: {
|
|
74
|
+
event: ["input", "focusin"],
|
|
75
|
+
condition: () => true,
|
|
76
|
+
},
|
|
77
|
+
searchEngine: (query, record) => {
|
|
78
|
+
if (!query || query.trim().length === 0) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return splitSearchString(query).every((m) => record.indexOf(m) >= 0);
|
|
82
|
+
},
|
|
83
|
+
data: {
|
|
84
|
+
src: () => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
return [...this.history, ...this.options.getData()].map((item) => (Object.assign(Object.assign({}, item), { all: Object.values(pick(item, ["endpoint", ...this.options.keys])).join(" ") })));
|
|
86
|
+
}),
|
|
87
|
+
key: ["all"],
|
|
88
|
+
cache: false,
|
|
89
|
+
},
|
|
90
|
+
selector: () => this.inputField,
|
|
91
|
+
resultsList: {
|
|
92
|
+
render: true,
|
|
93
|
+
destination: this.inputField,
|
|
94
|
+
container: (element) => {
|
|
95
|
+
element.id = "";
|
|
96
|
+
addClass(element, "autocompleteList");
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
resultItem: {
|
|
100
|
+
content: (data, source) => {
|
|
101
|
+
const endpoint = sanitize(data.value.endpoint);
|
|
102
|
+
if (data.value.type && data.value.type === "history") {
|
|
103
|
+
const resultsContainer = document.createElement("div");
|
|
104
|
+
resultsContainer.innerHTML = parse(endpoint, createHighlights(endpoint, this.inputField.value)).reduce((current, object) => (object.highlight ? current + object.text.bold() : current + object.text), "");
|
|
105
|
+
source.append(resultsContainer);
|
|
106
|
+
const removeBtn = document.createElement("button");
|
|
107
|
+
removeBtn.textContent = "✖";
|
|
108
|
+
addClass(removeBtn, "removeItem");
|
|
109
|
+
removeBtn.addEventListener("mousedown", (event) => {
|
|
110
|
+
this.history = this.history.filter((item) => item.endpoint !== endpoint);
|
|
111
|
+
this.emit("remove", this.value, this.history.map((value) => value.endpoint));
|
|
112
|
+
source.remove();
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
});
|
|
115
|
+
source.appendChild(removeBtn);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const matches = { matches: {} };
|
|
119
|
+
for (const key of [...this.options.keys]) {
|
|
120
|
+
const val = data.value[key];
|
|
121
|
+
if (val) {
|
|
122
|
+
matches.matches[key] = parse(val, createHighlights(val, this.inputField.value));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.options.renderItem(Object.assign(Object.assign({}, data), matches), source);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
element: "li",
|
|
129
|
+
},
|
|
130
|
+
onSelection: (feedback) => {
|
|
131
|
+
const item = feedback.selection.value;
|
|
132
|
+
this.value = item.endpoint;
|
|
133
|
+
this.inputField.value = this.value;
|
|
134
|
+
this.emit("select", this.value, this.history.map((value) => value.endpoint));
|
|
135
|
+
},
|
|
136
|
+
noResults: () => {
|
|
137
|
+
const container = this.container.querySelector(".autocompleteList");
|
|
138
|
+
if (container) {
|
|
139
|
+
const noResults = document.createElement("div");
|
|
140
|
+
addClass(noResults, "noResults");
|
|
141
|
+
noResults.innerText = 'Press "enter" to add this endpoint';
|
|
142
|
+
container.appendChild(noResults);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
this.inputField.addEventListener("keyup", (event) => {
|
|
147
|
+
const target = event.target;
|
|
148
|
+
if (event.keyCode === 13) {
|
|
149
|
+
if (this.value === target.value) {
|
|
150
|
+
this.clearListSuggestionList();
|
|
151
|
+
this.inputField.blur();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!target.value || !target.value.trim()) {
|
|
155
|
+
this.clearListSuggestionList();
|
|
156
|
+
this.inputField.blur();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (this.options.getData().find((i) => i.endpoint === this.inputField.value) ||
|
|
160
|
+
this.history.find((item) => item.endpoint === this.inputField.value)) {
|
|
161
|
+
this.value = target.value;
|
|
162
|
+
this.clearListSuggestionList();
|
|
163
|
+
this.emit("select", this.value, this.history.map((h) => h.endpoint));
|
|
164
|
+
this.inputField.blur();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.value = target.value;
|
|
168
|
+
this.history.push({ endpoint: target.value, type: "history" });
|
|
169
|
+
this.emit("select", this.value, this.history.map((value) => value.endpoint));
|
|
170
|
+
this.clearListSuggestionList();
|
|
171
|
+
this.inputField.blur();
|
|
172
|
+
}
|
|
173
|
+
if (event.keyCode === 27) {
|
|
174
|
+
this.inputField.blur();
|
|
175
|
+
this.inputField.value = this.value;
|
|
176
|
+
this.clearListSuggestionList();
|
|
177
|
+
}
|
|
178
|
+
if (event.keyCode === 38 || event.keyCode === 40) {
|
|
179
|
+
event.stopPropagation();
|
|
180
|
+
const selected = this.container.querySelector(".autocompleteList .autoComplete_result.autoComplete_selected");
|
|
181
|
+
if (selected && !listElementIsFullyVissible(selected)) {
|
|
182
|
+
selected.scrollIntoView(false);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
this.inputField.addEventListener("blur", (event) => {
|
|
187
|
+
const target = event.target;
|
|
188
|
+
if (target.className === this.inputField.className && event.relatedTarget) {
|
|
189
|
+
this.clearListSuggestionList();
|
|
190
|
+
this.inputField.value = this.value;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
document.addEventListener("mousedown", (event) => {
|
|
194
|
+
if (event.button !== 2) {
|
|
195
|
+
const target = event.target;
|
|
196
|
+
if (target.className === "removeItem" ||
|
|
197
|
+
target.className === "autoComplete_result" ||
|
|
198
|
+
target.className === "autocomplete")
|
|
199
|
+
return;
|
|
200
|
+
this.clearListSuggestionList();
|
|
201
|
+
this.inputField.value = this.value;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
setEndpoint(endpoint, endpointHistory) {
|
|
206
|
+
this.value = endpoint;
|
|
207
|
+
if (endpointHistory) {
|
|
208
|
+
this.history = endpointHistory.map((endpoint) => {
|
|
209
|
+
return { endpoint, type: "history" };
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (this.inputField === document.activeElement) {
|
|
213
|
+
this.inputField.focus();
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.inputField.value = endpoint;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
destroy() {
|
|
220
|
+
this.removeAllListeners();
|
|
221
|
+
this.inputField.remove();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function createHighlights(text, query) {
|
|
225
|
+
return splitSearchString(query)
|
|
226
|
+
.reduce((result, word) => {
|
|
227
|
+
if (!word.length)
|
|
228
|
+
return result;
|
|
229
|
+
const wordLen = word.length;
|
|
230
|
+
const index = text.indexOf(word);
|
|
231
|
+
if (index > -1) {
|
|
232
|
+
result.push([index, index + wordLen]);
|
|
233
|
+
text = text.slice(0, index) + new Array(wordLen + 1).join(" ") + text.slice(index + wordLen);
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
236
|
+
}, [])
|
|
237
|
+
.sort((match1, match2) => {
|
|
238
|
+
return match1[0] - match2[0];
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
export default EndpointSelect;
|
|
242
|
+
//# sourceMappingURL=endpointSelect.js.map
|