ngx-dropdown-list 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +2 -2
  2. package/esm2020/ngx-dropdown-list.mjs +5 -0
  3. package/esm2020/public_api.mjs +2 -0
  4. package/esm2020/src/ngx-dropdown-list/anchor/anchor.component.mjs +149 -0
  5. package/esm2020/src/ngx-dropdown-list/dropdown/dropdown.component.mjs +252 -0
  6. package/esm2020/src/ngx-dropdown-list/dropdown-list.component.mjs +233 -0
  7. package/esm2020/src/ngx-dropdown-list/dropdown-list.module.mjs +38 -0
  8. package/esm2020/src/ngx-dropdown-list/filter/input-filter.component.mjs +44 -0
  9. package/esm2020/src/ngx-dropdown-list/group-item/group-item.component.mjs +25 -0
  10. package/esm2020/src/ngx-dropdown-list/index.mjs +3 -0
  11. package/esm2020/src/ngx-dropdown-list/item/item.component.mjs +77 -0
  12. package/esm2020/src/ngx-dropdown-list/types/index.mjs +3 -0
  13. package/esm2020/src/ngx-dropdown-list/types/selection-group-items.types.mjs +2 -0
  14. package/esm2020/src/ngx-dropdown-list/types/selection-item.types.mjs +2 -0
  15. package/esm2020/src/ngx-dropdown-list/utils/util.mjs +59 -0
  16. package/fesm2015/ngx-dropdown-list.mjs +854 -0
  17. package/fesm2015/ngx-dropdown-list.mjs.map +1 -0
  18. package/fesm2020/ngx-dropdown-list.mjs +854 -0
  19. package/fesm2020/ngx-dropdown-list.mjs.map +1 -0
  20. package/ngx-dropdown-list.d.ts +1 -5
  21. package/package.json +26 -48
  22. package/src/ngx-dropdown-list/anchor/anchor.component.d.ts +6 -3
  23. package/src/ngx-dropdown-list/dropdown/dropdown.component.d.ts +5 -2
  24. package/src/ngx-dropdown-list/dropdown-list.component.d.ts +7 -4
  25. package/src/ngx-dropdown-list/dropdown-list.module.d.ts +12 -0
  26. package/src/ngx-dropdown-list/filter/input-filter.component.d.ts +3 -0
  27. package/src/ngx-dropdown-list/group-item/group-item.component.d.ts +3 -0
  28. package/src/ngx-dropdown-list/item/item.component.d.ts +3 -0
  29. package/bundles/ngx-dropdown-list.umd.js +0 -1212
  30. package/bundles/ngx-dropdown-list.umd.js.map +0 -1
  31. package/bundles/ngx-dropdown-list.umd.min.js +0 -2
  32. package/bundles/ngx-dropdown-list.umd.min.js.map +0 -1
  33. package/esm2015/ngx-dropdown-list.js +0 -14
  34. package/esm2015/public_api.js +0 -6
  35. package/esm2015/src/ngx-dropdown-list/anchor/anchor.component.js +0 -226
  36. package/esm2015/src/ngx-dropdown-list/dropdown/dropdown.component.js +0 -351
  37. package/esm2015/src/ngx-dropdown-list/dropdown-list.component.js +0 -290
  38. package/esm2015/src/ngx-dropdown-list/dropdown-list.module.js +0 -32
  39. package/esm2015/src/ngx-dropdown-list/filter/input-filter.component.js +0 -64
  40. package/esm2015/src/ngx-dropdown-list/group-item/group-item.component.js +0 -37
  41. package/esm2015/src/ngx-dropdown-list/index.js +0 -7
  42. package/esm2015/src/ngx-dropdown-list/item/item.component.js +0 -104
  43. package/esm2015/src/ngx-dropdown-list/types/index.js +0 -7
  44. package/esm2015/src/ngx-dropdown-list/types/selection-group-items.types.js +0 -16
  45. package/esm2015/src/ngx-dropdown-list/types/selection-item.types.js +0 -20
  46. package/esm2015/src/ngx-dropdown-list/utils/util.js +0 -101
  47. package/esm5/ngx-dropdown-list.js +0 -14
  48. package/esm5/public_api.js +0 -6
  49. package/esm5/src/ngx-dropdown-list/anchor/anchor.component.js +0 -272
  50. package/esm5/src/ngx-dropdown-list/dropdown/dropdown.component.js +0 -420
  51. package/esm5/src/ngx-dropdown-list/dropdown-list.component.js +0 -361
  52. package/esm5/src/ngx-dropdown-list/dropdown-list.module.js +0 -36
  53. package/esm5/src/ngx-dropdown-list/filter/input-filter.component.js +0 -79
  54. package/esm5/src/ngx-dropdown-list/group-item/group-item.component.js +0 -47
  55. package/esm5/src/ngx-dropdown-list/index.js +0 -7
  56. package/esm5/src/ngx-dropdown-list/item/item.component.js +0 -120
  57. package/esm5/src/ngx-dropdown-list/types/index.js +0 -7
  58. package/esm5/src/ngx-dropdown-list/types/selection-group-items.types.js +0 -16
  59. package/esm5/src/ngx-dropdown-list/types/selection-item.types.js +0 -20
  60. package/esm5/src/ngx-dropdown-list/utils/util.js +0 -124
  61. package/fesm2015/ngx-dropdown-list.js +0 -930
  62. package/fesm2015/ngx-dropdown-list.js.map +0 -1
  63. package/fesm5/ngx-dropdown-list.js +0 -1177
  64. package/fesm5/ngx-dropdown-list.js.map +0 -1
  65. package/ngx-dropdown-list-1.1.2.tgz +0 -0
  66. package/ngx-dropdown-list.metadata.json +0 -1
