@plitzi/sdk-elements 0.32.5 → 0.32.6

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.
@@ -10,74 +10,75 @@ import { StoreProvider as d } from "@plitzi/nexus/react";
10
10
  import { emptyObject as f, getPathsFromObeject as p } from "@plitzi/sdk-shared/helpers/utils";
11
11
  import { jsx as m } from "react/jsx-runtime";
12
12
  import h from "clsx";
13
- import g from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
14
- import { QueryBuilderEvaluator as _ } from "@plitzi/plitzi-ui/QueryBuilder";
13
+ import g from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
14
+ import _ from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
15
+ import { QueryBuilderEvaluator as v } from "@plitzi/plitzi-ui/QueryBuilder";
15
16
  //#region src/elements/provider/ApiContainer/ApiContainer.tsx
16
- var v = ({ ref: r, className: v = "", children: y, query: b = "", method: x = "get", accessToken: S = "", when: C = f, headers: w = f, mockData: T = "{}", subType: E = "div", credentials: D = "same-origin" }) => {
17
- let { id: O, definition: { label: k = "Api Container" } } = e(), { settings: { previewMode: A, debugMode: j }, contexts: { NavigationContext: M, InteractionsContext: N } } = c(), { interactionsManager: P } = i(N), { routeParams: F, queryParams: I } = i(M), L = s(() => {
18
- if (!b) return "";
17
+ var y = ({ ref: r, className: y = "", children: b, query: x = "", method: S = "get", accessToken: C = "", when: w = f, headers: T = f, mockData: E = "{}", subType: D = "div", credentials: O = "same-origin" }) => {
18
+ let { id: k, idRef: A, definition: { label: j = "Api Container" } } = e(), M = g("apiContainer", { idRef: A }), { settings: { previewMode: N, debugMode: P }, contexts: { NavigationContext: F, InteractionsContext: I } } = c(), { interactionsManager: L } = i(I), { routeParams: R, queryParams: z } = i(F), B = s(() => {
19
+ if (!x) return "";
19
20
  try {
20
21
  let e = {
21
- ...I,
22
- ...F
22
+ ...z,
23
+ ...R
23
24
  };
24
- j && [...b.matchAll(/{{([ ]+|)(?<token>[a-zA-Z0-9-_:*/]+)([ ]+|)}}/gim)].forEach(({ groups: t }) => {
25
+ P && [...x.matchAll(/{{([ ]+|)(?<token>[a-zA-Z0-9-_:*/]+)([ ]+|)}}/gim)].forEach(({ groups: t }) => {
25
26
  let n = t?.token.trim();
26
27
  (!n || !l(e, n)) && console.log(`Token ${n} is required`);
27
28
  });
28
- let t = u(b, e, !0);
29
- return typeof t == "string" ? t : b;
29
+ let t = u(x, e, !0);
30
+ return typeof t == "string" ? t : x;
30
31
  } catch (e) {
31
32
  console.error(e.message);
32
33
  }
33
34
  return "";
34
35
  }, [
35
- b,
36
- I,
37
- F,
38
- j
39
- ]), R = s(() => S ? {
40
- ...w,
41
- Authorization: `Bearer ${S}`
42
- } : w, [w, S]), z = s(() => !!(A && L && (C === f || _(C, {
43
- ...F,
44
- ...I
45
- })) || !A && (L || T && T !== "{}" && T !== f)), [
46
- A,
47
- L,
48
- C,
49
- F,
50
- I,
51
- T
52
- ]), { isLoading: B, data: V, refetch: H, isSuccess: U, isError: W } = n({
53
- url: L,
54
- method: x,
55
- credentials: D,
56
- mock: A ? void 0 : T,
57
- customHeaders: R,
58
- enabled: z
36
+ x,
37
+ z,
38
+ R,
39
+ P
40
+ ]), V = s(() => C ? {
41
+ ...T,
42
+ Authorization: `Bearer ${C}`
43
+ } : T, [T, C]), H = s(() => !!(N && B && (w === f || v(w, {
44
+ ...R,
45
+ ...z
46
+ })) || !N && (B || E && E !== "{}" && E !== f)), [
47
+ N,
48
+ B,
49
+ w,
50
+ R,
51
+ z,
52
+ E
53
+ ]), { isLoading: U, data: W, refetch: G, isSuccess: K, isError: q } = n({
54
+ url: B,
55
+ method: S,
56
+ credentials: O,
57
+ mock: N ? void 0 : E,
58
+ customHeaders: V,
59
+ enabled: H
59
60
  });
60
61
  o(() => {
61
- B || (U ? P.interactionTrigger(O, "onApiSuccess", {
62
- url: L,
63
- method: x,
64
- ...V
65
- }) : W && P.interactionTrigger(O, "onApiError", {
66
- url: L,
67
- method: x,
68
- ...V
62
+ U || !A || (K ? L.interactionTrigger(A, "onApiSuccess", {
63
+ url: B,
64
+ method: S,
65
+ ...W
66
+ }) : q && L.interactionTrigger(A, "onApiError", {
67
+ url: B,
68
+ method: S,
69
+ ...W
69
70
  }));
70
71
  }, [
71
- V,
72
- O,
73
- P,
74
72
  W,
75
- B,
73
+ A,
74
+ L,
75
+ q,
76
76
  U,
77
- x,
78
- L
77
+ K,
78
+ S,
79
+ B
79
80
  ]);
80
- let G = a(() => p(V).reduce((e, t) => {
81
+ let J = a(() => p(W).reduce((e, t) => {
81
82
  let n = t.split(".");
82
83
  return n.length > 1 ? [...e, {
83
84
  path: t,
@@ -86,21 +87,21 @@ var v = ({ ref: r, className: v = "", children: y, query: b = "", method: x = "g
86
87
  path: t,
87
88
  name: n[n.length - 1]
88
89
  }];
89
- }, []), [V]);
90
- g({
91
- id: O,
92
- source: `apiContainer_${O}`,
93
- name: k || `API - ${O}`,
94
- fields: G
90
+ }, []), [W]);
91
+ _({
92
+ id: k,
93
+ source: M,
94
+ name: j || `API - ${k}`,
95
+ fields: J
95
96
  });
96
- let K = s(() => ({ performQuery: {
97
+ let Y = s(() => ({ performQuery: {
97
98
  action: "performQuery",
98
- title: `Perform Query ${k}`,
99
+ title: `Perform Query ${j}`,
99
100
  type: "callback",
100
- callback: H,
101
+ callback: G,
101
102
  preview: {},
102
103
  params: {}
103
- } }), [k, H]), q = s(() => ({
104
+ } }), [j, G]), X = s(() => ({
104
105
  onApiError: {
105
106
  action: "onApiError",
106
107
  title: "On Api Error",
@@ -125,19 +126,20 @@ var v = ({ ref: r, className: v = "", children: y, query: b = "", method: x = "g
125
126
  data: ""
126
127
  }
127
128
  }
128
- }), []), J = s(() => ({ runtime: { sources: { [`apiContainer_${O}`]: V } } }), [V, O]);
129
+ }), []), Z = s(() => M ? { runtime: { sources: { [M]: W } } } : f, [W, M]);
129
130
  return /* @__PURE__ */ m(t, {
130
131
  ref: r,
131
- tag: E,
132
- className: h("plitzi-component__api-container", v),
133
- interactionTriggers: q,
134
- interactionCallbacks: K,
132
+ tag: D,
133
+ className: h("plitzi-component__api-container", y),
134
+ interactionTriggers: X,
135
+ interactionCallbacks: Y,
135
136
  children: /* @__PURE__ */ m(d, {
136
137
  inherit: "live",
137
- value: J,
138
- children: !B && y
138
+ name: `Api:${k}`,
139
+ value: Z,
140
+ children: !U && b
139
141
  })
140
142
  });
141
- }, y = r(v);
143
+ }, b = r(y);
142
144
  //#endregion
143
- export { v as ApiContainer, y as default };
145
+ export { y as ApiContainer, b as default };
@@ -5,20 +5,22 @@ import r from "../../../Element/hocs/withElement.mjs";
5
5
  import { useCallback as i, useMemo as a } from "react";
6
6
  import o from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
7
7
  import { StoreProvider as s } from "@plitzi/nexus/react";
8
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import u from "clsx";
10
- import d from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
8
+ import { emptyObject as c } from "@plitzi/sdk-shared/helpers/utils";
9
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
+ import d from "clsx";
11
+ import f from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
12
+ import p from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
11
13
  //#region src/elements/provider/CollectionContainer/CollectionContainer.tsx
12
- var f = ({ ref: r, className: f = "", source: p = "", children: m, limit: h = "10", query: g, singleRecord: _ = !1 }) => {
13
- let { id: v, definition: { label: y = "Collection Container" } } = e(), { settings: { previewMode: b } } = o(), { loading: x, collection: S, fetch: C } = n({
14
- source: p,
15
- limit: h,
16
- query: g,
17
- singleRecord: _,
18
- previewMode: b
19
- }), w = i(() => {
14
+ var m = ({ ref: r, className: m = "", source: h = "", children: g, limit: _ = "10", query: v, singleRecord: y = !1 }) => {
15
+ let { id: b, idRef: x, definition: { label: S = "Collection Container" } } = e(), C = f("collectionContainer", { idRef: x }), { settings: { previewMode: w } } = o(), { loading: T, collection: E, fetch: D } = n({
16
+ source: h,
17
+ limit: _,
18
+ query: v,
19
+ singleRecord: y,
20
+ previewMode: w
21
+ }), O = i(() => {
20
22
  let e = [];
21
- return S ? (_ || e.push({
23
+ return E ? (y || e.push({
22
24
  path: "records",
23
25
  name: "Records"
24
26
  }), e.push({
@@ -27,40 +29,41 @@ var f = ({ ref: r, className: f = "", source: p = "", children: m, limit: h = "1
27
29
  }), e.push({
28
30
  path: "record.status",
29
31
  name: "Record Status"
30
- }), Object.values(S.fields).forEach((t) => {
32
+ }), Object.values(E.fields).forEach((t) => {
31
33
  e.push({
32
34
  path: `record.values.${t.machineName}`,
33
35
  name: `Record Field - ${t.name}`
34
36
  });
35
37
  }), e) : [];
36
- }, [S, _]);
37
- d({
38
- id: v,
39
- source: `collectionContainer_${v}`,
40
- name: y || `Collection - ${S?.name || v}`,
41
- fields: w
38
+ }, [E, y]);
39
+ p({
40
+ id: b,
41
+ source: C,
42
+ name: S || `Collection - ${E?.name || b}`,
43
+ fields: O
42
44
  });
43
- let T = a(() => ({ performQuery: {
45
+ let k = a(() => ({ performQuery: {
44
46
  action: "performQuery",
45
- title: `Refresh ${y}`,
47
+ title: `Refresh ${S}`,
46
48
  type: "callback",
47
- callback: C,
49
+ callback: D,
48
50
  preview: {},
49
51
  params: {}
50
- } }), [C, y]), E = a(() => ({ runtime: { sources: { [`collectionContainer_${v}`]: S } } }), [S, v]);
51
- if (!(!S && b)) return /* @__PURE__ */ l(t, {
52
+ } }), [D, S]), A = a(() => C ? { runtime: { sources: { [C]: E } } } : c, [E, C]);
53
+ if (!(!E && w)) return /* @__PURE__ */ u(t, {
52
54
  ref: r,
53
- interactionCallbacks: T,
54
- className: u("plitzi-component__collection-container", f, { "collection-container--context-empty": !S }),
55
- children: [!S && /* @__PURE__ */ c("div", {
55
+ interactionCallbacks: k,
56
+ className: d("plitzi-component__collection-container", m, { "collection-container--context-empty": !E }),
57
+ children: [!E && /* @__PURE__ */ l("div", {
56
58
  className: "collection-container__message",
57
59
  children: "Source Not Selected"
58
- }), S && !x && /* @__PURE__ */ c(s, {
60
+ }), E && !T && /* @__PURE__ */ l(s, {
59
61
  inherit: "live",
60
- value: E,
61
- children: m
62
+ name: `Collection:${b}`,
63
+ value: A,
64
+ children: g
62
65
  })]
63
66
  });
64
- }, p = r(f);
67
+ }, h = r(m);
65
68
  //#endregion
66
- export { f as CollectionContainer, p as default };
69
+ export { m as CollectionContainer, h as default };
@@ -4,71 +4,72 @@ import n from "../../../Element/hocs/withElement.mjs";
4
4
  import { use as r, useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
5
5
  import c from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
6
6
  import { StoreProvider as l } from "@plitzi/nexus/react";
7
- import { getPathsFromObeject as u } from "@plitzi/sdk-shared/helpers/utils";
8
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
- import p from "clsx";
10
- import m from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
7
+ import { emptyObject as u, getPathsFromObeject as d } from "@plitzi/sdk-shared/helpers/utils";
8
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
+ import m from "clsx";
10
+ import h from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
11
+ import g from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
11
12
  //#region src/elements/structure/DialogContainer/DialogContainer.tsx
12
- var h = ({ ref: n, className: h = "", children: g, headerLabel: _ = "Dialog Header", acceptButtonLabel: v = "Accept", acceptButtonLabelLoading: y = "Loading...", rejectButtonLabel: b = "Cancel", autoHideAfterClick: x = !0 }) => {
13
- let { id: S, setElementState: C, definition: { styleSelectors: w, label: T = "Dialog" }, elementState: E } = e(), { contexts: { InteractionsContext: D } } = c(), { interactionsManager: O } = r(D), [k, A] = s({}), [j, M] = s(!1), N = i((e) => {
13
+ var _ = ({ ref: n, className: _ = "", children: v, headerLabel: y = "Dialog Header", acceptButtonLabel: b = "Accept", acceptButtonLabelLoading: x = "Loading...", rejectButtonLabel: S = "Cancel", autoHideAfterClick: C = !0 }) => {
14
+ let { id: w, idRef: T, setElementState: E, definition: { styleSelectors: D, label: O = "Dialog" }, elementState: k } = e(), A = h("dialogContainer", { idRef: T }), { contexts: { InteractionsContext: j } } = c(), { interactionsManager: M } = r(j), [N, P] = s({}), [F, I] = s(!1), L = i((e) => {
14
15
  let { metadata: t } = e;
15
- if (t && typeof t == "object") A(t);
16
+ if (t && typeof t == "object") P(t);
16
17
  else if (typeof t == "string") try {
17
- A(JSON.parse(t));
18
+ P(JSON.parse(t));
18
19
  } catch {
19
- A({ content: t });
20
+ P({ content: t });
20
21
  }
21
- else A(typeof t == "boolean" || typeof t == "number" ? { content: t } : {});
22
- C((e) => ({
22
+ else P(typeof t == "boolean" || typeof t == "number" ? { content: t } : {});
23
+ E((e) => ({
23
24
  ...e,
24
25
  visibility: !0
25
26
  }));
26
- }, [C, A]), P = i(() => {
27
- O.interactionTrigger(S, "onDialogClose", { metadata: k }), A({}), C((e) => ({
27
+ }, [E, P]), R = i(() => {
28
+ M.interactionTrigger(T, "onDialogClose", { metadata: N }), P({}), E((e) => ({
28
29
  ...e,
29
30
  visibility: !1
30
31
  }));
31
32
  }, [
32
- O,
33
- C,
34
- A,
35
- k,
36
- S
37
- ]), F = i(() => {
38
- x && (O.interactionTrigger(S, "onDialogClose", { metadata: k }), A({}), C((e) => ({
33
+ M,
34
+ E,
35
+ P,
36
+ N,
37
+ T
38
+ ]), z = i(() => {
39
+ C && (M.interactionTrigger(T, "onDialogClose", { metadata: N }), P({}), E((e) => ({
39
40
  ...e,
40
41
  visibility: !1
41
42
  })));
42
43
  }, [
43
- O,
44
- x,
44
+ M,
45
45
  C,
46
- A,
47
- k,
48
- S
46
+ E,
47
+ P,
48
+ N,
49
+ T
49
50
  ]);
50
51
  i(async () => {
51
- M(!0), await O.interactionTrigger(S, "onDialogAccept", { metadata: k }), M(!1), C((e) => ({
52
+ I(!0), await M.interactionTrigger(T, "onDialogAccept", { metadata: N }), I(!1), E((e) => ({
52
53
  ...e,
53
54
  visibility: !1
54
55
  }));
55
56
  }, [
56
- O,
57
- S,
58
- k,
59
- C
57
+ M,
58
+ T,
59
+ N,
60
+ E
60
61
  ]), i(async () => {
61
- M(!0), await O.interactionTrigger(S, "onDialogReject", { metadata: k }), M(!1), C((e) => ({
62
+ I(!0), await M.interactionTrigger(T, "onDialogReject", { metadata: N }), I(!1), E((e) => ({
62
63
  ...e,
63
64
  visibility: !1
64
65
  }));
65
66
  }, [
66
- O,
67
- S,
68
- k,
69
- C
67
+ M,
68
+ T,
69
+ N,
70
+ E
70
71
  ]);
71
- let I = o(() => ({
72
+ let B = o(() => ({
72
73
  onDialogAccept: {
73
74
  action: "onDialogAccept",
74
75
  title: "On Dialog Accept",
@@ -109,12 +110,12 @@ var h = ({ ref: n, className: h = "", children: g, headerLabel: _ = "Dialog Head
109
110
  } },
110
111
  preview: { metadata: "" }
111
112
  }
112
- }), []), L = o(() => ({
113
+ }), []), V = o(() => ({
113
114
  openDialog: {
114
115
  action: "openDialog",
115
- title: `Open ${T}`,
116
+ title: `Open ${O}`,
116
117
  type: "callback",
117
- callback: N,
118
+ callback: L,
118
119
  params: { metadata: {
119
120
  type: "text",
120
121
  defaultValue: ""
@@ -123,26 +124,26 @@ var h = ({ ref: n, className: h = "", children: g, headerLabel: _ = "Dialog Head
123
124
  },
124
125
  closeDialog: {
125
126
  action: "closeDialog",
126
- title: `Close ${T}`,
127
+ title: `Close ${O}`,
127
128
  type: "callback",
128
- callback: P,
129
+ callback: R,
129
130
  preview: {},
130
131
  params: {}
131
132
  }
132
133
  }), [
133
- P,
134
- N,
135
- T
134
+ R,
135
+ L,
136
+ O
136
137
  ]);
137
138
  a(() => {
138
- E.visibility !== !1 && O.interactionTrigger(S, "onDialogOpen", { metadata: k });
139
+ k.visibility !== !1 && M.interactionTrigger(T, "onDialogOpen", { metadata: N });
139
140
  }, [
140
- S,
141
- O,
142
- k,
143
- E.visibility
141
+ T,
142
+ M,
143
+ N,
144
+ k.visibility
144
145
  ]);
145
- let R = i(() => typeof k == "object" ? u(k).reduce((e, t) => {
146
+ let H = i(() => typeof N == "object" ? d(N).reduce((e, t) => {
146
147
  let n = t.split(".");
147
148
  return n.length > 1 ? [...e, {
148
149
  path: t,
@@ -151,64 +152,65 @@ var h = ({ ref: n, className: h = "", children: g, headerLabel: _ = "Dialog Head
151
152
  path: t,
152
153
  name: n[n.length - 1]
153
154
  }];
154
- }, []) : [], [k]);
155
- m({
156
- id: S,
157
- source: `dialogContainer_${S}`,
158
- name: T || `Dialog - ${S}`,
159
- fields: R
155
+ }, []) : [], [N]);
156
+ g({
157
+ id: w,
158
+ source: A,
159
+ name: O || `Dialog - ${w}`,
160
+ fields: H
160
161
  });
161
- let z = o(() => ({ runtime: { sources: { [`dialogContainer_${S}`]: k } } }), [S, k]);
162
- return /* @__PURE__ */ f(t, {
162
+ let U = o(() => A ? { runtime: { sources: { [A]: N } } } : u, [A, N]);
163
+ return /* @__PURE__ */ p(t, {
163
164
  ref: n,
164
- className: p("plitzi-component__dialog-container", h),
165
- interactionTriggers: I,
166
- interactionCallbacks: L,
167
- children: [/* @__PURE__ */ d("div", {
168
- className: p("dialog-container__background", w.backgroundContainer),
169
- onClick: F
170
- }), /* @__PURE__ */ f("div", {
171
- className: p("dialog-container__root", w.rootContainer),
165
+ className: m("plitzi-component__dialog-container", _),
166
+ interactionTriggers: B,
167
+ interactionCallbacks: V,
168
+ children: [/* @__PURE__ */ f("div", {
169
+ className: m("dialog-container__background", D.backgroundContainer),
170
+ onClick: z
171
+ }), /* @__PURE__ */ p("div", {
172
+ className: m("dialog-container__root", D.rootContainer),
172
173
  children: [
173
- /* @__PURE__ */ f("div", {
174
- className: p("dialog-container__header", w.headerContainer),
175
- children: [/* @__PURE__ */ d("div", {
176
- className: p("dialog-container__header__title", w.headerTitle),
177
- children: _ || "Dialog Header"
178
- }), /* @__PURE__ */ d("i", {
174
+ /* @__PURE__ */ p("div", {
175
+ className: m("dialog-container__header", D.headerContainer),
176
+ children: [/* @__PURE__ */ f("div", {
177
+ className: m("dialog-container__header__title", D.headerTitle),
178
+ children: y || "Dialog Header"
179
+ }), /* @__PURE__ */ f("i", {
179
180
  className: "fa-solid fa-xmark",
180
181
  title: "Close",
181
182
  onClick: void 0
182
183
  })]
183
184
  }),
184
- /* @__PURE__ */ d("div", {
185
- className: p("dialog-container__body", w.body),
186
- children: /* @__PURE__ */ d(l, {
185
+ /* @__PURE__ */ f("div", {
186
+ className: m("dialog-container__body", D.body),
187
+ children: /* @__PURE__ */ f(l, {
187
188
  inherit: "live",
188
- value: z,
189
- children: g
189
+ name: `Dialog:${w}`,
190
+ value: U,
191
+ children: v
190
192
  })
191
193
  }),
192
- /* @__PURE__ */ f("div", {
193
- className: p("dialog-container__footer", w.footerContainer),
194
- children: [/* @__PURE__ */ f("button", {
195
- className: p("footer__button button--accept", w.acceptButton),
194
+ /* @__PURE__ */ p("div", {
195
+ className: m("dialog-container__footer", D.footerContainer),
196
+ children: [/* @__PURE__ */ p("button", {
197
+ className: m("footer__button button--accept", D.acceptButton),
196
198
  onClick: void 0,
197
- disabled: j,
198
- children: [j && /* @__PURE__ */ f("div", {
199
+ disabled: F,
200
+ children: [F && /* @__PURE__ */ p("div", {
199
201
  className: "button--accept__container",
200
- children: [/* @__PURE__ */ d("i", { className: "fa-solid fa-rotate fa-spin" }), y]
201
- }), !j && v]
202
- }), /* @__PURE__ */ d("button", {
203
- className: p("footer__button button--cancel", w.cancelButton),
202
+ children: [/* @__PURE__ */ f("i", { className: "fa-solid fa-rotate fa-spin" }), x]
203
+ }), !F && b]
204
+ }), /* @__PURE__ */ f("button", {
205
+ className: m("footer__button button--cancel", D.cancelButton),
204
206
  onClick: void 0,
205
- disabled: j,
206
- children: b
207
+ disabled: F,
208
+ children: S
207
209
  })]
208
210
  })
209
211
  ]
210
212
  })]
211
213
  });
212
- }, g = n(h);
214
+ }, v = n(_);
213
215
  //#endregion
214
- export { h as DialogContainer, g as default };
216
+ export { _ as DialogContainer, v as default };
@@ -5,48 +5,50 @@ import { useCallback as r, useMemo as i } from "react";
5
5
  import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
6
6
  import { get as o } from "@plitzi/plitzi-ui/helpers";
7
7
  import { StoreProvider as s } from "@plitzi/nexus/react";
8
- import { getPathsFromObeject as c } from "@plitzi/sdk-shared/helpers/utils";
9
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
- import d from "clsx";
11
- import f from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
8
+ import { emptyObject as c, getPathsFromObeject as l } from "@plitzi/sdk-shared/helpers/utils";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ import f from "clsx";
11
+ import p from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
12
+ import m from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
12
13
  //#region src/elements/structure/List/modes/ListControlled/ListControlled.tsx
13
- var p = ({ ref: p, className: m = "", children: h, items: g = [] }) => {
14
- let { id: _, definition: { label: v } } = e(), { settings: { previewMode: y } } = a(), b = i(() => Array.isArray(g) ? g : [], [g]), x = r(() => c({
15
- item: o(b, "0", {}),
14
+ var h = ({ ref: h, className: g = "", children: _, items: v = [] }) => {
15
+ let { id: y, idRef: b, definition: { label: x } } = e(), S = p("list", { idRef: b }), { settings: { previewMode: C } } = a(), w = i(() => Array.isArray(v) ? v : [], [v]), T = r(() => l({
16
+ item: o(w, "0", {}),
16
17
  index: "0"
17
18
  }).reduce((e, t) => [...e, {
18
19
  path: t,
19
20
  name: t
20
- }], []), [b]), S = i(() => ({ runtime: { sources: { [`list_${_}`]: { items: b } } } }), [_, b]);
21
- return f({
22
- id: _,
23
- source: `list_${_}`,
24
- name: v || `List - ${_}`,
25
- fields: x
26
- }), /* @__PURE__ */ u(t, {
27
- ref: p,
28
- className: d("plitzi-component__controlled-list", m, { "controlled-list--build-mode": !y }),
29
- children: [/* @__PURE__ */ l(s, {
21
+ }], []), [w]), E = i(() => S ? { runtime: { sources: { [S]: { items: w } } } } : c, [S, w]);
22
+ return m({
23
+ id: y,
24
+ source: S,
25
+ name: x || `List - ${y}`,
26
+ fields: T
27
+ }), /* @__PURE__ */ d(t, {
28
+ ref: h,
29
+ className: f("plitzi-component__controlled-list", g, { "controlled-list--build-mode": !C }),
30
+ children: [/* @__PURE__ */ u(s, {
30
31
  inherit: "live",
31
- value: S,
32
- children: b.map((e, t) => !h || Array.isArray(h) && h.length === 0 ? /* @__PURE__ */ l("div", {
32
+ name: `List:${y}`,
33
+ value: E,
34
+ children: w.map((e, t) => !_ || Array.isArray(_) && _.length === 0 ? /* @__PURE__ */ u("div", {
33
35
  className: "plitzi-component__controlled-list-item controlled-list--empty",
34
- children: /* @__PURE__ */ l("div", {
36
+ children: /* @__PURE__ */ u("div", {
35
37
  className: "controlled-list-item__counter",
36
38
  children: `List Item - ${t + 1}`
37
39
  })
38
- }, t) : /* @__PURE__ */ l(n, {
40
+ }, t) : /* @__PURE__ */ u(n, {
39
41
  itemCount: t + 1,
40
- isTemplate: t !== 0 && !y,
42
+ isTemplate: t !== 0 && !C,
41
43
  record: e,
42
- source: `list_${_}`,
43
- children: h
44
+ source: S,
45
+ children: _
44
46
  }, t))
45
- }), !y && b.length === 0 && /* @__PURE__ */ l("div", {
47
+ }), !C && w.length === 0 && /* @__PURE__ */ u("div", {
46
48
  className: "controlled-list controlled-list--empty",
47
49
  children: "This list does not contain any items"
48
50
  })]
49
51
  });
50
52
  };
51
53
  //#endregion
52
- export { p as default };
54
+ export { h as default };