@nestledjs/data-browser 0.1.5 → 0.1.6
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/lib/layouts/AdminDataLayout.js +20 -20
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { AdminLocalStorage as j } from "../utils/secure-storage.js";
|
|
|
6
6
|
import { spacedWords as c, kebabCase as g } from "../utils/string-utils.js";
|
|
7
7
|
import { useAdminDataContext as F } from "../context/AdminDataContext.js";
|
|
8
8
|
function H() {
|
|
9
|
-
const L = M(), b = C(), { databaseModels: h, basePath:
|
|
9
|
+
const L = M(), b = C(), { databaseModels: h, basePath: P = "/admin/data" } = F(), [n, I] = x(!1), [d, y] = x(null), o = B(null), m = v(
|
|
10
10
|
() => [...h].sort(
|
|
11
11
|
(t, a) => r(c(t.name)).localeCompare(r(c(a.name)))
|
|
12
12
|
),
|
|
@@ -14,17 +14,17 @@ function H() {
|
|
|
14
14
|
), u = v(() => {
|
|
15
15
|
const t = b.dataTypePlural;
|
|
16
16
|
return t ? m.find((a) => g(r(a.name)).toLowerCase() === t.toLowerCase()) : null;
|
|
17
|
-
}, [b.dataTypePlural, m]),
|
|
17
|
+
}, [b.dataTypePlural, m]), k = (t) => {
|
|
18
18
|
const a = t.target.value;
|
|
19
19
|
if (a) {
|
|
20
20
|
const s = m.find((l) => l.name === a);
|
|
21
|
-
s && L(`${
|
|
21
|
+
s && L(`${P}/${g(r(s.name))}`);
|
|
22
22
|
}
|
|
23
|
-
}, k = () => {
|
|
24
|
-
P(!n);
|
|
25
|
-
}, i = (t, a) => {
|
|
26
|
-
f({ type: t, message: a }), setTimeout(() => f(null), 5e3);
|
|
27
23
|
}, U = () => {
|
|
24
|
+
I(!n);
|
|
25
|
+
}, i = (t, a) => {
|
|
26
|
+
y({ type: t, message: a }), setTimeout(() => y(null), 5e3);
|
|
27
|
+
}, w = () => {
|
|
28
28
|
const t = j.exportConfig();
|
|
29
29
|
if (!t) {
|
|
30
30
|
i("error", "Failed to export preferences");
|
|
@@ -47,13 +47,13 @@ function H() {
|
|
|
47
47
|
j.importConfig(N) ? (i("success", "Preferences imported successfully. Refreshing..."), setTimeout(() => window.location.reload(), 1500)) : i("error", "Invalid preferences file");
|
|
48
48
|
}, s.onerror = () => {
|
|
49
49
|
i("error", "Failed to read file");
|
|
50
|
-
}, s.readAsText(a),
|
|
50
|
+
}, s.readAsText(a), o.current && (o.current.value = "");
|
|
51
51
|
}, D = () => {
|
|
52
52
|
var t;
|
|
53
|
-
(t =
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
(t = o.current) == null || t.click();
|
|
54
|
+
}, f = /* @__PURE__ */ e("div", { className: "max-w-full mx-auto flex flex-col", children: [
|
|
55
|
+
d && /* @__PURE__ */ e("div", { className: `mb-4 px-4 py-3 rounded-md border ${d.type === "success" ? "bg-green-50 border-green-200 text-green-800 dark:bg-green-900/20 dark:border-green-800 dark:text-green-200" : "bg-red-50 border-red-200 text-red-800 dark:bg-red-900/20 dark:border-red-800 dark:text-red-200"}`, children: /* @__PURE__ */ e("div", { className: "flex items-center", children: [
|
|
56
|
+
d.type === "success" ? /* @__PURE__ */ e("svg", { className: "w-5 h-5 mr-2", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }, void 0, !1, {
|
|
57
57
|
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/admin-data/src/lib/layouts/AdminDataLayout.tsx",
|
|
58
58
|
lineNumber: 133,
|
|
59
59
|
columnNumber: 17
|
|
@@ -70,7 +70,7 @@ function H() {
|
|
|
70
70
|
lineNumber: 136,
|
|
71
71
|
columnNumber: 15
|
|
72
72
|
}, this),
|
|
73
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children:
|
|
73
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: d.message }, void 0, !1, {
|
|
74
74
|
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/admin-data/src/lib/layouts/AdminDataLayout.tsx",
|
|
75
75
|
lineNumber: 140,
|
|
76
76
|
columnNumber: 13
|
|
@@ -98,7 +98,7 @@ function H() {
|
|
|
98
98
|
{
|
|
99
99
|
id: "model-selector",
|
|
100
100
|
value: (u == null ? void 0 : u.name) || "",
|
|
101
|
-
onChange:
|
|
101
|
+
onChange: k,
|
|
102
102
|
className: "w-full h-[50px] pl-4 pr-10 py-3 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-web focus:border-green-web text-base appearance-none cursor-pointer",
|
|
103
103
|
children: [
|
|
104
104
|
/* @__PURE__ */ e("option", { value: "", children: "Choose a model..." }, void 0, !1, {
|
|
@@ -148,7 +148,7 @@ function H() {
|
|
|
148
148
|
/* @__PURE__ */ e(
|
|
149
149
|
"button",
|
|
150
150
|
{
|
|
151
|
-
onClick:
|
|
151
|
+
onClick: U,
|
|
152
152
|
className: "h-[50px] px-4 py-3 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-green-web focus:border-green-web transition-colors",
|
|
153
153
|
title: n ? "Exit fullscreen" : "Enter fullscreen",
|
|
154
154
|
children: n ? /* @__PURE__ */ e("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" }, void 0, !1, {
|
|
@@ -192,7 +192,7 @@ function H() {
|
|
|
192
192
|
/* @__PURE__ */ e(
|
|
193
193
|
"button",
|
|
194
194
|
{
|
|
195
|
-
onClick:
|
|
195
|
+
onClick: w,
|
|
196
196
|
className: "inline-flex items-center px-3 py-1.5 text-gray-700 dark:text-gray-300 hover:text-green-web dark:hover:text-green-web transition-colors",
|
|
197
197
|
title: "Export your preferences to a file",
|
|
198
198
|
children: [
|
|
@@ -253,7 +253,7 @@ function H() {
|
|
|
253
253
|
/* @__PURE__ */ e(
|
|
254
254
|
"input",
|
|
255
255
|
{
|
|
256
|
-
ref:
|
|
256
|
+
ref: o,
|
|
257
257
|
type: "file",
|
|
258
258
|
accept: "application/json,.json",
|
|
259
259
|
onChange: A,
|
|
@@ -278,7 +278,7 @@ function H() {
|
|
|
278
278
|
lineNumber: 146,
|
|
279
279
|
columnNumber: 7
|
|
280
280
|
}, this),
|
|
281
|
-
/* @__PURE__ */ e("div", {
|
|
281
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(R, {}, void 0, !1, {
|
|
282
282
|
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/admin-data/src/lib/layouts/AdminDataLayout.tsx",
|
|
283
283
|
lineNumber: 229,
|
|
284
284
|
columnNumber: 9
|
|
@@ -292,7 +292,7 @@ function H() {
|
|
|
292
292
|
lineNumber: 122,
|
|
293
293
|
columnNumber: 5
|
|
294
294
|
}, this);
|
|
295
|
-
return n ? /* @__PURE__ */ e("div", { className: "fixed inset-0 z-50 bg-white dark:bg-gray-900
|
|
295
|
+
return n ? /* @__PURE__ */ e("div", { className: "fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col", children: /* @__PURE__ */ e("div", { className: "w-full p-6 md:p-8 lg:p-12", children: f }, void 0, !1, {
|
|
296
296
|
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/admin-data/src/lib/layouts/AdminDataLayout.tsx",
|
|
297
297
|
lineNumber: 237,
|
|
298
298
|
columnNumber: 9
|
|
@@ -300,7 +300,7 @@ function H() {
|
|
|
300
300
|
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/admin-data/src/lib/layouts/AdminDataLayout.tsx",
|
|
301
301
|
lineNumber: 236,
|
|
302
302
|
columnNumber: 7
|
|
303
|
-
}, this) : /* @__PURE__ */ e("div", { className: "
|
|
303
|
+
}, this) : /* @__PURE__ */ e("div", { className: "flex flex-col", children: /* @__PURE__ */ e("main", { className: "w-full p-6 md:p-8 lg:p-12", children: f }, void 0, !1, {
|
|
304
304
|
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/admin-data/src/lib/layouts/AdminDataLayout.tsx",
|
|
305
305
|
lineNumber: 246,
|
|
306
306
|
columnNumber: 7
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestledjs/data-browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Universal admin data browser for Nestled framework projects with full CRUD operations",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@heroicons/react": "^2.0.0",
|
|
40
40
|
"@nestledjs/forms": "^0.5.0",
|
|
41
41
|
"@nestledjs/helpers": "^0.1.0",
|
|
42
|
-
"@nestledjs/shared-components": "^0.1.
|
|
42
|
+
"@nestledjs/shared-components": "^0.1.6",
|
|
43
43
|
"react": "^19.0.0",
|
|
44
44
|
"react-router": "^7.0.0"
|
|
45
45
|
},
|