mis-crystal-design-system 4.0.31 → 4.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/action-list/mis-crystal-design-system-action-list.metadata.json +1 -1
  2. package/async-search-dropdown/async-dropdown.component.d.ts +1 -0
  3. package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.metadata.json +1 -1
  4. package/bundles/mis-crystal-design-system-action-list.umd.js +641 -495
  5. package/bundles/mis-crystal-design-system-action-list.umd.js.map +1 -1
  6. package/bundles/mis-crystal-design-system-action-list.umd.min.js +1 -15
  7. package/bundles/mis-crystal-design-system-action-list.umd.min.js.map +1 -1
  8. package/bundles/mis-crystal-design-system-analytics.umd.js +555 -409
  9. package/bundles/mis-crystal-design-system-analytics.umd.js.map +1 -1
  10. package/bundles/mis-crystal-design-system-analytics.umd.min.js +1 -15
  11. package/bundles/mis-crystal-design-system-analytics.umd.min.js.map +1 -1
  12. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js +3 -1
  13. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js.map +1 -1
  14. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js +1 -1
  15. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js.map +1 -1
  16. package/bundles/mis-crystal-design-system-checkbox.umd.js +1 -1
  17. package/bundles/mis-crystal-design-system-checkbox.umd.min.js +1 -1
  18. package/bundles/mis-crystal-design-system-checkbox.umd.min.js.map +1 -1
  19. package/bundles/mis-crystal-design-system-datepicker_v2.umd.js +836 -690
  20. package/bundles/mis-crystal-design-system-datepicker_v2.umd.js.map +1 -1
  21. package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js +1 -15
  22. package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js.map +1 -1
  23. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js +889 -743
  24. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js.map +1 -1
  25. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js +1 -15
  26. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js.map +1 -1
  27. package/bundles/mis-crystal-design-system-dropdown.umd.js +648 -502
  28. package/bundles/mis-crystal-design-system-dropdown.umd.js.map +1 -1
  29. package/bundles/mis-crystal-design-system-dropdown.umd.min.js +1 -15
  30. package/bundles/mis-crystal-design-system-dropdown.umd.min.js.map +1 -1
  31. package/bundles/mis-crystal-design-system-dynamic-form.umd.js +869 -723
  32. package/bundles/mis-crystal-design-system-dynamic-form.umd.js.map +1 -1
  33. package/bundles/mis-crystal-design-system-dynamic-form.umd.min.js +1 -15
  34. package/bundles/mis-crystal-design-system-dynamic-form.umd.min.js.map +1 -1
  35. package/bundles/mis-crystal-design-system-input.umd.js +1 -1
  36. package/bundles/mis-crystal-design-system-input.umd.min.js +1 -1
  37. package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -1
  38. package/bundles/mis-crystal-design-system-loader.umd.js +1 -1
  39. package/bundles/mis-crystal-design-system-loader.umd.min.js +1 -1
  40. package/bundles/mis-crystal-design-system-loader.umd.min.js.map +1 -1
  41. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.js +756 -610
  42. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.js.map +1 -1
  43. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.min.js +1 -15
  44. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.min.js.map +1 -1
  45. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.js +769 -623
  46. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.js.map +1 -1
  47. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.min.js +1 -15
  48. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.min.js.map +1 -1
  49. package/bundles/mis-crystal-design-system-ske-loader.umd.js +1 -1
  50. package/bundles/mis-crystal-design-system-ske-loader.umd.min.js +1 -1
  51. package/bundles/mis-crystal-design-system-ske-loader.umd.min.js.map +1 -1
  52. package/bundles/mis-crystal-design-system-specificdatepicker.umd.js +1107 -961
  53. package/bundles/mis-crystal-design-system-specificdatepicker.umd.js.map +1 -1
  54. package/bundles/mis-crystal-design-system-specificdatepicker.umd.min.js +1 -15
  55. package/bundles/mis-crystal-design-system-specificdatepicker.umd.min.js.map +1 -1
  56. package/bundles/mis-crystal-design-system-table.umd.js +914 -768
  57. package/bundles/mis-crystal-design-system-table.umd.js.map +1 -1
  58. package/bundles/mis-crystal-design-system-table.umd.min.js +1 -15
  59. package/bundles/mis-crystal-design-system-table.umd.min.js.map +1 -1
  60. package/bundles/mis-crystal-design-system-timepicker.umd.js +813 -667
  61. package/bundles/mis-crystal-design-system-timepicker.umd.js.map +1 -1
  62. package/bundles/mis-crystal-design-system-timepicker.umd.min.js +1 -15
  63. package/bundles/mis-crystal-design-system-timepicker.umd.min.js.map +1 -1
  64. package/bundles/mis-crystal-design-system-virtual-scroll.umd.js +603 -457
  65. package/bundles/mis-crystal-design-system-virtual-scroll.umd.js.map +1 -1
  66. package/bundles/mis-crystal-design-system-virtual-scroll.umd.min.js +1 -15
  67. package/bundles/mis-crystal-design-system-virtual-scroll.umd.min.js.map +1 -1
  68. package/bundles/mis-crystal-design-system-widgets.umd.js +608 -462
  69. package/bundles/mis-crystal-design-system-widgets.umd.js.map +1 -1
  70. package/bundles/mis-crystal-design-system-widgets.umd.min.js +1 -15
  71. package/bundles/mis-crystal-design-system-widgets.umd.min.js.map +1 -1
  72. package/checkbox/mis-crystal-design-system-checkbox.metadata.json +1 -1
  73. package/datepicker_v2/mis-crystal-design-system-datepicker_v2.metadata.json +1 -1
  74. package/daterangepicker_v2/mis-crystal-design-system-daterangepicker_v2.metadata.json +1 -1
  75. package/dropdown/mis-crystal-design-system-dropdown.metadata.json +1 -1
  76. package/dynamic-form/mis-crystal-design-system-dynamic-form.metadata.json +1 -1
  77. package/esm2015/action-list/action-list.component.js +1 -1
  78. package/esm2015/async-search-dropdown/async-dropdown.component.js +4 -2
  79. package/esm2015/checkbox/checkbox.component.js +1 -1
  80. package/esm2015/datepicker_v2/tz-dp-container/tz-dp-container.component.js +1 -1
  81. package/esm2015/daterangepicker_v2/tz-drp-container/tz-drp-container.component.js +1 -1
  82. package/esm2015/dropdown/dropdown.component.js +1 -1
  83. package/esm2015/dynamic-form/dynamic-form.component.js +1 -1
  84. package/esm2015/input/mis-input.component.js +1 -1
  85. package/esm2015/loader/loader.component.js +1 -1
  86. package/esm2015/multi-select-dropdown/multi-select-dropdown.component.js +1 -1
  87. package/esm2015/nested-multi-select-dropdown/nested-multi-select-dropdown.component.js +1 -1
  88. package/esm2015/ske-loader/ske-loader.component.js +1 -1
  89. package/esm2015/specificdatepicker/tz-sdp-container/tz-sdp-container.component.js +1 -1
  90. package/esm2015/table/table.component.js +1 -1
  91. package/fesm2015/mis-crystal-design-system-action-list.js +1 -1
  92. package/fesm2015/mis-crystal-design-system-async-search-dropdown.js +3 -1
  93. package/fesm2015/mis-crystal-design-system-async-search-dropdown.js.map +1 -1
  94. package/fesm2015/mis-crystal-design-system-checkbox.js +1 -1
  95. package/fesm2015/mis-crystal-design-system-datepicker_v2.js +1 -1
  96. package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js +1 -1
  97. package/fesm2015/mis-crystal-design-system-dropdown.js +1 -1
  98. package/fesm2015/mis-crystal-design-system-dynamic-form.js +1 -1
  99. package/fesm2015/mis-crystal-design-system-input.js +1 -1
  100. package/fesm2015/mis-crystal-design-system-loader.js +1 -1
  101. package/fesm2015/mis-crystal-design-system-multi-select-dropdown.js +1 -1
  102. package/fesm2015/mis-crystal-design-system-nested-multi-select-dropdown.js +1 -1
  103. package/fesm2015/mis-crystal-design-system-ske-loader.js +1 -1
  104. package/fesm2015/mis-crystal-design-system-specificdatepicker.js +1 -1
  105. package/fesm2015/mis-crystal-design-system-table.js +1 -1
  106. package/input/mis-crystal-design-system-input.metadata.json +1 -1
  107. package/loader/mis-crystal-design-system-loader.metadata.json +1 -1
  108. package/multi-select-dropdown/mis-crystal-design-system-multi-select-dropdown.metadata.json +1 -1
  109. package/nested-multi-select-dropdown/mis-crystal-design-system-nested-multi-select-dropdown.metadata.json +1 -1
  110. package/package.json +1 -1
  111. package/ske-loader/mis-crystal-design-system-ske-loader.metadata.json +1 -1
  112. package/specificdatepicker/mis-crystal-design-system-specificdatepicker.metadata.json +1 -1
  113. package/table/mis-crystal-design-system-table.metadata.json +1 -1
@@ -1,740 +1,886 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/forms'), require('@angular/core'), require('@angular/cdk/overlay'), require('@angular/cdk-experimental/scrolling'), require('mis-crystal-design-system/dropdown'), require('moment'), require('moment-timezone'), require('mis-crystal-design-system/switch'), require('mis-crystal-design-system/multi-select-dropdown'), require('mis-crystal-design-system/datepicker_v2')) :
3
- typeof define === 'function' && define.amd ? define('mis-crystal-design-system/dynamic-form', ['exports', '@angular/common', '@angular/forms', '@angular/core', '@angular/cdk/overlay', '@angular/cdk-experimental/scrolling', 'mis-crystal-design-system/dropdown', 'moment', 'moment-timezone', 'mis-crystal-design-system/switch', 'mis-crystal-design-system/multi-select-dropdown', 'mis-crystal-design-system/datepicker_v2'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['dynamic-form'] = {}), global.ng.common, global.ng.forms, global.ng.core, global.ng.cdk.overlay, global.ng.cdkExperimental.scrolling, global['mis-crystal-design-system'].dropdown, global.moment, null, global['mis-crystal-design-system'].switch, global['mis-crystal-design-system']['multi-select-dropdown'], global['mis-crystal-design-system'].datepicker_v2));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/forms'), require('@angular/core'), require('@angular/cdk/overlay'), require('@angular/cdk-experimental/scrolling'), require('mis-crystal-design-system/dropdown'), require('moment'), require('moment-timezone'), require('mis-crystal-design-system/switch'), require('mis-crystal-design-system/multi-select-dropdown'), require('mis-crystal-design-system/datepicker_v2')) :
3
+ typeof define === 'function' && define.amd ? define('mis-crystal-design-system/dynamic-form', ['exports', '@angular/common', '@angular/forms', '@angular/core', '@angular/cdk/overlay', '@angular/cdk-experimental/scrolling', 'mis-crystal-design-system/dropdown', 'moment', 'moment-timezone', 'mis-crystal-design-system/switch', 'mis-crystal-design-system/multi-select-dropdown', 'mis-crystal-design-system/datepicker_v2'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['dynamic-form'] = {}), global.ng.common, global.ng.forms, global.ng.core, global.ng.cdk.overlay, global.ng.cdkExperimental.scrolling, global['mis-crystal-design-system'].dropdown, global.moment, null, global['mis-crystal-design-system'].switch, global['mis-crystal-design-system']['multi-select-dropdown'], global['mis-crystal-design-system'].datepicker_v2));
5
5
  }(this, (function (exports, common, forms, core, overlay, scrolling, dropdown, moment, momentTimezone, _switch, multiSelectDropdown, datepicker_v2) { 'use strict';
6
6
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () {
17
+ return e[k];
18
+ }
19
+ });
22
20
  }
