@startinblox/core 0.20.0-beta.1 → 0.20.0-beta.3
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-B4P9rvjM.js} +19 -8
- package/dist/helpers.js +1 -1
- package/dist/index.js +980 -508
- package/dist/slimselect-CT2Oyr_0.js +4 -0
- package/dist/slimselect-WIZK5Hmq.js +4 -0
- package/package.json +4 -1
- package/dist/slimselect-BTZP03JZ.js +0 -4
- package/dist/slimselect-DIo2l9XQ.js +0 -4
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ 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-B4P9rvjM.js";
|
|
6
|
+
import { h } from "./helpers-B4P9rvjM.js";
|
|
7
7
|
import PubSub$1 from "https://cdn.skypack.dev/pubsub-js";
|
|
8
8
|
if (!("flat" in Array.prototype)) {
|
|
9
9
|
Object.defineProperty(Array.prototype, "flat", {
|
|
@@ -41,13 +41,7 @@ if (!Element.prototype.toggleAttribute) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
const HOOKS = ["created", "attached", "detached"];
|
|
44
|
-
const API = [
|
|
45
|
-
"name",
|
|
46
|
-
"use",
|
|
47
|
-
"attributes",
|
|
48
|
-
"initialState",
|
|
49
|
-
...HOOKS
|
|
50
|
-
];
|
|
44
|
+
const API = ["name", "use", "attributes", "initialState", ...HOOKS];
|
|
51
45
|
class Compositor {
|
|
52
46
|
static merge(component, mixins) {
|
|
53
47
|
return {
|
|
@@ -113,7 +107,9 @@ class Compositor {
|
|
|
113
107
|
static mergeMethods(mixins) {
|
|
114
108
|
const methods2 = /* @__PURE__ */ new Map();
|
|
115
109
|
mixins.reverse().forEach((mixin) => {
|
|
116
|
-
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
|
+
);
|
|
117
113
|
keys2.forEach((key) => {
|
|
118
114
|
methods2.set(key, mixin[key]);
|
|
119
115
|
});
|
|
@@ -123,10 +119,20 @@ class Compositor {
|
|
|
123
119
|
static mergeAccessors(mixins) {
|
|
124
120
|
const accessors = {};
|
|
125
121
|
mixins.reverse().forEach((mixin) => {
|
|
126
|
-
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) => {
|
|
127
125
|
accessors[prop2] = { ...accessors[prop2] };
|
|
128
|
-
if (Reflect.getOwnPropertyDescriptor(mixin, prop2).get)
|
|
129
|
-
|
|
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;
|
|
130
136
|
});
|
|
131
137
|
});
|
|
132
138
|
return accessors;
|
|
@@ -467,7 +473,9 @@ function trackRenderAsync(fn, context2) {
|
|
|
467
473
|
this.profiler.updateStats(componentName, renderTime);
|
|
468
474
|
this.profiler.printStats();
|
|
469
475
|
} else {
|
|
470
|
-
log.debug(
|
|
476
|
+
log.debug(
|
|
477
|
+
`Component ${componentName} rendered in ${renderTime.toFixed(2)} ms`
|
|
478
|
+
);
|
|
471
479
|
}
|
|
472
480
|
return result;
|
|
473
481
|
};
|
|
@@ -557,11 +565,26 @@ class ComponentFactory {
|
|
|
557
565
|
const { initialState, attributes, methods: methods2, hooks, accessors, name } = Compositor.merge(component, Compositor.mergeMixin(component));
|
|
558
566
|
let componentConstructor = class extends Component {
|
|
559
567
|
};
|
|
560
|
-
componentConstructor = ComponentFactory.bindInitialState(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
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
|
+
);
|
|
565
588
|
Reflect.defineProperty(componentConstructor, "name", {
|
|
566
589
|
value: name
|
|
567
590
|
});
|
|
@@ -581,7 +604,9 @@ class ComponentFactory {
|
|
|
581
604
|
}
|
|
582
605
|
static bindAttributes(componentConstructor, attributes) {
|
|
583
606
|
if (attributes) {
|
|
584
|
-
const attributesList = Reflect.ownKeys(attributes).map(
|
|
607
|
+
const attributesList = Reflect.ownKeys(attributes).map(
|
|
608
|
+
(key) => String(key)
|
|
609
|
+
);
|
|
585
610
|
const attributesCallback = {};
|
|
586
611
|
attributesList.forEach((key) => {
|
|
587
612
|
const { default: def, type, required, callback } = attributes[key];
|
|
@@ -641,16 +666,29 @@ class ComponentFactory {
|
|
|
641
666
|
}
|
|
642
667
|
});
|
|
643
668
|
Reflect.defineProperty(componentConstructor, "observedAttributes", {
|
|
644
|
-
get: () => attributesList.map(
|
|
669
|
+
get: () => attributesList.map(
|
|
670
|
+
(attr) => attr.replace(/([a-z0-9])([A-Z0-9])/g, "$1-$2").toLowerCase()
|
|
671
|
+
)
|
|
645
672
|
});
|
|
646
|
-
Reflect.defineProperty(
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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
|
+
}
|
|
650
684
|
}
|
|
651
685
|
}
|
|
652
|
-
|
|
653
|
-
Reflect.defineProperty(
|
|
686
|
+
);
|
|
687
|
+
Reflect.defineProperty(
|
|
688
|
+
componentConstructor.prototype,
|
|
689
|
+
"attributesCallback",
|
|
690
|
+
attributesCallback
|
|
691
|
+
);
|
|
654
692
|
}
|
|
655
693
|
return componentConstructor;
|
|
656
694
|
}
|
|
@@ -731,7 +769,10 @@ class Sib {
|
|
|
731
769
|
return component.observedAttributes;
|
|
732
770
|
}
|
|
733
771
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
734
|
-
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
|
+
);
|
|
735
776
|
this.component.attributesCallback(attr, newValue, oldValue);
|
|
736
777
|
}
|
|
737
778
|
connectedCallback() {
|
|
@@ -1323,7 +1364,9 @@ class SpreadDirective extends i$2 {
|
|
|
1323
1364
|
if (part2.type === t.ATTRIBUTE || part2.type === t.PROPERTY) {
|
|
1324
1365
|
element = part2.element;
|
|
1325
1366
|
} else {
|
|
1326
|
-
console.warn(
|
|
1367
|
+
console.warn(
|
|
1368
|
+
"Unsupported part type or missing element, skipping update."
|
|
1369
|
+
);
|
|
1327
1370
|
return T;
|
|
1328
1371
|
}
|
|
1329
1372
|
if (spreadData) {
|
|
@@ -1401,7 +1444,10 @@ function preHTML(strings, ...values) {
|
|
|
1401
1444
|
const { needlessValues: needlessValues2 } = cached;
|
|
1402
1445
|
const isSame = needlessValues2.every((nv) => values[nv.index] === nv.value);
|
|
1403
1446
|
if (isSame) {
|
|
1404
|
-
return x(
|
|
1447
|
+
return x(
|
|
1448
|
+
cached.strings,
|
|
1449
|
+
...filterOutNeedlessValues(values, needlessValues2)
|
|
1450
|
+
);
|
|
1405
1451
|
}
|
|
1406
1452
|
}
|
|
1407
1453
|
}
|
|
@@ -1424,7 +1470,10 @@ function preHTML(strings, ...values) {
|
|
|
1424
1470
|
strings: finalStrings,
|
|
1425
1471
|
needlessValues
|
|
1426
1472
|
});
|
|
1427
|
-
return x(
|
|
1473
|
+
return x(
|
|
1474
|
+
finalStrings,
|
|
1475
|
+
...filterOutNeedlessValues(values, needlessValues)
|
|
1476
|
+
);
|
|
1428
1477
|
}
|
|
1429
1478
|
class PostProcessorRegistry {
|
|
1430
1479
|
constructor(currentPostProcessors = []) {
|
|
@@ -1557,7 +1606,10 @@ const BaseWidgetMixin = {
|
|
|
1557
1606
|
},
|
|
1558
1607
|
render() {
|
|
1559
1608
|
const listValueTransformationsCopy = this.listValueTransformations.deepCopy();
|
|
1560
|
-
listValueTransformationsCopy.attach(
|
|
1609
|
+
listValueTransformationsCopy.attach(
|
|
1610
|
+
this.renderTemplate.bind(this),
|
|
1611
|
+
"BaseWidgetMixin:renderTemplate"
|
|
1612
|
+
);
|
|
1561
1613
|
const nextProcessor = listValueTransformationsCopy.shift();
|
|
1562
1614
|
nextProcessor(this.value, listValueTransformationsCopy);
|
|
1563
1615
|
const listCallbacksCopy = this.listCallbacks.deepCopy();
|
|
@@ -1565,12 +1617,17 @@ const BaseWidgetMixin = {
|
|
|
1565
1617
|
if (nextCallback) {
|
|
1566
1618
|
nextCallback(this.value, listCallbacksCopy);
|
|
1567
1619
|
}
|
|
1568
|
-
this.element.dispatchEvent(
|
|
1620
|
+
this.element.dispatchEvent(
|
|
1621
|
+
new CustomEvent("widgetRendered", { bubbles: true })
|
|
1622
|
+
);
|
|
1569
1623
|
},
|
|
1570
1624
|
renderTemplate(value) {
|
|
1571
1625
|
const template = this.template(value, { ...this.listAttributes });
|
|
1572
1626
|
const listTemplateAdditionsCopy = this.listTemplateAdditions.deepCopy();
|
|
1573
|
-
listTemplateAdditionsCopy.attach(
|
|
1627
|
+
listTemplateAdditionsCopy.attach(
|
|
1628
|
+
this.templateToDOM.bind(this),
|
|
1629
|
+
"BaseWidgetMixin:templateToDOM"
|
|
1630
|
+
);
|
|
1574
1631
|
const nextProcessor = listTemplateAdditionsCopy.shift();
|
|
1575
1632
|
nextProcessor(template, listTemplateAdditionsCopy);
|
|
1576
1633
|
},
|
|
@@ -11144,7 +11201,8 @@ class CustomGetter {
|
|
|
11144
11201
|
if (!path) return;
|
|
11145
11202
|
try {
|
|
11146
11203
|
let isUrl = new URL(path);
|
|
11147
|
-
if (!isUrl.protocol.startsWith("http"))
|
|
11204
|
+
if (!isUrl.protocol.startsWith("http"))
|
|
11205
|
+
throw new Error("Not a valid HTTP url");
|
|
11148
11206
|
if (isUrl) {
|
|
11149
11207
|
let resources = this.resource[this.getExpandedPredicate(path)];
|
|
11150
11208
|
if (!resources) return void 0;
|
|
@@ -11152,7 +11210,13 @@ class CustomGetter {
|
|
|
11152
11210
|
let result = resources ? resources.map((res) => {
|
|
11153
11211
|
let resource = store.get(res["@id"]);
|
|
11154
11212
|
if (resource) return resource;
|
|
11155
|
-
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();
|
|
11156
11220
|
store.cacheResource(res["@id"], resource);
|
|
11157
11221
|
return resource;
|
|
11158
11222
|
}) : [];
|
|
@@ -11164,7 +11228,11 @@ class CustomGetter {
|
|
|
11164
11228
|
const path2 = [];
|
|
11165
11229
|
let value;
|
|
11166
11230
|
if (!this.isFullResource()) {
|
|
11167
|
-
await this.getResource(
|
|
11231
|
+
await this.getResource(
|
|
11232
|
+
this.resourceId,
|
|
11233
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11234
|
+
this.parentId
|
|
11235
|
+
);
|
|
11168
11236
|
}
|
|
11169
11237
|
while (true) {
|
|
11170
11238
|
value = await this.resource[this.getExpandedPredicate(path1[0])];
|
|
@@ -11174,10 +11242,18 @@ class CustomGetter {
|
|
|
11174
11242
|
}
|
|
11175
11243
|
if (path2.length === 0) {
|
|
11176
11244
|
if (!value || !value["@id"]) return this.getLiteralValue(value);
|
|
11177
|
-
return await this.getResource(
|
|
11245
|
+
return await this.getResource(
|
|
11246
|
+
value["@id"],
|
|
11247
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11248
|
+
this.parentId || this.resourceId
|
|
11249
|
+
);
|
|
11178
11250
|
}
|
|
11179
11251
|
if (!value || !value["@id"]) return void 0;
|
|
11180
|
-
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
|
+
);
|
|
11181
11257
|
store.subscribeResourceTo(this.resourceId, value["@id"]);
|
|
11182
11258
|
return resource ? await resource[path2.join(".")] : void 0;
|
|
11183
11259
|
}
|
|
@@ -11195,8 +11271,13 @@ class CustomGetter {
|
|
|
11195
11271
|
if (value.length === 0) return null;
|
|
11196
11272
|
if (Array.isArray(value[0])) {
|
|
11197
11273
|
const ln = store._getLanguage();
|
|
11198
|
-
let translatedValue = value.find(
|
|
11199
|
-
|
|
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
|
+
);
|
|
11200
11281
|
return translatedValue ? translatedValue["@value"] || null : null;
|
|
11201
11282
|
}
|
|
11202
11283
|
return value;
|
|
@@ -11220,11 +11301,15 @@ class CustomGetter {
|
|
|
11220
11301
|
isContainer() {
|
|
11221
11302
|
if (this.resource["@type"]) {
|
|
11222
11303
|
if (Array.isArray(this.resource["@type"]))
|
|
11223
|
-
return this.containerTypes.some(
|
|
11304
|
+
return this.containerTypes.some(
|
|
11305
|
+
(type) => this.resource["@type"].includes(type)
|
|
11306
|
+
);
|
|
11224
11307
|
return this.containerTypes.includes(this.resource["@type"]);
|
|
11225
11308
|
} else if (this.resource["type"]) {
|
|
11226
11309
|
if (Array.isArray(this.resource["type"]))
|
|
11227
|
-
return this.containerTypes.some(
|
|
11310
|
+
return this.containerTypes.some(
|
|
11311
|
+
(type) => this.resource["type"].includes(type)
|
|
11312
|
+
);
|
|
11228
11313
|
return this.containerTypes.includes(this.resource["type"]);
|
|
11229
11314
|
}
|
|
11230
11315
|
return false;
|
|
@@ -11233,15 +11318,16 @@ class CustomGetter {
|
|
|
11233
11318
|
* Return true if the given key in the current resource in an array
|
|
11234
11319
|
*/
|
|
11235
11320
|
isArray() {
|
|
11236
|
-
if (Array.isArray(this.resource))
|
|
11237
|
-
return true;
|
|
11321
|
+
if (Array.isArray(this.resource)) return true;
|
|
11238
11322
|
return false;
|
|
11239
11323
|
}
|
|
11240
11324
|
/**
|
|
11241
11325
|
* Get all properties of a resource
|
|
11242
11326
|
*/
|
|
11243
11327
|
getProperties() {
|
|
11244
|
-
return Object.keys(this.resource).map(
|
|
11328
|
+
return Object.keys(this.resource).map(
|
|
11329
|
+
(prop2) => this.getCompactedPredicate(prop2)
|
|
11330
|
+
);
|
|
11245
11331
|
}
|
|
11246
11332
|
/**
|
|
11247
11333
|
* Get children of container as objects
|
|
@@ -11259,14 +11345,23 @@ class CustomGetter {
|
|
|
11259
11345
|
let result = children ? children.map((res) => {
|
|
11260
11346
|
let resource = store.get(res["@id"]);
|
|
11261
11347
|
if (resource) return resource;
|
|
11262
|
-
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();
|
|
11263
11355
|
store.cacheResource(res["@id"], resource);
|
|
11264
11356
|
return resource;
|
|
11265
11357
|
}) : [];
|
|
11266
11358
|
return result;
|
|
11267
11359
|
}
|
|
11268
11360
|
merge(resource) {
|
|
11269
|
-
this.resource = {
|
|
11361
|
+
this.resource = {
|
|
11362
|
+
...this.getResourceData(),
|
|
11363
|
+
...resource.getResourceData()
|
|
11364
|
+
};
|
|
11270
11365
|
}
|
|
11271
11366
|
getResourceData() {
|
|
11272
11367
|
return this.resource;
|
|
@@ -11276,7 +11371,9 @@ class CustomGetter {
|
|
|
11276
11371
|
* @param prop
|
|
11277
11372
|
*/
|
|
11278
11373
|
isFullResource() {
|
|
11279
|
-
let propertiesKeys = Object.keys(this.resource).filter(
|
|
11374
|
+
let propertiesKeys = Object.keys(this.resource).filter(
|
|
11375
|
+
(p2) => !p2.startsWith("@")
|
|
11376
|
+
);
|
|
11280
11377
|
if (this.resource["@id"].startsWith("_:b")) return true;
|
|
11281
11378
|
if (propertiesKeys.length === 1 && propertiesKeys[0] === this.getExpandedPredicate("permissions"))
|
|
11282
11379
|
return false;
|
|
@@ -11286,7 +11383,7 @@ class CustomGetter {
|
|
|
11286
11383
|
/**
|
|
11287
11384
|
* Get permissions of a resource
|
|
11288
11385
|
* @param resourceId
|
|
11289
|
-
* @returns
|
|
11386
|
+
* @returns
|
|
11290
11387
|
*/
|
|
11291
11388
|
async getPermissions() {
|
|
11292
11389
|
let permissions = this.resource[this.getExpandedPredicate("permissions")];
|
|
@@ -11315,13 +11412,24 @@ class CustomGetter {
|
|
|
11315
11412
|
store.clearCache(this.resourceId);
|
|
11316
11413
|
}
|
|
11317
11414
|
getExpandedPredicate(property) {
|
|
11318
|
-
return ContextParser$1.expandTerm(
|
|
11415
|
+
return ContextParser$1.expandTerm(
|
|
11416
|
+
property,
|
|
11417
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11418
|
+
true
|
|
11419
|
+
);
|
|
11319
11420
|
}
|
|
11320
11421
|
getCompactedPredicate(property) {
|
|
11321
|
-
return ContextParser$1.compactIri(
|
|
11422
|
+
return ContextParser$1.compactIri(
|
|
11423
|
+
property,
|
|
11424
|
+
{ ...this.clientContext, ...this.serverContext },
|
|
11425
|
+
true
|
|
11426
|
+
);
|
|
11322
11427
|
}
|
|
11323
11428
|
getCompactedIri(id2) {
|
|
11324
|
-
return ContextParser$1.compactIri(id2, {
|
|
11429
|
+
return ContextParser$1.compactIri(id2, {
|
|
11430
|
+
...this.clientContext,
|
|
11431
|
+
...this.serverContext
|
|
11432
|
+
});
|
|
11325
11433
|
}
|
|
11326
11434
|
toString() {
|
|
11327
11435
|
return this.getCompactedIri(this.resource["@id"]);
|
|
@@ -11336,13 +11444,13 @@ class CustomGetter {
|
|
|
11336
11444
|
return new Proxy(this, {
|
|
11337
11445
|
get: (resource, property) => {
|
|
11338
11446
|
if (!this.resource) return void 0;
|
|
11339
|
-
if (typeof resource[property] === "function")
|
|
11447
|
+
if (typeof resource[property] === "function")
|
|
11448
|
+
return resource[property].bind(resource);
|
|
11340
11449
|
switch (property) {
|
|
11341
11450
|
case "@id":
|
|
11342
11451
|
if (this.resource["@id"])
|
|
11343
11452
|
return this.getCompactedIri(this.resource["@id"]);
|
|
11344
|
-
else
|
|
11345
|
-
console.log(this.resource, this.resource["@id"]);
|
|
11453
|
+
else console.log(this.resource, this.resource["@id"]);
|
|
11346
11454
|
return;
|
|
11347
11455
|
case "@type":
|
|
11348
11456
|
return this.resource["@type"];
|
|
@@ -11367,7 +11475,9 @@ class CustomGetter {
|
|
|
11367
11475
|
}
|
|
11368
11476
|
function formatAttributesToServerSearchOptions(elementAttributes) {
|
|
11369
11477
|
var _a3, _b, _c;
|
|
11370
|
-
const attributes = new Map(
|
|
11478
|
+
const attributes = new Map(
|
|
11479
|
+
Array.from(elementAttributes).map(({ name, value: value2 }) => [name, value2])
|
|
11480
|
+
);
|
|
11371
11481
|
const fields = (_a3 = attributes.get("server-search-fields")) == null ? void 0 : _a3.split(",").map((field) => field.trim());
|
|
11372
11482
|
const value = (_b = attributes.get("server-search-value")) == null ? void 0 : _b.trim();
|
|
11373
11483
|
const method = (_c = attributes.get("server-search-method")) == null ? void 0 : _c.trim();
|
|
@@ -11392,7 +11502,9 @@ function appendServerSearchToIri(iri, options) {
|
|
|
11392
11502
|
return `${iri}${first}search-fields=${fields}&search-terms=${value}&search-method=${method}`;
|
|
11393
11503
|
}
|
|
11394
11504
|
function formatAttributesToServerPaginationOptions(elementAttributes) {
|
|
11395
|
-
const attributes = new Map(
|
|
11505
|
+
const attributes = new Map(
|
|
11506
|
+
Array.from(elementAttributes).map(({ name, value }) => [name, value])
|
|
11507
|
+
);
|
|
11396
11508
|
const limit = attributes.get("limit");
|
|
11397
11509
|
const offset = attributes.get("offset");
|
|
11398
11510
|
if (!offset || !limit) return;
|
|
@@ -11454,7 +11566,11 @@ class Store {
|
|
|
11454
11566
|
this.subscriptionIndex = /* @__PURE__ */ new Map();
|
|
11455
11567
|
this.subscriptionVirtualContainersIndex = /* @__PURE__ */ new Map();
|
|
11456
11568
|
this.loadingList = /* @__PURE__ */ new Set();
|
|
11457
|
-
this.headers = {
|
|
11569
|
+
this.headers = {
|
|
11570
|
+
Accept: "application/ld+json",
|
|
11571
|
+
"Content-Type": "application/ld+json",
|
|
11572
|
+
"Cache-Control": "must-revalidate"
|
|
11573
|
+
};
|
|
11458
11574
|
this.fetch = this.storeOptions.fetchMethod;
|
|
11459
11575
|
this.session = this.storeOptions.session;
|
|
11460
11576
|
}
|
|
@@ -11468,7 +11584,7 @@ class Store {
|
|
|
11468
11584
|
* @param serverPagination - Server pagination options
|
|
11469
11585
|
* @param serverSearch - Server search options
|
|
11470
11586
|
* @param predicateName - predicate name if we target a specific predicate from the resource, useful for arrays
|
|
11471
|
-
*
|
|
11587
|
+
*
|
|
11472
11588
|
* @returns The fetched resource
|
|
11473
11589
|
*
|
|
11474
11590
|
* @async
|
|
@@ -11484,10 +11600,14 @@ class Store {
|
|
|
11484
11600
|
}
|
|
11485
11601
|
if (localData == null && this.cache.has(key) && !this.loadingList.has(key)) {
|
|
11486
11602
|
const resource = this.get(key);
|
|
11487
|
-
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;
|
|
11488
11605
|
}
|
|
11489
11606
|
return new Promise(async (resolve2) => {
|
|
11490
|
-
document.addEventListener(
|
|
11607
|
+
document.addEventListener(
|
|
11608
|
+
"resourceReady",
|
|
11609
|
+
this.resolveResource(key, resolve2)
|
|
11610
|
+
);
|
|
11491
11611
|
if (this.loadingList.has(key)) return;
|
|
11492
11612
|
this.loadingList.add(key);
|
|
11493
11613
|
const clientContext = await myParser.parse(context2);
|
|
@@ -11496,20 +11616,48 @@ class Store {
|
|
|
11496
11616
|
if (localData == null) localData = {};
|
|
11497
11617
|
localData["@id"] = id2;
|
|
11498
11618
|
resource = localData;
|
|
11499
|
-
} else
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
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
|
+
}
|
|
11504
11631
|
if (!resource) {
|
|
11505
11632
|
this.loadingList.delete(key);
|
|
11506
|
-
document.dispatchEvent(
|
|
11633
|
+
document.dispatchEvent(
|
|
11634
|
+
new CustomEvent("resourceReady", {
|
|
11635
|
+
detail: { id: key, resource: null, fetchedResource: null }
|
|
11636
|
+
})
|
|
11637
|
+
);
|
|
11507
11638
|
return;
|
|
11508
11639
|
}
|
|
11509
|
-
const serverContext = await myParser.parse([
|
|
11510
|
-
|
|
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
|
+
);
|
|
11511
11651
|
this.loadingList.delete(key);
|
|
11512
|
-
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
|
+
);
|
|
11513
11661
|
});
|
|
11514
11662
|
}
|
|
11515
11663
|
async fetchAuthn(iri, options) {
|
|
@@ -11518,7 +11666,8 @@ class Store {
|
|
|
11518
11666
|
if (this.fetch && authenticated) {
|
|
11519
11667
|
return this.fetch.then((fn) => fn(iri, options));
|
|
11520
11668
|
} else {
|
|
11521
|
-
if (options.headers)
|
|
11669
|
+
if (options.headers)
|
|
11670
|
+
options.headers = this._convertHeaders(options.headers);
|
|
11522
11671
|
return fetch(iri, options).then(function(response) {
|
|
11523
11672
|
return response;
|
|
11524
11673
|
});
|
|
@@ -11535,7 +11684,8 @@ class Store {
|
|
|
11535
11684
|
*/
|
|
11536
11685
|
async fetchData(id2, context2 = {}, parentId = "", serverPagination, serverSearch) {
|
|
11537
11686
|
let iri = this._getAbsoluteIri(id2, context2, parentId);
|
|
11538
|
-
if (serverPagination)
|
|
11687
|
+
if (serverPagination)
|
|
11688
|
+
iri = appendServerPaginationToIri(iri, serverPagination);
|
|
11539
11689
|
if (serverSearch) iri = appendServerSearchToIri(iri, serverSearch);
|
|
11540
11690
|
const headers = {
|
|
11541
11691
|
...this.headers,
|
|
@@ -11552,17 +11702,19 @@ class Store {
|
|
|
11552
11702
|
});
|
|
11553
11703
|
}
|
|
11554
11704
|
/**
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
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
|
+
*/
|
|
11563
11713
|
async cacheGraph(resource, clientContext, parentContext, parentId, serverPagination, serverSearch) {
|
|
11564
11714
|
const flattenedResources = await jsonld$1.flatten(resource);
|
|
11565
|
-
const compactedResources = await Promise.all(
|
|
11715
|
+
const compactedResources = await Promise.all(
|
|
11716
|
+
flattenedResources.map((r3) => jsonld$1.compact(r3, {}))
|
|
11717
|
+
);
|
|
11566
11718
|
for (let resource2 of compactedResources) {
|
|
11567
11719
|
let id2 = resource2["@id"] || resource2["id"];
|
|
11568
11720
|
let key = resource2["@id"] || resource2["id"];
|
|
@@ -11570,11 +11722,21 @@ class Store {
|
|
|
11570
11722
|
if (key === "/") key = parentId;
|
|
11571
11723
|
if (key.startsWith("_:b")) key = key + parentId;
|
|
11572
11724
|
if (key === id2 && resource2["@type"] == this.getExpandedPredicate("ldp:Container", clientContext)) {
|
|
11573
|
-
if (serverPagination)
|
|
11725
|
+
if (serverPagination)
|
|
11726
|
+
key = appendServerPaginationToIri(key, serverPagination);
|
|
11574
11727
|
if (serverSearch) key = appendServerSearchToIri(key, serverSearch);
|
|
11575
11728
|
}
|
|
11576
|
-
const resourceProxy = new CustomGetter(
|
|
11577
|
-
|
|
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);
|
|
11578
11740
|
if (this.get(key)) {
|
|
11579
11741
|
this.cache.get(key).merge(resourceProxy);
|
|
11580
11742
|
} else {
|
|
@@ -11629,7 +11791,8 @@ class Store {
|
|
|
11629
11791
|
* @returns void
|
|
11630
11792
|
*/
|
|
11631
11793
|
async _updateResource(method, resource, id2) {
|
|
11632
|
-
if (!["POST", "PUT", "PATCH", "_LOCAL"].includes(method))
|
|
11794
|
+
if (!["POST", "PUT", "PATCH", "_LOCAL"].includes(method))
|
|
11795
|
+
throw new Error("Error: method not allowed");
|
|
11633
11796
|
const context2 = await myParser.parse([resource["@context"] || {}]);
|
|
11634
11797
|
const expandedId = this._getExpandedId(id2, context2);
|
|
11635
11798
|
return this._fetch(method, resource, id2).then(async (response) => {
|
|
@@ -11642,7 +11805,16 @@ class Store {
|
|
|
11642
11805
|
const nestedResources = await this.getNestedResources(resource, id2);
|
|
11643
11806
|
const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
|
|
11644
11807
|
const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
|
|
11645
|
-
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
|
+
);
|
|
11646
11818
|
});
|
|
11647
11819
|
return ((_a3 = response.headers) == null ? void 0 : _a3.get("Location")) || null;
|
|
11648
11820
|
} else {
|
|
@@ -11659,12 +11831,19 @@ class Store {
|
|
|
11659
11831
|
resourceIds = [...new Set(resourceIds.filter((id2) => this.cache.has(id2)))];
|
|
11660
11832
|
const resourceWithContexts = resourceIds.map((resourceId) => {
|
|
11661
11833
|
var _a3;
|
|
11662
|
-
return {
|
|
11834
|
+
return {
|
|
11835
|
+
id: resourceId,
|
|
11836
|
+
context: (_a3 = store.get(resourceId)) == null ? void 0 : _a3.clientContext
|
|
11837
|
+
};
|
|
11663
11838
|
});
|
|
11664
11839
|
for (const resource of resourceWithContexts) {
|
|
11665
11840
|
if (!this._isLocalId(resource.id)) this.clearCache(resource.id);
|
|
11666
11841
|
}
|
|
11667
|
-
await Promise.all(
|
|
11842
|
+
await Promise.all(
|
|
11843
|
+
resourceWithContexts.map(
|
|
11844
|
+
({ id: id2, context: context2 }) => this.getData(id2, context2 || base_context)
|
|
11845
|
+
)
|
|
11846
|
+
);
|
|
11668
11847
|
return resourceIds;
|
|
11669
11848
|
}
|
|
11670
11849
|
/**
|
|
@@ -11717,7 +11896,8 @@ class Store {
|
|
|
11717
11896
|
const resource = this.cache.get(id2);
|
|
11718
11897
|
if (resource["@type"] === "ldp:Container") {
|
|
11719
11898
|
resource["ldp:contains"].forEach((child) => {
|
|
11720
|
-
if (child && child["@type"] === "ldp:Container")
|
|
11899
|
+
if (child && child["@type"] === "ldp:Container")
|
|
11900
|
+
this.cache.delete(child["@id"]);
|
|
11721
11901
|
});
|
|
11722
11902
|
}
|
|
11723
11903
|
this.cache.delete(id2);
|
|
@@ -11779,7 +11959,9 @@ class Store {
|
|
|
11779
11959
|
});
|
|
11780
11960
|
const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
|
|
11781
11961
|
const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
|
|
11782
|
-
this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(
|
|
11962
|
+
this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(
|
|
11963
|
+
(resourceIds) => this.notifyResources(resourceIds)
|
|
11964
|
+
);
|
|
11783
11965
|
return deleted;
|
|
11784
11966
|
}
|
|
11785
11967
|
/**
|
|
@@ -11804,8 +11986,7 @@ class Store {
|
|
|
11804
11986
|
* @returns The fully expanded term
|
|
11805
11987
|
*/
|
|
11806
11988
|
getExpandedPredicate(property, context2) {
|
|
11807
|
-
if (!context2)
|
|
11808
|
-
return ContextParser2.expandTerm(property, base_context, true);
|
|
11989
|
+
if (!context2) return ContextParser2.expandTerm(property, base_context, true);
|
|
11809
11990
|
return ContextParser2.expandTerm(property, context2, true);
|
|
11810
11991
|
}
|
|
11811
11992
|
/**
|
|
@@ -11815,8 +11996,7 @@ class Store {
|
|
|
11815
11996
|
* @returns The compacted term
|
|
11816
11997
|
*/
|
|
11817
11998
|
getCompactedIri(property, context2) {
|
|
11818
|
-
if (!context2)
|
|
11819
|
-
return ContextParser2.compactIri(property, base_context, true);
|
|
11999
|
+
if (!context2) return ContextParser2.compactIri(property, base_context, true);
|
|
11820
12000
|
return ContextParser2.compactIri(property, context2, true);
|
|
11821
12001
|
}
|
|
11822
12002
|
/**
|
|
@@ -11834,7 +12014,9 @@ class Store {
|
|
|
11834
12014
|
*/
|
|
11835
12015
|
subscribeResourceTo(resourceId, nestedResourceId) {
|
|
11836
12016
|
const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];
|
|
11837
|
-
this.subscriptionIndex.set(nestedResourceId, [
|
|
12017
|
+
this.subscriptionIndex.set(nestedResourceId, [
|
|
12018
|
+
.../* @__PURE__ */ new Set([...existingSubscriptions, resourceId])
|
|
12019
|
+
]);
|
|
11838
12020
|
}
|
|
11839
12021
|
/**
|
|
11840
12022
|
* Make a virtual container listen for changes of a resource
|
|
@@ -11843,7 +12025,9 @@ class Store {
|
|
|
11843
12025
|
*/
|
|
11844
12026
|
subscribeVirtualContainerTo(virtualContainerId, nestedResourceId) {
|
|
11845
12027
|
const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];
|
|
11846
|
-
this.subscriptionVirtualContainersIndex.set(nestedResourceId, [
|
|
12028
|
+
this.subscriptionVirtualContainersIndex.set(nestedResourceId, [
|
|
12029
|
+
.../* @__PURE__ */ new Set([...existingSubscriptions, virtualContainerId])
|
|
12030
|
+
]);
|
|
11847
12031
|
}
|
|
11848
12032
|
/**
|
|
11849
12033
|
* Return absolute IRI of the resource
|
|
@@ -11890,7 +12074,9 @@ if (window.sibStore) {
|
|
|
11890
12074
|
if (sibAuth) {
|
|
11891
12075
|
const sibAuthDefined = customElements.whenDefined(sibAuth.localName);
|
|
11892
12076
|
storeOptions.session = sibAuthDefined.then(() => sibAuth.session);
|
|
11893
|
-
storeOptions.fetchMethod = sibAuthDefined.then(
|
|
12077
|
+
storeOptions.fetchMethod = sibAuthDefined.then(
|
|
12078
|
+
() => sibAuth.getFetch()
|
|
12079
|
+
);
|
|
11894
12080
|
}
|
|
11895
12081
|
store = new Store(storeOptions);
|
|
11896
12082
|
window.sibStore = store;
|
|
@@ -11919,15 +12105,20 @@ const AttributeBinderMixin = {
|
|
|
11919
12105
|
async replaceAttributesData(reset = true) {
|
|
11920
12106
|
if (reset) this.resetAttributesData();
|
|
11921
12107
|
const oldAttributes = Array.from(this.element.attributes).reduce((obj, attr) => {
|
|
11922
|
-
if (!attr.value.match(/^store:\/\/(resource|container|user)/))
|
|
11923
|
-
|
|
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;
|
|
11924
12112
|
return {
|
|
11925
12113
|
...obj,
|
|
11926
12114
|
[attr.name]: attr.value
|
|
11927
12115
|
// add "key: value"
|
|
11928
12116
|
};
|
|
11929
12117
|
}, {});
|
|
11930
|
-
const newAttributes = await this.transformAttributes(
|
|
12118
|
+
const newAttributes = await this.transformAttributes(
|
|
12119
|
+
{ ...oldAttributes },
|
|
12120
|
+
this.resource
|
|
12121
|
+
);
|
|
11931
12122
|
for (let attr of Object.keys(newAttributes)) {
|
|
11932
12123
|
if (oldAttributes[attr] == newAttributes[attr]) continue;
|
|
11933
12124
|
this.element.setAttribute(attr, newAttributes[attr]);
|
|
@@ -12010,7 +12201,8 @@ const ContextMixin = {
|
|
|
12010
12201
|
// take element extra context first
|
|
12011
12202
|
document.querySelector("[data-default-context]")
|
|
12012
12203
|
);
|
|
12013
|
-
if (extraContextElement)
|
|
12204
|
+
if (extraContextElement)
|
|
12205
|
+
return JSON.parse(extraContextElement.textContent || "{}");
|
|
12014
12206
|
return {};
|
|
12015
12207
|
}
|
|
12016
12208
|
};
|
|
@@ -12111,7 +12303,8 @@ const ServerPaginationMixin = {
|
|
|
12111
12303
|
const currentOffset = this.getCurrentOffset(resourceId, this.limit);
|
|
12112
12304
|
var currentPageNumber = this.getCurrentServedPage(resourceId, 1);
|
|
12113
12305
|
const pageCount = Math.ceil(this.pageCount / this.limit);
|
|
12114
|
-
B(
|
|
12306
|
+
B(
|
|
12307
|
+
x`
|
|
12115
12308
|
<button
|
|
12116
12309
|
data-id="prev"
|
|
12117
12310
|
?disabled=${currentOffset <= 0}
|
|
@@ -12127,7 +12320,9 @@ const ServerPaginationMixin = {
|
|
|
12127
12320
|
>→</button>
|
|
12128
12321
|
<span>
|
|
12129
12322
|
</span>
|
|
12130
|
-
`,
|
|
12323
|
+
`,
|
|
12324
|
+
div2
|
|
12325
|
+
);
|
|
12131
12326
|
}
|
|
12132
12327
|
}
|
|
12133
12328
|
};
|
|
@@ -12168,7 +12363,11 @@ const StoreMixin = {
|
|
|
12168
12363
|
type: String,
|
|
12169
12364
|
default: null,
|
|
12170
12365
|
callback: function(value) {
|
|
12171
|
-
if (value)
|
|
12366
|
+
if (value)
|
|
12367
|
+
this.predicateName = store.getExpandedPredicate(
|
|
12368
|
+
this.arrayField,
|
|
12369
|
+
this.context
|
|
12370
|
+
);
|
|
12172
12371
|
}
|
|
12173
12372
|
},
|
|
12174
12373
|
predicateName: {
|
|
@@ -12177,6 +12376,7 @@ const StoreMixin = {
|
|
|
12177
12376
|
}
|
|
12178
12377
|
},
|
|
12179
12378
|
initialState: {
|
|
12379
|
+
resources: [],
|
|
12180
12380
|
resourceId: null,
|
|
12181
12381
|
subscription: null
|
|
12182
12382
|
},
|
|
@@ -12189,7 +12389,9 @@ const StoreMixin = {
|
|
|
12189
12389
|
get resource() {
|
|
12190
12390
|
var _a3;
|
|
12191
12391
|
let id2 = this.resourceId;
|
|
12192
|
-
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
12392
|
+
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
12393
|
+
this.element.attributes
|
|
12394
|
+
);
|
|
12193
12395
|
const serverSearch = mergeServerSearchOptions(
|
|
12194
12396
|
formatAttributesToServerSearchOptions(this.element.attributes),
|
|
12195
12397
|
(_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this)
|
|
@@ -12218,15 +12420,28 @@ const StoreMixin = {
|
|
|
12218
12420
|
}
|
|
12219
12421
|
}
|
|
12220
12422
|
this.updateNavigateSubscription();
|
|
12221
|
-
this.subscription = PubSub.subscribe(
|
|
12222
|
-
|
|
12423
|
+
this.subscription = PubSub.subscribe(
|
|
12424
|
+
this.resourceId,
|
|
12425
|
+
this.updateDOM.bind(this)
|
|
12426
|
+
);
|
|
12427
|
+
const serverPagination = formatAttributesToServerPaginationOptions(
|
|
12428
|
+
this.element.attributes
|
|
12429
|
+
);
|
|
12223
12430
|
const dynamicServerSearch = (_a3 = this.getDynamicServerSearch) == null ? void 0 : _a3.call(this);
|
|
12224
12431
|
const serverSearch = mergeServerSearchOptions(
|
|
12225
12432
|
formatAttributesToServerSearchOptions(this.element.attributes),
|
|
12226
12433
|
dynamicServerSearch
|
|
12227
12434
|
);
|
|
12228
12435
|
const forceRefetch = !!dynamicServerSearch;
|
|
12229
|
-
await store.getData(
|
|
12436
|
+
await store.getData(
|
|
12437
|
+
this.resourceId,
|
|
12438
|
+
this.context,
|
|
12439
|
+
void 0,
|
|
12440
|
+
void 0,
|
|
12441
|
+
forceRefetch,
|
|
12442
|
+
serverPagination,
|
|
12443
|
+
serverSearch
|
|
12444
|
+
);
|
|
12230
12445
|
this.updateDOM();
|
|
12231
12446
|
},
|
|
12232
12447
|
toggleLoaderHidden(toggle) {
|
|
@@ -12242,7 +12457,11 @@ const StoreMixin = {
|
|
|
12242
12457
|
setTimeout(
|
|
12243
12458
|
() => (
|
|
12244
12459
|
// Brings the dispatchEvent at the end of the queue
|
|
12245
|
-
this.element.dispatchEvent(
|
|
12460
|
+
this.element.dispatchEvent(
|
|
12461
|
+
new CustomEvent("populate", {
|
|
12462
|
+
detail: { resource: { "@id": this.dataSrc } }
|
|
12463
|
+
})
|
|
12464
|
+
)
|
|
12246
12465
|
)
|
|
12247
12466
|
);
|
|
12248
12467
|
this.toggleLoaderHidden(true);
|
|
@@ -12275,7 +12494,10 @@ const EditableMixin = {
|
|
|
12275
12494
|
}
|
|
12276
12495
|
},
|
|
12277
12496
|
created() {
|
|
12278
|
-
this.listTemplateAdditions.attach(
|
|
12497
|
+
this.listTemplateAdditions.attach(
|
|
12498
|
+
this.addEditButton.bind(this),
|
|
12499
|
+
"EditableMixin:addEditButton"
|
|
12500
|
+
);
|
|
12279
12501
|
},
|
|
12280
12502
|
addEditButton(template, listTemplateAdditions) {
|
|
12281
12503
|
let newTemplate = null;
|
|
@@ -12283,7 +12505,8 @@ const EditableMixin = {
|
|
|
12283
12505
|
newTemplate = x`${template}<button @click=${this.activateEditableField.bind(this)}>${this.buttonLabel}</button>`;
|
|
12284
12506
|
}
|
|
12285
12507
|
const nextProcessor = listTemplateAdditions.shift();
|
|
12286
|
-
if (nextProcessor)
|
|
12508
|
+
if (nextProcessor)
|
|
12509
|
+
nextProcessor(newTemplate || template, listTemplateAdditions);
|
|
12287
12510
|
},
|
|
12288
12511
|
activateEditableField(e2) {
|
|
12289
12512
|
const editableField = this.element.querySelector("[data-editable]");
|
|
@@ -12291,7 +12514,10 @@ const EditableMixin = {
|
|
|
12291
12514
|
editableField.toggleAttribute("contenteditable", true);
|
|
12292
12515
|
editableField.focus();
|
|
12293
12516
|
editButton.toggleAttribute("disabled", true);
|
|
12294
|
-
editableField.addEventListener(
|
|
12517
|
+
editableField.addEventListener(
|
|
12518
|
+
"focusout",
|
|
12519
|
+
() => this.save(editableField, editButton)
|
|
12520
|
+
);
|
|
12295
12521
|
},
|
|
12296
12522
|
save(editableField, editButton) {
|
|
12297
12523
|
editableField.toggleAttribute("contenteditable", false);
|
|
@@ -12385,7 +12611,8 @@ const FormMixin = {
|
|
|
12385
12611
|
},
|
|
12386
12612
|
getValue() {
|
|
12387
12613
|
if (!this.dataHolder || this.dataHolder.length === 0) return this.value;
|
|
12388
|
-
if (this.dataHolder.length > 1)
|
|
12614
|
+
if (this.dataHolder.length > 1)
|
|
12615
|
+
this.showDataHolderError(1, this.dataHolder.length);
|
|
12389
12616
|
return this.getValueFromElement(this.dataHolder[0]);
|
|
12390
12617
|
},
|
|
12391
12618
|
get type() {
|
|
@@ -12395,7 +12622,9 @@ const FormMixin = {
|
|
|
12395
12622
|
return false;
|
|
12396
12623
|
},
|
|
12397
12624
|
get dataHolder() {
|
|
12398
|
-
const dataHolders = Array.from(
|
|
12625
|
+
const dataHolders = Array.from(
|
|
12626
|
+
this.element.querySelectorAll("[data-holder]")
|
|
12627
|
+
);
|
|
12399
12628
|
const widgetDataHolders = dataHolders.filter((element) => {
|
|
12400
12629
|
const dataHolderAncestor = element.parentElement ? element.parentElement.closest("[data-holder]") : null;
|
|
12401
12630
|
return dataHolderAncestor === this.element || !dataHolderAncestor || !this.element.contains(dataHolderAncestor);
|
|
@@ -12406,7 +12635,9 @@ const FormMixin = {
|
|
|
12406
12635
|
return element.component ? element.component.getValue() : element.value;
|
|
12407
12636
|
},
|
|
12408
12637
|
showDataHolderError(expected, found) {
|
|
12409
|
-
console.warn(
|
|
12638
|
+
console.warn(
|
|
12639
|
+
`Expected ${expected} data-holder element in ${this.element.tagName}. Found ${found}`
|
|
12640
|
+
);
|
|
12410
12641
|
}
|
|
12411
12642
|
};
|
|
12412
12643
|
const FormCheckboxMixin = {
|
|
@@ -12486,10 +12717,13 @@ const FormDropdownMixin = {
|
|
|
12486
12717
|
getValue() {
|
|
12487
12718
|
if (!this.dataHolder) return "";
|
|
12488
12719
|
if (!this.multiple) {
|
|
12489
|
-
if (this.dataHolder.length > 1)
|
|
12720
|
+
if (this.dataHolder.length > 1)
|
|
12721
|
+
this.showDataHolderError(1, this.dataHolder.length);
|
|
12490
12722
|
return this.getValueFromElement(this.dataHolder[0]);
|
|
12491
12723
|
}
|
|
12492
|
-
const options = Array.from(
|
|
12724
|
+
const options = Array.from(
|
|
12725
|
+
this.element.querySelectorAll("option")
|
|
12726
|
+
);
|
|
12493
12727
|
return options.filter((el2) => el2.selected).map((el2) => el2.value ? JSON.parse(el2.value) : null);
|
|
12494
12728
|
},
|
|
12495
12729
|
get type() {
|
|
@@ -12522,7 +12756,9 @@ const FormCheckboxesMixin = {
|
|
|
12522
12756
|
this.listAttributes["values"] = [];
|
|
12523
12757
|
},
|
|
12524
12758
|
getValue() {
|
|
12525
|
-
const options = Array.from(
|
|
12759
|
+
const options = Array.from(
|
|
12760
|
+
this.element.querySelectorAll("input")
|
|
12761
|
+
);
|
|
12526
12762
|
return options.filter((el2) => el2.checked).map((el2) => {
|
|
12527
12763
|
if (!el2.value) return null;
|
|
12528
12764
|
let value = el2.value;
|
|
@@ -12546,7 +12782,9 @@ const FormRadioMixin = {
|
|
|
12546
12782
|
this.listAttributes["id"] = uniqID();
|
|
12547
12783
|
},
|
|
12548
12784
|
getValue() {
|
|
12549
|
-
const checkedElement = this.element.querySelector(
|
|
12785
|
+
const checkedElement = this.element.querySelector(
|
|
12786
|
+
"input[type=radio]:checked"
|
|
12787
|
+
);
|
|
12550
12788
|
return checkedElement ? checkedElement.value : "";
|
|
12551
12789
|
}
|
|
12552
12790
|
};
|
|
@@ -12651,7 +12889,8 @@ const MultipleFormMixin = {
|
|
|
12651
12889
|
type: String,
|
|
12652
12890
|
default: "+",
|
|
12653
12891
|
callback: function(value) {
|
|
12654
|
-
if (value !== this.listAttributes["addLabel"])
|
|
12892
|
+
if (value !== this.listAttributes["addLabel"])
|
|
12893
|
+
this.listAttributes["addLabel"] = value;
|
|
12655
12894
|
this.planRender();
|
|
12656
12895
|
}
|
|
12657
12896
|
},
|
|
@@ -12659,7 +12898,8 @@ const MultipleFormMixin = {
|
|
|
12659
12898
|
type: String,
|
|
12660
12899
|
default: "×",
|
|
12661
12900
|
callback: function(value) {
|
|
12662
|
-
if (value !== this.listAttributes["removeLabel"])
|
|
12901
|
+
if (value !== this.listAttributes["removeLabel"])
|
|
12902
|
+
this.listAttributes["removeLabel"] = value;
|
|
12663
12903
|
this.planRender();
|
|
12664
12904
|
}
|
|
12665
12905
|
},
|
|
@@ -12671,7 +12911,8 @@ const MultipleFormMixin = {
|
|
|
12671
12911
|
type: String,
|
|
12672
12912
|
default: void 0,
|
|
12673
12913
|
callback: function(value) {
|
|
12674
|
-
if (value !== this.listAttributes["addClass"])
|
|
12914
|
+
if (value !== this.listAttributes["addClass"])
|
|
12915
|
+
this.listAttributes["addClass"] = value;
|
|
12675
12916
|
this.planRender();
|
|
12676
12917
|
}
|
|
12677
12918
|
},
|
|
@@ -12679,13 +12920,17 @@ const MultipleFormMixin = {
|
|
|
12679
12920
|
type: String,
|
|
12680
12921
|
default: void 0,
|
|
12681
12922
|
callback: function(value) {
|
|
12682
|
-
if (value !== this.listAttributes["removeClass"])
|
|
12923
|
+
if (value !== this.listAttributes["removeClass"])
|
|
12924
|
+
this.listAttributes["removeClass"] = value;
|
|
12683
12925
|
this.planRender();
|
|
12684
12926
|
}
|
|
12685
12927
|
}
|
|
12686
12928
|
},
|
|
12687
12929
|
created() {
|
|
12688
|
-
this.listValueTransformations.attach(
|
|
12930
|
+
this.listValueTransformations.attach(
|
|
12931
|
+
this.setDataSrc.bind(this),
|
|
12932
|
+
"MultipleFormMixin:setDataSrc"
|
|
12933
|
+
);
|
|
12689
12934
|
this.listAttributes["children"] = [];
|
|
12690
12935
|
this.listAttributes["addLabel"] = this.addLabel;
|
|
12691
12936
|
this.listAttributes["removeLabel"] = this.removeLabel;
|
|
@@ -12726,12 +12971,13 @@ const MultipleFormMixin = {
|
|
|
12726
12971
|
const widget = document.createElement(this.widget);
|
|
12727
12972
|
const attributes = {
|
|
12728
12973
|
"data-holder": true,
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12974
|
+
name: this.name,
|
|
12975
|
+
value,
|
|
12976
|
+
range: this.range
|
|
12732
12977
|
};
|
|
12733
12978
|
for (let name of Object.keys(attributes)) {
|
|
12734
|
-
if (typeof attributes[name] === "boolean")
|
|
12979
|
+
if (typeof attributes[name] === "boolean")
|
|
12980
|
+
widget.toggleAttribute(name, attributes[name]);
|
|
12735
12981
|
else widget.setAttribute(name, attributes[name]);
|
|
12736
12982
|
}
|
|
12737
12983
|
this.listAttributes["children"].push(widget);
|
|
@@ -12763,7 +13009,8 @@ const MultipleselectFormMixin = {
|
|
|
12763
13009
|
type: String,
|
|
12764
13010
|
default: "",
|
|
12765
13011
|
callback: function(value) {
|
|
12766
|
-
if (value && value !== this.listAttributes["range"])
|
|
13012
|
+
if (value && value !== this.listAttributes["range"])
|
|
13013
|
+
this.listAttributes["range"] = value;
|
|
12767
13014
|
}
|
|
12768
13015
|
},
|
|
12769
13016
|
enum: {
|
|
@@ -12771,7 +13018,8 @@ const MultipleselectFormMixin = {
|
|
|
12771
13018
|
type: String,
|
|
12772
13019
|
default: "",
|
|
12773
13020
|
callback: function(value) {
|
|
12774
|
-
if (value && value !== this.listAttributes["enum"])
|
|
13021
|
+
if (value && value !== this.listAttributes["enum"])
|
|
13022
|
+
this.listAttributes["enum"] = value;
|
|
12775
13023
|
}
|
|
12776
13024
|
},
|
|
12777
13025
|
orderAsc: {
|
|
@@ -12790,7 +13038,10 @@ const MultipleselectFormMixin = {
|
|
|
12790
13038
|
}
|
|
12791
13039
|
},
|
|
12792
13040
|
created() {
|
|
12793
|
-
this.listValueTransformations.attach(
|
|
13041
|
+
this.listValueTransformations.attach(
|
|
13042
|
+
this.setDataSrc.bind(this),
|
|
13043
|
+
"MultipleselectFormMixin:setDataSrc"
|
|
13044
|
+
);
|
|
12794
13045
|
},
|
|
12795
13046
|
setDataSrc(value, listValueTransformations) {
|
|
12796
13047
|
if (value && value !== this.dataSrc) {
|
|
@@ -12810,7 +13061,8 @@ const MultipleselectFormMixin = {
|
|
|
12810
13061
|
if (nextProcessor) nextProcessor(value, listValueTransformations);
|
|
12811
13062
|
},
|
|
12812
13063
|
populate() {
|
|
12813
|
-
if (!this.resource || !this.resource["ldp:contains"] && !Array.isArray(this.resource))
|
|
13064
|
+
if (!this.resource || !this.resource["ldp:contains"] && !Array.isArray(this.resource))
|
|
13065
|
+
return;
|
|
12814
13066
|
this.setValue(this.resource["ldp:contains"]);
|
|
12815
13067
|
this.planRender();
|
|
12816
13068
|
},
|
|
@@ -12863,7 +13115,10 @@ const SorterMixin = {
|
|
|
12863
13115
|
randomOrder: null
|
|
12864
13116
|
},
|
|
12865
13117
|
attached() {
|
|
12866
|
-
this.listPostProcessors.attach(
|
|
13118
|
+
this.listPostProcessors.attach(
|
|
13119
|
+
this.orderCallback.bind(this),
|
|
13120
|
+
"SorterMixin:orderCallback"
|
|
13121
|
+
);
|
|
12867
13122
|
},
|
|
12868
13123
|
created() {
|
|
12869
13124
|
this.randomOrder = [];
|
|
@@ -12904,17 +13159,20 @@ const SorterMixin = {
|
|
|
12904
13159
|
if (sortingKey) {
|
|
12905
13160
|
let orderToSort = true;
|
|
12906
13161
|
if (this.orderDesc || orderValueToSort == "desc") orderToSort = false;
|
|
12907
|
-
resources = (await Promise.all(
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
13162
|
+
resources = (await Promise.all(
|
|
13163
|
+
resources.map(async (resource) => ({
|
|
13164
|
+
sortingKey: await resource[sortingKey],
|
|
13165
|
+
// fetch sorting value
|
|
13166
|
+
proxy: resource
|
|
13167
|
+
// and keep proxy
|
|
13168
|
+
}))
|
|
13169
|
+
)).sort(this.sortValuesByKey("sortingKey", orderToSort)).map((r3) => r3.proxy);
|
|
12913
13170
|
} else if (this.isRandomSorted()) {
|
|
12914
13171
|
resources = this.shuffleResources(resources);
|
|
12915
13172
|
}
|
|
12916
13173
|
const nextProcessor = listPostProcessors.shift();
|
|
12917
|
-
if (nextProcessor)
|
|
13174
|
+
if (nextProcessor)
|
|
13175
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
12918
13176
|
},
|
|
12919
13177
|
isRandomSorted() {
|
|
12920
13178
|
return this.orderByRandom !== null;
|
|
@@ -12927,7 +13185,9 @@ const SorterMixin = {
|
|
|
12927
13185
|
const varB = b2[key];
|
|
12928
13186
|
let comparison = 0;
|
|
12929
13187
|
if (typeof varA === "string" && typeof varB === "string") {
|
|
12930
|
-
comparison = varA.localeCompare(varB, void 0, {
|
|
13188
|
+
comparison = varA.localeCompare(varB, void 0, {
|
|
13189
|
+
sensitivity: "base"
|
|
13190
|
+
});
|
|
12931
13191
|
comparison = asc ? comparison : -comparison;
|
|
12932
13192
|
} else {
|
|
12933
13193
|
if (varA > varB) comparison = asc ? 1 : -1;
|
|
@@ -12960,16 +13220,21 @@ const FederationMixin = {
|
|
|
12960
13220
|
containerFetched: null
|
|
12961
13221
|
},
|
|
12962
13222
|
attached() {
|
|
12963
|
-
this.listPostProcessors.attach(
|
|
13223
|
+
this.listPostProcessors.attach(
|
|
13224
|
+
this.fetchSources.bind(this),
|
|
13225
|
+
"FederationMixin:fetchSources"
|
|
13226
|
+
);
|
|
12964
13227
|
},
|
|
12965
13228
|
async fetchSources(resources, listPostProcessors, div2, context2) {
|
|
12966
13229
|
this.containerFetched = [];
|
|
12967
13230
|
let newResources = await this.getResources(resources);
|
|
12968
13231
|
newResources = [...new Set(newResources)];
|
|
12969
13232
|
const nextProcessor = listPostProcessors.shift();
|
|
12970
|
-
if (nextProcessor)
|
|
13233
|
+
if (nextProcessor)
|
|
13234
|
+
await nextProcessor(newResources, listPostProcessors, div2, context2);
|
|
12971
13235
|
},
|
|
12972
13236
|
async getResources(resources) {
|
|
13237
|
+
if (!resources && this.resources) resources = this.resources;
|
|
12973
13238
|
if (!resources) return [];
|
|
12974
13239
|
const newResources = [];
|
|
12975
13240
|
const getChildResources = async (res) => {
|
|
@@ -12980,7 +13245,8 @@ const FederationMixin = {
|
|
|
12980
13245
|
if (!this.containerFetched.includes(containerId)) {
|
|
12981
13246
|
this.containerFetched.push(containerId);
|
|
12982
13247
|
const resourcesFetched = await this.fetchSource(containerId);
|
|
12983
|
-
if (resourcesFetched)
|
|
13248
|
+
if (resourcesFetched)
|
|
13249
|
+
newResources.push(...await this.getResources(resourcesFetched));
|
|
12984
13250
|
}
|
|
12985
13251
|
} else {
|
|
12986
13252
|
newResources.push(res);
|
|
@@ -13001,11 +13267,7 @@ const FederationMixin = {
|
|
|
13001
13267
|
};
|
|
13002
13268
|
const RangeMixin = {
|
|
13003
13269
|
name: "range-mixin",
|
|
13004
|
-
use: [
|
|
13005
|
-
StoreMixin,
|
|
13006
|
-
SorterMixin,
|
|
13007
|
-
FederationMixin
|
|
13008
|
-
],
|
|
13270
|
+
use: [StoreMixin, SorterMixin, FederationMixin],
|
|
13009
13271
|
attributes: {
|
|
13010
13272
|
range: {
|
|
13011
13273
|
type: String,
|
|
@@ -13064,19 +13326,20 @@ const RangeMixin = {
|
|
|
13064
13326
|
async populate() {
|
|
13065
13327
|
const resources = this.resource ? this.resource["ldp:contains"] : [];
|
|
13066
13328
|
const listPostProcessorsCopy = this.listPostProcessors.deepCopy();
|
|
13067
|
-
listPostProcessorsCopy.attach(
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
resources,
|
|
13071
|
-
listPostProcessorsCopy,
|
|
13072
|
-
null,
|
|
13073
|
-
this.dataSrc
|
|
13329
|
+
listPostProcessorsCopy.attach(
|
|
13330
|
+
this.setRangeAttribute.bind(this),
|
|
13331
|
+
"RangeMixin:setRangeAttribute"
|
|
13074
13332
|
);
|
|
13333
|
+
const nextProcessor = listPostProcessorsCopy.shift();
|
|
13334
|
+
await nextProcessor(resources, listPostProcessorsCopy, null, this.dataSrc);
|
|
13075
13335
|
},
|
|
13076
13336
|
async setRangeAttribute(resources) {
|
|
13077
13337
|
if (resources) {
|
|
13078
13338
|
const getRangeValue = async (resource) => {
|
|
13079
|
-
let res = await store.getData(
|
|
13339
|
+
let res = await store.getData(
|
|
13340
|
+
resource["@id"],
|
|
13341
|
+
this.context || base_context
|
|
13342
|
+
);
|
|
13080
13343
|
if (res === null) {
|
|
13081
13344
|
res = resource;
|
|
13082
13345
|
}
|
|
@@ -13127,7 +13390,8 @@ const FilterRangeFormMixin = {
|
|
|
13127
13390
|
},
|
|
13128
13391
|
getValue() {
|
|
13129
13392
|
if (!this.dataHolder) return [];
|
|
13130
|
-
if (this.dataHolder.length !== 2)
|
|
13393
|
+
if (this.dataHolder.length !== 2)
|
|
13394
|
+
this.showDataHolderError(2, this.dataHolder.length);
|
|
13131
13395
|
return [
|
|
13132
13396
|
// we expect 2 values, one min and one max
|
|
13133
13397
|
this.getValueFromElement(this.dataHolder[0]),
|
|
@@ -13995,22 +14259,26 @@ const formTemplates = {
|
|
|
13995
14259
|
${attributes.placeholder || "-"}
|
|
13996
14260
|
</option>
|
|
13997
14261
|
` : ""}
|
|
13998
|
-
${(attributes.range || []).map(
|
|
14262
|
+
${(attributes.range || []).map(
|
|
14263
|
+
(el2) => x`
|
|
13999
14264
|
<option
|
|
14000
14265
|
value=${el2.value}
|
|
14001
14266
|
?selected=${!attributes.multiple ? value === el2.selectedValue : attributes.values.includes(el2.selectedValue)}
|
|
14002
14267
|
>
|
|
14003
14268
|
${el2.label}
|
|
14004
14269
|
</option>
|
|
14005
|
-
`
|
|
14006
|
-
|
|
14270
|
+
`
|
|
14271
|
+
)}
|
|
14272
|
+
${Object.entries(attributes.enum || []).map(
|
|
14273
|
+
([key, val]) => x`
|
|
14007
14274
|
<option
|
|
14008
14275
|
value="${key}"
|
|
14009
14276
|
?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}
|
|
14010
14277
|
>
|
|
14011
14278
|
${val}
|
|
14012
14279
|
</option>
|
|
14013
|
-
`
|
|
14280
|
+
`
|
|
14281
|
+
)}
|
|
14014
14282
|
</select>
|
|
14015
14283
|
`,
|
|
14016
14284
|
dependencies: [FormDropdownMixin, FormMixin, RangeMixin]
|
|
@@ -14020,7 +14288,8 @@ const formTemplates = {
|
|
|
14020
14288
|
<div
|
|
14021
14289
|
name=${o$2(attributes.name)}
|
|
14022
14290
|
>
|
|
14023
|
-
${(attributes.range || []).map(
|
|
14291
|
+
${(attributes.range || []).map(
|
|
14292
|
+
(el2) => x`
|
|
14024
14293
|
<label>
|
|
14025
14294
|
<input
|
|
14026
14295
|
type="radio"
|
|
@@ -14030,8 +14299,10 @@ const formTemplates = {
|
|
|
14030
14299
|
?checked=${value === el2.selectedValue}
|
|
14031
14300
|
> <span>${el2.label}</span>
|
|
14032
14301
|
</label>
|
|
14033
|
-
`
|
|
14034
|
-
|
|
14302
|
+
`
|
|
14303
|
+
)}
|
|
14304
|
+
${Object.entries(attributes.enum || []).map(
|
|
14305
|
+
([key, val]) => x`
|
|
14035
14306
|
<label>
|
|
14036
14307
|
<input
|
|
14037
14308
|
type="radio"
|
|
@@ -14041,7 +14312,8 @@ const formTemplates = {
|
|
|
14041
14312
|
?checked=${value === key}
|
|
14042
14313
|
> <span>${val}</span>
|
|
14043
14314
|
</label>
|
|
14044
|
-
`
|
|
14315
|
+
`
|
|
14316
|
+
)}
|
|
14045
14317
|
`,
|
|
14046
14318
|
dependencies: [FormRadioMixin, FormMixin, RangeMixin]
|
|
14047
14319
|
},
|
|
@@ -14050,7 +14322,8 @@ const formTemplates = {
|
|
|
14050
14322
|
<div
|
|
14051
14323
|
name=${o$2(attributes.name)}
|
|
14052
14324
|
>
|
|
14053
|
-
${(attributes.range || []).map(
|
|
14325
|
+
${(attributes.range || []).map(
|
|
14326
|
+
(el2) => x`
|
|
14054
14327
|
<label>
|
|
14055
14328
|
<input
|
|
14056
14329
|
type="checkbox"
|
|
@@ -14058,14 +14331,17 @@ const formTemplates = {
|
|
|
14058
14331
|
?checked=${attributes.values.includes(el2.selectedValue)}
|
|
14059
14332
|
/> <span>${el2.label}</span>
|
|
14060
14333
|
</label>
|
|
14061
|
-
`
|
|
14062
|
-
|
|
14334
|
+
`
|
|
14335
|
+
)}
|
|
14336
|
+
${Object.entries(attributes.enum || []).map(
|
|
14337
|
+
([key, val]) => x`
|
|
14063
14338
|
<label>
|
|
14064
14339
|
<input type="checkbox"
|
|
14065
14340
|
value="${key}"
|
|
14066
14341
|
/> <span>${val}</span>
|
|
14067
14342
|
</label>
|
|
14068
|
-
`
|
|
14343
|
+
`
|
|
14344
|
+
)}
|
|
14069
14345
|
</select>
|
|
14070
14346
|
`,
|
|
14071
14347
|
dependencies: [FormCheckboxesMixin, FormMixin, RangeMixin]
|
|
@@ -14089,12 +14365,14 @@ const formTemplates = {
|
|
|
14089
14365
|
},
|
|
14090
14366
|
multiple: {
|
|
14091
14367
|
template: (_value, attributes) => x`
|
|
14092
|
-
${(attributes.children || []).map(
|
|
14368
|
+
${(attributes.children || []).map(
|
|
14369
|
+
(child, index2) => x`
|
|
14093
14370
|
<div data-index=${attributes.name + index2}>
|
|
14094
14371
|
${child}
|
|
14095
14372
|
<button type="button" class=${o$2(attributes.removeClass)} @click=${() => attributes.removeItem(index2)}>${attributes.removeLabel}</button>
|
|
14096
14373
|
</div>
|
|
14097
|
-
`
|
|
14374
|
+
`
|
|
14375
|
+
)}
|
|
14098
14376
|
<button type="button" class=${o$2(attributes.addClass)} @click=${attributes.addItem}>${attributes.addLabel}</button>
|
|
14099
14377
|
`,
|
|
14100
14378
|
dependencies: [MultipleFormMixin, FormMixin]
|
|
@@ -14297,7 +14575,10 @@ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
14297
14575
|
const DateMixin = {
|
|
14298
14576
|
name: "date-mixin",
|
|
14299
14577
|
created() {
|
|
14300
|
-
this.listValueTransformations.attach(
|
|
14578
|
+
this.listValueTransformations.attach(
|
|
14579
|
+
this.transformValue.bind(this),
|
|
14580
|
+
"DateMixin:transformValue"
|
|
14581
|
+
);
|
|
14301
14582
|
},
|
|
14302
14583
|
transformValue(value, listValueTransformations) {
|
|
14303
14584
|
try {
|
|
@@ -14324,7 +14605,10 @@ const DateMixin = {
|
|
|
14324
14605
|
const DateTimeMixin = {
|
|
14325
14606
|
name: "date-time-mixin",
|
|
14326
14607
|
created() {
|
|
14327
|
-
this.listValueTransformations.attach(
|
|
14608
|
+
this.listValueTransformations.attach(
|
|
14609
|
+
this.transformValue.bind(this),
|
|
14610
|
+
"DateTimeMixin:transformValue"
|
|
14611
|
+
);
|
|
14328
14612
|
},
|
|
14329
14613
|
transformValue(value, listValueTransformations) {
|
|
14330
14614
|
const newValue = value ? new Date(value).toLocaleString() : value;
|
|
@@ -14356,7 +14640,10 @@ const o$1 = e$1(e);
|
|
|
14356
14640
|
const MultilineMixin = {
|
|
14357
14641
|
name: "multiline-mixin",
|
|
14358
14642
|
created() {
|
|
14359
|
-
this.listValueTransformations.attach(
|
|
14643
|
+
this.listValueTransformations.attach(
|
|
14644
|
+
this.transformValue.bind(this),
|
|
14645
|
+
"MultilineMixin:transformValue"
|
|
14646
|
+
);
|
|
14360
14647
|
},
|
|
14361
14648
|
transformValue(value, listValueTransformations) {
|
|
14362
14649
|
const newValue = value ? o$1(value.replace(/\n/g, "<br/>")) : value;
|
|
@@ -19583,7 +19870,10 @@ const mila = /* @__PURE__ */ getDefaultExportFromCjs(markdownItLinkAttributes);
|
|
|
19583
19870
|
const MarkdownMixin = {
|
|
19584
19871
|
name: "markdown-mixin",
|
|
19585
19872
|
created() {
|
|
19586
|
-
this.listValueTransformations.attach(
|
|
19873
|
+
this.listValueTransformations.attach(
|
|
19874
|
+
this.transformValue.bind(this),
|
|
19875
|
+
"MarkdownMixin:transformValue"
|
|
19876
|
+
);
|
|
19587
19877
|
},
|
|
19588
19878
|
transformValue(value, listValueTransformations) {
|
|
19589
19879
|
let newValue = "";
|
|
@@ -19612,7 +19902,10 @@ const OembedMixin = {
|
|
|
19612
19902
|
existingOembed: null
|
|
19613
19903
|
},
|
|
19614
19904
|
created() {
|
|
19615
|
-
this.listValueTransformations.attach(
|
|
19905
|
+
this.listValueTransformations.attach(
|
|
19906
|
+
this.transformValue.bind(this),
|
|
19907
|
+
"OembedMixin:transformValue"
|
|
19908
|
+
);
|
|
19616
19909
|
},
|
|
19617
19910
|
async transformValue(value, listValueTransformations) {
|
|
19618
19911
|
if (!value) return;
|
|
@@ -21867,13 +22160,17 @@ function normalizeTruncateCfg(truncate) {
|
|
|
21867
22160
|
const AutolinkMixin = {
|
|
21868
22161
|
name: "autolink-mixin",
|
|
21869
22162
|
created() {
|
|
21870
|
-
this.listValueTransformations.attach(
|
|
22163
|
+
this.listValueTransformations.attach(
|
|
22164
|
+
this.transformValue.bind(this),
|
|
22165
|
+
"AutolinkMixin:transformValue"
|
|
22166
|
+
);
|
|
21871
22167
|
},
|
|
21872
22168
|
transformValue(value, listValueTransformations) {
|
|
21873
22169
|
const template = document.createElement("template");
|
|
21874
22170
|
template.innerHTML = Autolinker.link(value);
|
|
21875
22171
|
const nextProcessor = listValueTransformations.shift();
|
|
21876
|
-
if (nextProcessor)
|
|
22172
|
+
if (nextProcessor)
|
|
22173
|
+
nextProcessor(template.content, listValueTransformations);
|
|
21877
22174
|
}
|
|
21878
22175
|
};
|
|
21879
22176
|
const valueTransformationDirectory = {
|
|
@@ -21888,7 +22185,10 @@ const LabelMixin = {
|
|
|
21888
22185
|
name: "label-mixin",
|
|
21889
22186
|
created() {
|
|
21890
22187
|
this.listAttributes["id"] = uniqID();
|
|
21891
|
-
this.listTemplateAdditions.attach(
|
|
22188
|
+
this.listTemplateAdditions.attach(
|
|
22189
|
+
this.addLabel.bind(this),
|
|
22190
|
+
"LabelMixin:addLabel"
|
|
22191
|
+
);
|
|
21892
22192
|
},
|
|
21893
22193
|
addLabel(template, listTemplateAdditions) {
|
|
21894
22194
|
const newTemplate = x`<label for="${this.listAttributes["id"]}">${this.label || this.name}</label>${template}`;
|
|
@@ -21899,7 +22199,10 @@ const LabelMixin = {
|
|
|
21899
22199
|
const LabelLastMixin = {
|
|
21900
22200
|
name: "label-last-mixin",
|
|
21901
22201
|
created() {
|
|
21902
|
-
this.listTemplateAdditions.attach(
|
|
22202
|
+
this.listTemplateAdditions.attach(
|
|
22203
|
+
this.addLabelLast.bind(this),
|
|
22204
|
+
"LabelLastMixin:addLabelLast"
|
|
22205
|
+
);
|
|
21903
22206
|
},
|
|
21904
22207
|
addLabelLast(template, listTemplateAdditions) {
|
|
21905
22208
|
const newTemplate = x`${template}<label>${this.label || this.name}</label>`;
|
|
@@ -21910,13 +22213,20 @@ const LabelLastMixin = {
|
|
|
21910
22213
|
const AddableMixin = {
|
|
21911
22214
|
name: "addable-mixin",
|
|
21912
22215
|
created() {
|
|
21913
|
-
this.listTemplateAdditions.attach(
|
|
22216
|
+
this.listTemplateAdditions.attach(
|
|
22217
|
+
this.addableValue.bind(this),
|
|
22218
|
+
"AddableMixin:addableValue"
|
|
22219
|
+
);
|
|
21914
22220
|
},
|
|
21915
22221
|
getAddableAttributes() {
|
|
21916
|
-
const addableAttr = Array.from(this.element.attributes).filter(
|
|
22222
|
+
const addableAttr = Array.from(this.element.attributes).filter(
|
|
22223
|
+
(a2) => a2.name.startsWith("addable-")
|
|
22224
|
+
);
|
|
21917
22225
|
const cleanAddableAttr = {};
|
|
21918
|
-
for (let attr of addableAttr)
|
|
21919
|
-
|
|
22226
|
+
for (let attr of addableAttr)
|
|
22227
|
+
cleanAddableAttr[attr.name.replace("addable-", "")] = attr.value;
|
|
22228
|
+
if (!cleanAddableAttr.hasOwnProperty("data-src"))
|
|
22229
|
+
cleanAddableAttr["data-src"] = this.range;
|
|
21920
22230
|
return cleanAddableAttr;
|
|
21921
22231
|
},
|
|
21922
22232
|
addableValue(template, listTemplateAdditions, attributes) {
|
|
@@ -22473,7 +22783,7 @@ var slimselect = { exports: {} };
|
|
|
22473
22783
|
}
|
|
22474
22784
|
}
|
|
22475
22785
|
}
|
|
22476
|
-
if (this.settings.contentPosition === "relative") {
|
|
22786
|
+
if (this.settings.contentPosition === "relative" || this.settings.contentPosition === "fixed") {
|
|
22477
22787
|
this.content.main.classList.add("ss-" + this.settings.contentPosition);
|
|
22478
22788
|
}
|
|
22479
22789
|
}
|
|
@@ -22512,6 +22822,9 @@ var slimselect = { exports: {} };
|
|
|
22512
22822
|
this.callbacks.close();
|
|
22513
22823
|
return false;
|
|
22514
22824
|
}
|
|
22825
|
+
if (e2.key.length === 1) {
|
|
22826
|
+
this.callbacks.open();
|
|
22827
|
+
}
|
|
22515
22828
|
return true;
|
|
22516
22829
|
};
|
|
22517
22830
|
main.onclick = (e2) => {
|
|
@@ -23169,7 +23482,6 @@ var slimselect = { exports: {} };
|
|
|
23169
23482
|
}
|
|
23170
23483
|
const optionEl = document.createElement("div");
|
|
23171
23484
|
optionEl.dataset.id = option.id;
|
|
23172
|
-
optionEl.id = option.id;
|
|
23173
23485
|
optionEl.classList.add(this.classes.option);
|
|
23174
23486
|
optionEl.setAttribute("role", "option");
|
|
23175
23487
|
if (option.class) {
|
|
@@ -23286,8 +23598,8 @@ var slimselect = { exports: {} };
|
|
|
23286
23598
|
this.content.main.classList.add(this.classes.openAbove);
|
|
23287
23599
|
const containerRect = this.main.main.getBoundingClientRect();
|
|
23288
23600
|
this.content.main.style.margin = "-" + (mainHeight + contentHeight - 1) + "px 0px 0px 0px";
|
|
23289
|
-
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + "px";
|
|
23290
|
-
this.content.main.style.left = containerRect.left + window.scrollX + "px";
|
|
23601
|
+
this.content.main.style.top = containerRect.top + containerRect.height + (this.settings.contentPosition === "fixed" ? 0 : window.scrollY) + "px";
|
|
23602
|
+
this.content.main.style.left = containerRect.left + (this.settings.contentPosition === "fixed" ? 0 : window.scrollX) + "px";
|
|
23291
23603
|
this.content.main.style.width = containerRect.width + "px";
|
|
23292
23604
|
}
|
|
23293
23605
|
moveContentBelow() {
|
|
@@ -23298,8 +23610,8 @@ var slimselect = { exports: {} };
|
|
|
23298
23610
|
const containerRect = this.main.main.getBoundingClientRect();
|
|
23299
23611
|
this.content.main.style.margin = "-1px 0px 0px 0px";
|
|
23300
23612
|
if (this.settings.contentPosition !== "relative") {
|
|
23301
|
-
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + "px";
|
|
23302
|
-
this.content.main.style.left = containerRect.left + window.scrollX + "px";
|
|
23613
|
+
this.content.main.style.top = containerRect.top + containerRect.height + (this.settings.contentPosition === "fixed" ? 0 : window.scrollY) + "px";
|
|
23614
|
+
this.content.main.style.left = containerRect.left + (this.settings.contentPosition === "fixed" ? 0 : window.scrollX) + "px";
|
|
23303
23615
|
this.content.main.style.width = containerRect.width + "px";
|
|
23304
23616
|
}
|
|
23305
23617
|
}
|
|
@@ -24018,7 +24330,9 @@ const TranslationMixin = {
|
|
|
24018
24330
|
fr: () => import("./fr-ClQZ5-J-.js")
|
|
24019
24331
|
};
|
|
24020
24332
|
if (!translationsModules[langCode]) {
|
|
24021
|
-
console.warn(
|
|
24333
|
+
console.warn(
|
|
24334
|
+
`${langCode}.json translation file may not exist, English is setted by default`
|
|
24335
|
+
);
|
|
24022
24336
|
langCode = "en";
|
|
24023
24337
|
}
|
|
24024
24338
|
const module2 = await translationsModules[langCode]();
|
|
@@ -24074,11 +24388,20 @@ const AutocompletionMixin = {
|
|
|
24074
24388
|
mutationObserver: null
|
|
24075
24389
|
},
|
|
24076
24390
|
created() {
|
|
24077
|
-
importInlineCSS(
|
|
24078
|
-
|
|
24391
|
+
importInlineCSS(
|
|
24392
|
+
"slimselect-base",
|
|
24393
|
+
() => import("./slimselect-CT2Oyr_0.js")
|
|
24394
|
+
);
|
|
24395
|
+
importInlineCSS(
|
|
24396
|
+
"slimselect-local",
|
|
24397
|
+
() => import("./slimselect-WIZK5Hmq.js")
|
|
24398
|
+
);
|
|
24079
24399
|
this.slimSelect = null;
|
|
24080
24400
|
this.addToAttributes(true, "autocomplete");
|
|
24081
|
-
this.listCallbacks.attach(
|
|
24401
|
+
this.listCallbacks.attach(
|
|
24402
|
+
this.addCallback.bind(this),
|
|
24403
|
+
"AutocompletionMixin:addCallback"
|
|
24404
|
+
);
|
|
24082
24405
|
},
|
|
24083
24406
|
detached() {
|
|
24084
24407
|
if (this.slimSelect) this.slimSelect.destroy();
|
|
@@ -48117,7 +48440,10 @@ const RichtextMixin = {
|
|
|
48117
48440
|
created() {
|
|
48118
48441
|
importInlineCSS("quill", () => import("./quill.snow-B73wIbzm.js"));
|
|
48119
48442
|
this.quill = null;
|
|
48120
|
-
this.listCallbacks.attach(
|
|
48443
|
+
this.listCallbacks.attach(
|
|
48444
|
+
this.addCallback.bind(this),
|
|
48445
|
+
"RichtextMixin:addCallback"
|
|
48446
|
+
);
|
|
48121
48447
|
},
|
|
48122
48448
|
getPlaceHolderValue() {
|
|
48123
48449
|
return this.element.hasAttribute("placeholder") ? this.element.getAttribute("placeholder") : "";
|
|
@@ -48127,20 +48453,19 @@ const RichtextMixin = {
|
|
|
48127
48453
|
var toolbarOptions = [
|
|
48128
48454
|
["bold", "italic"],
|
|
48129
48455
|
["blockquote"],
|
|
48130
|
-
[{
|
|
48131
|
-
[{
|
|
48456
|
+
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
|
48457
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
48132
48458
|
["link"],
|
|
48133
48459
|
["clean"]
|
|
48134
48460
|
];
|
|
48135
|
-
const richtext = this.element.querySelector(
|
|
48136
|
-
|
|
48137
|
-
richtext,
|
|
48138
|
-
{
|
|
48139
|
-
modules: { toolbar: toolbarOptions },
|
|
48140
|
-
placeholder: this.getPlaceHolderValue(),
|
|
48141
|
-
theme: "snow"
|
|
48142
|
-
}
|
|
48461
|
+
const richtext = this.element.querySelector(
|
|
48462
|
+
"[data-richtext]"
|
|
48143
48463
|
);
|
|
48464
|
+
this.quill = new Quill(richtext, {
|
|
48465
|
+
modules: { toolbar: toolbarOptions },
|
|
48466
|
+
placeholder: this.getPlaceHolderValue(),
|
|
48467
|
+
theme: "snow"
|
|
48468
|
+
});
|
|
48144
48469
|
}
|
|
48145
48470
|
const ops = deltaMd.toDelta(this.value);
|
|
48146
48471
|
this.quill.setContents(ops);
|
|
@@ -48152,11 +48477,15 @@ const RichtextMixin = {
|
|
|
48152
48477
|
if (nextProcessor) nextProcessor(value, listCallbacks);
|
|
48153
48478
|
},
|
|
48154
48479
|
isRequired() {
|
|
48155
|
-
return Array.from(this.element.attributes).some(
|
|
48480
|
+
return Array.from(this.element.attributes).some(
|
|
48481
|
+
(attr) => attr.name === "required"
|
|
48482
|
+
);
|
|
48156
48483
|
},
|
|
48157
48484
|
createHiddenRequiredInput() {
|
|
48158
48485
|
const attributeName = this.getAttributeValue("name");
|
|
48159
|
-
this.hiddenInput = document.querySelector(
|
|
48486
|
+
this.hiddenInput = document.querySelector(
|
|
48487
|
+
`input[name="${attributeName + "-hidden"}"]`
|
|
48488
|
+
);
|
|
48160
48489
|
if (!this.hiddenInput) {
|
|
48161
48490
|
this.hiddenInput = this.createHiddenInput(attributeName + "-hidden");
|
|
48162
48491
|
this.element.appendChild(this.hiddenInput);
|
|
@@ -48174,13 +48503,17 @@ const RichtextMixin = {
|
|
|
48174
48503
|
return input;
|
|
48175
48504
|
},
|
|
48176
48505
|
getAttributeValue(attributeName) {
|
|
48177
|
-
const attribute2 = Array.from(this.element.attributes).find(
|
|
48506
|
+
const attribute2 = Array.from(this.element.attributes).find(
|
|
48507
|
+
(attr) => attr.name === attributeName
|
|
48508
|
+
);
|
|
48178
48509
|
return attribute2 ? attribute2.value : "";
|
|
48179
48510
|
},
|
|
48180
48511
|
displayCustomErrorMessage(message) {
|
|
48181
48512
|
const richtext = this.element.querySelector("[data-richtext]");
|
|
48182
48513
|
if (richtext) {
|
|
48183
|
-
let errorMessageElement = richtext.querySelector(
|
|
48514
|
+
let errorMessageElement = richtext.querySelector(
|
|
48515
|
+
".required-error-message"
|
|
48516
|
+
);
|
|
48184
48517
|
if (!errorMessageElement) {
|
|
48185
48518
|
errorMessageElement = document.createElement("div");
|
|
48186
48519
|
errorMessageElement.className = "required-error-message";
|
|
@@ -48202,9 +48535,10 @@ const RichtextMixin = {
|
|
|
48202
48535
|
},
|
|
48203
48536
|
removeErrorMessageAndStyling() {
|
|
48204
48537
|
const richtext = this.element.querySelector("[data-richtext]");
|
|
48205
|
-
let errorMessageElement = richtext.querySelector(
|
|
48206
|
-
|
|
48207
|
-
|
|
48538
|
+
let errorMessageElement = richtext.querySelector(
|
|
48539
|
+
".required-error-message"
|
|
48540
|
+
);
|
|
48541
|
+
if (errorMessageElement) errorMessageElement.remove();
|
|
48208
48542
|
richtext.classList.remove("error-border-richtext");
|
|
48209
48543
|
}
|
|
48210
48544
|
};
|
|
@@ -48314,7 +48648,8 @@ const WidgetMixin = {
|
|
|
48314
48648
|
this.nameWidgets = [];
|
|
48315
48649
|
},
|
|
48316
48650
|
attached() {
|
|
48317
|
-
if (!this.dataSrc && !this.resource && this.noRender === null)
|
|
48651
|
+
if (!this.dataSrc && !this.resource && this.noRender === null)
|
|
48652
|
+
this.populate();
|
|
48318
48653
|
},
|
|
48319
48654
|
get parentElement() {
|
|
48320
48655
|
return "div";
|
|
@@ -48329,7 +48664,9 @@ const WidgetMixin = {
|
|
|
48329
48664
|
this._div = value;
|
|
48330
48665
|
},
|
|
48331
48666
|
get widgets() {
|
|
48332
|
-
return this.nameWidgets.map(
|
|
48667
|
+
return this.nameWidgets.map(
|
|
48668
|
+
(name) => this.element.querySelector(`[name="${name}"]`)
|
|
48669
|
+
);
|
|
48333
48670
|
},
|
|
48334
48671
|
/**
|
|
48335
48672
|
* Return field list of the component
|
|
@@ -48351,7 +48688,8 @@ const WidgetMixin = {
|
|
|
48351
48688
|
break;
|
|
48352
48689
|
}
|
|
48353
48690
|
}
|
|
48354
|
-
if (!this.dataSrc)
|
|
48691
|
+
if (!this.dataSrc)
|
|
48692
|
+
console.error(new Error('You must provide a "fields" attribute'));
|
|
48355
48693
|
if (!resource) return [];
|
|
48356
48694
|
let fields = [];
|
|
48357
48695
|
for (const prop2 of resource.properties) {
|
|
@@ -48392,7 +48730,10 @@ const WidgetMixin = {
|
|
|
48392
48730
|
const setString = this.fields.match(this.getSetRegexp(field));
|
|
48393
48731
|
if (!setString) return [];
|
|
48394
48732
|
const firstSetBracket = this.fields.indexOf(setString[0]) + setString[0].length - 1;
|
|
48395
|
-
const lastSetBracket = findClosingBracketMatchIndex(
|
|
48733
|
+
const lastSetBracket = findClosingBracketMatchIndex(
|
|
48734
|
+
this.fields,
|
|
48735
|
+
firstSetBracket
|
|
48736
|
+
);
|
|
48396
48737
|
const set2 = this.fields.substring(firstSetBracket + 1, lastSetBracket);
|
|
48397
48738
|
return parseFieldsString(set2);
|
|
48398
48739
|
},
|
|
@@ -48430,10 +48771,14 @@ const WidgetMixin = {
|
|
|
48430
48771
|
if (resource && !((_a3 = resource.isContainer) == null ? void 0 : _a3.call(resource))) {
|
|
48431
48772
|
let fieldValue = await resource[field];
|
|
48432
48773
|
if (fieldValue === null || fieldValue === void 0 || fieldValue === "") {
|
|
48433
|
-
let expandedPredicate = sibStore.getExpandedPredicate(
|
|
48774
|
+
let expandedPredicate = sibStore.getExpandedPredicate(
|
|
48775
|
+
field,
|
|
48776
|
+
this.context
|
|
48777
|
+
);
|
|
48434
48778
|
fieldValue = await resource[expandedPredicate];
|
|
48435
48779
|
}
|
|
48436
|
-
if (fieldValue === null || fieldValue === void 0 || fieldValue === "")
|
|
48780
|
+
if (fieldValue === null || fieldValue === void 0 || fieldValue === "")
|
|
48781
|
+
return void 0;
|
|
48437
48782
|
if (Array.isArray(fieldValue) && !fieldValue["ldp:contains"]) {
|
|
48438
48783
|
return JSON.stringify(fieldValue);
|
|
48439
48784
|
} else if (typeof fieldValue === "object" && fieldValue["@id"] && 1 === Object.keys(fieldValue).length) {
|
|
@@ -48472,7 +48817,8 @@ const WidgetMixin = {
|
|
|
48472
48817
|
widgetFromTagName(tagName) {
|
|
48473
48818
|
let type = tagName.startsWith("solid") ? WidgetType.CUSTOM : WidgetType.USER;
|
|
48474
48819
|
if (!customElements.get(tagName)) {
|
|
48475
|
-
if (tagName.startsWith("solid"))
|
|
48820
|
+
if (tagName.startsWith("solid"))
|
|
48821
|
+
newWidgetFactory(tagName);
|
|
48476
48822
|
else type = WidgetType.NATIVE;
|
|
48477
48823
|
}
|
|
48478
48824
|
return { tagName, type };
|
|
@@ -48530,7 +48876,8 @@ const WidgetMixin = {
|
|
|
48530
48876
|
"add-class",
|
|
48531
48877
|
"remove-class"
|
|
48532
48878
|
];
|
|
48533
|
-
for (let attr of multipleAttributes)
|
|
48879
|
+
for (let attr of multipleAttributes)
|
|
48880
|
+
this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs2);
|
|
48534
48881
|
const defaultAttributes = [
|
|
48535
48882
|
"range",
|
|
48536
48883
|
"enum",
|
|
@@ -48538,6 +48885,7 @@ const WidgetMixin = {
|
|
|
48538
48885
|
"placeholder",
|
|
48539
48886
|
"class",
|
|
48540
48887
|
,
|
|
48888
|
+
/* 'widget', */
|
|
48541
48889
|
"required",
|
|
48542
48890
|
"editable",
|
|
48543
48891
|
"autocomplete",
|
|
@@ -48565,13 +48913,22 @@ const WidgetMixin = {
|
|
|
48565
48913
|
"target-src",
|
|
48566
48914
|
"data-label"
|
|
48567
48915
|
];
|
|
48568
|
-
for (let attr of defaultAttributes)
|
|
48916
|
+
for (let attr of defaultAttributes)
|
|
48917
|
+
this.addToAttributes(`${attr}-${escapedField}`, attr, attrs2);
|
|
48569
48918
|
const addableAttributes = Array.from(this.element.attributes).filter((a2) => a2.name.startsWith(`addable-${escapedField}`));
|
|
48570
|
-
for (let attr of addableAttributes)
|
|
48919
|
+
for (let attr of addableAttributes)
|
|
48920
|
+
this.addToAttributes(
|
|
48921
|
+
attr.name,
|
|
48922
|
+
attr.name.replace(`addable-${escapedField}`, "addable"),
|
|
48923
|
+
attrs2
|
|
48924
|
+
);
|
|
48571
48925
|
const resourceId = resource ? resource["@id"] : null;
|
|
48572
|
-
if (this.multiple(escapedField))
|
|
48573
|
-
|
|
48574
|
-
if (this.
|
|
48926
|
+
if (this.multiple(escapedField))
|
|
48927
|
+
attrs2["widget"] = this.getWidget(escapedField).tagName;
|
|
48928
|
+
if (this.getAction(escapedField) && resourceId)
|
|
48929
|
+
attrs2["src"] = this.element.getAttribute("src-" + escapedField) || resourceId;
|
|
48930
|
+
if (this.editable(escapedField) && resourceId)
|
|
48931
|
+
attrs2["value-id"] = resourceId;
|
|
48575
48932
|
return attrs2;
|
|
48576
48933
|
},
|
|
48577
48934
|
/**
|
|
@@ -48610,7 +48967,11 @@ const WidgetMixin = {
|
|
|
48610
48967
|
attributes["value"] = value;
|
|
48611
48968
|
}
|
|
48612
48969
|
if (value && value["@id"]) attributes["auto-subscribe"] = value["@id"];
|
|
48613
|
-
if (transformAttributes)
|
|
48970
|
+
if (transformAttributes)
|
|
48971
|
+
attributes = await this.transformAttributes(
|
|
48972
|
+
attributes,
|
|
48973
|
+
currentResource
|
|
48974
|
+
);
|
|
48614
48975
|
widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
|
|
48615
48976
|
}
|
|
48616
48977
|
this.nameWidgets.push(field);
|
|
@@ -48628,12 +48989,12 @@ const WidgetMixin = {
|
|
|
48628
48989
|
async createSet(field) {
|
|
48629
48990
|
const setWidget = this.getWidget(field, true);
|
|
48630
48991
|
const attrs2 = { name: field };
|
|
48631
|
-
const setAttributes = [
|
|
48632
|
-
|
|
48633
|
-
|
|
48634
|
-
|
|
48635
|
-
|
|
48636
|
-
|
|
48992
|
+
const setAttributes = ["class", "label"];
|
|
48993
|
+
for (let attr of setAttributes)
|
|
48994
|
+
this.addToAttributes(`${attr}-${field}`, attr, attrs2);
|
|
48995
|
+
let widget = this.element.querySelector(
|
|
48996
|
+
`${setWidget.tagName}[name="${field}"]`
|
|
48997
|
+
);
|
|
48637
48998
|
let initializing = false;
|
|
48638
48999
|
if (!widget) {
|
|
48639
49000
|
widget = document.createElement(setWidget.tagName);
|
|
@@ -48661,7 +49022,14 @@ const WidgetMixin = {
|
|
|
48661
49022
|
return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
|
|
48662
49023
|
}
|
|
48663
49024
|
}
|
|
48664
|
-
|
|
49025
|
+
if (!setFields.length) {
|
|
49026
|
+
console.warn(
|
|
49027
|
+
`Set with name ${field} has not been generated due to being empty`
|
|
49028
|
+
);
|
|
49029
|
+
}
|
|
49030
|
+
const widgetsTemplate = await Promise.all(
|
|
49031
|
+
setFields.map((field2) => this.createWidgetTemplate(field2))
|
|
49032
|
+
);
|
|
48665
49033
|
const template = x`${widgetsTemplate}`;
|
|
48666
49034
|
B(template, widget.querySelector("[data-content]") || widget);
|
|
48667
49035
|
return widget;
|
|
@@ -48727,8 +49095,14 @@ const ListMixin = {
|
|
|
48727
49095
|
if ((_d = (_c = this.resource).isContainer) == null ? void 0 : _d.call(_c)) {
|
|
48728
49096
|
this.setElementAttribute("container");
|
|
48729
49097
|
this.renderCallbacks = [];
|
|
48730
|
-
listPostProcessorsCopy.attach(
|
|
48731
|
-
|
|
49098
|
+
listPostProcessorsCopy.attach(
|
|
49099
|
+
this.renderDOM.bind(this),
|
|
49100
|
+
"ListMixin:renderDOM"
|
|
49101
|
+
);
|
|
49102
|
+
listPostProcessorsCopy.attach(
|
|
49103
|
+
this.handleEmptyWidget.bind(this),
|
|
49104
|
+
"ListMixin:handleEmptyWidget"
|
|
49105
|
+
);
|
|
48732
49106
|
const nextProcessor = listPostProcessorsCopy.shift();
|
|
48733
49107
|
await nextProcessor(
|
|
48734
49108
|
this.resource["ldp:contains"],
|
|
@@ -48739,8 +49113,14 @@ const ListMixin = {
|
|
|
48739
49113
|
} else if (this.arrayField && this.predicateName && this.resource[this.predicateName]) {
|
|
48740
49114
|
this.setElementAttribute("container");
|
|
48741
49115
|
this.renderCallbacks = [];
|
|
48742
|
-
listPostProcessorsCopy.attach(
|
|
48743
|
-
|
|
49116
|
+
listPostProcessorsCopy.attach(
|
|
49117
|
+
this.renderDOM.bind(this),
|
|
49118
|
+
"ListMixin:renderDOM"
|
|
49119
|
+
);
|
|
49120
|
+
listPostProcessorsCopy.attach(
|
|
49121
|
+
this.handleEmptyWidget.bind(this),
|
|
49122
|
+
"ListMixin:handleEmptyWidget"
|
|
49123
|
+
);
|
|
48744
49124
|
const nextProcessor = listPostProcessorsCopy.shift();
|
|
48745
49125
|
await nextProcessor(
|
|
48746
49126
|
await this.resource[this.predicateName],
|
|
@@ -48767,12 +49147,7 @@ const ListMixin = {
|
|
|
48767
49147
|
}
|
|
48768
49148
|
const nextProcessor = listPostProcessors.shift();
|
|
48769
49149
|
if (nextProcessor)
|
|
48770
|
-
await nextProcessor(
|
|
48771
|
-
resources,
|
|
48772
|
-
listPostProcessors,
|
|
48773
|
-
div2,
|
|
48774
|
-
context2
|
|
48775
|
-
);
|
|
49150
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
48776
49151
|
},
|
|
48777
49152
|
/**
|
|
48778
49153
|
* Show empty widget if no resources in the list
|
|
@@ -48788,16 +49163,14 @@ const ListMixin = {
|
|
|
48788
49163
|
this.emptyWrapper = document.createElement("span");
|
|
48789
49164
|
this.element.appendChild(this.emptyWrapper);
|
|
48790
49165
|
}
|
|
48791
|
-
B(
|
|
49166
|
+
B(
|
|
49167
|
+
resources.length > 0 ? x`` : emptyWidgetTemplate,
|
|
49168
|
+
this.emptyWrapper
|
|
49169
|
+
);
|
|
48792
49170
|
}
|
|
48793
49171
|
const nextProcessor = listPostProcessors.shift();
|
|
48794
49172
|
if (nextProcessor)
|
|
48795
|
-
await nextProcessor(
|
|
48796
|
-
resources,
|
|
48797
|
-
listPostProcessors,
|
|
48798
|
-
div2,
|
|
48799
|
-
context2
|
|
48800
|
-
);
|
|
49173
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
48801
49174
|
}
|
|
48802
49175
|
};
|
|
48803
49176
|
const PaginateMixin = {
|
|
@@ -48820,21 +49193,32 @@ const PaginateMixin = {
|
|
|
48820
49193
|
this.currentPage = [];
|
|
48821
49194
|
},
|
|
48822
49195
|
attached() {
|
|
48823
|
-
this.listPostProcessors.attach(
|
|
49196
|
+
this.listPostProcessors.attach(
|
|
49197
|
+
this.paginateCallback.bind(this),
|
|
49198
|
+
"PaginateMixin:paginateCallback"
|
|
49199
|
+
);
|
|
48824
49200
|
},
|
|
48825
49201
|
async paginateCallback(resources, listPostProcessors, div2, context2) {
|
|
48826
49202
|
if (this.paginateBy > 0) {
|
|
48827
49203
|
if (!this.currentPage[context2]) this.currentPage[context2] = 1;
|
|
48828
49204
|
const parentDiv = this.initParentPaginationDiv(div2, context2);
|
|
48829
49205
|
this.renderCallbacks.push({
|
|
48830
|
-
template: this.renderPaginationNav(
|
|
49206
|
+
template: this.renderPaginationNav(
|
|
49207
|
+
this.getPageCount(resources.length),
|
|
49208
|
+
context2,
|
|
49209
|
+
div2
|
|
49210
|
+
),
|
|
48831
49211
|
parent: parentDiv
|
|
48832
49212
|
});
|
|
48833
49213
|
const firstElementIndex = (this.getCurrentPage(context2) - 1) * this.paginateBy;
|
|
48834
|
-
resources = resources.slice(
|
|
49214
|
+
resources = resources.slice(
|
|
49215
|
+
firstElementIndex,
|
|
49216
|
+
firstElementIndex + this.paginateBy
|
|
49217
|
+
);
|
|
48835
49218
|
}
|
|
48836
49219
|
const nextProcessor = listPostProcessors.shift();
|
|
48837
|
-
if (nextProcessor)
|
|
49220
|
+
if (nextProcessor)
|
|
49221
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
48838
49222
|
},
|
|
48839
49223
|
getNavElement(div2) {
|
|
48840
49224
|
const insertNode = div2.parentNode || div2;
|
|
@@ -49022,18 +49406,20 @@ const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filt
|
|
|
49022
49406
|
return matchValue(resource[filter], query, throwOn);
|
|
49023
49407
|
}
|
|
49024
49408
|
try {
|
|
49025
|
-
await Promise.all(
|
|
49026
|
-
(
|
|
49027
|
-
|
|
49028
|
-
|
|
49029
|
-
|
|
49030
|
-
|
|
49031
|
-
|
|
49032
|
-
|
|
49033
|
-
|
|
49034
|
-
|
|
49409
|
+
await Promise.all(
|
|
49410
|
+
(fields || []).map(
|
|
49411
|
+
(field) => matchFilter(
|
|
49412
|
+
resource,
|
|
49413
|
+
field,
|
|
49414
|
+
query,
|
|
49415
|
+
fieldsAttr,
|
|
49416
|
+
searchForm,
|
|
49417
|
+
filterId,
|
|
49418
|
+
true
|
|
49419
|
+
// stop searching when 1 filter is true (= OR)
|
|
49420
|
+
)
|
|
49035
49421
|
)
|
|
49036
|
-
)
|
|
49422
|
+
);
|
|
49037
49423
|
} catch (e2) {
|
|
49038
49424
|
return true;
|
|
49039
49425
|
}
|
|
@@ -49041,19 +49427,21 @@ const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filt
|
|
|
49041
49427
|
};
|
|
49042
49428
|
const matchFilters = async (resource, filters, filterNames, fields, searchForm, filterId) => {
|
|
49043
49429
|
try {
|
|
49044
|
-
await Promise.all(
|
|
49045
|
-
|
|
49046
|
-
|
|
49047
|
-
|
|
49048
|
-
|
|
49049
|
-
|
|
49050
|
-
|
|
49051
|
-
|
|
49052
|
-
|
|
49053
|
-
|
|
49054
|
-
|
|
49055
|
-
|
|
49056
|
-
|
|
49430
|
+
await Promise.all(
|
|
49431
|
+
filterNames.map(async (filter) => {
|
|
49432
|
+
let match3 = await matchFilter(
|
|
49433
|
+
resource,
|
|
49434
|
+
filter,
|
|
49435
|
+
filters[filter],
|
|
49436
|
+
fields,
|
|
49437
|
+
searchForm,
|
|
49438
|
+
filterId,
|
|
49439
|
+
false
|
|
49440
|
+
// stop searching when 1 filter is false (= AND)
|
|
49441
|
+
);
|
|
49442
|
+
return match3;
|
|
49443
|
+
})
|
|
49444
|
+
);
|
|
49057
49445
|
} catch (e2) {
|
|
49058
49446
|
return false;
|
|
49059
49447
|
}
|
|
@@ -49063,17 +49451,19 @@ const searchInResources = async (resources, filters, fields, searchForm) => {
|
|
|
49063
49451
|
const filterNames = Object.keys(filters);
|
|
49064
49452
|
const filterId = uniqID();
|
|
49065
49453
|
window.cachePropsSearchFilter = {};
|
|
49066
|
-
return Promise.all(
|
|
49067
|
-
|
|
49068
|
-
|
|
49069
|
-
|
|
49070
|
-
|
|
49071
|
-
|
|
49072
|
-
|
|
49073
|
-
|
|
49074
|
-
|
|
49075
|
-
|
|
49076
|
-
|
|
49454
|
+
return Promise.all(
|
|
49455
|
+
resources.map(async (resource) => {
|
|
49456
|
+
let match3 = await matchFilters(
|
|
49457
|
+
resource,
|
|
49458
|
+
filters,
|
|
49459
|
+
filterNames,
|
|
49460
|
+
fields,
|
|
49461
|
+
searchForm,
|
|
49462
|
+
filterId
|
|
49463
|
+
);
|
|
49464
|
+
return match3;
|
|
49465
|
+
})
|
|
49466
|
+
);
|
|
49077
49467
|
};
|
|
49078
49468
|
const FilterMixin = {
|
|
49079
49469
|
name: "filter-mixin",
|
|
@@ -49116,9 +49506,15 @@ const FilterMixin = {
|
|
|
49116
49506
|
if (this.isFilteredOnServer() && filteredBy) {
|
|
49117
49507
|
this.searchForm = document.getElementById(filteredBy);
|
|
49118
49508
|
if (!this.searchForm) throw `#${filteredBy} is not in DOM`;
|
|
49119
|
-
this.searchForm.addEventListener(
|
|
49509
|
+
this.searchForm.addEventListener(
|
|
49510
|
+
"formChange",
|
|
49511
|
+
() => this.onServerSearchChange()
|
|
49512
|
+
);
|
|
49120
49513
|
} else {
|
|
49121
|
-
this.listPostProcessors.attach(
|
|
49514
|
+
this.listPostProcessors.attach(
|
|
49515
|
+
this.filterCallback.bind(this),
|
|
49516
|
+
"FilterMixin:filterCallback"
|
|
49517
|
+
);
|
|
49122
49518
|
}
|
|
49123
49519
|
},
|
|
49124
49520
|
get filters() {
|
|
@@ -49161,10 +49557,18 @@ const FilterMixin = {
|
|
|
49161
49557
|
this.fields,
|
|
49162
49558
|
this.searchForm
|
|
49163
49559
|
);
|
|
49164
|
-
resources = resources.filter(
|
|
49560
|
+
this.resources = resources = resources.filter(
|
|
49561
|
+
(_v, index2) => filteredResources[index2]
|
|
49562
|
+
);
|
|
49165
49563
|
}
|
|
49166
49564
|
const nextProcessor = listPostProcessors.shift();
|
|
49167
|
-
if (nextProcessor)
|
|
49565
|
+
if (nextProcessor)
|
|
49566
|
+
await nextProcessor(
|
|
49567
|
+
resources,
|
|
49568
|
+
listPostProcessors,
|
|
49569
|
+
div2,
|
|
49570
|
+
context2 + (this.searchCount.get(context2) || "")
|
|
49571
|
+
);
|
|
49168
49572
|
},
|
|
49169
49573
|
async filterList(context2) {
|
|
49170
49574
|
this.searchCount.set(context2, this.searchCount.get(context2) + 1);
|
|
@@ -49179,7 +49583,9 @@ const FilterMixin = {
|
|
|
49179
49583
|
const nextArrayOfObjects = await obj[field];
|
|
49180
49584
|
if (!nextArrayOfObjects) continue;
|
|
49181
49585
|
if (typeof nextArrayOfObjects !== "object") {
|
|
49182
|
-
console.warn(
|
|
49586
|
+
console.warn(
|
|
49587
|
+
`The format value of ${field} is not suitable with auto-range-[field] attribute`
|
|
49588
|
+
);
|
|
49183
49589
|
continue;
|
|
49184
49590
|
}
|
|
49185
49591
|
if (!nextArrayOfObjects.isContainer()) {
|
|
@@ -49232,7 +49638,10 @@ const CounterMixin = {
|
|
|
49232
49638
|
parentCounterDiv: null
|
|
49233
49639
|
},
|
|
49234
49640
|
attached() {
|
|
49235
|
-
this.listPostProcessors.attach(
|
|
49641
|
+
this.listPostProcessors.attach(
|
|
49642
|
+
this.countResources.bind(this),
|
|
49643
|
+
"CounterMixin:countResources"
|
|
49644
|
+
);
|
|
49236
49645
|
},
|
|
49237
49646
|
async countResources(resources, listPostProcessors, div2, context2) {
|
|
49238
49647
|
if (this.counterTemplate) {
|
|
@@ -49244,7 +49653,8 @@ const CounterMixin = {
|
|
|
49244
49653
|
});
|
|
49245
49654
|
}
|
|
49246
49655
|
const nextProcessor = listPostProcessors.shift();
|
|
49247
|
-
if (nextProcessor)
|
|
49656
|
+
if (nextProcessor)
|
|
49657
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49248
49658
|
},
|
|
49249
49659
|
/**
|
|
49250
49660
|
* Create the parent div of the counter in the component.
|
|
@@ -49294,7 +49704,10 @@ const GrouperMixin = {
|
|
|
49294
49704
|
}
|
|
49295
49705
|
},
|
|
49296
49706
|
attached() {
|
|
49297
|
-
this.listPostProcessors.attach(
|
|
49707
|
+
this.listPostProcessors.attach(
|
|
49708
|
+
this.groupResources.bind(this),
|
|
49709
|
+
"GrouperMixin:groupResources"
|
|
49710
|
+
);
|
|
49298
49711
|
},
|
|
49299
49712
|
async groupResources(resources, listPostProcessors, div2, context2) {
|
|
49300
49713
|
const nextProcessor = listPostProcessors.shift();
|
|
@@ -49313,25 +49726,25 @@ const GrouperMixin = {
|
|
|
49313
49726
|
return generalComparator(a2, b2, order2);
|
|
49314
49727
|
});
|
|
49315
49728
|
}
|
|
49316
|
-
const parents = sortedKeys.map((g2) => ({
|
|
49729
|
+
const parents = sortedKeys.map((g2) => ({
|
|
49730
|
+
group: g2,
|
|
49731
|
+
parent: this.renderGroup(g2, div2)
|
|
49732
|
+
}));
|
|
49317
49733
|
for (let { group, parent } of parents) {
|
|
49318
|
-
if (nextProcessor)
|
|
49319
|
-
|
|
49320
|
-
|
|
49321
|
-
|
|
49322
|
-
|
|
49323
|
-
|
|
49324
|
-
|
|
49325
|
-
|
|
49326
|
-
|
|
49734
|
+
if (nextProcessor)
|
|
49735
|
+
await nextProcessor(
|
|
49736
|
+
groups[group].resources,
|
|
49737
|
+
// give only resources from group
|
|
49738
|
+
listPostProcessors.deepCopy(),
|
|
49739
|
+
// copy post processors
|
|
49740
|
+
parent,
|
|
49741
|
+
// parent is group widget
|
|
49742
|
+
context2 + "_" + group
|
|
49743
|
+
);
|
|
49327
49744
|
}
|
|
49328
49745
|
} else {
|
|
49329
|
-
if (nextProcessor)
|
|
49330
|
-
resources,
|
|
49331
|
-
listPostProcessors,
|
|
49332
|
-
div2,
|
|
49333
|
-
context2
|
|
49334
|
-
);
|
|
49746
|
+
if (nextProcessor)
|
|
49747
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49335
49748
|
}
|
|
49336
49749
|
},
|
|
49337
49750
|
/**
|
|
@@ -49339,7 +49752,9 @@ const GrouperMixin = {
|
|
|
49339
49752
|
* @param groupName
|
|
49340
49753
|
*/
|
|
49341
49754
|
renderGroup(groupName, div2) {
|
|
49342
|
-
let groupElt = this.element.querySelector(
|
|
49755
|
+
let groupElt = this.element.querySelector(
|
|
49756
|
+
`${this.groupWidget}[value="${groupName}"]`
|
|
49757
|
+
);
|
|
49343
49758
|
if (!groupElt) {
|
|
49344
49759
|
groupElt = document.createElement(this.groupWidget);
|
|
49345
49760
|
groupElt.setAttribute("value", groupName);
|
|
@@ -49354,24 +49769,30 @@ const HighlighterMixin = {
|
|
|
49354
49769
|
name: "highlighter-mixin",
|
|
49355
49770
|
use: [],
|
|
49356
49771
|
attached() {
|
|
49357
|
-
this.listPostProcessors.attach(
|
|
49772
|
+
this.listPostProcessors.attach(
|
|
49773
|
+
this.hightlightCallback.bind(this),
|
|
49774
|
+
"HighlighterMixin:hightlightCallback"
|
|
49775
|
+
);
|
|
49358
49776
|
},
|
|
49359
49777
|
async hightlightCallback(resources, listPostProcessors, div2, context2) {
|
|
49360
49778
|
for (let attr of this.element.attributes) {
|
|
49361
49779
|
if (attr.name.startsWith("highlight-")) {
|
|
49362
49780
|
const field = attr.name.split("highlight-")[1];
|
|
49363
|
-
resources = await Promise.all(
|
|
49364
|
-
|
|
49365
|
-
|
|
49366
|
-
|
|
49367
|
-
|
|
49368
|
-
|
|
49781
|
+
resources = await Promise.all(
|
|
49782
|
+
resources.map(async (resource) => ({
|
|
49783
|
+
sortingKey: await resource[field],
|
|
49784
|
+
// fetch sorting value
|
|
49785
|
+
proxy: resource
|
|
49786
|
+
// and keep proxy
|
|
49787
|
+
}))
|
|
49788
|
+
);
|
|
49369
49789
|
resources = this.sortHighlighted(resources, "sortingKey", attr.value);
|
|
49370
49790
|
resources = resources.map((resource) => resource.proxy);
|
|
49371
49791
|
}
|
|
49372
49792
|
}
|
|
49373
49793
|
const nextProcessor = listPostProcessors.shift();
|
|
49374
|
-
if (nextProcessor)
|
|
49794
|
+
if (nextProcessor)
|
|
49795
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49375
49796
|
},
|
|
49376
49797
|
sortHighlighted(resources, field, value) {
|
|
49377
49798
|
for (let [index2, res] of resources.entries()) {
|
|
@@ -49407,7 +49828,10 @@ const RequiredMixin = {
|
|
|
49407
49828
|
name: "required-mixin",
|
|
49408
49829
|
use: [],
|
|
49409
49830
|
attached() {
|
|
49410
|
-
this.listPostProcessors.attach(
|
|
49831
|
+
this.listPostProcessors.attach(
|
|
49832
|
+
this.requiredResources.bind(this),
|
|
49833
|
+
"RequiredMixin:requiredResources"
|
|
49834
|
+
);
|
|
49411
49835
|
},
|
|
49412
49836
|
async requiredResources(resources, listPostProcessors, div2, context2) {
|
|
49413
49837
|
const displays = [];
|
|
@@ -49428,7 +49852,13 @@ const RequiredMixin = {
|
|
|
49428
49852
|
}
|
|
49429
49853
|
}
|
|
49430
49854
|
const nextProcessor = listPostProcessors.shift();
|
|
49431
|
-
if (nextProcessor)
|
|
49855
|
+
if (nextProcessor)
|
|
49856
|
+
await nextProcessor(
|
|
49857
|
+
requiredFields.length ? displays : resources,
|
|
49858
|
+
listPostProcessors,
|
|
49859
|
+
div2,
|
|
49860
|
+
context2
|
|
49861
|
+
);
|
|
49432
49862
|
}
|
|
49433
49863
|
};
|
|
49434
49864
|
const SolidDisplay = {
|
|
@@ -49466,7 +49896,8 @@ const SolidDisplay = {
|
|
|
49466
49896
|
},
|
|
49467
49897
|
detached() {
|
|
49468
49898
|
if (this.activeSubscription) PubSub.unsubscribe(this.activeSubscription);
|
|
49469
|
-
if (this.removeActiveSubscription)
|
|
49899
|
+
if (this.removeActiveSubscription)
|
|
49900
|
+
PubSub.unsubscribe(this.removeActiveSubscription);
|
|
49470
49901
|
},
|
|
49471
49902
|
// Update subscription when id changes
|
|
49472
49903
|
updateNavigateSubscription() {
|
|
@@ -49558,12 +49989,7 @@ const SolidDisplay = {
|
|
|
49558
49989
|
B(template, div2);
|
|
49559
49990
|
const nextProcessor = listPostProcessors.shift();
|
|
49560
49991
|
if (nextProcessor)
|
|
49561
|
-
await nextProcessor(
|
|
49562
|
-
resources,
|
|
49563
|
-
listPostProcessors,
|
|
49564
|
-
div2,
|
|
49565
|
-
context2
|
|
49566
|
-
);
|
|
49992
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
49567
49993
|
}, "SolidDisplay:renderDom"),
|
|
49568
49994
|
/**
|
|
49569
49995
|
* Get attributes to dispatch to children from current element
|
|
@@ -50266,8 +50692,10 @@ const ValidationMixin = {
|
|
|
50266
50692
|
return dialog.showModal();
|
|
50267
50693
|
},
|
|
50268
50694
|
performAction() {
|
|
50269
|
-
if (this.element.hasAttribute("confirmation-message") && !this.confirmationType)
|
|
50270
|
-
|
|
50695
|
+
if (this.element.hasAttribute("confirmation-message") && !this.confirmationType)
|
|
50696
|
+
console.warn("confirmation-type attribute is missing.");
|
|
50697
|
+
if (!this.confirmationType || this.confirmationType == "confirm" && confirm(this.confirmationMessage || this.t("validation.message")))
|
|
50698
|
+
this.validateModal();
|
|
50271
50699
|
if (this.confirmationType == "dialog") {
|
|
50272
50700
|
this.showModal();
|
|
50273
50701
|
}
|
|
@@ -50363,7 +50791,8 @@ const SolidForm = {
|
|
|
50363
50791
|
}
|
|
50364
50792
|
setDeepProperty(values, name.split("."), value);
|
|
50365
50793
|
});
|
|
50366
|
-
if (this.resource && !((_b = (_a3 = this.resource).isContainer) == null ? void 0 : _b.call(_a3)))
|
|
50794
|
+
if (this.resource && !((_b = (_a3 = this.resource).isContainer) == null ? void 0 : _b.call(_a3)))
|
|
50795
|
+
values["@id"] = this.resourceId;
|
|
50367
50796
|
return values;
|
|
50368
50797
|
},
|
|
50369
50798
|
get isNaked() {
|
|
@@ -50384,7 +50813,8 @@ const SolidForm = {
|
|
|
50384
50813
|
if (!object) {
|
|
50385
50814
|
object = await this.resource[store.getExpandedPredicate(predicate, this.context)];
|
|
50386
50815
|
}
|
|
50387
|
-
if (object && object["@id"] && !value[predicate]["@id"])
|
|
50816
|
+
if (object && object["@id"] && !value[predicate]["@id"])
|
|
50817
|
+
value[predicate]["@id"] = object["@id"];
|
|
50388
50818
|
if (object && !object["@id"] && Array.isArray(object) && value[predicate].length == 0 && object.length > 0) {
|
|
50389
50819
|
value[predicate] = object;
|
|
50390
50820
|
}
|
|
@@ -50467,10 +50897,13 @@ const SolidForm = {
|
|
|
50467
50897
|
let errorNextName = Object.values(member)[0];
|
|
50468
50898
|
let subErrorName = errorFullName === "" ? errorNextName : errorFullName.concat("." + errorNextName);
|
|
50469
50899
|
let errorFieldName = "";
|
|
50470
|
-
if (errorFullName)
|
|
50900
|
+
if (errorFullName)
|
|
50901
|
+
errorFieldName = errorFullName.concat("." + errorNextName);
|
|
50471
50902
|
else errorFieldName = errorNextName;
|
|
50472
50903
|
if (errorFieldName) {
|
|
50473
|
-
let formField = this.element.querySelector(
|
|
50904
|
+
let formField = this.element.querySelector(
|
|
50905
|
+
`[name="${errorFieldName}"]`
|
|
50906
|
+
);
|
|
50474
50907
|
if (formField) {
|
|
50475
50908
|
formField.classList.add("error");
|
|
50476
50909
|
let errorParagraph = document.createElement("p");
|
|
@@ -50481,7 +50914,9 @@ const SolidForm = {
|
|
|
50481
50914
|
errorParagraph.appendChild(errorText);
|
|
50482
50915
|
});
|
|
50483
50916
|
} else if (typeof Object.values(member)[1] === "object") {
|
|
50484
|
-
for (const [key, value] of Object.entries(
|
|
50917
|
+
for (const [key, value] of Object.entries(
|
|
50918
|
+
Object.values(member)[1]
|
|
50919
|
+
)) {
|
|
50485
50920
|
if (Array.isArray(value)) {
|
|
50486
50921
|
value.forEach((error2) => {
|
|
50487
50922
|
let errorText = document.createElement("p");
|
|
@@ -50511,7 +50946,9 @@ const SolidForm = {
|
|
|
50511
50946
|
empty() {
|
|
50512
50947
|
},
|
|
50513
50948
|
showError(e2) {
|
|
50514
|
-
let errors2 = Object.entries(e2).filter(
|
|
50949
|
+
let errors2 = Object.entries(e2).filter(
|
|
50950
|
+
(field) => !field[0].startsWith("@context")
|
|
50951
|
+
);
|
|
50515
50952
|
this.displayErrorMessage(errors2);
|
|
50516
50953
|
const errorTemplate = x`<p>${this.t("solid-form.validation-error")}</p>`;
|
|
50517
50954
|
const parentElement = this.element.querySelector("[data-id=error]");
|
|
@@ -50521,7 +50958,8 @@ const SolidForm = {
|
|
|
50521
50958
|
let formErrors = this.element.querySelectorAll(".error-message");
|
|
50522
50959
|
if (formErrors) formErrors.forEach((error2) => error2.remove());
|
|
50523
50960
|
let errorFields = this.element.querySelectorAll(".error");
|
|
50524
|
-
if (errorFields)
|
|
50961
|
+
if (errorFields)
|
|
50962
|
+
errorFields.forEach((errorField) => errorField.classList.remove("error"));
|
|
50525
50963
|
const parentElement = this.element.querySelector("[data-id=error]");
|
|
50526
50964
|
if (parentElement) B("", parentElement);
|
|
50527
50965
|
},
|
|
@@ -50547,13 +50985,14 @@ const SolidForm = {
|
|
|
50547
50985
|
</div>
|
|
50548
50986
|
`;
|
|
50549
50987
|
},
|
|
50550
|
-
populate: trackRenderAsync(
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
|
|
50556
|
-
|
|
50988
|
+
populate: trackRenderAsync(async function() {
|
|
50989
|
+
this.element.oninput = () => this.onInput();
|
|
50990
|
+
this.element.onchange = () => this.onChange();
|
|
50991
|
+
const fields = await this.getFields();
|
|
50992
|
+
const widgetTemplates = await Promise.all(
|
|
50993
|
+
fields.map((field) => this.createWidgetTemplate(field))
|
|
50994
|
+
);
|
|
50995
|
+
const template = x`
|
|
50557
50996
|
<div data-id="error"></div>
|
|
50558
50997
|
${!this.isNaked ? x`
|
|
50559
50998
|
<form
|
|
@@ -50567,10 +51006,8 @@ const SolidForm = {
|
|
|
50567
51006
|
` : x`${widgetTemplates}`}
|
|
50568
51007
|
${this.getModalDialog()}
|
|
50569
51008
|
`;
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
"SolidForm:populate"
|
|
50573
|
-
)
|
|
51009
|
+
B(template, this.element);
|
|
51010
|
+
}, "SolidForm:populate")
|
|
50574
51011
|
};
|
|
50575
51012
|
Sib.register(SolidForm);
|
|
50576
51013
|
const SolidFormSearch = {
|
|
@@ -50685,7 +51122,9 @@ const SolidFormSearch = {
|
|
|
50685
51122
|
}
|
|
50686
51123
|
const idField = `${this.rangeId}_${fieldName}`;
|
|
50687
51124
|
const id2 = `store://local.${idField}`;
|
|
50688
|
-
const ldpContains = Array.from(autoRangeValues).map((id22) => ({
|
|
51125
|
+
const ldpContains = Array.from(autoRangeValues).map((id22) => ({
|
|
51126
|
+
"@id": id22
|
|
51127
|
+
}));
|
|
50689
51128
|
const data = {
|
|
50690
51129
|
"@type": "ldp:Container",
|
|
50691
51130
|
"@context": this.context,
|
|
@@ -50719,23 +51158,17 @@ const SolidFormSearch = {
|
|
|
50719
51158
|
let parentElementLabel = (_a3 = input == null ? void 0 : input.parentElement) == null ? void 0 : _a3.getAttribute("label");
|
|
50720
51159
|
try {
|
|
50721
51160
|
const selectedLabel = (_b = input.selectedOptions[0].textContent) == null ? void 0 : _b.trim();
|
|
50722
|
-
this.change(
|
|
50723
|
-
|
|
50724
|
-
|
|
50725
|
-
|
|
50726
|
-
|
|
50727
|
-
type: "select"
|
|
50728
|
-
}
|
|
50729
|
-
);
|
|
51161
|
+
this.change(this.value, {
|
|
51162
|
+
value: selectedLabel,
|
|
51163
|
+
inputLabel: parentElementLabel,
|
|
51164
|
+
type: "select"
|
|
51165
|
+
});
|
|
50730
51166
|
} catch {
|
|
50731
|
-
this.change(
|
|
50732
|
-
|
|
50733
|
-
|
|
50734
|
-
|
|
50735
|
-
|
|
50736
|
-
type: "input"
|
|
50737
|
-
}
|
|
50738
|
-
);
|
|
51167
|
+
this.change(this.value, {
|
|
51168
|
+
value: input.value,
|
|
51169
|
+
inputLabel: parentElementLabel,
|
|
51170
|
+
type: "input"
|
|
51171
|
+
});
|
|
50739
51172
|
}
|
|
50740
51173
|
},
|
|
50741
51174
|
getSubmitTemplate() {
|
|
@@ -50754,29 +51187,29 @@ const SolidFormSearch = {
|
|
|
50754
51187
|
this.inputChange(input);
|
|
50755
51188
|
}, this.debounce);
|
|
50756
51189
|
},
|
|
50757
|
-
populate: trackRenderAsync(
|
|
50758
|
-
|
|
50759
|
-
|
|
50760
|
-
|
|
50761
|
-
this.
|
|
50762
|
-
}
|
|
50763
|
-
|
|
50764
|
-
|
|
50765
|
-
|
|
50766
|
-
|
|
50767
|
-
|
|
50768
|
-
|
|
50769
|
-
|
|
50770
|
-
|
|
51190
|
+
populate: trackRenderAsync(async function() {
|
|
51191
|
+
await this.replaceAttributesData();
|
|
51192
|
+
if (this.submitButton == null) {
|
|
51193
|
+
this.element.addEventListener("input", (e2) => {
|
|
51194
|
+
this.debounceInput(e2.target);
|
|
51195
|
+
});
|
|
51196
|
+
}
|
|
51197
|
+
this.element.addEventListener("submit", (e2) => {
|
|
51198
|
+
e2.preventDefault();
|
|
51199
|
+
this.inputChange(e2.target);
|
|
51200
|
+
});
|
|
51201
|
+
const fields = await this.getFields();
|
|
51202
|
+
const widgetTemplates = await Promise.all(
|
|
51203
|
+
fields.map((field) => this.createWidgetTemplate(field))
|
|
51204
|
+
);
|
|
51205
|
+
const template = x`
|
|
50771
51206
|
<form>
|
|
50772
51207
|
${widgetTemplates}
|
|
50773
51208
|
${this.submitButton == null ? "" : this.getSubmitTemplate()}
|
|
50774
51209
|
</form>
|
|
50775
51210
|
`;
|
|
50776
|
-
|
|
50777
|
-
|
|
50778
|
-
"SolidFormSearch:populate"
|
|
50779
|
-
)
|
|
51211
|
+
B(template, this.element);
|
|
51212
|
+
}, "SolidFormSearch:populate")
|
|
50780
51213
|
};
|
|
50781
51214
|
Sib.register(SolidFormSearch);
|
|
50782
51215
|
const SolidWidget = {
|
|
@@ -50794,12 +51227,7 @@ const SolidWidget = {
|
|
|
50794
51227
|
const template = this.template;
|
|
50795
51228
|
const newWidget = {
|
|
50796
51229
|
name: this.name,
|
|
50797
|
-
use: [
|
|
50798
|
-
BaseWidgetMixin,
|
|
50799
|
-
StoreMixin,
|
|
50800
|
-
FormMixin,
|
|
50801
|
-
ActionMixin
|
|
50802
|
-
],
|
|
51230
|
+
use: [BaseWidgetMixin, StoreMixin, FormMixin, ActionMixin],
|
|
50803
51231
|
attributes: {
|
|
50804
51232
|
label: {
|
|
50805
51233
|
type: String,
|
|
@@ -50810,7 +51238,9 @@ const SolidWidget = {
|
|
|
50810
51238
|
}
|
|
50811
51239
|
},
|
|
50812
51240
|
get template() {
|
|
50813
|
-
return () => this.evalTemplate(template).then(
|
|
51241
|
+
return () => this.evalTemplate(template).then(
|
|
51242
|
+
(tpl) => x`${o$1(tpl)}`
|
|
51243
|
+
);
|
|
50814
51244
|
},
|
|
50815
51245
|
evalTemplate(template2) {
|
|
50816
51246
|
const tpl = evalTemplateString(template2, {
|
|
@@ -50827,7 +51257,8 @@ const SolidWidget = {
|
|
|
50827
51257
|
},
|
|
50828
51258
|
// For form widgets, handle nested solid-form
|
|
50829
51259
|
getValueFromElement(element) {
|
|
50830
|
-
if (element.tagName === "SOLID-FORM")
|
|
51260
|
+
if (element.tagName === "SOLID-FORM")
|
|
51261
|
+
return element.component.value;
|
|
50831
51262
|
else if (element.component) return element.component.getValue();
|
|
50832
51263
|
return element.value;
|
|
50833
51264
|
},
|
|
@@ -50859,28 +51290,27 @@ const SolidAcChecker = {
|
|
|
50859
51290
|
default: ""
|
|
50860
51291
|
}
|
|
50861
51292
|
},
|
|
50862
|
-
populate: trackRenderAsync(
|
|
50863
|
-
|
|
50864
|
-
|
|
50865
|
-
|
|
50866
|
-
|
|
50867
|
-
|
|
50868
|
-
|
|
50869
|
-
|
|
50870
|
-
|
|
50871
|
-
|
|
50872
|
-
|
|
50873
|
-
|
|
50874
|
-
|
|
50875
|
-
|
|
50876
|
-
|
|
50877
|
-
|
|
50878
|
-
|
|
50879
|
-
|
|
50880
|
-
|
|
50881
|
-
|
|
50882
|
-
|
|
50883
|
-
),
|
|
51293
|
+
populate: trackRenderAsync(async function() {
|
|
51294
|
+
if (!this.resource) return;
|
|
51295
|
+
let displayElement;
|
|
51296
|
+
const ContextParser3 = JSONLDContextParser.ContextParser;
|
|
51297
|
+
const permissions = await this.resource.permissions;
|
|
51298
|
+
if (this.permission) {
|
|
51299
|
+
displayElement = permissions.some((p2) => {
|
|
51300
|
+
return ContextParser3.expandTerm(p2, this.context, true) === this.permission;
|
|
51301
|
+
});
|
|
51302
|
+
} else if (this.noPermission) {
|
|
51303
|
+
displayElement = permissions.every((p2) => {
|
|
51304
|
+
return ContextParser3.expandTerm(p2, this.context, true) !== this.noPermission;
|
|
51305
|
+
});
|
|
51306
|
+
} else {
|
|
51307
|
+
console.warn(
|
|
51308
|
+
'solid-ac-checker: you should define at least one of "permission" or "no-permission" attribute.'
|
|
51309
|
+
);
|
|
51310
|
+
return;
|
|
51311
|
+
}
|
|
51312
|
+
if (displayElement) this.element.removeAttribute("hidden");
|
|
51313
|
+
}, "SolidAcChecker:populate"),
|
|
50884
51314
|
empty() {
|
|
50885
51315
|
this.element.setAttribute("hidden", "");
|
|
50886
51316
|
}
|
|
@@ -50929,7 +51359,10 @@ const SolidDelete = {
|
|
|
50929
51359
|
return store.delete(this.dataSrc, this.context).then((response) => {
|
|
50930
51360
|
if (!response.ok) return;
|
|
50931
51361
|
this.goToNext(null);
|
|
50932
|
-
const eventData = {
|
|
51362
|
+
const eventData = {
|
|
51363
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51364
|
+
bubbles: true
|
|
51365
|
+
};
|
|
50933
51366
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
50934
51367
|
this.element.dispatchEvent(new CustomEvent("resourceDeleted", eventData));
|
|
50935
51368
|
});
|
|
@@ -50940,14 +51373,11 @@ const SolidDelete = {
|
|
|
50940
51373
|
update() {
|
|
50941
51374
|
this.render();
|
|
50942
51375
|
},
|
|
50943
|
-
render: trackRenderAsync(
|
|
50944
|
-
|
|
50945
|
-
|
|
50946
|
-
|
|
50947
|
-
|
|
50948
|
-
},
|
|
50949
|
-
"SolidDelete:render"
|
|
50950
|
-
)
|
|
51376
|
+
render: trackRenderAsync(async function() {
|
|
51377
|
+
await this.replaceAttributesData(false);
|
|
51378
|
+
const button = x`<button @click=${this.delete.bind(this)}>${this.dataLabel || this.t("solid-delete.button")}</button>${this.getModalDialog()}`;
|
|
51379
|
+
B(button, this.element);
|
|
51380
|
+
}, "SolidDelete:render")
|
|
50951
51381
|
};
|
|
50952
51382
|
Sib.register(SolidDelete);
|
|
50953
51383
|
const SolidLang = {
|
|
@@ -51157,7 +51587,9 @@ const SolidTable = {
|
|
|
51157
51587
|
},
|
|
51158
51588
|
get selectedLines() {
|
|
51159
51589
|
if (this.selectable === null) return [];
|
|
51160
|
-
return Array.from(
|
|
51590
|
+
return Array.from(
|
|
51591
|
+
this.element.querySelectorAll("input[data-selection]:checked")
|
|
51592
|
+
).map((e2) => {
|
|
51161
51593
|
var _a3;
|
|
51162
51594
|
return (_a3 = e2 == null ? void 0 : e2.closest("[data-resource]")) == null ? void 0 : _a3.getAttribute("data-resource");
|
|
51163
51595
|
});
|
|
@@ -51168,7 +51600,11 @@ const SolidTable = {
|
|
|
51168
51600
|
*/
|
|
51169
51601
|
selectAll(e2) {
|
|
51170
51602
|
if (this.selectable === null) return;
|
|
51171
|
-
for (const checkbox of Array.from(
|
|
51603
|
+
for (const checkbox of Array.from(
|
|
51604
|
+
this.element.querySelectorAll(
|
|
51605
|
+
"input[data-selection]"
|
|
51606
|
+
)
|
|
51607
|
+
)) {
|
|
51172
51608
|
checkbox.checked = e2.target.checked;
|
|
51173
51609
|
}
|
|
51174
51610
|
},
|
|
@@ -51177,7 +51613,11 @@ const SolidTable = {
|
|
|
51177
51613
|
*/
|
|
51178
51614
|
unselectAll() {
|
|
51179
51615
|
if (this.selectable === null) return;
|
|
51180
|
-
for (const checkbox of Array.from(
|
|
51616
|
+
for (const checkbox of Array.from(
|
|
51617
|
+
this.element.querySelectorAll(
|
|
51618
|
+
"input[data-selection]"
|
|
51619
|
+
)
|
|
51620
|
+
)) {
|
|
51181
51621
|
checkbox.checked = false;
|
|
51182
51622
|
}
|
|
51183
51623
|
},
|
|
@@ -51188,7 +51628,9 @@ const SolidTable = {
|
|
|
51188
51628
|
selectLines(lines) {
|
|
51189
51629
|
if (this.selectable === null || lines.length === 0) return;
|
|
51190
51630
|
for (const line of lines) {
|
|
51191
|
-
const checkbox = this.element.querySelector(
|
|
51631
|
+
const checkbox = this.element.querySelector(
|
|
51632
|
+
`[data-resource="${line}"] input[data-selection]`
|
|
51633
|
+
);
|
|
51192
51634
|
if (checkbox) checkbox.checked = true;
|
|
51193
51635
|
}
|
|
51194
51636
|
},
|
|
@@ -51198,7 +51640,8 @@ const SolidTable = {
|
|
|
51198
51640
|
* @param resource
|
|
51199
51641
|
*/
|
|
51200
51642
|
async createCellWidget(field, resource) {
|
|
51201
|
-
if (!this.element.hasAttribute("editable-" + field))
|
|
51643
|
+
if (!this.element.hasAttribute("editable-" + field))
|
|
51644
|
+
return this.createWidgetTemplate(field, resource, true);
|
|
51202
51645
|
const attributes = {};
|
|
51203
51646
|
const formWidgetAttributes = [
|
|
51204
51647
|
// attributes to give to the form widget
|
|
@@ -51215,14 +51658,16 @@ const SolidTable = {
|
|
|
51215
51658
|
"title",
|
|
51216
51659
|
"widget"
|
|
51217
51660
|
];
|
|
51218
|
-
for (let attr of formWidgetAttributes)
|
|
51661
|
+
for (let attr of formWidgetAttributes)
|
|
51662
|
+
this.addToAttributes(`${attr}-${field}`, `${attr}-${field}`, attributes);
|
|
51219
51663
|
const formAttributes = [
|
|
51220
51664
|
// attributes to give to the form
|
|
51221
51665
|
"class",
|
|
51222
51666
|
"submit-button",
|
|
51223
51667
|
"next"
|
|
51224
51668
|
];
|
|
51225
|
-
for (let attr of formAttributes)
|
|
51669
|
+
for (let attr of formAttributes)
|
|
51670
|
+
this.addToAttributes(`${attr}-${field}`, attr, attributes);
|
|
51226
51671
|
return x`
|
|
51227
51672
|
<solid-form
|
|
51228
51673
|
data-src="${resource["@id"]}"
|
|
@@ -51291,12 +51736,7 @@ const SolidTable = {
|
|
|
51291
51736
|
this.selectLines(selectedLines);
|
|
51292
51737
|
const nextProcessor = listPostProcessors.shift();
|
|
51293
51738
|
if (nextProcessor)
|
|
51294
|
-
await nextProcessor(
|
|
51295
|
-
resources,
|
|
51296
|
-
listPostProcessors,
|
|
51297
|
-
div2,
|
|
51298
|
-
context2
|
|
51299
|
-
);
|
|
51739
|
+
await nextProcessor(resources, listPostProcessors, div2, context2);
|
|
51300
51740
|
}, "SolidTable:renderDom")
|
|
51301
51741
|
};
|
|
51302
51742
|
Sib.register(SolidTable);
|
|
@@ -51344,10 +51784,8 @@ const SolidMembership = {
|
|
|
51344
51784
|
if (!store.session) return;
|
|
51345
51785
|
let currentUserSession = await store.session;
|
|
51346
51786
|
if (!currentUserSession) return;
|
|
51347
|
-
if (!this.dataTargetSrc)
|
|
51348
|
-
|
|
51349
|
-
else
|
|
51350
|
-
this.userId = this.dataTargetSrc;
|
|
51787
|
+
if (!this.dataTargetSrc) this.userId = await currentUserSession.webId;
|
|
51788
|
+
else this.userId = this.dataTargetSrc;
|
|
51351
51789
|
if (!this.userId) return;
|
|
51352
51790
|
this.resource = await store.getData(this.resourceId);
|
|
51353
51791
|
if (!this.resource) return;
|
|
@@ -51379,15 +51817,20 @@ const SolidMembership = {
|
|
|
51379
51817
|
this.currentMembers.push({ "@id": this.userId });
|
|
51380
51818
|
let currentRes = {
|
|
51381
51819
|
"@context": this.context,
|
|
51382
|
-
|
|
51820
|
+
user_set: this.currentMembers
|
|
51383
51821
|
};
|
|
51384
51822
|
return store.patch(currentRes, this.dataSrc).then((response) => {
|
|
51385
51823
|
if (!response) {
|
|
51386
|
-
console.warn(
|
|
51824
|
+
console.warn(
|
|
51825
|
+
`Error while joining group ${this.dataSrc} for user ${this.userId}`
|
|
51826
|
+
);
|
|
51387
51827
|
return;
|
|
51388
51828
|
}
|
|
51389
51829
|
this.goToNext(null);
|
|
51390
|
-
const eventData = {
|
|
51830
|
+
const eventData = {
|
|
51831
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51832
|
+
bubbles: true
|
|
51833
|
+
};
|
|
51391
51834
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51392
51835
|
this.element.dispatchEvent(new CustomEvent("memberAdded", eventData));
|
|
51393
51836
|
this.planRender();
|
|
@@ -51396,21 +51839,25 @@ const SolidMembership = {
|
|
|
51396
51839
|
async leaveGroup() {
|
|
51397
51840
|
let userSet = this.currentMembers.filter((value) => {
|
|
51398
51841
|
const userId = value["@id"];
|
|
51399
|
-
if (userId == this.userId)
|
|
51400
|
-
return false;
|
|
51842
|
+
if (userId == this.userId) return false;
|
|
51401
51843
|
else return true;
|
|
51402
51844
|
});
|
|
51403
51845
|
let currentRes = {
|
|
51404
51846
|
"@context": this.context,
|
|
51405
|
-
|
|
51847
|
+
user_set: userSet
|
|
51406
51848
|
};
|
|
51407
51849
|
return store.patch(currentRes, this.dataSrc).then((response) => {
|
|
51408
51850
|
if (!response) {
|
|
51409
|
-
console.warn(
|
|
51851
|
+
console.warn(
|
|
51852
|
+
`Error while leaving group ${this.dataSrc} for user ${this.userId}`
|
|
51853
|
+
);
|
|
51410
51854
|
return;
|
|
51411
51855
|
}
|
|
51412
51856
|
this.goToNext(null);
|
|
51413
|
-
const eventData = {
|
|
51857
|
+
const eventData = {
|
|
51858
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
51859
|
+
bubbles: true
|
|
51860
|
+
};
|
|
51414
51861
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51415
51862
|
this.element.dispatchEvent(new CustomEvent("memberRemoved", eventData));
|
|
51416
51863
|
this.planRender();
|
|
@@ -51429,12 +51876,11 @@ const SolidMembership = {
|
|
|
51429
51876
|
update() {
|
|
51430
51877
|
this.render();
|
|
51431
51878
|
},
|
|
51432
|
-
render: trackRenderAsync(
|
|
51433
|
-
|
|
51434
|
-
|
|
51435
|
-
|
|
51436
|
-
|
|
51437
|
-
button = x`
|
|
51879
|
+
render: trackRenderAsync(async function() {
|
|
51880
|
+
await this.populate();
|
|
51881
|
+
let button = x``;
|
|
51882
|
+
if (this.isMember) {
|
|
51883
|
+
button = x`
|
|
51438
51884
|
<solid-ac-checker data-src="${this.dataSrc}"
|
|
51439
51885
|
permission="acl:Read"
|
|
51440
51886
|
class=${o$2(`${this.classSubmitButton ? "leave " + this.classSubmitButton : "leave"}`)}
|
|
@@ -51443,8 +51889,8 @@ const SolidMembership = {
|
|
|
51443
51889
|
${this.getModalDialog()}
|
|
51444
51890
|
</solid-ac-checker>
|
|
51445
51891
|
`;
|
|
51446
|
-
|
|
51447
|
-
|
|
51892
|
+
} else {
|
|
51893
|
+
button = x`
|
|
51448
51894
|
<solid-ac-checker data-src="${this.dataSrc}"
|
|
51449
51895
|
permission="acl:Read"
|
|
51450
51896
|
class=${o$2(`${this.classSubmitButton ? "join " + this.classSubmitButton : "join"}`)}
|
|
@@ -51453,11 +51899,9 @@ const SolidMembership = {
|
|
|
51453
51899
|
${this.getModalDialog()}
|
|
51454
51900
|
</solid-ac-checker>
|
|
51455
51901
|
`;
|
|
51456
|
-
|
|
51457
|
-
|
|
51458
|
-
|
|
51459
|
-
"SolidMembership:render"
|
|
51460
|
-
)
|
|
51902
|
+
}
|
|
51903
|
+
B(button, this.element);
|
|
51904
|
+
}, "SolidMembership:render")
|
|
51461
51905
|
};
|
|
51462
51906
|
Sib.register(SolidMembership);
|
|
51463
51907
|
const SolidMemberDelete = {
|
|
@@ -51538,21 +51982,25 @@ const SolidMemberDelete = {
|
|
|
51538
51982
|
async deleteMembership() {
|
|
51539
51983
|
let userSet = this.currentMembers.filter((value) => {
|
|
51540
51984
|
const userId = value["@id"];
|
|
51541
|
-
if (userId == this.dataTargetSrc)
|
|
51542
|
-
return false;
|
|
51985
|
+
if (userId == this.dataTargetSrc) return false;
|
|
51543
51986
|
else return true;
|
|
51544
51987
|
});
|
|
51545
51988
|
let currentRes = {
|
|
51546
51989
|
"@context": this.context,
|
|
51547
|
-
|
|
51990
|
+
user_set: userSet
|
|
51548
51991
|
};
|
|
51549
51992
|
return store.patch(currentRes, this.dataSrc).then((response) => {
|
|
51550
51993
|
if (!response) {
|
|
51551
|
-
console.warn(
|
|
51994
|
+
console.warn(
|
|
51995
|
+
`Error while removing user ${this.dataTargetSrc} from group ${this.dataSrc}`
|
|
51996
|
+
);
|
|
51552
51997
|
return;
|
|
51553
51998
|
}
|
|
51554
51999
|
this.goToNext(null);
|
|
51555
|
-
const eventData = {
|
|
52000
|
+
const eventData = {
|
|
52001
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
52002
|
+
bubbles: true
|
|
52003
|
+
};
|
|
51556
52004
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51557
52005
|
this.element.dispatchEvent(new CustomEvent("memberRemoved", eventData));
|
|
51558
52006
|
this.planRender();
|
|
@@ -51564,12 +52012,11 @@ const SolidMemberDelete = {
|
|
|
51564
52012
|
update() {
|
|
51565
52013
|
this.render();
|
|
51566
52014
|
},
|
|
51567
|
-
render: trackRenderAsync(
|
|
51568
|
-
|
|
51569
|
-
|
|
51570
|
-
|
|
51571
|
-
|
|
51572
|
-
button = x`
|
|
52015
|
+
render: trackRenderAsync(async function() {
|
|
52016
|
+
await this.populate();
|
|
52017
|
+
let button = x``;
|
|
52018
|
+
if (this.isMember) {
|
|
52019
|
+
button = x`
|
|
51573
52020
|
<solid-ac-checker data-src="${this.dataSrc}"
|
|
51574
52021
|
permission="acl:Write"
|
|
51575
52022
|
class=${o$2(this.classSubmitButton)}
|
|
@@ -51581,13 +52028,11 @@ const SolidMemberDelete = {
|
|
|
51581
52028
|
${this.getModalDialog()}
|
|
51582
52029
|
</solid-ac-checker>
|
|
51583
52030
|
`;
|
|
51584
|
-
|
|
51585
|
-
|
|
51586
|
-
|
|
51587
|
-
|
|
51588
|
-
|
|
51589
|
-
"SolidMemberDelete:render"
|
|
51590
|
-
)
|
|
52031
|
+
} else {
|
|
52032
|
+
button = x`<span>${this.dataUnknownMember || this.t("solid-member-unknown.span")}</span>`;
|
|
52033
|
+
}
|
|
52034
|
+
B(button, this.element);
|
|
52035
|
+
}, "SolidMemberDelete:render")
|
|
51591
52036
|
};
|
|
51592
52037
|
Sib.register(SolidMemberDelete);
|
|
51593
52038
|
const SolidMemberAdd = {
|
|
@@ -51643,15 +52088,20 @@ const SolidMemberAdd = {
|
|
|
51643
52088
|
this.currentMembers.push(JSON.parse(this.dataTargetSrc));
|
|
51644
52089
|
let currentRes = {
|
|
51645
52090
|
"@context": this.context,
|
|
51646
|
-
|
|
52091
|
+
user_set: this.currentMembers
|
|
51647
52092
|
};
|
|
51648
52093
|
return store.patch(currentRes, this.resourceId).then((response) => {
|
|
51649
52094
|
if (!response) {
|
|
51650
|
-
console.warn(
|
|
52095
|
+
console.warn(
|
|
52096
|
+
`Error while adding user ${this.dataTargetSrc} to group ${this.resourceId}`
|
|
52097
|
+
);
|
|
51651
52098
|
return;
|
|
51652
52099
|
}
|
|
51653
52100
|
this.goToNext(null);
|
|
51654
|
-
const eventData = {
|
|
52101
|
+
const eventData = {
|
|
52102
|
+
detail: { resource: { "@id": this.dataSrc } },
|
|
52103
|
+
bubbles: true
|
|
52104
|
+
};
|
|
51655
52105
|
this.element.dispatchEvent(new CustomEvent("save", eventData));
|
|
51656
52106
|
this.element.dispatchEvent(new CustomEvent("memberAdded", eventData));
|
|
51657
52107
|
this.planRender();
|
|
@@ -51798,9 +52248,17 @@ class SolidTemplateElement extends HTMLElement {
|
|
|
51798
52248
|
const fullPath = `${path}/${ln}.json`;
|
|
51799
52249
|
return fetch(fullPath).then((result) => {
|
|
51800
52250
|
if (result.ok) {
|
|
51801
|
-
return result.json().catch(
|
|
52251
|
+
return result.json().catch(
|
|
52252
|
+
(e2) => console.error(
|
|
52253
|
+
`Error while parsing the translation file: ${fullPath}`
|
|
52254
|
+
)
|
|
52255
|
+
);
|
|
51802
52256
|
}
|
|
51803
|
-
}).catch(
|
|
52257
|
+
}).catch(
|
|
52258
|
+
(e2) => console.error(
|
|
52259
|
+
`Error while retrieving the translation file: ${fullPath}`
|
|
52260
|
+
)
|
|
52261
|
+
);
|
|
51804
52262
|
}
|
|
51805
52263
|
/**
|
|
51806
52264
|
* Returns current locale of app
|
|
@@ -51904,7 +52362,8 @@ class BaseWidget extends HTMLElement {
|
|
|
51904
52362
|
get value() {
|
|
51905
52363
|
if (this.dataHolder) {
|
|
51906
52364
|
let values = this.dataHolder.map((element) => {
|
|
51907
|
-
if (element instanceof HTMLInputElement && element.type == "checkbox")
|
|
52365
|
+
if (element instanceof HTMLInputElement && element.type == "checkbox")
|
|
52366
|
+
return element.checked;
|
|
51908
52367
|
return this.getValueHolder(element).value;
|
|
51909
52368
|
});
|
|
51910
52369
|
return values.length === 1 ? values[0] : values;
|
|
@@ -51923,17 +52382,15 @@ class BaseWidget extends HTMLElement {
|
|
|
51923
52382
|
}
|
|
51924
52383
|
if (element.dispatchEvent) element.dispatchEvent(new Event("change"));
|
|
51925
52384
|
} else if (this.dataHolder && this.dataHolder.length > 1) {
|
|
51926
|
-
this.dataHolder.forEach(
|
|
51927
|
-
(el2
|
|
51928
|
-
|
|
51929
|
-
|
|
51930
|
-
|
|
51931
|
-
|
|
51932
|
-
element.value = value ? value[index2] : "";
|
|
51933
|
-
}
|
|
51934
|
-
element.dispatchEvent(new Event("change"));
|
|
52385
|
+
this.dataHolder.forEach((el2, index2) => {
|
|
52386
|
+
const element = this.getValueHolder(el2);
|
|
52387
|
+
if (element.type == "checkbox") {
|
|
52388
|
+
element.checked = value ? value[index2] : "";
|
|
52389
|
+
} else {
|
|
52390
|
+
element.value = value ? value[index2] : "";
|
|
51935
52391
|
}
|
|
51936
|
-
|
|
52392
|
+
element.dispatchEvent(new Event("change"));
|
|
52393
|
+
});
|
|
51937
52394
|
}
|
|
51938
52395
|
this.render();
|
|
51939
52396
|
}
|
|
@@ -51950,7 +52407,9 @@ class BaseWidget extends HTMLElement {
|
|
|
51950
52407
|
this.setAttribute("remove-label", label);
|
|
51951
52408
|
}
|
|
51952
52409
|
get dataHolder() {
|
|
51953
|
-
const widgetDataHolders = Array.from(
|
|
52410
|
+
const widgetDataHolders = Array.from(
|
|
52411
|
+
this.querySelectorAll("[data-holder]")
|
|
52412
|
+
).filter((element) => {
|
|
51954
52413
|
const dataHolderAncestor = element.parentElement ? element.parentElement.closest("[data-holder]") : null;
|
|
51955
52414
|
return dataHolderAncestor === this || !dataHolderAncestor || !this.contains(dataHolderAncestor);
|
|
51956
52415
|
});
|
|
@@ -51976,7 +52435,10 @@ class BaseWidget extends HTMLElement {
|
|
|
51976
52435
|
}
|
|
51977
52436
|
set range(range2) {
|
|
51978
52437
|
(async () => {
|
|
51979
|
-
this._listen(
|
|
52438
|
+
this._listen(
|
|
52439
|
+
range2,
|
|
52440
|
+
async () => this._range = await store.getData(range2, this.context)
|
|
52441
|
+
);
|
|
51980
52442
|
this._range = await store.getData(range2, this.context);
|
|
51981
52443
|
this.render();
|
|
51982
52444
|
})();
|
|
@@ -51996,9 +52458,13 @@ class BaseWidget extends HTMLElement {
|
|
|
51996
52458
|
}
|
|
51997
52459
|
}
|
|
51998
52460
|
if ((_a3 = res.isContainer) == null ? void 0 : _a3.call(res)) {
|
|
51999
|
-
let resourcesFromContainer = await store.getData(
|
|
52461
|
+
let resourcesFromContainer = await store.getData(
|
|
52462
|
+
res["@id"],
|
|
52463
|
+
this.context
|
|
52464
|
+
);
|
|
52000
52465
|
this._listen(res["@id"]);
|
|
52001
|
-
if (resourcesFromContainer)
|
|
52466
|
+
if (resourcesFromContainer)
|
|
52467
|
+
resources.push(...resourcesFromContainer["ldp:contains"]);
|
|
52002
52468
|
} else {
|
|
52003
52469
|
resources.push(res);
|
|
52004
52470
|
}
|
|
@@ -52044,10 +52510,13 @@ class BaseWidget extends HTMLElement {
|
|
|
52044
52510
|
_listen(id2, callback = () => {
|
|
52045
52511
|
}) {
|
|
52046
52512
|
if (!this._subscriptions.get(id2)) {
|
|
52047
|
-
this._subscriptions.set(
|
|
52048
|
-
|
|
52049
|
-
|
|
52050
|
-
|
|
52513
|
+
this._subscriptions.set(
|
|
52514
|
+
id2,
|
|
52515
|
+
PubSub.subscribe(id2, async () => {
|
|
52516
|
+
await callback();
|
|
52517
|
+
this.render();
|
|
52518
|
+
})
|
|
52519
|
+
);
|
|
52051
52520
|
}
|
|
52052
52521
|
}
|
|
52053
52522
|
// Editable widgets
|
|
@@ -52058,7 +52527,10 @@ class BaseWidget extends HTMLElement {
|
|
|
52058
52527
|
editButton.innerText = "Modifier";
|
|
52059
52528
|
editButton.onclick = () => this.activateEditableField(editableField, editButton);
|
|
52060
52529
|
editableField.insertAdjacentElement("afterend", editButton);
|
|
52061
|
-
editableField.addEventListener(
|
|
52530
|
+
editableField.addEventListener(
|
|
52531
|
+
"focusout",
|
|
52532
|
+
() => this.save(editableField, editButton)
|
|
52533
|
+
);
|
|
52062
52534
|
}
|
|
52063
52535
|
}
|
|
52064
52536
|
activateEditableField(editableField, editButton) {
|