@marcura/marcura-combobox 4.6.2 → 4.7.1

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 (56) hide show
  1. package/bundles/marcura-marcura-combobox.umd.js +1841 -1779
  2. package/bundles/marcura-marcura-combobox.umd.js.map +1 -1
  3. package/bundles/marcura-marcura-combobox.umd.min.js +1 -1
  4. package/bundles/marcura-marcura-combobox.umd.min.js.map +1 -1
  5. package/esm2015/lib/combobox.injectables.js +4 -4
  6. package/esm2015/lib/combobox.module.js +60 -60
  7. package/esm2015/lib/components/abstract-combobox/abstract-combobox.component.js +225 -225
  8. package/esm2015/lib/components/abstract-dropdown/abstract-dropdown.component.js +204 -204
  9. package/esm2015/lib/components/combobox/combobox.component.js +288 -288
  10. package/esm2015/lib/components/combobox-popup-footer/combobox-popup-footer.component.js +27 -27
  11. package/esm2015/lib/components/dropdown/dropdown.component.js +165 -165
  12. package/esm2015/lib/components/multiselect/multiselect.component.js +241 -180
  13. package/esm2015/lib/directives/combobox-item-template.directive.js +8 -8
  14. package/esm2015/lib/directives/dropdown-item-template.directive.js +8 -8
  15. package/esm2015/lib/directives/dropdown-value-template.directive.js +8 -8
  16. package/esm2015/lib/directives/multiselect-item-template.directive.js +8 -8
  17. package/esm2015/lib/directives/multiselect-tag-template.directive.js +8 -8
  18. package/esm2015/lib/directives/multiselect-tag-wrapper.directive.js +58 -58
  19. package/esm2015/lib/model/combobox-changed.event.js +3 -3
  20. package/esm2015/lib/model/combobox-search-settings-operator.enum.js +5 -5
  21. package/esm2015/lib/model/dropdown-changed.event.js +3 -3
  22. package/esm2015/lib/model/multiselect-changed.event.js +3 -3
  23. package/esm2015/marcura-marcura-combobox.js +4 -4
  24. package/esm2015/public-api.js +24 -24
  25. package/fesm2015/marcura-marcura-combobox.js +1240 -1179
  26. package/fesm2015/marcura-marcura-combobox.js.map +1 -1
  27. package/lib/combobox.injectables.d.ts +8 -8
  28. package/lib/combobox.module.d.ts +4 -4
  29. package/lib/components/abstract-combobox/abstract-combobox.component.d.ts +51 -51
  30. package/lib/components/abstract-dropdown/abstract-dropdown.component.d.ts +66 -66
  31. package/lib/components/combobox/combobox.component.d.ts +60 -60
  32. package/lib/components/combobox-popup-footer/combobox-popup-footer.component.d.ts +10 -10
  33. package/lib/components/dropdown/dropdown.component.d.ts +42 -42
  34. package/lib/components/multiselect/multiselect.component.d.ts +55 -46
  35. package/lib/directives/combobox-item-template.directive.d.ts +2 -2
  36. package/lib/directives/dropdown-item-template.directive.d.ts +2 -2
  37. package/lib/directives/dropdown-value-template.directive.d.ts +2 -2
  38. package/lib/directives/multiselect-item-template.directive.d.ts +2 -2
  39. package/lib/directives/multiselect-tag-template.directive.d.ts +2 -2
  40. package/lib/directives/multiselect-tag-wrapper.directive.d.ts +18 -18
  41. package/lib/model/combobox-changed.event.d.ts +3 -3
  42. package/lib/model/combobox-kendo-component.interface.d.ts +7 -7
  43. package/lib/model/combobox-localization.interface.d.ts +5 -5
  44. package/lib/model/combobox-search-fn.type.d.ts +2 -2
  45. package/lib/model/combobox-search-settings-operator.enum.d.ts +4 -4
  46. package/lib/model/combobox-search-settings.interface.d.ts +5 -5
  47. package/lib/model/dropdown-changed.event.d.ts +3 -3
  48. package/lib/model/dropdown-kendo-component.interface.d.ts +6 -6
  49. package/lib/model/dropdown-localization.interface.d.ts +3 -3
  50. package/lib/model/dropdown-localizer.interface.d.ts +5 -5
  51. package/lib/model/multiselect-changed.event.d.ts +3 -3
  52. package/lib/model/multiselect-localization.interface.d.ts +5 -5
  53. package/marcura-marcura-combobox.d.ts +4 -4
  54. package/marcura-marcura-combobox.metadata.json +1 -1
  55. package/package.json +3 -3
  56. package/public-api.d.ts +24 -24
@@ -4,1823 +4,1885 @@
4
4
  (global = global || self, factory((global.marcura = global.marcura || {}, global.marcura['marcura-combobox'] = {}), global.ng.core, global.ng.common, global.ng.forms, global['@marcura/marcura-tag'], global['@progress/kendo-angular-dropdowns'], global['@progress/kendo-angular-popup'], global['@marcura/marcura-common'], global.rxjs, global.rxjs.operators));
5
5
  }(this, (function (exports, core, common, forms, marcuraTag, kendoAngularDropdowns, kendoAngularPopup, marcuraCommon, rxjs, operators) { 'use strict';
6
6
 
7
- var COMBOBOX_LOCALIZER = new core.InjectionToken('ComboboxModule.IDropdownLocalizer<IComboboxLocalization>');
8
- var DROPDOWN_LOCALIZER = new core.InjectionToken('ComboboxModule.IDropdownLocalizer<IDropdownLocalization>');
7
+ var COMBOBOX_LOCALIZER = new core.InjectionToken('ComboboxModule.IDropdownLocalizer<IComboboxLocalization>');
8
+ var DROPDOWN_LOCALIZER = new core.InjectionToken('ComboboxModule.IDropdownLocalizer<IDropdownLocalization>');
9
9
  var MULTISELECT_LOCALIZER = new core.InjectionToken('ComboboxModule.IDropdownLocalizer<IMultiselectLocalization>');
10
10
 
11
- /*! *****************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
- /* global Reflect, Promise */
26
- var extendStatics = function (d, b) {
27
- extendStatics = Object.setPrototypeOf ||
28
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29
- function (d, b) { for (var p in b)
30
- if (Object.prototype.hasOwnProperty.call(b, p))
31
- d[p] = b[p]; };
32
- return extendStatics(d, b);
33
- };
34
- function __extends(d, b) {
35
- extendStatics(d, b);
36
- function __() { this.constructor = d; }
37
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38
- }
39
- var __assign = function () {
40
- __assign = Object.assign || function __assign(t) {
41
- for (var s, i = 1, n = arguments.length; i < n; i++) {
42
- s = arguments[i];
43
- for (var p in s)
44
- if (Object.prototype.hasOwnProperty.call(s, p))
45
- t[p] = s[p];
46
- }
47
- return t;
48
- };
49
- return __assign.apply(this, arguments);
50
- };
51
- function __rest(s, e) {
52
- var t = {};
53
- for (var p in s)
54
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
55
- t[p] = s[p];
56
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
57
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
58
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
59
- t[p[i]] = s[p[i]];
60
- }
61
- return t;
62
- }
63
- function __decorate(decorators, target, key, desc) {
64
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
65
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
66
- r = Reflect.decorate(decorators, target, key, desc);
67
- else
68
- for (var i = decorators.length - 1; i >= 0; i--)
69
- if (d = decorators[i])
70
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
71
- return c > 3 && r && Object.defineProperty(target, key, r), r;
72
- }
73
- function __param(paramIndex, decorator) {
74
- return function (target, key) { decorator(target, key, paramIndex); };
75
- }
76
- function __metadata(metadataKey, metadataValue) {
77
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
78
- return Reflect.metadata(metadataKey, metadataValue);
79
- }
80
- function __awaiter(thisArg, _arguments, P, generator) {
81
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
82
- return new (P || (P = Promise))(function (resolve, reject) {
83
- function fulfilled(value) { try {
84
- step(generator.next(value));
85
- }
86
- catch (e) {
87
- reject(e);
88
- } }
89
- function rejected(value) { try {
90
- step(generator["throw"](value));
91
- }
92
- catch (e) {
93
- reject(e);
94
- } }
95
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
96
- step((generator = generator.apply(thisArg, _arguments || [])).next());
97
- });
98
- }
99
- function __generator(thisArg, body) {
100
- var _ = { label: 0, sent: function () { if (t[0] & 1)
101
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
102
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
103
- function verb(n) { return function (v) { return step([n, v]); }; }
104
- function step(op) {
105
- if (f)
106
- throw new TypeError("Generator is already executing.");
107
- while (_)
108
- try {
109
- 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)
110
- return t;
111
- if (y = 0, t)
112
- op = [op[0] & 2, t.value];
113
- switch (op[0]) {
114
- case 0:
115
- case 1:
116
- t = op;
117
- break;
118
- case 4:
119
- _.label++;
120
- return { value: op[1], done: false };
121
- case 5:
122
- _.label++;
123
- y = op[1];
124
- op = [0];
125
- continue;
126
- case 7:
127
- op = _.ops.pop();
128
- _.trys.pop();
129
- continue;
130
- default:
131
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
132
- _ = 0;
133
- continue;
134
- }
135
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
136
- _.label = op[1];
137
- break;
138
- }
139
- if (op[0] === 6 && _.label < t[1]) {
140
- _.label = t[1];
141
- t = op;
142
- break;
143
- }
144
- if (t && _.label < t[2]) {
145
- _.label = t[2];
146
- _.ops.push(op);
147
- break;
148
- }
149
- if (t[2])
150
- _.ops.pop();
151
- _.trys.pop();
152
- continue;
153
- }
154
- op = body.call(thisArg, _);
155
- }
156
- catch (e) {
157
- op = [6, e];
158
- y = 0;
159
- }
160
- finally {
161
- f = t = 0;
162
- }
163
- if (op[0] & 5)
164
- throw op[1];
165
- return { value: op[0] ? op[1] : void 0, done: true };
166
- }
167
- }
168
- var __createBinding = Object.create ? (function (o, m, k, k2) {
169
- if (k2 === undefined)
170
- k2 = k;
171
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
172
- }) : (function (o, m, k, k2) {
173
- if (k2 === undefined)
174
- k2 = k;
175
- o[k2] = m[k];
176
- });
177
- function __exportStar(m, o) {
178
- for (var p in m)
179
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
180
- __createBinding(o, m, p);
181
- }
182
- function __values(o) {
183
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
184
- if (m)
185
- return m.call(o);
186
- if (o && typeof o.length === "number")
187
- return {
188
- next: function () {
189
- if (o && i >= o.length)
190
- o = void 0;
191
- return { value: o && o[i++], done: !o };
192
- }
193
- };
194
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
195
- }
196
- function __read(o, n) {
197
- var m = typeof Symbol === "function" && o[Symbol.iterator];
198
- if (!m)
199
- return o;
200
- var i = m.call(o), r, ar = [], e;
201
- try {
202
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
203
- ar.push(r.value);
204
- }
205
- catch (error) {
206
- e = { error: error };
207
- }
208
- finally {
209
- try {
210
- if (r && !r.done && (m = i["return"]))
211
- m.call(i);
212
- }
213
- finally {
214
- if (e)
215
- throw e.error;
216
- }
217
- }
218
- return ar;
219
- }
220
- function __spread() {
221
- for (var ar = [], i = 0; i < arguments.length; i++)
222
- ar = ar.concat(__read(arguments[i]));
223
- return ar;
224
- }
225
- function __spreadArrays() {
226
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
227
- s += arguments[i].length;
228
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
229
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
230
- r[k] = a[j];
231
- return r;
232
- }
233
- ;
234
- function __await(v) {
235
- return this instanceof __await ? (this.v = v, this) : new __await(v);
236
- }
237
- function __asyncGenerator(thisArg, _arguments, generator) {
238
- if (!Symbol.asyncIterator)
239
- throw new TypeError("Symbol.asyncIterator is not defined.");
240
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
241
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
242
- function verb(n) { if (g[n])
243
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
244
- function resume(n, v) { try {
245
- step(g[n](v));
246
- }
247
- catch (e) {
248
- settle(q[0][3], e);
249
- } }
250
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
251
- function fulfill(value) { resume("next", value); }
252
- function reject(value) { resume("throw", value); }
253
- function settle(f, v) { if (f(v), q.shift(), q.length)
254
- resume(q[0][0], q[0][1]); }
255
- }
256
- function __asyncDelegator(o) {
257
- var i, p;
258
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
259
- 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; }
260
- }
261
- function __asyncValues(o) {
262
- if (!Symbol.asyncIterator)
263
- throw new TypeError("Symbol.asyncIterator is not defined.");
264
- var m = o[Symbol.asyncIterator], i;
265
- 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);
266
- 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); }); }; }
267
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
268
- }
269
- function __makeTemplateObject(cooked, raw) {
270
- if (Object.defineProperty) {
271
- Object.defineProperty(cooked, "raw", { value: raw });
272
- }
273
- else {
274
- cooked.raw = raw;
275
- }
276
- return cooked;
277
- }
278
- ;
279
- var __setModuleDefault = Object.create ? (function (o, v) {
280
- Object.defineProperty(o, "default", { enumerable: true, value: v });
281
- }) : function (o, v) {
282
- o["default"] = v;
283
- };
284
- function __importStar(mod) {
285
- if (mod && mod.__esModule)
286
- return mod;
287
- var result = {};
288
- if (mod != null)
289
- for (var k in mod)
290
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
291
- __createBinding(result, mod, k);
292
- __setModuleDefault(result, mod);
293
- return result;
294
- }
295
- function __importDefault(mod) {
296
- return (mod && mod.__esModule) ? mod : { default: mod };
297
- }
298
- function __classPrivateFieldGet(receiver, privateMap) {
299
- if (!privateMap.has(receiver)) {
300
- throw new TypeError("attempted to get private field on non-instance");
301
- }
302
- return privateMap.get(receiver);
303
- }
304
- function __classPrivateFieldSet(receiver, privateMap, value) {
305
- if (!privateMap.has(receiver)) {
306
- throw new TypeError("attempted to set private field on non-instance");
307
- }
308
- privateMap.set(receiver, value);
309
- return value;
11
+ /*! *****************************************************************************
12
+ Copyright (c) Microsoft Corporation.
13
+
14
+ Permission to use, copy, modify, and/or distribute this software for any
15
+ purpose with or without fee is hereby granted.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
+ PERFORMANCE OF THIS SOFTWARE.
24
+ ***************************************************************************** */
25
+ /* global Reflect, Promise */
26
+ var extendStatics = function (d, b) {
27
+ extendStatics = Object.setPrototypeOf ||
28
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29
+ function (d, b) { for (var p in b)
30
+ if (Object.prototype.hasOwnProperty.call(b, p))
31
+ d[p] = b[p]; };
32
+ return extendStatics(d, b);
33
+ };
34
+ function __extends(d, b) {
35
+ extendStatics(d, b);
36
+ function __() { this.constructor = d; }
37
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38
+ }
39
+ var __assign = function () {
40
+ __assign = Object.assign || function __assign(t) {
41
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
42
+ s = arguments[i];
43
+ for (var p in s)
44
+ if (Object.prototype.hasOwnProperty.call(s, p))
45
+ t[p] = s[p];
46
+ }
47
+ return t;
48
+ };
49
+ return __assign.apply(this, arguments);
50
+ };
51
+ function __rest(s, e) {
52
+ var t = {};
53
+ for (var p in s)
54
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
55
+ t[p] = s[p];
56
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
57
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
58
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
59
+ t[p[i]] = s[p[i]];
60
+ }
61
+ return t;
62
+ }
63
+ function __decorate(decorators, target, key, desc) {
64
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
65
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
66
+ r = Reflect.decorate(decorators, target, key, desc);
67
+ else
68
+ for (var i = decorators.length - 1; i >= 0; i--)
69
+ if (d = decorators[i])
70
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
71
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
72
+ }
73
+ function __param(paramIndex, decorator) {
74
+ return function (target, key) { decorator(target, key, paramIndex); };
75
+ }
76
+ function __metadata(metadataKey, metadataValue) {
77
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
78
+ return Reflect.metadata(metadataKey, metadataValue);
79
+ }
80
+ function __awaiter(thisArg, _arguments, P, generator) {
81
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
82
+ return new (P || (P = Promise))(function (resolve, reject) {
83
+ function fulfilled(value) { try {
84
+ step(generator.next(value));
85
+ }
86
+ catch (e) {
87
+ reject(e);
88
+ } }
89
+ function rejected(value) { try {
90
+ step(generator["throw"](value));
91
+ }
92
+ catch (e) {
93
+ reject(e);
94
+ } }
95
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
96
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
97
+ });
98
+ }
99
+ function __generator(thisArg, body) {
100
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
101
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
102
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
103
+ function verb(n) { return function (v) { return step([n, v]); }; }
104
+ function step(op) {
105
+ if (f)
106
+ throw new TypeError("Generator is already executing.");
107
+ while (_)
108
+ try {
109
+ 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)
110
+ return t;
111
+ if (y = 0, t)
112
+ op = [op[0] & 2, t.value];
113
+ switch (op[0]) {
114
+ case 0:
115
+ case 1:
116
+ t = op;
117
+ break;
118
+ case 4:
119
+ _.label++;
120
+ return { value: op[1], done: false };
121
+ case 5:
122
+ _.label++;
123
+ y = op[1];
124
+ op = [0];
125
+ continue;
126
+ case 7:
127
+ op = _.ops.pop();
128
+ _.trys.pop();
129
+ continue;
130
+ default:
131
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
132
+ _ = 0;
133
+ continue;
134
+ }
135
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
136
+ _.label = op[1];
137
+ break;
138
+ }
139
+ if (op[0] === 6 && _.label < t[1]) {
140
+ _.label = t[1];
141
+ t = op;
142
+ break;
143
+ }
144
+ if (t && _.label < t[2]) {
145
+ _.label = t[2];
146
+ _.ops.push(op);
147
+ break;
148
+ }
149
+ if (t[2])
150
+ _.ops.pop();
151
+ _.trys.pop();
152
+ continue;
153
+ }
154
+ op = body.call(thisArg, _);
155
+ }
156
+ catch (e) {
157
+ op = [6, e];
158
+ y = 0;
159
+ }
160
+ finally {
161
+ f = t = 0;
162
+ }
163
+ if (op[0] & 5)
164
+ throw op[1];
165
+ return { value: op[0] ? op[1] : void 0, done: true };
166
+ }
167
+ }
168
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
169
+ if (k2 === undefined)
170
+ k2 = k;
171
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
172
+ }) : (function (o, m, k, k2) {
173
+ if (k2 === undefined)
174
+ k2 = k;
175
+ o[k2] = m[k];
176
+ });
177
+ function __exportStar(m, o) {
178
+ for (var p in m)
179
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
180
+ __createBinding(o, m, p);
181
+ }
182
+ function __values(o) {
183
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
184
+ if (m)
185
+ return m.call(o);
186
+ if (o && typeof o.length === "number")
187
+ return {
188
+ next: function () {
189
+ if (o && i >= o.length)
190
+ o = void 0;
191
+ return { value: o && o[i++], done: !o };
192
+ }
193
+ };
194
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
195
+ }
196
+ function __read(o, n) {
197
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
198
+ if (!m)
199
+ return o;
200
+ var i = m.call(o), r, ar = [], e;
201
+ try {
202
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
203
+ ar.push(r.value);
204
+ }
205
+ catch (error) {
206
+ e = { error: error };
207
+ }
208
+ finally {
209
+ try {
210
+ if (r && !r.done && (m = i["return"]))
211
+ m.call(i);
212
+ }
213
+ finally {
214
+ if (e)
215
+ throw e.error;
216
+ }
217
+ }
218
+ return ar;
219
+ }
220
+ function __spread() {
221
+ for (var ar = [], i = 0; i < arguments.length; i++)
222
+ ar = ar.concat(__read(arguments[i]));
223
+ return ar;
224
+ }
225
+ function __spreadArrays() {
226
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
227
+ s += arguments[i].length;
228
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
229
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
230
+ r[k] = a[j];
231
+ return r;
232
+ }
233
+ ;
234
+ function __await(v) {
235
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
236
+ }
237
+ function __asyncGenerator(thisArg, _arguments, generator) {
238
+ if (!Symbol.asyncIterator)
239
+ throw new TypeError("Symbol.asyncIterator is not defined.");
240
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
241
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
242
+ function verb(n) { if (g[n])
243
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
244
+ function resume(n, v) { try {
245
+ step(g[n](v));
246
+ }
247
+ catch (e) {
248
+ settle(q[0][3], e);
249
+ } }
250
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
251
+ function fulfill(value) { resume("next", value); }
252
+ function reject(value) { resume("throw", value); }
253
+ function settle(f, v) { if (f(v), q.shift(), q.length)
254
+ resume(q[0][0], q[0][1]); }
255
+ }
256
+ function __asyncDelegator(o) {
257
+ var i, p;
258
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
259
+ 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; }
260
+ }
261
+ function __asyncValues(o) {
262
+ if (!Symbol.asyncIterator)
263
+ throw new TypeError("Symbol.asyncIterator is not defined.");
264
+ var m = o[Symbol.asyncIterator], i;
265
+ 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);
266
+ 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); }); }; }
267
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
268
+ }
269
+ function __makeTemplateObject(cooked, raw) {
270
+ if (Object.defineProperty) {
271
+ Object.defineProperty(cooked, "raw", { value: raw });
272
+ }
273
+ else {
274
+ cooked.raw = raw;
275
+ }
276
+ return cooked;
277
+ }
278
+ ;
279
+ var __setModuleDefault = Object.create ? (function (o, v) {
280
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
281
+ }) : function (o, v) {
282
+ o["default"] = v;
283
+ };
284
+ function __importStar(mod) {
285
+ if (mod && mod.__esModule)
286
+ return mod;
287
+ var result = {};
288
+ if (mod != null)
289
+ for (var k in mod)
290
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
291
+ __createBinding(result, mod, k);
292
+ __setModuleDefault(result, mod);
293
+ return result;
294
+ }
295
+ function __importDefault(mod) {
296
+ return (mod && mod.__esModule) ? mod : { default: mod };
297
+ }
298
+ function __classPrivateFieldGet(receiver, privateMap) {
299
+ if (!privateMap.has(receiver)) {
300
+ throw new TypeError("attempted to get private field on non-instance");
301
+ }
302
+ return privateMap.get(receiver);
303
+ }
304
+ function __classPrivateFieldSet(receiver, privateMap, value) {
305
+ if (!privateMap.has(receiver)) {
306
+ throw new TypeError("attempted to set private field on non-instance");
307
+ }
308
+ privateMap.set(receiver, value);
309
+ return value;
310
310
  }
