@sd-angular/core 0.0.1006 → 0.0.1007
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
- package/autocomplete/src/lib/autocomplete.component.d.ts +9 -5
- package/bundles/sd-angular-core-autocomplete.umd.js +34 -29
- package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js +2 -2
- package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-common.umd.js +42 -4
- package/bundles/sd-angular-core-common.umd.js.map +1 -1
- package/bundles/sd-angular-core-common.umd.min.js +3 -2
- package/bundles/sd-angular-core-common.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-input.umd.js +25 -5
- package/bundles/sd-angular-core-input.umd.js.map +1 -1
- package/bundles/sd-angular-core-input.umd.min.js +2 -2
- package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
- package/common/sd-angular-core-common.metadata.json +1 -1
- package/common/src/lib/common.module.d.ts +2 -0
- package/common/src/lib/directives/view-def.directive.d.ts +5 -0
- package/common/src/public-api.d.ts +2 -0
- package/esm2015/autocomplete/src/lib/autocomplete.component.js +35 -26
- package/esm2015/autocomplete/src/lib/autocomplete.module.js +4 -2
- package/esm2015/common/src/lib/common.module.js +20 -0
- package/esm2015/common/src/lib/directives/view-def.directive.js +16 -0
- package/esm2015/common/src/public-api.js +3 -1
- package/esm2015/input/src/lib/input.component.js +23 -4
- package/esm2015/input/src/lib/input.module.js +6 -3
- package/fesm2015/sd-angular-core-autocomplete.js +35 -26
- package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
- package/fesm2015/sd-angular-core-common.js +35 -1
- package/fesm2015/sd-angular-core-common.js.map +1 -1
- package/fesm2015/sd-angular-core-input.js +26 -6
- package/fesm2015/sd-angular-core-input.js.map +1 -1
- package/input/sd-angular-core-input.metadata.json +1 -1
- package/input/src/lib/input.component.d.ts +5 -0
- package/package.json +1 -1
- package/{sd-angular-core-0.0.1006.tgz → sd-angular-core-0.0.1007.tgz} +0 -0
|
@@ -9,7 +9,7 @@ import { v4 } from 'uuid';
|
|
|
9
9
|
import { Subscription } from 'rxjs';
|
|
10
10
|
import { SdUtilityService } from '@sd-angular/core/utility';
|
|
11
11
|
import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
12
|
-
import { SdFormControl } from '@sd-angular/core/common';
|
|
12
|
+
import { SdFormControl, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
|
|
13
13
|
import '@sd-angular/core/typing';
|
|
14
14
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
15
|
import { SdTranslateModule } from '@sd-angular/core/translate';
|
|
@@ -63,6 +63,7 @@ class SdAutocomplete {
|
|
|
63
63
|
this.isRequired = false;
|
|
64
64
|
this.disableErrorMessage = false;
|
|
65
65
|
_subscription.set(this, new Subscription());
|
|
66
|
+
this.isFocused = false;
|
|
66
67
|
_loadItems.set(this, (searchText, items) => __awaiter(this, void 0, void 0, function* () {
|
|
67
68
|
this.loading = true;
|
|
68
69
|
return yield items(searchText).finally(() => this.loading = false);
|
|
@@ -71,6 +72,7 @@ class SdAutocomplete {
|
|
|
71
72
|
}));
|
|
72
73
|
this.onSelect = (item) => {
|
|
73
74
|
if (item) {
|
|
75
|
+
this.selectedItem = item;
|
|
74
76
|
if (typeof (item) === 'string' || typeof (item) === 'number') {
|
|
75
77
|
if (this.formControl.value !== item) {
|
|
76
78
|
this.formControl.setValue(item);
|
|
@@ -89,21 +91,40 @@ class SdAutocomplete {
|
|
|
89
91
|
this.inputControl.setValue('', {
|
|
90
92
|
emitEvent: false
|
|
91
93
|
});
|
|
92
|
-
// this.ref.markForCheck();
|
|
93
|
-
// this.inputControl.setValue('', {
|
|
94
|
-
// emitEvent: false
|
|
95
|
-
// });
|
|
96
94
|
}
|
|
97
95
|
};
|
|
98
96
|
this.onFocus = () => {
|
|
97
|
+
this.isFocused = true;
|
|
99
98
|
this.inputControl.setValue('');
|
|
100
99
|
// this.inputControl.updateValueAndValidity();
|
|
101
100
|
};
|
|
102
101
|
this.onBlur = () => {
|
|
102
|
+
this.isFocused = false;
|
|
103
103
|
this.inputControl.setValue('', {
|
|
104
104
|
emitEvent: false
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
|
+
this.onClick = () => {
|
|
108
|
+
var _a;
|
|
109
|
+
if ((_a = this.sdView) === null || _a === void 0 ? void 0 : _a.templateRef) {
|
|
110
|
+
if (!this.formControl.disabled && !this.isFocused) {
|
|
111
|
+
this.focus();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
this.blur = () => {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
(_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.blur();
|
|
118
|
+
// $(this.input.nativeElement).trigger('blur');
|
|
119
|
+
};
|
|
120
|
+
this.focus = () => {
|
|
121
|
+
this.isFocused = true;
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
(_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
|
|
125
|
+
// $(this.input.nativeElement).trigger('focus');
|
|
126
|
+
}, 100);
|
|
127
|
+
};
|
|
107
128
|
this.clear = ($event) => {
|
|
108
129
|
var _a;
|
|
109
130
|
$event === null || $event === void 0 ? void 0 : $event.stopPropagation();
|
|
@@ -124,21 +145,6 @@ class SdAutocomplete {
|
|
|
124
145
|
this.inputControl.updateValueAndValidity({ emitEvent: true });
|
|
125
146
|
};
|
|
126
147
|
}
|
|
127
|
-
get isNumber() {
|
|
128
|
-
var _a;
|
|
129
|
-
if (__classPrivateFieldGet(this, _model) || __classPrivateFieldGet(this, _model) === 0) {
|
|
130
|
-
return typeof (__classPrivateFieldGet(this, _model)) === 'number';
|
|
131
|
-
}
|
|
132
|
-
if ((_a = __classPrivateFieldGet(this, _currentItems)) === null || _a === void 0 ? void 0 : _a.length) {
|
|
133
|
-
if (this.valueField) {
|
|
134
|
-
return typeof (__classPrivateFieldGet(this, _currentItems)[0][this.valueField]) === 'number';
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
return typeof (__classPrivateFieldGet(this, _currentItems)[0]) === 'number';
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
148
|
set form(val) {
|
|
143
149
|
if (val) {
|
|
144
150
|
if (val instanceof NgForm) {
|
|
@@ -171,9 +177,11 @@ class SdAutocomplete {
|
|
|
171
177
|
val = (val === '') || val;
|
|
172
178
|
if (val) {
|
|
173
179
|
this.inputControl.disable();
|
|
180
|
+
this.formControl.disable();
|
|
174
181
|
}
|
|
175
182
|
else {
|
|
176
183
|
this.inputControl.enable();
|
|
184
|
+
this.formControl.disable();
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
set required(val) {
|
|
@@ -253,9 +261,9 @@ _model = new WeakMap(), _items = new WeakMap(), _currentItems = new WeakMap(), _
|
|
|
253
261
|
SdAutocomplete.decorators = [
|
|
254
262
|
{ type: Component, args: [{
|
|
255
263
|
selector: 'sd-autocomplete',
|
|
256
|
-
template: "<div class=\"d-flex align-items-center\"
|
|
264
|
+
template: "<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, selectedItem: selectedItem }\">\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 [floatLabel]=\"size === 'sm' || formControl.value ? 'always':'auto'\" appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{ label }}</mat-label>\r\n <input [id]=\"id\" #autocompleteTrigger [formControl]=\"inputControl\" [placeholder]=\"controlPlaceHolder | async\"\r\n [ngClass]=\"{'c-selected': formControl?.value}\" [matAutocomplete]=\"auto\" (focus)=\"onFocus()\" (blur)=\"onBlur()\"\r\n matInput [autocomplete]=\"id\" autocorrect=\"off\" [errorStateMatcher]=\"matcher\" [required]=\"isRequired\" #input />\r\n <mat-icon *ngIf=\"!loading && formControl?.value && !inputControl.disabled\" class=\"pointer sd-suffix-icon\"\r\n (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-icon *ngIf=\"actionIcon && !loading && !formControl?.value && !inputControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"onAction($event)\" matSuffix>{{actionIcon}}\r\n </mat-icon>\r\n <mat-spinner *ngIf=\"loading\" strokeWidth=\"2\" mode=\"indeterminate\" diameter=\"18\" value=\"100\" matSuffix>\r\n </mat-spinner>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onSelect($event.option.value)\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"displayField ? item[displayField] : item\">\r\n <ng-container *ngIf=\"autocompleteDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"autocompleteDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!autocompleteDisplayDef?.templateRef\">\r\n {{ displayField ? item[displayField] : item }}\r\n </ng-container>\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-error *ngIf=\"formControl?.errors?.required && !disableErrorMessage\">\r\n {{ \"This field is required\" | sdTranslate }}\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
|
|
257
265
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
258
|
-
styles: [":host{display:block;padding-top:5px}: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.c-selected::-moz-placeholder{color:#000;opacity:1}:host ::ng-deep .mat-form-field input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected::-moz-placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected::placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected:-ms-input-placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected::-ms-input-placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}"]
|
|
266
|
+
styles: [":host{display:block;padding-top:5px}: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.c-selected::-moz-placeholder{color:#000;opacity:1}:host ::ng-deep .mat-form-field input.c-selected::placeholder{color:#000;opacity:1}:host ::ng-deep .mat-form-field input.c-selected:-ms-input-placeholder{color:#000}:host ::ng-deep .mat-form-field input.c-selected::-ms-input-placeholder{color:#000}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected::-moz-placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected::placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected:-ms-input-placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field input.mat-input-element:disabled.c-selected::-ms-input-placeholder{color:#4d4d4d}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}"]
|
|
259
267
|
},] }
|
|
260
268
|
];
|
|
261
269
|
SdAutocomplete.ctorParameters = () => [
|
|
@@ -270,8 +278,6 @@ SdAutocomplete.propDecorators = {
|
|
|
270
278
|
valueField: [{ type: Input }],
|
|
271
279
|
displayField: [{ type: Input }],
|
|
272
280
|
placeholder: [{ type: Input }],
|
|
273
|
-
leftLabel: [{ type: Input }],
|
|
274
|
-
labelMinWidth: [{ type: Input }],
|
|
275
281
|
items: [{ type: Input }],
|
|
276
282
|
limit: [{ type: Input }],
|
|
277
283
|
model: [{ type: Input }],
|
|
@@ -282,7 +288,9 @@ SdAutocomplete.propDecorators = {
|
|
|
282
288
|
sdChange: [{ type: Output }],
|
|
283
289
|
disabled: [{ type: Input }],
|
|
284
290
|
required: [{ type: Input }],
|
|
285
|
-
_disableErrorMessage: [{ type: Input, args: ['disableErrorMessage',] }]
|
|
291
|
+
_disableErrorMessage: [{ type: Input, args: ['disableErrorMessage',] }],
|
|
292
|
+
input: [{ type: ViewChild, args: ['input',] }],
|
|
293
|
+
sdView: [{ type: ContentChild, args: [SdViewDefDirective,] }]
|
|
286
294
|
};
|
|
287
295
|
|
|
288
296
|
class SdAutocompleteModule {
|
|
@@ -299,7 +307,8 @@ SdAutocompleteModule.decorators = [
|
|
|
299
307
|
MatAutocompleteModule,
|
|
300
308
|
MatIconModule,
|
|
301
309
|
MatProgressSpinnerModule,
|
|
302
|
-
SdTranslateModule
|
|
310
|
+
SdTranslateModule,
|
|
311
|
+
SdCommonModule
|
|
303
312
|
],
|
|
304
313
|
declarations: [
|
|
305
314
|
SdAutocomplete,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-autocomplete.js","sources":["../../../../projects/sd-core/autocomplete/src/lib/autocomplete-display-def.directive.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.component.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.module.ts","../../../../projects/sd-core/autocomplete/src/public-api.ts","../../../../projects/sd-core/autocomplete/sd-angular-core-autocomplete.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdAutocompleteDisplayDef]'\r\n})\r\nexport class SdAutocompleteDisplayDefDirective {\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 OnInit,\r\n OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n ContentChild,\r\n ChangeDetectionStrategy\r\n} from '@angular/core';\r\nimport { startWith, switchMap, debounceTime, debounce, distinctUntilChanged } from 'rxjs/operators';\r\n\r\nimport * as uuid from 'uuid';\r\nimport { FormControl, NgForm, Validators, FormGroupDirective, FormGroup } from '@angular/forms';\r\nimport { Observable, Subscription } from 'rxjs';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { MatAutocompleteTrigger } from '@angular/material/autocomplete';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\n\r\nclass SdAutocompleteErrotStateMatcher 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\r\n@Component({\r\n selector: 'sd-autocomplete',\r\n templateUrl: './autocomplete.component.html',\r\n styleUrls: ['./autocomplete.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdAutocomplete implements OnInit, OnDestroy, AfterViewInit {\r\n @ViewChild(MatAutocompleteTrigger, { read: MatAutocompleteTrigger }) autocompleteTrigger: MatAutocompleteTrigger;\r\n id = `I${uuid.v4()}`;\r\n #model: string | number;\r\n #items: any[] | ((searchText: string) => Promise<any[]>) = [];\r\n #currentItems: any[] = [];\r\n #delay = 500; // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện gọi hàm\r\n #name = uuid.v4();\r\n loading = false;\r\n inputControl = new FormControl();\r\n formControl = new SdFormControl();\r\n matcher = new SdAutocompleteErrotStateMatcher(this.formControl);\r\n get isNumber() {\r\n if (this.#model || this.#model === 0) {\r\n return typeof (this.#model) === 'number';\r\n }\r\n if (this.#currentItems?.length) {\r\n if (this.valueField) {\r\n return typeof (this.#currentItems[0][this.valueField]) === 'number';\r\n } else {\r\n return typeof (this.#currentItems[0]) === 'number';\r\n }\r\n }\r\n return false;\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n @Input() placeholder: string;\r\n @Input() leftLabel: string;\r\n @Input() labelMinWidth: string;\r\n\r\n @Input() set items(items: undefined | any[] | ((searchText?: string) => Promise<any[]>)) {\r\n if (!items) {\r\n this.#items = [];\r\n } else if (Array.isArray(items)) {\r\n this.#items = items.filter(e => e !== null && e !== undefined);\r\n } else {\r\n this.#items = items;\r\n }\r\n this.formControl.updateValueAndValidity();\r\n this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n @Input() limit = 100;\r\n\r\n filteredItems: Observable<any[]>;\r\n controlPlaceHolder: Observable<string | number>;\r\n @Input() set model(value: undefined | number | string) {\r\n this.#model = value;\r\n this.formControl.setValue(value);\r\n }\r\n\r\n @ContentChild(SdAutocompleteDisplayDefDirective) autocompleteDisplayDef: SdAutocompleteDisplayDefDirective;\r\n @Input() actionIcon: string;\r\n @Output() action = new EventEmitter();\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.inputControl.disable();\r\n } else {\r\n this.inputControl.enable();\r\n }\r\n }\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n if (this.isRequired) {\r\n this.formControl.setValidators([Validators.required]);\r\n } else {\r\n this.formControl.clearValidators();\r\n }\r\n }\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 #subscription = new Subscription();\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() { \r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.statusChanges.subscribe(() => this.ref.markForCheck()));\r\n this.filteredItems = this.inputControl.valueChanges.pipe(\r\n debounceTime(typeof (this.#items) === 'function' ? this.#delay : 0),\r\n // distinctUntilChanged(), Dùng sẽ gây ra bug khi items changes\r\n switchMap(async () => {\r\n const val = this.inputControl.value || '';\r\n if (typeof (this.#items) === 'function') {\r\n const items = await this.#loadItems(val, this.#items);\r\n this.#currentItems = items.filter((item, index) => index < this.limit);\r\n return this.#currentItems;\r\n }\r\n const { changeAliasLowerCase } = this.utilityService;\r\n this.#currentItems = this.#items.filter(item => {\r\n const value = item[this.valueField];\r\n const display = item[this.displayField];\r\n const searchText = changeAliasLowerCase(val);\r\n return changeAliasLowerCase(value).indexOf(searchText) !== -1 || changeAliasLowerCase(display).indexOf(searchText) !== -1\r\n }).filter((item, index) => index < this.limit);\r\n return this.#currentItems;\r\n })\r\n );\r\n this.controlPlaceHolder = this.formControl.valueChanges.pipe(\r\n startWith(''),\r\n // distinctUntilChanged(), Dùng sẽ gây ra bug khi items changes\r\n switchMap(async () => {\r\n const val = this.formControl.value;\r\n if (val || val === 0) {\r\n let currentItems = [];\r\n const items = this.#items;\r\n if (typeof (items) === 'function') {\r\n currentItems = await this.#loadItems(val, items);\r\n } else {\r\n currentItems = items || [];\r\n }\r\n if (this.valueField && this.displayField) {\r\n const item = currentItems.find(e => e[this.valueField] === val);\r\n return item?.[this.displayField] || val;\r\n } else {\r\n return currentItems.find(e => e === val) || val;\r\n }\r\n } else {\r\n return this.placeholder || this.label || '';\r\n }\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n this.#form?.removeControl(this.#name);\r\n }\r\n\r\n #loadItems = async (searchText: string, items: (searchText?: string) => Promise<any[]>) => {\r\n this.loading = true;\r\n return await items(searchText).finally(() => this.loading = false);\r\n // this.ref.detectChanges();\r\n // return this.#previousResults;\r\n }\r\n\r\n onSelect = (item: any) => {\r\n if (item) {\r\n if (typeof (item) === 'string' || typeof (item) === 'number') {\r\n if (this.formControl.value !== item) {\r\n this.formControl.setValue(item);\r\n this.modelChange.emit(item);\r\n this.sdChange.emit(item);\r\n }\r\n } else if (this.valueField && this.displayField) {\r\n const val = item?.[this.valueField] || null;\r\n if (this.formControl.value !== val) {\r\n this.formControl.setValue(val);\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(item);\r\n }\r\n }\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n // this.ref.markForCheck();\r\n // this.inputControl.setValue('', {\r\n // emitEvent: false\r\n // });\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.inputControl.setValue('');\r\n // this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n onBlur = () => {\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n\r\n clear = ($event?: any) => {\r\n $event?.stopPropagation();\r\n this.inputControl?.setValue('');\r\n if (this.#model) {\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 onAction = ($event: Event) => {\r\n $event?.stopPropagation();\r\n this.autocompleteTrigger?.closePanel();\r\n this.action.emit();\r\n }\r\n\r\n reValidate = () => {\r\n this.inputControl.updateValueAndValidity({ emitEvent: true });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { SdAutocomplete } from './autocomplete.component';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport '@sd-angular/core/typing';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatAutocompleteModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective\r\n ],\r\n exports: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdAutocompleteModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/autocomplete.module';\r\nexport * from './lib/autocomplete.component';\r\nexport * from './lib/autocomplete-display-def.directive';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;MAKa,iCAAiC;IAC5C,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,4BAA4B;aACvC;;;YAJmB,WAAW;;;;ACwB/B,MAAM,+BAA+B;IACnC,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;MAQY,cAAc;IA8FzB,YACU,GAAsB,EACtB,cAAgC;QADhC,QAAG,GAAH,GAAG,CAAmB;QACtB,mBAAc,GAAd,cAAc,CAAkB;QA9F1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,yBAAwB;QACxB,iBAA2D,EAAE,EAAC;QAC9D,wBAAuB,EAAE,EAAC;QAC1B,iBAAS,GAAG,EAAC;QACb,gBAAQA,EAAO,EAAE,EAAC;QAClB,YAAO,GAAG,KAAK,CAAC;QAChB,iBAAY,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,YAAO,GAAG,IAAI,+BAA+B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAehE,wBAAiB;QA6BR,UAAK,GAAG,GAAG,CAAC;QAWX,WAAM,GAAG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gBAAgB;oBAChB,kBAAkB;oBAClB,qBAAqB;oBACrB,aAAa;oBACb,wBAAwB;oBACxB,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,cAAc;oBACd,iCAAiC;iBAClC;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,iCAAiC;iBAClC;gBACD,SAAS,EAAE,EACV;aACF;;;ACrCD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-autocomplete.js","sources":["../../../../projects/sd-core/autocomplete/src/lib/autocomplete-display-def.directive.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.component.ts","../../../../projects/sd-core/autocomplete/src/lib/autocomplete.module.ts","../../../../projects/sd-core/autocomplete/src/public-api.ts","../../../../projects/sd-core/autocomplete/sd-angular-core-autocomplete.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdAutocompleteDisplayDef]'\r\n})\r\nexport class SdAutocompleteDisplayDefDirective {\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 OnInit,\r\n OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n ElementRef\r\n} from '@angular/core';\r\nimport { startWith, switchMap, debounceTime, debounce, distinctUntilChanged } from 'rxjs/operators';\r\n\r\nimport * as uuid from 'uuid';\r\n// import $ from 'jquery';\r\nimport { FormControl, NgForm, Validators, FormGroupDirective, FormGroup } from '@angular/forms';\r\nimport { Observable, Subscription } from 'rxjs';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { MatAutocompleteTrigger } from '@angular/material/autocomplete';\r\nimport { SdFormControl, SdViewDefDirective } from '@sd-angular/core/common';\r\n\r\nclass SdAutocompleteErrotStateMatcher 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\r\n@Component({\r\n selector: 'sd-autocomplete',\r\n templateUrl: './autocomplete.component.html',\r\n styleUrls: ['./autocomplete.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdAutocomplete implements OnInit, OnDestroy, AfterViewInit {\r\n @ViewChild(MatAutocompleteTrigger, { read: MatAutocompleteTrigger }) autocompleteTrigger: MatAutocompleteTrigger;\r\n id = `I${uuid.v4()}`;\r\n #model: string | number;\r\n #items: any[] | ((searchText: string) => Promise<any[]>) = [];\r\n #currentItems: any[] = [];\r\n #delay = 500; // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện gọi hàm\r\n #name = uuid.v4();\r\n loading = false;\r\n inputControl = new FormControl();\r\n formControl = new SdFormControl();\r\n matcher = new SdAutocompleteErrotStateMatcher(this.formControl);\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n @Input() placeholder: string;\r\n\r\n @Input() set items(items: undefined | any[] | ((searchText?: string) => Promise<any[]>)) {\r\n if (!items) {\r\n this.#items = [];\r\n } else if (Array.isArray(items)) {\r\n this.#items = items.filter(e => e !== null && e !== undefined);\r\n } else {\r\n this.#items = items;\r\n }\r\n this.formControl.updateValueAndValidity();\r\n this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n @Input() limit = 100;\r\n\r\n filteredItems: Observable<any[]>;\r\n controlPlaceHolder: Observable<string | number>;\r\n @Input() set model(value: undefined | number | string) {\r\n this.#model = value;\r\n this.formControl.setValue(value);\r\n }\r\n\r\n @ContentChild(SdAutocompleteDisplayDefDirective) autocompleteDisplayDef: SdAutocompleteDisplayDefDirective;\r\n @Input() actionIcon: string;\r\n @Output() action = new EventEmitter();\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n\r\n // Optional\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.disable();\r\n }\r\n }\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n if (this.isRequired) {\r\n this.formControl.setValidators([Validators.required]);\r\n } else {\r\n this.formControl.clearValidators();\r\n }\r\n }\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 #subscription = new Subscription();\r\n @ViewChild('input') input: ElementRef;\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n selectedItem: any;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() { \r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.statusChanges.subscribe(() => this.ref.markForCheck()));\r\n this.filteredItems = this.inputControl.valueChanges.pipe(\r\n debounceTime(typeof (this.#items) === 'function' ? this.#delay : 0),\r\n // distinctUntilChanged(), Dùng sẽ gây ra bug khi items changes\r\n switchMap(async () => {\r\n const val = this.inputControl.value || '';\r\n if (typeof (this.#items) === 'function') {\r\n const items = await this.#loadItems(val, this.#items);\r\n this.#currentItems = items.filter((item, index) => index < this.limit);\r\n return this.#currentItems;\r\n }\r\n const { changeAliasLowerCase } = this.utilityService;\r\n this.#currentItems = this.#items.filter(item => {\r\n const value = item[this.valueField];\r\n const display = item[this.displayField];\r\n const searchText = changeAliasLowerCase(val);\r\n return changeAliasLowerCase(value).indexOf(searchText) !== -1 || changeAliasLowerCase(display).indexOf(searchText) !== -1\r\n }).filter((item, index) => index < this.limit);\r\n return this.#currentItems;\r\n })\r\n );\r\n this.controlPlaceHolder = this.formControl.valueChanges.pipe(\r\n startWith(''),\r\n // distinctUntilChanged(), Dùng sẽ gây ra bug khi items changes\r\n switchMap(async () => {\r\n const val = this.formControl.value;\r\n if (val || val === 0) {\r\n let currentItems = [];\r\n const items = this.#items;\r\n if (typeof (items) === 'function') {\r\n currentItems = await this.#loadItems(val, items);\r\n } else {\r\n currentItems = items || [];\r\n }\r\n if (this.valueField && this.displayField) {\r\n const item = currentItems.find(e => e[this.valueField] === val);\r\n return item?.[this.displayField] || val;\r\n } else {\r\n return currentItems.find(e => e === val) || val;\r\n }\r\n } else {\r\n return this.placeholder || this.label || '';\r\n }\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n this.#form?.removeControl(this.#name);\r\n }\r\n\r\n #loadItems = async (searchText: string, items: (searchText?: string) => Promise<any[]>) => {\r\n this.loading = true;\r\n return await items(searchText).finally(() => this.loading = false);\r\n // this.ref.detectChanges();\r\n // return this.#previousResults;\r\n }\r\n\r\n onSelect = (item: any) => {\r\n if (item) {\r\n this.selectedItem = item;\r\n if (typeof (item) === 'string' || typeof (item) === 'number') {\r\n if (this.formControl.value !== item) {\r\n this.formControl.setValue(item);\r\n this.modelChange.emit(item);\r\n this.sdChange.emit(item);\r\n }\r\n } else if (this.valueField && this.displayField) {\r\n const val = item?.[this.valueField] || null;\r\n if (this.formControl.value !== val) {\r\n this.formControl.setValue(val);\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(item);\r\n }\r\n }\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.inputControl.setValue('');\r\n // this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n\r\n onClick = () => {\r\n if(this.sdView?.templateRef) {\r\n if(!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.input?.nativeElement?.blur();\r\n // $(this.input.nativeElement).trigger('blur');\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.input?.nativeElement?.focus();\r\n // $(this.input.nativeElement).trigger('focus');\r\n }, 100);\r\n }\r\n\r\n clear = ($event?: any) => {\r\n $event?.stopPropagation();\r\n this.inputControl?.setValue('');\r\n if (this.#model) {\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 onAction = ($event: Event) => {\r\n $event?.stopPropagation();\r\n this.autocompleteTrigger?.closePanel();\r\n this.action.emit();\r\n }\r\n\r\n reValidate = () => {\r\n this.inputControl.updateValueAndValidity({ emitEvent: true });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { SdAutocomplete } from './autocomplete.component';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport '@sd-angular/core/typing';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdAutocompleteDisplayDefDirective } from './autocomplete-display-def.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatAutocompleteModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n SdTranslateModule,\r\n SdCommonModule\r\n ],\r\n declarations: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective\r\n ],\r\n exports: [\r\n SdAutocomplete,\r\n SdAutocompleteDisplayDefDirective\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdAutocompleteModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/autocomplete.module';\r\nexport * from './lib/autocomplete.component';\r\nexport * from './lib/autocomplete-display-def.directive';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;MAKa,iCAAiC;IAC5C,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,4BAA4B;aACvC;;;YAJmB,WAAW;;;;AC0B/B,MAAM,+BAA+B;IACnC,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;MAQY,cAAc;IAqFzB,YACU,GAAsB,EACtB,cA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CommonModule } from '@angular/common';
|
|
1
3
|
import { FormControl } from '@angular/forms';
|
|
2
4
|
import { Subject } from 'rxjs';
|
|
3
5
|
|
|
6
|
+
class SdViewDefDirective {
|
|
7
|
+
// @Input() sdViewDef: string;
|
|
8
|
+
constructor(templateRef) {
|
|
9
|
+
this.templateRef = templateRef;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
SdViewDefDirective.decorators = [
|
|
13
|
+
{ type: Directive, args: [{
|
|
14
|
+
selector: '[sdViewDef]'
|
|
15
|
+
},] }
|
|
16
|
+
];
|
|
17
|
+
SdViewDefDirective.ctorParameters = () => [
|
|
18
|
+
{ type: TemplateRef }
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
class SdCommonModule {
|
|
22
|
+
}
|
|
23
|
+
SdCommonModule.decorators = [
|
|
24
|
+
{ type: NgModule, args: [{
|
|
25
|
+
imports: [
|
|
26
|
+
CommonModule
|
|
27
|
+
],
|
|
28
|
+
declarations: [
|
|
29
|
+
SdViewDefDirective
|
|
30
|
+
],
|
|
31
|
+
exports: [
|
|
32
|
+
SdViewDefDirective
|
|
33
|
+
],
|
|
34
|
+
providers: []
|
|
35
|
+
},] }
|
|
36
|
+
];
|
|
37
|
+
|
|
4
38
|
class SdFormControl extends FormControl {
|
|
5
39
|
constructor(formState, validator = null, asyncValidator = null) {
|
|
6
40
|
super(formState, validator, asyncValidator);
|
|
@@ -16,5 +50,5 @@ class SdFormControl extends FormControl {
|
|
|
16
50
|
* Generated bundle index. Do not edit.
|
|
17
51
|
*/
|
|
18
52
|
|
|
19
|
-
export { SdFormControl };
|
|
53
|
+
export { SdCommonModule, SdFormControl, SdViewDefDirective };
|
|
20
54
|
//# sourceMappingURL=sd-angular-core-common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-common.js","sources":["../../../../projects/sd-core/common/src/lib/models/sd-form-control.ts","../../../../projects/sd-core/common/sd-angular-core-common.ts"],"sourcesContent":["import { FormControl, AsyncValidatorFn, ValidatorFn } from '@angular/forms';\r\nimport { Subject } from 'rxjs';\r\nexport class SdFormControl extends FormControl {\r\n touchedChanges: Subject<boolean> = new Subject<boolean>();\r\n\r\n constructor(\r\n formState?: Object,\r\n validator: ValidatorFn | ValidatorFn[] = null,\r\n asyncValidator: AsyncValidatorFn | AsyncValidatorFn[] = null\r\n ) {\r\n super(formState, validator, asyncValidator);\r\n }\r\n\r\n markAsTouched({ onlySelf }: { onlySelf?: boolean } = {}): void {\r\n super.markAsTouched({ onlySelf });\r\n this.touchedChanges.next(true);\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sd-angular-core-common.js","sources":["../../../../projects/sd-core/common/src/lib/directives/view-def.directive.ts","../../../../projects/sd-core/common/src/lib/common.module.ts","../../../../projects/sd-core/common/src/lib/models/sd-form-control.ts","../../../../projects/sd-core/common/sd-angular-core-common.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdViewDef]'\r\n})\r\nexport class SdViewDefDirective {\r\n // @Input() sdViewDef: string;\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdViewDefDirective } from './directives/view-def.directive';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule\r\n ],\r\n declarations: [\r\n SdViewDefDirective\r\n ],\r\n exports: [\r\n SdViewDefDirective\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdCommonModule { }\r\n","import { FormControl, AsyncValidatorFn, ValidatorFn } from '@angular/forms';\r\nimport { Subject } from 'rxjs';\r\nexport class SdFormControl extends FormControl {\r\n touchedChanges: Subject<boolean> = new Subject<boolean>();\r\n\r\n constructor(\r\n formState?: Object,\r\n validator: ValidatorFn | ValidatorFn[] = null,\r\n asyncValidator: AsyncValidatorFn | AsyncValidatorFn[] = null\r\n ) {\r\n super(formState, validator, asyncValidator);\r\n }\r\n\r\n markAsTouched({ onlySelf }: { onlySelf?: boolean } = {}): void {\r\n super.markAsTouched({ onlySelf });\r\n this.touchedChanges.next(true);\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAKa,kBAAkB;;IAE7B,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YALtD,SAAS,SAAC;gBACT,QAAQ,EAAE,aAAa;aACxB;;;YAJmB,WAAW;;;MCiBlB,cAAc;;;YAb1B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;iBACb;gBACD,YAAY,EAAE;oBACZ,kBAAkB;iBACnB;gBACD,OAAO,EAAE;oBACP,kBAAkB;iBACnB;gBACD,SAAS,EAAE,EACV;aACF;;;MCdY,aAAc,SAAQ,WAAW;IAG5C,YACE,SAAkB,EAClB,YAAyC,IAAI,EAC7C,iBAAwD,IAAI;QAE5D,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QAP9C,mBAAc,GAAqB,IAAI,OAAO,EAAW,CAAC;KAQzD;IAED,aAAa,CAAC,EAAE,QAAQ,KAA6B,EAAE;QACrD,KAAK,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAChC;;;AChBH;;;;;;"}
|
|
@@ -8,7 +8,7 @@ import { v4 } from 'uuid';
|
|
|
8
8
|
import $ from 'jquery';
|
|
9
9
|
import { debounceTime } from 'rxjs/operators';
|
|
10
10
|
import { Subscription } from 'rxjs';
|
|
11
|
-
import { SdFormControl } from '@sd-angular/core/common';
|
|
11
|
+
import { SdFormControl, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
|
|
12
12
|
import { MatInputModule } from '@angular/material/input';
|
|
13
13
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
14
14
|
import { SdTranslateModule } from '@sd-angular/core/translate';
|
|
@@ -52,6 +52,7 @@ class SdInput {
|
|
|
52
52
|
this.keyupEnter = new EventEmitter();
|
|
53
53
|
this.formControl = new SdFormControl();
|
|
54
54
|
_subscription.set(this, new Subscription());
|
|
55
|
+
this.isFocused = false;
|
|
55
56
|
this.reValidate = () => {
|
|
56
57
|
this.formControl.updateValueAndValidity();
|
|
57
58
|
};
|
|
@@ -98,6 +99,7 @@ class SdInput {
|
|
|
98
99
|
};
|
|
99
100
|
this.onFocus = () => {
|
|
100
101
|
var _a;
|
|
102
|
+
this.isFocused = true;
|
|
101
103
|
this.sdFocus.emit();
|
|
102
104
|
if (((_a = this.sdFocusForceBlur.observers) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
103
105
|
this.blur();
|
|
@@ -106,14 +108,29 @@ class SdInput {
|
|
|
106
108
|
};
|
|
107
109
|
this.onBlur = () => {
|
|
108
110
|
var _a;
|
|
111
|
+
this.isFocused = false;
|
|
109
112
|
const val = ((_a = this.formControl.value) !== null && _a !== void 0 ? _a : '').toString();
|
|
110
113
|
if (val.length > val.trim().length) {
|
|
111
114
|
this.formControl.setValue(val.trim());
|
|
112
115
|
}
|
|
113
116
|
};
|
|
117
|
+
this.onClick = () => {
|
|
118
|
+
var _a;
|
|
119
|
+
if ((_a = this.sdView) === null || _a === void 0 ? void 0 : _a.templateRef) {
|
|
120
|
+
if (!this.formControl.disabled && !this.isFocused) {
|
|
121
|
+
this.focus();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
114
125
|
this.blur = () => {
|
|
115
126
|
$(this.control.nativeElement).trigger('blur');
|
|
116
127
|
};
|
|
128
|
+
this.focus = () => {
|
|
129
|
+
this.isFocused = true;
|
|
130
|
+
setTimeout(() => {
|
|
131
|
+
$(this.control.nativeElement).trigger('focus');
|
|
132
|
+
}, 100);
|
|
133
|
+
};
|
|
117
134
|
_customValidator.set(this, (func) => {
|
|
118
135
|
return (c) => __awaiter(this, void 0, void 0, function* () {
|
|
119
136
|
const value = c.value || null;
|
|
@@ -224,9 +241,9 @@ _name = new WeakMap(), _form = new WeakMap(), _model = new WeakMap(), _pattern =
|
|
|
224
241
|
SdInput.decorators = [
|
|
225
242
|
{ type: Component, args: [{
|
|
226
243
|
selector: 'sd-input',
|
|
227
|
-
template: "<div class=\"d-flex align-items-center\">\r\n <mat-form-field class=\"sd-md\"
|
|
244
|
+
template: "<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\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=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput [placeholder]=\"placeholder || label\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" [required]=\"isRequired\"\r\n [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\">\r\n <span class=\"mr-1\" *ngIf=\"maxlength\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.maxlength && !disableErrorMessage\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>",
|
|
228
245
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
229
|
-
styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}"]
|
|
246
|
+
styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}"]
|
|
230
247
|
},] }
|
|
231
248
|
];
|
|
232
249
|
SdInput.ctorParameters = () => [
|
|
@@ -258,7 +275,8 @@ SdInput.propDecorators = {
|
|
|
258
275
|
sdFocusForceBlur: [{ type: Output }],
|
|
259
276
|
keyupEnter: [{ type: Output }],
|
|
260
277
|
control: [{ type: ViewChild, args: ['control',] }],
|
|
261
|
-
sdInputSuffix: [{ type: ContentChild, args: [SdInputSuffixDirective,] }]
|
|
278
|
+
sdInputSuffix: [{ type: ContentChild, args: [SdInputSuffixDirective,] }],
|
|
279
|
+
sdView: [{ type: ContentChild, args: [SdViewDefDirective,] }]
|
|
262
280
|
};
|
|
263
281
|
|
|
264
282
|
class SdInputTooltipPipe {
|
|
@@ -305,7 +323,8 @@ SdInputModule.decorators = [
|
|
|
305
323
|
MatInputModule,
|
|
306
324
|
MatIconModule,
|
|
307
325
|
MatTooltipModule,
|
|
308
|
-
SdTranslateModule
|
|
326
|
+
SdTranslateModule,
|
|
327
|
+
SdCommonModule
|
|
309
328
|
],
|
|
310
329
|
declarations: [
|
|
311
330
|
SdInput,
|
|
@@ -316,7 +335,8 @@ SdInputModule.decorators = [
|
|
|
316
335
|
exports: [
|
|
317
336
|
SdInput,
|
|
318
337
|
SdInputTooltipPipe,
|
|
319
|
-
SdInputSuffixDirective
|
|
338
|
+
SdInputSuffixDirective,
|
|
339
|
+
SdCommonModule
|
|
320
340
|
]
|
|
321
341
|
},] }
|
|
322
342
|
];
|
|
@@ -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} from '@angular/core';\r\nimport { AbstractControl, FormControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport $ from 'jquery';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\n\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() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' = 'text';\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 #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n constructor(public ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n }\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.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 const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n blur = () => {\r\n $(this.control.nativeElement).trigger('blur');\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","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n console.log(changes);\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\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 ],\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 ]\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;;;;MC6BlB,OAAO;IAiGlB,YAAmB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAhGzC,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAOlB,wBAAiB;QAYR,SAAI,GAA6C,MAAM,CAAC;QACjE,wBAAmB,GAAG,KAAK,CAAC;QAK5B,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAA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BAML,KAAK;mBAQL,KAAK;wBAEL,KAAK,SAAC,UAAU;0BAIhB,MAAM;sBACN,KAAK;uBACL,MAAM;sBACN,MAAM;+BACN,MAAM;yBACN,MAAM;sBAEN,SAAS,SAAC,SAAS;4BACnB,YAAY,SAAC,sBAAsB;;;MCvHzB,kBAAkB;IAC7B,SAAS,CAAC,KAAU,EAAE,OAAkD;QACtE,IAAI,QAAQ,OAAO,CAAC,KAAK,QAAQ,EAAE;YACjC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;KACvB;;;YATF,IAAI,SAAC;gBACJ,IAAI,EAAE,oBAAoB;aAC3B;;;MCEY,cAAc;IAIzB,WAAW,CAAC,OAAsB;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAG,OAAO,CAAC,KAAK,EAAC;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;SACzB;KACF;;;YAZF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;aACpB;;;oBAEE,KAAK;kBACL,KAAK;;;MC6BK,aAAa;;;YAvBzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;iBACvB;aACF;;;ACnCD;;;;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} from '@angular/core';\r\nimport { AbstractControl, FormControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport $ from 'jquery';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\n\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() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' = 'text';\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 #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n constructor(public ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if(this.sdView?.templateRef) {\r\n if(!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n $(this.control.nativeElement).trigger('blur');\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n $(this.control.nativeElement).trigger('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","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n console.log(changes);\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\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 ],\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;;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CAAC,KAAK,CAAC,CAAC;KACvB;;;YATF,IAAI,SAAC;gBACJ,IAAI,EAAE,oBAAoB;aAC3B;;;MCEY,cAAc;IAIzB,WAAW,CAAC,OAAsB;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAG,OAAO,CAAC,KAAK,EAAC;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;SACzB;KACF;;;YAZF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;aACpB;;;oBAEE,KAAK;kBACL,KAAK;;;MCgCK,aAAa;;;YAzBzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;iBACf;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;;;ACtCD;;;;ACAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"SdInputModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":13,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":15,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":20,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":21,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":22,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdInput"},{"__symbolic":"reference","name":"SdInputTooltipPipe"},{"__symbolic":"reference","name":"SdInputSuffixDirective"},{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"SdInput"},{"__symbolic":"reference","name":"SdInputTooltipPipe"},{"__symbolic":"reference","name":"SdInputSuffixDirective"}]}]}],"members":{}},"SdInputTooltipPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":1,"character":1},"arguments":[{"name":"sdInputTooltipPipe"}]}],"members":{"transform":[{"__symbolic":"method"}]}},"SdInputSuffixDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"[sdInputSuffix]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}},"SdInput":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":23,"character":1},"arguments":[{"selector":"sd-input","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":27,"character":19},"member":"OnPush"},"template":"<div class=\"d-flex align-items-center\">\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\" appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput [placeholder]=\"placeholder || label\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\"\r\n autocorrect=\"off\">\r\n <span class=\"mr-1\" *ngIf=\"maxlength\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.maxlength && !disableErrorMessage\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n</div>","styles":[":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":48,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":50,"character":3}}]}],"_disableErrorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":3},"arguments":["disableErrorMessage"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":57,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":65,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":69,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":75,"character":3}}]}],"pMinlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":80,"character":3},"arguments":["minlength"]}]}],"pMaxlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":85,"character":3},"arguments":["maxlength"]}]}],"pattern":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":90,"character":3}}]}],"validator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":95,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":101,"character":3}}]}],"icon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":109,"character":3}}]}],"_hideIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":111,"character":3},"arguments":["hideIcon"]}]}],"sdClickIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":115,"character":3}}]}],"tooltip":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":116,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":117,"character":3}}]}],"sdFocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":118,"character":3}}]}],"sdFocusForceBlur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":119,"character":3}}]}],"keyupEnter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":120,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":122,"character":3},"arguments":["control"]}]}],"sdInputSuffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":123,"character":3},"arguments":[{"__symbolic":"reference","name":"SdInputSuffixDirective"}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":126,"character":26}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"[touch]"}]}],"members":{"touch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":6,"character":3}}]}],"ref":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":7,"character":3}}]}],"ngOnChanges":[{"__symbolic":"method"}]}}},"origins":{"SdInputModule":"./src/lib/input.module","SdInputTooltipPipe":"./src/lib/input-tooltip.pipe","SdInputSuffixDirective":"./src/lib/directives/input-suffix.directive","SdInput":"./src/lib/input.component","ɵa":"./src/lib/directives/touch.directive"},"importAs":"@sd-angular/core/input"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"SdInputModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":14,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":20,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":21,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":22,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":23,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdCommonModule","line":24,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdInput"},{"__symbolic":"reference","name":"SdInputTooltipPipe"},{"__symbolic":"reference","name":"SdInputSuffixDirective"},{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"SdInput"},{"__symbolic":"reference","name":"SdInputTooltipPipe"},{"__symbolic":"reference","name":"SdInputSuffixDirective"},{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdCommonModule","line":36,"character":4}]}]}],"members":{}},"SdInputTooltipPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":1,"character":1},"arguments":[{"name":"sdInputTooltipPipe"}]}],"members":{"transform":[{"__symbolic":"method"}]}},"SdInputSuffixDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"[sdInputSuffix]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}},"SdInput":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":24,"character":1},"arguments":[{"selector":"sd-input","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":28,"character":19},"member":"OnPush"},"template":"<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\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=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput [placeholder]=\"placeholder || label\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" [required]=\"isRequired\"\r\n [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\">\r\n <span class=\"mr-1\" *ngIf=\"maxlength\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.maxlength && !disableErrorMessage\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>","styles":[":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":50,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":51,"character":3}}]}],"_disableErrorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":53,"character":3},"arguments":["disableErrorMessage"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":58,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":66,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":70,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":76,"character":3}}]}],"pMinlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":81,"character":3},"arguments":["minlength"]}]}],"pMaxlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":86,"character":3},"arguments":["maxlength"]}]}],"pattern":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":91,"character":3}}]}],"validator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":96,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":102,"character":3}}]}],"icon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":110,"character":3}}]}],"_hideIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":112,"character":3},"arguments":["hideIcon"]}]}],"sdClickIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":116,"character":3}}]}],"tooltip":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":117,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":118,"character":3}}]}],"sdFocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":119,"character":3}}]}],"sdFocusForceBlur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":120,"character":3}}]}],"keyupEnter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":121,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":123,"character":3},"arguments":["control"]}]}],"sdInputSuffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":124,"character":3},"arguments":[{"__symbolic":"reference","name":"SdInputSuffixDirective"}]}]}],"sdView":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":127,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdViewDefDirective","line":127,"character":16}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":129,"character":26}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"[touch]"}]}],"members":{"touch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":6,"character":3}}]}],"ref":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":7,"character":3}}]}],"ngOnChanges":[{"__symbolic":"method"}]}}},"origins":{"SdInputModule":"./src/lib/input.module","SdInputTooltipPipe":"./src/lib/input-tooltip.pipe","SdInputSuffixDirective":"./src/lib/directives/input-suffix.directive","SdInput":"./src/lib/input.component","ɵa":"./src/lib/directives/touch.directive"},"importAs":"@sd-angular/core/input"}
|