@hybridcore/ui 1.5.85 → 1.5.87

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,43 +1,43 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { Box as t, Skeleton as n, Typography as a } from "@mui/material";
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { Box as r, Skeleton as t, Typography as l } from "@mui/material";
3
3
  import { AlternateCardRoot as b, AlternateCardMenuContainer as v } from "./styled.js";
4
- const g = ({
5
- title: d,
6
- subTitle: h,
7
- text: l,
8
- avatar: s,
9
- footer: p,
10
- menu: m,
11
- extra: x,
4
+ const y = ({
5
+ title: p,
6
+ subTitle: d,
7
+ text: o,
8
+ avatar: h,
9
+ footer: c,
10
+ menu: s,
11
+ extra: w,
12
12
  loading: i,
13
- rightMenu: w,
14
- onClick: o
13
+ rightMenu: x,
14
+ onClick: a
15
15
  }) => {
16
- const c = () => {
17
- o && o();
16
+ const m = () => {
17
+ a && a();
18
18
  };
19
- return /* @__PURE__ */ r(
19
+ return /* @__PURE__ */ n(
20
20
  b,
21
21
  {
22
22
  sx: {
23
23
  display: "flex"
24
24
  },
25
25
  children: [
26
- /* @__PURE__ */ r(t, { flex: 1, children: [
27
- m && /* @__PURE__ */ e(v, { className: "menu-container", children: m }),
28
- /* @__PURE__ */ r(t, { display: "flex", alignItems: "center", children: [
29
- s && /* @__PURE__ */ e(t, { mr: 2, children: i ? /* @__PURE__ */ e(
30
- n,
26
+ /* @__PURE__ */ n(r, { flex: 1, children: [
27
+ s && /* @__PURE__ */ e(v, { className: "menu-container", children: s }),
28
+ /* @__PURE__ */ n(r, { display: "flex", alignItems: "center", children: [
29
+ h && /* @__PURE__ */ e(r, { mr: 2, children: i ? /* @__PURE__ */ e(
30
+ t,
31
31
  {
32
32
  animation: "wave",
33
33
  variant: "circular",
34
34
  width: 42,
35
35
  height: 42
36
36
  }
37
- ) : s }),
38
- /* @__PURE__ */ r(t, { width: "100%", children: [
37
+ ) : h }),
38
+ /* @__PURE__ */ n(r, { width: "100%", sx: { minWidth: 0 }, children: [
39
39
  i ? /* @__PURE__ */ e(
40
- n,
40
+ t,
41
41
  {
42
42
  animation: "wave",
43
43
  height: 10,
@@ -45,7 +45,7 @@ const g = ({
45
45
  sx: { mb: 0.25, mt: 0.35 }
46
46
  }
47
47
  ) : /* @__PURE__ */ e(
48
- a,
48
+ l,
49
49
  {
50
50
  gutterBottom: !0,
51
51
  variant: "subtitle1",
@@ -57,15 +57,17 @@ const g = ({
57
57
  display: "-webkit-box",
58
58
  WebkitLineClamp: 3,
59
59
  WebkitBoxOrient: "vertical",
60
- cursor: o ? "pointer" : "default",
61
- lineHeight: "22px"
60
+ cursor: a ? "pointer" : "default",
61
+ lineHeight: "22px",
62
+ overflowWrap: "break-word",
63
+ wordBreak: "break-word"
62
64
  },
63
- onClick: c,
64
- children: d
65
+ onClick: m,
66
+ children: p
65
67
  }
66
68
  ),
67
- h && (i ? /* @__PURE__ */ e(
68
- n,
69
+ d && (i ? /* @__PURE__ */ e(
70
+ t,
69
71
  {
70
72
  animation: "wave",
71
73
  height: 10,
@@ -73,7 +75,7 @@ const g = ({
73
75
  sx: { mb: 0.25, mt: 0.35 }
74
76
  }
75
77
  ) : /* @__PURE__ */ e(
76
- a,
78
+ l,
77
79
  {
78
80
  variant: "caption",
79
81
  component: "p",
@@ -84,17 +86,19 @@ const g = ({
84
86
  display: "-webkit-box",
85
87
  WebkitLineClamp: 4,
86
88
  WebkitBoxOrient: "vertical",
87
- lineHeight: "16px"
89
+ lineHeight: "16px",
90
+ overflowWrap: "break-word",
91
+ wordBreak: "break-word"
88
92
  },
89
- children: h
93
+ children: d
90
94
  }
91
95
  ))
92
96
  ] })
93
97
  ] }),
94
- i ? /* @__PURE__ */ r(t, { children: [
95
- /* @__PURE__ */ e(n, { animation: "wave", height: 10, sx: { mb: 0.5, mt: 0.5 } }),
98
+ i ? /* @__PURE__ */ n(r, { children: [
99
+ /* @__PURE__ */ e(t, { animation: "wave", height: 10, sx: { mb: 0.5, mt: 0.5 } }),
96
100
  /* @__PURE__ */ e(
97
- n,
101
+ t,
98
102
  {
99
103
  animation: "wave",
100
104
  height: 10,
@@ -103,7 +107,7 @@ const g = ({
103
107
  }
104
108
  )
105
109
  ] }) : /* @__PURE__ */ e(
106
- a,
110
+ l,
107
111
  {
108
112
  variant: "caption",
109
113
  component: "p",
@@ -115,29 +119,31 @@ const g = ({
115
119
  WebkitLineClamp: 4,
116
120
  WebkitBoxOrient: "vertical",
117
121
  lineHeight: "16px",
118
- cursor: o ? "pointer" : "default",
119
- my: 2
122
+ cursor: a ? "pointer" : "default",
123
+ my: 2,
124
+ overflowWrap: "break-word",
125
+ wordBreak: "break-word"
120
126
  },
121
- onClick: c,
122
- children: /* @__PURE__ */ e("small", { children: typeof l == "string" ? l.length > 350 ? `${l.substring(0, 350)}...` : l : null })
127
+ onClick: m,
128
+ children: /* @__PURE__ */ e("small", { children: typeof o == "string" ? o.length > 350 ? `${o.substring(0, 350)}...` : o : null })
123
129
  }
124
130
  ),
125
131
  i ? /* @__PURE__ */ e(
126
- n,
132
+ t,
127
133
  {
128
134
  animation: "wave",
129
135
  height: 10,
130
136
  width: "100px",
131
137
  sx: { mb: 1, mt: 1 }
132
138
  }
133
- ) : p,
134
- i ? null : x
139
+ ) : c,
140
+ i ? null : w
135
141
  ] }),
136
- /* @__PURE__ */ e(t, { children: w })
142
+ /* @__PURE__ */ e(r, { children: x })
137
143
  ]
138
144
  }
139
145
  );
140
146
  };
141
147
  export {
142
- g as CardAlternate
148
+ y as CardAlternate
143
149
  };
@@ -1,21 +1,22 @@
1
- import { styled as a, Card as t, Box as o } from "@mui/material";
2
- const r = a(t, {
1
+ import { styled as i, Card as t, Box as n } from "@mui/material";
2
+ const r = i(t, {
3
3
  name: "SNAlternateCard",
4
4
  // The component name
5
5
  slot: "root"
6
6
  // The slot name
7
- })(({ theme: i }) => ({
7
+ })(({ theme: a }) => ({
8
8
  position: "relative",
9
9
  display: "flex",
10
- padding: i.spacing(3),
11
- gap: i.spacing(2),
10
+ padding: a.spacing(3),
11
+ paddingTop: a.spacing(6),
12
+ gap: a.spacing(2),
12
13
  "& .MuiCardMedia-root": {
13
- borderRadius: i.shape.borderRadius
14
+ borderRadius: a.shape.borderRadius
14
15
  },
15
16
  "& .MuiCardContent-root, & .MuiCardContent-root:last-child": {
16
17
  display: "flex",
17
18
  flex: 1,
18
- gap: i.spacing(3),
19
+ gap: a.spacing(3),
19
20
  padding: 0,
20
21
  margin: 0
21
22
  },
@@ -23,7 +24,7 @@ const r = a(t, {
23
24
  visibility: "visible",
24
25
  opacity: 1
25
26
  }
26
- })), e = a(o, {
27
+ })), e = i(n, {
27
28
  name: "SNAlternateCard",
28
29
  slot: "menuContainer"
29
30
  })(() => ({
@@ -31,6 +32,9 @@ const r = a(t, {
31
32
  top: 8,
32
33
  right: 8,
33
34
  display: "flex",
35
+ flexWrap: "wrap",
36
+ gap: 8,
37
+ alignItems: "center",
34
38
  visibility: "hidden",
35
39
  opacity: 0,
36
40
  transition: "0.3s all"
@@ -1,29 +1,31 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useMemo as m } from "react";
1
+ import { jsx as m } from "react/jsx-runtime";
3
2
  import s from "lodash";
4
- import n from "./variable.js";
5
- const c = ({
3
+ import { useMemo as n } from "react";
4
+ import h from "./variable.js";
5
+ const $ = ({
6
6
  template: r,
7
- data: t
7
+ data: t,
8
+ fieldOptions: p
8
9
  }) => {
9
- const p = m(() => {
10
+ const a = n(() => {
10
11
  let e = /* @__PURE__ */ new Map();
11
12
  return r.properties.forEach((o) => {
12
- const a = `${r.type}-${r.templateKey}-${o.propertyId}`;
13
- e.set(a, o);
13
+ const i = `${r.type}-${r.templateKey}-${o.propertyId}`;
14
+ e.set(i, o);
14
15
  }), e;
15
16
  }, [r]);
16
- return s.keys(t.variables).map((e, o) => /* @__PURE__ */ i(
17
- n,
17
+ return s.keys(t.variables).map((e, o) => /* @__PURE__ */ m(
18
+ h,
18
19
  {
19
20
  type: e,
20
21
  data: s.get(t.variables, e),
21
- properties: p,
22
- hashPrefix: `${t.template.type}-${t.template.templateKey}-`
22
+ properties: a,
23
+ hashPrefix: `${t.template.type}-${t.template.templateKey}-`,
24
+ fieldOptions: p
23
25
  },
24
26
  o
25
27
  ));
26
28
  };
27
29
  export {
28
- c as InstanceVariableList
30
+ $ as InstanceVariableList
29
31
  };
@@ -1,9 +1,9 @@
1
- import { jsx as n, Fragment as V, jsxs as a } from "react/jsx-runtime";
2
- import { Box as f } from "@mui/material";
3
- import Y from "dayjs";
4
- import x from "lodash";
5
- import { VariableRoot as j, VariableRow as d, VariableTitle as h, VariableValue as m } from "./styled.js";
6
- const D = [
1
+ import { jsx as a, Fragment as x, jsxs as m } from "react/jsx-runtime";
2
+ import { Box as i } from "@mui/material";
3
+ import V from "dayjs";
4
+ import Y from "lodash";
5
+ import { VariableRoot as v, VariableRow as g, VariableTitle as h, VariableValue as f } from "./styled.js";
6
+ const T = [
7
7
  "string",
8
8
  "boolean",
9
9
  "date",
@@ -15,44 +15,69 @@ const D = [
15
15
  "list",
16
16
  "text",
17
17
  "composite-list"
18
- ], i = ({ title: r, value: e }) => /* @__PURE__ */ a(d, { children: [
19
- /* @__PURE__ */ n(h, { variant: "subtitle2", children: r }),
20
- /* @__PURE__ */ n(m, { variant: "body2", children: e })
21
- ] }), s = ({ title: r, value: e }) => /* @__PURE__ */ n(i, { title: r, value: e }), T = ({ title: r, value: e }) => /* @__PURE__ */ n(i, { title: r, value: e ? "Yes" : "No" }), B = ({ title: r, value: e }) => {
22
- const u = Y(e).format("DD/MM/YYYY");
23
- return /* @__PURE__ */ n(i, { title: r, value: u });
24
- }, g = ({ title: r, value: e }) => {
25
- const u = (e ?? []).join(", ");
26
- return /* @__PURE__ */ n(i, { title: r, value: u });
27
- }, E = ({ title: r, value: e }) => /* @__PURE__ */ a(d, { children: [
28
- /* @__PURE__ */ n(h, { variant: "subtitle2", children: r }),
29
- /* @__PURE__ */ n(m, { variant: "body2", children: /* @__PURE__ */ n("a", { href: e, target: "_blank", rel: "noopener noreferrer", children: e }) })
18
+ ], b = ({ title: e, value: r }) => /* @__PURE__ */ m(g, { children: [
19
+ /* @__PURE__ */ a(h, { variant: "subtitle2", children: e }),
20
+ /* @__PURE__ */ a(f, { variant: "body2", children: r })
21
+ ] }), j = ({ title: e, value: r }) => /* @__PURE__ */ a(b, { title: e, value: r }), D = ({ title: e, value: r }) => /* @__PURE__ */ a(b, { title: e, value: r ? "Yes" : "No" }), k = ({ title: e, value: r }) => {
22
+ const n = V(r).format("DD/MM/YYYY");
23
+ return /* @__PURE__ */ a(b, { title: e, value: n });
24
+ }, B = ({ title: e, value: r }) => {
25
+ const n = (r ?? []).join(", ");
26
+ return /* @__PURE__ */ a(b, { title: e, value: n });
27
+ }, E = ({ title: e, value: r }) => /* @__PURE__ */ m(g, { children: [
28
+ /* @__PURE__ */ a(h, { variant: "subtitle2", children: e }),
29
+ /* @__PURE__ */ a(f, { variant: "body2", children: /* @__PURE__ */ a("a", { href: r, target: "_blank", rel: "noopener noreferrer", children: r }) })
30
30
  ] });
31
+ function _(e, r, n, t) {
32
+ if (t != null && t.component) return t.component;
33
+ if (t != null && t.clickable) return /* @__PURE__ */ a(E, { title: n, value: r });
34
+ switch (e) {
35
+ case "string":
36
+ case "byte":
37
+ case "double":
38
+ case "integer":
39
+ case "long":
40
+ case "enum":
41
+ case "text":
42
+ return /* @__PURE__ */ a(j, { title: n, value: r });
43
+ case "boolean":
44
+ return /* @__PURE__ */ a(D, { title: n, value: r });
45
+ case "date":
46
+ return /* @__PURE__ */ a(k, { title: n, value: r });
47
+ case "list":
48
+ case "composite-list":
49
+ return /* @__PURE__ */ a(B, { title: n, value: r });
50
+ default:
51
+ return null;
52
+ }
53
+ }
31
54
  function R({
32
- type: r,
33
- data: e,
34
- filter: u,
35
- properties: c,
36
- hashPrefix: v
55
+ type: e,
56
+ data: r,
57
+ filter: n,
58
+ properties: t,
59
+ hashPrefix: d,
60
+ fieldOptions: s
37
61
  }) {
38
- return r === "geometry" ? /* @__PURE__ */ n(V, {}) : /* @__PURE__ */ n(j, { children: x.keys(e).filter((l) => {
39
- const t = c.get(v + l);
40
- return t && !t.visible ? !1 : u === void 0 || u === "" || l.includes(u);
41
- }).map((l, t) => {
42
- const b = c.get(v + l), o = b ? b.name : "";
43
- return D.includes(r) ? /* @__PURE__ */ a(f, { mb: 1, className: "variable", children: [
44
- r === "string" && l === "url" ? /* @__PURE__ */ n(E, { title: o, value: e[l] }) : r === "string" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
45
- r === "boolean" && /* @__PURE__ */ n(T, { title: o, value: e[l] }),
46
- r === "date" && /* @__PURE__ */ n(B, { title: o, value: e[l] }),
47
- r === "byte" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
48
- r === "double" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
49
- r === "integer" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
50
- r === "long" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
51
- r === "enum" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
52
- r === "list" && /* @__PURE__ */ n(g, { title: o, value: e[l] }),
53
- r === "text" && /* @__PURE__ */ n(s, { title: o, value: e[l] }),
54
- r === "composite-list" && /* @__PURE__ */ n(g, { title: o, value: e[l] })
55
- ] }, t) : /* @__PURE__ */ n(f, {}, t);
62
+ return e === "geometry" ? /* @__PURE__ */ a(x, {}) : /* @__PURE__ */ a(v, { children: Y.keys(r).filter((l) => {
63
+ var o;
64
+ const u = t.get(d + l);
65
+ return u && !u.visible || (o = s == null ? void 0 : s[l]) != null && o.hidden ? !1 : n === void 0 || n === "" || l.includes(n);
66
+ }).map((l, u) => {
67
+ const o = t.get(d + l), y = o ? o.name : "", c = s == null ? void 0 : s[l];
68
+ return T.includes(e) ? /* @__PURE__ */ m(
69
+ i,
70
+ {
71
+ mb: 1,
72
+ className: "variable",
73
+ ...(c == null ? void 0 : c.order) && { order: c.order },
74
+ children: [
75
+ _(e, r[l], y, c),
76
+ c == null ? void 0 : c.helperText
77
+ ]
78
+ },
79
+ u
80
+ ) : /* @__PURE__ */ a(i, {}, u);
56
81
  }) });
57
82
  }
58
83
  export {
package/dist/main.d.ts CHANGED
@@ -283,6 +283,7 @@ declare interface FieldOptions {
283
283
  order?: number;
284
284
  hidden?: boolean;
285
285
  disabled?: boolean;
286
+ clickable?: boolean;
286
287
  minDate?: Dayjs;
287
288
  helperText?: React.ReactNode;
288
289
  placeholder?: string;
@@ -551,6 +552,9 @@ export declare const InstanceVariableList: FC<InstanceVariableListProps>;
551
552
  export declare interface InstanceVariableListProps {
552
553
  template: ONTOLOGY.TemplateType;
553
554
  data: INSTANCE.InstanceType;
555
+ fieldOptions?: {
556
+ [key: string]: FieldOptions;
557
+ };
554
558
  }
555
559
 
556
560
  declare interface ItemProps {
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.5.85",
4
+ "version": "1.5.87",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",