23
- n['default'] = e;
24
- return Object.freeze(n);
21
+ });
25
22
  }
23
+ n['default'] = e;
24
+ return Object.freeze(n);
25
+ }
26
26
 
27
- var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
27
+ var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
28
28
 
29
- /*! *****************************************************************************
30
- Copyright (c) Microsoft Corporation.
29
+ /******************************************************************************
30
+ Copyright (c) Microsoft Corporation.
31
31
 
32
- Permission to use, copy, modify, and/or distribute this software for any
33
- purpose with or without fee is hereby granted.
32
+ Permission to use, copy, modify, and/or distribute this software for any
33
+ purpose with or without fee is hereby granted.
34
34
 
35
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
- PERFORMANCE OF THIS SOFTWARE.
42
- ***************************************************************************** */
43
- /* global Reflect, Promise */
44
- var extendStatics = function (d, b) {
45
- extendStatics = Object.setPrototypeOf ||
46
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47
- function (d, b) { for (var p in b)
48
- if (Object.prototype.hasOwnProperty.call(b, p))
49
- d[p] = b[p]; };
50
- return extendStatics(d, b);
51
- };
52
- function __extends(d, b) {
53
- if (typeof b !== "function" && b !== null)
54
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
55
- extendStatics(d, b);
56
- function __() { this.constructor = d; }
57
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58
- }
59
- var __assign = function () {
60
- __assign = Object.assign || function __assign(t) {
61
- for (var s, i = 1, n = arguments.length; i < n; i++) {
62
- s = arguments[i];
63
- for (var p in s)
64
- if (Object.prototype.hasOwnProperty.call(s, p))
65
- t[p] = s[p];
66
- }
67
- return t;
68
- };
69
- return __assign.apply(this, arguments);
70
- };
71
- function __rest(s, e) {
72
- var t = {};
73
- for (var p in s)
74
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
- t[p] = s[p];
76
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
77
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79
- t[p[i]] = s[p[i]];
80
- }
81
- return t;
82
- }
83
- function __decorate(decorators, target, key, desc) {
84
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
85
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
86
- r = Reflect.decorate(decorators, target, key, desc);
87
- else
88
- for (var i = decorators.length - 1; i >= 0; i--)
89
- if (d = decorators[i])
90
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
- function __param(paramIndex, decorator) {
94
- return function (target, key) { decorator(target, key, paramIndex); };
95
- }
96
- function __metadata(metadataKey, metadataValue) {
97
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
98
- return Reflect.metadata(metadataKey, metadataValue);
99
- }
100
- function __awaiter(thisArg, _arguments, P, generator) {
101
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
102
- return new (P || (P = Promise))(function (resolve, reject) {
103
- function fulfilled(value) { try {
104
- step(generator.next(value));
105
- }
106
- catch (e) {
107
- reject(e);
108
- } }
109
- function rejected(value) { try {
110
- step(generator["throw"](value));
111
- }
112
- catch (e) {
113
- reject(e);
114
- } }
115
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
116
- step((generator = generator.apply(thisArg, _arguments || [])).next());
117
- });
118
- }
119
- function __generator(thisArg, body) {
120
- var _ = { label: 0, sent: function () { if (t[0] & 1)
121
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
122
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
123
- function verb(n) { return function (v) { return step([n, v]); }; }
124
- function step(op) {
125
- if (f)
126
- throw new TypeError("Generator is already executing.");
127
- while (_)
128
- try {
129
- 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)
130
- return t;
131
- if (y = 0, t)
132
- op = [op[0] & 2, t.value];
133
- switch (op[0]) {
134
- case 0:
135
- case 1:
136
- t = op;
137
- break;
138
- case 4:
139
- _.label++;
140
- return { value: op[1], done: false };
141
- case 5:
142
- _.label++;
143
- y = op[1];
144
- op = [0];
145
- continue;
146
- case 7:
147
- op = _.ops.pop();
148
- _.trys.pop();
149
- continue;
150
- default:
151
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
152
- _ = 0;
153
- continue;
154
- }
155
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
156
- _.label = op[1];
157
- break;
158
- }
159
- if (op[0] === 6 && _.label < t[1]) {
160
- _.label = t[1];
161
- t = op;
162
- break;
163
- }
164
- if (t && _.label < t[2]) {
165
- _.label = t[2];
166
- _.ops.push(op);
167
- break;
168
- }
169
- if (t[2])
170
- _.ops.pop();
171
- _.trys.pop();
172
- continue;
173
- }
174
- op = body.call(thisArg, _);
175
- }
176
- catch (e) {
177
- op = [6, e];
178
- y = 0;
179
- }
180
- finally {
181
- f = t = 0;
182
- }
183
- if (op[0] & 5)
184
- throw op[1];
185
- return { value: op[0] ? op[1] : void 0, done: true };
186
- }
187
- }
188
- var __createBinding = Object.create ? (function (o, m, k, k2) {
189
- if (k2 === undefined)
190
- k2 = k;
191
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
192
- }) : (function (o, m, k, k2) {
193
- if (k2 === undefined)
194
- k2 = k;
195
- o[k2] = m[k];
196
- });
197
- function __exportStar(m, o) {
198
- for (var p in m)
199
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
200
- __createBinding(o, m, p);
201
- }
202
- function __values(o) {
203
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
204
- if (m)
205
- return m.call(o);
206
- if (o && typeof o.length === "number")
207
- return {
208
- next: function () {
209
- if (o && i >= o.length)
210
- o = void 0;
211
- return { value: o && o[i++], done: !o };
212
- }
213
- };
214
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
215
- }
216
- function __read(o, n) {
217
- var m = typeof Symbol === "function" && o[Symbol.iterator];
218
- if (!m)
219
- return o;
220
- var i = m.call(o), r, ar = [], e;
221
- try {
222
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
223
- ar.push(r.value);
224
- }
225
- catch (error) {
226
- e = { error: error };
227
- }
228
- finally {
229
- try {
230
- if (r && !r.done && (m = i["return"]))
231
- m.call(i);
232
- }
233
- finally {
234
- if (e)
235
- throw e.error;
236
- }
237
- }
238
- return ar;
239
- }
240
- /** @deprecated */
241
- function __spread() {
242
- for (var ar = [], i = 0; i < arguments.length; i++)
243
- ar = ar.concat(__read(arguments[i]));
244
- return ar;
245
- }
246
- /** @deprecated */
247
- function __spreadArrays() {
248
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
249
- s += arguments[i].length;
250
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
251
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
252
- r[k] = a[j];
253
- return r;
254
- }
255
- function __spreadArray(to, from, pack) {
256
- if (pack || arguments.length === 2)
257
- for (var i = 0, l = from.length, ar; i < l; i++) {
258
- if (ar || !(i in from)) {
259
- if (!ar)
260
- ar = Array.prototype.slice.call(from, 0, i);
261
- ar[i] = from[i];
262
- }
263
- }
264
- return to.concat(ar || Array.prototype.slice.call(from));
265
- }
266
- function __await(v) {
267
- return this instanceof __await ? (this.v = v, this) : new __await(v);
268
- }
269
- function __asyncGenerator(thisArg, _arguments, generator) {
270
- if (!Symbol.asyncIterator)
271
- throw new TypeError("Symbol.asyncIterator is not defined.");
272
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
273
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
274
- function verb(n) { if (g[n])
275
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
276
- function resume(n, v) { try {
277
- step(g[n](v));
278
- }
279
- catch (e) {
280
- settle(q[0][3], e);
281
- } }
282
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
283
- function fulfill(value) { resume("next", value); }
284
- function reject(value) { resume("throw", value); }
285
- function settle(f, v) { if (f(v), q.shift(), q.length)
286
- resume(q[0][0], q[0][1]); }
287
- }
288
- function __asyncDelegator(o) {
289
- var i, p;
290
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
291
- 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; }
292
- }
293
- function __asyncValues(o) {
294
- if (!Symbol.asyncIterator)
295
- throw new TypeError("Symbol.asyncIterator is not defined.");
296
- var m = o[Symbol.asyncIterator], i;
297
- 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);
298
- 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); }); }; }
299
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
300
- }
301
- function __makeTemplateObject(cooked, raw) {
302
- if (Object.defineProperty) {
303
- Object.defineProperty(cooked, "raw", { value: raw });
304
- }
305
- else {
306
- cooked.raw = raw;
307
- }
308
- return cooked;
309
- }
310
- ;
311
- var __setModuleDefault = Object.create ? (function (o, v) {
312
- Object.defineProperty(o, "default", { enumerable: true, value: v });
313
- }) : function (o, v) {
314
- o["default"] = v;
315
- };
316
- function __importStar(mod) {
317
- if (mod && mod.__esModule)
318
- return mod;
319
- var result = {};
320
- if (mod != null)
321
- for (var k in mod)
322
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
323
- __createBinding(result, mod, k);
324
- __setModuleDefault(result, mod);
325
- return result;
326
- }
327
- function __importDefault(mod) {
328
- return (mod && mod.__esModule) ? mod : { default: mod };
329
- }
330
- function __classPrivateFieldGet(receiver, state, kind, f) {
331
- if (kind === "a" && !f)
332
- throw new TypeError("Private accessor was defined without a getter");
333
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
334
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
335
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
336
- }
337
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
338
- if (kind === "m")
339
- throw new TypeError("Private method is not writable");
340
- if (kind === "a" && !f)
341
- throw new TypeError("Private accessor was defined without a setter");
342
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
343
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
344
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
345
- }
35
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
+ PERFORMANCE OF THIS SOFTWARE.
42
+ ***************************************************************************** */
43
+ /* global Reflect, Promise, SuppressedError, Symbol */
44
+ var extendStatics = function (d, b) {
45
+ extendStatics = Object.setPrototypeOf ||
46
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47
+ function (d, b) { for (var p in b)
48
+ if (Object.prototype.hasOwnProperty.call(b, p))
49
+ d[p] = b[p]; };
50
+ return extendStatics(d, b);
51
+ };
52
+ function __extends(d, b) {
53
+ if (typeof b !== "function" && b !== null)
54
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
55
+ extendStatics(d, b);
56
+ function __() { this.constructor = d; }
57
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58
+ }
59
+ var __assign = function () {
60
+ __assign = Object.assign || function __assign(t) {
61
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
62
+ s = arguments[i];
63
+ for (var p in s)
64
+ if (Object.prototype.hasOwnProperty.call(s, p))
65
+ t[p] = s[p];
66
+ }
67
+ return t;
68
+ };
69
+ return __assign.apply(this, arguments);
70
+ };
71
+ function __rest(s, e) {
72
+ var t = {};
73
+ for (var p in s)
74
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
+ t[p] = s[p];
76
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
77
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79
+ t[p[i]] = s[p[i]];
80
+ }
81
+ return t;
82
+ }
83
+ function __decorate(decorators, target, key, desc) {
84
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
85
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
86
+ r = Reflect.decorate(decorators, target, key, desc);
87
+ else
88
+ for (var i = decorators.length - 1; i >= 0; i--)
89
+ if (d = decorators[i])
90
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
92
+ }
93
+ function __param(paramIndex, decorator) {
94
+ return function (target, key) { decorator(target, key, paramIndex); };
95
+ }
96
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
97
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
98
+ throw new TypeError("Function expected"); return f; }
99
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
100
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
101
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
102
+ var _, done = false;
103
+ for (var i = decorators.length - 1; i >= 0; i--) {
104
+ var context = {};
105
+ for (var p in contextIn)
106
+ context[p] = p === "access" ? {} : contextIn[p];
107
+ for (var p in contextIn.access)
108
+ context.access[p] = contextIn.access[p];
109
+ context.addInitializer = function (f) { if (done)
110
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
111
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
112
+ if (kind === "accessor") {
113
+ if (result === void 0)
114
+ continue;
115
+ if (result === null || typeof result !== "object")
116
+ throw new TypeError("Object expected");
117
+ if (_ = accept(result.get))
118
+ descriptor.get = _;
119
+ if (_ = accept(result.set))
120
+ descriptor.set = _;
121
+ if (_ = accept(result.init))
122
+ initializers.unshift(_);
123
+ }
124
+ else if (_ = accept(result)) {
125
+ if (kind === "field")
126
+ initializers.unshift(_);
127
+ else
128
+ descriptor[key] = _;
129
+ }
130
+ }
131
+ if (target)
132
+ Object.defineProperty(target, contextIn.name, descriptor);
133
+ done = true;
134
+ }
135
+ ;
136
+ function __runInitializers(thisArg, initializers, value) {
137
+ var useValue = arguments.length > 2;
138
+ for (var i = 0; i < initializers.length; i++) {
139
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
140
+ }
141
+ return useValue ? value : void 0;
142
+ }
143
+ ;
144
+ function __propKey(x) {
145
+ return typeof x === "symbol" ? x : "".concat(x);
146
+ }
147
+ ;
148
+ function __setFunctionName(f, name, prefix) {
149
+ if (typeof name === "symbol")
150
+ name = name.description ? "[".concat(name.description, "]") : "";
151
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
152
+ }
153
+ ;
154
+ function __metadata(metadataKey, metadataValue) {
155
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
156
+ return Reflect.metadata(metadataKey, metadataValue);
157
+ }
158
+ function __awaiter(thisArg, _arguments, P, generator) {
159
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
160
+ return new (P || (P = Promise))(function (resolve, reject) {
161
+ function fulfilled(value) { try {
162
+ step(generator.next(value));
163
+ }
164
+ catch (e) {
165
+ reject(e);
166
+ } }
167
+ function rejected(value) { try {
168
+ step(generator["throw"](value));
169
+ }
170
+ catch (e) {
171
+ reject(e);
172
+ } }
173
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
174
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
175
+ });
176
+ }
177
+ function __generator(thisArg, body) {
178
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
179
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
180
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
181
+ function verb(n) { return function (v) { return step([n, v]); }; }
182
+ function step(op) {
183
+ if (f)
184
+ throw new TypeError("Generator is already executing.");
185
+ while (g && (g = 0, op[0] && (_ = 0)), _)
186
+ try {
187
+ 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)
188
+ return t;
189
+ if (y = 0, t)
190
+ op = [op[0] & 2, t.value];
191
+ switch (op[0]) {
192
+ case 0:
193
+ case 1:
194
+ t = op;
195
+ break;
196
+ case 4:
197
+ _.label++;
198
+ return { value: op[1], done: false };
199
+ case 5:
200
+ _.label++;
201
+ y = op[1];
202
+ op = [0];
203
+ continue;
204
+ case 7:
205
+ op = _.ops.pop();
206
+ _.trys.pop();
207
+ continue;
208
+ default:
209
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
210
+ _ = 0;
211
+ continue;
212
+ }
213
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
214
+ _.label = op[1];
215
+ break;
216
+ }
217
+ if (op[0] === 6 && _.label < t[1]) {
218
+ _.label = t[1];
219
+ t = op;
220
+ break;
221
+ }
222
+ if (t && _.label < t[2]) {
223
+ _.label = t[2];
224
+ _.ops.push(op);
225
+ break;
226
+ }
227
+ if (t[2])
228
+ _.ops.pop();
229
+ _.trys.pop();
230
+ continue;
231
+ }
232
+ op = body.call(thisArg, _);
233
+ }
234
+ catch (e) {
235
+ op = [6, e];
236
+ y = 0;
237
+ }
238
+ finally {
239
+ f = t = 0;
240
+ }
241
+ if (op[0] & 5)
242
+ throw op[1];
243
+ return { value: op[0] ? op[1] : void 0, done: true };
244
+ }
245
+ }
246
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
247
+ if (k2 === undefined)
248
+ k2 = k;
249
+ var desc = Object.getOwnPropertyDescriptor(m, k);
250
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
251
+ desc = { enumerable: true, get: function () { return m[k]; } };
252
+ }
253
+ Object.defineProperty(o, k2, desc);
254
+ }) : (function (o, m, k, k2) {
255
+ if (k2 === undefined)
256
+ k2 = k;
257
+ o[k2] = m[k];
258
+ });
259
+ function __exportStar(m, o) {
260
+ for (var p in m)
261
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
262
+ __createBinding(o, m, p);
263
+ }
264
+ function __values(o) {
265
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
266
+ if (m)
267
+ return m.call(o);
268
+ if (o && typeof o.length === "number")
269
+ return {
270
+ next: function () {
271
+ if (o && i >= o.length)
272
+ o = void 0;
273
+ return { value: o && o[i++], done: !o };
274
+ }
275
+ };
276
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
277
+ }
278
+ function __read(o, n) {
279
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
280
+ if (!m)
281
+ return o;
282
+ var i = m.call(o), r, ar = [], e;
283
+ try {
284
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
285
+ ar.push(r.value);
286
+ }
287
+ catch (error) {
288
+ e = { error: error };
289
+ }
290
+ finally {
291
+ try {
292
+ if (r && !r.done && (m = i["return"]))
293
+ m.call(i);
294
+ }
295
+ finally {
296
+ if (e)
297
+ throw e.error;
298
+ }
299
+ }
300
+ return ar;
301
+ }
302
+ /** @deprecated */
303
+ function __spread() {
304
+ for (var ar = [], i = 0; i < arguments.length; i++)
305
+ ar = ar.concat(__read(arguments[i]));
306
+ return ar;
307
+ }
308
+ /** @deprecated */
309
+ function __spreadArrays() {
310
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
311
+ s += arguments[i].length;
312
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
313
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
314
+ r[k] = a[j];
315
+ return r;
316
+ }
317
+ function __spreadArray(to, from, pack) {
318
+ if (pack || arguments.length === 2)
319
+ for (var i = 0, l = from.length, ar; i < l; i++) {
320
+ if (ar || !(i in from)) {
321
+ if (!ar)
322
+ ar = Array.prototype.slice.call(from, 0, i);
323
+ ar[i] = from[i];
324
+ }
325
+ }
326
+ return to.concat(ar || Array.prototype.slice.call(from));
327
+ }
328
+ function __await(v) {
329
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
330
+ }
331
+ function __asyncGenerator(thisArg, _arguments, generator) {
332
+ if (!Symbol.asyncIterator)
333
+ throw new TypeError("Symbol.asyncIterator is not defined.");
334
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
335
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
336
+ function verb(n) { if (g[n])
337
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
338
+ function resume(n, v) { try {
339
+ step(g[n](v));
340
+ }
341
+ catch (e) {
342
+ settle(q[0][3], e);
343
+ } }
344
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
345
+ function fulfill(value) { resume("next", value); }
346
+ function reject(value) { resume("throw", value); }
347
+ function settle(f, v) { if (f(v), q.shift(), q.length)
348
+ resume(q[0][0], q[0][1]); }
349
+ }
350
+ function __asyncDelegator(o) {
351
+ var i, p;
352
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
353
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
354
+ }
355
+ function __asyncValues(o) {
356
+ if (!Symbol.asyncIterator)
357
+ throw new TypeError("Symbol.asyncIterator is not defined.");
358
+ var m = o[Symbol.asyncIterator], i;
359
+ 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);
360
+ 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); }); }; }
361
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
362
+ }
363
+ function __makeTemplateObject(cooked, raw) {
364
+ if (Object.defineProperty) {
365
+ Object.defineProperty(cooked, "raw", { value: raw });
366
+ }
367
+ else {
368
+ cooked.raw = raw;
369
+ }
370
+ return cooked;
371
+ }
372
+ ;
373
+ var __setModuleDefault = Object.create ? (function (o, v) {
374
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
375
+ }) : function (o, v) {
376
+ o["default"] = v;
377
+ };
378
+ function __importStar(mod) {
379
+ if (mod && mod.__esModule)
380
+ return mod;
381
+ var result = {};
382
+ if (mod != null)
383
+ for (var k in mod)
384
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
385
+ __createBinding(result, mod, k);
386
+ __setModuleDefault(result, mod);
387
+ return result;
388
+ }
389
+ function __importDefault(mod) {
390
+ return (mod && mod.__esModule) ? mod : { default: mod };
391
+ }
392
+ function __classPrivateFieldGet(receiver, state, kind, f) {
393
+ if (kind === "a" && !f)
394
+ throw new TypeError("Private accessor was defined without a getter");
395
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
396
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
397
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
398
+ }
399
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
400
+ if (kind === "m")
401
+ throw new TypeError("Private method is not writable");
402
+ if (kind === "a" && !f)
403
+ throw new TypeError("Private accessor was defined without a setter");
404
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
405
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
406
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
407
+ }
408
+ function __classPrivateFieldIn(state, receiver) {
409
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
410
+ throw new TypeError("Cannot use 'in' operator on non-object");
411
+ return typeof state === "function" ? receiver === state : state.has(receiver);
412
+ }
413
+ function __addDisposableResource(env, value, async) {
414
+ if (value !== null && value !== void 0) {
415
+ if (typeof value !== "object" && typeof value !== "function")
416
+ throw new TypeError("Object expected.");
417
+ var dispose;
418
+ if (async) {
419
+ if (!Symbol.asyncDispose)
420
+ throw new TypeError("Symbol.asyncDispose is not defined.");
421
+ dispose = value[Symbol.asyncDispose];
422
+ }
423
+ if (dispose === void 0) {
424
+ if (!Symbol.dispose)
425
+ throw new TypeError("Symbol.dispose is not defined.");
426
+ dispose = value[Symbol.dispose];
427
+ }
428
+ if (typeof dispose !== "function")
429
+ throw new TypeError("Object not disposable.");
430
+ env.stack.push({ value: value, dispose: dispose, async: async });
431
+ }
432
+ else if (async) {
433
+ env.stack.push({ async: true });
434
+ }
435
+ return value;
436
+ }
437
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
438
+ var e = new Error(message);
439
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
440
+ };
441
+ function __disposeResources(env) {
442
+ function fail(e) {
443
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
444
+ env.hasError = true;
445
+ }
446
+ function next() {
447
+ while (env.stack.length) {
448
+ var rec = env.stack.pop();
449
+ try {
450
+ var result = rec.dispose && rec.dispose.call(rec.value);
451
+ if (rec.async)
452
+ return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
453
+ }
454
+ catch (e) {
455
+ fail(e);
456
+ }
457
+ }
458
+ if (env.hasError)
459
+ throw env.error;
460
+ }
461
+ return next();
462
+ }
463
+ var tslib_es6 = {
464
+ __extends: __extends,
465
+ __assign: __assign,
466
+ __rest: __rest,
467
+ __decorate: __decorate,
468
+ __param: __param,
469
+ __metadata: __metadata,
470
+ __awaiter: __awaiter,
471
+ __generator: __generator,
472
+ __createBinding: __createBinding,
473
+ __exportStar: __exportStar,
474
+ __values: __values,
475
+ __read: __read,
476
+ __spread: __spread,
477
+ __spreadArrays: __spreadArrays,
478
+ __spreadArray: __spreadArray,
479
+ __await: __await,
480
+ __asyncGenerator: __asyncGenerator,
481
+ __asyncDelegator: __asyncDelegator,
482
+ __asyncValues: __asyncValues,
483
+ __makeTemplateObject: __makeTemplateObject,
484
+ __importStar: __importStar,
485
+ __importDefault: __importDefault,
486
+ __classPrivateFieldGet: __classPrivateFieldGet,
487
+ __classPrivateFieldSet: __classPrivateFieldSet,
488
+ __classPrivateFieldIn: __classPrivateFieldIn,
489
+ __addDisposableResource: __addDisposableResource,
490
+ __disposeResources: __disposeResources,
491
+ };
346
492
 
