@cervio/plugin-sdk 2.1.2 → 2.3.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/README.md +62 -0
- package/dist/forms/index.d.ts +360 -0
- package/dist/forms/index.js +416 -0
- package/dist/forms/react.d.ts +381 -0
- package/dist/forms/react.js +1159 -0
- package/dist/index.d.ts +75 -2
- package/dist/views/index.d.ts +450 -0
- package/dist/views/index.js +570 -0
- package/dist/views/react.d.ts +406 -0
- package/dist/views/react.js +1368 -0
- package/package.json +22 -2
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
// ../form-core/dist/index.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
var FormApiError = class extends Error {
|
|
6
|
+
constructor(status, code, message, field) {
|
|
7
|
+
super(message);
|
|
8
|
+
__publicField(this, "status", status);
|
|
9
|
+
__publicField(this, "code", code);
|
|
10
|
+
__publicField(this, "field", field);
|
|
11
|
+
this.name = "FormApiError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function createFetchTransport(opts = {}) {
|
|
15
|
+
const base = (opts.baseUrl ?? "").replace(/\/$/, "");
|
|
16
|
+
const doFetch = opts.fetchImpl ?? ((...a) => fetch(...a));
|
|
17
|
+
const e = encodeURIComponent;
|
|
18
|
+
async function call(path, init = {}) {
|
|
19
|
+
const res = await doFetch(`${base}/api/v1${path}`, {
|
|
20
|
+
method: init.method ?? (init.body !== void 0 ? "POST" : "GET"),
|
|
21
|
+
credentials: opts.credentials ?? "include",
|
|
22
|
+
signal: init.signal,
|
|
23
|
+
headers: {
|
|
24
|
+
Accept: "application/json",
|
|
25
|
+
...init.body !== void 0 ? { "Content-Type": "application/json" } : {},
|
|
26
|
+
...opts.headers
|
|
27
|
+
},
|
|
28
|
+
...init.body !== void 0 ? { body: JSON.stringify(init.body) } : {}
|
|
29
|
+
});
|
|
30
|
+
let body = null;
|
|
31
|
+
try {
|
|
32
|
+
body = await res.json();
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
if (!res.ok) {
|
|
36
|
+
const b = body ?? {};
|
|
37
|
+
throw new FormApiError(res.status, b.error ?? `http_${res.status}`, b.message ?? b.error ?? res.statusText, b.field);
|
|
38
|
+
}
|
|
39
|
+
return body;
|
|
40
|
+
}
|
|
41
|
+
const UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
42
|
+
const ids = /* @__PURE__ */ new Map();
|
|
43
|
+
const idOf = (entity) => {
|
|
44
|
+
if (UUID_RE2.test(entity)) return Promise.resolve(entity);
|
|
45
|
+
let p = ids.get(entity);
|
|
46
|
+
if (!p) {
|
|
47
|
+
p = call(`/entities/${e(entity)}`).then((r) => r.entity.id);
|
|
48
|
+
p.catch(() => ids.delete(entity));
|
|
49
|
+
ids.set(entity, p);
|
|
50
|
+
}
|
|
51
|
+
return p;
|
|
52
|
+
};
|
|
53
|
+
const loc = opts.locale ? `&locale=${e(opts.locale)}` : "";
|
|
54
|
+
const formPath = async (entity, form) => `/entities/${e(await idOf(entity))}/forms/${e(form)}`;
|
|
55
|
+
const recordsPath = async (entity) => `/entities/${e(await idOf(entity))}/records`;
|
|
56
|
+
return {
|
|
57
|
+
getSchema: async (entityId, form, signal) => call(`${await formPath(entityId, form)}/write-schema?include=layout${loc}`, { signal }),
|
|
58
|
+
// `layout_state`: hidden blocks and field variants; older hosts ignore it.
|
|
59
|
+
validateDraft: async (entityId, form, data, recordId, signal) => call(`${await formPath(entityId, form)}/validate-draft?include=layout_state${loc}`, {
|
|
60
|
+
body: { data, ...recordId ? { record_id: recordId } : {} },
|
|
61
|
+
signal
|
|
62
|
+
}),
|
|
63
|
+
getRecord: async (entityId, recordId, signal) => {
|
|
64
|
+
const r = await call(`${await recordsPath(entityId)}/${e(recordId)}`, { signal });
|
|
65
|
+
return r.record;
|
|
66
|
+
},
|
|
67
|
+
createRecord: async (entityId, form, data) => call(await recordsPath(entityId), { body: { data, form_name: form } }),
|
|
68
|
+
updateRecord: async (entityId, form, recordId, data, expectedUpdatedAt) => {
|
|
69
|
+
await call(`${await recordsPath(entityId)}/${e(recordId)}`, {
|
|
70
|
+
method: "PATCH",
|
|
71
|
+
body: { data, form_name: form, ...expectedUpdatedAt ? { expected_updated_at: expectedUpdatedAt } : {} }
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
fieldOptions: async (entityId, form, field, data) => {
|
|
75
|
+
const path = `${await formPath(entityId, form)}/fields/${e(field)}/options${opts.locale ? `?locale=${e(opts.locale)}` : ""}`;
|
|
76
|
+
return data ? call(path, { body: { data } }) : call(path);
|
|
77
|
+
},
|
|
78
|
+
relationOptions: async (entityId, form, field, q, limit = 20) => call(`${await formPath(entityId, form)}/fields/${e(field)}/relation-options?q=${e(q)}&limit=${limit}`)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var EMPTY_STATE = {
|
|
82
|
+
status: "loading",
|
|
83
|
+
error: null,
|
|
84
|
+
schema: null,
|
|
85
|
+
layout: null,
|
|
86
|
+
fields: {},
|
|
87
|
+
mode: "create",
|
|
88
|
+
recordId: null,
|
|
89
|
+
updatedAt: null,
|
|
90
|
+
values: {},
|
|
91
|
+
dirty: [],
|
|
92
|
+
touched: [],
|
|
93
|
+
fieldState: {},
|
|
94
|
+
errors: {},
|
|
95
|
+
draftErrors: {},
|
|
96
|
+
validating: false,
|
|
97
|
+
saving: false,
|
|
98
|
+
saveError: null,
|
|
99
|
+
conflict: false,
|
|
100
|
+
submitted: false,
|
|
101
|
+
relationLabels: {},
|
|
102
|
+
hiddenBlocks: [],
|
|
103
|
+
blockedSteps: [],
|
|
104
|
+
fieldDisplay: {}
|
|
105
|
+
};
|
|
106
|
+
function fieldDisplayFor(state, field, nodeId) {
|
|
107
|
+
const own = nodeId ? state.fieldDisplay[nodeId] : void 0;
|
|
108
|
+
if (own?.field === field) return own;
|
|
109
|
+
return Object.values(state.fieldDisplay).find((d) => d.field === field);
|
|
110
|
+
}
|
|
111
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
112
|
+
function asError(e) {
|
|
113
|
+
return e instanceof Error ? e : new Error(String(e));
|
|
114
|
+
}
|
|
115
|
+
function isEmpty(v) {
|
|
116
|
+
return v == null || v === "" || Array.isArray(v) && v.length === 0;
|
|
117
|
+
}
|
|
118
|
+
function sameValue(a, b) {
|
|
119
|
+
if (isEmpty(a) && isEmpty(b)) return true;
|
|
120
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
121
|
+
}
|
|
122
|
+
function flatLayout(fields) {
|
|
123
|
+
return {
|
|
124
|
+
version: 1,
|
|
125
|
+
children: [...fields].sort((a, b) => a.order - b.order || a.name.localeCompare(b.name)).map((f) => ({ type: "field", field: f.name }))
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function relationIds(v) {
|
|
129
|
+
if (Array.isArray(v)) return v.filter((x) => typeof x === "string" && UUID_RE.test(x));
|
|
130
|
+
return typeof v === "string" && UUID_RE.test(v) ? [v] : [];
|
|
131
|
+
}
|
|
132
|
+
function createFormController(opts) {
|
|
133
|
+
const { transport, entity, form } = opts;
|
|
134
|
+
const debounceMs = opts.validateDebounceMs ?? 300;
|
|
135
|
+
const requiredMessage = opts.requiredMessage ?? "Campo obbligatorio";
|
|
136
|
+
let state = { ...EMPTY_STATE, mode: opts.recordId ? "edit" : "create", recordId: opts.recordId ?? null };
|
|
137
|
+
let baseline = {};
|
|
138
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
139
|
+
let destroyed = false;
|
|
140
|
+
let timer = null;
|
|
141
|
+
let draftSeq = 0;
|
|
142
|
+
function set(patch) {
|
|
143
|
+
if (destroyed) return;
|
|
144
|
+
state = { ...state, ...patch };
|
|
145
|
+
for (const l of listeners) l(state);
|
|
146
|
+
}
|
|
147
|
+
function shownErrors(draft, touched, submitted) {
|
|
148
|
+
if (submitted) return draft;
|
|
149
|
+
const out = {};
|
|
150
|
+
for (const f of touched) if (draft[f]) out[f] = draft[f];
|
|
151
|
+
return out;
|
|
152
|
+
}
|
|
153
|
+
function writable(name) {
|
|
154
|
+
const f = state.fields[name];
|
|
155
|
+
if (!f) return false;
|
|
156
|
+
const fs = state.fieldState[name];
|
|
157
|
+
return !(fs?.readonly ?? f.readonly) && f.server_filled !== "computed";
|
|
158
|
+
}
|
|
159
|
+
function writableValues() {
|
|
160
|
+
const out = {};
|
|
161
|
+
for (const [k, v] of Object.entries(state.values)) if (writable(k)) out[k] = v;
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
function applyDraft(r) {
|
|
165
|
+
const values = { ...state.values };
|
|
166
|
+
const resolved = r.resolved_data ?? {};
|
|
167
|
+
for (const [name, kind] of Object.entries(r.server_filled ?? {})) {
|
|
168
|
+
if (!(name in resolved)) continue;
|
|
169
|
+
if (kind === "computed" || kind === "default" && state.mode === "create" && !state.dirty.includes(name) && isEmpty(values[name])) {
|
|
170
|
+
values[name] = resolved[name];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const draftErrors = {};
|
|
174
|
+
for (const e of r.errors ?? []) if (e.field && !draftErrors[e.field]) draftErrors[e.field] = e.message;
|
|
175
|
+
const fieldState = { ...state.fieldState, ...r.field_state ?? {} };
|
|
176
|
+
for (const [name, f] of Object.entries(state.fields)) {
|
|
177
|
+
const fs = fieldState[name] ?? { visible: true, required: f.required, readonly: f.readonly };
|
|
178
|
+
if (draftErrors[name] || !fs.visible || !fs.required || fs.readonly || f.server_filled) continue;
|
|
179
|
+
if (isEmpty(values[name])) draftErrors[name] = requiredMessage;
|
|
180
|
+
}
|
|
181
|
+
set({
|
|
182
|
+
values,
|
|
183
|
+
fieldState,
|
|
184
|
+
hiddenBlocks: r.hidden_blocks ?? [],
|
|
185
|
+
blockedSteps: r.blocked_steps ?? [],
|
|
186
|
+
fieldDisplay: r.field_display ?? {},
|
|
187
|
+
draftErrors,
|
|
188
|
+
errors: shownErrors(draftErrors, state.touched, state.submitted)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function runDraft() {
|
|
192
|
+
if (timer) {
|
|
193
|
+
clearTimeout(timer);
|
|
194
|
+
timer = null;
|
|
195
|
+
}
|
|
196
|
+
const my = ++draftSeq;
|
|
197
|
+
set({ validating: true });
|
|
198
|
+
const p = transport.validateDraft(entity, form, writableValues(), state.recordId).then((r) => {
|
|
199
|
+
if (my !== draftSeq || destroyed) return r.ok;
|
|
200
|
+
applyDraft(r);
|
|
201
|
+
set({ validating: timer != null });
|
|
202
|
+
return r.ok;
|
|
203
|
+
}).catch((e) => {
|
|
204
|
+
if (my === draftSeq) set({ validating: false, saveError: asError(e) });
|
|
205
|
+
return false;
|
|
206
|
+
});
|
|
207
|
+
return p;
|
|
208
|
+
}
|
|
209
|
+
function scheduleDraft() {
|
|
210
|
+
if (timer) clearTimeout(timer);
|
|
211
|
+
set({ validating: true });
|
|
212
|
+
timer = setTimeout(() => {
|
|
213
|
+
timer = null;
|
|
214
|
+
void runDraft();
|
|
215
|
+
}, debounceMs);
|
|
216
|
+
}
|
|
217
|
+
async function loadRelationLabels(values) {
|
|
218
|
+
const out = { ...state.relationLabels };
|
|
219
|
+
await Promise.all(
|
|
220
|
+
Object.values(state.fields).filter((f) => f.input?.mode === "relation").map(async (f) => {
|
|
221
|
+
const ids = relationIds(values[f.name]).filter((id) => !out[f.name]?.[id]);
|
|
222
|
+
if (!ids.length) return;
|
|
223
|
+
const found = await Promise.all(
|
|
224
|
+
ids.map((id) => transport.relationOptions(entity, form, f.name, id, 1).then((r) => r.records).catch(() => []))
|
|
225
|
+
);
|
|
226
|
+
out[f.name] = { ...out[f.name] ?? {} };
|
|
227
|
+
for (const r of found.flat()) out[f.name][r.id] = r.label;
|
|
228
|
+
})
|
|
229
|
+
);
|
|
230
|
+
set({ relationLabels: out });
|
|
231
|
+
}
|
|
232
|
+
async function loadRecord() {
|
|
233
|
+
if (!state.recordId) return;
|
|
234
|
+
const rec = await transport.getRecord(entity, state.recordId);
|
|
235
|
+
const values = {};
|
|
236
|
+
for (const name of Object.keys(state.fields)) values[name] = rec.data[name] ?? null;
|
|
237
|
+
baseline = values;
|
|
238
|
+
set({ values, updatedAt: rec.updated_at ?? null, dirty: [], conflict: false, saveError: null });
|
|
239
|
+
await loadRelationLabels(values);
|
|
240
|
+
}
|
|
241
|
+
const ready = (async () => {
|
|
242
|
+
try {
|
|
243
|
+
const schema = await transport.getSchema(entity, form);
|
|
244
|
+
const fields = {};
|
|
245
|
+
const fieldState = {};
|
|
246
|
+
for (const f of schema.fields) {
|
|
247
|
+
fields[f.name] = f;
|
|
248
|
+
fieldState[f.name] = { visible: true, required: f.required, readonly: f.readonly };
|
|
249
|
+
}
|
|
250
|
+
set({ schema, fields, fieldState, layout: schema.layout ?? flatLayout(schema.fields) });
|
|
251
|
+
if (state.recordId) {
|
|
252
|
+
await loadRecord();
|
|
253
|
+
} else {
|
|
254
|
+
const values = {};
|
|
255
|
+
for (const f of schema.fields) values[f.name] = opts.initialValues?.[f.name] ?? null;
|
|
256
|
+
baseline = values;
|
|
257
|
+
set({ values });
|
|
258
|
+
await loadRelationLabels(values);
|
|
259
|
+
}
|
|
260
|
+
await runDraft();
|
|
261
|
+
set({ status: "ready" });
|
|
262
|
+
} catch (e) {
|
|
263
|
+
set({ status: "error", error: asError(e) });
|
|
264
|
+
throw e;
|
|
265
|
+
}
|
|
266
|
+
})();
|
|
267
|
+
ready.catch(() => {
|
|
268
|
+
});
|
|
269
|
+
function setValues(patch) {
|
|
270
|
+
const values = { ...state.values };
|
|
271
|
+
const dirty = new Set(state.dirty);
|
|
272
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
273
|
+
if (!state.fields[k]) continue;
|
|
274
|
+
values[k] = v;
|
|
275
|
+
if (sameValue(v, baseline[k])) dirty.delete(k);
|
|
276
|
+
else dirty.add(k);
|
|
277
|
+
}
|
|
278
|
+
set({ values, dirty: [...dirty], saveError: null });
|
|
279
|
+
scheduleDraft();
|
|
280
|
+
}
|
|
281
|
+
async function save() {
|
|
282
|
+
if (state.saving) return null;
|
|
283
|
+
set({ saving: true, saveError: null, submitted: true });
|
|
284
|
+
try {
|
|
285
|
+
const ok = await runDraft();
|
|
286
|
+
set({ errors: state.draftErrors });
|
|
287
|
+
if (!ok) {
|
|
288
|
+
set({ saving: false });
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
const names = state.mode === "edit" ? state.dirty : Object.keys(state.fields);
|
|
292
|
+
const data = {};
|
|
293
|
+
for (const n of names) {
|
|
294
|
+
if (!writable(n)) continue;
|
|
295
|
+
if (state.fieldState[n]?.visible === false) continue;
|
|
296
|
+
if (state.mode === "create" && isEmpty(state.values[n])) continue;
|
|
297
|
+
data[n] = state.values[n];
|
|
298
|
+
}
|
|
299
|
+
let id;
|
|
300
|
+
let created = false;
|
|
301
|
+
if (state.mode === "create") {
|
|
302
|
+
id = (await transport.createRecord(entity, form, data)).id;
|
|
303
|
+
created = true;
|
|
304
|
+
set({ mode: "edit", recordId: id });
|
|
305
|
+
} else {
|
|
306
|
+
id = state.recordId;
|
|
307
|
+
if (Object.keys(data).length) {
|
|
308
|
+
if (!state.updatedAt) {
|
|
309
|
+
throw new FormApiError(409, "missing_updated_at", "The record was read without its update time: reload it before saving.");
|
|
310
|
+
}
|
|
311
|
+
await transport.updateRecord(entity, form, id, data, state.updatedAt);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
await loadRecord();
|
|
315
|
+
set({ saving: false, submitted: false, touched: [], errors: {} });
|
|
316
|
+
void runDraft();
|
|
317
|
+
return { id, created };
|
|
318
|
+
} catch (e) {
|
|
319
|
+
const err = asError(e);
|
|
320
|
+
if (err instanceof FormApiError && (err.code === "etag_conflict" || err.code === "missing_updated_at")) {
|
|
321
|
+
set({ saving: false, conflict: true, saveError: err });
|
|
322
|
+
} else if (err instanceof FormApiError && err.field && state.fields[err.field]) {
|
|
323
|
+
const draftErrors = { ...state.draftErrors, [err.field]: err.message };
|
|
324
|
+
set({ saving: false, draftErrors, errors: draftErrors });
|
|
325
|
+
} else {
|
|
326
|
+
set({ saving: false, saveError: err });
|
|
327
|
+
}
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
ready,
|
|
333
|
+
getState: () => state,
|
|
334
|
+
subscribe(listener) {
|
|
335
|
+
listeners.add(listener);
|
|
336
|
+
return () => listeners.delete(listener);
|
|
337
|
+
},
|
|
338
|
+
setValue: (field, value) => setValues({ [field]: value }),
|
|
339
|
+
setValues,
|
|
340
|
+
touch(field) {
|
|
341
|
+
if (state.touched.includes(field)) return;
|
|
342
|
+
const touched = [...state.touched, field];
|
|
343
|
+
set({ touched, errors: shownErrors(state.draftErrors, touched, state.submitted) });
|
|
344
|
+
},
|
|
345
|
+
validate: () => runDraft(),
|
|
346
|
+
save,
|
|
347
|
+
reset() {
|
|
348
|
+
set({ values: { ...baseline }, dirty: [], touched: [], submitted: false, errors: {}, saveError: null });
|
|
349
|
+
scheduleDraft();
|
|
350
|
+
},
|
|
351
|
+
async reload() {
|
|
352
|
+
try {
|
|
353
|
+
await loadRecord();
|
|
354
|
+
await runDraft();
|
|
355
|
+
} catch (e) {
|
|
356
|
+
set({ saveError: asError(e) });
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
async fieldOptions(field, nodeId) {
|
|
360
|
+
const f = state.fields[field];
|
|
361
|
+
const display = fieldDisplayFor(state, field, nodeId);
|
|
362
|
+
if (display?.options) return display.options;
|
|
363
|
+
const remote = display?.options_source === "remote" || f?.input?.mode === "remote_options";
|
|
364
|
+
if (!remote && f?.input?.options?.length) return f.input.options;
|
|
365
|
+
const r = await transport.fieldOptions(entity, form, field, remote ? state.values : void 0);
|
|
366
|
+
return r.options;
|
|
367
|
+
},
|
|
368
|
+
async relationOptions(field, search, limit) {
|
|
369
|
+
const r = await transport.relationOptions(entity, form, field, search, limit);
|
|
370
|
+
const labels = { ...state.relationLabels[field] ?? {} };
|
|
371
|
+
for (const x of r.records) labels[x.id] = x.label;
|
|
372
|
+
set({ relationLabels: { ...state.relationLabels, [field]: labels } });
|
|
373
|
+
return r.records;
|
|
374
|
+
},
|
|
375
|
+
destroy() {
|
|
376
|
+
destroyed = true;
|
|
377
|
+
if (timer) clearTimeout(timer);
|
|
378
|
+
listeners.clear();
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/context.ts
|
|
384
|
+
function getPluginContext() {
|
|
385
|
+
if (typeof window === "undefined") return null;
|
|
386
|
+
return window.__CERVIO_PLUGIN_CONTEXT__ ?? null;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// src/client.ts
|
|
390
|
+
function resolveApiBaseUrl(explicitBaseUrl) {
|
|
391
|
+
const explicit = explicitBaseUrl?.trim();
|
|
392
|
+
if (explicit) return explicit.replace(/\/$/, "");
|
|
393
|
+
const parentOrigin = getPluginContext()?.parentOrigin?.trim();
|
|
394
|
+
if (parentOrigin && parentOrigin !== "null") {
|
|
395
|
+
return parentOrigin.replace(/\/$/, "");
|
|
396
|
+
}
|
|
397
|
+
throw new Error(
|
|
398
|
+
"Unable to resolve the Cervio API base URL. Pass { baseUrl } explicitly, or run inside the Cervio plugin sandbox so window.__CERVIO_PLUGIN_CONTEXT__.parentOrigin is set. Do not fall back to window.location.origin."
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/forms/index.ts
|
|
403
|
+
function createPluginFormController(opts) {
|
|
404
|
+
const { baseUrl, fetchImpl, transport, locale, ...rest } = opts;
|
|
405
|
+
return createFormController({
|
|
406
|
+
...rest,
|
|
407
|
+
transport: transport ?? createFetchTransport({
|
|
408
|
+
baseUrl: resolveApiBaseUrl(baseUrl),
|
|
409
|
+
fetchImpl,
|
|
410
|
+
// Labels, options and texts in the user's language, like the Cervio form.
|
|
411
|
+
locale: locale ?? getPluginContext()?.locale ?? void 0
|
|
412
|
+
})
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export { FormApiError, createFetchTransport, createFormController, createPluginFormController, fieldDisplayFor, flatLayout };
|