@breadstone/mosaik-elements-angular 0.0.185 → 0.0.187
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.0.187 (2025-12-02)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for mosaik-elements-angular to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 0.0.186 (2025-12-02)
|
|
6
|
+
|
|
7
|
+
### 🚀 Features
|
|
8
|
+
|
|
9
|
+
- **directives:** refactor FormFieldDirective to use InputSignal for field state ([2ab766e52f](https://github.com/RueDeRennes/mosaik/commit/2ab766e52f))
|
|
10
|
+
|
|
1
11
|
## 0.0.185 (2025-12-02)
|
|
2
12
|
|
|
3
13
|
### 🚀 Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ChangeDetectorRef, ElementRef, NgZone, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, makeEnvironmentProviders, DestroyRef, Directive, forwardRef, Injectable, Pipe, signal, effect, ViewChild, ViewEncapsulation, TemplateRef, Injector, DOCUMENT as DOCUMENT$1, Renderer2, computed, provideEnvironmentInitializer, ViewContainerRef, booleanAttribute, HostListener, ContentChildren, isDevMode, Optional, SkipSelf } from '@angular/core';
|
|
3
|
-
import * as i1
|
|
2
|
+
import { InjectionToken, inject, ChangeDetectorRef, ElementRef, NgZone, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, makeEnvironmentProviders, DestroyRef, Directive, forwardRef, Injectable, Pipe, signal, effect, ViewChild, ViewEncapsulation, TemplateRef, Injector, DOCUMENT as DOCUMENT$1, Renderer2, computed, provideEnvironmentInitializer, ViewContainerRef, booleanAttribute, HostListener, ContentChildren, input, isDevMode, Optional, SkipSelf } from '@angular/core';
|
|
3
|
+
import * as i1 from '@breadstone/mosaik-elements-foundation';
|
|
4
4
|
import { AbsoluteItemElement, AbsoluteElement, AnchorElement, AppHeaderElement, AppElement, AttachmentChatToolElement, AudioElement, AutoCompleteBoxElement, AvatarGroupElement, avatarElementValueAccessor, AvatarElement, BackdropElement, BadgeElement, BannerGroupElement, BannerHeaderElement, BannerSubHeaderElement, BannerElement, BottomSheetElement, BoxElement, BreadcrumbItemElement, BreadcrumbElement, BusyStateElement, ButtonGroupElement, ButtonElement, CalendarHeaderElement, CalendarItemElement, CalendarSubHeaderElement, calendarElementValueAccessor, CalendarElement, CameraElement, CardActionsElement, CardContentElement, CardFooterElement, CardHeaderElement, CardSubTitleElement, CardTitleElement, CardElement, Carousel2Element, CarouselItem2Element, CarouselItemElement, CarouselElement, CellGroupElement, CellElement, ChartElement, ChatHeaderElement, ChatInputAttachmentListElement, ChatInputElement, ChatMarkerElement, ChatMessageAvatarElement, ChatMessageDividerElement, ChatMessageReactionElement, ChatMessageElement, ChatElement, checkBoxGroupElementValueAccessor, CheckBoxGroupElement, checkboxElementValueAccessor, CheckboxElement, CheckmarkElement, ChipElement, chipBoxElementValueAccessor, ChipBoxElement, ChoiceGroupHeaderElement, choiceGroupElementValueAccessor, ChoiceGroupElement, choiceElementValueAccessor, ChoiceElement, CodeElement, ColorAreaElement, ColorPickerElement, ColorSliderElement, ColorSwatchGroupElement, ColorSwatchElement, ColorThumbElement, colorBoxElementValueAccessor, ColorBoxElement, ComboItemElement, comboElementValueAccessor, ComboElement, CommentElement, CompoundButtonElement, CookiesConsentElement, DataListElement, DataTableElement, dateBoxElementValueAccessor, DateBoxElement, dateTimeBoxElementValueAccessor, DateTimeBoxElement, DialogActionsElement, DialogContentElement, DialogFooterElement, DialogHeaderSubTextElement, DialogHeaderTextElement, DialogHeaderElement, DialogElement, DisclosureElement, DismissElement, DividerElement, DockPanelElement, DotElement, DrawerContainerElement, DrawerContentElement, DrawerElement, DropZoneElement, DropDownButtonElement, ElevationElement, EmojiElement, EmptyStateElement, EpgChannelElement, EpgProgramElement, EpgElement, ErrorStateElement, ErrorElement, ExpandableElement, ExpanderGroupElement, ExpanderHeaderElement, ExpanderSubHeaderElement, ExpanderElement, FloatingActionButtonGroupElement, FloatingActionButtonElement, FilePickerElement, FileUploadItemElement, fileUploadElementValueAccessor, FileUploadElement, FlipElement, FloatingTriggerElement, FloatingElement, FocusRingElement, FooterItemGroupElement, FooterItemElement, FooterElement, FormFieldElement, FormElement, GridItemElement, GridElement, HelmetElement, HintElement, IconElement, ImageElement, IndicatorElement, JumbotronHeaderElement, JumbotronSubHeaderElement, JumbotronElement, KbdShortcutElement, KbdElement, LightChainElement, ListItemGroupElement, ListItemElement, ListElement, MapElement, MarqueeElement, MasonryElement, MenuItemGroupElement, MenuItemElement, MenuElement, MessageBoxElement, MeterBarElement, MeterRingElement, NumberCounterElement, NumberElement, numberBoxElementValueAccessor, NumberBoxElement, PageContentElement, PageHeaderElement, PagePreContentElement, PagePreHeaderElement, PageElement, PageMenuElement, PaginatorElement, passwordBoxElementValueAccessor, PasswordBoxElement, PatternElement, PersonaElement, PerspectiveElement, pinBoxElementValueAccessor, PinBoxElement, PopupElement, PortalHostElement, PortalProjectionElement, PortalElement, ProgressBarElement, ProgressRingElement, QRCodeElement, radioGroupElementValueAccessor, RadioGroupElement, radioElementValueAccessor, RadioElement, RatingElement, ReactionChatToolElement, RepeatButtonElement, ResizeAdornerElement, RibbonElement, richTextBoxElementValueAccessor, RichTextBoxElement, RippleElement, ScaleElement, ScrollElement, scrubSliderElementValueAccessor, ScrubSliderElement, searchBoxElementValueAccessor, SearchBoxElement, SegmentItemElement, SegmentElement, SelectItemGroupElement, SelectItemElement, selectElementValueAccessor, SelectElement, signaturePadElementValueAccessor, SignaturePadElement, SkeletonElement, sliderElementValueAccessor, SliderElement, Slider2ThumbElement, Slider2Element, SpacerElement, SplitButtonElement, SplitElement, StackElement, StickyElement, SuccessStateElement, SummaryElement, SwipeElement, TabItemElement, TabPanelElement, TabStripItemElement, TabStripElement, TabElement, TableBodyElement, TableCellElement, TableFooterElement, TableHeaderElement, TableRowElement, TableElement, TextFormatElement, TextElement, textBoxElementValueAccessor, TextBoxElement, Theme2Element, ThumbnailElement, TickBarElement, TileListItemElement, TileListElement, timeBoxElementValueAccessor, TimeBoxElement, ToastElement, ToggleButtonGroupElement, toggleButtonElementValueAccessor, ToggleButtonElement, toggleSwitchElementValueAccessor, ToggleSwitchElement, ToggleTipElement, ToolbarElement, TooltipElement, TreeItemElement, TreeElement, UpDownSpinnerElement, VideoElement, VirtualizeElement, VoiceRecorderChatToolElement, WizardStepElement, WizardElement, WrapElement, ToastService as ToastService$1, EID, Key, MessageBoxService as MessageBoxService$1, BottomSheetService as BottomSheetService$1, TranslatorService, Translator, TranslatorServiceLocator, BREAKPOINTS, Size, Spacing, AnimationPlayer2, Animation, DateAgoIntl, TimeAgoIntl } from '@breadstone/mosaik-elements-foundation';
|
|
5
5
|
import { NgControl, TouchedChangeEvent, NG_VALUE_ACCESSOR, FormControl, FormArray, FormGroup, AbstractControl, FormGroupDirective } from '@angular/forms';
|
|
6
6
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -11,8 +11,7 @@ import { DOCUMENT, NgTemplateOutlet, AsyncPipe } from '@angular/common';
|
|
|
11
11
|
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
12
12
|
import { OverlayPositionBuilder, Overlay } from '@angular/cdk/overlay';
|
|
13
13
|
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
14
|
-
import
|
|
15
|
-
import { validate, Field } from '@angular/forms/signals';
|
|
14
|
+
import { validate } from '@angular/forms/signals';
|
|
16
15
|
import { emit, filterByMemberPath, orderByMemberPath } from '@breadstone/mosaik-elements';
|
|
17
16
|
import { ThemeObserver, ThemeGeneratorServiceLocator, ThemeGenerator, ThemeObserverServiceLocator } from '@breadstone/mosaik-themes';
|
|
18
17
|
import { map, startWith } from 'rxjs/operators';
|
|
@@ -61728,73 +61727,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImpor
|
|
|
61728
61727
|
args: [{ required: true }]
|
|
61729
61728
|
}] } });
|
|
61730
61729
|
|
|
61731
|
-
|
|
61732
|
-
|
|
61730
|
+
//#region Imports
|
|
61731
|
+
//#endregion
|
|
61733
61732
|
/**
|
|
61734
|
-
* Directive
|
|
61735
|
-
*
|
|
61733
|
+
* Attribute-Directive that binds a `FieldState` to `FormFieldElement`.
|
|
61734
|
+
* It observes the validation `errors()` and `touched()` state of the field,
|
|
61735
|
+
* and automatically updates the Element’s `error` property — always using the **last** validation error (if any) when the field has been touched.
|
|
61736
61736
|
*
|
|
61737
61737
|
* @public
|
|
61738
|
-
*
|
|
61739
|
-
* @example
|
|
61738
|
+
* @Usage
|
|
61740
61739
|
* ```html
|
|
61741
|
-
* <mosaik-form-field [
|
|
61742
|
-
* <
|
|
61740
|
+
* <mosaik-form-field [fieldState]="form.someField()">
|
|
61741
|
+
* <mosaik-textbox [field]="form.someField" … />
|
|
61743
61742
|
* </mosaik-form-field>
|
|
61744
61743
|
* ```
|
|
61745
61744
|
*/
|
|
61746
61745
|
class FormFieldDirective {
|
|
61747
|
-
|
|
61746
|
+
//#region Fields
|
|
61748
61747
|
_elementRef;
|
|
61749
|
-
|
|
61750
|
-
|
|
61751
|
-
|
|
61752
|
-
/**
|
|
61753
|
-
* Constructs a new instance of the `{@link FormFieldErrorDirective}` class.
|
|
61754
|
-
*
|
|
61755
|
-
* @public
|
|
61756
|
-
*/
|
|
61757
|
-
constructor(elementRef = inject(ElementRef), control = inject(Field)) {
|
|
61748
|
+
//#endregion
|
|
61749
|
+
//#region Ctor
|
|
61750
|
+
constructor(elementRef = inject((ElementRef))) {
|
|
61758
61751
|
this._elementRef = elementRef;
|
|
61759
|
-
|
|
61752
|
+
// Observe changes in the fieldState signal. Whenever it changes (value, errors, touched…),
|
|
61753
|
+
// we recalc the error message and apply it to the Web Component.
|
|
61760
61754
|
effect(() => {
|
|
61761
|
-
const
|
|
61762
|
-
this.
|
|
61755
|
+
const fs = this.fieldState();
|
|
61756
|
+
this.applyError(fs);
|
|
61763
61757
|
});
|
|
61764
61758
|
}
|
|
61765
|
-
|
|
61766
|
-
|
|
61759
|
+
//#endregion
|
|
61760
|
+
//#region Properties
|
|
61767
61761
|
/**
|
|
61768
|
-
*
|
|
61762
|
+
* The FieldState to observe for validation errors.
|
|
61769
61763
|
*
|
|
61770
|
-
* @
|
|
61771
|
-
* @
|
|
61764
|
+
* @required
|
|
61765
|
+
* @public
|
|
61766
|
+
* @example
|
|
61767
|
+
* ```html
|
|
61768
|
+
* <mosaik-form-field [fieldState]="form.someField()">
|
|
61769
|
+
* …
|
|
61770
|
+
* </mosaik-form-field>
|
|
61771
|
+
* ```
|
|
61772
|
+
*/
|
|
61773
|
+
fieldState = input.required({ ...(ngDevMode ? { debugName: "fieldState" } : {}) });
|
|
61774
|
+
//#endregion
|
|
61775
|
+
//#region Methods
|
|
61776
|
+
/**
|
|
61777
|
+
* Maps the FieldState (errors + touched) to the Element error property.
|
|
61778
|
+
* If there is at least one error AND the field has been touched → set error to the
|
|
61779
|
+
* last error.message. Otherwise clear the error.
|
|
61780
|
+
*
|
|
61781
|
+
* @param fieldState The current FieldState
|
|
61772
61782
|
*/
|
|
61773
|
-
|
|
61774
|
-
const
|
|
61783
|
+
applyError(fieldState) {
|
|
61784
|
+
const el = this._elementRef.nativeElement;
|
|
61775
61785
|
if (!fieldState) {
|
|
61776
|
-
|
|
61786
|
+
// No state → clear any previous error
|
|
61787
|
+
el.error = '';
|
|
61777
61788
|
return;
|
|
61778
61789
|
}
|
|
61779
|
-
const errors = fieldState.errors();
|
|
61780
|
-
|
|
61781
|
-
|
|
61782
|
-
|
|
61783
|
-
|
|
61790
|
+
const errors = fieldState.errors(); // array of validation errors
|
|
61791
|
+
const isTouched = fieldState.touched(); // whether the field was touched
|
|
61792
|
+
if (errors.length > 0 && isTouched) {
|
|
61793
|
+
// Use the last error in the array as the “active” error message
|
|
61794
|
+
const lastError = errors[errors.length - 1];
|
|
61795
|
+
el.error = lastError.message ?? '';
|
|
61784
61796
|
}
|
|
61785
61797
|
else {
|
|
61786
|
-
|
|
61798
|
+
// No errors or not touched yet → clear error
|
|
61799
|
+
el.error = '';
|
|
61787
61800
|
}
|
|
61788
61801
|
}
|
|
61789
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: FormFieldDirective, deps: [{ token: i0.ElementRef }
|
|
61790
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
61802
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: FormFieldDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
61803
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.1", type: FormFieldDirective, isStandalone: true, selector: "mosaik-form-field", inputs: { fieldState: { classPropertyName: "fieldState", publicName: "fieldState", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
61791
61804
|
}
|
|
61792
61805
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: FormFieldDirective, decorators: [{
|
|
61793
61806
|
type: Directive,
|
|
61794
61807
|
args: [{
|
|
61795
|
-
|
|
61808
|
+
// applies to your custom element
|
|
61809
|
+
selector: 'mosaik-form-field'
|
|
61796
61810
|
}]
|
|
61797
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type:
|
|
61811
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { fieldState: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldState", required: true }] }] } });
|
|
61798
61812
|
|
|
61799
61813
|
// #region Imports
|
|
61800
61814
|
// #endregion
|
|
@@ -62171,12 +62185,12 @@ class TranslateService {
|
|
|
62171
62185
|
translate(key, ...args) {
|
|
62172
62186
|
return this._translator.translate(key, ...args);
|
|
62173
62187
|
}
|
|
62174
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: TranslateService, deps: [{ token: i1
|
|
62188
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: TranslateService, deps: [{ token: i1.TranslatorService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
62175
62189
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: TranslateService });
|
|
62176
62190
|
}
|
|
62177
62191
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: TranslateService, decorators: [{
|
|
62178
62192
|
type: Injectable
|
|
62179
|
-
}], ctorParameters: () => [{ type: i1
|
|
62193
|
+
}], ctorParameters: () => [{ type: i1.TranslatorService }] });
|
|
62180
62194
|
|
|
62181
62195
|
// #region Imports
|
|
62182
62196
|
// #endregion
|