311
311
 
312
- var ComboboxItemTemplateDirective = /** @class */ (function () {
313
- function ComboboxItemTemplateDirective() {
314
- }
315
- return ComboboxItemTemplateDirective;
316
- }());
317
- ComboboxItemTemplateDirective.decorators = [
318
- { type: core.Directive, args: [{
319
- selector: '[sgComboboxItem]',
320
- },] }
312
+ var ComboboxItemTemplateDirective = /** @class */ (function () {
313
+ function ComboboxItemTemplateDirective() {
314
+ }
315
+ return ComboboxItemTemplateDirective;
316
+ }());
317
+ ComboboxItemTemplateDirective.decorators = [
318
+ { type: core.Directive, args: [{
319
+ selector: '[sgComboboxItem]',
320
+ },] }
321
321
  ];
322
322
 
323
- var DropdownItemTemplateDirective = /** @class */ (function () {
324
- function DropdownItemTemplateDirective() {
325
- }
326
- return DropdownItemTemplateDirective;
327
- }());
328
- DropdownItemTemplateDirective.decorators = [
329
- { type: core.Directive, args: [{
330
- selector: '[sgDropdownItem]',
331
- },] }
323
+ var DropdownItemTemplateDirective = /** @class */ (function () {
324
+ function DropdownItemTemplateDirective() {
325
+ }
326
+ return DropdownItemTemplateDirective;
327
+ }());
328
+ DropdownItemTemplateDirective.decorators = [
329
+ { type: core.Directive, args: [{
330
+ selector: '[sgDropdownItem]',
331
+ },] }
332
332
  ];
333
333
 
334
- var DropdownValueTemplateDirective = /** @class */ (function () {
335
- function DropdownValueTemplateDirective() {
336
- }
337
- return DropdownValueTemplateDirective;
338
- }());
339
- DropdownValueTemplateDirective.decorators = [
340
- { type: core.Directive, args: [{
341
- selector: '[sgDropdownValue]',
342
- },] }
334
+ var DropdownValueTemplateDirective = /** @class */ (function () {
335
+ function DropdownValueTemplateDirective() {
336
+ }
337
+ return DropdownValueTemplateDirective;
338
+ }());
339
+ DropdownValueTemplateDirective.decorators = [
340
+ { type: core.Directive, args: [{
341
+ selector: '[sgDropdownValue]',
342
+ },] }
343
343
  ];
344
344
 
345
- var MultiselectItemTemplateDirective = /** @class */ (function () {
346
- function MultiselectItemTemplateDirective() {
347
- }
348
- return MultiselectItemTemplateDirective;
349
- }());
350
- MultiselectItemTemplateDirective.decorators = [
351
- { type: core.Directive, args: [{
352
- selector: '[sgMultiselectItem]',
353
- },] }
345
+ var MultiselectItemTemplateDirective = /** @class */ (function () {
346
+ function MultiselectItemTemplateDirective() {
347
+ }
348
+ return MultiselectItemTemplateDirective;
349
+ }());
350
+ MultiselectItemTemplateDirective.decorators = [
351
+ { type: core.Directive, args: [{
352
+ selector: '[sgMultiselectItem]',
353
+ },] }
354
354
  ];
355
355
 
356
- var MultiselectTagTemplateDirective = /** @class */ (function () {
357
- function MultiselectTagTemplateDirective() {
358
- }
359
- return MultiselectTagTemplateDirective;
360
- }());
361
- MultiselectTagTemplateDirective.decorators = [
362
- { type: core.Directive, args: [{
363
- selector: '[sgMultiselectTag]',
364
- },] }
356
+ var MultiselectTagTemplateDirective = /** @class */ (function () {
357
+ function MultiselectTagTemplateDirective() {
358
+ }
359
+ return MultiselectTagTemplateDirective;
360
+ }());
361
+ MultiselectTagTemplateDirective.decorators = [
362
+ { type: core.Directive, args: [{
363
+ selector: '[sgMultiselectTag]',
364
+ },] }
365
365
  ];
366
366
 
367
- /**
368
- * Toggles CSS classes of kendo-multiselect tag wrapper (kendo-taglist li.k-button),
369
- * so necessary styles could be applied when tag state changes, read only state, for example.
370
- *
371
- * @export
372
- */
373
- var MultiselectTagWrapperDirective = /** @class */ (function () {
374
- function MultiselectTagWrapperDirective(_element) {
375
- this._element = _element;
376
- this._getTagWrapperAttempts = 0;
377
- this._isReadOnly = false;
378
- }
379
- Object.defineProperty(MultiselectTagWrapperDirective.prototype, "isReadOnly", {
380
- get: function () {
381
- return this._isReadOnly;
382
- },
383
- set: function (isReadOnly) {
384
- // Will come as undefined if not set from the outside.
385
- this._isReadOnly = !!isReadOnly;
386
- this._tagWrapper = this._tagWrapper || this._getTagWrapper(this._element.nativeElement);
387
- this._setCssClass(this._tagWrapper);
388
- },
389
- enumerable: false,
390
- configurable: true
391
- });
392
- MultiselectTagWrapperDirective.prototype._getTagWrapper = function (element) {
393
- if (element.classList.contains('k-button') && element.tagName === 'LI') {
394
- return element;
395
- }
396
- else {
397
- if (this._getTagWrapperAttempts >= 5) {
398
- return null;
399
- }
400
- this._getTagWrapperAttempts++;
401
- return this._getTagWrapper(element.parentElement);
402
- }
403
- };
404
- MultiselectTagWrapperDirective.prototype._setCssClass = function (tagWrapper) {
405
- if (!tagWrapper) {
406
- return;
407
- }
408
- if (this.isReadOnly) {
409
- tagWrapper.classList.add('sg-multiselect__tag-wrapper--is-read-only');
410
- }
411
- else {
412
- tagWrapper.classList.remove('sg-multiselect__tag-wrapper--is-read-only');
413
- }
414
- };
415
- return MultiselectTagWrapperDirective;
416
- }());
417
- MultiselectTagWrapperDirective.decorators = [
418
- { type: core.Directive, args: [{
419
- selector: '[sgMultiselectTagWrapper]',
420
- exportAs: 'multiselectTagWrapper',
421
- },] }
422
- ];
423
- MultiselectTagWrapperDirective.ctorParameters = function () { return [
424
- { type: core.ElementRef }
425
- ]; };
426
- MultiselectTagWrapperDirective.propDecorators = {
427
- isReadOnly: [{ type: core.Input }]
367
+ /**
368
+ * Toggles CSS classes of kendo-multiselect tag wrapper (kendo-taglist li.k-button),
369
+ * so necessary styles could be applied when tag state changes, read only state, for example.
370
+ *
371
+ * @export
372
+ */
373
+ var MultiselectTagWrapperDirective = /** @class */ (function () {
374
+ function MultiselectTagWrapperDirective(_element) {
375
+ this._element = _element;
376
+ this._getTagWrapperAttempts = 0;
377
+ this._isReadOnly = false;
378
+ }
379
+ Object.defineProperty(MultiselectTagWrapperDirective.prototype, "isReadOnly", {
380
+ get: function () {
381
+ return this._isReadOnly;
382
+ },
383
+ set: function (isReadOnly) {
384
+ // Will come as undefined if not set from the outside.
385
+ this._isReadOnly = !!isReadOnly;
386
+ this._tagWrapper = this._tagWrapper || this._getTagWrapper(this._element.nativeElement);
387
+ this._setCssClass(this._tagWrapper);
388
+ },
389
+ enumerable: false,
390
+ configurable: true
391
+ });
392
+ MultiselectTagWrapperDirective.prototype._getTagWrapper = function (element) {
393
+ if (element.classList.contains('k-button') && element.tagName === 'LI') {
394
+ return element;
395
+ }
396
+ else {
397
+ if (this._getTagWrapperAttempts >= 5) {
398
+ return null;
399
+ }
400
+ this._getTagWrapperAttempts++;
401
+ return this._getTagWrapper(element.parentElement);
402
+ }
403
+ };
404
+ MultiselectTagWrapperDirective.prototype._setCssClass = function (tagWrapper) {
405
+ if (!tagWrapper) {
406
+ return;
407
+ }
408
+ if (this.isReadOnly) {
409
+ tagWrapper.classList.add('sg-multiselect__tag-wrapper--is-read-only');
410
+ }
411
+ else {
412
+ tagWrapper.classList.remove('sg-multiselect__tag-wrapper--is-read-only');
413
+ }
414
+ };
415
+ return MultiselectTagWrapperDirective;
416
+ }());
417
+ MultiselectTagWrapperDirective.decorators = [
418
+ { type: core.Directive, args: [{
419
+ selector: '[sgMultiselectTagWrapper]',
420
+ exportAs: 'multiselectTagWrapper',
421
+ },] }
422
+ ];
423
+ MultiselectTagWrapperDirective.ctorParameters = function () { return [
424
+ { type: core.ElementRef }
425
+ ]; };
426
+ MultiselectTagWrapperDirective.propDecorators = {
427
+ isReadOnly: [{ type: core.Input }]
428
428
  };
429
429
 
430
- var AbstractDropdownComponent = /** @class */ (function (_super) {
431
- __extends(AbstractDropdownComponent, _super);
432
- function AbstractDropdownComponent(_changeDetectorRef) {
433
- var _this = _super.call(this) || this;
434
- _this._changeDetectorRef = _changeDetectorRef;
435
- _this._valueField = 'id';
436
- _this._textField = 'name';
437
- _this._items = [];
438
- _this._isOpen = new rxjs.BehaviorSubject({
439
- isOpen: false,
440
- shouldEmit: false,
441
- });
442
- _this._isLoading = new rxjs.BehaviorSubject(false);
443
- _this._type = null;
444
- _this._state = null;
445
- _this._isSuccessType = _this._type === marcuraCommon.ControlType.Success;
446
- _this._isErrorType = _this._type === marcuraCommon.ControlType.Error;
447
- _this._isWarningType = _this._type === marcuraCommon.ControlType.Warning;
448
- _this._isHighlightedState = _this._state === marcuraCommon.ControlState.Highlighted;
449
- _this.valueFormControl = new forms.FormControl();
450
- _this.hasReset = true;
451
- _this.listHeight = 200;
452
- _this.isPrimitiveValue = false;
453
- _this.isOutline = false;
454
- _this.opened = new core.EventEmitter();
455
- _this.closed = new core.EventEmitter();
456
- return _this;
457
- }
458
- Object.defineProperty(AbstractDropdownComponent.prototype, "valueField", {
459
- get: function () {
460
- return this._valueField;
461
- },
462
- set: function (valueField) {
463
- if (valueField && this._valueField !== valueField) {
464
- this._valueField = valueField;
465
- }
466
- },
467
- enumerable: false,
468
- configurable: true
469
- });
470
- Object.defineProperty(AbstractDropdownComponent.prototype, "textField", {
471
- get: function () {
472
- return this._textField;
473
- },
474
- set: function (textField) {
475
- if (textField && this._textField !== textField) {
476
- this._textField = textField;
477
- }
478
- },
479
- enumerable: false,
480
- configurable: true
481
- });
482
- Object.defineProperty(AbstractDropdownComponent.prototype, "isLoading", {
483
- get: function () {
484
- return this._isLoading.value;
485
- },
486
- set: function (isLoading) {
487
- this._isLoading.next(isLoading);
488
- // Mark hasIsLoadingCssClass @HostBinding for check.
489
- this._changeDetectorRef.markForCheck();
490
- },
491
- enumerable: false,
492
- configurable: true
493
- });
494
- Object.defineProperty(AbstractDropdownComponent.prototype, "state", {
495
- get: function () {
496
- return this._state;
497
- },
498
- set: function (state) {
499
- if (this._state !== state) {
500
- this._state = state;
501
- this._isHighlightedState = state === marcuraCommon.ControlState.Highlighted;
502
- this._changeDetectorRef.markForCheck();
503
- }
504
- },
505
- enumerable: false,
506
- configurable: true
507
- });
508
- Object.defineProperty(AbstractDropdownComponent.prototype, "type", {
509
- get: function () {
510
- return this._type;
511
- },
512
- set: function (type) {
513
- if (this._type !== type) {
514
- this._type = type;
515
- this._isSuccessType = type === marcuraCommon.ControlType.Success;
516
- this._isErrorType = type === marcuraCommon.ControlType.Error;
517
- this._isWarningType = type === marcuraCommon.ControlType.Warning;
518
- this._changeDetectorRef.markForCheck();
519
- }
520
- },
521
- enumerable: false,
522
- configurable: true
523
- });
524
- Object.defineProperty(AbstractDropdownComponent.prototype, "items", {
525
- get: function () {
526
- return this._items;
527
- },
528
- set: function (items) {
529
- this._items = items || [];
530
- },
531
- enumerable: false,
532
- configurable: true
533
- });
534
- Object.defineProperty(AbstractDropdownComponent.prototype, "isOpen", {
535
- get: function () {
536
- return this._isOpen.value.isOpen;
537
- },
538
- enumerable: false,
539
- configurable: true
540
- });
541
- AbstractDropdownComponent.prototype._setComponent = function (component) {
542
- this._component = component;
543
- };
544
- AbstractDropdownComponent.prototype._emitChanged = function (value) { };
545
- AbstractDropdownComponent.prototype._reset = function () {
546
- var hasValueChanged = this.hasValueChanged(this.defaultValue);
547
- if (hasValueChanged) {
548
- this.writeValue(this.defaultValue);
549
- this.formControl.reset(this.defaultValue);
550
- this.valueFormControl.reset(this.defaultValue);
551
- this._component.reset();
552
- this._emitChanged(this.defaultValue);
553
- }
554
- else {
555
- this.formControl.markAsPristine();
556
- this.formControl.markAsUntouched();
557
- this.valueFormControl.reset(this.defaultValue);
558
- this._component.reset();
559
- }
560
- };
561
- AbstractDropdownComponent.prototype.init = function () {
562
- var _this = this;
563
- this._observer.listen(this._isDisabled, function (isDisabled) {
564
- if (isDisabled) {
565
- _this.valueFormControl.disable();
566
- }
567
- else {
568
- _this.valueFormControl.enable();
569
- }
570
- });
571
- };
572
- AbstractDropdownComponent.prototype.open = function (shouldEmitEvent) {
573
- if (shouldEmitEvent === void 0) { shouldEmitEvent = true; }
574
- this._component.toggle(true);
575
- this._isOpen.next({ isOpen: true, shouldEmit: shouldEmitEvent });
576
- };
577
- AbstractDropdownComponent.prototype.close = function (shouldEmitEvent) {
578
- if (shouldEmitEvent === void 0) { shouldEmitEvent = true; }
579
- this._component.toggle(false);
580
- this._isOpen.next({ isOpen: false, shouldEmit: shouldEmitEvent });
581
- };
582
- AbstractDropdownComponent.prototype.toggle = function (shouldEmitEvent) {
583
- if (shouldEmitEvent === void 0) { shouldEmitEvent = true; }
584
- if (this._isOpen) {
585
- this.close(shouldEmitEvent);
586
- }
587
- else {
588
- this.open(shouldEmitEvent);
589
- }
590
- };
591
- AbstractDropdownComponent.prototype.focus = function () {
592
- this._component.focus();
593
- };
594
- AbstractDropdownComponent.prototype.blur = function () {
595
- this._component.blur();
596
- };
597
- AbstractDropdownComponent.prototype.onOpened = function () {
598
- this._isOpen.next({ isOpen: true, shouldEmit: true });
599
- };
600
- AbstractDropdownComponent.prototype.onClosed = function () {
601
- this._isOpen.next({ isOpen: false, shouldEmit: true });
602
- };
603
- AbstractDropdownComponent.prototype.onFocused = function () {
604
- this.focused.emit();
605
- };
606
- AbstractDropdownComponent.prototype.onBlurred = function () {
607
- this.blurred.emit(new marcuraCommon.ControlBlurredEvent(this.value, this._resetedValue || this._focusedValue, this.hasValueChanged(this._resetedValue || this._focusedValue)));
608
- this._resetedValue = null;
609
- };
610
- AbstractDropdownComponent.prototype.onChanged = function (value) {
611
- value = value === undefined ? this.defaultValue : value;
612
- this.value = value;
613
- this.propagateChanged(value);
614
- this.propagateTouched();
615
- this._emitChanged(value);
616
- };
617
- AbstractDropdownComponent.prototype.onResetClicked = function () {
618
- if (!this.hasReset) {
619
- return;
620
- }
621
- this._resetedValue = this.value;
622
- this.focus();
623
- this._reset();
624
- this.open();
625
- };
626
- AbstractDropdownComponent.prototype.writeValue = function (value) {
627
- // CSS class @HostBindings aren't updated with OnPush change detection strategy,
628
- // and are to be marked for check.
629
- this._changeDetectorRef.markForCheck();
630
- this.valueFormControl.setValue(value);
631
- _super.prototype.writeValue.call(this, value);
632
- };
633
- AbstractDropdownComponent.prototype.setDisabledState = function (isDisabled) {
634
- _super.prototype.setDisabledState.call(this, isDisabled);
635
- // Mark hasIsDisabledCssClass @HostBinding for check.
636
- this._changeDetectorRef.markForCheck();
637
- };
638
- return AbstractDropdownComponent;
639
- }(marcuraCommon.AbstractControlComponent));
640
- AbstractDropdownComponent.decorators = [
641
- { type: core.Component, args: [{
642
- template: '',
643
- changeDetection: core.ChangeDetectionStrategy.OnPush
644
- },] }
645
- ];
646
- AbstractDropdownComponent.ctorParameters = function () { return [
647
- { type: core.ChangeDetectorRef }
648
- ]; };
649
- AbstractDropdownComponent.propDecorators = {
650
- valueField: [{ type: core.Input }],
651
- textField: [{ type: core.Input }],
652
- placeholder: [{ type: core.Input }],
653
- isLoading: [{ type: core.Input }],
654
- hasReset: [{ type: core.Input }],
655
- popupClass: [{ type: core.Input }],
656
- state: [{ type: core.Input }],
657
- type: [{ type: core.Input }],
658
- items: [{ type: core.Input }],
659
- listHeight: [{ type: core.Input }],
660
- isPrimitiveValue: [{ type: core.Input }],
661
- isOutline: [{ type: core.Input }],
662
- opened: [{ type: core.Output }],
663
- closed: [{ type: core.Output }]
430
+ var AbstractDropdownComponent = /** @class */ (function (_super) {
431
+ __extends(AbstractDropdownComponent, _super);
432
+ function AbstractDropdownComponent(_changeDetectorRef) {
433
+ var _this = _super.call(this) || this;
434
+ _this._changeDetectorRef = _changeDetectorRef;
435
+ _this._valueField = 'id';
436
+ _this._textField = 'name';
437
+ _this._items = [];
438
+ _this._isOpen = new rxjs.BehaviorSubject({
439
+ isOpen: false,
440
+ shouldEmit: false,
441
+ });
442
+ _this._isLoading = new rxjs.BehaviorSubject(false);
443
+ _this._type = null;
444
+ _this._state = null;
445
+ _this._isSuccessType = _this._type === marcuraCommon.ControlType.Success;
446
+ _this._isErrorType = _this._type === marcuraCommon.ControlType.Error;
447
+ _this._isWarningType = _this._type === marcuraCommon.ControlType.Warning;
448
+ _this._isHighlightedState = _this._state === marcuraCommon.ControlState.Highlighted;
449
+ _this.valueFormControl = new forms.FormControl();
450
+ _this.hasReset = true;
451
+ _this.listHeight = 200;
452
+ _this.isPrimitiveValue = false;
453
+ _this.isOutline = false;
454
+ _this.opened = new core.EventEmitter();
455
+ _this.closed = new core.EventEmitter();
456
+ return _this;
457
+ }
458
+ Object.defineProperty(AbstractDropdownComponent.prototype, "valueField", {
459
+ get: function () {
460
+ return this._valueField;
461
+ },
462
+ set: function (valueField) {
463
+ if (valueField && this._valueField !== valueField) {
464
+ this._valueField = valueField;
465
+ }
466
+ },
467
+ enumerable: false,
468
+ configurable: true
469
+ });
470
+ Object.defineProperty(AbstractDropdownComponent.prototype, "textField", {
471
+ get: function () {
472
+ return this._textField;
473
+ },
474
+ set: function (textField) {
475
+ if (textField && this._textField !== textField) {
476
+ this._textField = textField;
477
+ }
478
+ },
479
+ enumerable: false,
480
+ configurable: true
481
+ });
482
+ Object.defineProperty(AbstractDropdownComponent.prototype, "isLoading", {
483
+ get: function () {
484
+ return this._isLoading.value;
485
+ },
486
+ set: function (isLoading) {
487
+ this._isLoading.next(isLoading);
488
+ // Mark hasIsLoadingCssClass @HostBinding for check.
489
+ this._changeDetectorRef.markForCheck();
490
+ },
491
+ enumerable: false,
492
+ configurable: true
493
+ });
494
+ Object.defineProperty(AbstractDropdownComponent.prototype, "state", {
495
+ get: function () {
496
+ return this._state;
497
+ },
498
+ set: function (state) {
499
+ if (this._state !== state) {
500
+ this._state = state;
501
+ this._isHighlightedState = state === marcuraCommon.ControlState.Highlighted;
502
+ this._changeDetectorRef.markForCheck();
503
+ }
504
+ },
505
+ enumerable: false,
506
+ configurable: true
507
+ });
508
+ Object.defineProperty(AbstractDropdownComponent.prototype, "type", {
509
+ get: function () {
510
+ return this._type;
511
+ },
512
+ set: function (type) {
513
+ if (this._type !== type) {
514
+ this._type = type;
515
+ this._isSuccessType = type === marcuraCommon.ControlType.Success;
516
+ this._isErrorType = type === marcuraCommon.ControlType.Error;
517
+ this._isWarningType = type === marcuraCommon.ControlType.Warning;
518
+ this._changeDetectorRef.markForCheck();
519
+ }
520
+ },
521
+ enumerable: false,
522
+ configurable: true
523
+ });
524
+ Object.defineProperty(AbstractDropdownComponent.prototype, "items", {
525
+ get: function () {
526
+ return this._items;
527
+ },
528
+ set: function (items) {
529
+ this._items = items || [];
530
+ },
531
+ enumerable: false,
532
+ configurable: true
533
+ });
534
+ Object.defineProperty(AbstractDropdownComponent.prototype, "isOpen", {
535
+ get: function () {
536
+ return this._isOpen.value.isOpen;
537
+ },
538
+ enumerable: false,
539
+ configurable: true
540
+ });
541
+ AbstractDropdownComponent.prototype._setComponent = function (component) {
542
+ this._component = component;
543
+ };
544
+ AbstractDropdownComponent.prototype._emitChanged = function (value) { };
545
+ AbstractDropdownComponent.prototype._reset = function () {
546
+ var hasValueChanged = this.hasValueChanged(this.defaultValue);
547
+ if (hasValueChanged) {
548
+ this.writeValue(this.defaultValue);
549
+ this.formControl.reset(this.defaultValue);
550
+ this.valueFormControl.reset(this.defaultValue);
551
+ this._component.reset();
552
+ this._emitChanged(this.defaultValue);
553
+ }
554
+ else {
555
+ this.formControl.markAsPristine();
556
+ this.formControl.markAsUntouched();
557
+ this.valueFormControl.reset(this.defaultValue);
558
+ this._component.reset();
559
+ }
560
+ };
561
+ AbstractDropdownComponent.prototype.init = function () {
562
+ var _this = this;
563
+ this._observer.listen(this._isDisabled, function (isDisabled) {
564
+ if (isDisabled) {
565
+ _this.valueFormControl.disable();
566
+ }
567
+ else {
568
+ _this.valueFormControl.enable();
569
+ }
570
+ });
571
+ };
572
+ AbstractDropdownComponent.prototype.open = function (shouldEmitEvent) {
573
+ if (shouldEmitEvent === void 0) { shouldEmitEvent = true; }
574
+ this._component.toggle(true);
575
+ this._isOpen.next({ isOpen: true, shouldEmit: shouldEmitEvent });
576
+ };
577
+ AbstractDropdownComponent.prototype.close = function (shouldEmitEvent) {
578
+ if (shouldEmitEvent === void 0) { shouldEmitEvent = true; }
579
+ this._component.toggle(false);
580
+ this._isOpen.next({ isOpen: false, shouldEmit: shouldEmitEvent });
581
+ };
582
+ AbstractDropdownComponent.prototype.toggle = function (shouldEmitEvent) {
583
+ if (shouldEmitEvent === void 0) { shouldEmitEvent = true; }
584
+ if (this._isOpen) {
585
+ this.close(shouldEmitEvent);
586
+ }
587
+ else {
588
+ this.open(shouldEmitEvent);
589
+ }
590
+ };
591
+ AbstractDropdownComponent.prototype.focus = function () {
592
+ this._component.focus();
593
+ };
594
+ AbstractDropdownComponent.prototype.blur = function () {
595
+ this._component.blur();
596
+ };
597
+ AbstractDropdownComponent.prototype.onOpened = function () {
598
+ this._isOpen.next({ isOpen: true, shouldEmit: true });
599
+ };
600
+ AbstractDropdownComponent.prototype.onClosed = function () {
601
+ this._isOpen.next({ isOpen: false, shouldEmit: true });
602
+ };
603
+ AbstractDropdownComponent.prototype.onFocused = function () {
604
+ this.focused.emit();
605
+ };
606
+ AbstractDropdownComponent.prototype.onBlurred = function () {
607
+ this.blurred.emit(new marcuraCommon.ControlBlurredEvent(this.value, this._resetedValue || this._focusedValue, this.hasValueChanged(this._resetedValue || this._focusedValue)));
608
+ this._resetedValue = null;
609
+ };
610
+ AbstractDropdownComponent.prototype.onChanged = function (value) {
611
+ value = value === undefined ? this.defaultValue : value;
612
+ this.value = value;
613
+ this.propagateChanged(value);
614
+ this.propagateTouched();
615
+ this._emitChanged(value);
616
+ };
617
+ AbstractDropdownComponent.prototype.onResetClicked = function () {
618
+ if (!this.hasReset) {
619
+ return;
620
+ }
621
+ this._resetedValue = this.value;
622
+ this.focus();
623
+ this._reset();
624
+ this.open();
625
+ };
626
+ AbstractDropdownComponent.prototype.writeValue = function (value) {
627
+ // CSS class @HostBindings aren't updated with OnPush change detection strategy,
628
+ // and are to be marked for check.
629
+ this._changeDetectorRef.markForCheck();
630
+ this.valueFormControl.setValue(value);
631
+ _super.prototype.writeValue.call(this, value);
632
+ };
633
+ AbstractDropdownComponent.prototype.setDisabledState = function (isDisabled) {
634
+ _super.prototype.setDisabledState.call(this, isDisabled);
635
+ // Mark hasIsDisabledCssClass @HostBinding for check.
636
+ this._changeDetectorRef.markForCheck();
637
+ };
638
+ return AbstractDropdownComponent;
639
+ }(marcuraCommon.AbstractControlComponent));
640
+ AbstractDropdownComponent.decorators = [
641
+ { type: core.Component, args: [{
642
+ template: '',
643
+ changeDetection: core.ChangeDetectionStrategy.OnPush
644
+ },] }
645
+ ];
646
+ AbstractDropdownComponent.ctorParameters = function () { return [
647
+ { type: core.ChangeDetectorRef }
648
+ ]; };
649
+ AbstractDropdownComponent.propDecorators = {
650
+ valueField: [{ type: core.Input }],
651
+ textField: [{ type: core.Input }],
652
+ placeholder: [{ type: core.Input }],
653
+ isLoading: [{ type: core.Input }],
654
+ hasReset: [{ type: core.Input }],
655
+ popupClass: [{ type: core.Input }],
656
+ state: [{ type: core.Input }],
657
+ type: [{ type: core.Input }],
658
+ items: [{ type: core.Input }],
659
+ listHeight: [{ type: core.Input }],
660
+ isPrimitiveValue: [{ type: core.Input }],
661
+ isOutline: [{ type: core.Input }],
662
+ opened: [{ type: core.Output }],
663
+ closed: [{ type: core.Output }]
664
664
  };
665
665
 
666
- (function (ComboboxSearchSettingsOperator) {
667
- ComboboxSearchSettingsOperator["Contains"] = "contains";
668
- ComboboxSearchSettingsOperator["StartsWith"] = "startsWith";
666
+ (function (ComboboxSearchSettingsOperator) {
667
+ ComboboxSearchSettingsOperator["Contains"] = "contains";
668
+ ComboboxSearchSettingsOperator["StartsWith"] = "startsWith";
669
669
  })(exports.ComboboxSearchSettingsOperator || (exports.ComboboxSearchSettingsOperator = {}));
670
670
 
671
- var AbstractComboboxComponent = /** @class */ (function (_super) {
672
- __extends(AbstractComboboxComponent, _super);
673
- function AbstractComboboxComponent(changeDetectorRef, _renderer) {
674
- var _this = _super.call(this, changeDetectorRef) || this;
675
- _this._renderer = _renderer;
676
- _this._debounceTime = 500;
677
- _this._debounceObserver = new marcuraCommon.Observer();
678
- _this._worker = new marcuraCommon.Worker();
679
- _this._additionalItems = new rxjs.BehaviorSubject([]);
680
- _this._valueNormalizerItems = [];
681
- _this._isSync = false;
682
- _this._loadedItems = new rxjs.BehaviorSubject([]);
683
- _this._hasSearched = new rxjs.BehaviorSubject(false);
684
- _this._isSearching = new rxjs.BehaviorSubject(false);
685
- _this._searchText = new rxjs.BehaviorSubject('');
686
- _this.combinedItems = rxjs.combineLatest([_this._loadedItems, _this._additionalItems]).pipe(operators.map(function (_a) {
687
- var _b = __read(_a, 2), items = _b[0], additionalItems = _b[1];
688
- return __spread(items, additionalItems).filter(marcuraCommon.Is.truthy);
689
- }));
690
- _this.isSearchable = true;
691
- _this.minSearchCharacters = 1;
692
- _this.areItemsCached = false;
693
- _this.searchSettings = {
694
- isCaseSensitive: false,
695
- operator: exports.ComboboxSearchSettingsOperator.Contains,
696
- };
697
- _this.isGroupable = false;
698
- _this.searched = new core.EventEmitter();
699
- _this.isNoItemsTextVisible = rxjs.combineLatest([
700
- _this._isSearching,
701
- _this._hasSearched,
702
- _this._isFocused,
703
- _this.combinedItems,
704
- ]).pipe(operators.map(function (_a) {
705
- var _b = __read(_a, 4), isSearching = _b[0], hasSearched = _b[1], isFocused = _b[2], combinedItems = _b[3];
706
- return !isSearching && hasSearched && isFocused && combinedItems.length === 0;
707
- }));
708
- _this.isMinSearchTextVisible = rxjs.combineLatest([
709
- _this._isSearching,
710
- _this._hasSearched,
711
- _this._isFocused,
712
- ]).pipe(operators.map(function (_a) {
713
- var _b = __read(_a, 3), isSearching = _b[0], hasSearched = _b[1], isFocused = _b[2];
714
- return !_this._isSync && !isSearching && !hasSearched && isFocused;
715
- }));
716
- _this.isLoadingSpinnerVisible = rxjs.combineLatest([
717
- _this._isLoading,
718
- _this._isSearching,
719
- ]).pipe(operators.map(function (_a) {
720
- var _b = __read(_a, 2), isLoading = _b[0], isSearching = _b[1];
721
- return isLoading || isSearching;
722
- }));
723
- // To show loading properly we are to use loadedItems as they don't include additionalItems.
724
- _this.isLoadingTextVisible = rxjs.combineLatest([
725
- _this.isLoadingSpinnerVisible,
726
- _this._loadedItems,
727
- ]).pipe(operators.map(function (_a) {
728
- var _b = __read(_a, 2), isLoadingSpinnerVisible = _b[0], loadedItems = _b[1];
729
- return isLoadingSpinnerVisible && loadedItems.length === 0;
730
- }));
731
- _this.loadItems = function (searchText) {
732
- searchText = (searchText || '').trim();
733
- if (_this._isSync) {
734
- _this._hasSearched.next(!!searchText);
735
- _this._loadedItems.next(_this.searchItems(searchText));
736
- }
737
- else {
738
- if (_this.canLoadItems(searchText)) {
739
- _this._isSearching.next(true);
740
- _this._worker.handle(_this.search(searchText), function (items) {
741
- _this._hasSearched.next(true);
742
- _this._loadedItems.next(items);
743
- _this._valueNormalizerItems = __spread(items, _this._additionalItems.value);
744
- _this._isSearching.next(false);
745
- });
746
- }
747
- else {
748
- _this._hasSearched.next(false);
749
- _this._loadedItems.next([]);
750
- _this._valueNormalizerItems = [];
751
- _this._isSearching.next(false);
752
- }
753
- }
754
- };
755
- return _this;
756
- }
757
- Object.defineProperty(AbstractComboboxComponent.prototype, "debounceTime", {
758
- get: function () {
759
- return this._debounceTime;
760
- },
761
- set: function (value) {
762
- this._debounceTime = value;
763
- this._listenToSearched();
764
- },
765
- enumerable: false,
766
- configurable: true
767
- });
768
- Object.defineProperty(AbstractComboboxComponent.prototype, "items", {
769
- get: function () {
770
- return this._items;
771
- },
772
- set: function (items) {
773
- this._isSync = true;
774
- this._items = items || [];
775
- this._listenToSearched();
776
- this._loadedItems.next(this._items);
777
- },
778
- enumerable: false,
779
- configurable: true
780
- });
781
- Object.defineProperty(AbstractComboboxComponent.prototype, "additionalItems", {
782
- get: function () {
783
- return this._additionalItems.value;
784
- },
785
- set: function (additionalItems) {
786
- this._additionalItems.next(additionalItems || []);
787
- },
788
- enumerable: false,
789
- configurable: true
790
- });
791
- AbstractComboboxComponent.prototype._disableChromeAutocomplete = function () {
792
- if (this._component.searchbar && this._component.searchbar.input) {
793
- this._renderer.setAttribute(this._component.searchbar.input.nativeElement, 'autocomplete', 'disabled');
794
- }
795
- };
796
- AbstractComboboxComponent.prototype._listenToSearched = function () {
797
- var _this = this;
798
- this._debounceObserver.clear();
799
- this._debounceObserver.listen(this._searchText.pipe(operators.distinctUntilChanged(), operators.skip(1), operators.tap(function (searchText) {
800
- _this.searched.emit(searchText);
801
- _this._isSearching.next(_this.canLoadItems(searchText) && _this._isOpen.value.isOpen);
802
- }), operators.debounceTime(this._isSync ? 0 : this.debounceTime), operators.filter(function () { return _this._isOpen.value.isOpen; })), this.loadItems);
803
- };
804
- AbstractComboboxComponent.prototype._filterItems = function (items, searchText) {
805
- var _this = this;
806
- if (!items || !items.length) {
807
- return [];
808
- }
809
- return items.filter(function (item) {
810
- var itemText = (item[_this.textField] || '').trim();
811
- itemText = _this.searchSettings.isCaseSensitive ? itemText : itemText.toLowerCase();
812
- return _this.searchSettings.operator === exports.ComboboxSearchSettingsOperator.Contains
813
- ? itemText.indexOf(searchText) !== -1
814
- : itemText.substring(0, searchText.length) === searchText;
815
- });
816
- };
817
- AbstractComboboxComponent.prototype._setComponent = function (component) {
818
- this._component = component;
819
- this._disableChromeAutocomplete();
820
- };
821
- AbstractComboboxComponent.prototype.searchItems = function (searchText) {
822
- var _this = this;
823
- if (!this.searchSettings || !searchText || !this._items.length) {
824
- return this._items;
825
- }
826
- searchText = this.searchSettings.isCaseSensitive ? searchText : searchText.toLowerCase();
827
- if (this.isGroupable) {
828
- var groups = this._items;
829
- var filteredGroups = groups
830
- .map(function (group) {
831
- return {
832
- items: _this._filterItems(group.items, searchText),
833
- aggregates: group.aggregates,
834
- field: group.field,
835
- value: group.value,
836
- };
837
- })
838
- .filter(function (group) { return group.items.length > 0; });
839
- return filteredGroups;
840
- }
841
- return this._filterItems(this._items, searchText);
842
- };
843
- AbstractComboboxComponent.prototype.canLoadItems = function (searchText) {
844
- return searchText.length >= this.minSearchCharacters && !this._isSync;
845
- };
846
- AbstractComboboxComponent.prototype.getItem = function (items, text) {
847
- var _this = this;
848
- return items.find(function (item) { return item[_this.textField].toLowerCase() === text.toLowerCase(); });
849
- };
850
- AbstractComboboxComponent.prototype.isItemEqual = function (item1, item2) {
851
- var isItem1Empty = item1 === null || item1 === undefined;
852
- var isItem2Empty = item2 === null || item2 === undefined;
853
- if (isItem1Empty && isItem2Empty) {
854
- return true;
855
- }
856
- if (isItem1Empty || isItem2Empty) {
857
- return false;
858
- }
859
- return this.isPrimitiveValue ? item1 === item2 : item1[this.valueField] === item2[this.valueField];
860
- };
861
- AbstractComboboxComponent.prototype.ngOnDestroy = function () {
862
- this._debounceObserver.destroy();
863
- this._worker.destroy();
864
- };
865
- AbstractComboboxComponent.prototype.init = function () {
866
- var _this = this;
867
- _super.prototype.init.call(this);
868
- this._listenToSearched();
869
- if (this._isSync) {
870
- this._loadedItems.next(this._items);
871
- }
872
- // Closed.
873
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return !event.isOpen; }), operators.skip(1)), function (event) {
874
- if (!_this.areItemsCached && !_this._isSync) {
875
- _this._loadedItems.next([]);
876
- }
877
- _this._worker.cancel();
878
- _this._isSearching.next(false);
879
- if (event.shouldEmit) {
880
- _this.closed.emit();
881
- }
882
- });
883
- // Blurred.
884
- this._observer.listen(this._isFocused.pipe(operators.filter(marcuraCommon.isFalse)), function () {
885
- // Restore original unfiltered items when the component is blurred
886
- // after some search text entered. Consider a case:
887
- // 1. Search with text that gives 0 items.
888
- // 2. Blur and focus.
889
- // 3. Search text is cleared, but items remain empty, so the list won't show up.
890
- _this._loadedItems.next(_this._items);
891
- _this._hasSearched.next(false);
892
- });
893
- };
894
- AbstractComboboxComponent.prototype.onSearched = function (searchText) {
895
- this._searchText.next(searchText);
896
- };
897
- return AbstractComboboxComponent;
898
- }(AbstractDropdownComponent));
899
- AbstractComboboxComponent.decorators = [
900
- { type: core.Component, args: [{
901
- template: '',
902
- changeDetection: core.ChangeDetectionStrategy.OnPush
903
- },] }
904
- ];
905
- AbstractComboboxComponent.ctorParameters = function () { return [
906
- { type: core.ChangeDetectorRef },
907
- { type: core.Renderer2 }
908
- ]; };
909
- AbstractComboboxComponent.propDecorators = {
910
- isSearchable: [{ type: core.Input }],
911
- minSearchCharacters: [{ type: core.Input }],
912
- search: [{ type: core.Input }],
913
- areItemsCached: [{ type: core.Input }],
914
- debounceTime: [{ type: core.Input }],
915
- items: [{ type: core.Input }],
916
- additionalItems: [{ type: core.Input }],
917
- searchSettings: [{ type: core.Input }],
918
- isGroupable: [{ type: core.Input }],
919
- searched: [{ type: core.Output }]
671
+ var AbstractComboboxComponent = /** @class */ (function (_super) {
672
+ __extends(AbstractComboboxComponent, _super);
673
+ function AbstractComboboxComponent(changeDetectorRef, _renderer) {
674
+ var _this = _super.call(this, changeDetectorRef) || this;
675
+ _this._renderer = _renderer;
676
+ _this._debounceTime = 500;
677
+ _this._debounceObserver = new marcuraCommon.Observer();
678
+ _this._worker = new marcuraCommon.Worker();
679
+ _this._additionalItems = new rxjs.BehaviorSubject([]);
680
+ _this._valueNormalizerItems = [];
681
+ _this._isSync = false;
682
+ _this._loadedItems = new rxjs.BehaviorSubject([]);
683
+ _this._hasSearched = new rxjs.BehaviorSubject(false);
684
+ _this._isSearching = new rxjs.BehaviorSubject(false);
685
+ _this._searchText = new rxjs.BehaviorSubject('');
686
+ _this.combinedItems = rxjs.combineLatest([_this._loadedItems, _this._additionalItems]).pipe(operators.map(function (_a) {
687
+ var _b = __read(_a, 2), items = _b[0], additionalItems = _b[1];
688
+ return __spread(items, additionalItems).filter(marcuraCommon.Is.truthy);
689
+ }));
690
+ _this.isSearchable = true;
691
+ _this.minSearchCharacters = 1;
692
+ _this.areItemsCached = false;
693
+ _this.searchSettings = {
694
+ isCaseSensitive: false,
695
+ operator: exports.ComboboxSearchSettingsOperator.Contains,
696
+ };
697
+ _this.isGroupable = false;
698
+ _this.searched = new core.EventEmitter();
699
+ _this.isNoItemsTextVisible = rxjs.combineLatest([
700
+ _this._isSearching,
701
+ _this._hasSearched,
702
+ _this._isFocused,
703
+ _this.combinedItems,
704
+ ]).pipe(operators.map(function (_a) {
705
+ var _b = __read(_a, 4), isSearching = _b[0], hasSearched = _b[1], isFocused = _b[2], combinedItems = _b[3];
706
+ return !isSearching && hasSearched && isFocused && combinedItems.length === 0;
707
+ }));
708
+ _this.isMinSearchTextVisible = rxjs.combineLatest([
709
+ _this._isSearching,
710
+ _this._hasSearched,
711
+ _this._isFocused,
712
+ ]).pipe(operators.map(function (_a) {
713
+ var _b = __read(_a, 3), isSearching = _b[0], hasSearched = _b[1], isFocused = _b[2];
714
+ return !_this._isSync && !isSearching && !hasSearched && isFocused;
715
+ }));
716
+ _this.isLoadingSpinnerVisible = rxjs.combineLatest([
717
+ _this._isLoading,
718
+ _this._isSearching,
719
+ ]).pipe(operators.map(function (_a) {
720
+ var _b = __read(_a, 2), isLoading = _b[0], isSearching = _b[1];
721
+ return isLoading || isSearching;
722
+ }));
723
+ // To show loading properly we are to use loadedItems as they don't include additionalItems.
724
+ _this.isLoadingTextVisible = rxjs.combineLatest([
725
+ _this.isLoadingSpinnerVisible,
726
+ _this._loadedItems,
727
+ ]).pipe(operators.map(function (_a) {
728
+ var _b = __read(_a, 2), isLoadingSpinnerVisible = _b[0], loadedItems = _b[1];
729
+ return isLoadingSpinnerVisible && loadedItems.length === 0;
730
+ }));
731
+ _this.loadItems = function (searchText) {
732
+ searchText = (searchText || '').trim();
733
+ if (_this._isSync) {
734
+ _this._hasSearched.next(!!searchText);
735
+ _this._loadedItems.next(_this.searchItems(searchText));
736
+ }
737
+ else {
738
+ if (_this.canLoadItems(searchText)) {
739
+ _this._isSearching.next(true);
740
+ _this._worker.handle(_this.search(searchText), function (items) {
741
+ _this._hasSearched.next(true);
742
+ _this._loadedItems.next(items);
743
+ _this._valueNormalizerItems = __spread(items, _this._additionalItems.value);
744
+ _this._isSearching.next(false);
745
+ });
746
+ }
747
+ else {
748
+ _this._hasSearched.next(false);
749
+ _this._loadedItems.next([]);
750
+ _this._valueNormalizerItems = [];
751
+ _this._isSearching.next(false);
752
+ }
753
+ }
754
+ };
755
+ return _this;
756
+ }
757
+ Object.defineProperty(AbstractComboboxComponent.prototype, "debounceTime", {
758
+ get: function () {
759
+ return this._debounceTime;
760
+ },
761
+ set: function (value) {
762
+ this._debounceTime = value;
763
+ this._listenToSearched();
764
+ },
765
+ enumerable: false,
766
+ configurable: true
767
+ });
768
+ Object.defineProperty(AbstractComboboxComponent.prototype, "items", {
769
+ get: function () {
770
+ return this._items;
771
+ },
772
+ set: function (items) {
773
+ this._isSync = true;
774
+ this._items = items || [];
775
+ this._listenToSearched();
776
+ this._loadedItems.next(this._items);
777
+ },
778
+ enumerable: false,
779
+ configurable: true
780
+ });
781
+ Object.defineProperty(AbstractComboboxComponent.prototype, "additionalItems", {
782
+ get: function () {
783
+ return this._additionalItems.value;
784
+ },
785
+ set: function (additionalItems) {
786
+ this._additionalItems.next(additionalItems || []);
787
+ },
788
+ enumerable: false,
789
+ configurable: true
790
+ });
791
+ AbstractComboboxComponent.prototype._disableChromeAutocomplete = function () {
792
+ if (this._component.searchbar && this._component.searchbar.input) {
793
+ this._renderer.setAttribute(this._component.searchbar.input.nativeElement, 'autocomplete', 'disabled');
794
+ }
795
+ };
796
+ AbstractComboboxComponent.prototype._listenToSearched = function () {
797
+ var _this = this;
798
+ this._debounceObserver.clear();
799
+ this._debounceObserver.listen(this._searchText.pipe(operators.distinctUntilChanged(), operators.skip(1), operators.tap(function (searchText) {
800
+ _this.searched.emit(searchText);
801
+ _this._isSearching.next(_this.canLoadItems(searchText) && _this._isOpen.value.isOpen);
802
+ }), operators.debounceTime(this._isSync ? 0 : this.debounceTime), operators.filter(function () { return _this._isOpen.value.isOpen; })), this.loadItems);
803
+ };
804
+ AbstractComboboxComponent.prototype._filterItems = function (items, searchText) {
805
+ var _this = this;
806
+ if (!items || !items.length) {
807
+ return [];
808
+ }
809
+ return items.filter(function (item) {
810
+ var itemText = (item[_this.textField] || '').trim();
811
+ itemText = _this.searchSettings.isCaseSensitive ? itemText : itemText.toLowerCase();
812
+ return _this.searchSettings.operator === exports.ComboboxSearchSettingsOperator.Contains
813
+ ? itemText.indexOf(searchText) !== -1
814
+ : itemText.substring(0, searchText.length) === searchText;
815
+ });
816
+ };
817
+ AbstractComboboxComponent.prototype._setComponent = function (component) {
818
+ this._component = component;
819
+ this._disableChromeAutocomplete();
820
+ };
821
+ AbstractComboboxComponent.prototype.searchItems = function (searchText) {
822
+ var _this = this;
823
+ if (!this.searchSettings || !searchText || !this._items.length) {
824
+ return this._items;
825
+ }
826
+ searchText = this.searchSettings.isCaseSensitive ? searchText : searchText.toLowerCase();
827
+ if (this.isGroupable) {
828
+ var groups = this._items;
829
+ var filteredGroups = groups
830
+ .map(function (group) {
831
+ return {
832
+ items: _this._filterItems(group.items, searchText),
833
+ aggregates: group.aggregates,
834
+ field: group.field,
835
+ value: group.value,
836
+ };
837
+ })
838
+ .filter(function (group) { return group.items.length > 0; });
839
+ return filteredGroups;
840
+ }
841
+ return this._filterItems(this._items, searchText);
842
+ };
843
+ AbstractComboboxComponent.prototype.canLoadItems = function (searchText) {
844
+ return searchText.length >= this.minSearchCharacters && !this._isSync;
845
+ };
846
+ AbstractComboboxComponent.prototype.getItem = function (items, text) {
847
+ var _this = this;
848
+ return items.find(function (item) { return item[_this.textField].toLowerCase() === text.toLowerCase(); });
849
+ };
850
+ AbstractComboboxComponent.prototype.isItemEqual = function (item1, item2) {
851
+ var isItem1Empty = item1 === null || item1 === undefined;
852
+ var isItem2Empty = item2 === null || item2 === undefined;
853
+ if (isItem1Empty && isItem2Empty) {
854
+ return true;
855
+ }
856
+ if (isItem1Empty || isItem2Empty) {
857
+ return false;
858
+ }
859
+ return this.isPrimitiveValue ? item1 === item2 : item1[this.valueField] === item2[this.valueField];
860
+ };
861
+ AbstractComboboxComponent.prototype.ngOnDestroy = function () {
862
+ this._debounceObserver.destroy();
863
+ this._worker.destroy();
864
+ };
865
+ AbstractComboboxComponent.prototype.init = function () {
866
+ var _this = this;
867
+ _super.prototype.init.call(this);
868
+ this._listenToSearched();
869
+ if (this._isSync) {
870
+ this._loadedItems.next(this._items);
871
+ }
872
+ // Closed.
873
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return !event.isOpen; }), operators.skip(1)), function (event) {
874
+ if (!_this.areItemsCached && !_this._isSync) {
875
+ _this._loadedItems.next([]);
876
+ }
877
+ _this._worker.cancel();
878
+ _this._isSearching.next(false);
879
+ if (event.shouldEmit) {
880
+ _this.closed.emit();
881
+ }
882
+ });
883
+ // Blurred.
884
+ this._observer.listen(this._isFocused.pipe(operators.filter(marcuraCommon.isFalse)), function () {
885
+ // Restore original unfiltered items when the component is blurred
886
+ // after some search text entered. Consider a case:
887
+ // 1. Search with text that gives 0 items.
888
+ // 2. Blur and focus.
889
+ // 3. Search text is cleared, but items remain empty, so the list won't show up.
890
+ _this._loadedItems.next(_this._items);
891
+ _this._hasSearched.next(false);
892
+ });
893
+ };
894
+ AbstractComboboxComponent.prototype.onSearched = function (searchText) {
895
+ this._searchText.next(searchText);
896
+ };
897
+ return AbstractComboboxComponent;
898
+ }(AbstractDropdownComponent));
899
+ AbstractComboboxComponent.decorators = [
900
+ { type: core.Component, args: [{
901
+ template: '',
902
+ changeDetection: core.ChangeDetectionStrategy.OnPush
903
+ },] }
904
+ ];
905
+ AbstractComboboxComponent.ctorParameters = function () { return [
906
+ { type: core.ChangeDetectorRef },
907
+ { type: core.Renderer2 }
908
+ ]; };
909
+ AbstractComboboxComponent.propDecorators = {
910
+ isSearchable: [{ type: core.Input }],
911
+ minSearchCharacters: [{ type: core.Input }],
912
+ search: [{ type: core.Input }],
913
+ areItemsCached: [{ type: core.Input }],
914
+ debounceTime: [{ type: core.Input }],
915
+ items: [{ type: core.Input }],
916
+ additionalItems: [{ type: core.Input }],
917
+ searchSettings: [{ type: core.Input }],
918
+ isGroupable: [{ type: core.Input }],
919
+ searched: [{ type: core.Output }]
920
920
  };
921
921
 
922
- var ComboboxPopupFooterComponent = /** @class */ (function () {
923
- function ComboboxPopupFooterComponent() {
924
- this.isLoadingTextVisible = false;
925
- this.isNoItemsTextVisible = false;
926
- this.isMinSearchTextVisible = false;
927
- }
928
- ComboboxPopupFooterComponent.prototype.getMinSearchText = function () {
929
- return this.minSearchText.replace('{minSearchCharacters}', this.minSearchCharacters.toString());
930
- };
931
- return ComboboxPopupFooterComponent;
932
- }());
933
- ComboboxPopupFooterComponent.decorators = [
934
- { type: core.Component, args: [{
935
- selector: 'sg-combobox-popup-footer',
936
- template: "<div\n class=\"sg-combobox-popup-footer__inner\"\n *ngIf=\"isLoadingTextVisible || isNoItemsTextVisible || isMinSearchTextVisible\"\n>\n <span *ngIf=\"isLoadingTextVisible\" class=\"c-body c-body--3 u-color--text-05\">{{ loadingText }}</span>\n <span *ngIf=\"isNoItemsTextVisible\" class=\"c-body c-body--3 u-color--text-05\">{{ noItemsText }}</span>\n <span *ngIf=\"isMinSearchTextVisible\" class=\"c-body c-body--3 u-color--text-05\">{{ getMinSearchText() }}</span>\n</div>\n"
937
- },] }
938
- ];
939
- ComboboxPopupFooterComponent.propDecorators = {
940
- isLoadingTextVisible: [{ type: core.Input }],
941
- isNoItemsTextVisible: [{ type: core.Input }],
942
- isMinSearchTextVisible: [{ type: core.Input }],
943
- loadingText: [{ type: core.Input }],
944
- noItemsText: [{ type: core.Input }],
945
- minSearchText: [{ type: core.Input }],
946
- minSearchCharacters: [{ type: core.Input }]
922
+ var ComboboxPopupFooterComponent = /** @class */ (function () {
923
+ function ComboboxPopupFooterComponent() {
924
+ this.isLoadingTextVisible = false;
925
+ this.isNoItemsTextVisible = false;
926
+ this.isMinSearchTextVisible = false;
927
+ }
928
+ ComboboxPopupFooterComponent.prototype.getMinSearchText = function () {
929
+ return this.minSearchText.replace('{minSearchCharacters}', this.minSearchCharacters.toString());
930
+ };
931
+ return ComboboxPopupFooterComponent;
932
+ }());
933
+ ComboboxPopupFooterComponent.decorators = [
934
+ { type: core.Component, args: [{
935
+ selector: 'sg-combobox-popup-footer',
936
+ template: "<div\n class=\"sg-combobox-popup-footer__inner\"\n *ngIf=\"isLoadingTextVisible || isNoItemsTextVisible || isMinSearchTextVisible\"\n>\n <span *ngIf=\"isLoadingTextVisible\" class=\"c-body c-body--3\">{{ loadingText }}</span>\n <span *ngIf=\"isNoItemsTextVisible\" class=\"c-body c-body--3\">{{ noItemsText }}</span>\n <span *ngIf=\"isMinSearchTextVisible\" class=\"c-body c-body--3\">{{ getMinSearchText() }}</span>\n</div>\n"
937
+ },] }
938
+ ];
939
+ ComboboxPopupFooterComponent.propDecorators = {
940
+ isLoadingTextVisible: [{ type: core.Input }],
941
+ isNoItemsTextVisible: [{ type: core.Input }],
942
+ isMinSearchTextVisible: [{ type: core.Input }],
943
+ loadingText: [{ type: core.Input }],
944
+ noItemsText: [{ type: core.Input }],
945
+ minSearchText: [{ type: core.Input }],
946
+ minSearchCharacters: [{ type: core.Input }]
947
947
  };
948
948
 
949
- var ComboboxChangedEvent = /** @class */ (function (_super) {
950
- __extends(ComboboxChangedEvent, _super);
951
- function ComboboxChangedEvent() {
952
- return _super !== null && _super.apply(this, arguments) || this;
953
- }
954
- return ComboboxChangedEvent;
949
+ var ComboboxChangedEvent = /** @class */ (function (_super) {
950
+ __extends(ComboboxChangedEvent, _super);
951
+ function ComboboxChangedEvent() {
952
+ return _super !== null && _super.apply(this, arguments) || this;
953
+ }
954
+ return ComboboxChangedEvent;
955
955
  }(marcuraCommon.ControlChangedEvent));
956
956
 
957
- var ComboboxComponent = /** @class */ (function (_super) {
958
- __extends(ComboboxComponent, _super);
959
- function ComboboxComponent(changeDetectorRef, renderer, _localizer) {
960
- var _this = _super.call(this, changeDetectorRef, renderer) || this;
961
- _this._localizer = _localizer;
962
- _this.defaultValue = null;
963
- _this._size = marcuraCommon.ControlSize.Medium;
964
- _this._localization = {
965
- loadingText: 'Loading...',
966
- noItemsText: 'No items found.',
967
- minSearchText: 'Enter {minSearchCharacters} or more characters.',
968
- };
969
- _this.hasCssClass = true;
970
- _this.hasSmallSizeCssClass = false;
971
- _this.hasMediumSizeCssClass = true;
972
- _this.shouldSuggest = true;
973
- _this.openOnFocus = true;
974
- _this.allowCustom = false;
975
- _this.changed = new core.EventEmitter();
976
- /**
977
- * This field contains factory method for items which will be created placing customizable values inside component. Works when allowCustom is true.
978
- *
979
- * @memberof ComboboxComponent
980
- */
981
- _this.itemFactory = function (text) {
982
- var _a;
983
- return _a = {}, _a[_this.valueField] = null, _a[_this.textField] = text, _a;
984
- };
985
- _this.valueNormalizer = function (text$) { return text$.pipe(operators.map(function () {
986
- var value = null;
987
- if (!_this.component) {
988
- return value;
989
- }
990
- // Can't use this._searchText.value here as it might be empty, consider:
991
- // 1) type custom text, 2) focus out and back in 3) there's a text in searchbar,
992
- // but this._searchText.value is empty.
993
- // So this.component.searchbar.value is to be used.
994
- var text = (_this.component.searchbar.value || '').trim();
995
- if (!text) {
996
- return value;
997
- }
998
- if (_this.component.value && _this.component.value[_this.textField].toLowerCase() === text.toLowerCase()) {
999
- value = _this.component.value;
1000
- }
1001
- else if (_this.getItem(_this._valueNormalizerItems, text)) {
1002
- // If areItemsCached is off, then this.data will be lost by this moment,
1003
- // so we use a cache this.valueNormalizerItems.
1004
- // This is relevant especially in IE/Edge where this.component.value is null,
1005
- // so the code falls back to this condition section.
1006
- value = _this.getItem(_this._valueNormalizerItems, text);
1007
- }
1008
- else if (_this.allowCustom) {
1009
- value = _this.itemFactory(text);
1010
- if (_this._isSync) {
1011
- // Restore original items after selection, otherwise when opening the list
1012
- // next time, only the selected item will appear.
1013
- _this.loadItems();
1014
- }
1015
- }
1016
- else {
1017
- // Clears search text if suggestion hasn't been selected.
1018
- // Steps to reproduce.
1019
- // 1. Use Dymanic Empty sample.
1020
- // 2. Type 'to', wait for the list to load, but don't select 'Tokai'. Instead hit Esc key.
1021
- // 3. See that the search bar still contains 'to' text, while the value is null,
1022
- // which is wrong - search bar text should be removed.
1023
- // this.component.searchbar.suggestedText = ''; // This doesn't work.
1024
- // As the above line doesn't work, so workaround it by setting form control value to null.
1025
- _this.valueFormControl.setValue(value);
1026
- }
1027
- _this._valueNormalizerItems = [];
1028
- return value;
1029
- })); };
1030
- _this._localize();
1031
- return _this;
1032
- }
1033
- Object.defineProperty(ComboboxComponent.prototype, "hasHasValueCssClass", {
1034
- get: function () {
1035
- return this.hasValue;
1036
- },
1037
- enumerable: false,
1038
- configurable: true
1039
- });
1040
- Object.defineProperty(ComboboxComponent.prototype, "hasIsHoveredCssClass", {
1041
- get: function () {
1042
- return this._isHovered.value;
1043
- },
1044
- enumerable: false,
1045
- configurable: true
1046
- });
1047
- Object.defineProperty(ComboboxComponent.prototype, "hasIsFocusedCssClass", {
1048
- get: function () {
1049
- return this.isFocused;
1050
- },
1051
- enumerable: false,
1052
- configurable: true
1053
- });
1054
- Object.defineProperty(ComboboxComponent.prototype, "hasIsDisabledCssClass", {
1055
- get: function () {
1056
- return this.isDisabled;
1057
- },
1058
- enumerable: false,
1059
- configurable: true
1060
- });
1061
- Object.defineProperty(ComboboxComponent.prototype, "isSuccessType", {
1062
- get: function () {
1063
- return this._isSuccessType;
1064
- },
1065
- enumerable: false,
1066
- configurable: true
1067
- });
1068
- Object.defineProperty(ComboboxComponent.prototype, "isErrorType", {
1069
- get: function () {
1070
- return this._isErrorType;
1071
- },
1072
- enumerable: false,
1073
- configurable: true
1074
- });
1075
- Object.defineProperty(ComboboxComponent.prototype, "isWarningType", {
1076
- get: function () {
1077
- return this._isWarningType;
1078
- },
1079
- enumerable: false,
1080
- configurable: true
1081
- });
1082
- Object.defineProperty(ComboboxComponent.prototype, "isHighlightedState", {
1083
- get: function () {
1084
- return this._isHighlightedState;
1085
- },
1086
- enumerable: false,
1087
- configurable: true
1088
- });
1089
- Object.defineProperty(ComboboxComponent.prototype, "hasIsLoadingCssClass", {
1090
- get: function () {
1091
- return this.isLoading || this._isSearching.value;
1092
- },
1093
- enumerable: false,
1094
- configurable: true
1095
- });
1096
- Object.defineProperty(ComboboxComponent.prototype, "hasHasResetCssClass", {
1097
- get: function () {
1098
- return this.hasReset;
1099
- },
1100
- enumerable: false,
1101
- configurable: true
1102
- });
1103
- Object.defineProperty(ComboboxComponent.prototype, "hasIsOutlineCssClass", {
1104
- get: function () {
1105
- return this.isOutline;
1106
- },
1107
- enumerable: false,
1108
- configurable: true
1109
- });
1110
- Object.defineProperty(ComboboxComponent.prototype, "loadingText", {
1111
- get: function () {
1112
- return this._loadingText || this._localization.loadingText;
1113
- },
1114
- set: function (loadingText) {
1115
- this._loadingText = loadingText;
1116
- },
1117
- enumerable: false,
1118
- configurable: true
1119
- });
1120
- Object.defineProperty(ComboboxComponent.prototype, "noItemsText", {
1121
- get: function () {
1122
- return this._noItemsText || this._localization.noItemsText;
1123
- },
1124
- set: function (noItemsText) {
1125
- this._noItemsText = noItemsText;
1126
- },
1127
- enumerable: false,
1128
- configurable: true
1129
- });
1130
- Object.defineProperty(ComboboxComponent.prototype, "minSearchText", {
1131
- get: function () {
1132
- return this._minSearchText || this._localization.minSearchText;
1133
- },
1134
- set: function (minSearchText) {
1135
- this._minSearchText = minSearchText;
1136
- },
1137
- enumerable: false,
1138
- configurable: true
1139
- });
1140
- Object.defineProperty(ComboboxComponent.prototype, "size", {
1141
- get: function () {
1142
- return this._size;
1143
- },
1144
- set: function (size) {
1145
- if (size) {
1146
- this._size = size;
1147
- }
1148
- this.hasSmallSizeCssClass = this._size === marcuraCommon.ControlSize.Small;
1149
- this.hasMediumSizeCssClass = this._size === marcuraCommon.ControlSize.Medium;
1150
- },
1151
- enumerable: false,
1152
- configurable: true
1153
- });
1154
- Object.defineProperty(ComboboxComponent.prototype, "popupSettings", {
1155
- get: function () {
1156
- return {
1157
- animate: true,
1158
- popupClass: "sg-combobox-popup" + (this.isGroupable ? ' sg-combobox-popup--is-groupable' : '') + " " + (this.popupClass || ''),
1159
- };
1160
- },
1161
- enumerable: false,
1162
- configurable: true
1163
- });
1164
- ComboboxComponent.prototype._emitChanged = function (value) {
1165
- this.changed.emit(new ComboboxChangedEvent(value));
1166
- };
1167
- ComboboxComponent.prototype.hasValueChanged = function (value) {
1168
- return !this.isItemEqual(this.value, value);
1169
- };
1170
- ComboboxComponent.prototype._localize = function () {
1171
- var _this = this;
1172
- if (!this._localizer) {
1173
- return;
1174
- }
1175
- this._localization = this._localizer.localization;
1176
- this._observer.listen(this._localizer.localizationChanged, function (localization) {
1177
- _this._localization = localization;
1178
- });
1179
- };
1180
- ComboboxComponent.prototype.onResetClicked = function () {
1181
- if (!this.hasReset) {
1182
- return;
1183
- }
1184
- this._resetedValue = this.value;
1185
- this.focus();
1186
- this._reset();
1187
- if (this.openOnFocus) {
1188
- this.open();
1189
- }
1190
- };
1191
- ComboboxComponent.prototype.ngOnInit = function () {
1192
- var _this = this;
1193
- this._setComponent(this.component);
1194
- this.init();
1195
- // Opened.
1196
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () {
1197
- if (!_this.areItemsCached) {
1198
- _this._hasSearched.next(false);
1199
- }
1200
- if (_this.canLoadItems(_this._searchText.value) && _this._loadedItems.value.length === 0) {
1201
- _this.loadItems(_this._searchText.value);
1202
- }
1203
- });
1204
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; }),
1205
- // When clicking reset icon, opened event triggers search event with
1206
- // with old searchbar value instead of an empty string.
1207
- // So we need to give searchbar a moment before fire opened event.
1208
- // Steps to reproduce the bug:
1209
- // 1) Search for Vladivostok and select it 2) Reset value with icon
1210
- // 3) searchText remains "Vladivostok", but should be "".
1211
- operators.debounceTime(50)), function () { return _this.opened.emit(); });
1212
- // Focused.
1213
- this._observer.listen(this._isFocused.pipe(operators.filter(marcuraCommon.isTrue)), function () {
1214
- if (_this.openOnFocus) {
1215
- _this.open();
1216
- }
1217
- });
1218
- };
1219
- ComboboxComponent.prototype.onChanged = function (value) {
1220
- if (!this.hasValueChanged(value)) {
1221
- return;
1222
- }
1223
- value = value === undefined ? this.defaultValue : value;
1224
- this.value = value;
1225
- this.component.searchbar.suggestedText = '';
1226
- this.propagateChanged(value);
1227
- this.propagateTouched();
1228
- this._emitChanged(value);
1229
- if (!value && this._isSync) {
1230
- // Restore original items after selection, otherwise when opening the list
1231
- // next time, only the previously selected item will appear.
1232
- // Steps to reproduce: 1) Select "Cayman Brac", 2) Focus out and focus back,
1233
- // 3) Delete a couple of characters with a Backspace from the end and hit Enter.
1234
- // 4) Open the list.
1235
- this.loadItems();
1236
- }
1237
- };
1238
- return ComboboxComponent;
1239
- }(AbstractComboboxComponent));
1240
- ComboboxComponent.decorators = [
1241
- { type: core.Component, args: [{
1242
- selector: 'sg-combobox',
1243
- template: "<kendo-combobox\n #component\n [placeholder]=\"placeholder\"\n [formControl]=\"valueFormControl\"\n [data]=\"combinedItems | async\"\n [filterable]=\"isSearchable\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [loading]=\"isLoadingSpinnerVisible | async\"\n [clearButton]=\"false\"\n [popupSettings]=\"popupSettings\"\n [listHeight]=\"listHeight\"\n [valuePrimitive]=\"isPrimitiveValue\"\n [suggest]=\"shouldSuggest\"\n [allowCustom]=\"true\"\n [valueNormalizer]=\"valueNormalizer\"\n (filterChange)=\"onSearched($event)\"\n (valueChange)=\"onChanged($event)\"\n (open)=\"onOpened()\"\n (close)=\"onClosed()\"\n (focus)=\"onFocused()\"\n (blur)=\"onBlurred()\"\n>\n <ng-template kendoDropDownListFooterTemplate>\n <sg-combobox-popup-footer\n [isLoadingTextVisible]=\"isLoadingTextVisible | async\"\n [isNoItemsTextVisible]=\"isNoItemsTextVisible | async\"\n [isMinSearchTextVisible]=\"isMinSearchTextVisible | async\"\n [loadingText]=\"loadingText\"\n [noItemsText]=\"noItemsText\"\n [minSearchText]=\"minSearchText\"\n [minSearchCharacters]=\"minSearchCharacters\"\n >\n </sg-combobox-popup-footer>\n </ng-template>\n <ng-template kendoComboBoxNoDataTemplate></ng-template>\n <ng-template *ngIf=\"itemTemplate\" kendoComboBoxItemTemplate let-dataItem>\n <span [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\"></span>\n </ng-template>\n</kendo-combobox>\n<div class=\"sg-combobox__reset\" *ngIf=\"!isDisabled\" (click)=\"onResetClicked()\">\n <i class=\"far fa-times\"></i>\n</div>\n<div class=\"sg-combobox__state-line\"></div>\n",
1244
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1245
- providers: [
1246
- {
1247
- provide: forms.NG_VALUE_ACCESSOR,
1248
- useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1249
- multi: true,
1250
- },
1251
- {
1252
- provide: marcuraCommon.ABSTRACT_CONTROL_COMPONENT,
1253
- useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1254
- },
1255
- {
1256
- provide: marcuraCommon.OPENABLE_CONTROL_COMPONENT,
1257
- useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1258
- },
1259
- {
1260
- provide: marcuraCommon.STATEABLE_CONTROL_COMPONENT,
1261
- useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1262
- },
1263
- {
1264
- provide: marcuraCommon.TYPEABLE_CONTROL_COMPONENT,
1265
- useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1266
- },
1267
- {
1268
- provide: marcuraCommon.SIZEABLE_CONTROL_COMPONENT,
1269
- useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1270
- },
1271
- ]
1272
- },] }
1273
- ];
1274
- ComboboxComponent.ctorParameters = function () { return [
1275
- { type: core.ChangeDetectorRef },
1276
- { type: core.Renderer2 },
1277
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [COMBOBOX_LOCALIZER,] }] }
1278
- ]; };
1279
- ComboboxComponent.propDecorators = {
1280
- component: [{ type: core.ViewChild, args: ['component', { static: true },] }],
1281
- itemTemplate: [{ type: core.ContentChild, args: [ComboboxItemTemplateDirective, { read: core.TemplateRef, static: true },] }],
1282
- hasCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox',] }],
1283
- hasHasValueCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--has-value',] }],
1284
- hasIsHoveredCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-hovered',] }],
1285
- hasIsFocusedCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-focused',] }],
1286
- hasIsDisabledCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-disabled',] }],
1287
- isSuccessType: [{ type: core.HostBinding, args: ['class.sg-combobox--type-success',] }],
1288
- isErrorType: [{ type: core.HostBinding, args: ['class.sg-combobox--type-error',] }],
1289
- isWarningType: [{ type: core.HostBinding, args: ['class.sg-combobox--type-warning',] }],
1290
- isHighlightedState: [{ type: core.HostBinding, args: ['class.sg-combobox--state-highlighted',] }],
1291
- hasIsLoadingCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-loading',] }],
1292
- hasHasResetCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--has-reset',] }],
1293
- hasIsOutlineCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-outline',] }],
1294
- hasSmallSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--size-small',] }],
1295
- hasMediumSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--size-medium',] }],
1296
- loadingText: [{ type: core.Input }],
1297
- noItemsText: [{ type: core.Input }],
1298
- minSearchText: [{ type: core.Input }],
1299
- shouldSuggest: [{ type: core.Input }],
1300
- openOnFocus: [{ type: core.Input }],
1301
- allowCustom: [{ type: core.Input }],
1302
- size: [{ type: core.Input }],
1303
- changed: [{ type: core.Output }],
1304
- itemFactory: [{ type: core.Input }]
957
+ var ComboboxComponent = /** @class */ (function (_super) {
958
+ __extends(ComboboxComponent, _super);
959
+ function ComboboxComponent(changeDetectorRef, renderer, _localizer) {
960
+ var _this = _super.call(this, changeDetectorRef, renderer) || this;
961
+ _this._localizer = _localizer;
962
+ _this.defaultValue = null;
963
+ _this._size = marcuraCommon.ControlSize.Medium;
964
+ _this._localization = {
965
+ loadingText: 'Loading...',
966
+ noItemsText: 'No items found.',
967
+ minSearchText: 'Enter {minSearchCharacters} or more characters.',
968
+ };
969
+ _this.hasCssClass = true;
970
+ _this.hasSmallSizeCssClass = false;
971
+ _this.hasMediumSizeCssClass = true;
972
+ _this.shouldSuggest = true;
973
+ _this.openOnFocus = true;
974
+ _this.allowCustom = false;
975
+ _this.changed = new core.EventEmitter();
976
+ /**
977
+ * This field contains factory method for items which will be created placing customizable values inside component. Works when allowCustom is true.
978
+ *
979
+ * @memberof ComboboxComponent
980
+ */
981
+ _this.itemFactory = function (text) {
982
+ var _a;
983
+ return _a = {}, _a[_this.valueField] = null, _a[_this.textField] = text, _a;
984
+ };
985
+ _this.valueNormalizer = function (text$) { return text$.pipe(operators.map(function () {
986
+ var value = null;
987
+ if (!_this.component) {
988
+ return value;
989
+ }
990
+ // Can't use this._searchText.value here as it might be empty, consider:
991
+ // 1) type custom text, 2) focus out and back in 3) there's a text in searchbar,
992
+ // but this._searchText.value is empty.
993
+ // So this.component.searchbar.value is to be used.
994
+ var text = (_this.component.searchbar.value || '').trim();
995
+ if (!text) {
996
+ return value;
997
+ }
998
+ if (_this.component.value && _this.component.value[_this.textField].toLowerCase() === text.toLowerCase()) {
999
+ value = _this.component.value;
1000
+ }
1001
+ else if (_this.getItem(_this._valueNormalizerItems, text)) {
1002
+ // If areItemsCached is off, then this.data will be lost by this moment,
1003
+ // so we use a cache this.valueNormalizerItems.
1004
+ // This is relevant especially in IE/Edge where this.component.value is null,
1005
+ // so the code falls back to this condition section.
1006
+ value = _this.getItem(_this._valueNormalizerItems, text);
1007
+ }
1008
+ else if (_this.allowCustom) {
1009
+ value = _this.itemFactory(text);
1010
+ if (_this._isSync) {
1011
+ // Restore original items after selection, otherwise when opening the list
1012
+ // next time, only the selected item will appear.
1013
+ _this.loadItems();
1014
+ }
1015
+ }
1016
+ else {
1017
+ // Clears search text if suggestion hasn't been selected.
1018
+ // Steps to reproduce.
1019
+ // 1. Use Dymanic Empty sample.
1020
+ // 2. Type 'to', wait for the list to load, but don't select 'Tokai'. Instead hit Esc key.
1021
+ // 3. See that the search bar still contains 'to' text, while the value is null,
1022
+ // which is wrong - search bar text should be removed.
1023
+ // this.component.searchbar.suggestedText = ''; // This doesn't work.
1024
+ // As the above line doesn't work, so workaround it by setting form control value to null.
1025
+ _this.valueFormControl.setValue(value);
1026
+ }
1027
+ _this._valueNormalizerItems = [];
1028
+ return value;
1029
+ })); };
1030
+ _this._localize();
1031
+ return _this;
1032
+ }
1033
+ Object.defineProperty(ComboboxComponent.prototype, "hasHasValueCssClass", {
1034
+ get: function () {
1035
+ return this.hasValue;
1036
+ },
1037
+ enumerable: false,
1038
+ configurable: true
1039
+ });
1040
+ Object.defineProperty(ComboboxComponent.prototype, "hasIsHoveredCssClass", {
1041
+ get: function () {
1042
+ return this._isHovered.value;
1043
+ },
1044
+ enumerable: false,
1045
+ configurable: true
1046
+ });
1047
+ Object.defineProperty(ComboboxComponent.prototype, "hasIsFocusedCssClass", {
1048
+ get: function () {
1049
+ return this.isFocused;
1050
+ },
1051
+ enumerable: false,
1052
+ configurable: true
1053
+ });
1054
+ Object.defineProperty(ComboboxComponent.prototype, "hasIsDisabledCssClass", {
1055
+ get: function () {
1056
+ return this.isDisabled;
1057
+ },
1058
+ enumerable: false,
1059
+ configurable: true
1060
+ });
1061
+ Object.defineProperty(ComboboxComponent.prototype, "isSuccessType", {
1062
+ get: function () {
1063
+ return this._isSuccessType;
1064
+ },
1065
+ enumerable: false,
1066
+ configurable: true
1067
+ });
1068
+ Object.defineProperty(ComboboxComponent.prototype, "isErrorType", {
1069
+ get: function () {
1070
+ return this._isErrorType;
1071
+ },
1072
+ enumerable: false,
1073
+ configurable: true
1074
+ });
1075
+ Object.defineProperty(ComboboxComponent.prototype, "isWarningType", {
1076
+ get: function () {
1077
+ return this._isWarningType;
1078
+ },
1079
+ enumerable: false,
1080
+ configurable: true
1081
+ });
1082
+ Object.defineProperty(ComboboxComponent.prototype, "isHighlightedState", {
1083
+ get: function () {
1084
+ return this._isHighlightedState;
1085
+ },
1086
+ enumerable: false,
1087
+ configurable: true
1088
+ });
1089
+ Object.defineProperty(ComboboxComponent.prototype, "hasIsLoadingCssClass", {
1090
+ get: function () {
1091
+ return this.isLoading || this._isSearching.value;
1092
+ },
1093
+ enumerable: false,
1094
+ configurable: true
1095
+ });
1096
+ Object.defineProperty(ComboboxComponent.prototype, "hasHasResetCssClass", {
1097
+ get: function () {
1098
+ return this.hasReset;
1099
+ },
1100
+ enumerable: false,
1101
+ configurable: true
1102
+ });
1103
+ Object.defineProperty(ComboboxComponent.prototype, "hasIsOutlineCssClass", {
1104
+ get: function () {
1105
+ return this.isOutline;
1106
+ },
1107
+ enumerable: false,
1108
+ configurable: true
1109
+ });
1110
+ Object.defineProperty(ComboboxComponent.prototype, "loadingText", {
1111
+ get: function () {
1112
+ return this._loadingText || this._localization.loadingText;
1113
+ },
1114
+ set: function (loadingText) {
1115
+ this._loadingText = loadingText;
1116
+ },
1117
+ enumerable: false,
1118
+ configurable: true
1119
+ });
1120
+ Object.defineProperty(ComboboxComponent.prototype, "noItemsText", {
1121
+ get: function () {
1122
+ return this._noItemsText || this._localization.noItemsText;
1123
+ },
1124
+ set: function (noItemsText) {
1125
+ this._noItemsText = noItemsText;
1126
+ },
1127
+ enumerable: false,
1128
+ configurable: true
1129
+ });
1130
+ Object.defineProperty(ComboboxComponent.prototype, "minSearchText", {
1131
+ get: function () {
1132
+ return this._minSearchText || this._localization.minSearchText;
1133
+ },
1134
+ set: function (minSearchText) {
1135
+ this._minSearchText = minSearchText;
1136
+ },
1137
+ enumerable: false,
1138
+ configurable: true
1139
+ });
1140
+ Object.defineProperty(ComboboxComponent.prototype, "size", {
1141
+ get: function () {
1142
+ return this._size;
1143
+ },
1144
+ set: function (size) {
1145
+ if (size) {
1146
+ this._size = size;
1147
+ }
1148
+ this.hasSmallSizeCssClass = this._size === marcuraCommon.ControlSize.Small;
1149
+ this.hasMediumSizeCssClass = this._size === marcuraCommon.ControlSize.Medium;
1150
+ },
1151
+ enumerable: false,
1152
+ configurable: true
1153
+ });
1154
+ Object.defineProperty(ComboboxComponent.prototype, "popupSettings", {
1155
+ get: function () {
1156
+ return {
1157
+ animate: true,
1158
+ popupClass: "sg-combobox-popup" + (this.isGroupable ? ' sg-combobox-popup--is-groupable' : '') + " " + (this.popupClass || ''),
1159
+ };
1160
+ },
1161
+ enumerable: false,
1162
+ configurable: true
1163
+ });
1164
+ ComboboxComponent.prototype._emitChanged = function (value) {
1165
+ this.changed.emit(new ComboboxChangedEvent(value));
1166
+ };
1167
+ ComboboxComponent.prototype.hasValueChanged = function (value) {
1168
+ return !this.isItemEqual(this.value, value);
1169
+ };
1170
+ ComboboxComponent.prototype._localize = function () {
1171
+ var _this = this;
1172
+ if (!this._localizer) {
1173
+ return;
1174
+ }
1175
+ this._localization = this._localizer.localization;
1176
+ this._observer.listen(this._localizer.localizationChanged, function (localization) {
1177
+ _this._localization = localization;
1178
+ });
1179
+ };
1180
+ ComboboxComponent.prototype.onResetClicked = function () {
1181
+ if (!this.hasReset) {
1182
+ return;
1183
+ }
1184
+ this._resetedValue = this.value;
1185
+ this.focus();
1186
+ this._reset();
1187
+ if (this.openOnFocus) {
1188
+ this.open();
1189
+ }
1190
+ };
1191
+ ComboboxComponent.prototype.ngOnInit = function () {
1192
+ var _this = this;
1193
+ this._setComponent(this.component);
1194
+ this.init();
1195
+ // Opened.
1196
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () {
1197
+ if (!_this.areItemsCached) {
1198
+ _this._hasSearched.next(false);
1199
+ }
1200
+ if (_this.canLoadItems(_this._searchText.value) && _this._loadedItems.value.length === 0) {
1201
+ _this.loadItems(_this._searchText.value);
1202
+ }
1203
+ });
1204
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; }),
1205
+ // When clicking reset icon, opened event triggers search event with
1206
+ // with old searchbar value instead of an empty string.
1207
+ // So we need to give searchbar a moment before fire opened event.
1208
+ // Steps to reproduce the bug:
1209
+ // 1) Search for Vladivostok and select it 2) Reset value with icon
1210
+ // 3) searchText remains "Vladivostok", but should be "".
1211
+ operators.debounceTime(50)), function () { return _this.opened.emit(); });
1212
+ // Focused.
1213
+ this._observer.listen(this._isFocused.pipe(operators.filter(marcuraCommon.isTrue)), function () {
1214
+ if (_this.openOnFocus) {
1215
+ _this.open();
1216
+ }
1217
+ });
1218
+ };
1219
+ ComboboxComponent.prototype.onChanged = function (value) {
1220
+ if (!this.hasValueChanged(value)) {
1221
+ return;
1222
+ }
1223
+ value = value === undefined ? this.defaultValue : value;
1224
+ this.value = value;
1225
+ this.component.searchbar.suggestedText = '';
1226
+ this.propagateChanged(value);
1227
+ this.propagateTouched();
1228
+ this._emitChanged(value);
1229
+ if (!value && this._isSync) {
1230
+ // Restore original items after selection, otherwise when opening the list
1231
+ // next time, only the previously selected item will appear.
1232
+ // Steps to reproduce: 1) Select "Cayman Brac", 2) Focus out and focus back,
1233
+ // 3) Delete a couple of characters with a Backspace from the end and hit Enter.
1234
+ // 4) Open the list.
1235
+ this.loadItems();
1236
+ }
1237
+ };
1238
+ return ComboboxComponent;
1239
+ }(AbstractComboboxComponent));
1240
+ ComboboxComponent.decorators = [
1241
+ { type: core.Component, args: [{
1242
+ selector: 'sg-combobox',
1243
+ template: "<kendo-combobox\n #component\n [placeholder]=\"placeholder\"\n [formControl]=\"valueFormControl\"\n [data]=\"combinedItems | async\"\n [filterable]=\"isSearchable\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [loading]=\"isLoadingSpinnerVisible | async\"\n [clearButton]=\"false\"\n [popupSettings]=\"popupSettings\"\n [listHeight]=\"listHeight\"\n [valuePrimitive]=\"isPrimitiveValue\"\n [suggest]=\"shouldSuggest\"\n [allowCustom]=\"true\"\n [valueNormalizer]=\"valueNormalizer\"\n (filterChange)=\"onSearched($event)\"\n (valueChange)=\"onChanged($event)\"\n (open)=\"onOpened()\"\n (close)=\"onClosed()\"\n (focus)=\"onFocused()\"\n (blur)=\"onBlurred()\"\n>\n <ng-template kendoDropDownListFooterTemplate>\n <sg-combobox-popup-footer\n [isLoadingTextVisible]=\"isLoadingTextVisible | async\"\n [isNoItemsTextVisible]=\"isNoItemsTextVisible | async\"\n [isMinSearchTextVisible]=\"isMinSearchTextVisible | async\"\n [loadingText]=\"loadingText\"\n [noItemsText]=\"noItemsText\"\n [minSearchText]=\"minSearchText\"\n [minSearchCharacters]=\"minSearchCharacters\"\n >\n </sg-combobox-popup-footer>\n </ng-template>\n <ng-template kendoComboBoxNoDataTemplate></ng-template>\n <ng-template *ngIf=\"itemTemplate\" kendoComboBoxItemTemplate let-dataItem>\n <span [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\"></span>\n </ng-template>\n</kendo-combobox>\n<div class=\"sg-combobox__reset\" *ngIf=\"!isDisabled\" (click)=\"onResetClicked()\">\n <i class=\"far fa-times\"></i>\n</div>\n<div class=\"sg-combobox__state-line\"></div>\n",
1244
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1245
+ providers: [
1246
+ {
1247
+ provide: forms.NG_VALUE_ACCESSOR,
1248
+ useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1249
+ multi: true,
1250
+ },
1251
+ {
1252
+ provide: marcuraCommon.ABSTRACT_CONTROL_COMPONENT,
1253
+ useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1254
+ },
1255
+ {
1256
+ provide: marcuraCommon.OPENABLE_CONTROL_COMPONENT,
1257
+ useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1258
+ },
1259
+ {
1260
+ provide: marcuraCommon.STATEABLE_CONTROL_COMPONENT,
1261
+ useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1262
+ },
1263
+ {
1264
+ provide: marcuraCommon.TYPEABLE_CONTROL_COMPONENT,
1265
+ useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1266
+ },
1267
+ {
1268
+ provide: marcuraCommon.SIZEABLE_CONTROL_COMPONENT,
1269
+ useExisting: core.forwardRef(function () { return ComboboxComponent; }),
1270
+ },
1271
+ ]
1272
+ },] }
1273
+ ];
1274
+ ComboboxComponent.ctorParameters = function () { return [
1275
+ { type: core.ChangeDetectorRef },
1276
+ { type: core.Renderer2 },
1277
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [COMBOBOX_LOCALIZER,] }] }
1278
+ ]; };
1279
+ ComboboxComponent.propDecorators = {
1280
+ component: [{ type: core.ViewChild, args: ['component', { static: true },] }],
1281
+ itemTemplate: [{ type: core.ContentChild, args: [ComboboxItemTemplateDirective, { read: core.TemplateRef, static: true },] }],
1282
+ hasCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox',] }],
1283
+ hasHasValueCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--has-value',] }],
1284
+ hasIsHoveredCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-hovered',] }],
1285
+ hasIsFocusedCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-focused',] }],
1286
+ hasIsDisabledCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-disabled',] }],
1287
+ isSuccessType: [{ type: core.HostBinding, args: ['class.sg-combobox--type-success',] }],
1288
+ isErrorType: [{ type: core.HostBinding, args: ['class.sg-combobox--type-error',] }],
1289
+ isWarningType: [{ type: core.HostBinding, args: ['class.sg-combobox--type-warning',] }],
1290
+ isHighlightedState: [{ type: core.HostBinding, args: ['class.sg-combobox--state-highlighted',] }],
1291
+ hasIsLoadingCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-loading',] }],
1292
+ hasHasResetCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--has-reset',] }],
1293
+ hasIsOutlineCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--is-outline',] }],
1294
+ hasSmallSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--size-small',] }],
1295
+ hasMediumSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-combobox--size-medium',] }],
1296
+ loadingText: [{ type: core.Input }],
1297
+ noItemsText: [{ type: core.Input }],
1298
+ minSearchText: [{ type: core.Input }],
1299
+ shouldSuggest: [{ type: core.Input }],
1300
+ openOnFocus: [{ type: core.Input }],
1301
+ allowCustom: [{ type: core.Input }],
1302
+ size: [{ type: core.Input }],
1303
+ changed: [{ type: core.Output }],
1304
+ itemFactory: [{ type: core.Input }]
1305
1305
  };
