@startinblox/components-ds4go 3.0.2 → 3.1.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/.storybook/preview.ts +1 -0
- package/biome.json +1 -1
- package/dist/custom-getter-ZPFnoSjt-BCNOlbJZ-B4tuxA42.js +338 -0
- package/dist/en-BySYJZMr-CWZl5AwU-CWZl5AwU.js +14 -0
- package/dist/fr-BZZDTsmw-CNDWt66j-CNDWt66j.js +14 -0
- package/dist/index-BSwVRtNS.js +104980 -0
- package/dist/index.js +1 -3032
- package/dist/quill.snow-C_A_QkE8-D-uedtvC-D-uedtvC.js +13 -0
- package/dist/slimselect-NFLzJMfV-DZ7j6Vsj-DZ7j6Vsj.js +5 -0
- package/package.json +9 -8
- package/src/components/cards/ds4go-card-catalog.ts +132 -0
- package/src/components/catalog/ds4go-catalog-filter-holder.ts +459 -0
- package/src/components/catalog/ds4go-customer-holder.ts +162 -0
- package/src/components/catalog/ds4go-fact-bundle-holder.ts +7 -7
- package/src/components/modal/ds4go-customer-modal.ts +134 -0
- package/src/components/modal/ds4go-fact-bundle-modal.ts +2 -2
- package/src/components/solid-customer-list.ts +195 -0
- package/src/components/solid-dsif-explorer-poc.ts +8 -8
- package/src/components/solid-dsp-connector.ts +12 -4
- package/src/components/solid-fact-bundle-creation.ts +266 -169
- package/src/components/solid-fact-bundle.ts +9 -4
- package/src/helpers/components/orbitComponent.ts +12 -13
- package/src/helpers/i18n/configureLocalization.ts +12 -5
- package/src/helpers/index.ts +0 -2
- package/src/styles/cards/ds4go-card-catalog.scss +149 -0
- package/src/styles/fact-bundle-creation.scss +6 -2
- package/src/styles/modal/ds4go-customer-modal.scss +91 -0
- package/src/styles/modal/ds4go-fact-bundle-modal.scss +1 -1
- package/vite.config.ts +7 -7
- package/src/components/solid-boilerplate.ts +0 -76
- package/src/helpers/components/ResourceMapper.ts +0 -469
- package/src/helpers/components/orbitDspComponent.ts +0 -250
- package/src/helpers/mappings/dsp-mapping-config.ts +0 -545
package/.storybook/preview.ts
CHANGED
package/biome.json
CHANGED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { A as d, $ as y, f as C, U as f } from "./index-BSwVRtNS.js";
|
|
2
|
+
var m = Object.defineProperty, w = (l, e, t) => e in l ? m(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, o = (l, e, t) => w(l, typeof e != "symbol" ? e + "" : e, t);
|
|
3
|
+
const s = f.getInstance();
|
|
4
|
+
class g {
|
|
5
|
+
// search attributes to give to server
|
|
6
|
+
constructor(e, t, i, r, a = "", h = {}, n = {}) {
|
|
7
|
+
o(this, "resource"), o(this, "resourceId"), o(this, "clientContext"), o(this, "serverContext"), o(this, "parentId"), o(this, "listTypes"), o(this, "serverPagination"), o(this, "serverSearch"), this.clientContext = i, this.serverContext = r, this.parentId = a, this.resource = t, this.resourceId = e, this.serverPagination = h, this.serverSearch = n, this.listTypes = [
|
|
8
|
+
this.getExpandedPredicate("ldp:Container"),
|
|
9
|
+
this.getExpandedPredicate("dcat:Catalog"),
|
|
10
|
+
this.getExpandedPredicate("ldp:BasicContainer"),
|
|
11
|
+
this.getExpandedPredicate("ldp:DirectContainer"),
|
|
12
|
+
this.getExpandedPredicate("ldp:IndirectContainer"),
|
|
13
|
+
this.getExpandedPredicate("sib:federatedContainer")
|
|
14
|
+
].filter(Boolean);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the property of a resource for a given path
|
|
18
|
+
* Which means that if the resource is not complete, it will fetch it
|
|
19
|
+
* And that we handle the `.` notation, traversing the path recursively
|
|
20
|
+
* @param path: string
|
|
21
|
+
*/
|
|
22
|
+
async get(e) {
|
|
23
|
+
if (e)
|
|
24
|
+
try {
|
|
25
|
+
const t = new URL(e);
|
|
26
|
+
if (!t.protocol.startsWith("http"))
|
|
27
|
+
throw new Error("Not a valid HTTP url");
|
|
28
|
+
if (t) {
|
|
29
|
+
let i = await this.getList(e);
|
|
30
|
+
return !i || Array.isArray(i) && i.length === 0 ? void 0 : (Array.isArray(i) || (i = [i]), i ? Promise.all(
|
|
31
|
+
i.map(async (r) => {
|
|
32
|
+
let a = await s.get(r["@id"]);
|
|
33
|
+
return a || (a = new g(
|
|
34
|
+
r["@id"],
|
|
35
|
+
{ "@id": r["@id"] },
|
|
36
|
+
this.clientContext,
|
|
37
|
+
this.serverContext,
|
|
38
|
+
this.parentId
|
|
39
|
+
).getProxy(), await s.cacheResource(r["@id"], a), a);
|
|
40
|
+
})
|
|
41
|
+
) : []);
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
if (!e.split) return;
|
|
45
|
+
const t = e.split("."), i = [];
|
|
46
|
+
let r;
|
|
47
|
+
for (this.isFullResource() || await this.getResource(
|
|
48
|
+
this.resourceId,
|
|
49
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
50
|
+
this.parentId
|
|
51
|
+
); ; ) {
|
|
52
|
+
if (r = this.resource[t[0]], !r) {
|
|
53
|
+
const n = this.getExpandedPredicate(t[0]);
|
|
54
|
+
n && (r = this.resource[n]);
|
|
55
|
+
}
|
|
56
|
+
if (r || (r = await this.getList(t[0]), Array.isArray(r) && r.length === 0 && (r = void 0)), t.length <= 1) break;
|
|
57
|
+
const h = t.pop();
|
|
58
|
+
h && i.unshift(h);
|
|
59
|
+
}
|
|
60
|
+
if (i.length === 0) {
|
|
61
|
+
if (!r || !r["@id"]) return this.getLiteralValue(r);
|
|
62
|
+
const h = Object.keys(r).filter((n) => n !== "@type");
|
|
63
|
+
if (h.length === 1 && h[0] === "@id") {
|
|
64
|
+
const n = await s.get(r["@id"]);
|
|
65
|
+
if (n)
|
|
66
|
+
return n;
|
|
67
|
+
try {
|
|
68
|
+
const c = d(
|
|
69
|
+
this.clientContext,
|
|
70
|
+
this.serverContext
|
|
71
|
+
), p = y(c), x = [e];
|
|
72
|
+
try {
|
|
73
|
+
const u = this.getExpandedPredicate(e);
|
|
74
|
+
u && u !== e && x.push(u);
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
for (const u of x)
|
|
78
|
+
if (p?.[u] && typeof p[u] == "object" && p[u]["@type"] === "@id")
|
|
79
|
+
return r["@id"];
|
|
80
|
+
} catch (c) {
|
|
81
|
+
console.warn("Context parsing failed in CustomGetter:", c);
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const c = await this.getResource(
|
|
85
|
+
r["@id"],
|
|
86
|
+
d(this.clientContext, this.serverContext),
|
|
87
|
+
this.parentId || this.resourceId
|
|
88
|
+
);
|
|
89
|
+
if (c !== null)
|
|
90
|
+
return c;
|
|
91
|
+
} catch (c) {
|
|
92
|
+
console.warn("Failed to fetch resource:", r["@id"], c);
|
|
93
|
+
}
|
|
94
|
+
return r["@id"];
|
|
95
|
+
}
|
|
96
|
+
return await this.getResource(
|
|
97
|
+
r["@id"],
|
|
98
|
+
d(this.clientContext, this.serverContext),
|
|
99
|
+
this.parentId || this.resourceId
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (!r || !r["@id"]) return;
|
|
103
|
+
const a = await this.getResource(
|
|
104
|
+
r["@id"],
|
|
105
|
+
d(this.clientContext, this.serverContext),
|
|
106
|
+
this.parentId || this.resourceId
|
|
107
|
+
);
|
|
108
|
+
return s.subscribeResourceTo(this.resourceId, r["@id"]), a ? await a[i.join(".")] : void 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
static getEmptyResource(e, t, i) {
|
|
112
|
+
return new g(
|
|
113
|
+
e,
|
|
114
|
+
{ "@id": e },
|
|
115
|
+
t,
|
|
116
|
+
i
|
|
117
|
+
).getProxy();
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Return value depending of the current language
|
|
121
|
+
* @param value
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
getLiteralValue(e) {
|
|
125
|
+
if (typeof e != "object" || e === null) return e;
|
|
126
|
+
if (e["@value"]) return e["@value"];
|
|
127
|
+
if (!Array.isArray(e)) return e;
|
|
128
|
+
if (e.length === 0) return null;
|
|
129
|
+
if (!Array.isArray(e[0])) return e;
|
|
130
|
+
const t = s._getLanguage();
|
|
131
|
+
let i = e.find(
|
|
132
|
+
(r) => r["@language"] && r["@language"] === t
|
|
133
|
+
);
|
|
134
|
+
return i || (i = e.find(
|
|
135
|
+
(r) => r["@language"] && r["@language"] === "en"
|
|
136
|
+
)), i?.["@value"] ?? null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Cache resource in the store, and return the created proxy
|
|
140
|
+
* @param id
|
|
141
|
+
* @param context
|
|
142
|
+
* @param iriParent
|
|
143
|
+
*/
|
|
144
|
+
async getResource(e, t, i, r = !1) {
|
|
145
|
+
return e.startsWith("_:b") ? await s.get(e + i) : await s.getData(
|
|
146
|
+
e,
|
|
147
|
+
t,
|
|
148
|
+
i,
|
|
149
|
+
void 0,
|
|
150
|
+
r
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Return true if the resource is a container
|
|
155
|
+
*/
|
|
156
|
+
isContainer() {
|
|
157
|
+
return this.resource["@type"] ? Array.isArray(this.resource["@type"]) ? this.listTypes.some(
|
|
158
|
+
(e) => this.resource["@type"].includes(e)
|
|
159
|
+
) : this.listTypes.includes(this.resource["@type"]) : this.resource.type ? Array.isArray(this.resource.type) ? this.listTypes.some((e) => this.resource.type.includes(e)) : this.listTypes.includes(this.resource.type) : !1;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Return true if the given key in the current resource in an array
|
|
163
|
+
*/
|
|
164
|
+
isArray() {
|
|
165
|
+
return !!Array.isArray(this.resource);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get all properties of a resource
|
|
169
|
+
*/
|
|
170
|
+
getProperties() {
|
|
171
|
+
return Object.keys(this.resource).map(
|
|
172
|
+
(e) => this.getCompactedPredicate(e)
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get children of container as objects
|
|
177
|
+
*/
|
|
178
|
+
async getList(e) {
|
|
179
|
+
let t = await this.resource[e];
|
|
180
|
+
if (!t) {
|
|
181
|
+
const i = this.getExpandedPredicate(e);
|
|
182
|
+
i && (t = await this.resource[i]);
|
|
183
|
+
}
|
|
184
|
+
return t ?? [];
|
|
185
|
+
}
|
|
186
|
+
async getListAndCacheIt(e) {
|
|
187
|
+
let t = await this.getList(e);
|
|
188
|
+
return t ? (Array.isArray(t) || (t = [t]), t ? await Promise.all(
|
|
189
|
+
t.map(async (i) => {
|
|
190
|
+
let r = await s.get(i["@id"]);
|
|
191
|
+
return r || (r = new g(
|
|
192
|
+
i["@id"],
|
|
193
|
+
{ "@id": i["@id"] },
|
|
194
|
+
this.clientContext,
|
|
195
|
+
this.serverContext,
|
|
196
|
+
this.parentId
|
|
197
|
+
).getProxy(), await s.cacheResource(i["@id"], r), r);
|
|
198
|
+
})
|
|
199
|
+
) : []) : null;
|
|
200
|
+
}
|
|
201
|
+
async getDcatDataset() {
|
|
202
|
+
return await this.getListAndCacheIt("dcat:dataset");
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get children of container as Proxys
|
|
206
|
+
*/
|
|
207
|
+
async getLdpContains() {
|
|
208
|
+
return await this.getListAndCacheIt("ldp:contains");
|
|
209
|
+
}
|
|
210
|
+
merge(e) {
|
|
211
|
+
this.resource = {
|
|
212
|
+
...this.getResourceData(),
|
|
213
|
+
...e.getResourceData()
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
getResourceData() {
|
|
217
|
+
return this.resource;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get the list of resources associated with the list predicate of the resource
|
|
221
|
+
* If the resource is a container, it will return the ldp:contains list
|
|
222
|
+
* If the resource is a dcat:Catalog, it will return the dcat:dataset list
|
|
223
|
+
* If the resource is not a container or a catalog, it will return null
|
|
224
|
+
* @returns object[] | null
|
|
225
|
+
*/
|
|
226
|
+
async getContainerList() {
|
|
227
|
+
return this.hasType("ldp:Container") ? await this.getLdpContains() : this.getType() === "dcat:Catalog" ? await this.getDcatDataset() : null;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* return true if resource seems complete
|
|
231
|
+
* A resource is considered complete if it has at least one property which is not a permission
|
|
232
|
+
*/
|
|
233
|
+
isFullResource() {
|
|
234
|
+
const e = Object.keys(this.resource).filter(
|
|
235
|
+
(t) => !t.startsWith("@")
|
|
236
|
+
);
|
|
237
|
+
return this.resource["@id"].startsWith("_:b") ? !0 : e.length === 1 && e[0] === this.getExpandedPredicate("permissions") ? !1 : e.length > 0;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get permissions of a resource
|
|
241
|
+
* @param resourceId
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
244
|
+
async getPermissions() {
|
|
245
|
+
const e = this.getExpandedPredicate("permissions");
|
|
246
|
+
if (!e) return [];
|
|
247
|
+
let t = this.resource[e];
|
|
248
|
+
return t || (await this.getResource(
|
|
249
|
+
this.resourceId,
|
|
250
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
251
|
+
this.parentId,
|
|
252
|
+
!0
|
|
253
|
+
), t = this.resource[e]), Array.isArray(t) || (t = [t]), t || [];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* returns compacted @type of resource
|
|
257
|
+
*/
|
|
258
|
+
getType() {
|
|
259
|
+
return Array.isArray(this.resource["@type"]) ? this.resource["@type"].map((e) => this.getCompactedIri(e)) : this.resource["@type"] ? this.getCompactedIri(this.resource["@type"]) : "";
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Check if the resource has a specific type
|
|
263
|
+
* @param type
|
|
264
|
+
*/
|
|
265
|
+
hasType(e) {
|
|
266
|
+
const t = this.getType();
|
|
267
|
+
return t ? Array.isArray(t) ? t.includes(this.getCompactedIri(e)) : t === this.getCompactedIri(e) : !1;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Remove the resource from the cache
|
|
271
|
+
*/
|
|
272
|
+
async clearCache() {
|
|
273
|
+
await s.clearCache(this.resourceId);
|
|
274
|
+
}
|
|
275
|
+
getExpandedPredicate(e) {
|
|
276
|
+
return C(
|
|
277
|
+
d(this.clientContext, this.serverContext)
|
|
278
|
+
).expandTerm(e, !0);
|
|
279
|
+
}
|
|
280
|
+
getCompactedPredicate(e) {
|
|
281
|
+
return C(
|
|
282
|
+
d(this.clientContext, this.serverContext)
|
|
283
|
+
).compactIri(e, !0);
|
|
284
|
+
}
|
|
285
|
+
getCompactedIri(e) {
|
|
286
|
+
return C(
|
|
287
|
+
d(this.clientContext, this.serverContext)
|
|
288
|
+
).compactIri(e);
|
|
289
|
+
}
|
|
290
|
+
toString() {
|
|
291
|
+
return this.getCompactedIri(this.resource["@id"]);
|
|
292
|
+
}
|
|
293
|
+
[Symbol.toPrimitive]() {
|
|
294
|
+
return this.getCompactedIri(this.resource["@id"]);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Returns a Proxy which handles the different get requests
|
|
298
|
+
*/
|
|
299
|
+
getProxy() {
|
|
300
|
+
return new Proxy(this, {
|
|
301
|
+
get: (e, t) => {
|
|
302
|
+
if (this.resource) {
|
|
303
|
+
if (typeof e[t] == "function")
|
|
304
|
+
return e[t].bind(e);
|
|
305
|
+
switch (t) {
|
|
306
|
+
case "@id":
|
|
307
|
+
return this.resource["@id"] ? this.getCompactedIri(this.resource["@id"]) : void 0;
|
|
308
|
+
case "@type":
|
|
309
|
+
return this.resource["@type"];
|
|
310
|
+
// return synchronously
|
|
311
|
+
case "properties":
|
|
312
|
+
return this.getProperties();
|
|
313
|
+
case "ldp:contains":
|
|
314
|
+
case "listPredicate":
|
|
315
|
+
return this.getContainerList();
|
|
316
|
+
// returns standard arrays synchronously
|
|
317
|
+
case "permissions":
|
|
318
|
+
return this.getPermissions();
|
|
319
|
+
// get expanded permissions
|
|
320
|
+
case "clientContext":
|
|
321
|
+
return y(this.clientContext);
|
|
322
|
+
// get saved client context to re-fetch easily a resource
|
|
323
|
+
case "serverContext":
|
|
324
|
+
return y(this.serverContext);
|
|
325
|
+
// get saved client context to re-fetch easily a resource
|
|
326
|
+
case "then":
|
|
327
|
+
return;
|
|
328
|
+
default:
|
|
329
|
+
return e.get(t);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
export {
|
|
337
|
+
g as CustomGetter
|
|
338
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"autocompletion.placeholder": "Select a value",
|
|
3
|
+
"autocompletion.searchPlaceholder": "Search",
|
|
4
|
+
"autocompletion.searchText": "No result",
|
|
5
|
+
"solid-delete.button": "Delete",
|
|
6
|
+
"solid-form.submit-button": "Submit",
|
|
7
|
+
"solid-form.validation-error": "A validation error occurred.",
|
|
8
|
+
"validation.message": "Please, confirm your choice",
|
|
9
|
+
"validation.submit-text": "Yes",
|
|
10
|
+
"validation.cancel-text": "Cancel"
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
e as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"autocompletion.placeholder": "Sélectionner une valeur",
|
|
3
|
+
"autocompletion.searchPlaceholder": "Rechercher",
|
|
4
|
+
"autocompletion.searchText": "Aucun résultat",
|
|
5
|
+
"solid-delete.button": "Supprimer",
|
|
6
|
+
"solid-form.submit-button": "Envoyer",
|
|
7
|
+
"solid-form.validation-error": "Erreur de validation.",
|
|
8
|
+
"validation.message": "Merci de confirmer votre choix",
|
|
9
|
+
"validation.submit-text": "Oui",
|
|
10
|
+
"validation.cancel-text": "Annuler"
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
e as default
|
|
14
|
+
};
|