@fundamental-ngx/cdk 0.56.6 → 0.56.8
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.
|
@@ -287,10 +287,14 @@ class CvaDirective {
|
|
|
287
287
|
* Should be "false", if the change is made programmatically (internally) by the control, "true" otherwise
|
|
288
288
|
*/
|
|
289
289
|
setValue(value, emitOnChange = true) {
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
let coercedValue = value;
|
|
291
|
+
if (this.type === 'number') {
|
|
292
|
+
coercedValue = value === '' || value === null || value === undefined ? null : Number(value);
|
|
293
|
+
}
|
|
294
|
+
if (coercedValue !== this.value) {
|
|
295
|
+
this.writeValue(coercedValue);
|
|
292
296
|
if (emitOnChange) {
|
|
293
|
-
this.onChange(
|
|
297
|
+
this.onChange(coercedValue);
|
|
294
298
|
}
|
|
295
299
|
this._markForCheck();
|
|
296
300
|
}
|
|
@@ -300,7 +304,7 @@ class CvaDirective {
|
|
|
300
304
|
this.markForCheck.emit();
|
|
301
305
|
}
|
|
302
306
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: CvaDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
303
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.3", type: CvaDirective, isStandalone: true, selector: "[fdkCva]", inputs: { placeholder: "placeholder", state: "state", stateMessage: "stateMessage", disabled: "disabled", readonly: "readonly", ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", editable: "editable", name: "name", id: "id" }, outputs: { detectChanges: "detectChanges", markForCheck: "markForCheck" }, viewQueries: [{ propertyName: "_elementRef", first: true, predicate: ["inputElementRef"], descendants: true, read: ElementRef, static: true }], ngImport: i0 }); }
|
|
307
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.3", type: CvaDirective, isStandalone: true, selector: "[fdkCva]", inputs: { placeholder: "placeholder", type: "type", state: "state", stateMessage: "stateMessage", disabled: "disabled", readonly: "readonly", ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", editable: "editable", name: "name", id: "id" }, outputs: { detectChanges: "detectChanges", markForCheck: "markForCheck" }, viewQueries: [{ propertyName: "_elementRef", first: true, predicate: ["inputElementRef"], descendants: true, read: ElementRef, static: true }], ngImport: i0 }); }
|
|
304
308
|
}
|
|
305
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: CvaDirective, decorators: [{
|
|
306
310
|
type: Directive,
|
|
@@ -310,6 +314,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
310
314
|
}]
|
|
311
315
|
}], ctorParameters: () => [], propDecorators: { placeholder: [{
|
|
312
316
|
type: Input
|
|
317
|
+
}], type: [{
|
|
318
|
+
type: Input
|
|
313
319
|
}], state: [{
|
|
314
320
|
type: Input
|
|
315
321
|
}], stateMessage: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundamental-ngx-cdk-forms.mjs","sources":["../../../../libs/cdk/forms/models/form-state.ts","../../../../libs/cdk/forms/helpers/state.ts","../../../../libs/cdk/forms/tokens/form-field-control.token.ts","../../../../libs/cdk/forms/tokens/form-field.token.ts","../../../../libs/cdk/forms/cva/cva.directive.ts","../../../../libs/cdk/forms/forms.module.ts","../../../../libs/cdk/forms/cva/cva-control.class.ts","../../../../libs/cdk/forms/models/form-field.ts","../../../../libs/cdk/forms/models/select-item.ts","../../../../libs/cdk/forms/fundamental-ngx-cdk-forms.ts"],"sourcesContent":["export const formStates = ['success', 'error', 'warning', 'default', 'information'] as const;\n\nexport type FormStates = (typeof formStates)[number];\n","import { formStates, FormStates } from '../models/form-state';\n\nconst stateSet = new Set<FormStates>(formStates);\n\n/** Checks if the given state is a valid control state. */\nexport function isValidControlState(value: any): value is FormStates {\n return stateSet.has(value);\n}\n","import { InjectionToken } from '@angular/core';\nimport { FormFieldControl } from '../models/form-field';\n\nexport const FD_FORM_FIELD_CONTROL = new InjectionToken<FormFieldControl>('FdFormFieldControl');\n","import { InjectionToken } from '@angular/core';\nimport { FormField } from '../models/form-field';\n\nexport const FD_FORM_FIELD = new InjectionToken<FormField>('FdFormField');\n","import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n AfterViewInit,\n Directive,\n DoCheck,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewChild,\n computed,\n inject,\n isDevMode,\n signal\n} from '@angular/core';\nimport { ControlContainer, ControlValueAccessor, FormControl, NgControl, NgForm } from '@angular/forms';\nimport { HasElementRef, Nullable } from '@fundamental-ngx/cdk/utils';\nimport { Subject, Subscription } from 'rxjs';\nimport { isValidControlState } from '../helpers/state';\nimport { BaseCVA } from '../models/cva';\nimport { FormField, FormFieldControl } from '../models/form-field';\nimport { FormStates } from '../models/form-state';\nimport { FD_FORM_FIELD_CONTROL } from '../tokens/form-field-control.token';\nimport { FD_FORM_FIELD } from '../tokens/form-field.token';\n\nlet randomId = 0;\n\n@Directive({\n selector: '[fdkCva]',\n standalone: true\n})\nexport class CvaDirective<T = any>\n implements HasElementRef, BaseCVA, FormFieldControl, OnInit, DoCheck, AfterViewInit, OnDestroy, ControlValueAccessor\n{\n /** Input placeholder */\n @Input()\n placeholder: string;\n\n /**\n * The state of the form control - applies css classes.\n * Can be 'success', 'error', 'warning', 'default', 'information'.\n *\n * @default 'default'\n */\n @Input()\n set state(state: Nullable<FormStates>) {\n if (!state || isValidControlState(state)) {\n this._state$.set(state);\n } else if (isDevMode()) {\n console.warn(`Provided value \"${state}\" is not a valid option for FormStates type`);\n }\n }\n get state(): FormStates {\n return this.normalizedState$();\n }\n\n /** Holds the message with respect to state */\n @Input()\n stateMessage: Nullable<string>;\n\n /** Whether the input is disabled */\n @Input()\n set disabled(value: boolean) {\n this.setDisabledState(value);\n }\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n\n /**\n * readOnly Value to Mark component read only\n */\n @Input()\n readonly: boolean;\n\n /** Binds to control aria-labelledBy attribute */\n @Input()\n ariaLabelledBy: Nullable<string>;\n\n /** Sets control aria-label attribute value */\n @Input()\n ariaLabel: Nullable<string>;\n\n /**\n * Tell the component if we are in editing mode.\n */\n @Input()\n set editable(value: BooleanInput) {\n const newVal = coerceBooleanProperty(value);\n if (this._editable !== newVal) {\n this._editable = newVal;\n this._markForCheck();\n this.stateChanges.next('editable');\n }\n }\n get editable(): boolean {\n return this._editable;\n }\n\n /**\n * Name of the control.\n */\n @Input()\n name: string;\n\n /**\n * Emits when change detection is needed.\n */\n @Output()\n detectChanges = new EventEmitter<void>();\n\n /**\n * Emits when mark for changes detection is needed.\n */\n @Output()\n markForCheck = new EventEmitter<void>();\n\n /**\n * Reference to internal Input element\n */\n @ViewChild('inputElementRef', { static: true, read: ElementRef })\n protected _elementRef: ElementRef;\n\n /** @hidden */\n value: T;\n\n /** set when input field is mandatory form field */\n required: boolean;\n\n /**\n * See @FormFieldControl\n */\n focused = false;\n\n /** Whether control has errors */\n get controlInvalid(): boolean {\n return this._controlInvalid$();\n }\n\n /**\n * See @FormFieldControl\n */\n readonly stateChanges: Subject<any> = new Subject<any>();\n\n /** @hidden */\n readonly formField: FormField | null = inject(FD_FORM_FIELD, {\n skipSelf: true,\n optional: true\n });\n\n /**\n * NgControl instance.\n */\n readonly ngControl = inject(NgControl, {\n optional: true,\n host: true\n });\n\n /**\n * Form container instance. Usually ngForm or FormGroup directives.\n */\n readonly controlContainer = inject(ControlContainer, {\n optional: true,\n skipSelf: true\n });\n\n /**\n * Separate NgForm instance. For cases when formGroup is used with the form itself.\n */\n readonly ngForm = inject(NgForm, {\n optional: true,\n skipSelf: true\n });\n\n /** @hidden */\n readonly normalizedState$ = computed(() => {\n const storedState = this._state$();\n if (storedState) {\n return storedState;\n }\n\n if (!this._controlInvalid$()) {\n return 'default';\n }\n\n return this.formField?.getPriorityState() || 'default';\n });\n\n /** @hidden */\n protected _subscriptions = new Subscription();\n\n /**\n * A private property to hold the ElementRef which might be null\n */\n private _elementRefOrNull: ElementRef | null = inject(ElementRef, { optional: true });\n\n /**\n * Element reference.\n */\n get elementRef(): ElementRef {\n // Return a fallback ElementRef if _elementRefOrNull is null\n return this._elementRefOrNull || (this._elementRef as ElementRef);\n }\n\n /** @hidden */\n private _defaultId = `fd-input-id-${randomId++}`;\n\n /** ID for the Element */\n // eslint-disable-next-line @typescript-eslint/member-ordering\n @Input()\n id: string = this._defaultId;\n\n /** @hidden */\n private _disabled: boolean;\n /** @hidden */\n private _editable = true;\n\n /**\n * @hidden\n */\n private readonly _controlInvalid$ = signal(false);\n\n /** @hidden */\n private readonly _parentControl = inject(FD_FORM_FIELD_CONTROL, {\n skipSelf: true,\n optional: true\n });\n\n /**\n * @hidden\n * The state of the form control - applies css classes.\n * Can be `success`, `error`, `warning`, `information` or 'default'\n */\n private readonly _state$ = signal<Nullable<FormStates>>(null);\n\n /** @hidden */\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /** @hidden */\n onChange: (value: any) => void = () => {};\n\n /** @hidden */\n onTouched = (): void => {};\n\n /** @hidden */\n ngOnInit(): void {\n // There may be cases when one form control is used as a base to build another form control.\n if (!this._parentControl) {\n this.formField?.registerFormFieldControl(this);\n }\n }\n\n /**\n * Re-validate and emit event to parent container on every CD cycle as they are some errors\n * that we can't subscribe to.\n */\n ngDoCheck(): void {\n if (this.ngControl) {\n this.updateErrorState();\n }\n }\n\n /** @hidden */\n ngAfterViewInit(): void {\n if (this.ngControl) {\n this._subscriptions.add(\n this.ngControl.statusChanges?.subscribe(() => {\n this._markForCheck();\n })\n );\n }\n\n const labelAndHelpId = `fdp-form-label-content-${this.id}`;\n // if not specified, associate label and inline help ids with the input,\n // else add these ids to the specified ones\n if (!this.ariaLabelledBy) {\n this.ariaLabelledBy = labelAndHelpId;\n } else {\n this.ariaLabelledBy += ' ' + labelAndHelpId;\n }\n this._markForCheck();\n }\n\n /** @hidden */\n registerOnChange(fn: (_: any) => void): void {\n this.onChange = fn;\n }\n\n /** @hidden */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @hidden */\n ngOnDestroy(): void {\n this._subscriptions.unsubscribe();\n this.stateChanges.complete();\n this.formField?.unregisterFormFieldControl(this);\n }\n\n /** @hidden */\n setDisabledState(isDisabled: BooleanInput): void {\n const newState = coerceBooleanProperty(isDisabled);\n this._markForCheck();\n if (newState !== this._disabled) {\n this._disabled = newState;\n this.stateChanges.next('setDisabledState');\n }\n }\n\n /**\n * Method for setting the value\n * @param value\n */\n writeValue(value: T): void {\n this.value = value;\n this.stateChanges.next('writeValue');\n this._markForCheck();\n }\n\n /**\n *\n * Keeps track of element focus\n */\n _onFocusChanged(isFocused: boolean): void {\n if (isFocused !== this.focused && (!this.disabled || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next('_onFocusChanged');\n }\n\n if (!isFocused) {\n this.onTouched();\n }\n }\n\n /**\n * Handles even when we click on parent container which is the FormField Wrapping this\n * control\n */\n onContainerClick(event: MouseEvent): void {\n this.focus(event);\n }\n\n /**\n * In most of the cases when working with input element directly you should be just find to assign\n * variable to this element\n *\n * ```\n * <input #inputElementRef fd-form-control ...>\n * ```\n *\n * and this default behavior used. For other cases implement focus.\n *\n */\n focus(event?: MouseEvent): void {\n if (this._elementRef && !this.focused) {\n this._elementRef.nativeElement.focus(event);\n }\n }\n\n /**\n * Need re-validates errors on every CD iteration to make sure we are also\n * covering non-control errors, errors that happens outside of this control\n */\n updateErrorState(): void {\n const parent = this.ngForm;\n const parentControlContainer = this.controlContainer;\n const control = this.ngControl ? (this.ngControl.control as FormControl) : null;\n const newStatusIsError = !!(\n control?.invalid &&\n (control.dirty || control.touched || parent?.submitted || (parentControlContainer as any)?.submitted)\n );\n\n if (newStatusIsError !== this._controlInvalid$()) {\n this._controlInvalid$.set(newStatusIsError);\n this.stateChanges.next('updateErrorState');\n this._markForCheck();\n }\n }\n\n /**\n * Used to change the value of a control.\n * @param value the value to be applied\n * @param emitOnChange whether to emit \"onChange\" event.\n * Should be \"false\", if the change is made programmatically (internally) by the control, \"true\" otherwise\n */\n setValue(value: T, emitOnChange = true): void {\n if (value !== this.value) {\n this.writeValue(value);\n if (emitOnChange) {\n this.onChange(value);\n }\n this._markForCheck();\n }\n }\n\n /** @hidden */\n private _markForCheck(): void {\n this.markForCheck.emit();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CvaDirective } from './cva/cva.directive';\n\n@NgModule({\n imports: [CvaDirective],\n exports: [CvaDirective]\n})\nexport class FormsModule {}\n","import { ChangeDetectorRef, DestroyRef, inject, Injectable } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { CvaDirective } from './cva.directive';\n\n/**\n * Base ControlValueAccessor control class.\n * Used in conjunction with CvaDirective.\n *\n * This class performs generic change detection based on `CvaDirective` outputs.\n */\n@Injectable()\nexport class CvaControl<T> {\n /**\n * Control value accessor directive instance.\n */\n public cvaDirective = inject<CvaDirective<T>>(CvaDirective, {\n self: true,\n optional: true\n });\n\n /**\n * Change detector instance.\n */\n protected _changeDetector = inject(ChangeDetectorRef);\n\n /** @Hidden */\n protected _destroyRef = inject(DestroyRef);\n\n /** @hidden */\n listenToChanges(): void {\n this.cvaDirective?.markForCheck.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {\n this._changeDetector.detectChanges();\n });\n\n this.cvaDirective?.detectChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {\n this._changeDetector.detectChanges();\n });\n }\n}\n","import { ElementRef, QueryList } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { Nullable } from '@fundamental-ngx/cdk/utils';\nimport { Observable } from 'rxjs';\nimport { FormError } from './form-error';\nimport { FormStates } from './form-state';\n\n/**\n * FormField base class.\n *\n * This class is used to create form field components.\n *\n */\nexport abstract class FormField {\n /**\n * Register underlying form control\n */\n registerFormFieldControl: (control: FormFieldControl) => void;\n /**\n * Unregister underlying form control\n */\n unregisterFormFieldControl: (control: FormFieldControl) => void;\n\n /**\n * Set default columns layout\n */\n setDefaultColumnLayout: () => void;\n\n /** Gets field error priority state. */\n getPriorityState: () => FormStates;\n\n /** Groups errors. */\n groupErrors: () => void;\n\n /** Sets error directives from parent container */\n setErrorDirectives: (directives: QueryList<FormError>) => void;\n}\n\nexport interface FormFieldControl<T = any> {\n /**\n * Each input control has always a value. Need to make sure we keep a convention for\n * input fields\n */\n value: T | null;\n\n /**\n * Need to have a way to set placeholder to the input\n */\n placeholder: string;\n\n /**\n * Need to have a way to set Mandatory to the input field\n */\n required: boolean;\n\n /**\n * Sets id from FF to Input\n */\n id: string;\n\n /**\n * This should be coming from Parent.\n */\n editable: boolean;\n\n /**\n * The height of the extra content at the bottom of the form control,\n * which should not affect the alignment of form control and it's label\n */\n extraContentHeightPx?: number;\n\n /**\n *\n * Form Field listen for all the changes happening inside the input\n */\n stateChanges: Observable<void>;\n\n /**\n * Each input should inject its own ngControl and we should retrieve it\n */\n ngControl: NgControl | null;\n\n /** Whether the control is disabled. */\n disabled: boolean;\n\n /**\n * Keeps track if the form element is in focus\n */\n focused: boolean;\n\n /** Whether control has errors */\n controlInvalid: boolean;\n\n /** Corresponding element reference. */\n elementRef: ElementRef;\n\n /** Form field instance. */\n formField: Nullable<FormField>;\n\n /** Method for focusing on the element */\n focus(event?: MouseEvent): void;\n\n /**\n * Handles even when we click on parent container which is the FormField Wrapping this\n * control\n */\n onContainerClick(event: MouseEvent): void;\n}\n","/**\n * Interface SelectItem is used to deal with complex object in order to be able to format\n * custom label that is shown in the options.\n *\n * Used in various controls: Select, RadioGroup, CheckboxGroup, Combobox\n */\nexport interface SelectItem<T = any> {\n /**\n * Item text shown in the popup\n */\n label: string;\n\n /**\n * References to the object instance\n */\n value: T;\n disabled?: boolean;\n\n icon?: string;\n /**\n * Trigger values is a text for selected item\n */\n triggerValue?: string;\n\n isGroup?: boolean;\n secondaryText?: string;\n children?: SelectItem[];\n}\n\nexport interface OptionItem<T = any> {\n /** Item text */\n label: string;\n\n /**\n * References to the object instance\n */\n value: T;\n id?: string;\n isGroup?: boolean;\n secondaryText?: string;\n children?: OptionItem[];\n}\n\nexport interface SelectableOptionItem<T = any> extends OptionItem<T> {\n selected?: boolean;\n children?: SelectableOptionItem[];\n}\n\n/** @hidden */\nexport function isSelectableItem(item: SelectItem | any): item is SelectItem {\n return (\n item &&\n item.label !== undefined &&\n item.value !== undefined &&\n Object.prototype.hasOwnProperty.call(item, 'selected')\n );\n}\n\n/** @hidden */\nexport function isSelectItem(item: SelectItem | any): item is SelectItem {\n return item && item.label !== undefined && item.value !== undefined;\n}\n\nexport const isOptionItem = isSelectItem;\nexport const isSelectableOptionItem = isSelectableItem;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa;;ACElF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAa,UAAU,CAAC;AAEhD;AACM,SAAU,mBAAmB,CAAC,KAAU,EAAA;AAC1C,IAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;AAC9B;;MCJa,qBAAqB,GAAG,IAAI,cAAc,CAAmB,oBAAoB;;MCAjF,aAAa,GAAG,IAAI,cAAc,CAAY,aAAa;;ACwBxE,IAAI,QAAQ,GAAG,CAAC;MAMH,YAAY,CAAA;AAOrB;;;;;AAKG;IACH,IACI,KAAK,CAAC,KAA2B,EAAA;QACjC,IAAI,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE;AACtC,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;;aACpB,IAAI,SAAS,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ACM,SAAU,gBAAgB,CAAC,IAAsB,EAAA;AACnD,IAAA,QACI,IAAI;QACJ,IAAI,CAAC,KAAK,KAAK,SAAS;QACxB,IAAI,CAAC,KAAK,KAAK,SAAS;AACxB,QAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;AAE9D;AAEA;AACM,SAAU,YAAY,CAAC,IAAsB,EAAA;AAC/C,IAAA,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;AACvE;AAEO,MAAM,YAAY,GAAG;AACrB,MAAM,sBAAsB,GAAG;;AChEtC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"fundamental-ngx-cdk-forms.mjs","sources":["../../../../libs/cdk/forms/models/form-state.ts","../../../../libs/cdk/forms/helpers/state.ts","../../../../libs/cdk/forms/tokens/form-field-control.token.ts","../../../../libs/cdk/forms/tokens/form-field.token.ts","../../../../libs/cdk/forms/cva/cva.directive.ts","../../../../libs/cdk/forms/forms.module.ts","../../../../libs/cdk/forms/cva/cva-control.class.ts","../../../../libs/cdk/forms/models/form-field.ts","../../../../libs/cdk/forms/models/select-item.ts","../../../../libs/cdk/forms/fundamental-ngx-cdk-forms.ts"],"sourcesContent":["export const formStates = ['success', 'error', 'warning', 'default', 'information'] as const;\n\nexport type FormStates = (typeof formStates)[number];\n","import { formStates, FormStates } from '../models/form-state';\n\nconst stateSet = new Set<FormStates>(formStates);\n\n/** Checks if the given state is a valid control state. */\nexport function isValidControlState(value: any): value is FormStates {\n return stateSet.has(value);\n}\n","import { InjectionToken } from '@angular/core';\nimport { FormFieldControl } from '../models/form-field';\n\nexport const FD_FORM_FIELD_CONTROL = new InjectionToken<FormFieldControl>('FdFormFieldControl');\n","import { InjectionToken } from '@angular/core';\nimport { FormField } from '../models/form-field';\n\nexport const FD_FORM_FIELD = new InjectionToken<FormField>('FdFormField');\n","import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n AfterViewInit,\n Directive,\n DoCheck,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewChild,\n computed,\n inject,\n isDevMode,\n signal\n} from '@angular/core';\nimport { ControlContainer, ControlValueAccessor, FormControl, NgControl, NgForm } from '@angular/forms';\nimport { HasElementRef, Nullable } from '@fundamental-ngx/cdk/utils';\nimport { Subject, Subscription } from 'rxjs';\nimport { isValidControlState } from '../helpers/state';\nimport { BaseCVA } from '../models/cva';\nimport { FormField, FormFieldControl } from '../models/form-field';\nimport { FormStates } from '../models/form-state';\nimport { FD_FORM_FIELD_CONTROL } from '../tokens/form-field-control.token';\nimport { FD_FORM_FIELD } from '../tokens/form-field.token';\n\nlet randomId = 0;\n\n@Directive({\n selector: '[fdkCva]',\n standalone: true\n})\nexport class CvaDirective<T = any>\n implements HasElementRef, BaseCVA, FormFieldControl, OnInit, DoCheck, AfterViewInit, OnDestroy, ControlValueAccessor\n{\n /** Input placeholder */\n @Input()\n placeholder: string;\n\n /** Input type */\n @Input()\n type: string;\n\n /**\n * The state of the form control - applies css classes.\n * Can be 'success', 'error', 'warning', 'default', 'information'.\n *\n * @default 'default'\n */\n @Input()\n set state(state: Nullable<FormStates>) {\n if (!state || isValidControlState(state)) {\n this._state$.set(state);\n } else if (isDevMode()) {\n console.warn(`Provided value \"${state}\" is not a valid option for FormStates type`);\n }\n }\n get state(): FormStates {\n return this.normalizedState$();\n }\n\n /** Holds the message with respect to state */\n @Input()\n stateMessage: Nullable<string>;\n\n /** Whether the input is disabled */\n @Input()\n set disabled(value: boolean) {\n this.setDisabledState(value);\n }\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n\n /**\n * readOnly Value to Mark component read only\n */\n @Input()\n readonly: boolean;\n\n /** Binds to control aria-labelledBy attribute */\n @Input()\n ariaLabelledBy: Nullable<string>;\n\n /** Sets control aria-label attribute value */\n @Input()\n ariaLabel: Nullable<string>;\n\n /**\n * Tell the component if we are in editing mode.\n */\n @Input()\n set editable(value: BooleanInput) {\n const newVal = coerceBooleanProperty(value);\n if (this._editable !== newVal) {\n this._editable = newVal;\n this._markForCheck();\n this.stateChanges.next('editable');\n }\n }\n get editable(): boolean {\n return this._editable;\n }\n\n /**\n * Name of the control.\n */\n @Input()\n name: string;\n\n /**\n * Emits when change detection is needed.\n */\n @Output()\n detectChanges = new EventEmitter<void>();\n\n /**\n * Emits when mark for changes detection is needed.\n */\n @Output()\n markForCheck = new EventEmitter<void>();\n\n /**\n * Reference to internal Input element\n */\n @ViewChild('inputElementRef', { static: true, read: ElementRef })\n protected _elementRef: ElementRef;\n\n /** @hidden */\n value: T;\n\n /** set when input field is mandatory form field */\n required: boolean;\n\n /**\n * See @FormFieldControl\n */\n focused = false;\n\n /** Whether control has errors */\n get controlInvalid(): boolean {\n return this._controlInvalid$();\n }\n\n /**\n * See @FormFieldControl\n */\n readonly stateChanges: Subject<any> = new Subject<any>();\n\n /** @hidden */\n readonly formField: FormField | null = inject(FD_FORM_FIELD, {\n skipSelf: true,\n optional: true\n });\n\n /**\n * NgControl instance.\n */\n readonly ngControl = inject(NgControl, {\n optional: true,\n host: true\n });\n\n /**\n * Form container instance. Usually ngForm or FormGroup directives.\n */\n readonly controlContainer = inject(ControlContainer, {\n optional: true,\n skipSelf: true\n });\n\n /**\n * Separate NgForm instance. For cases when formGroup is used with the form itself.\n */\n readonly ngForm = inject(NgForm, {\n optional: true,\n skipSelf: true\n });\n\n /** @hidden */\n readonly normalizedState$ = computed(() => {\n const storedState = this._state$();\n if (storedState) {\n return storedState;\n }\n\n if (!this._controlInvalid$()) {\n return 'default';\n }\n\n return this.formField?.getPriorityState() || 'default';\n });\n\n /** @hidden */\n protected _subscriptions = new Subscription();\n\n /**\n * A private property to hold the ElementRef which might be null\n */\n private _elementRefOrNull: ElementRef | null = inject(ElementRef, { optional: true });\n\n /**\n * Element reference.\n */\n get elementRef(): ElementRef {\n // Return a fallback ElementRef if _elementRefOrNull is null\n return this._elementRefOrNull || (this._elementRef as ElementRef);\n }\n\n /** @hidden */\n private _defaultId = `fd-input-id-${randomId++}`;\n\n /** ID for the Element */\n // eslint-disable-next-line @typescript-eslint/member-ordering\n @Input()\n id: string = this._defaultId;\n\n /** @hidden */\n private _disabled: boolean;\n /** @hidden */\n private _editable = true;\n\n /**\n * @hidden\n */\n private readonly _controlInvalid$ = signal(false);\n\n /** @hidden */\n private readonly _parentControl = inject(FD_FORM_FIELD_CONTROL, {\n skipSelf: true,\n optional: true\n });\n\n /**\n * @hidden\n * The state of the form control - applies css classes.\n * Can be `success`, `error`, `warning`, `information` or 'default'\n */\n private readonly _state$ = signal<Nullable<FormStates>>(null);\n\n /** @hidden */\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /** @hidden */\n onChange: (value: any) => void = () => {};\n\n /** @hidden */\n onTouched = (): void => {};\n\n /** @hidden */\n ngOnInit(): void {\n // There may be cases when one form control is used as a base to build another form control.\n if (!this._parentControl) {\n this.formField?.registerFormFieldControl(this);\n }\n }\n\n /**\n * Re-validate and emit event to parent container on every CD cycle as they are some errors\n * that we can't subscribe to.\n */\n ngDoCheck(): void {\n if (this.ngControl) {\n this.updateErrorState();\n }\n }\n\n /** @hidden */\n ngAfterViewInit(): void {\n if (this.ngControl) {\n this._subscriptions.add(\n this.ngControl.statusChanges?.subscribe(() => {\n this._markForCheck();\n })\n );\n }\n\n const labelAndHelpId = `fdp-form-label-content-${this.id}`;\n // if not specified, associate label and inline help ids with the input,\n // else add these ids to the specified ones\n if (!this.ariaLabelledBy) {\n this.ariaLabelledBy = labelAndHelpId;\n } else {\n this.ariaLabelledBy += ' ' + labelAndHelpId;\n }\n this._markForCheck();\n }\n\n /** @hidden */\n registerOnChange(fn: (_: any) => void): void {\n this.onChange = fn;\n }\n\n /** @hidden */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @hidden */\n ngOnDestroy(): void {\n this._subscriptions.unsubscribe();\n this.stateChanges.complete();\n this.formField?.unregisterFormFieldControl(this);\n }\n\n /** @hidden */\n setDisabledState(isDisabled: BooleanInput): void {\n const newState = coerceBooleanProperty(isDisabled);\n this._markForCheck();\n if (newState !== this._disabled) {\n this._disabled = newState;\n this.stateChanges.next('setDisabledState');\n }\n }\n\n /**\n * Method for setting the value\n * @param value\n */\n writeValue(value: T): void {\n this.value = value;\n this.stateChanges.next('writeValue');\n this._markForCheck();\n }\n\n /**\n *\n * Keeps track of element focus\n */\n _onFocusChanged(isFocused: boolean): void {\n if (isFocused !== this.focused && (!this.disabled || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next('_onFocusChanged');\n }\n\n if (!isFocused) {\n this.onTouched();\n }\n }\n\n /**\n * Handles even when we click on parent container which is the FormField Wrapping this\n * control\n */\n onContainerClick(event: MouseEvent): void {\n this.focus(event);\n }\n\n /**\n * In most of the cases when working with input element directly you should be just find to assign\n * variable to this element\n *\n * ```\n * <input #inputElementRef fd-form-control ...>\n * ```\n *\n * and this default behavior used. For other cases implement focus.\n *\n */\n focus(event?: MouseEvent): void {\n if (this._elementRef && !this.focused) {\n this._elementRef.nativeElement.focus(event);\n }\n }\n\n /**\n * Need re-validates errors on every CD iteration to make sure we are also\n * covering non-control errors, errors that happens outside of this control\n */\n updateErrorState(): void {\n const parent = this.ngForm;\n const parentControlContainer = this.controlContainer;\n const control = this.ngControl ? (this.ngControl.control as FormControl) : null;\n const newStatusIsError = !!(\n control?.invalid &&\n (control.dirty || control.touched || parent?.submitted || (parentControlContainer as any)?.submitted)\n );\n\n if (newStatusIsError !== this._controlInvalid$()) {\n this._controlInvalid$.set(newStatusIsError);\n this.stateChanges.next('updateErrorState');\n this._markForCheck();\n }\n }\n\n /**\n * Used to change the value of a control.\n * @param value the value to be applied\n * @param emitOnChange whether to emit \"onChange\" event.\n * Should be \"false\", if the change is made programmatically (internally) by the control, \"true\" otherwise\n */\n setValue(value: T, emitOnChange = true): void {\n let coercedValue: any = value;\n\n if (this.type === 'number') {\n coercedValue = value === '' || value === null || value === undefined ? null : Number(value);\n }\n\n if (coercedValue !== this.value) {\n this.writeValue(coercedValue);\n if (emitOnChange) {\n this.onChange(coercedValue);\n }\n this._markForCheck();\n }\n }\n\n /** @hidden */\n private _markForCheck(): void {\n this.markForCheck.emit();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CvaDirective } from './cva/cva.directive';\n\n@NgModule({\n imports: [CvaDirective],\n exports: [CvaDirective]\n})\nexport class FormsModule {}\n","import { ChangeDetectorRef, DestroyRef, inject, Injectable } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { CvaDirective } from './cva.directive';\n\n/**\n * Base ControlValueAccessor control class.\n * Used in conjunction with CvaDirective.\n *\n * This class performs generic change detection based on `CvaDirective` outputs.\n */\n@Injectable()\nexport class CvaControl<T> {\n /**\n * Control value accessor directive instance.\n */\n public cvaDirective = inject<CvaDirective<T>>(CvaDirective, {\n self: true,\n optional: true\n });\n\n /**\n * Change detector instance.\n */\n protected _changeDetector = inject(ChangeDetectorRef);\n\n /** @Hidden */\n protected _destroyRef = inject(DestroyRef);\n\n /** @hidden */\n listenToChanges(): void {\n this.cvaDirective?.markForCheck.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {\n this._changeDetector.detectChanges();\n });\n\n this.cvaDirective?.detectChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {\n this._changeDetector.detectChanges();\n });\n }\n}\n","import { ElementRef, QueryList } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { Nullable } from '@fundamental-ngx/cdk/utils';\nimport { Observable } from 'rxjs';\nimport { FormError } from './form-error';\nimport { FormStates } from './form-state';\n\n/**\n * FormField base class.\n *\n * This class is used to create form field components.\n *\n */\nexport abstract class FormField {\n /**\n * Register underlying form control\n */\n registerFormFieldControl: (control: FormFieldControl) => void;\n /**\n * Unregister underlying form control\n */\n unregisterFormFieldControl: (control: FormFieldControl) => void;\n\n /**\n * Set default columns layout\n */\n setDefaultColumnLayout: () => void;\n\n /** Gets field error priority state. */\n getPriorityState: () => FormStates;\n\n /** Groups errors. */\n groupErrors: () => void;\n\n /** Sets error directives from parent container */\n setErrorDirectives: (directives: QueryList<FormError>) => void;\n}\n\nexport interface FormFieldControl<T = any> {\n /**\n * Each input control has always a value. Need to make sure we keep a convention for\n * input fields\n */\n value: T | null;\n\n /**\n * Need to have a way to set placeholder to the input\n */\n placeholder: string;\n\n /**\n * Need to have a way to set Mandatory to the input field\n */\n required: boolean;\n\n /**\n * Sets id from FF to Input\n */\n id: string;\n\n /**\n * This should be coming from Parent.\n */\n editable: boolean;\n\n /**\n * The height of the extra content at the bottom of the form control,\n * which should not affect the alignment of form control and it's label\n */\n extraContentHeightPx?: number;\n\n /**\n *\n * Form Field listen for all the changes happening inside the input\n */\n stateChanges: Observable<void>;\n\n /**\n * Each input should inject its own ngControl and we should retrieve it\n */\n ngControl: NgControl | null;\n\n /** Whether the control is disabled. */\n disabled: boolean;\n\n /**\n * Keeps track if the form element is in focus\n */\n focused: boolean;\n\n /** Whether control has errors */\n controlInvalid: boolean;\n\n /** Corresponding element reference. */\n elementRef: ElementRef;\n\n /** Form field instance. */\n formField: Nullable<FormField>;\n\n /** Method for focusing on the element */\n focus(event?: MouseEvent): void;\n\n /**\n * Handles even when we click on parent container which is the FormField Wrapping this\n * control\n */\n onContainerClick(event: MouseEvent): void;\n}\n","/**\n * Interface SelectItem is used to deal with complex object in order to be able to format\n * custom label that is shown in the options.\n *\n * Used in various controls: Select, RadioGroup, CheckboxGroup, Combobox\n */\nexport interface SelectItem<T = any> {\n /**\n * Item text shown in the popup\n */\n label: string;\n\n /**\n * References to the object instance\n */\n value: T;\n disabled?: boolean;\n\n icon?: string;\n /**\n * Trigger values is a text for selected item\n */\n triggerValue?: string;\n\n isGroup?: boolean;\n secondaryText?: string;\n children?: SelectItem[];\n}\n\nexport interface OptionItem<T = any> {\n /** Item text */\n label: string;\n\n /**\n * References to the object instance\n */\n value: T;\n id?: string;\n isGroup?: boolean;\n secondaryText?: string;\n children?: OptionItem[];\n}\n\nexport interface SelectableOptionItem<T = any> extends OptionItem<T> {\n selected?: boolean;\n children?: SelectableOptionItem[];\n}\n\n/** @hidden */\nexport function isSelectableItem(item: SelectItem | any): item is SelectItem {\n return (\n item &&\n item.label !== undefined &&\n item.value !== undefined &&\n Object.prototype.hasOwnProperty.call(item, 'selected')\n );\n}\n\n/** @hidden */\nexport function isSelectItem(item: SelectItem | any): item is SelectItem {\n return item && item.label !== undefined && item.value !== undefined;\n}\n\nexport const isOptionItem = isSelectItem;\nexport const isSelectableOptionItem = isSelectableItem;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa;;ACElF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAa,UAAU,CAAC;AAEhD;AACM,SAAU,mBAAmB,CAAC,KAAU,EAAA;AAC1C,IAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;AAC9B;;MCJa,qBAAqB,GAAG,IAAI,cAAc,CAAmB,oBAAoB;;MCAjF,aAAa,GAAG,IAAI,cAAc,CAAY,aAAa;;ACwBxE,IAAI,QAAQ,GAAG,CAAC;MAMH,YAAY,CAAA;AAWrB;;;;;AAKG;IACH,IACI,KAAK,CAAC,KAA2B,EAAA;QACjC,IAAI,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE;AACtC,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;;aACpB,IAAI,SAAS,EAAE,EAAE;AACpB,YAAA,OAAO,CAAC,IAAI,CAAC,mBAAmB,KAAK,CAAA,2CAAA,CAA6C,CAAC;;;AAG3F,IAAA,IAAI,KAAK,GAAA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HAAV,UAAU,EAAA,CAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBADtB;;;ACHD;;;;;AAKG;MACmB,SAAS,CAAA;AAuB9B;;ACYD;AACM,SAAU,gBAAgB,CAAC,IAAsB,EAAA;AACnD,IAAA,QACI,IAAI;QACJ,IAAI,CAAC,KAAK,KAAK,SAAS;QACxB,IAAI,CAAC,KAAK,KAAK,SAAS;AACxB,QAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;AAE9D;AAEA;AACM,SAAU,YAAY,CAAC,IAAsB,EAAA;AAC/C,IAAA,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;AACvE;AAEO,MAAM,YAAY,GAAG;AACrB,MAAM,sBAAsB,GAAG;;AChEtC;;AAEG;;;;"}
|
|
@@ -325,7 +325,6 @@ function uuidv4() {
|
|
|
325
325
|
|
|
326
326
|
class AutoCompleteDirective {
|
|
327
327
|
/** @hidden */
|
|
328
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
329
328
|
constructor() {
|
|
330
329
|
/** Whether the auto complete directive should be enabled */
|
|
331
330
|
this.enable = true;
|
|
@@ -384,6 +383,15 @@ class AutoCompleteDirective {
|
|
|
384
383
|
this._sendCompleteEvent(false);
|
|
385
384
|
}
|
|
386
385
|
else if (!this._isControlKey(event) && this.inputText) {
|
|
386
|
+
const hasSelection = this._elementRef.nativeElement.selectionStart !== this._elementRef.nativeElement.selectionEnd;
|
|
387
|
+
if (hasSelection) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const currentNativeValue = this._elementRef.nativeElement.value;
|
|
391
|
+
if (this.inputText.length > currentNativeValue.length + 1) {
|
|
392
|
+
this.inputText = currentNativeValue;
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
387
395
|
if (!this._triggerTypeAhead()) {
|
|
388
396
|
return;
|
|
389
397
|
}
|