@sebgroup/green-angular 1.0.0-beta.22 → 1.0.0-beta.24
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/lib/datepicker/datepicker.component.mjs +3 -3
- package/esm2020/lib/dropdown/dropdown.component.mjs +14 -327
- package/fesm2015/sebgroup-green-angular.mjs +16 -328
- package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
- package/fesm2020/sebgroup-green-angular.mjs +15 -328
- package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
- package/lib/dropdown/dropdown.component.d.ts +9 -9
- package/package.json +3 -3
|
@@ -85,7 +85,7 @@ class NggDropdownComponent {
|
|
|
85
85
|
this.listbox = dropdownValues.elements?.listbox;
|
|
86
86
|
this.fieldset = dropdownValues.elements?.fieldset;
|
|
87
87
|
this.trackByKey = (index, option) => {
|
|
88
|
-
return option
|
|
88
|
+
return option.attributes.id ?? '';
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
set multiSelect(value) {
|
|
@@ -113,35 +113,9 @@ class NggDropdownComponent {
|
|
|
113
113
|
this.toggler = dropdown.elements.toggler;
|
|
114
114
|
this.listbox = dropdown.elements.listbox;
|
|
115
115
|
this.fieldset = dropdown.elements.fieldset;
|
|
116
|
-
// TODO: refactor state handling to only emit value changes when value changes (not on state change), perhaps using rxjs?
|
|
117
|
-
if (!dropdown.isMultiSelect) {
|
|
118
|
-
let selectedOption = this.dropdown.options?.find((option) => option.selected);
|
|
119
|
-
if ((selectedOption && !this._value) ||
|
|
120
|
-
(selectedOption &&
|
|
121
|
-
selectedOption[dropdown.useValue] !==
|
|
122
|
-
this._value[dropdown.useValue])) {
|
|
123
|
-
const { attributes, classes, active, selected, ...data } = selectedOption;
|
|
124
|
-
selectedOption = dropdown.selectValue
|
|
125
|
-
? data[dropdown.selectValue]
|
|
126
|
-
: data;
|
|
127
|
-
this.updateValue(selectedOption);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
const selectedOption = this.dropdown.options
|
|
132
|
-
?.filter((option) => option.selected)
|
|
133
|
-
.map((option) => {
|
|
134
|
-
const { attributes, classes, active, selected, ...data } = option;
|
|
135
|
-
return dropdown.selectValue ? data[dropdown.selectValue] : data;
|
|
136
|
-
});
|
|
137
|
-
if ((this._value !== undefined || selectedOption?.length > 0) &&
|
|
138
|
-
this._value !== [] &&
|
|
139
|
-
selectedOption &&
|
|
140
|
-
JSON.stringify(this._value) !== JSON.stringify(selectedOption)) {
|
|
141
|
-
this.updateValue(selectedOption);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
116
|
this.cd.detectChanges();
|
|
117
|
+
}, (value) => {
|
|
118
|
+
this.updateValue(value);
|
|
145
119
|
});
|
|
146
120
|
}
|
|
147
121
|
}
|
|
@@ -172,13 +146,13 @@ class NggDropdownComponent {
|
|
|
172
146
|
texts: this.texts,
|
|
173
147
|
useValue: this.useValue,
|
|
174
148
|
display: this.display,
|
|
175
|
-
selectValue: this.selectValue,
|
|
176
149
|
options: this.options,
|
|
177
150
|
loop: this.loop,
|
|
178
151
|
value: this.value,
|
|
179
152
|
multiSelect: this.multiSelect,
|
|
180
153
|
searchable: this.searchable,
|
|
181
|
-
|
|
154
|
+
searchFilter: this.searchFilter,
|
|
155
|
+
compareWith: this.compareWith,
|
|
182
156
|
onTouched: () => {
|
|
183
157
|
this.onTouchedFn?.();
|
|
184
158
|
this.touched.emit(true);
|
|
@@ -196,7 +170,7 @@ class NggDropdownComponent {
|
|
|
196
170
|
if (this._value !== value && value !== undefined) {
|
|
197
171
|
this._value = value;
|
|
198
172
|
const valueKey = this.handler?.dropdown.useValue;
|
|
199
|
-
const selected = this.handler?.dropdown?.options.find((option) => option[valueKey]
|
|
173
|
+
const selected = this.handler?.dropdown?.options.find((option) => this.dropdown?.compareWith(option[valueKey], value));
|
|
200
174
|
if (selected)
|
|
201
175
|
this.handler?.select(selected);
|
|
202
176
|
}
|
|
@@ -207,309 +181,22 @@ class NggDropdownComponent {
|
|
|
207
181
|
}
|
|
208
182
|
}
|
|
209
183
|
NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
210
|
-
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",
|
|
184
|
+
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", useValue: "useValue", label: "label", options: "options", valid: "valid", invalid: "invalid", compareWith: "compareWith", searchFilter: "searchFilter", multiSelect: "multiSelect", searchable: "searchable", value: "value" }, outputs: { valueChange: "valueChange", touched: "touched" }, providers: [
|
|
211
185
|
{
|
|
212
186
|
provide: NG_VALUE_ACCESSOR,
|
|
213
187
|
useExisting: NggDropdownComponent,
|
|
214
188
|
multi: true,
|
|
215
189
|
},
|
|
216
|
-
], queries: [{ propertyName: "customOption", first: true, predicate: NggDropdownOptionDirective, descendants: true }], 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:
|
|
217
|
-
<div>
|
|
218
|
-
<span
|
|
219
|
-
class="label"
|
|
220
|
-
*ngIf="label"
|
|
221
|
-
[id]="toggler?.attributes?.id + '_label'"
|
|
222
|
-
>{{ label }}</span
|
|
223
|
-
>
|
|
224
|
-
<button
|
|
225
|
-
[attr.aria-labelledby]="
|
|
226
|
-
label ? toggler?.attributes?.id + '_label' : null
|
|
227
|
-
"
|
|
228
|
-
[attr.aria-describedby]="
|
|
229
|
-
formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)
|
|
230
|
-
? toggler?.attributes?.id + '_info'
|
|
231
|
-
: null
|
|
232
|
-
"
|
|
233
|
-
type="button"
|
|
234
|
-
#togglerRef
|
|
235
|
-
[id]="toggler?.attributes?.id"
|
|
236
|
-
[attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
|
|
237
|
-
[attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
|
|
238
|
-
[attr.aria-owns]="toggler?.attributes?.['aria-owns']"
|
|
239
|
-
[tabindex]="toggler?.attributes?.tabIndex"
|
|
240
|
-
[style]="toggler?.attributes?.style"
|
|
241
|
-
[class]="toggler?.classes"
|
|
242
|
-
(click)="handler?.toggle()"
|
|
243
|
-
[class.is-valid]="valid"
|
|
244
|
-
[class.is-invalid]="invalid"
|
|
245
|
-
>
|
|
246
|
-
<span>{{
|
|
247
|
-
dropdown?.texts?.select || dropdown?.texts?.placeholder
|
|
248
|
-
}}</span>
|
|
249
|
-
</button>
|
|
250
|
-
<span
|
|
251
|
-
class="form-info"
|
|
252
|
-
#formInfo
|
|
253
|
-
[attr.id]="toggler?.attributes?.id + '_info'"
|
|
254
|
-
><ng-content select="[data-form-info]"></ng-content
|
|
255
|
-
></span>
|
|
256
|
-
<div
|
|
257
|
-
#listboxRef
|
|
258
|
-
[id]="listbox?.attributes?.id"
|
|
259
|
-
[attr.role]="listbox?.attributes?.role"
|
|
260
|
-
[attr.aria-activedescendant]="
|
|
261
|
-
listbox?.attributes?.['aria-activedescendant']
|
|
262
|
-
"
|
|
263
|
-
[tabindex]="listbox?.attributes?.tabIndex"
|
|
264
|
-
[style]="listbox?.attributes?.style"
|
|
265
|
-
[class]="listbox?.classes"
|
|
266
|
-
>
|
|
267
|
-
<button
|
|
268
|
-
type="button"
|
|
269
|
-
class="close m-4 m-sm-2 d-block d-sm-none"
|
|
270
|
-
(click)="handler?.close()"
|
|
271
|
-
>
|
|
272
|
-
<span class="sr-only">{{ dropdown?.texts?.close }}</span>
|
|
273
|
-
</button>
|
|
274
|
-
<ul role="listbox" *ngIf="!dropdown?.isMultiSelect">
|
|
275
|
-
<ng-container *ngTemplateOutlet="searchInput"></ng-container>
|
|
276
|
-
<li
|
|
277
|
-
*ngFor="
|
|
278
|
-
let option of dropdown?.options;
|
|
279
|
-
let index = index;
|
|
280
|
-
trackBy: trackByKey
|
|
281
|
-
"
|
|
282
|
-
[id]="option.attributes.id"
|
|
283
|
-
[attr.role]="option.attributes.role"
|
|
284
|
-
[attr.aria-selected]="option.attributes['aria-selected']"
|
|
285
|
-
[style]="option.attributes.style"
|
|
286
|
-
[class]="option.classes"
|
|
287
|
-
(click)="handler?.select(option)"
|
|
288
|
-
>
|
|
289
|
-
<ng-container
|
|
290
|
-
*ngTemplateOutlet="
|
|
291
|
-
customOption?.templateRef
|
|
292
|
-
? customOption!.templateRef
|
|
293
|
-
: defaultOption;
|
|
294
|
-
context: { option: option, index: index }
|
|
295
|
-
"
|
|
296
|
-
></ng-container>
|
|
297
|
-
</li>
|
|
298
|
-
</ul>
|
|
299
|
-
<div *ngIf="dropdown?.isMultiSelect" class="sg-fieldset-container">
|
|
300
|
-
<ng-container *ngTemplateOutlet="searchInput"></ng-container>
|
|
301
|
-
<fieldset
|
|
302
|
-
#fieldsetRef
|
|
303
|
-
[attr.aria-describedby]="fieldset?.attributes?.id"
|
|
304
|
-
role="listbox"
|
|
305
|
-
tabIndex="-1"
|
|
306
|
-
aria-multiselectable="true"
|
|
307
|
-
>
|
|
308
|
-
<legend class="sr-only" [id]="fieldset?.attributes?.id">
|
|
309
|
-
Options
|
|
310
|
-
</legend>
|
|
311
|
-
<label
|
|
312
|
-
class="form-control"
|
|
313
|
-
[attr.role]="option.attributes.role"
|
|
314
|
-
[id]="option.attributes.id"
|
|
315
|
-
[attr.aria-selected]="option.attributes['aria-selected']"
|
|
316
|
-
[class]="option.classes"
|
|
317
|
-
*ngFor="
|
|
318
|
-
let option of dropdown?.options;
|
|
319
|
-
let index = index;
|
|
320
|
-
trackBy: trackByKey
|
|
321
|
-
"
|
|
322
|
-
>
|
|
323
|
-
<input
|
|
324
|
-
type="checkbox"
|
|
325
|
-
(change)="handler?.select(option, false)"
|
|
326
|
-
[checked]="option.selected"
|
|
327
|
-
tabIndex="-1"
|
|
328
|
-
/>
|
|
329
|
-
<ng-container
|
|
330
|
-
*ngTemplateOutlet="
|
|
331
|
-
customOption?.templateRef
|
|
332
|
-
? customOption!.templateRef
|
|
333
|
-
: defaultOption;
|
|
334
|
-
context: { option: option, index: index }
|
|
335
|
-
"
|
|
336
|
-
></ng-container>
|
|
337
|
-
<i></i>
|
|
338
|
-
</label>
|
|
339
|
-
</fieldset>
|
|
340
|
-
</div>
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
|
|
344
|
-
<ng-template #defaultOption let-option="option">
|
|
345
|
-
{{ option[dropdown!.display] }}
|
|
346
|
-
</ng-template>
|
|
347
|
-
|
|
348
|
-
<ng-template #searchInput>
|
|
349
|
-
<input
|
|
350
|
-
*ngIf="dropdown?.isSearchable"
|
|
351
|
-
type="search"
|
|
352
|
-
(input)="search($event)"
|
|
353
|
-
placeholder="{{ dropdown?.texts?.searchPlaceholder }}"
|
|
354
|
-
class="rounded-0 rounded-top border-0 border-bottom border-info"
|
|
355
|
-
/>
|
|
356
|
-
</ng-template>
|
|
357
|
-
`, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
190
|
+
], queries: [{ propertyName: "customOption", first: true, predicate: NggDropdownOptionDirective, descendants: true }], 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: "<div>\n <span class=\"label\" *ngIf=\"label\" [id]=\"toggler?.attributes?.id + '_label'\">{{\n label\n }}</span>\n <button\n [attr.aria-labelledby]=\"label ? toggler?.attributes?.id + '_label' : null\"\n [attr.aria-describedby]=\"\n formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)\n ? toggler?.attributes?.id + '_info'\n : null\n \"\n type=\"button\"\n #togglerRef\n [id]=\"toggler?.attributes?.id\"\n [attr.aria-haspopup]=\"toggler?.attributes?.['aria-haspopup']\"\n [attr.aria-expanded]=\"toggler?.attributes?.['aria-expanded']\"\n [attr.aria-owns]=\"toggler?.attributes?.['aria-owns']\"\n [tabindex]=\"toggler?.attributes?.tabIndex\"\n [style]=\"toggler?.attributes?.style\"\n [class]=\"toggler?.classes\"\n (click)=\"handler?.toggle()\"\n [class.is-valid]=\"valid\"\n [class.is-invalid]=\"invalid\"\n >\n <span>{{ dropdown?.texts?.select || dropdown?.texts?.placeholder }}</span>\n </button>\n <span\n class=\"form-info\"\n #formInfo\n [attr.id]=\"toggler?.attributes?.id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n <div\n #listboxRef\n [id]=\"listbox?.attributes?.id\"\n [attr.role]=\"listbox?.attributes?.role\"\n [attr.aria-activedescendant]=\"\n listbox?.attributes?.['aria-activedescendant']\n \"\n [tabindex]=\"listbox?.attributes?.tabIndex\"\n [style]=\"listbox?.attributes?.style\"\n [class]=\"listbox?.classes\"\n >\n <button\n type=\"button\"\n class=\"close m-4 m-sm-2 d-block d-sm-none\"\n (click)=\"handler?.close()\"\n >\n <span class=\"sr-only\">{{ dropdown?.texts?.close }}</span>\n </button>\n <ul role=\"listbox\" *ngIf=\"!dropdown?.isMultiSelect\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <li\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n [id]=\"option.attributes.id\"\n [attr.role]=\"option.attributes.role\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [style]=\"option.attributes.style\"\n [class]=\"option.classes\"\n (click)=\"handler?.select(option)\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n </li>\n </ul>\n <div *ngIf=\"dropdown?.isMultiSelect\" class=\"sg-fieldset-container\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <fieldset\n #fieldsetRef\n [attr.aria-describedby]=\"fieldset?.attributes?.id\"\n role=\"listbox\"\n tabIndex=\"-1\"\n aria-multiselectable=\"true\"\n >\n <legend class=\"sr-only\" [id]=\"fieldset?.attributes?.id\">Options</legend>\n <label\n class=\"form-control\"\n [attr.role]=\"option.attributes.role\"\n [id]=\"option.attributes.id\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [class]=\"option.classes\"\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n >\n <input\n type=\"checkbox\"\n (change)=\"handler?.select(option, false)\"\n [checked]=\"option.selected\"\n tabIndex=\"-1\"\n />\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n <i></i>\n </label>\n </fieldset>\n </div>\n </div>\n</div>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ option[dropdown!.display] }}\n</ng-template>\n\n<ng-template #searchInput>\n <input\n *ngIf=\"dropdown?.isSearchable\"\n type=\"search\"\n (input)=\"search($event)\"\n placeholder=\"{{ dropdown?.texts?.searchPlaceholder }}\"\n class=\"rounded-0 rounded-top border-0 border-bottom border-info\"\n />\n</ng-template>\n", directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
358
191
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, decorators: [{
|
|
359
192
|
type: Component,
|
|
360
|
-
args: [{
|
|
361
|
-
selector: 'ngg-dropdown',
|
|
362
|
-
template: `
|
|
363
|
-
<div>
|
|
364
|
-
<span
|
|
365
|
-
class="label"
|
|
366
|
-
*ngIf="label"
|
|
367
|
-
[id]="toggler?.attributes?.id + '_label'"
|
|
368
|
-
>{{ label }}</span
|
|
369
|
-
>
|
|
370
|
-
<button
|
|
371
|
-
[attr.aria-labelledby]="
|
|
372
|
-
label ? toggler?.attributes?.id + '_label' : null
|
|
373
|
-
"
|
|
374
|
-
[attr.aria-describedby]="
|
|
375
|
-
formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)
|
|
376
|
-
? toggler?.attributes?.id + '_info'
|
|
377
|
-
: null
|
|
378
|
-
"
|
|
379
|
-
type="button"
|
|
380
|
-
#togglerRef
|
|
381
|
-
[id]="toggler?.attributes?.id"
|
|
382
|
-
[attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
|
|
383
|
-
[attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
|
|
384
|
-
[attr.aria-owns]="toggler?.attributes?.['aria-owns']"
|
|
385
|
-
[tabindex]="toggler?.attributes?.tabIndex"
|
|
386
|
-
[style]="toggler?.attributes?.style"
|
|
387
|
-
[class]="toggler?.classes"
|
|
388
|
-
(click)="handler?.toggle()"
|
|
389
|
-
[class.is-valid]="valid"
|
|
390
|
-
[class.is-invalid]="invalid"
|
|
391
|
-
>
|
|
392
|
-
<span>{{
|
|
393
|
-
dropdown?.texts?.select || dropdown?.texts?.placeholder
|
|
394
|
-
}}</span>
|
|
395
|
-
</button>
|
|
396
|
-
<span
|
|
397
|
-
class="form-info"
|
|
398
|
-
#formInfo
|
|
399
|
-
[attr.id]="toggler?.attributes?.id + '_info'"
|
|
400
|
-
><ng-content select="[data-form-info]"></ng-content
|
|
401
|
-
></span>
|
|
402
|
-
<div
|
|
403
|
-
#listboxRef
|
|
404
|
-
[id]="listbox?.attributes?.id"
|
|
405
|
-
[attr.role]="listbox?.attributes?.role"
|
|
406
|
-
[attr.aria-activedescendant]="
|
|
407
|
-
listbox?.attributes?.['aria-activedescendant']
|
|
408
|
-
"
|
|
409
|
-
[tabindex]="listbox?.attributes?.tabIndex"
|
|
410
|
-
[style]="listbox?.attributes?.style"
|
|
411
|
-
[class]="listbox?.classes"
|
|
412
|
-
>
|
|
413
|
-
<button
|
|
414
|
-
type="button"
|
|
415
|
-
class="close m-4 m-sm-2 d-block d-sm-none"
|
|
416
|
-
(click)="handler?.close()"
|
|
417
|
-
>
|
|
418
|
-
<span class="sr-only">{{ dropdown?.texts?.close }}</span>
|
|
419
|
-
</button>
|
|
420
|
-
<ul role="listbox" *ngIf="!dropdown?.isMultiSelect">
|
|
421
|
-
<ng-container *ngTemplateOutlet="searchInput"></ng-container>
|
|
422
|
-
<li
|
|
423
|
-
*ngFor="
|
|
424
|
-
let option of dropdown?.options;
|
|
425
|
-
let index = index;
|
|
426
|
-
trackBy: trackByKey
|
|
427
|
-
"
|
|
428
|
-
[id]="option.attributes.id"
|
|
429
|
-
[attr.role]="option.attributes.role"
|
|
430
|
-
[attr.aria-selected]="option.attributes['aria-selected']"
|
|
431
|
-
[style]="option.attributes.style"
|
|
432
|
-
[class]="option.classes"
|
|
433
|
-
(click)="handler?.select(option)"
|
|
434
|
-
>
|
|
435
|
-
<ng-container
|
|
436
|
-
*ngTemplateOutlet="
|
|
437
|
-
customOption?.templateRef
|
|
438
|
-
? customOption!.templateRef
|
|
439
|
-
: defaultOption;
|
|
440
|
-
context: { option: option, index: index }
|
|
441
|
-
"
|
|
442
|
-
></ng-container>
|
|
443
|
-
</li>
|
|
444
|
-
</ul>
|
|
445
|
-
<div *ngIf="dropdown?.isMultiSelect" class="sg-fieldset-container">
|
|
446
|
-
<ng-container *ngTemplateOutlet="searchInput"></ng-container>
|
|
447
|
-
<fieldset
|
|
448
|
-
#fieldsetRef
|
|
449
|
-
[attr.aria-describedby]="fieldset?.attributes?.id"
|
|
450
|
-
role="listbox"
|
|
451
|
-
tabIndex="-1"
|
|
452
|
-
aria-multiselectable="true"
|
|
453
|
-
>
|
|
454
|
-
<legend class="sr-only" [id]="fieldset?.attributes?.id">
|
|
455
|
-
Options
|
|
456
|
-
</legend>
|
|
457
|
-
<label
|
|
458
|
-
class="form-control"
|
|
459
|
-
[attr.role]="option.attributes.role"
|
|
460
|
-
[id]="option.attributes.id"
|
|
461
|
-
[attr.aria-selected]="option.attributes['aria-selected']"
|
|
462
|
-
[class]="option.classes"
|
|
463
|
-
*ngFor="
|
|
464
|
-
let option of dropdown?.options;
|
|
465
|
-
let index = index;
|
|
466
|
-
trackBy: trackByKey
|
|
467
|
-
"
|
|
468
|
-
>
|
|
469
|
-
<input
|
|
470
|
-
type="checkbox"
|
|
471
|
-
(change)="handler?.select(option, false)"
|
|
472
|
-
[checked]="option.selected"
|
|
473
|
-
tabIndex="-1"
|
|
474
|
-
/>
|
|
475
|
-
<ng-container
|
|
476
|
-
*ngTemplateOutlet="
|
|
477
|
-
customOption?.templateRef
|
|
478
|
-
? customOption!.templateRef
|
|
479
|
-
: defaultOption;
|
|
480
|
-
context: { option: option, index: index }
|
|
481
|
-
"
|
|
482
|
-
></ng-container>
|
|
483
|
-
<i></i>
|
|
484
|
-
</label>
|
|
485
|
-
</fieldset>
|
|
486
|
-
</div>
|
|
487
|
-
</div>
|
|
488
|
-
</div>
|
|
489
|
-
|
|
490
|
-
<ng-template #defaultOption let-option="option">
|
|
491
|
-
{{ option[dropdown!.display] }}
|
|
492
|
-
</ng-template>
|
|
493
|
-
|
|
494
|
-
<ng-template #searchInput>
|
|
495
|
-
<input
|
|
496
|
-
*ngIf="dropdown?.isSearchable"
|
|
497
|
-
type="search"
|
|
498
|
-
(input)="search($event)"
|
|
499
|
-
placeholder="{{ dropdown?.texts?.searchPlaceholder }}"
|
|
500
|
-
class="rounded-0 rounded-top border-0 border-bottom border-info"
|
|
501
|
-
/>
|
|
502
|
-
</ng-template>
|
|
503
|
-
`,
|
|
504
|
-
providers: [
|
|
193
|
+
args: [{ selector: 'ngg-dropdown', providers: [
|
|
505
194
|
{
|
|
506
195
|
provide: NG_VALUE_ACCESSOR,
|
|
507
196
|
useExisting: NggDropdownComponent,
|
|
508
197
|
multi: true,
|
|
509
198
|
},
|
|
510
|
-
],
|
|
511
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
512
|
-
}]
|
|
199
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <span class=\"label\" *ngIf=\"label\" [id]=\"toggler?.attributes?.id + '_label'\">{{\n label\n }}</span>\n <button\n [attr.aria-labelledby]=\"label ? toggler?.attributes?.id + '_label' : null\"\n [attr.aria-describedby]=\"\n formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)\n ? toggler?.attributes?.id + '_info'\n : null\n \"\n type=\"button\"\n #togglerRef\n [id]=\"toggler?.attributes?.id\"\n [attr.aria-haspopup]=\"toggler?.attributes?.['aria-haspopup']\"\n [attr.aria-expanded]=\"toggler?.attributes?.['aria-expanded']\"\n [attr.aria-owns]=\"toggler?.attributes?.['aria-owns']\"\n [tabindex]=\"toggler?.attributes?.tabIndex\"\n [style]=\"toggler?.attributes?.style\"\n [class]=\"toggler?.classes\"\n (click)=\"handler?.toggle()\"\n [class.is-valid]=\"valid\"\n [class.is-invalid]=\"invalid\"\n >\n <span>{{ dropdown?.texts?.select || dropdown?.texts?.placeholder }}</span>\n </button>\n <span\n class=\"form-info\"\n #formInfo\n [attr.id]=\"toggler?.attributes?.id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n <div\n #listboxRef\n [id]=\"listbox?.attributes?.id\"\n [attr.role]=\"listbox?.attributes?.role\"\n [attr.aria-activedescendant]=\"\n listbox?.attributes?.['aria-activedescendant']\n \"\n [tabindex]=\"listbox?.attributes?.tabIndex\"\n [style]=\"listbox?.attributes?.style\"\n [class]=\"listbox?.classes\"\n >\n <button\n type=\"button\"\n class=\"close m-4 m-sm-2 d-block d-sm-none\"\n (click)=\"handler?.close()\"\n >\n <span class=\"sr-only\">{{ dropdown?.texts?.close }}</span>\n </button>\n <ul role=\"listbox\" *ngIf=\"!dropdown?.isMultiSelect\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <li\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n [id]=\"option.attributes.id\"\n [attr.role]=\"option.attributes.role\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [style]=\"option.attributes.style\"\n [class]=\"option.classes\"\n (click)=\"handler?.select(option)\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n </li>\n </ul>\n <div *ngIf=\"dropdown?.isMultiSelect\" class=\"sg-fieldset-container\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <fieldset\n #fieldsetRef\n [attr.aria-describedby]=\"fieldset?.attributes?.id\"\n role=\"listbox\"\n tabIndex=\"-1\"\n aria-multiselectable=\"true\"\n >\n <legend class=\"sr-only\" [id]=\"fieldset?.attributes?.id\">Options</legend>\n <label\n class=\"form-control\"\n [attr.role]=\"option.attributes.role\"\n [id]=\"option.attributes.id\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [class]=\"option.classes\"\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n >\n <input\n type=\"checkbox\"\n (change)=\"handler?.select(option, false)\"\n [checked]=\"option.selected\"\n tabIndex=\"-1\"\n />\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n <i></i>\n </label>\n </fieldset>\n </div>\n </div>\n</div>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ option[dropdown!.display] }}\n</ng-template>\n\n<ng-template #searchInput>\n <input\n *ngIf=\"dropdown?.isSearchable\"\n type=\"search\"\n (input)=\"search($event)\"\n placeholder=\"{{ dropdown?.texts?.searchPlaceholder }}\"\n class=\"rounded-0 rounded-top border-0 border-bottom border-info\"\n />\n</ng-template>\n" }]
|
|
513
200
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
|
|
514
201
|
type: Input
|
|
515
202
|
}], texts: [{
|
|
@@ -518,8 +205,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
518
205
|
type: Input
|
|
519
206
|
}], display: [{
|
|
520
207
|
type: Input
|
|
521
|
-
}], selectValue: [{
|
|
522
|
-
type: Input
|
|
523
208
|
}], useValue: [{
|
|
524
209
|
type: Input
|
|
525
210
|
}], label: [{
|
|
@@ -530,7 +215,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
530
215
|
type: Input
|
|
531
216
|
}], invalid: [{
|
|
532
217
|
type: Input
|
|
533
|
-
}],
|
|
218
|
+
}], compareWith: [{
|
|
219
|
+
type: Input
|
|
220
|
+
}], searchFilter: [{
|
|
534
221
|
type: Input
|
|
535
222
|
}], multiSelect: [{
|
|
536
223
|
type: Input
|
|
@@ -681,7 +368,7 @@ NggDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
|
|
|
681
368
|
useExisting: NggDatepickerComponent,
|
|
682
369
|
multi: true,
|
|
683
370
|
},
|
|
684
|
-
], 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
|
|
371
|
+
], 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 display=\"key\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.year\"\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", "useValue", "label", "options", "valid", "invalid", "compareWith", "searchFilter", "multiSelect", "searchable", "value"], outputs: ["valueChange", "touched"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
685
372
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, decorators: [{
|
|
686
373
|
type: Component,
|
|
687
374
|
args: [{ selector: 'ngg-datepicker', providers: [
|
|
@@ -690,7 +377,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
690
377
|
useExisting: NggDatepickerComponent,
|
|
691
378
|
multi: true,
|
|
692
379
|
},
|
|
693
|
-
], 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
|
|
380
|
+
], 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 display=\"key\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.year\"\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" }]
|
|
694
381
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
|
|
695
382
|
type: Input
|
|
696
383
|
}], value: [{
|