mis-crystal-design-system 2.8.5 → 2.8.7
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.
- package/async-search-dropdown/async-dropdown.component.d.ts +3 -0
- package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.metadata.json +1 -1
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js +18 -7
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js.map +1 -1
- package/esm2015/async-search-dropdown/async-dropdown.component.js +14 -3
- package/esm2015/async-search-dropdown/async-dropdown.module.js +3 -2
- package/fesm2015/mis-crystal-design-system-async-search-dropdown.js +15 -3
- package/fesm2015/mis-crystal-design-system-async-search-dropdown.js.map +1 -1
- package/package.json +1 -1
- package/styles/mis-color-constants-root.scss +75 -0
|
@@ -24,10 +24,13 @@ export declare class AsyncDropdownComponent implements OnInit, OnChanges, OnDest
|
|
|
24
24
|
input: ElementRef;
|
|
25
25
|
dd: TemplateRef<Element>;
|
|
26
26
|
customItem: TemplateRef<Element>;
|
|
27
|
+
customLoader: TemplateRef<Element>;
|
|
27
28
|
onSelect: EventEmitter<IListData | IListData[]>;
|
|
28
29
|
searchInput: FormControl;
|
|
29
30
|
data: IListData[];
|
|
30
31
|
opened: boolean;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
error: boolean;
|
|
31
34
|
selections: Map<string, any>;
|
|
32
35
|
private searchSubscription;
|
|
33
36
|
private overlayRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"AsyncDropdownComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":25,"character":1},"arguments":[{"selector":"mis-async-search-dropdown","template":"<div class=\"dd-wrapper\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <div *ngIf=\"data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n","styles":[".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"Overlay","line":31,"character":31},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":31,"character":66}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"httpStream":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"displayKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"secondaryDisplayKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"debounceTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"minInputLength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"multi":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"uniqueKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":42,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3}}]}],"origin":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":45,"character":3},"arguments":["ddBtn",{"static":false}]}]}],"input":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":46,"character":3},"arguments":["input",{"static":false}]}]}],"dd":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":47,"character":3},"arguments":["dd",{"static":false}]}]}],"customItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":48,"character":3},"arguments":["misCustomItem",{"static":false}]}]}],"onSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":51,"character":3}}]}],"searchValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":60,"character":3}}]}],"searchQueryChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":61,"character":3}}]}],"clear":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":62,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"openDropdown":[{"__symbolic":"method"}],"closeDropdown":[{"__symbolic":"method"}],"selectData":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"setControlValue":[{"__symbolic":"method"}],"removeInputValue":[{"__symbolic":"method"}]}},"AsyncDropdownModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"AsyncDropdownComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":12},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"OverlayModule","line":8,"character":26},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":8,"character":41},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":8,"character":62}],"exports":[{"__symbolic":"reference","name":"AsyncDropdownComponent"}]}]}],"members":{}}},"origins":{"AsyncDropdownComponent":"./async-dropdown.component","AsyncDropdownModule":"./async-dropdown.module"},"importAs":"mis-crystal-design-system/async-search-dropdown"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"AsyncDropdownComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":26,"character":1},"arguments":[{"selector":"mis-async-search-dropdown","template":"<div class=\"dd-wrapper\" [ngStyle]=\"{'height': size === 'sm' ? '32px': '44px'}\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <ng-container *ngIf=\"loading\">\n <ng-container\n *ngIf=\"customLoader; else defaultLoader\"\n [ngTemplateOutlet]=\"customLoader\"\n ></ng-container>\n <ng-template #defaultLoader>\n <div class=\"status-container\" *ngIf=\"loading && !customLoader\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"error\">\n <div class=\"status-container\">\n <p>Unknown error has occurred, <br> Please try again later.</p>\n </div>\n </ng-container>\n <div *ngIf=\"!loading && !error && data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!loading && !error && data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n","styles":[".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}::ng-deep #spinner{position:relative!important}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"Overlay","line":32,"character":31},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":32,"character":66}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"httpStream":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"displayKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"secondaryDisplayKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"debounceTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"minInputLength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"multi":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":3}}]}],"uniqueKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":42,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":45,"character":3}}]}],"origin":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":46,"character":3},"arguments":["ddBtn",{"static":false}]}]}],"input":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":47,"character":3},"arguments":["input",{"static":false}]}]}],"dd":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":48,"character":3},"arguments":["dd",{"static":false}]}]}],"customItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":49,"character":3},"arguments":["misCustomItem",{"static":false}]}]}],"customLoader":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":51,"character":3},"arguments":["asyncCustomLoader",{"static":false}]}]}],"onSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":54,"character":3}}]}],"searchValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":65,"character":3}}]}],"searchQueryChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":66,"character":3}}]}],"clear":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":67,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"openDropdown":[{"__symbolic":"method"}],"closeDropdown":[{"__symbolic":"method"}],"selectData":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"setControlValue":[{"__symbolic":"method"}],"removeInputValue":[{"__symbolic":"method"}]}},"AsyncDropdownModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"AsyncDropdownComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":9,"character":12},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"OverlayModule","line":9,"character":26},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":9,"character":41},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":9,"character":62},{"__symbolic":"reference","module":"mis-crystal-design-system/loader","name":"LoaderModule","line":9,"character":75}],"exports":[{"__symbolic":"reference","name":"AsyncDropdownComponent"}]}]}],"members":{}}},"origins":{"AsyncDropdownComponent":"./async-dropdown.component","AsyncDropdownModule":"./async-dropdown.module"},"importAs":"mis-crystal-design-system/async-search-dropdown"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/core'), require('@angular/forms'), require('rxjs/operators'), require('@angular/common')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('mis-crystal-design-system/async-search-dropdown', ['exports', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/core', '@angular/forms', 'rxjs/operators', '@angular/common'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['async-search-dropdown'] = {}), global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.core, global.ng.forms, global.rxjs.operators, global.ng.common));
|
|
5
|
-
}(this, (function (exports, overlay, portal, core, forms, operators, common) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/core'), require('@angular/forms'), require('rxjs/operators'), require('@angular/common'), require('mis-crystal-design-system/loader')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('mis-crystal-design-system/async-search-dropdown', ['exports', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/core', '@angular/forms', 'rxjs/operators', '@angular/common', 'mis-crystal-design-system/loader'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['async-search-dropdown'] = {}), global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.core, global.ng.forms, global.rxjs.operators, global.ng.common, global['mis-crystal-design-system'].loader));
|
|
5
|
+
}(this, (function (exports, overlay, portal, core, forms, operators, common, loader) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var AsyncDropdownComponent = /** @class */ (function () {
|
|
8
8
|
function AsyncDropdownComponent(overlay, viewContainerRef) {
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
this.searchInput = new forms.FormControl();
|
|
20
20
|
this.data = [];
|
|
21
21
|
this.opened = false;
|
|
22
|
+
this.loading = false;
|
|
23
|
+
this.error = false;
|
|
22
24
|
// tslint:disable-next-line
|
|
23
25
|
this.selections = new Map();
|
|
24
26
|
this.searchQueryChange = new core.EventEmitter();
|
|
@@ -49,12 +51,20 @@
|
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
else if ((res === null || res === void 0 ? void 0 : res.length) > _this.minInputLength && _this.httpStream) {
|
|
54
|
+
_this.loading = true;
|
|
55
|
+
_this.error = false;
|
|
56
|
+
if (!_this.overlayRef)
|
|
57
|
+
_this.openDropdown(_this.dd, _this.origin.nativeElement);
|
|
52
58
|
_this.httpStream(res).subscribe(function (list) {
|
|
53
59
|
var _a;
|
|
60
|
+
_this.loading = false;
|
|
54
61
|
_this.data = list;
|
|
55
62
|
if (!((_a = _this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && list.length > 0) {
|
|
56
63
|
_this.openDropdown(_this.dd, _this.origin.nativeElement);
|
|
57
64
|
}
|
|
65
|
+
}, function (error) {
|
|
66
|
+
_this.loading = false;
|
|
67
|
+
_this.error = true;
|
|
58
68
|
});
|
|
59
69
|
}
|
|
60
70
|
});
|
|
@@ -178,8 +188,8 @@
|
|
|
178
188
|
AsyncDropdownComponent.decorators = [
|
|
179
189
|
{ type: core.Component, args: [{
|
|
180
190
|
selector: "mis-async-search-dropdown",
|
|
181
|
-
template: "<div class=\"dd-wrapper\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <div *ngIf=\"data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
182
|
-
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}"]
|
|
191
|
+
template: "<div class=\"dd-wrapper\" [ngStyle]=\"{'height': size === 'sm' ? '32px': '44px'}\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <ng-container *ngIf=\"loading\">\n <ng-container\n *ngIf=\"customLoader; else defaultLoader\"\n [ngTemplateOutlet]=\"customLoader\"\n ></ng-container>\n <ng-template #defaultLoader>\n <div class=\"status-container\" *ngIf=\"loading && !customLoader\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"error\">\n <div class=\"status-container\">\n <p>Unknown error has occurred, <br> Please try again later.</p>\n </div>\n </ng-container>\n <div *ngIf=\"!loading && !error && data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!loading && !error && data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
192
|
+
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}::ng-deep #spinner{position:relative!important}"]
|
|
183
193
|
},] }
|
|
184
194
|
];
|
|
185
195
|
AsyncDropdownComponent.ctorParameters = function () { return [
|
|
@@ -204,6 +214,7 @@
|
|
|
204
214
|
input: [{ type: core.ViewChild, args: ["input", { static: false },] }],
|
|
205
215
|
dd: [{ type: core.ViewChild, args: ["dd", { static: false },] }],
|
|
206
216
|
customItem: [{ type: core.ContentChild, args: ["misCustomItem", { static: false },] }],
|
|
217
|
+
customLoader: [{ type: core.ContentChild, args: ["asyncCustomLoader", { static: false },] }],
|
|
207
218
|
onSelect: [{ type: core.Output }],
|
|
208
219
|
searchValue: [{ type: core.Input }],
|
|
209
220
|
searchQueryChange: [{ type: core.Output }],
|
|
@@ -218,7 +229,7 @@
|
|
|
218
229
|
AsyncDropdownModule.decorators = [
|
|
219
230
|
{ type: core.NgModule, args: [{
|
|
220
231
|
declarations: [AsyncDropdownComponent],
|
|
221
|
-
imports: [common.CommonModule, overlay.OverlayModule, forms.ReactiveFormsModule, forms.FormsModule],
|
|
232
|
+
imports: [common.CommonModule, overlay.OverlayModule, forms.ReactiveFormsModule, forms.FormsModule, loader.LoaderModule],
|
|
222
233
|
exports: [AsyncDropdownComponent]
|
|
223
234
|
},] }
|
|
224
235
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-async-search-dropdown.umd.js","sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts","../../../projects/mis-components/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.ts"],"sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewContainerRef\n} from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged, filter, tap } from \"rxjs/operators\";\n\n// tslint:disable-next-line\ntype IListData = any;\n\n@Component({\n selector: \"mis-async-search-dropdown\",\n templateUrl: \"./async-dropdown.component.html\",\n styleUrls: [\"./async-dropdown.component.scss\"]\n})\nexport class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {\n constructor(private overlay: Overlay, private viewContainerRef: ViewContainerRef) { }\n @Input() height;\n @Input() size: 'md' | 'sm' = 'md'\n @Input() httpStream!: (searchKey: string) => Observable<IListData>; // function that returns an httpobservable\n @Input() displayKey!: string; // string to show value in list\n @Input() secondaryDisplayKey!: string; // string to display secondary value\n @Input() placeholder = \"Select\"; // placeholder for input\n @Input() debounceTime = 400; // wait time till which API call is paused\n @Input() minInputLength = 2; // min length after which API call is made\n @Input() multi = false; // maintain a list or emit value\n @Input() uniqueKey: string; // for identifying unique values\n @Input() control: AbstractControl | null; // form control for reactive forms\n @Input() disabled: boolean; // disable actions on component\n @Input() readonly: boolean; // make component readonly\n @ViewChild(\"ddBtn\", { static: false }) origin: ElementRef;\n @ViewChild(\"input\", { static: false }) input: ElementRef;\n @ViewChild(\"dd\", { static: false }) dd: TemplateRef<Element>;\n @ContentChild(\"misCustomItem\", { static: false })\n customItem: TemplateRef<Element>;\n // tslint:disable-next-line\n @Output() onSelect: EventEmitter<IListData | IListData[]> = new EventEmitter(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n @Input() searchValue;\n @Output() searchQueryChange = new EventEmitter<string>()\n @Output() clear: EventEmitter<boolean> = new EventEmitter(false);\n ngOnInit(): void {\n if (this.multi && !this.uniqueKey) {\n throw new Error(\"[uniqueKey] required in multi mode.\");\n }\n if (this.disabled) {\n this.searchInput.disable();\n }\n this.searchSubscription = this.searchInput.valueChanges\n .pipe(\n // filter(val => val && val.length >= this.minInputLength),\n tap((val) => this.searchQueryChange.emit(val)),\n debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe(res => {\n if (res?.length < this.minInputLength) {\n this.closeDropdown();\n return;\n } else if (res?.length > this.minInputLength && this.httpStream) {\n this.httpStream(res).subscribe(list => {\n this.data = list;\n if (!this.overlayRef?.hasAttached() && list.length > 0) {\n this.openDropdown(this.dd, this.origin.nativeElement);\n }\n });\n }\n });\n if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(this.handleControlChanges);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes && changes?.searchValue?.currentValue) {\n this.searchInput.patchValue(changes.searchValue.currentValue);\n }\n if (changes && changes.disabled) {\n this.searchInput.enable();\n if (this.disabled) {\n this.searchInput.disable();\n }\n }\n }\n\n ngOnDestroy(): void {\n this.searchSubscription?.unsubscribe();\n }\n\n private handleControlChanges = (values: IListData[]) => {\n values.forEach(el => {\n this.selectData(el, true);\n });\n // tslint:disable-next-line\n };\n\n private openDropdown(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n\n removeInputValue() {\n this.searchInput.reset();\n this.data = [];\n this.clear.emit(true);\n }\n}\n","import { OverlayModule } from \"@angular/cdk/overlay\";\nimport { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\nimport { AsyncDropdownComponent } from \"./async-dropdown.component\";\n\n@NgModule({\n declarations: [AsyncDropdownComponent],\n imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule],\n exports: [AsyncDropdownComponent]\n})\nexport class AsyncDropdownModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["EventEmitter","FormControl","tap","debounceTime","distinctUntilChanged","ConnectionPositionPair","OverlayConfig","TemplatePortal","Component","Overlay","ViewContainerRef","Input","ViewChild","ContentChild","Output","NgModule","CommonModule","OverlayModule","ReactiveFormsModule","FormsModule"],"mappings":";;;;;;;QA+BE,gCAAoB,OAAgB,EAAU,gBAAkC;YAAhF,iBAAqF;YAAjE,YAAO,GAAP,OAAO,CAAS;YAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;YAEvE,SAAI,GAAgB,IAAI,CAAA;YAIxB,gBAAW,GAAG,QAAQ,CAAC;YACvB,iBAAY,GAAG,GAAG,CAAC;YACnB,mBAAc,GAAG,CAAC,CAAC;YACnB,UAAK,GAAG,KAA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AE,CAAC,sBAAsB,CAAC;oBACtC,OAAO,EAAE,CAACC,mBAAY,EAAEC,qBAAa,EAAEC,yBAAmB,EAAEC,iBAAW,CAAC;oBACxE,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBAClC;;;ICVD;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-async-search-dropdown.umd.js","sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts","../../../projects/mis-components/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.ts"],"sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewContainerRef\n} from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged, filter, tap } from \"rxjs/operators\";\n\n// tslint:disable-next-line\ntype IListData = any;\n\n@Component({\n selector: \"mis-async-search-dropdown\",\n templateUrl: \"./async-dropdown.component.html\",\n styleUrls: [\"./async-dropdown.component.scss\"]\n})\nexport class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {\n constructor(private overlay: Overlay, private viewContainerRef: ViewContainerRef) { }\n @Input() height;\n @Input() size: 'md' | 'sm' = 'md'\n @Input() httpStream!: (searchKey: string) => Observable<IListData>; // function that returns an httpobservable\n @Input() displayKey!: string; // string to show value in list\n @Input() secondaryDisplayKey!: string; // string to display secondary value\n @Input() placeholder = \"Select\"; // placeholder for input\n @Input() debounceTime = 400; // wait time till which API call is paused\n @Input() minInputLength = 2; // min length after which API call is made\n @Input() multi = false; // maintain a list or emit value\n @Input() uniqueKey: string; // for identifying unique values\n @Input() control: AbstractControl | null; // form control for reactive forms\n @Input() disabled: boolean; // disable actions on component\n @Input() readonly: boolean; // make component readonly\n @ViewChild(\"ddBtn\", { static: false }) origin: ElementRef;\n @ViewChild(\"input\", { static: false }) input: ElementRef;\n @ViewChild(\"dd\", { static: false }) dd: TemplateRef<Element>;\n @ContentChild(\"misCustomItem\", { static: false })\n customItem: TemplateRef<Element>;\n @ContentChild(\"asyncCustomLoader\", { static: false})\n customLoader: TemplateRef<Element>;\n // tslint:disable-next-line\n @Output() onSelect: EventEmitter<IListData | IListData[]> = new EventEmitter(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n loading: boolean = false;\n error: boolean = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n @Input() searchValue;\n @Output() searchQueryChange = new EventEmitter<string>()\n @Output() clear: EventEmitter<boolean> = new EventEmitter(false);\n ngOnInit(): void {\n if (this.multi && !this.uniqueKey) {\n throw new Error(\"[uniqueKey] required in multi mode.\");\n }\n if (this.disabled) {\n this.searchInput.disable();\n }\n this.searchSubscription = this.searchInput.valueChanges\n .pipe(\n // filter(val => val && val.length >= this.minInputLength),\n tap((val) => this.searchQueryChange.emit(val)),\n debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe(res => {\n if (res?.length < this.minInputLength) {\n this.closeDropdown();\n return;\n } else if (res?.length > this.minInputLength && this.httpStream) {\n this.loading = true;\n this.error = false;\n if(!this.overlayRef)\n this.openDropdown(this.dd, this.origin.nativeElement);\n this.httpStream(res).subscribe(list => {\n this.loading = false;\n this.data = list;\n if (!this.overlayRef?.hasAttached() && list.length > 0) {\n this.openDropdown(this.dd, this.origin.nativeElement);\n }\n }, error => {\n this.loading = false;\n this.error = true;\n });\n }\n });\n if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(this.handleControlChanges);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes && changes?.searchValue?.currentValue) {\n this.searchInput.patchValue(changes.searchValue.currentValue);\n }\n if (changes && changes.disabled) {\n this.searchInput.enable();\n if (this.disabled) {\n this.searchInput.disable();\n }\n }\n }\n\n ngOnDestroy(): void {\n this.searchSubscription?.unsubscribe();\n }\n\n private handleControlChanges = (values: IListData[]) => {\n values.forEach(el => {\n this.selectData(el, true);\n });\n // tslint:disable-next-line\n };\n\n private openDropdown(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n\n removeInputValue() {\n this.searchInput.reset();\n this.data = [];\n this.clear.emit(true);\n }\n}\n","import { OverlayModule } from \"@angular/cdk/overlay\";\nimport { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\nimport { LoaderModule } from \"mis-crystal-design-system/loader\";\nimport { AsyncDropdownComponent } from \"./async-dropdown.component\";\n\n@NgModule({\n declarations: [AsyncDropdownComponent],\n imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule, LoaderModule],\n exports: [AsyncDropdownComponent]\n})\nexport class AsyncDropdownModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["EventEmitter","FormControl","tap","debounceTime","distinctUntilChanged","ConnectionPositionPair","OverlayConfig","TemplatePortal","Component","Overlay","ViewContainerRef","Input","ViewChild","ContentChild","Output","NgModule","CommonModule","OverlayModule","ReactiveFormsModule","FormsModule","LoaderModule"],"mappings":";;;;;;;QAgCE,gCAAoB,OAAgB,EAAU,gBAAkC;YAAhF,iBAAqF;YAAjE,YAAO,GAAP,OAAO,CAAS;YAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;YAEvE,SAAI,GAAgB,IAAI,CAAA;YAIxB,gBAAW,GAAG,QAAQ,CAAC;YACvB,iBAAY,GAAG,GAAG,CAAC;YACnB,mBAAc,GAAG,CAA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8BACLA,UAAK;+BACLA,UAAK;iCACLA,UAAK;wBACLA,UAAK;4BACLA,UAAK;0BACLA,UAAK;2BACLA,UAAK;2BACLA,UAAK;yBACLC,cAAS,SAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;wBACpCA,cAAS,SAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;qBACpCA,cAAS,SAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;6BACjCC,iBAAY,SAAC,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;+BAE/CA,iBAAY,SAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAC;2BAGlDC,WAAM;8BAWNH,UAAK;oCACLG,WAAM;wBACNA,WAAM;;;;QCvDT;;;;;gBALCC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,sBAAsB,CAAC;oBACtC,OAAO,EAAE,CAACC,mBAAY,EAAEC,qBAAa,EAAEC,yBAAmB,EAAEC,iBAAW,EAAEC,mBAAY,CAAC;oBACtF,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBAClC;;;ICXD;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/overlay"),require("@angular/cdk/portal"),require("@angular/core"),require("@angular/forms"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/async-search-dropdown",["exports","@angular/cdk/overlay","@angular/cdk/portal","@angular/core","@angular/forms","rxjs/operators","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["mis-crystal-design-system"]=e["mis-crystal-design-system"]||{},e["mis-crystal-design-system"]["async-search-dropdown"]={}),e.ng.cdk.overlay,e.ng.cdk.portal,e.ng.core,e.ng.forms,e.rxjs.operators,e.ng.common)}(this,(function(e,t,n,i,s,o,a){"use strict";var r=function(){function e(e,t){var n=this;this.overlay=e,this.viewContainerRef=t,this.size="md",this.placeholder="Select",this.debounceTime=400,this.minInputLength=2,this.multi=!1,this.onSelect=new i.EventEmitter(!0),this.searchInput=new s.FormControl,this.data=[],this.opened=!1,this.selections=new Map,this.searchQueryChange=new i.EventEmitter,this.clear=new i.EventEmitter(!1),this.handleControlChanges=function(e){e.forEach((function(e){n.selectData(e,!0)}))}}return e.prototype.ngOnInit=function(){var e,t,n=this;if(this.multi&&!this.uniqueKey)throw new Error("[uniqueKey] required in multi mode.");this.disabled&&this.searchInput.disable(),this.searchSubscription=this.searchInput.valueChanges.pipe(o.tap((function(e){return n.searchQueryChange.emit(e)})),o.debounceTime(this.debounceTime),o.distinctUntilChanged()).subscribe((function(e){(null==e?void 0:e.length)<n.minInputLength?n.closeDropdown():(null==e?void 0:e.length)>n.minInputLength&&n.httpStream&&n.httpStream(e).subscribe((function(e){var t;n.data=e,!(null===(t=n.overlayRef)||void 0===t?void 0:t.hasAttached())&&e.length>0&&n.openDropdown(n.dd,n.origin.nativeElement)}))})),(null===(e=this.control)||void 0===e?void 0:e.value)&&this.handleControlChanges(this.control.value),this.controlSubscription=null===(t=this.control)||void 0===t?void 0:t.valueChanges.subscribe(this.handleControlChanges)},e.prototype.ngOnChanges=function(e){var t;e&&(null===(t=null==e?void 0:e.searchValue)||void 0===t?void 0:t.currentValue)&&this.searchInput.patchValue(e.searchValue.currentValue),e&&e.disabled&&(this.searchInput.enable(),this.disabled&&this.searchInput.disable())},e.prototype.ngOnDestroy=function(){var e;null===(e=this.searchSubscription)||void 0===e||e.unsubscribe()},e.prototype.openDropdown=function(e,i){var s=this,o=this.overlay.position().flexibleConnectedTo(i).withPositions([new t.ConnectionPositionPair({originX:"start",originY:"bottom"},{overlayX:"start",overlayY:"top"}),new t.ConnectionPositionPair({originX:"start",originY:"top"},{overlayX:"start",overlayY:"bottom"})]).withPush(!0),a=new t.OverlayConfig({hasBackdrop:!0,backdropClass:"cdk-overlay-transparent-backdrop",scrollStrategy:this.overlay.scrollStrategies.reposition(),positionStrategy:o,width:i.clientWidth});this.overlayRef=this.overlay.create(a),this.overlayRef.attach(new n.TemplatePortal(e,this.viewContainerRef)),this.overlayRef.backdropClick().subscribe((function(e){s.closeDropdown()}))},e.prototype.closeDropdown=function(){var e;this.opened=!1,null===(e=this.overlayRef)||void 0===e||e.detach(),this.data=[]},e.prototype.selectData=function(e,t){var n=this;void 0===t&&(t=!0),e.disabled||(this.multi?(this.selections.has(e[this.uniqueKey])||this.selections.set(e[this.uniqueKey],e),this.setControlValue(this.selectedItems),t||setTimeout((function(){n.input.nativeElement.focus(),n.input.nativeElement.scrollIntoView()}),10),this.searchInput.patchValue(""),this.data=[]):(this.searchInput.patchValue(e[this.displayKey],{emitEvent:!1}),this.setControlValue(e)),this.closeDropdown())},e.prototype.removeItem=function(e){this.selections.delete(e[this.uniqueKey]),this.setControlValue(this.selectedItems),this.input.nativeElement.focus()},e.prototype.setControlValue=function(e){var t;this.onSelect.emit(e),null===(t=this.control)||void 0===t||t.patchValue(e,{emitEvent:!1})},Object.defineProperty(e.prototype,"selectedItems",{get:function(){return Array.from(this.selections.values())},enumerable:!1,configurable:!0}),e.prototype.removeInputValue=function(){this.searchInput.reset(),this.data=[],this.clear.emit(!0)},e}();r.decorators=[{type:i.Component,args:[{selector:"mis-async-search-dropdown",template:'<div class="dd-wrapper" [ngClass]="{ opened: opened, disabled: disabled, readonly: readonly }" #ddBtn>\n <div class="selected-list" *ngIf="multi && selections.size > 0">\n <div class="chip" [ngClass]="{\'chip-md\': size === \'md\', \'chip-sm\': size === \'sm\'}" *ngFor="let item of selectedItems">\n <span [ngClass]="{\'h6\': size === \'md\', \'h8-b\': size === \'sm\'}" style="margin-right: 4px;">{{item[displayKey]}}</span>\n <span style="cursor: pointer;" (click)="removeItem(item)" [ngStyle]="{\'font-size\': size === \'sm\' ? \'12px\': \'14px\'}" class="ic-navigation-cancel-24"></span>\n </div>\n </div>\n <div class="search-input">\n <span class="ic-action-search-24"></span>\n <input [ngClass]="{\'ip-md\': size === \'md\', \'ip-sm\': size === \'sm\'}" tabindex="0" type="text" class="black-text h6" #input [placeholder]="placeholder" [formControl]="searchInput" />\n <div class="ic-navigation-cancel-24 croos-icon" *ngIf="searchInput?.value?.length" (click)="removeInputValue()"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class="dd-list" [ngStyle]="{\'max-height\':height}" [ngClass]="{\'dd-list-pd\':data.length === 0}" >\n <div *ngIf="data.length > 0">\n <ng-container *ngFor="let item of data">\n <div (click)="selectData(item, false)">\n <ng-container\n *ngIf="customItem; else standardItem"\n [ngTemplateOutlet]="customItem"\n [ngTemplateOutletContext]="{ $implicit: item }"\n ></ng-container>\n <ng-template #standardItem>\n <div class="item">\n <div class="value">\n <div class="primary">\n {{ item[displayKey] }}\n </div>\n <div class="secondary">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf="data.length === 0 && searchInput.value">\n <div class="data-not-found">No Data Available</div>\n </div>\n </div>\n</ng-template>\n',styles:[".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}"]}]}],r.ctorParameters=function(){return[{type:t.Overlay},{type:i.ViewContainerRef}]},r.propDecorators={height:[{type:i.Input}],size:[{type:i.Input}],httpStream:[{type:i.Input}],displayKey:[{type:i.Input}],secondaryDisplayKey:[{type:i.Input}],placeholder:[{type:i.Input}],debounceTime:[{type:i.Input}],minInputLength:[{type:i.Input}],multi:[{type:i.Input}],uniqueKey:[{type:i.Input}],control:[{type:i.Input}],disabled:[{type:i.Input}],readonly:[{type:i.Input}],origin:[{type:i.ViewChild,args:["ddBtn",{static:!1}]}],input:[{type:i.ViewChild,args:["input",{static:!1}]}],dd:[{type:i.ViewChild,args:["dd",{static:!1}]}],customItem:[{type:i.ContentChild,args:["misCustomItem",{static:!1}]}],onSelect:[{type:i.Output}],searchValue:[{type:i.Input}],searchQueryChange:[{type:i.Output}],clear:[{type:i.Output}]};var d=function(){};d.decorators=[{type:i.NgModule,args:[{declarations:[r],imports:[a.CommonModule,t.OverlayModule,s.ReactiveFormsModule,s.FormsModule],exports:[r]}]}],e.AsyncDropdownComponent=r,e.AsyncDropdownModule=d,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/overlay"),require("@angular/cdk/portal"),require("@angular/core"),require("@angular/forms"),require("rxjs/operators"),require("@angular/common"),require("mis-crystal-design-system/loader")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/async-search-dropdown",["exports","@angular/cdk/overlay","@angular/cdk/portal","@angular/core","@angular/forms","rxjs/operators","@angular/common","mis-crystal-design-system/loader"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["mis-crystal-design-system"]=e["mis-crystal-design-system"]||{},e["mis-crystal-design-system"]["async-search-dropdown"]={}),e.ng.cdk.overlay,e.ng.cdk.portal,e.ng.core,e.ng.forms,e.rxjs.operators,e.ng.common,e["mis-crystal-design-system"].loader)}(this,(function(e,t,n,i,o,s,r,a){"use strict";var d=function(){function e(e,t){var n=this;this.overlay=e,this.viewContainerRef=t,this.size="md",this.placeholder="Select",this.debounceTime=400,this.minInputLength=2,this.multi=!1,this.onSelect=new i.EventEmitter(!0),this.searchInput=new o.FormControl,this.data=[],this.opened=!1,this.loading=!1,this.error=!1,this.selections=new Map,this.searchQueryChange=new i.EventEmitter,this.clear=new i.EventEmitter(!1),this.handleControlChanges=function(e){e.forEach((function(e){n.selectData(e,!0)}))}}return e.prototype.ngOnInit=function(){var e,t,n=this;if(this.multi&&!this.uniqueKey)throw new Error("[uniqueKey] required in multi mode.");this.disabled&&this.searchInput.disable(),this.searchSubscription=this.searchInput.valueChanges.pipe(s.tap((function(e){return n.searchQueryChange.emit(e)})),s.debounceTime(this.debounceTime),s.distinctUntilChanged()).subscribe((function(e){(null==e?void 0:e.length)<n.minInputLength?n.closeDropdown():(null==e?void 0:e.length)>n.minInputLength&&n.httpStream&&(n.loading=!0,n.error=!1,n.overlayRef||n.openDropdown(n.dd,n.origin.nativeElement),n.httpStream(e).subscribe((function(e){var t;n.loading=!1,n.data=e,!(null===(t=n.overlayRef)||void 0===t?void 0:t.hasAttached())&&e.length>0&&n.openDropdown(n.dd,n.origin.nativeElement)}),(function(e){n.loading=!1,n.error=!0})))})),(null===(e=this.control)||void 0===e?void 0:e.value)&&this.handleControlChanges(this.control.value),this.controlSubscription=null===(t=this.control)||void 0===t?void 0:t.valueChanges.subscribe(this.handleControlChanges)},e.prototype.ngOnChanges=function(e){var t;e&&(null===(t=null==e?void 0:e.searchValue)||void 0===t?void 0:t.currentValue)&&this.searchInput.patchValue(e.searchValue.currentValue),e&&e.disabled&&(this.searchInput.enable(),this.disabled&&this.searchInput.disable())},e.prototype.ngOnDestroy=function(){var e;null===(e=this.searchSubscription)||void 0===e||e.unsubscribe()},e.prototype.openDropdown=function(e,i){var o=this,s=this.overlay.position().flexibleConnectedTo(i).withPositions([new t.ConnectionPositionPair({originX:"start",originY:"bottom"},{overlayX:"start",overlayY:"top"}),new t.ConnectionPositionPair({originX:"start",originY:"top"},{overlayX:"start",overlayY:"bottom"})]).withPush(!0),r=new t.OverlayConfig({hasBackdrop:!0,backdropClass:"cdk-overlay-transparent-backdrop",scrollStrategy:this.overlay.scrollStrategies.reposition(),positionStrategy:s,width:i.clientWidth});this.overlayRef=this.overlay.create(r),this.overlayRef.attach(new n.TemplatePortal(e,this.viewContainerRef)),this.overlayRef.backdropClick().subscribe((function(e){o.closeDropdown()}))},e.prototype.closeDropdown=function(){var e;this.opened=!1,null===(e=this.overlayRef)||void 0===e||e.detach(),this.data=[]},e.prototype.selectData=function(e,t){var n=this;void 0===t&&(t=!0),e.disabled||(this.multi?(this.selections.has(e[this.uniqueKey])||this.selections.set(e[this.uniqueKey],e),this.setControlValue(this.selectedItems),t||setTimeout((function(){n.input.nativeElement.focus(),n.input.nativeElement.scrollIntoView()}),10),this.searchInput.patchValue(""),this.data=[]):(this.searchInput.patchValue(e[this.displayKey],{emitEvent:!1}),this.setControlValue(e)),this.closeDropdown())},e.prototype.removeItem=function(e){this.selections.delete(e[this.uniqueKey]),this.setControlValue(this.selectedItems),this.input.nativeElement.focus()},e.prototype.setControlValue=function(e){var t;this.onSelect.emit(e),null===(t=this.control)||void 0===t||t.patchValue(e,{emitEvent:!1})},Object.defineProperty(e.prototype,"selectedItems",{get:function(){return Array.from(this.selections.values())},enumerable:!1,configurable:!0}),e.prototype.removeInputValue=function(){this.searchInput.reset(),this.data=[],this.clear.emit(!0)},e}();d.decorators=[{type:i.Component,args:[{selector:"mis-async-search-dropdown",template:'<div class="dd-wrapper" [ngStyle]="{\'height\': size === \'sm\' ? \'32px\': \'44px\'}" [ngClass]="{ opened: opened, disabled: disabled, readonly: readonly }" #ddBtn>\n <div class="selected-list" *ngIf="multi && selections.size > 0">\n <div class="chip" [ngClass]="{\'chip-md\': size === \'md\', \'chip-sm\': size === \'sm\'}" *ngFor="let item of selectedItems">\n <span [ngClass]="{\'h6\': size === \'md\', \'h8-b\': size === \'sm\'}" style="margin-right: 4px;">{{item[displayKey]}}</span>\n <span style="cursor: pointer;" (click)="removeItem(item)" [ngStyle]="{\'font-size\': size === \'sm\' ? \'12px\': \'14px\'}" class="ic-navigation-cancel-24"></span>\n </div>\n </div>\n <div class="search-input">\n <span class="ic-action-search-24"></span>\n <input [ngClass]="{\'ip-md\': size === \'md\', \'ip-sm\': size === \'sm\'}" tabindex="0" type="text" class="black-text h6" #input [placeholder]="placeholder" [formControl]="searchInput" />\n <div class="ic-navigation-cancel-24 croos-icon" *ngIf="searchInput?.value?.length" (click)="removeInputValue()"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class="dd-list" [ngStyle]="{\'max-height\':height}" [ngClass]="{\'dd-list-pd\':data.length === 0}" >\n <ng-container *ngIf="loading">\n <ng-container\n *ngIf="customLoader; else defaultLoader"\n [ngTemplateOutlet]="customLoader"\n ></ng-container>\n <ng-template #defaultLoader>\n <div class="status-container" *ngIf="loading && !customLoader">\n <mis-loader [mobileView]="true"></mis-loader>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf="error">\n <div class="status-container">\n <p>Unknown error has occurred, <br> Please try again later.</p>\n </div>\n </ng-container>\n <div *ngIf="!loading && !error && data.length > 0">\n <ng-container *ngFor="let item of data">\n <div (click)="selectData(item, false)">\n <ng-container\n *ngIf="customItem; else standardItem"\n [ngTemplateOutlet]="customItem"\n [ngTemplateOutletContext]="{ $implicit: item }"\n ></ng-container>\n <ng-template #standardItem>\n <div class="item">\n <div class="value">\n <div class="primary">\n {{ item[displayKey] }}\n </div>\n <div class="secondary">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf="!loading && !error && data.length === 0 && searchInput.value">\n <div class="data-not-found">No Data Available</div>\n </div>\n </div>\n</ng-template>\n',styles:[".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}::ng-deep #spinner{position:relative!important}"]}]}],d.ctorParameters=function(){return[{type:t.Overlay},{type:i.ViewContainerRef}]},d.propDecorators={height:[{type:i.Input}],size:[{type:i.Input}],httpStream:[{type:i.Input}],displayKey:[{type:i.Input}],secondaryDisplayKey:[{type:i.Input}],placeholder:[{type:i.Input}],debounceTime:[{type:i.Input}],minInputLength:[{type:i.Input}],multi:[{type:i.Input}],uniqueKey:[{type:i.Input}],control:[{type:i.Input}],disabled:[{type:i.Input}],readonly:[{type:i.Input}],origin:[{type:i.ViewChild,args:["ddBtn",{static:!1}]}],input:[{type:i.ViewChild,args:["input",{static:!1}]}],dd:[{type:i.ViewChild,args:["dd",{static:!1}]}],customItem:[{type:i.ContentChild,args:["misCustomItem",{static:!1}]}],customLoader:[{type:i.ContentChild,args:["asyncCustomLoader",{static:!1}]}],onSelect:[{type:i.Output}],searchValue:[{type:i.Input}],searchQueryChange:[{type:i.Output}],clear:[{type:i.Output}]};var l=function(){};l.decorators=[{type:i.NgModule,args:[{declarations:[d],imports:[r.CommonModule,t.OverlayModule,o.ReactiveFormsModule,o.FormsModule,a.LoaderModule],exports:[d]}]}],e.AsyncDropdownComponent=d,e.AsyncDropdownModule=l,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-async-search-dropdown.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts"],"names":["AsyncDropdownComponent","overlay","viewContainerRef","_this","this","size","placeholder","debounceTime","minInputLength","multi","onSelect","EventEmitter","searchInput","FormControl","data","opened","selections","Map","searchQueryChange","clear","handleControlChanges","values","forEach","el","selectData","prototype","ngOnInit","uniqueKey","Error","disabled","disable","searchSubscription","valueChanges","pipe","tap","val","emit","distinctUntilChanged","subscribe","res","length","closeDropdown","httpStream","list","_a","overlayRef","hasAttached","openDropdown","dd","origin","nativeElement","control","value","controlSubscription","_b","ngOnChanges","changes","searchValue","currentValue","patchValue","enable","ngOnDestroy","unsubscribe","template","positionStrategy","position","flexibleConnectedTo","withPositions","ConnectionPositionPair","originX","originY","overlayX","overlayY","withPush","configs","OverlayConfig","hasBackdrop","backdropClass","scrollStrategy","scrollStrategies","reposition","width","clientWidth","create","attach","TemplatePortal","backdropClick","detach","item","effectedFromOutside","has","set","setControlValue","selectedItems","setTimeout","input","focus","scrollIntoView","displayKey","emitEvent","removeItem","delete","Object","defineProperty","Array","from","removeInputValue","reset","Component","args","selector","Overlay","ViewContainerRef","Input","ViewChild","static","ContentChild","Output","NgModule","declarations","imports","CommonModule","OverlayModule","ReactiveFormsModule","F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AC,CACTC,SAAU,4BACV/C,SAAA,w5IA3B+BgD,EAAAA,eAgB/BC,EAAAA,oDAgBCC,EAAAA,oBACAA,EAAAA,0BACAA,EAAAA,0BACAA,EAAAA,mCACAA,EAAAA,2BACAA,EAAAA,4BACAA,EAAAA,8BACAA,EAAAA,qBACAA,EAAAA,yBACAA,EAAAA,uBACAA,EAAAA,wBACAA,EAAAA,wBACAA,EAAAA,sBACAC,EAAAA,UAASL,KAAA,CAAC,QAAS,CAAEM,QAAQ,mBAC7BD,EAAAA,UAASL,KAAA,CAAC,QAAS,CAAEM,QAAQ,gBAC7BD,EAAAA,UAASL,KAAA,CAAC,KAAM,CAAEM,QAAQ,wBAC1BC,EAAAA,aAAYP,KAAA,CAAC,gBAAiB,CAAEM,QAAQ,sBAGxCE,EAAAA,4BASAJ,EAAAA,iCACAI,EAAAA,sBACAA,EAAAA,gBCnDH,iCALCC,EAAAA,SAAQT,KAAA,CAAC,CACRU,aAAc,CAACvH,GACfwH,QAAS,CAACC,EAAAA,aAAcC,EAAAA,cAAeC,EAAAA,oBAAqBC,EAAAA,aAC5DC,QAAS,CAAC7H","sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewContainerRef\n} from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged, filter, tap } from \"rxjs/operators\";\n\n// tslint:disable-next-line\ntype IListData = any;\n\n@Component({\n selector: \"mis-async-search-dropdown\",\n templateUrl: \"./async-dropdown.component.html\",\n styleUrls: [\"./async-dropdown.component.scss\"]\n})\nexport class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {\n constructor(private overlay: Overlay, private viewContainerRef: ViewContainerRef) { }\n @Input() height;\n @Input() size: 'md' | 'sm' = 'md'\n @Input() httpStream!: (searchKey: string) => Observable<IListData>; // function that returns an httpobservable\n @Input() displayKey!: string; // string to show value in list\n @Input() secondaryDisplayKey!: string; // string to display secondary value\n @Input() placeholder = \"Select\"; // placeholder for input\n @Input() debounceTime = 400; // wait time till which API call is paused\n @Input() minInputLength = 2; // min length after which API call is made\n @Input() multi = false; // maintain a list or emit value\n @Input() uniqueKey: string; // for identifying unique values\n @Input() control: AbstractControl | null; // form control for reactive forms\n @Input() disabled: boolean; // disable actions on component\n @Input() readonly: boolean; // make component readonly\n @ViewChild(\"ddBtn\", { static: false }) origin: ElementRef;\n @ViewChild(\"input\", { static: false }) input: ElementRef;\n @ViewChild(\"dd\", { static: false }) dd: TemplateRef<Element>;\n @ContentChild(\"misCustomItem\", { static: false })\n customItem: TemplateRef<Element>;\n // tslint:disable-next-line\n @Output() onSelect: EventEmitter<IListData | IListData[]> = new EventEmitter(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n @Input() searchValue;\n @Output() searchQueryChange = new EventEmitter<string>()\n @Output() clear: EventEmitter<boolean> = new EventEmitter(false);\n ngOnInit(): void {\n if (this.multi && !this.uniqueKey) {\n throw new Error(\"[uniqueKey] required in multi mode.\");\n }\n if (this.disabled) {\n this.searchInput.disable();\n }\n this.searchSubscription = this.searchInput.valueChanges\n .pipe(\n // filter(val => val && val.length >= this.minInputLength),\n tap((val) => this.searchQueryChange.emit(val)),\n debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe(res => {\n if (res?.length < this.minInputLength) {\n this.closeDropdown();\n return;\n } else if (res?.length > this.minInputLength && this.httpStream) {\n this.httpStream(res).subscribe(list => {\n this.data = list;\n if (!this.overlayRef?.hasAttached() && list.length > 0) {\n this.openDropdown(this.dd, this.origin.nativeElement);\n }\n });\n }\n });\n if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(this.handleControlChanges);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes && changes?.searchValue?.currentValue) {\n this.searchInput.patchValue(changes.searchValue.currentValue);\n }\n if (changes && changes.disabled) {\n this.searchInput.enable();\n if (this.disabled) {\n this.searchInput.disable();\n }\n }\n }\n\n ngOnDestroy(): void {\n this.searchSubscription?.unsubscribe();\n }\n\n private handleControlChanges = (values: IListData[]) => {\n values.forEach(el => {\n this.selectData(el, true);\n });\n // tslint:disable-next-line\n };\n\n private openDropdown(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n\n removeInputValue() {\n this.searchInput.reset();\n this.data = [];\n this.clear.emit(true);\n }\n}\n","import { OverlayModule } from \"@angular/cdk/overlay\";\nimport { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\nimport { AsyncDropdownComponent } from \"./async-dropdown.component\";\n\n@NgModule({\n declarations: [AsyncDropdownComponent],\n imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule],\n exports: [AsyncDropdownComponent]\n})\nexport class AsyncDropdownModule {}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts"],"names":["AsyncDropdownComponent","overlay","viewContainerRef","_this","this","size","placeholder","debounceTime","minInputLength","multi","onSelect","EventEmitter","searchInput","FormControl","data","opened","loading","error","selections","Map","searchQueryChange","clear","handleControlChanges","values","forEach","el","selectData","prototype","ngOnInit","uniqueKey","Error","disabled","disable","searchSubscription","valueChanges","pipe","tap","val","emit","distinctUntilChanged","subscribe","res","length","closeDropdown","httpStream","overlayRef","openDropdown","dd","origin","nativeElement","list","_a","hasAttached","control","value","controlSubscription","_b","ngOnChanges","changes","searchValue","currentValue","patchValue","enable","ngOnDestroy","unsubscribe","template","positionStrategy","position","flexibleConnectedTo","withPositions","ConnectionPositionPair","originX","originY","overlayX","overlayY","withPush","configs","OverlayConfig","hasBackdrop","backdropClass","scrollStrategy","scrollStrategies","reposition","width","clientWidth","create","attach","TemplatePortal","backdropClick","detach","item","effectedFromOutside","has","set","setControlValue","selectedItems","setTimeout","input","focus","scrollIntoView","displayKey","emitEvent","removeItem","delete","Object","defineProperty","Array","from","removeInputValue","reset","Component","args","selector","Overlay","ViewContainerRef","Input","ViewChild","static","ContentChild","Output","NgModule","declarations","imports","CommonModule","OverlayModule","ReactiveFormsModule","FormsModule","LoaderModule","exports"],"mappings":"k5BAgCE,SAAAA,EAAoBC,EAA0BC,GAA9C,IAAAC,EAAAC,KAAoBA,KAAAH,QAAAA,EAA0BG,KAAAF,iBAAAA,EAErCE,KAAAC,KAAoB,KAIpBD,KAAAE,YAAc,SACdF,KAAAG,aAAe,IACfH,KAAAI,eAAiB,EACjBJ,KAAAK,OAAQ,EAaPL,KAAAM,SAAkD,IAAIC,EAAAA,cAAa,GAC7EP,KAAAQ,YAA2B,IAAIC,EAAAA,YAC/BT,KAAAU,KAAoB,GACpBV,KAAAW,QAAS,EACTX,KAAAY,SAAmB,EACnBZ,KAAAa,OAAiB,EAEjBb,KAAAc,WAA+B,IAAIC,IAKzBf,KAAAgB,kBAAoB,IAAIT,EAAAA,aACxBP,KAAAiB,MAA+B,IAAIV,EAAAA,cAAa,GA0DlDP,KAAAkB,qBAAuB,SAACC,GAC9BA,EAAOC,SAAQ,SAAAC,GACbtB,EAAKuB,WAAWD,GAAI,cA3DxBzB,EAAA2B,UAAAC,SAAA,WAAA,QAAAzB,EAAAC,KACE,GAAIA,KAAKK,QAAUL,KAAKyB,UACtB,MAAM,IAAIC,MAAM,uCAEd1B,KAAK2B,UACP3B,KAAKQ,YAAYoB,UAEnB5B,KAAK6B,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AG5CE,EAAAA,4BAWAJ,EAAAA,iCACAI,EAAAA,sBACAA,EAAAA,gBCvDH,iCALCC,EAAAA,SAAQT,KAAA,CAAC,CACRU,aAAc,CAACzH,GACf0H,QAAS,CAACC,EAAAA,aAAcC,EAAAA,cAAeC,EAAAA,oBAAqBC,EAAAA,YAAaC,EAAAA,cACzEC,QAAS,CAAChI","sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewContainerRef\n} from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged, filter, tap } from \"rxjs/operators\";\n\n// tslint:disable-next-line\ntype IListData = any;\n\n@Component({\n selector: \"mis-async-search-dropdown\",\n templateUrl: \"./async-dropdown.component.html\",\n styleUrls: [\"./async-dropdown.component.scss\"]\n})\nexport class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {\n constructor(private overlay: Overlay, private viewContainerRef: ViewContainerRef) { }\n @Input() height;\n @Input() size: 'md' | 'sm' = 'md'\n @Input() httpStream!: (searchKey: string) => Observable<IListData>; // function that returns an httpobservable\n @Input() displayKey!: string; // string to show value in list\n @Input() secondaryDisplayKey!: string; // string to display secondary value\n @Input() placeholder = \"Select\"; // placeholder for input\n @Input() debounceTime = 400; // wait time till which API call is paused\n @Input() minInputLength = 2; // min length after which API call is made\n @Input() multi = false; // maintain a list or emit value\n @Input() uniqueKey: string; // for identifying unique values\n @Input() control: AbstractControl | null; // form control for reactive forms\n @Input() disabled: boolean; // disable actions on component\n @Input() readonly: boolean; // make component readonly\n @ViewChild(\"ddBtn\", { static: false }) origin: ElementRef;\n @ViewChild(\"input\", { static: false }) input: ElementRef;\n @ViewChild(\"dd\", { static: false }) dd: TemplateRef<Element>;\n @ContentChild(\"misCustomItem\", { static: false })\n customItem: TemplateRef<Element>;\n @ContentChild(\"asyncCustomLoader\", { static: false})\n customLoader: TemplateRef<Element>;\n // tslint:disable-next-line\n @Output() onSelect: EventEmitter<IListData | IListData[]> = new EventEmitter(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n loading: boolean = false;\n error: boolean = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n @Input() searchValue;\n @Output() searchQueryChange = new EventEmitter<string>()\n @Output() clear: EventEmitter<boolean> = new EventEmitter(false);\n ngOnInit(): void {\n if (this.multi && !this.uniqueKey) {\n throw new Error(\"[uniqueKey] required in multi mode.\");\n }\n if (this.disabled) {\n this.searchInput.disable();\n }\n this.searchSubscription = this.searchInput.valueChanges\n .pipe(\n // filter(val => val && val.length >= this.minInputLength),\n tap((val) => this.searchQueryChange.emit(val)),\n debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe(res => {\n if (res?.length < this.minInputLength) {\n this.closeDropdown();\n return;\n } else if (res?.length > this.minInputLength && this.httpStream) {\n this.loading = true;\n this.error = false;\n if(!this.overlayRef)\n this.openDropdown(this.dd, this.origin.nativeElement);\n this.httpStream(res).subscribe(list => {\n this.loading = false;\n this.data = list;\n if (!this.overlayRef?.hasAttached() && list.length > 0) {\n this.openDropdown(this.dd, this.origin.nativeElement);\n }\n }, error => {\n this.loading = false;\n this.error = true;\n });\n }\n });\n if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(this.handleControlChanges);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes && changes?.searchValue?.currentValue) {\n this.searchInput.patchValue(changes.searchValue.currentValue);\n }\n if (changes && changes.disabled) {\n this.searchInput.enable();\n if (this.disabled) {\n this.searchInput.disable();\n }\n }\n }\n\n ngOnDestroy(): void {\n this.searchSubscription?.unsubscribe();\n }\n\n private handleControlChanges = (values: IListData[]) => {\n values.forEach(el => {\n this.selectData(el, true);\n });\n // tslint:disable-next-line\n };\n\n private openDropdown(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n\n removeInputValue() {\n this.searchInput.reset();\n this.data = [];\n this.clear.emit(true);\n }\n}\n","import { OverlayModule } from \"@angular/cdk/overlay\";\nimport { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\nimport { LoaderModule } from \"mis-crystal-design-system/loader\";\nimport { AsyncDropdownComponent } from \"./async-dropdown.component\";\n\n@NgModule({\n declarations: [AsyncDropdownComponent],\n imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule, LoaderModule],\n exports: [AsyncDropdownComponent]\n})\nexport class AsyncDropdownModule {}\n"]}
|
|
@@ -17,6 +17,8 @@ export class AsyncDropdownComponent {
|
|
|
17
17
|
this.searchInput = new FormControl();
|
|
18
18
|
this.data = [];
|
|
19
19
|
this.opened = false;
|
|
20
|
+
this.loading = false;
|
|
21
|
+
this.error = false;
|
|
20
22
|
// tslint:disable-next-line
|
|
21
23
|
this.selections = new Map();
|
|
22
24
|
this.searchQueryChange = new EventEmitter();
|
|
@@ -46,12 +48,20 @@ export class AsyncDropdownComponent {
|
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
50
|
else if ((res === null || res === void 0 ? void 0 : res.length) > this.minInputLength && this.httpStream) {
|
|
51
|
+
this.loading = true;
|
|
52
|
+
this.error = false;
|
|
53
|
+
if (!this.overlayRef)
|
|
54
|
+
this.openDropdown(this.dd, this.origin.nativeElement);
|
|
49
55
|
this.httpStream(res).subscribe(list => {
|
|
50
56
|
var _a;
|
|
57
|
+
this.loading = false;
|
|
51
58
|
this.data = list;
|
|
52
59
|
if (!((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && list.length > 0) {
|
|
53
60
|
this.openDropdown(this.dd, this.origin.nativeElement);
|
|
54
61
|
}
|
|
62
|
+
}, error => {
|
|
63
|
+
this.loading = false;
|
|
64
|
+
this.error = true;
|
|
55
65
|
});
|
|
56
66
|
}
|
|
57
67
|
});
|
|
@@ -167,8 +177,8 @@ export class AsyncDropdownComponent {
|
|
|
167
177
|
AsyncDropdownComponent.decorators = [
|
|
168
178
|
{ type: Component, args: [{
|
|
169
179
|
selector: "mis-async-search-dropdown",
|
|
170
|
-
template: "<div class=\"dd-wrapper\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <div *ngIf=\"data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
171
|
-
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}"]
|
|
180
|
+
template: "<div class=\"dd-wrapper\" [ngStyle]=\"{'height': size === 'sm' ? '32px': '44px'}\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <ng-container *ngIf=\"loading\">\n <ng-container\n *ngIf=\"customLoader; else defaultLoader\"\n [ngTemplateOutlet]=\"customLoader\"\n ></ng-container>\n <ng-template #defaultLoader>\n <div class=\"status-container\" *ngIf=\"loading && !customLoader\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"error\">\n <div class=\"status-container\">\n <p>Unknown error has occurred, <br> Please try again later.</p>\n </div>\n </ng-container>\n <div *ngIf=\"!loading && !error && data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!loading && !error && data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
181
|
+
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}::ng-deep #spinner{position:relative!important}"]
|
|
172
182
|
},] }
|
|
173
183
|
];
|
|
174
184
|
AsyncDropdownComponent.ctorParameters = () => [
|
|
@@ -193,9 +203,10 @@ AsyncDropdownComponent.propDecorators = {
|
|
|
193
203
|
input: [{ type: ViewChild, args: ["input", { static: false },] }],
|
|
194
204
|
dd: [{ type: ViewChild, args: ["dd", { static: false },] }],
|
|
195
205
|
customItem: [{ type: ContentChild, args: ["misCustomItem", { static: false },] }],
|
|
206
|
+
customLoader: [{ type: ContentChild, args: ["asyncCustomLoader", { static: false },] }],
|
|
196
207
|
onSelect: [{ type: Output }],
|
|
197
208
|
searchValue: [{ type: Input }],
|
|
198
209
|
searchQueryChange: [{ type: Output }],
|
|
199
210
|
clear: [{ type: Output }]
|
|
200
211
|
};
|
|
201
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN5bmMtZHJvcGRvd24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbWlzLWNvbXBvbmVudHMvYXN5bmMtc2VhcmNoLWRyb3Bkb3duL2FzeW5jLWRyb3Bkb3duLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsT0FBTyxFQUFFLGFBQWEsRUFBYyxNQUFNLHNCQUFzQixDQUFDO0FBQ2xHLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEVBRUwsU0FBUyxFQUNULFlBQVksRUFFWixZQUFZLEVBQ1osS0FBSyxFQUlMLE1BQU0sRUFHTixTQUFTLEVBQ1QsZ0JBQWdCLEVBQ2pCLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBbUIsV0FBVyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFOUQsT0FBTyxFQUFFLFlBQVksRUFBRSxvQkFBb0IsRUFBVSxHQUFHLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQVVqRixNQUFNLE9BQU8sc0JBQXNCO0lBQ2pDLFlBQW9CLE9BQWdCLEVBQVUsZ0JBQWtDO1FBQTVELFlBQU8sR0FBUCxPQUFPLENBQVM7UUFBVSxxQkFBZ0IsR0FBaEIsZ0JBQWdCLENBQWtCO1FBRXZFLFNBQUksR0FBZ0IsSUFBSSx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mlxdWVLZXldKTtcbiAgICB0aGlzLnNldENvbnRyb2xWYWx1ZSh0aGlzLnNlbGVjdGVkSXRlbXMpO1xuICAgIC8vIHRzbGludDpkaXNhYmxlLW5leHQtbGluZVxuICAgIHRoaXMuaW5wdXRbXCJuYXRpdmVFbGVtZW50XCJdLmZvY3VzKCk7XG4gIH1cblxuICBwcml2YXRlIHNldENvbnRyb2xWYWx1ZSh2YWx1ZTogSUxpc3REYXRhKTogdm9pZCB7XG4gICAgdGhpcy5vblNlbGVjdC5lbWl0KHZhbHVlKTtcbiAgICB0aGlzLmNvbnRyb2w/LnBhdGNoVmFsdWUodmFsdWUsIHsgZW1pdEV2ZW50OiBmYWxzZSB9KTtcbiAgfVxuXG4gIC8qKlxuICAgKiBAcmV0dXJucyBsaXN0IG9mIHNlbGVjdGVkIGl0ZW1zXG4gICAqL1xuICBnZXQgc2VsZWN0ZWRJdGVtcygpOiBBcnJheTxJTGlzdERhdGE+IHtcbiAgICByZXR1cm4gQXJyYXkuZnJvbSh0aGlzLnNlbGVjdGlvbnMudmFsdWVzKCkpO1xuICB9XG5cbiAgcmVtb3ZlSW5wdXRWYWx1ZSgpIHtcbiAgICB0aGlzLnNlYXJjaElucHV0LnJlc2V0KCk7XG4gICAgdGhpcy5kYXRhID0gW107XG4gICAgdGhpcy5jbGVhci5lbWl0KHRydWUpO1xuICB9XG59XG4iXX0=
|
|
@@ -2,14 +2,15 @@ import { OverlayModule } from "@angular/cdk/overlay";
|
|
|
2
2
|
import { CommonModule } from "@angular/common";
|
|
3
3
|
import { NgModule } from "@angular/core";
|
|
4
4
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
5
|
+
import { LoaderModule } from "mis-crystal-design-system/loader";
|
|
5
6
|
import { AsyncDropdownComponent } from "./async-dropdown.component";
|
|
6
7
|
export class AsyncDropdownModule {
|
|
7
8
|
}
|
|
8
9
|
AsyncDropdownModule.decorators = [
|
|
9
10
|
{ type: NgModule, args: [{
|
|
10
11
|
declarations: [AsyncDropdownComponent],
|
|
11
|
-
imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule],
|
|
12
|
+
imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule, LoaderModule],
|
|
12
13
|
exports: [AsyncDropdownComponent]
|
|
13
14
|
},] }
|
|
14
15
|
];
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN5bmMtZHJvcGRvd24ubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbWlzLWNvbXBvbmVudHMvYXN5bmMtc2VhcmNoLWRyb3Bkb3duL2FzeW5jLWRyb3Bkb3duLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDckQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLFdBQVcsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNoRSxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQU9wRSxNQUFNLE9BQU8sbUJBQW1COzs7WUFML0IsUUFBUSxTQUFDO2dCQUNSLFlBQVksRUFBRSxDQUFDLHNCQUFzQixDQUFDO2dCQUN0QyxPQUFPLEVBQUUsQ0FBQyxZQUFZLEVBQUUsYUFBYSxFQUFFLG1CQUFtQixFQUFFLFdBQVcsRUFBRSxZQUFZLENBQUM7Z0JBQ3RGLE9BQU8sRUFBRSxDQUFDLHNCQUFzQixDQUFDO2FBQ2xDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgT3ZlcmxheU1vZHVsZSB9IGZyb20gXCJAYW5ndWxhci9jZGsvb3ZlcmxheVwiO1xuaW1wb3J0IHsgQ29tbW9uTW9kdWxlIH0gZnJvbSBcIkBhbmd1bGFyL2NvbW1vblwiO1xuaW1wb3J0IHsgTmdNb2R1bGUgfSBmcm9tIFwiQGFuZ3VsYXIvY29yZVwiO1xuaW1wb3J0IHsgRm9ybXNNb2R1bGUsIFJlYWN0aXZlRm9ybXNNb2R1bGUgfSBmcm9tIFwiQGFuZ3VsYXIvZm9ybXNcIjtcbmltcG9ydCB7IExvYWRlck1vZHVsZSB9IGZyb20gXCJtaXMtY3J5c3RhbC1kZXNpZ24tc3lzdGVtL2xvYWRlclwiO1xuaW1wb3J0IHsgQXN5bmNEcm9wZG93bkNvbXBvbmVudCB9IGZyb20gXCIuL2FzeW5jLWRyb3Bkb3duLmNvbXBvbmVudFwiO1xuXG5ATmdNb2R1bGUoe1xuICBkZWNsYXJhdGlvbnM6IFtBc3luY0Ryb3Bkb3duQ29tcG9uZW50XSxcbiAgaW1wb3J0czogW0NvbW1vbk1vZHVsZSwgT3ZlcmxheU1vZHVsZSwgUmVhY3RpdmVGb3Jtc01vZHVsZSwgRm9ybXNNb2R1bGUsIExvYWRlck1vZHVsZV0sXG4gIGV4cG9ydHM6IFtBc3luY0Ryb3Bkb3duQ29tcG9uZW50XVxufSlcbmV4cG9ydCBjbGFzcyBBc3luY0Ryb3Bkb3duTW9kdWxlIHt9XG4iXX0=
|
|
@@ -4,6 +4,7 @@ import { EventEmitter, Component, ViewContainerRef, Input, ViewChild, ContentChi
|
|
|
4
4
|
import { FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
5
5
|
import { tap, debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
|
+
import { LoaderModule } from 'mis-crystal-design-system/loader';
|
|
7
8
|
|
|
8
9
|
class AsyncDropdownComponent {
|
|
9
10
|
constructor(overlay, viewContainerRef) {
|
|
@@ -19,6 +20,8 @@ class AsyncDropdownComponent {
|
|
|
19
20
|
this.searchInput = new FormControl();
|
|
20
21
|
this.data = [];
|
|
21
22
|
this.opened = false;
|
|
23
|
+
this.loading = false;
|
|
24
|
+
this.error = false;
|
|
22
25
|
// tslint:disable-next-line
|
|
23
26
|
this.selections = new Map();
|
|
24
27
|
this.searchQueryChange = new EventEmitter();
|
|
@@ -48,12 +51,20 @@ class AsyncDropdownComponent {
|
|
|
48
51
|
return;
|
|
49
52
|
}
|
|
50
53
|
else if ((res === null || res === void 0 ? void 0 : res.length) > this.minInputLength && this.httpStream) {
|
|
54
|
+
this.loading = true;
|
|
55
|
+
this.error = false;
|
|
56
|
+
if (!this.overlayRef)
|
|
57
|
+
this.openDropdown(this.dd, this.origin.nativeElement);
|
|
51
58
|
this.httpStream(res).subscribe(list => {
|
|
52
59
|
var _a;
|
|
60
|
+
this.loading = false;
|
|
53
61
|
this.data = list;
|
|
54
62
|
if (!((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && list.length > 0) {
|
|
55
63
|
this.openDropdown(this.dd, this.origin.nativeElement);
|
|
56
64
|
}
|
|
65
|
+
}, error => {
|
|
66
|
+
this.loading = false;
|
|
67
|
+
this.error = true;
|
|
57
68
|
});
|
|
58
69
|
}
|
|
59
70
|
});
|
|
@@ -169,8 +180,8 @@ class AsyncDropdownComponent {
|
|
|
169
180
|
AsyncDropdownComponent.decorators = [
|
|
170
181
|
{ type: Component, args: [{
|
|
171
182
|
selector: "mis-async-search-dropdown",
|
|
172
|
-
template: "<div class=\"dd-wrapper\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <div *ngIf=\"data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
173
|
-
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}"]
|
|
183
|
+
template: "<div class=\"dd-wrapper\" [ngStyle]=\"{'height': size === 'sm' ? '32px': '44px'}\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <ng-container *ngIf=\"loading\">\n <ng-container\n *ngIf=\"customLoader; else defaultLoader\"\n [ngTemplateOutlet]=\"customLoader\"\n ></ng-container>\n <ng-template #defaultLoader>\n <div class=\"status-container\" *ngIf=\"loading && !customLoader\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"error\">\n <div class=\"status-container\">\n <p>Unknown error has occurred, <br> Please try again later.</p>\n </div>\n </ng-container>\n <div *ngIf=\"!loading && !error && data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!loading && !error && data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
184
|
+
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}::ng-deep #spinner{position:relative!important}"]
|
|
174
185
|
},] }
|
|
175
186
|
];
|
|
176
187
|
AsyncDropdownComponent.ctorParameters = () => [
|
|
@@ -195,6 +206,7 @@ AsyncDropdownComponent.propDecorators = {
|
|
|
195
206
|
input: [{ type: ViewChild, args: ["input", { static: false },] }],
|
|
196
207
|
dd: [{ type: ViewChild, args: ["dd", { static: false },] }],
|
|
197
208
|
customItem: [{ type: ContentChild, args: ["misCustomItem", { static: false },] }],
|
|
209
|
+
customLoader: [{ type: ContentChild, args: ["asyncCustomLoader", { static: false },] }],
|
|
198
210
|
onSelect: [{ type: Output }],
|
|
199
211
|
searchValue: [{ type: Input }],
|
|
200
212
|
searchQueryChange: [{ type: Output }],
|
|
@@ -206,7 +218,7 @@ class AsyncDropdownModule {
|
|
|
206
218
|
AsyncDropdownModule.decorators = [
|
|
207
219
|
{ type: NgModule, args: [{
|
|
208
220
|
declarations: [AsyncDropdownComponent],
|
|
209
|
-
imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule],
|
|
221
|
+
imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule, LoaderModule],
|
|
210
222
|
exports: [AsyncDropdownComponent]
|
|
211
223
|
},] }
|
|
212
224
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-async-search-dropdown.js","sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts","../../../projects/mis-components/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.ts"],"sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewContainerRef\n} from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged, filter, tap } from \"rxjs/operators\";\n\n// tslint:disable-next-line\ntype IListData = any;\n\n@Component({\n selector: \"mis-async-search-dropdown\",\n templateUrl: \"./async-dropdown.component.html\",\n styleUrls: [\"./async-dropdown.component.scss\"]\n})\nexport class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {\n constructor(private overlay: Overlay, private viewContainerRef: ViewContainerRef) { }\n @Input() height;\n @Input() size: 'md' | 'sm' = 'md'\n @Input() httpStream!: (searchKey: string) => Observable<IListData>; // function that returns an httpobservable\n @Input() displayKey!: string; // string to show value in list\n @Input() secondaryDisplayKey!: string; // string to display secondary value\n @Input() placeholder = \"Select\"; // placeholder for input\n @Input() debounceTime = 400; // wait time till which API call is paused\n @Input() minInputLength = 2; // min length after which API call is made\n @Input() multi = false; // maintain a list or emit value\n @Input() uniqueKey: string; // for identifying unique values\n @Input() control: AbstractControl | null; // form control for reactive forms\n @Input() disabled: boolean; // disable actions on component\n @Input() readonly: boolean; // make component readonly\n @ViewChild(\"ddBtn\", { static: false }) origin: ElementRef;\n @ViewChild(\"input\", { static: false }) input: ElementRef;\n @ViewChild(\"dd\", { static: false }) dd: TemplateRef<Element>;\n @ContentChild(\"misCustomItem\", { static: false })\n customItem: TemplateRef<Element>;\n // tslint:disable-next-line\n @Output() onSelect: EventEmitter<IListData | IListData[]> = new EventEmitter(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n @Input() searchValue;\n @Output() searchQueryChange = new EventEmitter<string>()\n @Output() clear: EventEmitter<boolean> = new EventEmitter(false);\n ngOnInit(): void {\n if (this.multi && !this.uniqueKey) {\n throw new Error(\"[uniqueKey] required in multi mode.\");\n }\n if (this.disabled) {\n this.searchInput.disable();\n }\n this.searchSubscription = this.searchInput.valueChanges\n .pipe(\n // filter(val => val && val.length >= this.minInputLength),\n tap((val) => this.searchQueryChange.emit(val)),\n debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe(res => {\n if (res?.length < this.minInputLength) {\n this.closeDropdown();\n return;\n } else if (res?.length > this.minInputLength && this.httpStream) {\n this.httpStream(res).subscribe(list => {\n this.data = list;\n if (!this.overlayRef?.hasAttached() && list.length > 0) {\n this.openDropdown(this.dd, this.origin.nativeElement);\n }\n });\n }\n });\n if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(this.handleControlChanges);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes && changes?.searchValue?.currentValue) {\n this.searchInput.patchValue(changes.searchValue.currentValue);\n }\n if (changes && changes.disabled) {\n this.searchInput.enable();\n if (this.disabled) {\n this.searchInput.disable();\n }\n }\n }\n\n ngOnDestroy(): void {\n this.searchSubscription?.unsubscribe();\n }\n\n private handleControlChanges = (values: IListData[]) => {\n values.forEach(el => {\n this.selectData(el, true);\n });\n // tslint:disable-next-line\n };\n\n private openDropdown(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n\n removeInputValue() {\n this.searchInput.reset();\n this.data = [];\n this.clear.emit(true);\n }\n}\n","import { OverlayModule } from \"@angular/cdk/overlay\";\nimport { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\nimport { AsyncDropdownComponent } from \"./async-dropdown.component\";\n\n@NgModule({\n declarations: [AsyncDropdownComponent],\n imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule],\n exports: [AsyncDropdownComponent]\n})\nexport class AsyncDropdownModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MA8Ba,sBAAsB;IACjC,YAAoB,OAAgB,EAAU,gBAAkC;QAA5D,YAAO,GAAP,OAAO,CAAS;QAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;QAEvE,SAAI,GAAgB,IAAI,CAAA;QAIxB,gBAAW,GAAG,QAAQ,CAAC;QACvB,iBAAY,GAAG,GAAG,CAAC;QACnB,mBAAc,GAAG,CAAC,CAAC;QACnB,UAAK,GAAG,KAAK,CAAC;;QAWb,aAAQ,GAA0C,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACnF,gBAAW,GAAgB,IAAI,WAAW,EAAE,CAAC;QAC7C,SAAI,GAAgB,EAAE,CAAC;QACvB,WAAM,GAAG,KAAK,CAAC;;QAEf,eAAU,GAAqB,IAAI,GAAG,EAAE,CAAC;QAK/B,sBAAiB,GAAG,IAAI,YAAY,EAAU,CAAA;QAC9C,UAAK,GAA0B,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QAkDzD,yBAAoB,GAAG,CAAC,MAAmB;YACjD,MAAM,CAAC,OAAO,CAAC,EAAE;gBACf,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;aAC3B,CAAC,CAAC;;SAEJ,CAAC;KAtFmF;IAgCrF,QAAQ;;QACN,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,q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AAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;oBACpC,SAAS,SAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;iBACpC,SAAS,SAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;yBACjC,YAAY,SAAC,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;uBAG/C,MAAM;0BASN,KAAK;gCACL,MAAM;oBACN,MAAM;;;MCnDI,mBAAmB;;;YAL/B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,CAAC;gBACxE,OAAO,EAAE,CAAC,sBAAsB,CAAC;aAClC;;;ACVD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-async-search-dropdown.js","sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts","../../../projects/mis-components/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.ts"],"sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewContainerRef\n} from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { debounceTime, distinctUntilChanged, filter, tap } from \"rxjs/operators\";\n\n// tslint:disable-next-line\ntype IListData = any;\n\n@Component({\n selector: \"mis-async-search-dropdown\",\n templateUrl: \"./async-dropdown.component.html\",\n styleUrls: [\"./async-dropdown.component.scss\"]\n})\nexport class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {\n constructor(private overlay: Overlay, private viewContainerRef: ViewContainerRef) { }\n @Input() height;\n @Input() size: 'md' | 'sm' = 'md'\n @Input() httpStream!: (searchKey: string) => Observable<IListData>; // function that returns an httpobservable\n @Input() displayKey!: string; // string to show value in list\n @Input() secondaryDisplayKey!: string; // string to display secondary value\n @Input() placeholder = \"Select\"; // placeholder for input\n @Input() debounceTime = 400; // wait time till which API call is paused\n @Input() minInputLength = 2; // min length after which API call is made\n @Input() multi = false; // maintain a list or emit value\n @Input() uniqueKey: string; // for identifying unique values\n @Input() control: AbstractControl | null; // form control for reactive forms\n @Input() disabled: boolean; // disable actions on component\n @Input() readonly: boolean; // make component readonly\n @ViewChild(\"ddBtn\", { static: false }) origin: ElementRef;\n @ViewChild(\"input\", { static: false }) input: ElementRef;\n @ViewChild(\"dd\", { static: false }) dd: TemplateRef<Element>;\n @ContentChild(\"misCustomItem\", { static: false })\n customItem: TemplateRef<Element>;\n @ContentChild(\"asyncCustomLoader\", { static: false})\n customLoader: TemplateRef<Element>;\n // tslint:disable-next-line\n @Output() onSelect: EventEmitter<IListData | IListData[]> = new EventEmitter(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n loading: boolean = false;\n error: boolean = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n @Input() searchValue;\n @Output() searchQueryChange = new EventEmitter<string>()\n @Output() clear: EventEmitter<boolean> = new EventEmitter(false);\n ngOnInit(): void {\n if (this.multi && !this.uniqueKey) {\n throw new Error(\"[uniqueKey] required in multi mode.\");\n }\n if (this.disabled) {\n this.searchInput.disable();\n }\n this.searchSubscription = this.searchInput.valueChanges\n .pipe(\n // filter(val => val && val.length >= this.minInputLength),\n tap((val) => this.searchQueryChange.emit(val)),\n debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe(res => {\n if (res?.length < this.minInputLength) {\n this.closeDropdown();\n return;\n } else if (res?.length > this.minInputLength && this.httpStream) {\n this.loading = true;\n this.error = false;\n if(!this.overlayRef)\n this.openDropdown(this.dd, this.origin.nativeElement);\n this.httpStream(res).subscribe(list => {\n this.loading = false;\n this.data = list;\n if (!this.overlayRef?.hasAttached() && list.length > 0) {\n this.openDropdown(this.dd, this.origin.nativeElement);\n }\n }, error => {\n this.loading = false;\n this.error = true;\n });\n }\n });\n if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(this.handleControlChanges);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes && changes?.searchValue?.currentValue) {\n this.searchInput.patchValue(changes.searchValue.currentValue);\n }\n if (changes && changes.disabled) {\n this.searchInput.enable();\n if (this.disabled) {\n this.searchInput.disable();\n }\n }\n }\n\n ngOnDestroy(): void {\n this.searchSubscription?.unsubscribe();\n }\n\n private handleControlChanges = (values: IListData[]) => {\n values.forEach(el => {\n this.selectData(el, true);\n });\n // tslint:disable-next-line\n };\n\n private openDropdown(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n\n removeInputValue() {\n this.searchInput.reset();\n this.data = [];\n this.clear.emit(true);\n }\n}\n","import { OverlayModule } from \"@angular/cdk/overlay\";\nimport { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\nimport { LoaderModule } from \"mis-crystal-design-system/loader\";\nimport { AsyncDropdownComponent } from \"./async-dropdown.component\";\n\n@NgModule({\n declarations: [AsyncDropdownComponent],\n imports: [CommonModule, OverlayModule, ReactiveFormsModule, FormsModule, LoaderModule],\n exports: [AsyncDropdownComponent]\n})\nexport class AsyncDropdownModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MA+Ba,sBAAsB;IACjC,YAAoB,OAAgB,EAAU,gBAAkC;QAA5D,YAAO,GAAP,OAAO,CAAS;QAAU,qBA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M,EAAE,KAAK,EAAE;oBACpC,SAAS,SAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;iBACpC,SAAS,SAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;yBACjC,YAAY,SAAC,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;2BAE/C,YAAY,SAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAC;uBAGlD,MAAM;0BAWN,KAAK;gCACL,MAAM;oBACN,MAAM;;;MCvDI,mBAAmB;;;YAL/B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,CAAC;gBACtF,OAAO,EAAE,CAAC,sBAAsB,CAAC;aAClC;;;ACXD;;;;;;"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
:root{
|
|
2
|
+
// PRIMARY_COLORS -----------------------
|
|
3
|
+
$pmry_100: #CBDDFB;
|
|
4
|
+
$pmry_200: #99BAF7;
|
|
5
|
+
$pmry_500: #0937B2;
|
|
6
|
+
$pmry_400: #3C68D0;
|
|
7
|
+
$pmry_600: #062A99;
|
|
8
|
+
$pmry_700: #041F80;
|
|
9
|
+
$pmry_300: #638FE7;
|
|
10
|
+
$pmry_800: #021567;
|
|
11
|
+
$pmry_900: #010F55;
|
|
12
|
+
|
|
13
|
+
// SECONDARY_COLORS ---------------------
|
|
14
|
+
$sec_d_purple: #40447F;
|
|
15
|
+
$sec_maroon: #6B034E;
|
|
16
|
+
$sec_mud_red: #B23600;
|
|
17
|
+
$sec_orange: #ED711C;
|
|
18
|
+
$sec_purple: #815FD5;
|
|
19
|
+
$sec_teal: #10ADAE;
|
|
20
|
+
$sec_yellow: #D4900C;
|
|
21
|
+
$sec_green: #547F40;
|
|
22
|
+
$sec_bright_green: #27D22E;
|
|
23
|
+
$sec_dark_teal: #035F6B;
|
|
24
|
+
$sec_chocolate: #7C2F33;
|
|
25
|
+
$sec_rube_pink: #C13D6D;
|
|
26
|
+
$sec_cerulean: #0087B2;
|
|
27
|
+
|
|
28
|
+
//SEMANTIC COLORS --------------------------
|
|
29
|
+
$sem_error: #B00020;
|
|
30
|
+
$sem_info: #0091FF;
|
|
31
|
+
$sem_warning: #FF9D00;
|
|
32
|
+
$sem_success: #38AF49;
|
|
33
|
+
|
|
34
|
+
//grey -------------------------------------
|
|
35
|
+
$grey_bg-1: #FAFAFA;
|
|
36
|
+
$grey_bg: #F5F5F5;
|
|
37
|
+
$grey_seperators: #E0E0E0;
|
|
38
|
+
$grey_disabled: #C8CDD3;
|
|
39
|
+
$grey_hover: #F5F7FC;
|
|
40
|
+
$grey_pressed: #E6EBF7;
|
|
41
|
+
$grey_row: #F5F7FC;
|
|
42
|
+
|
|
43
|
+
//decor ------------------------------------
|
|
44
|
+
$dec_light-yellow:#F4E7C3;
|
|
45
|
+
$dec_light-purple:#DACFF9;
|
|
46
|
+
$dec_light-green:#E4F5E9;
|
|
47
|
+
$dec_light-green2:#F1FFF3;
|
|
48
|
+
$dec_light-pink:#FAE1EA;
|
|
49
|
+
$dec_:#F4CBC1;
|
|
50
|
+
$dec_lt-orange:#FAEFED;
|
|
51
|
+
$dec_light-blue:#CFECF9;
|
|
52
|
+
$dec_row-selection:#F1FDF8;
|
|
53
|
+
$dec_row-selection2:#F2FBFF;
|
|
54
|
+
$dec_row-lines:#D3E1E9;
|
|
55
|
+
|
|
56
|
+
//Text -------------------------------------
|
|
57
|
+
$text_white: #FFFFFF;
|
|
58
|
+
$text-disabled: #929DAB;
|
|
59
|
+
$text_muted: #6A737D;
|
|
60
|
+
$text_black: #181F33;
|
|
61
|
+
|
|
62
|
+
//meeting-rooms ----------------------------
|
|
63
|
+
$MR_solid_blue2: #C8D5F6;
|
|
64
|
+
$MR_solid_purple: #C9C3FB;
|
|
65
|
+
$MR_solid_orange: #EEAC9F;
|
|
66
|
+
$MR_solid_green: #ACDADA;
|
|
67
|
+
$MR_solid_brown: #E8C8AF;
|
|
68
|
+
$MR_solid_yellow: #FFEFC7;
|
|
69
|
+
$MR_solid_blue: #BBE6FF;
|
|
70
|
+
$MR_solid_pink: #FFC6F2;
|
|
71
|
+
|
|
72
|
+
//transparency -----------------------------
|
|
73
|
+
$tr_hover: #F0F3FA;
|
|
74
|
+
$tr_pressed: #DAE1F3;
|
|
75
|
+
}
|