@yoozsoft/yoozsoft-ng 5.3.4 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @yoozsoft/yoozsoft-ng might be problematic. Click here for more details.
- package/README.md +11 -4
- package/fesm2022/yoozsoft-yoozsoft-ng-autocomplete.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-autocomplete.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs +31 -31
- package/fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-directives.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-directives.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-dropdown.mjs +16 -9
- package/fesm2022/yoozsoft-yoozsoft-ng-dropdown.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-footer.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-footer.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-loading.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-loading.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs +4 -4
- package/fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-overlay.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-overlay.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-pagination.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-pagination.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs +6 -6
- package/fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-progress.mjs +6 -6
- package/fesm2022/yoozsoft-yoozsoft-ng-progress.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-select.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-select.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs +6 -6
- package/fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-toast.mjs +6 -6
- package/fesm2022/yoozsoft-yoozsoft-ng-toast.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng.mjs +2593 -2
- package/fesm2022/yoozsoft-yoozsoft-ng.mjs.map +1 -1
- package/package.json +30 -30
- package/types/yoozsoft-yoozsoft-ng.d.ts +925 -0
- package/index.d.ts +0 -3
- /package/{autocomplete/index.d.ts → types/yoozsoft-yoozsoft-ng-autocomplete.d.ts} +0 -0
- /package/{datepicker/index.d.ts → types/yoozsoft-yoozsoft-ng-datepicker.d.ts} +0 -0
- /package/{directives/index.d.ts → types/yoozsoft-yoozsoft-ng-directives.d.ts} +0 -0
- /package/{dropdown/index.d.ts → types/yoozsoft-yoozsoft-ng-dropdown.d.ts} +0 -0
- /package/{file-upload/index.d.ts → types/yoozsoft-yoozsoft-ng-file-upload.d.ts} +0 -0
- /package/{footer/index.d.ts → types/yoozsoft-yoozsoft-ng-footer.d.ts} +0 -0
- /package/{loading/index.d.ts → types/yoozsoft-yoozsoft-ng-loading.d.ts} +0 -0
- /package/{navbar/index.d.ts → types/yoozsoft-yoozsoft-ng-navbar.d.ts} +0 -0
- /package/{overlay/index.d.ts → types/yoozsoft-yoozsoft-ng-overlay.d.ts} +0 -0
- /package/{pagination/index.d.ts → types/yoozsoft-yoozsoft-ng-pagination.d.ts} +0 -0
- /package/{password-strength/index.d.ts → types/yoozsoft-yoozsoft-ng-password-strength.d.ts} +0 -0
- /package/{progress/index.d.ts → types/yoozsoft-yoozsoft-ng-progress.d.ts} +0 -0
- /package/{select/index.d.ts → types/yoozsoft-yoozsoft-ng-select.d.ts} +0 -0
- /package/{sidebar/index.d.ts → types/yoozsoft-yoozsoft-ng-sidebar.d.ts} +0 -0
- /package/{tiff-viewer/index.d.ts → types/yoozsoft-yoozsoft-ng-tiff-viewer.d.ts} +0 -0
- /package/{toast/index.d.ts → types/yoozsoft-yoozsoft-ng-toast.d.ts} +0 -0
|
@@ -1,11 +1,2602 @@
|
|
|
1
|
+
import * as i2 from '@angular/cdk/scrolling';
|
|
2
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
3
|
+
import { NgTemplateOutlet, NgClass, AsyncPipe } from '@angular/common';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { EventEmitter, TemplateRef, forwardRef, HostListener, ViewChild, Output, Input, ContentChild, Component, Injectable, inject, Directive, ElementRef } from '@angular/core';
|
|
6
|
+
import * as i1 from '@angular/forms';
|
|
7
|
+
import { FormsModule, NG_VALUE_ACCESSOR, NG_ASYNC_VALIDATORS, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
8
|
+
import { Subject, debounceTime, distinctUntilChanged, switchMap, catchError, of, BehaviorSubject } from 'rxjs';
|
|
9
|
+
import * as i2$1 from '@ng-bootstrap/ng-bootstrap';
|
|
10
|
+
import { NgbDateParserFormatter, NgbDatepickerI18n, NgbCalendar, NgbDatepickerModule, NgbCalendarPersian, NgbDate, NgbTooltip, NgbTooltipModule, NgbPagination, NgbToastModule } from '@ng-bootstrap/ng-bootstrap';
|
|
11
|
+
import * as i1$1 from '@angular/router';
|
|
12
|
+
import { RouterLink, RouterLinkActive, NavigationEnd } from '@angular/router';
|
|
13
|
+
|
|
14
|
+
class YsAutocompleteComponent {
|
|
15
|
+
elRef;
|
|
16
|
+
searchTerm = '';
|
|
17
|
+
filteredOptions = [];
|
|
18
|
+
selectedOptions = [];
|
|
19
|
+
showDropdown = false;
|
|
20
|
+
activeIndex = -1;
|
|
21
|
+
error = null;
|
|
22
|
+
/** Array or async function */
|
|
23
|
+
options;
|
|
24
|
+
/** Label display field */
|
|
25
|
+
optionLabel = 'label';
|
|
26
|
+
/** placeholder */
|
|
27
|
+
placeholder = '';
|
|
28
|
+
/** Multiple choice mode */
|
|
29
|
+
multiple = false;
|
|
30
|
+
/** Button to clear selection */
|
|
31
|
+
showClear = false;
|
|
32
|
+
disabled = false;
|
|
33
|
+
/** Custom template */
|
|
34
|
+
itemTemplate;
|
|
35
|
+
styleClass;
|
|
36
|
+
/** Badge style class on Multiple choice mode */
|
|
37
|
+
badgeStyleClass = 'text-bg-light';
|
|
38
|
+
loading = false;
|
|
39
|
+
loadingMessage = 'Loading...';
|
|
40
|
+
/** No results found message */
|
|
41
|
+
noResultMessage = 'No results found.';
|
|
42
|
+
/** Infinite scroll feature enabled */
|
|
43
|
+
infiniteScroll = false;
|
|
44
|
+
virtualScroll = true;
|
|
45
|
+
virtualScrollItemSize = 36;
|
|
46
|
+
// [virtualScrollOptions]="options"
|
|
47
|
+
/** Event to request more items */
|
|
48
|
+
loadMore = new EventEmitter();
|
|
49
|
+
/** Output selection */
|
|
50
|
+
selected = new EventEmitter();
|
|
51
|
+
/** Output selection after removed item */
|
|
52
|
+
removed = new EventEmitter();
|
|
53
|
+
search$ = new Subject();
|
|
54
|
+
_onChange = () => { };
|
|
55
|
+
_onTouched = () => { };
|
|
56
|
+
inputRef;
|
|
57
|
+
get isArrayItems() { return Array.isArray(this.options); }
|
|
58
|
+
get isFunctionItems() { return typeof this.options === 'function'; }
|
|
59
|
+
constructor(elRef) {
|
|
60
|
+
this.elRef = elRef;
|
|
61
|
+
}
|
|
62
|
+
ngOnInit() {
|
|
63
|
+
if (Array.isArray(this.options)) {
|
|
64
|
+
this.filteredOptions = this.options;
|
|
65
|
+
}
|
|
66
|
+
/** Only in async function mode */
|
|
67
|
+
if (typeof this.options === 'function') {
|
|
68
|
+
const fetchFn = this.options;
|
|
69
|
+
this.search$
|
|
70
|
+
.pipe(debounceTime(300), distinctUntilChanged(), switchMap((term) => {
|
|
71
|
+
this.loading = true;
|
|
72
|
+
this.error = null;
|
|
73
|
+
return fetchFn(term).pipe(catchError((err) => {
|
|
74
|
+
this.error = 'Error receiving data!';
|
|
75
|
+
console.error(err);
|
|
76
|
+
return of([]);
|
|
77
|
+
}));
|
|
78
|
+
}))
|
|
79
|
+
.subscribe((results) => {
|
|
80
|
+
this.filteredOptions = results;
|
|
81
|
+
this.loading = false;
|
|
82
|
+
this.showDropdown = true;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** For the initial value of FormControl */
|
|
87
|
+
writeValue(value) {
|
|
88
|
+
if (this.multiple) {
|
|
89
|
+
this.selectedOptions = value ? [...value] : [];
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.searchTerm = value ? this.getLabel(value) : '';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
registerOnChange(fn) {
|
|
96
|
+
this._onChange = fn;
|
|
97
|
+
}
|
|
98
|
+
registerOnTouched(fn) {
|
|
99
|
+
this._onTouched = fn;
|
|
100
|
+
}
|
|
101
|
+
setDisabledState(isDisabled) {
|
|
102
|
+
this.disabled = isDisabled;
|
|
103
|
+
if (this.inputRef) {
|
|
104
|
+
this.inputRef.nativeElement.disabled = isDisabled;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
onSearchChange() {
|
|
108
|
+
const term = this.searchTerm.trim();
|
|
109
|
+
if (Array.isArray(this.options)) {
|
|
110
|
+
const lower = term.toLowerCase();
|
|
111
|
+
this.filteredOptions = this.options.filter((item) => this.getLabel(item).toLowerCase().includes(lower));
|
|
112
|
+
this.showDropdown = this.filteredOptions.length >= 0;
|
|
113
|
+
}
|
|
114
|
+
else if (typeof this.options === 'function') {
|
|
115
|
+
this.search$.next(term);
|
|
116
|
+
}
|
|
117
|
+
if (!this.multiple && !term) {
|
|
118
|
+
this.clearSelection();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
getLabel(item) {
|
|
122
|
+
if (!item)
|
|
123
|
+
return '';
|
|
124
|
+
if (typeof item === 'string')
|
|
125
|
+
return item;
|
|
126
|
+
if (item && this.optionLabel && item[this.optionLabel]) {
|
|
127
|
+
return item[this.optionLabel];
|
|
128
|
+
}
|
|
129
|
+
return '';
|
|
130
|
+
}
|
|
131
|
+
onSelect(item) {
|
|
132
|
+
if (this.multiple) {
|
|
133
|
+
const exists = this.selectedOptions.some((x) => this.getLabel(x) === this.getLabel(item));
|
|
134
|
+
if (!exists) {
|
|
135
|
+
this.selectedOptions.push(item);
|
|
136
|
+
this._onChange(this.selectedOptions);
|
|
137
|
+
this._onTouched();
|
|
138
|
+
this.selected.emit(this.selectedOptions);
|
|
139
|
+
}
|
|
140
|
+
this.searchTerm = '';
|
|
141
|
+
this.showDropdown = true;
|
|
142
|
+
this.onSearchChange();
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.searchTerm = this.getLabel(item);
|
|
146
|
+
this._onChange(item);
|
|
147
|
+
this._onTouched();
|
|
148
|
+
this.selected.emit(item);
|
|
149
|
+
this.showDropdown = false;
|
|
150
|
+
}
|
|
151
|
+
this.activeIndex = -1;
|
|
152
|
+
}
|
|
153
|
+
removeItem(item) {
|
|
154
|
+
this.selectedOptions = this.selectedOptions.filter((x) => this.getLabel(x) !== this.getLabel(item));
|
|
155
|
+
this._onChange(this.selectedOptions);
|
|
156
|
+
this.removed.emit(this.selectedOptions);
|
|
157
|
+
}
|
|
158
|
+
onScroll(event) {
|
|
159
|
+
if (!this.infiniteScroll || this.loading)
|
|
160
|
+
return;
|
|
161
|
+
const target = event.target;
|
|
162
|
+
const nearBottom = target.scrollHeight - target.scrollTop <= target.clientHeight + 10;
|
|
163
|
+
if (nearBottom) {
|
|
164
|
+
// Request more items
|
|
165
|
+
this.loadMore.emit(this.searchTerm);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
clearSelection() {
|
|
169
|
+
if (this.multiple) {
|
|
170
|
+
this.selectedOptions = [];
|
|
171
|
+
this._onChange(this.selectedOptions);
|
|
172
|
+
this.removed.emit(this.selectedOptions);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
this.searchTerm = '';
|
|
176
|
+
this._onChange(null);
|
|
177
|
+
this.selected.emit(null);
|
|
178
|
+
}
|
|
179
|
+
this.showDropdown = false;
|
|
180
|
+
}
|
|
181
|
+
/** Keyboard control */
|
|
182
|
+
handleKeyboard(event) {
|
|
183
|
+
if (!this.showDropdown || this.filteredOptions.length === 0)
|
|
184
|
+
return;
|
|
185
|
+
switch (event.key) {
|
|
186
|
+
case 'ArrowDown':
|
|
187
|
+
this.activeIndex = (this.activeIndex + 1) % this.filteredOptions.length;
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
break;
|
|
190
|
+
case 'ArrowUp':
|
|
191
|
+
this.activeIndex =
|
|
192
|
+
(this.activeIndex - 1 + this.filteredOptions.length) %
|
|
193
|
+
this.filteredOptions.length;
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
break;
|
|
196
|
+
case 'Enter':
|
|
197
|
+
if (this.activeIndex >= 0) {
|
|
198
|
+
this.onSelect(this.filteredOptions[this.activeIndex]);
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
case 'Escape':
|
|
203
|
+
this.showDropdown = false;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** Close by clicking outside */
|
|
208
|
+
onClickOutside(event) {
|
|
209
|
+
const clickedInside = this.elRef.nativeElement.contains(event.target);
|
|
210
|
+
if (!clickedInside) {
|
|
211
|
+
this.showDropdown = false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsAutocompleteComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
215
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsAutocompleteComponent, isStandalone: true, selector: "ys-autocomplete", inputs: { options: "options", optionLabel: "optionLabel", placeholder: "placeholder", multiple: "multiple", showClear: "showClear", disabled: "disabled", styleClass: "styleClass", badgeStyleClass: "badgeStyleClass", loading: "loading", loadingMessage: "loadingMessage", noResultMessage: "noResultMessage", infiniteScroll: "infiniteScroll", virtualScroll: "virtualScroll", virtualScrollItemSize: "virtualScrollItemSize" }, outputs: { loadMore: "loadMore", selected: "selected", removed: "removed" }, host: { listeners: { "keydown": "handleKeyboard($event)", "document:click": "onClickOutside($event)" } }, providers: [
|
|
216
|
+
{
|
|
217
|
+
provide: NG_VALUE_ACCESSOR,
|
|
218
|
+
useExisting: forwardRef(() => YsAutocompleteComponent),
|
|
219
|
+
multi: true,
|
|
220
|
+
},
|
|
221
|
+
], queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputRef"], descendants: true }], ngImport: i0, template: "<div class=\"ys-autocomplete position-relative\">\r\n <div class=\"input-group flex-wrap\">\r\n @if (multiple && selectedOptions.length > 0) {\r\n <div class=\"d-flex flex-wrap\">\r\n @for (item of selectedOptions; track item) {\r\n <span class=\"badge me-1 mb-1 p-2 d-flex align-items-center\" [ngClass]=\"badgeStyleClass\">\r\n {{ getLabel(item) }}\r\n <i class=\"fa fa-times ms-2 cursor-pointer\" (click)=\"removeItem(item)\"></i>\r\n </span>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"input-group w-100\">\r\n <input #inputRef type=\"text\" class=\"form-control\" [placeholder]=\"placeholder\" [(ngModel)]=\"searchTerm\"\r\n (input)=\"onSearchChange()\" (focus)=\"showDropdown = true\" [ngClass]=\"styleClass\" />\r\n\r\n @if (showClear) {\r\n @if ((multiple && selectedOptions.length > 0) || (!multiple && searchTerm)) {\r\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearSelection()\"\r\n [disabled]=\"disabled\">\r\n <span class=\"fa fa-times\"></span>\r\n </button>\r\n }\r\n }\r\n <span class=\"input-group-text\" (click)=\"showDropdown = !showDropdown\">\r\n <i class=\"fa fa-search\"></i>\r\n </span>\r\n </div>\r\n </div>\r\n\r\n @if (showDropdown) {\r\n <div class=\"dropdown-container position-absolute w-100 shadow-sm bg-white border rounded\">\r\n @if (loading) {\r\n <div class=\"list-group-item text-center\">\r\n <i class=\"fa fa-spinner fa-spin me-2\"></i>{{ loadingMessage }}\r\n </div>\r\n }\r\n @else if (error) {\r\n <div class=\"list-group-item text-danger text-center\">{{ error }}</div>\r\n }\r\n @else if (filteredOptions.length === 0) {\r\n <div class=\"list-group-item text-muted text-center\">\r\n {{ noResultMessage }}\r\n </div>\r\n }\r\n <!-- \u2705 \u062D\u0627\u0644\u062A Virtual Scroll \u0628\u0631\u0627\u06CC \u0644\u06CC\u0633\u062A\u200C\u0647\u0627\u06CC \u0628\u0632\u0631\u06AF -->\r\n @else if (virtualScroll && filteredOptions.length > 100) {\r\n <cdk-virtual-scroll-viewport [itemSize]=\"virtualScrollItemSize\" class=\"list-group w-100 overflow-y-auto\">\r\n <ul class=\"list-group w-100\">\r\n @for (item of filteredOptions; track item; let i = $index) {\r\n <li class=\"list-group-item list-group-item-action\" [class.active]=\"i === activeIndex\"\r\n (click)=\"onSelect(item)\">\r\n @if (itemTemplate) {\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\r\n } @else {\r\n {{ getLabel(item) }}\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </cdk-virtual-scroll-viewport>\r\n }\r\n <!-- \u2705 \u062D\u0627\u0644\u062A \u0645\u0639\u0645\u0648\u0644\u06CC \u0628\u0631\u0627\u06CC \u0644\u06CC\u0633\u062A\u200C\u0647\u0627\u06CC \u06A9\u0648\u0686\u06A9 -->\r\n @else {\r\n <ul class=\"list-group w-100 overflow-y-auto\" [class.scrollable]=\"infiniteScroll\" (scroll)=\"onScroll($event)\">\r\n @for (item of filteredOptions; track item; let i = $index) {\r\n <li class=\"list-group-item list-group-item-action\" [class.active]=\"i === activeIndex\"\r\n (click)=\"onSelect(item)\">\r\n @if (itemTemplate) {\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\r\n } @else {\r\n {{ getLabel(item) }}\r\n }\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n }\r\n\r\n</div>", styles: [".ys-autocomplete .dropdown-container,.ys-autocomplete .list-group{z-index:1000;max-height:200px}.ys-autocomplete cdk-virtual-scroll-viewport{height:200px;display:block}.ys-autocomplete .btn-clear:hover{background-color:var(--bs-btn-hover-bg)}.ys-autocomplete .badge{font-size:.9rem;cursor:default;font-weight:var(--bs-body-font-weight)}.ys-autocomplete .badge i{cursor:pointer;font-size:.8rem}.ys-autocomplete .badge:hover{font-weight:var(--bs-badge-font-weight)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i2.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "component", type: i2.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }] });
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsAutocompleteComponent, decorators: [{
|
|
224
|
+
type: Component,
|
|
225
|
+
args: [{ selector: 'ys-autocomplete', imports: [FormsModule, NgTemplateOutlet, NgClass, ScrollingModule], providers: [
|
|
226
|
+
{
|
|
227
|
+
provide: NG_VALUE_ACCESSOR,
|
|
228
|
+
useExisting: forwardRef(() => YsAutocompleteComponent),
|
|
229
|
+
multi: true,
|
|
230
|
+
},
|
|
231
|
+
], template: "<div class=\"ys-autocomplete position-relative\">\r\n <div class=\"input-group flex-wrap\">\r\n @if (multiple && selectedOptions.length > 0) {\r\n <div class=\"d-flex flex-wrap\">\r\n @for (item of selectedOptions; track item) {\r\n <span class=\"badge me-1 mb-1 p-2 d-flex align-items-center\" [ngClass]=\"badgeStyleClass\">\r\n {{ getLabel(item) }}\r\n <i class=\"fa fa-times ms-2 cursor-pointer\" (click)=\"removeItem(item)\"></i>\r\n </span>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"input-group w-100\">\r\n <input #inputRef type=\"text\" class=\"form-control\" [placeholder]=\"placeholder\" [(ngModel)]=\"searchTerm\"\r\n (input)=\"onSearchChange()\" (focus)=\"showDropdown = true\" [ngClass]=\"styleClass\" />\r\n\r\n @if (showClear) {\r\n @if ((multiple && selectedOptions.length > 0) || (!multiple && searchTerm)) {\r\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearSelection()\"\r\n [disabled]=\"disabled\">\r\n <span class=\"fa fa-times\"></span>\r\n </button>\r\n }\r\n }\r\n <span class=\"input-group-text\" (click)=\"showDropdown = !showDropdown\">\r\n <i class=\"fa fa-search\"></i>\r\n </span>\r\n </div>\r\n </div>\r\n\r\n @if (showDropdown) {\r\n <div class=\"dropdown-container position-absolute w-100 shadow-sm bg-white border rounded\">\r\n @if (loading) {\r\n <div class=\"list-group-item text-center\">\r\n <i class=\"fa fa-spinner fa-spin me-2\"></i>{{ loadingMessage }}\r\n </div>\r\n }\r\n @else if (error) {\r\n <div class=\"list-group-item text-danger text-center\">{{ error }}</div>\r\n }\r\n @else if (filteredOptions.length === 0) {\r\n <div class=\"list-group-item text-muted text-center\">\r\n {{ noResultMessage }}\r\n </div>\r\n }\r\n <!-- \u2705 \u062D\u0627\u0644\u062A Virtual Scroll \u0628\u0631\u0627\u06CC \u0644\u06CC\u0633\u062A\u200C\u0647\u0627\u06CC \u0628\u0632\u0631\u06AF -->\r\n @else if (virtualScroll && filteredOptions.length > 100) {\r\n <cdk-virtual-scroll-viewport [itemSize]=\"virtualScrollItemSize\" class=\"list-group w-100 overflow-y-auto\">\r\n <ul class=\"list-group w-100\">\r\n @for (item of filteredOptions; track item; let i = $index) {\r\n <li class=\"list-group-item list-group-item-action\" [class.active]=\"i === activeIndex\"\r\n (click)=\"onSelect(item)\">\r\n @if (itemTemplate) {\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\r\n } @else {\r\n {{ getLabel(item) }}\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </cdk-virtual-scroll-viewport>\r\n }\r\n <!-- \u2705 \u062D\u0627\u0644\u062A \u0645\u0639\u0645\u0648\u0644\u06CC \u0628\u0631\u0627\u06CC \u0644\u06CC\u0633\u062A\u200C\u0647\u0627\u06CC \u06A9\u0648\u0686\u06A9 -->\r\n @else {\r\n <ul class=\"list-group w-100 overflow-y-auto\" [class.scrollable]=\"infiniteScroll\" (scroll)=\"onScroll($event)\">\r\n @for (item of filteredOptions; track item; let i = $index) {\r\n <li class=\"list-group-item list-group-item-action\" [class.active]=\"i === activeIndex\"\r\n (click)=\"onSelect(item)\">\r\n @if (itemTemplate) {\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\r\n } @else {\r\n {{ getLabel(item) }}\r\n }\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n }\r\n\r\n</div>", styles: [".ys-autocomplete .dropdown-container,.ys-autocomplete .list-group{z-index:1000;max-height:200px}.ys-autocomplete cdk-virtual-scroll-viewport{height:200px;display:block}.ys-autocomplete .btn-clear:hover{background-color:var(--bs-btn-hover-bg)}.ys-autocomplete .badge{font-size:.9rem;cursor:default;font-weight:var(--bs-body-font-weight)}.ys-autocomplete .badge i{cursor:pointer;font-size:.8rem}.ys-autocomplete .badge:hover{font-weight:var(--bs-badge-font-weight)}\n"] }]
|
|
232
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { options: [{
|
|
233
|
+
type: Input
|
|
234
|
+
}], optionLabel: [{
|
|
235
|
+
type: Input
|
|
236
|
+
}], placeholder: [{
|
|
237
|
+
type: Input
|
|
238
|
+
}], multiple: [{
|
|
239
|
+
type: Input
|
|
240
|
+
}], showClear: [{
|
|
241
|
+
type: Input
|
|
242
|
+
}], disabled: [{
|
|
243
|
+
type: Input
|
|
244
|
+
}], itemTemplate: [{
|
|
245
|
+
type: ContentChild,
|
|
246
|
+
args: [TemplateRef]
|
|
247
|
+
}], styleClass: [{
|
|
248
|
+
type: Input
|
|
249
|
+
}], badgeStyleClass: [{
|
|
250
|
+
type: Input
|
|
251
|
+
}], loading: [{
|
|
252
|
+
type: Input
|
|
253
|
+
}], loadingMessage: [{
|
|
254
|
+
type: Input
|
|
255
|
+
}], noResultMessage: [{
|
|
256
|
+
type: Input
|
|
257
|
+
}], infiniteScroll: [{
|
|
258
|
+
type: Input
|
|
259
|
+
}], virtualScroll: [{
|
|
260
|
+
type: Input
|
|
261
|
+
}], virtualScrollItemSize: [{
|
|
262
|
+
type: Input
|
|
263
|
+
}], loadMore: [{
|
|
264
|
+
type: Output
|
|
265
|
+
}], selected: [{
|
|
266
|
+
type: Output
|
|
267
|
+
}], removed: [{
|
|
268
|
+
type: Output
|
|
269
|
+
}], inputRef: [{
|
|
270
|
+
type: ViewChild,
|
|
271
|
+
args: ['inputRef']
|
|
272
|
+
}], handleKeyboard: [{
|
|
273
|
+
type: HostListener,
|
|
274
|
+
args: ['keydown', ['$event']]
|
|
275
|
+
}], onClickOutside: [{
|
|
276
|
+
type: HostListener,
|
|
277
|
+
args: ['document:click', ['$event']]
|
|
278
|
+
}] } });
|
|
279
|
+
|
|
280
|
+
/*
|
|
281
|
+
* Public API Surface of ys-autocomplete
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
class DateTimeFormat {
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
class JalaliDate {
|
|
288
|
+
static daysInMonth = {
|
|
289
|
+
g_days_in_month: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
290
|
+
j_days_in_month: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29]
|
|
291
|
+
};
|
|
292
|
+
static jalaliToGregorian(jalaliYear, jalaliMonth, jalaliDay) {
|
|
293
|
+
jalaliYear = parseInt(`${jalaliYear}`);
|
|
294
|
+
jalaliMonth = parseInt(`${jalaliMonth}`);
|
|
295
|
+
jalaliDay = parseInt(`${jalaliDay}`);
|
|
296
|
+
var jy = jalaliYear - 979;
|
|
297
|
+
var jm = jalaliMonth - 1;
|
|
298
|
+
var jd = jalaliDay - 1;
|
|
299
|
+
var j_day_no = 365 * jy + parseInt(`${jy / 33}`) * 8 + parseInt(`${(jy % 33 + 3) / 4}`);
|
|
300
|
+
for (var i = 0; i < jm; ++i)
|
|
301
|
+
j_day_no += this.daysInMonth.j_days_in_month[i];
|
|
302
|
+
j_day_no += jd;
|
|
303
|
+
var g_day_no = j_day_no + 79;
|
|
304
|
+
var gy = 1600 + 400 * parseInt(`${g_day_no / 146097}`);
|
|
305
|
+
g_day_no = g_day_no % 146097;
|
|
306
|
+
var leap = true;
|
|
307
|
+
if (g_day_no >= 36525) {
|
|
308
|
+
g_day_no--;
|
|
309
|
+
gy += 100 * parseInt(`${g_day_no / 36524}`);
|
|
310
|
+
g_day_no = g_day_no % 36524;
|
|
311
|
+
if (g_day_no >= 365)
|
|
312
|
+
g_day_no++;
|
|
313
|
+
else
|
|
314
|
+
leap = false;
|
|
315
|
+
}
|
|
316
|
+
gy += 4 * parseInt(`${g_day_no / 1461}`);
|
|
317
|
+
g_day_no %= 1461;
|
|
318
|
+
if (g_day_no >= 366) {
|
|
319
|
+
leap = false;
|
|
320
|
+
g_day_no--;
|
|
321
|
+
gy += parseInt(`${g_day_no / 365}`);
|
|
322
|
+
g_day_no = g_day_no % 365;
|
|
323
|
+
}
|
|
324
|
+
for (var i = 0; g_day_no >= this.daysInMonth.g_days_in_month[i] + ((i == 1 && leap) ? 1 : 0); i++)
|
|
325
|
+
g_day_no -= this.daysInMonth.g_days_in_month[i] + ((i == 1 && leap) ? 1 : 0);
|
|
326
|
+
var gm = i + 1;
|
|
327
|
+
var gd = g_day_no + 1;
|
|
328
|
+
return [gy, gm, gd];
|
|
329
|
+
}
|
|
330
|
+
static gregorianToJalali(gregorianYear, gregorianMonth, gregorianDay) {
|
|
331
|
+
gregorianYear = parseInt(`${gregorianYear}`);
|
|
332
|
+
gregorianMonth = parseInt(`${gregorianMonth}`);
|
|
333
|
+
gregorianDay = parseInt(`${gregorianDay}`);
|
|
334
|
+
var gy = gregorianYear - 1600;
|
|
335
|
+
var gm = gregorianMonth - 1;
|
|
336
|
+
var gd = gregorianDay - 1;
|
|
337
|
+
var g_day_no = 365 * gy + parseInt(`${(gy + 3) / 4}`) - parseInt(`${(gy + 99) / 100}`) + parseInt(`${(gy + 399) / 400}`);
|
|
338
|
+
for (var i = 0; i < gm; ++i)
|
|
339
|
+
g_day_no += this.daysInMonth.g_days_in_month[i];
|
|
340
|
+
if (gm > 1 && ((gy % 4 == 0 && gy % 100 != 0) || (gy % 400 == 0)))
|
|
341
|
+
++g_day_no;
|
|
342
|
+
g_day_no += gd;
|
|
343
|
+
var j_day_no = g_day_no - 79;
|
|
344
|
+
var j_np = parseInt(`${j_day_no / 12053}`);
|
|
345
|
+
j_day_no %= 12053;
|
|
346
|
+
var jy = 979 + 33 * j_np + 4 * parseInt(`${j_day_no / 1461}`);
|
|
347
|
+
j_day_no %= 1461;
|
|
348
|
+
if (j_day_no >= 366) {
|
|
349
|
+
jy += parseInt(`${(j_day_no - 1) / 365}`);
|
|
350
|
+
j_day_no = (j_day_no - 1) % 365;
|
|
351
|
+
}
|
|
352
|
+
for (var i = 0; i < 11 && j_day_no >= this.daysInMonth.j_days_in_month[i]; ++i) {
|
|
353
|
+
j_day_no -= this.daysInMonth.j_days_in_month[i];
|
|
354
|
+
}
|
|
355
|
+
var jm = i + 1;
|
|
356
|
+
var jd = j_day_no + 1;
|
|
357
|
+
return [jy, jm, jd];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
class YsDateParserFormatterService extends NgbDateParserFormatter {
|
|
362
|
+
DELIMITER = '/';
|
|
363
|
+
parse(value) {
|
|
364
|
+
if (value) {
|
|
365
|
+
const date = value.split(this.DELIMITER);
|
|
366
|
+
return {
|
|
367
|
+
day: parseInt(date[0], 10),
|
|
368
|
+
month: parseInt(date[1], 10),
|
|
369
|
+
year: parseInt(date[2], 10),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
format(date) {
|
|
375
|
+
return date ? date.year + this.DELIMITER + date.month + this.DELIMITER + date.day : '';
|
|
376
|
+
}
|
|
377
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDateParserFormatterService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
378
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDateParserFormatterService, providedIn: 'root' });
|
|
379
|
+
}
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDateParserFormatterService, decorators: [{
|
|
381
|
+
type: Injectable,
|
|
382
|
+
args: [{
|
|
383
|
+
providedIn: 'root'
|
|
384
|
+
}]
|
|
385
|
+
}] });
|
|
386
|
+
|
|
387
|
+
var LanguageType;
|
|
388
|
+
(function (LanguageType) {
|
|
389
|
+
LanguageType[LanguageType["en"] = 0] = "en";
|
|
390
|
+
LanguageType[LanguageType["fa"] = 1] = "fa";
|
|
391
|
+
LanguageType[LanguageType["fr"] = 2] = "fr";
|
|
392
|
+
})(LanguageType || (LanguageType = {}));
|
|
393
|
+
const I18N_VALUES = {
|
|
394
|
+
"en": {
|
|
395
|
+
weekdays: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
|
396
|
+
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
397
|
+
weekLabel: 'week'
|
|
398
|
+
},
|
|
399
|
+
"fa": {
|
|
400
|
+
weekdays: ['د', 'س', 'چ', 'پ', 'ج', 'ش', 'ی'],
|
|
401
|
+
months: ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'],
|
|
402
|
+
weekLabel: 'هفته'
|
|
403
|
+
},
|
|
404
|
+
"fr": {
|
|
405
|
+
weekdays: ['Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa', 'Di'],
|
|
406
|
+
months: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Aou', 'Sep', 'Oct', 'Nov', 'Déc'],
|
|
407
|
+
weekLabel: 'sem'
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
class I18n {
|
|
411
|
+
language = LanguageType[LanguageType.en];
|
|
412
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: I18n, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
413
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: I18n });
|
|
414
|
+
}
|
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: I18n, decorators: [{
|
|
416
|
+
type: Injectable
|
|
417
|
+
}] });
|
|
418
|
+
class YsDatepickerI18nService extends NgbDatepickerI18n {
|
|
419
|
+
_i18n = inject(I18n);
|
|
420
|
+
constructor() {
|
|
421
|
+
super();
|
|
422
|
+
}
|
|
423
|
+
getWeekdayLabel(weekday) {
|
|
424
|
+
return I18N_VALUES[this._i18n.language].weekdays[weekday - 1];
|
|
425
|
+
}
|
|
426
|
+
getWeekLabel() {
|
|
427
|
+
return I18N_VALUES[this._i18n.language].weekLabel;
|
|
428
|
+
}
|
|
429
|
+
getMonthShortName(month) {
|
|
430
|
+
return I18N_VALUES[this._i18n.language].months[month - 1];
|
|
431
|
+
}
|
|
432
|
+
getMonthFullName(month) {
|
|
433
|
+
return this.getMonthShortName(month);
|
|
434
|
+
}
|
|
435
|
+
getDayAriaLabel(date) {
|
|
436
|
+
return `${date.day}-${date.month}-${date.year}`;
|
|
437
|
+
}
|
|
438
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerI18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
439
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerI18nService, providedIn: 'root' });
|
|
440
|
+
}
|
|
441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerI18nService, decorators: [{
|
|
442
|
+
type: Injectable,
|
|
443
|
+
args: [{
|
|
444
|
+
providedIn: 'root'
|
|
445
|
+
}]
|
|
446
|
+
}], ctorParameters: () => [] });
|
|
447
|
+
|
|
448
|
+
class YsDatepickerComponent {
|
|
449
|
+
i18N;
|
|
450
|
+
calendar = inject(NgbCalendar);
|
|
451
|
+
today = inject(NgbCalendar).getToday();
|
|
452
|
+
firstDayOfWeek = 1;
|
|
453
|
+
weekend = [6, 7];
|
|
454
|
+
_language = LanguageType[LanguageType.en];
|
|
455
|
+
get language() {
|
|
456
|
+
return this._language;
|
|
457
|
+
}
|
|
458
|
+
set language(value) {
|
|
459
|
+
this._language = value;
|
|
460
|
+
this.i18N.language = this._language;
|
|
461
|
+
}
|
|
462
|
+
isFooter = true;
|
|
463
|
+
todayLabel = "Today";
|
|
464
|
+
footer = null;
|
|
465
|
+
_value = null;
|
|
466
|
+
get value() {
|
|
467
|
+
return this._value;
|
|
468
|
+
}
|
|
469
|
+
set value(val) {
|
|
470
|
+
this._value = val;
|
|
471
|
+
}
|
|
472
|
+
disabled = false;
|
|
473
|
+
onChange = () => { };
|
|
474
|
+
onTouched = () => { };
|
|
475
|
+
constructor(i18N) {
|
|
476
|
+
this.i18N = i18N;
|
|
477
|
+
}
|
|
478
|
+
writeValue(obj) {
|
|
479
|
+
if (!obj) {
|
|
480
|
+
this.value = null;
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
var date = obj;
|
|
484
|
+
this.value = { year: date.getFullYear(), month: (date.getMonth() + 1), day: date.getDate() };
|
|
485
|
+
}
|
|
486
|
+
registerOnChange(fn) {
|
|
487
|
+
this.onChange = fn;
|
|
488
|
+
}
|
|
489
|
+
registerOnTouched(fn) {
|
|
490
|
+
this.onTouched = fn;
|
|
491
|
+
}
|
|
492
|
+
setDisabledState(isDisabled) {
|
|
493
|
+
this.disabled = isDisabled;
|
|
494
|
+
}
|
|
495
|
+
markDisabled = (date, current) => date.month !== current?.month;
|
|
496
|
+
isWeekend = (date) => this.weekend.includes(this.calendar.getWeekday(date));
|
|
497
|
+
valueChanged(newDate) {
|
|
498
|
+
if (newDate) {
|
|
499
|
+
if (typeof newDate == 'string') {
|
|
500
|
+
let temp = newDate.split('/');
|
|
501
|
+
let res = new Date(+temp[0], (+temp[1]) - 1, +temp[2]);
|
|
502
|
+
this.onChange(res);
|
|
503
|
+
this.onTouched(res);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
let res = new Date(newDate.year, newDate.month - 1, newDate.day);
|
|
507
|
+
this.onChange(res);
|
|
508
|
+
this.onTouched(res);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
this.onChange(null);
|
|
513
|
+
this.onTouched(null);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
setToday() {
|
|
517
|
+
this.value = this.today;
|
|
518
|
+
this.valueChanged(this.value);
|
|
519
|
+
}
|
|
520
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerComponent, deps: [{ token: I18n }], target: i0.ɵɵFactoryTarget.Component });
|
|
521
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDatepickerComponent, isStandalone: true, selector: "ys-datepicker", inputs: { firstDayOfWeek: "firstDayOfWeek", weekend: "weekend", language: "language", isFooter: "isFooter", todayLabel: "todayLabel", footer: "footer", disabled: "disabled" }, providers: [
|
|
522
|
+
{
|
|
523
|
+
provide: NG_VALUE_ACCESSOR,
|
|
524
|
+
useExisting: forwardRef(() => YsDatepickerComponent),
|
|
525
|
+
multi: true
|
|
526
|
+
},
|
|
527
|
+
I18n,
|
|
528
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
529
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
530
|
+
], ngImport: i0, template: "<ngb-datepicker #dp [(ngModel)]=\"value\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n [footerTemplate]=\"footerTemplate\" placeholder=\"yyyy/mm/dd\" [disabled]=\"disabled\"\r\n (ngModelChange)=\"valueChanged(value)\" />\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"dp.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "component", type: i2$1.NgbDatepicker, selector: "ngb-datepicker", inputs: ["contentTemplate", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "maxDate", "minDate", "navigation", "outsideDays", "showWeekNumbers", "startDate", "weekdays"], outputs: ["navigate", "dateSelect"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { 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"] }] });
|
|
531
|
+
}
|
|
532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerComponent, decorators: [{
|
|
533
|
+
type: Component,
|
|
534
|
+
args: [{ selector: 'ys-datepicker', imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
535
|
+
{
|
|
536
|
+
provide: NG_VALUE_ACCESSOR,
|
|
537
|
+
useExisting: forwardRef(() => YsDatepickerComponent),
|
|
538
|
+
multi: true
|
|
539
|
+
},
|
|
540
|
+
I18n,
|
|
541
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
542
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
543
|
+
], template: "<ngb-datepicker #dp [(ngModel)]=\"value\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n [footerTemplate]=\"footerTemplate\" placeholder=\"yyyy/mm/dd\" [disabled]=\"disabled\"\r\n (ngModelChange)=\"valueChanged(value)\" />\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"dp.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"] }]
|
|
544
|
+
}], ctorParameters: () => [{ type: I18n }], propDecorators: { firstDayOfWeek: [{
|
|
545
|
+
type: Input
|
|
546
|
+
}], weekend: [{
|
|
547
|
+
type: Input
|
|
548
|
+
}], language: [{
|
|
549
|
+
type: Input
|
|
550
|
+
}], isFooter: [{
|
|
551
|
+
type: Input
|
|
552
|
+
}], todayLabel: [{
|
|
553
|
+
type: Input
|
|
554
|
+
}], footer: [{
|
|
555
|
+
type: Input
|
|
556
|
+
}], disabled: [{
|
|
557
|
+
type: Input
|
|
558
|
+
}] } });
|
|
559
|
+
|
|
560
|
+
class YsDatepickerPersianComponent {
|
|
561
|
+
i18N;
|
|
562
|
+
calendar = inject(NgbCalendar);
|
|
563
|
+
today = inject(NgbCalendar).getToday();
|
|
564
|
+
firstDayOfWeek = 6;
|
|
565
|
+
weekend = [5];
|
|
566
|
+
_language = LanguageType[LanguageType.fa];
|
|
567
|
+
get language() {
|
|
568
|
+
return this._language;
|
|
569
|
+
}
|
|
570
|
+
set language(value) {
|
|
571
|
+
this._language = value;
|
|
572
|
+
this.i18N.language = this._language;
|
|
573
|
+
}
|
|
574
|
+
isFooter = true;
|
|
575
|
+
todayLabel = "امروز";
|
|
576
|
+
footer = null;
|
|
577
|
+
_value = null;
|
|
578
|
+
get value() {
|
|
579
|
+
return this._value;
|
|
580
|
+
}
|
|
581
|
+
set value(val) {
|
|
582
|
+
this._value = val;
|
|
583
|
+
}
|
|
584
|
+
disabled = false;
|
|
585
|
+
onChange = () => { };
|
|
586
|
+
onTouched = () => { };
|
|
587
|
+
constructor(i18N) {
|
|
588
|
+
this.i18N = i18N;
|
|
589
|
+
this.language = LanguageType[LanguageType.fa];
|
|
590
|
+
}
|
|
591
|
+
writeValue(obj) {
|
|
592
|
+
if (!obj) {
|
|
593
|
+
this.value = null;
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
var date = obj;
|
|
597
|
+
let persianDate = JalaliDate.gregorianToJalali(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
598
|
+
this.value = { year: persianDate[0], month: persianDate[1], day: persianDate[2] };
|
|
599
|
+
}
|
|
600
|
+
registerOnChange(fn) {
|
|
601
|
+
this.onChange = fn;
|
|
602
|
+
}
|
|
603
|
+
registerOnTouched(fn) {
|
|
604
|
+
this.onTouched = fn;
|
|
605
|
+
}
|
|
606
|
+
setDisabledState(isDisabled) {
|
|
607
|
+
this.disabled = isDisabled;
|
|
608
|
+
}
|
|
609
|
+
markDisabled = (date, current) => date.month !== current?.month;
|
|
610
|
+
isWeekend = (date) => this.weekend.includes(this.calendar.getWeekday(date));
|
|
611
|
+
valueChanged(newDate) {
|
|
612
|
+
if (newDate) {
|
|
613
|
+
if (typeof newDate == 'string') {
|
|
614
|
+
let temp = newDate.split('/');
|
|
615
|
+
let convertedDate = JalaliDate.jalaliToGregorian(+temp[0], (+temp[1]) - 1, +temp[2]);
|
|
616
|
+
let res = new Date(+convertedDate[0], (+convertedDate[1]) - 1, +convertedDate[2]);
|
|
617
|
+
this.onChange(res);
|
|
618
|
+
this.onTouched(res);
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
let convertedDate = JalaliDate.jalaliToGregorian(newDate.year, newDate.month, newDate.day);
|
|
622
|
+
var res = new Date(+convertedDate[0], +convertedDate[1] - 1, +convertedDate[2]);
|
|
623
|
+
this.onChange(res);
|
|
624
|
+
this.onTouched(res);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
this.onChange(null);
|
|
629
|
+
this.onTouched(null);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
setToday() {
|
|
633
|
+
this.value = this.today;
|
|
634
|
+
this.valueChanged(this.value);
|
|
635
|
+
}
|
|
636
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerPersianComponent, deps: [{ token: I18n }], target: i0.ɵɵFactoryTarget.Component });
|
|
637
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDatepickerPersianComponent, isStandalone: true, selector: "ys-datepicker-persian", inputs: { firstDayOfWeek: "firstDayOfWeek", weekend: "weekend", language: "language", isFooter: "isFooter", todayLabel: "todayLabel", footer: "footer", disabled: "disabled" }, providers: [
|
|
638
|
+
{
|
|
639
|
+
provide: NG_VALUE_ACCESSOR,
|
|
640
|
+
useExisting: forwardRef(() => YsDatepickerPersianComponent),
|
|
641
|
+
multi: true
|
|
642
|
+
},
|
|
643
|
+
I18n,
|
|
644
|
+
{ provide: NgbCalendar, useClass: NgbCalendarPersian },
|
|
645
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
646
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
647
|
+
], ngImport: i0, template: "<ngb-datepicker #dp [(ngModel)]=\"value\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n [footerTemplate]=\"footerTemplate\" placeholder=\"yyyy/mm/dd\" [disabled]=\"disabled\"\r\n (ngModelChange)=\"valueChanged(value)\" />\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"dp.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "component", type: i2$1.NgbDatepicker, selector: "ngb-datepicker", inputs: ["contentTemplate", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "maxDate", "minDate", "navigation", "outsideDays", "showWeekNumbers", "startDate", "weekdays"], outputs: ["navigate", "dateSelect"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { 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"] }] });
|
|
648
|
+
}
|
|
649
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerPersianComponent, decorators: [{
|
|
650
|
+
type: Component,
|
|
651
|
+
args: [{ selector: 'ys-datepicker-persian', imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
652
|
+
{
|
|
653
|
+
provide: NG_VALUE_ACCESSOR,
|
|
654
|
+
useExisting: forwardRef(() => YsDatepickerPersianComponent),
|
|
655
|
+
multi: true
|
|
656
|
+
},
|
|
657
|
+
I18n,
|
|
658
|
+
{ provide: NgbCalendar, useClass: NgbCalendarPersian },
|
|
659
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
660
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
661
|
+
], template: "<ngb-datepicker #dp [(ngModel)]=\"value\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n [footerTemplate]=\"footerTemplate\" placeholder=\"yyyy/mm/dd\" [disabled]=\"disabled\"\r\n (ngModelChange)=\"valueChanged(value)\" />\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"dp.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"] }]
|
|
662
|
+
}], ctorParameters: () => [{ type: I18n }], propDecorators: { firstDayOfWeek: [{
|
|
663
|
+
type: Input
|
|
664
|
+
}], weekend: [{
|
|
665
|
+
type: Input
|
|
666
|
+
}], language: [{
|
|
667
|
+
type: Input
|
|
668
|
+
}], isFooter: [{
|
|
669
|
+
type: Input
|
|
670
|
+
}], todayLabel: [{
|
|
671
|
+
type: Input
|
|
672
|
+
}], footer: [{
|
|
673
|
+
type: Input
|
|
674
|
+
}], disabled: [{
|
|
675
|
+
type: Input
|
|
676
|
+
}] } });
|
|
677
|
+
|
|
678
|
+
class YsDatepickerPopupPersianComponent {
|
|
679
|
+
i18N;
|
|
680
|
+
calendar = inject(NgbCalendar);
|
|
681
|
+
today = inject(NgbCalendar).getToday();
|
|
682
|
+
_value = null;
|
|
683
|
+
get value() {
|
|
684
|
+
return this._value;
|
|
685
|
+
}
|
|
686
|
+
set value(val) {
|
|
687
|
+
this._value = val;
|
|
688
|
+
}
|
|
689
|
+
container = null;
|
|
690
|
+
firstDayOfWeek = 6;
|
|
691
|
+
weekend = [5];
|
|
692
|
+
_language = LanguageType[LanguageType.fa];
|
|
693
|
+
get language() {
|
|
694
|
+
return this._language;
|
|
695
|
+
}
|
|
696
|
+
set language(value) {
|
|
697
|
+
this._language = value;
|
|
698
|
+
this.i18N.language = this._language;
|
|
699
|
+
}
|
|
700
|
+
isFooter = true;
|
|
701
|
+
closeLabel = "بستن";
|
|
702
|
+
todayLabel = "امروز";
|
|
703
|
+
footer = null;
|
|
704
|
+
calendarIconClass = "fa-solid fa-calendar-days";
|
|
705
|
+
disabled = false;
|
|
706
|
+
onChange = () => { };
|
|
707
|
+
onTouched = () => { };
|
|
708
|
+
constructor(i18N) {
|
|
709
|
+
this.i18N = i18N;
|
|
710
|
+
this.language = LanguageType[LanguageType.fa];
|
|
711
|
+
}
|
|
712
|
+
writeValue(obj) {
|
|
713
|
+
if (!obj) {
|
|
714
|
+
this.value = null;
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
var date = obj;
|
|
718
|
+
let persianDate = JalaliDate.gregorianToJalali(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
719
|
+
this.value = { year: persianDate[0], month: persianDate[1], day: persianDate[2] };
|
|
720
|
+
}
|
|
721
|
+
registerOnChange(fn) {
|
|
722
|
+
this.onChange = fn;
|
|
723
|
+
}
|
|
724
|
+
registerOnTouched(fn) {
|
|
725
|
+
this.onTouched = fn;
|
|
726
|
+
}
|
|
727
|
+
setDisabledState(isDisabled) {
|
|
728
|
+
this.disabled = isDisabled;
|
|
729
|
+
}
|
|
730
|
+
markDisabled = (date, current) => date.month !== current?.month;
|
|
731
|
+
isWeekend = (date) => this.weekend.includes(this.calendar.getWeekday(date));
|
|
732
|
+
valueChanged(newDate) {
|
|
733
|
+
if (newDate) {
|
|
734
|
+
if (typeof newDate == 'string') {
|
|
735
|
+
let temp = newDate.split('/');
|
|
736
|
+
let convertedDate = JalaliDate.jalaliToGregorian(+temp[0], (+temp[1]) - 1, +temp[2]);
|
|
737
|
+
let res = new Date(+convertedDate[0], (+convertedDate[1]) - 1, +convertedDate[2]);
|
|
738
|
+
this.onChange(res);
|
|
739
|
+
this.onTouched(res);
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
let convertedDate = JalaliDate.jalaliToGregorian(newDate.year, newDate.month, newDate.day);
|
|
743
|
+
var res = new Date(+convertedDate[0], +convertedDate[1] - 1, +convertedDate[2]);
|
|
744
|
+
this.onChange(res);
|
|
745
|
+
this.onTouched(res);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
else {
|
|
749
|
+
this.onChange(null);
|
|
750
|
+
this.onTouched(null);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
setToday() {
|
|
754
|
+
this.value = this.today;
|
|
755
|
+
this.valueChanged(this.value);
|
|
756
|
+
}
|
|
757
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerPopupPersianComponent, deps: [{ token: I18n }], target: i0.ɵɵFactoryTarget.Component });
|
|
758
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDatepickerPopupPersianComponent, isStandalone: true, selector: "ys-datepicker-popup-persian", inputs: { container: "container", firstDayOfWeek: "firstDayOfWeek", weekend: "weekend", language: "language", isFooter: "isFooter", closeLabel: "closeLabel", todayLabel: "todayLabel", footer: "footer", calendarIconClass: "calendarIconClass", disabled: "disabled" }, providers: [
|
|
759
|
+
{
|
|
760
|
+
provide: NG_VALUE_ACCESSOR,
|
|
761
|
+
useExisting: forwardRef(() => YsDatepickerPopupPersianComponent),
|
|
762
|
+
multi: true
|
|
763
|
+
},
|
|
764
|
+
I18n,
|
|
765
|
+
{ provide: NgbCalendar, useClass: NgbCalendarPersian },
|
|
766
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
767
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
768
|
+
], ngImport: i0, template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dp\" [(ngModel)]=\"value\" ngbDatepicker\r\n #datepicker=\"ngbDatepicker\" [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n (ngModelChange)=\"valueChanged(value)\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "directive", type: i2$1.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
769
|
+
}
|
|
770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerPopupPersianComponent, decorators: [{
|
|
771
|
+
type: Component,
|
|
772
|
+
args: [{ selector: 'ys-datepicker-popup-persian', imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
773
|
+
{
|
|
774
|
+
provide: NG_VALUE_ACCESSOR,
|
|
775
|
+
useExisting: forwardRef(() => YsDatepickerPopupPersianComponent),
|
|
776
|
+
multi: true
|
|
777
|
+
},
|
|
778
|
+
I18n,
|
|
779
|
+
{ provide: NgbCalendar, useClass: NgbCalendarPersian },
|
|
780
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
781
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
782
|
+
], template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dp\" [(ngModel)]=\"value\" ngbDatepicker\r\n #datepicker=\"ngbDatepicker\" [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n (ngModelChange)=\"valueChanged(value)\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"] }]
|
|
783
|
+
}], ctorParameters: () => [{ type: I18n }], propDecorators: { container: [{
|
|
784
|
+
type: Input
|
|
785
|
+
}], firstDayOfWeek: [{
|
|
786
|
+
type: Input
|
|
787
|
+
}], weekend: [{
|
|
788
|
+
type: Input
|
|
789
|
+
}], language: [{
|
|
790
|
+
type: Input
|
|
791
|
+
}], isFooter: [{
|
|
792
|
+
type: Input
|
|
793
|
+
}], closeLabel: [{
|
|
794
|
+
type: Input
|
|
795
|
+
}], todayLabel: [{
|
|
796
|
+
type: Input
|
|
797
|
+
}], footer: [{
|
|
798
|
+
type: Input
|
|
799
|
+
}], calendarIconClass: [{
|
|
800
|
+
type: Input
|
|
801
|
+
}], disabled: [{
|
|
802
|
+
type: Input
|
|
803
|
+
}] } });
|
|
804
|
+
|
|
805
|
+
class YsDatepickerPopupComponent {
|
|
806
|
+
i18N;
|
|
807
|
+
calendar = inject(NgbCalendar);
|
|
808
|
+
today = inject(NgbCalendar).getToday();
|
|
809
|
+
_value = null;
|
|
810
|
+
get value() {
|
|
811
|
+
return this._value;
|
|
812
|
+
}
|
|
813
|
+
set value(val) {
|
|
814
|
+
this._value = val;
|
|
815
|
+
}
|
|
816
|
+
container = null;
|
|
817
|
+
firstDayOfWeek = 1;
|
|
818
|
+
weekend = [6, 7];
|
|
819
|
+
_language = LanguageType[LanguageType.en];
|
|
820
|
+
get language() {
|
|
821
|
+
return this._language;
|
|
822
|
+
}
|
|
823
|
+
set language(value) {
|
|
824
|
+
this._language = value;
|
|
825
|
+
this.i18N.language = this._language;
|
|
826
|
+
}
|
|
827
|
+
isFooter = true;
|
|
828
|
+
closeLabel = "Close";
|
|
829
|
+
todayLabel = "Today";
|
|
830
|
+
footer = null;
|
|
831
|
+
calendarIconClass = "fa-solid fa-calendar-days";
|
|
832
|
+
disabled = false;
|
|
833
|
+
onChange = () => { };
|
|
834
|
+
onTouched = () => { };
|
|
835
|
+
constructor(i18N) {
|
|
836
|
+
this.i18N = i18N;
|
|
837
|
+
}
|
|
838
|
+
writeValue(obj) {
|
|
839
|
+
if (!obj) {
|
|
840
|
+
this.value = null;
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
var date = obj;
|
|
844
|
+
this.value = { year: date.getFullYear(), month: (date.getMonth() + 1), day: date.getDate() };
|
|
845
|
+
}
|
|
846
|
+
registerOnChange(fn) {
|
|
847
|
+
this.onChange = fn;
|
|
848
|
+
}
|
|
849
|
+
registerOnTouched(fn) {
|
|
850
|
+
this.onTouched = fn;
|
|
851
|
+
}
|
|
852
|
+
setDisabledState(isDisabled) {
|
|
853
|
+
this.disabled = isDisabled;
|
|
854
|
+
}
|
|
855
|
+
markDisabled = (date, current) => date.month !== current?.month;
|
|
856
|
+
isWeekend = (date) => this.weekend.includes(this.calendar.getWeekday(date));
|
|
857
|
+
valueChanged(newDate) {
|
|
858
|
+
if (newDate) {
|
|
859
|
+
if (typeof newDate == 'string') {
|
|
860
|
+
let temp = newDate.split('/');
|
|
861
|
+
let res = new Date(+temp[0], (+temp[1]) - 1, +temp[2]);
|
|
862
|
+
this.onChange(res);
|
|
863
|
+
this.onTouched(res);
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
let res = new Date(newDate.year, newDate.month - 1, newDate.day);
|
|
867
|
+
this.onChange(res);
|
|
868
|
+
this.onTouched(res);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
this.onChange(null);
|
|
873
|
+
this.onTouched(null);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
setToday() {
|
|
877
|
+
this.value = this.today;
|
|
878
|
+
this.valueChanged(this.value);
|
|
879
|
+
}
|
|
880
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerPopupComponent, deps: [{ token: I18n }], target: i0.ɵɵFactoryTarget.Component });
|
|
881
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDatepickerPopupComponent, isStandalone: true, selector: "ys-datepicker-popup", inputs: { container: "container", firstDayOfWeek: "firstDayOfWeek", weekend: "weekend", language: "language", isFooter: "isFooter", closeLabel: "closeLabel", todayLabel: "todayLabel", footer: "footer", calendarIconClass: "calendarIconClass", disabled: "disabled" }, providers: [
|
|
882
|
+
{
|
|
883
|
+
provide: NG_VALUE_ACCESSOR,
|
|
884
|
+
useExisting: forwardRef(() => YsDatepickerPopupComponent),
|
|
885
|
+
multi: true
|
|
886
|
+
},
|
|
887
|
+
I18n,
|
|
888
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
889
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
890
|
+
], ngImport: i0, template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dp\" [(ngModel)]=\"value\" ngbDatepicker\r\n #datepicker=\"ngbDatepicker\" [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n (ngModelChange)=\"valueChanged(value)\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "directive", type: i2$1.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
891
|
+
}
|
|
892
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerPopupComponent, decorators: [{
|
|
893
|
+
type: Component,
|
|
894
|
+
args: [{ selector: 'ys-datepicker-popup', imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
895
|
+
{
|
|
896
|
+
provide: NG_VALUE_ACCESSOR,
|
|
897
|
+
useExisting: forwardRef(() => YsDatepickerPopupComponent),
|
|
898
|
+
multi: true
|
|
899
|
+
},
|
|
900
|
+
I18n,
|
|
901
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
902
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
903
|
+
], template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dp\" [(ngModel)]=\"value\" ngbDatepicker\r\n #datepicker=\"ngbDatepicker\" [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" [dayTemplate]=\"customDay\"\r\n (ngModelChange)=\"valueChanged(value)\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\" [class.bg-info]=\"selected\"\r\n [class.text-white]=\"selected\" [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.custom-day:hover,.custom-day.focused{background-color:var(--bs-gray-300)}.hidden{display:none}\n"] }]
|
|
904
|
+
}], ctorParameters: () => [{ type: I18n }], propDecorators: { container: [{
|
|
905
|
+
type: Input
|
|
906
|
+
}], firstDayOfWeek: [{
|
|
907
|
+
type: Input
|
|
908
|
+
}], weekend: [{
|
|
909
|
+
type: Input
|
|
910
|
+
}], language: [{
|
|
911
|
+
type: Input
|
|
912
|
+
}], isFooter: [{
|
|
913
|
+
type: Input
|
|
914
|
+
}], closeLabel: [{
|
|
915
|
+
type: Input
|
|
916
|
+
}], todayLabel: [{
|
|
917
|
+
type: Input
|
|
918
|
+
}], footer: [{
|
|
919
|
+
type: Input
|
|
920
|
+
}], calendarIconClass: [{
|
|
921
|
+
type: Input
|
|
922
|
+
}], disabled: [{
|
|
923
|
+
type: Input
|
|
924
|
+
}] } });
|
|
925
|
+
|
|
926
|
+
class YsDatepickerRangePopupPersianComponent {
|
|
927
|
+
i18N;
|
|
928
|
+
calendar = inject(NgbCalendar);
|
|
929
|
+
formatter = inject(NgbDateParserFormatter);
|
|
930
|
+
today = inject(NgbCalendar).getToday();
|
|
931
|
+
date;
|
|
932
|
+
hoveredDate = null;
|
|
933
|
+
_fromDate = null;
|
|
934
|
+
get fromDate() { return this._fromDate; }
|
|
935
|
+
set fromDate(value) {
|
|
936
|
+
this._fromDate = value;
|
|
937
|
+
}
|
|
938
|
+
_toDate = null;
|
|
939
|
+
get toDate() { return this._toDate; }
|
|
940
|
+
set toDate(value) {
|
|
941
|
+
this._toDate = value;
|
|
942
|
+
}
|
|
943
|
+
container = null;
|
|
944
|
+
firstDayOfWeek = 6;
|
|
945
|
+
weekend = [5];
|
|
946
|
+
_language = LanguageType[LanguageType.fa];
|
|
947
|
+
get language() {
|
|
948
|
+
return this._language;
|
|
949
|
+
}
|
|
950
|
+
set language(value) {
|
|
951
|
+
this._language = value;
|
|
952
|
+
this.i18N.language = this._language;
|
|
953
|
+
}
|
|
954
|
+
isFooter = true;
|
|
955
|
+
closeLabel = "بستن";
|
|
956
|
+
todayLabel = "امروز";
|
|
957
|
+
footer = null;
|
|
958
|
+
calendarIconClass = "fa-solid fa-calendar-days";
|
|
959
|
+
disabled = false;
|
|
960
|
+
onChange = () => { };
|
|
961
|
+
onTouched = () => { };
|
|
962
|
+
constructor(i18N) {
|
|
963
|
+
this.i18N = i18N;
|
|
964
|
+
this.language = LanguageType[LanguageType.fa];
|
|
965
|
+
}
|
|
966
|
+
writeValue(obj) {
|
|
967
|
+
if (!obj) {
|
|
968
|
+
this.fromDate = null;
|
|
969
|
+
this.toDate = null;
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
var fDate = obj.fromDate;
|
|
973
|
+
let persianDate = JalaliDate.gregorianToJalali(fDate.getFullYear(), fDate.getMonth() + 1, fDate.getDate());
|
|
974
|
+
this.fromDate = { year: persianDate[0], month: persianDate[1], day: persianDate[2] };
|
|
975
|
+
var tDate = obj.toDate;
|
|
976
|
+
persianDate = JalaliDate.gregorianToJalali(tDate.getFullYear(), tDate.getMonth() + 1, tDate.getDate());
|
|
977
|
+
this.toDate = { year: persianDate[0], month: persianDate[1], day: persianDate[2] };
|
|
978
|
+
}
|
|
979
|
+
registerOnChange(fn) {
|
|
980
|
+
this.onChange = fn;
|
|
981
|
+
}
|
|
982
|
+
registerOnTouched(fn) {
|
|
983
|
+
this.onTouched = fn;
|
|
984
|
+
}
|
|
985
|
+
setDisabledState(isDisabled) {
|
|
986
|
+
this.disabled = isDisabled;
|
|
987
|
+
}
|
|
988
|
+
onDateSelection(date) {
|
|
989
|
+
if (!this.fromDate && !this.toDate) {
|
|
990
|
+
this.fromDate = date;
|
|
991
|
+
}
|
|
992
|
+
else if (this.fromDate && !this.toDate && date && date.after(this.fromDate)) {
|
|
993
|
+
this.toDate = date;
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
this.toDate = null;
|
|
997
|
+
this.fromDate = date;
|
|
998
|
+
}
|
|
999
|
+
this.valueChanged();
|
|
1000
|
+
}
|
|
1001
|
+
isHovered(date) {
|
|
1002
|
+
return (this.fromDate && !this.toDate && this.hoveredDate && date.after(this.fromDate) && date.before(this.hoveredDate));
|
|
1003
|
+
}
|
|
1004
|
+
isInside(date) {
|
|
1005
|
+
return this.toDate && date.after(this.fromDate) && date.before(this.toDate);
|
|
1006
|
+
}
|
|
1007
|
+
isRange(date) {
|
|
1008
|
+
return (date.equals(this.fromDate) ||
|
|
1009
|
+
(this.toDate && date.equals(this.toDate)) ||
|
|
1010
|
+
this.isInside(date) ||
|
|
1011
|
+
this.isHovered(date));
|
|
1012
|
+
}
|
|
1013
|
+
markDisabled = (date, current) => date.month !== current?.month;
|
|
1014
|
+
isWeekend = (date) => this.weekend.includes(this.calendar.getWeekday(date));
|
|
1015
|
+
validateInput(currentValue, input) {
|
|
1016
|
+
const parsed = this.formatter.parse(input);
|
|
1017
|
+
return parsed && this.calendar.isValid(NgbDate.from(parsed)) ? NgbDate.from(parsed) : currentValue;
|
|
1018
|
+
}
|
|
1019
|
+
valueChanged() {
|
|
1020
|
+
let range = { fromDate: null, toDate: null };
|
|
1021
|
+
if (this.fromDate) {
|
|
1022
|
+
let fromDateConverted = JalaliDate.jalaliToGregorian(this.fromDate.year, this.fromDate.month, this.fromDate.day);
|
|
1023
|
+
range.fromDate = new Date(fromDateConverted[0], fromDateConverted[1] - 1, fromDateConverted[2]);
|
|
1024
|
+
}
|
|
1025
|
+
if (this.toDate) {
|
|
1026
|
+
let toDateConverted = JalaliDate.jalaliToGregorian(this.toDate.year, this.toDate.month, this.toDate.day);
|
|
1027
|
+
range.toDate = new Date(toDateConverted[0], toDateConverted[1] - 1, toDateConverted[2]);
|
|
1028
|
+
}
|
|
1029
|
+
this.onChange(range);
|
|
1030
|
+
this.onTouched(range);
|
|
1031
|
+
}
|
|
1032
|
+
setToday() {
|
|
1033
|
+
this.fromDate = this.today;
|
|
1034
|
+
this.toDate = this.today;
|
|
1035
|
+
this.valueChanged();
|
|
1036
|
+
}
|
|
1037
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerRangePopupPersianComponent, deps: [{ token: I18n }], target: i0.ɵɵFactoryTarget.Component });
|
|
1038
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDatepickerRangePopupPersianComponent, isStandalone: true, selector: "ys-datepicker-range-popup-persian", inputs: { container: "container", firstDayOfWeek: "firstDayOfWeek", weekend: "weekend", language: "language", isFooter: "isFooter", closeLabel: "closeLabel", todayLabel: "todayLabel", footer: "footer", calendarIconClass: "calendarIconClass", disabled: "disabled" }, providers: [
|
|
1039
|
+
{
|
|
1040
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1041
|
+
useExisting: forwardRef(() => YsDatepickerRangePopupPersianComponent),
|
|
1042
|
+
multi: true
|
|
1043
|
+
},
|
|
1044
|
+
I18n,
|
|
1045
|
+
{ provide: NgbCalendar, useClass: NgbCalendarPersian },
|
|
1046
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
1047
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
1048
|
+
], ngImport: i0, template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"dp-hidden position-absolute\">\r\n <div class=\"input-group\">\r\n <input name=\"datepicker\" class=\"form-control\" ngbDatepicker #datepicker=\"ngbDatepicker\"\r\n [autoClose]=\"'outside'\" (dateSelect)=\"onDateSelection($event)\" [displayMonths]=\"2\"\r\n [dayTemplate]=\"customDay\" outsideDays=\"hidden\" [startDate]=\"fromDate!\" tabindex=\"-1\"\r\n [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" readonly />\r\n </div>\r\n </div>\r\n <div class=\"input-group\">\r\n <input #dpFromDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpFromDate\"\r\n [value]=\"formatter.format(fromDate)\" (input)=\"fromDate = validateInput(fromDate, dpFromDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input #dpToDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpToDate\"\r\n [value]=\"formatter.format(toDate)\" (input)=\"toDate = validateInput(toDate, dpToDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\"\r\n [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\" [class.range]=\"isRange(date)\"\r\n [class.faded]=\"isHovered(date) || isInside(date)\" (mouseenter)=\"hoveredDate = date\"\r\n (mouseleave)=\"hoveredDate = null\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.dp-hidden{width:0;margin:0;border:none;padding:0}.custom-day.focused{background-color:var(--bs-gray-300)}.custom-day.range,.custom-day:hover{background-color:var(--bs-info);color:var(--bs-white)}.custom-day.faded{background-color:var(--bs-info);opacity:.5}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "directive", type: i2$1.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
1049
|
+
}
|
|
1050
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerRangePopupPersianComponent, decorators: [{
|
|
1051
|
+
type: Component,
|
|
1052
|
+
args: [{ selector: 'ys-datepicker-range-popup-persian', imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
1053
|
+
{
|
|
1054
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1055
|
+
useExisting: forwardRef(() => YsDatepickerRangePopupPersianComponent),
|
|
1056
|
+
multi: true
|
|
1057
|
+
},
|
|
1058
|
+
I18n,
|
|
1059
|
+
{ provide: NgbCalendar, useClass: NgbCalendarPersian },
|
|
1060
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
1061
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
1062
|
+
], template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"dp-hidden position-absolute\">\r\n <div class=\"input-group\">\r\n <input name=\"datepicker\" class=\"form-control\" ngbDatepicker #datepicker=\"ngbDatepicker\"\r\n [autoClose]=\"'outside'\" (dateSelect)=\"onDateSelection($event)\" [displayMonths]=\"2\"\r\n [dayTemplate]=\"customDay\" outsideDays=\"hidden\" [startDate]=\"fromDate!\" tabindex=\"-1\"\r\n [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" readonly />\r\n </div>\r\n </div>\r\n <div class=\"input-group\">\r\n <input #dpFromDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpFromDate\"\r\n [value]=\"formatter.format(fromDate)\" (input)=\"fromDate = validateInput(fromDate, dpFromDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input #dpToDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpToDate\"\r\n [value]=\"formatter.format(toDate)\" (input)=\"toDate = validateInput(toDate, dpToDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\"\r\n [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\" [class.range]=\"isRange(date)\"\r\n [class.faded]=\"isHovered(date) || isInside(date)\" (mouseenter)=\"hoveredDate = date\"\r\n (mouseleave)=\"hoveredDate = null\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.dp-hidden{width:0;margin:0;border:none;padding:0}.custom-day.focused{background-color:var(--bs-gray-300)}.custom-day.range,.custom-day:hover{background-color:var(--bs-info);color:var(--bs-white)}.custom-day.faded{background-color:var(--bs-info);opacity:.5}\n"] }]
|
|
1063
|
+
}], ctorParameters: () => [{ type: I18n }], propDecorators: { container: [{
|
|
1064
|
+
type: Input
|
|
1065
|
+
}], firstDayOfWeek: [{
|
|
1066
|
+
type: Input
|
|
1067
|
+
}], weekend: [{
|
|
1068
|
+
type: Input
|
|
1069
|
+
}], language: [{
|
|
1070
|
+
type: Input
|
|
1071
|
+
}], isFooter: [{
|
|
1072
|
+
type: Input
|
|
1073
|
+
}], closeLabel: [{
|
|
1074
|
+
type: Input
|
|
1075
|
+
}], todayLabel: [{
|
|
1076
|
+
type: Input
|
|
1077
|
+
}], footer: [{
|
|
1078
|
+
type: Input
|
|
1079
|
+
}], calendarIconClass: [{
|
|
1080
|
+
type: Input
|
|
1081
|
+
}], disabled: [{
|
|
1082
|
+
type: Input
|
|
1083
|
+
}] } });
|
|
1084
|
+
|
|
1085
|
+
class YsDatepickerRangePopupComponent {
|
|
1086
|
+
i18N;
|
|
1087
|
+
calendar = inject(NgbCalendar);
|
|
1088
|
+
formatter = inject(NgbDateParserFormatter);
|
|
1089
|
+
today = inject(NgbCalendar).getToday();
|
|
1090
|
+
hoveredDate = null;
|
|
1091
|
+
_fromDate = null;
|
|
1092
|
+
get fromDate() { return this._fromDate; }
|
|
1093
|
+
set fromDate(value) {
|
|
1094
|
+
this._fromDate = value;
|
|
1095
|
+
}
|
|
1096
|
+
_toDate = null;
|
|
1097
|
+
get toDate() { return this._toDate; }
|
|
1098
|
+
set toDate(value) {
|
|
1099
|
+
this._toDate = value;
|
|
1100
|
+
}
|
|
1101
|
+
container = null;
|
|
1102
|
+
firstDayOfWeek = 1;
|
|
1103
|
+
weekend = [6, 7];
|
|
1104
|
+
_language = LanguageType[LanguageType.en];
|
|
1105
|
+
get language() {
|
|
1106
|
+
return this._language;
|
|
1107
|
+
}
|
|
1108
|
+
set language(value) {
|
|
1109
|
+
this._language = value;
|
|
1110
|
+
this.i18N.language = this._language;
|
|
1111
|
+
}
|
|
1112
|
+
isFooter = true;
|
|
1113
|
+
closeLabel = "Close";
|
|
1114
|
+
todayLabel = "Today";
|
|
1115
|
+
footer = null;
|
|
1116
|
+
calendarIconClass = "fa-solid fa-calendar-days";
|
|
1117
|
+
disabled = false;
|
|
1118
|
+
onChange = () => { };
|
|
1119
|
+
onTouched = () => { };
|
|
1120
|
+
constructor(i18N) {
|
|
1121
|
+
this.i18N = i18N;
|
|
1122
|
+
}
|
|
1123
|
+
writeValue(obj) {
|
|
1124
|
+
if (!obj) {
|
|
1125
|
+
this.fromDate = null;
|
|
1126
|
+
this.toDate = null;
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
let d = obj;
|
|
1130
|
+
var fDate = d.fromDate;
|
|
1131
|
+
this.fromDate = { year: fDate.getFullYear(), month: (fDate.getMonth() + 1), day: fDate.getDate() };
|
|
1132
|
+
var tDate = d.toDate;
|
|
1133
|
+
this.toDate = { year: tDate.getFullYear(), month: (tDate.getMonth() + 1), day: tDate.getDate() };
|
|
1134
|
+
}
|
|
1135
|
+
registerOnChange(fn) {
|
|
1136
|
+
this.onChange = fn;
|
|
1137
|
+
}
|
|
1138
|
+
registerOnTouched(fn) {
|
|
1139
|
+
this.onTouched = fn;
|
|
1140
|
+
}
|
|
1141
|
+
setDisabledState(isDisabled) {
|
|
1142
|
+
this.disabled = isDisabled;
|
|
1143
|
+
}
|
|
1144
|
+
onDateSelection(date) {
|
|
1145
|
+
if (!this.fromDate && !this.toDate) {
|
|
1146
|
+
this.fromDate = date;
|
|
1147
|
+
}
|
|
1148
|
+
else if (this.fromDate && !this.toDate && date && date.after(this.fromDate)) {
|
|
1149
|
+
this.toDate = date;
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
this.toDate = null;
|
|
1153
|
+
this.fromDate = date;
|
|
1154
|
+
}
|
|
1155
|
+
this.valueChanged();
|
|
1156
|
+
}
|
|
1157
|
+
isHovered(date) {
|
|
1158
|
+
return (this.fromDate && !this.toDate && this.hoveredDate && date.after(this.fromDate) && date.before(this.hoveredDate));
|
|
1159
|
+
}
|
|
1160
|
+
isInside(date) {
|
|
1161
|
+
return this.toDate && date.after(this.fromDate) && date.before(this.toDate);
|
|
1162
|
+
}
|
|
1163
|
+
isRange(date) {
|
|
1164
|
+
return (date.equals(this.fromDate) ||
|
|
1165
|
+
(this.toDate && date.equals(this.toDate)) ||
|
|
1166
|
+
this.isInside(date) ||
|
|
1167
|
+
this.isHovered(date));
|
|
1168
|
+
}
|
|
1169
|
+
markDisabled = (date, current) => date.month !== current?.month;
|
|
1170
|
+
isWeekend = (date) => this.weekend.includes(this.calendar.getWeekday(date));
|
|
1171
|
+
validateInput(currentValue, input) {
|
|
1172
|
+
const parsed = this.formatter.parse(input);
|
|
1173
|
+
return parsed && this.calendar.isValid(NgbDate.from(parsed)) ? NgbDate.from(parsed) : currentValue;
|
|
1174
|
+
}
|
|
1175
|
+
valueChanged() {
|
|
1176
|
+
const fromDateTemp = this.fromDate ? new Date(this.fromDate.year, this.fromDate.month - 1, this.fromDate.day) : null;
|
|
1177
|
+
const toDateTemp = this.toDate ? new Date(this.toDate.year, this.toDate.month - 1, this.toDate.day) : null;
|
|
1178
|
+
const res = { fromDate: fromDateTemp, toDate: toDateTemp };
|
|
1179
|
+
this.onChange(res);
|
|
1180
|
+
this.onTouched(res);
|
|
1181
|
+
}
|
|
1182
|
+
setToday() {
|
|
1183
|
+
this.fromDate = this.today;
|
|
1184
|
+
this.toDate = this.today;
|
|
1185
|
+
this.valueChanged();
|
|
1186
|
+
}
|
|
1187
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerRangePopupComponent, deps: [{ token: I18n }], target: i0.ɵɵFactoryTarget.Component });
|
|
1188
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDatepickerRangePopupComponent, isStandalone: true, selector: "ys-datepicker-range-popup", inputs: { container: "container", firstDayOfWeek: "firstDayOfWeek", weekend: "weekend", language: "language", isFooter: "isFooter", closeLabel: "closeLabel", todayLabel: "todayLabel", footer: "footer", calendarIconClass: "calendarIconClass", disabled: "disabled" }, providers: [
|
|
1189
|
+
{
|
|
1190
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1191
|
+
useExisting: forwardRef(() => YsDatepickerRangePopupComponent),
|
|
1192
|
+
multi: true
|
|
1193
|
+
},
|
|
1194
|
+
I18n,
|
|
1195
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
1196
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
1197
|
+
], ngImport: i0, template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"dp-hidden position-absolute\">\r\n <div class=\"input-group\">\r\n <input name=\"datepicker\" class=\"form-control\" ngbDatepicker #datepicker=\"ngbDatepicker\"\r\n [autoClose]=\"'outside'\" (dateSelect)=\"onDateSelection($event)\" [displayMonths]=\"2\"\r\n [dayTemplate]=\"customDay\" outsideDays=\"hidden\" [startDate]=\"fromDate!\" tabindex=\"-1\"\r\n [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" readonly />\r\n </div>\r\n </div>\r\n <div class=\"input-group\">\r\n <input #dpFromDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpFromDate\"\r\n [value]=\"formatter.format(fromDate)\" (input)=\"fromDate = validateInput(fromDate, dpFromDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input #dpToDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpToDate\"\r\n [value]=\"formatter.format(toDate)\" (input)=\"toDate = validateInput(toDate, dpToDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\"\r\n [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\" [class.range]=\"isRange(date)\"\r\n [class.faded]=\"isHovered(date) || isInside(date)\" (mouseenter)=\"hoveredDate = date\"\r\n (mouseleave)=\"hoveredDate = null\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.dp-hidden{width:0;margin:0;border:none;padding:0}.custom-day.focused{background-color:var(--bs-gray-300)}.custom-day.range,.custom-day:hover{background-color:var(--bs-info);color:var(--bs-white)}.custom-day.faded{background-color:var(--bs-info);opacity:.5}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "directive", type: i2$1.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
1198
|
+
}
|
|
1199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDatepickerRangePopupComponent, decorators: [{
|
|
1200
|
+
type: Component,
|
|
1201
|
+
args: [{ selector: 'ys-datepicker-range-popup', imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
1202
|
+
{
|
|
1203
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1204
|
+
useExisting: forwardRef(() => YsDatepickerRangePopupComponent),
|
|
1205
|
+
multi: true
|
|
1206
|
+
},
|
|
1207
|
+
I18n,
|
|
1208
|
+
{ provide: NgbDatepickerI18n, useClass: YsDatepickerI18nService },
|
|
1209
|
+
{ provide: NgbDateParserFormatter, useClass: YsDateParserFormatterService }
|
|
1210
|
+
], template: "<form class=\"row row-cols-sm-auto\">\r\n <div class=\"col-12\">\r\n <div class=\"dp-hidden position-absolute\">\r\n <div class=\"input-group\">\r\n <input name=\"datepicker\" class=\"form-control\" ngbDatepicker #datepicker=\"ngbDatepicker\"\r\n [autoClose]=\"'outside'\" (dateSelect)=\"onDateSelection($event)\" [displayMonths]=\"2\"\r\n [dayTemplate]=\"customDay\" outsideDays=\"hidden\" [startDate]=\"fromDate!\" tabindex=\"-1\"\r\n [container]=\"container\" [markDisabled]=\"markDisabled\" [disabled]=\"disabled\"\r\n [footerTemplate]=\"footerTemplate\" [firstDayOfWeek]=\"firstDayOfWeek\" readonly />\r\n </div>\r\n </div>\r\n <div class=\"input-group\">\r\n <input #dpFromDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpFromDate\"\r\n [value]=\"formatter.format(fromDate)\" (input)=\"fromDate = validateInput(fromDate, dpFromDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"col-12\">\r\n <div class=\"input-group\">\r\n <input #dpToDate class=\"form-control\" placeholder=\"yyyy/mm/dd\" name=\"dpToDate\"\r\n [value]=\"formatter.format(toDate)\" (input)=\"toDate = validateInput(toDate, dpToDate.value)\"\r\n [disabled]=\"disabled\" readonly />\r\n <button class=\"btn btn-outline-secondary\" (click)=\"datepicker.toggle()\" type=\"button\" [disabled]=\"disabled\">\r\n <i class=\"{{calendarIconClass}}\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n <ng-template #customDay let-date let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\"\r\n let-focused=\"focused\">\r\n <span class=\"custom-day\" [class.weekend]=\"isWeekend(date)\" [class.focused]=\"focused\"\r\n [class.hidden]=\"date.month !== currentMonth\" [class.text-muted]=\"disabled\" [class.range]=\"isRange(date)\"\r\n [class.faded]=\"isHovered(date) || isInside(date)\" (mouseenter)=\"hoveredDate = date\"\r\n (mouseleave)=\"hoveredDate = null\">\r\n {{ date.day }}\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template #footerTemplate>\r\n @if (isFooter) {\r\n <span>\r\n <hr class=\"my-0\" />\r\n @if (footer) {\r\n <span>\r\n {{footer}}\r\n </span>\r\n }\r\n @if (!footer) {\r\n <span>\r\n <button class=\"btn btn-primary btn-sm m-2 float-start\" (click)=\"datepicker.navigateTo(); setToday();\"\r\n [disabled]=\"disabled\">{{todayLabel}}</button>\r\n <button class=\"btn btn-secondary btn-sm m-2 float-end\" (click)=\"datepicker.close()\">{{closeLabel}}</button>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </ng-template>", styles: ["::ng-deep html[dir=rtl] .ngb-dp-arrow-prev .ngb-dp-navigation-chevron{transform:rotate(45deg)}::ng-deep html[dir=rtl] .ngb-dp-arrow-next .ngb-dp-navigation-chevron{transform:rotate(-135deg)}::ng-deep html[dir=rtl] .form-select{background-position:left .75rem center}::ng-deep html[dir=rtl] .ngb-dp-month:first-child .ngb-dp-week{padding-right:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month:last-child .ngb-dp-week{padding-left:.25rem}::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,::ng-deep html[dir=rtl] .ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-right:1rem}::ng-deep html[dir=rtl] .input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,::ng-deep html[dir=rtl] .input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}::ng-deep html[dir=rtl] .input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-right:calc(var(--bs-border-width) * -1);border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-top-right-radius:0;border-bottom-right-radius:0}::ng-deep .ngb-dp-day{display:flex;align-items:center}.custom-day{text-align:center;padding:.185rem .25rem;border-radius:.25rem;display:inline-block;width:2rem;height:2rem;line-height:1.7}.weekend{color:var(--bs-danger)}.dp-hidden{width:0;margin:0;border:none;padding:0}.custom-day.focused{background-color:var(--bs-gray-300)}.custom-day.range,.custom-day:hover{background-color:var(--bs-info);color:var(--bs-white)}.custom-day.faded{background-color:var(--bs-info);opacity:.5}\n"] }]
|
|
1211
|
+
}], ctorParameters: () => [{ type: I18n }], propDecorators: { container: [{
|
|
1212
|
+
type: Input
|
|
1213
|
+
}], firstDayOfWeek: [{
|
|
1214
|
+
type: Input
|
|
1215
|
+
}], weekend: [{
|
|
1216
|
+
type: Input
|
|
1217
|
+
}], language: [{
|
|
1218
|
+
type: Input
|
|
1219
|
+
}], isFooter: [{
|
|
1220
|
+
type: Input
|
|
1221
|
+
}], closeLabel: [{
|
|
1222
|
+
type: Input
|
|
1223
|
+
}], todayLabel: [{
|
|
1224
|
+
type: Input
|
|
1225
|
+
}], footer: [{
|
|
1226
|
+
type: Input
|
|
1227
|
+
}], calendarIconClass: [{
|
|
1228
|
+
type: Input
|
|
1229
|
+
}], disabled: [{
|
|
1230
|
+
type: Input
|
|
1231
|
+
}] } });
|
|
1232
|
+
|
|
1233
|
+
/*
|
|
1234
|
+
* Public API Surface of ys-datepicker
|
|
1235
|
+
*/
|
|
1236
|
+
|
|
1237
|
+
class YsPasswordMatchDirective {
|
|
1238
|
+
matchWith = '';
|
|
1239
|
+
validate(control) {
|
|
1240
|
+
return this.matchWith ? passwordMatchValidator(this.matchWith)(control) : null;
|
|
1241
|
+
}
|
|
1242
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPasswordMatchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1243
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: YsPasswordMatchDirective, isStandalone: true, selector: "[ysPasswordMatch]", inputs: { matchWith: ["passwordMatch", "matchWith"] }, providers: [
|
|
1244
|
+
{
|
|
1245
|
+
provide: NG_ASYNC_VALIDATORS,
|
|
1246
|
+
useExisting: forwardRef(() => YsPasswordMatchDirective),
|
|
1247
|
+
multi: true,
|
|
1248
|
+
},
|
|
1249
|
+
], ngImport: i0 });
|
|
1250
|
+
}
|
|
1251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPasswordMatchDirective, decorators: [{
|
|
1252
|
+
type: Directive,
|
|
1253
|
+
args: [{
|
|
1254
|
+
selector: '[ysPasswordMatch]',
|
|
1255
|
+
providers: [
|
|
1256
|
+
{
|
|
1257
|
+
provide: NG_ASYNC_VALIDATORS,
|
|
1258
|
+
useExisting: forwardRef(() => YsPasswordMatchDirective),
|
|
1259
|
+
multi: true,
|
|
1260
|
+
},
|
|
1261
|
+
],
|
|
1262
|
+
}]
|
|
1263
|
+
}], propDecorators: { matchWith: [{
|
|
1264
|
+
type: Input,
|
|
1265
|
+
args: ['passwordMatch']
|
|
1266
|
+
}] } });
|
|
1267
|
+
/**
|
|
1268
|
+
* Validate password and repeat password matching.
|
|
1269
|
+
* @param matchWith AbstractControl name to matching.
|
|
1270
|
+
* @returns Returns null if the controls value matches, otherwise returns passwordMismatch error.
|
|
1271
|
+
*/
|
|
1272
|
+
function passwordMatchValidator(matchWith) {
|
|
1273
|
+
return (control) => {
|
|
1274
|
+
const password = control.parent?.get(matchWith);
|
|
1275
|
+
const confirmPassword = control;
|
|
1276
|
+
return password && confirmPassword && password.value === confirmPassword.value ? null : { mismatch: true };
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/*
|
|
1281
|
+
* Public API Surface of ys-directives
|
|
1282
|
+
*/
|
|
1283
|
+
|
|
1284
|
+
class YsDropdownComponent {
|
|
1285
|
+
/** لیست گزینهها */
|
|
1286
|
+
_options = [];
|
|
1287
|
+
set options(value) { this._options = this.normalizeOptions(value); }
|
|
1288
|
+
get options() { return this._options; }
|
|
1289
|
+
optionLabel = 'label';
|
|
1290
|
+
placeholder = '';
|
|
1291
|
+
searchPlaceholder = '';
|
|
1292
|
+
selectedMaxLength = 3;
|
|
1293
|
+
selectedMaxLengthTemplate = '{length} items selected';
|
|
1294
|
+
selectionSeparator = ", ";
|
|
1295
|
+
/** انتخاب چندگانه یا تکی */
|
|
1296
|
+
multiple = false;
|
|
1297
|
+
showClear = false;
|
|
1298
|
+
/** تمپلیت سفارشی برای آیتمها */
|
|
1299
|
+
itemTemplate;
|
|
1300
|
+
/** مقدار انتخابشده */
|
|
1301
|
+
selected = this.multiple ? [] : null;
|
|
1302
|
+
/** قابلیت جستجو */
|
|
1303
|
+
searchable = false;
|
|
1304
|
+
disabled = false;
|
|
1305
|
+
/** رویداد خروجی هنگام تغییر انتخاب */
|
|
1306
|
+
selectionChange = new EventEmitter();
|
|
1307
|
+
searchTerm = '';
|
|
1308
|
+
isOpen = false;
|
|
1309
|
+
highlightedIndex = -1;
|
|
1310
|
+
elRef = inject(ElementRef);
|
|
1311
|
+
_onChange = () => { };
|
|
1312
|
+
_onTouched = () => { };
|
|
1313
|
+
writeValue(obj) {
|
|
1314
|
+
if (this.multiple) {
|
|
1315
|
+
this.selected = obj ? [...obj] : [];
|
|
1316
|
+
}
|
|
1317
|
+
else {
|
|
1318
|
+
this.selected = obj;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
registerOnChange(fn) {
|
|
1322
|
+
this._onChange = fn;
|
|
1323
|
+
}
|
|
1324
|
+
registerOnTouched(fn) {
|
|
1325
|
+
this._onTouched = fn;
|
|
1326
|
+
}
|
|
1327
|
+
setDisabledState(isDisabled) {
|
|
1328
|
+
this.disabled = isDisabled;
|
|
1329
|
+
}
|
|
1330
|
+
normalizeOptions(list) {
|
|
1331
|
+
if (!Array.isArray(list))
|
|
1332
|
+
return [];
|
|
1333
|
+
return list.map(item => {
|
|
1334
|
+
// 1. اگر primitive بود
|
|
1335
|
+
if (['string', 'number', 'boolean'].includes(typeof item)) {
|
|
1336
|
+
return {
|
|
1337
|
+
raw: item,
|
|
1338
|
+
label: String(item),
|
|
1339
|
+
value: item
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
// 2. اگر OptionItem<T> بود
|
|
1343
|
+
if ('value' in item) {
|
|
1344
|
+
return {
|
|
1345
|
+
raw: item,
|
|
1346
|
+
label: item.label ?? String(item.value),
|
|
1347
|
+
value: item.value,
|
|
1348
|
+
...item
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
// 3. object معمولی
|
|
1352
|
+
return {
|
|
1353
|
+
raw: item,
|
|
1354
|
+
label: item[this.optionLabel] ?? JSON.stringify(item),
|
|
1355
|
+
value: item
|
|
1356
|
+
};
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
get selectedLabels() {
|
|
1360
|
+
if (this.multiple) {
|
|
1361
|
+
if (!Array.isArray(this.selected))
|
|
1362
|
+
return '';
|
|
1363
|
+
// لیست object های انتخابی را پیدا میکنیم
|
|
1364
|
+
const selectedItems = this.options.filter(o => this.selected.includes(o.value));
|
|
1365
|
+
const count = selectedItems.length;
|
|
1366
|
+
// اگر بیشتر از حد مجاز باشد → متن سفارشی
|
|
1367
|
+
if (count > this.selectedMaxLength) {
|
|
1368
|
+
return this.selectedMaxLengthTemplate.replace('{length}', count + '');
|
|
1369
|
+
}
|
|
1370
|
+
// در غیر اینصورت لیبلها را نمایش بده
|
|
1371
|
+
return selectedItems.map(o => o.label).join(this.selectionSeparator);
|
|
1372
|
+
}
|
|
1373
|
+
const item = this.options.find(o => o.value === this.selected);
|
|
1374
|
+
return item?.label ?? '';
|
|
1375
|
+
}
|
|
1376
|
+
toggleDropdown() {
|
|
1377
|
+
this.isOpen = !this.isOpen;
|
|
1378
|
+
if (this.isOpen) {
|
|
1379
|
+
this.highlightedIndex = -1;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
filterOptions() {
|
|
1383
|
+
let list = this.options;
|
|
1384
|
+
if (this.searchable && this.searchTerm.trim()) {
|
|
1385
|
+
const term = this.searchTerm.toLowerCase();
|
|
1386
|
+
list = this.options.filter(opt => opt[this.optionLabel].toLowerCase().includes(term));
|
|
1387
|
+
}
|
|
1388
|
+
// هر بار جستجو انجام شد index ریست بشه
|
|
1389
|
+
this.highlightedIndex = Math.min(this.highlightedIndex, list.length - 1);
|
|
1390
|
+
return list;
|
|
1391
|
+
}
|
|
1392
|
+
selectOption(option) {
|
|
1393
|
+
if (option.disabled)
|
|
1394
|
+
return;
|
|
1395
|
+
const returnedValue = option.value; // مقدار نهایی برای فرم
|
|
1396
|
+
if (this.multiple) {
|
|
1397
|
+
const exists = this.selected?.some((x) => x === returnedValue);
|
|
1398
|
+
this.selected = exists
|
|
1399
|
+
? this.selected.filter((x) => x !== returnedValue)
|
|
1400
|
+
: [...(this.selected || []), returnedValue];
|
|
1401
|
+
}
|
|
1402
|
+
else {
|
|
1403
|
+
this.selected = returnedValue;
|
|
1404
|
+
this.isOpen = false;
|
|
1405
|
+
}
|
|
1406
|
+
this._onChange(this.selected);
|
|
1407
|
+
this.selectionChange.emit(this.selected);
|
|
1408
|
+
}
|
|
1409
|
+
isSelected(option) {
|
|
1410
|
+
if (this.multiple) {
|
|
1411
|
+
return Array.isArray(this.selected)
|
|
1412
|
+
? this.selected.includes(option.value)
|
|
1413
|
+
: false;
|
|
1414
|
+
}
|
|
1415
|
+
return this.selected === option.value;
|
|
1416
|
+
}
|
|
1417
|
+
clearSelection() {
|
|
1418
|
+
this.selected = this.multiple ? [] : null;
|
|
1419
|
+
this._onChange(this.selected);
|
|
1420
|
+
this._onTouched();
|
|
1421
|
+
this.selectionChange.emit(this.selected);
|
|
1422
|
+
}
|
|
1423
|
+
onKeyDown(event) {
|
|
1424
|
+
const filtered = this.filterOptions();
|
|
1425
|
+
if (!filtered.length)
|
|
1426
|
+
return;
|
|
1427
|
+
switch (event.key) {
|
|
1428
|
+
case 'ArrowDown':
|
|
1429
|
+
event.preventDefault();
|
|
1430
|
+
this.highlightedIndex = (this.highlightedIndex + 1) % filtered.length;
|
|
1431
|
+
this.scrollToHighlighted();
|
|
1432
|
+
break;
|
|
1433
|
+
case 'ArrowUp':
|
|
1434
|
+
event.preventDefault();
|
|
1435
|
+
this.highlightedIndex = this.highlightedIndex > 0 ? this.highlightedIndex - 1 : filtered.length - 1;
|
|
1436
|
+
this.scrollToHighlighted();
|
|
1437
|
+
break;
|
|
1438
|
+
case 'Enter':
|
|
1439
|
+
event.preventDefault();
|
|
1440
|
+
if (this.highlightedIndex >= 0 && this.highlightedIndex < filtered.length) {
|
|
1441
|
+
this.selectOption(filtered[this.highlightedIndex]);
|
|
1442
|
+
}
|
|
1443
|
+
break;
|
|
1444
|
+
case 'Escape':
|
|
1445
|
+
this.isOpen = false;
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
scrollToHighlighted() {
|
|
1450
|
+
// تأخیر جزئی برای اطمینان از رندر کامل
|
|
1451
|
+
setTimeout(() => {
|
|
1452
|
+
const dropdown = this.elRef.nativeElement.querySelector('.dropdown-menu');
|
|
1453
|
+
const items = dropdown?.querySelectorAll('.dropdown-item');
|
|
1454
|
+
const activeItem = items?.[this.highlightedIndex];
|
|
1455
|
+
if (activeItem && dropdown) {
|
|
1456
|
+
const itemTop = activeItem.offsetTop;
|
|
1457
|
+
const itemBottom = itemTop + activeItem.offsetHeight;
|
|
1458
|
+
const dropdownScrollTop = dropdown.scrollTop;
|
|
1459
|
+
const dropdownHeight = dropdown.clientHeight;
|
|
1460
|
+
if (itemBottom > dropdownScrollTop + dropdownHeight) {
|
|
1461
|
+
dropdown.scrollTop = itemBottom - dropdownHeight;
|
|
1462
|
+
}
|
|
1463
|
+
else if (itemTop < dropdownScrollTop) {
|
|
1464
|
+
dropdown.scrollTop = itemTop;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
/** Close by clicking outside */
|
|
1470
|
+
onClickOutside(event) {
|
|
1471
|
+
const clickedInside = this.elRef.nativeElement.contains(event.target);
|
|
1472
|
+
if (!clickedInside) {
|
|
1473
|
+
this.isOpen = false;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1477
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsDropdownComponent, isStandalone: true, selector: "ys-dropdown", inputs: { options: "options", optionLabel: "optionLabel", placeholder: "placeholder", searchPlaceholder: "searchPlaceholder", selectedMaxLength: "selectedMaxLength", selectedMaxLengthTemplate: "selectedMaxLengthTemplate", selectionSeparator: "selectionSeparator", multiple: "multiple", showClear: "showClear", itemTemplate: "itemTemplate", selected: "selected", searchable: "searchable", disabled: "disabled" }, outputs: { selectionChange: "selectionChange" }, host: { listeners: { "document:click": "onClickOutside($event)" } }, providers: [
|
|
1478
|
+
{
|
|
1479
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1480
|
+
useExisting: forwardRef(() => YsDropdownComponent),
|
|
1481
|
+
multi: true,
|
|
1482
|
+
},
|
|
1483
|
+
], ngImport: i0, template: "<div class=\"dropdown ys-dropdown\">\r\n <div class=\"input-group w-100\">\r\n <input #inputRef type=\"text\" class=\"form-control\" [value]=\"selectedLabels\" [placeholder]=\"placeholder\" readonly\r\n (focus)=\"isOpen = true\" (keydown)=\"onKeyDown($event)\" [disabled]=\"disabled\" />\r\n\r\n @if(showClear && (multiple ? selected?.length > 0 : selected)){\r\n <button class=\"btn btn-outline-secondary\" type=\"button\" (click)=\"clearSelection()\" [disabled]=\"disabled\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\" (click)=\"toggleDropdown()\"\r\n [disabled]=\"disabled\">\r\n <i class=\"fa fa-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <div class=\"dropdown-menu w-100 overflow-auto\" [class.show]=\"isOpen\">\r\n\r\n @if(searchable){\r\n <div class=\"px-2\">\r\n <input type=\"text\" class=\"form-control mb-2\" [placeholder]=\"searchPlaceholder\" [(ngModel)]=\"searchTerm\"\r\n (keydown)=\"onKeyDown($event)\">\r\n </div>\r\n }\r\n\r\n @for (option of filterOptions(); track $index) {\r\n <div class=\"dropdown-item\" (click)=\"selectOption(option)\" [class.active]=\"isSelected(option)\"\r\n [class.highlighted]=\"$index === highlightedIndex\">\r\n @if(itemTemplate){\r\n <ng-container [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ option: option }\">\r\n </ng-container>\r\n }\r\n @else {\r\n @if(multiple){\r\n <i class=\"fa fa-check text-success me-1\" [class.invisible]=\"!isSelected(option)\"></i>\r\n }\r\n <!-- <span>{{option[optionLabel]}}</span> -->\r\n <span>{{option.label}}</span>\r\n }\r\n </div>\r\n }\r\n </div>\r\n</div>", styles: [".ys-dropdown .dropdown-toggle:after{display:none}.ys-dropdown .dropdown-menu{max-height:200px}.ys-dropdown .dropdown-item.highlighted{color:var(--bs-dropdown-link-hover-color);background-color:var(--bs-dropdown-link-hover-bg)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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"] }] });
|
|
1484
|
+
}
|
|
1485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsDropdownComponent, decorators: [{
|
|
1486
|
+
type: Component,
|
|
1487
|
+
args: [{ selector: 'ys-dropdown', imports: [NgTemplateOutlet, FormsModule], providers: [
|
|
1488
|
+
{
|
|
1489
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1490
|
+
useExisting: forwardRef(() => YsDropdownComponent),
|
|
1491
|
+
multi: true,
|
|
1492
|
+
},
|
|
1493
|
+
], template: "<div class=\"dropdown ys-dropdown\">\r\n <div class=\"input-group w-100\">\r\n <input #inputRef type=\"text\" class=\"form-control\" [value]=\"selectedLabels\" [placeholder]=\"placeholder\" readonly\r\n (focus)=\"isOpen = true\" (keydown)=\"onKeyDown($event)\" [disabled]=\"disabled\" />\r\n\r\n @if(showClear && (multiple ? selected?.length > 0 : selected)){\r\n <button class=\"btn btn-outline-secondary\" type=\"button\" (click)=\"clearSelection()\" [disabled]=\"disabled\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\" (click)=\"toggleDropdown()\"\r\n [disabled]=\"disabled\">\r\n <i class=\"fa fa-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <div class=\"dropdown-menu w-100 overflow-auto\" [class.show]=\"isOpen\">\r\n\r\n @if(searchable){\r\n <div class=\"px-2\">\r\n <input type=\"text\" class=\"form-control mb-2\" [placeholder]=\"searchPlaceholder\" [(ngModel)]=\"searchTerm\"\r\n (keydown)=\"onKeyDown($event)\">\r\n </div>\r\n }\r\n\r\n @for (option of filterOptions(); track $index) {\r\n <div class=\"dropdown-item\" (click)=\"selectOption(option)\" [class.active]=\"isSelected(option)\"\r\n [class.highlighted]=\"$index === highlightedIndex\">\r\n @if(itemTemplate){\r\n <ng-container [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ option: option }\">\r\n </ng-container>\r\n }\r\n @else {\r\n @if(multiple){\r\n <i class=\"fa fa-check text-success me-1\" [class.invisible]=\"!isSelected(option)\"></i>\r\n }\r\n <!-- <span>{{option[optionLabel]}}</span> -->\r\n <span>{{option.label}}</span>\r\n }\r\n </div>\r\n }\r\n </div>\r\n</div>", styles: [".ys-dropdown .dropdown-toggle:after{display:none}.ys-dropdown .dropdown-menu{max-height:200px}.ys-dropdown .dropdown-item.highlighted{color:var(--bs-dropdown-link-hover-color);background-color:var(--bs-dropdown-link-hover-bg)}\n"] }]
|
|
1494
|
+
}], propDecorators: { options: [{
|
|
1495
|
+
type: Input
|
|
1496
|
+
}], optionLabel: [{
|
|
1497
|
+
type: Input
|
|
1498
|
+
}], placeholder: [{
|
|
1499
|
+
type: Input
|
|
1500
|
+
}], searchPlaceholder: [{
|
|
1501
|
+
type: Input
|
|
1502
|
+
}], selectedMaxLength: [{
|
|
1503
|
+
type: Input
|
|
1504
|
+
}], selectedMaxLengthTemplate: [{
|
|
1505
|
+
type: Input
|
|
1506
|
+
}], selectionSeparator: [{
|
|
1507
|
+
type: Input
|
|
1508
|
+
}], multiple: [{
|
|
1509
|
+
type: Input
|
|
1510
|
+
}], showClear: [{
|
|
1511
|
+
type: Input
|
|
1512
|
+
}], itemTemplate: [{
|
|
1513
|
+
type: Input
|
|
1514
|
+
}], selected: [{
|
|
1515
|
+
type: Input
|
|
1516
|
+
}], searchable: [{
|
|
1517
|
+
type: Input
|
|
1518
|
+
}], disabled: [{
|
|
1519
|
+
type: Input
|
|
1520
|
+
}], selectionChange: [{
|
|
1521
|
+
type: Output
|
|
1522
|
+
}], onClickOutside: [{
|
|
1523
|
+
type: HostListener,
|
|
1524
|
+
args: ['document:click', ['$event']]
|
|
1525
|
+
}] } });
|
|
1526
|
+
|
|
1527
|
+
/*
|
|
1528
|
+
* Public API Surface of ys-dropdown
|
|
1529
|
+
*/
|
|
1530
|
+
|
|
1531
|
+
class YsFileUploadComponent {
|
|
1532
|
+
fileList;
|
|
1533
|
+
files = [];
|
|
1534
|
+
selectedFile = null;
|
|
1535
|
+
styleClass;
|
|
1536
|
+
/**
|
|
1537
|
+
* Allowing upload multiple files
|
|
1538
|
+
* Default is false
|
|
1539
|
+
*/
|
|
1540
|
+
multiple = false;
|
|
1541
|
+
/**
|
|
1542
|
+
* Acceptable type of files
|
|
1543
|
+
* Default is all file type
|
|
1544
|
+
*/
|
|
1545
|
+
accept = '*/*';
|
|
1546
|
+
/**
|
|
1547
|
+
* Upload button label
|
|
1548
|
+
* Default is Choose File
|
|
1549
|
+
*/
|
|
1550
|
+
uploadLabel = 'Choose File';
|
|
1551
|
+
/**Style class of upload button */
|
|
1552
|
+
uploadStyleClass = 'btn-primary';
|
|
1553
|
+
/**Icon class of upload button */
|
|
1554
|
+
uploadIconClass = 'fa fa-paperclip';
|
|
1555
|
+
/**Display choosed file remove button */
|
|
1556
|
+
isRemove = true;
|
|
1557
|
+
/**Icon of remove item button */
|
|
1558
|
+
removeIconClass = 'fa fa-times';
|
|
1559
|
+
/**
|
|
1560
|
+
* Files list display direction
|
|
1561
|
+
* Default is vertical (false)
|
|
1562
|
+
*/
|
|
1563
|
+
isHorizontal = false;
|
|
1564
|
+
/**Message displayed before choosing file */
|
|
1565
|
+
noFileMessage = "No file chosen";
|
|
1566
|
+
progressStyleClass;
|
|
1567
|
+
/**Value of progress element */
|
|
1568
|
+
progressValue;
|
|
1569
|
+
/**Max value of progress element */
|
|
1570
|
+
progressValueMax = 100;
|
|
1571
|
+
/**Display cancel upload button */
|
|
1572
|
+
isCancel = false;
|
|
1573
|
+
/**Event to get choosed files */
|
|
1574
|
+
choosed = new EventEmitter();
|
|
1575
|
+
/**Event of selected file in the list of choosed file*/
|
|
1576
|
+
select = new EventEmitter();
|
|
1577
|
+
/**Event of removed file in the list of choosed file*/
|
|
1578
|
+
removed = new EventEmitter();
|
|
1579
|
+
/**Event of cancel upload button */
|
|
1580
|
+
cancel = new EventEmitter();
|
|
1581
|
+
/**Disable elements */
|
|
1582
|
+
disabled = false;
|
|
1583
|
+
onChange = () => { };
|
|
1584
|
+
onTouched = () => { };
|
|
1585
|
+
constructor() { }
|
|
1586
|
+
writeValue(obj) {
|
|
1587
|
+
if (!obj) {
|
|
1588
|
+
this.files = [];
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
if (!Array.isArray(obj)) {
|
|
1592
|
+
this.files = [obj];
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
this.files = obj;
|
|
1596
|
+
}
|
|
1597
|
+
registerOnChange(fn) {
|
|
1598
|
+
this.onChange = fn;
|
|
1599
|
+
}
|
|
1600
|
+
registerOnTouched(fn) {
|
|
1601
|
+
this.onTouched = fn;
|
|
1602
|
+
}
|
|
1603
|
+
setDisabledState(isDisabled) {
|
|
1604
|
+
this.disabled = isDisabled;
|
|
1605
|
+
}
|
|
1606
|
+
onChangeFiles(event) {
|
|
1607
|
+
this.fileList = event.target.files;
|
|
1608
|
+
if (this.fileList?.length) {
|
|
1609
|
+
if (!this.multiple) {
|
|
1610
|
+
this.files = [];
|
|
1611
|
+
}
|
|
1612
|
+
for (let i = 0; i < this.fileList.length; i++) {
|
|
1613
|
+
const file = this.fileList.item(i);
|
|
1614
|
+
this.files.push(file);
|
|
1615
|
+
}
|
|
1616
|
+
this.files.sort((a, b) => a.name > b.name ? -1 : 1);
|
|
1617
|
+
}
|
|
1618
|
+
else {
|
|
1619
|
+
this.files = [];
|
|
1620
|
+
}
|
|
1621
|
+
this.onChange(this.files);
|
|
1622
|
+
this.onTouched(this.files);
|
|
1623
|
+
this.choosed.emit(this.files);
|
|
1624
|
+
event.target.value = null;
|
|
1625
|
+
}
|
|
1626
|
+
removeFile(file) {
|
|
1627
|
+
const index = this.files.indexOf(file);
|
|
1628
|
+
this.files.splice(index, 1);
|
|
1629
|
+
// this.onChange(this.multiple ? this.files : this.files[0]);
|
|
1630
|
+
this.onChange(this.files);
|
|
1631
|
+
this.onTouched(this.files);
|
|
1632
|
+
// this.choosed.emit(this.files);
|
|
1633
|
+
if (this.selectedFile == file) {
|
|
1634
|
+
this.selectedFile = null;
|
|
1635
|
+
// this.select.emit(null);
|
|
1636
|
+
}
|
|
1637
|
+
this.removed.emit(file);
|
|
1638
|
+
}
|
|
1639
|
+
onSelectFile(file) {
|
|
1640
|
+
this.selectedFile = file;
|
|
1641
|
+
this.select.emit(this.selectedFile);
|
|
1642
|
+
}
|
|
1643
|
+
cancelUpload() {
|
|
1644
|
+
this.cancel.emit();
|
|
1645
|
+
}
|
|
1646
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1647
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsFileUploadComponent, isStandalone: true, selector: "ys-file-upload", inputs: { styleClass: "styleClass", multiple: "multiple", accept: "accept", uploadLabel: "uploadLabel", uploadStyleClass: "uploadStyleClass", uploadIconClass: "uploadIconClass", isRemove: "isRemove", removeIconClass: "removeIconClass", isHorizontal: "isHorizontal", noFileMessage: "noFileMessage", progressStyleClass: "progressStyleClass", progressValue: "progressValue", progressValueMax: "progressValueMax", isCancel: "isCancel", disabled: "disabled" }, outputs: { choosed: "choosed", select: "select", removed: "removed", cancel: "cancel" }, providers: [
|
|
1648
|
+
{
|
|
1649
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1650
|
+
useExisting: forwardRef(() => YsFileUploadComponent),
|
|
1651
|
+
multi: true
|
|
1652
|
+
}
|
|
1653
|
+
], ngImport: i0, template: "<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n <div class=\"file-upload\" [ngClass]=\"styleClass\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-upload\" [ngClass]=\"uploadStyleClass\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n @if (uploadLabel) {\r\n <span class=\"ms-2\">{{uploadLabel}}</span>\r\n }\r\n </button>\r\n\r\n @if (noFileMessage) {\r\n <span class=\"ms-2\">{{files.length ? '' : noFileMessage}}</span>\r\n }\r\n\r\n @if (files.length) {\r\n <ul class=\"file-upload-list list-group mt-2\"\r\n [ngClass]=\"{'list-group-horizontal overflow-auto': isHorizontal}\">\r\n @for (file of files; track file) {\r\n <a class=\"file-upload-item list-group-item d-flex align-items-center\" role=\"button\"\r\n (click)=\"onSelectFile(file)\"\r\n [ngClass]=\"{'active': file == selectedFile, 'disabled': disabled}\">\r\n <span class=\"me-2\">{{file.name}}</span>\r\n @if (isRemove) {\r\n <button class=\"btn btn-outline-danger btn-sm ms-auto\" type=\"button\"\r\n id=\"removeFileButton\" (click)=\"removeFile(file); $event.stopPropagation();\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"removeIconClass\"></i>\r\n </button>\r\n }\r\n </a>\r\n }\r\n </ul>\r\n }\r\n\r\n </div>\r\n </div>\r\n </div>\r\n\r\n @if (progressValue) {\r\n <div class=\"progress mt-2\" [ngClass]=\"progressStyleClass\">\r\n <div class=\"progress-bar\" role=\"progressbar\" [style.width.%]=\"progressValue\" [attr.aria-valuenow]=\"progressValue\"\r\n aria-valuemin=\"0\" [attr.aria-valuemax]=\"progressValueMax\"></div>\r\n @if (isCancel && progressValue < progressValueMax) {\r\n <button class=\"btn btn-danger btn-sm btn-upload-cancel d-flex\"\r\n (click)=\"cancelUpload()\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n }\r\n </div>\r\n }", styles: [".progress{height:20px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1654
|
+
}
|
|
1655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsFileUploadComponent, decorators: [{
|
|
1656
|
+
type: Component,
|
|
1657
|
+
args: [{ selector: 'ys-file-upload', imports: [NgClass], providers: [
|
|
1658
|
+
{
|
|
1659
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1660
|
+
useExisting: forwardRef(() => YsFileUploadComponent),
|
|
1661
|
+
multi: true
|
|
1662
|
+
}
|
|
1663
|
+
], template: "<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n <div class=\"file-upload\" [ngClass]=\"styleClass\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-upload\" [ngClass]=\"uploadStyleClass\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n @if (uploadLabel) {\r\n <span class=\"ms-2\">{{uploadLabel}}</span>\r\n }\r\n </button>\r\n\r\n @if (noFileMessage) {\r\n <span class=\"ms-2\">{{files.length ? '' : noFileMessage}}</span>\r\n }\r\n\r\n @if (files.length) {\r\n <ul class=\"file-upload-list list-group mt-2\"\r\n [ngClass]=\"{'list-group-horizontal overflow-auto': isHorizontal}\">\r\n @for (file of files; track file) {\r\n <a class=\"file-upload-item list-group-item d-flex align-items-center\" role=\"button\"\r\n (click)=\"onSelectFile(file)\"\r\n [ngClass]=\"{'active': file == selectedFile, 'disabled': disabled}\">\r\n <span class=\"me-2\">{{file.name}}</span>\r\n @if (isRemove) {\r\n <button class=\"btn btn-outline-danger btn-sm ms-auto\" type=\"button\"\r\n id=\"removeFileButton\" (click)=\"removeFile(file); $event.stopPropagation();\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"removeIconClass\"></i>\r\n </button>\r\n }\r\n </a>\r\n }\r\n </ul>\r\n }\r\n\r\n </div>\r\n </div>\r\n </div>\r\n\r\n @if (progressValue) {\r\n <div class=\"progress mt-2\" [ngClass]=\"progressStyleClass\">\r\n <div class=\"progress-bar\" role=\"progressbar\" [style.width.%]=\"progressValue\" [attr.aria-valuenow]=\"progressValue\"\r\n aria-valuemin=\"0\" [attr.aria-valuemax]=\"progressValueMax\"></div>\r\n @if (isCancel && progressValue < progressValueMax) {\r\n <button class=\"btn btn-danger btn-sm btn-upload-cancel d-flex\"\r\n (click)=\"cancelUpload()\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n }\r\n </div>\r\n }", styles: [".progress{height:20px}\n"] }]
|
|
1664
|
+
}], ctorParameters: () => [], propDecorators: { styleClass: [{
|
|
1665
|
+
type: Input
|
|
1666
|
+
}], multiple: [{
|
|
1667
|
+
type: Input
|
|
1668
|
+
}], accept: [{
|
|
1669
|
+
type: Input
|
|
1670
|
+
}], uploadLabel: [{
|
|
1671
|
+
type: Input
|
|
1672
|
+
}], uploadStyleClass: [{
|
|
1673
|
+
type: Input
|
|
1674
|
+
}], uploadIconClass: [{
|
|
1675
|
+
type: Input
|
|
1676
|
+
}], isRemove: [{
|
|
1677
|
+
type: Input
|
|
1678
|
+
}], removeIconClass: [{
|
|
1679
|
+
type: Input
|
|
1680
|
+
}], isHorizontal: [{
|
|
1681
|
+
type: Input
|
|
1682
|
+
}], noFileMessage: [{
|
|
1683
|
+
type: Input
|
|
1684
|
+
}], progressStyleClass: [{
|
|
1685
|
+
type: Input
|
|
1686
|
+
}], progressValue: [{
|
|
1687
|
+
type: Input
|
|
1688
|
+
}], progressValueMax: [{
|
|
1689
|
+
type: Input
|
|
1690
|
+
}], isCancel: [{
|
|
1691
|
+
type: Input
|
|
1692
|
+
}], choosed: [{
|
|
1693
|
+
type: Output
|
|
1694
|
+
}], select: [{
|
|
1695
|
+
type: Output
|
|
1696
|
+
}], removed: [{
|
|
1697
|
+
type: Output
|
|
1698
|
+
}], cancel: [{
|
|
1699
|
+
type: Output
|
|
1700
|
+
}], disabled: [{
|
|
1701
|
+
type: Input
|
|
1702
|
+
}] } });
|
|
1703
|
+
|
|
1704
|
+
/*
|
|
1705
|
+
* Public API Surface of ys-file-upload
|
|
1706
|
+
*/
|
|
1707
|
+
|
|
1708
|
+
class YsFooterComponent {
|
|
1709
|
+
styleClass = null;
|
|
1710
|
+
brand = null;
|
|
1711
|
+
copyright = null;
|
|
1712
|
+
socialNetworks = [];
|
|
1713
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1714
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsFooterComponent, isStandalone: true, selector: "ys-footer", inputs: { styleClass: "styleClass", brand: "brand", copyright: "copyright", socialNetworks: "socialNetworks" }, ngImport: i0, template: "<!-- https://colorlib.com/wp/template/bootstrap-footer-19/ -->\r\n<footer [ngClass]=\"styleClass\">\r\n <!-- <div class=\"row\">\r\n <div class=\"col-md-6 col-lg-3 mb-md-0 mb-4\">\r\n <h2 class=\"footer-heading d-flex\">\r\n <span class=\"icon d-flex align-items-center justify-content-center\"><i class=\"ion-logo-ionic\"></i></span>\r\n About\r\n </h2>\r\n <div class=\"block-23 mb-3\">\r\n <ul>\r\n <li><span class=\"icon ion-ios-pin\"></span><span class=\"text\">203 Fake St. Mountain View, San\r\n Francisco, California, USA</span></li>\r\n <li><a href=\"#\"><span class=\"icon ion-ios-call\"></span><span class=\"text\">+2 392 3929 210</span></a>\r\n </li>\r\n <li><a href=\"#\"><span class=\"icon ion-ios-send\"></span><span\r\n class=\"text\">support@yourdomain.com</span></a></li>\r\n </ul>\r\n </div>\r\n\r\n <form action=\"#\" class=\"subscribe-form\">\r\n <div class=\"input-group d-flex\">\r\n <input type=\"text\" class=\"form-control\" placeholder=\"Enter email address\">\r\n <button type=\"submit\" class=\"btn btn-info\">\r\n <span class=\"sr-only\">Submit</span>\r\n <i class=\"fa fa-paper-plane\"></i></button>\r\n </div>\r\n </form>\r\n </div>\r\n\r\n </div> -->\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"d-flex justify-content-between align-items-center py-3 my-4 border-top\">\r\n @if (brand || copyright) {\r\n <div class=\"d-flex align-items-center\">\r\n @if (brand) {\r\n <a href=\"{{brand.href}}\" class=\"px-2 text-muted text-decoration-none\">\r\n <img src=\"{{brand.src}}\" alt=\"{{brand.alt}}\" class=\"brand-logo d-inline-block align-text-top\">\r\n </a>\r\n }\r\n @if (copyright) {\r\n <span class=\"text-muted\">{{copyright}}</span>\r\n }\r\n </div>\r\n }\r\n\r\n @if (socialNetworks.length) {\r\n <ul class=\"nav\">\r\n @for (item of socialNetworks; track item) {\r\n <li class=\"px-2\">\r\n <a class=\"text-muted social-icon\" href=\"{{item.href}}\" [ngbTooltip]=\"item.tooltip\">\r\n <em class=\"{{item.iconClass}}\"></em>\r\n </a>\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</footer>", styles: [".social-icon:hover{color:rgba(var(--bs-link-color-rgb),var(--bs-link-opacity, 1))!important}.brand-logo{width:30px;height:30px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "tooltipContext", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] });
|
|
1715
|
+
}
|
|
1716
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsFooterComponent, decorators: [{
|
|
1717
|
+
type: Component,
|
|
1718
|
+
args: [{ selector: 'ys-footer', imports: [NgClass, NgbTooltip], template: "<!-- https://colorlib.com/wp/template/bootstrap-footer-19/ -->\r\n<footer [ngClass]=\"styleClass\">\r\n <!-- <div class=\"row\">\r\n <div class=\"col-md-6 col-lg-3 mb-md-0 mb-4\">\r\n <h2 class=\"footer-heading d-flex\">\r\n <span class=\"icon d-flex align-items-center justify-content-center\"><i class=\"ion-logo-ionic\"></i></span>\r\n About\r\n </h2>\r\n <div class=\"block-23 mb-3\">\r\n <ul>\r\n <li><span class=\"icon ion-ios-pin\"></span><span class=\"text\">203 Fake St. Mountain View, San\r\n Francisco, California, USA</span></li>\r\n <li><a href=\"#\"><span class=\"icon ion-ios-call\"></span><span class=\"text\">+2 392 3929 210</span></a>\r\n </li>\r\n <li><a href=\"#\"><span class=\"icon ion-ios-send\"></span><span\r\n class=\"text\">support@yourdomain.com</span></a></li>\r\n </ul>\r\n </div>\r\n\r\n <form action=\"#\" class=\"subscribe-form\">\r\n <div class=\"input-group d-flex\">\r\n <input type=\"text\" class=\"form-control\" placeholder=\"Enter email address\">\r\n <button type=\"submit\" class=\"btn btn-info\">\r\n <span class=\"sr-only\">Submit</span>\r\n <i class=\"fa fa-paper-plane\"></i></button>\r\n </div>\r\n </form>\r\n </div>\r\n\r\n </div> -->\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"d-flex justify-content-between align-items-center py-3 my-4 border-top\">\r\n @if (brand || copyright) {\r\n <div class=\"d-flex align-items-center\">\r\n @if (brand) {\r\n <a href=\"{{brand.href}}\" class=\"px-2 text-muted text-decoration-none\">\r\n <img src=\"{{brand.src}}\" alt=\"{{brand.alt}}\" class=\"brand-logo d-inline-block align-text-top\">\r\n </a>\r\n }\r\n @if (copyright) {\r\n <span class=\"text-muted\">{{copyright}}</span>\r\n }\r\n </div>\r\n }\r\n\r\n @if (socialNetworks.length) {\r\n <ul class=\"nav\">\r\n @for (item of socialNetworks; track item) {\r\n <li class=\"px-2\">\r\n <a class=\"text-muted social-icon\" href=\"{{item.href}}\" [ngbTooltip]=\"item.tooltip\">\r\n <em class=\"{{item.iconClass}}\"></em>\r\n </a>\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</footer>", styles: [".social-icon:hover{color:rgba(var(--bs-link-color-rgb),var(--bs-link-opacity, 1))!important}.brand-logo{width:30px;height:30px}\n"] }]
|
|
1719
|
+
}], propDecorators: { styleClass: [{
|
|
1720
|
+
type: Input
|
|
1721
|
+
}], brand: [{
|
|
1722
|
+
type: Input
|
|
1723
|
+
}], copyright: [{
|
|
1724
|
+
type: Input
|
|
1725
|
+
}], socialNetworks: [{
|
|
1726
|
+
type: Input
|
|
1727
|
+
}] } });
|
|
1728
|
+
|
|
1729
|
+
/*
|
|
1730
|
+
* Public API Surface of ys-footer
|
|
1731
|
+
*/
|
|
1732
|
+
|
|
1733
|
+
class YsLoadingMaskComponent {
|
|
1734
|
+
loading = false;
|
|
1735
|
+
message = 'Loading ...';
|
|
1736
|
+
backgroundStyleclass = null;
|
|
1737
|
+
spinnerStyleclass = null;
|
|
1738
|
+
messageStyleclass = null;
|
|
1739
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsLoadingMaskComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1740
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsLoadingMaskComponent, isStandalone: true, selector: "ys-loading-mask", inputs: { loading: "loading", message: "message", backgroundStyleclass: "backgroundStyleclass", spinnerStyleclass: "spinnerStyleclass", messageStyleclass: "messageStyleclass" }, ngImport: i0, template: "@if (loading) {\r\n <div\r\n class=\"loading-wrapper d-flex flex-column align-items-center justify-content-center h-100 w-100 position-absolute\">\r\n <div class=\"loading-mask bg-secondary position-absolute h-100 w-100\" [ngClass]=\"backgroundStyleclass\">\r\n </div>\r\n <div class=\"loading-content d-flex flex-column align-items-center justify-content-center\">\r\n <div class=\"loading-spinner spinner-border text-primary\" [ngClass]=\"spinnerStyleclass\" role=\"status\"></div>\r\n @if (message) {\r\n <strong class=\"badge bg-primary mt-4 p-3\" [ngClass]=\"messageStyleclass\">\r\n {{message}}\r\n </strong>\r\n }\r\n </div>\r\n </div>\r\n}", styles: [".loading-wrapper{top:0;left:0;z-index:1001}.loading-wrapper .loading-mask{opacity:.3}.loading-wrapper .loading-content{z-index:1}.loading-wrapper .loading-content .loading-spinner{width:3rem;height:3rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1741
|
+
}
|
|
1742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsLoadingMaskComponent, decorators: [{
|
|
1743
|
+
type: Component,
|
|
1744
|
+
args: [{ selector: 'ys-loading-mask', imports: [NgClass], template: "@if (loading) {\r\n <div\r\n class=\"loading-wrapper d-flex flex-column align-items-center justify-content-center h-100 w-100 position-absolute\">\r\n <div class=\"loading-mask bg-secondary position-absolute h-100 w-100\" [ngClass]=\"backgroundStyleclass\">\r\n </div>\r\n <div class=\"loading-content d-flex flex-column align-items-center justify-content-center\">\r\n <div class=\"loading-spinner spinner-border text-primary\" [ngClass]=\"spinnerStyleclass\" role=\"status\"></div>\r\n @if (message) {\r\n <strong class=\"badge bg-primary mt-4 p-3\" [ngClass]=\"messageStyleclass\">\r\n {{message}}\r\n </strong>\r\n }\r\n </div>\r\n </div>\r\n}", styles: [".loading-wrapper{top:0;left:0;z-index:1001}.loading-wrapper .loading-mask{opacity:.3}.loading-wrapper .loading-content{z-index:1}.loading-wrapper .loading-content .loading-spinner{width:3rem;height:3rem}\n"] }]
|
|
1745
|
+
}], propDecorators: { loading: [{
|
|
1746
|
+
type: Input
|
|
1747
|
+
}], message: [{
|
|
1748
|
+
type: Input
|
|
1749
|
+
}], backgroundStyleclass: [{
|
|
1750
|
+
type: Input
|
|
1751
|
+
}], spinnerStyleclass: [{
|
|
1752
|
+
type: Input
|
|
1753
|
+
}], messageStyleclass: [{
|
|
1754
|
+
type: Input
|
|
1755
|
+
}] } });
|
|
1756
|
+
|
|
1757
|
+
/*
|
|
1758
|
+
* Public API Surface of ys-loading-mask
|
|
1759
|
+
*/
|
|
1760
|
+
|
|
1761
|
+
class YsNavbarComponent {
|
|
1762
|
+
formBuilder;
|
|
1763
|
+
searchForm;
|
|
1764
|
+
id = 'mainNavbar';
|
|
1765
|
+
theme = 'dark';
|
|
1766
|
+
styleClass;
|
|
1767
|
+
brand = null;
|
|
1768
|
+
items = [];
|
|
1769
|
+
endItems = [];
|
|
1770
|
+
isSearch = false;
|
|
1771
|
+
searchLabel = 'Search';
|
|
1772
|
+
searchIconClass;
|
|
1773
|
+
searchPlaceholder = 'Search';
|
|
1774
|
+
isSidebarToggler = false;
|
|
1775
|
+
isSidebarToggled = true;
|
|
1776
|
+
sidebarTogglerIconClass = "fa-solid fa-angle-right";
|
|
1777
|
+
toggleSidebar = new EventEmitter();
|
|
1778
|
+
search = new EventEmitter();
|
|
1779
|
+
constructor(formBuilder) {
|
|
1780
|
+
this.formBuilder = formBuilder;
|
|
1781
|
+
this.searchForm = this.formBuilder.group({
|
|
1782
|
+
searchValue: ['']
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
ngOnInit() {
|
|
1786
|
+
// this.toggleSidebar.emit(this.isSidebarToggled);
|
|
1787
|
+
}
|
|
1788
|
+
onToggleSidebar() {
|
|
1789
|
+
this.isSidebarToggled = !this.isSidebarToggled;
|
|
1790
|
+
this.toggleSidebar.emit(this.isSidebarToggled);
|
|
1791
|
+
}
|
|
1792
|
+
submitSearch() {
|
|
1793
|
+
this.search.emit(this.searchForm.get('searchValue')?.value);
|
|
1794
|
+
}
|
|
1795
|
+
isDropdown(item) {
|
|
1796
|
+
return item.items?.length;
|
|
1797
|
+
}
|
|
1798
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsNavbarComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
1799
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsNavbarComponent, isStandalone: true, selector: "ys-navbar", inputs: { id: "id", theme: "theme", styleClass: "styleClass", brand: "brand", items: "items", endItems: "endItems", isSearch: "isSearch", searchLabel: "searchLabel", searchIconClass: "searchIconClass", searchPlaceholder: "searchPlaceholder", isSidebarToggler: "isSidebarToggler", isSidebarToggled: "isSidebarToggled", sidebarTogglerIconClass: "sidebarTogglerIconClass" }, outputs: { toggleSidebar: "toggleSidebar", search: "search" }, ngImport: i0, template: "<nav class=\"navbar navbar-expand-lg bg-primary\" [ngClass]=\"styleClass\" [attr.data-bs-theme]=\"theme\">\r\n <div class=\"container-fluid\">\r\n\r\n @if (isSidebarToggler) {\r\n <button class=\"sidebar-toggler me-2\" type=\"button\" (click)=\"onToggleSidebar()\"\r\n aria-expanded=\"false\" aria-label=\"Toggle sidebar\" [ngClass]=\"{'toggled': isSidebarToggled}\">\r\n <i class=\"{{sidebarTogglerIconClass}} sidebar-toggler-icon p-1\"></i>\r\n </button>\r\n }\r\n\r\n <a class=\"navbar-brand\" [ngClass]=\"{'me-auto': !items.length}\" href=\"{{brand?.href}}\">\r\n @if (brand?.src) {\r\n <img src=\"{{brand?.src}}\" alt=\"{{brand?.alt}}\" width=\"{{brand?.width}}\"\r\n height=\"{{brand?.height}}\">\r\n }\r\n {{brand?.label}}\r\n </a>\r\n\r\n @if (items.length || endItems.length || search) {\r\n <button class=\"navbar-toggler ms-auto\" type=\"button\"\r\n data-bs-toggle=\"collapse\" [attr.data-bs-target]=\"'#' + id\" [attr.aria-controls]=\"id\" aria-expanded=\"false\"\r\n aria-label=\"Toggle navigation\">\r\n <span class=\"navbar-toggler-icon\"></span>\r\n </button>\r\n }\r\n\r\n <div class=\"collapse navbar-collapse\" [id]=\"id\">\r\n\r\n @if (items.length) {\r\n <ul class=\"navbar-nav me-auto\" [ngClass]=\"{'mb-2': isSearch}\">\r\n @for (navItem of items; track navItem) {\r\n @if (!isDropdown(navItem)) {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link\" [ngClass]=\"{'disabled': navItem.disabled}\"\r\n (click)=\"navItem.onClick && navItem.onClick($event)\" [attr.aria-disabled]=\"navItem.disabled\"\r\n [routerLink]=\"navItem.routerLink\" [routerLinkActive]=\"['active']\"\r\n ngbTooltip=\"{{navItem.tooltipLabel}}\" aria-current=\"page\">\r\n @if (navItem.iconClass) {\r\n <i class=\"pe-2 {{navItem.iconClass}}\"></i>\r\n }\r\n {{navItem.label}}\r\n </a>\r\n </li>\r\n }\r\n @if (isDropdown(navItem)) {\r\n <li class=\"nav-item dropdown\">\r\n <a class=\"nav-link dropdown-toggle\" [ngClass]=\"{'disabled': navItem.disabled}\"\r\n [attr.aria-disabled]=\"navItem.disabled\" ngbTooltip=\"{{navItem.tooltipLabel}}\"\r\n data-bs-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">\r\n @if (navItem.iconClass) {\r\n <i class=\"pe-2 {{navItem.iconClass}}\"></i>\r\n }\r\n @if (navItem.label) {\r\n <span>{{navItem.label}}</span>\r\n }\r\n </a>\r\n <ul class=\"dropdown-menu px-2\">\r\n @for (navSubItem of navItem.items; track navSubItem) {\r\n <li>\r\n @if (!navSubItem.isDivider) {\r\n <a class=\"dropdown-item rounded\"\r\n (click)=\"navSubItem.onClick && navSubItem.onClick($event)\"\r\n [ngClass]=\"{'disabled': navSubItem.disabled}\"\r\n [attr.aria-disabled]=\"navItem.disabled\" [routerLink]=\"navSubItem.routerLink\"\r\n [routerLinkActive]=\"['active']\" ngbTooltip=\"{{navSubItem.tooltipLabel}}\">\r\n @if (navSubItem.iconClass) {\r\n <i class=\"me-2 {{navSubItem.iconClass}}\"></i>\r\n }\r\n @if (navSubItem.label) {\r\n <span>{{navSubItem.label}}</span>\r\n }\r\n </a>\r\n }\r\n @if (navSubItem.isDivider) {\r\n <hr class=\"dropdown-divider\">\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n }\r\n\r\n @if (endItems.length > 0) {\r\n <ul class=\"navbar-nav flex-row ms-auto nav-end me-2\" [ngClass]=\"{'nav-end-me-0': search}\">\r\n @for (endItem of endItems; track endItem) {\r\n @if (!isDropdown(endItem)) {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link\" [routerLink]=\"endItem.routerLink\" [routerLinkActive]=\"['active']\"\r\n (click)=\"endItem.onClick && endItem.onClick($event)\" role=\"button\"\r\n ngbTooltip=\"{{endItem.tooltipLabel}}\">\r\n @if (endItem.iconClass) {\r\n <i class=\"pe-2 {{endItem.iconClass}}\"></i>\r\n }\r\n @if (endItem.label) {\r\n <span>{{endItem.label}}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n @if (isDropdown(endItem)) {\r\n <li class=\"nav-item dropdown\">\r\n <a class=\"nav-link dropdown-toggle\" ngbTooltip=\"{{endItem.tooltipLabel}}\"\r\n data-bs-toggle=\"dropdown\" data-bs-display=\"static\" aria-expanded=\"false\" role=\"button\"\r\n aria-haspopup=\"true\" aria-expanded=\"false\">\r\n @if (endItem.iconClass) {\r\n <i class=\"pe-2 {{endItem.iconClass}}\"></i>\r\n }\r\n @if (endItem.label) {\r\n <span>{{endItem.label}}</span>\r\n }\r\n </a>\r\n <div class=\"dropdown-menu px-2 dropdown-menu-end\">\r\n @for (endItemSubItem of endItem.items; track endItemSubItem) {\r\n @if (!endItemSubItem.isDivider) {\r\n <a class=\"dropdown-item text-center rounded\"\r\n [routerLink]=\"endItemSubItem.routerLink\" [routerLinkActive]=\"['active']\"\r\n (click)=\"endItemSubItem.onClick && endItemSubItem.onClick($event)\" role=\"button\"\r\n ngbTooltip=\"{{endItemSubItem.tooltipLabel}}\">\r\n @if (endItemSubItem.iconClass) {\r\n <i class=\"me-2 {{endItemSubItem.iconClass}}\"></i>\r\n }\r\n @if (endItemSubItem.label) {\r\n <span>{{endItemSubItem.label}}</span>\r\n }\r\n </a>\r\n }\r\n @if (endItemSubItem.isDivider) {\r\n <div class=\"dropdown-divider\"></div>\r\n }\r\n }\r\n </div>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n }\r\n\r\n @if (isSearch) {\r\n <form class=\"search-form d-flex\" role=\"search\" [ngClass]=\"{'ms-auto': !endItems.length}\"\r\n [formGroup]=\"searchForm\" (submit)=\"submitSearch()\">\r\n <input name=\"searchValue\" id=\"searchValue\" formControlName=\"searchValue\" class=\"form-control me-2\" type=\"search\"\r\n placeholder=\"{{searchPlaceholder}}\" aria-label=\"Search\">\r\n <button name=\"submitBtn\" class=\"btn btn-outline-success\" type=\"submit\">\r\n @if (searchIconClass) {\r\n <i class=\"{{searchIconClass}}\"></i>\r\n }\r\n @if (searchLabel) {\r\n <span>{{searchLabel}}</span>\r\n }\r\n </button>\r\n </form>\r\n }\r\n\r\n <!-- <form *ngIf=\"search\" class=\"d-flex mt-2 mt-md-0\" [ngClass]=\"{'ms-auto': endItems.length <= 0}\"\r\n [formGroup]=\"searchForm\" (submit)=\"submitSearch()\">\r\n <input class=\"form-control me-sm-2\" type=\"search\" placeholder=\"{{searchPlaceholder}}\"\r\n formControlName=\"searchValue\">\r\n <button class=\"btn btn-secondary my-2 my-sm-0\" type=\"submit\">\r\n <i *ngIf=\"searchIconClass\" class=\"{{searchIconClass}}\"></i>\r\n <span *ngIf=\"searchLabel\">{{searchLabel}}</span>\r\n </button>\r\n </form> -->\r\n </div>\r\n </div>\r\n </nav>", styles: [".sidebar-toggler{padding:var(--bs-navbar-toggler-padding-y) var(--bs-navbar-toggler-padding-x);font-size:var(--bs-navbar-toggler-font-size);line-height:1;color:var(--bs-navbar-color);background-color:transparent;border:var(--bs-border-width) solid var(--bs-navbar-toggler-border-color);border-radius:var(--bs-navbar-toggler-border-radius);transition:var(--bs-navbar-toggler-transition)}.sidebar-toggler.toggled .sidebar-toggler-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}@media(prefers-reduced-motion:reduce){.sidebar-toggler{transition:none}}.sidebar-toggler:hover{text-decoration:none}.sidebar-toggler:focus{text-decoration:none;outline:0;box-shadow:0 0 0 var(--bs-navbar-toggler-focus-width)}.sidebar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease}::ng-deep html[dir=rtl] .sidebar-toggler{-webkit-transform:scaleX(-1);transform:scaleX(-1)}::ng-deep html[dir=rtl] .sidebar-toggler.toggled .sidebar-toggler-icon{-webkit-transform:scaleX(1);transform:scaleX(1)}::ng-deep html[dir=rtl] .nav-end .nav-link{padding-left:var(--bs-navbar-nav-link-padding-x);padding-right:0!important}::ng-deep html[dir=rtl] .nav-end.nav-end-me-0{margin-left:0!important}@media(max-width:576px){.navbar-expand-sm .search-form{margin-top:.5rem!important}.navbar-expand-sm .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-sm .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:768px){.navbar-expand-md .search-form{margin-top:.5rem!important}.navbar-expand-md .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-md .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:992px){.navbar-expand-lg .search-form{margin-top:.5rem!important}.navbar-expand-lg .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-lg .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:1200px){.navbar-expand-xlg .search-form{margin-top:.5rem!important}.navbar-expand-xlg .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-xlg .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:1400px){.navbar-expand-xxlg .search-form{margin-top:.5rem!important}.navbar-expand-xxlg .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-xxlg .nav-end.nav-end-me-0{margin-right:0!important}}@media(min-width:576px){.navbar-expand-sm .navbar-nav{margin-bottom:0!important}}@media(min-width:768px){.navbar-expand-md .navbar-nav{margin-bottom:0!important}}@media(min-width:992px){.navbar-expand-lg .navbar-nav{margin-bottom:0!important}}@media(min-width:1200px){.navbar-expand-xlg .navbar-nav{margin-bottom:0!important}}@media(min-width:1400px){.navbar-expand-xxlg .navbar-nav{margin-bottom:0!important}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: NgbTooltipModule }, { kind: "directive", type: i2$1.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "tooltipContext", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] });
|
|
1800
|
+
}
|
|
1801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsNavbarComponent, decorators: [{
|
|
1802
|
+
type: Component,
|
|
1803
|
+
args: [{ selector: 'ys-navbar', imports: [
|
|
1804
|
+
NgClass,
|
|
1805
|
+
RouterLink,
|
|
1806
|
+
RouterLinkActive,
|
|
1807
|
+
ReactiveFormsModule,
|
|
1808
|
+
NgbTooltipModule
|
|
1809
|
+
], template: "<nav class=\"navbar navbar-expand-lg bg-primary\" [ngClass]=\"styleClass\" [attr.data-bs-theme]=\"theme\">\r\n <div class=\"container-fluid\">\r\n\r\n @if (isSidebarToggler) {\r\n <button class=\"sidebar-toggler me-2\" type=\"button\" (click)=\"onToggleSidebar()\"\r\n aria-expanded=\"false\" aria-label=\"Toggle sidebar\" [ngClass]=\"{'toggled': isSidebarToggled}\">\r\n <i class=\"{{sidebarTogglerIconClass}} sidebar-toggler-icon p-1\"></i>\r\n </button>\r\n }\r\n\r\n <a class=\"navbar-brand\" [ngClass]=\"{'me-auto': !items.length}\" href=\"{{brand?.href}}\">\r\n @if (brand?.src) {\r\n <img src=\"{{brand?.src}}\" alt=\"{{brand?.alt}}\" width=\"{{brand?.width}}\"\r\n height=\"{{brand?.height}}\">\r\n }\r\n {{brand?.label}}\r\n </a>\r\n\r\n @if (items.length || endItems.length || search) {\r\n <button class=\"navbar-toggler ms-auto\" type=\"button\"\r\n data-bs-toggle=\"collapse\" [attr.data-bs-target]=\"'#' + id\" [attr.aria-controls]=\"id\" aria-expanded=\"false\"\r\n aria-label=\"Toggle navigation\">\r\n <span class=\"navbar-toggler-icon\"></span>\r\n </button>\r\n }\r\n\r\n <div class=\"collapse navbar-collapse\" [id]=\"id\">\r\n\r\n @if (items.length) {\r\n <ul class=\"navbar-nav me-auto\" [ngClass]=\"{'mb-2': isSearch}\">\r\n @for (navItem of items; track navItem) {\r\n @if (!isDropdown(navItem)) {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link\" [ngClass]=\"{'disabled': navItem.disabled}\"\r\n (click)=\"navItem.onClick && navItem.onClick($event)\" [attr.aria-disabled]=\"navItem.disabled\"\r\n [routerLink]=\"navItem.routerLink\" [routerLinkActive]=\"['active']\"\r\n ngbTooltip=\"{{navItem.tooltipLabel}}\" aria-current=\"page\">\r\n @if (navItem.iconClass) {\r\n <i class=\"pe-2 {{navItem.iconClass}}\"></i>\r\n }\r\n {{navItem.label}}\r\n </a>\r\n </li>\r\n }\r\n @if (isDropdown(navItem)) {\r\n <li class=\"nav-item dropdown\">\r\n <a class=\"nav-link dropdown-toggle\" [ngClass]=\"{'disabled': navItem.disabled}\"\r\n [attr.aria-disabled]=\"navItem.disabled\" ngbTooltip=\"{{navItem.tooltipLabel}}\"\r\n data-bs-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">\r\n @if (navItem.iconClass) {\r\n <i class=\"pe-2 {{navItem.iconClass}}\"></i>\r\n }\r\n @if (navItem.label) {\r\n <span>{{navItem.label}}</span>\r\n }\r\n </a>\r\n <ul class=\"dropdown-menu px-2\">\r\n @for (navSubItem of navItem.items; track navSubItem) {\r\n <li>\r\n @if (!navSubItem.isDivider) {\r\n <a class=\"dropdown-item rounded\"\r\n (click)=\"navSubItem.onClick && navSubItem.onClick($event)\"\r\n [ngClass]=\"{'disabled': navSubItem.disabled}\"\r\n [attr.aria-disabled]=\"navItem.disabled\" [routerLink]=\"navSubItem.routerLink\"\r\n [routerLinkActive]=\"['active']\" ngbTooltip=\"{{navSubItem.tooltipLabel}}\">\r\n @if (navSubItem.iconClass) {\r\n <i class=\"me-2 {{navSubItem.iconClass}}\"></i>\r\n }\r\n @if (navSubItem.label) {\r\n <span>{{navSubItem.label}}</span>\r\n }\r\n </a>\r\n }\r\n @if (navSubItem.isDivider) {\r\n <hr class=\"dropdown-divider\">\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n }\r\n\r\n @if (endItems.length > 0) {\r\n <ul class=\"navbar-nav flex-row ms-auto nav-end me-2\" [ngClass]=\"{'nav-end-me-0': search}\">\r\n @for (endItem of endItems; track endItem) {\r\n @if (!isDropdown(endItem)) {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link\" [routerLink]=\"endItem.routerLink\" [routerLinkActive]=\"['active']\"\r\n (click)=\"endItem.onClick && endItem.onClick($event)\" role=\"button\"\r\n ngbTooltip=\"{{endItem.tooltipLabel}}\">\r\n @if (endItem.iconClass) {\r\n <i class=\"pe-2 {{endItem.iconClass}}\"></i>\r\n }\r\n @if (endItem.label) {\r\n <span>{{endItem.label}}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n @if (isDropdown(endItem)) {\r\n <li class=\"nav-item dropdown\">\r\n <a class=\"nav-link dropdown-toggle\" ngbTooltip=\"{{endItem.tooltipLabel}}\"\r\n data-bs-toggle=\"dropdown\" data-bs-display=\"static\" aria-expanded=\"false\" role=\"button\"\r\n aria-haspopup=\"true\" aria-expanded=\"false\">\r\n @if (endItem.iconClass) {\r\n <i class=\"pe-2 {{endItem.iconClass}}\"></i>\r\n }\r\n @if (endItem.label) {\r\n <span>{{endItem.label}}</span>\r\n }\r\n </a>\r\n <div class=\"dropdown-menu px-2 dropdown-menu-end\">\r\n @for (endItemSubItem of endItem.items; track endItemSubItem) {\r\n @if (!endItemSubItem.isDivider) {\r\n <a class=\"dropdown-item text-center rounded\"\r\n [routerLink]=\"endItemSubItem.routerLink\" [routerLinkActive]=\"['active']\"\r\n (click)=\"endItemSubItem.onClick && endItemSubItem.onClick($event)\" role=\"button\"\r\n ngbTooltip=\"{{endItemSubItem.tooltipLabel}}\">\r\n @if (endItemSubItem.iconClass) {\r\n <i class=\"me-2 {{endItemSubItem.iconClass}}\"></i>\r\n }\r\n @if (endItemSubItem.label) {\r\n <span>{{endItemSubItem.label}}</span>\r\n }\r\n </a>\r\n }\r\n @if (endItemSubItem.isDivider) {\r\n <div class=\"dropdown-divider\"></div>\r\n }\r\n }\r\n </div>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n }\r\n\r\n @if (isSearch) {\r\n <form class=\"search-form d-flex\" role=\"search\" [ngClass]=\"{'ms-auto': !endItems.length}\"\r\n [formGroup]=\"searchForm\" (submit)=\"submitSearch()\">\r\n <input name=\"searchValue\" id=\"searchValue\" formControlName=\"searchValue\" class=\"form-control me-2\" type=\"search\"\r\n placeholder=\"{{searchPlaceholder}}\" aria-label=\"Search\">\r\n <button name=\"submitBtn\" class=\"btn btn-outline-success\" type=\"submit\">\r\n @if (searchIconClass) {\r\n <i class=\"{{searchIconClass}}\"></i>\r\n }\r\n @if (searchLabel) {\r\n <span>{{searchLabel}}</span>\r\n }\r\n </button>\r\n </form>\r\n }\r\n\r\n <!-- <form *ngIf=\"search\" class=\"d-flex mt-2 mt-md-0\" [ngClass]=\"{'ms-auto': endItems.length <= 0}\"\r\n [formGroup]=\"searchForm\" (submit)=\"submitSearch()\">\r\n <input class=\"form-control me-sm-2\" type=\"search\" placeholder=\"{{searchPlaceholder}}\"\r\n formControlName=\"searchValue\">\r\n <button class=\"btn btn-secondary my-2 my-sm-0\" type=\"submit\">\r\n <i *ngIf=\"searchIconClass\" class=\"{{searchIconClass}}\"></i>\r\n <span *ngIf=\"searchLabel\">{{searchLabel}}</span>\r\n </button>\r\n </form> -->\r\n </div>\r\n </div>\r\n </nav>", styles: [".sidebar-toggler{padding:var(--bs-navbar-toggler-padding-y) var(--bs-navbar-toggler-padding-x);font-size:var(--bs-navbar-toggler-font-size);line-height:1;color:var(--bs-navbar-color);background-color:transparent;border:var(--bs-border-width) solid var(--bs-navbar-toggler-border-color);border-radius:var(--bs-navbar-toggler-border-radius);transition:var(--bs-navbar-toggler-transition)}.sidebar-toggler.toggled .sidebar-toggler-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}@media(prefers-reduced-motion:reduce){.sidebar-toggler{transition:none}}.sidebar-toggler:hover{text-decoration:none}.sidebar-toggler:focus{text-decoration:none;outline:0;box-shadow:0 0 0 var(--bs-navbar-toggler-focus-width)}.sidebar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease}::ng-deep html[dir=rtl] .sidebar-toggler{-webkit-transform:scaleX(-1);transform:scaleX(-1)}::ng-deep html[dir=rtl] .sidebar-toggler.toggled .sidebar-toggler-icon{-webkit-transform:scaleX(1);transform:scaleX(1)}::ng-deep html[dir=rtl] .nav-end .nav-link{padding-left:var(--bs-navbar-nav-link-padding-x);padding-right:0!important}::ng-deep html[dir=rtl] .nav-end.nav-end-me-0{margin-left:0!important}@media(max-width:576px){.navbar-expand-sm .search-form{margin-top:.5rem!important}.navbar-expand-sm .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-sm .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:768px){.navbar-expand-md .search-form{margin-top:.5rem!important}.navbar-expand-md .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-md .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:992px){.navbar-expand-lg .search-form{margin-top:.5rem!important}.navbar-expand-lg .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-lg .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:1200px){.navbar-expand-xlg .search-form{margin-top:.5rem!important}.navbar-expand-xlg .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-xlg .nav-end.nav-end-me-0{margin-right:0!important}}@media(max-width:1400px){.navbar-expand-xxlg .search-form{margin-top:.5rem!important}.navbar-expand-xxlg .nav-end .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-xxlg .nav-end.nav-end-me-0{margin-right:0!important}}@media(min-width:576px){.navbar-expand-sm .navbar-nav{margin-bottom:0!important}}@media(min-width:768px){.navbar-expand-md .navbar-nav{margin-bottom:0!important}}@media(min-width:992px){.navbar-expand-lg .navbar-nav{margin-bottom:0!important}}@media(min-width:1200px){.navbar-expand-xlg .navbar-nav{margin-bottom:0!important}}@media(min-width:1400px){.navbar-expand-xxlg .navbar-nav{margin-bottom:0!important}}\n"] }]
|
|
1810
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { id: [{
|
|
1811
|
+
type: Input
|
|
1812
|
+
}], theme: [{
|
|
1813
|
+
type: Input
|
|
1814
|
+
}], styleClass: [{
|
|
1815
|
+
type: Input
|
|
1816
|
+
}], brand: [{
|
|
1817
|
+
type: Input
|
|
1818
|
+
}], items: [{
|
|
1819
|
+
type: Input
|
|
1820
|
+
}], endItems: [{
|
|
1821
|
+
type: Input
|
|
1822
|
+
}], isSearch: [{
|
|
1823
|
+
type: Input
|
|
1824
|
+
}], searchLabel: [{
|
|
1825
|
+
type: Input
|
|
1826
|
+
}], searchIconClass: [{
|
|
1827
|
+
type: Input
|
|
1828
|
+
}], searchPlaceholder: [{
|
|
1829
|
+
type: Input
|
|
1830
|
+
}], isSidebarToggler: [{
|
|
1831
|
+
type: Input
|
|
1832
|
+
}], isSidebarToggled: [{
|
|
1833
|
+
type: Input
|
|
1834
|
+
}], sidebarTogglerIconClass: [{
|
|
1835
|
+
type: Input
|
|
1836
|
+
}], toggleSidebar: [{
|
|
1837
|
+
type: Output
|
|
1838
|
+
}], search: [{
|
|
1839
|
+
type: Output
|
|
1840
|
+
}] } });
|
|
1841
|
+
|
|
1842
|
+
/*
|
|
1843
|
+
* Public API Surface of ys-navbar
|
|
1844
|
+
*/
|
|
1845
|
+
|
|
1846
|
+
class YsOverlayComponent {
|
|
1847
|
+
show = false;
|
|
1848
|
+
onClick = new EventEmitter();
|
|
1849
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1850
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: YsOverlayComponent, isStandalone: true, selector: "ys-overlay", inputs: { show: "show" }, outputs: { onClick: "onClick" }, ngImport: i0, template: "<div class=\"overlay bg-dark\" (click)=\"onClick.emit($event)\" [ngClass]=\"{'show': show}\"></div>", styles: ["@-webkit-keyframes fadeIn-overlay{0%{opacity:0}to{opacity:.5}}@keyframes fadeIn-overlay{0%{opacity:0}to{opacity:.5}}.overlay{position:fixed;inset:0;z-index:100;opacity:.5;display:none;-webkit-animation:fadeIn-overlay .5s;animation:fadeIn-overlay .5s}.overlay.show{display:block}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1851
|
+
}
|
|
1852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsOverlayComponent, decorators: [{
|
|
1853
|
+
type: Component,
|
|
1854
|
+
args: [{ selector: 'ys-overlay', imports: [NgClass], template: "<div class=\"overlay bg-dark\" (click)=\"onClick.emit($event)\" [ngClass]=\"{'show': show}\"></div>", styles: ["@-webkit-keyframes fadeIn-overlay{0%{opacity:0}to{opacity:.5}}@keyframes fadeIn-overlay{0%{opacity:0}to{opacity:.5}}.overlay{position:fixed;inset:0;z-index:100;opacity:.5;display:none;-webkit-animation:fadeIn-overlay .5s;animation:fadeIn-overlay .5s}.overlay.show{display:block}\n"] }]
|
|
1855
|
+
}], propDecorators: { show: [{
|
|
1856
|
+
type: Input
|
|
1857
|
+
}], onClick: [{
|
|
1858
|
+
type: Output
|
|
1859
|
+
}] } });
|
|
1860
|
+
|
|
1861
|
+
/*
|
|
1862
|
+
* Public API Surface of ys-overlay
|
|
1863
|
+
*/
|
|
1864
|
+
|
|
1865
|
+
class YsPaginationComponent {
|
|
1866
|
+
rowsPerPage = [10, 25, 50];
|
|
1867
|
+
pageReport = true;
|
|
1868
|
+
pageReportTemplate = 'Showing {first} to {last} of {totalRecords} items';
|
|
1869
|
+
ellipses = false;
|
|
1870
|
+
boundaryLinks = true;
|
|
1871
|
+
maxSize = 5;
|
|
1872
|
+
rotate = true;
|
|
1873
|
+
page = 1;
|
|
1874
|
+
pageSizeSelection = true;
|
|
1875
|
+
pageSize = this.rowsPerPage[0] || 10;
|
|
1876
|
+
collectionSize = 0;
|
|
1877
|
+
pageChange = new EventEmitter();
|
|
1878
|
+
get firstIndex() { return (this.page - 1) * this.pageSize; }
|
|
1879
|
+
get lastIndex() { return Math.min(this.firstIndex + this.pageSize, this.collectionSize); }
|
|
1880
|
+
get totalPages() {
|
|
1881
|
+
return Math.ceil(this.collectionSize / this.pageSize) || 1;
|
|
1882
|
+
}
|
|
1883
|
+
changePage(page) {
|
|
1884
|
+
if (page >= 1 && page <= this.totalPages) {
|
|
1885
|
+
this.page = page;
|
|
1886
|
+
this.pageChange.emit({ page: this.page, pageSize: this.pageSize });
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
changePageSize(size) {
|
|
1890
|
+
this.pageSize = +size;
|
|
1891
|
+
this.page = 1;
|
|
1892
|
+
this.pageChange.emit({ page: this.page, pageSize: this.pageSize });
|
|
1893
|
+
}
|
|
1894
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1895
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", 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"] }] });
|
|
1896
|
+
}
|
|
1897
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPaginationComponent, decorators: [{
|
|
1898
|
+
type: Component,
|
|
1899
|
+
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"] }]
|
|
1900
|
+
}], propDecorators: { rowsPerPage: [{
|
|
1901
|
+
type: Input
|
|
1902
|
+
}], pageReport: [{
|
|
1903
|
+
type: Input
|
|
1904
|
+
}], pageReportTemplate: [{
|
|
1905
|
+
type: Input
|
|
1906
|
+
}], ellipses: [{
|
|
1907
|
+
type: Input
|
|
1908
|
+
}], boundaryLinks: [{
|
|
1909
|
+
type: Input
|
|
1910
|
+
}], maxSize: [{
|
|
1911
|
+
type: Input
|
|
1912
|
+
}], rotate: [{
|
|
1913
|
+
type: Input
|
|
1914
|
+
}], page: [{
|
|
1915
|
+
type: Input
|
|
1916
|
+
}], pageSizeSelection: [{
|
|
1917
|
+
type: Input
|
|
1918
|
+
}], pageSize: [{
|
|
1919
|
+
type: Input
|
|
1920
|
+
}], collectionSize: [{
|
|
1921
|
+
type: Input
|
|
1922
|
+
}], pageChange: [{
|
|
1923
|
+
type: Output
|
|
1924
|
+
}] } });
|
|
1925
|
+
|
|
1926
|
+
/*
|
|
1927
|
+
* Public API Surface of ys-pagination
|
|
1928
|
+
*/
|
|
1929
|
+
|
|
1930
|
+
const StrongPasswordRegx = /^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=\D*\d)(?=.*[!@#$%^&*]).{8,}$/;
|
|
1931
|
+
const UppercaseRegx = /^.*[A-Z]/;
|
|
1932
|
+
const LowercaseRegx = /^.*[a-z]/;
|
|
1933
|
+
const DigitRegx = /^.*[0-9].*/;
|
|
1934
|
+
const NonAlphanumericRegx = /^.*[!@#$%^&*]/;
|
|
1935
|
+
// export const MinLength8Regx: RegExp = /^.{8,}/;
|
|
1936
|
+
|
|
1937
|
+
class StrengthValidationFeedback {
|
|
1938
|
+
required;
|
|
1939
|
+
uppercase;
|
|
1940
|
+
lowercase;
|
|
1941
|
+
digit;
|
|
1942
|
+
nonAlphanumeric;
|
|
1943
|
+
minLength;
|
|
1944
|
+
constructor(options) {
|
|
1945
|
+
this.required = options?.required == undefined ? 'Please enter a valid password.' : options?.required;
|
|
1946
|
+
this.uppercase = options?.uppercase == undefined ? 'At least one uppercase letter.' : options?.uppercase;
|
|
1947
|
+
this.lowercase = options?.lowercase == undefined ? 'At least one lowercase letter.' : options?.lowercase;
|
|
1948
|
+
this.digit = options?.digit == undefined ? 'At least one digit.' : options?.digit;
|
|
1949
|
+
this.nonAlphanumeric = options?.nonAlphanumeric == undefined ? 'At least one special character (e.g., !, @, #, $).' : options?.nonAlphanumeric;
|
|
1950
|
+
this.minLength = options?.minLength == undefined ? 'At least 8 characters long.' : options?.minLength;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
class StrengthValidationOption {
|
|
1955
|
+
requireUppercase;
|
|
1956
|
+
requireLowercase;
|
|
1957
|
+
requireDigit;
|
|
1958
|
+
requireNonAlphanumeric;
|
|
1959
|
+
requiredMinLength;
|
|
1960
|
+
constructor(options) {
|
|
1961
|
+
this.requireUppercase = options?.requireUppercase == undefined ? true : options?.requireUppercase;
|
|
1962
|
+
this.requireLowercase = options?.requireLowercase == undefined ? true : options?.requireLowercase;
|
|
1963
|
+
this.requireDigit = options?.requireDigit == undefined ? true : options?.requireDigit;
|
|
1964
|
+
this.requireNonAlphanumeric = options?.requireNonAlphanumeric == undefined ? true : options?.requireNonAlphanumeric;
|
|
1965
|
+
this.requiredMinLength = options?.requiredMinLength == undefined ? 8 : options?.requiredMinLength;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
class YsPasswordStrengthComponent {
|
|
1970
|
+
passwordHelp = null;
|
|
1971
|
+
displayFeedback = true;
|
|
1972
|
+
feedback = new StrengthValidationFeedback();
|
|
1973
|
+
minLengthRegx = new RegExp('');
|
|
1974
|
+
_control;
|
|
1975
|
+
get control() { return this._control; }
|
|
1976
|
+
set control(value) {
|
|
1977
|
+
this._control = value;
|
|
1978
|
+
if (!this._control) {
|
|
1979
|
+
return;
|
|
1980
|
+
}
|
|
1981
|
+
if (!this._control.options) {
|
|
1982
|
+
this._control.options = new StrengthValidationOption();
|
|
1983
|
+
}
|
|
1984
|
+
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},}$`);
|
|
1985
|
+
this.minLengthRegx = new RegExp(`.{${this._control.options.requiredMinLength},}$`);
|
|
1986
|
+
this._control.formControl?.addValidators([Validators.required, Validators.pattern(strongPasswordRegx)]);
|
|
1987
|
+
this._control.formControl?.updateValueAndValidity();
|
|
1988
|
+
}
|
|
1989
|
+
get requiredOptionsLength() { return Object.values(this.control?.options).filter(x => x).length; }
|
|
1990
|
+
get hasUppercase() { return this.control?.formControl?.value && UppercaseRegx.test(this.control?.formControl?.value); }
|
|
1991
|
+
get hasLowercase() { return this.control?.formControl?.value && LowercaseRegx.test(this.control?.formControl?.value); }
|
|
1992
|
+
get hasDigit() { return this.control?.formControl?.value && DigitRegx.test(this.control?.formControl?.value); }
|
|
1993
|
+
get hasNonAlphanumeric() { return this.control?.formControl?.value && NonAlphanumericRegx.test(this.control?.formControl?.value); }
|
|
1994
|
+
get hasMinLength() { return this.control?.formControl?.value && this.minLengthRegx.test(this.control?.formControl?.value); }
|
|
1995
|
+
get strengthMeter() {
|
|
1996
|
+
let strength = -1;
|
|
1997
|
+
if (this.control?.options?.requireUppercase && this.hasUppercase)
|
|
1998
|
+
strength += 1;
|
|
1999
|
+
if (this.control?.options?.requireLowercase && this.hasLowercase)
|
|
2000
|
+
strength += 1;
|
|
2001
|
+
if (this.control?.options?.requireDigit && this.hasDigit)
|
|
2002
|
+
strength += 1;
|
|
2003
|
+
if (this.control?.options?.requireNonAlphanumeric && this.hasNonAlphanumeric)
|
|
2004
|
+
strength += 1;
|
|
2005
|
+
if (this.control?.options?.requiredMinLength && this.hasMinLength)
|
|
2006
|
+
strength += 1;
|
|
2007
|
+
return strength + (5 - this.requiredOptionsLength);
|
|
2008
|
+
}
|
|
2009
|
+
get strengthStyleClass() {
|
|
2010
|
+
return this.strengthMeter == 4 ? "green" :
|
|
2011
|
+
this.strengthMeter == 3 ? "yellow" :
|
|
2012
|
+
this.strengthMeter == 2 ? "orange" :
|
|
2013
|
+
this.strengthMeter == 1 ? "red" :
|
|
2014
|
+
this.strengthMeter == 0 ? "pink" :
|
|
2015
|
+
'';
|
|
2016
|
+
}
|
|
2017
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPasswordStrengthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2018
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", 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"] }] });
|
|
2019
|
+
}
|
|
2020
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPasswordStrengthComponent, decorators: [{
|
|
2021
|
+
type: Component,
|
|
2022
|
+
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"] }]
|
|
2023
|
+
}], propDecorators: { passwordHelp: [{
|
|
2024
|
+
type: Input
|
|
2025
|
+
}], displayFeedback: [{
|
|
2026
|
+
type: Input
|
|
2027
|
+
}], feedback: [{
|
|
2028
|
+
type: Input
|
|
2029
|
+
}], control: [{
|
|
2030
|
+
type: Input
|
|
2031
|
+
}] } });
|
|
2032
|
+
|
|
2033
|
+
class YsPasswordStrengthDirective {
|
|
2034
|
+
el;
|
|
2035
|
+
viewContainerRef;
|
|
2036
|
+
injector;
|
|
2037
|
+
control;
|
|
2038
|
+
passwordHelp = null;
|
|
2039
|
+
displayFeedback = true;
|
|
2040
|
+
feedback = new StrengthValidationFeedback();
|
|
2041
|
+
options;
|
|
2042
|
+
constructor(el, viewContainerRef, injector, control) {
|
|
2043
|
+
this.el = el;
|
|
2044
|
+
this.viewContainerRef = viewContainerRef;
|
|
2045
|
+
this.injector = injector;
|
|
2046
|
+
this.control = control;
|
|
2047
|
+
}
|
|
2048
|
+
ngOnInit() {
|
|
2049
|
+
const element = this.el.nativeElement;
|
|
2050
|
+
const elementParent = element.parentElement;
|
|
2051
|
+
const formControl = this.control.control;
|
|
2052
|
+
const passwordStrengthComponent = this.viewContainerRef.createComponent(YsPasswordStrengthComponent, { injector: this.injector });
|
|
2053
|
+
elementParent.insertBefore(passwordStrengthComponent.location.nativeElement, element.nextSibling);
|
|
2054
|
+
const passwordStrength = passwordStrengthComponent.instance;
|
|
2055
|
+
passwordStrength.passwordHelp = this.passwordHelp;
|
|
2056
|
+
passwordStrength.displayFeedback = this.displayFeedback;
|
|
2057
|
+
passwordStrength.feedback = this.feedback;
|
|
2058
|
+
passwordStrength.control = { formControl: formControl, options: this.options };
|
|
2059
|
+
}
|
|
2060
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPasswordStrengthDirective, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.Injector }, { token: i1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2061
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: YsPasswordStrengthDirective, isStandalone: true, selector: "[ysPasswordStrength]", inputs: { passwordHelp: "passwordHelp", displayFeedback: "displayFeedback", feedback: "feedback", options: "options" }, ngImport: i0 });
|
|
2062
|
+
}
|
|
2063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsPasswordStrengthDirective, decorators: [{
|
|
2064
|
+
type: Directive,
|
|
2065
|
+
args: [{
|
|
2066
|
+
selector: '[ysPasswordStrength]'
|
|
2067
|
+
}]
|
|
2068
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.Injector }, { type: i1.NgControl }], propDecorators: { passwordHelp: [{
|
|
2069
|
+
type: Input
|
|
2070
|
+
}], displayFeedback: [{
|
|
2071
|
+
type: Input
|
|
2072
|
+
}], feedback: [{
|
|
2073
|
+
type: Input
|
|
2074
|
+
}], options: [{
|
|
2075
|
+
type: Input
|
|
2076
|
+
}] } });
|
|
2077
|
+
|
|
2078
|
+
/*
|
|
2079
|
+
* Public API Surface of ys-password-strength
|
|
2080
|
+
*/
|
|
2081
|
+
|
|
2082
|
+
class ProgressService {
|
|
2083
|
+
_loading$ = new BehaviorSubject(false);
|
|
2084
|
+
get loading$() { return this._loading$.asObservable(); }
|
|
2085
|
+
setLoading(loading) {
|
|
2086
|
+
this._loading$.next(loading);
|
|
2087
|
+
}
|
|
2088
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ProgressService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2089
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ProgressService });
|
|
2090
|
+
}
|
|
2091
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ProgressService, decorators: [{
|
|
2092
|
+
type: Injectable
|
|
2093
|
+
}] });
|
|
2094
|
+
|
|
2095
|
+
class YsProgressComponent {
|
|
2096
|
+
progressService;
|
|
2097
|
+
loading$;
|
|
2098
|
+
/**
|
|
2099
|
+
* Set reverse animation direction.
|
|
2100
|
+
*/
|
|
2101
|
+
reverse = false;
|
|
2102
|
+
styleClass = null;
|
|
2103
|
+
height = 3;
|
|
2104
|
+
label = null;
|
|
2105
|
+
constructor(progressService) {
|
|
2106
|
+
this.progressService = progressService;
|
|
2107
|
+
this.loading$ = progressService.loading$;
|
|
2108
|
+
}
|
|
2109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsProgressComponent, deps: [{ token: ProgressService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: YsProgressComponent, isStandalone: true, selector: "ys-progress", inputs: { reverse: "reverse", styleClass: "styleClass", height: "height", label: "label" }, ngImport: i0, template: "<div class=\"progress\" role=\"progressbar\" [style]=\"'height: '+ height +'px'\">\r\n <div class=\"progress-bar {{styleClass}}\"\r\n [ngClass]=\"{'indeterminate': (loading$ | async), 'direction-reverse': reverse}\">\r\n {{(loading$ | async) && label ? label : ''}}\r\n </div>\r\n</div>", styles: ["@keyframes progress-indeterminate{0%{left:-25%;width:25%}to{left:100%;width:25%}}@keyframes progress-indeterminate-rtl{0%{left:-100%;width:25%}to{left:25%;width:25%}}.progress .progress-bar.indeterminate{position:relative}.progress .direction-reverse{animation-direction:reverse!important}::ng-deep html[dir=rtl] .progress .progress-bar.indeterminate{animation:progress-indeterminate-rtl 3s linear infinite}::ng-deep html[dir=ltr] .progress .progress-bar.indeterminate,::ng-deep html :not(dir) .progress .progress-bar.indeterminate{animation:progress-indeterminate 3s linear infinite}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] });
|
|
2111
|
+
}
|
|
2112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsProgressComponent, decorators: [{
|
|
2113
|
+
type: Component,
|
|
2114
|
+
args: [{ selector: 'ys-progress', imports: [NgClass, AsyncPipe], template: "<div class=\"progress\" role=\"progressbar\" [style]=\"'height: '+ height +'px'\">\r\n <div class=\"progress-bar {{styleClass}}\"\r\n [ngClass]=\"{'indeterminate': (loading$ | async), 'direction-reverse': reverse}\">\r\n {{(loading$ | async) && label ? label : ''}}\r\n </div>\r\n</div>", styles: ["@keyframes progress-indeterminate{0%{left:-25%;width:25%}to{left:100%;width:25%}}@keyframes progress-indeterminate-rtl{0%{left:-100%;width:25%}to{left:25%;width:25%}}.progress .progress-bar.indeterminate{position:relative}.progress .direction-reverse{animation-direction:reverse!important}::ng-deep html[dir=rtl] .progress .progress-bar.indeterminate{animation:progress-indeterminate-rtl 3s linear infinite}::ng-deep html[dir=ltr] .progress .progress-bar.indeterminate,::ng-deep html :not(dir) .progress .progress-bar.indeterminate{animation:progress-indeterminate 3s linear infinite}\n"] }]
|
|
2115
|
+
}], ctorParameters: () => [{ type: ProgressService }], propDecorators: { reverse: [{
|
|
2116
|
+
type: Input
|
|
2117
|
+
}], styleClass: [{
|
|
2118
|
+
type: Input
|
|
2119
|
+
}], height: [{
|
|
2120
|
+
type: Input
|
|
2121
|
+
}], label: [{
|
|
2122
|
+
type: Input
|
|
2123
|
+
}] } });
|
|
2124
|
+
|
|
2125
|
+
/*
|
|
2126
|
+
* Public API Surface of ys-progress
|
|
2127
|
+
*/
|
|
2128
|
+
|
|
2129
|
+
class YsSelectComponent {
|
|
2130
|
+
/**ُSelect element id */
|
|
2131
|
+
id = 'ys-select';
|
|
2132
|
+
options = [];
|
|
2133
|
+
/**Name of field to display in option title */
|
|
2134
|
+
optionLabel = 'label';
|
|
2135
|
+
placeholder;
|
|
2136
|
+
styleClass;
|
|
2137
|
+
invalid = false;
|
|
2138
|
+
invalidFeedback;
|
|
2139
|
+
valid = false;
|
|
2140
|
+
validFeedback;
|
|
2141
|
+
/**Support multiple attribute */
|
|
2142
|
+
multiple = false;
|
|
2143
|
+
/**Size of multiple attribute */
|
|
2144
|
+
size;
|
|
2145
|
+
/**Display clear button */
|
|
2146
|
+
showClear = false;
|
|
2147
|
+
disabled = false;
|
|
2148
|
+
selected = new EventEmitter();
|
|
2149
|
+
onChange = () => { };
|
|
2150
|
+
onTouched = () => { };
|
|
2151
|
+
value;
|
|
2152
|
+
writeValue(obj) {
|
|
2153
|
+
if (!this.multiple && this.placeholder && !obj) {
|
|
2154
|
+
this.value = null;
|
|
2155
|
+
this.onChange(this.value);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
if (this.multiple && !obj) {
|
|
2159
|
+
this.multiple ? this.value = [] : this.value = null;
|
|
2160
|
+
this.onChange(this.value);
|
|
2161
|
+
return;
|
|
2162
|
+
}
|
|
2163
|
+
if (!this.multiple && obj && Array.isArray(obj)) {
|
|
2164
|
+
if (obj.length) {
|
|
2165
|
+
this.value = obj[0];
|
|
2166
|
+
}
|
|
2167
|
+
else {
|
|
2168
|
+
this.value = null;
|
|
2169
|
+
}
|
|
2170
|
+
this.onChange(this.value);
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
this.value = obj;
|
|
2174
|
+
}
|
|
2175
|
+
registerOnChange(fn) {
|
|
2176
|
+
this.onChange = fn;
|
|
2177
|
+
}
|
|
2178
|
+
registerOnTouched(fn) {
|
|
2179
|
+
this.onTouched = fn;
|
|
2180
|
+
}
|
|
2181
|
+
setDisabledState(isDisabled) {
|
|
2182
|
+
this.disabled = isDisabled;
|
|
2183
|
+
}
|
|
2184
|
+
onModelChange(option) {
|
|
2185
|
+
this.onChange(option);
|
|
2186
|
+
this.onTouched(option);
|
|
2187
|
+
this.selected.emit(option);
|
|
2188
|
+
}
|
|
2189
|
+
clearValue() {
|
|
2190
|
+
this.multiple ? this.value = [] : this.value = null;
|
|
2191
|
+
this.onModelChange(this.value);
|
|
2192
|
+
}
|
|
2193
|
+
isObject(item) {
|
|
2194
|
+
return typeof item == 'object';
|
|
2195
|
+
}
|
|
2196
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2197
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsSelectComponent, isStandalone: true, selector: "ys-select", inputs: { id: "id", options: "options", optionLabel: "optionLabel", placeholder: "placeholder", styleClass: "styleClass", invalid: "invalid", invalidFeedback: "invalidFeedback", valid: "valid", validFeedback: "validFeedback", multiple: "multiple", size: "size", showClear: "showClear", disabled: "disabled" }, outputs: { selected: "selected" }, providers: [
|
|
2198
|
+
{
|
|
2199
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2200
|
+
useExisting: forwardRef(() => YsSelectComponent),
|
|
2201
|
+
multi: true
|
|
2202
|
+
}
|
|
2203
|
+
], ngImport: i0, template: "<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear, 'is-valid': valid, 'is-invalid': invalid}\">\r\n\r\n @if (!multiple) {\r\n <select [id]=\"id\" class=\"form-select {{styleClass}}\" [ngClass]=\"{'is-valid': valid, 'is-invalid': invalid}\"\r\n aria-label=\"Select option\" [(ngModel)]=\"value\" (ngModelChange)=\"onModelChange($event)\" [disabled]=\"disabled\">\r\n @if (placeholder) {\r\n <option selected disabled [ngValue]=\"null\" class=\"d-none\"> {{placeholder}}\r\n </option>\r\n }\r\n @for (item of options; track $index; let i = $index) {\r\n <option [selected]=\" i === 0 && !placeholder \" [ngValue]=\"item\">\r\n {{isObject(item) ? item[optionLabel] : item}}\r\n </option>\r\n }\r\n </select>\r\n }\r\n\r\n @if (multiple) {\r\n <select [id]=\"id\" class=\"form-select {{styleClass}}\" [ngClass]=\"{'is-valid': valid, 'is-invalid': invalid}\"\r\n aria-label=\"Select option\" [(ngModel)]=\"value\" (ngModelChange)=\"onModelChange($event)\" [disabled]=\"disabled\"\r\n [multiple]=\"multiple\" [size]=\"size\">\r\n @if (placeholder) {\r\n <option selected disabled [ngValue]=\"null\"> {{placeholder}}\r\n </option>\r\n }\r\n @for (item of options; track $index; let i = $index) {\r\n <option [selected]=\" i === 0 && !placeholder \" [ngValue]=\"item\">\r\n {{isObject(item) ? item[optionLabel] : item}}\r\n </option>\r\n }\r\n </select>\r\n }\r\n\r\n @if (showClear) {\r\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\r\n [disabled]=\"disabled\">\r\n <span class=\"fa fa-times\"></span>\r\n </button>\r\n }\r\n</div>\r\n\r\n@if(valid && validFeedback){\r\n<div class=\"valid-feedback\">{{validFeedback}}</div>\r\n}\r\n@if(invalid && invalidFeedback){\r\n<div class=\"invalid-feedback\">{{invalidFeedback}}</div>\r\n}", 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])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
2204
|
+
}
|
|
2205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsSelectComponent, decorators: [{
|
|
2206
|
+
type: Component,
|
|
2207
|
+
args: [{ selector: 'ys-select', imports: [FormsModule, NgClass], providers: [
|
|
2208
|
+
{
|
|
2209
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2210
|
+
useExisting: forwardRef(() => YsSelectComponent),
|
|
2211
|
+
multi: true
|
|
2212
|
+
}
|
|
2213
|
+
], template: "<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear, 'is-valid': valid, 'is-invalid': invalid}\">\r\n\r\n @if (!multiple) {\r\n <select [id]=\"id\" class=\"form-select {{styleClass}}\" [ngClass]=\"{'is-valid': valid, 'is-invalid': invalid}\"\r\n aria-label=\"Select option\" [(ngModel)]=\"value\" (ngModelChange)=\"onModelChange($event)\" [disabled]=\"disabled\">\r\n @if (placeholder) {\r\n <option selected disabled [ngValue]=\"null\" class=\"d-none\"> {{placeholder}}\r\n </option>\r\n }\r\n @for (item of options; track $index; let i = $index) {\r\n <option [selected]=\" i === 0 && !placeholder \" [ngValue]=\"item\">\r\n {{isObject(item) ? item[optionLabel] : item}}\r\n </option>\r\n }\r\n </select>\r\n }\r\n\r\n @if (multiple) {\r\n <select [id]=\"id\" class=\"form-select {{styleClass}}\" [ngClass]=\"{'is-valid': valid, 'is-invalid': invalid}\"\r\n aria-label=\"Select option\" [(ngModel)]=\"value\" (ngModelChange)=\"onModelChange($event)\" [disabled]=\"disabled\"\r\n [multiple]=\"multiple\" [size]=\"size\">\r\n @if (placeholder) {\r\n <option selected disabled [ngValue]=\"null\"> {{placeholder}}\r\n </option>\r\n }\r\n @for (item of options; track $index; let i = $index) {\r\n <option [selected]=\" i === 0 && !placeholder \" [ngValue]=\"item\">\r\n {{isObject(item) ? item[optionLabel] : item}}\r\n </option>\r\n }\r\n </select>\r\n }\r\n\r\n @if (showClear) {\r\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\r\n [disabled]=\"disabled\">\r\n <span class=\"fa fa-times\"></span>\r\n </button>\r\n }\r\n</div>\r\n\r\n@if(valid && validFeedback){\r\n<div class=\"valid-feedback\">{{validFeedback}}</div>\r\n}\r\n@if(invalid && invalidFeedback){\r\n<div class=\"invalid-feedback\">{{invalidFeedback}}</div>\r\n}" }]
|
|
2214
|
+
}], propDecorators: { id: [{
|
|
2215
|
+
type: Input
|
|
2216
|
+
}], options: [{
|
|
2217
|
+
type: Input
|
|
2218
|
+
}], optionLabel: [{
|
|
2219
|
+
type: Input
|
|
2220
|
+
}], placeholder: [{
|
|
2221
|
+
type: Input
|
|
2222
|
+
}], styleClass: [{
|
|
2223
|
+
type: Input
|
|
2224
|
+
}], invalid: [{
|
|
2225
|
+
type: Input
|
|
2226
|
+
}], invalidFeedback: [{
|
|
2227
|
+
type: Input
|
|
2228
|
+
}], valid: [{
|
|
2229
|
+
type: Input
|
|
2230
|
+
}], validFeedback: [{
|
|
2231
|
+
type: Input
|
|
2232
|
+
}], multiple: [{
|
|
2233
|
+
type: Input
|
|
2234
|
+
}], size: [{
|
|
2235
|
+
type: Input
|
|
2236
|
+
}], showClear: [{
|
|
2237
|
+
type: Input
|
|
2238
|
+
}], disabled: [{
|
|
2239
|
+
type: Input
|
|
2240
|
+
}], selected: [{
|
|
2241
|
+
type: Output
|
|
2242
|
+
}] } });
|
|
2243
|
+
|
|
2244
|
+
/*
|
|
2245
|
+
* Public API Surface of ys-select
|
|
2246
|
+
*/
|
|
2247
|
+
|
|
2248
|
+
class SidebarService {
|
|
2249
|
+
constructor() { }
|
|
2250
|
+
_isSidebarToggled$ = new BehaviorSubject(true);
|
|
2251
|
+
_isSidebar$ = new BehaviorSubject(false);
|
|
2252
|
+
/**
|
|
2253
|
+
* Sidebar toggled state. Default value is true.
|
|
2254
|
+
*/
|
|
2255
|
+
get isSidebarToggled$() { return this._isSidebarToggled$.asObservable(); }
|
|
2256
|
+
/**
|
|
2257
|
+
* Sidebar display state. Default value is false.
|
|
2258
|
+
*/
|
|
2259
|
+
get isSidebar$() { return this._isSidebar$.asObservable(); }
|
|
2260
|
+
/**
|
|
2261
|
+
* Change sidebar toggle state.
|
|
2262
|
+
*/
|
|
2263
|
+
toggleSidebar() {
|
|
2264
|
+
this._isSidebarToggled$.next(!this._isSidebarToggled$.value);
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Set sidebar toggle state.
|
|
2268
|
+
* @param isToggled
|
|
2269
|
+
*/
|
|
2270
|
+
setIsSidebarToggled(isToggled) {
|
|
2271
|
+
this._isSidebarToggled$.next(isToggled);
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Set sidebar toggle state.
|
|
2275
|
+
* @param isSidebar
|
|
2276
|
+
*/
|
|
2277
|
+
setIsSidebar(isSidebar) {
|
|
2278
|
+
this._isSidebar$.next(isSidebar);
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* Return sidebar toggle state.
|
|
2282
|
+
*/
|
|
2283
|
+
get sidebarState() {
|
|
2284
|
+
return this._isSidebarToggled$.getValue();
|
|
2285
|
+
}
|
|
2286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SidebarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2287
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SidebarService, providedIn: 'root' });
|
|
2288
|
+
}
|
|
2289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SidebarService, decorators: [{
|
|
2290
|
+
type: Injectable,
|
|
2291
|
+
args: [{
|
|
2292
|
+
providedIn: 'root'
|
|
2293
|
+
}]
|
|
2294
|
+
}], ctorParameters: () => [] });
|
|
2295
|
+
|
|
2296
|
+
class YsSidebarComponent {
|
|
2297
|
+
router;
|
|
2298
|
+
subscription;
|
|
2299
|
+
currentItem;
|
|
2300
|
+
currentItemState = [];
|
|
2301
|
+
_items = [];
|
|
2302
|
+
get items() { return this._items; }
|
|
2303
|
+
;
|
|
2304
|
+
set items(value) { this._items = value; }
|
|
2305
|
+
profile = null;
|
|
2306
|
+
styleClass;
|
|
2307
|
+
itemsStyleClass;
|
|
2308
|
+
constructor(router) {
|
|
2309
|
+
this.router = router;
|
|
2310
|
+
this.subscription = router.events.subscribe(e => {
|
|
2311
|
+
if (e instanceof NavigationEnd) {
|
|
2312
|
+
this.currentItem = undefined;
|
|
2313
|
+
this.currentItemState = [];
|
|
2314
|
+
}
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
ngOnDestroy() {
|
|
2318
|
+
this.subscription.unsubscribe();
|
|
2319
|
+
}
|
|
2320
|
+
get fullName() { return `${this.profile?.firstName} ${this.profile?.lastName}`; }
|
|
2321
|
+
openItem(item) {
|
|
2322
|
+
if (item.isOpen) {
|
|
2323
|
+
item.isOpen = !item.isOpen;
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
this.items.forEach(x => x.isOpen = false);
|
|
2327
|
+
item.isOpen = !item.isOpen;
|
|
2328
|
+
}
|
|
2329
|
+
isDropdown(item) {
|
|
2330
|
+
return (item.items?.length ?? 0) > 0;
|
|
2331
|
+
}
|
|
2332
|
+
onRouterLinkActive(isActive, item) {
|
|
2333
|
+
this.currentItemState.push(isActive);
|
|
2334
|
+
if (!isActive && this.currentItem == item) {
|
|
2335
|
+
if (this.currentItemState.length == 2 && this.currentItemState[0] && !this.currentItemState[1]) {
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
this.currentItem = item;
|
|
2340
|
+
item.isActive = isActive;
|
|
2341
|
+
// if (isActive) {
|
|
2342
|
+
// this.items.forEach(x => x.isOpen = false);
|
|
2343
|
+
// item.isOpen = true;
|
|
2344
|
+
// }
|
|
2345
|
+
}
|
|
2346
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsSidebarComponent, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
2347
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsSidebarComponent, isStandalone: true, selector: "ys-sidebar", inputs: { items: "items", profile: "profile", styleClass: "styleClass", itemsStyleClass: "itemsStyleClass" }, ngImport: i0, template: "<aside class=\"sidebar card overflow-auto shadow-sm transition-ease\" [ngClass]=\"styleClass\">\r\n @if (profile) {\r\n <div>\r\n @if (profile.image || fullName || profile.role) {\r\n <div class=\"sidebar-profile d-flex flex-column justify-content-center pt-3\">\r\n @if (profile.image) {\r\n <div class=\"image-wrapper\" [ngClass]=\"{'mb-3': fullName || profile.role}\">\r\n <div class=\"user-image rounded-circle m-auto transition-ease\">\r\n <img src=\"{{profile.image.src}}\" class=\"img-fluid\" alt=\"{{profile.image.alt}}\">\r\n </div>\r\n </div>\r\n }\r\n @if (fullName || profile.role) {\r\n <div class=\"profile-details d-flex flex-column text-center transition-ease\">\r\n @if (fullName) {\r\n <strong class=\"text-uppercase name\">{{fullName || ''}}</strong>\r\n }\r\n @if (profile.role) {\r\n <small class=\"text-uppercase role\">{{profile.role}}</small>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n <hr />\r\n </div>\r\n }\r\n\r\n <div class=\"sidebar-menu\" [ngClass]=\"{'pt-2': !profile}\">\r\n <ul class=\"sidebar-items nav nav-pills flex-column mx-2\" [ngClass]=\"itemsStyleClass\">\r\n @for (item of items; track item) {\r\n @if (item.isDivider) {\r\n <hr class=\"sidebar-divider\" />\r\n }\r\n @if (!item.isDivider) {\r\n @if (!isDropdown(item)) {\r\n <li class=\"nav-item d-block\">\r\n <a class=\"nav-link d-flex align-items-center\" [ngClass]=\"{'disabled': item.disabled}\"\r\n [routerLink]=\"item.routerLink\" [routerLinkActive]=\"['active']\" role=\"button\"\r\n (click)=\"openItem(item); item.onClick && item.onClick($event)\">\r\n @if (item.iconClass) {\r\n <i [ngClass]=\"item.iconClass\"></i>\r\n }\r\n <span class=\"link-label ms-3 me-auto\">{{item.label}}</span>\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info\" [ngClass]=\"item.badgeStyleClass\">{{item.badgeLabel}}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n @if (isDropdown(item)) {\r\n <li class=\"nav-item d-block dropend\">\r\n <a class=\"nav-link d-flex align-items-center dropdown-toggle\"\r\n [ngClass]=\"{'active': item.isActive , 'toggled': item.isOpen, 'disabled': item.disabled}\"\r\n data-bs-toggle=\"dropend\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\"\r\n (click)=\"openItem(item); item.onClick && item.onClick($event)\">\r\n @if (item.iconClass) {\r\n <i [ngClass]=\"item.iconClass\"></i>\r\n }\r\n <span class=\"link-label ms-3 me-auto\">{{item.label}}</span>\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info me-1\" [ngClass]=\"item.badgeStyleClass\">{{item.badgeLabel}}</span>\r\n }\r\n </a>\r\n <ul class=\"nav-sub-items nav nav-pills flex-column rounded shadow-sm mb-2 mx-2\"\r\n [ngClass]=\"{'show': item.isOpen}\">\r\n @for (subItem of item.items; track subItem) {\r\n @if (subItem.isDivider) {\r\n <hr class=\"sidebar-divider my-1\" />\r\n }\r\n @if (!subItem.isDivider) {\r\n <li class=\"nav-item d-block\">\r\n <a class=\"nav-link d-flex align-items-center\" [routerLink]=\"subItem.routerLink\" role=\"button\"\r\n [ngClass]=\"{'disabled': subItem.disabled}\" [routerLinkActive]=\"['active']\"\r\n (isActiveChange)=\"this.onRouterLinkActive($event, item)\"\r\n (click)=\"subItem.onClick && subItem.onClick($event)\">\r\n @if (subItem.iconClass) {\r\n <i [ngClass]=\"subItem.iconClass\"></i>\r\n }\r\n <span class=\"link-label ms-3 me-auto\">{{subItem.label}}</span>\r\n @if (subItem.badgeLabel) {\r\n <span class=\"badge bg-info\" [ngClass]=\"subItem.badgeStyleClass\">{{subItem.badgeLabel}}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n </li>\r\n }\r\n }\r\n }\r\n </ul>\r\n </div>\r\n</aside>", styles: ["@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.transition-ease{-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease}.sidebar{height:100%;width:300px;position:absolute;top:0;left:0;z-index:1000}.sidebar .sidebar-profile .user-image{width:75px;height:75px;overflow:hidden}.sidebar .sidebar-profile .profile-details{-webkit-animation:fadeIn 1.5s;animation:fadeIn 1.5s}.sidebar .sidebar-profile .profile-details .role{font-size:.7rem;letter-spacing:1px}.sidebar .sidebar-menu .dropdown-toggle:after{-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease}.sidebar .sidebar-menu .dropdown-toggle.toggled:after{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.sidebar .sidebar-menu .nav-sub-items{display:none;-webkit-animation:fadeIn 1s;animation:fadeIn 1s}.sidebar .sidebar-menu .nav-sub-items .nav-link{height:3em;line-height:3em;font-size:11px}.show{display:block!important}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }] });
|
|
2348
|
+
}
|
|
2349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsSidebarComponent, decorators: [{
|
|
2350
|
+
type: Component,
|
|
2351
|
+
args: [{ selector: 'ys-sidebar', imports: [NgClass, RouterLink, RouterLinkActive], template: "<aside class=\"sidebar card overflow-auto shadow-sm transition-ease\" [ngClass]=\"styleClass\">\r\n @if (profile) {\r\n <div>\r\n @if (profile.image || fullName || profile.role) {\r\n <div class=\"sidebar-profile d-flex flex-column justify-content-center pt-3\">\r\n @if (profile.image) {\r\n <div class=\"image-wrapper\" [ngClass]=\"{'mb-3': fullName || profile.role}\">\r\n <div class=\"user-image rounded-circle m-auto transition-ease\">\r\n <img src=\"{{profile.image.src}}\" class=\"img-fluid\" alt=\"{{profile.image.alt}}\">\r\n </div>\r\n </div>\r\n }\r\n @if (fullName || profile.role) {\r\n <div class=\"profile-details d-flex flex-column text-center transition-ease\">\r\n @if (fullName) {\r\n <strong class=\"text-uppercase name\">{{fullName || ''}}</strong>\r\n }\r\n @if (profile.role) {\r\n <small class=\"text-uppercase role\">{{profile.role}}</small>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n <hr />\r\n </div>\r\n }\r\n\r\n <div class=\"sidebar-menu\" [ngClass]=\"{'pt-2': !profile}\">\r\n <ul class=\"sidebar-items nav nav-pills flex-column mx-2\" [ngClass]=\"itemsStyleClass\">\r\n @for (item of items; track item) {\r\n @if (item.isDivider) {\r\n <hr class=\"sidebar-divider\" />\r\n }\r\n @if (!item.isDivider) {\r\n @if (!isDropdown(item)) {\r\n <li class=\"nav-item d-block\">\r\n <a class=\"nav-link d-flex align-items-center\" [ngClass]=\"{'disabled': item.disabled}\"\r\n [routerLink]=\"item.routerLink\" [routerLinkActive]=\"['active']\" role=\"button\"\r\n (click)=\"openItem(item); item.onClick && item.onClick($event)\">\r\n @if (item.iconClass) {\r\n <i [ngClass]=\"item.iconClass\"></i>\r\n }\r\n <span class=\"link-label ms-3 me-auto\">{{item.label}}</span>\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info\" [ngClass]=\"item.badgeStyleClass\">{{item.badgeLabel}}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n @if (isDropdown(item)) {\r\n <li class=\"nav-item d-block dropend\">\r\n <a class=\"nav-link d-flex align-items-center dropdown-toggle\"\r\n [ngClass]=\"{'active': item.isActive , 'toggled': item.isOpen, 'disabled': item.disabled}\"\r\n data-bs-toggle=\"dropend\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\"\r\n (click)=\"openItem(item); item.onClick && item.onClick($event)\">\r\n @if (item.iconClass) {\r\n <i [ngClass]=\"item.iconClass\"></i>\r\n }\r\n <span class=\"link-label ms-3 me-auto\">{{item.label}}</span>\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info me-1\" [ngClass]=\"item.badgeStyleClass\">{{item.badgeLabel}}</span>\r\n }\r\n </a>\r\n <ul class=\"nav-sub-items nav nav-pills flex-column rounded shadow-sm mb-2 mx-2\"\r\n [ngClass]=\"{'show': item.isOpen}\">\r\n @for (subItem of item.items; track subItem) {\r\n @if (subItem.isDivider) {\r\n <hr class=\"sidebar-divider my-1\" />\r\n }\r\n @if (!subItem.isDivider) {\r\n <li class=\"nav-item d-block\">\r\n <a class=\"nav-link d-flex align-items-center\" [routerLink]=\"subItem.routerLink\" role=\"button\"\r\n [ngClass]=\"{'disabled': subItem.disabled}\" [routerLinkActive]=\"['active']\"\r\n (isActiveChange)=\"this.onRouterLinkActive($event, item)\"\r\n (click)=\"subItem.onClick && subItem.onClick($event)\">\r\n @if (subItem.iconClass) {\r\n <i [ngClass]=\"subItem.iconClass\"></i>\r\n }\r\n <span class=\"link-label ms-3 me-auto\">{{subItem.label}}</span>\r\n @if (subItem.badgeLabel) {\r\n <span class=\"badge bg-info\" [ngClass]=\"subItem.badgeStyleClass\">{{subItem.badgeLabel}}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n </li>\r\n }\r\n }\r\n }\r\n </ul>\r\n </div>\r\n</aside>", styles: ["@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.transition-ease{-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease}.sidebar{height:100%;width:300px;position:absolute;top:0;left:0;z-index:1000}.sidebar .sidebar-profile .user-image{width:75px;height:75px;overflow:hidden}.sidebar .sidebar-profile .profile-details{-webkit-animation:fadeIn 1.5s;animation:fadeIn 1.5s}.sidebar .sidebar-profile .profile-details .role{font-size:.7rem;letter-spacing:1px}.sidebar .sidebar-menu .dropdown-toggle:after{-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease}.sidebar .sidebar-menu .dropdown-toggle.toggled:after{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.sidebar .sidebar-menu .nav-sub-items{display:none;-webkit-animation:fadeIn 1s;animation:fadeIn 1s}.sidebar .sidebar-menu .nav-sub-items .nav-link{height:3em;line-height:3em;font-size:11px}.show{display:block!important}\n"] }]
|
|
2352
|
+
}], ctorParameters: () => [{ type: i1$1.Router }], propDecorators: { items: [{
|
|
2353
|
+
type: Input
|
|
2354
|
+
}], profile: [{
|
|
2355
|
+
type: Input
|
|
2356
|
+
}], styleClass: [{
|
|
2357
|
+
type: Input
|
|
2358
|
+
}], itemsStyleClass: [{
|
|
2359
|
+
type: Input
|
|
2360
|
+
}] } });
|
|
2361
|
+
|
|
2362
|
+
/*
|
|
2363
|
+
* Public API Surface of ys-sidebar
|
|
2364
|
+
*/
|
|
2365
|
+
|
|
2366
|
+
class YsTiffViewerComponent {
|
|
2367
|
+
canvasRef;
|
|
2368
|
+
canvas;
|
|
2369
|
+
context;
|
|
2370
|
+
/**image file directories */
|
|
2371
|
+
IFDs = [];
|
|
2372
|
+
currentIFDIndex = 0;
|
|
2373
|
+
isDecoding = false;
|
|
2374
|
+
_buffer;
|
|
2375
|
+
/**Uint8Array source */
|
|
2376
|
+
/**ArrayBuffer containing TIFF or EXIF data */
|
|
2377
|
+
get buffer() { return this._buffer; }
|
|
2378
|
+
set buffer(value) { this._buffer = value; this.convertSource(this._buffer); }
|
|
2379
|
+
_currentPageReportTemplate = "Page {current} of {total}";
|
|
2380
|
+
/**Current page report template */
|
|
2381
|
+
get currentPageReportTemplate() {
|
|
2382
|
+
return this._currentPageReportTemplate?.
|
|
2383
|
+
replace('{current}', `<strong>${this.currentIFDIndex + 1}</strong>`).
|
|
2384
|
+
replace('{total}', `<strong>${this.IFDs.length}</strong>`);
|
|
2385
|
+
}
|
|
2386
|
+
set currentPageReportTemplate(value) { this._currentPageReportTemplate = value; }
|
|
2387
|
+
/**Canvas container style class */
|
|
2388
|
+
styleClass;
|
|
2389
|
+
/**Message displayed before filling the input buffer */
|
|
2390
|
+
noFileMessage = "No image file";
|
|
2391
|
+
noFileStyleClass;
|
|
2392
|
+
/**First button icon class */
|
|
2393
|
+
firstIconClass = 'fa fa-fast-backward';
|
|
2394
|
+
/**Previous button icon class */
|
|
2395
|
+
previousIconClass = 'fa fa-step-backward';
|
|
2396
|
+
/**Next button icon class */
|
|
2397
|
+
nextIconClass = 'fa fa-step-forward';
|
|
2398
|
+
/**Last button icon class */
|
|
2399
|
+
lastIconClass = 'fa fa-fast-forward';
|
|
2400
|
+
get isIFDs() { return this.IFDs.length > 0; }
|
|
2401
|
+
get isFirstImage() { return !this.isIFDs || (this.currentIFDIndex == 0); }
|
|
2402
|
+
get isLastImage() { return !this.isIFDs || (this.currentIFDIndex == this.IFDs.length - 1); }
|
|
2403
|
+
/**
|
|
2404
|
+
* Convert buffer to an array of "IFDs" (image file directories)
|
|
2405
|
+
* @param buffer ArrayBuffer containing TIFF or EXIF data
|
|
2406
|
+
* @returns
|
|
2407
|
+
*/
|
|
2408
|
+
async convertSource(buffer) {
|
|
2409
|
+
this.canvas = this.canvasRef.nativeElement;
|
|
2410
|
+
this.context = this.canvas.getContext("2d");
|
|
2411
|
+
this.IFDs = [];
|
|
2412
|
+
this.currentIFDIndex = 0;
|
|
2413
|
+
if (!buffer) {
|
|
2414
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
if (buffer instanceof File || buffer instanceof Blob) {
|
|
2418
|
+
// buffer = await this.getAsByteArray(buffer);
|
|
2419
|
+
buffer = await buffer.arrayBuffer();
|
|
2420
|
+
}
|
|
2421
|
+
this.isDecoding = true;
|
|
2422
|
+
this.IFDs = UTIF.decode(buffer);
|
|
2423
|
+
this.IFDs.forEach((ifd) => UTIF.decodeImage(buffer, ifd));
|
|
2424
|
+
this.putImage(this.currentIFDIndex);
|
|
2425
|
+
this.isDecoding = false;
|
|
2426
|
+
}
|
|
2427
|
+
putImage(index) {
|
|
2428
|
+
if (!this.IFDs.length) {
|
|
2429
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2430
|
+
return;
|
|
2431
|
+
}
|
|
2432
|
+
const tiffImage = this.IFDs[index];
|
|
2433
|
+
const rgbaImage = UTIF.toRGBA8(tiffImage); // Uint8Array with RGBA pixels
|
|
2434
|
+
const data = new Uint8ClampedArray(rgbaImage);
|
|
2435
|
+
const imageData = new ImageData(data, tiffImage.width, tiffImage.height);
|
|
2436
|
+
this.context.canvas.width = tiffImage.width;
|
|
2437
|
+
this.context.canvas.height = tiffImage.height;
|
|
2438
|
+
// Draw image data to the canvas
|
|
2439
|
+
this.context.putImageData(imageData, 0, 0);
|
|
2440
|
+
}
|
|
2441
|
+
first() {
|
|
2442
|
+
this.currentIFDIndex = 0;
|
|
2443
|
+
this.putImage(this.currentIFDIndex);
|
|
2444
|
+
}
|
|
2445
|
+
previous() {
|
|
2446
|
+
this.currentIFDIndex -= 1;
|
|
2447
|
+
if (this.currentIFDIndex < 0) {
|
|
2448
|
+
this.currentIFDIndex = 0;
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
this.putImage(this.currentIFDIndex);
|
|
2452
|
+
}
|
|
2453
|
+
next() {
|
|
2454
|
+
this.currentIFDIndex += 1;
|
|
2455
|
+
if (this.currentIFDIndex > (this.IFDs.length - 1)) {
|
|
2456
|
+
this.currentIFDIndex = this.IFDs.length - 1;
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
this.putImage(this.currentIFDIndex);
|
|
2460
|
+
}
|
|
2461
|
+
last() {
|
|
2462
|
+
this.currentIFDIndex = this.IFDs.length - 1;
|
|
2463
|
+
this.putImage(this.currentIFDIndex);
|
|
2464
|
+
}
|
|
2465
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsTiffViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2466
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsTiffViewerComponent, isStandalone: true, selector: "ys-tiff-viewer", inputs: { buffer: "buffer", currentPageReportTemplate: "currentPageReportTemplate", styleClass: "styleClass", noFileMessage: "noFileMessage", noFileStyleClass: "noFileStyleClass", firstIconClass: "firstIconClass", previousIconClass: "previousIconClass", nextIconClass: "nextIconClass", lastIconClass: "lastIconClass" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["tiffCanvas"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"row\">\r\n <div class=\"col d-flex justify-content-between align-items-center\">\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" [ngClass]=\"{'ml-auto': isIFDs}\" type=\"button\" (click)=\"first()\"\r\n [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"firstIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" type=\"button\" (click)=\"previous()\" [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"previousIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n @if (isIFDs) {\r\n <span [innerHtml]=\"currentPageReportTemplate\">\r\n </span>\r\n }\r\n\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" type=\"button\" (click)=\"next()\" [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"nextIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" [ngClass]=\"{'mr-auto': isIFDs}\" type=\"button\" (click)=\"last()\"\r\n [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"lastIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n\r\n </div>\r\n</div>\r\n<div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"canvas-container card d-flex justify-content-center align-items-center mt-1 {{styleClass}}\">\r\n @if (!isIFDs && noFileMessage) {\r\n <span class=\"my-4\" [ngClass]=\"noFileStyleClass\">{{noFileMessage}}</span>\r\n }\r\n <canvas #tiffCanvas class=\"canvas-image img-fluid\" [ngClass]=\"{'d-none': !isIFDs}\"></canvas>\r\n <div class=\"backdrop position-absolute w-100 h-100 d-flex justify-content-center align-items-center\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n\r\n </div>\r\n <div class=\"spinner-border text-info position-absolute\" style=\"width: 3rem; height: 3rem;\" role=\"status\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n <span class=\"visually-hidden\">Loading...</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".backdrop{background-color:rgba(var(--bs-dark-rgb),.3)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
2467
|
+
}
|
|
2468
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsTiffViewerComponent, decorators: [{
|
|
2469
|
+
type: Component,
|
|
2470
|
+
args: [{ selector: 'ys-tiff-viewer', imports: [NgClass], template: "<div class=\"row\">\r\n <div class=\"col d-flex justify-content-between align-items-center\">\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" [ngClass]=\"{'ml-auto': isIFDs}\" type=\"button\" (click)=\"first()\"\r\n [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"firstIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" type=\"button\" (click)=\"previous()\" [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"previousIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n @if (isIFDs) {\r\n <span [innerHtml]=\"currentPageReportTemplate\">\r\n </span>\r\n }\r\n\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" type=\"button\" (click)=\"next()\" [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"nextIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" [ngClass]=\"{'mr-auto': isIFDs}\" type=\"button\" (click)=\"last()\"\r\n [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"lastIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n\r\n </div>\r\n</div>\r\n<div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"canvas-container card d-flex justify-content-center align-items-center mt-1 {{styleClass}}\">\r\n @if (!isIFDs && noFileMessage) {\r\n <span class=\"my-4\" [ngClass]=\"noFileStyleClass\">{{noFileMessage}}</span>\r\n }\r\n <canvas #tiffCanvas class=\"canvas-image img-fluid\" [ngClass]=\"{'d-none': !isIFDs}\"></canvas>\r\n <div class=\"backdrop position-absolute w-100 h-100 d-flex justify-content-center align-items-center\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n\r\n </div>\r\n <div class=\"spinner-border text-info position-absolute\" style=\"width: 3rem; height: 3rem;\" role=\"status\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n <span class=\"visually-hidden\">Loading...</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".backdrop{background-color:rgba(var(--bs-dark-rgb),.3)}\n"] }]
|
|
2471
|
+
}], propDecorators: { canvasRef: [{
|
|
2472
|
+
type: ViewChild,
|
|
2473
|
+
args: ['tiffCanvas', { static: true }]
|
|
2474
|
+
}], buffer: [{
|
|
2475
|
+
type: Input
|
|
2476
|
+
}], currentPageReportTemplate: [{
|
|
2477
|
+
type: Input
|
|
2478
|
+
}], styleClass: [{
|
|
2479
|
+
type: Input
|
|
2480
|
+
}], noFileMessage: [{
|
|
2481
|
+
type: Input
|
|
2482
|
+
}], noFileStyleClass: [{
|
|
2483
|
+
type: Input
|
|
2484
|
+
}], firstIconClass: [{
|
|
2485
|
+
type: Input
|
|
2486
|
+
}], previousIconClass: [{
|
|
2487
|
+
type: Input
|
|
2488
|
+
}], nextIconClass: [{
|
|
2489
|
+
type: Input
|
|
2490
|
+
}], lastIconClass: [{
|
|
2491
|
+
type: Input
|
|
2492
|
+
}] } });
|
|
2493
|
+
|
|
2494
|
+
/*
|
|
2495
|
+
* Public API Surface of ys-sidebar
|
|
2496
|
+
*/
|
|
2497
|
+
|
|
2498
|
+
var ToastType;
|
|
2499
|
+
(function (ToastType) {
|
|
2500
|
+
ToastType[ToastType["info"] = 0] = "info";
|
|
2501
|
+
ToastType[ToastType["success"] = 1] = "success";
|
|
2502
|
+
ToastType[ToastType["warning"] = 2] = "warning";
|
|
2503
|
+
ToastType[ToastType["danger"] = 3] = "danger";
|
|
2504
|
+
})(ToastType || (ToastType = {}));
|
|
2505
|
+
|
|
2506
|
+
class ToastService {
|
|
2507
|
+
toasts = [];
|
|
2508
|
+
// showItem = false;
|
|
2509
|
+
show(textOrTpl, options = {}) {
|
|
2510
|
+
// this.showItem = true;
|
|
2511
|
+
this.toasts.push({ textOrTpl, ...options });
|
|
2512
|
+
}
|
|
2513
|
+
remove(toast) {
|
|
2514
|
+
// this.showItem = false;
|
|
2515
|
+
this.toasts = this.toasts.filter(t => t !== toast);
|
|
2516
|
+
}
|
|
2517
|
+
clear() {
|
|
2518
|
+
this.toasts.splice(0, this.toasts.length);
|
|
2519
|
+
}
|
|
2520
|
+
showStandard(textOrTpl, header) {
|
|
2521
|
+
this.show(textOrTpl, { header: header });
|
|
2522
|
+
}
|
|
2523
|
+
showInfo(textOrTpl, header) {
|
|
2524
|
+
this.show(textOrTpl, { header: header, classname: 'bg-info text-light', type: ToastType.info, delay: 10000, autohide: true });
|
|
2525
|
+
}
|
|
2526
|
+
showSuccess(textOrTpl, header) {
|
|
2527
|
+
this.show(textOrTpl, { header: header, classname: 'bg-success text-light', type: ToastType.success, delay: 10000, autohide: true });
|
|
2528
|
+
}
|
|
2529
|
+
showWarning(textOrTpl, header) {
|
|
2530
|
+
this.show(textOrTpl, { header: header, classname: 'bg-warning text-light', type: ToastType.warning, delay: 10000, autohide: true });
|
|
2531
|
+
}
|
|
2532
|
+
showDanger(textOrTpl, header) {
|
|
2533
|
+
this.show(textOrTpl, { header: header, classname: 'bg-danger text-light', type: ToastType.danger, delay: 15000, autohide: true });
|
|
2534
|
+
}
|
|
2535
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2536
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
2537
|
+
}
|
|
2538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ToastService, decorators: [{
|
|
2539
|
+
type: Injectable,
|
|
2540
|
+
args: [{
|
|
2541
|
+
providedIn: 'root'
|
|
2542
|
+
}]
|
|
2543
|
+
}] });
|
|
2544
|
+
|
|
2545
|
+
class YsToastComponent {
|
|
2546
|
+
toastService;
|
|
2547
|
+
_elementRef;
|
|
2548
|
+
autohide = true;
|
|
2549
|
+
_placement = [];
|
|
2550
|
+
/**
|
|
2551
|
+
* Set toasts placement with style classes.
|
|
2552
|
+
* Default place is top end.
|
|
2553
|
+
*/
|
|
2554
|
+
get placement() { return this._placement; }
|
|
2555
|
+
set placement(placement) {
|
|
2556
|
+
this._placement = placement;
|
|
2557
|
+
this.setPlacement(this._placement);
|
|
2558
|
+
}
|
|
2559
|
+
constructor(toastService, _elementRef) {
|
|
2560
|
+
this.toastService = toastService;
|
|
2561
|
+
this._elementRef = _elementRef;
|
|
2562
|
+
}
|
|
2563
|
+
ngOnInit() {
|
|
2564
|
+
this.setPlacement(this._placement);
|
|
2565
|
+
}
|
|
2566
|
+
get toastTypes() { return ToastType; }
|
|
2567
|
+
get hostElement() { return this._elementRef.nativeElement; }
|
|
2568
|
+
setPlacement(placement) {
|
|
2569
|
+
if (placement?.length <= 0) {
|
|
2570
|
+
this.hostElement?.classList?.add(...["top-0", "end-0"]);
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2573
|
+
this.hostElement?.classList?.add(...this._placement);
|
|
2574
|
+
}
|
|
2575
|
+
isTemplate(toast) { return toast.textOrTpl instanceof TemplateRef; }
|
|
2576
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsToastComponent, deps: [{ token: ToastService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2577
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: YsToastComponent, isStandalone: true, selector: "ys-toast", inputs: { autohide: "autohide", placement: "placement" }, host: { styleAttribute: "z-index: 1200", classAttribute: "toast-container position-fixed p-3" }, ngImport: i0, template: "@for (toast of toastService.toasts; track toast) {\r\n <ngb-toast [class]=\"toast.classname\" [autohide]=\"autohide\" [header]=\"toast.header\" [delay]=\"toast.delay || 5000\"\r\n (hidden)=\"toastService.remove(toast);\">\r\n <!-- *ngIf=\"toastService.showItem\" -->\r\n @if (isTemplate(toast)) {\r\n <ng-template [ngTemplateOutlet]=\"toast.textOrTpl\"></ng-template>\r\n } @else {\r\n @if (toast.type==toastTypes.danger) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"bug\" class=\"svg-inline--fa fa-bug fa-w-16\" role=\"img\"\r\n width=\"24\" height=\"24\" viewBox=\"0 0 512 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z\" />\r\n </svg>\r\n }\r\n <!-- <svg *ngIf=\"toast.type=='danger'\" xmlns=\"http://www.w3.org/2000/svg\" class=\"ml-2\" fill=\"#fff\" width=\"24\"\r\n height=\"24\" viewBox=\"0 0 24 24\">\r\n <path\r\n d=\"M10.872 6.831l1.695 3.904 3.654-1.561-1.79 3.426 3.333.954-3.417 1.338 2.231 4.196-4.773-2.582-2.869 2.287.413-3.004-3.792-.726 2.93-1.74-1.885-2.512 3.427.646.843-4.626zm-.786-6.831l-1.665 9.119-6.512-1.228 3.639 4.851-5.548 3.294 7.108 1.361-.834 6.076 5.742-4.577 9.438 5.104-4.288-8.064 6.834-2.677-6.661-1.907 3.25-6.22-6.98 2.982-3.523-8.114z\" />\r\n </svg> -->\r\n @if (toast.type==toastTypes.warning) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"exclamation-triangle\"\r\n class=\"svg-inline--fa fa-exclamation-triangle fa-w-18 ml-2\" role=\"img\" width=\"24\" height=\"24\"\r\n viewBox=\"0 0 576 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\" />\r\n </svg>\r\n }\r\n @if (toast.type==toastTypes.info) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"info-circle\"\r\n class=\"svg-inline--fa fa-info-circle fa-w-16 ml-2\" role=\"img\" width=\"24\" height=\"24\"\r\n viewBox=\"0 0 512 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\" />\r\n </svg>\r\n }\r\n @if (toast.type==toastTypes.success) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"check-circle\"\r\n class=\"svg-inline--fa fa-check-circle fa-w-16 ml-2\" role=\"img\" width=\"24\" height=\"24\"\r\n viewBox=\"0 0 512 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z\" />\r\n </svg>\r\n }\r\n <span class=\"ms-2\">{{ toast.textOrTpl }}</span>\r\n }\r\n </ngb-toast>\r\n }", styles: [""], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NgbToastModule }, { kind: "component", type: i2$1.NgbToast, selector: "ngb-toast", inputs: ["animation", "delay", "autohide", "header"], outputs: ["shown", "hidden"], exportAs: ["ngbToast"] }] });
|
|
2578
|
+
}
|
|
2579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: YsToastComponent, decorators: [{
|
|
2580
|
+
type: Component,
|
|
2581
|
+
args: [{ selector: 'ys-toast', imports: [NgTemplateOutlet, NgbToastModule], host: { class: 'toast-container position-fixed p-3', style: 'z-index: 1200' }, template: "@for (toast of toastService.toasts; track toast) {\r\n <ngb-toast [class]=\"toast.classname\" [autohide]=\"autohide\" [header]=\"toast.header\" [delay]=\"toast.delay || 5000\"\r\n (hidden)=\"toastService.remove(toast);\">\r\n <!-- *ngIf=\"toastService.showItem\" -->\r\n @if (isTemplate(toast)) {\r\n <ng-template [ngTemplateOutlet]=\"toast.textOrTpl\"></ng-template>\r\n } @else {\r\n @if (toast.type==toastTypes.danger) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"bug\" class=\"svg-inline--fa fa-bug fa-w-16\" role=\"img\"\r\n width=\"24\" height=\"24\" viewBox=\"0 0 512 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z\" />\r\n </svg>\r\n }\r\n <!-- <svg *ngIf=\"toast.type=='danger'\" xmlns=\"http://www.w3.org/2000/svg\" class=\"ml-2\" fill=\"#fff\" width=\"24\"\r\n height=\"24\" viewBox=\"0 0 24 24\">\r\n <path\r\n d=\"M10.872 6.831l1.695 3.904 3.654-1.561-1.79 3.426 3.333.954-3.417 1.338 2.231 4.196-4.773-2.582-2.869 2.287.413-3.004-3.792-.726 2.93-1.74-1.885-2.512 3.427.646.843-4.626zm-.786-6.831l-1.665 9.119-6.512-1.228 3.639 4.851-5.548 3.294 7.108 1.361-.834 6.076 5.742-4.577 9.438 5.104-4.288-8.064 6.834-2.677-6.661-1.907 3.25-6.22-6.98 2.982-3.523-8.114z\" />\r\n </svg> -->\r\n @if (toast.type==toastTypes.warning) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"exclamation-triangle\"\r\n class=\"svg-inline--fa fa-exclamation-triangle fa-w-18 ml-2\" role=\"img\" width=\"24\" height=\"24\"\r\n viewBox=\"0 0 576 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\" />\r\n </svg>\r\n }\r\n @if (toast.type==toastTypes.info) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"info-circle\"\r\n class=\"svg-inline--fa fa-info-circle fa-w-16 ml-2\" role=\"img\" width=\"24\" height=\"24\"\r\n viewBox=\"0 0 512 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\" />\r\n </svg>\r\n }\r\n @if (toast.type==toastTypes.success) {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"\r\n focusable=\"false\" data-prefix=\"fas\" data-icon=\"check-circle\"\r\n class=\"svg-inline--fa fa-check-circle fa-w-16 ml-2\" role=\"img\" width=\"24\" height=\"24\"\r\n viewBox=\"0 0 512 512\">\r\n <path fill=\"currentColor\"\r\n d=\"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z\" />\r\n </svg>\r\n }\r\n <span class=\"ms-2\">{{ toast.textOrTpl }}</span>\r\n }\r\n </ngb-toast>\r\n }" }]
|
|
2582
|
+
}], ctorParameters: () => [{ type: ToastService }, { type: i0.ElementRef }], propDecorators: { autohide: [{
|
|
2583
|
+
type: Input
|
|
2584
|
+
}], placement: [{
|
|
2585
|
+
type: Input
|
|
2586
|
+
}] } });
|
|
2587
|
+
|
|
2588
|
+
/*
|
|
2589
|
+
* Public API Surface of ys-toast
|
|
2590
|
+
*/
|
|
2591
|
+
|
|
1
2592
|
/*
|
|
2
2593
|
* Public API Surface of yoozsoft-ng
|
|
3
2594
|
*/
|
|
4
|
-
const YOOZSOFT_YOOZSOFT_NG = "@yoozsoft/yoozsoft-ng";
|
|
2595
|
+
// export const YOOZSOFT_YOOZSOFT_NG = "@yoozsoft/yoozsoft-ng";
|
|
5
2596
|
|
|
6
2597
|
/**
|
|
7
2598
|
* Generated bundle index. Do not edit.
|
|
8
2599
|
*/
|
|
9
2600
|
|
|
10
|
-
export {
|
|
2601
|
+
export { DateTimeFormat, DigitRegx, I18n, JalaliDate, LanguageType, LowercaseRegx, NonAlphanumericRegx, ProgressService, SidebarService, StrengthValidationFeedback, StrengthValidationOption, StrongPasswordRegx, ToastService, ToastType, UppercaseRegx, YsAutocompleteComponent, YsDateParserFormatterService, YsDatepickerComponent, YsDatepickerI18nService, YsDatepickerPersianComponent, YsDatepickerPopupComponent, YsDatepickerPopupPersianComponent, YsDatepickerRangePopupComponent, YsDatepickerRangePopupPersianComponent, YsDropdownComponent, YsFileUploadComponent, YsFooterComponent, YsLoadingMaskComponent, YsNavbarComponent, YsOverlayComponent, YsPaginationComponent, YsPasswordMatchDirective, YsPasswordStrengthComponent, YsPasswordStrengthDirective, YsProgressComponent, YsSelectComponent, YsSidebarComponent, YsTiffViewerComponent, YsToastComponent, passwordMatchValidator };
|
|
11
2602
|
//# sourceMappingURL=yoozsoft-yoozsoft-ng.mjs.map
|