@klippa/ngx-enhancy-forms 3.0.0 → 5.1.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.
Files changed (39) hide show
  1. package/bundles/klippa-ngx-enhancy-forms.umd.js +987 -492
  2. package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -1
  3. package/bundles/klippa-ngx-enhancy-forms.umd.min.js +3 -2
  4. package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -1
  5. package/esm2015/lib/elements/date-picker/date-picker.component.js +92 -0
  6. package/esm2015/lib/elements/date-time-picker/date-time-picker.component.js +311 -0
  7. package/esm2015/lib/elements/email/email-input.component.js +2 -2
  8. package/esm2015/lib/elements/password-field/password-field.component.js +6 -4
  9. package/esm2015/lib/elements/select/select-footer/select-footer.component.js +15 -0
  10. package/esm2015/lib/elements/select/select.component.js +30 -9
  11. package/esm2015/lib/elements/sortable-items/sortable-items.component.js +46 -4
  12. package/esm2015/lib/elements/text-input/text-input.component.js +7 -4
  13. package/esm2015/lib/elements/value-accessor-base/multiple-value-accessor-base.component.js +63 -0
  14. package/esm2015/lib/elements/value-accessor-base/value-accessor-base.component.js +25 -7
  15. package/esm2015/lib/form/form-element/form-element.component.js +25 -17
  16. package/esm2015/lib/form/form.component.js +47 -20
  17. package/esm2015/lib/ngx-enhancy-forms.module.js +13 -4
  18. package/esm2015/lib/util/values.js +11 -17
  19. package/esm2015/public-api.js +5 -2
  20. package/fesm2015/klippa-ngx-enhancy-forms.js +575 -100
  21. package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
  22. package/klippa-ngx-enhancy-forms.metadata.json +1 -1
  23. package/lib/elements/date-picker/date-picker.component.d.ts +23 -0
  24. package/lib/elements/date-time-picker/date-time-picker.component.d.ts +59 -0
  25. package/lib/elements/email/email-input.component.d.ts +1 -1
  26. package/lib/elements/password-field/password-field.component.d.ts +2 -1
  27. package/lib/elements/select/select-footer/select-footer.component.d.ts +4 -0
  28. package/lib/elements/select/select.component.d.ts +12 -4
  29. package/lib/elements/sortable-items/sortable-items.component.d.ts +12 -2
  30. package/lib/elements/text-input/text-input.component.d.ts +2 -0
  31. package/lib/elements/value-accessor-base/multiple-value-accessor-base.component.d.ts +11 -0
  32. package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +5 -1
  33. package/lib/form/form-element/form-element.component.d.ts +10 -6
  34. package/lib/form/form.component.d.ts +8 -7
  35. package/lib/util/values.d.ts +3 -4
  36. package/package.json +1 -1
  37. package/public-api.d.ts +4 -1
  38. package/esm2015/lib/elements/datepicker/datepicker.component.js +0 -111
  39. package/lib/elements/datepicker/datepicker.component.d.ts +0 -26
@@ -1,414 +1,113 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('lodash'), require('ngx-sortablejs'), require('@ng-select/ng-select'), require('@angular/material/core'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/button')) :
3
- typeof define === 'function' && define.amd ? define('@klippa/ngx-enhancy-forms', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'lodash', 'ngx-sortablejs', '@ng-select/ng-select', '@angular/material/core', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@angular/material/button'], factory) :
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
- })(this, (function (exports, core, common, forms, lodash, ngxSortablejs, ngSelect, core$1, datepicker, formField, input, button) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('lodash'), require('ngx-sortablejs'), require('@ng-select/ng-select'), require('date-fns'), require('@angular/material/core'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/button')) :
3
+ typeof define === 'function' && define.amd ? define('@klippa/ngx-enhancy-forms', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'lodash', 'ngx-sortablejs', '@ng-select/ng-select', 'date-fns', '@angular/material/core', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@angular/material/button'], factory) :
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.dateFns, global.ng.material.core, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global.ng.material.button));
5
+ })(this, (function (exports, core, common, forms, lodash, ngxSortablejs, ngSelect, dateFns, core$1, datepicker, formField, input, button) { 'use strict';
6
6
 
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
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);
29
- };
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];
44
- }
45
- return t;
46
- };
47
- return __assign.apply(this, arguments);
48
- };
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;
7
+ function stringIsSetAndFilled(s) {
8
+ return lodash.isString(s) && s.length > 0;
60
9
  }
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;
10
+ function isNullOrUndefined(value) {
11
+ return value === null || value === undefined;
70
12
  }
