@yoozsoft/yoozsoft-ng 5.3.5 → 7.1.1

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 (113) hide show
  1. package/README.md +143 -24
  2. package/assets/js/UTIF.js-master/LICENSE +21 -21
  3. package/assets/js/UTIF.js-master/README.md +72 -72
  4. package/assets/js/UTIF.js-master/UTIF.js +1762 -1762
  5. package/assets/js/UTIF.js-master/package-lock.json +13 -13
  6. package/assets/js/UTIF.js-master/package.json +24 -0
  7. package/assets/styles/components/_ys-navbar.scss +22 -0
  8. package/assets/styles/components/_ys-pagination.scss +10 -0
  9. package/assets/styles/{ys-layout.scss → utilities/ys-layout.scss} +1 -1
  10. package/assets/styles/ys-styles.scss +2 -0
  11. package/autocomplete/package.json +4 -0
  12. package/date/package.json +4 -0
  13. package/datepicker/package.json +4 -0
  14. package/dropdown/package.json +4 -0
  15. package/fesm2022/yoozsoft-yoozsoft-ng-autocomplete.mjs +257 -197
  16. package/fesm2022/yoozsoft-yoozsoft-ng-autocomplete.mjs.map +1 -1
  17. package/fesm2022/yoozsoft-yoozsoft-ng-date.mjs +562 -0
  18. package/fesm2022/yoozsoft-yoozsoft-ng-date.mjs.map +1 -0
  19. package/fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs +600 -837
  20. package/fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs.map +1 -1
  21. package/fesm2022/yoozsoft-yoozsoft-ng-dropdown.mjs +161 -151
  22. package/fesm2022/yoozsoft-yoozsoft-ng-dropdown.mjs.map +1 -1
  23. package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs +93 -103
  24. package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs.map +1 -1
  25. package/fesm2022/yoozsoft-yoozsoft-ng-footer.mjs +16 -21
  26. package/fesm2022/yoozsoft-yoozsoft-ng-footer.mjs.map +1 -1
  27. package/fesm2022/yoozsoft-yoozsoft-ng-loading.mjs +20 -24
  28. package/fesm2022/yoozsoft-yoozsoft-ng-loading.mjs.map +1 -1
  29. package/fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs +60 -76
  30. package/fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs.map +1 -1
  31. package/fesm2022/yoozsoft-yoozsoft-ng-overlay.mjs +11 -15
  32. package/fesm2022/yoozsoft-yoozsoft-ng-overlay.mjs.map +1 -1
  33. package/fesm2022/yoozsoft-yoozsoft-ng-pagination.mjs +61 -55
  34. package/fesm2022/yoozsoft-yoozsoft-ng-pagination.mjs.map +1 -1
  35. package/fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs +142 -130
  36. package/fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs.map +1 -1
  37. package/fesm2022/yoozsoft-yoozsoft-ng-pipes.mjs +44 -0
  38. package/fesm2022/yoozsoft-yoozsoft-ng-pipes.mjs.map +1 -0
  39. package/fesm2022/yoozsoft-yoozsoft-ng-progress.mjs +51 -34
  40. package/fesm2022/yoozsoft-yoozsoft-ng-progress.mjs.map +1 -1
  41. package/fesm2022/yoozsoft-yoozsoft-ng-rating.mjs +155 -0
  42. package/fesm2022/yoozsoft-yoozsoft-ng-rating.mjs.map +1 -0
  43. package/fesm2022/yoozsoft-yoozsoft-ng-select.mjs +78 -80
  44. package/fesm2022/yoozsoft-yoozsoft-ng-select.mjs.map +1 -1
  45. package/fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs +99 -99
  46. package/fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs.map +1 -1
  47. package/fesm2022/yoozsoft-yoozsoft-ng-table.mjs +316 -0
  48. package/fesm2022/yoozsoft-yoozsoft-ng-table.mjs.map +1 -0
  49. package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs +128 -114
  50. package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs.map +1 -1
  51. package/fesm2022/yoozsoft-yoozsoft-ng-toast.mjs +112 -62
  52. package/fesm2022/yoozsoft-yoozsoft-ng-toast.mjs.map +1 -1
  53. package/fesm2022/yoozsoft-yoozsoft-ng-validators.mjs +37 -0
  54. package/fesm2022/yoozsoft-yoozsoft-ng-validators.mjs.map +1 -0
  55. package/fesm2022/yoozsoft-yoozsoft-ng.mjs.map +1 -1
  56. package/file-upload/package.json +4 -0
  57. package/footer/package.json +4 -0
  58. package/loading/package.json +4 -0
  59. package/navbar/package.json +4 -0
  60. package/overlay/package.json +4 -0
  61. package/package.json +61 -38
  62. package/pagination/package.json +4 -0
  63. package/password-strength/package.json +4 -0
  64. package/pipes/package.json +4 -0
  65. package/progress/package.json +4 -0
  66. package/rating/package.json +4 -0
  67. package/select/package.json +4 -0
  68. package/sidebar/package.json +4 -0
  69. package/table/package.json +4 -0
  70. package/tiff-viewer/package.json +4 -0
  71. package/toast/package.json +4 -0
  72. package/types/yoozsoft-yoozsoft-ng-autocomplete.d.ts +79 -0
  73. package/types/yoozsoft-yoozsoft-ng-date.d.ts +118 -0
  74. package/types/yoozsoft-yoozsoft-ng-datepicker.d.ts +120 -0
  75. package/types/yoozsoft-yoozsoft-ng-dropdown.d.ts +76 -0
  76. package/types/yoozsoft-yoozsoft-ng-file-upload.d.ts +75 -0
  77. package/types/yoozsoft-yoozsoft-ng-footer.d.ts +26 -0
  78. package/types/yoozsoft-yoozsoft-ng-loading.d.ts +14 -0
  79. package/types/yoozsoft-yoozsoft-ng-navbar.d.ts +60 -0
  80. package/types/yoozsoft-yoozsoft-ng-overlay.d.ts +10 -0
  81. package/types/yoozsoft-yoozsoft-ng-pagination.d.ts +31 -0
  82. package/types/yoozsoft-yoozsoft-ng-password-strength.d.ts +73 -0
  83. package/types/yoozsoft-yoozsoft-ng-pipes.d.ts +11 -0
  84. package/types/yoozsoft-yoozsoft-ng-progress.d.ts +31 -0
  85. package/types/yoozsoft-yoozsoft-ng-rating.d.ts +56 -0
  86. package/types/yoozsoft-yoozsoft-ng-select.d.ts +43 -0
  87. package/types/yoozsoft-yoozsoft-ng-sidebar.d.ts +69 -0
  88. package/types/yoozsoft-yoozsoft-ng-table.d.ts +137 -0
  89. package/types/yoozsoft-yoozsoft-ng-tiff-viewer.d.ts +53 -0
  90. package/types/yoozsoft-yoozsoft-ng-toast.d.ts +66 -0
  91. package/types/yoozsoft-yoozsoft-ng-validators.d.ts +5 -0
  92. package/validators/package.json +4 -0
  93. package/autocomplete/index.d.ts +0 -71
  94. package/datepicker/index.d.ts +0 -291
  95. package/directives/index.d.ts +0 -17
  96. package/dropdown/index.d.ts +0 -62
  97. package/fesm2022/yoozsoft-yoozsoft-ng-directives.mjs +0 -57
  98. package/fesm2022/yoozsoft-yoozsoft-ng-directives.mjs.map +0 -1
  99. package/file-upload/index.d.ts +0 -72
  100. package/footer/index.d.ts +0 -25
  101. package/loading/index.d.ts +0 -13
  102. package/navbar/index.d.ts +0 -56
  103. package/overlay/index.d.ts +0 -11
  104. package/pagination/index.d.ts +0 -29
  105. package/password-strength/index.d.ts +0 -84
  106. package/progress/index.d.ts +0 -28
  107. package/select/index.d.ts +0 -39
  108. package/sidebar/index.d.ts +0 -94
  109. package/tiff-viewer/index.d.ts +0 -52
  110. package/toast/index.d.ts +0 -53
  111. /package/assets/styles/{ys-preloader-9.scss → preloaders/ys-preloader-9.scss} +0 -0
  112. /package/assets/styles/{ys-preloader.scss → preloaders/ys-preloader.scss} +0 -0
  113. /package/{index.d.ts → types/yoozsoft-yoozsoft-ng.d.ts} +0 -0
