@klippa/ngx-enhancy-forms 2.3.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/klippa-ngx-enhancy-forms.umd.js +960 -469
- package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js +3 -2
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -1
- package/esm2015/lib/elements/date-picker/date-picker.component.js +92 -0
- package/esm2015/lib/elements/date-time-picker/date-time-picker.component.js +311 -0
- package/esm2015/lib/elements/email/email-input.component.js +2 -2
- package/esm2015/lib/elements/password-field/password-field.component.js +6 -4
- package/esm2015/lib/elements/select/select-footer/select-footer.component.js +15 -0
- package/esm2015/lib/elements/select/select.component.js +30 -9
- package/esm2015/lib/elements/sortable-items/sortable-items.component.js +46 -4
- package/esm2015/lib/elements/text-input/text-input.component.js +7 -4
- package/esm2015/lib/elements/value-accessor-base/multiple-value-accessor-base.component.js +63 -0
- package/esm2015/lib/elements/value-accessor-base/value-accessor-base.component.js +3 -3
- package/esm2015/lib/form/form-element/form-element.component.js +13 -15
- package/esm2015/lib/form/form.component.js +64 -18
- package/esm2015/lib/ngx-enhancy-forms.module.js +36 -25
- package/esm2015/lib/util/values.js +8 -17
- package/esm2015/public-api.js +5 -2
- package/fesm2015/klippa-ngx-enhancy-forms.js +556 -90
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
- package/klippa-ngx-enhancy-forms.metadata.json +1 -1
- package/lib/elements/date-picker/date-picker.component.d.ts +23 -0
- package/lib/elements/date-time-picker/date-time-picker.component.d.ts +59 -0
- package/lib/elements/email/email-input.component.d.ts +1 -1
- package/lib/elements/password-field/password-field.component.d.ts +2 -1
- package/lib/elements/select/select-footer/select-footer.component.d.ts +4 -0
- package/lib/elements/select/select.component.d.ts +12 -4
- package/lib/elements/sortable-items/sortable-items.component.d.ts +12 -2
- package/lib/elements/text-input/text-input.component.d.ts +2 -0
- package/lib/elements/value-accessor-base/multiple-value-accessor-base.component.d.ts +11 -0
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +2 -1
- package/lib/form/form-element/form-element.component.d.ts +5 -5
- package/lib/form/form.component.d.ts +11 -7
- package/lib/util/values.d.ts +2 -4
- package/package.json +1 -1
- package/public-api.d.ts +4 -1
- package/esm2015/lib/elements/datepicker/datepicker.component.js +0 -111
- package/lib/elements/datepicker/datepicker.component.d.ts +0 -26
|
@@ -1,390 +1,110 @@
|
|
|
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
|
-
|
|
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
|
|
62
|
-
|
|
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
|
|
72
|
-
return
|
|
13
|
+
function numberIsSet(value) {
|
|
14
|
+
return isValueSet(value) && typeof value === 'number';
|
|
73
15
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
16
|
+
function isValueSet(value) {
|
|
17
|
+
return value !== null && value !== undefined;
|
|
77
18
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
|
98
|
-
|
|
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
|
-
}
|
|
165
|
-
}
|
|
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);
|
|
25
|
+
function stringOrArrayIsSetAndEmpty(value) {
|
|
26
|
+
return value !== null && value !== undefined && value.length === 0;
|
|
179
27
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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.");
|
|
28
|
+
function truncateString(s, length) {
|
|
29
|
+
if (s.length < length) {
|
|
30
|
+
return s;
|
|
31
|
+
}
|
|
32
|
+
return s.substring(0, length) + '...';
|
|
193
33
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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);
|
|
34
|
+
|
|
35
|
+
var invalidFieldsSymbol = Symbol('Not all fields are valid');
|
|
36
|
+
var SubFormDirective = /** @class */ (function () {
|
|
37
|
+
function SubFormDirective() {
|
|
202
38
|
}
|
|
203
|
-
|
|
204
|
-
|
|
39
|
+
return SubFormDirective;
|
|
40
|
+
}());
|
|
41
|
+
SubFormDirective.decorators = [
|
|
42
|
+
{ type: core.Directive, args: [{
|
|
43
|
+
// tslint:disable-next-line:directive-selector
|
|
44
|
+
selector: 'klp-sub-form',
|
|
45
|
+
},] }
|
|
46
|
+
];
|
|
47
|
+
SubFormDirective.propDecorators = {
|
|
48
|
+
injectInto: [{ type: core.Input }],
|
|
49
|
+
at: [{ type: core.Input }]
|
|
50
|
+
};
|
|
51
|
+
var FormComponent = /** @class */ (function () {
|
|
52
|
+
function FormComponent(parent, subFormPlaceholder) {
|
|
53
|
+
this.parent = parent;
|
|
54
|
+
this.subFormPlaceholder = subFormPlaceholder;
|
|
55
|
+
// we keep track of what form controls are actually rendered. Only those count when looking at form validation
|
|
56
|
+
this.activeControls = [];
|
|
205
57
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
58
|
+
FormComponent.prototype.ngOnInit = function () {
|
|
59
|
+
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
60
|
+
var injectInto = this.subFormPlaceholder.injectInto;
|
|
61
|
+
var injectAt = this.subFormPlaceholder.at;
|
|
62
|
+
if (injectInto instanceof forms.FormArray) {
|
|
63
|
+
if (typeof injectAt !== 'number') {
|
|
64
|
+
throw new Error("cannot index FormArray with " + typeof injectAt);
|
|
65
|
+
}
|
|
66
|
+
injectInto.setControl(injectAt, this.formGroup);
|
|
67
|
+
}
|
|
68
|
+
else if (injectInto instanceof forms.FormGroup) {
|
|
69
|
+
if (typeof injectAt !== 'string') {
|
|
70
|
+
throw new Error("cannot index FormGroup with " + typeof injectAt);
|
|
71
|
+
}
|
|
72
|
+
injectInto.setControl(injectAt, this.formGroup);
|
|
73
|
+
}
|
|
210
74
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
throw e.error;
|
|
75
|
+
if (isValueSet(this.patchValueInterceptor)) {
|
|
76
|
+
this.addSupportForPatchValueInterceptor();
|
|
214
77
|
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
r[k] = a[j];
|
|
231
|
-
return r;
|
|
232
|
-
}
|
|
233
|
-
function __spreadArray(to, from, pack) {
|
|
234
|
-
if (pack || arguments.length === 2)
|
|
235
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
236
|
-
if (ar || !(i in from)) {
|
|
237
|
-
if (!ar)
|
|
238
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
239
|
-
ar[i] = from[i];
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
243
|
-
}
|
|
244
|
-
function __await(v) {
|
|
245
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
246
|
-
}
|
|
247
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
248
|
-
if (!Symbol.asyncIterator)
|
|
249
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
250
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
251
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
252
|
-
function verb(n) { if (g[n])
|
|
253
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
254
|
-
function resume(n, v) { try {
|
|
255
|
-
step(g[n](v));
|
|
256
|
-
}
|
|
257
|
-
catch (e) {
|
|
258
|
-
settle(q[0][3], e);
|
|
259
|
-
} }
|
|
260
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
261
|
-
function fulfill(value) { resume("next", value); }
|
|
262
|
-
function reject(value) { resume("throw", value); }
|
|
263
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
264
|
-
resume(q[0][0], q[0][1]); }
|
|
265
|
-
}
|
|
266
|
-
function __asyncDelegator(o) {
|
|
267
|
-
var i, p;
|
|
268
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
269
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
270
|
-
}
|
|
271
|
-
function __asyncValues(o) {
|
|
272
|
-
if (!Symbol.asyncIterator)
|
|
273
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
274
|
-
var m = o[Symbol.asyncIterator], i;
|
|
275
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
276
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
277
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
278
|
-
}
|
|
279
|
-
function __makeTemplateObject(cooked, raw) {
|
|
280
|
-
if (Object.defineProperty) {
|
|
281
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
cooked.raw = raw;
|
|
285
|
-
}
|
|
286
|
-
return cooked;
|
|
287
|
-
}
|
|
288
|
-
;
|
|
289
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
290
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
291
|
-
}) : function (o, v) {
|
|
292
|
-
o["default"] = v;
|
|
293
|
-
};
|
|
294
|
-
function __importStar(mod) {
|
|
295
|
-
if (mod && mod.__esModule)
|
|
296
|
-
return mod;
|
|
297
|
-
var result = {};
|
|
298
|
-
if (mod != null)
|
|
299
|
-
for (var k in mod)
|
|
300
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
301
|
-
__createBinding(result, mod, k);
|
|
302
|
-
__setModuleDefault(result, mod);
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
function __importDefault(mod) {
|
|
306
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
307
|
-
}
|
|
308
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
309
|
-
if (kind === "a" && !f)
|
|
310
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
311
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
312
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
313
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
314
|
-
}
|
|
315
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
316
|
-
if (kind === "m")
|
|
317
|
-
throw new TypeError("Private method is not writable");
|
|
318
|
-
if (kind === "a" && !f)
|
|
319
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
320
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
321
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
322
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function stringIsSetAndNotEmpty(s) {
|
|
326
|
-
return lodash.isString(s) && s.length > 0;
|
|
327
|
-
}
|
|
328
|
-
function isNullOrUndefined(value) {
|
|
329
|
-
return value === null || value === undefined;
|
|
330
|
-
}
|
|
331
|
-
function numberIsSet(value) {
|
|
332
|
-
return isValueSet(value) && typeof value === 'number';
|
|
333
|
-
}
|
|
334
|
-
function isValueSet(value) {
|
|
335
|
-
return value !== null && value !== undefined;
|
|
336
|
-
}
|
|
337
|
-
function stringOrArrayIsSetAndEmpty(value) {
|
|
338
|
-
return value !== null && value !== undefined && value.length === 0;
|
|
339
|
-
}
|
|
340
|
-
function useIfStringIsSet(s) {
|
|
341
|
-
if (stringIsSetAndNotEmpty(s)) {
|
|
342
|
-
return s;
|
|
343
|
-
}
|
|
344
|
-
return undefined;
|
|
345
|
-
}
|
|
346
|
-
function useIfArrayIsSetWithOneItem(a) {
|
|
347
|
-
if (!isNullOrUndefined(a) && a.length === 1) {
|
|
348
|
-
return a[0];
|
|
349
|
-
}
|
|
350
|
-
return undefined;
|
|
351
|
-
}
|
|
352
|
-
function convertParentToChild(originalClass, newClass) {
|
|
353
|
-
return Object.assign(newClass, originalClass);
|
|
354
|
-
}
|
|
355
|
-
function truncateString(s, length) {
|
|
356
|
-
if (s.length < length) {
|
|
357
|
-
return s;
|
|
358
|
-
}
|
|
359
|
-
return s.substring(0, length) + '...';
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
var invalidFieldsSymbol = Symbol('Not all fields are valid');
|
|
363
|
-
// Only used as a 'marker' to define a property will be filled in by a sub form
|
|
364
|
-
var SubForm = /** @class */ (function (_super) {
|
|
365
|
-
__extends(SubForm, _super);
|
|
366
|
-
function SubForm() {
|
|
367
|
-
return _super.call(this, {}, null) || this;
|
|
368
|
-
}
|
|
369
|
-
return SubForm;
|
|
370
|
-
}(forms.FormGroup));
|
|
371
|
-
var FormComponent = /** @class */ (function () {
|
|
372
|
-
function FormComponent(parent, surroundingFormGroupName) {
|
|
373
|
-
this.parent = parent;
|
|
374
|
-
this.surroundingFormGroupName = surroundingFormGroupName;
|
|
375
|
-
// we keep track of what form controls are actually rendered. Only those count when looking at form validation
|
|
376
|
-
this.activeControls = [];
|
|
377
|
-
}
|
|
378
|
-
FormComponent.prototype.ngOnInit = function () {
|
|
379
|
-
var _a;
|
|
380
|
-
if (this.parent && isValueSet((_a = this.surroundingFormGroupName) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
381
|
-
var groupName = String(this.surroundingFormGroupName.name);
|
|
382
|
-
var groupToOverwrite = this.parent.formGroup.get(groupName);
|
|
383
|
-
if (groupToOverwrite instanceof SubForm) {
|
|
384
|
-
this.parent.formGroup.setControl(groupName, this.formGroup);
|
|
78
|
+
};
|
|
79
|
+
FormComponent.prototype.ngOnDestroy = function () {
|
|
80
|
+
var _this = this;
|
|
81
|
+
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
82
|
+
var injectInto = this.subFormPlaceholder.injectInto;
|
|
83
|
+
var injectAt = this.subFormPlaceholder.at;
|
|
84
|
+
if (injectInto instanceof forms.FormArray) {
|
|
85
|
+
var idx = injectInto.controls.findIndex(function (e) { return e === _this.formGroup; });
|
|
86
|
+
injectInto.removeAt(idx);
|
|
87
|
+
}
|
|
88
|
+
else if (injectInto instanceof forms.FormGroup) {
|
|
89
|
+
if (typeof injectAt !== 'string') {
|
|
90
|
+
throw new Error("cannot index FormGroup with " + typeof injectAt);
|
|
91
|
+
}
|
|
92
|
+
injectInto.removeControl(injectAt);
|
|
385
93
|
}
|
|
386
94
|
}
|
|
387
95
|
};
|
|
96
|
+
FormComponent.prototype.addSupportForPatchValueInterceptor = function () {
|
|
97
|
+
var _this = this;
|
|
98
|
+
var fn = this.formGroup.patchValue;
|
|
99
|
+
var newFn = function (value, options) {
|
|
100
|
+
_this.patchValueInterceptor(value).then(function (val) {
|
|
101
|
+
setTimeout(function () {
|
|
102
|
+
fn.call(_this.formGroup, val, options);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
this.formGroup.patchValue = newFn;
|
|
107
|
+
};
|
|
388
108
|
FormComponent.prototype.registerControl = function (formControl, formElement) {
|
|
389
109
|
this.activeControls.push({ formControl: formControl, formElement: formElement });
|
|
390
110
|
if (this.parent) {
|
|
@@ -441,6 +161,7 @@
|
|
|
441
161
|
FormComponent.prototype.trySubmit = function () {
|
|
442
162
|
var _this = this;
|
|
443
163
|
var _a, _b;
|
|
164
|
+
this.formGroup.updateValueAndValidity();
|
|
444
165
|
this.formGroup.markAllAsTouched();
|
|
445
166
|
var allControls = this.getAllFormControls();
|
|
446
167
|
var originalDisabledStates = allControls.map(function (e) {
|
|
@@ -479,23 +200,24 @@
|
|
|
479
200
|
];
|
|
480
201
|
FormComponent.ctorParameters = function () { return [
|
|
481
202
|
{ type: FormComponent, decorators: [{ type: core.SkipSelf }, { type: core.Optional }] },
|
|
482
|
-
{ type:
|
|
203
|
+
{ type: SubFormDirective, decorators: [{ type: core.Optional }] }
|
|
483
204
|
]; };
|
|
484
205
|
FormComponent.propDecorators = {
|
|
485
|
-
formGroup: [{ type: core.Input }]
|
|
206
|
+
formGroup: [{ type: core.Input }],
|
|
207
|
+
patchValueInterceptor: [{ type: core.Input }]
|
|
486
208
|
};
|
|
487
209
|
|
|
488
210
|
var FORM_ERROR_MESSAGES = new core.InjectionToken('form.error.messages');
|
|
489
211
|
var DEFAULT_ERROR_MESSAGES = {
|
|
490
|
-
min:
|
|
491
|
-
max:
|
|
492
|
-
required:
|
|
493
|
-
email:
|
|
494
|
-
minLength:
|
|
495
|
-
maxLength:
|
|
496
|
-
pattern:
|
|
497
|
-
matchPassword:
|
|
498
|
-
date:
|
|
212
|
+
min: 'Use a number larger than %min%',
|
|
213
|
+
max: 'Use a number smaller than %max%',
|
|
214
|
+
required: 'This field is required',
|
|
215
|
+
email: 'Use a valid email address',
|
|
216
|
+
minLength: 'Has to be longer than %minLength% character(s)',
|
|
217
|
+
maxLength: 'Has to be shorter than %maxLength% character(s)',
|
|
218
|
+
pattern: 'This input is not valid',
|
|
219
|
+
matchPassword: 'Passwords must match',
|
|
220
|
+
date: 'Enter a valid date',
|
|
499
221
|
};
|
|
500
222
|
var FormElementComponent = /** @class */ (function () {
|
|
501
223
|
function FormElementComponent(parent, customMessages) {
|
|
@@ -513,8 +235,6 @@
|
|
|
513
235
|
}, message);
|
|
514
236
|
};
|
|
515
237
|
FormElementComponent.prototype.registerControl = function (formControl) {
|
|
516
|
-
// console.log('register');
|
|
517
|
-
// console.log(this.caption);
|
|
518
238
|
this.attachedControl = formControl;
|
|
519
239
|
this.parent.registerControl(formControl, this);
|
|
520
240
|
};
|
|
@@ -561,7 +281,7 @@
|
|
|
561
281
|
// to give some breathing room, we scroll 100px more to the top
|
|
562
282
|
(_a = this.getScrollableParent(this.internalComponentRef.nativeElement)) === null || _a === void 0 ? void 0 : _a.scrollBy(0, -100);
|
|
563
283
|
};
|
|
564
|
-
FormElementComponent.prototype.
|
|
284
|
+
FormElementComponent.prototype.getErrorMessage = function (key) {
|
|
565
285
|
var _a, _b, _c;
|
|
566
286
|
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];
|
|
567
287
|
};
|
|
@@ -570,7 +290,7 @@
|
|
|
570
290
|
FormElementComponent.decorators = [
|
|
571
291
|
{ type: core.Component, args: [{
|
|
572
292
|
selector: 'klp-form-element',
|
|
573
|
-
template: "<ng-template #errorRef>\n\t<div *ngIf=\"getErrorToShow()\" class=\"errorContainer\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(
|
|
293
|
+
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\" [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",
|
|
574
294
|
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%}"]
|
|
575
295
|
},] }
|
|
576
296
|
];
|
|
@@ -612,7 +332,7 @@
|
|
|
612
332
|
if (this.formControl) {
|
|
613
333
|
this.attachedFormControl = this.formControl;
|
|
614
334
|
}
|
|
615
|
-
else if (
|
|
335
|
+
else if (stringIsSetAndFilled(this.formControlName)) {
|
|
616
336
|
this.attachedFormControl = (_a = this.controlContainer) === null || _a === void 0 ? void 0 : _a.control.get(this.formControlName);
|
|
617
337
|
if (isNullOrUndefined(this.attachedFormControl)) {
|
|
618
338
|
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.");
|
|
@@ -682,37 +402,355 @@
|
|
|
682
402
|
this.isLoading = false;
|
|
683
403
|
this.type = 'button';
|
|
684
404
|
}
|
|
685
|
-
Object.defineProperty(ButtonComponent.prototype, "_", {
|
|
686
|
-
get: function () {
|
|
687
|
-
return this.fullWidth;
|
|
688
|
-
},
|
|
689
|
-
enumerable: false,
|
|
690
|
-
configurable: true
|
|
691
|
-
});
|
|
692
|
-
ButtonComponent.prototype.onClick = function (event) {
|
|
693
|
-
if (this.disabled) {
|
|
694
|
-
event.stopPropagation();
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
return ButtonComponent;
|
|
698
|
-
}());
|
|
699
|
-
ButtonComponent.decorators = [
|
|
700
|
-
{ type: core.Component, args: [{
|
|
701
|
-
selector: 'klp-form-button',
|
|
702
|
-
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",
|
|
703
|
-
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}"]
|
|
704
|
-
},] }
|
|
705
|
-
];
|
|
706
|
-
ButtonComponent.propDecorators = {
|
|
707
|
-
variant: [{ type: core.Input }],
|
|
708
|
-
size: [{ type: core.Input }],
|
|
709
|
-
fullWidth: [{ type: core.Input }],
|
|
710
|
-
hasBorder: [{ type: core.Input }],
|
|
711
|
-
disabled: [{ type: core.Input }],
|
|
712
|
-
isLoading: [{ type: core.Input }],
|
|
713
|
-
type: [{ type: core.Input }],
|
|
714
|
-
_: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
|
|
405
|
+
Object.defineProperty(ButtonComponent.prototype, "_", {
|
|
406
|
+
get: function () {
|
|
407
|
+
return this.fullWidth;
|
|
408
|
+
},
|
|
409
|
+
enumerable: false,
|
|
410
|
+
configurable: true
|
|
411
|
+
});
|
|
412
|
+
ButtonComponent.prototype.onClick = function (event) {
|
|
413
|
+
if (this.disabled) {
|
|
414
|
+
event.stopPropagation();
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
return ButtonComponent;
|
|
418
|
+
}());
|
|
419
|
+
ButtonComponent.decorators = [
|
|
420
|
+
{ type: core.Component, args: [{
|
|
421
|
+
selector: 'klp-form-button',
|
|
422
|
+
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",
|
|
423
|
+
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}"]
|
|
424
|
+
},] }
|
|
425
|
+
];
|
|
426
|
+
ButtonComponent.propDecorators = {
|
|
427
|
+
variant: [{ type: core.Input }],
|
|
428
|
+
size: [{ type: core.Input }],
|
|
429
|
+
fullWidth: [{ type: core.Input }],
|
|
430
|
+
hasBorder: [{ type: core.Input }],
|
|
431
|
+
disabled: [{ type: core.Input }],
|
|
432
|
+
isLoading: [{ type: core.Input }],
|
|
433
|
+
type: [{ type: core.Input }],
|
|
434
|
+
_: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
/*! *****************************************************************************
|
|
438
|
+
Copyright (c) Microsoft Corporation.
|
|
439
|
+
|
|
440
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
441
|
+
purpose with or without fee is hereby granted.
|
|
442
|
+
|
|
443
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
444
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
445
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
446
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
447
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
448
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
449
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
450
|
+
***************************************************************************** */
|
|
451
|
+
/* global Reflect, Promise */
|
|
452
|
+
var extendStatics = function (d, b) {
|
|
453
|
+
extendStatics = Object.setPrototypeOf ||
|
|
454
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
455
|
+
function (d, b) { for (var p in b)
|
|
456
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
457
|
+
d[p] = b[p]; };
|
|
458
|
+
return extendStatics(d, b);
|
|
459
|
+
};
|
|
460
|
+
function __extends(d, b) {
|
|
461
|
+
if (typeof b !== "function" && b !== null)
|
|
462
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
463
|
+
extendStatics(d, b);
|
|
464
|
+
function __() { this.constructor = d; }
|
|
465
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
466
|
+
}
|
|
467
|
+
var __assign = function () {
|
|
468
|
+
__assign = Object.assign || function __assign(t) {
|
|
469
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
470
|
+
s = arguments[i];
|
|
471
|
+
for (var p in s)
|
|
472
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
473
|
+
t[p] = s[p];
|
|
474
|
+
}
|
|
475
|
+
return t;
|
|
476
|
+
};
|
|
477
|
+
return __assign.apply(this, arguments);
|
|
478
|
+
};
|
|
479
|
+
function __rest(s, e) {
|
|
480
|
+
var t = {};
|
|
481
|
+
for (var p in s)
|
|
482
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
483
|
+
t[p] = s[p];
|
|
484
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
485
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
486
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
487
|
+
t[p[i]] = s[p[i]];
|
|
488
|
+
}
|
|
489
|
+
return t;
|
|
490
|
+
}
|
|
491
|
+
function __decorate(decorators, target, key, desc) {
|
|
492
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
493
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
494
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
495
|
+
else
|
|
496
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
497
|
+
if (d = decorators[i])
|
|
498
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
499
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
500
|
+
}
|
|
501
|
+
function __param(paramIndex, decorator) {
|
|
502
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
503
|
+
}
|
|
504
|
+
function __metadata(metadataKey, metadataValue) {
|
|
505
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
506
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
507
|
+
}
|
|
508
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
509
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
510
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
511
|
+
function fulfilled(value) { try {
|
|
512
|
+
step(generator.next(value));
|
|
513
|
+
}
|
|
514
|
+
catch (e) {
|
|
515
|
+
reject(e);
|
|
516
|
+
} }
|
|
517
|
+
function rejected(value) { try {
|
|
518
|
+
step(generator["throw"](value));
|
|
519
|
+
}
|
|
520
|
+
catch (e) {
|
|
521
|
+
reject(e);
|
|
522
|
+
} }
|
|
523
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
524
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
function __generator(thisArg, body) {
|
|
528
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
529
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
530
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
531
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
532
|
+
function step(op) {
|
|
533
|
+
if (f)
|
|
534
|
+
throw new TypeError("Generator is already executing.");
|
|
535
|
+
while (_)
|
|
536
|
+
try {
|
|
537
|
+
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)
|
|
538
|
+
return t;
|
|
539
|
+
if (y = 0, t)
|
|
540
|
+
op = [op[0] & 2, t.value];
|
|
541
|
+
switch (op[0]) {
|
|
542
|
+
case 0:
|
|
543
|
+
case 1:
|
|
544
|
+
t = op;
|
|
545
|
+
break;
|
|
546
|
+
case 4:
|
|
547
|
+
_.label++;
|
|
548
|
+
return { value: op[1], done: false };
|
|
549
|
+
case 5:
|
|
550
|
+
_.label++;
|
|
551
|
+
y = op[1];
|
|
552
|
+
op = [0];
|
|
553
|
+
continue;
|
|
554
|
+
case 7:
|
|
555
|
+
op = _.ops.pop();
|
|
556
|
+
_.trys.pop();
|
|
557
|
+
continue;
|
|
558
|
+
default:
|
|
559
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
560
|
+
_ = 0;
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
564
|
+
_.label = op[1];
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
568
|
+
_.label = t[1];
|
|
569
|
+
t = op;
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
if (t && _.label < t[2]) {
|
|
573
|
+
_.label = t[2];
|
|
574
|
+
_.ops.push(op);
|
|
575
|
+
break;
|
|
576
|
+
}
|
|
577
|
+
if (t[2])
|
|
578
|
+
_.ops.pop();
|
|
579
|
+
_.trys.pop();
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
op = body.call(thisArg, _);
|
|
583
|
+
}
|
|
584
|
+
catch (e) {
|
|
585
|
+
op = [6, e];
|
|
586
|
+
y = 0;
|
|
587
|
+
}
|
|
588
|
+
finally {
|
|
589
|
+
f = t = 0;
|
|
590
|
+
}
|
|
591
|
+
if (op[0] & 5)
|
|
592
|
+
throw op[1];
|
|
593
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
597
|
+
if (k2 === undefined)
|
|
598
|
+
k2 = k;
|
|
599
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
600
|
+
}) : (function (o, m, k, k2) {
|
|
601
|
+
if (k2 === undefined)
|
|
602
|
+
k2 = k;
|
|
603
|
+
o[k2] = m[k];
|
|
604
|
+
});
|
|
605
|
+
function __exportStar(m, o) {
|
|
606
|
+
for (var p in m)
|
|
607
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
608
|
+
__createBinding(o, m, p);
|
|
609
|
+
}
|
|
610
|
+
function __values(o) {
|
|
611
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
612
|
+
if (m)
|
|
613
|
+
return m.call(o);
|
|
614
|
+
if (o && typeof o.length === "number")
|
|
615
|
+
return {
|
|
616
|
+
next: function () {
|
|
617
|
+
if (o && i >= o.length)
|
|
618
|
+
o = void 0;
|
|
619
|
+
return { value: o && o[i++], done: !o };
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
623
|
+
}
|
|
624
|
+
function __read(o, n) {
|
|
625
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
626
|
+
if (!m)
|
|
627
|
+
return o;
|
|
628
|
+
var i = m.call(o), r, ar = [], e;
|
|
629
|
+
try {
|
|
630
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
631
|
+
ar.push(r.value);
|
|
632
|
+
}
|
|
633
|
+
catch (error) {
|
|
634
|
+
e = { error: error };
|
|
635
|
+
}
|
|
636
|
+
finally {
|
|
637
|
+
try {
|
|
638
|
+
if (r && !r.done && (m = i["return"]))
|
|
639
|
+
m.call(i);
|
|
640
|
+
}
|
|
641
|
+
finally {
|
|
642
|
+
if (e)
|
|
643
|
+
throw e.error;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return ar;
|
|
647
|
+
}
|
|
648
|
+
/** @deprecated */
|
|
649
|
+
function __spread() {
|
|
650
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
651
|
+
ar = ar.concat(__read(arguments[i]));
|
|
652
|
+
return ar;
|
|
653
|
+
}
|
|
654
|
+
/** @deprecated */
|
|
655
|
+
function __spreadArrays() {
|
|
656
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
657
|
+
s += arguments[i].length;
|
|
658
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
659
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
660
|
+
r[k] = a[j];
|
|
661
|
+
return r;
|
|
662
|
+
}
|
|
663
|
+
function __spreadArray(to, from, pack) {
|
|
664
|
+
if (pack || arguments.length === 2)
|
|
665
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
666
|
+
if (ar || !(i in from)) {
|
|
667
|
+
if (!ar)
|
|
668
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
669
|
+
ar[i] = from[i];
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
673
|
+
}
|
|
674
|
+
function __await(v) {
|
|
675
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
676
|
+
}
|
|
677
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
678
|
+
if (!Symbol.asyncIterator)
|
|
679
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
680
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
681
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
682
|
+
function verb(n) { if (g[n])
|
|
683
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
684
|
+
function resume(n, v) { try {
|
|
685
|
+
step(g[n](v));
|
|
686
|
+
}
|
|
687
|
+
catch (e) {
|
|
688
|
+
settle(q[0][3], e);
|
|
689
|
+
} }
|
|
690
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
691
|
+
function fulfill(value) { resume("next", value); }
|
|
692
|
+
function reject(value) { resume("throw", value); }
|
|
693
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
694
|
+
resume(q[0][0], q[0][1]); }
|
|
695
|
+
}
|
|
696
|
+
function __asyncDelegator(o) {
|
|
697
|
+
var i, p;
|
|
698
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
699
|
+
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; }
|
|
700
|
+
}
|
|
701
|
+
function __asyncValues(o) {
|
|
702
|
+
if (!Symbol.asyncIterator)
|
|
703
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
704
|
+
var m = o[Symbol.asyncIterator], i;
|
|
705
|
+
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);
|
|
706
|
+
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); }); }; }
|
|
707
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
708
|
+
}
|
|
709
|
+
function __makeTemplateObject(cooked, raw) {
|
|
710
|
+
if (Object.defineProperty) {
|
|
711
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
712
|
+
}
|
|
713
|
+
else {
|
|
714
|
+
cooked.raw = raw;
|
|
715
|
+
}
|
|
716
|
+
return cooked;
|
|
717
|
+
}
|
|
718
|
+
;
|
|
719
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
720
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
721
|
+
}) : function (o, v) {
|
|
722
|
+
o["default"] = v;
|
|
715
723
|
};
|
|
724
|
+
function __importStar(mod) {
|
|
725
|
+
if (mod && mod.__esModule)
|
|
726
|
+
return mod;
|
|
727
|
+
var result = {};
|
|
728
|
+
if (mod != null)
|
|
729
|
+
for (var k in mod)
|
|
730
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
731
|
+
__createBinding(result, mod, k);
|
|
732
|
+
__setModuleDefault(result, mod);
|
|
733
|
+
return result;
|
|
734
|
+
}
|
|
735
|
+
function __importDefault(mod) {
|
|
736
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
737
|
+
}
|
|
738
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
739
|
+
if (kind === "a" && !f)
|
|
740
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
741
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
742
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
743
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
744
|
+
}
|
|
745
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
746
|
+
if (kind === "m")
|
|
747
|
+
throw new TypeError("Private method is not writable");
|
|
748
|
+
if (kind === "a" && !f)
|
|
749
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
750
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
751
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
752
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
753
|
+
}
|
|
716
754
|
|
|
717
755
|
var CheckboxComponent = /** @class */ (function (_super) {
|
|
718
756
|
__extends(CheckboxComponent, _super);
|
|
@@ -798,6 +836,7 @@
|
|
|
798
836
|
function PasswordFieldComponent() {
|
|
799
837
|
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
800
838
|
_this.placeholder = 'Password';
|
|
839
|
+
_this.isPasswordConfirm = false;
|
|
801
840
|
return _this;
|
|
802
841
|
}
|
|
803
842
|
return PasswordFieldComponent;
|
|
@@ -805,74 +844,157 @@
|
|
|
805
844
|
PasswordFieldComponent.decorators = [
|
|
806
845
|
{ type: core.Component, args: [{
|
|
807
846
|
selector: 'klp-form-password-field',
|
|
808
|
-
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]=\"
|
|
847
|
+
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",
|
|
809
848
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: PasswordFieldComponent, multi: true }],
|
|
810
849
|
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}"]
|
|
811
850
|
},] }
|
|
812
851
|
];
|
|
813
852
|
PasswordFieldComponent.propDecorators = {
|
|
814
|
-
placeholder: [{ type: core.Input }]
|
|
853
|
+
placeholder: [{ type: core.Input }],
|
|
854
|
+
isPasswordConfirm: [{ type: core.Input }]
|
|
815
855
|
};
|
|
816
856
|
|
|
857
|
+
var SELECT_TRANSLATIONS = new core.InjectionToken('klp.form.select.translations');
|
|
817
858
|
var SelectComponent = /** @class */ (function (_super) {
|
|
818
859
|
__extends(SelectComponent, _super);
|
|
819
|
-
function SelectComponent(parent, controlContainer) {
|
|
860
|
+
function SelectComponent(parent, controlContainer, translations) {
|
|
820
861
|
var _this = _super.call(this, parent, controlContainer) || this;
|
|
821
862
|
_this.parent = parent;
|
|
822
863
|
_this.controlContainer = controlContainer;
|
|
823
|
-
_this.
|
|
864
|
+
_this.translations = translations;
|
|
824
865
|
_this.multiple = false;
|
|
866
|
+
_this.multipleDisplayedAsAmount = false;
|
|
825
867
|
_this.clearable = true;
|
|
826
868
|
_this.onSearch = new core.EventEmitter();
|
|
827
869
|
return _this;
|
|
828
870
|
}
|
|
871
|
+
SelectComponent.prototype.onTextInput = function (value) {
|
|
872
|
+
this.currentQueryString = value;
|
|
873
|
+
this.onSearch.emit(value);
|
|
874
|
+
};
|
|
875
|
+
SelectComponent.prototype.getDefaultTranslation = function (key) {
|
|
876
|
+
var _this = this;
|
|
877
|
+
switch (key) {
|
|
878
|
+
case 'placeholder':
|
|
879
|
+
return function () { var _a; return (_a = _this.placeholder) !== null && _a !== void 0 ? _a : 'Pick an option'; };
|
|
880
|
+
case 'amountSelected':
|
|
881
|
+
return function (amount) { return amount + " selected"; };
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
SelectComponent.prototype.getTranslation = function (key, params) {
|
|
885
|
+
if (params === void 0) { params = null; }
|
|
886
|
+
var _a, _b, _c;
|
|
887
|
+
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);
|
|
888
|
+
};
|
|
829
889
|
return SelectComponent;
|
|
830
890
|
}(ValueAccessorBase));
|
|
831
891
|
SelectComponent.decorators = [
|
|
832
892
|
{ type: core.Component, args: [{
|
|
833
893
|
selector: 'klp-form-select',
|
|
834
|
-
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",
|
|
894
|
+
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",
|
|
835
895
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }],
|
|
836
|
-
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
|
|
896
|
+
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}"]
|
|
837
897
|
},] }
|
|
838
898
|
];
|
|
839
899
|
SelectComponent.ctorParameters = function () { return [
|
|
840
900
|
{ type: FormElementComponent, decorators: [{ type: core.Optional }, { type: core.Host }] },
|
|
841
|
-
{ type: forms.ControlContainer, decorators: [{ type: core.Optional }, { type: core.Host }] }
|
|
901
|
+
{ type: forms.ControlContainer, decorators: [{ type: core.Optional }, { type: core.Host }] },
|
|
902
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [SELECT_TRANSLATIONS,] }, { type: core.Optional }] }
|
|
842
903
|
]; };
|
|
843
904
|
SelectComponent.propDecorators = {
|
|
844
905
|
placeholder: [{ type: core.Input }],
|
|
845
906
|
options: [{ type: core.Input }],
|
|
846
907
|
multiple: [{ type: core.Input }],
|
|
908
|
+
multipleDisplayedAsAmount: [{ type: core.Input }],
|
|
847
909
|
clearable: [{ type: core.Input }],
|
|
848
910
|
dropdownPosition: [{ type: core.Input }],
|
|
849
911
|
customSearchFn: [{ type: core.Input }],
|
|
912
|
+
footerElement: [{ type: core.Input }],
|
|
850
913
|
onSearch: [{ type: core.Output }]
|
|
851
914
|
};
|
|
852
915
|
|
|
916
|
+
var SelectFooterComponent = /** @class */ (function () {
|
|
917
|
+
function SelectFooterComponent() {
|
|
918
|
+
}
|
|
919
|
+
return SelectFooterComponent;
|
|
920
|
+
}());
|
|
921
|
+
SelectFooterComponent.decorators = [
|
|
922
|
+
{ type: core.Component, args: [{
|
|
923
|
+
selector: 'klp-select-footer',
|
|
924
|
+
template: "<div class=\"componentContainer\">\n\t<span class=\"prefix\">{{prefix}}</span>\n\t<span class=\"text\">{{text}}</span>\n</div>\n",
|
|
925
|
+
styles: [":host{display:block}.componentContainer{cursor:pointer;padding:6px 10px}.componentContainer:hover{background:#e7faee}.prefix{font-size:80%;padding-right:.625rem}"]
|
|
926
|
+
},] }
|
|
927
|
+
];
|
|
928
|
+
SelectFooterComponent.propDecorators = {
|
|
929
|
+
prefix: [{ type: core.Input }],
|
|
930
|
+
text: [{ type: core.Input }]
|
|
931
|
+
};
|
|
932
|
+
|
|
853
933
|
var SortableItemsComponent = /** @class */ (function (_super) {
|
|
854
934
|
__extends(SortableItemsComponent, _super);
|
|
855
935
|
function SortableItemsComponent() {
|
|
856
936
|
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
857
937
|
_this.sortableItemSize = 'lg';
|
|
938
|
+
_this.useCustomScroll = false;
|
|
939
|
+
_this.scrollInterval = null;
|
|
858
940
|
_this.itemsOrderChanged = function () {
|
|
859
941
|
_this.setInnerValueAndNotify(_this.innerValue);
|
|
860
942
|
};
|
|
943
|
+
_this.onItemDrag = function (data) {
|
|
944
|
+
// if the item you're dragging is reaching the top, start scrolling.
|
|
945
|
+
if (data.relatedRect.top < 100) {
|
|
946
|
+
_this.scrollPage(100);
|
|
947
|
+
}
|
|
948
|
+
else {
|
|
949
|
+
_this.stopScrolling();
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
_this.onEnd = function () {
|
|
953
|
+
_this.stopScrolling();
|
|
954
|
+
};
|
|
861
955
|
return _this;
|
|
862
956
|
}
|
|
957
|
+
SortableItemsComponent.prototype.ngOnInit = function () {
|
|
958
|
+
_super.prototype.ngOnInit.call(this);
|
|
959
|
+
if (this.useCustomScroll) {
|
|
960
|
+
this.sortablejsOptions = { onUpdate: this.itemsOrderChanged, onMove: this.onItemDrag, onEnd: this.onEnd };
|
|
961
|
+
}
|
|
962
|
+
else {
|
|
963
|
+
this.sortablejsOptions = { onUpdate: this.itemsOrderChanged };
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
SortableItemsComponent.prototype.scrollPage = function (scrollAmount) {
|
|
967
|
+
var _this = this;
|
|
968
|
+
if (!isValueSet(this.scrollInterval)) {
|
|
969
|
+
this.scrollInterval = setInterval(function () {
|
|
970
|
+
window.scroll({
|
|
971
|
+
top: document.scrollingElement.scrollTop - scrollAmount,
|
|
972
|
+
behavior: 'smooth',
|
|
973
|
+
});
|
|
974
|
+
if (document.scrollingElement.scrollTop <= 100) {
|
|
975
|
+
_this.stopScrolling();
|
|
976
|
+
}
|
|
977
|
+
}, 100);
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
SortableItemsComponent.prototype.stopScrolling = function () {
|
|
981
|
+
clearInterval(this.scrollInterval);
|
|
982
|
+
this.scrollInterval = null;
|
|
983
|
+
};
|
|
863
984
|
return SortableItemsComponent;
|
|
864
985
|
}(ValueAccessorBase));
|
|
865
986
|
SortableItemsComponent.decorators = [
|
|
866
987
|
{ type: core.Component, args: [{
|
|
867
988
|
selector: 'klp-form-sortable-items',
|
|
868
|
-
template: "<ng-template #listItem>\n\t<li *ngFor=\"let item of innerValue; index as index\"\n\t
|
|
989
|
+
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",
|
|
869
990
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SortableItemsComponent, multi: true }],
|
|
870
991
|
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}"]
|
|
871
992
|
},] }
|
|
872
993
|
];
|
|
873
994
|
SortableItemsComponent.propDecorators = {
|
|
874
995
|
template: [{ type: core.ContentChild, args: [core.TemplateRef,] }],
|
|
875
|
-
sortableItemSize: [{ type: core.Input }]
|
|
996
|
+
sortableItemSize: [{ type: core.Input }],
|
|
997
|
+
useCustomScroll: [{ type: core.Input }]
|
|
876
998
|
};
|
|
877
999
|
|
|
878
1000
|
var TextInputComponent = /** @class */ (function (_super) {
|
|
@@ -880,6 +1002,7 @@
|
|
|
880
1002
|
function TextInputComponent() {
|
|
881
1003
|
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
882
1004
|
_this.type = 'text';
|
|
1005
|
+
_this.clearable = false;
|
|
883
1006
|
return _this;
|
|
884
1007
|
}
|
|
885
1008
|
return TextInputComponent;
|
|
@@ -887,14 +1010,16 @@
|
|
|
887
1010
|
TextInputComponent.decorators = [
|
|
888
1011
|
{ type: core.Component, args: [{
|
|
889
1012
|
selector: 'klp-form-text-input',
|
|
890
|
-
template: "<
|
|
1013
|
+
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",
|
|
891
1014
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }],
|
|
892
|
-
styles: [":host
|
|
1015
|
+
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}"]
|
|
893
1016
|
},] }
|
|
894
1017
|
];
|
|
895
1018
|
TextInputComponent.propDecorators = {
|
|
896
1019
|
placeholder: [{ type: core.Input }],
|
|
897
|
-
type: [{ type: core.Input }]
|
|
1020
|
+
type: [{ type: core.Input }],
|
|
1021
|
+
clearable: [{ type: core.Input }],
|
|
1022
|
+
icon: [{ type: core.Input }]
|
|
898
1023
|
};
|
|
899
1024
|
|
|
900
1025
|
var ToggleComponent = /** @class */ (function (_super) {
|
|
@@ -1039,38 +1164,226 @@
|
|
|
1039
1164
|
_: [{ type: core.HostBinding, args: ['class._fullWidth',] }]
|
|
1040
1165
|
};
|
|
1041
1166
|
|
|
1167
|
+
var MultipleValueAccessorBase = /** @class */ (function (_super) {
|
|
1168
|
+
__extends(MultipleValueAccessorBase, _super);
|
|
1169
|
+
function MultipleValueAccessorBase(parent, controlContainer) {
|
|
1170
|
+
var _this = _super.call(this, parent, controlContainer) || this;
|
|
1171
|
+
_this.parent = parent;
|
|
1172
|
+
_this.controlContainer = controlContainer;
|
|
1173
|
+
_this.multiple = false;
|
|
1174
|
+
return _this;
|
|
1175
|
+
}
|
|
1176
|
+
MultipleValueAccessorBase.prototype.writeValue = function (value) {
|
|
1177
|
+
if (this.multiple) {
|
|
1178
|
+
if (Array.isArray(value)) {
|
|
1179
|
+
_super.prototype.writeValue.call(this, value.filter(isValueSet));
|
|
1180
|
+
}
|
|
1181
|
+
else {
|
|
1182
|
+
_super.prototype.writeValue.call(this, [value].filter(isValueSet));
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
if (Array.isArray(value)) {
|
|
1187
|
+
_super.prototype.writeValue.call(this, value[0]);
|
|
1188
|
+
}
|
|
1189
|
+
else {
|
|
1190
|
+
_super.prototype.writeValue.call(this, value);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
MultipleValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
|
|
1195
|
+
if (this.multiple) {
|
|
1196
|
+
if (Array.isArray(value)) {
|
|
1197
|
+
_super.prototype.setInnerValueAndNotify.call(this, value.filter(isValueSet));
|
|
1198
|
+
}
|
|
1199
|
+
else {
|
|
1200
|
+
_super.prototype.setInnerValueAndNotify.call(this, [value].filter(isValueSet));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
else {
|
|
1204
|
+
if (Array.isArray(value)) {
|
|
1205
|
+
_super.prototype.setInnerValueAndNotify.call(this, value[0]);
|
|
1206
|
+
}
|
|
1207
|
+
else {
|
|
1208
|
+
_super.prototype.setInnerValueAndNotify.call(this, value);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
return MultipleValueAccessorBase;
|
|
1213
|
+
}(ValueAccessorBase));
|
|
1214
|
+
MultipleValueAccessorBase.decorators = [
|
|
1215
|
+
{ type: core.Component, args: [{
|
|
1216
|
+
selector: '',
|
|
1217
|
+
template: ''
|
|
1218
|
+
},] }
|
|
1219
|
+
];
|
|
1220
|
+
MultipleValueAccessorBase.ctorParameters = function () { return [
|
|
1221
|
+
{ type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1222
|
+
{ type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] }
|
|
1223
|
+
]; };
|
|
1224
|
+
MultipleValueAccessorBase.propDecorators = {
|
|
1225
|
+
multiple: [{ type: core.Input }]
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1042
1228
|
var invalidDateKey = '--invalid_date--';
|
|
1043
1229
|
function dateValidator(control) {
|
|
1044
1230
|
var invalid = control.value === invalidDateKey;
|
|
1045
1231
|
return invalid ? { date: control.value } : null;
|
|
1046
1232
|
}
|
|
1047
1233
|
|
|
1234
|
+
var DATE_PICKER_TRANSLATIONS = new core.InjectionToken('klp.form.date.translations');
|
|
1235
|
+
var DatePickerComponent = /** @class */ (function (_super) {
|
|
1236
|
+
__extends(DatePickerComponent, _super);
|
|
1237
|
+
function DatePickerComponent(parent, controlContainer, translations) {
|
|
1238
|
+
var _this = _super.call(this, parent, controlContainer) || this;
|
|
1239
|
+
_this.parent = parent;
|
|
1240
|
+
_this.controlContainer = controlContainer;
|
|
1241
|
+
_this.translations = translations;
|
|
1242
|
+
_this.minDate = undefined;
|
|
1243
|
+
_this.maxDate = undefined;
|
|
1244
|
+
_this.sameMonthOnly = false;
|
|
1245
|
+
_this.format = 'dd-MM-yyyy';
|
|
1246
|
+
_this.clearable = false;
|
|
1247
|
+
return _this;
|
|
1248
|
+
}
|
|
1249
|
+
DatePickerComponent.prototype.writeValue = function (value) {
|
|
1250
|
+
if (value === invalidDateKey) {
|
|
1251
|
+
_super.prototype.writeValue.call(this, invalidDateKey);
|
|
1252
|
+
}
|
|
1253
|
+
else if (isNullOrUndefined(value)) {
|
|
1254
|
+
this.dateValue = null;
|
|
1255
|
+
_super.prototype.writeValue.call(this, null);
|
|
1256
|
+
}
|
|
1257
|
+
else {
|
|
1258
|
+
if (Array.isArray(value)) {
|
|
1259
|
+
this.dateValue = value.map(function (e) { return dateFns.parse(e, 'yyyy-MM-dd', new Date()); });
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
this.dateValue = dateFns.parse(value, 'yyyy-MM-dd', new Date());
|
|
1263
|
+
}
|
|
1264
|
+
_super.prototype.writeValue.call(this, value);
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
DatePickerComponent.prototype.dateChanged = function (value) {
|
|
1268
|
+
if (value === invalidDateKey) {
|
|
1269
|
+
this.setInnerValueAndNotify(invalidDateKey);
|
|
1270
|
+
}
|
|
1271
|
+
else if (isNullOrUndefined(value)) {
|
|
1272
|
+
this.dateValue = null;
|
|
1273
|
+
this.setInnerValueAndNotify(null);
|
|
1274
|
+
}
|
|
1275
|
+
else {
|
|
1276
|
+
this.dateValue = value;
|
|
1277
|
+
if (Array.isArray(value)) {
|
|
1278
|
+
this.setInnerValueAndNotify(value.map(function (e) { return dateFns.format(e, 'yyyy-MM-dd'); }));
|
|
1279
|
+
}
|
|
1280
|
+
else {
|
|
1281
|
+
this.setInnerValueAndNotify(dateFns.format(value, 'yyyy-MM-dd'));
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
DatePickerComponent.prototype.getDefaultTranslation = function (key) {
|
|
1286
|
+
var _this = this;
|
|
1287
|
+
switch (key) {
|
|
1288
|
+
case 'placeholder':
|
|
1289
|
+
return function () { var _a; return (_a = _this.placeholder) !== null && _a !== void 0 ? _a : 'Select date'; };
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
DatePickerComponent.prototype.getTranslation = function (key, params) {
|
|
1293
|
+
if (params === void 0) { params = null; }
|
|
1294
|
+
var _a, _b, _c;
|
|
1295
|
+
if (key === 'placeholder' && this.multiple) {
|
|
1296
|
+
return '';
|
|
1297
|
+
}
|
|
1298
|
+
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);
|
|
1299
|
+
};
|
|
1300
|
+
return DatePickerComponent;
|
|
1301
|
+
}(MultipleValueAccessorBase));
|
|
1302
|
+
DatePickerComponent.decorators = [
|
|
1303
|
+
{ type: core.Component, args: [{
|
|
1304
|
+
selector: 'klp-form-date-picker',
|
|
1305
|
+
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",
|
|
1306
|
+
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: DatePickerComponent, multi: true }],
|
|
1307
|
+
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}"]
|
|
1308
|
+
},] }
|
|
1309
|
+
];
|
|
1310
|
+
DatePickerComponent.ctorParameters = function () { return [
|
|
1311
|
+
{ type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1312
|
+
{ type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1313
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [DATE_PICKER_TRANSLATIONS,] }, { type: core.Optional }] }
|
|
1314
|
+
]; };
|
|
1315
|
+
DatePickerComponent.propDecorators = {
|
|
1316
|
+
minDate: [{ type: core.Input }],
|
|
1317
|
+
maxDate: [{ type: core.Input }],
|
|
1318
|
+
sameMonthOnly: [{ type: core.Input }],
|
|
1319
|
+
format: [{ type: core.Input }],
|
|
1320
|
+
placeholder: [{ type: core.Input }],
|
|
1321
|
+
clearable: [{ type: core.Input }]
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1048
1324
|
var KLP_DATE_FORMATS = new core.InjectionToken('klp.form.date.formats');
|
|
1325
|
+
var DATE_TIME_PICKER_TRANSLATIONS = new core.InjectionToken('klp.form.dateTime.translations');
|
|
1049
1326
|
function matDateFormatsFactory(component, dateFormats) {
|
|
1050
1327
|
var _a;
|
|
1051
1328
|
return (_a = dateFormats === null || dateFormats === void 0 ? void 0 : dateFormats(component.format)) !== null && _a !== void 0 ? _a : core$1.MAT_NATIVE_DATE_FORMATS;
|
|
1052
1329
|
}
|
|
1053
|
-
var
|
|
1054
|
-
__extends(
|
|
1055
|
-
function
|
|
1056
|
-
var _this = _super.
|
|
1330
|
+
var DateTimePickerComponent = /** @class */ (function (_super) {
|
|
1331
|
+
__extends(DateTimePickerComponent, _super);
|
|
1332
|
+
function DateTimePickerComponent(parent, controlContainer, translations, cdr) {
|
|
1333
|
+
var _this = _super.call(this, parent, controlContainer) || this;
|
|
1334
|
+
_this.parent = parent;
|
|
1335
|
+
_this.controlContainer = controlContainer;
|
|
1336
|
+
_this.translations = translations;
|
|
1337
|
+
_this.cdr = cdr;
|
|
1057
1338
|
_this.minDate = undefined;
|
|
1058
1339
|
_this.maxDate = undefined;
|
|
1059
|
-
_this.
|
|
1340
|
+
_this.sameMonthOnly = false;
|
|
1341
|
+
_this.format = 'dd-MM-yyyy';
|
|
1060
1342
|
_this.clearable = false;
|
|
1343
|
+
_this.showTimeInput = true;
|
|
1344
|
+
_this.invalidTimeAsMidnight = false; // if the time is not valid, use 00:00 as the time
|
|
1061
1345
|
_this.minDateStartOfDay = undefined;
|
|
1062
1346
|
_this.maxDateEndOfDay = undefined;
|
|
1347
|
+
_this.selectedDates = [];
|
|
1348
|
+
_this.dateTouched = false;
|
|
1349
|
+
_this.hoursTouched = false;
|
|
1350
|
+
_this.minutesTouched = false;
|
|
1351
|
+
_this.isSelected = function (d) {
|
|
1352
|
+
if (_this.multiple) {
|
|
1353
|
+
return _this.selectedDates.some(function (e) { return e.getTime() === d.getTime(); }) ? 'selected' : '';
|
|
1354
|
+
}
|
|
1355
|
+
return '';
|
|
1356
|
+
};
|
|
1357
|
+
_this.filterDates = function (e) {
|
|
1358
|
+
if (_this.disabled) {
|
|
1359
|
+
return false;
|
|
1360
|
+
}
|
|
1361
|
+
return true;
|
|
1362
|
+
};
|
|
1063
1363
|
return _this;
|
|
1064
1364
|
}
|
|
1065
|
-
|
|
1365
|
+
DateTimePickerComponent.prototype.ngOnInit = function () {
|
|
1366
|
+
_super.prototype.ngOnInit.call(this);
|
|
1367
|
+
if (this.multiple) {
|
|
1368
|
+
this.placeholder = '';
|
|
1369
|
+
this.showTimeInput = false;
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
DateTimePickerComponent.prototype.ngAfterViewInit = function () {
|
|
1373
|
+
if (this.multiple) {
|
|
1374
|
+
// we are going to overwrite the datepicker closing fn later, so we are saving it here to restore it when needed
|
|
1375
|
+
this.datePickingClosingFn = this.datePickerRef.close;
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
DateTimePickerComponent.prototype.ngOnChanges = function (changes) {
|
|
1066
1379
|
if (changes.minDate) {
|
|
1067
|
-
this.
|
|
1380
|
+
this.determineMinAndMaxDates();
|
|
1068
1381
|
}
|
|
1069
1382
|
if (changes.maxDate) {
|
|
1070
|
-
this.
|
|
1383
|
+
this.determineMinAndMaxDates();
|
|
1071
1384
|
}
|
|
1072
1385
|
};
|
|
1073
|
-
|
|
1386
|
+
DateTimePickerComponent.prototype.setMinDate = function (minDate) {
|
|
1074
1387
|
if (minDate) {
|
|
1075
1388
|
this.minDateStartOfDay = new Date(minDate);
|
|
1076
1389
|
this.minDateStartOfDay.setHours(0, 0, 0, 0);
|
|
@@ -1079,7 +1392,7 @@
|
|
|
1079
1392
|
this.minDateStartOfDay = undefined;
|
|
1080
1393
|
}
|
|
1081
1394
|
};
|
|
1082
|
-
|
|
1395
|
+
DateTimePickerComponent.prototype.setMaxDate = function (maxDate) {
|
|
1083
1396
|
if (maxDate) {
|
|
1084
1397
|
this.maxDateEndOfDay = new Date(maxDate);
|
|
1085
1398
|
this.maxDateEndOfDay.setHours(23, 59, 59, 999);
|
|
@@ -1088,67 +1401,231 @@
|
|
|
1088
1401
|
this.maxDateEndOfDay = undefined;
|
|
1089
1402
|
}
|
|
1090
1403
|
};
|
|
1404
|
+
DateTimePickerComponent.prototype.getSelectedMonths = function () {
|
|
1405
|
+
return removeDuplicatesFromArray(this.selectedDates.map(function (e) { return dateFns.format(e, 'MMMM'); })).length;
|
|
1406
|
+
};
|
|
1091
1407
|
// dateChanged is called when the output of the datepicker is changed and
|
|
1092
1408
|
// parsed correctly. If the date is invalid, it will be called the first time
|
|
1093
1409
|
// with null but never again until a valid input is provided.
|
|
1094
|
-
|
|
1095
|
-
var
|
|
1410
|
+
DateTimePickerComponent.prototype.dateChanged = function (event) {
|
|
1411
|
+
var _this = this;
|
|
1096
1412
|
var date = event.value;
|
|
1097
|
-
if (
|
|
1098
|
-
this.
|
|
1413
|
+
if (this.multiple) {
|
|
1414
|
+
this.datePickerRef.close = function () {
|
|
1415
|
+
};
|
|
1416
|
+
if (this.selectedDates.some(function (e) { return e.getTime() === date.getTime(); })) {
|
|
1417
|
+
this.selectedDates = this.selectedDates.filter(function (e) { return e.getTime() !== date.getTime(); });
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
this.selectedDates = __spread(this.selectedDates, [date]);
|
|
1421
|
+
}
|
|
1422
|
+
// START HACK
|
|
1423
|
+
// the date picker does not provide any rerender calls. Therefore, we are going to change the minDate in order to force the render
|
|
1424
|
+
// This is needed to show all selected days in our date picker
|
|
1425
|
+
// We also set the innerValue to null (with this.valueForMaterialDatePicker = null;), otherwise you can not
|
|
1426
|
+
// deselect your last picked date
|
|
1427
|
+
this.cdr.detectChanges();
|
|
1428
|
+
this.valueForMaterialDatePicker = null;
|
|
1429
|
+
var oldMinDate = this.minDateStartOfDay;
|
|
1430
|
+
this.minDateStartOfDay = new Date(0);
|
|
1431
|
+
this.cdr.detectChanges();
|
|
1432
|
+
this.minDateStartOfDay = oldMinDate;
|
|
1433
|
+
// END HACK
|
|
1434
|
+
if (this.sameMonthOnly) {
|
|
1435
|
+
if (this.selectedDates.length >= 2) {
|
|
1436
|
+
if (date < dateFns.startOfMonth(this.selectedDates[0]) || date > dateFns.endOfMonth(this.selectedDates[0])) {
|
|
1437
|
+
this.selectedDates = [date];
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
this.determineMinAndMaxDates();
|
|
1441
|
+
}
|
|
1442
|
+
this.setInnerValueAndNotify(this.selectedDates);
|
|
1443
|
+
setTimeout(function () {
|
|
1444
|
+
_this.datePickerRef.close = _this.datePickingClosingFn;
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
else {
|
|
1448
|
+
this.notifyNewDate();
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
DateTimePickerComponent.prototype.determineMinAndMaxDates = function () {
|
|
1452
|
+
if (this.sameMonthOnly) {
|
|
1453
|
+
if (this.selectedDates.length >= 2) {
|
|
1454
|
+
this.setMinDate(dateFns.startOfMonth(this.selectedDates[0]));
|
|
1455
|
+
this.setMaxDate(dateFns.endOfMonth(this.selectedDates[0]));
|
|
1456
|
+
}
|
|
1457
|
+
else {
|
|
1458
|
+
this.setMinDate(this.minDate);
|
|
1459
|
+
this.setMaxDate(this.maxDate);
|
|
1460
|
+
}
|
|
1099
1461
|
}
|
|
1100
1462
|
else {
|
|
1101
|
-
this.
|
|
1463
|
+
this.setMinDate(this.minDate);
|
|
1464
|
+
this.setMinDate(this.maxDate);
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
DateTimePickerComponent.prototype.notifyNewDate = function () {
|
|
1468
|
+
var nativeInputValue = this.nativeInputRef.nativeElement.value;
|
|
1469
|
+
var parsedHours = Number(this.hours);
|
|
1470
|
+
var parsedMinutes = Number(this.minutes);
|
|
1471
|
+
// if we dont have the time element
|
|
1472
|
+
if (!this.showTimeInput) {
|
|
1473
|
+
if (!stringIsSetAndFilled(nativeInputValue)) {
|
|
1474
|
+
this.setInnerValueAndNotify(null);
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
if (this.valueForMaterialDatePicker instanceof Date) {
|
|
1478
|
+
this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
// when all inputs are empty
|
|
1483
|
+
if (!stringIsSetAndFilled(nativeInputValue) && !stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
|
|
1484
|
+
this.setInnerValueAndNotify(null);
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
// if we have date and time
|
|
1488
|
+
if (stringIsSetAndFilled(this.hours) &&
|
|
1489
|
+
Number.isFinite(parsedHours) &&
|
|
1490
|
+
parsedHours >= 0 &&
|
|
1491
|
+
parsedHours <= 23 &&
|
|
1492
|
+
stringIsSetAndFilled(this.minutes) &&
|
|
1493
|
+
Number.isFinite(parsedMinutes) &&
|
|
1494
|
+
parsedMinutes >= 0 &&
|
|
1495
|
+
parsedMinutes <= 59 &&
|
|
1496
|
+
this.valueForMaterialDatePicker instanceof Date) {
|
|
1497
|
+
var newDateWithHours = new Date(this.valueForMaterialDatePicker.setHours(parsedHours));
|
|
1498
|
+
var newDateWithMinutes = new Date(newDateWithHours.setMinutes(parsedMinutes));
|
|
1499
|
+
this.setInnerValueAndNotify(newDateWithMinutes);
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
if (this.invalidTimeAsMidnight) {
|
|
1503
|
+
if (this.valueForMaterialDatePicker instanceof Date) {
|
|
1504
|
+
this.setInnerValueAndNotify(this.valueForMaterialDatePicker);
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1102
1507
|
}
|
|
1508
|
+
// all other cases, we are not in a valid state
|
|
1509
|
+
this.setInnerValueAndNotify(invalidDateKey);
|
|
1103
1510
|
};
|
|
1104
|
-
|
|
1511
|
+
DateTimePickerComponent.prototype.writeValue = function (value) {
|
|
1105
1512
|
_super.prototype.writeValue.call(this, value);
|
|
1106
|
-
|
|
1513
|
+
if (Array.isArray(value)) {
|
|
1514
|
+
this.selectedDates = value;
|
|
1515
|
+
this.determineMinAndMaxDates();
|
|
1516
|
+
this.valueForMaterialDatePicker = null;
|
|
1517
|
+
}
|
|
1518
|
+
else {
|
|
1519
|
+
this.valueForMaterialDatePicker = value === invalidDateKey ? null : value;
|
|
1520
|
+
if (value instanceof Date) {
|
|
1521
|
+
this.hours = String(value.getHours());
|
|
1522
|
+
this.minutes = String(value.getMinutes());
|
|
1523
|
+
this.formatTime();
|
|
1524
|
+
}
|
|
1525
|
+
else {
|
|
1526
|
+
this.hours = '';
|
|
1527
|
+
this.minutes = '';
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1107
1530
|
};
|
|
1108
1531
|
// nativeValueChanged is called when the internal text value changes, but not
|
|
1109
1532
|
// when the date is changed via the date picker. We need this so that we can
|
|
1110
1533
|
// determine if the datepicker is empty or invalid.
|
|
1111
|
-
|
|
1112
|
-
var nativeInputValue = event.target.value;
|
|
1113
|
-
var date = this.valueForMaterialDatePicker;
|
|
1534
|
+
DateTimePickerComponent.prototype.nativeValueChanged = function () {
|
|
1114
1535
|
if (this.datePickerRef.opened) {
|
|
1115
1536
|
// if the user is typing instead of using the picker, close it.
|
|
1116
1537
|
this.datePickerRef.close();
|
|
1117
1538
|
}
|
|
1118
|
-
|
|
1119
|
-
this.setInnerValueAndNotify(invalidDateKey);
|
|
1120
|
-
}
|
|
1121
|
-
else {
|
|
1122
|
-
this.setInnerValueAndNotify(date);
|
|
1123
|
-
}
|
|
1539
|
+
this.notifyNewDate();
|
|
1124
1540
|
};
|
|
1125
|
-
|
|
1541
|
+
DateTimePickerComponent.prototype.resetToNull = function () {
|
|
1126
1542
|
this.setInnerValueAndNotify(null);
|
|
1127
1543
|
this.valueForMaterialDatePicker = null;
|
|
1128
1544
|
this.nativeInputRef.nativeElement.value = null;
|
|
1545
|
+
this.hours = '';
|
|
1546
|
+
this.minutes = '';
|
|
1547
|
+
this.selectedDates = [];
|
|
1129
1548
|
};
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1549
|
+
DateTimePickerComponent.prototype.formatTime = function () {
|
|
1550
|
+
if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
|
|
1551
|
+
this.hours = '0' + this.hours;
|
|
1552
|
+
}
|
|
1553
|
+
if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
|
|
1554
|
+
this.minutes = '0' + this.minutes;
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
DateTimePickerComponent.prototype.touchDate = function () {
|
|
1558
|
+
this.dateTouched = true;
|
|
1559
|
+
this.determineAllTouched();
|
|
1560
|
+
};
|
|
1561
|
+
DateTimePickerComponent.prototype.touchHours = function () {
|
|
1562
|
+
this.hoursTouched = true;
|
|
1563
|
+
this.determineAllTouched();
|
|
1564
|
+
};
|
|
1565
|
+
DateTimePickerComponent.prototype.touchMinutes = function () {
|
|
1566
|
+
this.minutesTouched = true;
|
|
1567
|
+
this.determineAllTouched();
|
|
1568
|
+
};
|
|
1569
|
+
DateTimePickerComponent.prototype.determineAllTouched = function () {
|
|
1570
|
+
if ((this.dateTouched && this.hoursTouched && this.minutesTouched) || (this.dateTouched && !this.showTimeInput)) {
|
|
1571
|
+
this.touch();
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
DateTimePickerComponent.prototype.getDefaultTranslation = function (key) {
|
|
1575
|
+
var _this = this;
|
|
1576
|
+
switch (key) {
|
|
1577
|
+
case 'placeholder':
|
|
1578
|
+
return function () { var _a; return (_a = _this.placeholder) !== null && _a !== void 0 ? _a : 'Select date'; };
|
|
1579
|
+
case 'selectDays':
|
|
1580
|
+
return function () { return 'Select day(s)'; };
|
|
1581
|
+
case 'selectedDate':
|
|
1582
|
+
return function (d) { return d.toLocaleDateString(); };
|
|
1583
|
+
case 'daysSelected':
|
|
1584
|
+
return function (amount) { return amount + " days selected"; };
|
|
1585
|
+
case 'selectedInMonth':
|
|
1586
|
+
return function (d) { return " in " + dateFns.format(d, 'MMMM'); };
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
DateTimePickerComponent.prototype.getTranslation = function (key, params) {
|
|
1590
|
+
if (params === void 0) { params = null; }
|
|
1591
|
+
var _a, _b, _c;
|
|
1592
|
+
if (key === 'placeholder' && this.multiple) {
|
|
1593
|
+
return '';
|
|
1594
|
+
}
|
|
1595
|
+
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);
|
|
1596
|
+
};
|
|
1597
|
+
return DateTimePickerComponent;
|
|
1598
|
+
}(MultipleValueAccessorBase));
|
|
1599
|
+
DateTimePickerComponent.decorators = [
|
|
1133
1600
|
{ type: core.Component, args: [{
|
|
1134
|
-
selector: 'klp-form-
|
|
1135
|
-
template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<mat-form-field [
|
|
1601
|
+
selector: 'klp-form-date-time-picker',
|
|
1602
|
+
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",
|
|
1136
1603
|
providers: [
|
|
1137
|
-
{ provide: forms.NG_VALUE_ACCESSOR, useExisting:
|
|
1138
|
-
{
|
|
1139
|
-
|
|
1604
|
+
{ provide: forms.NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1605
|
+
{
|
|
1606
|
+
provide: core$1.MAT_DATE_FORMATS,
|
|
1607
|
+
deps: [DateTimePickerComponent, [new core.Optional(), KLP_DATE_FORMATS]],
|
|
1140
1608
|
useFactory: matDateFormatsFactory,
|
|
1141
1609
|
}
|
|
1142
1610
|
],
|
|
1143
|
-
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:
|
|
1611
|
+
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}"]
|
|
1144
1612
|
},] }
|
|
1145
1613
|
];
|
|
1146
|
-
|
|
1614
|
+
DateTimePickerComponent.ctorParameters = function () { return [
|
|
1615
|
+
{ type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1616
|
+
{ type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1617
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [DATE_TIME_PICKER_TRANSLATIONS,] }, { type: core.Optional }] },
|
|
1618
|
+
{ type: core.ChangeDetectorRef }
|
|
1619
|
+
]; };
|
|
1620
|
+
DateTimePickerComponent.propDecorators = {
|
|
1147
1621
|
minDate: [{ type: core.Input }],
|
|
1148
1622
|
maxDate: [{ type: core.Input }],
|
|
1623
|
+
sameMonthOnly: [{ type: core.Input }],
|
|
1149
1624
|
format: [{ type: core.Input }],
|
|
1150
1625
|
placeholder: [{ type: core.Input }],
|
|
1151
1626
|
clearable: [{ type: core.Input }],
|
|
1627
|
+
showTimeInput: [{ type: core.Input }],
|
|
1628
|
+
invalidTimeAsMidnight: [{ type: core.Input }],
|
|
1152
1629
|
nativeInputRef: [{ type: core.ViewChild, args: ['nativeInput',] }],
|
|
1153
1630
|
datePickerRef: [{ type: core.ViewChild, args: ['picker',] }]
|
|
1154
1631
|
};
|
|
@@ -1183,14 +1660,17 @@
|
|
|
1183
1660
|
],
|
|
1184
1661
|
declarations: [
|
|
1185
1662
|
ValueAccessorBase,
|
|
1663
|
+
MultipleValueAccessorBase,
|
|
1186
1664
|
ButtonComponent,
|
|
1187
1665
|
CheckboxComponent,
|
|
1188
|
-
|
|
1666
|
+
DatePickerComponent,
|
|
1667
|
+
DateTimePickerComponent,
|
|
1189
1668
|
EmailInputComponent,
|
|
1190
1669
|
LoadingIndicatorComponent,
|
|
1191
1670
|
NumberInputComponent,
|
|
1192
1671
|
PasswordFieldComponent,
|
|
1193
1672
|
SelectComponent,
|
|
1673
|
+
SelectFooterComponent,
|
|
1194
1674
|
SortableItemsComponent,
|
|
1195
1675
|
TextInputComponent,
|
|
1196
1676
|
ToggleComponent,
|
|
@@ -1199,17 +1679,21 @@
|
|
|
1199
1679
|
FormErrorComponent,
|
|
1200
1680
|
FormSubmitButtonComponent,
|
|
1201
1681
|
FormComponent,
|
|
1682
|
+
SubFormDirective,
|
|
1202
1683
|
],
|
|
1203
1684
|
exports: [
|
|
1204
1685
|
ValueAccessorBase,
|
|
1686
|
+
MultipleValueAccessorBase,
|
|
1205
1687
|
ButtonComponent,
|
|
1206
|
-
|
|
1688
|
+
DatePickerComponent,
|
|
1689
|
+
DateTimePickerComponent,
|
|
1207
1690
|
CheckboxComponent,
|
|
1208
1691
|
EmailInputComponent,
|
|
1209
1692
|
LoadingIndicatorComponent,
|
|
1210
1693
|
NumberInputComponent,
|
|
1211
1694
|
PasswordFieldComponent,
|
|
1212
1695
|
SelectComponent,
|
|
1696
|
+
SelectFooterComponent,
|
|
1213
1697
|
SortableItemsComponent,
|
|
1214
1698
|
TextInputComponent,
|
|
1215
1699
|
ToggleComponent,
|
|
@@ -1218,6 +1702,7 @@
|
|
|
1218
1702
|
FormErrorComponent,
|
|
1219
1703
|
FormSubmitButtonComponent,
|
|
1220
1704
|
FormComponent,
|
|
1705
|
+
SubFormDirective,
|
|
1221
1706
|
]
|
|
1222
1707
|
},] }
|
|
1223
1708
|
];
|
|
@@ -1232,8 +1717,11 @@
|
|
|
1232
1717
|
|
|
1233
1718
|
exports.ButtonComponent = ButtonComponent;
|
|
1234
1719
|
exports.CheckboxComponent = CheckboxComponent;
|
|
1720
|
+
exports.DATE_PICKER_TRANSLATIONS = DATE_PICKER_TRANSLATIONS;
|
|
1721
|
+
exports.DATE_TIME_PICKER_TRANSLATIONS = DATE_TIME_PICKER_TRANSLATIONS;
|
|
1235
1722
|
exports.DEFAULT_ERROR_MESSAGES = DEFAULT_ERROR_MESSAGES;
|
|
1236
|
-
exports.
|
|
1723
|
+
exports.DatePickerComponent = DatePickerComponent;
|
|
1724
|
+
exports.DateTimePickerComponent = DateTimePickerComponent;
|
|
1237
1725
|
exports.EmailInputComponent = EmailInputComponent;
|
|
1238
1726
|
exports.FORM_ERROR_MESSAGES = FORM_ERROR_MESSAGES;
|
|
1239
1727
|
exports.FormCaptionComponent = FormCaptionComponent;
|
|
@@ -1243,12 +1731,15 @@
|
|
|
1243
1731
|
exports.FormSubmitButtonComponent = FormSubmitButtonComponent;
|
|
1244
1732
|
exports.KLP_DATE_FORMATS = KLP_DATE_FORMATS;
|
|
1245
1733
|
exports.LoadingIndicatorComponent = LoadingIndicatorComponent;
|
|
1734
|
+
exports.MultipleValueAccessorBase = MultipleValueAccessorBase;
|
|
1246
1735
|
exports.NgxEnhancyFormsModule = NgxEnhancyFormsModule;
|
|
1247
1736
|
exports.NumberInputComponent = NumberInputComponent;
|
|
1248
1737
|
exports.PasswordFieldComponent = PasswordFieldComponent;
|
|
1738
|
+
exports.SELECT_TRANSLATIONS = SELECT_TRANSLATIONS;
|
|
1249
1739
|
exports.SelectComponent = SelectComponent;
|
|
1740
|
+
exports.SelectFooterComponent = SelectFooterComponent;
|
|
1250
1741
|
exports.SortableItemsComponent = SortableItemsComponent;
|
|
1251
|
-
exports.
|
|
1742
|
+
exports.SubFormDirective = SubFormDirective;
|
|
1252
1743
|
exports.TextInputComponent = TextInputComponent;
|
|
1253
1744
|
exports.ToggleComponent = ToggleComponent;
|
|
1254
1745
|
exports.ValueAccessorBase = ValueAccessorBase;
|