@klippa/ngx-enhancy-forms 10.2.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/klippa-ngx-enhancy-forms.mjs +5 -0
- package/esm2020/lib/elements/button/button.component.mjs +57 -0
- package/esm2020/lib/elements/checkbox/checkbox.component.mjs +23 -0
- package/esm2020/lib/elements/date-picker/date-picker.component.mjs +108 -0
- package/esm2020/lib/elements/date-time-picker/date-time-picker.component.mjs +360 -0
- package/esm2020/lib/elements/email/email-input.component.mjs +20 -0
- package/esm2020/lib/elements/file-input/file-input.component.mjs +71 -0
- package/esm2020/lib/elements/hour-minute-input/hour-minute-input.component.mjs +90 -0
- package/esm2020/lib/elements/loading-indicator/loading-indicator.component.mjs +20 -0
- package/esm2020/lib/elements/number-input/number-input.component.mjs +31 -0
- package/esm2020/lib/elements/password-field/password-field.component.mjs +21 -0
- package/esm2020/lib/elements/select/select-footer/select-footer.component.mjs +15 -0
- package/esm2020/lib/elements/select/select.component.mjs +129 -0
- package/esm2020/lib/elements/sortable-grouped-items/sortable-grouped-items.component.mjs +51 -0
- package/esm2020/lib/elements/sortable-items/sortable-items.component.mjs +70 -0
- package/esm2020/lib/elements/text-input/text-input.component.mjs +28 -0
- package/esm2020/lib/elements/toggle/toggle.component.mjs +15 -0
- package/esm2020/lib/elements/value-accessor-base/multiple-value-accessor-base.component.mjs +61 -0
- package/esm2020/lib/elements/value-accessor-base/value-accessor-base.component.mjs +144 -0
- package/esm2020/lib/form/form-caption/form-caption.component.mjs +36 -0
- package/esm2020/lib/form/form-element/form-element.component.mjs +124 -0
- package/esm2020/lib/form/form-error/form-error.component.mjs +39 -0
- package/esm2020/lib/form/form-submit-button/form-submit-button.component.mjs +61 -0
- package/esm2020/lib/form/form.component.mjs +180 -0
- package/esm2020/lib/material.module.mjs +22 -0
- package/esm2020/lib/ngx-enhancy-forms.module.mjs +158 -0
- package/esm2020/lib/types.mjs +2 -0
- package/esm2020/lib/util/arrays.mjs +45 -0
- package/esm2020/lib/util/values.mjs +23 -0
- package/esm2020/lib/validators/dateValidator.mjs +6 -0
- package/esm2020/lib/validators/timeValidator.mjs +6 -0
- package/esm2020/public-api.mjs +30 -0
- package/fesm2015/klippa-ngx-enhancy-forms.mjs +1894 -0
- package/fesm2015/klippa-ngx-enhancy-forms.mjs.map +1 -0
- package/fesm2020/klippa-ngx-enhancy-forms.mjs +1858 -0
- package/fesm2020/klippa-ngx-enhancy-forms.mjs.map +1 -0
- package/{klippa-ngx-enhancy-forms.d.ts → index.d.ts} +1 -1
- package/lib/elements/button/button.component.d.ts +4 -1
- package/lib/elements/checkbox/checkbox.component.d.ts +3 -0
- package/lib/elements/date-picker/date-picker.component.d.ts +3 -0
- package/lib/elements/date-time-picker/date-time-picker.component.d.ts +3 -0
- package/lib/elements/email/email-input.component.d.ts +3 -0
- package/lib/elements/file-input/file-input.component.d.ts +3 -0
- package/lib/elements/hour-minute-input/hour-minute-input.component.d.ts +3 -0
- package/lib/elements/loading-indicator/loading-indicator.component.d.ts +3 -0
- package/lib/elements/number-input/number-input.component.d.ts +3 -0
- package/lib/elements/password-field/password-field.component.d.ts +3 -0
- package/lib/elements/select/select-footer/select-footer.component.d.ts +3 -0
- package/lib/elements/select/select.component.d.ts +5 -0
- package/lib/elements/sortable-grouped-items/sortable-grouped-items.component.d.ts +3 -0
- package/lib/elements/sortable-items/sortable-items.component.d.ts +3 -0
- package/lib/elements/text-input/text-input.component.d.ts +3 -0
- package/lib/elements/toggle/toggle.component.d.ts +3 -0
- package/lib/elements/value-accessor-base/multiple-value-accessor-base.component.d.ts +3 -0
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +5 -2
- package/lib/form/form-caption/form-caption.component.d.ts +3 -0
- package/lib/form/form-element/form-element.component.d.ts +7 -4
- package/lib/form/form-error/form-error.component.d.ts +3 -0
- package/lib/form/form-submit-button/form-submit-button.component.d.ts +3 -0
- package/lib/form/form.component.d.ts +10 -5
- package/lib/material.module.d.ts +9 -0
- package/lib/ngx-enhancy-forms.module.d.ts +32 -0
- package/package.json +29 -16
- package/src/lib/form/README.md +1 -0
- package/bundles/klippa-ngx-enhancy-forms.umd.js +0 -2177
- package/bundles/klippa-ngx-enhancy-forms.umd.js.map +0 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js +0 -17
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +0 -1
- package/esm2015/klippa-ngx-enhancy-forms.js +0 -6
- package/esm2015/lib/elements/button/button.component.js +0 -49
- package/esm2015/lib/elements/checkbox/checkbox.component.js +0 -22
- package/esm2015/lib/elements/date-picker/date-picker.component.js +0 -95
- package/esm2015/lib/elements/date-time-picker/date-time-picker.component.js +0 -330
- package/esm2015/lib/elements/email/email-input.component.js +0 -21
- package/esm2015/lib/elements/file-input/file-input.component.js +0 -66
- package/esm2015/lib/elements/hour-minute-input/hour-minute-input.component.js +0 -90
- package/esm2015/lib/elements/loading-indicator/loading-indicator.component.js +0 -19
- package/esm2015/lib/elements/number-input/number-input.component.js +0 -30
- package/esm2015/lib/elements/password-field/password-field.component.js +0 -21
- package/esm2015/lib/elements/select/select-footer/select-footer.component.js +0 -15
- package/esm2015/lib/elements/select/select.component.js +0 -104
- package/esm2015/lib/elements/sortable-grouped-items/sortable-grouped-items.component.js +0 -49
- package/esm2015/lib/elements/sortable-items/sortable-items.component.js +0 -67
- package/esm2015/lib/elements/text-input/text-input.component.js +0 -25
- package/esm2015/lib/elements/toggle/toggle.component.js +0 -14
- package/esm2015/lib/elements/value-accessor-base/multiple-value-accessor-base.component.js +0 -54
- package/esm2015/lib/elements/value-accessor-base/value-accessor-base.component.js +0 -135
- package/esm2015/lib/form/form-caption/form-caption.component.js +0 -35
- package/esm2015/lib/form/form-element/form-element.component.js +0 -118
- package/esm2015/lib/form/form-error/form-error.component.js +0 -37
- package/esm2015/lib/form/form-submit-button/form-submit-button.component.js +0 -53
- package/esm2015/lib/form/form.component.js +0 -173
- package/esm2015/lib/material.module.js +0 -17
- package/esm2015/lib/ngx-enhancy-forms.module.js +0 -97
- package/esm2015/lib/types.js +0 -2
- package/esm2015/lib/util/arrays.js +0 -45
- package/esm2015/lib/util/values.js +0 -23
- package/esm2015/lib/validators/dateValidator.js +0 -6
- package/esm2015/lib/validators/timeValidator.js +0 -6
- package/esm2015/public-api.js +0 -30
- package/fesm2015/klippa-ngx-enhancy-forms.js +0 -1715
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +0 -1
- package/klippa-ngx-enhancy-forms.metadata.json +0 -1
|
@@ -0,0 +1,1858 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, Input, Component, SkipSelf, Optional, InjectionToken, Host, Inject, ViewChild, EventEmitter, Output, HostBinding, TemplateRef, ContentChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { UntypedFormArray, UntypedFormGroup, UntypedFormControl, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
|
+
import { isString } from 'lodash-es';
|
|
8
|
+
import { isArray } from 'lodash';
|
|
9
|
+
import * as i4 from '@ng-select/ng-select';
|
|
10
|
+
import { NgSelectModule } from '@ng-select/ng-select';
|
|
11
|
+
import * as i2$1 from 'ngx-sortablejs';
|
|
12
|
+
import { SortablejsModule } from 'ngx-sortablejs';
|
|
13
|
+
import { isSameDay, format, startOfMonth, endOfMonth, parse } from 'date-fns';
|
|
14
|
+
import * as i3 from '@angular/material/core';
|
|
15
|
+
import { MAT_NATIVE_DATE_FORMATS, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
|
|
16
|
+
import * as i5 from '@angular/material/datepicker';
|
|
17
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
18
|
+
import * as i6 from '@angular/material/form-field';
|
|
19
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
20
|
+
import * as i7 from '@angular/material/input';
|
|
21
|
+
import { MatInputModule } from '@angular/material/input';
|
|
22
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
23
|
+
|
|
24
|
+
function stringIsSetAndFilled(s) {
|
|
25
|
+
return isString(s) && s.length > 0;
|
|
26
|
+
}
|
|
27
|
+
function isNullOrUndefined(value) {
|
|
28
|
+
return value === null || value === undefined;
|
|
29
|
+
}
|
|
30
|
+
function numberIsSet(value) {
|
|
31
|
+
return isValueSet(value) && typeof value === 'number';
|
|
32
|
+
}
|
|
33
|
+
function isValueSet(value) {
|
|
34
|
+
return value !== null && value !== undefined;
|
|
35
|
+
}
|
|
36
|
+
function stringOrArrayIsSetAndEmpty(value) {
|
|
37
|
+
return value !== null && value !== undefined && value.length === 0;
|
|
38
|
+
}
|
|
39
|
+
function truncateString(s, length) {
|
|
40
|
+
if (s.length < length) {
|
|
41
|
+
return s;
|
|
42
|
+
}
|
|
43
|
+
return s.substring(0, length) + '...';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function removeDuplicatesFromArraysWithComparator(comparator, ...arrays) {
|
|
47
|
+
let combined = [];
|
|
48
|
+
for (const array of arrays) {
|
|
49
|
+
combined = combined.concat(array);
|
|
50
|
+
}
|
|
51
|
+
return combined.filter((c, i) => {
|
|
52
|
+
const firstOccurrenceIndex = combined.findIndex((c2) => comparator(c, c2));
|
|
53
|
+
return i === firstOccurrenceIndex;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function removeDuplicatesFromArray(array) {
|
|
57
|
+
return array.filter((c, i) => {
|
|
58
|
+
const firstOccurrenceIndex = array.findIndex((c2) => c2 === c);
|
|
59
|
+
return i === firstOccurrenceIndex;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function insertAtIndex(arr, index, item) {
|
|
63
|
+
arr.splice(index, 0, item);
|
|
64
|
+
}
|
|
65
|
+
function arrayIsSetAndFilled(arr) {
|
|
66
|
+
return isArray(arr) && arr !== null && arr !== undefined && arr.length > 0;
|
|
67
|
+
}
|
|
68
|
+
function asArray(value) {
|
|
69
|
+
if (isValueSet(value)) {
|
|
70
|
+
if (Array.isArray(value)) {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
return [value];
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
function splitArrayByCondition(value, condition) {
|
|
78
|
+
return value.reduce((acc, cur) => {
|
|
79
|
+
if (condition(cur)) {
|
|
80
|
+
acc.push([]);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
acc[acc.length - 1].push(cur);
|
|
84
|
+
}
|
|
85
|
+
return acc;
|
|
86
|
+
}, [[]]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const invalidFieldsSymbol = Symbol('Not all fields are valid');
|
|
90
|
+
class SubFormDirective {
|
|
91
|
+
}
|
|
92
|
+
SubFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SubFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
93
|
+
SubFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: SubFormDirective, selector: "klp-sub-form", inputs: { injectInto: "injectInto", at: "at" }, ngImport: i0 });
|
|
94
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SubFormDirective, decorators: [{
|
|
95
|
+
type: Directive,
|
|
96
|
+
args: [{
|
|
97
|
+
// tslint:disable-next-line:directive-selector
|
|
98
|
+
selector: 'klp-sub-form',
|
|
99
|
+
}]
|
|
100
|
+
}], propDecorators: { injectInto: [{
|
|
101
|
+
type: Input
|
|
102
|
+
}], at: [{
|
|
103
|
+
type: Input
|
|
104
|
+
}] } });
|
|
105
|
+
class FormComponent {
|
|
106
|
+
constructor(parent, subFormPlaceholder) {
|
|
107
|
+
this.parent = parent;
|
|
108
|
+
this.subFormPlaceholder = subFormPlaceholder;
|
|
109
|
+
this.showErrorMessages = true;
|
|
110
|
+
this.errorMessageLocation = 'belowCaption';
|
|
111
|
+
// we keep track of what form controls are actually rendered. Only those count when looking at form validation
|
|
112
|
+
this.activeControls = [];
|
|
113
|
+
}
|
|
114
|
+
ngOnInit() {
|
|
115
|
+
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
116
|
+
const injectInto = this.subFormPlaceholder.injectInto;
|
|
117
|
+
const injectAt = this.subFormPlaceholder.at;
|
|
118
|
+
if (injectInto instanceof UntypedFormArray) {
|
|
119
|
+
if (typeof injectAt !== 'number') {
|
|
120
|
+
throw new Error(`cannot index FormArray with ${typeof injectAt}`);
|
|
121
|
+
}
|
|
122
|
+
injectInto.setControl(injectAt, this.formGroup);
|
|
123
|
+
}
|
|
124
|
+
else if (injectInto instanceof UntypedFormGroup) {
|
|
125
|
+
if (typeof injectAt !== 'string') {
|
|
126
|
+
throw new Error(`cannot index FormGroup with ${typeof injectAt}`);
|
|
127
|
+
}
|
|
128
|
+
injectInto.setControl(injectAt, this.formGroup);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (isValueSet(this.patchValueInterceptor)) {
|
|
132
|
+
this.addSupportForPatchValueInterceptor();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
ngOnDestroy() {
|
|
136
|
+
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
137
|
+
const injectInto = this.subFormPlaceholder.injectInto;
|
|
138
|
+
const injectAt = this.subFormPlaceholder.at;
|
|
139
|
+
if (injectInto instanceof UntypedFormArray) {
|
|
140
|
+
const idx = injectInto.controls.findIndex(e => e === this.formGroup);
|
|
141
|
+
injectInto.removeAt(idx);
|
|
142
|
+
}
|
|
143
|
+
else if (injectInto instanceof UntypedFormGroup) {
|
|
144
|
+
if (typeof injectAt !== 'string') {
|
|
145
|
+
throw new Error(`cannot index FormGroup with ${typeof injectAt}`);
|
|
146
|
+
}
|
|
147
|
+
injectInto.removeControl(injectAt);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
addSupportForPatchValueInterceptor() {
|
|
152
|
+
const fn = this.formGroup.patchValue;
|
|
153
|
+
const newFn = (value, options) => {
|
|
154
|
+
this.patchValueInterceptor(value).then((val) => {
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
fn.call(this.formGroup, val, options);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
this.formGroup.patchValue = newFn;
|
|
161
|
+
}
|
|
162
|
+
registerControl(formControl, formElement) {
|
|
163
|
+
this.activeControls.push({ formControl, formElement });
|
|
164
|
+
if (this.parent) {
|
|
165
|
+
this.parent.registerControl(formControl, formElement);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
unregisterControl(formControl) {
|
|
169
|
+
this.activeControls = this.activeControls.filter((e) => e.formControl !== formControl);
|
|
170
|
+
if (this.parent) {
|
|
171
|
+
this.parent.unregisterControl(formControl);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
addFormGroupControls(formGroup, result) {
|
|
175
|
+
Object.values(formGroup.controls).forEach((value) => {
|
|
176
|
+
if (value instanceof UntypedFormGroup) {
|
|
177
|
+
this.addFormGroupControls(value, result);
|
|
178
|
+
}
|
|
179
|
+
else if (value instanceof UntypedFormArray) {
|
|
180
|
+
this.addFormArrayControls(value, result);
|
|
181
|
+
}
|
|
182
|
+
else if (value instanceof UntypedFormControl) {
|
|
183
|
+
this.addFormControl(value, result);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
addFormArrayControls(formArray, result) {
|
|
188
|
+
formArray.controls.forEach((value) => {
|
|
189
|
+
if (value instanceof UntypedFormGroup) {
|
|
190
|
+
this.addFormGroupControls(value, result);
|
|
191
|
+
}
|
|
192
|
+
else if (value instanceof UntypedFormArray) {
|
|
193
|
+
this.addFormArrayControls(value, result);
|
|
194
|
+
}
|
|
195
|
+
else if (value instanceof UntypedFormControl) {
|
|
196
|
+
this.addFormControl(value, result);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
getAllFormControls() {
|
|
201
|
+
const result = [];
|
|
202
|
+
this.addFormGroupControls(this.formGroup, result);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
addFormControl(control, result) {
|
|
206
|
+
result.push(control);
|
|
207
|
+
}
|
|
208
|
+
disableInactiveFormControl(control) {
|
|
209
|
+
if (!this.activeControls.some((e) => e.formControl === control)) {
|
|
210
|
+
control.disable();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
trySubmit() {
|
|
214
|
+
this.formGroup.markAllAsTouched();
|
|
215
|
+
const allControls = this.getAllFormControls();
|
|
216
|
+
const originalDisabledStates = allControls.map(e => {
|
|
217
|
+
return { control: e, disabled: e.disabled };
|
|
218
|
+
});
|
|
219
|
+
allControls.forEach(e => this.disableInactiveFormControl(e));
|
|
220
|
+
allControls.forEach(e => e.updateValueAndValidity());
|
|
221
|
+
const values = this.formGroup.value;
|
|
222
|
+
if (this.formGroup.valid) {
|
|
223
|
+
this.setDisabledStatesForAllControls(originalDisabledStates);
|
|
224
|
+
return Promise.resolve(values);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this.activeControls.find((e) => !e.formControl.valid)?.formElement?.scrollTo();
|
|
228
|
+
this.setDisabledStatesForAllControls(originalDisabledStates);
|
|
229
|
+
return Promise.reject(invalidFieldsSymbol);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
setDisabledStatesForAllControls(originalDisabledStates) {
|
|
233
|
+
originalDisabledStates.forEach((e) => {
|
|
234
|
+
if (e.disabled) {
|
|
235
|
+
e.control.disable();
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
e.control.enable();
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormComponent, deps: [{ token: FormComponent, optional: true, skipSelf: true }, { token: SubFormDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
244
|
+
FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormComponent, selector: "klp-form", inputs: { showErrorMessages: "showErrorMessages", errorMessageLocation: "errorMessageLocation", formGroup: "formGroup", patchValueInterceptor: "patchValueInterceptor" }, ngImport: i0, template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n", styles: [":host{display:block}:host.row{display:flex}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormComponent, decorators: [{
|
|
246
|
+
type: Component,
|
|
247
|
+
args: [{ selector: 'klp-form', template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n", styles: [":host{display:block}:host.row{display:flex}\n"] }]
|
|
248
|
+
}], ctorParameters: function () { return [{ type: FormComponent, decorators: [{
|
|
249
|
+
type: SkipSelf
|
|
250
|
+
}, {
|
|
251
|
+
type: Optional
|
|
252
|
+
}] }, { type: SubFormDirective, decorators: [{
|
|
253
|
+
type: Optional
|
|
254
|
+
}] }]; }, propDecorators: { showErrorMessages: [{
|
|
255
|
+
type: Input
|
|
256
|
+
}], errorMessageLocation: [{
|
|
257
|
+
type: Input
|
|
258
|
+
}], formGroup: [{
|
|
259
|
+
type: Input
|
|
260
|
+
}], patchValueInterceptor: [{
|
|
261
|
+
type: Input
|
|
262
|
+
}] } });
|
|
263
|
+
|
|
264
|
+
const FORM_ERROR_MESSAGES = new InjectionToken('form.error.messages');
|
|
265
|
+
const DEFAULT_ERROR_MESSAGES = {
|
|
266
|
+
min: 'Use a number larger than %min%',
|
|
267
|
+
max: 'Use a number smaller than %max%',
|
|
268
|
+
required: 'This field is required',
|
|
269
|
+
email: 'Use a valid email address',
|
|
270
|
+
minLength: 'Has to be longer than %minLength% character(s)',
|
|
271
|
+
maxLength: 'Has to be shorter than %maxLength% character(s)',
|
|
272
|
+
pattern: 'This input is not valid',
|
|
273
|
+
matchPassword: 'Passwords must match',
|
|
274
|
+
date: 'Enter a valid date',
|
|
275
|
+
};
|
|
276
|
+
class FormElementComponent {
|
|
277
|
+
constructor(parent, customMessages) {
|
|
278
|
+
this.parent = parent;
|
|
279
|
+
this.customMessages = customMessages;
|
|
280
|
+
this.direction = 'horizontal';
|
|
281
|
+
this.captionSpacing = 'percentages';
|
|
282
|
+
this.spaceDistribution = '40-60';
|
|
283
|
+
this.swapInputAndCaption = false;
|
|
284
|
+
this.errorMessages = DEFAULT_ERROR_MESSAGES;
|
|
285
|
+
this.customErrorHandlers = [];
|
|
286
|
+
}
|
|
287
|
+
shouldShowErrorMessages() {
|
|
288
|
+
return this.parent?.showErrorMessages !== false;
|
|
289
|
+
}
|
|
290
|
+
substituteParameters(message, parameters) {
|
|
291
|
+
return Object.keys(parameters).reduce((msg, key) => {
|
|
292
|
+
return msg.replace(`%${key}%`, parameters[key]);
|
|
293
|
+
}, message);
|
|
294
|
+
}
|
|
295
|
+
registerControl(formControl, input = null) {
|
|
296
|
+
this.attachedControl = formControl;
|
|
297
|
+
this.parent.registerControl(formControl, this);
|
|
298
|
+
this.input = input;
|
|
299
|
+
}
|
|
300
|
+
unregisterControl(formControl) {
|
|
301
|
+
this.attachedControl = null;
|
|
302
|
+
this.parent.unregisterControl(formControl);
|
|
303
|
+
}
|
|
304
|
+
getAttachedControl() {
|
|
305
|
+
return this.attachedControl;
|
|
306
|
+
}
|
|
307
|
+
registerErrorHandler(error, templateRef) {
|
|
308
|
+
this.customErrorHandlers.push({ error, templateRef });
|
|
309
|
+
}
|
|
310
|
+
registerCaption(templateRef) {
|
|
311
|
+
this.captionRef = templateRef;
|
|
312
|
+
}
|
|
313
|
+
getErrorToShow() {
|
|
314
|
+
if (this.attachedControl?.touched === true && this.attachedControl?.errors) {
|
|
315
|
+
return Object.keys(this.attachedControl?.errors)[0];
|
|
316
|
+
}
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
getCustomErrorHandler(error) {
|
|
320
|
+
return this.customErrorHandlers.find((e) => e.error === error);
|
|
321
|
+
}
|
|
322
|
+
showDefaultError(error) {
|
|
323
|
+
return this.getErrorToShow() === error && !this.customErrorHandlers.some((e) => e.error === error);
|
|
324
|
+
}
|
|
325
|
+
getScrollableParent(node) {
|
|
326
|
+
if (node == null) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
if (node.scrollHeight > node.clientHeight) {
|
|
330
|
+
return node;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
return this.getScrollableParent(node.parentNode);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
scrollTo() {
|
|
337
|
+
this.internalComponentRef.nativeElement.scrollIntoView(true);
|
|
338
|
+
// to give some breathing room, we scroll 100px more to the top
|
|
339
|
+
this.getScrollableParent(this.internalComponentRef.nativeElement)?.scrollBy(0, -100);
|
|
340
|
+
}
|
|
341
|
+
isRequired() {
|
|
342
|
+
if (isValueSet(this.input)) {
|
|
343
|
+
return this.input.hasValidator('required');
|
|
344
|
+
}
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
getErrorMessage(key) {
|
|
348
|
+
return this.customMessages?.[key]?.() ?? this.errorMessages[key];
|
|
349
|
+
}
|
|
350
|
+
getErrorLocation() {
|
|
351
|
+
return this.parent?.errorMessageLocation ?? 'belowCaption';
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
FormElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormElementComponent, deps: [{ token: FormComponent, host: true, optional: true }, { token: FORM_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
355
|
+
FormElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormElementComponent, selector: "klp-form-element", inputs: { caption: "caption", direction: "direction", captionSpacing: "captionSpacing", spaceDistribution: "spaceDistribution", swapInputAndCaption: "swapInputAndCaption" }, viewQueries: [{ propertyName: "internalComponentRef", first: true, predicate: ["internalComponentRef"], descendants: true }], ngImport: i0, template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70'}\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\n\t\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\t\tpercentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70',\n\t\t\twithErrorRightOfCaption: getErrorLocation() === 'rightOfCaption'\n\t\t}\"\n\t>\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t\t<div class=\"rightOfCaptionError\">\n\t\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'rightOfCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{ percentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70' }\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n", styles: [":host{display:block}.componentContainer{display:flex;align-items:center;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;padding-right:1.25rem;color:#515365}.caption.percentageSpacing{flex:0 0 40%}.caption.percentageSpacing.d30-70{flex-basis:30%}.caption.hasErrors{color:#ff8000}.caption.withErrorRightOfCaption{display:flex;justify-content:space-between;gap:2.5rem}.caption.withErrorRightOfCaption .rightOfCaptionError{font-weight:400;overflow:hidden}.caption.withErrorRightOfCaption .rightOfCaptionError *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inputContainer{flex:1}.inputContainer.percentageSpacing{flex:0 0 60%}.inputContainer.percentageSpacing.d30-70{flex-basis:70%}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormElementComponent, decorators: [{
|
|
357
|
+
type: Component,
|
|
358
|
+
args: [{ selector: 'klp-form-element', template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70'}\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\n\t\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\t\tpercentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70',\n\t\t\twithErrorRightOfCaption: getErrorLocation() === 'rightOfCaption'\n\t\t}\"\n\t>\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t\t<div class=\"rightOfCaptionError\">\n\t\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'rightOfCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{ percentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70' }\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n", styles: [":host{display:block}.componentContainer{display:flex;align-items:center;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;padding-right:1.25rem;color:#515365}.caption.percentageSpacing{flex:0 0 40%}.caption.percentageSpacing.d30-70{flex-basis:30%}.caption.hasErrors{color:#ff8000}.caption.withErrorRightOfCaption{display:flex;justify-content:space-between;gap:2.5rem}.caption.withErrorRightOfCaption .rightOfCaptionError{font-weight:400;overflow:hidden}.caption.withErrorRightOfCaption .rightOfCaptionError *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inputContainer{flex:1}.inputContainer.percentageSpacing{flex:0 0 60%}.inputContainer.percentageSpacing.d30-70{flex-basis:70%}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}\n"] }]
|
|
359
|
+
}], ctorParameters: function () { return [{ type: FormComponent, decorators: [{
|
|
360
|
+
type: Host
|
|
361
|
+
}, {
|
|
362
|
+
type: Optional
|
|
363
|
+
}] }, { type: undefined, decorators: [{
|
|
364
|
+
type: Inject,
|
|
365
|
+
args: [FORM_ERROR_MESSAGES]
|
|
366
|
+
}, {
|
|
367
|
+
type: Optional
|
|
368
|
+
}] }]; }, propDecorators: { caption: [{
|
|
369
|
+
type: Input
|
|
370
|
+
}], direction: [{
|
|
371
|
+
type: Input
|
|
372
|
+
}], captionSpacing: [{
|
|
373
|
+
type: Input
|
|
374
|
+
}], spaceDistribution: [{
|
|
375
|
+
type: Input
|
|
376
|
+
}], swapInputAndCaption: [{
|
|
377
|
+
type: Input
|
|
378
|
+
}], internalComponentRef: [{
|
|
379
|
+
type: ViewChild,
|
|
380
|
+
args: ['internalComponentRef']
|
|
381
|
+
}] } });
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* This component is a base in order to create a component that supports ngModel.
|
|
385
|
+
* Some important things to know about it:
|
|
386
|
+
*
|
|
387
|
+
* innerValue = your own inner state, which you should use to store the current state of what ngModel should be.
|
|
388
|
+
* writeValue() = called by angular, when ngModel is changed from OUTSIDE of the component. Feel free to patch this method if you need inner logic to happen when ngModel is altered from the outside. Always remember to also call the super.writeValue if you do!
|
|
389
|
+
* setInnerValueAndNotify() = call this when you want your ngModel to be updated from INSIDE of your component, and provide it to the OUTSIDE.
|
|
390
|
+
* ngOnInit() = Used to support the angular reactive forms framework. If you use ngOnInit in your own component (which happens fairly often) you must not forget to call the super.ngOnInit() method.
|
|
391
|
+
*/
|
|
392
|
+
class ValueAccessorBase {
|
|
393
|
+
constructor(parent, controlContainer) {
|
|
394
|
+
this.parent = parent;
|
|
395
|
+
this.controlContainer = controlContainer;
|
|
396
|
+
this.changed = new Array();
|
|
397
|
+
this.touched = new Array();
|
|
398
|
+
this.prevValue = null;
|
|
399
|
+
this.disabled = false;
|
|
400
|
+
// we support both providing just the formControlName and the full formControl
|
|
401
|
+
this.formControlName = null;
|
|
402
|
+
this.formControl = null;
|
|
403
|
+
this.onTouch = new EventEmitter();
|
|
404
|
+
this.validators = [];
|
|
405
|
+
}
|
|
406
|
+
ngOnInit() {
|
|
407
|
+
if (this.formControl) {
|
|
408
|
+
this.attachedFormControl = this.formControl;
|
|
409
|
+
}
|
|
410
|
+
else if (stringIsSetAndFilled(this.formControlName)) {
|
|
411
|
+
this.attachedFormControl = this.controlContainer?.control.get(this.formControlName);
|
|
412
|
+
if (isNullOrUndefined(this.attachedFormControl)) {
|
|
413
|
+
throw new Error(`Form element '${this.formControlName}' with caption '${this.parent?.caption}' is not declared in your FormGroup.`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (this.attachedFormControl) {
|
|
417
|
+
this.disabled = this.attachedFormControl.disabled;
|
|
418
|
+
this.attachedFormControl.statusChanges.subscribe(() => {
|
|
419
|
+
this.disabled = this.attachedFormControl.disabled;
|
|
420
|
+
});
|
|
421
|
+
this.parent?.registerControl(this.attachedFormControl, this);
|
|
422
|
+
if (this.attachedFormControl?.validator) {
|
|
423
|
+
const vals = this.attachedFormControl.validator({});
|
|
424
|
+
if (isValueSet(vals)) {
|
|
425
|
+
this.validators = Object.keys(vals);
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
this.validators = [];
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
isInErrorState() {
|
|
434
|
+
return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
|
|
435
|
+
}
|
|
436
|
+
ngOnDestroy() {
|
|
437
|
+
if (this.attachedFormControl) {
|
|
438
|
+
this.parent?.unregisterControl(this.attachedFormControl);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
touch() {
|
|
442
|
+
this.touched.forEach((f) => f());
|
|
443
|
+
}
|
|
444
|
+
writeValue(value) {
|
|
445
|
+
this.innerValue = value;
|
|
446
|
+
this.prevValue = value;
|
|
447
|
+
}
|
|
448
|
+
registerOnChange(fn) {
|
|
449
|
+
this.changed.push(fn);
|
|
450
|
+
}
|
|
451
|
+
registerOnTouched(fn) {
|
|
452
|
+
this.touched.push(fn);
|
|
453
|
+
}
|
|
454
|
+
setInnerValueAndNotify(value) {
|
|
455
|
+
const actuallySetValue = (valueToSet) => {
|
|
456
|
+
this.innerValue = valueToSet;
|
|
457
|
+
this.prevValue = valueToSet;
|
|
458
|
+
this.changed.forEach((fn) => fn(valueToSet));
|
|
459
|
+
};
|
|
460
|
+
if (isValueSet(this.innerValueChangeInterceptor)) {
|
|
461
|
+
this.latestInnerValueChangedInterceptorPromise = this.innerValueChangeInterceptor(this.prevValue, value);
|
|
462
|
+
const myPromise = this.latestInnerValueChangedInterceptorPromise;
|
|
463
|
+
this.latestInnerValueChangedInterceptorPromise.then(() => {
|
|
464
|
+
if (this.latestInnerValueChangedInterceptorPromise === myPromise) {
|
|
465
|
+
actuallySetValue(value);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
// ignore outdated promises
|
|
469
|
+
}
|
|
470
|
+
}).catch(() => {
|
|
471
|
+
if (this.latestInnerValueChangedInterceptorPromise === myPromise) {
|
|
472
|
+
actuallySetValue(this.prevValue);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
// ignore outdated promises
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
actuallySetValue(value);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
resetToNull() {
|
|
484
|
+
this.setInnerValueAndNotify(null);
|
|
485
|
+
}
|
|
486
|
+
hasValidator(validatorName) {
|
|
487
|
+
if (arrayIsSetAndFilled(this.validators)) {
|
|
488
|
+
return this.validators.includes(validatorName);
|
|
489
|
+
}
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
ValueAccessorBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ValueAccessorBase, deps: [{ token: FormElementComponent, host: true, optional: true }, { token: i2.ControlContainer, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
494
|
+
ValueAccessorBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: ValueAccessorBase, selector: "ng-component", inputs: { disabled: "disabled", innerValueChangeInterceptor: "innerValueChangeInterceptor", formControlName: "formControlName", formControl: "formControl" }, outputs: { onTouch: "onTouch" }, ngImport: i0, template: '', isInline: true });
|
|
495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ValueAccessorBase, decorators: [{
|
|
496
|
+
type: Component,
|
|
497
|
+
args: [{
|
|
498
|
+
selector: '',
|
|
499
|
+
template: '',
|
|
500
|
+
}]
|
|
501
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
502
|
+
type: Host
|
|
503
|
+
}, {
|
|
504
|
+
type: Optional
|
|
505
|
+
}] }, { type: i2.ControlContainer, decorators: [{
|
|
506
|
+
type: Host
|
|
507
|
+
}, {
|
|
508
|
+
type: Optional
|
|
509
|
+
}] }]; }, propDecorators: { disabled: [{
|
|
510
|
+
type: Input
|
|
511
|
+
}], innerValueChangeInterceptor: [{
|
|
512
|
+
type: Input
|
|
513
|
+
}], formControlName: [{
|
|
514
|
+
type: Input
|
|
515
|
+
}], formControl: [{
|
|
516
|
+
type: Input
|
|
517
|
+
}], onTouch: [{
|
|
518
|
+
type: Output
|
|
519
|
+
}] } });
|
|
520
|
+
|
|
521
|
+
class LoadingIndicatorComponent {
|
|
522
|
+
constructor() {
|
|
523
|
+
this.variant = '3dots';
|
|
524
|
+
this.size = 'medium';
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
LoadingIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: LoadingIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
528
|
+
LoadingIndicatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: LoadingIndicatorComponent, selector: "klp-form-loading-indicator", inputs: { variant: "variant", size: "size" }, ngImport: i0, template: "<div class=\"threeDots\" [ngClass]=\"[size]\" *ngIf=\"variant === '3dots'\">\n\t<div></div>\n\t<div></div>\n\t<div></div>\n\t<div></div>\n</div>\n\n<div class=\"spinner\" [ngClass]=\"[size]\" *ngIf=\"variant === 'spinner'\">\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" viewBox=\"0 0 48 48\">\n\t\t<circle cx=\"24\" cy=\"4\" r=\"4\" fill=\"currentColor\" />\n\t\t<circle cx=\"12.19\" cy=\"7.86\" r=\"3.7\" fill=\"currentColor\" />\n\t\t<circle cx=\"5.02\" cy=\"17.68\" r=\"3.4\" fill=\"currentColor\" />\n\t\t<circle cx=\"5.02\" cy=\"30.32\" r=\"3.1\" fill=\"currentColor\" />\n\t\t<circle cx=\"12.19\" cy=\"40.14\" r=\"2.8\" fill=\"currentColor\" />\n\t\t<circle cx=\"24\" cy=\"44\" r=\"2.5\" fill=\"currentColor\" />\n\t\t<circle cx=\"35.81\" cy=\"40.14\" r=\"2.2\" fill=\"currentColor\" />\n\t\t<circle cx=\"42.98\" cy=\"30.32\" r=\"1.9\" fill=\"currentColor\" />\n\t\t<circle cx=\"42.98\" cy=\"17.68\" r=\"1.6\" fill=\"currentColor\" />\n\t\t<circle cx=\"35.81\" cy=\"7.86\" r=\"1.3\" fill=\"currentColor\" />\n\t</svg>\n</div>\n\n<div class=\"textInput\" *ngIf=\"variant === 'textInput'\">\n\t<input\n\t\tdisabled\n\t\ttype=\"text\"\n\t\tclass=\"form-control\"\n\t\tplaceholder=\"Loading...\"\n\t>\n</div>\n\n<div class=\"picker\" *ngIf=\"variant === 'picker'\">\n\t<input\n\t\tdisabled\n\t\ttype=\"text\"\n\t\tclass=\"form-control\"\n\t\tplaceholder=\"Loading...\"\n\t>\n\t<div class=\"chevronDown\"></div>\n</div>\n", styles: [":host{display:block}.threeDots{display:block;position:relative;width:calc(4 * var(--base));height:var(--base)}.threeDots.tiny{--base: 4px}.threeDots.small{--base: 8px}.threeDots.medium{--base: 12px}.threeDots.large{--base: 18px}.threeDots.huge{--base: 26px}.threeDots div{position:absolute;top:0;width:var(--base);height:var(--base);border-radius:50%;background:#27bb5f;animation-timing-function:cubic-bezier(0,1,1,0)}.threeDots div:nth-child(1){animation:lds-ellipsis1 .6s infinite}.threeDots div:nth-child(2){animation:lds-ellipsis2 .6s infinite}.threeDots div:nth-child(3){left:calc(1.5 * var(--base));animation:lds-ellipsis2 .6s infinite}.threeDots div:nth-child(4){left:calc(3 * var(--base));animation:lds-ellipsis3 .6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(150%)}}.spinner.tiny svg{width:1rem;height:1rem}.spinner.small svg{width:1.6rem;height:1.6rem}.spinner.medium svg{width:2.5rem;height:2.5rem}.spinner.large svg{width:3rem;height:3rem}.spinner.huge svg{width:4rem;height:4rem}.spinner svg{-webkit-transition-property:-webkit-transform;-webkit-transition-duration:1.2s;-webkit-animation-name:rotate;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-moz-transition-property:-moz-transform;-moz-animation-name:rotate;-moz-animation-duration:1.2s;-moz-animation-iteration-count:infinite;-moz-animation-timing-function:linear;transition-property:transform;animation-name:rotate;animation-duration:1.2s;animation-iteration-count:infinite;animation-timing-function:linear}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.picker{position:relative}.picker .chevronDown{position:absolute;top:18px;right:23px;width:0;height:0;border-top:5px solid #888da8;border-left:5px solid transparent;border-right:5px solid transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: LoadingIndicatorComponent, decorators: [{
|
|
530
|
+
type: Component,
|
|
531
|
+
args: [{ selector: 'klp-form-loading-indicator', template: "<div class=\"threeDots\" [ngClass]=\"[size]\" *ngIf=\"variant === '3dots'\">\n\t<div></div>\n\t<div></div>\n\t<div></div>\n\t<div></div>\n</div>\n\n<div class=\"spinner\" [ngClass]=\"[size]\" *ngIf=\"variant === 'spinner'\">\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" viewBox=\"0 0 48 48\">\n\t\t<circle cx=\"24\" cy=\"4\" r=\"4\" fill=\"currentColor\" />\n\t\t<circle cx=\"12.19\" cy=\"7.86\" r=\"3.7\" fill=\"currentColor\" />\n\t\t<circle cx=\"5.02\" cy=\"17.68\" r=\"3.4\" fill=\"currentColor\" />\n\t\t<circle cx=\"5.02\" cy=\"30.32\" r=\"3.1\" fill=\"currentColor\" />\n\t\t<circle cx=\"12.19\" cy=\"40.14\" r=\"2.8\" fill=\"currentColor\" />\n\t\t<circle cx=\"24\" cy=\"44\" r=\"2.5\" fill=\"currentColor\" />\n\t\t<circle cx=\"35.81\" cy=\"40.14\" r=\"2.2\" fill=\"currentColor\" />\n\t\t<circle cx=\"42.98\" cy=\"30.32\" r=\"1.9\" fill=\"currentColor\" />\n\t\t<circle cx=\"42.98\" cy=\"17.68\" r=\"1.6\" fill=\"currentColor\" />\n\t\t<circle cx=\"35.81\" cy=\"7.86\" r=\"1.3\" fill=\"currentColor\" />\n\t</svg>\n</div>\n\n<div class=\"textInput\" *ngIf=\"variant === 'textInput'\">\n\t<input\n\t\tdisabled\n\t\ttype=\"text\"\n\t\tclass=\"form-control\"\n\t\tplaceholder=\"Loading...\"\n\t>\n</div>\n\n<div class=\"picker\" *ngIf=\"variant === 'picker'\">\n\t<input\n\t\tdisabled\n\t\ttype=\"text\"\n\t\tclass=\"form-control\"\n\t\tplaceholder=\"Loading...\"\n\t>\n\t<div class=\"chevronDown\"></div>\n</div>\n", styles: [":host{display:block}.threeDots{display:block;position:relative;width:calc(4 * var(--base));height:var(--base)}.threeDots.tiny{--base: 4px}.threeDots.small{--base: 8px}.threeDots.medium{--base: 12px}.threeDots.large{--base: 18px}.threeDots.huge{--base: 26px}.threeDots div{position:absolute;top:0;width:var(--base);height:var(--base);border-radius:50%;background:#27bb5f;animation-timing-function:cubic-bezier(0,1,1,0)}.threeDots div:nth-child(1){animation:lds-ellipsis1 .6s infinite}.threeDots div:nth-child(2){animation:lds-ellipsis2 .6s infinite}.threeDots div:nth-child(3){left:calc(1.5 * var(--base));animation:lds-ellipsis2 .6s infinite}.threeDots div:nth-child(4){left:calc(3 * var(--base));animation:lds-ellipsis3 .6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(150%)}}.spinner.tiny svg{width:1rem;height:1rem}.spinner.small svg{width:1.6rem;height:1.6rem}.spinner.medium svg{width:2.5rem;height:2.5rem}.spinner.large svg{width:3rem;height:3rem}.spinner.huge svg{width:4rem;height:4rem}.spinner svg{-webkit-transition-property:-webkit-transform;-webkit-transition-duration:1.2s;-webkit-animation-name:rotate;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-moz-transition-property:-moz-transform;-moz-animation-name:rotate;-moz-animation-duration:1.2s;-moz-animation-iteration-count:infinite;-moz-animation-timing-function:linear;transition-property:transform;animation-name:rotate;animation-duration:1.2s;animation-iteration-count:infinite;animation-timing-function:linear}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.picker{position:relative}.picker .chevronDown{position:absolute;top:18px;right:23px;width:0;height:0;border-top:5px solid #888da8;border-left:5px solid transparent;border-right:5px solid transparent}\n"] }]
|
|
532
|
+
}], propDecorators: { variant: [{
|
|
533
|
+
type: Input
|
|
534
|
+
}], size: [{
|
|
535
|
+
type: Input
|
|
536
|
+
}] } });
|
|
537
|
+
|
|
538
|
+
class ButtonComponent {
|
|
539
|
+
constructor() {
|
|
540
|
+
this.variant = 'white';
|
|
541
|
+
this.size = 'medium';
|
|
542
|
+
this.fullWidth = false;
|
|
543
|
+
this.hasBorder = true;
|
|
544
|
+
this.disabled = false;
|
|
545
|
+
this.isLoading = false;
|
|
546
|
+
this.type = 'button';
|
|
547
|
+
}
|
|
548
|
+
get _() {
|
|
549
|
+
return this.fullWidth;
|
|
550
|
+
}
|
|
551
|
+
async onClick(event) {
|
|
552
|
+
if (this.disabled) {
|
|
553
|
+
event.stopPropagation();
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
if (isValueSet(this.clickCallback)) {
|
|
557
|
+
this.isLoading = true;
|
|
558
|
+
await this.clickCallback(event).finally(() => {
|
|
559
|
+
this.isLoading = false;
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
565
|
+
ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: ButtonComponent, selector: "klp-form-button", inputs: { variant: "variant", size: "size", fullWidth: "fullWidth", hasBorder: "hasBorder", disabled: "disabled", isLoading: "isLoading", type: "type", clickCallback: "clickCallback" }, host: { properties: { "class._fullWidth": "this._" } }, ngImport: i0, template: "<button class=\"buttonFundamentals\"\n\t[ngClass]=\"[\n\t\tvariant,\n\t\tsize,\n\t\tfullWidth ? 'fullWidth' : '',\n\t\thasBorder ? '' : 'no-border',\n\t\tdisabled ? 'disabled' : ''\n\t]\"\n\t[type]=\"type\"\n\t(click)=\"onClick($event)\"\n>\n\t<div class=\"caption\" [ngClass]=\"{invisible: isLoading}\">\n\t\t<ng-content></ng-content>\n\t</div>\n\t<div class=\"loadingSpinnerContainer\" *ngIf=\"isLoading\">\n\t\t<klp-form-loading-indicator variant=\"spinner\" size=\"small\"></klp-form-loading-indicator>\n\t</div>\n</button>\n", styles: [":host{display:inline-block}:host._fullWidth{display:block}.buttonFundamentals{cursor:pointer;letter-spacing:1px;font-size:13px;font-weight:700;padding:0 20px;border:1px solid #e6ecf5;border-radius:5px;color:#888da8;height:2.625rem}.buttonFundamentals.disabled{cursor:not-allowed}.buttonFundamentals.tiny{font-size:.75rem;font-weight:400;height:2rem}.buttonFundamentals.large{height:3rem}.fullWidth{width:100%}.no-border{border:none}.caption.invisible{visibility:hidden}button{position:relative}.loadingSpinnerContainer{position:absolute;inset:0;display:flex;justify-content:center;align-items:center}.white{color:#515365;background-color:#fff;border-color:#d4deee;font-weight:500}.white:hover,.white:active{color:#515365;background-color:#edf2f8;border-color:#edf2f8}.white:focus{text-decoration:underline}.greenFilled{background-color:#27bb5f;border-color:#27bb5f;color:#fff}.greenFilled:hover{color:#fff;background-color:#2bd06a;border-color:#2bd06a}.greenFilled:focus{text-decoration:underline}.greenFilled:active{background-color:#23a654;border-color:#23a654}.greenOutlined{background-color:#fff;border-color:#27bb5f;color:#27bb5f}.greenOutlined:hover{color:#fff;background-color:#2bd06a;border-color:#2bd06a}.greenOutlined:focus{text-decoration:underline}.greenOutlined:active{background-color:#23a654;border-color:#23a654}.greenLink{color:#27bb5f;border:none;background:none;padding:0}.greenLink:hover,.greenLink:focus{text-decoration:underline}.contextMenuItem{color:#888da8;background-color:#fff;border-color:#fff}.contextMenuItem:hover{background-color:#f6f7fb;border-color:#f6f7fb}.contextMenuItem:focus,.contextMenuItem:active{text-decoration:underline}.redFilled{color:#fff;background-color:#dc3545;border-color:#dc3545}.redFilled:hover{color:#fff;background-color:#e04b59;border-color:#e04b59}.redFilled:focus{text-decoration:underline}.redFilled:active{background-color:#d32535;border-color:#d32535}.redOutlined{color:#dc3545;background-color:#fff;border-color:#dc3545}.redOutlined:hover{color:#fff;background-color:#e04b59;border-color:#e04b59}.redOutlined:focus{text-decoration:underline}.redOutlined:active{background-color:#d32535;border-color:#d32535}.orangeFilled{color:#fff;background-color:#ff8000;border-color:#ff8000}.orangeFilled:hover{color:#fff;background-color:#ff8d1a;border-color:#ff8d1a}.orangeFilled:focus{text-decoration:underline}.orangeFilled:active{background-color:#e67300;border-color:#e67300}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoadingIndicatorComponent, selector: "klp-form-loading-indicator", inputs: ["variant", "size"] }] });
|
|
566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
567
|
+
type: Component,
|
|
568
|
+
args: [{ selector: 'klp-form-button', template: "<button class=\"buttonFundamentals\"\n\t[ngClass]=\"[\n\t\tvariant,\n\t\tsize,\n\t\tfullWidth ? 'fullWidth' : '',\n\t\thasBorder ? '' : 'no-border',\n\t\tdisabled ? 'disabled' : ''\n\t]\"\n\t[type]=\"type\"\n\t(click)=\"onClick($event)\"\n>\n\t<div class=\"caption\" [ngClass]=\"{invisible: isLoading}\">\n\t\t<ng-content></ng-content>\n\t</div>\n\t<div class=\"loadingSpinnerContainer\" *ngIf=\"isLoading\">\n\t\t<klp-form-loading-indicator variant=\"spinner\" size=\"small\"></klp-form-loading-indicator>\n\t</div>\n</button>\n", styles: [":host{display:inline-block}:host._fullWidth{display:block}.buttonFundamentals{cursor:pointer;letter-spacing:1px;font-size:13px;font-weight:700;padding:0 20px;border:1px solid #e6ecf5;border-radius:5px;color:#888da8;height:2.625rem}.buttonFundamentals.disabled{cursor:not-allowed}.buttonFundamentals.tiny{font-size:.75rem;font-weight:400;height:2rem}.buttonFundamentals.large{height:3rem}.fullWidth{width:100%}.no-border{border:none}.caption.invisible{visibility:hidden}button{position:relative}.loadingSpinnerContainer{position:absolute;inset:0;display:flex;justify-content:center;align-items:center}.white{color:#515365;background-color:#fff;border-color:#d4deee;font-weight:500}.white:hover,.white:active{color:#515365;background-color:#edf2f8;border-color:#edf2f8}.white:focus{text-decoration:underline}.greenFilled{background-color:#27bb5f;border-color:#27bb5f;color:#fff}.greenFilled:hover{color:#fff;background-color:#2bd06a;border-color:#2bd06a}.greenFilled:focus{text-decoration:underline}.greenFilled:active{background-color:#23a654;border-color:#23a654}.greenOutlined{background-color:#fff;border-color:#27bb5f;color:#27bb5f}.greenOutlined:hover{color:#fff;background-color:#2bd06a;border-color:#2bd06a}.greenOutlined:focus{text-decoration:underline}.greenOutlined:active{background-color:#23a654;border-color:#23a654}.greenLink{color:#27bb5f;border:none;background:none;padding:0}.greenLink:hover,.greenLink:focus{text-decoration:underline}.contextMenuItem{color:#888da8;background-color:#fff;border-color:#fff}.contextMenuItem:hover{background-color:#f6f7fb;border-color:#f6f7fb}.contextMenuItem:focus,.contextMenuItem:active{text-decoration:underline}.redFilled{color:#fff;background-color:#dc3545;border-color:#dc3545}.redFilled:hover{color:#fff;background-color:#e04b59;border-color:#e04b59}.redFilled:focus{text-decoration:underline}.redFilled:active{background-color:#d32535;border-color:#d32535}.redOutlined{color:#dc3545;background-color:#fff;border-color:#dc3545}.redOutlined:hover{color:#fff;background-color:#e04b59;border-color:#e04b59}.redOutlined:focus{text-decoration:underline}.redOutlined:active{background-color:#d32535;border-color:#d32535}.orangeFilled{color:#fff;background-color:#ff8000;border-color:#ff8000}.orangeFilled:hover{color:#fff;background-color:#ff8d1a;border-color:#ff8d1a}.orangeFilled:focus{text-decoration:underline}.orangeFilled:active{background-color:#e67300;border-color:#e67300}\n"] }]
|
|
569
|
+
}], propDecorators: { variant: [{
|
|
570
|
+
type: Input
|
|
571
|
+
}], size: [{
|
|
572
|
+
type: Input
|
|
573
|
+
}], fullWidth: [{
|
|
574
|
+
type: Input
|
|
575
|
+
}], hasBorder: [{
|
|
576
|
+
type: Input
|
|
577
|
+
}], disabled: [{
|
|
578
|
+
type: Input
|
|
579
|
+
}], isLoading: [{
|
|
580
|
+
type: Input
|
|
581
|
+
}], type: [{
|
|
582
|
+
type: Input
|
|
583
|
+
}], clickCallback: [{
|
|
584
|
+
type: Input
|
|
585
|
+
}], _: [{
|
|
586
|
+
type: HostBinding,
|
|
587
|
+
args: ['class._fullWidth']
|
|
588
|
+
}] } });
|
|
589
|
+
|
|
590
|
+
class CheckboxComponent extends ValueAccessorBase {
|
|
591
|
+
constructor() {
|
|
592
|
+
super(...arguments);
|
|
593
|
+
this.renderUndefinedAsIndeterminate = false;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
597
|
+
CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: CheckboxComponent, selector: "klp-form-checkbox", inputs: { caption: "caption", renderUndefinedAsIndeterminate: "renderUndefinedAsIndeterminate" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CheckboxComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<label class=\"componentContainer\">\n\t<div class=\"checkboxContainer\">\n\t\t<input type=\"checkbox\" class=\"checkboxNative\"\n\t\t\t[(ngModel)]=\"innerValue\"\n\t\t\t(change)=\"setInnerValueAndNotify(innerValue); touch()\"\n\t\t\t[disabled]=\"disabled\"\n\t\t/>\n <div class=\"checkboxVisual\">\n <svg *ngIf=\"innerValue === true\" version=\"1.1\" viewBox=\"0 0 4.2333 4.2333\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m0.17014 2.7065 1.3073 1.1798 2.5656-3.7404\" stroke=\"currentColor\" fill=\"none\" stroke-width=\".4646px\" />\n </svg>\n\t\t\t<svg *ngIf=\"renderUndefinedAsIndeterminate && innerValue === undefined\" version=\"1.1\" viewBox=\"0 0 4.2333 4.2333\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t<path d=\"m0.5 2.11665 3.2333 0\" stroke=\"currentColor\" fill=\"none\" stroke-width=\".4646px\" />\n\t\t\t</svg>\n </div>\n\t</div>\n\t<div *ngIf=\"caption\" class=\"caption\">{{ caption }}</div>\n</label>\n", styles: [":host{display:block}.componentContainer{display:flex;margin-bottom:0}.checkboxContainer{position:relative}.caption{cursor:pointer;font-weight:700;color:#888da8}.checkboxNative{position:absolute;opacity:0;top:0;left:0;width:22px;height:22px;cursor:pointer}.checkboxVisual{pointer-events:none;color:#27bb5f;padding:.125rem;width:22px;height:22px;display:inline-block;border:2px solid #e6ecf5;border-radius:3px;margin-right:10px;font-size:15px;font-weight:400;line-height:19px;vertical-align:bottom;text-align:center;background-color:#fff;cursor:pointer}.checkboxNative[disabled]{cursor:not-allowed}.checkboxNative[disabled]+.checkboxVisual:before{color:#666}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
599
|
+
type: Component,
|
|
600
|
+
args: [{ selector: 'klp-form-checkbox', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CheckboxComponent, multi: true }], template: "<label class=\"componentContainer\">\n\t<div class=\"checkboxContainer\">\n\t\t<input type=\"checkbox\" class=\"checkboxNative\"\n\t\t\t[(ngModel)]=\"innerValue\"\n\t\t\t(change)=\"setInnerValueAndNotify(innerValue); touch()\"\n\t\t\t[disabled]=\"disabled\"\n\t\t/>\n <div class=\"checkboxVisual\">\n <svg *ngIf=\"innerValue === true\" version=\"1.1\" viewBox=\"0 0 4.2333 4.2333\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m0.17014 2.7065 1.3073 1.1798 2.5656-3.7404\" stroke=\"currentColor\" fill=\"none\" stroke-width=\".4646px\" />\n </svg>\n\t\t\t<svg *ngIf=\"renderUndefinedAsIndeterminate && innerValue === undefined\" version=\"1.1\" viewBox=\"0 0 4.2333 4.2333\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t<path d=\"m0.5 2.11665 3.2333 0\" stroke=\"currentColor\" fill=\"none\" stroke-width=\".4646px\" />\n\t\t\t</svg>\n </div>\n\t</div>\n\t<div *ngIf=\"caption\" class=\"caption\">{{ caption }}</div>\n</label>\n", styles: [":host{display:block}.componentContainer{display:flex;margin-bottom:0}.checkboxContainer{position:relative}.caption{cursor:pointer;font-weight:700;color:#888da8}.checkboxNative{position:absolute;opacity:0;top:0;left:0;width:22px;height:22px;cursor:pointer}.checkboxVisual{pointer-events:none;color:#27bb5f;padding:.125rem;width:22px;height:22px;display:inline-block;border:2px solid #e6ecf5;border-radius:3px;margin-right:10px;font-size:15px;font-weight:400;line-height:19px;vertical-align:bottom;text-align:center;background-color:#fff;cursor:pointer}.checkboxNative[disabled]{cursor:not-allowed}.checkboxNative[disabled]+.checkboxVisual:before{color:#666}\n"] }]
|
|
601
|
+
}], propDecorators: { caption: [{
|
|
602
|
+
type: Input
|
|
603
|
+
}], renderUndefinedAsIndeterminate: [{
|
|
604
|
+
type: Input
|
|
605
|
+
}] } });
|
|
606
|
+
|
|
607
|
+
class EmailInputComponent extends ValueAccessorBase {
|
|
608
|
+
constructor() {
|
|
609
|
+
super(...arguments);
|
|
610
|
+
this.placeholder = '';
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
EmailInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: EmailInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
614
|
+
EmailInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: EmailInputComponent, selector: "klp-form-email-input", inputs: { placeholder: "placeholder" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: EmailInputComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<input\n\ttype=\"email\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n", styles: [":host{display:block}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}.showErrors{border-color:#ff8000}\n"], dependencies: [{ kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: EmailInputComponent, decorators: [{
|
|
616
|
+
type: Component,
|
|
617
|
+
args: [{ selector: 'klp-form-email-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: EmailInputComponent, multi: true }], template: "<input\n\ttype=\"email\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n", styles: [":host{display:block}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}.showErrors{border-color:#ff8000}\n"] }]
|
|
618
|
+
}], propDecorators: { placeholder: [{
|
|
619
|
+
type: Input
|
|
620
|
+
}] } });
|
|
621
|
+
|
|
622
|
+
class NumberInputComponent extends ValueAccessorBase {
|
|
623
|
+
constructor() {
|
|
624
|
+
super(...arguments);
|
|
625
|
+
this.parseNumber = false;
|
|
626
|
+
}
|
|
627
|
+
setInnerValueAndNotify(value) {
|
|
628
|
+
if (this.parseNumber && typeof value === "string") {
|
|
629
|
+
super.setInnerValueAndNotify(Number(value));
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
super.setInnerValueAndNotify(value);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
NumberInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NumberInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
637
|
+
NumberInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: NumberInputComponent, selector: "klp-form-number-input", inputs: { placeholder: "placeholder", parseNumber: "parseNumber" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: NumberInputComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<input\n\ttype=\"number\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t[disabled]=\"disabled\"\n/>\n", styles: [":host{display:block}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}.showErrors{border-color:#ff8000}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NumberInputComponent, decorators: [{
|
|
639
|
+
type: Component,
|
|
640
|
+
args: [{ selector: 'klp-form-number-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: NumberInputComponent, multi: true }], template: "<input\n\ttype=\"number\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t[disabled]=\"disabled\"\n/>\n", styles: [":host{display:block}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}.showErrors{border-color:#ff8000}\n"] }]
|
|
641
|
+
}], propDecorators: { placeholder: [{
|
|
642
|
+
type: Input
|
|
643
|
+
}], parseNumber: [{
|
|
644
|
+
type: Input
|
|
645
|
+
}] } });
|
|
646
|
+
|
|
647
|
+
class PasswordFieldComponent extends ValueAccessorBase {
|
|
648
|
+
constructor() {
|
|
649
|
+
super(...arguments);
|
|
650
|
+
this.placeholder = 'Password';
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
PasswordFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: PasswordFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
654
|
+
PasswordFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: PasswordFieldComponent, selector: "klp-form-password-field", inputs: { placeholder: "placeholder" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: PasswordFieldComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<input\n\ttype=\"password\"\n\tclass=\"form-control\"\n [ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n", styles: [":host{display:block}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}.showErrors{border-color:#ff8000}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: PasswordFieldComponent, decorators: [{
|
|
656
|
+
type: Component,
|
|
657
|
+
args: [{ selector: 'klp-form-password-field', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: PasswordFieldComponent, multi: true }], template: "<input\n\ttype=\"password\"\n\tclass=\"form-control\"\n [ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n", styles: [":host{display:block}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}.showErrors{border-color:#ff8000}\n"] }]
|
|
658
|
+
}], propDecorators: { placeholder: [{
|
|
659
|
+
type: Input
|
|
660
|
+
}] } });
|
|
661
|
+
|
|
662
|
+
const SELECT_TRANSLATIONS = new InjectionToken('klp.form.select.translations');
|
|
663
|
+
class KlpSelectOptionTemplateDirective {
|
|
664
|
+
}
|
|
665
|
+
KlpSelectOptionTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: KlpSelectOptionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
666
|
+
KlpSelectOptionTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: KlpSelectOptionTemplateDirective, selector: "[klpSelectOptionTpl]", ngImport: i0 });
|
|
667
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: KlpSelectOptionTemplateDirective, decorators: [{
|
|
668
|
+
type: Directive,
|
|
669
|
+
args: [{ selector: '[klpSelectOptionTpl]' }]
|
|
670
|
+
}] });
|
|
671
|
+
class SelectComponent extends ValueAccessorBase {
|
|
672
|
+
constructor(parent, controlContainer, translations, elRef) {
|
|
673
|
+
super(parent, controlContainer);
|
|
674
|
+
this.parent = parent;
|
|
675
|
+
this.controlContainer = controlContainer;
|
|
676
|
+
this.translations = translations;
|
|
677
|
+
this.elRef = elRef;
|
|
678
|
+
this.orientation = 'horizontal';
|
|
679
|
+
this.multiple = false;
|
|
680
|
+
this.multipleDisplayedAsAmount = false;
|
|
681
|
+
this.clearable = true;
|
|
682
|
+
this.truncateOptions = true;
|
|
683
|
+
this.onSearch = new EventEmitter();
|
|
684
|
+
this.onEndReached = new EventEmitter();
|
|
685
|
+
this.onOpened = new EventEmitter();
|
|
686
|
+
this.lastItemIndexReached = -1;
|
|
687
|
+
}
|
|
688
|
+
ngOnChanges(changes) {
|
|
689
|
+
if (isValueSet(changes.options)) {
|
|
690
|
+
this.lastItemIndexReached = -1;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
getDefaultTranslation(key) {
|
|
694
|
+
switch (key) {
|
|
695
|
+
case 'placeholder':
|
|
696
|
+
return () => 'Pick an option';
|
|
697
|
+
case 'amountSelected':
|
|
698
|
+
return (amount) => `${amount} selected`;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
getTranslation(key, params = null) {
|
|
702
|
+
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
703
|
+
return this.placeholder;
|
|
704
|
+
}
|
|
705
|
+
return this.translations?.[key]?.(params) ?? this.getDefaultTranslation(key)(params);
|
|
706
|
+
}
|
|
707
|
+
onScroll(lastItemIndex) {
|
|
708
|
+
const visibleItems = this.ngSelect?.itemsList?.filteredItems?.length ?? 0;
|
|
709
|
+
if (this.lastItemIndexReached < lastItemIndex && lastItemIndex === visibleItems) {
|
|
710
|
+
this.onEndReached.emit();
|
|
711
|
+
}
|
|
712
|
+
this.lastItemIndexReached = Math.max(lastItemIndex, this.lastItemIndexReached);
|
|
713
|
+
}
|
|
714
|
+
searchQueryChanged(searchQuery) {
|
|
715
|
+
this.onSearch.emit(searchQuery);
|
|
716
|
+
}
|
|
717
|
+
onOpen() {
|
|
718
|
+
// waiting for the thing to render until we fire the event
|
|
719
|
+
setTimeout(() => {
|
|
720
|
+
this.onOpened.emit();
|
|
721
|
+
if (this.truncateOptions === false) {
|
|
722
|
+
const widths = Array.from(this.elRef.nativeElement.querySelectorAll('.ng-option div')).map((e) => e.scrollWidth);
|
|
723
|
+
const maxWidth = Math.max(...widths);
|
|
724
|
+
const dropdownPanel = this.elRef.nativeElement.querySelector('ng-dropdown-panel');
|
|
725
|
+
dropdownPanel.style.width = `${maxWidth + 40}px`;
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectComponent, deps: [{ token: FormElementComponent, host: true, optional: true }, { token: i2.ControlContainer, host: true, optional: true }, { token: SELECT_TRANSLATIONS, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
731
|
+
SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: SelectComponent, selector: "klp-form-select", inputs: { placeholder: "placeholder", orientation: "orientation", options: "options", multiple: "multiple", multipleDisplayedAsAmount: "multipleDisplayedAsAmount", clearable: "clearable", truncateOptions: "truncateOptions", dropdownPosition: "dropdownPosition", customSearchFn: "customSearchFn", footerElement: "footerElement" }, outputs: { onSearch: "onSearch", onEndReached: "onEndReached", onOpened: "onOpened" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }], queries: [{ propertyName: "customOptionTpl", first: true, predicate: KlpSelectOptionTemplateDirective, descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "ngSelect", first: true, predicate: ["ngSelect"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-select\n\t#ngSelect\n\t[placeholder]=\"getTranslation('placeholder')\"\n\tbindLabel=\"name\"\n\tbindValue=\"id\"\n\t[items]=\"options\"\n\t[clearable]=\"clearable\"\n\t[(ngModel)]=\"innerValue\"\n\t[ngClass]=\"{showErrors: isInErrorState(), verticalOrientation: orientation === 'vertical'}\"\n\t(change)=\"setInnerValueAndNotify(innerValue)\"\n\t[multiple]=\"multiple\"\n\t[disabled]=\"disabled\"\n\t(blur)=\"touch()\"\n\t(search)=\"searchQueryChanged($event.term)\"\n\t[dropdownPosition]=\"dropdownPosition\"\n\t[searchFn]=\"customSearchFn\"\n\t[selectOnTab]=\"true\"\n\t[virtualScroll]=\"true\"\n\t(scroll)=\"onScroll($event.end)\"\n\t(open)=\"onOpen()\"\n>\n\t<ng-template let-item=\"item\" ng-option-tmp>\n\t\t<ng-container *ngIf=\"customOptionTpl\" [ngTemplateOutlet]=\"customOptionTpl\" [ngTemplateOutletContext]=\"{item: item}\"></ng-container>\n\t\t<div [attr.data-cy]=\"item.id\" *ngIf=\"!customOptionTpl\">\n\t\t\t{{ item.name }}\n\t\t\t<div *ngIf=\"item.description\" class=\"dropdown-item-description\">\n\t\t\t\t{{ item.description }}\n\t\t\t</div>\n\t\t</div>\n\t</ng-template>\n\t<ng-container *ngIf=\"multiple && multipleDisplayedAsAmount && innerValue?.length > 1\">\n\t\t<ng-template ng-multi-label-tmp>\n\t\t\t<div class=\"ng-value\">\n\t\t\t\t<span class=\"ng-value-label\">{{getTranslation('amountSelected', innerValue?.length)}}</span>\n\t\t\t</div>\n\t\t</ng-template>\n\t</ng-container>\n\t<ng-template ng-footer-tmp *ngIf=\"footerElement\">\n\t\t<ng-container [ngTemplateOutlet]=\"footerElement\"></ng-container>\n\t</ng-template>\n</ng-select>\n", styles: [":host{display:block}ng-select.showErrors::ng-deep .ng-select-container{border-color:#ff8000}:host ::ng-deep ng-select.ng-select .ng-select-container{color:#888da8}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container{background:#fff;border-color:#3ed778}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container:hover{box-shadow:none}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container .ng-arrow{top:-2px;border-color:transparent transparent #999;border-width:0 5px 5px}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container .ng-arrow:hover{border-color:transparent transparent #666}:host ::ng-deep .ng-select.ng-select-opened.ng-select-bottom>.ng-select-container{border-bottom-right-radius:0;border-bottom-left-radius:0}:host ::ng-deep .ng-select.ng-select-opened.ng-select-top>.ng-select-container{border-top-right-radius:0;border-top-left-radius:0}:host ::ng-deep .ng-select.ng-select-disabled>.ng-select-container{background-color:#f9f9f9}:host ::ng-deep .ng-select .ng-has-value .ng-placeholder{display:none}:host ::ng-deep .ng-select .ng-select-container{display:flex;flex-direction:row;border:1px solid #ccc;min-height:42px;align-items:center;background-clip:padding-box;background-color:#fff;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;box-sizing:border-box;color:#888da8;font-size:1rem;font-size:14px;line-height:1.5;margin:0;outline:none;overflow:visible;padding:.375rem .75rem;transition-delay:0s;transition-duration:.2s;transition-property:all;transition-timing-function:ease-in;width:100%}:host ::ng-deep .ng-select .ng-select-container:hover{box-shadow:0 1px #0000000f}:host ::ng-deep .ng-select .ng-select-container .ng-value-container{align-items:center;padding-left:10px;overflow:hidden}:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-placeholder{color:#aaa}:host ::ng-deep .ng-select.ng-select-single .ng-select-container{height:42px}:host ::ng-deep .ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{left:0;padding-left:10px;padding-right:50px;top:5px}:host ::ng-deep .ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value{background-color:#f9f9f9;border:1px solid #e3e3e3}:host ::ng-deep .ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-label{padding:0 5px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{font-size:.9em;margin-right:5px;margin-top:3px;margin-bottom:3px;background-color:#e7faee;border-radius:2px;border:1px solid #93e8b3;display:flex;overflow:hidden}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled{background-color:#f9f9f9;border:1px solid #e3e3e3}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-label{padding-left:5px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-label{display:inline-block;padding:0 5px;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:inline-block;padding:0 5px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon:hover{background-color:#93e8b3}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{border-right:1px solid #93e8b3}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.right{border-left:1px solid #c2e0ff}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{padding-bottom:3px;padding-left:3px}:host ::ng-deep ng-select.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{top:5px;padding-bottom:3px;padding-left:3px;position:static}:host ::ng-deep .ng-select .ng-clear-wrapper{color:#999}:host ::ng-deep .ng-select .ng-clear-wrapper .ng-clear:hover{color:#dc3545}:host ::ng-deep .ng-select .ng-spinner-zone{padding-right:5px;padding-top:5px}:host ::ng-deep .ng-select .ng-arrow-wrapper{padding-right:5px;width:25px}:host ::ng-deep .ng-select .ng-arrow-wrapper:hover .ng-arrow{border-top-color:#666}:host ::ng-deep .ng-select .ng-arrow-wrapper .ng-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 2.5px}:host ::ng-deep .ng-dropdown-panel{background-color:#fff;border:1px solid #3ed778;box-shadow:0 1px #0000000f}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom{top:100%;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top-color:#e6e6e6;margin-top:-1px}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom .ng-dropdown-panel-items .ng-option:last-child{border-bottom-right-radius:4px;border-bottom-left-radius:4px}:host ::ng-deep .ng-dropdown-panel.ng-select-top{bottom:100%;border-top-right-radius:4px;border-top-left-radius:4px;border-bottom-color:#e6e6e6;margin-bottom:-1px}:host ::ng-deep .ng-dropdown-panel.ng-select-top .ng-dropdown-panel-items .ng-option:first-child{border-top-right-radius:4px;border-top-left-radius:4px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-header{border-bottom:1px solid #ccc;padding:5px 7px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-footer{border-top:1px solid #ccc;padding:5px 7px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items{margin-bottom:1px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{-webkit-user-select:none;user-select:none;cursor:default;padding:8px 10px;font-weight:500;color:#0000008a;cursor:pointer}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-disabled{cursor:default}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-marked{background-color:#ebf5ff}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-selected{background-color:#f5faff;font-weight:600}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{background-color:#fff;color:#000000de;padding:8px 10px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected{color:#333;background-color:#e7faee}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected .ng-option-label{font-weight:600}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-marked{background-color:#e7faee;color:#333}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-disabled{color:#ccc}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-child{padding-left:22px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-tag-label{padding-right:5px;font-size:80%;font-weight:400}:host ::ng-deep ng-select.ng-select .ng-select-container .ng-value-container{padding-left:0}:host ::ng-deep ng-select.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{top:9px;color:#888da8}:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-input>input{color:#888da8}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{color:#888da8}:host ::ng-deep .ng-select.ng-select-auto-grow{max-width:inherit}:host ::ng-deep .ng-select.ng-select-auto-grow .ng-dropdown-panel{width:auto}.verticalOrientation{transform:translateY(100%) rotate(-90deg);transform-origin:top left}.verticalOrientation ::ng-deep ng-dropdown-panel.ng-select-bottom{transform:rotate(90deg) translate(100%);transform-origin:top right;border-top-color:#3ed778;border-bottom-right-radius:2px;border-bottom-left-radius:0;border-top-right-radius:2px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i4.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i4.NgMultiLabelTemplateDirective, selector: "[ng-multi-label-tmp]" }, { kind: "directive", type: i4.NgFooterTemplateDirective, selector: "[ng-footer-tmp]" }] });
|
|
732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectComponent, decorators: [{
|
|
733
|
+
type: Component,
|
|
734
|
+
args: [{ selector: 'klp-form-select', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }], template: "<ng-select\n\t#ngSelect\n\t[placeholder]=\"getTranslation('placeholder')\"\n\tbindLabel=\"name\"\n\tbindValue=\"id\"\n\t[items]=\"options\"\n\t[clearable]=\"clearable\"\n\t[(ngModel)]=\"innerValue\"\n\t[ngClass]=\"{showErrors: isInErrorState(), verticalOrientation: orientation === 'vertical'}\"\n\t(change)=\"setInnerValueAndNotify(innerValue)\"\n\t[multiple]=\"multiple\"\n\t[disabled]=\"disabled\"\n\t(blur)=\"touch()\"\n\t(search)=\"searchQueryChanged($event.term)\"\n\t[dropdownPosition]=\"dropdownPosition\"\n\t[searchFn]=\"customSearchFn\"\n\t[selectOnTab]=\"true\"\n\t[virtualScroll]=\"true\"\n\t(scroll)=\"onScroll($event.end)\"\n\t(open)=\"onOpen()\"\n>\n\t<ng-template let-item=\"item\" ng-option-tmp>\n\t\t<ng-container *ngIf=\"customOptionTpl\" [ngTemplateOutlet]=\"customOptionTpl\" [ngTemplateOutletContext]=\"{item: item}\"></ng-container>\n\t\t<div [attr.data-cy]=\"item.id\" *ngIf=\"!customOptionTpl\">\n\t\t\t{{ item.name }}\n\t\t\t<div *ngIf=\"item.description\" class=\"dropdown-item-description\">\n\t\t\t\t{{ item.description }}\n\t\t\t</div>\n\t\t</div>\n\t</ng-template>\n\t<ng-container *ngIf=\"multiple && multipleDisplayedAsAmount && innerValue?.length > 1\">\n\t\t<ng-template ng-multi-label-tmp>\n\t\t\t<div class=\"ng-value\">\n\t\t\t\t<span class=\"ng-value-label\">{{getTranslation('amountSelected', innerValue?.length)}}</span>\n\t\t\t</div>\n\t\t</ng-template>\n\t</ng-container>\n\t<ng-template ng-footer-tmp *ngIf=\"footerElement\">\n\t\t<ng-container [ngTemplateOutlet]=\"footerElement\"></ng-container>\n\t</ng-template>\n</ng-select>\n", styles: [":host{display:block}ng-select.showErrors::ng-deep .ng-select-container{border-color:#ff8000}:host ::ng-deep ng-select.ng-select .ng-select-container{color:#888da8}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container{background:#fff;border-color:#3ed778}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container:hover{box-shadow:none}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container .ng-arrow{top:-2px;border-color:transparent transparent #999;border-width:0 5px 5px}:host ::ng-deep .ng-select.ng-select-opened>.ng-select-container .ng-arrow:hover{border-color:transparent transparent #666}:host ::ng-deep .ng-select.ng-select-opened.ng-select-bottom>.ng-select-container{border-bottom-right-radius:0;border-bottom-left-radius:0}:host ::ng-deep .ng-select.ng-select-opened.ng-select-top>.ng-select-container{border-top-right-radius:0;border-top-left-radius:0}:host ::ng-deep .ng-select.ng-select-disabled>.ng-select-container{background-color:#f9f9f9}:host ::ng-deep .ng-select .ng-has-value .ng-placeholder{display:none}:host ::ng-deep .ng-select .ng-select-container{display:flex;flex-direction:row;border:1px solid #ccc;min-height:42px;align-items:center;background-clip:padding-box;background-color:#fff;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;box-sizing:border-box;color:#888da8;font-size:1rem;font-size:14px;line-height:1.5;margin:0;outline:none;overflow:visible;padding:.375rem .75rem;transition-delay:0s;transition-duration:.2s;transition-property:all;transition-timing-function:ease-in;width:100%}:host ::ng-deep .ng-select .ng-select-container:hover{box-shadow:0 1px #0000000f}:host ::ng-deep .ng-select .ng-select-container .ng-value-container{align-items:center;padding-left:10px;overflow:hidden}:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-placeholder{color:#aaa}:host ::ng-deep .ng-select.ng-select-single .ng-select-container{height:42px}:host ::ng-deep .ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{left:0;padding-left:10px;padding-right:50px;top:5px}:host ::ng-deep .ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value{background-color:#f9f9f9;border:1px solid #e3e3e3}:host ::ng-deep .ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-label{padding:0 5px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{font-size:.9em;margin-right:5px;margin-top:3px;margin-bottom:3px;background-color:#e7faee;border-radius:2px;border:1px solid #93e8b3;display:flex;overflow:hidden}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled{background-color:#f9f9f9;border:1px solid #e3e3e3}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-label{padding-left:5px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-label{display:inline-block;padding:0 5px;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:inline-block;padding:0 5px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon:hover{background-color:#93e8b3}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{border-right:1px solid #93e8b3}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.right{border-left:1px solid #c2e0ff}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{padding-bottom:3px;padding-left:3px}:host ::ng-deep ng-select.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{top:5px;padding-bottom:3px;padding-left:3px;position:static}:host ::ng-deep .ng-select .ng-clear-wrapper{color:#999}:host ::ng-deep .ng-select .ng-clear-wrapper .ng-clear:hover{color:#dc3545}:host ::ng-deep .ng-select .ng-spinner-zone{padding-right:5px;padding-top:5px}:host ::ng-deep .ng-select .ng-arrow-wrapper{padding-right:5px;width:25px}:host ::ng-deep .ng-select .ng-arrow-wrapper:hover .ng-arrow{border-top-color:#666}:host ::ng-deep .ng-select .ng-arrow-wrapper .ng-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 2.5px}:host ::ng-deep .ng-dropdown-panel{background-color:#fff;border:1px solid #3ed778;box-shadow:0 1px #0000000f}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom{top:100%;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top-color:#e6e6e6;margin-top:-1px}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom .ng-dropdown-panel-items .ng-option:last-child{border-bottom-right-radius:4px;border-bottom-left-radius:4px}:host ::ng-deep .ng-dropdown-panel.ng-select-top{bottom:100%;border-top-right-radius:4px;border-top-left-radius:4px;border-bottom-color:#e6e6e6;margin-bottom:-1px}:host ::ng-deep .ng-dropdown-panel.ng-select-top .ng-dropdown-panel-items .ng-option:first-child{border-top-right-radius:4px;border-top-left-radius:4px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-header{border-bottom:1px solid #ccc;padding:5px 7px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-footer{border-top:1px solid #ccc;padding:5px 7px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items{margin-bottom:1px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{-webkit-user-select:none;user-select:none;cursor:default;padding:8px 10px;font-weight:500;color:#0000008a;cursor:pointer}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-disabled{cursor:default}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-marked{background-color:#ebf5ff}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-selected{background-color:#f5faff;font-weight:600}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{background-color:#fff;color:#000000de;padding:8px 10px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected{color:#333;background-color:#e7faee}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected .ng-option-label{font-weight:600}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-marked{background-color:#e7faee;color:#333}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-disabled{color:#ccc}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-child{padding-left:22px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-tag-label{padding-right:5px;font-size:80%;font-weight:400}:host ::ng-deep ng-select.ng-select .ng-select-container .ng-value-container{padding-left:0}:host ::ng-deep ng-select.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{top:9px;color:#888da8}:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-input>input{color:#888da8}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{color:#888da8}:host ::ng-deep .ng-select.ng-select-auto-grow{max-width:inherit}:host ::ng-deep .ng-select.ng-select-auto-grow .ng-dropdown-panel{width:auto}.verticalOrientation{transform:translateY(100%) rotate(-90deg);transform-origin:top left}.verticalOrientation ::ng-deep ng-dropdown-panel.ng-select-bottom{transform:rotate(90deg) translate(100%);transform-origin:top right;border-top-color:#3ed778;border-bottom-right-radius:2px;border-bottom-left-radius:0;border-top-right-radius:2px}\n"] }]
|
|
735
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
736
|
+
type: Optional
|
|
737
|
+
}, {
|
|
738
|
+
type: Host
|
|
739
|
+
}] }, { type: i2.ControlContainer, decorators: [{
|
|
740
|
+
type: Optional
|
|
741
|
+
}, {
|
|
742
|
+
type: Host
|
|
743
|
+
}] }, { type: undefined, decorators: [{
|
|
744
|
+
type: Inject,
|
|
745
|
+
args: [SELECT_TRANSLATIONS]
|
|
746
|
+
}, {
|
|
747
|
+
type: Optional
|
|
748
|
+
}] }, { type: i0.ElementRef }]; }, propDecorators: { placeholder: [{
|
|
749
|
+
type: Input
|
|
750
|
+
}], orientation: [{
|
|
751
|
+
type: Input
|
|
752
|
+
}], options: [{
|
|
753
|
+
type: Input
|
|
754
|
+
}], multiple: [{
|
|
755
|
+
type: Input
|
|
756
|
+
}], multipleDisplayedAsAmount: [{
|
|
757
|
+
type: Input
|
|
758
|
+
}], clearable: [{
|
|
759
|
+
type: Input
|
|
760
|
+
}], truncateOptions: [{
|
|
761
|
+
type: Input
|
|
762
|
+
}], dropdownPosition: [{
|
|
763
|
+
type: Input
|
|
764
|
+
}], customSearchFn: [{
|
|
765
|
+
type: Input
|
|
766
|
+
}], footerElement: [{
|
|
767
|
+
type: Input
|
|
768
|
+
}], onSearch: [{
|
|
769
|
+
type: Output
|
|
770
|
+
}], onEndReached: [{
|
|
771
|
+
type: Output
|
|
772
|
+
}], onOpened: [{
|
|
773
|
+
type: Output
|
|
774
|
+
}], ngSelect: [{
|
|
775
|
+
type: ViewChild,
|
|
776
|
+
args: ['ngSelect']
|
|
777
|
+
}], customOptionTpl: [{
|
|
778
|
+
type: ContentChild,
|
|
779
|
+
args: [KlpSelectOptionTemplateDirective, { read: TemplateRef }]
|
|
780
|
+
}] } });
|
|
781
|
+
|
|
782
|
+
class SelectFooterComponent {
|
|
783
|
+
}
|
|
784
|
+
SelectFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
785
|
+
SelectFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: SelectFooterComponent, selector: "klp-select-footer", inputs: { prefix: "prefix", text: "text" }, ngImport: i0, template: "<div class=\"componentContainer\">\n\t<span class=\"prefix\">{{prefix}}</span>\n\t<span class=\"text\">{{text}}</span>\n</div>\n", styles: [":host{display:block}.componentContainer{cursor:pointer;padding:6px 10px}.componentContainer:hover{background:#e7faee}.prefix{font-size:80%;padding-right:.625rem}\n"] });
|
|
786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectFooterComponent, decorators: [{
|
|
787
|
+
type: Component,
|
|
788
|
+
args: [{ selector: 'klp-select-footer', template: "<div class=\"componentContainer\">\n\t<span class=\"prefix\">{{prefix}}</span>\n\t<span class=\"text\">{{text}}</span>\n</div>\n", styles: [":host{display:block}.componentContainer{cursor:pointer;padding:6px 10px}.componentContainer:hover{background:#e7faee}.prefix{font-size:80%;padding-right:.625rem}\n"] }]
|
|
789
|
+
}], propDecorators: { prefix: [{
|
|
790
|
+
type: Input
|
|
791
|
+
}], text: [{
|
|
792
|
+
type: Input
|
|
793
|
+
}] } });
|
|
794
|
+
|
|
795
|
+
class SortableItemsComponent extends ValueAccessorBase {
|
|
796
|
+
constructor() {
|
|
797
|
+
super(...arguments);
|
|
798
|
+
this.sortableItemSize = 'lg';
|
|
799
|
+
this.useCustomScroll = false;
|
|
800
|
+
this.scrollInterval = null;
|
|
801
|
+
this.itemsOrderChanged = () => {
|
|
802
|
+
this.setInnerValueAndNotify(this.innerValue);
|
|
803
|
+
};
|
|
804
|
+
this.onItemDrag = (data) => {
|
|
805
|
+
// if the item you're dragging is reaching the top, start scrolling.
|
|
806
|
+
if (data.relatedRect.top < 100) {
|
|
807
|
+
this.scrollPage(100);
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
this.stopScrolling();
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
this.onEnd = () => {
|
|
814
|
+
this.stopScrolling();
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
ngOnInit() {
|
|
818
|
+
super.ngOnInit();
|
|
819
|
+
if (this.useCustomScroll) {
|
|
820
|
+
this.sortablejsOptions = { onUpdate: this.itemsOrderChanged, onMove: this.onItemDrag, onEnd: this.onEnd };
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
this.sortablejsOptions = { onUpdate: this.itemsOrderChanged };
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
scrollPage(scrollAmount) {
|
|
827
|
+
if (!isValueSet(this.scrollInterval)) {
|
|
828
|
+
this.scrollInterval = setInterval(() => {
|
|
829
|
+
window.scroll({
|
|
830
|
+
top: document.scrollingElement.scrollTop - scrollAmount,
|
|
831
|
+
behavior: 'smooth',
|
|
832
|
+
});
|
|
833
|
+
if (document.scrollingElement.scrollTop <= 100) {
|
|
834
|
+
this.stopScrolling();
|
|
835
|
+
}
|
|
836
|
+
}, 100);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
stopScrolling() {
|
|
840
|
+
clearInterval(this.scrollInterval);
|
|
841
|
+
this.scrollInterval = null;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
SortableItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableItemsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
845
|
+
SortableItemsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: SortableItemsComponent, selector: "klp-form-sortable-items", inputs: { sortableItemSize: "sortableItemSize", useCustomScroll: "useCustomScroll" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SortableItemsComponent, multi: true }], queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #listItem>\n\t<li *ngFor=\"let item of innerValue; index as index\"\n\t\t\tclass=\"sortableItem\"\n\t\t\t[ngClass]=\"{\n\t\t\tlargeSortableItem: sortableItemSize === 'lg',\n\t\t \tsmallSortableItem: sortableItemSize === 'sm'\n\t\t }\"\n\t>\n\t\t<ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item, index:index }\"></ng-container>\n\t</li>\n</ng-template>\n\n<ol *ngIf='!disabled'\n\t\t[sortablejs]=\"innerValue\"\n\t\t[sortablejsOptions]=\"sortablejsOptions\"\n\t\tclass=\"itemsContainer\"\n>\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n\n<ol *ngIf='disabled' class=\"itemsContainer disabled-mouse-cursor\">\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n", styles: [":host{display:block}.itemsContainer{border:1px solid #e6ecf5;border-radius:5px;padding:0;margin-bottom:0}.sortableItem{list-style:none;border-top:1px solid #e6ecf5;cursor:grab}.sortableItem:hover{background:#f8f9fa}.sortableItem:first-child{border-top:none}.largeSortableItem{padding:15px}.smallSortableItem{padding:0 10px}.disabled-mouse-cursor li{cursor:no-drop}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.SortablejsDirective, selector: "[sortablejs]", inputs: ["sortablejs", "sortablejsContainer", "sortablejsOptions", "sortablejsCloneFunction"], outputs: ["sortablejsInit"] }] });
|
|
846
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableItemsComponent, decorators: [{
|
|
847
|
+
type: Component,
|
|
848
|
+
args: [{ selector: 'klp-form-sortable-items', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SortableItemsComponent, multi: true }], template: "<ng-template #listItem>\n\t<li *ngFor=\"let item of innerValue; index as index\"\n\t\t\tclass=\"sortableItem\"\n\t\t\t[ngClass]=\"{\n\t\t\tlargeSortableItem: sortableItemSize === 'lg',\n\t\t \tsmallSortableItem: sortableItemSize === 'sm'\n\t\t }\"\n\t>\n\t\t<ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item, index:index }\"></ng-container>\n\t</li>\n</ng-template>\n\n<ol *ngIf='!disabled'\n\t\t[sortablejs]=\"innerValue\"\n\t\t[sortablejsOptions]=\"sortablejsOptions\"\n\t\tclass=\"itemsContainer\"\n>\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n\n<ol *ngIf='disabled' class=\"itemsContainer disabled-mouse-cursor\">\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n", styles: [":host{display:block}.itemsContainer{border:1px solid #e6ecf5;border-radius:5px;padding:0;margin-bottom:0}.sortableItem{list-style:none;border-top:1px solid #e6ecf5;cursor:grab}.sortableItem:hover{background:#f8f9fa}.sortableItem:first-child{border-top:none}.largeSortableItem{padding:15px}.smallSortableItem{padding:0 10px}.disabled-mouse-cursor li{cursor:no-drop}\n"] }]
|
|
849
|
+
}], propDecorators: { template: [{
|
|
850
|
+
type: ContentChild,
|
|
851
|
+
args: [TemplateRef]
|
|
852
|
+
}], sortableItemSize: [{
|
|
853
|
+
type: Input
|
|
854
|
+
}], useCustomScroll: [{
|
|
855
|
+
type: Input
|
|
856
|
+
}] } });
|
|
857
|
+
|
|
858
|
+
class TextInputComponent extends ValueAccessorBase {
|
|
859
|
+
constructor() {
|
|
860
|
+
super(...arguments);
|
|
861
|
+
this.type = 'text';
|
|
862
|
+
this.clearable = false;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
TextInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: TextInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
866
|
+
TextInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: TextInputComponent, selector: "klp-form-text-input", inputs: { placeholder: "placeholder", type: "type", clearable: "clearable", icon: "icon" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable}\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch()\"\n\t\t[disabled]='disabled'\n\t/>\n\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{position:absolute;left:.625rem;top:14px}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}.clearIcon{position:absolute;right:.625rem;top:7px;font-size:18px;cursor:pointer}.showErrors{border-color:#ff8000}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
868
|
+
type: Component,
|
|
869
|
+
args: [{ selector: 'klp-form-text-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }], template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable}\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch()\"\n\t\t[disabled]='disabled'\n\t/>\n\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{position:absolute;left:.625rem;top:14px}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}.clearIcon{position:absolute;right:.625rem;top:7px;font-size:18px;cursor:pointer}.showErrors{border-color:#ff8000}\n"] }]
|
|
870
|
+
}], propDecorators: { placeholder: [{
|
|
871
|
+
type: Input
|
|
872
|
+
}], type: [{
|
|
873
|
+
type: Input
|
|
874
|
+
}], clearable: [{
|
|
875
|
+
type: Input
|
|
876
|
+
}], icon: [{
|
|
877
|
+
type: Input
|
|
878
|
+
}] } });
|
|
879
|
+
|
|
880
|
+
class ToggleComponent extends ValueAccessorBase {
|
|
881
|
+
}
|
|
882
|
+
ToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
883
|
+
ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: ToggleComponent, selector: "klp-form-toggle", providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: ToggleComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input type=\"checkbox\" class=\"nativeCheckbox\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.checked); touch()\"\n\t\t[disabled]=\"disabled\"\n\t\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t/>\n\t<div class=\"toggleVisual\"></div>\n</div>\n", styles: [":host{display:block}.componentContainer{position:relative}.nativeCheckbox{position:absolute;opacity:0;top:0;left:0;width:35px;height:20px;cursor:pointer}.toggleVisual{pointer-events:none;position:relative;display:block;transition:.4s ease;-webkit-transition:.4s ease;-moz-transition:.4s ease;-o-transition:.4s ease;-ms-transition:.4s ease;width:35px;height:20px;border:1px solid #e6ecf5;border-radius:35px}.toggleVisual:before{content:\"\";position:absolute;display:block;transition:.2s cubic-bezier(.24,0,.5,1);-webkit-transition:.2s cubic-bezier(.24,0,.5,1);-moz-transition:.2s cubic-bezier(.24,0,.5,1);-o-transition:.2s cubic-bezier(.24,0,.5,1);-ms-transition:.2s cubic-bezier(.24,0,.5,1);margin:1px;width:33px;height:18px;top:-1px;left:-1px;border-radius:30px}.toggleVisual:after{content:\"\";position:absolute;display:block;box-shadow:0 0 0 1px #0000001a,0 4px #0000000a,0 4px 9px #00000021,0 3px 3px #0000000d;transition:.35s cubic-bezier(.54,1.6,.5,1);-webkit-transition:.35s cubic-bezier(.54,1.6,.5,1);-moz-transition:.35s cubic-bezier(.54,1.6,.5,1);-o-transition:.35s cubic-bezier(.54,1.6,.5,1);-ms-transition:.35s cubic-bezier(.54,1.6,.5,1);background:#f7f7f7;height:20px;width:20px;top:-1px;left:0;border-radius:60px}.nativeCheckbox:checked+.toggleVisual:before{background:#37c936;transition:width .2s cubic-bezier(0,0,0,.1);-webkit-transition:width .2s cubic-bezier(0,0,0,.1);-moz-transition:width .2s cubic-bezier(0,0,0,.1);-o-transition:width .2s cubic-bezier(0,0,0,.1);-ms-transition:width .2s cubic-bezier(0,0,0,.1)}.nativeCheckbox:checked+.toggleVisual:after{left:18px}.disabled{opacity:.6}.showErrors+.toggleVisual:before{border:1px solid #ff8000}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ToggleComponent, decorators: [{
|
|
885
|
+
type: Component,
|
|
886
|
+
args: [{ selector: 'klp-form-toggle', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: ToggleComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input type=\"checkbox\" class=\"nativeCheckbox\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.checked); touch()\"\n\t\t[disabled]=\"disabled\"\n\t\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t/>\n\t<div class=\"toggleVisual\"></div>\n</div>\n", styles: [":host{display:block}.componentContainer{position:relative}.nativeCheckbox{position:absolute;opacity:0;top:0;left:0;width:35px;height:20px;cursor:pointer}.toggleVisual{pointer-events:none;position:relative;display:block;transition:.4s ease;-webkit-transition:.4s ease;-moz-transition:.4s ease;-o-transition:.4s ease;-ms-transition:.4s ease;width:35px;height:20px;border:1px solid #e6ecf5;border-radius:35px}.toggleVisual:before{content:\"\";position:absolute;display:block;transition:.2s cubic-bezier(.24,0,.5,1);-webkit-transition:.2s cubic-bezier(.24,0,.5,1);-moz-transition:.2s cubic-bezier(.24,0,.5,1);-o-transition:.2s cubic-bezier(.24,0,.5,1);-ms-transition:.2s cubic-bezier(.24,0,.5,1);margin:1px;width:33px;height:18px;top:-1px;left:-1px;border-radius:30px}.toggleVisual:after{content:\"\";position:absolute;display:block;box-shadow:0 0 0 1px #0000001a,0 4px #0000000a,0 4px 9px #00000021,0 3px 3px #0000000d;transition:.35s cubic-bezier(.54,1.6,.5,1);-webkit-transition:.35s cubic-bezier(.54,1.6,.5,1);-moz-transition:.35s cubic-bezier(.54,1.6,.5,1);-o-transition:.35s cubic-bezier(.54,1.6,.5,1);-ms-transition:.35s cubic-bezier(.54,1.6,.5,1);background:#f7f7f7;height:20px;width:20px;top:-1px;left:0;border-radius:60px}.nativeCheckbox:checked+.toggleVisual:before{background:#37c936;transition:width .2s cubic-bezier(0,0,0,.1);-webkit-transition:width .2s cubic-bezier(0,0,0,.1);-moz-transition:width .2s cubic-bezier(0,0,0,.1);-o-transition:width .2s cubic-bezier(0,0,0,.1);-ms-transition:width .2s cubic-bezier(0,0,0,.1)}.nativeCheckbox:checked+.toggleVisual:after{left:18px}.disabled{opacity:.6}.showErrors+.toggleVisual:before{border:1px solid #ff8000}\n"] }]
|
|
887
|
+
}] });
|
|
888
|
+
|
|
889
|
+
class FormCaptionComponent {
|
|
890
|
+
constructor(parent) {
|
|
891
|
+
this.parent = parent;
|
|
892
|
+
}
|
|
893
|
+
ngOnInit() {
|
|
894
|
+
// this is being run next cycle, because we dont want to fail if the order of components is as follows:
|
|
895
|
+
// <app-form-error />
|
|
896
|
+
// <some-input />
|
|
897
|
+
// That would fail, because the logic of the form error is run first, and at that moment, the `some-input` isnt registered yet
|
|
898
|
+
setTimeout(() => {
|
|
899
|
+
const attachedControl = this.parent.getAttachedControl();
|
|
900
|
+
this.parent.registerCaption(this.contentRef);
|
|
901
|
+
if (isNullOrUndefined(attachedControl)) {
|
|
902
|
+
throw new Error('You added a Form Caption component without an attached Form Control');
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
FormCaptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormCaptionComponent, deps: [{ token: FormElementComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
908
|
+
FormCaptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormCaptionComponent, selector: "klp-form-caption", viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["contentRef"], descendants: true }], ngImport: i0, template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] });
|
|
909
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormCaptionComponent, decorators: [{
|
|
910
|
+
type: Component,
|
|
911
|
+
args: [{ selector: 'klp-form-caption', template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
912
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
913
|
+
type: Host
|
|
914
|
+
}, {
|
|
915
|
+
type: Optional
|
|
916
|
+
}] }]; }, propDecorators: { contentRef: [{
|
|
917
|
+
type: ViewChild,
|
|
918
|
+
args: ['contentRef']
|
|
919
|
+
}] } });
|
|
920
|
+
|
|
921
|
+
class FormErrorComponent {
|
|
922
|
+
constructor(parent) {
|
|
923
|
+
this.parent = parent;
|
|
924
|
+
this.showError = false;
|
|
925
|
+
}
|
|
926
|
+
ngOnInit() {
|
|
927
|
+
// this is being run next cycle, because we dont want to fail if the order of components is as follows:
|
|
928
|
+
// <app-form-error />
|
|
929
|
+
// <some-input />
|
|
930
|
+
// That would fail, because the logic of the form error is run first, and at that moment, the `some-input` isnt registered yet
|
|
931
|
+
setTimeout(() => {
|
|
932
|
+
const attachedControl = this.parent.getAttachedControl();
|
|
933
|
+
this.parent.registerErrorHandler(this.error, this.contentRef);
|
|
934
|
+
if (isNullOrUndefined(attachedControl)) {
|
|
935
|
+
throw new Error('You added a Form Error component without an attached Form Control');
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
FormErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormErrorComponent, deps: [{ token: FormElementComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
941
|
+
FormErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormErrorComponent, selector: "klp-form-error", inputs: { error: "error" }, viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["contentRef"], descendants: true }], ngImport: i0, template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] });
|
|
942
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormErrorComponent, decorators: [{
|
|
943
|
+
type: Component,
|
|
944
|
+
args: [{ selector: 'klp-form-error', template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
945
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
946
|
+
type: Host
|
|
947
|
+
}, {
|
|
948
|
+
type: Optional
|
|
949
|
+
}] }]; }, propDecorators: { error: [{
|
|
950
|
+
type: Input
|
|
951
|
+
}], contentRef: [{
|
|
952
|
+
type: ViewChild,
|
|
953
|
+
args: ['contentRef']
|
|
954
|
+
}] } });
|
|
955
|
+
|
|
956
|
+
class FormSubmitButtonComponent {
|
|
957
|
+
constructor(parentForm) {
|
|
958
|
+
this.parentForm = parentForm;
|
|
959
|
+
this.isLoading = false;
|
|
960
|
+
this.fullWidth = false;
|
|
961
|
+
this.variant = 'greenFilled';
|
|
962
|
+
}
|
|
963
|
+
get _() {
|
|
964
|
+
return this.fullWidth;
|
|
965
|
+
}
|
|
966
|
+
submitForm() {
|
|
967
|
+
this.parentForm
|
|
968
|
+
.trySubmit()
|
|
969
|
+
.then((value) => {
|
|
970
|
+
this.isLoading = true;
|
|
971
|
+
const submitCallbackResult = this.submitCallback(value);
|
|
972
|
+
if (isNullOrUndefined(submitCallbackResult)) {
|
|
973
|
+
throw new Error('No promise is returned in your submit function.');
|
|
974
|
+
}
|
|
975
|
+
return submitCallbackResult.then(() => (this.isLoading = false)).catch((e) => {
|
|
976
|
+
this.isLoading = false;
|
|
977
|
+
throw e;
|
|
978
|
+
});
|
|
979
|
+
})
|
|
980
|
+
.catch((e) => {
|
|
981
|
+
if (e === invalidFieldsSymbol) {
|
|
982
|
+
return; // swallow the error, the framework will scroll to the field that needs attention
|
|
983
|
+
}
|
|
984
|
+
throw e;
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
FormSubmitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormSubmitButtonComponent, deps: [{ token: FormComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
989
|
+
FormSubmitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormSubmitButtonComponent, selector: "klp-form-submit-button", inputs: { isLoading: "isLoading", fullWidth: "fullWidth", variant: "variant", submitCallback: "submitCallback" }, host: { properties: { "class._fullWidth": "this._" } }, ngImport: i0, template: "<klp-form-button\n\t\t[variant]=\"variant\"\n\t\t(click)=\"submitForm()\"\n\t\t[disabled]=\"isLoading\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\ttype=\"submit\"\n\t\t[ngClass]=\"fullWidth ? 'fullWidth' : ''\"\n\t>\n\t<ng-content></ng-content>\n</klp-form-button>\n", styles: [":host{display:inline-block}:host._fullWidth{display:block}.fullWidth{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ButtonComponent, selector: "klp-form-button", inputs: ["variant", "size", "fullWidth", "hasBorder", "disabled", "isLoading", "type", "clickCallback"] }] });
|
|
990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormSubmitButtonComponent, decorators: [{
|
|
991
|
+
type: Component,
|
|
992
|
+
args: [{ selector: 'klp-form-submit-button', template: "<klp-form-button\n\t\t[variant]=\"variant\"\n\t\t(click)=\"submitForm()\"\n\t\t[disabled]=\"isLoading\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\ttype=\"submit\"\n\t\t[ngClass]=\"fullWidth ? 'fullWidth' : ''\"\n\t>\n\t<ng-content></ng-content>\n</klp-form-button>\n", styles: [":host{display:inline-block}:host._fullWidth{display:block}.fullWidth{width:100%}\n"] }]
|
|
993
|
+
}], ctorParameters: function () { return [{ type: FormComponent, decorators: [{
|
|
994
|
+
type: Host
|
|
995
|
+
}, {
|
|
996
|
+
type: Optional
|
|
997
|
+
}] }]; }, propDecorators: { isLoading: [{
|
|
998
|
+
type: Input
|
|
999
|
+
}], fullWidth: [{
|
|
1000
|
+
type: Input
|
|
1001
|
+
}], variant: [{
|
|
1002
|
+
type: Input
|
|
1003
|
+
}], submitCallback: [{
|
|
1004
|
+
type: Input
|
|
1005
|
+
}], _: [{
|
|
1006
|
+
type: HostBinding,
|
|
1007
|
+
args: ['class._fullWidth']
|
|
1008
|
+
}] } });
|
|
1009
|
+
|
|
1010
|
+
class MultipleValueAccessorBase extends ValueAccessorBase {
|
|
1011
|
+
constructor(parent, controlContainer) {
|
|
1012
|
+
super(parent, controlContainer);
|
|
1013
|
+
this.parent = parent;
|
|
1014
|
+
this.controlContainer = controlContainer;
|
|
1015
|
+
this.multiple = false;
|
|
1016
|
+
}
|
|
1017
|
+
writeValue(value) {
|
|
1018
|
+
// if the outside world passes a value in the wrong format, it should be corrected
|
|
1019
|
+
if (this.multiple && !Array.isArray(value)) {
|
|
1020
|
+
const correctedVal = [value].filter(isValueSet);
|
|
1021
|
+
super.writeValue(correctedVal);
|
|
1022
|
+
super.setInnerValueAndNotify(correctedVal);
|
|
1023
|
+
}
|
|
1024
|
+
else if (!this.multiple && Array.isArray(value)) {
|
|
1025
|
+
const correctedVal = value[0];
|
|
1026
|
+
super.writeValue(correctedVal);
|
|
1027
|
+
super.setInnerValueAndNotify(correctedVal);
|
|
1028
|
+
}
|
|
1029
|
+
else {
|
|
1030
|
+
super.writeValue(value);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
setInnerValueAndNotify(value) {
|
|
1034
|
+
if (this.multiple && !Array.isArray(value)) {
|
|
1035
|
+
super.setInnerValueAndNotify([value].filter(isValueSet));
|
|
1036
|
+
}
|
|
1037
|
+
else if (!this.multiple && Array.isArray(value)) {
|
|
1038
|
+
super.setInnerValueAndNotify(value[0]);
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
super.setInnerValueAndNotify(value);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
MultipleValueAccessorBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MultipleValueAccessorBase, deps: [{ token: FormElementComponent, host: true, optional: true }, { token: i2.ControlContainer, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1046
|
+
MultipleValueAccessorBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: MultipleValueAccessorBase, selector: "ng-component", inputs: { multiple: "multiple" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
1047
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MultipleValueAccessorBase, decorators: [{
|
|
1048
|
+
type: Component,
|
|
1049
|
+
args: [{
|
|
1050
|
+
selector: '',
|
|
1051
|
+
template: '',
|
|
1052
|
+
}]
|
|
1053
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
1054
|
+
type: Host
|
|
1055
|
+
}, {
|
|
1056
|
+
type: Optional
|
|
1057
|
+
}] }, { type: i2.ControlContainer, decorators: [{
|
|
1058
|
+
type: Host
|
|
1059
|
+
}, {
|
|
1060
|
+
type: Optional
|
|
1061
|
+
}] }]; }, propDecorators: { multiple: [{
|
|
1062
|
+
type: Input
|
|
1063
|
+
}] } });
|
|
1064
|
+
|
|
1065
|
+
const invalidDateKey = '--invalid_date--';
|
|
1066
|
+
function dateValidator(control) {
|
|
1067
|
+
const invalid = control.value === invalidDateKey;
|
|
1068
|
+
return invalid ? { date: control.value } : null;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
const KLP_DATE_FORMATS = new InjectionToken('klp.form.date.formats');
|
|
1072
|
+
const DATE_TIME_PICKER_TRANSLATIONS = new InjectionToken('klp.form.dateTime.translations');
|
|
1073
|
+
const DATE_PICKER_LOCALE = new InjectionToken('klp.form.dateTime.locale');
|
|
1074
|
+
function matDateFormatsFactory(component, dateFormats) {
|
|
1075
|
+
return dateFormats?.(component.format) ?? MAT_NATIVE_DATE_FORMATS;
|
|
1076
|
+
}
|
|
1077
|
+
class DateTimePickerComponent extends MultipleValueAccessorBase {
|
|
1078
|
+
constructor(parent, controlContainer, translations, datePickerLocale, dateAdapter, cdr) {
|
|
1079
|
+
super(parent, controlContainer);
|
|
1080
|
+
this.parent = parent;
|
|
1081
|
+
this.controlContainer = controlContainer;
|
|
1082
|
+
this.translations = translations;
|
|
1083
|
+
this.datePickerLocale = datePickerLocale;
|
|
1084
|
+
this.dateAdapter = dateAdapter;
|
|
1085
|
+
this.cdr = cdr;
|
|
1086
|
+
this.minDate = undefined;
|
|
1087
|
+
this.maxDate = undefined;
|
|
1088
|
+
this.sameMonthOnly = false;
|
|
1089
|
+
this.format = 'dd-MM-yyyy';
|
|
1090
|
+
this.clearable = false;
|
|
1091
|
+
this.showTimeInput = true;
|
|
1092
|
+
this.invalidTimeAsMidnight = false; // if the time is not valid, use 00:00 as the time
|
|
1093
|
+
this.openPickerOnDate = null;
|
|
1094
|
+
this.minDateStartOfDay = undefined;
|
|
1095
|
+
this.maxDateEndOfDay = undefined;
|
|
1096
|
+
this.selectedDates = [];
|
|
1097
|
+
this.dateTouched = false;
|
|
1098
|
+
this.hoursTouched = false;
|
|
1099
|
+
this.minutesTouched = false;
|
|
1100
|
+
this.isSelected = (d) => {
|
|
1101
|
+
if (this.multiple) {
|
|
1102
|
+
return this.selectedDates.some((e) => isSameDay(e, d)) ? 'selected' : '';
|
|
1103
|
+
}
|
|
1104
|
+
return '';
|
|
1105
|
+
};
|
|
1106
|
+
this.filterDates = (e) => {
|
|
1107
|
+
if (this.disabled) {
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
return true;
|
|
1111
|
+
};
|
|
1112
|
+
if (isValueSet(datePickerLocale)) {
|
|
1113
|
+
dateAdapter.setLocale(datePickerLocale());
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
ngOnInit() {
|
|
1117
|
+
super.ngOnInit();
|
|
1118
|
+
if (this.multiple) {
|
|
1119
|
+
this.placeholder = '';
|
|
1120
|
+
this.showTimeInput = false;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
ngAfterViewInit() {
|
|
1124
|
+
if (this.multiple) {
|
|
1125
|
+
// we are going to overwrite the datepicker closing fn later, so we are saving it here to restore it when needed
|
|
1126
|
+
this.datePickingClosingFn = this.datePickerRef.close;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
ngOnChanges(changes) {
|
|
1130
|
+
if (changes.minDate) {
|
|
1131
|
+
this.determineMinAndMaxDates();
|
|
1132
|
+
}
|
|
1133
|
+
if (changes.maxDate) {
|
|
1134
|
+
this.determineMinAndMaxDates();
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
setMinDate(minDate) {
|
|
1138
|
+
if (minDate) {
|
|
1139
|
+
this.minDateStartOfDay = new Date(minDate);
|
|
1140
|
+
this.minDateStartOfDay.setHours(0, 0, 0, 0);
|
|
1141
|
+
}
|
|
1142
|
+
else {
|
|
1143
|
+
this.minDateStartOfDay = undefined;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
setMaxDate(maxDate) {
|
|
1147
|
+
if (maxDate) {
|
|
1148
|
+
this.maxDateEndOfDay = new Date(maxDate);
|
|
1149
|
+
this.maxDateEndOfDay.setHours(23, 59, 59, 999);
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
this.maxDateEndOfDay = undefined;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
getSelectedMonths() {
|
|
1156
|
+
return removeDuplicatesFromArray(this.selectedDates.map((e) => format(e, 'MMMM'))).length;
|
|
1157
|
+
}
|
|
1158
|
+
// dateChanged is called when the output of the datepicker is changed and
|
|
1159
|
+
// parsed correctly. If the date is invalid, it will be called the first time
|
|
1160
|
+
// with null but never again until a valid input is provided.
|
|
1161
|
+
dateChanged(event) {
|
|
1162
|
+
const date = event.value;
|
|
1163
|
+
if (this.multiple) {
|
|
1164
|
+
this.datePickerRef.close = () => {
|
|
1165
|
+
};
|
|
1166
|
+
if (this.selectedDates.some((e) => isSameDay(e, date))) {
|
|
1167
|
+
this.selectedDates = this.selectedDates.filter((e) => !isSameDay(e, date));
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
this.selectedDates = [...this.selectedDates, date];
|
|
1171
|
+
}
|
|
1172
|
+
// START HACK
|
|
1173
|
+
// the date picker does not provide any rerender calls. Therefore, we are going to change the minDate in order to force the render
|
|
1174
|
+
// This is needed to show all selected days in our date picker
|
|
1175
|
+
// We also set the innerValue to null (with this.valueForMaterialDatePicker = null;), otherwise you can not
|
|
1176
|
+
// deselect your last picked date
|
|
1177
|
+
this.cdr.detectChanges();
|
|
1178
|
+
this.valueForMaterialDatePicker = null;
|
|
1179
|
+
const oldMinDate = this.minDateStartOfDay;
|
|
1180
|
+
this.minDateStartOfDay = new Date(0);
|
|
1181
|
+
this.cdr.detectChanges();
|
|
1182
|
+
this.minDateStartOfDay = oldMinDate;
|
|
1183
|
+
// END HACK
|
|
1184
|
+
if (this.sameMonthOnly) {
|
|
1185
|
+
if (this.selectedDates.length >= 2) {
|
|
1186
|
+
if (date < startOfMonth(this.selectedDates[0]) || date > endOfMonth(this.selectedDates[0])) {
|
|
1187
|
+
this.selectedDates = [date];
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
this.determineMinAndMaxDates();
|
|
1191
|
+
}
|
|
1192
|
+
this.setInnerValueAndNotify(this.selectedDates);
|
|
1193
|
+
setTimeout(() => {
|
|
1194
|
+
this.datePickerRef.close = this.datePickingClosingFn;
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
this.notifyNewDate();
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
determineMinAndMaxDates() {
|
|
1202
|
+
if (this.sameMonthOnly) {
|
|
1203
|
+
if (this.selectedDates.length >= 2) {
|
|
1204
|
+
this.setMinDate(startOfMonth(this.selectedDates[0]));
|
|
1205
|
+
this.setMaxDate(endOfMonth(this.selectedDates[0]));
|
|
1206
|
+
}
|
|
1207
|
+
else {
|
|
1208
|
+
this.setMinDate(this.minDate);
|
|
1209
|
+
this.setMaxDate(this.maxDate);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
this.setMinDate(this.minDate);
|
|
1214
|
+
this.setMaxDate(this.maxDate);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
notifyNewDate() {
|
|
1218
|
+
const nativeInputValue = this.nativeInputRef.nativeElement.value;
|
|
1219
|
+
const parsedHours = Number(this.hours);
|
|
1220
|
+
const parsedMinutes = Number(this.minutes);
|
|
1221
|
+
// if we dont have the time element
|
|
1222
|
+
if (!this.showTimeInput) {
|
|
1223
|
+
if (!stringIsSetAndFilled(nativeInputValue)) {
|
|
1224
|
+
this.setInnerValueAndNotify(null);
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
if (this.valueForMaterialDatePicker instanceof Date) {
|
|
1228
|
+
this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
// when all inputs are empty
|
|
1233
|
+
if (!stringIsSetAndFilled(nativeInputValue) && !stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
|
|
1234
|
+
this.setInnerValueAndNotify(null);
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
// if we have date and time
|
|
1238
|
+
if (stringIsSetAndFilled(this.hours) &&
|
|
1239
|
+
Number.isFinite(parsedHours) &&
|
|
1240
|
+
parsedHours >= 0 &&
|
|
1241
|
+
parsedHours <= 23 &&
|
|
1242
|
+
stringIsSetAndFilled(this.minutes) &&
|
|
1243
|
+
Number.isFinite(parsedMinutes) &&
|
|
1244
|
+
parsedMinutes >= 0 &&
|
|
1245
|
+
parsedMinutes <= 59 &&
|
|
1246
|
+
this.valueForMaterialDatePicker instanceof Date) {
|
|
1247
|
+
const newDateWithHours = new Date(this.valueForMaterialDatePicker.setHours(parsedHours));
|
|
1248
|
+
const newDateWithMinutes = new Date(newDateWithHours.setMinutes(parsedMinutes));
|
|
1249
|
+
this.setInnerValueAndNotify(newDateWithMinutes);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
if (this.invalidTimeAsMidnight) {
|
|
1253
|
+
if (this.valueForMaterialDatePicker instanceof Date) {
|
|
1254
|
+
this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
// all other cases, we are not in a valid state
|
|
1259
|
+
this.setInnerValueAndNotify(invalidDateKey);
|
|
1260
|
+
}
|
|
1261
|
+
writeValue(value) {
|
|
1262
|
+
super.writeValue(value);
|
|
1263
|
+
if (Array.isArray(value)) {
|
|
1264
|
+
this.selectedDates = value;
|
|
1265
|
+
this.determineMinAndMaxDates();
|
|
1266
|
+
this.valueForMaterialDatePicker = null;
|
|
1267
|
+
if (arrayIsSetAndFilled(value)) {
|
|
1268
|
+
this.openPickerOnDate = this.selectedDates[0];
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
else {
|
|
1272
|
+
this.valueForMaterialDatePicker = value === invalidDateKey ? null : value;
|
|
1273
|
+
if (value instanceof Date) {
|
|
1274
|
+
this.hours = String(value.getHours());
|
|
1275
|
+
this.minutes = String(value.getMinutes());
|
|
1276
|
+
this.formatTime();
|
|
1277
|
+
this.openPickerOnDate = value;
|
|
1278
|
+
}
|
|
1279
|
+
else {
|
|
1280
|
+
this.hours = '';
|
|
1281
|
+
this.minutes = '';
|
|
1282
|
+
this.openPickerOnDate = null;
|
|
1283
|
+
this.selectedDates = [];
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
// nativeValueChanged is called when the internal text value changes, but not
|
|
1288
|
+
// when the date is changed via the date picker. We need this so that we can
|
|
1289
|
+
// determine if the datepicker is empty or invalid.
|
|
1290
|
+
nativeValueChanged() {
|
|
1291
|
+
if (this.datePickerRef.opened) {
|
|
1292
|
+
// if the user is typing instead of using the picker, close it.
|
|
1293
|
+
this.datePickerRef.close();
|
|
1294
|
+
}
|
|
1295
|
+
this.notifyNewDate();
|
|
1296
|
+
}
|
|
1297
|
+
resetToNull() {
|
|
1298
|
+
this.setInnerValueAndNotify(null);
|
|
1299
|
+
this.valueForMaterialDatePicker = null;
|
|
1300
|
+
this.nativeInputRef.nativeElement.value = null;
|
|
1301
|
+
this.hours = '';
|
|
1302
|
+
this.minutes = '';
|
|
1303
|
+
this.selectedDates = [];
|
|
1304
|
+
}
|
|
1305
|
+
formatTime() {
|
|
1306
|
+
if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
|
|
1307
|
+
this.hours = '0' + this.hours;
|
|
1308
|
+
}
|
|
1309
|
+
if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
|
|
1310
|
+
this.minutes = '0' + this.minutes;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
touchDate() {
|
|
1314
|
+
this.dateTouched = true;
|
|
1315
|
+
this.determineAllTouched();
|
|
1316
|
+
}
|
|
1317
|
+
touchHours() {
|
|
1318
|
+
this.hoursTouched = true;
|
|
1319
|
+
this.determineAllTouched();
|
|
1320
|
+
}
|
|
1321
|
+
touchMinutes() {
|
|
1322
|
+
this.minutesTouched = true;
|
|
1323
|
+
this.determineAllTouched();
|
|
1324
|
+
}
|
|
1325
|
+
determineAllTouched() {
|
|
1326
|
+
if ((this.dateTouched && this.hoursTouched && this.minutesTouched) || (this.dateTouched && !this.showTimeInput)) {
|
|
1327
|
+
this.touch();
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
getDefaultTranslation(key) {
|
|
1331
|
+
switch (key) {
|
|
1332
|
+
case 'placeholder':
|
|
1333
|
+
return () => 'Select date';
|
|
1334
|
+
case 'selectDays':
|
|
1335
|
+
return () => 'Select day(s)';
|
|
1336
|
+
case 'selectedDate':
|
|
1337
|
+
return (d) => d.toLocaleDateString();
|
|
1338
|
+
case 'daysSelected':
|
|
1339
|
+
return (amount) => `${amount} days selected`;
|
|
1340
|
+
case 'selectedInMonth':
|
|
1341
|
+
return (d) => ` in ${format(d, 'MMMM')}`;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
getTranslation(key, params = null) {
|
|
1345
|
+
if (key === 'placeholder' && this.multiple) {
|
|
1346
|
+
return '';
|
|
1347
|
+
}
|
|
1348
|
+
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
1349
|
+
return this.placeholder;
|
|
1350
|
+
}
|
|
1351
|
+
return this.translations?.[key]?.(params) ?? this.getDefaultTranslation(key)(params);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
DateTimePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DateTimePickerComponent, deps: [{ token: FormElementComponent, host: true, optional: true }, { token: i2.ControlContainer, host: true, optional: true }, { token: DATE_TIME_PICKER_TRANSLATIONS, optional: true }, { token: DATE_PICKER_LOCALE, optional: true }, { token: i3.DateAdapter }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1355
|
+
DateTimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: DateTimePickerComponent, selector: "klp-form-date-time-picker", inputs: { minDate: "minDate", maxDate: "maxDate", sameMonthOnly: "sameMonthOnly", format: "format", placeholder: "placeholder", clearable: "clearable", showTimeInput: "showTimeInput", invalidTimeAsMidnight: "invalidTimeAsMidnight" }, providers: [
|
|
1356
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1357
|
+
{
|
|
1358
|
+
provide: MAT_DATE_FORMATS,
|
|
1359
|
+
deps: [DateTimePickerComponent, [new Optional(), KLP_DATE_FORMATS]],
|
|
1360
|
+
useFactory: matDateFormatsFactory,
|
|
1361
|
+
},
|
|
1362
|
+
], viewQueries: [{ propertyName: "nativeInputRef", first: true, predicate: ["nativeInput"], descendants: true }, { propertyName: "datePickerRef", first: true, predicate: ["picker"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<div class=\"dateContainer\" [ngClass]=\"{noRightBorder: !showTimeInput && clearable && !disabled, disabled: disabled}\">\n\t\t<mat-form-field floatLabel=\"never\">\n\t\t\t<div *ngIf=\"multiple\" class=\"daysSelectedCaption\" (click)=\"picker.open()\" [ngClass]=\"{disabled: disabled}\">\n\t\t\t\t<ng-container *ngIf=\"selectedDates.length >= 2\">\n\t\t\t\t\t<span>{{getTranslation('daysSelected', selectedDates.length)}}</span>\n\t\t\t\t\t<span *ngIf=\"getSelectedMonths() === 1\">{{getTranslation('selectedInMonth', selectedDates[0])}}</span>\n\t\t\t\t</ng-container>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 1\">{{getTranslation('selectedDate', selectedDates[0])}}</span>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 0\" class=\"placeholderForMultipleSelection\">{{getTranslation('selectDays')}}</span>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\t#nativeInput\n\t\t\t\tmatInput\n\t\t\t\t[matDatepicker]=\"picker\"\n\t\t\t\t[matDatepickerFilter]=\"filterDates\"\n\t\t\t\t[(ngModel)]=\"valueForMaterialDatePicker\"\n\t\t\t\t(dateInput)=\"dateChanged($event)\"\n\t\t\t\t(input)=\"nativeValueChanged()\"\n\t\t\t\t[min]=\"minDateStartOfDay\"\n\t\t\t\t[max]=\"maxDateEndOfDay\"\n\t\t\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t\t\t(click)=\"picker.open()\"\n\t\t\t\t(blur)=\"touchDate()\"\n\t\t\t\t[ngClass]=\"{inputForMultipleDays: multiple}\"\n\t\t\t>\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n\t\t\t<mat-datepicker\n\t\t\t\t#picker\n\t\t\t\t[dateClass]=\"isSelected\"\n\t\t\t\t[startAt]=\"openPickerOnDate\"\n\t\t\t></mat-datepicker>\n\t\t</mat-form-field>\n\t</div>\n\t<div class=\"timeContainer\" *ngIf=\"showTimeInput\" [ngClass]=\"{disabled: disabled}\">\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchHours()\">\n\t\t<div class=\"divider\">:</div>\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchMinutes()\">\n\t</div>\n\t<button *ngIf=\"clearable && !disabled\" class=\"clearButton\" (click)=\"resetToNull()\" [ngClass]=\"{withoutSpacing: !showTimeInput}\">\u00D7</button>\n</div>\n", styles: [":host{display:block}:host ::ng-deep mat-form-field{display:block;height:100%}:host ::ng-deep mat-form-field .mat-form-field-label{color:#adadad}:host ::ng-deep mat-form-field.mat-focused .mat-form-field-label{color:#adadad}:host ::ng-deep .mat-datepicker-toggle-active{color:#666}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field-flex{flex-direction:row-reverse}:host ::ng-deep .mat-form-field-infix{border-top:none;width:auto}:host ::ng-deep .mat-form-field-suffix{margin-right:.625rem}:host ::ng-deep .mat-form-field-suffix:hover .mat-button-focus-overlay{opacity:.1}:host ::ng-deep .mat-form-field-underline{display:none}:host ::ng-deep .daysSelectedCaption{cursor:pointer}:host ::ng-deep .daysSelectedCaption.disabled{cursor:zoom-in}:host ::ng-deep .inputForMultipleDays{display:none}.componentContainer{display:flex;position:relative;border-radius:2px;color:#888da8}.componentContainer .placeholderForMultipleSelection{color:#adadad}.componentContainer.showErrors .dateContainer,.componentContainer.showErrors .timeContainer,.componentContainer.showErrors .clearButton.withoutSpacing{border-color:#ff8000}.componentContainer .clearButton{flex:0 0 auto;display:flex;align-items:center;background:#ffffff;color:#7b7b7b;border:1px solid #e6ecf5;margin-left:1.25rem;padding:6px 14px;font-size:18px}.componentContainer .clearButton.withoutSpacing{border-left:none;margin-left:0}.componentContainer .clearButton:disabled{border:1px solid #e6ecf5;background:#f9f9f9}.componentContainer .dateContainer{flex:1 1 auto;padding:6px;background:#ffffff;border:1px solid #e6ecf5}.componentContainer .dateContainer.noRightBorder{border-right:none}.componentContainer .dateContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer{flex:0 0 auto;margin-left:1.25rem;padding:6px .625rem;background:#ffffff;display:flex;align-items:center;border:1px solid #e6ecf5}.componentContainer .timeContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer input{color:#888da8;text-align:center;width:20px;padding:0;border:none}.componentContainer .timeContainer input::placeholder{color:#adadad}.componentContainer .timeContainer .divider{margin:0 .3125rem}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] });
|
|
1363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DateTimePickerComponent, decorators: [{
|
|
1364
|
+
type: Component,
|
|
1365
|
+
args: [{ selector: 'klp-form-date-time-picker', providers: [
|
|
1366
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1367
|
+
{
|
|
1368
|
+
provide: MAT_DATE_FORMATS,
|
|
1369
|
+
deps: [DateTimePickerComponent, [new Optional(), KLP_DATE_FORMATS]],
|
|
1370
|
+
useFactory: matDateFormatsFactory,
|
|
1371
|
+
},
|
|
1372
|
+
], template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<div class=\"dateContainer\" [ngClass]=\"{noRightBorder: !showTimeInput && clearable && !disabled, disabled: disabled}\">\n\t\t<mat-form-field floatLabel=\"never\">\n\t\t\t<div *ngIf=\"multiple\" class=\"daysSelectedCaption\" (click)=\"picker.open()\" [ngClass]=\"{disabled: disabled}\">\n\t\t\t\t<ng-container *ngIf=\"selectedDates.length >= 2\">\n\t\t\t\t\t<span>{{getTranslation('daysSelected', selectedDates.length)}}</span>\n\t\t\t\t\t<span *ngIf=\"getSelectedMonths() === 1\">{{getTranslation('selectedInMonth', selectedDates[0])}}</span>\n\t\t\t\t</ng-container>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 1\">{{getTranslation('selectedDate', selectedDates[0])}}</span>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 0\" class=\"placeholderForMultipleSelection\">{{getTranslation('selectDays')}}</span>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\t#nativeInput\n\t\t\t\tmatInput\n\t\t\t\t[matDatepicker]=\"picker\"\n\t\t\t\t[matDatepickerFilter]=\"filterDates\"\n\t\t\t\t[(ngModel)]=\"valueForMaterialDatePicker\"\n\t\t\t\t(dateInput)=\"dateChanged($event)\"\n\t\t\t\t(input)=\"nativeValueChanged()\"\n\t\t\t\t[min]=\"minDateStartOfDay\"\n\t\t\t\t[max]=\"maxDateEndOfDay\"\n\t\t\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t\t\t(click)=\"picker.open()\"\n\t\t\t\t(blur)=\"touchDate()\"\n\t\t\t\t[ngClass]=\"{inputForMultipleDays: multiple}\"\n\t\t\t>\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n\t\t\t<mat-datepicker\n\t\t\t\t#picker\n\t\t\t\t[dateClass]=\"isSelected\"\n\t\t\t\t[startAt]=\"openPickerOnDate\"\n\t\t\t></mat-datepicker>\n\t\t</mat-form-field>\n\t</div>\n\t<div class=\"timeContainer\" *ngIf=\"showTimeInput\" [ngClass]=\"{disabled: disabled}\">\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchHours()\">\n\t\t<div class=\"divider\">:</div>\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchMinutes()\">\n\t</div>\n\t<button *ngIf=\"clearable && !disabled\" class=\"clearButton\" (click)=\"resetToNull()\" [ngClass]=\"{withoutSpacing: !showTimeInput}\">\u00D7</button>\n</div>\n", styles: [":host{display:block}:host ::ng-deep mat-form-field{display:block;height:100%}:host ::ng-deep mat-form-field .mat-form-field-label{color:#adadad}:host ::ng-deep mat-form-field.mat-focused .mat-form-field-label{color:#adadad}:host ::ng-deep .mat-datepicker-toggle-active{color:#666}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field-flex{flex-direction:row-reverse}:host ::ng-deep .mat-form-field-infix{border-top:none;width:auto}:host ::ng-deep .mat-form-field-suffix{margin-right:.625rem}:host ::ng-deep .mat-form-field-suffix:hover .mat-button-focus-overlay{opacity:.1}:host ::ng-deep .mat-form-field-underline{display:none}:host ::ng-deep .daysSelectedCaption{cursor:pointer}:host ::ng-deep .daysSelectedCaption.disabled{cursor:zoom-in}:host ::ng-deep .inputForMultipleDays{display:none}.componentContainer{display:flex;position:relative;border-radius:2px;color:#888da8}.componentContainer .placeholderForMultipleSelection{color:#adadad}.componentContainer.showErrors .dateContainer,.componentContainer.showErrors .timeContainer,.componentContainer.showErrors .clearButton.withoutSpacing{border-color:#ff8000}.componentContainer .clearButton{flex:0 0 auto;display:flex;align-items:center;background:#ffffff;color:#7b7b7b;border:1px solid #e6ecf5;margin-left:1.25rem;padding:6px 14px;font-size:18px}.componentContainer .clearButton.withoutSpacing{border-left:none;margin-left:0}.componentContainer .clearButton:disabled{border:1px solid #e6ecf5;background:#f9f9f9}.componentContainer .dateContainer{flex:1 1 auto;padding:6px;background:#ffffff;border:1px solid #e6ecf5}.componentContainer .dateContainer.noRightBorder{border-right:none}.componentContainer .dateContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer{flex:0 0 auto;margin-left:1.25rem;padding:6px .625rem;background:#ffffff;display:flex;align-items:center;border:1px solid #e6ecf5}.componentContainer .timeContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer input{color:#888da8;text-align:center;width:20px;padding:0;border:none}.componentContainer .timeContainer input::placeholder{color:#adadad}.componentContainer .timeContainer .divider{margin:0 .3125rem}\n"] }]
|
|
1373
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
1374
|
+
type: Host
|
|
1375
|
+
}, {
|
|
1376
|
+
type: Optional
|
|
1377
|
+
}] }, { type: i2.ControlContainer, decorators: [{
|
|
1378
|
+
type: Host
|
|
1379
|
+
}, {
|
|
1380
|
+
type: Optional
|
|
1381
|
+
}] }, { type: undefined, decorators: [{
|
|
1382
|
+
type: Inject,
|
|
1383
|
+
args: [DATE_TIME_PICKER_TRANSLATIONS]
|
|
1384
|
+
}, {
|
|
1385
|
+
type: Optional
|
|
1386
|
+
}] }, { type: undefined, decorators: [{
|
|
1387
|
+
type: Inject,
|
|
1388
|
+
args: [DATE_PICKER_LOCALE]
|
|
1389
|
+
}, {
|
|
1390
|
+
type: Optional
|
|
1391
|
+
}] }, { type: i3.DateAdapter }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { minDate: [{
|
|
1392
|
+
type: Input
|
|
1393
|
+
}], maxDate: [{
|
|
1394
|
+
type: Input
|
|
1395
|
+
}], sameMonthOnly: [{
|
|
1396
|
+
type: Input
|
|
1397
|
+
}], format: [{
|
|
1398
|
+
type: Input
|
|
1399
|
+
}], placeholder: [{
|
|
1400
|
+
type: Input
|
|
1401
|
+
}], clearable: [{
|
|
1402
|
+
type: Input
|
|
1403
|
+
}], showTimeInput: [{
|
|
1404
|
+
type: Input
|
|
1405
|
+
}], invalidTimeAsMidnight: [{
|
|
1406
|
+
type: Input
|
|
1407
|
+
}], nativeInputRef: [{
|
|
1408
|
+
type: ViewChild,
|
|
1409
|
+
args: ['nativeInput']
|
|
1410
|
+
}], datePickerRef: [{
|
|
1411
|
+
type: ViewChild,
|
|
1412
|
+
args: ['picker']
|
|
1413
|
+
}] } });
|
|
1414
|
+
|
|
1415
|
+
const DATE_PICKER_TRANSLATIONS = new InjectionToken('klp.form.date.translations');
|
|
1416
|
+
class DatePickerComponent extends MultipleValueAccessorBase {
|
|
1417
|
+
constructor(parent, controlContainer, translations) {
|
|
1418
|
+
super(parent, controlContainer);
|
|
1419
|
+
this.parent = parent;
|
|
1420
|
+
this.controlContainer = controlContainer;
|
|
1421
|
+
this.translations = translations;
|
|
1422
|
+
this.minDate = undefined;
|
|
1423
|
+
this.maxDate = undefined;
|
|
1424
|
+
this.sameMonthOnly = false;
|
|
1425
|
+
this.format = 'dd-MM-yyyy';
|
|
1426
|
+
this.clearable = false;
|
|
1427
|
+
}
|
|
1428
|
+
writeValue(value) {
|
|
1429
|
+
if (value === invalidDateKey) {
|
|
1430
|
+
super.writeValue(invalidDateKey);
|
|
1431
|
+
}
|
|
1432
|
+
else if (isNullOrUndefined(value)) {
|
|
1433
|
+
this.dateValue = this.multiple ? [] : null;
|
|
1434
|
+
super.writeValue(this.multiple ? [] : null);
|
|
1435
|
+
}
|
|
1436
|
+
else {
|
|
1437
|
+
if (Array.isArray(value)) {
|
|
1438
|
+
this.dateValue = value.map((e) => parse(e, 'yyyy-MM-dd', new Date()));
|
|
1439
|
+
}
|
|
1440
|
+
else {
|
|
1441
|
+
this.dateValue = parse(value, 'yyyy-MM-dd', new Date());
|
|
1442
|
+
}
|
|
1443
|
+
super.writeValue(value);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
dateChanged(value) {
|
|
1447
|
+
if (value === invalidDateKey) {
|
|
1448
|
+
this.setInnerValueAndNotify(invalidDateKey);
|
|
1449
|
+
}
|
|
1450
|
+
else if (isNullOrUndefined(value)) {
|
|
1451
|
+
this.dateValue = this.multiple ? [] : null;
|
|
1452
|
+
this.setInnerValueAndNotify(this.multiple ? [] : null);
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
this.dateValue = value;
|
|
1456
|
+
if (Array.isArray(value)) {
|
|
1457
|
+
this.setInnerValueAndNotify(value.map((e) => format(e, 'yyyy-MM-dd')));
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
this.setInnerValueAndNotify(format(value, 'yyyy-MM-dd'));
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
getDefaultTranslation(key) {
|
|
1465
|
+
switch (key) {
|
|
1466
|
+
case 'placeholder':
|
|
1467
|
+
return () => 'Select date';
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
getTranslation(key, params = null) {
|
|
1471
|
+
if (key === 'placeholder' && this.multiple) {
|
|
1472
|
+
return '';
|
|
1473
|
+
}
|
|
1474
|
+
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
1475
|
+
return this.placeholder;
|
|
1476
|
+
}
|
|
1477
|
+
return this.translations?.[key]?.(params) ?? this.getDefaultTranslation(key)(params);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
DatePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DatePickerComponent, deps: [{ token: FormElementComponent, host: true, optional: true }, { token: i2.ControlContainer, host: true, optional: true }, { token: DATE_PICKER_TRANSLATIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1481
|
+
DatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: DatePickerComponent, selector: "klp-form-date-picker", inputs: { minDate: "minDate", maxDate: "maxDate", sameMonthOnly: "sameMonthOnly", format: "format", placeholder: "placeholder", clearable: "clearable" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: DatePickerComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<klp-form-date-time-picker\n\t\t[multiple]=\"multiple\"\n\t\t[disabled]=\"disabled\"\n\t\t[(ngModel)]=\"dateValue\"\n\t\t(ngModelChange)=\"dateChanged($event)\"\n\t\t[minDate]=\"minDate\"\n\t\t[maxDate]=\"maxDate\"\n\t\t[sameMonthOnly]=\"sameMonthOnly\"\n\t\t[format]=\"format\"\n\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t[clearable]=\"clearable\"\n\t\t[showTimeInput]=\"false\"\n\t\t(onTouch)=\"touch()\"\n\t></klp-form-date-time-picker>\n</div>\n", styles: [":host{display:block}.componentContainer.showErrors ::ng-deep klp-form-date-time-picker .dateContainer,.componentContainer.showErrors ::ng-deep klp-form-date-time-picker .clearButton{border-color:#ff8000}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: DateTimePickerComponent, selector: "klp-form-date-time-picker", inputs: ["minDate", "maxDate", "sameMonthOnly", "format", "placeholder", "clearable", "showTimeInput", "invalidTimeAsMidnight"] }] });
|
|
1482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
1483
|
+
type: Component,
|
|
1484
|
+
args: [{ selector: 'klp-form-date-picker', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: DatePickerComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<klp-form-date-time-picker\n\t\t[multiple]=\"multiple\"\n\t\t[disabled]=\"disabled\"\n\t\t[(ngModel)]=\"dateValue\"\n\t\t(ngModelChange)=\"dateChanged($event)\"\n\t\t[minDate]=\"minDate\"\n\t\t[maxDate]=\"maxDate\"\n\t\t[sameMonthOnly]=\"sameMonthOnly\"\n\t\t[format]=\"format\"\n\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t[clearable]=\"clearable\"\n\t\t[showTimeInput]=\"false\"\n\t\t(onTouch)=\"touch()\"\n\t></klp-form-date-time-picker>\n</div>\n", styles: [":host{display:block}.componentContainer.showErrors ::ng-deep klp-form-date-time-picker .dateContainer,.componentContainer.showErrors ::ng-deep klp-form-date-time-picker .clearButton{border-color:#ff8000}\n"] }]
|
|
1485
|
+
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
1486
|
+
type: Host
|
|
1487
|
+
}, {
|
|
1488
|
+
type: Optional
|
|
1489
|
+
}] }, { type: i2.ControlContainer, decorators: [{
|
|
1490
|
+
type: Host
|
|
1491
|
+
}, {
|
|
1492
|
+
type: Optional
|
|
1493
|
+
}] }, { type: undefined, decorators: [{
|
|
1494
|
+
type: Inject,
|
|
1495
|
+
args: [DATE_PICKER_TRANSLATIONS]
|
|
1496
|
+
}, {
|
|
1497
|
+
type: Optional
|
|
1498
|
+
}] }]; }, propDecorators: { minDate: [{
|
|
1499
|
+
type: Input
|
|
1500
|
+
}], maxDate: [{
|
|
1501
|
+
type: Input
|
|
1502
|
+
}], sameMonthOnly: [{
|
|
1503
|
+
type: Input
|
|
1504
|
+
}], format: [{
|
|
1505
|
+
type: Input
|
|
1506
|
+
}], placeholder: [{
|
|
1507
|
+
type: Input
|
|
1508
|
+
}], clearable: [{
|
|
1509
|
+
type: Input
|
|
1510
|
+
}] } });
|
|
1511
|
+
|
|
1512
|
+
// material.module.ts
|
|
1513
|
+
class MaterialModule {
|
|
1514
|
+
}
|
|
1515
|
+
MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1516
|
+
MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: MaterialModule, imports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule], exports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule] });
|
|
1517
|
+
MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MaterialModule, providers: [MatDatepickerModule], imports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule, MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule] });
|
|
1518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MaterialModule, decorators: [{
|
|
1519
|
+
type: NgModule,
|
|
1520
|
+
args: [{
|
|
1521
|
+
imports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule],
|
|
1522
|
+
exports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule],
|
|
1523
|
+
providers: [MatDatepickerModule],
|
|
1524
|
+
}]
|
|
1525
|
+
}] });
|
|
1526
|
+
|
|
1527
|
+
class FileInputComponent extends MultipleValueAccessorBase {
|
|
1528
|
+
constructor() {
|
|
1529
|
+
super(...arguments);
|
|
1530
|
+
this.isLoading = false;
|
|
1531
|
+
this.clearable = false;
|
|
1532
|
+
this.onlyShowUploadButton = false;
|
|
1533
|
+
this.useFullParentSize = false;
|
|
1534
|
+
}
|
|
1535
|
+
onChange(files) {
|
|
1536
|
+
const result = [];
|
|
1537
|
+
for (let i = 0; i < files.length; i++) {
|
|
1538
|
+
result.push(files.item(i));
|
|
1539
|
+
}
|
|
1540
|
+
this.setInnerValueAndNotify(result);
|
|
1541
|
+
// to make sure we can select the same file again
|
|
1542
|
+
this.fileInputEl.nativeElement.value = null;
|
|
1543
|
+
}
|
|
1544
|
+
getFileNames() {
|
|
1545
|
+
if (Array.isArray(this.innerValue)) {
|
|
1546
|
+
return this.innerValue.map(e => e.name).join(', ');
|
|
1547
|
+
}
|
|
1548
|
+
else if (this.innerValue instanceof File) {
|
|
1549
|
+
return this.innerValue.name;
|
|
1550
|
+
}
|
|
1551
|
+
return null;
|
|
1552
|
+
}
|
|
1553
|
+
shouldShowClearButton() {
|
|
1554
|
+
if (this.onlyShowUploadButton) {
|
|
1555
|
+
return false;
|
|
1556
|
+
}
|
|
1557
|
+
if (this.multiple) {
|
|
1558
|
+
if (arrayIsSetAndFilled(this.innerValue)) {
|
|
1559
|
+
return true;
|
|
1560
|
+
}
|
|
1561
|
+
return false;
|
|
1562
|
+
}
|
|
1563
|
+
if (isValueSet(this.innerValue)) {
|
|
1564
|
+
return true;
|
|
1565
|
+
}
|
|
1566
|
+
return false;
|
|
1567
|
+
}
|
|
1568
|
+
uploadFileClicked() {
|
|
1569
|
+
this.fileInputEl.nativeElement.click();
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
FileInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FileInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1573
|
+
FileInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FileInputComponent, selector: "klp-form-file-input", inputs: { isLoading: "isLoading", clearable: "clearable", onlyShowUploadButton: "onlyShowUploadButton", useFullParentSize: "useFullParentSize" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }], viewQueries: [{ propertyName: "fileInputEl", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\tUpload a file\n\t\t</klp-form-button>\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#fileInput\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{display:flex;align-items:center}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{position:absolute;cursor:pointer;opacity:0;inset:0}.fileName{flex:1 1 0px;margin-left:.625rem;color:#515365;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clearButton{flex:0 0 auto}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "klp-form-button", inputs: ["variant", "size", "fullWidth", "hasBorder", "disabled", "isLoading", "type", "clickCallback"] }] });
|
|
1574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FileInputComponent, decorators: [{
|
|
1575
|
+
type: Component,
|
|
1576
|
+
args: [{ selector: 'klp-form-file-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\tUpload a file\n\t\t</klp-form-button>\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#fileInput\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{display:flex;align-items:center}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{position:absolute;cursor:pointer;opacity:0;inset:0}.fileName{flex:1 1 0px;margin-left:.625rem;color:#515365;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clearButton{flex:0 0 auto}\n"] }]
|
|
1577
|
+
}], propDecorators: { isLoading: [{
|
|
1578
|
+
type: Input
|
|
1579
|
+
}], clearable: [{
|
|
1580
|
+
type: Input
|
|
1581
|
+
}], onlyShowUploadButton: [{
|
|
1582
|
+
type: Input
|
|
1583
|
+
}], useFullParentSize: [{
|
|
1584
|
+
type: Input
|
|
1585
|
+
}], fileInputEl: [{
|
|
1586
|
+
type: ViewChild,
|
|
1587
|
+
args: ['fileInput']
|
|
1588
|
+
}] } });
|
|
1589
|
+
|
|
1590
|
+
class SortableGroupedItemsComponent extends ValueAccessorBase {
|
|
1591
|
+
constructor() {
|
|
1592
|
+
super(...arguments);
|
|
1593
|
+
this.reloader = true; // sortable items doesnt correctly update, so we have this boolean that flips to rerender the sortable items comp
|
|
1594
|
+
}
|
|
1595
|
+
writeValue(value) {
|
|
1596
|
+
super.writeValue(value);
|
|
1597
|
+
this.reloader = false;
|
|
1598
|
+
setTimeout(() => {
|
|
1599
|
+
if (arrayIsSetAndFilled(value)) {
|
|
1600
|
+
this.items = value.flatMap(e => [...e, '']);
|
|
1601
|
+
}
|
|
1602
|
+
else {
|
|
1603
|
+
this.items = [];
|
|
1604
|
+
}
|
|
1605
|
+
this.reloader = true;
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
onItemsRearranged(value) {
|
|
1609
|
+
const result = splitArrayByCondition(value, e => e === '').filter(arrayIsSetAndFilled);
|
|
1610
|
+
this.setInnerValueAndNotify(result);
|
|
1611
|
+
this.reloader = false;
|
|
1612
|
+
setTimeout(() => {
|
|
1613
|
+
this.items = [...this.items, ''].filter((e, i) => {
|
|
1614
|
+
if (i === 0 && e === '') {
|
|
1615
|
+
return false;
|
|
1616
|
+
}
|
|
1617
|
+
if (e === '' && this.items[i - 1] === '') {
|
|
1618
|
+
return false;
|
|
1619
|
+
}
|
|
1620
|
+
return true;
|
|
1621
|
+
});
|
|
1622
|
+
this.reloader = true;
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
SortableGroupedItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableGroupedItemsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1627
|
+
SortableGroupedItemsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: SortableGroupedItemsComponent, selector: "klp-form-sortable-grouped-items", providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SortableGroupedItemsComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"reloader\">\n\t<klp-form-sortable-items\n\t\t[(ngModel)]=\"items\"\n\t\t(ngModelChange)=\"onItemsRearranged($event)\"\n\t>\n\t\t<ng-template let-item=\"item\">\n\t\t\t<div>{{item}}</div>\n\t\t</ng-template>\n\t</klp-form-sortable-items>\n</ng-container>\n", styles: [":host{display:block}\n"], 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SortableItemsComponent, selector: "klp-form-sortable-items", inputs: ["sortableItemSize", "useCustomScroll"] }] });
|
|
1628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableGroupedItemsComponent, decorators: [{
|
|
1629
|
+
type: Component,
|
|
1630
|
+
args: [{ selector: 'klp-form-sortable-grouped-items', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SortableGroupedItemsComponent, multi: true }], template: "<ng-container *ngIf=\"reloader\">\n\t<klp-form-sortable-items\n\t\t[(ngModel)]=\"items\"\n\t\t(ngModelChange)=\"onItemsRearranged($event)\"\n\t>\n\t\t<ng-template let-item=\"item\">\n\t\t\t<div>{{item}}</div>\n\t\t</ng-template>\n\t</klp-form-sortable-items>\n</ng-container>\n", styles: [":host{display:block}\n"] }]
|
|
1631
|
+
}] });
|
|
1632
|
+
|
|
1633
|
+
const invalidTimeKey = '--invalid_time--';
|
|
1634
|
+
function timeValidator(control) {
|
|
1635
|
+
const invalid = control.value === invalidTimeKey;
|
|
1636
|
+
return invalid ? { date: control.value } : null;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
class HourMinuteInputComponent extends ValueAccessorBase {
|
|
1640
|
+
constructor() {
|
|
1641
|
+
super(...arguments);
|
|
1642
|
+
this.placeholders = ['hour', 'min'];
|
|
1643
|
+
this.hoursTouched = false;
|
|
1644
|
+
this.minutesTouched = false;
|
|
1645
|
+
}
|
|
1646
|
+
formatHours() {
|
|
1647
|
+
if (!stringIsSetAndFilled(this.hours)) {
|
|
1648
|
+
this.hours = '0';
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
formatMinutes() {
|
|
1652
|
+
if (!stringIsSetAndFilled(this.minutes)) {
|
|
1653
|
+
this.minutes = '0';
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
formatTime() {
|
|
1657
|
+
if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
|
|
1658
|
+
this.hours = '0' + this.hours;
|
|
1659
|
+
}
|
|
1660
|
+
if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
|
|
1661
|
+
this.minutes = '0' + this.minutes;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
writeValue(value) {
|
|
1665
|
+
if (Number.isFinite(value)) {
|
|
1666
|
+
this.hours = Math.floor(value / 60) + '';
|
|
1667
|
+
this.minutes = value % 60 + '';
|
|
1668
|
+
this.formatTime();
|
|
1669
|
+
super.writeValue(value);
|
|
1670
|
+
}
|
|
1671
|
+
else {
|
|
1672
|
+
this.hours = '';
|
|
1673
|
+
this.minutes = '';
|
|
1674
|
+
super.writeValue(invalidTimeKey);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
notifyNewTime() {
|
|
1678
|
+
const parsedHours = Number(this.hours);
|
|
1679
|
+
const parsedMinutes = Number(this.minutes);
|
|
1680
|
+
// when all inputs are empty
|
|
1681
|
+
if (!stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
|
|
1682
|
+
this.setInnerValueAndNotify(null);
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
// if we have valid time
|
|
1686
|
+
if (Number.isFinite(parsedHours) &&
|
|
1687
|
+
parsedHours >= 0 &&
|
|
1688
|
+
parsedHours <= 9999 &&
|
|
1689
|
+
Number.isFinite(parsedMinutes) &&
|
|
1690
|
+
parsedMinutes >= 0 &&
|
|
1691
|
+
parsedMinutes <= 59) {
|
|
1692
|
+
this.setInnerValueAndNotify(parsedHours * 60 + parsedMinutes);
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
// all other cases, we are not in a valid state
|
|
1696
|
+
this.setInnerValueAndNotify(invalidTimeKey);
|
|
1697
|
+
}
|
|
1698
|
+
touchHours() {
|
|
1699
|
+
this.hoursTouched = true;
|
|
1700
|
+
this.determineAllTouched();
|
|
1701
|
+
}
|
|
1702
|
+
touchMinutes() {
|
|
1703
|
+
this.minutesTouched = true;
|
|
1704
|
+
this.determineAllTouched();
|
|
1705
|
+
}
|
|
1706
|
+
determineAllTouched() {
|
|
1707
|
+
if (this.hoursTouched && this.minutesTouched) {
|
|
1708
|
+
this.touch();
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
HourMinuteInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: HourMinuteInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1713
|
+
HourMinuteInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: HourMinuteInputComponent, selector: "klp-form-hour-minute-input", inputs: { placeholders: "placeholders" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: HourMinuteInputComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input class=\"hourInput\" maxlength=\"4\" [placeholder]=\"placeholders[0]\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (blur)=\"formatHours(); formatTime(); touchHours(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n\t<div class=\"divider\">:</div>\n\t<input maxlength=\"2\" [placeholder]=\"placeholders[1]\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (blur)=\"formatMinutes(); formatTime(); touchMinutes(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n</div>\n", styles: [":host{display:flex}.componentContainer{height:42px;flex:0 0 auto;padding:6px .625rem;background:#ffffff;display:flex;align-items:center;border:1px solid #e6ecf5}.componentContainer.disabled{background:#f9f9f9;cursor:not-allowed}.componentContainer input{color:#888da8;text-align:center;width:30px;padding:0;border:none}.componentContainer input.hourInput{width:50px}.componentContainer input::placeholder{color:#adadad}.componentContainer .divider{margin:0 .3125rem}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: HourMinuteInputComponent, decorators: [{
|
|
1715
|
+
type: Component,
|
|
1716
|
+
args: [{ selector: 'klp-form-hour-minute-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: HourMinuteInputComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input class=\"hourInput\" maxlength=\"4\" [placeholder]=\"placeholders[0]\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (blur)=\"formatHours(); formatTime(); touchHours(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n\t<div class=\"divider\">:</div>\n\t<input maxlength=\"2\" [placeholder]=\"placeholders[1]\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (blur)=\"formatMinutes(); formatTime(); touchMinutes(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n</div>\n", styles: [":host{display:flex}.componentContainer{height:42px;flex:0 0 auto;padding:6px .625rem;background:#ffffff;display:flex;align-items:center;border:1px solid #e6ecf5}.componentContainer.disabled{background:#f9f9f9;cursor:not-allowed}.componentContainer input{color:#888da8;text-align:center;width:30px;padding:0;border:none}.componentContainer input.hourInput{width:50px}.componentContainer input::placeholder{color:#adadad}.componentContainer .divider{margin:0 .3125rem}\n"] }]
|
|
1717
|
+
}], propDecorators: { placeholders: [{
|
|
1718
|
+
type: Input
|
|
1719
|
+
}] } });
|
|
1720
|
+
|
|
1721
|
+
class NgxEnhancyFormsModule {
|
|
1722
|
+
}
|
|
1723
|
+
NgxEnhancyFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1724
|
+
NgxEnhancyFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, declarations: [ValueAccessorBase,
|
|
1725
|
+
MultipleValueAccessorBase,
|
|
1726
|
+
ButtonComponent,
|
|
1727
|
+
CheckboxComponent,
|
|
1728
|
+
DatePickerComponent,
|
|
1729
|
+
DateTimePickerComponent,
|
|
1730
|
+
EmailInputComponent,
|
|
1731
|
+
LoadingIndicatorComponent,
|
|
1732
|
+
NumberInputComponent,
|
|
1733
|
+
PasswordFieldComponent,
|
|
1734
|
+
SelectComponent,
|
|
1735
|
+
KlpSelectOptionTemplateDirective,
|
|
1736
|
+
SelectFooterComponent,
|
|
1737
|
+
SortableItemsComponent,
|
|
1738
|
+
SortableGroupedItemsComponent,
|
|
1739
|
+
TextInputComponent,
|
|
1740
|
+
ToggleComponent,
|
|
1741
|
+
FileInputComponent,
|
|
1742
|
+
FormCaptionComponent,
|
|
1743
|
+
FormElementComponent,
|
|
1744
|
+
FormErrorComponent,
|
|
1745
|
+
FormSubmitButtonComponent,
|
|
1746
|
+
FormComponent,
|
|
1747
|
+
SubFormDirective,
|
|
1748
|
+
HourMinuteInputComponent], imports: [CommonModule,
|
|
1749
|
+
FormsModule,
|
|
1750
|
+
NgSelectModule,
|
|
1751
|
+
SortablejsModule,
|
|
1752
|
+
MaterialModule], exports: [ValueAccessorBase,
|
|
1753
|
+
MultipleValueAccessorBase,
|
|
1754
|
+
ButtonComponent,
|
|
1755
|
+
DatePickerComponent,
|
|
1756
|
+
DateTimePickerComponent,
|
|
1757
|
+
CheckboxComponent,
|
|
1758
|
+
EmailInputComponent,
|
|
1759
|
+
LoadingIndicatorComponent,
|
|
1760
|
+
NumberInputComponent,
|
|
1761
|
+
PasswordFieldComponent,
|
|
1762
|
+
SelectComponent,
|
|
1763
|
+
KlpSelectOptionTemplateDirective,
|
|
1764
|
+
SelectFooterComponent,
|
|
1765
|
+
SortableItemsComponent,
|
|
1766
|
+
SortableGroupedItemsComponent,
|
|
1767
|
+
TextInputComponent,
|
|
1768
|
+
ToggleComponent,
|
|
1769
|
+
FileInputComponent,
|
|
1770
|
+
FormCaptionComponent,
|
|
1771
|
+
FormElementComponent,
|
|
1772
|
+
FormErrorComponent,
|
|
1773
|
+
FormSubmitButtonComponent,
|
|
1774
|
+
FormComponent,
|
|
1775
|
+
SubFormDirective,
|
|
1776
|
+
HourMinuteInputComponent] });
|
|
1777
|
+
NgxEnhancyFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, imports: [CommonModule,
|
|
1778
|
+
FormsModule,
|
|
1779
|
+
NgSelectModule,
|
|
1780
|
+
SortablejsModule,
|
|
1781
|
+
MaterialModule] });
|
|
1782
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, decorators: [{
|
|
1783
|
+
type: NgModule,
|
|
1784
|
+
args: [{
|
|
1785
|
+
imports: [
|
|
1786
|
+
CommonModule,
|
|
1787
|
+
FormsModule,
|
|
1788
|
+
NgSelectModule,
|
|
1789
|
+
SortablejsModule,
|
|
1790
|
+
MaterialModule,
|
|
1791
|
+
],
|
|
1792
|
+
declarations: [
|
|
1793
|
+
ValueAccessorBase,
|
|
1794
|
+
MultipleValueAccessorBase,
|
|
1795
|
+
ButtonComponent,
|
|
1796
|
+
CheckboxComponent,
|
|
1797
|
+
DatePickerComponent,
|
|
1798
|
+
DateTimePickerComponent,
|
|
1799
|
+
EmailInputComponent,
|
|
1800
|
+
LoadingIndicatorComponent,
|
|
1801
|
+
NumberInputComponent,
|
|
1802
|
+
PasswordFieldComponent,
|
|
1803
|
+
SelectComponent,
|
|
1804
|
+
KlpSelectOptionTemplateDirective,
|
|
1805
|
+
SelectFooterComponent,
|
|
1806
|
+
SortableItemsComponent,
|
|
1807
|
+
SortableGroupedItemsComponent,
|
|
1808
|
+
TextInputComponent,
|
|
1809
|
+
ToggleComponent,
|
|
1810
|
+
FileInputComponent,
|
|
1811
|
+
FormCaptionComponent,
|
|
1812
|
+
FormElementComponent,
|
|
1813
|
+
FormErrorComponent,
|
|
1814
|
+
FormSubmitButtonComponent,
|
|
1815
|
+
FormComponent,
|
|
1816
|
+
SubFormDirective,
|
|
1817
|
+
HourMinuteInputComponent
|
|
1818
|
+
],
|
|
1819
|
+
exports: [
|
|
1820
|
+
ValueAccessorBase,
|
|
1821
|
+
MultipleValueAccessorBase,
|
|
1822
|
+
ButtonComponent,
|
|
1823
|
+
DatePickerComponent,
|
|
1824
|
+
DateTimePickerComponent,
|
|
1825
|
+
CheckboxComponent,
|
|
1826
|
+
EmailInputComponent,
|
|
1827
|
+
LoadingIndicatorComponent,
|
|
1828
|
+
NumberInputComponent,
|
|
1829
|
+
PasswordFieldComponent,
|
|
1830
|
+
SelectComponent,
|
|
1831
|
+
KlpSelectOptionTemplateDirective,
|
|
1832
|
+
SelectFooterComponent,
|
|
1833
|
+
SortableItemsComponent,
|
|
1834
|
+
SortableGroupedItemsComponent,
|
|
1835
|
+
TextInputComponent,
|
|
1836
|
+
ToggleComponent,
|
|
1837
|
+
FileInputComponent,
|
|
1838
|
+
FormCaptionComponent,
|
|
1839
|
+
FormElementComponent,
|
|
1840
|
+
FormErrorComponent,
|
|
1841
|
+
FormSubmitButtonComponent,
|
|
1842
|
+
FormComponent,
|
|
1843
|
+
SubFormDirective,
|
|
1844
|
+
HourMinuteInputComponent
|
|
1845
|
+
]
|
|
1846
|
+
}]
|
|
1847
|
+
}] });
|
|
1848
|
+
|
|
1849
|
+
/*
|
|
1850
|
+
* Public API Surface of ngx-enhancy-forms
|
|
1851
|
+
*/
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* Generated bundle index. Do not edit.
|
|
1855
|
+
*/
|
|
1856
|
+
|
|
1857
|
+
export { ButtonComponent, CheckboxComponent, DATE_PICKER_LOCALE, DATE_PICKER_TRANSLATIONS, DATE_TIME_PICKER_TRANSLATIONS, DEFAULT_ERROR_MESSAGES, DatePickerComponent, DateTimePickerComponent, EmailInputComponent, FORM_ERROR_MESSAGES, FileInputComponent, FormCaptionComponent, FormComponent, FormElementComponent, FormErrorComponent, FormSubmitButtonComponent, HourMinuteInputComponent, KLP_DATE_FORMATS, KlpSelectOptionTemplateDirective, LoadingIndicatorComponent, MultipleValueAccessorBase, NgxEnhancyFormsModule, NumberInputComponent, PasswordFieldComponent, SELECT_TRANSLATIONS, SelectComponent, SelectFooterComponent, SortableGroupedItemsComponent, SortableItemsComponent, SubFormDirective, TextInputComponent, ToggleComponent, ValueAccessorBase, dateValidator, invalidDateKey, invalidFieldsSymbol, matDateFormatsFactory };
|
|
1858
|
+
//# sourceMappingURL=klippa-ngx-enhancy-forms.mjs.map
|