@gisce/react-ooui 2.121.0 → 2.121.1

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.
@@ -0,0 +1,694 @@
1
+ var F = Object.defineProperty;
2
+ var D = (d, n, e) => n in d ? F(d, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[n] = e;
3
+ var h = (d, n, e) => (D(d, typeof n != "symbol" ? n + "" : n, e), e);
4
+ import { jsxs as P, jsx as p } from "react/jsx-runtime";
5
+ import { memo as x, useState as v, useMemo as b, useCallback as A, useEffect as k } from "react";
6
+ import $ from "antd/es/alert/ErrorBoundary";
7
+ import { NotificationProvider as _ } from "@gisce/react-formiga-components";
8
+ import { C as V, a7 as E, T as R, av as L, i as j } from "./TabContent-afd3f2d3.mjs";
9
+ import "antd";
10
+ import "@gisce/ooui";
11
+ import "@ant-design/icons";
12
+ import "interweave";
13
+ import "dayjs";
14
+ import "dayjs/plugin/advancedFormat";
15
+ import "dayjs/plugin/customParseFormat";
16
+ import "dayjs/plugin/isoWeek";
17
+ import "dayjs/plugin/timezone";
18
+ import "dayjs/plugin/duration";
19
+ import "dayjs/plugin/relativeTime";
20
+ import "dayjs/plugin/weekday";
21
+ import "dayjs/plugin/localeData";
22
+ import "antd/lib/input/TextArea";
23
+ import "styled-components";
24
+ import "react-measure";
25
+ import "lodash/debounce";
26
+ import "use-deep-compare";
27
+ import "nanoid";
28
+ import "@ant-design/colors";
29
+ import "antd/lib/typography/Title";
30
+ import "@ant-design/plots";
31
+ import "react-dom/client";
32
+ import "file-type-buffer-browser";
33
+ import "@gisce/react-formiga-table";
34
+ import "antd/es/typography/Link";
35
+ import "antd/lib/_util/colors";
36
+ import "validator";
37
+ import "@gisce/react-formiga-table/style.css";
38
+ import "@gisce/fiber-diagram";
39
+ import "tinycolor2";
40
+ import "react-hotkeys-hook";
41
+ import "validator/lib/isURL";
42
+ import "validator/lib/isEmail";
43
+ import "react-markdown";
44
+ import "remark-gfm";
45
+ import "@monaco-editor/react";
46
+ import "md5";
47
+ import "react-grid-layout";
48
+ import "react-grid-layout/css/styles.css";
49
+ import "@dnd-kit/core";
50
+ import "@dnd-kit/modifiers";
51
+ import "@dnd-kit/sortable";
52
+ import "framer-motion";
53
+ import "@tanstack/react-virtual";
54
+ import "focus-trap-react";
55
+ class I {
56
+ constructor(n) {
57
+ h(this, "config");
58
+ h(this, "data");
59
+ h(this, "checkPermission", () => ({
60
+ read: !0,
61
+ write: !0,
62
+ create: !0,
63
+ unlink: !0
64
+ }));
65
+ h(this, "checkPermissions", () => ({
66
+ read: !0,
67
+ write: !0,
68
+ create: !0,
69
+ unlink: !0
70
+ }));
71
+ h(this, "permissions", () => ({ read: !0, write: !0, create: !0, unlink: !0 }));
72
+ this.config = n, this.data = [...n.records];
73
+ }
74
+ async fieldsViewGet({ model: n, viewType: e }) {
75
+ var t, r;
76
+ if (n === this.config.model)
77
+ return this.config.view;
78
+ if ((r = (t = this.config.relatedModels) == null ? void 0 : t[n]) != null && r.view)
79
+ return this.config.relatedModels[n].view;
80
+ throw new Error(`View not found for model: ${n}`);
81
+ }
82
+ async getView({ model: n, type: e }) {
83
+ var t, r;
84
+ if (n === this.config.model)
85
+ return this.config.view;
86
+ if ((r = (t = this.config.relatedModels) == null ? void 0 : t[n]) != null && r.view)
87
+ return this.config.relatedModels[n].view;
88
+ throw new Error(`View not found for model: ${n}`);
89
+ }
90
+ async readObjects(n) {
91
+ var r;
92
+ const { model: e, ids: t } = n;
93
+ return e === this.config.model ? this.data.filter((i) => t.includes(i.id)).map((i) => this.transformRecordFields(i)) : (r = this.config.relatedModels) != null && r[e] ? this.config.relatedModels[e].records.filter(
94
+ (o) => t.includes(o.id)
95
+ ) : [];
96
+ }
97
+ /**
98
+ * Transform one2many and many2many field values to the format expected by react-ooui.
99
+ * For one2many/many2many fields, the format is:
100
+ * { fields: {...}, items: [{ id, operation: "original", values: {...}, treeValues: {...} }] }
101
+ */
102
+ transformRecordFields(n) {
103
+ var r, o;
104
+ const e = { ...n }, t = this.config.view.fields;
105
+ for (const [i, a] of Object.entries(t)) {
106
+ const s = n[i];
107
+ if (s && (a.type === "one2many" || a.type === "many2many")) {
108
+ const l = a.relation;
109
+ if (!l)
110
+ continue;
111
+ const c = (r = this.config.relatedModels) == null ? void 0 : r[l];
112
+ if (!c)
113
+ continue;
114
+ let u = [];
115
+ Array.isArray(s) && (s.length > 0 && Array.isArray(s[0]) && s[0][0] === 6 ? u = s[0][2] || [] : u = s.filter(
116
+ (f) => typeof f == "number"
117
+ ));
118
+ const g = c.records.filter(
119
+ (f) => u.includes(f.id)
120
+ );
121
+ e[i] = {
122
+ fields: ((o = c.view) == null ? void 0 : o.fields) || {},
123
+ items: g.map((f) => ({
124
+ id: f.id,
125
+ operation: "original",
126
+ values: f,
127
+ treeValues: f
128
+ }))
129
+ };
130
+ }
131
+ }
132
+ return e;
133
+ }
134
+ async read({ model: n, ids: e }) {
135
+ return this.readObjects({ model: n, ids: e });
136
+ }
137
+ async search({ model: n, fieldsToRetrieve: e }) {
138
+ var t;
139
+ return n === this.config.model ? e && e.length > 0 ? this.data : this.data.map((r) => r.id) : (t = this.config.relatedModels) != null && t[n] ? e && e.length > 0 ? this.config.relatedModels[n].records : this.config.relatedModels[n].records.map((r) => r.id) : [];
140
+ }
141
+ async searchForTree({ model: n }) {
142
+ return n === this.config.model ? {
143
+ results: this.data,
144
+ totalItems: async () => this.data.length,
145
+ attrsEvaluated: [],
146
+ items: this.data
147
+ } : {
148
+ results: [],
149
+ totalItems: async () => 0,
150
+ attrsEvaluated: [],
151
+ items: []
152
+ };
153
+ }
154
+ async nameGet({ model: n, ids: e }) {
155
+ var t;
156
+ return n === this.config.model ? this.data.filter((r) => e.includes(r.id)).map((r) => [r.id, r.name || `Record ${r.id}`]) : (t = this.config.relatedModels) != null && t[n] ? this.config.relatedModels[n].records.filter((r) => e.includes(r.id)).map((r) => [r.id, r.name]) : [];
157
+ }
158
+ async nameSearch({ model: n, name: e, payload: t, limit: r }) {
159
+ var i;
160
+ const o = (t || e || "").toLowerCase();
161
+ return n === this.config.model ? this.data.filter(
162
+ (s) => (s.name || "").toLowerCase().includes(o)
163
+ ).slice(0, r || 7).map((s) => [s.id, s.name || `Record ${s.id}`]) : (i = this.config.relatedModels) != null && i[n] ? this.config.relatedModels[n].records.filter(
164
+ (s) => s.name.toLowerCase().includes(o)
165
+ ).slice(0, r || 7).map((s) => [s.id, s.name]) : [];
166
+ }
167
+ async create({ model: n, values: e }) {
168
+ if (n === this.config.model) {
169
+ const t = Math.max(0, ...this.data.map((r) => r.id)) + 1;
170
+ return this.data.push({ id: t, ...e }), t;
171
+ }
172
+ return null;
173
+ }
174
+ async write({ model: n, ids: e, values: t }) {
175
+ return n === this.config.model ? (this.data = this.data.map(
176
+ (r) => e.includes(r.id) ? { ...r, ...t } : r
177
+ ), !0) : !1;
178
+ }
179
+ async unlink({ model: n, ids: e }) {
180
+ return n === this.config.model ? (this.data = this.data.filter((t) => !e.includes(t.id)), !0) : !1;
181
+ }
182
+ async defaultGet({ model: n, extraValues: e }) {
183
+ return e || {};
184
+ }
185
+ async executeOnChange(n) {
186
+ return { value: {}, warning: null, domain: {} };
187
+ }
188
+ getPermissions() {
189
+ return { read: !0, write: !0, create: !0, unlink: !0 };
190
+ }
191
+ async fieldsGet() {
192
+ return {};
193
+ }
194
+ async getDefaults(n) {
195
+ return {};
196
+ }
197
+ async getToolbar(n) {
198
+ return { action: {}, relate: [], print: [], other: [] };
199
+ }
200
+ async execute(n) {
201
+ return null;
202
+ }
203
+ async executeButton(n) {
204
+ return null;
205
+ }
206
+ async executeWorkflow(n) {
207
+ return null;
208
+ }
209
+ async searchCount({ model: n }) {
210
+ return n === this.config.model ? this.data.length : 0;
211
+ }
212
+ async readGroup() {
213
+ return [];
214
+ }
215
+ async export() {
216
+ return "";
217
+ }
218
+ async getTree() {
219
+ return { field_parent: "", name: "" };
220
+ }
221
+ async getXMLViewContent() {
222
+ return "";
223
+ }
224
+ async getActionData() {
225
+ return {};
226
+ }
227
+ async getActionDomain() {
228
+ return [];
229
+ }
230
+ async getDashboardActionData() {
231
+ return {};
232
+ }
233
+ async evalDomain(n) {
234
+ return [];
235
+ }
236
+ async evalContext() {
237
+ return {};
238
+ }
239
+ async getSessionInfo() {
240
+ return { session_id: "docs-mock" };
241
+ }
242
+ async isConnectionOnline() {
243
+ return !0;
244
+ }
245
+ async canCreateNewDatabase() {
246
+ return !1;
247
+ }
248
+ async createNewDatabase() {
249
+ return !1;
250
+ }
251
+ async getDatabaseList() {
252
+ return [];
253
+ }
254
+ async getDistinctValues() {
255
+ return [];
256
+ }
257
+ async copy() {
258
+ return null;
259
+ }
260
+ async getReportData() {
261
+ return null;
262
+ }
263
+ async printReport() {
264
+ return null;
265
+ }
266
+ async call() {
267
+ return null;
268
+ }
269
+ async callWithContext() {
270
+ return null;
271
+ }
272
+ async getSomeCounters() {
273
+ return {};
274
+ }
275
+ async callWizard() {
276
+ return null;
277
+ }
278
+ async callDefaultGetFunction() {
279
+ return {};
280
+ }
281
+ async getRelatedFieldData() {
282
+ return null;
283
+ }
284
+ async getReferencedModels() {
285
+ return [];
286
+ }
287
+ async getTitleFromId() {
288
+ return "";
289
+ }
290
+ async treeButOpen() {
291
+ return [[null, null, {}]];
292
+ }
293
+ async readAggregates() {
294
+ return {};
295
+ }
296
+ async writeConcurrencyField() {
297
+ return !0;
298
+ }
299
+ async parseConditions() {
300
+ return [];
301
+ }
302
+ async parseCondition() {
303
+ return {};
304
+ }
305
+ async processSearchResults() {
306
+ return { results: [], attrsEvaluated: [] };
307
+ }
308
+ async update({ model: n, id: e, values: t }) {
309
+ return this.write({ model: n, ids: [e], values: t });
310
+ }
311
+ async readUserViewPrefs() {
312
+ return !1;
313
+ }
314
+ async saveUserViewPrefs() {
315
+ return !0;
316
+ }
317
+ }
318
+ const M = /* @__PURE__ */ new Map();
319
+ let C = null;
320
+ class O extends I {
321
+ constructor(e) {
322
+ super({
323
+ model: "__multi__",
324
+ view: { view_id: 0, type: "form", arch: "", fields: {} },
325
+ records: []
326
+ });
327
+ h(this, "configs");
328
+ this.configs = e;
329
+ }
330
+ getConfigForModel(e) {
331
+ return this.configs.get(e);
332
+ }
333
+ async fieldsViewGet({ model: e }) {
334
+ var r, o;
335
+ const t = this.getConfigForModel(e);
336
+ if (t)
337
+ return t.view;
338
+ for (const i of this.configs.values())
339
+ if ((o = (r = i.relatedModels) == null ? void 0 : r[e]) != null && o.view)
340
+ return i.relatedModels[e].view;
341
+ throw new Error(`View not found for model: ${e}`);
342
+ }
343
+ async getView({ model: e, type: t }) {
344
+ var o, i;
345
+ const r = this.getConfigForModel(e);
346
+ if (r)
347
+ return t === "form" && r.view.type === "tree" ? this.generateFormView(r) : r.view;
348
+ for (const a of this.configs.values())
349
+ if ((o = a.relatedModels) != null && o[e]) {
350
+ const s = a.relatedModels[e];
351
+ return t === "form" && ((i = s.view) == null ? void 0 : i.type) === "tree" ? this.generateFormViewForRelated(s) : s.view;
352
+ }
353
+ throw new Error(`View not found for model: ${e}`);
354
+ }
355
+ generateFormView(e) {
356
+ const t = e.view.fields, o = Object.keys(t).map((i) => `<field name="${i}"/>`).join("");
357
+ return {
358
+ view_id: (e.view.view_id || 0) + 1e3,
359
+ type: "form",
360
+ arch: `<?xml version="1.0"?><form><group>${o}</group></form>`,
361
+ fields: t
362
+ };
363
+ }
364
+ generateFormViewForRelated(e) {
365
+ var i, a;
366
+ const t = ((i = e.view) == null ? void 0 : i.fields) || {}, o = Object.keys(t).map((s) => `<field name="${s}"/>`).join("");
367
+ return {
368
+ view_id: (((a = e.view) == null ? void 0 : a.view_id) || 0) + 1e3,
369
+ type: "form",
370
+ arch: `<?xml version="1.0"?><form><group>${o}</group></form>`,
371
+ fields: t
372
+ };
373
+ }
374
+ async getToolbar({ model: e, type: t, context: r }) {
375
+ return console.log(`[Docs Preview] getToolbar called: ${e}`, {
376
+ type: t,
377
+ context: r
378
+ }), {
379
+ action: {},
380
+ relate: [],
381
+ print: [],
382
+ other: []
383
+ };
384
+ }
385
+ async readObjects(e) {
386
+ var i;
387
+ const { model: t, ids: r } = e, o = this.getConfigForModel(t);
388
+ if (o)
389
+ return o.records.filter((s) => r.includes(s.id)).map(
390
+ (s) => this.transformX2ManyFields(s, o)
391
+ );
392
+ for (const a of this.configs.values())
393
+ if ((i = a.relatedModels) != null && i[t])
394
+ return a.relatedModels[t].records.filter(
395
+ (s) => r.includes(s.id)
396
+ );
397
+ return [];
398
+ }
399
+ /**
400
+ * Transform one2many and many2many field values to the format expected by react-ooui.
401
+ */
402
+ transformX2ManyFields(e, t) {
403
+ var i, a;
404
+ const r = { ...e }, o = t.view.fields;
405
+ for (const [s, l] of Object.entries(o)) {
406
+ const c = e[s];
407
+ if (c && (l.type === "one2many" || l.type === "many2many")) {
408
+ const u = l.relation;
409
+ if (!u)
410
+ continue;
411
+ const g = (i = t.relatedModels) == null ? void 0 : i[u];
412
+ if (!g)
413
+ continue;
414
+ let f = [];
415
+ Array.isArray(c) && (c.length > 0 && Array.isArray(c[0]) && c[0][0] === 6 ? f = c[0][2] || [] : f = c.filter(
416
+ (m) => typeof m == "number"
417
+ ));
418
+ const y = g.records.filter(
419
+ (m) => f.includes(m.id)
420
+ );
421
+ r[s] = {
422
+ fields: ((a = g.view) == null ? void 0 : a.fields) || {},
423
+ items: y.map((m) => ({
424
+ id: m.id,
425
+ operation: "original",
426
+ values: m,
427
+ treeValues: m
428
+ }))
429
+ };
430
+ }
431
+ }
432
+ return r;
433
+ }
434
+ async read({ model: e, ids: t }) {
435
+ return this.readObjects({ model: e, ids: t });
436
+ }
437
+ async search({ model: e, params: t, fieldsToRetrieve: r }) {
438
+ var i;
439
+ const o = this.getConfigForModel(e);
440
+ if (o)
441
+ return r && r.length > 0 ? o.records : o.records.map((a) => a.id);
442
+ for (const a of this.configs.values())
443
+ if ((i = a.relatedModels) != null && i[e])
444
+ return r && r.length > 0 ? a.relatedModels[e].records : a.relatedModels[e].records.map((s) => s.id);
445
+ return [];
446
+ }
447
+ async searchForTree({ model: e, name_search: t, params: r }) {
448
+ var s;
449
+ console.log("[Docs Preview] searchForTree called:", {
450
+ model: e,
451
+ name_search: t,
452
+ params: r
453
+ });
454
+ const o = (t || "").toLowerCase(), i = (l) => o ? l.filter(
455
+ (c) => (c.name || "").toLowerCase().includes(o)
456
+ ) : l, a = this.getConfigForModel(e);
457
+ if (a) {
458
+ const l = i(a.records);
459
+ return {
460
+ results: l,
461
+ totalItems: async () => l.length,
462
+ attrsEvaluated: [],
463
+ items: l
464
+ };
465
+ }
466
+ for (const l of this.configs.values())
467
+ if ((s = l.relatedModels) != null && s[e]) {
468
+ const c = i(l.relatedModels[e].records);
469
+ return {
470
+ results: c,
471
+ totalItems: async () => c.length,
472
+ attrsEvaluated: [],
473
+ items: c
474
+ };
475
+ }
476
+ return {
477
+ results: [],
478
+ totalItems: async () => 0,
479
+ attrsEvaluated: [],
480
+ items: []
481
+ };
482
+ }
483
+ async nameGet({ model: e, ids: t }) {
484
+ var o;
485
+ const r = this.getConfigForModel(e);
486
+ if (r)
487
+ return r.records.filter((i) => t.includes(i.id)).map((i) => [i.id, i.name || `Record ${i.id}`]);
488
+ for (const i of this.configs.values())
489
+ if ((o = i.relatedModels) != null && o[e])
490
+ return i.relatedModels[e].records.filter((a) => t.includes(a.id)).map((a) => [a.id, a.name]);
491
+ return [];
492
+ }
493
+ async nameSearch({ model: e, name: t, payload: r, limit: o }) {
494
+ var s;
495
+ const i = (r || t || "").toLowerCase(), a = this.getConfigForModel(e);
496
+ if (a)
497
+ return a.records.filter(
498
+ (c) => (c.name || "").toLowerCase().includes(i)
499
+ ).slice(0, o || 7).map((c) => [c.id, c.name || `Record ${c.id}`]);
500
+ for (const l of this.configs.values())
501
+ if ((s = l.relatedModels) != null && s[e])
502
+ return l.relatedModels[e].records.filter(
503
+ (u) => u.name.toLowerCase().includes(i)
504
+ ).slice(0, o || 7).map((u) => [u.id, u.name]);
505
+ return [];
506
+ }
507
+ async searchCount({ model: e, name_search: t }) {
508
+ var a;
509
+ const r = (t || "").toLowerCase(), o = (s) => r ? s.filter(
510
+ (l) => (l.name || "").toLowerCase().includes(r)
511
+ ) : s, i = this.getConfigForModel(e);
512
+ if (i)
513
+ return o(i.records).length;
514
+ for (const s of this.configs.values())
515
+ if ((a = s.relatedModels) != null && a[e])
516
+ return o(s.relatedModels[e].records).length;
517
+ return 0;
518
+ }
519
+ // Button execution methods - return empty/success responses for docs preview
520
+ async execute({ model: e, action: t, payload: r, context: o }) {
521
+ if (console.log(`[Docs Preview] execute called: ${e}.${t}`, {
522
+ payload: r,
523
+ context: o
524
+ }), t === "name_get") {
525
+ const i = Array.isArray(r) ? r : [r];
526
+ return this.nameGet({ model: e, ids: i });
527
+ }
528
+ return {};
529
+ }
530
+ async executeButton({ model: e, payload: t }) {
531
+ return console.log(`[Docs Preview] executeButton called: ${e}`, { payload: t }), {};
532
+ }
533
+ async executeWorkflow({ model: e, action: t, payload: r }) {
534
+ return console.log(`[Docs Preview] executeWorkflow called: ${e}.${t}`, {
535
+ payload: r
536
+ }), {};
537
+ }
538
+ // Many2one search modal support
539
+ async searchAllIds({ model: e }) {
540
+ var r;
541
+ const t = this.getConfigForModel(e);
542
+ if (t)
543
+ return t.records.map((o) => o.id);
544
+ for (const o of this.configs.values())
545
+ if ((r = o.relatedModels) != null && r[e])
546
+ return o.relatedModels[e].records.map((i) => i.id);
547
+ return [];
548
+ }
549
+ // Write/create methods for form interactions
550
+ async write({ model: e, ids: t, values: r }) {
551
+ return console.log(`[Docs Preview] write called: ${e}`, { ids: t, values: r }), !0;
552
+ }
553
+ async create({ model: e, values: t }) {
554
+ return console.log(`[Docs Preview] create called: ${e}`, { values: t }), 999;
555
+ }
556
+ async update({ model: e, id: t, values: r }) {
557
+ return console.log(`[Docs Preview] update called: ${e}`, { id: t, values: r }), !0;
558
+ }
559
+ // Action reading for action buttons
560
+ async getAction({ actionId: e }) {
561
+ return console.log("[Docs Preview] getAction called:", { actionId: e }), { type: "ir.actions.act_window_close" };
562
+ }
563
+ // Domain evaluation
564
+ async evalDomain({ domain: e }) {
565
+ return e || [];
566
+ }
567
+ // Default get for new records
568
+ async getDefaults({ model: e }) {
569
+ return {};
570
+ }
571
+ // On change handling
572
+ async executeOnChange({ model: e }) {
573
+ return { value: {}, warning: null, domain: {} };
574
+ }
575
+ // Method for refreshing record data after actions
576
+ async refresh({ model: e, id: t }) {
577
+ return console.log(`[Docs Preview] refresh called: ${e}`, { id: t }), this.readObjects({ model: e, ids: [t] });
578
+ }
579
+ }
580
+ function T(d) {
581
+ M.set(d.model, d), C = new O(M);
582
+ const n = new Proxy(C, {
583
+ get(e, t, r) {
584
+ const o = Reflect.get(e, t, r);
585
+ return o !== void 0 ? typeof o == "function" ? o.bind(e) : o : typeof t == "string" && t !== "constructor" ? function() {
586
+ return { read: !0, write: !0, create: !0, unlink: !0 };
587
+ } : o;
588
+ }
589
+ });
590
+ return V.init(n), n;
591
+ }
592
+ const N = async () => (console.log("[Docs Preview] Action triggered (mock)"), null), G = {
593
+ openAction: (d) => {
594
+ console.log("[Docs Preview] openAction called:", d);
595
+ },
596
+ openRelate: (d) => {
597
+ console.log("[Docs Preview] openRelate called:", d);
598
+ },
599
+ openDefaultActionForModel: (d) => {
600
+ console.log("[Docs Preview] openDefaultActionForModel called:", d);
601
+ },
602
+ openShortcut: (d) => {
603
+ console.log("[Docs Preview] openShortcut called:", d);
604
+ },
605
+ activeKey: "docs-preview",
606
+ onChangeTab: () => {
607
+ },
608
+ onRemoveTab: () => {
609
+ },
610
+ onReorderTabs: () => {
611
+ },
612
+ tabs: []
613
+ }, S = x(function({
614
+ arch: n,
615
+ fields: e,
616
+ values: t,
617
+ model: r = "docs.preview",
618
+ relatedModels: o = {},
619
+ readOnly: i = !0,
620
+ locale: a = "en_US",
621
+ height: s,
622
+ showFooter: l = !1
623
+ }) {
624
+ const [c, u] = v(!1), [g, f] = v(null), y = b(() => n.includes("<?xml") ? n : `<?xml version="1.0"?>
625
+ ${n}`, [n]), m = A(() => {
626
+ try {
627
+ T({
628
+ model: r,
629
+ view: {
630
+ view_id: 1,
631
+ type: "form",
632
+ arch: y,
633
+ fields: e
634
+ },
635
+ records: [{ id: 1, ...t }],
636
+ relatedModels: o
637
+ }), u(!0);
638
+ } catch (w) {
639
+ f(
640
+ w instanceof Error ? w.message : "Failed to initialize mock provider"
641
+ );
642
+ }
643
+ }, [y, e, t, r, o]);
644
+ return k(() => {
645
+ m();
646
+ }, [m]), g ? /* @__PURE__ */ P(
647
+ "div",
648
+ {
649
+ style: {
650
+ color: "red",
651
+ padding: 16,
652
+ border: "1px solid red",
653
+ borderRadius: 4
654
+ },
655
+ children: [
656
+ "Error: ",
657
+ g
658
+ ]
659
+ }
660
+ ) : c ? /* @__PURE__ */ p($, { children: /* @__PURE__ */ p(_, { children: /* @__PURE__ */ p(
661
+ E,
662
+ {
663
+ locale: a,
664
+ erpFeatures: {},
665
+ userFeatures: { features: {}, canWriteFeatureFlags: !1 },
666
+ globalValues: {},
667
+ rootContext: {},
668
+ devMode: !1,
669
+ title: "Documentation Preview",
670
+ treeMaxLimit: 100,
671
+ children: /* @__PURE__ */ p(R.Provider, { value: G, children: /* @__PURE__ */ p(
672
+ L.Provider,
673
+ {
674
+ value: { processAction: N, globalValues: {} },
675
+ children: /* @__PURE__ */ p("div", { style: { height: s || "auto" }, children: /* @__PURE__ */ p(
676
+ j,
677
+ {
678
+ model: r,
679
+ id: 1,
680
+ showFooter: l,
681
+ readOnly: i,
682
+ rootForm: !0,
683
+ parentContext: {}
684
+ }
685
+ ) })
686
+ }
687
+ ) })
688
+ }
689
+ ) }) }) : /* @__PURE__ */ p("div", { style: { padding: 16, color: "#666" }, children: "Loading preview..." });
690
+ }), Ge = S;
691
+ export {
692
+ Ge as FormPreview
693
+ };
694
+ //# sourceMappingURL=docs.es.js.map