@nestledjs/data-browser 0.1.18 → 0.1.21
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/components/RelationFieldWrapper.js +10 -42
- package/lib/components/filters/DateRangeFilter.js +18 -66
- package/lib/components/filters/NumberRangeFilter.js +18 -66
- package/lib/components/filters/RelationComponents.js +37 -164
- package/lib/components/filters/RelationFilterField.js +16 -60
- package/lib/components/shared/AdminBreadcrumbs.js +15 -67
- package/lib/components/shared/AdminErrorStates.js +27 -127
- package/lib/components/shared/AdminStatusDisplay.js +13 -53
- package/lib/context/AdminDataContext.js +2 -6
- package/lib/layouts/AdminDataLayout.js +39 -219
- package/lib/pages/AdminDataCreatePage.js +63 -335
- package/lib/pages/AdminDataEditPage.js +111 -571
- package/lib/pages/AdminDataIndexPage.js +17 -68
- package/lib/pages/AdminDataListPage.js +153 -698
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Link } from "react-router";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
const toKebabCase = (str) => {
|
|
@@ -36,15 +36,15 @@ function RelationFieldWrapper({
|
|
|
36
36
|
}
|
|
37
37
|
}, [fieldName, currentValue, initialValue]);
|
|
38
38
|
const showViewLink = !!(relationType && currentValue && currentValue !== "");
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
40
40
|
children,
|
|
41
|
-
showViewLink && /* @__PURE__ */
|
|
41
|
+
showViewLink && /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxs(
|
|
42
42
|
Link,
|
|
43
43
|
{
|
|
44
44
|
to: `${basePath}/${toKebabCase(relationType)}/${currentValue}`,
|
|
45
45
|
className: "inline-flex items-center text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 hover:underline",
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
48
|
"svg",
|
|
49
49
|
{
|
|
50
50
|
className: "h-3 w-3 mr-1",
|
|
@@ -52,56 +52,24 @@ function RelationFieldWrapper({
|
|
|
52
52
|
stroke: "currentColor",
|
|
53
53
|
viewBox: "0 0 24 24",
|
|
54
54
|
xmlns: "http://www.w3.org/2000/svg",
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ jsx(
|
|
56
56
|
"path",
|
|
57
57
|
{
|
|
58
58
|
strokeLinecap: "round",
|
|
59
59
|
strokeLinejoin: "round",
|
|
60
60
|
strokeWidth: 2,
|
|
61
61
|
d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
|
|
62
|
-
}
|
|
63
|
-
void 0,
|
|
64
|
-
false,
|
|
65
|
-
{
|
|
66
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/RelationFieldWrapper.tsx",
|
|
67
|
-
lineNumber: 79,
|
|
68
|
-
columnNumber: 15
|
|
69
|
-
},
|
|
70
|
-
this
|
|
62
|
+
}
|
|
71
63
|
)
|
|
72
|
-
}
|
|
73
|
-
void 0,
|
|
74
|
-
false,
|
|
75
|
-
{
|
|
76
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/RelationFieldWrapper.tsx",
|
|
77
|
-
lineNumber: 72,
|
|
78
|
-
columnNumber: 13
|
|
79
|
-
},
|
|
80
|
-
this
|
|
64
|
+
}
|
|
81
65
|
),
|
|
82
66
|
"View ",
|
|
83
67
|
relationType,
|
|
84
68
|
" record"
|
|
85
69
|
]
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/RelationFieldWrapper.tsx",
|
|
91
|
-
lineNumber: 68,
|
|
92
|
-
columnNumber: 11
|
|
93
|
-
},
|
|
94
|
-
this
|
|
95
|
-
) }, void 0, false, {
|
|
96
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/RelationFieldWrapper.tsx",
|
|
97
|
-
lineNumber: 67,
|
|
98
|
-
columnNumber: 9
|
|
99
|
-
}, this)
|
|
100
|
-
] }, void 0, true, {
|
|
101
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/RelationFieldWrapper.tsx",
|
|
102
|
-
lineNumber: 64,
|
|
103
|
-
columnNumber: 5
|
|
104
|
-
}, this);
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
] });
|
|
105
73
|
}
|
|
106
74
|
export {
|
|
107
75
|
RelationFieldWrapper
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { formatFieldName } from "../../utils/string-utils.js";
|
|
3
3
|
function DateRangeFilter({
|
|
4
4
|
fieldName,
|
|
@@ -35,20 +35,12 @@ function DateRangeFilter({
|
|
|
35
35
|
onChange(newValue);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */ jsxDEV("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
45
|
-
/* @__PURE__ */ jsxDEV("div", { children: [
|
|
46
|
-
/* @__PURE__ */ jsxDEV("label", { htmlFor: `${fieldName}-from`, className: "block text-xs text-gray-500 mb-1", children: "From" }, void 0, false, {
|
|
47
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/DateRangeFilter.tsx",
|
|
48
|
-
lineNumber: 61,
|
|
49
|
-
columnNumber: 11
|
|
50
|
-
}, this),
|
|
51
|
-
/* @__PURE__ */ jsxDEV(
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
39
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700", children: formatFieldName(fieldName) }),
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
42
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${fieldName}-from`, className: "block text-xs text-gray-500 mb-1", children: "From" }),
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
52
44
|
"input",
|
|
53
45
|
{
|
|
54
46
|
id: `${fieldName}-from`,
|
|
@@ -56,28 +48,12 @@ function DateRangeFilter({
|
|
|
56
48
|
value: fromDate,
|
|
57
49
|
onChange: (e) => handleFromChange(e.target.value),
|
|
58
50
|
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-green-web focus:border-green-web"
|
|
59
|
-
}
|
|
60
|
-
void 0,
|
|
61
|
-
false,
|
|
62
|
-
{
|
|
63
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/DateRangeFilter.tsx",
|
|
64
|
-
lineNumber: 62,
|
|
65
|
-
columnNumber: 11
|
|
66
|
-
},
|
|
67
|
-
this
|
|
51
|
+
}
|
|
68
52
|
)
|
|
69
|
-
] },
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, this),
|
|
74
|
-
/* @__PURE__ */ jsxDEV("div", { children: [
|
|
75
|
-
/* @__PURE__ */ jsxDEV("label", { htmlFor: `${fieldName}-to`, className: "block text-xs text-gray-500 mb-1", children: "To" }, void 0, false, {
|
|
76
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/DateRangeFilter.tsx",
|
|
77
|
-
lineNumber: 71,
|
|
78
|
-
columnNumber: 11
|
|
79
|
-
}, this),
|
|
80
|
-
/* @__PURE__ */ jsxDEV(
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
55
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${fieldName}-to`, className: "block text-xs text-gray-500 mb-1", children: "To" }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
81
57
|
"input",
|
|
82
58
|
{
|
|
83
59
|
id: `${fieldName}-to`,
|
|
@@ -85,40 +61,16 @@ function DateRangeFilter({
|
|
|
85
61
|
value: toDate,
|
|
86
62
|
onChange: (e) => handleToChange(e.target.value),
|
|
87
63
|
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-green-web focus:border-green-web"
|
|
88
|
-
}
|
|
89
|
-
void 0,
|
|
90
|
-
false,
|
|
91
|
-
{
|
|
92
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/DateRangeFilter.tsx",
|
|
93
|
-
lineNumber: 72,
|
|
94
|
-
columnNumber: 11
|
|
95
|
-
},
|
|
96
|
-
this
|
|
64
|
+
}
|
|
97
65
|
)
|
|
98
|
-
] }
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
columnNumber: 9
|
|
102
|
-
}, this)
|
|
103
|
-
] }, void 0, true, {
|
|
104
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/DateRangeFilter.tsx",
|
|
105
|
-
lineNumber: 59,
|
|
106
|
-
columnNumber: 7
|
|
107
|
-
}, this),
|
|
108
|
-
(fromDate || toDate) && /* @__PURE__ */ jsxDEV("div", { className: "text-xs text-gray-500", children: [
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
(fromDate || toDate) && /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500", children: [
|
|
109
69
|
fromDate && toDate && `${fromDate} to ${toDate}`,
|
|
110
70
|
fromDate && !toDate && `From ${fromDate}`,
|
|
111
71
|
!fromDate && toDate && `Until ${toDate}`
|
|
112
|
-
] }
|
|
113
|
-
|
|
114
|
-
lineNumber: 82,
|
|
115
|
-
columnNumber: 9
|
|
116
|
-
}, this)
|
|
117
|
-
] }, void 0, true, {
|
|
118
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/DateRangeFilter.tsx",
|
|
119
|
-
lineNumber: 55,
|
|
120
|
-
columnNumber: 5
|
|
121
|
-
}, this);
|
|
72
|
+
] })
|
|
73
|
+
] });
|
|
122
74
|
}
|
|
123
75
|
export {
|
|
124
76
|
DateRangeFilter
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { formatFieldName } from "../../utils/string-utils.js";
|
|
3
3
|
function NumberRangeFilter({
|
|
4
4
|
fieldName,
|
|
@@ -48,20 +48,12 @@ function NumberRangeFilter({
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const step = fieldType === "int" || fieldType === "bigint" ? "1" : "any";
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */ jsxDEV("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
58
|
-
/* @__PURE__ */ jsxDEV("div", { children: [
|
|
59
|
-
/* @__PURE__ */ jsxDEV("label", { htmlFor: `${fieldName}-min`, className: "block text-xs text-gray-500 mb-1", children: "Min" }, void 0, false, {
|
|
60
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/NumberRangeFilter.tsx",
|
|
61
|
-
lineNumber: 80,
|
|
62
|
-
columnNumber: 11
|
|
63
|
-
}, this),
|
|
64
|
-
/* @__PURE__ */ jsxDEV(
|
|
51
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
52
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700", children: formatFieldName(fieldName) }),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
55
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${fieldName}-min`, className: "block text-xs text-gray-500 mb-1", children: "Min" }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
65
57
|
"input",
|
|
66
58
|
{
|
|
67
59
|
id: `${fieldName}-min`,
|
|
@@ -71,28 +63,12 @@ function NumberRangeFilter({
|
|
|
71
63
|
onChange: (e) => handleMinChange(e.target.value),
|
|
72
64
|
placeholder: "No minimum",
|
|
73
65
|
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-green-web focus:border-green-web"
|
|
74
|
-
}
|
|
75
|
-
void 0,
|
|
76
|
-
false,
|
|
77
|
-
{
|
|
78
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/NumberRangeFilter.tsx",
|
|
79
|
-
lineNumber: 81,
|
|
80
|
-
columnNumber: 11
|
|
81
|
-
},
|
|
82
|
-
this
|
|
66
|
+
}
|
|
83
67
|
)
|
|
84
|
-
] },
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}, this),
|
|
89
|
-
/* @__PURE__ */ jsxDEV("div", { children: [
|
|
90
|
-
/* @__PURE__ */ jsxDEV("label", { htmlFor: `${fieldName}-max`, className: "block text-xs text-gray-500 mb-1", children: "Max" }, void 0, false, {
|
|
91
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/NumberRangeFilter.tsx",
|
|
92
|
-
lineNumber: 92,
|
|
93
|
-
columnNumber: 11
|
|
94
|
-
}, this),
|
|
95
|
-
/* @__PURE__ */ jsxDEV(
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
70
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${fieldName}-max`, className: "block text-xs text-gray-500 mb-1", children: "Max" }),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
96
72
|
"input",
|
|
97
73
|
{
|
|
98
74
|
id: `${fieldName}-max`,
|
|
@@ -102,40 +78,16 @@ function NumberRangeFilter({
|
|
|
102
78
|
onChange: (e) => handleMaxChange(e.target.value),
|
|
103
79
|
placeholder: "No maximum",
|
|
104
80
|
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-green-web focus:border-green-web"
|
|
105
|
-
}
|
|
106
|
-
void 0,
|
|
107
|
-
false,
|
|
108
|
-
{
|
|
109
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/NumberRangeFilter.tsx",
|
|
110
|
-
lineNumber: 93,
|
|
111
|
-
columnNumber: 11
|
|
112
|
-
},
|
|
113
|
-
this
|
|
81
|
+
}
|
|
114
82
|
)
|
|
115
|
-
] }
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
columnNumber: 9
|
|
119
|
-
}, this)
|
|
120
|
-
] }, void 0, true, {
|
|
121
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/NumberRangeFilter.tsx",
|
|
122
|
-
lineNumber: 78,
|
|
123
|
-
columnNumber: 7
|
|
124
|
-
}, this),
|
|
125
|
-
(minValue || maxValue) && /* @__PURE__ */ jsxDEV("div", { className: "text-xs text-gray-500", children: [
|
|
83
|
+
] })
|
|
84
|
+
] }),
|
|
85
|
+
(minValue || maxValue) && /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500", children: [
|
|
126
86
|
minValue && maxValue && `${minValue} to ${maxValue}`,
|
|
127
87
|
minValue && !maxValue && `≥ ${minValue}`,
|
|
128
88
|
!minValue && maxValue && `≤ ${maxValue}`
|
|
129
|
-
] }
|
|
130
|
-
|
|
131
|
-
lineNumber: 105,
|
|
132
|
-
columnNumber: 9
|
|
133
|
-
}, this)
|
|
134
|
-
] }, void 0, true, {
|
|
135
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/NumberRangeFilter.tsx",
|
|
136
|
-
lineNumber: 74,
|
|
137
|
-
columnNumber: 5
|
|
138
|
-
}, this);
|
|
89
|
+
] })
|
|
90
|
+
] });
|
|
139
91
|
}
|
|
140
92
|
export {
|
|
141
93
|
NumberRangeFilter
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getItemDisplayName } from "../../utils/string-utils.js";
|
|
3
3
|
function RelationDropdownButton({
|
|
4
4
|
currentItem,
|
|
@@ -6,50 +6,26 @@ function RelationDropdownButton({
|
|
|
6
6
|
isOpen,
|
|
7
7
|
onClick
|
|
8
8
|
}) {
|
|
9
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsxs(
|
|
10
10
|
"button",
|
|
11
11
|
{
|
|
12
12
|
type: "button",
|
|
13
13
|
onClick,
|
|
14
14
|
className: "w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-web focus:border-green-web text-sm text-left bg-white flex items-center justify-between",
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
lineNumber: 21,
|
|
19
|
-
columnNumber: 11
|
|
20
|
-
}, this),
|
|
21
|
-
/* @__PURE__ */ jsxDEV(
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: currentItem ? "text-gray-900" : "text-gray-500", children: currentItem ? getItemDisplayName(currentItem) : `Select ${relatedModelName.toLowerCase()}...` }),
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
22
18
|
"svg",
|
|
23
19
|
{
|
|
24
20
|
className: `w-4 h-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`,
|
|
25
21
|
fill: "none",
|
|
26
22
|
stroke: "currentColor",
|
|
27
23
|
viewBox: "0 0 24 24",
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
lineNumber: 30,
|
|
31
|
-
columnNumber: 13
|
|
32
|
-
}, this)
|
|
33
|
-
},
|
|
34
|
-
void 0,
|
|
35
|
-
false,
|
|
36
|
-
{
|
|
37
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
38
|
-
lineNumber: 24,
|
|
39
|
-
columnNumber: 7
|
|
40
|
-
},
|
|
41
|
-
this
|
|
24
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
25
|
+
}
|
|
42
26
|
)
|
|
43
27
|
]
|
|
44
|
-
}
|
|
45
|
-
void 0,
|
|
46
|
-
true,
|
|
47
|
-
{
|
|
48
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
49
|
-
lineNumber: 16,
|
|
50
|
-
columnNumber: 9
|
|
51
|
-
},
|
|
52
|
-
this
|
|
28
|
+
}
|
|
53
29
|
);
|
|
54
30
|
}
|
|
55
31
|
function RelationSearchInput({
|
|
@@ -57,7 +33,7 @@ function RelationSearchInput({
|
|
|
57
33
|
onSearchChange,
|
|
58
34
|
relatedModelName
|
|
59
35
|
}) {
|
|
60
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsx(
|
|
61
37
|
"input",
|
|
62
38
|
{
|
|
63
39
|
type: "text",
|
|
@@ -66,41 +42,21 @@ function RelationSearchInput({
|
|
|
66
42
|
onChange: (e) => onSearchChange(e.target.value),
|
|
67
43
|
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-green-web",
|
|
68
44
|
autoFocus: true
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
false,
|
|
72
|
-
{
|
|
73
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
74
|
-
lineNumber: 48,
|
|
75
|
-
columnNumber: 15
|
|
76
|
-
},
|
|
77
|
-
this
|
|
78
|
-
) }, void 0, false, {
|
|
79
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
80
|
-
lineNumber: 47,
|
|
81
|
-
columnNumber: 13
|
|
82
|
-
}, this);
|
|
45
|
+
}
|
|
46
|
+
) });
|
|
83
47
|
}
|
|
84
48
|
function RelationItem({
|
|
85
49
|
item,
|
|
86
50
|
onSelect
|
|
87
51
|
}) {
|
|
88
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
89
53
|
"button",
|
|
90
54
|
{
|
|
91
55
|
type: "button",
|
|
92
56
|
onClick: () => onSelect(item),
|
|
93
57
|
className: "w-full px-3 py-2 text-left text-sm hover:bg-gray-100 focus:bg-gray-100 transition-colors",
|
|
94
58
|
children: getItemDisplayName(item)
|
|
95
|
-
}
|
|
96
|
-
void 0,
|
|
97
|
-
false,
|
|
98
|
-
{
|
|
99
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
100
|
-
lineNumber: 69,
|
|
101
|
-
columnNumber: 5
|
|
102
|
-
},
|
|
103
|
-
this
|
|
59
|
+
}
|
|
104
60
|
);
|
|
105
61
|
}
|
|
106
62
|
function RelationItemList({
|
|
@@ -110,103 +66,40 @@ function RelationItemList({
|
|
|
110
66
|
onSelect,
|
|
111
67
|
onClear
|
|
112
68
|
}) {
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ jsxs("div", { className: "max-h-48 overflow-y-auto", children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
115
71
|
"button",
|
|
116
72
|
{
|
|
117
73
|
type: "button",
|
|
118
74
|
onClick: onClear,
|
|
119
75
|
className: "w-full px-3 py-2 text-left text-sm hover:bg-gray-100 text-gray-500 border-b border-gray-200",
|
|
120
76
|
children: "Clear selection"
|
|
121
|
-
}
|
|
122
|
-
void 0,
|
|
123
|
-
false,
|
|
124
|
-
{
|
|
125
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
126
|
-
lineNumber: 95,
|
|
127
|
-
columnNumber: 15
|
|
128
|
-
},
|
|
129
|
-
this
|
|
77
|
+
}
|
|
130
78
|
),
|
|
131
|
-
error && /* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
135
|
-
lineNumber: 107,
|
|
136
|
-
columnNumber: 15
|
|
137
|
-
}, this) }, void 0, false, {
|
|
138
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
139
|
-
lineNumber: 106,
|
|
140
|
-
columnNumber: 13
|
|
141
|
-
}, this),
|
|
79
|
+
error && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-sm text-red-600", children: [
|
|
80
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
81
|
+
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
142
82
|
"Failed to load options"
|
|
143
|
-
] },
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
columnNumber: 11
|
|
152
|
-
}, this)
|
|
153
|
-
] }, void 0, true, {
|
|
154
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
155
|
-
lineNumber: 104,
|
|
156
|
-
columnNumber: 9
|
|
157
|
-
}, this),
|
|
158
|
-
!error && loading && /* @__PURE__ */ jsxDEV("div", { className: "px-3 py-2 text-sm text-gray-500", children: /* @__PURE__ */ jsxDEV("div", { className: "flex items-center", children: [
|
|
159
|
-
/* @__PURE__ */ jsxDEV("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4 text-gray-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
160
|
-
/* @__PURE__ */ jsxDEV("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }, void 0, false, {
|
|
161
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
162
|
-
lineNumber: 120,
|
|
163
|
-
columnNumber: 15
|
|
164
|
-
}, this),
|
|
165
|
-
/* @__PURE__ */ jsxDEV("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" }, void 0, false, {
|
|
166
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
167
|
-
lineNumber: 121,
|
|
168
|
-
columnNumber: 15
|
|
169
|
-
}, this)
|
|
170
|
-
] }, void 0, true, {
|
|
171
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
172
|
-
lineNumber: 119,
|
|
173
|
-
columnNumber: 13
|
|
174
|
-
}, this),
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 mt-1", children: error.networkError ? "Network error" : "Please try again" })
|
|
85
|
+
] }),
|
|
86
|
+
!error && loading && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-gray-500", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4 text-gray-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
89
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
90
|
+
] }),
|
|
175
91
|
"Loading..."
|
|
176
|
-
] }
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
columnNumber: 11
|
|
180
|
-
}, this) }, void 0, false, {
|
|
181
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
182
|
-
lineNumber: 117,
|
|
183
|
-
columnNumber: 9
|
|
184
|
-
}, this),
|
|
185
|
-
!error && !loading && items.length === 0 && /* @__PURE__ */ jsxDEV("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No items found" }, void 0, false, {
|
|
186
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
187
|
-
lineNumber: 128,
|
|
188
|
-
columnNumber: 9
|
|
189
|
-
}, this),
|
|
190
|
-
!error && !loading && items.length > 0 && items.map((item) => /* @__PURE__ */ jsxDEV(
|
|
92
|
+
] }) }),
|
|
93
|
+
!error && !loading && items.length === 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No items found" }),
|
|
94
|
+
!error && !loading && items.length > 0 && items.map((item) => /* @__PURE__ */ jsx(
|
|
191
95
|
RelationItem,
|
|
192
96
|
{
|
|
193
97
|
item,
|
|
194
98
|
onSelect
|
|
195
99
|
},
|
|
196
|
-
item.id
|
|
197
|
-
false,
|
|
198
|
-
{
|
|
199
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
200
|
-
lineNumber: 132,
|
|
201
|
-
columnNumber: 11
|
|
202
|
-
},
|
|
203
|
-
this
|
|
100
|
+
item.id
|
|
204
101
|
))
|
|
205
|
-
] }
|
|
206
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
207
|
-
lineNumber: 94,
|
|
208
|
-
columnNumber: 13
|
|
209
|
-
}, this);
|
|
102
|
+
] });
|
|
210
103
|
}
|
|
211
104
|
function RelationDropdownContent({
|
|
212
105
|
searchTerm,
|
|
@@ -218,24 +111,16 @@ function RelationDropdownContent({
|
|
|
218
111
|
onSelect,
|
|
219
112
|
onClear
|
|
220
113
|
}) {
|
|
221
|
-
return /* @__PURE__ */
|
|
222
|
-
/* @__PURE__ */
|
|
114
|
+
return /* @__PURE__ */ jsxs("div", { className: "absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-md shadow-lg", children: [
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
223
116
|
RelationSearchInput,
|
|
224
117
|
{
|
|
225
118
|
searchTerm,
|
|
226
119
|
onSearchChange,
|
|
227
120
|
relatedModelName
|
|
228
|
-
}
|
|
229
|
-
void 0,
|
|
230
|
-
false,
|
|
231
|
-
{
|
|
232
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
233
|
-
lineNumber: 165,
|
|
234
|
-
columnNumber: 7
|
|
235
|
-
},
|
|
236
|
-
this
|
|
121
|
+
}
|
|
237
122
|
),
|
|
238
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
239
124
|
RelationItemList,
|
|
240
125
|
{
|
|
241
126
|
items,
|
|
@@ -243,21 +128,9 @@ function RelationDropdownContent({
|
|
|
243
128
|
error,
|
|
244
129
|
onSelect,
|
|
245
130
|
onClear
|
|
246
|
-
}
|
|
247
|
-
void 0,
|
|
248
|
-
false,
|
|
249
|
-
{
|
|
250
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
251
|
-
lineNumber: 170,
|
|
252
|
-
columnNumber: 7
|
|
253
|
-
},
|
|
254
|
-
this
|
|
131
|
+
}
|
|
255
132
|
)
|
|
256
|
-
] }
|
|
257
|
-
fileName: "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationComponents.tsx",
|
|
258
|
-
lineNumber: 164,
|
|
259
|
-
columnNumber: 5
|
|
260
|
-
}, this);
|
|
133
|
+
] });
|
|
261
134
|
}
|
|
262
135
|
export {
|
|
263
136
|
RelationDropdownButton,
|