@startinblox/core 0.19.22-beta.5 → 0.20.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{helpers-D842zXW3.js → helpers-BICN491G.js} +18 -8
- package/dist/helpers.js +1 -1
- package/dist/index.js +964 -692
- package/dist/slimselect-WIZK5Hmq.js +4 -0
- package/package.json +4 -6
- package/dist/MarkerCluster-pBxvH3Oj.js +0 -4
- package/dist/MarkerCluster.Default-DBivQAto.js +0 -4
- package/dist/default-theme-CYuJ78jz.js +0 -4
- package/dist/leaflet-B-Oc5et1.js +0 -665
- package/dist/slimselect-DIo2l9XQ.js +0 -4
package/dist/index.js
CHANGED
|
@@ -2,11 +2,9 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
var _a2;
|
|
5
|
-
import { d as defineComponent, u as uniqID, i as importInlineCSS, a as asyncQuerySelector, f as fuzzyCompare, p as parseFieldsString, b as findClosingBracketMatchIndex, c as compare, e as evalTemplateString, g as generalComparator, s as setDeepProperty, t as transformArrayToContainer } from "./helpers-
|
|
6
|
-
import { h } from "./helpers-
|
|
5
|
+
import { d as defineComponent, u as uniqID, i as importInlineCSS, a as asyncQuerySelector, f as fuzzyCompare, p as parseFieldsString, b as findClosingBracketMatchIndex, c as compare, e as evalTemplateString, g as generalComparator, s as setDeepProperty, t as transformArrayToContainer } from "./helpers-BICN491G.js";
|
|
6
|
+
import { h } from "./helpers-BICN491G.js";
|
|
7
7
|
import PubSub$1 from "https://cdn.skypack.dev/pubsub-js";
|
|
8
|
-
import L$1 from "https://cdn.skypack.dev/leaflet";
|
|
9
|
-
import "https://cdn.skypack.dev/leaflet.markercluster";
|
|
10
8
|
if (!("flat" in Array.prototype)) {
|
|
11
9
|
Object.defineProperty(Array.prototype, "flat", {
|
|
12
10
|
configurable: true,
|
|
@@ -43,13 +41,7 @@ if (!Element.prototype.toggleAttribute) {
|
|
|
43
41
|
};
|
|
44
42
|
}
|
|
45
43
|
const HOOKS = ["created", "attached", "detached"];
|
|
46
|
-
const API = [
|
|
47
|
-
"name",
|
|
48
|
-
"use",
|
|
49
|
-
"attributes",
|
|
50
|
-
"initialState",
|
|
51
|
-
...HOOKS
|
|
52
|
-
];
|
|
44
|
+
const API = ["name", "use", "attributes", "initialState", ...HOOKS];
|
|
53
45
|
class Compositor {
|
|
54
46
|
static merge(component, mixins) {
|
|
55
47
|
return {
|
|
@@ -115,7 +107,9 @@ class Compositor {
|
|
|
115
107
|
static mergeMethods(mixins) {
|
|
116
108
|
const methods2 = /* @__PURE__ */ new Map();
|
|
117
109
|
mixins.reverse().forEach((mixin) => {
|
|
118
|
-
const keys2 = Reflect.ownKeys(mixin).filter(
|
|
110
|
+
const keys2 = Reflect.ownKeys(mixin).filter(
|
|
111
|
+
(key) => typeof key === "string" && API.indexOf(key) < 0 && !Object.getOwnPropertyDescriptor(mixin, key).get && !Object.getOwnPropertyDescriptor(mixin, key).set && typeof mixin[key] === "function"
|
|
112
|
+
);
|
|
119
113
|
keys2.forEach((key) => {
|
|
120
114
|
methods2.set(key, mixin[key]);
|
|
121
115
|
});
|
|
@@ -125,10 +119,20 @@ class Compositor {
|
|
|
125
119
|
static mergeAccessors(mixins) {
|
|
126
120
|
const accessors = {};
|
|
127
121
|
mixins.reverse().forEach((mixin) => {
|
|
128
|
-
Reflect.ownKeys(mixin).filter(
|
|
122
|
+
Reflect.ownKeys(mixin).filter(
|
|
123
|
+
(key) => typeof key === "string" && API.indexOf(key) < 0 && (Object.getOwnPropertyDescriptor(mixin, key).get || Object.getOwnPropertyDescriptor(mixin, key).set)
|
|
124
|
+
).forEach((prop2) => {
|
|
129
125
|
accessors[prop2] = { ...accessors[prop2] };
|
|
130
|
-
if (Reflect.getOwnPropertyDescriptor(mixin, prop2).get)
|
|
131
|
-
|
|
126
|
+
if (Reflect.getOwnPropertyDescriptor(mixin, prop2).get)
|
|
127
|
+
accessors[prop2].get = Reflect.getOwnPropertyDescriptor(
|
|
128
|
+
mixin,
|
|
129
|
+
prop2
|
|
130
|
+
).get;
|
|
131
|
+
if (Reflect.getOwnPropertyDescriptor(mixin, prop2).set)
|
|
132
|
+
accessors[prop2].set = Reflect.getOwnPropertyDescriptor(
|
|
133
|
+
mixin,
|
|
134
|
+
prop2
|
|
135
|
+
).set;
|
|
132
136
|
});
|
|
133
137
|
});
|
|
134
138
|
return accessors;
|
|
@@ -469,7 +473,9 @@ function trackRenderAsync(fn, context2) {
|
|
|
469
473
|
this.profiler.updateStats(componentName, renderTime);
|
|
470
474
|
this.profiler.printStats();
|
|
471
475
|
} else {
|
|
472
|
-
log.debug(
|
|
476
|
+
log.debug(
|
|
477
|
+
`Component ${componentName} rendered in ${renderTime.toFixed(2)} ms`
|
|
478
|
+
);
|
|
473
479
|
}
|
|
474
480
|
return result;
|
|
475
481
|
};
|
|
@@ -559,11 +565,26 @@ class ComponentFactory {
|
|
|
559
565
|
const { initialState, attributes, methods: methods2, hooks, accessors, name } = Compositor.merge(component, Compositor.mergeMixin(component));
|
|
560
566
|
let componentConstructor = class extends Component {
|
|
561
567
|
};
|
|
562
|
-
componentConstructor = ComponentFactory.bindInitialState(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
componentConstructor = ComponentFactory.
|
|
568
|
+
componentConstructor = ComponentFactory.bindInitialState(
|
|
569
|
+
componentConstructor,
|
|
570
|
+
initialState
|
|
571
|
+
);
|
|
572
|
+
componentConstructor = ComponentFactory.bindAttributes(
|
|
573
|
+
componentConstructor,
|
|
574
|
+
attributes
|
|
575
|
+
);
|
|
576
|
+
componentConstructor = ComponentFactory.bindMethods(
|
|
577
|
+
componentConstructor,
|
|
578
|
+
methods2
|
|
579
|
+
);
|
|
580
|
+
componentConstructor = ComponentFactory.bindAccessors(
|
|
581
|
+
componentConstructor,
|
|
582
|
+
accessors
|
|
583
|
+
);
|
|
584
|
+
componentConstructor = ComponentFactory.bindHooks(
|
|
585
|
+
componentConstructor,
|
|
586
|
+
hooks
|
|
587
|
+
);
|
|
567
588
|
Reflect.defineProperty(componentConstructor, "name", {
|
|
568
589
|
value: name
|
|
569
590
|
});
|
|
@@ -583,7 +604,9 @@ class ComponentFactory {
|
|
|
583
604
|
}
|
|
584
605
|
static bindAttributes(componentConstructor, attributes) {
|
|
585
606
|
if (attributes) {
|
|
586
|
-
const attributesList = Reflect.ownKeys(attributes).map(
|
|
607
|
+
const attributesList = Reflect.ownKeys(attributes).map(
|
|
608
|
+
(key) => String(key)
|
|
609
|
+
);
|
|
587
610
|
const attributesCallback = {};
|
|
588
611
|
attributesList.forEach((key) => {
|
|
589
612
|
const { default: def, type, required, callback } = attributes[key];
|
|
@@ -643,16 +666,29 @@ class ComponentFactory {
|
|
|
643
666
|
}
|
|
644
667
|
});
|
|
645
668
|
Reflect.defineProperty(componentConstructor, "observedAttributes", {
|
|
646
|
-
get: () => attributesList.map(
|
|
669
|
+
get: () => attributesList.map(
|
|
670
|
+
(attr) => attr.replace(/([a-z0-9])([A-Z0-9])/g, "$1-$2").toLowerCase()
|
|
671
|
+
)
|
|
647
672
|
});
|
|
648
|
-
Reflect.defineProperty(
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
673
|
+
Reflect.defineProperty(
|
|
674
|
+
componentConstructor.prototype,
|
|
675
|
+
"attributesCallback",
|
|
676
|
+
{
|
|
677
|
+
value: function(key, newValue, oldValue) {
|
|
678
|
+
if (key in attributesCallback) {
|
|
679
|
+
Reflect.apply(attributesCallback[key], this, [
|
|
680
|
+
newValue,
|
|
681
|
+
oldValue
|
|
682
|
+
]);
|
|
683
|
+
}
|
|
652
684
|
}
|
|
653
685
|
}
|
|
654
|
-
|
|
655
|
-
Reflect.defineProperty(
|
|
686
|
+
);
|
|
687
|
+
Reflect.defineProperty(
|
|
688
|
+
componentConstructor.prototype,
|
|
689
|
+
"attributesCallback",
|
|
690
|
+
attributesCallback
|
|
691
|
+
);
|
|
656
692
|
}
|
|
657
693
|
return componentConstructor;
|
|
658
694
|
}
|
|
@@ -733,7 +769,10 @@ class Sib {
|
|
|
733
769
|
return component.observedAttributes;
|
|
734
770
|
}
|
|
735
771
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
736
|
-
const attr = name.replace(
|
|
772
|
+
const attr = name.replace(
|
|
773
|
+
/([a-z0-9])-([a-z0-9])/g,
|
|
774
|
+
(_c, p1, p2) => `${p1}${p2.toUpperCase()}`
|
|
775
|
+
);
|
|
737
776
|
this.component.attributesCallback(attr, newValue, oldValue);
|
|
738
777
|
}
|
|
739
778
|
connectedCallback() {
|
|
@@ -1325,7 +1364,9 @@ class SpreadDirective extends i$2 {
|
|
|
1325
1364
|
if (part2.type === t.ATTRIBUTE || part2.type === t.PROPERTY) {
|
|
1326
1365
|
element = part2.element;
|
|
1327
1366
|
} else {
|
|
1328
|
-
console.warn(
|
|
1367
|
+
console.warn(
|
|
1368
|
+
"Unsupported part type or missing element, skipping update."
|
|
1369
|
+
);
|
|
1329
1370
|
return T;
|
|
1330
1371
|
}
|
|
1331
1372
|
if (spreadData) {
|
|
@@ -1403,7 +1444,10 @@ function preHTML(strings, ...values) {
|
|
|
1403
1444
|
const { needlessValues: needlessValues2 } = cached;
|
|
1404
1445
|
const isSame = needlessValues2.every((nv) => values[nv.index] === nv.value);
|
|
1405
1446
|
if (isSame) {
|
|
1406
|
-
return x(
|
|
1447
|
+
return x(
|
|
1448
|
+
cached.strings,
|
|
1449
|
+
...filterOutNeedlessValues(values, needlessValues2)
|
|
1450
|
+
);
|
|
1407
1451
|
}
|
|
1408
1452
|
}
|
|
1409
1453
|
}
|
|
@@ -1426,7 +1470,10 @@ function preHTML(strings, ...values) {
|
|
|
1426
1470
|
strings: finalStrings,
|
|
1427
1471
|
needlessValues
|
|
1428
1472
|
});
|
|
1429
|
-
return x(
|
|
1473
|
+
return x(
|
|
1474
|
+
finalStrings,
|
|
1475
|
+
...filterOutNeedlessValues(values, needlessValues)
|
|
1476
|
+
);
|
|
1430
1477
|
}
|
|
1431
1478
|
class PostProcessorRegistry {
|
|
1432
1479
|
constructor(currentPostProcessors = []) {
|
|
@@ -1559,7 +1606,10 @@ const BaseWidgetMixin = {
|
|
|
1559
1606
|
},
|
|
1560
1607
|
render() {
|
|
1561
1608
|
const listValueTransformationsCopy = this.listValueTransformations.deepCopy();
|
|
1562
|
-
listValueTransformationsCopy.attach(
|
|
1609
|
+
listValueTransformationsCopy.attach(
|
|
1610
|
+
this.renderTemplate.bind(this),
|
|
1611
|
+
"BaseWidgetMixin:renderTemplate"
|
|
1612
|
+
);
|
|
1563
1613
|
const nextProcessor = listValueTransformationsCopy.shift();
|
|
1564
1614
|
nextProcessor(this.value, listValueTransformationsCopy);
|
|
1565
1615
|
const listCallbacksCopy = this.listCallbacks.deepCopy();
|
|
@@ -1567,12 +1617,17 @@ const BaseWidgetMixin = {
|
|
|
1567
1617
|
if (nextCallback) {
|
|
1568
1618
|
nextCallback(this.value, listCallbacksCopy);
|
|
1569
1619
|
}
|
|
1570
|
-
this.element.dispatchEvent(
|
|
1620
|
+
this.element.dispatchEvent(
|
|
1621
|
+
new CustomEvent("widgetRendered", { bubbles: true })
|
|
1622
|
+
);
|
|
1571
1623
|
},
|
|
1572
1624
|
renderTemplate(value) {
|
|
1573
1625
|
const template = this.template(value, { ...this.listAttributes });
|
|
1574
1626
|
const listTemplateAdditionsCopy = this.listTemplateAdditions.deepCopy();
|
|
1575
|
-
listTemplateAdditionsCopy.attach(
|
|
1627
|
+
listTemplateAdditionsCopy.attach(
|
|
1628
|
+
this.templateToDOM.bind(this),
|
|
1629
|
+
"BaseWidgetMixin:templateToDOM"
|
|
1630
|
+
);
|
|
1576
1631
|
const nextProcessor = listTemplateAdditionsCopy.shift();
|
|
1577
1632
|
nextProcessor(template, listTemplateAdditionsCopy);
|
|
1578
1633
|
},
|
|
@@ -11146,7 +11201,8 @@ class CustomGetter {
|
|
|
11146
11201
|
if (!path) return;
|
|
11147
11202
|
try {
|
|
11148
11203
|
let isUrl = new URL(path);
|
|
11149
|
-
if (!isUrl.protocol.startsWith("http"))
|
|
11204
|
+
if (!isUrl.protocol.startsWith("http"))
|
|
11205
|
+
throw new Error("Not a valid HTTP url");
|
|
11150
11206
|
if (isUrl) {
|
|
11151
11207
|
let resources = this.resource[this.getExpandedPredicate(path)];
|
|
11152
11208
|
if (!resources) return void 0;
|
|
@@ -11154,7 +11210,13 @@ class CustomGetter {
|
|
|
11154
11210
|
let result = resources ? resources.map((res) => {
|
|
11155
11211
|
let resource = store.get(res["@id"]);
|
|
11156
11212
|
if (resource) return resource;
|
|
11157
|
-
resource = new CustomGetter(
|
|
11213
|
+
resource = new CustomGetter(
|
|
11214
|
+
res["@id"],
|
|
11215
|
+
{ "@id": res["@id"] },
|
|
11216
|
+
this.clientContext,
|
|
11217
|
+
this.serverContext,
|
|
11218
|
+
this.parentId
|
|
11219
|
+
).getProxy();
|
|
11158
11220
|
store.cacheResource(res["@id"], resource);
|
|
11159
11221
|
return resource;
|
|
11160
11222
|
}) : [];
|
|
@@ -11166,7 +11228,11 @@ class CustomGetter {
|
|
|
11166
11228
|
const path2 = [];
|
|
11167
11229
|
let value;
|
|
11168
11230
|
if (!this.isFullResource()) {
|
|
11169
|
-
await this.getResource(
|
|
11231
|
+
await this.getResource(
|
|
11232
|
+
this.resourceId,
|
|
11233
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11234
|
+
this.parentId
|
|
11235
|
+
);
|
|
11170
11236
|
}
|
|
11171
11237
|
while (true) {
|
|
11172
11238
|
value = await this.resource[this.getExpandedPredicate(path1[0])];
|
|
@@ -11176,10 +11242,18 @@ class CustomGetter {
|
|
|
11176
11242
|
}
|
|
11177
11243
|
if (path2.length === 0) {
|
|
11178
11244
|
if (!value || !value["@id"]) return this.getLiteralValue(value);
|
|
11179
|
-
return await this.getResource(
|
|
11245
|
+
return await this.getResource(
|
|
11246
|
+
value["@id"],
|
|
11247
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11248
|
+
this.parentId || this.resourceId
|
|
11249
|
+
);
|
|
11180
11250
|
}
|
|
11181
11251
|
if (!value || !value["@id"]) return void 0;
|
|
11182
|
-
let resource = await this.getResource(
|
|
11252
|
+
let resource = await this.getResource(
|
|
11253
|
+
value["@id"],
|
|
11254
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11255
|
+
this.parentId || this.resourceId
|
|
11256
|
+
);
|
|
11183
11257
|
store.subscribeResourceTo(this.resourceId, value["@id"]);
|
|
11184
11258
|
return resource ? await resource[path2.join(".")] : void 0;
|
|
11185
11259
|
}
|
|
@@ -11197,8 +11271,13 @@ class CustomGetter {
|
|
|
11197
11271
|
if (value.length === 0) return null;
|
|
11198
11272
|
if (Array.isArray(value[0])) {
|
|
11199
11273
|
const ln = store._getLanguage();
|
|
11200
|
-
let translatedValue = value.find(
|
|
11201
|
-
|
|
11274
|
+
let translatedValue = value.find(
|
|
11275
|
+
(v2) => v2["@language"] && v2["@language"] === ln
|
|
11276
|
+
);
|
|
11277
|
+
if (!translatedValue)
|
|
11278
|
+
translatedValue = value.find(
|
|
11279
|
+
(v2) => v2["@language"] && v2["@language"] === "en"
|
|
11280
|
+
);
|
|
11202
11281
|
return translatedValue ? translatedValue["@value"] || null : null;
|
|
11203
11282
|
}
|
|
11204
11283
|
return value;
|
|
@@ -11222,11 +11301,15 @@ class CustomGetter {
|
|
|
11222
11301
|
isContainer() {
|
|
11223
11302
|
if (this.resource["@type"]) {
|
|
11224
11303
|
if (Array.isArray(this.resource["@type"]))
|
|
11225
|
-
return this.containerTypes.some(
|
|
11304
|
+
return this.containerTypes.some(
|
|
11305
|
+
(type) => this.resource["@type"].includes(type)
|
|
11306
|
+
);
|
|
11226
11307
|
return this.containerTypes.includes(this.resource["@type"]);
|
|
11227
11308
|
} else if (this.resource["type"]) {
|
|
11228
11309
|
if (Array.isArray(this.resource["type"]))
|
|
11229
|
-
return this.containerTypes.some(
|
|
11310
|
+
return this.containerTypes.some(
|
|
11311
|
+
(type) => this.resource["type"].includes(type)
|
|
11312
|
+
);
|
|
11230
11313
|
return this.containerTypes.includes(this.resource["type"]);
|
|
11231
11314
|
}
|
|
11232
11315
|
return false;
|
|
@@ -11235,15 +11318,16 @@ class CustomGetter {
|
|
|
11235
11318
|
* Return true if the given key in the current resource in an array
|
|
11236
11319
|
*/
|
|
11237
11320
|
isArray() {
|
|
11238
|
-
if (Array.isArray(this.resource))
|
|
11239
|
-
return true;
|
|
11321
|
+
if (Array.isArray(this.resource)) return true;
|
|
11240
11322
|
return false;
|
|
11241
11323
|
}
|
|
11242
11324
|
/**
|
|
11243
11325
|
* Get all properties of a resource
|
|
11244
11326
|
*/
|
|
11245
11327
|
getProperties() {
|
|
11246
|
-
return Object.keys(this.resource).map(
|
|
11328
|
+
return Object.keys(this.resource).map(
|
|
11329
|
+
(prop2) => this.getCompactedPredicate(prop2)
|
|
11330
|
+
);
|
|
11247
11331
|
}
|
|
11248
11332
|
/**
|
|
11249
11333
|
* Get children of container as objects
|
|
@@ -11261,14 +11345,23 @@ class CustomGetter {
|
|
|
11261
11345
|
let result = children ? children.map((res) => {
|
|
11262
11346
|
let resource = store.get(res["@id"]);
|
|
11263
11347
|
if (resource) return resource;
|
|
11264
|
-
resource = new CustomGetter(
|
|
11348
|
+
resource = new CustomGetter(
|
|
11349
|
+
res["@id"],
|
|
11350
|
+
{ "@id": res["@id"] },
|
|
11351
|
+
this.clientContext,
|
|
11352
|
+
this.serverContext,
|
|
11353
|
+
this.parentId
|
|
11354
|
+
).getProxy();
|
|
11265
11355
|
store.cacheResource(res["@id"], resource);
|
|
11266
11356
|
return resource;
|
|
11267
11357
|
}) : [];
|
|
11268
11358
|
return result;
|
|
11269
11359
|
}
|
|
11270
11360
|
merge(resource) {
|
|
11271
|
-
this.resource = {
|
|
11361
|
+
this.resource = {
|
|
11362
|
+
...this.getResourceData(),
|
|
11363
|
+
...resource.getResourceData()
|
|
11364
|
+
};
|
|
11272
11365
|
}
|
|
11273
11366
|
getResourceData() {
|
|
11274
11367
|
return this.resource;
|
|
@@ -11278,7 +11371,9 @@ class CustomGetter {
|
|
|
11278
11371
|
* @param prop
|
|
11279
11372
|
*/
|
|
11280
11373
|
isFullResource() {
|
|
11281
|
-
let propertiesKeys = Object.keys(this.resource).filter(
|
|
11374
|
+
let propertiesKeys = Object.keys(this.resource).filter(
|
|
11375
|
+
(p2) => !p2.startsWith("@")
|
|
11376
|
+
);
|
|
11282
11377
|
if (this.resource["@id"].startsWith("_:b")) return true;
|
|
11283
11378
|
if (propertiesKeys.length === 1 && propertiesKeys[0] === this.getExpandedPredicate("permissions"))
|
|
11284
11379
|
return false;
|
|
@@ -11288,7 +11383,7 @@ class CustomGetter {
|
|
|
11288
11383
|
/**
|
|
11289
11384
|
* Get permissions of a resource
|
|
11290
11385
|
* @param resourceId
|
|
11291
|
-
* @returns
|
|
11386
|
+
* @returns
|
|
11292
11387
|
*/
|
|
11293
11388
|
async getPermissions() {
|
|
11294
11389
|
let permissions = this.resource[this.getExpandedPredicate("permissions")];
|
|
@@ -11317,13 +11412,24 @@ class CustomGetter {
|
|
|
11317
11412
|
store.clearCache(this.resourceId);
|
|
11318
11413
|
}
|
|
11319
11414
|
getExpandedPredicate(property) {
|
|
11320
|
-
return ContextParser$1.expandTerm(
|
|
11415
|
+
return ContextParser$1.expandTerm(
|
|
11416
|
+
property,
|
|
11417
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11418
|
+
true
|
|
11419
|
+
);
|
|
11321
11420
|
}
|
|
11322
11421
|
getCompactedPredicate(property) {
|
|
11323
|
-
return ContextParser$1.compactIri(
|
|
11422
|
+
return ContextParser$1.compactIri(
|
|
11423
|
+
property,
|
|
11424
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11425
|
+
true
|
|
11426
|
+
);
|
|
11324
11427
|
}
|
|
11325
11428
|
getCompactedIri(id2) {
|
|
11326
|
-
return ContextParser$1.compactIri(id2, {
|
|
11429
|
+
return ContextParser$1.compactIri(id2, {
|
|
11430
|
+
...this.clientContext,
|
|
11431
|
+
...this.serverContext
|
|
11432
|
+
});
|
|
11327
11433
|
}
|
|
11328
11434
|
toString() {
|
|
11329
11435
|
return this.getCompactedIri(this.resource["@id"]);
|
|
@@ -11338,13 +11444,13 @@ class CustomGetter {
|
|
|
11338
11444
|
return new Proxy(this, {
|
|
11339
11445
|
get: (resource, property) => {
|
|
11340
11446
|
if (!this.resource) return void 0;
|
|
11341
|
-
if (typeof resource[property] === "function")
|
|
11447
|
+
if (typeof resource[property] === "function")
|
|
11448
|
+
return resource[property].bind(resource);
|
|
11342
11449
|
switch (property) {
|
|
11343
11450
|
case "@id":
|
|
11344
11451
|
if (this.resource["@id"])
|
|
11345
11452
|
return this.getCompactedIri(this.resource["@id"]);
|
|
11346
|
-
else
|
|
11347
|
-
console.log(this.resource, this.resource["@id"]);
|
|
11453
|
+
else console.log(this.resource, this.resource["@id"]);
|
|
11348
11454
|
return;
|
|
11349
11455
|
case "@type":
|
|
11350
11456
|
return this.resource["@type"];
|
|
@@ -11369,7 +11475,9 @@ class CustomGetter {
|
|
|
11369
11475
|
}
|
|
11370
11476
|
function formatAttributesToServerSearchOptions(elementAttributes) {
|
|
11371
11477
|
var _a3, _b, _c;
|
|
11372
|
-
const attributes = new Map(
|
|
11478
|
+
const attributes = new Map(
|
|
11479
|
+
Array.from(elementAttributes).map(({ name, value: value2 }) => [name, value2])
|
|
11480
|
+
);
|
|
11373
11481
|
const fields = (_a3 = attributes.get("server-search-fields")) == null ? void 0 : _a3.split(",").map((field) => field.trim());
|
|
11374
11482
|
const value = (_b = attributes.get("server-search-value")) == null ? void 0 : _b.trim();
|
|
11375
11483
|
const method = (_c = attributes.get("server-search-method")) == null ? void 0 : _c.trim();
|
|
@@ -11394,7 +11502,9 @@ function appendServerSearchToIri(iri, options) {
|
|
|
11394
11502
|
return `${iri}${first}search-fields=${fields}&search-terms=${value}&search-method=${method}`;
|
|
11395
11503
|
}
|
|
11396
11504
|
function formatAttributesToServerPaginationOptions(elementAttributes) {
|
|
11397
|
-
const attributes = new Map(
|
|
11505
|
+
const attributes = new Map(
|
|
11506
|
+
Array.from(elementAttributes).map(({ name, value }) => [name, value])
|
|
11507
|
+
);
|
|
11398
11508
|
const limit = attributes.get("limit");
|
|
11399
11509
|
const offset = attributes.get("offset");
|
|
11400
11510
|
if (!offset || !limit) return;
|
|
@@ -11456,7 +11566,11 @@ class Store {
|
|
|
11456
11566
|
this.subscriptionIndex = /* @__PURE__ */ new Map();
|
|
11457
11567
|
this.subscriptionVirtualContainersIndex = /* @__PURE__ */ new Map();
|
|
11458
11568
|
this.loadingList = /* @__PURE__ */ new Set();
|
|
11459
|
-
this.headers = {
|
|
11569
|
+
this.headers = {
|
|
11570
|
+
Accept: "application/ld+json",
|
|
11571
|
+
"Content-Type": "application/ld+json",
|
|
11572
|
+
"Cache-Control": "must-revalidate"
|
|
11573
|
+
};
|
|
11460
11574
|
this.fetch = this.storeOptions.fetchMethod;
|
|
11461
11575
|
this.session = this.storeOptions.session;
|
|
11462
11576
|
}
|
|
@@ -11470,7 +11584,7 @@ class Store {
|
|
|
11470
11584
|
* @param serverPagination - Server pagination options
|
|
11471
11585
|
* @param serverSearch - Server search options
|
|
11472
11586
|
* @param predicateName - predicate name if we target a specific predicate from the resource, useful for arrays
|
|
11473
|
-
*
|
|
11587
|
+
*
|
|
11474
11588
|
* @returns The fetched resource
|
|
11475
11589
|
*
|
|
11476
11590
|
* @async
|
|
@@ -11486,10 +11600,14 @@ class Store {
|
|
|
11486
11600
|
}
|
|
11487
11601
|
if (localData == null && this.cache.has(key) && !this.loadingList.has(key)) {
|
|
11488
11602
|
const resource = this.get(key);
|
|
11489
|
-
if (resource && ((_a3 = resource.isFullResource) == null ? void 0 : _a3.call(resource)) && !forceFetch)
|
|
11603
|
+
if (resource && ((_a3 = resource.isFullResource) == null ? void 0 : _a3.call(resource)) && !forceFetch)
|
|
11604
|
+
return resource;
|
|
11490
11605
|
}
|
|
11491
11606
|
return new Promise(async (resolve2) => {
|
|
11492
|
-
document.addEventListener(
|
|
11607
|
+
document.addEventListener(
|
|
11608
|
+
"resourceReady",
|
|
11609
|
+
this.resolveResource(key, resolve2)
|
|
11610
|
+
);
|
|
11493
11611
|
if (this.loadingList.has(key)) return;
|
|
11494
11612
|
this.loadingList.add(key);
|
|
11495
11613
|
const clientContext = await myParser.parse(context2);
|
|
@@ -11498,20 +11616,48 @@ class Store {
|
|
|
11498
11616
|
if (localData == null) localData = {};
|
|
11499
11617
|
localData["@id"] = id2;
|
|
11500
11618
|
resource = localData;
|
|
11501
|
-
} else
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11619
|
+
} else
|
|
11620
|
+
try {
|
|
11621
|
+
resource = localData || await this.fetchData(
|
|
11622
|
+
id2,
|
|
11623
|
+
clientContext,
|
|
11624
|
+
parentId,
|
|
11625
|
+
serverPagination,
|
|
11626
|
+
serverSearch
|
|
11627
|
+
);
|
|
11628
|
+
} catch (error2) {
|
|
11629
|
+
console.error(error2);
|
|
11630
|
+
}
|
|
11506
11631
|
if (!resource) {
|
|
11507
11632
|
this.loadingList.delete(key);
|
|
11508
|
-
document.dispatchEvent(
|
|
11633
|
+
document.dispatchEvent(
|
|
11634
|
+
new CustomEvent("resourceReady", {
|
|
11635
|
+
detail: { id: key, resource: null, fetchedResource: null }
|
|
11636
|
+
})
|
|
11637
|
+
);
|
|
11509
11638
|
return;
|
|
11510
11639
|
}
|
|
11511
|
-
const serverContext = await myParser.parse([
|
|
11512
|
-
|
|
11640
|
+
const serverContext = await myParser.parse([
|
|
11641
|
+
resource["@context"] || base_context
|
|
11642
|
+
]);
|
|
11643
|
+
await this.cacheGraph(
|
|
11644
|
+
resource,
|
|
11645
|
+
clientContext,
|
|
11646
|
+
serverContext,
|
|
11647
|
+
parentId ? parentId : key,
|
|
11648
|
+
serverPagination,
|
|
11649
|
+
serverSearch
|
|
11650
|
+
);
|
|
11513
11651
|
this.loadingList.delete(key);
|
|
11514
|
-
document.dispatchEvent(
|
|
11652
|
+
document.dispatchEvent(
|
|
11653
|
+
new CustomEvent("resourceReady", {
|
|
11654
|
+
detail: {
|
|
11655
|
+
id: key,
|
|
11656
|
+
resource: this.get(key),
|
|
11657
|
+
fetchedResource: resource
|
|
11658
|
+
}
|
|
11659
|
+
})
|
|
11660
|
+
);
|
|
11515
11661
|
});
|
|
11516
11662
|
}
|
|
11517
11663
|
async fetchAuthn(iri, options) {
|
|
@@ -11520,7 +11666,8 @@ class Store {
|
|
|
11520
11666
|
if (this.fetch && authenticated) {
|
|
11521
11667
|
return this.fetch.then((fn) => fn(iri, options));
|
|
11522
11668
|
} else {
|
|
11523
|
-
if (options.headers)
|
|
11669
|
+
if (options.headers)
|
|
11670
|
+
options.headers = this._convertHeaders(options.headers);
|
|
11524
11671
|
return fetch(iri, options).then(function(response) {
|
|
11525
11672
|
return response;
|
|
11526
11673
|
});
|
|
@@ -11537,7 +11684,8 @@ class Store {
|
|
|
11537
11684
|
*/
|
|
11538
11685
|
async fetchData(id2, context2 = {}, parentId = "", serverPagination, serverSearch) {
|
|
11539
11686
|
let iri = this._getAbsoluteIri(id2, context2, parentId);
|
|
11540
|
-
if (serverPagination)
|
|
11687
|
+
if (serverPagination)
|
|
11688
|
+
iri = appendServerPaginationToIri(iri, serverPagination);
|
|
11541
11689
|
if (serverSearch) iri = appendServerSearchToIri(iri, serverSearch);
|
|
11542
11690
|
const headers = {
|
|
11543
11691
|
...this.headers,
|
|
@@ -11554,17 +11702,19 @@ class Store {
|
|
|
11554
11702
|
});
|
|
11555
11703
|
}
|
|
11556
11704
|
/**
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11705
|
+
* Cache the whole graph
|
|
11706
|
+
* @param resource - graph fetched
|
|
11707
|
+
* @param clientContext - context of the client app
|
|
11708
|
+
* @param parentContext - context of the server
|
|
11709
|
+
* @param parentId - id of the parent caller
|
|
11710
|
+
* @param serverPagination - Server pagination query params
|
|
11711
|
+
* @param serverSearch - Server search query params
|
|
11712
|
+
*/
|
|
11565
11713
|
async cacheGraph(resource, clientContext, parentContext, parentId, serverPagination, serverSearch) {
|
|
11566
11714
|
const flattenedResources = await jsonld$1.flatten(resource);
|
|
11567
|
-
const compactedResources = await Promise.all(
|
|
11715
|
+
const compactedResources = await Promise.all(
|
|
11716
|
+
flattenedResources.map((r3) => jsonld$1.compact(r3, {}))
|
|
11717
|
+
);
|
|
11568
11718
|
for (let resource2 of compactedResources) {
|
|
11569
11719
|
let id2 = resource2["@id"] || resource2["id"];
|
|
11570
11720
|
let key = resource2["@id"] || resource2["id"];
|
|
@@ -11572,11 +11722,21 @@ class Store {
|
|
|
11572
11722
|
if (key === "/") key = parentId;
|
|
11573
11723
|
if (key.startsWith("_:b")) key = key + parentId;
|
|
11574
11724
|
if (key === id2 && resource2["@type"] == this.getExpandedPredicate("ldp:Container", clientContext)) {
|
|
11575
|
-
if (serverPagination)
|
|
11725
|
+
if (serverPagination)
|
|
11726
|
+
key = appendServerPaginationToIri(key, serverPagination);
|
|
11576
11727
|
if (serverSearch) key = appendServerSearchToIri(key, serverSearch);
|
|
11577
11728
|
}
|
|
11578
|
-
const resourceProxy = new CustomGetter(
|
|
11579
|
-
|
|
11729
|
+
const resourceProxy = new CustomGetter(
|
|
11730
|
+
key,
|
|
11731
|
+
resource2,
|
|
11732
|
+
clientContext,
|
|
11733
|
+
parentContext,
|
|
11734
|
+
parentId,
|
|
11735
|
+
serverPagination,
|
|
11736
|
+
serverSearch
|
|
11737
|
+
).getProxy();
|
|
11738
|
+
if (resourceProxy.isContainer())
|
|
11739
|
+
this.subscribeChildren(resourceProxy, id2);
|
|
11580
11740
|
if (this.get(key)) {
|
|
11581
11741
|
this.cache.get(key).merge(resourceProxy);
|
|
11582
11742
|
} else {
|
|
@@ -11631,7 +11791,8 @@ class Store {
|
|
|
11631
11791
|
* @returns void
|
|
11632
11792
|
*/
|
|
11633
11793
|
async _updateResource(method, resource, id2) {
|
|
11634
|
-
if (!["POST", "PUT", "PATCH", "_LOCAL"].includes(method))
|
|
11794
|
+
if (!["POST", "PUT", "PATCH", "_LOCAL"].includes(method))
|
|
11795
|
+
throw new Error("Error: method not allowed");
|
|
11635
11796
|
const context2 = await myParser.parse([resource["@context"] || {}]);
|
|
11636
11797
|
const expandedId = this._getExpandedId(id2, context2);
|
|
11637
11798
|
return this._fetch(method, resource, id2).then(async (response) => {
|
|
@@ -11644,7 +11805,16 @@ class Store {
|
|
|
11644
11805
|
const nestedResources = await this.getNestedResources(resource, id2);
|
|
11645
11806
|
const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
|
|
11646
11807
|
const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
|
|
11647
|
-
return this.refreshResources([
|
|
11808
|
+
return this.refreshResources([
|
|
11809
|
+
...nestedResources,
|
|
11810
|
+
...resourcesToRefresh
|
|
11811
|
+
]).then(
|
|
11812
|
+
(resourceIds) => this.notifyResources([
|
|
11813
|
+
expandedId,
|
|
11814
|
+
...resourceIds,
|
|
11815
|
+
...resourcesToNotify
|
|
11816
|
+
])
|
|
11817
|
+
);
|
|
11648
11818
|
});
|
|
11649
11819
|
return ((_a3 = response.headers) == null ? void 0 : _a3.get("Location")) || null;
|
|
11650
11820
|
} else {
|
|
@@ -11661,12 +11831,19 @@ class Store {
|
|
|
11661
11831
|
resourceIds = [...new Set(resourceIds.filter((id2) => this.cache.has(id2)))];
|
|
11662
11832
|
const resourceWithContexts = resourceIds.map((resourceId) => {
|
|
11663
11833
|
var _a3;
|
|
11664
|
-
return {
|
|
11834
|
+
return {
|
|
11835
|
+
id: resourceId,
|
|
11836
|
+
context: (_a3 = store.get(resourceId)) == null ? void 0 : _a3.clientContext
|
|
11837
|
+
};
|
|
11665
11838
|
});
|
|
11666
11839
|
for (const resource of resourceWithContexts) {
|
|
11667
11840
|
if (!this._isLocalId(resource.id)) this.clearCache(resource.id);
|
|
11668
11841
|
}
|
|
11669
|
-
await Promise.all(
|
|
11842
|
+
await Promise.all(
|
|
11843
|
+
resourceWithContexts.map(
|
|
11844
|
+
({ id: id2, context: context2 }) => this.getData(id2, context2 || base_context)
|
|
11845
|
+
)
|
|
11846
|
+
);
|
|
11670
11847
|
return resourceIds;
|
|
11671
11848
|
}
|
|
11672
11849
|
/**
|
|
@@ -11719,7 +11896,8 @@ class Store {
|
|
|
11719
11896
|
const resource = this.cache.get(id2);
|
|
11720
11897
|
if (resource["@type"] === "ldp:Container") {
|
|
11721
11898
|
resource["ldp:contains"].forEach((child) => {
|
|
11722
|
-
if (child && child["@type"] === "ldp:Container")
|
|
11899
|
+
if (child && child["@type"] === "ldp:Container")
|
|
11900
|
+
this.cache.delete(child["@id"]);
|
|
11723
11901
|
});
|
|
11724
11902
|
}
|
|
11725
11903
|
this.cache.delete(id2);
|
|
@@ -11781,7 +11959,9 @@ class Store {
|
|
|
11781
11959
|
});
|
|
11782
11960
|
const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
|
|
11783
11961
|
const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
|
|
11784
|
-
this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(
|
|
11962
|
+
this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(
|
|
11963
|
+
(resourceIds) => this.notifyResources(resourceIds)
|
|
11964
|
+
);
|
|
11785
11965
|
return deleted;
|
|
11786
11966
|
}
|
|
11787
11967
|
/**
|
|
@@ -11806,8 +11986,7 @@ class Store {
|
|
|
11806
11986
|
* @returns The fully expanded term
|
|
11807
11987
|
*/
|
|
11808
11988
|
getExpandedPredicate(property, context2) {
|
|
11809
|
-
if (!context2)
|
|
11810
|
-
return ContextParser2.expandTerm(property, base_context, true);
|
|
11989
|
+
if (!context2) return ContextParser2.expandTerm(property, base_context, true);
|
|
11811
11990
|
return ContextParser2.expandTerm(property, context2, true);
|
|
11812
11991
|
}
|
|
11813
11992
|
/**
|
|
@@ -11817,8 +11996,7 @@ class Store {
|
|
|
11817
11996
|
* @returns The compacted term
|
|
11818
11997
|
*/
|
|
11819
11998
|
getCompactedIri(property, context2) {
|
|
11820
|
-
if (!context2)
|
|
11821
|
-
return ContextParser2.compactIri(property, base_context, true);
|
|
11999
|
+
if (!context2) return ContextParser2.compactIri(property, base_context, true);
|
|
11822
12000
|
return ContextParser2.compactIri(property, context2, true);
|
|
11823
12001
|
}
|
|
11824
12002
|
/**
|
|
@@ -11836,7 +12014,9 @@ class Store {
|
|
|
11836
12014
|
*/
|
|
11837
12015
|
subscribeResourceTo(resourceId, nestedResourceId) {
|
|
11838
12016
|
const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];
|
|
11839
|
-
this.subscriptionIndex.set(nestedResourceId, [
|
|
12017
|
+
this.subscriptionIndex.set(nestedResourceId, [
|
|
12018
|
+
.../* @__PURE__ */ new Set([...existingSubscriptions, resourceId])
|
|
12019
|
+
]);
|
|
11840
12020
|
}
|
|
11841
12021
|
/**
|
|
11842
12022
|
* Make a virtual container listen for changes of a resource
|
|
@@ -11845,7 +12025,9 @@ class Store {
|
|
|
11845
12025
|
*/
|
|
11846
12026
|
subscribeVirtualContainerTo(virtualContainerId, nestedResourceId) {
|
|
11847
12027
|
const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];
|
|
11848
|
-
this.subscriptionVirtualContainersIndex.set(nestedResourceId, [
|
|
12028
|
+
this.subscriptionVirtualContainersIndex.set(nestedResourceId, [
|
|
12029
|
+
.../* @__PURE__ */ new Set([...existingSubscriptions, virtualContainerId])
|
|
12030
|
+
]);
|
|
11849
12031
|
}
|
|
11850
12032
|
/**
|
|
11851
12033
|
* Return absolute IRI of the resource
|
|
@@ -11892,7 +12074,9 @@ if (window.sibStore) {
|
|
|
11892
12074
|
if (sibAuth) {
|
|
11893
12075
|
const sibAuthDefined = customElements.whenDefined(sibAuth.localName);
|
|
11894
12076
|
storeOptions.session = sibAuthDefined.then(() => sibAuth.session);
|
|
11895
|
-
storeOptions.fetchMethod = sibAuthDefined.then(
|
|
12077
|
+
storeOptions.fetchMethod = sibAuthDefined.then(
|
|
12078
|
+
() => sibAuth.getFetch()
|
|
12079
|
+
);
|
|
11896
12080
|
}
|
|
11897
12081
|
store = new Store(storeOptions);
|
|
11898
12082
|
window.sibStore = store;
|
|
@@ -11921,15 +12105,20 @@ const AttributeBinderMixin = {
|
|
|
11921
12105
|
async replaceAttributesData(reset = true) {
|
|
11922
12106
|
if (reset) this.resetAttributesData();
|
|
11923
12107
|
const oldAttributes = Array.from(this.element.attributes).reduce((obj, attr) => {
|
|
11924
|
-
if (!attr.value.match(/^store:\/\/(resource|container|user)/))
|
|
11925
|
-
|
|
12108
|
+
if (!attr.value.match(/^store:\/\/(resource|container|user)/))
|
|
12109
|
+
return { ...obj };
|
|
12110
|
+
if (!this.bindedAttributes[attr.name])
|
|
12111
|
+
this.bindedAttributes[attr.name] = attr.value;
|
|
11926
12112
|
return {
|
|
11927
12113
|
...obj,
|
|
11928
12114
|
[attr.name]: attr.value
|
|
11929
12115
|
// add "key: value"
|
|
11930
12116
|
};
|
|
11931
12117
|
}, {});
|
|
11932
|
-
const newAttributes = await this.transformAttributes(
|
|
12118
|
+
const newAttributes = await this.transformAttributes(
|
|
12119
|
+
{ ...oldAttributes },
|
|
12120
|
+
this.resource
|
|
12121
|
+
);
|
|
11933
12122
|
for (let attr of Object.keys(newAttributes)) {
|
|
11934
12123
|
if (oldAttributes[attr] == newAttributes[attr]) continue;
|
|
11935
12124
|
this.element.setAttribute(attr, newAttributes[attr]);
|
|
@@ -12012,7 +12201,8 @@ const ContextMixin = {
|
|
|
12012
12201
|
// take element extra context first
|
|
12013
12202
|
document.querySelector("[data-default-context]")
|
|
12014
12203
|
);
|
|
12015
|
-
if (extraContextElement)
|
|
12204
|
+
if (extraContextElement)
|
|
12205
|
+
return JSON.parse(extraContextElement.textContent || "{}");
|
|
12016
12206
|
return {};
|
|
12017
12207
|
}
|
|
12018
12208
|
};
|
|
@@ -12113,7 +12303,8 @@ const ServerPaginationMixin = {
|
|
|
12113
12303
|
const currentOffset = this.getCurrentOffset(resourceId, this.limit);
|
|
12114
12304
|
var currentPageNumber = this.getCurrentServedPage(resourceId, 1);
|
|
12115
12305
|
const pageCount = Math.ceil(this.pageCount / this.limit);
|
|
12116
|
-
B(
|
|
12306
|
+
B(
|
|
12307
|
+
x`
|
|
12117
12308
|
<button
|
|
12118
12309
|
data-id="prev"
|
|
12119
12310
|
?disabled=${currentOffset <= 0}
|
|
@@ -12129,7 +12320,9 @@ const ServerPaginationMixin = {
|
|
|
12129
12320
|
>→</button>
|
|
12130
12321
|
<span>
|
|
12131
12322
|
</span>
|
|
12132
|
-
`,
|
|
12323
|
+
`,
|
|
12324
|
+
div2
|
|
12325
|
+
);
|
|
12133
12326
|
}
|
|
12134
12327
|
}
|
|
12135
12328
|
};
|
|
@@ -12170,7 +12363,11 @@ const StoreMixin = {
|
|
|
12170
12363
|
type: String,
|
|
12171
12364
|
default: null,
|
|
12172
12365
|
callback: function(value) {
|
|
12173
|
-
if (value)
|
|
12366
|
+
if (value)
|
|
12367
|
+
this.predicateName = store.getExpandedPredicate(
|
|
12368
|
+
this.arrayField,
|
|
12369
|
+
this.context
|
|
12370
|
+
);
|
|
12174
12371
|
}
|
|
12175
12372
|
},
|
|
12176
12373
|
predicateName: {
|
|
@@ -12191,7 +12388,9 @@ const StoreMixin = {
|
|
|
12191
12388
|
get resource() {
|
|
12192
12389
|
var _a3;
|
|
12193
12390
|
let id2 = this.resourceId;
|
|
12194
|
-
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
12391
|
+
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
12392
|
+
this.element.attributes
|
|
12393
|
+
);
|
|
12195
12394
|
const serverSearch = mergeServerSearchOptions(
|
|
12196
12395
|
formatAttributesToServerSearchOptions(this.element.attributes),
|
|
12197
12396
|
(_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this)
|
|
@@ -12220,15 +12419,28 @@ const StoreMixin = {
|
|
|
12220
12419
|
}
|
|
12221
12420
|
}
|
|
12222
12421
|
this.updateNavigateSubscription();
|
|
12223
|
-
this.subscription = PubSub.subscribe(
|
|
12224
|
-
|
|
12422
|
+
this.subscription = PubSub.subscribe(
|
|
12423
|
+
this.resourceId,
|
|
12424
|
+
this.updateDOM.bind(this)
|
|
12425
|
+
);
|
|
12426
|
+
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
12427
|
+
this.element.attributes
|
|
12428
|
+
);
|
|
12225
12429
|
const dynamicServerSearch = (_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this);
|
|
12226
12430
|
const serverSearch = mergeServerSearchOptions(
|
|
12227
12431
|
formatAttributesToServerSearchOptions(this.element.attributes),
|
|
12228
12432
|
dynamicServerSearch
|
|
12229
12433
|
);
|
|
12230
12434
|
const forceRefetch = !!dynamicServerSearch;
|
|
12231
|
-
await store.getData(
|
|
12435
|
+
await store.getData(
|
|
12436
|
+
this.resourceId,
|
|
12437
|
+
this.context,
|
|
12438
|
+
void 0,
|
|
12439
|
+
void 0,
|
|
12440
|
+
forceRefetch,
|
|
12441
|
+
serverPagination,
|
|
12442
|
+
serverSearch
|
|
12443
|
+
);
|
|
12232
12444
|
this.updateDOM();
|
|
12233
12445
|
},
|
|
12234
12446
|
toggleLoaderHidden(toggle) {
|
|
@@ -12244,7 +12456,11 @@ const StoreMixin = {
|
|
|
12244
12456
|
setTimeout(
|
|
12245
12457
|
() => (
|
|
12246
12458
|
// Brings the dispatchEvent at the end of the queue
|
|
12247
|
-
this.element.dispatchEvent(
|
|
12459
|
+
this.element.dispatchEvent(
|
|
12460
|
+
new CustomEvent("populate", {
|
|
12461
|
+
detail: { resource: { "@id": this.dataSrc } }
|
|
12462
|
+
})
|
|
12463
|
+
)
|
|
12248
12464
|
)
|
|
12249
12465
|
);
|
|
12250
12466
|
this.toggleLoaderHidden(true);
|
|
@@ -12277,7 +12493,10 @@ const EditableMixin = {
|
|
|
12277
12493
|
}
|
|
12278
12494
|
},
|
|
12279
12495
|
created() {
|
|
12280
|
-
this.listTemplateAdditions.attach(
|
|
12496
|
+
this.listTemplateAdditions.attach(
|
|
12497
|
+
this.addEditButton.bind(this),
|
|
12498
|
+
"EditableMixin:addEditButton"
|
|
12499
|
+
);
|
|
12281
12500
|
},
|
|
12282
12501
|
addEditButton(template, listTemplateAdditions) {
|
|
12283
12502
|
let newTemplate = null;
|
|
@@ -12285,7 +12504,8 @@ const EditableMixin = {
|
|
|
12285
12504
|
newTemplate = x`${template}<button @click=${this.activateEditableField.bind(this)}>${this.buttonLabel}</button>`;
|
|
12286
12505
|
}
|
|
12287
12506
|
const nextProcessor = listTemplateAdditions.shift();
|
|
12288
|
-
if (nextProcessor)
|
|
12507
|
+
if (nextProcessor)
|
|
12508
|
+
nextProcessor(newTemplate || template, listTemplateAdditions);
|
|
12289
12509
|
},
|
|
12290
12510
|
activateEditableField(e2) {
|
|
12291
12511
|
const editableField = this.element.querySelector("[data-editable]");
|
|
@@ -12293,7 +12513,10 @@ const EditableMixin = {
|
|
|
12293
12513
|
editableField.toggleAttribute("contenteditable", true);
|
|
12294
12514
|
editableField.focus();
|
|
12295
12515
|
editButton.toggleAttribute("disabled", true);
|
|
12296
|
-
editableField.addEventListener(
|
|
12516
|
+
editableField.addEventListener(
|
|
12517
|
+
"focusout",
|
|
12518
|
+
() => this.save(editableField, editButton)
|
|
12519
|
+
);
|
|
12297
12520
|
},
|
|
12298
12521
|
save(editableField, editButton) {
|
|
12299
12522
|
editableField.toggleAttribute("contenteditable", false);
|
|
@@ -12387,7 +12610,8 @@ const FormMixin = {
|
|
|
12387
12610
|
},
|
|
12388
12611
|
getValue() {
|
|
12389
12612
|
if (!this.dataHolder || this.dataHolder.length === 0) return this.value;
|
|
12390
|
-
if (this.dataHolder.length > 1)
|
|
12613
|
+
if (this.dataHolder.length > 1)
|
|
12614
|
+
this.showDataHolderError(1, this.dataHolder.length);
|
|
12391
12615
|
return this.getValueFromElement(this.dataHolder[0]);
|
|
12392
12616
|
},
|
|
12393
12617
|
get type() {
|
|
@@ -12397,7 +12621,9 @@ const FormMixin = {
|
|
|
12397
12621
|
return false;
|
|
12398
12622
|
},
|
|
12399
12623
|
get dataHolder() {
|
|
12400
|
-
const dataHolders = Array.from(
|
|
12624
|
+
const dataHolders = Array.from(
|
|
12625
|
+
this.element.querySelectorAll("[data-holder]")
|
|
12626
|
+
);
|
|
12401
12627
|
const widgetDataHolders = dataHolders.filter((element) => {
|
|
12402
12628
|
const dataHolderAncestor = element.parentElement ? element.parentElement.closest("[data-holder]") : null;
|
|
12403
12629
|
return dataHolderAncestor === this.element || !dataHolderAncestor || !this.element.contains(dataHolderAncestor);
|
|
@@ -12408,7 +12634,9 @@ const FormMixin = {
|
|
|
12408
12634
|
return element.component ? element.component.getValue() : element.value;
|
|
12409
12635
|
},
|
|
12410
12636
|
showDataHolderError(expected, found) {
|
|
12411
|
-
console.warn(
|
|
12637
|
+
console.warn(
|
|
12638
|
+
`Expected ${expected} data-holder element in ${this.element.tagName}. Found ${found}`
|
|
12639
|
+
);
|
|
12412
12640
|
}
|
|
12413
12641
|
};
|
|
12414
12642
|
const FormCheckboxMixin = {
|
|
@@ -12488,10 +12716,13 @@ const FormDropdownMixin = {
|
|
|
12488
12716
|
getValue() {
|
|
12489
12717
|
if (!this.dataHolder) return "";
|
|
12490
12718
|
if (!this.multiple) {
|
|
12491
|
-
if (this.dataHolder.length > 1)
|
|
12719
|
+
if (this.dataHolder.length > 1)
|
|
12720
|
+
this.showDataHolderError(1, this.dataHolder.length);
|
|
12492
12721
|
return this.getValueFromElement(this.dataHolder[0]);
|
|
12493
12722
|
}
|
|
12494
|
-
const options = Array.from(
|
|
12723
|
+
const options = Array.from(
|
|
12724
|
+
this.element.querySelectorAll("option")
|
|
12725
|
+
);
|
|
12495
12726
|
return options.filter((el2) => el2.selected).map((el2) => el2.value ? JSON.parse(el2.value) : null);
|
|
12496
12727
|
},
|
|
12497
12728
|
get type() {
|
|
@@ -12524,7 +12755,9 @@ const FormCheckboxesMixin = {
|
|
|
12524
12755
|
this.listAttributes["values"] = [];
|
|
12525
12756
|
},
|
|
12526
12757
|
getValue() {
|
|
12527
|
-
const options = Array.from(
|
|
12758
|
+
const options = Array.from(
|
|
12759
|
+
this.element.querySelectorAll("input")
|
|
12760
|
+
);
|
|
12528
12761
|
return options.filter((el2) => el2.checked).map((el2) => {
|
|
12529
12762
|
if (!el2.value) return null;
|
|
12530
12763
|
let value = el2.value;
|
|
@@ -12548,7 +12781,9 @@ const FormRadioMixin = {
|
|
|
12548
12781
|
this.listAttributes["id"] = uniqID();
|
|
12549
12782
|
},
|
|
12550
12783
|
getValue() {
|
|
12551
|
-
const checkedElement = this.element.querySelector(
|
|
12784
|
+
const checkedElement = this.element.querySelector(
|
|
12785
|
+
"input[type=radio]:checked"
|
|
12786
|
+
);
|
|
12552
12787
|
return checkedElement ? checkedElement.value : "";
|
|
12553
12788
|
}
|
|
12554
12789
|
};
|
|
@@ -12653,7 +12888,8 @@ const MultipleFormMixin = {
|
|
|
12653
12888
|
type: String,
|
|
12654
12889
|
default: "+",
|
|
12655
12890
|
callback: function(value) {
|
|
12656
|
-
if (value !== this.listAttributes["addLabel"])
|
|
12891
|
+
if (value !== this.listAttributes["addLabel"])
|
|
12892
|
+
this.listAttributes["addLabel"] = value;
|
|
12657
12893
|
this.planRender();
|
|
12658
12894
|
}
|
|
12659
12895
|
},
|
|
@@ -12661,7 +12897,8 @@ const MultipleFormMixin = {
|
|
|
12661
12897
|
type: String,
|
|
12662
12898
|
default: "×",
|
|
12663
12899
|
callback: function(value) {
|
|
12664
|
-
if (value !== this.listAttributes["removeLabel"])
|
|
12900
|
+
if (value !== this.listAttributes["removeLabel"])
|
|
12901
|
+
this.listAttributes["removeLabel"] = value;
|
|
12665
12902
|
this.planRender();
|
|
12666
12903
|
}
|
|
12667
12904
|
},
|
|
@@ -12673,7 +12910,8 @@ const MultipleFormMixin = {
|
|
|
12673
12910
|
type: String,
|
|
12674
12911
|
default: void 0,
|
|
12675
12912
|
callback: function(value) {
|
|
12676
|
-
if (value !== this.listAttributes["addClass"])
|
|
12913
|
+
if (value !== this.listAttributes["addClass"])
|
|
12914
|
+
this.listAttributes["addClass"] = value;
|
|
12677
12915
|
this.planRender();
|
|
12678
12916
|
}
|
|
12679
12917
|
},
|
|
@@ -12681,13 +12919,17 @@ const MultipleFormMixin = {
|
|
|
12681
12919
|
type: String,
|
|
12682
12920
|
default: void 0,
|
|
12683
12921
|
callback: function(value) {
|
|
12684
|
-
if (value !== this.listAttributes["removeClass"])
|
|
12922
|
+
if (value !== this.listAttributes["removeClass"])
|
|
12923
|
+
this.listAttributes["removeClass"] = value;
|
|
12685
12924
|
this.planRender();
|
|
12686
12925
|
}
|
|
12687
12926
|
}
|
|
12688
12927
|
},
|
|
12689
12928
|
created() {
|
|
12690
|
-
this.listValueTransformations.attach(
|
|
12929
|
+
this.listValueTransformations.attach(
|
|
12930
|
+
this.setDataSrc.bind(this),
|
|
12931
|
+
"MultipleFormMixin:setDataSrc"
|
|
12932
|
+
);
|
|
12691
12933
|
this.listAttributes["children"] = [];
|
|
12692
12934
|
this.listAttributes["addLabel"] = this.addLabel;
|
|
12693
12935
|
this.listAttributes["removeLabel"] = this.removeLabel;
|
|
@@ -12728,12 +12970,13 @@ const MultipleFormMixin = {
|
|
|
12728
12970
|
const widget = document.createElement(this.widget);
|
|
12729
12971
|
const attributes = {
|
|
12730
12972
|
"data-holder": true,
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12973
|
+
name: this.name,
|
|
12974
|
+
value,
|
|
12975
|
+
range: this.range
|
|
12734
12976
|
};
|
|
12735
12977
|
for (let name of Object.keys(attributes)) {
|
|
12736
|
-
if (typeof attributes[name] === "boolean")
|
|
12978
|
+
if (typeof attributes[name] === "boolean")
|
|
12979
|
+
widget.toggleAttribute(name, attributes[name]);
|
|
12737
12980
|
else widget.setAttribute(name, attributes[name]);
|
|
12738
12981
|
}
|
|
12739
12982
|
this.listAttributes["children"].push(widget);
|
|
@@ -12765,7 +13008,8 @@ const MultipleselectFormMixin = {
|
|
|
12765
13008
|
type: String,
|
|
12766
13009
|
default: "",
|
|
12767
13010
|
callback: function(value) {
|
|
12768
|
-
if (value && value !== this.listAttributes["range"])
|
|
13011
|
+
if (value && value !== this.listAttributes["range"])
|
|
13012
|
+
this.listAttributes["range"] = value;
|
|
12769
13013
|
}
|
|
12770
13014
|
},
|
|
12771
13015
|
enum: {
|
|
@@ -12773,7 +13017,8 @@ const MultipleselectFormMixin = {
|
|
|
12773
13017
|
type: String,
|
|
12774
13018
|
default: "",
|
|
12775
13019
|
callback: function(value) {
|
|
12776
|
-
if (value && value !== this.listAttributes["enum"])
|
|
13020
|
+
if (value && value !== this.listAttributes["enum"])
|
|
13021
|
+
this.listAttributes["enum"] = value;
|
|
12777
13022
|
}
|
|
12778
13023
|
},
|
|
12779
13024
|
orderAsc: {
|
|
@@ -12792,7 +13037,10 @@ const MultipleselectFormMixin = {
|
|
|
12792
13037
|
}
|
|
12793
13038
|
},
|
|
12794
13039
|
created() {
|
|
12795
|
-
this.listValueTransformations.attach(
|
|
13040
|
+
this.listValueTransformations.attach(
|
|
13041
|
+
this.setDataSrc.bind(this),
|
|
13042
|
+
"MultipleselectFormMixin:setDataSrc"
|
|
13043
|
+
);
|
|
12796
13044
|
},
|
|
12797
13045
|
setDataSrc(value, listValueTransformations) {
|
|
12798
13046
|
if (value && value !== this.dataSrc) {
|
|
@@ -12812,7 +13060,8 @@ const MultipleselectFormMixin = {
|
|
|
12812
13060
|
if (nextProcessor) nextProcessor(value, listValueTransformations);
|
|
12813
13061
|
},
|
|
12814
13062
|
populate() {
|
|
12815
|
-
if (!this.resource || !this.resource["ldp:contains"] && !Array.isArray(this.resource))
|
|
13063
|
+
if (!this.resource || !this.resource["ldp:contains"] && !Array.isArray(this.resource))
|
|
13064
|
+
return;
|
|
12816
13065
|
this.setValue(this.resource["ldp:contains"]);
|
|
12817
13066
|
this.planRender();
|
|
12818
13067
|
},
|
|
@@ -12865,7 +13114,10 @@ const SorterMixin = {
|
|
|
12865
13114
|
randomOrder: null
|
|
12866
13115
|
},
|
|
12867
13116
|
attached() {
|
|
12868
|
-
this.listPostProcessors.attach(
|
|
13117
|
+
this.listPostProcessors.attach(
|
|
13118
|
+
this.orderCallback.bind(this),
|
|
13119
|
+
"SorterMixin:orderCallback"
|
|
13120
|
+
);
|
|
12869
13121
|
},
|
|
12870
13122
|
created() {
|
|
12871
13123
|
this.randomOrder = [];
|
|
@@ -12906,17 +13158,20 @@ const SorterMixin = {
|
|
|
12906
13158
|
if (sortingKey) {
|
|
12907
13159
|
let orderToSort = true;
|
|
12908
13160
|
if (this.orderDesc || orderValueToSort == "desc") orderToSort = false;
|
|
12909
|
-
resources = (await Promise.all(
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
13161
|
+
resources = (await Promise.all(
|
|
13162
|
+
resources.map(async (resource) => ({
|
|
13163
|
+
sortingKey: await resource[sortingKey],
|
|
13164
|
+
// fetch sorting value
|
|
13165
|
+
proxy: resource
|
|
13166
|
+
// and keep proxy
|
|
13167
|
+
}))
|
|
13168
|
+
)).sort(this.sortValuesByKey("sortingKey", orderToSort)).map((r3) => r3.proxy);
|
|
12915
13169
|
} else if (this.isRandomSorted()) {
|
|
12916
13170
|
resources = this.shuffleResources(resources);
|
|
12917
13171
|
}
|
|
12918
13172
|
const nextProcessor = listPostProcessors.shift();
|
|
12919
|
-
if (nextProcessor)
|
|
13173
|
+
if (nextProcessor)
|
|
13174
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
12920
13175
|
},
|
|
12921
13176
|
isRandomSorted() {
|
|
12922
13177
|
return this.orderByRandom !== null;
|
|
@@ -12929,7 +13184,9 @@ const SorterMixin = {
|
|
|
12929
13184
|
const varB = b2[key];
|
|
12930
13185
|
let comparison = 0;
|
|
12931
13186
|
if (typeof varA === "string" && typeof varB === "string") {
|
|
12932
|
-
comparison = varA.localeCompare(varB, void 0, {
|
|
13187
|
+
comparison = varA.localeCompare(varB, void 0, {
|
|
13188
|
+
sensitivity: "base"
|
|
13189
|
+
});
|
|
12933
13190
|
comparison = asc ? comparison : -comparison;
|
|
12934
13191
|
} else {
|
|
12935
13192
|
if (varA > varB) comparison = asc ? 1 : -1;
|
|
@@ -12962,14 +13219,18 @@ const FederationMixin = {
|
|
|
12962
13219
|
containerFetched: null
|
|
12963
13220
|
},
|
|
12964
13221
|
attached() {
|
|
12965
|
-
this.listPostProcessors.attach(
|
|
13222
|
+
this.listPostProcessors.attach(
|
|
13223
|
+
this.fetchSources.bind(this),
|
|
13224
|
+
"FederationMixin:fetchSources"
|
|
13225
|
+
);
|
|
12966
13226
|
},
|
|
12967
13227
|
async fetchSources(resources, listPostProcessors, div2, context2) {
|
|
12968
13228
|
this.containerFetched = [];
|
|
12969
13229
|
let newResources = await this.getResources(resources);
|
|
12970
13230
|
newResources = [...new Set(newResources)];
|
|
12971
13231
|
const nextProcessor = listPostProcessors.shift();
|
|
12972
|
-
if (nextProcessor)
|
|
13232
|
+
if (nextProcessor)
|
|
13233
|
+
await nextProcessor(newResources, listPostProcessors, div2, context2);
|
|
12973
13234
|
},
|
|
12974
13235
|
async getResources(resources) {
|
|
12975
13236
|
if (!resources) return [];
|
|
@@ -12982,7 +13243,8 @@ const FederationMixin = {
|
|
|
12982
13243
|
if (!this.containerFetched.includes(containerId)) {
|
|
12983
13244
|
this.containerFetched.push(containerId);
|
|
12984
13245
|
const resourcesFetched = await this.fetchSource(containerId);
|
|
12985
|
-
if (resourcesFetched)
|
|
13246
|
+
if (resourcesFetched)
|
|
13247
|
+
newResources.push(...await this.getResources(resourcesFetched));
|
|
12986
13248
|
}
|
|
12987
13249
|
} else {
|
|
12988
13250
|
newResources.push(res);
|
|
@@ -13003,11 +13265,7 @@ const FederationMixin = {
|
|
|
13003
13265
|
};
|
|
13004
13266
|
const RangeMixin = {
|
|
13005
13267
|
name: "range-mixin",
|
|
13006
|
-
use: [
|
|
13007
|
-
StoreMixin,
|
|
13008
|
-
SorterMixin,
|
|
13009
|
-
FederationMixin
|
|
13010
|
-
],
|
|
13268
|
+
use: [StoreMixin, SorterMixin, FederationMixin],
|
|
13011
13269
|
attributes: {
|
|
13012
13270
|
range: {
|
|
13013
13271
|
type: String,
|
|
@@ -13066,19 +13324,20 @@ const RangeMixin = {
|
|
|
13066
13324
|
async populate() {
|
|
13067
13325
|
const resources = this.resource ? this.resource["ldp:contains"] : [];
|
|
13068
13326
|
const listPostProcessorsCopy = this.listPostProcessors.deepCopy();
|
|
13069
|
-
listPostProcessorsCopy.attach(
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
resources,
|
|
13073
|
-
listPostProcessorsCopy,
|
|
13074
|
-
null,
|
|
13075
|
-
this.dataSrc
|
|
13327
|
+
listPostProcessorsCopy.attach(
|
|
13328
|
+
this.setRangeAttribute.bind(this),
|
|
13329
|
+
"RangeMixin:setRangeAttribute"
|
|
13076
13330
|
);
|
|
13331
|
+
const nextProcessor = listPostProcessorsCopy.shift();
|
|
13332
|
+
await nextProcessor(resources, listPostProcessorsCopy, null, this.dataSrc);
|
|
13077
13333
|
},
|
|
13078
13334
|
async setRangeAttribute(resources) {
|
|
13079
13335
|
if (resources) {
|
|
13080
13336
|
const getRangeValue = async (resource) => {
|
|
13081
|
-
let res = await store.getData(
|
|
13337
|
+
let res = await store.getData(
|
|
13338
|
+
resource["@id"],
|
|
13339
|
+
this.context || base_context
|
|
13340
|
+
);
|
|
13082
13341
|
if (res === null) {
|
|
13083
13342
|
res = resource;
|
|
13084
13343
|
}
|
|
@@ -13129,7 +13388,8 @@ const FilterRangeFormMixin = {
|
|
|
13129
13388
|
},
|
|
13130
13389
|
getValue() {
|
|
13131
13390
|
if (!this.dataHolder) return [];
|
|
13132
|
-
if (this.dataHolder.length !== 2)
|
|
13391
|
+
if (this.dataHolder.length !== 2)
|
|
13392
|
+
this.showDataHolderError(2, this.dataHolder.length);
|
|
13133
13393
|
return [
|
|
13134
13394
|
// we expect 2 values, one min and one max
|
|
13135
13395
|
this.getValueFromElement(this.dataHolder[0]),
|
|
@@ -13997,22 +14257,26 @@ const formTemplates = {
|
|
|
13997
14257
|
${attributes.placeholder || "-"}
|
|
13998
14258
|
</option>
|
|
13999
14259
|
` : ""}
|
|
14000
|
-
${(attributes.range || []).map(
|
|
14260
|
+
${(attributes.range || []).map(
|
|
14261
|
+
(el2) => x`
|
|
14001
14262
|
<option
|
|
14002
14263
|
value=${el2.value}
|
|
14003
14264
|
?selected=${!attributes.multiple ? value === el2.selectedValue : attributes.values.includes(el2.selectedValue)}
|
|
14004
14265
|
>
|
|
14005
14266
|
${el2.label}
|
|
14006
14267
|
</option>
|
|
14007
|
-
`
|
|
14008
|
-
|
|
14268
|
+
`
|
|
14269
|
+
)}
|
|
14270
|
+
${Object.entries(attributes.enum || []).map(
|
|
14271
|
+
([key, val]) => x`
|
|
14009
14272
|
<option
|
|
14010
14273
|
value="${key}"
|
|
14011
14274
|
?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}
|
|
14012
14275
|
>
|
|
14013
14276
|
${val}
|
|
14014
14277
|
</option>
|
|
14015
|
-
`
|
|
14278
|
+
`
|
|
14279
|
+
)}
|
|
14016
14280
|
</select>
|
|
14017
14281
|
`,
|
|
14018
14282
|
dependencies: [FormDropdownMixin, FormMixin, RangeMixin]
|
|
@@ -14022,7 +14286,8 @@ const formTemplates = {
|
|
|
14022
14286
|
<div
|
|
14023
14287
|
name=${o$2(attributes.name)}
|
|
14024
14288
|
>
|
|
14025
|
-
${(attributes.range || []).map(
|
|
14289
|
+
${(attributes.range || []).map(
|
|
14290
|
+
(el2) => x`
|
|
14026
14291
|
<label>
|
|
14027
14292
|
<input
|
|
14028
14293
|
type="radio"
|
|
@@ -14032,8 +14297,10 @@ const formTemplates = {
|
|
|
14032
14297
|
?checked=${value === el2.selectedValue}
|
|
14033
14298
|
> <span>${el2.label}</span>
|
|
14034
14299
|
</label>
|
|
14035
|
-
`
|
|
14036
|
-
|
|
14300
|
+
`
|
|
14301
|
+
)}
|
|
14302
|
+
${Object.entries(attributes.enum || []).map(
|
|
14303
|
+
([key, val]) => x`
|
|
14037
14304
|
<label>
|
|
14038
14305
|
<input
|
|
14039
14306
|
type="radio"
|
|
@@ -14043,7 +14310,8 @@ const formTemplates = {
|
|
|
14043
14310
|
?checked=${value === key}
|
|
14044
14311
|
> <span>${val}</span>
|
|
14045
14312
|
</label>
|
|
14046
|
-
`
|
|
14313
|
+
`
|
|
14314
|
+
)}
|
|
14047
14315
|
`,
|
|
14048
14316
|
dependencies: [FormRadioMixin, FormMixin, RangeMixin]
|
|
14049
14317
|
},
|
|
@@ -14052,7 +14320,8 @@ const formTemplates = {
|
|
|
14052
14320
|
<div
|
|
14053
14321
|
name=${o$2(attributes.name)}
|
|
14054
14322
|
>
|
|
14055
|
-
${(attributes.range || []).map(
|
|
14323
|
+
${(attributes.range || []).map(
|
|
14324
|
+
(el2) => x`
|
|
14056
14325
|
<label>
|
|
14057
14326
|
<input
|
|
14058
14327
|
type="checkbox"
|
|
@@ -14060,14 +14329,17 @@ const formTemplates = {
|
|
|
14060
14329
|
?checked=${attributes.values.includes(el2.selectedValue)}
|
|
14061
14330
|
/> <span>${el2.label}</span>
|
|
14062
14331
|
</label>
|
|
14063
|
-
`
|
|
14064
|
-
|
|
14332
|
+
`
|
|
14333
|
+
)}
|
|
14334
|
+
${Object.entries(attributes.enum || []).map(
|
|
14335
|
+
([key, val]) => x`
|
|
14065
14336
|
<label>
|
|
14066
14337
|
<input type="checkbox"
|
|
14067
14338
|
value="${key}"
|
|
14068
14339
|
/> <span>${val}</span>
|
|
14069
14340
|
</label>
|
|
14070
|
-
`
|
|
14341
|
+
`
|
|
14342
|
+
)}
|
|
14071
14343
|
</select>
|
|
14072
14344
|
`,
|
|
14073
14345
|
dependencies: [FormCheckboxesMixin, FormMixin, RangeMixin]
|
|
@@ -14091,12 +14363,14 @@ const formTemplates = {
|
|
|
14091
14363
|
},
|
|
14092
14364
|
multiple: {
|
|
14093
14365
|
template: (_value, attributes) => x`
|
|
14094
|
-
${(attributes.children || []).map(
|
|
14366
|
+
${(attributes.children || []).map(
|
|
14367
|
+
(child, index2) => x`
|
|
14095
14368
|
<div data-index=${attributes.name + index2}>
|
|
14096
14369
|
${child}
|
|
14097
14370
|
<button type="button" class=${o$2(attributes.removeClass)} @click=${() => attributes.removeItem(index2)}>${attributes.removeLabel}</button>
|
|
14098
14371
|
</div>
|
|
14099
|
-
`
|
|
14372
|
+
`
|
|
14373
|
+
)}
|
|
14100
14374
|
<button type="button" class=${o$2(attributes.addClass)} @click=${attributes.addItem}>${attributes.addLabel}</button>
|
|
14101
14375
|
`,
|
|
14102
14376
|
dependencies: [MultipleFormMixin, FormMixin]
|
|
@@ -14299,7 +14573,10 @@ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
14299
14573
|
const DateMixin = {
|
|
14300
14574
|
name: "date-mixin",
|
|
14301
14575
|
created() {
|
|
14302
|
-
this.listValueTransformations.attach(
|
|
14576
|
+
this.listValueTransformations.attach(
|
|
14577
|
+
this.transformValue.bind(this),
|
|
14578
|
+
"DateMixin:transformValue"
|
|
14579
|
+
);
|
|
14303
14580
|
},
|
|
14304
14581
|
transformValue(value, listValueTransformations) {
|
|
14305
14582
|
try {
|
|
@@ -14326,7 +14603,10 @@ const DateMixin = {
|
|
|
14326
14603
|
const DateTimeMixin = {
|
|
14327
14604
|
name: "date-time-mixin",
|
|
14328
14605
|
created() {
|
|
14329
|
-
this.listValueTransformations.attach(
|
|
14606
|
+
this.listValueTransformations.attach(
|
|
14607
|
+
this.transformValue.bind(this),
|
|
14608
|
+
"DateTimeMixin:transformValue"
|
|
14609
|
+
);
|
|
14330
14610
|
},
|
|
14331
14611
|
transformValue(value, listValueTransformations) {
|
|
14332
14612
|
const newValue = value ? new Date(value).toLocaleString() : value;
|
|
@@ -14358,7 +14638,10 @@ const o$1 = e$1(e);
|
|
|
14358
14638
|
const MultilineMixin = {
|
|
14359
14639
|
name: "multiline-mixin",
|
|
14360
14640
|
created() {
|
|
14361
|
-
this.listValueTransformations.attach(
|
|
14641
|
+
this.listValueTransformations.attach(
|
|
14642
|
+
this.transformValue.bind(this),
|
|
14643
|
+
"MultilineMixin:transformValue"
|
|
14644
|
+
);
|
|
14362
14645
|
},
|
|
14363
14646
|
transformValue(value, listValueTransformations) {
|
|
14364
14647
|
const newValue = value ? o$1(value.replace(/\n/g, "<br/>")) : value;
|
|
@@ -19585,7 +19868,10 @@ const mila = /* @__PURE__ */ getDefaultExportFromCjs(markdownItLinkAttributes);
|
|
|
19585
19868
|
const MarkdownMixin = {
|
|
19586
19869
|
name: "markdown-mixin",
|
|
19587
19870
|
created() {
|
|
19588
|
-
this.listValueTransformations.attach(
|
|
19871
|
+
this.listValueTransformations.attach(
|
|
19872
|
+
this.transformValue.bind(this),
|
|
19873
|
+
"MarkdownMixin:transformValue"
|
|
19874
|
+
);
|
|
19589
19875
|
},
|
|
19590
19876
|
transformValue(value, listValueTransformations) {
|
|
19591
19877
|
let newValue = "";
|
|
@@ -19614,7 +19900,10 @@ const OembedMixin = {
|
|
|
19614
19900
|
existingOembed: null
|
|
19615
19901
|
},
|
|
19616
19902
|
created() {
|
|
19617
|
-
this.listValueTransformations.attach(
|
|
19903
|
+
this.listValueTransformations.attach(
|
|
19904
|
+
this.transformValue.bind(this),
|
|
19905
|
+
"OembedMixin:transformValue"
|
|
19906
|
+
);
|
|
19618
19907
|
},
|
|
19619
19908
|
async transformValue(value, listValueTransformations) {
|
|
19620
19909
|
if (!value) return;
|
|
@@ -21869,13 +22158,17 @@ function normalizeTruncateCfg(truncate) {
|
|
|
21869
22158
|
const AutolinkMixin = {
|
|
21870
22159
|
name: "autolink-mixin",
|
|
21871
22160
|
created() {
|
|
21872
|
-
this.listValueTransformations.attach(
|
|
22161
|
+
this.listValueTransformations.attach(
|
|
22162
|
+
this.transformValue.bind(this),
|
|
22163
|
+
"AutolinkMixin:transformValue"
|
|
22164
|
+
);
|
|
21873
22165
|
},
|
|
21874
22166
|
transformValue(value, listValueTransformations) {
|
|
21875
22167
|
const template = document.createElement("template");
|
|
21876
22168
|
template.innerHTML = Autolinker.link(value);
|
|
21877
22169
|
const nextProcessor = listValueTransformations.shift();
|
|
21878
|
-
if (nextProcessor)
|
|
22170
|
+
if (nextProcessor)
|
|
22171
|
+
nextProcessor(template.content, listValueTransformations);
|
|
21879
22172
|
}
|
|
21880
22173
|
};
|
|
21881
22174
|
const valueTransformationDirectory = {
|
|
@@ -21890,7 +22183,10 @@ const LabelMixin = {
|
|
|
21890
22183
|
name: "label-mixin",
|
|
21891
22184
|
created() {
|
|
21892
22185
|
this.listAttributes["id"] = uniqID();
|
|
21893
|
-
this.listTemplateAdditions.attach(
|
|
22186
|
+
this.listTemplateAdditions.attach(
|
|
22187
|
+
this.addLabel.bind(this),
|
|
22188
|
+
"LabelMixin:addLabel"
|
|
22189
|
+
);
|
|
21894
22190
|
},
|
|
21895
22191
|
addLabel(template, listTemplateAdditions) {
|
|
21896
22192
|
const newTemplate = x`<label for="${this.listAttributes["id"]}">${this.label || this.name}</label>${template}`;
|
|
@@ -21901,7 +22197,10 @@ const LabelMixin = {
|
|
|
21901
22197
|
const LabelLastMixin = {
|
|
21902
22198
|
name: "label-last-mixin",
|
|
21903
22199
|
created() {
|
|
21904
|
-
this.listTemplateAdditions.attach(
|
|
22200
|
+
this.listTemplateAdditions.attach(
|
|
22201
|
+
this.addLabelLast.bind(this),
|
|
22202
|
+
"LabelLastMixin:addLabelLast"
|
|
22203
|
+
);
|
|
21905
22204
|
},
|
|
21906
22205
|
addLabelLast(template, listTemplateAdditions) {
|
|
21907
22206
|
const newTemplate = x`${template}<label>${this.label || this.name}</label>`;
|
|
@@ -21912,13 +22211,20 @@ const LabelLastMixin = {
|
|
|
21912
22211
|
const AddableMixin = {
|
|
21913
22212
|
name: "addable-mixin",
|
|
21914
22213
|
created() {
|
|
21915
|
-
this.listTemplateAdditions.attach(
|
|
22214
|
+
this.listTemplateAdditions.attach(
|
|
22215
|
+
this.addableValue.bind(this),
|
|
22216
|
+
"AddableMixin:addableValue"
|
|
22217
|
+
);
|
|
21916
22218
|
},
|
|
21917
22219
|
getAddableAttributes() {
|
|
21918
|
-
const addableAttr = Array.from(this.element.attributes).filter(
|
|
22220
|
+
const addableAttr = Array.from(this.element.attributes).filter(
|
|
22221
|
+
(a2) => a2.name.startsWith("addable-")
|
|
22222
|
+
);
|
|
21919
22223
|
const cleanAddableAttr = {};
|
|
21920
|
-
for (let attr of addableAttr)
|
|
21921
|
-
|
|
22224
|
+
for (let attr of addableAttr)
|
|
22225
|
+
cleanAddableAttr[attr.name.replace("addable-", "")] = attr.value;
|
|
22226
|
+
if (!cleanAddableAttr.hasOwnProperty("data-src"))
|
|
22227
|
+
cleanAddableAttr["data-src"] = this.range;
|
|
21922
22228
|
return cleanAddableAttr;
|
|
21923
22229
|
},
|
|
21924
22230
|
addableValue(template, listTemplateAdditions, attributes) {
|
|
@@ -24020,7 +24326,9 @@ const TranslationMixin = {
|
|
|
24020
24326
|
fr: () => import("./fr-ClQZ5-J-.js")
|
|
24021
24327
|
};
|
|
24022
24328
|
if (!translationsModules[langCode]) {
|
|
24023
|
-
console.warn(
|
|
24329
|
+
console.warn(
|
|
24330
|
+
`${langCode}.json translation file may not exist, English is setted by default`
|
|
24331
|
+
);
|
|
24024
24332
|
langCode = "en";
|
|
24025
24333
|
}
|
|
24026
24334
|
const module2 = await translationsModules[langCode]();
|
|
@@ -24076,11 +24384,20 @@ const AutocompletionMixin = {
|
|
|
24076
24384
|
mutationObserver: null
|
|
24077
24385
|
},
|
|
24078
24386
|
created() {
|
|
24079
|
-
importInlineCSS(
|
|
24080
|
-
|
|
24387
|
+
importInlineCSS(
|
|
24388
|
+
"slimselect-base",
|
|
24389
|
+
() => import("./slimselect-BTZP03JZ.js")
|
|
24390
|
+
);
|
|
24391
|
+
importInlineCSS(
|
|
24392
|
+
"slimselect-local",
|
|
24393
|
+
() => import("./slimselect-WIZK5Hmq.js")
|
|
24394
|
+
);
|
|
24081
24395
|
this.slimSelect = null;
|
|
24082
24396
|
this.addToAttributes(true, "autocomplete");
|
|
24083
|
-
this.listCallbacks.attach(
|
|
24397
|
+
this.listCallbacks.attach(
|
|
24398
|
+
this.addCallback.bind(this),
|
|
24399
|
+
"AutocompletionMixin:addCallback"
|
|
24400
|
+
);
|
|
24084
24401
|
},
|
|
24085
24402
|
detached() {
|
|
24086
24403
|
if (this.slimSelect) this.slimSelect.destroy();
|
|
@@ -48119,7 +48436,10 @@ const RichtextMixin = {
|
|
|
48119
48436
|
created() {
|
|
48120
48437
|
importInlineCSS("quill", () => import("./quill.snow-B73wIbzm.js"));
|
|
48121
48438
|
this.quill = null;
|
|
48122
|
-
this.listCallbacks.attach(
|
|
48439
|
+
this.listCallbacks.attach(
|
|
48440
|
+
this.addCallback.bind(this),
|
|
48441
|
+
"RichtextMixin:addCallback"
|
|
48442
|
+
);
|
|
48123
48443
|
},
|
|
48124
48444
|
getPlaceHolderValue() {
|
|
48125
48445
|
return this.element.hasAttribute("placeholder") ? this.element.getAttribute("placeholder") : "";
|
|
@@ -48129,20 +48449,19 @@ const RichtextMixin = {
|
|
|
48129
48449
|
var toolbarOptions = [
|
|
48130
48450
|
["bold", "italic"],
|
|
48131
48451
|
["blockquote"],
|
|
48132
|
-
[{
|
|
48133
|
-
[{
|
|
48452
|
+
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
|
48453
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
48134
48454
|
["link"],
|
|
48135
48455
|
["clean"]
|
|
48136
48456
|
];
|
|
48137
|
-
const richtext = this.element.querySelector(
|
|
48138
|
-
|
|
48139
|
-
richtext,
|
|
48140
|
-
{
|
|
48141
|
-
modules: { toolbar: toolbarOptions },
|
|
48142
|
-
placeholder: this.getPlaceHolderValue(),
|
|
48143
|
-
theme: "snow"
|
|
48144
|
-
}
|
|
48457
|
+
const richtext = this.element.querySelector(
|
|
48458
|
+
"[data-richtext]"
|
|
48145
48459
|
);
|
|
48460
|
+
this.quill = new Quill(richtext, {
|
|
48461
|
+
modules: { toolbar: toolbarOptions },
|
|
48462
|
+
placeholder: this.getPlaceHolderValue(),
|
|
48463
|
+
theme: "snow"
|
|
48464
|
+
});
|
|
48146
48465
|
}
|
|
48147
48466
|
const ops = deltaMd.toDelta(this.value);
|
|
48148
48467
|
this.quill.setContents(ops);
|
|
@@ -48154,11 +48473,15 @@ const RichtextMixin = {
|
|
|
48154
48473
|
if (nextProcessor) nextProcessor(value, listCallbacks);
|
|
48155
48474
|
},
|
|
48156
48475
|
isRequired() {
|
|
48157
|
-
return Array.from(this.element.attributes).some(
|
|
48476
|
+
return Array.from(this.element.attributes).some(
|
|
48477
|
+
(attr) => attr.name === "required"
|
|
48478
|
+
);
|
|
48158
48479
|
},
|
|
48159
48480
|
createHiddenRequiredInput() {
|
|
48160
48481
|
const attributeName = this.getAttributeValue("name");
|
|
48161
|
-
this.hiddenInput = document.querySelector(
|
|
48482
|
+
this.hiddenInput = document.querySelector(
|
|
48483
|
+
`input[name="${attributeName + "-hidden"}"]`
|
|
48484
|
+
);
|
|
48162
48485
|
if (!this.hiddenInput) {
|
|
48163
48486
|
this.hiddenInput = this.createHiddenInput(attributeName + "-hidden");
|
|
48164
48487
|
this.element.appendChild(this.hiddenInput);
|
|
@@ -48176,13 +48499,17 @@ const RichtextMixin = {
|
|
|
48176
48499
|
return input;
|
|
48177
48500
|
},
|
|
48178
48501
|
getAttributeValue(attributeName) {
|
|
48179
|
-
const attribute2 = Array.from(this.element.attributes).find(
|
|
48502
|
+
const attribute2 = Array.from(this.element.attributes).find(
|
|
48503
|
+
(attr) => attr.name === attributeName
|
|
48504
|
+
);
|
|
48180
48505
|
return attribute2 ? attribute2.value : "";
|
|
48181
48506
|
},
|
|
48182
48507
|
displayCustomErrorMessage(message) {
|
|
48183
48508
|
const richtext = this.element.querySelector("[data-richtext]");
|
|
48184
48509
|
if (richtext) {
|
|
48185
|
-
let errorMessageElement = richtext.querySelector(
|
|
48510
|
+
let errorMessageElement = richtext.querySelector(
|
|
48511
|
+
".required-error-message"
|
|
48512
|
+
);
|
|
48186
48513
|
if (!errorMessageElement) {
|
|
48187
48514
|
errorMessageElement = document.createElement("div");
|
|
48188
48515
|
errorMessageElement.className = "required-error-message";
|
|
@@ -48204,9 +48531,10 @@ const RichtextMixin = {
|
|
|
48204
48531
|
},
|
|
48205
48532
|
removeErrorMessageAndStyling() {
|
|
48206
48533
|
const richtext = this.element.querySelector("[data-richtext]");
|
|
48207
|
-
let errorMessageElement = richtext.querySelector(
|
|
48208
|
-
|
|
48209
|
-
|
|
48534
|
+
let errorMessageElement = richtext.querySelector(
|
|
48535
|
+
".required-error-message"
|
|
48536
|
+
);
|
|
48537
|
+
if (errorMessageElement) errorMessageElement.remove();
|
|
48210
48538
|
richtext.classList.remove("error-border-richtext");
|
|
48211
48539
|
}
|
|
48212
48540
|
};
|
|
@@ -48316,7 +48644,8 @@ const WidgetMixin = {
|
|
|
48316
48644
|
this.nameWidgets = [];
|
|
48317
48645
|
},
|
|
48318
48646
|
attached() {
|
|
48319
|
-
if (!this.dataSrc && !this.resource && this.noRender === null)
|
|
48647
|
+
if (!this.dataSrc && !this.resource && this.noRender === null)
|
|
48648
|
+
this.populate();
|
|
48320
48649
|
},
|
|
48321
48650
|
get parentElement() {
|
|
48322
48651
|
return "div";
|
|
@@ -48331,7 +48660,9 @@ const WidgetMixin = {
|
|
|
48331
48660
|
this._div = value;
|
|
48332
48661
|
},
|
|
48333
48662
|
get widgets() {
|
|
48334
|
-
return this.nameWidgets.map(
|
|
48663
|
+
return this.nameWidgets.map(
|
|
48664
|
+
(name) => this.element.querySelector(`[name="${name}"]`)
|
|
48665
|
+
);
|
|
48335
48666
|
},
|
|
48336
48667
|
/**
|
|
48337
48668
|
* Return field list of the component
|
|
@@ -48353,7 +48684,8 @@ const WidgetMixin = {
|
|
|
48353
48684
|
break;
|
|
48354
48685
|
}
|
|
48355
48686
|
}
|
|
48356
|
-
if (!this.dataSrc)
|
|
48687
|
+
if (!this.dataSrc)
|
|
48688
|
+
console.error(new Error('You must provide a "fields" attribute'));
|
|
48357
48689
|
if (!resource) return [];
|
|
48358
48690
|
let fields = [];
|
|
48359
48691
|
for (const prop2 of resource.properties) {
|
|
@@ -48394,7 +48726,10 @@ const WidgetMixin = {
|
|
|
48394
48726
|
const setString = this.fields.match(this.getSetRegexp(field));
|
|
48395
48727
|
if (!setString) return [];
|
|
48396
48728
|
const firstSetBracket = this.fields.indexOf(setString[0]) + setString[0].length - 1;
|
|
48397
|
-
const lastSetBracket = findClosingBracketMatchIndex(
|
|
48729
|
+
const lastSetBracket = findClosingBracketMatchIndex(
|
|
48730
|
+
this.fields,
|
|
48731
|
+
firstSetBracket
|
|
48732
|
+
);
|
|
48398
48733
|
const set2 = this.fields.substring(firstSetBracket + 1, lastSetBracket);
|
|
48399
48734
|
return parseFieldsString(set2);
|
|
48400
48735
|
},
|
|
@@ -48432,10 +48767,14 @@ const WidgetMixin = {
|
|
|
48432
48767
|
if (resource && !((_a3 = resource.isContainer) == null ? void 0 : _a3.call(resource))) {
|
|
48433
48768
|
let fieldValue = await resource[field];
|
|
48434
48769
|
if (fieldValue === null || fieldValue === void 0 || fieldValue === "") {
|
|
48435
|
-
let expandedPredicate = sibStore.getExpandedPredicate(
|
|
48770
|
+
let expandedPredicate = sibStore.getExpandedPredicate(
|
|
48771
|
+
field,
|
|
48772
|
+
this.context
|
|
48773
|
+
);
|
|
48436
48774
|
fieldValue = await resource[expandedPredicate];
|
|
48437
48775
|
}
|
|
48438
|
-
if (fieldValue === null || fieldValue === void 0 || fieldValue === "")
|
|
48776
|
+
if (fieldValue === null || fieldValue === void 0 || fieldValue === "")
|
|
48777
|
+
return void 0;
|
|
48439
48778
|
if (Array.isArray(fieldValue) && !fieldValue["ldp:contains"]) {
|
|
48440
48779
|
return JSON.stringify(fieldValue);
|
|
48441
48780
|
} else if (typeof fieldValue === "object" && fieldValue["@id"] && 1 === Object.keys(fieldValue).length) {
|
|
@@ -48474,7 +48813,8 @@ const WidgetMixin = {
|
|
|
48474
48813
|
widgetFromTagName(tagName) {
|
|
48475
48814
|
let type = tagName.startsWith("solid") ? WidgetType.CUSTOM : WidgetType.USER;
|
|
48476
48815
|
if (!customElements.get(tagName)) {
|
|
48477
|
-
if (tagName.startsWith("solid"))
|
|
48816
|
+
if (tagName.startsWith("solid"))
|
|
48817
|
+
newWidgetFactory(tagName);
|
|
48478
48818
|
else type = WidgetType.NATIVE;
|
|
48479
48819
|
}
|
|
48480
48820
|
return { tagName, type };
|
|
@@ -48532,7 +48872,8 @@ const WidgetMixin = {
|
|
|
48532
48872
|
"add-class",
|
|
48533
48873
|
"remove-class"
|
|
48534
48874
|
];
|
|
48535
|
-
for (let attr of multipleAttributes)
|
|
48875
|
+
for (let attr of multipleAttributes)
|
|
48876
|
+
this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs2);
|
|
48536
48877
|
const defaultAttributes = [
|
|
48537
48878
|
"range",
|
|
48538
48879
|
"enum",
|
|
@@ -48540,6 +48881,7 @@ const WidgetMixin = {
|
|
|
48540
48881
|
"placeholder",
|
|
48541
48882
|
"class",
|
|
48542
48883
|
,
|
|
48884
|
+
/* 'widget', */
|
|
48543
48885
|
"required",
|
|
48544
48886
|
"editable",
|
|
48545
48887
|
"autocomplete",
|
|
@@ -48567,13 +48909,22 @@ const WidgetMixin = {
|
|
|
48567
48909
|
"target-src",
|
|
48568
48910
|
"data-label"
|
|
48569
48911
|
];
|
|
48570
|
-
for (let attr of defaultAttributes)
|
|
48912
|
+
for (let attr of defaultAttributes)
|
|
48913
|
+
this.addToAttributes(`${attr}-${escapedField}`, attr, attrs2);
|
|
48571
48914
|
const addableAttributes = Array.from(this.element.attributes).filter((a2) => a2.name.startsWith(`addable-${escapedField}`));
|
|
48572
|
-
for (let attr of addableAttributes)
|
|
48915
|
+
for (let attr of addableAttributes)
|
|
48916
|
+
this.addToAttributes(
|
|
48917
|
+
attr.name,
|
|
48918
|
+
attr.name.replace(`addable-${escapedField}`, "addable"),
|
|
48919
|
+
attrs2
|
|
48920
|
+
);
|
|
48573
48921
|
const resourceId = resource ? resource["@id"] : null;
|
|
48574
|
-
if (this.multiple(escapedField))
|
|
48575
|
-
|
|
48576
|
-
if (this.
|
|
48922
|
+
if (this.multiple(escapedField))
|
|
48923
|
+
attrs2["widget"] = this.getWidget(escapedField).tagName;
|
|
48924
|
+
if (this.getAction(escapedField) && resourceId)
|
|
48925
|
+
attrs2["src"] = this.element.getAttribute("src-" + escapedField) || resourceId;
|
|
48926
|
+
if (this.editable(escapedField) && resourceId)
|
|
48927
|
+
attrs2["value-id"] = resourceId;
|
|
48577
48928
|
return attrs2;
|
|
48578
48929
|
},
|
|
48579
48930
|
/**
|
|
@@ -48612,7 +48963,11 @@ const WidgetMixin = {
|
|
|
48612
48963
|
attributes["value"] = value;
|
|
48613
48964
|
}
|
|
48614
48965
|
if (value && value["@id"]) attributes["auto-subscribe"] = value["@id"];
|
|
48615
|
-
if (transformAttributes)
|
|
48966
|
+
if (transformAttributes)
|
|
48967
|
+
attributes = await this.transformAttributes(
|
|
48968
|
+
attributes,
|
|
48969
|
+
currentResource
|
|
48970
|
+
);
|
|
48616
48971
|
widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
|
|
48617
48972
|
}
|
|
48618
48973
|
this.nameWidgets.push(field);
|
|
@@ -48630,12 +48985,12 @@ const WidgetMixin = {
|
|
|
48630
48985
|
async createSet(field) {
|
|
48631
48986
|
const setWidget = this.getWidget(field, true);
|
|
48632
48987
|
const attrs2 = { name: field };
|
|
48633
|
-
const setAttributes = [
|
|
48634
|
-
|
|
48635
|
-
|
|
48636
|
-
|
|
48637
|
-
|
|
48638
|
-
|
|
48988
|
+
const setAttributes = ["class", "label"];
|
|
48989
|
+
for (let attr of setAttributes)
|
|
48990
|
+
this.addToAttributes(`${attr}-${field}`, attr, attrs2);
|
|
48991
|
+
let widget = this.element.querySelector(
|
|
48992
|
+
`${setWidget.tagName}[name="${field}"]`
|
|
48993
|
+
);
|
|
48639
48994
|
let initializing = false;
|
|
48640
48995
|
if (!widget) {
|
|
48641
48996
|
widget = document.createElement(setWidget.tagName);
|
|
@@ -48663,7 +49018,9 @@ const WidgetMixin = {
|
|
|
48663
49018
|
return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
|
|
48664
49019
|
}
|
|
48665
49020
|
}
|
|
48666
|
-
const widgetsTemplate = await Promise.all(
|
|
49021
|
+
const widgetsTemplate = await Promise.all(
|
|
49022
|
+
setFields.map((field2) => this.createWidgetTemplate(field2))
|
|
49023
|
+
);
|
|
48667
49024
|
const template = x`${widgetsTemplate}`;
|
|
48668
49025
|
B(template, widget.querySelector("[data-content]") || widget);
|
|
48669
49026
|
return widget;
|
|
@@ -48729,8 +49086,14 @@ const ListMixin = {
|
|
|
48729
49086
|
if ((_d = (_c = this.resource).isContainer) == null ? void 0 : _d.call(_c)) {
|
|
48730
49087
|
this.setElementAttribute("container");
|
|
48731
49088
|
this.renderCallbacks = [];
|
|
48732
|
-
listPostProcessorsCopy.attach(
|
|
48733
|
-
|
|
49089
|
+
listPostProcessorsCopy.attach(
|
|
49090
|
+
this.renderDOM.bind(this),
|
|
49091
|
+
"ListMixin:renderDOM"
|
|
49092
|
+
);
|
|
49093
|
+
listPostProcessorsCopy.attach(
|
|
49094
|
+
this.handleEmptyWidget.bind(this),
|
|
49095
|
+
"ListMixin:handleEmptyWidget"
|
|
49096
|
+
);
|
|
48734
49097
|
const nextProcessor = listPostProcessorsCopy.shift();
|
|
48735
49098
|
await nextProcessor(
|
|
48736
49099
|
this.resource["ldp:contains"],
|
|
@@ -48741,8 +49104,14 @@ const ListMixin = {
|
|
|
48741
49104
|
} else if (this.arrayField && this.predicateName && this.resource[this.predicateName]) {
|
|
48742
49105
|
this.setElementAttribute("container");
|
|
48743
49106
|
this.renderCallbacks = [];
|
|
48744
|
-
listPostProcessorsCopy.attach(
|
|
48745
|
-
|
|
49107
|
+
listPostProcessorsCopy.attach(
|
|
49108
|
+
this.renderDOM.bind(this),
|
|
49109
|
+
"ListMixin:renderDOM"
|
|
49110
|
+
);
|
|
49111
|
+
listPostProcessorsCopy.attach(
|
|
49112
|
+
this.handleEmptyWidget.bind(this),
|
|
49113
|
+
"ListMixin:handleEmptyWidget"
|
|
49114
|
+
);
|
|
48746
49115
|
const nextProcessor = listPostProcessorsCopy.shift();
|
|
48747
49116
|
await nextProcessor(
|
|
48748
49117
|
await this.resource[this.predicateName],
|
|
@@ -48769,12 +49138,7 @@ const ListMixin = {
|
|
|
48769
49138
|
}
|
|
48770
49139
|
const nextProcessor = listPostProcessors.shift();
|
|
48771
49140
|
if (nextProcessor)
|
|
48772
|
-
await nextProcessor(
|
|
48773
|
-
resources,
|
|
48774
|
-
listPostProcessors,
|
|
48775
|
-
div2,
|
|
48776
|
-
context2
|
|
48777
|
-
);
|
|
49141
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
48778
49142
|
},
|
|
48779
49143
|
/**
|
|
48780
49144
|
* Show empty widget if no resources in the list
|
|
@@ -48790,16 +49154,14 @@ const ListMixin = {
|
|
|
48790
49154
|
this.emptyWrapper = document.createElement("span");
|
|
48791
49155
|
this.element.appendChild(this.emptyWrapper);
|
|
48792
49156
|
}
|
|
48793
|
-
B(
|
|
49157
|
+
B(
|
|
49158
|
+
resources.length > 0 ? x`` : emptyWidgetTemplate,
|
|
49159
|
+
this.emptyWrapper
|
|
49160
|
+
);
|
|
48794
49161
|
}
|
|
48795
49162
|
const nextProcessor = listPostProcessors.shift();
|
|
48796
49163
|
if (nextProcessor)
|
|
48797
|
-
await nextProcessor(
|
|
48798
|
-
resources,
|
|
48799
|
-
listPostProcessors,
|
|
48800
|
-
div2,
|
|
48801
|
-
context2
|
|
48802
|
-
);
|
|
49164
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
48803
49165
|
}
|
|
48804
49166
|
};
|
|
48805
49167
|
const PaginateMixin = {
|
|
@@ -48822,21 +49184,32 @@ const PaginateMixin = {
|
|
|
48822
49184
|
this.currentPage = [];
|
|
48823
49185
|
},
|
|
48824
49186
|
attached() {
|
|
48825
|
-
this.listPostProcessors.attach(
|
|
49187
|
+
this.listPostProcessors.attach(
|
|
49188
|
+
this.paginateCallback.bind(this),
|
|
49189
|
+
"PaginateMixin:paginateCallback"
|
|
49190
|
+
);
|
|
48826
49191
|
},
|
|
48827
49192
|
async paginateCallback(resources, listPostProcessors, div2, context2) {
|
|
48828
49193
|
if (this.paginateBy > 0) {
|
|
48829
49194
|
if (!this.currentPage[context2]) this.currentPage[context2] = 1;
|
|
48830
49195
|
const parentDiv = this.initParentPaginationDiv(div2, context2);
|
|
48831
49196
|
this.renderCallbacks.push({
|
|
48832
|
-
template: this.renderPaginationNav(
|
|
49197
|
+
template: this.renderPaginationNav(
|
|
49198
|
+
this.getPageCount(resources.length),
|
|
49199
|
+
context2,
|
|
49200
|
+
div2
|
|
49201
|
+
),
|
|
48833
49202
|
parent: parentDiv
|
|
48834
49203
|
});
|
|
48835
49204
|
const firstElementIndex = (this.getCurrentPage(context2) - 1) * this.paginateBy;
|
|
48836
|
-
resources = resources.slice(
|
|
49205
|
+
resources = resources.slice(
|
|
49206
|
+
firstElementIndex,
|
|
49207
|
+
firstElementIndex + this.paginateBy
|
|
49208
|
+
);
|
|
48837
49209
|
}
|
|
48838
49210
|
const nextProcessor = listPostProcessors.shift();
|
|
48839
|
-
if (nextProcessor)
|
|
49211
|
+
if (nextProcessor)
|
|
49212
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
48840
49213
|
},
|
|
48841
49214
|
getNavElement(div2) {
|
|
48842
49215
|
const insertNode = div2.parentNode || div2;
|
|
@@ -49024,18 +49397,20 @@ const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filt
|
|
|
49024
49397
|
return matchValue(resource[filter], query, throwOn);
|
|
49025
49398
|
}
|
|
49026
49399
|
try {
|
|
49027
|
-
await Promise.all(
|
|
49028
|
-
(
|
|
49029
|
-
|
|
49030
|
-
|
|
49031
|
-
|
|
49032
|
-
|
|
49033
|
-
|
|
49034
|
-
|
|
49035
|
-
|
|
49036
|
-
|
|
49400
|
+
await Promise.all(
|
|
49401
|
+
(fields || []).map(
|
|
49402
|
+
(field) => matchFilter(
|
|
49403
|
+
resource,
|
|
49404
|
+
field,
|
|
49405
|
+
query,
|
|
49406
|
+
fieldsAttr,
|
|
49407
|
+
searchForm,
|
|
49408
|
+
filterId,
|
|
49409
|
+
true
|
|
49410
|
+
// stop searching when 1 filter is true (= OR)
|
|
49411
|
+
)
|
|
49037
49412
|
)
|
|
49038
|
-
)
|
|
49413
|
+
);
|
|
49039
49414
|
} catch (e2) {
|
|
49040
49415
|
return true;
|
|
49041
49416
|
}
|
|
@@ -49043,19 +49418,21 @@ const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filt
|
|
|
49043
49418
|
};
|
|
49044
49419
|
const matchFilters = async (resource, filters, filterNames, fields, searchForm, filterId) => {
|
|
49045
49420
|
try {
|
|
49046
|
-
await Promise.all(
|
|
49047
|
-
|
|
49048
|
-
|
|
49049
|
-
|
|
49050
|
-
|
|
49051
|
-
|
|
49052
|
-
|
|
49053
|
-
|
|
49054
|
-
|
|
49055
|
-
|
|
49056
|
-
|
|
49057
|
-
|
|
49058
|
-
|
|
49421
|
+
await Promise.all(
|
|
49422
|
+
filterNames.map(async (filter) => {
|
|
49423
|
+
let match3 = await matchFilter(
|
|
49424
|
+
resource,
|
|
49425
|
+
filter,
|
|
49426
|
+
filters[filter],
|
|
49427
|
+
fields,
|
|
49428
|
+
searchForm,
|
|
49429
|
+
filterId,
|
|
49430
|
+
false
|
|
49431
|
+
// stop searching when 1 filter is false (= AND)
|
|
49432
|
+
);
|
|
49433
|
+
return match3;
|
|
49434
|
+
})
|
|
49435
|
+
);
|
|
49059
49436
|
} catch (e2) {
|
|
49060
49437
|
return false;
|
|
49061
49438
|
}
|
|
@@ -49065,17 +49442,19 @@ const searchInResources = async (resources, filters, fields, searchForm) => {
|
|
|
49065
49442
|
const filterNames = Object.keys(filters);
|
|
49066
49443
|
const filterId = uniqID();
|
|
49067
49444
|
window.cachePropsSearchFilter = {};
|
|
49068
|
-
return Promise.all(
|
|
49069
|
-
|
|
49070
|
-
|
|
49071
|
-
|
|
49072
|
-
|
|
49073
|
-
|
|
49074
|
-
|
|
49075
|
-
|
|
49076
|
-
|
|
49077
|
-
|
|
49078
|
-
|
|
49445
|
+
return Promise.all(
|
|
49446
|
+
resources.map(async (resource) => {
|
|
49447
|
+
let match3 = await matchFilters(
|
|
49448
|
+
resource,
|
|
49449
|
+
filters,
|
|
49450
|
+
filterNames,
|
|
49451
|
+
fields,
|
|
49452
|
+
searchForm,
|
|
49453
|
+
filterId
|
|
49454
|
+
);
|
|
49455
|
+
return match3;
|
|
49456
|
+
})
|
|
49457
|
+
);
|
|
49079
49458
|
};
|
|
49080
49459
|
const FilterMixin = {
|
|
49081
49460
|
name: "filter-mixin",
|
|
@@ -49118,9 +49497,15 @@ const FilterMixin = {
|
|
|
49118
49497
|
if (this.isFilteredOnServer() && filteredBy) {
|
|
49119
49498
|
this.searchForm = document.getElementById(filteredBy);
|
|
49120
49499
|
if (!this.searchForm) throw `#${filteredBy} is not in DOM`;
|
|
49121
|
-
this.searchForm.addEventListener(
|
|
49500
|
+
this.searchForm.addEventListener(
|
|
49501
|
+
"formChange",
|
|
49502
|
+
() => this.onServerSearchChange()
|
|
49503
|
+
);
|
|
49122
49504
|
} else {
|
|
49123
|
-
this.listPostProcessors.attach(
|
|
49505
|
+
this.listPostProcessors.attach(
|
|
49506
|
+
this.filterCallback.bind(this),
|
|
49507
|
+
"FilterMixin:filterCallback"
|
|
49508
|
+
);
|
|
49124
49509
|
}
|
|
49125
49510
|
},
|
|
49126
49511
|
get filters() {
|
|
@@ -49166,7 +49551,13 @@ const FilterMixin = {
|
|
|
49166
49551
|
resources = resources.filter((_v, index2) => filteredResources[index2]);
|
|
49167
49552
|
}
|
|
49168
49553
|
const nextProcessor = listPostProcessors.shift();
|
|
49169
|
-
if (nextProcessor)
|
|
49554
|
+
if (nextProcessor)
|
|
49555
|
+
await nextProcessor(
|
|
49556
|
+
resources,
|
|
49557
|
+
listPostProcessors,
|
|
49558
|
+
div2,
|
|
49559
|
+
context2 + (this.searchCount.get(context2) || "")
|
|
49560
|
+
);
|
|
49170
49561
|
},
|
|
49171
49562
|
async filterList(context2) {
|
|
49172
49563
|
this.searchCount.set(context2, this.searchCount.get(context2) + 1);
|
|
@@ -49181,7 +49572,9 @@ const FilterMixin = {
|
|
|
49181
49572
|
const nextArrayOfObjects = await obj[field];
|
|
49182
49573
|
if (!nextArrayOfObjects) continue;
|
|
49183
49574
|
if (typeof nextArrayOfObjects !== "object") {
|
|
49184
|
-
console.warn(
|
|
49575
|
+
console.warn(
|
|
49576
|
+
`The format value of ${field} is not suitable with auto-range-[field] attribute`
|
|
49577
|
+
);
|
|
49185
49578
|
continue;
|
|
49186
49579
|
}
|
|
49187
49580
|
if (!nextArrayOfObjects.isContainer()) {
|
|
@@ -49234,7 +49627,10 @@ const CounterMixin = {
|
|
|
49234
49627
|
parentCounterDiv: null
|
|
49235
49628
|
},
|
|
49236
49629
|
attached() {
|
|
49237
|
-
this.listPostProcessors.attach(
|
|
49630
|
+
this.listPostProcessors.attach(
|
|
49631
|
+
this.countResources.bind(this),
|
|
49632
|
+
"CounterMixin:countResources"
|
|
49633
|
+
);
|
|
49238
49634
|
},
|
|
49239
49635
|
async countResources(resources, listPostProcessors, div2, context2) {
|
|
49240
49636
|
if (this.counterTemplate) {
|
|
@@ -49246,7 +49642,8 @@ const CounterMixin = {
|
|
|
49246
49642
|
});
|
|
49247
49643
|
}
|
|
49248
49644
|
const nextProcessor = listPostProcessors.shift();
|
|
49249
|
-
if (nextProcessor)
|
|
49645
|
+
if (nextProcessor)
|
|
49646
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49250
49647
|
},
|
|
49251
49648
|
/**
|
|
49252
49649
|
* Create the parent div of the counter in the component.
|
|
@@ -49296,7 +49693,10 @@ const GrouperMixin = {
|
|
|
49296
49693
|
}
|
|
49297
49694
|
},
|
|
49298
49695
|
attached() {
|
|
49299
|
-
this.listPostProcessors.attach(
|
|
49696
|
+
this.listPostProcessors.attach(
|
|
49697
|
+
this.groupResources.bind(this),
|
|
49698
|
+
"GrouperMixin:groupResources"
|
|
49699
|
+
);
|
|
49300
49700
|
},
|
|
49301
49701
|
async groupResources(resources, listPostProcessors, div2, context2) {
|
|
49302
49702
|
const nextProcessor = listPostProcessors.shift();
|
|
@@ -49315,25 +49715,25 @@ const GrouperMixin = {
|
|
|
49315
49715
|
return generalComparator(a2, b2, order2);
|
|
49316
49716
|
});
|
|
49317
49717
|
}
|
|
49318
|
-
const parents = sortedKeys.map((g2) => ({
|
|
49718
|
+
const parents = sortedKeys.map((g2) => ({
|
|
49719
|
+
group: g2,
|
|
49720
|
+
parent: this.renderGroup(g2, div2)
|
|
49721
|
+
}));
|
|
49319
49722
|
for (let { group, parent } of parents) {
|
|
49320
|
-
if (nextProcessor)
|
|
49321
|
-
|
|
49322
|
-
|
|
49323
|
-
|
|
49324
|
-
|
|
49325
|
-
|
|
49326
|
-
|
|
49327
|
-
|
|
49328
|
-
|
|
49723
|
+
if (nextProcessor)
|
|
49724
|
+
await nextProcessor(
|
|
49725
|
+
groups[group].resources,
|
|
49726
|
+
// give only resources from group
|
|
49727
|
+
listPostProcessors.deepCopy(),
|
|
49728
|
+
// copy post processors
|
|
49729
|
+
parent,
|
|
49730
|
+
// parent is group widget
|
|
49731
|
+
context2 + "_" + group
|
|
49732
|
+
);
|
|
49329
49733
|
}
|
|
49330
49734
|
} else {
|
|
49331
|
-
if (nextProcessor)
|
|
49332
|
-
resources,
|
|
49333
|
-
listPostProcessors,
|
|
49334
|
-
div2,
|
|
49335
|
-
context2
|
|
49336
|
-
);
|
|
49735
|
+
if (nextProcessor)
|
|
49736
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49337
49737
|
}
|
|
49338
49738
|
},
|
|
49339
49739
|
/**
|
|
@@ -49341,7 +49741,9 @@ const GrouperMixin = {
|
|
|
49341
49741
|
* @param groupName
|
|
49342
49742
|
*/
|
|
49343
49743
|
renderGroup(groupName, div2) {
|
|
49344
|
-
let groupElt = this.element.querySelector(
|
|
49744
|
+
let groupElt = this.element.querySelector(
|
|
49745
|
+
`${this.groupWidget}[value="${groupName}"]`
|
|
49746
|
+
);
|
|
49345
49747
|
if (!groupElt) {
|
|
49346
49748
|
groupElt = document.createElement(this.groupWidget);
|
|
49347
49749
|
groupElt.setAttribute("value", groupName);
|
|
@@ -49356,24 +49758,30 @@ const HighlighterMixin = {
|
|
|
49356
49758
|
name: "highlighter-mixin",
|
|
49357
49759
|
use: [],
|
|
49358
49760
|
attached() {
|
|
49359
|
-
this.listPostProcessors.attach(
|
|
49761
|
+
this.listPostProcessors.attach(
|
|
49762
|
+
this.hightlightCallback.bind(this),
|
|
49763
|
+
"HighlighterMixin:hightlightCallback"
|
|
49764
|
+
);
|
|
49360
49765
|
},
|
|
49361
49766
|
async hightlightCallback(resources, listPostProcessors, div2, context2) {
|
|
49362
49767
|
for (let attr of this.element.attributes) {
|
|
49363
49768
|
if (attr.name.startsWith("highlight-")) {
|
|
49364
49769
|
const field = attr.name.split("highlight-")[1];
|
|
49365
|
-
resources = await Promise.all(
|
|
49366
|
-
|
|
49367
|
-
|
|
49368
|
-
|
|
49369
|
-
|
|
49370
|
-
|
|
49770
|
+
resources = await Promise.all(
|
|
49771
|
+
resources.map(async (resource) => ({
|
|
49772
|
+
sortingKey: await resource[field],
|
|
49773
|
+
// fetch sorting value
|
|
49774
|
+
proxy: resource
|
|
49775
|
+
// and keep proxy
|
|
49776
|
+
}))
|
|
49777
|
+
);
|
|
49371
49778
|
resources = this.sortHighlighted(resources, "sortingKey", attr.value);
|
|
49372
49779
|
resources = resources.map((resource) => resource.proxy);
|
|
49373
49780
|
}
|
|
49374
49781
|
}
|
|
49375
49782
|
const nextProcessor = listPostProcessors.shift();
|
|
49376
|
-
if (nextProcessor)
|
|
49783
|
+
if (nextProcessor)
|
|
49784
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49377
49785
|
},
|
|
49378
49786
|
sortHighlighted(resources, field, value) {
|
|
49379
49787
|
for (let [index2, res] of resources.entries()) {
|
|
@@ -49409,7 +49817,10 @@ const RequiredMixin = {
|
|
|
49409
49817
|
name: "required-mixin",
|
|
49410
49818
|
use: [],
|
|
49411
49819
|
attached() {
|
|
49412
|
-
this.listPostProcessors.attach(
|
|
49820
|
+
this.listPostProcessors.attach(
|
|
49821
|
+
this.requiredResources.bind(this),
|
|
49822
|
+
"RequiredMixin:requiredResources"
|
|
49823
|
+
);
|
|
49413
49824
|
},
|
|
49414
49825
|
async requiredResources(resources, listPostProcessors, div2, context2) {
|
|
49415
49826
|
const displays = [];
|
|
@@ -49430,7 +49841,13 @@ const RequiredMixin = {
|
|
|
49430
49841
|
}
|
|
49431
49842
|
}
|
|
49432
49843
|
const nextProcessor = listPostProcessors.shift();
|
|
49433
|
-
if (nextProcessor)
|
|
49844
|
+
if (nextProcessor)
|
|
49845
|
+
await nextProcessor(
|
|
49846
|
+
requiredFields.length ? displays : resources,
|
|
49847
|
+
listPostProcessors,
|
|
49848
|
+
div2,
|
|
49849
|
+
context2
|
|
49850
|
+
);
|
|
49434
49851
|
}
|
|
49435
49852
|
};
|
|
49436
49853
|
const SolidDisplay = {
|
|
@@ -49468,7 +49885,8 @@ const SolidDisplay = {
|
|
|
49468
49885
|
},
|
|
49469
49886
|
detached() {
|
|
49470
49887
|
if (this.activeSubscription) PubSub.unsubscribe(this.activeSubscription);
|
|
49471
|
-
if (this.removeActiveSubscription)
|
|
49888
|
+
if (this.removeActiveSubscription)
|
|
49889
|
+
PubSub.unsubscribe(this.removeActiveSubscription);
|
|
49472
49890
|
},
|
|
49473
49891
|
// Update subscription when id changes
|
|
49474
49892
|
updateNavigateSubscription() {
|
|
@@ -49560,12 +49978,7 @@ const SolidDisplay = {
|
|
|
49560
49978
|
B(template, div2);
|
|
49561
49979
|
const nextProcessor = listPostProcessors.shift();
|
|
49562
49980
|
if (nextProcessor)
|
|
49563
|
-
await nextProcessor(
|
|
49564
|
-
resources,
|
|
49565
|
-
listPostProcessors,
|
|
49566
|
-
div2,
|
|
49567
|
-
context2
|
|
49568
|
-
);
|
|
49981
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49569
49982
|
}, "SolidDisplay:renderDom"),
|
|
49570
49983
|
/**
|
|
49571
49984
|
* Get attributes to dispatch to children from current element
|
|
@@ -50268,8 +50681,10 @@ const ValidationMixin = {
|
|
|
50268
50681
|
return dialog.showModal();
|
|
50269
50682
|
},
|
|
50270
50683
|
performAction() {
|
|
50271
|
-
if (this.element.hasAttribute("confirmation-message") && !this.confirmationType)
|
|
50272
|
-
|
|
50684
|
+
if (this.element.hasAttribute("confirmation-message") && !this.confirmationType)
|
|
50685
|
+
console.warn("confirmation-type attribute is missing.");
|
|
50686
|
+
if (!this.confirmationType || this.confirmationType == "confirm" && confirm(this.confirmationMessage || this.t("validation.message")))
|
|
50687
|
+
this.validateModal();
|
|
50273
50688
|
if (this.confirmationType == "dialog") {
|
|
50274
50689
|
this.showModal();
|
|
50275
50690
|
}
|
|
@@ -50365,7 +50780,8 @@ const SolidForm = {
|
|
|
50365
50780
|
}
|
|
50366
50781
|
setDeepProperty(values, name.split("."), value);
|
|
50367
50782
|
});
|
|
50368
|
-
if (this.resource && !((_b = (_a3 = this.resource).isContainer) == null ? void 0 : _b.call(_a3)))
|
|
50783
|
+
if (this.resource && !((_b = (_a3 = this.resource).isContainer) == null ? void 0 : _b.call(_a3)))
|
|
50784
|
+
values["@id"] = this.resourceId;
|
|
50369
50785
|
return values;
|
|
50370
50786
|
},
|
|
50371
50787
|
get isNaked() {
|
|
@@ -50386,7 +50802,8 @@ const SolidForm = {
|
|
|
50386
50802
|
if (!object) {
|
|
50387
50803
|
object = await this.resource[store.getExpandedPredicate(predicate, this.context)];
|
|
50388
50804
|
}
|
|
50389
|
-
if (object && object["@id"] && !value[predicate]["@id"])
|
|
50805
|
+
if (object && object["@id"] && !value[predicate]["@id"])
|
|
50806
|
+
value[predicate]["@id"] = object["@id"];
|
|
50390
50807
|
if (object && !object["@id"] && Array.isArray(object) && value[predicate].length == 0 && object.length > 0) {
|
|
50391
50808
|
value[predicate] = object;
|
|
50392
50809
|
}
|
|
@@ -50469,10 +50886,13 @@ const SolidForm = {
|
|
|
50469
50886
|
let errorNextName = Object.values(member)[0];
|
|
50470
50887
|
let subErrorName = errorFullName === "" ? errorNextName : errorFullName.concat("." + errorNextName);
|
|
50471
50888
|
let errorFieldName = "";
|
|
50472
|
-
if (errorFullName)
|
|
50889
|
+
if (errorFullName)
|
|
50890
|
+
errorFieldName = errorFullName.concat("." + errorNextName);
|
|
50473
50891
|
else errorFieldName = errorNextName;
|
|
50474
50892
|
if (errorFieldName) {
|
|
50475
|
-
let formField = this.element.querySelector(
|
|
50893
|
+
let formField = this.element.querySelector(
|
|
50894
|
+
`[name="${errorFieldName}"]`
|
|
50895
|
+
);
|
|
50476
50896
|
if (formField) {
|
|
50477
50897
|
formField.classList.add("error");
|
|
50478
50898
|
let errorParagraph = document.createElement("p");
|
|
@@ -50483,7 +50903,9 @@ const SolidForm = {
|
|
|
50483
50903
|
errorParagraph.appendChild(errorText);
|
|
50484
50904
|
});
|
|
50485
50905
|
} else if (typeof Object.values(member)[1] === "object") {
|
|
50486
|
-
for (const [key, value] of Object.entries(
|
|
50906
|
+
for (const [key, value] of Object.entries(
|
|
50907
|
+
Object.values(member)[1]
|
|
50908
|
+
)) {
|
|
50487
50909
|
if (Array.isArray(value)) {
|
|
50488
50910
|
value.forEach((error2) => {
|
|
50489
50911
|
let errorText = document.createElement("p");
|
|
@@ -50513,7 +50935,9 @@ const SolidForm = {
|
|
|
50513
50935
|
empty() {
|
|
50514
50936
|
},
|
|
50515
50937
|
showError(e2) {
|
|
50516
|
-
let errors2 = Object.entries(e2).filter(
|
|
50938
|
+
let errors2 = Object.entries(e2).filter(
|
|
50939
|
+
(field) => !field[0].startsWith("@context")
|
|
50940
|
+
);
|
|
50517
50941
|
this.displayErrorMessage(errors2);
|
|
50518
50942
|
const errorTemplate = x`<p>${this.t("solid-form.validation-error")}</p>`;
|
|
50519
50943
|
const parentElement = this.element.querySelector("[data-id=error]");
|
|
@@ -50523,7 +50947,8 @@ const SolidForm = {
|
|
|
50523
50947
|
let formErrors = this.element.querySelectorAll(".error-message");
|
|
50524
50948
|
if (formErrors) formErrors.forEach((error2) => error2.remove());
|
|
50525
50949
|
let errorFields = this.element.querySelectorAll(".error");
|
|
50526
|
-
if (errorFields)
|
|
50950
|
+
if (errorFields)
|
|
50951
|
+
errorFields.forEach((errorField) => errorField.classList.remove("error"));
|
|
50527
50952
|
const parentElement = this.element.querySelector("[data-id=error]");
|
|
50528
50953
|
if (parentElement) B("", parentElement);
|
|
50529
50954
|
},
|
|
@@ -50549,13 +50974,14 @@ const SolidForm = {
|
|
|
50549
50974
|
</div>
|
|
50550
50975
|
`;
|
|
50551
50976
|
},
|
|
50552
|
-
populate: trackRenderAsync(
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
|
|
50556
|
-
|
|
50557
|
-
|
|
50558
|
-
|
|
50977
|
+
populate: trackRenderAsync(async function() {
|
|
50978
|
+
this.element.oninput = () => this.onInput();
|
|
50979
|
+
this.element.onchange = () => this.onChange();
|
|
50980
|
+
const fields = await this.getFields();
|
|
50981
|
+
const widgetTemplates = await Promise.all(
|
|
50982
|
+
fields.map((field) => this.createWidgetTemplate(field))
|
|
50983
|
+
);
|
|
50984
|
+
const template = x`
|
|
50559
50985
|
<div data-id="error"></div>
|
|
50560
50986
|
${!this.isNaked ? x`
|
|
50561
50987
|
<form
|
|
@@ -50569,10 +50995,8 @@ const SolidForm = {
|
|
|
50569
50995
|
` : x`${widgetTemplates}`}
|
|
50570
50996
|
${this.getModalDialog()}
|
|
50571
50997
|
`;
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
"SolidForm:populate"
|
|
50575
|
-
)
|
|
50998
|
+
B(template, this.element);
|
|
50999
|
+
}, "SolidForm:populate")
|
|
50576
51000
|
};
|
|
50577
51001
|
Sib.register(SolidForm);
|
|
50578
51002
|
const SolidFormSearch = {
|
|
@@ -50687,7 +51111,9 @@ const SolidFormSearch = {
|
|
|
50687
51111
|
}
|
|
50688
51112
|
const idField = `${this.rangeId}_${fieldName}`;
|
|
50689
51113
|
const id2 = `store://local.${idField}`;
|
|
50690
|
-
const ldpContains = Array.from(autoRangeValues).map((id22) => ({
|
|
51114
|
+
const ldpContains = Array.from(autoRangeValues).map((id22) => ({
|
|
51115
|
+
"@id": id22
|
|
51116
|
+
}));
|
|
50691
51117
|
const data = {
|
|
50692
51118
|
"@type": "ldp:Container",
|
|
50693
51119
|
"@context": this.context,
|
|
@@ -50721,23 +51147,17 @@ const SolidFormSearch = {
|
|
|
50721
51147
|
let parentElementLabel = (_a3 = input == null ? void 0 : input.parentElement) == null ? void 0 : _a3.getAttribute("label");
|
|
50722
51148
|
try {
|
|
50723
51149
|
const selectedLabel = (_b = input.selectedOptions[0].textContent) == null ? void 0 : _b.trim();
|
|
50724
|
-
this.change(
|
|
50725
|
-
|
|
50726
|
-
|
|
50727
|
-
|
|
50728
|
-
|
|
50729
|
-
type: "select"
|
|
50730
|
-
}
|
|
50731
|
-
);
|
|
51150
|
+
this.change(this.value, {
|
|
51151
|
+
value: selectedLabel,
|
|
51152
|
+
inputLabel: parentElementLabel,
|
|
51153
|
+
type: "select"
|
|
51154
|
+
});
|
|
50732
51155
|
} catch {
|
|
50733
|
-
this.change(
|
|
50734
|
-
|
|
50735
|
-
|
|
50736
|
-
|
|
50737
|
-
|
|
50738
|
-
type: "input"
|
|
50739
|
-
}
|
|
50740
|
-
);
|
|
51156
|
+
this.change(this.value, {
|
|
51157
|
+
value: input.value,
|
|
51158
|
+
inputLabel: parentElementLabel,
|
|
51159
|
+
type: "input"
|
|
51160
|
+
});
|
|
50741
51161
|
}
|
|
50742
51162
|
},
|
|
50743
51163
|
getSubmitTemplate() {
|
|
@@ -50756,29 +51176,31 @@ const SolidFormSearch = {
|
|
|
50756
51176
|
this.inputChange(input);
|
|
50757
51177
|
}, this.debounce);
|
|
50758
51178
|
},
|
|
50759
|
-
populate: trackRenderAsync(
|
|
50760
|
-
|
|
50761
|
-
|
|
50762
|
-
|
|
50763
|
-
|
|
50764
|
-
|
|
50765
|
-
|
|
50766
|
-
|
|
50767
|
-
|
|
50768
|
-
|
|
50769
|
-
|
|
50770
|
-
|
|
50771
|
-
|
|
50772
|
-
|
|
51179
|
+
populate: trackRenderAsync(async function() {
|
|
51180
|
+
await this.replaceAttributesData();
|
|
51181
|
+
if (this.submitButton == null) {
|
|
51182
|
+
this.element.addEventListener(
|
|
51183
|
+
"input",
|
|
51184
|
+
(e2) => this.debounceInput(e2.target)
|
|
51185
|
+
);
|
|
51186
|
+
} else {
|
|
51187
|
+
this.element.addEventListener("submit", (e2) => {
|
|
51188
|
+
e2.preventDefault();
|
|
51189
|
+
this.inputChange(e2.target);
|
|
51190
|
+
});
|
|
51191
|
+
}
|
|
51192
|
+
const fields = await this.getFields();
|
|
51193
|
+
const widgetTemplates = await Promise.all(
|
|
51194
|
+
fields.map((field) => this.createWidgetTemplate(field))
|
|
51195
|
+
);
|
|
51196
|
+
const template = x`
|
|
50773
51197
|
<form>
|
|
50774
51198
|
${widgetTemplates}
|
|
50775
51199
|
${this.submitButton == null ? "" : this.getSubmitTemplate()}
|
|
50776
51200
|
</form>
|
|
50777
51201
|
`;
|
|
50778
|
-
|
|
50779
|
-
|
|
50780
|
-
"SolidFormSearch:populate"
|
|
50781
|
-
)
|
|
51202
|
+
B(template, this.element);
|
|
51203
|
+
}, "SolidFormSearch:populate")
|
|
50782
51204
|
};
|
|
50783
51205
|
Sib.register(SolidFormSearch);
|
|
50784
51206
|
const SolidWidget = {
|
|
@@ -50796,12 +51218,7 @@ const SolidWidget = {
|
|
|
50796
51218
|
const template = this.template;
|
|
50797
51219
|
const newWidget = {
|
|
50798
51220
|
name: this.name,
|
|
50799
|
-
use: [
|
|
50800
|
-
BaseWidgetMixin,
|
|
50801
|
-
StoreMixin,
|
|
50802
|
-
FormMixin,
|
|
50803
|
-
ActionMixin
|
|
50804
|
-
],
|
|
51221
|
+
use: [BaseWidgetMixin, StoreMixin, FormMixin, ActionMixin],
|
|
50805
51222
|
attributes: {
|
|
50806
51223
|
label: {
|
|
50807
51224
|
type: String,
|
|
@@ -50812,7 +51229,9 @@ const SolidWidget = {
|
|
|
50812
51229
|
}
|
|
50813
51230
|
},
|
|
50814
51231
|
get template() {
|
|
50815
|
-
return () => this.evalTemplate(template).then(
|
|
51232
|
+
return () => this.evalTemplate(template).then(
|
|
51233
|
+
(tpl) => x`${o$1(tpl)}`
|
|
51234
|
+
);
|
|
50816
51235
|
},
|
|
50817
51236
|
evalTemplate(template2) {
|
|
50818
51237
|
const tpl = evalTemplateString(template2, {
|
|
@@ -50829,7 +51248,8 @@ const SolidWidget = {
|
|
|
50829
51248
|
},
|
|
50830
51249
|
// For form widgets, handle nested solid-form
|
|
50831
51250
|
getValueFromElement(element) {
|
|
50832
|
-
if (element.tagName === "SOLID-FORM")
|
|
51251
|
+
if (element.tagName === "SOLID-FORM")
|
|
51252
|
+
return element.component.value;
|
|
50833
51253
|
else if (element.component) return element.component.getValue();
|
|
50834
51254
|
return element.value;
|
|
50835
51255
|
},
|
|
@@ -50861,28 +51281,27 @@ const SolidAcChecker = {
|
|
|
50861
51281
|
default: ""
|
|
50862
51282
|
}
|
|
50863
51283
|
},
|
|
50864
|
-
populate: trackRenderAsync(
|
|
50865
|
-
|
|
50866
|
-
|
|
50867
|
-
|
|
50868
|
-
|
|
50869
|
-
|
|
50870
|
-
|
|
50871
|
-
|
|
50872
|
-
|
|
50873
|
-
|
|
50874
|
-
|
|
50875
|
-
|
|
50876
|
-
|
|
50877
|
-
|
|
50878
|
-
|
|
50879
|
-
|
|
50880
|
-
|
|
50881
|
-
|
|
50882
|
-
|
|
50883
|
-
|
|
50884
|
-
|
|
50885
|
-
),
|
|
51284
|
+
populate: trackRenderAsync(async function() {
|
|
51285
|
+
if (!this.resource) return;
|
|
51286
|
+
let displayElement;
|
|
51287
|
+
const ContextParser3 = JSONLDContextParser.ContextParser;
|
|
51288
|
+
const permissions = await this.resource.permissions;
|
|
51289
|
+
if (this.permission) {
|
|
51290
|
+
displayElement = permissions.some((p2) => {
|
|
51291
|
+
return ContextParser3.expandTerm(p2, this.context, true) === this.permission;
|
|
51292
|
+
});
|
|
51293
|
+
} else if (this.noPermission) {
|
|
51294
|
+
displayElement = permissions.every((p2) => {
|
|
51295
|
+
return ContextParser3.expandTerm(p2, this.context, true) !== this.noPermission;
|
|
51296
|
+
});
|
|
51297
|
+
} else {
|
|
51298
|
+
console.warn(
|
|
51299
|
+
'solid-ac-checker: you should define at least one of "permission" or "no-permission" attribute.'
|
|
51300
|
+
);
|
|
51301
|
+
return;
|
|
51302
|
+
}
|
|
51303
|
+
if (displayElement) this.element.removeAttribute("hidden");
|
|
51304
|
+
}, "SolidAcChecker:populate"),
|
|
50886
51305
|
empty() {
|
|
50887
51306
|
this.element.setAttribute("hidden", "");
|
|
50888
51307
|
}
|
|
@@ -50931,7 +51350,10 @@ const SolidDelete = {
|
|
|
50931
51350
|
return store.delete(this.dataSrc, this.context).then((response) => {
|
|
50932
51351
|
if (!response.ok) return;
|
|
50933
51352
|
this.goToNext(null);
|
|
50934
|
-
const eventData = {
|
|
51353
|
+
const eventData = {
|
|
51354
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51355
|
+
bubbles: true
|
|
51356
|
+
};
|
|
50935
51357
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
50936
51358
|
this.element.dispatchEvent(new CustomEvent("resourceDeleted", eventData));
|
|
50937
51359
|
});
|
|
@@ -50942,14 +51364,11 @@ const SolidDelete = {
|
|
|
50942
51364
|
update() {
|
|
50943
51365
|
this.render();
|
|
50944
51366
|
},
|
|
50945
|
-
render: trackRenderAsync(
|
|
50946
|
-
|
|
50947
|
-
|
|
50948
|
-
|
|
50949
|
-
|
|
50950
|
-
},
|
|
50951
|
-
"SolidDelete:render"
|
|
50952
|
-
)
|
|
51367
|
+
render: trackRenderAsync(async function() {
|
|
51368
|
+
await this.replaceAttributesData(false);
|
|
51369
|
+
const button = x`<button @click=${this.delete.bind(this)}>${this.dataLabel || this.t("solid-delete.button")}</button>${this.getModalDialog()}`;
|
|
51370
|
+
B(button, this.element);
|
|
51371
|
+
}, "SolidDelete:render")
|
|
50953
51372
|
};
|
|
50954
51373
|
Sib.register(SolidDelete);
|
|
50955
51374
|
const SolidLang = {
|
|
@@ -51159,7 +51578,9 @@ const SolidTable = {
|
|
|
51159
51578
|
},
|
|
51160
51579
|
get selectedLines() {
|
|
51161
51580
|
if (this.selectable === null) return [];
|
|
51162
|
-
return Array.from(
|
|
51581
|
+
return Array.from(
|
|
51582
|
+
this.element.querySelectorAll("input[data-selection]:checked")
|
|
51583
|
+
).map((e2) => {
|
|
51163
51584
|
var _a3;
|
|
51164
51585
|
return (_a3 = e2 == null ? void 0 : e2.closest("[data-resource]")) == null ? void 0 : _a3.getAttribute("data-resource");
|
|
51165
51586
|
});
|
|
@@ -51170,7 +51591,11 @@ const SolidTable = {
|
|
|
51170
51591
|
*/
|
|
51171
51592
|
selectAll(e2) {
|
|
51172
51593
|
if (this.selectable === null) return;
|
|
51173
|
-
for (const checkbox of Array.from(
|
|
51594
|
+
for (const checkbox of Array.from(
|
|
51595
|
+
this.element.querySelectorAll(
|
|
51596
|
+
"input[data-selection]"
|
|
51597
|
+
)
|
|
51598
|
+
)) {
|
|
51174
51599
|
checkbox.checked = e2.target.checked;
|
|
51175
51600
|
}
|
|
51176
51601
|
},
|
|
@@ -51179,7 +51604,11 @@ const SolidTable = {
|
|
|
51179
51604
|
*/
|
|
51180
51605
|
unselectAll() {
|
|
51181
51606
|
if (this.selectable === null) return;
|
|
51182
|
-
for (const checkbox of Array.from(
|
|
51607
|
+
for (const checkbox of Array.from(
|
|
51608
|
+
this.element.querySelectorAll(
|
|
51609
|
+
"input[data-selection]"
|
|
51610
|
+
)
|
|
51611
|
+
)) {
|
|
51183
51612
|
checkbox.checked = false;
|
|
51184
51613
|
}
|
|
51185
51614
|
},
|
|
@@ -51190,7 +51619,9 @@ const SolidTable = {
|
|
|
51190
51619
|
selectLines(lines) {
|
|
51191
51620
|
if (this.selectable === null || lines.length === 0) return;
|
|
51192
51621
|
for (const line of lines) {
|
|
51193
|
-
const checkbox = this.element.querySelector(
|
|
51622
|
+
const checkbox = this.element.querySelector(
|
|
51623
|
+
`[data-resource="${line}"] input[data-selection]`
|
|
51624
|
+
);
|
|
51194
51625
|
if (checkbox) checkbox.checked = true;
|
|
51195
51626
|
}
|
|
51196
51627
|
},
|
|
@@ -51200,7 +51631,8 @@ const SolidTable = {
|
|
|
51200
51631
|
* @param resource
|
|
51201
51632
|
*/
|
|
51202
51633
|
async createCellWidget(field, resource) {
|
|
51203
|
-
if (!this.element.hasAttribute("editable-" + field))
|
|
51634
|
+
if (!this.element.hasAttribute("editable-" + field))
|
|
51635
|
+
return this.createWidgetTemplate(field, resource, true);
|
|
51204
51636
|
const attributes = {};
|
|
51205
51637
|
const formWidgetAttributes = [
|
|
51206
51638
|
// attributes to give to the form widget
|
|
@@ -51217,14 +51649,16 @@ const SolidTable = {
|
|
|
51217
51649
|
"title",
|
|
51218
51650
|
"widget"
|
|
51219
51651
|
];
|
|
51220
|
-
for (let attr of formWidgetAttributes)
|
|
51652
|
+
for (let attr of formWidgetAttributes)
|
|
51653
|
+
this.addToAttributes(`${attr}-${field}`, `${attr}-${field}`, attributes);
|
|
51221
51654
|
const formAttributes = [
|
|
51222
51655
|
// attributes to give to the form
|
|
51223
51656
|
"class",
|
|
51224
51657
|
"submit-button",
|
|
51225
51658
|
"next"
|
|
51226
51659
|
];
|
|
51227
|
-
for (let attr of formAttributes)
|
|
51660
|
+
for (let attr of formAttributes)
|
|
51661
|
+
this.addToAttributes(`${attr}-${field}`, attr, attributes);
|
|
51228
51662
|
return x`
|
|
51229
51663
|
<solid-form
|
|
51230
51664
|
data-src="${resource["@id"]}"
|
|
@@ -51293,203 +51727,10 @@ const SolidTable = {
|
|
|
51293
51727
|
this.selectLines(selectedLines);
|
|
51294
51728
|
const nextProcessor = listPostProcessors.shift();
|
|
51295
51729
|
if (nextProcessor)
|
|
51296
|
-
await nextProcessor(
|
|
51297
|
-
resources,
|
|
51298
|
-
listPostProcessors,
|
|
51299
|
-
div2,
|
|
51300
|
-
context2
|
|
51301
|
-
);
|
|
51730
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
51302
51731
|
}, "SolidTable:renderDom")
|
|
51303
51732
|
};
|
|
51304
51733
|
Sib.register(SolidTable);
|
|
51305
|
-
const SolidMap = {
|
|
51306
|
-
name: "solid-map",
|
|
51307
|
-
use: [
|
|
51308
|
-
WidgetMixin,
|
|
51309
|
-
ListMixin,
|
|
51310
|
-
StoreMixin,
|
|
51311
|
-
GrouperMixin,
|
|
51312
|
-
CounterMixin,
|
|
51313
|
-
FilterMixin,
|
|
51314
|
-
FederationMixin,
|
|
51315
|
-
NextMixin
|
|
51316
|
-
],
|
|
51317
|
-
attributes: {
|
|
51318
|
-
clustering: {
|
|
51319
|
-
type: Boolean,
|
|
51320
|
-
default: null
|
|
51321
|
-
}
|
|
51322
|
-
},
|
|
51323
|
-
initialState: {
|
|
51324
|
-
markers: {
|
|
51325
|
-
default: null
|
|
51326
|
-
},
|
|
51327
|
-
subscriptions: null,
|
|
51328
|
-
resetPlanned: false,
|
|
51329
|
-
hasBeenResetOnce: false
|
|
51330
|
-
},
|
|
51331
|
-
created() {
|
|
51332
|
-
importInlineCSS("leaflet", () => import("./leaflet-B-Oc5et1.js"));
|
|
51333
|
-
importInlineCSS("default-theme", () => import("./default-theme-CYuJ78jz.js"));
|
|
51334
|
-
importInlineCSS("marker-cluster", () => import("./MarkerCluster-pBxvH3Oj.js"));
|
|
51335
|
-
importInlineCSS("marker-cluster-default", () => import("./MarkerCluster.Default-DBivQAto.js"));
|
|
51336
|
-
document.body.addEventListener(
|
|
51337
|
-
"navigate",
|
|
51338
|
-
() => setTimeout(() => this.isVisible && !this.hasBeenResetOnce && this.reset())
|
|
51339
|
-
);
|
|
51340
|
-
this.markers = [];
|
|
51341
|
-
this.subscriptions = /* @__PURE__ */ new Map();
|
|
51342
|
-
},
|
|
51343
|
-
get isVisible() {
|
|
51344
|
-
return this.element.offsetParent !== null;
|
|
51345
|
-
},
|
|
51346
|
-
attached() {
|
|
51347
|
-
const id2 = uniqID();
|
|
51348
|
-
const template = x`
|
|
51349
|
-
<div id=${id2} style="width:100%;height:100%;"></div>
|
|
51350
|
-
`;
|
|
51351
|
-
B(template, this.element);
|
|
51352
|
-
const div2 = this.element.querySelector(`#${id2}`);
|
|
51353
|
-
this.map = L$1.map(div2);
|
|
51354
|
-
L$1.tileLayer(
|
|
51355
|
-
"https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"
|
|
51356
|
-
).addTo(this.map);
|
|
51357
|
-
if (this.clustering !== null) {
|
|
51358
|
-
this.markersCluster = L$1.markerClusterGroup();
|
|
51359
|
-
this.map.addLayer(this.markersCluster);
|
|
51360
|
-
}
|
|
51361
|
-
},
|
|
51362
|
-
reset() {
|
|
51363
|
-
if (this.isVisible) {
|
|
51364
|
-
this.map.invalidateSize();
|
|
51365
|
-
if (this.markers.length) {
|
|
51366
|
-
this.map.fitBounds(L$1.featureGroup(this.markers).getBounds());
|
|
51367
|
-
} else {
|
|
51368
|
-
this.map.fitWorld();
|
|
51369
|
-
}
|
|
51370
|
-
this.hasBeenResetOnce = true;
|
|
51371
|
-
}
|
|
51372
|
-
},
|
|
51373
|
-
/**
|
|
51374
|
-
* Execute a reset only if none is planned already
|
|
51375
|
-
*/
|
|
51376
|
-
planReset() {
|
|
51377
|
-
if (!this.resetPlanned) {
|
|
51378
|
-
this.resetPlanned = true;
|
|
51379
|
-
setTimeout(() => {
|
|
51380
|
-
this.reset();
|
|
51381
|
-
this.resetPlanned = false;
|
|
51382
|
-
});
|
|
51383
|
-
}
|
|
51384
|
-
},
|
|
51385
|
-
dispatchSelect(event) {
|
|
51386
|
-
const target2 = event.target;
|
|
51387
|
-
const resource = target2["options"].resource;
|
|
51388
|
-
this.element.dispatchEvent(
|
|
51389
|
-
new CustomEvent("resourceSelect", { detail: { resource } })
|
|
51390
|
-
);
|
|
51391
|
-
this.goToNext(resource);
|
|
51392
|
-
},
|
|
51393
|
-
/**
|
|
51394
|
-
* Override listMixin method: initialize a marker on the map
|
|
51395
|
-
* @param resourceId: id of the resource to display
|
|
51396
|
-
* @param groupClass: class of the group of markers
|
|
51397
|
-
*/
|
|
51398
|
-
async appendChildElt(resourceId, groupClass) {
|
|
51399
|
-
const resource = await store.getData(resourceId, this.context);
|
|
51400
|
-
if (!this.subscriptions.get(resourceId)) {
|
|
51401
|
-
this.subscriptions.set(resourceId, PubSub.subscribe(resourceId, () => this.updateDOM()));
|
|
51402
|
-
}
|
|
51403
|
-
if (!resource) return;
|
|
51404
|
-
const lat2 = await resource["lat"];
|
|
51405
|
-
const lng = await resource["lng"];
|
|
51406
|
-
if (lat2 && lng) {
|
|
51407
|
-
const icon = L$1.divIcon({
|
|
51408
|
-
// create the icon, doc here: https://leafletjs.com/reference-1.6.0.html#icon
|
|
51409
|
-
className: "sib-custom-marker " + groupClass,
|
|
51410
|
-
// default class used for styling
|
|
51411
|
-
iconSize: [8, 8],
|
|
51412
|
-
iconAnchor: [12, 34],
|
|
51413
|
-
popupAnchor: [0, -34]
|
|
51414
|
-
});
|
|
51415
|
-
const marker2 = L$1.marker(
|
|
51416
|
-
[lat2.toString(), lng.toString()],
|
|
51417
|
-
{ resource, icon }
|
|
51418
|
-
);
|
|
51419
|
-
if (this.clustering === null) marker2.addTo(this.map);
|
|
51420
|
-
else this.markersCluster.addLayer(marker2);
|
|
51421
|
-
marker2.on("click", this.dispatchSelect.bind(this));
|
|
51422
|
-
if (this.fields !== null) {
|
|
51423
|
-
marker2.bindPopup(() => this.getPopupContent(resourceId), { minWidth: 150 });
|
|
51424
|
-
}
|
|
51425
|
-
this.markers.push(marker2);
|
|
51426
|
-
}
|
|
51427
|
-
},
|
|
51428
|
-
/**
|
|
51429
|
-
* Generate the solid-display of the popup
|
|
51430
|
-
* @param resourceId: id of the popup clicked
|
|
51431
|
-
*/
|
|
51432
|
-
getPopupContent(resourceId) {
|
|
51433
|
-
const attributes = {};
|
|
51434
|
-
for (let attr of this.element.attributes) {
|
|
51435
|
-
if (attr.name.startsWith("value-") || attr.name.startsWith("label-") || attr.name.startsWith("widget-") || attr.name.startsWith("class-") || attr.name.startsWith("multiple-") || attr.name.startsWith("editable-") || attr.name.startsWith("action-") || attr.name.startsWith("default-") || attr.name == "extra-context")
|
|
51436
|
-
attributes[attr.name] = attr.value;
|
|
51437
|
-
if (attr.name.startsWith("child-"))
|
|
51438
|
-
attributes[attr.name.replace(/^child-/, "")] = attr.value;
|
|
51439
|
-
}
|
|
51440
|
-
const div2 = document.createElement("div");
|
|
51441
|
-
const template = x`
|
|
51442
|
-
<solid-display
|
|
51443
|
-
fields="${o$2(this.fields)}"
|
|
51444
|
-
data-src="${resourceId}"
|
|
51445
|
-
...=${spread(attributes)}
|
|
51446
|
-
></solid-display>
|
|
51447
|
-
`;
|
|
51448
|
-
B(template, div2);
|
|
51449
|
-
return div2.querySelector("solid-display");
|
|
51450
|
-
},
|
|
51451
|
-
/**
|
|
51452
|
-
* Override widgetMixin method: empty the map
|
|
51453
|
-
*/
|
|
51454
|
-
empty() {
|
|
51455
|
-
if (!this.map) return;
|
|
51456
|
-
if (this.markersCluster) this.map.removeLayer(this.markersCluster);
|
|
51457
|
-
for (let marker2 of this.markers) this.map.removeLayer(marker2);
|
|
51458
|
-
if (this.clustering !== null) {
|
|
51459
|
-
this.markersCluster = L$1.markerClusterGroup();
|
|
51460
|
-
this.map.addLayer(this.markersCluster);
|
|
51461
|
-
}
|
|
51462
|
-
this.markers = [];
|
|
51463
|
-
},
|
|
51464
|
-
/**
|
|
51465
|
-
* Override groupMixin method
|
|
51466
|
-
* @param groupName: value of the group
|
|
51467
|
-
*/
|
|
51468
|
-
renderGroup(groupName) {
|
|
51469
|
-
const sanitizedGroupName = encodeURIComponent(groupName.toLowerCase()).replace(/%[0-9A-F]{2}/gi, "");
|
|
51470
|
-
const div2 = document.createElement("div");
|
|
51471
|
-
div2.dataset.groupClass = "group-" + sanitizedGroupName;
|
|
51472
|
-
return div2;
|
|
51473
|
-
},
|
|
51474
|
-
/**
|
|
51475
|
-
* Override listMixin method: display all the resources
|
|
51476
|
-
* @param resources
|
|
51477
|
-
* @param listPostProcessors
|
|
51478
|
-
* @param div
|
|
51479
|
-
* @param context
|
|
51480
|
-
*/
|
|
51481
|
-
renderDOM: trackRenderAsync(
|
|
51482
|
-
async function(resources, listPostProcessors, div2, context2) {
|
|
51483
|
-
const groupClass = div2.dataset.groupClass || "";
|
|
51484
|
-
await Promise.all(resources.map((resource) => this.appendChildElt(resource["@id"], groupClass)));
|
|
51485
|
-
this.planReset();
|
|
51486
|
-
const nextProcessor = listPostProcessors.shift();
|
|
51487
|
-
if (nextProcessor) await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
51488
|
-
},
|
|
51489
|
-
"SolidMap:renderDOM"
|
|
51490
|
-
)
|
|
51491
|
-
};
|
|
51492
|
-
Sib.register(SolidMap);
|
|
51493
51734
|
const SolidMembership = {
|
|
51494
51735
|
name: "solid-membership",
|
|
51495
51736
|
use: [NextMixin, ValidationMixin, ContextMixin],
|
|
@@ -51534,10 +51775,8 @@ const SolidMembership = {
|
|
|
51534
51775
|
if (!store.session) return;
|
|
51535
51776
|
let currentUserSession = await store.session;
|
|
51536
51777
|
if (!currentUserSession) return;
|
|
51537
|
-
if (!this.dataTargetSrc)
|
|
51538
|
-
|
|
51539
|
-
else
|
|
51540
|
-
this.userId = this.dataTargetSrc;
|
|
51778
|
+
if (!this.dataTargetSrc) this.userId = await currentUserSession.webId;
|
|
51779
|
+
else this.userId = this.dataTargetSrc;
|
|
51541
51780
|
if (!this.userId) return;
|
|
51542
51781
|
this.resource = await store.getData(this.resourceId);
|
|
51543
51782
|
if (!this.resource) return;
|
|
@@ -51569,15 +51808,20 @@ const SolidMembership = {
|
|
|
51569
51808
|
this.currentMembers.push({ "@id": this.userId });
|
|
51570
51809
|
let currentRes = {
|
|
51571
51810
|
"@context": this.context,
|
|
51572
|
-
|
|
51811
|
+
user_set: this.currentMembers
|
|
51573
51812
|
};
|
|
51574
51813
|
return store.patch(currentRes, this.dataSrc).then((response) => {
|
|
51575
51814
|
if (!response) {
|
|
51576
|
-
console.warn(
|
|
51815
|
+
console.warn(
|
|
51816
|
+
`Error while joining group ${this.dataSrc} for user ${this.userId}`
|
|
51817
|
+
);
|
|
51577
51818
|
return;
|
|
51578
51819
|
}
|
|
51579
51820
|
this.goToNext(null);
|
|
51580
|
-
const eventData = {
|
|
51821
|
+
const eventData = {
|
|
51822
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51823
|
+
bubbles: true
|
|
51824
|
+
};
|
|
51581
51825
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51582
51826
|
this.element.dispatchEvent(new CustomEvent("memberAdded", eventData));
|
|
51583
51827
|
this.planRender();
|
|
@@ -51586,21 +51830,25 @@ const SolidMembership = {
|
|
|
51586
51830
|
async leaveGroup() {
|
|
51587
51831
|
let userSet = this.currentMembers.filter((value) => {
|
|
51588
51832
|
const userId = value["@id"];
|
|
51589
|
-
if (userId == this.userId)
|
|
51590
|
-
return false;
|
|
51833
|
+
if (userId == this.userId) return false;
|
|
51591
51834
|
else return true;
|
|
51592
51835
|
});
|
|
51593
51836
|
let currentRes = {
|
|
51594
51837
|
"@context": this.context,
|
|
51595
|
-
|
|
51838
|
+
user_set: userSet
|
|
51596
51839
|
};
|
|
51597
51840
|
return store.patch(currentRes, this.dataSrc).then((response) => {
|
|
51598
51841
|
if (!response) {
|
|
51599
|
-
console.warn(
|
|
51842
|
+
console.warn(
|
|
51843
|
+
`Error while leaving group ${this.dataSrc} for user ${this.userId}`
|
|
51844
|
+
);
|
|
51600
51845
|
return;
|
|
51601
51846
|
}
|
|
51602
51847
|
this.goToNext(null);
|
|
51603
|
-
const eventData = {
|
|
51848
|
+
const eventData = {
|
|
51849
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51850
|
+
bubbles: true
|
|
51851
|
+
};
|
|
51604
51852
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51605
51853
|
this.element.dispatchEvent(new CustomEvent("memberRemoved", eventData));
|
|
51606
51854
|
this.planRender();
|
|
@@ -51619,12 +51867,11 @@ const SolidMembership = {
|
|
|
51619
51867
|
update() {
|
|
51620
51868
|
this.render();
|
|
51621
51869
|
},
|
|
51622
|
-
render: trackRenderAsync(
|
|
51623
|
-
|
|
51624
|
-
|
|
51625
|
-
|
|
51626
|
-
|
|
51627
|
-
button = x`
|
|
51870
|
+
render: trackRenderAsync(async function() {
|
|
51871
|
+
await this.populate();
|
|
51872
|
+
let button = x``;
|
|
51873
|
+
if (this.isMember) {
|
|
51874
|
+
button = x`
|
|
51628
51875
|
<solid-ac-checker data-src="${this.dataSrc}"
|
|
51629
51876
|
permission="acl:Read"
|
|
51630
51877
|
class=${o$2(`${this.classSubmitButton ? "leave " + this.classSubmitButton : "leave"}`)}
|
|
@@ -51633,8 +51880,8 @@ const SolidMembership = {
|
|
|
51633
51880
|
${this.getModalDialog()}
|
|
51634
51881
|
</solid-ac-checker>
|
|
51635
51882
|
`;
|
|
51636
|
-
|
|
51637
|
-
|
|
51883
|
+
} else {
|
|
51884
|
+
button = x`
|
|
51638
51885
|
<solid-ac-checker data-src="${this.dataSrc}"
|
|
51639
51886
|
permission="acl:Read"
|
|
51640
51887
|
class=${o$2(`${this.classSubmitButton ? "join " + this.classSubmitButton : "join"}`)}
|
|
@@ -51643,11 +51890,9 @@ const SolidMembership = {
|
|
|
51643
51890
|
${this.getModalDialog()}
|
|
51644
51891
|
</solid-ac-checker>
|
|
51645
51892
|
`;
|
|
51646
|
-
|
|
51647
|
-
|
|
51648
|
-
|
|
51649
|
-
"SolidMembership:render"
|
|
51650
|
-
)
|
|
51893
|
+
}
|
|
51894
|
+
B(button, this.element);
|
|
51895
|
+
}, "SolidMembership:render")
|
|
51651
51896
|
};
|
|
51652
51897
|
Sib.register(SolidMembership);
|
|
51653
51898
|
const SolidMemberDelete = {
|
|
@@ -51728,21 +51973,25 @@ const SolidMemberDelete = {
|
|
|
51728
51973
|
async deleteMembership() {
|
|
51729
51974
|
let userSet = this.currentMembers.filter((value) => {
|
|
51730
51975
|
const userId = value["@id"];
|
|
51731
|
-
if (userId == this.dataTargetSrc)
|
|
51732
|
-
return false;
|
|
51976
|
+
if (userId == this.dataTargetSrc) return false;
|
|
51733
51977
|
else return true;
|
|
51734
51978
|
});
|
|
51735
51979
|
let currentRes = {
|
|
51736
51980
|
"@context": this.context,
|
|
51737
|
-
|
|
51981
|
+
user_set: userSet
|
|
51738
51982
|
};
|
|
51739
51983
|
return store.patch(currentRes, this.dataSrc).then((response) => {
|
|
51740
51984
|
if (!response) {
|
|
51741
|
-
console.warn(
|
|
51985
|
+
console.warn(
|
|
51986
|
+
`Error while removing user ${this.dataTargetSrc} from group ${this.dataSrc}`
|
|
51987
|
+
);
|
|
51742
51988
|
return;
|
|
51743
51989
|
}
|
|
51744
51990
|
this.goToNext(null);
|
|
51745
|
-
const eventData = {
|
|
51991
|
+
const eventData = {
|
|
51992
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51993
|
+
bubbles: true
|
|
51994
|
+
};
|
|
51746
51995
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51747
51996
|
this.element.dispatchEvent(new CustomEvent("memberRemoved", eventData));
|
|
51748
51997
|
this.planRender();
|
|
@@ -51754,12 +52003,11 @@ const SolidMemberDelete = {
|
|
|
51754
52003
|
update() {
|
|
51755
52004
|
this.render();
|
|
51756
52005
|
},
|
|
51757
|
-
render: trackRenderAsync(
|
|
51758
|
-
|
|
51759
|
-
|
|
51760
|
-
|
|
51761
|
-
|
|
51762
|
-
button = x`
|
|
52006
|
+
render: trackRenderAsync(async function() {
|
|
52007
|
+
await this.populate();
|
|
52008
|
+
let button = x``;
|
|
52009
|
+
if (this.isMember) {
|
|
52010
|
+
button = x`
|
|
51763
52011
|
<solid-ac-checker data-src="${this.dataSrc}"
|
|
51764
52012
|
permission="acl:Write"
|
|
51765
52013
|
class=${o$2(this.classSubmitButton)}
|
|
@@ -51771,13 +52019,11 @@ const SolidMemberDelete = {
|
|
|
51771
52019
|
${this.getModalDialog()}
|
|
51772
52020
|
</solid-ac-checker>
|
|
51773
52021
|
`;
|
|
51774
|
-
|
|
51775
|
-
|
|
51776
|
-
|
|
51777
|
-
|
|
51778
|
-
|
|
51779
|
-
"SolidMemberDelete:render"
|
|
51780
|
-
)
|
|
52022
|
+
} else {
|
|
52023
|
+
button = x`<span>${this.dataUnknownMember || this.t("solid-member-unknown.span")}</span>`;
|
|
52024
|
+
}
|
|
52025
|
+
B(button, this.element);
|
|
52026
|
+
}, "SolidMemberDelete:render")
|
|
51781
52027
|
};
|
|
51782
52028
|
Sib.register(SolidMemberDelete);
|
|
51783
52029
|
const SolidMemberAdd = {
|
|
@@ -51833,15 +52079,20 @@ const SolidMemberAdd = {
|
|
|
51833
52079
|
this.currentMembers.push(JSON.parse(this.dataTargetSrc));
|
|
51834
52080
|
let currentRes = {
|
|
51835
52081
|
"@context": this.context,
|
|
51836
|
-
|
|
52082
|
+
user_set: this.currentMembers
|
|
51837
52083
|
};
|
|
51838
52084
|
return store.patch(currentRes, this.resourceId).then((response) => {
|
|
51839
52085
|
if (!response) {
|
|
51840
|
-
console.warn(
|
|
52086
|
+
console.warn(
|
|
52087
|
+
`Error while adding user ${this.dataTargetSrc} to group ${this.resourceId}`
|
|
52088
|
+
);
|
|
51841
52089
|
return;
|
|
51842
52090
|
}
|
|
51843
52091
|
this.goToNext(null);
|
|
51844
|
-
const eventData = {
|
|
52092
|
+
const eventData = {
|
|
52093
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
52094
|
+
bubbles: true
|
|
52095
|
+
};
|
|
51845
52096
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51846
52097
|
this.element.dispatchEvent(new CustomEvent("memberAdded", eventData));
|
|
51847
52098
|
this.planRender();
|
|
@@ -51988,9 +52239,17 @@ class SolidTemplateElement extends HTMLElement {
|
|
|
51988
52239
|
const fullPath = `${path}/${ln}.json`;
|
|
51989
52240
|
return fetch(fullPath).then((result) => {
|
|
51990
52241
|
if (result.ok) {
|
|
51991
|
-
return result.json().catch(
|
|
52242
|
+
return result.json().catch(
|
|
52243
|
+
(e2) => console.error(
|
|
52244
|
+
`Error while parsing the translation file: ${fullPath}`
|
|
52245
|
+
)
|
|
52246
|
+
);
|
|
51992
52247
|
}
|
|
51993
|
-
}).catch(
|
|
52248
|
+
}).catch(
|
|
52249
|
+
(e2) => console.error(
|
|
52250
|
+
`Error while retrieving the translation file: ${fullPath}`
|
|
52251
|
+
)
|
|
52252
|
+
);
|
|
51994
52253
|
}
|
|
51995
52254
|
/**
|
|
51996
52255
|
* Returns current locale of app
|
|
@@ -52094,7 +52353,8 @@ class BaseWidget extends HTMLElement {
|
|
|
52094
52353
|
get value() {
|
|
52095
52354
|
if (this.dataHolder) {
|
|
52096
52355
|
let values = this.dataHolder.map((element) => {
|
|
52097
|
-
if (element instanceof HTMLInputElement && element.type == "checkbox")
|
|
52356
|
+
if (element instanceof HTMLInputElement && element.type == "checkbox")
|
|
52357
|
+
return element.checked;
|
|
52098
52358
|
return this.getValueHolder(element).value;
|
|
52099
52359
|
});
|
|
52100
52360
|
return values.length === 1 ? values[0] : values;
|
|
@@ -52113,17 +52373,15 @@ class BaseWidget extends HTMLElement {
|
|
|
52113
52373
|
}
|
|
52114
52374
|
if (element.dispatchEvent) element.dispatchEvent(new Event("change"));
|
|
52115
52375
|
} else if (this.dataHolder && this.dataHolder.length > 1) {
|
|
52116
|
-
this.dataHolder.forEach(
|
|
52117
|
-
(el2
|
|
52118
|
-
|
|
52119
|
-
|
|
52120
|
-
|
|
52121
|
-
|
|
52122
|
-
element.value = value ? value[index2] : "";
|
|
52123
|
-
}
|
|
52124
|
-
element.dispatchEvent(new Event("change"));
|
|
52376
|
+
this.dataHolder.forEach((el2, index2) => {
|
|
52377
|
+
const element = this.getValueHolder(el2);
|
|
52378
|
+
if (element.type == "checkbox") {
|
|
52379
|
+
element.checked = value ? value[index2] : "";
|
|
52380
|
+
} else {
|
|
52381
|
+
element.value = value ? value[index2] : "";
|
|
52125
52382
|
}
|
|
52126
|
-
|
|
52383
|
+
element.dispatchEvent(new Event("change"));
|
|
52384
|
+
});
|
|
52127
52385
|
}
|
|
52128
52386
|
this.render();
|
|
52129
52387
|
}
|
|
@@ -52140,7 +52398,9 @@ class BaseWidget extends HTMLElement {
|
|
|
52140
52398
|
this.setAttribute("remove-label", label);
|
|
52141
52399
|
}
|
|
52142
52400
|
get dataHolder() {
|
|
52143
|
-
const widgetDataHolders = Array.from(
|
|
52401
|
+
const widgetDataHolders = Array.from(
|
|
52402
|
+
this.querySelectorAll("[data-holder]")
|
|
52403
|
+
).filter((element) => {
|
|
52144
52404
|
const dataHolderAncestor = element.parentElement ? element.parentElement.closest("[data-holder]") : null;
|
|
52145
52405
|
return dataHolderAncestor === this || !dataHolderAncestor || !this.contains(dataHolderAncestor);
|
|
52146
52406
|
});
|
|
@@ -52166,7 +52426,10 @@ class BaseWidget extends HTMLElement {
|
|
|
52166
52426
|
}
|
|
52167
52427
|
set range(range2) {
|
|
52168
52428
|
(async () => {
|
|
52169
|
-
this._listen(
|
|
52429
|
+
this._listen(
|
|
52430
|
+
range2,
|
|
52431
|
+
async () => this._range = await store.getData(range2, this.context)
|
|
52432
|
+
);
|
|
52170
52433
|
this._range = await store.getData(range2, this.context);
|
|
52171
52434
|
this.render();
|
|
52172
52435
|
})();
|
|
@@ -52186,9 +52449,13 @@ class BaseWidget extends HTMLElement {
|
|
|
52186
52449
|
}
|
|
52187
52450
|
}
|
|
52188
52451
|
if ((_a3 = res.isContainer) == null ? void 0 : _a3.call(res)) {
|
|
52189
|
-
let resourcesFromContainer = await store.getData(
|
|
52452
|
+
let resourcesFromContainer = await store.getData(
|
|
52453
|
+
res["@id"],
|
|
52454
|
+
this.context
|
|
52455
|
+
);
|
|
52190
52456
|
this._listen(res["@id"]);
|
|
52191
|
-
if (resourcesFromContainer)
|
|
52457
|
+
if (resourcesFromContainer)
|
|
52458
|
+
resources.push(...resourcesFromContainer["ldp:contains"]);
|
|
52192
52459
|
} else {
|
|
52193
52460
|
resources.push(res);
|
|
52194
52461
|
}
|
|
@@ -52234,10 +52501,13 @@ class BaseWidget extends HTMLElement {
|
|
|
52234
52501
|
_listen(id2, callback = () => {
|
|
52235
52502
|
}) {
|
|
52236
52503
|
if (!this._subscriptions.get(id2)) {
|
|
52237
|
-
this._subscriptions.set(
|
|
52238
|
-
|
|
52239
|
-
|
|
52240
|
-
|
|
52504
|
+
this._subscriptions.set(
|
|
52505
|
+
id2,
|
|
52506
|
+
PubSub.subscribe(id2, async () => {
|
|
52507
|
+
await callback();
|
|
52508
|
+
this.render();
|
|
52509
|
+
})
|
|
52510
|
+
);
|
|
52241
52511
|
}
|
|
52242
52512
|
}
|
|
52243
52513
|
// Editable widgets
|
|
@@ -52248,7 +52518,10 @@ class BaseWidget extends HTMLElement {
|
|
|
52248
52518
|
editButton.innerText = "Modifier";
|
|
52249
52519
|
editButton.onclick = () => this.activateEditableField(editableField, editButton);
|
|
52250
52520
|
editableField.insertAdjacentElement("afterend", editButton);
|
|
52251
|
-
editableField.addEventListener(
|
|
52521
|
+
editableField.addEventListener(
|
|
52522
|
+
"focusout",
|
|
52523
|
+
() => this.save(editableField, editButton)
|
|
52524
|
+
);
|
|
52252
52525
|
}
|
|
52253
52526
|
}
|
|
52254
52527
|
activateEditableField(editableField, editButton) {
|
|
@@ -52320,7 +52593,6 @@ export {
|
|
|
52320
52593
|
SolidForm,
|
|
52321
52594
|
SolidFormSearch,
|
|
52322
52595
|
SolidLang,
|
|
52323
|
-
SolidMap,
|
|
52324
52596
|
SolidMemberAdd,
|
|
52325
52597
|
SolidMemberDelete,
|
|
52326
52598
|
SolidMembership,
|