@startinblox/components-ds4go 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1354,7 +1354,14 @@ const Es = (e) => (bs(((t, i) => Rs(dr, t, i))), ee = lr = e.sourceLocale, ie =
1354
1354
  const m = n(c, u);
1355
1355
  return s ? -m : m;
1356
1356
  }), o;
1357
- }, St = (e) => e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).trim(), Si = /* @__PURE__ */ new Map(), js = (e) => {
1357
+ }, St = (e) => {
1358
+ const i = e.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()).trim().split(/\s+/), r = [];
1359
+ for (let s = 0; s < i.length; s++) {
1360
+ const o = i[s];
1361
+ o.replace(/[^a-zA-ZÀ-ÿ]/g, "").length === 1 ? s > 0 ? r[r.length - 1] += o : s < i.length - 1 ? (r.push(o + i[s + 1]), s++) : r.push(o) : r.push(o);
1362
+ }
1363
+ return r.join(" ");
1364
+ }, Si = /* @__PURE__ */ new Map(), js = (e) => {
1358
1365
  const t = JSON.stringify(e);
1359
1366
  let i = Si.get(t);
1360
1367
  return i || (i = new Intl.DateTimeFormat(void 0, e), Si.set(t, i)), i;
@@ -3985,10 +3992,14 @@ let Et = class extends F {
3985
3992
  type: i["dsif:costPerAPICall"] > 0 ? "warning" : "success"
3986
3993
  });
3987
3994
  }
