list-selection-input 15.0.4
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/README.md +24 -0
- package/esm2022/lib/list-selection-demo/list-selection-demo.component.mjs +167 -0
- package/esm2022/lib/list-selection-input/list-selection-input.component.mjs +265 -0
- package/esm2022/lib/list-selection-input.module.mjs +101 -0
- package/esm2022/lib/models/index.mjs +6 -0
- package/esm2022/lib/models/selection-basic.model.mjs +10 -0
- package/esm2022/lib/models/selection-item.model.mjs +12 -0
- package/esm2022/lib/multi-selection-demo/multi-selection-demo.component.mjs +167 -0
- package/esm2022/lib/pipes/remove-underscore.pipe.mjs +17 -0
- package/esm2022/list-selection-input.mjs +5 -0
- package/esm2022/public-api.mjs +10 -0
- package/fesm2022/list-selection-input.mjs +729 -0
- package/fesm2022/list-selection-input.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/list-selection-demo/list-selection-demo.component.d.ts +54 -0
- package/lib/list-selection-input/list-selection-input.component.d.ts +53 -0
- package/lib/list-selection-input.module.d.ts +27 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/selection-basic.model.d.ts +10 -0
- package/lib/models/selection-item.model.d.ts +14 -0
- package/lib/multi-selection-demo/multi-selection-demo.component.d.ts +54 -0
- package/lib/pipes/remove-underscore.pipe.d.ts +7 -0
- package/list-selection-input-15.0.4.tgz +0 -0
- package/package.json +25 -0
- package/public-api.d.ts +6 -0
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, inject, EventEmitter, forwardRef, Component, Input, Output, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/forms';
|
|
4
|
+
import { FormBuilder, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import * as i3$1 from '@angular/material/button';
|
|
8
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
9
|
+
import * as i3 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
11
|
+
import * as i5$1 from '@angular/material/button-toggle';
|
|
12
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
13
|
+
import * as i6 from '@angular/material/divider';
|
|
14
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
15
|
+
import * as i7 from '@angular/material/slide-toggle';
|
|
16
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
17
|
+
import * as i4 from '@angular/material/core';
|
|
18
|
+
import { MatOptionModule } from '@angular/material/core';
|
|
19
|
+
import * as i5 from '@angular/material/select';
|
|
20
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
21
|
+
import { MatSliderModule } from '@angular/material/slider';
|
|
22
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
23
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
24
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
25
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
26
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
27
|
+
import { MatInputModule } from '@angular/material/input';
|
|
28
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
29
|
+
|
|
30
|
+
class SelectionBasic {
|
|
31
|
+
constructor(id = 0, value = '') {
|
|
32
|
+
this.id = id;
|
|
33
|
+
this.value = value;
|
|
34
|
+
}
|
|
35
|
+
static adapt(item) {
|
|
36
|
+
return new SelectionBasic(item?.id, (item?.value) ? item.value : item);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class SelectionItem {
|
|
41
|
+
constructor(id = crypto.randomUUID(), value = '', disabled, selected) {
|
|
42
|
+
this.id = id;
|
|
43
|
+
this.value = value;
|
|
44
|
+
this.disabled = disabled;
|
|
45
|
+
this.selected = selected;
|
|
46
|
+
}
|
|
47
|
+
static adapt(item) {
|
|
48
|
+
return new SelectionItem(item?.id, (item?.value) ? item.value : item, (item?.disabled) ? true : false, (item?.selected) ? true : false);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Public API Surface of selections
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
class RemoveUnderscorePipe {
|
|
57
|
+
transform(value) {
|
|
58
|
+
return value ? value.replace(/_/g, " ") : value;
|
|
59
|
+
}
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoveUnderscorePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
61
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: RemoveUnderscorePipe, isStandalone: true, name: "removeUnderscore" }); }
|
|
62
|
+
}
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoveUnderscorePipe, decorators: [{
|
|
64
|
+
type: Pipe,
|
|
65
|
+
args: [{
|
|
66
|
+
name: 'removeUnderscore',
|
|
67
|
+
standalone: true
|
|
68
|
+
}]
|
|
69
|
+
}] });
|
|
70
|
+
|
|
71
|
+
class ListSelectionInputComponent {
|
|
72
|
+
set minSelection(value) {
|
|
73
|
+
this._minSelection = (value) ? value : 0;
|
|
74
|
+
}
|
|
75
|
+
get minSelection() {
|
|
76
|
+
return this._minSelection;
|
|
77
|
+
}
|
|
78
|
+
set maxSelection(value) {
|
|
79
|
+
this._maxSelection = (value) ? value : 0;
|
|
80
|
+
}
|
|
81
|
+
get maxSelection() {
|
|
82
|
+
return this._maxSelection;
|
|
83
|
+
}
|
|
84
|
+
set multiple(value) {
|
|
85
|
+
this._multiple = (value) ? value : false;
|
|
86
|
+
}
|
|
87
|
+
get multiple() {
|
|
88
|
+
return this._multiple;
|
|
89
|
+
}
|
|
90
|
+
get isValid() {
|
|
91
|
+
return this.isValidRange(this.data);
|
|
92
|
+
}
|
|
93
|
+
set data(value) {
|
|
94
|
+
this.isObjects = this.hasObjects(value);
|
|
95
|
+
this._data = (value) ? value.map(item => SelectionItem.adapt(item)) : [];
|
|
96
|
+
const selectedObjects = this.data.filter(item => item.selected).map(item => item.value);
|
|
97
|
+
this.defaultDisabled = (!this.defaultDisabled) ? this.data.map(item => SelectionItem.adapt(item)).filter(item => item.disabled) : this.defaultDisabled;
|
|
98
|
+
if (this.multiple) {
|
|
99
|
+
const selected = (selectedObjects) ? selectedObjects : this.findFirst(selectedObjects);
|
|
100
|
+
this.selectionControl.patchValue(selected, { emitEvent: false });
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const selected = (selectedObjects.length === 0 && value.length > 0) ? [value[0]] : this.findFirst(selectedObjects);
|
|
104
|
+
this.selectionControl.patchValue(selected, { emitEvent: false });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
get data() {
|
|
108
|
+
return this._data;
|
|
109
|
+
}
|
|
110
|
+
constructor() {
|
|
111
|
+
this.fb = inject(FormBuilder);
|
|
112
|
+
this.selectionControl = this.fb.control([], Validators.required);
|
|
113
|
+
this._minSelection = 0;
|
|
114
|
+
this._maxSelection = 0;
|
|
115
|
+
this._multiple = false;
|
|
116
|
+
this.defaultDisabled = [];
|
|
117
|
+
this.appearance = 'outline';
|
|
118
|
+
this._data = [];
|
|
119
|
+
this.selectionChange = new EventEmitter();
|
|
120
|
+
this.disabled = false;
|
|
121
|
+
this.formInitialized = false;
|
|
122
|
+
this.isArray = (obj) => Array.isArray(obj);
|
|
123
|
+
this.hasObjects = (obj) => (this.isArray(obj) && obj.length > 0) ? this.isObject(obj[0]) : false;
|
|
124
|
+
this.isObject = (obj) => typeof obj === 'object' && obj !== null && !Array.isArray(obj);
|
|
125
|
+
this.findFirst = (obj) => {
|
|
126
|
+
const found = this.data.find(item => obj.includes(item.value));
|
|
127
|
+
return (found) ? found.value : null;
|
|
128
|
+
};
|
|
129
|
+
this.onChange = () => { };
|
|
130
|
+
this.onTouch = () => { };
|
|
131
|
+
this.isObjects = false;
|
|
132
|
+
this.invalid = false;
|
|
133
|
+
this.updateSelection = (newData) => newData.filter(item => !item.selected).map(item => {
|
|
134
|
+
const dis = this.defaultDisabled.map(item => item.value);
|
|
135
|
+
return (dis.includes(item.value)) ? item.disabled = true : item.disabled = false;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
ngOnInit() {
|
|
139
|
+
if (this.multiple) {
|
|
140
|
+
this.defaultDisabled = this.data.filter(item => item.disabled);
|
|
141
|
+
if (this.minSelection > 0 && this.minSelection > this.maxSelection) {
|
|
142
|
+
this.minSelection = this.maxSelection !== 0 ? this.maxSelection : this.minSelection;
|
|
143
|
+
}
|
|
144
|
+
else if (this.maxSelection > 0 && this.maxSelection < this.minSelection) {
|
|
145
|
+
this.maxSelection = this.minSelection;
|
|
146
|
+
}
|
|
147
|
+
this.maxSelection = this.maxSelection || this.data.length;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
ngAfterViewInit() {
|
|
151
|
+
this.formInitialized = true;
|
|
152
|
+
}
|
|
153
|
+
writeValue(value) {
|
|
154
|
+
const selected = (this.isArray(value) && value.length > 1) ? this.findFirst(value) : value;
|
|
155
|
+
this.data
|
|
156
|
+
.map(item => {
|
|
157
|
+
item.selected = (value && value.includes(item.value)) ? true : false;
|
|
158
|
+
return item;
|
|
159
|
+
});
|
|
160
|
+
if (selected) {
|
|
161
|
+
if (this.multiple) {
|
|
162
|
+
this.selectionControl.patchValue(value, { emitEvent: false });
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
if (!value || value.length === 0)
|
|
166
|
+
return;
|
|
167
|
+
this.selectionControl.patchValue(this.findFirst(value), { emitEvent: false });
|
|
168
|
+
this.selectionControl.markAsDirty({ onlySelf: true });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (this.formInitialized && !this.selectionControl.pristine) {
|
|
172
|
+
if (value === null)
|
|
173
|
+
this.selectionControl.reset();
|
|
174
|
+
this.selectionControl.markAsDirty({ onlySelf: true });
|
|
175
|
+
this.selectionControl.markAllAsTouched();
|
|
176
|
+
}
|
|
177
|
+
else if (this.formInitialized && this.selectionControl.pristine) {
|
|
178
|
+
if (value === null)
|
|
179
|
+
this.selectionControl.reset();
|
|
180
|
+
}
|
|
181
|
+
this.formInitialized = true;
|
|
182
|
+
}
|
|
183
|
+
validate(control) {
|
|
184
|
+
const isRequired = control.hasValidator(Validators.required) ? true : false;
|
|
185
|
+
let errors = { 'minRequired': false, 'maxExceeded': false };
|
|
186
|
+
if (!isRequired)
|
|
187
|
+
this.selectionControl.clearValidators();
|
|
188
|
+
if (this.minSelection > 0)
|
|
189
|
+
this.selectionControl.addValidators(Validators.minLength(this.minSelection));
|
|
190
|
+
const hasValue = (!this.selectionControl.value || this.selectionControl.value?.length === 0);
|
|
191
|
+
if (this.minSelection > 0) {
|
|
192
|
+
const hasMin = (this.selectionControl.value?.length + 1 <= this.minSelection) ? true : false;
|
|
193
|
+
errors.minRequired = hasMin;
|
|
194
|
+
}
|
|
195
|
+
if (this.maxSelection > 0) {
|
|
196
|
+
const hasMax = (this.selectionControl.value?.length >= this.maxSelection) ? true : false;
|
|
197
|
+
errors.maxExceeded = hasMax;
|
|
198
|
+
}
|
|
199
|
+
const hasErrors = this.selectedValues(errors, true).length > 0;
|
|
200
|
+
const values = this.selectedValues(this.selectionControl.value || [], true).length;
|
|
201
|
+
const hasValues = (this.minSelection > 0 && values > this.minSelection) || (this.maxSelection > 0 && values < this.maxSelection);
|
|
202
|
+
const finalErrors = (isRequired && !hasValues && hasErrors) ? errors : null;
|
|
203
|
+
return finalErrors;
|
|
204
|
+
}
|
|
205
|
+
registerOnChange(fn) {
|
|
206
|
+
this.onChange = fn;
|
|
207
|
+
}
|
|
208
|
+
registerOnTouched(fn) {
|
|
209
|
+
this.onTouch = fn;
|
|
210
|
+
}
|
|
211
|
+
setDisabledState(isDisabled) {
|
|
212
|
+
this.disabled = isDisabled;
|
|
213
|
+
if (this.disabled) {
|
|
214
|
+
this.selectionControl.disable();
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
this.selectionControl.enable();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
onSelection(selection) {
|
|
221
|
+
this.invalid = false;
|
|
222
|
+
if (this.multiple) {
|
|
223
|
+
const checkboxSelected = selection.value;
|
|
224
|
+
const newData = this.data.map(item => SelectionItem.adapt(item));
|
|
225
|
+
newData.map(item => item.selected = checkboxSelected.includes(item.value) ? true : false);
|
|
226
|
+
if (this.isValidRange(newData))
|
|
227
|
+
this.data = newData;
|
|
228
|
+
const curSelected = this.data.filter(item => item.selected).length;
|
|
229
|
+
const prevSelected = newData.filter(item => item.selected).length;
|
|
230
|
+
if (curSelected > this.maxSelection) {
|
|
231
|
+
this.updateSelection(newData);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
if (prevSelected < curSelected) {
|
|
235
|
+
this.updateSelection(newData);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
if (curSelected >= this.maxSelection) {
|
|
239
|
+
const dis = this.defaultDisabled.map(item => item.value);
|
|
240
|
+
newData.filter(item => !item.selected).map(item => {
|
|
241
|
+
return item.disabled = (dis.includes(item.value)) ? item.disabled : !item.disabled;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
this.updateSelection(newData);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
this.data = newData;
|
|
250
|
+
const sel = this.data.filter(item => item.selected).map(item => item.value);
|
|
251
|
+
this.selectionControl.patchValue(sel, { emitEvent: false });
|
|
252
|
+
}
|
|
253
|
+
selection = (selection?.value) ? selection.value : selection;
|
|
254
|
+
const selected = (this.multiple) ? this.isArray(selection) ? selection : [selection] : [selection];
|
|
255
|
+
const data = this.data.map(({ id, value }) => ({ id, value }));
|
|
256
|
+
const newData = data.filter((item) => selected.includes(item.value));
|
|
257
|
+
const selectedData = (this.isObjects) ? newData : newData.map(({ value }) => value);
|
|
258
|
+
this.selectionControl.markAllAsTouched();
|
|
259
|
+
this.selectionChange.emit(data);
|
|
260
|
+
this.onChange(selectedData);
|
|
261
|
+
}
|
|
262
|
+
findControlDisabled(control) {
|
|
263
|
+
const found = this.data.find(item => item.value === control);
|
|
264
|
+
const disabled = (found?.disabled) ? found.disabled : false;
|
|
265
|
+
return disabled;
|
|
266
|
+
}
|
|
267
|
+
isValidRange(data) {
|
|
268
|
+
const selected = data.filter(item => item.selected).length;
|
|
269
|
+
if (this.multiple) {
|
|
270
|
+
const isMin = (this.minSelection !== 0) ? selected >= this.minSelection : true;
|
|
271
|
+
const isMax = (this.maxSelection !== 0) ? selected <= this.maxSelection : true;
|
|
272
|
+
return isMin && isMax;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
return selected > 0;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
selectedValues(obj, state = false) {
|
|
279
|
+
return Object.entries(obj).filter(([key, value]) => value === state).map(([key, _]) => key);
|
|
280
|
+
}
|
|
281
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
282
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ListSelectionInputComponent, selector: "app-list-selection-input", inputs: { label: "label", placeholder: "placeholder", minSelection: "minSelection", maxSelection: "maxSelection", multiple: "multiple", appearance: "appearance", data: "data" }, outputs: { selectionChange: "selectionChange" }, providers: [
|
|
283
|
+
{
|
|
284
|
+
provide: NG_VALUE_ACCESSOR,
|
|
285
|
+
useExisting: forwardRef(() => ListSelectionInputComponent),
|
|
286
|
+
multi: true
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
provide: NG_VALIDATORS,
|
|
290
|
+
useExisting: forwardRef(() => ListSelectionInputComponent),
|
|
291
|
+
multi: true
|
|
292
|
+
}
|
|
293
|
+
], ngImport: i0, template: "<div style=\"display: flex; flex-direction: column;\">\n <div style=\"margin-bottom: .5rem; display: flex; flex-direction: column;\">\n <mat-label style=\"font-size: larger;\">\n {{ label }}\n </mat-label>\n </div>\n <ng-container *ngIf=\"data && data.length > 0; else NODATA\">\n <mat-form-field\n style=\"display: flex;\"\n [appearance]=\"appearance\"\n >\n <mat-select\n [formControl]=\"selectionControl\"\n (selectionChange)=\"onSelection($event)\"\n [multiple]=\"multiple\"\n [placeholder]=\"placeholder||''\"\n >\n <mat-option\n *ngFor=\"let option of data\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{option.value}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </ng-container>\n <ng-template #NODATA>\n <div class=\"wrapper\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n</div>\n\n", styles: [".wrapper:not(:empty)+.default{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "panelWidth", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }] }); }
|
|
294
|
+
}
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputComponent, decorators: [{
|
|
296
|
+
type: Component,
|
|
297
|
+
args: [{ selector: 'app-list-selection-input', providers: [
|
|
298
|
+
{
|
|
299
|
+
provide: NG_VALUE_ACCESSOR,
|
|
300
|
+
useExisting: forwardRef(() => ListSelectionInputComponent),
|
|
301
|
+
multi: true
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
provide: NG_VALIDATORS,
|
|
305
|
+
useExisting: forwardRef(() => ListSelectionInputComponent),
|
|
306
|
+
multi: true
|
|
307
|
+
}
|
|
308
|
+
], template: "<div style=\"display: flex; flex-direction: column;\">\n <div style=\"margin-bottom: .5rem; display: flex; flex-direction: column;\">\n <mat-label style=\"font-size: larger;\">\n {{ label }}\n </mat-label>\n </div>\n <ng-container *ngIf=\"data && data.length > 0; else NODATA\">\n <mat-form-field\n style=\"display: flex;\"\n [appearance]=\"appearance\"\n >\n <mat-select\n [formControl]=\"selectionControl\"\n (selectionChange)=\"onSelection($event)\"\n [multiple]=\"multiple\"\n [placeholder]=\"placeholder||''\"\n >\n <mat-option\n *ngFor=\"let option of data\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{option.value}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </ng-container>\n <ng-template #NODATA>\n <div class=\"wrapper\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n</div>\n\n", styles: [".wrapper:not(:empty)+.default{display:none}\n"] }]
|
|
309
|
+
}], ctorParameters: function () { return []; }, propDecorators: { label: [{
|
|
310
|
+
type: Input
|
|
311
|
+
}], placeholder: [{
|
|
312
|
+
type: Input
|
|
313
|
+
}], minSelection: [{
|
|
314
|
+
type: Input
|
|
315
|
+
}], maxSelection: [{
|
|
316
|
+
type: Input
|
|
317
|
+
}], multiple: [{
|
|
318
|
+
type: Input
|
|
319
|
+
}], appearance: [{
|
|
320
|
+
type: Input
|
|
321
|
+
}], data: [{
|
|
322
|
+
type: Input
|
|
323
|
+
}], selectionChange: [{
|
|
324
|
+
type: Output
|
|
325
|
+
}] } });
|
|
326
|
+
|
|
327
|
+
class ListSelectionInputDemoComponent {
|
|
328
|
+
constructor() {
|
|
329
|
+
this.fb = inject(FormBuilder);
|
|
330
|
+
this.data_1 = [
|
|
331
|
+
{ id: 11, value: 'Telus' },
|
|
332
|
+
{ id: 12, value: 'AT&T', disabled: true },
|
|
333
|
+
{ id: 14, value: 'Bell', selected: true },
|
|
334
|
+
{ id: 63, value: 'Rogers', selected: true }
|
|
335
|
+
];
|
|
336
|
+
this.data_2 = ['Telus', 'AT&T', 'Bell', 'Rogers'];
|
|
337
|
+
// SELECTIONS
|
|
338
|
+
this.selectionControl_1 = this.fb.control(null, Validators.required);
|
|
339
|
+
this.selectionControl_2 = this.fb.control(null, Validators.required);
|
|
340
|
+
this.selectionControl_3 = this.fb.control(null, Validators.required);
|
|
341
|
+
this.selectionControl_4 = this.fb.control(null);
|
|
342
|
+
this.selectionControl_5 = this.fb.control(null);
|
|
343
|
+
this.selectionControl_6 = this.fb.control(null, Validators.required);
|
|
344
|
+
this.selectionControl_7 = this.fb.control(null, Validators.required);
|
|
345
|
+
this.selectionControl_8 = this.fb.control(null, Validators.required);
|
|
346
|
+
//CHANGE DETECTION
|
|
347
|
+
this.changeDetection_1 = this.fb.control(false);
|
|
348
|
+
this.changeDetection_2 = this.fb.control(false);
|
|
349
|
+
this.changeDetection_3 = this.fb.control(false);
|
|
350
|
+
this.changeDetection_4 = this.fb.control(false);
|
|
351
|
+
this.changeDetection_5 = this.fb.control(false);
|
|
352
|
+
this.changeDetection_6 = this.fb.control(false);
|
|
353
|
+
this.changeDetection_7 = this.fb.control(false);
|
|
354
|
+
this.changeDetection_8 = this.fb.control(false);
|
|
355
|
+
this.data = this.data_2;
|
|
356
|
+
}
|
|
357
|
+
ngOnInit() {
|
|
358
|
+
// SELECTIONS
|
|
359
|
+
this.selectionControl_1.valueChanges.subscribe(data => {
|
|
360
|
+
if (this.changeDetection_1.value)
|
|
361
|
+
console.log('CHANGE:', data);
|
|
362
|
+
});
|
|
363
|
+
this.selectionControl_2.valueChanges.subscribe(data => {
|
|
364
|
+
if (this.changeDetection_2.value)
|
|
365
|
+
console.log('CHANGE:', data);
|
|
366
|
+
});
|
|
367
|
+
this.selectionControl_3.valueChanges.subscribe(data => {
|
|
368
|
+
if (this.changeDetection_3.value)
|
|
369
|
+
console.log('CHANGE:', data);
|
|
370
|
+
});
|
|
371
|
+
this.selectionControl_4.valueChanges.subscribe(data => {
|
|
372
|
+
if (this.changeDetection_4.value)
|
|
373
|
+
console.log('CHANGE:', data);
|
|
374
|
+
});
|
|
375
|
+
this.selectionControl_5.valueChanges.subscribe(data => {
|
|
376
|
+
if (this.changeDetection_5.value)
|
|
377
|
+
console.log('CHANGE:', data);
|
|
378
|
+
});
|
|
379
|
+
this.selectionControl_6.valueChanges.subscribe(data => {
|
|
380
|
+
if (this.changeDetection_6.value)
|
|
381
|
+
console.log('CHANGE:', data);
|
|
382
|
+
});
|
|
383
|
+
this.selectionControl_7.valueChanges.subscribe(data => {
|
|
384
|
+
if (this.changeDetection_7.value)
|
|
385
|
+
console.log('CHANGE:', data);
|
|
386
|
+
});
|
|
387
|
+
this.selectionControl_8.valueChanges.subscribe(data => {
|
|
388
|
+
if (this.changeDetection_8.value)
|
|
389
|
+
console.log('CHANGE:', data);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
onPerformPatch() {
|
|
393
|
+
this.selectionControl_1.patchValue(['Bell']);
|
|
394
|
+
this.selectionControl_2.patchValue(['AT&T']);
|
|
395
|
+
this.selectionControl_3.patchValue(['Telus']);
|
|
396
|
+
this.selectionControl_4.patchValue(['Rogers']);
|
|
397
|
+
this.selectionControl_5.patchValue(['Bell']);
|
|
398
|
+
this.selectionControl_6.patchValue(['AT&T']);
|
|
399
|
+
this.selectionControl_7.patchValue(['Telus']);
|
|
400
|
+
this.selectionControl_8.patchValue(['Rogers']);
|
|
401
|
+
}
|
|
402
|
+
onChangeDataType(type) {
|
|
403
|
+
if (type === 'strings') {
|
|
404
|
+
this.data = this.data_2; //strings
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
this.data = this.data_1; //objects
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
// DISABLE
|
|
411
|
+
onDisabled_1(disable) {
|
|
412
|
+
if (disable) {
|
|
413
|
+
this.selectionControl_1.disable();
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
this.selectionControl_1.enable();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
onDisabled_2(disable) {
|
|
420
|
+
if (disable) {
|
|
421
|
+
this.selectionControl_2.disable();
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
this.selectionControl_2.enable();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
onDisabled_3(disable) {
|
|
428
|
+
if (disable) {
|
|
429
|
+
this.selectionControl_3.disable();
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
this.selectionControl_3.enable();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
onDisabled_4(disable) {
|
|
436
|
+
if (disable) {
|
|
437
|
+
this.selectionControl_4.disable();
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
this.selectionControl_4.enable();
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
onDisabled_5(disable) {
|
|
444
|
+
if (disable) {
|
|
445
|
+
this.selectionControl_5.disable();
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
this.selectionControl_5.enable();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
onDisabled_6(disable) {
|
|
452
|
+
if (disable) {
|
|
453
|
+
this.selectionControl_6.disable();
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
this.selectionControl_6.enable();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
onDisabled_7(disable) {
|
|
460
|
+
if (disable) {
|
|
461
|
+
this.selectionControl_7.disable();
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.selectionControl_7.enable();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
onDisabled_8(disable) {
|
|
468
|
+
if (disable) {
|
|
469
|
+
this.selectionControl_8.disable();
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
this.selectionControl_8.enable();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
476
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ListSelectionInputDemoComponent, selector: "app-list-selection-demo", ngImport: i0, template: "<div style=\"display: flex;\">\n <h1>List Selection FormControl</h1>\n <div style=\"flex:1; text-align: right;\">\n <div style=\"display: flex; gap: 2rem; flex-direction: row-reverse;\">\n <mat-button-toggle (click)=\"onPerformPatch()\">Patch</mat-button-toggle>\n\n <mat-button-toggle-group #varTypes=\"matButtonToggleGroup\" (change)=\"onChangeDataType(varTypes.value)\">\n <mat-button-toggle value=\"strings\" checked=\"true\">Strings</mat-button-toggle>\n <mat-button-toggle value=\"objects\" checked=\"false\">Objects</mat-button-toggle>\n </mat-button-toggle-group>\n </div>\n </div>\n</div>\n\n<h3>No Data - Projection of Error</h3>\n<app-list-selection-input error=\"No Data Provided\">\n <h3 style=\"color: red; margin-top: 0; margin-bottom: 0;\">No Data</h3>\n</app-list-selection-input>\n\n<div style=\"margin-top: 2rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n</div>\n\n<div>\n <h3 style=\"margin-bottom: 0;\">Single Selection - {{ varTypes.value | uppercase }}</h3>\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_1.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_1\"\n ></app-list-selection-input>\n <div *ngIf=\"error1.checked\">\n <mat-error *ngIf=\"selectionControl_1.hasError('minRequired')\">You must have a minimun of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_1.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_1.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_1\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error1>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable1 (change)=\"onDisabled_1(disable1.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n No Label or Placeholder<br>\n Required<br>\n Valid {{ selectionControl_1.valid }}<br>\n </div>\n </div>\n\n <div style=\"margin-top: 2rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_2.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_2\"\n label=\"Providers\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error2.checked\">\n <mat-error *ngIf=\"selectionControl_2.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_2.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_2.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_2\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error2>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable2 (change)=\"onDisabled_2(disable2.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Label and Placeholder<br>\n Required<br>\n Valid {{ selectionControl_2.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_3.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_3\"\n label=\"Providers\"\n placeholder=\"Select Provider\"\n appearance=\"fill\"\n ></app-list-selection-input>\n <div *ngIf=\"error3.checked\">\n <mat-error *ngIf=\"selectionControl_3.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_3.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_3.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_3\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error3>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable3 (change)=\"onDisabled_3(disable3.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Label and Placeholder<br>\n Appearance is Fill<br>\n Required<br>\n Valid {{ selectionControl_3.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i5$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "component", type: i6.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i7.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }, { kind: "component", type: ListSelectionInputComponent, selector: "app-list-selection-input", inputs: ["label", "placeholder", "minSelection", "maxSelection", "multiple", "appearance", "data"], outputs: ["selectionChange"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }] }); }
|
|
477
|
+
}
|
|
478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputDemoComponent, decorators: [{
|
|
479
|
+
type: Component,
|
|
480
|
+
args: [{ selector: 'app-list-selection-demo', template: "<div style=\"display: flex;\">\n <h1>List Selection FormControl</h1>\n <div style=\"flex:1; text-align: right;\">\n <div style=\"display: flex; gap: 2rem; flex-direction: row-reverse;\">\n <mat-button-toggle (click)=\"onPerformPatch()\">Patch</mat-button-toggle>\n\n <mat-button-toggle-group #varTypes=\"matButtonToggleGroup\" (change)=\"onChangeDataType(varTypes.value)\">\n <mat-button-toggle value=\"strings\" checked=\"true\">Strings</mat-button-toggle>\n <mat-button-toggle value=\"objects\" checked=\"false\">Objects</mat-button-toggle>\n </mat-button-toggle-group>\n </div>\n </div>\n</div>\n\n<h3>No Data - Projection of Error</h3>\n<app-list-selection-input error=\"No Data Provided\">\n <h3 style=\"color: red; margin-top: 0; margin-bottom: 0;\">No Data</h3>\n</app-list-selection-input>\n\n<div style=\"margin-top: 2rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n</div>\n\n<div>\n <h3 style=\"margin-bottom: 0;\">Single Selection - {{ varTypes.value | uppercase }}</h3>\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_1.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_1\"\n ></app-list-selection-input>\n <div *ngIf=\"error1.checked\">\n <mat-error *ngIf=\"selectionControl_1.hasError('minRequired')\">You must have a minimun of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_1.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_1.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_1\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error1>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable1 (change)=\"onDisabled_1(disable1.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n No Label or Placeholder<br>\n Required<br>\n Valid {{ selectionControl_1.valid }}<br>\n </div>\n </div>\n\n <div style=\"margin-top: 2rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_2.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_2\"\n label=\"Providers\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error2.checked\">\n <mat-error *ngIf=\"selectionControl_2.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_2.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_2.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_2\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error2>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable2 (change)=\"onDisabled_2(disable2.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Label and Placeholder<br>\n Required<br>\n Valid {{ selectionControl_2.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_3.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_3\"\n label=\"Providers\"\n placeholder=\"Select Provider\"\n appearance=\"fill\"\n ></app-list-selection-input>\n <div *ngIf=\"error3.checked\">\n <mat-error *ngIf=\"selectionControl_3.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_3.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_3.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_3\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error3>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable3 (change)=\"onDisabled_3(disable3.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Label and Placeholder<br>\n Appearance is Fill<br>\n Required<br>\n Valid {{ selectionControl_3.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n</div>\n\n" }]
|
|
481
|
+
}], ctorParameters: function () { return []; } });
|
|
482
|
+
|
|
483
|
+
class ListMultiSelectionDemoComponent {
|
|
484
|
+
constructor() {
|
|
485
|
+
this.fb = inject(FormBuilder);
|
|
486
|
+
this.data_1 = [
|
|
487
|
+
{ id: 11, value: 'Telus' },
|
|
488
|
+
{ id: 12, value: 'AT&T', disabled: true },
|
|
489
|
+
{ id: 14, value: 'Bell', selected: true },
|
|
490
|
+
{ id: 63, value: 'Rogers', selected: true }
|
|
491
|
+
];
|
|
492
|
+
this.data_2 = ['Telus', 'AT&T', 'Bell', 'Rogers'];
|
|
493
|
+
// SELECTIONS
|
|
494
|
+
this.selectionControl_1 = this.fb.control(null, Validators.required);
|
|
495
|
+
this.selectionControl_2 = this.fb.control(null, Validators.required);
|
|
496
|
+
this.selectionControl_3 = this.fb.control(null, Validators.required);
|
|
497
|
+
this.selectionControl_4 = this.fb.control(null);
|
|
498
|
+
this.selectionControl_5 = this.fb.control(null);
|
|
499
|
+
this.selectionControl_6 = this.fb.control(null, Validators.required);
|
|
500
|
+
this.selectionControl_7 = this.fb.control(null, Validators.required);
|
|
501
|
+
this.selectionControl_8 = this.fb.control(null, Validators.required);
|
|
502
|
+
//CHANGE DETECTION
|
|
503
|
+
this.changeDetection_1 = this.fb.control(false);
|
|
504
|
+
this.changeDetection_2 = this.fb.control(false);
|
|
505
|
+
this.changeDetection_3 = this.fb.control(false);
|
|
506
|
+
this.changeDetection_4 = this.fb.control(false);
|
|
507
|
+
this.changeDetection_5 = this.fb.control(false);
|
|
508
|
+
this.changeDetection_6 = this.fb.control(false);
|
|
509
|
+
this.changeDetection_7 = this.fb.control(false);
|
|
510
|
+
this.changeDetection_8 = this.fb.control(false);
|
|
511
|
+
this.data = this.data_2;
|
|
512
|
+
}
|
|
513
|
+
ngOnInit() {
|
|
514
|
+
// SELECTIONS
|
|
515
|
+
this.selectionControl_1.valueChanges.subscribe(data => {
|
|
516
|
+
if (this.changeDetection_1.value)
|
|
517
|
+
console.log('CHANGE:', data);
|
|
518
|
+
});
|
|
519
|
+
this.selectionControl_2.valueChanges.subscribe(data => {
|
|
520
|
+
if (this.changeDetection_2.value)
|
|
521
|
+
console.log('CHANGE:', data);
|
|
522
|
+
});
|
|
523
|
+
this.selectionControl_3.valueChanges.subscribe(data => {
|
|
524
|
+
if (this.changeDetection_3.value)
|
|
525
|
+
console.log('CHANGE:', data);
|
|
526
|
+
});
|
|
527
|
+
this.selectionControl_4.valueChanges.subscribe(data => {
|
|
528
|
+
if (this.changeDetection_4.value)
|
|
529
|
+
console.log('CHANGE:', data);
|
|
530
|
+
});
|
|
531
|
+
this.selectionControl_5.valueChanges.subscribe(data => {
|
|
532
|
+
if (this.changeDetection_5.value)
|
|
533
|
+
console.log('CHANGE:', data);
|
|
534
|
+
});
|
|
535
|
+
this.selectionControl_6.valueChanges.subscribe(data => {
|
|
536
|
+
if (this.changeDetection_6.value)
|
|
537
|
+
console.log('CHANGE:', data);
|
|
538
|
+
});
|
|
539
|
+
this.selectionControl_7.valueChanges.subscribe(data => {
|
|
540
|
+
if (this.changeDetection_7.value)
|
|
541
|
+
console.log('CHANGE:', data);
|
|
542
|
+
});
|
|
543
|
+
this.selectionControl_8.valueChanges.subscribe(data => {
|
|
544
|
+
if (this.changeDetection_8.value)
|
|
545
|
+
console.log('CHANGE:', data);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
onPerformPatch() {
|
|
549
|
+
this.selectionControl_1.patchValue(['Bell']);
|
|
550
|
+
this.selectionControl_2.patchValue(['AT&T']);
|
|
551
|
+
this.selectionControl_3.patchValue(['Telus']);
|
|
552
|
+
this.selectionControl_4.patchValue(['Rogers']);
|
|
553
|
+
this.selectionControl_5.patchValue(['Bell']);
|
|
554
|
+
this.selectionControl_6.patchValue(['AT&T']);
|
|
555
|
+
this.selectionControl_7.patchValue(['Telus']);
|
|
556
|
+
this.selectionControl_8.patchValue(['Rogers']);
|
|
557
|
+
}
|
|
558
|
+
onChangeDataType(type) {
|
|
559
|
+
if (type === 'strings') {
|
|
560
|
+
this.data = this.data_2; //strings
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
this.data = this.data_1; //objects
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
// DISABLE
|
|
567
|
+
onDisabled_1(disable) {
|
|
568
|
+
if (disable) {
|
|
569
|
+
this.selectionControl_1.disable();
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
this.selectionControl_1.enable();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
onDisabled_2(disable) {
|
|
576
|
+
if (disable) {
|
|
577
|
+
this.selectionControl_2.disable();
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
this.selectionControl_2.enable();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
onDisabled_3(disable) {
|
|
584
|
+
if (disable) {
|
|
585
|
+
this.selectionControl_3.disable();
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
this.selectionControl_3.enable();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
onDisabled_4(disable) {
|
|
592
|
+
if (disable) {
|
|
593
|
+
this.selectionControl_4.disable();
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
this.selectionControl_4.enable();
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
onDisabled_5(disable) {
|
|
600
|
+
if (disable) {
|
|
601
|
+
this.selectionControl_5.disable();
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
this.selectionControl_5.enable();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
onDisabled_6(disable) {
|
|
608
|
+
if (disable) {
|
|
609
|
+
this.selectionControl_6.disable();
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
this.selectionControl_6.enable();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
onDisabled_7(disable) {
|
|
616
|
+
if (disable) {
|
|
617
|
+
this.selectionControl_7.disable();
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
this.selectionControl_7.enable();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
onDisabled_8(disable) {
|
|
624
|
+
if (disable) {
|
|
625
|
+
this.selectionControl_8.disable();
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
this.selectionControl_8.enable();
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListMultiSelectionDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
632
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ListMultiSelectionDemoComponent, selector: "app-list-multi-selection-demo", ngImport: i0, template: "<div style=\"display: flex;\">\n <h1>Multi List Selection FormControl</h1>\n <div style=\"flex:1; text-align: right;\">\n <div style=\"display: flex; gap: 2rem; flex-direction: row-reverse;\">\n <mat-button-toggle (click)=\"onPerformPatch()\">Patch</mat-button-toggle>\n\n <mat-button-toggle-group #varTypes=\"matButtonToggleGroup\" (change)=\"onChangeDataType(varTypes.value)\">\n <mat-button-toggle value=\"strings\" checked=\"true\">Strings</mat-button-toggle>\n <mat-button-toggle value=\"objects\" checked=\"false\">Objects</mat-button-toggle>\n </mat-button-toggle-group>\n </div>\n </div>\n</div>\n\n<h3>No Data - Projection of Error</h3>\n<app-list-selection-input error=\"No Data Provided\">\n <h3 style=\"color: red; margin-top: 0; margin-bottom: 0;\">No Data</h3>\n</app-list-selection-input>\n\n<div style=\"margin-top: 2rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n</div>\n\n<div>\n <h3 style=\"margin-bottom: 0;\">Multi Selection - {{ varTypes.value | uppercase }}</h3>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_4.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_4\"\n [multiple]=\"true\"\n ></app-list-selection-input>\n <div *ngIf=\"error4.checked\">\n <mat-error *ngIf=\"selectionControl_4.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_4.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_4.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_4\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error4>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable4 (change)=\"onDisabled_4(disable4.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n No Label and Placeholder<br>\n Not Required<br>\n Valid {{ selectionControl_4.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_5.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_5\"\n [multiple]=\"true\"\n [data]=\"data\"\n label=\"Sample Selection\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error5.checked\">\n <mat-error *ngIf=\"selectionControl_5.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_5.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_5.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_5\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error5>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable5 (change)=\"onDisabled_5(disable5.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Label and Placeholder<br>\n Not Required<br>\n Valid {{ selectionControl_5.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_6.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_6\"\n [multiple]=\"true\"\n [data]=\"data\"\n placeholder=\"Select Provider\"\n [minSelection]=\"2\"\n ></app-list-selection-input>\n <div *ngIf=\"error6.checked\">\n <mat-error *ngIf=\"selectionControl_6.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_6.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_6.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_6\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error6>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable6 (change)=\"onDisabled_6(disable6.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Placeholder<br>\n Required<br>\n Minimum of 2 Required<br>\n Valid {{ selectionControl_6.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_7.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_7\"\n [multiple]=\"true\"\n [data]=\"data\"\n [maxSelection]=\"2\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error7.checked\">\n <mat-error *ngIf=\"selectionControl_7.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_7.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_7.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_7\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error7>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable7 (change)=\"onDisabled_7(disable7.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Placeholder<br>\n Required<br>\n Maximum of 2 Required<br>\n Valid {{ selectionControl_7.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_8.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_8\"\n [multiple]=\"true\"\n [data]=\"data\"\n [minSelection]=\"1\"\n [maxSelection]=\"2\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error8.checked\">\n <mat-error *ngIf=\"selectionControl_8.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_8.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_8.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_8\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error8>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable8 (change)=\"onDisabled_8(disable8.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Placeholder<br>\n Required<br>\n Minimum of 1 Required<br>\n Maximum of 2 Required<br>\n Valid {{ selectionControl_8.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i5$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "component", type: i6.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i7.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }, { kind: "component", type: ListSelectionInputComponent, selector: "app-list-selection-input", inputs: ["label", "placeholder", "minSelection", "maxSelection", "multiple", "appearance", "data"], outputs: ["selectionChange"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }] }); }
|
|
633
|
+
}
|
|
634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListMultiSelectionDemoComponent, decorators: [{
|
|
635
|
+
type: Component,
|
|
636
|
+
args: [{ selector: 'app-list-multi-selection-demo', template: "<div style=\"display: flex;\">\n <h1>Multi List Selection FormControl</h1>\n <div style=\"flex:1; text-align: right;\">\n <div style=\"display: flex; gap: 2rem; flex-direction: row-reverse;\">\n <mat-button-toggle (click)=\"onPerformPatch()\">Patch</mat-button-toggle>\n\n <mat-button-toggle-group #varTypes=\"matButtonToggleGroup\" (change)=\"onChangeDataType(varTypes.value)\">\n <mat-button-toggle value=\"strings\" checked=\"true\">Strings</mat-button-toggle>\n <mat-button-toggle value=\"objects\" checked=\"false\">Objects</mat-button-toggle>\n </mat-button-toggle-group>\n </div>\n </div>\n</div>\n\n<h3>No Data - Projection of Error</h3>\n<app-list-selection-input error=\"No Data Provided\">\n <h3 style=\"color: red; margin-top: 0; margin-bottom: 0;\">No Data</h3>\n</app-list-selection-input>\n\n<div style=\"margin-top: 2rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n</div>\n\n<div>\n <h3 style=\"margin-bottom: 0;\">Multi Selection - {{ varTypes.value | uppercase }}</h3>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_4.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [data]=\"data\"\n [formControl]=\"selectionControl_4\"\n [multiple]=\"true\"\n ></app-list-selection-input>\n <div *ngIf=\"error4.checked\">\n <mat-error *ngIf=\"selectionControl_4.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_4.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_4.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 1rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_4\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error4>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable4 (change)=\"onDisabled_4(disable4.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n No Label and Placeholder<br>\n Not Required<br>\n Valid {{ selectionControl_4.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_5.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_5\"\n [multiple]=\"true\"\n [data]=\"data\"\n label=\"Sample Selection\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error5.checked\">\n <mat-error *ngIf=\"selectionControl_5.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_5.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_5.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_5\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error5>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable5 (change)=\"onDisabled_5(disable5.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Label and Placeholder<br>\n Not Required<br>\n Valid {{ selectionControl_5.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_6.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_6\"\n [multiple]=\"true\"\n [data]=\"data\"\n placeholder=\"Select Provider\"\n [minSelection]=\"2\"\n ></app-list-selection-input>\n <div *ngIf=\"error6.checked\">\n <mat-error *ngIf=\"selectionControl_6.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_6.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_6.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_6\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error6>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable6 (change)=\"onDisabled_6(disable6.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Placeholder<br>\n Required<br>\n Minimum of 2 Required<br>\n Valid {{ selectionControl_6.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_7.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_7\"\n [multiple]=\"true\"\n [data]=\"data\"\n [maxSelection]=\"2\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error7.checked\">\n <mat-error *ngIf=\"selectionControl_7.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_7.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_7.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_7\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error7>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable7 (change)=\"onDisabled_7(disable7.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Placeholder<br>\n Required<br>\n Maximum of 2 Required<br>\n Valid {{ selectionControl_7.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n <div>\n <div style=\"display: flex;\">\n <span style=\"flex:1\"></span>\n <button mat-button (click)=\"selectionControl_8.reset()\">Reset</button>\n </div>\n <app-list-selection-input\n [formControl]=\"selectionControl_8\"\n [multiple]=\"true\"\n [data]=\"data\"\n [minSelection]=\"1\"\n [maxSelection]=\"2\"\n placeholder=\"Select Provider\"\n ></app-list-selection-input>\n <div *ngIf=\"error8.checked\">\n <mat-error *ngIf=\"selectionControl_8.hasError('minRequired')\">You must have a minimum of 1 selected</mat-error>\n <mat-error *ngIf=\"selectionControl_8.hasError('maxExceeded')\">maximum reached</mat-error>\n <mat-error *ngIf=\"selectionControl_8.hasError('required')\">This field is Required</mat-error>\n </div>\n <div style=\"display: flex; gap: 2rem; margin-top: 2rem;\">\n <mat-slide-toggle [formControl]=\"changeDetection_8\">Change Detection</mat-slide-toggle>\n <mat-slide-toggle #error8>Display Error</mat-slide-toggle>\n <mat-slide-toggle #disable8 (change)=\"onDisabled_8(disable8.checked)\">Disable</mat-slide-toggle>\n <span style=\"flex:1\"></span>\n </div>\n <div style=\"margin-top: 2rem;\">\n Placeholder<br>\n Required<br>\n Minimum of 1 Required<br>\n Maximum of 2 Required<br>\n Valid {{ selectionControl_8.valid }}<br>\n </div>\n <div style=\"margin-top: .5rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n </div>\n\n</div>\n\n" }]
|
|
637
|
+
}], ctorParameters: function () { return []; } });
|
|
638
|
+
|
|
639
|
+
class ListSelectionInputModule {
|
|
640
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
641
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputModule, declarations: [ListSelectionInputDemoComponent,
|
|
642
|
+
ListMultiSelectionDemoComponent,
|
|
643
|
+
ListSelectionInputComponent], imports: [CommonModule,
|
|
644
|
+
FormsModule,
|
|
645
|
+
ReactiveFormsModule,
|
|
646
|
+
MatSliderModule,
|
|
647
|
+
MatButtonModule,
|
|
648
|
+
MatIconModule,
|
|
649
|
+
MatFormFieldModule,
|
|
650
|
+
MatToolbarModule,
|
|
651
|
+
MatCheckboxModule,
|
|
652
|
+
MatMenuModule,
|
|
653
|
+
MatButtonToggleModule,
|
|
654
|
+
MatDividerModule,
|
|
655
|
+
MatRadioModule,
|
|
656
|
+
MatInputModule,
|
|
657
|
+
MatAutocompleteModule,
|
|
658
|
+
RemoveUnderscorePipe,
|
|
659
|
+
MatSelectModule,
|
|
660
|
+
MatOptionModule,
|
|
661
|
+
MatSlideToggleModule], exports: [ListSelectionInputDemoComponent,
|
|
662
|
+
ListMultiSelectionDemoComponent,
|
|
663
|
+
ListSelectionInputComponent] }); }
|
|
664
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputModule, imports: [CommonModule,
|
|
665
|
+
FormsModule,
|
|
666
|
+
ReactiveFormsModule,
|
|
667
|
+
MatSliderModule,
|
|
668
|
+
MatButtonModule,
|
|
669
|
+
MatIconModule,
|
|
670
|
+
MatFormFieldModule,
|
|
671
|
+
MatToolbarModule,
|
|
672
|
+
MatCheckboxModule,
|
|
673
|
+
MatMenuModule,
|
|
674
|
+
MatButtonToggleModule,
|
|
675
|
+
MatDividerModule,
|
|
676
|
+
MatRadioModule,
|
|
677
|
+
MatInputModule,
|
|
678
|
+
MatAutocompleteModule,
|
|
679
|
+
MatSelectModule,
|
|
680
|
+
MatOptionModule,
|
|
681
|
+
MatSlideToggleModule] }); }
|
|
682
|
+
}
|
|
683
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ListSelectionInputModule, decorators: [{
|
|
684
|
+
type: NgModule,
|
|
685
|
+
args: [{
|
|
686
|
+
imports: [
|
|
687
|
+
CommonModule,
|
|
688
|
+
FormsModule,
|
|
689
|
+
ReactiveFormsModule,
|
|
690
|
+
MatSliderModule,
|
|
691
|
+
MatButtonModule,
|
|
692
|
+
MatIconModule,
|
|
693
|
+
MatFormFieldModule,
|
|
694
|
+
MatToolbarModule,
|
|
695
|
+
MatCheckboxModule,
|
|
696
|
+
MatMenuModule,
|
|
697
|
+
MatButtonToggleModule,
|
|
698
|
+
MatDividerModule,
|
|
699
|
+
MatRadioModule,
|
|
700
|
+
MatInputModule,
|
|
701
|
+
MatAutocompleteModule,
|
|
702
|
+
RemoveUnderscorePipe,
|
|
703
|
+
MatSelectModule,
|
|
704
|
+
MatOptionModule,
|
|
705
|
+
MatSlideToggleModule,
|
|
706
|
+
],
|
|
707
|
+
declarations: [
|
|
708
|
+
ListSelectionInputDemoComponent,
|
|
709
|
+
ListMultiSelectionDemoComponent,
|
|
710
|
+
ListSelectionInputComponent,
|
|
711
|
+
],
|
|
712
|
+
exports: [
|
|
713
|
+
ListSelectionInputDemoComponent,
|
|
714
|
+
ListMultiSelectionDemoComponent,
|
|
715
|
+
ListSelectionInputComponent,
|
|
716
|
+
]
|
|
717
|
+
}]
|
|
718
|
+
}] });
|
|
719
|
+
|
|
720
|
+
/*
|
|
721
|
+
* Public API Surface of checkbox-selection-input
|
|
722
|
+
*/
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Generated bundle index. Do not edit.
|
|
726
|
+
*/
|
|
727
|
+
|
|
728
|
+
export { ListMultiSelectionDemoComponent, ListSelectionInputComponent, ListSelectionInputDemoComponent, ListSelectionInputModule, RemoveUnderscorePipe, SelectionBasic, SelectionItem };
|
|
729
|
+
//# sourceMappingURL=list-selection-input.mjs.map
|