@klippa/ngx-enhancy-forms 14.6.2 → 16.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{esm2020 → esm2022}/lib/elements/button/button.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/checkbox/checkbox.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/date-picker/date-picker.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/date-time-picker/date-time-picker.component.mjs +13 -13
- package/{esm2020 → esm2022}/lib/elements/email/email-input.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/file-input/file-input.component.mjs +5 -5
- package/{esm2020 → esm2022}/lib/elements/hour-minute-input/hour-minute-input.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/loading-indicator/loading-indicator.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/number-input/number-input.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/password-field/password-field.component.mjs +4 -4
- package/esm2022/lib/elements/radio/radio.component.mjs +30 -0
- package/{esm2020 → esm2022}/lib/elements/select/select-footer/select-footer.component.mjs +4 -4
- package/esm2022/lib/elements/select/select.component.mjs +138 -0
- package/{esm2020 → esm2022}/lib/elements/sortable-grouped-items/sortable-grouped-items.component.mjs +4 -4
- package/esm2022/lib/elements/sortable-items/sortable-items.component.mjs +86 -0
- package/esm2022/lib/elements/text-input/text-input.component.mjs +31 -0
- package/{esm2020 → esm2022}/lib/elements/toggle/toggle.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/value-accessor-base/multiple-value-accessor-base.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/elements/value-accessor-base/value-accessor-base.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/form/form-caption/form-caption.component.mjs +4 -4
- package/esm2022/lib/form/form-element/form-element.component.mjs +122 -0
- package/{esm2020 → esm2022}/lib/form/form-error/form-error.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/form/form-submit-button/form-submit-button.component.mjs +7 -7
- package/{esm2020 → esm2022}/lib/form/form.component.mjs +7 -7
- package/esm2022/lib/material.module.mjs +22 -0
- package/{esm2020 → esm2022}/lib/ngx-enhancy-forms.module.mjs +67 -67
- package/{esm2020 → esm2022}/lib/util/arrays.mjs +2 -2
- package/{fesm2020 → fesm2022}/klippa-ngx-enhancy-forms.mjs +193 -274
- package/fesm2022/klippa-ngx-enhancy-forms.mjs.map +1 -0
- package/lib/elements/button/button.component.d.ts +1 -1
- package/lib/elements/checkbox/checkbox.component.d.ts +1 -1
- package/lib/elements/date-picker/date-picker.component.d.ts +1 -1
- package/lib/elements/date-time-picker/date-time-picker.component.d.ts +1 -1
- package/lib/elements/email/email-input.component.d.ts +1 -1
- package/lib/elements/file-input/file-input.component.d.ts +1 -1
- package/lib/elements/hour-minute-input/hour-minute-input.component.d.ts +1 -1
- package/lib/elements/loading-indicator/loading-indicator.component.d.ts +1 -1
- package/lib/elements/number-input/number-input.component.d.ts +1 -1
- package/lib/elements/password-field/password-field.component.d.ts +1 -1
- package/lib/elements/radio/radio.component.d.ts +3 -4
- package/lib/elements/select/select-footer/select-footer.component.d.ts +1 -1
- package/lib/elements/select/select.component.d.ts +7 -18
- package/lib/elements/sortable-grouped-items/sortable-grouped-items.component.d.ts +1 -1
- package/lib/elements/sortable-items/sortable-items.component.d.ts +1 -1
- package/lib/elements/text-input/text-input.component.d.ts +1 -3
- package/lib/elements/toggle/toggle.component.d.ts +1 -1
- package/lib/elements/value-accessor-base/multiple-value-accessor-base.component.d.ts +1 -1
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +1 -1
- package/lib/form/form-caption/form-caption.component.d.ts +1 -1
- package/lib/form/form-element/form-element.component.d.ts +2 -2
- package/lib/form/form-error/form-error.component.d.ts +1 -1
- package/lib/form/form-submit-button/form-submit-button.component.d.ts +1 -1
- package/lib/form/form.component.d.ts +2 -2
- package/lib/material.module.d.ts +4 -4
- package/lib/ngx-enhancy-forms.module.d.ts +1 -1
- package/lib/types.d.ts +3 -3
- package/package.json +8 -14
- package/esm2020/lib/elements/radio/radio.component.mjs +0 -31
- package/esm2020/lib/elements/select/select.component.mjs +0 -225
- package/esm2020/lib/elements/sortable-items/sortable-items.component.mjs +0 -70
- package/esm2020/lib/elements/text-input/text-input.component.mjs +0 -37
- package/esm2020/lib/form/form-element/form-element.component.mjs +0 -124
- package/esm2020/lib/material.module.mjs +0 -22
- package/fesm2015/klippa-ngx-enhancy-forms.mjs +0 -2147
- package/fesm2015/klippa-ngx-enhancy-forms.mjs.map +0 -1
- package/fesm2020/klippa-ngx-enhancy-forms.mjs.map +0 -1
- package/src/lib/form/README.md +0 -1
- /package/{esm2020 → esm2022}/klippa-ngx-enhancy-forms.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/types.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/util/objects.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/util/values.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/validators/dateValidator.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/validators/timeValidator.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
|
@@ -1,2147 +0,0 @@
|
|
|
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, FormControl, FormArray, FormGroup, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
|
-
import { isString } from 'lodash-es';
|
|
8
|
-
import { isArray } from 'lodash';
|
|
9
|
-
import { __awaiter } from 'tslib';
|
|
10
|
-
import * as i4 from '@ng-select/ng-select';
|
|
11
|
-
import { NgSelectModule } from '@ng-select/ng-select';
|
|
12
|
-
import * as i2$1 from 'ngx-sortablejs';
|
|
13
|
-
import { SortablejsModule } from 'ngx-sortablejs';
|
|
14
|
-
import { isSameDay, format, startOfMonth, endOfMonth, parse } from 'date-fns';
|
|
15
|
-
import * as i3 from '@angular/material/core';
|
|
16
|
-
import { MAT_NATIVE_DATE_FORMATS, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
|
|
17
|
-
import * as i5 from '@angular/material/datepicker';
|
|
18
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
19
|
-
import * as i6 from '@angular/material/form-field';
|
|
20
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
21
|
-
import * as i7 from '@angular/material/input';
|
|
22
|
-
import { MatInputModule } from '@angular/material/input';
|
|
23
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
24
|
-
|
|
25
|
-
function stringIsSetAndFilled(s) {
|
|
26
|
-
return isString(s) && s.length > 0;
|
|
27
|
-
}
|
|
28
|
-
function isNullOrUndefined(value) {
|
|
29
|
-
return value === null || value === undefined;
|
|
30
|
-
}
|
|
31
|
-
function numberIsSet(value) {
|
|
32
|
-
return isValueSet(value) && typeof value === 'number';
|
|
33
|
-
}
|
|
34
|
-
function isValueSet(value) {
|
|
35
|
-
return value !== null && value !== undefined;
|
|
36
|
-
}
|
|
37
|
-
function stringOrArrayIsSetAndEmpty(value) {
|
|
38
|
-
return value !== null && value !== undefined && value.length === 0;
|
|
39
|
-
}
|
|
40
|
-
function truncateString(s, length) {
|
|
41
|
-
if (s.length < length) {
|
|
42
|
-
return s;
|
|
43
|
-
}
|
|
44
|
-
return s.substring(0, length) + '...';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function removeDuplicatesFromArraysWithComparator(comparator, ...arrays) {
|
|
48
|
-
let combined = [];
|
|
49
|
-
for (const array of arrays) {
|
|
50
|
-
combined = combined.concat(array);
|
|
51
|
-
}
|
|
52
|
-
return combined.filter((c, i) => {
|
|
53
|
-
const firstOccurrenceIndex = combined.findIndex((c2) => comparator(c, c2));
|
|
54
|
-
return i === firstOccurrenceIndex;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function removeDuplicatesFromArray(array) {
|
|
58
|
-
return array.filter((c, i) => {
|
|
59
|
-
const firstOccurrenceIndex = array.findIndex((c2) => c2 === c);
|
|
60
|
-
return i === firstOccurrenceIndex;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function insertAtIndex(arr, index, item) {
|
|
64
|
-
arr.splice(index, 0, item);
|
|
65
|
-
}
|
|
66
|
-
function arrayIsSetAndFilled(arr) {
|
|
67
|
-
return isArray(arr) && arr !== null && arr !== undefined && arr.length > 0;
|
|
68
|
-
}
|
|
69
|
-
function asArray(value) {
|
|
70
|
-
if (isValueSet(value)) {
|
|
71
|
-
if (Array.isArray(value)) {
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
return [value];
|
|
75
|
-
}
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
function splitArrayByCondition(value, condition) {
|
|
79
|
-
return value.reduce((acc, cur) => {
|
|
80
|
-
if (condition(cur)) {
|
|
81
|
-
acc.push([]);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
acc[acc.length - 1].push(cur);
|
|
85
|
-
}
|
|
86
|
-
return acc;
|
|
87
|
-
}, [[]]);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function mergeArray(arrA, arrB) {
|
|
91
|
-
var _a;
|
|
92
|
-
const arr = new Array(Math.max(arrA.length, arrB.length));
|
|
93
|
-
for (let i = 0; i < arr.length; i++) {
|
|
94
|
-
if (typeof arrA[i] === 'object' && typeof arrB[i] === 'object') {
|
|
95
|
-
arr[i] = deepMerge(arrA[i], arrB[i]);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
arr[i] = (_a = arrB[i]) !== null && _a !== void 0 ? _a : arrA[i];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return arr;
|
|
102
|
-
}
|
|
103
|
-
function deepMerge(objA, objB) {
|
|
104
|
-
if (Array.isArray(objA) || Array.isArray(objB)) {
|
|
105
|
-
if (Array.isArray(objA) && Array.isArray(objB)) {
|
|
106
|
-
return mergeArray(objA, objB);
|
|
107
|
-
}
|
|
108
|
-
// if a and b differ in type, prefer b.
|
|
109
|
-
return objB !== null && objB !== void 0 ? objB : objA;
|
|
110
|
-
}
|
|
111
|
-
const merged = {};
|
|
112
|
-
const keys = new Set([
|
|
113
|
-
...Object.keys(objA),
|
|
114
|
-
...Object.keys(objB),
|
|
115
|
-
]);
|
|
116
|
-
keys.forEach((key) => {
|
|
117
|
-
const a = objA[key];
|
|
118
|
-
const b = objB[key];
|
|
119
|
-
if (typeof a === 'object' && typeof b === 'object') {
|
|
120
|
-
merged[key] = deepMerge(a, b);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
// if a and b differ in type, prefer b.
|
|
124
|
-
merged[key] = (b !== null && b !== void 0 ? b : a);
|
|
125
|
-
});
|
|
126
|
-
return merged;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const invalidFieldsSymbol = Symbol('Not all fields are valid');
|
|
130
|
-
class SubFormDirective {
|
|
131
|
-
}
|
|
132
|
-
SubFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SubFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
133
|
-
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 });
|
|
134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SubFormDirective, decorators: [{
|
|
135
|
-
type: Directive,
|
|
136
|
-
args: [{
|
|
137
|
-
// tslint:disable-next-line:directive-selector
|
|
138
|
-
selector: 'klp-sub-form',
|
|
139
|
-
}]
|
|
140
|
-
}], propDecorators: { injectInto: [{
|
|
141
|
-
type: Input
|
|
142
|
-
}], at: [{
|
|
143
|
-
type: Input
|
|
144
|
-
}] } });
|
|
145
|
-
class FormComponent {
|
|
146
|
-
constructor(parent, subFormPlaceholder) {
|
|
147
|
-
this.parent = parent;
|
|
148
|
-
this.subFormPlaceholder = subFormPlaceholder;
|
|
149
|
-
this.readOnly = false;
|
|
150
|
-
this.showErrorMessages = true;
|
|
151
|
-
this.errorMessageLocation = 'belowCaption';
|
|
152
|
-
// we keep track of what form controls are actually rendered. Only those count when looking at form validation
|
|
153
|
-
this.activeControls = [];
|
|
154
|
-
}
|
|
155
|
-
ngOnInit() {
|
|
156
|
-
var _a, _b, _c, _d;
|
|
157
|
-
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
158
|
-
const injectInto = this.subFormPlaceholder.injectInto;
|
|
159
|
-
const injectAt = this.subFormPlaceholder.at;
|
|
160
|
-
if (injectInto instanceof UntypedFormArray) {
|
|
161
|
-
if (typeof injectAt !== 'number') {
|
|
162
|
-
throw new Error(`cannot index FormArray with ${typeof injectAt}`);
|
|
163
|
-
}
|
|
164
|
-
if ((_a = injectInto.at(injectAt)) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
165
|
-
this.formGroup.disable();
|
|
166
|
-
}
|
|
167
|
-
const valueBeforeInject = (_b = injectInto.at(injectAt)) === null || _b === void 0 ? void 0 : _b.value;
|
|
168
|
-
injectInto.setControl(injectAt, this.formGroup);
|
|
169
|
-
if (isValueSet(valueBeforeInject)) {
|
|
170
|
-
this.formGroup.patchValue(valueBeforeInject);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
else if (injectInto instanceof UntypedFormGroup) {
|
|
174
|
-
if (typeof injectAt !== 'string') {
|
|
175
|
-
throw new Error(`cannot index FormGroup with ${typeof injectAt}`);
|
|
176
|
-
}
|
|
177
|
-
if ((_c = injectInto.get(injectAt)) === null || _c === void 0 ? void 0 : _c.disabled) {
|
|
178
|
-
this.formGroup.disable();
|
|
179
|
-
}
|
|
180
|
-
const valueBeforeInject = (_d = injectInto.get(injectAt)) === null || _d === void 0 ? void 0 : _d.value;
|
|
181
|
-
injectInto.setControl(injectAt, this.formGroup);
|
|
182
|
-
if (isValueSet(valueBeforeInject)) {
|
|
183
|
-
this.formGroup.patchValue(valueBeforeInject);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (isValueSet(this.patchValueInterceptor)) {
|
|
188
|
-
this.addSupportForPatchValueInterceptor();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
ngOnChanges(simpleChanges) {
|
|
192
|
-
var _a;
|
|
193
|
-
if (((_a = simpleChanges.readOnly) === null || _a === void 0 ? void 0 : _a.currentValue) === true) {
|
|
194
|
-
this.activeControls.forEach(e => e.formControl.disable());
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
ngOnDestroy() {
|
|
198
|
-
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
199
|
-
const injectInto = this.subFormPlaceholder.injectInto;
|
|
200
|
-
const injectAt = this.subFormPlaceholder.at;
|
|
201
|
-
if (injectInto instanceof UntypedFormArray) {
|
|
202
|
-
const idx = injectInto.controls.findIndex(e => e === this.formGroup);
|
|
203
|
-
injectInto.removeAt(idx);
|
|
204
|
-
}
|
|
205
|
-
else if (injectInto instanceof UntypedFormGroup) {
|
|
206
|
-
if (typeof injectAt !== 'string') {
|
|
207
|
-
throw new Error(`cannot index FormGroup with ${typeof injectAt}`);
|
|
208
|
-
}
|
|
209
|
-
injectInto.removeControl(injectAt);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
addSupportForPatchValueInterceptor() {
|
|
214
|
-
const fn = this.formGroup.patchValue;
|
|
215
|
-
const newFn = (value, options) => {
|
|
216
|
-
this.patchValueInterceptor(value).then((val) => {
|
|
217
|
-
setTimeout(() => {
|
|
218
|
-
fn.call(this.formGroup, val, options);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
this.formGroup.patchValue = newFn;
|
|
223
|
-
}
|
|
224
|
-
registerControl(formControl, formElement) {
|
|
225
|
-
this.activeControls.push({ formControl, formElement });
|
|
226
|
-
if (this.parent) {
|
|
227
|
-
this.parent.registerControl(formControl, formElement);
|
|
228
|
-
}
|
|
229
|
-
if (this.readOnly) {
|
|
230
|
-
formControl.disable();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
unregisterControl(formControl) {
|
|
234
|
-
this.activeControls = this.activeControls.filter((e) => e.formControl !== formControl);
|
|
235
|
-
if (this.parent) {
|
|
236
|
-
this.parent.unregisterControl(formControl);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
addFormGroupControls(formGroup, result) {
|
|
240
|
-
Object.values(formGroup.controls).forEach((value) => {
|
|
241
|
-
if (value instanceof UntypedFormGroup) {
|
|
242
|
-
this.addFormGroupControls(value, result);
|
|
243
|
-
}
|
|
244
|
-
else if (value instanceof UntypedFormArray) {
|
|
245
|
-
this.addFormArrayControls(value, result);
|
|
246
|
-
}
|
|
247
|
-
else if (value instanceof UntypedFormControl) {
|
|
248
|
-
this.addFormControl(value, result);
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
addFormArrayControls(formArray, result) {
|
|
253
|
-
formArray.controls.forEach((value) => {
|
|
254
|
-
if (value instanceof UntypedFormGroup) {
|
|
255
|
-
this.addFormGroupControls(value, result);
|
|
256
|
-
}
|
|
257
|
-
else if (value instanceof UntypedFormArray) {
|
|
258
|
-
this.addFormArrayControls(value, result);
|
|
259
|
-
}
|
|
260
|
-
else if (value instanceof UntypedFormControl) {
|
|
261
|
-
this.addFormControl(value, result);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
getAllFormControls() {
|
|
266
|
-
const result = [];
|
|
267
|
-
this.addFormGroupControls(this.formGroup, result);
|
|
268
|
-
return result;
|
|
269
|
-
}
|
|
270
|
-
addFormControl(control, result) {
|
|
271
|
-
result.push(control);
|
|
272
|
-
}
|
|
273
|
-
disableInactiveFormControl(control) {
|
|
274
|
-
if (!this.activeControls.some((e) => e.formControl === control)) {
|
|
275
|
-
control.disable();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
trySubmit() {
|
|
279
|
-
var _a, _b;
|
|
280
|
-
this.formGroup.markAllAsTouched();
|
|
281
|
-
const allControls = this.getAllFormControls();
|
|
282
|
-
const originalDisabledStates = allControls.map(e => {
|
|
283
|
-
return { control: e, disabled: e.disabled };
|
|
284
|
-
});
|
|
285
|
-
allControls.forEach(e => this.disableInactiveFormControl(e));
|
|
286
|
-
allControls.forEach(e => e.updateValueAndValidity());
|
|
287
|
-
const formGroupValue = this.formGroup.value;
|
|
288
|
-
const renderedAndEnabledValues = this.getRenderedFieldValuesFormGroup(this.formGroup, true);
|
|
289
|
-
const renderedButDisabledValues = this.getRenderedFieldValuesFormGroup(this.formGroup, false);
|
|
290
|
-
if (this.formGroup.invalid) {
|
|
291
|
-
(_b = (_a = this.activeControls.find((e) => !e.formControl.valid)) === null || _a === void 0 ? void 0 : _a.formElement) === null || _b === void 0 ? void 0 : _b.scrollTo();
|
|
292
|
-
this.setDisabledStatesForAllControls(originalDisabledStates);
|
|
293
|
-
return Promise.reject(invalidFieldsSymbol);
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
this.setDisabledStatesForAllControls(originalDisabledStates);
|
|
297
|
-
const renderedValues = deepMerge(renderedAndEnabledValues, renderedButDisabledValues);
|
|
298
|
-
return Promise.resolve([formGroupValue, renderedValues]);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
getRenderedFieldValuesFormGroup(formGroup, enabled, valueObject = {}) {
|
|
302
|
-
Object.entries(formGroup.controls).forEach(([name, control]) => {
|
|
303
|
-
if (control instanceof FormControl && control.enabled === enabled && this.activeControls.some(e => e.formControl === control)) {
|
|
304
|
-
valueObject[name] = control.value;
|
|
305
|
-
}
|
|
306
|
-
else if (control instanceof FormArray) {
|
|
307
|
-
valueObject[name] = [];
|
|
308
|
-
this.getRenderedFieldValuesFormArray(control, enabled, valueObject[name]);
|
|
309
|
-
}
|
|
310
|
-
else if (control instanceof FormGroup) {
|
|
311
|
-
valueObject[name] = {};
|
|
312
|
-
this.getRenderedFieldValuesFormGroup(control, enabled, valueObject[name]);
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
return valueObject;
|
|
316
|
-
}
|
|
317
|
-
getRenderedFieldValuesFormArray(formArray, enabled, valueArray) {
|
|
318
|
-
formArray.controls.forEach((control) => {
|
|
319
|
-
if (control instanceof FormControl && control.enabled === enabled && this.activeControls.some(e => e.formControl === control)) {
|
|
320
|
-
valueArray.push(control.value);
|
|
321
|
-
}
|
|
322
|
-
else if (control instanceof FormArray) {
|
|
323
|
-
const newArray = [];
|
|
324
|
-
valueArray.push(newArray);
|
|
325
|
-
this.getRenderedFieldValuesFormArray(control, enabled, newArray);
|
|
326
|
-
}
|
|
327
|
-
else if (control instanceof FormGroup) {
|
|
328
|
-
const newObject = {};
|
|
329
|
-
valueArray.push(newObject);
|
|
330
|
-
this.getRenderedFieldValuesFormGroup(control, enabled, newObject);
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
setDisabledStatesForAllControls(originalDisabledStates) {
|
|
335
|
-
originalDisabledStates.forEach((e) => {
|
|
336
|
-
if (e.disabled) {
|
|
337
|
-
e.control.disable();
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
e.control.enable();
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
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 });
|
|
346
|
-
FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormComponent, selector: "klp-form", inputs: { readOnly: "readOnly", showErrorMessages: "showErrorMessages", errorMessageLocation: "errorMessageLocation", formGroup: "formGroup", patchValueInterceptor: "patchValueInterceptor" }, usesOnChanges: true, ngImport: i0, template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n", styles: [":host{display:block}:host.row{display:flex}:host form{height:inherit}\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"] }] });
|
|
347
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormComponent, decorators: [{
|
|
348
|
-
type: Component,
|
|
349
|
-
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}:host form{height:inherit}\n"] }]
|
|
350
|
-
}], ctorParameters: function () {
|
|
351
|
-
return [{ type: FormComponent, decorators: [{
|
|
352
|
-
type: SkipSelf
|
|
353
|
-
}, {
|
|
354
|
-
type: Optional
|
|
355
|
-
}] }, { type: SubFormDirective, decorators: [{
|
|
356
|
-
type: Optional
|
|
357
|
-
}] }];
|
|
358
|
-
}, propDecorators: { readOnly: [{
|
|
359
|
-
type: Input
|
|
360
|
-
}], showErrorMessages: [{
|
|
361
|
-
type: Input
|
|
362
|
-
}], errorMessageLocation: [{
|
|
363
|
-
type: Input
|
|
364
|
-
}], formGroup: [{
|
|
365
|
-
type: Input
|
|
366
|
-
}], patchValueInterceptor: [{
|
|
367
|
-
type: Input
|
|
368
|
-
}] } });
|
|
369
|
-
|
|
370
|
-
const FORM_ERROR_MESSAGES = new InjectionToken('form.error.messages');
|
|
371
|
-
const DEFAULT_ERROR_MESSAGES = {
|
|
372
|
-
min: 'Use a number larger than %min%',
|
|
373
|
-
max: 'Use a number smaller than %max%',
|
|
374
|
-
required: 'This field is required',
|
|
375
|
-
email: 'Use a valid email address',
|
|
376
|
-
minLength: 'Has to be longer than %minLength% character(s)',
|
|
377
|
-
maxLength: 'Has to be shorter than %maxLength% character(s)',
|
|
378
|
-
pattern: 'This input is not valid',
|
|
379
|
-
matchPassword: 'Passwords must match',
|
|
380
|
-
date: 'Enter a valid date',
|
|
381
|
-
};
|
|
382
|
-
class FormElementComponent {
|
|
383
|
-
constructor(parent, customMessages) {
|
|
384
|
-
this.parent = parent;
|
|
385
|
-
this.customMessages = customMessages;
|
|
386
|
-
this.direction = 'horizontal';
|
|
387
|
-
this.captionSpacing = 'percentages';
|
|
388
|
-
this.spaceDistribution = '40-60';
|
|
389
|
-
this.swapInputAndCaption = false;
|
|
390
|
-
this.errorMessages = DEFAULT_ERROR_MESSAGES;
|
|
391
|
-
this.customErrorHandlers = [];
|
|
392
|
-
}
|
|
393
|
-
shouldShowErrorMessages() {
|
|
394
|
-
var _a;
|
|
395
|
-
return ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.showErrorMessages) !== false;
|
|
396
|
-
}
|
|
397
|
-
substituteParameters(message, parameters) {
|
|
398
|
-
return Object.keys(parameters).reduce((msg, key) => {
|
|
399
|
-
return msg.replace(`%${key}%`, parameters[key]);
|
|
400
|
-
}, message);
|
|
401
|
-
}
|
|
402
|
-
registerControl(formControl, input = null) {
|
|
403
|
-
this.attachedControl = formControl;
|
|
404
|
-
this.parent.registerControl(formControl, this);
|
|
405
|
-
this.input = input;
|
|
406
|
-
}
|
|
407
|
-
unregisterControl(formControl) {
|
|
408
|
-
this.attachedControl = null;
|
|
409
|
-
this.parent.unregisterControl(formControl);
|
|
410
|
-
}
|
|
411
|
-
getAttachedControl() {
|
|
412
|
-
return this.attachedControl;
|
|
413
|
-
}
|
|
414
|
-
registerErrorHandler(error, templateRef) {
|
|
415
|
-
this.customErrorHandlers.push({ error, templateRef });
|
|
416
|
-
}
|
|
417
|
-
registerCaption(templateRef) {
|
|
418
|
-
this.captionRef = templateRef;
|
|
419
|
-
}
|
|
420
|
-
getErrorToShow() {
|
|
421
|
-
var _a, _b, _c;
|
|
422
|
-
if (((_a = this.attachedControl) === null || _a === void 0 ? void 0 : _a.touched) === true && ((_b = this.attachedControl) === null || _b === void 0 ? void 0 : _b.errors)) {
|
|
423
|
-
return Object.keys((_c = this.attachedControl) === null || _c === void 0 ? void 0 : _c.errors)[0];
|
|
424
|
-
}
|
|
425
|
-
return null;
|
|
426
|
-
}
|
|
427
|
-
getCustomErrorHandler(error) {
|
|
428
|
-
return this.customErrorHandlers.find((e) => e.error === error);
|
|
429
|
-
}
|
|
430
|
-
showDefaultError(error) {
|
|
431
|
-
return this.getErrorToShow() === error && !this.customErrorHandlers.some((e) => e.error === error);
|
|
432
|
-
}
|
|
433
|
-
getScrollableParent(node) {
|
|
434
|
-
if (node == null) {
|
|
435
|
-
return null;
|
|
436
|
-
}
|
|
437
|
-
if (node.scrollHeight > node.clientHeight) {
|
|
438
|
-
return node;
|
|
439
|
-
}
|
|
440
|
-
else {
|
|
441
|
-
return this.getScrollableParent(node.parentNode);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
scrollTo() {
|
|
445
|
-
var _a;
|
|
446
|
-
this.internalComponentRef.nativeElement.scrollIntoView(true);
|
|
447
|
-
// to give some breathing room, we scroll 100px more to the top
|
|
448
|
-
(_a = this.getScrollableParent(this.internalComponentRef.nativeElement)) === null || _a === void 0 ? void 0 : _a.scrollBy(0, -100);
|
|
449
|
-
}
|
|
450
|
-
isRequired() {
|
|
451
|
-
if (isValueSet(this.input)) {
|
|
452
|
-
return this.input.hasValidator('required');
|
|
453
|
-
}
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
getErrorMessage(key) {
|
|
457
|
-
var _a, _b, _c;
|
|
458
|
-
return (_c = (_b = (_a = this.customMessages) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this.errorMessages[key];
|
|
459
|
-
}
|
|
460
|
-
getErrorLocation() {
|
|
461
|
-
var _a, _b;
|
|
462
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.errorMessageLocation) !== null && _b !== void 0 ? _b : 'belowCaption';
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
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 });
|
|
466
|
-
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', 'd34-66': spaceDistribution === '34-66'}\">\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',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\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]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66'\n\t}\">\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.percentageSpacing.d34-66{flex-basis:34%}.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%}.inputContainer.percentageSpacing.d34-66{flex-basis:66%}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}.errorContainer.hasCaption.d34-66{margin-left:34%}\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"] }] });
|
|
467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormElementComponent, decorators: [{
|
|
468
|
-
type: Component,
|
|
469
|
-
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', 'd34-66': spaceDistribution === '34-66'}\">\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',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\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]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66'\n\t}\">\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.percentageSpacing.d34-66{flex-basis:34%}.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%}.inputContainer.percentageSpacing.d34-66{flex-basis:66%}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}.errorContainer.hasCaption.d34-66{margin-left:34%}\n"] }]
|
|
470
|
-
}], ctorParameters: function () {
|
|
471
|
-
return [{ type: FormComponent, decorators: [{
|
|
472
|
-
type: Host
|
|
473
|
-
}, {
|
|
474
|
-
type: Optional
|
|
475
|
-
}] }, { type: undefined, decorators: [{
|
|
476
|
-
type: Inject,
|
|
477
|
-
args: [FORM_ERROR_MESSAGES]
|
|
478
|
-
}, {
|
|
479
|
-
type: Optional
|
|
480
|
-
}] }];
|
|
481
|
-
}, propDecorators: { caption: [{
|
|
482
|
-
type: Input
|
|
483
|
-
}], direction: [{
|
|
484
|
-
type: Input
|
|
485
|
-
}], captionSpacing: [{
|
|
486
|
-
type: Input
|
|
487
|
-
}], spaceDistribution: [{
|
|
488
|
-
type: Input
|
|
489
|
-
}], swapInputAndCaption: [{
|
|
490
|
-
type: Input
|
|
491
|
-
}], internalComponentRef: [{
|
|
492
|
-
type: ViewChild,
|
|
493
|
-
args: ['internalComponentRef']
|
|
494
|
-
}] } });
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* This component is a base in order to create a component that supports ngModel.
|
|
498
|
-
* Some important things to know about it:
|
|
499
|
-
*
|
|
500
|
-
* innerValue = your own inner state, which you should use to store the current state of what ngModel should be.
|
|
501
|
-
* 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!
|
|
502
|
-
* setInnerValueAndNotify() = call this when you want your ngModel to be updated from INSIDE of your component, and provide it to the OUTSIDE.
|
|
503
|
-
* 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.
|
|
504
|
-
*/
|
|
505
|
-
class ValueAccessorBase {
|
|
506
|
-
constructor(parent, controlContainer) {
|
|
507
|
-
this.parent = parent;
|
|
508
|
-
this.controlContainer = controlContainer;
|
|
509
|
-
this.changed = new Array();
|
|
510
|
-
this.touched = new Array();
|
|
511
|
-
this.prevValue = null;
|
|
512
|
-
this.disabled = false;
|
|
513
|
-
// we support both providing just the formControlName and the full formControl
|
|
514
|
-
this.formControlName = null;
|
|
515
|
-
this.formControl = null;
|
|
516
|
-
this.onTouch = new EventEmitter();
|
|
517
|
-
this.focus = () => {
|
|
518
|
-
var _a, _b, _c;
|
|
519
|
-
if (isValueSet((_a = this.nativeInputRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
|
|
520
|
-
(_c = (_b = this.nativeInputRef) === null || _b === void 0 ? void 0 : _b.nativeElement) === null || _c === void 0 ? void 0 : _c.focus();
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
throw new Error('the focus() method is not implemented in this element!');
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
ngOnInit() {
|
|
528
|
-
var _a, _b, _c;
|
|
529
|
-
if (this.formControl) {
|
|
530
|
-
this.attachedFormControl = this.formControl;
|
|
531
|
-
}
|
|
532
|
-
else if (stringIsSetAndFilled(this.formControlName)) {
|
|
533
|
-
this.attachedFormControl = (_a = this.controlContainer) === null || _a === void 0 ? void 0 : _a.control.get(this.formControlName);
|
|
534
|
-
if (isNullOrUndefined(this.attachedFormControl)) {
|
|
535
|
-
throw new Error(`Form element '${this.formControlName}' with caption '${(_b = this.parent) === null || _b === void 0 ? void 0 : _b.caption}' is not declared in your FormGroup.`);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
if (this.attachedFormControl) {
|
|
539
|
-
this.disabled = this.attachedFormControl.disabled;
|
|
540
|
-
this.attachedFormControl.statusChanges.subscribe(() => {
|
|
541
|
-
this.disabled = this.attachedFormControl.disabled;
|
|
542
|
-
});
|
|
543
|
-
(_c = this.parent) === null || _c === void 0 ? void 0 : _c.registerControl(this.attachedFormControl, this);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
isInErrorState() {
|
|
547
|
-
return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
|
|
548
|
-
}
|
|
549
|
-
ngOnDestroy() {
|
|
550
|
-
var _a;
|
|
551
|
-
if (this.attachedFormControl) {
|
|
552
|
-
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.unregisterControl(this.attachedFormControl);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
touch() {
|
|
556
|
-
this.touched.forEach((f) => f());
|
|
557
|
-
}
|
|
558
|
-
writeValue(value) {
|
|
559
|
-
this.innerValue = value;
|
|
560
|
-
this.prevValue = value;
|
|
561
|
-
}
|
|
562
|
-
registerOnChange(fn) {
|
|
563
|
-
this.changed.push(fn);
|
|
564
|
-
}
|
|
565
|
-
registerOnTouched(fn) {
|
|
566
|
-
this.touched.push(fn);
|
|
567
|
-
}
|
|
568
|
-
setInnerValueAndNotify(value) {
|
|
569
|
-
const actuallySetValue = (valueToSet) => {
|
|
570
|
-
this.innerValue = valueToSet;
|
|
571
|
-
this.prevValue = valueToSet;
|
|
572
|
-
this.changed.forEach((fn) => fn(valueToSet));
|
|
573
|
-
};
|
|
574
|
-
if (isValueSet(this.innerValueChangeInterceptor)) {
|
|
575
|
-
this.latestInnerValueChangedInterceptorPromise = this.innerValueChangeInterceptor(this.prevValue, value);
|
|
576
|
-
const myPromise = this.latestInnerValueChangedInterceptorPromise;
|
|
577
|
-
this.latestInnerValueChangedInterceptorPromise.then(() => {
|
|
578
|
-
if (this.latestInnerValueChangedInterceptorPromise === myPromise) {
|
|
579
|
-
actuallySetValue(value);
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
// ignore outdated promises
|
|
583
|
-
}
|
|
584
|
-
}).catch(() => {
|
|
585
|
-
if (this.latestInnerValueChangedInterceptorPromise === myPromise) {
|
|
586
|
-
actuallySetValue(this.prevValue);
|
|
587
|
-
}
|
|
588
|
-
else {
|
|
589
|
-
// ignore outdated promises
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
else {
|
|
594
|
-
actuallySetValue(value);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
resetToNull() {
|
|
598
|
-
this.setInnerValueAndNotify(null);
|
|
599
|
-
}
|
|
600
|
-
hasValidator(validatorName) {
|
|
601
|
-
var _a, _b, _c;
|
|
602
|
-
const validators = Object.keys((_c = (_b = (_a = this.attachedFormControl) === null || _a === void 0 ? void 0 : _a.validator) === null || _b === void 0 ? void 0 : _b.call(_a, {})) !== null && _c !== void 0 ? _c : {});
|
|
603
|
-
if (arrayIsSetAndFilled(validators)) {
|
|
604
|
-
return validators.includes(validatorName);
|
|
605
|
-
}
|
|
606
|
-
return false;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
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 });
|
|
610
|
-
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" }, viewQueries: [{ propertyName: "nativeInputRef", first: true, predicate: ["nativeInputRef"], descendants: true }], ngImport: i0, template: '', isInline: true });
|
|
611
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ValueAccessorBase, decorators: [{
|
|
612
|
-
type: Component,
|
|
613
|
-
args: [{
|
|
614
|
-
selector: '',
|
|
615
|
-
template: '',
|
|
616
|
-
}]
|
|
617
|
-
}], ctorParameters: function () {
|
|
618
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
619
|
-
type: Host
|
|
620
|
-
}, {
|
|
621
|
-
type: Optional
|
|
622
|
-
}] }, { type: i2.ControlContainer, decorators: [{
|
|
623
|
-
type: Host
|
|
624
|
-
}, {
|
|
625
|
-
type: Optional
|
|
626
|
-
}] }];
|
|
627
|
-
}, propDecorators: { disabled: [{
|
|
628
|
-
type: Input
|
|
629
|
-
}], innerValueChangeInterceptor: [{
|
|
630
|
-
type: Input
|
|
631
|
-
}], formControlName: [{
|
|
632
|
-
type: Input
|
|
633
|
-
}], formControl: [{
|
|
634
|
-
type: Input
|
|
635
|
-
}], onTouch: [{
|
|
636
|
-
type: Output
|
|
637
|
-
}], nativeInputRef: [{
|
|
638
|
-
type: ViewChild,
|
|
639
|
-
args: ['nativeInputRef']
|
|
640
|
-
}] } });
|
|
641
|
-
|
|
642
|
-
class LoadingIndicatorComponent {
|
|
643
|
-
constructor() {
|
|
644
|
-
this.variant = '3dots';
|
|
645
|
-
this.size = 'medium';
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
LoadingIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: LoadingIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
649
|
-
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"] }] });
|
|
650
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: LoadingIndicatorComponent, decorators: [{
|
|
651
|
-
type: Component,
|
|
652
|
-
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"] }]
|
|
653
|
-
}], propDecorators: { variant: [{
|
|
654
|
-
type: Input
|
|
655
|
-
}], size: [{
|
|
656
|
-
type: Input
|
|
657
|
-
}] } });
|
|
658
|
-
|
|
659
|
-
class ButtonComponent {
|
|
660
|
-
constructor() {
|
|
661
|
-
this.variant = 'white';
|
|
662
|
-
this.size = 'medium';
|
|
663
|
-
this.fullWidth = false;
|
|
664
|
-
this.hasBorder = true;
|
|
665
|
-
this.disabled = false;
|
|
666
|
-
this.isLoading = false;
|
|
667
|
-
this.type = 'button';
|
|
668
|
-
}
|
|
669
|
-
get _() {
|
|
670
|
-
return this.fullWidth;
|
|
671
|
-
}
|
|
672
|
-
onClick(event) {
|
|
673
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
674
|
-
if (this.disabled) {
|
|
675
|
-
event.stopPropagation();
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
if (isValueSet(this.clickCallback)) {
|
|
679
|
-
this.isLoading = true;
|
|
680
|
-
yield this.clickCallback(event).finally(() => {
|
|
681
|
-
this.isLoading = false;
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
688
|
-
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"] }] });
|
|
689
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
690
|
-
type: Component,
|
|
691
|
-
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"] }]
|
|
692
|
-
}], propDecorators: { variant: [{
|
|
693
|
-
type: Input
|
|
694
|
-
}], size: [{
|
|
695
|
-
type: Input
|
|
696
|
-
}], fullWidth: [{
|
|
697
|
-
type: Input
|
|
698
|
-
}], hasBorder: [{
|
|
699
|
-
type: Input
|
|
700
|
-
}], disabled: [{
|
|
701
|
-
type: Input
|
|
702
|
-
}], isLoading: [{
|
|
703
|
-
type: Input
|
|
704
|
-
}], type: [{
|
|
705
|
-
type: Input
|
|
706
|
-
}], clickCallback: [{
|
|
707
|
-
type: Input
|
|
708
|
-
}], _: [{
|
|
709
|
-
type: HostBinding,
|
|
710
|
-
args: ['class._fullWidth']
|
|
711
|
-
}] } });
|
|
712
|
-
|
|
713
|
-
class CheckboxComponent extends ValueAccessorBase {
|
|
714
|
-
constructor() {
|
|
715
|
-
super(...arguments);
|
|
716
|
-
this.renderUndefinedAsIndeterminate = false;
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
720
|
-
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\t#nativeInputRef\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"] }] });
|
|
721
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
722
|
-
type: Component,
|
|
723
|
-
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\t#nativeInputRef\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"] }]
|
|
724
|
-
}], propDecorators: { caption: [{
|
|
725
|
-
type: Input
|
|
726
|
-
}], renderUndefinedAsIndeterminate: [{
|
|
727
|
-
type: Input
|
|
728
|
-
}] } });
|
|
729
|
-
|
|
730
|
-
class EmailInputComponent extends ValueAccessorBase {
|
|
731
|
-
constructor() {
|
|
732
|
-
super(...arguments);
|
|
733
|
-
this.placeholder = '';
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
EmailInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: EmailInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
737
|
-
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\t#nativeInputRef\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"] }] });
|
|
738
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: EmailInputComponent, decorators: [{
|
|
739
|
-
type: Component,
|
|
740
|
-
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\t#nativeInputRef\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"] }]
|
|
741
|
-
}], propDecorators: { placeholder: [{
|
|
742
|
-
type: Input
|
|
743
|
-
}] } });
|
|
744
|
-
|
|
745
|
-
class NumberInputComponent extends ValueAccessorBase {
|
|
746
|
-
constructor() {
|
|
747
|
-
super(...arguments);
|
|
748
|
-
this.parseNumber = false;
|
|
749
|
-
}
|
|
750
|
-
setInnerValueAndNotify(value) {
|
|
751
|
-
if (this.parseNumber && typeof value === "string") {
|
|
752
|
-
super.setInnerValueAndNotify(Number(value));
|
|
753
|
-
}
|
|
754
|
-
else {
|
|
755
|
-
super.setInnerValueAndNotify(value);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
NumberInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NumberInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
760
|
-
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\t#nativeInputRef\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"] }] });
|
|
761
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NumberInputComponent, decorators: [{
|
|
762
|
-
type: Component,
|
|
763
|
-
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\t#nativeInputRef\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"] }]
|
|
764
|
-
}], propDecorators: { placeholder: [{
|
|
765
|
-
type: Input
|
|
766
|
-
}], parseNumber: [{
|
|
767
|
-
type: Input
|
|
768
|
-
}] } });
|
|
769
|
-
|
|
770
|
-
class PasswordFieldComponent extends ValueAccessorBase {
|
|
771
|
-
constructor() {
|
|
772
|
-
super(...arguments);
|
|
773
|
-
this.placeholder = 'Password';
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
PasswordFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: PasswordFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
777
|
-
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\t#nativeInputRef\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"] }] });
|
|
778
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: PasswordFieldComponent, decorators: [{
|
|
779
|
-
type: Component,
|
|
780
|
-
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\t#nativeInputRef\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"] }]
|
|
781
|
-
}], propDecorators: { placeholder: [{
|
|
782
|
-
type: Input
|
|
783
|
-
}] } });
|
|
784
|
-
|
|
785
|
-
const SELECT_TRANSLATIONS = new InjectionToken('klp.form.select.translations');
|
|
786
|
-
class KlpSelectOptionTemplateDirective {
|
|
787
|
-
}
|
|
788
|
-
KlpSelectOptionTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: KlpSelectOptionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
789
|
-
KlpSelectOptionTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: KlpSelectOptionTemplateDirective, selector: "[klpSelectOptionTpl]", ngImport: i0 });
|
|
790
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: KlpSelectOptionTemplateDirective, decorators: [{
|
|
791
|
-
type: Directive,
|
|
792
|
-
args: [{ selector: '[klpSelectOptionTpl]' }]
|
|
793
|
-
}] });
|
|
794
|
-
class SelectComponent extends ValueAccessorBase {
|
|
795
|
-
constructor(parent, controlContainer, translations, elRef) {
|
|
796
|
-
super(parent, controlContainer);
|
|
797
|
-
this.parent = parent;
|
|
798
|
-
this.controlContainer = controlContainer;
|
|
799
|
-
this.translations = translations;
|
|
800
|
-
this.elRef = elRef;
|
|
801
|
-
this.orientation = 'horizontal';
|
|
802
|
-
this.multiple = false;
|
|
803
|
-
this.multipleDisplayedAsAmount = false;
|
|
804
|
-
this.clearable = true;
|
|
805
|
-
this.truncateOptions = true;
|
|
806
|
-
this.withSeparatingLine = false;
|
|
807
|
-
this.searchable = true;
|
|
808
|
-
this.dropdownPosition = null;
|
|
809
|
-
this.onSearch = new EventEmitter();
|
|
810
|
-
this.onEndReached = new EventEmitter();
|
|
811
|
-
this.onOpened = new EventEmitter();
|
|
812
|
-
this.onClosed = new EventEmitter();
|
|
813
|
-
this.onBlur = new EventEmitter();
|
|
814
|
-
this.onClear = new EventEmitter();
|
|
815
|
-
this.lastItemIndexReached = -1;
|
|
816
|
-
this.dropdownPositionToUse = 'bottom';
|
|
817
|
-
this.focus = () => {
|
|
818
|
-
this.ngSelect.focus();
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
ngAfterViewInit() {
|
|
822
|
-
this.addPrefix();
|
|
823
|
-
}
|
|
824
|
-
addPrefix() {
|
|
825
|
-
if (stringIsSetAndFilled(this.prefix)) {
|
|
826
|
-
const container = this.elRef.nativeElement.querySelector('.ng-select-container');
|
|
827
|
-
const newNode = document.createElement('div');
|
|
828
|
-
newNode.className = 'prefix';
|
|
829
|
-
newNode.innerText = this.prefix;
|
|
830
|
-
container.insertBefore(newNode, container.children[0]);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
ngOnChanges(changes) {
|
|
834
|
-
if (isValueSet(changes.options)) {
|
|
835
|
-
this.lastItemIndexReached = -1;
|
|
836
|
-
this.setWidthBasedOnOptionsWidths();
|
|
837
|
-
}
|
|
838
|
-
this.dropdownPositionToUse = this.dropdownPosition;
|
|
839
|
-
}
|
|
840
|
-
getDefaultTranslation(key) {
|
|
841
|
-
switch (key) {
|
|
842
|
-
case 'placeholder':
|
|
843
|
-
return () => 'Pick an option';
|
|
844
|
-
case 'amountSelected':
|
|
845
|
-
return (amount) => `${amount} selected`;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
getTranslation(key, params = null) {
|
|
849
|
-
var _a, _b, _c;
|
|
850
|
-
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
851
|
-
return this.placeholder;
|
|
852
|
-
}
|
|
853
|
-
return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
|
|
854
|
-
}
|
|
855
|
-
onScroll(lastItemIndex) {
|
|
856
|
-
var _a, _b, _c, _d;
|
|
857
|
-
const visibleItems = (_d = (_c = (_b = (_a = this.ngSelect) === null || _a === void 0 ? void 0 : _a.itemsList) === null || _b === void 0 ? void 0 : _b.filteredItems) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
|
|
858
|
-
if (this.lastItemIndexReached < lastItemIndex && lastItemIndex === visibleItems) {
|
|
859
|
-
this.onEndReached.emit();
|
|
860
|
-
}
|
|
861
|
-
this.lastItemIndexReached = Math.max(lastItemIndex, this.lastItemIndexReached);
|
|
862
|
-
this.setWidthBasedOnOptionsWidths();
|
|
863
|
-
}
|
|
864
|
-
searchQueryChanged(searchQuery) {
|
|
865
|
-
this.onSearch.emit(searchQuery);
|
|
866
|
-
}
|
|
867
|
-
onOpen() {
|
|
868
|
-
if (this.orientation === 'horizontal' && !isValueSet(this.dropdownPosition)) {
|
|
869
|
-
this.determineDropdownPosition();
|
|
870
|
-
}
|
|
871
|
-
// waiting for the thing to render until we fire the event
|
|
872
|
-
setTimeout(() => {
|
|
873
|
-
this.onOpened.emit();
|
|
874
|
-
this.setWidthBasedOnOptionsWidths();
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
setWidthBasedOnOptionsWidths() {
|
|
878
|
-
if (this.truncateOptions === false) {
|
|
879
|
-
setTimeout(() => {
|
|
880
|
-
var _a;
|
|
881
|
-
const widths = Array.from(this.elRef.nativeElement.querySelectorAll('.ng-option div')).map((e) => e.scrollWidth);
|
|
882
|
-
const maxWidth = Math.max(...widths);
|
|
883
|
-
const dropdownPanel = this.elRef.nativeElement.querySelector('ng-dropdown-panel');
|
|
884
|
-
if (dropdownPanel) {
|
|
885
|
-
dropdownPanel.style.width = `${Math.max(this.elRef.nativeElement.clientWidth, maxWidth + 40, dropdownPanel.getBoundingClientRect().width)}px`;
|
|
886
|
-
}
|
|
887
|
-
let limitingParentContainer = this.elRef.nativeElement;
|
|
888
|
-
while (limitingParentContainer.parentElement && !this.isLimitingContainer(limitingParentContainer)) {
|
|
889
|
-
limitingParentContainer = limitingParentContainer.parentElement;
|
|
890
|
-
}
|
|
891
|
-
if (dropdownPanel) {
|
|
892
|
-
const spaceInParent = limitingParentContainer.clientWidth;
|
|
893
|
-
const spaceLeftOfElRef = ((_a = this.elRef) === null || _a === void 0 ? void 0 : _a.nativeElement.getBoundingClientRect().left) - limitingParentContainer.getBoundingClientRect().left;
|
|
894
|
-
const spaceRightOfElRef = spaceInParent - spaceLeftOfElRef;
|
|
895
|
-
const shiftToLeft = (dropdownPanel === null || dropdownPanel === void 0 ? void 0 : dropdownPanel.clientWidth) - spaceRightOfElRef + 20;
|
|
896
|
-
if (shiftToLeft > 0) {
|
|
897
|
-
dropdownPanel.style.left = `-${shiftToLeft}px`;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
determineDropdownPosition() {
|
|
904
|
-
let current = this.elRef.nativeElement;
|
|
905
|
-
while (current.parentElement && !this.isLimitingContainer(current)) {
|
|
906
|
-
current = current.parentElement;
|
|
907
|
-
}
|
|
908
|
-
const topSpace = this.elRef.nativeElement.getBoundingClientRect().top - current.getBoundingClientRect().top;
|
|
909
|
-
const bottomSpace = current.clientHeight - topSpace;
|
|
910
|
-
if (bottomSpace >= 285) {
|
|
911
|
-
this.dropdownPositionToUse = 'bottom';
|
|
912
|
-
}
|
|
913
|
-
else {
|
|
914
|
-
this.dropdownPositionToUse = 'top';
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
isLimitingContainer(element) {
|
|
918
|
-
const style = getComputedStyle(element);
|
|
919
|
-
if (style.overflowY === 'auto') {
|
|
920
|
-
return true;
|
|
921
|
-
}
|
|
922
|
-
if (style.overflow === 'auto') {
|
|
923
|
-
return true;
|
|
924
|
-
}
|
|
925
|
-
if (style.overflowY === 'scroll') {
|
|
926
|
-
return true;
|
|
927
|
-
}
|
|
928
|
-
if (style.overflow === 'scroll') {
|
|
929
|
-
return true;
|
|
930
|
-
}
|
|
931
|
-
return false;
|
|
932
|
-
}
|
|
933
|
-
onClose() {
|
|
934
|
-
// Give angular a second to render the closed situation before emitting the close event
|
|
935
|
-
setTimeout(() => {
|
|
936
|
-
this.onClosed.emit();
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
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 });
|
|
941
|
-
SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: SelectComponent, selector: "klp-form-select", inputs: { placeholder: "placeholder", prefix: "prefix", orientation: "orientation", options: "options", multiple: "multiple", multipleDisplayedAsAmount: "multipleDisplayedAsAmount", clearable: "clearable", truncateOptions: "truncateOptions", withSeparatingLine: "withSeparatingLine", searchable: "searchable", dropdownPosition: "dropdownPosition", customSearchFn: "customSearchFn", footerElement: "footerElement" }, outputs: { onSearch: "onSearch", onEndReached: "onEndReached", onOpened: "onOpened", onClosed: "onClosed", onBlur: "onBlur", onClear: "onClear" }, 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', truncateOptions: truncateOptions, withSeparatingLine: withSeparatingLine}\"\n\t(change)=\"setInnerValueAndNotify(innerValue)\"\n\t[multiple]=\"multiple\"\n\t[disabled]=\"disabled\"\n\t(blur)=\"touch(); onBlur.emit()\"\n\t(clear)=\"onClear.emit()\"\n\t(search)=\"searchQueryChanged($event.term)\"\n\t[searchable]=\"searchable\"\n\t[dropdownPosition]=\"dropdownPositionToUse\"\n\t[searchFn]=\"customSearchFn\"\n\t[selectOnTab]=\"true\"\n\t[virtualScroll]=\"true\"\n\t(scroll)=\"onScroll($event.end)\"\n\t(open)=\"onOpen()\"\n\t(close)=\"onClose()\"\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:not(.ng-select-multiple) .ng-placeholder,:host ::ng-deep .ng-select:not(.ng-select-multiple) .ng-value{width:0px;flex-grow:1;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:initial}: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;display:flex}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option div{white-space:nowrap}:host .ng-select.truncateOptions ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{display:block}:host .ng-select.truncateOptions ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option div{overflow:hidden;text-overflow:ellipsis}:host .ng-select.withSeparatingLine ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{border-bottom:1px solid #e3e3e3}: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]" }] });
|
|
942
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectComponent, decorators: [{
|
|
943
|
-
type: Component,
|
|
944
|
-
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', truncateOptions: truncateOptions, withSeparatingLine: withSeparatingLine}\"\n\t(change)=\"setInnerValueAndNotify(innerValue)\"\n\t[multiple]=\"multiple\"\n\t[disabled]=\"disabled\"\n\t(blur)=\"touch(); onBlur.emit()\"\n\t(clear)=\"onClear.emit()\"\n\t(search)=\"searchQueryChanged($event.term)\"\n\t[searchable]=\"searchable\"\n\t[dropdownPosition]=\"dropdownPositionToUse\"\n\t[searchFn]=\"customSearchFn\"\n\t[selectOnTab]=\"true\"\n\t[virtualScroll]=\"true\"\n\t(scroll)=\"onScroll($event.end)\"\n\t(open)=\"onOpen()\"\n\t(close)=\"onClose()\"\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:not(.ng-select-multiple) .ng-placeholder,:host ::ng-deep .ng-select:not(.ng-select-multiple) .ng-value{width:0px;flex-grow:1;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:initial}: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;display:flex}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option div{white-space:nowrap}:host .ng-select.truncateOptions ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{display:block}:host .ng-select.truncateOptions ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option div{overflow:hidden;text-overflow:ellipsis}:host .ng-select.withSeparatingLine ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{border-bottom:1px solid #e3e3e3}: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"] }]
|
|
945
|
-
}], ctorParameters: function () {
|
|
946
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
947
|
-
type: Optional
|
|
948
|
-
}, {
|
|
949
|
-
type: Host
|
|
950
|
-
}] }, { type: i2.ControlContainer, decorators: [{
|
|
951
|
-
type: Optional
|
|
952
|
-
}, {
|
|
953
|
-
type: Host
|
|
954
|
-
}] }, { type: undefined, decorators: [{
|
|
955
|
-
type: Inject,
|
|
956
|
-
args: [SELECT_TRANSLATIONS]
|
|
957
|
-
}, {
|
|
958
|
-
type: Optional
|
|
959
|
-
}] }, { type: i0.ElementRef }];
|
|
960
|
-
}, propDecorators: { placeholder: [{
|
|
961
|
-
type: Input
|
|
962
|
-
}], prefix: [{
|
|
963
|
-
type: Input
|
|
964
|
-
}], orientation: [{
|
|
965
|
-
type: Input
|
|
966
|
-
}], options: [{
|
|
967
|
-
type: Input
|
|
968
|
-
}], multiple: [{
|
|
969
|
-
type: Input
|
|
970
|
-
}], multipleDisplayedAsAmount: [{
|
|
971
|
-
type: Input
|
|
972
|
-
}], clearable: [{
|
|
973
|
-
type: Input
|
|
974
|
-
}], truncateOptions: [{
|
|
975
|
-
type: Input
|
|
976
|
-
}], withSeparatingLine: [{
|
|
977
|
-
type: Input
|
|
978
|
-
}], searchable: [{
|
|
979
|
-
type: Input
|
|
980
|
-
}], dropdownPosition: [{
|
|
981
|
-
type: Input
|
|
982
|
-
}], customSearchFn: [{
|
|
983
|
-
type: Input
|
|
984
|
-
}], footerElement: [{
|
|
985
|
-
type: Input
|
|
986
|
-
}], onSearch: [{
|
|
987
|
-
type: Output
|
|
988
|
-
}], onEndReached: [{
|
|
989
|
-
type: Output
|
|
990
|
-
}], onOpened: [{
|
|
991
|
-
type: Output
|
|
992
|
-
}], onClosed: [{
|
|
993
|
-
type: Output
|
|
994
|
-
}], onBlur: [{
|
|
995
|
-
type: Output
|
|
996
|
-
}], onClear: [{
|
|
997
|
-
type: Output
|
|
998
|
-
}], ngSelect: [{
|
|
999
|
-
type: ViewChild,
|
|
1000
|
-
args: ['ngSelect']
|
|
1001
|
-
}], customOptionTpl: [{
|
|
1002
|
-
type: ContentChild,
|
|
1003
|
-
args: [KlpSelectOptionTemplateDirective, { read: TemplateRef }]
|
|
1004
|
-
}] } });
|
|
1005
|
-
|
|
1006
|
-
class SelectFooterComponent {
|
|
1007
|
-
}
|
|
1008
|
-
SelectFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1009
|
-
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"] });
|
|
1010
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SelectFooterComponent, decorators: [{
|
|
1011
|
-
type: Component,
|
|
1012
|
-
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"] }]
|
|
1013
|
-
}], propDecorators: { prefix: [{
|
|
1014
|
-
type: Input
|
|
1015
|
-
}], text: [{
|
|
1016
|
-
type: Input
|
|
1017
|
-
}] } });
|
|
1018
|
-
|
|
1019
|
-
class SortableItemsComponent extends ValueAccessorBase {
|
|
1020
|
-
constructor() {
|
|
1021
|
-
super(...arguments);
|
|
1022
|
-
this.sortableItemSize = 'lg';
|
|
1023
|
-
this.useCustomScroll = false;
|
|
1024
|
-
this.scrollInterval = null;
|
|
1025
|
-
this.itemsOrderChanged = () => {
|
|
1026
|
-
this.setInnerValueAndNotify(this.innerValue);
|
|
1027
|
-
};
|
|
1028
|
-
this.onItemDrag = (data) => {
|
|
1029
|
-
// if the item you're dragging is reaching the top, start scrolling.
|
|
1030
|
-
if (data.relatedRect.top < 100) {
|
|
1031
|
-
this.scrollPage(100);
|
|
1032
|
-
}
|
|
1033
|
-
else {
|
|
1034
|
-
this.stopScrolling();
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
this.onEnd = () => {
|
|
1038
|
-
this.stopScrolling();
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
ngOnInit() {
|
|
1042
|
-
super.ngOnInit();
|
|
1043
|
-
if (this.useCustomScroll) {
|
|
1044
|
-
this.sortablejsOptions = { onUpdate: this.itemsOrderChanged, onMove: this.onItemDrag, onEnd: this.onEnd };
|
|
1045
|
-
}
|
|
1046
|
-
else {
|
|
1047
|
-
this.sortablejsOptions = { onUpdate: this.itemsOrderChanged };
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
scrollPage(scrollAmount) {
|
|
1051
|
-
if (!isValueSet(this.scrollInterval)) {
|
|
1052
|
-
this.scrollInterval = setInterval(() => {
|
|
1053
|
-
window.scroll({
|
|
1054
|
-
top: document.scrollingElement.scrollTop - scrollAmount,
|
|
1055
|
-
behavior: 'smooth',
|
|
1056
|
-
});
|
|
1057
|
-
if (document.scrollingElement.scrollTop <= 100) {
|
|
1058
|
-
this.stopScrolling();
|
|
1059
|
-
}
|
|
1060
|
-
}, 100);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
stopScrolling() {
|
|
1064
|
-
clearInterval(this.scrollInterval);
|
|
1065
|
-
this.scrollInterval = null;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
SortableItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableItemsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1069
|
-
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"] }] });
|
|
1070
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableItemsComponent, decorators: [{
|
|
1071
|
-
type: Component,
|
|
1072
|
-
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"] }]
|
|
1073
|
-
}], propDecorators: { template: [{
|
|
1074
|
-
type: ContentChild,
|
|
1075
|
-
args: [TemplateRef]
|
|
1076
|
-
}], sortableItemSize: [{
|
|
1077
|
-
type: Input
|
|
1078
|
-
}], useCustomScroll: [{
|
|
1079
|
-
type: Input
|
|
1080
|
-
}] } });
|
|
1081
|
-
|
|
1082
|
-
class TextInputComponent extends ValueAccessorBase {
|
|
1083
|
-
constructor() {
|
|
1084
|
-
super(...arguments);
|
|
1085
|
-
this.type = 'text';
|
|
1086
|
-
this.clearable = false;
|
|
1087
|
-
this.hasBorderLeft = true;
|
|
1088
|
-
this.hasBorderRight = true;
|
|
1089
|
-
this.onBlur = new EventEmitter();
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
TextInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: TextInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1093
|
-
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", hasBorderLeft: "hasBorderLeft", hasBorderRight: "hasBorderRight" }, outputs: { onBlur: "onBlur" }, 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[(ngModel)]=\"innerValue\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable, noBorderLeft: !hasBorderLeft, noBorderRight: !hasBorderRight}\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch(); onBlur.emit()\"\n\t\t[disabled]='disabled'\n\t\t#nativeInputRef\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}input.noBorderLeft{border-left:none}input.noBorderRight{border-right:none}.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"] }] });
|
|
1094
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
1095
|
-
type: Component,
|
|
1096
|
-
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[(ngModel)]=\"innerValue\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable, noBorderLeft: !hasBorderLeft, noBorderRight: !hasBorderRight}\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch(); onBlur.emit()\"\n\t\t[disabled]='disabled'\n\t\t#nativeInputRef\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}input.noBorderLeft{border-left:none}input.noBorderRight{border-right:none}.clearIcon{position:absolute;right:.625rem;top:7px;font-size:18px;cursor:pointer}.showErrors{border-color:#ff8000}\n"] }]
|
|
1097
|
-
}], propDecorators: { placeholder: [{
|
|
1098
|
-
type: Input
|
|
1099
|
-
}], type: [{
|
|
1100
|
-
type: Input
|
|
1101
|
-
}], clearable: [{
|
|
1102
|
-
type: Input
|
|
1103
|
-
}], icon: [{
|
|
1104
|
-
type: Input
|
|
1105
|
-
}], hasBorderLeft: [{
|
|
1106
|
-
type: Input
|
|
1107
|
-
}], hasBorderRight: [{
|
|
1108
|
-
type: Input
|
|
1109
|
-
}], onBlur: [{
|
|
1110
|
-
type: Output
|
|
1111
|
-
}] } });
|
|
1112
|
-
|
|
1113
|
-
class ToggleComponent extends ValueAccessorBase {
|
|
1114
|
-
}
|
|
1115
|
-
ToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1116
|
-
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 #nativeInputRef\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"] }] });
|
|
1117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ToggleComponent, decorators: [{
|
|
1118
|
-
type: Component,
|
|
1119
|
-
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 #nativeInputRef\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"] }]
|
|
1120
|
-
}] });
|
|
1121
|
-
|
|
1122
|
-
class FormCaptionComponent {
|
|
1123
|
-
constructor(parent) {
|
|
1124
|
-
this.parent = parent;
|
|
1125
|
-
}
|
|
1126
|
-
ngOnInit() {
|
|
1127
|
-
// this is being run next cycle, because we dont want to fail if the order of components is as follows:
|
|
1128
|
-
// <app-form-error />
|
|
1129
|
-
// <some-input />
|
|
1130
|
-
// That would fail, because the logic of the form error is run first, and at that moment, the `some-input` isnt registered yet
|
|
1131
|
-
setTimeout(() => {
|
|
1132
|
-
this.parent.registerCaption(this.contentRef);
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
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 });
|
|
1137
|
-
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"] });
|
|
1138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormCaptionComponent, decorators: [{
|
|
1139
|
-
type: Component,
|
|
1140
|
-
args: [{ selector: 'klp-form-caption', template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
1141
|
-
}], ctorParameters: function () {
|
|
1142
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
1143
|
-
type: Host
|
|
1144
|
-
}, {
|
|
1145
|
-
type: Optional
|
|
1146
|
-
}] }];
|
|
1147
|
-
}, propDecorators: { contentRef: [{
|
|
1148
|
-
type: ViewChild,
|
|
1149
|
-
args: ['contentRef']
|
|
1150
|
-
}] } });
|
|
1151
|
-
|
|
1152
|
-
class FormErrorComponent {
|
|
1153
|
-
constructor(parent) {
|
|
1154
|
-
this.parent = parent;
|
|
1155
|
-
this.showError = false;
|
|
1156
|
-
}
|
|
1157
|
-
ngOnInit() {
|
|
1158
|
-
// this is being run next cycle, because we dont want to fail if the order of components is as follows:
|
|
1159
|
-
// <app-form-error />
|
|
1160
|
-
// <some-input />
|
|
1161
|
-
// That would fail, because the logic of the form error is run first, and at that moment, the `some-input` isnt registered yet
|
|
1162
|
-
setTimeout(() => {
|
|
1163
|
-
const attachedControl = this.parent.getAttachedControl();
|
|
1164
|
-
this.parent.registerErrorHandler(this.error, this.contentRef);
|
|
1165
|
-
if (isNullOrUndefined(attachedControl)) {
|
|
1166
|
-
throw new Error('You added a Form Error component without an attached Form Control');
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
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 });
|
|
1172
|
-
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"] });
|
|
1173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormErrorComponent, decorators: [{
|
|
1174
|
-
type: Component,
|
|
1175
|
-
args: [{ selector: 'klp-form-error', template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
1176
|
-
}], ctorParameters: function () {
|
|
1177
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
1178
|
-
type: Host
|
|
1179
|
-
}, {
|
|
1180
|
-
type: Optional
|
|
1181
|
-
}] }];
|
|
1182
|
-
}, propDecorators: { error: [{
|
|
1183
|
-
type: Input
|
|
1184
|
-
}], contentRef: [{
|
|
1185
|
-
type: ViewChild,
|
|
1186
|
-
args: ['contentRef']
|
|
1187
|
-
}] } });
|
|
1188
|
-
|
|
1189
|
-
class FormSubmitButtonComponent {
|
|
1190
|
-
constructor(parentForm) {
|
|
1191
|
-
this.parentForm = parentForm;
|
|
1192
|
-
this.isLoading = false;
|
|
1193
|
-
this.fullWidth = false;
|
|
1194
|
-
this.variant = 'greenFilled';
|
|
1195
|
-
this.before = () => Promise.resolve();
|
|
1196
|
-
this.after = () => Promise.resolve();
|
|
1197
|
-
}
|
|
1198
|
-
get _() {
|
|
1199
|
-
return this.fullWidth;
|
|
1200
|
-
}
|
|
1201
|
-
submitForm() {
|
|
1202
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1203
|
-
try {
|
|
1204
|
-
yield this.before();
|
|
1205
|
-
}
|
|
1206
|
-
catch (e) {
|
|
1207
|
-
return;
|
|
1208
|
-
}
|
|
1209
|
-
this.parentForm
|
|
1210
|
-
.trySubmit()
|
|
1211
|
-
.then(([renderedAndEnabledValues, renderedValues]) => {
|
|
1212
|
-
this.isLoading = true;
|
|
1213
|
-
const submitCallbackResult = this.submitCallback(renderedAndEnabledValues, renderedValues);
|
|
1214
|
-
if (isNullOrUndefined(submitCallbackResult)) {
|
|
1215
|
-
throw new Error('No promise is returned in your submit function.');
|
|
1216
|
-
}
|
|
1217
|
-
return submitCallbackResult.then(() => (this.isLoading = false)).catch((e) => {
|
|
1218
|
-
this.isLoading = false;
|
|
1219
|
-
throw e;
|
|
1220
|
-
});
|
|
1221
|
-
})
|
|
1222
|
-
.catch((e) => {
|
|
1223
|
-
if (e === invalidFieldsSymbol) {
|
|
1224
|
-
return; // swallow the error, the framework will scroll to the field that needs attention
|
|
1225
|
-
}
|
|
1226
|
-
throw e;
|
|
1227
|
-
});
|
|
1228
|
-
yield this.after();
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
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 });
|
|
1233
|
-
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", before: "before", after: "after", 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"] }] });
|
|
1234
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormSubmitButtonComponent, decorators: [{
|
|
1235
|
-
type: Component,
|
|
1236
|
-
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"] }]
|
|
1237
|
-
}], ctorParameters: function () {
|
|
1238
|
-
return [{ type: FormComponent, decorators: [{
|
|
1239
|
-
type: Host
|
|
1240
|
-
}, {
|
|
1241
|
-
type: Optional
|
|
1242
|
-
}] }];
|
|
1243
|
-
}, propDecorators: { isLoading: [{
|
|
1244
|
-
type: Input
|
|
1245
|
-
}], fullWidth: [{
|
|
1246
|
-
type: Input
|
|
1247
|
-
}], variant: [{
|
|
1248
|
-
type: Input
|
|
1249
|
-
}], before: [{
|
|
1250
|
-
type: Input
|
|
1251
|
-
}], after: [{
|
|
1252
|
-
type: Input
|
|
1253
|
-
}], submitCallback: [{
|
|
1254
|
-
type: Input
|
|
1255
|
-
}], _: [{
|
|
1256
|
-
type: HostBinding,
|
|
1257
|
-
args: ['class._fullWidth']
|
|
1258
|
-
}] } });
|
|
1259
|
-
|
|
1260
|
-
class MultipleValueAccessorBase extends ValueAccessorBase {
|
|
1261
|
-
constructor(parent, controlContainer) {
|
|
1262
|
-
super(parent, controlContainer);
|
|
1263
|
-
this.parent = parent;
|
|
1264
|
-
this.controlContainer = controlContainer;
|
|
1265
|
-
this.multiple = false;
|
|
1266
|
-
}
|
|
1267
|
-
writeValue(value) {
|
|
1268
|
-
// if the outside world passes a value in the wrong format, it should be corrected
|
|
1269
|
-
if (this.multiple && !Array.isArray(value)) {
|
|
1270
|
-
const correctedVal = [value].filter(isValueSet);
|
|
1271
|
-
super.writeValue(correctedVal);
|
|
1272
|
-
super.setInnerValueAndNotify(correctedVal);
|
|
1273
|
-
}
|
|
1274
|
-
else if (!this.multiple && Array.isArray(value)) {
|
|
1275
|
-
const correctedVal = value[0];
|
|
1276
|
-
super.writeValue(correctedVal);
|
|
1277
|
-
super.setInnerValueAndNotify(correctedVal);
|
|
1278
|
-
}
|
|
1279
|
-
else {
|
|
1280
|
-
super.writeValue(value);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
setInnerValueAndNotify(value) {
|
|
1284
|
-
if (this.multiple && !Array.isArray(value)) {
|
|
1285
|
-
super.setInnerValueAndNotify([value].filter(isValueSet));
|
|
1286
|
-
}
|
|
1287
|
-
else if (!this.multiple && Array.isArray(value)) {
|
|
1288
|
-
super.setInnerValueAndNotify(value[0]);
|
|
1289
|
-
}
|
|
1290
|
-
else {
|
|
1291
|
-
super.setInnerValueAndNotify(value);
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
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 });
|
|
1296
|
-
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 });
|
|
1297
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MultipleValueAccessorBase, decorators: [{
|
|
1298
|
-
type: Component,
|
|
1299
|
-
args: [{
|
|
1300
|
-
selector: '',
|
|
1301
|
-
template: '',
|
|
1302
|
-
}]
|
|
1303
|
-
}], ctorParameters: function () {
|
|
1304
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
1305
|
-
type: Host
|
|
1306
|
-
}, {
|
|
1307
|
-
type: Optional
|
|
1308
|
-
}] }, { type: i2.ControlContainer, decorators: [{
|
|
1309
|
-
type: Host
|
|
1310
|
-
}, {
|
|
1311
|
-
type: Optional
|
|
1312
|
-
}] }];
|
|
1313
|
-
}, propDecorators: { multiple: [{
|
|
1314
|
-
type: Input
|
|
1315
|
-
}] } });
|
|
1316
|
-
|
|
1317
|
-
const invalidDateKey = '--invalid_date--';
|
|
1318
|
-
function dateValidator(control) {
|
|
1319
|
-
const invalid = control.value === invalidDateKey;
|
|
1320
|
-
return invalid ? { date: control.value } : null;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
const KLP_DATE_FORMATS = new InjectionToken('klp.form.date.formats');
|
|
1324
|
-
const DATE_TIME_PICKER_TRANSLATIONS = new InjectionToken('klp.form.dateTime.translations');
|
|
1325
|
-
const DATE_PICKER_LOCALE = new InjectionToken('klp.form.dateTime.locale');
|
|
1326
|
-
function matDateFormatsFactory(component, dateFormats) {
|
|
1327
|
-
var _a;
|
|
1328
|
-
return (_a = dateFormats === null || dateFormats === void 0 ? void 0 : dateFormats(component.format)) !== null && _a !== void 0 ? _a : MAT_NATIVE_DATE_FORMATS;
|
|
1329
|
-
}
|
|
1330
|
-
class DateTimePickerComponent extends MultipleValueAccessorBase {
|
|
1331
|
-
constructor(parent, controlContainer, translations, datePickerLocale, dateAdapter, cdr) {
|
|
1332
|
-
super(parent, controlContainer);
|
|
1333
|
-
this.parent = parent;
|
|
1334
|
-
this.controlContainer = controlContainer;
|
|
1335
|
-
this.translations = translations;
|
|
1336
|
-
this.datePickerLocale = datePickerLocale;
|
|
1337
|
-
this.dateAdapter = dateAdapter;
|
|
1338
|
-
this.cdr = cdr;
|
|
1339
|
-
this.minDate = undefined;
|
|
1340
|
-
this.maxDate = undefined;
|
|
1341
|
-
this.sameMonthOnly = false;
|
|
1342
|
-
this.format = 'dd-MM-yyyy';
|
|
1343
|
-
this.clearable = false;
|
|
1344
|
-
this.showTimeInput = true;
|
|
1345
|
-
this.invalidTimeAsMidnight = false; // if the time is not valid, use 00:00 as the time
|
|
1346
|
-
this.openPickerOnDate = null;
|
|
1347
|
-
this.minDateStartOfDay = undefined;
|
|
1348
|
-
this.maxDateEndOfDay = undefined;
|
|
1349
|
-
this.selectedDates = [];
|
|
1350
|
-
this.dateTouched = false;
|
|
1351
|
-
this.hoursTouched = false;
|
|
1352
|
-
this.minutesTouched = false;
|
|
1353
|
-
this.isSelected = (d) => {
|
|
1354
|
-
if (this.multiple) {
|
|
1355
|
-
return this.selectedDates.some((e) => isSameDay(e, d)) ? 'selected' : '';
|
|
1356
|
-
}
|
|
1357
|
-
return '';
|
|
1358
|
-
};
|
|
1359
|
-
this.filterDates = (e) => {
|
|
1360
|
-
if (this.disabled) {
|
|
1361
|
-
return false;
|
|
1362
|
-
}
|
|
1363
|
-
return true;
|
|
1364
|
-
};
|
|
1365
|
-
if (isValueSet(datePickerLocale)) {
|
|
1366
|
-
dateAdapter.setLocale(datePickerLocale());
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
ngOnInit() {
|
|
1370
|
-
super.ngOnInit();
|
|
1371
|
-
if (this.multiple) {
|
|
1372
|
-
this.placeholder = '';
|
|
1373
|
-
this.showTimeInput = false;
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
ngAfterViewInit() {
|
|
1377
|
-
if (this.multiple) {
|
|
1378
|
-
// we are going to overwrite the datepicker closing fn later, so we are saving it here to restore it when needed
|
|
1379
|
-
this.datePickingClosingFn = this.datePickerRef.close;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
ngOnChanges(changes) {
|
|
1383
|
-
if (changes.minDate) {
|
|
1384
|
-
this.determineMinAndMaxDates();
|
|
1385
|
-
}
|
|
1386
|
-
if (changes.maxDate) {
|
|
1387
|
-
this.determineMinAndMaxDates();
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
setMinDate(minDate) {
|
|
1391
|
-
if (minDate) {
|
|
1392
|
-
this.minDateStartOfDay = new Date(minDate);
|
|
1393
|
-
this.minDateStartOfDay.setHours(0, 0, 0, 0);
|
|
1394
|
-
}
|
|
1395
|
-
else {
|
|
1396
|
-
this.minDateStartOfDay = undefined;
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
setMaxDate(maxDate) {
|
|
1400
|
-
if (maxDate) {
|
|
1401
|
-
this.maxDateEndOfDay = new Date(maxDate);
|
|
1402
|
-
this.maxDateEndOfDay.setHours(23, 59, 59, 999);
|
|
1403
|
-
}
|
|
1404
|
-
else {
|
|
1405
|
-
this.maxDateEndOfDay = undefined;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
getSelectedMonths() {
|
|
1409
|
-
return removeDuplicatesFromArray(this.selectedDates.map((e) => format(e, 'MMMM'))).length;
|
|
1410
|
-
}
|
|
1411
|
-
// dateChanged is called when the output of the datepicker is changed and
|
|
1412
|
-
// parsed correctly. If the date is invalid, it will be called the first time
|
|
1413
|
-
// with null but never again until a valid input is provided.
|
|
1414
|
-
dateChanged(event) {
|
|
1415
|
-
const date = event.value;
|
|
1416
|
-
if (this.multiple) {
|
|
1417
|
-
this.datePickerRef.close = () => {
|
|
1418
|
-
};
|
|
1419
|
-
if (this.selectedDates.some((e) => isSameDay(e, date))) {
|
|
1420
|
-
this.selectedDates = this.selectedDates.filter((e) => !isSameDay(e, date));
|
|
1421
|
-
}
|
|
1422
|
-
else {
|
|
1423
|
-
this.selectedDates = [...this.selectedDates, date];
|
|
1424
|
-
}
|
|
1425
|
-
// START HACK
|
|
1426
|
-
// the date picker does not provide any rerender calls. Therefore, we are going to change the minDate in order to force the render
|
|
1427
|
-
// This is needed to show all selected days in our date picker
|
|
1428
|
-
// We also set the innerValue to null (with this.valueForMaterialDatePicker = null;), otherwise you can not
|
|
1429
|
-
// deselect your last picked date
|
|
1430
|
-
this.cdr.detectChanges();
|
|
1431
|
-
this.valueForMaterialDatePicker = null;
|
|
1432
|
-
const oldMinDate = this.minDateStartOfDay;
|
|
1433
|
-
this.minDateStartOfDay = new Date(0);
|
|
1434
|
-
this.cdr.detectChanges();
|
|
1435
|
-
this.minDateStartOfDay = oldMinDate;
|
|
1436
|
-
// END HACK
|
|
1437
|
-
if (this.sameMonthOnly) {
|
|
1438
|
-
if (this.selectedDates.length >= 2) {
|
|
1439
|
-
if (date < startOfMonth(this.selectedDates[0]) || date > endOfMonth(this.selectedDates[0])) {
|
|
1440
|
-
this.selectedDates = [date];
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
this.determineMinAndMaxDates();
|
|
1444
|
-
}
|
|
1445
|
-
this.setInnerValueAndNotify(this.selectedDates);
|
|
1446
|
-
setTimeout(() => {
|
|
1447
|
-
this.datePickerRef.close = this.datePickingClosingFn;
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
else {
|
|
1451
|
-
this.notifyNewDate();
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
determineMinAndMaxDates() {
|
|
1455
|
-
if (this.sameMonthOnly) {
|
|
1456
|
-
if (this.selectedDates.length >= 2) {
|
|
1457
|
-
this.setMinDate(startOfMonth(this.selectedDates[0]));
|
|
1458
|
-
this.setMaxDate(endOfMonth(this.selectedDates[0]));
|
|
1459
|
-
}
|
|
1460
|
-
else {
|
|
1461
|
-
this.setMinDate(this.minDate);
|
|
1462
|
-
this.setMaxDate(this.maxDate);
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
else {
|
|
1466
|
-
this.setMinDate(this.minDate);
|
|
1467
|
-
this.setMaxDate(this.maxDate);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
notifyNewDate() {
|
|
1471
|
-
const nativeInputValue = this.nativeInputRef.nativeElement.value;
|
|
1472
|
-
const parsedHours = Number(this.hours);
|
|
1473
|
-
const parsedMinutes = Number(this.minutes);
|
|
1474
|
-
// if we dont have the time element
|
|
1475
|
-
if (!this.showTimeInput) {
|
|
1476
|
-
if (!stringIsSetAndFilled(nativeInputValue)) {
|
|
1477
|
-
this.setInnerValueAndNotify(null);
|
|
1478
|
-
return;
|
|
1479
|
-
}
|
|
1480
|
-
if (this.valueForMaterialDatePicker instanceof Date) {
|
|
1481
|
-
this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
|
|
1482
|
-
return;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
// when all inputs are empty
|
|
1486
|
-
if (!stringIsSetAndFilled(nativeInputValue) && !stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
|
|
1487
|
-
this.setInnerValueAndNotify(null);
|
|
1488
|
-
return;
|
|
1489
|
-
}
|
|
1490
|
-
// if we have date and time
|
|
1491
|
-
if (stringIsSetAndFilled(this.hours) &&
|
|
1492
|
-
Number.isFinite(parsedHours) &&
|
|
1493
|
-
parsedHours >= 0 &&
|
|
1494
|
-
parsedHours <= 23 &&
|
|
1495
|
-
stringIsSetAndFilled(this.minutes) &&
|
|
1496
|
-
Number.isFinite(parsedMinutes) &&
|
|
1497
|
-
parsedMinutes >= 0 &&
|
|
1498
|
-
parsedMinutes <= 59 &&
|
|
1499
|
-
this.valueForMaterialDatePicker instanceof Date) {
|
|
1500
|
-
const newDateWithHours = new Date(this.valueForMaterialDatePicker.setHours(parsedHours));
|
|
1501
|
-
const newDateWithMinutes = new Date(newDateWithHours.setMinutes(parsedMinutes));
|
|
1502
|
-
this.setInnerValueAndNotify(newDateWithMinutes);
|
|
1503
|
-
return;
|
|
1504
|
-
}
|
|
1505
|
-
if (this.invalidTimeAsMidnight) {
|
|
1506
|
-
if (this.valueForMaterialDatePicker instanceof Date) {
|
|
1507
|
-
this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
|
|
1508
|
-
return;
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
// all other cases, we are not in a valid state
|
|
1512
|
-
this.setInnerValueAndNotify(invalidDateKey);
|
|
1513
|
-
}
|
|
1514
|
-
writeValue(value) {
|
|
1515
|
-
super.writeValue(value);
|
|
1516
|
-
if (Array.isArray(value)) {
|
|
1517
|
-
this.selectedDates = value;
|
|
1518
|
-
this.determineMinAndMaxDates();
|
|
1519
|
-
this.valueForMaterialDatePicker = null;
|
|
1520
|
-
if (arrayIsSetAndFilled(value)) {
|
|
1521
|
-
this.openPickerOnDate = this.selectedDates[0];
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
else {
|
|
1525
|
-
this.valueForMaterialDatePicker = value === invalidDateKey ? null : value;
|
|
1526
|
-
if (value instanceof Date) {
|
|
1527
|
-
this.hours = String(value.getHours());
|
|
1528
|
-
this.minutes = String(value.getMinutes());
|
|
1529
|
-
this.formatTime();
|
|
1530
|
-
this.openPickerOnDate = value;
|
|
1531
|
-
}
|
|
1532
|
-
else {
|
|
1533
|
-
this.hours = '';
|
|
1534
|
-
this.minutes = '';
|
|
1535
|
-
this.openPickerOnDate = null;
|
|
1536
|
-
this.selectedDates = [];
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
// nativeValueChanged is called when the internal text value changes, but not
|
|
1541
|
-
// when the date is changed via the date picker. We need this so that we can
|
|
1542
|
-
// determine if the datepicker is empty or invalid.
|
|
1543
|
-
nativeValueChanged() {
|
|
1544
|
-
if (this.datePickerRef.opened) {
|
|
1545
|
-
// if the user is typing instead of using the picker, close it.
|
|
1546
|
-
this.datePickerRef.close();
|
|
1547
|
-
}
|
|
1548
|
-
this.notifyNewDate();
|
|
1549
|
-
}
|
|
1550
|
-
resetToNull() {
|
|
1551
|
-
this.setInnerValueAndNotify(null);
|
|
1552
|
-
this.valueForMaterialDatePicker = null;
|
|
1553
|
-
this.nativeInputRef.nativeElement.value = null;
|
|
1554
|
-
this.hours = '';
|
|
1555
|
-
this.minutes = '';
|
|
1556
|
-
this.selectedDates = [];
|
|
1557
|
-
}
|
|
1558
|
-
formatTime() {
|
|
1559
|
-
if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
|
|
1560
|
-
this.hours = '0' + this.hours;
|
|
1561
|
-
}
|
|
1562
|
-
if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
|
|
1563
|
-
this.minutes = '0' + this.minutes;
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
touchDate() {
|
|
1567
|
-
this.dateTouched = true;
|
|
1568
|
-
this.determineAllTouched();
|
|
1569
|
-
}
|
|
1570
|
-
touchHours() {
|
|
1571
|
-
this.hoursTouched = true;
|
|
1572
|
-
this.determineAllTouched();
|
|
1573
|
-
}
|
|
1574
|
-
touchMinutes() {
|
|
1575
|
-
this.minutesTouched = true;
|
|
1576
|
-
this.determineAllTouched();
|
|
1577
|
-
}
|
|
1578
|
-
determineAllTouched() {
|
|
1579
|
-
if ((this.dateTouched && this.hoursTouched && this.minutesTouched) || (this.dateTouched && !this.showTimeInput)) {
|
|
1580
|
-
this.touch();
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
getDefaultTranslation(key) {
|
|
1584
|
-
switch (key) {
|
|
1585
|
-
case 'placeholder':
|
|
1586
|
-
return () => 'Select date';
|
|
1587
|
-
case 'selectDays':
|
|
1588
|
-
return () => 'Select day(s)';
|
|
1589
|
-
case 'selectedDate':
|
|
1590
|
-
return (d) => d.toLocaleDateString();
|
|
1591
|
-
case 'daysSelected':
|
|
1592
|
-
return (amount) => `${amount} days selected`;
|
|
1593
|
-
case 'selectedInMonth':
|
|
1594
|
-
return (d) => ` in ${format(d, 'MMMM')}`;
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
getTranslation(key, params = null) {
|
|
1598
|
-
var _a, _b, _c;
|
|
1599
|
-
if (key === 'placeholder' && this.multiple) {
|
|
1600
|
-
return '';
|
|
1601
|
-
}
|
|
1602
|
-
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
1603
|
-
return this.placeholder;
|
|
1604
|
-
}
|
|
1605
|
-
return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
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 });
|
|
1609
|
-
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: [
|
|
1610
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1611
|
-
{
|
|
1612
|
-
provide: MAT_DATE_FORMATS,
|
|
1613
|
-
deps: [DateTimePickerComponent, [new Optional(), KLP_DATE_FORMATS]],
|
|
1614
|
-
useFactory: matDateFormatsFactory,
|
|
1615
|
-
},
|
|
1616
|
-
], 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"] }] });
|
|
1617
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DateTimePickerComponent, decorators: [{
|
|
1618
|
-
type: Component,
|
|
1619
|
-
args: [{ selector: 'klp-form-date-time-picker', providers: [
|
|
1620
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1621
|
-
{
|
|
1622
|
-
provide: MAT_DATE_FORMATS,
|
|
1623
|
-
deps: [DateTimePickerComponent, [new Optional(), KLP_DATE_FORMATS]],
|
|
1624
|
-
useFactory: matDateFormatsFactory,
|
|
1625
|
-
},
|
|
1626
|
-
], 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"] }]
|
|
1627
|
-
}], ctorParameters: function () {
|
|
1628
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
1629
|
-
type: Host
|
|
1630
|
-
}, {
|
|
1631
|
-
type: Optional
|
|
1632
|
-
}] }, { type: i2.ControlContainer, decorators: [{
|
|
1633
|
-
type: Host
|
|
1634
|
-
}, {
|
|
1635
|
-
type: Optional
|
|
1636
|
-
}] }, { type: undefined, decorators: [{
|
|
1637
|
-
type: Inject,
|
|
1638
|
-
args: [DATE_TIME_PICKER_TRANSLATIONS]
|
|
1639
|
-
}, {
|
|
1640
|
-
type: Optional
|
|
1641
|
-
}] }, { type: undefined, decorators: [{
|
|
1642
|
-
type: Inject,
|
|
1643
|
-
args: [DATE_PICKER_LOCALE]
|
|
1644
|
-
}, {
|
|
1645
|
-
type: Optional
|
|
1646
|
-
}] }, { type: i3.DateAdapter }, { type: i0.ChangeDetectorRef }];
|
|
1647
|
-
}, propDecorators: { minDate: [{
|
|
1648
|
-
type: Input
|
|
1649
|
-
}], maxDate: [{
|
|
1650
|
-
type: Input
|
|
1651
|
-
}], sameMonthOnly: [{
|
|
1652
|
-
type: Input
|
|
1653
|
-
}], format: [{
|
|
1654
|
-
type: Input
|
|
1655
|
-
}], placeholder: [{
|
|
1656
|
-
type: Input
|
|
1657
|
-
}], clearable: [{
|
|
1658
|
-
type: Input
|
|
1659
|
-
}], showTimeInput: [{
|
|
1660
|
-
type: Input
|
|
1661
|
-
}], invalidTimeAsMidnight: [{
|
|
1662
|
-
type: Input
|
|
1663
|
-
}], nativeInputRef: [{
|
|
1664
|
-
type: ViewChild,
|
|
1665
|
-
args: ['nativeInput']
|
|
1666
|
-
}], datePickerRef: [{
|
|
1667
|
-
type: ViewChild,
|
|
1668
|
-
args: ['picker']
|
|
1669
|
-
}] } });
|
|
1670
|
-
|
|
1671
|
-
const DATE_PICKER_TRANSLATIONS = new InjectionToken('klp.form.date.translations');
|
|
1672
|
-
class DatePickerComponent extends MultipleValueAccessorBase {
|
|
1673
|
-
constructor(parent, controlContainer, translations) {
|
|
1674
|
-
super(parent, controlContainer);
|
|
1675
|
-
this.parent = parent;
|
|
1676
|
-
this.controlContainer = controlContainer;
|
|
1677
|
-
this.translations = translations;
|
|
1678
|
-
this.minDate = undefined;
|
|
1679
|
-
this.maxDate = undefined;
|
|
1680
|
-
this.sameMonthOnly = false;
|
|
1681
|
-
this.format = 'dd-MM-yyyy';
|
|
1682
|
-
this.clearable = false;
|
|
1683
|
-
}
|
|
1684
|
-
writeValue(value) {
|
|
1685
|
-
if (value === invalidDateKey) {
|
|
1686
|
-
super.writeValue(invalidDateKey);
|
|
1687
|
-
}
|
|
1688
|
-
else if (isNullOrUndefined(value)) {
|
|
1689
|
-
this.dateValue = this.multiple ? [] : null;
|
|
1690
|
-
super.writeValue(this.multiple ? [] : null);
|
|
1691
|
-
}
|
|
1692
|
-
else {
|
|
1693
|
-
if (Array.isArray(value)) {
|
|
1694
|
-
this.dateValue = value.map((e) => parse(e, 'yyyy-MM-dd', new Date()));
|
|
1695
|
-
}
|
|
1696
|
-
else {
|
|
1697
|
-
this.dateValue = parse(value, 'yyyy-MM-dd', new Date());
|
|
1698
|
-
}
|
|
1699
|
-
super.writeValue(value);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
dateChanged(value) {
|
|
1703
|
-
if (value === invalidDateKey) {
|
|
1704
|
-
this.setInnerValueAndNotify(invalidDateKey);
|
|
1705
|
-
}
|
|
1706
|
-
else if (isNullOrUndefined(value)) {
|
|
1707
|
-
this.dateValue = this.multiple ? [] : null;
|
|
1708
|
-
this.setInnerValueAndNotify(this.multiple ? [] : null);
|
|
1709
|
-
}
|
|
1710
|
-
else {
|
|
1711
|
-
this.dateValue = value;
|
|
1712
|
-
if (Array.isArray(value)) {
|
|
1713
|
-
this.setInnerValueAndNotify(value.map((e) => format(e, 'yyyy-MM-dd')));
|
|
1714
|
-
}
|
|
1715
|
-
else {
|
|
1716
|
-
this.setInnerValueAndNotify(format(value, 'yyyy-MM-dd'));
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
getDefaultTranslation(key) {
|
|
1721
|
-
switch (key) {
|
|
1722
|
-
case 'placeholder':
|
|
1723
|
-
return () => 'Select date';
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
getTranslation(key, params = null) {
|
|
1727
|
-
var _a, _b, _c;
|
|
1728
|
-
if (key === 'placeholder' && this.multiple) {
|
|
1729
|
-
return '';
|
|
1730
|
-
}
|
|
1731
|
-
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
1732
|
-
return this.placeholder;
|
|
1733
|
-
}
|
|
1734
|
-
return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
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 });
|
|
1738
|
-
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"] }] });
|
|
1739
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
1740
|
-
type: Component,
|
|
1741
|
-
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"] }]
|
|
1742
|
-
}], ctorParameters: function () {
|
|
1743
|
-
return [{ type: FormElementComponent, decorators: [{
|
|
1744
|
-
type: Host
|
|
1745
|
-
}, {
|
|
1746
|
-
type: Optional
|
|
1747
|
-
}] }, { type: i2.ControlContainer, decorators: [{
|
|
1748
|
-
type: Host
|
|
1749
|
-
}, {
|
|
1750
|
-
type: Optional
|
|
1751
|
-
}] }, { type: undefined, decorators: [{
|
|
1752
|
-
type: Inject,
|
|
1753
|
-
args: [DATE_PICKER_TRANSLATIONS]
|
|
1754
|
-
}, {
|
|
1755
|
-
type: Optional
|
|
1756
|
-
}] }];
|
|
1757
|
-
}, propDecorators: { minDate: [{
|
|
1758
|
-
type: Input
|
|
1759
|
-
}], maxDate: [{
|
|
1760
|
-
type: Input
|
|
1761
|
-
}], sameMonthOnly: [{
|
|
1762
|
-
type: Input
|
|
1763
|
-
}], format: [{
|
|
1764
|
-
type: Input
|
|
1765
|
-
}], placeholder: [{
|
|
1766
|
-
type: Input
|
|
1767
|
-
}], clearable: [{
|
|
1768
|
-
type: Input
|
|
1769
|
-
}] } });
|
|
1770
|
-
|
|
1771
|
-
// material.module.ts
|
|
1772
|
-
class MaterialModule {
|
|
1773
|
-
}
|
|
1774
|
-
MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1775
|
-
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] });
|
|
1776
|
-
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] });
|
|
1777
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MaterialModule, decorators: [{
|
|
1778
|
-
type: NgModule,
|
|
1779
|
-
args: [{
|
|
1780
|
-
imports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule],
|
|
1781
|
-
exports: [MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatButtonModule],
|
|
1782
|
-
providers: [MatDatepickerModule],
|
|
1783
|
-
}]
|
|
1784
|
-
}] });
|
|
1785
|
-
|
|
1786
|
-
class FileInputComponent extends MultipleValueAccessorBase {
|
|
1787
|
-
constructor() {
|
|
1788
|
-
super(...arguments);
|
|
1789
|
-
this.isLoading = false;
|
|
1790
|
-
this.clearable = false;
|
|
1791
|
-
this.onlyShowUploadButton = false;
|
|
1792
|
-
this.useFullParentSize = false;
|
|
1793
|
-
}
|
|
1794
|
-
onChange(files) {
|
|
1795
|
-
const result = [];
|
|
1796
|
-
for (let i = 0; i < files.length; i++) {
|
|
1797
|
-
result.push(files.item(i));
|
|
1798
|
-
}
|
|
1799
|
-
this.setInnerValueAndNotify(result);
|
|
1800
|
-
// to make sure we can select the same file again
|
|
1801
|
-
this.nativeInputRef.nativeElement.value = null;
|
|
1802
|
-
}
|
|
1803
|
-
getFileNames() {
|
|
1804
|
-
if (Array.isArray(this.innerValue)) {
|
|
1805
|
-
return this.innerValue.map(e => e.name).join(', ');
|
|
1806
|
-
}
|
|
1807
|
-
else if (this.innerValue instanceof File) {
|
|
1808
|
-
return this.innerValue.name;
|
|
1809
|
-
}
|
|
1810
|
-
return null;
|
|
1811
|
-
}
|
|
1812
|
-
shouldShowClearButton() {
|
|
1813
|
-
if (this.onlyShowUploadButton) {
|
|
1814
|
-
return false;
|
|
1815
|
-
}
|
|
1816
|
-
if (this.multiple) {
|
|
1817
|
-
if (arrayIsSetAndFilled(this.innerValue)) {
|
|
1818
|
-
return true;
|
|
1819
|
-
}
|
|
1820
|
-
return false;
|
|
1821
|
-
}
|
|
1822
|
-
if (isValueSet(this.innerValue)) {
|
|
1823
|
-
return true;
|
|
1824
|
-
}
|
|
1825
|
-
return false;
|
|
1826
|
-
}
|
|
1827
|
-
uploadFileClicked() {
|
|
1828
|
-
this.nativeInputRef.nativeElement.click();
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
FileInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FileInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1832
|
-
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: "nativeInputRef", first: true, predicate: ["nativeInputRef"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#nativeInputRef\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\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\tUpload a file\n\t\t</klp-form-button>\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"] }] });
|
|
1833
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FileInputComponent, decorators: [{
|
|
1834
|
-
type: Component,
|
|
1835
|
-
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<input\n\t\t\ttype=\"file\"\n\t\t\t#nativeInputRef\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\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\tUpload a file\n\t\t</klp-form-button>\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"] }]
|
|
1836
|
-
}], propDecorators: { isLoading: [{
|
|
1837
|
-
type: Input
|
|
1838
|
-
}], clearable: [{
|
|
1839
|
-
type: Input
|
|
1840
|
-
}], onlyShowUploadButton: [{
|
|
1841
|
-
type: Input
|
|
1842
|
-
}], useFullParentSize: [{
|
|
1843
|
-
type: Input
|
|
1844
|
-
}], nativeInputRef: [{
|
|
1845
|
-
type: ViewChild,
|
|
1846
|
-
args: ['nativeInputRef']
|
|
1847
|
-
}] } });
|
|
1848
|
-
|
|
1849
|
-
class SortableGroupedItemsComponent extends ValueAccessorBase {
|
|
1850
|
-
constructor() {
|
|
1851
|
-
super(...arguments);
|
|
1852
|
-
this.reloader = true; // sortable items doesnt correctly update, so we have this boolean that flips to rerender the sortable items comp
|
|
1853
|
-
}
|
|
1854
|
-
writeValue(value) {
|
|
1855
|
-
super.writeValue(value);
|
|
1856
|
-
this.reloader = false;
|
|
1857
|
-
setTimeout(() => {
|
|
1858
|
-
if (arrayIsSetAndFilled(value)) {
|
|
1859
|
-
this.items = value.flatMap(e => [...e, '']);
|
|
1860
|
-
}
|
|
1861
|
-
else {
|
|
1862
|
-
this.items = [];
|
|
1863
|
-
}
|
|
1864
|
-
this.reloader = true;
|
|
1865
|
-
});
|
|
1866
|
-
}
|
|
1867
|
-
onItemsRearranged(value) {
|
|
1868
|
-
const result = splitArrayByCondition(value, e => e === '').filter(arrayIsSetAndFilled);
|
|
1869
|
-
this.setInnerValueAndNotify(result);
|
|
1870
|
-
this.reloader = false;
|
|
1871
|
-
setTimeout(() => {
|
|
1872
|
-
this.items = [...this.items, ''].filter((e, i) => {
|
|
1873
|
-
if (i === 0 && e === '') {
|
|
1874
|
-
return false;
|
|
1875
|
-
}
|
|
1876
|
-
if (e === '' && this.items[i - 1] === '') {
|
|
1877
|
-
return false;
|
|
1878
|
-
}
|
|
1879
|
-
return true;
|
|
1880
|
-
});
|
|
1881
|
-
this.reloader = true;
|
|
1882
|
-
});
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
SortableGroupedItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableGroupedItemsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1886
|
-
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"] }] });
|
|
1887
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: SortableGroupedItemsComponent, decorators: [{
|
|
1888
|
-
type: Component,
|
|
1889
|
-
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"] }]
|
|
1890
|
-
}] });
|
|
1891
|
-
|
|
1892
|
-
const invalidTimeKey = '--invalid_time--';
|
|
1893
|
-
function timeValidator(control) {
|
|
1894
|
-
const invalid = control.value === invalidTimeKey;
|
|
1895
|
-
return invalid ? { date: control.value } : null;
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
class HourMinuteInputComponent extends ValueAccessorBase {
|
|
1899
|
-
constructor() {
|
|
1900
|
-
super(...arguments);
|
|
1901
|
-
this.placeholders = ['hour', 'min'];
|
|
1902
|
-
this.hoursTouched = false;
|
|
1903
|
-
this.minutesTouched = false;
|
|
1904
|
-
}
|
|
1905
|
-
formatHours() {
|
|
1906
|
-
if (!stringIsSetAndFilled(this.hours)) {
|
|
1907
|
-
this.hours = '0';
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
formatMinutes() {
|
|
1911
|
-
if (!stringIsSetAndFilled(this.minutes)) {
|
|
1912
|
-
this.minutes = '0';
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
formatTime() {
|
|
1916
|
-
if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
|
|
1917
|
-
this.hours = '0' + this.hours;
|
|
1918
|
-
}
|
|
1919
|
-
if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
|
|
1920
|
-
this.minutes = '0' + this.minutes;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
writeValue(value) {
|
|
1924
|
-
if (Number.isFinite(value)) {
|
|
1925
|
-
this.hours = Math.floor(value / 60) + '';
|
|
1926
|
-
this.minutes = value % 60 + '';
|
|
1927
|
-
this.formatTime();
|
|
1928
|
-
super.writeValue(value);
|
|
1929
|
-
}
|
|
1930
|
-
else {
|
|
1931
|
-
this.hours = '';
|
|
1932
|
-
this.minutes = '';
|
|
1933
|
-
super.writeValue(invalidTimeKey);
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
notifyNewTime() {
|
|
1937
|
-
const parsedHours = Number(this.hours);
|
|
1938
|
-
const parsedMinutes = Number(this.minutes);
|
|
1939
|
-
// when all inputs are empty
|
|
1940
|
-
if (!stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
|
|
1941
|
-
this.setInnerValueAndNotify(null);
|
|
1942
|
-
return;
|
|
1943
|
-
}
|
|
1944
|
-
// if we have valid time
|
|
1945
|
-
if (Number.isFinite(parsedHours) &&
|
|
1946
|
-
parsedHours >= 0 &&
|
|
1947
|
-
parsedHours <= 9999 &&
|
|
1948
|
-
Number.isFinite(parsedMinutes) &&
|
|
1949
|
-
parsedMinutes >= 0 &&
|
|
1950
|
-
parsedMinutes <= 59) {
|
|
1951
|
-
this.setInnerValueAndNotify(parsedHours * 60 + parsedMinutes);
|
|
1952
|
-
return;
|
|
1953
|
-
}
|
|
1954
|
-
// all other cases, we are not in a valid state
|
|
1955
|
-
this.setInnerValueAndNotify(invalidTimeKey);
|
|
1956
|
-
}
|
|
1957
|
-
touchHours() {
|
|
1958
|
-
this.hoursTouched = true;
|
|
1959
|
-
this.determineAllTouched();
|
|
1960
|
-
}
|
|
1961
|
-
touchMinutes() {
|
|
1962
|
-
this.minutesTouched = true;
|
|
1963
|
-
this.determineAllTouched();
|
|
1964
|
-
}
|
|
1965
|
-
determineAllTouched() {
|
|
1966
|
-
if (this.hoursTouched && this.minutesTouched) {
|
|
1967
|
-
this.touch();
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
HourMinuteInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: HourMinuteInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1972
|
-
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()\" #nativeInputRef>\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"] }] });
|
|
1973
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: HourMinuteInputComponent, decorators: [{
|
|
1974
|
-
type: Component,
|
|
1975
|
-
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()\" #nativeInputRef>\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"] }]
|
|
1976
|
-
}], propDecorators: { placeholders: [{
|
|
1977
|
-
type: Input
|
|
1978
|
-
}] } });
|
|
1979
|
-
|
|
1980
|
-
var Orientation;
|
|
1981
|
-
(function (Orientation) {
|
|
1982
|
-
Orientation["COLUMN"] = "column";
|
|
1983
|
-
Orientation["ROW"] = "row";
|
|
1984
|
-
})(Orientation || (Orientation = {}));
|
|
1985
|
-
class RadioComponent extends ValueAccessorBase {
|
|
1986
|
-
constructor() {
|
|
1987
|
-
super(...arguments);
|
|
1988
|
-
this.orientation = Orientation.ROW;
|
|
1989
|
-
this.variant = 'classic';
|
|
1990
|
-
this.Orientation = Orientation;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
RadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1994
|
-
RadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: RadioComponent, selector: "klp-form-radio", inputs: { options: "options", orientation: "orientation", variant: "variant" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: RadioComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{'verticallyOriented': orientation === Orientation.COLUMN, 'horizontallyOriented': orientation === Orientation.ROW}\">\n\t<ng-container *ngFor=\"let option of options\">\n\t\t<button class=\"optionContainer\"\n\t\t\t[ngClass]=\"{classic: variant === 'classic', button: variant === 'button', isSelected: innerValue === option.id}\"\n\t\t\t(click)=\"setInnerValueAndNotify(option.id)\"\n\t\t>\n\t\t\t<div class=\"selectedRadioBtnContainer\" *ngIf=\"variant === 'classic'\">\n\t\t\t\t<div class=\"selected\" *ngIf=\"innerValue === option.id\"></div>\n\t\t\t</div>\n\t\t\t<div>{{option.name}}</div>\n\t\t</button>\n\t</ng-container>\n</div>\n", styles: [":host{display:block}.componentContainer{position:relative;display:flex}.componentContainer.verticallyOriented{flex-direction:column}.componentContainer.verticallyOriented .optionContainer{margin-bottom:.3125rem}.componentContainer.verticallyOriented .optionContainer:last-child{margin-bottom:0}.componentContainer.horizontallyOriented{flex-direction:row}.componentContainer.horizontallyOriented .optionContainer:first-child{border-radius:6px 0 0 6px}.componentContainer.horizontallyOriented .optionContainer:last-child{border-radius:0 6px 6px 0}.optionContainer{display:flex;flex-direction:row;margin-right:.3125rem;background:transparent;border:none;align-items:center}.optionContainer.classic{cursor:pointer}.optionContainer.classic .selectedRadioBtnContainer{position:relative;height:20px;width:20px;padding:4px;border-radius:50%;border:2px solid #e6ecf5;margin-right:.3125rem}.optionContainer.classic .selectedRadioBtnContainer .selected{height:100%;width:100%;display:block;border-radius:100%;background-color:#27bb5f}.optionContainer.button{position:relative;cursor:pointer;padding:10px 14px;margin-right:0;transition:all .3s ease-in-out;color:#27bb5f;border:1px solid #27bb5f;background-color:#fff}.optionContainer.button.isSelected{background:#27bb5f;color:#fff}\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"] }] });
|
|
1995
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: RadioComponent, decorators: [{
|
|
1996
|
-
type: Component,
|
|
1997
|
-
args: [{ selector: 'klp-form-radio', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: RadioComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{'verticallyOriented': orientation === Orientation.COLUMN, 'horizontallyOriented': orientation === Orientation.ROW}\">\n\t<ng-container *ngFor=\"let option of options\">\n\t\t<button class=\"optionContainer\"\n\t\t\t[ngClass]=\"{classic: variant === 'classic', button: variant === 'button', isSelected: innerValue === option.id}\"\n\t\t\t(click)=\"setInnerValueAndNotify(option.id)\"\n\t\t>\n\t\t\t<div class=\"selectedRadioBtnContainer\" *ngIf=\"variant === 'classic'\">\n\t\t\t\t<div class=\"selected\" *ngIf=\"innerValue === option.id\"></div>\n\t\t\t</div>\n\t\t\t<div>{{option.name}}</div>\n\t\t</button>\n\t</ng-container>\n</div>\n", styles: [":host{display:block}.componentContainer{position:relative;display:flex}.componentContainer.verticallyOriented{flex-direction:column}.componentContainer.verticallyOriented .optionContainer{margin-bottom:.3125rem}.componentContainer.verticallyOriented .optionContainer:last-child{margin-bottom:0}.componentContainer.horizontallyOriented{flex-direction:row}.componentContainer.horizontallyOriented .optionContainer:first-child{border-radius:6px 0 0 6px}.componentContainer.horizontallyOriented .optionContainer:last-child{border-radius:0 6px 6px 0}.optionContainer{display:flex;flex-direction:row;margin-right:.3125rem;background:transparent;border:none;align-items:center}.optionContainer.classic{cursor:pointer}.optionContainer.classic .selectedRadioBtnContainer{position:relative;height:20px;width:20px;padding:4px;border-radius:50%;border:2px solid #e6ecf5;margin-right:.3125rem}.optionContainer.classic .selectedRadioBtnContainer .selected{height:100%;width:100%;display:block;border-radius:100%;background-color:#27bb5f}.optionContainer.button{position:relative;cursor:pointer;padding:10px 14px;margin-right:0;transition:all .3s ease-in-out;color:#27bb5f;border:1px solid #27bb5f;background-color:#fff}.optionContainer.button.isSelected{background:#27bb5f;color:#fff}\n"] }]
|
|
1998
|
-
}], propDecorators: { options: [{
|
|
1999
|
-
type: Input
|
|
2000
|
-
}], orientation: [{
|
|
2001
|
-
type: Input
|
|
2002
|
-
}], variant: [{
|
|
2003
|
-
type: Input
|
|
2004
|
-
}] } });
|
|
2005
|
-
|
|
2006
|
-
class NgxEnhancyFormsModule {
|
|
2007
|
-
}
|
|
2008
|
-
NgxEnhancyFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2009
|
-
NgxEnhancyFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, declarations: [ValueAccessorBase,
|
|
2010
|
-
MultipleValueAccessorBase,
|
|
2011
|
-
ButtonComponent,
|
|
2012
|
-
CheckboxComponent,
|
|
2013
|
-
DatePickerComponent,
|
|
2014
|
-
DateTimePickerComponent,
|
|
2015
|
-
EmailInputComponent,
|
|
2016
|
-
LoadingIndicatorComponent,
|
|
2017
|
-
NumberInputComponent,
|
|
2018
|
-
PasswordFieldComponent,
|
|
2019
|
-
SelectComponent,
|
|
2020
|
-
KlpSelectOptionTemplateDirective,
|
|
2021
|
-
SelectFooterComponent,
|
|
2022
|
-
SortableItemsComponent,
|
|
2023
|
-
SortableGroupedItemsComponent,
|
|
2024
|
-
TextInputComponent,
|
|
2025
|
-
ToggleComponent,
|
|
2026
|
-
FileInputComponent,
|
|
2027
|
-
FormCaptionComponent,
|
|
2028
|
-
FormElementComponent,
|
|
2029
|
-
FormErrorComponent,
|
|
2030
|
-
FormSubmitButtonComponent,
|
|
2031
|
-
FormComponent,
|
|
2032
|
-
SubFormDirective,
|
|
2033
|
-
HourMinuteInputComponent,
|
|
2034
|
-
RadioComponent], imports: [CommonModule,
|
|
2035
|
-
FormsModule,
|
|
2036
|
-
NgSelectModule,
|
|
2037
|
-
SortablejsModule,
|
|
2038
|
-
MaterialModule], exports: [ValueAccessorBase,
|
|
2039
|
-
MultipleValueAccessorBase,
|
|
2040
|
-
ButtonComponent,
|
|
2041
|
-
DatePickerComponent,
|
|
2042
|
-
DateTimePickerComponent,
|
|
2043
|
-
CheckboxComponent,
|
|
2044
|
-
EmailInputComponent,
|
|
2045
|
-
LoadingIndicatorComponent,
|
|
2046
|
-
NumberInputComponent,
|
|
2047
|
-
PasswordFieldComponent,
|
|
2048
|
-
SelectComponent,
|
|
2049
|
-
KlpSelectOptionTemplateDirective,
|
|
2050
|
-
SelectFooterComponent,
|
|
2051
|
-
SortableItemsComponent,
|
|
2052
|
-
SortableGroupedItemsComponent,
|
|
2053
|
-
TextInputComponent,
|
|
2054
|
-
ToggleComponent,
|
|
2055
|
-
FileInputComponent,
|
|
2056
|
-
FormCaptionComponent,
|
|
2057
|
-
FormElementComponent,
|
|
2058
|
-
FormErrorComponent,
|
|
2059
|
-
FormSubmitButtonComponent,
|
|
2060
|
-
FormComponent,
|
|
2061
|
-
SubFormDirective,
|
|
2062
|
-
HourMinuteInputComponent,
|
|
2063
|
-
RadioComponent] });
|
|
2064
|
-
NgxEnhancyFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, imports: [CommonModule,
|
|
2065
|
-
FormsModule,
|
|
2066
|
-
NgSelectModule,
|
|
2067
|
-
SortablejsModule,
|
|
2068
|
-
MaterialModule] });
|
|
2069
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, decorators: [{
|
|
2070
|
-
type: NgModule,
|
|
2071
|
-
args: [{
|
|
2072
|
-
imports: [
|
|
2073
|
-
CommonModule,
|
|
2074
|
-
FormsModule,
|
|
2075
|
-
NgSelectModule,
|
|
2076
|
-
SortablejsModule,
|
|
2077
|
-
MaterialModule,
|
|
2078
|
-
],
|
|
2079
|
-
declarations: [
|
|
2080
|
-
ValueAccessorBase,
|
|
2081
|
-
MultipleValueAccessorBase,
|
|
2082
|
-
ButtonComponent,
|
|
2083
|
-
CheckboxComponent,
|
|
2084
|
-
DatePickerComponent,
|
|
2085
|
-
DateTimePickerComponent,
|
|
2086
|
-
EmailInputComponent,
|
|
2087
|
-
LoadingIndicatorComponent,
|
|
2088
|
-
NumberInputComponent,
|
|
2089
|
-
PasswordFieldComponent,
|
|
2090
|
-
SelectComponent,
|
|
2091
|
-
KlpSelectOptionTemplateDirective,
|
|
2092
|
-
SelectFooterComponent,
|
|
2093
|
-
SortableItemsComponent,
|
|
2094
|
-
SortableGroupedItemsComponent,
|
|
2095
|
-
TextInputComponent,
|
|
2096
|
-
ToggleComponent,
|
|
2097
|
-
FileInputComponent,
|
|
2098
|
-
FormCaptionComponent,
|
|
2099
|
-
FormElementComponent,
|
|
2100
|
-
FormErrorComponent,
|
|
2101
|
-
FormSubmitButtonComponent,
|
|
2102
|
-
FormComponent,
|
|
2103
|
-
SubFormDirective,
|
|
2104
|
-
HourMinuteInputComponent,
|
|
2105
|
-
RadioComponent
|
|
2106
|
-
],
|
|
2107
|
-
exports: [
|
|
2108
|
-
ValueAccessorBase,
|
|
2109
|
-
MultipleValueAccessorBase,
|
|
2110
|
-
ButtonComponent,
|
|
2111
|
-
DatePickerComponent,
|
|
2112
|
-
DateTimePickerComponent,
|
|
2113
|
-
CheckboxComponent,
|
|
2114
|
-
EmailInputComponent,
|
|
2115
|
-
LoadingIndicatorComponent,
|
|
2116
|
-
NumberInputComponent,
|
|
2117
|
-
PasswordFieldComponent,
|
|
2118
|
-
SelectComponent,
|
|
2119
|
-
KlpSelectOptionTemplateDirective,
|
|
2120
|
-
SelectFooterComponent,
|
|
2121
|
-
SortableItemsComponent,
|
|
2122
|
-
SortableGroupedItemsComponent,
|
|
2123
|
-
TextInputComponent,
|
|
2124
|
-
ToggleComponent,
|
|
2125
|
-
FileInputComponent,
|
|
2126
|
-
FormCaptionComponent,
|
|
2127
|
-
FormElementComponent,
|
|
2128
|
-
FormErrorComponent,
|
|
2129
|
-
FormSubmitButtonComponent,
|
|
2130
|
-
FormComponent,
|
|
2131
|
-
SubFormDirective,
|
|
2132
|
-
HourMinuteInputComponent,
|
|
2133
|
-
RadioComponent
|
|
2134
|
-
]
|
|
2135
|
-
}]
|
|
2136
|
-
}] });
|
|
2137
|
-
|
|
2138
|
-
/*
|
|
2139
|
-
* Public API Surface of ngx-enhancy-forms
|
|
2140
|
-
*/
|
|
2141
|
-
|
|
2142
|
-
/**
|
|
2143
|
-
* Generated bundle index. Do not edit.
|
|
2144
|
-
*/
|
|
2145
|
-
|
|
2146
|
-
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, Orientation, PasswordFieldComponent, RadioComponent, SELECT_TRANSLATIONS, SelectComponent, SelectFooterComponent, SortableGroupedItemsComponent, SortableItemsComponent, SubFormDirective, TextInputComponent, ToggleComponent, ValueAccessorBase, dateValidator, invalidDateKey, invalidFieldsSymbol, matDateFormatsFactory };
|
|
2147
|
-
//# sourceMappingURL=klippa-ngx-enhancy-forms.mjs.map
|