@ng-forge/dynamic-forms 0.1.1 → 0.1.3

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 (20) hide show
  1. package/README.md +33 -0
  2. package/fesm2022/ng-forge-dynamic-forms-integration.mjs +269 -0
  3. package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -0
  4. package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms-Dcd04rfS.mjs → ng-forge-dynamic-forms-ng-forge-dynamic-forms-B_676NHl.mjs} +989 -1211
  5. package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-B_676NHl.mjs.map +1 -0
  6. package/fesm2022/{ng-forge-dynamic-forms-page-field.component-DjrahUgb.mjs → ng-forge-dynamic-forms-page-field.component-YHFQcpCS.mjs} +31 -29
  7. package/fesm2022/ng-forge-dynamic-forms-page-field.component-YHFQcpCS.mjs.map +1 -0
  8. package/fesm2022/ng-forge-dynamic-forms-testing-test-button.harness-BenmCFcM.mjs +31 -0
  9. package/fesm2022/ng-forge-dynamic-forms-testing-test-button.harness-BenmCFcM.mjs.map +1 -0
  10. package/fesm2022/ng-forge-dynamic-forms-testing.mjs +968 -0
  11. package/fesm2022/ng-forge-dynamic-forms-testing.mjs.map +1 -0
  12. package/fesm2022/{ng-forge-dynamic-forms-text-field.component-7QVNm95W.mjs → ng-forge-dynamic-forms-text-field.component-CiYq73aF.mjs} +2 -2
  13. package/fesm2022/{ng-forge-dynamic-forms-text-field.component-7QVNm95W.mjs.map → ng-forge-dynamic-forms-text-field.component-CiYq73aF.mjs.map} +1 -1
  14. package/fesm2022/ng-forge-dynamic-forms.mjs +1 -1
  15. package/package.json +17 -3
  16. package/types/ng-forge-dynamic-forms-integration.d.ts +315 -0
  17. package/types/ng-forge-dynamic-forms-testing.d.ts +565 -0
  18. package/types/ng-forge-dynamic-forms.d.ts +353 -549
  19. package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-Dcd04rfS.mjs.map +0 -1
  20. package/fesm2022/ng-forge-dynamic-forms-page-field.component-DjrahUgb.mjs.map +0 -1
