@hybridcore/ui 1.5.85 → 1.5.86

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,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.86",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",