@ng-forge/dynamic-forms 1.3.0-next.2 → 1.3.0-next.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.
- package/fesm2022/ng-forge-dynamic-forms-active-page-initialized.event-CiKN-mcc.mjs +12 -0
- package/fesm2022/ng-forge-dynamic-forms-active-page-initialized.event-CiKN-mcc.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-Dv9mPnJ3.mjs +770 -0
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-Dv9mPnJ3.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-array-item-registry.service-D-AxVLdk.mjs +83 -0
- package/fesm2022/ng-forge-dynamic-forms-array-item-registry.service-D-AxVLdk.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-EuYCbquo.mjs +1887 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-EuYCbquo.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-web-mcp-2wQK_wPp.mjs +954 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-web-mcp-2wQK_wPp.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-container-field-processors-C_JRvaVt.mjs +117 -0
- package/fesm2022/ng-forge-dynamic-forms-container-field-processors-C_JRvaVt.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-Bg7Win9n.mjs +228 -0
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-Bg7Win9n.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-R2yc-H0T.mjs +102 -0
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-R2yc-H0T.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-debounce-CG3uP5B-.mjs +4 -0
- package/fesm2022/{ng-forge-dynamic-forms-debounce-C9F4v1Ke.mjs.map → ng-forge-dynamic-forms-debounce-CG3uP5B-.mjs.map} +1 -1
- package/fesm2022/ng-forge-dynamic-forms-default-value-D5M4MNE-.mjs +77 -0
- package/fesm2022/ng-forge-dynamic-forms-default-value-D5M4MNE-.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-dev-mode-4rbYBBo_.mjs +4 -0
- package/fesm2022/ng-forge-dynamic-forms-dev-mode-4rbYBBo_.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-df-field-outlet.directive-CQsDMV-s.mjs +644 -0
- package/fesm2022/ng-forge-dynamic-forms-df-field-outlet.directive-CQsDMV-s.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-field-errors-wrapper.component-DKgkpIpG.mjs +56 -0
- package/fesm2022/ng-forge-dynamic-forms-field-errors-wrapper.component-DKgkpIpG.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-form-schema.service-Dd-gHJ_7.mjs +38 -0
- package/fesm2022/{ng-forge-dynamic-forms-form-schema.service-Dx5Dlb15.mjs.map → ng-forge-dynamic-forms-form-schema.service-Dd-gHJ_7.mjs.map} +1 -1
- package/fesm2022/ng-forge-dynamic-forms-form-state-manager-DcOXRFRL.mjs +1522 -0
- package/fesm2022/ng-forge-dynamic-forms-form-state-manager-DcOXRFRL.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-BjZi0bhq.mjs +292 -0
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-BjZi0bhq.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs +1318 -843
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs +3326 -3641
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs +295 -0
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-resolve-field-ByGa5cpo.mjs +329 -0
- package/fesm2022/ng-forge-dynamic-forms-resolve-field-ByGa5cpo.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-CuFycQb-.mjs +81 -0
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-CuFycQb-.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-schema-builder-C62afItJ.mjs +400 -0
- package/fesm2022/ng-forge-dynamic-forms-schema-builder-C62afItJ.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-schema-registry.service-axBV9FBH.mjs +45 -0
- package/fesm2022/ng-forge-dynamic-forms-schema-registry.service-axBV9FBH.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-schema.mjs +8 -14
- package/fesm2022/ng-forge-dynamic-forms-schema.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-testing.mjs +68 -73
- package/fesm2022/ng-forge-dynamic-forms-testing.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-text-field.component--MAh_h4Q.mjs +257 -0
- package/fesm2022/ng-forge-dynamic-forms-text-field.component--MAh_h4Q.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-validation-execution.token-BFyySKtp.mjs +8 -0
- package/fesm2022/ng-forge-dynamic-forms-validation-execution.token-BFyySKtp.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-with-logger-config-BAATqYY0.mjs +94 -0
- package/fesm2022/ng-forge-dynamic-forms-with-logger-config-BAATqYY0.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-wrapper-chain-BnntfNU1.mjs +115 -0
- package/fesm2022/ng-forge-dynamic-forms-wrapper-chain-BnntfNU1.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms.mjs +2136 -3
- package/fesm2022/ng-forge-dynamic-forms.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ng-forge-dynamic-forms-integration.d.ts +543 -415
- package/types/ng-forge-dynamic-forms-internal.d.ts +2319 -2436
- package/types/ng-forge-dynamic-forms-schema.d.ts +13 -16
- package/types/ng-forge-dynamic-forms-testing.d.ts +34 -37
- package/types/ng-forge-dynamic-forms.d.ts +735 -722
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-CSCKq_1K.mjs +0 -750
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-CSCKq_1K.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-CTOTwzzw.mjs +0 -2394
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-CTOTwzzw.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-web-mcp-BtjqeJOj.mjs +0 -1054
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-web-mcp-BtjqeJOj.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-Dc3ROhHL.mjs +0 -86
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-Dc3ROhHL.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-BzgX8lAD.mjs +0 -33
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-BzgX8lAD.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-debounce-C9F4v1Ke.mjs +0 -17
- package/fesm2022/ng-forge-dynamic-forms-field-errors-wrapper.component-CIKbWqYA.mjs +0 -25
- package/fesm2022/ng-forge-dynamic-forms-field-errors-wrapper.component-CIKbWqYA.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-form-schema.service-Dx5Dlb15.mjs +0 -24
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-DAC3P9DC.mjs +0 -177
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-DAC3P9DC.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-CXQe_5td.mjs +0 -5133
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-CXQe_5td.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-DPKJcwUO.mjs +0 -176
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-DPKJcwUO.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-DMEeKZny.mjs +0 -19
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-DMEeKZny.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-schema-builder-BvDTzfdM.mjs +0 -570
- package/fesm2022/ng-forge-dynamic-forms-schema-builder-BvDTzfdM.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-text-field.component-BB-jutBq.mjs +0 -126
- package/fesm2022/ng-forge-dynamic-forms-text-field.component-BB-jutBq.mjs.map +0 -1
|
@@ -1,3 +1,2136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { d as FieldViewportObserver, f as resolveFieldParking, h as FIELD_WINDOWING, i as initializationComponentKey, m as clampWindowSize, n as collectInitializingContainerKeys, p as resolveFieldWindowing, t as DfFieldOutlet, u as resolveWrappers } from "./ng-forge-dynamic-forms-df-field-outlet.directive-CQsDMV-s.mjs";
|
|
2
|
+
import { a as walkAndValidateAddons, n as FormStateManager, o as normalizeSimplifiedArrays, r as VALUE_EXCLUSION_DEFAULTS, s as FormSubmitEvent, t as FORM_STATE_DEPS } from "./ng-forge-dynamic-forms-form-state-manager-DcOXRFRL.mjs";
|
|
3
|
+
import { c as PROPERTY_OVERRIDE_STORE, l as createPropertyOverrideStore, u as injectFieldRegistry } from "./ng-forge-dynamic-forms-resolve-field-ByGa5cpo.mjs";
|
|
4
|
+
import { a as resolveDefaultExport, n as loadWrapperComponent } from "./ng-forge-dynamic-forms-wrapper-chain-BnntfNU1.mjs";
|
|
5
|
+
import { n as getNormalizedArrayMetadata } from "./ng-forge-dynamic-forms-default-value-D5M4MNE-.mjs";
|
|
6
|
+
import { a as isDynamicFormFeature, i as createFeature, n as withLoggerConfig, o as DERIVATION_WARNING_TRACKER, r as ConsoleLogger, s as someField } from "./ng-forge-dynamic-forms-with-logger-config-BAATqYY0.mjs";
|
|
7
|
+
import { t as ArrayItemRegistryService } from "./ng-forge-dynamic-forms-array-item-registry.service-D-AxVLdk.mjs";
|
|
8
|
+
import { t as SchemaRegistryService } from "./ng-forge-dynamic-forms-schema-registry.service-axBV9FBH.mjs";
|
|
9
|
+
import { n as createContainerFieldProcessors, t as CONTAINER_FIELD_PROCESSORS } from "./ng-forge-dynamic-forms-container-field-processors-C_JRvaVt.mjs";
|
|
10
|
+
import { t as DEV_MODE } from "./ng-forge-dynamic-forms-dev-mode-4rbYBBo_.mjs";
|
|
11
|
+
import { t as VALIDATION_EXECUTION_DEFAULTS } from "./ng-forge-dynamic-forms-validation-execution.token-BFyySKtp.mjs";
|
|
12
|
+
import { t as ActivePageInitializedEvent } from "./ng-forge-dynamic-forms-active-page-initialized.event-CiKN-mcc.mjs";
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, EnvironmentInjector, Injectable, InjectionToken, Injector, PLATFORM_ID, PendingTasks, TemplateRef, afterNextRender, computed, contentChildren, inject, input, isDevMode, linkedSignal, makeEnvironmentProviders, model, runInInjectionContext, signal, untracked } from "@angular/core";
|
|
15
|
+
import { explicitEffect } from "ngxtension/explicit-effect";
|
|
16
|
+
import { EMPTY, catchError, defer, exhaustMap, filter, firstValueFrom, from, isObservable, shareReplay, take, tap } from "rxjs";
|
|
17
|
+
import { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_TYPE_COMPONENT_CACHE, ADDON_TYPE_DEFINITIONS, ADDON_TYPE_REGISTRY, AsyncConditionFunctionCacheService, ComponentInitializedEvent, DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, DEFAULT_WRAPPERS, DEPRECATION_WARNING_TRACKER, DF_FIELD_TEMPLATES, DF_FIELD_TEMPLATES as DF_FIELD_TEMPLATES$1, DynamicFormError, DynamicFormError as DynamicFormError$1, DynamicFormLogger, DynamicFormLogger as DynamicFormLogger$1, DynamicTextPipe, DynamicValueFunctionCacheService, EMIT_FORM_VALUE_ON_EVENTS, EXTERNAL_DATA, EventBus, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FORM_ID_PREFIX, FORM_OPTIONS, FieldContextRegistryService, FunctionRegistryService, HTTP_CONDITION_CACHE, HttpConditionCache, HttpConditionFunctionCacheService, LogicFunctionCacheService, NoopLogger, RootFormRegistryService, WRAPPER_AUTO_ASSOCIATIONS, WRAPPER_COMPONENT_CACHE, WRAPPER_COMPONENT_LOAD_CACHE, WRAPPER_REGISTRY, arrayFieldMapper, containerFieldMapper, createAddonActionRegistry, createWarningTracker, evaluateCondition, getGridClassString, groupFieldMapper, hasFormValue, isArrayField, isContainerField, isContainerField as isContainerField$1, isDerivationLogicConfig, isDisplayOnlyField, isFieldBoundContext, isFormStateCondition, isGenericContainerField, isGroupField, isHiddenField, isLeafField, isPageField, isPageField as isPageField$1, isRowField, isRowField as isRowField$1, isSimplifiedArrayField, isValueBearingField, isWrapperTypeDefinition, isWrapperTypeDefinition as isWrapperTypeDefinition$1, pageFieldMapper, resolveDynamicValue, rowError, rowFieldMapper, textFieldMapper } from "@ng-forge/dynamic-forms/internal";
|
|
18
|
+
import { AsyncPipe, NgComponentOutlet, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
|
|
19
|
+
import { outputFromObservable, takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
|
|
20
|
+
import { provideSignalFormsConfig, submit } from "@angular/forms/signals";
|
|
21
|
+
import { NG_STATUS_CLASSES } from "@angular/forms/signals/compat";
|
|
22
|
+
var __defProp = Object.defineProperty;
|
|
23
|
+
var __exportAll = (all, no_symbols) => {
|
|
24
|
+
let target = {};
|
|
25
|
+
for (var name in all) __defProp(target, name, {
|
|
26
|
+
get: all[name],
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
function isPending(formSignal) {
|
|
33
|
+
return formSignal()().pending();
|
|
34
|
+
}
|
|
35
|
+
function isTreeValidationErrors(result) {
|
|
36
|
+
const isError = (v) => typeof v === "object" && v !== null && "kind" in v;
|
|
37
|
+
return Array.isArray(result) ? result.every(isError) && result.length > 0 : isError(result);
|
|
38
|
+
}
|
|
39
|
+
function wrapSubmissionAction(action) {
|
|
40
|
+
return async (formTree) => {
|
|
41
|
+
const result = action(formTree);
|
|
42
|
+
const resolved = isObservable(result) ? await firstValueFrom(result) : await Promise.resolve(result);
|
|
43
|
+
return isTreeValidationErrors(resolved) ? resolved : void 0;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function createSubmissionHandler(options) {
|
|
47
|
+
const { eventBus, configSignal, formSignal, validSignal, logger } = options;
|
|
48
|
+
return eventBus.on("submit").pipe(exhaustMap((event) => {
|
|
49
|
+
const reply = event.reply;
|
|
50
|
+
reply?.accept();
|
|
51
|
+
const submissionConfig = configSignal().submission;
|
|
52
|
+
if (!submissionConfig?.action) {
|
|
53
|
+
reply?.settle(validSignal() ? { status: "dispatched" } : { status: "validation-failed" });
|
|
54
|
+
return EMPTY;
|
|
55
|
+
}
|
|
56
|
+
if (!validSignal()) {
|
|
57
|
+
logger.debug("Submission action skipped: form is not valid (invalid or pending async validators)");
|
|
58
|
+
reply?.settle(isPending(formSignal) ? { status: "pending-validation" } : { status: "validation-failed" });
|
|
59
|
+
return EMPTY;
|
|
60
|
+
}
|
|
61
|
+
const wrappedAction = wrapSubmissionAction(submissionConfig.action);
|
|
62
|
+
return defer(() => {
|
|
63
|
+
const formTree = formSignal();
|
|
64
|
+
return from(submit(formTree, wrappedAction)).pipe(tap(() => {
|
|
65
|
+
reply?.settle(formTree().errorSummary().length ? { status: "server-errors" } : { status: "success" });
|
|
66
|
+
}), catchError((error) => {
|
|
67
|
+
logger.error("Submission action failed:", error);
|
|
68
|
+
reply?.settle({
|
|
69
|
+
status: "action-failed",
|
|
70
|
+
error
|
|
71
|
+
});
|
|
72
|
+
return EMPTY;
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
function collectFieldDefs(fields, out = []) {
|
|
78
|
+
for (const field of fields ?? []) {
|
|
79
|
+
out.push(field);
|
|
80
|
+
const children = field.fields;
|
|
81
|
+
if (Array.isArray(children)) for (const child of children) if (Array.isArray(child)) collectFieldDefs(child, out);
|
|
82
|
+
else collectFieldDefs([child], out);
|
|
83
|
+
const metadata = getNormalizedArrayMetadata(field);
|
|
84
|
+
const template = metadata?.template;
|
|
85
|
+
if (Array.isArray(template)) collectFieldDefs(template, out);
|
|
86
|
+
else if (template) collectFieldDefs([template], out);
|
|
87
|
+
if (metadata?.autoRemoveButton) collectFieldDefs([metadata.autoRemoveButton], out);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
function injectFormComponentPreloader() {
|
|
92
|
+
const fieldRegistry = injectFieldRegistry();
|
|
93
|
+
const wrapperRegistry = inject(WRAPPER_REGISTRY);
|
|
94
|
+
const wrapperCache = inject(WRAPPER_COMPONENT_CACHE);
|
|
95
|
+
const wrapperLoadCache = inject(WRAPPER_COMPONENT_LOAD_CACHE);
|
|
96
|
+
const autoAssociations = inject(WRAPPER_AUTO_ASSOCIATIONS);
|
|
97
|
+
const defaultWrappers = inject(DEFAULT_WRAPPERS, { optional: true });
|
|
98
|
+
const preloadedConfigs = /* @__PURE__ */ new WeakSet();
|
|
99
|
+
const preloadedFieldRoots = /* @__PURE__ */ new WeakSet();
|
|
100
|
+
const preloadFields = (fields) => {
|
|
101
|
+
const unseenFields = fields.filter((field) => {
|
|
102
|
+
if (preloadedFieldRoots.has(field)) return false;
|
|
103
|
+
preloadedFieldRoots.add(field);
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
106
|
+
if (unseenFields.length === 0) return;
|
|
107
|
+
const defs = collectFieldDefs(normalizeSimplifiedArrays(unseenFields));
|
|
108
|
+
if (defs.length === 0) return;
|
|
109
|
+
const fieldTypes = /* @__PURE__ */ new Set();
|
|
110
|
+
const wrapperTypes = /* @__PURE__ */ new Set();
|
|
111
|
+
for (const def of defs) {
|
|
112
|
+
if (def.type) fieldTypes.add(def.type);
|
|
113
|
+
for (const wrapper of resolveWrappers(def, defaultWrappers?.(), autoAssociations, wrapperRegistry)) wrapperTypes.add(wrapper.type);
|
|
114
|
+
}
|
|
115
|
+
const started = [];
|
|
116
|
+
for (const type of fieldTypes) {
|
|
117
|
+
if (fieldRegistry.getLoadedComponent(type)) continue;
|
|
118
|
+
started.push(Promise.resolve(fieldRegistry.loadTypeComponent(type)).catch(() => void 0));
|
|
119
|
+
}
|
|
120
|
+
for (const type of wrapperTypes) {
|
|
121
|
+
if (wrapperCache.has(type)) continue;
|
|
122
|
+
started.push(loadWrapperComponent(type, wrapperRegistry, wrapperCache, wrapperLoadCache).catch(() => void 0));
|
|
123
|
+
}
|
|
124
|
+
Promise.allSettled(started);
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
preloadConfig: (config) => {
|
|
128
|
+
if (preloadedConfigs.has(config)) return;
|
|
129
|
+
preloadedConfigs.add(config);
|
|
130
|
+
const fields = config.fields;
|
|
131
|
+
if (fields.length > 0 && fields.every(isPageField$1)) return;
|
|
132
|
+
preloadFields(fields);
|
|
133
|
+
},
|
|
134
|
+
preloadFields
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
var PageChangeEvent = class {
|
|
138
|
+
currentPageIndex;
|
|
139
|
+
totalPages;
|
|
140
|
+
previousPageIndex;
|
|
141
|
+
type = "page-change";
|
|
142
|
+
constructor(currentPageIndex, totalPages, previousPageIndex) {
|
|
143
|
+
this.currentPageIndex = currentPageIndex;
|
|
144
|
+
this.totalPages = totalPages;
|
|
145
|
+
this.previousPageIndex = previousPageIndex;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var PagerStateEvent = class {
|
|
149
|
+
state;
|
|
150
|
+
type = "pager-state";
|
|
151
|
+
constructor(state) {
|
|
152
|
+
this.state = state;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const PAGE_PRELOAD_WINDOW = new InjectionToken("PAGE_PRELOAD_WINDOW", {
|
|
156
|
+
providedIn: "root",
|
|
157
|
+
factory: () => 1
|
|
158
|
+
});
|
|
159
|
+
function collectLeafFieldKeys(fields) {
|
|
160
|
+
const keys = [];
|
|
161
|
+
for (const field of fields) if (isRowField$1(field) || isGenericContainerField(field)) keys.push(...collectLeafFieldKeys(field.fields));
|
|
162
|
+
else if (field.key) keys.push(field.key);
|
|
163
|
+
return keys;
|
|
164
|
+
}
|
|
165
|
+
var PageOrchestratorComponent = class PageOrchestratorComponent {
|
|
166
|
+
eventBus = inject(EventBus);
|
|
167
|
+
fieldContextRegistry = inject(FieldContextRegistryService);
|
|
168
|
+
functionRegistry = inject(FunctionRegistryService);
|
|
169
|
+
formOptions = inject(FORM_OPTIONS, { optional: true });
|
|
170
|
+
globalPreloadWindow = inject(PAGE_PRELOAD_WINDOW);
|
|
171
|
+
stateManager = inject(FormStateManager, { optional: true });
|
|
172
|
+
pendingPageRequest = computed(() => this.stateManager?.pendingPageRequest() ?? null, ...ngDevMode ? [{ debugName: "pendingPageRequest" }] : /* istanbul ignore next */ []);
|
|
173
|
+
schemaCurrent = computed(() => this.stateManager?.isSchemaCurrent() ?? true, ...ngDevMode ? [{ debugName: "schemaCurrent" }] : /* istanbul ignore next */ []);
|
|
174
|
+
configScope = computed(() => this.stateManager?.activeConfig(), ...ngDevMode ? [{ debugName: "configScope" }] : /* istanbul ignore next */ []);
|
|
175
|
+
pageFields = input.required(...ngDevMode ? [{ debugName: "pageFields" }] : /* istanbul ignore next */ []);
|
|
176
|
+
form = input.required(...ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []);
|
|
177
|
+
fieldSignalContext = input.required(...ngDevMode ? [{ debugName: "fieldSignalContext" }] : /* istanbul ignore next */ []);
|
|
178
|
+
pageHiddenStates = computed(() => {
|
|
179
|
+
return this.pageFields().map((page) => this.evaluatePageHidden(page));
|
|
180
|
+
}, ...ngDevMode ? [{ debugName: "pageHiddenStates" }] : /* istanbul ignore next */ []);
|
|
181
|
+
visiblePageIndices = computed(() => {
|
|
182
|
+
return this.pageHiddenStates().map((hidden, index) => ({
|
|
183
|
+
index,
|
|
184
|
+
hidden
|
|
185
|
+
})).filter((item) => !item.hidden).map((item) => item.index);
|
|
186
|
+
}, ...ngDevMode ? [{ debugName: "visiblePageIndices" }] : /* istanbul ignore next */ []);
|
|
187
|
+
activePageOwnership = linkedSignal({
|
|
188
|
+
...ngDevMode ? { debugName: "activePageOwnership" } : /* istanbul ignore next */ {},
|
|
189
|
+
source: this.configScope,
|
|
190
|
+
computation: (config, previous) => {
|
|
191
|
+
const totalPages = this.pageFields().length;
|
|
192
|
+
if (totalPages === 0) return {
|
|
193
|
+
config,
|
|
194
|
+
initialized: true,
|
|
195
|
+
index: 0
|
|
196
|
+
};
|
|
197
|
+
return untracked(() => {
|
|
198
|
+
const owned = this.stateManager?.activePageState();
|
|
199
|
+
if ((previous === void 0 || previous.source === config) && owned !== void 0 && owned.config === config && owned.initialized && owned.index >= 0 && owned.index < totalPages) return {
|
|
200
|
+
config,
|
|
201
|
+
initialized: true,
|
|
202
|
+
index: owned.index
|
|
203
|
+
};
|
|
204
|
+
if (this.initialPage().validate && !this.schemaCurrent()) return {
|
|
205
|
+
config,
|
|
206
|
+
initialized: false,
|
|
207
|
+
index: 0
|
|
208
|
+
};
|
|
209
|
+
return {
|
|
210
|
+
config,
|
|
211
|
+
initialized: true,
|
|
212
|
+
index: this.resolveInitialLanding()
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
currentPageIndex = computed(() => this.activePageOwnership().index, ...ngDevMode ? [{ debugName: "currentPageIndex" }] : /* istanbul ignore next */ []);
|
|
218
|
+
setCurrentPageIndex(index) {
|
|
219
|
+
this.activePageOwnership.update((ownership) => ({
|
|
220
|
+
...ownership,
|
|
221
|
+
initialized: true,
|
|
222
|
+
index
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
resolveInitialLanding() {
|
|
226
|
+
const { index, validate } = this.initialPage();
|
|
227
|
+
const visible = this.visiblePageIndices();
|
|
228
|
+
if (index === 0 || visible.length === 0) return 0;
|
|
229
|
+
const target = visible.includes(index) ? index : this.findNearestVisiblePage(index, visible);
|
|
230
|
+
if (target <= 0) return Math.max(target, 0);
|
|
231
|
+
if (!validate) return target;
|
|
232
|
+
return visible.filter((i) => i < target).find((i) => !this.isPageValid(i)) ?? target;
|
|
233
|
+
}
|
|
234
|
+
initialPage = computed(() => {
|
|
235
|
+
const raw = this.formOptions?.()?.initialPage;
|
|
236
|
+
const totalPages = this.pageFields().length;
|
|
237
|
+
const requested = typeof raw === "number" ? raw : raw?.index;
|
|
238
|
+
const validate = typeof raw === "number" ? false : raw?.validate ?? false;
|
|
239
|
+
if (typeof requested !== "number" || !Number.isFinite(requested) || requested < 0 || totalPages === 0) return {
|
|
240
|
+
index: 0,
|
|
241
|
+
validate: false
|
|
242
|
+
};
|
|
243
|
+
return {
|
|
244
|
+
index: Math.min(Math.trunc(requested), totalPages - 1),
|
|
245
|
+
validate
|
|
246
|
+
};
|
|
247
|
+
}, ...ngDevMode ? [{ debugName: "initialPage" }] : /* istanbul ignore next */ []);
|
|
248
|
+
state = computed(() => {
|
|
249
|
+
const currentIndex = this.currentPageIndex();
|
|
250
|
+
const totalPages = this.pageFields().length;
|
|
251
|
+
const visibleIndices = this.visiblePageIndices();
|
|
252
|
+
const currentVisiblePosition = visibleIndices.indexOf(currentIndex);
|
|
253
|
+
return {
|
|
254
|
+
currentPageIndex: currentIndex,
|
|
255
|
+
totalPages,
|
|
256
|
+
isFirstPage: currentVisiblePosition === 0 || currentVisiblePosition === -1,
|
|
257
|
+
isLastPage: currentVisiblePosition >= visibleIndices.length - 1
|
|
258
|
+
};
|
|
259
|
+
}, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
260
|
+
currentPageValid = computed(() => (this.stateManager?.isSchemaCurrent() ?? true) && this.isPageValid(this.currentPageIndex()), ...ngDevMode ? [{ debugName: "currentPageValid" }] : /* istanbul ignore next */ []);
|
|
261
|
+
isPageValid(pageIndex) {
|
|
262
|
+
const pages = this.pageFields();
|
|
263
|
+
const form = this.form();
|
|
264
|
+
if (pageIndex < 0 || pageIndex >= pages.length) return true;
|
|
265
|
+
const leafKeys = collectLeafFieldKeys(pages[pageIndex].fields || []);
|
|
266
|
+
for (const fieldKey of leafKeys) {
|
|
267
|
+
const field = form[fieldKey];
|
|
268
|
+
if (field && typeof field === "function") {
|
|
269
|
+
const fieldState = field();
|
|
270
|
+
if (fieldState && typeof fieldState.valid === "function" && !fieldState.valid()) return false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
extendedFieldSignalContext = computed(() => ({
|
|
276
|
+
...this.fieldSignalContext(),
|
|
277
|
+
currentPageValid: this.currentPageValid
|
|
278
|
+
}), ...ngDevMode ? [{ debugName: "extendedFieldSignalContext" }] : /* istanbul ignore next */ []);
|
|
279
|
+
preloadWindow = computed(() => {
|
|
280
|
+
const perForm = this.formOptions?.()?.pagePreloadWindow;
|
|
281
|
+
return clampWindowSize(perForm, this.globalPreloadWindow);
|
|
282
|
+
}, ...ngDevMode ? [{ debugName: "preloadWindow" }] : /* istanbul ignore next */ []);
|
|
283
|
+
pageRenderStates = computed(() => {
|
|
284
|
+
const activeIndex = this.currentPageIndex();
|
|
285
|
+
const hiddenStates = this.pageHiddenStates();
|
|
286
|
+
const preloadWindow = this.preloadWindow();
|
|
287
|
+
return this.pageFields().map((field, index) => ({
|
|
288
|
+
field,
|
|
289
|
+
index,
|
|
290
|
+
hidden: hiddenStates[index],
|
|
291
|
+
active: index === activeIndex,
|
|
292
|
+
preload: index !== activeIndex && Math.abs(index - activeIndex) <= preloadWindow
|
|
293
|
+
}));
|
|
294
|
+
}, ...ngDevMode ? [{ debugName: "pageRenderStates" }] : /* istanbul ignore next */ []);
|
|
295
|
+
constructor() {
|
|
296
|
+
this.setupEventListeners();
|
|
297
|
+
const preloader = injectFormComponentPreloader();
|
|
298
|
+
explicitEffect([this.pageRenderStates], ([states]) => {
|
|
299
|
+
preloader.preloadFields(states.filter((page) => !page.hidden && (page.active || page.preload)).map((page) => page.field));
|
|
300
|
+
});
|
|
301
|
+
explicitEffect([this.schemaCurrent, this.pageFields], ([schemaCurrent]) => {
|
|
302
|
+
const ownership = this.activePageOwnership();
|
|
303
|
+
if (!schemaCurrent || ownership.initialized) return;
|
|
304
|
+
this.activePageOwnership.set({
|
|
305
|
+
...ownership,
|
|
306
|
+
initialized: true,
|
|
307
|
+
index: this.resolveInitialLanding()
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
explicitEffect([this.state, this.visiblePageIndices], ([state, visibleIndices]) => {
|
|
311
|
+
if (visibleIndices.indexOf(state.currentPageIndex) === -1 && visibleIndices.length > 0) {
|
|
312
|
+
const nearest = this.findNearestVisiblePage(state.currentPageIndex, visibleIndices);
|
|
313
|
+
if (nearest !== -1) this.executePageChange(nearest);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
navigateToNextPage() {
|
|
318
|
+
if ((this.formOptions?.()?.nextButton?.disableWhenPageInvalid ?? true) && !this.currentPageValid()) return {
|
|
319
|
+
success: false,
|
|
320
|
+
newPageIndex: this.state().currentPageIndex,
|
|
321
|
+
error: "Current page has invalid fields"
|
|
322
|
+
};
|
|
323
|
+
const currentState = this.state();
|
|
324
|
+
const visibleIndices = this.visiblePageIndices();
|
|
325
|
+
if (currentState.isLastPage) return {
|
|
326
|
+
success: false,
|
|
327
|
+
newPageIndex: currentState.currentPageIndex,
|
|
328
|
+
error: "Already on the last visible page"
|
|
329
|
+
};
|
|
330
|
+
const currentVisiblePosition = visibleIndices.indexOf(currentState.currentPageIndex);
|
|
331
|
+
if (currentVisiblePosition === -1 || currentVisiblePosition >= visibleIndices.length - 1) return {
|
|
332
|
+
success: false,
|
|
333
|
+
newPageIndex: currentState.currentPageIndex,
|
|
334
|
+
error: "No next visible page available"
|
|
335
|
+
};
|
|
336
|
+
const nextVisiblePageIndex = visibleIndices[currentVisiblePosition + 1];
|
|
337
|
+
return this.executePageChange(nextVisiblePageIndex);
|
|
338
|
+
}
|
|
339
|
+
navigateToPreviousPage() {
|
|
340
|
+
const currentState = this.state();
|
|
341
|
+
const visibleIndices = this.visiblePageIndices();
|
|
342
|
+
if (currentState.isFirstPage) return {
|
|
343
|
+
success: false,
|
|
344
|
+
newPageIndex: currentState.currentPageIndex,
|
|
345
|
+
error: "Already on the first visible page"
|
|
346
|
+
};
|
|
347
|
+
const currentVisiblePosition = visibleIndices.indexOf(currentState.currentPageIndex);
|
|
348
|
+
if (currentVisiblePosition <= 0) return {
|
|
349
|
+
success: false,
|
|
350
|
+
newPageIndex: currentState.currentPageIndex,
|
|
351
|
+
error: "No previous visible page available"
|
|
352
|
+
};
|
|
353
|
+
const prevVisiblePageIndex = visibleIndices[currentVisiblePosition - 1];
|
|
354
|
+
return this.executePageChange(prevVisiblePageIndex);
|
|
355
|
+
}
|
|
356
|
+
navigateToPage(pageIndex, options) {
|
|
357
|
+
const currentIndex = this.state().currentPageIndex;
|
|
358
|
+
const visibleIndices = this.visiblePageIndices();
|
|
359
|
+
if (pageIndex <= currentIndex || !visibleIndices.includes(pageIndex)) return this.executePageChange(pageIndex);
|
|
360
|
+
if (options?.validate === false) return this.executePageChange(pageIndex);
|
|
361
|
+
if (!(this.formOptions?.()?.nextButton?.disableWhenPageInvalid ?? true)) return this.executePageChange(pageIndex);
|
|
362
|
+
const firstInvalidPage = visibleIndices.filter((index) => index >= currentIndex && index < pageIndex).find((index) => !this.isPageValid(index));
|
|
363
|
+
if (firstInvalidPage === void 0) return this.executePageChange(pageIndex);
|
|
364
|
+
this.executePageChange(firstInvalidPage);
|
|
365
|
+
return {
|
|
366
|
+
success: false,
|
|
367
|
+
newPageIndex: firstInvalidPage,
|
|
368
|
+
error: `Cannot navigate to page ${pageIndex}: page ${firstInvalidPage} has invalid fields`
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
executePageChange(pageIndex) {
|
|
372
|
+
const currentState = this.state();
|
|
373
|
+
const totalPages = currentState.totalPages;
|
|
374
|
+
if (pageIndex < 0 || pageIndex >= totalPages) return {
|
|
375
|
+
success: false,
|
|
376
|
+
newPageIndex: currentState.currentPageIndex,
|
|
377
|
+
error: `Invalid page index: ${pageIndex}. Valid range is 0 to ${totalPages - 1}`
|
|
378
|
+
};
|
|
379
|
+
const visibleIndices = this.visiblePageIndices();
|
|
380
|
+
if (!visibleIndices.includes(pageIndex)) return {
|
|
381
|
+
success: false,
|
|
382
|
+
newPageIndex: currentState.currentPageIndex,
|
|
383
|
+
error: `Cannot navigate to hidden page at index ${pageIndex}. Visible pages: [${visibleIndices.join(", ")}]`
|
|
384
|
+
};
|
|
385
|
+
if (pageIndex === currentState.currentPageIndex) return {
|
|
386
|
+
success: true,
|
|
387
|
+
newPageIndex: pageIndex
|
|
388
|
+
};
|
|
389
|
+
const previousIndex = currentState.currentPageIndex;
|
|
390
|
+
this.setCurrentPageIndex(pageIndex);
|
|
391
|
+
this.eventBus.dispatch(PageChangeEvent, pageIndex, totalPages, previousIndex);
|
|
392
|
+
return {
|
|
393
|
+
success: true,
|
|
394
|
+
newPageIndex: pageIndex
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
findNearestVisiblePage(currentIndex, visibleIndices) {
|
|
398
|
+
let nearest = -1;
|
|
399
|
+
let minDistance = Infinity;
|
|
400
|
+
for (const idx of visibleIndices) {
|
|
401
|
+
const distance = Math.abs(idx - currentIndex);
|
|
402
|
+
if (distance < minDistance || distance === minDistance && idx > nearest) {
|
|
403
|
+
minDistance = distance;
|
|
404
|
+
nearest = idx;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return nearest;
|
|
408
|
+
}
|
|
409
|
+
setupEventListeners() {
|
|
410
|
+
this.eventBus.on("next-page").pipe(takeUntilDestroyed()).subscribe(() => {
|
|
411
|
+
this.navigateToNextPage();
|
|
412
|
+
});
|
|
413
|
+
this.eventBus.on("previous-page").pipe(takeUntilDestroyed()).subscribe(() => {
|
|
414
|
+
this.navigateToPreviousPage();
|
|
415
|
+
});
|
|
416
|
+
explicitEffect([this.pendingPageRequest], ([request]) => {
|
|
417
|
+
if (!request) return;
|
|
418
|
+
this.stateManager?.pendingPageRequest.set(null);
|
|
419
|
+
this.navigateToPage(request.index, request.options);
|
|
420
|
+
});
|
|
421
|
+
explicitEffect([this.state], ([state]) => this.eventBus.dispatch(PagerStateEvent, state));
|
|
422
|
+
explicitEffect([this.activePageOwnership], ([ownership]) => this.stateManager?.activePageState.set(ownership));
|
|
423
|
+
}
|
|
424
|
+
evaluatePageHidden(page) {
|
|
425
|
+
if (!page.logic || page.logic.length === 0) return false;
|
|
426
|
+
const hiddenLogic = page.logic.filter((l) => l.type === "hidden");
|
|
427
|
+
if (hiddenLogic.length === 0) return false;
|
|
428
|
+
for (const logic of hiddenLogic) {
|
|
429
|
+
if (typeof logic.condition === "boolean") {
|
|
430
|
+
if (logic.condition) return true;
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const condition = logic.condition;
|
|
434
|
+
const context = this.fieldContextRegistry.createDisplayOnlyContext(page.key || "", this.functionRegistry.getCustomFunctions());
|
|
435
|
+
if (evaluateCondition(condition, context)) return true;
|
|
436
|
+
}
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
440
|
+
minVersion: "12.0.0",
|
|
441
|
+
version: "22.2.5",
|
|
442
|
+
ngImport: i0,
|
|
443
|
+
type: PageOrchestratorComponent,
|
|
444
|
+
deps: [],
|
|
445
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
446
|
+
});
|
|
447
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
448
|
+
minVersion: "17.0.0",
|
|
449
|
+
version: "22.2.5",
|
|
450
|
+
type: PageOrchestratorComponent,
|
|
451
|
+
isStandalone: true,
|
|
452
|
+
selector: "div[page-orchestrator]",
|
|
453
|
+
inputs: {
|
|
454
|
+
pageFields: {
|
|
455
|
+
classPropertyName: "pageFields",
|
|
456
|
+
publicName: "pageFields",
|
|
457
|
+
isSignal: true,
|
|
458
|
+
isRequired: true,
|
|
459
|
+
transformFunction: null
|
|
460
|
+
},
|
|
461
|
+
form: {
|
|
462
|
+
classPropertyName: "form",
|
|
463
|
+
publicName: "form",
|
|
464
|
+
isSignal: true,
|
|
465
|
+
isRequired: true,
|
|
466
|
+
transformFunction: null
|
|
467
|
+
},
|
|
468
|
+
fieldSignalContext: {
|
|
469
|
+
classPropertyName: "fieldSignalContext",
|
|
470
|
+
publicName: "fieldSignalContext",
|
|
471
|
+
isSignal: true,
|
|
472
|
+
isRequired: true,
|
|
473
|
+
transformFunction: null
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
host: {
|
|
477
|
+
properties: {
|
|
478
|
+
"attr.data-current-page": "state().currentPageIndex",
|
|
479
|
+
"attr.data-total-pages": "state().totalPages"
|
|
480
|
+
},
|
|
481
|
+
classAttribute: "df-page-orchestrator"
|
|
482
|
+
},
|
|
483
|
+
providers: [{
|
|
484
|
+
provide: FIELD_SIGNAL_CONTEXT,
|
|
485
|
+
useFactory: (orchestrator) => orchestrator.extendedFieldSignalContext(),
|
|
486
|
+
deps: [PageOrchestratorComponent]
|
|
487
|
+
}],
|
|
488
|
+
ngImport: i0,
|
|
489
|
+
template: `
|
|
490
|
+
@for (page of pageRenderStates(); track page.field.key) {
|
|
491
|
+
<!--
|
|
492
|
+
Skip pages hidden by 'hidden' logic conditions entirely. FormStateManager
|
|
493
|
+
derives schema/value/validators from config (not from mounted components),
|
|
494
|
+
so unmounting a hidden page has no effect on form state — only on render +
|
|
495
|
+
CD cost. This is the page-level equivalent of the existing field-level
|
|
496
|
+
\`@if (!field.hidden())\` gate in page-field.component.ts.
|
|
497
|
+
-->
|
|
498
|
+
@if (!page.hidden) {
|
|
499
|
+
@if (page.active || page.preload) {
|
|
500
|
+
@defer (when page.active; on idle) {
|
|
501
|
+
<section page-field [field]="page.field" [key]="page.field.key" [pageIndex]="page.index" [isVisible]="page.active"></section>
|
|
502
|
+
} @placeholder {
|
|
503
|
+
<div class="df-page-placeholder" [attr.data-page-index]="page.index" [attr.data-page-key]="page.field.key"></div>
|
|
504
|
+
}
|
|
505
|
+
} @else {
|
|
506
|
+
<!--
|
|
507
|
+
Pages outside the preload window remain lightweight placeholders.
|
|
508
|
+
Form state derives from config, so leaving their components unmounted
|
|
509
|
+
does not affect validity, derivations, or navigation. The active page
|
|
510
|
+
renders directly; configured neighbours preload declaratively on idle.
|
|
511
|
+
-->
|
|
512
|
+
<div class="df-page-placeholder" [attr.data-page-index]="page.index" [attr.data-page-key]="page.field.key"></div>
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
`,
|
|
517
|
+
isInline: true,
|
|
518
|
+
styles: [":host{display:block;position:relative;width:100%}\n"],
|
|
519
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
520
|
+
deferBlockDependencies: [() => [import("./ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs").then((m) => m.default)]]
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
i0.ɵɵngDeclareClassMetadataAsync({
|
|
524
|
+
minVersion: "18.0.0",
|
|
525
|
+
version: "22.2.5",
|
|
526
|
+
ngImport: i0,
|
|
527
|
+
type: PageOrchestratorComponent,
|
|
528
|
+
resolveDeferredDeps: () => [import("./ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs").then((m) => m.default)],
|
|
529
|
+
resolveMetadata: (PageFieldComponent) => ({
|
|
530
|
+
decorators: [{
|
|
531
|
+
type: Component,
|
|
532
|
+
args: [{
|
|
533
|
+
selector: "div[page-orchestrator]",
|
|
534
|
+
imports: [PageFieldComponent],
|
|
535
|
+
template: `
|
|
536
|
+
@for (page of pageRenderStates(); track page.field.key) {
|
|
537
|
+
<!--
|
|
538
|
+
Skip pages hidden by 'hidden' logic conditions entirely. FormStateManager
|
|
539
|
+
derives schema/value/validators from config (not from mounted components),
|
|
540
|
+
so unmounting a hidden page has no effect on form state — only on render +
|
|
541
|
+
CD cost. This is the page-level equivalent of the existing field-level
|
|
542
|
+
\`@if (!field.hidden())\` gate in page-field.component.ts.
|
|
543
|
+
-->
|
|
544
|
+
@if (!page.hidden) {
|
|
545
|
+
@if (page.active || page.preload) {
|
|
546
|
+
@defer (when page.active; on idle) {
|
|
547
|
+
<section page-field [field]="page.field" [key]="page.field.key" [pageIndex]="page.index" [isVisible]="page.active"></section>
|
|
548
|
+
} @placeholder {
|
|
549
|
+
<div class="df-page-placeholder" [attr.data-page-index]="page.index" [attr.data-page-key]="page.field.key"></div>
|
|
550
|
+
}
|
|
551
|
+
} @else {
|
|
552
|
+
<!--
|
|
553
|
+
Pages outside the preload window remain lightweight placeholders.
|
|
554
|
+
Form state derives from config, so leaving their components unmounted
|
|
555
|
+
does not affect validity, derivations, or navigation. The active page
|
|
556
|
+
renders directly; configured neighbours preload declaratively on idle.
|
|
557
|
+
-->
|
|
558
|
+
<div class="df-page-placeholder" [attr.data-page-index]="page.index" [attr.data-page-key]="page.field.key"></div>
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
`,
|
|
563
|
+
host: {
|
|
564
|
+
class: "df-page-orchestrator",
|
|
565
|
+
"[attr.data-current-page]": "state().currentPageIndex",
|
|
566
|
+
"[attr.data-total-pages]": "state().totalPages"
|
|
567
|
+
},
|
|
568
|
+
providers: [{
|
|
569
|
+
provide: FIELD_SIGNAL_CONTEXT,
|
|
570
|
+
useFactory: (orchestrator) => orchestrator.extendedFieldSignalContext(),
|
|
571
|
+
deps: [PageOrchestratorComponent]
|
|
572
|
+
}],
|
|
573
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
574
|
+
styles: [":host{display:block;position:relative;width:100%}\n"]
|
|
575
|
+
}]
|
|
576
|
+
}],
|
|
577
|
+
ctorParameters: () => [],
|
|
578
|
+
propDecorators: {
|
|
579
|
+
pageFields: [{
|
|
580
|
+
type: i0.Input,
|
|
581
|
+
args: [{
|
|
582
|
+
isSignal: true,
|
|
583
|
+
alias: "pageFields",
|
|
584
|
+
required: true
|
|
585
|
+
}]
|
|
586
|
+
}],
|
|
587
|
+
form: [{
|
|
588
|
+
type: i0.Input,
|
|
589
|
+
args: [{
|
|
590
|
+
isSignal: true,
|
|
591
|
+
alias: "form",
|
|
592
|
+
required: true
|
|
593
|
+
}]
|
|
594
|
+
}],
|
|
595
|
+
fieldSignalContext: [{
|
|
596
|
+
type: i0.Input,
|
|
597
|
+
args: [{
|
|
598
|
+
isSignal: true,
|
|
599
|
+
alias: "fieldSignalContext",
|
|
600
|
+
required: true
|
|
601
|
+
}]
|
|
602
|
+
}]
|
|
603
|
+
}
|
|
604
|
+
})
|
|
605
|
+
});
|
|
606
|
+
function configHasDerivations(fields) {
|
|
607
|
+
return someField(fields, (field) => {
|
|
608
|
+
if (!field.key) return false;
|
|
609
|
+
const validationField = field;
|
|
610
|
+
return !!validationField.derivation || !!validationField.logic?.some(isDerivationLogicConfig);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
const DERIVATION_RENDER_GATE = new InjectionToken("DERIVATION_RENDER_GATE");
|
|
614
|
+
function createDerivationRenderGate() {
|
|
615
|
+
const stateManager = inject(FormStateManager);
|
|
616
|
+
const injector = inject(Injector);
|
|
617
|
+
const pendingTasks = inject(PendingTasks);
|
|
618
|
+
const logger = inject(DynamicFormLogger$1);
|
|
619
|
+
const hasDerivations = computed(() => {
|
|
620
|
+
const setup = stateManager.formSetup();
|
|
621
|
+
return !!setup && configHasDerivations(setup.schemaFields);
|
|
622
|
+
}, ...ngDevMode ? [{ debugName: "hasDerivations" }] : /* istanbul ignore next */ []);
|
|
623
|
+
const engine = signal("idle", ...ngDevMode ? [{ debugName: "engine" }] : /* istanbul ignore next */ []);
|
|
624
|
+
explicitEffect([hasDerivations], ([has]) => {
|
|
625
|
+
if (!has || engine() !== "idle") return;
|
|
626
|
+
engine.set("loading");
|
|
627
|
+
pendingTasks.run(() => import("./ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-EuYCbquo.mjs").then(({ bootstrapDerivationOrchestrator }) => {
|
|
628
|
+
runInInjectionContext(injector, () => bootstrapDerivationOrchestrator());
|
|
629
|
+
engine.set("wired");
|
|
630
|
+
}).catch((error) => {
|
|
631
|
+
engine.set("failed");
|
|
632
|
+
logger.error("Failed to load the derivation engine; derivations will not apply.", error);
|
|
633
|
+
}));
|
|
634
|
+
});
|
|
635
|
+
return computed(() => {
|
|
636
|
+
if (!hasDerivations()) return true;
|
|
637
|
+
const state = engine();
|
|
638
|
+
return state === "wired" || state === "failed";
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
const WEB_MCP_ENABLED = new InjectionToken("WEB_MCP_ENABLED", {
|
|
642
|
+
providedIn: "root",
|
|
643
|
+
factory: () => false
|
|
644
|
+
});
|
|
645
|
+
const WEB_MCP_GATE = new InjectionToken("WEB_MCP_GATE");
|
|
646
|
+
function createWebMcpGate() {
|
|
647
|
+
const enabled = inject(WEB_MCP_ENABLED);
|
|
648
|
+
const isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
649
|
+
const stateManager = inject(FormStateManager);
|
|
650
|
+
const injector = inject(Injector);
|
|
651
|
+
const destroyRef = inject(DestroyRef);
|
|
652
|
+
const logger = inject(DynamicFormLogger$1);
|
|
653
|
+
if (!enabled || !isBrowser) return computed(() => "disabled");
|
|
654
|
+
const registration = computed(() => {
|
|
655
|
+
const options = stateManager.effectiveFormOptions().webMcp;
|
|
656
|
+
return options ? {
|
|
657
|
+
options,
|
|
658
|
+
setup: stateManager.formSetup()
|
|
659
|
+
} : void 0;
|
|
660
|
+
}, ...ngDevMode ? [{ debugName: "registration" }] : /* istanbul ignore next */ []);
|
|
661
|
+
const status = signal("idle", ...ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []);
|
|
662
|
+
let epoch;
|
|
663
|
+
let epochId = 0;
|
|
664
|
+
const closeEpoch = () => {
|
|
665
|
+
epoch?.abort();
|
|
666
|
+
epoch = void 0;
|
|
667
|
+
};
|
|
668
|
+
destroyRef.onDestroy(closeEpoch);
|
|
669
|
+
explicitEffect([registration], ([input]) => {
|
|
670
|
+
closeEpoch();
|
|
671
|
+
epochId += 1;
|
|
672
|
+
const thisEpoch = epochId;
|
|
673
|
+
if (!input) {
|
|
674
|
+
status.set("idle");
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
const controller = new AbortController();
|
|
678
|
+
epoch = controller;
|
|
679
|
+
status.set("registering");
|
|
680
|
+
import("./ng-forge-dynamic-forms-bootstrap-web-mcp-2wQK_wPp.mjs").then(({ bootstrapWebMcp }) => {
|
|
681
|
+
if (thisEpoch !== epochId || controller.signal.aborted) return;
|
|
682
|
+
return runInInjectionContext(injector, () => bootstrapWebMcp(input.options, controller.signal));
|
|
683
|
+
}).then((result) => {
|
|
684
|
+
if (thisEpoch !== epochId || controller.signal.aborted) return;
|
|
685
|
+
if (result) status.set(result);
|
|
686
|
+
}).catch((error) => {
|
|
687
|
+
if (thisEpoch !== epochId) return;
|
|
688
|
+
status.set("failed");
|
|
689
|
+
logger.error("Failed to load the WebMCP registrar; this form will not be exposed to agents.", error);
|
|
690
|
+
});
|
|
691
|
+
});
|
|
692
|
+
return status.asReadonly();
|
|
693
|
+
}
|
|
694
|
+
const FORM_INITIALIZER = new InjectionToken("FORM_INITIALIZER");
|
|
695
|
+
const AUTO_ID_PREFIX = "df-";
|
|
696
|
+
var DynamicFormInstanceRegistry = class DynamicFormInstanceRegistry {
|
|
697
|
+
slots = /* @__PURE__ */ new Map();
|
|
698
|
+
_membership = signal(0, ...ngDevMode ? [{ debugName: "_membership" }] : /* istanbul ignore next */ []);
|
|
699
|
+
multiplePresent = computed(() => {
|
|
700
|
+
this._membership();
|
|
701
|
+
let visible = 0;
|
|
702
|
+
for (const isVisible of this.slots.values()) if (isVisible()) {
|
|
703
|
+
visible += 1;
|
|
704
|
+
if (visible > 1) return true;
|
|
705
|
+
}
|
|
706
|
+
return false;
|
|
707
|
+
}, ...ngDevMode ? [{ debugName: "multiplePresent" }] : /* istanbul ignore next */ []);
|
|
708
|
+
register(visible) {
|
|
709
|
+
let slot = 1;
|
|
710
|
+
while (this.slots.has(slot)) slot++;
|
|
711
|
+
this.slots.set(slot, visible);
|
|
712
|
+
this._membership.update((m) => m + 1);
|
|
713
|
+
return `${AUTO_ID_PREFIX}${slot}`;
|
|
714
|
+
}
|
|
715
|
+
unregister(id) {
|
|
716
|
+
this.slots.delete(Number(id.slice(3)));
|
|
717
|
+
this._membership.update((m) => m + 1);
|
|
718
|
+
}
|
|
719
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
720
|
+
minVersion: "12.0.0",
|
|
721
|
+
version: "22.2.5",
|
|
722
|
+
ngImport: i0,
|
|
723
|
+
type: DynamicFormInstanceRegistry,
|
|
724
|
+
deps: [],
|
|
725
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
726
|
+
});
|
|
727
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
728
|
+
minVersion: "12.0.0",
|
|
729
|
+
version: "22.2.5",
|
|
730
|
+
ngImport: i0,
|
|
731
|
+
type: DynamicFormInstanceRegistry,
|
|
732
|
+
providedIn: "root"
|
|
733
|
+
});
|
|
734
|
+
};
|
|
735
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
736
|
+
minVersion: "12.0.0",
|
|
737
|
+
version: "22.2.5",
|
|
738
|
+
ngImport: i0,
|
|
739
|
+
type: DynamicFormInstanceRegistry,
|
|
740
|
+
decorators: [{
|
|
741
|
+
type: Injectable,
|
|
742
|
+
args: [{ providedIn: "root" }]
|
|
743
|
+
}]
|
|
744
|
+
});
|
|
745
|
+
const INVALID_ID_CHARS = /[^\w-]+/g;
|
|
746
|
+
function sanitizeIdPrefix(prefix) {
|
|
747
|
+
return prefix.replace(INVALID_ID_CHARS, "_");
|
|
748
|
+
}
|
|
749
|
+
function isRendered(host) {
|
|
750
|
+
if (!host.isConnected) return false;
|
|
751
|
+
if (typeof host.checkVisibility === "function") return host.checkVisibility();
|
|
752
|
+
const rect = host.getBoundingClientRect();
|
|
753
|
+
return rect.width > 0 || rect.height > 0;
|
|
754
|
+
}
|
|
755
|
+
var FormIdPrefixService = class FormIdPrefixService {
|
|
756
|
+
registry = inject(DynamicFormInstanceRegistry);
|
|
757
|
+
options = inject(FORM_OPTIONS, { optional: true });
|
|
758
|
+
logger = inject(DynamicFormLogger$1, { optional: true });
|
|
759
|
+
host = inject(ElementRef).nativeElement;
|
|
760
|
+
visible = signal(true, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
761
|
+
autoId = this.registry.register(this.visible);
|
|
762
|
+
rawPrefix = computed(() => this.options?.()?.idPrefix?.trim() || void 0, ...ngDevMode ? [{ debugName: "rawPrefix" }] : /* istanbul ignore next */ []);
|
|
763
|
+
prefix = computed(() => {
|
|
764
|
+
const explicit = this.rawPrefix();
|
|
765
|
+
if (explicit) return sanitizeIdPrefix(explicit);
|
|
766
|
+
return this.registry.multiplePresent() ? this.autoId : "";
|
|
767
|
+
}, ...ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []);
|
|
768
|
+
constructor() {
|
|
769
|
+
const destroyRef = inject(DestroyRef);
|
|
770
|
+
destroyRef.onDestroy(() => this.registry.unregister(this.autoId));
|
|
771
|
+
if (isPlatformBrowser(inject(PLATFORM_ID)) && typeof ResizeObserver !== "undefined") {
|
|
772
|
+
const ro = new ResizeObserver(() => this.visible.set(isRendered(this.host)));
|
|
773
|
+
ro.observe(this.host);
|
|
774
|
+
destroyRef.onDestroy(() => ro.disconnect());
|
|
775
|
+
}
|
|
776
|
+
if (isDevMode()) explicitEffect([this.rawPrefix], ([raw]) => {
|
|
777
|
+
const safe = raw ? sanitizeIdPrefix(raw) : raw;
|
|
778
|
+
if (raw && safe !== raw) this.logger?.warn(`idPrefix "${raw}" sanitized to "${safe}".`);
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
782
|
+
minVersion: "12.0.0",
|
|
783
|
+
version: "22.2.5",
|
|
784
|
+
ngImport: i0,
|
|
785
|
+
type: FormIdPrefixService,
|
|
786
|
+
deps: [],
|
|
787
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
788
|
+
});
|
|
789
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
790
|
+
minVersion: "12.0.0",
|
|
791
|
+
version: "22.2.5",
|
|
792
|
+
ngImport: i0,
|
|
793
|
+
type: FormIdPrefixService
|
|
794
|
+
});
|
|
795
|
+
};
|
|
796
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
797
|
+
minVersion: "12.0.0",
|
|
798
|
+
version: "22.2.5",
|
|
799
|
+
ngImport: i0,
|
|
800
|
+
type: FormIdPrefixService,
|
|
801
|
+
decorators: [{ type: Injectable }],
|
|
802
|
+
ctorParameters: () => []
|
|
803
|
+
});
|
|
804
|
+
function coreProviders() {
|
|
805
|
+
return [
|
|
806
|
+
EventBus,
|
|
807
|
+
{
|
|
808
|
+
provide: CONTAINER_FIELD_PROCESSORS,
|
|
809
|
+
useFactory: createContainerFieldProcessors
|
|
810
|
+
},
|
|
811
|
+
SchemaRegistryService,
|
|
812
|
+
FunctionRegistryService,
|
|
813
|
+
{
|
|
814
|
+
provide: FORM_STATE_DEPS,
|
|
815
|
+
useFactory: () => ({
|
|
816
|
+
config: null,
|
|
817
|
+
formOptions: null,
|
|
818
|
+
value: null,
|
|
819
|
+
source: null
|
|
820
|
+
})
|
|
821
|
+
},
|
|
822
|
+
FormStateManager,
|
|
823
|
+
{
|
|
824
|
+
provide: RootFormRegistryService,
|
|
825
|
+
useFactory: (stateManager) => new RootFormRegistryService(stateManager.formValue, computed(() => stateManager.form())),
|
|
826
|
+
deps: [FormStateManager]
|
|
827
|
+
},
|
|
828
|
+
FieldContextRegistryService,
|
|
829
|
+
ArrayItemRegistryService,
|
|
830
|
+
{
|
|
831
|
+
provide: DEFAULT_PROPS,
|
|
832
|
+
useFactory: (stateManager) => computed(() => stateManager.activeConfig()?.defaultProps),
|
|
833
|
+
deps: [FormStateManager]
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
provide: DEFAULT_WRAPPERS,
|
|
837
|
+
useFactory: (stateManager) => computed(() => stateManager.activeConfig()?.defaultWrappers),
|
|
838
|
+
deps: [FormStateManager]
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
provide: DEFAULT_VALIDATION_MESSAGES,
|
|
842
|
+
useFactory: (stateManager) => computed(() => stateManager.activeConfig()?.defaultValidationMessages),
|
|
843
|
+
deps: [FormStateManager]
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
provide: FORM_OPTIONS,
|
|
847
|
+
useFactory: (stateManager) => stateManager.effectiveFormOptions,
|
|
848
|
+
deps: [FormStateManager]
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
provide: EXTERNAL_DATA,
|
|
852
|
+
useFactory: (stateManager) => computed(() => stateManager.activeConfig()?.externalData),
|
|
853
|
+
deps: [FormStateManager]
|
|
854
|
+
},
|
|
855
|
+
FormIdPrefixService,
|
|
856
|
+
FieldViewportObserver,
|
|
857
|
+
{
|
|
858
|
+
provide: FORM_ID_PREFIX,
|
|
859
|
+
useFactory: (svc) => svc.prefix,
|
|
860
|
+
deps: [FormIdPrefixService]
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
provide: DEPRECATION_WARNING_TRACKER,
|
|
864
|
+
useFactory: createWarningTracker
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
provide: ADDON_ACTION_REGISTRY,
|
|
868
|
+
useFactory: createAddonActionRegistry
|
|
869
|
+
}
|
|
870
|
+
];
|
|
871
|
+
}
|
|
872
|
+
function derivationProviders() {
|
|
873
|
+
return [{
|
|
874
|
+
provide: DERIVATION_WARNING_TRACKER,
|
|
875
|
+
useFactory: createWarningTracker
|
|
876
|
+
}, {
|
|
877
|
+
provide: DERIVATION_RENDER_GATE,
|
|
878
|
+
useFactory: createDerivationRenderGate
|
|
879
|
+
}];
|
|
880
|
+
}
|
|
881
|
+
function propertyDerivationProviders() {
|
|
882
|
+
return [{
|
|
883
|
+
provide: PROPERTY_OVERRIDE_STORE,
|
|
884
|
+
useFactory: createPropertyOverrideStore
|
|
885
|
+
}];
|
|
886
|
+
}
|
|
887
|
+
function httpExpressionProviders() {
|
|
888
|
+
return [{
|
|
889
|
+
provide: HTTP_CONDITION_CACHE,
|
|
890
|
+
useFactory: () => new HttpConditionCache(100)
|
|
891
|
+
}, HttpConditionFunctionCacheService];
|
|
892
|
+
}
|
|
893
|
+
function asyncExpressionProviders() {
|
|
894
|
+
return [AsyncConditionFunctionCacheService];
|
|
895
|
+
}
|
|
896
|
+
function dynamicValueProviders() {
|
|
897
|
+
return [DynamicValueFunctionCacheService];
|
|
898
|
+
}
|
|
899
|
+
function logicProviders() {
|
|
900
|
+
return [LogicFunctionCacheService];
|
|
901
|
+
}
|
|
902
|
+
function provideDynamicFormDI() {
|
|
903
|
+
return [
|
|
904
|
+
...coreProviders(),
|
|
905
|
+
...logicProviders(),
|
|
906
|
+
...dynamicValueProviders(),
|
|
907
|
+
...httpExpressionProviders(),
|
|
908
|
+
...asyncExpressionProviders(),
|
|
909
|
+
...propertyDerivationProviders(),
|
|
910
|
+
...derivationProviders(),
|
|
911
|
+
{
|
|
912
|
+
provide: WEB_MCP_GATE,
|
|
913
|
+
useFactory: createWebMcpGate
|
|
914
|
+
}
|
|
915
|
+
];
|
|
916
|
+
}
|
|
917
|
+
var EventDispatcher = class EventDispatcher {
|
|
918
|
+
bus;
|
|
919
|
+
dispatch(event) {
|
|
920
|
+
this.bus?.emitInstance(event);
|
|
921
|
+
}
|
|
922
|
+
connect(bus) {
|
|
923
|
+
this.bus = bus;
|
|
924
|
+
}
|
|
925
|
+
disconnect() {
|
|
926
|
+
this.bus = void 0;
|
|
927
|
+
}
|
|
928
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
929
|
+
minVersion: "12.0.0",
|
|
930
|
+
version: "22.2.5",
|
|
931
|
+
ngImport: i0,
|
|
932
|
+
type: EventDispatcher,
|
|
933
|
+
deps: [],
|
|
934
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
935
|
+
});
|
|
936
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
937
|
+
minVersion: "12.0.0",
|
|
938
|
+
version: "22.2.5",
|
|
939
|
+
ngImport: i0,
|
|
940
|
+
type: EventDispatcher
|
|
941
|
+
});
|
|
942
|
+
};
|
|
943
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
944
|
+
minVersion: "12.0.0",
|
|
945
|
+
version: "22.2.5",
|
|
946
|
+
ngImport: i0,
|
|
947
|
+
type: EventDispatcher,
|
|
948
|
+
decorators: [{ type: Injectable }]
|
|
949
|
+
});
|
|
950
|
+
var DfTemplate = class DfTemplate {
|
|
951
|
+
dfTemplate = input.required(...ngDevMode ? [{ debugName: "dfTemplate" }] : /* istanbul ignore next */ []);
|
|
952
|
+
templateRef = inject(TemplateRef);
|
|
953
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
954
|
+
minVersion: "12.0.0",
|
|
955
|
+
version: "22.2.5",
|
|
956
|
+
ngImport: i0,
|
|
957
|
+
type: DfTemplate,
|
|
958
|
+
deps: [],
|
|
959
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
960
|
+
});
|
|
961
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
962
|
+
minVersion: "17.1.0",
|
|
963
|
+
version: "22.2.5",
|
|
964
|
+
type: DfTemplate,
|
|
965
|
+
isStandalone: true,
|
|
966
|
+
selector: "ng-template[dfTemplate]",
|
|
967
|
+
inputs: { dfTemplate: {
|
|
968
|
+
classPropertyName: "dfTemplate",
|
|
969
|
+
publicName: "dfTemplate",
|
|
970
|
+
isSignal: true,
|
|
971
|
+
isRequired: true,
|
|
972
|
+
transformFunction: null
|
|
973
|
+
} },
|
|
974
|
+
exportAs: ["dfTemplate"],
|
|
975
|
+
ngImport: i0
|
|
976
|
+
});
|
|
977
|
+
};
|
|
978
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
979
|
+
minVersion: "12.0.0",
|
|
980
|
+
version: "22.2.5",
|
|
981
|
+
ngImport: i0,
|
|
982
|
+
type: DfTemplate,
|
|
983
|
+
decorators: [{
|
|
984
|
+
type: Directive,
|
|
985
|
+
args: [{
|
|
986
|
+
selector: "ng-template[dfTemplate]",
|
|
987
|
+
exportAs: "dfTemplate"
|
|
988
|
+
}]
|
|
989
|
+
}],
|
|
990
|
+
propDecorators: { dfTemplate: [{
|
|
991
|
+
type: i0.Input,
|
|
992
|
+
args: [{
|
|
993
|
+
isSignal: true,
|
|
994
|
+
alias: "dfTemplate",
|
|
995
|
+
required: true
|
|
996
|
+
}]
|
|
997
|
+
}] }
|
|
998
|
+
});
|
|
999
|
+
var DfFieldTemplateRegistry = class DfFieldTemplateRegistry {
|
|
1000
|
+
_map = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "_map" }] : /* istanbul ignore next */ []);
|
|
1001
|
+
map = this._map.asReadonly();
|
|
1002
|
+
set(value) {
|
|
1003
|
+
this._map.set(value);
|
|
1004
|
+
}
|
|
1005
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1006
|
+
minVersion: "12.0.0",
|
|
1007
|
+
version: "22.2.5",
|
|
1008
|
+
ngImport: i0,
|
|
1009
|
+
type: DfFieldTemplateRegistry,
|
|
1010
|
+
deps: [],
|
|
1011
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1012
|
+
});
|
|
1013
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1014
|
+
minVersion: "12.0.0",
|
|
1015
|
+
version: "22.2.5",
|
|
1016
|
+
ngImport: i0,
|
|
1017
|
+
type: DfFieldTemplateRegistry
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1021
|
+
minVersion: "12.0.0",
|
|
1022
|
+
version: "22.2.5",
|
|
1023
|
+
ngImport: i0,
|
|
1024
|
+
type: DfFieldTemplateRegistry,
|
|
1025
|
+
decorators: [{ type: Injectable }]
|
|
1026
|
+
});
|
|
1027
|
+
var DynamicForm = class DynamicForm {
|
|
1028
|
+
config = input.required({
|
|
1029
|
+
...ngDevMode ? { debugName: "config" } : /* istanbul ignore next */ {},
|
|
1030
|
+
alias: "dynamic-form"
|
|
1031
|
+
});
|
|
1032
|
+
formOptions = input(void 0, ...ngDevMode ? [{ debugName: "formOptions" }] : /* istanbul ignore next */ []);
|
|
1033
|
+
value = model(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1034
|
+
source = input("inline", ...ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []);
|
|
1035
|
+
destroyRef = inject(DestroyRef);
|
|
1036
|
+
injector = inject(Injector);
|
|
1037
|
+
environmentInjector = inject(EnvironmentInjector);
|
|
1038
|
+
eventBus = inject(EventBus);
|
|
1039
|
+
logger = inject(DynamicFormLogger$1);
|
|
1040
|
+
dispatcher = inject(EventDispatcher, { optional: true });
|
|
1041
|
+
templateRegistry = inject(DfFieldTemplateRegistry);
|
|
1042
|
+
globalFieldWindowing = inject(FIELD_WINDOWING);
|
|
1043
|
+
_projectedTemplates = contentChildren(DfTemplate, ...ngDevMode ? [{ debugName: "_projectedTemplates" }] : /* istanbul ignore next */ []);
|
|
1044
|
+
stateManager = this.connectDeps();
|
|
1045
|
+
formIdPrefix = inject(FormIdPrefixService);
|
|
1046
|
+
idPrefix = this.formIdPrefix.prefix;
|
|
1047
|
+
componentId = "dynamic-form";
|
|
1048
|
+
activeConfig = this.stateManager.activeConfig;
|
|
1049
|
+
renderPhase = this.stateManager.renderPhase;
|
|
1050
|
+
formModeDetection = this.stateManager.formModeDetection;
|
|
1051
|
+
pageFieldDefinitions = this.stateManager.pageFieldDefinitions;
|
|
1052
|
+
effectiveFormOptions = this.stateManager.effectiveFormOptions;
|
|
1053
|
+
fieldSignalContext = this.stateManager.fieldSignalContext;
|
|
1054
|
+
defaultValues = this.stateManager.defaultValues;
|
|
1055
|
+
form = this.stateManager.form;
|
|
1056
|
+
formValue = this.stateManager.formValue;
|
|
1057
|
+
valid = this.stateManager.valid;
|
|
1058
|
+
invalid = this.stateManager.invalid;
|
|
1059
|
+
dirty = this.stateManager.dirty;
|
|
1060
|
+
touched = this.stateManager.touched;
|
|
1061
|
+
errors = this.stateManager.errors;
|
|
1062
|
+
disabled = this.stateManager.disabled;
|
|
1063
|
+
submitting = this.stateManager.submitting;
|
|
1064
|
+
fieldLoadingErrors = this.stateManager.fieldLoadingErrors;
|
|
1065
|
+
derivationReady = inject(DERIVATION_RENDER_GATE);
|
|
1066
|
+
shouldRender = computed(() => this.stateManager.shouldRender() && this.stateManager.formSchemaReady() && this.derivationReady(), ...ngDevMode ? [{ debugName: "shouldRender" }] : /* istanbul ignore next */ []);
|
|
1067
|
+
webMcpStatus = inject(WEB_MCP_GATE);
|
|
1068
|
+
resolvedFields = this.stateManager.resolvedFields;
|
|
1069
|
+
fieldWindowing = computed(() => resolveFieldWindowing(this.globalFieldWindowing, this.effectiveFormOptions()?.fieldWindowing), ...ngDevMode ? [{ debugName: "fieldWindowing" }] : /* istanbul ignore next */ []);
|
|
1070
|
+
initializedComponents = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "initializedComponents" }] : /* istanbul ignore next */ []);
|
|
1071
|
+
initialPageReady = signal(false, ...ngDevMode ? [{ debugName: "initialPageReady" }] : /* istanbul ignore next */ []);
|
|
1072
|
+
initializationReady = computed(() => {
|
|
1073
|
+
const config = this.activeConfig();
|
|
1074
|
+
if (!config) return false;
|
|
1075
|
+
if (this.formModeDetection().mode === "paged") return this.initialPageReady();
|
|
1076
|
+
const initialized = this.initializedComponents();
|
|
1077
|
+
return [initializationComponentKey("dynamic-form", this.componentId), ...collectInitializingContainerKeys(config.fields ?? [])].every((key) => initialized.has(key));
|
|
1078
|
+
}, ...ngDevMode ? [{ debugName: "initializationReady" }] : /* istanbul ignore next */ []);
|
|
1079
|
+
initialized$ = toObservable(this.initializationReady, { injector: this.injector }).pipe(filter((ready) => ready), take(1), shareReplay({
|
|
1080
|
+
bufferSize: 1,
|
|
1081
|
+
refCount: false
|
|
1082
|
+
}));
|
|
1083
|
+
validityChange = outputFromObservable(toObservable(this.valid));
|
|
1084
|
+
dirtyChange = outputFromObservable(toObservable(this.dirty));
|
|
1085
|
+
submitted = outputFromObservable(this.stateManager.submitted$);
|
|
1086
|
+
reset = outputFromObservable(this.eventBus.on("form-reset"));
|
|
1087
|
+
cleared = outputFromObservable(this.eventBus.on("form-clear"));
|
|
1088
|
+
events = outputFromObservable(this.eventBus.events$);
|
|
1089
|
+
initialized = outputFromObservable(this.initialized$);
|
|
1090
|
+
activePageInitialized = outputFromObservable(this.eventBus.on("active-page-initialized"));
|
|
1091
|
+
onPageChange = outputFromObservable(this.eventBus.on("page-change"));
|
|
1092
|
+
onPageNavigationStateChange = outputFromObservable(this.eventBus.on("pager-state"));
|
|
1093
|
+
constructor() {
|
|
1094
|
+
this.eventBus.on("component-initialized").pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
1095
|
+
const key = initializationComponentKey(event.componentType, event.componentId);
|
|
1096
|
+
this.initializedComponents.update((current) => {
|
|
1097
|
+
if (current.has(key)) return current;
|
|
1098
|
+
const next = new Set(current);
|
|
1099
|
+
next.add(key);
|
|
1100
|
+
return next;
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1103
|
+
this.eventBus.on("active-page-initialized").pipe(takeUntilDestroyed(this.destroyRef), take(1)).subscribe(() => this.initialPageReady.set(true));
|
|
1104
|
+
this.dispatcher?.connect(this.eventBus);
|
|
1105
|
+
this.destroyRef.onDestroy(() => this.dispatcher?.disconnect());
|
|
1106
|
+
inject(FORM_INITIALIZER, { optional: true });
|
|
1107
|
+
const preload = injectFormComponentPreloader();
|
|
1108
|
+
explicitEffect([this.config], ([config]) => preload.preloadConfig(config));
|
|
1109
|
+
this.setupEffects();
|
|
1110
|
+
this.setupEventHandlers();
|
|
1111
|
+
}
|
|
1112
|
+
onNativeSubmit(event) {
|
|
1113
|
+
event.preventDefault();
|
|
1114
|
+
this.eventBus.dispatch(FormSubmitEvent);
|
|
1115
|
+
}
|
|
1116
|
+
windowsField(field, index) {
|
|
1117
|
+
const w = this.fieldWindowing();
|
|
1118
|
+
return w.enabled && index >= w.eager && !isContainerField$1(field.fieldDef);
|
|
1119
|
+
}
|
|
1120
|
+
placeholderGridClass(field) {
|
|
1121
|
+
const grid = getGridClassString(field.fieldDef);
|
|
1122
|
+
return grid ? `df-field-placeholder ${grid}` : "df-field-placeholder";
|
|
1123
|
+
}
|
|
1124
|
+
setupEffects() {
|
|
1125
|
+
explicitEffect([this.formModeDetection, this.pageFieldDefinitions], ([{ mode }, pages]) => {
|
|
1126
|
+
if (mode === "paged" && pages.length > 0) this.eventBus.dispatch(ComponentInitializedEvent, "dynamic-form", this.componentId);
|
|
1127
|
+
});
|
|
1128
|
+
explicitEffect([
|
|
1129
|
+
this.resolvedFields,
|
|
1130
|
+
this.formModeDetection,
|
|
1131
|
+
this.activeConfig
|
|
1132
|
+
], ([, { mode }, config]) => {
|
|
1133
|
+
if (config && mode === "non-paged") afterNextRender(() => {
|
|
1134
|
+
this.eventBus.dispatch(ComponentInitializedEvent, "dynamic-form", this.componentId);
|
|
1135
|
+
}, { injector: this.injector });
|
|
1136
|
+
});
|
|
1137
|
+
explicitEffect([this._projectedTemplates], ([templates]) => {
|
|
1138
|
+
const map = /* @__PURE__ */ new Map();
|
|
1139
|
+
for (const t of templates) map.set(t.dfTemplate(), t.templateRef);
|
|
1140
|
+
this.templateRegistry.set(map);
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
connectDeps() {
|
|
1144
|
+
const deps = inject(FORM_STATE_DEPS);
|
|
1145
|
+
deps.config = this.config;
|
|
1146
|
+
deps.formOptions = this.formOptions;
|
|
1147
|
+
deps.value = this.value;
|
|
1148
|
+
deps.source = this.source;
|
|
1149
|
+
return inject(FormStateManager);
|
|
1150
|
+
}
|
|
1151
|
+
setupEventHandlers() {
|
|
1152
|
+
createSubmissionHandler({
|
|
1153
|
+
eventBus: this.eventBus,
|
|
1154
|
+
configSignal: this.config,
|
|
1155
|
+
formSignal: this.form,
|
|
1156
|
+
validSignal: this.valid,
|
|
1157
|
+
logger: this.logger
|
|
1158
|
+
}).pipe(takeUntilDestroyed(this.destroyRef)).subscribe({ error: (err) => this.logger.error("Submission handler error", err) });
|
|
1159
|
+
}
|
|
1160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1161
|
+
minVersion: "12.0.0",
|
|
1162
|
+
version: "22.2.5",
|
|
1163
|
+
ngImport: i0,
|
|
1164
|
+
type: DynamicForm,
|
|
1165
|
+
deps: [],
|
|
1166
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1167
|
+
});
|
|
1168
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1169
|
+
minVersion: "17.0.0",
|
|
1170
|
+
version: "22.2.5",
|
|
1171
|
+
type: DynamicForm,
|
|
1172
|
+
isStandalone: true,
|
|
1173
|
+
selector: "form[dynamic-form]",
|
|
1174
|
+
inputs: {
|
|
1175
|
+
config: {
|
|
1176
|
+
classPropertyName: "config",
|
|
1177
|
+
publicName: "dynamic-form",
|
|
1178
|
+
isSignal: true,
|
|
1179
|
+
isRequired: true,
|
|
1180
|
+
transformFunction: null
|
|
1181
|
+
},
|
|
1182
|
+
formOptions: {
|
|
1183
|
+
classPropertyName: "formOptions",
|
|
1184
|
+
publicName: "formOptions",
|
|
1185
|
+
isSignal: true,
|
|
1186
|
+
isRequired: false,
|
|
1187
|
+
transformFunction: null
|
|
1188
|
+
},
|
|
1189
|
+
value: {
|
|
1190
|
+
classPropertyName: "value",
|
|
1191
|
+
publicName: "value",
|
|
1192
|
+
isSignal: true,
|
|
1193
|
+
isRequired: false,
|
|
1194
|
+
transformFunction: null
|
|
1195
|
+
},
|
|
1196
|
+
source: {
|
|
1197
|
+
classPropertyName: "source",
|
|
1198
|
+
publicName: "source",
|
|
1199
|
+
isSignal: true,
|
|
1200
|
+
isRequired: false,
|
|
1201
|
+
transformFunction: null
|
|
1202
|
+
}
|
|
1203
|
+
},
|
|
1204
|
+
outputs: {
|
|
1205
|
+
value: "valueChange",
|
|
1206
|
+
validityChange: "validityChange",
|
|
1207
|
+
dirtyChange: "dirtyChange",
|
|
1208
|
+
submitted: "submitted",
|
|
1209
|
+
reset: "reset",
|
|
1210
|
+
cleared: "cleared",
|
|
1211
|
+
events: "events",
|
|
1212
|
+
initialized: "initialized",
|
|
1213
|
+
activePageInitialized: "activePageInitialized",
|
|
1214
|
+
onPageChange: "onPageChange",
|
|
1215
|
+
onPageNavigationStateChange: "onPageNavigationStateChange"
|
|
1216
|
+
},
|
|
1217
|
+
host: {
|
|
1218
|
+
attributes: { "novalidate": "" },
|
|
1219
|
+
listeners: { "submit": "onNativeSubmit($event)" },
|
|
1220
|
+
properties: {
|
|
1221
|
+
"class.disabled": "disabled()",
|
|
1222
|
+
"class.df-form-paged": "formModeDetection().mode === \"paged\"",
|
|
1223
|
+
"class.df-form-non-paged": "formModeDetection().mode === \"non-paged\"",
|
|
1224
|
+
"attr.data-form-mode": "formModeDetection().mode",
|
|
1225
|
+
"attr.id": "idPrefix() || null"
|
|
1226
|
+
},
|
|
1227
|
+
classAttribute: "df-dynamic-form df-form"
|
|
1228
|
+
},
|
|
1229
|
+
providers: [
|
|
1230
|
+
provideDynamicFormDI(),
|
|
1231
|
+
DfFieldTemplateRegistry,
|
|
1232
|
+
{
|
|
1233
|
+
provide: DF_FIELD_TEMPLATES$1,
|
|
1234
|
+
useFactory: () => inject(DfFieldTemplateRegistry).map
|
|
1235
|
+
}
|
|
1236
|
+
],
|
|
1237
|
+
queries: [{
|
|
1238
|
+
propertyName: "_projectedTemplates",
|
|
1239
|
+
predicate: DfTemplate,
|
|
1240
|
+
isSignal: true
|
|
1241
|
+
}],
|
|
1242
|
+
ngImport: i0,
|
|
1243
|
+
template: `
|
|
1244
|
+
@if (shouldRender()) {
|
|
1245
|
+
@switch (formModeDetection().mode) {
|
|
1246
|
+
@case ('paged') {
|
|
1247
|
+
<div page-orchestrator [pageFields]="pageFieldDefinitions()" [form]="form()" [fieldSignalContext]="fieldSignalContext()"></div>
|
|
1248
|
+
}
|
|
1249
|
+
@case ('non-paged') {
|
|
1250
|
+
@for (field of resolvedFields(); track field.key; let i = $index) {
|
|
1251
|
+
@if (windowsField(field, i)) {
|
|
1252
|
+
@if (!field.hidden()) {
|
|
1253
|
+
@defer (on viewport) {
|
|
1254
|
+
<ng-container *dfFieldOutlet="field; environmentInjector: environmentInjector" />
|
|
1255
|
+
} @placeholder {
|
|
1256
|
+
<div
|
|
1257
|
+
[class]="placeholderGridClass(field)"
|
|
1258
|
+
[style.min-height]="fieldWindowing().placeholderHeight"
|
|
1259
|
+
[attr.data-field-key]="field.key"
|
|
1260
|
+
aria-hidden="true"
|
|
1261
|
+
></div>
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
} @else {
|
|
1265
|
+
<!-- DfFieldOutlet owns the hidden gate so an already-mounted field can be detached
|
|
1266
|
+
and restored without recreating its component and wrapper chain. -->
|
|
1267
|
+
<ng-container *dfFieldOutlet="field; environmentInjector: environmentInjector" />
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
@default {
|
|
1272
|
+
never;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
`,
|
|
1277
|
+
isInline: true,
|
|
1278
|
+
styles: [".df-form{display:grid;grid-template-columns:1fr;gap:var(--df-grid-row-gap, .5rem);width:100%}.df-form>*{grid-column:1/-1}.df-row{display:grid;grid-template-columns:repeat(var(--df-grid-columns, 12),1fr);gap:var(--df-grid-gap, .5rem);align-items:start;width:100%}.df-row>*:not([class*=df-col-]){grid-column:1/-1}.df-col-1{grid-column:span 1}.df-col-2{grid-column:span 2}.df-col-3{grid-column:span 3}.df-col-4{grid-column:span 4}.df-col-5{grid-column:span 5}.df-col-6{grid-column:span 6}.df-col-7{grid-column:span 7}.df-col-8{grid-column:span 8}.df-col-9{grid-column:span 9}.df-col-10{grid-column:span 10}.df-col-11{grid-column:span 11}.df-col-12{grid-column:span 12}.df-col-auto{grid-column:span auto;width:auto}.df-col-full{grid-column:1/-1}.df-col-start-1{grid-column-start:1}.df-col-start-2{grid-column-start:2}.df-col-start-3{grid-column-start:3}.df-col-start-4{grid-column-start:4}.df-col-start-5{grid-column-start:5}.df-col-start-6{grid-column-start:6}.df-col-start-7{grid-column-start:7}.df-col-start-8{grid-column-start:8}.df-col-start-9{grid-column-start:9}.df-col-start-10{grid-column-start:10}.df-col-start-11{grid-column-start:11}.df-col-start-12{grid-column-start:12}.df-col-end-1{grid-column-end:1}.df-col-end-2{grid-column-end:2}.df-col-end-3{grid-column-end:3}.df-col-end-4{grid-column-end:4}.df-col-end-5{grid-column-end:5}.df-col-end-6{grid-column-end:6}.df-col-end-7{grid-column-end:7}.df-col-end-8{grid-column-end:8}.df-col-end-9{grid-column-end:9}.df-col-end-10{grid-column-end:10}.df-col-end-11{grid-column-end:11}.df-col-end-12{grid-column-end:12}.df-col-end-13{grid-column-end:13}@media(max-width:576px){.df-form{--df-grid-gap: var(--df-grid-gap-sm, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-sm, .5rem)}.df-row{grid-template-columns:1fr}.df-row>*{grid-column:1/-1!important}.df-row.df-row-mobile-keep-cols{grid-template-columns:repeat(var(--df-grid-columns, 12),1fr)}.df-row.df-row-mobile-keep-cols>*{grid-column:revert!important}}@media(min-width:577px)and (max-width:768px){.df-form{--df-grid-gap: var(--df-grid-gap-md, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-md, .5rem)}.df-row{--df-grid-columns: 6}.df-col-sm-1{grid-column:span 1}.df-col-sm-2{grid-column:span 2}.df-col-sm-3{grid-column:span 3}.df-col-sm-4{grid-column:span 4}.df-col-sm-5{grid-column:span 5}.df-col-sm-6{grid-column:span 6}.df-col-sm-full{grid-column:1/-1}}@media(min-width:769px)and (max-width:992px){.df-form{--df-grid-gap: var(--df-grid-gap-lg, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-lg, .5rem)}.df-col-md-1{grid-column:span 1}.df-col-md-2{grid-column:span 2}.df-col-md-3{grid-column:span 3}.df-col-md-4{grid-column:span 4}.df-col-md-5{grid-column:span 5}.df-col-md-6{grid-column:span 6}.df-col-md-7{grid-column:span 7}.df-col-md-8{grid-column:span 8}.df-col-md-9{grid-column:span 9}.df-col-md-10{grid-column:span 10}.df-col-md-11{grid-column:span 11}.df-col-md-12{grid-column:span 12}.df-col-md-full{grid-column:1/-1}}@media(min-width:993px){.df-form{--df-grid-gap: var(--df-grid-gap-xl, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-xl, .5rem)}.df-col-lg-1{grid-column:span 1}.df-col-lg-2{grid-column:span 2}.df-col-lg-3{grid-column:span 3}.df-col-lg-4{grid-column:span 4}.df-col-lg-5{grid-column:span 5}.df-col-lg-6{grid-column:span 6}.df-col-lg-7{grid-column:span 7}.df-col-lg-8{grid-column:span 8}.df-col-lg-9{grid-column:span 9}.df-col-lg-10{grid-column:span 10}.df-col-lg-11{grid-column:span 11}.df-col-lg-12{grid-column:span 12}.df-col-lg-full{grid-column:1/-1}}.df-gap-none{--df-grid-gap: 0}.df-gap-xs{--df-grid-gap: .25rem}.df-gap-sm{--df-grid-gap: .5rem}.df-gap-md{--df-grid-gap: 1rem}.df-gap-lg{--df-grid-gap: 1.5rem}.df-gap-xl{--df-grid-gap: 2rem}.df-row-gap-none{--df-grid-row-gap: 0}.df-row-gap-xs{--df-grid-row-gap: .25rem}.df-row-gap-sm{--df-grid-row-gap: .5rem}.df-row-gap-md{--df-grid-row-gap: 1rem}.df-row-gap-lg{--df-grid-row-gap: 1.5rem}.df-row-gap-xl{--df-grid-row-gap: 2rem}.df-field{display:block;width:100%;min-width:0;overflow:hidden;margin:0}.df-group,.df-page{display:block;width:100%}.df-form.disabled,.df-row.disabled,.df-field.disabled{opacity:.6;pointer-events:none}.df-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.df-sr-only-focusable:focus,.df-sr-only-focusable:active{position:static;width:auto;height:auto;padding:inherit;margin:inherit;overflow:visible;clip:auto;white-space:normal}.df-live-region{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.df-form :focus-visible{outline:2px solid var(--df-focus-color, #005fcc);outline-offset:2px}.df-group:focus-within{outline:1px dashed var(--df-focus-color, #005fcc);outline-offset:4px}:host{display:grid;grid-template-columns:1fr;gap:var(--df-grid-row-gap, .5rem);width:100%}:host>*{grid-column:1/-1}:host.df-form-spacing-custom{--df-grid-row-gap: var(--df-form-custom-spacing, 1.5rem)}:host.df-form-gap-none{--df-grid-row-gap: 0}:host.df-form-gap-xs{--df-grid-row-gap: .25rem}:host.df-form-gap-sm{--df-grid-row-gap: .5rem}:host.df-form-gap-md{--df-grid-row-gap: 1rem}:host.df-form-gap-lg{--df-grid-row-gap: 1.5rem}:host.df-form-gap-xl{--df-grid-row-gap: 2rem}:host.df-form-paged{gap:0}.df-field-placeholder{display:block}\n"],
|
|
1279
|
+
dependencies: [{
|
|
1280
|
+
kind: "directive",
|
|
1281
|
+
type: DfFieldOutlet,
|
|
1282
|
+
selector: "[dfFieldOutlet]",
|
|
1283
|
+
inputs: ["dfFieldOutlet", "dfFieldOutletEnvironmentInjector"]
|
|
1284
|
+
}, {
|
|
1285
|
+
kind: "component",
|
|
1286
|
+
type: PageOrchestratorComponent,
|
|
1287
|
+
selector: "div[page-orchestrator]",
|
|
1288
|
+
inputs: [
|
|
1289
|
+
"pageFields",
|
|
1290
|
+
"form",
|
|
1291
|
+
"fieldSignalContext"
|
|
1292
|
+
]
|
|
1293
|
+
}],
|
|
1294
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1295
|
+
deferBlockDependencies: [() => [DfFieldOutlet]]
|
|
1296
|
+
});
|
|
1297
|
+
};
|
|
1298
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1299
|
+
minVersion: "12.0.0",
|
|
1300
|
+
version: "22.2.5",
|
|
1301
|
+
ngImport: i0,
|
|
1302
|
+
type: DynamicForm,
|
|
1303
|
+
decorators: [{
|
|
1304
|
+
type: Component,
|
|
1305
|
+
args: [{
|
|
1306
|
+
selector: "form[dynamic-form]",
|
|
1307
|
+
imports: [DfFieldOutlet, PageOrchestratorComponent],
|
|
1308
|
+
template: `
|
|
1309
|
+
@if (shouldRender()) {
|
|
1310
|
+
@switch (formModeDetection().mode) {
|
|
1311
|
+
@case ('paged') {
|
|
1312
|
+
<div page-orchestrator [pageFields]="pageFieldDefinitions()" [form]="form()" [fieldSignalContext]="fieldSignalContext()"></div>
|
|
1313
|
+
}
|
|
1314
|
+
@case ('non-paged') {
|
|
1315
|
+
@for (field of resolvedFields(); track field.key; let i = $index) {
|
|
1316
|
+
@if (windowsField(field, i)) {
|
|
1317
|
+
@if (!field.hidden()) {
|
|
1318
|
+
@defer (on viewport) {
|
|
1319
|
+
<ng-container *dfFieldOutlet="field; environmentInjector: environmentInjector" />
|
|
1320
|
+
} @placeholder {
|
|
1321
|
+
<div
|
|
1322
|
+
[class]="placeholderGridClass(field)"
|
|
1323
|
+
[style.min-height]="fieldWindowing().placeholderHeight"
|
|
1324
|
+
[attr.data-field-key]="field.key"
|
|
1325
|
+
aria-hidden="true"
|
|
1326
|
+
></div>
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
} @else {
|
|
1330
|
+
<!-- DfFieldOutlet owns the hidden gate so an already-mounted field can be detached
|
|
1331
|
+
and restored without recreating its component and wrapper chain. -->
|
|
1332
|
+
<ng-container *dfFieldOutlet="field; environmentInjector: environmentInjector" />
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
@default {
|
|
1337
|
+
never;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
`,
|
|
1342
|
+
providers: [
|
|
1343
|
+
provideDynamicFormDI(),
|
|
1344
|
+
DfFieldTemplateRegistry,
|
|
1345
|
+
{
|
|
1346
|
+
provide: DF_FIELD_TEMPLATES$1,
|
|
1347
|
+
useFactory: () => inject(DfFieldTemplateRegistry).map
|
|
1348
|
+
}
|
|
1349
|
+
],
|
|
1350
|
+
host: {
|
|
1351
|
+
class: "df-dynamic-form df-form",
|
|
1352
|
+
novalidate: "",
|
|
1353
|
+
"[class.disabled]": "disabled()",
|
|
1354
|
+
"[class.df-form-paged]": "formModeDetection().mode === \"paged\"",
|
|
1355
|
+
"[class.df-form-non-paged]": "formModeDetection().mode === \"non-paged\"",
|
|
1356
|
+
"[attr.data-form-mode]": "formModeDetection().mode",
|
|
1357
|
+
"[attr.id]": "idPrefix() || null",
|
|
1358
|
+
"(submit)": "onNativeSubmit($event)"
|
|
1359
|
+
},
|
|
1360
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1361
|
+
styles: [".df-form{display:grid;grid-template-columns:1fr;gap:var(--df-grid-row-gap, .5rem);width:100%}.df-form>*{grid-column:1/-1}.df-row{display:grid;grid-template-columns:repeat(var(--df-grid-columns, 12),1fr);gap:var(--df-grid-gap, .5rem);align-items:start;width:100%}.df-row>*:not([class*=df-col-]){grid-column:1/-1}.df-col-1{grid-column:span 1}.df-col-2{grid-column:span 2}.df-col-3{grid-column:span 3}.df-col-4{grid-column:span 4}.df-col-5{grid-column:span 5}.df-col-6{grid-column:span 6}.df-col-7{grid-column:span 7}.df-col-8{grid-column:span 8}.df-col-9{grid-column:span 9}.df-col-10{grid-column:span 10}.df-col-11{grid-column:span 11}.df-col-12{grid-column:span 12}.df-col-auto{grid-column:span auto;width:auto}.df-col-full{grid-column:1/-1}.df-col-start-1{grid-column-start:1}.df-col-start-2{grid-column-start:2}.df-col-start-3{grid-column-start:3}.df-col-start-4{grid-column-start:4}.df-col-start-5{grid-column-start:5}.df-col-start-6{grid-column-start:6}.df-col-start-7{grid-column-start:7}.df-col-start-8{grid-column-start:8}.df-col-start-9{grid-column-start:9}.df-col-start-10{grid-column-start:10}.df-col-start-11{grid-column-start:11}.df-col-start-12{grid-column-start:12}.df-col-end-1{grid-column-end:1}.df-col-end-2{grid-column-end:2}.df-col-end-3{grid-column-end:3}.df-col-end-4{grid-column-end:4}.df-col-end-5{grid-column-end:5}.df-col-end-6{grid-column-end:6}.df-col-end-7{grid-column-end:7}.df-col-end-8{grid-column-end:8}.df-col-end-9{grid-column-end:9}.df-col-end-10{grid-column-end:10}.df-col-end-11{grid-column-end:11}.df-col-end-12{grid-column-end:12}.df-col-end-13{grid-column-end:13}@media(max-width:576px){.df-form{--df-grid-gap: var(--df-grid-gap-sm, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-sm, .5rem)}.df-row{grid-template-columns:1fr}.df-row>*{grid-column:1/-1!important}.df-row.df-row-mobile-keep-cols{grid-template-columns:repeat(var(--df-grid-columns, 12),1fr)}.df-row.df-row-mobile-keep-cols>*{grid-column:revert!important}}@media(min-width:577px)and (max-width:768px){.df-form{--df-grid-gap: var(--df-grid-gap-md, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-md, .5rem)}.df-row{--df-grid-columns: 6}.df-col-sm-1{grid-column:span 1}.df-col-sm-2{grid-column:span 2}.df-col-sm-3{grid-column:span 3}.df-col-sm-4{grid-column:span 4}.df-col-sm-5{grid-column:span 5}.df-col-sm-6{grid-column:span 6}.df-col-sm-full{grid-column:1/-1}}@media(min-width:769px)and (max-width:992px){.df-form{--df-grid-gap: var(--df-grid-gap-lg, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-lg, .5rem)}.df-col-md-1{grid-column:span 1}.df-col-md-2{grid-column:span 2}.df-col-md-3{grid-column:span 3}.df-col-md-4{grid-column:span 4}.df-col-md-5{grid-column:span 5}.df-col-md-6{grid-column:span 6}.df-col-md-7{grid-column:span 7}.df-col-md-8{grid-column:span 8}.df-col-md-9{grid-column:span 9}.df-col-md-10{grid-column:span 10}.df-col-md-11{grid-column:span 11}.df-col-md-12{grid-column:span 12}.df-col-md-full{grid-column:1/-1}}@media(min-width:993px){.df-form{--df-grid-gap: var(--df-grid-gap-xl, .5rem);--df-grid-row-gap: var(--df-grid-row-gap-xl, .5rem)}.df-col-lg-1{grid-column:span 1}.df-col-lg-2{grid-column:span 2}.df-col-lg-3{grid-column:span 3}.df-col-lg-4{grid-column:span 4}.df-col-lg-5{grid-column:span 5}.df-col-lg-6{grid-column:span 6}.df-col-lg-7{grid-column:span 7}.df-col-lg-8{grid-column:span 8}.df-col-lg-9{grid-column:span 9}.df-col-lg-10{grid-column:span 10}.df-col-lg-11{grid-column:span 11}.df-col-lg-12{grid-column:span 12}.df-col-lg-full{grid-column:1/-1}}.df-gap-none{--df-grid-gap: 0}.df-gap-xs{--df-grid-gap: .25rem}.df-gap-sm{--df-grid-gap: .5rem}.df-gap-md{--df-grid-gap: 1rem}.df-gap-lg{--df-grid-gap: 1.5rem}.df-gap-xl{--df-grid-gap: 2rem}.df-row-gap-none{--df-grid-row-gap: 0}.df-row-gap-xs{--df-grid-row-gap: .25rem}.df-row-gap-sm{--df-grid-row-gap: .5rem}.df-row-gap-md{--df-grid-row-gap: 1rem}.df-row-gap-lg{--df-grid-row-gap: 1.5rem}.df-row-gap-xl{--df-grid-row-gap: 2rem}.df-field{display:block;width:100%;min-width:0;overflow:hidden;margin:0}.df-group,.df-page{display:block;width:100%}.df-form.disabled,.df-row.disabled,.df-field.disabled{opacity:.6;pointer-events:none}.df-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.df-sr-only-focusable:focus,.df-sr-only-focusable:active{position:static;width:auto;height:auto;padding:inherit;margin:inherit;overflow:visible;clip:auto;white-space:normal}.df-live-region{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.df-form :focus-visible{outline:2px solid var(--df-focus-color, #005fcc);outline-offset:2px}.df-group:focus-within{outline:1px dashed var(--df-focus-color, #005fcc);outline-offset:4px}:host{display:grid;grid-template-columns:1fr;gap:var(--df-grid-row-gap, .5rem);width:100%}:host>*{grid-column:1/-1}:host.df-form-spacing-custom{--df-grid-row-gap: var(--df-form-custom-spacing, 1.5rem)}:host.df-form-gap-none{--df-grid-row-gap: 0}:host.df-form-gap-xs{--df-grid-row-gap: .25rem}:host.df-form-gap-sm{--df-grid-row-gap: .5rem}:host.df-form-gap-md{--df-grid-row-gap: 1rem}:host.df-form-gap-lg{--df-grid-row-gap: 1.5rem}:host.df-form-gap-xl{--df-grid-row-gap: 2rem}:host.df-form-paged{gap:0}.df-field-placeholder{display:block}\n"]
|
|
1362
|
+
}]
|
|
1363
|
+
}],
|
|
1364
|
+
ctorParameters: () => [],
|
|
1365
|
+
propDecorators: {
|
|
1366
|
+
config: [{
|
|
1367
|
+
type: i0.Input,
|
|
1368
|
+
args: [{
|
|
1369
|
+
isSignal: true,
|
|
1370
|
+
alias: "dynamic-form",
|
|
1371
|
+
required: true
|
|
1372
|
+
}]
|
|
1373
|
+
}],
|
|
1374
|
+
formOptions: [{
|
|
1375
|
+
type: i0.Input,
|
|
1376
|
+
args: [{
|
|
1377
|
+
isSignal: true,
|
|
1378
|
+
alias: "formOptions",
|
|
1379
|
+
required: false
|
|
1380
|
+
}]
|
|
1381
|
+
}],
|
|
1382
|
+
value: [{
|
|
1383
|
+
type: i0.Input,
|
|
1384
|
+
args: [{
|
|
1385
|
+
isSignal: true,
|
|
1386
|
+
alias: "value",
|
|
1387
|
+
required: false
|
|
1388
|
+
}]
|
|
1389
|
+
}, {
|
|
1390
|
+
type: i0.Output,
|
|
1391
|
+
args: ["valueChange"]
|
|
1392
|
+
}],
|
|
1393
|
+
source: [{
|
|
1394
|
+
type: i0.Input,
|
|
1395
|
+
args: [{
|
|
1396
|
+
isSignal: true,
|
|
1397
|
+
alias: "source",
|
|
1398
|
+
required: false
|
|
1399
|
+
}]
|
|
1400
|
+
}],
|
|
1401
|
+
_projectedTemplates: [{
|
|
1402
|
+
type: i0.ContentChildren,
|
|
1403
|
+
args: [i0.forwardRef(() => DfTemplate), { isSignal: true }]
|
|
1404
|
+
}],
|
|
1405
|
+
validityChange: [{
|
|
1406
|
+
type: i0.Output,
|
|
1407
|
+
args: ["validityChange"]
|
|
1408
|
+
}],
|
|
1409
|
+
dirtyChange: [{
|
|
1410
|
+
type: i0.Output,
|
|
1411
|
+
args: ["dirtyChange"]
|
|
1412
|
+
}],
|
|
1413
|
+
submitted: [{
|
|
1414
|
+
type: i0.Output,
|
|
1415
|
+
args: ["submitted"]
|
|
1416
|
+
}],
|
|
1417
|
+
reset: [{
|
|
1418
|
+
type: i0.Output,
|
|
1419
|
+
args: ["reset"]
|
|
1420
|
+
}],
|
|
1421
|
+
cleared: [{
|
|
1422
|
+
type: i0.Output,
|
|
1423
|
+
args: ["cleared"]
|
|
1424
|
+
}],
|
|
1425
|
+
events: [{
|
|
1426
|
+
type: i0.Output,
|
|
1427
|
+
args: ["events"]
|
|
1428
|
+
}],
|
|
1429
|
+
initialized: [{
|
|
1430
|
+
type: i0.Output,
|
|
1431
|
+
args: ["initialized"]
|
|
1432
|
+
}],
|
|
1433
|
+
activePageInitialized: [{
|
|
1434
|
+
type: i0.Output,
|
|
1435
|
+
args: ["activePageInitialized"]
|
|
1436
|
+
}],
|
|
1437
|
+
onPageChange: [{
|
|
1438
|
+
type: i0.Output,
|
|
1439
|
+
args: ["onPageChange"]
|
|
1440
|
+
}],
|
|
1441
|
+
onPageNavigationStateChange: [{
|
|
1442
|
+
type: i0.Output,
|
|
1443
|
+
args: ["onPageNavigationStateChange"]
|
|
1444
|
+
}]
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
const BUILT_IN_ADDON_TYPES = [
|
|
1448
|
+
{
|
|
1449
|
+
type: "text",
|
|
1450
|
+
loadComponent: () => Promise.resolve().then(() => text_addon_component_exports).then((m) => m.TextAddonComponent),
|
|
1451
|
+
validate: (addon, fieldKey) => {
|
|
1452
|
+
const text = addon.text;
|
|
1453
|
+
if (text === void 0 || text === null) throw new DynamicFormError$1(`Addon type 'text' requires a 'text' field (field: '${fieldKey}').`);
|
|
1454
|
+
if (typeof text === "string" && text.length === 0) throw new DynamicFormError$1(`Addon type 'text' requires a non-empty 'text' string (field: '${fieldKey}').`);
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
type: "template",
|
|
1459
|
+
loadComponent: () => Promise.resolve().then(() => template_addon_component_exports).then((m) => m.TemplateAddonComponent),
|
|
1460
|
+
validate: (addon, fieldKey) => {
|
|
1461
|
+
const key = addon.templateKey;
|
|
1462
|
+
if (typeof key !== "string" || key.length === 0) throw new DynamicFormError$1(`Addon type 'template' requires a non-empty 'templateKey' string (field: '${fieldKey}').`);
|
|
1463
|
+
}
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
type: "component",
|
|
1467
|
+
jsonSafe: false,
|
|
1468
|
+
loadComponent: () => Promise.resolve().then(() => component_addon_component_exports).then((m) => m.ComponentAddonComponent),
|
|
1469
|
+
validate: (addon, fieldKey) => {
|
|
1470
|
+
if (typeof addon.component !== "function") throw new DynamicFormError$1(`Addon type 'component' requires a 'component' loader function (field: '${fieldKey}').`);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
];
|
|
1474
|
+
const CONTAINER_FIELD_TYPES_BASE = { renderReadyWhen: ["field"] };
|
|
1475
|
+
const DISPLAY_FIELD_TYPES_BASE = { renderReadyWhen: [] };
|
|
1476
|
+
const BUILT_IN_FIELDS = [
|
|
1477
|
+
{
|
|
1478
|
+
name: "row",
|
|
1479
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-container-field.component-Bg7Win9n.mjs"),
|
|
1480
|
+
mapper: rowFieldMapper,
|
|
1481
|
+
valueHandling: "flatten",
|
|
1482
|
+
...CONTAINER_FIELD_TYPES_BASE
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
name: "group",
|
|
1486
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-group-field.component-BjZi0bhq.mjs"),
|
|
1487
|
+
mapper: groupFieldMapper,
|
|
1488
|
+
valueHandling: "include",
|
|
1489
|
+
...CONTAINER_FIELD_TYPES_BASE
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
name: "array",
|
|
1493
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-array-field.component-Dv9mPnJ3.mjs"),
|
|
1494
|
+
mapper: arrayFieldMapper,
|
|
1495
|
+
valueHandling: "include",
|
|
1496
|
+
...CONTAINER_FIELD_TYPES_BASE
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
name: "page",
|
|
1500
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs"),
|
|
1501
|
+
mapper: pageFieldMapper,
|
|
1502
|
+
valueHandling: "flatten",
|
|
1503
|
+
...CONTAINER_FIELD_TYPES_BASE
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
name: "text",
|
|
1507
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-text-field.component--MAh_h4Q.mjs"),
|
|
1508
|
+
mapper: textFieldMapper,
|
|
1509
|
+
valueHandling: "exclude",
|
|
1510
|
+
...DISPLAY_FIELD_TYPES_BASE
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
name: "hidden",
|
|
1514
|
+
valueHandling: "include"
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
name: "container",
|
|
1518
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-container-field.component-Bg7Win9n.mjs"),
|
|
1519
|
+
mapper: containerFieldMapper,
|
|
1520
|
+
valueHandling: "flatten",
|
|
1521
|
+
...CONTAINER_FIELD_TYPES_BASE
|
|
1522
|
+
}
|
|
1523
|
+
];
|
|
1524
|
+
const BUILT_IN_WRAPPERS = [
|
|
1525
|
+
{
|
|
1526
|
+
wrapperName: "css",
|
|
1527
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-css-wrapper.component-R2yc-H0T.mjs")
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
wrapperName: "row",
|
|
1531
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-row-wrapper.component-CuFycQb-.mjs")
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
wrapperName: "field-errors",
|
|
1535
|
+
loadComponent: () => import("./ng-forge-dynamic-forms-field-errors-wrapper.component-DKgkpIpG.mjs"),
|
|
1536
|
+
rendersFieldErrors: true
|
|
1537
|
+
}
|
|
1538
|
+
];
|
|
1539
|
+
function createWrappers(...registrations) {
|
|
1540
|
+
return {
|
|
1541
|
+
ɵkind: "wrappers",
|
|
1542
|
+
ɵregistrations: registrations,
|
|
1543
|
+
ɵdefinitions: registrations.map(({ wrapperName, loadComponent, types }) => ({
|
|
1544
|
+
wrapperName,
|
|
1545
|
+
loadComponent,
|
|
1546
|
+
types
|
|
1547
|
+
}))
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
function isWrappersBundle(value) {
|
|
1551
|
+
return typeof value === "object" && value !== null && "ɵkind" in value && value.ɵkind === "wrappers" && "ɵdefinitions" in value && Array.isArray(value.ɵdefinitions);
|
|
1552
|
+
}
|
|
1553
|
+
function provideDynamicForm(...items) {
|
|
1554
|
+
const fieldTypes = items.filter((item) => !isDynamicFormFeature(item) && !isWrapperTypeDefinition$1(item) && !isWrappersBundle(item));
|
|
1555
|
+
const wrapperTypes = items.filter(isWrapperTypeDefinition$1);
|
|
1556
|
+
const wrapperBundles = items.filter(isWrappersBundle);
|
|
1557
|
+
const features = items.filter(isDynamicFormFeature);
|
|
1558
|
+
const fields = [...BUILT_IN_FIELDS, ...fieldTypes];
|
|
1559
|
+
const customWrappers = [...wrapperTypes, ...wrapperBundles.flatMap((bundle) => bundle.ɵdefinitions)];
|
|
1560
|
+
const wrappers = [...BUILT_IN_WRAPPERS, ...customWrappers];
|
|
1561
|
+
const featureProviders = [];
|
|
1562
|
+
const hasLoggerFeature = features.some((feature) => feature.ɵkind === "logger");
|
|
1563
|
+
features.forEach((feature) => {
|
|
1564
|
+
featureProviders.push(...feature.ɵproviders);
|
|
1565
|
+
});
|
|
1566
|
+
const defaultLoggerProvider = hasLoggerFeature ? [] : [{
|
|
1567
|
+
provide: DynamicFormLogger$1,
|
|
1568
|
+
useValue: new ConsoleLogger()
|
|
1569
|
+
}];
|
|
1570
|
+
return makeEnvironmentProviders([
|
|
1571
|
+
...defaultLoggerProvider,
|
|
1572
|
+
{
|
|
1573
|
+
provide: FIELD_REGISTRY,
|
|
1574
|
+
useFactory: () => {
|
|
1575
|
+
const logger = inject(DynamicFormLogger$1);
|
|
1576
|
+
const registry = /* @__PURE__ */ new Map();
|
|
1577
|
+
fields.forEach((fieldType) => {
|
|
1578
|
+
if (DEV_MODE && registry.has(fieldType.name)) logger.warn(`Field type "${fieldType.name}" is already registered. Overwriting.`);
|
|
1579
|
+
registry.set(fieldType.name, fieldType);
|
|
1580
|
+
});
|
|
1581
|
+
for (const [legacy, canonical] of Object.entries({
|
|
1582
|
+
addArrayItem: "add-array-item",
|
|
1583
|
+
prependArrayItem: "prepend-array-item",
|
|
1584
|
+
insertArrayItem: "insert-array-item",
|
|
1585
|
+
removeArrayItem: "remove-array-item",
|
|
1586
|
+
popArrayItem: "pop-array-item",
|
|
1587
|
+
shiftArrayItem: "shift-array-item"
|
|
1588
|
+
})) {
|
|
1589
|
+
const def = registry.get(canonical);
|
|
1590
|
+
if (def && !registry.has(legacy)) registry.set(legacy, def);
|
|
1591
|
+
}
|
|
1592
|
+
return registry;
|
|
1593
|
+
}
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
provide: WRAPPER_REGISTRY,
|
|
1597
|
+
useFactory: () => {
|
|
1598
|
+
const logger = inject(DynamicFormLogger$1);
|
|
1599
|
+
const registry = /* @__PURE__ */ new Map();
|
|
1600
|
+
const builtInNames = new Set(BUILT_IN_WRAPPERS.map((w) => w.wrapperName));
|
|
1601
|
+
BUILT_IN_WRAPPERS.forEach((wrapperType) => registry.set(wrapperType.wrapperName, wrapperType));
|
|
1602
|
+
const seenCustom = DEV_MODE ? /* @__PURE__ */ new Set() : null;
|
|
1603
|
+
customWrappers.forEach((wrapperType) => {
|
|
1604
|
+
const name = wrapperType.wrapperName;
|
|
1605
|
+
if (seenCustom) {
|
|
1606
|
+
if (seenCustom.has(name) && !builtInNames.has(name)) logger.warn(`Wrapper type "${name}" is already registered. Overwriting.`);
|
|
1607
|
+
seenCustom.add(name);
|
|
1608
|
+
}
|
|
1609
|
+
registry.set(name, wrapperType);
|
|
1610
|
+
});
|
|
1611
|
+
return registry;
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
provide: WRAPPER_AUTO_ASSOCIATIONS,
|
|
1616
|
+
useFactory: () => {
|
|
1617
|
+
const autoMap = /* @__PURE__ */ new Map();
|
|
1618
|
+
for (const wrapperType of wrappers) {
|
|
1619
|
+
if (!wrapperType.types) continue;
|
|
1620
|
+
for (const fieldType of wrapperType.types) {
|
|
1621
|
+
const existing = autoMap.get(fieldType) ?? [];
|
|
1622
|
+
existing.push({ type: wrapperType.wrapperName });
|
|
1623
|
+
autoMap.set(fieldType, existing);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
return autoMap;
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
provide: ADDON_TYPE_REGISTRY,
|
|
1631
|
+
useFactory: () => {
|
|
1632
|
+
const logger = inject(DynamicFormLogger$1);
|
|
1633
|
+
const contributed = inject(ADDON_TYPE_DEFINITIONS, { optional: true }) ?? [];
|
|
1634
|
+
const registry = /* @__PURE__ */ new Map();
|
|
1635
|
+
for (const def of BUILT_IN_ADDON_TYPES) registry.set(def.type, def);
|
|
1636
|
+
for (const def of contributed) {
|
|
1637
|
+
if (DEV_MODE && registry.has(def.type)) logger.warn(`Addon type "${def.type}" is already registered. Overwriting.`);
|
|
1638
|
+
registry.set(def.type, def);
|
|
1639
|
+
}
|
|
1640
|
+
return registry;
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
provide: ADDON_TYPE_COMPONENT_CACHE,
|
|
1645
|
+
useFactory: () => /* @__PURE__ */ new Map()
|
|
1646
|
+
},
|
|
1647
|
+
...featureProviders
|
|
1648
|
+
]);
|
|
1649
|
+
}
|
|
1650
|
+
function withEventFormValue() {
|
|
1651
|
+
return createFeature("event-form-value", [{
|
|
1652
|
+
provide: EMIT_FORM_VALUE_ON_EVENTS,
|
|
1653
|
+
useValue: true
|
|
1654
|
+
}]);
|
|
1655
|
+
}
|
|
1656
|
+
function withValueExclusionDefaults(config) {
|
|
1657
|
+
const resolved = {
|
|
1658
|
+
excludeValueIfHidden: config?.excludeValueIfHidden ?? true,
|
|
1659
|
+
excludeValueIfDisabled: config?.excludeValueIfDisabled ?? true,
|
|
1660
|
+
excludeValueIfReadonly: config?.excludeValueIfReadonly ?? true
|
|
1661
|
+
};
|
|
1662
|
+
return createFeature("value-exclusion", [{
|
|
1663
|
+
provide: VALUE_EXCLUSION_DEFAULTS,
|
|
1664
|
+
useValue: resolved
|
|
1665
|
+
}]);
|
|
1666
|
+
}
|
|
1667
|
+
function withPagePreload(window) {
|
|
1668
|
+
const resolved = clampWindowSize(window, 1);
|
|
1669
|
+
return createFeature("page-preload", [{
|
|
1670
|
+
provide: PAGE_PRELOAD_WINDOW,
|
|
1671
|
+
useValue: resolved
|
|
1672
|
+
}]);
|
|
1673
|
+
}
|
|
1674
|
+
function withFieldWindowing(config) {
|
|
1675
|
+
const resolved = {
|
|
1676
|
+
enabled: true,
|
|
1677
|
+
eager: clampWindowSize(config?.eager, 12),
|
|
1678
|
+
placeholderHeight: config?.placeholderHeight ?? "4rem",
|
|
1679
|
+
park: resolveFieldParking({
|
|
1680
|
+
enabled: true,
|
|
1681
|
+
margin: "100%"
|
|
1682
|
+
}, config?.park)
|
|
1683
|
+
};
|
|
1684
|
+
return createFeature("field-windowing", [{
|
|
1685
|
+
provide: FIELD_WINDOWING,
|
|
1686
|
+
useValue: resolved
|
|
1687
|
+
}]);
|
|
1688
|
+
}
|
|
1689
|
+
function withExperimentalWebMcp() {
|
|
1690
|
+
return createFeature("web-mcp", [{
|
|
1691
|
+
provide: WEB_MCP_ENABLED,
|
|
1692
|
+
useValue: true
|
|
1693
|
+
}]);
|
|
1694
|
+
}
|
|
1695
|
+
function withValidationExecutionDefaults(config) {
|
|
1696
|
+
const resolved = { validateWhenHidden: config?.validateWhenHidden ?? false };
|
|
1697
|
+
return createFeature("validation-execution", [{
|
|
1698
|
+
provide: VALIDATION_EXECUTION_DEFAULTS,
|
|
1699
|
+
useValue: resolved
|
|
1700
|
+
}]);
|
|
1701
|
+
}
|
|
1702
|
+
function withLegacyStatusClasses() {
|
|
1703
|
+
return createFeature("legacy-status-classes", [...provideSignalFormsConfig({ classes: NG_STATUS_CLASSES })]);
|
|
1704
|
+
}
|
|
1705
|
+
function wrapperProps() {}
|
|
1706
|
+
var text_addon_component_exports = /* @__PURE__ */ __exportAll({ TextAddonComponent: () => TextAddonComponent });
|
|
1707
|
+
var TextAddonComponent = class TextAddonComponent {
|
|
1708
|
+
addon = input.required(...ngDevMode ? [{ debugName: "addon" }] : /* istanbul ignore next */ []);
|
|
1709
|
+
fieldInputs = input(...ngDevMode ? [void 0, { debugName: "fieldInputs" }] : /* istanbul ignore next */ []);
|
|
1710
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1711
|
+
minVersion: "12.0.0",
|
|
1712
|
+
version: "22.2.5",
|
|
1713
|
+
ngImport: i0,
|
|
1714
|
+
type: TextAddonComponent,
|
|
1715
|
+
deps: [],
|
|
1716
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1717
|
+
});
|
|
1718
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1719
|
+
minVersion: "17.1.0",
|
|
1720
|
+
version: "22.2.5",
|
|
1721
|
+
type: TextAddonComponent,
|
|
1722
|
+
isStandalone: true,
|
|
1723
|
+
selector: "df-text-addon",
|
|
1724
|
+
inputs: {
|
|
1725
|
+
addon: {
|
|
1726
|
+
classPropertyName: "addon",
|
|
1727
|
+
publicName: "addon",
|
|
1728
|
+
isSignal: true,
|
|
1729
|
+
isRequired: true,
|
|
1730
|
+
transformFunction: null
|
|
1731
|
+
},
|
|
1732
|
+
fieldInputs: {
|
|
1733
|
+
classPropertyName: "fieldInputs",
|
|
1734
|
+
publicName: "fieldInputs",
|
|
1735
|
+
isSignal: true,
|
|
1736
|
+
isRequired: false,
|
|
1737
|
+
transformFunction: null
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
host: { properties: { "attr.aria-hidden": "\"true\"" } },
|
|
1741
|
+
ngImport: i0,
|
|
1742
|
+
template: `<span>{{ addon().text | dynamicText | async }}</span>`,
|
|
1743
|
+
isInline: true,
|
|
1744
|
+
dependencies: [{
|
|
1745
|
+
kind: "pipe",
|
|
1746
|
+
type: AsyncPipe,
|
|
1747
|
+
name: "async"
|
|
1748
|
+
}, {
|
|
1749
|
+
kind: "pipe",
|
|
1750
|
+
type: DynamicTextPipe,
|
|
1751
|
+
name: "dynamicText"
|
|
1752
|
+
}],
|
|
1753
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1754
|
+
});
|
|
1755
|
+
};
|
|
1756
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1757
|
+
minVersion: "12.0.0",
|
|
1758
|
+
version: "22.2.5",
|
|
1759
|
+
ngImport: i0,
|
|
1760
|
+
type: TextAddonComponent,
|
|
1761
|
+
decorators: [{
|
|
1762
|
+
type: Component,
|
|
1763
|
+
args: [{
|
|
1764
|
+
selector: "df-text-addon",
|
|
1765
|
+
imports: [AsyncPipe, DynamicTextPipe],
|
|
1766
|
+
template: `<span>{{ addon().text | dynamicText | async }}</span>`,
|
|
1767
|
+
host: { "[attr.aria-hidden]": "\"true\"" },
|
|
1768
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1769
|
+
}]
|
|
1770
|
+
}],
|
|
1771
|
+
propDecorators: {
|
|
1772
|
+
addon: [{
|
|
1773
|
+
type: i0.Input,
|
|
1774
|
+
args: [{
|
|
1775
|
+
isSignal: true,
|
|
1776
|
+
alias: "addon",
|
|
1777
|
+
required: true
|
|
1778
|
+
}]
|
|
1779
|
+
}],
|
|
1780
|
+
fieldInputs: [{
|
|
1781
|
+
type: i0.Input,
|
|
1782
|
+
args: [{
|
|
1783
|
+
isSignal: true,
|
|
1784
|
+
alias: "fieldInputs",
|
|
1785
|
+
required: false
|
|
1786
|
+
}]
|
|
1787
|
+
}]
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
var template_addon_component_exports = /* @__PURE__ */ __exportAll({ TemplateAddonComponent: () => TemplateAddonComponent });
|
|
1791
|
+
var TemplateAddonComponent = class TemplateAddonComponent {
|
|
1792
|
+
templates = inject(DF_FIELD_TEMPLATES$1, { optional: true });
|
|
1793
|
+
logger = inject(DynamicFormLogger$1);
|
|
1794
|
+
addon = input.required(...ngDevMode ? [{ debugName: "addon" }] : /* istanbul ignore next */ []);
|
|
1795
|
+
fieldInputs = input(...ngDevMode ? [void 0, { debugName: "fieldInputs" }] : /* istanbul ignore next */ []);
|
|
1796
|
+
template = computed(() => {
|
|
1797
|
+
const map = this.templates?.();
|
|
1798
|
+
const key = this.addon().templateKey;
|
|
1799
|
+
return map?.get(key) ?? null;
|
|
1800
|
+
}, ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
|
|
1801
|
+
outletContext = computed(() => ({ $implicit: this.fieldInputs() }), ...ngDevMode ? [{ debugName: "outletContext" }] : /* istanbul ignore next */ []);
|
|
1802
|
+
constructor() {
|
|
1803
|
+
explicitEffect([this.template, this.addon], ([tpl, addon]) => {
|
|
1804
|
+
if (!tpl) this.logger.warn(`Template addon: no <ng-template dfTemplate="${addon.templateKey}"> found. Did you project it as a child of <df-dynamic-form>?`);
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1808
|
+
minVersion: "12.0.0",
|
|
1809
|
+
version: "22.2.5",
|
|
1810
|
+
ngImport: i0,
|
|
1811
|
+
type: TemplateAddonComponent,
|
|
1812
|
+
deps: [],
|
|
1813
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1814
|
+
});
|
|
1815
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1816
|
+
minVersion: "17.0.0",
|
|
1817
|
+
version: "22.2.5",
|
|
1818
|
+
type: TemplateAddonComponent,
|
|
1819
|
+
isStandalone: true,
|
|
1820
|
+
selector: "df-template-addon",
|
|
1821
|
+
inputs: {
|
|
1822
|
+
addon: {
|
|
1823
|
+
classPropertyName: "addon",
|
|
1824
|
+
publicName: "addon",
|
|
1825
|
+
isSignal: true,
|
|
1826
|
+
isRequired: true,
|
|
1827
|
+
transformFunction: null
|
|
1828
|
+
},
|
|
1829
|
+
fieldInputs: {
|
|
1830
|
+
classPropertyName: "fieldInputs",
|
|
1831
|
+
publicName: "fieldInputs",
|
|
1832
|
+
isSignal: true,
|
|
1833
|
+
isRequired: false,
|
|
1834
|
+
transformFunction: null
|
|
1835
|
+
}
|
|
1836
|
+
},
|
|
1837
|
+
ngImport: i0,
|
|
1838
|
+
template: `
|
|
1839
|
+
@if (template(); as tpl) {
|
|
1840
|
+
<ng-container *ngTemplateOutlet="tpl; context: outletContext()" />
|
|
1841
|
+
}
|
|
1842
|
+
`,
|
|
1843
|
+
isInline: true,
|
|
1844
|
+
dependencies: [{
|
|
1845
|
+
kind: "directive",
|
|
1846
|
+
type: NgTemplateOutlet,
|
|
1847
|
+
selector: "[ngTemplateOutlet]",
|
|
1848
|
+
inputs: [
|
|
1849
|
+
"ngTemplateOutletContext",
|
|
1850
|
+
"ngTemplateOutlet",
|
|
1851
|
+
"ngTemplateOutletInjector"
|
|
1852
|
+
]
|
|
1853
|
+
}],
|
|
1854
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1855
|
+
});
|
|
1856
|
+
};
|
|
1857
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1858
|
+
minVersion: "12.0.0",
|
|
1859
|
+
version: "22.2.5",
|
|
1860
|
+
ngImport: i0,
|
|
1861
|
+
type: TemplateAddonComponent,
|
|
1862
|
+
decorators: [{
|
|
1863
|
+
type: Component,
|
|
1864
|
+
args: [{
|
|
1865
|
+
selector: "df-template-addon",
|
|
1866
|
+
imports: [NgTemplateOutlet],
|
|
1867
|
+
template: `
|
|
1868
|
+
@if (template(); as tpl) {
|
|
1869
|
+
<ng-container *ngTemplateOutlet="tpl; context: outletContext()" />
|
|
1870
|
+
}
|
|
1871
|
+
`,
|
|
1872
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1873
|
+
}]
|
|
1874
|
+
}],
|
|
1875
|
+
ctorParameters: () => [],
|
|
1876
|
+
propDecorators: {
|
|
1877
|
+
addon: [{
|
|
1878
|
+
type: i0.Input,
|
|
1879
|
+
args: [{
|
|
1880
|
+
isSignal: true,
|
|
1881
|
+
alias: "addon",
|
|
1882
|
+
required: true
|
|
1883
|
+
}]
|
|
1884
|
+
}],
|
|
1885
|
+
fieldInputs: [{
|
|
1886
|
+
type: i0.Input,
|
|
1887
|
+
args: [{
|
|
1888
|
+
isSignal: true,
|
|
1889
|
+
alias: "fieldInputs",
|
|
1890
|
+
required: false
|
|
1891
|
+
}]
|
|
1892
|
+
}]
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
var component_addon_component_exports = /* @__PURE__ */ __exportAll({ ComponentAddonComponent: () => ComponentAddonComponent });
|
|
1896
|
+
var ComponentAddonComponent = class ComponentAddonComponent {
|
|
1897
|
+
logger = inject(DynamicFormLogger$1);
|
|
1898
|
+
addon = input.required(...ngDevMode ? [{ debugName: "addon" }] : /* istanbul ignore next */ []);
|
|
1899
|
+
fieldInputs = input(...ngDevMode ? [void 0, { debugName: "fieldInputs" }] : /* istanbul ignore next */ []);
|
|
1900
|
+
inputs = computed(() => this.addon().inputs ?? {}, ...ngDevMode ? [{ debugName: "inputs" }] : /* istanbul ignore next */ []);
|
|
1901
|
+
asyncLoaded = signal(void 0, ...ngDevMode ? [{ debugName: "asyncLoaded" }] : /* istanbul ignore next */ []);
|
|
1902
|
+
resolvedComponent = computed(() => {
|
|
1903
|
+
const current = this.addon();
|
|
1904
|
+
const loaded = this.asyncLoaded();
|
|
1905
|
+
return loaded?.addon === current ? loaded.component : void 0;
|
|
1906
|
+
}, ...ngDevMode ? [{ debugName: "resolvedComponent" }] : /* istanbul ignore next */ []);
|
|
1907
|
+
constructor() {
|
|
1908
|
+
explicitEffect([this.addon], ([addon]) => {
|
|
1909
|
+
Promise.resolve(addon.component()).then((mod) => {
|
|
1910
|
+
const component = resolveDefaultExport(mod);
|
|
1911
|
+
if (component) this.asyncLoaded.set({
|
|
1912
|
+
addon,
|
|
1913
|
+
component
|
|
1914
|
+
});
|
|
1915
|
+
}).catch((error) => {
|
|
1916
|
+
this.logger.warn(`Failed to load component addon (slot: '${addon.slot}'): ${error instanceof Error ? error.message : String(error)}`);
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1921
|
+
minVersion: "12.0.0",
|
|
1922
|
+
version: "22.2.5",
|
|
1923
|
+
ngImport: i0,
|
|
1924
|
+
type: ComponentAddonComponent,
|
|
1925
|
+
deps: [],
|
|
1926
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1927
|
+
});
|
|
1928
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1929
|
+
minVersion: "17.0.0",
|
|
1930
|
+
version: "22.2.5",
|
|
1931
|
+
type: ComponentAddonComponent,
|
|
1932
|
+
isStandalone: true,
|
|
1933
|
+
selector: "df-component-addon",
|
|
1934
|
+
inputs: {
|
|
1935
|
+
addon: {
|
|
1936
|
+
classPropertyName: "addon",
|
|
1937
|
+
publicName: "addon",
|
|
1938
|
+
isSignal: true,
|
|
1939
|
+
isRequired: true,
|
|
1940
|
+
transformFunction: null
|
|
1941
|
+
},
|
|
1942
|
+
fieldInputs: {
|
|
1943
|
+
classPropertyName: "fieldInputs",
|
|
1944
|
+
publicName: "fieldInputs",
|
|
1945
|
+
isSignal: true,
|
|
1946
|
+
isRequired: false,
|
|
1947
|
+
transformFunction: null
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
ngImport: i0,
|
|
1951
|
+
template: `
|
|
1952
|
+
@if (resolvedComponent(); as cmp) {
|
|
1953
|
+
<ng-container *ngComponentOutlet="cmp; inputs: inputs()" />
|
|
1954
|
+
}
|
|
1955
|
+
`,
|
|
1956
|
+
isInline: true,
|
|
1957
|
+
dependencies: [{
|
|
1958
|
+
kind: "directive",
|
|
1959
|
+
type: NgComponentOutlet,
|
|
1960
|
+
selector: "[ngComponentOutlet]",
|
|
1961
|
+
inputs: [
|
|
1962
|
+
"ngComponentOutlet",
|
|
1963
|
+
"ngComponentOutletInputs",
|
|
1964
|
+
"ngComponentOutletInjector",
|
|
1965
|
+
"ngComponentOutletEnvironmentInjector",
|
|
1966
|
+
"ngComponentOutletContent",
|
|
1967
|
+
"ngComponentOutletNgModule"
|
|
1968
|
+
],
|
|
1969
|
+
exportAs: ["ngComponentOutlet"]
|
|
1970
|
+
}],
|
|
1971
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1972
|
+
});
|
|
1973
|
+
};
|
|
1974
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1975
|
+
minVersion: "12.0.0",
|
|
1976
|
+
version: "22.2.5",
|
|
1977
|
+
ngImport: i0,
|
|
1978
|
+
type: ComponentAddonComponent,
|
|
1979
|
+
decorators: [{
|
|
1980
|
+
type: Component,
|
|
1981
|
+
args: [{
|
|
1982
|
+
selector: "df-component-addon",
|
|
1983
|
+
imports: [NgComponentOutlet],
|
|
1984
|
+
template: `
|
|
1985
|
+
@if (resolvedComponent(); as cmp) {
|
|
1986
|
+
<ng-container *ngComponentOutlet="cmp; inputs: inputs()" />
|
|
1987
|
+
}
|
|
1988
|
+
`,
|
|
1989
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1990
|
+
}]
|
|
1991
|
+
}],
|
|
1992
|
+
ctorParameters: () => [],
|
|
1993
|
+
propDecorators: {
|
|
1994
|
+
addon: [{
|
|
1995
|
+
type: i0.Input,
|
|
1996
|
+
args: [{
|
|
1997
|
+
isSignal: true,
|
|
1998
|
+
alias: "addon",
|
|
1999
|
+
required: true
|
|
2000
|
+
}]
|
|
2001
|
+
}],
|
|
2002
|
+
fieldInputs: [{
|
|
2003
|
+
type: i0.Input,
|
|
2004
|
+
args: [{
|
|
2005
|
+
isSignal: true,
|
|
2006
|
+
alias: "fieldInputs",
|
|
2007
|
+
required: false
|
|
2008
|
+
}]
|
|
2009
|
+
}]
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
function withCustomAddon(definition) {
|
|
2013
|
+
return createFeature("addons", [{
|
|
2014
|
+
provide: ADDON_TYPE_DEFINITIONS,
|
|
2015
|
+
useValue: definition,
|
|
2016
|
+
multi: true
|
|
2017
|
+
}]);
|
|
2018
|
+
}
|
|
2019
|
+
function withAddonActions(handlers) {
|
|
2020
|
+
return createFeature("addon-actions", [{
|
|
2021
|
+
provide: ADDON_ACTION_HANDLERS,
|
|
2022
|
+
useValue: handlers,
|
|
2023
|
+
multi: true
|
|
2024
|
+
}]);
|
|
2025
|
+
}
|
|
2026
|
+
function sanitizeFormConfig(config, options = {}) {
|
|
2027
|
+
const fieldRegistry = inject(FIELD_REGISTRY);
|
|
2028
|
+
const typeRegistry = inject(ADDON_TYPE_REGISTRY);
|
|
2029
|
+
const source = options.source ?? "inline";
|
|
2030
|
+
const { fields, warnings } = walkAndValidateAddons(config.fields ?? [], fieldRegistry, typeRegistry, source);
|
|
2031
|
+
return {
|
|
2032
|
+
sanitized: {
|
|
2033
|
+
...config,
|
|
2034
|
+
fields
|
|
2035
|
+
},
|
|
2036
|
+
warnings
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
var GoToPageEvent = class {
|
|
2040
|
+
pageIndex;
|
|
2041
|
+
options;
|
|
2042
|
+
type = "go-to-page";
|
|
2043
|
+
constructor(pageIndex, options) {
|
|
2044
|
+
this.pageIndex = pageIndex;
|
|
2045
|
+
this.options = options;
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
2048
|
+
var NextPageEvent = class {
|
|
2049
|
+
type = "next-page";
|
|
2050
|
+
};
|
|
2051
|
+
var PreviousPageEvent = class {
|
|
2052
|
+
type = "previous-page";
|
|
2053
|
+
};
|
|
2054
|
+
var FormResetEvent = class {
|
|
2055
|
+
type = "form-reset";
|
|
2056
|
+
};
|
|
2057
|
+
var FormClearEvent = class {
|
|
2058
|
+
type = "form-clear";
|
|
2059
|
+
};
|
|
2060
|
+
var AppendArrayItemEvent = class {
|
|
2061
|
+
arrayKey;
|
|
2062
|
+
template;
|
|
2063
|
+
type = "append-array-item";
|
|
2064
|
+
constructor(arrayKey, template) {
|
|
2065
|
+
this.arrayKey = arrayKey;
|
|
2066
|
+
this.template = template;
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
var PrependArrayItemEvent = class {
|
|
2070
|
+
arrayKey;
|
|
2071
|
+
template;
|
|
2072
|
+
type = "prepend-array-item";
|
|
2073
|
+
constructor(arrayKey, template) {
|
|
2074
|
+
this.arrayKey = arrayKey;
|
|
2075
|
+
this.template = template;
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
var InsertArrayItemEvent = class {
|
|
2079
|
+
arrayKey;
|
|
2080
|
+
index;
|
|
2081
|
+
template;
|
|
2082
|
+
type = "insert-array-item";
|
|
2083
|
+
constructor(arrayKey, index, template) {
|
|
2084
|
+
this.arrayKey = arrayKey;
|
|
2085
|
+
this.index = index;
|
|
2086
|
+
this.template = template;
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
var PopArrayItemEvent = class {
|
|
2090
|
+
arrayKey;
|
|
2091
|
+
type = "pop-array-item";
|
|
2092
|
+
constructor(arrayKey) {
|
|
2093
|
+
this.arrayKey = arrayKey;
|
|
2094
|
+
}
|
|
2095
|
+
};
|
|
2096
|
+
var ShiftArrayItemEvent = class {
|
|
2097
|
+
arrayKey;
|
|
2098
|
+
type = "shift-array-item";
|
|
2099
|
+
constructor(arrayKey) {
|
|
2100
|
+
this.arrayKey = arrayKey;
|
|
2101
|
+
}
|
|
2102
|
+
};
|
|
2103
|
+
var MoveArrayItemEvent = class {
|
|
2104
|
+
arrayKey;
|
|
2105
|
+
fromIndex;
|
|
2106
|
+
toIndex;
|
|
2107
|
+
type = "move-array-item";
|
|
2108
|
+
constructor(arrayKey, fromIndex, toIndex) {
|
|
2109
|
+
this.arrayKey = arrayKey;
|
|
2110
|
+
this.fromIndex = fromIndex;
|
|
2111
|
+
this.toIndex = toIndex;
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
var RemoveAtIndexEvent = class {
|
|
2115
|
+
arrayKey;
|
|
2116
|
+
index;
|
|
2117
|
+
type = "remove-at-index";
|
|
2118
|
+
constructor(arrayKey, index) {
|
|
2119
|
+
this.arrayKey = arrayKey;
|
|
2120
|
+
this.index = index;
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
function arrayEvent(arrayKey) {
|
|
2124
|
+
return {
|
|
2125
|
+
append: (template) => new AppendArrayItemEvent(arrayKey, template),
|
|
2126
|
+
prepend: (template) => new PrependArrayItemEvent(arrayKey, template),
|
|
2127
|
+
insertAt: (index, template) => new InsertArrayItemEvent(arrayKey, index, template),
|
|
2128
|
+
pop: () => new PopArrayItemEvent(arrayKey),
|
|
2129
|
+
shift: () => new ShiftArrayItemEvent(arrayKey),
|
|
2130
|
+
removeAt: (index) => new RemoveAtIndexEvent(arrayKey, index),
|
|
2131
|
+
move: (from, to) => new MoveArrayItemEvent(arrayKey, from, to)
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
export { ActivePageInitializedEvent, AppendArrayItemEvent, BUILT_IN_FIELDS, ComponentAddonComponent, ConsoleLogger, DF_FIELD_TEMPLATES, DfTemplate, DynamicForm, DynamicFormError, DynamicFormLogger, EventDispatcher, FormClearEvent, FormResetEvent, FormSubmitEvent, GoToPageEvent, InsertArrayItemEvent, MoveArrayItemEvent, NextPageEvent, NoopLogger, PageChangeEvent, PagerStateEvent, PopArrayItemEvent, PrependArrayItemEvent, PreviousPageEvent, RemoveAtIndexEvent, ShiftArrayItemEvent, TemplateAddonComponent, TextAddonComponent, arrayEvent, createWrappers, hasFormValue, isArrayField, isContainerField, isDisplayOnlyField, isFieldBoundContext, isFormStateCondition, isGroupField, isHiddenField, isLeafField, isPageField, isRowField, isSimplifiedArrayField, isValueBearingField, isWrapperTypeDefinition, isWrappersBundle, provideDynamicForm, resolveDynamicValue, rowError, sanitizeFormConfig, withAddonActions, withCustomAddon, withEventFormValue, withExperimentalWebMcp, withFieldWindowing, withLegacyStatusClasses, withLoggerConfig, withPagePreload, withValidationExecutionDefaults, withValueExclusionDefaults, wrapperProps };
|
|
2135
|
+
|
|
2136
|
+
//# sourceMappingURL=ng-forge-dynamic-forms.mjs.map
|