@@ -1,69 +1,75 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Output, Input, Component } from '@angular/core';
2
+ import { input, model, output, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { FormsModule } from '@angular/forms';
5
5
  import { NgbPagination } from '@ng-bootstrap/ng-bootstrap';
6
6
 
7
- class YsPaginationComponent {
8
- rowsPerPage = [10, 25, 50];
9
- pageReport = true;
10
- pageReportTemplate = 'Showing {first} to {last} of {totalRecords} items';
11
- ellipses = false;
12
- boundaryLinks = true;
13
- maxSize = 5;
14
- rotate = true;
15
- page = 1;
16
- pageSizeSelection = true;
17
- pageSize = this.rowsPerPage[0] || 10;
18
- collectionSize = 0;
19
- pageChange = new EventEmitter();
20
- get firstIndex() { return (this.page - 1) * this.pageSize; }
21
- get lastIndex() { return Math.min(this.firstIndex + this.pageSize, this.collectionSize); }
22
- get totalPages() {
23
- return Math.ceil(this.collectionSize / this.pageSize) || 1;
7
+ class YsPagination {
8
+ rowsPerPage = input([10, 25, 50], /* @ts-ignore */
9
+ ...(ngDevMode ? [{ debugName: "rowsPerPage" }] : /* istanbul ignore next */ []));
10
+ pageReport = input(true, /* @ts-ignore */
11
+ ...(ngDevMode ? [{ debugName: "pageReport" }] : /* istanbul ignore next */ []));
12
+ pageReportTemplate = input('Showing {first} to {last} of {totalRecords} items', /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "pageReportTemplate" }] : /* istanbul ignore next */ []));
14
+ ellipses = input(false, /* @ts-ignore */
15
+ ...(ngDevMode ? [{ debugName: "ellipses" }] : /* istanbul ignore next */ []));
16
+ boundaryLinks = input(true, /* @ts-ignore */
17
+ ...(ngDevMode ? [{ debugName: "boundaryLinks" }] : /* istanbul ignore next */ []));
18
+ maxSize = input(5, /* @ts-ignore */
19
+ ...(ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []));
20
+ rotate = input(true, /* @ts-ignore */
21
+ ...(ngDevMode ? [{ debugName: "rotate" }] : /* istanbul ignore next */ []));
22
+ page = model(1, /* @ts-ignore */
23
+ ...(ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []));
24
+ pageSizeSelection = input(true, /* @ts-ignore */
25
+ ...(ngDevMode ? [{ debugName: "pageSizeSelection" }] : /* istanbul ignore next */ []));
26
+ pageSize = model(10, /* @ts-ignore */
27
+ ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
28
+ collectionSize = input(0, /* @ts-ignore */
29
+ ...(ngDevMode ? [{ debugName: "collectionSize" }] : /* istanbul ignore next */ []));
30
+ pageChanged = output();
31
+ firstIndex = computed(() => (this.page() - 1) * this.pageSize(), /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "firstIndex" }] : /* istanbul ignore next */ []));
33
+ lastIndex = computed(() => Math.min(this.firstIndex() + this.pageSize(), this.collectionSize()), /* @ts-ignore */
34
+ ...(ngDevMode ? [{ debugName: "lastIndex" }] : /* istanbul ignore next */ []));
35
+ totalPages = computed(() => Math.ceil(this.collectionSize() / this.pageSize()) || 1, /* @ts-ignore */
36
+ ...(ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []));
37
+ firstRecord = computed(() => (this.collectionSize() === 0 ? 0 : this.firstIndex() + 1), /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "firstRecord" }] : /* istanbul ignore next */ []));
39
+ pageReportText = computed(() => this.pageReportTemplate()
40
+ .replace('{first}', this.firstRecord() + '')
41
+ .replace('{last}', this.lastIndex() + '')
42
+ .replace('{totalRecords}', this.collectionSize() + ''), /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "pageReportText" }] : /* istanbul ignore next */ []));
44
+ constructor() {
45
+ effect(() => {
46
+ if (!this.rowsPerPage().includes(this.pageSize())) {
47
+ this.pageSize.set(this.rowsPerPage()[0] ?? 10);
48
+ }
49
+ });
24
50
  }
25
51
  changePage(page) {
26
- if (page >= 1 && page <= this.totalPages) {
27
- this.page = page;
28
- this.pageChange.emit({ page: this.page, pageSize: this.pageSize });
29
- }
52
+ this.page.set(page);
53
+ this.pageChanged.emit({
54
+ page,
55
+ pageSize: this.pageSize(),
56
+ });
30
57
  }
31
58
  changePageSize(size) {
32
- this.pageSize = +size;
33
- this.page = 1;
34
- this.pageChange.emit({ page: this.page, pageSize: this.pageSize });
59
+ this.pageSize.set(+size);
60
+ this.page.set(1);
61
+ this.pageChanged.emit({
62
+ page: 1,
63
+ pageSize: size,
64
+ });
35
65
  }