@@ -1,1177 +0,0 @@
1
- import { __values } from 'tslib';
2
- import { FormsModule } from '@angular/forms';
3
- import { DecimalPipe, CommonModule } from '@angular/common';
4
- import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, NgModule } from '@angular/core';
5
-
6
- /**
7
- * @fileoverview added by tsickle
8
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
9
- */
10
- /**
11
- * check whether the provided items contains group
12
- * @param {?} items
13
- * @return {?}
14
- */
15
- function hasGroup(items) {
16
- return items ? (items.find((/**
17
- * @param {?} item
18
- * @return {?}
19
- */
20
- function (item) { return item.group; })) != null) : false;
21
- }
22
- /**
23
- * clear all selections from the provide items.
24
- * @param {?} items the dropdown items, can be group or item
25
- * @return {?}
26
- */
27
- function clearAllSelection(items) {
28
- var e_1, _a;
29
- if (hasGroup(items)) {
30
- try {
31
- for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
32
- var groupItem = items_1_1.value;
33
- if (groupItem.items) {
34
- groupItem.items.filter((/**
35
- * @param {?} item
36
- * @return {?}
37
- */
38
- function (item) { return item.selected; })).forEach((/**
39
- * @param {?} item
40
- * @return {?}
41
- */
42
- function (item) { return item.selected = false; }));
43
- }
44
- }
45
- }
46
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
47
- finally {
48
- try {
49
- if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
50
- }
51
- finally { if (e_1) throw e_1.error; }
52
- }
53
- }
54
- else {
55
- // clear the selection of previous selected item
56
- items.filter((/**
57
- * @param {?} item
58
- * @return {?}
59
- */
60
- function (item) { return item.selected; })).forEach((/**
61
- * @param {?} item
62
- * @return {?}
63
- */
64
- function (item) { return item.selected = false; }));
65
- }
66
- }
67
- /**
68
- * stop all propagation and default actions
69
- * @param {?} event
70
- * @return {?}
71
- */
72
- function stopPropagationAndDefault(event) {
73
- event.stopImmediatePropagation();
74
- event.stopPropagation();
75
- event.preventDefault();
76
- }
77
- /**
78
- * check whether the provided value is number of not
79
- * @param {?} value
80
- * @return {?}
81
- */
82
- function isNumber(value) {
83
- return !(value == null || isNaN(value) || value.length === 0);
84
- }
85
- /**
86
- * get the selected item from the items list (including item and group)
87
- * @param {?} items
88
- * @return {?}
89
- */
90
- function getFirstSelectedItem(items) {
91
- var e_2, _a;
92
- if (!items) {
93
- return undefined;
94
- }
95
- /** @type {?} */
96
- var selectedItem;
97
- if (hasGroup(items)) {
98
- try {
99
- for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
100
- var item = items_2_1.value;
101
- selectedItem = item.items ? item.items.find((/**
102
- * @param {?} subItem
103
- * @return {?}
104
- */
105
- function (subItem) { return subItem.selected; })) : undefined;
106
- if (selectedItem) {
107
- break;
108
- }
109
- }
110
- }
111
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
112
- finally {
113
- try {
114
- if (items_2_1 && !items_2_1.done && (_a = items_2.return)) _a.call(items_2);
115
- }
116
- finally { if (e_2) throw e_2.error; }
117
- }
118
- }
119
- else {
120
- selectedItem = items ? items.find((/**
121
- * @param {?} item
122
- * @return {?}
123
- */
124
- function (item) { return item.selected; })) : undefined;
125
- }
126
- return selectedItem;
127
- }
128
-
129
- /**
130
- * @fileoverview added by tsickle
131
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
132
- */
133
- var DropdownListComponent = /** @class */ (function () {
134
- function DropdownListComponent() {
135
- /**
136
- * bind to [multiSelection], the flag for multi-select (checkbox) mode.
137
- */
138
- this.multiSelection = false;
139
- /**
140
- * bind to [filterBox] for displaying the filter input text box
141
- */
142
- this.filterBox = false;
143
- /**
144
- * bind to [allowClear] for enabling the clearance (clearance is not avaiable when checkbox is enabled)
145
- */
146
- this.allowClear = true;
147
- /**
148
- * bind to [formatNumber] for show formatted number text
149
- */
150
- this.formatNumber = false;
151
- /**
152
- * for 2-way binding of [selectedValue], using async event to
153
- * prevent "ExpressionChangedAfterItHasBeenCheckedError".
154
- */
155
- this.selectedValueChange = new EventEmitter(true);
156
- /**
157
- * [selectionChange] event that will be triggered when changing of the selection.
158
- * Using async event to prevent "ExpressionChangedAfterItHasBeenCheckedError".
159
- */
160
- this.selectionChange = new EventEmitter(true);
161
- /**
162
- * visibility flag of drop down
163
- */
164
- this.dropdownVisibility = false;
165
- }
166
- Object.defineProperty(DropdownListComponent.prototype, "selectedText", {
167
- /**
168
- * current selected text
169
- */
170
- get: /**
171
- * current selected text
172
- * @return {?}
173
- */
174
- function () {
175
- if (!this.multiSelection) {
176
- /** @type {?} */
177
- var selectedItem = getFirstSelectedItem(this.items);
178
- return selectedItem ? selectedItem.text : undefined;
179
- }
180
- },
181
- enumerable: true,
182
- configurable: true
183
- });
184
- /**
185
- * triggered with (selectionChange) event, emits (selectedValueChange) and (selectionChange)
186
- */
187
- /**
188
- * triggered with (selectionChange) event, emits (selectedValueChange) and (selectionChange)
189
- * @param {?} event
190
- * @return {?}
191
- */
192
- DropdownListComponent.prototype.onSelectionChange = /**
193
- * triggered with (selectionChange) event, emits (selectedValueChange) and (selectionChange)
194
- * @param {?} event
195
- * @return {?}
196
- */
197
- function (event) {
198
- this.selectedValueChange.emit(event);
199
- this.selectionChange.emit(event);
200
- };
201
- /**
202
- * triggered with (anchorClick) event, controlling the "open" and "close" of the dropdown
203
- */
204
- /**
205
- * triggered with (anchorClick) event, controlling the "open" and "close" of the dropdown
206
- * @param {?} event
207
- * @return {?}
208
- */
209
- DropdownListComponent.prototype.onAnchorClick = /**
210
- * triggered with (anchorClick) event, controlling the "open" and "close" of the dropdown
211
- * @param {?} event
212
- * @return {?}
213
- */
214
- function (event) {
215
- if (this.disabled) {
216
- stopPropagationAndDefault(event);
217
- return;
218
- }
219
- if (this._isSelectionOpen()) {
220
- this._hideItemList();
221
- }
222
- else {
223
- this._showItemsList();
224
- }
225
- stopPropagationAndDefault(event);
226
- };
227
- /**
228
- * triggered with (itemClick) event, closes the dropdown in non-checkbox mode
229
- */
230
- /**
231
- * triggered with (itemClick) event, closes the dropdown in non-checkbox mode
232
- * @return {?}
233
- */
234
- DropdownListComponent.prototype.onItemClick = /**
235
- * triggered with (itemClick) event, closes the dropdown in non-checkbox mode
236
- * @return {?}
237
- */
238
- function () {
239
- if (!this.multiSelection) {
240
- this._hideItemList();
241
- }
242
- };
243
- /**
244
- * triggered with (clearanceClick) event, clearing all selections
245
- * and emits (selectedValueChange) and (selectionChange) event for empty value
246
- */
247
- /**
248
- * triggered with (clearanceClick) event, clearing all selections
249
- * and emits (selectedValueChange) and (selectionChange) event for empty value
250
- * @param {?} event
251
- * @return {?}
252
- */
253
- DropdownListComponent.prototype.onClearanceClick = /**
254
- * triggered with (clearanceClick) event, clearing all selections
255
- * and emits (selectedValueChange) and (selectionChange) event for empty value
256
- * @param {?} event
257
- * @return {?}
258
- */
259
- function (event) {
260
- if (!this.multiSelection) {
261
- this.selectedValue = void 0;
262
- this.selectedValueChange.emit(undefined);
263
- this.selectionChange.emit(undefined);
264
- clearAllSelection(this.items);
265
- }
266
- stopPropagationAndDefault(event);
267
- };
268
- /**
269
- * triggered with (dropdownBlur) event, closes the dropdown
270
- */
271
- /**
272
- * triggered with (dropdownBlur) event, closes the dropdown
273
- * @return {?}
274
- */
275
- DropdownListComponent.prototype.onItemsBlur = /**
276
- * triggered with (dropdownBlur) event, closes the dropdown
277
- * @return {?}
278
- */
279
- function () {
280
- if (this._isSelectionOpen()) {
281
- this._hideItemList();
282
- }
283
- };
284
- /**
285
- * close the dropdown
286
- */
287
- /**
288
- * close the dropdown
289
- * @private
290
- * @return {?}
291
- */
292
- DropdownListComponent.prototype._hideItemList = /**
293
- * close the dropdown
294
- * @private
295
- * @return {?}
296
- */
297
- function () {
298
- // hide the dropdown element (has some problem for using CSS directly, using this as a workaround)
299
- this._dropdownElement.classList.remove('visible');
300
- this._dropdownElement.style.display = 'none';
301
- this.dropdownVisibility = false;
302
- };
303
- /**
304
- * open the dropdown
305
- */
306
- /**
307
- * open the dropdown
308
- * @private
309
- * @return {?}
310
- */
311
- DropdownListComponent.prototype._showItemsList = /**
312
- * open the dropdown
313
- * @private
314
- * @return {?}
315
- */
316
- function () {
317
- // display the dropdown element (has some problem for using CSS directly, using this as a workaround)
318
- this._dropdownElement.classList.add('visible');
319
- this._dropdownElement.style.display = 'block';
320
- this.dropdownVisibility = true;
321
- // scrolling to the selected item
322
- if (this._selectedElement) {
323
- this._selectedElement.scrollIntoView({ behavior: 'instant', block: 'center' });
324
- }
325
- // setting the focus
326
- if (this.filterBox && !this.multiSelection) {
327
- this._filterInputElement.focus();
328
- }
329
- else {
330
- this._dropdownElement.focus();
331
- }
332
- };
333
- /**
334
- * visibility status of dropdown
335
- */
336
- /**
337
- * visibility status of dropdown
338
- * @private
339
- * @return {?}
340
- */
341
- DropdownListComponent.prototype._isSelectionOpen = /**
342
- * visibility status of dropdown
343
- * @private
344
- * @return {?}
345
- */
346
- function () {
347
- return this.dropdownVisibility;
348
- };
349
- Object.defineProperty(DropdownListComponent.prototype, "_dropdownElement", {
350
- /**
351
- * get the real dropdown element (for focusing and visibility controlling), the <span> not the <dropdown>
352
- */
353
- get: /**
354
- * get the real dropdown element (for focusing and visibility controlling), the <span> not the <dropdown>
355
- * @private
356
- * @return {?}
357
- */
358
- function () {
359
- return this.dropdownRef ? this.dropdownRef.nativeElement ? this.dropdownRef.nativeElement.firstElementChild : null : null;
360
- },
361
- enumerable: true,
362
- configurable: true
363
- });
364
- Object.defineProperty(DropdownListComponent.prototype, "_filterInputElement", {
365
- /**
366
- * get the real filter element (for focusing), the <input> not the <input-filter>
367
- */
368
- get: /**
369
- * get the real filter element (for focusing), the <input> not the <input-filter>
370
- * @private
371
- * @return {?}
372
- */
373
- function () {
374
- return this._dropdownElement ?
375
- this._dropdownElement.firstElementChild ? this._dropdownElement.firstElementChild.firstElementChild : null : null;
376
- },
377
- enumerable: true,
378
- configurable: true
379
- });
380
- Object.defineProperty(DropdownListComponent.prototype, "_selectedElement", {
381
- /**
382
- * get the HTMLElement of selected item, for doing (scrollIntoView) scrolling to the selected item
383
- */
384
- get: /**
385
- * get the HTMLElement of selected item, for doing (scrollIntoView) scrolling to the selected item
386
- * @private
387
- * @return {?}
388
- */
389
- function () {
390
- /** @type {?} */
391
- var selectedItem = getFirstSelectedItem(this.items);
392
- return selectedItem ? (/** @type {?} */ (document.getElementById(selectedItem.id))) : undefined;
393
- },
394
- enumerable: true,
395
- configurable: true
396
- });
397
- DropdownListComponent.decorators = [
398
- { type: Component, args: [{
399
- selector: 'ngx-dropdown-list',
400
- template: "\n <span class=\"ngx-select\">\n <anchor (anchorClick)=\"onAnchorClick($event)\" (clearanceClick)=\"onClearanceClick($event)\"\n [checkbox]=\"multiSelection\"\n [formatNumber]=\"formatNumber\"\n [suffixText]=\"suffixText\"\n [placeHolder]=\"placeHolder\"\n [allowClear]=\"allowClear\"\n [openStatus]=\"dropdownVisibility\"\n [selectedText]=\"selectedText\"\n [disabled]=\"disabled\">\n </anchor>\n <dropdown #dropdown (dropdownBlur) = \"onItemsBlur()\" (selectionChange)=\"onSelectionChange($event)\"\n [items]=\"items\"\n [checkbox]=\"multiSelection\"\n [filterBox]=\"filterBox\"\n [formatNumber]=\"formatNumber\"\n [suffixText]=\"suffixText\"\n [(selectedValue)]=\"selectedValue\"\n (itemClick) = \"onItemClick()\"\n [disabled]=\"disabled\">\n </dropdown>\n </span>\n ",
401
- styles: [":host *,:host :after,:host :before{font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:inherit;background:inherit}:host .ngx-select{border-radius:4px;font-size:14px;position:relative;display:inline-block;width:100%;height:34px;background:#fff;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}"]
402
- }] }
403
- ];
404
- DropdownListComponent.propDecorators = {
405
- dropdownRef: [{ type: ViewChild, args: ['dropdown', { read: ElementRef },] }],
406
- placeHolder: [{ type: Input }],
407
- items: [{ type: Input }],
408
- multiSelection: [{ type: Input }],
409
- selectedValue: [{ type: Input }],
410
- filterBox: [{ type: Input }],
411
- suffixText: [{ type: Input }],
412
- disabled: [{ type: Input }],
413
- allowClear: [{ type: Input }],
414
- formatNumber: [{ type: Input }],
415
- selectedValueChange: [{ type: Output }],
416
- selectionChange: [{ type: Output }]
417
- };
418
- return DropdownListComponent;
419
- }());
420
-
421
- /**
422
- * @fileoverview added by tsickle
423
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
424
- */
425
- var ItemComponent = /** @class */ (function () {
426
- function ItemComponent() {
427
- /**
428
- * bind to [formatNumber], the flag for formatting the number
429
- */
430
- this.formatNumber = false;
431
- /**
432
- * bind to [itemClick] event, triggers when clicking the item of dropdown
433
- */
434
- this.itemClick = new EventEmitter();
435
- /**
436
- * bind to [checkStatusChange] event, triggers when check status is changed in checkbox mode.
437
- */
438
- this.checkStatusChange = new EventEmitter();
439
- }
440
- /**
441
- * check whether needs to format number for the provided text
442
- */
443
- /**
444
- * check whether needs to format number for the provided text
445
- * @param {?} value
446
- * @return {?}
447
- */
448
- ItemComponent.prototype.needFormatNumber = /**
449
- * check whether needs to format number for the provided text
450
- * @param {?} value
451
- * @return {?}
452
- */
453
- function (value) {
454
- return isNumber(value) && this.formatNumber;
455
- };
456
- /**
457
- * triggered when clicking the item, emits the [itemClick] event
458
- */
459
- /**
460
- * triggered when clicking the item, emits the [itemClick] event
461
- * @param {?} item
462
- * @return {?}
463
- */
464
- ItemComponent.prototype.onItemClick = /**
465
- * triggered when clicking the item, emits the [itemClick] event
466
- * @param {?} item
467
- * @return {?}
468
- */
469
- function (item) {
470
- this.itemClick.emit(item);
471
- };
472
- /**
473
- * triggered when checking status changed in checkbox mode, emits the [checkStatusChange] event
474
- */
475
- /**
476
- * triggered when checking status changed in checkbox mode, emits the [checkStatusChange] event
477
- * @param {?} item
478
- * @return {?}
479
- */
480
- ItemComponent.prototype.onCheckStatusChange = /**
481
- * triggered when checking status changed in checkbox mode, emits the [checkStatusChange] event
482
- * @param {?} item
483
- * @return {?}
484
- */
485
- function (item) {
486
- this.checkStatusChange.emit(item);
487
- };
488
- ItemComponent.decorators = [
489
- { type: Component, args: [{
490
- selector: 'item',
491
- template: "\n <label [class.container-checkbox]=\"checkbox\"\n [class.container-selection]=\"!checkbox && !item.selected\"\n [class.container-selection-selected]=\"!checkbox && item.selected\"\n [id]=\"item.id\" (mousedown)=\"onItemClick(item)\">\n {{needFormatNumber(item.text)? (item.text | number:'1.0-2') : item.text}}{{suffixText? suffixText : ''}}\n <ng-container *ngIf=\"checkbox\">\n <input type='checkbox' [id]=\"'checkbox-'+item.text\" (change)=\"onCheckStatusChange(item)\" [checked]=\"item.selected\">\n <span class=\"checkmark\" [id]=\"'checkmark-'+item.text\"></span>\n </ng-container>\n </label>",
492
- styles: ["*,:after,:before{font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:inherit;background:inherit}.container-checkbox,.container-selection,.container-selection-selected,.dropdown-item{background:0 0;display:list-item;list-style:none;position:relative;width:100%;height:auto;cursor:pointer;color:#495057;padding-bottom:5px;padding-top:5px;padding-left:12px}.container-checkbox{padding-left:35px}.container-checkbox input{position:absolute;opacity:0;cursor:pointer}.container-checkbox .checkmark{position:absolute;top:5px;left:10px;height:15px;width:15px;border:1px solid rgba(0,0,0,.3);background-color:#fff;border-radius:4px}.container-checkbox .checkmark:after{content:\"\";position:absolute;display:none;left:5px;top:2px;width:4px;height:7px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.container-checkbox:hover input~.checkmark{background-color:#ccc}.container-checkbox input:checked~.checkmark{background-color:#2196f3;border:1px solid #2196f3}.container-checkbox input:checked~.checkmark:after{display:block}.container-checkbox:hover{color:#66afe9}.container-selection,.container-selection-selected{padding-left:12px}.container-selection-selected:hover,.container-selection:hover{color:#495057;background:#e0ffff}.container-selection-selected{color:#fff;background:#6495ed}"]
493
- }] }
494
- ];
495
- ItemComponent.propDecorators = {
496
- checkbox: [{ type: Input }],
497
- item: [{ type: Input }],
498
- formatNumber: [{ type: Input }],
499
- suffixText: [{ type: Input }],
500
- itemClick: [{ type: Output }],
501
- checkStatusChange: [{ type: Output }]
502
- };
503
- return ItemComponent;
504
- }());
505
-
506
- /**
507
- * @fileoverview added by tsickle
508
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
509
- */
510
- var GroupItemComponent = /** @class */ (function () {
511
- function GroupItemComponent() {
512
- }
513
- /**
514
- * prevent all clicking event from happening
515
- */
516
- /**
517
- * prevent all clicking event from happening
518
- * @param {?} event
519
- * @return {?}
520
- */
521
- GroupItemComponent.prototype.onItemGroupClick = /**
522
- * prevent all clicking event from happening
523
- * @param {?} event
524
- * @return {?}
525
- */
526
- function (event) {
527
- event.stopImmediatePropagation();
528
- event.stopPropagation();
529
- event.preventDefault();
530
- };
531
- GroupItemComponent.decorators = [
532
- { type: Component, args: [{
533
- selector: 'group-item',
534
- template: "\n <label class=\"dropdown-item dropdown-item-group\" (mousedown)=\"onItemGroupClick($event)\">{{item.group}}</label>\n ",
535
- styles: ["*,:after,:before{font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:inherit;background:inherit}.container-checkbox,.container-selection,.container-selection-selected,.dropdown-item{background:0 0;display:list-item;list-style:none;position:relative;width:100%;height:auto;cursor:pointer;color:#495057;padding-bottom:5px;padding-top:5px;padding-left:12px}.container-checkbox{padding-left:35px}.container-checkbox input{position:absolute;opacity:0;cursor:pointer}.container-checkbox .checkmark{position:absolute;top:5px;left:10px;height:15px;width:15px;border:1px solid rgba(0,0,0,.3);background-color:#fff;border-radius:4px}.container-checkbox .checkmark:after{content:\"\";position:absolute;display:none;left:5px;top:2px;width:4px;height:7px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.container-checkbox:hover input~.checkmark{background-color:#ccc}.container-checkbox input:checked~.checkmark{background-color:#2196f3;border:1px solid #2196f3}.container-checkbox input:checked~.checkmark:after{display:block}.container-checkbox:hover{color:#66afe9}.container-selection,.container-selection-selected{padding-left:12px}.container-selection-selected:hover,.container-selection:hover{color:#495057;background:#e0ffff}.container-selection-selected{color:#fff;background:#6495ed}.dropdown-item-group{font-weight:700}.dropdown-item-group:hover{cursor:default}"]
536
- }] }
537
- ];
538
- GroupItemComponent.propDecorators = {
539
- item: [{ type: Input }]
540
- };
541
- return GroupItemComponent;
542
- }());
543
-
544
- /**
545
- * @fileoverview added by tsickle
546
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
547
- */
548
- var InputFilterComponent = /** @class */ (function () {
549
- function InputFilterComponent() {
550
- /**
551
- * bind to [inputFilterBlur], emits with (blur) of filter input box
552
- */
553
- this.inputFilterBlur = new EventEmitter();
554
- /**
555
- * bind to [filterValueChange], for 2-way binding of filterValue
556
- */
557
- this.filterValueChange = new EventEmitter();
558
- }
559
- /**
560
- * triggers with (blur) event, emits the (inputFilterBlur) event
561
- */
562
- /**
563
- * triggers with (blur) event, emits the (inputFilterBlur) event
564
- * @param {?} event
565
- * @return {?}
566
- */
567
- InputFilterComponent.prototype.onFilterTextBlur = /**
568
- * triggers with (blur) event, emits the (inputFilterBlur) event
569
- * @param {?} event
570
- * @return {?}
571
- */
572
- function (event) {
573
- this.inputFilterBlur.emit(event);
574
- };
575
- /**
576
- * triggers with (input) event, emits the (filterValueChange) event for 2-way binding of filterValue
577
- */
578
- /**
579
- * triggers with (input) event, emits the (filterValueChange) event for 2-way binding of filterValue
580
- * @return {?}
581
- */
582
- InputFilterComponent.prototype.onChange = /**
583
- * triggers with (input) event, emits the (filterValueChange) event for 2-way binding of filterValue
584
- * @return {?}
585
- */
586
- function () {
587
- this.filterValueChange.emit(this.filterValue);
588
- };
589
- InputFilterComponent.decorators = [
590
- { type: Component, args: [{
591
- selector: 'input-filter',
592
- template: "\n <input type=\"text\" class=\"filter-box\" [(ngModel)]=\"filterValue\" (input)=\"onChange()\" (blur)=\"onFilterTextBlur($event)\">\n ",
593
- styles: ["*,:after,:before{font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:inherit;background:inherit}.filter-box{width:calc(100% - 10px);height:28px;border-radius:4px;border:1px solid #ccc;margin:1px 5px 5px;padding-left:5px;font-size:12px;box-sizing:border-box;color:#495057}.filter-box:focus{outline:0;border-color:#ccc}"]
594
- }] }
595
- ];
596
- InputFilterComponent.propDecorators = {
597
- filterValue: [{ type: Input }],
598
- inputFilterBlur: [{ type: Output }],
599
- filterValueChange: [{ type: Output }]
600
- };
601
- return InputFilterComponent;
602
- }());
603
-
604
- /**
605
- * @fileoverview added by tsickle
606
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
607
- */
608
- var AnchorComponent = /** @class */ (function () {
609
- function AnchorComponent(_decimalPipe) {
610
- this._decimalPipe = _decimalPipe;
611
- /**
612
- * bind to [checkbox] for checking whether the clearance flag should be shown or not.
613
- */
614
- this.checkbox = false;
615
- /**
616
- * bind to [allowClear] for enabling the clearance (clearance is not avaiable when checkbox is enabled)
617
- */
618
- this.allowClear = true;
619
- /**
620
- * bind to [openStatus], it's the visibility status of dropdown, for showing the arrow on anchor
621
- */
622
- this.openStatus = false;
623
- /**
624
- * bind to [disabled] for disabling the anchor
625
- */
626
- this.disabled = false;
627
- /**
628
- * will be triggered when clicking the anchor
629
- */
630
- this.anchorClick = new EventEmitter();
631
- /**
632
- * will be triggered when clicking the clearance
633
- */
634
- this.clearanceClick = new EventEmitter();
635
- }
636
- Object.defineProperty(AnchorComponent.prototype, "showClearanceFlag", {
637
- /**
638
- * flag for showing the clearance flag
639
- */
640
- get: /**
641
- * flag for showing the clearance flag
642
- * @return {?}
643
- */
644
- function () {
645
- return !this.checkbox && this.selectedText && this.allowClear;
646
- },
647
- enumerable: true,
648
- configurable: true
649
- });
650
- Object.defineProperty(AnchorComponent.prototype, "anchorDisplayText", {
651
- /**
652
- * the text displays on anchor
653
- */
654
- get: /**
655
- * the text displays on anchor
656
- * @return {?}
657
- */
658
- function () {
659
- /** @type {?} */
660
- var anchorDisplayText = this.selectedText ? (this.formatNumber ? (isNumber(this.selectedText) ?
661
- this._decimalPipe.transform(this.selectedText, '1.0-2') : this.selectedText) :
662
- this.selectedText) + (this.suffixText ? this.suffixText : '') : this.placeHolder;
663
- /** @type {?} */
664
- var charLength = 1;
665
- if (this.showClearanceFlag && this.anchorLength > 0) {
666
- charLength = Math.floor((this.anchorLength - 50) / 7);
667
- }
668
- else {
669
- charLength = Math.floor((this.anchorLength - 50) / 7);
670
- }
671
- if (anchorDisplayText.length > charLength) {
672
- anchorDisplayText = anchorDisplayText.slice(0, charLength - 2) + '...';
673
- }
674
- return anchorDisplayText;
675
- },
676
- enumerable: true,
677
- configurable: true
678
- });
679
- Object.defineProperty(AnchorComponent.prototype, "anchorClass", {
680
- /**
681
- * anchor CSS class
682
- */
683
- get: /**
684
- * anchor CSS class
685
- * @return {?}
686
- */
687
- function () {
688
- /** @type {?} */
689
- var anchorClassStatusPart;
690
- /** @type {?} */
691
- var anchorClassFontColor;
692
- if (this.disabled) {
693
- anchorClassStatusPart = 'selection-anchor-disabled';
694
- anchorClassFontColor = 'place-holder';
695
- }
696
- else {
697
- if (this.openStatus) {
698
- anchorClassStatusPart = 'selection-anchor-open';
699
- }
700
- else {
701
- anchorClassStatusPart = 'selection-anchor-close';
702
- }
703
- if (this.selectedText != null) {
704
- anchorClassFontColor = 'selected-item';
705
- }
706
- else {
707
- anchorClassFontColor = 'place-holder';
708
- }
709
- }
710
- return anchorClassStatusPart + " " + anchorClassFontColor;
711
- },
712
- enumerable: true,
713
- configurable: true
714
- });
715
- /**
716
- * triggered when clicking the anchor
717
- */
718
- /**
719
- * triggered when clicking the anchor
720
- * @param {?} event
721
- * @return {?}
722
- */
723
- AnchorComponent.prototype.onAnchorClick = /**
724
- * triggered when clicking the anchor
725
- * @param {?} event
726
- * @return {?}
727
- */
728
- function (event) {
729
- this.anchorClick.emit(event);
730
- };
731
- /**
732
- * triggered with (blur) of anchor
733
- */
734
- /**
735
- * triggered with (blur) of anchor
736
- * @param {?} event
737
- * @return {?}
738
- */
739
- AnchorComponent.prototype.onAnchorBlur = /**
740
- * triggered with (blur) of anchor
741
- * @param {?} event
742
- * @return {?}
743
- */
744
- function (event) {
745
- stopPropagationAndDefault(event);
746
- };
747
- /**
748
- * triggered when clicking the clearance
749
- */
750
- /**
751
- * triggered when clicking the clearance
752
- * @param {?} event
753
- * @return {?}
754
- */
755
- AnchorComponent.prototype.onClearanceClick = /**
756
- * triggered when clicking the clearance
757
- * @param {?} event
758
- * @return {?}
759
- */
760
- function (event) {
761
- this.clearanceClick.emit(event);
762
- };
763
- /**
764
- * triggered when resizing, get the clientWidth of anchor
765
- */
766
- /**
767
- * triggered when resizing, get the clientWidth of anchor
768
- * @return {?}
769
- */
770
- AnchorComponent.prototype.onResize = /**
771
- * triggered when resizing, get the clientWidth of anchor
772
- * @return {?}
773
- */
774
- function () {
775
- this.anchorLength = this.anchorRef ? this.anchorRef.nativeElement ? this.anchorRef.nativeElement.clientWidth : 0 : 0;
776
- };
777
- AnchorComponent.decorators = [
778
- { type: Component, args: [{
779
- selector: 'anchor',
780
- template: "\n <span #anchor tabindex=\"2\" [ngClass]=\"anchorClass\" (window:resize)=\"onResize()\"\n (mousedown)=\"onAnchorClick($event)\" (blur)=\"onAnchorBlur($event)\"> {{anchorDisplayText}}\n <span #selectionClearance class=\"selection-clearance\" (mousedown)=\"onClearanceClick($event)\" *ngIf=\"showClearanceFlag\">&times;</span>\n </span>\n ",
781
- providers: [DecimalPipe],
782
- styles: ["*,:after,:before{font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:inherit;background:inherit}.selection-anchor-close:after,.selection-anchor-disabled:after,.selection-anchor-open:after,.vertical-center{position:absolute;top:50%;transform:translateY(-50%)}.hover-box,.selection-anchor-close:hover{outline:0;box-shadow:0 0 6px #23adff;border-radius:4px}.anchor-box,.selection-anchor,.selection-anchor-close,.selection-anchor-disabled,.selection-anchor-open{height:100%;border-radius:4px;width:100%;position:relative;display:inline-block;padding:8px 12px 5px;border:1px solid;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-sizing:border-box;white-space:nowrap}.selection-anchor,.selection-anchor-close,.selection-anchor-open{cursor:pointer}.selection-anchor .selection-clearance,.selection-anchor-close .selection-clearance,.selection-anchor-open .selection-clearance{position:absolute;right:35px;font-weight:700}.selection-anchor .selection-clearance:hover,.selection-anchor-close .selection-clearance:hover,.selection-anchor-open .selection-clearance:hover{color:#000}.selection-anchor-close:focus,.selection-anchor-open:focus,.selection-anchor:focus{box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;border-color:#66afe9}.selection-anchor-disabled{border-color:#ccc;cursor:default;pointer-events:none;background:#f8f8f8;filter:opacity(50%)}.selection-anchor-disabled:after{font-size:9px;content:'\\0025BC';right:10px;padding-bottom:3px}.selection-anchor-open{border-bottom:none;border-bottom-right-radius:0;border-bottom-left-radius:0;border-color:#66afe9}.selection-anchor-open:after{font-size:9px;content:'\\0025B2';right:10px;padding-bottom:3px}.selection-anchor-close{border-color:#ccc}.selection-anchor-close:after{font-size:9px;content:'\\0025BC';right:10px;padding-bottom:3px}.place-holder{color:#999}.selected-item{color:#495057}"]
783
- }] }
784
- ];
785
- /** @nocollapse */
786
- AnchorComponent.ctorParameters = function () { return [
787
- { type: DecimalPipe }
788
- ]; };
789
- AnchorComponent.propDecorators = {
790
- anchorRef: [{ type: ViewChild, args: ['anchor', { read: ElementRef },] }],
791
- placeHolder: [{ type: Input }],
792
- checkbox: [{ type: Input }],
793
- suffixText: [{ type: Input }],
794
- allowClear: [{ type: Input }],
795
- formatNumber: [{ type: Input }],
796
- selectedText: [{ type: Input }],
797
- openStatus: [{ type: Input }],
798
- disabled: [{ type: Input }],
799
- anchorClick: [{ type: Output }],
800
- clearanceClick: [{ type: Output }]
801
- };
802
- return AnchorComponent;
803
- }());
804
-
805
- /**
806
- * @fileoverview added by tsickle
807
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
808
- */
809
- var DropdownComponent = /** @class */ (function () {
810
- function DropdownComponent() {
811
- /**
812
- * bind to [checkbox], the flag for multi-select (checkbox) mode.
813
- */
814
- this.checkbox = false;
815
- /**
816
- * bind to [filterBox] for displaying the filter input text box
817
- */
818
- this.filterBox = false;
819
- /**
820
- * bind to [allowClear] for enabling the clearance (clearance is not avaiable when checkbox is enabled)
821
- */
822
- this.allowClear = true;
823
- /**
824
- * bind to [formatNumber] for show formatted number text
825
- */
826
- this.formatNumber = false;
827
- /**
828
- * for 2-way binding of [selectedValue]
829
- */
830
- this.selectedValueChange = new EventEmitter(true);
831
- /**
832
- * [selectionChange] event that will be triggered when changing of the selection
833
- */
834
- this.selectionChange = new EventEmitter(true);
835
- /**
836
- * [dropdownBlur] event that will be triggered with (blur) of dropdown
837
- */
838
- this.dropdownBlur = new EventEmitter();
839
- /**
840
- * [itemClick] event that will be triggered when clicking the option of dropdown
841
- */
842
- this.itemClick = new EventEmitter();
843
- /**
844
- * flag of clicking dropdown. It's to prevent (blur) of dropdown from happening in checkbox mode.
845
- */
846
- this._clickedItems = false;
847
- }
848
- /**
849
- * @param {?} changes
850
- * @return {?}
851
- */
852
- DropdownComponent.prototype.ngOnChanges = /**
853
- * @param {?} changes
854
- * @return {?}
855
- */
856
- function (changes) {
857
- if (changes.items) {
858
- this._checkSelectionChange(changes.items.previousValue, changes.items.currentValue);
859
- }
860
- };
861
- /**
862
- * triggered when clicking the dropdown
863
- */
864
- /**
865
- * triggered when clicking the dropdown
866
- * @param {?} event
867
- * @return {?}
868
- */
869
- DropdownComponent.prototype.onItemsClick = /**
870
- * triggered when clicking the dropdown
871
- * @param {?} event
872
- * @return {?}
873
- */
874
- function (event) {
875
- if (event.offsetX > (event.target.clientWidth + event.target.clientLeft)) {
876
- stopPropagationAndDefault(event);
877
- return;
878
- }
879
- // should ignore clicking on filter
880
- if (this.checkbox && event.target.type !== 'text') {
881
- this._clickedItems = true;
882
- }
883
- };
884
- /**
885
- * triggered when clicking the item
886
- */
887
- /**
888
- * triggered when clicking the item
889
- * @param {?} currentItem
890
- * @return {?}
891
- */
892
- DropdownComponent.prototype.onItemClick = /**
893
- * triggered when clicking the item
894
- * @param {?} currentItem
895
- * @return {?}
896
- */
897
- function (currentItem) {
898
- if (!this.checkbox) {
899
- this.selectedValue = this._getItemValue(currentItem); // currentItem.value != null ? currentItem.value : currentItem.text;
900
- clearAllSelection(this.items);
901
- // set the selection of current one
902
- currentItem.selected = true;
903
- this.itemClick.emit(currentItem);
904
- this._onSelectionChange(this.selectedValue);
905
- }
906
- };
907
- /**
908
- * triggers with (blur) event of filter input box
909
- */
910
- /**
911
- * triggers with (blur) event of filter input box
912
- * @param {?} event
913
- * @return {?}
914
- */
915
- DropdownComponent.prototype.onFilterTextBlur = /**
916
- * triggers with (blur) event of filter input box
917
- * @param {?} event
918
- * @return {?}
919
- */
920
- function (event) {
921
- this.dropdownBlur.emit(event);
922
- };
923
- /**
924
- * triggers with (blur) event of dropdown
925
- */
926
- /**
927
- * triggers with (blur) event of dropdown
928
- * @param {?} event
929
- * @return {?}
930
- */
931
- DropdownComponent.prototype.onItemsBlur = /**
932
- * triggers with (blur) event of dropdown
933
- * @param {?} event
934
- * @return {?}
935
- */
936
- function (event) {
937
- if (this.checkbox) {
938
- if (this._clickedItems) {
939
- // in checkbox mode, this blur event will be ignored when clicking the dropdown (check the checkbox)
940
- event.target.focus();
941
- this._clickedItems = false;
942
- return;
943
- }
944
- }
945
- this.dropdownBlur.emit(event);
946
- };
947
- /**
948
- * toggle the selection when checking status changed (in checkbox mode)
949
- */
950
- /**
951
- * toggle the selection when checking status changed (in checkbox mode)
952
- * @param {?} item
953
- * @return {?}
954
- */
955
- DropdownComponent.prototype.toggleSelection = /**
956
- * toggle the selection when checking status changed (in checkbox mode)
957
- * @param {?} item
958
- * @return {?}
959
- */
960
- function (item) {
961
- item.selected = !item.selected;
962
- this.selectionChange.emit(this._getItemValue(item)); // item.value != null ? item.value : item.text);
963
- };
964
- Object.defineProperty(DropdownComponent.prototype, "itemsValues", {
965
- /**
966
- * items values list after applying the filter
967
- */
968
- get: /**
969
- * items values list after applying the filter
970
- * @return {?}
971
- */
972
- function () {
973
- /** @type {?} */
974
- var filter;
975
- if (this.filterValue) {
976
- filter = this.filterValue.toUpperCase();
977
- }
978
- if (filter == null) {
979
- return this.items;
980
- }
981
- if (!this.items || this.items.length === 0) {
982
- return [];
983
- }
984
- if (hasGroup(this.items)) {
985
- /** @type {?} */
986
- var items_1 = [];
987
- this.items.forEach((/**
988
- * @param {?} groupItem
989
- * @return {?}
990
- */
991
- function (groupItem) {
992
- if (groupItem.group != null && groupItem.group.toString().toUpperCase().includes(filter)) {
993
- // if groupItem contains the filters, the groupItem needs to be displayed as well
994
- items_1.push(groupItem);
995
- }
996
- else {
997
- /** @type {?} */
998
- var filteredItems = groupItem.items.filter((/**
999
- * @param {?} item
1000
- * @return {?}
1001
- */
1002
- function (item) { return item.text != null && item.text.toString().toUpperCase().includes(filter); }));
1003
- if (filteredItems && filteredItems.length > 0) {
1004
- items_1.push({ group: groupItem.group, items: filteredItems });
1005
- }
1006
- }
1007
- }));
1008
- return items_1;
1009
- }
1010
- else {
1011
- return this.items.filter((/**
1012
- * @param {?} item
1013
- * @return {?}
1014
- */
1015
- function (item) { return (item.text != null && item.text.toString().toUpperCase().includes(filter)); }));
1016
- }
1017
- },
1018
- enumerable: true,
1019
- configurable: true
1020
- });
1021
- Object.defineProperty(DropdownComponent.prototype, "optionsClass", {
1022
- /**
1023
- * options CSS class
1024
- */
1025
- get: /**
1026
- * options CSS class
1027
- * @return {?}
1028
- */
1029
- function () {
1030
- if (this.filterBox && !this.checkbox) {
1031
- return 'options with-filter';
1032
- }
1033
- else {
1034
- return 'options no-filter';
1035
- }
1036
- },
1037
- enumerable: true,
1038
- configurable: true
1039
- });
1040
- /**
1041
- * get item value. Return text if value is not available
1042
- */
1043
- /**
1044
- * get item value. Return text if value is not available
1045
- * @private
1046
- * @param {?} item
1047
- * @return {?}
1048
- */
1049
- DropdownComponent.prototype._getItemValue = /**
1050
- * get item value. Return text if value is not available
1051
- * @private
1052
- * @param {?} item
1053
- * @return {?}
1054
- */
1055
- function (item) {
1056
- return item ? item.value != null ? item.value : item.text : undefined;
1057
- };
1058
- /**
1059
- * selection changed, emits events: (selectedValueChange) and (selectionChange);
1060
- */
1061
- /**
1062
- * selection changed, emits events: (selectedValueChange) and (selectionChange);
1063
- * @private
1064
- * @param {?} value
1065
- * @return {?}
1066
- */
1067
- DropdownComponent.prototype._onSelectionChange = /**
1068
- * selection changed, emits events: (selectedValueChange) and (selectionChange);
1069
- * @private
1070
- * @param {?} value
1071
- * @return {?}
1072
- */
1073
- function (value) {
1074
- this.selectedValueChange.emit(value);
1075
- this.selectionChange.emit(value);
1076
- };
1077
- /**
1078
- * check whether the selection is changed. Emits relative events when if changed.
1079
- */
1080
- /**
1081
- * check whether the selection is changed. Emits relative events when if changed.
1082
- * @private
1083
- * @param {?} previousValue
1084
- * @param {?} currentValue
1085
- * @return {?}
1086
- */
1087
- DropdownComponent.prototype._checkSelectionChange = /**
1088
- * check whether the selection is changed. Emits relative events when if changed.
1089
- * @private
1090
- * @param {?} previousValue
1091
- * @param {?} currentValue
1092
- * @return {?}
1093
- */
1094
- function (previousValue, currentValue) {
1095
- /** @type {?} */
1096
- var curSelectedItem = getFirstSelectedItem(currentValue);
1097
- /** @type {?} */
1098
- var lastSelectedItem = getFirstSelectedItem(previousValue);
1099
- /** @type {?} */
1100
- var curSelectedItemId = curSelectedItem ? curSelectedItem.id : undefined;
1101
- /** @type {?} */
1102
- var lastSelectedItemId = lastSelectedItem ? lastSelectedItem.id : undefined;
1103
- if (curSelectedItemId !== lastSelectedItemId && !this.checkbox) {
1104
- this._onSelectionChange(this._getItemValue(curSelectedItem));
1105
- }
1106
- };
1107
- DropdownComponent.decorators = [
1108
- { type: Component, args: [{
1109
- selector: 'dropdown',
1110
- template: "\n <span #dropdown class=\"dropdown\" tabindex=\"3\" (mousedown)=\"onItemsClick($event)\" (blur)=\"onItemsBlur($event)\" *ngIf=\"!disabled\" >\n <input-filter #filterInput tabindex=\"4\" *ngIf=\"filterBox && !checkbox\" [(filterValue)]=\"filterValue\" (inputFilterBlur)=\"onFilterTextBlur($event)\"></input-filter>\n <span #selectionOptions [ngClass]=\"optionsClass\">\n <ng-container *ngFor=\"let item of itemsValues\" >\n <ng-container *ngIf=\"item && item.group\">\n <group-item [item]=\"item\"></group-item>\n <item *ngFor=\"let subItem of item.items\" (itemClick)=\"onItemClick(subItem)\" (checkStatusChange)=\"toggleSelection(subItem)\"\n [item]=\"subItem\" [checkbox]=\"checkbox\" [formatNumber]=\"formatNumber\" [suffixText]=\"suffixText\">\n </item>\n </ng-container>\n <ng-container *ngIf=\"item && !item.group\">\n <item (itemClick)=\"onItemClick(item)\" (checkStatusChange)=\"toggleSelection(item)\"\n [item]=\"item\" [checkbox]=\"checkbox\" [formatNumber]=\"formatNumber\" [suffixText]=\"suffixText\">\n </item>\n </ng-container>\n </ng-container>\n </span>\n </span>\n ",
1111
- styles: ["*,:after,:before{font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:inherit;background:inherit}.dropdown{width:100%;padding:0;display:none;margin:0;border:1px solid #66afe9;border-top:none;border-bottom:none;border-top-right-radius:0;border-top-left-radius:0;box-sizing:border-box;position:relative;z-index:999}.dropdown:focus{outline:0}.dropdown .options{width:calc(100% + 2px);left:0;box-sizing:border-box;background:#fff;position:absolute;max-height:228px;overflow-y:auto;overflow-x:hidden;border:1px solid #66afe9;border-top:none;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-left:-1px;margin-right:-1px}.dropdown .with-filter{top:32px}.dropdown .no-filter{top:0}"]
1112
- }] }
1113
- ];
1114
- DropdownComponent.propDecorators = {
1115
- dropdownRef: [{ type: ViewChild, args: ['dropdown', { read: ElementRef },] }],
1116
- filterInputRef: [{ type: ViewChild, args: ['filterInput', { read: ElementRef },] }],
1117
- placeHolder: [{ type: Input }],
1118
- items: [{ type: Input }],
1119
- checkbox: [{ type: Input }],
1120
- selectedValue: [{ type: Input }],
1121
- filterBox: [{ type: Input }],
1122
- suffixText: [{ type: Input }],
1123
- disabled: [{ type: Input }],
1124
- allowClear: [{ type: Input }],
1125
- formatNumber: [{ type: Input }],
1126
- selectedValueChange: [{ type: Output }],
1127
- selectionChange: [{ type: Output }],
1128
- dropdownBlur: [{ type: Output }],
1129
- itemClick: [{ type: Output }]
1130
- };
1131
- return DropdownComponent;
1132
- }());
1133
-
1134
- /**
1135
- * @fileoverview added by tsickle
1136
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1137
- */
1138
- var DropdownListModule = /** @class */ (function () {
1139
- function DropdownListModule() {
1140
- }
1141
- DropdownListModule.decorators = [
1142
- { type: NgModule, args: [{
1143
- declarations: [
1144
- DropdownListComponent,
1145
- ItemComponent,
1146
- GroupItemComponent,
1147
- InputFilterComponent,
1148
- AnchorComponent,
1149
- DropdownComponent
1150
- ],
1151
- exports: [DropdownListComponent],
1152
- imports: [CommonModule, FormsModule],
1153
- providers: [],
1154
- bootstrap: [],
1155
- },] }
1156
- ];
1157
- return DropdownListModule;
1158
- }());
1159
-
1160
- /**
1161
- * @fileoverview added by tsickle
1162
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1163
- */
1164
-
1165
- /**
1166
- * @fileoverview added by tsickle
1167
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1168
- */
1169
-
1170
- /**
1171
- * @fileoverview added by tsickle
1172
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1173
- */
1174
-
1175
- export { DropdownListComponent, DropdownListModule, AnchorComponent as ɵd, DropdownComponent as ɵe, InputFilterComponent as ɵc, GroupItemComponent as ɵb, ItemComponent as ɵa };
1176
-
1177
- //# sourceMappingURL=ngx-dropdown-list.js.map