@sd-angular/core 0.0.1013 → 0.0.1017

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/bundles/sd-angular-core-comment.umd.js +8 -6
  2. package/bundles/sd-angular-core-comment.umd.js.map +1 -1
  3. package/bundles/sd-angular-core-comment.umd.min.js +2 -2
  4. package/bundles/sd-angular-core-comment.umd.min.js.map +1 -1
  5. package/bundles/sd-angular-core-common.umd.js +3 -3
  6. package/bundles/sd-angular-core-common.umd.js.map +1 -1
  7. package/bundles/sd-angular-core-common.umd.min.js +1 -1
  8. package/bundles/sd-angular-core-common.umd.min.js.map +1 -1
  9. package/bundles/sd-angular-core-select.umd.js +84 -57
  10. package/bundles/sd-angular-core-select.umd.js.map +1 -1
  11. package/bundles/sd-angular-core-select.umd.min.js +2 -2
  12. package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
  13. package/bundles/sd-angular-core-textarea.umd.js +75 -22
  14. package/bundles/sd-angular-core-textarea.umd.js.map +1 -1
  15. package/bundles/sd-angular-core-textarea.umd.min.js +2 -2
  16. package/bundles/sd-angular-core-textarea.umd.min.js.map +1 -1
  17. package/comment/sd-angular-core-comment.metadata.json +1 -1
  18. package/comment/src/lib/comment.component.d.ts +2 -0
  19. package/esm2015/comment/src/lib/comment.component.js +7 -4
  20. package/esm2015/common/src/lib/typings/array.extension.js +2 -2
  21. package/esm2015/select/src/lib/select.component.js +51 -41
  22. package/esm2015/textarea/src/lib/textarea.component.js +64 -18
  23. package/esm2015/textarea/src/lib/textarea.module.js +5 -2
  24. package/fesm2015/sd-angular-core-comment.js +6 -4
  25. package/fesm2015/sd-angular-core-comment.js.map +1 -1
  26. package/fesm2015/sd-angular-core-common.js +1 -1
  27. package/fesm2015/sd-angular-core-common.js.map +1 -1
  28. package/fesm2015/sd-angular-core-select.js +50 -40
  29. package/fesm2015/sd-angular-core-select.js.map +1 -1
  30. package/fesm2015/sd-angular-core-textarea.js +66 -18
  31. package/fesm2015/sd-angular-core-textarea.js.map +1 -1
  32. package/package.json +1 -1
  33. package/{sd-angular-core-0.0.1013.tgz → sd-angular-core-0.0.1017.tgz} +0 -0
  34. package/select/sd-angular-core-select.metadata.json +1 -1
  35. package/select/src/lib/select.component.d.ts +1 -1
  36. package/textarea/sd-angular-core-textarea.metadata.json +1 -1
  37. package/textarea/src/lib/textarea.component.d.ts +13 -3
@@ -7,6 +7,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
7
7
  import { MatFormFieldModule } from '@angular/material/form-field';
8
8
  import { MatInputModule } from '@angular/material/input';
9
9
  import { SdTranslateModule } from '@sd-angular/core/translate';
10
+ import { SdCommonModule } from '@sd-angular/core/common';
10
11
  export class SdTextareaModule {
11
12
  }
12
13
  SdTextareaModule.decorators = [
@@ -19,14 +20,16 @@ SdTextareaModule.decorators = [
19
20
  MatInputModule,
20
21
  MatIconModule,
21
22
  MatTooltipModule,
22
- SdTranslateModule
23
+ SdTranslateModule,
24
+ SdCommonModule
23
25
  ],
24
26
  declarations: [
25
27
  SdTextarea
26
28
  ],
27
29
  exports: [
30
+ SdCommonModule,
28
31
  SdTextarea
29
32
  ]
30
33
  },] }
31
34
  ];
32
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dGFyZWEubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IkM6L1VzZXJzL25naGlhdHQxNS9EZXNrdG9wL1dvcmtpbmcvMU1HL2xpYi1jb3JlLXVpL3Byb2plY3RzL3NkLWNvcmUvdGV4dGFyZWEvIiwic291cmNlcyI6WyJzcmMvbGliL3RleHRhcmVhLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxXQUFXLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxnQkFBZ0IsQ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lLFxyXG4gICAgTWF0SW5wdXRNb2R1bGUsXHJcbiAgICBNYXRJY29uTW9kdWxlLFxyXG4gICAgTWF0VG9vbHRpcE1vZHVsZSxcclxuICAgIFNkVHJhbnNsYXRlTW9kdWxlLFxyXG4gICAgU2RDb21tb25Nb2R1bGVcclxuICBdLFxyXG4gIGRlY2xhcmF0aW9uczogW1xyXG4gICAgU2RUZXh0YXJlYVxyXG4gIF0sXHJcbiAgZXhwb3J0czogW1xyXG4gICAgU2RDb21tb25Nb2R1bGUsXHJcbiAgICBTZFRleHRhcmVhXHJcbiAgXVxyXG59KVxyXG5leHBvcnQgY2xhc3MgU2RUZXh0YXJlYU1vZHVsZSB7IH1cclxuIl19
@@ -1,14 +1,14 @@
1
- import { Component, ChangeDetectionStrategy, Input, NgModule } from '@angular/core';
1
+ import { Component, ChangeDetectionStrategy, ViewChild, Input, NgModule } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { SdTranslateModule } from '@sd-angular/core/translate';
4
4
  import { MatIconModule } from '@angular/material/icon';
5
5
  import { MatButtonModule } from '@angular/material/button';
6
6
  import { __awaiter, __classPrivateFieldGet } from 'tslib';
7
+ import { SdTextarea, SdTextareaModule } from '@sd-angular/core/textarea';
7
8
  import { BehaviorSubject } from 'rxjs';
8
9
  import { map } from 'rxjs/operators';
9
10
  import { SdButtonModule } from '@sd-angular/core/button';
10
11
  import { SdInputModule } from '@sd-angular/core/input';
11
- import { SdTextareaModule } from '@sd-angular/core/textarea';
12
12
  import { SdUtilityModule } from '@sd-angular/core/utility';
13
13
  import { MatTooltipModule } from '@angular/material/tooltip';
14
14
 
@@ -22,6 +22,7 @@ class SdComment {
22
22
  if (this.message) {
23
23
  (_b = (_a = this.commentOption) === null || _a === void 0 ? void 0 : _a.event) === null || _b === void 0 ? void 0 : _b.onSend(this.message);
24
24
  this.message = null;
25
+ this.textarea.focus();
25
26
  }
26
27
  };
