@object-ui/plugin-aggrid 4.0.1 → 4.0.4
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 +41 -0
- package/dist/AgGridImpl-CAfXf2vU.js +225 -0
- package/dist/ObjectAgGridImpl-C-HQaIhp.js +460 -0
- package/dist/index.js +21 -16
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-aggrid",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "AG Grid data grid plugin for Object UI, powered by AG Grid Community",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"./style.css": "./dist/index.css"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@object-ui/components": "4.0.
|
|
29
|
-
"@object-ui/core": "4.0.
|
|
30
|
-
"@object-ui/data-objectstack": "4.0.
|
|
31
|
-
"@object-ui/fields": "4.0.
|
|
32
|
-
"@object-ui/react": "4.0.
|
|
33
|
-
"@object-ui/types": "4.0.
|
|
28
|
+
"@object-ui/components": "4.0.4",
|
|
29
|
+
"@object-ui/core": "4.0.4",
|
|
30
|
+
"@object-ui/data-objectstack": "4.0.4",
|
|
31
|
+
"@object-ui/fields": "4.0.4",
|
|
32
|
+
"@object-ui/react": "4.0.4",
|
|
33
|
+
"@object-ui/types": "4.0.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"ag-grid-community": "^32.0.0",
|
|
@@ -1,98 +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, Input as r, Label as i } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/AddressField.tsx
|
|
6
|
-
var a = /* @__PURE__ */ e({ AddressField: () => s }), o = t();
|
|
7
|
-
function s({ value: e, onChange: t, field: a, readonly: s, ...c }) {
|
|
8
|
-
let l = e || {}, u = (e, n) => {
|
|
9
|
-
t({
|
|
10
|
-
...l,
|
|
11
|
-
[e]: n
|
|
12
|
-
});
|
|
13
|
-
}, d = (e) => [
|
|
14
|
-
e.street,
|
|
15
|
-
e.city,
|
|
16
|
-
[e.state, e.zipCode].filter(Boolean).join(" "),
|
|
17
|
-
e.country
|
|
18
|
-
].filter(Boolean).join(", ");
|
|
19
|
-
if (s) {
|
|
20
|
-
let e = d(l);
|
|
21
|
-
return e ? /* @__PURE__ */ (0, o.jsx)("span", {
|
|
22
|
-
className: "text-sm",
|
|
23
|
-
children: e
|
|
24
|
-
}) : /* @__PURE__ */ (0, o.jsx)(n, {});
|
|
25
|
-
}
|
|
26
|
-
return /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
27
|
-
className: "space-y-3",
|
|
28
|
-
children: [
|
|
29
|
-
/* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)(i, {
|
|
30
|
-
htmlFor: "street",
|
|
31
|
-
className: "text-xs",
|
|
32
|
-
children: "Street Address"
|
|
33
|
-
}), /* @__PURE__ */ (0, o.jsx)(r, {
|
|
34
|
-
id: "street",
|
|
35
|
-
type: "text",
|
|
36
|
-
value: l.street || "",
|
|
37
|
-
onChange: (e) => u("street", e.target.value),
|
|
38
|
-
placeholder: "123 Main St",
|
|
39
|
-
disabled: s || c.disabled,
|
|
40
|
-
className: c.className
|
|
41
|
-
})] }),
|
|
42
|
-
/* @__PURE__ */ (0, o.jsxs)("div", {
|
|
43
|
-
className: "grid grid-cols-2 gap-3",
|
|
44
|
-
children: [/* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)(i, {
|
|
45
|
-
htmlFor: "city",
|
|
46
|
-
className: "text-xs",
|
|
47
|
-
children: "City"
|
|
48
|
-
}), /* @__PURE__ */ (0, o.jsx)(r, {
|
|
49
|
-
id: "city",
|
|
50
|
-
type: "text",
|
|
51
|
-
value: l.city || "",
|
|
52
|
-
onChange: (e) => u("city", e.target.value),
|
|
53
|
-
placeholder: "San Francisco",
|
|
54
|
-
disabled: s || c.disabled
|
|
55
|
-
})] }), /* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)(i, {
|
|
56
|
-
htmlFor: "state",
|
|
57
|
-
className: "text-xs",
|
|
58
|
-
children: "State / Province"
|
|
59
|
-
}), /* @__PURE__ */ (0, o.jsx)(r, {
|
|
60
|
-
id: "state",
|
|
61
|
-
type: "text",
|
|
62
|
-
value: l.state || "",
|
|
63
|
-
onChange: (e) => u("state", e.target.value),
|
|
64
|
-
placeholder: "CA",
|
|
65
|
-
disabled: s || c.disabled
|
|
66
|
-
})] })]
|
|
67
|
-
}),
|
|
68
|
-
/* @__PURE__ */ (0, o.jsxs)("div", {
|
|
69
|
-
className: "grid grid-cols-2 gap-3",
|
|
70
|
-
children: [/* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)(i, {
|
|
71
|
-
htmlFor: "zipCode",
|
|
72
|
-
className: "text-xs",
|
|
73
|
-
children: "ZIP / Postal Code"
|
|
74
|
-
}), /* @__PURE__ */ (0, o.jsx)(r, {
|
|
75
|
-
id: "zipCode",
|
|
76
|
-
type: "text",
|
|
77
|
-
value: l.zipCode || "",
|
|
78
|
-
onChange: (e) => u("zipCode", e.target.value),
|
|
79
|
-
placeholder: "94102",
|
|
80
|
-
disabled: s || c.disabled
|
|
81
|
-
})] }), /* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)(i, {
|
|
82
|
-
htmlFor: "country",
|
|
83
|
-
className: "text-xs",
|
|
84
|
-
children: "Country"
|
|
85
|
-
}), /* @__PURE__ */ (0, o.jsx)(r, {
|
|
86
|
-
id: "country",
|
|
87
|
-
type: "text",
|
|
88
|
-
value: l.country || "",
|
|
89
|
-
onChange: (e) => u("country", e.target.value),
|
|
90
|
-
placeholder: "United States",
|
|
91
|
-
disabled: s || c.disabled
|
|
92
|
-
})] })]
|
|
93
|
-
})
|
|
94
|
-
]
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
export { a as t };
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./jsx-runtime-CXSCp6pT.js";
|
|
2
|
-
import { useCallback as t, useMemo as n, useRef as r } from "react";
|
|
3
|
-
import { AgGridReact as i } from "ag-grid-react";
|
|
4
|
-
//#region src/AgGridImpl.tsx
|
|
5
|
-
var a = e();
|
|
6
|
-
function o({ rowData: e = [], columnDefs: o = [], gridOptions: s = {}, pagination: c = !1, paginationPageSize: l = 10, domLayout: u = "normal", animateRows: d = !0, rowSelection: f, theme: p = "quartz", height: m = 500, className: h = "", editable: g = !1, editType: _, singleClickEdit: v = !1, stopEditingWhenCellsLoseFocus: y = !0, exportConfig: b, statusBar: x, callbacks: S, columnConfig: C, enableRangeSelection: w = !1, enableCharts: T = !1, contextMenu: E, treeData: D, rowGrouping: O, excelExport: k }) {
|
|
7
|
-
let A = r(null), j = n(() => {
|
|
8
|
-
if (!x?.enabled) return;
|
|
9
|
-
let e = x.aggregations || [
|
|
10
|
-
"count",
|
|
11
|
-
"sum",
|
|
12
|
-
"avg"
|
|
13
|
-
], t = [];
|
|
14
|
-
return e.includes("count") && t.push({
|
|
15
|
-
statusPanel: "agAggregationComponent",
|
|
16
|
-
statusPanelParams: { aggFuncs: ["count"] }
|
|
17
|
-
}), e.includes("sum") && t.push({
|
|
18
|
-
statusPanel: "agAggregationComponent",
|
|
19
|
-
statusPanelParams: { aggFuncs: ["sum"] }
|
|
20
|
-
}), e.includes("avg") && t.push({
|
|
21
|
-
statusPanel: "agAggregationComponent",
|
|
22
|
-
statusPanelParams: { aggFuncs: ["avg"] }
|
|
23
|
-
}), e.includes("min") && t.push({
|
|
24
|
-
statusPanel: "agAggregationComponent",
|
|
25
|
-
statusPanelParams: { aggFuncs: ["min"] }
|
|
26
|
-
}), e.includes("max") && t.push({
|
|
27
|
-
statusPanel: "agAggregationComponent",
|
|
28
|
-
statusPanelParams: { aggFuncs: ["max"] }
|
|
29
|
-
}), t;
|
|
30
|
-
}, [x]), M = t(() => {
|
|
31
|
-
if (!A.current?.api) return;
|
|
32
|
-
let t = {
|
|
33
|
-
fileName: b?.fileName || "export.csv",
|
|
34
|
-
skipColumnHeaders: b?.skipColumnHeaders || !1,
|
|
35
|
-
allColumns: b?.allColumns || !1,
|
|
36
|
-
onlySelected: b?.onlySelected || !1
|
|
37
|
-
};
|
|
38
|
-
if (A.current.api.exportDataAsCsv(t), S?.onExport) {
|
|
39
|
-
let t = b?.onlySelected ? A.current.api.getSelectedRows() : e;
|
|
40
|
-
S.onExport(t || [], "csv");
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
b,
|
|
44
|
-
S,
|
|
45
|
-
e
|
|
46
|
-
]), N = t(() => {
|
|
47
|
-
if (!A.current?.api) return;
|
|
48
|
-
let t = {
|
|
49
|
-
fileName: k?.fileName || b?.fileName || "export.csv",
|
|
50
|
-
skipColumnHeaders: k?.includeHeaders === !1,
|
|
51
|
-
allColumns: !0,
|
|
52
|
-
onlySelected: k?.onlySelected || !1
|
|
53
|
-
};
|
|
54
|
-
if (A.current.api.exportDataAsCsv(t), S?.onExport) {
|
|
55
|
-
let t = k?.onlySelected ? A.current.api.getSelectedRows() : e;
|
|
56
|
-
S.onExport(t || [], "excel");
|
|
57
|
-
}
|
|
58
|
-
}, [
|
|
59
|
-
k,
|
|
60
|
-
b,
|
|
61
|
-
S,
|
|
62
|
-
e
|
|
63
|
-
]), P = t((e) => {
|
|
64
|
-
if (!E?.enabled) return [];
|
|
65
|
-
let t = [];
|
|
66
|
-
return (E.items || [
|
|
67
|
-
"copy",
|
|
68
|
-
"copyWithHeaders",
|
|
69
|
-
"separator",
|
|
70
|
-
"export"
|
|
71
|
-
]).forEach((e) => {
|
|
72
|
-
e === "export" ? t.push({
|
|
73
|
-
name: "Export CSV",
|
|
74
|
-
icon: "<span>📥</span>",
|
|
75
|
-
action: () => M()
|
|
76
|
-
}) : e === "export-excel" ? t.push({
|
|
77
|
-
name: "Export Excel (CSV)",
|
|
78
|
-
icon: "<span>📊</span>",
|
|
79
|
-
action: () => N()
|
|
80
|
-
}) : e === "autoSizeAll" ? t.push({
|
|
81
|
-
name: "Auto-size All Columns",
|
|
82
|
-
action: () => {
|
|
83
|
-
A.current?.api && A.current.api.autoSizeAllColumns();
|
|
84
|
-
}
|
|
85
|
-
}) : e === "resetColumns" ? t.push({
|
|
86
|
-
name: "Reset Columns",
|
|
87
|
-
action: () => {
|
|
88
|
-
A.current?.api && A.current.api.resetColumnState();
|
|
89
|
-
}
|
|
90
|
-
}) : t.push(e);
|
|
91
|
-
}), E.customItems && (t.length > 0 && t.push("separator"), E.customItems.forEach((n) => {
|
|
92
|
-
t.push({
|
|
93
|
-
name: n.name,
|
|
94
|
-
disabled: n.disabled,
|
|
95
|
-
action: () => {
|
|
96
|
-
S?.onContextMenuAction && S.onContextMenuAction(n.action, e.node?.data);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
})), t;
|
|
100
|
-
}, [
|
|
101
|
-
E,
|
|
102
|
-
M,
|
|
103
|
-
N,
|
|
104
|
-
S
|
|
105
|
-
]), F = t((e) => {
|
|
106
|
-
S?.onCellClicked?.(e);
|
|
107
|
-
}, [S]), I = t((e) => {
|
|
108
|
-
S?.onRowClicked?.(e);
|
|
109
|
-
}, [S]), L = t((e) => {
|
|
110
|
-
S?.onSelectionChanged?.(e);
|
|
111
|
-
}, [S]), R = t((e) => {
|
|
112
|
-
S?.onCellValueChanged?.(e);
|
|
113
|
-
}, [S]), z = t((e) => {
|
|
114
|
-
A.current = e;
|
|
115
|
-
}, []), B = n(() => o ? o.map((e) => {
|
|
116
|
-
let t = { ...e };
|
|
117
|
-
return g && e.editable !== !1 && (t.editable = !0), C && (C.resizable !== void 0 && e.resizable === void 0 && (t.resizable = C.resizable), C.sortable !== void 0 && e.sortable === void 0 && (t.sortable = C.sortable), C.filterable !== void 0 && e.filter === void 0 && (t.filter = C.filterable)), O?.enabled && O.groupByFields?.includes(e.field || "") && (t.rowGroup = !0, t.hide = !0), O?.aggregations && e.field && O.aggregations[e.field] && (t.aggFunc = O.aggregations[e.field]), t;
|
|
118
|
-
}) : [], [
|
|
119
|
-
o,
|
|
120
|
-
g,
|
|
121
|
-
C,
|
|
122
|
-
O
|
|
123
|
-
]), V = n(() => ({
|
|
124
|
-
...s,
|
|
125
|
-
pagination: c,
|
|
126
|
-
paginationPageSize: l,
|
|
127
|
-
domLayout: u,
|
|
128
|
-
animateRows: d,
|
|
129
|
-
rowSelection: f,
|
|
130
|
-
editType: _,
|
|
131
|
-
singleClickEdit: v,
|
|
132
|
-
stopEditingWhenCellsLoseFocus: y,
|
|
133
|
-
statusBar: j ? { statusPanels: j } : void 0,
|
|
134
|
-
enableRangeSelection: w,
|
|
135
|
-
enableCharts: T,
|
|
136
|
-
getContextMenuItems: E?.enabled ? P : void 0,
|
|
137
|
-
...D?.enabled ? {
|
|
138
|
-
treeData: !0,
|
|
139
|
-
getDataPath: D.pathField ? (e) => e[D.pathField] : void 0,
|
|
140
|
-
autoGroupColumnDef: {
|
|
141
|
-
headerName: "Hierarchy",
|
|
142
|
-
minWidth: 250,
|
|
143
|
-
cellRendererParams: { suppressCount: !1 }
|
|
144
|
-
},
|
|
145
|
-
groupDefaultExpanded: D.expandAll ? -1 : D.expandDepth ?? 0
|
|
146
|
-
} : {},
|
|
147
|
-
...O?.enabled ? {
|
|
148
|
-
groupDefaultExpanded: +!!O.groupByFields?.length,
|
|
149
|
-
autoGroupColumnDef: {
|
|
150
|
-
minWidth: 200,
|
|
151
|
-
cellRendererParams: { suppressCount: !O.showRowCount }
|
|
152
|
-
}
|
|
153
|
-
} : {},
|
|
154
|
-
suppressCellFocus: !g,
|
|
155
|
-
enableCellTextSelection: !0,
|
|
156
|
-
ensureDomOrder: !0,
|
|
157
|
-
rowBuffer: s.rowBuffer ?? 10,
|
|
158
|
-
debounceVerticalScrollbar: s.debounceVerticalScrollbar ?? e.length > 1e3,
|
|
159
|
-
onCellClicked: F,
|
|
160
|
-
onRowClicked: I,
|
|
161
|
-
onSelectionChanged: L,
|
|
162
|
-
onCellValueChanged: R,
|
|
163
|
-
onGridReady: z
|
|
164
|
-
}), [
|
|
165
|
-
s,
|
|
166
|
-
c,
|
|
167
|
-
l,
|
|
168
|
-
u,
|
|
169
|
-
d,
|
|
170
|
-
f,
|
|
171
|
-
_,
|
|
172
|
-
v,
|
|
173
|
-
y,
|
|
174
|
-
j,
|
|
175
|
-
w,
|
|
176
|
-
T,
|
|
177
|
-
E,
|
|
178
|
-
P,
|
|
179
|
-
D,
|
|
180
|
-
O,
|
|
181
|
-
g,
|
|
182
|
-
e.length,
|
|
183
|
-
F,
|
|
184
|
-
I,
|
|
185
|
-
L,
|
|
186
|
-
R,
|
|
187
|
-
z
|
|
188
|
-
]), H = n(() => ({
|
|
189
|
-
height: typeof m == "number" ? `${m}px` : m,
|
|
190
|
-
width: "100%"
|
|
191
|
-
}), [m]), U = [
|
|
192
|
-
`ag-theme-${p}`,
|
|
193
|
-
"rounded-xl",
|
|
194
|
-
"border",
|
|
195
|
-
"border-border",
|
|
196
|
-
"overflow-hidden",
|
|
197
|
-
"shadow-lg",
|
|
198
|
-
h
|
|
199
|
-
].filter(Boolean).join(" ");
|
|
200
|
-
return /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
201
|
-
className: "ag-grid-container",
|
|
202
|
-
children: [(b?.enabled || k?.enabled) && /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
203
|
-
className: "mb-2 flex gap-2",
|
|
204
|
-
children: [b?.enabled && /* @__PURE__ */ (0, a.jsx)("button", {
|
|
205
|
-
onClick: M,
|
|
206
|
-
className: "px-3 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors",
|
|
207
|
-
children: "Export CSV"
|
|
208
|
-
}), k?.enabled && /* @__PURE__ */ (0, a.jsx)("button", {
|
|
209
|
-
onClick: N,
|
|
210
|
-
className: "px-3 py-1.5 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-md transition-colors",
|
|
211
|
-
children: "Export Excel (CSV)"
|
|
212
|
-
})]
|
|
213
|
-
}), /* @__PURE__ */ (0, a.jsx)("div", {
|
|
214
|
-
className: U,
|
|
215
|
-
style: H,
|
|
216
|
-
children: /* @__PURE__ */ (0, a.jsx)(i, {
|
|
217
|
-
ref: A,
|
|
218
|
-
rowData: e,
|
|
219
|
-
columnDefs: B,
|
|
220
|
-
gridOptions: V
|
|
221
|
-
})
|
|
222
|
-
})]
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
//#endregion
|
|
226
|
-
export { o as default };
|
|
@@ -1,14 +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/AutoNumberField.tsx
|
|
6
|
-
var r = /* @__PURE__ */ e({ AutoNumberField: () => a }), i = t();
|
|
7
|
-
function a({ value: e, field: t, ...r }) {
|
|
8
|
-
return e == null ? /* @__PURE__ */ (0, i.jsx)(n, { className: r.className }) : /* @__PURE__ */ (0, i.jsx)("span", {
|
|
9
|
-
className: `text-sm font-mono text-gray-700 ${r.className || ""}`,
|
|
10
|
-
children: String(e)
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { r as t };
|
|
@@ -1,83 +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 "./upload-DWhfIa3Y.js";
|
|
4
|
-
import { t as r } from "./x-BDi_yYx9.js";
|
|
5
|
-
import i from "react";
|
|
6
|
-
import { Avatar as a, AvatarFallback as o, AvatarImage as s, Button as c } from "@object-ui/components";
|
|
7
|
-
//#region ../fields/src/widgets/AvatarField.tsx
|
|
8
|
-
var l = /* @__PURE__ */ e({ AvatarField: () => d }), u = t();
|
|
9
|
-
function d({ value: e, onChange: t, field: l, readonly: d, ...f }) {
|
|
10
|
-
let [p, m] = i.useState(!1), h = i.useRef(null), g = l || f.schema, _ = (e) => {
|
|
11
|
-
let n = e.target.files?.[0];
|
|
12
|
-
if (!n) return;
|
|
13
|
-
if (!n.type.startsWith("image/")) {
|
|
14
|
-
console.error("Please select an image file");
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (n.size > 5 * 1024 * 1024) {
|
|
18
|
-
console.error("File size must be less than 5MB");
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
let r = new FileReader();
|
|
22
|
-
r.onloadend = () => {
|
|
23
|
-
t(r.result);
|
|
24
|
-
}, r.readAsDataURL(n);
|
|
25
|
-
}, v = () => {
|
|
26
|
-
t("");
|
|
27
|
-
}, y = () => (g?.defaultName || g?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
28
|
-
return d ? /* @__PURE__ */ (0, u.jsxs)(a, {
|
|
29
|
-
className: "w-16 h-16",
|
|
30
|
-
children: [e && /* @__PURE__ */ (0, u.jsx)(s, {
|
|
31
|
-
src: e,
|
|
32
|
-
alt: g?.label
|
|
33
|
-
}), /* @__PURE__ */ (0, u.jsx)(o, { children: y() })]
|
|
34
|
-
}) : /* @__PURE__ */ (0, u.jsxs)("div", {
|
|
35
|
-
className: "flex items-center gap-4",
|
|
36
|
-
children: [/* @__PURE__ */ (0, u.jsxs)("div", {
|
|
37
|
-
className: "relative",
|
|
38
|
-
onMouseEnter: () => m(!0),
|
|
39
|
-
onMouseLeave: () => m(!1),
|
|
40
|
-
children: [/* @__PURE__ */ (0, u.jsxs)(a, {
|
|
41
|
-
className: "w-16 h-16",
|
|
42
|
-
children: [e && /* @__PURE__ */ (0, u.jsx)(s, {
|
|
43
|
-
src: e,
|
|
44
|
-
alt: g?.label
|
|
45
|
-
}), /* @__PURE__ */ (0, u.jsx)(o, { children: y() })]
|
|
46
|
-
}), !d && p && e && /* @__PURE__ */ (0, u.jsx)("button", {
|
|
47
|
-
type: "button",
|
|
48
|
-
onClick: v,
|
|
49
|
-
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
50
|
-
children: /* @__PURE__ */ (0, u.jsx)(r, { className: "w-3 h-3" })
|
|
51
|
-
})]
|
|
52
|
-
}), /* @__PURE__ */ (0, u.jsxs)("div", {
|
|
53
|
-
className: "flex flex-col gap-2",
|
|
54
|
-
children: [
|
|
55
|
-
/* @__PURE__ */ (0, u.jsx)("input", {
|
|
56
|
-
ref: h,
|
|
57
|
-
type: "file",
|
|
58
|
-
accept: "image/*",
|
|
59
|
-
onChange: _,
|
|
60
|
-
className: "hidden"
|
|
61
|
-
}),
|
|
62
|
-
/* @__PURE__ */ (0, u.jsxs)(c, {
|
|
63
|
-
type: "button",
|
|
64
|
-
variant: "outline",
|
|
65
|
-
size: "sm",
|
|
66
|
-
onClick: () => h.current?.click(),
|
|
67
|
-
disabled: d || f.disabled,
|
|
68
|
-
children: [
|
|
69
|
-
/* @__PURE__ */ (0, u.jsx)(n, { className: "w-4 h-4 mr-2" }),
|
|
70
|
-
e ? "Change" : "Upload",
|
|
71
|
-
" Avatar"
|
|
72
|
-
]
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ (0, u.jsx)("p", {
|
|
75
|
-
className: "text-xs text-muted-foreground",
|
|
76
|
-
children: "PNG, JPG up to 5MB"
|
|
77
|
-
})
|
|
78
|
-
]
|
|
79
|
-
})]
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
export { l as n, d as t };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
|
|
2
|
-
import { t } from "./jsx-runtime-CXSCp6pT.js";
|
|
3
|
-
import { useId as n } from "react";
|
|
4
|
-
import { Checkbox as r, Label as i, Switch as a } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/BooleanField.tsx
|
|
6
|
-
var o = /* @__PURE__ */ e({ BooleanField: () => c }), s = t();
|
|
7
|
-
function c({ value: e, onChange: t, field: o, readonly: c, ...l }) {
|
|
8
|
-
let u = o || l.schema, d = u?.widget, f = n(), p = u?.name || f, m = u?.label || "Checkbox";
|
|
9
|
-
if (c) return /* @__PURE__ */ (0, s.jsx)("span", {
|
|
10
|
-
className: "text-sm",
|
|
11
|
-
children: e ? "Yes" : "No"
|
|
12
|
-
});
|
|
13
|
-
let { inputType: h, ...g } = l;
|
|
14
|
-
return d === "checkbox" ? /* @__PURE__ */ (0, s.jsxs)("div", {
|
|
15
|
-
className: "flex items-center space-x-2",
|
|
16
|
-
children: [/* @__PURE__ */ (0, s.jsx)(r, {
|
|
17
|
-
...g,
|
|
18
|
-
id: p,
|
|
19
|
-
checked: !!e,
|
|
20
|
-
onCheckedChange: (e) => t(!!e),
|
|
21
|
-
disabled: c || g.disabled
|
|
22
|
-
}), /* @__PURE__ */ (0, s.jsx)(i, {
|
|
23
|
-
htmlFor: p,
|
|
24
|
-
children: m
|
|
25
|
-
})]
|
|
26
|
-
}) : /* @__PURE__ */ (0, s.jsxs)("div", {
|
|
27
|
-
className: "flex items-center space-x-2",
|
|
28
|
-
children: [/* @__PURE__ */ (0, s.jsx)(a, {
|
|
29
|
-
...g,
|
|
30
|
-
id: p,
|
|
31
|
-
checked: !!e,
|
|
32
|
-
onCheckedChange: t,
|
|
33
|
-
disabled: c || g.disabled
|
|
34
|
-
}), /* @__PURE__ */ (0, s.jsx)(i, {
|
|
35
|
-
htmlFor: p,
|
|
36
|
-
children: m
|
|
37
|
-
})]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { o as n, c as t };
|
|
@@ -1,23 +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, Textarea as r, cn as i } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/CodeField.tsx
|
|
6
|
-
var a = /* @__PURE__ */ e({ CodeField: () => s }), o = t();
|
|
7
|
-
function s({ value: e, onChange: t, field: a, readonly: s, ...c }) {
|
|
8
|
-
let l = a || c.schema, u = l?.language ?? "javascript";
|
|
9
|
-
return s ? /* @__PURE__ */ (0, o.jsx)("pre", {
|
|
10
|
-
className: i("text-sm bg-muted p-2 rounded overflow-x-auto border", c.className),
|
|
11
|
-
children: /* @__PURE__ */ (0, o.jsx)("code", { children: e || /* @__PURE__ */ (0, o.jsx)(n, {}) })
|
|
12
|
-
}) : /* @__PURE__ */ (0, o.jsx)(r, {
|
|
13
|
-
value: e || "",
|
|
14
|
-
onChange: (e) => t(e.target.value),
|
|
15
|
-
placeholder: l?.placeholder || `// Write ${u} code here...`,
|
|
16
|
-
disabled: s || c.disabled,
|
|
17
|
-
className: i("font-mono text-sm", c.className),
|
|
18
|
-
rows: 12,
|
|
19
|
-
spellCheck: !1
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { a as n, s as t };
|
|
@@ -1,38 +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, Input as r } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/ColorField.tsx
|
|
6
|
-
var i = /* @__PURE__ */ e({ ColorField: () => o }), a = t();
|
|
7
|
-
function o({ value: e, onChange: t, field: i, readonly: o, ...s }) {
|
|
8
|
-
let c = i || s.schema;
|
|
9
|
-
return o ? /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
10
|
-
className: "flex items-center gap-2",
|
|
11
|
-
children: [/* @__PURE__ */ (0, a.jsx)("div", {
|
|
12
|
-
className: "w-6 h-6 rounded border border-input",
|
|
13
|
-
style: { backgroundColor: e || "#000000" }
|
|
14
|
-
}), /* @__PURE__ */ (0, a.jsx)("span", {
|
|
15
|
-
className: "text-sm",
|
|
16
|
-
children: e || /* @__PURE__ */ (0, a.jsx)(n, {})
|
|
17
|
-
})]
|
|
18
|
-
}) : /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
19
|
-
className: "flex items-center gap-2",
|
|
20
|
-
children: [/* @__PURE__ */ (0, a.jsx)("input", {
|
|
21
|
-
type: "color",
|
|
22
|
-
value: e || "#000000",
|
|
23
|
-
onChange: (e) => t(e.target.value),
|
|
24
|
-
disabled: o || s.disabled,
|
|
25
|
-
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
26
|
-
}), /* @__PURE__ */ (0, a.jsx)(r, {
|
|
27
|
-
type: "text",
|
|
28
|
-
value: e || "",
|
|
29
|
-
onChange: (e) => t(e.target.value),
|
|
30
|
-
placeholder: c?.placeholder || "#000000",
|
|
31
|
-
disabled: o || s.disabled,
|
|
32
|
-
className: s.className,
|
|
33
|
-
pattern: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
|
|
34
|
-
})]
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { i as n, o 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, Input as r } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/CurrencyField.tsx
|
|
6
|
-
var i = /* @__PURE__ */ e({ CurrencyField: () => s }), a = t();
|
|
7
|
-
function o(e, t = "USD") {
|
|
8
|
-
try {
|
|
9
|
-
return new Intl.NumberFormat("en-US", {
|
|
10
|
-
style: "currency",
|
|
11
|
-
currency: t
|
|
12
|
-
}).format(e);
|
|
13
|
-
} catch {
|
|
14
|
-
return `${t} ${e.toFixed(2)}`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function s({ value: e, onChange: t, field: i, readonly: s, errorMessage: c, className: l, ...u }) {
|
|
18
|
-
let d = i || u.schema, f = d?.currency || "USD", p = d?.precision ?? 2;
|
|
19
|
-
if (s) return e == null ? /* @__PURE__ */ (0, a.jsx)(n, {}) : /* @__PURE__ */ (0, a.jsx)("span", {
|
|
20
|
-
className: "text-sm font-medium tabular-nums",
|
|
21
|
-
children: o(Number(e), f)
|
|
22
|
-
});
|
|
23
|
-
let m = (e) => {
|
|
24
|
-
let n = parseFloat(e.target.value);
|
|
25
|
-
isNaN(n) || t(parseFloat(n.toFixed(p)));
|
|
26
|
-
};
|
|
27
|
-
return /* @__PURE__ */ (0, a.jsxs)("div", {
|
|
28
|
-
className: "relative",
|
|
29
|
-
children: [/* @__PURE__ */ (0, a.jsx)("span", {
|
|
30
|
-
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
31
|
-
children: f === "USD" ? "$" : f
|
|
32
|
-
}), /* @__PURE__ */ (0, a.jsx)(r, {
|
|
33
|
-
...u,
|
|
34
|
-
type: "number",
|
|
35
|
-
value: e ?? "",
|
|
36
|
-
onChange: (e) => {
|
|
37
|
-
t(e.target.value === "" ? null : parseFloat(e.target.value));
|
|
38
|
-
},
|
|
39
|
-
onBlur: m,
|
|
40
|
-
placeholder: d?.placeholder || "0.00",
|
|
41
|
-
disabled: s || u.disabled,
|
|
42
|
-
className: `pl-8 ${l || ""}`,
|
|
43
|
-
step: (10 ** -p).toFixed(p),
|
|
44
|
-
"aria-invalid": !!c
|
|
45
|
-
})]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { i as n, s as t };
|
|
@@ -1,22 +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, Input as r } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/DateField.tsx
|
|
6
|
-
var i = /* @__PURE__ */ e({ DateField: () => o }), a = t();
|
|
7
|
-
function o({ value: e, onChange: t, field: i, readonly: o, ...s }) {
|
|
8
|
-
if (o) return e ? /* @__PURE__ */ (0, a.jsx)("span", {
|
|
9
|
-
className: "text-sm",
|
|
10
|
-
children: new Date(e).toLocaleDateString()
|
|
11
|
-
}) : /* @__PURE__ */ (0, a.jsx)(n, {});
|
|
12
|
-
let { inputType: c, ...l } = s;
|
|
13
|
-
return /* @__PURE__ */ (0, a.jsx)(r, {
|
|
14
|
-
...l,
|
|
15
|
-
type: "date",
|
|
16
|
-
value: e || "",
|
|
17
|
-
onChange: (e) => t(e.target.value),
|
|
18
|
-
disabled: o || l.disabled
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { i as n, o as t };
|
|
@@ -1,30 +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, Input as r } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/DateTimeField.tsx
|
|
6
|
-
var i = /* @__PURE__ */ e({ DateTimeField: () => o }), a = t();
|
|
7
|
-
function o({ value: e, onChange: t, field: i, readonly: o, ...s }) {
|
|
8
|
-
if (o) {
|
|
9
|
-
if (!e) return /* @__PURE__ */ (0, a.jsx)(n, {});
|
|
10
|
-
let t = new Date(e);
|
|
11
|
-
return /* @__PURE__ */ (0, a.jsxs)("span", {
|
|
12
|
-
className: "text-sm",
|
|
13
|
-
children: [
|
|
14
|
-
t.toLocaleDateString(),
|
|
15
|
-
" ",
|
|
16
|
-
t.toLocaleTimeString()
|
|
17
|
-
]
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
let { inputType: c, ...l } = s;
|
|
21
|
-
return /* @__PURE__ */ (0, a.jsx)(r, {
|
|
22
|
-
...l,
|
|
23
|
-
type: "datetime-local",
|
|
24
|
-
value: e || "",
|
|
25
|
-
onChange: (e) => t(e.target.value),
|
|
26
|
-
disabled: o || l.disabled
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { i as n, o as t };
|
|
@@ -1,26 +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, Input as r } from "@object-ui/components";
|
|
5
|
-
//#region ../fields/src/widgets/EmailField.tsx
|
|
6
|
-
var i = /* @__PURE__ */ e({ EmailField: () => o }), a = t();
|
|
7
|
-
function o({ value: e, onChange: t, field: i, readonly: o, errorMessage: s, ...c }) {
|
|
8
|
-
let l = i || c.schema;
|
|
9
|
-
if (o) return e ? /* @__PURE__ */ (0, a.jsx)("a", {
|
|
10
|
-
href: `mailto:${e}`,
|
|
11
|
-
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
12
|
-
children: e
|
|
13
|
-
}) : /* @__PURE__ */ (0, a.jsx)(n, {});
|
|
14
|
-
let { inputType: u, ...d } = c;
|
|
15
|
-
return /* @__PURE__ */ (0, a.jsx)(r, {
|
|
16
|
-
...d,
|
|
17
|
-
type: "email",
|
|
18
|
-
value: e || "",
|
|
19
|
-
onChange: (e) => t(e.target.value),
|
|
20
|
-
placeholder: l?.placeholder || "email@example.com",
|
|
21
|
-
disabled: o || d.disabled,
|
|
22
|
-
"aria-invalid": !!s
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { i as n, o as t };
|