36
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: YsPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
37
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.5", type: YsPaginationComponent, isStandalone: true, selector: "ys-pagination", inputs: { rowsPerPage: "rowsPerPage", pageReport: "pageReport", pageReportTemplate: "pageReportTemplate", ellipses: "ellipses", boundaryLinks: "boundaryLinks", maxSize: "maxSize", rotate: "rotate", page: "page", pageSizeSelection: "pageSizeSelection", pageSize: "pageSize", collectionSize: "collectionSize" }, outputs: { pageChange: "pageChange" }, ngImport: i0, template: "<div class=\"ys-pagination d-flex flex-wrap justify-content-center justify-content-sm-between align-items-center gap-2\">\r\n\r\n <!-- \u0635\u0641\u062D\u0647\u200C\u0628\u0646\u062F\u06CC -->\r\n <ngb-pagination [collectionSize]=\"collectionSize\" [(page)]=\"page\" [pageSize]=\"pageSize\" [maxSize]=\"maxSize\"\r\n [rotate]=\"rotate\" [ellipses]=\"ellipses\" [boundaryLinks]=\"boundaryLinks\" (pageChange)=\"changePage($event)\" />\r\n\r\n <!-- \u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0639\u062F\u0627\u062F \u062F\u0631 \u0647\u0631 \u0635\u0641\u062D\u0647 -->\r\n @if(pageSizeSelection){\r\n <select class=\"pagination-select form-select form-select-sm w-auto me-auto\" [(ngModel)]=\"pageSize\"\r\n (change)=\"changePageSize(pageSize)\" id=\"pagination\">\r\n @for (opt of rowsPerPage; track opt) {\r\n <option [value]=\"opt\">{{ opt }}</option>\r\n }\r\n </select>\r\n }\r\n\r\n <!-- \u06AF\u0632\u0627\u0631\u0634 -->\r\n @if(pageReport){\r\n <small class=\"pagination-report text-muted ms-auto\">\r\n {{ pageReportTemplate\r\n .replace('{first}', firstIndex + 1 + '')\r\n .replace('{last}', lastIndex + '')\r\n .replace('{totalRecords}', collectionSize + '') }}\r\n </small>\r\n }\r\n\r\n</div>", styles: [":host::ng-deep .ys-pagination .pagination{margin-bottom:0!important}:host::ng-deep .ys-pagination .pagination-select{height:-webkit-fill-available;height:stretch}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgbPagination, selector: "ngb-pagination", inputs: ["disabled", "boundaryLinks", "directionLinks", "ellipses", "rotate", "collectionSize", "maxSize", "page", "pageSize", "size"], outputs: ["pageChange"] }] });
66
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsPagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
67
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: YsPagination, isStandalone: true, selector: "ys-pagination", inputs: { rowsPerPage: { classPropertyName: "rowsPerPage", publicName: "rowsPerPage", isSignal: true, isRequired: false, transformFunction: null }, pageReport: { classPropertyName: "pageReport", publicName: "pageReport", isSignal: true, isRequired: false, transformFunction: null }, pageReportTemplate: { classPropertyName: "pageReportTemplate", publicName: "pageReportTemplate", isSignal: true, isRequired: false, transformFunction: null }, ellipses: { classPropertyName: "ellipses", publicName: "ellipses", isSignal: true, isRequired: false, transformFunction: null }, boundaryLinks: { classPropertyName: "boundaryLinks", publicName: "boundaryLinks", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, rotate: { classPropertyName: "rotate", publicName: "rotate", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, pageSizeSelection: { classPropertyName: "pageSizeSelection", publicName: "pageSizeSelection", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, collectionSize: { classPropertyName: "collectionSize", publicName: "collectionSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { page: "pageChange", pageSize: "pageSizeChange", pageChanged: "pageChanged" }, ngImport: i0, template: "<div class=\"ys-pagination d-flex flex-wrap justify-content-center justify-content-sm-between align-items-center gap-2\">\n\n <!-- \u0635\u0641\u062D\u0647\u200C\u0628\u0646\u062F\u06CC -->\n <ngb-pagination [collectionSize]=\"collectionSize()\" [page]=\"page()\" [pageSize]=\"pageSize()\" [maxSize]=\"maxSize()\"\n [rotate]=\"rotate()\" [ellipses]=\"ellipses()\" [boundaryLinks]=\"boundaryLinks()\"\n (pageChange)=\"changePage($event)\" />\n\n <!-- \u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0639\u062F\u0627\u062F \u062F\u0631 \u0647\u0631 \u0635\u0641\u062D\u0647 -->\n @if(pageSizeSelection()){\n <select class=\"pagination-select form-select form-select-sm w-auto me-auto\" [ngModel]=\"pageSize()\"\n (ngModelChange)=\"changePageSize($event)\" id=\"pagination\">\n @for (rows of rowsPerPage(); track rows) {\n <option [value]=\"rows\">{{ rows }}</option>\n }\n </select>\n }\n\n <!-- \u06AF\u0632\u0627\u0631\u0634 -->\n @if(pageReport()){\n <small class=\"pagination-report text-muted ms-auto\">\n {{ pageReportText() }}\n </small>\n }\n\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgbPagination, selector: "ngb-pagination", inputs: ["disabled", "boundaryLinks", "directionLinks", "ellipses", "rotate", "collectionSize", "maxSize", "page", "pageSize", "size"], outputs: ["pageChange"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
38
68
  }
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: YsPaginationComponent, decorators: [{
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsPagination, decorators: [{
40
70
  type: Component,
41
- args: [{ selector: 'ys-pagination', imports: [FormsModule, NgbPagination], template: "<div class=\"ys-pagination d-flex flex-wrap justify-content-center justify-content-sm-between align-items-center gap-2\">\r\n\r\n <!-- \u0635\u0641\u062D\u0647\u200C\u0628\u0646\u062F\u06CC -->\r\n <ngb-pagination [collectionSize]=\"collectionSize\" [(page)]=\"page\" [pageSize]=\"pageSize\" [maxSize]=\"maxSize\"\r\n [rotate]=\"rotate\" [ellipses]=\"ellipses\" [boundaryLinks]=\"boundaryLinks\" (pageChange)=\"changePage($event)\" />\r\n\r\n <!-- \u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0639\u062F\u0627\u062F \u062F\u0631 \u0647\u0631 \u0635\u0641\u062D\u0647 -->\r\n @if(pageSizeSelection){\r\n <select class=\"pagination-select form-select form-select-sm w-auto me-auto\" [(ngModel)]=\"pageSize\"\r\n (change)=\"changePageSize(pageSize)\" id=\"pagination\">\r\n @for (opt of rowsPerPage; track opt) {\r\n <option [value]=\"opt\">{{ opt }}</option>\r\n }\r\n </select>\r\n }\r\n\r\n <!-- \u06AF\u0632\u0627\u0631\u0634 -->\r\n @if(pageReport){\r\n <small class=\"pagination-report text-muted ms-auto\">\r\n {{ pageReportTemplate\r\n .replace('{first}', firstIndex + 1 + '')\r\n .replace('{last}', lastIndex + '')\r\n .replace('{totalRecords}', collectionSize + '') }}\r\n </small>\r\n }\r\n\r\n</div>", styles: [":host::ng-deep .ys-pagination .pagination{margin-bottom:0!important}:host::ng-deep .ys-pagination .pagination-select{height:-webkit-fill-available;height:stretch}\n"] }]
42
- }], propDecorators: { rowsPerPage: [{
43
- type: Input
44
- }], pageReport: [{
45
- type: Input
46
- }], pageReportTemplate: [{
47
- type: Input
48
- }], ellipses: [{
49
- type: Input
50
- }], boundaryLinks: [{
51
- type: Input
52
- }], maxSize: [{
53
- type: Input
54
- }], rotate: [{
55
- type: Input
56
- }], page: [{
57
- type: Input
58
- }], pageSizeSelection: [{
59
- type: Input
60
- }], pageSize: [{
61
- type: Input
62
- }], collectionSize: [{
63
- type: Input
64
- }], pageChange: [{
65
- type: Output
66
- }] } });
71
+ args: [{ selector: 'ys-pagination', imports: [FormsModule, NgbPagination], changeDetection: ChangeDetectionStrategy.Eager, template: "<div class=\"ys-pagination d-flex flex-wrap justify-content-center justify-content-sm-between align-items-center gap-2\">\n\n <!-- \u0635\u0641\u062D\u0647\u200C\u0628\u0646\u062F\u06CC -->\n <ngb-pagination [collectionSize]=\"collectionSize()\" [page]=\"page()\" [pageSize]=\"pageSize()\" [maxSize]=\"maxSize()\"\n [rotate]=\"rotate()\" [ellipses]=\"ellipses()\" [boundaryLinks]=\"boundaryLinks()\"\n (pageChange)=\"changePage($event)\" />\n\n <!-- \u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0639\u062F\u0627\u062F \u062F\u0631 \u0647\u0631 \u0635\u0641\u062D\u0647 -->\n @if(pageSizeSelection()){\n <select class=\"pagination-select form-select form-select-sm w-auto me-auto\" [ngModel]=\"pageSize()\"\n (ngModelChange)=\"changePageSize($event)\" id=\"pagination\">\n @for (rows of rowsPerPage(); track rows) {\n <option [value]=\"rows\">{{ rows }}</option>\n }\n </select>\n }\n\n <!-- \u06AF\u0632\u0627\u0631\u0634 -->\n @if(pageReport()){\n <small class=\"pagination-report text-muted ms-auto\">\n {{ pageReportText() }}\n </small>\n }\n\n</div>" }]
72
+ }], ctorParameters: () => [], propDecorators: { rowsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowsPerPage", required: false }] }], pageReport: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageReport", required: false }] }], pageReportTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageReportTemplate", required: false }] }], ellipses: [{ type: i0.Input, args: [{ isSignal: true, alias: "ellipses", required: false }] }], boundaryLinks: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaryLinks", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], rotate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rotate", required: false }] }], page: [{ type: i0.Input, args: [{ isSignal: true, alias: "page", required: false }] }, { type: i0.Output, args: ["pageChange"] }], pageSizeSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeSelection", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], collectionSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "collectionSize", required: false }] }], pageChanged: [{ type: i0.Output, args: ["pageChanged"] }] } });
67
73
 
68
74
  /*
69
75
  * Public API Surface of ys-pagination
@@ -73,5 +79,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImpor
73
79
  * Generated bundle index. Do not edit.
74
80
  */
75
81
 