27
28
  _load.set(this, () => __awaiter(this, void 0, void 0, function* () {
@@ -59,13 +60,14 @@ _items = new WeakMap(), _send = new WeakMap(), _load = new WeakMap();
59
60
  SdComment.decorators = [
60
61
  { type: Component, args: [{
61
62
  selector: 'sd-comment',
62
- template: "<div class=\"c-container\">\r\n <div class=\"c-header\">\r\n <div class=\"c-title\">{{'Comments' | sdTranslate}} <span>({{count | async}})</span></div>\r\n </div>\r\n <div class=\"c-body\">\r\n <ng-container *ngFor=\"let item of items | async\">\r\n <div class=\"d-flex my-8\">\r\n <div class=\"c-avatar mr-12\">\r\n <img height=\"32\" width=\"32px\" [src]=\"item.picture\">\r\n </div>\r\n <div class=\"c-comment\">\r\n <div class=\"c-info mb-4\">\r\n {{'By' | sdTranslate}}\r\n <span class=\"c-creator ml-2\">\r\n {{item.creator}}\r\n </span>\r\n <ng-container *ngIf=\"item.createdDate\">\r\n <span class=\"mx-4\">\u2022</span>\r\n <span [matTooltip]=\"item.createdDate | date:'dd/MM/yyyy HH:mm'\">{{item.createdDate | sdTimeDifferent:'dd/MM/yyyy HH:mm':'hour' | async}}</span>\r\n </ng-container>\r\n </div>\r\n <div class=\"c-content\" [innerHtml]=\"item.content\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"c-footer p-16\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <sd-input [(model)]=\"message\" disableErrorMessage></sd-input>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-12 mt-16\">\r\n <sd-button class=\"float-right\" title=\"G\u1EEDi\" (action)=\"onSend()\" [disabled]=\"!message\" color=\"primary\" type=\"fill\" size=\"sm\">\r\n </sd-button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>",
63
+ template: "<div class=\"c-container\">\r\n <div class=\"c-header\">\r\n <div class=\"c-title\">{{'Comments' | sdTranslate}} <a href=\"javascript:;\">({{count | async}})</a></div>\r\n </div>\r\n <div class=\"c-body\">\r\n <ng-container *ngFor=\"let item of items | async\">\r\n <div class=\"d-flex my-8\">\r\n <div class=\"c-avatar mr-12\">\r\n <img height=\"32\" width=\"32px\" [src]=\"item.picture\">\r\n </div>\r\n <div class=\"c-comment\">\r\n <div class=\"c-info mb-4\">\r\n {{'By' | sdTranslate}}\r\n <span class=\"c-creator ml-2\">\r\n {{item.creator}}\r\n </span>\r\n <ng-container *ngIf=\"item.createdDate\">\r\n <span class=\"mx-4\">\u2022</span>\r\n <span [matTooltip]=\"item.createdDate | date:'dd/MM/yyyy HH:mm'\">{{item.createdDate | sdTimeDifferent:'dd/MM/yyyy HH:mm':'hour' | async}}</span>\r\n </ng-container>\r\n </div>\r\n <div class=\"c-content\" [innerHtml]=\"item.content\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"c-footer p-16\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <sd-textarea [(model)]=\"message\" rows=\"1\" autoHeight></sd-textarea>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <sd-button class=\"float-right\" title=\"G\u1EEDi\" (action)=\"onSend()\" [disabled]=\"!message\" color=\"primary\" type=\"fill\" size=\"sm\">\r\n </sd-button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>",
63
64
  changeDetection: ChangeDetectionStrategy.OnPush,
64
- styles: [".c-container{display:flex;flex-direction:column;height:100%}.c-container .c-header{align-items:center;background-color:#fff;display:flex;height:40px;padding:0 16px}.c-container .c-header .c-title{font-weight:500}.c-container .c-body{background:#f8f9fa;flex:1;overflow-y:hidden;padding:16px}.c-container .c-body:hover{overflow-y:auto}.c-container .c-body .c-comment{background:#fff;border:1px solid #f2f2f2;border-radius:4px;padding:12px 16px}.c-container .c-body .c-comment .c-info{color:#757575}.c-container .c-body .c-comment .c-info .c-creator{color:#000;font-weight:500}.c-container .c-footer{min-height:120px}"]
65
+ styles: [".c-container{display:flex;flex-direction:column;height:100%}.c-container .c-header{align-items:center;background-color:#fff;display:flex;height:40px;padding:0 16px}.c-container .c-header .c-title{font-weight:500}.c-container .c-body{background:#f8f9fa;flex:1;overflow-y:hidden;padding:16px}.c-container .c-body:hover{overflow-y:auto}.c-container .c-body .c-comment{background:#fff;border:1px solid #f2f2f2;border-radius:4px;padding:12px 16px}.c-container .c-body .c-comment .c-info{color:#757575}.c-container .c-body .c-comment .c-info .c-creator{color:#000;font-weight:500}.c-container .c-footer{background:#fff;min-height:120px}"]
65
66
  },] }
66
67
  ];
67
68
  SdComment.ctorParameters = () => [];
68
69
  SdComment.propDecorators = {
70
+ textarea: [{ type: ViewChild, args: [SdTextarea,] }],
69
71
  option: [{ type: Input }]
70
72
  };
71
73
 
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-comment.js","sources":["../../../../projects/sd-core/comment/src/lib/comment.component.ts","../../../../projects/sd-core/comment/src/lib/comment.module.ts","../../../../projects/sd-core/comment/src/public-api.ts","../../../../projects/sd-core/comment/sd-angular-core-comment.ts"],"sourcesContent":["import {\r\n Component,\r\n AfterViewInit,\r\n OnInit,\r\n OnDestroy,\r\n Input,\r\n ChangeDetectionStrategy\r\n} from '@angular/core';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { map, switchMap } from 'rxjs/operators';\r\nimport { Comment, SdCommentOption } from './comment.model';\r\n@Component({\r\n selector: 'sd-comment',\r\n templateUrl: './comment.component.html',\r\n styleUrls: ['./comment.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdComment implements OnInit, AfterViewInit, OnDestroy {\r\n #items = new BehaviorSubject<Comment[]>([]);\r\n #send = new BehaviorSubject<string>('');\r\n commentOption: SdCommentOption;\r\n @Input() set option(option: SdCommentOption) {\r\n this.commentOption = option;\r\n this.reload();\r\n };\r\n\r\n items: Observable<Comment[]>;\r\n count: Observable<number>;\r\n message: string;\r\n constructor() {\r\n }\r\n ngOnInit(): void {\r\n this.items = this.#items.pipe(map(items => {\r\n return items.map(e => ({\r\n ...e,\r\n picture: e.picture ?? `https://ui-avatars.com/api/?size=32&rounded=true&background=random&name=${e.creator}`\r\n }))\r\n }));\r\n this.count = this.items.pipe(map(items => items.length));\r\n }\r\n ngOnDestroy(): void {\r\n }\r\n ngAfterViewInit(): void {\r\n }\r\n\r\n onSend = () => {\r\n if (this.message) {\r\n this.commentOption?.event?.onSend(this.message);\r\n this.message = null;\r\n }\r\n }\r\n\r\n #load = async () => {\r\n const { items } = this.commentOption;\r\n const results = items();\r\n if (results instanceof Promise) {\r\n return await results;\r\n }\r\n return results;\r\n }\r\n\r\n reload = async () => {\r\n this.#items.next(await this.#load());\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdComment } from './comment.component';\r\nimport { SdButtonModule } from '@sd-angular/core/button';\r\nimport { SdInputModule } from '@sd-angular/core/input';\r\nimport { SdTextareaModule } from '@sd-angular/core/textarea';\r\nimport { SdUtilityModule } from '@sd-angular/core/utility';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatButtonModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdButtonModule,\r\n SdInputModule,\r\n SdTextareaModule,\r\n SdUtilityModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdComment\r\n ],\r\n exports: [\r\n SdComment\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdCommentModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/comment.module';\r\nexport * from './lib/comment.model';\r\nexport * from './lib/comment.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MAiBa,SAAS;IAYpB;QAXA,iBAAS,IAAI,eAAe,CAAY,EAAE,CAAC,EAAC;QAC5C,gB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AM;;aAChD;;;;qBAKE,KAAK;;;MCaK,eAAe;;;YAtB3B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,eAAe;oBACf,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,eAAe;oBACf,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,SAAS;iBACV;gBACD,OAAO,EAAE;oBACP,SAAS;iBACV;gBACD,SAAS,EAAE,EACV;aACF;;;ACjCD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-comment.js","sources":["../../../../projects/sd-core/comment/src/lib/comment.component.ts","../../../../projects/sd-core/comment/src/lib/comment.module.ts","../../../../projects/sd-core/comment/src/public-api.ts","../../../../projects/sd-core/comment/sd-angular-core-comment.ts"],"sourcesContent":["import {\r\n Component,\r\n AfterViewInit,\r\n OnInit,\r\n OnDestroy,\r\n Input,\r\n ChangeDetectionStrategy,\r\n ViewChild\r\n} from '@angular/core';\r\nimport { SdTextarea } from '@sd-angular/core/textarea';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { map, switchMap } from 'rxjs/operators';\r\nimport { Comment, SdCommentOption } from './comment.model';\r\n@Component({\r\n selector: 'sd-comment',\r\n templateUrl: './comment.component.html',\r\n styleUrls: ['./comment.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdComment implements OnInit, AfterViewInit, OnDestroy {\r\n @ViewChild(SdTextarea) textarea: SdTextarea;\r\n #items = new BehaviorSubject<Comment[]>([]);\r\n #send = new BehaviorSubject<string>('');\r\n commentOption: SdCommentOption;\r\n @Input() set option(option: SdCommentOption) {\r\n this.commentOption = option;\r\n this.reload();\r\n };\r\n\r\n items: Observable<Comment[]>;\r\n count: Observable<number>;\r\n message: string;\r\n constructor() {\r\n }\r\n ngOnInit(): void {\r\n this.items = this.#items.pipe(map(items => {\r\n return items.map(e => ({\r\n ...e,\r\n picture: e.picture ?? `https://ui-avatars.com/api/?size=32&rounded=true&background=random&name=${e.creator}`\r\n }))\r\n }));\r\n this.count = this.items.pipe(map(items => items.length));\r\n }\r\n ngOnDestroy(): void {\r\n }\r\n ngAfterViewInit(): void {\r\n }\r\n\r\n onSend = () => {\r\n if (this.message) {\r\n this.commentOption?.event?.onSend(this.message);\r\n this.message = null;\r\n this.textarea.focus();\r\n }\r\n }\r\n\r\n #load = async () => {\r\n const { items } = this.commentOption;\r\n const results = items();\r\n if (results instanceof Promise) {\r\n return await results;\r\n }\r\n return results;\r\n }\r\n\r\n reload = async () => {\r\n this.#items.next(await this.#load());\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdComment } from './comment.component';\r\nimport { SdButtonModule } from '@sd-angular/core/button';\r\nimport { SdInputModule } from '@sd-angular/core/input';\r\nimport { SdTextareaModule } from '@sd-angular/core/textarea';\r\nimport { SdUtilityModule } from '@sd-angular/core/utility';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatButtonModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdButtonModule,\r\n SdInputModule,\r\n SdTextareaModule,\r\n SdUtilityModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdComment\r\n ],\r\n exports: [\r\n SdComment\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdCommentModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/comment.module';\r\nexport * from './lib/comment.model';\r\nexport * from './lib/comment.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MAmBa,SAAS;IAapB;QAXA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d;;;;YAjCF,SAAS,SAAC;gBACT,QAAQ,EAAE,YAAY;gBACtB,8mDAAuC;gBAEvC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;;uBAEE,SAAS,SAAC,UAAU;qBAIpB,KAAK;;;MCUK,eAAe;;;YAtB3B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,eAAe;oBACf,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,eAAe;oBACf,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,SAAS;iBACV;gBACD,OAAO,EAAE;oBACP,SAAS;iBACV;gBACD,SAAS,EAAE,EACV;aACF;;;ACjCD;;;;ACAA;;;;;;"}
@@ -32,7 +32,7 @@ Array.prototype.toObject = function (key) {
32
32
  if (!key) {
33
33
  return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { obj[item === null || item === void 0 ? void 0 : item.toString()] = item; return obj; }, {});
34
34
  }
35
- return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { obj[item[key]] = item; return obj; }, {});
35
+ return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { var _a; obj[(_a = item[key]) === null || _a === void 0 ? void 0 : _a.toString()] = item; return obj; }, {});
36
36
  };
37
37
  Array.prototype.union = function (key, ...args) {
38
38
  let results = this;
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-common.js","sources":["../../../../projects/sd-core/common/src/lib/typings/array.extension.ts","../../../../projects/sd-core/common/src/lib/typings/date.extension.ts","../../../../projects/sd-core/common/src/lib/typings/number.extension.ts","../../../../projects/sd-core/common/src/lib/typings/string.extension.ts","../../../../projects/sd-core/common/src/lib/directives/view-def.directive.ts","../../../../projects/sd-core/common/src/lib/directives/sd-let.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 { Observable, of } from 'rxjs';\r\n\r\nexport { };\r\n\r\ndeclare global {\r\n interface Array<T = any> {\r\n search(searchText: string | number, fields?: string | string[]): T[];\r\n paging(pageSize: number, page?: number): T[];\r\n toObject(key?: string): { [key: string]: T };\r\n union(key: string, ...args: T[][]): T[];\r\n asObservable(): Observable<T[]>\r\n }\r\n interface ArrayConstructor {\r\n search<T = any>(items: T[], searchText: string | number, fields?: string | string[]): T[];\r\n union<T = any>(key: string, ...args: T[][]): T[];\r\n toObject<T = any>(items: T[], key?: string): { [key: string]: T };\r\n }\r\n}\r\n\r\nArray.prototype.search = function <T = any>(searchText: any, fields?: string | string[]): T[] {\r\n const items: T[] = this;\r\n if (!searchText?.toString()) {\r\n return items;\r\n }\r\n if (Array.isArray(fields)) {\r\n const fs = fields.filter(e => e !== undefined && e !== null && e !== '');\r\n if (!fs.length) {\r\n return items.filter(item => item !== undefined && item !== null && String.aliasIncludes(item, searchText));\r\n }\r\n return items.filter(item => item !== undefined && item !== null && fs.some(field => String.aliasIncludes(item[field], searchText)));\r\n }\r\n if (!fields) {\r\n return items.filter(item => item !== undefined && item !== null && String.aliasIncludes(item, searchText));\r\n }\r\n return items.filter(item => item !== undefined && item !== null && String.aliasIncludes(item[fields], searchText));\r\n};\r\n\r\nArray.prototype.paging = function <T = any>(pageSize: number, page: number = 0): T[] {\r\n const items: T[] = this;\r\n return items.filter((item, index) => {\r\n return index >= page * pageSize\r\n && index < (page + 1) * pageSize;\r\n });\r\n};\r\n\r\nArray.prototype.toObject = function <T = any>(key: string): { [key: string]: T } {\r\n const items: T[] = this;\r\n if (!key) {\r\n return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { obj[item?.toString()] = item; return obj; }, {});\r\n }\r\n return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { obj[item[key]] = item; return obj; }, {});\r\n};\r\n\r\nArray.prototype.union = function <T = any>(key: string, ...args: T[][]) {\r\n let results: T[] = this;\r\n const filterUnion = <T = any>(val: T, index: number, self: T[]) => val !== undefined && val !== null && self.findIndex((e: { [x: string]: any; }) => !!key ? e[key] === val[key] : e === val) === index;\r\n if (!args?.length) {\r\n return results.filter(filterUnion);\r\n }\r\n for (const arg of args) {\r\n if (Array.isArray(arg)) {\r\n results = [...results, ...arg].filter(filterUnion);\r\n }\r\n }\r\n return results;\r\n}\r\n\r\nArray.prototype.asObservable = function <T = any>() {\r\n const items: T[] = this;\r\n return of(items);\r\n}\r\n\r\nArray.search = <T = any>(items: T[], searchText: string | number, fields?: string | string[]) => {\r\n if (!Array.isArray(items)) {\r\n return [];\r\n }\r\n return items.search(searchText, fields);\r\n};\r\n\r\nArray.union = <T = any>(key: string, ...args: T[][]) => {\r\n return [].union(key, args);\r\n}\r\n\r\nArray.toObject = <T>(items: T[], key?: string): { [key: string]: T } => {\r\n if (!Array.isArray(items)) {\r\n return {};\r\n }\r\n return items.toObject(key);\r\n}\r\n\r\n","export { };\r\n\r\ndeclare global {\r\n interface Date {\r\n begin(): Date;\r\n end(): Date;\r\n addMiliseconds(miliseconds: number): Date;\r\n addHours(hours: number): Date;\r\n addDays(days: number): Date;\r\n addMonths(months: number): Date;\r\n toFormat(format: string): string;\r\n }\r\n interface DateConstructor {\r\n equal(date1: any, date2: any): boolean;\r\n parseFrom(value: any, format: string): Date;\r\n isDate(value: any): boolean;\r\n toFormat(value: any, format: string): string;\r\n addMiliseconds(value: any, miliseconds: number): Date;\r\n addHours(value: any, hours: number): Date;\r\n addDays(value: any, days: number): Date;\r\n addMonths(value: any, months: number): Date;\r\n begin(value: any): Date;\r\n end(value: any): Date;\r\n }\r\n}\r\n\r\nDate.equal = (date1: any, date2: any) => {\r\n if (!Date.isDate(date1) && !Date.isDate(date2)) {\r\n return true;\r\n }\r\n if (!Date.isDate(date1) || !Date.isDate(date2)) {\r\n return false;\r\n }\r\n return new Date(date1).getTime() === new Date(date2).getTime();\r\n};\r\n\r\nDate.parseFrom = (value: any, format: string) => {\r\n if (!value) {\r\n return null;\r\n }\r\n if (!format) {\r\n return null;\r\n }\r\n value = value.toString();\r\n const dmy = format.indexOf('dd') > -1 && format.indexOf('MM') > -1 && format.indexOf('yyyy') > -1;\r\n const hms = format.indexOf('HH') > -1 || format.indexOf('mm') > -1 || format.indexOf('ss') > -1;\r\n let strDate = '';\r\n if (dmy) {\r\n const dd = value.substr(format.indexOf('dd'), 'dd'.length);\r\n const MM = value.substr(format.indexOf('MM'), 'MM'.length);\r\n const yyyy = value.substr(format.indexOf('yyyy'), 'yyyy'.length);\r\n if (+yyyy > 0 && +MM > 0 && +dd > 0) {\r\n strDate += `${MM}/${dd}/${yyyy}`;\r\n } else {\r\n return null;\r\n }\r\n } else {\r\n const today = new Date();\r\n const yyyy = today.getFullYear().toString();\r\n const MM = (today.getMonth() + 1).toString().padStart(2, '0');\r\n const dd = today.getDate().toString().padStart(2, '0');\r\n strDate += `${MM}/${dd}/${yyyy}`;\r\n }\r\n if (hms) {\r\n const HH = format.indexOf('HH') > -1 ? value.substr(format.indexOf('HH'), 'HH'.length) : '00';\r\n const mm = format.indexOf('mm') > -1 ? value.substr(format.indexOf('mm'), 'mm'.length) : '00';\r\n const ss = format.indexOf('ss') > -1 ? value.substr(format.indexOf('ss'), 'ss'.length) : '00';\r\n strDate += ` ${HH || '00'}:${mm || '00'}:${ss || '00'}`;\r\n }\r\n if (!Date.isDate(strDate)) {\r\n return null;\r\n }\r\n return new Date(strDate);\r\n};\r\n\r\nDate.isDate = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const date = new Date(value);\r\n return !isNaN(date.getTime());\r\n};\r\n\r\nDate.toFormat = (value: any, format: string): string => {\r\n if (!Date.isDate(value)) {\r\n return '';\r\n }\r\n const date: Date = new Date(value);\r\n return date.toFormat(format);\r\n};\r\n\r\nDate.addMiliseconds = (value: any, miliseconds: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addMiliseconds(miliseconds);\r\n};\r\n\r\nDate.addHours = (value: any, hours: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addHours(hours);\r\n};\r\n\r\nDate.addDays = (value: any, days: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addDays(days);\r\n};\r\n\r\nDate.addMonths = (value: any, months: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addMonths(months);\r\n};\r\n\r\nDate.begin = (value: any) => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n return new Date(Date.toFormat(value, 'MM/dd/yyyy'));\r\n};\r\n\r\nDate.end = (value: any) => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n return new Date(value).addDays(1).begin().addMiliseconds(-1);\r\n};\r\n\r\nDate.prototype.begin = function () {\r\n return new Date(this.toFormat('MM/dd/yyyy'));\r\n};\r\n\r\nDate.prototype.end = function () {\r\n const date: Date = this;\r\n return date.addDays(1).begin().addMiliseconds(-1);\r\n};\r\n\r\nDate.prototype.addMiliseconds = function (miliseconds: number) {\r\n const date: Date = this;\r\n date.setMilliseconds(date.getMilliseconds() + miliseconds);\r\n return date;\r\n};\r\n\r\nDate.prototype.addHours = function (hours: number) {\r\n const date: Date = this;\r\n date.setHours(date.getHours() + hours);\r\n return date;\r\n};\r\n\r\nDate.prototype.addDays = function (days: number) {\r\n const date: Date = this;\r\n date.setDate(date.getDate() + days);\r\n return date;\r\n};\r\n\r\nDate.prototype.addMonths = function (months: number) {\r\n const date: Date = this;\r\n date.setMonth(date.getMonth() + months);\r\n return date;\r\n};\r\n\r\nDate.prototype.toFormat = function (format: string) {\r\n const date: Date = this;\r\n let result = format;\r\n result = result.replace('yyyy', date.getFullYear().toString());\r\n result = result.replace('MM', (date.getMonth() + 1).toString().padStart(2, '0'));\r\n result = result.replace('dd', date.getDate().toString().padStart(2, '0'));\r\n result = result.replace('HH', date.getHours().toString().padStart(2, '0'));\r\n result = result.replace('mm', date.getMinutes().toString().padStart(2, '0'));\r\n result = result.replace('ss', date.getSeconds().toString().padStart(2, '0'));\r\n return result;\r\n};\r\n","export { };\r\n\r\ndeclare global {\r\n interface NumberConstructor {\r\n toVNCurrency(value: any): string;\r\n isNumber(value: any): boolean;\r\n isPositiveInteger(value: any): boolean;\r\n isPositiveNumber(value: any): boolean;\r\n }\r\n}\r\n\r\nNumber.toVNCurrency = (value: any) => {\r\n value = (value ?? '').toString().replace(/,/g, '');\r\n if (!value) {\r\n return null;\r\n }\r\n const val = +value;\r\n if (!Number.isNaN(val)) {\r\n return val.toLocaleString('vi-VN');\r\n }\r\n return null;\r\n};\r\n\r\nNumber.isPositiveInteger = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const regex = /^([0-9]*)$/;\r\n return regex.test(value) && +value > 0;\r\n};\r\n\r\nNumber.isPositiveNumber = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const regex = /^([0-9]*)(\\.[0-9]+$){0,1}$/;\r\n return regex.test(value) && +value > 0;\r\n};\r\n\r\nNumber.isNumber = (value: any) => {\r\n if (value === undefined || value === null || value === '') {\r\n return false;\r\n }\r\n return !Number.isNaN(+value);\r\n};\r\n","export { };\r\n\r\ndeclare global {\r\n interface StringConstructor {\r\n isValidEmail(value: any): boolean;\r\n isValidPhone(value: any): boolean;\r\n isValidCode(value: any): boolean;\r\n changeAliasLowerCase(alias: any): string;\r\n aliasIncludes(alias: any, searchText: any): boolean;\r\n }\r\n}\r\n\r\nString.isValidEmail = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const re = /^(([^<>()\\[\\]\\.,;:\\s@\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i;\r\n return re.test(value);\r\n};\r\n\r\nString.isValidPhone = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const re = /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$/;\r\n return re.test(value);\r\n};\r\n\r\nString.isValidCode = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const re = /^[a-zA-Z0-9\\@\\_\\-]{2,20}$/;\r\n return re.test(value);\r\n};\r\n\r\nString.changeAliasLowerCase = (alias: any) => {\r\n let str: string = alias?.toString() ?? '';\r\n str = str.toString().toLowerCase();\r\n str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, 'a');\r\n str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, 'e');\r\n str = str.replace(/ì|í|ị|ỉ|ĩ/g, 'i');\r\n str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, 'o');\r\n str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, 'u');\r\n str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, 'y');\r\n str = str.replace(/đ/g, 'd');\r\n str = str.replace(/!|@|%|\\^|\\*|\\(|\\)|\\+|\\=|\\<|\\>|\\?|\\/|,|\\.|\\:|\\;|\\'|\\\"|\\&|\\#|\\[|\\]|~|\\$|_|`|-|{|}|\\||\\\\/g, ' ');\r\n str = str.replace(/ + /g, ' ');\r\n str = str.trim();\r\n return str;\r\n}\r\n\r\nString.aliasIncludes = (alias: any, searchText: any) => {\r\n return String.changeAliasLowerCase(alias).includes(String.changeAliasLowerCase(searchText));\r\n}","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 { Directive, Input, TemplateRef, ViewContainerRef } from \"@angular/core\";\r\n@Directive({\r\n selector: '[sdLet]',\r\n})\r\nexport class SdLetDirective {\r\n @Input()\r\n set sdLet(context: any) {\r\n this.context.$implicit = this.context.sdLet = context;\r\n this.updateView();\r\n }\r\n context: any = {};\r\n\r\n constructor(private vcRef: ViewContainerRef, private templateRef: TemplateRef<any>) { }\r\n\r\n updateView() {\r\n this.vcRef.clear();\r\n this.vcRef.createEmbeddedView(this.templateRef, this.context);\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdViewDefDirective } from './directives/view-def.directive';\r\nimport { SdLetDirective } from './directives/sd-let.directive';\r\n// import './typings';\r\n@NgModule({\r\n imports: [\r\n CommonModule\r\n ],\r\n declarations: [\r\n SdViewDefDirective,\r\n SdLetDirective\r\n ],\r\n exports: [\r\n SdViewDefDirective,\r\n SdLetDirective\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":";;;;;AAmBA,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,UAAmB,UAAe,EAAE,MAA0B;IACrF,MAAM,KAAK,GAAQ,IAAI,CAAC;IACxB,IAAI,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,GAAE,E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B;oBAClB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,kBAAkB;oBAClB,cAAc;iBACf;gBACD,SAAS,EAAE,EACV;aACF;;;MCjBY,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;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-common.js","sources":["../../../../projects/sd-core/common/src/lib/typings/array.extension.ts","../../../../projects/sd-core/common/src/lib/typings/date.extension.ts","../../../../projects/sd-core/common/src/lib/typings/number.extension.ts","../../../../projects/sd-core/common/src/lib/typings/string.extension.ts","../../../../projects/sd-core/common/src/lib/directives/view-def.directive.ts","../../../../projects/sd-core/common/src/lib/directives/sd-let.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 { Observable, of } from 'rxjs';\r\n\r\nexport { };\r\n\r\ndeclare global {\r\n interface Array<T = any> {\r\n search(searchText: string | number, fields?: string | string[]): T[];\r\n paging(pageSize: number, page?: number): T[];\r\n toObject(key?: string): { [key: string]: T };\r\n union(key: string, ...args: T[][]): T[];\r\n asObservable(): Observable<T[]>\r\n }\r\n interface ArrayConstructor {\r\n search<T = any>(items: T[], searchText: string | number, fields?: string | string[]): T[];\r\n union<T = any>(key: string, ...args: T[][]): T[];\r\n toObject<T = any>(items: T[], key?: string): { [key: string]: T };\r\n }\r\n}\r\n\r\nArray.prototype.search = function <T = any>(searchText: any, fields?: string | string[]): T[] {\r\n const items: T[] = this;\r\n if (!searchText?.toString()) {\r\n return items;\r\n }\r\n if (Array.isArray(fields)) {\r\n const fs = fields.filter(e => e !== undefined && e !== null && e !== '');\r\n if (!fs.length) {\r\n return items.filter(item => item !== undefined && item !== null && String.aliasIncludes(item, searchText));\r\n }\r\n return items.filter(item => item !== undefined && item !== null && fs.some(field => String.aliasIncludes(item[field], searchText)));\r\n }\r\n if (!fields) {\r\n return items.filter(item => item !== undefined && item !== null && String.aliasIncludes(item, searchText));\r\n }\r\n return items.filter(item => item !== undefined && item !== null && String.aliasIncludes(item[fields], searchText));\r\n};\r\n\r\nArray.prototype.paging = function <T = any>(pageSize: number, page: number = 0): T[] {\r\n const items: T[] = this;\r\n return items.filter((item, index) => {\r\n return index >= page * pageSize\r\n && index < (page + 1) * pageSize;\r\n });\r\n};\r\n\r\nArray.prototype.toObject = function <T = any>(key: string): { [key: string]: T } {\r\n const items: T[] = this;\r\n if (!key) {\r\n return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { obj[item?.toString()] = item; return obj; }, {});\r\n }\r\n return items.filter(item => item !== undefined && item !== null).reduce((obj, item) => { obj[item[key]?.toString()] = item; return obj; }, {});\r\n};\r\n\r\nArray.prototype.union = function <T = any>(key: string, ...args: T[][]) {\r\n let results: T[] = this;\r\n const filterUnion = <T = any>(val: T, index: number, self: T[]) => val !== undefined && val !== null && self.findIndex((e: { [x: string]: any; }) => !!key ? e[key] === val[key] : e === val) === index;\r\n if (!args?.length) {\r\n return results.filter(filterUnion);\r\n }\r\n for (const arg of args) {\r\n if (Array.isArray(arg)) {\r\n results = [...results, ...arg].filter(filterUnion);\r\n }\r\n }\r\n return results;\r\n}\r\n\r\nArray.prototype.asObservable = function <T = any>() {\r\n const items: T[] = this;\r\n return of(items);\r\n}\r\n\r\nArray.search = <T = any>(items: T[], searchText: string | number, fields?: string | string[]) => {\r\n if (!Array.isArray(items)) {\r\n return [];\r\n }\r\n return items.search(searchText, fields);\r\n};\r\n\r\nArray.union = <T = any>(key: string, ...args: T[][]) => {\r\n return [].union(key, args);\r\n}\r\n\r\nArray.toObject = <T>(items: T[], key?: string): { [key: string]: T } => {\r\n if (!Array.isArray(items)) {\r\n return {};\r\n }\r\n return items.toObject(key);\r\n}\r\n\r\n","export { };\r\n\r\ndeclare global {\r\n interface Date {\r\n begin(): Date;\r\n end(): Date;\r\n addMiliseconds(miliseconds: number): Date;\r\n addHours(hours: number): Date;\r\n addDays(days: number): Date;\r\n addMonths(months: number): Date;\r\n toFormat(format: string): string;\r\n }\r\n interface DateConstructor {\r\n equal(date1: any, date2: any): boolean;\r\n parseFrom(value: any, format: string): Date;\r\n isDate(value: any): boolean;\r\n toFormat(value: any, format: string): string;\r\n addMiliseconds(value: any, miliseconds: number): Date;\r\n addHours(value: any, hours: number): Date;\r\n addDays(value: any, days: number): Date;\r\n addMonths(value: any, months: number): Date;\r\n begin(value: any): Date;\r\n end(value: any): Date;\r\n }\r\n}\r\n\r\nDate.equal = (date1: any, date2: any) => {\r\n if (!Date.isDate(date1) && !Date.isDate(date2)) {\r\n return true;\r\n }\r\n if (!Date.isDate(date1) || !Date.isDate(date2)) {\r\n return false;\r\n }\r\n return new Date(date1).getTime() === new Date(date2).getTime();\r\n};\r\n\r\nDate.parseFrom = (value: any, format: string) => {\r\n if (!value) {\r\n return null;\r\n }\r\n if (!format) {\r\n return null;\r\n }\r\n value = value.toString();\r\n const dmy = format.indexOf('dd') > -1 && format.indexOf('MM') > -1 && format.indexOf('yyyy') > -1;\r\n const hms = format.indexOf('HH') > -1 || format.indexOf('mm') > -1 || format.indexOf('ss') > -1;\r\n let strDate = '';\r\n if (dmy) {\r\n const dd = value.substr(format.indexOf('dd'), 'dd'.length);\r\n const MM = value.substr(format.indexOf('MM'), 'MM'.length);\r\n const yyyy = value.substr(format.indexOf('yyyy'), 'yyyy'.length);\r\n if (+yyyy > 0 && +MM > 0 && +dd > 0) {\r\n strDate += `${MM}/${dd}/${yyyy}`;\r\n } else {\r\n return null;\r\n }\r\n } else {\r\n const today = new Date();\r\n const yyyy = today.getFullYear().toString();\r\n const MM = (today.getMonth() + 1).toString().padStart(2, '0');\r\n const dd = today.getDate().toString().padStart(2, '0');\r\n strDate += `${MM}/${dd}/${yyyy}`;\r\n }\r\n if (hms) {\r\n const HH = format.indexOf('HH') > -1 ? value.substr(format.indexOf('HH'), 'HH'.length) : '00';\r\n const mm = format.indexOf('mm') > -1 ? value.substr(format.indexOf('mm'), 'mm'.length) : '00';\r\n const ss = format.indexOf('ss') > -1 ? value.substr(format.indexOf('ss'), 'ss'.length) : '00';\r\n strDate += ` ${HH || '00'}:${mm || '00'}:${ss || '00'}`;\r\n }\r\n if (!Date.isDate(strDate)) {\r\n return null;\r\n }\r\n return new Date(strDate);\r\n};\r\n\r\nDate.isDate = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const date = new Date(value);\r\n return !isNaN(date.getTime());\r\n};\r\n\r\nDate.toFormat = (value: any, format: string): string => {\r\n if (!Date.isDate(value)) {\r\n return '';\r\n }\r\n const date: Date = new Date(value);\r\n return date.toFormat(format);\r\n};\r\n\r\nDate.addMiliseconds = (value: any, miliseconds: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addMiliseconds(miliseconds);\r\n};\r\n\r\nDate.addHours = (value: any, hours: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addHours(hours);\r\n};\r\n\r\nDate.addDays = (value: any, days: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addDays(days);\r\n};\r\n\r\nDate.addMonths = (value: any, months: number): Date => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n const date: Date = new Date(value);\r\n return date.addMonths(months);\r\n};\r\n\r\nDate.begin = (value: any) => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n return new Date(Date.toFormat(value, 'MM/dd/yyyy'));\r\n};\r\n\r\nDate.end = (value: any) => {\r\n if (!Date.isDate(value)) {\r\n return null;\r\n }\r\n return new Date(value).addDays(1).begin().addMiliseconds(-1);\r\n};\r\n\r\nDate.prototype.begin = function () {\r\n return new Date(this.toFormat('MM/dd/yyyy'));\r\n};\r\n\r\nDate.prototype.end = function () {\r\n const date: Date = this;\r\n return date.addDays(1).begin().addMiliseconds(-1);\r\n};\r\n\r\nDate.prototype.addMiliseconds = function (miliseconds: number) {\r\n const date: Date = this;\r\n date.setMilliseconds(date.getMilliseconds() + miliseconds);\r\n return date;\r\n};\r\n\r\nDate.prototype.addHours = function (hours: number) {\r\n const date: Date = this;\r\n date.setHours(date.getHours() + hours);\r\n return date;\r\n};\r\n\r\nDate.prototype.addDays = function (days: number) {\r\n const date: Date = this;\r\n date.setDate(date.getDate() + days);\r\n return date;\r\n};\r\n\r\nDate.prototype.addMonths = function (months: number) {\r\n const date: Date = this;\r\n date.setMonth(date.getMonth() + months);\r\n return date;\r\n};\r\n\r\nDate.prototype.toFormat = function (format: string) {\r\n const date: Date = this;\r\n let result = format;\r\n result = result.replace('yyyy', date.getFullYear().toString());\r\n result = result.replace('MM', (date.getMonth() + 1).toString().padStart(2, '0'));\r\n result = result.replace('dd', date.getDate().toString().padStart(2, '0'));\r\n result = result.replace('HH', date.getHours().toString().padStart(2, '0'));\r\n result = result.replace('mm', date.getMinutes().toString().padStart(2, '0'));\r\n result = result.replace('ss', date.getSeconds().toString().padStart(2, '0'));\r\n return result;\r\n};\r\n","export { };\r\n\r\ndeclare global {\r\n interface NumberConstructor {\r\n toVNCurrency(value: any): string;\r\n isNumber(value: any): boolean;\r\n isPositiveInteger(value: any): boolean;\r\n isPositiveNumber(value: any): boolean;\r\n }\r\n}\r\n\r\nNumber.toVNCurrency = (value: any) => {\r\n value = (value ?? '').toString().replace(/,/g, '');\r\n if (!value) {\r\n return null;\r\n }\r\n const val = +value;\r\n if (!Number.isNaN(val)) {\r\n return val.toLocaleString('vi-VN');\r\n }\r\n return null;\r\n};\r\n\r\nNumber.isPositiveInteger = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const regex = /^([0-9]*)$/;\r\n return regex.test(value) && +value > 0;\r\n};\r\n\r\nNumber.isPositiveNumber = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const regex = /^([0-9]*)(\\.[0-9]+$){0,1}$/;\r\n return regex.test(value) && +value > 0;\r\n};\r\n\r\nNumber.isNumber = (value: any) => {\r\n if (value === undefined || value === null || value === '') {\r\n return false;\r\n }\r\n return !Number.isNaN(+value);\r\n};\r\n","export { };\r\n\r\ndeclare global {\r\n interface StringConstructor {\r\n isValidEmail(value: any): boolean;\r\n isValidPhone(value: any): boolean;\r\n isValidCode(value: any): boolean;\r\n changeAliasLowerCase(alias: any): string;\r\n aliasIncludes(alias: any, searchText: any): boolean;\r\n }\r\n}\r\n\r\nString.isValidEmail = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const re = /^(([^<>()\\[\\]\\.,;:\\s@\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i;\r\n return re.test(value);\r\n};\r\n\r\nString.isValidPhone = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const re = /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$/;\r\n return re.test(value);\r\n};\r\n\r\nString.isValidCode = (value: any) => {\r\n if (!value) {\r\n return false;\r\n }\r\n const re = /^[a-zA-Z0-9\\@\\_\\-]{2,20}$/;\r\n return re.test(value);\r\n};\r\n\r\nString.changeAliasLowerCase = (alias: any) => {\r\n let str: string = alias?.toString() ?? '';\r\n str = str.toString().toLowerCase();\r\n str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, 'a');\r\n str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, 'e');\r\n str = str.replace(/ì|í|ị|ỉ|ĩ/g, 'i');\r\n str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, 'o');\r\n str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, 'u');\r\n str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, 'y');\r\n str = str.replace(/đ/g, 'd');\r\n str = str.replace(/!|@|%|\\^|\\*|\\(|\\)|\\+|\\=|\\<|\\>|\\?|\\/|,|\\.|\\:|\\;|\\'|\\\"|\\&|\\#|\\[|\\]|~|\\$|_|`|-|{|}|\\||\\\\/g, ' ');\r\n str = str.replace(/ + /g, ' ');\r\n str = str.trim();\r\n return str;\r\n}\r\n\r\nString.aliasIncludes = (alias: any, searchText: any) => {\r\n return String.changeAliasLowerCase(alias).includes(String.changeAliasLowerCase(searchText));\r\n}","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 { Directive, Input, TemplateRef, ViewContainerRef } from \"@angular/core\";\r\n@Directive({\r\n selector: '[sdLet]',\r\n})\r\nexport class SdLetDirective {\r\n @Input()\r\n set sdLet(context: any) {\r\n this.context.$implicit = this.context.sdLet = context;\r\n this.updateView();\r\n }\r\n context: any = {};\r\n\r\n constructor(private vcRef: ViewContainerRef, private templateRef: TemplateRef<any>) { }\r\n\r\n updateView() {\r\n this.vcRef.clear();\r\n this.vcRef.createEmbeddedView(this.templateRef, this.context);\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdViewDefDirective } from './directives/view-def.directive';\r\nimport { SdLetDirective } from './directives/sd-let.directive';\r\n// import './typings';\r\n@NgModule({\r\n imports: [\r\n CommonModule\r\n ],\r\n declarations: [\r\n SdViewDefDirective,\r\n SdLetDirective\r\n ],\r\n exports: [\r\n SdViewDefDirective,\r\n SdLetDirective\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":";;;;;AAmBA,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,UAAmB,UAAe,EAAE,MAA0B;IACrF,MAAM,KAAK,GAAQ,IAAI,CAAC;IACxB,IAAI,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,GAAE,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzB,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,MAAM,CAA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K,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 { MatTooltipModule } from '@angular/material/tooltip';
8
8
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
9
9
  import { __classPrivateFieldGet, __awaiter, __classPrivateFieldSet } from 'tslib';
10
10
  import { v4 } from 'uuid';
11
- import { Subject, Subscription, combineLatest } from 'rxjs';
11
+ import { Subject, BehaviorSubject, Subscription, combineLatest } from 'rxjs';
12
12
  import { startWith, debounceTime, switchMap, map } from 'rxjs/operators';
13
13
  import { SdFormControl, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
14
14
  import { MatSelectModule } from '@angular/material/select';
@@ -29,7 +29,7 @@ SdSelectDisplayDefDirective.ctorParameters = () => [
29
29
  { type: TemplateRef }
30
30
  ];
31
31
 
32
- var _input, _name, _form, _items, _delay, _validator, _subscription, _selectedItems, _allItems, _allItem, _cache, _updateValidator, _loadSelectedItems, _loadItems, _onChange, _customValidator;
32
+ var _input, _name, _form, _itemsChanges, _delay, _validator, _subscription, _allItems, _allItem, _cache, _updateValidator, _loadSelectedItems, _loadItems, _onChange, _customValidator;
33
33
  class SdSelect {
34
34
  constructor(ref) {
35
35
  this.ref = ref;
@@ -40,10 +40,10 @@ class SdSelect {
40
40
  this.searchTerm$ = new Subject();
41
41
  _form.set(this, void 0);
42
42
  // Items
43
- _items.set(this, []);
43
+ _itemsChanges.set(this, new BehaviorSubject([]));
44
44
  // Server search
45
45
  this.loading = false;
46
- _delay.set(this, 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
46
+ _delay.set(this, 0); // 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
47
47
  // Validator
48
48
  this.isRequired = false;
49
49
  _validator.set(this, void 0);
@@ -55,7 +55,6 @@ class SdSelect {
55
55
  this.sdChange = new EventEmitter();
56
56
  this.sdSelection = new EventEmitter();
57
57
  _subscription.set(this, new Subscription());
58
- _selectedItems.set(this, void 0);
59
58
  _allItems.set(this, void 0);
60
59
  _allItem.set(this, {});
61
60
  this.allSelected = false;
@@ -86,27 +85,26 @@ class SdSelect {
86
85
  }
87
86
  this.loading = true;
88
87
  if (values.some(val => __classPrivateFieldGet(this, _allItem)[val] === undefined)) {
89
- const results = yield items(value, true).finally(() => this.loading = false);
88
+ const results = yield items(value, true).catch(() => []).finally(() => this.loading = false);
90
89
  const objItem = Array.toObject(results, this.valueField);
91
- __classPrivateFieldSet(this, _allItem, Object.assign(Object.assign(Object.assign({}, values.map(val => ({ [val]: { [this.valueField]: val, [this.displayField]: val } }))), __classPrivateFieldGet(this, _allItem)), objItem));
90
+ __classPrivateFieldSet(this, _allItem, Object.assign(Object.assign(Object.assign({}, values.map(val => ({ [val === null || val === void 0 ? void 0 : val.toString()]: { [this.valueField]: val, [this.displayField]: val } }))), __classPrivateFieldGet(this, _allItem)), objItem));
92
91
  }
93
92
  return values.map(val => __classPrivateFieldGet(this, _allItem)[val]);
94
93
  }));
95
94
  _loadItems.set(this, (searchText, items) => __awaiter(this, void 0, void 0, function* () {
95
+ searchText = (searchText === null || searchText === void 0 ? void 0 : searchText.toString()) || '';
96
96
  if (__classPrivateFieldGet(this, _cache)[searchText] === undefined) {
97
97
  this.loading = true;
98
98
  const results = yield items(searchText).catch(() => []).finally(() => this.loading = false);
99
99
  const objItem = Array.toObject(results, this.valueField);
100
100
  __classPrivateFieldSet(this, _allItem, Object.assign(Object.assign({}, __classPrivateFieldGet(this, _allItem)), objItem));
101
- if (this.multiple) {
102
- const selectedItems = yield __classPrivateFieldGet(this, _loadSelectedItems).call(this, this.formControl.value, items);
103
- __classPrivateFieldGet(this, _cache)[searchText] = [...selectedItems, ...results].union(this.valueField);
104
- }
105
- else {
106
- __classPrivateFieldGet(this, _cache)[searchText] = results.union(this.valueField);
107
- }
101
+ __classPrivateFieldGet(this, _cache)[searchText] = results.union(this.valueField);
102
+ }
103
+ if (!this.multiple) {
104
+ return __classPrivateFieldGet(this, _cache)[searchText];
108
105
  }
109
- return __classPrivateFieldGet(this, _cache)[searchText];
106
+ const selectedItems = yield __classPrivateFieldGet(this, _loadSelectedItems).call(this, this.formControl.value, items);
107
+ return [...selectedItems, ...__classPrivateFieldGet(this, _cache)[searchText]].union(this.valueField);
110
108
  }));
111
109
  this.onSelectionChange = (change) => {
112
110
  var _a;
@@ -123,13 +121,13 @@ class SdSelect {
123
121
  this.reValidate = () => {
124
122
  this.formControl.updateValueAndValidity({ emitEvent: true });
125
123
  };
126
- _onChange.set(this, (value) => {
124
+ _onChange.set(this, (value) => __awaiter(this, void 0, void 0, function* () {
127
125
  if (Array.isArray(value)) {
128
126
  this.modelChange.emit(value);
129
127
  this.sdChange.emit(value);
130
128
  this.sdSelection.emit({
131
129
  value: value,
132
- items: this.selectedItems
130
+ items: value.map(val => __classPrivateFieldGet(this, _allItem)[val === null || val === void 0 ? void 0 : val.toString()])
133
131
  });
134
132
  }
135
133
  else {
@@ -137,10 +135,10 @@ class SdSelect {
137
135
  this.sdChange.emit(value);
138
136
  this.sdSelection.emit({
139
137
  value: value,
140
- item: this.selectedItems[0]
138
+ item: __classPrivateFieldGet(this, _allItem)[value === null || value === void 0 ? void 0 : value.toString()]
141
139
  });
142
140
  }
143
- });
141
+ }));
144
142
  this.clear = ($event) => {
145
143
  $event === null || $event === void 0 ? void 0 : $event.stopPropagation();
146
144
  if (this.multiple) {
@@ -244,14 +242,16 @@ class SdSelect {
244
242
  this.formControl.setValue(value);
245
243
  }
246
244
  set items(items) {
245
+ __classPrivateFieldSet(this, _delay, 0);
247
246
  if (!items) {
248
- __classPrivateFieldSet(this, _items, []);
247
+ __classPrivateFieldGet(this, _itemsChanges).next([]);
249
248
  }
250
249
  else if (Array.isArray(items)) {
251
- __classPrivateFieldSet(this, _items, items.filter(e => e !== null && e !== undefined));
250
+ __classPrivateFieldGet(this, _itemsChanges).next(items.filter(e => e !== null && e !== undefined));
252
251
  }
253
252
  else {
254
- __classPrivateFieldSet(this, _items, items);
253
+ __classPrivateFieldSet(this, _delay, 500);
254
+ __classPrivateFieldGet(this, _itemsChanges).next(items);
255
255
  }
256
256
  this.searchTerm$.next('');
257
257
  }
@@ -287,15 +287,17 @@ class SdSelect {
287
287
  this.ref.markForCheck();
288
288
  }));
289
289
  __classPrivateFieldSet(this, _allItems, combineLatest([
290
- this.searchTerm$.asObservable().pipe(startWith(''), debounceTime(typeof (__classPrivateFieldGet(this, _items)) === 'function' ? __classPrivateFieldGet(this, _delay) : 0)),
290
+ __classPrivateFieldGet(this, _itemsChanges).asObservable(),
291
+ this.searchTerm$.asObservable().pipe(startWith(''), debounceTime(__classPrivateFieldGet(this, _delay))),
291
292
  this.formControl.valueChanges.pipe(startWith(this.formControl.value))
292
- ]).pipe(switchMap(([val, formValue]) => __awaiter(this, void 0, void 0, function* () {
293
- if (typeof (__classPrivateFieldGet(this, _items)) === 'function') {
294
- return yield __classPrivateFieldGet(this, _loadItems).call(this, val, __classPrivateFieldGet(this, _items));
293
+ ]).pipe(switchMap(([items, val, formValue]) => __awaiter(this, void 0, void 0, function* () {
294
+ if (typeof (items) === 'function') {
295
+ return yield __classPrivateFieldGet(this, _loadItems).call(this, val, items);
295
296
  }
297
+ __classPrivateFieldSet(this, _allItem, items.toObject(this.valueField));
296
298
  const isArray = Array.isArray(formValue);
297
299
  const hasFields = !!this.valueField && !!this.displayField;
298
- return __classPrivateFieldGet(this, _items).filter(item => {
300
+ return items.filter(item => {
299
301
  const value = hasFields ? item[this.valueField] : item;
300
302
  const display = hasFields ? item[this.displayField] : item;
301
303
  if (String.aliasIncludes(value, val) || String.aliasIncludes(display, val)) {
@@ -307,22 +309,30 @@ class SdSelect {
307
309
  return formValue === value;
308
310
  });
309
311
  }))));
310
- __classPrivateFieldSet(this, _selectedItems, __classPrivateFieldGet(this, _allItems).pipe(map(items => {
311
- const formValue = this.formControl.value;
312
- if (!(formValue === null || formValue === void 0 ? void 0 : formValue.toString())) {
312
+ this.selectedItems = combineLatest([
313
+ __classPrivateFieldGet(this, _itemsChanges).asObservable(),
314
+ this.formControl.valueChanges.pipe(startWith(this.formControl.value))
315
+ ])
316
+ .pipe(switchMap(([items, val]) => __awaiter(this, void 0, void 0, function* () {
317
+ if (!(val === null || val === void 0 ? void 0 : val.toString())) {
313
318
  return [];
314
319
  }
315
- const values = Array.isArray(formValue) ? formValue : [formValue];
316
- this.selectedItems = values.map(val => {
317
- if (this.valueField) {
318
- return items === null || items === void 0 ? void 0 : items.find(item => item[this.valueField] === val);
319
- }
320
- return val;
320
+ const values = Array.isArray(val) ? val : [val];
321
+ if (!this.valueField) {
322
+ return values;
323
+ }
324
+ if (typeof (items) === 'function') {
325
+ return yield __classPrivateFieldGet(this, _loadSelectedItems).call(this, val, items);
326
+ }
327
+ return values.map(val => {
328
+ return (items === null || items === void 0 ? void 0 : items.find(item => item[this.valueField] === val)) || {
329
+ [this.valueField]: val,
330
+ [this.displayField]: val
331
+ };
321
332
  });
322
- return this.selectedItems;
323
333
  })));
324
334
  this.filteredItems = __classPrivateFieldGet(this, _allItems).pipe(map(allItems => allItems.paging(this.limit)));
325
- this.display = __classPrivateFieldGet(this, _selectedItems).pipe(map(selectedItems => { var _a; return (_a = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => this.displayField ? item[this.displayField] : item)) === null || _a === void 0 ? void 0 : _a.join(', '); }));
335
+ this.display = this.selectedItems.pipe(map(selectedItems => { var _a; return (_a = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => this.displayField ? item[this.displayField] : item)) === null || _a === void 0 ? void 0 : _a.join(', '); }));
326
336
  }
327
337
  ngAfterViewInit() {
328
338
  var _a;
@@ -343,11 +353,11 @@ class SdSelect {
343
353
  __classPrivateFieldGet(this, _onChange).call(this, this.formControl.value);
344
354
  }
345
355
  }
346
- _input = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _items = new WeakMap(), _delay = new WeakMap(), _validator = new WeakMap(), _subscription = new WeakMap(), _selectedItems = new WeakMap(), _allItems = new WeakMap(), _allItem = new WeakMap(), _cache = new WeakMap(), _updateValidator = new WeakMap(), _loadSelectedItems = new WeakMap(), _loadItems = new WeakMap(), _onChange = new WeakMap(), _customValidator = new WeakMap();
356
+ _input = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _itemsChanges = new WeakMap(), _delay = new WeakMap(), _validator = new WeakMap(), _subscription = new WeakMap(), _allItems = new WeakMap(), _allItem = new WeakMap(), _cache = new WeakMap(), _updateValidator = new WeakMap(), _loadSelectedItems = new WeakMap(), _loadItems = new WeakMap(), _onChange = new WeakMap(), _customValidator = new WeakMap();
347
357
  SdSelect.decorators = [
348
358
  { type: Component, args: [{
349
359
  selector: 'sd-select',
350
- 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, selectedItems: selectedItems }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item[valueField]\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item[valueField]\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
360
+ 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, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item[valueField]\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item[valueField]\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
351
361
  changeDetection: ChangeDetectionStrategy.OnPush,
352
362
  styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field mat-select.mat-select-disabled .mat-select-value{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}"]
353
363
  },] }