@sd-angular/core 1.1.98 → 1.2.2
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/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.js +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-common.umd.js +22 -0
- package/bundles/sd-angular-core-common.umd.js.map +1 -1
- package/bundles/sd-angular-core-common.umd.min.js +1 -1
- package/bundles/sd-angular-core-common.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-date-time.umd.js +1 -1
- package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
- package/bundles/sd-angular-core-date-time.umd.min.js +1 -1
- package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.js +25 -1
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-input-number.umd.js +1 -1
- package/bundles/sd-angular-core-input-number.umd.js.map +1 -1
- package/bundles/sd-angular-core-input-number.umd.min.js +1 -1
- package/bundles/sd-angular-core-input-number.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-input.umd.js +1 -1
- package/bundles/sd-angular-core-input.umd.js.map +1 -1
- package/bundles/sd-angular-core-input.umd.min.js +1 -1
- package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-popover.umd.js +1 -1
- package/bundles/sd-angular-core-popover.umd.js.map +1 -1
- package/bundles/sd-angular-core-popover.umd.min.js +1 -1
- package/bundles/sd-angular-core-popover.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-select-editor.umd.js +7 -1
- package/bundles/sd-angular-core-select-editor.umd.js.map +1 -1
- package/bundles/sd-angular-core-select-editor.umd.min.js +2 -2
- package/bundles/sd-angular-core-select-editor.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-select.umd.js +1 -1
- package/bundles/sd-angular-core-select.umd.js.map +1 -1
- package/bundles/sd-angular-core-select.umd.min.js +1 -1
- package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
- package/common/src/lib/typings/string.extension.d.ts +2 -0
- package/date-time/sd-angular-core-date-time.metadata.json +1 -1
- package/esm2015/autocomplete/src/lib/autocomplete.component.js +2 -2
- package/esm2015/common/src/lib/typings/string.extension.js +23 -1
- package/esm2015/date-time/src/lib/date-time.component.js +2 -2
- package/esm2015/grid-material/src/lib/components/desktop-cell-editor/desktop-cell-editor.component.js +26 -2
- package/esm2015/grid-material/src/lib/models/grid-column.model.js +1 -1
- package/esm2015/input/src/lib/input.component.js +2 -2
- package/esm2015/input-number/src/lib/input-number.component.js +2 -2
- package/esm2015/popover/src/lib/directives/popover-trigger.directive.js +2 -2
- package/esm2015/select/src/lib/select.component.js +2 -2
- package/esm2015/select-editor/src/lib/select-editor.component.js +9 -3
- package/fesm2015/sd-angular-core-autocomplete.js +1 -1
- package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
- package/fesm2015/sd-angular-core-common.js +22 -0
- package/fesm2015/sd-angular-core-common.js.map +1 -1
- package/fesm2015/sd-angular-core-date-time.js +1 -1
- package/fesm2015/sd-angular-core-date-time.js.map +1 -1
- package/fesm2015/sd-angular-core-grid-material.js +25 -1
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-input-number.js +1 -1
- package/fesm2015/sd-angular-core-input-number.js.map +1 -1
- package/fesm2015/sd-angular-core-input.js +1 -1
- package/fesm2015/sd-angular-core-input.js.map +1 -1
- package/fesm2015/sd-angular-core-popover.js +1 -1
- package/fesm2015/sd-angular-core-popover.js.map +1 -1
- package/fesm2015/sd-angular-core-select-editor.js +8 -2
- package/fesm2015/sd-angular-core-select-editor.js.map +1 -1
- package/fesm2015/sd-angular-core-select.js +1 -1
- package/fesm2015/sd-angular-core-select.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/desktop-cell-editor/desktop-cell-editor.component.d.ts +3 -0
- package/grid-material/src/lib/models/grid-column.model.d.ts +5 -2
- package/input/sd-angular-core-input.metadata.json +1 -1
- package/input-number/sd-angular-core-input-number.metadata.json +1 -1
- package/package.json +1 -1
- package/{sd-angular-core-1.1.98.tgz → sd-angular-core-1.2.2.tgz} +0 -0
- package/select/sd-angular-core-select.metadata.json +1 -1
- package/select-editor/sd-angular-core-select-editor.metadata.json +1 -1
- package/select-editor/src/lib/select-editor.component.d.ts +3 -0
|
@@ -327,7 +327,7 @@ _name = new WeakMap(), _valueInput = new WeakMap(), _regexDecimal = new WeakMap(
|
|
|
327
327
|
SdInputNumber.decorators = [
|
|
328
328
|
{ type: Component, args: [{
|
|
329
329
|
selector: 'sd-input-number',
|
|
330
|
-
template: "<label *ngIf=\"!appearance && label\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</span></label>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{ 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"inputControl\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" (keydown)=\"onKeydown($event)\"\r\n [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" (paste)=\"onPaste($event)\" autocorrect=\"off\"\r\n [sdPopoverTriggerFor]=\"
|
|
330
|
+
template: "<label *ngIf=\"!appearance && label\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</span></label>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{ 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"inputControl\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" (keydown)=\"onKeydown($event)\"\r\n [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" (paste)=\"onPaste($event)\" autocorrect=\"off\"\r\n [sdPopoverTriggerFor]=\"null\" [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\">\r\n <ng-container *ngIf=\"sdSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-error *ngIf=\"formControl?.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{formControl.errors?.customValidator}}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>\r\n<!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n <span *ngIf=\"formControl.errors?.required\">\r\n {{ \"This field is required\" | sdTranslate }}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->",
|
|
331
331
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
332
332
|
styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{background:#e9e9e9!important;font-size:12px;line-height:26px!important;margin-bottom:3px;visibility:hidden}"]
|
|
333
333
|
},] }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-input-number.js","sources":["../../../../projects/sd-core/input-number/src/lib/input-number.component.ts","../../../../projects/sd-core/input-number/src/lib/input-number.module.ts","../../../../projects/sd-core/input-number/src/public-api.ts","../../../../projects/sd-core/input-number/sd-angular-core-input-number.ts"],"sourcesContent":["import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup, FormControl, FormGroupDirective } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\n// import { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl, SdSuffixDirective } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nclass SdInputNumberErrotStateMatcher implements ErrorStateMatcher {\r\n constructor(private formControl: FormControl) { }\r\n isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {\r\n const isSubmitted = form && form.submitted;\r\n return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));\r\n }\r\n}\r\n@Component({\r\n selector: 'sd-input-number',\r\n templateUrl: './input-number.component.html',\r\n styleUrls: ['./input-number.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInputNumber implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n #valueInput: string;\r\n #regexDecimal: string\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n if (value || value == 0) {\r\n const val = value.toString().replace(/\\./g, ',');\r\n this.inputControl.setValue(this.#setValueInput(val));\r\n }\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n @Input() type: 'minus' | 'integers'; //minus: chỉ nhập số âm, integers: chỉ số dương, all: tất cả\r\n @Input() precision: number = 2; //số chữ số thập phân \r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n #min: number;\r\n @Input() set min(val: number) {\r\n this.#min = val;\r\n }\r\n\r\n #max: number;\r\n @Input() set max(val: number) {\r\n this.#max = val;\r\n }\r\n\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.inputControl.disable();\r\n this.formControl.disable();\r\n } else {\r\n this.inputControl.enable();\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() appearance: MatFormFieldAppearance;\r\n\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n formControl = new SdFormControl();\r\n inputControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n matcher = new SdInputNumberErrotStateMatcher(this.formControl);\r\n\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n @ContentChild(SdSuffixDirective) sdSuffix: SdSuffixDirective;\r\n isFocused = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.inputControl.touchChanges.subscribe(() => {\r\n this.formControl.markAsTouched();\r\n this.ref.markForCheck();\r\n }));\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#subscription.add(this.inputControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#regexDecimal = `(([0-9]+(\\\\.[0-9])?)+(\\\\,[0-9]{0,${this.precision}}){0,1})$`;\r\n if (this.precision == 0) {\r\n this.#regexDecimal = `(([0-9]+(\\\\.[0-9])?)+)$`;\r\n }\r\n if (this.type == 'minus') {\r\n this.#regexDecimal = `[-]${this.#regexDecimal}`;\r\n }\r\n if (!this.type) {\r\n this.#regexDecimal = `[-]?${this.#regexDecimal}`;\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.inputControl.valueChanges.pipe(debounceTime(200)).subscribe(val => {\r\n if (!val) {\r\n this.formControl.setValue(undefined);\r\n this.modelChange.emit(undefined);\r\n this.sdChange.emit(undefined);\r\n return;\r\n }\r\n let item = this.#setValueInput(val);\r\n if (this.#valueInput === item) {\r\n return;\r\n }\r\n this.#valueInput = item;\r\n let value = (val.toString().replace(/\\./g, '').replace(/,/g, '.'));\r\n if (this.#min || this.#min === 0) {\r\n if (+value < this.#min) {\r\n value = this.#min;\r\n item = this.#setValueInput(this.#min.toString().replace(/\\./g, ','));\r\n }\r\n }\r\n this.inputControl.setValue(item);\r\n this.formControl.setValue(value);\r\n this.#outPutValue(Number(value));\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n #setValueInput = (value: string) => {\r\n const arrayNext = value.split(',');\r\n if (arrayNext.length >= 2) {\r\n return `${this.#formatNumber(arrayNext[0])},${arrayNext[1]}`;\r\n }\r\n return this.#formatNumber(value);\r\n }\r\n\r\n #formatNumber = (string) => {\r\n return string.toString().replace(/\\./g, '').split(\"\").reverse().reduce((acc, num, i, orig) => {\r\n return num + (num != \"-\" && i && !(i % 3) ? \".\" : \"\") + acc;\r\n }, \"\");\r\n }\r\n\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #outPutValue = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.inputControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.inputControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.inputControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onKeydown = (event) => {\r\n if(event.ctrlKey && event.key =='v'){\r\n this.#checkValue(event,'');\r\n return;\r\n }\r\n const key = event.keyCode || event.charCode;\r\n if (key == 8 || key == 46 || key == 37 || key == 39||(event.ctrlKey && event.key =='c')||(event.ctrlKey && event.key =='x')) {\r\n return;\r\n }\r\n this.#checkValue(event, event.key);\r\n }\r\n\r\n onPaste(event){\r\n const nextKey = event.clipboardData.getData('text');\r\n this.#checkValue(event, nextKey)\r\n }\r\n\r\n #checkValue=(event, nextKey)=>{\r\n const current: string = event.target.value;\r\n const curval_arr = current.split(\"\");\r\n curval_arr.splice(event.target.selectionStart, (event.target.selectionEnd - event.target.selectionStart), nextKey);\r\n const newval = curval_arr.join(\"\");\r\n if (this.type !== 'integers' && newval === '-') {\r\n return;\r\n }\r\n const regExp: RegExp = new RegExp(`^${this.#regexDecimal}`, 'g');\r\n if (newval && !String(newval).match(regExp)) {\r\n event.preventDefault();\r\n return;\r\n }\r\n const value = (newval.toString().replace(/\\./g, '').replace(/,/g, '.'));\r\n if ((this.#max || this.#max === 0) && +value > this.#max) {\r\n setTimeout(() => { \r\n this.inputControl.setValue(this.#setValueInput(this.#max.toString().replace(/\\./g, ',')));\r\n },10);\r\n event.preventDefault();\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n let val: string = (this.inputControl.value ?? '').toString();\r\n const arrayValue = val.split(',');\r\n if (arrayValue.length >= 2 && arrayValue[1] == '') {\r\n this.inputControl.setValue(this.#formatNumber(arrayValue[0]));\r\n return;\r\n }\r\n if (val.length > val.trim().length) {\r\n this.inputControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdInputNumber } from './input-number.component';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\n\r\n@NgModule({\r\n declarations: [SdInputNumber],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n MatButtonModule\r\n ],\r\n exports: [\r\n SdInputNumber\r\n ]\r\n})\r\nexport class SdInputNumberModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input-number.module';\r\nexport * from './lib/input-number.component';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n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-angular-core-input-number.js","sources":["../../../../projects/sd-core/input-number/src/lib/input-number.component.ts","../../../../projects/sd-core/input-number/src/lib/input-number.module.ts","../../../../projects/sd-core/input-number/src/public-api.ts","../../../../projects/sd-core/input-number/sd-angular-core-input-number.ts"],"sourcesContent":["import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup, FormControl, FormGroupDirective } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\n// import { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl, SdSuffixDirective } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nclass SdInputNumberErrotStateMatcher implements ErrorStateMatcher {\r\n constructor(private formControl: FormControl) { }\r\n isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {\r\n const isSubmitted = form && form.submitted;\r\n return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));\r\n }\r\n}\r\n@Component({\r\n selector: 'sd-input-number',\r\n templateUrl: './input-number.component.html',\r\n styleUrls: ['./input-number.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInputNumber implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n #valueInput: string;\r\n #regexDecimal: string\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n if (value || value == 0) {\r\n const val = value.toString().replace(/\\./g, ',');\r\n this.inputControl.setValue(this.#setValueInput(val));\r\n }\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n @Input() type: 'minus' | 'integers'; //minus: chỉ nhập số âm, integers: chỉ số dương, all: tất cả\r\n @Input() precision: number = 2; //số chữ số thập phân \r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n #min: number;\r\n @Input() set min(val: number) {\r\n this.#min = val;\r\n }\r\n\r\n #max: number;\r\n @Input() set max(val: number) {\r\n this.#max = val;\r\n }\r\n\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.inputControl.disable();\r\n this.formControl.disable();\r\n } else {\r\n this.inputControl.enable();\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() appearance: MatFormFieldAppearance;\r\n\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n formControl = new SdFormControl();\r\n inputControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n matcher = new SdInputNumberErrotStateMatcher(this.formControl);\r\n\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n @ContentChild(SdSuffixDirective) sdSuffix: SdSuffixDirective;\r\n isFocused = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.inputControl.touchChanges.subscribe(() => {\r\n this.formControl.markAsTouched();\r\n this.ref.markForCheck();\r\n }));\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#subscription.add(this.inputControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#regexDecimal = `(([0-9]+(\\\\.[0-9])?)+(\\\\,[0-9]{0,${this.precision}}){0,1})$`;\r\n if (this.precision == 0) {\r\n this.#regexDecimal = `(([0-9]+(\\\\.[0-9])?)+)$`;\r\n }\r\n if (this.type == 'minus') {\r\n this.#regexDecimal = `[-]${this.#regexDecimal}`;\r\n }\r\n if (!this.type) {\r\n this.#regexDecimal = `[-]?${this.#regexDecimal}`;\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.inputControl.valueChanges.pipe(debounceTime(200)).subscribe(val => {\r\n if (!val) {\r\n this.formControl.setValue(undefined);\r\n this.modelChange.emit(undefined);\r\n this.sdChange.emit(undefined);\r\n return;\r\n }\r\n let item = this.#setValueInput(val);\r\n if (this.#valueInput === item) {\r\n return;\r\n }\r\n this.#valueInput = item;\r\n let value = (val.toString().replace(/\\./g, '').replace(/,/g, '.'));\r\n if (this.#min || this.#min === 0) {\r\n if (+value < this.#min) {\r\n value = this.#min;\r\n item = this.#setValueInput(this.#min.toString().replace(/\\./g, ','));\r\n }\r\n }\r\n this.inputControl.setValue(item);\r\n this.formControl.setValue(value);\r\n this.#outPutValue(Number(value));\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n #setValueInput = (value: string) => {\r\n const arrayNext = value.split(',');\r\n if (arrayNext.length >= 2) {\r\n return `${this.#formatNumber(arrayNext[0])},${arrayNext[1]}`;\r\n }\r\n return this.#formatNumber(value);\r\n }\r\n\r\n #formatNumber = (string) => {\r\n return string.toString().replace(/\\./g, '').split(\"\").reverse().reduce((acc, num, i, orig) => {\r\n return num + (num != \"-\" && i && !(i % 3) ? \".\" : \"\") + acc;\r\n }, \"\");\r\n }\r\n\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #outPutValue = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.inputControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.inputControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.inputControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onKeydown = (event) => {\r\n if(event.ctrlKey && event.key =='v'){\r\n this.#checkValue(event,'');\r\n return;\r\n }\r\n const key = event.keyCode || event.charCode;\r\n if (key == 8 || key == 46 || key == 37 || key == 39||(event.ctrlKey && event.key =='c')||(event.ctrlKey && event.key =='x')) {\r\n return;\r\n }\r\n this.#checkValue(event, event.key);\r\n }\r\n\r\n onPaste(event){\r\n const nextKey = event.clipboardData.getData('text');\r\n this.#checkValue(event, nextKey)\r\n }\r\n\r\n #checkValue=(event, nextKey)=>{\r\n const current: string = event.target.value;\r\n const curval_arr = current.split(\"\");\r\n curval_arr.splice(event.target.selectionStart, (event.target.selectionEnd - event.target.selectionStart), nextKey);\r\n const newval = curval_arr.join(\"\");\r\n if (this.type !== 'integers' && newval === '-') {\r\n return;\r\n }\r\n const regExp: RegExp = new RegExp(`^${this.#regexDecimal}`, 'g');\r\n if (newval && !String(newval).match(regExp)) {\r\n event.preventDefault();\r\n return;\r\n }\r\n const value = (newval.toString().replace(/\\./g, '').replace(/,/g, '.'));\r\n if ((this.#max || this.#max === 0) && +value > this.#max) {\r\n setTimeout(() => { \r\n this.inputControl.setValue(this.#setValueInput(this.#max.toString().replace(/\\./g, ',')));\r\n },10);\r\n event.preventDefault();\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n let val: string = (this.inputControl.value ?? '').toString();\r\n const arrayValue = val.split(',');\r\n if (arrayValue.length >= 2 && arrayValue[1] == '') {\r\n this.inputControl.setValue(this.#formatNumber(arrayValue[0]));\r\n return;\r\n }\r\n if (val.length > val.trim().length) {\r\n this.inputControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdInputNumber } from './input-number.component';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\n\r\n@NgModule({\r\n declarations: [SdInputNumber],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n MatButtonModule\r\n ],\r\n exports: [\r\n SdInputNumber\r\n ]\r\n})\r\nexport class SdInputNumberModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input-number.module';\r\nexport * from './lib/input-number.component';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAM,8BAA8B;IAClC,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;KAAK;IACjD,YAAY,CAAC,OAA2B,EAAE,IAAwC;;QAChF,MAAM,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC;QAC3C,OAAO,CAAC,EAAE,OAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,MAAK,OAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,YAAI,IAAI,CAAC,WAAW,0CAAE,OAAO,CAAA,IAAI,WAAW,CAAC,CAAC,CAAC;KAC/G;CACF;MAOY,aAAa;IAuGxB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QAzG1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAClB,8BAAoB;QACpB,gCAAqB;QAOrB,wBAAiB;QAYjB,wBAAmB,GAAG,KAAK,CAAC;QAI5B,yBAAe,KAAK,EAAC;QAIrB,yBAAY;QAaF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAOV,cAAS,GAAW,CAAC,CAAC;QAE/B,eAAU,GAAG,KAAK,CAAC;QAKnB,uBAAa;QAKb,uBAAa;QAKb,6BAAqD;QAkB3C,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QACnC,YAAO,GAAG,I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;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,eAAe;oBACf,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,aAAa;iBACd;aACF;;;AC/BD;;;;ACAA;;;;;;"}
|
|
@@ -278,7 +278,7 @@ _name = new WeakMap(), _form = new WeakMap(), _blurOnEnter_1 = new WeakMap(), _m
|
|
|
278
278
|
SdInput.decorators = [
|
|
279
279
|
{ type: Component, args: [{
|
|
280
280
|
selector: 'sd-input',
|
|
281
|
-
template: "<label *ngIf=\"!appearance && label\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</span></label>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n [step]=\"1\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" [sdPopoverTriggerFor]=\"
|
|
281
|
+
template: "<label *ngIf=\"!appearance && label\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</span></label>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n [step]=\"1\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" [sdPopoverTriggerFor]=\"null\"\r\n [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\">\r\n <button #btnCopy *ngIf=\"copyable\" matSuffix mat-flat-button aria-label=\"Clear\" class=\"btn-copy\"\r\n (click)=\"copyText()\">\r\n Copy\r\n </button>\r\n <span class=\"mr-1\" *ngIf=\"maxlength\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\" formControl.errors?.maxlength\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Max length' | sdTranslate}} {{maxlength}}\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Pattern error' | sdTranslate}}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{formControl.errors?.customValidator}}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>\r\n<!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n <span *ngIf=\"formControl.errors?.required\">\r\n {{ \"This field is required\" | sdTranslate }}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </span>\r\n <span *ngIf=\"formControl.errors?.pattern\">\r\n {{'Pattern error' | sdTranslate}}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->",
|
|
282
282
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
283
283
|
styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{background:#e9e9e9!important;font-size:12px;line-height:26px!important;margin-bottom:3px;visibility:hidden}"]
|
|
284
284
|
},] }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-input.js","sources":["../../../../projects/sd-core/input/src/lib/directives/input-suffix.directive.ts","../../../../projects/sd-core/input/src/lib/input.component.ts","../../../../projects/sd-core/input/src/lib/input-tooltip.pipe.ts","../../../../projects/sd-core/input/src/lib/directives/touch.directive.ts","../../../../projects/sd-core/input/src/lib/input.module.ts","../../../../projects/sd-core/input/src/public-api.ts","../../../../projects/sd-core/input/sd-angular-core-input.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdInputSuffix]'\r\n})\r\nexport class SdInputSuffixDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\n@Component({\r\n selector: 'sd-input',\r\n templateUrl: './input.component.html',\r\n styleUrls: ['./input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInput implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() appearance: MatFormFieldAppearance;\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n qcId: string;\r\n label: string;\r\n @Input('label') set _label(val: string) {\r\n this.label = val;\r\n this.qcId = hash({\r\n selector: 'sd-input',\r\n label: val\r\n });\r\n };\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' | 'datetime-local' | 'month' = 'text';\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('btnCopy', { read: ElementRef }) btnCopy: ElementRef;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n copyText() {\r\n this.utilityService.copyToClipboard(this.#model);\r\n this.btnCopy.nativeElement.innerText = 'Copied';\r\n this.btnCopy.nativeElement.setAttribute('style', 'color: #4caf50;');\r\n setTimeout(() => {\r\n this.btnCopy.nativeElement.innerText = 'Copy';\r\n this.btnCopy.nativeElement.removeAttribute('style');\r\n }, 2000);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n console.log(changes);\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n MatButtonModule\r\n ],\r\n declarations: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n TouchDirective\r\n ],\r\n exports: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n SdCommonModule\r\n ]\r\n})\r\nexport class SdInputModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input.module';\r\nexport * from './lib/input-tooltip.pipe';\r\nexport * from './lib/directives/input-suffix.directive';\r\nexport * from './lib/input.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TouchDirective as ɵa} from './src/lib/directives/touch.directive';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;MAKa,sBAAsB;IACjC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,iBAAiB;aAC5B;;;YAJmB,WAAW;;;;MCmClB,OAAO;IAoHlB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QAtH1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAQlB,wBAAiB;QAoBR,SAAI,GAA0E,MAAM,CAAC;QAC9F,wBAAmB,GAAG,KAAK,CAAC;QAI5B,yBAAe,KAAK,EAAC;QAIrB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,GAAG,KAAK,CAAC;QAenB,2BAAiB;QAKjB,6BAAqD;QAe5C,SAAI,GAAG,QAAQ,CAAC;QACzB,aAAQ,GAAG,KAAK,CAAC;QAKP,gBAAW,GAAG,IAAI,YAAY,EAAO,CAAC;QAEtC,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QACnC,YAAO,GAAG,IAAI,YAAY,EAAO,CAAC;QAClC,qBAAgB,GAAG,IAAI,YAAY,EAAO,CAAC;QAC3C,eAAU,GAAG,IAAI,YAAY,EAAE,CAAC;QAI1C,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,wBAAgB,IAAI,YAAY,EAAE,EAAC;QAEnC,cAAS,GAAG,KAAK,CAAC;QAElB,aAAQ,GAAG,KAAK,C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,SAAS;4BACnB,YAAY,SAAC,sBAAsB;qBAGnC,YAAY,SAAC,kBAAkB;sBAE/B,SAAS,SAAC,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;wBAEzC,KAAK,SAAC,UAAU;;;MChJN,kBAAkB;IAC7B,SAAS,CAAC,KAAU,EAAE,OAAkD;QACtE,IAAI,QAAQ,OAAO,CAAC,KAAK,QAAQ,EAAE;YACjC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;KACvB;;;YATF,IAAI,SAAC;gBACJ,IAAI,EAAE,oBAAoB;aAC3B;;;MCEY,cAAc;IAIzB,WAAW,CAAC,OAAsB;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAG,OAAO,CAAC,KAAK,EAAC;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;SACzB;KACF;;;YAZF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;aACpB;;;oBAEE,KAAK;kBACL,KAAK;;;MCoCK,aAAa;;;YA3BzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,eAAe;oBACf,eAAe;iBAChB;gBACD,YAAY,EAAE;oBACZ,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;aACF;;;AC1CD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-input.js","sources":["../../../../projects/sd-core/input/src/lib/directives/input-suffix.directive.ts","../../../../projects/sd-core/input/src/lib/input.component.ts","../../../../projects/sd-core/input/src/lib/input-tooltip.pipe.ts","../../../../projects/sd-core/input/src/lib/directives/touch.directive.ts","../../../../projects/sd-core/input/src/lib/input.module.ts","../../../../projects/sd-core/input/src/public-api.ts","../../../../projects/sd-core/input/sd-angular-core-input.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdInputSuffix]'\r\n})\r\nexport class SdInputSuffixDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\n@Component({\r\n selector: 'sd-input',\r\n templateUrl: './input.component.html',\r\n styleUrls: ['./input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInput implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() appearance: MatFormFieldAppearance;\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n qcId: string;\r\n label: string;\r\n @Input('label') set _label(val: string) {\r\n this.label = val;\r\n this.qcId = hash({\r\n selector: 'sd-input',\r\n label: val\r\n });\r\n };\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' | 'datetime-local' | 'month' = 'text';\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('btnCopy', { read: ElementRef }) btnCopy: ElementRef;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n copyText() {\r\n this.utilityService.copyToClipboard(this.#model);\r\n this.btnCopy.nativeElement.innerText = 'Copied';\r\n this.btnCopy.nativeElement.setAttribute('style', 'color: #4caf50;');\r\n setTimeout(() => {\r\n this.btnCopy.nativeElement.innerText = 'Copy';\r\n this.btnCopy.nativeElement.removeAttribute('style');\r\n }, 2000);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n console.log(changes);\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n MatButtonModule\r\n ],\r\n declarations: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n TouchDirective\r\n ],\r\n exports: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n SdCommonModule\r\n ]\r\n})\r\nexport class SdInputModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input.module';\r\nexport * from './lib/input-tooltip.pipe';\r\nexport * from './lib/directives/input-suffix.directive';\r\nexport * from './lib/input.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TouchDirective as ɵa} from './src/lib/directives/touch.directive';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;MAKa,sBAAsB;IACjC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,iBAAiB;aAC5B;;;YAJmB,WAAW;;;;MCmClB,OAAO;IAoHlB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QAtH1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAQ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E,CAAC;SACzB;KACF;;;YAZF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;aACpB;;;oBAEE,KAAK;kBACL,KAAK;;;MCoCK,aAAa;;;YA3BzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,eAAe;oBACf,eAAe;iBAChB;gBACD,YAAY,EAAE;oBACZ,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;aACF;;;AC1CD;;;;ACAA;;;;;;"}
|
|
@@ -310,7 +310,7 @@ class PopoverTriggerDirective {
|
|
|
310
310
|
return __classPrivateFieldGet(this, _popover);
|
|
311
311
|
}
|
|
312
312
|
set popover(popover) {
|
|
313
|
-
if (popover === __classPrivateFieldGet(this, _popover)) {
|
|
313
|
+
if (!popover || popover === __classPrivateFieldGet(this, _popover)) {
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
316
|
__classPrivateFieldSet(this, _popover, popover);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-popover.js","sources":["../../../../projects/sd-core/popover/src/lib/directives/popover-content.directive.ts","../../../../projects/sd-core/popover/src/lib/popover/popover.component.ts","../../../../projects/sd-core/popover/src/lib/directives/popover-trigger.directive.ts","../../../../projects/sd-core/popover/src/lib/popover.module.ts","../../../../projects/sd-core/popover/src/public-api.ts","../../../../projects/sd-core/popover/sd-angular-core-popover.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdPopoverContent]'\r\n})\r\nexport class PopoverContentDirective {\r\n\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n ElementRef,\r\n EventEmitter,\r\n HostListener,\r\n Input,\r\n OnDestroy,\r\n OnInit,\r\n Output,\r\n TemplateRef,\r\n ViewChild,\r\n ViewEncapsulation,\r\n OnChanges,\r\n SimpleChanges,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { Position } from '../popover.model';\r\nimport * as uuid from 'uuid';\r\nimport { DeviceDetectorService } from 'ngx-device-detector';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { PopoverTriggerDirective } from '../directives/popover-trigger.directive';\r\nimport { PopoverContentDirective } from '../directives/popover-content.directive';\r\n\r\nexport interface SdPopover {\r\n close: () => void;\r\n}\r\n\r\n@Component({\r\n selector: 'sd-popover',\r\n templateUrl: './popover.component.html',\r\n styleUrls: ['./popover.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n exportAs: 'sdPopover',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PopoverComponent implements SdPopover, OnChanges, OnInit, OnDestroy {\r\n classList: Record<string, boolean> = {};\r\n panelId = `sd-popover-panel-${uuid.v4()}`;\r\n isMobileOrTablet = false;\r\n mouseState$ = new BehaviorSubject<boolean>(false);\r\n trigger: PopoverTriggerDirective = null;\r\n\r\n @ViewChild(TemplateRef) templateRef: TemplateRef<any>;\r\n @ViewChild('panel') panel: ElementRef<HTMLDivElement>;\r\n @ContentChild(PopoverContentDirective) popoverContent: PopoverContentDirective\r\n\r\n @Input() panelClass: string = '';\r\n @Input() width: 'lg' | 'md' | 'sm' | string = 'sm';\r\n @Input() height: string = 'auto';\r\n @Input() type: 'normal' | 'primary' | 'info' | 'success' | 'warning' | 'danger' = 'normal';\r\n @Input()\r\n get position(): Position {\r\n return this.#xPosition;\r\n }\r\n set position(value: Position) {\r\n this.#xPosition = value;\r\n this.setPositionClasses();\r\n }\r\n #xPosition: Position;\r\n\r\n @Output() readonly closed = new EventEmitter<void>();\r\n\r\n @HostListener('document:click', ['$event.target'])\r\n _hostClick(targetElement) {\r\n if (this.panel?.nativeElement) {\r\n const isInside = this.panel.nativeElement.contains(targetElement);\r\n if (!isInside) {\r\n this.setMouseState(false);\r\n }\r\n }\r\n }\r\n\r\n constructor(\r\n private cdRef: ChangeDetectorRef,\r\n private deviceService: DeviceDetectorService\r\n ) {\r\n this.isMobileOrTablet = !deviceService.isDesktop();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if(changes.type) {\r\n const type = changes.type.currentValue;\r\n const preType = changes.type.previousValue;\r\n this.classList = this.classList ?? {\r\n 'sd-popover--normal': true\r\n };\r\n if (preType) {\r\n this.classList[`sd-popover--${preType}`] = false;\r\n }\r\n if (type) {\r\n this.classList[`sd-popover--${type}`] = true;\r\n }\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n this.setPositionClasses();\r\n this.width = this.width || '80vw';\r\n if (!this.isMobileOrTablet) {\r\n switch (this.width) {\r\n case 'lg':\r\n this.width = '80vw';\r\n break;\r\n case 'md':\r\n this.width = '60vw';\r\n break;\r\n case 'sm':\r\n this.width = '40vw';\r\n break;\r\n }\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.closed.complete();\r\n this.mouseState$.complete();\r\n }\r\n\r\n close = () => {\r\n this.mouseState$.next(false);\r\n this.closed.emit();\r\n };\r\n\r\n setPositionClasses = (pos: Position = this.position) => {\r\n const classes = this.classList;\r\n classes['sd-popover-above'] = pos === 'above';\r\n classes['sd-popover-below'] = pos === 'below';\r\n\r\n this.cdRef?.markForCheck();\r\n };\r\n\r\n addArrowTranslateX = (offset: number) => {\r\n const arrowElement: HTMLElement = document.querySelector(`#${this.panelId} .sd-popover-arrow`);\r\n if (arrowElement && offset) {\r\n try {\r\n const style = window.getComputedStyle(arrowElement);\r\n const matrix = new WebKitCSSMatrix(style.transform);\r\n const translateX = matrix.m41 + offset;\r\n const translateY = matrix.m42;\r\n arrowElement.style.transform = `translateX(${translateX}px) translateY(${translateY}px)`;\r\n } catch (error) {}\r\n }\r\n };\r\n\r\n setMouseState = (visible: boolean) => {\r\n if (!visible) {\r\n // chỉ được tắt khi đang không focus element nào bên trong panel\r\n // tránh lỗi có control mở overlay khiến cho mất mouseenter ở panel\r\n const activeElement = document.activeElement;\r\n const panelElement = this.panel.nativeElement;\r\n if (panelElement?.contains(activeElement)) {\r\n return;\r\n }\r\n }\r\n this.mouseState$.next(visible);\r\n };\r\n}\r\n","import { Directionality } from \"@angular/cdk/bidi\";\r\nimport {\r\n FlexibleConnectedPositionStrategy,\r\n Overlay,\r\n OverlayConfig,\r\n OverlayRef,\r\n} from \"@angular/cdk/overlay\";\r\nimport { Platform } from \"@angular/cdk/platform\";\r\nimport { TemplatePortal } from \"@angular/cdk/portal\";\r\nimport {\r\n AfterContentInit,\r\n AfterViewInit,\r\n Directive,\r\n ElementRef,\r\n EventEmitter,\r\n Input,\r\n NgZone,\r\n OnDestroy,\r\n Optional,\r\n Output,\r\n ViewContainerRef,\r\n} from \"@angular/core\";\r\nimport { fromEvent, merge, Subject, Subscription } from \"rxjs\";\r\nimport {\r\n auditTime,\r\n debounceTime,\r\n distinctUntilChanged,\r\n filter,\r\n map,\r\n mapTo,\r\n takeUntil,\r\n tap,\r\n} from \"rxjs/operators\";\r\nimport { Position } from \"../popover.model\";\r\nimport { PopoverComponent } from \"../popover/popover.component\";\r\n\r\n@Directive({\r\n selector: \"[sdPopoverTriggerFor]\",\r\n host: {\r\n \"aria-haspopup\": \"true\",\r\n class: \"sd-popover-trigger\",\r\n },\r\n exportAs: \"sdPopoverTrigger\",\r\n})\r\nexport class PopoverTriggerDirective implements AfterViewInit, OnDestroy {\r\n #overlayRef: OverlayRef | null = null;\r\n #popoverClose$ = Subscription.EMPTY;\r\n #portal: TemplatePortal;\r\n #destroy$ = new Subject();\r\n\r\n popoverOpen = false;\r\n\r\n @Input(\"sdPopoverTriggerFor\")\r\n get popover() {\r\n return this.#popover;\r\n }\r\n set popover(popover: PopoverComponent) {\r\n if (popover === this.#popover) {\r\n return;\r\n }\r\n this.#popover = popover;\r\n this.#popoverClose$.unsubscribe();\r\n if (popover) {\r\n this.#popoverClose$ = popover.closed.subscribe(() => {\r\n this.#destroyPopover();\r\n });\r\n }\r\n }\r\n #popover: PopoverComponent;\r\n\r\n @Input(\"sdPopoverData\")\r\n popoverData: any;\r\n\r\n @Input(\"sdPopoverDisabled\")\r\n disabled: boolean = false;\r\n\r\n @Output() popoverOpened = new EventEmitter<void>();\r\n @Output() popoverClosed = new EventEmitter<void>();\r\n\r\n constructor(\r\n private _overlay: Overlay,\r\n private _element: ElementRef<HTMLElement>,\r\n private _ngZone: NgZone,\r\n private viewContainerRef: ViewContainerRef,\r\n private elementRef: ElementRef,\r\n private platform: Platform,\r\n @Optional() private _dir: Directionality\r\n ) {}\r\n\r\n ngAfterViewInit(): void {\r\n if (this.popover) {\r\n const nativeElement = this.elementRef.nativeElement;\r\n\r\n const hostMouseState$ = merge(\r\n fromEvent(nativeElement, \"mouseenter\").pipe(mapTo(true)),\r\n fromEvent(nativeElement, \"mouseleave\").pipe(mapTo(false))\r\n );\r\n\r\n const popoverMouseState$ = this.popover.mouseState$.pipe(\r\n // chỉ lấy luồng emit open bởi chính trigger (tránh lỗi nhiều trigger cho một popover)\r\n filter((v) => !this.popover.trigger || this.popover.trigger == this)\r\n );\r\n\r\n const mergedMouseState$ = merge(popoverMouseState$, hostMouseState$);\r\n\r\n mergedMouseState$\r\n .pipe(\r\n debounceTime(100),\r\n distinctUntilChanged(),\r\n filter(() => this.platform.isBrowser),\r\n takeUntil(this.#destroy$)\r\n )\r\n .subscribe((visible) => {\r\n if (visible && !this.disabled) {\r\n this.openPopover();\r\n } else {\r\n this.closePopover();\r\n }\r\n });\r\n }\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#destroy$.next();\r\n this.#destroy$.complete();\r\n if (this.#overlayRef) {\r\n this.#overlayRef.dispose();\r\n this.#overlayRef = null;\r\n }\r\n }\r\n\r\n openPopover = () => {\r\n if (this.popoverOpen) {\r\n return;\r\n }\r\n\r\n const overlayRef = this.#createOverlay();\r\n const overlayConfig = overlayRef.getConfig();\r\n const positionStrategy =\r\n overlayConfig.positionStrategy as FlexibleConnectedPositionStrategy;\r\n this.#setPosition(positionStrategy);\r\n overlayConfig.hasBackdrop = false;\r\n overlayRef.attach(this.#getPortal());\r\n this.popover.trigger = this;\r\n this.#setIsPopoverOpen(true);\r\n };\r\n\r\n closePopover = () => {\r\n this.popover.closed.emit();\r\n };\r\n\r\n #setIsPopoverOpen = (isOpen: boolean) => {\r\n this.popoverOpen = isOpen;\r\n this.popoverOpen ? this.popoverOpened.emit() : this.popoverClosed.emit();\r\n };\r\n\r\n #getPortal = (): TemplatePortal => {\r\n if (\r\n !this.#portal ||\r\n this.#portal.templateRef !== this.popover.templateRef ||\r\n this.#portal.context?.data !== this.popoverData\r\n ) {\r\n this.#portal = new TemplatePortal(\r\n this.popover.templateRef,\r\n this.viewContainerRef,\r\n {\r\n data: this.popoverData\r\n }\r\n );\r\n }\r\n\r\n return this.#portal;\r\n };\r\n\r\n #createOverlay = () => {\r\n if (!this.#overlayRef) {\r\n const config = this.#getOverlayConfig();\r\n this.#subscribeToPositions(\r\n config.positionStrategy as FlexibleConnectedPositionStrategy\r\n );\r\n this.#overlayRef = this._overlay.create(config);\r\n }\r\n\r\n return this.#overlayRef;\r\n };\r\n\r\n #setPosition = (positionStrategy: FlexibleConnectedPositionStrategy) => {\r\n let originX: \"start\" | \"center\" | \"end\" = \"center\";\r\n let originY: \"top\" | \"center\" | \"bottom\" = \"top\";\r\n let overlayX: \"start\" | \"center\" | \"end\" = \"center\";\r\n let overlayY: \"top\" | \"center\" | \"bottom\" = \"bottom\";\r\n let offsetX = 0;\r\n let offsetY = 16;\r\n\r\n switch (this.popover.position) {\r\n case \"above\":\r\n originY = \"top\";\r\n overlayY = \"bottom\";\r\n break;\r\n case \"below\":\r\n originY = \"bottom\";\r\n overlayY = \"top\";\r\n break;\r\n }\r\n\r\n positionStrategy.withPositions([\r\n // theo input\r\n { originX, originY, overlayX, overlayY, offsetY: originY == \"top\" ? -offsetY : offsetY },\r\n // giữa trên\r\n {\r\n originX: \"center\",\r\n originY: \"top\",\r\n overlayX: \"center\",\r\n overlayY: \"bottom\",\r\n offsetX,\r\n offsetY: -offsetY,\r\n },\r\n // giữa dưới\r\n {\r\n originX: \"center\",\r\n originY: \"bottom\",\r\n overlayX: \"center\",\r\n overlayY: \"top\",\r\n offsetX,\r\n offsetY,\r\n },\r\n ]);\r\n };\r\n\r\n #getOverlayConfig = () => {\r\n return new OverlayConfig({\r\n positionStrategy: this._overlay\r\n .position()\r\n .flexibleConnectedTo(this._element)\r\n .withLockedPosition()\r\n .withGrowAfterOpen()\r\n .withTransformOriginOn(\".sd-popover-panel\"),\r\n backdropClass: \"cdk-overlay-transparent-backdrop\",\r\n panelClass: this.popover.panelClass,\r\n direction: this._dir,\r\n width: this.popover.width,\r\n height: this.popover.height,\r\n });\r\n };\r\n\r\n #subscribeToPositions = (position: FlexibleConnectedPositionStrategy) => {\r\n if (this.popover.setPositionClasses) {\r\n position.positionChanges.subscribe((change) => {\r\n const pos: Position =\r\n change.connectionPair.overlayY === \"top\" ? \"below\" : \"above\";\r\n\r\n if (this._ngZone) {\r\n this._ngZone.run(() => this.popover.setPositionClasses(pos));\r\n } else {\r\n this.popover.setPositionClasses(pos);\r\n }\r\n\r\n const originElement: HTMLElement = this.elementRef.nativeElement;\r\n const overlayElement: HTMLElement = (\r\n this.viewContainerRef.get(0) as any\r\n )?.rootNodes[0];\r\n if (originElement && overlayElement) {\r\n const originRect = originElement.getBoundingClientRect();\r\n const overlayRect = overlayElement.getBoundingClientRect();\r\n const originLeft = originRect.left + originRect.width / 2;\r\n const overlayLeft = overlayRect.left + overlayRect.width / 2;\r\n\r\n const offset = originLeft - overlayLeft;\r\n\r\n this.popover.addArrowTranslateX(offset);\r\n }\r\n });\r\n }\r\n };\r\n\r\n #destroyPopover = () => {\r\n if (!this.#overlayRef || !this.popoverOpen) {\r\n return;\r\n }\r\n this.#overlayRef.detach();\r\n this.#setIsPopoverOpen(false);\r\n };\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { PopoverComponent } from './popover/popover.component';\r\nimport { PopoverTriggerDirective } from './directives/popover-trigger.directive';\r\nimport { A11yModule } from '@angular/cdk/a11y';\r\nimport { PopoverContentDirective } from './directives/popover-content.directive';\r\n\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n PopoverComponent, \r\n PopoverTriggerDirective, \r\n PopoverContentDirective\r\n ],\r\n imports: [\r\n CommonModule,\r\n A11yModule\r\n ],\r\n exports: [\r\n PopoverComponent, \r\n PopoverTriggerDirective,\r\n PopoverContentDirective\r\n ]\r\n})\r\nexport class SdPopoverModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport { SdPopoverModule } from './lib/popover.module';\r\n\r\nexport * from './lib/popover/popover.component';\r\nexport * from './lib/directives/popover-trigger.directive';\r\nexport * from './lib/directives/popover-content.directive';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;MAKa,uBAAuB;IAElC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YALtD,SAAS,SAAC;gBACT,QAAQ,EAAE,oBAAoB;aAC/B;;;YAJmB,WAAW;;;;MCqClB,gBAAgB;IAqC3B,YACU,KAAwB,EACxB,aAAoC;QADpC,UAAK,GAAL,KAAK,CAAmB;QACxB,kBAAa,GAAb,aAAa,CAAuB;QAtC9C,cAAS,GAA4B,EAAE,CAAC;QACxC,YAAO,GAAG,oBAAoBA,EAAO,EAAE,EAAE,CAAC;QAC1C,qBAAgB,GAAG,KAAK,CAAC;QACzB,gBAAW,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC,CAAC;QAClD,YAAO,GAA4B,IAAI,CAAC;QAM/B,eAAU,GAAW,E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AI,EAAE;oBACJ,eAAe,EAAE,MAAM;oBACvB,KAAK,EAAE,oBAAoB;iBAC5B;gBACD,QAAQ,EAAE,kBAAkB;aAC7B;;;YAxCC,OAAO;YAUP,UAAU;YAGV,MAAM;YAIN,gBAAgB;YAPhB,UAAU;YANH,QAAQ;YAPR,cAAc,uBAsFlB,QAAQ;;;sBAlCV,KAAK,SAAC,qBAAqB;0BAkB3B,KAAK,SAAC,eAAe;uBAGrB,KAAK,SAAC,mBAAmB;4BAGzB,MAAM;4BACN,MAAM;;;MCpDI,eAAe;;;YAhB3B,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,gBAAgB;oBAChB,uBAAuB;oBACvB,uBAAuB;iBACxB;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,UAAU;iBACX;gBACD,OAAO,EAAE;oBACP,gBAAgB;oBAChB,uBAAuB;oBACvB,uBAAuB;iBACxB;aACF;;;ACxBD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-popover.js","sources":["../../../../projects/sd-core/popover/src/lib/directives/popover-content.directive.ts","../../../../projects/sd-core/popover/src/lib/popover/popover.component.ts","../../../../projects/sd-core/popover/src/lib/directives/popover-trigger.directive.ts","../../../../projects/sd-core/popover/src/lib/popover.module.ts","../../../../projects/sd-core/popover/src/public-api.ts","../../../../projects/sd-core/popover/sd-angular-core-popover.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdPopoverContent]'\r\n})\r\nexport class PopoverContentDirective {\r\n\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n ElementRef,\r\n EventEmitter,\r\n HostListener,\r\n Input,\r\n OnDestroy,\r\n OnInit,\r\n Output,\r\n TemplateRef,\r\n ViewChild,\r\n ViewEncapsulation,\r\n OnChanges,\r\n SimpleChanges,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { Position } from '../popover.model';\r\nimport * as uuid from 'uuid';\r\nimport { DeviceDetectorService } from 'ngx-device-detector';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { PopoverTriggerDirective } from '../directives/popover-trigger.directive';\r\nimport { PopoverContentDirective } from '../directives/popover-content.directive';\r\n\r\nexport interface SdPopover {\r\n close: () => void;\r\n}\r\n\r\n@Component({\r\n selector: 'sd-popover',\r\n templateUrl: './popover.component.html',\r\n styleUrls: ['./popover.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n exportAs: 'sdPopover',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PopoverComponent implements SdPopover, OnChanges, OnInit, OnDestroy {\r\n classList: Record<string, boolean> = {};\r\n panelId = `sd-popover-panel-${uuid.v4()}`;\r\n isMobileOrTablet = false;\r\n mouseState$ = new BehaviorSubject<boolean>(false);\r\n trigger: PopoverTriggerDirective = null;\r\n\r\n @ViewChild(TemplateRef) templateRef: TemplateRef<any>;\r\n @ViewChild('panel') panel: ElementRef<HTMLDivElement>;\r\n @ContentChild(PopoverContentDirective) popoverContent: PopoverContentDirective\r\n\r\n @Input() panelClass: string = '';\r\n @Input() width: 'lg' | 'md' | 'sm' | string = 'sm';\r\n @Input() height: string = 'auto';\r\n @Input() type: 'normal' | 'primary' | 'info' | 'success' | 'warning' | 'danger' = 'normal';\r\n @Input()\r\n get position(): Position {\r\n return this.#xPosition;\r\n }\r\n set position(value: Position) {\r\n this.#xPosition = value;\r\n this.setPositionClasses();\r\n }\r\n #xPosition: Position;\r\n\r\n @Output() readonly closed = new EventEmitter<void>();\r\n\r\n @HostListener('document:click', ['$event.target'])\r\n _hostClick(targetElement) {\r\n if (this.panel?.nativeElement) {\r\n const isInside = this.panel.nativeElement.contains(targetElement);\r\n if (!isInside) {\r\n this.setMouseState(false);\r\n }\r\n }\r\n }\r\n\r\n constructor(\r\n private cdRef: ChangeDetectorRef,\r\n private deviceService: DeviceDetectorService\r\n ) {\r\n this.isMobileOrTablet = !deviceService.isDesktop();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if(changes.type) {\r\n const type = changes.type.currentValue;\r\n const preType = changes.type.previousValue;\r\n this.classList = this.classList ?? {\r\n 'sd-popover--normal': true\r\n };\r\n if (preType) {\r\n this.classList[`sd-popover--${preType}`] = false;\r\n }\r\n if (type) {\r\n this.classList[`sd-popover--${type}`] = true;\r\n }\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n this.setPositionClasses();\r\n this.width = this.width || '80vw';\r\n if (!this.isMobileOrTablet) {\r\n switch (this.width) {\r\n case 'lg':\r\n this.width = '80vw';\r\n break;\r\n case 'md':\r\n this.width = '60vw';\r\n break;\r\n case 'sm':\r\n this.width = '40vw';\r\n break;\r\n }\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.closed.complete();\r\n this.mouseState$.complete();\r\n }\r\n\r\n close = () => {\r\n this.mouseState$.next(false);\r\n this.closed.emit();\r\n };\r\n\r\n setPositionClasses = (pos: Position = this.position) => {\r\n const classes = this.classList;\r\n classes['sd-popover-above'] = pos === 'above';\r\n classes['sd-popover-below'] = pos === 'below';\r\n\r\n this.cdRef?.markForCheck();\r\n };\r\n\r\n addArrowTranslateX = (offset: number) => {\r\n const arrowElement: HTMLElement = document.querySelector(`#${this.panelId} .sd-popover-arrow`);\r\n if (arrowElement && offset) {\r\n try {\r\n const style = window.getComputedStyle(arrowElement);\r\n const matrix = new WebKitCSSMatrix(style.transform);\r\n const translateX = matrix.m41 + offset;\r\n const translateY = matrix.m42;\r\n arrowElement.style.transform = `translateX(${translateX}px) translateY(${translateY}px)`;\r\n } catch (error) {}\r\n }\r\n };\r\n\r\n setMouseState = (visible: boolean) => {\r\n if (!visible) {\r\n // chỉ được tắt khi đang không focus element nào bên trong panel\r\n // tránh lỗi có control mở overlay khiến cho mất mouseenter ở panel\r\n const activeElement = document.activeElement;\r\n const panelElement = this.panel.nativeElement;\r\n if (panelElement?.contains(activeElement)) {\r\n return;\r\n }\r\n }\r\n this.mouseState$.next(visible);\r\n };\r\n}\r\n","import { Directionality } from \"@angular/cdk/bidi\";\r\nimport {\r\n FlexibleConnectedPositionStrategy,\r\n Overlay,\r\n OverlayConfig,\r\n OverlayRef,\r\n} from \"@angular/cdk/overlay\";\r\nimport { Platform } from \"@angular/cdk/platform\";\r\nimport { TemplatePortal } from \"@angular/cdk/portal\";\r\nimport {\r\n AfterContentInit,\r\n AfterViewInit,\r\n Directive,\r\n ElementRef,\r\n EventEmitter,\r\n Input,\r\n NgZone,\r\n OnDestroy,\r\n Optional,\r\n Output,\r\n ViewContainerRef,\r\n} from \"@angular/core\";\r\nimport { fromEvent, merge, Subject, Subscription } from \"rxjs\";\r\nimport {\r\n auditTime,\r\n debounceTime,\r\n distinctUntilChanged,\r\n filter,\r\n map,\r\n mapTo,\r\n takeUntil,\r\n tap,\r\n} from \"rxjs/operators\";\r\nimport { Position } from \"../popover.model\";\r\nimport { PopoverComponent } from \"../popover/popover.component\";\r\n\r\n@Directive({\r\n selector: \"[sdPopoverTriggerFor]\",\r\n host: {\r\n \"aria-haspopup\": \"true\",\r\n class: \"sd-popover-trigger\",\r\n },\r\n exportAs: \"sdPopoverTrigger\",\r\n})\r\nexport class PopoverTriggerDirective implements AfterViewInit, OnDestroy {\r\n #overlayRef: OverlayRef | null = null;\r\n #popoverClose$ = Subscription.EMPTY;\r\n #portal: TemplatePortal;\r\n #destroy$ = new Subject();\r\n\r\n popoverOpen = false;\r\n\r\n @Input(\"sdPopoverTriggerFor\")\r\n get popover() {\r\n return this.#popover;\r\n }\r\n set popover(popover: PopoverComponent) {\r\n if (!popover || popover === this.#popover) {\r\n return;\r\n }\r\n this.#popover = popover;\r\n this.#popoverClose$.unsubscribe();\r\n if (popover) {\r\n this.#popoverClose$ = popover.closed.subscribe(() => {\r\n this.#destroyPopover();\r\n });\r\n }\r\n }\r\n #popover: PopoverComponent;\r\n\r\n @Input(\"sdPopoverData\")\r\n popoverData: any;\r\n\r\n @Input(\"sdPopoverDisabled\")\r\n disabled: boolean = false;\r\n\r\n @Output() popoverOpened = new EventEmitter<void>();\r\n @Output() popoverClosed = new EventEmitter<void>();\r\n\r\n constructor(\r\n private _overlay: Overlay,\r\n private _element: ElementRef<HTMLElement>,\r\n private _ngZone: NgZone,\r\n private viewContainerRef: ViewContainerRef,\r\n private elementRef: ElementRef,\r\n private platform: Platform,\r\n @Optional() private _dir: Directionality\r\n ) {}\r\n\r\n ngAfterViewInit(): void {\r\n if (this.popover) {\r\n const nativeElement = this.elementRef.nativeElement;\r\n\r\n const hostMouseState$ = merge(\r\n fromEvent(nativeElement, \"mouseenter\").pipe(mapTo(true)),\r\n fromEvent(nativeElement, \"mouseleave\").pipe(mapTo(false))\r\n );\r\n\r\n const popoverMouseState$ = this.popover.mouseState$.pipe(\r\n // chỉ lấy luồng emit open bởi chính trigger (tránh lỗi nhiều trigger cho một popover)\r\n filter((v) => !this.popover.trigger || this.popover.trigger == this)\r\n );\r\n\r\n const mergedMouseState$ = merge(popoverMouseState$, hostMouseState$);\r\n\r\n mergedMouseState$\r\n .pipe(\r\n debounceTime(100),\r\n distinctUntilChanged(),\r\n filter(() => this.platform.isBrowser),\r\n takeUntil(this.#destroy$)\r\n )\r\n .subscribe((visible) => {\r\n if (visible && !this.disabled) {\r\n this.openPopover();\r\n } else {\r\n this.closePopover();\r\n }\r\n });\r\n }\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#destroy$.next();\r\n this.#destroy$.complete();\r\n if (this.#overlayRef) {\r\n this.#overlayRef.dispose();\r\n this.#overlayRef = null;\r\n }\r\n }\r\n\r\n openPopover = () => {\r\n if (this.popoverOpen) {\r\n return;\r\n }\r\n\r\n const overlayRef = this.#createOverlay();\r\n const overlayConfig = overlayRef.getConfig();\r\n const positionStrategy =\r\n overlayConfig.positionStrategy as FlexibleConnectedPositionStrategy;\r\n this.#setPosition(positionStrategy);\r\n overlayConfig.hasBackdrop = false;\r\n overlayRef.attach(this.#getPortal());\r\n this.popover.trigger = this;\r\n this.#setIsPopoverOpen(true);\r\n };\r\n\r\n closePopover = () => {\r\n this.popover.closed.emit();\r\n };\r\n\r\n #setIsPopoverOpen = (isOpen: boolean) => {\r\n this.popoverOpen = isOpen;\r\n this.popoverOpen ? this.popoverOpened.emit() : this.popoverClosed.emit();\r\n };\r\n\r\n #getPortal = (): TemplatePortal => {\r\n if (\r\n !this.#portal ||\r\n this.#portal.templateRef !== this.popover.templateRef ||\r\n this.#portal.context?.data !== this.popoverData\r\n ) {\r\n this.#portal = new TemplatePortal(\r\n this.popover.templateRef,\r\n this.viewContainerRef,\r\n {\r\n data: this.popoverData\r\n }\r\n );\r\n }\r\n\r\n return this.#portal;\r\n };\r\n\r\n #createOverlay = () => {\r\n if (!this.#overlayRef) {\r\n const config = this.#getOverlayConfig();\r\n this.#subscribeToPositions(\r\n config.positionStrategy as FlexibleConnectedPositionStrategy\r\n );\r\n this.#overlayRef = this._overlay.create(config);\r\n }\r\n\r\n return this.#overlayRef;\r\n };\r\n\r\n #setPosition = (positionStrategy: FlexibleConnectedPositionStrategy) => {\r\n let originX: \"start\" | \"center\" | \"end\" = \"center\";\r\n let originY: \"top\" | \"center\" | \"bottom\" = \"top\";\r\n let overlayX: \"start\" | \"center\" | \"end\" = \"center\";\r\n let overlayY: \"top\" | \"center\" | \"bottom\" = \"bottom\";\r\n let offsetX = 0;\r\n let offsetY = 16;\r\n\r\n switch (this.popover.position) {\r\n case \"above\":\r\n originY = \"top\";\r\n overlayY = \"bottom\";\r\n break;\r\n case \"below\":\r\n originY = \"bottom\";\r\n overlayY = \"top\";\r\n break;\r\n }\r\n\r\n positionStrategy.withPositions([\r\n // theo input\r\n { originX, originY, overlayX, overlayY, offsetY: originY == \"top\" ? -offsetY : offsetY },\r\n // giữa trên\r\n {\r\n originX: \"center\",\r\n originY: \"top\",\r\n overlayX: \"center\",\r\n overlayY: \"bottom\",\r\n offsetX,\r\n offsetY: -offsetY,\r\n },\r\n // giữa dưới\r\n {\r\n originX: \"center\",\r\n originY: \"bottom\",\r\n overlayX: \"center\",\r\n overlayY: \"top\",\r\n offsetX,\r\n offsetY,\r\n },\r\n ]);\r\n };\r\n\r\n #getOverlayConfig = () => {\r\n return new OverlayConfig({\r\n positionStrategy: this._overlay\r\n .position()\r\n .flexibleConnectedTo(this._element)\r\n .withLockedPosition()\r\n .withGrowAfterOpen()\r\n .withTransformOriginOn(\".sd-popover-panel\"),\r\n backdropClass: \"cdk-overlay-transparent-backdrop\",\r\n panelClass: this.popover.panelClass,\r\n direction: this._dir,\r\n width: this.popover.width,\r\n height: this.popover.height,\r\n });\r\n };\r\n\r\n #subscribeToPositions = (position: FlexibleConnectedPositionStrategy) => {\r\n if (this.popover.setPositionClasses) {\r\n position.positionChanges.subscribe((change) => {\r\n const pos: Position =\r\n change.connectionPair.overlayY === \"top\" ? \"below\" : \"above\";\r\n\r\n if (this._ngZone) {\r\n this._ngZone.run(() => this.popover.setPositionClasses(pos));\r\n } else {\r\n this.popover.setPositionClasses(pos);\r\n }\r\n\r\n const originElement: HTMLElement = this.elementRef.nativeElement;\r\n const overlayElement: HTMLElement = (\r\n this.viewContainerRef.get(0) as any\r\n )?.rootNodes[0];\r\n if (originElement && overlayElement) {\r\n const originRect = originElement.getBoundingClientRect();\r\n const overlayRect = overlayElement.getBoundingClientRect();\r\n const originLeft = originRect.left + originRect.width / 2;\r\n const overlayLeft = overlayRect.left + overlayRect.width / 2;\r\n\r\n const offset = originLeft - overlayLeft;\r\n\r\n this.popover.addArrowTranslateX(offset);\r\n }\r\n });\r\n }\r\n };\r\n\r\n #destroyPopover = () => {\r\n if (!this.#overlayRef || !this.popoverOpen) {\r\n return;\r\n }\r\n this.#overlayRef.detach();\r\n this.#setIsPopoverOpen(false);\r\n };\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { PopoverComponent } from './popover/popover.component';\r\nimport { PopoverTriggerDirective } from './directives/popover-trigger.directive';\r\nimport { A11yModule } from '@angular/cdk/a11y';\r\nimport { PopoverContentDirective } from './directives/popover-content.directive';\r\n\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n PopoverComponent, \r\n PopoverTriggerDirective, \r\n PopoverContentDirective\r\n ],\r\n imports: [\r\n CommonModule,\r\n A11yModule\r\n ],\r\n exports: [\r\n PopoverComponent, \r\n PopoverTriggerDirective,\r\n PopoverContentDirective\r\n ]\r\n})\r\nexport class SdPopoverModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport { SdPopoverModule } from './lib/popover.module';\r\n\r\nexport * from './lib/popover/popover.component';\r\nexport * from './lib/directives/popover-trigger.directive';\r\nexport * from './lib/directives/popover-content.directive';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;MAKa,uBAAuB;IAElC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YALtD,SAAS,SAAC;gBACT,QAAQ,EAAE,oBAAoB;aAC/B;;;YAJmB,WAAW;;;;MCqClB,gBAAgB;IAqC3B,YACU,KAAwB,EACxB,aAAoC;QADpC,UAAK,GAAL,KAAK,CAAmB;QACxB,kBAAa,GAAb,aAAa,CAAuB;QAtC9C,cAAS,GAA4B,EAAE,CAAC;QACxC,YAAO,GAAG,oBAAoBA,EAAO,EAAE,EAAE,CAAC;QAC1C,qBAAgB,GAAG,KAAK,CAAC;QACzB,gBAAW,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC,CAAC;QAClD,YAAO,GAA4B,IAAI,CAAC;QAM/B,eAAU,GAAW,EAAE,CAAC;QACxB,UAAK,GAAgC,IAAI,CAAC;QAC1C,WAAM,GAAW,MAAM,CAAC;QACxB,SAAI,GAAqE,QAAQ,CAAC;QAS3F,6BAAqB;QAEF,WAAM,GAAG,IAAI,YAAY,EAAQ,CAAC;QA0DrD,UAAK,GAAG;YACN,IAAI,CAAC,WA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PR,cAAc,uBAsFlB,QAAQ;;;sBAlCV,KAAK,SAAC,qBAAqB;0BAkB3B,KAAK,SAAC,eAAe;uBAGrB,KAAK,SAAC,mBAAmB;4BAGzB,MAAM;4BACN,MAAM;;;MCpDI,eAAe;;;YAhB3B,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,gBAAgB;oBAChB,uBAAuB;oBACvB,uBAAuB;iBACxB;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,UAAU;iBACX;gBACD,OAAO,EAAE;oBACP,gBAAgB;oBAChB,uBAAuB;oBACvB,uBAAuB;iBACxB;aACF;;;ACxBD;;;;ACAA;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter, Component, ChangeDetectorRef, Inject, Optional, ViewChild, Output, NgModule } from '@angular/core';
|
|
1
|
+
import { EventEmitter, Component, ChangeDetectorRef, Inject, Optional, ViewChild, Input, Output, NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
@@ -17,6 +17,9 @@ class SdSelectEditor extends SdSelect {
|
|
|
17
17
|
super(cdRef, formConfiguration);
|
|
18
18
|
this.cdRef = cdRef;
|
|
19
19
|
this.formConfiguration = formConfiguration;
|
|
20
|
+
this.addable = true;
|
|
21
|
+
this.editable = true;
|
|
22
|
+
this.deletable = true;
|
|
20
23
|
this.sdAdd = new EventEmitter();
|
|
21
24
|
this.sdEdit = new EventEmitter();
|
|
22
25
|
this.sdDelete = new EventEmitter();
|
|
@@ -46,7 +49,7 @@ class SdSelectEditor extends SdSelect {
|
|
|
46
49
|
SdSelectEditor.decorators = [
|
|
47
50
|
{ type: Component, args: [{
|
|
48
51
|
selector: "sd-select-editor",
|
|
49
|
-
template: "<label *ngIf=\"!appearance && label\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</span></label>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n[class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n<ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n</ng-container>\r\n<ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n</ng-template>\r\n</div>",
|
|
52
|
+
template: "<label *ngIf=\"!appearance && label\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</span></label>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n[class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n<ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n</ng-container>\r\n<ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"addable && sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"addable && sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n</ng-template>\r\n</div>",
|
|
50
53
|
styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field mat-select.mat-select-disabled .mat-select-value{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}.sd__option--add{background-color:#fff;bottom:0;color:rgba(0,0,0,.87);cursor:pointer;position:-webkit-sticky;position:sticky;z-index:10}"]
|
|
51
54
|
},] }
|
|
52
55
|
];
|
|
@@ -56,6 +59,9 @@ SdSelectEditor.ctorParameters = () => [
|
|
|
56
59
|
];
|
|
57
60
|
SdSelectEditor.propDecorators = {
|
|
58
61
|
matSelect: [{ type: ViewChild, args: [MatSelect,] }],
|
|
62
|
+
addable: [{ type: Input }],
|
|
63
|
+
editable: [{ type: Input }],
|
|
64
|
+
deletable: [{ type: Input }],
|
|
59
65
|
sdAdd: [{ type: Output }],
|
|
60
66
|
sdEdit: [{ type: Output }],
|
|
61
67
|
sdDelete: [{ type: Output }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-select-editor.js","sources":["../../../../projects/sd-core/select-editor/src/lib/select-editor.component.ts","../../../../projects/sd-core/select-editor/src/lib/select-editor.module.ts","../../../../projects/sd-core/select-editor/src/public-api.ts","../../../../projects/sd-core/select-editor/sd-angular-core-select-editor.ts"],"sourcesContent":["import {\r\n Component,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n OnInit,\r\n ViewChild,\r\n Optional,\r\n Inject,\r\n} from \"@angular/core\";\r\nimport { MatSelect } from \"@angular/material/select\";\r\nimport {\r\n FORM_CONFIG,\r\n IFormConfiguration\r\n} from \"@sd-angular/core/common\";\r\nimport { SdSelect } from \"@sd-angular/core/select\";\r\n\r\n@Component({\r\n selector: \"sd-select-editor\",\r\n templateUrl: \"./select-editor.component.html\",\r\n styleUrls: [\"./select-editor.component.scss\"],\r\n})\r\nexport class SdSelectEditor extends SdSelect implements OnInit, OnDestroy {\r\n @ViewChild(MatSelect) matSelect: MatSelect;\r\n\r\n @Output() sdAdd = new EventEmitter();\r\n @Output() sdEdit = new EventEmitter<any>();\r\n @Output() sdDelete = new EventEmitter<any>();\r\n\r\n constructor(\r\n private cdRef: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG)\r\n @Optional()\r\n private formConfiguration: IFormConfiguration\r\n ) {\r\n super(cdRef, formConfiguration);\r\n }\r\n\r\n onAdd = ($event: Event) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdAdd.emit();\r\n };\r\n\r\n onEdit = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdEdit.emit(item);\r\n };\r\n\r\n onDelete = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdDelete.emit(item);\r\n };\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdSelectEditor } from './select-editor.component';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdSelectModule } from '@sd-angular/core/select';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatSelectModule,\r\n SdTranslateModule,\r\n MatCheckboxModule,\r\n MatProgressSpinnerModule,\r\n SdCommonModule,\r\n SdSelectModule\r\n ],\r\n declarations: [\r\n SdSelectEditor\r\n ],\r\n exports: [\r\n SdSelectEditor\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdSelectEditorModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/select-editor.module';\r\nexport * from './lib/select-editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"sd-angular-core-select-editor.js","sources":["../../../../projects/sd-core/select-editor/src/lib/select-editor.component.ts","../../../../projects/sd-core/select-editor/src/lib/select-editor.module.ts","../../../../projects/sd-core/select-editor/src/public-api.ts","../../../../projects/sd-core/select-editor/sd-angular-core-select-editor.ts"],"sourcesContent":["import {\r\n Component,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n OnInit,\r\n ViewChild,\r\n Optional,\r\n Inject,\r\n Input,\r\n} from \"@angular/core\";\r\nimport { MatSelect } from \"@angular/material/select\";\r\nimport {\r\n FORM_CONFIG,\r\n IFormConfiguration\r\n} from \"@sd-angular/core/common\";\r\nimport { SdSelect } from \"@sd-angular/core/select\";\r\n\r\n@Component({\r\n selector: \"sd-select-editor\",\r\n templateUrl: \"./select-editor.component.html\",\r\n styleUrls: [\"./select-editor.component.scss\"],\r\n})\r\nexport class SdSelectEditor extends SdSelect implements OnInit, OnDestroy {\r\n @ViewChild(MatSelect) matSelect: MatSelect;\r\n\r\n @Input() addable: boolean = true;\r\n @Input() editable: boolean = true;\r\n @Input() deletable: boolean = true;\r\n\r\n @Output() sdAdd = new EventEmitter();\r\n @Output() sdEdit = new EventEmitter<any>();\r\n @Output() sdDelete = new EventEmitter<any>();\r\n\r\n constructor(\r\n private cdRef: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG)\r\n @Optional()\r\n private formConfiguration: IFormConfiguration\r\n ) {\r\n super(cdRef, formConfiguration);\r\n }\r\n\r\n onAdd = ($event: Event) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdAdd.emit();\r\n };\r\n\r\n onEdit = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdEdit.emit(item);\r\n };\r\n\r\n onDelete = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdDelete.emit(item);\r\n };\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdSelectEditor } from './select-editor.component';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdSelectModule } from '@sd-angular/core/select';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatSelectModule,\r\n SdTranslateModule,\r\n MatCheckboxModule,\r\n MatProgressSpinnerModule,\r\n SdCommonModule,\r\n SdSelectModule\r\n ],\r\n declarations: [\r\n SdSelectEditor\r\n ],\r\n exports: [\r\n SdSelectEditor\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdSelectEditorModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/select-editor.module';\r\nexport * from './lib/select-editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAwBa,cAAe,SAAQ,QAAQ;IAW1C,YACU,KAAwB,EAGxB,iBAAqC;QAE7C,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QALxB,UAAK,GA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