@ng-forge/dynamic-forms 1.2.0-next.4 → 1.2.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/fesm2022/{ng-forge-dynamic-forms-array-field.component-BLPWSurR.mjs → ng-forge-dynamic-forms-array-field.component-NTHLPjau.mjs} +2 -2
- package/fesm2022/{ng-forge-dynamic-forms-array-field.component-BLPWSurR.mjs.map → ng-forge-dynamic-forms-array-field.component-NTHLPjau.mjs.map} +1 -1
- package/fesm2022/{ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-jHiY95pr.mjs → ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-CNCeWAeJ.mjs} +2 -2
- package/fesm2022/{ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-jHiY95pr.mjs.map → ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-CNCeWAeJ.mjs.map} +1 -1
- package/fesm2022/{ng-forge-dynamic-forms-container-field.component-ug5tp6kt.mjs → ng-forge-dynamic-forms-container-field.component-ByGdzAsk.mjs} +5 -4
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-ByGdzAsk.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-field-errors-wrapper.component-ZdaC4Bit.mjs +25 -0
- package/fesm2022/ng-forge-dynamic-forms-field-errors-wrapper.component-ZdaC4Bit.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-group-field.component-DyD00a1U.mjs → ng-forge-dynamic-forms-group-field.component-DnLZdj8v.mjs} +2 -2
- package/fesm2022/{ng-forge-dynamic-forms-group-field.component-DyD00a1U.mjs.map → ng-forge-dynamic-forms-group-field.component-DnLZdj8v.mjs.map} +1 -1
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs +10 -72
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs +221 -91
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs.map +1 -1
- package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms-BGRxIQ2V.mjs → ng-forge-dynamic-forms-ng-forge-dynamic-forms-B2C_WAMP.mjs} +127 -40
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-B2C_WAMP.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-page-field.component-B7A2v1vN.mjs → ng-forge-dynamic-forms-page-field.component-CwH22lRl.mjs} +2 -2
- package/fesm2022/{ng-forge-dynamic-forms-page-field.component-B7A2v1vN.mjs.map → ng-forge-dynamic-forms-page-field.component-CwH22lRl.mjs.map} +1 -1
- package/fesm2022/ng-forge-dynamic-forms.mjs +2 -2
- package/package.json +2 -2
- package/types/ng-forge-dynamic-forms-integration.d.ts +7 -31
- package/types/ng-forge-dynamic-forms-internal.d.ts +449 -218
- package/types/ng-forge-dynamic-forms.d.ts +26 -8
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-ug5tp6kt.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-BGRxIQ2V.mjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, computed, isSignal, inject, Injector, input, signal, ChangeDetectionStrategy, Component, untracked, Injectable, linkedSignal, resourceFromSnapshots, Pipe } from '@angular/core';
|
|
2
|
+
import { InjectionToken, computed, isSignal, inject, Injector, input, signal, ChangeDetectionStrategy, Component, untracked, Injectable, linkedSignal, resourceFromSnapshots, Pipe, viewChild, ViewContainerRef, Directive, forwardRef } from '@angular/core';
|
|
3
3
|
import { NgComponentOutlet } from '@angular/common';
|
|
4
4
|
import { explicitEffect } from 'ngxtension/explicit-effect';
|
|
5
5
|
import { toSignal, toObservable, rxResource } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { isObservable, defer, combineLatest, pipe, debounceTime, distinctUntilChanged, map, tap, catchError, of, from, startWith, Subject, filter, TimeoutError, throwError } from 'rxjs';
|
|
7
7
|
import { HttpClient } from '@angular/common/http';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { switchMap, map as map$1, scan, filter as filter$1, take, timeout, catchError as catchError$1, shareReplay } from 'rxjs/operators';
|
|
9
|
+
import { email, min, max, minLength, maxLength, pattern, required, validateTree, validate, validateAsync, validateHttp } from '@angular/forms/signals';
|
|
10
10
|
|
|
11
11
|
const ADDON_TYPE_DEFINITIONS = new InjectionToken('ADDON_TYPE_DEFINITIONS');
|
|
12
12
|
|
|
@@ -2662,6 +2662,187 @@ function injectNonFieldEvaluationContext(fieldDef, options = {}) {
|
|
|
2662
2662
|
};
|
|
2663
2663
|
}
|
|
2664
2664
|
|
|
2665
|
+
function dynamicTextToObservable(value, injector) {
|
|
2666
|
+
if (value === undefined) {
|
|
2667
|
+
return of('');
|
|
2668
|
+
}
|
|
2669
|
+
if (isObservable(value)) {
|
|
2670
|
+
return value;
|
|
2671
|
+
}
|
|
2672
|
+
if (isSignal(value)) {
|
|
2673
|
+
return untracked(() => toObservable(value, { injector }));
|
|
2674
|
+
}
|
|
2675
|
+
return of(String(value));
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
const PLACEHOLDER_PATTERN = /\{\{([^{}]*)\}\}/g;
|
|
2679
|
+
function interpolateParams(message, error) {
|
|
2680
|
+
const params = extractErrorParams(error);
|
|
2681
|
+
return message.replace(PLACEHOLDER_PATTERN, (placeholder, rawKey) => {
|
|
2682
|
+
const key = rawKey.trim();
|
|
2683
|
+
return Object.hasOwn(params, key) ? safeToString(params[key]) : placeholder;
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
function safeToString(value) {
|
|
2687
|
+
if (value === null || value === undefined) {
|
|
2688
|
+
return '';
|
|
2689
|
+
}
|
|
2690
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
2691
|
+
return String(value);
|
|
2692
|
+
}
|
|
2693
|
+
if (value instanceof RegExp) {
|
|
2694
|
+
return value.toString();
|
|
2695
|
+
}
|
|
2696
|
+
if (value instanceof Date) {
|
|
2697
|
+
return value.toISOString();
|
|
2698
|
+
}
|
|
2699
|
+
if (Array.isArray(value)) {
|
|
2700
|
+
return value.join(', ');
|
|
2701
|
+
}
|
|
2702
|
+
try {
|
|
2703
|
+
if (typeof value === 'object' && value.toString !== Object.prototype.toString) {
|
|
2704
|
+
return value.toString();
|
|
2705
|
+
}
|
|
2706
|
+
return JSON.stringify(value);
|
|
2707
|
+
}
|
|
2708
|
+
catch {
|
|
2709
|
+
return '[object]';
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
function extractErrorParams(error) {
|
|
2713
|
+
const params = {};
|
|
2714
|
+
if ('min' in error)
|
|
2715
|
+
params.min = error.min;
|
|
2716
|
+
if ('max' in error)
|
|
2717
|
+
params.max = error.max;
|
|
2718
|
+
if ('pattern' in error)
|
|
2719
|
+
params.pattern = error.pattern;
|
|
2720
|
+
if ('actual' in error)
|
|
2721
|
+
params.actual = error.actual;
|
|
2722
|
+
if ('expected' in error)
|
|
2723
|
+
params.expected = error.expected;
|
|
2724
|
+
if ('requiredLength' in error) {
|
|
2725
|
+
params.requiredLength = error.requiredLength;
|
|
2726
|
+
}
|
|
2727
|
+
else if ('minLength' in error) {
|
|
2728
|
+
params.requiredLength = error.minLength;
|
|
2729
|
+
params.minLength = error.minLength;
|
|
2730
|
+
}
|
|
2731
|
+
else if ('maxLength' in error) {
|
|
2732
|
+
params.requiredLength = error.maxLength;
|
|
2733
|
+
params.maxLength = error.maxLength;
|
|
2734
|
+
}
|
|
2735
|
+
if ('actualLength' in error)
|
|
2736
|
+
params.actualLength = error.actualLength;
|
|
2737
|
+
Object.keys(error).forEach((key) => {
|
|
2738
|
+
if (key !== 'kind' && !(key in params)) {
|
|
2739
|
+
params[key] = error[key];
|
|
2740
|
+
}
|
|
2741
|
+
});
|
|
2742
|
+
return params;
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
function createResolvedErrorsSignal(field, validationMessages, defaultValidationMessages = signal(undefined), injector = inject(Injector)) {
|
|
2746
|
+
const logger = injector.get(DynamicFormLogger);
|
|
2747
|
+
const messages = computed(() => validationMessages() ?? {}, /* @ts-ignore */
|
|
2748
|
+
...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
2749
|
+
const defaultMessages = computed(() => defaultValidationMessages() ?? {}, /* @ts-ignore */
|
|
2750
|
+
...(ngDevMode ? [{ debugName: "defaultMessages" }] : /* istanbul ignore next */ []));
|
|
2751
|
+
const errors = computed(() => field()?.().errors() ?? [], /* @ts-ignore */
|
|
2752
|
+
...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
2753
|
+
const errors$ = toObservable(errors, { injector });
|
|
2754
|
+
const messages$ = toObservable(messages, { injector });
|
|
2755
|
+
const defaultMessages$ = toObservable(defaultMessages, { injector });
|
|
2756
|
+
const resolvedErrors$ = combineLatest([errors$, messages$, defaultMessages$]).pipe(switchMap(([currentErrors, msgs, defaultMsgs]) => {
|
|
2757
|
+
if (!currentErrors || currentErrors.length === 0) {
|
|
2758
|
+
return of([]);
|
|
2759
|
+
}
|
|
2760
|
+
const errorResolvers = currentErrors.map((error) => resolveErrorMessage(error, msgs, defaultMsgs, injector, logger));
|
|
2761
|
+
return errorResolvers.length > 0
|
|
2762
|
+
? combineLatest(errorResolvers).pipe(map$1((errors) => errors.filter((e) => e !== null)))
|
|
2763
|
+
: of([]);
|
|
2764
|
+
}));
|
|
2765
|
+
return toSignal(resolvedErrors$, { initialValue: [], injector });
|
|
2766
|
+
}
|
|
2767
|
+
function isMessageResolver(message) {
|
|
2768
|
+
return typeof message === 'function' && !isSignal(message);
|
|
2769
|
+
}
|
|
2770
|
+
function resolveMessageFunction(resolver, error, logger) {
|
|
2771
|
+
try {
|
|
2772
|
+
return resolver(error) ?? error.message ?? '';
|
|
2773
|
+
}
|
|
2774
|
+
catch (err) {
|
|
2775
|
+
logger.error(`Validation message resolver for error kind "${error.kind}" threw; falling back to error.message.`, err);
|
|
2776
|
+
return error.message ?? '';
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
function resolveErrorMessage(error, fieldMessages, defaultMessages, injector, logger) {
|
|
2780
|
+
const fieldMessage = fieldMessages[error.kind];
|
|
2781
|
+
const defaultMessage = defaultMessages[error.kind];
|
|
2782
|
+
const messageToUse = fieldMessage ?? defaultMessage ?? error.message;
|
|
2783
|
+
if (!messageToUse) {
|
|
2784
|
+
logger.warn(`No validation message found for error kind "${error.kind}". ` +
|
|
2785
|
+
`Please provide a message via field-level validationMessages or form-level defaultValidationMessages.`);
|
|
2786
|
+
return of(null);
|
|
2787
|
+
}
|
|
2788
|
+
const isSchemaMessage = fieldMessage === undefined && defaultMessage === undefined;
|
|
2789
|
+
const messageText = isMessageResolver(messageToUse) ? resolveMessageFunction(messageToUse, error, logger) : messageToUse;
|
|
2790
|
+
const messageObservable = isSchemaMessage
|
|
2791
|
+
? of(messageToUse) : dynamicTextToObservable(messageText, injector);
|
|
2792
|
+
return messageObservable.pipe(map$1((msg) => ({
|
|
2793
|
+
kind: error.kind,
|
|
2794
|
+
message: interpolateParams(msg, error),
|
|
2795
|
+
})));
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
function shouldShowErrors(field) {
|
|
2799
|
+
return computed(() => {
|
|
2800
|
+
const control = field()?.();
|
|
2801
|
+
if (!control)
|
|
2802
|
+
return false;
|
|
2803
|
+
return control.invalid() && control.touched() && control.errors().length > 0;
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
const FIELD_ERROR_DISPLAY = new InjectionToken('FIELD_ERROR_DISPLAY');
|
|
2808
|
+
function injectFieldErrors(options) {
|
|
2809
|
+
const injector = options.injector ?? inject(Injector);
|
|
2810
|
+
const defaultValidationMessages = inject(DEFAULT_VALIDATION_MESSAGES, { optional: true });
|
|
2811
|
+
const fieldSignalContext = inject(FIELD_SIGNAL_CONTEXT, { optional: true });
|
|
2812
|
+
const fieldState = computed(() => {
|
|
2813
|
+
const inputs = options.fieldInputs();
|
|
2814
|
+
if (!inputs)
|
|
2815
|
+
return undefined;
|
|
2816
|
+
if (inputs.field)
|
|
2817
|
+
return inputs.field;
|
|
2818
|
+
const parentTree = fieldSignalContext?.form;
|
|
2819
|
+
const node = inputs.key ? parentTree?.[inputs.key] : undefined;
|
|
2820
|
+
return node ? node() : undefined;
|
|
2821
|
+
}, /* @ts-ignore */
|
|
2822
|
+
...(ngDevMode ? [{ debugName: "fieldState" }] : /* istanbul ignore next */ []));
|
|
2823
|
+
const fieldTree = computed(() => {
|
|
2824
|
+
const state = fieldState();
|
|
2825
|
+
return state ? (() => state) : undefined;
|
|
2826
|
+
}, /* @ts-ignore */
|
|
2827
|
+
...(ngDevMode ? [{ debugName: "fieldTree" }] : /* istanbul ignore next */ []));
|
|
2828
|
+
const messages = computed(() => options.validationMessages?.() ?? options.fieldInputs()?.validationMessages, /* @ts-ignore */
|
|
2829
|
+
...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
2830
|
+
const errors = createResolvedErrorsSignal(fieldTree, messages, computed(() => defaultValidationMessages?.()), injector);
|
|
2831
|
+
const showErrors = shouldShowErrors(fieldTree);
|
|
2832
|
+
return {
|
|
2833
|
+
errors,
|
|
2834
|
+
showErrors,
|
|
2835
|
+
errorsToDisplay: computed(() => (showErrors() ? errors() : [])),
|
|
2836
|
+
errorId: computed(() => `${options.fieldInputs()?.key ?? ''}-error`),
|
|
2837
|
+
};
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
function rowError(ctx, index, key, error) {
|
|
2841
|
+
const rows = ctx.fieldTree;
|
|
2842
|
+
const fieldTree = rows?.[index]?.[key];
|
|
2843
|
+
return fieldTree ? { ...error, fieldTree } : error;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2665
2846
|
function isFunctionHttpValidator(config) {
|
|
2666
2847
|
const c = config;
|
|
2667
2848
|
return typeof c.functionName === 'string' || (c.fn !== null && typeof c.fn === 'object');
|
|
@@ -2773,7 +2954,8 @@ function applyPatternValidator(path, value, expression, when) {
|
|
|
2773
2954
|
function createConditionalLogic(when) {
|
|
2774
2955
|
return when ? createLogicFunction(when) : undefined;
|
|
2775
2956
|
}
|
|
2776
|
-
function applyValidator(config,
|
|
2957
|
+
function applyValidator(config,
|
|
2958
|
+
fieldPath, attachment = 'field') {
|
|
2777
2959
|
const path = fieldPath;
|
|
2778
2960
|
switch (config.type) {
|
|
2779
2961
|
case 'required':
|
|
@@ -2820,7 +3002,7 @@ function applyValidator(config, fieldPath) {
|
|
|
2820
3002
|
}
|
|
2821
3003
|
break;
|
|
2822
3004
|
case 'custom':
|
|
2823
|
-
applyCustomValidator(config, path);
|
|
3005
|
+
applyCustomValidator(config, path, attachment);
|
|
2824
3006
|
break;
|
|
2825
3007
|
case 'async':
|
|
2826
3008
|
applyAsyncValidator(config, path);
|
|
@@ -2830,7 +3012,7 @@ function applyValidator(config, fieldPath) {
|
|
|
2830
3012
|
break;
|
|
2831
3013
|
}
|
|
2832
3014
|
}
|
|
2833
|
-
function applyCustomValidator(config, fieldPath) {
|
|
3015
|
+
function applyCustomValidator(config, fieldPath, attachment = 'field') {
|
|
2834
3016
|
let validatorFn;
|
|
2835
3017
|
if (config.expression) {
|
|
2836
3018
|
validatorFn = createExpressionValidator(config);
|
|
@@ -2842,11 +3024,16 @@ function applyCustomValidator(config, fieldPath) {
|
|
|
2842
3024
|
throw new DynamicFormError('Custom validator requires one of "expression", "functionName", or "fn".');
|
|
2843
3025
|
}
|
|
2844
3026
|
const whenLogic = createConditionalLogic(config.when);
|
|
2845
|
-
|
|
3027
|
+
const run = (ctx) => {
|
|
2846
3028
|
if (whenLogic && !whenLogic(ctx))
|
|
2847
3029
|
return null;
|
|
2848
3030
|
return validatorFn(ctx);
|
|
2849
|
-
}
|
|
3031
|
+
};
|
|
3032
|
+
if (attachment === 'tree') {
|
|
3033
|
+
validateTree(fieldPath, run);
|
|
3034
|
+
return;
|
|
3035
|
+
}
|
|
3036
|
+
validate(fieldPath, run);
|
|
2850
3037
|
}
|
|
2851
3038
|
function createFunctionValidator(config) {
|
|
2852
3039
|
const logger = inject(DynamicFormLogger);
|
|
@@ -2998,8 +3185,9 @@ function applyDeclarativeHttpValidator(config, fieldPath) {
|
|
|
2998
3185
|
},
|
|
2999
3186
|
});
|
|
3000
3187
|
}
|
|
3001
|
-
function applyValidators(configs,
|
|
3002
|
-
|
|
3188
|
+
function applyValidators(configs,
|
|
3189
|
+
fieldPath, attachment = 'field') {
|
|
3190
|
+
configs.forEach((config) => applyValidator(config, fieldPath, attachment));
|
|
3003
3191
|
}
|
|
3004
3192
|
|
|
3005
3193
|
function isCheckedField(field) {
|
|
@@ -3485,19 +3673,6 @@ function isDisplayOnlyField(field) {
|
|
|
3485
3673
|
}
|
|
3486
3674
|
|
|
3487
3675
|
|
|
3488
|
-
function dynamicTextToObservable(value, injector) {
|
|
3489
|
-
if (value === undefined) {
|
|
3490
|
-
return of('');
|
|
3491
|
-
}
|
|
3492
|
-
if (isObservable(value)) {
|
|
3493
|
-
return value;
|
|
3494
|
-
}
|
|
3495
|
-
if (isSignal(value)) {
|
|
3496
|
-
return untracked(() => toObservable(value, { injector }));
|
|
3497
|
-
}
|
|
3498
|
-
return of(String(value));
|
|
3499
|
-
}
|
|
3500
|
-
|
|
3501
3676
|
class DynamicTextPipe {
|
|
3502
3677
|
injector = inject(Injector);
|
|
3503
3678
|
transform(value) {
|
|
@@ -3559,73 +3734,6 @@ function setupInitializationTracking(options) {
|
|
|
3559
3734
|
}), shareReplay({ bufferSize: 1, refCount: false }));
|
|
3560
3735
|
}
|
|
3561
3736
|
|
|
3562
|
-
const PLACEHOLDER_PATTERN = /\{\{([^{}]*)\}\}/g;
|
|
3563
|
-
function interpolateParams(message, error) {
|
|
3564
|
-
const params = extractErrorParams(error);
|
|
3565
|
-
return message.replace(PLACEHOLDER_PATTERN, (placeholder, rawKey) => {
|
|
3566
|
-
const key = rawKey.trim();
|
|
3567
|
-
return Object.hasOwn(params, key) ? safeToString(params[key]) : placeholder;
|
|
3568
|
-
});
|
|
3569
|
-
}
|
|
3570
|
-
function safeToString(value) {
|
|
3571
|
-
if (value === null || value === undefined) {
|
|
3572
|
-
return '';
|
|
3573
|
-
}
|
|
3574
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
3575
|
-
return String(value);
|
|
3576
|
-
}
|
|
3577
|
-
if (value instanceof RegExp) {
|
|
3578
|
-
return value.toString();
|
|
3579
|
-
}
|
|
3580
|
-
if (value instanceof Date) {
|
|
3581
|
-
return value.toISOString();
|
|
3582
|
-
}
|
|
3583
|
-
if (Array.isArray(value)) {
|
|
3584
|
-
return value.join(', ');
|
|
3585
|
-
}
|
|
3586
|
-
try {
|
|
3587
|
-
if (typeof value === 'object' && value.toString !== Object.prototype.toString) {
|
|
3588
|
-
return value.toString();
|
|
3589
|
-
}
|
|
3590
|
-
return JSON.stringify(value);
|
|
3591
|
-
}
|
|
3592
|
-
catch {
|
|
3593
|
-
return '[object]';
|
|
3594
|
-
}
|
|
3595
|
-
}
|
|
3596
|
-
function extractErrorParams(error) {
|
|
3597
|
-
const params = {};
|
|
3598
|
-
if ('min' in error)
|
|
3599
|
-
params.min = error.min;
|
|
3600
|
-
if ('max' in error)
|
|
3601
|
-
params.max = error.max;
|
|
3602
|
-
if ('pattern' in error)
|
|
3603
|
-
params.pattern = error.pattern;
|
|
3604
|
-
if ('actual' in error)
|
|
3605
|
-
params.actual = error.actual;
|
|
3606
|
-
if ('expected' in error)
|
|
3607
|
-
params.expected = error.expected;
|
|
3608
|
-
if ('requiredLength' in error) {
|
|
3609
|
-
params.requiredLength = error.requiredLength;
|
|
3610
|
-
}
|
|
3611
|
-
else if ('minLength' in error) {
|
|
3612
|
-
params.requiredLength = error.minLength;
|
|
3613
|
-
params.minLength = error.minLength;
|
|
3614
|
-
}
|
|
3615
|
-
else if ('maxLength' in error) {
|
|
3616
|
-
params.requiredLength = error.maxLength;
|
|
3617
|
-
params.maxLength = error.maxLength;
|
|
3618
|
-
}
|
|
3619
|
-
if ('actualLength' in error)
|
|
3620
|
-
params.actualLength = error.actualLength;
|
|
3621
|
-
Object.keys(error).forEach((key) => {
|
|
3622
|
-
if (key !== 'kind' && !(key in params)) {
|
|
3623
|
-
params[key] = error[key];
|
|
3624
|
-
}
|
|
3625
|
-
});
|
|
3626
|
-
return params;
|
|
3627
|
-
}
|
|
3628
|
-
|
|
3629
3737
|
function isEqual(a, b) {
|
|
3630
3738
|
return isEqualInternal(a, b, new WeakMap(), new WeakMap());
|
|
3631
3739
|
}
|
|
@@ -3820,7 +3928,29 @@ function createWarningTracker() {
|
|
|
3820
3928
|
return { warnedKeys: new Set() };
|
|
3821
3929
|
}
|
|
3822
3930
|
|
|
3931
|
+
class FieldErrorsWrapperBase {
|
|
3932
|
+
fieldComponent = viewChild.required('fieldComponent', { read: ViewContainerRef });
|
|
3933
|
+
validationMessages = input(/* @ts-ignore */
|
|
3934
|
+
...(ngDevMode ? [undefined, { debugName: "validationMessages" }] : /* istanbul ignore next */ []));
|
|
3935
|
+
fieldInputs = input(/* @ts-ignore */
|
|
3936
|
+
...(ngDevMode ? [undefined, { debugName: "fieldInputs" }] : /* istanbul ignore next */ []));
|
|
3937
|
+
claimedKey = computed(() => this.fieldInputs()?.key, /* @ts-ignore */
|
|
3938
|
+
...(ngDevMode ? [{ debugName: "claimedKey" }] : /* istanbul ignore next */ []));
|
|
3939
|
+
ngf = injectFieldErrors({
|
|
3940
|
+
fieldInputs: this.fieldInputs,
|
|
3941
|
+
validationMessages: this.validationMessages,
|
|
3942
|
+
});
|
|
3943
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: FieldErrorsWrapperBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3944
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.1", type: FieldErrorsWrapperBase, isStandalone: true, inputs: { validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, fieldInputs: { classPropertyName: "fieldInputs", publicName: "fieldInputs", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "fieldComponent", first: true, predicate: ["fieldComponent"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0 });
|
|
3945
|
+
}
|
|
3946
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: FieldErrorsWrapperBase, decorators: [{
|
|
3947
|
+
type: Directive
|
|
3948
|
+
}], propDecorators: { fieldComponent: [{ type: i0.ViewChild, args: ['fieldComponent', { ...{ read: ViewContainerRef }, isSignal: true }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], fieldInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldInputs", required: false }] }] } });
|
|
3949
|
+
function provideFieldErrorDisplay(wrapper) {
|
|
3950
|
+
return { provide: FIELD_ERROR_DISPLAY, useExisting: forwardRef(wrapper) };
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3823
3953
|
|
|
3824
3954
|
|
|
3825
|
-
export { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_TYPE_COMPONENT_CACHE, ADDON_TYPE_DEFINITIONS, ADDON_TYPE_REGISTRY, ARRAY_CONTEXT, AsyncConditionFunctionCacheService, ComponentInitializedEvent, DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, DEFAULT_WRAPPERS, DEPRECATION_WARNING_TRACKER, DF_FIELD_TEMPLATES, DfAddonSlot, DynamicFormError, DynamicFormLogger, DynamicTextPipe, DynamicValueFunctionCacheService, EMIT_FORM_VALUE_ON_EVENTS, EXTERNAL_DATA, EventBus, ExpressionParser, ExpressionParserError, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FORM_ID_PREFIX, FORM_OPTIONS, FieldContextRegistryService, FunctionRegistryService, GROUP_CONTEXT, HTTP_CONDITION_CACHE, HttpConditionCache, HttpConditionFunctionCacheService, INITIALIZATION_TIMEOUT_MS, LogicFunctionCacheService, NoopLogger, READONLY_FIELD_TREE_CACHE, RootFormRegistryService, TokenType, WRAPPER_AUTO_ASSOCIATIONS, WRAPPER_COMPONENT_CACHE, WRAPPER_REGISTRY, applyMetaToElement, applyValidator, applyValidators, arrayFieldMapper, assertNever, baseFieldMapper, buildBaseInputs, buildClassName, compareValues, containerFieldMapper, createAddonActionRegistry, createDebouncedLogicFunction, createDefaultDerivationLogConfig, createDynamicValueFunction, createFieldValueProxy, createFormFieldStateMap, createFormStateLogicFunction, createInitializationTracker, createLogicFunction, createWarningTracker, deepMergeDefaults, derivedFromDeferred, detectFormMode, dynamicTextToObservable, evaluateCondition, evaluateNonFieldDisabled, evaluateNonFieldHidden, extractExpressionDependencies, extractStringDependencies, getArrayLength, getChangedKeys, getFieldValueHandling, getGridClassString, getNestedValue, groupFieldMapper, hasChildFields, hasCrossFieldWhenCondition, hasFormValue, hasNestedProperty, hasTargetProperty, injectAddonTypeRegistry, injectFieldSignalContext, injectFieldsSupportingAddons, injectNonFieldEvaluationContext, interpolateParams, isArrayField, isCheckedField, isContainerField, isCrossFieldBuiltInValidator, isCrossFieldExpression, isCrossFieldSchema, isCrossFieldStateLogic, isCrossFieldValidator, isDerivationLogicConfig, isDisplayOnlyField, isEqual, isFieldBoundContext, isFormStateCondition, isFunctionHttpValidator, isGenericContainerField, isGroupField, isHiddenField, isLeafField, isNonPagedForm, isPageField, isPagedForm, isResourceBasedValidator, isRowField, isSimplifiedArrayField, isStateLogicConfig, isValidNonPagedForm, isValidPagedForm, isValueBearingField, isValueField, isWrapperTypeDefinition, keyBy, mapValues, memoize, normalizeFieldsArray, omit, pageFieldMapper, readFieldStateInfo, resolveDynamicValue, resolveHttpRequest, resolveNextButtonDisabled, resolveNonFieldDisabled, resolveNonFieldHidden, resolveSubmitButtonDisabled, resolveTokens, rowFieldMapper, runPresetAction, setupInitializationTracking, shouldLog, textFieldMapper, toReadonlyFieldTree, toReadonlyFieldTreeCached, validatePageNesting, withPreviousValue, writeToFieldValue };
|
|
3955
|
+
export { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_TYPE_COMPONENT_CACHE, ADDON_TYPE_DEFINITIONS, ADDON_TYPE_REGISTRY, ARRAY_CONTEXT, AsyncConditionFunctionCacheService, ComponentInitializedEvent, DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, DEFAULT_WRAPPERS, DEPRECATION_WARNING_TRACKER, DF_FIELD_TEMPLATES, DfAddonSlot, DynamicFormError, DynamicFormLogger, DynamicTextPipe, DynamicValueFunctionCacheService, EMIT_FORM_VALUE_ON_EVENTS, EXTERNAL_DATA, EventBus, ExpressionParser, ExpressionParserError, FIELD_ERROR_DISPLAY, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FORM_ID_PREFIX, FORM_OPTIONS, FieldContextRegistryService, FieldErrorsWrapperBase, FunctionRegistryService, GROUP_CONTEXT, HTTP_CONDITION_CACHE, HttpConditionCache, HttpConditionFunctionCacheService, INITIALIZATION_TIMEOUT_MS, LogicFunctionCacheService, NoopLogger, READONLY_FIELD_TREE_CACHE, RootFormRegistryService, TokenType, WRAPPER_AUTO_ASSOCIATIONS, WRAPPER_COMPONENT_CACHE, WRAPPER_REGISTRY, applyMetaToElement, applyValidator, applyValidators, arrayFieldMapper, assertNever, baseFieldMapper, buildBaseInputs, buildClassName, compareValues, containerFieldMapper, createAddonActionRegistry, createDebouncedLogicFunction, createDefaultDerivationLogConfig, createDynamicValueFunction, createFieldValueProxy, createFormFieldStateMap, createFormStateLogicFunction, createInitializationTracker, createLogicFunction, createResolvedErrorsSignal, createWarningTracker, deepMergeDefaults, derivedFromDeferred, detectFormMode, dynamicTextToObservable, evaluateCondition, evaluateNonFieldDisabled, evaluateNonFieldHidden, extractExpressionDependencies, extractStringDependencies, getArrayLength, getChangedKeys, getFieldValueHandling, getGridClassString, getNestedValue, groupFieldMapper, hasChildFields, hasCrossFieldWhenCondition, hasFormValue, hasNestedProperty, hasTargetProperty, injectAddonTypeRegistry, injectFieldErrors, injectFieldSignalContext, injectFieldsSupportingAddons, injectNonFieldEvaluationContext, interpolateParams, isArrayField, isCheckedField, isContainerField, isCrossFieldBuiltInValidator, isCrossFieldExpression, isCrossFieldSchema, isCrossFieldStateLogic, isCrossFieldValidator, isDerivationLogicConfig, isDisplayOnlyField, isEqual, isFieldBoundContext, isFormStateCondition, isFunctionHttpValidator, isGenericContainerField, isGroupField, isHiddenField, isLeafField, isNonPagedForm, isPageField, isPagedForm, isResourceBasedValidator, isRowField, isSimplifiedArrayField, isStateLogicConfig, isValidNonPagedForm, isValidPagedForm, isValueBearingField, isValueField, isWrapperTypeDefinition, keyBy, mapValues, memoize, normalizeFieldsArray, omit, pageFieldMapper, provideFieldErrorDisplay, readFieldStateInfo, resolveDynamicValue, resolveHttpRequest, resolveNextButtonDisabled, resolveNonFieldDisabled, resolveNonFieldHidden, resolveSubmitButtonDisabled, resolveTokens, rowError, rowFieldMapper, runPresetAction, setupInitializationTracking, shouldLog, shouldShowErrors, textFieldMapper, toReadonlyFieldTree, toReadonlyFieldTreeCached, validatePageNesting, withPreviousValue, writeToFieldValue };
|
|
3826
3956
|
//# sourceMappingURL=ng-forge-dynamic-forms-internal.mjs.map
|