76
- export { YsPaginationComponent };
82
+ export { YsPagination };
77
83
  //# sourceMappingURL=yoozsoft-yoozsoft-ng-pagination.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"yoozsoft-yoozsoft-ng-pagination.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/pagination/src/ys-pagination/ys-pagination.component.ts","../../../../projects/yoozsoft/yoozsoft-ng/pagination/src/ys-pagination/ys-pagination.component.html","../../../../projects/yoozsoft/yoozsoft-ng/pagination/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/pagination/yoozsoft-yoozsoft-ng-pagination.ts"],"sourcesContent":["import { Component, EventEmitter, Input, Output } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { NgbPagination } from '@ng-bootstrap/ng-bootstrap';\r\n\r\n@Component({\r\n selector: 'ys-pagination',\r\n imports: [FormsModule, NgbPagination],\r\n templateUrl: './ys-pagination.component.html',\r\n styleUrl: './ys-pagination.component.scss'\r\n})\r\nexport class YsPaginationComponent {\r\n\r\n @Input() rowsPerPage: number[] = [10, 25, 50];\r\n @Input() pageReport: boolean = true;\r\n @Input() pageReportTemplate: string = 'Showing {first} to {last} of {totalRecords} items';\r\n @Input() ellipses: boolean = false;\r\n @Input() boundaryLinks: boolean = true;\r\n @Input() maxSize: number = 5;\r\n @Input() rotate: boolean = true;\r\n\r\n @Input() page: number = 1;\r\n @Input() pageSizeSelection: boolean = true;\r\n @Input() pageSize: number = this.rowsPerPage[0] || 10;\r\n @Input() collectionSize: number = 0;\r\n\r\n @Output() pageChange = new EventEmitter<{ page: number, pageSize: number }>();\r\n\r\n get firstIndex(): number { return (this.page - 1) * this.pageSize; }\r\n get lastIndex(): number { return Math.min(this.firstIndex + this.pageSize, this.collectionSize); }\r\n\r\n get totalPages(): number {\r\n return Math.ceil(this.collectionSize / this.pageSize) || 1;\r\n }\r\n\r\n changePage(page: number): void {\r\n if (page >= 1 && page <= this.totalPages) {\r\n this.page = page;\r\n\r\n this.pageChange.emit({ page: this.page, pageSize: this.pageSize });\r\n }\r\n }\r\n\r\n changePageSize(size: number): void {\r\n this.pageSize = +size;\r\n this.page = 1;\r\n this.pageChange.emit({ page: this.page, pageSize: this.pageSize });\r\n }\r\n\r\n}","<div class=\"ys-pagination d-flex flex-wrap justify-content-center justify-content-sm-between align-items-center gap-2\">\r\n\r\n <!-- صفحه‌بندی -->\r\n <ngb-pagination [collectionSize]=\"collectionSize\" [(page)]=\"page\" [pageSize]=\"pageSize\" [maxSize]=\"maxSize\"\r\n [rotate]=\"rotate\" [ellipses]=\"ellipses\" [boundaryLinks]=\"boundaryLinks\" (pageChange)=\"changePage($event)\" />\r\n\r\n <!-- انتخاب تعداد در هر صفحه -->\r\n @if(pageSizeSelection){\r\n <select class=\"pagination-select form-select form-select-sm w-auto me-auto\" [(ngModel)]=\"pageSize\"\r\n (change)=\"changePageSize(pageSize)\" id=\"pagination\">\r\n @for (opt of rowsPerPage; track opt) {\r\n <option [value]=\"opt\">{{ opt }}</option>\r\n }\r\n </select>\r\n }\r\n\r\n <!-- گزارش -->\r\n @if(pageReport){\r\n <small class=\"pagination-report text-muted ms-auto\">\r\n {{ pageReportTemplate\r\n .replace('{first}', firstIndex + 1 + '')\r\n .replace('{last}', lastIndex + '')\r\n .replace('{totalRecords}', collectionSize + '') }}\r\n </small>\r\n }\r\n\r\n</div>","/*\r\n * Public API Surface of ys-pagination\r\n */\r\n\r\nexport * from './src/ys-pagination/ys-pagination.component';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAUa,qBAAqB,CAAA;IAEvB,WAAW,GAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IACpC,UAAU,GAAY,IAAI;IAC1B,kBAAkB,GAAW,mDAAmD;IAChF,QAAQ,GAAY,KAAK;IACzB,aAAa,GAAY,IAAI;IAC7B,OAAO,GAAW,CAAC;IACnB,MAAM,GAAY,IAAI;IAEtB,IAAI,GAAW,CAAC;IAChB,iBAAiB,G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,CAAA;sBAAhB;gBACQ,aAAa,EAAA,CAAA;sBAArB;gBACQ,OAAO,EAAA,CAAA;sBAAf;gBACQ,MAAM,EAAA,CAAA;sBAAd;gBAEQ,IAAI,EAAA,CAAA;sBAAZ;gBACQ,iBAAiB,EAAA,CAAA;sBAAzB;gBACQ,QAAQ,EAAA,CAAA;sBAAhB;gBACQ,cAAc,EAAA,CAAA;sBAAtB;gBAES,UAAU,EAAA,CAAA;sBAAnB;;;AEzBH;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"yoozsoft-yoozsoft-ng-pagination.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/pagination/src/ys-pagination/ys-pagination.ts","../../../../projects/yoozsoft/yoozsoft-ng/pagination/src/ys-pagination/ys-pagination.html","../../../../projects/yoozsoft/yoozsoft-ng/pagination/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/pagination/yoozsoft-yoozsoft-ng-pagination.ts"],"sourcesContent":["import {\r\n Component,\r\n computed,\r\n effect,\r\n input,\r\n model,\r\n output,\r\n ChangeDetectionStrategy,\r\n} from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { NgbPagination } from '@ng-bootstrap/ng-bootstrap';\r\n\r\n@Component({\r\n selector: 'ys-pagination',\r\n imports: [FormsModule, NgbPagination],\r\n templateUrl: './ys-pagination.html',\r\n changeDetection: ChangeDetectionStrategy.Eager,\r\n styleUrl: './ys-pagination.scss',\r\n})\r\nexport class YsPagination {\r\n rowsPerPage = input<number[]>([10, 25, 50]);\r\n pageReport = input(true);\r\n pageReportTemplate = input<string>('Showing {first} to {last} of {totalRecords} items');\r\n ellipses = input<boolean>(false);\r\n boundaryLinks = input<boolean>(true);\r\n maxSize = input<number>(5);\r\n rotate = input<boolean>(true);\r\n\r\n page = model<number>(1);\r\n pageSizeSelection = input<boolean>(true);\r\n pageSize = model<number>(10);\r\n collectionSize = input<number>(0);\r\n\r\n pageChanged = output<{ page: number; pageSize: number }>();\r\n\r\n readonly firstIndex = computed<number>(() => (this.page() - 1) * this.pageSize());\r\n\r\n readonly lastIndex = computed<number>(() =>\r\n Math.min(this.firstIndex() + this.pageSize(), this.collectionSize()),\r\n );\r\n\r\n readonly totalPages = computed<number>(\r\n () => Math.ceil(this.collectionSize() / this.pageSize()) || 1,\r\n );\r\n\r\n readonly firstRecord = computed(() => (this.collectionSize() === 0 ? 0 : this.firstIndex() + 1));\r\n\r\n readonly pageReportText = computed(() =>\r\n this.pageReportTemplate()\r\n .replace('{first}', this.firstRecord() + '')\r\n .replace('{last}', this.lastIndex() + '')\r\n .replace('{totalRecords}', this.collectionSize() + ''),\r\n );\r\n\r\n constructor() {\r\n effect(() => {\r\n if (!this.rowsPerPage().includes(this.pageSize())) {\r\n this.pageSize.set(this.rowsPerPage()[0] ?? 10);\r\n }\r\n });\r\n }\r\n\r\n changePage(page: number): void {\r\n this.page.set(page);\r\n\r\n this.pageChanged.emit({\r\n page,\r\n pageSize: this.pageSize(),\r\n });\r\n }\r\n\r\n changePageSize(size: number): void {\r\n this.pageSize.set(+size);\r\n this.page.set(1);\r\n\r\n this.pageChanged.emit({\r\n page: 1,\r\n pageSize: size,\r\n });\r\n }\r\n}\r\n","<div class=\"ys-pagination d-flex flex-wrap justify-content-center justify-content-sm-between align-items-center gap-2\">\n\n <!-- صفحه‌بندی -->\n <ngb-pagination [collectionSize]=\"collectionSize()\" [page]=\"page()\" [pageSize]=\"pageSize()\" [maxSize]=\"maxSize()\"\n [rotate]=\"rotate()\" [ellipses]=\"ellipses()\" [boundaryLinks]=\"boundaryLinks()\"\n (pageChange)=\"changePage($event)\" />\n\n <!-- انتخاب تعداد در هر صفحه -->\n @if(pageSizeSelection()){\n <select class=\"pagination-select form-select form-select-sm w-auto me-auto\" [ngModel]=\"pageSize()\"\n (ngModelChange)=\"changePageSize($event)\" id=\"pagination\">\n @for (rows of rowsPerPage(); track rows) {\n <option [value]=\"rows\">{{ rows }}</option>\n }\n </select>\n }\n\n <!-- گزارش -->\n @if(pageReport()){\n <small class=\"pagination-report text-muted ms-auto\">\n {{ pageReportText() }}\n </small>\n }\n\n</div>","/*\r\n * Public API Surface of ys-pagination\r\n */\r\n\r\nexport * from './src/ys-pagination/ys-pagination';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAmBa,YAAY,CAAA;IACvB,WAAW,GAAG,KAAK,CAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;oFAAC;IAC3C,UAAU,GAAG,KAAK,CAAC,IAAI;mFAAC;IACxB,kBAAkB,GAAG,KAAK,CAAS,mDAAmD;2FAAC;IACvF,QAAQ,GAAG,KAAK,CAAU,KAAK;iFAAC;IAChC,aAAa,GAAG,KAAK,CAAU,IAAI;sFAAC;IACpC,OAAO,GAAG,KAAK,CAAS,CAAC;gFAAC;IAC1B,MAAM,GAAG,KAAK,CAAU,IAAI;+EAAC;IAE7B,IAAI,GAAG,KAAK,CAAS,CAAC;6EAAC;IACvB,iBAAiB,GAAG,KAAK,CAAU,IAAI;0FAAC;IACxC,QAAQ,GAAG,KAAK,CAAS,EAAE;iFAAC;IAC5B,cAAc,GAAG,KAAK,CAAS,CAAC;uFAAC;IAEjC,WAAW,GAAG,MAAM,EAAsC;AAEjD,IAAA,UAAU,GAAG,QAAQ,CAAS,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;mFAAC;IAExE,SAAS,GAAG,QAAQ,CAAS,MACpC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;kFACrE;IAEQ,UAAU,GAAG,QAAQ,CAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;mFAC9D;IA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AA,EAAA,CAAA;;2FAKzB,YAAY,EAAA,UAAA,EAAA,CAAA;kBAPxB,SAAS;+BACE,eAAe,EAAA,OAAA,EAChB,CAAC,WAAW,EAAE,aAAa,CAAC,EAAA,eAAA,EAEpB,uBAAuB,CAAC,KAAK,EAAA,QAAA,EAAA,onCAAA,EAAA;;;AEhBhD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1,156 +1,168 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Input, Component, Directive } from '@angular/core';