71
- function __param(paramIndex, decorator) {
72
- return function (target, key) { decorator(target, key, paramIndex); };
13
+ function numberIsSet(value) {
14
+ return isValueSet(value) && typeof value === 'number';
73
15
  }
74
- function __metadata(metadataKey, metadataValue) {
75
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
- return Reflect.metadata(metadataKey, metadataValue);
16
+ function isValueSet(value) {
17
+ return value !== null && value !== undefined;
77
18
  }
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());
19
+ function removeDuplicatesFromArray(array) {
20
+ return array.filter(function (c, i) {
21
+ var firstOccurrenceIndex = array.findIndex(function (c2) { return c2 === c; });
22
+ return i === firstOccurrenceIndex;
95
23
  });
96
24
  }
97
- function __generator(thisArg, body) {
98
- var _ = { label: 0, sent: function () { if (t[0] & 1)
99
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
100
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
101
- function verb(n) { return function (v) { return step([n, v]); }; }
102
- function step(op) {
103
- if (f)
104
- throw new TypeError("Generator is already executing.");
105
- while (_)
106
- try {
107
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
108
- return t;
109
- if (y = 0, t)
110
- op = [op[0] & 2, t.value];
111
- switch (op[0]) {
112
- case 0:
113
- case 1:
114
- t = op;
115
- break;
116
- case 4:
117
- _.label++;
118
- return { value: op[1], done: false };
119
- case 5:
120
- _.label++;
121
- y = op[1];
122
- op = [0];
123
- continue;
124
- case 7:
125
- op = _.ops.pop();
126
- _.trys.pop();
127
- continue;
128
- default:
129
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
130
- _ = 0;
131
- continue;
132
- }
133
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
134
- _.label = op[1];
135
- break;
136
- }
137
- if (op[0] === 6 && _.label < t[1]) {
138
- _.label = t[1];
139
- t = op;
140
- break;
141
- }
142
- if (t && _.label < t[2]) {
143
- _.label = t[2];
144
- _.ops.push(op);
145
- break;
146
- }
147
- if (t[2])
148
- _.ops.pop();
149
- _.trys.pop();
150
- continue;
151
- }
152
- op = body.call(thisArg, _);
153
- }
154
- catch (e) {
155
- op = [6, e];
156
- y = 0;
157
- }
158
- finally {
159
- f = t = 0;
160
- }
161
- if (op[0] & 5)
162
- throw op[1];
163
- return { value: op[0] ? op[1] : void 0, done: true };
164
- }
25
+ function stringOrArrayIsSetAndEmpty(value) {
26
+ return value !== null && value !== undefined && value.length === 0;
165
27
  }
166
- var __createBinding = Object.create ? (function (o, m, k, k2) {
167
- if (k2 === undefined)
168
- k2 = k;
169
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
170
- }) : (function (o, m, k, k2) {
171
- if (k2 === undefined)
172
- k2 = k;
173
- o[k2] = m[k];
174
- });
175
- function __exportStar(m, o) {
176
- for (var p in m)
177
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
178
- __createBinding(o, m, p);
28
+ function truncateString(s, length) {
29
+ if (s.length < length) {
30
+ return s;
31
+ }
32
+ return s.substring(0, length) + '...';
179
33
  }
180
- function __values(o) {
181
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
182
- if (m)
183
- return m.call(o);
184
- if (o && typeof o.length === "number")
185
- return {
186
- next: function () {
187
- if (o && i >= o.length)
188
- o = void 0;
189
- return { value: o && o[i++], done: !o };
190
- }
191
- };
192
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
34
+ function arrayIsSetAndFilled(arr) {
35
+ return arr !== null && arr !== undefined && arr.length > 0;
193
36
  }
194
- function __read(o, n) {
195
- var m = typeof Symbol === "function" && o[Symbol.iterator];
196
- if (!m)
197
- return o;
198
- var i = m.call(o), r, ar = [], e;
199
- try {
200
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
201
- ar.push(r.value);
37
+
38
+ var invalidFieldsSymbol = Symbol('Not all fields are valid');
39
+ var SubFormDirective = /** @class */ (function () {
40
+ function SubFormDirective() {
202
41
  }
203
- catch (error) {
204
- e = { error: error };
42
+ return SubFormDirective;
43
+ }());
44
+ SubFormDirective.decorators = [
45
+ { type: core.Directive, args: [{
46
+ // tslint:disable-next-line:directive-selector
47
+ selector: 'klp-sub-form',
48
+ },] }
49
+ ];
50
+ SubFormDirective.propDecorators = {
51
+ injectInto: [{ type: core.Input }],
52
+ at: [{ type: core.Input }]
53
+ };
54
+ var FormComponent = /** @class */ (function () {
55
+ function FormComponent(parent, subFormPlaceholder) {
56
+ this.parent = parent;
57
+ this.subFormPlaceholder = subFormPlaceholder;
58
+ // we keep track of what form controls are actually rendered. Only those count when looking at form validation
59
+ this.activeControls = [];
205
60
  }
206
- finally {
207
- try {
208
- if (r && !r.done && (m = i["return"]))
209
- m.call(i);
61
+ FormComponent.prototype.ngOnInit = function () {
62
+ if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
63
+ var injectInto = this.subFormPlaceholder.injectInto;
64
+ var injectAt = this.subFormPlaceholder.at;
65
+ if (injectInto instanceof forms.FormArray) {
66
+ if (typeof injectAt !== 'number') {
67
+ throw new Error("cannot index FormArray with " + typeof injectAt);
68
+ }
69
+ injectInto.setControl(injectAt, this.formGroup);
70
+ }
71
+ else if (injectInto instanceof forms.FormGroup) {
72
+ if (typeof injectAt !== 'string') {
73
+ throw new Error("cannot index FormGroup with " + typeof injectAt);
74
+ }
75
+ injectInto.setControl(injectAt, this.formGroup);
76
+ }
210
77
  }
211
- finally {
212
- if (e)
213
- throw e.error;
78
+ if (isValueSet(this.patchValueInterceptor)) {
79
+ this.addSupportForPatchValueInterceptor();
214
80
  }
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
- var SubFormDirective = /** @class */ (function () {
364
- function SubFormDirective() {
365
- }
366
- return SubFormDirective;
367
- }());
368
- SubFormDirective.decorators = [
369
- { type: core.Directive, args: [{
370
- // tslint:disable-next-line:directive-selector
371
- selector: 'klp-sub-form',
372
- },] }
373
- ];
374
- SubFormDirective.propDecorators = {
375
- injectInto: [{ type: core.Input }]
376
- };
377
- // Only used as a 'marker' to define a property will be filled in by a sub form
378
- var SubForm = /** @class */ (function (_super) {
379
- __extends(SubForm, _super);
380
- function SubForm() {
381
- return _super.call(this, {}, null) || this;
382
- }
383
- return SubForm;
384
- }(forms.FormGroup));
385
- var FormComponent = /** @class */ (function () {
386
- function FormComponent(parent, subFormPlaceholder) {
387
- this.parent = parent;
388
- this.subFormPlaceholder = subFormPlaceholder;
389
- // we keep track of what form controls are actually rendered. Only those count when looking at form validation
390
- this.activeControls = [];
391
- }
392
- FormComponent.prototype.ngOnInit = function () {
81
+ };
82
+ FormComponent.prototype.ngOnDestroy = function () {
393
83
  var _this = this;
394
84
  if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
395
- var parentOfInjectInto = this.subFormPlaceholder.injectInto.parent;
396
- if (parentOfInjectInto instanceof forms.FormArray) {
397
- var i = parentOfInjectInto.controls.findIndex(function (e) { return e === _this.subFormPlaceholder.injectInto; });
398
- parentOfInjectInto.setControl(i, this.formGroup);
85
+ var injectInto = this.subFormPlaceholder.injectInto;
86
+ var injectAt = this.subFormPlaceholder.at;
87
+ if (injectInto instanceof forms.FormArray) {
88
+ var idx = injectInto.controls.findIndex(function (e) { return e === _this.formGroup; });
89
+ injectInto.removeAt(idx);
399
90
  }
400
- else if (parentOfInjectInto instanceof forms.FormGroup) {
401
- var toReplace = Object.entries(parentOfInjectInto.controls).find(function (_c) {
402
- var _d = __read(_c, 2), key = _d[0], val = _d[1];
403
- return val === _this.subFormPlaceholder.injectInto;
404
- });
405
- if (!((toReplace === null || toReplace === void 0 ? void 0 : toReplace[1]) instanceof SubForm)) {
406
- throw new Error("You are trying to inject a subForm ('" + (toReplace === null || toReplace === void 0 ? void 0 : toReplace[0]) + "') within something that is not annotated as such.");
91
+ else if (injectInto instanceof forms.FormGroup) {
92
+ if (typeof injectAt !== 'string') {
93
+ throw new Error("cannot index FormGroup with " + typeof injectAt);
407
94
  }
408
- parentOfInjectInto.setControl(toReplace[0], this.formGroup);
95
+ injectInto.removeControl(injectAt);
409
96
  }
410
97
  }
411
98
  };
99
+ FormComponent.prototype.addSupportForPatchValueInterceptor = function () {
100
+ var _this = this;
101
+ var fn = this.formGroup.patchValue;
102
+ var newFn = function (value, options) {
103
+ _this.patchValueInterceptor(value).then(function (val) {
104
+ setTimeout(function () {
105
+ fn.call(_this.formGroup, val, options);
106
+ });
107
+ });
108
+ };
109
+ this.formGroup.patchValue = newFn;
110
+ };
412
111
  FormComponent.prototype.registerControl = function (formControl, formElement) {
413
112
  this.activeControls.push({ formControl: formControl, formElement: formElement });
414
113
  if (this.parent) {
@@ -465,6 +164,7 @@
465
164
  FormComponent.prototype.trySubmit = function () {
466
165
  var _this = this;
467
166
  var _a, _b;
167
+ this.formGroup.updateValueAndValidity();
468
168
  this.formGroup.markAllAsTouched();
469
169
  var allControls = this.getAllFormControls();
470
170
  var originalDisabledStates = allControls.map(function (e) {
@@ -506,20 +206,21 @@
506
206
  { type: SubFormDirective, decorators: [{ type: core.Optional }] }
507
207
  ]; };
508
208
  FormComponent.propDecorators = {
509
- formGroup: [{ type: core.Input }]
209
+ formGroup: [{ type: core.Input }],
210
+ patchValueInterceptor: [{ type: core.Input }]
510
211
  };
511
212
 
512
213
  var FORM_ERROR_MESSAGES = new core.InjectionToken('form.error.messages');
513
214
  var DEFAULT_ERROR_MESSAGES = {
514
- min: "Use a number larger than %min%",
515
- max: "Use a number smaller than %max%",
516
- required: "This field is required",
517
- email: "Use a valid email address",
518
- minLength: "Has to be longer than %minLength% character(s)",
519
- maxLength: "Has to be shorter than %maxLength% character(s)",
520
- pattern: "This input is not valid",
521
- matchPassword: "Passwords must match",
522
- date: "Enter a valid date",
215
+ min: 'Use a number larger than %min%',
216
+ max: 'Use a number smaller than %max%',
217
+ required: 'This field is required',
218
+ email: 'Use a valid email address',
219
+ minLength: 'Has to be longer than %minLength% character(s)',
220
+ maxLength: 'Has to be shorter than %maxLength% character(s)',
221
+ pattern: 'This input is not valid',
222
+ matchPassword: 'Passwords must match',
223
+ date: 'Enter a valid date',
523
224
  };
524
225
  var FormElementComponent = /** @class */ (function () {
525
226
  function FormElementComponent(parent, customMessages) {
@@ -527,6 +228,7 @@
527
228
  this.customMessages = customMessages;
528
229
  this.direction = 'horizontal';
529
230
  this.captionSpacing = 'percentages';
231
+ this.spaceDistribution = '40-60';
530
232
  this.swapInputAndCaption = false;
531
233
  this.errorMessages = DEFAULT_ERROR_MESSAGES;
532
234
  this.customErrorHandlers = [];
@@ -536,11 +238,11 @@
536
238
  return msg.replace("%" + key + "%", parameters[key]);
537
239
  }, message);
538
240
  };
539
- FormElementComponent.prototype.registerControl = function (formControl) {
540
- // console.log('register');
541
- // console.log(this.caption);
241
+ FormElementComponent.prototype.registerControl = function (formControl, input) {
242
+ if (input === void 0) { input = null; }
542
243
  this.attachedControl = formControl;
543
244
  this.parent.registerControl(formControl, this);
245
+ this.input = input;
544
246
  };
545
247
  FormElementComponent.prototype.unregisterControl = function (formControl) {
546
248
  this.attachedControl = null;
@@ -585,7 +287,13 @@
585
287
  // to give some breathing room, we scroll 100px more to the top
586
288
  (_a = this.getScrollableParent(this.internalComponentRef.nativeElement)) === null || _a === void 0 ? void 0 : _a.scrollBy(0, -100);
587
289
  };
588
- FormElementComponent.prototype.getErrorMessages = function (key) {
290
+ FormElementComponent.prototype.isRequired = function () {
291
+ if (isValueSet(this.input)) {
292
+ return this.input.hasValidator('required');
293
+ }
294
+ return false;
295
+ };
296
+ FormElementComponent.prototype.getErrorMessage = function (key) {
589
297
  var _a, _b, _c;
590
298
  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];
591
299
  };
@@ -594,8 +302,8 @@
594
302
  FormElementComponent.decorators = [
595
303
  { type: core.Component, args: [{
596
304
  selector: 'klp-form-element',
597
- 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",
598
- 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%}"]
305
+ template: "<ng-template #errorRef>\n\t<div *ngIf=\"getErrorToShow()\" class=\"errorContainer\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n<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\" *ngIf=\"caption || captionRef\" [ngClass]=\"{ hasErrors: getErrorToShow() && attachedControl.touched, percentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70' }\">\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\">&nbsp;*</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}<span *ngIf=\"isRequired()\">&nbsp;*</span></div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{ percentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70' }\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n",
306
+ styles: [":host{display:block}.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}.captionRefContainer{display:flex}.caption{color:#515365;flex:0 0 auto;font-weight:700}.caption.percentageSpacing{flex:0 0 40%}.caption.percentageSpacing.d30-70{flex-basis:30%}.caption.hasErrors{color:#ff8000}.inputContainer{flex:1}.inputContainer.percentageSpacing{flex:0 0 60%}.inputContainer.percentageSpacing.d30-70{flex-basis:70%}.errorContainer{color:#ff8000;margin-left:40%}.errorContainer.d30-70{margin-left:30%}"]
599
307
  },] }
600
308
  ];
601
309
  FormElementComponent.ctorParameters = function () { return [
@@ -606,6 +314,7 @@
606
314
  caption: [{ type: core.Input }],
607
315
  direction: [{ type: core.Input }],
608
316
  captionSpacing: [{ type: core.Input }],
317
+ spaceDistribution: [{ type: core.Input }],
609
318
  swapInputAndCaption: [{ type: core.Input }],
610
319
  internalComponentRef: [{ type: core.ViewChild, args: ['internalComponentRef',] }]
611
320
  };
@@ -629,14 +338,16 @@
629
338
  // we support both providing just the formControlName and the full formControl
630
339
  this.formControlName = null;
631
340
  this.formControl = null;
341
+ this.onTouch = new core.EventEmitter();
342
+ this.validators = [];
632
343
  }
633
344
  ValueAccessorBase.prototype.ngOnInit = function () {
634
345
  var _this = this;
635
- var _a, _b, _c;
346
+ var _a, _b, _c, _d;
636
347
  if (this.formControl) {
637
348
  this.attachedFormControl = this.formControl;
638
349
  }
639
- else if (stringIsSetAndNotEmpty(this.formControlName)) {
350
+ else if (stringIsSetAndFilled(this.formControlName)) {
640
351
  this.attachedFormControl = (_a = this.controlContainer) === null || _a === void 0 ? void 0 : _a.control.get(this.formControlName);
641
352
  if (isNullOrUndefined(this.attachedFormControl)) {
642
353
  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.");
@@ -647,7 +358,16 @@
647
358
  this.attachedFormControl.statusChanges.subscribe(function () {
648
359
  _this.disabled = _this.attachedFormControl.disabled;
649
360
  });
650
- (_c = this.parent) === null || _c === void 0 ? void 0 : _c.registerControl(this.attachedFormControl);
361
+ (_c = this.parent) === null || _c === void 0 ? void 0 : _c.registerControl(this.attachedFormControl, this);
362
+ if ((_d = this.attachedFormControl) === null || _d === void 0 ? void 0 : _d.validator) {
363
+ var vals = this.attachedFormControl.validator({});
364
+ if (isValueSet(vals)) {
365
+ this.validators = Object.keys(vals);
366
+ }
367
+ else {
368
+ this.validators = [];
369
+ }
370
+ }
651
371
  }
652
372
  };
653
373
  ValueAccessorBase.prototype.isInErrorState = function () {
@@ -678,6 +398,12 @@
678
398
  ValueAccessorBase.prototype.resetToNull = function () {
679
399
  this.setInnerValueAndNotify(null);
680
400
  };
401
+ ValueAccessorBase.prototype.hasValidator = function (validatorName) {
402
+ if (arrayIsSetAndFilled(this.validators)) {
403
+ return this.validators.includes(validatorName);
404
+ }
405
+ return false;
406
+ };
681
407
  return ValueAccessorBase;
682
408
  }());
683
409
  ValueAccessorBase.decorators = [
@@ -693,7 +419,8 @@
693
419
  ValueAccessorBase.propDecorators = {
694
420
  disabled: [{ type: core.Input }],
695
421
  formControlName: [{ type: core.Input }],
696
- formControl: [{ type: core.Input }]
422
+ formControl: [{ type: core.Input }],
423
+ onTouch: [{ type: core.Output }]
697
424
  };
698
425
 
699
426
  var ButtonComponent = /** @class */ (function () {
@@ -706,37 +433,355 @@
706
433
  this.isLoading = false;
707
434
  this.type = 'button';
708
435
  }
709
- Object.defineProperty(ButtonComponent.prototype, "_", {
710
- get: function () {
711
- return this.fullWidth;
712
- },
713
- enumerable: false,
714
- configurable: true
715
- });
716
- ButtonComponent.prototype.onClick = function (event) {
717
- if (this.disabled) {
718
- event.stopPropagation();
719
- }
720
- };
721
- return ButtonComponent;
722
- }());
723
- ButtonComponent.decorators = [
724
- { type: core.Component, args: [{
725
- selector: 'klp-form-button',
726
- 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",
727
- 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}"]
728
- },] }
729
- ];
730
- ButtonComponent.propDecorators = {
731
- variant: [{ type: core.Input }],
732
- size: [{ type: core.Input }],
733
- fullWidth: [{ type: core.Input }],
734
- hasBorder: [{ type: core.Input }],
735
- disabled: [{ type: core.Input }],
736
- isLoading: [{ type: core.Input }],
737
- type: [{ type: core.Input }],
738
- _: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
436
+ Object.defineProperty(ButtonComponent.prototype, "_", {
437
+ get: function () {
438
+ return this.fullWidth;
439
+ },
440
+ enumerable: false,
441
+ configurable: true
442
+ });
443
+ ButtonComponent.prototype.onClick = function (event) {
444
+ if (this.disabled) {
445
+ event.stopPropagation();
446
+ }
447
+ };
448
+ return ButtonComponent;
449
+ }());
450
+ ButtonComponent.decorators = [
451
+ { type: core.Component, args: [{
452
+ selector: 'klp-form-button',
453
+ 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",
454
+ 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}"]
455
+ },] }
456
+ ];
457
+ ButtonComponent.propDecorators = {
458
+ variant: [{ type: core.Input }],
459
+ size: [{ type: core.Input }],
460
+ fullWidth: [{ type: core.Input }],
461
+ hasBorder: [{ type: core.Input }],
462
+ disabled: [{ type: core.Input }],
463
+ isLoading: [{ type: core.Input }],
464
+ type: [{ type: core.Input }],
465
+ _: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
466
+ };
467
+
468
+ /*! *****************************************************************************
469
+ Copyright (c) Microsoft Corporation.
470
+
471
+ Permission to use, copy, modify, and/or distribute this software for any
472
+ purpose with or without fee is hereby granted.
473
+
474
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
475
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
476
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
477
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
478
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
479
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
480
+ PERFORMANCE OF THIS SOFTWARE.
481
+ ***************************************************************************** */
482
+ /* global Reflect, Promise */
483
+ var extendStatics = function (d, b) {
484
+ extendStatics = Object.setPrototypeOf ||
485
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
486
+ function (d, b) { for (var p in b)
487
+ if (Object.prototype.hasOwnProperty.call(b, p))
488
+ d[p] = b[p]; };
489
+ return extendStatics(d, b);
490
+ };
491
+ function __extends(d, b) {
492
+ if (typeof b !== "function" && b !== null)
493
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
494
+ extendStatics(d, b);
495
+ function __() { this.constructor = d; }
496
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
497
+ }
498
+ var __assign = function () {
499
+ __assign = Object.assign || function __assign(t) {
500
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
501
+ s = arguments[i];
502
+ for (var p in s)
503
+ if (Object.prototype.hasOwnProperty.call(s, p))
504
+ t[p] = s[p];
505
+ }
506
+ return t;
507
+ };
508
+ return __assign.apply(this, arguments);
509
+ };
510
+ function __rest(s, e) {
511
+ var t = {};
512
+ for (var p in s)
513
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
514
+ t[p] = s[p];
515
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
516
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
517
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
518
+ t[p[i]] = s[p[i]];
519
+ }
520
+ return t;
521
+ }
522
+ function __decorate(decorators, target, key, desc) {
523
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
524
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
525
+ r = Reflect.decorate(decorators, target, key, desc);
526
+ else
527
+ for (var i = decorators.length - 1; i >= 0; i--)
528
+ if (d = decorators[i])
529
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
530
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
531
+ }
532
+ function __param(paramIndex, decorator) {
533
+ return function (target, key) { decorator(target, key, paramIndex); };
534
+ }
535
+ function __metadata(metadataKey, metadataValue) {
536
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
537
+ return Reflect.metadata(metadataKey, metadataValue);
538
+ }
539
+ function __awaiter(thisArg, _arguments, P, generator) {
540
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
541
+ return new (P || (P = Promise))(function (resolve, reject) {
542
+ function fulfilled(value) { try {
543
+ step(generator.next(value));
544
+ }
545
+ catch (e) {
546
+ reject(e);
547
+ } }
548
+ function rejected(value) { try {
549
+ step(generator["throw"](value));
550
+ }
551
+ catch (e) {
552
+ reject(e);
553
+ } }
554
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
555
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
556
+ });
557
+ }
558
+ function __generator(thisArg, body) {
559
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
560
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
561
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
562
+ function verb(n) { return function (v) { return step([n, v]); }; }
563
+ function step(op) {
564
+ if (f)
565
+ throw new TypeError("Generator is already executing.");
566
+ while (_)
567
+ try {
568
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
569
+ return t;
570
+ if (y = 0, t)
571
+ op = [op[0] & 2, t.value];
572
+ switch (op[0]) {
573
+ case 0:
574
+ case 1:
575
+ t = op;
576
+ break;
577
+ case 4:
578
+ _.label++;
579
+ return { value: op[1], done: false };
580
+ case 5:
581
+ _.label++;
582
+ y = op[1];
583
+ op = [0];
584
+ continue;
585
+ case 7:
586
+ op = _.ops.pop();
587
+ _.trys.pop();
588
+ continue;
589
+ default:
590
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
591
+ _ = 0;
592
+ continue;
593
+ }
594
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
595
+ _.label = op[1];
596
+ break;
597
+ }
598
+ if (op[0] === 6 && _.label < t[1]) {
599
+ _.label = t[1];
600
+ t = op;
601
+ break;
602
+ }
603
+ if (t && _.label < t[2]) {
604
+ _.label = t[2];
605
+ _.ops.push(op);
606
+ break;
607
+ }
608
+ if (t[2])
609
+ _.ops.pop();
610
+ _.trys.pop();
611
+ continue;
612
+ }
613
+ op = body.call(thisArg, _);
614
+ }
615
+ catch (e) {
616
+ op = [6, e];
617
+ y = 0;
618
+ }
619
+ finally {
620
+ f = t = 0;
621
+ }
622
+ if (op[0] & 5)
623
+ throw op[1];
624
+ return { value: op[0] ? op[1] : void 0, done: true };
625
+ }
626
+ }
627
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
628
+ if (k2 === undefined)
629
+ k2 = k;
630
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
631
+ }) : (function (o, m, k, k2) {
632
+ if (k2 === undefined)
633
+ k2 = k;
634
+ o[k2] = m[k];
635
+ });
636
+ function __exportStar(m, o) {
637
+ for (var p in m)
638
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
639
+ __createBinding(o, m, p);
640
+ }
641
+ function __values(o) {
642
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
643
+ if (m)
644
+ return m.call(o);
645
+ if (o && typeof o.length === "number")
646
+ return {
647
+ next: function () {
648
+ if (o && i >= o.length)
649
+ o = void 0;
650
+ return { value: o && o[i++], done: !o };
651
+ }
652
+ };
653
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
654
+ }
655
+ function __read(o, n) {
656
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
657
+ if (!m)
658
+ return o;
659
+ var i = m.call(o), r, ar = [], e;
660
+ try {
661
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
662
+ ar.push(r.value);
663
+ }
664
+ catch (error) {
665
+ e = { error: error };
666
+ }
667
+ finally {
668
+ try {
669
+ if (r && !r.done && (m = i["return"]))
670
+ m.call(i);
671
+ }
672
+ finally {
673
+ if (e)
674
+ throw e.error;
675
+ }
676
+ }
677
+ return ar;
678
+ }
679
+ /** @deprecated */
680
+ function __spread() {
681
+ for (var ar = [], i = 0; i < arguments.length; i++)
682
+ ar = ar.concat(__read(arguments[i]));
683
+ return ar;
684
+ }
685
+ /** @deprecated */
686
+ function __spreadArrays() {
687
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
688
+ s += arguments[i].length;
689
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
690
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
691
+ r[k] = a[j];
692
+ return r;
693
+ }
694
+ function __spreadArray(to, from, pack) {
695
+ if (pack || arguments.length === 2)
696
+ for (var i = 0, l = from.length, ar; i < l; i++) {
697
+ if (ar || !(i in from)) {
698
+ if (!ar)
699
+ ar = Array.prototype.slice.call(from, 0, i);
700
+ ar[i] = from[i];
701
+ }
702
+ }
703
+ return to.concat(ar || Array.prototype.slice.call(from));
704
+ }
705
+ function __await(v) {
706
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
707
+ }
708
+ function __asyncGenerator(thisArg, _arguments, generator) {
709
+ if (!Symbol.asyncIterator)
710
+ throw new TypeError("Symbol.asyncIterator is not defined.");
711
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
712
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
713
+ function verb(n) { if (g[n])
714
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
715
+ function resume(n, v) { try {
716
+ step(g[n](v));
717
+ }
718
+ catch (e) {
719
+ settle(q[0][3], e);
720
+ } }
721
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
722
+ function fulfill(value) { resume("next", value); }
723
+ function reject(value) { resume("throw", value); }
724
+ function settle(f, v) { if (f(v), q.shift(), q.length)
725
+ resume(q[0][0], q[0][1]); }
726
+ }
727
+ function __asyncDelegator(o) {
728
+ var i, p;
729
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
730
+ 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; }
731
+ }
732
+ function __asyncValues(o) {
733
+ if (!Symbol.asyncIterator)
734
+ throw new TypeError("Symbol.asyncIterator is not defined.");
735
+ var m = o[Symbol.asyncIterator], i;
736
+ 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);
737
+ 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); }); }; }
738
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
739
+ }
740
+ function __makeTemplateObject(cooked, raw) {
741
+ if (Object.defineProperty) {
742
+ Object.defineProperty(cooked, "raw", { value: raw });
743
+ }
744
+ else {
745
+ cooked.raw = raw;
746
+ }
747
+ return cooked;
748
+ }
749
+ ;
750
+ var __setModuleDefault = Object.create ? (function (o, v) {
751
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
752
+ }) : function (o, v) {
753
+ o["default"] = v;
739
754
  };
755
+ function __importStar(mod) {
756
+ if (mod && mod.__esModule)
757
+ return mod;
758
+ var result = {};
759
+ if (mod != null)
760
+ for (var k in mod)
761
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
762
+ __createBinding(result, mod, k);
763
+ __setModuleDefault(result, mod);
764
+ return result;
765
+ }
766
+ function __importDefault(mod) {
767
+ return (mod && mod.__esModule) ? mod : { default: mod };
768
+ }
769
+ function __classPrivateFieldGet(receiver, state, kind, f) {
770
+ if (kind === "a" && !f)
771
+ throw new TypeError("Private accessor was defined without a getter");
772
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
773
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
774
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
775
+ }
776
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
777
+ if (kind === "m")
778
+ throw new TypeError("Private method is not writable");
779
+ if (kind === "a" && !f)
780
+ throw new TypeError("Private accessor was defined without a setter");
781
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
782
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
783
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
784
+ }
740
785
 
741
786
  var CheckboxComponent = /** @class */ (function (_super) {
742
787
  __extends(CheckboxComponent, _super);
@@ -822,6 +867,7 @@
822
867
  function PasswordFieldComponent() {
823
868
  var _this = _super.apply(this, __spread(arguments)) || this;
824
869
  _this.placeholder = 'Password';
870
+ _this.isPasswordConfirm = false;
825
871
  return _this;
826
872
  }
827
873
  return PasswordFieldComponent;
@@ -829,74 +875,157 @@
829
875
  PasswordFieldComponent.decorators = [
830
876
  { type: core.Component, args: [{
831
877
  selector: 'klp-form-password-field',
832
- template: "<input\n\ttype=\"password\"\n\tclass=\"form-control\"\n [ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n/>\n",
878
+ template: "<input\n\ttype=\"password\"\n\tclass=\"form-control\"\n [ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"isPasswordConfirm ? 'Confirm password': 'Password'\"\n\t(blur)=\"touch()\"\n/>\n",
833
879
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: PasswordFieldComponent, multi: true }],
834
880
  styles: [":host,input{display:block}input{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;font-size:14px;height:42px;outline:none;padding:.375rem .625rem;transition:all .2s ease-in;width:100%}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder,input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{border-color:#3ed778;box-shadow:none;outline:0 none}input.input-sm{height:30px}input.input-lg{height:50px}input.error{background-color:#ffeff4;border-color:#ff3c7e}input.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}.showErrors{border-color:#ff8000}"]
835
881
  },] }
836
882
  ];
837
883
  PasswordFieldComponent.propDecorators = {
838
- placeholder: [{ type: core.Input }]
884
+ placeholder: [{ type: core.Input }],
885
+ isPasswordConfirm: [{ type: core.Input }]
839
886
  };
840
887
 
888
+ var SELECT_TRANSLATIONS = new core.InjectionToken('klp.form.select.translations');
841
889
  var SelectComponent = /** @class */ (function (_super) {
842
890
  __extends(SelectComponent, _super);
843
- function SelectComponent(parent, controlContainer) {
891
+ function SelectComponent(parent, controlContainer, translations) {
844
892
  var _this = _super.call(this, parent, controlContainer) || this;
845
893
  _this.parent = parent;
846
894
  _this.controlContainer = controlContainer;
847
- _this.placeholder = 'Pick an option';
895
+ _this.translations = translations;
848
896
  _this.multiple = false;
897
+ _this.multipleDisplayedAsAmount = false;
849
898
  _this.clearable = true;
850
899
  _this.onSearch = new core.EventEmitter();
851
900
  return _this;
852
901
  }
902
+ SelectComponent.prototype.onTextInput = function (value) {
903
+ this.currentQueryString = value;
904
+ this.onSearch.emit(value);
905
+ };
906
+ SelectComponent.prototype.getDefaultTranslation = function (key) {
907
+ var _this = this;
908
+ switch (key) {
909
+ case 'placeholder':
910
+ return function () { var _a; return (_a = _this.placeholder) !== null && _a !== void 0 ? _a : 'Pick an option'; };
911
+ case 'amountSelected':
912
+ return function (amount) { return amount + " selected"; };
913
+ }
914
+ };
915
+ SelectComponent.prototype.getTranslation = function (key, params) {
916
+ if (params === void 0) { params = null; }
917
+ var _a, _b, _c;
918
+ return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
919
+ };
853
920
  return SelectComponent;
854
921
  }(ValueAccessorBase));
855
922
  SelectComponent.decorators = [
856
923
  { type: core.Component, args: [{
857
924
  selector: 'klp-form-select',
858
- 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",
925
+ template: "<ng-select\n\t[placeholder]=\"getTranslation('placeholder')\"\n\tbindLabel=\"name\"\n\tbindValue=\"id\"\n\t[items]=\"options\"\n\t[clearable]=\"clearable\"\n\t[(ngModel)]=\"innerValue\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\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\t(input)=\"onTextInput($event.target.value)\"\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\t<ng-container *ngIf=\"multiple && multipleDisplayedAsAmount && innerValue?.length > 1\">\n\t\t<ng-template ng-multi-label-tmp>\n\t\t\t<div class=\"ng-value\">\n\t\t\t\t<span class=\"ng-value-label\">{{getTranslation('amountSelected', innerValue?.length)}}</span>\n\t\t\t</div>\n\t\t</ng-template>\n\t</ng-container>\n\t<ng-template ng-footer-tmp *ngIf=\"footerElement\">\n\t\t<ng-container [ngTemplateOutlet]=\"footerElement\"></ng-container>\n\t</ng-template>\n</ng-select>\n",
859
926
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }],
860
- 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}"]
927
+ 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 .ng-value{background-color:#e7faee;border:1px solid #93e8b3;border-radius:2px;display:flex;font-size:.9em;margin-bottom:3px;margin-right:5px;margin-top:3px;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}"]
861
928
  },] }
862
929
  ];
863
930
  SelectComponent.ctorParameters = function () { return [
864
931
  { type: FormElementComponent, decorators: [{ type: core.Optional }, { type: core.Host }] },
865
- { type: forms.ControlContainer, decorators: [{ type: core.Optional }, { type: core.Host }] }
932
+ { type: forms.ControlContainer, decorators: [{ type: core.Optional }, { type: core.Host }] },
933
+ { type: undefined, decorators: [{ type: core.Inject, args: [SELECT_TRANSLATIONS,] }, { type: core.Optional }] }
866
934
  ]; };
867
935
  SelectComponent.propDecorators = {
868
936
  placeholder: [{ type: core.Input }],
869
937
  options: [{ type: core.Input }],
870
938
  multiple: [{ type: core.Input }],
939
+ multipleDisplayedAsAmount: [{ type: core.Input }],
871
940
  clearable: [{ type: core.Input }],
872
941
  dropdownPosition: [{ type: core.Input }],
873
942
  customSearchFn: [{ type: core.Input }],
943
+ footerElement: [{ type: core.Input }],
874
944
  onSearch: [{ type: core.Output }]
875
945
  };
876
946
 
947
+ var SelectFooterComponent = /** @class */ (function () {
948
+ function SelectFooterComponent() {
949
+ }
950
+ return SelectFooterComponent;
951
+ }());
952
+ SelectFooterComponent.decorators = [
953
+ { type: core.Component, args: [{
954
+ selector: 'klp-select-footer',
955
+ template: "<div class=\"componentContainer\">\n\t<span class=\"prefix\">{{prefix}}</span>\n\t<span class=\"text\">{{text}}</span>\n</div>\n",
956
+ styles: [":host{display:block}.componentContainer{cursor:pointer;padding:6px 10px}.componentContainer:hover{background:#e7faee}.prefix{font-size:80%;padding-right:.625rem}"]
957
+ },] }
958
+ ];
959
+ SelectFooterComponent.propDecorators = {
960
+ prefix: [{ type: core.Input }],
961
+ text: [{ type: core.Input }]
962
+ };
963
+
877
964
  var SortableItemsComponent = /** @class */ (function (_super) {
878
965
  __extends(SortableItemsComponent, _super);
879
966
  function SortableItemsComponent() {
880
967
  var _this = _super.apply(this, __spread(arguments)) || this;
881
968
  _this.sortableItemSize = 'lg';
969
+ _this.useCustomScroll = false;
970
+ _this.scrollInterval = null;
882
971
  _this.itemsOrderChanged = function () {
883
972
  _this.setInnerValueAndNotify(_this.innerValue);
884
973
  };
974
+ _this.onItemDrag = function (data) {
975
+ // if the item you're dragging is reaching the top, start scrolling.
976
+ if (data.relatedRect.top < 100) {
977
+ _this.scrollPage(100);
978
+ }
979
+ else {
980
+ _this.stopScrolling();
981
+ }
982
+ };
983
+ _this.onEnd = function () {
984
+ _this.stopScrolling();
985
+ };
885
986
  return _this;
886
987
  }
988
+ SortableItemsComponent.prototype.ngOnInit = function () {
989
+ _super.prototype.ngOnInit.call(this);
990
+ if (this.useCustomScroll) {
991
+ this.sortablejsOptions = { onUpdate: this.itemsOrderChanged, onMove: this.onItemDrag, onEnd: this.onEnd };
992
+ }
993
+ else {
994
+ this.sortablejsOptions = { onUpdate: this.itemsOrderChanged };
995
+ }
996
+ };
997
+ SortableItemsComponent.prototype.scrollPage = function (scrollAmount) {
998
+ var _this = this;
999
+ if (!isValueSet(this.scrollInterval)) {
1000
+ this.scrollInterval = setInterval(function () {
1001
+ window.scroll({
1002
+ top: document.scrollingElement.scrollTop - scrollAmount,
1003
+ behavior: 'smooth',
1004
+ });
1005
+ if (document.scrollingElement.scrollTop <= 100) {
1006
+ _this.stopScrolling();
1007
+ }
1008
+ }, 100);
1009
+ }
1010
+ };
1011
+ SortableItemsComponent.prototype.stopScrolling = function () {
1012
+ clearInterval(this.scrollInterval);
1013
+ this.scrollInterval = null;
1014
+ };
887
1015
  return SortableItemsComponent;
888
1016
  }(ValueAccessorBase));
889
1017
  SortableItemsComponent.decorators = [
890
1018
  { type: core.Component, args: [{
891
1019
  selector: 'klp-form-sortable-items',
892
- template: "<ng-template #listItem>\n\t<li *ngFor=\"let item of innerValue; index as index\"\n\t class=\"sortableItem\"\n\t [ngClass]=\"{\n\t\t\tlargeSortableItem: sortableItemSize === 'lg',\n\t\t \tsmallSortableItem: sortableItemSize === 'sm'\n\t\t }\"\n\t>\n\t\t<ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item, index:index }\" ></ng-container>\n\t</li>\n</ng-template>\n\n<ol *ngIf='!disabled'\n [sortablejs]=\"innerValue\"\n [sortablejsOptions]=\"{ onUpdate: itemsOrderChanged }\"\n class=\"itemsContainer\"\n>\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n\n<ol *ngIf='disabled' class=\"itemsContainer disabled-mouse-cursor\">\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n",
1020
+ template: "<ng-template #listItem>\n\t<li *ngFor=\"let item of innerValue; index as index\"\n\t\t\tclass=\"sortableItem\"\n\t\t\t[ngClass]=\"{\n\t\t\tlargeSortableItem: sortableItemSize === 'lg',\n\t\t \tsmallSortableItem: sortableItemSize === 'sm'\n\t\t }\"\n\t>\n\t\t<ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item, index:index }\"></ng-container>\n\t</li>\n</ng-template>\n\n<ol *ngIf='!disabled'\n\t\t[sortablejs]=\"innerValue\"\n\t\t[sortablejsOptions]=\"sortablejsOptions\"\n\t\tclass=\"itemsContainer\"\n>\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n\n<ol *ngIf='disabled' class=\"itemsContainer disabled-mouse-cursor\">\n\t<ng-container *ngTemplateOutlet=\"listItem\"></ng-container>\n</ol>\n",
893
1021
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SortableItemsComponent, multi: true }],
894
1022
  styles: [":host{display:block}.itemsContainer{border:1px solid #e6ecf5;border-radius:5px;margin-bottom:0;padding:0}.sortableItem{border-top:1px solid #e6ecf5;cursor:-webkit-grab;cursor:grab;list-style:none}.sortableItem:hover{background:#f8f9fa}.sortableItem:first-child{border-top:none}.largeSortableItem{padding:15px}.smallSortableItem{padding:0 10px}.disabled-mouse-cursor li{cursor:no-drop}"]
895
1023
  },] }
896
1024
  ];
897
1025
  SortableItemsComponent.propDecorators = {
898
1026
  template: [{ type: core.ContentChild, args: [core.TemplateRef,] }],
899
- sortableItemSize: [{ type: core.Input }]
1027
+ sortableItemSize: [{ type: core.Input }],
1028
+ useCustomScroll: [{ type: core.Input }]
900
1029
  };
901
1030
 
902
1031
  var TextInputComponent = /** @class */ (function (_super) {
@@ -904,6 +1033,7 @@
904
1033
  function TextInputComponent() {
905
1034
  var _this = _super.apply(this, __spread(arguments)) || this;
906
1035
  _this.type = 'text';
1036
+ _this.clearable = false;
907
1037
  return _this;
908
1038
  }
909
1039
  return TextInputComponent;
@@ -911,14 +1041,16 @@
911
1041
  TextInputComponent.decorators = [
912
1042
  { type: core.Component, args: [{
913
1043
  selector: 'klp-form-text-input',
914
- template: "<input\n\t[type]=\"type\"\n\tclass=\"form-control\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t(blur)=\"touch()\"\n\t[disabled]='disabled'\n/>\n",
1044
+ template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable}\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch()\"\n\t\t[disabled]='disabled'\n\t/>\n\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n</div>\n",
915
1045
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }],
916
- styles: [":host,input{display:block}input{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;font-size:14px;height:42px;outline:none;padding:.375rem .625rem;transition:all .2s ease-in;width:100%}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder,input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{border-color:#3ed778;box-shadow:none;outline:0 none}input.input-sm{height:30px}input.input-lg{height:50px}input.error{background-color:#ffeff4;border-color:#ff3c7e}input.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}.showErrors{border-color:#ff8000}"]
1046
+ styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{left:.625rem;position:absolute;top:14px}input{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;display:block;font-size:14px;height:42px;outline:none;padding:.375rem .625rem;transition:all .2s ease-in;width:100%}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder,input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{border-color:#3ed778;box-shadow:none;outline:0 none}input.input-sm{height:30px}input.input-lg{height:50px}input.error{background-color:#ffeff4;border-color:#ff3c7e}input.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}.clearIcon{cursor:pointer;font-size:18px;position:absolute;right:.625rem;top:7px}.showErrors{border-color:#ff8000}"]
917
1047
  },] }
918
1048
  ];
919
1049
  TextInputComponent.propDecorators = {
920
1050
  placeholder: [{ type: core.Input }],
921
- type: [{ type: core.Input }]
1051
+ type: [{ type: core.Input }],
1052
+ clearable: [{ type: core.Input }],
1053
+ icon: [{ type: core.Input }]
922
1054
  };
923
1055
 
924
1056
  var ToggleComponent = /** @class */ (function (_super) {
@@ -1063,38 +1195,226 @@
1063
1195
  _: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
1064
1196
  };
1065
1197
 
1198
+ var MultipleValueAccessorBase = /** @class */ (function (_super) {
1199
+ __extends(MultipleValueAccessorBase, _super);
1200
+ function MultipleValueAccessorBase(parent, controlContainer) {
1201
+ var _this = _super.call(this, parent, controlContainer) || this;
1202
+ _this.parent = parent;
1203
+ _this.controlContainer = controlContainer;
1204
+ _this.multiple = false;
1205
+ return _this;
1206
+ }
1207
+ MultipleValueAccessorBase.prototype.writeValue = function (value) {
1208
+ if (this.multiple) {
1209
+ if (Array.isArray(value)) {
1210
+ _super.prototype.writeValue.call(this, value.filter(isValueSet));
1211
+ }
1212
+ else {
1213
+ _super.prototype.writeValue.call(this, [value].filter(isValueSet));
1214
+ }
1215
+ }
1216
+ else {
1217
+ if (Array.isArray(value)) {
1218
+ _super.prototype.writeValue.call(this, value[0]);
1219
+ }
1220
+ else {
1221
+ _super.prototype.writeValue.call(this, value);
1222
+ }
1223
+ }
1224
+ };
1225
+ MultipleValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
1226
+ if (this.multiple) {
1227
+ if (Array.isArray(value)) {
1228
+ _super.prototype.setInnerValueAndNotify.call(this, value.filter(isValueSet));
1229
+ }
1230
+ else {
1231
+ _super.prototype.setInnerValueAndNotify.call(this, [value].filter(isValueSet));
1232
+ }
1233
+ }
1234
+ else {
1235
+ if (Array.isArray(value)) {
1236
+ _super.prototype.setInnerValueAndNotify.call(this, value[0]);
1237
+ }
1238
+ else {
1239
+ _super.prototype.setInnerValueAndNotify.call(this, value);
1240
+ }
1241
+ }
1242
+ };
1243
+ return MultipleValueAccessorBase;
1244
+ }(ValueAccessorBase));
1245
+ MultipleValueAccessorBase.decorators = [
1246
+ { type: core.Component, args: [{
1247
+ selector: '',
1248
+ template: ''
1249
+ },] }
1250
+ ];
1251
+ MultipleValueAccessorBase.ctorParameters = function () { return [
1252
+ { type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
1253
+ { type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] }
1254
+ ]; };
1255
+ MultipleValueAccessorBase.propDecorators = {
1256
+ multiple: [{ type: core.Input }]
1257
+ };
1258
+
1066
1259
  var invalidDateKey = '--invalid_date--';
1067
1260
  function dateValidator(control) {
1068
1261
  var invalid = control.value === invalidDateKey;
1069
1262
  return invalid ? { date: control.value } : null;
1070
1263
  }
1071
1264
 
1265
+ var DATE_PICKER_TRANSLATIONS = new core.InjectionToken('klp.form.date.translations');
1266
+ var DatePickerComponent = /** @class */ (function (_super) {
1267
+ __extends(DatePickerComponent, _super);
1268
+ function DatePickerComponent(parent, controlContainer, translations) {
1269
+ var _this = _super.call(this, parent, controlContainer) || this;
1270
+ _this.parent = parent;
1271
+ _this.controlContainer = controlContainer;
1272
+ _this.translations = translations;
1273
+ _this.minDate = undefined;
1274
+ _this.maxDate = undefined;
1275
+ _this.sameMonthOnly = false;
1276
+ _this.format = 'dd-MM-yyyy';
1277
+ _this.clearable = false;
1278
+ return _this;
1279
+ }
1280
+ DatePickerComponent.prototype.writeValue = function (value) {
1281
+ if (value === invalidDateKey) {
1282
+ _super.prototype.writeValue.call(this, invalidDateKey);
1283
+ }
1284
+ else if (isNullOrUndefined(value)) {
1285
+ this.dateValue = null;
1286
+ _super.prototype.writeValue.call(this, null);
1287
+ }
1288
+ else {
1289
+ if (Array.isArray(value)) {
1290
+ this.dateValue = value.map(function (e) { return dateFns.parse(e, 'yyyy-MM-dd', new Date()); });
1291
+ }
1292
+ else {
1293
+ this.dateValue = dateFns.parse(value, 'yyyy-MM-dd', new Date());
1294
+ }
1295
+ _super.prototype.writeValue.call(this, value);
1296
+ }
1297
+ };
1298
+ DatePickerComponent.prototype.dateChanged = function (value) {
1299
+ if (value === invalidDateKey) {
1300
+ this.setInnerValueAndNotify(invalidDateKey);
1301
+ }
1302
+ else if (isNullOrUndefined(value)) {
1303
+ this.dateValue = null;
1304
+ this.setInnerValueAndNotify(null);
1305
+ }
1306
+ else {
1307
+ this.dateValue = value;
1308
+ if (Array.isArray(value)) {
1309
+ this.setInnerValueAndNotify(value.map(function (e) { return dateFns.format(e, 'yyyy-MM-dd'); }));
1310
+ }
1311
+ else {
1312
+ this.setInnerValueAndNotify(dateFns.format(value, 'yyyy-MM-dd'));
1313
+ }
1314
+ }
1315
+ };
1316
+ DatePickerComponent.prototype.getDefaultTranslation = function (key) {
1317
+ var _this = this;
1318
+ switch (key) {
1319
+ case 'placeholder':
1320
+ return function () { var _a; return (_a = _this.placeholder) !== null && _a !== void 0 ? _a : 'Select date'; };
1321
+ }
1322
+ };
1323
+ DatePickerComponent.prototype.getTranslation = function (key, params) {
1324
+ if (params === void 0) { params = null; }
1325
+ var _a, _b, _c;
1326
+ if (key === 'placeholder' && this.multiple) {
1327
+ return '';
1328
+ }
1329
+ return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
1330
+ };
1331
+ return DatePickerComponent;
1332
+ }(MultipleValueAccessorBase));
1333
+ DatePickerComponent.decorators = [
1334
+ { type: core.Component, args: [{
1335
+ selector: 'klp-form-date-picker',
1336
+ template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<klp-form-date-time-picker\n\t\t[multiple]=\"multiple\"\n\t\t[disabled]=\"disabled\"\n\t\t[(ngModel)]=\"dateValue\"\n\t\t(ngModelChange)=\"dateChanged($event)\"\n\t\t[minDate]=\"minDate\"\n\t\t[maxDate]=\"maxDate\"\n\t\t[sameMonthOnly]=\"sameMonthOnly\"\n\t\t[format]=\"format\"\n\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t[clearable]=\"clearable\"\n\t\t[showTimeInput]=\"false\"\n\t\t(onTouch)=\"touch()\"\n\t></klp-form-date-time-picker>\n</div>\n",
1337
+ providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: DatePickerComponent, multi: true }],
1338
+ styles: [":host{display:block}.componentContainer.showErrors ::ng-deep klp-form-date-time-picker .clearButton,.componentContainer.showErrors ::ng-deep klp-form-date-time-picker .dateContainer{border-color:#ff8000}"]
1339
+ },] }
1340
+ ];
1341
+ DatePickerComponent.ctorParameters = function () { return [
1342
+ { type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
1343
+ { type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] },
1344
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATE_PICKER_TRANSLATIONS,] }, { type: core.Optional }] }
1345
+ ]; };
1346
+ DatePickerComponent.propDecorators = {
1347
+ minDate: [{ type: core.Input }],
1348
+ maxDate: [{ type: core.Input }],
1349
+ sameMonthOnly: [{ type: core.Input }],
1350
+ format: [{ type: core.Input }],
1351
+ placeholder: [{ type: core.Input }],
1352
+ clearable: [{ type: core.Input }]
1353
+ };
1354
+
1072
1355
  var KLP_DATE_FORMATS = new core.InjectionToken('klp.form.date.formats');
