@object-ui/plugin-form 0.5.0 → 3.0.0
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/.turbo/turbo-build.log +17 -6
- package/CHANGELOG.md +36 -0
- package/dist/index.js +1388 -283
- package/dist/index.umd.cjs +2 -2
- package/dist/packages/plugin-form/src/DrawerForm.d.ts +61 -0
- package/dist/packages/plugin-form/src/FormSection.d.ts +49 -0
- package/dist/packages/plugin-form/src/FormVariants.test.d.ts +0 -0
- package/dist/packages/plugin-form/src/ModalForm.d.ts +60 -0
- package/dist/packages/plugin-form/src/ObjectForm.stories.d.ts +23 -0
- package/dist/packages/plugin-form/src/SplitForm.d.ts +50 -0
- package/dist/packages/plugin-form/src/TabbedForm.d.ts +123 -0
- package/dist/packages/plugin-form/src/WizardForm.d.ts +112 -0
- package/dist/packages/plugin-form/src/__tests__/NewVariants.test.d.ts +8 -0
- package/dist/packages/plugin-form/src/__tests__/form-validation-submit.test.d.ts +8 -0
- package/dist/packages/plugin-form/src/index.d.ts +12 -0
- package/package.json +9 -9
- package/src/DrawerForm.tsx +385 -0
- package/src/FormSection.tsx +144 -0
- package/src/FormVariants.test.tsx +219 -0
- package/src/ModalForm.tsx +379 -0
- package/src/ObjectForm.msw.test.tsx +29 -2
- package/src/ObjectForm.stories.tsx +85 -0
- package/src/ObjectForm.tsx +206 -8
- package/src/SplitForm.tsx +299 -0
- package/src/TabbedForm.tsx +394 -0
- package/src/WizardForm.tsx +501 -0
- package/src/__tests__/NewVariants.test.tsx +488 -0
- package/src/__tests__/form-validation-submit.test.tsx +286 -0
- package/src/index.tsx +60 -3
- package/vitest.config.ts +12 -0
- package/vitest.setup.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1,409 +1,1514 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ComponentRegistry as
|
|
3
|
-
import { SchemaRenderer as
|
|
4
|
-
import { buildValidationRules as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import J, { useState as g, useCallback as k, useMemo as Q, useEffect as W } from "react";
|
|
2
|
+
import { ComponentRegistry as ue } from "@object-ui/core";
|
|
3
|
+
import { SchemaRenderer as M } from "@object-ui/react";
|
|
4
|
+
import { buildValidationRules as Y, mapFieldTypeToFormType as U, formatFileSize as ye, evaluateCondition as xe } from "@object-ui/fields";
|
|
5
|
+
import { cn as V, Tabs as je, TabsList as ge, TabsTrigger as we, TabsContent as ve, Button as K, ResizablePanelGroup as Ne, ResizablePanel as se, ResizableHandle as Se, Sheet as Te, SheetContent as Ce, SheetHeader as Ee, SheetTitle as Oe, SheetDescription as _e, Dialog as Re, DialogContent as De, DialogHeader as Fe, DialogTitle as ke, DialogDescription as Ie } from "@object-ui/components";
|
|
6
|
+
import { ChevronRight as pe, ChevronDown as ze, Check as Pe, ChevronLeft as Le } from "lucide-react";
|
|
7
|
+
var ee = { exports: {} }, B = {};
|
|
8
|
+
var ae;
|
|
9
|
+
function he() {
|
|
10
|
+
if (ae) return B;
|
|
11
|
+
ae = 1;
|
|
12
|
+
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), l = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
13
|
+
function f(d, w, b) {
|
|
12
14
|
var T = null;
|
|
13
|
-
if (b !== void 0 && (T = "" + b),
|
|
15
|
+
if (b !== void 0 && (T = "" + b), w.key !== void 0 && (T = "" + w.key), "key" in w) {
|
|
14
16
|
b = {};
|
|
15
|
-
for (var
|
|
16
|
-
|
|
17
|
-
} else b =
|
|
18
|
-
return
|
|
19
|
-
$$typeof:
|
|
20
|
-
type:
|
|
17
|
+
for (var E in w)
|
|
18
|
+
E !== "key" && (b[E] = w[E]);
|
|
19
|
+
} else b = w;
|
|
20
|
+
return w = b.ref, {
|
|
21
|
+
$$typeof: e,
|
|
22
|
+
type: d,
|
|
21
23
|
key: T,
|
|
22
|
-
ref:
|
|
24
|
+
ref: w !== void 0 ? w : null,
|
|
23
25
|
props: b
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
return
|
|
28
|
+
return B.Fragment = l, B.jsx = f, B.jsxs = f, B;
|
|
27
29
|
}
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
function r
|
|
33
|
-
if (
|
|
34
|
-
if (typeof
|
|
35
|
-
return
|
|
36
|
-
if (typeof
|
|
37
|
-
switch (
|
|
38
|
-
case
|
|
30
|
+
var X = {};
|
|
31
|
+
var de;
|
|
32
|
+
function Ae() {
|
|
33
|
+
return de || (de = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
34
|
+
function e(r) {
|
|
35
|
+
if (r == null) return null;
|
|
36
|
+
if (typeof r == "function")
|
|
37
|
+
return r.$$typeof === $ ? null : r.displayName || r.name || null;
|
|
38
|
+
if (typeof r == "string") return r;
|
|
39
|
+
switch (r) {
|
|
40
|
+
case F:
|
|
39
41
|
return "Fragment";
|
|
40
|
-
case
|
|
42
|
+
case q:
|
|
41
43
|
return "Profiler";
|
|
42
|
-
case
|
|
44
|
+
case _:
|
|
43
45
|
return "StrictMode";
|
|
44
|
-
case
|
|
46
|
+
case o:
|
|
45
47
|
return "Suspense";
|
|
46
|
-
case
|
|
48
|
+
case a:
|
|
47
49
|
return "SuspenseList";
|
|
48
|
-
case
|
|
50
|
+
case v:
|
|
49
51
|
return "Activity";
|
|
50
52
|
}
|
|
51
|
-
if (typeof
|
|
52
|
-
switch (typeof
|
|
53
|
+
if (typeof r == "object")
|
|
54
|
+
switch (typeof r.tag == "number" && console.error(
|
|
53
55
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
|
-
),
|
|
55
|
-
case
|
|
56
|
+
), r.$$typeof) {
|
|
57
|
+
case A:
|
|
56
58
|
return "Portal";
|
|
57
|
-
case
|
|
58
|
-
return
|
|
59
|
-
case
|
|
60
|
-
return (
|
|
61
|
-
case
|
|
62
|
-
var
|
|
63
|
-
return
|
|
64
|
-
case
|
|
65
|
-
return
|
|
66
|
-
case
|
|
67
|
-
|
|
59
|
+
case s:
|
|
60
|
+
return r.displayName || "Context";
|
|
61
|
+
case u:
|
|
62
|
+
return (r._context.displayName || "Context") + ".Consumer";
|
|
63
|
+
case n:
|
|
64
|
+
var m = r.render;
|
|
65
|
+
return r = r.displayName, r || (r = m.displayName || m.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
66
|
+
case c:
|
|
67
|
+
return m = r.displayName || null, m !== null ? m : e(r.type) || "Memo";
|
|
68
|
+
case i:
|
|
69
|
+
m = r._payload, r = r._init;
|
|
68
70
|
try {
|
|
69
|
-
return r(
|
|
71
|
+
return e(r(m));
|
|
70
72
|
} catch {
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
return null;
|
|
74
76
|
}
|
|
75
|
-
function
|
|
76
|
-
return "" +
|
|
77
|
+
function l(r) {
|
|
78
|
+
return "" + r;
|
|
77
79
|
}
|
|
78
|
-
function f(
|
|
80
|
+
function f(r) {
|
|
79
81
|
try {
|
|
80
|
-
|
|
81
|
-
var
|
|
82
|
+
l(r);
|
|
83
|
+
var m = !1;
|
|
82
84
|
} catch {
|
|
83
|
-
|
|
85
|
+
m = !0;
|
|
84
86
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
var
|
|
88
|
-
return
|
|
89
|
-
|
|
87
|
+
if (m) {
|
|
88
|
+
m = console;
|
|
89
|
+
var O = m.error, I = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
90
|
+
return O.call(
|
|
91
|
+
m,
|
|
90
92
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
-
|
|
92
|
-
),
|
|
93
|
+
I
|
|
94
|
+
), l(r);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
|
-
function
|
|
96
|
-
if (
|
|
97
|
-
if (typeof
|
|
97
|
+
function d(r) {
|
|
98
|
+
if (r === F) return "<>";
|
|
99
|
+
if (typeof r == "object" && r !== null && r.$$typeof === i)
|
|
98
100
|
return "<...>";
|
|
99
101
|
try {
|
|
100
|
-
var
|
|
101
|
-
return
|
|
102
|
+
var m = e(r);
|
|
103
|
+
return m ? "<" + m + ">" : "<...>";
|
|
102
104
|
} catch {
|
|
103
105
|
return "<...>";
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
|
-
function
|
|
107
|
-
var
|
|
108
|
-
return
|
|
108
|
+
function w() {
|
|
109
|
+
var r = p.A;
|
|
110
|
+
return r === null ? null : r.getOwner();
|
|
109
111
|
}
|
|
110
112
|
function b() {
|
|
111
113
|
return Error("react-stack-top-frame");
|
|
112
114
|
}
|
|
113
|
-
function T(
|
|
114
|
-
if (
|
|
115
|
-
var
|
|
116
|
-
if (
|
|
115
|
+
function T(r) {
|
|
116
|
+
if (x.call(r, "key")) {
|
|
117
|
+
var m = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
118
|
+
if (m && m.isReactWarning) return !1;
|
|
117
119
|
}
|
|
118
|
-
return
|
|
120
|
+
return r.key !== void 0;
|
|
119
121
|
}
|
|
120
|
-
function
|
|
121
|
-
function
|
|
122
|
-
|
|
122
|
+
function E(r, m) {
|
|
123
|
+
function O() {
|
|
124
|
+
h || (h = !0, console.error(
|
|
123
125
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
124
|
-
|
|
126
|
+
m
|
|
125
127
|
));
|
|
126
128
|
}
|
|
127
|
-
|
|
128
|
-
get:
|
|
129
|
+
O.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
130
|
+
get: O,
|
|
129
131
|
configurable: !0
|
|
130
132
|
});
|
|
131
133
|
}
|
|
132
|
-
function
|
|
133
|
-
var
|
|
134
|
-
return
|
|
134
|
+
function S() {
|
|
135
|
+
var r = e(this.type);
|
|
136
|
+
return le[r] || (le[r] = !0, console.error(
|
|
135
137
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
|
-
)),
|
|
137
|
-
}
|
|
138
|
-
function
|
|
139
|
-
var
|
|
140
|
-
return
|
|
141
|
-
$$typeof:
|
|
142
|
-
type:
|
|
143
|
-
key:
|
|
144
|
-
props:
|
|
145
|
-
_owner:
|
|
146
|
-
}, (
|
|
138
|
+
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
139
|
+
}
|
|
140
|
+
function C(r, m, O, I, Z, te) {
|
|
141
|
+
var z = O.ref;
|
|
142
|
+
return r = {
|
|
143
|
+
$$typeof: P,
|
|
144
|
+
type: r,
|
|
145
|
+
key: m,
|
|
146
|
+
props: O,
|
|
147
|
+
_owner: I
|
|
148
|
+
}, (z !== void 0 ? z : null) !== null ? Object.defineProperty(r, "ref", {
|
|
147
149
|
enumerable: !1,
|
|
148
|
-
get:
|
|
149
|
-
}) : Object.defineProperty(
|
|
150
|
+
get: S
|
|
151
|
+
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
150
152
|
configurable: !1,
|
|
151
153
|
enumerable: !1,
|
|
152
154
|
writable: !0,
|
|
153
155
|
value: 0
|
|
154
|
-
}), Object.defineProperty(
|
|
156
|
+
}), Object.defineProperty(r, "_debugInfo", {
|
|
155
157
|
configurable: !1,
|
|
156
158
|
enumerable: !1,
|
|
157
159
|
writable: !0,
|
|
158
160
|
value: null
|
|
159
|
-
}), Object.defineProperty(
|
|
161
|
+
}), Object.defineProperty(r, "_debugStack", {
|
|
160
162
|
configurable: !1,
|
|
161
163
|
enumerable: !1,
|
|
162
164
|
writable: !0,
|
|
163
|
-
value:
|
|
164
|
-
}), Object.defineProperty(
|
|
165
|
+
value: Z
|
|
166
|
+
}), Object.defineProperty(r, "_debugTask", {
|
|
165
167
|
configurable: !1,
|
|
166
168
|
enumerable: !1,
|
|
167
169
|
writable: !0,
|
|
168
|
-
value:
|
|
169
|
-
}), Object.freeze && (Object.freeze(
|
|
170
|
-
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
if (
|
|
176
|
-
for (
|
|
177
|
-
|
|
178
|
-
Object.freeze && Object.freeze(
|
|
170
|
+
value: te
|
|
171
|
+
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
172
|
+
}
|
|
173
|
+
function j(r, m, O, I, Z, te) {
|
|
174
|
+
var z = m.children;
|
|
175
|
+
if (z !== void 0)
|
|
176
|
+
if (I)
|
|
177
|
+
if (R(z)) {
|
|
178
|
+
for (I = 0; I < z.length; I++)
|
|
179
|
+
y(z[I]);
|
|
180
|
+
Object.freeze && Object.freeze(z);
|
|
179
181
|
} else
|
|
180
182
|
console.error(
|
|
181
183
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
184
|
);
|
|
183
|
-
else
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
var
|
|
187
|
-
return
|
|
185
|
+
else y(z);
|
|
186
|
+
if (x.call(m, "key")) {
|
|
187
|
+
z = e(r);
|
|
188
|
+
var H = Object.keys(m).filter(function(me) {
|
|
189
|
+
return me !== "key";
|
|
188
190
|
});
|
|
189
|
-
|
|
191
|
+
I = 0 < H.length ? "{key: someKey, " + H.join(": ..., ") + ": ...}" : "{key: someKey}", oe[z + I] || (H = 0 < H.length ? "{" + H.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
192
|
`A props object containing a "key" prop is being spread into JSX:
|
|
191
193
|
let props = %s;
|
|
192
194
|
<%s {...props} />
|
|
193
195
|
React keys must be passed directly to JSX without using spread:
|
|
194
196
|
let props = %s;
|
|
195
197
|
<%s key={someKey} {...props} />`,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
),
|
|
201
|
-
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
for (var
|
|
205
|
-
|
|
206
|
-
} else
|
|
207
|
-
return
|
|
208
|
-
|
|
209
|
-
typeof
|
|
210
|
-
),
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
198
|
+
I,
|
|
199
|
+
z,
|
|
200
|
+
H,
|
|
201
|
+
z
|
|
202
|
+
), oe[z + I] = !0);
|
|
203
|
+
}
|
|
204
|
+
if (z = null, O !== void 0 && (f(O), z = "" + O), T(m) && (f(m.key), z = "" + m.key), "key" in m) {
|
|
205
|
+
O = {};
|
|
206
|
+
for (var re in m)
|
|
207
|
+
re !== "key" && (O[re] = m[re]);
|
|
208
|
+
} else O = m;
|
|
209
|
+
return z && E(
|
|
210
|
+
O,
|
|
211
|
+
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
212
|
+
), C(
|
|
213
|
+
r,
|
|
214
|
+
z,
|
|
215
|
+
O,
|
|
216
|
+
w(),
|
|
217
|
+
Z,
|
|
218
|
+
te
|
|
217
219
|
);
|
|
218
220
|
}
|
|
219
|
-
function
|
|
220
|
-
|
|
221
|
+
function y(r) {
|
|
222
|
+
N(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === i && (r._payload.status === "fulfilled" ? N(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
|
|
221
223
|
}
|
|
222
|
-
function
|
|
223
|
-
return typeof
|
|
224
|
+
function N(r) {
|
|
225
|
+
return typeof r == "object" && r !== null && r.$$typeof === P;
|
|
224
226
|
}
|
|
225
|
-
var
|
|
227
|
+
var D = J, P = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), F = /* @__PURE__ */ Symbol.for("react.fragment"), _ = /* @__PURE__ */ Symbol.for("react.strict_mode"), q = /* @__PURE__ */ Symbol.for("react.profiler"), u = /* @__PURE__ */ Symbol.for("react.consumer"), s = /* @__PURE__ */ Symbol.for("react.context"), n = /* @__PURE__ */ Symbol.for("react.forward_ref"), o = /* @__PURE__ */ Symbol.for("react.suspense"), a = /* @__PURE__ */ Symbol.for("react.suspense_list"), c = /* @__PURE__ */ Symbol.for("react.memo"), i = /* @__PURE__ */ Symbol.for("react.lazy"), v = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), p = D.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, R = Array.isArray, L = console.createTask ? console.createTask : function() {
|
|
226
228
|
return null;
|
|
227
229
|
};
|
|
228
|
-
|
|
229
|
-
react_stack_bottom_frame: function(
|
|
230
|
-
return
|
|
230
|
+
D = {
|
|
231
|
+
react_stack_bottom_frame: function(r) {
|
|
232
|
+
return r();
|
|
231
233
|
}
|
|
232
234
|
};
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
+
var h, le = {}, ne = D.react_stack_bottom_frame.bind(
|
|
236
|
+
D,
|
|
235
237
|
b
|
|
236
|
-
)(),
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
return
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
)(), ie = L(d(b)), oe = {};
|
|
239
|
+
X.Fragment = F, X.jsx = function(r, m, O) {
|
|
240
|
+
var I = 1e4 > p.recentlyCreatedOwnerStacks++;
|
|
241
|
+
return j(
|
|
242
|
+
r,
|
|
243
|
+
m,
|
|
244
|
+
O,
|
|
243
245
|
!1,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
+
I ? Error("react-stack-top-frame") : ne,
|
|
247
|
+
I ? L(d(r)) : ie
|
|
246
248
|
);
|
|
247
|
-
},
|
|
248
|
-
var
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
}, X.jsxs = function(r, m, O) {
|
|
250
|
+
var I = 1e4 > p.recentlyCreatedOwnerStacks++;
|
|
251
|
+
return j(
|
|
252
|
+
r,
|
|
253
|
+
m,
|
|
254
|
+
O,
|
|
253
255
|
!0,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
I ? Error("react-stack-top-frame") : ne,
|
|
257
|
+
I ? L(d(r)) : ie
|
|
256
258
|
);
|
|
257
259
|
};
|
|
258
|
-
})()),
|
|
260
|
+
})()), X;
|
|
259
261
|
}
|
|
260
|
-
var
|
|
261
|
-
function
|
|
262
|
-
return
|
|
262
|
+
var ce;
|
|
263
|
+
function Ve() {
|
|
264
|
+
return ce || (ce = 1, process.env.NODE_ENV === "production" ? ee.exports = he() : ee.exports = Ae()), ee.exports;
|
|
263
265
|
}
|
|
264
|
-
var
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
var t = Ve();
|
|
267
|
+
const G = ({
|
|
268
|
+
label: e,
|
|
269
|
+
description: l,
|
|
270
|
+
collapsible: f = !1,
|
|
271
|
+
collapsed: d = !1,
|
|
272
|
+
columns: w = 1,
|
|
273
|
+
children: b,
|
|
274
|
+
className: T
|
|
275
|
+
}) => {
|
|
276
|
+
const [E, S] = g(d), C = {
|
|
277
|
+
1: "grid-cols-1",
|
|
278
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
279
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
280
|
+
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
281
|
+
}, j = () => {
|
|
282
|
+
f && S(!E);
|
|
283
|
+
};
|
|
284
|
+
return /* @__PURE__ */ t.jsxs("div", { className: V("form-section", T), children: [
|
|
285
|
+
(e || l) && /* @__PURE__ */ t.jsxs(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
className: V(
|
|
289
|
+
"flex items-start gap-2 mb-4",
|
|
290
|
+
f && "cursor-pointer select-none"
|
|
291
|
+
),
|
|
292
|
+
onClick: j,
|
|
293
|
+
role: f ? "button" : void 0,
|
|
294
|
+
"aria-expanded": f ? !E : void 0,
|
|
295
|
+
children: [
|
|
296
|
+
f && /* @__PURE__ */ t.jsx("span", { className: "mt-0.5 text-muted-foreground", children: E ? /* @__PURE__ */ t.jsx(pe, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(ze, { className: "h-4 w-4" }) }),
|
|
297
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex-1", children: [
|
|
298
|
+
e && /* @__PURE__ */ t.jsx("h3", { className: "text-base font-semibold text-foreground", children: e }),
|
|
299
|
+
l && /* @__PURE__ */ t.jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: l })
|
|
300
|
+
] })
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
!E && /* @__PURE__ */ t.jsx("div", { className: V("grid gap-4", C[w]), children: b })
|
|
305
|
+
] });
|
|
306
|
+
}, qe = ({
|
|
307
|
+
schema: e,
|
|
308
|
+
dataSource: l,
|
|
309
|
+
className: f
|
|
310
|
+
}) => {
|
|
311
|
+
const [d, w] = g(null), [b, T] = g({}), [E, S] = g(!0), [C, j] = g(null), [y, N] = g(
|
|
312
|
+
e.defaultTab || e.sections[0]?.name || e.sections[0]?.label || "tab-0"
|
|
313
|
+
);
|
|
314
|
+
J.useEffect(() => {
|
|
315
|
+
(async () => {
|
|
316
|
+
if (!l) {
|
|
317
|
+
S(!1);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
const n = await l.getObjectSchema(e.objectName);
|
|
322
|
+
w(n);
|
|
323
|
+
} catch (n) {
|
|
324
|
+
j(n);
|
|
325
|
+
}
|
|
326
|
+
})();
|
|
327
|
+
}, [e.objectName, l]), J.useEffect(() => {
|
|
328
|
+
(d || !l) && (async () => {
|
|
329
|
+
if (e.mode === "create" || !e.recordId || !l) {
|
|
330
|
+
T(e.initialData || e.initialValues || {}), S(!1);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
try {
|
|
334
|
+
const n = await l.findOne(e.objectName, e.recordId);
|
|
335
|
+
T(n || {});
|
|
336
|
+
} catch (n) {
|
|
337
|
+
j(n);
|
|
338
|
+
} finally {
|
|
339
|
+
S(!1);
|
|
340
|
+
}
|
|
341
|
+
})();
|
|
342
|
+
}, [d, e.mode, e.recordId, e.initialData, e.initialValues, l, e.objectName]);
|
|
343
|
+
const D = k((s) => {
|
|
344
|
+
const n = [];
|
|
345
|
+
for (const o of s.fields) {
|
|
346
|
+
const a = typeof o == "string" ? o : o.name;
|
|
347
|
+
if (typeof o == "object")
|
|
348
|
+
n.push(o);
|
|
349
|
+
else if (d?.fields?.[a]) {
|
|
350
|
+
const c = d.fields[a];
|
|
351
|
+
n.push({
|
|
352
|
+
name: a,
|
|
353
|
+
label: c.label || a,
|
|
354
|
+
type: U(c.type),
|
|
355
|
+
required: c.required || !1,
|
|
356
|
+
disabled: e.readOnly || e.mode === "view" || c.readonly,
|
|
357
|
+
placeholder: c.placeholder,
|
|
358
|
+
description: c.help || c.description,
|
|
359
|
+
validation: Y(c),
|
|
360
|
+
field: c,
|
|
361
|
+
options: c.options,
|
|
362
|
+
multiple: c.multiple
|
|
363
|
+
});
|
|
364
|
+
} else
|
|
365
|
+
n.push({
|
|
366
|
+
name: a,
|
|
367
|
+
label: a,
|
|
368
|
+
type: "input"
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
return n;
|
|
372
|
+
}, [d, e.readOnly, e.mode]), P = k(async (s) => {
|
|
373
|
+
if (!l)
|
|
374
|
+
return e.onSuccess && await e.onSuccess(s), s;
|
|
375
|
+
try {
|
|
376
|
+
let n;
|
|
377
|
+
return e.mode === "create" ? n = await l.create(e.objectName, s) : e.mode === "edit" && e.recordId && (n = await l.update(e.objectName, e.recordId, s)), e.onSuccess && await e.onSuccess(n), n;
|
|
378
|
+
} catch (n) {
|
|
379
|
+
throw e.onError && e.onError(n), n;
|
|
380
|
+
}
|
|
381
|
+
}, [e, l]), A = k(() => {
|
|
382
|
+
e.onCancel && e.onCancel();
|
|
383
|
+
}, [e]), F = (s, n) => s.name || s.label || `tab-${n}`;
|
|
384
|
+
if (C)
|
|
385
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
|
|
386
|
+
/* @__PURE__ */ t.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading form" }),
|
|
387
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-red-600 text-sm mt-1", children: C.message })
|
|
388
|
+
] });
|
|
389
|
+
if (E)
|
|
390
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center", children: [
|
|
391
|
+
/* @__PURE__ */ t.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
|
|
392
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading form..." })
|
|
393
|
+
] });
|
|
394
|
+
const q = {
|
|
395
|
+
type: "form",
|
|
396
|
+
fields: e.sections.flatMap((s) => D(s)),
|
|
397
|
+
layout: "vertical",
|
|
398
|
+
defaultValues: b,
|
|
399
|
+
submitLabel: e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
400
|
+
cancelLabel: e.cancelText,
|
|
401
|
+
showSubmit: e.showSubmit !== !1 && e.mode !== "view",
|
|
402
|
+
showCancel: e.showCancel !== !1,
|
|
403
|
+
onSubmit: P,
|
|
404
|
+
onCancel: A
|
|
405
|
+
}, u = e.tabPosition === "left" || e.tabPosition === "right";
|
|
406
|
+
return /* @__PURE__ */ t.jsx("div", { className: V("w-full", f, e.className), children: /* @__PURE__ */ t.jsxs(
|
|
407
|
+
je,
|
|
408
|
+
{
|
|
409
|
+
value: y,
|
|
410
|
+
onValueChange: N,
|
|
411
|
+
orientation: u ? "vertical" : "horizontal",
|
|
412
|
+
className: V(u && "flex gap-4"),
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ t.jsx(ge, { className: V(
|
|
415
|
+
u ? "flex-col h-auto" : "",
|
|
416
|
+
e.tabPosition === "bottom" && "order-last",
|
|
417
|
+
e.tabPosition === "right" && "order-last"
|
|
418
|
+
), children: e.sections.map((s, n) => /* @__PURE__ */ t.jsx(
|
|
419
|
+
we,
|
|
420
|
+
{
|
|
421
|
+
value: F(s, n),
|
|
422
|
+
className: u ? "w-full justify-start" : "",
|
|
423
|
+
children: s.label || `Tab ${n + 1}`
|
|
424
|
+
},
|
|
425
|
+
F(s, n)
|
|
426
|
+
)) }),
|
|
427
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1", children: e.sections.map((s, n) => /* @__PURE__ */ t.jsx(
|
|
428
|
+
ve,
|
|
429
|
+
{
|
|
430
|
+
value: F(s, n),
|
|
431
|
+
className: "mt-0",
|
|
432
|
+
children: /* @__PURE__ */ t.jsx(
|
|
433
|
+
G,
|
|
434
|
+
{
|
|
435
|
+
description: s.description,
|
|
436
|
+
columns: s.columns || 1,
|
|
437
|
+
children: /* @__PURE__ */ t.jsx(
|
|
438
|
+
M,
|
|
439
|
+
{
|
|
440
|
+
schema: {
|
|
441
|
+
...q,
|
|
442
|
+
fields: D(s),
|
|
443
|
+
// Only show buttons on the last tab or always visible
|
|
444
|
+
showSubmit: e.showSubmit !== !1 && e.mode !== "view",
|
|
445
|
+
showCancel: e.showCancel !== !1
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
},
|
|
452
|
+
F(s, n)
|
|
453
|
+
)) })
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
) });
|
|
457
|
+
}, We = ({
|
|
458
|
+
schema: e,
|
|
459
|
+
dataSource: l,
|
|
460
|
+
className: f
|
|
461
|
+
}) => {
|
|
462
|
+
const [d, w] = g(null), [b, T] = g({}), [E, S] = g(!0), [C, j] = g(null), [y, N] = g(0), [D, P] = g(/* @__PURE__ */ new Set()), [A, F] = g(!1), _ = e.sections.length, q = y === 0, u = y === _ - 1;
|
|
463
|
+
J.useEffect(() => {
|
|
464
|
+
(async () => {
|
|
465
|
+
if (!l) {
|
|
466
|
+
S(!1);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
const x = await l.getObjectSchema(e.objectName);
|
|
471
|
+
w(x);
|
|
472
|
+
} catch (x) {
|
|
473
|
+
j(x);
|
|
474
|
+
}
|
|
475
|
+
})();
|
|
476
|
+
}, [e.objectName, l]), J.useEffect(() => {
|
|
477
|
+
(d || !l) && (async () => {
|
|
478
|
+
if (e.mode === "create" || !e.recordId || !l) {
|
|
479
|
+
T(e.initialData || e.initialValues || {}), S(!1);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
try {
|
|
483
|
+
const x = await l.findOne(e.objectName, e.recordId);
|
|
484
|
+
T(x || {});
|
|
485
|
+
} catch (x) {
|
|
486
|
+
j(x);
|
|
487
|
+
} finally {
|
|
488
|
+
S(!1);
|
|
489
|
+
}
|
|
490
|
+
})();
|
|
491
|
+
}, [d, e.mode, e.recordId, e.initialData, e.initialValues, l, e.objectName]);
|
|
492
|
+
const s = k((p) => {
|
|
493
|
+
const x = [];
|
|
494
|
+
for (const R of p.fields) {
|
|
495
|
+
const L = typeof R == "string" ? R : R.name;
|
|
496
|
+
if (typeof R == "object")
|
|
497
|
+
x.push(R);
|
|
498
|
+
else if (d?.fields?.[L]) {
|
|
499
|
+
const h = d.fields[L];
|
|
500
|
+
x.push({
|
|
501
|
+
name: L,
|
|
502
|
+
label: h.label || L,
|
|
503
|
+
type: U(h.type),
|
|
504
|
+
required: h.required || !1,
|
|
505
|
+
disabled: e.readOnly || e.mode === "view" || h.readonly,
|
|
506
|
+
placeholder: h.placeholder,
|
|
507
|
+
description: h.help || h.description,
|
|
508
|
+
validation: Y(h),
|
|
509
|
+
field: h,
|
|
510
|
+
options: h.options,
|
|
511
|
+
multiple: h.multiple
|
|
512
|
+
});
|
|
513
|
+
} else
|
|
514
|
+
x.push({
|
|
515
|
+
name: L,
|
|
516
|
+
label: L,
|
|
517
|
+
type: "input"
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
return x;
|
|
521
|
+
}, [d, e.readOnly, e.mode]), n = Q(() => y >= 0 && y < _ ? s(e.sections[y]) : [], [y, _, e.sections, s]), o = k(async (p) => {
|
|
522
|
+
const x = { ...b, ...p };
|
|
523
|
+
if (T(x), P((R) => new Set(R).add(y)), u) {
|
|
524
|
+
F(!0);
|
|
525
|
+
try {
|
|
526
|
+
if (!l)
|
|
527
|
+
return e.onSuccess && await e.onSuccess(x), x;
|
|
528
|
+
let R;
|
|
529
|
+
return e.mode === "create" ? R = await l.create(e.objectName, x) : e.mode === "edit" && e.recordId && (R = await l.update(e.objectName, e.recordId, x)), e.onSuccess && await e.onSuccess(R), R;
|
|
530
|
+
} catch (R) {
|
|
531
|
+
throw e.onError && e.onError(R), R;
|
|
532
|
+
} finally {
|
|
533
|
+
F(!1);
|
|
534
|
+
}
|
|
535
|
+
} else
|
|
536
|
+
a(y + 1);
|
|
537
|
+
}, [b, y, u, e, l]), a = k((p) => {
|
|
538
|
+
p >= 0 && p < _ && (N(p), e.onStepChange && e.onStepChange(p));
|
|
539
|
+
}, [_, e]), c = k(() => {
|
|
540
|
+
a(y - 1);
|
|
541
|
+
}, [y, a]), i = k(() => {
|
|
542
|
+
e.onCancel && e.onCancel();
|
|
543
|
+
}, [e]), v = k((p) => {
|
|
544
|
+
(e.allowSkip || D.has(p) || p <= y) && a(p);
|
|
545
|
+
}, [e.allowSkip, D, y, a]);
|
|
546
|
+
if (C)
|
|
547
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
|
|
548
|
+
/* @__PURE__ */ t.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading form" }),
|
|
549
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-red-600 text-sm mt-1", children: C.message })
|
|
550
|
+
] });
|
|
551
|
+
if (E)
|
|
552
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center", children: [
|
|
553
|
+
/* @__PURE__ */ t.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
|
|
554
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading form..." })
|
|
555
|
+
] });
|
|
556
|
+
const $ = e.sections[y];
|
|
557
|
+
return /* @__PURE__ */ t.jsxs("div", { className: V("w-full", f, e.className), children: [
|
|
558
|
+
e.showStepIndicator !== !1 && /* @__PURE__ */ t.jsx("nav", { "aria-label": "Progress", className: "mb-8", children: /* @__PURE__ */ t.jsx("ol", { className: "flex items-center", children: e.sections.map((p, x) => {
|
|
559
|
+
const R = x === y, L = D.has(x), h = e.allowSkip || L || x <= y;
|
|
560
|
+
return /* @__PURE__ */ t.jsxs(
|
|
561
|
+
"li",
|
|
562
|
+
{
|
|
563
|
+
className: V(
|
|
564
|
+
"relative flex-1",
|
|
565
|
+
x !== _ - 1 && "pr-8 sm:pr-12"
|
|
566
|
+
),
|
|
567
|
+
children: [
|
|
568
|
+
x !== _ - 1 && /* @__PURE__ */ t.jsx(
|
|
569
|
+
"div",
|
|
570
|
+
{
|
|
571
|
+
className: "absolute top-3 sm:top-4 left-6 -right-4 sm:left-10 sm:-right-2 h-0.5",
|
|
572
|
+
"aria-hidden": "true",
|
|
573
|
+
children: /* @__PURE__ */ t.jsx(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
className: V(
|
|
577
|
+
"h-full",
|
|
578
|
+
L ? "bg-primary" : "bg-muted"
|
|
579
|
+
)
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
/* @__PURE__ */ t.jsxs(
|
|
585
|
+
"button",
|
|
586
|
+
{
|
|
587
|
+
type: "button",
|
|
588
|
+
className: V(
|
|
589
|
+
"group relative flex items-center",
|
|
590
|
+
h ? "cursor-pointer" : "cursor-not-allowed"
|
|
591
|
+
),
|
|
592
|
+
onClick: () => v(x),
|
|
593
|
+
disabled: !h,
|
|
594
|
+
children: [
|
|
595
|
+
/* @__PURE__ */ t.jsx(
|
|
596
|
+
"span",
|
|
597
|
+
{
|
|
598
|
+
className: V(
|
|
599
|
+
"flex h-6 w-6 sm:h-8 sm:w-8 items-center justify-center rounded-full text-xs sm:text-sm font-medium transition-colors",
|
|
600
|
+
L && "bg-primary text-primary-foreground",
|
|
601
|
+
R && !L && "border-2 border-primary bg-background text-primary",
|
|
602
|
+
!R && !L && "border-2 border-muted bg-background text-muted-foreground"
|
|
603
|
+
),
|
|
604
|
+
children: L ? /* @__PURE__ */ t.jsx(Pe, { className: "h-3 w-3 sm:h-4 sm:w-4" }) : x + 1
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ t.jsx("span", { className: "ml-2 sm:ml-3 text-xs sm:text-sm font-medium hidden sm:block", children: /* @__PURE__ */ t.jsx(
|
|
608
|
+
"span",
|
|
609
|
+
{
|
|
610
|
+
className: V(
|
|
611
|
+
R ? "text-foreground" : "text-muted-foreground"
|
|
612
|
+
),
|
|
613
|
+
children: p.label || `Step ${x + 1}`
|
|
614
|
+
}
|
|
615
|
+
) })
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
)
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
x
|
|
622
|
+
);
|
|
623
|
+
}) }) }),
|
|
624
|
+
/* @__PURE__ */ t.jsx("div", { className: "min-h-[200px]", children: $ && /* @__PURE__ */ t.jsx(
|
|
625
|
+
G,
|
|
626
|
+
{
|
|
627
|
+
label: $.label,
|
|
628
|
+
description: $.description,
|
|
629
|
+
columns: $.columns || 1,
|
|
630
|
+
children: n.length > 0 ? /* @__PURE__ */ t.jsx(
|
|
631
|
+
M,
|
|
632
|
+
{
|
|
633
|
+
schema: {
|
|
634
|
+
type: "form",
|
|
635
|
+
fields: n,
|
|
636
|
+
layout: "vertical",
|
|
637
|
+
defaultValues: b,
|
|
638
|
+
showSubmit: !1,
|
|
639
|
+
showCancel: !1,
|
|
640
|
+
onSubmit: o
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
) : /* @__PURE__ */ t.jsx("div", { className: "text-center py-8 text-muted-foreground", children: "No fields configured for this step" })
|
|
644
|
+
}
|
|
645
|
+
) }),
|
|
646
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between mt-6 pt-4 border-t", children: [
|
|
647
|
+
/* @__PURE__ */ t.jsx("div", { children: e.showCancel !== !1 && /* @__PURE__ */ t.jsx(
|
|
648
|
+
K,
|
|
649
|
+
{
|
|
650
|
+
variant: "ghost",
|
|
651
|
+
onClick: i,
|
|
652
|
+
children: e.cancelText || "Cancel"
|
|
653
|
+
}
|
|
654
|
+
) }),
|
|
655
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
656
|
+
/* @__PURE__ */ t.jsxs("span", { className: "text-sm text-muted-foreground mr-2", children: [
|
|
657
|
+
"Step ",
|
|
658
|
+
y + 1,
|
|
659
|
+
" of ",
|
|
660
|
+
_
|
|
661
|
+
] }),
|
|
662
|
+
!q && /* @__PURE__ */ t.jsxs(
|
|
663
|
+
K,
|
|
664
|
+
{
|
|
665
|
+
variant: "outline",
|
|
666
|
+
onClick: c,
|
|
667
|
+
children: [
|
|
668
|
+
/* @__PURE__ */ t.jsx(Le, { className: "h-4 w-4 mr-1" }),
|
|
669
|
+
e.prevText || "Back"
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
u ? /* @__PURE__ */ t.jsx(
|
|
674
|
+
K,
|
|
675
|
+
{
|
|
676
|
+
onClick: () => o(b),
|
|
677
|
+
disabled: A || e.mode === "view",
|
|
678
|
+
children: A ? "Submitting..." : e.submitText || (e.mode === "create" ? "Create" : "Update")
|
|
679
|
+
}
|
|
680
|
+
) : /* @__PURE__ */ t.jsxs(
|
|
681
|
+
K,
|
|
682
|
+
{
|
|
683
|
+
onClick: () => o(b),
|
|
684
|
+
children: [
|
|
685
|
+
e.nextText || "Next",
|
|
686
|
+
/* @__PURE__ */ t.jsx(pe, { className: "h-4 w-4 ml-1" })
|
|
687
|
+
]
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
] })
|
|
691
|
+
] })
|
|
692
|
+
] });
|
|
693
|
+
}, $e = ({
|
|
694
|
+
schema: e,
|
|
695
|
+
dataSource: l,
|
|
696
|
+
className: f
|
|
697
|
+
}) => {
|
|
698
|
+
const [d, w] = g(null), [b, T] = g({}), [E, S] = g(!0), [C, j] = g(null);
|
|
699
|
+
W(() => {
|
|
700
|
+
(async () => {
|
|
701
|
+
if (!l) {
|
|
702
|
+
S(!1);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
try {
|
|
706
|
+
const n = await l.getObjectSchema(e.objectName);
|
|
707
|
+
w(n);
|
|
708
|
+
} catch (n) {
|
|
709
|
+
j(n), S(!1);
|
|
710
|
+
}
|
|
711
|
+
})();
|
|
712
|
+
}, [e.objectName, l]), W(() => {
|
|
713
|
+
(d || !l) && (async () => {
|
|
714
|
+
if (e.mode === "create" || !e.recordId) {
|
|
715
|
+
T(e.initialData || e.initialValues || {}), S(!1);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
if (!l) {
|
|
719
|
+
T(e.initialData || e.initialValues || {}), S(!1);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
try {
|
|
723
|
+
const n = await l.findOne(e.objectName, e.recordId);
|
|
724
|
+
T(n || {});
|
|
725
|
+
} catch (n) {
|
|
726
|
+
j(n);
|
|
727
|
+
} finally {
|
|
728
|
+
S(!1);
|
|
729
|
+
}
|
|
730
|
+
})();
|
|
731
|
+
}, [d, e.mode, e.recordId, e.initialData, e.initialValues, l, e.objectName]);
|
|
732
|
+
const y = k((s) => {
|
|
733
|
+
const n = [];
|
|
734
|
+
for (const o of s.fields) {
|
|
735
|
+
const a = typeof o == "string" ? o : o.name;
|
|
736
|
+
if (typeof o == "object")
|
|
737
|
+
n.push(o);
|
|
738
|
+
else if (d?.fields?.[a]) {
|
|
739
|
+
const c = d.fields[a];
|
|
740
|
+
n.push({
|
|
741
|
+
name: a,
|
|
742
|
+
label: c.label || a,
|
|
743
|
+
type: U(c.type),
|
|
744
|
+
required: c.required || !1,
|
|
745
|
+
disabled: e.readOnly || e.mode === "view" || c.readonly,
|
|
746
|
+
placeholder: c.placeholder,
|
|
747
|
+
description: c.help || c.description,
|
|
748
|
+
validation: Y(c),
|
|
749
|
+
field: c,
|
|
750
|
+
options: c.options,
|
|
751
|
+
multiple: c.multiple
|
|
752
|
+
});
|
|
753
|
+
} else
|
|
754
|
+
n.push({
|
|
755
|
+
name: a,
|
|
756
|
+
label: a,
|
|
757
|
+
type: "input"
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
return n;
|
|
761
|
+
}, [d, e.readOnly, e.mode]), N = k(async (s) => {
|
|
762
|
+
if (!l)
|
|
763
|
+
return e.onSuccess && await e.onSuccess(s), s;
|
|
764
|
+
try {
|
|
765
|
+
let n;
|
|
766
|
+
return e.mode === "create" ? n = await l.create(e.objectName, s) : e.mode === "edit" && e.recordId && (n = await l.update(e.objectName, e.recordId, s)), e.onSuccess && await e.onSuccess(n), n;
|
|
767
|
+
} catch (n) {
|
|
768
|
+
throw e.onError && e.onError(n), n;
|
|
769
|
+
}
|
|
770
|
+
}, [e, l]), D = k(() => {
|
|
771
|
+
e.onCancel && e.onCancel();
|
|
772
|
+
}, [e]), P = Q(() => e.sections.slice(0, 1), [e.sections]), A = Q(() => e.sections.slice(1), [e.sections]);
|
|
773
|
+
Q(
|
|
774
|
+
() => e.sections.flatMap((s) => y(s)),
|
|
775
|
+
[e.sections, y]
|
|
776
|
+
);
|
|
777
|
+
const F = e.splitDirection || "horizontal", _ = e.splitSize || 50;
|
|
778
|
+
if (C)
|
|
779
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
|
|
780
|
+
/* @__PURE__ */ t.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading form" }),
|
|
781
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-red-600 text-sm mt-1", children: C.message })
|
|
782
|
+
] });
|
|
783
|
+
if (E)
|
|
784
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center", children: [
|
|
785
|
+
/* @__PURE__ */ t.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
|
|
786
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading form..." })
|
|
787
|
+
] });
|
|
788
|
+
const q = {
|
|
789
|
+
type: "form",
|
|
790
|
+
layout: "vertical",
|
|
791
|
+
defaultValues: b,
|
|
792
|
+
onSubmit: N,
|
|
793
|
+
onCancel: D
|
|
794
|
+
}, u = (s, n) => /* @__PURE__ */ t.jsx("div", { className: "space-y-4 p-4", children: s.map((o, a) => /* @__PURE__ */ t.jsx(
|
|
795
|
+
G,
|
|
796
|
+
{
|
|
797
|
+
label: o.label,
|
|
798
|
+
description: o.description,
|
|
799
|
+
columns: o.columns || 1,
|
|
800
|
+
children: /* @__PURE__ */ t.jsx(
|
|
801
|
+
M,
|
|
802
|
+
{
|
|
803
|
+
schema: {
|
|
804
|
+
...q,
|
|
805
|
+
fields: y(o),
|
|
806
|
+
showSubmit: n && e.showSubmit !== !1 && e.mode !== "view",
|
|
807
|
+
showCancel: n && e.showCancel !== !1,
|
|
808
|
+
submitLabel: e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
809
|
+
cancelLabel: e.cancelText
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
},
|
|
814
|
+
o.name || o.label || a
|
|
815
|
+
)) });
|
|
816
|
+
return /* @__PURE__ */ t.jsx("div", { className: V("w-full", f, e.className), children: /* @__PURE__ */ t.jsxs(Ne, { orientation: F, className: "min-h-[300px] rounded-lg border", children: [
|
|
817
|
+
/* @__PURE__ */ t.jsx(se, { defaultSize: _, minSize: 20, children: u(P, A.length === 0) }),
|
|
818
|
+
A.length > 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
819
|
+
/* @__PURE__ */ t.jsx(Se, { withHandle: e.splitResizable !== !1 }),
|
|
820
|
+
/* @__PURE__ */ t.jsx(se, { defaultSize: 100 - _, minSize: 20, children: u(A, !0) })
|
|
821
|
+
] })
|
|
822
|
+
] }) });
|
|
823
|
+
}, Me = ({
|
|
824
|
+
schema: e,
|
|
825
|
+
dataSource: l,
|
|
826
|
+
className: f
|
|
268
827
|
}) => {
|
|
269
|
-
const [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
828
|
+
const [d, w] = g(null), [b, T] = g([]), [E, S] = g({}), [C, j] = g(!0), [y, N] = g(null), D = e.open !== !1, P = e.drawerSide || "right";
|
|
829
|
+
W(() => {
|
|
830
|
+
(async () => {
|
|
831
|
+
if (!l) {
|
|
832
|
+
j(!1);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
try {
|
|
836
|
+
const a = await l.getObjectSchema(e.objectName);
|
|
837
|
+
w(a);
|
|
838
|
+
} catch (a) {
|
|
839
|
+
N(a), j(!1);
|
|
840
|
+
}
|
|
841
|
+
})();
|
|
842
|
+
}, [e.objectName, l]), W(() => {
|
|
843
|
+
(d || !l) && (async () => {
|
|
844
|
+
if (e.mode === "create" || !e.recordId) {
|
|
845
|
+
S(e.initialData || e.initialValues || {}), j(!1);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
if (!l) {
|
|
849
|
+
S(e.initialData || e.initialValues || {}), j(!1);
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
274
852
|
try {
|
|
275
|
-
|
|
853
|
+
const a = await l.findOne(e.objectName, e.recordId);
|
|
854
|
+
S(a || {});
|
|
855
|
+
} catch (a) {
|
|
856
|
+
N(a);
|
|
857
|
+
} finally {
|
|
858
|
+
j(!1);
|
|
859
|
+
}
|
|
860
|
+
})();
|
|
861
|
+
}, [d, e.mode, e.recordId, e.initialData, e.initialValues, l, e.objectName]);
|
|
862
|
+
const A = k((o) => {
|
|
863
|
+
const a = [];
|
|
864
|
+
for (const c of o.fields) {
|
|
865
|
+
const i = typeof c == "string" ? c : c.name;
|
|
866
|
+
if (typeof c == "object")
|
|
867
|
+
a.push(c);
|
|
868
|
+
else if (d?.fields?.[i]) {
|
|
869
|
+
const v = d.fields[i];
|
|
870
|
+
a.push({
|
|
871
|
+
name: i,
|
|
872
|
+
label: v.label || i,
|
|
873
|
+
type: U(v.type),
|
|
874
|
+
required: v.required || !1,
|
|
875
|
+
disabled: e.readOnly || e.mode === "view" || v.readonly,
|
|
876
|
+
placeholder: v.placeholder,
|
|
877
|
+
description: v.help || v.description,
|
|
878
|
+
validation: Y(v),
|
|
879
|
+
field: v,
|
|
880
|
+
options: v.options,
|
|
881
|
+
multiple: v.multiple
|
|
882
|
+
});
|
|
883
|
+
} else
|
|
884
|
+
a.push({
|
|
885
|
+
name: i,
|
|
886
|
+
label: i,
|
|
887
|
+
type: "input"
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
return a;
|
|
891
|
+
}, [d, e.readOnly, e.mode]);
|
|
892
|
+
W(() => {
|
|
893
|
+
if (!d && l) return;
|
|
894
|
+
if (e.customFields?.length) {
|
|
895
|
+
T(e.customFields), j(!1);
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
if (e.sections?.length) {
|
|
899
|
+
j(!1);
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
if (!d) return;
|
|
903
|
+
const o = e.fields || Object.keys(d.fields || {}), a = [];
|
|
904
|
+
for (const c of o) {
|
|
905
|
+
const i = typeof c == "string" ? c : c.name;
|
|
906
|
+
if (!i) continue;
|
|
907
|
+
const v = d.fields?.[i];
|
|
908
|
+
v && a.push({
|
|
909
|
+
name: i,
|
|
910
|
+
label: v.label || i,
|
|
911
|
+
type: U(v.type),
|
|
912
|
+
required: v.required || !1,
|
|
913
|
+
disabled: e.readOnly || e.mode === "view" || v.readonly,
|
|
914
|
+
placeholder: v.placeholder,
|
|
915
|
+
description: v.help || v.description,
|
|
916
|
+
validation: Y(v),
|
|
917
|
+
field: v,
|
|
918
|
+
options: v.options,
|
|
919
|
+
multiple: v.multiple
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
T(a), j(!1);
|
|
923
|
+
}, [d, e.fields, e.customFields, e.sections, e.readOnly, e.mode, l]);
|
|
924
|
+
const F = k(async (o) => {
|
|
925
|
+
if (!l)
|
|
926
|
+
return e.onSuccess && await e.onSuccess(o), e.onOpenChange?.(!1), o;
|
|
927
|
+
try {
|
|
928
|
+
let a;
|
|
929
|
+
return e.mode === "create" ? a = await l.create(e.objectName, o) : e.mode === "edit" && e.recordId && (a = await l.update(e.objectName, e.recordId, o)), e.onSuccess && await e.onSuccess(a), e.onOpenChange?.(!1), a;
|
|
930
|
+
} catch (a) {
|
|
931
|
+
throw e.onError && e.onError(a), a;
|
|
932
|
+
}
|
|
933
|
+
}, [e, l]), _ = k(() => {
|
|
934
|
+
e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
|
|
935
|
+
}, [e]), q = Q(() => e.drawerWidth ? P === "left" || P === "right" ? { width: e.drawerWidth, maxWidth: e.drawerWidth } : { height: e.drawerWidth, maxHeight: e.drawerWidth } : void 0, [e.drawerWidth, P]), s = {
|
|
936
|
+
type: "form",
|
|
937
|
+
layout: e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical",
|
|
938
|
+
defaultValues: E,
|
|
939
|
+
submitLabel: e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
940
|
+
cancelLabel: e.cancelText,
|
|
941
|
+
showSubmit: e.showSubmit !== !1 && e.mode !== "view",
|
|
942
|
+
showCancel: e.showCancel !== !1,
|
|
943
|
+
onSubmit: F,
|
|
944
|
+
onCancel: _
|
|
945
|
+
}, n = () => y ? /* @__PURE__ */ t.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
|
|
946
|
+
/* @__PURE__ */ t.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading form" }),
|
|
947
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-red-600 text-sm mt-1", children: y.message })
|
|
948
|
+
] }) : C ? /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center", children: [
|
|
949
|
+
/* @__PURE__ */ t.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
|
|
950
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading form..." })
|
|
951
|
+
] }) : e.sections?.length ? /* @__PURE__ */ t.jsx("div", { className: "space-y-6", children: e.sections.map((o, a) => /* @__PURE__ */ t.jsx(
|
|
952
|
+
G,
|
|
953
|
+
{
|
|
954
|
+
label: o.label,
|
|
955
|
+
description: o.description,
|
|
956
|
+
columns: o.columns || 1,
|
|
957
|
+
children: /* @__PURE__ */ t.jsx(
|
|
958
|
+
M,
|
|
959
|
+
{
|
|
960
|
+
schema: {
|
|
961
|
+
...s,
|
|
962
|
+
fields: A(o),
|
|
963
|
+
showSubmit: a === e.sections.length - 1 && s.showSubmit,
|
|
964
|
+
showCancel: a === e.sections.length - 1 && s.showCancel
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
)
|
|
968
|
+
},
|
|
969
|
+
o.name || o.label || a
|
|
970
|
+
)) }) : /* @__PURE__ */ t.jsx(
|
|
971
|
+
M,
|
|
972
|
+
{
|
|
973
|
+
schema: {
|
|
974
|
+
...s,
|
|
975
|
+
fields: b,
|
|
976
|
+
columns: e.columns
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
return /* @__PURE__ */ t.jsx(Te, { open: D, onOpenChange: e.onOpenChange, children: /* @__PURE__ */ t.jsxs(
|
|
981
|
+
Ce,
|
|
982
|
+
{
|
|
983
|
+
side: P,
|
|
984
|
+
className: V("overflow-y-auto", f, e.className),
|
|
985
|
+
style: q,
|
|
986
|
+
children: [
|
|
987
|
+
(e.title || e.description) && /* @__PURE__ */ t.jsxs(Ee, { children: [
|
|
988
|
+
e.title && /* @__PURE__ */ t.jsx(Oe, { children: e.title }),
|
|
989
|
+
e.description && /* @__PURE__ */ t.jsx(_e, { children: e.description })
|
|
990
|
+
] }),
|
|
991
|
+
/* @__PURE__ */ t.jsx("div", { className: "py-4", children: n() })
|
|
992
|
+
]
|
|
993
|
+
}
|
|
994
|
+
) });
|
|
995
|
+
}, fe = {
|
|
996
|
+
sm: "max-w-sm",
|
|
997
|
+
default: "max-w-lg",
|
|
998
|
+
lg: "max-w-2xl",
|
|
999
|
+
xl: "max-w-4xl",
|
|
1000
|
+
full: "max-w-[95vw] w-full"
|
|
1001
|
+
}, Ye = ({
|
|
1002
|
+
schema: e,
|
|
1003
|
+
dataSource: l,
|
|
1004
|
+
className: f
|
|
1005
|
+
}) => {
|
|
1006
|
+
const [d, w] = g(null), [b, T] = g([]), [E, S] = g({}), [C, j] = g(!0), [y, N] = g(null), D = e.open !== !1, P = fe[e.modalSize || "default"] || fe.default;
|
|
1007
|
+
W(() => {
|
|
1008
|
+
(async () => {
|
|
1009
|
+
if (!l) {
|
|
1010
|
+
j(!1);
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
try {
|
|
1014
|
+
const o = await l.getObjectSchema(e.objectName);
|
|
1015
|
+
w(o);
|
|
1016
|
+
} catch (o) {
|
|
1017
|
+
N(o), j(!1);
|
|
1018
|
+
}
|
|
1019
|
+
})();
|
|
1020
|
+
}, [e.objectName, l]), W(() => {
|
|
1021
|
+
(d || !l) && (async () => {
|
|
1022
|
+
if (e.mode === "create" || !e.recordId) {
|
|
1023
|
+
S(e.initialData || e.initialValues || {}), j(!1);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
if (!l) {
|
|
1027
|
+
S(e.initialData || e.initialValues || {}), j(!1);
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
try {
|
|
1031
|
+
const o = await l.findOne(e.objectName, e.recordId);
|
|
1032
|
+
S(o || {});
|
|
1033
|
+
} catch (o) {
|
|
1034
|
+
N(o);
|
|
1035
|
+
} finally {
|
|
1036
|
+
j(!1);
|
|
1037
|
+
}
|
|
1038
|
+
})();
|
|
1039
|
+
}, [d, e.mode, e.recordId, e.initialData, e.initialValues, l, e.objectName]);
|
|
1040
|
+
const A = k((n) => {
|
|
1041
|
+
const o = [];
|
|
1042
|
+
for (const a of n.fields) {
|
|
1043
|
+
const c = typeof a == "string" ? a : a.name;
|
|
1044
|
+
if (typeof a == "object")
|
|
1045
|
+
o.push(a);
|
|
1046
|
+
else if (d?.fields?.[c]) {
|
|
1047
|
+
const i = d.fields[c];
|
|
1048
|
+
o.push({
|
|
1049
|
+
name: c,
|
|
1050
|
+
label: i.label || c,
|
|
1051
|
+
type: U(i.type),
|
|
1052
|
+
required: i.required || !1,
|
|
1053
|
+
disabled: e.readOnly || e.mode === "view" || i.readonly,
|
|
1054
|
+
placeholder: i.placeholder,
|
|
1055
|
+
description: i.help || i.description,
|
|
1056
|
+
validation: Y(i),
|
|
1057
|
+
field: i,
|
|
1058
|
+
options: i.options,
|
|
1059
|
+
multiple: i.multiple
|
|
1060
|
+
});
|
|
1061
|
+
} else
|
|
1062
|
+
o.push({
|
|
1063
|
+
name: c,
|
|
1064
|
+
label: c,
|
|
1065
|
+
type: "input"
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
return o;
|
|
1069
|
+
}, [d, e.readOnly, e.mode]);
|
|
1070
|
+
W(() => {
|
|
1071
|
+
if (!d && l) return;
|
|
1072
|
+
if (e.customFields?.length) {
|
|
1073
|
+
T(e.customFields), j(!1);
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
if (e.sections?.length) {
|
|
1077
|
+
j(!1);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
if (!d) return;
|
|
1081
|
+
const n = e.fields || Object.keys(d.fields || {}), o = [];
|
|
1082
|
+
for (const a of n) {
|
|
1083
|
+
const c = typeof a == "string" ? a : a.name;
|
|
1084
|
+
if (!c) continue;
|
|
1085
|
+
const i = d.fields?.[c];
|
|
1086
|
+
i && o.push({
|
|
1087
|
+
name: c,
|
|
1088
|
+
label: i.label || c,
|
|
1089
|
+
type: U(i.type),
|
|
1090
|
+
required: i.required || !1,
|
|
1091
|
+
disabled: e.readOnly || e.mode === "view" || i.readonly,
|
|
1092
|
+
placeholder: i.placeholder,
|
|
1093
|
+
description: i.help || i.description,
|
|
1094
|
+
validation: Y(i),
|
|
1095
|
+
field: i,
|
|
1096
|
+
options: i.options,
|
|
1097
|
+
multiple: i.multiple
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
T(o), j(!1);
|
|
1101
|
+
}, [d, e.fields, e.customFields, e.sections, e.readOnly, e.mode, l]);
|
|
1102
|
+
const F = k(async (n) => {
|
|
1103
|
+
if (!l)
|
|
1104
|
+
return e.onSuccess && await e.onSuccess(n), e.onOpenChange?.(!1), n;
|
|
1105
|
+
try {
|
|
1106
|
+
let o;
|
|
1107
|
+
return e.mode === "create" ? o = await l.create(e.objectName, n) : e.mode === "edit" && e.recordId && (o = await l.update(e.objectName, e.recordId, n)), e.onSuccess && await e.onSuccess(o), e.onOpenChange?.(!1), o;
|
|
1108
|
+
} catch (o) {
|
|
1109
|
+
throw e.onError && e.onError(o), o;
|
|
1110
|
+
}
|
|
1111
|
+
}, [e, l]), _ = k(() => {
|
|
1112
|
+
e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
|
|
1113
|
+
}, [e]), u = {
|
|
1114
|
+
type: "form",
|
|
1115
|
+
layout: e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical",
|
|
1116
|
+
defaultValues: E,
|
|
1117
|
+
submitLabel: e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
1118
|
+
cancelLabel: e.cancelText,
|
|
1119
|
+
showSubmit: e.showSubmit !== !1 && e.mode !== "view",
|
|
1120
|
+
showCancel: e.showCancel !== !1,
|
|
1121
|
+
onSubmit: F,
|
|
1122
|
+
onCancel: _
|
|
1123
|
+
}, s = () => y ? /* @__PURE__ */ t.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
|
|
1124
|
+
/* @__PURE__ */ t.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading form" }),
|
|
1125
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-red-600 text-sm mt-1", children: y.message })
|
|
1126
|
+
] }) : C ? /* @__PURE__ */ t.jsxs("div", { className: "p-8 text-center", children: [
|
|
1127
|
+
/* @__PURE__ */ t.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
|
|
1128
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading form..." })
|
|
1129
|
+
] }) : e.sections?.length ? /* @__PURE__ */ t.jsx("div", { className: "space-y-6", children: e.sections.map((n, o) => /* @__PURE__ */ t.jsx(
|
|
1130
|
+
G,
|
|
1131
|
+
{
|
|
1132
|
+
label: n.label,
|
|
1133
|
+
description: n.description,
|
|
1134
|
+
columns: n.columns || 1,
|
|
1135
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1136
|
+
M,
|
|
1137
|
+
{
|
|
1138
|
+
schema: {
|
|
1139
|
+
...u,
|
|
1140
|
+
fields: A(n),
|
|
1141
|
+
showSubmit: o === e.sections.length - 1 && u.showSubmit,
|
|
1142
|
+
showCancel: o === e.sections.length - 1 && u.showCancel
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
},
|
|
1147
|
+
n.name || n.label || o
|
|
1148
|
+
)) }) : /* @__PURE__ */ t.jsx(
|
|
1149
|
+
M,
|
|
1150
|
+
{
|
|
1151
|
+
schema: {
|
|
1152
|
+
...u,
|
|
1153
|
+
fields: b,
|
|
1154
|
+
columns: e.columns
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
);
|
|
1158
|
+
return /* @__PURE__ */ t.jsx(Re, { open: D, onOpenChange: e.onOpenChange, children: /* @__PURE__ */ t.jsxs(De, { className: V(P, "max-h-[90vh] overflow-y-auto", f, e.className), children: [
|
|
1159
|
+
(e.title || e.description) && /* @__PURE__ */ t.jsxs(Fe, { children: [
|
|
1160
|
+
e.title && /* @__PURE__ */ t.jsx(ke, { children: e.title }),
|
|
1161
|
+
e.description && /* @__PURE__ */ t.jsx(Ie, { children: e.description })
|
|
1162
|
+
] }),
|
|
1163
|
+
/* @__PURE__ */ t.jsx("div", { className: "py-2", children: s() })
|
|
1164
|
+
] }) });
|
|
1165
|
+
}, Ue = ({
|
|
1166
|
+
schema: e,
|
|
1167
|
+
dataSource: l
|
|
1168
|
+
}) => {
|
|
1169
|
+
if (e.formType === "tabbed" && e.sections?.length)
|
|
1170
|
+
return /* @__PURE__ */ t.jsx(
|
|
1171
|
+
qe,
|
|
1172
|
+
{
|
|
1173
|
+
schema: {
|
|
1174
|
+
...e,
|
|
1175
|
+
formType: "tabbed",
|
|
1176
|
+
sections: e.sections.map((f) => ({
|
|
1177
|
+
name: f.name,
|
|
1178
|
+
label: f.label,
|
|
1179
|
+
description: f.description,
|
|
1180
|
+
columns: f.columns,
|
|
1181
|
+
fields: f.fields
|
|
1182
|
+
})),
|
|
1183
|
+
defaultTab: e.defaultTab,
|
|
1184
|
+
tabPosition: e.tabPosition
|
|
1185
|
+
},
|
|
1186
|
+
dataSource: l,
|
|
1187
|
+
className: e.className
|
|
1188
|
+
}
|
|
1189
|
+
);
|
|
1190
|
+
if (e.formType === "wizard" && e.sections?.length)
|
|
1191
|
+
return /* @__PURE__ */ t.jsx(
|
|
1192
|
+
We,
|
|
1193
|
+
{
|
|
1194
|
+
schema: {
|
|
1195
|
+
...e,
|
|
1196
|
+
formType: "wizard",
|
|
1197
|
+
sections: e.sections.map((f) => ({
|
|
1198
|
+
name: f.name,
|
|
1199
|
+
label: f.label,
|
|
1200
|
+
description: f.description,
|
|
1201
|
+
columns: f.columns,
|
|
1202
|
+
fields: f.fields
|
|
1203
|
+
})),
|
|
1204
|
+
allowSkip: e.allowSkip,
|
|
1205
|
+
showStepIndicator: e.showStepIndicator,
|
|
1206
|
+
nextText: e.nextText,
|
|
1207
|
+
prevText: e.prevText,
|
|
1208
|
+
onStepChange: e.onStepChange
|
|
1209
|
+
},
|
|
1210
|
+
dataSource: l,
|
|
1211
|
+
className: e.className
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
if (e.formType === "split" && e.sections?.length)
|
|
1215
|
+
return /* @__PURE__ */ t.jsx(
|
|
1216
|
+
$e,
|
|
1217
|
+
{
|
|
1218
|
+
schema: {
|
|
1219
|
+
...e,
|
|
1220
|
+
formType: "split",
|
|
1221
|
+
sections: e.sections.map((f) => ({
|
|
1222
|
+
name: f.name,
|
|
1223
|
+
label: f.label,
|
|
1224
|
+
description: f.description,
|
|
1225
|
+
columns: f.columns,
|
|
1226
|
+
fields: f.fields
|
|
1227
|
+
})),
|
|
1228
|
+
splitDirection: e.splitDirection,
|
|
1229
|
+
splitSize: e.splitSize,
|
|
1230
|
+
splitResizable: e.splitResizable
|
|
1231
|
+
},
|
|
1232
|
+
dataSource: l,
|
|
1233
|
+
className: e.className
|
|
1234
|
+
}
|
|
1235
|
+
);
|
|
1236
|
+
if (e.formType === "drawer") {
|
|
1237
|
+
const { layout: f, ...d } = e, w = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : void 0;
|
|
1238
|
+
return /* @__PURE__ */ t.jsx(
|
|
1239
|
+
Me,
|
|
1240
|
+
{
|
|
1241
|
+
schema: {
|
|
1242
|
+
...d,
|
|
1243
|
+
layout: w,
|
|
1244
|
+
formType: "drawer",
|
|
1245
|
+
sections: e.sections?.map((b) => ({
|
|
1246
|
+
name: b.name,
|
|
1247
|
+
label: b.label,
|
|
1248
|
+
description: b.description,
|
|
1249
|
+
columns: b.columns,
|
|
1250
|
+
fields: b.fields
|
|
1251
|
+
})),
|
|
1252
|
+
open: e.open,
|
|
1253
|
+
onOpenChange: e.onOpenChange,
|
|
1254
|
+
drawerSide: e.drawerSide,
|
|
1255
|
+
drawerWidth: e.drawerWidth
|
|
1256
|
+
},
|
|
1257
|
+
dataSource: l,
|
|
1258
|
+
className: e.className
|
|
1259
|
+
}
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
if (e.formType === "modal") {
|
|
1263
|
+
const { layout: f, ...d } = e, w = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : void 0;
|
|
1264
|
+
return /* @__PURE__ */ t.jsx(
|
|
1265
|
+
Ye,
|
|
1266
|
+
{
|
|
1267
|
+
schema: {
|
|
1268
|
+
...d,
|
|
1269
|
+
layout: w,
|
|
1270
|
+
formType: "modal",
|
|
1271
|
+
sections: e.sections?.map((b) => ({
|
|
1272
|
+
name: b.name,
|
|
1273
|
+
label: b.label,
|
|
1274
|
+
description: b.description,
|
|
1275
|
+
columns: b.columns,
|
|
1276
|
+
fields: b.fields
|
|
1277
|
+
})),
|
|
1278
|
+
open: e.open,
|
|
1279
|
+
onOpenChange: e.onOpenChange,
|
|
1280
|
+
modalSize: e.modalSize,
|
|
1281
|
+
modalCloseButton: e.modalCloseButton
|
|
1282
|
+
},
|
|
1283
|
+
dataSource: l,
|
|
1284
|
+
className: e.className
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
return /* @__PURE__ */ t.jsx(He, { schema: e, dataSource: l });
|
|
1289
|
+
}, He = ({
|
|
1290
|
+
schema: e,
|
|
1291
|
+
dataSource: l
|
|
1292
|
+
}) => {
|
|
1293
|
+
const [f, d] = g(null), [w, b] = g([]), [T, E] = g(null), [S, C] = g(!0), [j, y] = g(null), N = e.customFields && e.customFields.length > 0;
|
|
1294
|
+
W(() => {
|
|
1295
|
+
N && (E(e.initialData || e.initialValues || {}), C(!1));
|
|
1296
|
+
}, [N, e.initialData, e.initialValues]), W(() => {
|
|
1297
|
+
const u = async () => {
|
|
1298
|
+
try {
|
|
1299
|
+
if (!l)
|
|
276
1300
|
throw new Error("DataSource is required when using ObjectQL schema fetching (inline fields not provided)");
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
1301
|
+
const s = await l.getObjectSchema(e.objectName);
|
|
1302
|
+
if (!s)
|
|
1303
|
+
throw new Error(`No schema found for object "${e.objectName}"`);
|
|
1304
|
+
d(s);
|
|
1305
|
+
} catch (s) {
|
|
1306
|
+
y(s), C(!1);
|
|
281
1307
|
}
|
|
282
1308
|
};
|
|
283
|
-
|
|
284
|
-
name:
|
|
1309
|
+
N ? d({
|
|
1310
|
+
name: e.objectName,
|
|
285
1311
|
fields: {}
|
|
286
|
-
}) :
|
|
287
|
-
}, [
|
|
288
|
-
f && !
|
|
289
|
-
if (!
|
|
290
|
-
|
|
1312
|
+
}) : e.objectName && l ? u() : N || C(!1);
|
|
1313
|
+
}, [e.objectName, l, N]), W(() => {
|
|
1314
|
+
f && !N && (async () => {
|
|
1315
|
+
if (!e.recordId || e.mode === "create") {
|
|
1316
|
+
E(e.initialData || e.initialValues || {}), C(!1);
|
|
291
1317
|
return;
|
|
292
1318
|
}
|
|
293
|
-
if (!
|
|
294
|
-
if (!
|
|
295
|
-
|
|
1319
|
+
if (!N) {
|
|
1320
|
+
if (!l) {
|
|
1321
|
+
y(new Error("DataSource is required for fetching record data (inline data not provided)")), C(!1);
|
|
296
1322
|
return;
|
|
297
1323
|
}
|
|
298
|
-
|
|
1324
|
+
C(!0);
|
|
299
1325
|
try {
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
} catch (
|
|
303
|
-
console.error("Failed to fetch record:",
|
|
1326
|
+
const s = await l.findOne(e.objectName, e.recordId);
|
|
1327
|
+
E(s);
|
|
1328
|
+
} catch (s) {
|
|
1329
|
+
console.error("Failed to fetch record:", s), y(s);
|
|
304
1330
|
} finally {
|
|
305
|
-
|
|
1331
|
+
C(!1);
|
|
306
1332
|
}
|
|
307
1333
|
}
|
|
308
1334
|
})();
|
|
309
|
-
}, [
|
|
310
|
-
if (
|
|
311
|
-
b(
|
|
1335
|
+
}, [e.objectName, e.recordId, e.mode, e.initialValues, e.initialData, l, f, N]), W(() => {
|
|
1336
|
+
if (N && e.customFields) {
|
|
1337
|
+
b(e.customFields), C(!1);
|
|
312
1338
|
return;
|
|
313
1339
|
}
|
|
314
1340
|
if (!f) return;
|
|
315
|
-
const
|
|
316
|
-
(Array.isArray(
|
|
317
|
-
const
|
|
318
|
-
if (!
|
|
319
|
-
const
|
|
320
|
-
if (!
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
else if (
|
|
327
|
-
const
|
|
328
|
-
name:
|
|
329
|
-
label:
|
|
330
|
-
type:
|
|
331
|
-
required:
|
|
332
|
-
disabled:
|
|
333
|
-
placeholder:
|
|
334
|
-
description:
|
|
335
|
-
validation:
|
|
1341
|
+
const u = [], s = e.fields || Object.keys(f.fields || {});
|
|
1342
|
+
(Array.isArray(s) ? s : Object.keys(s)).forEach((a) => {
|
|
1343
|
+
const c = typeof a == "string" ? a : a.name;
|
|
1344
|
+
if (!c) return;
|
|
1345
|
+
const i = f.fields?.[c];
|
|
1346
|
+
if (!i && !N) return;
|
|
1347
|
+
const v = !i?.permissions || i?.permissions.write !== !1;
|
|
1348
|
+
if (e.mode !== "view" && !v) return;
|
|
1349
|
+
const $ = e.customFields?.find((p) => p.name === c);
|
|
1350
|
+
if ($)
|
|
1351
|
+
u.push($);
|
|
1352
|
+
else if (i) {
|
|
1353
|
+
const p = {
|
|
1354
|
+
name: c,
|
|
1355
|
+
label: i.label || a,
|
|
1356
|
+
type: U(i.type),
|
|
1357
|
+
required: i.required || !1,
|
|
1358
|
+
disabled: e.readOnly || e.mode === "view" || i.readonly,
|
|
1359
|
+
placeholder: i.placeholder,
|
|
1360
|
+
description: i.help || i.description,
|
|
1361
|
+
validation: Y(i),
|
|
336
1362
|
// Important: Pass the original field metadata so widgets can access properties like precision, currency, etc.
|
|
337
|
-
field:
|
|
1363
|
+
field: i
|
|
338
1364
|
};
|
|
339
|
-
if ((
|
|
340
|
-
const
|
|
341
|
-
|
|
1365
|
+
if ((i.type === "select" || i.type === "lookup" || i.type === "master_detail") && (p.options = i.options || [], p.multiple = i.multiple), (i.type === "number" || i.type === "currency" || i.type === "percent") && (p.inputType = "number", p.min = i.min, p.max = i.max, p.step = i.precision ? Math.pow(10, -i.precision) : void 0), i.type === "date" && (p.inputType = "date"), i.type === "datetime" && (p.inputType = "datetime-local"), (i.type === "text" || i.type === "textarea" || i.type === "markdown" || i.type === "html") && (p.maxLength = i.max_length, p.minLength = i.min_length), (i.type === "file" || i.type === "image") && (p.inputType = "file", p.multiple = i.multiple, p.accept = i.accept ? i.accept.join(",") : void 0, i.max_size)) {
|
|
1366
|
+
const x = `Max size: ${ye(i.max_size)}`;
|
|
1367
|
+
p.description = p.description ? `${p.description} (${x})` : x;
|
|
342
1368
|
}
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
}), b(
|
|
346
|
-
}, [f,
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
return
|
|
350
|
-
if (!
|
|
1369
|
+
i.type === "email" && (p.inputType = "email"), i.type === "phone" && (p.inputType = "tel"), i.type === "url" && (p.inputType = "url"), i.type === "password" && (p.inputType = "password"), i.type === "time" && (p.inputType = "time"), (i.type === "formula" || i.type === "summary" || i.type === "auto_number") && (p.disabled = !0), i.visible_on && (p.visible = (x) => xe(i.visible_on, x)), u.push(p);
|
|
1370
|
+
}
|
|
1371
|
+
}), b(u), !N && e.recordId && e.mode !== "create" && l || C(!1);
|
|
1372
|
+
}, [f, e.fields, e.customFields, e.readOnly, e.mode, N, e.recordId, l]);
|
|
1373
|
+
const D = k(async (u, s) => {
|
|
1374
|
+
if (u && (u.nativeEvent || u._reactName === "onSubmit") && (console.warn("ObjectForm: Received Event instead of data in handleSubmit! This suggests a Form renderer issue."), s === void 0 && (s = u, u = {})), N && !l)
|
|
1375
|
+
return e.onSuccess && await e.onSuccess(u), u;
|
|
1376
|
+
if (!l)
|
|
351
1377
|
throw new Error("DataSource is required for form submission (inline mode not configured)");
|
|
352
1378
|
try {
|
|
353
|
-
let
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
else if (
|
|
357
|
-
|
|
1379
|
+
let n;
|
|
1380
|
+
if (e.mode === "create")
|
|
1381
|
+
n = await l.create(e.objectName, u);
|
|
1382
|
+
else if (e.mode === "edit" && e.recordId)
|
|
1383
|
+
n = await l.update(e.objectName, e.recordId, u);
|
|
358
1384
|
else
|
|
359
1385
|
throw new Error("Invalid form mode or missing record ID");
|
|
360
|
-
return
|
|
361
|
-
} catch (
|
|
362
|
-
throw console.error("Failed to submit form:",
|
|
363
|
-
}
|
|
364
|
-
}, [
|
|
365
|
-
|
|
366
|
-
}, [
|
|
367
|
-
...
|
|
1386
|
+
return e.onSuccess && await e.onSuccess(n), n;
|
|
1387
|
+
} catch (n) {
|
|
1388
|
+
throw console.error("Failed to submit form:", n), e.onError && e.onError(n), n;
|
|
1389
|
+
}
|
|
1390
|
+
}, [e, l, N]), P = k(() => {
|
|
1391
|
+
e.onCancel && e.onCancel();
|
|
1392
|
+
}, [e]), F = {
|
|
1393
|
+
...J.useMemo(() => {
|
|
368
1394
|
if (!f?.fields) return {};
|
|
369
|
-
const
|
|
370
|
-
return Object.keys(f.fields).forEach((
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
}),
|
|
1395
|
+
const u = {};
|
|
1396
|
+
return Object.keys(f.fields).forEach((s) => {
|
|
1397
|
+
const n = f.fields[s];
|
|
1398
|
+
n.defaultValue !== void 0 && (u[s] = n.defaultValue);
|
|
1399
|
+
}), u;
|
|
374
1400
|
}, [f]),
|
|
375
1401
|
...T
|
|
376
1402
|
};
|
|
377
|
-
if (
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
1403
|
+
if (j)
|
|
1404
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md", children: [
|
|
1405
|
+
/* @__PURE__ */ t.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading form" }),
|
|
1406
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-red-600 text-sm mt-1", children: j.message })
|
|
381
1407
|
] });
|
|
382
|
-
if (
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
1408
|
+
if (S)
|
|
1409
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "p-4 sm:p-8 text-center", children: [
|
|
1410
|
+
/* @__PURE__ */ t.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
|
|
1411
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading form..." })
|
|
386
1412
|
] });
|
|
387
|
-
const
|
|
1413
|
+
const _ = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical";
|
|
1414
|
+
if (e.sections?.length && (!e.formType || e.formType === "simple"))
|
|
1415
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-full space-y-6", children: e.sections.map((u, s) => {
|
|
1416
|
+
const n = u.fields.map((a) => typeof a == "string" ? a : a.name), o = w.filter((a) => n.includes(a.name));
|
|
1417
|
+
return /* @__PURE__ */ t.jsx(
|
|
1418
|
+
G,
|
|
1419
|
+
{
|
|
1420
|
+
label: u.label,
|
|
1421
|
+
description: u.description,
|
|
1422
|
+
collapsible: u.collapsible,
|
|
1423
|
+
collapsed: u.collapsed,
|
|
1424
|
+
columns: u.columns,
|
|
1425
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1426
|
+
M,
|
|
1427
|
+
{
|
|
1428
|
+
schema: {
|
|
1429
|
+
type: "form",
|
|
1430
|
+
fields: o,
|
|
1431
|
+
layout: _,
|
|
1432
|
+
defaultValues: F,
|
|
1433
|
+
// Only show action buttons after the last section
|
|
1434
|
+
showSubmit: s === e.sections.length - 1 && e.showSubmit !== !1 && e.mode !== "view",
|
|
1435
|
+
showCancel: s === e.sections.length - 1 && e.showCancel !== !1,
|
|
1436
|
+
submitLabel: e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
1437
|
+
cancelLabel: e.cancelText,
|
|
1438
|
+
onSubmit: D,
|
|
1439
|
+
onCancel: P
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
)
|
|
1443
|
+
},
|
|
1444
|
+
u.name || u.label || s
|
|
1445
|
+
);
|
|
1446
|
+
}) });
|
|
1447
|
+
const q = {
|
|
388
1448
|
type: "form",
|
|
389
|
-
fields:
|
|
390
|
-
layout:
|
|
391
|
-
columns:
|
|
392
|
-
submitLabel:
|
|
393
|
-
cancelLabel:
|
|
394
|
-
showSubmit:
|
|
395
|
-
showCancel:
|
|
396
|
-
resetOnSubmit:
|
|
397
|
-
defaultValues:
|
|
398
|
-
onSubmit:
|
|
399
|
-
onCancel:
|
|
400
|
-
className:
|
|
1449
|
+
fields: w,
|
|
1450
|
+
layout: _,
|
|
1451
|
+
columns: e.columns,
|
|
1452
|
+
submitLabel: e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
1453
|
+
cancelLabel: e.cancelText,
|
|
1454
|
+
showSubmit: e.showSubmit !== !1 && e.mode !== "view",
|
|
1455
|
+
showCancel: e.showCancel !== !1,
|
|
1456
|
+
resetOnSubmit: e.showReset,
|
|
1457
|
+
defaultValues: F,
|
|
1458
|
+
onSubmit: D,
|
|
1459
|
+
onCancel: P,
|
|
1460
|
+
className: e.className
|
|
401
1461
|
};
|
|
402
|
-
return /* @__PURE__ */
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
namespace: "plugin-form"
|
|
1462
|
+
return /* @__PURE__ */ t.jsx("div", { className: "w-full", children: /* @__PURE__ */ t.jsx(M, { schema: q }) });
|
|
1463
|
+
}, be = ({ schema: e }) => /* @__PURE__ */ t.jsx(Ue, { schema: e });
|
|
1464
|
+
ue.register("object-form", be, {
|
|
1465
|
+
namespace: "plugin-form",
|
|
1466
|
+
label: "Object Form",
|
|
1467
|
+
category: "plugin",
|
|
1468
|
+
inputs: [
|
|
1469
|
+
{ name: "objectName", type: "string", label: "Object Name", required: !0 },
|
|
1470
|
+
{ name: "fields", type: "array", label: "Fields" },
|
|
1471
|
+
{ name: "mode", type: "enum", label: "Mode", enum: ["create", "edit", "view"] },
|
|
1472
|
+
{ name: "formType", type: "enum", label: "Form Type", enum: ["simple", "tabbed", "wizard", "split", "drawer", "modal"] },
|
|
1473
|
+
{ name: "sections", type: "array", label: "Sections" },
|
|
1474
|
+
{ name: "title", type: "string", label: "Title" },
|
|
1475
|
+
{ name: "description", type: "string", label: "Description" },
|
|
1476
|
+
{ name: "layout", type: "enum", label: "Layout", enum: ["vertical", "horizontal", "inline", "grid"] },
|
|
1477
|
+
{ name: "columns", type: "number", label: "Columns" },
|
|
1478
|
+
// Tabbed
|
|
1479
|
+
{ name: "defaultTab", type: "string", label: "Default Tab" },
|
|
1480
|
+
{ name: "tabPosition", type: "enum", label: "Tab Position", enum: ["top", "bottom", "left", "right"] },
|
|
1481
|
+
// Wizard
|
|
1482
|
+
{ name: "allowSkip", type: "boolean", label: "Allow Skip Steps" },
|
|
1483
|
+
{ name: "showStepIndicator", type: "boolean", label: "Show Step Indicator" },
|
|
1484
|
+
// Split
|
|
1485
|
+
{ name: "splitDirection", type: "enum", label: "Split Direction", enum: ["horizontal", "vertical"] },
|
|
1486
|
+
{ name: "splitSize", type: "number", label: "Split Panel Size (%)" },
|
|
1487
|
+
{ name: "splitResizable", type: "boolean", label: "Split Resizable" },
|
|
1488
|
+
// Drawer
|
|
1489
|
+
{ name: "drawerSide", type: "enum", label: "Drawer Side", enum: ["top", "bottom", "left", "right"] },
|
|
1490
|
+
{ name: "drawerWidth", type: "string", label: "Drawer Width" },
|
|
1491
|
+
// Modal
|
|
1492
|
+
{ name: "modalSize", type: "enum", label: "Modal Size", enum: ["sm", "default", "lg", "xl", "full"] }
|
|
1493
|
+
]
|
|
1494
|
+
});
|
|
1495
|
+
ue.register("form", be, {
|
|
1496
|
+
namespace: "view",
|
|
1497
|
+
skipFallback: !0,
|
|
1498
|
+
label: "Data Form View",
|
|
1499
|
+
category: "view",
|
|
1500
|
+
inputs: [
|
|
1501
|
+
{ name: "objectName", type: "string", label: "Object Name", required: !0 },
|
|
1502
|
+
{ name: "fields", type: "array", label: "Fields" },
|
|
1503
|
+
{ name: "mode", type: "enum", label: "Mode", enum: ["create", "edit", "view"] }
|
|
1504
|
+
]
|
|
406
1505
|
});
|
|
407
1506
|
export {
|
|
408
|
-
|
|
1507
|
+
Me as DrawerForm,
|
|
1508
|
+
G as FormSection,
|
|
1509
|
+
Ye as ModalForm,
|
|
1510
|
+
Ue as ObjectForm,
|
|
1511
|
+
$e as SplitForm,
|
|
1512
|
+
qe as TabbedForm,
|
|
1513
|
+
We as WizardForm
|
|
409
1514
|
};
|