2
+ import { input, signal, computed, effect, ChangeDetectionStrategy, Component, inject, ViewContainerRef, Injector, Directive } from '@angular/core';
3
+ import { Validators, NgControl } from '@angular/forms';
3
4
  import { NgClass } from '@angular/common';
4
- import * as i1 from '@angular/forms';
5
- import { Validators } from '@angular/forms';
6
5
 
7
- const StrongPasswordRegx = /^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=\D*\d)(?=.*[!@#$%^&*]).{8,}$/;
8
- const UppercaseRegx = /^.*[A-Z]/;
9
- const LowercaseRegx = /^.*[a-z]/;
10
- const DigitRegx = /^.*[0-9].*/;
11
- const NonAlphanumericRegx = /^.*[!@#$%^&*]/;
6
+ const STRONG_PASSWORD_REGX = /^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=\D*\d)(?=.*[!@#$%^&*]).{8,}$/;
7
+ const UPPERCASE_REGEX = /^.*[A-Z]/;
8
+ const LOWERCASE_REGEX = /^.*[a-z]/;
9
+ const DIGIT_REGX = /^.*[0-9].*/;
10
+ const NON_ALPHANUMERIC_REGX = /^.*[!@#$%^&*]/;
12
11
  // export const MinLength8Regx: RegExp = /^.{8,}/;
13
12
 
14
- class StrengthValidationFeedback {
15
- required;
16
- uppercase;
17
- lowercase;
18
- digit;
19
- nonAlphanumeric;
20
- minLength;
21
- constructor(options) {
22
- this.required = options?.required == undefined ? 'Please enter a valid password.' : options?.required;
23
- this.uppercase = options?.uppercase == undefined ? 'At least one uppercase letter.' : options?.uppercase;
24
- this.lowercase = options?.lowercase == undefined ? 'At least one lowercase letter.' : options?.lowercase;
25
- this.digit = options?.digit == undefined ? 'At least one digit.' : options?.digit;
26
- this.nonAlphanumeric = options?.nonAlphanumeric == undefined ? 'At least one special character (e.g., !, @, #, $).' : options?.nonAlphanumeric;
27
- this.minLength = options?.minLength == undefined ? 'At least 8 characters long.' : options?.minLength;
28
- }
29
- }
13
+ const DEFAULT_FEEDBACK = {
14
+ required: 'Please enter a valid password.',
15
+ uppercase: 'At least one uppercase letter.',
16
+ lowercase: 'At least one lowercase letter.',
17
+ digit: 'At least one digit.',
18
+ nonAlphanumeric: 'At least one special character (e.g., !, @, #, $).',
19
+ minLength: 'At least 8 characters long.',
20
+ };
30
21
 
31
- class StrengthValidationOption {
32
- requireUppercase;
33
- requireLowercase;
34
- requireDigit;
35
- requireNonAlphanumeric;
36
- requiredMinLength;
37
- constructor(options) {
38
- this.requireUppercase = options?.requireUppercase == undefined ? true : options?.requireUppercase;
39
- this.requireLowercase = options?.requireLowercase == undefined ? true : options?.requireLowercase;
40
- this.requireDigit = options?.requireDigit == undefined ? true : options?.requireDigit;
41
- this.requireNonAlphanumeric = options?.requireNonAlphanumeric == undefined ? true : options?.requireNonAlphanumeric;
42
- this.requiredMinLength = options?.requiredMinLength == undefined ? 8 : options?.requiredMinLength;
43
- }
44
- }
22
+ const DEFAULT_OPTIONS = {
23
+ requireUppercase: true,
24
+ requireLowercase: true,
25
+ requireDigit: true,
26
+ requireNonAlphanumeric: true,
27
+ requiredMinLength: 8,
28
+ };
45
29
 
46
- class YsPasswordStrengthComponent {
47
- passwordHelp = null;
48
- displayFeedback = true;
49
- feedback = new StrengthValidationFeedback();
30
+ class YsPasswordStrength {
50
31
  minLengthRegx = new RegExp('');
51
- _control;
52
- get control() { return this._control; }
53
- set control(value) {
54
- this._control = value;
55
- if (!this._control) {
56
- return;
57
- }
58
- if (!this._control.options) {
59
- this._control.options = new StrengthValidationOption();
60
- }
61
- const strongPasswordRegx = new RegExp(`${this._control.options.requireUppercase ? '^(?=[^A-Z]*[A-Z])' : ''}${this._control.options.requireLowercase ? '(?=[^a-z]*[a-z])' : ''}${this._control.options.requireDigit ? '(?=\\D*\\d)' : ''}${this._control.options.requireNonAlphanumeric ? '(?=.*[!@#$%^&*])' : ''}.{${this._control.options.requiredMinLength},}$`);
62
- this.minLengthRegx = new RegExp(`.{${this._control.options.requiredMinLength},}$`);
63
- this._control.formControl?.addValidators([Validators.required, Validators.pattern(strongPasswordRegx)]);
64
- this._control.formControl?.updateValueAndValidity();
65
- }
66
- get requiredOptionsLength() { return Object.values(this.control?.options).filter(x => x).length; }
67
- get hasUppercase() { return this.control?.formControl?.value && UppercaseRegx.test(this.control?.formControl?.value); }
68
- get hasLowercase() { return this.control?.formControl?.value && LowercaseRegx.test(this.control?.formControl?.value); }
69
- get hasDigit() { return this.control?.formControl?.value && DigitRegx.test(this.control?.formControl?.value); }
70
- get hasNonAlphanumeric() { return this.control?.formControl?.value && NonAlphanumericRegx.test(this.control?.formControl?.value); }
71
- get hasMinLength() { return this.control?.formControl?.value && this.minLengthRegx.test(this.control?.formControl?.value); }
72
- get strengthMeter() {
32
+ passwordHelp = input(null, /* @ts-ignore */
33
+ ...(ngDevMode ? [{ debugName: "passwordHelp" }] : /* istanbul ignore next */ []));
34
+ displayFeedback = input(true, /* @ts-ignore */
35
+ ...(ngDevMode ? [{ debugName: "displayFeedback" }] : /* istanbul ignore next */ []));
36
+ feedback = input({}, /* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "feedback" }] : /* istanbul ignore next */ []));
38
+ control = input(/* @ts-ignore */
39
+ ...(ngDevMode ? [undefined, { debugName: "control" }] : /* istanbul ignore next */ []));
40
+ passwordValue = signal('', /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "passwordValue" }] : /* istanbul ignore next */ []));
42
+ hasUppercase = computed(() => UPPERCASE_REGEX.test(this.passwordValue()), /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "hasUppercase" }] : /* istanbul ignore next */ []));
44
+ hasLowercase = computed(() => LOWERCASE_REGEX.test(this.passwordValue()), /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "hasLowercase" }] : /* istanbul ignore next */ []));
46
+ hasDigit = computed(() => DIGIT_REGX.test(this.passwordValue()), /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "hasDigit" }] : /* istanbul ignore next */ []));
48
+ hasNonAlphanumeric = computed(() => NON_ALPHANUMERIC_REGX.test(this.passwordValue()), /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "hasNonAlphanumeric" }] : /* istanbul ignore next */ []));
50
+ hasMinLength = computed(() => this.minLengthRegx.test(this.passwordValue()), /* @ts-ignore */
51
+ ...(ngDevMode ? [{ debugName: "hasMinLength" }] : /* istanbul ignore next */ []));
52
+ strengthMeter = computed(() => {
73
53
  let strength = -1;
74
- if (this.control?.options?.requireUppercase && this.hasUppercase)
54
+ if (this.mergedOptions().requireUppercase && this.hasUppercase())
75
55
  strength += 1;
76
- if (this.control?.options?.requireLowercase && this.hasLowercase)
56
+ if (this.mergedOptions().requireLowercase && this.hasLowercase())
77
57
  strength += 1;
78
- if (this.control?.options?.requireDigit && this.hasDigit)
58
+ if (this.mergedOptions().requireDigit && this.hasDigit())
79
59
  strength += 1;
80
- if (this.control?.options?.requireNonAlphanumeric && this.hasNonAlphanumeric)
60
+ if (this.mergedOptions().requireNonAlphanumeric && this.hasNonAlphanumeric())
81
61
  strength += 1;
82
- if (this.control?.options?.requiredMinLength && this.hasMinLength)
62
+ if (this.mergedOptions().requiredMinLength && this.hasMinLength())
83
63
  strength += 1;
84
- return strength + (5 - this.requiredOptionsLength);
85
- }
86
- get strengthStyleClass() {
87
- return this.strengthMeter == 4 ? "green" :
88
- this.strengthMeter == 3 ? "yellow" :
89
- this.strengthMeter == 2 ? "orange" :
90
- this.strengthMeter == 1 ? "red" :
91
- this.strengthMeter == 0 ? "pink" :
92
- '';
64
+ return strength + (5 - this.requiredOptionsLength());
65
+ }, /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "strengthMeter" }] : /* istanbul ignore next */ []));
67
+ strengthStyleClass = computed(() => {
68
+ return this.strengthMeter() == 4
69
+ ? 'green'
70
+ : this.strengthMeter() == 3
71
+ ? 'yellow'
72
+ : this.strengthMeter() == 2
73
+ ? 'orange'
74
+ : this.strengthMeter() == 1
75
+ ? 'red'
76
+ : this.strengthMeter() == 0
77
+ ? 'pink'
78
+ : '';
79
+ }, /* @ts-ignore */
80
+ ...(ngDevMode ? [{ debugName: "strengthStyleClass" }] : /* istanbul ignore next */ []));
81
+ requiredOptionsLength = computed(() => Object.values(this.mergedOptions()).filter(Boolean).length, /* @ts-ignore */
82
+ ...(ngDevMode ? [{ debugName: "requiredOptionsLength" }] : /* istanbul ignore next */ []));
83
+ mergedOptions = computed(() => ({
84
+ ...DEFAULT_OPTIONS,
85
+ ...(this.control()?.options ?? {}),
86
+ }), /* @ts-ignore */
87
+ ...(ngDevMode ? [{ debugName: "mergedOptions" }] : /* istanbul ignore next */ []));
88
+ mergedFeedback = computed(() => ({
89
+ ...DEFAULT_FEEDBACK,
90
+ ...this.feedback(),
91
+ }), /* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "mergedFeedback" }] : /* istanbul ignore next */ []));
93
+ constructor() {
94
+ effect((onCleanup) => {
95
+ const control = this.control();
96
+ if (!control?.formControl)
97
+ return;
98
+ this.passwordValue.set(control.formControl.value ?? '');
99
+ const sub = control.formControl.valueChanges.subscribe((value) => {
100
+ this.passwordValue.set(value ?? '');
101
+ });
102
+ onCleanup(() => sub.unsubscribe());
103
+ // control.options ??= { ...DEFAULT_OPTIONS };
104
+ const strongPasswordRegex = new RegExp(`${this.mergedOptions().requireUppercase ? '^(?=[^A-Z]*[A-Z])' : ''}${this.mergedOptions().requireLowercase ? '(?=[^a-z]*[a-z])' : ''}${this.mergedOptions().requireDigit ? '(?=\\D*\\d)' : ''}${this.mergedOptions().requireNonAlphanumeric ? '(?=.*[!@#$%^&*])' : ''}.{${this.mergedOptions().requiredMinLength},}$`);
105
+ this.minLengthRegx = new RegExp(`.{${this.mergedOptions().requiredMinLength},}$`);
106
+ control.formControl?.setValidators([
107
+ Validators.required,
108
+ Validators.pattern(strongPasswordRegex),
109
+ ]);
110
+ control.formControl?.updateValueAndValidity();
111
+ });
93
112
  }
