@klippa/ngx-enhancy-forms 2.0.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,431 +4,95 @@
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 FormComponent = /** @class */ (function () {
8
- function FormComponent() {
9
- // we keep track of what form controls are actually rendered. Only those count when looking at form validation
10
- this.activeControls = [];
11
- }
12
- FormComponent.prototype.registerControl = function (formControl, formElement) {
13
- this.activeControls.push({ formControl: formControl, formElement: formElement });
14
- };
15
- FormComponent.prototype.unregisterControl = function (formControl) {
16
- this.activeControls = this.activeControls.filter(function (e) { return e.formControl !== formControl; });
17
- };
18
- FormComponent.prototype.disableInactiveFormGroupControls = function (formGroup) {
19
- var _this = this;
20
- Object.values(formGroup.controls).forEach(function (value) {
21
- if (value instanceof forms.FormGroup) {
22
- _this.disableInactiveFormGroupControls(value);
23
- }
24
- else if (value instanceof forms.FormArray) {
25
- _this.disableInactiveFormArrayControls(value);
26
- }
27
- else if (value instanceof forms.FormControl) {
28
- _this.disableInactiveFormControl(value);
29
- }
30
- });
31
- };
32
- FormComponent.prototype.disableInactiveFormArrayControls = function (formArray) {
33
- var _this = this;
34
- formArray.controls.forEach(function (value) {
35
- if (value instanceof forms.FormGroup) {
36
- _this.disableInactiveFormGroupControls(value);
37
- }
38
- else if (value instanceof forms.FormArray) {
39
- _this.disableInactiveFormArrayControls(value);
40
- }
41
- else if (value instanceof forms.FormControl) {
42
- _this.disableInactiveFormControl(value);
43
- }
44
- });
45
- };
46
- FormComponent.prototype.disableInactiveFormControl = function (control) {
47
- if (this.activeControls.some(function (e) { return e.formControl === control; })) {
48
- control.enable();
49
- }
50
- else {
51
- control.disable();
52
- }
53
- };
54
- FormComponent.prototype.trySubmit = function () {
55
- var _a, _b;
56
- this.formGroup.markAllAsTouched();
57
- this.disableInactiveFormGroupControls(this.formGroup);
58
- if (this.formGroup.valid) {
59
- return Promise.resolve(this.formGroup.value);
60
- }
61
- else {
62
- (_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();
63
- return Promise.reject('Not all fields are valid');
64
- }
65
- };
66
- return FormComponent;
67
- }());
68
- FormComponent.decorators = [
69
- { type: core.Component, args: [{
70
- selector: 'klp-form',
71
- template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n",
72
- styles: [":host{display:block}:host.row{display:flex}"]
73
- },] }
74
- ];
75
- FormComponent.propDecorators = {
76
- formGroup: [{ type: core.Input }]
77
- };
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
78
9
 
79
- var FORM_ERROR_MESSAGES = new core.InjectionToken('form.error.messages');
80
- var DEFAULT_ERROR_MESSAGES = {
81
- min: "Use a number larger than %min%",
82
- max: "Use a number smaller than %max%",
83
- required: "This field is required",
84
- email: "Use a valid email address",
85
- minLength: "Has to be longer than %minLength% character(s)",
86
- maxLength: "Has to be shorter than %maxLength% character(s)",
87
- pattern: "This input is not valid",
88
- matchPassword: "Passwords must match",
89
- 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);
90
29
  };
