@ng-forge/dynamic-forms 1.3.0-next.3 → 1.3.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/fesm2022/ng-forge-dynamic-forms-active-page-initialized.event-bnrwNw7Y.mjs +156 -0
  2. package/fesm2022/ng-forge-dynamic-forms-active-page-initialized.event-bnrwNw7Y.mjs.map +1 -0
  3. package/fesm2022/{ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-EuYCbquo.mjs → ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-B6WH0Etk.mjs} +2 -2
  4. package/fesm2022/{ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-EuYCbquo.mjs.map → ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-B6WH0Etk.mjs.map} +1 -1
  5. package/fesm2022/{ng-forge-dynamic-forms-bootstrap-web-mcp-2wQK_wPp.mjs → ng-forge-dynamic-forms-bootstrap-web-mcp-VjJn-JeD.mjs} +2 -2
  6. package/fesm2022/{ng-forge-dynamic-forms-bootstrap-web-mcp-2wQK_wPp.mjs.map → ng-forge-dynamic-forms-bootstrap-web-mcp-VjJn-JeD.mjs.map} +1 -1
  7. package/fesm2022/{ng-forge-dynamic-forms-form-state-manager-DcOXRFRL.mjs → ng-forge-dynamic-forms-form-state-manager-BJKBX4FL.mjs} +26 -3
  8. package/fesm2022/ng-forge-dynamic-forms-form-state-manager-BJKBX4FL.mjs.map +1 -0
  9. package/fesm2022/ng-forge-dynamic-forms-internal.mjs +109 -14
  10. package/fesm2022/ng-forge-dynamic-forms-internal.mjs.map +1 -1
  11. package/fesm2022/{ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs → ng-forge-dynamic-forms-page-field.component-Bsd8YpzL.mjs} +37 -5
  12. package/fesm2022/ng-forge-dynamic-forms-page-field.component-Bsd8YpzL.mjs.map +1 -0
  13. package/fesm2022/ng-forge-dynamic-forms.mjs +85 -26
  14. package/fesm2022/ng-forge-dynamic-forms.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/types/ng-forge-dynamic-forms-internal.d.ts +9 -0
  17. package/types/ng-forge-dynamic-forms.d.ts +63 -2
  18. package/fesm2022/ng-forge-dynamic-forms-active-page-initialized.event-CiKN-mcc.mjs +0 -12
  19. package/fesm2022/ng-forge-dynamic-forms-active-page-initialized.event-CiKN-mcc.mjs.map +0 -1
  20. package/fesm2022/ng-forge-dynamic-forms-form-state-manager-DcOXRFRL.mjs.map +0 -1
  21. package/fesm2022/ng-forge-dynamic-forms-page-field.component-BRjQmWC9.mjs.map +0 -1
