@sd-angular/core 1.3.224 → 1.3.226

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.
Files changed (43) hide show
  1. package/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
  2. package/bundles/sd-angular-core-autocomplete.umd.js +1 -1
  3. package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
  4. package/bundles/sd-angular-core-autocomplete.umd.min.js +2 -2
  5. package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
  6. package/bundles/sd-angular-core-date-time.umd.js +1 -1
  7. package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
  8. package/bundles/sd-angular-core-date-time.umd.min.js +1 -1
  9. package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
  10. package/bundles/sd-angular-core-input-number.umd.js +1 -1
  11. package/bundles/sd-angular-core-input-number.umd.js.map +1 -1
  12. package/bundles/sd-angular-core-input-number.umd.min.js +1 -1
  13. package/bundles/sd-angular-core-input-number.umd.min.js.map +1 -1
  14. package/bundles/sd-angular-core-input.umd.js +1 -1
  15. package/bundles/sd-angular-core-input.umd.js.map +1 -1
  16. package/bundles/sd-angular-core-input.umd.min.js +1 -1
  17. package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
  18. package/bundles/sd-angular-core-select.umd.js +0 -1
  19. package/bundles/sd-angular-core-select.umd.js.map +1 -1
  20. package/bundles/sd-angular-core-select.umd.min.js +1 -1
  21. package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
  22. package/date-time/sd-angular-core-date-time.metadata.json +1 -1
  23. package/esm2015/autocomplete/src/lib/autocomplete.component.js +2 -2
  24. package/esm2015/date-time/src/lib/date-time.component.js +2 -2
  25. package/esm2015/input/src/lib/input.component.js +2 -2
  26. package/esm2015/input-number/src/lib/input-number.component.js +2 -2
  27. package/esm2015/select/src/lib/select.component.js +1 -3
  28. package/fesm2015/sd-angular-core-autocomplete.js +1 -1
  29. package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
  30. package/fesm2015/sd-angular-core-date-time.js +1 -1
  31. package/fesm2015/sd-angular-core-date-time.js.map +1 -1
  32. package/fesm2015/sd-angular-core-input-number.js +1 -1
  33. package/fesm2015/sd-angular-core-input-number.js.map +1 -1
  34. package/fesm2015/sd-angular-core-input.js +1 -1
  35. package/fesm2015/sd-angular-core-input.js.map +1 -1
  36. package/fesm2015/sd-angular-core-select.js +1 -2
  37. package/fesm2015/sd-angular-core-select.js.map +1 -1
  38. package/input/sd-angular-core-input.metadata.json +1 -1
  39. package/input-number/sd-angular-core-input-number.metadata.json +1 -1
  40. package/package.json +1 -1
  41. package/{sd-angular-core-1.3.224.tgz → sd-angular-core-1.3.226.tgz} +0 -0
  42. package/select/sd-angular-core-select.metadata.json +1 -1
  43. package/select/src/lib/select.component.d.ts +1 -3
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-date-time.js","sources":["../../../../projects/sd-core/date-time/src/lib/date-time.component.ts","../../../../projects/sd-core/date-time/src/lib/date-time.module.ts","../../../../projects/sd-core/date-time/sd-angular-core-date-time.ts"],"sourcesContent":["import {\r\n Component,\r\n Input,\r\n EventEmitter,\r\n Output,\r\n OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n OnInit,\r\n ViewChild,\r\n ChangeDetectionStrategy,\r\n ContentChild,\r\n ElementRef,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport moment, { Moment } from 'moment';\r\nimport { AbstractControl, FormGroup, NgForm, ValidatorFn, Validators } from '@angular/forms';\r\nimport { DeviceDetectorService } from 'ngx-device-detector';\r\nimport { MatDatepicker, MatDatepickerInputEvent } from '@angular/material/datepicker';\r\nimport { NgxMatDatetimePicker, NGX_MAT_DATE_FORMATS, } from '@angular-material-components/datetime-picker';\r\nimport { MAT_DATE_FORMATS } from '@angular/material/core';\r\nimport { Subscription } from 'rxjs';\r\nimport { FORM_CONFIG, IFormConfiguration, SdFormControl, SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\nimport { SdLabelDefDirective } from '@sd-angular/core/common';\r\n\r\nconst CUSTOM_DATETIME_FORMATS = {\r\n parse: {\r\n dateInput: 'DD/MM/YYYY HH:mm'\r\n },\r\n display: {\r\n dateInput: 'DD/MM/YYYY HH:mm',\r\n monthYearLabel: 'MMM YYYY',\r\n dateA11yLabel: 'LL',\r\n monthYearA11yLabel: 'MMMM YYYY'\r\n }\r\n};\r\nconst CUSTOM_DATE_FORMATS = {\r\n parse: {\r\n dateInput: 'DD/MM/YYYY'\r\n },\r\n display: {\r\n dateInput: 'DD/MM/YYYY',\r\n monthYearLabel: 'MMM YYYY',\r\n dateA11yLabel: 'LL',\r\n monthYearA11yLabel: 'MMMM YYYY'\r\n }\r\n};\r\n@Component({\r\n selector: 'sd-date-time',\r\n templateUrl: './date-time.component.html',\r\n styleUrls: ['./date-time.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n providers: [\r\n { provide: MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },\r\n { provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATETIME_FORMATS }\r\n ]\r\n})\r\nexport class SdDateTime implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n isMobileOrTablet = false;\r\n #date: any;\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 disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n formControl = new SdFormControl();\r\n min: Date;\r\n @Input('min') set _min(val: string | Date | number) {\r\n if (Date.isDate(val)) {\r\n this.min = new Date(val);\r\n } else {\r\n this.min = null;\r\n }\r\n }\r\n max: Date;\r\n @Input('max') set _max(val: string | Date | number) {\r\n if (Date.isDate(val)) {\r\n this.max = new Date(val);\r\n } else {\r\n this.max = null;\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 maxlength: number;\r\n type: 'datetime' | 'date' | 'time' | 'month' = 'datetime';\r\n @Input('type') set _type(val: 'datetime' | 'date' | 'time' | 'month') {\r\n this.type = val || 'datetime';\r\n }\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 required = false;\r\n @Input('required') set _required(val: boolean | '') {\r\n this.required = (val === '') || val;\r\n if (this.required) {\r\n this.formControl.setValidators([Validators.required]);\r\n } else {\r\n this.formControl.clearValidators();\r\n }\r\n }\r\n\r\n inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\r\n // this.#updateValidator();\r\n if (this.inlineError) {\r\n \r\n\r\n this.formControl.setValidators([this.customInlineErrorValidator()]);\r\n this.formControl.updateValueAndValidity();\r\n\r\n } else {\r\n this.formControl.clearValidators();\r\n this.formControl.updateValueAndValidity();\r\n\r\n }\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-date-time',\r\n label: val\r\n });\r\n };\r\n @Input() placeholder: string;\r\n @Input() defaultTime: any;\r\n @Input() set minDate(val: string | Date) {\r\n if (Date.isDate(val)) {\r\n this.min = new Date(val);\r\n } else {\r\n this.min = null;\r\n }\r\n }\r\n @Input() set maxDate(val: string | Date) {\r\n if (Date.isDate(val)) {\r\n this.max = new Date(val);\r\n } else {\r\n this.max = null;\r\n }\r\n }\r\n @Input() validator: (value: any) => string | Promise<string>;\r\n @Output() sdChange = new EventEmitter();\r\n\r\n @Input() set model(val: any) {\r\n if (!Date.isDate(val)) {\r\n val = null;\r\n }\r\n if (this.#date !== val) {\r\n this.#date = val;\r\n const date = Date.isDate(this.#date) ? moment(Date.toFormat(this.#date, 'MM/dd/yyyy HH:mm:ss'), 'MM/DD/YYYY HH:mm:ss') : null;\r\n this.formControl.setValue(date);\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n @ViewChild('input') input: ElementRef;\r\n @ViewChild(MatDatepicker) datePicker: MatDatepicker<Moment>;\r\n @ViewChild(NgxMatDatetimePicker) dateTimePicker: NgxMatDatetimePicker<Moment>;\r\n isFocused = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n deviceService: DeviceDetectorService,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration) {\r\n this.isMobileOrTablet = !deviceService.isDesktop();\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 ngOnInit() {\r\n this.maxlength = this.type === 'datetime' ? 16 : 10;\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n // this.formControl.updateValueAndValidity();\r\n this.ref.markForCheck();\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n \r\n // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n ngAfterViewInit() {\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\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.input?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.input?.nativeElement?.focus();\r\n if (this.type === 'date') {\r\n this.datePicker?.open();\r\n } else {\r\n this.dateTimePicker?.open();\r\n }\r\n //\r\n }, 100);\r\n }\r\n\r\n focusInputElement() {\r\n this.input?.nativeElement?.focus();\r\n }\r\n\r\n isValid: boolean;\r\n onKeyDown = (event: KeyboardEvent) => {\r\n const key = event.keyCode || event.charCode;\r\n let isShift = false;\r\n if (key == 16) {\r\n isShift = true;\r\n }\r\n //Allow only Numeric Keys.\r\n if (((key >= 48 && key <= 57) || key == 8 || key <= 37 || key <= 39 || (key >= 96 && key <= 105) || key == 191 || key == 186 || key == 59) && isShift == false) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n\r\n onKeyup = (event) => {\r\n const currentVal: string = event.target.value;\r\n const formControl: AbstractControl = this.formControl;\r\n let regex = /^([1-9]|([012][0-9])|(3[01]))\\/([0]{0,1}[1-9]|1[012])\\/\\d\\d\\d\\d$/g;\r\n\r\n if (this.type === 'datetime' || this.type === 'time') {\r\n regex = /^([1-9]|([012][0-9])|(3[01]))\\/([0]{0,1}[1-9]|1[012])\\/\\d\\d\\d\\d [012]{0,1}[0-9]:[0-6][0-9]$/g;\r\n }\r\n if (this.type === 'month') {\r\n regex = /^([0]{0,1}[1-9]|1[012])\\/\\d\\d\\d\\d [012]{0,1}[0-9]:[0-6][0-9]$/g;\r\n }\r\n\r\n const errorMessage = this.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm';\r\n if (currentVal && !regex.test(currentVal)) {\r\n setTimeout(() => {\r\n this.isValid = true;\r\n formControl.markAsDirty();\r\n formControl.markAsTouched();\r\n formControl.setErrors({ ...formControl.errors, date: `Chưa đúng định dạng ${errorMessage}` });\r\n }, 0);\r\n\r\n } else {\r\n setTimeout(() => {\r\n this.isValid = false;\r\n formControl.setErrors({ ...formControl.errors, date: null });\r\n this.formControl.updateValueAndValidity();\r\n }, 0);\r\n }\r\n }\r\n\r\n onChange = (event: MatDatepickerInputEvent<Moment>) => {\r\n const value = event.value?.toDate();\r\n if (!this.dateTimePicker) {\r\n this.input?.nativeElement?.focus();\r\n }\r\n if (!this.isValid) {\r\n if (new Date(this.#date) !== value) {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n } else {\r\n this.isValid = false;\r\n this.formControl.setValue(null);\r\n this.modelChange.emit(null);\r\n this.sdChange.emit(null);\r\n }\r\n }\r\n\r\n timeChanged = (event) => {\r\n const value = event;\r\n this.formControl.setValue(value);\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n \r\n }\r\n\r\n clear = ($event: any) => {\r\n $event?.stopPropagation();\r\n if (this.formControl.value) {\r\n this.formControl.setValue(null);\r\n this.modelChange.emit(null);\r\n this.sdChange.emit(null);\r\n }\r\n }\r\n\r\n setMonthAndYear = (normalizedMonthAndYear: Moment, datepicker: MatDatepicker<Moment>) => {\r\n const ctrlValue = this.formControl.value || moment();\r\n ctrlValue.month(normalizedMonthAndYear.month());\r\n ctrlValue.year(normalizedMonthAndYear.year());\r\n this.formControl.setValue(ctrlValue);\r\n datepicker.close();\r\n this.modelChange.emit(ctrlValue);\r\n this.sdChange.emit(ctrlValue);\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 { MatDatepickerModule } from '@angular/material/datepicker';\r\nimport {\r\n NgxMatDatetimePickerModule,\r\n NgxMatTimepickerModule\r\n} from '@angular-material-components/datetime-picker';\r\nimport { SdDateTime } from './date-time.component';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { NgxMatMomentModule } from '@angular-material-components/moment-adapter';\r\nimport { MatMomentDateModule } from '@angular/material-moment-adapter';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\nimport { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatFormFieldModule,\r\n MatDatepickerModule,\r\n MatMomentDateModule,\r\n NgxMatDatetimePickerModule,\r\n NgxMatTimepickerModule,\r\n NgxMatMomentModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n NgxMaterialTimepickerModule,\r\n SdButtonModule\r\n ],\r\n declarations: [\r\n SdDateTime\r\n ],\r\n exports: [\r\n SdCommonModule,\r\n SdDateTime\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdDateTimeModule {\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE;QACL,SAAS,EAAE,kBAAkB;KAC9B;IACD,OAAO,EAAE;QACP,SAAS,EAAE,kBAAkB;QAC7B,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,IAAI;QACnB,kBAAkB,EAAE,WAAW;KAChC;CACF,CAAC;AACF,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE;QACL,SAAS,EAAE,YAAY;KACxB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,YAAY;QACvB,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,IAAI;QACnB,kBAAkB,EAAE,WAAW;K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
1
+ {"version":3,"file":"sd-angular-core-date-time.js","sources":["../../../../projects/sd-core/date-time/src/lib/date-time.component.ts","../../../../projects/sd-core/date-time/src/lib/date-time.module.ts","../../../../projects/sd-core/date-time/sd-angular-core-date-time.ts"],"sourcesContent":["import {\r\n Component,\r\n Input,\r\n EventEmitter,\r\n Output,\r\n OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n OnInit,\r\n ViewChild,\r\n ChangeDetectionStrategy,\r\n ContentChild,\r\n ElementRef,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport moment, { Moment } from 'moment';\r\nimport { AbstractControl, FormGroup, NgForm, ValidatorFn, Validators } from '@angular/forms';\r\nimport { DeviceDetectorService } from 'ngx-device-detector';\r\nimport { MatDatepicker, MatDatepickerInputEvent } from '@angular/material/datepicker';\r\nimport { NgxMatDatetimePicker, NGX_MAT_DATE_FORMATS, } from '@angular-material-components/datetime-picker';\r\nimport { MAT_DATE_FORMATS } from '@angular/material/core';\r\nimport { Subscription } from 'rxjs';\r\nimport { FORM_CONFIG, IFormConfiguration, SdFormControl, SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\nimport { SdLabelDefDirective } from '@sd-angular/core/common';\r\n\r\nconst CUSTOM_DATETIME_FORMATS = {\r\n parse: {\r\n dateInput: 'DD/MM/YYYY HH:mm'\r\n },\r\n display: {\r\n dateInput: 'DD/MM/YYYY HH:mm',\r\n monthYearLabel: 'MMM YYYY',\r\n dateA11yLabel: 'LL',\r\n monthYearA11yLabel: 'MMMM YYYY'\r\n }\r\n};\r\nconst CUSTOM_DATE_FORMATS = {\r\n parse: {\r\n dateInput: 'DD/MM/YYYY'\r\n },\r\n display: {\r\n dateInput: 'DD/MM/YYYY',\r\n monthYearLabel: 'MMM YYYY',\r\n dateA11yLabel: 'LL',\r\n monthYearA11yLabel: 'MMMM YYYY'\r\n }\r\n};\r\n@Component({\r\n selector: 'sd-date-time',\r\n templateUrl: './date-time.component.html',\r\n styleUrls: ['./date-time.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n providers: [\r\n { provide: MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },\r\n { provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATETIME_FORMATS }\r\n ]\r\n})\r\nexport class SdDateTime implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n isMobileOrTablet = false;\r\n #date: any;\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 disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n formControl = new SdFormControl();\r\n min: Date;\r\n @Input('min') set _min(val: string | Date | number) {\r\n if (Date.isDate(val)) {\r\n this.min = new Date(val);\r\n } else {\r\n this.min = null;\r\n }\r\n }\r\n max: Date;\r\n @Input('max') set _max(val: string | Date | number) {\r\n if (Date.isDate(val)) {\r\n this.max = new Date(val);\r\n } else {\r\n this.max = null;\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 maxlength: number;\r\n type: 'datetime' | 'date' | 'time' | 'month' = 'datetime';\r\n @Input('type') set _type(val: 'datetime' | 'date' | 'time' | 'month') {\r\n this.type = val || 'datetime';\r\n }\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 required = false;\r\n @Input('required') set _required(val: boolean | '') {\r\n this.required = (val === '') || val;\r\n if (this.required) {\r\n this.formControl.setValidators([Validators.required]);\r\n } else {\r\n this.formControl.clearValidators();\r\n }\r\n }\r\n\r\n inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\r\n // this.#updateValidator();\r\n if (this.inlineError) {\r\n \r\n\r\n this.formControl.setValidators([this.customInlineErrorValidator()]);\r\n this.formControl.updateValueAndValidity();\r\n\r\n } else {\r\n this.formControl.clearValidators();\r\n this.formControl.updateValueAndValidity();\r\n\r\n }\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-date-time',\r\n label: val\r\n });\r\n };\r\n @Input() placeholder: string;\r\n @Input() defaultTime: any;\r\n @Input() set minDate(val: string | Date) {\r\n if (Date.isDate(val)) {\r\n this.min = new Date(val);\r\n } else {\r\n this.min = null;\r\n }\r\n }\r\n @Input() set maxDate(val: string | Date) {\r\n if (Date.isDate(val)) {\r\n this.max = new Date(val);\r\n } else {\r\n this.max = null;\r\n }\r\n }\r\n @Input() validator: (value: any) => string | Promise<string>;\r\n @Output() sdChange = new EventEmitter();\r\n\r\n @Input() set model(val: any) {\r\n if (!Date.isDate(val)) {\r\n val = null;\r\n }\r\n if (this.#date !== val) {\r\n this.#date = val;\r\n const date = Date.isDate(this.#date) ? moment(Date.toFormat(this.#date, 'MM/dd/yyyy HH:mm:ss'), 'MM/DD/YYYY HH:mm:ss') : null;\r\n this.formControl.setValue(date);\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n @ViewChild('input') input: ElementRef;\r\n @ViewChild(MatDatepicker) datePicker: MatDatepicker<Moment>;\r\n @ViewChild(NgxMatDatetimePicker) dateTimePicker: NgxMatDatetimePicker<Moment>;\r\n isFocused = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n deviceService: DeviceDetectorService,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration) {\r\n this.isMobileOrTablet = !deviceService.isDesktop();\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 ngOnInit() {\r\n this.maxlength = this.type === 'datetime' ? 16 : 10;\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n // this.formControl.updateValueAndValidity();\r\n this.ref.markForCheck();\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n \r\n // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n ngAfterViewInit() {\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\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.input?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.input?.nativeElement?.focus();\r\n if (this.type === 'date') {\r\n this.datePicker?.open();\r\n } else {\r\n this.dateTimePicker?.open();\r\n }\r\n //\r\n }, 100);\r\n }\r\n\r\n focusInputElement() {\r\n this.input?.nativeElement?.focus();\r\n }\r\n\r\n isValid: boolean;\r\n onKeyDown = (event: KeyboardEvent) => {\r\n const key = event.keyCode || event.charCode;\r\n let isShift = false;\r\n if (key == 16) {\r\n isShift = true;\r\n }\r\n //Allow only Numeric Keys.\r\n if (((key >= 48 && key <= 57) || key == 8 || key <= 37 || key <= 39 || (key >= 96 && key <= 105) || key == 191 || key == 186 || key == 59) && isShift == false) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n\r\n onKeyup = (event) => {\r\n const currentVal: string = event.target.value;\r\n const formControl: AbstractControl = this.formControl;\r\n let regex = /^([1-9]|([012][0-9])|(3[01]))\\/([0]{0,1}[1-9]|1[012])\\/\\d\\d\\d\\d$/g;\r\n\r\n if (this.type === 'datetime' || this.type === 'time') {\r\n regex = /^([1-9]|([012][0-9])|(3[01]))\\/([0]{0,1}[1-9]|1[012])\\/\\d\\d\\d\\d [012]{0,1}[0-9]:[0-6][0-9]$/g;\r\n }\r\n if (this.type === 'month') {\r\n regex = /^([0]{0,1}[1-9]|1[012])\\/\\d\\d\\d\\d [012]{0,1}[0-9]:[0-6][0-9]$/g;\r\n }\r\n\r\n const errorMessage = this.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm';\r\n if (currentVal && !regex.test(currentVal)) {\r\n setTimeout(() => {\r\n this.isValid = true;\r\n formControl.markAsDirty();\r\n formControl.markAsTouched();\r\n formControl.setErrors({ ...formControl.errors, date: `Chưa đúng định dạng ${errorMessage}` });\r\n }, 0);\r\n\r\n } else {\r\n setTimeout(() => {\r\n this.isValid = false;\r\n formControl.setErrors({ ...formControl.errors, date: null });\r\n this.formControl.updateValueAndValidity();\r\n }, 0);\r\n }\r\n }\r\n\r\n onChange = (event: MatDatepickerInputEvent<Moment>) => {\r\n const value = event.value?.toDate();\r\n if (!this.dateTimePicker) {\r\n this.input?.nativeElement?.focus();\r\n }\r\n if (!this.isValid) {\r\n if (new Date(this.#date) !== value) {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n } else {\r\n this.isValid = false;\r\n this.formControl.setValue(null);\r\n this.modelChange.emit(null);\r\n this.sdChange.emit(null);\r\n }\r\n }\r\n\r\n timeChanged = (event) => {\r\n const value = event;\r\n this.formControl.setValue(value);\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n \r\n }\r\n\r\n clear = ($event: any) => {\r\n $event?.stopPropagation();\r\n if (this.formControl.value) {\r\n this.formControl.setValue(null);\r\n this.modelChange.emit(null);\r\n this.sdChange.emit(null);\r\n }\r\n }\r\n\r\n setMonthAndYear = (normalizedMonthAndYear: Moment, datepicker: MatDatepicker<Moment>) => {\r\n const ctrlValue = this.formControl.value || moment();\r\n ctrlValue.month(normalizedMonthAndYear.month());\r\n ctrlValue.year(normalizedMonthAndYear.year());\r\n this.formControl.setValue(ctrlValue);\r\n datepicker.close();\r\n this.modelChange.emit(ctrlValue);\r\n this.sdChange.emit(ctrlValue);\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 { MatDatepickerModule } from '@angular/material/datepicker';\r\nimport {\r\n NgxMatDatetimePickerModule,\r\n NgxMatTimepickerModule\r\n} from '@angular-material-components/datetime-picker';\r\nimport { SdDateTime } from './date-time.component';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { NgxMatMomentModule } from '@angular-material-components/moment-adapter';\r\nimport { MatMomentDateModule } from '@angular/material-moment-adapter';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\nimport { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatFormFieldModule,\r\n MatDatepickerModule,\r\n MatMomentDateModule,\r\n NgxMatDatetimePickerModule,\r\n NgxMatTimepickerModule,\r\n NgxMatMomentModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n NgxMaterialTimepickerModule,\r\n SdButtonModule\r\n ],\r\n declarations: [\r\n SdDateTime\r\n ],\r\n exports: [\r\n SdCommonModule,\r\n SdDateTime\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdDateTimeModule {\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE;QACL,SAAS,EAAE,kBAAkB;KAC9B;IACD,OAAO,EAAE;QACP,SAAS,EAAE,kBAAkB;QAC7B,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,IAAI;QACnB,kBAAkB,EAAE,WAAW;KAChC;CACF,CAAC;AACF,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE;QACL,SAAS,EAAE,YAAY;KACxB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,YAAY;QACvB,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,IAAI;QACnB,kBAAkB,EAAE,WAAW;KAChC;CACF,CAAC;WAOyC,mBAAmB,OACf,uBAAuB;MAGzD,UAAU;IAmIrB,YACU,GAAsB,EAC9B,aAAoC,EACK,UAA8B;QAF/D,QAAG,GAAH,GAAG,CAAmB;QAEW,eAAU,GAAV,UAAU,CAAoB;QArIzE,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,qBAAgB,GAAG,KAAK,CAAC;QACzB,wBAAW;QACX,gBAAQA,EAAO,EAAE,EAAC;QAOlB,wBAAmB,GAAG,KAAK,CAAC;QAK5B,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;QAkBlC,wBAAiB;QAWjB,SAAI,GAA2C,UAAU,CAAC;QAY1D,aAAQ,GAAG,KAAK,CAAC;QAsDP,aAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAY9B,gBAAW,GAAG,IAAI,YAAY,EAAE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Aa;qBAmBnB,KAAK,SAAC,OAAO;0BAOb,KAAK;0BACL,KAAK;sBACL,KAAK;sBAOL,KAAK;wBAOL,KAAK;uBACL,MAAM;oBAEN,KAAK;0BAUL,MAAM;qBAEN,YAAY,SAAC,kBAAkB;yBAC/B,YAAY,SAAC,mBAAmB;oBAChC,SAAS,SAAC,OAAO;yBACjB,SAAS,SAAC,aAAa;6BACvB,SAAS,SAAC,oBAAoB;;;MC7IpB,gBAAgB;;;YA7B5B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,cAAc;oBACd,aAAa;oBACb,kBAAkB;oBAClB,mBAAmB;oBACnB,mBAAmB;oBACnB,0BAA0B;oBAC1B,sBAAsB;oBACtB,kBAAkB;oBAClB,iBAAiB;oBACjB,cAAc;oBACd,eAAe;oBACf,2BAA2B;oBAC3B,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,UAAU;iBACX;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,UAAU;iBACX;gBACD,SAAS,EAAE,EACV;aACF;;;AChDD;;;;;;"}
@@ -383,7 +383,7 @@ _name = new WeakMap(), _form = new WeakMap(), _blurOnEnter_1 = new WeakMap(), _m
383
383
  SdInputNumber.decorators = [
384
384
  { type: Component, args: [{
385
385
  selector: 'sd-input-number',
386
- template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" 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 aria-hidden=\"true\" [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 [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\"\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 <svg \r\n #copyTooltip=\"matTooltip\" \r\n *ngIf=\"copyable\" \r\n matSuffix \r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\" \r\n class=\"icon-copy\" \r\n focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\" \r\n (click)=\"onCopyText()\">\r\n <path d=\"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z\"></path>\r\n </svg>\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?.min\"> \r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Kh\u00F4ng nh\u1EADp b\u00E9 h\u01A1n '}} <strong>{{minNumber}}</strong></ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.max\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Kh\u00F4ng nh\u1EADp l\u1EDBn h\u01A1n '}} <strong>{{maxNumber}}</strong></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-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</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> -->",
386
+ template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" 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 aria-hidden=\"true\" [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 [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\"\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 <ng-content select=\"[sdSuffixIcon]\" matSuffix></ng-content>\r\n <svg \r\n #copyTooltip=\"matTooltip\" \r\n *ngIf=\"copyable\" \r\n matSuffix \r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\" \r\n class=\"icon-copy\" \r\n focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\" \r\n (click)=\"onCopyText()\">\r\n <path d=\"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z\"></path>\r\n </svg>\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?.min\"> \r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Kh\u00F4ng nh\u1EADp b\u00E9 h\u01A1n '}} <strong>{{minNumber}}</strong></ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.max\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Kh\u00F4ng nh\u1EADp l\u1EDBn h\u01A1n '}} <strong>{{maxNumber}}</strong></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-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</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> -->",
387
387
  changeDetection: ChangeDetectionStrategy.OnPush,
388
388
  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}:host ::ng-deep .mat-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-form-field .icon-copy{cursor:pointer;fill:rgba(0,0,0,.5);height:.9em;opacity:0;transition:opacity .2s linear;width:.9em}.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}"]
389
389
  },] }
@@ -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 SimpleChanges,\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 hash from 'object-hash';\r\n\r\nimport { Subscription } from 'rxjs';\r\nimport { SdFormControl, SdSuffixDirective } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\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\nimport { SdLabelDefDirective } from '@sd-angular/core/common';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { MatTooltip } from '@angular/material/tooltip';\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 @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 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-number',\r\n label: val\r\n });\r\n };\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(this.#model, {\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.#getValueWithFormat(val), {\r\n emitEvent: false\r\n });\r\n } else {\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\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 @Input() type: 'negative' | 'positive'; //negative: chỉ nhập số âm, positive: chỉ số dương\r\n @Input() precision: number = 3; //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 minNumber: number;\r\n @Input() set min(val: number) {\r\n this.minNumber = val;\r\n this.#updateValidator();\r\n }\r\n\r\n maxNumber: number;\r\n @Input() set max(val: number) {\r\n this.maxNumber = val;\r\n this.#updateValidator();\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 inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\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 @ViewChild('copyTooltip') copyTooltip: MatTooltip;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n copied = false;\r\n\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdBlur = 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 @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n isFocused = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration) {\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 }\r\n\r\n private get regex() {\r\n let result = `(([0-9]+(\\\\.[0-9])?)+(\\\\,[0-9]{0,${this.precision}}){0,1})$`;\r\n if (this.precision === 0) {\r\n result = `(([0-9]+(\\\\.[0-9])?)+)$`;\r\n }\r\n if (this.type === 'negative') {\r\n result = `[-]${result}`;\r\n }\r\n if (!this.type) {\r\n result = `[-]?${result}`;\r\n }\r\n return result;\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.inputControl.valueChanges.subscribe(() => {\r\n const val = this.inputControl.value;\r\n if (!val) {\r\n this.#onChange(undefined);\r\n return;\r\n }\r\n const value = this.#toNumber(val);\r\n if (!isNaN(value)) {\r\n this.inputControl.setValue(this.#getValueWithFormat(val), {\r\n emitEvent: false\r\n });\r\n this.#onChange(value);\r\n }\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n #getValueWithFormat = (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 = (text: any) => {\r\n return Number.toVNCurrency((text?.toString() || '').replace(/\\./g, ''));\r\n // const arrs: string[] = (text?.toString() || '').replace(/\\./g, '').split('');\r\n // return arrs.reverse().reduce((acc, num, index) => {\r\n // return num + (num !== '-' && index && !(index % 3) ? '.' : '') + acc;\r\n // }, '');\r\n }\r\n\r\n #toNumber = (text: any) => +((text?.toString() || '').replace(/\\./g, '').replace(/,/g, '.'));\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.minNumber || this.minNumber === 0) {\r\n validators.push(Validators.min(this.minNumber));\r\n }\r\n if (this.maxNumber || this.maxNumber === 0) {\r\n validators.push(Validators.max(this.maxNumber));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n if (this.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\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 // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.#model = value ?? null;\r\n this.modelChange.emit(this.#model);\r\n this.sdChange.emit(this.#model);\r\n this.formControl.setValue(this.#model);\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: KeyboardEvent) => {\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 || key == 35 || key == 36 || key == 9) {\r\n return;\r\n }\r\n if (event.ctrlKey && (event.key == 'c' || event.key == 'x' || event.key == 'a')) {\r\n return;\r\n }\r\n if (event.shiftKey && key == 9) {\r\n return;\r\n }\r\n this.#checkValue(event, event.key);\r\n }\r\n\r\n onPaste(event: ClipboardEvent) {\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 // if(this.maxNumber === +current.toString().replace(/\\./g, '').replace(/,/g, '.')){\r\n // event.preventDefault();\r\n // return;\r\n // }\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 !== 'positive' && newval === '-') {\r\n return;\r\n }\r\n const regExp: RegExp = new RegExp(`^${this.regex}`, '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.maxNumber || this.maxNumber === 0) && +value > this.maxNumber) {\r\n // setTimeout(() => {\r\n // this.inputControl.setValue(this.#getValueWithFormat(this.maxNumber.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 const 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 this.sdBlur.emit(this.formControl.value);\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 onCopyText() {\r\n SdUtility.copyToClipboard(this.inputControl.value);\r\n this.copied = true;\r\n setTimeout(() => {\r\n this.copied = false;\r\n }, 2000);\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":";;;;;;;;;;;;;;;;;AAgCA,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,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C,aAAa;wBAEvB,KAAK,SAAC,UAAU;uBAKhB,MAAM;sBACN,MAAM;qBACN,MAAM;+BACN,MAAM;yBACN,MAAM;sBAEN,SAAS,SAAC,SAAS;qBAMnB,YAAY,SAAC,kBAAkB;uBAC/B,YAAY,SAAC,iBAAiB;yBAC9B,YAAY,SAAC,mBAAmB;;;MC9ItB,mBAAmB;;;YAnB/B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,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,OAAO,EAAE;oBACP,aAAa;iBACd;aACF;;;AC/BD;;;;ACAA;;;;;;"}
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 SimpleChanges,\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 hash from 'object-hash';\r\n\r\nimport { Subscription } from 'rxjs';\r\nimport { SdFormControl, SdSuffixDirective } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\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\nimport { SdLabelDefDirective } from '@sd-angular/core/common';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { MatTooltip } from '@angular/material/tooltip';\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 @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 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-number',\r\n label: val\r\n });\r\n };\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(this.#model, {\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.#getValueWithFormat(val), {\r\n emitEvent: false\r\n });\r\n } else {\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\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 @Input() type: 'negative' | 'positive'; //negative: chỉ nhập số âm, positive: chỉ số dương\r\n @Input() precision: number = 3; //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 minNumber: number;\r\n @Input() set min(val: number) {\r\n this.minNumber = val;\r\n this.#updateValidator();\r\n }\r\n\r\n maxNumber: number;\r\n @Input() set max(val: number) {\r\n this.maxNumber = val;\r\n this.#updateValidator();\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 inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\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 @ViewChild('copyTooltip') copyTooltip: MatTooltip;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n copied = false;\r\n\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdBlur = 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 @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n isFocused = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration) {\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 }\r\n\r\n private get regex() {\r\n let result = `(([0-9]+(\\\\.[0-9])?)+(\\\\,[0-9]{0,${this.precision}}){0,1})$`;\r\n if (this.precision === 0) {\r\n result = `(([0-9]+(\\\\.[0-9])?)+)$`;\r\n }\r\n if (this.type === 'negative') {\r\n result = `[-]${result}`;\r\n }\r\n if (!this.type) {\r\n result = `[-]?${result}`;\r\n }\r\n return result;\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.inputControl.valueChanges.subscribe(() => {\r\n const val = this.inputControl.value;\r\n if (!val) {\r\n this.#onChange(undefined);\r\n return;\r\n }\r\n const value = this.#toNumber(val);\r\n if (!isNaN(value)) {\r\n this.inputControl.setValue(this.#getValueWithFormat(val), {\r\n emitEvent: false\r\n });\r\n this.#onChange(value);\r\n }\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n #getValueWithFormat = (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 = (text: any) => {\r\n return Number.toVNCurrency((text?.toString() || '').replace(/\\./g, ''));\r\n // const arrs: string[] = (text?.toString() || '').replace(/\\./g, '').split('');\r\n // return arrs.reverse().reduce((acc, num, index) => {\r\n // return num + (num !== '-' && index && !(index % 3) ? '.' : '') + acc;\r\n // }, '');\r\n }\r\n\r\n #toNumber = (text: any) => +((text?.toString() || '').replace(/\\./g, '').replace(/,/g, '.'));\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.minNumber || this.minNumber === 0) {\r\n validators.push(Validators.min(this.minNumber));\r\n }\r\n if (this.maxNumber || this.maxNumber === 0) {\r\n validators.push(Validators.max(this.maxNumber));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n if (this.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\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 // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.#model = value ?? null;\r\n this.modelChange.emit(this.#model);\r\n this.sdChange.emit(this.#model);\r\n this.formControl.setValue(this.#model);\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: KeyboardEvent) => {\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 || key == 35 || key == 36 || key == 9) {\r\n return;\r\n }\r\n if (event.ctrlKey && (event.key == 'c' || event.key == 'x' || event.key == 'a')) {\r\n return;\r\n }\r\n if (event.shiftKey && key == 9) {\r\n return;\r\n }\r\n this.#checkValue(event, event.key);\r\n }\r\n\r\n onPaste(event: ClipboardEvent) {\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 // if(this.maxNumber === +current.toString().replace(/\\./g, '').replace(/,/g, '.')){\r\n // event.preventDefault();\r\n // return;\r\n // }\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 !== 'positive' && newval === '-') {\r\n return;\r\n }\r\n const regExp: RegExp = new RegExp(`^${this.regex}`, '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.maxNumber || this.maxNumber === 0) && +value > this.maxNumber) {\r\n // setTimeout(() => {\r\n // this.inputControl.setValue(this.#getValueWithFormat(this.maxNumber.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 const 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 this.sdBlur.emit(this.formControl.value);\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 onCopyText() {\r\n SdUtility.copyToClipboard(this.inputControl.value);\r\n this.copied = true;\r\n setTimeout(() => {\r\n this.copied = false;\r\n }, 2000);\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":";;;;;;;;;;;;;;;;;AAgCA,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;IAmIxB,YACU,GAAsB,EACW,UAA8B;QAD/D,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QApIzE,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAOlB,wBAAiB;QAoBjB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C;gBACR,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,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,OAAO,EAAE;oBACP,aAAa;iBACd;aACF;;;AC/BD;;;;ACAA;;;;;;"}
@@ -293,7 +293,7 @@ _name = new WeakMap(), _form = new WeakMap(), _blurOnEnter_1 = new WeakMap(), _m
293
293
  SdInput.decorators = [
294
294
  { type: Component, args: [{
295
295
  selector: 'sd-input',
296
- template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" 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 aria-hidden=\"true\" [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 <svg \r\n #copyTooltip=\"matTooltip\" \r\n *ngIf=\"copyable\" \r\n matSuffix \r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\" \r\n class=\"icon-copy\" \r\n focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\" \r\n (click)=\"onCopyText()\">\r\n <path d=\"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z\"></path>\r\n </svg>\r\n <span class=\"mr-1\" *ngIf=\"maxlength && !formControl.disabled\" 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-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n\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> -->",
296
+ template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" 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 aria-hidden=\"true\" [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 <svg \r\n #copyTooltip=\"matTooltip\" \r\n *ngIf=\"copyable\" \r\n matSuffix \r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\" \r\n class=\"icon-copy\" \r\n focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\" \r\n (click)=\"onCopyText()\">\r\n <path d=\"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z\"></path>\r\n </svg>\r\n <span class=\"mr-1\" *ngIf=\"maxlength && !formControl.disabled\" 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 <ng-content select=\"[sdSuffixIcon]\" matSuffix></ng-content>\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-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n\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> -->",
297
297
  changeDetection: ChangeDetectionStrategy.OnPush,
298
298
  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}:host ::ng-deep .mat-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-form-field .icon-copy{cursor:pointer;fill:rgba(0,0,0,.5);height:.9em;opacity:0;transition:opacity .2s linear;width:.9em}.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}"]
299
299
  },] }
@@ -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, filter } 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, SdLabelDefDirective } 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 { MatTooltip } from '@angular/material/tooltip';\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 \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 inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\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() sdBlur = 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 @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('copyTooltip') copyTooltip: MatTooltip;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n copied = 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.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.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\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.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\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 \r\n // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(this.formControl.value);\r\n this.sdChange.emit(this.formControl.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 \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 this.sdBlur.emit(this.formControl.value);\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 onCopyText() {\r\n SdUtility.copyToClipboard(this.#model);\r\n this.copied = true;\r\n setTimeout(() => {\r\n this.copied = false;\r\n }, 2000);\r\n }\r\n}\r\n\r\nexport function backendErrorValidator(backendErrorMessage: string): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n const value = control.value as string;\r\n\r\n if (value === backendErrorMessage) {\r\n return { backendError: true };\r\n }\r\n\r\n return null;\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 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;;;;MCoClB,OAAO;IA+HlB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QAjI1C,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;;QAI3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,GAAG,KAAK,CAAC;QAenB,2BAAiB;QAKjB,6BAAqD;QAqB5C,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,WAAM,GAAG,IAAI,YAAY,EAAO,CAAC;QACjC,qBAAgB,GAAG,IAAI,YAAY,EAAO,CAAC;QAC3C,eAAU,GAAG,IAAI,YAAY,EAAE,CAAC;QAM1C,gBAAW,GAAG,IAAI,aAAa,EAAE,CAA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AAQ,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, filter } 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, SdLabelDefDirective } 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 { MatTooltip } from '@angular/material/tooltip';\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 \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 inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\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() sdBlur = 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 @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('copyTooltip') copyTooltip: MatTooltip;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n copied = 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.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.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\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.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\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 \r\n // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(this.formControl.value);\r\n this.sdChange.emit(this.formControl.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 \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 this.sdBlur.emit(this.formControl.value);\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 onCopyText() {\r\n SdUtility.copyToClipboard(this.#model);\r\n this.copied = true;\r\n setTimeout(() => {\r\n this.copied = false;\r\n }, 2000);\r\n }\r\n}\r\n\r\nexport function backendErrorValidator(backendErrorMessage: string): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n const value = control.value as string;\r\n\r\n if (value === backendErrorMessage) {\r\n return { backendError: true };\r\n }\r\n\r\n return null;\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 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;;;;MCoClB,OAAO;IA+HlB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QAjI1C,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;;QAI3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,G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I,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,IAAG,OAAO,CAAC,KAAK,EAAC;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;SACzB;KACF;;;YAXF,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;;;;;;"}
@@ -7,7 +7,7 @@ import { MatIconModule } from '@angular/material/icon';
7
7
  import { MatTooltipModule } from '@angular/material/tooltip';
8
8
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
9
9
  import { __classPrivateFieldGet, __awaiter, __classPrivateFieldSet } from 'tslib';
10
- import { SdFormControl, FORM_CONFIG, SdSuffixIconDirective, SdLabelDefDirective, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
10
+ import { SdFormControl, FORM_CONFIG, SdLabelDefDirective, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
11
11
  import hash from 'object-hash';
12
12
  import { Subject, BehaviorSubject, Subscription, combineLatest } from 'rxjs';
13
13
  import { startWith, debounceTime, switchMap, map } from 'rxjs/operators';
@@ -498,7 +498,6 @@ SdSelect.propDecorators = {
498
498
  _multiple: [{ type: Input, args: ['multiple',] }],
499
499
  limit: [{ type: Input }],
500
500
  _filtered: [{ type: Input, args: ['filtered',] }],
501
- sdSuffixIcon: [{ type: ContentChild, args: [SdSuffixIconDirective,] }],
502
501
  selectDisplayDef: [{ type: ContentChild, args: [SdSelectDisplayDefDirective,] }],
503
502
  _selectAll: [{ type: Input, args: ['selectAll',] }],
504
503
  copyTooltip: [{ type: ViewChild, args: ['copyTooltip',] }],