@object-ui/plugin-aggrid 4.0.3 → 4.0.5
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/CHANGELOG.md +54 -0
- package/dist/index.js +709 -17
- package/dist/index.umd.cjs +1 -238
- package/package.json +7 -7
- package/dist/AddressField-CP-8JJvR.js +0 -98
- package/dist/AgGridImpl-DiTsK8F6.js +0 -226
- package/dist/AutoNumberField-DCL2eUJj.js +0 -14
- package/dist/AvatarField-DuaF__ns.js +0 -83
- package/dist/BooleanField-0QUz5DOy.js +0 -41
- package/dist/CodeField-iTabv7wS.js +0 -23
- package/dist/ColorField-R7ZmLj1V.js +0 -38
- package/dist/CurrencyField-CEu2SjEj.js +0 -49
- package/dist/DateField-DoaPu9GV.js +0 -22
- package/dist/DateTimeField-DcKX54zr.js +0 -30
- package/dist/EmailField-eYfpFAtE.js +0 -26
- package/dist/FileField-DtvoWRK-.js +0 -214
- package/dist/FormulaField-DF6-4u2b.js +0 -17
- package/dist/GeolocationField-CyzG2dqR.js +0 -161
- package/dist/GridField-BFlgbp8W.js +0 -49
- package/dist/ImageCropperDialog-BFlbM7vO.js +0 -153
- package/dist/ImageField-DoXNtXV_.js +0 -145
- package/dist/LocationField-BeYK6K9V.js +0 -36
- package/dist/LookupField-DXGCnQ3q.js +0 -1063
- package/dist/MasterDetailField-JpmMudRV.js +0 -110
- package/dist/NumberField-BYuCxbmU.js +0 -27
- package/dist/ObjectAgGridImpl-Bz5whFec.js +0 -20000
- package/dist/ObjectField-Dlf_yrMC.js +0 -50
- package/dist/PasswordField-40E439oE.js +0 -61
- package/dist/PercentField-BvdQEcfn.js +0 -61
- package/dist/PhoneField-CBuoC-vs.js +0 -26
- package/dist/QRCodeField-CrRsA1vB.js +0 -145
- package/dist/RatingField-BVkroiQ4.js +0 -43
- package/dist/RichTextField-DEYNcokk.js +0 -33
- package/dist/SelectField-K-xoVDss.js +0 -36
- package/dist/SignatureField-D0nUx3Cb.js +0 -99
- package/dist/SliderField-C2EpGbj8.js +0 -35
- package/dist/SummaryField-S6Gt7IDC.js +0 -22
- package/dist/TextAreaField-j4eJQ66C.js +0 -125
- package/dist/TextField-DccUZtd7.js +0 -30
- package/dist/TimeField-CWbpycPt.js +0 -22
- package/dist/UrlField-BkPyImh9.js +0 -31
- package/dist/UserField-LrhYdvnz.js +0 -77
- package/dist/VectorField-Baa_mHsO.js +0 -34
- package/dist/check-CBAnx5TO.js +0 -7
- package/dist/createLucideIcon-BtZxPlua.js +0 -42
- package/dist/crop-2wjrXKXD.js +0 -10
- package/dist/dist-BcXWTU-8.js +0 -54
- package/dist/index.css +0 -2
- package/dist/jsx-runtime-CXSCp6pT.js +0 -180
- package/dist/loader-circle-Cxg-xF4u.js +0 -7
- package/dist/plus-COkdZ2Fh.js +0 -10
- package/dist/rolldown-runtime-CkxV0rQ3.js +0 -14
- package/dist/upload-DWhfIa3Y.js +0 -17
- package/dist/useFieldTranslation-DtLNhrx3.js +0 -305
- package/dist/x-BDi_yYx9.js +0 -10
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
|
|
2
|
-
import { t } from "./jsx-runtime-CXSCp6pT.js";
|
|
3
|
-
import { t as n } from "./createLucideIcon-BtZxPlua.js";
|
|
4
|
-
import { n as r, t as i } from "./dist-BcXWTU-8.js";
|
|
5
|
-
import { t as a } from "./loader-circle-Cxg-xF4u.js";
|
|
6
|
-
import { t as o } from "./upload-DWhfIa3Y.js";
|
|
7
|
-
import { t as s } from "./x-BDi_yYx9.js";
|
|
8
|
-
import { useCallback as c, useRef as l, useState as u } from "react";
|
|
9
|
-
import { Button as d, EmptyValue as f } from "@object-ui/components";
|
|
10
|
-
var p = n("camera", [["path", {
|
|
11
|
-
d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
|
|
12
|
-
key: "18u6gg"
|
|
13
|
-
}], ["circle", {
|
|
14
|
-
cx: "12",
|
|
15
|
-
cy: "13",
|
|
16
|
-
r: "3",
|
|
17
|
-
key: "1vg3eu"
|
|
18
|
-
}]]), m = n("file", [["path", {
|
|
19
|
-
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
20
|
-
key: "1oefj6"
|
|
21
|
-
}], ["path", {
|
|
22
|
-
d: "M14 2v5a1 1 0 0 0 1 1h5",
|
|
23
|
-
key: "wfsgrz"
|
|
24
|
-
}]]), h = /* @__PURE__ */ e({ FileField: () => _ }), g = t();
|
|
25
|
-
function _({ value: e, onChange: t, field: n, readonly: h, ..._ }) {
|
|
26
|
-
let v = l(null), y = l(null), b = n || _.schema, x = b?.multiple || !1, S = b?.accept ? b.accept.join(",") : void 0, C = b?.maxSize, w = b?.capture ?? null, T = !S || S.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), E = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), D = w === !1 ? !1 : w ?? (T && E ? "environment" : null), [O, k] = u(!1), [A, j] = u([]), { upload: M } = i(), [N, P] = u({}), [F, I] = u(!1), L = e ? Array.isArray(e) ? e : [e] : [], R = c(async (e) => {
|
|
27
|
-
if (e.length === 0) return;
|
|
28
|
-
let n = [], r = e.filter((e) => {
|
|
29
|
-
if (C && e.size > C) {
|
|
30
|
-
let t = (C / (1024 * 1024)).toFixed(1);
|
|
31
|
-
return n.push(`"${e.name}" exceeds max size (${t} MB)`), !1;
|
|
32
|
-
}
|
|
33
|
-
return !0;
|
|
34
|
-
});
|
|
35
|
-
if (j(n), r.length !== 0) {
|
|
36
|
-
I(!0);
|
|
37
|
-
try {
|
|
38
|
-
let e = (await Promise.all(r.map(async (e) => {
|
|
39
|
-
try {
|
|
40
|
-
let t = await M(e, { onProgress: (t) => P((n) => ({
|
|
41
|
-
...n,
|
|
42
|
-
[e.name]: t
|
|
43
|
-
})) });
|
|
44
|
-
return {
|
|
45
|
-
name: t.name,
|
|
46
|
-
original_name: e.name,
|
|
47
|
-
size: t.size,
|
|
48
|
-
mime_type: t.mimeType,
|
|
49
|
-
url: t.url
|
|
50
|
-
};
|
|
51
|
-
} catch (t) {
|
|
52
|
-
return n.push(`Failed to upload "${e.name}": ${t.message}`), j([...n]), null;
|
|
53
|
-
}
|
|
54
|
-
}))).filter(Boolean);
|
|
55
|
-
if (e.length === 0) return;
|
|
56
|
-
t(x ? [...L, ...e] : e[0]);
|
|
57
|
-
} finally {
|
|
58
|
-
I(!1), P({});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}, [
|
|
62
|
-
L,
|
|
63
|
-
x,
|
|
64
|
-
t,
|
|
65
|
-
C,
|
|
66
|
-
M
|
|
67
|
-
]), z = c((e) => {
|
|
68
|
-
e.preventDefault(), e.stopPropagation(), k(!0);
|
|
69
|
-
}, []), B = c((e) => {
|
|
70
|
-
e.preventDefault(), e.stopPropagation(), k(!1);
|
|
71
|
-
}, []), V = c((e) => {
|
|
72
|
-
e.preventDefault(), e.stopPropagation(), k(!1);
|
|
73
|
-
let t = Array.from(e.dataTransfer.files);
|
|
74
|
-
if (S) {
|
|
75
|
-
let e = S.split(",").map((e) => e.trim().toLowerCase());
|
|
76
|
-
R(t.filter((t) => {
|
|
77
|
-
let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
|
|
78
|
-
return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
|
|
79
|
-
}));
|
|
80
|
-
} else R(t);
|
|
81
|
-
}, [S, R]);
|
|
82
|
-
if (h) return e ? /* @__PURE__ */ (0, g.jsx)("div", {
|
|
83
|
-
className: "flex flex-wrap gap-2",
|
|
84
|
-
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ (0, g.jsx)("span", {
|
|
85
|
-
className: "text-sm truncate max-w-xs",
|
|
86
|
-
children: e.name || e.original_name || "File"
|
|
87
|
-
}, t))
|
|
88
|
-
}) : /* @__PURE__ */ (0, g.jsx)(f, {});
|
|
89
|
-
let H = (e) => {
|
|
90
|
-
R(Array.from(e.target.files || []));
|
|
91
|
-
}, U = (e) => {
|
|
92
|
-
if (x) {
|
|
93
|
-
let n = L.filter((t, n) => n !== e);
|
|
94
|
-
t(n.length > 0 ? n : null);
|
|
95
|
-
} else t(null);
|
|
96
|
-
}, W = (e) => (e.mime_type || "").startsWith("image/");
|
|
97
|
-
return /* @__PURE__ */ (0, g.jsxs)("div", {
|
|
98
|
-
className: _.className,
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ (0, g.jsx)("input", {
|
|
101
|
-
ref: v,
|
|
102
|
-
type: "file",
|
|
103
|
-
multiple: x,
|
|
104
|
-
accept: S,
|
|
105
|
-
onChange: H,
|
|
106
|
-
className: "hidden"
|
|
107
|
-
}),
|
|
108
|
-
D && /* @__PURE__ */ (0, g.jsx)("input", {
|
|
109
|
-
ref: y,
|
|
110
|
-
type: "file",
|
|
111
|
-
accept: "image/*",
|
|
112
|
-
capture: D,
|
|
113
|
-
onChange: H,
|
|
114
|
-
className: "hidden",
|
|
115
|
-
"aria-label": "Camera capture",
|
|
116
|
-
"data-testid": "file-field-camera-input"
|
|
117
|
-
}),
|
|
118
|
-
/* @__PURE__ */ (0, g.jsxs)("div", {
|
|
119
|
-
className: "space-y-2",
|
|
120
|
-
children: [
|
|
121
|
-
/* @__PURE__ */ (0, g.jsxs)("div", {
|
|
122
|
-
onDragOver: z,
|
|
123
|
-
onDragLeave: B,
|
|
124
|
-
onDrop: V,
|
|
125
|
-
onClick: () => v.current?.click(),
|
|
126
|
-
className: `
|
|
127
|
-
flex flex-col items-center justify-center gap-2 p-6
|
|
128
|
-
border-2 border-dashed rounded-lg cursor-pointer
|
|
129
|
-
transition-colors duration-200
|
|
130
|
-
${O ? "border-primary bg-primary/5 text-primary" : "border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
|
|
131
|
-
`,
|
|
132
|
-
role: "button",
|
|
133
|
-
tabIndex: 0,
|
|
134
|
-
onKeyDown: (e) => {
|
|
135
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), v.current?.click());
|
|
136
|
-
},
|
|
137
|
-
children: [/* @__PURE__ */ (0, g.jsx)(o, { className: `size-8 ${O ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ (0, g.jsxs)("div", {
|
|
138
|
-
className: "text-center",
|
|
139
|
-
children: [/* @__PURE__ */ (0, g.jsx)("p", {
|
|
140
|
-
className: "text-sm font-medium",
|
|
141
|
-
children: O ? "Drop files here" : "Drag & drop files here"
|
|
142
|
-
}), /* @__PURE__ */ (0, g.jsxs)("p", {
|
|
143
|
-
className: "text-xs text-muted-foreground mt-1",
|
|
144
|
-
children: ["or click to browse", D ? " • use the camera button below" : ""]
|
|
145
|
-
})]
|
|
146
|
-
})]
|
|
147
|
-
}),
|
|
148
|
-
D && /* @__PURE__ */ (0, g.jsxs)(d, {
|
|
149
|
-
type: "button",
|
|
150
|
-
variant: "outline",
|
|
151
|
-
size: "sm",
|
|
152
|
-
className: "w-full",
|
|
153
|
-
onClick: (e) => {
|
|
154
|
-
e.stopPropagation(), y.current?.click();
|
|
155
|
-
},
|
|
156
|
-
"data-testid": "file-field-camera-button",
|
|
157
|
-
children: [/* @__PURE__ */ (0, g.jsx)(p, { className: "size-4 mr-2" }), D === "user" ? "Take selfie" : "Take photo"]
|
|
158
|
-
}),
|
|
159
|
-
F && /* @__PURE__ */ (0, g.jsxs)("div", {
|
|
160
|
-
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
161
|
-
"data-testid": "file-field-uploading",
|
|
162
|
-
children: [/* @__PURE__ */ (0, g.jsx)(a, { className: "size-3 animate-spin" }), /* @__PURE__ */ (0, g.jsxs)("span", { children: ["Uploading…", Object.keys(N).length > 0 && ` (${Math.round(Object.values(N).reduce((e, t) => e + t, 0) / Object.keys(N).length * 100)}%)`] })]
|
|
163
|
-
}),
|
|
164
|
-
A.length > 0 && /* @__PURE__ */ (0, g.jsx)("div", {
|
|
165
|
-
className: "space-y-0.5",
|
|
166
|
-
children: A.map((e, t) => /* @__PURE__ */ (0, g.jsx)("p", {
|
|
167
|
-
className: "text-xs text-destructive",
|
|
168
|
-
children: e
|
|
169
|
-
}, t))
|
|
170
|
-
}),
|
|
171
|
-
L.length > 0 && /* @__PURE__ */ (0, g.jsx)("div", {
|
|
172
|
-
className: "space-y-1",
|
|
173
|
-
children: L.map((e, t) => /* @__PURE__ */ (0, g.jsxs)("div", {
|
|
174
|
-
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
175
|
-
children: [/* @__PURE__ */ (0, g.jsxs)("div", {
|
|
176
|
-
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
177
|
-
children: [
|
|
178
|
-
W(e) && e.url ? /* @__PURE__ */ (0, g.jsx)("img", {
|
|
179
|
-
src: e.url,
|
|
180
|
-
alt: e.name,
|
|
181
|
-
className: "size-8 object-cover rounded flex-shrink-0"
|
|
182
|
-
}) : W(e) ? /* @__PURE__ */ (0, g.jsx)(r, { className: "size-4 text-muted-foreground flex-shrink-0" }) : /* @__PURE__ */ (0, g.jsx)(m, { className: "size-4 text-muted-foreground flex-shrink-0" }),
|
|
183
|
-
/* @__PURE__ */ (0, g.jsx)("span", {
|
|
184
|
-
className: "text-sm truncate",
|
|
185
|
-
children: e.name || e.original_name || "File"
|
|
186
|
-
}),
|
|
187
|
-
e.size && /* @__PURE__ */ (0, g.jsxs)("span", {
|
|
188
|
-
className: "text-xs text-muted-foreground",
|
|
189
|
-
children: [
|
|
190
|
-
"(",
|
|
191
|
-
(e.size / 1024).toFixed(1),
|
|
192
|
-
" KB)"
|
|
193
|
-
]
|
|
194
|
-
})
|
|
195
|
-
]
|
|
196
|
-
}), /* @__PURE__ */ (0, g.jsx)(d, {
|
|
197
|
-
type: "button",
|
|
198
|
-
variant: "ghost",
|
|
199
|
-
size: "sm",
|
|
200
|
-
onClick: (e) => {
|
|
201
|
-
e.stopPropagation(), U(t);
|
|
202
|
-
},
|
|
203
|
-
className: "h-6 w-6 p-0",
|
|
204
|
-
children: /* @__PURE__ */ (0, g.jsx)(s, { className: "size-3" })
|
|
205
|
-
})]
|
|
206
|
-
}, t))
|
|
207
|
-
})
|
|
208
|
-
]
|
|
209
|
-
})
|
|
210
|
-
]
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
//#endregion
|
|
214
|
-
export { h as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
|
|
2
|
-
import { t } from "./jsx-runtime-CXSCp6pT.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import { EmptyValue as n } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/FormulaField.tsx
|
|
6
|
-
var r = /* @__PURE__ */ e({ FormulaField: () => a }), i = t();
|
|
7
|
-
function a({ value: e, field: t, ...r }) {
|
|
8
|
-
let a = (t || r.schema)?.return_type || "text";
|
|
9
|
-
if (e == null) return /* @__PURE__ */ (0, i.jsx)(n, { className: r.className });
|
|
10
|
-
let o;
|
|
11
|
-
return o = a === "number" || a === "currency" ? typeof e == "number" ? e.toFixed(2) : String(e) : a === "boolean" ? e ? "Yes" : "No" : a === "date" ? new Date(e).toLocaleDateString() : String(e), /* @__PURE__ */ (0, i.jsx)("span", {
|
|
12
|
-
className: `text-sm font-mono text-gray-700 ${r.className || ""}`,
|
|
13
|
-
children: o
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { r as t };
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
|
|
2
|
-
import { t } from "./jsx-runtime-CXSCp6pT.js";
|
|
3
|
-
import { t as n } from "./createLucideIcon-BtZxPlua.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import { Button as i, EmptyValue as a, Input as o, Label as s } from "@object-ui/components";
|
|
6
|
-
var c = n("crosshair", [
|
|
7
|
-
["circle", {
|
|
8
|
-
cx: "12",
|
|
9
|
-
cy: "12",
|
|
10
|
-
r: "10",
|
|
11
|
-
key: "1mglay"
|
|
12
|
-
}],
|
|
13
|
-
["line", {
|
|
14
|
-
x1: "22",
|
|
15
|
-
x2: "18",
|
|
16
|
-
y1: "12",
|
|
17
|
-
y2: "12",
|
|
18
|
-
key: "l9bcsi"
|
|
19
|
-
}],
|
|
20
|
-
["line", {
|
|
21
|
-
x1: "6",
|
|
22
|
-
x2: "2",
|
|
23
|
-
y1: "12",
|
|
24
|
-
y2: "12",
|
|
25
|
-
key: "13hhkx"
|
|
26
|
-
}],
|
|
27
|
-
["line", {
|
|
28
|
-
x1: "12",
|
|
29
|
-
x2: "12",
|
|
30
|
-
y1: "6",
|
|
31
|
-
y2: "2",
|
|
32
|
-
key: "10w3f3"
|
|
33
|
-
}],
|
|
34
|
-
["line", {
|
|
35
|
-
x1: "12",
|
|
36
|
-
x2: "12",
|
|
37
|
-
y1: "22",
|
|
38
|
-
y2: "18",
|
|
39
|
-
key: "15g9kq"
|
|
40
|
-
}]
|
|
41
|
-
]), l = n("map-pin", [["path", {
|
|
42
|
-
d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
|
|
43
|
-
key: "1r0f0z"
|
|
44
|
-
}], ["circle", {
|
|
45
|
-
cx: "12",
|
|
46
|
-
cy: "10",
|
|
47
|
-
r: "3",
|
|
48
|
-
key: "ilqhr7"
|
|
49
|
-
}]]), u = /* @__PURE__ */ e({ GeolocationField: () => f }), d = t();
|
|
50
|
-
function f({ value: e, onChange: t, field: n, readonly: u, ...f }) {
|
|
51
|
-
let [p, m] = r.useState(!1), h = e || {}, g = (e, n) => {
|
|
52
|
-
t({
|
|
53
|
-
...h,
|
|
54
|
-
[e]: n ? Number(n) : void 0
|
|
55
|
-
});
|
|
56
|
-
}, _ = () => {
|
|
57
|
-
if (!navigator.geolocation) {
|
|
58
|
-
console.error("Geolocation is not supported by this browser");
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
m(!0), navigator.geolocation.getCurrentPosition((e) => {
|
|
62
|
-
t({
|
|
63
|
-
latitude: e.coords.latitude,
|
|
64
|
-
longitude: e.coords.longitude,
|
|
65
|
-
accuracy: e.coords.accuracy
|
|
66
|
-
}), m(!1);
|
|
67
|
-
}, (e) => {
|
|
68
|
-
console.error("Error getting location:", e.message), m(!1);
|
|
69
|
-
}, {
|
|
70
|
-
enableHighAccuracy: !0,
|
|
71
|
-
timeout: 5e3,
|
|
72
|
-
maximumAge: 0
|
|
73
|
-
});
|
|
74
|
-
}, v = (e) => !e.latitude || !e.longitude ? "" : `${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`, y = () => {
|
|
75
|
-
if (!h.latitude || !h.longitude) return;
|
|
76
|
-
let e = `https://www.google.com/maps?q=${h.latitude},${h.longitude}`;
|
|
77
|
-
window.open(e, "_blank");
|
|
78
|
-
};
|
|
79
|
-
if (u) {
|
|
80
|
-
let e = v(h);
|
|
81
|
-
return /* @__PURE__ */ (0, d.jsxs)("div", {
|
|
82
|
-
className: "flex items-center gap-2",
|
|
83
|
-
children: [
|
|
84
|
-
/* @__PURE__ */ (0, d.jsx)(l, { className: "w-4 h-4 text-muted-foreground" }),
|
|
85
|
-
e ? /* @__PURE__ */ (0, d.jsx)("span", {
|
|
86
|
-
className: "text-sm",
|
|
87
|
-
children: e
|
|
88
|
-
}) : /* @__PURE__ */ (0, d.jsx)(a, {}),
|
|
89
|
-
h.latitude && h.longitude && /* @__PURE__ */ (0, d.jsx)(i, {
|
|
90
|
-
type: "button",
|
|
91
|
-
variant: "link",
|
|
92
|
-
size: "sm",
|
|
93
|
-
onClick: y,
|
|
94
|
-
className: "p-0 h-auto",
|
|
95
|
-
children: "View on map"
|
|
96
|
-
})
|
|
97
|
-
]
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return /* @__PURE__ */ (0, d.jsxs)("div", {
|
|
101
|
-
className: "space-y-3",
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ (0, d.jsxs)("div", {
|
|
104
|
-
className: "flex items-center gap-2",
|
|
105
|
-
children: [/* @__PURE__ */ (0, d.jsxs)(i, {
|
|
106
|
-
type: "button",
|
|
107
|
-
variant: "outline",
|
|
108
|
-
size: "sm",
|
|
109
|
-
onClick: _,
|
|
110
|
-
disabled: u || p,
|
|
111
|
-
children: [/* @__PURE__ */ (0, d.jsx)(c, { className: "w-4 h-4 mr-2" }), p ? "Getting location..." : "Use Current Location"]
|
|
112
|
-
}), h.latitude && h.longitude && /* @__PURE__ */ (0, d.jsxs)(i, {
|
|
113
|
-
type: "button",
|
|
114
|
-
variant: "link",
|
|
115
|
-
size: "sm",
|
|
116
|
-
onClick: y,
|
|
117
|
-
children: [/* @__PURE__ */ (0, d.jsx)(l, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
118
|
-
})]
|
|
119
|
-
}),
|
|
120
|
-
/* @__PURE__ */ (0, d.jsxs)("div", {
|
|
121
|
-
className: "grid grid-cols-2 gap-3",
|
|
122
|
-
children: [/* @__PURE__ */ (0, d.jsxs)("div", { children: [/* @__PURE__ */ (0, d.jsx)(s, {
|
|
123
|
-
htmlFor: "latitude",
|
|
124
|
-
className: "text-xs",
|
|
125
|
-
children: "Latitude"
|
|
126
|
-
}), /* @__PURE__ */ (0, d.jsx)(o, {
|
|
127
|
-
id: "latitude",
|
|
128
|
-
type: "number",
|
|
129
|
-
value: h.latitude ?? "",
|
|
130
|
-
onChange: (e) => g("latitude", e.target.value),
|
|
131
|
-
placeholder: "37.7749",
|
|
132
|
-
disabled: u || f.disabled,
|
|
133
|
-
step: "any",
|
|
134
|
-
className: f.className
|
|
135
|
-
})] }), /* @__PURE__ */ (0, d.jsxs)("div", { children: [/* @__PURE__ */ (0, d.jsx)(s, {
|
|
136
|
-
htmlFor: "longitude",
|
|
137
|
-
className: "text-xs",
|
|
138
|
-
children: "Longitude"
|
|
139
|
-
}), /* @__PURE__ */ (0, d.jsx)(o, {
|
|
140
|
-
id: "longitude",
|
|
141
|
-
type: "number",
|
|
142
|
-
value: h.longitude ?? "",
|
|
143
|
-
onChange: (e) => g("longitude", e.target.value),
|
|
144
|
-
placeholder: "-122.4194",
|
|
145
|
-
disabled: u || f.disabled,
|
|
146
|
-
step: "any"
|
|
147
|
-
})] })]
|
|
148
|
-
}),
|
|
149
|
-
h.accuracy && /* @__PURE__ */ (0, d.jsxs)("p", {
|
|
150
|
-
className: "text-xs text-muted-foreground",
|
|
151
|
-
children: [
|
|
152
|
-
"Accuracy: ±",
|
|
153
|
-
h.accuracy.toFixed(0),
|
|
154
|
-
"m"
|
|
155
|
-
]
|
|
156
|
-
})
|
|
157
|
-
]
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
|
-
export { u as t };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
|
|
2
|
-
import { t } from "./jsx-runtime-CXSCp6pT.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import { EmptyValue as n, cn as r } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/GridField.tsx
|
|
6
|
-
var i = /* @__PURE__ */ e({ GridField: () => o }), a = t();
|
|
7
|
-
function o({ value: e, field: t, readonly: i, ...o }) {
|
|
8
|
-
let s = (t || o.schema)?.columns || [];
|
|
9
|
-
return !e || !Array.isArray(e) ? /* @__PURE__ */ (0, a.jsx)(n, {}) : i ? /* @__PURE__ */ (0, a.jsx)("div", {
|
|
10
|
-
className: r("text-sm", o.className),
|
|
11
|
-
children: /* @__PURE__ */ (0, a.jsxs)("span", {
|
|
12
|
-
className: "text-foreground",
|
|
13
|
-
children: [e.length, " rows"]
|
|
14
|
-
})
|
|
15
|
-
}) : /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
16
|
-
className: r("border border-border rounded-lg overflow-hidden", o.className),
|
|
17
|
-
children: [/* @__PURE__ */ (0, a.jsx)("div", {
|
|
18
|
-
className: "overflow-auto max-h-60",
|
|
19
|
-
children: /* @__PURE__ */ (0, a.jsxs)("table", {
|
|
20
|
-
className: "w-full text-sm",
|
|
21
|
-
children: [/* @__PURE__ */ (0, a.jsx)("thead", {
|
|
22
|
-
className: "bg-muted border-b border-border",
|
|
23
|
-
children: /* @__PURE__ */ (0, a.jsx)("tr", { children: s.map((e, t) => /* @__PURE__ */ (0, a.jsx)("th", {
|
|
24
|
-
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
25
|
-
children: e.label || e.name
|
|
26
|
-
}, t)) })
|
|
27
|
-
}), /* @__PURE__ */ (0, a.jsx)("tbody", {
|
|
28
|
-
className: "divide-y divide-border",
|
|
29
|
-
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */ (0, a.jsx)("tr", {
|
|
30
|
-
className: "hover:bg-muted/50 transition-colors",
|
|
31
|
-
children: s.map((t, r) => /* @__PURE__ */ (0, a.jsx)("td", {
|
|
32
|
-
className: "px-3 py-2 text-foreground",
|
|
33
|
-
children: e[t.name] == null ? /* @__PURE__ */ (0, a.jsx)(n, {}) : String(e[t.name])
|
|
34
|
-
}, r))
|
|
35
|
-
}, t))
|
|
36
|
-
})]
|
|
37
|
-
})
|
|
38
|
-
}), e.length > 5 && /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
39
|
-
className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",
|
|
40
|
-
children: [
|
|
41
|
-
"Showing 5 of ",
|
|
42
|
-
e.length,
|
|
43
|
-
" rows"
|
|
44
|
-
]
|
|
45
|
-
})]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { i as t };
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
|
|
2
|
-
import { t } from "./jsx-runtime-CXSCp6pT.js";
|
|
3
|
-
import { t as n } from "./createLucideIcon-BtZxPlua.js";
|
|
4
|
-
import { t as r } from "./crop-2wjrXKXD.js";
|
|
5
|
-
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
6
|
-
import { Button as c, Dialog as l, DialogContent as u, DialogDescription as d, DialogFooter as f, DialogHeader as p, DialogTitle as m } from "@object-ui/components";
|
|
7
|
-
var h = n("rotate-cw", [["path", {
|
|
8
|
-
d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
|
|
9
|
-
key: "1p45f6"
|
|
10
|
-
}], ["path", {
|
|
11
|
-
d: "M21 3v5h-5",
|
|
12
|
-
key: "1q7to0"
|
|
13
|
-
}]]), g = /* @__PURE__ */ e({ ImageCropperDialog: () => v }), _ = t(), v = ({ open: e, onOpenChange: t, src: n, outputType: g = "image/png", outputName: v = "cropped.png", onConfirm: y }) => {
|
|
14
|
-
let b = o(null), x = o(null), [S, C] = s(0), [w, T] = s({
|
|
15
|
-
x: 0,
|
|
16
|
-
y: 0,
|
|
17
|
-
width: 100,
|
|
18
|
-
height: 100
|
|
19
|
-
}), [E, D] = s(null), [O, k] = s(!1);
|
|
20
|
-
a(() => {
|
|
21
|
-
if (!e || !n) return;
|
|
22
|
-
k(!1);
|
|
23
|
-
let t = new Image();
|
|
24
|
-
t.crossOrigin = "anonymous", t.onload = () => {
|
|
25
|
-
x.current = t;
|
|
26
|
-
let e = t.naturalWidth * .8, n = t.naturalHeight * .8;
|
|
27
|
-
T({
|
|
28
|
-
x: (t.naturalWidth - e) / 2,
|
|
29
|
-
y: (t.naturalHeight - n) / 2,
|
|
30
|
-
width: e,
|
|
31
|
-
height: n
|
|
32
|
-
}), C(0), k(!0);
|
|
33
|
-
}, t.onerror = () => k(!1), t.src = n;
|
|
34
|
-
}, [e, n]), a(() => {
|
|
35
|
-
if (!O || !x.current || !b.current) return;
|
|
36
|
-
let e = x.current, t = b.current, n = t.getContext("2d");
|
|
37
|
-
if (!n) return;
|
|
38
|
-
let r = 480 / e.naturalWidth, i = e.naturalHeight * r;
|
|
39
|
-
t.width = 480, t.height = i, n.clearRect(0, 0, 480, i), n.save(), n.translate(480 / 2, i / 2), n.rotate(S * Math.PI / 180);
|
|
40
|
-
let a = S % 180 == 0 ? 480 : i, o = S % 180 == 0 ? i : 480;
|
|
41
|
-
n.drawImage(e, -a / 2, -o / 2, a, o), n.restore();
|
|
42
|
-
let s = w.x * r, c = w.y * r, l = w.width * r, u = w.height * r;
|
|
43
|
-
n.fillStyle = "rgba(0,0,0,0.45)", n.fillRect(0, 0, 480, c), n.fillRect(0, c + u, 480, i - c - u), n.fillRect(0, c, s, u), n.fillRect(s + l, c, 480 - s - l, u), n.strokeStyle = "#3b82f6", n.lineWidth = 2, n.strokeRect(s, c, l, u);
|
|
44
|
-
}, [
|
|
45
|
-
O,
|
|
46
|
-
w,
|
|
47
|
-
S
|
|
48
|
-
]);
|
|
49
|
-
let A = i((e) => {
|
|
50
|
-
if (!x.current || !b.current) return;
|
|
51
|
-
let t = b.current.getBoundingClientRect(), n = x.current.naturalWidth / t.width;
|
|
52
|
-
D({
|
|
53
|
-
ox: (e.clientX - t.left) * n,
|
|
54
|
-
oy: (e.clientY - t.top) * n,
|
|
55
|
-
cx: w.x,
|
|
56
|
-
cy: w.y
|
|
57
|
-
}), e.target.setPointerCapture(e.pointerId);
|
|
58
|
-
}, [w]), j = i((e) => {
|
|
59
|
-
if (!E || !x.current || !b.current) return;
|
|
60
|
-
let t = b.current.getBoundingClientRect(), n = x.current.naturalWidth / t.width, r = (e.clientX - t.left) * n - E.ox, i = (e.clientY - t.top) * n - E.oy, a = Math.max(0, Math.min(E.cx + r, x.current.naturalWidth - w.width)), o = Math.max(0, Math.min(E.cy + i, x.current.naturalHeight - w.height));
|
|
61
|
-
T((e) => ({
|
|
62
|
-
...e,
|
|
63
|
-
x: a,
|
|
64
|
-
y: o
|
|
65
|
-
}));
|
|
66
|
-
}, [
|
|
67
|
-
E,
|
|
68
|
-
w.width,
|
|
69
|
-
w.height
|
|
70
|
-
]), M = i(() => D(null), []), N = i(() => C((e) => (e + 90) % 360), []), P = i(async () => {
|
|
71
|
-
if (!x.current) return;
|
|
72
|
-
let e = x.current, n = document.createElement("canvas"), r = w.width, i = w.height;
|
|
73
|
-
n.width = S % 180 == 0 ? r : i, n.height = S % 180 == 0 ? i : r;
|
|
74
|
-
let a = n.getContext("2d");
|
|
75
|
-
if (!a) return;
|
|
76
|
-
a.save(), a.translate(n.width / 2, n.height / 2), a.rotate(S * Math.PI / 180), a.drawImage(e, w.x, w.y, r, i, -r / 2, -i / 2, r, i), a.restore();
|
|
77
|
-
let o = await new Promise((e) => n.toBlob(e, g));
|
|
78
|
-
o && (y(o, v), t(!1));
|
|
79
|
-
}, [
|
|
80
|
-
w,
|
|
81
|
-
S,
|
|
82
|
-
v,
|
|
83
|
-
g,
|
|
84
|
-
y,
|
|
85
|
-
t
|
|
86
|
-
]);
|
|
87
|
-
return /* @__PURE__ */ (0, _.jsx)(l, {
|
|
88
|
-
open: e,
|
|
89
|
-
onOpenChange: t,
|
|
90
|
-
children: /* @__PURE__ */ (0, _.jsxs)(u, {
|
|
91
|
-
className: "max-w-xl",
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ (0, _.jsxs)(p, { children: [/* @__PURE__ */ (0, _.jsx)(m, { children: "Crop & rotate image" }), /* @__PURE__ */ (0, _.jsx)(d, { children: "Drag the highlighted box to reposition the crop. Use the rotate button to spin the image in 90° increments." })] }),
|
|
94
|
-
/* @__PURE__ */ (0, _.jsxs)("div", {
|
|
95
|
-
className: "flex flex-col items-center gap-3",
|
|
96
|
-
children: [O ? /* @__PURE__ */ (0, _.jsx)("canvas", {
|
|
97
|
-
ref: b,
|
|
98
|
-
"data-testid": "image-cropper-canvas",
|
|
99
|
-
role: "img",
|
|
100
|
-
"aria-label": "Image crop preview",
|
|
101
|
-
className: "border rounded-md cursor-move touch-none max-w-full",
|
|
102
|
-
onPointerDown: A,
|
|
103
|
-
onPointerMove: j,
|
|
104
|
-
onPointerUp: M,
|
|
105
|
-
onPointerCancel: M
|
|
106
|
-
}) : /* @__PURE__ */ (0, _.jsx)("div", {
|
|
107
|
-
className: "flex h-[270px] w-full items-center justify-center text-sm text-muted-foreground",
|
|
108
|
-
children: "Loading image…"
|
|
109
|
-
}), /* @__PURE__ */ (0, _.jsxs)("div", {
|
|
110
|
-
className: "flex w-full items-center justify-between text-xs text-muted-foreground",
|
|
111
|
-
children: [/* @__PURE__ */ (0, _.jsxs)("span", { children: [
|
|
112
|
-
"Crop: ",
|
|
113
|
-
Math.round(w.width),
|
|
114
|
-
" × ",
|
|
115
|
-
Math.round(w.height),
|
|
116
|
-
" px"
|
|
117
|
-
] }), /* @__PURE__ */ (0, _.jsxs)("span", { children: [
|
|
118
|
-
"Rotation: ",
|
|
119
|
-
S,
|
|
120
|
-
"°"
|
|
121
|
-
] })]
|
|
122
|
-
})]
|
|
123
|
-
}),
|
|
124
|
-
/* @__PURE__ */ (0, _.jsxs)(f, {
|
|
125
|
-
className: "flex justify-between sm:justify-between",
|
|
126
|
-
children: [/* @__PURE__ */ (0, _.jsxs)(c, {
|
|
127
|
-
type: "button",
|
|
128
|
-
variant: "outline",
|
|
129
|
-
onClick: N,
|
|
130
|
-
"data-testid": "image-cropper-rotate",
|
|
131
|
-
children: [/* @__PURE__ */ (0, _.jsx)(h, { className: "size-4 mr-2" }), "Rotate 90°"]
|
|
132
|
-
}), /* @__PURE__ */ (0, _.jsxs)("div", {
|
|
133
|
-
className: "flex gap-2",
|
|
134
|
-
children: [/* @__PURE__ */ (0, _.jsx)(c, {
|
|
135
|
-
type: "button",
|
|
136
|
-
variant: "ghost",
|
|
137
|
-
onClick: () => t(!1),
|
|
138
|
-
children: "Cancel"
|
|
139
|
-
}), /* @__PURE__ */ (0, _.jsxs)(c, {
|
|
140
|
-
type: "button",
|
|
141
|
-
onClick: P,
|
|
142
|
-
disabled: !O,
|
|
143
|
-
"data-testid": "image-cropper-confirm",
|
|
144
|
-
children: [/* @__PURE__ */ (0, _.jsx)(r, { className: "size-4 mr-2" }), "Apply crop"]
|
|
145
|
-
})]
|
|
146
|
-
})]
|
|
147
|
-
})
|
|
148
|
-
]
|
|
149
|
-
})
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
//#endregion
|
|
153
|
-
export { g as t };
|