@plitzi/sdk-elements 0.30.19 → 0.31.0

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