@startinblox/components-ds4go 3.2.1 → 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/components-ds4go",
3
- "version": "3.2.1",
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
  }
@@ -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;