1356
+ var DATE_TIME_PICKER_TRANSLATIONS = new core.InjectionToken('klp.form.dateTime.translations');
1073
1357
  function matDateFormatsFactory(component, dateFormats) {
1074
1358
  var _a;
1075
1359
  return (_a = dateFormats === null || dateFormats === void 0 ? void 0 : dateFormats(component.format)) !== null && _a !== void 0 ? _a : core$1.MAT_NATIVE_DATE_FORMATS;
1076
1360
  }
1077
- var DatepickerComponent = /** @class */ (function (_super) {
1078
- __extends(DatepickerComponent, _super);
1079
- function DatepickerComponent() {
1080
- var _this = _super.apply(this, __spread(arguments)) || this;
1361
+ var DateTimePickerComponent = /** @class */ (function (_super) {
1362
+ __extends(DateTimePickerComponent, _super);
1363
+ function DateTimePickerComponent(parent, controlContainer, translations, cdr) {
1364
+ var _this = _super.call(this, parent, controlContainer) || this;
1365
+ _this.parent = parent;
1366
+ _this.controlContainer = controlContainer;
1367
+ _this.translations = translations;
1368
+ _this.cdr = cdr;
1081
1369
  _this.minDate = undefined;
1082
1370
  _this.maxDate = undefined;
1083
- _this.placeholder = 'Select date';
1371
+ _this.sameMonthOnly = false;
1372
+ _this.format = 'dd-MM-yyyy';
1084
1373
  _this.clearable = false;
1374
+ _this.showTimeInput = true;
1375
+ _this.invalidTimeAsMidnight = false; // if the time is not valid, use 00:00 as the time
1085
1376
  _this.minDateStartOfDay = undefined;
1086
1377
  _this.maxDateEndOfDay = undefined;
1378
+ _this.selectedDates = [];
1379
+ _this.dateTouched = false;
1380
+ _this.hoursTouched = false;
1381
+ _this.minutesTouched = false;
1382
+ _this.isSelected = function (d) {
1383
+ if (_this.multiple) {
1384
+ return _this.selectedDates.some(function (e) { return e.getTime() === d.getTime(); }) ? 'selected' : '';
1385
+ }
1386
+ return '';
1387
+ };
1388
+ _this.filterDates = function (e) {
1389
+ if (_this.disabled) {
1390
+ return false;
1391
+ }
1392
+ return true;
1393
+ };
1087
1394
  return _this;
1088
1395
  }
1089
- DatepickerComponent.prototype.ngOnChanges = function (changes) {
1396
+ DateTimePickerComponent.prototype.ngOnInit = function () {
1397
+ _super.prototype.ngOnInit.call(this);
1398
+ if (this.multiple) {
1399
+ this.placeholder = '';
1400
+ this.showTimeInput = false;
1401
+ }
1402
+ };
1403
+ DateTimePickerComponent.prototype.ngAfterViewInit = function () {
1404
+ if (this.multiple) {
1405
+ // we are going to overwrite the datepicker closing fn later, so we are saving it here to restore it when needed
1406
+ this.datePickingClosingFn = this.datePickerRef.close;
1407
+ }
1408
+ };
1409
+ DateTimePickerComponent.prototype.ngOnChanges = function (changes) {
1090
1410
  if (changes.minDate) {
1091
- this.setMinDate(changes.minDate.currentValue);
1411
+ this.determineMinAndMaxDates();
1092
1412
  }
1093
1413
  if (changes.maxDate) {
1094
- this.setMaxDate(changes.maxDate.currentValue);
1414
+ this.determineMinAndMaxDates();
1095
1415
  }
1096
1416
  };
1097
- DatepickerComponent.prototype.setMinDate = function (minDate) {
1417
+ DateTimePickerComponent.prototype.setMinDate = function (minDate) {
1098
1418
  if (minDate) {
1099
1419
  this.minDateStartOfDay = new Date(minDate);
1100
1420
  this.minDateStartOfDay.setHours(0, 0, 0, 0);
@@ -1103,7 +1423,7 @@
1103
1423
  this.minDateStartOfDay = undefined;
1104
1424
  }
1105
1425
  };
1106
- DatepickerComponent.prototype.setMaxDate = function (maxDate) {
1426
+ DateTimePickerComponent.prototype.setMaxDate = function (maxDate) {
1107
1427
  if (maxDate) {
1108
1428
  this.maxDateEndOfDay = new Date(maxDate);
1109
1429
  this.maxDateEndOfDay.setHours(23, 59, 59, 999);
@@ -1112,67 +1432,231 @@
1112
1432
  this.maxDateEndOfDay = undefined;
1113
1433
  }
1114
1434
  };
1435
+ DateTimePickerComponent.prototype.getSelectedMonths = function () {
1436
+ return removeDuplicatesFromArray(this.selectedDates.map(function (e) { return dateFns.format(e, 'MMMM'); })).length;
1437
+ };
1115
1438
  // dateChanged is called when the output of the datepicker is changed and
1116
1439
  // parsed correctly. If the date is invalid, it will be called the first time
1117
1440
  // with null but never again until a valid input is provided.
1118
- DatepickerComponent.prototype.dateChanged = function (event) {
1119
- var nativeInputValue = this.nativeInputRef.nativeElement.value;
1441
+ DateTimePickerComponent.prototype.dateChanged = function (event) {
1442
+ var _this = this;
1120
1443
  var date = event.value;
1121
- if (isNullOrUndefined(date) && stringIsSetAndNotEmpty(nativeInputValue)) {
1122
- this.setInnerValueAndNotify(invalidDateKey);
1444
+ if (this.multiple) {
1445
+ this.datePickerRef.close = function () {
1446
+ };
1447
+ if (this.selectedDates.some(function (e) { return e.getTime() === date.getTime(); })) {
1448
+ this.selectedDates = this.selectedDates.filter(function (e) { return e.getTime() !== date.getTime(); });
1449
+ }
1450
+ else {
1451
+ this.selectedDates = __spread(this.selectedDates, [date]);
1452
+ }
1453
+ // START HACK
1454
+ // the date picker does not provide any rerender calls. Therefore, we are going to change the minDate in order to force the render
1455
+ // This is needed to show all selected days in our date picker
1456
+ // We also set the innerValue to null (with this.valueForMaterialDatePicker = null;), otherwise you can not
1457
+ // deselect your last picked date
1458
+ this.cdr.detectChanges();
1459
+ this.valueForMaterialDatePicker = null;
1460
+ var oldMinDate = this.minDateStartOfDay;
1461
+ this.minDateStartOfDay = new Date(0);
1462
+ this.cdr.detectChanges();
1463
+ this.minDateStartOfDay = oldMinDate;
1464
+ // END HACK
1465
+ if (this.sameMonthOnly) {
1466
+ if (this.selectedDates.length >= 2) {
1467
+ if (date < dateFns.startOfMonth(this.selectedDates[0]) || date > dateFns.endOfMonth(this.selectedDates[0])) {
1468
+ this.selectedDates = [date];
1469
+ }
1470
+ }
1471
+ this.determineMinAndMaxDates();
1472
+ }
1473
+ this.setInnerValueAndNotify(this.selectedDates);
1474
+ setTimeout(function () {
1475
+ _this.datePickerRef.close = _this.datePickingClosingFn;
1476
+ });
1477
+ }
1478
+ else {
1479
+ this.notifyNewDate();
1480
+ }
1481
+ };
1482
+ DateTimePickerComponent.prototype.determineMinAndMaxDates = function () {
1483
+ if (this.sameMonthOnly) {
1484
+ if (this.selectedDates.length >= 2) {
1485
+ this.setMinDate(dateFns.startOfMonth(this.selectedDates[0]));
1486
+ this.setMaxDate(dateFns.endOfMonth(this.selectedDates[0]));
1487
+ }
1488
+ else {
1489
+ this.setMinDate(this.minDate);
1490
+ this.setMaxDate(this.maxDate);
1491
+ }
1123
1492
  }
1124
1493
  else {
1125
- this.setInnerValueAndNotify(date);
1494
+ this.setMinDate(this.minDate);
1495
+ this.setMinDate(this.maxDate);
1496
+ }
1497
+ };
1498
+ DateTimePickerComponent.prototype.notifyNewDate = function () {
1499
+ var nativeInputValue = this.nativeInputRef.nativeElement.value;
1500
+ var parsedHours = Number(this.hours);
1501
+ var parsedMinutes = Number(this.minutes);
1502
+ // if we dont have the time element
1503
+ if (!this.showTimeInput) {
1504
+ if (!stringIsSetAndFilled(nativeInputValue)) {
1505
+ this.setInnerValueAndNotify(null);
1506
+ return;
1507
+ }
1508
+ if (this.valueForMaterialDatePicker instanceof Date) {
1509
+ this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
1510
+ return;
1511
+ }
1512
+ }
1513
+ // when all inputs are empty
1514
+ if (!stringIsSetAndFilled(nativeInputValue) && !stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
1515
+ this.setInnerValueAndNotify(null);
1516
+ return;
1517
+ }
1518
+ // if we have date and time
1519
+ if (stringIsSetAndFilled(this.hours) &&
1520
+ Number.isFinite(parsedHours) &&
1521
+ parsedHours >= 0 &&
1522
+ parsedHours <= 23 &&
1523
+ stringIsSetAndFilled(this.minutes) &&
1524
+ Number.isFinite(parsedMinutes) &&
1525
+ parsedMinutes >= 0 &&
1526
+ parsedMinutes <= 59 &&
1527
+ this.valueForMaterialDatePicker instanceof Date) {
1528
+ var newDateWithHours = new Date(this.valueForMaterialDatePicker.setHours(parsedHours));
1529
+ var newDateWithMinutes = new Date(newDateWithHours.setMinutes(parsedMinutes));
1530
+ this.setInnerValueAndNotify(newDateWithMinutes);
1531
+ return;
1532
+ }
1533
+ if (this.invalidTimeAsMidnight) {
1534
+ if (this.valueForMaterialDatePicker instanceof Date) {
1535
+ this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
1536
+ return;
1537
+ }
1126
1538
  }
1539
+ // all other cases, we are not in a valid state
1540
+ this.setInnerValueAndNotify(invalidDateKey);
1127
1541
  };
1128
- DatepickerComponent.prototype.writeValue = function (value) {
1542
+ DateTimePickerComponent.prototype.writeValue = function (value) {
1129
1543
  _super.prototype.writeValue.call(this, value);
1130
- this.valueForMaterialDatePicker = value === invalidDateKey ? null : value;
1544
+ if (Array.isArray(value)) {
1545
+ this.selectedDates = value;
1546
+ this.determineMinAndMaxDates();
1547
+ this.valueForMaterialDatePicker = null;
1548
+ }
1549
+ else {
1550
+ this.valueForMaterialDatePicker = value === invalidDateKey ? null : value;
1551
+ if (value instanceof Date) {
1552
+ this.hours = String(value.getHours());
1553
+ this.minutes = String(value.getMinutes());
1554
+ this.formatTime();
1555
+ }
1556
+ else {
1557
+ this.hours = '';
1558
+ this.minutes = '';
1559
+ }
1560
+ }
1131
1561
  };
1132
1562
  // nativeValueChanged is called when the internal text value changes, but not
1133
1563
  // when the date is changed via the date picker. We need this so that we can
1134
1564
  // determine if the datepicker is empty or invalid.
1135
- DatepickerComponent.prototype.nativeValueChanged = function (event) {
1136
- var nativeInputValue = event.target.value;
1137
- var date = this.valueForMaterialDatePicker;
1565
+ DateTimePickerComponent.prototype.nativeValueChanged = function () {
1138
1566
  if (this.datePickerRef.opened) {
1139
1567
  // if the user is typing instead of using the picker, close it.
1140
1568
  this.datePickerRef.close();
1141
1569
  }
1142
- if (isNullOrUndefined(date) && stringIsSetAndNotEmpty(nativeInputValue)) {
1143
- this.setInnerValueAndNotify(invalidDateKey);
1144
- }
1145
- else {
1146
- this.setInnerValueAndNotify(date);
1147
- }
1570
+ this.notifyNewDate();
1148
1571
  };
1149
- DatepickerComponent.prototype.resetToNull = function () {
1572
+ DateTimePickerComponent.prototype.resetToNull = function () {
1150
1573
  this.setInnerValueAndNotify(null);
1151
1574
  this.valueForMaterialDatePicker = null;
1152
1575
  this.nativeInputRef.nativeElement.value = null;
1576
+ this.hours = '';
1577
+ this.minutes = '';
1578
+ this.selectedDates = [];
1153
1579
  };
1154
- return DatepickerComponent;
1155
- }(ValueAccessorBase));
1156
- DatepickerComponent.decorators = [
1580
+ DateTimePickerComponent.prototype.formatTime = function () {
1581
+ if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
1582
+ this.hours = '0' + this.hours;
1583
+ }
1584
+ if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
1585
+ this.minutes = '0' + this.minutes;
1586
+ }
1587
+ };
1588
+ DateTimePickerComponent.prototype.touchDate = function () {
1589
+ this.dateTouched = true;
1590
+ this.determineAllTouched();
1591
+ };
1592
+ DateTimePickerComponent.prototype.touchHours = function () {
1593
+ this.hoursTouched = true;
1594
+ this.determineAllTouched();
1595
+ };
1596
+ DateTimePickerComponent.prototype.touchMinutes = function () {
1597
+ this.minutesTouched = true;
1598
+ this.determineAllTouched();
1599
+ };
1600
+ DateTimePickerComponent.prototype.determineAllTouched = function () {
1601
+ if ((this.dateTouched && this.hoursTouched && this.minutesTouched) || (this.dateTouched && !this.showTimeInput)) {
1602
+ this.touch();
1603
+ }
1604
+ };
1605
+ DateTimePickerComponent.prototype.getDefaultTranslation = function (key) {
1606
+ var _this = this;
1607
+ switch (key) {
1608
+ case 'placeholder':
1609
+ return function () { var _a; return (_a = _this.placeholder) !== null && _a !== void 0 ? _a : 'Select date'; };
1610
+ case 'selectDays':
1611
+ return function () { return 'Select day(s)'; };
1612
+ case 'selectedDate':
1613
+ return function (d) { return d.toLocaleDateString(); };
1614
+ case 'daysSelected':
1615
+ return function (amount) { return amount + " days selected"; };
1616
+ case 'selectedInMonth':
1617
+ return function (d) { return " in " + dateFns.format(d, 'MMMM'); };
1618
+ }
1619
+ };
1620
+ DateTimePickerComponent.prototype.getTranslation = function (key, params) {
1621
+ if (params === void 0) { params = null; }
1622
+ var _a, _b, _c;
1623
+ if (key === 'placeholder' && this.multiple) {
1624
+ return '';
1625
+ }
1626
+ return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
1627
+ };
1628
+ return DateTimePickerComponent;
1629
+ }(MultipleValueAccessorBase));
1630
+ DateTimePickerComponent.decorators = [
1157
1631
  { type: core.Component, args: [{
1158
- selector: 'klp-form-datepicker',
1159
- template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<mat-form-field [floatLabel]=\"'never'\">\n\t\t<input\n\t\t\t#nativeInput\n\t\t\tmatInput\n\t\t\t[matDatepicker]=\"picker\"\n\t\t\t[(ngModel)]=\"valueForMaterialDatePicker\"\n\t\t\t(dateInput)=\"dateChanged($event)\"\n\t\t\t(input)=\"nativeValueChanged($event)\"\n\t\t\t[min]=\"minDateStartOfDay\"\n\t\t\t[max]=\"maxDateEndOfDay\"\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t(click)=\"picker.open()\"\n\t\t\t(blur)=\"touch()\"\n\t\t>\n\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n\t\t<mat-datepicker #picker\n\t\t></mat-datepicker>\n\t</mat-form-field>\n\t<button *ngIf=\"clearable\" class=\"clearButton\" (click)=\"resetToNull()\">\u00D7</button>\n</div>\n",
1632
+ selector: 'klp-form-date-time-picker',
1633
+ template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<div class=\"dateContainer\" [ngClass]=\"{noRightBorder: !showTimeInput && clearable && !disabled, disabled: disabled}\">\n\t\t<mat-form-field floatLabel=\"never\">\n\t\t\t<div *ngIf=\"multiple\" class=\"daysSelectedCaption\" (click)=\"picker.open()\" [ngClass]=\"{disabled: disabled}\">\n\t\t\t\t<ng-container *ngIf=\"selectedDates.length >= 2\">\n\t\t\t\t\t<span>{{getTranslation('daysSelected', selectedDates.length)}}</span>\n\t\t\t\t\t<span *ngIf=\"getSelectedMonths() === 1\">{{getTranslation('selectedInMonth', selectedDates[0])}}</span>\n\t\t\t\t</ng-container>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 1\">{{getTranslation('selectedDate', selectedDates[0])}}</span>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 0\" class=\"placeholderForMultipleSelection\">{{getTranslation('selectDays')}}</span>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\t#nativeInput\n\t\t\t\tmatInput\n\t\t\t\t[matDatepicker]=\"picker\"\n\t\t\t\t[matDatepickerFilter]=\"filterDates\"\n\t\t\t\t[(ngModel)]=\"valueForMaterialDatePicker\"\n\t\t\t\t(dateInput)=\"dateChanged($event)\"\n\t\t\t\t(input)=\"nativeValueChanged()\"\n\t\t\t\t[min]=\"minDateStartOfDay\"\n\t\t\t\t[max]=\"maxDateEndOfDay\"\n\t\t\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t\t\t(click)=\"picker.open()\"\n\t\t\t\t(blur)=\"touchDate()\"\n\t\t\t\t[ngClass]=\"{inputForMultipleDays: multiple}\"\n\t\t\t>\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n\t\t\t<mat-datepicker\n\t\t\t\t#picker\n\t\t\t\t[dateClass]=\"isSelected\"\n\t\t\t></mat-datepicker>\n\t\t</mat-form-field>\n\t</div>\n\t<div class=\"timeContainer\" *ngIf=\"showTimeInput\" [ngClass]=\"{disabled: disabled}\">\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchHours()\">\n\t\t<div class=\"divider\">:</div>\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchMinutes()\">\n\t</div>\n\t<button *ngIf=\"clearable && !disabled\" class=\"clearButton\" (click)=\"resetToNull()\" [ngClass]=\"{withoutSpacing: !showTimeInput}\">\u00D7</button>\n</div>\n",
1160
1634
  providers: [
1161
- { provide: forms.NG_VALUE_ACCESSOR, useExisting: DatepickerComponent, multi: true },
1162
- { provide: core$1.MAT_DATE_FORMATS,
1163
- deps: [DatepickerComponent, [new core.Optional(), KLP_DATE_FORMATS]],
1635
+ { provide: forms.NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
1636
+ {
1637
+ provide: core$1.MAT_DATE_FORMATS,
1638
+ deps: [DateTimePickerComponent, [new core.Optional(), KLP_DATE_FORMATS]],
1164
1639
  useFactory: matDateFormatsFactory,
1165
1640
  }
1166
1641
  ],
1167
- styles: [":host{display:block}:host ::ng-deep mat-form-field{display:block;height:100%}:host ::ng-deep mat-form-field.mat-focused .mat-form-field-label,:host ::ng-deep mat-form-field .mat-form-field-label{color:#adadad}:host ::ng-deep .mat-datepicker-toggle-active{color:#666}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:none}:host ::ng-deep .mat-form-field-flex{flex-direction:row-reverse}:host ::ng-deep .mat-form-field-infix{border-top:none}:host ::ng-deep .mat-form-field-suffix{margin-right:.625rem}:host ::ng-deep .mat-form-field-suffix:hover .mat-button-focus-overlay{opacity:.1}:host ::ng-deep .mat-form-field-underline{display:none}.componentContainer{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;display:block;font-size:14px;height:42px;padding:.375rem .625rem;position:relative;transition:all .2s ease-in;width:100%}.componentContainer::-webkit-input-placeholder{color:#adadad}.componentContainer:-moz-placeholder,.componentContainer::-moz-placeholder{color:#adadad}.componentContainer:-ms-input-placeholder{color:#adadad}.componentContainer:focus{border-color:#3ed778;box-shadow:none;outline:0 none}.componentContainer.input-sm{height:30px}.componentContainer.input-lg{height:50px}.componentContainer.error{background-color:#ffeff4;border-color:#ff3c7e}.componentContainer.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}.componentContainer.showErrors{border-color:#ff8000}.componentContainer .clearButton{align-items:center;background:none;border:none;bottom:0;color:#7b7b7b;display:flex;font-size:18px;position:absolute;right:1.25rem;top:0}"]
1642
+ styles: [":host{display:block}:host ::ng-deep mat-form-field{display:block;height:100%}:host ::ng-deep mat-form-field.mat-focused .mat-form-field-label,:host ::ng-deep mat-form-field .mat-form-field-label{color:#adadad}:host ::ng-deep .mat-datepicker-toggle-active{color:#666}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field-flex{flex-direction:row-reverse}:host ::ng-deep .mat-form-field-infix{border-top:none;width:auto}:host ::ng-deep .mat-form-field-suffix{margin-right:.625rem}:host ::ng-deep .mat-form-field-suffix:hover .mat-button-focus-overlay{opacity:.1}:host ::ng-deep .mat-form-field-underline{display:none}:host ::ng-deep .daysSelectedCaption{cursor:pointer}:host ::ng-deep .daysSelectedCaption.disabled{cursor:zoom-in}:host ::ng-deep .inputForMultipleDays{display:none}.componentContainer{border-radius:2px;color:#888da8;display:flex;position:relative}.componentContainer .placeholderForMultipleSelection{color:#adadad}.componentContainer.showErrors .clearButton.withoutSpacing,.componentContainer.showErrors .dateContainer,.componentContainer.showErrors .timeContainer{border-color:#ff8000}.componentContainer .clearButton{align-items:center;background:#fff;border:1px solid #e6ecf5;color:#7b7b7b;display:flex;flex:0 0 auto;font-size:18px;margin-left:1.25rem;padding:6px 14px}.componentContainer .clearButton.withoutSpacing{border-left:none;margin-left:0}.componentContainer .clearButton:disabled{background:#f9f9f9;border:1px solid #e6ecf5}.componentContainer .dateContainer{background:#fff;border:1px solid #e6ecf5;flex:1 1 auto;padding:6px}.componentContainer .dateContainer.noRightBorder{border-right:none}.componentContainer .dateContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer{align-items:center;background:#fff;border:1px solid #e6ecf5;display:flex;flex:0 0 auto;margin-left:1.25rem;padding:6px .625rem}.componentContainer .timeContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer input{border:none;color:#888da8;padding:0;text-align:center;width:20px}.componentContainer .timeContainer input::-moz-placeholder{color:#adadad}.componentContainer .timeContainer input:-ms-input-placeholder{color:#adadad}.componentContainer .timeContainer input::placeholder{color:#adadad}.componentContainer .timeContainer .divider{margin:0 .3125rem}"]
1168
1643
  },] }
1169
1644
  ];
1170
- DatepickerComponent.propDecorators = {
1645
+ DateTimePickerComponent.ctorParameters = function () { return [
1646
+ { type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
1647
+ { type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] },
1648
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATE_TIME_PICKER_TRANSLATIONS,] }, { type: core.Optional }] },
1649
+ { type: core.ChangeDetectorRef }
1650
+ ]; };
1651
+ DateTimePickerComponent.propDecorators = {
1171
1652
  minDate: [{ type: core.Input }],
1172
1653
  maxDate: [{ type: core.Input }],
1654
+ sameMonthOnly: [{ type: core.Input }],
1173
1655
  format: [{ type: core.Input }],
1174
1656
  placeholder: [{ type: core.Input }],
1175
1657
  clearable: [{ type: core.Input }],
1658
+ showTimeInput: [{ type: core.Input }],
1659
+ invalidTimeAsMidnight: [{ type: core.Input }],
1176
1660
  nativeInputRef: [{ type: core.ViewChild, args: ['nativeInput',] }],
1177
1661
  datePickerRef: [{ type: core.ViewChild, args: ['picker',] }]
1178
1662
  };
@@ -1207,14 +1691,17 @@
1207
1691
  ],
1208
1692
  declarations: [
1209
1693
  ValueAccessorBase,
1694
+ MultipleValueAccessorBase,
1210
1695
  ButtonComponent,
1211
1696
  CheckboxComponent,
1212
- DatepickerComponent,
1697
+ DatePickerComponent,
1698
+ DateTimePickerComponent,
1213
1699
  EmailInputComponent,
1214
1700
  LoadingIndicatorComponent,
1215
1701
  NumberInputComponent,
1216
1702
  PasswordFieldComponent,
1217
1703
  SelectComponent,
1704
+ SelectFooterComponent,
1218
1705
  SortableItemsComponent,
1219
1706
  TextInputComponent,
1220
1707
  ToggleComponent,
@@ -1227,14 +1714,17 @@
1227
1714
  ],
1228
1715
  exports: [
1229
1716
  ValueAccessorBase,
1717
+ MultipleValueAccessorBase,
1230
1718
  ButtonComponent,
1231
- DatepickerComponent,
1719
+ DatePickerComponent,
1720
+ DateTimePickerComponent,
1232
1721
  CheckboxComponent,
1233
1722
  EmailInputComponent,
1234
1723
  LoadingIndicatorComponent,
1235
1724
  NumberInputComponent,
1236
1725
  PasswordFieldComponent,
1237
1726
  SelectComponent,
1727
+ SelectFooterComponent,
1238
1728
  SortableItemsComponent,
1239
1729
  TextInputComponent,
1240
1730
  ToggleComponent,
@@ -1258,8 +1748,11 @@
1258
1748
 
1259
1749
  exports.ButtonComponent = ButtonComponent;
1260
1750
  exports.CheckboxComponent = CheckboxComponent;
1751
+ exports.DATE_PICKER_TRANSLATIONS = DATE_PICKER_TRANSLATIONS;
1752
+ exports.DATE_TIME_PICKER_TRANSLATIONS = DATE_TIME_PICKER_TRANSLATIONS;
1261
1753
  exports.DEFAULT_ERROR_MESSAGES = DEFAULT_ERROR_MESSAGES;
1262
- exports.DatepickerComponent = DatepickerComponent;
1754
+ exports.DatePickerComponent = DatePickerComponent;
1755
+ exports.DateTimePickerComponent = DateTimePickerComponent;
1263
1756
  exports.EmailInputComponent = EmailInputComponent;
1264
1757
  exports.FORM_ERROR_MESSAGES = FORM_ERROR_MESSAGES;
1265
1758
  exports.FormCaptionComponent = FormCaptionComponent;
@@ -1269,12 +1762,14 @@
1269
1762
  exports.FormSubmitButtonComponent = FormSubmitButtonComponent;
1270
1763
  exports.KLP_DATE_FORMATS = KLP_DATE_FORMATS;
1271
1764
  exports.LoadingIndicatorComponent = LoadingIndicatorComponent;
1765
+ exports.MultipleValueAccessorBase = MultipleValueAccessorBase;
1272
1766
  exports.NgxEnhancyFormsModule = NgxEnhancyFormsModule;
1273
1767
  exports.NumberInputComponent = NumberInputComponent;
1274
1768
  exports.PasswordFieldComponent = PasswordFieldComponent;
1769
+ exports.SELECT_TRANSLATIONS = SELECT_TRANSLATIONS;
1275
1770
  exports.SelectComponent = SelectComponent;
1771
+ exports.SelectFooterComponent = SelectFooterComponent;
1276
1772
  exports.SortableItemsComponent = SortableItemsComponent;
1277
- exports.SubForm = SubForm;
1278
1773
  exports.SubFormDirective = SubFormDirective;
1279
1774
  exports.TextInputComponent = TextInputComponent;
1280
1775
  exports.ToggleComponent = ToggleComponent;