UNPKG

ngx-sfc-inputs

Version:

Angular inputs library for SFC project

1 lines 450 kB
{"version":3,"file":"ngx-sfc-inputs.mjs","sources":["../../../projects/ngx-sfc-inputs/src/lib/constants/input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/directives/reference/input-reference.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/enums/input-ui.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/base/base-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/enums/common-validator.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/_validators.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/common.validators.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/directives/equal-or-include-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/directives/max-array-length-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/directives/min-array-length-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/directives/match-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/directives/compare-than-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/common/index.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/file/enums/file-validator.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/file/file.validators.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/file/directives/file-extensions-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/file/directives/file-max-size-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/file/directives/file-min-size-validator.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/file/index.ts","../../../projects/ngx-sfc-inputs/src/lib/components/base/text/base-text-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/text/text-type.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/text/text-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/text/text-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/textarea/text-area-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/textarea/text-area-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/file/file-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/file/base-file-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/file/input/file-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/file/input/file-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/file/inline/inline-file-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/file/inline/inline-file-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/base/logical/logical-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/checkbox/checkbox-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/checkbox/checkbox-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/toggle/toggle-type.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/toggle/toggle-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/toggle/toggle-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/constants/validation.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/tags/tags-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/tags/parts/chip/tags-chip.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/tags/parts/chip/tags-chip.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/tags/tags-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/tags/tags-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/number/parts/spinner/number-spinner.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/number/parts/spinner/number-spinner.component.html","../../../projects/ngx-sfc-inputs/src/lib/directives/number/input-number.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/components/number/number-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/number/number-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/stars/stars-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/stars/stars.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/stars/parts/star/star.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/stars/parts/star/star.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/stars/stars-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/stars/stars-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/constants/datetime-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/constants/formats.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/service/value/datetime-value.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/service/value/datetime-value.service.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/service/view/enums/datetime-view.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/service/view/enums/datetime-state.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/datetime-input-view.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/service/view/datetime-view.service.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/calendar/datetime-calendar.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/calendar/datetime-calendar.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/clock/datetime-clock.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/clock/datetime-clock.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/year/datetime-year.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/year/datetime-year.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/year/datetime-year.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/modal/datetime-modal.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/parts/modal/datetime-modal.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/datetime-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/datetime/datetime-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/image/image-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/image-input-type.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/service/image.service.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/parts/editor/image-editor.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/parts/editor/cropper-drag-mode.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/parts/editor/image-editor.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/parts/editor/image-editor.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/image/image-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/image/image-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/range/enums/range-input-type.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/range/range-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/range/enums/range-limit-input-state.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/range/base/range-base.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/range/range-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/range/range-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/range/vertical/range-input-vertical.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/range/vertical/range-input-vertical.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/radio/radio-input.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/radio/radio-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/radio/radio-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/autocomplete/autocomplete-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/base/data/data-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/autocomplete/parts/item/autocomplete-item.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/autocomplete/parts/item/autocomplete-item.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/autocomplete/autocomplete-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/autocomplete/autocomplete-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/select/select-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/select/parts/item/select-item.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/select/parts/item/select-item.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/select/parts/item/select-item.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/select/select-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/select/select-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/bubbles/parts/bubble/bubble.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/bubbles/parts/bubble/bubble.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/bubbles/bubbles-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/bubbles/bubbles-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/carousel/directives/carousel-input-slide.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/components/carousel/carousel-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/carousel/carousel-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/utils/form.utils.ts","../../../projects/ngx-sfc-inputs/src/lib/components/submit-button/submit-button.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/submit-button/submit-button.component.html","../../../projects/ngx-sfc-inputs/src/lib/components/avatar/avatar-input.constants.ts","../../../projects/ngx-sfc-inputs/src/lib/components/avatar/avatar-input-template.enum.ts","../../../projects/ngx-sfc-inputs/src/lib/components/avatar/avatar-input.component.ts","../../../projects/ngx-sfc-inputs/src/lib/components/avatar/avatar-input.component.html","../../../projects/ngx-sfc-inputs/src/lib/directives/focus/input-focus.directive.ts","../../../projects/ngx-sfc-inputs/src/lib/ngx-sfc-inputs.module.ts","../../../projects/ngx-sfc-inputs/src/lib/validators/ngx-sfc-inputs-validation.module.ts","../../../projects/ngx-sfc-inputs/src/public-api.ts","../../../projects/ngx-sfc-inputs/src/ngx-sfc-inputs.ts"],"sourcesContent":["export class InputConstants {\r\n static ID_PREFIX = 'sfc-';\r\n static INPUT_CLASS = 'sfc-input';\r\n static DEFAULT_ERROR_MESSAGE = 'Invalid value';\r\n\r\n static ENTER_KEY = \"Enter\";\r\n static BACKSPACE_KEY = \"Backspace\";\r\n static DELETE_KEY = \"Delete\";\r\n}","import { Directive, HostBinding, HostListener, Optional } from '@angular/core';\r\nimport { NgControl, ValidationErrors } from '@angular/forms';\r\nimport { isDefined, isNullOrEmptyString } from 'ngx-sfc-common';\r\nimport { InputConstants } from '../../constants/input.constants';\r\n\r\n@Directive({\r\n selector: '[sfcInput]'\r\n})\r\nexport class InputReferenceDirective {\r\n\r\n isFocused: boolean = false;\r\n\r\n @HostBinding('class')\r\n class = InputConstants.INPUT_CLASS;\r\n\r\n constructor(@Optional() private ngControl: NgControl) { }\r\n\r\n get value(): any {\r\n return this.ngControl ? this.ngControl.value : null;\r\n }\r\n\r\n get hasValue(): boolean {\r\n return this.ngControl && !isNullOrEmptyString(this.value);\r\n }\r\n\r\n get isInvalid(): boolean {\r\n if (this.isDirty) {\r\n return this.ngControl.invalid || false;\r\n }\r\n\r\n return this.hasValue && (this.ngControl.invalid || false);\r\n }\r\n\r\n get isValid(): boolean {\r\n return this.ngControl.valid || false;\r\n }\r\n\r\n get isDirty(): boolean {\r\n return this.ngControl?.dirty || false;\r\n }\r\n\r\n get errors(): ValidationErrors | null {\r\n if (this.isInvalid && isDefined(this.ngControl.errors)) {\r\n return this.ngControl.errors;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n @HostListener('focus')\r\n onFocus(): void {\r\n this.isFocused = true;\r\n }\r\n\r\n @HostListener('blur')\r\n onBlur(): void {\r\n this.isFocused = false;\r\n }\r\n}\r\n","export enum InputUIClass {\r\n HasValue = 'has-value',\r\n HasIcon = 'has-icon'\r\n};","import { ChangeDetectorRef, AfterViewInit, Input, ViewChild, HostBinding, ElementRef, Renderer2, Directive, Optional, HostListener, Output, EventEmitter } from '@angular/core';\r\nimport { NgControl, ControlValueAccessor, ValidationErrors } from '@angular/forms';\r\nimport { IconDefinition } from '@fortawesome/free-solid-svg-icons';\r\nimport { addPropertyToObject, any, CommonConstants, ComponentSizeDirective, isDefined, isNullOrEmptyString, removePropertyFromObject, UIClass } from 'ngx-sfc-common';\r\nimport { InputReferenceDirective } from '../../directives/reference/input-reference.directive';\r\nimport { InputUIClass } from '../../enums/input-ui.enum';\r\nimport { InputConstants } from '../../constants/input.constants';\r\nimport { IValidationModel } from '../../models/validation.model';\r\nimport { IInnerValidation } from '../../validators/inner-validation.model';\r\nimport { Observable, Subject } from 'rxjs';\r\n\r\n@Directive()\r\nexport abstract class BaseInputComponent<T> implements ControlValueAccessor, AfterViewInit {\r\n\r\n // INPUTS\r\n\r\n @Input()\r\n id!: string;\r\n\r\n @Input()\r\n label!: string;\r\n\r\n @Input()\r\n @HostBinding(`class.${UIClass.Disabled}`)\r\n disabled: boolean = false;\r\n\r\n @Input()\r\n placeholder: string = CommonConstants.EMPTY_STRING;\r\n\r\n @Input()\r\n icon?: IconDefinition | null;\r\n\r\n /*\r\n * Helper text under input\r\n */\r\n @Input()\r\n helperText!: string;\r\n\r\n /*\r\n * Validation messages (key - validation rule, value - error message)\r\n */\r\n @Input()\r\n validations: IValidationModel = {};\r\n\r\n @Input()\r\n @HostBinding(`class.${UIClass.Bordered}`)\r\n bordered: boolean = false;\r\n\r\n @Output()\r\n changeValue: EventEmitter<T | null> = new EventEmitter<T | null>();\r\n // END INPUTS\r\n\r\n // PROPERTIES\r\n\r\n get inputId(): string {\r\n return `${InputConstants.ID_PREFIX}${this.id}`;\r\n }\r\n\r\n _value: T | null = null;\r\n set value(value: T | null) {\r\n this._value = value;\r\n }\r\n get value(): T | null {\r\n return this._value;\r\n }\r\n\r\n get inputValue(): string {\r\n return this.inputElementRef?.nativeElement.value;\r\n }\r\n\r\n get labelClass(): string {\r\n return this.placeholder || this.isFocused || this.value ? UIClass.Active : CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n get placeholderValue(): string {\r\n return this.placeholder && !this.isFocused ? this.placeholder : CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n /*\r\n * Return helper text if input has NOT error, \r\n * otherwise return first error message\r\n */\r\n get helperTextValue(): string {\r\n return this.input?.isInvalid || !this.isValid ? this.errorMessage : this.helperText;\r\n }\r\n\r\n get sizeProportion(): number {\r\n return this.componentSize?.proportion || 1;\r\n }\r\n\r\n /**\r\n * input componnent validation flag\r\n */\r\n get isValid() {\r\n return !Object.keys(this.validationErrors).length;\r\n }\r\n\r\n @HostBinding(`class.${UIClass.InnerInvalid}`)\r\n get isInnerInvalid() {\r\n return Object.keys(this.innerErrors).length > 0;\r\n }\r\n\r\n get validationClass() {\r\n return this.isValid ? UIClass.Valid : UIClass.Invalid;\r\n }\r\n\r\n /**\r\n * input componnent validation errors\r\n */\r\n innerErrors: ValidationErrors = {};\r\n\r\n innerValidations: IInnerValidation[] = [];\r\n\r\n /*\r\n * Get first error message from custom validation error mappings (or default)\r\n */\r\n private get errorMessage() {\r\n return this.input ? this.validationMessages[0] || InputConstants.DEFAULT_ERROR_MESSAGE : CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n private get validationMessages(): string[] {\r\n const messages: string[] = [];\r\n\r\n Object.keys(this.validations).forEach(key => {\r\n if (this.validationErrors[key]) {\r\n messages.push(this.validations[key]);\r\n }\r\n });\r\n\r\n return messages;\r\n }\r\n\r\n /*\r\n * Return all input validation errors (ngControl errors)\r\n */\r\n get validationErrors() {\r\n return this.input\r\n ? isDefined(this.input.errors) ? { ...this.input.errors, ...this.innerErrors } : this.innerErrors\r\n : this.innerErrors\r\n }\r\n\r\n // END PROPERTIES\r\n\r\n // CLASSES\r\n\r\n @HostBinding(`class.${UIClass.Focus}`)\r\n get isFocused() {\r\n return this.input ? this.input.isFocused : false;\r\n }\r\n\r\n @HostBinding(`class.${InputUIClass.HasIcon}`)\r\n protected get hasIcon() {\r\n return isDefined(this.icon);\r\n }\r\n\r\n @HostBinding(`class.${InputUIClass.HasValue}`)\r\n protected get hasValue() {\r\n return !isNullOrEmptyString(this.value as any);\r\n }\r\n\r\n // END CLASSES\r\n\r\n public isHovered: boolean = false;\r\n\r\n @HostListener('mouseenter')\r\n onMouseEnter() { this.isHovered = true; }\r\n\r\n @HostListener('mouseleave')\r\n onMouseLeave() { this.isHovered = false; }\r\n\r\n @ViewChild(InputReferenceDirective, { static: false })\r\n input!: InputReferenceDirective;\r\n\r\n @ViewChild(InputReferenceDirective, { static: false, read: ElementRef })\r\n inputElementRef!: ElementRef;\r\n\r\n @ViewChild('iconRef', { static: false, read: ElementRef })\r\n iconElementRef!: ElementRef;\r\n\r\n private valueSubject: Subject<T> = new Subject<T>();\r\n\r\n public value$: Observable<T> = this.valueSubject.asObservable();\r\n\r\n constructor(\r\n @Optional() protected ngControl: NgControl,\r\n @Optional() protected componentSize: ComponentSizeDirective,\r\n protected changeDetector: ChangeDetectorRef,\r\n protected renderer: Renderer2,\r\n protected elementRef: ElementRef) {\r\n if (this.ngControl)\r\n this.ngControl.valueAccessor = this;\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n if (this.iconElementRef)\r\n this.setOnFocusEvent(this.iconElementRef.nativeElement);\r\n\r\n this.changeDetector.detectChanges();\r\n }\r\n\r\n // METHODS \r\n\r\n setOnFocusEvent(element: ElementRef) {\r\n if (element) {\r\n this.renderer.listen(element, 'click', () => this.inputElementRef.nativeElement.focus());\r\n }\r\n }\r\n\r\n checkeInnerValidation(parameters: any) {\r\n if (any(this.innerValidations)) {\r\n this.innerValidations.forEach(validation => this.toggleInnerErrors(validation.key, validation.validate(this.value, parameters)));\r\n }\r\n }\r\n\r\n clearInnerErrors() {\r\n this.innerErrors = {};\r\n }\r\n\r\n toggleInnerErrors(validationKey: string, isValid: boolean) {\r\n if (isValid)\r\n removePropertyFromObject(this.innerErrors, validationKey);\r\n else\r\n this.innerErrors = addPropertyToObject(this.innerErrors, validationKey, true);\r\n }\r\n\r\n // END METHODS \r\n\r\n /*\r\n * Write form value to the DOM element (model => view)\r\n */\r\n writeValue(value: T): void {\r\n this.valueSubject.next(value);\r\n this.value = value;\r\n }\r\n\r\n /*\r\n * Write form disabled state to the DOM element (model => view)\r\n */\r\n setDisabledState(isDisabled: boolean): void {\r\n this.disabled = isDisabled;\r\n }\r\n\r\n /*\r\n * Update form when DOM element value changes (view => model)\r\n */\r\n registerOnChange(fn: any): void {\r\n // Store the provided function as an internal method.\r\n this.propagateChange = fn;\r\n }\r\n\r\n /*\r\n * Update form when DOM element is blurred (view => model)\r\n */\r\n registerOnTouched(fn: any): void {\r\n // Store the provided function as an internal method.\r\n this.propagateBlur = fn;\r\n }\r\n\r\n onChange(value: T | null) {\r\n this.value = value;\r\n this.propagateChange(this.value);\r\n this.changeValue.emit(this.value);\r\n }\r\n\r\n onBlur() {\r\n this.propagateBlur();\r\n }\r\n\r\n private propagateChange = (_: any) => { };\r\n\r\n private propagateBlur = () => { };\r\n}","export enum CommonValidator {\r\n Required = 'required',\r\n MaxLength = 'maxlength',\r\n MinLength = 'minlength',\r\n Format = 'sfc-format',\r\n Empty = 'sfc-empty',\r\n Duplicate = 'sfc-duplicate',\r\n Exist = 'sfc-exist',\r\n Data = 'sfc-data',\r\n TagsLength = 'sfc-tags-length',\r\n MaxArrayLength = 'sfc-max-array-length',\r\n MinArrayLength = 'sfc-max-array-length'\r\n}","import { AbstractControl, ValidatorFn } from \"@angular/forms\";\r\nimport { isDefined } from \"ngx-sfc-common\";\r\n\r\nexport function validation(validatorFn: (arg: any) => null | object): ValidatorFn {\r\n const validator: ValidatorFn = (formControl: AbstractControl) => {\r\n return isDefined(formControl) ? validatorFn(formControl.value) : null;\r\n };\r\n\r\n return validator;\r\n}","import { AbstractControl, ValidationErrors, ValidatorFn } from \"@angular/forms\";\r\nimport { isDefined, Compare } from \"ngx-sfc-common\";\r\nimport { validation } from \"../_validators\";\r\n\r\nexport function equalOrInclude(includes: any | Array<any>): ValidatorFn {\r\n const invalidResult = { 'sfc-equal-or-include': true };\r\n\r\n const validatorFn: ValidatorFn = (value: any) => {\r\n if (!isDefined(value))\r\n return null;\r\n\r\n if (Array.isArray(includes)) {\r\n if (includes.length > 0) {\r\n if (Array.isArray(value)) {\r\n for (let index = 0; index < value.length; index++) {\r\n const element = value[index],\r\n result = equalOrIncludeArrayOfValues(element, includes);\r\n\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n } else {\r\n return equalOrIncludeArrayOfValues(value, includes);\r\n }\r\n }\r\n } else {\r\n if (Array.isArray(value)) {\r\n for (let index = 0; index < value.length; index++) {\r\n const element = value[index];\r\n\r\n if (element instanceof Object) {\r\n return JSON.stringify(includes) !== JSON.stringify(element) ? invalidResult : null;\r\n } else {\r\n return value.includes(includes) ? null : invalidResult;\r\n }\r\n }\r\n } else {\r\n if (value instanceof Object) {\r\n return JSON.stringify(includes) !== JSON.stringify(value) ? invalidResult : null;\r\n } else {\r\n return value != includes ? invalidResult : null;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return validation(validatorFn);\r\n\r\n function equalOrIncludeArrayOfValues(element: any, includes: Array<any>): ValidationErrors | null {\r\n if (element instanceof Object) {\r\n let found: boolean = false;\r\n for (let index = 0; index < includes.length; index++) {\r\n const item = includes[index];\r\n if (JSON.stringify(item) === JSON.stringify(element)) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n return found ? null : invalidResult;\r\n } else {\r\n return includes.includes(element) ? null : invalidResult;\r\n }\r\n }\r\n}\r\n\r\nexport function maxArrayLength(maxLength: number): ValidatorFn {\r\n const validatorFn = (value: Array<any>) => {\r\n if (isDefined(value) && value instanceof Array) {\r\n if (value.length > maxLength) {\r\n return { 'sfc-max-array-length': { requiredLength: maxLength, actualLength: value.length, value } };\r\n }\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return validation(validatorFn);\r\n}\r\n\r\nexport function minArrayLength(minLength: number): ValidatorFn {\r\n const validatorFn = (value: Array<any>) => {\r\n if (isDefined(value) && value instanceof Array) {\r\n if (value.length < minLength) {\r\n return { 'sfc-min-array-length': { requiredLength: minLength, actualLength: value.length, value } };\r\n }\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return validation(validatorFn);\r\n}\r\n\r\nexport function match(matchTo: string, reverse?: boolean): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors | null => {\r\n if (control.parent && reverse) {\r\n const matchControl = (control.parent?.controls as any)[matchTo] as AbstractControl;\r\n\r\n if (matchControl)\r\n matchControl.updateValueAndValidity();\r\n\r\n return null;\r\n }\r\n\r\n return !!control.parent &&\r\n !!control.parent.value &&\r\n control.value === (control.parent?.controls as any)[matchTo]?.value\r\n ? null\r\n : { 'sfc-match': true };\r\n }\r\n}\r\n\r\nexport function compareThan(comparePropertyName: string, compare: Compare, reverse?: boolean): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors | null => {\r\n const comparePropertyValue: any = control.parent?.controls\r\n ? (control.parent?.controls as any)[comparePropertyName]?.value\r\n : null;\r\n\r\n if (!isDefined(comparePropertyValue))\r\n return null;\r\n\r\n if (control.parent && reverse) {\r\n const matchControl = (control.parent?.controls as any)[comparePropertyName] as AbstractControl;\r\n\r\n if (matchControl)\r\n matchControl.updateValueAndValidity();\r\n\r\n return null;\r\n }\r\n\r\n return !!control.parent &&\r\n !!control.parent.value &&\r\n comparePropertyValue &&\r\n (compare == Compare.More\r\n ? control.value > comparePropertyValue\r\n : control.value < comparePropertyValue)\r\n ? null\r\n : { 'sfc-compare-than': true };\r\n }\r\n}\r\n\r\n","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { equalOrInclude } from '../common.validators';\r\n\r\n@Directive({\r\n selector: '[sfcEqualOrInclude]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: EqualOrIncludeValidatorDirective }\r\n ]\r\n})\r\nexport class EqualOrIncludeValidatorDirective {\r\n @Input('sfcEqualOrInclude')\r\n includes: any | Array<any>;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return equalOrInclude(this.includes)(control);\r\n }\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { maxArrayLength } from '../common.validators';\r\n\r\n@Directive({\r\n selector: '[sfcMaxArrayLength]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: MaxArrayLengthValidatorDirective }\r\n ]\r\n})\r\nexport class MaxArrayLengthValidatorDirective {\r\n @Input('sfcMaxArrayLength')\r\n maxArrayLength!: number;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return maxArrayLength(this.maxArrayLength)(control);\r\n }\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { minArrayLength } from '../common.validators';\r\n\r\n@Directive({\r\n selector: '[sfcMinArrayLength]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: MinArrayLengthValidatorDirective }\r\n ]\r\n})\r\nexport class MinArrayLengthValidatorDirective {\r\n @Input('sfcMinArrayLength')\r\n minArrayLength!: number;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return minArrayLength(this.minArrayLength)(control);\r\n }\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { match } from '../common.validators';\r\n\r\n@Directive({\r\n selector: '[sfcMatch]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: MatchValidatorDirective }\r\n ]\r\n})\r\nexport class MatchValidatorDirective {\r\n @Input('sfcMatch')\r\n matchTo!: string;\r\n\r\n @Input()\r\n reverse: boolean = false;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return match(this.matchTo, this.reverse)(control);\r\n }\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { compareThan } from '../common.validators';\r\nimport { Compare } from 'ngx-sfc-common';\r\n\r\n@Directive({\r\n selector: '[sfcCompareThan]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: CompareThanValidatorDirective }\r\n ]\r\n})\r\nexport class CompareThanValidatorDirective {\r\n @Input('sfcCompareThan')\r\n comparePropertyName!: string;\r\n\r\n @Input()\r\n compare!: Compare;\r\n\r\n @Input()\r\n reverse: boolean = false;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return compareThan(this.comparePropertyName, this.compare, this.reverse)(control);\r\n }\r\n}","// enums\r\nexport { CommonValidator } from './enums';\r\n\r\n// directives\r\nexport {\r\n EqualOrIncludeValidatorDirective,\r\n CompareThanValidatorDirective,\r\n MatchValidatorDirective,\r\n MaxArrayLengthValidatorDirective,\r\n MinArrayLengthValidatorDirective\r\n} from './directives';\r\n\r\n// functions\r\nexport {\r\n compareThan,\r\n equalOrInclude,\r\n match,\r\n maxArrayLength,\r\n minArrayLength\r\n} from './common.validators';","export enum FileValidator {\r\n MaxSize = 'sfc-file-max-size',\r\n MinSize = 'sfc-file-min-size',\r\n Extension = 'sfc-file-extension'\r\n}","import { ValidatorFn } from \"@angular/forms\";\r\nimport { any, getFileExtension } from \"ngx-sfc-common\";\r\nimport { validation } from \"../_validators\";\r\nimport { FileValidator } from \"./enums/file-validator.enum\";\r\nimport { IFileExtensionValidationModel } from \"./models/file-extension-validation.model\";\r\nimport { IFileSizeValidationModel } from \"./models/file-size-validation.model\";\r\n\r\nexport function fileMaxSize(maxSize: number): ValidatorFn {\r\n const validatorFn = (file: File) => {\r\n if (file instanceof File && file.size > maxSize) {\r\n const model: IFileSizeValidationModel = { requiredSize: maxSize, actualSize: file.size, file };\r\n return { [FileValidator.MaxSize]: model };\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return validation(validatorFn);\r\n}\r\n\r\nexport function fileMinSize(minSize: number): ValidatorFn {\r\n const validatorFn = (file: File) => {\r\n if (file instanceof File && file.size < minSize) {\r\n const model: IFileSizeValidationModel = { requiredSize: minSize, actualSize: file.size, file };\r\n return { [FileValidator.MinSize]: model };\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return validation(validatorFn);\r\n}\r\n\r\nexport function fileExtensions(allowedExtensions: Array<string>): ValidatorFn {\r\n const validatorFn = (file: File) => {\r\n if (!any(allowedExtensions)) {\r\n return null;\r\n }\r\n\r\n if (file instanceof File) {\r\n const ext = getFileExtension(file);\r\n if (allowedExtensions.indexOf(ext) === -1) {\r\n const model: IFileExtensionValidationModel = { allowedExtensions: allowedExtensions, actualExtension: ext, file };\r\n return { [FileValidator.Extension]: model };\r\n }\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return validation(validatorFn);\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { fileExtensions } from '../file.validators';\r\n\r\n@Directive({\r\n selector: '[sfcFileExtensions]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: FileExtensionsValidatorDirective }\r\n ]\r\n})\r\nexport class FileExtensionsValidatorDirective {\r\n @Input('sfcFileExtensions')\r\n extensions: string[] = [];\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return fileExtensions(this.extensions)(control);\r\n }\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { fileMaxSize } from '../../file/file.validators';\r\n\r\n@Directive({\r\n selector: '[sfcFileMaxSize]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: FileMaxSizeValidatorDirective }\r\n ]\r\n})\r\nexport class FileMaxSizeValidatorDirective {\r\n @Input('sfcFileMaxSize')\r\n maxSize: number = 0;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return fileMaxSize(this.maxSize)(control);\r\n }\r\n}","import { NG_VALIDATORS, AbstractControl, ValidationErrors } from '@angular/forms';\r\nimport { Directive, Input } from '@angular/core';\r\nimport { fileMinSize } from '../../file/file.validators';\r\n\r\n@Directive({\r\n selector: '[sfcFileMinSize]',\r\n providers: [\r\n { provide: NG_VALIDATORS, multi: true, useExisting: FileMinSizeValidatorDirective }\r\n ]\r\n})\r\nexport class FileMinSizeValidatorDirective {\r\n @Input('sfcFileMinSize') \r\n minSize: number = 0;\r\n\r\n validate(control: AbstractControl): ValidationErrors | null {\r\n return fileMinSize(this.minSize)(control);\r\n }\r\n}","// models, enums\r\nexport { FileValidator } from './enums';\r\nexport { IFileExtensionValidationModel, IFileSizeValidationModel } from './models';\r\n\r\n// directives\r\nexport {\r\n FileExtensionsValidatorDirective,\r\n FileMaxSizeValidatorDirective,\r\n FileMinSizeValidatorDirective\r\n} from './directives';\r\n\r\n// functions\r\nexport {\r\n fileExtensions,\r\n fileMaxSize,\r\n fileMinSize\r\n} from './file.validators';","import { Directive, Input } from '@angular/core';\r\nimport { CommonConstants } from 'ngx-sfc-common';\r\nimport { BaseInputComponent } from '../base-input.component';\r\nimport { CommonValidator } from '../../../validators';\r\n\r\n@Directive()\r\nexport abstract class BaseTextInputComponent<T extends string | string[]> extends BaseInputComponent<T> {\r\n\r\n @Input()\r\n showPlaceholderOnFocus: boolean = false;\r\n\r\n override get placeholderValue(): string {\r\n return this.placeholder && (!this.isFocused || this.showPlaceholderOnFocus)\r\n ? this.placeholder\r\n : CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n get requiredLengthValue(): number | null {\r\n let requiredLength = null;\r\n\r\n if (this.validationErrors) {\r\n const minLengthError = this.validationErrors[CommonValidator.MinLength],\r\n maxLengthError = this.validationErrors[CommonValidator.MaxLength];\r\n\r\n if (minLengthError) {\r\n requiredLength = minLengthError.requiredLength;\r\n }\r\n\r\n if (maxLengthError) {\r\n requiredLength = maxLengthError.requiredLength;\r\n }\r\n }\r\n\r\n return requiredLength;\r\n }\r\n\r\n get charsCounterValue(): string {\r\n return this.requiredLengthValue\r\n ? `${this.value?.length}${CommonConstants.COMMON_TEXT_DELIMETER}${this.requiredLengthValue}`\r\n : CommonConstants.EMPTY_STRING;\r\n }\r\n}","export enum TextType {\r\n Text = 'text',\r\n Password = 'password'\r\n}","import { Component, Input, OnInit } from '@angular/core';\r\nimport { faEye, faEyeSlash, IconDefinition } from '@fortawesome/free-solid-svg-icons';\r\nimport { BaseTextInputComponent } from '../base/text/base-text-input.component';\r\nimport { TextType } from './text-type.enum';\r\n\r\n@Component({\r\n selector: 'sfc-text-input',\r\n templateUrl: './text-input.component.html',\r\n styleUrls: ['../../styles/input.component.scss', './text-input.component.scss',\r\n './text-input-bordered.component.scss']\r\n})\r\nexport class TextInputComponent extends BaseTextInputComponent<string> implements OnInit {\r\n\r\n @Input()\r\n type: string = TextType.Text;\r\n\r\n _isPassword = false;\r\n\r\n ngOnInit(): void {\r\n this._isPassword = this.isPassword;\r\n }\r\n\r\n get isPassword(): boolean {\r\n return this.type === TextType.Password;\r\n }\r\n\r\n get passwordIcon(): IconDefinition {\r\n return this.isPassword ? faEye : faEyeSlash;\r\n }\r\n\r\n togglePasswordVisibility() {\r\n this.type = this.type == TextType.Password ? TextType.Text : TextType.Password;\r\n }\r\n}\r\n","<div class=\"container\">\r\n <fa-icon *ngIf=\"icon\" #iconRef class=\"icon\" [icon]=\"icon\"></fa-icon>\r\n <div class=\"content\">\r\n <fa-icon *ngIf=\"_isPassword\" class=\"password-icon\" [icon]=\"passwordIcon\" (click)=\"togglePasswordVisibility()\">\r\n </fa-icon>\r\n <label for=\"{{inputId}}\" [ngClass]=\"labelClass\">{{label}}</label>\r\n <div class=\"input\">\r\n <input sfcInput id=\"{{inputId}}\" [type]=\"type\" class=\"text-input\" [placeholder]=\"placeholderValue\"\r\n [value]=\"value\" [disabled]=\"disabled\" (input)=\"onChange($any($event.target).value)\" (blur)=\"onBlur()\">\r\n <ng-content></ng-content>\r\n </div>\r\n <span class=\"helper-text\">{{helperTextValue}}</span>\r\n <span [sfcShowHideElement]=\"requiredLengthValue !== null\" class=\"right-side-info\">{{charsCounterValue}}</span>\r\n </div>\r\n</div> ","import { AfterViewChecked, Component, ElementRef, ViewChild } from '@angular/core';\r\nimport { CommonConstants, getCssLikeValue } from 'ngx-sfc-common';\r\nimport { BaseTextInputComponent } from '../base/text/base-text-input.component';\r\n\r\n@Component({\r\n selector: 'sfc-text-area-input',\r\n templateUrl: './text-area-input.component.html',\r\n styleUrls: ['../../styles/input.component.scss', './text-area-input.component.scss',\r\n './text-area-input-bordered.component.scss']\r\n})\r\nexport class TextAreaInputComponent\r\n extends BaseTextInputComponent<string>\r\n implements AfterViewChecked {\r\n\r\n @ViewChild(\"textAreaRef\", { static: false })\r\n protected textAreaElementRef!: ElementRef;\r\n\r\n ngAfterViewChecked(): void {\r\n this.alignHeight();\r\n }\r\n\r\n override get charsCounterValue(): string {\r\n //Think about this: this.value.replace(/\\r?\\n/g, \"\");\r\n return super.charsCounterValue\r\n ? super.charsCounterValue\r\n : this.value?.length\r\n ? this.value.length.toString() : CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n // for stretching text area input on large texts (new lines)\r\n public alignHeight(): void {\r\n this.textAreaElementRef.nativeElement.style.height = getCssLikeValue(0);\r\n this.textAreaElementRef.nativeElement.style.height = getCssLikeValue(this.textAreaElementRef.nativeElement.scrollHeight);\r\n }\r\n}\r\n","<div class=\"container\">\r\n <fa-icon *ngIf=\"icon\" #iconRef class=\"icon\" [icon]=\"icon\"></fa-icon>\r\n <div class=\"content\">\r\n <div class=\"input\">\r\n <textarea #textAreaRef sfcInput id=\"{{inputId}}\" class=\"text-input\" [placeholder]=\"placeholderValue\"\r\n [value]=\"value\" [disabled]=\"disabled\" (input)=\"onChange($any($event.target).value)\"\r\n (blur)=\"onBlur()\"></textarea>\r\n </div>\r\n <label for=\"{{inputId}}\" [ngClass]=\"labelClass\">{{label}}</label>\r\n <span class=\"helper-text\">{{helperTextValue}}</span>\r\n <span class=\"right-side-info\">{{charsCounterValue}}</span>\r\n </div>\r\n</div>","import { faUpload } from \"@fortawesome/free-solid-svg-icons\";\r\n\r\nexport class FileInputConstants {\r\n static DEFAULT_ICON = faUpload;\r\n static DEFAULT_PLACEHOLDER = 'Choose file';\r\n static NO_FILE_TITLE = 'No file chosen';\r\n}\r\n","import { Directive, ElementRef, HostListener, Input, ViewChild } from \"@angular/core\";\r\nimport { CommonConstants, isNullOrEmptyString } from \"ngx-sfc-common\";\r\nimport { BaseInputComponent } from \"../base/base-input.component\";\r\nimport { FileInputConstants } from \"./file-input.constants\";\r\n\r\n@Directive()\r\nexport abstract class BaseFileInputComponent extends BaseInputComponent<File> {\r\n\r\n @Input()\r\n clear = true;\r\n\r\n @ViewChild('inputFile', { static: false, read: ElementRef })\r\n fileElementRef!: ElementRef;\r\n\r\n @HostListener('change', ['$event.target.files'])\r\n emitFiles(event: FileList) {\r\n const file = event && event.item(0);\r\n this.onChange(file);\r\n }\r\n\r\n get fileName(): string {\r\n return this.value ? this.value.name : CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n get title(): string {\r\n return isNullOrEmptyString(this.fileName) ? FileInputConstants.NO_FILE_TITLE : this.fileName;\r\n }\r\n\r\n get showClearButton(): boolean {\r\n return this.hasValue && this.clear;\r\n }\r\n\r\n clearData(event: Event): void {\r\n event.preventDefault();\r\n this.fileElementRef.nativeElement.value = null;\r\n this.onChange(null);\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\nimport { ButtonType, CommonConstants, parseFileSize } from 'ngx-sfc-common';\r\nimport { BaseFileInputComponent } from '../base-file-input.component';\r\n\r\n@Component({\r\n selector: 'sfc-file-input',\r\n templateUrl: './file-input.component.html',\r\n styleUrls: ['../../../styles/input.component.scss', './file-input.component.scss',\r\n './file-input-bordered.component.scss']\r\n})\r\nexport class FileInputComponent extends BaseFileInputComponent {\r\n\r\n ButtonType = ButtonType;\r\n\r\n override get placeholderValue() {\r\n return this.placeholder || CommonConstants.EMPTY_STRING;\r\n }\r\n\r\n get fileSize() {\r\n return this.value ? parseFileSize(this.value.size) : CommonConstants.EMPTY_STRING;\r\n }\r\n}\r\n","<div class=\"container\">\r\n <sfc-button *ngIf=\"!icon\" class=\"icon\" [sfcComponentSize] [customSize]=\"0.6\"\r\n [types]=\"[ButtonType.Rounded, ButtonType.Filled]\" text=\"File\" [disabled]=\"disabled\">\r\n </sfc-button>\r\n <fa-icon *ngIf=\"icon\" class=\"icon\" [icon]=\"icon\"></fa-icon>\r\n <input #inputFile id=\"{{inputId}}\" type=\"file\" title={{title}} [disabled]=\"disabled\"\r\n (change)=\"emitFiles($any($event.target).files)\">\r\n <div class=\"content\">\r\n <label for=\"{{inputId}}\" class=\"active\">{{label}}</label>\r\n <div class=\"input\">\r\n <input sfcInput class=\"text-input\" value={{fileName}} type=\"text\" [disabled]=\"disabled\"\r\n [placeholder]=\"placeholderValue\">\r\n </div>\r\n <span class=\"helper-text\">{{helperTextValue}}</span>\r\n <span class=\"right-side-info\">{{fileSize}}</span>\r\n <sfc-close class=\"clear-button\" *ngIf=\"showClearButton\" (click)=\"clearData($event)\"></sfc-close>\r\n </div>\r\n</div>","import { Component, Input, OnInit } from '@angular/core';\r\nimport { CommonConstants } from 'ngx-sfc-common';\r\nimport { BaseFileInputComponent } from '../base-file-input.component';\r\nimport { FileInputConstants } from '../file-input.constants';\r\n\r\n@Component({\r\n selector: 'sfc-inline-file-input',\r\n templateUrl: './inline-file-input.component.html',\r\n styleUrls: ['./inline-file-input.component.scss']\r\n})\r\nexport class InlineFileInputComponent extends BaseFileInputComponent implements OnInit {\r\n\r\n @Input()\r\n defaultIcon = false;\r\n\r\n @Input()\r\n showFileName = true;\r\n\r\n override bordered: boolean = false;\r\n\r\n ngOnInit() {\r\n if (this.defaultIcon || !this.showFileName && !this.icon)\r\n this.icon = FileInputConstants.DEFAULT_ICON;\r\n }\r\n\r\n get text() {\r\n if (this.showFileName) {\r\n return this.fileName\r\n ? this.fileName\r\n : this.placeholder || this.label || FileInputConstants.DEFAULT_PLACEHOLDER;\r\n }\r\n\r\n return CommonConstants.EMPTY_STRING;\r\n }\r\n}\r\n","<div class=\"container\">\r\n <input #inputFile sfcInput id=\"{{inputId}}\" type=\"file\" [disabled]=\"disabled\">\r\n <label for=\"{{inputId}}\" title={{title}}>\r\n <fa-icon *ngIf=\"icon\" [icon]=\"icon\" class=\"icon\"></fa-icon>\r\n <span>{{text}}</span>\r\n <sfc-close class=\"clear-button\" *ngIf=\"showClearButton\" (click)=\"clearData($event)\"></sfc-close>\r\n </label>\r\n <span class=\"helper-text\">{{helperTextValue}}</span>\r\n</div>","import { Directive, Input } from '@angular/core';\r\nimport { BaseInputComponent } from '../base-input.component';\r\n\r\n@Directive()\r\nexport abstract class BaseLogicalInputComponent extends BaseInputComponent<boolean> {\r\n\r\n @Input()\r\n sideLabel!: string;\r\n\r\n override bordered: boolean = false;\r\n\r\n get labelValue(): string {\r\n return this.label || this.sideLabel || this.placeholder;\r\n }\r\n}","import { Component, Input } from '@angular/core';\r\nimport { CheckmarkType } from 'ngx-sfc-common';\r\nimport { BaseLogicalInputComponent } from '../base/logical/logical-input.component';\r\n\r\n@Component({\r\n selector: 'sfc-checkbox-input',\r\n templateUrl: './checkbox-input.component.html',\r\n styleUrls: [\r\n '../../styles/input.component.scss',\r\n '../../styles/vertical-input.component.scss',\r\n './checkbox-input.component.scss'\r\n ]\r\n})\r\nexport class CheckboxInputComponent extends BaseLogicalInputComponent {\r\n\r\n @Input()\r\n checkmarkType: CheckmarkType = CheckmarkType.Square;\r\n}\r\n","<div class=\"container\">\r\n <input sfcInput id=\"{{inputId}}\" type=\"checkbox\" [disabled]=\"disabled\" [checked]=\"value\" [value]=\"value\"\r\n (input)=\"onChange($any($event.target).checked)\" style=\"display: none;\" />\r\n <div class=\"content\" [class.side-label]=\"sideLabel\">\r\n <label tabindex=\"0\" for=\"{{inputId}}\" *ngIf=\"label\">{{label}}</label>\r\n <div class=\"component\">\r\n <fa-icon *ngIf=\"icon\" class=\"icon\" [icon]=\"icon\"></fa-icon>\r\n <sfc-checkmark [type]=\"checkmarkType\" [disabled]=\"disabled\" [active]=\"value || false\"\r\n (click)=\"onChange(!value)\"></sfc-checkmark>\r\n <label tabindex=\"0\" *ngIf=\"sideLabel\" class=\"side\" for=\"{{inputId}}\">{{sideLabel}}</label>\r\n </div>\r\n <span [sfcShowHideElement]=\"!!helperTextValue\" class=\"helper-text\">{{helperTextValue}}</span>\r\n </div>\r\n</div>","export enum ToggleType {\r\n Simple,\r\n Complex\r\n}","import { Component, Input } from '@angular/core';\r\nimport { faCheck, faTimes } from '@fortawesome/free-solid-svg-icons';\r\nimport { CommonConstants, IToggleSwitcherModel } from 'ngx-sfc-common';\r\nimport { BaseLogicalInputComponent } from '../base/logical/logical-input.component';\r\nimport { ToggleType } from './toggle-type.enum';\r\n\r\n@Component({\r\n selector: 'sfc-toggle-input',\r\n templateUrl: './toggle-input.component.html',\r\n styleUrls: ['./toggle-input.component.scss',\r\n '../../styles/input.component.scss',\r\n '../../styles/vertical-input.component.scss']\r\n})\r\nexport class ToggleInputComponent extends BaseLogicalInputComponent {\r\n\r\n ToggleType = ToggleType;\r\n\r