@hybridcore/ui 1.4.24 → 1.4.25

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.
@@ -1,88 +1,107 @@
1
- import { jsx as a, Fragment as p } from "react/jsx-runtime";
2
- import u from "lodash";
3
- import { CollapsibleCard as v } from "../collapsible-card/index.js";
4
- import h from "./property.js";
5
- const N = ({
6
- values: o,
7
- templates: d,
8
- inputVariant: c,
9
- fieldOptions: s,
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import s from "lodash";
3
+ import { CollapsibleCard as I } from "../collapsible-card/index.js";
4
+ import p from "./property.js";
5
+ import { Box as c } from "@mui/material";
6
+ const b = ({
7
+ values: a,
8
+ templates: m,
9
+ inputVariant: h,
10
+ fieldOptions: i,
10
11
  onChange: g
11
12
  }) => {
12
- const m = (f) => (n) => {
13
- if (f) {
14
- let e = o.find((r) => r.templateKey === f);
13
+ const y = (o) => (t) => {
14
+ if (o) {
15
+ let e = a.find((r) => r.templateKey === o);
15
16
  if (e) {
16
- const r = u.keys(n)[0];
17
- let t = e.filters.findIndex(
18
- (l) => l.fieldName === r
17
+ const r = s.keys(t)[0];
18
+ let l = e.filters.findIndex(
19
+ (n) => n.fieldName === r
19
20
  );
20
- const i = u.get(n, r);
21
- u.values(i).filter((l) => !(u.isArray(l) && l.length === 0 || l === "")).length === 0 && t !== -1 ? e.filters.splice(t, 1) : t !== -1 ? e.filters[t] = {
21
+ const f = s.get(t, r);
22
+ s.values(f).filter((n) => !(s.isArray(n) && n.length === 0 || n === "")).length === 0 && l !== -1 ? e.filters.splice(l, 1) : l !== -1 ? e.filters[l] = {
22
23
  fieldName: r,
23
- value: i
24
+ value: f
24
25
  } : e.filters.push({
25
26
  fieldName: r,
26
- value: i
27
+ value: f
27
28
  });
28
29
  }
29
- g(o);
30
+ g(a);
30
31
  } else console.warn("Template could not be found!");
31
32
  };
32
- if (o.length === 1) {
33
- const f = o[0], n = d.get(f.templateKey);
34
- return /* @__PURE__ */ a(p, { children: n == null ? void 0 : n.properties.filter((e) => {
33
+ if (a.length === 1) {
34
+ const o = a[0], t = m.get(o.templateKey);
35
+ return /* @__PURE__ */ d(c, { display: "flex", flexDirection: "column", children: t == null ? void 0 : t.properties.filter((e) => {
35
36
  var r;
36
- return s ? !((r = s[e.propertyId]) != null && r.hidden) : !0;
37
+ return i ? !((r = i[e.propertyId]) != null && r.hidden) : !0;
37
38
  }).map((e, r) => {
38
- let t = {};
39
- const i = f.filters.find(
40
- (l) => l.fieldName === e.propertyId
39
+ var n;
40
+ let l = {};
41
+ const f = o.filters.find(
42
+ (u) => u.fieldName === e.propertyId
41
43
  );
42
- return i && (t = i.value), /* @__PURE__ */ a(
43
- h,
44
+ return f && (l = f.value), /* @__PURE__ */ d(
45
+ c,
44
46
  {
45
- property: e,
46
- value: t,
47
- size: "small",
48
- variant: c,
49
- onChange: m(n == null ? void 0 : n.templateKey)
50
- },
51
- r
47
+ ...i && ((n = i[e.propertyId]) == null ? void 0 : n.order) && {
48
+ order: i[e.propertyId].order
49
+ },
50
+ children: /* @__PURE__ */ d(
51
+ p,
52
+ {
53
+ property: e,
54
+ value: l,
55
+ size: "small",
56
+ variant: h,
57
+ onChange: y(t == null ? void 0 : t.templateKey)
58
+ },
59
+ r
60
+ )
61
+ }
52
62
  );
53
63
  }) });
54
64
  }
55
- return o.map((f, n) => {
56
- const e = d.get(f.templateKey);
57
- return /* @__PURE__ */ a(
58
- v,
65
+ return a.map((o, t) => {
66
+ const e = m.get(o.templateKey);
67
+ return /* @__PURE__ */ d(
68
+ I,
59
69
  {
60
70
  header: e == null ? void 0 : e.name,
61
- content: /* @__PURE__ */ a(p, { children: e == null ? void 0 : e.properties.filter((r) => {
62
- var t;
63
- return s ? !((t = s[r.propertyId]) != null && t.hidden) : !0;
64
- }).map((r, t) => {
65
- let i = {};
66
- const l = f.filters.find(
67
- (y) => y.fieldName === r.propertyId
71
+ content: /* @__PURE__ */ d(c, { display: "flex", flexDirection: "column", children: e == null ? void 0 : e.properties.filter((r) => {
72
+ var l;
73
+ return i ? !((l = i[r.propertyId]) != null && l.hidden) : !0;
74
+ }).map((r, l) => {
75
+ var u;
76
+ let f = {};
77
+ const n = o.filters.find(
78
+ (x) => x.fieldName === r.propertyId
68
79
  );
69
- return l && (i = l.value), /* @__PURE__ */ a(
70
- h,
80
+ return n && (f = n.value), /* @__PURE__ */ d(
81
+ c,
71
82
  {
72
- property: r,
73
- value: i,
74
- size: "small",
75
- variant: c,
76
- onChange: m(e == null ? void 0 : e.templateKey)
77
- },
78
- t
83
+ ...i && ((u = i[r.propertyId]) == null ? void 0 : u.order) && {
84
+ order: i[r.propertyId].order
85
+ },
86
+ children: /* @__PURE__ */ d(
87
+ p,
88
+ {
89
+ property: r,
90
+ value: f,
91
+ size: "small",
92
+ variant: h,
93
+ onChange: y(e == null ? void 0 : e.templateKey)
94
+ },
95
+ l
96
+ )
97
+ }
79
98
  );
80
99
  }) })
81
100
  },
82
- n
101
+ t
83
102
  );
84
103
  });
85
104
  };
86
105
  export {
87
- N as TemplatePropertyFilters
106
+ b as TemplatePropertyFilters
88
107
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.4.24",
4
+ "version": "1.4.25",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",