@@ -0,0 +1,156 @@
1
+ import * as i0 from "@angular/core";
2
+ import { Directive, Injectable, InjectionToken, TemplateRef, computed, inject, input, signal } from "@angular/core";
3
+ var DfPlaceholder = class DfPlaceholder {
4
+ dfPlaceholder = input("", ...ngDevMode ? [{ debugName: "dfPlaceholder" }] : /* istanbul ignore next */ []);
5
+ dfPlaceholderKey = input("", ...ngDevMode ? [{ debugName: "dfPlaceholderKey" }] : /* istanbul ignore next */ []);
6
+ templateRef = inject(TemplateRef);
7
+ static ngTemplateContextGuard(_dir, ctx) {
8
+ return true;
9
+ }
10
+ static ɵfac = i0.ɵɵngDeclareFactory({
11
+ minVersion: "12.0.0",
12
+ version: "22.2.5",
13
+ ngImport: i0,
14
+ type: DfPlaceholder,
15
+ deps: [],
16
+ target: i0.ɵɵFactoryTarget.Directive
17
+ });
18
+ static ɵdir = i0.ɵɵngDeclareDirective({
19
+ minVersion: "17.1.0",
20
+ version: "22.2.5",
21
+ type: DfPlaceholder,
22
+ isStandalone: true,
23
+ selector: "ng-template[dfPlaceholder], ng-template[dfPlaceholderKey]",
24
+ inputs: {
25
+ dfPlaceholder: {
26
+ classPropertyName: "dfPlaceholder",
27
+ publicName: "dfPlaceholder",
28
+ isSignal: true,
29
+ isRequired: false,
30
+ transformFunction: null
31
+ },
32
+ dfPlaceholderKey: {
33
+ classPropertyName: "dfPlaceholderKey",
34
+ publicName: "dfPlaceholderKey",
35
+ isSignal: true,
36
+ isRequired: false,
37
+ transformFunction: null
38
+ }
39
+ },
40
+ exportAs: ["dfPlaceholder"],
41
+ ngImport: i0
42
+ });
43
+ };
44
+ i0.ɵɵngDeclareClassMetadata({
45
+ minVersion: "12.0.0",
46
+ version: "22.2.5",
47
+ ngImport: i0,
48
+ type: DfPlaceholder,
49
+ decorators: [{
50
+ type: Directive,
51
+ args: [{
52
+ selector: "ng-template[dfPlaceholder], ng-template[dfPlaceholderKey]",
53
+ exportAs: "dfPlaceholder"
54
+ }]
55
+ }],
56
+ propDecorators: {
57
+ dfPlaceholder: [{
58
+ type: i0.Input,
59
+ args: [{
60
+ isSignal: true,
61
+ alias: "dfPlaceholder",
62
+ required: false
63
+ }]
64
+ }],
65
+ dfPlaceholderKey: [{
66
+ type: i0.Input,
67
+ args: [{
68
+ isSignal: true,
69
+ alias: "dfPlaceholderKey",
70
+ required: false
71
+ }]
72
+ }]
73
+ }
74
+ });
75
+ var DfPlaceholderRegistry = class DfPlaceholderRegistry {
76
+ source = signal(void 0, ...ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []);
77
+ placeholders = computed(() => foldPlaceholders(this.source()?.() ?? []), ...ngDevMode ? [{ debugName: "placeholders" }] : /* istanbul ignore next */ []);
78
+ bind(projected) {
79
+ this.source.set(projected);
80
+ }
81
+ static ɵfac = i0.ɵɵngDeclareFactory({
82
+ minVersion: "12.0.0",
83
+ version: "22.2.5",
84
+ ngImport: i0,
85
+ type: DfPlaceholderRegistry,
86
+ deps: [],
87
+ target: i0.ɵɵFactoryTarget.Injectable
88
+ });
89
+ static ɵprov = i0.ɵɵngDeclareInjectable({
90
+ minVersion: "12.0.0",
91
+ version: "22.2.5",
92
+ ngImport: i0,
93
+ type: DfPlaceholderRegistry
94
+ });
95
+ };
96
+ i0.ɵɵngDeclareClassMetadata({
97
+ minVersion: "12.0.0",
98
+ version: "22.2.5",
99
+ ngImport: i0,
100
+ type: DfPlaceholderRegistry,
101
+ decorators: [{ type: Injectable }]
102
+ });
103
+ function foldPlaceholders(placeholders) {
104
+ const byKey = /* @__PURE__ */ new Map();
105
+ const byType = /* @__PURE__ */ new Map();
106
+ let fallback;
107
+ for (const p of placeholders) {
108
+ const key = p.dfPlaceholderKey();
109
+ const type = p.dfPlaceholder();
110
+ if (key) byKey.set(key, p.templateRef);
111
+ else if (type) byType.set(type, p.templateRef);
112
+ else fallback = p.templateRef;
113
+ }
114
+ return {
115
+ byKey,
116
+ byType,
117
+ default: fallback
118
+ };
119
+ }
120
+ const DF_FIELD_PLACEHOLDERS = new InjectionToken("DF_FIELD_PLACEHOLDERS");
121
+ function resolvePlaceholderTemplate(placeholders, field) {
122
+ return placeholders.byKey.get(field.key) ?? placeholders.byType.get(field.type) ?? placeholders.default ?? null;
123
+ }
124
+ function createPlaceholderContextCache() {
125
+ const cache = /* @__PURE__ */ new WeakMap();
126
+ return (field) => {
127
+ let ctx = cache.get(field.fieldDef);
128
+ if (!ctx) {
129
+ const label = typeof field.fieldDef.label === "string" ? field.fieldDef.label : void 0;
130
+ const info = {
131
+ key: field.key,
132
+ type: field.fieldDef.type,
133
+ label,
134
+ col: field.fieldDef.col
135
+ };
136
+ ctx = {
137
+ $implicit: info,
138
+ field: info
139
+ };
140
+ cache.set(field.fieldDef, ctx);
141
+ }
142
+ return ctx;
143
+ };
144
+ }
145
+ var ActivePageInitializedEvent = class {
146
+ pageIndex;
147
+ pageKey;
148
+ type = "active-page-initialized";
149
+ constructor(pageIndex, pageKey) {
150
+ this.pageIndex = pageIndex;
151
+ this.pageKey = pageKey;
152
+ }
153
+ };
154
+ export { DfPlaceholder as a, DF_FIELD_PLACEHOLDERS as i, createPlaceholderContextCache as n, DfPlaceholderRegistry as o, resolvePlaceholderTemplate as r, ActivePageInitializedEvent as t };
155
+
156
+ //# sourceMappingURL=ng-forge-dynamic-forms-active-page-initialized.event-bnrwNw7Y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-active-page-initialized.event-bnrwNw7Y.mjs","names":[],"sources":["../../../../packages/dynamic-forms/src/lib/directives/df-placeholder/df-placeholder.directive.ts","../../../../packages/dynamic-forms/src/lib/directives/df-placeholder/resolve-placeholder-template.ts","../../../../packages/dynamic-forms/src/lib/events/constants/active-page-initialized.event.ts"],"sourcesContent":["import { computed, Directive, Injectable, inject, InjectionToken, input, Signal, signal, TemplateRef } from '@angular/core';\n\n/**\n * Field metadata handed to a projected placeholder template as its context —\n * both `$implicit` (for `let-field`) and the named `field`. Deliberately narrow\n * and stable: it is NOT the internal `ResolvedField`.\n */\nexport interface FieldPlaceholderInfo {\n /** The field's key. */\n readonly key: string;\n /** The field's type (e.g. `input`, `textarea`, `select`). */\n readonly type: string;\n /** The field's label when it is a plain string; translated (Observable or Signal) labels are not resolved. */\n readonly label?: string;\n /** The field's grid column span, if any. */\n readonly col?: number;\n}\n\n/** Template context for a projected `dfPlaceholder`. */\nexport interface FieldPlaceholderContext {\n readonly $implicit: FieldPlaceholderInfo;\n readonly field: FieldPlaceholderInfo;\n}\n\n/**\n * Resolved placeholder templates, indexed for the resolution cascade\n * (key → type → default). Empty maps + no default means \"use the built-in\n * bare div\", preserving the pre-projection behaviour.\n */\nexport interface ResolvedPlaceholders {\n readonly byKey: ReadonlyMap<string, TemplateRef<FieldPlaceholderContext>>;\n readonly byType: ReadonlyMap<string, TemplateRef<FieldPlaceholderContext>>;\n readonly default?: TemplateRef<FieldPlaceholderContext>;\n}\n\n/**\n * Marks an `<ng-template>` projected into `<form dynamic-form>` content as a\n * field-windowing placeholder. Mirrors {@link DfTemplate}: the template is\n * captured by `DynamicForm` via `contentChildren` and published through\n * {@link DF_FIELD_PLACEHOLDERS} so dynamically-rendered pages can resolve it.\n *\n * - `<ng-template dfPlaceholder let-field>` — default, used for any field\n * - `<ng-template dfPlaceholder=\"textarea\">` — matched by field type\n * - `<ng-template dfPlaceholderKey=\"username\">` — matched by a specific field key\n */\n@Directive({\n selector: 'ng-template[dfPlaceholder], ng-template[dfPlaceholderKey]',\n exportAs: 'dfPlaceholder',\n})\nexport class DfPlaceholder {\n /** Field-type match, or empty for the default placeholder. */\n readonly dfPlaceholder = input<string>('');\n /** Field-key match (escape hatch); wins over a type match. */\n readonly dfPlaceholderKey = input<string>('');\n\n readonly templateRef = inject(TemplateRef) as TemplateRef<FieldPlaceholderContext>;\n\n /** Types `let-field` in `<ng-template dfPlaceholder let-field>`. */\n static ngTemplateContextGuard(_dir: DfPlaceholder, ctx: unknown): ctx is FieldPlaceholderContext {\n return true;\n }\n}\n\n/**\n * Holder service published at the `<form dynamic-form>` component scope.\n * `DynamicForm` collects projected `<ng-template dfPlaceholder>` via\n * `contentChildren(DfPlaceholder)` and folds them into the cascade structure.\n * The {@link DF_FIELD_PLACEHOLDERS} token exposes the resulting signal so\n * page/container renderers resolve placeholders without coupling to the host\n * form's generic class.\n */\n@Injectable()\nexport class DfPlaceholderRegistry {\n private readonly source = signal<Signal<readonly DfPlaceholder[]> | undefined>(undefined);\n\n /** Reactive view consumed via {@link DF_FIELD_PLACEHOLDERS}; follows bound inputs on the projected templates. */\n readonly placeholders: Signal<ResolvedPlaceholders> = computed(() => foldPlaceholders(this.source()?.() ?? []));\n\n /** Connects the form's `contentChildren(DfPlaceholder)` query. */\n bind(projected: Signal<readonly DfPlaceholder[]>): void {\n this.source.set(projected);\n }\n}\n\n/** Folds projected templates into the cascade structure (last wins per bucket). Key beats type beats default. */\nfunction foldPlaceholders(placeholders: readonly DfPlaceholder[]): ResolvedPlaceholders {\n const byKey = new Map<string, TemplateRef<FieldPlaceholderContext>>();\n const byType = new Map<string, TemplateRef<FieldPlaceholderContext>>();\n let fallback: TemplateRef<FieldPlaceholderContext> | undefined;\n for (const p of placeholders) {\n const key = p.dfPlaceholderKey();\n const type = p.dfPlaceholder();\n if (key) byKey.set(key, p.templateRef);\n else if (type) byType.set(type, p.templateRef);\n else fallback = p.templateRef;\n }\n return { byKey, byType, default: fallback };\n}\n\n/** Reactive resolved placeholders, provided at the DynamicForm scope. */\nexport const DF_FIELD_PLACEHOLDERS = new InjectionToken<Signal<ResolvedPlaceholders>>('DF_FIELD_PLACEHOLDERS');\n","import type { TemplateRef } from '@angular/core';\nimport type { FieldPlaceholderContext, ResolvedPlaceholders } from './df-placeholder.directive';\nimport type { ResolvedField } from '../../utils/resolve-field/resolve-field';\n\n/**\n * Resolves the projected placeholder template for a windowed field, following\n * the cascade: a key match wins over a type match, which wins over the default\n * template. Returns `null` when nothing matches, so the caller renders the\n * built-in bare placeholder div (the pre-projection behaviour).\n */\nexport function resolvePlaceholderTemplate(\n placeholders: ResolvedPlaceholders,\n field: { key: string; type: string },\n): TemplateRef<FieldPlaceholderContext> | null {\n return placeholders.byKey.get(field.key) ?? placeholders.byType.get(field.type) ?? placeholders.default ?? null;\n}\n\n/**\n * Returns a per-instance lookup for a windowed field's placeholder context.\n * Keyed by the field definition object, so a config change gives fresh label/type/col\n * while unchanged fields keep a stable context across change detection.\n */\nexport function createPlaceholderContextCache(): (field: ResolvedField) => FieldPlaceholderContext {\n const cache = new WeakMap<object, FieldPlaceholderContext>();\n return (field) => {\n let ctx = cache.get(field.fieldDef);\n if (!ctx) {\n const label = typeof field.fieldDef.label === 'string' ? field.fieldDef.label : undefined;\n const info = { key: field.key, type: field.fieldDef.type, label, col: field.fieldDef.col };\n ctx = { $implicit: info, field: info };\n cache.set(field.fieldDef, ctx);\n }\n return ctx;\n };\n}\n","import { FormEvent } from '@ng-forge/dynamic-forms/internal';\n\n/** Emitted after the active page and all of its visible fields have rendered. */\nexport class ActivePageInitializedEvent implements FormEvent {\n readonly type = 'active-page-initialized' as const;\n\n constructor(\n public readonly pageIndex: number,\n public readonly pageKey: string,\n ) {}\n}\n"],"mappings":";;AAiDA,IAAa,gBAAb,MAAa,cAAa;CAEf,gBAAgB,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAEjC,mBAAmB,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Ae;EADf,KAAA,YAAA;EACA,KAAA,UAAA;CACf;AACJ"}
@@ -1,5 +1,5 @@
1
1
  import { c as traverseFieldsWithContext, o as DERIVATION_WARNING_TRACKER, t as DERIVATION_LOG_CONFIG } from "./ng-forge-dynamic-forms-with-logger-config-BAATqYY0.mjs";
2
- import { n as FormStateManager } from "./ng-forge-dynamic-forms-form-state-manager-DcOXRFRL.mjs";
2
+ import { n as FormStateManager } from "./ng-forge-dynamic-forms-form-state-manager-BJKBX4FL.mjs";
3
3
  import { c as PROPERTY_OVERRIDE_STORE } from "./ng-forge-dynamic-forms-resolve-field-ByGa5cpo.mjs";
4
4
  import { t as DEV_MODE } from "./ng-forge-dynamic-forms-dev-mode-4rbYBBo_.mjs";
5
5
  import "./ng-forge-dynamic-forms-debounce-CG3uP5B-.mjs";
@@ -1884,4 +1884,4 @@ function bootstrapDerivationOrchestrator() {
1884
1884
  }
1885
1885
  export { bootstrapDerivationOrchestrator };
1886
1886
 
1887
- //# sourceMappingURL=ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-EuYCbquo.mjs.map
1887
+ //# sourceMappingURL=ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-B6WH0Etk.mjs.map