3988
- return e.catalogTitle && t.push({ name: St(e.catalogTitle), type: "information" }), e.sectorName && t.push({ name: St(e.sectorName), type: "neutral" }), e["dspace:assetId"] && t.push({
3989
- name: e["dspace:assetId"].split(":").pop() || e["dspace:assetId"],
3990
- type: "neutral"
3991
- }), e["dsif:previewLinks"] && e["dsif:previewLinks"].length > 0 && t.push({
3995
+ if (e.catalogTitle && t.push({ name: St(e.catalogTitle), type: "information" }), e.sectorName && t.push({ name: St(e.sectorName), type: "neutral" }), e["dspace:assetId"]) {
3996
+ let i = e["dspace:assetId"].split(":").pop() || e["dspace:assetId"];
3997
+ i.length > 10 && (i = i.substring(0, 7) + "..."), t.push({
3998
+ name: i,
3999
+ type: "neutral"
4000
+ });
4001
+ }
4002
+ return e["dsif:previewLinks"] && e["dsif:previewLinks"].length > 0 && t.push({
3992
4003
  name: `${e["dsif:previewLinks"].length} previews`,
3993
4004
  type: "information"
3994
4005
  }), t;
@@ -4819,33 +4830,31 @@ let X = class extends T {
4819
4830
  </div>
4820
4831
  </div></tems-division
4821
4832
  >
4822
- <tems-button
4823
- @click=${this._toggleTechnicalInfo}
4824
- type="outline-gray"
4825
- label=${this.showTechnicalInfo ? l("Hide Technical Informations") : l("Show Technical Informations")}
4826
- ></tems-button>
4827
- ${this.showTechnicalInfo ? p`
4828
- <tems-division type="h4"
4829
- >${l("Technical informations")}</tems-division
4830
- >
4831
- ${this.contracts && this.contracts.length > 0 ? p`${this.contracts.map(
4833
+ ${this.contracts && this.contracts.length > 0 || this.negotiations && this.negotiations.length > 0 ? p`<tems-button
4834
+ @click=${this._toggleTechnicalInfo}
4835
+ type="outline-gray"
4836
+ label=${this.showTechnicalInfo ? l("Hide Technical Informations") : l("Show Technical Informations")}
4837
+ ></tems-button>
4838
+ ${this.showTechnicalInfo ? p`<tems-division type="h4"
4839
+ >${l("Technical informations")}</tems-division
4840
+ >
4841
+ ${this.contracts && this.contracts.length > 0 ? p`${this.contracts.map(
4832
4842
  (t) => p`<ds4go-contract-modal-part
4833
- .contract=${t}
4834
- .assets=${this.assets}
4835
- .policies=${this.policies}
4836
- ></ds4go-contract-modal-part>`
4843
+ .contract=${t}
4844
+ .assets=${this.assets}
4845
+ .policies=${this.policies}
4846
+ ></ds4go-contract-modal-part>`
4837
4847
  )}` : d}
4838
- ` : d}
4839
- ${this.negotiations && this.negotiations.length > 0 ? p`<ds4go-negotiations-modal-part
4840
- .negotiations=${this.negotiations}
4841
- .assets=${this.assets}
4842
- .type=${"PROVIDER"}
4843
- ></ds4go-negotiations-modal-part>
4844
- <ds4go-negotiations-modal-part
4845
- .negotiations=${this.negotiations}
4846
- .assets=${this.assets}
4847
- .type=${"CONSUMER"}
4848
- ></ds4go-negotiations-modal-part>` : d}
4848
+ ${this.negotiations && this.negotiations.length > 0 ? p`<ds4go-negotiations-modal-part
4849
+ .negotiations=${this.negotiations}
4850
+ .assets=${this.assets}
4851
+ .type=${"PROVIDER"}
4852
+ ></ds4go-negotiations-modal-part>
4853
+ <ds4go-negotiations-modal-part
4854
+ .negotiations=${this.negotiations}
4855
+ .assets=${this.assets}
4856
+ .type=${"CONSUMER"}
4857
+ ></ds4go-negotiations-modal-part>` : d}` : d}` : d}
4849
4858
  </div>
4850
4859
  </div>
4851
4860
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/components-ds4go",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Startin'blox DS4GO",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -199,10 +199,12 @@ export class Ds4goDsifExplorerPocHolder extends LitElement {
199
199
  }
200
200
 
201
201
  if (dataset["dspace:assetId"]) {
202
+ let assetId = dataset["dspace:assetId"].split(":").pop() || dataset["dspace:assetId"];
203
+ if(assetId.length > 10) {
204
+ assetId = assetId.substring(0, 7) + "...";
205
+ }
202
206
  tags.push({
203
- name:
204
- dataset["dspace:assetId"].split(":").pop() ||
205
- dataset["dspace:assetId"],
207
+ name: assetId,
206
208
  type: "neutral",
207
209
  });
208
210
  }
@@ -188,41 +188,42 @@ export class Ds4goFactBundleModal extends OrbitComponent {
188
188
  </div>
189
189
  </div></tems-division
190
190
  >
191
- <tems-button
192
- @click=${this._toggleTechnicalInfo}
193
- type="outline-gray"
194
- label=${this.showTechnicalInfo
195
- ? msg("Hide Technical Informations")
196
- : msg("Show Technical Informations")}
197
- ></tems-button>
198
- ${this.showTechnicalInfo
199
- ? html`
200
- <tems-division type="h4"
201
- >${msg("Technical informations")}</tems-division
202
- >
203
- ${this.contracts && this.contracts.length > 0
204
- ? html`${this.contracts.map(
205
- (contract: ContractDefinition) =>
206
- html`<ds4go-contract-modal-part
207
- .contract=${contract}
208
- .assets=${this.assets}
209
- .policies=${this.policies}
210
- ></ds4go-contract-modal-part>`,
211
- )}`
212
- : nothing}
213
- `
214
- : nothing}
215
- ${this.negotiations && this.negotiations.length > 0
216
- ? html`<ds4go-negotiations-modal-part
217
- .negotiations=${this.negotiations}
218
- .assets=${this.assets}
219
- .type=${"PROVIDER"}
220
- ></ds4go-negotiations-modal-part>
221
- <ds4go-negotiations-modal-part
222
- .negotiations=${this.negotiations}
223
- .assets=${this.assets}
224
- .type=${"CONSUMER"}
225
- ></ds4go-negotiations-modal-part>`
191
+ ${(this.contracts && this.contracts.length > 0) ||
192
+ (this.negotiations && this.negotiations.length > 0)
193
+ ? html`<tems-button
194
+ @click=${this._toggleTechnicalInfo}
195
+ type="outline-gray"
196
+ label=${this.showTechnicalInfo
197
+ ? msg("Hide Technical Informations")
198
+ : msg("Show Technical Informations")}
199
+ ></tems-button>
200
+ ${this.showTechnicalInfo
201
+ ? html`<tems-division type="h4"
202
+ >${msg("Technical informations")}</tems-division
203
+ >
204
+ ${this.contracts && this.contracts.length > 0
205
+ ? html`${this.contracts.map(
206
+ (contract: ContractDefinition) =>
207
+ html`<ds4go-contract-modal-part
208
+ .contract=${contract}
209
+ .assets=${this.assets}
210
+ .policies=${this.policies}
211
+ ></ds4go-contract-modal-part>`,
212
+ )}`
213
+ : nothing}
214
+ ${this.negotiations && this.negotiations.length > 0
215
+ ? html`<ds4go-negotiations-modal-part
216
+ .negotiations=${this.negotiations}
217
+ .assets=${this.assets}
218
+ .type=${"PROVIDER"}
219
+ ></ds4go-negotiations-modal-part>
220
+ <ds4go-negotiations-modal-part
221
+ .negotiations=${this.negotiations}
222
+ .assets=${this.assets}
223
+ .type=${"CONSUMER"}
224
+ ></ds4go-negotiations-modal-part>`
225
+ : nothing}`
226
+ : nothing}`
226
227
  : nothing}
227
228
  </div>
228
229
  </div>
@@ -1,8 +1,30 @@
1
1
  const formatCase = (str: string) => {
2
- return str
2
+ let result = str
3
3
  .replace(/([A-Z])/g, " $1")
4
- .replace(/^./, (str) => str.toUpperCase())
4
+ .replace(/^./, (s) => s.toUpperCase())
5
5
  .trim();
6
+
7
+ const words = result.split(/\s+/);
8
+ const mergedWords: string[] = [];
9
+
10
+ for (let i = 0; i < words.length; i++) {
11
+ const word = words[i];
12
+ const wordWithoutSpecialChars = word.replace(/[^a-zA-ZÀ-ÿ]/g, "");
13
+ if (wordWithoutSpecialChars.length === 1) {
14
+ if (i > 0) {
15
+ mergedWords[mergedWords.length - 1] += word;
16
+ } else if (i < words.length - 1) {
17
+ mergedWords.push(word + words[i + 1]);
18
+ i++;
19
+ } else {
20
+ mergedWords.push(word);
21
+ }
22
+ } else {
23
+ mergedWords.push(word);
24
+ }
25
+ }
26
+
27
+ return mergedWords.join(" ");
6
28
  };
7
29
 
8
30
  export default formatCase;