@hybridcore/ui 1.6.19 → 1.6.20
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,119 +1,133 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { EditOutlined as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/* @__PURE__ */ e(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { ContentCopyOutlined as b, EditOutlined as A, DeleteOutline as P, AddLocationOutlined as D, DrawOutlined as O, LayersOutlined as h } from "@mui/icons-material";
|
|
3
|
+
import { Tooltip as p } from "@mui/material";
|
|
4
|
+
import { Coordinate as S } from "./coordinate/index.js";
|
|
5
|
+
import { Edit as E } from "./edit/index.js";
|
|
6
|
+
import { Geometry as I } from "./geometry/index.js";
|
|
7
|
+
import { Kml as T } from "./kml/index.js";
|
|
8
|
+
import { Wkt as M } from "./wkt/index.js";
|
|
9
|
+
import { useGeometryPickerLogic as x } from "./logic.js";
|
|
10
|
+
import { GeometryPickerEndAdornment as g, GeometryPickerEndAdornmentButton as u, GeometryPickerActions as L, GeometryPickerActionButton as d, GeometryPickerRoot as W, GeometryPickerHeader as z, GeometryPickerTopLabel as K, GeometryPickerContainer as v, GeometryPickerFormControl as R, GeometryPickerInputLabel as w, GeometryPickerInputStandard as B, GeometryPickerInputOutlined as F, GeometryPickerInputFilled as j, GeometryPickerDialog as N, GeometryPickerDialogTitle as H, GeometryPickerDialogContent as Y } from "./styled.js";
|
|
11
|
+
const oe = (y) => {
|
|
12
|
+
const { label: r, mapboxAccessToken: a, value: i = "", defaultExtent: k } = y, { refs: f, state: t, actions: o } = x(y), { ownerState: m, variant: l, labelPosition: c } = t, s = /* @__PURE__ */ e(g, { position: "end", children: i !== "" && /* @__PURE__ */ n(G, { children: [
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
|
+
p,
|
|
15
|
+
{
|
|
16
|
+
title: t.copied ? "Copied to clipboard" : "Copy",
|
|
17
|
+
open: t.copyTooltipOpen,
|
|
18
|
+
onOpen: o.openCopyTooltip,
|
|
19
|
+
onClose: o.closeCopyTooltip,
|
|
20
|
+
children: /* @__PURE__ */ e(u, { size: "small", onClick: o.onCopy, children: /* @__PURE__ */ e(b, { fontSize: "small" }) })
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ e(p, { title: "Edit", children: /* @__PURE__ */ e(u, { size: "small", onClick: o.onEdit, children: /* @__PURE__ */ e(A, { fontSize: "small" }) }) }),
|
|
24
|
+
/* @__PURE__ */ e(p, { title: "Remove", children: /* @__PURE__ */ e(u, { size: "small", onClick: o.onDelete, children: /* @__PURE__ */ e(P, { fontSize: "small" }) }) })
|
|
25
|
+
] }) }), C = /* @__PURE__ */ n(L, { ownerState: m, children: [
|
|
26
|
+
m.disableAddCoordinate === !1 && /* @__PURE__ */ e(
|
|
27
|
+
d,
|
|
28
|
+
{
|
|
29
|
+
color: "inherit",
|
|
30
|
+
startIcon: /* @__PURE__ */ e(D, {}),
|
|
31
|
+
onClick: o.onAddCoordinate,
|
|
32
|
+
children: "Add Coordinate"
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ e(
|
|
36
|
+
d,
|
|
37
|
+
{
|
|
38
|
+
color: "inherit",
|
|
39
|
+
startIcon: /* @__PURE__ */ e(O, {}),
|
|
40
|
+
onClick: o.onDraw,
|
|
41
|
+
children: "Draw"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ e(
|
|
45
|
+
d,
|
|
46
|
+
{
|
|
47
|
+
color: "inherit",
|
|
48
|
+
startIcon: /* @__PURE__ */ e(h, {}),
|
|
49
|
+
onClick: o.onAddKml,
|
|
50
|
+
children: "Add KML"
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
d,
|
|
55
|
+
{
|
|
56
|
+
color: "inherit",
|
|
57
|
+
startIcon: /* @__PURE__ */ e(h, {}),
|
|
58
|
+
onClick: o.onAddWkt,
|
|
59
|
+
children: "Add WKT"
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] });
|
|
63
|
+
return /* @__PURE__ */ n(W, { ref: f.rootRef, sx: t.sx, children: [
|
|
64
|
+
c === "top" && /* @__PURE__ */ n(z, { children: [
|
|
65
|
+
r !== void 0 && /* @__PURE__ */ e(K, { children: r }),
|
|
66
|
+
C
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ n(v, { ownerState: m, children: [
|
|
69
|
+
c !== "top" && C,
|
|
70
|
+
/* @__PURE__ */ n(
|
|
71
|
+
R,
|
|
58
72
|
{
|
|
59
73
|
fullWidth: !0,
|
|
60
74
|
variant: l,
|
|
61
75
|
contentEditable: !1,
|
|
62
76
|
onClick: o.onClick,
|
|
63
77
|
children: [
|
|
64
|
-
|
|
65
|
-
l === "standard" && /* @__PURE__ */ e(
|
|
78
|
+
c === "default" && /* @__PURE__ */ e(w, { shrink: !!i, children: r }),
|
|
79
|
+
l === "standard" && /* @__PURE__ */ e(B, { value: i, readOnly: !0, endAdornment: s }),
|
|
66
80
|
l === "outlined" && /* @__PURE__ */ e(
|
|
67
|
-
|
|
81
|
+
F,
|
|
68
82
|
{
|
|
69
|
-
label:
|
|
70
|
-
value:
|
|
83
|
+
label: c === "default" ? r : void 0,
|
|
84
|
+
value: i,
|
|
71
85
|
readOnly: !0,
|
|
72
|
-
endAdornment:
|
|
86
|
+
endAdornment: s
|
|
73
87
|
}
|
|
74
88
|
),
|
|
75
|
-
l === "filled" && /* @__PURE__ */ e(
|
|
89
|
+
l === "filled" && /* @__PURE__ */ e(j, { value: i, readOnly: !0, endAdornment: s })
|
|
76
90
|
]
|
|
77
91
|
}
|
|
78
92
|
)
|
|
79
93
|
] }),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
94
|
+
/* @__PURE__ */ n(
|
|
95
|
+
N,
|
|
82
96
|
{
|
|
83
97
|
open: t.modal.isOpen,
|
|
84
98
|
onClose: o.closeModal,
|
|
85
99
|
fullWidth: !0,
|
|
86
100
|
maxWidth: "md",
|
|
87
101
|
children: [
|
|
88
|
-
/* @__PURE__ */ e(
|
|
89
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ e(H, { children: t.content.title }),
|
|
103
|
+
/* @__PURE__ */ n(Y, { children: [
|
|
90
104
|
t.content.action === "ADD" && t.content.type === "COORDINATE" && /* @__PURE__ */ e(
|
|
91
|
-
|
|
105
|
+
S,
|
|
92
106
|
{
|
|
93
|
-
mapboxAccessToken:
|
|
94
|
-
defaultExtent:
|
|
107
|
+
mapboxAccessToken: a,
|
|
108
|
+
defaultExtent: k,
|
|
95
109
|
onCancel: o.closeModal,
|
|
96
110
|
onSubmit: o.onSubmit
|
|
97
111
|
}
|
|
98
112
|
),
|
|
99
113
|
t.content.action === "ADD" && t.content.type === "GEOMETRY" && /* @__PURE__ */ e(
|
|
100
|
-
|
|
114
|
+
I,
|
|
101
115
|
{
|
|
102
116
|
mapId: "map-geo-picker-001",
|
|
103
|
-
mapboxAccessToken:
|
|
104
|
-
defaultExtent:
|
|
117
|
+
mapboxAccessToken: a,
|
|
118
|
+
defaultExtent: k,
|
|
105
119
|
onCancel: o.closeModal,
|
|
106
120
|
onSubmit: o.onSubmit
|
|
107
121
|
}
|
|
108
122
|
),
|
|
109
|
-
t.content.action === "ADD" && t.content.type === "KML" && /* @__PURE__ */ e(
|
|
110
|
-
t.content.action === "ADD" && t.content.type === "WKT" && /* @__PURE__ */ e(
|
|
111
|
-
t.content.action === "EDIT" && !!
|
|
112
|
-
|
|
123
|
+
t.content.action === "ADD" && t.content.type === "KML" && /* @__PURE__ */ e(T, { onCancel: o.closeModal, onSubmit: o.onSubmit }),
|
|
124
|
+
t.content.action === "ADD" && t.content.type === "WKT" && /* @__PURE__ */ e(M, { onCancel: o.closeModal, onSubmit: o.onSubmit }),
|
|
125
|
+
t.content.action === "EDIT" && !!i && /* @__PURE__ */ e(
|
|
126
|
+
E,
|
|
113
127
|
{
|
|
114
128
|
mapId: "map-geo-edit-001",
|
|
115
|
-
value:
|
|
116
|
-
mapboxAccessToken:
|
|
129
|
+
value: i,
|
|
130
|
+
mapboxAccessToken: a,
|
|
117
131
|
onCancel: o.closeModal,
|
|
118
132
|
onSubmit: o.onSubmit
|
|
119
133
|
}
|
|
@@ -125,5 +139,5 @@ const X = (s) => {
|
|
|
125
139
|
] });
|
|
126
140
|
};
|
|
127
141
|
export {
|
|
128
|
-
|
|
142
|
+
oe as GeometryPicker
|
|
129
143
|
};
|
|
@@ -1,62 +1,79 @@
|
|
|
1
|
-
import { useThemeProps as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
value:
|
|
7
|
-
disableAddCoordinate:
|
|
8
|
-
variant:
|
|
9
|
-
labelPosition:
|
|
10
|
-
onChange:
|
|
11
|
-
} =
|
|
1
|
+
import { useThemeProps as x } from "@mui/material";
|
|
2
|
+
import { useRef as C, useState as p, useEffect as G } from "react";
|
|
3
|
+
import L from "../../hooks/useToggle.js";
|
|
4
|
+
const H = (g) => {
|
|
5
|
+
const l = x({ props: g, name: "HCGeometryPicker" }), {
|
|
6
|
+
value: e = "",
|
|
7
|
+
disableAddCoordinate: f = !1,
|
|
8
|
+
variant: d = "outlined",
|
|
9
|
+
labelPosition: u = "top",
|
|
10
|
+
onChange: s
|
|
11
|
+
} = l, P = C(null), t = L(!1), [m, D] = p(!1), [E, a] = p(!1), i = C(), [c, n] = p({
|
|
12
12
|
title: "",
|
|
13
13
|
type: "COORDINATE",
|
|
14
14
|
action: "ADD"
|
|
15
|
-
}),
|
|
15
|
+
}), T = () => {
|
|
16
16
|
n({ title: "Add Coordinate", type: "COORDINATE", action: "ADD" }), t.action.open();
|
|
17
|
-
},
|
|
17
|
+
}, K = () => {
|
|
18
18
|
n({ title: "Add KML", type: "KML", action: "ADD" }), t.action.open();
|
|
19
|
-
},
|
|
19
|
+
}, O = () => {
|
|
20
20
|
n({ title: "Add WKT", type: "WKT", action: "ADD" }), t.action.open();
|
|
21
|
-
},
|
|
21
|
+
}, r = (o) => {
|
|
22
22
|
o != null && o.stopPropagation && o.stopPropagation(), n({ title: "Edit", type: "WKT", action: "EDIT" }), t.action.open();
|
|
23
|
-
}, D = (o) => {
|
|
24
|
-
o != null && o.stopPropagation && o.stopPropagation(), n({ title: "Draw Geometry", type: "GEOMETRY", action: "ADD" }), t.action.open();
|
|
25
23
|
}, y = (o) => {
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
24
|
+
o != null && o.stopPropagation && o.stopPropagation(), n({ title: "Draw Geometry", type: "GEOMETRY", action: "ADD" }), t.action.open();
|
|
25
|
+
}, R = (o) => {
|
|
26
|
+
t.action.close(), s && s(o), c.action === "ADD" && (c.type === "KML" || c.type === "WKT") && r();
|
|
27
|
+
}, w = () => {
|
|
28
|
+
e !== void 0 && e !== "" ? r() : f === !1 ? T() : y();
|
|
29
|
+
}, M = (o) => {
|
|
30
|
+
o.stopPropagation(), s && s("");
|
|
31
|
+
}, W = (o) => {
|
|
32
|
+
var A;
|
|
33
|
+
o != null && o.stopPropagation && o.stopPropagation(), e && ((A = navigator.clipboard) == null || A.writeText(e), D(!0), a(!0), i.current && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
34
|
+
D(!1), a(!1);
|
|
35
|
+
}, 2e3));
|
|
36
|
+
}, b = () => a(!0), k = () => {
|
|
37
|
+
m || a(!1);
|
|
31
38
|
};
|
|
32
|
-
return
|
|
33
|
-
|
|
39
|
+
return G(
|
|
40
|
+
() => () => {
|
|
41
|
+
i.current && clearTimeout(i.current);
|
|
42
|
+
},
|
|
43
|
+
[]
|
|
44
|
+
), {
|
|
45
|
+
refs: { rootRef: P },
|
|
34
46
|
state: {
|
|
35
47
|
ownerState: {
|
|
36
|
-
variant:
|
|
37
|
-
labelPosition:
|
|
38
|
-
hasValue:
|
|
39
|
-
disableAddCoordinate:
|
|
48
|
+
variant: d,
|
|
49
|
+
labelPosition: u,
|
|
50
|
+
hasValue: e !== "",
|
|
51
|
+
disableAddCoordinate: f
|
|
40
52
|
},
|
|
41
|
-
content:
|
|
53
|
+
content: c,
|
|
42
54
|
modal: t.state,
|
|
43
|
-
variant:
|
|
44
|
-
labelPosition:
|
|
45
|
-
|
|
55
|
+
variant: d,
|
|
56
|
+
labelPosition: u,
|
|
57
|
+
copied: m,
|
|
58
|
+
copyTooltipOpen: E,
|
|
59
|
+
sx: l.sx
|
|
46
60
|
},
|
|
47
61
|
actions: {
|
|
48
|
-
onAddCoordinate:
|
|
49
|
-
onAddKml:
|
|
50
|
-
onAddWkt:
|
|
51
|
-
onSubmit:
|
|
52
|
-
onClick:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
onAddCoordinate: T,
|
|
63
|
+
onAddKml: K,
|
|
64
|
+
onAddWkt: O,
|
|
65
|
+
onSubmit: R,
|
|
66
|
+
onClick: w,
|
|
67
|
+
onCopy: W,
|
|
68
|
+
openCopyTooltip: b,
|
|
69
|
+
closeCopyTooltip: k,
|
|
70
|
+
onDelete: M,
|
|
71
|
+
onEdit: r,
|
|
72
|
+
onDraw: y,
|
|
56
73
|
closeModal: t.action.close
|
|
57
74
|
}
|
|
58
75
|
};
|
|
59
76
|
};
|
|
60
77
|
export {
|
|
61
|
-
|
|
78
|
+
H as useGeometryPickerLogic
|
|
62
79
|
};
|