@hybridcore/ui 1.3.5 → 1.3.7

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.
@@ -3,33 +3,33 @@ import { useMemo as C } from "react";
3
3
  import { FormControl as D, InputLabel as F, Select as I, MenuItem as $, FormHelperText as j } from "@mui/material";
4
4
  import { hasDataAccess as a } from "../../access/helpers.js";
5
5
  const p = ({
6
- ontologyId: s,
6
+ ontologyId: g,
7
7
  appRoles: f,
8
8
  templateKeys: e,
9
9
  templateType: o,
10
10
  securityLevels: l,
11
- value: g,
12
- minLevel: i = 99,
11
+ value: S,
12
+ minLevel: t = 99,
13
13
  minLevelId: c,
14
- minLevelRoles: t,
15
- showError: h,
16
- variant: d = "standard",
17
- onChange: S
14
+ minLevelRoles: i,
15
+ showError: d,
16
+ variant: h = "outlined",
17
+ onChange: b
18
18
  }) => {
19
- const b = C(() => {
20
- if (t && t.length > 0) {
21
- for (let r of t)
19
+ const s = C(() => {
20
+ if (i && i.length > 0) {
21
+ for (let r of i)
22
22
  if (a(r, "SUPER_ADMIN", f))
23
- return i;
23
+ return t;
24
24
  }
25
25
  if (e && e.length > 0 && o) {
26
26
  for (let r of e)
27
27
  if (a(
28
- `${s}.${o}.${r}`,
28
+ `${g}.${o}.${r}`,
29
29
  "SUPER_ADMIN",
30
30
  f
31
31
  ))
32
- return i;
32
+ return t;
33
33
  }
34
34
  if (c && l.length > 0) {
35
35
  const r = l.find(
@@ -37,26 +37,25 @@ const p = ({
37
37
  );
38
38
  if (r) return r.level;
39
39
  }
40
- return i;
40
+ return t;
41
41
  }, [
42
- i,
42
+ t,
43
43
  c,
44
44
  l,
45
- t,
45
+ i,
46
46
  e,
47
47
  o
48
48
  ]), x = (r) => {
49
- S(r.target.value);
49
+ b(r.target.value);
50
50
  };
51
51
  return /* @__PURE__ */ m(A, { children: [
52
52
  /* @__PURE__ */ m(
53
53
  D,
54
54
  {
55
55
  fullWidth: !0,
56
- variant: d,
57
- error: h,
58
- size: d === "outlined" ? "small" : "medium",
59
- sx: { ...d === "outlined" && { mt: 1 } },
56
+ variant: h,
57
+ error: d,
58
+ sx: { ...h === "outlined" && { mt: 1 } },
60
59
  children: [
61
60
  /* @__PURE__ */ n(F, { id: "security-level-label", children: "Security Level *" }),
62
61
  /* @__PURE__ */ n(
@@ -65,15 +64,15 @@ const p = ({
65
64
  label: "Security Level *",
66
65
  labelId: "security-level-label",
67
66
  id: "demo-simple-select",
68
- value: g,
67
+ value: S,
69
68
  onChange: x,
70
- children: l.filter((r) => r.level <= b).map((r, u) => /* @__PURE__ */ n($, { value: r.id, children: r.name }, u))
69
+ children: l.filter((r) => r.level <= s).map((r, u) => /* @__PURE__ */ n($, { value: r.id, children: r.name }, u))
71
70
  }
72
71
  )
73
72
  ]
74
73
  }
75
74
  ),
76
- h && /* @__PURE__ */ n(j, { error: !0, children: "This field is required!" })
75
+ d && /* @__PURE__ */ n(j, { error: !0, children: "This field is required!" })
77
76
  ] });
78
77
  };
79
78
  export {
@@ -1,103 +1,125 @@
1
- import { jsxs as l, Fragment as w, jsx as e } from "react/jsx-runtime";
2
- import { useState as T, useMemo as y } from "react";
3
- import { Stack as d, IconButton as F, Menu as P, MenuItem as E } from "@mui/material";
4
- import { DatePicker as B } from "@mui/x-date-pickers";
5
- import h from "dayjs";
6
- import f from "lodash";
7
- import { PatternFormat as I } from "react-number-format";
8
- import { Schedule as Z } from "@mui/icons-material";
9
- import $ from "../../hooks/useMenuLogic.js";
10
- const K = ({
11
- value: g,
12
- name: Y,
13
- minDate: D,
14
- variant: M,
15
- size: H = "small",
16
- minuteStep: m = 30,
17
- pattern: S = "##:##:##",
18
- onChange: c
1
+ import { jsxs as d, Fragment as w, jsx as e } from "react/jsx-runtime";
2
+ import { useState as y, useMemo as F } from "react";
3
+ import { useTheme as P, Stack as B, Box as E, IconButton as I, Menu as R, MenuItem as Z } from "@mui/material";
4
+ import { DatePicker as $ } from "@mui/x-date-pickers";
5
+ import g from "dayjs";
6
+ import Y from "lodash";
7
+ import { PatternFormat as j } from "react-number-format";
8
+ import { Schedule as v } from "@mui/icons-material";
9
+ import z from "../../hooks/useMenuLogic.js";
10
+ const Q = ({
11
+ value: c,
12
+ name: D,
13
+ minDate: M,
14
+ variant: r,
15
+ label: x,
16
+ size: b = "small",
17
+ minuteStep: a = 30,
18
+ pattern: C = "##:##:##",
19
+ onChange: p
19
20
  }) => {
20
- const r = $(), [o, p] = T(h(g)), v = y(() => {
21
+ const n = z(), [o, u] = y(c ? g(c) : null), h = P(), H = F(() => {
21
22
  let t = [];
22
- for (let n = 0; n < 24; n++)
23
- for (let i = 0; i < 60 / m; i++) {
24
- const a = f.padStart(n.toString(), 2, "0"), s = f.padStart(
25
- (i * m).toString(),
23
+ for (let i = 0; i < 24; i++)
24
+ for (let s = 0; s < 60 / a; s++) {
25
+ const l = Y.padStart(i.toString(), 2, "0"), m = Y.padStart(
26
+ (s * a).toString(),
26
27
  2,
27
28
  "0"
28
- ), k = `${a}:${s}`;
29
+ ), k = `${l}:${m}`;
29
30
  t.push(k);
30
31
  }
31
32
  return t;
32
- }, [m]), x = (t) => {
33
- t && (p(t), c(t.format("YYYY-MM-DDTHH:mm:ssZ")));
34
- }, u = (t) => {
35
- const [n, i, a] = t.target.value.split(":");
36
- let s = h(o).set("hour", n ?? 0).set("m", i ?? 0).set("s", a ?? 0);
37
- p(s), c(s.format("YYYY-MM-DDTHH:mm:ssZ"));
38
- }, C = (t) => () => {
39
- u({
33
+ }, [a]), S = (t) => {
34
+ t && (u(t), p(t.format("YYYY-MM-DDTHH:mm:ssZ")));
35
+ }, f = (t) => {
36
+ const [i, s, l] = t.target.value.split(":");
37
+ let m = g(o).set("hour", i ?? 0).set("m", s ?? 0).set("s", l ?? 0);
38
+ u(m), p(m.format("YYYY-MM-DDTHH:mm:ssZ"));
39
+ }, T = (t) => () => {
40
+ f({
40
41
  target: {
41
42
  value: t
42
43
  }
43
- }), r.action.close();
44
+ }), n.action.close();
44
45
  };
45
- return /* @__PURE__ */ l(w, { children: [
46
- /* @__PURE__ */ l(d, { direction: "row", spacing: 2, children: [
46
+ return /* @__PURE__ */ d(w, { children: [
47
+ /* @__PURE__ */ d(B, { direction: "row", spacing: 2, mb: 1, alignItems: "flex-end", children: [
47
48
  /* @__PURE__ */ e(
48
- B,
49
+ $,
49
50
  {
51
+ label: x,
50
52
  value: o,
51
53
  format: "DD/MM/YYYY",
52
- minDate: D,
53
- onChange: x,
54
+ minDate: M,
55
+ onChange: S,
54
56
  slotProps: {
55
57
  textField: {
56
- variant: M,
57
- size: H
58
+ variant: r,
59
+ size: b
58
60
  }
59
61
  }
60
62
  }
61
63
  ),
62
- /* @__PURE__ */ l(d, { direction: "row", position: "relative", children: [
64
+ /* @__PURE__ */ d(E, { position: "relative", children: [
63
65
  /* @__PURE__ */ e(
64
- I,
66
+ j,
65
67
  {
66
- format: S,
68
+ format: C,
67
69
  allowEmptyFormatting: !0,
68
70
  value: o == null ? void 0 : o.format("HH:mm:ss"),
69
- onChange: u,
71
+ onChange: f,
70
72
  style: {
71
- border: 0,
72
- borderBottom: "1px solid #333",
73
73
  fontSize: 16,
74
- width: 120
74
+ width: 120,
75
+ ...r === "standard" && {
76
+ height: 32,
77
+ border: 0,
78
+ borderBottom: "1px solid",
79
+ padding: "0"
80
+ },
81
+ ...r === "outlined" && {
82
+ height: 54,
83
+ border: "1px solid",
84
+ borderRadius: h.shape.borderRadius,
85
+ padding: "0 10px"
86
+ },
87
+ borderColor: h.palette.action.disabled
75
88
  }
76
89
  }
77
90
  ),
78
91
  /* @__PURE__ */ e(
79
- F,
92
+ I,
80
93
  {
81
- onClick: r.action.open,
82
- sx: { position: "absolute", top: -4, right: 0 },
83
- children: /* @__PURE__ */ e(Z, {})
94
+ onClick: n.action.open,
95
+ sx: {
96
+ position: "absolute",
97
+ right: 0,
98
+ ...r === "standard" && {
99
+ top: -4
100
+ },
101
+ ...r === "outlined" && {
102
+ top: 8
103
+ }
104
+ },
105
+ children: /* @__PURE__ */ e(v, {})
84
106
  }
85
107
  )
86
108
  ] })
87
109
  ] }),
88
110
  /* @__PURE__ */ e(
89
- P,
111
+ R,
90
112
  {
91
113
  id: "time-menu",
92
- anchorEl: r.state.anchorEl,
93
- open: r.state.isOpen,
94
- onClose: r.action.close,
95
- children: v.map((t) => /* @__PURE__ */ e(E, { onClick: C(t), children: t }, t))
114
+ anchorEl: n.state.anchorEl,
115
+ open: n.state.isOpen,
116
+ onClose: n.action.close,
117
+ children: H.map((t) => /* @__PURE__ */ e(Z, { onClick: T(t), children: t }, t))
96
118
  }
97
119
  ),
98
- /* @__PURE__ */ e("input", { type: "hidden", name: Y, value: (o == null ? void 0 : o.format()) ?? "" })
120
+ /* @__PURE__ */ e("input", { type: "hidden", name: D, value: (o == null ? void 0 : o.format()) ?? "" })
99
121
  ] });
100
122
  };
101
123
  export {
102
- K as DateTimePicker
124
+ Q as DateTimePicker
103
125
  };
@@ -1,131 +1,135 @@
1
- import { jsxs as i, Fragment as m, jsx as o } from "react/jsx-runtime";
2
- import { AddLocationOutlined as u, DrawOutlined as C, LayersOutlined as a, EditOutlined as f, DeleteOutline as D } from "@mui/icons-material";
3
- import { Container as I, Actions as A, Button as l } from "./styled.js";
4
- import S from "./logic.js";
1
+ import { jsx as o, jsxs as i, Fragment as s } from "react/jsx-runtime";
2
+ import { EditOutlined as f, DeleteOutline as D, AddLocationOutlined as I, DrawOutlined as A, LayersOutlined as p } from "@mui/icons-material";
3
+ import { Container as O, Actions as S, Button as d } from "./styled.js";
4
+ import y from "./logic.js";
5
5
  import k from "./coordinate/index.js";
6
- import O from "./edit/index.js";
7
- import y from "./geometry/index.js";
8
- import b from "./kml/index.js";
9
- import g from "./wkt/index.js";
10
- import { IconButton as s, Dialog as E, DialogTitle as W, DialogContent as K } from "@mui/material";
11
- import { F as L, I as z } from "../../FormControl-BMRUQKHh.js";
12
- import { I as G } from "../../Input-Dxzguyp5.js";
6
+ import E from "./edit/index.js";
7
+ import b from "./geometry/index.js";
8
+ import g from "./kml/index.js";
9
+ import W from "./wkt/index.js";
10
+ import { IconButton as u, OutlinedInput as K, FilledInput as L, Dialog as z, DialogTitle as F, DialogContent as G } from "@mui/material";
13
11
  import { I as w } from "../../InputAdornment-B8ERE7Zv.js";
14
- const Q = ({
12
+ import { F as B, I as M } from "../../FormControl-BMRUQKHh.js";
13
+ import { I as T } from "../../Input-Dxzguyp5.js";
14
+ const Z = ({
15
15
  label: c,
16
- mapboxAccessToken: r,
16
+ mapboxAccessToken: l,
17
17
  value: e = "",
18
- disableAddCoordinate: p = !1,
19
- defaultExtent: d,
20
- onChange: h
18
+ disableAddCoordinate: h = !1,
19
+ defaultExtent: a,
20
+ variant: r = "outlined",
21
+ onChange: C
21
22
  }) => {
22
- const { state: t, action: n } = S({
23
+ const { state: t, action: n } = y({
23
24
  label: c,
24
25
  value: e,
25
- mapboxAccessToken: r,
26
- onChange: h
27
- });
28
- return /* @__PURE__ */ i(m, { children: [
29
- /* @__PURE__ */ i(I, { children: [
30
- /* @__PURE__ */ i(A, { children: [
31
- p === !1 && /* @__PURE__ */ o(
32
- l,
26
+ mapboxAccessToken: l,
27
+ onChange: C
28
+ }), m = /* @__PURE__ */ o(w, { position: "end", children: e !== "" && /* @__PURE__ */ i(s, { children: [
29
+ /* @__PURE__ */ o(u, { size: "small", onClick: n.onEdit, children: /* @__PURE__ */ o(f, { fontSize: "small" }) }),
30
+ /* @__PURE__ */ o(u, { size: "small", onClick: n.onDelete, children: /* @__PURE__ */ o(D, { fontSize: "small" }) })
31
+ ] }) });
32
+ return /* @__PURE__ */ i(s, { children: [
33
+ /* @__PURE__ */ i(O, { children: [
34
+ /* @__PURE__ */ i(S, { variant: r, children: [
35
+ h === !1 && /* @__PURE__ */ o(
36
+ d,
33
37
  {
34
38
  color: "inherit",
35
- startIcon: /* @__PURE__ */ o(u, {}),
39
+ startIcon: /* @__PURE__ */ o(I, {}),
36
40
  onClick: n.onAddCoordinate,
37
41
  children: "Add Coordinate"
38
42
  }
39
43
  ),
40
44
  /* @__PURE__ */ o(
41
- l,
45
+ d,
42
46
  {
43
47
  color: "inherit",
44
- startIcon: /* @__PURE__ */ o(C, {}),
48
+ startIcon: /* @__PURE__ */ o(A, {}),
45
49
  onClick: n.onDraw,
46
50
  children: "Draw"
47
51
  }
48
52
  ),
49
53
  /* @__PURE__ */ o(
50
- l,
54
+ d,
51
55
  {
52
56
  color: "inherit",
53
- startIcon: /* @__PURE__ */ o(a, {}),
57
+ startIcon: /* @__PURE__ */ o(p, {}),
54
58
  onClick: n.onAddKml,
55
59
  children: "Add KML"
56
60
  }
57
61
  ),
58
62
  /* @__PURE__ */ o(
59
- l,
63
+ d,
60
64
  {
61
65
  color: "inherit",
62
- startIcon: /* @__PURE__ */ o(a, {}),
66
+ startIcon: /* @__PURE__ */ o(p, {}),
63
67
  onClick: n.onAddWkt,
64
68
  children: "Add WKT"
65
69
  }
66
70
  )
67
71
  ] }),
68
72
  /* @__PURE__ */ i(
69
- L,
73
+ B,
70
74
  {
71
75
  fullWidth: !0,
72
- variant: "standard",
76
+ variant: r,
73
77
  contentEditable: !1,
74
78
  onClick: n.onClick,
75
79
  children: [
76
- /* @__PURE__ */ o(z, { shrink: !0, children: c }),
77
- /* @__PURE__ */ o(
78
- G,
80
+ /* @__PURE__ */ o(M, { children: c }),
81
+ r === "standard" && /* @__PURE__ */ o(T, { value: e, readOnly: !0, endAdornment: m }),
82
+ r === "outlined" && /* @__PURE__ */ o(
83
+ K,
79
84
  {
85
+ label: c,
80
86
  value: e,
81
87
  readOnly: !0,
82
- endAdornment: /* @__PURE__ */ o(w, { position: "end", children: e !== "" && /* @__PURE__ */ i(m, { children: [
83
- /* @__PURE__ */ o(s, { size: "small", onClick: n.onEdit, children: /* @__PURE__ */ o(f, { fontSize: "small" }) }),
84
- /* @__PURE__ */ o(s, { size: "small", onClick: n.onDelete, children: /* @__PURE__ */ o(D, { fontSize: "small" }) })
85
- ] }) })
88
+ endAdornment: m
86
89
  }
87
- )
90
+ ),
91
+ r === "filled" && /* @__PURE__ */ o(L, { value: e, readOnly: !0, endAdornment: m })
88
92
  ]
89
93
  }
90
94
  )
91
95
  ] }),
92
96
  /* @__PURE__ */ i(
93
- E,
97
+ z,
94
98
  {
95
99
  open: t.modal.isOpen,
96
100
  onClose: n.modal.close,
97
101
  fullWidth: !0,
98
102
  maxWidth: "md",
99
103
  children: [
100
- /* @__PURE__ */ o(W, { children: t.content.title }),
101
- /* @__PURE__ */ i(K, { children: [
104
+ /* @__PURE__ */ o(F, { children: t.content.title }),
105
+ /* @__PURE__ */ i(G, { children: [
102
106
  t.content.action === "ADD" && t.content.type === "COORDINATE" && /* @__PURE__ */ o(
103
107
  k,
104
108
  {
105
- mapboxAccessToken: r,
106
- defaultExtent: d,
109
+ mapboxAccessToken: l,
110
+ defaultExtent: a,
107
111
  onCancel: n.modal.close,
108
112
  onSubmit: n.onSubmit
109
113
  }
110
114
  ),
111
115
  t.content.action === "ADD" && t.content.type === "GEOMETRY" && /* @__PURE__ */ o(
112
- y,
116
+ b,
113
117
  {
114
118
  mapId: "map-geo-picker-001",
115
- mapboxAccessToken: r,
116
- defaultExtent: d,
119
+ mapboxAccessToken: l,
120
+ defaultExtent: a,
117
121
  onCancel: n.modal.close,
118
122
  onSubmit: n.onSubmit
119
123
  }
120
124
  ),
121
- t.content.action === "ADD" && t.content.type === "KML" && /* @__PURE__ */ o(b, { onCancel: n.modal.close, onSubmit: n.onSubmit }),
122
- t.content.action === "ADD" && t.content.type === "WKT" && /* @__PURE__ */ o(g, { onCancel: n.modal.close, onSubmit: n.onSubmit }),
125
+ t.content.action === "ADD" && t.content.type === "KML" && /* @__PURE__ */ o(g, { onCancel: n.modal.close, onSubmit: n.onSubmit }),
126
+ t.content.action === "ADD" && t.content.type === "WKT" && /* @__PURE__ */ o(W, { onCancel: n.modal.close, onSubmit: n.onSubmit }),
123
127
  t.content.action === "EDIT" && !!e && /* @__PURE__ */ o(
124
- O,
128
+ E,
125
129
  {
126
130
  mapId: "map-geo-edit-001",
127
131
  value: e,
128
- mapboxAccessToken: r,
132
+ mapboxAccessToken: l,
129
133
  onCancel: n.modal.close,
130
134
  onSubmit: n.onSubmit
131
135
  }
@@ -137,5 +141,5 @@ const Q = ({
137
141
  ] });
138
142
  };
139
143
  export {
140
- Q as GeometryPicker
144
+ Z as GeometryPicker
141
145
  };
@@ -1,14 +1,22 @@
1
- import { styled as t, Box as n, Button as a } from "@mui/material";
2
- const e = t(n)(({ theme: o }) => ({
1
+ import { styled as n, Box as i, Button as a } from "@mui/material";
2
+ const s = n(i)(({ theme: o }) => ({
3
3
  position: "relative",
4
4
  paddingTop: o.spacing(1),
5
5
  width: "100%"
6
- })), r = t(n)({
7
- position: "absolute",
8
- top: 0,
9
- right: 0,
10
- zIndex: 9
11
- }), d = t(a)(({ theme: o, variant: i }) => ({
6
+ })), p = n(i)(
7
+ ({ variant: o = "standard", theme: t }) => ({
8
+ position: "absolute",
9
+ top: 0,
10
+ right: 0,
11
+ zIndex: 9,
12
+ ...o === "outlined" && {
13
+ padding: t.spacing(0.25),
14
+ top: t.spacing(-0.75),
15
+ right: t.spacing(1),
16
+ background: t.palette.background.default
17
+ }
18
+ })
19
+ ), r = n(a)(({ theme: o, variant: t }) => ({
12
20
  fontSize: 10,
13
21
  padding: "3px 8px",
14
22
  minWidth: "auto",
@@ -22,13 +30,13 @@ const e = t(n)(({ theme: o }) => ({
22
30
  fontSize: 14
23
31
  }
24
32
  },
25
- ...i === "contained" && {
33
+ ...t === "contained" && {
26
34
  "&:hover": {
27
35
  backgroundColor: o.palette.grey[300],
28
36
  boxShadow: o.shadows[1]
29
37
  }
30
38
  }
31
- })), p = t(n)({
39
+ })), g = n(i)({
32
40
  position: "absolute",
33
41
  top: 0,
34
42
  left: 0,
@@ -41,8 +49,8 @@ const e = t(n)(({ theme: o }) => ({
41
49
  }
42
50
  });
43
51
  export {
44
- r as Actions,
45
- d as Button,
46
- e as Container,
47
- p as Modal
52
+ p as Actions,
53
+ r as Button,
54
+ s as Container,
55
+ g as Modal
48
56
  };