@plitzi/sdk-elements 0.37.7 → 0.37.9

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.
@@ -20,28 +20,28 @@ var l = 30, u = 300, d = (e) => !!e && e !== "{}" && e !== i, f = (e) => {
20
20
  data: e.message
21
21
  };
22
22
  }
23
- }, p = async (e, t, n, r, i) => {
23
+ }, p = async (e, t, n, r, i, s = !1) => {
24
24
  if (!e) return {
25
25
  status: 400,
26
26
  data: "URL is required"
27
27
  };
28
- let s = new Headers(r);
29
- s.has("Content-Type") || s.set("Content-Type", "application/json");
30
- let c = {
28
+ let c = new Headers(r);
29
+ c.has("Accept") || c.set("Accept", "application/json");
30
+ let l = {
31
31
  method: t,
32
32
  credentials: n,
33
- headers: s,
33
+ headers: c,
34
34
  signal: i
35
35
  };
36
- t !== "get" && (c.body = "{}");
36
+ t !== "get" && (l.body = "{}", c.has("Content-Type") || c.set("Content-Type", "application/json"));
37
37
  try {
38
- let t = await fetch(e, c), n = await t.json(), r = a(t.status, n);
39
- return r && o({
40
- reason: r,
38
+ let c = await fetch(e, l), u = await c.json(), d = a(c.status, u);
39
+ return d && await o({
40
+ reason: d,
41
41
  url: e
42
- }), {
43
- status: t.status,
44
- data: n
42
+ }) && !s && !i.aborted ? await p(e, t, n, r, i, !0) : {
43
+ status: c.status,
44
+ data: u
45
45
  };
46
46
  } catch (e) {
47
47
  if (i.aborted) throw e;
@@ -12,27 +12,30 @@ import p from "clsx";
12
12
  import m from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
13
13
  import h from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
14
14
  //#region src/elements/structure/List/modes/ListControlled/ListControlled.tsx
15
- var g = ({ ref: g, className: _ = "", children: v, items: y = [] }) => {
16
- let { id: b, definition: { label: x } } = e(), S = m(n.sourceType, b), { settings: { previewMode: C } } = o(), w = a(() => Array.isArray(y) ? y : [], [y]), T = i(() => u({
17
- item: s(w, "0", {}),
15
+ var g = (e) => {
16
+ let t = e.map((e) => typeof e == "object" && e && "id" in e && (typeof e.id == "string" || typeof e.id == "number") ? e.id : void 0);
17
+ return t.every((e) => e !== void 0) && new Set(t).size === t.length ? t.map((e) => `id:${String(e)}`) : e.map((e, t) => t);
18
+ }, _ = ({ ref: _, className: v = "", children: y, items: b = [] }) => {
19
+ let { id: x, definition: { label: S } } = e(), C = m(n.sourceType, x), { settings: { previewMode: w } } = o(), T = a(() => Array.isArray(b) ? b : [], [b]), E = a(() => g(T), [T]), D = i(() => u({
20
+ item: s(T, "0", {}),
18
21
  index: "0"
19
22
  }).reduce((e, t) => [...e, {
20
23
  path: t,
21
24
  name: t
22
- }], []), [w]), E = a(() => S ? { runtime: { sources: { [S]: { items: w } } } } : l, [S, w]);
25
+ }], []), [T]), O = a(() => C ? { runtime: { sources: { [C]: { items: T } } } } : l, [C, T]);
23
26
  return h({
24
- id: b,
25
- source: S,
26
- name: x || `List - ${b}`,
27
- fields: T
27
+ id: x,
28
+ source: C,
29
+ name: S || `List - ${x}`,
30
+ fields: D
28
31
  }), /* @__PURE__ */ f(t, {
29
- ref: g,
30
- className: p("plitzi-component__controlled-list", _, { "controlled-list--build-mode": !C }),
32
+ ref: _,
33
+ className: p("plitzi-component__controlled-list", v, { "controlled-list--build-mode": !w }),
31
34
  children: [/* @__PURE__ */ d(c, {
32
35
  inherit: "live",
33
- name: `List:${b}`,
34
- value: E,
35
- children: w.map((e, t) => !v || Array.isArray(v) && v.length === 0 ? /* @__PURE__ */ d("div", {
36
+ name: `List:${x}`,
37
+ value: O,
38
+ children: T.map((e, t) => !y || Array.isArray(y) && y.length === 0 ? /* @__PURE__ */ d("div", {
36
39
  className: "plitzi-component__controlled-list-item controlled-list--empty",
37
40
  children: /* @__PURE__ */ d("div", {
38
41
  className: "controlled-list-item__counter",
@@ -40,16 +43,16 @@ var g = ({ ref: g, className: _ = "", children: v, items: y = [] }) => {
40
43
  })
41
44
  }, t) : /* @__PURE__ */ d(r, {
42
45
  index: t,
43
- isTemplate: t !== 0 && !C,
46
+ isTemplate: t !== 0 && !w,
44
47
  record: e,
45
- source: S,
46
- children: v
47
- }, t))
48
- }), !C && w.length === 0 && /* @__PURE__ */ d("div", {
48
+ source: C,
49
+ children: y
50
+ }, E[t]))
51
+ }), !w && T.length === 0 && /* @__PURE__ */ d("div", {
49
52
  className: "controlled-list controlled-list--empty",
50
53
  children: "This list does not contain any items"
51
54
  })]
52
55
  });
53
56
  };
54
57
  //#endregion
55
- export { g as default };
58
+ export { _ as default };
package/dist/index.d.ts CHANGED
@@ -323,12 +323,11 @@ export declare const defaultElements: {
323
323
  readonly attributes: {
324
324
  readonly referenceType: "element";
325
325
  readonly referenceId: "";
326
- readonly referenceContainer: "";
327
326
  };
328
327
  readonly definition: {
329
328
  readonly label: "Reference";
330
329
  readonly type: "reference";
331
- readonly description: "Reuses another element or template by id, rendering it in place.";
330
+ readonly description: "Places one of the components of the space, or renders another of its elements by id, in place.";
332
331
  readonly items: readonly [];
333
332
  readonly bindings: {};
334
333
  readonly styleSelectors: {
@@ -368,9 +367,8 @@ export declare const defaultElements: {
368
367
  readonly settings: {};
369
368
  };
370
369
  } & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
371
- referenceType: import('@plitzi/sdk-shared').ElementLayoutType;
372
370
  referenceId: string;
373
- referenceContainer: string;
371
+ referenceType: "element" | "component";
374
372
  }>>;
375
373
  blockHtml: {
376
374
  (props: import('./Element/hocs/withElement').WithElementProps<import('./elements/advanced/BlockHtml/BlockHtml').BlockHtmlProps>): import('react').JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-elements",
3
- "version": "0.37.7",
3
+ "version": "0.37.9",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -266,6 +266,10 @@
266
266
  "types": "./dist/elements/advanced/Reference/index.d.ts",
267
267
  "import": "./dist/elements/advanced/Reference/index.mjs"
268
268
  },
269
+ "./elements/advanced/Reference/PropField": {
270
+ "types": "./dist/elements/advanced/Reference/PropField.d.ts",
271
+ "import": "./dist/elements/advanced/Reference/PropField.mjs"
272
+ },
269
273
  "./elements/advanced/Reference/Reference": {
270
274
  "types": "./dist/elements/advanced/Reference/Reference.d.ts",
271
275
  "import": "./dist/elements/advanced/Reference/Reference.mjs"
@@ -1076,15 +1080,15 @@
1076
1080
  "type": "module",
1077
1081
  "sideEffects": false,
1078
1082
  "dependencies": {
1079
- "@plitzi/nexus": "^1.3.1",
1080
- "@plitzi/plitzi-ui": "^1.6.24",
1081
- "@plitzi/sdk-auth": "0.37.7",
1082
- "@plitzi/sdk-dev-tools": "0.37.7",
1083
- "@plitzi/sdk-event-bridge": "0.37.7",
1084
- "@plitzi/sdk-interactions": "0.37.7",
1085
- "@plitzi/sdk-navigation": "0.37.7",
1086
- "@plitzi/sdk-schema": "0.37.7",
1087
- "@plitzi/sdk-shared": "0.37.7",
1083
+ "@plitzi/nexus": "^1.4.0",
1084
+ "@plitzi/plitzi-ui": "^1.6.26",
1085
+ "@plitzi/sdk-auth": "0.37.9",
1086
+ "@plitzi/sdk-dev-tools": "0.37.9",
1087
+ "@plitzi/sdk-event-bridge": "0.37.9",
1088
+ "@plitzi/sdk-interactions": "0.37.9",
1089
+ "@plitzi/sdk-navigation": "0.37.9",
1090
+ "@plitzi/sdk-schema": "0.37.9",
1091
+ "@plitzi/sdk-shared": "0.37.9",
1088
1092
  "clsx": "^2.1.1",
1089
1093
  "immer": "^11.1.18"
1090
1094
  },