@startinblox/components-ds4go 3.0.2 → 3.0.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/index.js CHANGED
@@ -2423,28 +2423,24 @@ let b = class extends $ {
2423
2423
  }
2424
2424
  ], this._getResource = new rt(this, {
2425
2425
  task: async ([t, r, i]) => {
2426
- if (!(!t || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
2427
- if (!this.hasCachedDatas || this.oldDataSrc !== t) {
2428
- if (!t) return;
2429
- this.facts = await this._getProxyValue(t), this.hasCachedDatas = !0;
2430
- }
2431
- return this.oldDataSrc !== t && (this.oldDataSrc = t), Array.isArray(this.facts) || (this.facts = []), r ? S(
2432
- ae(
2433
- this.facts.filter(
2434
- (s) => !i.includes(s)
2435
- ),
2436
- r
2437
- ),
2438
- "name",
2439
- "asc"
2440
- ) : (i.length === 0 && (this.spliceLength = Math.floor((window.innerWidth - 800) / 354) * Math.floor((window.innerHeight - 255) / 500)), S(
2441
- this.facts.filter(
2442
- (s) => !this.selectedFacts.includes(s)
2443
- ),
2444
- "name",
2445
- "asc"
2446
- ));
2426
+ if (!t || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))
2427
+ return;
2428
+ if (!this.hasCachedDatas || this.oldDataSrc !== t) {
2429
+ if (!t) return;
2430
+ this.facts = await this._getProxyValue(t), this.hasCachedDatas = !0;
2447
2431
  }
2432
+ this.oldDataSrc !== t && (this.oldDataSrc = t), Array.isArray(this.facts) || (this.facts = []);
2433
+ const s = this.facts.filter(
2434
+ (o) => !i.includes(o)
2435
+ );
2436
+ if (r) {
2437
+ const o = ae(
2438
+ s,
2439
+ r
2440
+ );
2441
+ return o.length > 0 ? S(o, "name", "asc") : [];
2442
+ }
2443
+ return i.length === 0 && (this.spliceLength = Math.floor((window.innerWidth - 800) / 354) * Math.floor((window.innerHeight - 255) / 500)), s.length > 0 ? S(s, "name", "asc") : [];
2448
2444
  },
2449
2445
  args: () => [
2450
2446
  this.factsSrc,
@@ -2456,7 +2452,9 @@ let b = class extends $ {
2456
2452
  });
2457
2453
  }
2458
2454
  async _afterAttach() {
2459
- return this.dspConnector = this.orbit?.components.find((t) => t.type === "dsp-connector"), Promise.resolve();
2455
+ return this.dspConnector = this.orbit?.components.find(
2456
+ (t) => t.type === "dsp-connector"
2457
+ ), Promise.resolve();
2460
2458
  }
2461
2459
  _showMoreResults() {
2462
2460
  this.spliceLength += Math.floor((window.innerWidth - 800) / 354);
@@ -2557,7 +2555,9 @@ let b = class extends $ {
2557
2555
  a && a.loadData();
2558
2556
  }
2559
2557
  this.bundleName = "", this.bundleDescription = "", this.selectedFacts = [];
2560
- const i = this.orbit?.components.find((s) => s.type === "fact-bundle");
2558
+ const i = this.orbit?.components.find(
2559
+ (s) => s.type === "fact-bundle"
2560
+ );
2561
2561
  document.dispatchEvent(
2562
2562
  new CustomEvent("save", {
2563
2563
  detail: { resource: { "@id": i?.defaultDataSrc } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/components-ds4go",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Startin'blox DS4GO",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -73,7 +73,9 @@ export class SolidFactBundle extends OrbitComponent {
73
73
 
74
74
  async _afterAttach() {
75
75
  // use this.dspConnector.instance to reach the connector
76
- this.dspConnector = this.orbit?.components.find((c) => c.type === "dsp-connector");
76
+ this.dspConnector = this.orbit?.components.find(
77
+ (c) => c.type === "dsp-connector",
78
+ );
77
79
 
78
80
  return Promise.resolve();
79
81
  }
@@ -119,17 +121,19 @@ export class SolidFactBundle extends OrbitComponent {
119
121
  this.facts = [];
120
122
  }
121
123
 
124
+ const factsWithoutSelected = this.facts.filter(
125
+ (fact: Resource) => !selectedFacts.includes(fact),
126
+ );
127
+
122
128
  if (filterText) {
123
- return sort(
124
- filterObjectByValue(
125
- this.facts.filter(
126
- (fact: Resource) => !selectedFacts.includes(fact),
127
- ),
128
- filterText,
129
- ),
130
- "name",
131
- "asc",
129
+ const filteredFacts = filterObjectByValue(
130
+ factsWithoutSelected,
131
+ filterText,
132
132
  );
133
+ if (filteredFacts.length > 0) {
134
+ return sort(filteredFacts, "name", "asc");
135
+ }
136
+ return [];
133
137
  }
134
138
 
135
139
  if (selectedFacts.length === 0) {
@@ -138,13 +142,11 @@ export class SolidFactBundle extends OrbitComponent {
138
142
  Math.floor((window.innerHeight - 255) / 500);
139
143
  }
140
144
 
141
- return sort(
142
- this.facts.filter(
143
- (fact: Resource) => !this.selectedFacts.includes(fact),
144
- ),
145
- "name",
146
- "asc",
147
- );
145
+ if (factsWithoutSelected.length > 0) {
146
+ return sort(factsWithoutSelected, "name", "asc");
147
+ }
148
+
149
+ return [];
148
150
  },
149
151
  args: () => [
150
152
  this.factsSrc,
@@ -288,7 +290,9 @@ export class SolidFactBundle extends OrbitComponent {
288
290
  this.bundleDescription = "";
289
291
  this.selectedFacts = [];
290
292
 
291
- const factbundleComponent: any = this.orbit?.components.find((c) => c.type === "fact-bundle");
293
+ const factbundleComponent: any = this.orbit?.components.find(
294
+ (c) => c.type === "fact-bundle",
295
+ );
292
296
 
293
297
  document.dispatchEvent(
294
298
  new CustomEvent("save", {