94
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: YsPasswordStrengthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
95
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.5", type: YsPasswordStrengthComponent, isStandalone: true, selector: "ys-password-strength", inputs: { passwordHelp: "passwordHelp", displayFeedback: "displayFeedback", feedback: "feedback", control: "control" }, ngImport: i0, template: "@if (control) {\r\n <div class=\"password-strength\">\r\n <div class=\"d-flex flex-row mt-1\">\r\n @if (this.requiredOptionsLength > 4) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\" (strengthMeter >= 0) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 3) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\"(strengthMeter >= 1) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 2) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\"(strengthMeter >= 2) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 1) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\"(strengthMeter >= 3) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 0) {\r\n <hr class=\"rounded-start rounded-end\"\r\n [ngClass]=\"(strengthMeter >= 4) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n </div>\r\n @if (passwordHelp) {\r\n <small id=\"passwordHelp\" class=\"form-text text-muted\">{{passwordHelp}}</small>\r\n }\r\n @if (displayFeedback && control.formControl?.errors?.['pattern'] && (control.formControl?.touched || control.formControl?.dirty)) {\r\n <div\r\n class=\"invalid-feedback d-grid \">\r\n @if (control.options?.requireUppercase) {\r\n <span\r\n [ngClass]=\"{'text-success': hasUppercase}\">{{feedback?.uppercase}}</span>\r\n }\r\n @if (control.options?.requireLowercase) {\r\n <span\r\n [ngClass]=\"{'text-success': hasLowercase}\">{{feedback?.lowercase}}</span>\r\n }\r\n @if (control.options?.requireDigit) {\r\n <span [ngClass]=\"{'text-success': hasDigit}\">{{feedback?.digit}}</span>\r\n }\r\n @if (control.options?.requireNonAlphanumeric) {\r\n <span\r\n [ngClass]=\"{'text-success': hasNonAlphanumeric}\">{{feedback?.nonAlphanumeric}}</span>\r\n }\r\n @if (control.options?.requiredMinLength) {\r\n <span\r\n [ngClass]=\"{'text-success': hasMinLength}\">{{feedback?.minLength}}</span>\r\n }\r\n </div>\r\n }\r\n @if (control.formControl?.errors?.['required'] && (control.formControl?.touched || control.formControl?.dirty)) {\r\n <div\r\n class=\"invalid-feedback d-grid \">\r\n {{feedback?.required}}\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (!control) {\r\n <div>\r\n Password strength control is undefined.\r\n </div>\r\n }", styles: [".is-invalid ys-password-strength~.invalid-feedback{display:block}.password-strength hr{border-top:3px solid;margin:0;opacity:.75!important}.password-strength .gray{color:var(--bs-gray-300)}.password-strength .pink{color:var(--bs-pink)}.password-strength .red{color:var(--bs-red)}.password-strength .orange{color:var(--bs-orange)}.password-strength .yellow{color:var(--bs-yellow)}.password-strength .green{color:var(--bs-green)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
113
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsPasswordStrength, deps: [], target: i0.ɵɵFactoryTarget.Component });
114
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: YsPasswordStrength, isStandalone: true, selector: "ys-password-strength", inputs: { passwordHelp: { classPropertyName: "passwordHelp", publicName: "passwordHelp", isSignal: true, isRequired: false, transformFunction: null }, displayFeedback: { classPropertyName: "displayFeedback", publicName: "displayFeedback", isSignal: true, isRequired: false, transformFunction: null }, feedback: { classPropertyName: "feedback", publicName: "feedback", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (control()) {\n<div class=\"password-strength\">\n <div class=\"d-flex flex-row mt-1\">\n\n @if (this.requiredOptionsLength() > 4) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\" (strengthMeter() >= 0) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 3) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\"(strengthMeter() >= 1) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 2) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\"(strengthMeter() >= 2) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 1) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\"(strengthMeter() >= 3) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 0) {\n <hr class=\"rounded-start rounded-end\" [ngClass]=\"(strengthMeter() >= 4) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n </div>\n\n @if (passwordHelp()) {\n\n <small id=\"passwordHelp\" class=\"form-text text-muted\">{{passwordHelp()}}</small>\n\n }\n\n @if (displayFeedback() && control()?.formControl?.errors?.['pattern'] && (control()?.formControl?.touched ||\n control()?.formControl?.dirty)) {\n\n <div class=\"invalid-feedback d-grid \">\n\n @if (mergedOptions().requireUppercase && mergedFeedback().uppercase) {\n <span [ngClass]=\"{'text-success': hasUppercase()}\">{{mergedFeedback().uppercase}}</span>\n }\n\n @if (mergedOptions().requireLowercase && mergedFeedback().lowercase) {\n <span [ngClass]=\"{'text-success': hasLowercase()}\">{{mergedFeedback().lowercase}}</span>\n }\n\n @if (mergedOptions().requireDigit && mergedFeedback().digit) {\n <span [ngClass]=\"{'text-success': hasDigit()}\">{{mergedFeedback().digit}}</span>\n }\n\n @if (mergedOptions().requireNonAlphanumeric && mergedFeedback().nonAlphanumeric) {\n <span [ngClass]=\"{'text-success': hasNonAlphanumeric()}\">{{mergedFeedback().nonAlphanumeric}}</span>\n }\n\n @if (mergedOptions().requiredMinLength && mergedFeedback().minLength) {\n <span [ngClass]=\"{'text-success': hasMinLength()}\">{{mergedFeedback().minLength}}</span>\n\n }\n\n </div>\n\n }\n\n @if (control()?.formControl?.errors?.['required'] && (control()?.formControl?.touched ||\n control()?.formControl?.dirty)) {\n\n <div class=\"invalid-feedback d-grid \">\n {{mergedFeedback().required}}\n </div>\n\n }\n\n</div>\n\n}\n\n@if (!control()) {\n\n<div>\n Password strength control is undefined.\n</div>\n\n}", styles: [".is-invalid ys-password-strength~.invalid-feedback{display:block}.password-strength hr{border-top:3px solid;margin:0;opacity:.75!important}.password-strength .gray{color:var(--bs-gray-300)}.password-strength .pink{color:var(--bs-pink)}.password-strength .red{color:var(--bs-red)}.password-strength .orange{color:var(--bs-orange)}.password-strength .yellow{color:var(--bs-yellow)}.password-strength .green{color:var(--bs-green)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
96
115
  }
97
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: YsPasswordStrengthComponent, decorators: [{
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsPasswordStrength, decorators: [{
98
117
  type: Component,
99
- args: [{ selector: 'ys-password-strength', imports: [NgClass], template: "@if (control) {\r\n <div class=\"password-strength\">\r\n <div class=\"d-flex flex-row mt-1\">\r\n @if (this.requiredOptionsLength > 4) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\" (strengthMeter >= 0) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 3) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\"(strengthMeter >= 1) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 2) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\"(strengthMeter >= 2) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 1) {\r\n <hr class=\"rounded-start rounded-end me-1\"\r\n [ngClass]=\"(strengthMeter >= 3) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n @if (this.requiredOptionsLength > 0) {\r\n <hr class=\"rounded-start rounded-end\"\r\n [ngClass]=\"(strengthMeter >= 4) ? strengthStyleClass : 'gray'\"\r\n [style.width.%]=\"[100 / requiredOptionsLength]\">\r\n }\r\n </div>\r\n @if (passwordHelp) {\r\n <small id=\"passwordHelp\" class=\"form-text text-muted\">{{passwordHelp}}</small>\r\n }\r\n @if (displayFeedback && control.formControl?.errors?.['pattern'] && (control.formControl?.touched || control.formControl?.dirty)) {\r\n <div\r\n class=\"invalid-feedback d-grid \">\r\n @if (control.options?.requireUppercase) {\r\n <span\r\n [ngClass]=\"{'text-success': hasUppercase}\">{{feedback?.uppercase}}</span>\r\n }\r\n @if (control.options?.requireLowercase) {\r\n <span\r\n [ngClass]=\"{'text-success': hasLowercase}\">{{feedback?.lowercase}}</span>\r\n }\r\n @if (control.options?.requireDigit) {\r\n <span [ngClass]=\"{'text-success': hasDigit}\">{{feedback?.digit}}</span>\r\n }\r\n @if (control.options?.requireNonAlphanumeric) {\r\n <span\r\n [ngClass]=\"{'text-success': hasNonAlphanumeric}\">{{feedback?.nonAlphanumeric}}</span>\r\n }\r\n @if (control.options?.requiredMinLength) {\r\n <span\r\n [ngClass]=\"{'text-success': hasMinLength}\">{{feedback?.minLength}}</span>\r\n }\r\n </div>\r\n }\r\n @if (control.formControl?.errors?.['required'] && (control.formControl?.touched || control.formControl?.dirty)) {\r\n <div\r\n class=\"invalid-feedback d-grid \">\r\n {{feedback?.required}}\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (!control) {\r\n <div>\r\n Password strength control is undefined.\r\n </div>\r\n }", styles: [".is-invalid ys-password-strength~.invalid-feedback{display:block}.password-strength hr{border-top:3px solid;margin:0;opacity:.75!important}.password-strength .gray{color:var(--bs-gray-300)}.password-strength .pink{color:var(--bs-pink)}.password-strength .red{color:var(--bs-red)}.password-strength .orange{color:var(--bs-orange)}.password-strength .yellow{color:var(--bs-yellow)}.password-strength .green{color:var(--bs-green)}\n"] }]
100
- }], propDecorators: { passwordHelp: [{
101
- type: Input
102
- }], displayFeedback: [{
103
- type: Input
104
- }], feedback: [{
105
- type: Input
106
- }], control: [{
107
- type: Input
108
- }] } });
118
+ args: [{ selector: 'ys-password-strength', imports: [NgClass], changeDetection: ChangeDetectionStrategy.Eager, template: "@if (control()) {\n<div class=\"password-strength\">\n <div class=\"d-flex flex-row mt-1\">\n\n @if (this.requiredOptionsLength() > 4) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\" (strengthMeter() >= 0) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 3) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\"(strengthMeter() >= 1) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 2) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\"(strengthMeter() >= 2) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 1) {\n <hr class=\"rounded-start rounded-end me-1\" [ngClass]=\"(strengthMeter() >= 3) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n @if (this.requiredOptionsLength() > 0) {\n <hr class=\"rounded-start rounded-end\" [ngClass]=\"(strengthMeter() >= 4) ? strengthStyleClass() : 'gray'\"\n [style.width.%]=\"[100 / requiredOptionsLength()]\">\n }\n\n </div>\n\n @if (passwordHelp()) {\n\n <small id=\"passwordHelp\" class=\"form-text text-muted\">{{passwordHelp()}}</small>\n\n }\n\n @if (displayFeedback() && control()?.formControl?.errors?.['pattern'] && (control()?.formControl?.touched ||\n control()?.formControl?.dirty)) {\n\n <div class=\"invalid-feedback d-grid \">\n\n @if (mergedOptions().requireUppercase && mergedFeedback().uppercase) {\n <span [ngClass]=\"{'text-success': hasUppercase()}\">{{mergedFeedback().uppercase}}</span>\n }\n\n @if (mergedOptions().requireLowercase && mergedFeedback().lowercase) {\n <span [ngClass]=\"{'text-success': hasLowercase()}\">{{mergedFeedback().lowercase}}</span>\n }\n\n @if (mergedOptions().requireDigit && mergedFeedback().digit) {\n <span [ngClass]=\"{'text-success': hasDigit()}\">{{mergedFeedback().digit}}</span>\n }\n\n @if (mergedOptions().requireNonAlphanumeric && mergedFeedback().nonAlphanumeric) {\n <span [ngClass]=\"{'text-success': hasNonAlphanumeric()}\">{{mergedFeedback().nonAlphanumeric}}</span>\n }\n\n @if (mergedOptions().requiredMinLength && mergedFeedback().minLength) {\n <span [ngClass]=\"{'text-success': hasMinLength()}\">{{mergedFeedback().minLength}}</span>\n\n }\n\n </div>\n\n }\n\n @if (control()?.formControl?.errors?.['required'] && (control()?.formControl?.touched ||\n control()?.formControl?.dirty)) {\n\n <div class=\"invalid-feedback d-grid \">\n {{mergedFeedback().required}}\n </div>\n\n }\n\n</div>\n\n}\n\n@if (!control()) {\n\n<div>\n Password strength control is undefined.\n</div>\n\n}", styles: [".is-invalid ys-password-strength~.invalid-feedback{display:block}.password-strength hr{border-top:3px solid;margin:0;opacity:.75!important}.password-strength .gray{color:var(--bs-gray-300)}.password-strength .pink{color:var(--bs-pink)}.password-strength .red{color:var(--bs-red)}.password-strength .orange{color:var(--bs-orange)}.password-strength .yellow{color:var(--bs-yellow)}.password-strength .green{color:var(--bs-green)}\n"] }]
119
+ }], ctorParameters: () => [], propDecorators: { passwordHelp: [{ type: i0.Input, args: [{ isSignal: true, alias: "passwordHelp", required: false }] }], displayFeedback: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayFeedback", required: false }] }], feedback: [{ type: i0.Input, args: [{ isSignal: true, alias: "feedback", required: false }] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }] } });
109
120
 
110
121
  class YsPasswordStrengthDirective {
111
- el;
112
- viewContainerRef;
113
- injector;
114
- control;
115
- passwordHelp = null;
116
- displayFeedback = true;
117
- feedback = new StrengthValidationFeedback();
118
- options;
119
- constructor(el, viewContainerRef, injector, control) {
120
- this.el = el;
121
- this.viewContainerRef = viewContainerRef;
122
- this.injector = injector;
123
- this.control = control;
124
- }
125
- ngOnInit() {
126
- const element = this.el.nativeElement;
127
- const elementParent = element.parentElement;
128
- const formControl = this.control.control;
129
- const passwordStrengthComponent = this.viewContainerRef.createComponent(YsPasswordStrengthComponent, { injector: this.injector });
130
- elementParent.insertBefore(passwordStrengthComponent.location.nativeElement, element.nextSibling);
131
- const passwordStrength = passwordStrengthComponent.instance;
132
- passwordStrength.passwordHelp = this.passwordHelp;
133
- passwordStrength.displayFeedback = this.displayFeedback;
134
- passwordStrength.feedback = this.feedback;
135
- passwordStrength.control = { formControl: formControl, options: this.options };
122
+ viewContainerRef = inject(ViewContainerRef);
123
+ injector = inject(Injector);
124
+ control = inject(NgControl, {
125
+ self: true
126
+ });
127
+ componentRef = this.viewContainerRef.createComponent(YsPasswordStrength, {
128
+ injector: this.injector
129
+ });
130
+ passwordHelp = input(null, /* @ts-ignore */
131
+ ...(ngDevMode ? [{ debugName: "passwordHelp" }] : /* istanbul ignore next */ []));
132
+ displayFeedback = input(true, /* @ts-ignore */
133
+ ...(ngDevMode ? [{ debugName: "displayFeedback" }] : /* istanbul ignore next */ []));
134
+ feedback = input({}, /* @ts-ignore */
135
+ ...(ngDevMode ? [{ debugName: "feedback" }] : /* istanbul ignore next */ []));
136
+ options = input({}, /* @ts-ignore */
137
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
138
+ mergedOptions = computed(() => ({
139
+ ...DEFAULT_OPTIONS,
140
+ ...this.options()
141
+ }), /* @ts-ignore */
142
+ ...(ngDevMode ? [{ debugName: "mergedOptions" }] : /* istanbul ignore next */ []));
143
+ mergedFeedback = computed(() => ({
144
+ ...DEFAULT_FEEDBACK,
145
+ ...this.feedback()
146
+ }), /* @ts-ignore */
147
+ ...(ngDevMode ? [{ debugName: "mergedFeedback" }] : /* istanbul ignore next */ []));
148
+ constructor() {
149
+ effect(() => {
150
+ const formControl = this.control.control;
151
+ this.componentRef.setInput('passwordHelp', this.passwordHelp());
152
+ this.componentRef.setInput('displayFeedback', this.displayFeedback());
153
+ this.componentRef.setInput('feedback', this.mergedFeedback());
154
+ this.componentRef.setInput('control', { formControl: formControl, options: this.mergedOptions() });
155
+ });
136
156
  }
137
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: YsPasswordStrengthDirective, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.Injector }, { token: i1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
138
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.5", type: YsPasswordStrengthDirective, isStandalone: true, selector: "[ysPasswordStrength]", inputs: { passwordHelp: "passwordHelp", displayFeedback: "displayFeedback", feedback: "feedback", options: "options" }, ngImport: i0 });
157
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsPasswordStrengthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
158
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.7", type: YsPasswordStrengthDirective, isStandalone: true, selector: "[ysPasswordStrength]", inputs: { passwordHelp: { classPropertyName: "passwordHelp", publicName: "passwordHelp", isSignal: true, isRequired: false, transformFunction: null }, displayFeedback: { classPropertyName: "displayFeedback", publicName: "displayFeedback", isSignal: true, isRequired: false, transformFunction: null }, feedback: { classPropertyName: "feedback", publicName: "feedback", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
139
159
  }
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: YsPasswordStrengthDirective, decorators: [{
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsPasswordStrengthDirective, decorators: [{
141
161
  type: Directive,
142
162
  args: [{
143
- selector: '[ysPasswordStrength]'
163
+ selector: '[ysPasswordStrength]',
144
164
  }]
145
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.Injector }, { type: i1.NgControl }], propDecorators: { passwordHelp: [{
146
- type: Input
147
- }], displayFeedback: [{
148
- type: Input
149
- }], feedback: [{
150
- type: Input
151
- }], options: [{
152
- type: Input
153
- }] } });
165
+ }], ctorParameters: () => [], propDecorators: { passwordHelp: [{ type: i0.Input, args: [{ isSignal: true, alias: "passwordHelp", required: false }] }], displayFeedback: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayFeedback", required: false }] }], feedback: [{ type: i0.Input, args: [{ isSignal: true, alias: "feedback", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
154
166
 
155
167
  /*
156
168
  * Public API Surface of ys-password-strength
@@ -160,5 +172,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImpor
160
172
  * Generated bundle index. Do not edit.
161
173
  */
162
174
 
163
- export { DigitRegx, LowercaseRegx, NonAlphanumericRegx, StrengthValidationFeedback, StrengthValidationOption, StrongPasswordRegx, UppercaseRegx, YsPasswordStrengthComponent, YsPasswordStrengthDirective };
175
+ export { DEFAULT_FEEDBACK, DEFAULT_OPTIONS, DIGIT_REGX, LOWERCASE_REGEX, NON_ALPHANUMERIC_REGX, STRONG_PASSWORD_REGX, UPPERCASE_REGEX, YsPasswordStrength, YsPasswordStrengthDirective };
164
176
  //# sourceMappingURL=yoozsoft-yoozsoft-ng-password-strength.mjs.map