@ngx-formly/material 6.0.0-next.1 → 6.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/checkbox/checkbox.module.d.ts +10 -0
- package/checkbox/checkbox.type.d.ts +3 -0
- package/checkbox/ngx-formly-material-checkbox.d.ts +1 -0
- package/checkbox/package.json +5 -6
- package/datepicker/datepicker.module.d.ts +11 -0
- package/datepicker/datepicker.type.d.ts +3 -0
- package/datepicker/ngx-formly-material-datepicker.d.ts +1 -1
- package/datepicker/package.json +5 -6
- package/esm2020/checkbox/checkbox.module.mjs +61 -0
- package/esm2020/checkbox/checkbox.type.mjs +109 -0
- package/{esm2015/checkbox/ngx-formly-material-checkbox.js → esm2020/checkbox/ngx-formly-material-checkbox.mjs} +0 -0
- package/{esm2015/checkbox/public_api.js → esm2020/checkbox/public_api.mjs} +0 -0
- package/esm2020/datepicker/datepicker.module.mjs +57 -0
- package/esm2020/datepicker/datepicker.type.mjs +117 -0
- package/esm2020/datepicker/ngx-formly-material-datepicker.mjs +5 -0
- package/{esm2015/datepicker/public_api.js → esm2020/datepicker/public_api.mjs} +0 -0
- package/esm2020/form-field/field.type.mjs +124 -0
- package/esm2020/form-field/form-field.module.mjs +47 -0
- package/esm2020/form-field/form-field.wrapper.mjs +141 -0
- package/esm2020/form-field/ngx-formly-material-form-field.mjs +5 -0
- package/{esm2015/form-field/public_api.js → esm2020/form-field/public_api.mjs} +0 -0
- package/esm2020/input/input.module.mjs +91 -0
- package/esm2020/input/input.type.mjs +79 -0
- package/{esm2015/input/ngx-formly-material-input.js → esm2020/input/ngx-formly-material-input.mjs} +0 -0
- package/{esm2015/input/public_api.js → esm2020/input/public_api.mjs} +0 -0
- package/{esm2015/lib/ui-material.js → esm2020/lib/ui-material.mjs} +0 -0
- package/esm2020/lib/ui-material.module.mjs +43 -0
- package/esm2020/multicheckbox/multicheckbox.module.mjs +57 -0
- package/esm2020/multicheckbox/multicheckbox.type.mjs +82 -0
- package/{esm2015/multicheckbox/ngx-formly-material-multicheckbox.js → esm2020/multicheckbox/ngx-formly-material-multicheckbox.mjs} +0 -0
- package/{esm2015/multicheckbox/public_api.js → esm2020/multicheckbox/public_api.mjs} +0 -0
- package/esm2020/native-select/native-select.module.mjs +57 -0
- package/esm2020/native-select/native-select.type.mjs +97 -0
- package/{esm2015/native-select/ngx-formly-material-native-select.js → esm2020/native-select/ngx-formly-material-native-select.mjs} +0 -0
- package/{esm2015/native-select/public_api.js → esm2020/native-select/public_api.mjs} +0 -0
- package/{esm2015/ngx-formly-material.js → esm2020/ngx-formly-material.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/{esm2015/radio/ngx-formly-material-radio.js → esm2020/radio/ngx-formly-material-radio.mjs} +0 -0
- package/{esm2015/radio/public_api.js → esm2020/radio/public_api.mjs} +0 -0
- package/esm2020/radio/radio.module.mjs +57 -0
- package/esm2020/radio/radio.type.mjs +89 -0
- package/{esm2015/select/ngx-formly-material-select.js → esm2020/select/ngx-formly-material-select.mjs} +0 -0
- package/{esm2015/select/public_api.js → esm2020/select/public_api.mjs} +0 -0
- package/esm2020/select/select.module.mjs +63 -0
- package/esm2020/select/select.type.mjs +151 -0
- package/{esm2015/slider/ngx-formly-material-slider.js → esm2020/slider/ngx-formly-material-slider.mjs} +1 -2
- package/{esm2015/slider/public_api.js → esm2020/slider/public_api.mjs} +0 -0
- package/esm2020/slider/slider.module.mjs +53 -0
- package/esm2020/slider/slider.type.mjs +79 -0
- package/{esm2015/textarea/ngx-formly-material-textarea.js → esm2020/textarea/ngx-formly-material-textarea.mjs} +0 -0
- package/{esm2015/textarea/public_api.js → esm2020/textarea/public_api.mjs} +0 -0
- package/esm2020/textarea/textarea.module.mjs +53 -0
- package/esm2020/textarea/textarea.type.mjs +77 -0
- package/{esm2015/toggle/ngx-formly-material-toggle.js → esm2020/toggle/ngx-formly-material-toggle.mjs} +1 -2
- package/{esm2015/toggle/public_api.js → esm2020/toggle/public_api.mjs} +0 -0
- package/esm2020/toggle/toggle.module.mjs +53 -0
- package/esm2020/toggle/toggle.type.mjs +61 -0
- package/fesm2015/ngx-formly-material-checkbox.mjs +171 -0
- package/fesm2015/ngx-formly-material-checkbox.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-datepicker.mjs +177 -0
- package/fesm2015/ngx-formly-material-datepicker.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-form-field.mjs +312 -0
- package/fesm2015/ngx-formly-material-form-field.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-input.mjs +172 -0
- package/fesm2015/ngx-formly-material-input.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-multicheckbox.mjs +140 -0
- package/fesm2015/ngx-formly-material-multicheckbox.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-native-select.mjs +156 -0
- package/fesm2015/ngx-formly-material-native-select.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-radio.mjs +146 -0
- package/fesm2015/ngx-formly-material-radio.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-select.mjs +219 -0
- package/fesm2015/ngx-formly-material-select.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-slider.mjs +133 -0
- package/fesm2015/ngx-formly-material-slider.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-textarea.mjs +131 -0
- package/fesm2015/ngx-formly-material-textarea.mjs.map +1 -0
- package/fesm2015/ngx-formly-material-toggle.mjs +115 -0
- package/fesm2015/ngx-formly-material-toggle.mjs.map +1 -0
- package/fesm2015/ngx-formly-material.mjs +55 -0
- package/fesm2015/ngx-formly-material.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-checkbox.mjs +171 -0
- package/fesm2020/ngx-formly-material-checkbox.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-datepicker.mjs +176 -0
- package/fesm2020/ngx-formly-material-datepicker.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-form-field.mjs +309 -0
- package/fesm2020/ngx-formly-material-form-field.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-input.mjs +172 -0
- package/fesm2020/ngx-formly-material-input.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-multicheckbox.mjs +140 -0
- package/fesm2020/ngx-formly-material-multicheckbox.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-native-select.mjs +156 -0
- package/fesm2020/ngx-formly-material-native-select.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-radio.mjs +146 -0
- package/fesm2020/ngx-formly-material-radio.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-select.mjs +216 -0
- package/fesm2020/ngx-formly-material-select.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-slider.mjs +133 -0
- package/fesm2020/ngx-formly-material-slider.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-textarea.mjs +131 -0
- package/fesm2020/ngx-formly-material-textarea.mjs.map +1 -0
- package/fesm2020/ngx-formly-material-toggle.mjs +115 -0
- package/fesm2020/ngx-formly-material-toggle.mjs.map +1 -0
- package/fesm2020/ngx-formly-material.mjs +55 -0
- package/fesm2020/ngx-formly-material.mjs.map +1 -0
- package/form-field/field.type.d.ts +3 -0
- package/form-field/form-field.module.d.ts +9 -0
- package/form-field/form-field.wrapper.d.ts +4 -3
- package/form-field/ngx-formly-material-form-field.d.ts +1 -1
- package/form-field/package.json +5 -6
- package/input/input.module.d.ts +10 -0
- package/input/input.type.d.ts +3 -0
- package/input/ngx-formly-material-input.d.ts +1 -0
- package/input/package.json +5 -6
- package/lib/ui-material.module.d.ts +11 -0
- package/multicheckbox/multicheckbox.module.d.ts +11 -0
- package/multicheckbox/multicheckbox.type.d.ts +3 -0
- package/multicheckbox/ngx-formly-material-multicheckbox.d.ts +1 -0
- package/multicheckbox/package.json +5 -6
- package/native-select/native-select.module.d.ts +11 -0
- package/native-select/native-select.type.d.ts +3 -0
- package/native-select/ngx-formly-material-native-select.d.ts +1 -0
- package/native-select/package.json +5 -6
- package/ngx-formly-material.d.ts +1 -0
- package/package.json +109 -9
- package/radio/ngx-formly-material-radio.d.ts +1 -0
- package/radio/package.json +5 -6
- package/radio/radio.module.d.ts +11 -0
- package/radio/radio.type.d.ts +3 -0
- package/select/ngx-formly-material-select.d.ts +1 -0
- package/select/package.json +5 -6
- package/select/select.module.d.ts +12 -0
- package/select/select.type.d.ts +5 -1
- package/slider/ngx-formly-material-slider.d.ts +1 -1
- package/slider/package.json +5 -6
- package/slider/slider.module.d.ts +10 -0
- package/slider/slider.type.d.ts +3 -0
- package/textarea/ngx-formly-material-textarea.d.ts +1 -0
- package/textarea/package.json +5 -6
- package/textarea/textarea.module.d.ts +10 -0
- package/textarea/textarea.type.d.ts +3 -0
- package/toggle/ngx-formly-material-toggle.d.ts +1 -1
- package/toggle/package.json +5 -6
- package/toggle/toggle.module.d.ts +10 -0
- package/toggle/toggle.type.d.ts +3 -0
- package/bundles/ngx-formly-material-checkbox.umd.js +0 -423
- package/bundles/ngx-formly-material-checkbox.umd.js.map +0 -1
- package/bundles/ngx-formly-material-checkbox.umd.min.js +0 -16
- package/bundles/ngx-formly-material-checkbox.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-datepicker.umd.js +0 -392
- package/bundles/ngx-formly-material-datepicker.umd.js.map +0 -1
- package/bundles/ngx-formly-material-datepicker.umd.min.js +0 -16
- package/bundles/ngx-formly-material-datepicker.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-form-field.umd.js +0 -575
- package/bundles/ngx-formly-material-form-field.umd.js.map +0 -1
- package/bundles/ngx-formly-material-form-field.umd.min.js +0 -16
- package/bundles/ngx-formly-material-form-field.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-input.umd.js +0 -393
- package/bundles/ngx-formly-material-input.umd.js.map +0 -1
- package/bundles/ngx-formly-material-input.umd.min.js +0 -16
- package/bundles/ngx-formly-material-input.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-multicheckbox.umd.js +0 -397
- package/bundles/ngx-formly-material-multicheckbox.umd.js.map +0 -1
- package/bundles/ngx-formly-material-multicheckbox.umd.min.js +0 -16
- package/bundles/ngx-formly-material-multicheckbox.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-native-select.umd.js +0 -374
- package/bundles/ngx-formly-material-native-select.umd.js.map +0 -1
- package/bundles/ngx-formly-material-native-select.umd.min.js +0 -16
- package/bundles/ngx-formly-material-native-select.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-radio.umd.js +0 -398
- package/bundles/ngx-formly-material-radio.umd.js.map +0 -1
- package/bundles/ngx-formly-material-radio.umd.min.js +0 -16
- package/bundles/ngx-formly-material-radio.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-select.umd.js +0 -411
- package/bundles/ngx-formly-material-select.umd.js.map +0 -1
- package/bundles/ngx-formly-material-select.umd.min.js +0 -16
- package/bundles/ngx-formly-material-select.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-slider.umd.js +0 -382
- package/bundles/ngx-formly-material-slider.umd.js.map +0 -1
- package/bundles/ngx-formly-material-slider.umd.min.js +0 -16
- package/bundles/ngx-formly-material-slider.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-textarea.umd.js +0 -379
- package/bundles/ngx-formly-material-textarea.umd.js.map +0 -1
- package/bundles/ngx-formly-material-textarea.umd.min.js +0 -16
- package/bundles/ngx-formly-material-textarea.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material-toggle.umd.js +0 -382
- package/bundles/ngx-formly-material-toggle.umd.js.map +0 -1
- package/bundles/ngx-formly-material-toggle.umd.min.js +0 -16
- package/bundles/ngx-formly-material-toggle.umd.min.js.map +0 -1
- package/bundles/ngx-formly-material.umd.js +0 -45
- package/bundles/ngx-formly-material.umd.js.map +0 -1
- package/bundles/ngx-formly-material.umd.min.js +0 -2
- package/bundles/ngx-formly-material.umd.min.js.map +0 -1
- package/checkbox/ngx-formly-material-checkbox.metadata.json +0 -1
- package/datepicker/ngx-formly-material-datepicker.metadata.json +0 -1
- package/esm2015/checkbox/checkbox.module.js +0 -34
- package/esm2015/checkbox/checkbox.type.js +0 -80
- package/esm2015/datepicker/datepicker.module.js +0 -32
- package/esm2015/datepicker/datepicker.type.js +0 -73
- package/esm2015/datepicker/ngx-formly-material-datepicker.js +0 -6
- package/esm2015/form-field/field.type.js +0 -120
- package/esm2015/form-field/form-field.module.js +0 -27
- package/esm2015/form-field/form-field.wrapper.js +0 -91
- package/esm2015/form-field/ngx-formly-material-form-field.js +0 -6
- package/esm2015/input/input.module.js +0 -49
- package/esm2015/input/input.type.js +0 -43
- package/esm2015/lib/ui-material.module.js +0 -24
- package/esm2015/multicheckbox/multicheckbox.module.js +0 -32
- package/esm2015/multicheckbox/multicheckbox.type.js +0 -59
- package/esm2015/native-select/native-select.module.js +0 -32
- package/esm2015/native-select/native-select.type.js +0 -54
- package/esm2015/radio/radio.module.js +0 -32
- package/esm2015/radio/radio.type.js +0 -62
- package/esm2015/select/select.module.js +0 -35
- package/esm2015/select/select.type.js +0 -95
- package/esm2015/slider/slider.module.js +0 -30
- package/esm2015/slider/slider.type.js +0 -44
- package/esm2015/textarea/textarea.module.js +0 -30
- package/esm2015/textarea/textarea.type.js +0 -46
- package/esm2015/toggle/toggle.module.js +0 -30
- package/esm2015/toggle/toggle.type.js +0 -41
- package/fesm2015/ngx-formly-material-checkbox.js +0 -117
- package/fesm2015/ngx-formly-material-checkbox.js.map +0 -1
- package/fesm2015/ngx-formly-material-datepicker.js +0 -109
- package/fesm2015/ngx-formly-material-datepicker.js.map +0 -1
- package/fesm2015/ngx-formly-material-form-field.js +0 -238
- package/fesm2015/ngx-formly-material-form-field.js.map +0 -1
- package/fesm2015/ngx-formly-material-input.js +0 -96
- package/fesm2015/ngx-formly-material-input.js.map +0 -1
- package/fesm2015/ngx-formly-material-multicheckbox.js +0 -94
- package/fesm2015/ngx-formly-material-multicheckbox.js.map +0 -1
- package/fesm2015/ngx-formly-material-native-select.js +0 -90
- package/fesm2015/ngx-formly-material-native-select.js.map +0 -1
- package/fesm2015/ngx-formly-material-radio.js +0 -96
- package/fesm2015/ngx-formly-material-radio.js.map +0 -1
- package/fesm2015/ngx-formly-material-select.js +0 -134
- package/fesm2015/ngx-formly-material-select.js.map +0 -1
- package/fesm2015/ngx-formly-material-slider.js +0 -77
- package/fesm2015/ngx-formly-material-slider.js.map +0 -1
- package/fesm2015/ngx-formly-material-textarea.js +0 -79
- package/fesm2015/ngx-formly-material-textarea.js.map +0 -1
- package/fesm2015/ngx-formly-material-toggle.js +0 -74
- package/fesm2015/ngx-formly-material-toggle.js.map +0 -1
- package/fesm2015/ngx-formly-material.js +0 -36
- package/fesm2015/ngx-formly-material.js.map +0 -1
- package/form-field/ngx-formly-material-form-field.metadata.json +0 -1
- package/input/ngx-formly-material-input.metadata.json +0 -1
- package/multicheckbox/ngx-formly-material-multicheckbox.metadata.json +0 -1
- package/native-select/ngx-formly-material-native-select.metadata.json +0 -1
- package/ngx-formly-material.metadata.json +0 -1
- package/radio/ngx-formly-material-radio.metadata.json +0 -1
- package/select/ngx-formly-material-select.metadata.json +0 -1
- package/slider/ngx-formly-material-slider.metadata.json +0 -1
- package/textarea/ngx-formly-material-textarea.metadata.json +0 -1
- package/toggle/ngx-formly-material-toggle.metadata.json +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, ViewChildren, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i3 from '@ngx-formly/core';
|
|
7
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
8
|
+
import * as i4 from '@ngx-formly/core/select';
|
|
9
|
+
import { FormlySelectModule } from '@ngx-formly/core/select';
|
|
10
|
+
import { FieldType, FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';
|
|
11
|
+
import * as i1 from '@angular/material/checkbox';
|
|
12
|
+
import { MatCheckbox, MatCheckboxModule } from '@angular/material/checkbox';
|
|
13
|
+
|
|
14
|
+
class FormlyFieldMultiCheckbox extends FieldType {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.defaultOptions = {
|
|
18
|
+
templateOptions: {
|
|
19
|
+
hideFieldUnderline: true,
|
|
20
|
+
floatLabel: 'always',
|
|
21
|
+
options: [],
|
|
22
|
+
color: 'accent', // workaround for https://github.com/angular/components/issues/18465
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
onChange(value, checked) {
|
|
27
|
+
if (this.to.type === 'array') {
|
|
28
|
+
this.formControl.patchValue(checked
|
|
29
|
+
? [...(this.formControl.value || []), value]
|
|
30
|
+
: [...(this.formControl.value || [])].filter((o) => o !== value));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.formControl.patchValue({ ...this.formControl.value, [value]: checked });
|
|
34
|
+
}
|
|
35
|
+
this.formControl.markAsTouched();
|
|
36
|
+
}
|
|
37
|
+
// TODO: find a solution to prevent scroll on focus
|
|
38
|
+
onContainerClick() { }
|
|
39
|
+
isChecked(option) {
|
|
40
|
+
const value = this.formControl.value;
|
|
41
|
+
return value && (this.to.type === 'array' ? value.indexOf(option.value) !== -1 : value[option.value]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
FormlyFieldMultiCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyFieldMultiCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
45
|
+
FormlyFieldMultiCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: FormlyFieldMultiCheckbox, selector: "formly-field-mat-multicheckbox", viewQueries: [{ propertyName: "checkboxes", predicate: MatCheckbox, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
46
|
+
<ng-container *ngFor="let option of to.options | formlySelectOptions: field | async; let i = index">
|
|
47
|
+
<mat-checkbox
|
|
48
|
+
[id]="id + '_' + i"
|
|
49
|
+
[formlyAttributes]="field"
|
|
50
|
+
[tabIndex]="to.tabindex"
|
|
51
|
+
[color]="to.color"
|
|
52
|
+
[labelPosition]="to.labelPosition"
|
|
53
|
+
[checked]="isChecked(option)"
|
|
54
|
+
[disabled]="formControl.disabled"
|
|
55
|
+
(change)="onChange(option.value, $event.checked)"
|
|
56
|
+
>
|
|
57
|
+
{{ option.label }}
|
|
58
|
+
</mat-checkbox>
|
|
59
|
+
</ng-container>
|
|
60
|
+
`, isInline: true, components: [{ type: i1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], pipes: { "async": i2.AsyncPipe, "formlySelectOptions": i4.ɵFormlySelectOptionsPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyFieldMultiCheckbox, decorators: [{
|
|
62
|
+
type: Component,
|
|
63
|
+
args: [{
|
|
64
|
+
selector: 'formly-field-mat-multicheckbox',
|
|
65
|
+
template: `
|
|
66
|
+
<ng-container *ngFor="let option of to.options | formlySelectOptions: field | async; let i = index">
|
|
67
|
+
<mat-checkbox
|
|
68
|
+
[id]="id + '_' + i"
|
|
69
|
+
[formlyAttributes]="field"
|
|
70
|
+
[tabIndex]="to.tabindex"
|
|
71
|
+
[color]="to.color"
|
|
72
|
+
[labelPosition]="to.labelPosition"
|
|
73
|
+
[checked]="isChecked(option)"
|
|
74
|
+
[disabled]="formControl.disabled"
|
|
75
|
+
(change)="onChange(option.value, $event.checked)"
|
|
76
|
+
>
|
|
77
|
+
{{ option.label }}
|
|
78
|
+
</mat-checkbox>
|
|
79
|
+
</ng-container>
|
|
80
|
+
`,
|
|
81
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
82
|
+
}]
|
|
83
|
+
}], propDecorators: { checkboxes: [{
|
|
84
|
+
type: ViewChildren,
|
|
85
|
+
args: [MatCheckbox]
|
|
86
|
+
}] } });
|
|
87
|
+
|
|
88
|
+
class FormlyMatMultiCheckboxModule {
|
|
89
|
+
}
|
|
90
|
+
FormlyMatMultiCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatMultiCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
91
|
+
FormlyMatMultiCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatMultiCheckboxModule, declarations: [FormlyFieldMultiCheckbox], imports: [CommonModule,
|
|
92
|
+
ReactiveFormsModule,
|
|
93
|
+
MatCheckboxModule,
|
|
94
|
+
FormlyMatFormFieldModule,
|
|
95
|
+
FormlySelectModule, i3.FormlyModule] });
|
|
96
|
+
FormlyMatMultiCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatMultiCheckboxModule, imports: [[
|
|
97
|
+
CommonModule,
|
|
98
|
+
ReactiveFormsModule,
|
|
99
|
+
MatCheckboxModule,
|
|
100
|
+
FormlyMatFormFieldModule,
|
|
101
|
+
FormlySelectModule,
|
|
102
|
+
FormlyModule.forChild({
|
|
103
|
+
types: [
|
|
104
|
+
{
|
|
105
|
+
name: 'multicheckbox',
|
|
106
|
+
component: FormlyFieldMultiCheckbox,
|
|
107
|
+
wrappers: ['form-field'],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
}),
|
|
111
|
+
]] });
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatMultiCheckboxModule, decorators: [{
|
|
113
|
+
type: NgModule,
|
|
114
|
+
args: [{
|
|
115
|
+
declarations: [FormlyFieldMultiCheckbox],
|
|
116
|
+
imports: [
|
|
117
|
+
CommonModule,
|
|
118
|
+
ReactiveFormsModule,
|
|
119
|
+
MatCheckboxModule,
|
|
120
|
+
FormlyMatFormFieldModule,
|
|
121
|
+
FormlySelectModule,
|
|
122
|
+
FormlyModule.forChild({
|
|
123
|
+
types: [
|
|
124
|
+
{
|
|
125
|
+
name: 'multicheckbox',
|
|
126
|
+
component: FormlyFieldMultiCheckbox,
|
|
127
|
+
wrappers: ['form-field'],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
}),
|
|
131
|
+
],
|
|
132
|
+
}]
|
|
133
|
+
}] });
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Generated bundle index. Do not edit.
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
export { FormlyFieldMultiCheckbox, FormlyMatMultiCheckboxModule };
|
|
140
|
+
//# sourceMappingURL=ngx-formly-material-multicheckbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-formly-material-multicheckbox.mjs","sources":["../../../../src/ui/material/multicheckbox/src/multicheckbox.type.ts","../../../../src/ui/material/multicheckbox/src/multicheckbox.module.ts","../../../../src/ui/material/multicheckbox/src/ngx-formly-material-multicheckbox.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, ViewChildren, QueryList } from '@angular/core';\nimport { FieldType } from '@ngx-formly/material/form-field';\nimport { MatCheckbox } from '@angular/material/checkbox';\n\n@Component({\n selector: 'formly-field-mat-multicheckbox',\n template: `\n <ng-container *ngFor=\"let option of to.options | formlySelectOptions: field | async; let i = index\">\n <mat-checkbox\n [id]=\"id + '_' + i\"\n [formlyAttributes]=\"field\"\n [tabIndex]=\"to.tabindex\"\n [color]=\"to.color\"\n [labelPosition]=\"to.labelPosition\"\n [checked]=\"isChecked(option)\"\n [disabled]=\"formControl.disabled\"\n (change)=\"onChange(option.value, $event.checked)\"\n >\n {{ option.label }}\n </mat-checkbox>\n </ng-container>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FormlyFieldMultiCheckbox extends FieldType {\n @ViewChildren(MatCheckbox) checkboxes!: QueryList<MatCheckbox>;\n\n defaultOptions = {\n templateOptions: {\n hideFieldUnderline: true,\n floatLabel: 'always' as const,\n options: [],\n color: 'accent' as const, // workaround for https://github.com/angular/components/issues/18465\n },\n };\n\n onChange(value: any, checked: boolean) {\n if (this.to.type === 'array') {\n this.formControl.patchValue(\n checked\n ? [...(this.formControl.value || []), value]\n : [...(this.formControl.value || [])].filter((o) => o !== value),\n );\n } else {\n this.formControl.patchValue({ ...this.formControl.value, [value]: checked });\n }\n this.formControl.markAsTouched();\n }\n\n // TODO: find a solution to prevent scroll on focus\n onContainerClick() {}\n\n isChecked(option: any) {\n const value = this.formControl.value;\n\n return value && (this.to.type === 'array' ? value.indexOf(option.value) !== -1 : value[option.value]);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormlySelectModule } from '@ngx-formly/core/select';\nimport { FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\n\nimport { FormlyFieldMultiCheckbox } from './multicheckbox.type';\n\n@NgModule({\n declarations: [FormlyFieldMultiCheckbox],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n\n MatCheckboxModule,\n\n FormlyMatFormFieldModule,\n FormlySelectModule,\n FormlyModule.forChild({\n types: [\n {\n name: 'multicheckbox',\n component: FormlyFieldMultiCheckbox,\n wrappers: ['form-field'],\n },\n ],\n }),\n ],\n})\nexport class FormlyMatMultiCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAwBa,wBAAyB,SAAQ,SAAS;IApBvD;;QAuBE,mBAAc,GAAG;YACf,eAAe,EAAE;gBACf,kBAAkB,EAAE,IAAI;gBACxB,UAAU,EAAE,QAAiB;gBAC7B,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,QAAiB;aACzB;SACF,CAAC;KAuBH;IArBC,QAAQ,CAAC,KAAU,EAAE,OAAgB;QACnC,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,OAAO,EAAE;YAC5B,IAAI,CAAC,WAAW,CAAC,UAAU,CACzB,OAAO;kBACH,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC;kBAC1C,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CACnE,CAAC;SACH;aAAM;YACL,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,OAAO,EAAE,CAAC,CAAC;SAC9E;QACD,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;KAClC;;IAGD,gBAAgB,MAAK;IAErB,SAAS,CAAC,MAAW;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QAErC,OAAO,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACvG;;qHAhCU,wBAAwB;yGAAxB,wBAAwB,qGACrB,WAAW,uEAnBf;;;;;;;;;;;;;;;GAeT;2FAGU,wBAAwB;kBApBpC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gCAAgC;oBAC1C,QAAQ,EAAE;;;;;;;;;;;;;;;GAeT;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;8BAE4B,UAAU;sBAApC,YAAY;uBAAC,WAAW;;;MCMd,4BAA4B;;yHAA5B,4BAA4B;0HAA5B,4BAA4B,iBApBxB,wBAAwB,aAErC,YAAY;QACZ,mBAAmB;QAEnB,iBAAiB;QAEjB,wBAAwB;QACxB,kBAAkB;0HAYT,4BAA4B,YAnB9B;YACP,YAAY;YACZ,mBAAmB;YAEnB,iBAAiB;YAEjB,wBAAwB;YACxB,kBAAkB;YAClB,YAAY,CAAC,QAAQ,CAAC;gBACpB,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,eAAe;wBACrB,SAAS,EAAE,wBAAwB;wBACnC,QAAQ,EAAE,CAAC,YAAY,CAAC;qBACzB;iBACF;aACF,CAAC;SACH;2FAEU,4BAA4B;kBArBxC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBAEnB,iBAAiB;wBAEjB,wBAAwB;wBACxB,kBAAkB;wBAClB,YAAY,CAAC,QAAQ,CAAC;4BACpB,KAAK,EAAE;gCACL;oCACE,IAAI,EAAE,eAAe;oCACrB,SAAS,EAAE,wBAAwB;oCACnC,QAAQ,EAAE,CAAC,YAAY,CAAC;iCACzB;6BACF;yBACF,CAAC;qBACH;iBACF;;;AC9BD;;;;;;"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
|
+
import * as i4 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i3 from '@ngx-formly/core';
|
|
6
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
7
|
+
import * as i5 from '@ngx-formly/core/select';
|
|
8
|
+
import { FormlySelectModule } from '@ngx-formly/core/select';
|
|
9
|
+
import * as i2 from '@angular/forms';
|
|
10
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
11
|
+
import { FieldType, FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';
|
|
12
|
+
import * as i1 from '@angular/material/input';
|
|
13
|
+
import { MatInputModule } from '@angular/material/input';
|
|
14
|
+
|
|
15
|
+
class FormlyFieldNativeSelect extends FieldType {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.defaultOptions = {
|
|
19
|
+
templateOptions: {
|
|
20
|
+
options: [],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
FormlyFieldNativeSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyFieldNativeSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
26
|
+
FormlyFieldNativeSelect.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: FormlyFieldNativeSelect, selector: "formly-field-mat-native-select", usesInheritance: true, ngImport: i0, template: `
|
|
27
|
+
<select
|
|
28
|
+
matNativeControl
|
|
29
|
+
[id]="id"
|
|
30
|
+
[readonly]="to.readonly"
|
|
31
|
+
[required]="to.required"
|
|
32
|
+
[errorStateMatcher]="errorStateMatcher"
|
|
33
|
+
[formControl]="formControl"
|
|
34
|
+
[formlyAttributes]="field"
|
|
35
|
+
>
|
|
36
|
+
<option *ngIf="to.placeholder" [ngValue]="undefined">{{ to.placeholder }}</option>
|
|
37
|
+
<ng-container *ngIf="to.options | formlySelectOptions: field | async as opts">
|
|
38
|
+
<ng-container *ngIf="to._flatOptions; else grouplist">
|
|
39
|
+
<ng-container *ngFor="let opt of opts">
|
|
40
|
+
<option [ngValue]="opt.value" [disabled]="opt.disabled">{{ opt.label }}</option>
|
|
41
|
+
</ng-container>
|
|
42
|
+
</ng-container>
|
|
43
|
+
|
|
44
|
+
<ng-template #grouplist>
|
|
45
|
+
<ng-container *ngFor="let opt of opts">
|
|
46
|
+
<option *ngIf="!opt.group; else optgroup" [ngValue]="opt.value" [disabled]="opt.disabled">
|
|
47
|
+
{{ opt.label }}
|
|
48
|
+
</option>
|
|
49
|
+
<ng-template #optgroup>
|
|
50
|
+
<optgroup [label]="opt.label">
|
|
51
|
+
<option *ngFor="let child of opt.group" [ngValue]="child.value" [disabled]="child.disabled">
|
|
52
|
+
{{ child.label }}
|
|
53
|
+
</option>
|
|
54
|
+
</optgroup>
|
|
55
|
+
</ng-template>
|
|
56
|
+
</ng-container>
|
|
57
|
+
</ng-template>
|
|
58
|
+
</ng-container>
|
|
59
|
+
</select>
|
|
60
|
+
`, isInline: true, directives: [{ type: i1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe, "formlySelectOptions": i5.ɵFormlySelectOptionsPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyFieldNativeSelect, decorators: [{
|
|
62
|
+
type: Component,
|
|
63
|
+
args: [{
|
|
64
|
+
selector: 'formly-field-mat-native-select',
|
|
65
|
+
template: `
|
|
66
|
+
<select
|
|
67
|
+
matNativeControl
|
|
68
|
+
[id]="id"
|
|
69
|
+
[readonly]="to.readonly"
|
|
70
|
+
[required]="to.required"
|
|
71
|
+
[errorStateMatcher]="errorStateMatcher"
|
|
72
|
+
[formControl]="formControl"
|
|
73
|
+
[formlyAttributes]="field"
|
|
74
|
+
>
|
|
75
|
+
<option *ngIf="to.placeholder" [ngValue]="undefined">{{ to.placeholder }}</option>
|
|
76
|
+
<ng-container *ngIf="to.options | formlySelectOptions: field | async as opts">
|
|
77
|
+
<ng-container *ngIf="to._flatOptions; else grouplist">
|
|
78
|
+
<ng-container *ngFor="let opt of opts">
|
|
79
|
+
<option [ngValue]="opt.value" [disabled]="opt.disabled">{{ opt.label }}</option>
|
|
80
|
+
</ng-container>
|
|
81
|
+
</ng-container>
|
|
82
|
+
|
|
83
|
+
<ng-template #grouplist>
|
|
84
|
+
<ng-container *ngFor="let opt of opts">
|
|
85
|
+
<option *ngIf="!opt.group; else optgroup" [ngValue]="opt.value" [disabled]="opt.disabled">
|
|
86
|
+
{{ opt.label }}
|
|
87
|
+
</option>
|
|
88
|
+
<ng-template #optgroup>
|
|
89
|
+
<optgroup [label]="opt.label">
|
|
90
|
+
<option *ngFor="let child of opt.group" [ngValue]="child.value" [disabled]="child.disabled">
|
|
91
|
+
{{ child.label }}
|
|
92
|
+
</option>
|
|
93
|
+
</optgroup>
|
|
94
|
+
</ng-template>
|
|
95
|
+
</ng-container>
|
|
96
|
+
</ng-template>
|
|
97
|
+
</ng-container>
|
|
98
|
+
</select>
|
|
99
|
+
`,
|
|
100
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
101
|
+
}]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
104
|
+
class FormlyMatNativeSelectModule {
|
|
105
|
+
}
|
|
106
|
+
FormlyMatNativeSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatNativeSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
107
|
+
FormlyMatNativeSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatNativeSelectModule, declarations: [FormlyFieldNativeSelect], imports: [CommonModule,
|
|
108
|
+
ReactiveFormsModule,
|
|
109
|
+
MatInputModule,
|
|
110
|
+
FormlyMatFormFieldModule,
|
|
111
|
+
FormlySelectModule, i3.FormlyModule] });
|
|
112
|
+
FormlyMatNativeSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatNativeSelectModule, imports: [[
|
|
113
|
+
CommonModule,
|
|
114
|
+
ReactiveFormsModule,
|
|
115
|
+
MatInputModule,
|
|
116
|
+
FormlyMatFormFieldModule,
|
|
117
|
+
FormlySelectModule,
|
|
118
|
+
FormlyModule.forChild({
|
|
119
|
+
types: [
|
|
120
|
+
{
|
|
121
|
+
name: 'native-select',
|
|
122
|
+
component: FormlyFieldNativeSelect,
|
|
123
|
+
wrappers: ['form-field'],
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
127
|
+
]] });
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatNativeSelectModule, decorators: [{
|
|
129
|
+
type: NgModule,
|
|
130
|
+
args: [{
|
|
131
|
+
declarations: [FormlyFieldNativeSelect],
|
|
132
|
+
imports: [
|
|
133
|
+
CommonModule,
|
|
134
|
+
ReactiveFormsModule,
|
|
135
|
+
MatInputModule,
|
|
136
|
+
FormlyMatFormFieldModule,
|
|
137
|
+
FormlySelectModule,
|
|
138
|
+
FormlyModule.forChild({
|
|
139
|
+
types: [
|
|
140
|
+
{
|
|
141
|
+
name: 'native-select',
|
|
142
|
+
component: FormlyFieldNativeSelect,
|
|
143
|
+
wrappers: ['form-field'],
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
}),
|
|
147
|
+
],
|
|
148
|
+
}]
|
|
149
|
+
}] });
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Generated bundle index. Do not edit.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
export { FormlyFieldNativeSelect, FormlyMatNativeSelectModule };
|
|
156
|
+
//# sourceMappingURL=ngx-formly-material-native-select.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-formly-material-native-select.mjs","sources":["../../../../src/ui/material/native-select/src/native-select.type.ts","../../../../src/ui/material/native-select/src/native-select.module.ts","../../../../src/ui/material/native-select/src/ngx-formly-material-native-select.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy } from '@angular/core';\nimport { FieldType } from '@ngx-formly/material/form-field';\n\n@Component({\n selector: 'formly-field-mat-native-select',\n template: `\n <select\n matNativeControl\n [id]=\"id\"\n [readonly]=\"to.readonly\"\n [required]=\"to.required\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n >\n <option *ngIf=\"to.placeholder\" [ngValue]=\"undefined\">{{ to.placeholder }}</option>\n <ng-container *ngIf=\"to.options | formlySelectOptions: field | async as opts\">\n <ng-container *ngIf=\"to._flatOptions; else grouplist\">\n <ng-container *ngFor=\"let opt of opts\">\n <option [ngValue]=\"opt.value\" [disabled]=\"opt.disabled\">{{ opt.label }}</option>\n </ng-container>\n </ng-container>\n\n <ng-template #grouplist>\n <ng-container *ngFor=\"let opt of opts\">\n <option *ngIf=\"!opt.group; else optgroup\" [ngValue]=\"opt.value\" [disabled]=\"opt.disabled\">\n {{ opt.label }}\n </option>\n <ng-template #optgroup>\n <optgroup [label]=\"opt.label\">\n <option *ngFor=\"let child of opt.group\" [ngValue]=\"child.value\" [disabled]=\"child.disabled\">\n {{ child.label }}\n </option>\n </optgroup>\n </ng-template>\n </ng-container>\n </ng-template>\n </ng-container>\n </select>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FormlyFieldNativeSelect extends FieldType {\n defaultOptions = {\n templateOptions: {\n options: [],\n },\n };\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormlySelectModule } from '@ngx-formly/core/select';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { FormlyFieldNativeSelect } from './native-select.type';\n\n@NgModule({\n declarations: [FormlyFieldNativeSelect],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n MatInputModule,\n\n FormlyMatFormFieldModule,\n FormlySelectModule,\n FormlyModule.forChild({\n types: [\n {\n name: 'native-select',\n component: FormlyFieldNativeSelect,\n wrappers: ['form-field'],\n },\n ],\n }),\n ],\n})\nexport class FormlyMatNativeSelectModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MA0Ca,uBAAwB,SAAQ,SAAS;IAvCtD;;QAwCE,mBAAc,GAAG;YACf,eAAe,EAAE;gBACf,OAAO,EAAE,EAAE;aACZ;SACF,CAAC;KACH;;oHANY,uBAAuB;wGAAvB,uBAAuB,6FArCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCT;2FAGU,uBAAuB;kBAvCnC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gCAAgC;oBAC1C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCT;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;;;MCVY,2BAA2B;;wHAA3B,2BAA2B;yHAA3B,2BAA2B,iBAnBvB,uBAAuB,aAEpC,YAAY;QACZ,mBAAmB;QACnB,cAAc;QAEd,wBAAwB;QACxB,kBAAkB;yHAYT,2BAA2B,YAlB7B;YACP,YAAY;YACZ,mBAAmB;YACnB,cAAc;YAEd,wBAAwB;YACxB,kBAAkB;YAClB,YAAY,CAAC,QAAQ,CAAC;gBACpB,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,eAAe;wBACrB,SAAS,EAAE,uBAAuB;wBAClC,QAAQ,EAAE,CAAC,YAAY,CAAC;qBACzB;iBACF;aACF,CAAC;SACH;2FAEU,2BAA2B;kBApBvC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,uBAAuB,CAAC;oBACvC,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,cAAc;wBAEd,wBAAwB;wBACxB,kBAAkB;wBAClB,YAAY,CAAC,QAAQ,CAAC;4BACpB,KAAK,EAAE;gCACL;oCACE,IAAI,EAAE,eAAe;oCACrB,SAAS,EAAE,uBAAuB;oCAClC,QAAQ,EAAE,CAAC,YAAY,CAAC;iCACzB;6BACF;yBACF,CAAC;qBACH;iBACF;;;AC9BD;;;;;;"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i4 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i3 from '@ngx-formly/core';
|
|
6
|
+
import { ɵobserve, FormlyModule } from '@ngx-formly/core';
|
|
7
|
+
import * as i2 from '@angular/forms';
|
|
8
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
9
|
+
import * as i5 from '@ngx-formly/core/select';
|
|
10
|
+
import { FormlySelectModule } from '@ngx-formly/core/select';
|
|
11
|
+
import { FieldType, FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';
|
|
12
|
+
import * as i1 from '@angular/material/radio';
|
|
13
|
+
import { MatRadioGroup, MatRadioModule } from '@angular/material/radio';
|
|
14
|
+
|
|
15
|
+
class FormlyFieldRadio extends FieldType {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.defaultOptions = {
|
|
19
|
+
templateOptions: {
|
|
20
|
+
hideFieldUnderline: true,
|
|
21
|
+
floatLabel: 'always',
|
|
22
|
+
options: [],
|
|
23
|
+
tabindex: -1,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
ngAfterViewInit() {
|
|
28
|
+
this.focusObserver = ɵobserve(this.field, ['focus'], ({ currentValue }) => {
|
|
29
|
+
if (this.to.tabindex === -1 && currentValue && this.radioGroup._radios.length > 0) {
|
|
30
|
+
// https://github.com/ngx-formly/ngx-formly/issues/2498
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
const radio = this.radioGroup.selected ? this.radioGroup.selected : this.radioGroup._radios.first;
|
|
33
|
+
radio.focus();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// TODO: find a solution to prevent scroll on focus
|
|
39
|
+
onContainerClick() { }
|
|
40
|
+
ngOnDestroy() {
|
|
41
|
+
this.focusObserver && this.focusObserver.unsubscribe();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
FormlyFieldRadio.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyFieldRadio, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
45
|
+
FormlyFieldRadio.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: FormlyFieldRadio, selector: "formly-field-mat-radio", viewQueries: [{ propertyName: "radioGroup", first: true, predicate: MatRadioGroup, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
46
|
+
<mat-radio-group
|
|
47
|
+
[formControl]="formControl"
|
|
48
|
+
[formlyAttributes]="field"
|
|
49
|
+
[required]="to.required"
|
|
50
|
+
[tabindex]="to.tabindex"
|
|
51
|
+
>
|
|
52
|
+
<mat-radio-button
|
|
53
|
+
*ngFor="let option of to.options | formlySelectOptions: field | async; let i = index"
|
|
54
|
+
[id]="id + '_' + i"
|
|
55
|
+
[color]="to.color"
|
|
56
|
+
[labelPosition]="to.labelPosition"
|
|
57
|
+
[disabled]="option.disabled"
|
|
58
|
+
[value]="option.value"
|
|
59
|
+
>
|
|
60
|
+
{{ option.label }}
|
|
61
|
+
</mat-radio-button>
|
|
62
|
+
</mat-radio-group>
|
|
63
|
+
`, isInline: true, components: [{ type: i1.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }], directives: [{ type: i1.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe, "formlySelectOptions": i5.ɵFormlySelectOptionsPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyFieldRadio, decorators: [{
|
|
65
|
+
type: Component,
|
|
66
|
+
args: [{
|
|
67
|
+
selector: 'formly-field-mat-radio',
|
|
68
|
+
template: `
|
|
69
|
+
<mat-radio-group
|
|
70
|
+
[formControl]="formControl"
|
|
71
|
+
[formlyAttributes]="field"
|
|
72
|
+
[required]="to.required"
|
|
73
|
+
[tabindex]="to.tabindex"
|
|
74
|
+
>
|
|
75
|
+
<mat-radio-button
|
|
76
|
+
*ngFor="let option of to.options | formlySelectOptions: field | async; let i = index"
|
|
77
|
+
[id]="id + '_' + i"
|
|
78
|
+
[color]="to.color"
|
|
79
|
+
[labelPosition]="to.labelPosition"
|
|
80
|
+
[disabled]="option.disabled"
|
|
81
|
+
[value]="option.value"
|
|
82
|
+
>
|
|
83
|
+
{{ option.label }}
|
|
84
|
+
</mat-radio-button>
|
|
85
|
+
</mat-radio-group>
|
|
86
|
+
`,
|
|
87
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
88
|
+
}]
|
|
89
|
+
}], propDecorators: { radioGroup: [{
|
|
90
|
+
type: ViewChild,
|
|
91
|
+
args: [MatRadioGroup, { static: true }]
|
|
92
|
+
}] } });
|
|
93
|
+
|
|
94
|
+
class FormlyMatRadioModule {
|
|
95
|
+
}
|
|
96
|
+
FormlyMatRadioModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
97
|
+
FormlyMatRadioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatRadioModule, declarations: [FormlyFieldRadio], imports: [CommonModule,
|
|
98
|
+
ReactiveFormsModule,
|
|
99
|
+
MatRadioModule,
|
|
100
|
+
FormlyMatFormFieldModule,
|
|
101
|
+
FormlySelectModule, i3.FormlyModule] });
|
|
102
|
+
FormlyMatRadioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatRadioModule, imports: [[
|
|
103
|
+
CommonModule,
|
|
104
|
+
ReactiveFormsModule,
|
|
105
|
+
MatRadioModule,
|
|
106
|
+
FormlyMatFormFieldModule,
|
|
107
|
+
FormlySelectModule,
|
|
108
|
+
FormlyModule.forChild({
|
|
109
|
+
types: [
|
|
110
|
+
{
|
|
111
|
+
name: 'radio',
|
|
112
|
+
component: FormlyFieldRadio,
|
|
113
|
+
wrappers: ['form-field'],
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
}),
|
|
117
|
+
]] });
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: FormlyMatRadioModule, decorators: [{
|
|
119
|
+
type: NgModule,
|
|
120
|
+
args: [{
|
|
121
|
+
declarations: [FormlyFieldRadio],
|
|
122
|
+
imports: [
|
|
123
|
+
CommonModule,
|
|
124
|
+
ReactiveFormsModule,
|
|
125
|
+
MatRadioModule,
|
|
126
|
+
FormlyMatFormFieldModule,
|
|
127
|
+
FormlySelectModule,
|
|
128
|
+
FormlyModule.forChild({
|
|
129
|
+
types: [
|
|
130
|
+
{
|
|
131
|
+
name: 'radio',
|
|
132
|
+
component: FormlyFieldRadio,
|
|
133
|
+
wrappers: ['form-field'],
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
}),
|
|
137
|
+
],
|
|
138
|
+
}]
|
|
139
|
+
}] });
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Generated bundle index. Do not edit.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
export { FormlyFieldRadio, FormlyMatRadioModule };
|
|
146
|
+
//# sourceMappingURL=ngx-formly-material-radio.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-formly-material-radio.mjs","sources":["../../../../src/ui/material/radio/src/radio.type.ts","../../../../src/ui/material/radio/src/radio.module.ts","../../../../src/ui/material/radio/src/ngx-formly-material-radio.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';\nimport { FieldType } from '@ngx-formly/material/form-field';\nimport { MatRadioGroup } from '@angular/material/radio';\nimport { ɵobserve as observe } from '@ngx-formly/core';\n\n@Component({\n selector: 'formly-field-mat-radio',\n template: `\n <mat-radio-group\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [required]=\"to.required\"\n [tabindex]=\"to.tabindex\"\n >\n <mat-radio-button\n *ngFor=\"let option of to.options | formlySelectOptions: field | async; let i = index\"\n [id]=\"id + '_' + i\"\n [color]=\"to.color\"\n [labelPosition]=\"to.labelPosition\"\n [disabled]=\"option.disabled\"\n [value]=\"option.value\"\n >\n {{ option.label }}\n </mat-radio-button>\n </mat-radio-group>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FormlyFieldRadio extends FieldType implements AfterViewInit, OnDestroy {\n @ViewChild(MatRadioGroup, { static: true }) radioGroup!: MatRadioGroup;\n defaultOptions = {\n templateOptions: {\n hideFieldUnderline: true,\n floatLabel: 'always' as const,\n options: [],\n tabindex: -1,\n },\n };\n\n private focusObserver!: ReturnType<typeof observe>;\n ngAfterViewInit() {\n this.focusObserver = observe(this.field, ['focus'], ({ currentValue }) => {\n if (this.to.tabindex === -1 && currentValue && this.radioGroup._radios.length > 0) {\n // https://github.com/ngx-formly/ngx-formly/issues/2498\n setTimeout(() => {\n const radio = this.radioGroup.selected ? this.radioGroup.selected : this.radioGroup._radios.first;\n radio.focus();\n });\n }\n });\n }\n\n // TODO: find a solution to prevent scroll on focus\n onContainerClick() {}\n\n ngOnDestroy() {\n this.focusObserver && this.focusObserver.unsubscribe();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlySelectModule } from '@ngx-formly/core/select';\n\nimport { FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';\nimport { MatRadioModule } from '@angular/material/radio';\n\nimport { FormlyFieldRadio } from './radio.type';\n\n@NgModule({\n declarations: [FormlyFieldRadio],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n MatRadioModule,\n\n FormlyMatFormFieldModule,\n FormlySelectModule,\n FormlyModule.forChild({\n types: [\n {\n name: 'radio',\n component: FormlyFieldRadio,\n wrappers: ['form-field'],\n },\n ],\n }),\n ],\n})\nexport class FormlyMatRadioModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["observe"],"mappings":";;;;;;;;;;;;;;MA4Ba,gBAAiB,SAAQ,SAAS;IAvB/C;;QAyBE,mBAAc,GAAG;YACf,eAAe,EAAE;gBACf,kBAAkB,EAAE,IAAI;gBACxB,UAAU,EAAE,QAAiB;gBAC7B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,CAAC,CAAC;aACb;SACF,CAAC;KAqBH;IAlBC,eAAe;QACb,IAAI,CAAC,aAAa,GAAGA,QAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE;YACnE,IAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,KAAK,CAAC,CAAC,IAAI,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;;gBAEjF,UAAU,CAAC;oBACT,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;oBAClG,KAAK,CAAC,KAAK,EAAE,CAAC;iBACf,CAAC,CAAC;aACJ;SACF,CAAC,CAAC;KACJ;;IAGD,gBAAgB,MAAK;IAErB,WAAW;QACT,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;KACxD;;6GA7BU,gBAAgB;iGAAhB,gBAAgB,0GAChB,aAAa,qFAtBd;;;;;;;;;;;;;;;;;;GAkBT;2FAGU,gBAAgB;kBAvB5B,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;GAkBT;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;8BAE6C,UAAU;sBAArD,SAAS;uBAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;MCE/B,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAnBhB,gBAAgB,aAE7B,YAAY;QACZ,mBAAmB;QACnB,cAAc;QAEd,wBAAwB;QACxB,kBAAkB;kHAYT,oBAAoB,YAlBtB;YACP,YAAY;YACZ,mBAAmB;YACnB,cAAc;YAEd,wBAAwB;YACxB,kBAAkB;YAClB,YAAY,CAAC,QAAQ,CAAC;gBACpB,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,OAAO;wBACb,SAAS,EAAE,gBAAgB;wBAC3B,QAAQ,EAAE,CAAC,YAAY,CAAC;qBACzB;iBACF;aACF,CAAC;SACH;2FAEU,oBAAoB;kBApBhC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,gBAAgB,CAAC;oBAChC,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,cAAc;wBAEd,wBAAwB;wBACxB,kBAAkB;wBAClB,YAAY,CAAC,QAAQ,CAAC;4BACpB,KAAK,EAAE;gCACL;oCACE,IAAI,EAAE,OAAO;oCACb,SAAS,EAAE,gBAAgB;oCAC3B,QAAQ,EAAE,CAAC,YAAY,CAAC;iCACzB;6BACF;yBACF,CAAC;qBACH;iBACF;;;AC9BD;;;;;;"}
|