@stackline/angular-multiselect-dropdown 2.0.5 → 2.0.6

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.
@@ -0,0 +1,413 @@
1
+ import { Component, OnInit, NgModule, SimpleChanges, OnChanges, ViewEncapsulation, ContentChild, ViewChild, forwardRef, Input, Output, EventEmitter, ElementRef, AfterViewInit, Pipe, PipeTransform } from '@angular/core';
2
+ import { FormsModule, NG_VALUE_ACCESSOR, ControlValueAccessor, NG_VALIDATORS, Validator, FormControl } from '@angular/forms';
3
+ import { CommonModule } from '@angular/common';
4
+ import { ListItem, MyException } from './multiselect.model';
5
+ import { DropdownSettings } from './multiselect.interface';
6
+ import { ClickOutsideDirective, ScrollDirective, styleDirective } from './clickOutside';
7
+ import { ListFilterPipe } from './list-filter';
8
+ import { Item, Badge, TemplateRenderer } from './menu-item';
9
+
10
+ export const DROPDOWN_CONTROL_VALUE_ACCESSOR: any = {
11
+ provide: NG_VALUE_ACCESSOR,
12
+ useExisting: forwardRef(() => AngularMultiSelect),
13
+ multi: true
14
+ };
15
+ export const DROPDOWN_CONTROL_VALIDATION: any = {
16
+ provide: NG_VALIDATORS,
17
+ useExisting: forwardRef(() => AngularMultiSelect),
18
+ multi: true,
19
+ }
20
+ const noop = () => {
21
+ };
22
+
23
+ @Component({
24
+ selector: 'angular-multiselect, angular2-multiselect',
25
+ template: "<div class=\"stackline-dropdown\" [ngClass]=\"getDropdownClasses()\" (clickOutside)=\"closeDropdown()\">\n <div class=\"selected-list\">\n <div class=\"c-btn\" (click)=\"toggleDropdown($event)\" [ngClass]=\"{'disabled': settings.disabled}\">\n <span *ngIf=\"selectedItems?.length == 0\">{{settings.text}}</span>\n <span *ngIf=\"settings.singleSelection\">\n <span *ngFor=\"let item of selectedItems;trackBy: trackByFn;\">\n {{item[settings.labelKey]}}\n </span>\n </span>\n <div class=\"c-list\" *ngIf=\"selectedItems?.length > 0 && !settings.singleSelection\">\n <div class=\"c-token\" *ngFor=\"let item of selectedItems;trackBy: trackByFn;let k = index\" [hidden]=\"k > settings.badgeShowLimit-1\">\n <span *ngIf=\"!badgeTempl\" class=\"c-label\">{{item[settings.labelKey]}}</span>\n <span *ngIf=\"badgeTempl\" class=\"c-label\">\n <c-templateRenderer [data]=\"badgeTempl\" [item]=\"item\"></c-templateRenderer>\n </span>\n <span class=\"fa fa-remove\" (click)=\"onItemClick(item,k,$event)\"></span>\n </div>\n </div> \n <span class=\"countplaceholder\" *ngIf=\"selectedItems?.length > settings.badgeShowLimit\">+{{selectedItems?.length - settings.badgeShowLimit }}</span>\n <span class=\"fa fa-remove clear-all\" *ngIf=\"settings.clearAll && selectedItems?.length > 0 && !settings.disabled\" (click)=\"clearSelection($event);$event.stopPropagation()\"></span>\n <span class=\"fa\" [ngClass]=\"{'fa-angle-down': !isActive,'fa-angle-up':isActive}\"></span>\n </div> \n </div>\n <div class=\"dropdown-list\" [hidden]=\"!isActive\">\n <div class=\"arrow-up arrow-2\"></div>\n <div class=\"arrow-up\"></div>\n <div class=\"list-area\">\n <div class=\"pure-checkbox select-all\" *ngIf=\"settings.enableCheckAll && !settings.singleSelection && !settings.limitSelection\" (click)=\"toggleSelectAll()\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelectAll\" [disabled]=\"settings.limitSelection == selectedItems?.length\"/>\n <label>\n <span [hidden]=\"isSelectAll\">{{settings.selectAllText}}</span>\n <span [hidden]=\"!isSelectAll\">{{settings.unSelectAllText}}</span>\n </label>\n </div> \n <div class=\"list-filter\" *ngIf=\"settings.enableSearchFilter && !settings.lazyLoading\">\n <span class=\"fa fa-search\"></span>\n <input #searchInput type=\"text\" [placeholder]=\"settings.searchPlaceholderText\" [(ngModel)]=\"filter\">\n </div> \n <div class=\"list-filter\" *ngIf=\"settings.enableSearchFilter && settings.lazyLoading\">\n <span class=\"fa fa-search\"></span>\n <input #searchInput type=\"text\" [placeholder]=\"settings.searchPlaceholderText\" (keyup)=\"filterInfiniteList($event)\">\n </div>\n <ul *ngIf=\"!settings.groupBy\" [style.maxHeight] = \"settings.maxHeight+'px'\" class=\"lazyContainer\" >\n <span *ngIf=\"itemTempl\">\n <li *ngFor=\"let item of data | listFilter:filter; let i = index;\" (click)=\"onItemClick(item,i,$event)\" class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\" [disabled]=\"settings.limitSelection == selectedItems?.length && !isSelected(item)\"/>\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </span>\n <span *ngIf=\"!itemTempl && !settings.lazyLoading\" >\n <li *ngFor=\"let item of data | listFilter:filter; let i = index;\" (click)=\"onItemClick(item,i,$event)\" class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\" [disabled]=\"settings.limitSelection == selectedItems?.length && !isSelected(item)\"/>\n <label>{{item[settings.labelKey]}}</label>\n </li>\n </span>\n <span *ngIf=\"!itemTempl && settings.lazyLoading\" >\n <div [ngStyle]=\"{'height':totalHeight+'px'}\" style=\"position: relative;\">\n\n \n <li *ngFor=\"let item of chunkArray | listFilter:filter; let i = index;\" (click)=\"onItemClick(item,i,$event)\" style=\"position: absolute;width: 100%;\" class=\"pure-checkbox\" [styleProp]=\"chunkIndex[i]\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\" [disabled]=\"settings.limitSelection == selectedItems?.length && !isSelected(item)\"/>\n <label>{{item[settings.labelKey]}}</label>\n </li>\n </div>\n </span>\n </ul>\n <div *ngIf=\"settings.groupBy\" [style.maxHeight] = \"settings.maxHeight+'px'\" style=\"overflow: auto;\">\n <ul *ngFor=\"let obj of groupedData ; let i = index;\" class=\"list-grp\">\n <h4 *ngIf=\"(obj.value | listFilter:filter ).length > 0\">{{obj.key}}</h4>\n <span *ngIf=\"itemTempl\" >\n <li *ngFor=\"let item of obj.value | listFilter:filter; let i = index;\" (click)=\"onItemClick(item,i,$event)\" class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\" [disabled]=\"settings.limitSelection == selectedItems?.length && !isSelected(item)\"/>\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </span>\n <span *ngIf=\"!itemTempl\" >\n <li *ngFor=\"let item of obj.value | listFilter:filter; let i = index;\" (click)=\"onItemClick(item,i,$event)\" class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\" [disabled]=\"settings.limitSelection == selectedItems?.length && !isSelected(item)\"/>\n <label>{{item[settings.labelKey]}}</label>\n </li>\n </span>\n </ul>\n </div>\n <h5 class=\"list-message\" *ngIf=\"data?.length == 0\">{{settings.noDataLabel}}</h5>\n </div>\n </div>\n</div>\n",
26
+ host: { '[class]': 'defaultSettings.classes' },
27
+ styles: [".stackline-dropdown {\n position: relative;\n}\n\n.c-btn {\n display: inline-block;\n background: #fff;\n border: 1px solid #ccc;\n border-radius: 3px;\n font-size: 14px;\n color: #333;\n}\n\n.c-btn.disabled {\n background: #ccc;\n}\n\n.c-btn:focus {\n outline: none;\n}\n\n.selected-list .c-list {\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n flex-wrap: wrap;\n min-width: 0;\n float: none;\n padding: 0px;\n margin: 0px;\n width: auto;\n}\n.selected-list .c-list .c-token {\n list-style: none;\n padding: 0px 5px;\n background: #0079FE;\n color: #fff;\n border-radius: 2px;\n margin-right: 4px;\n margin-top: 2px;\n float: left;\n}\n.selected-list .c-list .c-token .c-label {\n display: block;\n float: left;\n /*width: 50px;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;*/\n}\n.selected-list .c-list .c-token .fa-remove {\n margin-left: 1px;\n font-size: 12px;\n}\n.selected-list .fa-angle-down, .selected-list .fa-angle-up {\n font-size: 15pt;\n position: absolute;\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n}\n.selected-list .countplaceholder {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n align-self: center;\n margin: 0 0 0 6px;\n line-height: 1;\n}\n.selected-list .c-btn {\n box-sizing: border-box;\n width: 100%;\n box-shadow: 0px 1px 5px #959595;\n padding: 10px 68px 10px 10px;\n cursor: pointer;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n position: relative;\n}\n\n.dropdown-list {\n position: absolute;\n padding-top: 14px;\n width: 100%;\n z-index: 9999;\n}\n.dropdown-list ul {\n padding: 0px;\n list-style: none;\n overflow: auto;\n margin: 0px;\n}\n.dropdown-list ul li {\n padding: 10px 10px;\n cursor: pointer;\n text-align: left;\n}\n.dropdown-list ul li:first-child {\n padding-top: 10px;\n}\n.dropdown-list ul li:last-child {\n padding-bottom: 10px;\n}\n.dropdown-list ul li:hover {\n background: #f5f5f5;\n}\n.dropdown-list ::-webkit-scrollbar {\n width: 8px;\n}\n.dropdown-list ::-webkit-scrollbar-thumb {\n background: #cccccc;\n border-radius: 5px;\n}\n.dropdown-list ::-webkit-scrollbar-track {\n background: #f2f2f2;\n}\n\n.arrow-up {\n width: 0;\n height: 0;\n border-left: 13px solid transparent;\n border-right: 13px solid transparent;\n border-bottom: 15px solid #fff;\n margin-left: 15px;\n position: absolute;\n top: 0;\n}\n\n.arrow-2 {\n border-bottom: 15px solid #ccc;\n top: -1px;\n}\n\n.list-area {\n border: 1px solid #ccc;\n border-radius: 3px;\n background: #fff;\n margin: 0px;\n box-shadow: 0px 1px 5px #959595;\n}\n\n.select-all {\n padding: 10px;\n border-bottom: 1px solid #ccc;\n text-align: left;\n}\n\n.list-filter {\n border-bottom: 1px solid #ccc;\n position: relative;\n}\n.list-filter input {\n border: 0px;\n width: 100%;\n height: 35px;\n padding: 0px 0px 0px 35px;\n}\n.list-filter input:focus {\n outline: none;\n}\n.list-filter .fa {\n position: absolute;\n top: 10px;\n left: 13px;\n color: #888;\n}\n\n.pure-checkbox input[type=checkbox] {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n}\n\n.pure-checkbox input[type=checkbox]:focus + label:before,\n.pure-checkbox input[type=checkbox]:hover + label:before {\n border-color: #0079FE;\n background-color: #f2f2f2;\n}\n\n.pure-checkbox input[type=checkbox]:active + label:before {\n transition-duration: 0s;\n}\n\n.pure-checkbox input[type=checkbox] + label {\n position: relative;\n padding-left: 2em;\n vertical-align: middle;\n user-select: none;\n cursor: pointer;\n margin: 0px;\n color: #000;\n font-weight: 300;\n}\n\n.pure-checkbox input[type=checkbox] + label:before {\n box-sizing: content-box;\n content: \"\";\n color: #0079FE;\n position: absolute;\n top: 50%;\n left: 0;\n width: 14px;\n height: 14px;\n margin-top: -9px;\n border: 2px solid #0079FE;\n text-align: center;\n transition: all 0.4s ease;\n}\n\n.pure-checkbox input[type=checkbox] + label:after {\n box-sizing: content-box;\n content: \"\";\n background-color: #0079FE;\n position: absolute;\n top: 50%;\n left: 4px;\n width: 10px;\n height: 10px;\n margin-top: -5px;\n transform: scale(0);\n transform-origin: 50%;\n transition: transform 200ms ease-out;\n}\n\n.pure-checkbox input[type=checkbox]:disabled + label:before {\n border-color: #cccccc;\n}\n\n.pure-checkbox input[type=checkbox]:disabled:focus + label:before .pure-checkbox input[type=checkbox]:disabled:hover + label:before {\n background-color: inherit;\n}\n\n.pure-checkbox input[type=checkbox]:disabled:checked + label:before {\n background-color: #cccccc;\n}\n\n.pure-checkbox input[type=checkbox] + label:after {\n background-color: transparent;\n top: 50%;\n left: 4px;\n width: 8px;\n height: 3px;\n margin-top: -4px;\n border-style: solid;\n border-color: #ffffff;\n border-width: 0 0 3px 3px;\n border-image: none;\n transform: rotate(-45deg) scale(0);\n}\n\n.pure-checkbox input[type=checkbox]:checked + label:after {\n content: \"\";\n transform: rotate(-45deg) scale(1);\n transition: transform 200ms ease-out;\n}\n\n.pure-checkbox input[type=radio]:checked + label:before {\n background-color: white;\n}\n\n.pure-checkbox input[type=radio]:checked + label:after {\n transform: scale(1);\n}\n\n.pure-checkbox input[type=radio] + label:before {\n border-radius: 50%;\n}\n\n.pure-checkbox input[type=checkbox]:checked + label:before {\n background: #0079FE;\n}\n\n.pure-checkbox input[type=checkbox]:checked + label:after {\n transform: rotate(-45deg) scale(1);\n}\n\n.list-message {\n text-align: center;\n}\n\n.list-grp {\n padding: 0 15px !important;\n}\n\n.list-grp h4 {\n text-transform: capitalize;\n margin: 15px 0px 0px 0px;\n font-size: 14px;\n font-weight: 700;\n}\n\n.list-grp > li {\n padding-left: 15px !important;\n}\n\n.stackline-dropdown.theme-material,\n.stackline-dropdown.theme-dark,\n.stackline-dropdown.theme-custom {\n --ms-primary: #3f51b5;\n --ms-primary-soft: rgba(63, 81, 181, 0.12);\n --ms-surface: #ffffff;\n --ms-surface-soft: #f5f7fb;\n --ms-surface-muted: #e8eaf6;\n --ms-outline: #c5cae9;\n --ms-outline-strong: #7986cb;\n --ms-on-surface: #212121;\n --ms-on-surface-muted: #5f6368;\n --ms-chip-bg: #e8eaf6;\n --ms-chip-text: #303f9f;\n --ms-chip-remove: #303f9f;\n --ms-divider: rgba(125, 119, 134, 0.16);\n --ms-section-bg: rgba(247, 242, 250, 0.76);\n --ms-selected-text: var(--ms-primary);\n --ms-shadow: 0 1px 2px rgba(33, 33, 33, 0.16), 0 12px 32px rgba(63, 81, 181, 0.12);\n --ms-shadow-soft: 0 1px 2px rgba(33, 33, 33, 0.12), 0 4px 12px rgba(33, 33, 33, 0.08);\n display: block;\n width: 100%;\n color: var(--ms-on-surface);\n font: inherit;\n}\n\n.stackline-dropdown.theme-dark {\n --ms-primary: #8ab4f8;\n --ms-primary-soft: rgba(138, 180, 248, 0.18);\n --ms-surface: #151a23;\n --ms-surface-soft: #202736;\n --ms-surface-muted: #111722;\n --ms-outline: #384456;\n --ms-outline-strong: #8ab4f8;\n --ms-on-surface: #edf2f7;\n --ms-on-surface-muted: #aab6c5;\n --ms-chip-bg: #263247;\n --ms-chip-text: #d7e6ff;\n --ms-chip-remove: #d7e6ff;\n --ms-divider: rgba(170, 182, 197, 0.18);\n --ms-section-bg: #101620;\n --ms-selected-text: #d7e6ff;\n --ms-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);\n --ms-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 24px rgba(0, 0, 0, 0.28);\n}\n\n.stackline-dropdown.theme-custom {\n --ms-primary: var(--stackline-ms-primary, #0f766e);\n --ms-primary-soft: var(--stackline-ms-primary-soft, rgba(15, 118, 110, 0.14));\n --ms-surface: var(--stackline-ms-surface, #ffffff);\n --ms-surface-soft: var(--stackline-ms-surface-soft, #ecfdf5);\n --ms-surface-muted: var(--stackline-ms-surface-muted, #d1fae5);\n --ms-outline: var(--stackline-ms-outline, #99f6e4);\n --ms-outline-strong: var(--stackline-ms-outline-strong, #0f766e);\n --ms-on-surface: var(--stackline-ms-on-surface, #102a2a);\n --ms-on-surface-muted: var(--stackline-ms-on-surface-muted, #47615f);\n --ms-chip-bg: var(--stackline-ms-chip-bg, #ccfbf1);\n --ms-chip-text: var(--stackline-ms-chip-text, #115e59);\n --ms-chip-remove: var(--stackline-ms-chip-remove, #115e59);\n --ms-divider: var(--stackline-ms-divider, rgba(15, 118, 110, 0.16));\n --ms-section-bg: var(--stackline-ms-section-bg, #f0fdfa);\n --ms-selected-text: var(--stackline-ms-selected-text, var(--ms-primary));\n --ms-shadow: var(--stackline-ms-shadow, 0 18px 42px rgba(15, 118, 110, 0.15));\n --ms-shadow-soft: var(--stackline-ms-shadow-soft, 0 1px 2px rgba(15, 118, 110, 0.16), 0 8px 18px rgba(15, 118, 110, 0.09));\n}\n\n.stackline-dropdown.theme-material .selected-list,\n.stackline-dropdown.theme-dark .selected-list,\n.stackline-dropdown.theme-custom .selected-list {\n width: 100%;\n}\n\n.stackline-dropdown.theme-material .selected-list .c-btn,\n.stackline-dropdown.theme-dark .selected-list .c-btn,\n.stackline-dropdown.theme-custom .selected-list .c-btn {\n position: relative;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n gap: 8px;\n width: 100%;\n min-height: 56px;\n padding: 11px 84px 11px 16px;\n border-radius: 18px;\n border: 1px solid var(--ms-outline);\n background: var(--ms-surface);\n box-shadow: var(--ms-shadow-soft);\n color: var(--ms-on-surface);\n cursor: pointer;\n font-size: inherit;\n line-height: 1.45;\n transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, transform 0.16s ease;\n}\n\n.stackline-dropdown.theme-material .selected-list .c-btn:hover,\n.stackline-dropdown.theme-dark .selected-list .c-btn:hover,\n.stackline-dropdown.theme-custom .selected-list .c-btn:hover {\n border-color: var(--ms-outline-strong);\n}\n\n.stackline-dropdown.theme-material .selected-list .c-btn.disabled,\n.stackline-dropdown.theme-dark .selected-list .c-btn.disabled,\n.stackline-dropdown.theme-custom .selected-list .c-btn.disabled {\n background: var(--ms-surface);\n cursor: not-allowed;\n opacity: 0.72;\n}\n\n.stackline-dropdown.theme-material .selected-list .c-list,\n.stackline-dropdown.theme-dark .selected-list .c-list,\n.stackline-dropdown.theme-custom .selected-list .c-list {\n display: flex;\n flex: 1 1 auto;\n flex-wrap: wrap;\n gap: 8px;\n width: auto;\n min-width: 0;\n margin: 0;\n padding: 0;\n float: none;\n}\n\n.stackline-dropdown.theme-material .selected-list .c-list .c-token,\n.stackline-dropdown.theme-dark .selected-list .c-list .c-token,\n.stackline-dropdown.theme-custom .selected-list .c-list .c-token {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n min-height: 32px;\n max-width: 100%;\n padding: 6px 30px 6px 12px;\n background: var(--ms-chip-bg);\n color: var(--ms-chip-text);\n border-radius: 999px;\n box-shadow: inset 0 0 0 1px rgba(103, 80, 164, 0.08);\n line-height: 1.35;\n white-space: normal;\n overflow-wrap: anywhere;\n margin: 0;\n float: none;\n}\n\n.stackline-dropdown.theme-material .selected-list .c-list .c-token .c-label,\n.stackline-dropdown.theme-dark .selected-list .c-list .c-token .c-label,\n.stackline-dropdown.theme-custom .selected-list .c-list .c-token .c-label {\n display: inline-flex;\n align-items: center;\n float: none;\n min-width: 0;\n max-width: 100%;\n line-height: 1.3;\n font-weight: 500;\n white-space: normal;\n overflow-wrap: anywhere;\n}\n\n.stackline-dropdown.theme-material .selected-list .c-list .c-token .fa-remove,\n.stackline-dropdown.theme-dark .selected-list .c-list .c-token .fa-remove,\n.stackline-dropdown.theme-custom .selected-list .c-list .c-token .fa-remove {\n position: absolute;\n right: 10px;\n top: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n margin-left: 0;\n transform: translateY(-50%);\n color: var(--ms-chip-remove);\n cursor: pointer;\n}\n\n.stackline-dropdown.theme-material .selected-list .countplaceholder,\n.stackline-dropdown.theme-dark .selected-list .countplaceholder,\n.stackline-dropdown.theme-custom .selected-list .countplaceholder {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n align-self: center;\n margin: 0;\n line-height: 1;\n color: var(--ms-on-surface-muted);\n font-size: 0.8rem;\n font-weight: 600;\n}\n\n.stackline-dropdown.theme-material .selected-list .fa-angle-down,\n.stackline-dropdown.theme-dark .selected-list .fa-angle-down,\n.stackline-dropdown.theme-custom .selected-list .fa-angle-down,\n.stackline-dropdown.theme-material .selected-list .fa-angle-up,\n.stackline-dropdown.theme-dark .selected-list .fa-angle-up,\n.stackline-dropdown.theme-custom .selected-list .fa-angle-up {\n position: absolute;\n top: 50%;\n right: 16px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n transform: translateY(-50%);\n color: var(--ms-on-surface-muted);\n font-size: 15pt;\n pointer-events: none;\n}\n\n.stackline-dropdown.theme-material .dropdown-list,\n.stackline-dropdown.theme-dark .dropdown-list,\n.stackline-dropdown.theme-custom .dropdown-list {\n position: absolute;\n width: 100%;\n padding-top: 8px;\n z-index: 99999;\n}\n\n.stackline-dropdown.theme-material .arrow-up,\n.stackline-dropdown.theme-dark .arrow-up,\n.stackline-dropdown.theme-custom .arrow-up,\n.stackline-dropdown.theme-material .arrow-down,\n.stackline-dropdown.theme-dark .arrow-down,\n.stackline-dropdown.theme-custom .arrow-down,\n.stackline-dropdown.theme-material .arrow-2,\n.stackline-dropdown.theme-dark .arrow-2,\n.stackline-dropdown.theme-custom .arrow-2 {\n display: none;\n}\n\n.stackline-dropdown.theme-material .list-area,\n.stackline-dropdown.theme-dark .list-area,\n.stackline-dropdown.theme-custom .list-area {\n overflow: hidden;\n border-radius: 22px;\n background: var(--ms-surface);\n border: 1px solid var(--ms-outline);\n box-shadow: var(--ms-shadow);\n margin: 0;\n}\n\n.stackline-dropdown.theme-material .select-all,\n.stackline-dropdown.theme-dark .select-all,\n.stackline-dropdown.theme-custom .select-all {\n padding: 10px 14px;\n border-bottom: 1px solid var(--ms-divider);\n background: var(--ms-section-bg);\n text-align: left;\n}\n\n.stackline-dropdown.theme-material .list-filter,\n.stackline-dropdown.theme-dark .list-filter,\n.stackline-dropdown.theme-custom .list-filter {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 52px;\n padding-left: 48px;\n padding-right: 44px;\n border-bottom: 1px solid var(--ms-divider);\n background: var(--ms-surface);\n}\n\n.stackline-dropdown.theme-material .list-filter input,\n.stackline-dropdown.theme-dark .list-filter input,\n.stackline-dropdown.theme-custom .list-filter input {\n width: 100%;\n height: 100%;\n border: 0;\n background: transparent;\n color: var(--ms-on-surface);\n font: inherit;\n padding: 0;\n}\n\n.stackline-dropdown.theme-material .list-filter input::placeholder,\n.stackline-dropdown.theme-dark .list-filter input::placeholder,\n.stackline-dropdown.theme-custom .list-filter input::placeholder {\n color: var(--ms-on-surface-muted);\n}\n\n.stackline-dropdown.theme-material .list-filter input:focus,\n.stackline-dropdown.theme-dark .list-filter input:focus,\n.stackline-dropdown.theme-custom .list-filter input:focus {\n outline: none;\n}\n\n.stackline-dropdown.theme-material .list-filter .fa,\n.stackline-dropdown.theme-dark .list-filter .fa,\n.stackline-dropdown.theme-custom .list-filter .fa {\n position: absolute;\n top: 50%;\n left: 16px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n transform: translateY(-50%);\n color: var(--ms-on-surface-muted);\n}\n\n.stackline-dropdown.theme-material .dropdown-list ul,\n.stackline-dropdown.theme-dark .dropdown-list ul,\n.stackline-dropdown.theme-custom .dropdown-list ul {\n list-style: none;\n margin: 0;\n padding: 8px;\n overflow: auto;\n}\n\n.stackline-dropdown.theme-material .dropdown-list ul li,\n.stackline-dropdown.theme-dark .dropdown-list ul li,\n.stackline-dropdown.theme-custom .dropdown-list ul li {\n align-items: center;\n min-height: 0;\n margin: 4px;\n padding: 12px 14px;\n border-radius: 14px;\n cursor: pointer;\n text-align: left;\n line-height: 1.35;\n transition: background-color 0.16s ease, color 0.16s ease;\n}\n\n.stackline-dropdown.theme-material .dropdown-list ul li:first-child,\n.stackline-dropdown.theme-dark .dropdown-list ul li:first-child,\n.stackline-dropdown.theme-custom .dropdown-list ul li:first-child {\n padding-top: 12px;\n}\n\n.stackline-dropdown.theme-material .dropdown-list ul li:last-child,\n.stackline-dropdown.theme-dark .dropdown-list ul li:last-child,\n.stackline-dropdown.theme-custom .dropdown-list ul li:last-child {\n padding-bottom: 12px;\n}\n\n.stackline-dropdown.theme-material .dropdown-list ul li:hover,\n.stackline-dropdown.theme-dark .dropdown-list ul li:hover,\n.stackline-dropdown.theme-custom .dropdown-list ul li:hover {\n background: var(--ms-surface-soft);\n}\n\n.stackline-dropdown.theme-material .pure-checkbox,\n.stackline-dropdown.theme-dark .pure-checkbox,\n.stackline-dropdown.theme-custom .pure-checkbox {\n position: relative;\n}\n\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox] + label,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox] + label,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox] + label {\n position: relative;\n display: block;\n width: 100%;\n margin: 0;\n padding-left: 32px;\n color: inherit;\n cursor: pointer;\n font-weight: 500;\n user-select: none;\n}\n\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox] + label:before,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox] + label:before,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox] + label:before {\n box-sizing: content-box;\n content: \"\";\n position: absolute;\n top: 50%;\n left: 0;\n width: 16px;\n height: 16px;\n margin-top: -10px;\n border: 2px solid var(--ms-outline-strong);\n border-radius: 5px;\n background: var(--ms-surface);\n transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;\n}\n\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox] + label:after,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox] + label:after,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox] + label:after {\n box-sizing: content-box;\n content: \"\";\n position: absolute;\n top: 50%;\n left: 5px;\n width: 8px;\n height: 3px;\n margin-top: -4px;\n border-style: solid;\n border-color: #ffffff;\n border-width: 0 0 3px 3px;\n border-image: none;\n background: transparent;\n transform: rotate(-45deg) scale(0);\n transform-origin: 50%;\n transition: transform 0.16s ease;\n}\n\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox]:focus + label:before,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox]:focus + label:before,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox]:focus + label:before,\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox]:hover + label:before,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox]:hover + label:before,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox]:hover + label:before {\n border-color: var(--ms-primary);\n background: var(--ms-surface-soft);\n}\n\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox]:checked + label:before,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox]:checked + label:before,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox]:checked + label:before {\n border-color: var(--ms-primary);\n background: var(--ms-primary);\n}\n\n.stackline-dropdown.theme-material .pure-checkbox input[type=checkbox]:checked + label:after,\n.stackline-dropdown.theme-dark .pure-checkbox input[type=checkbox]:checked + label:after,\n.stackline-dropdown.theme-custom .pure-checkbox input[type=checkbox]:checked + label:after {\n transform: rotate(-45deg) scale(1);\n}\n\n.stackline-dropdown.theme-material .list-message,\n.stackline-dropdown.theme-dark .list-message,\n.stackline-dropdown.theme-custom .list-message {\n margin: 0;\n padding: 20px 14px;\n color: var(--ms-on-surface-muted);\n text-align: center;\n}\n"],
28
+ providers: [DROPDOWN_CONTROL_VALUE_ACCESSOR, DROPDOWN_CONTROL_VALIDATION]
29
+ })
30
+
31
+ export class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChanges, Validator {
32
+
33
+ @Input()
34
+ data: Array<ListItem>;
35
+
36
+ @Input()
37
+ settings: DropdownSettings;
38
+
39
+ @Output('onSelect')
40
+ onSelect: EventEmitter<ListItem> = new EventEmitter<ListItem>();
41
+
42
+ @Output('onDeSelect')
43
+ onDeSelect: EventEmitter<ListItem> = new EventEmitter<ListItem>();
44
+
45
+ @Output('onSelectAll')
46
+ onSelectAll: EventEmitter<Array<ListItem>> = new EventEmitter<Array<ListItem>>();
47
+
48
+ @Output('onDeSelectAll')
49
+ onDeSelectAll: EventEmitter<Array<ListItem>> = new EventEmitter<Array<ListItem>>();
50
+
51
+ @Output('onOpen')
52
+ onOpen: EventEmitter<any> = new EventEmitter<any>();
53
+
54
+ @Output('onClose')
55
+ onClose: EventEmitter<any> = new EventEmitter<any>();
56
+
57
+ @ContentChild(Item) itemTempl: Item;
58
+ @ContentChild(Badge) badgeTempl: Badge;
59
+
60
+
61
+ @ViewChild('searchInput') searchInput: ElementRef;
62
+
63
+ public selectedItems: Array<ListItem>;
64
+ public isActive: boolean = false;
65
+ public isSelectAll: boolean = false;
66
+ public groupedData: Array<ListItem>;
67
+ filter: any;
68
+ public chunkArray:any[];
69
+ public scrollTop:any;
70
+ public chunkIndex:any[] = [];
71
+ public cachedItems:any[] = [];
72
+ public totalRows:any;
73
+ public itemHeight:any = 41.6;
74
+ public screenItemsLen:any;
75
+ public cachedItemsLen:any;
76
+ public totalHeight: any;
77
+ public scroller:any;
78
+ public maxBuffer:any;
79
+ public lastScrolled:any;
80
+ public lastRepaintY: any;
81
+
82
+ defaultSettings: DropdownSettings = {
83
+ singleSelection: false,
84
+ text: 'Select',
85
+ enableCheckAll: true,
86
+ selectAllText: 'Select All',
87
+ unSelectAllText: 'UnSelect All',
88
+ enableSearchFilter: false,
89
+ maxHeight: 300,
90
+ badgeShowLimit: 999999999999,
91
+ classes: '',
92
+ disabled: false,
93
+ searchPlaceholderText: 'Search',
94
+ showCheckbox: true,
95
+ noDataLabel: 'No Data Available',
96
+ searchAutofocus: true,
97
+ lazyLoading: false,
98
+ labelKey: 'itemName',
99
+ theme: 'classic',
100
+ skin: 'classic',
101
+ clearAll: true
102
+ }
103
+ public parseError: boolean;
104
+ constructor(public _elementRef : ElementRef) {
105
+
106
+ }
107
+ getThemeName(): string {
108
+ let rawTheme: any = 'classic';
109
+ if (this.settings) {
110
+ rawTheme = this.settings.skin || this.settings.theme || 'classic';
111
+ }
112
+ let theme = String(rawTheme).toLowerCase().replace(/[^a-z0-9_-]+/g, '-');
113
+ theme = theme.replace(/^-+|-+$/g, '');
114
+ return theme || 'classic';
115
+ }
116
+ getDropdownClasses(): string {
117
+ let theme = this.getThemeName();
118
+ let className = 'theme-' + theme;
119
+ if (theme !== 'classic' && theme !== 'material' && theme !== 'dark' && theme !== 'custom') {
120
+ className += ' theme-custom';
121
+ }
122
+ if (this.isActive) {
123
+ className += ' is-open';
124
+ }
125
+ if (this.settings && this.settings.disabled) {
126
+ className += ' is-disabled';
127
+ }
128
+ return className;
129
+ }
130
+ ngOnInit() {
131
+ this.settings = Object.assign(this.defaultSettings, this.settings);
132
+ if (this.settings.groupBy) {
133
+ this.groupedData = this.transformData(this.data, this.settings.groupBy);
134
+ }
135
+ this.totalRows = (this.data && this.data.length);
136
+ this.cachedItems = this.data;
137
+ this.screenItemsLen = Math.ceil(this.settings.maxHeight / this.itemHeight);
138
+ this.cachedItemsLen = this.screenItemsLen * 3;
139
+ this.totalHeight = this.itemHeight * this.totalRows;
140
+ this.maxBuffer = this.screenItemsLen * this.itemHeight;
141
+ this.lastScrolled = 0;
142
+ this.renderChunk(0, this.cachedItemsLen / 2);
143
+ }
144
+ ngOnChanges(changes: SimpleChanges) {
145
+ if (changes.data && !changes.data.isFirstChange()) {
146
+ if (this.settings.groupBy) {
147
+ this.groupedData = this.transformData(this.data, this.settings.groupBy);
148
+ if (this.data.length == 0) {
149
+ this.selectedItems = [];
150
+ }
151
+ }
152
+ }
153
+ if (changes.settings && !changes.settings.isFirstChange()) {
154
+ this.settings = Object.assign(this.defaultSettings, this.settings);
155
+ }
156
+ }
157
+ ngDoCheck() {
158
+ if (this.selectedItems) {
159
+ if (this.selectedItems.length == 0 || this.data.length == 0 || this.selectedItems.length < this.data.length) {
160
+ this.isSelectAll = false;
161
+ }
162
+ }
163
+ }
164
+ ngAfterViewInit() {
165
+ if(this.settings.lazyLoading){
166
+ this._elementRef.nativeElement.getElementsByClassName("lazyContainer")[0].addEventListener('scroll', this.onScroll.bind(this));
167
+ }
168
+ }
169
+ onItemClick(item: ListItem, index: number, evt: Event) {
170
+ if (this.settings.disabled) {
171
+ return false;
172
+ }
173
+
174
+ let found = this.isSelected(item);
175
+ let limit = this.selectedItems.length < this.settings.limitSelection ? true : false;
176
+
177
+ if (!found) {
178
+ if (this.settings.limitSelection) {
179
+ if (limit) {
180
+ this.addSelected(item);
181
+ this.onSelect.emit(item);
182
+ }
183
+ }
184
+ else {
185
+ this.addSelected(item);
186
+ this.onSelect.emit(item);
187
+ }
188
+
189
+ }
190
+ else {
191
+ this.removeSelected(item);
192
+ this.onDeSelect.emit(item);
193
+ }
194
+ if (this.isSelectAll || this.data.length > this.selectedItems.length) {
195
+ this.isSelectAll = false;
196
+ }
197
+ if (this.data.length == this.selectedItems.length) {
198
+ this.isSelectAll = true;
199
+ }
200
+ }
201
+ public validate(c: FormControl): any {
202
+ return null;
203
+ }
204
+ private onTouchedCallback: (_: any) => void = noop;
205
+ private onChangeCallback: (_: any) => void = noop;
206
+
207
+ writeValue(value: any) {
208
+ if (value !== undefined && value !== null) {
209
+ if (this.settings.singleSelection) {
210
+ try {
211
+
212
+ if (value.length > 1) {
213
+ this.selectedItems = [value[0]];
214
+ throw new MyException(404, { "msg": "Single Selection Mode, Selected Items cannot have more than one item." });
215
+ }
216
+ else {
217
+ this.selectedItems = value;
218
+ }
219
+ }
220
+ catch (e) {
221
+ console.error(e.body.msg);
222
+ }
223
+
224
+ }
225
+ else {
226
+ if (this.settings.limitSelection) {
227
+ this.selectedItems = value.splice(0, this.settings.limitSelection);
228
+ }
229
+ else {
230
+ this.selectedItems = value;
231
+ }
232
+ if (this.selectedItems.length === this.data.length && this.data.length > 0) {
233
+ this.isSelectAll = true;
234
+ }
235
+ }
236
+ } else {
237
+ this.selectedItems = [];
238
+ }
239
+ }
240
+
241
+ //From ControlValueAccessor interface
242
+ registerOnChange(fn: any) {
243
+ this.onChangeCallback = fn;
244
+ }
245
+
246
+ //From ControlValueAccessor interface
247
+ registerOnTouched(fn: any) {
248
+ this.onTouchedCallback = fn;
249
+ }
250
+ trackByFn(index: number, item: ListItem) {
251
+ return item.id;
252
+ }
253
+ isSelected(clickedItem: ListItem) {
254
+ let found = false;
255
+ this.selectedItems && this.selectedItems.forEach(item => {
256
+ if (clickedItem.id === item.id) {
257
+ found = true;
258
+ }
259
+ });
260
+ return found;
261
+ }
262
+ addSelected(item: ListItem) {
263
+ if (this.settings.singleSelection) {
264
+ this.selectedItems = [];
265
+ this.selectedItems.push(item);
266
+ this.closeDropdown();
267
+ }
268
+ else
269
+ this.selectedItems.push(item);
270
+ this.onChangeCallback(this.selectedItems);
271
+ this.onTouchedCallback(this.selectedItems);
272
+ }
273
+ removeSelected(clickedItem: ListItem) {
274
+ this.selectedItems && this.selectedItems.forEach(item => {
275
+ if (clickedItem.id === item.id) {
276
+ this.selectedItems.splice(this.selectedItems.indexOf(item), 1);
277
+ }
278
+ });
279
+ this.onChangeCallback(this.selectedItems);
280
+ this.onTouchedCallback(this.selectedItems);
281
+ }
282
+ clearSelection(e?: any) {
283
+ this.selectedItems = [];
284
+ this.isSelectAll = false;
285
+ this.onChangeCallback(this.selectedItems);
286
+ this.onTouchedCallback(this.selectedItems);
287
+ this.onDeSelectAll.emit(this.selectedItems);
288
+ }
289
+ toggleDropdown(evt: any) {
290
+ if (this.settings.disabled) {
291
+ return false;
292
+ }
293
+ this.isActive = !this.isActive;
294
+ if (this.isActive) {
295
+ if (this.settings.searchAutofocus && this.settings.enableSearchFilter) {
296
+ setTimeout(() => {
297
+ this.searchInput.nativeElement.focus();
298
+ }, 0);
299
+ }
300
+ this.onOpen.emit(true);
301
+ }
302
+ else {
303
+ this.onClose.emit(false);
304
+ }
305
+ evt.preventDefault();
306
+ }
307
+ closeDropdown() {
308
+ if(this.searchInput){
309
+ this.searchInput.nativeElement.value = "";
310
+ this.data = [];
311
+ this.data = this.cachedItems;
312
+ this.totalHeight = this.itemHeight * this.data.length;
313
+ this.totalRows = this.data.length;
314
+ this.updateView(this.scrollTop);
315
+ }
316
+ this.filter = "";
317
+ this.isActive = false;
318
+ this.onClose.emit(false);
319
+ }
320
+ toggleSelectAll() {
321
+ if (!this.isSelectAll) {
322
+ this.selectedItems = [];
323
+ this.selectedItems = this.data.slice();
324
+ this.isSelectAll = true;
325
+ this.onChangeCallback(this.selectedItems);
326
+ this.onTouchedCallback(this.selectedItems);
327
+
328
+ this.onSelectAll.emit(this.selectedItems);
329
+ }
330
+ else {
331
+ this.selectedItems = [];
332
+ this.isSelectAll = false;
333
+ this.onChangeCallback(this.selectedItems);
334
+ this.onTouchedCallback(this.selectedItems);
335
+
336
+ this.onDeSelectAll.emit(this.selectedItems);
337
+ }
338
+ }
339
+ transformData(arr: Array<ListItem>, field: any): Array<ListItem> {
340
+ const groupedObj: any = arr.reduce((prev: any, cur: any) => {
341
+ if (!prev[cur[field]]) {
342
+ prev[cur[field]] = [cur];
343
+ } else {
344
+ prev[cur[field]].push(cur);
345
+ }
346
+ return prev;
347
+ }, {});
348
+ const tempArr: any = [];
349
+ Object.keys(groupedObj).map(function (x) {
350
+ tempArr.push({ key: x, value: groupedObj[x] });
351
+ });
352
+ return tempArr;
353
+ }
354
+ renderChunk(fromPos:any, howMany:any) {
355
+ this.chunkArray = [];
356
+ this.chunkIndex = [];
357
+ var finalItem = fromPos + howMany;
358
+ if (finalItem > this.totalRows)
359
+ finalItem = this.totalRows;
360
+
361
+ for (var i = fromPos; i < finalItem; i++) {
362
+ this.chunkIndex.push((i * this.itemHeight) + 'px');
363
+ this.chunkArray.push(this.data[i]);
364
+ }
365
+ }
366
+ public onScroll(e:any) {
367
+ this.scrollTop = e.target.scrollTop;
368
+ this.updateView(this.scrollTop);
369
+
370
+ }
371
+ public updateView(scrollTop:any){
372
+ var scrollPos = scrollTop ? scrollTop: 0;
373
+ var first = (scrollPos / this.itemHeight) - this.screenItemsLen;
374
+ var firstTemp = ""+first;
375
+ first = parseInt(firstTemp) < 0 ? 0 : parseInt(firstTemp);
376
+ this.renderChunk(first, this.cachedItemsLen);
377
+ this.lastRepaintY = scrollPos;
378
+ }
379
+ public filterInfiniteList(evt: any){
380
+ var filteredElems:Array<any> = [];
381
+ this.data = this.cachedItems.slice();
382
+ if(evt.target.value.toString() != ''){
383
+ this.data.filter(function(el:any){
384
+ for(var prop in el){
385
+ if(el[prop].toString().toLowerCase().indexOf(evt.target.value.toString().toLowerCase()) >=0 ){
386
+ filteredElems.push(el);
387
+ break;
388
+ }
389
+ }
390
+ });
391
+ //this.cachedItems = this.data;
392
+ this.totalHeight = this.itemHeight * filteredElems.length;
393
+ this.totalRows = filteredElems.length;
394
+ this.data = [];
395
+ this.data = filteredElems;
396
+ this.updateView(this.scrollTop);
397
+ }
398
+ else if(evt.target.value.toString() == '' && this.cachedItems.length > 0){
399
+ this.data = [];
400
+ this.data = this.cachedItems;
401
+ this.totalHeight = this.itemHeight * this.data.length;
402
+ this.totalRows = this.data.length;
403
+ this.updateView(this.scrollTop);
404
+ }
405
+ }
406
+ }
407
+
408
+ @NgModule({
409
+ imports: [CommonModule, FormsModule],
410
+ declarations: [AngularMultiSelect, ClickOutsideDirective, ScrollDirective, styleDirective, ListFilterPipe, Item, TemplateRenderer, Badge],
411
+ exports: [AngularMultiSelect, ClickOutsideDirective, ScrollDirective, styleDirective, ListFilterPipe, Item, TemplateRenderer, Badge]
412
+ })
413
+ export class AngularMultiSelectModule { }
@@ -0,0 +1,22 @@
1
+ export interface DropdownSettings{
2
+ singleSelection: Boolean;
3
+ text: String;
4
+ enableCheckAll : Boolean;
5
+ selectAllText: String;
6
+ unSelectAllText: String;
7
+ enableSearchFilter: Boolean;
8
+ maxHeight: number;
9
+ badgeShowLimit: Number;
10
+ classes: String;
11
+ limitSelection?: Number;
12
+ disabled?: Boolean;
13
+ searchPlaceholderText: String;
14
+ groupBy?: String;
15
+ showCheckbox?: Boolean;
16
+ noDataLabel: string;
17
+ searchAutofocus?: boolean;
18
+ lazyLoading?: boolean;
19
+ labelKey?: String;
20
+ theme?: String;
21
+ skin?: String;
22
+ }
@@ -0,0 +1,13 @@
1
+ export class ListItem{
2
+ id: Number;
3
+ itemName: String
4
+ }
5
+ export class MyException {
6
+ status : number;
7
+ body : any;
8
+ constructor(status : number, body : any) {
9
+ this.status = status;
10
+ this.body = body;
11
+ }
12
+
13
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["es2015", "es2017", "dom"],
5
+ "module": "es2015",
6
+ "moduleResolution": "node",
7
+ "sourceMap": true,
8
+ "declaration": true,
9
+ "removeComments": false,
10
+ "noImplicitAny": true,
11
+ "experimentalDecorators": true,
12
+ "emitDecoratorMetadata": true,
13
+ "allowUnreachableCode": false,
14
+ "allowUnusedLabels": false,
15
+ "pretty": true,
16
+ "stripInternal": true,
17
+ "skipLibCheck": true,
18
+ "outDir": "dist",
19
+ "rootDir": "./tmp/src-inlined"
20
+ },
21
+ "files": [
22
+ "./tmp/src-inlined/index.ts",
23
+ "./tmp/src-inlined/angular2-multiselect-dropdown.ts"
24
+ ],
25
+ "angularCompilerOptions": {
26
+ "genDir": "dist",
27
+ "debug": false,
28
+ "skipTemplateCodegen": true,
29
+ "skipMetadataEmit": false,
30
+ "strictMetadataEmit": true
31
+ }
32
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "noEmit": true,
7
+ "sourceMap": true,
8
+ "declaration": false,
9
+ "noImplicitAny": false,
10
+ "experimentalDecorators": true,
11
+ "emitDecoratorMetadata": true,
12
+ "lib": [
13
+ "es2015",
14
+ "dom"
15
+ ],
16
+ "typeRoots" : [
17
+ "./node_modules/@types"
18
+ ],
19
+ "types": [
20
+ "jasmine",
21
+ "karma",
22
+ "node",
23
+ "webpack",
24
+ "webpack-env"
25
+ ]
26
+ },
27
+ "include": [
28
+ "src/app/angular2-multiselect-dropdown/**/*.ts"
29
+ ],
30
+ "exclude": [
31
+ "src/**/*.spec.ts",
32
+ "node_modules",
33
+ "demo",
34
+ "dist"
35
+ ]
36
+ }
@@ -0,0 +1,70 @@
1
+ import * as webpack from 'webpack';
2
+ import * as path from 'path';
3
+
4
+ export default {
5
+ resolve: {
6
+ extensions: [ '.ts', '.js', '.json' ]
7
+ },
8
+ module: {
9
+ rules: [
10
+ {
11
+ test: /\.ts$/,
12
+ use: [
13
+ {
14
+ loader: 'awesome-typescript-loader',
15
+ options: {
16
+ configFileName: 'tsconfig.json'
17
+ }
18
+ },
19
+ {
20
+ loader: 'angular2-template-loader'
21
+ }
22
+ ],
23
+ exclude: [
24
+ /\.e2e\.ts$/,
25
+ /node_modules/
26
+ ]
27
+ },
28
+
29
+ {
30
+ test: /.ts$/,
31
+ exclude: /(node_modules|\.spec\.ts|\.e2e\.ts$)/,
32
+ loader: 'istanbul-instrumenter-loader',
33
+ enforce: 'post'
34
+ },
35
+
36
+ {
37
+ test: /\.json$/,
38
+ use: 'json-loader'
39
+ },
40
+
41
+ {
42
+ test: /\.css$/,
43
+ use: ['to-string-loader', 'css-loader']
44
+ },
45
+
46
+ {
47
+ test: /\.scss$/,
48
+ use: ['to-string-loader', 'css-loader', 'sass-loader']
49
+ },
50
+
51
+ {
52
+ test: /\.html$/,
53
+ use: 'raw-loader'
54
+ }
55
+ ]
56
+ },
57
+ plugins: [
58
+ new webpack.SourceMapDevToolPlugin({
59
+ filename: null,
60
+ test: /\.(ts|js)($|\?)/i
61
+ }),
62
+
63
+ new webpack.ContextReplacementPlugin(
64
+ /angular(\\|\/)core(\\|\/)@angular/,
65
+ path.join(__dirname, 'src')
66
+ ),
67
+
68
+ new webpack.NoEmitOnErrorsPlugin()
69
+ ]
70
+ } as webpack.Configuration;