@dereekb/dbx-form 13.8.0 → 13.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/dereekb-dbx-form-calendar.mjs +10 -18
- package/fesm2022/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form-flex.wrapper.component-CpOHCk87.mjs +39 -0
- package/fesm2022/dereekb-dbx-form-flex.wrapper.component-CpOHCk87.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-info.wrapper.component-18n632L-.mjs +61 -0
- package/fesm2022/dereekb-dbx-form-info.wrapper.component-18n632L-.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-mapbox.mjs +26 -16
- package/fesm2022/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form-section.wrapper.component-vq21oG6v.mjs +52 -0
- package/fesm2022/dereekb-dbx-form-section.wrapper.component-vq21oG6v.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-style.wrapper.component-BbKj-IHD.mjs +42 -0
- package/fesm2022/dereekb-dbx-form-style.wrapper.component-BbKj-IHD.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form.mjs +4893 -2968
- package/fesm2022/dereekb-dbx-form.mjs.map +1 -1
- package/lib/forge/_forge.scss +14 -0
- package/lib/forge/field/_field.scss +0 -2
- package/lib/forge/field/selection/_selection.scss +3 -0
- package/lib/forge/field/selection/list/_list.scss +17 -0
- package/lib/forge/field/selection/pickable/_pickable.scss +26 -1
- package/lib/forge/field/selection/sourceselect/_sourceselect.scss +16 -32
- package/lib/forge/field/wrapper/_wrapper.scss +16 -6
- package/lib/{formly/form/_form.scss → forge/preset/_preset.scss} +3 -12
- package/lib/forge/style/_shared.scss +13 -3
- package/lib/form/_form.scss +21 -7
- package/lib/formly/field/selection/sourceselect/_sourceselect.scss +0 -7
- package/lib/style/_all-core.scss +2 -4
- package/lib/style/_all-theme.scss +2 -4
- package/lib/style/_all-typography.scss +1 -1
- package/package.json +10 -10
- package/types/dereekb-dbx-form-calendar.d.ts +9 -20
- package/types/dereekb-dbx-form-mapbox.d.ts +15 -12
- package/types/dereekb-dbx-form.d.ts +4962 -3950
- package/fesm2022/dereekb-dbx-form-array.field.component-1wYSd4d3.mjs +0 -169
- package/fesm2022/dereekb-dbx-form-array.field.component-1wYSd4d3.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-formfield.field.component-BQyujXe3.mjs +0 -70
- package/fesm2022/dereekb-dbx-form-formfield.field.component-BQyujXe3.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-info.wrapper.field.component-Crm4wVr5.mjs +0 -35
- package/fesm2022/dereekb-dbx-form-info.wrapper.field.component-Crm4wVr5.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-section.field.component-DliafLqL.mjs +0 -63
- package/fesm2022/dereekb-dbx-form-section.field.component-DliafLqL.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-style.field.component-C3ZNiotx.mjs +0 -71
- package/fesm2022/dereekb-dbx-form-style.field.component-C3ZNiotx.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-working.field.component-CO8vK2bH.mjs +0 -53
- package/fesm2022/dereekb-dbx-form-working.field.component-CO8vK2bH.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-working.wrapper.field.component-BtD7_5i5.mjs +0 -54
- package/fesm2022/dereekb-dbx-form-working.wrapper.field.component-BtD7_5i5.mjs.map +0 -1
- package/fesm2022/dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs +0 -87
- package/fesm2022/dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs.map +0 -1
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, signal, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { CdkDropList, CdkDrag, CdkDragHandle, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
4
|
-
import * as i1 from '@angular/material/icon';
|
|
5
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
-
import * as i3 from '@angular/material/button';
|
|
7
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
8
|
-
import { DynamicForm } from '@ng-forge/dynamic-forms';
|
|
9
|
-
import { DbxButtonComponent, DbxButtonSpacerDirective } from '@dereekb/dbx-web';
|
|
10
|
-
import { forgeFieldDisabled } from './dereekb-dbx-form.mjs';
|
|
11
|
-
|
|
12
|
-
let _forgeArrayItemTrackId = 0;
|
|
13
|
-
/**
|
|
14
|
-
* Forge ValueFieldComponent that renders a drag-and-drop array.
|
|
15
|
-
*
|
|
16
|
-
* Each array item is rendered as a nested `DynamicForm` using the provided template.
|
|
17
|
-
* Items can be reordered via CDK drag/drop, added, removed, and duplicated.
|
|
18
|
-
*
|
|
19
|
-
* This is the forge equivalent of formly's `DbxFormRepeatArrayTypeComponent`.
|
|
20
|
-
*/
|
|
21
|
-
class DbxForgeArrayFieldComponent {
|
|
22
|
-
// ng-forge ValueFieldComponent inputs
|
|
23
|
-
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
24
|
-
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
25
|
-
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
26
|
-
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
27
|
-
className = input('', ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
|
|
28
|
-
tabIndex = input(...(ngDevMode ? [undefined, { debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
29
|
-
props = input(...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
30
|
-
meta = input(...(ngDevMode ? [undefined, { debugName: "meta" }] : /* istanbul ignore next */ []));
|
|
31
|
-
validationMessages = input(...(ngDevMode ? [undefined, { debugName: "validationMessages" }] : /* istanbul ignore next */ []));
|
|
32
|
-
defaultValidationMessages = input(...(ngDevMode ? [undefined, { debugName: "defaultValidationMessages" }] : /* istanbul ignore next */ []));
|
|
33
|
-
itemsSignal = signal([], ...(ngDevMode ? [{ debugName: "itemsSignal" }] : /* istanbul ignore next */ []));
|
|
34
|
-
_initialized = false;
|
|
35
|
-
templateConfigSignal = computed(() => {
|
|
36
|
-
const template = this.props()?.template;
|
|
37
|
-
if (!template) {
|
|
38
|
-
return { fields: [] };
|
|
39
|
-
}
|
|
40
|
-
const fields = Array.isArray(template) ? template : [template];
|
|
41
|
-
return { fields };
|
|
42
|
-
}, ...(ngDevMode ? [{ debugName: "templateConfigSignal" }] : /* istanbul ignore next */ []));
|
|
43
|
-
// Disabled state
|
|
44
|
-
isDisabled = forgeFieldDisabled();
|
|
45
|
-
formOptionsSignal = computed(() => (this.isDisabled() ? { disabled: true } : undefined), ...(ngDevMode ? [{ debugName: "formOptionsSignal" }] : /* istanbul ignore next */ []));
|
|
46
|
-
disableRearrangeSignal = computed(() => this.props()?.disableRearrange ?? false, ...(ngDevMode ? [{ debugName: "disableRearrangeSignal" }] : /* istanbul ignore next */ []));
|
|
47
|
-
allowAddSignal = computed(() => this.props()?.allowAdd ?? true, ...(ngDevMode ? [{ debugName: "allowAddSignal" }] : /* istanbul ignore next */ []));
|
|
48
|
-
allowRemoveSignal = computed(() => this.props()?.allowRemove ?? true, ...(ngDevMode ? [{ debugName: "allowRemoveSignal" }] : /* istanbul ignore next */ []));
|
|
49
|
-
allowDuplicateSignal = computed(() => this.props()?.allowDuplicate ?? false, ...(ngDevMode ? [{ debugName: "allowDuplicateSignal" }] : /* istanbul ignore next */ []));
|
|
50
|
-
addTextSignal = computed(() => this.props()?.addText ?? 'Add', ...(ngDevMode ? [{ debugName: "addTextSignal" }] : /* istanbul ignore next */ []));
|
|
51
|
-
removeTextSignal = computed(() => this.props()?.removeText ?? 'Remove', ...(ngDevMode ? [{ debugName: "removeTextSignal" }] : /* istanbul ignore next */ []));
|
|
52
|
-
duplicateTextSignal = computed(() => this.props()?.duplicateText ?? 'Duplicate', ...(ngDevMode ? [{ debugName: "duplicateTextSignal" }] : /* istanbul ignore next */ []));
|
|
53
|
-
static _DEFAULT_ADD_BUTTON_STYLE = { type: 'raised', color: 'primary' };
|
|
54
|
-
static _DEFAULT_REMOVE_BUTTON_STYLE = { type: 'stroked', color: 'warn' };
|
|
55
|
-
static _DEFAULT_DUPLICATE_BUTTON_STYLE = { type: 'stroked', color: 'primary' };
|
|
56
|
-
addButtonStyleSignal = computed(() => this.props()?.addButtonStyle ?? DbxForgeArrayFieldComponent._DEFAULT_ADD_BUTTON_STYLE, ...(ngDevMode ? [{ debugName: "addButtonStyleSignal" }] : /* istanbul ignore next */ []));
|
|
57
|
-
removeButtonStyleSignal = computed(() => this.props()?.removeButtonStyle ?? DbxForgeArrayFieldComponent._DEFAULT_REMOVE_BUTTON_STYLE, ...(ngDevMode ? [{ debugName: "removeButtonStyleSignal" }] : /* istanbul ignore next */ []));
|
|
58
|
-
duplicateButtonStyleSignal = computed(() => this.props()?.duplicateButtonStyle ?? DbxForgeArrayFieldComponent._DEFAULT_DUPLICATE_BUTTON_STYLE, ...(ngDevMode ? [{ debugName: "duplicateButtonStyleSignal" }] : /* istanbul ignore next */ []));
|
|
59
|
-
showAddButtonSignal = computed(() => {
|
|
60
|
-
if (!this.allowAddSignal()) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
const maxLength = this.props()?.maxLength;
|
|
64
|
-
if (maxLength != null) {
|
|
65
|
-
return this.itemsSignal().length < maxLength;
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}, ...(ngDevMode ? [{ debugName: "showAddButtonSignal" }] : /* istanbul ignore next */ []));
|
|
69
|
-
constructor() {
|
|
70
|
-
effect(() => {
|
|
71
|
-
const fieldState = this.field()();
|
|
72
|
-
const values = fieldState.value() ?? [];
|
|
73
|
-
if (!this._initialized && Array.isArray(values)) {
|
|
74
|
-
this._initialized = true;
|
|
75
|
-
this.itemsSignal.set(values.map((value) => ({
|
|
76
|
-
trackId: _forgeArrayItemTrackId++,
|
|
77
|
-
value
|
|
78
|
-
})));
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Cast item value to Partial for the DynamicForm [value] binding.
|
|
84
|
-
*
|
|
85
|
-
* @param value - The raw array item value to cast
|
|
86
|
-
* @returns The value cast as a Record for DynamicForm binding, or undefined if null/undefined
|
|
87
|
-
*/
|
|
88
|
-
asPartial(value) {
|
|
89
|
-
return value ?? undefined;
|
|
90
|
-
}
|
|
91
|
-
labelForItem(index, value) {
|
|
92
|
-
const labelForField = this.props()?.labelForField;
|
|
93
|
-
if (!labelForField) {
|
|
94
|
-
return `${index + 1}.`;
|
|
95
|
-
}
|
|
96
|
-
if (typeof labelForField === 'string') {
|
|
97
|
-
return `${index + 1}. ${labelForField}`;
|
|
98
|
-
}
|
|
99
|
-
const pair = { index, value: value };
|
|
100
|
-
return `${index + 1}. ${labelForField(pair)}`;
|
|
101
|
-
}
|
|
102
|
-
onItemValueChange(index, newValue) {
|
|
103
|
-
const items = [...this.itemsSignal()];
|
|
104
|
-
if (items[index]) {
|
|
105
|
-
items[index] = { ...items[index], value: newValue };
|
|
106
|
-
this.itemsSignal.set(items);
|
|
107
|
-
this._syncToFieldTree();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
addItem() {
|
|
111
|
-
const items = [...this.itemsSignal()];
|
|
112
|
-
items.push({ trackId: _forgeArrayItemTrackId++, value: {} });
|
|
113
|
-
this.itemsSignal.set(items);
|
|
114
|
-
this._syncToFieldTree();
|
|
115
|
-
}
|
|
116
|
-
removeItem(index) {
|
|
117
|
-
const items = [...this.itemsSignal()];
|
|
118
|
-
items.splice(index, 1);
|
|
119
|
-
this.itemsSignal.set(items);
|
|
120
|
-
this._syncToFieldTree();
|
|
121
|
-
}
|
|
122
|
-
duplicateItem(index) {
|
|
123
|
-
const items = [...this.itemsSignal()];
|
|
124
|
-
const source = items[index];
|
|
125
|
-
if (!source) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const duplicate = {
|
|
129
|
-
trackId: _forgeArrayItemTrackId++,
|
|
130
|
-
value: structuredClone(source.value)
|
|
131
|
-
};
|
|
132
|
-
const addToEnd = this.props()?.addDuplicateToEnd ?? false;
|
|
133
|
-
if (addToEnd) {
|
|
134
|
-
items.push(duplicate);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
items.splice(index + 1, 0, duplicate);
|
|
138
|
-
}
|
|
139
|
-
this.itemsSignal.set(items);
|
|
140
|
-
this._syncToFieldTree();
|
|
141
|
-
}
|
|
142
|
-
drop(event) {
|
|
143
|
-
const items = [...this.itemsSignal()];
|
|
144
|
-
const [movedItem] = items.splice(event.previousIndex, 1);
|
|
145
|
-
if (movedItem) {
|
|
146
|
-
items.splice(event.currentIndex, 0, movedItem);
|
|
147
|
-
this.itemsSignal.set(items);
|
|
148
|
-
this._syncToFieldTree();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
_syncToFieldTree() {
|
|
152
|
-
const values = this.itemsSignal().map((item) => item.value);
|
|
153
|
-
const fieldState = this.field()();
|
|
154
|
-
fieldState.value.set(values);
|
|
155
|
-
fieldState.markAsTouched();
|
|
156
|
-
fieldState.markAsDirty();
|
|
157
|
-
}
|
|
158
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeArrayFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
159
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxForgeArrayFieldComponent, isStandalone: true, selector: "dbx-forge-array-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, defaultValidationMessages: { classPropertyName: "defaultValidationMessages", publicName: "defaultValidationMessages", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "className()" } }, ngImport: i0, template: "<div class=\"dbx-form-repeat-array\">\n <div cdkDropList [cdkDropListDisabled]=\"disableRearrangeSignal() || isDisabled()\" (cdkDropListDropped)=\"drop($event)\">\n @for (item of itemsSignal(); track item.trackId; let i = $index) {\n <div class=\"dbx-form-repeat-array-field\" cdkDrag cdkDragLockAxis=\"y\">\n <ng-template cdkDragPlaceholder>\n <div class=\"dbx-form-repeat-array-drag-placeholder\"></div>\n </ng-template>\n <div class=\"dbx-form-repeat-array-bar dbx-flex-bar\">\n @if (!disableRearrangeSignal()) {\n <button mat-icon-button type=\"button\" cdkDragHandle class=\"dbx-form-repeat-array-drag-button\" [disabled]=\"isDisabled()\" aria-label=\"Drag to reorder\">\n <mat-icon>drag_handle</mat-icon>\n </button>\n <dbx-button-spacer></dbx-button-spacer>\n }\n <span class=\"dbx-form-repeat-array-label\">{{ labelForItem(i, item.value) }}</span>\n <span class=\"spacer\"></span>\n @if (allowDuplicateSignal()) {\n <dbx-button [text]=\"duplicateTextSignal()\" [buttonStyle]=\"duplicateButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"duplicateItem(i)\"></dbx-button>\n <dbx-button-spacer></dbx-button-spacer>\n }\n @if (allowRemoveSignal()) {\n <dbx-button [text]=\"removeTextSignal()\" [buttonStyle]=\"removeButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"removeItem(i)\"></dbx-button>\n }\n </div>\n <div class=\"dbx-form-repeat-array-field-content\">\n <form [dynamic-form]=\"templateConfigSignal()\" [value]=\"asPartial(item.value)\" [formOptions]=\"formOptionsSignal()\" (valueChange)=\"onItemValueChange(i, $event)\"></form>\n </div>\n </div>\n }\n </div>\n @if (showAddButtonSignal()) {\n <div class=\"dbx-form-repeat-array-footer\">\n <dbx-button [text]=\"addTextSignal()\" [buttonStyle]=\"addButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"addItem()\"></dbx-button>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: DynamicForm, selector: "form[dynamic-form]", inputs: ["dynamic-form", "formOptions", "value"], outputs: ["valueChange", "validityChange", "dirtyChange", "submitted", "reset", "cleared", "events", "initialized", "onPageChange", "onPageNavigationStateChange"] }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "directive", type: DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
160
|
-
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeArrayFieldComponent, decorators: [{
|
|
162
|
-
type: Component,
|
|
163
|
-
args: [{ selector: 'dbx-forge-array-field', imports: [CdkDropList, CdkDrag, CdkDragHandle, CdkDragPlaceholder, MatIconModule, MatButtonModule, DynamicForm, DbxButtonComponent, DbxButtonSpacerDirective], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: {
|
|
164
|
-
'[class]': 'className()'
|
|
165
|
-
}, template: "<div class=\"dbx-form-repeat-array\">\n <div cdkDropList [cdkDropListDisabled]=\"disableRearrangeSignal() || isDisabled()\" (cdkDropListDropped)=\"drop($event)\">\n @for (item of itemsSignal(); track item.trackId; let i = $index) {\n <div class=\"dbx-form-repeat-array-field\" cdkDrag cdkDragLockAxis=\"y\">\n <ng-template cdkDragPlaceholder>\n <div class=\"dbx-form-repeat-array-drag-placeholder\"></div>\n </ng-template>\n <div class=\"dbx-form-repeat-array-bar dbx-flex-bar\">\n @if (!disableRearrangeSignal()) {\n <button mat-icon-button type=\"button\" cdkDragHandle class=\"dbx-form-repeat-array-drag-button\" [disabled]=\"isDisabled()\" aria-label=\"Drag to reorder\">\n <mat-icon>drag_handle</mat-icon>\n </button>\n <dbx-button-spacer></dbx-button-spacer>\n }\n <span class=\"dbx-form-repeat-array-label\">{{ labelForItem(i, item.value) }}</span>\n <span class=\"spacer\"></span>\n @if (allowDuplicateSignal()) {\n <dbx-button [text]=\"duplicateTextSignal()\" [buttonStyle]=\"duplicateButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"duplicateItem(i)\"></dbx-button>\n <dbx-button-spacer></dbx-button-spacer>\n }\n @if (allowRemoveSignal()) {\n <dbx-button [text]=\"removeTextSignal()\" [buttonStyle]=\"removeButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"removeItem(i)\"></dbx-button>\n }\n </div>\n <div class=\"dbx-form-repeat-array-field-content\">\n <form [dynamic-form]=\"templateConfigSignal()\" [value]=\"asPartial(item.value)\" [formOptions]=\"formOptionsSignal()\" (valueChange)=\"onItemValueChange(i, $event)\"></form>\n </div>\n </div>\n }\n </div>\n @if (showAddButtonSignal()) {\n <div class=\"dbx-form-repeat-array-footer\">\n <dbx-button [text]=\"addTextSignal()\" [buttonStyle]=\"addButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"addItem()\"></dbx-button>\n </div>\n }\n</div>\n" }]
|
|
166
|
-
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], defaultValidationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValidationMessages", required: false }] }] } });
|
|
167
|
-
|
|
168
|
-
export { DbxForgeArrayFieldComponent };
|
|
169
|
-
//# sourceMappingURL=dereekb-dbx-form-array.field.component-1wYSd4d3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-array.field.component-1wYSd4d3.mjs","sources":["../../../../packages/dbx-form/src/lib/forge/field/value/array/array.field.component.ts","../../../../packages/dbx-form/src/lib/forge/field/value/array/array.field.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, input, signal } from '@angular/core';\nimport { type CdkDragDrop, CdkDropList, CdkDrag, CdkDragHandle, CdkDragPlaceholder } from '@angular/cdk/drag-drop';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { type FieldTree } from '@angular/forms/signals';\nimport { type DynamicText, type FieldMeta, type ValidationMessages, type FormConfig, DynamicForm } from '@ng-forge/dynamic-forms';\nimport { type FactoryWithRequiredInput } from '@dereekb/util';\nimport { DbxButtonComponent, DbxButtonSpacerDirective, type DbxButtonStyle } from '@dereekb/dbx-web';\nimport type { DbxForgeArrayFieldProps, DbxForgeArrayItemPair } from './array.field';\nimport { forgeFieldDisabled } from '../../field.disabled';\n\n/**\n * Internal state for a single array item.\n */\ninterface DbxForgeArrayItem {\n readonly trackId: number;\n value: unknown;\n}\n\nlet _forgeArrayItemTrackId = 0;\n\n/**\n * Forge ValueFieldComponent that renders a drag-and-drop array.\n *\n * Each array item is rendered as a nested `DynamicForm` using the provided template.\n * Items can be reordered via CDK drag/drop, added, removed, and duplicated.\n *\n * This is the forge equivalent of formly's `DbxFormRepeatArrayTypeComponent`.\n */\n@Component({\n selector: 'dbx-forge-array-field',\n templateUrl: './array.field.component.html',\n imports: [CdkDropList, CdkDrag, CdkDragHandle, CdkDragPlaceholder, MatIconModule, MatButtonModule, DynamicForm, DbxButtonComponent, DbxButtonSpacerDirective],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n host: {\n '[class]': 'className()'\n }\n})\nexport class DbxForgeArrayFieldComponent<T = unknown> {\n // ng-forge ValueFieldComponent inputs\n readonly field = input.required<FieldTree<unknown[]>>();\n readonly key = input.required<string>();\n readonly label = input<DynamicText | undefined>();\n readonly placeholder = input<DynamicText | undefined>();\n readonly className = input<string>('');\n readonly tabIndex = input<number | undefined>();\n readonly props = input<DbxForgeArrayFieldProps<T> | undefined>();\n readonly meta = input<FieldMeta | undefined>();\n readonly validationMessages = input<ValidationMessages | undefined>();\n readonly defaultValidationMessages = input<ValidationMessages | undefined>();\n\n readonly itemsSignal = signal<DbxForgeArrayItem[]>([]);\n\n private _initialized = false;\n\n readonly templateConfigSignal = computed((): FormConfig => {\n const template = this.props()?.template;\n\n if (!template) {\n return { fields: [] } as unknown as FormConfig;\n }\n\n const fields = Array.isArray(template) ? template : [template];\n return { fields } as unknown as FormConfig;\n });\n\n // Disabled state\n readonly isDisabled = forgeFieldDisabled();\n readonly formOptionsSignal = computed(() => (this.isDisabled() ? { disabled: true } : undefined));\n\n readonly disableRearrangeSignal = computed(() => this.props()?.disableRearrange ?? false);\n readonly allowAddSignal = computed(() => this.props()?.allowAdd ?? true);\n readonly allowRemoveSignal = computed(() => this.props()?.allowRemove ?? true);\n readonly allowDuplicateSignal = computed(() => this.props()?.allowDuplicate ?? false);\n readonly addTextSignal = computed(() => this.props()?.addText ?? 'Add');\n readonly removeTextSignal = computed(() => this.props()?.removeText ?? 'Remove');\n readonly duplicateTextSignal = computed(() => this.props()?.duplicateText ?? 'Duplicate');\n\n private static readonly _DEFAULT_ADD_BUTTON_STYLE: DbxButtonStyle = { type: 'raised', color: 'primary' };\n private static readonly _DEFAULT_REMOVE_BUTTON_STYLE: DbxButtonStyle = { type: 'stroked', color: 'warn' };\n private static readonly _DEFAULT_DUPLICATE_BUTTON_STYLE: DbxButtonStyle = { type: 'stroked', color: 'primary' };\n\n readonly addButtonStyleSignal = computed(() => this.props()?.addButtonStyle ?? DbxForgeArrayFieldComponent._DEFAULT_ADD_BUTTON_STYLE);\n readonly removeButtonStyleSignal = computed(() => this.props()?.removeButtonStyle ?? DbxForgeArrayFieldComponent._DEFAULT_REMOVE_BUTTON_STYLE);\n readonly duplicateButtonStyleSignal = computed(() => this.props()?.duplicateButtonStyle ?? DbxForgeArrayFieldComponent._DEFAULT_DUPLICATE_BUTTON_STYLE);\n\n readonly showAddButtonSignal = computed(() => {\n if (!this.allowAddSignal()) {\n return false;\n }\n\n const maxLength = this.props()?.maxLength;\n\n if (maxLength != null) {\n return this.itemsSignal().length < maxLength;\n }\n\n return true;\n });\n\n constructor() {\n effect(() => {\n const fieldState = this.field()();\n const values = fieldState.value() ?? [];\n\n if (!this._initialized && Array.isArray(values)) {\n this._initialized = true;\n this.itemsSignal.set(\n values.map((value) => ({\n trackId: _forgeArrayItemTrackId++,\n value\n }))\n );\n }\n });\n }\n\n /**\n * Cast item value to Partial for the DynamicForm [value] binding.\n *\n * @param value - The raw array item value to cast\n * @returns The value cast as a Record for DynamicForm binding, or undefined if null/undefined\n */\n asPartial(value: unknown): Record<string, unknown> | undefined {\n return (value as Record<string, unknown>) ?? undefined;\n }\n\n labelForItem(index: number, value: unknown): string {\n const labelForField = this.props()?.labelForField;\n\n if (!labelForField) {\n return `${index + 1}.`;\n }\n\n if (typeof labelForField === 'string') {\n return `${index + 1}. ${labelForField}`;\n }\n\n const pair: DbxForgeArrayItemPair<T> = { index, value: value as T };\n return `${index + 1}. ${(labelForField as FactoryWithRequiredInput<string, DbxForgeArrayItemPair<T>>)(pair)}`;\n }\n\n onItemValueChange(index: number, newValue: unknown): void {\n const items = [...this.itemsSignal()];\n\n if (items[index]) {\n items[index] = { ...items[index], value: newValue };\n this.itemsSignal.set(items);\n this._syncToFieldTree();\n }\n }\n\n addItem(): void {\n const items = [...this.itemsSignal()];\n items.push({ trackId: _forgeArrayItemTrackId++, value: {} });\n this.itemsSignal.set(items);\n this._syncToFieldTree();\n }\n\n removeItem(index: number): void {\n const items = [...this.itemsSignal()];\n items.splice(index, 1);\n this.itemsSignal.set(items);\n this._syncToFieldTree();\n }\n\n duplicateItem(index: number): void {\n const items = [...this.itemsSignal()];\n const source = items[index];\n\n if (!source) {\n return;\n }\n\n const duplicate: DbxForgeArrayItem = {\n trackId: _forgeArrayItemTrackId++,\n value: structuredClone(source.value)\n };\n\n const addToEnd = this.props()?.addDuplicateToEnd ?? false;\n\n if (addToEnd) {\n items.push(duplicate);\n } else {\n items.splice(index + 1, 0, duplicate);\n }\n\n this.itemsSignal.set(items);\n this._syncToFieldTree();\n }\n\n drop(event: CdkDragDrop<unknown>): void {\n const items = [...this.itemsSignal()];\n const [movedItem] = items.splice(event.previousIndex, 1);\n\n if (movedItem) {\n items.splice(event.currentIndex, 0, movedItem);\n this.itemsSignal.set(items);\n this._syncToFieldTree();\n }\n }\n\n private _syncToFieldTree(): void {\n const values = this.itemsSignal().map((item) => item.value);\n const fieldState = this.field()();\n fieldState.value.set(values);\n fieldState.markAsTouched();\n fieldState.markAsDirty();\n }\n}\n","<div class=\"dbx-form-repeat-array\">\n <div cdkDropList [cdkDropListDisabled]=\"disableRearrangeSignal() || isDisabled()\" (cdkDropListDropped)=\"drop($event)\">\n @for (item of itemsSignal(); track item.trackId; let i = $index) {\n <div class=\"dbx-form-repeat-array-field\" cdkDrag cdkDragLockAxis=\"y\">\n <ng-template cdkDragPlaceholder>\n <div class=\"dbx-form-repeat-array-drag-placeholder\"></div>\n </ng-template>\n <div class=\"dbx-form-repeat-array-bar dbx-flex-bar\">\n @if (!disableRearrangeSignal()) {\n <button mat-icon-button type=\"button\" cdkDragHandle class=\"dbx-form-repeat-array-drag-button\" [disabled]=\"isDisabled()\" aria-label=\"Drag to reorder\">\n <mat-icon>drag_handle</mat-icon>\n </button>\n <dbx-button-spacer></dbx-button-spacer>\n }\n <span class=\"dbx-form-repeat-array-label\">{{ labelForItem(i, item.value) }}</span>\n <span class=\"spacer\"></span>\n @if (allowDuplicateSignal()) {\n <dbx-button [text]=\"duplicateTextSignal()\" [buttonStyle]=\"duplicateButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"duplicateItem(i)\"></dbx-button>\n <dbx-button-spacer></dbx-button-spacer>\n }\n @if (allowRemoveSignal()) {\n <dbx-button [text]=\"removeTextSignal()\" [buttonStyle]=\"removeButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"removeItem(i)\"></dbx-button>\n }\n </div>\n <div class=\"dbx-form-repeat-array-field-content\">\n <form [dynamic-form]=\"templateConfigSignal()\" [value]=\"asPartial(item.value)\" [formOptions]=\"formOptionsSignal()\" (valueChange)=\"onItemValueChange(i, $event)\"></form>\n </div>\n </div>\n }\n </div>\n @if (showAddButtonSignal()) {\n <div class=\"dbx-form-repeat-array-footer\">\n <dbx-button [text]=\"addTextSignal()\" [buttonStyle]=\"addButtonStyleSignal()\" [disabled]=\"isDisabled()\" (buttonClick)=\"addItem()\"></dbx-button>\n </div>\n }\n</div>\n"],"names":["i2"],"mappings":";;;;;;;;;;;AAmBA,IAAI,sBAAsB,GAAG,CAAC;AAE9B;;;;;;;AAOG;MAWU,2BAA2B,CAAA;;AAE7B,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,2EAAwB;AAC9C,IAAA,GAAG,GAAG,KAAK,CAAC,QAAQ,yEAAU;IAC9B,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAA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A,EAAA,ujEAAA,EAAA;;;;;"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { viewChild, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { DynamicTextPipe } from '@ng-forge/dynamic-forms';
|
|
4
|
-
import { AbstractForgeWrapperFieldComponent, forgeFieldDisabled, provideDbxForgeWrapperFieldDirective } from './dereekb-dbx-form.mjs';
|
|
5
|
-
import { AsyncPipe } from '@angular/common';
|
|
6
|
-
import { D as DbxForgeWrapperContentComponent } from './dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Forge wrapper field component that renders child fields inside a Material-style
|
|
10
|
-
* outlined container with a notched outline, floating label, and hint/error subscript.
|
|
11
|
-
*
|
|
12
|
-
* This is the forge equivalent of ngx-formly's `FormlyWrapperFormField` which wraps
|
|
13
|
-
* fields in `<mat-form-field>`. Uses `<dbx-forge-wrapper-content />` for the nested
|
|
14
|
-
* DynamicForm rendering and reads its validation state for error display.
|
|
15
|
-
*/
|
|
16
|
-
class DbxForgeFormFieldWrapperComponent extends AbstractForgeWrapperFieldComponent {
|
|
17
|
-
contentRef = viewChild(DbxForgeWrapperContentComponent, ...(ngDevMode ? [{ debugName: "contentRef" }] : /* istanbul ignore next */ []));
|
|
18
|
-
// Disabled state
|
|
19
|
-
isDisabled = forgeFieldDisabled();
|
|
20
|
-
// Child form validation state via content component
|
|
21
|
-
childErrors = computed(() => this.contentRef()?.errors() ?? [], ...(ngDevMode ? [{ debugName: "childErrors" }] : /* istanbul ignore next */ []));
|
|
22
|
-
childTouched = computed(() => this.contentRef()?.touched() ?? false, ...(ngDevMode ? [{ debugName: "childTouched" }] : /* istanbul ignore next */ []));
|
|
23
|
-
childDirty = computed(() => this.contentRef()?.dynamicForm()?.dirty() ?? false, ...(ngDevMode ? [{ debugName: "childDirty" }] : /* istanbul ignore next */ []));
|
|
24
|
-
// Error display: show errors when the child form has been touched OR is dirty (value changed)
|
|
25
|
-
showErrors = computed(() => (this.childTouched() || this.childDirty()) && this.childErrors().length > 0, ...(ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []));
|
|
26
|
-
hasError = computed(() => this.showErrors(), ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
27
|
-
firstErrorMessage = computed(() => {
|
|
28
|
-
const errors = this.childErrors();
|
|
29
|
-
if (errors.length === 0) {
|
|
30
|
-
return '';
|
|
31
|
-
}
|
|
32
|
-
const error = errors[0];
|
|
33
|
-
// Try raw error message first (set by Angular built-in validators)
|
|
34
|
-
if (error.message) {
|
|
35
|
-
return error.message;
|
|
36
|
-
}
|
|
37
|
-
// Resolve from child field validationMessages by matching error.kind
|
|
38
|
-
const fields = this.props()?.fields;
|
|
39
|
-
if (fields?.length) {
|
|
40
|
-
for (const field of fields) {
|
|
41
|
-
const messages = field.validationMessages;
|
|
42
|
-
if (messages?.[error.kind]) {
|
|
43
|
-
return messages[error.kind];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return error.kind;
|
|
48
|
-
}, ...(ngDevMode ? [{ debugName: "firstErrorMessage" }] : /* istanbul ignore next */ []));
|
|
49
|
-
// Props
|
|
50
|
-
hintSignal = computed(() => this.props()?.hint, ...(ngDevMode ? [{ debugName: "hintSignal" }] : /* istanbul ignore next */ []));
|
|
51
|
-
/**
|
|
52
|
-
* Whether any child field has `required: true`, used to show the asterisk in the label.
|
|
53
|
-
*/
|
|
54
|
-
isRequired = computed(() => {
|
|
55
|
-
const fields = this.props()?.fields;
|
|
56
|
-
return fields?.some((f) => f.required === true) ?? false;
|
|
57
|
-
}, ...(ngDevMode ? [{ debugName: "isRequired" }] : /* istanbul ignore next */ []));
|
|
58
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeFormFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxForgeFormFieldWrapperComponent, isStandalone: true, selector: "dbx-forge-form-field-wrapper", host: { properties: { "class": "className()" }, classAttribute: "mat-mdc-form-field mat-form-field-animations-enabled" }, providers: provideDbxForgeWrapperFieldDirective(DbxForgeFormFieldWrapperComponent), viewQueries: [{ propertyName: "contentRef", first: true, predicate: DbxForgeWrapperContentComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-forge-form-field-wrapper\" [class.dbx-forge-form-field-wrapper-error]=\"hasError()\" [class.dbx-forge-form-field-wrapper-disabled]=\"isDisabled()\">\n <div class=\"dbx-forge-form-field-outline\">\n <div class=\"dbx-forge-form-field-outline-leading\"></div>\n <div class=\"dbx-forge-form-field-outline-notch\" [class.dbx-forge-form-field-outline-notch-empty]=\"!label()\">\n @if (label(); as labelText) {\n <span class=\"dbx-forge-form-field-outline-label\">\n {{ labelText | dynamicText | async }}\n @if (isRequired()) {\n <span aria-hidden=\"true\" class=\"mat-mdc-form-field-required-marker mdc-floating-label--required\"></span>\n }\n </span>\n }\n </div>\n <div class=\"dbx-forge-form-field-outline-trailing\"></div>\n </div>\n <div class=\"dbx-forge-form-field-content\">\n <dbx-forge-wrapper-content />\n </div>\n</div>\n<div class=\"mat-mdc-form-field-subscript-wrapper mat-mdc-form-field-bottom-align\">\n @if (showErrors()) {\n <div class=\"mat-mdc-form-field-error-wrapper\">\n <div class=\"mat-mdc-form-field-error mat-mdc-form-field-bottom-align\">{{ firstErrorMessage() }}</div>\n </div>\n } @else if (hintSignal(); as hint) {\n <div class=\"mat-mdc-form-field-hint-wrapper\">\n <div class=\"mat-mdc-form-field-hint mat-mdc-form-field-bottom-align\">{{ hint }}</div>\n </div>\n }\n</div>\n", styles: [":host{display:block;width:100%;margin-bottom:16px}.dbx-forge-form-field-wrapper{position:relative;margin-top:8px}.dbx-forge-form-field-outline{display:flex;position:absolute;inset:0;pointer-events:none}.dbx-forge-form-field-outline-leading{border:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));border-right:none;border-radius:var(--mdc-outlined-text-field-container-shape, 8px) 0 0 var(--mdc-outlined-text-field-container-shape, 8px);width:12px}.dbx-forge-form-field-outline-notch{border-bottom:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));display:flex;align-items:flex-start;max-width:calc(100% - 24px)}.dbx-forge-form-field-outline-notch-empty{border-top:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));width:0;padding:0}.dbx-forge-form-field-outline-label{display:inline-block;transform:translateY(-50%);padding:0 4px;background:var(--mat-sys-surface, white);white-space:nowrap;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--mat-form-field-outlined-label-text-populated-font, var(--mat-sys-body-small-font));font-size:var(--mat-form-field-outlined-label-text-populated-size, var(--mat-sys-body-small-size));line-height:var(--mat-form-field-outlined-label-text-populated-line-height, var(--mat-sys-body-small-line-height));letter-spacing:var(--mat-form-field-outlined-label-text-populated-tracking, var(--mat-sys-body-small-tracking));font-weight:var(--mat-form-field-outlined-label-text-populated-weight, var(--mat-sys-body-small-weight));color:var(--mdc-outlined-text-field-label-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)))}.dbx-forge-form-field-outline-trailing{border:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));border-left:none;border-radius:0 var(--mdc-outlined-text-field-container-shape, 8px) var(--mdc-outlined-text-field-container-shape, 8px) 0;flex-grow:1}.dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-hover-outline-color, var(--mat-sys-on-surface, rgba(0, 0, 0, .87)))}.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-focus-outline-color, var(--mat-sys-primary));border-width:2px}.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-label{color:var(--mdc-outlined-text-field-focus-label-text-color, var(--mat-sys-primary));padding:0 3px}.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-error-outline-color, var(--mat-sys-error, #f44336))}.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-label{color:var(--mdc-outlined-text-field-error-label-text-color, var(--mat-sys-error, #f44336))}.dbx-forge-form-field-content{position:relative;padding:var(--mat-form-field-container-vertical-padding, 16px) 16px 8px;min-height:56px;box-sizing:border-box}.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-content{opacity:.38;pointer-events:none}.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-trailing,.dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-disabled-outline-color, rgba(0, 0, 0, .12))}.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-label{color:var(--mdc-outlined-text-field-disabled-label-text-color, rgba(0, 0, 0, .38))}.mat-mdc-form-field-subscript-wrapper{padding:0 16px;box-sizing:border-box}\n"], dependencies: [{ kind: "component", type: DbxForgeWrapperContentComponent, selector: "dbx-forge-wrapper-content" }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
60
|
-
}
|
|
61
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeFormFieldWrapperComponent, decorators: [{
|
|
62
|
-
type: Component,
|
|
63
|
-
args: [{ selector: 'dbx-forge-form-field-wrapper', providers: provideDbxForgeWrapperFieldDirective(DbxForgeFormFieldWrapperComponent), imports: [DbxForgeWrapperContentComponent, DynamicTextPipe, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: {
|
|
64
|
-
class: 'mat-mdc-form-field mat-form-field-animations-enabled',
|
|
65
|
-
'[class]': 'className()'
|
|
66
|
-
}, template: "<div class=\"dbx-forge-form-field-wrapper\" [class.dbx-forge-form-field-wrapper-error]=\"hasError()\" [class.dbx-forge-form-field-wrapper-disabled]=\"isDisabled()\">\n <div class=\"dbx-forge-form-field-outline\">\n <div class=\"dbx-forge-form-field-outline-leading\"></div>\n <div class=\"dbx-forge-form-field-outline-notch\" [class.dbx-forge-form-field-outline-notch-empty]=\"!label()\">\n @if (label(); as labelText) {\n <span class=\"dbx-forge-form-field-outline-label\">\n {{ labelText | dynamicText | async }}\n @if (isRequired()) {\n <span aria-hidden=\"true\" class=\"mat-mdc-form-field-required-marker mdc-floating-label--required\"></span>\n }\n </span>\n }\n </div>\n <div class=\"dbx-forge-form-field-outline-trailing\"></div>\n </div>\n <div class=\"dbx-forge-form-field-content\">\n <dbx-forge-wrapper-content />\n </div>\n</div>\n<div class=\"mat-mdc-form-field-subscript-wrapper mat-mdc-form-field-bottom-align\">\n @if (showErrors()) {\n <div class=\"mat-mdc-form-field-error-wrapper\">\n <div class=\"mat-mdc-form-field-error mat-mdc-form-field-bottom-align\">{{ firstErrorMessage() }}</div>\n </div>\n } @else if (hintSignal(); as hint) {\n <div class=\"mat-mdc-form-field-hint-wrapper\">\n <div class=\"mat-mdc-form-field-hint mat-mdc-form-field-bottom-align\">{{ hint }}</div>\n </div>\n }\n</div>\n", styles: [":host{display:block;width:100%;margin-bottom:16px}.dbx-forge-form-field-wrapper{position:relative;margin-top:8px}.dbx-forge-form-field-outline{display:flex;position:absolute;inset:0;pointer-events:none}.dbx-forge-form-field-outline-leading{border:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));border-right:none;border-radius:var(--mdc-outlined-text-field-container-shape, 8px) 0 0 var(--mdc-outlined-text-field-container-shape, 8px);width:12px}.dbx-forge-form-field-outline-notch{border-bottom:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));display:flex;align-items:flex-start;max-width:calc(100% - 24px)}.dbx-forge-form-field-outline-notch-empty{border-top:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));width:0;padding:0}.dbx-forge-form-field-outline-label{display:inline-block;transform:translateY(-50%);padding:0 4px;background:var(--mat-sys-surface, white);white-space:nowrap;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--mat-form-field-outlined-label-text-populated-font, var(--mat-sys-body-small-font));font-size:var(--mat-form-field-outlined-label-text-populated-size, var(--mat-sys-body-small-size));line-height:var(--mat-form-field-outlined-label-text-populated-line-height, var(--mat-sys-body-small-line-height));letter-spacing:var(--mat-form-field-outlined-label-text-populated-tracking, var(--mat-sys-body-small-tracking));font-weight:var(--mat-form-field-outlined-label-text-populated-weight, var(--mat-sys-body-small-weight));color:var(--mdc-outlined-text-field-label-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)))}.dbx-forge-form-field-outline-trailing{border:1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .38)));border-left:none;border-radius:0 var(--mdc-outlined-text-field-container-shape, 8px) var(--mdc-outlined-text-field-container-shape, 8px) 0;flex-grow:1}.dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-hover-outline-color, var(--mat-sys-on-surface, rgba(0, 0, 0, .87)))}.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-focus-outline-color, var(--mat-sys-primary));border-width:2px}.dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-label{color:var(--mdc-outlined-text-field-focus-label-text-color, var(--mat-sys-primary));padding:0 3px}.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-error-outline-color, var(--mat-sys-error, #f44336))}.dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-label{color:var(--mdc-outlined-text-field-error-label-text-color, var(--mat-sys-error, #f44336))}.dbx-forge-form-field-content{position:relative;padding:var(--mat-form-field-container-vertical-padding, 16px) 16px 8px;min-height:56px;box-sizing:border-box}.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-content{opacity:.38;pointer-events:none}.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-trailing,.dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-leading,.dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-notch,.dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-trailing{border-color:var(--mdc-outlined-text-field-disabled-outline-color, rgba(0, 0, 0, .12))}.dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-label{color:var(--mdc-outlined-text-field-disabled-label-text-color, rgba(0, 0, 0, .38))}.mat-mdc-form-field-subscript-wrapper{padding:0 16px;box-sizing:border-box}\n"] }]
|
|
67
|
-
}], propDecorators: { contentRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => DbxForgeWrapperContentComponent), { isSignal: true }] }] } });
|
|
68
|
-
|
|
69
|
-
export { DbxForgeFormFieldWrapperComponent };
|
|
70
|
-
//# sourceMappingURL=dereekb-dbx-form-formfield.field.component-BQyujXe3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-formfield.field.component-BQyujXe3.mjs","sources":["../../../../packages/dbx-form/src/lib/forge/field/wrapper/formfield/formfield.field.component.ts","../../../../packages/dbx-form/src/lib/forge/field/wrapper/formfield/formfield.field.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, viewChild } from '@angular/core';\nimport { DynamicTextPipe, type FieldWithValidation } from '@ng-forge/dynamic-forms';\nimport { forgeFieldDisabled } from '../../field.disabled';\nimport { AsyncPipe } from '@angular/common';\nimport { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from '../wrapper.field';\nimport { DbxForgeWrapperContentComponent } from '../wrapper.content.component';\nimport type { DbxForgeFormFieldWrapperProps } from './formfield.field';\n\n/**\n * Forge wrapper field component that renders child fields inside a Material-style\n * outlined container with a notched outline, floating label, and hint/error subscript.\n *\n * This is the forge equivalent of ngx-formly's `FormlyWrapperFormField` which wraps\n * fields in `<mat-form-field>`. Uses `<dbx-forge-wrapper-content />` for the nested\n * DynamicForm rendering and reads its validation state for error display.\n */\n@Component({\n selector: 'dbx-forge-form-field-wrapper',\n templateUrl: './formfield.field.component.html',\n styles: [\n `\n :host {\n display: block;\n width: 100%;\n margin-bottom: 16px;\n }\n\n .dbx-forge-form-field-wrapper {\n position: relative;\n margin-top: 8px;\n }\n\n /* --- Notched outline --- */\n .dbx-forge-form-field-outline {\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n pointer-events: none;\n }\n\n .dbx-forge-form-field-outline-leading {\n border: 1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, 0.38)));\n border-right: none;\n border-radius: var(--mdc-outlined-text-field-container-shape, 8px) 0 0 var(--mdc-outlined-text-field-container-shape, 8px);\n width: 12px;\n }\n\n .dbx-forge-form-field-outline-notch {\n border-bottom: 1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, 0.38)));\n display: flex;\n align-items: flex-start;\n max-width: calc(100% - 24px);\n }\n\n .dbx-forge-form-field-outline-notch-empty {\n border-top: 1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, 0.38)));\n width: 0;\n padding: 0;\n }\n\n .dbx-forge-form-field-outline-label {\n display: inline-block;\n transform: translateY(-50%);\n padding: 0 4px;\n background: var(--mat-sys-surface, white);\n white-space: nowrap;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--mat-form-field-outlined-label-text-populated-font, var(--mat-sys-body-small-font));\n font-size: var(--mat-form-field-outlined-label-text-populated-size, var(--mat-sys-body-small-size));\n line-height: var(--mat-form-field-outlined-label-text-populated-line-height, var(--mat-sys-body-small-line-height));\n letter-spacing: var(--mat-form-field-outlined-label-text-populated-tracking, var(--mat-sys-body-small-tracking));\n font-weight: var(--mat-form-field-outlined-label-text-populated-weight, var(--mat-sys-body-small-weight));\n color: var(--mdc-outlined-text-field-label-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));\n }\n\n .dbx-forge-form-field-outline-trailing {\n border: 1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, 0.38)));\n border-left: none;\n border-radius: 0 var(--mdc-outlined-text-field-container-shape, 8px) var(--mdc-outlined-text-field-container-shape, 8px) 0;\n flex-grow: 1;\n }\n\n /* --- Hover state --- */\n .dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-leading,\n .dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-notch,\n .dbx-forge-form-field-wrapper:hover .dbx-forge-form-field-outline-trailing {\n border-color: var(--mdc-outlined-text-field-hover-outline-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));\n }\n\n /* --- Focus state --- */\n .dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-leading,\n .dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-notch,\n .dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-trailing {\n border-color: var(--mdc-outlined-text-field-focus-outline-color, var(--mat-sys-primary));\n border-width: 2px;\n }\n\n .dbx-forge-form-field-wrapper:focus-within .dbx-forge-form-field-outline-label {\n color: var(--mdc-outlined-text-field-focus-label-text-color, var(--mat-sys-primary));\n padding: 0 3px;\n }\n\n /* --- Error state --- */\n .dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-leading,\n .dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-notch,\n .dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-trailing {\n border-color: var(--mdc-outlined-text-field-error-outline-color, var(--mat-sys-error, #f44336));\n }\n\n .dbx-forge-form-field-wrapper-error .dbx-forge-form-field-outline-label {\n color: var(--mdc-outlined-text-field-error-label-text-color, var(--mat-sys-error, #f44336));\n }\n\n /* --- Content area --- */\n .dbx-forge-form-field-content {\n position: relative;\n padding: var(--mat-form-field-container-vertical-padding, 16px) 16px 8px;\n min-height: 56px;\n box-sizing: border-box;\n }\n\n /* --- Disabled state --- */\n .dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-content {\n opacity: 0.38;\n pointer-events: none;\n }\n\n .dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-leading,\n .dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-notch,\n .dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-trailing {\n border-color: var(--mdc-outlined-text-field-disabled-outline-color, rgba(0, 0, 0, 0.12));\n }\n\n .dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-leading,\n .dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-notch,\n .dbx-forge-form-field-wrapper-disabled:hover .dbx-forge-form-field-outline-trailing {\n border-color: var(--mdc-outlined-text-field-disabled-outline-color, rgba(0, 0, 0, 0.12));\n }\n\n .dbx-forge-form-field-wrapper-disabled .dbx-forge-form-field-outline-label {\n color: var(--mdc-outlined-text-field-disabled-label-text-color, rgba(0, 0, 0, 0.38));\n }\n\n /* --- Subscript area --- */\n .mat-mdc-form-field-subscript-wrapper {\n padding: 0 16px;\n box-sizing: border-box;\n }\n `\n ],\n providers: provideDbxForgeWrapperFieldDirective(DbxForgeFormFieldWrapperComponent),\n imports: [DbxForgeWrapperContentComponent, DynamicTextPipe, AsyncPipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n host: {\n class: 'mat-mdc-form-field mat-form-field-animations-enabled',\n '[class]': 'className()'\n }\n})\nexport class DbxForgeFormFieldWrapperComponent extends AbstractForgeWrapperFieldComponent<DbxForgeFormFieldWrapperProps> {\n readonly contentRef = viewChild(DbxForgeWrapperContentComponent);\n\n // Disabled state\n readonly isDisabled = forgeFieldDisabled();\n\n // Child form validation state via content component\n readonly childErrors = computed(() => this.contentRef()?.errors() ?? []);\n readonly childTouched = computed(() => this.contentRef()?.touched() ?? false);\n readonly childDirty = computed(() => this.contentRef()?.dynamicForm()?.dirty() ?? false);\n\n // Error display: show errors when the child form has been touched OR is dirty (value changed)\n readonly showErrors = computed(() => (this.childTouched() || this.childDirty()) && this.childErrors().length > 0);\n readonly hasError = computed(() => this.showErrors());\n readonly firstErrorMessage = computed(() => {\n const errors = this.childErrors();\n\n if (errors.length === 0) {\n return '';\n }\n\n const error = errors[0];\n\n // Try raw error message first (set by Angular built-in validators)\n if (error.message) {\n return error.message;\n }\n\n // Resolve from child field validationMessages by matching error.kind\n const fields = this.props()?.fields;\n\n if (fields?.length) {\n for (const field of fields) {\n const messages = (field as FieldWithValidation).validationMessages as Record<string, string> | undefined;\n\n if (messages?.[error.kind]) {\n return messages[error.kind];\n }\n }\n }\n\n return error.kind;\n });\n\n // Props\n readonly hintSignal = computed(() => this.props()?.hint);\n\n /**\n * Whether any child field has `required: true`, used to show the asterisk in the label.\n */\n readonly isRequired = computed(() => {\n const fields = this.props()?.fields;\n return fields?.some((f: any) => f.required === true) ?? false;\n });\n}\n","<div class=\"dbx-forge-form-field-wrapper\" [class.dbx-forge-form-field-wrapper-error]=\"hasError()\" [class.dbx-forge-form-field-wrapper-disabled]=\"isDisabled()\">\n <div class=\"dbx-forge-form-field-outline\">\n <div class=\"dbx-forge-form-field-outline-leading\"></div>\n <div class=\"dbx-forge-form-field-outline-notch\" [class.dbx-forge-form-field-outline-notch-empty]=\"!label()\">\n @if (label(); as labelText) {\n <span class=\"dbx-forge-form-field-outline-label\">\n {{ labelText | dynamicText | async }}\n @if (isRequired()) {\n <span aria-hidden=\"true\" class=\"mat-mdc-form-field-required-marker mdc-floating-label--required\"></span>\n }\n </span>\n }\n </div>\n <div class=\"dbx-forge-form-field-outline-trailing\"></div>\n </div>\n <div class=\"dbx-forge-form-field-content\">\n <dbx-forge-wrapper-content />\n </div>\n</div>\n<div class=\"mat-mdc-form-field-subscript-wrapper mat-mdc-form-field-bottom-align\">\n @if (showErrors()) {\n <div class=\"mat-mdc-form-field-error-wrapper\">\n <div class=\"mat-mdc-form-field-error mat-mdc-form-field-bottom-align\">{{ firstErrorMessage() }}</div>\n </div>\n } @else if (hintSignal(); as hint) {\n <div class=\"mat-m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IconButton } from '@angular/material/button';
|
|
4
|
-
import * as i1 from '@angular/material/icon';
|
|
5
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
-
import { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from './dereekb-dbx-form.mjs';
|
|
7
|
-
import { D as DbxForgeWrapperContentComponent } from './dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Forge wrapper field component that renders child fields inside a flex layout
|
|
11
|
-
* with an info icon button beside them.
|
|
12
|
-
*
|
|
13
|
-
* This is the forge equivalent of formly's `DbxFormInfoWrapperComponent`,
|
|
14
|
-
* providing a content area with a clickable info button on the right side.
|
|
15
|
-
* Supports wrapping groups of fields, not just single fields.
|
|
16
|
-
*/
|
|
17
|
-
class DbxForgeInfoWrapperFieldComponent extends AbstractForgeWrapperFieldComponent {
|
|
18
|
-
ariaLabelSignal = computed(() => {
|
|
19
|
-
return this.props()?.ariaLabel ?? 'More information';
|
|
20
|
-
}, ...(ngDevMode ? [{ debugName: "ariaLabelSignal" }] : /* istanbul ignore next */ []));
|
|
21
|
-
onClick() {
|
|
22
|
-
this.props()?.onInfoClick();
|
|
23
|
-
}
|
|
24
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeInfoWrapperFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
25
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: DbxForgeInfoWrapperFieldComponent, isStandalone: true, selector: "dbx-forge-info-wrapper-field", host: { properties: { "class": "className()" } }, providers: provideDbxForgeWrapperFieldDirective(DbxForgeInfoWrapperFieldComponent), usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-form-info-wrapper dbx-flex-bar\">\n <div class=\"dbx-form-info-wrapper-content dbx-flex-grow\">\n <dbx-forge-wrapper-content />\n </div>\n <div class=\"dbx-form-info-wrapper-info dbx-flex-noshrink dbx-flex-column dbx-flex-center\">\n <button mat-icon-button type=\"button\" (click)=\"onClick()\" [attr.aria-label]=\"ariaLabelSignal()\">\n <mat-icon>info</mat-icon>\n </button>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: DbxForgeWrapperContentComponent, selector: "dbx-forge-wrapper-content" }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
26
|
-
}
|
|
27
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeInfoWrapperFieldComponent, decorators: [{
|
|
28
|
-
type: Component,
|
|
29
|
-
args: [{ selector: 'dbx-forge-info-wrapper-field', providers: provideDbxForgeWrapperFieldDirective(DbxForgeInfoWrapperFieldComponent), imports: [DbxForgeWrapperContentComponent, MatIconButton, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: {
|
|
30
|
-
'[class]': 'className()'
|
|
31
|
-
}, template: "<div class=\"dbx-form-info-wrapper dbx-flex-bar\">\n <div class=\"dbx-form-info-wrapper-content dbx-flex-grow\">\n <dbx-forge-wrapper-content />\n </div>\n <div class=\"dbx-form-info-wrapper-info dbx-flex-noshrink dbx-flex-column dbx-flex-center\">\n <button mat-icon-button type=\"button\" (click)=\"onClick()\" [attr.aria-label]=\"ariaLabelSignal()\">\n <mat-icon>info</mat-icon>\n </button>\n </div>\n</div>\n" }]
|
|
32
|
-
}] });
|
|
33
|
-
|
|
34
|
-
export { DbxForgeInfoWrapperFieldComponent };
|
|
35
|
-
//# sourceMappingURL=dereekb-dbx-form-info.wrapper.field.component-Crm4wVr5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-info.wrapper.field.component-Crm4wVr5.mjs","sources":["../../../../packages/dbx-form/src/lib/forge/field/wrapper/info/info.wrapper.field.component.ts","../../../../packages/dbx-form/src/lib/forge/field/wrapper/info/info.wrapper.field.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { MatIconButton } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from '../wrapper.field';\nimport { DbxForgeWrapperContentComponent } from '../wrapper.content.component';\nimport type { DbxForgeInfoWrapperFieldProps } from './info.wrapper.field';\n\n/**\n * Forge wrapper field component that renders child fields inside a flex layout\n * with an info icon button beside them.\n *\n * This is the forge equivalent of formly's `DbxFormInfoWrapperComponent`,\n * providing a content area with a clickable info button on the right side.\n * Supports wrapping groups of fields, not just single fields.\n */\n@Component({\n selector: 'dbx-forge-info-wrapper-field',\n templateUrl: './info.wrapper.field.component.html',\n providers: provideDbxForgeWrapperFieldDirective(DbxForgeInfoWrapperFieldComponent),\n imports: [DbxForgeWrapperContentComponent, MatIconButton, MatIconModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n host: {\n '[class]': 'className()'\n }\n})\nexport class DbxForgeInfoWrapperFieldComponent extends AbstractForgeWrapperFieldComponent<DbxForgeInfoWrapperFieldProps> {\n readonly ariaLabelSignal = computed(() => {\n return this.props()?.ariaLabel ?? 'More information';\n });\n\n onClick(): void {\n this.props()?.onInfoClick();\n }\n}\n","<div class=\"dbx-form-info-wrapper dbx-flex-bar\">\n <div class=\"dbx-form-info-wrapper-content dbx-flex-grow\">\n <dbx-forge-wrapper-content />\n </div>\n <div class=\"dbx-form-info-wrapper-info dbx-flex-noshrink dbx-flex-column dbx-flex-center\">\n <button mat-icon-button type=\"button\" (click)=\"onClick()\" [attr.aria-label]=\"ariaLabelSignal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A,EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAO5D,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAX7C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,8BAA8B,aAE7B,oCAAoC,CAAA,iCAAA,CAAmC,EAAA,OAAA,EACzE,CAAC,+BAA+B,EAAE,aAAa,EAAE,aAAa,CAAC,EAAA,eAAA,EACvD,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EAAA,IAAA,EACV;AACJ,wBAAA,SAAS,EAAE;AACZ,qBAAA,EAAA,QAAA,EAAA,gbAAA,EAAA;;;;;"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { DbxSectionComponent, DbxSubSectionComponent } from '@dereekb/dbx-web';
|
|
4
|
-
import { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from './dereekb-dbx-form.mjs';
|
|
5
|
-
import { D as DbxForgeWrapperContentComponent } from './dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Forge wrapper field component that renders child fields inside a
|
|
9
|
-
* `<dbx-section>` or `<dbx-subsection>`.
|
|
10
|
-
*
|
|
11
|
-
* This is the forge equivalent of formly's `DbxFormSectionWrapperComponent`,
|
|
12
|
-
* providing proper semantic section structure with header and content area.
|
|
13
|
-
*/
|
|
14
|
-
class DbxForgeDbxSectionFieldWrapperComponent extends AbstractForgeWrapperFieldComponent {
|
|
15
|
-
headerConfigSignal = computed(() => {
|
|
16
|
-
return this.props()?.headerConfig ?? {};
|
|
17
|
-
}, ...(ngDevMode ? [{ debugName: "headerConfigSignal" }] : /* istanbul ignore next */ []));
|
|
18
|
-
elevateSignal = computed(() => {
|
|
19
|
-
return this.props()?.elevate ?? false;
|
|
20
|
-
}, ...(ngDevMode ? [{ debugName: "elevateSignal" }] : /* istanbul ignore next */ []));
|
|
21
|
-
subsectionSignal = computed(() => {
|
|
22
|
-
return this.props()?.subsection ?? false;
|
|
23
|
-
}, ...(ngDevMode ? [{ debugName: "subsectionSignal" }] : /* istanbul ignore next */ []));
|
|
24
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeDbxSectionFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
25
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxForgeDbxSectionFieldWrapperComponent, isStandalone: true, selector: "dbx-forge-section-field", host: { properties: { "class": "className()" } }, providers: provideDbxForgeWrapperFieldDirective(DbxForgeDbxSectionFieldWrapperComponent), usesInheritance: true, ngImport: i0, template: `
|
|
26
|
-
@if (subsectionSignal()) {
|
|
27
|
-
<dbx-subsection [headerConfig]="headerConfigSignal()">
|
|
28
|
-
<dbx-forge-wrapper-content />
|
|
29
|
-
</dbx-subsection>
|
|
30
|
-
} @else {
|
|
31
|
-
<dbx-section [headerConfig]="headerConfigSignal()" [elevate]="elevateSignal()">
|
|
32
|
-
<dbx-forge-wrapper-content />
|
|
33
|
-
</dbx-section>
|
|
34
|
-
}
|
|
35
|
-
`, isInline: true, dependencies: [{ kind: "component", type: DbxSectionComponent, selector: "dbx-section", inputs: ["elevate"] }, { kind: "component", type: DbxSubSectionComponent, selector: "dbx-subsection" }, { kind: "component", type: DbxForgeWrapperContentComponent, selector: "dbx-forge-wrapper-content" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
36
|
-
}
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeDbxSectionFieldWrapperComponent, decorators: [{
|
|
38
|
-
type: Component,
|
|
39
|
-
args: [{
|
|
40
|
-
selector: 'dbx-forge-section-field',
|
|
41
|
-
template: `
|
|
42
|
-
@if (subsectionSignal()) {
|
|
43
|
-
<dbx-subsection [headerConfig]="headerConfigSignal()">
|
|
44
|
-
<dbx-forge-wrapper-content />
|
|
45
|
-
</dbx-subsection>
|
|
46
|
-
} @else {
|
|
47
|
-
<dbx-section [headerConfig]="headerConfigSignal()" [elevate]="elevateSignal()">
|
|
48
|
-
<dbx-forge-wrapper-content />
|
|
49
|
-
</dbx-section>
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
providers: provideDbxForgeWrapperFieldDirective(DbxForgeDbxSectionFieldWrapperComponent),
|
|
53
|
-
imports: [DbxSectionComponent, DbxSubSectionComponent, DbxForgeWrapperContentComponent],
|
|
54
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
55
|
-
standalone: true,
|
|
56
|
-
host: {
|
|
57
|
-
'[class]': 'className()'
|
|
58
|
-
}
|
|
59
|
-
}]
|
|
60
|
-
}] });
|
|
61
|
-
|
|
62
|
-
export { DbxForgeDbxSectionFieldWrapperComponent };
|
|
63
|
-
//# sourceMappingURL=dereekb-dbx-form-section.field.component-DliafLqL.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-section.field.component-DliafLqL.mjs","sources":["../../../../packages/dbx-form/src/lib/forge/field/wrapper/section/section.field.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { DbxSectionComponent, DbxSubSectionComponent, type DbxSectionHeaderConfig } from '@dereekb/dbx-web';\nimport { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from '../wrapper.field';\nimport { DbxForgeWrapperContentComponent } from '../wrapper.content.component';\nimport type { DbxForgeSectionFieldProps } from './section.field';\n\n/**\n * Forge wrapper field component that renders child fields inside a\n * `<dbx-section>` or `<dbx-subsection>`.\n *\n * This is the forge equivalent of formly's `DbxFormSectionWrapperComponent`,\n * providing proper semantic section structure with header and content area.\n */\n@Component({\n selector: 'dbx-forge-section-field',\n template: `\n @if (subsectionSignal()) {\n <dbx-subsection [headerConfig]=\"headerConfigSignal()\">\n <dbx-forge-wrapper-content />\n </dbx-subsection>\n } @else {\n <dbx-section [headerConfig]=\"headerConfigSignal()\" [elevate]=\"elevateSignal()\">\n <dbx-forge-wrapper-content />\n </dbx-section>\n }\n `,\n providers: provideDbxForgeWrapperFieldDirective(DbxForgeDbxSectionFieldWrapperComponent),\n imports: [DbxSectionComponent, DbxSubSectionComponent, DbxForgeWrapperContentComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n host: {\n '[class]': 'className()'\n }\n})\nexport class DbxForgeDbxSectionFieldWrapperComponent extends AbstractForgeWrapperFieldComponent<DbxForgeSectionFieldProps> {\n readonly headerConfigSignal = computed((): DbxSectionHeaderConfig => {\n return this.props()?.headerConfig ?? {};\n });\n\n readonly elevateSignal = computed((): boolean => {\n return this.props()?.elevate ?? false;\n });\n\n readonly subsectionSignal = computed((): boolean => {\n return this.props()?.subsection ?? false;\n });\n}\n"],"names":[],"mappings":";;;;;;AAMA;;;;;;AAMG;AAsBG,MAAO,uCAAwC,SAAQ,kCAA6D,CAAA;AAC/G,IAAA,kBAAkB,GAAG,QAAQ,CAAC,MAA6B;QAClE,OAAO,IAAI,CAAC,KAAK,EAAE,EAAE,YAAY,IAAI,EAAE;AACzC,IAAA,CAAC,yFAAC;AAEO,IAAA,aAAa,GAAG,QAAQ,CAAC,MAAc;QAC9C,OAAO,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,IAAI,KAAK;AACvC,IAAA,CAAC,oFAAC;AAEO,IAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAc;QACjD,OAAO,IAAI,CAAC,KAAK,EAAE,EAAE,UAAU,IAAI,KAAK;AAC1C,IAAA,CAAC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uB,CAAC,MAAM;AAC/C,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE;AACZ;AACF,iBAAA;;;;;"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { NgClass, NgStyle } from '@angular/common';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { signal, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
-
import { asObservable } from '@dereekb/rxjs';
|
|
5
|
-
import { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from './dereekb-dbx-form.mjs';
|
|
6
|
-
import { D as DbxForgeWrapperContentComponent } from './dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Forge wrapper field component that applies dynamic CSS classes and
|
|
10
|
-
* inline styles to a container around child fields.
|
|
11
|
-
*
|
|
12
|
-
* This is the forge equivalent of formly's `DbxFormStyleWrapperComponent`.
|
|
13
|
-
* Supports both static values and reactive observables for class and style
|
|
14
|
-
* properties via `ObservableOrValue`.
|
|
15
|
-
*/
|
|
16
|
-
class DbxForgeStyleFieldComponent extends AbstractForgeWrapperFieldComponent {
|
|
17
|
-
classValueSignal = signal('', ...(ngDevMode ? [{ debugName: "classValueSignal" }] : /* istanbul ignore next */ []));
|
|
18
|
-
styleValueSignal = signal({}, ...(ngDevMode ? [{ debugName: "styleValueSignal" }] : /* istanbul ignore next */ []));
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
// Bridge classGetter ObservableOrValue to signal
|
|
22
|
-
effect((onCleanup) => {
|
|
23
|
-
const classGetter = this.props()?.classGetter;
|
|
24
|
-
if (classGetter != null) {
|
|
25
|
-
const sub = asObservable(classGetter).subscribe((v) => this.classValueSignal.set(v));
|
|
26
|
-
onCleanup(() => sub.unsubscribe());
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this.classValueSignal.set('');
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
// Bridge styleGetter ObservableOrValue to signal
|
|
33
|
-
effect((onCleanup) => {
|
|
34
|
-
const styleGetter = this.props()?.styleGetter;
|
|
35
|
-
if (styleGetter != null) {
|
|
36
|
-
const sub = asObservable(styleGetter).subscribe((v) => this.styleValueSignal.set(v));
|
|
37
|
-
onCleanup(() => sub.unsubscribe());
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
this.styleValueSignal.set({});
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeStyleFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
45
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: DbxForgeStyleFieldComponent, isStandalone: true, selector: "dbx-forge-style-wrapper-field", host: { properties: { "class": "className()" } }, providers: provideDbxForgeWrapperFieldDirective(DbxForgeStyleFieldComponent), usesInheritance: true, ngImport: i0, template: `
|
|
46
|
-
<div class="dbx-form-style-wrapper" [ngClass]="classValueSignal()" [ngStyle]="styleValueSignal()">
|
|
47
|
-
<dbx-forge-wrapper-content />
|
|
48
|
-
</div>
|
|
49
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: DbxForgeWrapperContentComponent, selector: "dbx-forge-wrapper-content" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
50
|
-
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeStyleFieldComponent, decorators: [{
|
|
52
|
-
type: Component,
|
|
53
|
-
args: [{
|
|
54
|
-
selector: 'dbx-forge-style-wrapper-field',
|
|
55
|
-
template: `
|
|
56
|
-
<div class="dbx-form-style-wrapper" [ngClass]="classValueSignal()" [ngStyle]="styleValueSignal()">
|
|
57
|
-
<dbx-forge-wrapper-content />
|
|
58
|
-
</div>
|
|
59
|
-
`,
|
|
60
|
-
providers: provideDbxForgeWrapperFieldDirective(DbxForgeStyleFieldComponent),
|
|
61
|
-
imports: [NgClass, NgStyle, DbxForgeWrapperContentComponent],
|
|
62
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
63
|
-
standalone: true,
|
|
64
|
-
host: {
|
|
65
|
-
'[class]': 'className()'
|
|
66
|
-
}
|
|
67
|
-
}]
|
|
68
|
-
}], ctorParameters: () => [] });
|
|
69
|
-
|
|
70
|
-
export { DbxForgeStyleFieldComponent };
|
|
71
|
-
//# sourceMappingURL=dereekb-dbx-form-style.field.component-C3ZNiotx.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-style.field.component-C3ZNiotx.mjs","sources":["../../../../packages/dbx-form/src/lib/forge/field/wrapper/style/style.field.component.ts"],"sourcesContent":["import { NgClass, NgStyle } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, effect, signal } from '@angular/core';\nimport { asObservable } from '@dereekb/rxjs';\nimport { AbstractForgeWrapperFieldComponent, provideDbxForgeWrapperFieldDirective } from '../wrapper.field';\nimport { DbxForgeWrapperContentComponent } from '../wrapper.content.component';\nimport type { DbxForgeStyleFieldProps, DbxForgeStyleObject } from './style.field';\n\n/**\n * Forge wrapper field component that applies dynamic CSS classes and\n * inline styles to a container around child fields.\n *\n * This is the forge equivalent of formly's `DbxFormStyleWrapperComponent`.\n * Supports both static values and reactive observables for class and style\n * properties via `ObservableOrValue`.\n */\n@Component({\n selector: 'dbx-forge-style-wrapper-field',\n template: `\n <div class=\"dbx-form-style-wrapper\" [ngClass]=\"classValueSignal()\" [ngStyle]=\"styleValueSignal()\">\n <dbx-forge-wrapper-content />\n </div>\n `,\n providers: provideDbxForgeWrapperFieldDirective(DbxForgeStyleFieldComponent),\n imports: [NgClass, NgStyle, DbxForgeWrapperContentComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n host: {\n '[class]': 'className()'\n }\n})\nexport class DbxForgeStyleFieldComponent extends AbstractForgeWrapperFieldComponent<DbxForgeStyleFieldProps> {\n readonly classValueSignal = signal<string>('');\n readonly styleValueSignal = signal<DbxForgeStyleObject>({});\n\n constructor() {\n super();\n\n // Bridge classGetter ObservableOrValue to signal\n effect((onCleanup) => {\n const classGetter = this.props()?.classGetter;\n\n if (classGetter != null) {\n const sub = asObservable(classGetter).subscribe((v) => this.classValueSignal.set(v));\n onCleanup(() => sub.unsubscribe());\n } else {\n this.classValueSignal.set('');\n }\n });\n\n // Bridge styleGetter ObservableOrValue to signal\n effect((onCleanup) => {\n const styleGetter = this.props()?.styleGetter;\n\n if (styleGetter != null) {\n const sub = asObservable(styleGetter).subscribe((v) => this.styleValueSignal.set(v));\n onCleanup(() => sub.unsubscribe());\n } else {\n this.styleValueSignal.set({});\n }\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;AAOA;;;;;;;AAOG;AAgBG,MAAO,2BAA4B,SAAQ,kCAA2D,CAAA;AACjG,IAAA,gBAAgB,GAAG,MAAM,CAAS,EAAE,uFAAC;AACrC,IAAA,gBAAgB,GAAG,MAAM,CAAsB,EAAE,uFAAC;AAE3D,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;AAGP,QAAA,MAAM,CAAC,CAAC,SAAS,KAAI;YACnB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,WAAW;AAE7C,YAAA,IAAI,WAAW,IAAI,IAAI,EAAE;gBACvB,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACpF,SAAS,CAAC,MAAM,GAAG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