91
- var FormElementComponent = /** @class */ (function () {
92
- function FormElementComponent(parent, customMessages) {
93
- this.parent = parent;
94
- this.customMessages = customMessages;
95
- this.direction = 'horizontal';
96
- this.captionSpacing = 'percentages';
97
- this.swapInputAndCaption = false;
98
- this.errorMessages = DEFAULT_ERROR_MESSAGES;
99
- this.customErrorHandlers = [];
100
- }
101
- FormElementComponent.prototype.substituteParameters = function (message, parameters) {
102
- return Object.keys(parameters).reduce(function (msg, key) {
103
- return msg.replace("%" + key + "%", parameters[key]);
104
- }, message);
105
- };
106
- FormElementComponent.prototype.registerControl = function (formControl) {
107
- this.attachedControl = formControl;
108
- this.parent.registerControl(formControl, this);
109
- };
110
- FormElementComponent.prototype.unregisterControl = function (formControl) {
111
- this.attachedControl = null;
112
- this.parent.unregisterControl(formControl);
113
- };
114
- FormElementComponent.prototype.getAttachedControl = function () {
115
- return this.attachedControl;
116
- };
117
- FormElementComponent.prototype.registerErrorHandler = function (error, templateRef) {
118
- this.customErrorHandlers.push({ error: error, templateRef: templateRef });
119
- };
120
- FormElementComponent.prototype.registerCaption = function (templateRef) {
121
- this.captionRef = templateRef;
122
- };
123
- FormElementComponent.prototype.getErrorToShow = function () {
124
- var _a, _b, _c;
125
- if (((_a = this.attachedControl) === null || _a === void 0 ? void 0 : _a.touched) === true && ((_b = this.attachedControl) === null || _b === void 0 ? void 0 : _b.errors)) {
126
- return Object.keys((_c = this.attachedControl) === null || _c === void 0 ? void 0 : _c.errors)[0];
127
- }
128
- return null;
129
- };
130
- FormElementComponent.prototype.getCustomErrorHandler = function (error) {
131
- return this.customErrorHandlers.find(function (e) { return e.error === error; });
132
- };
133
- FormElementComponent.prototype.showDefaultError = function (error) {
134
- return this.getErrorToShow() === error && !this.customErrorHandlers.some(function (e) { return e.error === error; });
135
- };
136
- FormElementComponent.prototype.getScrollableParent = function (node) {
137
- if (node == null) {
138
- return null;
139
- }
140
- if (node.scrollHeight > node.clientHeight) {
141
- return node;
142
- }
143
- else {
144
- 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];
145
44
  }
45
+ return t;
146
46
  };
147
- FormElementComponent.prototype.scrollTo = function () {
148
- var _a;
149
- this.internalComponentRef.nativeElement.scrollIntoView(true);
150
- // to give some breathing room, we scroll 100px more to the top
151
- (_a = this.getScrollableParent(this.internalComponentRef.nativeElement)) === null || _a === void 0 ? void 0 : _a.scrollBy(0, -100);
152
- };
153
- FormElementComponent.prototype.getErrorMessages = function (key) {
154
- var _a, _b, _c;
155
- 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];
156
- };
157
- return FormElementComponent;
158
- }());
159
- FormElementComponent.decorators = [
160
- { type: core.Component, args: [{
161
- selector: 'klp-form-element',
162
- 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",
163
- 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%}"]
164
- },] }
165
- ];
166
- FormElementComponent.ctorParameters = function () { return [
167
- { type: FormComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
168
- { type: undefined, decorators: [{ type: core.Inject, args: [FORM_ERROR_MESSAGES,] }, { type: core.Optional }] }
169
- ]; };
170
- FormElementComponent.propDecorators = {
171
- caption: [{ type: core.Input }],
172
- direction: [{ type: core.Input }],
173
- captionSpacing: [{ type: core.Input }],
174
- swapInputAndCaption: [{ type: core.Input }],
175
- internalComponentRef: [{ type: core.ViewChild, args: ['internalComponentRef',] }]
47
+ return __assign.apply(this, arguments);
176
48
  };
177
-
178
- function stringIsSetAndNotEmpty(s) {
179
- return lodash.isString(s) && s.length > 0;
180
- }
181
- function isNullOrUndefined(value) {
182
- return value === null || value === undefined;
183
- }
184
- function numberIsSet(value) {
185
- return isValueSet(value) && typeof value === 'number';
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;
186
60
  }
187
- function isValueSet(value) {
188
- return value !== null && value !== undefined;
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;
189
70
  }
190
- function stringOrArrayIsSetAndEmpty(value) {
191
- return value !== null && value !== undefined && value.length === 0;
71
+ function __param(paramIndex, decorator) {
72
+ return function (target, key) { decorator(target, key, paramIndex); };
192
73
  }
193
- function useIfStringIsSet(s) {
194
- if (stringIsSetAndNotEmpty(s)) {
195
- return s;
196
- }
197
- return undefined;
74
+ function __metadata(metadataKey, metadataValue) {
75
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
+ return Reflect.metadata(metadataKey, metadataValue);
198
77
  }
199
- function useIfArrayIsSetWithOneItem(a) {
200
- if (!isNullOrUndefined(a) && a.length === 1) {
201
- return a[0];
202
- }
203
- return undefined;
204
- }
205
- function convertParentToChild(originalClass, newClass) {
206
- return Object.assign(newClass, originalClass);
207
- }
208
- function truncateString(s, length) {
209
- if (s.length < length) {
210
- return s;
211
- }
212
- return s.substring(0, length) + '...';
213
- }
214
-
215
- /**
216
- * This component is a base in order to create a component that supports ngModel.
217
- * Some important things to know about it:
218
- *
219
- * innerValue = your own inner state, which you should use to store the current state of what ngModel should be.
220
- * 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!
221
- * setInnerValueAndNotify() = call this when you want your ngModel to be updated from INSIDE of your component, and provide it to the OUTSIDE.
222
- * 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.
223
- */
224
- var ValueAccessorBase = /** @class */ (function () {
225
- function ValueAccessorBase(parent, controlContainer) {
226
- this.parent = parent;
227
- this.controlContainer = controlContainer;
228
- this.changed = new Array();
229
- this.touched = new Array();
230
- this.disabled = false;
231
- // we support both providing just the formControlName and the full formControl
232
- this.formControlName = null;
233
- this.formControl = null;
234
- }
235
- ValueAccessorBase.prototype.ngOnInit = function () {
236
- var _this = this;
237
- var _a, _b, _c;
238
- if (this.formControl) {
239
- this.attachedFormControl = this.formControl;
240
- }
241
- else if (stringIsSetAndNotEmpty(this.formControlName)) {
242
- this.attachedFormControl = (_a = this.controlContainer) === null || _a === void 0 ? void 0 : _a.control.get(this.formControlName);
243
- if (isNullOrUndefined(this.attachedFormControl)) {
244
- 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.");
245
- }
246
- }
247
- if (this.attachedFormControl) {
248
- this.disabled = this.attachedFormControl.disabled;
249
- this.attachedFormControl.statusChanges.subscribe(function () {
250
- _this.disabled = _this.attachedFormControl.disabled;
251
- });
252
- (_c = this.parent) === null || _c === void 0 ? void 0 : _c.registerControl(this.attachedFormControl);
253
- }
254
- };
255
- ValueAccessorBase.prototype.isInErrorState = function () {
256
- return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
257
- };
258
- ValueAccessorBase.prototype.ngOnDestroy = function () {
259
- var _a;
260
- if (this.attachedFormControl) {
261
- (_a = this.parent) === null || _a === void 0 ? void 0 : _a.unregisterControl(this.attachedFormControl);
262
- }
263
- };
264
- ValueAccessorBase.prototype.touch = function () {
265
- this.touched.forEach(function (f) { return f(); });
266
- };
267
- ValueAccessorBase.prototype.writeValue = function (value) {
268
- this.innerValue = value;
269
- };
270
- ValueAccessorBase.prototype.registerOnChange = function (fn) {
271
- this.changed.push(fn);
272
- };
273
- ValueAccessorBase.prototype.registerOnTouched = function (fn) {
274
- this.touched.push(fn);
275
- };
276
- ValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
277
- this.innerValue = value;
278
- this.changed.forEach(function (fn) { return fn(value); });
279
- };
280
- ValueAccessorBase.prototype.resetToNull = function () {
281
- this.setInnerValueAndNotify(null);
282
- };
283
- return ValueAccessorBase;
284
- }());
285
- ValueAccessorBase.decorators = [
286
- { type: core.Component, args: [{
287
- selector: '',
288
- template: ''
289
- },] }
290
- ];
291
- ValueAccessorBase.ctorParameters = function () { return [
292
- { type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
293
- { type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] }
294
- ]; };
295
- ValueAccessorBase.propDecorators = {
296
- disabled: [{ type: core.Input }],
297
- formControlName: [{ type: core.Input }],
298
- formControl: [{ type: core.Input }]
299
- };
300
-
301
- var ButtonComponent = /** @class */ (function () {
302
- function ButtonComponent() {
303
- this.variant = 'white';
304
- this.size = 'medium';
305
- this.fullWidth = false;
306
- this.hasBorder = true;
307
- this.disabled = false;
308
- this.isLoading = false;
309
- this.type = 'button';
310
- }
311
- Object.defineProperty(ButtonComponent.prototype, "_", {
312
- get: function () {
313
- return this.fullWidth;
314
- },
315
- enumerable: false,
316
- configurable: true
317
- });
318
- ButtonComponent.prototype.onClick = function (event) {
319
- if (this.disabled) {
320
- event.stopPropagation();
321
- }
322
- };
323
- return ButtonComponent;
324
- }());
325
- ButtonComponent.decorators = [
326
- { type: core.Component, args: [{
327
- selector: 'klp-form-button',
328
- 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",
329
- 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}"]
330
- },] }
331
- ];
332
- ButtonComponent.propDecorators = {
333
- variant: [{ type: core.Input }],
334
- size: [{ type: core.Input }],
335
- fullWidth: [{ type: core.Input }],
336
- hasBorder: [{ type: core.Input }],
337
- disabled: [{ type: core.Input }],
338
- isLoading: [{ type: core.Input }],
339
- type: [{ type: core.Input }],
340
- _: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
341
- };
342
-
343
- /*! *****************************************************************************
344
- Copyright (c) Microsoft Corporation.
345
-
346
- Permission to use, copy, modify, and/or distribute this software for any
347
- purpose with or without fee is hereby granted.
348
-
349
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
350
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
351
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
352
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
353
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
354
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
355
- PERFORMANCE OF THIS SOFTWARE.
356
- ***************************************************************************** */
357
- /* global Reflect, Promise */
358
- var extendStatics = function (d, b) {
359
- extendStatics = Object.setPrototypeOf ||
360
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
361
- function (d, b) { for (var p in b)
362
- if (Object.prototype.hasOwnProperty.call(b, p))
363
- d[p] = b[p]; };
364
- return extendStatics(d, b);
365
- };
366
- function __extends(d, b) {
367
- if (typeof b !== "function" && b !== null)
368
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
369
- extendStatics(d, b);
370
- function __() { this.constructor = d; }
371
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
372
- }
373
- var __assign = function () {
374
- __assign = Object.assign || function __assign(t) {
375
- for (var s, i = 1, n = arguments.length; i < n; i++) {
376
- s = arguments[i];
377
- for (var p in s)
378
- if (Object.prototype.hasOwnProperty.call(s, p))
379
- t[p] = s[p];
380
- }
381
- return t;
382
- };
383
- return __assign.apply(this, arguments);
384
- };
385
- function __rest(s, e) {
386
- var t = {};
387
- for (var p in s)
388
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
389
- t[p] = s[p];
390
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
391
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
392
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
393
- t[p[i]] = s[p[i]];
394
- }
395
- return t;
396
- }
397
- function __decorate(decorators, target, key, desc) {
398
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
399
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
400
- r = Reflect.decorate(decorators, target, key, desc);
401
- else
402
- for (var i = decorators.length - 1; i >= 0; i--)
403
- if (d = decorators[i])
404
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
405
- return c > 3 && r && Object.defineProperty(target, key, r), r;
406
- }
407
- function __param(paramIndex, decorator) {
408
- return function (target, key) { decorator(target, key, paramIndex); };
409
- }
410
- function __metadata(metadataKey, metadataValue) {
411
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
412
- return Reflect.metadata(metadataKey, metadataValue);
413
- }
414
- function __awaiter(thisArg, _arguments, P, generator) {
415
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
416
- return new (P || (P = Promise))(function (resolve, reject) {
417
- function fulfilled(value) { try {
418
- step(generator.next(value));
419
- }
420
- catch (e) {
421
- reject(e);
422
- } }
423
- function rejected(value) { try {
424
- step(generator["throw"](value));
425
- }
426
- catch (e) {
427
- reject(e);
428
- } }
429
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
430
- step((generator = generator.apply(thisArg, _arguments || [])).next());
431
- });
78
+ function __awaiter(thisArg, _arguments, P, generator) {
79
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
80
+ return new (P || (P = Promise))(function (resolve, reject) {
81
+ function fulfilled(value) { try {
82
+ step(generator.next(value));
83
+ }
84
+ catch (e) {
85
+ reject(e);
86
+ } }
87
+ function rejected(value) { try {
88
+ step(generator["throw"](value));
89
+ }
90
+ catch (e) {
91
+ reject(e);
92
+ } }
93
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
94
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
95
+ });
432
96
  }
433
97
  function __generator(thisArg, body) {
434
98
  var _ = { label: 0, sent: function () { if (t[0] & 1)
@@ -539,124 +203,520 @@
539
203
  catch (error) {
540
204
  e = { error: error };
541
205
  }
542
- finally {
543
- try {
544
- if (r && !r.done && (m = i["return"]))
545
- m.call(i);
546
- }
547
- finally {
548
- if (e)
549
- throw e.error;
206
+ finally {
207
+ try {
208
+ if (r && !r.done && (m = i["return"]))
209
+ m.call(i);
210
+ }
211
+ finally {
212
+ if (e)
213
+ throw e.error;
214
+ }
215
+ }
216
+ return ar;
217
+ }
218
+ /** @deprecated */
219
+ function __spread() {
220
+ for (var ar = [], i = 0; i < arguments.length; i++)
221
+ ar = ar.concat(__read(arguments[i]));
222
+ return ar;
223
+ }
224
+ /** @deprecated */
225
+ function __spreadArrays() {
226
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
227
+ s += arguments[i].length;
228
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
229
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
230
+ r[k] = a[j];
231
+ return r;
232
+ }
233
+ function __spreadArray(to, from, pack) {
234
+ if (pack || arguments.length === 2)
235
+ for (var i = 0, l = from.length, ar; i < l; i++) {
236
+ if (ar || !(i in from)) {
237
+ if (!ar)
238
+ ar = Array.prototype.slice.call(from, 0, i);
239
+ ar[i] = from[i];
240
+ }
241
+ }
242
+ return to.concat(ar || Array.prototype.slice.call(from));
243
+ }
244
+ function __await(v) {
245
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
246
+ }
247
+ function __asyncGenerator(thisArg, _arguments, generator) {
248
+ if (!Symbol.asyncIterator)
249
+ throw new TypeError("Symbol.asyncIterator is not defined.");
250
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
251
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
252
+ function verb(n) { if (g[n])
253
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
254
+ function resume(n, v) { try {
255
+ step(g[n](v));
256
+ }
257
+ catch (e) {
258
+ settle(q[0][3], e);
259
+ } }
260
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
261
+ function fulfill(value) { resume("next", value); }
262
+ function reject(value) { resume("throw", value); }
263
+ function settle(f, v) { if (f(v), q.shift(), q.length)
264
+ resume(q[0][0], q[0][1]); }
265
+ }
266
+ function __asyncDelegator(o) {
267
+ var i, p;
268
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
269
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
270
+ }
271
+ function __asyncValues(o) {
272
+ if (!Symbol.asyncIterator)
273
+ throw new TypeError("Symbol.asyncIterator is not defined.");
274
+ var m = o[Symbol.asyncIterator], i;
275
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
276
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
277
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
278
+ }
279
+ function __makeTemplateObject(cooked, raw) {
280
+ if (Object.defineProperty) {
281
+ Object.defineProperty(cooked, "raw", { value: raw });
282
+ }
283
+ else {
284
+ cooked.raw = raw;
285
+ }
286
+ return cooked;
287
+ }
288
+ ;
289
+ var __setModuleDefault = Object.create ? (function (o, v) {
290
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
291
+ }) : function (o, v) {
292
+ o["default"] = v;
293
+ };
294
+ function __importStar(mod) {
295
+ if (mod && mod.__esModule)
296
+ return mod;
297
+ var result = {};
298
+ if (mod != null)
299
+ for (var k in mod)
300
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
301
+ __createBinding(result, mod, k);
302
+ __setModuleDefault(result, mod);
303
+ return result;
304
+ }
305
+ function __importDefault(mod) {
306
+ return (mod && mod.__esModule) ? mod : { default: mod };
307
+ }
308
+ function __classPrivateFieldGet(receiver, state, kind, f) {
309
+ if (kind === "a" && !f)
310
+ throw new TypeError("Private accessor was defined without a getter");
311
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
312
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
313
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
314
+ }
315
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
316
+ if (kind === "m")
317
+ throw new TypeError("Private method is not writable");
318
+ if (kind === "a" && !f)
319
+ throw new TypeError("Private accessor was defined without a setter");
320
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
321
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
322
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
323
+ }
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;
550
618
  }
551
- }
552
- return ar;
553
- }
554
- /** @deprecated */
555
- function __spread() {
556
- for (var ar = [], i = 0; i < arguments.length; i++)
557
- ar = ar.concat(__read(arguments[i]));
558
- return ar;
559
- }
560
- /** @deprecated */
561
- function __spreadArrays() {
562
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
563
- s += arguments[i].length;
564
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
565
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
566
- r[k] = a[j];
567
- return r;
568
- }
569
- function __spreadArray(to, from, pack) {
570
- if (pack || arguments.length === 2)
571
- for (var i = 0, l = from.length, ar; i < l; i++) {
572
- if (ar || !(i in from)) {
573
- if (!ar)
574
- ar = Array.prototype.slice.call(from, 0, i);
575
- ar[i] = from[i];
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.");
576
623
  }
577
624
  }
578
- return to.concat(ar || Array.prototype.slice.call(from));
579
- }
580
- function __await(v) {
581
- return this instanceof __await ? (this.v = v, this) : new __await(v);
582
- }
583
- function __asyncGenerator(thisArg, _arguments, generator) {
584
- if (!Symbol.asyncIterator)
585
- throw new TypeError("Symbol.asyncIterator is not defined.");
586
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
587
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
588
- function verb(n) { if (g[n])
589
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
590
- function resume(n, v) { try {
591
- step(g[n](v));
592
- }
593
- catch (e) {
594
- settle(q[0][3], e);
595
- } }
596
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
597
- function fulfill(value) { resume("next", value); }
598
- function reject(value) { resume("throw", value); }
599
- function settle(f, v) { if (f(v), q.shift(), q.length)
600
- resume(q[0][0], q[0][1]); }
601
- }
602
- function __asyncDelegator(o) {
603
- var i, p;
604
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
605
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
606
- }
607
- function __asyncValues(o) {
608
- if (!Symbol.asyncIterator)
609
- throw new TypeError("Symbol.asyncIterator is not defined.");
610
- var m = o[Symbol.asyncIterator], i;
611
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
612
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
613
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
614
- }
615
- function __makeTemplateObject(cooked, raw) {
616
- if (Object.defineProperty) {
617
- Object.defineProperty(cooked, "raw", { value: raw });
618
- }
619
- else {
620
- cooked.raw = raw;
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';
621
688
  }
622
- return cooked;
623
- }
624
- ;
625
- var __setModuleDefault = Object.create ? (function (o, v) {
626
- Object.defineProperty(o, "default", { enumerable: true, value: v });
627
- }) : function (o, v) {
628
- o["default"] = v;
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',] }]
629
719
  };
630
- function __importStar(mod) {
631
- if (mod && mod.__esModule)
632
- return mod;
633
- var result = {};
634
- if (mod != null)
635
- for (var k in mod)
636
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
637
- __createBinding(result, mod, k);
638
- __setModuleDefault(result, mod);
639
- return result;
640
- }
641
- function __importDefault(mod) {
642
- return (mod && mod.__esModule) ? mod : { default: mod };
643
- }
644
- function __classPrivateFieldGet(receiver, state, kind, f) {
645
- if (kind === "a" && !f)
646
- throw new TypeError("Private accessor was defined without a getter");
647
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
648
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
649
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
650
- }
651
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
652
- if (kind === "m")
653
- throw new TypeError("Private method is not writable");
654
- if (kind === "a" && !f)
655
- throw new TypeError("Private accessor was defined without a setter");
656
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
657
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
658
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
659
- }
660
720
 
661
721
  var CheckboxComponent = /** @class */ (function (_super) {
662
722
  __extends(CheckboxComponent, _super);
@@ -767,6 +827,7 @@
767
827
  _this.placeholder = 'Pick an option';
768
828
  _this.multiple = false;
769
829
  _this.clearable = true;
830
+ _this.onSearch = new core.EventEmitter();
770
831
  return _this;
771
832
  }
772
833
  return SelectComponent;
@@ -774,9 +835,9 @@
774
835
  SelectComponent.decorators = [
775
836
  { type: core.Component, args: [{
776
837
  selector: 'klp-form-select',
777
- template: "<ng-select\n\t[placeholder]=\"placeholder\"\n\tbindLabel=\"name\"\n\tbindValue=\"id\"\n\t[items]=\"options\"\n\t[clearable]=\"clearable\"\n\t[(ngModel)]=\"innerValue\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t(change)=\"setInnerValueAndNotify(innerValue)\"\n\t[multiple]=\"multiple\"\n\t[disabled]=\"disabled\"\n\t(blur)=\"touch()\"\n\t[dropdownPosition]=\"dropdownPosition\"\n\t[searchFn]=\"customSearchFn\"\n>\n\t<ng-template let-item=\"item\" ng-option-tmp>\n\t\t{{ item.name }}\n\t\t<div *ngIf=\"item.description\" class=\"dropdown-item-description\">\n\t\t\t{{ item.description }}\n\t\t</div>\n\t</ng-template>\n</ng-select>\n",
838
+ template: "<ng-select\n\t[placeholder]=\"placeholder\"\n\tbindLabel=\"name\"\n\tbindValue=\"id\"\n\t[items]=\"options\"\n\t[clearable]=\"clearable\"\n\t[(ngModel)]=\"innerValue\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t(change)=\"setInnerValueAndNotify(innerValue)\"\n\t[multiple]=\"multiple\"\n\t[disabled]=\"disabled\"\n\t(blur)=\"touch()\"\n\t(search)=\"onSearch.emit($event.term)\"\n\t[dropdownPosition]=\"dropdownPosition\"\n\t[searchFn]=\"customSearchFn\"\n>\n\t<ng-template let-item=\"item\" ng-option-tmp>\n\t\t{{ item.name }}\n\t\t<div *ngIf=\"item.description\" class=\"dropdown-item-description\">\n\t\t\t{{ item.description }}\n\t\t</div>\n\t</ng-template>\n</ng-select>\n",
778
839
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }],
779
- styles: [":host{display:block}.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{border-color:transparent transparent #999;border-width:0 5px 5px;top:-2px}: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-left-radius:0;border-bottom-right-radius:0}:host ::ng-deep .ng-select.ng-select-opened.ng-select-top>.ng-select-container{border-top-left-radius:0;border-top-right-radius:0}:host ::ng-deep .ng-select.ng-select-disabled>.ng-select-container{background-color:#f9f9f9}:host ::ng-deep .ng-select .ng-has-value .ng-placeholder{display:none}:host ::ng-deep .ng-select .ng-select-container{align-items:center;background-clip:padding-box;background-color:#fff;border:1px solid #e6ecf5;border-radius:4px;border-radius:2px;box-shadow:none;box-sizing:border-box;color:#888da8;display:flex;flex-direction:row;font-size:1rem;font-size:14px;line-height:1.5;margin:0;min-height:42px;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 0 rgba(0,0,0,.06)}:host ::ng-deep .ng-select .ng-select-container .ng-value-container{align-items:center;overflow:hidden;padding-left:10px}: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{padding-left:7px;padding-right:10px;padding-top:2px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{background-color:#e7faee;border:1px solid #93e8b3;border-radius:2px;display:flex;font-size:.9em;margin-bottom:5px;margin-right:5px;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;overflow:hidden;padding:0 5px;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{padding-bottom:3px;padding-left:3px;position:static;top:5px}:host ::ng-deep .ng-select .ng-clear-wrapper{color:#999}:host ::ng-deep .ng-select .ng-clear-wrapper .ng-clear:hover{color:#ff3c7e}: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 0 rgba(0,0,0,.06)}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-top-color:#e6e6e6;margin-top:-1px;top:100%}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom .ng-dropdown-panel-items .ng-option:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px}:host ::ng-deep .ng-dropdown-panel.ng-select-top{border-bottom-color:#e6e6e6;border-top-left-radius:4px;border-top-right-radius:4px;bottom:100%;margin-bottom:-1px}:host ::ng-deep .ng-dropdown-panel.ng-select-top .ng-dropdown-panel-items .ng-option:first-child{border-top-left-radius:4px;border-top-right-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{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;color:rgba(0,0,0,.54);cursor:default;cursor:pointer;font-weight:500;padding:8px 10px;user-select:none}: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:rgba(0,0,0,.87);padding:8px 10px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected{background-color:#e7faee;color:#333}: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{font-size:80%;font-weight:400;padding-right:5px}: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{color:#888da8;top:9px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option,:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-input>input{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}"]
840
+ styles: [":host{display:block}.showErrors ::ng-deep .ng-select-container,:host.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{border-color:transparent transparent #999;border-width:0 5px 5px;top:-2px}: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-left-radius:0;border-bottom-right-radius:0}:host ::ng-deep .ng-select.ng-select-opened.ng-select-top>.ng-select-container{border-top-left-radius:0;border-top-right-radius:0}:host ::ng-deep .ng-select.ng-select-disabled>.ng-select-container{background-color:#f9f9f9}:host ::ng-deep .ng-select .ng-has-value .ng-placeholder{display:none}:host ::ng-deep .ng-select .ng-select-container{align-items:center;background-clip:padding-box;background-color:#fff;border:1px solid #e6ecf5;border-radius:4px;border-radius:2px;box-shadow:none;box-sizing:border-box;color:#888da8;display:flex;flex-direction:row;font-size:1rem;font-size:14px;line-height:1.5;margin:0;min-height:42px;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 0 rgba(0,0,0,.06)}:host ::ng-deep .ng-select .ng-select-container .ng-value-container{align-items:center;overflow:hidden;padding-left:10px}: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{padding-left:7px;padding-right:10px;padding-top:2px}:host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{background-color:#e7faee;border:1px solid #93e8b3;border-radius:2px;display:flex;font-size:.9em;margin-bottom:5px;margin-right:5px;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;overflow:hidden;padding:0 5px;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{padding-bottom:3px;padding-left:3px;position:static;top:5px}:host ::ng-deep .ng-select .ng-clear-wrapper{color:#999}:host ::ng-deep .ng-select .ng-clear-wrapper .ng-clear:hover{color:#ff3c7e}: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 0 rgba(0,0,0,.06)}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-top-color:#e6e6e6;margin-top:-1px;top:100%}:host ::ng-deep .ng-dropdown-panel.ng-select-bottom .ng-dropdown-panel-items .ng-option:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px}:host ::ng-deep .ng-dropdown-panel.ng-select-top{border-bottom-color:#e6e6e6;border-top-left-radius:4px;border-top-right-radius:4px;bottom:100%;margin-bottom:-1px}:host ::ng-deep .ng-dropdown-panel.ng-select-top .ng-dropdown-panel-items .ng-option:first-child{border-top-left-radius:4px;border-top-right-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{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;color:rgba(0,0,0,.54);cursor:default;cursor:pointer;font-weight:500;padding:8px 10px;user-select:none}: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:rgba(0,0,0,.87);padding:8px 10px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected{background-color:#e7faee;color:#333}: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{font-size:80%;font-weight:400;padding-right:5px}: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{color:#888da8;top:9px}:host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option,:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-input>input{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}"]
780
841
  },] }
781
842
  ];
782
843
  SelectComponent.ctorParameters = function () { return [
@@ -789,7 +850,8 @@
789
850
  multiple: [{ type: core.Input }],
790
851
  clearable: [{ type: core.Input }],
791
852
  dropdownPosition: [{ type: core.Input }],
792
- customSearchFn: [{ type: core.Input }]
853
+ customSearchFn: [{ type: core.Input }],
854
+ onSearch: [{ type: core.Output }]
793
855
  };
794
856
 
795
857
  var SortableItemsComponent = /** @class */ (function (_super) {
@@ -945,11 +1007,21 @@
945
1007
  .trySubmit()
946
1008
  .then(function (value) {
947
1009
  _this.isLoading = true;
948
- _this.submitCallback(value)
949
- .then(function () { return (_this.isLoading = false); })
950
- .catch(function () { return (_this.isLoading = false); });
1010
+ var submitCallbackResult = _this.submitCallback(value);
1011
+ if (isNullOrUndefined(submitCallbackResult)) {
1012
+ throw new Error('No promise is returned in your submit function.');
1013
+ }
1014
+ return submitCallbackResult.then(function () { return (_this.isLoading = false); }).catch(function (e) {
1015
+ _this.isLoading = false;
1016
+ throw e;
1017
+ });
951
1018
  })
952
- .catch(function () { }); // swallow the error, the framework will scroll to the field that needs attention
1019
+ .catch(function (e) {
1020
+ if (e === invalidFieldsSymbol) {
1021
+ return; // swallow the error, the framework will scroll to the field that needs attention
1022
+ }
1023
+ throw e;
1024
+ });
953
1025
  };
954
1026
  return FormSubmitButtonComponent;
955
1027
  }());
@@ -1180,11 +1252,13 @@
1180
1252
  exports.PasswordFieldComponent = PasswordFieldComponent;
1181
1253
  exports.SelectComponent = SelectComponent;
1182
1254
  exports.SortableItemsComponent = SortableItemsComponent;
1255
+ exports.SubForm = SubForm;
1183
1256
  exports.TextInputComponent = TextInputComponent;
1184
1257
  exports.ToggleComponent = ToggleComponent;
1185
1258
  exports.ValueAccessorBase = ValueAccessorBase;
1186
1259
  exports.dateValidator = dateValidator;
1187
1260
  exports.invalidDateKey = invalidDateKey;
1261
+ exports.invalidFieldsSymbol = invalidFieldsSymbol;
1188
1262
  exports.matDateFormatsFactory = matDateFormatsFactory;
1189
1263
  exports["ɵa"] = MaterialModule;
1190
1264