@@ -0,0 +1,968 @@
1
+ import { vi } from 'vitest';
2
+ import { NoopLogger, DynamicForm, BUILT_IN_FIELDS, FIELD_SIGNAL_CONTEXT, provideDynamicForm, EventBus, FIELD_REGISTRY } from '@ng-forge/dynamic-forms';
3
+ import { TestBed } from '@angular/core/testing';
4
+ import * as i0 from '@angular/core';
5
+ import { computed, signal, Injector, runInInjectionContext, input, Component, ChangeDetectionStrategy, Injectable } from '@angular/core';
6
+ import { firstValueFrom, race, timer, BehaviorSubject } from 'rxjs';
7
+ import { map } from 'rxjs/operators';
8
+ import { valueFieldMapper, checkboxFieldMapper } from '@ng-forge/dynamic-forms/integration';
9
+ import { form, Field } from '@angular/forms/signals';
10
+
11
+ /**
12
+ * Creates a promise that resolves after the specified delay.
13
+ *
14
+ * Utility function for testing scenarios where you need to wait for
15
+ * asynchronous operations, animations, or timing-dependent behavior.
16
+ *
17
+ * @param ms - Delay in milliseconds (defaults to 0 for next tick)
18
+ * @returns Promise that resolves after the specified delay
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * // Wait for async operations in tests
23
+ * await delay(100);
24
+ * expect(component.isLoaded).toBe(true);
25
+ *
26
+ * // Wait for next tick (micro-task)
27
+ * await delay();
28
+ * fixture.detectChanges();
29
+ * ```
30
+ */
31
+ function delay(ms = 0) {
32
+ return new Promise((resolve) => setTimeout(resolve, ms));
33
+ }
34
+
35
+ /**
36
+ * Creates a mock logger with vitest spies for all methods.
37
+ * Useful for testing code that uses the logger.
38
+ */
39
+ function createMockLogger() {
40
+ return {
41
+ debug: vi.fn(),
42
+ info: vi.fn(),
43
+ warn: vi.fn(),
44
+ error: vi.fn(),
45
+ };
46
+ }
47
+ /**
48
+ * Creates a silent logger that doesn't output anything.
49
+ * Useful for tests where logging output is not relevant.
50
+ */
51
+ function createSilentLogger() {
52
+ return new NoopLogger();
53
+ }
54
+
55
+ /**
56
+ * Fluent API for building form configurations
57
+ */
58
+ class FormConfigBuilder {
59
+ fields = [];
60
+ field(field) {
61
+ this.fields.push(field);
62
+ return this;
63
+ }
64
+ inputField(key, props) {
65
+ return this.field({
66
+ key,
67
+ type: 'input',
68
+ label: key.charAt(0).toUpperCase() + key.slice(1),
69
+ props: { placeholder: `Enter ${key}`, ...props },
70
+ });
71
+ }
72
+ requiredInputField(key, props) {
73
+ const inputField = {
74
+ key,
75
+ type: 'input',
76
+ label: key.charAt(0).toUpperCase() + key.slice(1),
77
+ required: true,
78
+ props: { placeholder: `Enter ${key}`, ...props },
79
+ };
80
+ return this.field(inputField);
81
+ }
82
+ selectField(key, options, props) {
83
+ const selectField = {
84
+ key,
85
+ type: 'select',
86
+ label: key.charAt(0).toUpperCase() + key.slice(1),
87
+ options,
88
+ props: props || {},
89
+ };
90
+ return this.field(selectField);
91
+ }
92
+ checkboxField(key, props) {
93
+ return this.field({
94
+ key,
95
+ type: 'checkbox',
96
+ label: key.charAt(0).toUpperCase() + key.slice(1),
97
+ props: props || {},
98
+ });
99
+ }
100
+ rowField(key, fields) {
101
+ return this.field({
102
+ key,
103
+ type: 'row',
104
+ fields,
105
+ });
106
+ }
107
+ groupField(key, fields) {
108
+ return this.field({
109
+ key,
110
+ type: 'group',
111
+ fields,
112
+ });
113
+ }
114
+ buttonField(key, props) {
115
+ return this.field({
116
+ key,
117
+ type: 'button',
118
+ label: key.charAt(0).toUpperCase() + key.slice(1),
119
+ props: props || {},
120
+ });
121
+ }
122
+ pageField(key, fields, title) {
123
+ const pageFields = title ? [{ key: `${key}-title`, type: 'text', label: title }, ...fields] : fields;
124
+ return this.field({
125
+ key,
126
+ type: 'page',
127
+ fields: pageFields,
128
+ });
129
+ }
130
+ build() {
131
+ return { fields: this.fields };
132
+ }
133
+ }
134
+ /**
135
+ * Utility class for testing dynamic forms
136
+ */
137
+ class DynamicFormTestUtils {
138
+ /**
139
+ * Creates a new form config builder
140
+ */
141
+ static builder() {
142
+ return new FormConfigBuilder();
143
+ }
144
+ /**
145
+ * Creates a dynamic form test setup with optional test field registration
146
+ */
147
+ static async createTest(testConfig) {
148
+ const fixture = TestBed.createComponent(DynamicForm);
149
+ const component = fixture.componentInstance;
150
+ // Access fieldRegistry from the component instance (injected by Angular DI)
151
+ const fieldRegistry = component['fieldRegistry'];
152
+ // Register test fields if requested
153
+ if (testConfig.registerTestFields !== false) {
154
+ DynamicFormTestUtils.registerTestFields(fieldRegistry);
155
+ }
156
+ // Set up the component - use 'dynamic-form' as the input name since config uses alias: 'dynamic-form'
157
+ fixture.componentRef.setInput('dynamic-form', testConfig.config);
158
+ if (testConfig.initialValue !== undefined) {
159
+ fixture.componentRef.setInput('value', testConfig.initialValue);
160
+ }
161
+ fixture.detectChanges();
162
+ await DynamicFormTestUtils.waitForInit(fixture);
163
+ return {
164
+ component: component,
165
+ fixture: fixture,
166
+ };
167
+ }
168
+ /**
169
+ * Registers common test field types including built-in types like page, row, group
170
+ * @internal
171
+ */
172
+ static registerTestFields(fieldRegistry) {
173
+ // Input field mapper that extends value field mapper (returns Signal)
174
+ const inputMapper = (fieldDef) => {
175
+ const baseInputsSignal = valueFieldMapper(fieldDef);
176
+ // Return computed signal that adds input-specific inputs
177
+ return computed(() => ({
178
+ ...baseInputsSignal(),
179
+ type: fieldDef.props?.['type'] || 'text',
180
+ placeholder: fieldDef.props?.['placeholder'] || '',
181
+ }));
182
+ };
183
+ // Select field mapper that extends value field mapper (returns Signal)
184
+ const selectMapper = (fieldDef) => {
185
+ const baseInputsSignal = valueFieldMapper(fieldDef);
186
+ // Return computed signal that adds select-specific inputs
187
+ return computed(() => ({
188
+ ...baseInputsSignal(),
189
+ options: fieldDef.options || [],
190
+ }));
191
+ };
192
+ // Checkbox field mapper - uses checked instead of value (already returns Signal)
193
+ const checkboxMapper = (fieldDef) => {
194
+ return checkboxFieldMapper(fieldDef);
195
+ };
196
+ // Button field mapper that extends value field mapper (already returns Signal)
197
+ const buttonMapper = (fieldDef) => {
198
+ return valueFieldMapper(fieldDef);
199
+ };
200
+ // Register built-in fields first (page, row, group)
201
+ fieldRegistry.registerTypes(BUILT_IN_FIELDS);
202
+ // Then register test field types
203
+ fieldRegistry.registerTypes([
204
+ {
205
+ name: 'input',
206
+ loadComponent: () => Promise.resolve().then(function () { return testInput_harness; }),
207
+ mapper: inputMapper,
208
+ },
209
+ {
210
+ name: 'select',
211
+ loadComponent: () => Promise.resolve().then(function () { return testSelect_harness; }),
212
+ mapper: selectMapper,
213
+ },
214
+ {
215
+ name: 'checkbox',
216
+ loadComponent: () => Promise.resolve().then(function () { return testCheckbox_harness; }),
217
+ mapper: checkboxMapper,
218
+ },
219
+ {
220
+ name: 'button',
221
+ loadComponent: () => import('./ng-forge-dynamic-forms-testing-test-button.harness-BenmCFcM.mjs'),
222
+ mapper: buttonMapper,
223
+ },
224
+ ]);
225
+ }
226
+ /**
227
+ * Waits for the dynamic form to initialize.
228
+ * Uses the initialized$ observable directly which has shareReplay for late subscribers.
229
+ * @param fixture - The component fixture
230
+ * @param timeoutMs - Maximum time to wait for initialization (default: 100ms)
231
+ */
232
+ static async waitForInit(fixture, timeoutMs = 100) {
233
+ const component = fixture.componentInstance;
234
+ // Trigger initial change detection
235
+ fixture.detectChanges();
236
+ TestBed.flushEffects();
237
+ // Use the initialized$ observable directly (with shareReplay) for proper replay behavior
238
+ // Race against a timeout to prevent hanging if initialization already happened
239
+ await firstValueFrom(race(component.initialized$.pipe(map(() => true)), timer(timeoutMs).pipe(map(() => false))));
240
+ // Stabilization cycles for async components
241
+ for (let i = 0; i < 2; i++) {
242
+ TestBed.flushEffects();
243
+ fixture.detectChanges();
244
+ await delay(0);
245
+ }
246
+ await fixture.whenStable();
247
+ TestBed.flushEffects();
248
+ fixture.detectChanges();
249
+ }
250
+ /**
251
+ * Waits for an element to appear in the DOM with retries
252
+ */
253
+ static async waitForElement(fixture, selector, maxAttempts = 10) {
254
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
255
+ const element = fixture.nativeElement.querySelector(selector);
256
+ if (element) {
257
+ return element;
258
+ }
259
+ // Wait and retry
260
+ TestBed.flushEffects();
261
+ fixture.detectChanges();
262
+ await delay(50);
263
+ }
264
+ throw new Error(`[Dynamic Forms] Element not found with selector: ${selector} after ${maxAttempts} attempts`);
265
+ }
266
+ /**
267
+ * Simulates user input on a field element
268
+ */
269
+ static async simulateInput(fixture, selector, value) {
270
+ const input = await DynamicFormTestUtils.waitForElement(fixture, selector);
271
+ input.value = value;
272
+ input.dispatchEvent(new Event('input', { bubbles: true }));
273
+ fixture.detectChanges();
274
+ await delay(0);
275
+ }
276
+ /**
277
+ * Simulates user blur on a field element
278
+ */
279
+ static async simulateBlur(fixture, selector) {
280
+ const element = await DynamicFormTestUtils.waitForElement(fixture, selector);
281
+ element.dispatchEvent(new Event('blur', { bubbles: true }));
282
+ fixture.detectChanges();
283
+ await delay(0);
284
+ }
285
+ /**
286
+ * Simulates user selection on a select element
287
+ */
288
+ static async simulateSelect(fixture, selector, value) {
289
+ const select = await DynamicFormTestUtils.waitForElement(fixture, selector);
290
+ select.value = value;
291
+ select.dispatchEvent(new Event('change', { bubbles: true }));
292
+ fixture.detectChanges();
293
+ await delay(0);
294
+ }
295
+ /**
296
+ * Simulates checkbox toggle
297
+ */
298
+ static async simulateCheckbox(fixture, selector, checked) {
299
+ const checkbox = await DynamicFormTestUtils.waitForElement(fixture, selector);
300
+ checkbox.checked = checked;
301
+ checkbox.dispatchEvent(new Event('input', { bubbles: true }));
302
+ checkbox.dispatchEvent(new Event('change', { bubbles: true }));
303
+ fixture.detectChanges();
304
+ await delay(0);
305
+ }
306
+ /**
307
+ * Simulates button click
308
+ */
309
+ static async simulateButtonClick(fixture, selector) {
310
+ const button = await DynamicFormTestUtils.waitForElement(fixture, selector);
311
+ button.click();
312
+ fixture.detectChanges();
313
+ await delay(0);
314
+ }
315
+ /**
316
+ * Gets the current form value from the component
317
+ */
318
+ static getFormValue(component) {
319
+ return component.formValue();
320
+ }
321
+ /**
322
+ * Gets validation errors from the component
323
+ */
324
+ static getFormErrors(component) {
325
+ return component.errors();
326
+ }
327
+ /**
328
+ * Checks if the form is valid
329
+ */
330
+ static isFormValid(component) {
331
+ return component.valid();
332
+ }
333
+ /**
334
+ * Gets all field elements from the fixture
335
+ */
336
+ static getFieldElements(fixture, fieldType) {
337
+ return fixture.nativeElement.querySelectorAll(`df-test-${fieldType}`);
338
+ }
339
+ /**
340
+ * Asserts that a field has a specific value
341
+ */
342
+ static async assertFieldValue(fixture, fieldSelector, expectedValue) {
343
+ const element = await DynamicFormTestUtils.waitForElement(fixture, fieldSelector);
344
+ const actualValue = element.type === 'checkbox' ? element.checked.toString() : element.value;
345
+ if (actualValue !== expectedValue) {
346
+ throw new Error(`[Dynamic Forms] Expected field value to be "${expectedValue}", but got "${actualValue}"`);
347
+ }
348
+ }
349
+ /**
350
+ * Asserts that the form has a specific value
351
+ */
352
+ static assertFormValue(component, expectedValue) {
353
+ const actualValue = component.formValue();
354
+ if (JSON.stringify(actualValue) !== JSON.stringify(expectedValue)) {
355
+ throw new Error(`[Dynamic Forms] Expected form value to be ${JSON.stringify(expectedValue)}, but got ${JSON.stringify(actualValue)}`);
356
+ }
357
+ }
358
+ }
359
+
360
+ /**
361
+ * Creates a test injector with FIELD_SIGNAL_CONTEXT provided.
362
+ *
363
+ * This utility simplifies testing of mappers and components that inject FIELD_SIGNAL_CONTEXT.
364
+ *
365
+ * @example
366
+ * ```typescript
367
+ * // Basic usage
368
+ * const testInjector = createTestFormInjector();
369
+ *
370
+ * // With custom initial value
371
+ * const testInjector = createTestFormInjector({
372
+ * initialValue: { username: 'test' }
373
+ * });
374
+ *
375
+ * // With validation messages
376
+ * const testInjector = createTestFormInjector({
377
+ * defaultValidationMessages: { required: 'This field is required' }
378
+ * });
379
+ * ```
380
+ */
381
+ function createTestFormInjector(config = {}) {
382
+ const { parentInjector, initialValue = {}, defaultValues = () => initialValue, defaultValidationMessages, valueSignal, form: customForm, } = config;
383
+ // Create value signal
384
+ const value = valueSignal ?? signal(initialValue);
385
+ // Create form instance in injection context
386
+ let formInstance;
387
+ if (customForm) {
388
+ formInstance = customForm;
389
+ }
390
+ else {
391
+ const tempInjector = parentInjector || Injector.create({ providers: [] });
392
+ formInstance = runInInjectionContext(tempInjector, () => form(value));
393
+ }
394
+ // Create field signal context
395
+ const fieldSignalContext = {
396
+ injector: parentInjector || Injector.create({ providers: [] }),
397
+ value,
398
+ defaultValues,
399
+ form: formInstance,
400
+ defaultValidationMessages,
401
+ };
402
+ // Create injector with context
403
+ return Injector.create({
404
+ parent: parentInjector,
405
+ providers: [
406
+ {
407
+ provide: FIELD_SIGNAL_CONTEXT,
408
+ useValue: fieldSignalContext,
409
+ },
410
+ ],
411
+ });
412
+ }
413
+ /**
414
+ * Runs a mapper function in a test injection context.
415
+ *
416
+ * This is a convenience wrapper that creates a test injector and runs the mapper
417
+ * function within it, returning the result.
418
+ *
419
+ * @example
420
+ * ```typescript
421
+ * // Test a mapper without context overrides
422
+ * const bindings = testMapper(() => mapValueField(fieldDef));
423
+ *
424
+ * // Test a mapper with custom context
425
+ * const bindings = testMapper(
426
+ * () => mapValueField(fieldDef),
427
+ * { initialValue: { username: 'test' } }
428
+ * );
429
+ *
430
+ * // Test a mapper with validation messages
431
+ * const bindings = testMapper(
432
+ * () => mapValueField(fieldDef),
433
+ * { defaultValidationMessages: { required: 'Required field' } }
434
+ * );
435
+ * ```
436
+ */
437
+ function testMapper(mapperFn, context) {
438
+ const testInjector = createTestFormInjector(context);
439
+ return runInInjectionContext(testInjector, mapperFn);
440
+ }
441
+ /**
442
+ * Creates a field signal context for testing without creating an injector.
443
+ *
444
+ * Useful when you need to manually provide the context or test context creation logic.
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const context = createTestFieldContext({
449
+ * initialValue: { name: 'test' }
450
+ * });
451
+ *
452
+ * // Use in your own injector
453
+ * const injector = Injector.create({
454
+ * providers: [
455
+ * { provide: FIELD_SIGNAL_CONTEXT, useValue: context }
456
+ * ]
457
+ * });
458
+ * ```
459
+ */
460
+ function createTestFieldContext(config = {}) {
461
+ const { parentInjector, initialValue = {}, defaultValues = () => initialValue, defaultValidationMessages, valueSignal, form: customForm, } = config;
462
+ const injector = parentInjector || Injector.create({ providers: [] });
463
+ const value = valueSignal ?? signal(initialValue);
464
+ let formInstance;
465
+ if (customForm) {
466
+ formInstance = customForm;
467
+ }
468
+ else {
469
+ formInstance = runInInjectionContext(injector, () => form(value));
470
+ }
471
+ return {
472
+ injector,
473
+ value,
474
+ defaultValues,
475
+ form: formInstance,
476
+ defaultValidationMessages,
477
+ };
478
+ }
479
+
480
+ /**
481
+ * Fluent API for building form configurations using existing field structure
482
+ */
483
+ class TestFormConfigBuilder {
484
+ fields = [];
485
+ field(field) {
486
+ this.fields.push(field);
487
+ return this;
488
+ }
489
+ inputField(key, props) {
490
+ return this.field({
491
+ key,
492
+ type: 'input',
493
+ label: key.charAt(0).toUpperCase() + key.slice(1),
494
+ ...props,
495
+ });
496
+ }
497
+ requiredInputField(key, props) {
498
+ return this.inputField(key, { required: true, ...props });
499
+ }
500
+ checkboxField(key, props) {
501
+ return this.field({
502
+ key,
503
+ type: 'checkbox',
504
+ label: key.charAt(0).toUpperCase() + key.slice(1),
505
+ ...props,
506
+ });
507
+ }
508
+ build() {
509
+ return { fields: this.fields };
510
+ }
511
+ }
512
+ /**
513
+ * Simple utility class for testing dynamic forms
514
+ */
515
+ class SimpleTestUtils {
516
+ /**
517
+ * Creates a new form config builder
518
+ */
519
+ static builder() {
520
+ return new TestFormConfigBuilder();
521
+ }
522
+ /**
523
+ * Creates a simple test component - assumes TestBed is already configured
524
+ */
525
+ static createComponent(config = { fields: [] }, initialValue) {
526
+ const fixture = TestBed.createComponent(DynamicForm);
527
+ const component = fixture.componentInstance;
528
+ // Use 'dynamic-form' as the input name since config uses alias: 'dynamic-form'
529
+ fixture.componentRef.setInput('dynamic-form', config);
530
+ if (initialValue !== undefined) {
531
+ fixture.componentRef.setInput('value', initialValue);
532
+ }
533
+ fixture.detectChanges();
534
+ TestBed.flushEffects();
535
+ return { component, fixture };
536
+ }
537
+ /**
538
+ * Waits for the dynamic form to initialize
539
+ */
540
+ static async waitForInit(fixture) {
541
+ await delay(0);
542
+ fixture.detectChanges();
543
+ TestBed.flushEffects();
544
+ await delay(0);
545
+ }
546
+ /**
547
+ * Simulates user input on a field element
548
+ */
549
+ static async simulateInput(fixture, selector, value) {
550
+ const input = fixture.nativeElement.querySelector(selector);
551
+ if (!input) {
552
+ throw new Error(`[Dynamic Forms] Input element not found with selector: ${selector}`);
553
+ }
554
+ input.value = value;
555
+ input.dispatchEvent(new Event('input', { bubbles: true }));
556
+ fixture.detectChanges();
557
+ await delay(0);
558
+ }
559
+ /**
560
+ * Simulates checkbox toggle
561
+ */
562
+ static async simulateCheckbox(fixture, selector, checked) {
563
+ const checkbox = fixture.nativeElement.querySelector(selector);
564
+ if (!checkbox) {
565
+ throw new Error(`[Dynamic Forms] Checkbox element not found with selector: ${selector}`);
566
+ }
567
+ checkbox.checked = checked;
568
+ checkbox.dispatchEvent(new Event('change', { bubbles: true }));
569
+ fixture.detectChanges();
570
+ await delay(0);
571
+ }
572
+ /**
573
+ * Gets the current form value from the component
574
+ */
575
+ static getFormValue(component) {
576
+ return component.formValue();
577
+ }
578
+ /**
579
+ * Checks if the form is valid
580
+ */
581
+ static isFormValid(component) {
582
+ return component.valid();
583
+ }
584
+ /**
585
+ * Asserts that the form has a specific value
586
+ */
587
+ static assertFormValue(component, expectedValue) {
588
+ const actualValue = component.formValue();
589
+ if (JSON.stringify(actualValue) !== JSON.stringify(expectedValue)) {
590
+ throw new Error(`[Dynamic Forms] Expected form value to be ${JSON.stringify(expectedValue)}, but got ${JSON.stringify(actualValue)}`);
591
+ }
592
+ }
593
+ }
594
+ // Mock field component for testing
595
+ // Includes all inputs that baseFieldMapper and valueFieldMapper might create bindings for
596
+ class TestFieldComponent {
597
+ value = signal('test', ...(ngDevMode ? [{ debugName: "value" }] : []));
598
+ // Required inputs from baseFieldMapper
599
+ key = input('', ...(ngDevMode ? [{ debugName: "key" }] : []));
600
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
601
+ className = input('', ...(ngDevMode ? [{ debugName: "className" }] : []));
602
+ tabIndex = input(undefined, ...(ngDevMode ? [{ debugName: "tabIndex" }] : []));
603
+ props = input(undefined, ...(ngDevMode ? [{ debugName: "props" }] : []));
604
+ placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
605
+ // Array-related inputs
606
+ fields = input([], ...(ngDevMode ? [{ debugName: "fields" }] : []));
607
+ arrayContext = input(undefined, ...(ngDevMode ? [{ debugName: "arrayContext" }] : []));
608
+ // Validation inputs from valueFieldMapper
609
+ validationMessages = input(undefined, ...(ngDevMode ? [{ debugName: "validationMessages" }] : []));
610
+ defaultValidationMessages = input(undefined, ...(ngDevMode ? [{ debugName: "defaultValidationMessages" }] : []));
611
+ field = input(undefined, ...(ngDevMode ? [{ debugName: "field" }] : []));
612
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
613
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.5", type: TestFieldComponent, isStandalone: true, selector: "df-test-field", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, arrayContext: { classPropertyName: "arrayContext", publicName: "arrayContext", isSignal: true, isRequired: false, transformFunction: null }, validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, defaultValidationMessages: { classPropertyName: "defaultValidationMessages", publicName: "defaultValidationMessages", isSignal: true, isRequired: false, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '<div>Test Field: {{ value() }}</div>', isInline: true });
614
+ }
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestFieldComponent, decorators: [{
616
+ type: Component,
617
+ args: [{
618
+ selector: 'df-test-field',
619
+ template: '<div>Test Field: {{ value() }}</div>',
620
+ }]
621
+ }], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], arrayContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrayContext", required: false }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], defaultValidationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValidationMessages", required: false }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }] } });
622
+ /**
623
+ * Creates a simple test setup for individual field components
624
+ */
625
+ function setupSimpleTest(componentType, config) {
626
+ const mockFieldType = {
627
+ name: 'test',
628
+ loadComponent: async () => TestFieldComponent,
629
+ mapper: () => computed(() => ({})), // Simple mapper that returns empty inputs signal for testing
630
+ };
631
+ TestBed.configureTestingModule({
632
+ imports: [componentType],
633
+ providers: [
634
+ provideDynamicForm(),
635
+ EventBus,
636
+ {
637
+ provide: FIELD_REGISTRY,
638
+ useValue: new Map([['test', mockFieldType]]),
639
+ },
640
+ {
641
+ provide: FIELD_SIGNAL_CONTEXT,
642
+ useFactory: (injector) => {
643
+ // Create test context using factory
644
+ return runInInjectionContext(injector, () => {
645
+ const valueSignal = signal(config.value || {}, ...(ngDevMode ? [{ debugName: "valueSignal" }] : []));
646
+ const formInstance = form(valueSignal);
647
+ return {
648
+ injector,
649
+ value: valueSignal,
650
+ defaultValues: () => (config.value || {}),
651
+ form: formInstance,
652
+ defaultValidationMessages: undefined,
653
+ };
654
+ });
655
+ },
656
+ deps: [Injector],
657
+ },
658
+ ],
659
+ });
660
+ const fixture = TestBed.createComponent(componentType);
661
+ const component = fixture.componentInstance;
662
+ fixture.componentRef.setInput('field', config.field);
663
+ fixture.componentRef.setInput('key', config.field.key);
664
+ if (config.value !== undefined) {
665
+ fixture.componentRef.setInput('value', config.value);
666
+ }
667
+ if (config.pageIndex !== undefined) {
668
+ fixture.componentRef.setInput('pageIndex', config.pageIndex);
669
+ }
670
+ if (config.isVisible !== undefined) {
671
+ fixture.componentRef.setInput('isVisible', config.isVisible);
672
+ }
673
+ // Set any additional inputs provided in config
674
+ Object.keys(config).forEach((key) => {
675
+ if (!['field', 'value', 'pageIndex', 'isVisible'].includes(key) && config[key] !== undefined) {
676
+ fixture.componentRef.setInput(key, config[key]);
677
+ }
678
+ });
679
+ fixture.detectChanges();
680
+ return { component, fixture };
681
+ }
682
+ /**
683
+ * Creates a simple test field definition
684
+ */
685
+ function createSimpleTestField(key, label) {
686
+ return {
687
+ key,
688
+ type: 'test',
689
+ label,
690
+ };
691
+ }
692
+
693
+ class TestInputHarness {
694
+ field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
695
+ key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
696
+ // Field-specific properties
697
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
698
+ placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
699
+ type = input('text', ...(ngDevMode ? [{ debugName: "type" }] : []));
700
+ props = input({}, ...(ngDevMode ? [{ debugName: "props" }] : []));
701
+ className = input('', ...(ngDevMode ? [{ debugName: "className" }] : []));
702
+ validationMessages = input(...(ngDevMode ? [undefined, { debugName: "validationMessages" }] : []));
703
+ defaultValidationMessages = input(...(ngDevMode ? [undefined, { debugName: "defaultValidationMessages" }] : []));
704
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestInputHarness, deps: [], target: i0.ɵɵFactoryTarget.Component });
705
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.5", type: TestInputHarness, isStandalone: true, selector: "df-test-input", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, defaultValidationMessages: { classPropertyName: "defaultValidationMessages", publicName: "defaultValidationMessages", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<input [type]="type()" [field]="field()" />`, isInline: true, dependencies: [{ kind: "directive", type: Field, selector: "[field]", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
706
+ }
707
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestInputHarness, decorators: [{
708
+ type: Component,
709
+ args: [{
710
+ selector: 'df-test-input',
711
+ template: `<input [type]="type()" [field]="field()" />`,
712
+ changeDetection: ChangeDetectionStrategy.OnPush,
713
+ imports: [Field],
714
+ }]
715
+ }], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], defaultValidationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValidationMessages", required: false }] }] } });
716
+
717
+ var testInput_harness = /*#__PURE__*/Object.freeze({
718
+ __proto__: null,
719
+ default: TestInputHarness
720
+ });
721
+
722
+ class TestCheckboxHarness {
723
+ field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
724
+ key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
725
+ // Field-specific properties
726
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
727
+ props = input({}, ...(ngDevMode ? [{ debugName: "props" }] : []));
728
+ className = input('', ...(ngDevMode ? [{ debugName: "className" }] : []));
729
+ validationMessages = input(...(ngDevMode ? [undefined, { debugName: "validationMessages" }] : []));
730
+ defaultValidationMessages = input(...(ngDevMode ? [undefined, { debugName: "defaultValidationMessages" }] : []));
731
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestCheckboxHarness, deps: [], target: i0.ɵɵFactoryTarget.Component });
732
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.5", type: TestCheckboxHarness, isStandalone: true, selector: "df-test-checkbox", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, defaultValidationMessages: { classPropertyName: "defaultValidationMessages", publicName: "defaultValidationMessages", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ` <input type="checkbox" [field]="field()" /> `, isInline: true, dependencies: [{ kind: "directive", type: Field, selector: "[field]", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
733
+ }
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestCheckboxHarness, decorators: [{
735
+ type: Component,
736
+ args: [{
737
+ selector: 'df-test-checkbox',
738
+ template: ` <input type="checkbox" [field]="field()" /> `,
739
+ changeDetection: ChangeDetectionStrategy.OnPush,
740
+ imports: [Field],
741
+ }]
742
+ }], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], defaultValidationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValidationMessages", required: false }] }] } });
743
+
744
+ var testCheckbox_harness = /*#__PURE__*/Object.freeze({
745
+ __proto__: null,
746
+ default: TestCheckboxHarness
747
+ });
748
+
749
+ /**
750
+ * Test harness component for select fields
751
+ */
752
+ class TestSelectHarness {
753
+ field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
754
+ key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
755
+ // Field-specific properties
756
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
757
+ options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
758
+ className = input('', ...(ngDevMode ? [{ debugName: "className" }] : []));
759
+ tabIndex = input(undefined, ...(ngDevMode ? [{ debugName: "tabIndex" }] : []));
760
+ hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : []));
761
+ readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
762
+ props = input({}, ...(ngDevMode ? [{ debugName: "props" }] : []));
763
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestSelectHarness, deps: [], target: i0.ɵɵFactoryTarget.Component });
764
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.5", type: TestSelectHarness, isStandalone: true, selector: "df-test-select", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
765
+ @let f = field();
766
+ <select [field]="f">
767
+ <option value="">Select...</option>
768
+ @for (option of options(); track option.value) {
769
+ <option [value]="option.value">{{ option.label }}</option>
770
+ }
771
+ </select>
772
+ `, isInline: true, dependencies: [{ kind: "directive", type: Field, selector: "[field]", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
773
+ }
774
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: TestSelectHarness, decorators: [{
775
+ type: Component,
776
+ args: [{
777
+ selector: 'df-test-select',
778
+ template: `
779
+ @let f = field();
780
+ <select [field]="f">
781
+ <option value="">Select...</option>
782
+ @for (option of options(); track option.value) {
783
+ <option [value]="option.value">{{ option.label }}</option>
784
+ }
785
+ </select>
786
+ `,
787
+ changeDetection: ChangeDetectionStrategy.OnPush,
788
+ imports: [Field],
789
+ }]
790
+ }], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
791
+
792
+ var testSelect_harness = /*#__PURE__*/Object.freeze({
793
+ __proto__: null,
794
+ default: TestSelectHarness
795
+ });
796
+
797
+ /**
798
+ * Fake translation service for testing dynamic text functionality.
799
+ * Provides Observable-based translation methods with language switching simulation.
800
+ *
801
+ * @example
802
+ * ```typescript
803
+ * TestBed.configureTestingModule({
804
+ * providers: [
805
+ * { provide: TranslationService, useClass: FakeTranslationService }
806
+ * ]
807
+ * });
808
+ *
809
+ * const service = TestBed.inject(FakeTranslationService);
810
+ * service.setTranslations({
811
+ * 'form.username.label': 'Username',
812
+ * 'validation.required': 'This field is required'
813
+ * });
814
+ * ```
815
+ *
816
+ * @public
817
+ */
818
+ class FakeTranslationService {
819
+ translations = new BehaviorSubject({});
820
+ currentLanguage = signal('en', ...(ngDevMode ? [{ debugName: "currentLanguage" }] : []));
821
+ /**
822
+ * Set the translation dictionary
823
+ */
824
+ setTranslations(translations) {
825
+ this.translations.next(translations);
826
+ }
827
+ /**
828
+ * Add translations to the existing dictionary
829
+ */
830
+ addTranslations(translations) {
831
+ const current = this.translations.value;
832
+ this.translations.next({ ...current, ...translations });
833
+ }
834
+ /**
835
+ * Simulate language change
836
+ */
837
+ setLanguage(language) {
838
+ this.currentLanguage.set(language);
839
+ // Trigger translation updates by emitting current translations
840
+ this.translations.next(this.translations.value);
841
+ }
842
+ /**
843
+ * Get current language as signal
844
+ */
845
+ getLanguage() {
846
+ return this.currentLanguage;
847
+ }
848
+ /**
849
+ * Translate a key and return an Observable
850
+ * Supports parameter interpolation using {{param}} syntax
851
+ */
852
+ translate(key, params) {
853
+ return this.translations.pipe(map((translations) => {
854
+ const translatedValue = translations[key] || key;
855
+ return this.interpolateParams(translatedValue, params);
856
+ }));
857
+ }
858
+ /**
859
+ * Get instant translation (synchronous)
860
+ * Supports parameter interpolation using {{param}} syntax
861
+ */
862
+ instant(key, params) {
863
+ const translations = this.translations.value;
864
+ const translatedValue = translations[key] || key;
865
+ return this.interpolateParams(translatedValue, params);
866
+ }
867
+ /**
868
+ * Simulate translation for validation errors
869
+ * Uses validation.${errorKind} pattern
870
+ */
871
+ translateValidationError(errorKind, params) {
872
+ const key = `validation.${errorKind}`;
873
+ return this.translate(key, params);
874
+ }
875
+ /**
876
+ * Get all current translations
877
+ */
878
+ getTranslations() {
879
+ return this.translations.value;
880
+ }
881
+ /**
882
+ * Clear all translations
883
+ */
884
+ clearTranslations() {
885
+ this.translations.next({});
886
+ }
887
+ interpolateParams(template, params) {
888
+ if (!params) {
889
+ return template;
890
+ }
891
+ let result = template;
892
+ Object.entries(params).forEach(([key, value]) => {
893
+ const placeholder = new RegExp(`{{\\s*${key}\\s*}}`, 'g');
894
+ result = result.replace(placeholder, String(value));
895
+ });
896
+ return result;
897
+ }
898
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: FakeTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
899
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: FakeTranslationService, providedIn: 'root' });
900
+ }
901
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: FakeTranslationService, decorators: [{
902
+ type: Injectable,
903
+ args: [{
904
+ providedIn: 'root',
905
+ }]
906
+ }] });
907
+ /**
908
+ * Default translations for common form fields and validation messages
909
+ * Useful for quick testing setup
910
+ */
911
+ const DEFAULT_TEST_TRANSLATIONS = {
912
+ // Form field labels
913
+ 'form.username.label': 'Username',
914
+ 'form.email.label': 'Email Address',
915
+ 'form.password.label': 'Password',
916
+ 'form.firstName.label': 'First Name',
917
+ 'form.lastName.label': 'Last Name',
918
+ 'form.phone.label': 'Phone Number',
919
+ 'form.address.label': 'Address',
920
+ // Form field placeholders
921
+ 'form.username.placeholder': 'Enter your username',
922
+ 'form.email.placeholder': 'Enter your email address',
923
+ 'form.password.placeholder': 'Enter your password',
924
+ // Validation messages
925
+ 'validation.required': 'This field is required',
926
+ 'validation.email': 'Please enter a valid email address',
927
+ 'validation.min': 'Value must be at least {{min}}',
928
+ 'validation.max': 'Value must be at most {{max}}',
929
+ 'validation.minLength': 'Must be at least {{requiredLength}} characters',
930
+ 'validation.maxLength': 'Must be at most {{requiredLength}} characters',
931
+ 'validation.pattern': 'Invalid format',
932
+ // Button labels
933
+ 'buttons.submit': 'Submit',
934
+ 'buttons.cancel': 'Cancel',
935
+ 'buttons.save': 'Save',
936
+ 'buttons.delete': 'Delete',
937
+ 'buttons.edit': 'Edit',
938
+ // Multi-language examples for testing language switching
939
+ greeting: 'Hello',
940
+ goodbye: 'Goodbye',
941
+ };
942
+ /**
943
+ * Alternative translations for testing language switching
944
+ */
945
+ const SPANISH_TEST_TRANSLATIONS = {
946
+ 'form.username.label': 'Nombre de usuario',
947
+ 'form.email.label': 'Dirección de correo electrónico',
948
+ 'form.password.label': 'Contraseña',
949
+ 'validation.required': 'Este campo es obligatorio',
950
+ 'validation.email': 'Por favor ingrese una dirección de correo válida',
951
+ greeting: 'Hola',
952
+ goodbye: 'Adiós',
953
+ };
954
+ /**
955
+ * Test utility to create a configured FakeTranslationService with default translations
956
+ */
957
+ function createTestTranslationService(initialTranslations = DEFAULT_TEST_TRANSLATIONS) {
958
+ const service = new FakeTranslationService();
959
+ service.setTranslations(initialTranslations);
960
+ return service;
961
+ }
962
+
963
+ /**
964
+ * Generated bundle index. Do not edit.
965
+ */
966
+
967
+ export { DEFAULT_TEST_TRANSLATIONS, DynamicFormTestUtils, FakeTranslationService, FormConfigBuilder, SPANISH_TEST_TRANSLATIONS, TestFormConfigBuilder as SimpleFormConfigBuilder, SimpleTestUtils, TestCheckboxHarness as TestCheckboxHarnessComponent, TestFieldComponent, TestInputHarness as TestInputHarnessComponent, TestSelectHarness as TestSelectHarnessComponent, createMockLogger, createSilentLogger, createSimpleTestField, createTestFieldContext, createTestFormInjector, createTestTranslationService, delay, setupSimpleTest, testMapper };
968
+ //# sourceMappingURL=ng-forge-dynamic-forms-testing.mjs.map