@klippa/ngx-enhancy-forms 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,426 +4,76 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.klippa = global.klippa || {}, global.klippa["ngx-enhancy-forms"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.lodash, global.ngxSortablejs, global.ngSelect, global.ng.material.core, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global.ng.material.button));
5
5
  })(this, (function (exports, core, common, forms, lodash, ngxSortablejs, ngSelect, core$1, datepicker, formField, input, button) { 'use strict';
6
6
 
7
- var invalidFieldsSymbol = Symbol('Not all fields are valid');
8
- var FormComponent = /** @class */ (function () {
9
- function FormComponent() {
10
- // we keep track of what form controls are actually rendered. Only those count when looking at form validation
11
- this.activeControls = [];
12
- }
13
- FormComponent.prototype.registerControl = function (formControl, formElement) {
14
- this.activeControls.push({ formControl: formControl, formElement: formElement });
15
- };
16
- FormComponent.prototype.unregisterControl = function (formControl) {
17
- this.activeControls = this.activeControls.filter(function (e) { return e.formControl !== formControl; });
18
- };
19
- FormComponent.prototype.disableInactiveFormGroupControls = function (formGroup) {
20
- var _this = this;
21
- Object.values(formGroup.controls).forEach(function (value) {
22
- if (value instanceof forms.FormGroup) {
23
- _this.disableInactiveFormGroupControls(value);
24
- }
25
- else if (value instanceof forms.FormArray) {
26
- _this.disableInactiveFormArrayControls(value);
27
- }
28
- else if (value instanceof forms.FormControl) {
29
- _this.disableInactiveFormControl(value);
30
- }
31
- });
32
- };
33
- FormComponent.prototype.disableInactiveFormArrayControls = function (formArray) {
34
- var _this = this;
35
- formArray.controls.forEach(function (value) {
36
- if (value instanceof forms.FormGroup) {
37
- _this.disableInactiveFormGroupControls(value);
38
- }
39
- else if (value instanceof forms.FormArray) {
40
- _this.disableInactiveFormArrayControls(value);
41
- }
42
- else if (value instanceof forms.FormControl) {
43
- _this.disableInactiveFormControl(value);
44
- }
45
- });
46
- };
47
- FormComponent.prototype.disableInactiveFormControl = function (control) {
48
- if (!this.activeControls.some(function (e) { return e.formControl === control; })) {
49
- control.disable();
50
- }
51
- };
52
- FormComponent.prototype.trySubmit = function () {
53
- var _a, _b;
54
- this.formGroup.markAllAsTouched();
55
- var originalDisabledStates = Object.values(this.formGroup.controls).map(function (e) {
56
- return { control: e, disabled: e.disabled };
57
- });
58
- this.disableInactiveFormGroupControls(this.formGroup);
59
- var values = this.formGroup.value;
60
- if (this.formGroup.valid) {
61
- this.setDisabledStatesForAllControls(originalDisabledStates);
62
- return Promise.resolve(values);
63
- }
64
- else {
65
- (_b = (_a = this.activeControls.find(function (e) { return !e.formControl.valid; })) === null || _a === void 0 ? void 0 : _a.formElement) === null || _b === void 0 ? void 0 : _b.scrollTo();
66
- this.setDisabledStatesForAllControls(originalDisabledStates);
67
- return Promise.reject(invalidFieldsSymbol);
68
- }
69
- };
70
- FormComponent.prototype.setDisabledStatesForAllControls = function (originalDisabledStates) {
71
- originalDisabledStates.forEach(function (e) {
72
- if (e.disabled) {
73
- e.control.disable();
74
- }
75
- else {
76
- e.control.enable();
77
- }
78
- });
79
- };
80
- return FormComponent;
81
- }());
82
- FormComponent.decorators = [
83
- { type: core.Component, args: [{
84
- selector: 'klp-form',
85
- template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n",
86
- styles: [":host{display:block}:host.row{display:flex}"]
87
- },] }
88
- ];
89
- FormComponent.propDecorators = {
90
- formGroup: [{ type: core.Input }]
91
- };
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
92
9
 
93
- var FORM_ERROR_MESSAGES = new core.InjectionToken('form.error.messages');
94
- var DEFAULT_ERROR_MESSAGES = {
95
- min: "Use a number larger than %min%",
96
- max: "Use a number smaller than %max%",
97
- required: "This field is required",
98
- email: "Use a valid email address",
99
- minLength: "Has to be longer than %minLength% character(s)",
100
- maxLength: "Has to be shorter than %maxLength% character(s)",
101
- pattern: "This input is not valid",
102
- matchPassword: "Passwords must match",
103
- date: "Enter a valid date",
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise */
22
+ var extendStatics = function (d, b) {
23
+ extendStatics = Object.setPrototypeOf ||
24
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25
+ function (d, b) { for (var p in b)
26
+ if (Object.prototype.hasOwnProperty.call(b, p))
27
+ d[p] = b[p]; };
28
+ return extendStatics(d, b);
104
29
  };
105
- var FormElementComponent = /** @class */ (function () {
106
- function FormElementComponent(parent, customMessages) {
107
- this.parent = parent;
108
- this.customMessages = customMessages;
109
- this.direction = 'horizontal';
110
- this.captionSpacing = 'percentages';
111
- this.swapInputAndCaption = false;
112
- this.errorMessages = DEFAULT_ERROR_MESSAGES;
113
- this.customErrorHandlers = [];
114
- }
115
- FormElementComponent.prototype.substituteParameters = function (message, parameters) {
116
- return Object.keys(parameters).reduce(function (msg, key) {
117
- return msg.replace("%" + key + "%", parameters[key]);
118
- }, message);
119
- };
120
- FormElementComponent.prototype.registerControl = function (formControl) {
121
- this.attachedControl = formControl;
122
- this.parent.registerControl(formControl, this);
123
- };
124
- FormElementComponent.prototype.unregisterControl = function (formControl) {
125
- this.attachedControl = null;
126
- this.parent.unregisterControl(formControl);
127
- };
128
- FormElementComponent.prototype.getAttachedControl = function () {
129
- return this.attachedControl;
130
- };
131
- FormElementComponent.prototype.registerErrorHandler = function (error, templateRef) {
132
- this.customErrorHandlers.push({ error: error, templateRef: templateRef });
133
- };
134
- FormElementComponent.prototype.registerCaption = function (templateRef) {
135
- this.captionRef = templateRef;
136
- };
137
- FormElementComponent.prototype.getErrorToShow = function () {
138
- var _a, _b, _c;
139
- if (((_a = this.attachedControl) === null || _a === void 0 ? void 0 : _a.touched) === true && ((_b = this.attachedControl) === null || _b === void 0 ? void 0 : _b.errors)) {
140
- return Object.keys((_c = this.attachedControl) === null || _c === void 0 ? void 0 : _c.errors)[0];
141
- }
142
- return null;
143
- };
144
- FormElementComponent.prototype.getCustomErrorHandler = function (error) {
145
- return this.customErrorHandlers.find(function (e) { return e.error === error; });
146
- };
147
- FormElementComponent.prototype.showDefaultError = function (error) {
148
- return this.getErrorToShow() === error && !this.customErrorHandlers.some(function (e) { return e.error === error; });
149
- };
150
- FormElementComponent.prototype.getScrollableParent = function (node) {
151
- if (node == null) {
152
- return null;
153
- }
154
- if (node.scrollHeight > node.clientHeight) {
155
- return node;
156
- }
157
- else {
158
- return this.getScrollableParent(node.parentNode);
30
+ function __extends(d, b) {
31
+ if (typeof b !== "function" && b !== null)
32
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
+ extendStatics(d, b);
34
+ function __() { this.constructor = d; }
35
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
+ }
37
+ var __assign = function () {
38
+ __assign = Object.assign || function __assign(t) {
39
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
40
+ s = arguments[i];
41
+ for (var p in s)
42
+ if (Object.prototype.hasOwnProperty.call(s, p))
43
+ t[p] = s[p];
159
44
  }
45
+ return t;
160
46
  };
161
- FormElementComponent.prototype.scrollTo = function () {
162
- var _a;
163
- this.internalComponentRef.nativeElement.scrollIntoView(true);
164
- // to give some breathing room, we scroll 100px more to the top
165
- (_a = this.getScrollableParent(this.internalComponentRef.nativeElement)) === null || _a === void 0 ? void 0 : _a.scrollBy(0, -100);
166
- };
167
- FormElementComponent.prototype.getErrorMessages = function (key) {
168
- var _a, _b, _c;
169
- 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];
170
- };
171
- return FormElementComponent;
172
- }());
173
- FormElementComponent.decorators = [
174
- { type: core.Component, args: [{
175
- selector: 'klp-form-element',
176
- template: "<ng-template #errorRef>\n\t<div *ngIf=\"getErrorToShow()\" class=\"errorContainer\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessages(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessages(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessages(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessages(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessages(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessages(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessages(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessages(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessages(\"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<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n<div *ngIf=\"attachedControl\" class=\"componentContainer\" [ngClass]=\"{vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" [ngClass]=\"{ hasErrors: getErrorToShow() && attachedControl.touched, percentageSpacing: captionSpacing === 'percentages' }\">\n\t\t<div *ngIf=\"captionRef\" [ngTemplateOutlet]=\"captionRef\"></div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{ percentageSpacing: captionSpacing === 'percentages' }\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n",
177
- styles: [":host{display:block;margin-top:1.25rem}.componentContainer{align-items:center;display:flex}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block;margin-bottom:1rem}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.caption{color:#515365;flex:0 0 auto;font-weight:700}.caption.percentageSpacing{flex:0 0 40%}.caption.hasErrors{color:#ff8000}.inputContainer{flex:0 0 auto}.inputContainer.percentageSpacing{flex:0 0 60%}.errorContainer{color:#ff8000;margin-left:40%}"]
178
- },] }
179
- ];
180
- FormElementComponent.ctorParameters = function () { return [
181
- { type: FormComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
182
- { type: undefined, decorators: [{ type: core.Inject, args: [FORM_ERROR_MESSAGES,] }, { type: core.Optional }] }
183
- ]; };
184
- FormElementComponent.propDecorators = {
185
- caption: [{ type: core.Input }],
186
- direction: [{ type: core.Input }],
187
- captionSpacing: [{ type: core.Input }],
188
- swapInputAndCaption: [{ type: core.Input }],
189
- internalComponentRef: [{ type: core.ViewChild, args: ['internalComponentRef',] }]
47
+ return __assign.apply(this, arguments);
190
48
  };
191
-
192
- function stringIsSetAndNotEmpty(s) {
193
- return lodash.isString(s) && s.length > 0;
194
- }
195
- function isNullOrUndefined(value) {
196
- return value === null || value === undefined;
197
- }
198
- function numberIsSet(value) {
199
- return isValueSet(value) && typeof value === 'number';
200
- }
201
- function isValueSet(value) {
202
- return value !== null && value !== undefined;
49
+ function __rest(s, e) {
50
+ var t = {};
51
+ for (var p in s)
52
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
53
+ t[p] = s[p];
54
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
55
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
56
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
57
+ t[p[i]] = s[p[i]];
58
+ }
59
+ return t;
203
60
  }
204
- function stringOrArrayIsSetAndEmpty(value) {
205
- return value !== null && value !== undefined && value.length === 0;
61
+ function __decorate(decorators, target, key, desc) {
62
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
64
+ r = Reflect.decorate(decorators, target, key, desc);
65
+ else
66
+ for (var i = decorators.length - 1; i >= 0; i--)
67
+ if (d = decorators[i])
68
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
69
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
206
70
  }
207
- function useIfStringIsSet(s) {
208
- if (stringIsSetAndNotEmpty(s)) {
209
- return s;
210
- }
211
- return undefined;
71
+ function __param(paramIndex, decorator) {
72
+ return function (target, key) { decorator(target, key, paramIndex); };
212
73
  }
213
- function useIfArrayIsSetWithOneItem(a) {
214
- if (!isNullOrUndefined(a) && a.length === 1) {
215
- return a[0];
216
- }
217
- return undefined;
218
- }
219
- function convertParentToChild(originalClass, newClass) {
220
- return Object.assign(newClass, originalClass);
221
- }
222
- function truncateString(s, length) {
223
- if (s.length < length) {
224
- return s;
225
- }
226
- return s.substring(0, length) + '...';
227
- }
228
-
229
- /**
230
- * This component is a base in order to create a component that supports ngModel.
231
- * Some important things to know about it:
232
- *
233
- * innerValue = your own inner state, which you should use to store the current state of what ngModel should be.
234
- * 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!
235
- * setInnerValueAndNotify() = call this when you want your ngModel to be updated from INSIDE of your component, and provide it to the OUTSIDE.
236
- * 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.
237
- */
238
- var ValueAccessorBase = /** @class */ (function () {
239
- function ValueAccessorBase(parent, controlContainer) {
240
- this.parent = parent;
241
- this.controlContainer = controlContainer;
242
- this.changed = new Array();
243
- this.touched = new Array();
244
- this.disabled = false;
245
- // we support both providing just the formControlName and the full formControl
246
- this.formControlName = null;
247
- this.formControl = null;
248
- }
249
- ValueAccessorBase.prototype.ngOnInit = function () {
250
- var _this = this;
251
- var _a, _b, _c;
252
- if (this.formControl) {
253
- this.attachedFormControl = this.formControl;
254
- }
255
- else if (stringIsSetAndNotEmpty(this.formControlName)) {
256
- this.attachedFormControl = (_a = this.controlContainer) === null || _a === void 0 ? void 0 : _a.control.get(this.formControlName);
257
- if (isNullOrUndefined(this.attachedFormControl)) {
258
- 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.");
259
- }
260
- }
261
- if (this.attachedFormControl) {
262
- this.disabled = this.attachedFormControl.disabled;
263
- this.attachedFormControl.statusChanges.subscribe(function () {
264
- _this.disabled = _this.attachedFormControl.disabled;
265
- });
266
- (_c = this.parent) === null || _c === void 0 ? void 0 : _c.registerControl(this.attachedFormControl);
267
- }
268
- };
269
- ValueAccessorBase.prototype.isInErrorState = function () {
270
- return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
271
- };
272
- ValueAccessorBase.prototype.ngOnDestroy = function () {
273
- var _a;
274
- if (this.attachedFormControl) {
275
- (_a = this.parent) === null || _a === void 0 ? void 0 : _a.unregisterControl(this.attachedFormControl);
276
- }
277
- };
278
- ValueAccessorBase.prototype.touch = function () {
279
- this.touched.forEach(function (f) { return f(); });
280
- };
281
- ValueAccessorBase.prototype.writeValue = function (value) {
282
- this.innerValue = value;
283
- };
284
- ValueAccessorBase.prototype.registerOnChange = function (fn) {
285
- this.changed.push(fn);
286
- };
287
- ValueAccessorBase.prototype.registerOnTouched = function (fn) {
288
- this.touched.push(fn);
289
- };
290
- ValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
291
- this.innerValue = value;
292
- this.changed.forEach(function (fn) { return fn(value); });
293
- };
294
- ValueAccessorBase.prototype.resetToNull = function () {
295
- this.setInnerValueAndNotify(null);
296
- };
297
- return ValueAccessorBase;
298
- }());
299
- ValueAccessorBase.decorators = [
300
- { type: core.Component, args: [{
301
- selector: '',
302
- template: ''
303
- },] }
304
- ];
305
- ValueAccessorBase.ctorParameters = function () { return [
306
- { type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
307
- { type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] }
308
- ]; };
309
- ValueAccessorBase.propDecorators = {
310
- disabled: [{ type: core.Input }],
311
- formControlName: [{ type: core.Input }],
312
- formControl: [{ type: core.Input }]
313
- };
314
-
315
- var ButtonComponent = /** @class */ (function () {
316
- function ButtonComponent() {
317
- this.variant = 'white';
318
- this.size = 'medium';
319
- this.fullWidth = false;
320
- this.hasBorder = true;
321
- this.disabled = false;
322
- this.isLoading = false;
323
- this.type = 'button';
324
- }
325
- Object.defineProperty(ButtonComponent.prototype, "_", {
326
- get: function () {
327
- return this.fullWidth;
328
- },
329
- enumerable: false,
330
- configurable: true
331
- });
332
- ButtonComponent.prototype.onClick = function (event) {
333
- if (this.disabled) {
334
- event.stopPropagation();
335
- }
336
- };
337
- return ButtonComponent;
338
- }());
339
- ButtonComponent.decorators = [
340
- { type: core.Component, args: [{
341
- selector: 'klp-form-button',
342
- 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",
343
- styles: [":host{display:inline-block}:host._fullWidth{display:block}.buttonFundamentals{border:1px solid #e6ecf5;border-radius:5px;color:#888da8;cursor:pointer;font-size:13px;font-weight:700;letter-spacing:1px;padding:10px 20px}.fullWidth{width:100%}.no-border{border:none}.caption.invisible{visibility:hidden}button{position:relative}.loadingSpinnerContainer{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.small{padding-bottom:.375rem;padding-top:.375rem}.large{line-height:2}.white{background-color:#fff;border-color:#d4deee;color:#515365;font-weight:500}.white:active,.white:hover{background-color:#edf2f8;border-color:#edf2f8;color:#515365}.white:focus{text-decoration:underline}.greenFilled{background-color:#27bb5f;border-color:#27bb5f;color:#fff}.greenFilled:hover{background-color:#2bd06a;border-color:#2bd06a;color:#fff}.greenFilled:focus{text-decoration:underline}.greenFilled:active{background-color:#23a654;border-color:#23a654}.greenOutlined{background-color:#fff;border-color:#27bb5f;color:#27bb5f}.greenOutlined:hover{background-color:#2bd06a;border-color:#2bd06a;color:#fff}.greenOutlined:focus{text-decoration:underline}.greenOutlined:active{background-color:#23a654;border-color:#23a654}.greenLink{background:none;border:none;color:#27bb5f;padding:0}.greenLink:focus,.greenLink:hover{text-decoration:underline}.contextMenuItem{background-color:#fff;border-color:#fff;color:#888da8}.contextMenuItem:hover{background-color:#f6f7fb;border-color:#f6f7fb}.contextMenuItem:active,.contextMenuItem:focus{text-decoration:underline}.redFilled{background-color:#ff3c7e;border-color:#ff3c7e;color:#fff}.redFilled:hover{background-color:#ff568f;border-color:#ff568f;color:#fff}.redFilled:focus{text-decoration:underline}.redFilled:active{background-color:#ff236d;border-color:#ff236d}.redOutlined{background-color:#fff;border-color:#ff3c7e;color:#ff3c7e}.redOutlined:hover{background-color:#ff568f;border-color:#ff568f;color:#fff}.redOutlined:focus{text-decoration:underline}.redOutlined:active{background-color:#ff236d;border-color:#ff236d}.orangeFilled{background-color:#ff8000;border-color:#ff8000;color:#fff}.orangeFilled:hover{background-color:#ff8d1a;border-color:#ff8d1a;color:#fff}.orangeFilled:focus{text-decoration:underline}.orangeFilled:active{background-color:#e67300;border-color:#e67300}"]
344
- },] }
345
- ];
346
- ButtonComponent.propDecorators = {
347
- variant: [{ type: core.Input }],
348
- size: [{ type: core.Input }],
349
- fullWidth: [{ type: core.Input }],
350
- hasBorder: [{ type: core.Input }],
351
- disabled: [{ type: core.Input }],
352
- isLoading: [{ type: core.Input }],
353
- type: [{ type: core.Input }],
354
- _: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
355
- };
356
-
357
- /*! *****************************************************************************
358
- Copyright (c) Microsoft Corporation.
359
-
360
- Permission to use, copy, modify, and/or distribute this software for any
361
- purpose with or without fee is hereby granted.
362
-
363
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
364
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
365
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
366
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
367
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
368
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
369
- PERFORMANCE OF THIS SOFTWARE.
370
- ***************************************************************************** */
371
- /* global Reflect, Promise */
372
- var extendStatics = function (d, b) {
373
- extendStatics = Object.setPrototypeOf ||
374
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
375
- function (d, b) { for (var p in b)
376
- if (Object.prototype.hasOwnProperty.call(b, p))
377
- d[p] = b[p]; };
378
- return extendStatics(d, b);
379
- };
380
- function __extends(d, b) {
381
- if (typeof b !== "function" && b !== null)
382
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
383
- extendStatics(d, b);
384
- function __() { this.constructor = d; }
385
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
386
- }
387
- var __assign = function () {
388
- __assign = Object.assign || function __assign(t) {
389
- for (var s, i = 1, n = arguments.length; i < n; i++) {
390
- s = arguments[i];
391
- for (var p in s)
392
- if (Object.prototype.hasOwnProperty.call(s, p))
393
- t[p] = s[p];
394
- }
395
- return t;
396
- };
397
- return __assign.apply(this, arguments);
398
- };
399
- function __rest(s, e) {
400
- var t = {};
401
- for (var p in s)
402
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
403
- t[p] = s[p];
404
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
405
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
406
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
407
- t[p[i]] = s[p[i]];
408
- }
409
- return t;
410
- }
411
- function __decorate(decorators, target, key, desc) {
412
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
413
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
414
- r = Reflect.decorate(decorators, target, key, desc);
415
- else
416
- for (var i = decorators.length - 1; i >= 0; i--)
417
- if (d = decorators[i])
418
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
419
- return c > 3 && r && Object.defineProperty(target, key, r), r;
420
- }
421
- function __param(paramIndex, decorator) {
422
- return function (target, key) { decorator(target, key, paramIndex); };
423
- }
424
- function __metadata(metadataKey, metadataValue) {
425
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
426
- return Reflect.metadata(metadataKey, metadataValue);
74
+ function __metadata(metadataKey, metadataValue) {
75
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
+ return Reflect.metadata(metadataKey, metadataValue);
427
77
  }
428
78
  function __awaiter(thisArg, _arguments, P, generator) {
429
79
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -672,6 +322,402 @@
672
322
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
673
323
  }
674
324
 
325
+ function stringIsSetAndNotEmpty(s) {
326
+ return lodash.isString(s) && s.length > 0;
327
+ }
328
+ function isNullOrUndefined(value) {
329
+ return value === null || value === undefined;
330
+ }
331
+ function numberIsSet(value) {
332
+ return isValueSet(value) && typeof value === 'number';
333
+ }
334
+ function isValueSet(value) {
335
+ return value !== null && value !== undefined;
336
+ }
337
+ function stringOrArrayIsSetAndEmpty(value) {
338
+ return value !== null && value !== undefined && value.length === 0;
339
+ }
340
+ function useIfStringIsSet(s) {
341
+ if (stringIsSetAndNotEmpty(s)) {
342
+ return s;
343
+ }
344
+ return undefined;
345
+ }
346
+ function useIfArrayIsSetWithOneItem(a) {
347
+ if (!isNullOrUndefined(a) && a.length === 1) {
348
+ return a[0];
349
+ }
350
+ return undefined;
351
+ }
352
+ function convertParentToChild(originalClass, newClass) {
353
+ return Object.assign(newClass, originalClass);
354
+ }
355
+ function truncateString(s, length) {
356
+ if (s.length < length) {
357
+ return s;
358
+ }
359
+ return s.substring(0, length) + '...';
360
+ }
361
+
362
+ var invalidFieldsSymbol = Symbol('Not all fields are valid');
363
+ // Only used as a 'marker' to define a property will be filled in by a sub form
364
+ var SubForm = /** @class */ (function (_super) {
365
+ __extends(SubForm, _super);
366
+ function SubForm() {
367
+ return _super.call(this, {}, null) || this;
368
+ }
369
+ return SubForm;
370
+ }(forms.FormGroup));
371
+ var FormComponent = /** @class */ (function () {
372
+ function FormComponent(parent, surroundingFormGroupName) {
373
+ this.parent = parent;
374
+ this.surroundingFormGroupName = surroundingFormGroupName;
375
+ // we keep track of what form controls are actually rendered. Only those count when looking at form validation
376
+ this.activeControls = [];
377
+ }
378
+ FormComponent.prototype.ngOnInit = function () {
379
+ var _a;
380
+ if (this.parent) {
381
+ if (!isValueSet((_a = this.surroundingFormGroupName) === null || _a === void 0 ? void 0 : _a.name)) {
382
+ throw new Error('No surrounding groupname is found for a nested form');
383
+ }
384
+ var groupName = String(this.surroundingFormGroupName.name);
385
+ var groupToOverwrite = this.parent.formGroup.get(groupName);
386
+ if (!(groupToOverwrite instanceof SubForm)) {
387
+ throw new Error("Surrounding groupname '" + groupName + "' is not a subFormSubstitute'");
388
+ }
389
+ this.parent.formGroup.setControl(groupName, this.formGroup);
390
+ }
391
+ };
392
+ FormComponent.prototype.registerControl = function (formControl, formElement) {
393
+ this.activeControls.push({ formControl: formControl, formElement: formElement });
394
+ if (this.parent) {
395
+ this.parent.registerControl(formControl, formElement);
396
+ }
397
+ };
398
+ FormComponent.prototype.unregisterControl = function (formControl) {
399
+ this.activeControls = this.activeControls.filter(function (e) { return e.formControl !== formControl; });
400
+ if (this.parent) {
401
+ this.parent.unregisterControl(formControl);
402
+ }
403
+ };
404
+ FormComponent.prototype.addFormGroupControls = function (formGroup, result) {
405
+ var _this = this;
406
+ Object.values(formGroup.controls).forEach(function (value) {
407
+ if (value instanceof forms.FormGroup) {
408
+ _this.addFormGroupControls(value, result);
409
+ }
410
+ else if (value instanceof forms.FormArray) {
411
+ _this.addFormArrayControls(value, result);
412
+ }
413
+ else if (value instanceof forms.FormControl) {
414
+ _this.addFormControl(value, result);
415
+ }
416
+ });
417
+ };
418
+ FormComponent.prototype.addFormArrayControls = function (formArray, result) {
419
+ var _this = this;
420
+ formArray.controls.forEach(function (value) {
421
+ if (value instanceof forms.FormGroup) {
422
+ _this.addFormGroupControls(value, result);
423
+ }
424
+ else if (value instanceof forms.FormArray) {
425
+ _this.addFormArrayControls(value, result);
426
+ }
427
+ else if (value instanceof forms.FormControl) {
428
+ _this.addFormControl(value, result);
429
+ }
430
+ });
431
+ };
432
+ FormComponent.prototype.getAllFormControls = function () {
433
+ var result = [];
434
+ this.addFormGroupControls(this.formGroup, result);
435
+ return result;
436
+ };
437
+ FormComponent.prototype.addFormControl = function (control, result) {
438
+ result.push(control);
439
+ };
440
+ FormComponent.prototype.disableInactiveFormControl = function (control) {
441
+ if (!this.activeControls.some(function (e) { return e.formControl === control; })) {
442
+ control.disable();
443
+ }
444
+ };
445
+ FormComponent.prototype.trySubmit = function () {
446
+ var _this = this;
447
+ var _a, _b;
448
+ this.formGroup.markAllAsTouched();
449
+ var allControls = this.getAllFormControls();
450
+ var originalDisabledStates = allControls.map(function (e) {
451
+ return { control: e, disabled: e.disabled };
452
+ });
453
+ allControls.forEach(function (e) { return _this.disableInactiveFormControl(e); });
454
+ var values = this.formGroup.value;
455
+ if (this.formGroup.valid) {
456
+ this.setDisabledStatesForAllControls(originalDisabledStates);
457
+ return Promise.resolve(values);
458
+ }
459
+ else {
460
+ (_b = (_a = this.activeControls.find(function (e) { return !e.formControl.valid; })) === null || _a === void 0 ? void 0 : _a.formElement) === null || _b === void 0 ? void 0 : _b.scrollTo();
461
+ this.setDisabledStatesForAllControls(originalDisabledStates);
462
+ return Promise.reject(invalidFieldsSymbol);
463
+ }
464
+ };
465
+ FormComponent.prototype.setDisabledStatesForAllControls = function (originalDisabledStates) {
466
+ originalDisabledStates.forEach(function (e) {
467
+ if (e.disabled) {
468
+ e.control.disable();
469
+ }
470
+ else {
471
+ e.control.enable();
472
+ }
473
+ });
474
+ };
475
+ return FormComponent;
476
+ }());
477
+ FormComponent.decorators = [
478
+ { type: core.Component, args: [{
479
+ selector: 'klp-form',
480
+ template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n",
481
+ styles: [":host{display:block}:host.row{display:flex}"]
482
+ },] }
483
+ ];
484
+ FormComponent.ctorParameters = function () { return [
485
+ { type: FormComponent, decorators: [{ type: core.SkipSelf }, { type: core.Optional }] },
486
+ { type: forms.FormGroupName, decorators: [{ type: core.Optional }] }
487
+ ]; };
488
+ FormComponent.propDecorators = {
489
+ formGroup: [{ type: core.Input }]
490
+ };
491
+
492
+ var FORM_ERROR_MESSAGES = new core.InjectionToken('form.error.messages');
493
+ var DEFAULT_ERROR_MESSAGES = {
494
+ min: "Use a number larger than %min%",
495
+ max: "Use a number smaller than %max%",
496
+ required: "This field is required",
497
+ email: "Use a valid email address",
498
+ minLength: "Has to be longer than %minLength% character(s)",
499
+ maxLength: "Has to be shorter than %maxLength% character(s)",
500
+ pattern: "This input is not valid",
501
+ matchPassword: "Passwords must match",
502
+ date: "Enter a valid date",
503
+ };
504
+ var FormElementComponent = /** @class */ (function () {
505
+ function FormElementComponent(parent, customMessages) {
506
+ this.parent = parent;
507
+ this.customMessages = customMessages;
508
+ this.direction = 'horizontal';
509
+ this.captionSpacing = 'percentages';
510
+ this.swapInputAndCaption = false;
511
+ this.errorMessages = DEFAULT_ERROR_MESSAGES;
512
+ this.customErrorHandlers = [];
513
+ }
514
+ FormElementComponent.prototype.substituteParameters = function (message, parameters) {
515
+ return Object.keys(parameters).reduce(function (msg, key) {
516
+ return msg.replace("%" + key + "%", parameters[key]);
517
+ }, message);
518
+ };
519
+ FormElementComponent.prototype.registerControl = function (formControl) {
520
+ // console.log('register');
521
+ // console.log(this.caption);
522
+ this.attachedControl = formControl;
523
+ this.parent.registerControl(formControl, this);
524
+ };
525
+ FormElementComponent.prototype.unregisterControl = function (formControl) {
526
+ this.attachedControl = null;
527
+ this.parent.unregisterControl(formControl);
528
+ };
529
+ FormElementComponent.prototype.getAttachedControl = function () {
530
+ return this.attachedControl;
531
+ };
532
+ FormElementComponent.prototype.registerErrorHandler = function (error, templateRef) {
533
+ this.customErrorHandlers.push({ error: error, templateRef: templateRef });
534
+ };
535
+ FormElementComponent.prototype.registerCaption = function (templateRef) {
536
+ this.captionRef = templateRef;
537
+ };
538
+ FormElementComponent.prototype.getErrorToShow = function () {
539
+ var _a, _b, _c;
540
+ if (((_a = this.attachedControl) === null || _a === void 0 ? void 0 : _a.touched) === true && ((_b = this.attachedControl) === null || _b === void 0 ? void 0 : _b.errors)) {
541
+ return Object.keys((_c = this.attachedControl) === null || _c === void 0 ? void 0 : _c.errors)[0];
542
+ }
543
+ return null;
544
+ };
545
+ FormElementComponent.prototype.getCustomErrorHandler = function (error) {
546
+ return this.customErrorHandlers.find(function (e) { return e.error === error; });
547
+ };
548
+ FormElementComponent.prototype.showDefaultError = function (error) {
549
+ return this.getErrorToShow() === error && !this.customErrorHandlers.some(function (e) { return e.error === error; });
550
+ };
551
+ FormElementComponent.prototype.getScrollableParent = function (node) {
552
+ if (node == null) {
553
+ return null;
554
+ }
555
+ if (node.scrollHeight > node.clientHeight) {
556
+ return node;
557
+ }
558
+ else {
559
+ return this.getScrollableParent(node.parentNode);
560
+ }
561
+ };
562
+ FormElementComponent.prototype.scrollTo = function () {
563
+ var _a;
564
+ this.internalComponentRef.nativeElement.scrollIntoView(true);
565
+ // to give some breathing room, we scroll 100px more to the top
566
+ (_a = this.getScrollableParent(this.internalComponentRef.nativeElement)) === null || _a === void 0 ? void 0 : _a.scrollBy(0, -100);
567
+ };
568
+ FormElementComponent.prototype.getErrorMessages = function (key) {
569
+ var _a, _b, _c;
570
+ 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];
571
+ };
572
+ return FormElementComponent;
573
+ }());
574
+ FormElementComponent.decorators = [
575
+ { type: core.Component, args: [{
576
+ selector: 'klp-form-element',
577
+ template: "<ng-template #errorRef>\n\t<div *ngIf=\"getErrorToShow()\" class=\"errorContainer\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessages(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessages(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessages(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessages(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessages(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessages(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessages(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessages(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessages(\"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<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n<div *ngIf=\"attachedControl\" class=\"componentContainer\" [ngClass]=\"{vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" [ngClass]=\"{ hasErrors: getErrorToShow() && attachedControl.touched, percentageSpacing: captionSpacing === 'percentages' }\">\n\t\t<div *ngIf=\"captionRef\" [ngTemplateOutlet]=\"captionRef\"></div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{ percentageSpacing: captionSpacing === 'percentages' }\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n",
578
+ styles: [":host{display:block;margin-top:1.25rem}.componentContainer{align-items:center;display:flex}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block;margin-bottom:1rem}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.caption{color:#515365;flex:0 0 auto;font-weight:700}.caption.percentageSpacing{flex:0 0 40%}.caption.hasErrors{color:#ff8000}.inputContainer{flex:0 0 auto}.inputContainer.percentageSpacing{flex:0 0 60%}.errorContainer{color:#ff8000;margin-left:40%}"]
579
+ },] }
580
+ ];
581
+ FormElementComponent.ctorParameters = function () { return [
582
+ { type: FormComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
583
+ { type: undefined, decorators: [{ type: core.Inject, args: [FORM_ERROR_MESSAGES,] }, { type: core.Optional }] }
584
+ ]; };
585
+ FormElementComponent.propDecorators = {
586
+ caption: [{ type: core.Input }],
587
+ direction: [{ type: core.Input }],
588
+ captionSpacing: [{ type: core.Input }],
589
+ swapInputAndCaption: [{ type: core.Input }],
590
+ internalComponentRef: [{ type: core.ViewChild, args: ['internalComponentRef',] }]
591
+ };
592
+
593
+ /**
594
+ * This component is a base in order to create a component that supports ngModel.
595
+ * Some important things to know about it:
596
+ *
597
+ * innerValue = your own inner state, which you should use to store the current state of what ngModel should be.
598
+ * 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!
599
+ * setInnerValueAndNotify() = call this when you want your ngModel to be updated from INSIDE of your component, and provide it to the OUTSIDE.
600
+ * 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.
601
+ */
602
+ var ValueAccessorBase = /** @class */ (function () {
603
+ function ValueAccessorBase(parent, controlContainer) {
604
+ this.parent = parent;
605
+ this.controlContainer = controlContainer;
606
+ this.changed = new Array();
607
+ this.touched = new Array();
608
+ this.disabled = false;
609
+ // we support both providing just the formControlName and the full formControl
610
+ this.formControlName = null;
611
+ this.formControl = null;
612
+ }
613
+ ValueAccessorBase.prototype.ngOnInit = function () {
614
+ var _this = this;
615
+ var _a, _b, _c;
616
+ if (this.formControl) {
617
+ this.attachedFormControl = this.formControl;
618
+ }
619
+ else if (stringIsSetAndNotEmpty(this.formControlName)) {
620
+ this.attachedFormControl = (_a = this.controlContainer) === null || _a === void 0 ? void 0 : _a.control.get(this.formControlName);
621
+ if (isNullOrUndefined(this.attachedFormControl)) {
622
+ 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.");
623
+ }
624
+ }
625
+ if (this.attachedFormControl) {
626
+ this.disabled = this.attachedFormControl.disabled;
627
+ this.attachedFormControl.statusChanges.subscribe(function () {
628
+ _this.disabled = _this.attachedFormControl.disabled;
629
+ });
630
+ (_c = this.parent) === null || _c === void 0 ? void 0 : _c.registerControl(this.attachedFormControl);
631
+ }
632
+ };
633
+ ValueAccessorBase.prototype.isInErrorState = function () {
634
+ return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
635
+ };
636
+ ValueAccessorBase.prototype.ngOnDestroy = function () {
637
+ var _a;
638
+ if (this.attachedFormControl) {
639
+ (_a = this.parent) === null || _a === void 0 ? void 0 : _a.unregisterControl(this.attachedFormControl);
640
+ }
641
+ };
642
+ ValueAccessorBase.prototype.touch = function () {
643
+ this.touched.forEach(function (f) { return f(); });
644
+ };
645
+ ValueAccessorBase.prototype.writeValue = function (value) {
646
+ this.innerValue = value;
647
+ };
648
+ ValueAccessorBase.prototype.registerOnChange = function (fn) {
649
+ this.changed.push(fn);
650
+ };
651
+ ValueAccessorBase.prototype.registerOnTouched = function (fn) {
652
+ this.touched.push(fn);
653
+ };
654
+ ValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
655
+ this.innerValue = value;
656
+ this.changed.forEach(function (fn) { return fn(value); });
657
+ };
658
+ ValueAccessorBase.prototype.resetToNull = function () {
659
+ this.setInnerValueAndNotify(null);
660
+ };
661
+ return ValueAccessorBase;
662
+ }());
663
+ ValueAccessorBase.decorators = [
664
+ { type: core.Component, args: [{
665
+ selector: '',
666
+ template: ''
667
+ },] }
668
+ ];
669
+ ValueAccessorBase.ctorParameters = function () { return [
670
+ { type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
671
+ { type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] }
672
+ ]; };
673
+ ValueAccessorBase.propDecorators = {
674
+ disabled: [{ type: core.Input }],
675
+ formControlName: [{ type: core.Input }],
676
+ formControl: [{ type: core.Input }]
677
+ };
678
+
679
+ var ButtonComponent = /** @class */ (function () {
680
+ function ButtonComponent() {
681
+ this.variant = 'white';
682
+ this.size = 'medium';
683
+ this.fullWidth = false;
684
+ this.hasBorder = true;
685
+ this.disabled = false;
686
+ this.isLoading = false;
687
+ this.type = 'button';
688
+ }
689
+ Object.defineProperty(ButtonComponent.prototype, "_", {
690
+ get: function () {
691
+ return this.fullWidth;
692
+ },
693
+ enumerable: false,
694
+ configurable: true
695
+ });
696
+ ButtonComponent.prototype.onClick = function (event) {
697
+ if (this.disabled) {
698
+ event.stopPropagation();
699
+ }
700
+ };
701
+ return ButtonComponent;
702
+ }());
703
+ ButtonComponent.decorators = [
704
+ { type: core.Component, args: [{
705
+ selector: 'klp-form-button',
706
+ 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",
707
+ styles: [":host{display:inline-block}:host._fullWidth{display:block}.buttonFundamentals{border:1px solid #e6ecf5;border-radius:5px;color:#888da8;cursor:pointer;font-size:13px;font-weight:700;letter-spacing:1px;padding:10px 20px}.fullWidth{width:100%}.no-border{border:none}.caption.invisible{visibility:hidden}button{position:relative}.loadingSpinnerContainer{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.small{padding-bottom:.375rem;padding-top:.375rem}.large{line-height:2}.white{background-color:#fff;border-color:#d4deee;color:#515365;font-weight:500}.white:active,.white:hover{background-color:#edf2f8;border-color:#edf2f8;color:#515365}.white:focus{text-decoration:underline}.greenFilled{background-color:#27bb5f;border-color:#27bb5f;color:#fff}.greenFilled:hover{background-color:#2bd06a;border-color:#2bd06a;color:#fff}.greenFilled:focus{text-decoration:underline}.greenFilled:active{background-color:#23a654;border-color:#23a654}.greenOutlined{background-color:#fff;border-color:#27bb5f;color:#27bb5f}.greenOutlined:hover{background-color:#2bd06a;border-color:#2bd06a;color:#fff}.greenOutlined:focus{text-decoration:underline}.greenOutlined:active{background-color:#23a654;border-color:#23a654}.greenLink{background:none;border:none;color:#27bb5f;padding:0}.greenLink:focus,.greenLink:hover{text-decoration:underline}.contextMenuItem{background-color:#fff;border-color:#fff;color:#888da8}.contextMenuItem:hover{background-color:#f6f7fb;border-color:#f6f7fb}.contextMenuItem:active,.contextMenuItem:focus{text-decoration:underline}.redFilled{background-color:#ff3c7e;border-color:#ff3c7e;color:#fff}.redFilled:hover{background-color:#ff568f;border-color:#ff568f;color:#fff}.redFilled:focus{text-decoration:underline}.redFilled:active{background-color:#ff236d;border-color:#ff236d}.redOutlined{background-color:#fff;border-color:#ff3c7e;color:#ff3c7e}.redOutlined:hover{background-color:#ff568f;border-color:#ff568f;color:#fff}.redOutlined:focus{text-decoration:underline}.redOutlined:active{background-color:#ff236d;border-color:#ff236d}.orangeFilled{background-color:#ff8000;border-color:#ff8000;color:#fff}.orangeFilled:hover{background-color:#ff8d1a;border-color:#ff8d1a;color:#fff}.orangeFilled:focus{text-decoration:underline}.orangeFilled:active{background-color:#e67300;border-color:#e67300}"]
708
+ },] }
709
+ ];
710
+ ButtonComponent.propDecorators = {
711
+ variant: [{ type: core.Input }],
712
+ size: [{ type: core.Input }],
713
+ fullWidth: [{ type: core.Input }],
714
+ hasBorder: [{ type: core.Input }],
715
+ disabled: [{ type: core.Input }],
716
+ isLoading: [{ type: core.Input }],
717
+ type: [{ type: core.Input }],
718
+ _: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
719
+ };
720
+
675
721
  var CheckboxComponent = /** @class */ (function (_super) {
676
722
  __extends(CheckboxComponent, _super);
677
723
  function CheckboxComponent() {
@@ -1206,6 +1252,7 @@
1206
1252
  exports.PasswordFieldComponent = PasswordFieldComponent;
1207
1253
  exports.SelectComponent = SelectComponent;
1208
1254
  exports.SortableItemsComponent = SortableItemsComponent;
1255
+ exports.SubForm = SubForm;
1209
1256
  exports.TextInputComponent = TextInputComponent;
1210
1257
  exports.ToggleComponent = ToggleComponent;
1211
1258
  exports.ValueAccessorBase = ValueAccessorBase;