1306
1306
 
1307
- var DropdownChangedEvent = /** @class */ (function (_super) {
1308
- __extends(DropdownChangedEvent, _super);
1309
- function DropdownChangedEvent() {
1310
- return _super !== null && _super.apply(this, arguments) || this;
1311
- }
1312
- return DropdownChangedEvent;
1307
+ var DropdownChangedEvent = /** @class */ (function (_super) {
1308
+ __extends(DropdownChangedEvent, _super);
1309
+ function DropdownChangedEvent() {
1310
+ return _super !== null && _super.apply(this, arguments) || this;
1311
+ }
1312
+ return DropdownChangedEvent;
1313
1313
  }(marcuraCommon.ControlChangedEvent));
1314
1314
 
1315
- var DropdownComponent = /** @class */ (function (_super) {
1316
- __extends(DropdownComponent, _super);
1317
- function DropdownComponent(changeDetectorRef, _localizer) {
1318
- var _this = _super.call(this, changeDetectorRef) || this;
1319
- _this._localizer = _localizer;
1320
- _this.defaultValue = null;
1321
- _this._size = marcuraCommon.ControlSize.Medium;
1322
- _this._localization = {
1323
- noItemsText: 'No items found.',
1324
- };
1325
- _this.hasCssClass = true;
1326
- _this.hasSmallSizeCssClass = false;
1327
- _this.hasMediumSizeCssClass = true;
1328
- _this.changed = new core.EventEmitter();
1329
- _this._localize();
1330
- return _this;
1331
- }
1332
- Object.defineProperty(DropdownComponent.prototype, "hasHasValueCssClass", {
1333
- get: function () {
1334
- return this.hasValue;
1335
- },
1336
- enumerable: false,
1337
- configurable: true
1338
- });
1339
- Object.defineProperty(DropdownComponent.prototype, "hasIsFocusedCssClass", {
1340
- get: function () {
1341
- return this.isFocused;
1342
- },
1343
- enumerable: false,
1344
- configurable: true
1345
- });
1346
- Object.defineProperty(DropdownComponent.prototype, "hasIsHoveredCssClass", {
1347
- get: function () {
1348
- return this._isHovered.value;
1349
- },
1350
- enumerable: false,
1351
- configurable: true
1352
- });
1353
- Object.defineProperty(DropdownComponent.prototype, "hasIsDisabledCssClass", {
1354
- get: function () {
1355
- return this.isDisabled;
1356
- },
1357
- enumerable: false,
1358
- configurable: true
1359
- });
1360
- Object.defineProperty(DropdownComponent.prototype, "isSuccessType", {
1361
- get: function () {
1362
- return this._isSuccessType;
1363
- },
1364
- enumerable: false,
1365
- configurable: true
1366
- });
1367
- Object.defineProperty(DropdownComponent.prototype, "isErrorType", {
1368
- get: function () {
1369
- return this._isErrorType;
1370
- },
1371
- enumerable: false,
1372
- configurable: true
1373
- });
1374
- Object.defineProperty(DropdownComponent.prototype, "isWarningType", {
1375
- get: function () {
1376
- return this._isWarningType;
1377
- },
1378
- enumerable: false,
1379
- configurable: true
1380
- });
1381
- Object.defineProperty(DropdownComponent.prototype, "isHighlightedState", {
1382
- get: function () {
1383
- return this._isHighlightedState;
1384
- },
1385
- enumerable: false,
1386
- configurable: true
1387
- });
1388
- Object.defineProperty(DropdownComponent.prototype, "hasIsLoadingCssClass", {
1389
- get: function () {
1390
- return this.isLoading;
1391
- },
1392
- enumerable: false,
1393
- configurable: true
1394
- });
1395
- Object.defineProperty(DropdownComponent.prototype, "hasHasResetCssClass", {
1396
- get: function () {
1397
- return this.hasReset;
1398
- },
1399
- enumerable: false,
1400
- configurable: true
1401
- });
1402
- Object.defineProperty(DropdownComponent.prototype, "hasIsOutlineCssClass", {
1403
- get: function () {
1404
- return this.isOutline;
1405
- },
1406
- enumerable: false,
1407
- configurable: true
1408
- });
1409
- Object.defineProperty(DropdownComponent.prototype, "noItemsText", {
1410
- get: function () {
1411
- return this._noItemsText || this._localization.noItemsText;
1412
- },
1413
- set: function (noItemsText) {
1414
- this._noItemsText = noItemsText;
1415
- },
1416
- enumerable: false,
1417
- configurable: true
1418
- });
1419
- Object.defineProperty(DropdownComponent.prototype, "size", {
1420
- get: function () {
1421
- return this._size;
1422
- },
1423
- set: function (size) {
1424
- if (size) {
1425
- this._size = size;
1426
- }
1427
- this.hasSmallSizeCssClass = this._size === marcuraCommon.ControlSize.Small;
1428
- this.hasMediumSizeCssClass = this._size === marcuraCommon.ControlSize.Medium;
1429
- },
1430
- enumerable: false,
1431
- configurable: true
1432
- });
1433
- Object.defineProperty(DropdownComponent.prototype, "popupSettings", {
1434
- get: function () {
1435
- return {
1436
- animate: true,
1437
- popupClass: "sg-dropdown-popup " + (this.popupClass || ''),
1438
- };
1439
- },
1440
- enumerable: false,
1441
- configurable: true
1442
- });
1443
- DropdownComponent.prototype._emitChanged = function (value) {
1444
- this.changed.emit(new DropdownChangedEvent(value));
1445
- };
1446
- DropdownComponent.prototype._localize = function () {
1447
- var _this = this;
1448
- if (!this._localizer) {
1449
- return;
1450
- }
1451
- this._localization = this._localizer.localization;
1452
- this._observer.listen(this._localizer.localizationChanged, function (localization) {
1453
- _this._localization = localization;
1454
- });
1455
- };
1456
- DropdownComponent.prototype.ngOnInit = function () {
1457
- var _this = this;
1458
- this._setComponent(this.component);
1459
- this.init();
1460
- // Opened.
1461
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () { return _this.opened.emit(); });
1462
- // Closed.
1463
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return !event.isOpen; }), operators.skip(1)), function (event) {
1464
- if (event.shouldEmit) {
1465
- _this.closed.emit();
1466
- }
1467
- });
1468
- };
1469
- return DropdownComponent;
1470
- }(AbstractDropdownComponent));
1471
- DropdownComponent.decorators = [
1472
- { type: core.Component, args: [{
1473
- selector: 'sg-dropdown',
1474
- template: "<kendo-dropdownlist\n #component\n [formControl]=\"valueFormControl\"\n [data]=\"items\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [loading]=\"isLoading\"\n [popupSettings]=\"popupSettings\"\n [listHeight]=\"listHeight\"\n [valuePrimitive]=\"isPrimitiveValue\"\n (valueChange)=\"onChanged($event)\"\n (open)=\"onOpened()\"\n (close)=\"onClosed()\"\n (focus)=\"onFocused()\"\n (blur)=\"onBlurred()\"\n>\n <ng-template *ngIf=\"itemTemplate\" kendoDropDownListItemTemplate let-dataItem>\n <span [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\"></span>\n </ng-template>\n <ng-template kendoDropDownListValueTemplate let-dataItem>\n <ng-container *ngIf=\"dataItem\">\n <ng-container *ngIf=\"valueTemplate\">\n <span [ngTemplateOutlet]=\"valueTemplate\" [ngTemplateOutletContext]=\"{value: dataItem}\"></span>\n </ng-container>\n <ng-container *ngIf=\"!valueTemplate\">{{ dataItem[textField] }}</ng-container>\n </ng-container>\n <ng-container *ngIf=\"!dataItem\">\n <span *ngIf=\"placeholder\" class=\"k-placeholder\">{{ placeholder }}</span>\n <ng-container *ngIf=\"!placeholder && valueTemplate\">\n <span [ngTemplateOutlet]=\"valueTemplate\" [ngTemplateOutletContext]=\"{value: dataItem}\"></span>\n </ng-container>\n </ng-container>\n </ng-template>\n <ng-template kendoDropDownListFooterTemplate>\n <sg-combobox-popup-footer [isNoItemsTextVisible]=\"items.length === 0\" [noItemsText]=\"noItemsText\">\n </sg-combobox-popup-footer>\n </ng-template>\n <ng-template kendoDropDownListNoDataTemplate></ng-template>\n</kendo-dropdownlist>\n<div class=\"sg-dropdown__reset\" *ngIf=\"!isDisabled\" (click)=\"onResetClicked()\">\n <i class=\"far fa-times\"></i>\n</div>\n<div class=\"sg-dropdown__state-line\"></div>\n",
1475
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1476
- providers: [
1477
- {
1478
- provide: forms.NG_VALUE_ACCESSOR,
1479
- useExisting: core.forwardRef(function () { return DropdownComponent; }),
1480
- multi: true,
1481
- },
1482
- {
1483
- provide: marcuraCommon.ABSTRACT_CONTROL_COMPONENT,
1484
- useExisting: core.forwardRef(function () { return DropdownComponent; }),
1485
- },
1486
- {
1487
- provide: marcuraCommon.OPENABLE_CONTROL_COMPONENT,
1488
- useExisting: core.forwardRef(function () { return DropdownComponent; }),
1489
- },
1490
- {
1491
- provide: marcuraCommon.STATEABLE_CONTROL_COMPONENT,
1492
- useExisting: core.forwardRef(function () { return DropdownComponent; }),
1493
- },
1494
- {
1495
- provide: marcuraCommon.TYPEABLE_CONTROL_COMPONENT,
1496
- useExisting: core.forwardRef(function () { return DropdownComponent; }),
1497
- },
1498
- {
1499
- provide: marcuraCommon.SIZEABLE_CONTROL_COMPONENT,
1500
- useExisting: core.forwardRef(function () { return DropdownComponent; }),
1501
- },
1502
- ]
1503
- },] }
1504
- ];
1505
- DropdownComponent.ctorParameters = function () { return [
1506
- { type: core.ChangeDetectorRef },
1507
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DROPDOWN_LOCALIZER,] }] }
1508
- ]; };
1509
- DropdownComponent.propDecorators = {
1510
- component: [{ type: core.ViewChild, args: ['component', { static: true },] }],
1511
- itemTemplate: [{ type: core.ContentChild, args: [DropdownItemTemplateDirective, { read: core.TemplateRef },] }],
1512
- valueTemplate: [{ type: core.ContentChild, args: [DropdownValueTemplateDirective, { read: core.TemplateRef },] }],
1513
- hasCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown',] }],
1514
- hasHasValueCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--has-value',] }],
1515
- hasIsFocusedCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-focused',] }],
1516
- hasIsHoveredCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-hovered',] }],
1517
- hasIsDisabledCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-disabled',] }],
1518
- isSuccessType: [{ type: core.HostBinding, args: ['class.sg-dropdown--type-success',] }],
1519
- isErrorType: [{ type: core.HostBinding, args: ['class.sg-dropdown--type-error',] }],
1520
- isWarningType: [{ type: core.HostBinding, args: ['class.sg-dropdown--type-warning',] }],
1521
- isHighlightedState: [{ type: core.HostBinding, args: ['class.sg-dropdown--state-highlighted',] }],
1522
- hasIsLoadingCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-loading',] }],
1523
- hasHasResetCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--has-reset',] }],
1524
- hasIsOutlineCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-outline',] }],
1525
- hasSmallSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--size-small',] }],
1526
- hasMediumSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--size-medium',] }],
1527
- noItemsText: [{ type: core.Input }],
1528
- size: [{ type: core.Input }],
1529
- changed: [{ type: core.Output }]
1315
+ var DropdownComponent = /** @class */ (function (_super) {
1316
+ __extends(DropdownComponent, _super);
1317
+ function DropdownComponent(changeDetectorRef, _localizer) {
1318
+ var _this = _super.call(this, changeDetectorRef) || this;
1319
+ _this._localizer = _localizer;
1320
+ _this.defaultValue = null;
1321
+ _this._size = marcuraCommon.ControlSize.Medium;
1322
+ _this._localization = {
1323
+ noItemsText: 'No items found.',
1324
+ };
1325
+ _this.hasCssClass = true;
1326
+ _this.hasSmallSizeCssClass = false;
1327
+ _this.hasMediumSizeCssClass = true;
1328
+ _this.changed = new core.EventEmitter();
1329
+ _this._localize();
1330
+ return _this;
1331
+ }
1332
+ Object.defineProperty(DropdownComponent.prototype, "hasHasValueCssClass", {
1333
+ get: function () {
1334
+ return this.hasValue;
1335
+ },
1336
+ enumerable: false,
1337
+ configurable: true
1338
+ });
1339
+ Object.defineProperty(DropdownComponent.prototype, "hasIsFocusedCssClass", {
1340
+ get: function () {
1341
+ return this.isFocused;
1342
+ },
1343
+ enumerable: false,
1344
+ configurable: true
1345
+ });
1346
+ Object.defineProperty(DropdownComponent.prototype, "hasIsHoveredCssClass", {
1347
+ get: function () {
1348
+ return this._isHovered.value;
1349
+ },
1350
+ enumerable: false,
1351
+ configurable: true
1352
+ });
1353
+ Object.defineProperty(DropdownComponent.prototype, "hasIsDisabledCssClass", {
1354
+ get: function () {
1355
+ return this.isDisabled;
1356
+ },
1357
+ enumerable: false,
1358
+ configurable: true
1359
+ });
1360
+ Object.defineProperty(DropdownComponent.prototype, "isSuccessType", {
1361
+ get: function () {
1362
+ return this._isSuccessType;
1363
+ },
1364
+ enumerable: false,
1365
+ configurable: true
1366
+ });
1367
+ Object.defineProperty(DropdownComponent.prototype, "isErrorType", {
1368
+ get: function () {
1369
+ return this._isErrorType;
1370
+ },
1371
+ enumerable: false,
1372
+ configurable: true
1373
+ });
1374
+ Object.defineProperty(DropdownComponent.prototype, "isWarningType", {
1375
+ get: function () {
1376
+ return this._isWarningType;
1377
+ },
1378
+ enumerable: false,
1379
+ configurable: true
1380
+ });
1381
+ Object.defineProperty(DropdownComponent.prototype, "isHighlightedState", {
1382
+ get: function () {
1383
+ return this._isHighlightedState;
1384
+ },
1385
+ enumerable: false,
1386
+ configurable: true
1387
+ });
1388
+ Object.defineProperty(DropdownComponent.prototype, "hasIsLoadingCssClass", {
1389
+ get: function () {
1390
+ return this.isLoading;
1391
+ },
1392
+ enumerable: false,
1393
+ configurable: true
1394
+ });
1395
+ Object.defineProperty(DropdownComponent.prototype, "hasHasResetCssClass", {
1396
+ get: function () {
1397
+ return this.hasReset;
1398
+ },
1399
+ enumerable: false,
1400
+ configurable: true
1401
+ });
1402
+ Object.defineProperty(DropdownComponent.prototype, "hasIsOutlineCssClass", {
1403
+ get: function () {
1404
+ return this.isOutline;
1405
+ },
1406
+ enumerable: false,
1407
+ configurable: true
1408
+ });
1409
+ Object.defineProperty(DropdownComponent.prototype, "noItemsText", {
1410
+ get: function () {
1411
+ return this._noItemsText || this._localization.noItemsText;
1412
+ },
1413
+ set: function (noItemsText) {
1414
+ this._noItemsText = noItemsText;
1415
+ },
1416
+ enumerable: false,
1417
+ configurable: true
1418
+ });
1419
+ Object.defineProperty(DropdownComponent.prototype, "size", {
1420
+ get: function () {
1421
+ return this._size;
1422
+ },
1423
+ set: function (size) {
1424
+ if (size) {
1425
+ this._size = size;
1426
+ }
1427
+ this.hasSmallSizeCssClass = this._size === marcuraCommon.ControlSize.Small;
1428
+ this.hasMediumSizeCssClass = this._size === marcuraCommon.ControlSize.Medium;
1429
+ },
1430
+ enumerable: false,
1431
+ configurable: true
1432
+ });
1433
+ Object.defineProperty(DropdownComponent.prototype, "popupSettings", {
1434
+ get: function () {
1435
+ return {
1436
+ animate: true,
1437
+ popupClass: "sg-dropdown-popup " + (this.popupClass || ''),
1438
+ };
1439
+ },
1440
+ enumerable: false,
1441
+ configurable: true
1442
+ });
1443
+ DropdownComponent.prototype._emitChanged = function (value) {
1444
+ this.changed.emit(new DropdownChangedEvent(value));
1445
+ };
1446
+ DropdownComponent.prototype._localize = function () {
1447
+ var _this = this;
1448
+ if (!this._localizer) {
1449
+ return;
1450
+ }
1451
+ this._localization = this._localizer.localization;
1452
+ this._observer.listen(this._localizer.localizationChanged, function (localization) {
1453
+ _this._localization = localization;
1454
+ });
1455
+ };
1456
+ DropdownComponent.prototype.ngOnInit = function () {
1457
+ var _this = this;
1458
+ this._setComponent(this.component);
1459
+ this.init();
1460
+ // Opened.
1461
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () { return _this.opened.emit(); });
1462
+ // Closed.
1463
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return !event.isOpen; }), operators.skip(1)), function (event) {
1464
+ if (event.shouldEmit) {
1465
+ _this.closed.emit();
1466
+ }
1467
+ });
1468
+ };
1469
+ return DropdownComponent;
1470
+ }(AbstractDropdownComponent));
1471
+ DropdownComponent.decorators = [
1472
+ { type: core.Component, args: [{
1473
+ selector: 'sg-dropdown',
1474
+ template: "<kendo-dropdownlist\n #component\n [formControl]=\"valueFormControl\"\n [data]=\"items\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [loading]=\"isLoading\"\n [popupSettings]=\"popupSettings\"\n [listHeight]=\"listHeight\"\n [valuePrimitive]=\"isPrimitiveValue\"\n (valueChange)=\"onChanged($event)\"\n (open)=\"onOpened()\"\n (close)=\"onClosed()\"\n (focus)=\"onFocused()\"\n (blur)=\"onBlurred()\"\n>\n <ng-template *ngIf=\"itemTemplate\" kendoDropDownListItemTemplate let-dataItem>\n <span [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\"></span>\n </ng-template>\n <ng-template kendoDropDownListValueTemplate let-dataItem>\n <ng-container *ngIf=\"dataItem\">\n <ng-container *ngIf=\"valueTemplate\">\n <span [ngTemplateOutlet]=\"valueTemplate\" [ngTemplateOutletContext]=\"{value: dataItem}\"></span>\n </ng-container>\n <ng-container *ngIf=\"!valueTemplate\">{{ dataItem[textField] }}</ng-container>\n </ng-container>\n <ng-container *ngIf=\"!dataItem\">\n <span *ngIf=\"placeholder\" class=\"k-placeholder\">{{ placeholder }}</span>\n <ng-container *ngIf=\"!placeholder && valueTemplate\">\n <span [ngTemplateOutlet]=\"valueTemplate\" [ngTemplateOutletContext]=\"{value: dataItem}\"></span>\n </ng-container>\n </ng-container>\n </ng-template>\n <ng-template kendoDropDownListFooterTemplate>\n <sg-combobox-popup-footer [isNoItemsTextVisible]=\"items.length === 0\" [noItemsText]=\"noItemsText\">\n </sg-combobox-popup-footer>\n </ng-template>\n <ng-template kendoDropDownListNoDataTemplate></ng-template>\n</kendo-dropdownlist>\n<div class=\"sg-dropdown__reset\" *ngIf=\"!isDisabled\" (click)=\"onResetClicked()\">\n <i class=\"far fa-times\"></i>\n</div>\n<div class=\"sg-dropdown__state-line\"></div>\n",
1475
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1476
+ providers: [
1477
+ {
1478
+ provide: forms.NG_VALUE_ACCESSOR,
1479
+ useExisting: core.forwardRef(function () { return DropdownComponent; }),
1480
+ multi: true,
1481
+ },
1482
+ {
1483
+ provide: marcuraCommon.ABSTRACT_CONTROL_COMPONENT,
1484
+ useExisting: core.forwardRef(function () { return DropdownComponent; }),
1485
+ },
1486
+ {
1487
+ provide: marcuraCommon.OPENABLE_CONTROL_COMPONENT,
1488
+ useExisting: core.forwardRef(function () { return DropdownComponent; }),
1489
+ },
1490
+ {
1491
+ provide: marcuraCommon.STATEABLE_CONTROL_COMPONENT,
1492
+ useExisting: core.forwardRef(function () { return DropdownComponent; }),
1493
+ },
1494
+ {
1495
+ provide: marcuraCommon.TYPEABLE_CONTROL_COMPONENT,
1496
+ useExisting: core.forwardRef(function () { return DropdownComponent; }),
1497
+ },
1498
+ {
1499
+ provide: marcuraCommon.SIZEABLE_CONTROL_COMPONENT,
1500
+ useExisting: core.forwardRef(function () { return DropdownComponent; }),
1501
+ },
1502
+ ]
1503
+ },] }
1504
+ ];
1505
+ DropdownComponent.ctorParameters = function () { return [
1506
+ { type: core.ChangeDetectorRef },
1507
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DROPDOWN_LOCALIZER,] }] }
1508
+ ]; };
1509
+ DropdownComponent.propDecorators = {
1510
+ component: [{ type: core.ViewChild, args: ['component', { static: true },] }],
1511
+ itemTemplate: [{ type: core.ContentChild, args: [DropdownItemTemplateDirective, { read: core.TemplateRef },] }],
1512
+ valueTemplate: [{ type: core.ContentChild, args: [DropdownValueTemplateDirective, { read: core.TemplateRef },] }],
1513
+ hasCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown',] }],
1514
+ hasHasValueCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--has-value',] }],
1515
+ hasIsFocusedCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-focused',] }],
1516
+ hasIsHoveredCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-hovered',] }],
1517
+ hasIsDisabledCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-disabled',] }],
1518
+ isSuccessType: [{ type: core.HostBinding, args: ['class.sg-dropdown--type-success',] }],
1519
+ isErrorType: [{ type: core.HostBinding, args: ['class.sg-dropdown--type-error',] }],
1520
+ isWarningType: [{ type: core.HostBinding, args: ['class.sg-dropdown--type-warning',] }],
1521
+ isHighlightedState: [{ type: core.HostBinding, args: ['class.sg-dropdown--state-highlighted',] }],
1522
+ hasIsLoadingCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-loading',] }],
1523
+ hasHasResetCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--has-reset',] }],
1524
+ hasIsOutlineCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--is-outline',] }],
1525
+ hasSmallSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--size-small',] }],
1526
+ hasMediumSizeCssClass: [{ type: core.HostBinding, args: ['class.sg-dropdown--size-medium',] }],
1527
+ noItemsText: [{ type: core.Input }],
1528
+ size: [{ type: core.Input }],
1529
+ changed: [{ type: core.Output }]
1530
1530
  };