347
- var DynamicFormComponent = /** @class */ (function () {
348
- function DynamicFormComponent() {
349
- /**
350
- * formFields: Dynamic fields recieved from the API metadata to build a dynamic form
351
- * formValues: Holds the value of the dynamic form with "key" being dynamic field "title"
352
- * and value being the user input.
353
- */
354
- this.formFields = [];
355
- this.formValues = {};
356
- // Need to deprecate these inputs and use constants.
357
- this.activeBtnIconUrl = "";
358
- this.calendarIconUrl = "";
359
- /**
360
- * formUpdated: Emits formValues Object whenever there is a change in the dynamic form.
361
- */
362
- this.formUpdated = new core.EventEmitter();
363
- /**
364
- * formValid: Emits boolean depending on validity of the form
365
- */
366
- this.formValid = new core.EventEmitter();
367
- /**
368
- * formInitialized: Emits dynamic form API on form initilization
369
- */
370
- this.formInitialized = new core.EventEmitter();
371
- }
372
- DynamicFormComponent.prototype.ngOnInit = function () {
373
- var _this = this;
374
- // Building the form
375
- this.dynamicForm = this.generateDynamicForm(this.formFields, this.formValues);
376
- // Subscribing to form changes and emiting values.
377
- this.valueChangesSubscription$ = this.dynamicForm.valueChanges.subscribe(function (formValue) {
378
- _this.onFormValueChanges();
379
- });
380
- //api to expose functions
381
- this.dynamicFormAPI = {
382
- defaultFormValues: function () {
383
- return _this.generateDynamicFieldsValueObject(_this.dynamicForm.value.dynamicFields);
384
- }
385
- };
386
- this.formInitialized.emit(this.dynamicFormAPI);
387
- this.formValid.emit(this.dynamicForm.valid);
388
- };
389
- DynamicFormComponent.prototype.ngOnDestroy = function () {
390
- var _a;
391
- (_a = this.valueChangesSubscription$) === null || _a === void 0 ? void 0 : _a.unsubscribe();
392
- };
393
- DynamicFormComponent.prototype.onFormValueChanges = function () {
394
- var formValues = this.generateDynamicFieldsValueObject(this.dynamicForm.value.dynamicFields);
395
- this.formValid.emit(this.dynamicForm.valid);
396
- this.formUpdated.emit(formValues);
397
- console.log(formValues);
398
- };
399
- DynamicFormComponent.prototype.generateDynamicFieldsValueObject = function (formValues) {
400
- var _this = this;
401
- var dynamicFieldsValue = {};
402
- formValues.forEach(function (fieldValue, index) {
403
- var _a;
404
- var formattedValue = _this.mapFormFieldToFormValue(_this.formFields[index], fieldValue.value);
405
- if (((_a = fieldValue.subFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
406
- var formattedSubFieldsValues_1 = {};
407
- fieldValue.subFields.forEach(function (subFieldValue, subIndex) {
408
- var subFormField = _this.formFields[index].subFields[subIndex];
409
- formattedSubFieldsValues_1[subFormField.configName] = _this.mapFormFieldToFormValue(subFormField, subFieldValue);
410
- });
411
- dynamicFieldsValue[_this.formFields[index].configName] = {
412
- value: formattedValue,
413
- subFields: formattedSubFieldsValues_1
414
- };
415
- }
416
- else {
417
- dynamicFieldsValue[_this.formFields[index].configName] = formattedValue;
418
- }
419
- });
420
- return dynamicFieldsValue;
421
- };
422
- DynamicFormComponent.prototype.generateDynamicForm = function (formFields, formValues) {
423
- var e_1, _b;
424
- var _a;
425
- var formArray = new forms.FormArray([]);
426
- try {
427
- for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
428
- var field = formFields_1_1.value;
429
- var fieldValue = ((_a = formValues[field.configName]) === null || _a === void 0 ? void 0 : _a.value) ? formValues[field.configName].value : formValues[field.configName];
430
- var fieldControl = this.mapFormValueToFormField(field, fieldValue);
431
- var subFieldsControls = this.generateSubDynamicFields(formValues, field, fieldControl.value);
432
- formArray.push(new forms.FormGroup({
433
- value: fieldControl,
434
- subFields: subFieldsControls
435
- }));
436
- }
437
- }
438
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
439
- finally {
440
- try {
441
- if (formFields_1_1 && !formFields_1_1.done && (_b = formFields_1.return)) _b.call(formFields_1);
442
- }
443
- finally { if (e_1) throw e_1.error; }
444
- }
445
- return new forms.FormGroup({
446
- dynamicFields: formArray
447
- });
448
- };
449
- DynamicFormComponent.prototype.getDynamicFieldsControls = function () {
450
- return this.dynamicForm.get("dynamicFields");
451
- };
452
- DynamicFormComponent.prototype.updateSubDynamicFields = function (field, formGroup, value) {
453
- var _a;
454
- if (((_a = field.subFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
455
- var subFieldsControls = this.generateSubDynamicFields(this.formValues, field, value);
456
- formGroup.removeControl('subFields');
457
- formGroup.addControl('subFields', subFieldsControls);
458
- }
459
- };
460
- DynamicFormComponent.prototype.updateSelectedValueForSingleSelect = function (field, control, formGroup, value) {
461
- var _a;
462
- if (((_a = control.value) === null || _a === void 0 ? void 0 : _a.value) !== value.value) {
463
- control.setValue(value);
464
- }
465
- else
466
- control.setValue('');
467
- this.updateSubDynamicFields(field, formGroup, value);
468
- control.markAsTouched();
469
- };
470
- DynamicFormComponent.prototype.updateSelectedValueForMultiSelect = function (field, control, formGroup, values) {
471
- var e_2, _b;
472
- var selectedValues = control.value;
473
- var _loop_1 = function (value) {
474
- var itemIndex = selectedValues.findIndex(function (item) { return item.label === value.label; });
475
- if (itemIndex > -1) {
476
- selectedValues.splice(itemIndex, 1);
477
- }
478
- else {
479
- selectedValues.push(Object.assign({}, value));
480
- }
481
- };
482
- try {
483
- for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
484
- var value = values_1_1.value;
485
- _loop_1(value);
486
- }
487
- }
488
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
489
- finally {
490
- try {
491
- if (values_1_1 && !values_1_1.done && (_b = values_1.return)) _b.call(values_1);
492
- }
493
- finally { if (e_2) throw e_2.error; }
494
- }
495
- control.setValue(selectedValues);
496
- this.updateSubDynamicFields(field, formGroup, values);
497
- control.markAsTouched();
498
- };
499
- DynamicFormComponent.prototype.isCheckBoxSelected = function (value, selectedValues) {
500
- return selectedValues.findIndex(function (item) { return item.label === value; }) > -1;
501
- };
502
- DynamicFormComponent.prototype.findSelectedIndex = function (subfields, value) {
503
- var selectedIndex = subfields.findIndex(function (item) { return item.parentConfigValue === value; });
504
- return selectedIndex !== -1 ? selectedIndex : 0;
505
- };
506
- DynamicFormComponent.prototype.matchParentConfig = function (subfields, value) {
507
- if (!subfields || subfields.length === 0) {
508
- return false;
509
- }
510
- return subfields.some(function (item) { return item.parentConfigValue === value; });
511
- };
512
- DynamicFormComponent.prototype.generateSubDynamicFields = function (formValues, parentField, parentValue) {
513
- var e_3, _b;
514
- var _a;
515
- var controls = new forms.FormArray([]);
516
- var subFields = parentField.subFields;
517
- var subFieldsValues = ((_a = formValues[parentField.configName]) === null || _a === void 0 ? void 0 : _a.subFields) ? formValues[parentField.configName].subFields : {};
518
- if (!subFields)
519
- return controls;
520
- if (parentField.fieldType === 'singleSelect') {
521
- subFields = subFields.filter(function (subField) { var _a; return subField.parentConfigValue === ((_a = parentValue) === null || _a === void 0 ? void 0 : _a.value); });
522
- }
523
- else if (parentField.fieldType === 'multiSelect') {
524
- var parentValues_1 = new Set(parentValue.map(function (value) { return value.value; }));
525
- subFields = subFields.filter(function (subField) { return parentValues_1.has(subField.parentConfigValue); });
526
- }
527
- if ((subFields === null || subFields === void 0 ? void 0 : subFields.length) > 0) {
528
- try {
529
- for (var subFields_1 = __values(subFields), subFields_1_1 = subFields_1.next(); !subFields_1_1.done; subFields_1_1 = subFields_1.next()) {
530
- var subField = subFields_1_1.value;
531
- controls.push(this.mapFormValueToFormField(subField, subFieldsValues[subField.configName]));
532
- }
533
- }
534
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
535
- finally {
536
- try {
537
- if (subFields_1_1 && !subFields_1_1.done && (_b = subFields_1.return)) _b.call(subFields_1);
538
- }
539
- finally { if (e_3) throw e_3.error; }
540
- }
541
- }
542
- return controls;
543
- };
544
- DynamicFormComponent.prototype.mapFormValueToFormField = function (formField, formValue) {
545
- var e_4, _b;
546
- var validators = formField.validators ? [dynamicFieldValidator(formField.validators)] : [];
547
- var control = new forms.FormControl(null, validators);
548
- if (formField.fieldType === "input") {
549
- if (formField.fieldInputType === "text" || formField.fieldInputType === "textarea")
550
- control.setValue(formValue ? formValue : "");
551
- else if (formField.fieldInputType === "number")
552
- control.setValue(formValue ? formValue : 0);
553
- else if (formField.fieldInputType === "date") {
554
- if (formValue && typeof formValue === "number") {
555
- control.setValue(moment__namespace(formValue).tz(formField.fieldConfig.timezone).format(formField.fieldConfig.format));
556
- }
557
- else {
558
- control.setValue(moment__namespace().tz(formField.fieldConfig.timezone).format(formField.fieldConfig.format));
559
- }
560
- }
561
- }
562
- else if (formField.fieldType === "singleSelect") {
563
- var findSelectedValue = function () {
564
- var index = formField.itemsList.findIndex(function (item) { return item.value === formValue; });
565
- return index >= 0 ? formField.itemsList[index] : "";
566
- };
567
- if (formField.fieldInputType === "dropdown") {
568
- if (!formValue)
569
- control.setValue(formField.itemsList[0]);
570
- else
571
- control.setValue(findSelectedValue());
572
- }
573
- else if (formField.fieldInputType === "radio") {
574
- control.setValue(findSelectedValue());
575
- }
576
- }
577
- else if (formField.fieldType === "multiSelect") {
578
- if (formValue && Array.isArray(formValue)) {
579
- var selectedValues = [];
580
- var _loop_2 = function (value) {
581
- var index = formField.itemsList.findIndex(function (item) { return item.value === value; });
582
- if (index > -1)
583
- selectedValues.push(Object.assign({}, formField.itemsList[index]));
584
- };
585
- try {
586
- for (var formValue_1 = __values(formValue), formValue_1_1 = formValue_1.next(); !formValue_1_1.done; formValue_1_1 = formValue_1.next()) {
587
- var value = formValue_1_1.value;
588
- _loop_2(value);
589
- }
590
- }
591
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
592
- finally {
593
- try {
594
- if (formValue_1_1 && !formValue_1_1.done && (_b = formValue_1.return)) _b.call(formValue_1);
595
- }
596
- finally { if (e_4) throw e_4.error; }
597
- }
598
- control.setValue(selectedValues);
599
- }
600
- else {
601
- control.setValue([]);
602
- }
603
- }
604
- else if (formField.fieldType === "boolean") {
605
- control.setValue(!!formValue);
606
- }
607
- else
608
- control.setValue(null);
609
- return control;
610
- };
611
- DynamicFormComponent.prototype.mapFormFieldToFormValue = function (formField, formValue) {
612
- var _a;
613
- if (formField.fieldType === "input") {
614
- if (formField.fieldInputType === "text" || formField.fieldInputType === "textarea")
615
- return formValue;
616
- else if (formField.fieldInputType === "number")
617
- return +formValue;
618
- else if (formField.fieldInputType === "date") {
619
- return moment.tz(formValue, formField.fieldConfig.format, formField.fieldConfig.timezone).valueOf();
620
- }
621
- }
622
- else if (formField.fieldType === "singleSelect") {
623
- return (_a = formValue === null || formValue === void 0 ? void 0 : formValue.value) !== null && _a !== void 0 ? _a : '';
624
- }
625
- else if (formField.fieldType === "multiSelect") {
626
- return formValue === null || formValue === void 0 ? void 0 : formValue.map(function (item) { return item.value; });
627
- }
628
- else if (formField.fieldType === "boolean") {
629
- return formValue;
630
- }
631
- else
632
- return formValue;
633
- };
634
- return DynamicFormComponent;
635
- }());
636
- DynamicFormComponent.decorators = [
637
- { type: core.Component, args: [{
638
- selector: "mis-dynamic-form",
639
- template: "<form [formGroup]=\"dynamicForm\">\n <ng-container formArrayName=\"dynamicFields\">\n <ng-container [formGroupName]=\"i\" *ngFor=\"let fieldControl of getDynamicFieldsControls().controls; let i = index\">\n <ng-container\n [ngTemplateOutlet]=\"dynamicField\"\n [ngTemplateOutletContext]=\"{\n $implicit: formFields[i],\n formGroup: fieldControl,\n control: fieldControl.controls.value\n }\"\n >\n </ng-container>\n <div class=\"sub-dynamic-form\" *ngIf=\"fieldControl.value && (!!formFields[i]?.subFields && formFields[i]?.subFields?.length > 0 && matchParentConfig(formFields[i]?.subFields, fieldControl.controls.value.value.value))\">\n <ng-container *ngFor=\"let subFieldControl of fieldControl.controls.subFields.controls;\">\n <ng-container\n [ngTemplateOutlet]=\"dynamicField\"\n [ngTemplateOutletContext]=\"{\n $implicit: formFields[i].subFields[findSelectedIndex(formFields[i]?.subFields, fieldControl.controls.value.value.value)],\n control: subFieldControl\n }\">\n </ng-container>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n</form>\n\n\n<ng-template #dynamicField let-field let-control=\"control\" let-formgroup=\"formGroup\">\n\n <!-- fieldType: 'input' fieldInputType: 'text' | 'number' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'input' && (field.fieldInputType === 'text' || field.fieldInputType === 'number')\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <input class=\"input-field ip-text\" [type]=\"field.fieldInputType\" [formControl]=\"control\"\n (ngModelChange)=\"updateSubDynamicFields(field, formgroup, $event)\" \n [ngStyle]=\"{'border': control.touched && control.errors ? '1px solid #B00020': ''}\"\n [placeholder]=\"field.placeholderText ? field.placeholderText : 'Input Text'\" \n [min]=\"field.fieldInputType === 'number' ? 0 : '' \"/>\n <ng-container *ngIf=\"control.touched && control.errors\"\n [ngTemplateOutlet]=\"dynamicFieldErrors\" \n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\"\n >\n </ng-container>\n </div>\n\n <!-- fieldType: 'input' fieldInputType: 'textarea' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'input' && field.fieldInputType === 'textarea'\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <textarea class=\"input-field ip-textarea\" type=\"text\"\n [ngStyle]=\"{'border': control.touched && control.errors ? '1px solid #B00020': ''}\"\n [placeholder]=\"field.placeholderText ? field.placeholderText : 'Input Text'\" [formControl]=\"control\" (ngModelChange)=\"updateSubDynamicFields(field, formgroup, $event)\"></textarea>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'input' fieldInputType: 'date' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'input' && field.fieldInputType === 'date'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <div class=\"date-picker-container\">\n <input class=\"date-picker\" readonly misTzDp [dpConfig]=\"field.fieldConfig\"\n (dateChange)=\"control.setValue($event)\" [selectedDate]=\"control.value\" [offsetY]=\"0\"\n [value]=\"control.value\" #dp />\n <img alt=\"data-picker\" *ngIf=\"calendarIconUrl\" class=\"date-picker-icon\" [src]=\"calendarIconUrl\"\n (click)=\"dp.click()\" />\n </div>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'boolean' fieldInputType: 'toggle' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'boolean' && field.fieldInputType === 'toggle'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <mis-switch [control]=\"control\" (valueChanged)=\"updateSubDynamicFields(field, formgroup, $event)\"></mis-switch>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'singleSelect' fieldInputType: 'dropdown' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'singleSelect' && field.fieldInputType === 'dropdown'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <mis-dropdown [searchEnabled]=\"false\" [width]=\"'140px'\" [data]=\"field.itemsList\" [selectedItem]=\"control.value\"\n (onChange)=\"updateSelectedValueForSingleSelect(field, control, formgroup, $event);\">\n </mis-dropdown>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'singleSelect' fieldInputType: 'radio' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'singleSelect' && field.fieldInputType === 'radio'\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <div id=\"checkboxes-container\">\n <div class=\"radio-checkbox-common\" *ngFor=\"let item of field.itemsList\"\n [ngClass]=\"{ 'checkbox-active': item.label === control.value?.label }\"\n (click)=\"updateSelectedValueForSingleSelect(field, control, formgroup, item);\">\n <img *ngIf=\"(item.label === control.value?.label) && activeBtnIconUrl\" [src]=\"activeBtnIconUrl\" alt=\"\" />\n <p class=\"h6\">{{ item.label }}</p>\n </div>\n </div>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'multiSelect' fieldInputType: 'checkbox' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'multiSelect' && field.fieldInputType === 'checkbox'\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <div id=\"checkboxes-container\">\n <div class=\"radio-checkbox-common\" *ngFor=\"let item of field.itemsList\"\n [ngClass]=\"{ 'checkbox-active': isCheckBoxSelected(item.label, control.value) }\"\n (click)=\"updateSelectedValueForMultiSelect(field, control, formgroup, [item])\">\n <img *ngIf=\"isCheckBoxSelected(item.label, control.value) && activeBtnIconUrl\" [src]=\"activeBtnIconUrl\"\n alt=\"\" />\n <p class=\"h6\">{{ item.label }}</p>\n </div>\n </div>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'multiSelect' fieldInputType: 'dropdown' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'multiSelect' && field.fieldInputType === 'dropdown'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <mis-multi-select-dropdown [width]=\"'140px'\" [showSelectedCount]=\"true\" [dropdownListWidth]=\"'256px'\"\n [searchEnabled]=\"false\" [hideApplyButton]=\"true\" [data]=\"field.itemsList\"\n [selectedItems]=\"control.value\" (onChange)=\"updateSelectedValueForMultiSelect(field, control, formgroup, $event);\"></mis-multi-select-dropdown>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n</ng-template>\n\n<ng-template #dynamicFieldErrors let-errors>\n <div id=\"error-messages-container\">\n <ng-container *ngFor=\"let error of errors | keyvalue\">\n <p class=\"h8\">\n {{\" \u2022 &nbsp;\" + error.value}}\n </p>\n <div style=\"flex-basis: 100%; height: 0\"></div>\n </ng-container>\n </div>\n</ng-template>",
640
- styles: ["p{margin:0;cursor:default}::ng-deep .main-container{margin:0;max-width:100%}.sub-dynamic-form{padding-left:24px}.dynamic-field ::ng-deep .container{height:32px!important}.single-line-field-container{justify-content:space-between;align-items:center}.multi-line-field-container,.single-line-field-container{display:flex;padding:28px 16px;border-bottom:1px solid var(--grey-seperators)}.multi-line-field-container{justify-content:flex-start;align-items:flex-start;flex-wrap:wrap}.field-title-sm{margin-bottom:8px;cursor:default}.input-field{width:100%;background-color:var(--grey-bg-1);border:1px solid var(--grey-seperators);border-radius:6px}.ip-text{height:44px;padding:8px 12px}.ip-textarea{max-height:94px;padding:8px}input:focus{outline:none}input::-moz-placeholder{color:var(--grey-seperators)}input:-ms-input-placeholder{color:var(--grey-seperators)}input::placeholder{color:var(--grey-seperators)}textarea:focus{outline:none}.date-picker-container{position:relative;width:140px}.date-picker-container .date-picker{cursor:pointer;height:32px;width:100%;font-size:14px;border-radius:6px;padding:0 12px;border:1px solid var(--grey-seperators);inset:10px auto auto 80px;background-color:var(--text-white)}.date-picker-container .date-picker:hover{background-color:var(--grey-hover)}.date-picker-container .date-picker-icon{position:absolute;top:50%;right:12px;transform:translateY(-50%);cursor:pointer}form .dynamic-field:last-child{border-bottom:none!important}#checkboxes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.radio-checkbox-common{display:flex;justify-content:center;align-items:center;cursor:pointer;margin-right:8px;margin-bottom:8px;background-color:var(--text-white);padding:12px 16px;border:1px solid var(--text-muted);border-radius:8px}.radio-checkbox-common p{color:var(--text-muted);cursor:pointer}.radio-checkbox-common img{margin-right:8px}.checkbox-active{background-color:var(--pmry-500)}.checkbox-active p{color:var(--text-white)}#error-messages-container{margin-top:4px;width:100%;display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}#error-messages-container p{color:var(--sem-error)}"]
641
- },] }
642
- ];
643
- DynamicFormComponent.ctorParameters = function () { return []; };
644
- DynamicFormComponent.propDecorators = {
645
- formFields: [{ type: core.Input }],
646
- formValues: [{ type: core.Input }],
647
- activeBtnIconUrl: [{ type: core.Input }],
648
- calendarIconUrl: [{ type: core.Input }],
649
- formUpdated: [{ type: core.Output }],
650
- formValid: [{ type: core.Output }],
651
- formInitialized: [{ type: core.Output }]
652
- };
653
- var dynamicFieldValidator = function (validators) {
654
- return function (control) {
655
- var value = control.value;
656
- if (Array.isArray(value)) {
657
- return null;
658
- }
659
- else if (typeof value === 'object') {
660
- value = (value === null || value === void 0 ? void 0 : value.value) ? value.value : '';
661
- }
662
- var errors = null;
663
- validators.forEach(function (validator) {
664
- var error = null;
665
- var message = validator.message;
666
- switch (validator.type) {
667
- case "Required":
668
- error = forms.Validators.required(control);
669
- if (error)
670
- error = { Required: message };
671
- break;
672
- case "MinLength":
673
- error = forms.Validators.minLength(+validator.value)(control);
674
- message = message.replace('${0}', error === null || error === void 0 ? void 0 : error.minlength.requiredLength);
675
- if (error)
676
- error = { MinLength: message };
677
- break;
678
- case "MaxLength":
679
- error = forms.Validators.maxLength(+validator.value)(control);
680
- message = message.replace('${0}', error === null || error === void 0 ? void 0 : error.actualLength);
681
- if (error)
682
- error = { MaxLength: message };
683
- break;
684
- case "Email":
685
- error = forms.Validators.email(control);
686
- if (error)
687
- error = { Email: message };
688
- break;
689
- case "Custom":
690
- error = forms.Validators.pattern("" + validator.value)(control);
691
- if (error)
692
- error = { Custom: message };
693
- break;
694
- default:
695
- break;
696
- }
697
- if (error)
698
- errors = Object.assign(Object.assign({}, errors), error);
699
- });
700
- return errors;
701
- };
702
- };
493
+ var DynamicFormComponent = /** @class */ (function () {
494
+ function DynamicFormComponent() {
495
+ /**
496
+ * formFields: Dynamic fields recieved from the API metadata to build a dynamic form
497
+ * formValues: Holds the value of the dynamic form with "key" being dynamic field "title"
498
+ * and value being the user input.
499
+ */
500
+ this.formFields = [];
501
+ this.formValues = {};
502
+ // Need to deprecate these inputs and use constants.
503
+ this.activeBtnIconUrl = "";
504
+ this.calendarIconUrl = "";
505
+ /**
506
+ * formUpdated: Emits formValues Object whenever there is a change in the dynamic form.
507
+ */
508
+ this.formUpdated = new core.EventEmitter();
509
+ /**
510
+ * formValid: Emits boolean depending on validity of the form
511
+ */
512
+ this.formValid = new core.EventEmitter();
513
+ /**
514
+ * formInitialized: Emits dynamic form API on form initilization
515
+ */
516
+ this.formInitialized = new core.EventEmitter();
517
+ }
518
+ DynamicFormComponent.prototype.ngOnInit = function () {
519
+ var _this = this;
520
+ // Building the form
521
+ this.dynamicForm = this.generateDynamicForm(this.formFields, this.formValues);
522
+ // Subscribing to form changes and emiting values.
523
+ this.valueChangesSubscription$ = this.dynamicForm.valueChanges.subscribe(function (formValue) {
524
+ _this.onFormValueChanges();
525
+ });
526
+ //api to expose functions
527
+ this.dynamicFormAPI = {
528
+ defaultFormValues: function () {
529
+ return _this.generateDynamicFieldsValueObject(_this.dynamicForm.value.dynamicFields);
530
+ }
531
+ };
532
+ this.formInitialized.emit(this.dynamicFormAPI);
533
+ this.formValid.emit(this.dynamicForm.valid);
534
+ };
535
+ DynamicFormComponent.prototype.ngOnDestroy = function () {
536
+ var _a;
537
+ (_a = this.valueChangesSubscription$) === null || _a === void 0 ? void 0 : _a.unsubscribe();
538
+ };
539
+ DynamicFormComponent.prototype.onFormValueChanges = function () {
540
+ var formValues = this.generateDynamicFieldsValueObject(this.dynamicForm.value.dynamicFields);
541
+ this.formValid.emit(this.dynamicForm.valid);
542
+ this.formUpdated.emit(formValues);
543
+ console.log(formValues);
544
+ };
545
+ DynamicFormComponent.prototype.generateDynamicFieldsValueObject = function (formValues) {
546
+ var _this = this;
547
+ var dynamicFieldsValue = {};
548
+ formValues.forEach(function (fieldValue, index) {
549
+ var _a;
550
+ var formattedValue = _this.mapFormFieldToFormValue(_this.formFields[index], fieldValue.value);
551
+ if (((_a = fieldValue.subFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
552
+ var formattedSubFieldsValues_1 = {};
553
+ fieldValue.subFields.forEach(function (subFieldValue, subIndex) {
554
+ var subFormField = _this.formFields[index].subFields[subIndex];
555
+ formattedSubFieldsValues_1[subFormField.configName] = _this.mapFormFieldToFormValue(subFormField, subFieldValue);
556
+ });
557
+ dynamicFieldsValue[_this.formFields[index].configName] = {
558
+ value: formattedValue,
559
+ subFields: formattedSubFieldsValues_1
560
+ };
561
+ }
562
+ else {
563
+ dynamicFieldsValue[_this.formFields[index].configName] = formattedValue;
564
+ }
565
+ });
566
+ return dynamicFieldsValue;
567
+ };
568
+ DynamicFormComponent.prototype.generateDynamicForm = function (formFields, formValues) {
569
+ var e_1, _b;
570
+ var _a;
571
+ var formArray = new forms.FormArray([]);
572
+ try {
573
+ for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
574
+ var field = formFields_1_1.value;
575
+ var fieldValue = ((_a = formValues[field.configName]) === null || _a === void 0 ? void 0 : _a.value) ? formValues[field.configName].value : formValues[field.configName];
576
+ var fieldControl = this.mapFormValueToFormField(field, fieldValue);
577
+ var subFieldsControls = this.generateSubDynamicFields(formValues, field, fieldControl.value);
578
+ formArray.push(new forms.FormGroup({
579
+ value: fieldControl,
580
+ subFields: subFieldsControls
581
+ }));
582
+ }
583
+ }
584
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
585
+ finally {
586
+ try {
587
+ if (formFields_1_1 && !formFields_1_1.done && (_b = formFields_1.return)) _b.call(formFields_1);
588
+ }
589
+ finally { if (e_1) throw e_1.error; }
590
+ }
591
+ return new forms.FormGroup({
592
+ dynamicFields: formArray
593
+ });
594
+ };
595
+ DynamicFormComponent.prototype.getDynamicFieldsControls = function () {
596
+ return this.dynamicForm.get("dynamicFields");
597
+ };
598
+ DynamicFormComponent.prototype.updateSubDynamicFields = function (field, formGroup, value) {
599
+ var _a;
600
+ if (((_a = field.subFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
601
+ var subFieldsControls = this.generateSubDynamicFields(this.formValues, field, value);
602
+ formGroup.removeControl('subFields');
603
+ formGroup.addControl('subFields', subFieldsControls);
604
+ }
605
+ };
606
+ DynamicFormComponent.prototype.updateSelectedValueForSingleSelect = function (field, control, formGroup, value) {
607
+ var _a;
608
+ if (((_a = control.value) === null || _a === void 0 ? void 0 : _a.value) !== value.value) {
609
+ control.setValue(value);
610
+ }
611
+ else
612
+ control.setValue('');
613
+ this.updateSubDynamicFields(field, formGroup, value);
614
+ control.markAsTouched();
615
+ };
616
+ DynamicFormComponent.prototype.updateSelectedValueForMultiSelect = function (field, control, formGroup, values) {
617
+ var e_2, _b;
618
+ var selectedValues = control.value;
619
+ var _loop_1 = function (value) {
620
+ var itemIndex = selectedValues.findIndex(function (item) { return item.label === value.label; });
621
+ if (itemIndex > -1) {
622
+ selectedValues.splice(itemIndex, 1);
623
+ }
624
+ else {
625
+ selectedValues.push(Object.assign({}, value));
626
+ }
627
+ };
628
+ try {
629
+ for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
630
+ var value = values_1_1.value;
631
+ _loop_1(value);
632
+ }
633
+ }
634
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
635
+ finally {
636
+ try {
637
+ if (values_1_1 && !values_1_1.done && (_b = values_1.return)) _b.call(values_1);
638
+ }
639
+ finally { if (e_2) throw e_2.error; }
640
+ }
641
+ control.setValue(selectedValues);
642
+ this.updateSubDynamicFields(field, formGroup, values);
643
+ control.markAsTouched();
644
+ };
645
+ DynamicFormComponent.prototype.isCheckBoxSelected = function (value, selectedValues) {
646
+ return selectedValues.findIndex(function (item) { return item.label === value; }) > -1;
647
+ };
648
+ DynamicFormComponent.prototype.findSelectedIndex = function (subfields, value) {
649
+ var selectedIndex = subfields.findIndex(function (item) { return item.parentConfigValue === value; });
650
+ return selectedIndex !== -1 ? selectedIndex : 0;
651
+ };
652
+ DynamicFormComponent.prototype.matchParentConfig = function (subfields, value) {
653
+ if (!subfields || subfields.length === 0) {
654
+ return false;
655
+ }
656
+ return subfields.some(function (item) { return item.parentConfigValue === value; });
657
+ };
658
+ DynamicFormComponent.prototype.generateSubDynamicFields = function (formValues, parentField, parentValue) {
659
+ var e_3, _b;
660
+ var _a;
661
+ var controls = new forms.FormArray([]);
662
+ var subFields = parentField.subFields;
663
+ var subFieldsValues = ((_a = formValues[parentField.configName]) === null || _a === void 0 ? void 0 : _a.subFields) ? formValues[parentField.configName].subFields : {};
664
+ if (!subFields)
665
+ return controls;
666
+ if (parentField.fieldType === 'singleSelect') {
667
+ subFields = subFields.filter(function (subField) { var _a; return subField.parentConfigValue === ((_a = parentValue) === null || _a === void 0 ? void 0 : _a.value); });
668
+ }
669
+ else if (parentField.fieldType === 'multiSelect') {
670
+ var parentValues_1 = new Set(parentValue.map(function (value) { return value.value; }));
671
+ subFields = subFields.filter(function (subField) { return parentValues_1.has(subField.parentConfigValue); });
672
+ }
673
+ if ((subFields === null || subFields === void 0 ? void 0 : subFields.length) > 0) {
674
+ try {
675
+ for (var subFields_1 = __values(subFields), subFields_1_1 = subFields_1.next(); !subFields_1_1.done; subFields_1_1 = subFields_1.next()) {
676
+ var subField = subFields_1_1.value;
677
+ controls.push(this.mapFormValueToFormField(subField, subFieldsValues[subField.configName]));
678
+ }
679
+ }
680
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
681
+ finally {
682
+ try {
683
+ if (subFields_1_1 && !subFields_1_1.done && (_b = subFields_1.return)) _b.call(subFields_1);
684
+ }
685
+ finally { if (e_3) throw e_3.error; }
686
+ }
687
+ }
688
+ return controls;
689
+ };
690
+ DynamicFormComponent.prototype.mapFormValueToFormField = function (formField, formValue) {
691
+ var e_4, _b;
692
+ var validators = formField.validators ? [dynamicFieldValidator(formField.validators)] : [];
693
+ var control = new forms.FormControl(null, validators);
694
+ if (formField.fieldType === "input") {
695
+ if (formField.fieldInputType === "text" || formField.fieldInputType === "textarea")
696
+ control.setValue(formValue ? formValue : "");
697
+ else if (formField.fieldInputType === "number")
698
+ control.setValue(formValue ? formValue : 0);
699
+ else if (formField.fieldInputType === "date") {
700
+ if (formValue && typeof formValue === "number") {
701
+ control.setValue(moment__namespace(formValue).tz(formField.fieldConfig.timezone).format(formField.fieldConfig.format));
702
+ }
703
+ else {
704
+ control.setValue(moment__namespace().tz(formField.fieldConfig.timezone).format(formField.fieldConfig.format));
705
+ }
706
+ }
707
+ }
708
+ else if (formField.fieldType === "singleSelect") {
709
+ var findSelectedValue = function () {
710
+ var index = formField.itemsList.findIndex(function (item) { return item.value === formValue; });
711
+ return index >= 0 ? formField.itemsList[index] : "";
712
+ };
713
+ if (formField.fieldInputType === "dropdown") {
714
+ if (!formValue)
715
+ control.setValue(formField.itemsList[0]);
716
+ else
717
+ control.setValue(findSelectedValue());
718
+ }
719
+ else if (formField.fieldInputType === "radio") {
720
+ control.setValue(findSelectedValue());
721
+ }
722
+ }
723
+ else if (formField.fieldType === "multiSelect") {
724
+ if (formValue && Array.isArray(formValue)) {
725
+ var selectedValues = [];
726
+ var _loop_2 = function (value) {
727
+ var index = formField.itemsList.findIndex(function (item) { return item.value === value; });
728
+ if (index > -1)
729
+ selectedValues.push(Object.assign({}, formField.itemsList[index]));
730
+ };
731
+ try {
732
+ for (var formValue_1 = __values(formValue), formValue_1_1 = formValue_1.next(); !formValue_1_1.done; formValue_1_1 = formValue_1.next()) {
733
+ var value = formValue_1_1.value;
734
+ _loop_2(value);
735
+ }
736
+ }
737
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
738
+ finally {
739
+ try {
740
+ if (formValue_1_1 && !formValue_1_1.done && (_b = formValue_1.return)) _b.call(formValue_1);
741
+ }
742
+ finally { if (e_4) throw e_4.error; }
743
+ }
744
+ control.setValue(selectedValues);
745
+ }
746
+ else {
747
+ control.setValue([]);
748
+ }
749
+ }
750
+ else if (formField.fieldType === "boolean") {
751
+ control.setValue(!!formValue);
752
+ }
753
+ else
754
+ control.setValue(null);
755
+ return control;
756
+ };
757
+ DynamicFormComponent.prototype.mapFormFieldToFormValue = function (formField, formValue) {
758
+ var _a;
759
+ if (formField.fieldType === "input") {
760
+ if (formField.fieldInputType === "text" || formField.fieldInputType === "textarea")
761
+ return formValue;
762
+ else if (formField.fieldInputType === "number")
763
+ return +formValue;
764
+ else if (formField.fieldInputType === "date") {
765
+ return moment.tz(formValue, formField.fieldConfig.format, formField.fieldConfig.timezone).valueOf();
766
+ }
767
+ }
768
+ else if (formField.fieldType === "singleSelect") {
769
+ return (_a = formValue === null || formValue === void 0 ? void 0 : formValue.value) !== null && _a !== void 0 ? _a : '';
770
+ }
771
+ else if (formField.fieldType === "multiSelect") {
772
+ return formValue === null || formValue === void 0 ? void 0 : formValue.map(function (item) { return item.value; });
773
+ }
774
+ else if (formField.fieldType === "boolean") {
775
+ return formValue;
776
+ }
777
+ else
778
+ return formValue;
779
+ };
780
+ return DynamicFormComponent;
781
+ }());
782
+ DynamicFormComponent.decorators = [
783
+ { type: core.Component, args: [{
784
+ selector: "mis-dynamic-form",
785
+ template: "<form [formGroup]=\"dynamicForm\">\n <ng-container formArrayName=\"dynamicFields\">\n <ng-container [formGroupName]=\"i\" *ngFor=\"let fieldControl of getDynamicFieldsControls().controls; let i = index\">\n <ng-container\n [ngTemplateOutlet]=\"dynamicField\"\n [ngTemplateOutletContext]=\"{\n $implicit: formFields[i],\n formGroup: fieldControl,\n control: fieldControl.controls.value\n }\"\n >\n </ng-container>\n <div class=\"sub-dynamic-form\" *ngIf=\"fieldControl.value && (!!formFields[i]?.subFields && formFields[i]?.subFields?.length > 0 && matchParentConfig(formFields[i]?.subFields, fieldControl.controls.value.value.value))\">\n <ng-container *ngFor=\"let subFieldControl of fieldControl.controls.subFields.controls;\">\n <ng-container\n [ngTemplateOutlet]=\"dynamicField\"\n [ngTemplateOutletContext]=\"{\n $implicit: formFields[i].subFields[findSelectedIndex(formFields[i]?.subFields, fieldControl.controls.value.value.value)],\n control: subFieldControl\n }\">\n </ng-container>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n</form>\n\n\n<ng-template #dynamicField let-field let-control=\"control\" let-formgroup=\"formGroup\">\n\n <!-- fieldType: 'input' fieldInputType: 'text' | 'number' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'input' && (field.fieldInputType === 'text' || field.fieldInputType === 'number')\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <input class=\"input-field ip-text\" [type]=\"field.fieldInputType\" [formControl]=\"control\"\n (ngModelChange)=\"updateSubDynamicFields(field, formgroup, $event)\" \n [ngStyle]=\"{'border': control.touched && control.errors ? '1px solid #B00020': ''}\"\n [placeholder]=\"field.placeholderText ? field.placeholderText : 'Input Text'\" \n [min]=\"field.fieldInputType === 'number' ? 0 : '' \"/>\n <ng-container *ngIf=\"control.touched && control.errors\"\n [ngTemplateOutlet]=\"dynamicFieldErrors\" \n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\"\n >\n </ng-container>\n </div>\n\n <!-- fieldType: 'input' fieldInputType: 'textarea' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'input' && field.fieldInputType === 'textarea'\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <textarea class=\"input-field ip-textarea\" type=\"text\"\n [ngStyle]=\"{'border': control.touched && control.errors ? '1px solid #B00020': ''}\"\n [placeholder]=\"field.placeholderText ? field.placeholderText : 'Input Text'\" [formControl]=\"control\" (ngModelChange)=\"updateSubDynamicFields(field, formgroup, $event)\"></textarea>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'input' fieldInputType: 'date' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'input' && field.fieldInputType === 'date'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <div class=\"date-picker-container\">\n <input class=\"date-picker\" readonly misTzDp [dpConfig]=\"field.fieldConfig\"\n (dateChange)=\"control.setValue($event)\" [selectedDate]=\"control.value\" [offsetY]=\"0\"\n [value]=\"control.value\" #dp />\n <img alt=\"data-picker\" *ngIf=\"calendarIconUrl\" class=\"date-picker-icon\" [src]=\"calendarIconUrl\"\n (click)=\"dp.click()\" />\n </div>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'boolean' fieldInputType: 'toggle' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'boolean' && field.fieldInputType === 'toggle'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <mis-switch [control]=\"control\" (valueChanged)=\"updateSubDynamicFields(field, formgroup, $event)\"></mis-switch>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'singleSelect' fieldInputType: 'dropdown' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'singleSelect' && field.fieldInputType === 'dropdown'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <mis-dropdown [searchEnabled]=\"false\" [width]=\"'140px'\" [data]=\"field.itemsList\" [selectedItem]=\"control.value\"\n (onChange)=\"updateSelectedValueForSingleSelect(field, control, formgroup, $event);\">\n </mis-dropdown>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'singleSelect' fieldInputType: 'radio' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'singleSelect' && field.fieldInputType === 'radio'\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <div id=\"checkboxes-container\">\n <div class=\"radio-checkbox-common\" *ngFor=\"let item of field.itemsList\"\n [ngClass]=\"{ 'checkbox-active': item.label === control.value?.label }\"\n (click)=\"updateSelectedValueForSingleSelect(field, control, formgroup, item);\">\n <img *ngIf=\"(item.label === control.value?.label) && activeBtnIconUrl\" [src]=\"activeBtnIconUrl\" alt=\"\" />\n <p class=\"h6\">{{ item.label }}</p>\n </div>\n </div>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'multiSelect' fieldInputType: 'checkbox' -->\n <div class=\"dynamic-field multi-line-field-container\"\n *ngIf=\"field.fieldType === 'multiSelect' && field.fieldInputType === 'checkbox'\">\n <p class=\"h7 field-title-sm\">\n {{ field.title }}\n </p>\n <div style=\"flex-basis: 100%\"></div>\n <div id=\"checkboxes-container\">\n <div class=\"radio-checkbox-common\" *ngFor=\"let item of field.itemsList\"\n [ngClass]=\"{ 'checkbox-active': isCheckBoxSelected(item.label, control.value) }\"\n (click)=\"updateSelectedValueForMultiSelect(field, control, formgroup, [item])\">\n <img *ngIf=\"isCheckBoxSelected(item.label, control.value) && activeBtnIconUrl\" [src]=\"activeBtnIconUrl\"\n alt=\"\" />\n <p class=\"h6\">{{ item.label }}</p>\n </div>\n </div>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n <!-- fieldType: 'multiSelect' fieldInputType: 'dropdown' -->\n <div class=\"dynamic-field single-line-field-container\"\n *ngIf=\"field.fieldType === 'multiSelect' && field.fieldInputType === 'dropdown'\">\n <p class=\"h6\">\n {{ field.title }}\n </p>\n <mis-multi-select-dropdown [width]=\"'140px'\" [showSelectedCount]=\"true\" [dropdownListWidth]=\"'256px'\"\n [searchEnabled]=\"false\" [hideApplyButton]=\"true\" [data]=\"field.itemsList\"\n [selectedItems]=\"control.value\" (onChange)=\"updateSelectedValueForMultiSelect(field, control, formgroup, $event);\"></mis-multi-select-dropdown>\n <ng-container *ngIf=\"control.touched && control.errors\" [ngTemplateOutlet]=\"dynamicFieldErrors\"\n [ngTemplateOutletContext]=\"{ $implicit: control.errors }\">\n </ng-container>\n </div>\n\n</ng-template>\n\n<ng-template #dynamicFieldErrors let-errors>\n <div id=\"error-messages-container\">\n <ng-container *ngFor=\"let error of errors | keyvalue\">\n <p class=\"h8\">\n {{\" \u2022 &nbsp;\" + error.value}}\n </p>\n <div style=\"flex-basis: 100%; height: 0\"></div>\n </ng-container>\n </div>\n</ng-template>",
786
+ styles: ["p{margin:0;cursor:default}::ng-deep .main-container{margin:0;max-width:100%}.sub-dynamic-form{padding-left:24px}.dynamic-field ::ng-deep .container{height:32px!important}.single-line-field-container{justify-content:space-between;align-items:center}.multi-line-field-container,.single-line-field-container{display:flex;padding:28px 16px;border-bottom:1px solid var(--grey-seperators)}.multi-line-field-container{justify-content:flex-start;align-items:flex-start;flex-wrap:wrap}.field-title-sm{margin-bottom:8px;cursor:default}.input-field{width:100%;background-color:var(--grey-bg-1);border:1px solid var(--grey-seperators);border-radius:6px}.ip-text{height:44px;padding:8px 12px}.ip-textarea{max-height:94px;padding:8px}input:focus{outline:none}input::-moz-placeholder{color:var(--grey-seperators)}input::placeholder{color:var(--grey-seperators)}textarea:focus{outline:none}.date-picker-container{position:relative;width:140px}.date-picker-container .date-picker{cursor:pointer;height:32px;width:100%;font-size:14px;border-radius:6px;padding:0 12px;border:1px solid var(--grey-seperators);inset:10px auto auto 80px;background-color:var(--text-white)}.date-picker-container .date-picker:hover{background-color:var(--grey-hover)}.date-picker-container .date-picker-icon{position:absolute;top:50%;right:12px;transform:translateY(-50%);cursor:pointer}form .dynamic-field:last-child{border-bottom:none!important}#checkboxes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.radio-checkbox-common{display:flex;justify-content:center;align-items:center;cursor:pointer;margin-right:8px;margin-bottom:8px;background-color:var(--text-white);padding:12px 16px;border:1px solid var(--text-muted);border-radius:8px}.radio-checkbox-common p{color:var(--text-muted);cursor:pointer}.radio-checkbox-common img{margin-right:8px}.checkbox-active{background-color:var(--pmry-500)}.checkbox-active p{color:var(--text-white)}#error-messages-container{margin-top:4px;width:100%;display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}#error-messages-container p{color:var(--sem-error)}"]
787
+ },] }
788
+ ];
789
+ DynamicFormComponent.ctorParameters = function () { return []; };
790
+ DynamicFormComponent.propDecorators = {
791
+ formFields: [{ type: core.Input }],
792
+ formValues: [{ type: core.Input }],
793
+ activeBtnIconUrl: [{ type: core.Input }],
794
+ calendarIconUrl: [{ type: core.Input }],
795
+ formUpdated: [{ type: core.Output }],
796
+ formValid: [{ type: core.Output }],
797
+ formInitialized: [{ type: core.Output }]
798
+ };
799
+ var dynamicFieldValidator = function (validators) {
800
+ return function (control) {
801
+ var value = control.value;
802
+ if (Array.isArray(value)) {
803
+ return null;
804
+ }
805
+ else if (typeof value === 'object') {
806
+ value = (value === null || value === void 0 ? void 0 : value.value) ? value.value : '';
807
+ }
808
+ var errors = null;
809
+ validators.forEach(function (validator) {
810
+ var error = null;
811
+ var message = validator.message;
812
+ switch (validator.type) {
813
+ case "Required":
814
+ error = forms.Validators.required(control);
815
+ if (error)
816
+ error = { Required: message };
817
+ break;
818
+ case "MinLength":
819
+ error = forms.Validators.minLength(+validator.value)(control);
820
+ message = message.replace('${0}', error === null || error === void 0 ? void 0 : error.minlength.requiredLength);
821
+ if (error)
822
+ error = { MinLength: message };
823
+ break;
824
+ case "MaxLength":
825
+ error = forms.Validators.maxLength(+validator.value)(control);
826
+ message = message.replace('${0}', error === null || error === void 0 ? void 0 : error.actualLength);
827
+ if (error)
828
+ error = { MaxLength: message };
829
+ break;
830
+ case "Email":
831
+ error = forms.Validators.email(control);
832
+ if (error)
833
+ error = { Email: message };
834
+ break;
835
+ case "Custom":
836
+ error = forms.Validators.pattern("" + validator.value)(control);
837
+ if (error)
838
+ error = { Custom: message };
839
+ break;
840
+ default:
841
+ break;
842
+ }
843
+ if (error)
844
+ errors = Object.assign(Object.assign({}, errors), error);
845
+ });
846
+ return errors;
847
+ };
848
+ };
703
849
 
704
- var DynamicFormModule = /** @class */ (function () {
705
- function DynamicFormModule() {
706
- }
707
- DynamicFormModule.forRoot = function () {
708
- return { ngModule: DynamicFormModule, providers: [] };
709
- };
710
- return DynamicFormModule;
711
- }());
712
- DynamicFormModule.decorators = [
713
- { type: core.NgModule, args: [{
714
- declarations: [DynamicFormComponent],
715
- imports: [
716
- common.CommonModule,
717
- forms.ReactiveFormsModule,
718
- forms.FormsModule,
719
- overlay.OverlayModule,
720
- scrolling.ScrollingModule,
721
- dropdown.DropdownModule,
722
- _switch.SwitchModule,
723
- multiSelectDropdown.MultiSelectDropdownModule,
724
- datepicker_v2.DatepickerModuleV2
725
- ],
726
- exports: [DynamicFormComponent]
727
- },] }
728
- ];
850
+ var DynamicFormModule = /** @class */ (function () {
851
+ function DynamicFormModule() {
852
+ }
853
+ DynamicFormModule.forRoot = function () {
854
+ return { ngModule: DynamicFormModule, providers: [] };
855
+ };
856
+ return DynamicFormModule;
857
+ }());
858
+ DynamicFormModule.decorators = [
859
+ { type: core.NgModule, args: [{
860
+ declarations: [DynamicFormComponent],
861
+ imports: [
862
+ common.CommonModule,
863
+ forms.ReactiveFormsModule,
864
+ forms.FormsModule,
865
+ overlay.OverlayModule,
866
+ scrolling.ScrollingModule,
867
+ dropdown.DropdownModule,
868
+ _switch.SwitchModule,
869
+ multiSelectDropdown.MultiSelectDropdownModule,
870
+ datepicker_v2.DatepickerModuleV2
871
+ ],
872
+ exports: [DynamicFormComponent]
873
+ },] }
874
+ ];
729
875
 
730
- /**
731
- * Generated bundle index. Do not edit.
732
- */
876
+ /**
877
+ * Generated bundle index. Do not edit.
878
+ */
733
879
 
734
- exports.DynamicFormComponent = DynamicFormComponent;
735
- exports.DynamicFormModule = DynamicFormModule;
880
+ exports.DynamicFormComponent = DynamicFormComponent;
881
+ exports.DynamicFormModule = DynamicFormModule;
736
882
 
737
- Object.defineProperty(exports, '__esModule', { value: true });
883
+ Object.defineProperty(exports, '__esModule', { value: true });
738
884
 
739
885
  })));
740
886
  //# sourceMappingURL=mis-crystal-design-system-dynamic-form.umd.js.map