@startinblox/core 0.19.0-beta.3 → 0.19.0-beta.5

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/index.js CHANGED
@@ -10979,7 +10979,7 @@ class CustomGetter {
10979
10979
  this.getExpandedPredicate("ldp:BasicContainer"),
10980
10980
  this.getExpandedPredicate("ldp:DirectContainer"),
10981
10981
  this.getExpandedPredicate("ldp:IndirectContainer"),
10982
- "sib:federatedContainer"
10982
+ this.getExpandedPredicate("sib:federatedContainer")
10983
10983
  ];
10984
10984
  }
10985
10985
  /**
@@ -11261,18 +11261,27 @@ function appendServerPaginationToIri(iri, options) {
11261
11261
  const ContextParser2 = JSONLDContextParser.ContextParser;
11262
11262
  const myParser = new ContextParser2();
11263
11263
  const base_context = {
11264
- "@vocab": "http://happy-dev.fr/owl/#",
11265
- rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
11266
- rdfs: "http://www.w3.org/2000/01/rdf-schema#",
11267
- ldp: "http://www.w3.org/ns/ldp#",
11264
+ "@vocab": "https://cdn.startinblox.com/owl#",
11268
11265
  foaf: "http://xmlns.com/foaf/0.1/",
11269
- name: "rdfs:label",
11266
+ doap: "http://usefulinc.com/ns/doap#",
11267
+ ldp: "http://www.w3.org/ns/ldp#",
11268
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#",
11269
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
11270
+ xsd: "http://www.w3.org/2001/XMLSchema#",
11271
+ geo: "http://www.w3.org/2003/01/geo/wgs84_pos#",
11270
11272
  acl: "http://www.w3.org/ns/auth/acl#",
11273
+ name: "rdfs:label",
11274
+ deadline: "xsd:dateTime",
11275
+ lat: "geo:lat",
11276
+ lng: "geo:long",
11277
+ jabberID: "foaf:jabberID",
11271
11278
  permissions: "acl:accessControl",
11272
11279
  mode: "acl:mode",
11273
- geo: "http://www.w3.org/2003/01/geo/wgs84_pos#",
11274
- lat: "geo:lat",
11275
- lng: "geo:long"
11280
+ view: "acl:Read",
11281
+ change: "acl:Write",
11282
+ add: "acl:Append",
11283
+ delete: "acl:Delete",
11284
+ control: "acl:Control"
11276
11285
  };
11277
11286
  class Store {
11278
11287
  constructor(storeOptions) {
@@ -11313,7 +11322,7 @@ class Store {
11313
11322
  var _a;
11314
11323
  let key = id2;
11315
11324
  if (serverPagination) {
11316
- key = id2 + "#p" + serverPagination.limit + "?o" + serverPagination.offset;
11325
+ key = appendServerPaginationToIri(key, serverPagination);
11317
11326
  }
11318
11327
  if (serverSearch) {
11319
11328
  key = appendServerSearchToIri(key, serverSearch);
@@ -11423,7 +11432,7 @@ class Store {
11423
11432
  key = key + parentId;
11424
11433
  if (key === id2 && resource2["@type"] == this.getExpandedPredicate("ldp:Container", clientContext)) {
11425
11434
  if (serverPagination)
11426
- key = key + "#p" + serverPagination.limit + "?o" + serverPagination.offset;
11435
+ key = appendServerPaginationToIri(key, serverPagination);
11427
11436
  if (serverSearch)
11428
11437
  key = appendServerSearchToIri(key, serverSearch);
11429
11438
  }
@@ -11559,7 +11568,10 @@ class Store {
11559
11568
  *
11560
11569
  * @returns Resource (Proxy) if in the cache, null otherwise
11561
11570
  */
