agviewermap-react 0.1.16 → 0.1.18
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.
- package/dist/LazyModalContent-KYg-4Dun.js +126 -0
- package/dist/LazyPlotModalContent-DQuJrz3C.js +160 -0
- package/dist/agviewermap-react.js +2 -76961
- package/dist/agviewermap-react.umd.cjs +174 -174
- package/dist/arrow-up-right-DzFwaANr.js +50 -0
- package/dist/index-BermKuD8.js +76529 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { d as B, t as H, j as e, S as z, a as P, I as U, M as V, T as S, b as _, E as q } from "./index-BermKuD8.js";
|
|
2
|
+
import { useState as d, useRef as G, useCallback as i, useMemo as j, useEffect as J } from "react";
|
|
3
|
+
import { A as K, T as O } from "./arrow-up-right-DzFwaANr.js";
|
|
4
|
+
const Q = ({ marker: a, onMarkerClick: u, onDeleteMarker: m, markersData: h, intl: o }) => /* @__PURE__ */ e.jsx("div", { className: "marker-item rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 p-2 mb-2", children: /* @__PURE__ */ e.jsx("div", { className: "marker-item-info", children: /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center gap-2", children: [
|
|
5
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
6
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 text-primary flex-shrink-0" }),
|
|
7
|
+
/* @__PURE__ */ e.jsx("h5", { className: "text-sm font-medium text-gray-800 dark:text-gray-200 break-words leading-tight", children: a == null ? void 0 : a.title })
|
|
8
|
+
] }),
|
|
9
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
10
|
+
/* @__PURE__ */ e.jsx(S, { text: o.formatMessage({ id: "app.agviewer_map.focus_marker", defaultMessage: "Focus on the marker" }), children: /* @__PURE__ */ e.jsx(
|
|
11
|
+
_,
|
|
12
|
+
{
|
|
13
|
+
variant: "icon",
|
|
14
|
+
className: "rounded-full p-1 hover:bg-gray-100 dark:hover:bg-gray-600",
|
|
15
|
+
onClick: (r) => u(r, a),
|
|
16
|
+
"data-marker-id": a.id,
|
|
17
|
+
children: /* @__PURE__ */ e.jsx(K, { className: "w-4 h-4" })
|
|
18
|
+
}
|
|
19
|
+
) }),
|
|
20
|
+
/* @__PURE__ */ e.jsx(S, { text: o.formatMessage({ id: "app.agviewer_map.delete_marker", defaultMessage: "Delete Marker" }), children: /* @__PURE__ */ e.jsx(
|
|
21
|
+
_,
|
|
22
|
+
{
|
|
23
|
+
variant: "icon",
|
|
24
|
+
className: "rounded-full p-1 hover:bg-gray-100 dark:hover:bg-gray-600",
|
|
25
|
+
onClick: (r) => m(r, a),
|
|
26
|
+
"data-marker-id": a.id,
|
|
27
|
+
children: /* @__PURE__ */ e.jsx(O, { className: "w-4 h-4 text-red-500" })
|
|
28
|
+
}
|
|
29
|
+
) }),
|
|
30
|
+
/* @__PURE__ */ e.jsx(
|
|
31
|
+
q,
|
|
32
|
+
{
|
|
33
|
+
marker: h.find((r) => r.id === a.id)
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] })
|
|
37
|
+
] }) }) });
|
|
38
|
+
function $({
|
|
39
|
+
markersData: a,
|
|
40
|
+
loading: u,
|
|
41
|
+
handleDeleteMarker: m,
|
|
42
|
+
onMarkerClick: h,
|
|
43
|
+
onClose: o,
|
|
44
|
+
intl: r
|
|
45
|
+
}) {
|
|
46
|
+
const [v, k] = d(""), [g, T] = d(""), [C, N] = d(!1), [n, y] = d(20), [c, M] = d(!1), I = G(null), b = i(
|
|
47
|
+
B((s) => {
|
|
48
|
+
T(s), N(!1);
|
|
49
|
+
}, 300),
|
|
50
|
+
[]
|
|
51
|
+
), L = i((s) => {
|
|
52
|
+
const t = s.target.value;
|
|
53
|
+
k(t), N(!0), b(t);
|
|
54
|
+
}, [b]), p = j(() => !a || a.length === 0 ? [] : a.map((s) => H(s)), [a]), l = j(() => {
|
|
55
|
+
if (!g) return p;
|
|
56
|
+
const s = g.toLowerCase();
|
|
57
|
+
return p.filter(
|
|
58
|
+
(t) => {
|
|
59
|
+
var f, x;
|
|
60
|
+
return (x = (f = t == null ? void 0 : t.title) == null ? void 0 : f.toLowerCase()) == null ? void 0 : x.includes(s);
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}, [p, g]), E = j(() => l.slice(0, n), [l, n]);
|
|
64
|
+
J(() => {
|
|
65
|
+
y(20);
|
|
66
|
+
}, [g]);
|
|
67
|
+
const w = i(() => {
|
|
68
|
+
c || n >= l.length || (M(!0), setTimeout(() => {
|
|
69
|
+
y((s) => Math.min(s + 20, l.length)), M(!1);
|
|
70
|
+
}, 300));
|
|
71
|
+
}, [c, n, l.length]), F = i((s) => {
|
|
72
|
+
const { scrollTop: t, scrollHeight: f, clientHeight: x } = s.target;
|
|
73
|
+
t + x >= f - 100 && !c && n < l.length && w();
|
|
74
|
+
}, [w, c, n, l.length]), R = i((s, t) => {
|
|
75
|
+
h(s, t), o();
|
|
76
|
+
}, [h, o]), A = i((s, t) => {
|
|
77
|
+
m(s, t);
|
|
78
|
+
}, [m]);
|
|
79
|
+
return u ? /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-center h-40", children: /* @__PURE__ */ e.jsx(z, {}) }) : /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
|
|
80
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative mb-4", children: [
|
|
81
|
+
/* @__PURE__ */ e.jsx(P, { className: "w-4 h-4 text-gray-500 absolute left-3 top-1/2 transform -translate-y-1/2" }),
|
|
82
|
+
/* @__PURE__ */ e.jsx(
|
|
83
|
+
U,
|
|
84
|
+
{
|
|
85
|
+
className: "pl-9 w-full text-sm h-9",
|
|
86
|
+
placeholder: r.formatMessage({ id: "app.agviewer_map.search_station", defaultMessage: "Search Station" }),
|
|
87
|
+
value: v,
|
|
88
|
+
onChange: L
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
C && /* @__PURE__ */ e.jsx("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-primary" }) })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ e.jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
ref: I,
|
|
97
|
+
className: "overflow-y-auto h-[350px]",
|
|
98
|
+
onScroll: F,
|
|
99
|
+
children: l.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center h-20 p-4", children: /* @__PURE__ */ e.jsx("h5", { className: "text-sm text-gray-500 dark:text-gray-400", children: v ? r.formatMessage({ id: "app.agviewer_map.no_station_found", defaultMessage: "No Station Found" }) : r.formatMessage({ id: "app.agviewer_map.no_station_found", defaultMessage: "No Station Found" }) }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
100
|
+
E.map((s) => /* @__PURE__ */ e.jsx(
|
|
101
|
+
Q,
|
|
102
|
+
{
|
|
103
|
+
marker: s,
|
|
104
|
+
onMarkerClick: R,
|
|
105
|
+
onDeleteMarker: A,
|
|
106
|
+
markersData: a,
|
|
107
|
+
intl: r
|
|
108
|
+
},
|
|
109
|
+
s.id
|
|
110
|
+
)),
|
|
111
|
+
c && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-center py-4", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
112
|
+
/* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-primary" }),
|
|
113
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Loading more..." })
|
|
114
|
+
] }) }),
|
|
115
|
+
n >= l.length && l.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-center py-4", children: /* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: r.formatMessage({
|
|
116
|
+
id: "app.agviewer_map.all_results_loaded",
|
|
117
|
+
defaultMessage: "All results loaded"
|
|
118
|
+
}) }) })
|
|
119
|
+
] })
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
$ as default
|
|
126
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { u as P, c as R, e as H, P as O, j as e, f as U, B as z, T as w, g as G, C as V, h as q, i as T, d as J, t as K, S as Q, a as W, I as X, M as Y, b as I } from "./index-BermKuD8.js";
|
|
2
|
+
import { useState as u, useContext as Z, useRef as $, useCallback as h, useMemo as b, useEffect as ee } from "react";
|
|
3
|
+
import { A as se, T as ae } from "./arrow-up-right-DzFwaANr.js";
|
|
4
|
+
const te = ({ plot: a }) => {
|
|
5
|
+
const [f, l] = u(!1);
|
|
6
|
+
P((o) => o.toDrawMode), P((o) => o.toNormalMode);
|
|
7
|
+
const r = R(), { isOpen: d, currentStep: i } = H(), { handlePlotUpdate: x, handleEditPlot: j, setClickedPlot: c } = Z(O), M = (o) => {
|
|
8
|
+
l(!1), c(null), j(a);
|
|
9
|
+
}, y = (o) => (T(r.formatMessage({ id: "app.agviewer_map.saving_changes", defaultMessage: "Saving changes" })), x(o).then(() => {
|
|
10
|
+
c(null), T.success(r.formatMessage({ id: "app.agviewer_map.changes_saved_successfully", defaultMessage: "Changes saved successfully" }));
|
|
11
|
+
}));
|
|
12
|
+
return /* @__PURE__ */ e.jsx(
|
|
13
|
+
U,
|
|
14
|
+
{
|
|
15
|
+
trigger: /* @__PURE__ */ e.jsx(z, { variant: "outline", size: "icon", children: /* @__PURE__ */ e.jsx(w, { text: r.formatMessage({ id: "app.agviewer_map.edit_plot", defaultMessage: "Edit plot" }), children: /* @__PURE__ */ e.jsx(G, { className: "w-5 h-5 action-icon" }) }) }),
|
|
16
|
+
title: r.formatMessage({ id: "app.agviewer_map.edit_plot", defaultMessage: "Edit plot" }),
|
|
17
|
+
open: f,
|
|
18
|
+
setOpen: l,
|
|
19
|
+
headerClassName: "m-4",
|
|
20
|
+
onClose: () => l(!1),
|
|
21
|
+
preventBackdropClose: d && i === 3,
|
|
22
|
+
children: /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsx(
|
|
23
|
+
q,
|
|
24
|
+
{
|
|
25
|
+
plot: a,
|
|
26
|
+
onSubmit: y,
|
|
27
|
+
onCancel: () => l(!1),
|
|
28
|
+
onGeometryChange: M,
|
|
29
|
+
submitButtonText: r.formatMessage({ id: "app.agviewer_map.save_changes", defaultMessage: "Save Changes" })
|
|
30
|
+
}
|
|
31
|
+
) })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}, re = ({ plot: a, onPlotClick: f, onDeletePlot: l, plots: r, intl: d }) => /* @__PURE__ */ e.jsx("div", { className: "marker-item rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 p-2 mb-2", children: /* @__PURE__ */ e.jsx("div", { className: "marker-item-info", children: /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center gap-2", children: [
|
|
35
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
36
|
+
/* @__PURE__ */ e.jsx(Y, { className: "h-4 w-4 text-primary flex-shrink-0" }),
|
|
37
|
+
/* @__PURE__ */ e.jsx("h5", { className: "text-sm font-medium text-gray-800 dark:text-gray-200 break-words leading-tight", children: a == null ? void 0 : a.name })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
40
|
+
/* @__PURE__ */ e.jsx(w, { text: d.formatMessage({ id: "app.agviewer_map.focus_plot", defaultMessage: "Focus on the plot" }), children: /* @__PURE__ */ e.jsx(
|
|
41
|
+
I,
|
|
42
|
+
{
|
|
43
|
+
variant: "icon",
|
|
44
|
+
className: "rounded-full p-1 hover:bg-gray-100 dark:hover:bg-gray-600",
|
|
45
|
+
onClick: () => f(a),
|
|
46
|
+
"data-plot-id": a.id,
|
|
47
|
+
children: /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4" })
|
|
48
|
+
}
|
|
49
|
+
) }),
|
|
50
|
+
/* @__PURE__ */ e.jsx(w, { text: d.formatMessage({ id: "app.agviewer_map.delete_plot", defaultMessage: "Delete plot" }), children: /* @__PURE__ */ e.jsx(
|
|
51
|
+
I,
|
|
52
|
+
{
|
|
53
|
+
variant: "icon",
|
|
54
|
+
className: "rounded-full p-1 hover:bg-gray-100 dark:hover:bg-gray-600",
|
|
55
|
+
onClick: () => l(a),
|
|
56
|
+
"data-plot-id": a.id,
|
|
57
|
+
children: /* @__PURE__ */ e.jsx(ae, { className: "w-4 h-4 text-red-500" })
|
|
58
|
+
}
|
|
59
|
+
) }),
|
|
60
|
+
/* @__PURE__ */ e.jsx(
|
|
61
|
+
te,
|
|
62
|
+
{
|
|
63
|
+
plot: r.find((i) => i.id === a.id)
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] })
|
|
67
|
+
] }) }) });
|
|
68
|
+
function de({
|
|
69
|
+
plots: a,
|
|
70
|
+
loading: f,
|
|
71
|
+
handleDeletePlot: l,
|
|
72
|
+
handleFlyToPlot: r,
|
|
73
|
+
onClose: d,
|
|
74
|
+
intl: i
|
|
75
|
+
}) {
|
|
76
|
+
const [x, j] = u(""), [c, M] = u(""), [y, o] = u(!1), [m, _] = u(20), [p, C] = u(!1), B = $(null), k = h(
|
|
77
|
+
J((s) => {
|
|
78
|
+
M(s), o(!1);
|
|
79
|
+
}, 300),
|
|
80
|
+
[]
|
|
81
|
+
), E = h((s) => {
|
|
82
|
+
const t = s.target.value;
|
|
83
|
+
j(t), o(!0), k(t);
|
|
84
|
+
}, [k]), N = b(() => !a || a.length === 0 ? [] : a.map((s) => K(s)), [a]), n = b(() => {
|
|
85
|
+
if (!c) return N;
|
|
86
|
+
const s = c.toLowerCase();
|
|
87
|
+
return N.filter(
|
|
88
|
+
(t) => {
|
|
89
|
+
var g, v;
|
|
90
|
+
return (v = (g = t == null ? void 0 : t.name) == null ? void 0 : g.toLowerCase()) == null ? void 0 : v.includes(s);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}, [N, c]), L = b(() => n.slice(0, m), [n, m]);
|
|
94
|
+
ee(() => {
|
|
95
|
+
_(20);
|
|
96
|
+
}, [c]);
|
|
97
|
+
const S = h(() => {
|
|
98
|
+
p || m >= n.length || (C(!0), setTimeout(() => {
|
|
99
|
+
_((s) => Math.min(s + 20, n.length)), C(!1);
|
|
100
|
+
}, 300));
|
|
101
|
+
}, [p, m, n.length]), A = h((s) => {
|
|
102
|
+
const { scrollTop: t, scrollHeight: g, clientHeight: v } = s.target;
|
|
103
|
+
t + v >= g - 100 && !p && m < n.length && S();
|
|
104
|
+
}, [S, p, m, n.length]), D = h((s) => {
|
|
105
|
+
var t, g;
|
|
106
|
+
d(), r((g = (t = s == null ? void 0 : s.options) == null ? void 0 : t.geometry) == null ? void 0 : g.coordinates);
|
|
107
|
+
}, [r, d]), F = h((s) => {
|
|
108
|
+
l(s);
|
|
109
|
+
}, [l]);
|
|
110
|
+
return f ? /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-center h-40", children: /* @__PURE__ */ e.jsx(Q, {}) }) : /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
|
|
111
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative mb-4", children: [
|
|
112
|
+
/* @__PURE__ */ e.jsx(W, { className: "w-4 h-4 text-gray-500 absolute left-3 top-1/2 transform -translate-y-1/2" }),
|
|
113
|
+
/* @__PURE__ */ e.jsx(
|
|
114
|
+
X,
|
|
115
|
+
{
|
|
116
|
+
className: "pl-9 w-full text-sm h-9",
|
|
117
|
+
placeholder: i.formatMessage({ id: "app.agviewer_map.search_plots", defaultMessage: "Search Plots" }),
|
|
118
|
+
value: x,
|
|
119
|
+
onChange: E
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
y && /* @__PURE__ */ e.jsx("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-primary" }) })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ e.jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
ref: B,
|
|
128
|
+
className: "overflow-y-auto h-[350px]",
|
|
129
|
+
onScroll: A,
|
|
130
|
+
children: n.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center h-20 p-4", children: /* @__PURE__ */ e.jsx("h5", { className: "text-sm text-gray-500 dark:text-gray-400", children: x ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
131
|
+
i.formatMessage({ id: "app.agviewer_map.no_plot_found", defaultMessage: "No Plots Found for keyword:" }),
|
|
132
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-medium ml-1", children: x })
|
|
133
|
+
] }) : i.formatMessage({ id: "app.agviewer_map.no_plots", defaultMessage: "No Plots Available" }) }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
134
|
+
L.map((s) => /* @__PURE__ */ e.jsx(
|
|
135
|
+
re,
|
|
136
|
+
{
|
|
137
|
+
plot: s,
|
|
138
|
+
onPlotClick: D,
|
|
139
|
+
onDeletePlot: F,
|
|
140
|
+
plots: a,
|
|
141
|
+
intl: i
|
|
142
|
+
},
|
|
143
|
+
s.id
|
|
144
|
+
)),
|
|
145
|
+
p && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-center py-4", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
146
|
+
/* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-primary" }),
|
|
147
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Loading more..." })
|
|
148
|
+
] }) }),
|
|
149
|
+
m >= n.length && n.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center items-center py-4", children: /* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: i.formatMessage({
|
|
150
|
+
id: "app.agviewer_map.all_results_loaded",
|
|
151
|
+
defaultMessage: "All results loaded"
|
|
152
|
+
}) }) })
|
|
153
|
+
] })
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
de as default
|
|
160
|
+
};
|