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