@stackline/angular-multiselect-dropdown 2.0.5 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,405 @@
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\" [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 36px 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 54px 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
+ }
102
+ public parseError: boolean;
103
+ constructor(public _elementRef : ElementRef) {
104
+
105
+ }
106
+ getThemeName(): string {
107
+ let rawTheme: any = 'classic';
108
+ if (this.settings) {
109
+ rawTheme = this.settings.skin || this.settings.theme || 'classic';
110
+ }
111
+ let theme = String(rawTheme).toLowerCase().replace(/[^a-z0-9_-]+/g, '-');
112
+ theme = theme.replace(/^-+|-+$/g, '');
113
+ return theme || 'classic';
114
+ }
115
+ getDropdownClasses(): string {
116
+ let theme = this.getThemeName();
117
+ let className = 'theme-' + theme;
118
+ if (theme !== 'classic' && theme !== 'material' && theme !== 'dark' && theme !== 'custom') {
119
+ className += ' theme-custom';
120
+ }
121
+ if (this.isActive) {
122
+ className += ' is-open';
123
+ }
124
+ if (this.settings && this.settings.disabled) {
125
+ className += ' is-disabled';
126
+ }
127
+ return className;
128
+ }
129
+ ngOnInit() {
130
+ this.settings = Object.assign(this.defaultSettings, this.settings);
131
+ if (this.settings.groupBy) {
132
+ this.groupedData = this.transformData(this.data, this.settings.groupBy);
133
+ }
134
+ this.totalRows = (this.data && this.data.length);
135
+ this.cachedItems = this.data;
136
+ this.screenItemsLen = Math.ceil(this.settings.maxHeight / this.itemHeight);
137
+ this.cachedItemsLen = this.screenItemsLen * 3;
138
+ this.totalHeight = this.itemHeight * this.totalRows;
139
+ this.maxBuffer = this.screenItemsLen * this.itemHeight;
140
+ this.lastScrolled = 0;
141
+ this.renderChunk(0, this.cachedItemsLen / 2);
142
+ }
143
+ ngOnChanges(changes: SimpleChanges) {
144
+ if (changes.data && !changes.data.isFirstChange()) {
145
+ if (this.settings.groupBy) {
146
+ this.groupedData = this.transformData(this.data, this.settings.groupBy);
147
+ if (this.data.length == 0) {
148
+ this.selectedItems = [];
149
+ }
150
+ }
151
+ }
152
+ if (changes.settings && !changes.settings.isFirstChange()) {
153
+ this.settings = Object.assign(this.defaultSettings, this.settings);
154
+ }
155
+ }
156
+ ngDoCheck() {
157
+ if (this.selectedItems) {
158
+ if (this.selectedItems.length == 0 || this.data.length == 0 || this.selectedItems.length < this.data.length) {
159
+ this.isSelectAll = false;
160
+ }
161
+ }
162
+ }
163
+ ngAfterViewInit() {
164
+ if(this.settings.lazyLoading){
165
+ this._elementRef.nativeElement.getElementsByClassName("lazyContainer")[0].addEventListener('scroll', this.onScroll.bind(this));
166
+ }
167
+ }
168
+ onItemClick(item: ListItem, index: number, evt: Event) {
169
+ if (this.settings.disabled) {
170
+ return false;
171
+ }
172
+
173
+ let found = this.isSelected(item);
174
+ let limit = this.selectedItems.length < this.settings.limitSelection ? true : false;
175
+
176
+ if (!found) {
177
+ if (this.settings.limitSelection) {
178
+ if (limit) {
179
+ this.addSelected(item);
180
+ this.onSelect.emit(item);
181
+ }
182
+ }
183
+ else {
184
+ this.addSelected(item);
185
+ this.onSelect.emit(item);
186
+ }
187
+
188
+ }
189
+ else {
190
+ this.removeSelected(item);
191
+ this.onDeSelect.emit(item);
192
+ }
193
+ if (this.isSelectAll || this.data.length > this.selectedItems.length) {
194
+ this.isSelectAll = false;
195
+ }
196
+ if (this.data.length == this.selectedItems.length) {
197
+ this.isSelectAll = true;
198
+ }
199
+ }
200
+ public validate(c: FormControl): any {
201
+ return null;
202
+ }
203
+ private onTouchedCallback: (_: any) => void = noop;
204
+ private onChangeCallback: (_: any) => void = noop;
205
+
206
+ writeValue(value: any) {
207
+ if (value !== undefined && value !== null) {
208
+ if (this.settings.singleSelection) {
209
+ try {
210
+
211
+ if (value.length > 1) {
212
+ this.selectedItems = [value[0]];
213
+ throw new MyException(404, { "msg": "Single Selection Mode, Selected Items cannot have more than one item." });
214
+ }
215
+ else {
216
+ this.selectedItems = value;
217
+ }
218
+ }
219
+ catch (e) {
220
+ console.error(e.body.msg);
221
+ }
222
+
223
+ }
224
+ else {
225
+ if (this.settings.limitSelection) {
226
+ this.selectedItems = value.splice(0, this.settings.limitSelection);
227
+ }
228
+ else {
229
+ this.selectedItems = value;
230
+ }
231
+ if (this.selectedItems.length === this.data.length && this.data.length > 0) {
232
+ this.isSelectAll = true;
233
+ }
234
+ }
235
+ } else {
236
+ this.selectedItems = [];
237
+ }
238
+ }
239
+
240
+ //From ControlValueAccessor interface
241
+ registerOnChange(fn: any) {
242
+ this.onChangeCallback = fn;
243
+ }
244
+
245
+ //From ControlValueAccessor interface
246
+ registerOnTouched(fn: any) {
247
+ this.onTouchedCallback = fn;
248
+ }
249
+ trackByFn(index: number, item: ListItem) {
250
+ return item.id;
251
+ }
252
+ isSelected(clickedItem: ListItem) {
253
+ let found = false;
254
+ this.selectedItems && this.selectedItems.forEach(item => {
255
+ if (clickedItem.id === item.id) {
256
+ found = true;
257
+ }
258
+ });
259
+ return found;
260
+ }
261
+ addSelected(item: ListItem) {
262
+ if (this.settings.singleSelection) {
263
+ this.selectedItems = [];
264
+ this.selectedItems.push(item);
265
+ this.closeDropdown();
266
+ }
267
+ else
268
+ this.selectedItems.push(item);
269
+ this.onChangeCallback(this.selectedItems);
270
+ this.onTouchedCallback(this.selectedItems);
271
+ }
272
+ removeSelected(clickedItem: ListItem) {
273
+ this.selectedItems && this.selectedItems.forEach(item => {
274
+ if (clickedItem.id === item.id) {
275
+ this.selectedItems.splice(this.selectedItems.indexOf(item), 1);
276
+ }
277
+ });
278
+ this.onChangeCallback(this.selectedItems);
279
+ this.onTouchedCallback(this.selectedItems);
280
+ }
281
+ toggleDropdown(evt: any) {
282
+ if (this.settings.disabled) {
283
+ return false;
284
+ }
285
+ this.isActive = !this.isActive;
286
+ if (this.isActive) {
287
+ if (this.settings.searchAutofocus && this.settings.enableSearchFilter) {
288
+ setTimeout(() => {
289
+ this.searchInput.nativeElement.focus();
290
+ }, 0);
291
+ }
292
+ this.onOpen.emit(true);
293
+ }
294
+ else {
295
+ this.onClose.emit(false);
296
+ }
297
+ evt.preventDefault();
298
+ }
299
+ closeDropdown() {
300
+ if(this.searchInput){
301
+ this.searchInput.nativeElement.value = "";
302
+ this.data = [];
303
+ this.data = this.cachedItems;
304
+ this.totalHeight = this.itemHeight * this.data.length;
305
+ this.totalRows = this.data.length;
306
+ this.updateView(this.scrollTop);
307
+ }
308
+ this.filter = "";
309
+ this.isActive = false;
310
+ this.onClose.emit(false);
311
+ }
312
+ toggleSelectAll() {
313
+ if (!this.isSelectAll) {
314
+ this.selectedItems = [];
315
+ this.selectedItems = this.data.slice();
316
+ this.isSelectAll = true;
317
+ this.onChangeCallback(this.selectedItems);
318
+ this.onTouchedCallback(this.selectedItems);
319
+
320
+ this.onSelectAll.emit(this.selectedItems);
321
+ }
322
+ else {
323
+ this.selectedItems = [];
324
+ this.isSelectAll = false;
325
+ this.onChangeCallback(this.selectedItems);
326
+ this.onTouchedCallback(this.selectedItems);
327
+
328
+ this.onDeSelectAll.emit(this.selectedItems);
329
+ }
330
+ }
331
+ transformData(arr: Array<ListItem>, field: any): Array<ListItem> {
332
+ const groupedObj: any = arr.reduce((prev: any, cur: any) => {
333
+ if (!prev[cur[field]]) {
334
+ prev[cur[field]] = [cur];
335
+ } else {
336
+ prev[cur[field]].push(cur);
337
+ }
338
+ return prev;
339
+ }, {});
340
+ const tempArr: any = [];
341
+ Object.keys(groupedObj).map(function (x) {
342
+ tempArr.push({ key: x, value: groupedObj[x] });
343
+ });
344
+ return tempArr;
345
+ }
346
+ renderChunk(fromPos:any, howMany:any) {
347
+ this.chunkArray = [];
348
+ this.chunkIndex = [];
349
+ var finalItem = fromPos + howMany;
350
+ if (finalItem > this.totalRows)
351
+ finalItem = this.totalRows;
352
+
353
+ for (var i = fromPos; i < finalItem; i++) {
354
+ this.chunkIndex.push((i * this.itemHeight) + 'px');
355
+ this.chunkArray.push(this.data[i]);
356
+ }
357
+ }
358
+ public onScroll(e:any) {
359
+ this.scrollTop = e.target.scrollTop;
360
+ this.updateView(this.scrollTop);
361
+
362
+ }
363
+ public updateView(scrollTop:any){
364
+ var scrollPos = scrollTop ? scrollTop: 0;
365
+ var first = (scrollPos / this.itemHeight) - this.screenItemsLen;
366
+ var firstTemp = ""+first;
367
+ first = parseInt(firstTemp) < 0 ? 0 : parseInt(firstTemp);
368
+ this.renderChunk(first, this.cachedItemsLen);
369
+ this.lastRepaintY = scrollPos;
370
+ }
371
+ public filterInfiniteList(evt: any){
372
+ var filteredElems:Array<any> = [];
373
+ this.data = this.cachedItems.slice();
374
+ if(evt.target.value.toString() != ''){
375
+ this.data.filter(function(el:any){
376
+ for(var prop in el){
377
+ if(el[prop].toString().toLowerCase().indexOf(evt.target.value.toString().toLowerCase()) >=0 ){
378
+ filteredElems.push(el);
379
+ break;
380
+ }
381
+ }
382
+ });
383
+ //this.cachedItems = this.data;
384
+ this.totalHeight = this.itemHeight * filteredElems.length;
385
+ this.totalRows = filteredElems.length;
386
+ this.data = [];
387
+ this.data = filteredElems;
388
+ this.updateView(this.scrollTop);
389
+ }
390
+ else if(evt.target.value.toString() == '' && this.cachedItems.length > 0){
391
+ this.data = [];
392
+ this.data = this.cachedItems;
393
+ this.totalHeight = this.itemHeight * this.data.length;
394
+ this.totalRows = this.data.length;
395
+ this.updateView(this.scrollTop);
396
+ }
397
+ }
398
+ }
399
+
400
+ @NgModule({
401
+ imports: [CommonModule, FormsModule],
402
+ declarations: [AngularMultiSelect, ClickOutsideDirective, ScrollDirective, styleDirective, ListFilterPipe, Item, TemplateRenderer, Badge],
403
+ exports: [AngularMultiSelect, ClickOutsideDirective, ScrollDirective, styleDirective, ListFilterPipe, Item, TemplateRenderer, Badge]
404
+ })
405
+ 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
+ }
@@ -200,3 +200,4 @@
200
200
  right: 16px;
201
201
  }
202
202
 
203
+ /*# sourceMappingURL=custom.theme.css.map */
@@ -34,3 +34,4 @@
34
34
  color: #ffffff;
35
35
  }
36
36
 
37
+ /*# sourceMappingURL=default.theme.css.map */
@@ -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;