@sebgroup/green-angular 1.0.0-beta.10 → 1.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/index.mjs +3 -1
- package/esm2020/lib/badge/badge.component.mjs +56 -0
- package/esm2020/lib/badge/badge.module.mjs +18 -0
- package/esm2020/lib/datepicker/datepicker.component.mjs +62 -16
- package/esm2020/lib/datepicker/datepicker.module.mjs +4 -4
- package/esm2020/lib/dropdown/dropdown.component.mjs +152 -40
- package/esm2020/lib/dropdown/dropdown.module.mjs +4 -4
- package/esm2020/lib/green-angular.module.mjs +4 -4
- package/esm2020/lib/segmented-control/segmented-control.component.mjs +3 -3
- package/esm2020/lib/segmented-control/segmented-control.module.mjs +4 -4
- package/fesm2015/sebgroup-green-angular.mjs +303 -78
- package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
- package/fesm2020/sebgroup-green-angular.mjs +298 -73
- package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/lib/badge/badge.component.d.ts +16 -0
- package/lib/badge/badge.module.d.ts +8 -0
- package/lib/datepicker/datepicker.component.d.ts +10 -7
- package/lib/dropdown/dropdown.component.d.ts +13 -6
- package/package.json +3 -3
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, Input, NgModule, EventEmitter, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, Input, NgModule, EventEmitter, Output, ViewChild, HostBinding } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/router';
|
|
6
6
|
import { RouterModule } from '@angular/router';
|
|
7
7
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
8
|
import { dropdownValues, createDropdown, randomId, months, years, createDatepicker } from '@sebgroup/extract';
|
|
9
|
+
import { startOfDay, endOfDay } from 'date-fns';
|
|
9
10
|
|
|
10
11
|
class NggSegmentedControlComponent {
|
|
11
12
|
}
|
|
12
|
-
NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
13
|
-
NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.
|
|
13
|
+
NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
+
NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
|
|
14
15
|
<div class="group">
|
|
15
16
|
<a
|
|
16
17
|
*ngFor="let control of $controls | async"
|
|
@@ -21,7 +22,7 @@ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
|
|
|
21
22
|
>
|
|
22
23
|
</div>
|
|
23
24
|
`, isInline: true, directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i2.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
|
|
25
26
|
type: Component,
|
|
26
27
|
args: [{
|
|
27
28
|
selector: 'ngg-segmented-control',
|
|
@@ -45,10 +46,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
45
46
|
|
|
46
47
|
class NggSegmentedControlModule {
|
|
47
48
|
}
|
|
48
|
-
NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
49
|
-
NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
50
|
-
NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
49
|
+
NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
50
|
+
NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
|
|
51
|
+
NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
|
|
52
53
|
type: NgModule,
|
|
53
54
|
args: [{
|
|
54
55
|
declarations: [NggSegmentedControlComponent],
|
|
@@ -61,14 +62,23 @@ class NggDropdownComponent {
|
|
|
61
62
|
constructor(cd) {
|
|
62
63
|
this.cd = cd;
|
|
63
64
|
this.loop = false;
|
|
65
|
+
this._multiSelect = false;
|
|
64
66
|
this.options = [];
|
|
65
67
|
this.valueChange = new EventEmitter();
|
|
66
68
|
this.toggler = dropdownValues.elements?.toggler;
|
|
67
69
|
this.listbox = dropdownValues.elements?.listbox;
|
|
70
|
+
this.fieldset = dropdownValues.elements?.fieldset;
|
|
68
71
|
this.trackByKey = (index, option) => {
|
|
69
|
-
return option.key;
|
|
72
|
+
return option[''] || option.key;
|
|
70
73
|
};
|
|
71
74
|
}
|
|
75
|
+
set multiSelect(value) {
|
|
76
|
+
this._multiSelect =
|
|
77
|
+
value === '' || value === 'true' || value.toString() === 'true' || false;
|
|
78
|
+
}
|
|
79
|
+
get multiSelect() {
|
|
80
|
+
return this._multiSelect;
|
|
81
|
+
}
|
|
72
82
|
get value() {
|
|
73
83
|
return this._value;
|
|
74
84
|
}
|
|
@@ -77,18 +87,48 @@ class NggDropdownComponent {
|
|
|
77
87
|
}
|
|
78
88
|
ngAfterViewInit() {
|
|
79
89
|
if (this.togglerRef?.nativeElement && this.listboxRef?.nativeElement) {
|
|
80
|
-
this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, (dropdown) => {
|
|
90
|
+
this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, this.fieldsetRef?.nativeElement, (dropdown) => {
|
|
81
91
|
this.dropdown = dropdown;
|
|
82
92
|
this.toggler = dropdown.elements.toggler;
|
|
83
93
|
this.listbox = dropdown.elements.listbox;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
this.fieldset = dropdown.elements.fieldset;
|
|
95
|
+
// TODO: refactor state handling to only emit value changes when value changes (not on state change), perhaps using rxjs?
|
|
96
|
+
if (!dropdown.isMultiSelect) {
|
|
97
|
+
let selectedOption = this.dropdown.options?.find((option) => option.selected);
|
|
98
|
+
if ((selectedOption && !this._value) ||
|
|
99
|
+
(selectedOption &&
|
|
100
|
+
selectedOption[dropdown.useValue] !==
|
|
101
|
+
this._value[dropdown.useValue])) {
|
|
102
|
+
const { attributes, classes, active, selected, ...data } = selectedOption;
|
|
103
|
+
selectedOption = dropdown.selectValue
|
|
104
|
+
? data[dropdown.selectValue]
|
|
105
|
+
: data;
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
this._value = selectedOption;
|
|
108
|
+
this.valueChange.emit(selectedOption);
|
|
109
|
+
this.onChangeFn && this.onChangeFn(selectedOption);
|
|
110
|
+
this.onTouchedFn && this.onTouchedFn();
|
|
111
|
+
}, 0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const selectedOption = this.dropdown.options
|
|
116
|
+
?.filter((option) => option.selected)
|
|
117
|
+
.map((option) => {
|
|
118
|
+
const { attributes, classes, active, selected, ...data } = option;
|
|
119
|
+
return dropdown.selectValue ? data[dropdown.selectValue] : data;
|
|
120
|
+
});
|
|
121
|
+
if ((this._value !== undefined || selectedOption?.length > 0) &&
|
|
122
|
+
this._value !== [] &&
|
|
123
|
+
selectedOption &&
|
|
124
|
+
JSON.stringify(this._value) !== JSON.stringify(selectedOption)) {
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
this._value = selectedOption;
|
|
127
|
+
this.valueChange.emit(selectedOption);
|
|
128
|
+
this.onChangeFn && this.onChangeFn(selectedOption);
|
|
129
|
+
this.onTouchedFn && this.onTouchedFn();
|
|
130
|
+
}, 0);
|
|
131
|
+
}
|
|
92
132
|
}
|
|
93
133
|
this.cd.detectChanges();
|
|
94
134
|
});
|
|
@@ -112,39 +152,39 @@ class NggDropdownComponent {
|
|
|
112
152
|
registerOnTouched(fn) {
|
|
113
153
|
this.onTouchedFn = fn;
|
|
114
154
|
}
|
|
115
|
-
select(option) {
|
|
116
|
-
this.handler?.select(option);
|
|
117
|
-
this._value = option.value;
|
|
118
|
-
this.valueChange.emit(option.value);
|
|
119
|
-
this.onChangeFn && this.onChangeFn(option.value);
|
|
120
|
-
this.onTouchedFn && this.onTouchedFn();
|
|
121
|
-
}
|
|
122
155
|
get props() {
|
|
123
156
|
return {
|
|
124
157
|
id: this.id || this.dropdown?.id,
|
|
125
|
-
|
|
158
|
+
texts: this.texts,
|
|
159
|
+
useValue: this.useValue,
|
|
160
|
+
display: this.display,
|
|
161
|
+
selectValue: this.selectValue,
|
|
126
162
|
options: this.options,
|
|
127
163
|
loop: this.loop,
|
|
128
164
|
value: this.value,
|
|
165
|
+
multiSelect: this.multiSelect,
|
|
129
166
|
};
|
|
130
167
|
}
|
|
131
168
|
setSelectionByValue(value) {
|
|
132
|
-
if (this.
|
|
133
|
-
this._value
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
this.handler?.
|
|
169
|
+
if (!this.dropdown?.isMultiSelect) {
|
|
170
|
+
if (this._value !== value && value !== undefined) {
|
|
171
|
+
this._value = value;
|
|
172
|
+
const valueKey = this.handler?.dropdown.useValue;
|
|
173
|
+
const selected = this.handler?.dropdown?.options.find((option) => option[valueKey] === value[valueKey] || option[valueKey] === value);
|
|
174
|
+
if (selected)
|
|
175
|
+
this.handler?.select(selected);
|
|
176
|
+
}
|
|
137
177
|
}
|
|
138
178
|
}
|
|
139
179
|
}
|
|
140
|
-
NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
141
|
-
NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.
|
|
180
|
+
NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
181
|
+
NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { id: "id", texts: "texts", loop: "loop", display: "display", selectValue: "selectValue", useValue: "useValue", multiSelect: "multiSelect", label: "label", options: "options", valid: "valid", invalid: "invalid", value: "value" }, outputs: { valueChange: "valueChange" }, providers: [
|
|
142
182
|
{
|
|
143
183
|
provide: NG_VALUE_ACCESSOR,
|
|
144
184
|
useExisting: NggDropdownComponent,
|
|
145
185
|
multi: true,
|
|
146
186
|
},
|
|
147
|
-
], viewQueries: [{ propertyName: "togglerRef", first: true, predicate: ["togglerRef"], descendants: true }, { propertyName: "listboxRef", first: true, predicate: ["listboxRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
187
|
+
], viewQueries: [{ propertyName: "togglerRef", first: true, predicate: ["togglerRef"], descendants: true }, { propertyName: "listboxRef", first: true, predicate: ["listboxRef"], descendants: true }, { propertyName: "fieldsetRef", first: true, predicate: ["fieldsetRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
148
188
|
<div>
|
|
149
189
|
<span
|
|
150
190
|
class="label"
|
|
@@ -157,7 +197,7 @@ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
157
197
|
label ? toggler?.attributes?.id + '_label' : null
|
|
158
198
|
"
|
|
159
199
|
[attr.aria-describedby]="
|
|
160
|
-
formInfo?.
|
|
200
|
+
formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)
|
|
161
201
|
? toggler?.attributes?.id + '_info'
|
|
162
202
|
: null
|
|
163
203
|
"
|
|
@@ -174,7 +214,9 @@ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
174
214
|
[class.is-valid]="valid"
|
|
175
215
|
[class.is-invalid]="invalid"
|
|
176
216
|
>
|
|
177
|
-
<span>{{
|
|
217
|
+
<span>{{
|
|
218
|
+
dropdown?.texts?.select || dropdown?.texts?.placeholder
|
|
219
|
+
}}</span>
|
|
178
220
|
</button>
|
|
179
221
|
<span
|
|
180
222
|
class="form-info"
|
|
@@ -198,9 +240,9 @@ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
198
240
|
class="close m-4 m-sm-2 d-block d-sm-none"
|
|
199
241
|
(click)="handler?.close()"
|
|
200
242
|
>
|
|
201
|
-
<span class="sr-only">
|
|
243
|
+
<span class="sr-only">{{ dropdown?.texts?.close }}</span>
|
|
202
244
|
</button>
|
|
203
|
-
<ul role="listbox">
|
|
245
|
+
<ul role="listbox" *ngIf="!dropdown?.isMultiSelect">
|
|
204
246
|
<li
|
|
205
247
|
*ngFor="let option of dropdown?.options; trackBy: trackByKey"
|
|
206
248
|
[id]="option.attributes.id"
|
|
@@ -210,13 +252,42 @@ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
210
252
|
[class]="option.classes"
|
|
211
253
|
(click)="handler?.select(option)"
|
|
212
254
|
>
|
|
213
|
-
{{ option
|
|
255
|
+
{{ option[dropdown!.display] }}
|
|
214
256
|
</li>
|
|
215
257
|
</ul>
|
|
258
|
+
<div *ngIf="dropdown?.isMultiSelect" class="sg-fieldset-container">
|
|
259
|
+
<fieldset
|
|
260
|
+
#fieldsetRef
|
|
261
|
+
[attr.aria-describedby]="fieldset?.attributes?.id"
|
|
262
|
+
role="listbox"
|
|
263
|
+
tabIndex="-1"
|
|
264
|
+
aria-multiselectable="true"
|
|
265
|
+
>
|
|
266
|
+
<legend class="sr-only" [id]="fieldset?.attributes?.id">
|
|
267
|
+
Options
|
|
268
|
+
</legend>
|
|
269
|
+
<label
|
|
270
|
+
class="form-control"
|
|
271
|
+
[attr.role]="option.attributes.role"
|
|
272
|
+
[id]="option.attributes.id"
|
|
273
|
+
[attr.aria-selected]="option.attributes['aria-selected']"
|
|
274
|
+
[class]="option.classes"
|
|
275
|
+
*ngFor="let option of dropdown?.options; trackBy: trackByKey"
|
|
276
|
+
>
|
|
277
|
+
<input
|
|
278
|
+
type="checkbox"
|
|
279
|
+
(change)="handler?.select(option, false)"
|
|
280
|
+
[checked]="option.selected"
|
|
281
|
+
/>
|
|
282
|
+
<span>{{ option[dropdown!.display] }}</span>
|
|
283
|
+
<i></i>
|
|
284
|
+
</label>
|
|
285
|
+
</fieldset>
|
|
286
|
+
</div>
|
|
216
287
|
</div>
|
|
217
288
|
</div>
|
|
218
289
|
`, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, decorators: [{
|
|
220
291
|
type: Component,
|
|
221
292
|
args: [{
|
|
222
293
|
selector: 'ngg-dropdown',
|
|
@@ -233,7 +304,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
233
304
|
label ? toggler?.attributes?.id + '_label' : null
|
|
234
305
|
"
|
|
235
306
|
[attr.aria-describedby]="
|
|
236
|
-
formInfo?.
|
|
307
|
+
formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)
|
|
237
308
|
? toggler?.attributes?.id + '_info'
|
|
238
309
|
: null
|
|
239
310
|
"
|
|
@@ -250,7 +321,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
250
321
|
[class.is-valid]="valid"
|
|
251
322
|
[class.is-invalid]="invalid"
|
|
252
323
|
>
|
|
253
|
-
<span>{{
|
|
324
|
+
<span>{{
|
|
325
|
+
dropdown?.texts?.select || dropdown?.texts?.placeholder
|
|
326
|
+
}}</span>
|
|
254
327
|
</button>
|
|
255
328
|
<span
|
|
256
329
|
class="form-info"
|
|
@@ -274,9 +347,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
274
347
|
class="close m-4 m-sm-2 d-block d-sm-none"
|
|
275
348
|
(click)="handler?.close()"
|
|
276
349
|
>
|
|
277
|
-
<span class="sr-only">
|
|
350
|
+
<span class="sr-only">{{ dropdown?.texts?.close }}</span>
|
|
278
351
|
</button>
|
|
279
|
-
<ul role="listbox">
|
|
352
|
+
<ul role="listbox" *ngIf="!dropdown?.isMultiSelect">
|
|
280
353
|
<li
|
|
281
354
|
*ngFor="let option of dropdown?.options; trackBy: trackByKey"
|
|
282
355
|
[id]="option.attributes.id"
|
|
@@ -286,9 +359,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
286
359
|
[class]="option.classes"
|
|
287
360
|
(click)="handler?.select(option)"
|
|
288
361
|
>
|
|
289
|
-
{{ option
|
|
362
|
+
{{ option[dropdown!.display] }}
|
|
290
363
|
</li>
|
|
291
364
|
</ul>
|
|
365
|
+
<div *ngIf="dropdown?.isMultiSelect" class="sg-fieldset-container">
|
|
366
|
+
<fieldset
|
|
367
|
+
#fieldsetRef
|
|
368
|
+
[attr.aria-describedby]="fieldset?.attributes?.id"
|
|
369
|
+
role="listbox"
|
|
370
|
+
tabIndex="-1"
|
|
371
|
+
aria-multiselectable="true"
|
|
372
|
+
>
|
|
373
|
+
<legend class="sr-only" [id]="fieldset?.attributes?.id">
|
|
374
|
+
Options
|
|
375
|
+
</legend>
|
|
376
|
+
<label
|
|
377
|
+
class="form-control"
|
|
378
|
+
[attr.role]="option.attributes.role"
|
|
379
|
+
[id]="option.attributes.id"
|
|
380
|
+
[attr.aria-selected]="option.attributes['aria-selected']"
|
|
381
|
+
[class]="option.classes"
|
|
382
|
+
*ngFor="let option of dropdown?.options; trackBy: trackByKey"
|
|
383
|
+
>
|
|
384
|
+
<input
|
|
385
|
+
type="checkbox"
|
|
386
|
+
(change)="handler?.select(option, false)"
|
|
387
|
+
[checked]="option.selected"
|
|
388
|
+
/>
|
|
389
|
+
<span>{{ option[dropdown!.display] }}</span>
|
|
390
|
+
<i></i>
|
|
391
|
+
</label>
|
|
392
|
+
</fieldset>
|
|
393
|
+
</div>
|
|
292
394
|
</div>
|
|
293
395
|
</div>
|
|
294
396
|
`,
|
|
@@ -303,10 +405,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
303
405
|
}]
|
|
304
406
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
|
|
305
407
|
type: Input
|
|
306
|
-
}],
|
|
408
|
+
}], texts: [{
|
|
307
409
|
type: Input
|
|
308
410
|
}], loop: [{
|
|
309
411
|
type: Input
|
|
412
|
+
}], display: [{
|
|
413
|
+
type: Input
|
|
414
|
+
}], selectValue: [{
|
|
415
|
+
type: Input
|
|
416
|
+
}], useValue: [{
|
|
417
|
+
type: Input
|
|
418
|
+
}], multiSelect: [{
|
|
419
|
+
type: Input
|
|
310
420
|
}], label: [{
|
|
311
421
|
type: Input
|
|
312
422
|
}], options: [{
|
|
@@ -325,14 +435,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
325
435
|
}], listboxRef: [{
|
|
326
436
|
type: ViewChild,
|
|
327
437
|
args: ['listboxRef']
|
|
438
|
+
}], fieldsetRef: [{
|
|
439
|
+
type: ViewChild,
|
|
440
|
+
args: ['fieldsetRef']
|
|
328
441
|
}] } });
|
|
329
442
|
|
|
330
443
|
class NggDropdownModule {
|
|
331
444
|
}
|
|
332
|
-
NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
333
|
-
NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
334
|
-
NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.
|
|
335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
445
|
+
NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
446
|
+
NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent], imports: [CommonModule], exports: [NggDropdownComponent] });
|
|
447
|
+
NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
|
|
448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, decorators: [{
|
|
336
449
|
type: NgModule,
|
|
337
450
|
args: [{
|
|
338
451
|
declarations: [NggDropdownComponent],
|
|
@@ -345,20 +458,24 @@ class NggDatepickerComponent {
|
|
|
345
458
|
constructor(_cdr) {
|
|
346
459
|
this._cdr = _cdr;
|
|
347
460
|
this.id = randomId();
|
|
461
|
+
this.isValid = null;
|
|
348
462
|
this.valueChange = new EventEmitter();
|
|
349
463
|
this._months = months({});
|
|
350
|
-
this.years = years({});
|
|
351
|
-
this.trackByKey = (index, option) => {
|
|
352
|
-
return option.key;
|
|
353
|
-
};
|
|
354
464
|
this.listener = (data, state) => {
|
|
355
465
|
if (this.dp && state) {
|
|
356
466
|
this.dp.state = { ...state };
|
|
467
|
+
this.years = years({
|
|
468
|
+
from: this.dp.state?.minDate?.getFullYear(),
|
|
469
|
+
to: this.dp.state?.maxDate?.getFullYear(),
|
|
470
|
+
});
|
|
357
471
|
}
|
|
358
472
|
this.onTouchedFn && this.onTouchedFn();
|
|
359
473
|
if (data) {
|
|
360
|
-
|
|
361
|
-
this.
|
|
474
|
+
// only emit change event if date has changed
|
|
475
|
+
if (this.data?.selectedDate !== data.selectedDate) {
|
|
476
|
+
this.valueChange.emit(data.selectedDate);
|
|
477
|
+
this.onChangeFn && this.onChangeFn(data.selectedDate);
|
|
478
|
+
}
|
|
362
479
|
this.data = data;
|
|
363
480
|
}
|
|
364
481
|
if (data || state) {
|
|
@@ -409,6 +526,17 @@ class NggDatepickerComponent {
|
|
|
409
526
|
set data(value) {
|
|
410
527
|
this._data = value;
|
|
411
528
|
}
|
|
529
|
+
onDateChange(value) {
|
|
530
|
+
const newDate = new Date(value);
|
|
531
|
+
// Only pass valid date to date picker
|
|
532
|
+
if (!isNaN(newDate.getTime())) {
|
|
533
|
+
this.dp?.select(value);
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
this.valueChange.emit(value);
|
|
537
|
+
this.onChangeFn && this.onChangeFn(value);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
412
540
|
trackWeek(index, week) {
|
|
413
541
|
return week;
|
|
414
542
|
}
|
|
@@ -430,15 +558,15 @@ class NggDatepickerComponent {
|
|
|
430
558
|
}
|
|
431
559
|
}
|
|
432
560
|
}
|
|
433
|
-
NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
434
|
-
NggDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.
|
|
561
|
+
NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
562
|
+
NggDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggDatepickerComponent, selector: "ngg-datepicker", inputs: { options: "options", value: "value", id: "id", label: "label", isValid: "isValid" }, outputs: { valueChange: "valueChange" }, providers: [
|
|
435
563
|
{
|
|
436
564
|
provide: NG_VALUE_ACCESSOR,
|
|
437
565
|
useExisting: NggDatepickerComponent,
|
|
438
566
|
multi: true,
|
|
439
567
|
},
|
|
440
|
-
], viewQueries: [{ propertyName: "datepickerDialogElRef", first: true, predicate: ["datepickerDialogElRef"], descendants: true }, { propertyName: "dateInputElRef", first: true, predicate: ["dateInputElRef"], descendants: true }, { propertyName: "datepickerElRef", first: true, predicate: ["datepickerElRef"], descendants: true }, { propertyName: "datepickerTriggerElRef", first: true, predicate: ["datepickerTriggerElRef"], descendants: true }], ngImport: i0, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"
|
|
441
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
568
|
+
], viewQueries: [{ propertyName: "datepickerDialogElRef", first: true, predicate: ["datepickerDialogElRef"], descendants: true }, { propertyName: "dateInputElRef", first: true, predicate: ["dateInputElRef"], descendants: true }, { propertyName: "datepickerElRef", first: true, predicate: ["datepickerElRef"], descendants: true }, { propertyName: "datepickerTriggerElRef", first: true, predicate: ["datepickerTriggerElRef"], descendants: true }], ngImport: i0, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"isValid\"\n [class.is-invalid]=\"isValid === false\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"onDateChange(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"popover popover-datepicker\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <button type=\"button\" class=\"close\" (click)=\"dp?.close()\">Close</button>\n <div class=\"sg-date\">\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n text=\"Select\"\n [value]=\"data?.month\"\n selectValue=\"value\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n text=\"Select\"\n [value]=\"data?.year\"\n selectValue=\"value\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"\n day.selected && !data?.highlightedDate ? true : null\n \"\n [class.disabled]=\"day.disabled\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n [tabIndex]=\"\n day.highlighted ||\n (day.selected && !data?.highlightedDate) ||\n (day.today && !data?.highlightedDate && !data?.selectedDate)\n ? 0\n : -1\n \"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n </div>\n</div>\n", components: [{ type: NggDropdownComponent, selector: "ngg-dropdown", inputs: ["id", "texts", "loop", "display", "selectValue", "useValue", "multiSelect", "label", "options", "valid", "invalid", "value"], outputs: ["valueChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
569
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, decorators: [{
|
|
442
570
|
type: Component,
|
|
443
571
|
args: [{ selector: 'ngg-datepicker', providers: [
|
|
444
572
|
{
|
|
@@ -446,7 +574,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
446
574
|
useExisting: NggDatepickerComponent,
|
|
447
575
|
multi: true,
|
|
448
576
|
},
|
|
449
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"
|
|
577
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"isValid\"\n [class.is-invalid]=\"isValid === false\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"onDateChange(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"popover popover-datepicker\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <button type=\"button\" class=\"close\" (click)=\"dp?.close()\">Close</button>\n <div class=\"sg-date\">\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n text=\"Select\"\n [value]=\"data?.month\"\n selectValue=\"value\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n text=\"Select\"\n [value]=\"data?.year\"\n selectValue=\"value\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"\n day.selected && !data?.highlightedDate ? true : null\n \"\n [class.disabled]=\"day.disabled\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n [tabIndex]=\"\n day.highlighted ||\n (day.selected && !data?.highlightedDate) ||\n (day.today && !data?.highlightedDate && !data?.selectedDate)\n ? 0\n : -1\n \"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n </div>\n</div>\n" }]
|
|
450
578
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
|
|
451
579
|
type: Input
|
|
452
580
|
}], value: [{
|
|
@@ -455,9 +583,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
455
583
|
type: Input
|
|
456
584
|
}], label: [{
|
|
457
585
|
type: Input
|
|
458
|
-
}],
|
|
459
|
-
type: Input
|
|
460
|
-
}], invalid: [{
|
|
586
|
+
}], isValid: [{
|
|
461
587
|
type: Input
|
|
462
588
|
}], valueChange: [{
|
|
463
589
|
type: Output
|
|
@@ -474,13 +600,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
474
600
|
type: ViewChild,
|
|
475
601
|
args: ['datepickerTriggerElRef']
|
|
476
602
|
}] } });
|
|
603
|
+
function dateValidator(dates) {
|
|
604
|
+
return (control) => {
|
|
605
|
+
const value = control.value;
|
|
606
|
+
if (!value) {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
const newDate = new Date(value);
|
|
610
|
+
const isValidDate = !isNaN(newDate.getTime());
|
|
611
|
+
if (!isValidDate) {
|
|
612
|
+
return { validDate: true };
|
|
613
|
+
}
|
|
614
|
+
const validMinDate = dates?.min ? newDate >= startOfDay(dates.min) : true;
|
|
615
|
+
const validMaxDate = dates?.max ? newDate <= endOfDay(dates.max) : true;
|
|
616
|
+
if (!validMinDate && dates?.min) {
|
|
617
|
+
return {
|
|
618
|
+
validDate: {
|
|
619
|
+
minDate: startOfDay(dates.min),
|
|
620
|
+
actualDate: newDate,
|
|
621
|
+
},
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
if (!validMaxDate && dates?.max) {
|
|
625
|
+
return {
|
|
626
|
+
validDate: {
|
|
627
|
+
maxDate: endOfDay(dates.max),
|
|
628
|
+
actualDate: newDate,
|
|
629
|
+
},
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
return null;
|
|
633
|
+
};
|
|
634
|
+
}
|
|
477
635
|
|
|
478
636
|
class NggDatepickerModule {
|
|
479
637
|
}
|
|
480
|
-
NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
481
|
-
NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
482
|
-
NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.
|
|
483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
638
|
+
NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
639
|
+
NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
|
|
640
|
+
NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
|
|
641
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, decorators: [{
|
|
484
642
|
type: NgModule,
|
|
485
643
|
args: [{
|
|
486
644
|
declarations: [NggDatepickerComponent],
|
|
@@ -491,10 +649,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
491
649
|
|
|
492
650
|
class NggModule {
|
|
493
651
|
}
|
|
494
|
-
NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
495
|
-
NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
496
|
-
NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.
|
|
497
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
652
|
+
NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
653
|
+
NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
|
|
654
|
+
NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [[CommonModule], NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, decorators: [{
|
|
498
656
|
type: NgModule,
|
|
499
657
|
args: [{
|
|
500
658
|
declarations: [],
|
|
@@ -503,9 +661,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
503
661
|
}]
|
|
504
662
|
}] });
|
|
505
663
|
|
|
664
|
+
class NggBadgeComponent {
|
|
665
|
+
constructor(viewContainerRef) {
|
|
666
|
+
this.viewContainerRef = viewContainerRef;
|
|
667
|
+
}
|
|
668
|
+
set isCloseable(value) {
|
|
669
|
+
this._isCloseable = value;
|
|
670
|
+
}
|
|
671
|
+
get isCloseable() {
|
|
672
|
+
return this._isCloseable === '' || !!this._isCloseable;
|
|
673
|
+
}
|
|
674
|
+
get class() {
|
|
675
|
+
return ['badge', this.badgeType].join(' ');
|
|
676
|
+
}
|
|
677
|
+
close() {
|
|
678
|
+
this.viewContainerRef.element.nativeElement.remove();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
NggBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
682
|
+
NggBadgeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggBadgeComponent, selector: "[ngg-badge]", inputs: { isCloseable: "isCloseable", badgeType: "badgeType", closeText: "closeText" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: `
|
|
683
|
+
<strong>
|
|
684
|
+
<ng-content></ng-content>
|
|
685
|
+
</strong>
|
|
686
|
+
<button *ngIf="isCloseable" class="close" (click)="close()">
|
|
687
|
+
{{ closeText }}
|
|
688
|
+
</button>
|
|
689
|
+
`, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
690
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, decorators: [{
|
|
691
|
+
type: Component,
|
|
692
|
+
args: [{
|
|
693
|
+
// we need to disable this warning since we don't want the badge component to create a new element
|
|
694
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
695
|
+
selector: '[ngg-badge]',
|
|
696
|
+
template: `
|
|
697
|
+
<strong>
|
|
698
|
+
<ng-content></ng-content>
|
|
699
|
+
</strong>
|
|
700
|
+
<button *ngIf="isCloseable" class="close" (click)="close()">
|
|
701
|
+
{{ closeText }}
|
|
702
|
+
</button>
|
|
703
|
+
`,
|
|
704
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
705
|
+
}]
|
|
706
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { isCloseable: [{
|
|
707
|
+
type: Input
|
|
708
|
+
}], badgeType: [{
|
|
709
|
+
type: Input
|
|
710
|
+
}], closeText: [{
|
|
711
|
+
type: Input
|
|
712
|
+
}], class: [{
|
|
713
|
+
type: HostBinding,
|
|
714
|
+
args: ['class']
|
|
715
|
+
}] } });
|
|
716
|
+
|
|
717
|
+
class NggBadgeModule {
|
|
718
|
+
}
|
|
719
|
+
NggBadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
720
|
+
NggBadgeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, declarations: [NggBadgeComponent], imports: [CommonModule], exports: [NggBadgeComponent] });
|
|
721
|
+
NggBadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, imports: [[CommonModule]] });
|
|
722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, decorators: [{
|
|
723
|
+
type: NgModule,
|
|
724
|
+
args: [{
|
|
725
|
+
declarations: [NggBadgeComponent],
|
|
726
|
+
imports: [CommonModule],
|
|
727
|
+
exports: [NggBadgeComponent],
|
|
728
|
+
}]
|
|
729
|
+
}] });
|
|
730
|
+
|
|
506
731
|
/**
|
|
507
732
|
* Generated bundle index. Do not edit.
|
|
508
733
|
*/
|
|
509
734
|
|
|
510
|
-
export { NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule };
|
|
735
|
+
export { NggBadgeComponent, NggBadgeModule, NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule, dateValidator };
|
|
511
736
|
//# sourceMappingURL=sebgroup-green-angular.mjs.map
|