@prolibu-suite/cobalt-form 0.1.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.
Files changed (38) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  2. package/dist/cjs/co-form.cjs.entry.js +8 -0
  3. package/dist/cjs/cobalt-form.cjs.js +25 -0
  4. package/dist/cjs/index-8raPCV5a.js +2019 -0
  5. package/dist/cjs/index.cjs.js +9260 -0
  6. package/dist/cjs/loader.cjs.js +13 -0
  7. package/dist/cobalt-form/cobalt-form.esm.js +1 -0
  8. package/dist/cobalt-form/index.esm.js +7 -0
  9. package/dist/cobalt-form/p-DQuL1Twl.js +1 -0
  10. package/dist/cobalt-form/p-X0Keifac.js +2 -0
  11. package/dist/cobalt-form/p-ef70e055.entry.js +1 -0
  12. package/dist/collection/collection-manifest.json +13 -0
  13. package/dist/collection/components/co-form/co-form.css +23 -0
  14. package/dist/collection/components/co-form/co-form.js +750 -0
  15. package/dist/collection/index.js +1 -0
  16. package/dist/components/co-form.d.ts +11 -0
  17. package/dist/components/co-form.js +1 -0
  18. package/dist/components/index.d.ts +35 -0
  19. package/dist/components/index.js +7 -0
  20. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  21. package/dist/esm/co-form.entry.js +2 -0
  22. package/dist/esm/cobalt-form.js +21 -0
  23. package/dist/esm/index-X0Keifac.js +1993 -0
  24. package/dist/esm/index.js +9258 -0
  25. package/dist/esm/loader.js +11 -0
  26. package/dist/index.cjs.js +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/types/components/co-form/co-form.d.ts +88 -0
  29. package/dist/types/components.d.ts +217 -0
  30. package/dist/types/index.d.ts +1 -0
  31. package/dist/types/jsx-cobalt.d.ts +60 -0
  32. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  33. package/loader/cdn.js +1 -0
  34. package/loader/index.cjs.js +1 -0
  35. package/loader/index.d.ts +24 -0
  36. package/loader/index.es2017.js +1 -0
  37. package/loader/index.js +2 -0
  38. package/package.json +56 -0