1531
1531
 
1532
- var MultiselectChangedEvent = /** @class */ (function (_super) {
1533
- __extends(MultiselectChangedEvent, _super);
1534
- function MultiselectChangedEvent() {
1535
- return _super !== null && _super.apply(this, arguments) || this;
1536
- }
1537
- return MultiselectChangedEvent;
1532
+ var MultiselectChangedEvent = /** @class */ (function (_super) {
1533
+ __extends(MultiselectChangedEvent, _super);
1534
+ function MultiselectChangedEvent() {
1535
+ return _super !== null && _super.apply(this, arguments) || this;
1536
+ }
1537
+ return MultiselectChangedEvent;
1538
1538
  }(marcuraCommon.ControlChangedEvent));
1539
1539
 
1540
- var MultiselectComponent = /** @class */ (function (_super) {
1541
- __extends(MultiselectComponent, _super);
1542
- function MultiselectComponent(changeDetectorRef, renderer, _localizer) {
1543
- var _this = _super.call(this, changeDetectorRef, renderer) || this;
1544
- _this._localizer = _localizer;
1545
- _this._localization = {
1546
- loadingText: 'Loading...',
1547
- noItemsText: 'No items found.',
1548
- minSearchText: 'Enter {minSearchCharacters} or more characters.',
1549
- };
1550
- _this.defaultValue = [];
1551
- _this.hasCssClass = true;
1552
- _this.changed = new core.EventEmitter();
1553
- _this.isReadOnlyTag = null;
1554
- _this.isActivatedTag = function () { return false; };
1555
- _this.tagColor = function () { return null; };
1556
- _this._localize();
1557
- return _this;
1558
- }
1559
- Object.defineProperty(MultiselectComponent.prototype, "hasValue", {
1560
- get: function () {
1561
- return this.valueFormControl.value && this.valueFormControl.value.length > 0;
1562
- },
1563
- enumerable: false,
1564
- configurable: true
1565
- });
1566
- Object.defineProperty(MultiselectComponent.prototype, "hasIsFocusedCssClass", {
1567
- get: function () {
1568
- return this.isFocused;
1569
- },
1570
- enumerable: false,
1571
- configurable: true
1572
- });
1573
- Object.defineProperty(MultiselectComponent.prototype, "hasIsHoveredCssClass", {
1574
- get: function () {
1575
- return this._isHovered.value;
1576
- },
1577
- enumerable: false,
1578
- configurable: true
1579
- });
1580
- Object.defineProperty(MultiselectComponent.prototype, "hasIsDisabledCssClass", {
1581
- get: function () {
1582
- return this.isDisabled;
1583
- },
1584
- enumerable: false,
1585
- configurable: true
1586
- });
1587
- Object.defineProperty(MultiselectComponent.prototype, "isSuccessType", {
1588
- get: function () {
1589
- return this._isSuccessType;
1590
- },
1591
- enumerable: false,
1592
- configurable: true
1593
- });
1594
- Object.defineProperty(MultiselectComponent.prototype, "isErrorType", {
1595
- get: function () {
1596
- return this._isErrorType;
1597
- },
1598
- enumerable: false,
1599
- configurable: true
1600
- });
1601
- Object.defineProperty(MultiselectComponent.prototype, "isWarningType", {
1602
- get: function () {
1603
- return this._isWarningType;
1604
- },
1605
- enumerable: false,
1606
- configurable: true
1607
- });
1608
- Object.defineProperty(MultiselectComponent.prototype, "isHighlightedState", {
1609
- get: function () {
1610
- return this._isHighlightedState;
1611
- },
1612
- enumerable: false,
1613
- configurable: true
1614
- });
1615
- Object.defineProperty(MultiselectComponent.prototype, "hasIsLoadingCssClass", {
1616
- get: function () {
1617
- return this.isLoading || this._isSearching.value;
1618
- },
1619
- enumerable: false,
1620
- configurable: true
1621
- });
1622
- Object.defineProperty(MultiselectComponent.prototype, "hasHasResetCssClass", {
1623
- get: function () {
1624
- return this.hasReset;
1625
- },
1626
- enumerable: false,
1627
- configurable: true
1628
- });
1629
- Object.defineProperty(MultiselectComponent.prototype, "hasIsOutlineCssClass", {
1630
- get: function () {
1631
- return this.isOutline;
1632
- },
1633
- enumerable: false,
1634
- configurable: true
1635
- });
1636
- Object.defineProperty(MultiselectComponent.prototype, "loadingText", {
1637
- get: function () {
1638
- return this._loadingText || this._localization.loadingText;
1639
- },
1640
- set: function (loadingText) {
1641
- this._loadingText = loadingText;
1642
- },
1643
- enumerable: false,
1644
- configurable: true
1645
- });
1646
- Object.defineProperty(MultiselectComponent.prototype, "noItemsText", {
1647
- get: function () {
1648
- return this._noItemsText || this._localization.noItemsText;
1649
- },
1650
- set: function (noItemsText) {
1651
- this._noItemsText = noItemsText;
1652
- },
1653
- enumerable: false,
1654
- configurable: true
1655
- });
1656
- Object.defineProperty(MultiselectComponent.prototype, "minSearchText", {
1657
- get: function () {
1658
- return this._minSearchText || this._localization.minSearchText;
1659
- },
1660
- set: function (minSearchText) {
1661
- this._minSearchText = minSearchText;
1662
- },
1663
- enumerable: false,
1664
- configurable: true
1665
- });
1666
- Object.defineProperty(MultiselectComponent.prototype, "popupSettings", {
1667
- get: function () {
1668
- return {
1669
- animate: true,
1670
- popupClass: "sg-multiselect-popup" + (this.isGroupable ? ' sg-multiselect-popup--is-groupable' : '') + " " + (this.popupClass || ''),
1671
- };
1672
- },
1673
- enumerable: false,
1674
- configurable: true
1675
- });
1676
- MultiselectComponent.prototype._emitChanged = function (value) {
1677
- this.changed.emit(new MultiselectChangedEvent(value));
1678
- };
1679
- MultiselectComponent.prototype.hasValueChanged = function (value) {
1680
- var _this = this;
1681
- var isOldValueEmpty = this.value === null || this.value === undefined || this.value.length === 0;
1682
- var isNewValueEmpty = value === null || value === undefined || value.length === 0;
1683
- if (isOldValueEmpty && isNewValueEmpty) {
1684
- return false;
1685
- }
1686
- if (isOldValueEmpty || isNewValueEmpty) {
1687
- return true;
1688
- }
1689
- return (this.value.length !== value.length || this.value.some(function (item, index) { return !_this.isItemEqual(item, value[index]); }));
1690
- };
1691
- MultiselectComponent.prototype._localize = function () {
1692
- var _this = this;
1693
- if (!this._localizer) {
1694
- return;
1695
- }
1696
- this._localization = this._localizer.localization;
1697
- this._observer.listen(this._localizer.localizationChanged, function (localization) {
1698
- _this._localization = localization;
1699
- });
1700
- };
1701
- MultiselectComponent.prototype.ngOnInit = function () {
1702
- var _this = this;
1703
- this._setComponent(this.component);
1704
- this.init();
1705
- // Opened.
1706
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () {
1707
- _this._hasSearched.next(false);
1708
- if (!_this.areItemsCached && _this._loadedItems.value.length === 0) {
1709
- _this.loadItems(_this._searchText.value);
1710
- }
1711
- });
1712
- this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () { return _this.opened.emit(); });
1713
- };
1714
- return MultiselectComponent;
1715
- }(AbstractComboboxComponent));
1716
- MultiselectComponent.decorators = [
1717
- { type: core.Component, args: [{
1718
- selector: 'sg-multiselect',
1719
- template: "<kendo-multiselect\n #component\n [placeholder]=\"placeholder\"\n [formControl]=\"valueFormControl\"\n [data]=\"combinedItems | async\"\n [filterable]=\"isSearchable\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [loading]=\"isLoadingSpinnerVisible | async\"\n [clearButton]=\"false\"\n [popupSettings]=\"popupSettings\"\n [listHeight]=\"listHeight\"\n [valuePrimitive]=\"isPrimitiveValue\"\n (filterChange)=\"onSearched($event)\"\n (valueChange)=\"onChanged($event)\"\n (open)=\"onOpened()\"\n (close)=\"onClosed()\"\n (focus)=\"onFocused()\"\n (blur)=\"onBlurred()\"\n>\n <ng-template kendoDropDownListFooterTemplate>\n <sg-combobox-popup-footer\n [isLoadingTextVisible]=\"isLoadingTextVisible | async\"\n [isNoItemsTextVisible]=\"isNoItemsTextVisible | async\"\n [isMinSearchTextVisible]=\"isMinSearchTextVisible | async\"\n [loadingText]=\"loadingText\"\n [noItemsText]=\"noItemsText\"\n [minSearchText]=\"minSearchText\"\n [minSearchCharacters]=\"minSearchCharacters\"\n >\n </sg-combobox-popup-footer>\n </ng-template>\n <ng-template kendoDropDownListNoDataTemplate></ng-template>\n <ng-template *ngIf=\"itemTemplate\" kendoMultiSelectItemTemplate let-dataItem>\n <span [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\"></span>\n </ng-template>\n <ng-template kendoMultiSelectTagTemplate let-dataItem>\n <span\n #tagWrapper=\"multiselectTagWrapper\"\n sgMultiselectTagWrapper\n [isReadOnly]=\"isReadOnlyTag && isReadOnlyTag(dataItem)\"\n >\n <sg-tag\n [icon]=\"tagWrapper.isReadOnly ? '' : 'far fa-times'\"\n [color]=\"tagColor(dataItem)\"\n [isActivated]=\"isActivatedTag(dataItem)\"\n >\n <ng-container *ngIf=\"tagTemplate\" [ngTemplateOutlet]=\"tagTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\">\n </ng-container>\n <ng-container *ngIf=\"!tagTemplate\">{{ dataItem[textField] }}</ng-container>\n </sg-tag>\n </span>\n </ng-template>\n</kendo-multiselect>\n<div class=\"sg-multiselect__reset\" *ngIf=\"!isDisabled\" (click)=\"onResetClicked()\">\n <i class=\"far fa-times\"></i>\n</div>\n<div class=\"sg-multiselect__state-line\"></div>\n",
1720
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1721
- providers: [
1722
- {
1723
- provide: forms.NG_VALUE_ACCESSOR,
1724
- useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1725
- multi: true,
1726
- },
1727
- {
1728
- provide: marcuraCommon.ABSTRACT_CONTROL_COMPONENT,
1729
- useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1730
- },
1731
- {
1732
- provide: marcuraCommon.OPENABLE_CONTROL_COMPONENT,
1733
- useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1734
- },
1735
- {
1736
- provide: marcuraCommon.STATEABLE_CONTROL_COMPONENT,
1737
- useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1738
- },
1739
- {
1740
- provide: marcuraCommon.TYPEABLE_CONTROL_COMPONENT,
1741
- useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1742
- },
1743
- ]
1744
- },] }
1745
- ];
1746
- MultiselectComponent.ctorParameters = function () { return [
1747
- { type: core.ChangeDetectorRef },
1748
- { type: core.Renderer2 },
1749
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MULTISELECT_LOCALIZER,] }] }
1750
- ]; };
1751
- MultiselectComponent.propDecorators = {
1752
- component: [{ type: core.ViewChild, args: ['component', { static: true },] }],
1753
- itemTemplate: [{ type: core.ContentChild, args: [MultiselectItemTemplateDirective, { read: core.TemplateRef, static: true },] }],
1754
- tagTemplate: [{ type: core.ContentChild, args: [MultiselectTagTemplateDirective, { read: core.TemplateRef, static: true },] }],
1755
- hasCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect',] }],
1756
- hasValue: [{ type: core.HostBinding, args: ['class.sg-multiselect--has-value',] }],
1757
- hasIsFocusedCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-focused',] }],
1758
- hasIsHoveredCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-hovered',] }],
1759
- hasIsDisabledCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-disabled',] }],
1760
- isSuccessType: [{ type: core.HostBinding, args: ['class.sg-multiselect--type-success',] }],
1761
- isErrorType: [{ type: core.HostBinding, args: ['class.sg-multiselect--type-error',] }],
1762
- isWarningType: [{ type: core.HostBinding, args: ['class.sg-multiselect--type-warning',] }],
1763
- isHighlightedState: [{ type: core.HostBinding, args: ['class.sg-multiselect--state-highlighted',] }],
1764
- hasIsLoadingCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-loading',] }],
1765
- hasHasResetCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--has-reset',] }],
1766
- hasIsOutlineCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-outline',] }],
1767
- loadingText: [{ type: core.Input }],
1768
- noItemsText: [{ type: core.Input }],
1769
- minSearchText: [{ type: core.Input }],
1770
- changed: [{ type: core.Output }],
1771
- isReadOnlyTag: [{ type: core.Input }],
1772
- isActivatedTag: [{ type: core.Input }],
1773
- tagColor: [{ type: core.Input }]
1540
+ var MultiselectComponent = /** @class */ (function (_super) {
1541
+ __extends(MultiselectComponent, _super);
1542
+ function MultiselectComponent(changeDetectorRef, renderer, _localizer) {
1543
+ var _this = _super.call(this, changeDetectorRef, renderer) || this;
1544
+ _this._localizer = _localizer;
1545
+ _this._localization = {
1546
+ loadingText: 'Loading...',
1547
+ noItemsText: 'No items found.',
1548
+ minSearchText: 'Enter {minSearchCharacters} or more characters.',
1549
+ };
1550
+ _this.defaultValue = [];
1551
+ _this.hasCssClass = true;
1552
+ _this.allowCustom = false;
1553
+ _this.changed = new core.EventEmitter();
1554
+ _this.isReadOnlyTag = null;
1555
+ _this.isActivatedTag = function () { return false; };
1556
+ _this.tagColor = function () { return null; };
1557
+ /**
1558
+ * This field contains factory method for items which will be created placing customizable values inside component. Works when allowCustom is true.
1559
+ *
1560
+ * @memberof MultiselectComponent
1561
+ */
1562
+ _this.itemFactory = function (text) {
1563
+ var _c;
1564
+ return _c = {}, _c[_this.valueField] = null, _c[_this.textField] = text, _c;
1565
+ };
1566
+ _this.valueNormalizer = function (text$) { return text$.pipe(operators.map(function () {
1567
+ var _a, _b;
1568
+ var value = null;
1569
+ if (!_this.component) {
1570
+ return value;
1571
+ }
1572
+ // Can't use this._searchText.value here as it might be empty, consider:
1573
+ // 1) type custom text, 2) focus out and back in 3) there's a text in searchbar,
1574
+ // but this._searchText.value is empty.
1575
+ // So this.component.searchbar.value is to be used.
1576
+ var text = (_this.component.searchbar.value || '').trim();
1577
+ if (!text) {
1578
+ return value;
1579
+ }
1580
+ var matchingValue = (_b = (_a = _this.component.value) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item[_this.textField].toLowerCase() === text.toLowerCase(); })) !== null && _b !== void 0 ? _b : null;
1581
+ // Handle case when value already contains items that match the search text.
1582
+ if (matchingValue) {
1583
+ value = matchingValue;
1584
+ }
1585
+ // If no matches found in the selected values, check if item is in cache.
1586
+ else if (_this.getItem(_this._valueNormalizerItems, text)) {
1587
+ // If areItemsCached is off, then this.data will be lost by this moment,
1588
+ // so we use a cache this.valueNormalizerItems.
1589
+ // This is relevant especially in IE/Edge where this.component.value is null,
1590
+ // so the code falls back to this condition section.
1591
+ value = _this.getItem(_this._valueNormalizerItems, text);
1592
+ }
1593
+ // If no match is found and custom values are allowed, create a new custom item
1594
+ else if (_this.allowCustom) {
1595
+ value = _this.itemFactory(text);
1596
+ if (_this._isSync) {
1597
+ // Restore original items after selection, otherwise when opening the list
1598
+ // next time, only the selected item will appear.
1599
+ _this.loadItems();
1600
+ }
1601
+ }
1602
+ else {
1603
+ // Clears search text if suggestion hasn't been selected.
1604
+ // Steps to reproduce.
1605
+ // 1. Use Dymanic Empty sample.
1606
+ // 2. Type 'to', wait for the list to load, but don't select 'Tokai'. Instead hit Esc key.
1607
+ // 3. See that the search bar still contains 'to' text, while the value is null,
1608
+ // which is wrong - search bar text should be removed.
1609
+ // this.component.searchbar.suggestedText = ''; // This doesn't work.
1610
+ // As the above line doesn't work, so workaround it by setting form control value to null.
1611
+ _this.valueFormControl.setValue(value);
1612
+ }
1613
+ _this._valueNormalizerItems = [];
1614
+ return value;
1615
+ })); };
1616
+ _this._localize();
1617
+ return _this;
1618
+ }
1619
+ Object.defineProperty(MultiselectComponent.prototype, "hasValue", {
1620
+ get: function () {
1621
+ return this.valueFormControl.value && this.valueFormControl.value.length > 0;
1622
+ },
1623
+ enumerable: false,
1624
+ configurable: true
1625
+ });
1626
+ Object.defineProperty(MultiselectComponent.prototype, "hasIsFocusedCssClass", {
1627
+ get: function () {
1628
+ return this.isFocused;
1629
+ },
1630
+ enumerable: false,
1631
+ configurable: true
1632
+ });
1633
+ Object.defineProperty(MultiselectComponent.prototype, "hasIsHoveredCssClass", {
1634
+ get: function () {
1635
+ return this._isHovered.value;
1636
+ },
1637
+ enumerable: false,
1638
+ configurable: true
1639
+ });
1640
+ Object.defineProperty(MultiselectComponent.prototype, "hasIsDisabledCssClass", {
1641
+ get: function () {
1642
+ return this.isDisabled;
1643
+ },
1644
+ enumerable: false,
1645
+ configurable: true
1646
+ });
1647
+ Object.defineProperty(MultiselectComponent.prototype, "isSuccessType", {
1648
+ get: function () {
1649
+ return this._isSuccessType;
1650
+ },
1651
+ enumerable: false,
1652
+ configurable: true
1653
+ });
1654
+ Object.defineProperty(MultiselectComponent.prototype, "isErrorType", {
1655
+ get: function () {
1656
+ return this._isErrorType;
1657
+ },
1658
+ enumerable: false,
1659
+ configurable: true
1660
+ });
1661
+ Object.defineProperty(MultiselectComponent.prototype, "isWarningType", {
1662
+ get: function () {
1663
+ return this._isWarningType;
1664
+ },
1665
+ enumerable: false,
1666
+ configurable: true
1667
+ });
1668
+ Object.defineProperty(MultiselectComponent.prototype, "isHighlightedState", {
1669
+ get: function () {
1670
+ return this._isHighlightedState;
1671
+ },
1672
+ enumerable: false,
1673
+ configurable: true
1674
+ });
1675
+ Object.defineProperty(MultiselectComponent.prototype, "hasIsLoadingCssClass", {
1676
+ get: function () {
1677
+ return this.isLoading || this._isSearching.value;
1678
+ },
1679
+ enumerable: false,
1680
+ configurable: true
1681
+ });
1682
+ Object.defineProperty(MultiselectComponent.prototype, "hasHasResetCssClass", {
1683
+ get: function () {
1684
+ return this.hasReset;
1685
+ },
1686
+ enumerable: false,
1687
+ configurable: true
1688
+ });
1689
+ Object.defineProperty(MultiselectComponent.prototype, "hasIsOutlineCssClass", {
1690
+ get: function () {
1691
+ return this.isOutline;
1692
+ },
1693
+ enumerable: false,
1694
+ configurable: true
1695
+ });
1696
+ Object.defineProperty(MultiselectComponent.prototype, "loadingText", {
1697
+ get: function () {
1698
+ return this._loadingText || this._localization.loadingText;
1699
+ },
1700
+ set: function (loadingText) {
1701
+ this._loadingText = loadingText;
1702
+ },
1703
+ enumerable: false,
1704
+ configurable: true
1705
+ });
1706
+ Object.defineProperty(MultiselectComponent.prototype, "noItemsText", {
1707
+ get: function () {
1708
+ return this._noItemsText || this._localization.noItemsText;
1709
+ },
1710
+ set: function (noItemsText) {
1711
+ this._noItemsText = noItemsText;
1712
+ },
1713
+ enumerable: false,
1714
+ configurable: true
1715
+ });
1716
+ Object.defineProperty(MultiselectComponent.prototype, "minSearchText", {
1717
+ get: function () {
1718
+ return this._minSearchText || this._localization.minSearchText;
1719
+ },
1720
+ set: function (minSearchText) {
1721
+ this._minSearchText = minSearchText;
1722
+ },
1723
+ enumerable: false,
1724
+ configurable: true
1725
+ });
1726
+ Object.defineProperty(MultiselectComponent.prototype, "popupSettings", {
1727
+ get: function () {
1728
+ return {
1729
+ animate: true,
1730
+ popupClass: "sg-multiselect-popup" + (this.isGroupable ? ' sg-multiselect-popup--is-groupable' : '') + " " + (this.popupClass || ''),
1731
+ };
1732
+ },
1733
+ enumerable: false,
1734
+ configurable: true
1735
+ });
1736
+ MultiselectComponent.prototype._emitChanged = function (value) {
1737
+ this.changed.emit(new MultiselectChangedEvent(value));
1738
+ };
1739
+ MultiselectComponent.prototype.hasValueChanged = function (value) {
1740
+ var _this = this;
1741
+ var isOldValueEmpty = this.value === null || this.value === undefined || this.value.length === 0;
1742
+ var isNewValueEmpty = value === null || value === undefined || value.length === 0;
1743
+ if (isOldValueEmpty && isNewValueEmpty) {
1744
+ return false;
1745
+ }
1746
+ if (isOldValueEmpty || isNewValueEmpty) {
1747
+ return true;
1748
+ }
1749
+ return (this.value.length !== value.length || this.value.some(function (item, index) { return !_this.isItemEqual(item, value[index]); }));
1750
+ };
1751
+ MultiselectComponent.prototype._localize = function () {
1752
+ var _this = this;
1753
+ if (!this._localizer) {
1754
+ return;
1755
+ }
1756
+ this._localization = this._localizer.localization;
1757
+ this._observer.listen(this._localizer.localizationChanged, function (localization) {
1758
+ _this._localization = localization;
1759
+ });
1760
+ };
1761
+ MultiselectComponent.prototype.ngOnInit = function () {
1762
+ var _this = this;
1763
+ this._setComponent(this.component);
1764
+ this.init();
1765
+ // Opened.
1766
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () {
1767
+ _this._hasSearched.next(false);
1768
+ if (!_this.areItemsCached && _this._loadedItems.value.length === 0) {
1769
+ _this.loadItems(_this._searchText.value);
1770
+ }
1771
+ });
1772
+ this._observer.listen(this._isOpen.pipe(operators.filter(function (event) { return event.isOpen; })), function () { return _this.opened.emit(); });
1773
+ };
1774
+ return MultiselectComponent;
1775
+ }(AbstractComboboxComponent));
1776
+ MultiselectComponent.decorators = [
1777
+ { type: core.Component, args: [{
1778
+ selector: 'sg-multiselect',
1779
+ template: "<kendo-multiselect\n #component\n [placeholder]=\"placeholder\"\n [formControl]=\"valueFormControl\"\n [data]=\"combinedItems | async\"\n [filterable]=\"isSearchable\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [loading]=\"isLoadingSpinnerVisible | async\"\n [clearButton]=\"false\"\n [popupSettings]=\"popupSettings\"\n [listHeight]=\"listHeight\"\n [valuePrimitive]=\"isPrimitiveValue\"\n [allowCustom]=\"allowCustom\"\n [valueNormalizer]=\"valueNormalizer\"\n (filterChange)=\"onSearched($event)\"\n (valueChange)=\"onChanged($event)\"\n (open)=\"onOpened()\"\n (close)=\"onClosed()\"\n (focus)=\"onFocused()\"\n (blur)=\"onBlurred()\"\n>\n <ng-template kendoDropDownListFooterTemplate>\n <sg-combobox-popup-footer\n [isLoadingTextVisible]=\"isLoadingTextVisible | async\"\n [isNoItemsTextVisible]=\"isNoItemsTextVisible | async\"\n [isMinSearchTextVisible]=\"isMinSearchTextVisible | async\"\n [loadingText]=\"loadingText\"\n [noItemsText]=\"noItemsText\"\n [minSearchText]=\"minSearchText\"\n [minSearchCharacters]=\"minSearchCharacters\"\n >\n </sg-combobox-popup-footer>\n </ng-template>\n <ng-template kendoDropDownListNoDataTemplate></ng-template>\n <ng-template *ngIf=\"itemTemplate\" kendoMultiSelectItemTemplate let-dataItem>\n <span [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\"></span>\n </ng-template>\n <ng-template kendoMultiSelectTagTemplate let-dataItem>\n <span\n #tagWrapper=\"multiselectTagWrapper\"\n sgMultiselectTagWrapper\n [isReadOnly]=\"isReadOnlyTag && isReadOnlyTag(dataItem)\"\n >\n <sg-tag\n [icon]=\"tagWrapper.isReadOnly ? '' : 'far fa-times'\"\n [color]=\"tagColor(dataItem)\"\n [isActivated]=\"isActivatedTag(dataItem)\"\n >\n <ng-container *ngIf=\"tagTemplate\" [ngTemplateOutlet]=\"tagTemplate\" [ngTemplateOutletContext]=\"{item: dataItem}\">\n </ng-container>\n <ng-container *ngIf=\"!tagTemplate\">{{ dataItem[textField] }}</ng-container>\n </sg-tag>\n </span>\n </ng-template>\n</kendo-multiselect>\n<div class=\"sg-multiselect__reset\" *ngIf=\"!isDisabled\" (click)=\"onResetClicked()\">\n <i class=\"far fa-times\"></i>\n</div>\n<div class=\"sg-multiselect__state-line\"></div>\n",
1780
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1781
+ providers: [
1782
+ {
1783
+ provide: forms.NG_VALUE_ACCESSOR,
1784
+ useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1785
+ multi: true,
1786
+ },
1787
+ {
1788
+ provide: marcuraCommon.ABSTRACT_CONTROL_COMPONENT,
1789
+ useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1790
+ },
1791
+ {
1792
+ provide: marcuraCommon.OPENABLE_CONTROL_COMPONENT,
1793
+ useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1794
+ },
1795
+ {
1796
+ provide: marcuraCommon.STATEABLE_CONTROL_COMPONENT,
1797
+ useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1798
+ },
1799
+ {
1800
+ provide: marcuraCommon.TYPEABLE_CONTROL_COMPONENT,
1801
+ useExisting: core.forwardRef(function () { return MultiselectComponent; }),
1802
+ },
1803
+ ]
1804
+ },] }
1805
+ ];
1806
+ MultiselectComponent.ctorParameters = function () { return [
1807
+ { type: core.ChangeDetectorRef },
1808
+ { type: core.Renderer2 },
1809
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MULTISELECT_LOCALIZER,] }] }
1810
+ ]; };
1811
+ MultiselectComponent.propDecorators = {
1812
+ component: [{ type: core.ViewChild, args: ['component', { static: true },] }],
1813
+ itemTemplate: [{ type: core.ContentChild, args: [MultiselectItemTemplateDirective, { read: core.TemplateRef, static: true },] }],
1814
+ tagTemplate: [{ type: core.ContentChild, args: [MultiselectTagTemplateDirective, { read: core.TemplateRef, static: true },] }],
1815
+ hasCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect',] }],
1816
+ hasValue: [{ type: core.HostBinding, args: ['class.sg-multiselect--has-value',] }],
1817
+ hasIsFocusedCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-focused',] }],
1818
+ hasIsHoveredCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-hovered',] }],
1819
+ hasIsDisabledCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-disabled',] }],
1820
+ isSuccessType: [{ type: core.HostBinding, args: ['class.sg-multiselect--type-success',] }],
1821
+ isErrorType: [{ type: core.HostBinding, args: ['class.sg-multiselect--type-error',] }],
1822
+ isWarningType: [{ type: core.HostBinding, args: ['class.sg-multiselect--type-warning',] }],
1823
+ isHighlightedState: [{ type: core.HostBinding, args: ['class.sg-multiselect--state-highlighted',] }],
1824
+ hasIsLoadingCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-loading',] }],
1825
+ hasHasResetCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--has-reset',] }],
1826
+ hasIsOutlineCssClass: [{ type: core.HostBinding, args: ['class.sg-multiselect--is-outline',] }],
1827
+ loadingText: [{ type: core.Input }],
1828
+ noItemsText: [{ type: core.Input }],
1829
+ minSearchText: [{ type: core.Input }],
1830
+ allowCustom: [{ type: core.Input }],
1831
+ changed: [{ type: core.Output }],
1832
+ isReadOnlyTag: [{ type: core.Input }],
1833
+ isActivatedTag: [{ type: core.Input }],
1834
+ tagColor: [{ type: core.Input }],
1835
+ itemFactory: [{ type: core.Input }]
1774
1836
  };