11562
- get(id2, serverSearch) {
11571
+ get(id2, serverPagination, serverSearch) {
11572
+ if (serverPagination) {
11573
+ id2 = appendServerPaginationToIri(id2, serverPagination);
11574
+ }
11563
11575
  if (serverSearch) {
11564
11576
  id2 = appendServerSearchToIri(id2, serverSearch);
11565
11577
  }
@@ -11936,9 +11948,8 @@ const ServerPaginationMixin = {
11936
11948
  this.updateNavButtons(resourceId, index, 1);
11937
11949
  await this.fetchData(this.dataSrc);
11938
11950
  },
11939
- updateNavButtons(resourceId, index, variance) {
11951
+ async updateNavButtons(resourceId, index, variance) {
11940
11952
  this.element.querySelector("[data-id='prev']").disabled = this.currentOffset[index] <= 0;
11941
- this.element.querySelector("[data-id='next']").disabled = this.currentOffset[index] * this.limit >= this.pageCount;
11942
11953
  this.element.querySelector("[data-id='current']").innerText = this.getCurrentServedPage(resourceId, variance);
11943
11954
  },
11944
11955
  getServerNavElement(div2) {
@@ -11950,6 +11961,7 @@ const ServerPaginationMixin = {
11950
11961
  },
11951
11962
  getCurrentServedPage(context2, variance) {
11952
11963
  this.currentPage[context2] = Number(this.currentPage[context2]) + variance;
11964
+ this.pageNumber = this.currentPage[context2];
11953
11965
  return this.currentPage[context2];
11954
11966
  },
11955
11967
  /**
@@ -11980,18 +11992,15 @@ const ServerPaginationMixin = {
11980
11992
  ?disabled=${currentOffset <= 0}
11981
11993
  @click=${() => this.decreaseCurrentOffset(resourceId)}
11982
11994
  >←</button>
11995
+ <span data-id="current">
11996
+ ${currentPageNumber}
11997
+ </span>
11983
11998
  <button
11984
11999
  data-id="next"
11985
12000
  ?disabled=${currentOffset >= (pageCount - 1) * this.limit}
11986
12001
  @click=${() => this.increaseCurrentOffset(resourceId)}
11987
12002
  >→</button>
11988
12003
  <span>
11989
- <span data-id="current">
11990
- ${currentPageNumber}
11991
- </span> /
11992
- <span data-id="count">
11993
- ${this.pageCount}
11994
- </span>
11995
12004
  </span>
11996
12005
  `, div2);
11997
12006
  }
@@ -12059,15 +12068,13 @@ const StoreMixin = {
12059
12068
  get resource() {
12060
12069
  var _a;
12061
12070
  let id2 = this.resourceId;
12062
- if (this.limit) {
12063
- id2 = this.resourceId + "#p" + this.limit + "?o" + this.offset;
12064
- }
12071
+ const serverPagination = formatAttributesToServerPaginationOptions(this.element.attributes);
12065
12072
  const serverSearch = mergeServerSearchOptions(
12066
12073
  formatAttributesToServerSearchOptions(this.element.attributes),
12067
12074
  (_a = this.getDynamicServerSearch) == null ? void 0 : _a.call(this)
12068
12075
  // from `filterMixin`
12069
12076
  );
12070
- return id2 ? store.get(id2, serverSearch) : null;
12077
+ return id2 ? store.get(id2, serverPagination, serverSearch) : null;
12071
12078
  },
12072
12079
  get loader() {
12073
12080
  return this.loaderId ? document.getElementById(this.loaderId) : null;
@@ -12691,12 +12698,15 @@ const MultipleselectFormMixin = {
12691
12698
  setDataSrc(value, listValueTransformations) {
12692
12699
  if (value && value !== this.dataSrc) {
12693
12700
  try {
12694
- if (Array.isArray(JSON.parse(value))) {
12695
- this.setValue(JSON.parse(value));
12701
+ let values = JSON.parse(value);
12702
+ if (values && Array.isArray(values)) {
12703
+ this.setValue(values);
12704
+ } else {
12705
+ this.setValue([value]);
12696
12706
  }
12697
12707
  } catch (ex) {
12698
12708
  this.dataSrc = value;
12699
- console.log("Not an array", ex);
12709
+ this.setValue([{ "@id": value }]);
12700
12710
  }
12701
12711
  }
12702
12712
  const nextProcessor = listValueTransformations.shift();
@@ -12874,7 +12884,7 @@ const FederationMixin = {
12874
12884
  return [];
12875
12885
  const newResources = [];
12876
12886
  const getChildResources = async (res) => {
12877
- var _a, _b;
12887
+ var _a;
12878
12888
  if (!res)
12879
12889
  return;
12880
12890
  if ((_a = res.isContainer) == null ? void 0 : _a.call(res)) {
@@ -12885,10 +12895,6 @@ const FederationMixin = {
12885
12895
  if (resourcesFetched)
12886
12896
  newResources.push(...await this.getResources(resourcesFetched));
12887
12897
  }
12888
- } else if (!((_b = res.isArray) == null ? void 0 : _b.call(res))) {
12889
- const resource = await store.getData(res["@id"], this.context);
12890
- if (resource)
12891
- newResources.push(resource);
12892
12898
  } else {
12893
12899
  newResources.push(res);
12894
12900
  }
@@ -51134,6 +51140,10 @@ const WidgetMixin = {
51134
51140
  var _a, _b;
51135
51141
  if (resource && !((_a = resource.isContainer) == null ? void 0 : _a.call(resource))) {
51136
51142
  let fieldValue = await resource[field];
51143
+ if (fieldValue === null || fieldValue === void 0 || fieldValue === "") {
51144
+ let expandedPredicate = sibStore.getExpandedPredicate(field, this.context);
51145
+ fieldValue = await resource[expandedPredicate];
51146
+ }
51137
51147
  if (fieldValue === null || fieldValue === void 0 || fieldValue === "")
51138
51148
  return void 0;
51139
51149
  if (Array.isArray(fieldValue) && !fieldValue["ldp:contains"]) {