@@ -0,0 +1,750 @@
1
+ import { h } from "@stencil/core";
2
+ import { createForm, createInlineValidator, describeFields, normalizeForValidation, } from "@prolibu-suite/cobalt-form-core";
3
+ const PAGE_SIZE = 20;
4
+ const blankRefState = () => ({
5
+ options: [],
6
+ selectedDisplay: [],
7
+ loading: false,
8
+ total: 0,
9
+ hasMore: false,
10
+ page: 1,
11
+ query: '',
12
+ });
13
+ /**
14
+ * Schema-driven form. Renders Cobalt input components from an inline
15
+ * Prolibu/Mongoose-style JSON schema and emits the validated payload on submit.
16
+ *
17
+ * Validation: bundled AJV (via `createInlineValidator` in form-core) handles
18
+ * required, format, min/max, minLength/maxLength, enum, regex out of the box.
19
+ * Hosts wanting full Prolibu FormSchemaWeb behavior can assign a pre-built
20
+ * `FormSchemaLike` to the `schemaInstance` element property.
21
+ *
22
+ * Ref fields: assign a `refResolver` function to the element to enable
23
+ * search + pagination + label hydration against your backend. See
24
+ * {@link RefResolver}.
25
+ *
26
+ * @slot header - Content above the fields.
27
+ * @slot footer - Content below the fields (default: a primary submit button).
28
+ * @slot field:<name> - Override the rendering of a specific field by name.
29
+ */
30
+ export class CoForm {
31
+ constructor() {
32
+ /** Locale for labels and AJV error messages. */
33
+ this.locale = 'es';
34
+ /** Layout strategy for the field grid. */
35
+ this.layout = 'grid';
36
+ /** Disable all fields. */
37
+ this.disabled = false;
38
+ /** Read-only mode for all fields. */
39
+ this.readOnly = false;
40
+ this.snapshot = {
41
+ values: {},
42
+ errors: {},
43
+ touched: {},
44
+ isValid: true,
45
+ isDirty: false,
46
+ isSubmitting: false,
47
+ };
48
+ this.refStates = {};
49
+ this.controller = null;
50
+ this.fields = [];
51
+ this.unsubscribe = null;
52
+ // ── Form actions ──────────────────────────────────────────────────────────
53
+ this.handleFieldChange = (name, value) => {
54
+ var _a;
55
+ (_a = this.controller) === null || _a === void 0 ? void 0 : _a.setValue(name, value);
56
+ this.coChange.emit({ name, value });
57
+ };
58
+ this.handleSubmit = (e) => {
59
+ e.preventDefault();
60
+ if (!this.controller || !this.controller)
61
+ return;
62
+ const isValid = this.controller.validate();
63
+ if (!isValid) {
64
+ this.controller.touchAll();
65
+ return;
66
+ }
67
+ const properties = this.controller.fields.reduce((acc, f) => {
68
+ acc[f.name] = f.ajvProperty;
69
+ return acc;
70
+ }, {});
71
+ const values = normalizeForValidation(this.controller.state.values, properties);
72
+ this.coSubmit.emit({ values });
73
+ };
74
+ this.handleRefSearch = (f, query) => {
75
+ if (!this.refResolver)
76
+ return;
77
+ this.fetchRefPage(f, query, 1, /* append */ false);
78
+ };
79
+ this.handleRefLoadMore = (f) => {
80
+ var _a;
81
+ if (!this.refResolver)
82
+ return;
83
+ const prev = (_a = this.refStates[f.name]) !== null && _a !== void 0 ? _a : blankRefState();
84
+ if (prev.loading || !prev.hasMore)
85
+ return;
86
+ this.fetchRefPage(f, prev.query, prev.page + 1, /* append */ true);
87
+ };
88
+ this.handleRefSelect = (f, ev) => {
89
+ var _a, _b;
90
+ const detail = (_a = ev.detail) !== null && _a !== void 0 ? _a : {};
91
+ const value = detail.value;
92
+ const item = detail.item;
93
+ // Keep display labels in sync: add the picked option to selectedDisplay
94
+ // so chips render with the right text without re-fetching.
95
+ if (item) {
96
+ const prev = (_b = this.refStates[f.name]) !== null && _b !== void 0 ? _b : blankRefState();
97
+ const ids = Array.isArray(value) ? value : value ? [value] : [];
98
+ const display = [];
99
+ for (const id of ids) {
100
+ const known = prev.selectedDisplay.find((d) => d.value === id) ||
101
+ prev.options.find((o) => o.value === id) ||
102
+ (item.value === id ? item : null);
103
+ if (known)
104
+ display.push(known);
105
+ else
106
+ display.push({ value: id, label: id });
107
+ }
108
+ this.patchRefState(f.name, { selectedDisplay: display });
109
+ }
110
+ this.handleFieldChange(f.name, value);
111
+ };
112
+ }
113
+ componentWillLoad() {
114
+ this.rebuildController();
115
+ }
116
+ onSchemaChange() {
117
+ this.rebuildController();
118
+ }
119
+ disconnectedCallback() {
120
+ var _a;
121
+ (_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
122
+ this.unsubscribe = null;
123
+ }
124
+ // ── Controller wiring ─────────────────────────────────────────────────────
125
+ rebuildController() {
126
+ var _a;
127
+ (_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
128
+ const instance = this.resolveSchemaInstance();
129
+ if (!instance) {
130
+ this.fields = [];
131
+ return;
132
+ }
133
+ const initialValues = this.parseInitialValues();
134
+ this.controller = createForm({
135
+ schema: { instance },
136
+ initialValues,
137
+ });
138
+ this.fields = describeFields(instance.formSchema.properties);
139
+ this.snapshot = this.controller.state;
140
+ this.unsubscribe = this.controller.subscribe((s) => {
141
+ this.snapshot = s;
142
+ this.coValidate.emit({ isValid: s.isValid, errors: s.errors });
143
+ });
144
+ this.initRefStates();
145
+ }
146
+ resolveSchemaInstance() {
147
+ var _a;
148
+ if (this.schemaInstance)
149
+ return this.schemaInstance;
150
+ if (!this.schema) {
151
+ console.warn('[co-form] no `schema` attribute provided');
152
+ return null;
153
+ }
154
+ try {
155
+ const parsed = JSON.parse(this.schema);
156
+ if (parsed && typeof parsed === 'object' && ((_a = parsed.formSchema) === null || _a === void 0 ? void 0 : _a.properties)) {
157
+ return parsed;
158
+ }
159
+ return createInlineValidator(parsed, this.locale);
160
+ }
161
+ catch (err) {
162
+ console.error('[co-form] failed to parse `schema` JSON:', err);
163
+ return null;
164
+ }
165
+ }
166
+ parseInitialValues() {
167
+ if (!this.initialValues)
168
+ return {};
169
+ try {
170
+ return JSON.parse(this.initialValues) || {};
171
+ }
172
+ catch (err) {
173
+ console.error('[co-form] failed to parse `initialValues` JSON:', err);
174
+ return {};
175
+ }
176
+ }
177
+ get excludedSet() {
178
+ if (!this.excludeFields)
179
+ return new Set();
180
+ return new Set(this.excludeFields
181
+ .split(',')
182
+ .map((n) => n.trim())
183
+ .filter(Boolean));
184
+ }
185
+ // ── Public methods (for slot content) ─────────────────────────────────────
186
+ /** Push a value into the controller from outside (e.g. from slot content). */
187
+ async setValue(name, value) {
188
+ this.handleFieldChange(name, value);
189
+ }
190
+ /** Read the current value of a field. */
191
+ async getValue(name) {
192
+ var _a;
193
+ return (_a = this.controller) === null || _a === void 0 ? void 0 : _a.getValue(name);
194
+ }
195
+ /** Mark a field as touched (forces its errors to be visible). */
196
+ async touch(name) {
197
+ var _a;
198
+ (_a = this.controller) === null || _a === void 0 ? void 0 : _a.touch(name);
199
+ }
200
+ hasSlotContent(slotName) {
201
+ return !!this.host.querySelector(`[slot="${slotName}"]`);
202
+ }
203
+ // ── Ref-field state ───────────────────────────────────────────────────────
204
+ initRefStates() {
205
+ const next = {};
206
+ const toHydrate = [];
207
+ for (const f of this.fields) {
208
+ if (f.kind !== 'ref')
209
+ continue;
210
+ const v = this.snapshot.values[f.name];
211
+ const state = blankRefState();
212
+ const { ids, display } = this.normalizeRefValue(f, v);
213
+ state.selectedDisplay = display;
214
+ next[f.name] = state;
215
+ // If we have ids but no labels (raw _id form), defer hydration.
216
+ const idsMissingLabel = ids.filter((id) => !display.some((d) => d.value === id));
217
+ if (idsMissingLabel.length > 0) {
218
+ toHydrate.push({ field: f, ids: idsMissingLabel });
219
+ }
220
+ }
221
+ this.refStates = next;
222
+ for (const { field, ids } of toHydrate) {
223
+ this.hydrateRefFieldLabels(field, ids);
224
+ }
225
+ }
226
+ /** Given a raw value, return the canonical {ids, display} pair. */
227
+ normalizeRefValue(f, v) {
228
+ const displayKey = f.originalAttrs.displayName || 'name';
229
+ const ids = [];
230
+ const display = [];
231
+ const intake = (item) => {
232
+ var _a, _b;
233
+ if (!item)
234
+ return;
235
+ if (typeof item === 'string') {
236
+ ids.push(item);
237
+ }
238
+ else if (typeof item === 'object' && item._id) {
239
+ ids.push(item._id);
240
+ display.push({
241
+ value: item._id,
242
+ label: String((_b = (_a = item[displayKey]) !== null && _a !== void 0 ? _a : item.name) !== null && _b !== void 0 ? _b : item._id),
243
+ meta: item,
244
+ });
245
+ }
246
+ };
247
+ if (Array.isArray(v))
248
+ v.forEach(intake);
249
+ else
250
+ intake(v);
251
+ return { ids, display };
252
+ }
253
+ async hydrateRefFieldLabels(f, ids) {
254
+ var _a;
255
+ if (!this.refResolver) {
256
+ // No resolver registered — leave selectedDisplay empty; the field will
257
+ // render with the raw _id which is ugly but predictable.
258
+ console.warn(`[co-form] field "${f.name}" has unpopulated values but no refResolver is set; labels will fall back to raw ids.`);
259
+ return;
260
+ }
261
+ this.patchRefState(f.name, { loading: true });
262
+ try {
263
+ const result = await this.refResolver({
264
+ model: f.originalAttrs.ref,
265
+ ids,
266
+ });
267
+ const prev = (_a = this.refStates[f.name]) !== null && _a !== void 0 ? _a : blankRefState();
268
+ const seen = new Set(prev.selectedDisplay.map((d) => d.value));
269
+ const merged = [...prev.selectedDisplay];
270
+ for (const opt of result.options) {
271
+ if (!seen.has(opt.value))
272
+ merged.push(opt);
273
+ }
274
+ this.patchRefState(f.name, { selectedDisplay: merged, loading: false });
275
+ }
276
+ catch (err) {
277
+ console.error(`[co-form] refResolver failed to hydrate "${f.name}":`, err);
278
+ this.patchRefState(f.name, { loading: false });
279
+ }
280
+ }
281
+ patchRefState(name, patch) {
282
+ var _a;
283
+ const prev = (_a = this.refStates[name]) !== null && _a !== void 0 ? _a : blankRefState();
284
+ this.refStates = Object.assign(Object.assign({}, this.refStates), { [name]: Object.assign(Object.assign({}, prev), patch) });
285
+ }
286
+ async fetchRefPage(f, query, page, append) {
287
+ var _a, _b, _c;
288
+ if (!this.refResolver)
289
+ return;
290
+ this.patchRefState(f.name, { loading: true, query });
291
+ try {
292
+ const result = await this.refResolver({
293
+ model: f.originalAttrs.ref,
294
+ query,
295
+ page,
296
+ pageSize: PAGE_SIZE,
297
+ });
298
+ const prev = (_a = this.refStates[f.name]) !== null && _a !== void 0 ? _a : blankRefState();
299
+ const options = append ? [...prev.options, ...result.options] : result.options;
300
+ const total = (_b = result.total) !== null && _b !== void 0 ? _b : options.length;
301
+ const hasMore = (_c = result.hasMore) !== null && _c !== void 0 ? _c : page * PAGE_SIZE < total;
302
+ this.patchRefState(f.name, {
303
+ options,
304
+ total,
305
+ hasMore,
306
+ page,
307
+ loading: false,
308
+ });
309
+ }
310
+ catch (err) {
311
+ console.error(`[co-form] refResolver failed:`, err);
312
+ this.patchRefState(f.name, { loading: false });
313
+ }
314
+ }
315
+ refValueAsString(f, raw) {
316
+ if (raw === undefined || raw === null)
317
+ return '';
318
+ const isMultiple = !!f.originalAttrs.multiple || f.originalAttrs.type === 'array';
319
+ if (Array.isArray(raw)) {
320
+ const ids = raw.map((x) => (typeof x === 'string' ? x : (x === null || x === void 0 ? void 0 : x._id) || ''));
321
+ return JSON.stringify(ids);
322
+ }
323
+ if (typeof raw === 'string')
324
+ return isMultiple ? JSON.stringify([raw]) : raw;
325
+ if (typeof raw === 'object' && raw._id) {
326
+ return isMultiple ? JSON.stringify([raw._id]) : String(raw._id);
327
+ }
328
+ return '';
329
+ }
330
+ // ── Render ────────────────────────────────────────────────────────────────
331
+ render() {
332
+ const excluded = this.excludedSet;
333
+ const visible = this.fields.filter((f) => !f.hidden && !excluded.has(f.name));
334
+ return (h("form", { key: '6cd71dc417b9a74b5131e9fe34955b4f4cced8a4', onSubmit: this.handleSubmit }, h("slot", { key: 'ef994d53f763fbe954f104a880bc675d60db8b79', name: "header" }), h("div", { key: '930d1f56c0f66e42441ffa57d71bcfdcd94d4677', class: `co-form-layout co-form-layout--${this.layout}` }, visible.map((f) => this.renderField(f))), h("div", { key: '2680a1eb2ddfc67773f247e226c1e8710514550f', class: "co-form-footer" }, h("slot", { key: '0c8adac9743830a4f990a5dfb3d0927ad5185d5f', name: "footer" }, h("co-button", { key: 'a092584e93fb6dd7623f537a4f9792f368454d45', type: "submit", label: "Enviar", variant: "primary" })))));
335
+ }
336
+ renderField(f) {
337
+ var _a;
338
+ // If the consumer provided a slot for this field, let it take over
339
+ // regardless of the kind. Lets external HTML replace any field rendering.
340
+ const slotName = `field:${f.name}`;
341
+ if (this.hasSlotContent(slotName)) {
342
+ return h("slot", { name: slotName });
343
+ }
344
+ const isTouched = !!this.snapshot.touched[f.name];
345
+ const errors = isTouched ? this.snapshot.errors[f.name] || [] : [];
346
+ const status = errors.length > 0 ? 'error' : 'default';
347
+ const helperText = errors[0] || f.helperText;
348
+ const value = this.snapshot.values[f.name];
349
+ const disabled = this.disabled || f.disabled;
350
+ const common = {
351
+ key: f.name,
352
+ label: f.label,
353
+ placeholder: f.placeholder,
354
+ required: f.required,
355
+ disabled,
356
+ status: status,
357
+ helperText: helperText,
358
+ };
359
+ switch (f.kind) {
360
+ case 'text':
361
+ return (h("co-input", Object.assign({}, common, { value: value !== null && value !== void 0 ? value : '', onCoInput: (e) => this.handleFieldChange(f.name, e.detail) })));
362
+ case 'textarea':
363
+ return (h("co-input", Object.assign({}, common, { multiline: true, value: value !== null && value !== void 0 ? value : '', onCoInput: (e) => this.handleFieldChange(f.name, e.detail) })));
364
+ case 'html':
365
+ return (h("co-input", Object.assign({}, common, { multiline: true, value: value !== null && value !== void 0 ? value : '', onCoInput: (e) => this.handleFieldChange(f.name, e.detail) })));
366
+ case 'date':
367
+ return (h("co-input", Object.assign({}, common, { type: "date", value: value !== null && value !== void 0 ? value : '', onCoInput: (e) => this.handleFieldChange(f.name, e.detail) })));
368
+ case 'number':
369
+ return (h("co-number-field", Object.assign({}, common, { value: typeof value === 'number' ? value : undefined, onCoChange: (e) => this.handleFieldChange(f.name, e.detail) })));
370
+ case 'boolean':
371
+ return (h("co-switch", Object.assign({}, common, { checked: !!value, onCoChange: (e) => this.handleFieldChange(f.name, e.detail) })));
372
+ case 'select':
373
+ return (h("co-select", Object.assign({}, common, { options: JSON.stringify(this.optionsFor(f)), value: String(value !== null && value !== void 0 ? value : ''), onCoChange: (e) => this.handleFieldChange(f.name, e.detail) })));
374
+ case 'ref': {
375
+ const refState = (_a = this.refStates[f.name]) !== null && _a !== void 0 ? _a : blankRefState();
376
+ const isMultiple = !!f.originalAttrs.multiple || f.originalAttrs.type === 'array';
377
+ return (h("co-ref-field", Object.assign({}, common, { model: f.originalAttrs.ref, multiple: isMultiple, value: this.refValueAsString(f, value), options: JSON.stringify(refState.options), selectedDisplay: JSON.stringify(refState.selectedDisplay), loading: refState.loading, total: refState.total, onCoOpen: () => {
378
+ // Lazy-load on first open if we haven't fetched yet.
379
+ if (this.refResolver && refState.options.length === 0 && !refState.loading) {
380
+ this.fetchRefPage(f, '', 1, false);
381
+ }
382
+ }, onCoSearch: (e) => this.handleRefSearch(f, e.detail), onCoLoadMore: () => this.handleRefLoadMore(f), onCoChange: (e) => this.handleRefSelect(f, e) })));
383
+ }
384
+ case 'custom':
385
+ default:
386
+ return h("slot", { name: `field:${f.name}` });
387
+ }
388
+ }
389
+ optionsFor(f) {
390
+ const raw = f.originalAttrs.enum;
391
+ if (!Array.isArray(raw))
392
+ return [];
393
+ return raw.map((v) => ({ label: String(v), value: String(v) }));
394
+ }
395
+ static get is() { return "co-form"; }
396
+ static get originalStyleUrls() {
397
+ return {
398
+ "$": ["co-form.css"]
399
+ };
400
+ }
401
+ static get styleUrls() {
402
+ return {
403
+ "$": ["co-form.css"]
404
+ };
405
+ }
406
+ static get properties() {
407
+ return {
408
+ "schema": {
409
+ "type": "string",
410
+ "mutable": false,
411
+ "complexType": {
412
+ "original": "string",
413
+ "resolved": "string",
414
+ "references": {}
415
+ },
416
+ "required": true,
417
+ "optional": false,
418
+ "docs": {
419
+ "tags": [],
420
+ "text": "Raw Mongoose-style schema as a JSON string."
421
+ },
422
+ "getter": false,
423
+ "setter": false,
424
+ "reflect": false,
425
+ "attribute": "schema"
426
+ },
427
+ "initialValues": {
428
+ "type": "string",
429
+ "mutable": false,
430
+ "complexType": {
431
+ "original": "string",
432
+ "resolved": "string | undefined",
433
+ "references": {}
434
+ },
435
+ "required": false,
436
+ "optional": true,
437
+ "docs": {
438
+ "tags": [],
439
+ "text": "Initial field values as a JSON string."
440
+ },
441
+ "getter": false,
442
+ "setter": false,
443
+ "reflect": false,
444
+ "attribute": "initial-values"
445
+ },
446
+ "schemaInstance": {
447
+ "type": "unknown",
448
+ "mutable": false,
449
+ "complexType": {
450
+ "original": "FormSchemaLike",
451
+ "resolved": "FormSchemaLike | undefined",
452
+ "references": {
453
+ "FormSchemaLike": {
454
+ "location": "import",
455
+ "path": "@prolibu-suite/cobalt-form-core",
456
+ "id": "../form-core/dist/index.d.ts::FormSchemaLike",
457
+ "referenceLocation": "FormSchemaLike"
458
+ }
459
+ }
460
+ },
461
+ "required": false,
462
+ "optional": true,
463
+ "docs": {
464
+ "tags": [],
465
+ "text": "Pre-built FormSchemaLike \u2014 assigned as a JS property, bypasses parsing."
466
+ },
467
+ "getter": false,
468
+ "setter": false
469
+ },
470
+ "refResolver": {
471
+ "type": "unknown",
472
+ "mutable": false,
473
+ "complexType": {
474
+ "original": "RefResolver",
475
+ "resolved": "((args: RefResolverArgs) => Promise<RefResolverResult>) | undefined",
476
+ "references": {
477
+ "RefResolver": {
478
+ "location": "import",
479
+ "path": "@prolibu-suite/cobalt-form-core",
480
+ "id": "../form-core/dist/index.d.ts::RefResolver",
481
+ "referenceLocation": "RefResolver"
482
+ }
483
+ }
484
+ },
485
+ "required": false,
486
+ "optional": true,
487
+ "docs": {
488
+ "tags": [],
489
+ "text": "Host-provided resolver for ref fields. Set as a JS property."
490
+ },
491
+ "getter": false,
492
+ "setter": false
493
+ },
494
+ "locale": {
495
+ "type": "string",
496
+ "mutable": false,
497
+ "complexType": {
498
+ "original": "Locale",
499
+ "resolved": "\"en\" | \"es\" | \"pt\"",
500
+ "references": {
501
+ "Locale": {
502
+ "location": "import",
503
+ "path": "@prolibu-suite/cobalt-form-core",
504
+ "id": "../form-core/dist/index.d.ts::Locale",
505
+ "referenceLocation": "Locale"
506
+ }
507
+ }
508
+ },
509
+ "required": false,
510
+ "optional": false,
511
+ "docs": {
512
+ "tags": [],
513
+ "text": "Locale for labels and AJV error messages."
514
+ },
515
+ "getter": false,
516
+ "setter": false,
517
+ "reflect": false,
518
+ "attribute": "locale",
519
+ "defaultValue": "'es'"
520
+ },
521
+ "layout": {
522
+ "type": "string",
523
+ "mutable": false,
524
+ "complexType": {
525
+ "original": "'grid' | 'stack'",
526
+ "resolved": "\"grid\" | \"stack\"",
527
+ "references": {}
528
+ },
529
+ "required": false,
530
+ "optional": false,
531
+ "docs": {
532
+ "tags": [],
533
+ "text": "Layout strategy for the field grid."
534
+ },
535
+ "getter": false,
536
+ "setter": false,
537
+ "reflect": false,
538
+ "attribute": "layout",
539
+ "defaultValue": "'grid'"
540
+ },
541
+ "excludeFields": {
542
+ "type": "string",
543
+ "mutable": false,
544
+ "complexType": {
545
+ "original": "string",
546
+ "resolved": "string | undefined",
547
+ "references": {}
548
+ },
549
+ "required": false,
550
+ "optional": true,
551
+ "docs": {
552
+ "tags": [],
553
+ "text": "Comma-separated list of field names to exclude from rendering."
554
+ },
555
+ "getter": false,
556
+ "setter": false,
557
+ "reflect": false,
558
+ "attribute": "exclude-fields"
559
+ },
560
+ "disabled": {
561
+ "type": "boolean",
562
+ "mutable": false,
563
+ "complexType": {
564
+ "original": "boolean",
565
+ "resolved": "boolean",
566
+ "references": {}
567
+ },
568
+ "required": false,
569
+ "optional": false,
570
+ "docs": {
571
+ "tags": [],
572
+ "text": "Disable all fields."
573
+ },
574
+ "getter": false,
575
+ "setter": false,
576
+ "reflect": false,
577
+ "attribute": "disabled",
578
+ "defaultValue": "false"
579
+ },
580
+ "readOnly": {
581
+ "type": "boolean",
582
+ "mutable": false,
583
+ "complexType": {
584
+ "original": "boolean",
585
+ "resolved": "boolean",
586
+ "references": {}
587
+ },
588
+ "required": false,
589
+ "optional": false,
590
+ "docs": {
591
+ "tags": [],
592
+ "text": "Read-only mode for all fields."
593
+ },
594
+ "getter": false,
595
+ "setter": false,
596
+ "reflect": false,
597
+ "attribute": "read-only",
598
+ "defaultValue": "false"
599
+ }
600
+ };
601
+ }
602
+ static get states() {
603
+ return {
604
+ "snapshot": {},
605
+ "refStates": {}
606
+ };
607
+ }
608
+ static get events() {
609
+ return [{
610
+ "method": "coSubmit",
611
+ "name": "coSubmit",
612
+ "bubbles": true,
613
+ "cancelable": true,
614
+ "composed": true,
615
+ "docs": {
616
+ "tags": [],
617
+ "text": "Emits the payload (refs normalized to `_id`) after a successful submit."
618
+ },
619
+ "complexType": {
620
+ "original": "{ values: Record<string, any> }",
621
+ "resolved": "{ values: Record<string, any>; }",
622
+ "references": {
623
+ "Record": {
624
+ "location": "global",
625
+ "id": "global::Record"
626
+ }
627
+ }
628
+ }
629
+ }, {
630
+ "method": "coChange",
631
+ "name": "coChange",
632
+ "bubbles": true,
633
+ "cancelable": true,
634
+ "composed": true,
635
+ "docs": {
636
+ "tags": [],
637
+ "text": "Emits whenever a field changes."
638
+ },
639
+ "complexType": {
640
+ "original": "{ name: string; value: any }",
641
+ "resolved": "{ name: string; value: any; }",
642
+ "references": {}
643
+ }
644
+ }, {
645
+ "method": "coValidate",
646
+ "name": "coValidate",
647
+ "bubbles": true,
648
+ "cancelable": true,
649
+ "composed": true,
650
+ "docs": {
651
+ "tags": [],
652
+ "text": "Emits validation state changes."
653
+ },
654
+ "complexType": {
655
+ "original": "{ isValid: boolean; errors: Record<string, string[]> }",
656
+ "resolved": "{ isValid: boolean; errors: Record<string, string[]>; }",
657
+ "references": {
658
+ "Record": {
659
+ "location": "global",
660
+ "id": "global::Record"
661
+ }
662
+ }
663
+ }
664
+ }];
665
+ }
666
+ static get methods() {
667
+ return {
668
+ "setValue": {
669
+ "complexType": {
670
+ "signature": "(name: string, value: any) => Promise<void>",
671
+ "parameters": [{
672
+ "name": "name",
673
+ "type": "string",
674
+ "docs": ""
675
+ }, {
676
+ "name": "value",
677
+ "type": "any",
678
+ "docs": ""
679
+ }],
680
+ "references": {
681
+ "Promise": {
682
+ "location": "global",
683
+ "id": "global::Promise"
684
+ }
685
+ },
686
+ "return": "Promise<void>"
687
+ },
688
+ "docs": {
689
+ "text": "Push a value into the controller from outside (e.g. from slot content).",
690
+ "tags": []
691
+ }
692
+ },
693
+ "getValue": {
694
+ "complexType": {
695
+ "signature": "(name: string) => Promise<any>",
696
+ "parameters": [{
697
+ "name": "name",
698
+ "type": "string",
699
+ "docs": ""
700
+ }],
701
+ "references": {
702
+ "Promise": {
703
+ "location": "global",
704
+ "id": "global::Promise"
705
+ }
706
+ },
707
+ "return": "Promise<any>"
708
+ },
709
+ "docs": {
710
+ "text": "Read the current value of a field.",
711
+ "tags": []
712
+ }
713
+ },
714
+ "touch": {
715
+ "complexType": {
716
+ "signature": "(name: string) => Promise<void>",
717
+ "parameters": [{
718
+ "name": "name",
719
+ "type": "string",
720
+ "docs": ""
721
+ }],
722
+ "references": {
723
+ "Promise": {
724
+ "location": "global",
725
+ "id": "global::Promise"
726
+ }
727
+ },
728
+ "return": "Promise<void>"
729
+ },
730
+ "docs": {
731
+ "text": "Mark a field as touched (forces its errors to be visible).",
732
+ "tags": []
733
+ }
734
+ }
735
+ };
736
+ }
737
+ static get elementRef() { return "host"; }
738
+ static get watchers() {
739
+ return [{
740
+ "propName": "schema",
741
+ "methodName": "onSchemaChange"
742
+ }, {
743
+ "propName": "schemaInstance",
744
+ "methodName": "onSchemaChange"
745
+ }, {
746
+ "propName": "locale",
747
+ "methodName": "onSchemaChange"
748
+ }];
749
+ }
750
+ }