1775
1837
 
1776
- var components = [
1777
- AbstractComboboxComponent,
1778
- AbstractDropdownComponent,
1779
- ComboboxComponent,
1780
- ComboboxPopupFooterComponent,
1781
- MultiselectComponent,
1782
- DropdownComponent,
1783
- ];
1784
- var directives = [
1785
- ComboboxItemTemplateDirective,
1786
- MultiselectItemTemplateDirective,
1787
- MultiselectTagTemplateDirective,
1788
- MultiselectTagWrapperDirective,
1789
- DropdownItemTemplateDirective,
1790
- DropdownValueTemplateDirective,
1791
- ];
1792
- function getPopupContainer() {
1793
- return { nativeElement: document.body };
1794
- }
1795
- var ComboboxModule = /** @class */ (function () {
1796
- function ComboboxModule() {
1797
- }
1798
- return ComboboxModule;
1799
- }());
1800
- ComboboxModule.decorators = [
1801
- { type: core.NgModule, args: [{
1802
- declarations: __spread(components, directives),
1803
- imports: [
1804
- common.CommonModule,
1805
- forms.ReactiveFormsModule,
1806
- kendoAngularDropdowns.ComboBoxModule,
1807
- kendoAngularDropdowns.MultiSelectModule,
1808
- kendoAngularPopup.PopupModule,
1809
- marcuraTag.TagModule,
1810
- kendoAngularDropdowns.DropDownListModule,
1811
- ],
1812
- exports: __spread(components, directives),
1813
- providers: [
1814
- {
1815
- provide: kendoAngularPopup.POPUP_CONTAINER,
1816
- useFactory: getPopupContainer,
1817
- },
1818
- ],
1819
- },] }
1838
+ var components = [
1839
+ AbstractComboboxComponent,
1840
+ AbstractDropdownComponent,
1841
+ ComboboxComponent,
1842
+ ComboboxPopupFooterComponent,
1843
+ MultiselectComponent,
1844
+ DropdownComponent,
1845
+ ];
1846
+ var directives = [
1847
+ ComboboxItemTemplateDirective,
1848
+ MultiselectItemTemplateDirective,
1849
+ MultiselectTagTemplateDirective,
1850
+ MultiselectTagWrapperDirective,
1851
+ DropdownItemTemplateDirective,
1852
+ DropdownValueTemplateDirective,
1853
+ ];
1854
+ function getPopupContainer() {
1855
+ return { nativeElement: document.body };
1856
+ }
1857
+ var ComboboxModule = /** @class */ (function () {
1858
+ function ComboboxModule() {
1859
+ }
1860
+ return ComboboxModule;
1861
+ }());
1862
+ ComboboxModule.decorators = [
1863
+ { type: core.NgModule, args: [{
1864
+ declarations: __spread(components, directives),
1865
+ imports: [
1866
+ common.CommonModule,
1867
+ forms.ReactiveFormsModule,
1868
+ kendoAngularDropdowns.ComboBoxModule,
1869
+ kendoAngularDropdowns.MultiSelectModule,
1870
+ kendoAngularPopup.PopupModule,
1871
+ marcuraTag.TagModule,
1872
+ kendoAngularDropdowns.DropDownListModule,
1873
+ ],
1874
+ exports: __spread(components, directives),
1875
+ providers: [
1876
+ {
1877
+ provide: kendoAngularPopup.POPUP_CONTAINER,
1878
+ useFactory: getPopupContainer,
1879
+ },
1880
+ ],
1881
+ },] }
1820
1882
  ];
1821
1883
 
1822
- /**
1823
- * Generated bundle index. Do not edit.
1884
+ /**
1885
+ * Generated bundle index. Do not edit.
1824
1886
  */
1825
1887
 
1826
1888
  exports.AbstractComboboxComponent = AbstractComboboxComponent;