mis-crystal-design-system 2.1.2 → 2.2.2
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 +60 -0
- package/async-search-dropdown/async-dropdown.module.d.ts +2 -0
- package/async-search-dropdown/index.d.ts +1 -0
- package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.d.ts +4 -0
- package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.metadata.json +1 -0
- package/async-search-dropdown/package.json +11 -0
- package/async-search-dropdown/public_api.d.ts +2 -0
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js +211 -0
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js.map +1 -0
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js +2 -0
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js.map +1 -0
- package/bundles/mis-crystal-design-system-button.umd.js +60 -2
- package/bundles/mis-crystal-design-system-button.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-button.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-button.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-datepicker.umd.js +3 -1
- package/bundles/mis-crystal-design-system-datepicker.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-datepicker.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-datepicker.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-dropdown.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-dropdown.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-input.umd.js +111 -0
- package/bundles/mis-crystal-design-system-input.umd.js.map +1 -0
- package/bundles/mis-crystal-design-system-input.umd.min.js +2 -0
- package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -0
- package/bundles/mis-crystal-design-system-modal.umd.js +165 -0
- package/bundles/mis-crystal-design-system-modal.umd.js.map +1 -0
- package/bundles/mis-crystal-design-system-modal.umd.min.js +2 -0
- package/bundles/mis-crystal-design-system-modal.umd.min.js.map +1 -0
- package/bundles/mis-crystal-design-system-table.umd.js +35 -49
- package/bundles/mis-crystal-design-system-table.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-table.umd.min.js +2 -2
- package/bundles/mis-crystal-design-system-table.umd.min.js.map +1 -1
- package/button/button.directive.d.ts +12 -0
- package/button/button.directive.scss +69 -0
- package/button/mis-crystal-design-system-button.d.ts +1 -0
- package/button/mis-crystal-design-system-button.metadata.json +1 -1
- package/datepicker/mis-crystal-design-system-datepicker.metadata.json +1 -1
- package/dropdown/mis-crystal-design-system-dropdown.metadata.json +1 -1
- package/esm2015/async-search-dropdown/async-dropdown.component.js +176 -0
- package/esm2015/async-search-dropdown/async-dropdown.module.js +15 -0
- package/esm2015/async-search-dropdown/index.js +2 -0
- package/esm2015/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.js +5 -0
- package/esm2015/async-search-dropdown/public_api.js +3 -0
- package/esm2015/button/button.directive.js +57 -0
- package/esm2015/button/button.module.js +4 -3
- package/esm2015/button/mis-crystal-design-system-button.js +2 -1
- package/esm2015/datepicker/bs-datepicker.module.js +6 -2
- package/esm2015/dropdown/dropdown.component.js +1 -1
- package/esm2015/input/directives/input/input.directive.js +38 -0
- package/esm2015/input/index.js +2 -0
- package/esm2015/input/mis-crystal-design-system-input.js +5 -0
- package/esm2015/input/mis-input.component.js +40 -0
- package/esm2015/input/mis-input.module.js +15 -0
- package/esm2015/input/public_api.js +4 -0
- package/esm2015/modal/index.js +2 -0
- package/esm2015/modal/mis-crystal-design-system-modal.js +6 -0
- package/esm2015/modal/modal-constants.js +4 -0
- package/esm2015/modal/modal-ref.js +16 -0
- package/esm2015/modal/modal.module.js +32 -0
- package/esm2015/modal/modal.service.js +72 -0
- package/esm2015/modal/module-wrapper/module-wrapper.component.js +33 -0
- package/esm2015/modal/public_api.js +5 -0
- package/esm2015/table/custom-table-cell.directive.js +3 -2
- package/esm2015/table/filter/filter.component.js +20 -22
- package/esm2015/table/mis-crystal-design-system-table.js +2 -1
- package/esm2015/table/public_api.js +1 -2
- package/esm2015/table/sub-table/sub-table.component.js +3 -3
- package/esm2015/table/table.component.js +7 -10
- package/esm2015/table/table.module.js +3 -3
- package/fesm2015/mis-crystal-design-system-async-search-dropdown.js +194 -0
- package/fesm2015/mis-crystal-design-system-async-search-dropdown.js.map +1 -0
- package/fesm2015/mis-crystal-design-system-button.js +60 -4
- package/fesm2015/mis-crystal-design-system-button.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-datepicker.js +3 -1
- package/fesm2015/mis-crystal-design-system-datepicker.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-dropdown.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-input.js +94 -0
- package/fesm2015/mis-crystal-design-system-input.js.map +1 -0
- package/fesm2015/mis-crystal-design-system-modal.js +151 -0
- package/fesm2015/mis-crystal-design-system-modal.js.map +1 -0
- package/fesm2015/mis-crystal-design-system-table.js +32 -36
- package/fesm2015/mis-crystal-design-system-table.js.map +1 -1
- package/input/directives/input/input.directive.d.ts +15 -0
- package/input/index.d.ts +1 -0
- package/input/mis-crystal-design-system-input.d.ts +4 -0
- package/input/mis-crystal-design-system-input.metadata.json +1 -0
- package/input/mis-input.component.d.ts +15 -0
- package/input/mis-input.module.d.ts +2 -0
- package/input/package.json +11 -0
- package/input/public_api.d.ts +3 -0
- package/modal/index.d.ts +1 -0
- package/modal/mis-crystal-design-system-modal.d.ts +5 -0
- package/modal/mis-crystal-design-system-modal.metadata.json +1 -0
- package/modal/modal-constants.d.ts +3 -0
- package/modal/modal-ref.d.ts +9 -0
- package/modal/modal.module.d.ts +5 -0
- package/modal/modal.scss +9 -0
- package/modal/modal.service.d.ts +22 -0
- package/modal/module-wrapper/module-wrapper.component.d.ts +9 -0
- package/modal/package.json +11 -0
- package/modal/public_api.d.ts +4 -0
- package/package.json +1 -1
- package/table/filter/filter.component.d.ts +3 -5
- package/table/mis-crystal-design-system-table.d.ts +1 -0
- package/table/mis-crystal-design-system-table.metadata.json +1 -1
- package/table/public_api.d.ts +1 -1
- package/table/sub-table/sub-table.component.d.ts +1 -0
- package/table/table.component.d.ts +2 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-dropdown.js","sources":["../../../projects/mis-components/dropdown/dropdown.component.ts","../../../projects/mis-components/dropdown/dropdown.module.ts","../../../projects/mis-components/dropdown/mis-crystal-design-system-dropdown.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnInit,\n Output\n} from '@angular/core';\n\n@Component({\n selector: 'mis-dropdown',\n templateUrl: './dropdown.component.html',\n styleUrls: ['./dropdown.component.scss']\n})\nexport class DropdownComponent implements OnInit {\n
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-dropdown.js","sources":["../../../projects/mis-components/dropdown/dropdown.component.ts","../../../projects/mis-components/dropdown/dropdown.module.ts","../../../projects/mis-components/dropdown/mis-crystal-design-system-dropdown.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnInit,\n Output\n} from '@angular/core';\n\n@Component({\n selector: 'mis-dropdown',\n templateUrl: './dropdown.component.html',\n styleUrls: ['./dropdown.component.scss']\n})\nexport class DropdownComponent implements OnInit {\n isOpen = false;\n isSearchInputFocused: boolean = false;\n searchInput: string = '';\n searchData: DropdownItem[] = [];\n\n @Input() data: DropdownItem[] = [];\n @Input() height: string = ''\n @Input() width: string = ''\n @Input() label: string = 'Select';\n\n @Input() dropdownListHeight: string = ''\n @Input() dropdownListWidth: string = ''\n @Input() dropdownListPosition: 'Left' | 'Right' = 'Left'\n\n @Input() searchEnabled: boolean = true;\n @Input() selectedItem: DropdownItem = { value: '', label: '' };\n @Input() noDataMessage: string = 'No Data';\n\n @Output() onChange: EventEmitter<any> = new EventEmitter();\n\n constructor(private eRef: ElementRef) { }\n ngOnInit() { }\n\n @HostListener('document:click', ['$event'])\n clickout(event) {\n const isClickedOutside = !this.eRef.nativeElement.contains(event.target);\n if (isClickedOutside) {\n this.onCancel();\n }\n }\n filterByValue(array: DropdownItem[], string: string) {\n return array.filter(o =>\n o.label.toLowerCase().includes(string.toLowerCase())\n );\n }\n searchInputOnChange(newValue) {\n this.searchInput = newValue;\n if (newValue) {\n this.searchData = this.filterByValue(this.data, newValue);\n } else {\n this.searchData = [];\n this.searchInput = '';\n }\n }\n searchInputFocused(isFocused: boolean) {\n this.isSearchInputFocused = isFocused;\n }\n searchInputCanceled(event) {\n event.stopPropagation();\n this.searchInput = '';\n this.isSearchInputFocused = false;\n }\n toggleDropdown() {\n this.isOpen = !this.isOpen;\n }\n selectItem(item) {\n this.onChange.emit(item);\n this.toggleDropdown();\n }\n onCancel() {\n this.isSearchInputFocused = false;\n this.isOpen = false;\n this.searchInput = '';\n }\n}\nexport interface DropdownItem {\n label: string;\n value: string;\n icon?: string\n}\n","import { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { NgModule, ModuleWithProviders } from '@angular/core';\nimport { DropdownComponent } from './dropdown.component';\n\n@NgModule({\n declarations: [DropdownComponent],\n imports: [CommonModule, FormsModule],\n exports: [DropdownComponent]\n})\nexport class DropdownModule {\n static forRoot(): ModuleWithProviders<DropdownModule> {\n return { ngModule: DropdownModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAea,iBAAiB;IAqB1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QApBpC,WAAM,GAAG,KAAK,CAAC;QACf,yBAAoB,GAAY,KAAK,CAAC;QACtC,gBAAW,GAAW,EAAE,CAAC;QACzB,eAAU,GAAmB,EAAE,CAAC;QAEvB,SAAI,GAAmB,EAAE,CAAC;QAC1B,WAAM,GAAW,EAAE,CAAA;QACnB,UAAK,GAAW,EAAE,CAAA;QAClB,UAAK,GAAW,QAAQ,CAAC;QAEzB,uBA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;KACrC;IACD,cAAc;QACV,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;KAC9B;IACD,UAAU,CAAC,IAAI;QACX,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,EAAE,CAAC;KACzB;IACD,QAAQ;QACJ,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;KACzB;;;YArEJ,SAAS,SAAC;gBACP,QAAQ,EAAE,cAAc;gBACxB,soJAAwC;;aAE3C;;;YAZG,UAAU;;;mBAmBT,KAAK;qBACL,KAAK;oBACL,KAAK;oBACL,KAAK;iCAEL,KAAK;gCACL,KAAK;mCACL,KAAK;4BAEL,KAAK;2BACL,KAAK;4BACL,KAAK;uBAEL,MAAM;uBAKN,YAAY,SAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC;;;MC7BjC,cAAc;IACvB,OAAO,OAAO;QACV,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;KACtD;;;YARJ,QAAQ,SAAC;gBACN,YAAY,EAAE,CAAC,iBAAiB,CAAC;gBACjC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;gBACpC,OAAO,EAAE,CAAC,iBAAiB,CAAC;aAC/B;;;ACTD;;;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Directive, ElementRef, Self, Optional, Component, Input, ContentChild, NgModule } from '@angular/core';
|
|
2
|
+
import { NgControl, FormsModule } from '@angular/forms';
|
|
3
|
+
import { ReplaySubject, Subject } from 'rxjs';
|
|
4
|
+
import { takeUntil } from 'rxjs/operators';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
class MisInputDirective {
|
|
8
|
+
constructor(el, control) {
|
|
9
|
+
this.el = el;
|
|
10
|
+
this.control = control;
|
|
11
|
+
this.validityChange = new ReplaySubject(1);
|
|
12
|
+
this.validity = this.validityChange.asObservable();
|
|
13
|
+
this.endObs = new Subject();
|
|
14
|
+
this.focus = false;
|
|
15
|
+
this.hasValue = false;
|
|
16
|
+
}
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
(_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.control) === null || _b === void 0 ? void 0 : _b.statusChanges.pipe(takeUntil(this.endObs)).subscribe(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
this.validityChange.next((_a = this.control.control) === null || _a === void 0 ? void 0 : _a.valid);
|
|
22
|
+
});
|
|
23
|
+
this.el.nativeElement.placeholder += ' ';
|
|
24
|
+
}
|
|
25
|
+
ngOnDestroy() {
|
|
26
|
+
this.endObs.next();
|
|
27
|
+
this.endObs.complete();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
MisInputDirective.decorators = [
|
|
31
|
+
{ type: Directive, args: [{
|
|
32
|
+
// tslint:disable-next-line
|
|
33
|
+
selector: 'input[misInput]',
|
|
34
|
+
},] }
|
|
35
|
+
];
|
|
36
|
+
MisInputDirective.ctorParameters = () => [
|
|
37
|
+
{ type: ElementRef },
|
|
38
|
+
{ type: NgControl, decorators: [{ type: Self }, { type: Optional }] }
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
class MisInputComponent {
|
|
42
|
+
constructor() {
|
|
43
|
+
this.type = 'floating';
|
|
44
|
+
this.noHints = false;
|
|
45
|
+
this.hasError = false; // show input in error state
|
|
46
|
+
this.inputValidity = true;
|
|
47
|
+
}
|
|
48
|
+
set formInput(input) {
|
|
49
|
+
var _a;
|
|
50
|
+
if (!this.placeholder) {
|
|
51
|
+
this.placeholder = input.el.nativeElement.placeholder;
|
|
52
|
+
}
|
|
53
|
+
(_a = this.inputSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
54
|
+
this.inputSubscription = input === null || input === void 0 ? void 0 : input.validity.subscribe((res) => (this.inputValidity = res));
|
|
55
|
+
this.placeholder += ' ';
|
|
56
|
+
}
|
|
57
|
+
ngOnInit() { }
|
|
58
|
+
ngOnDestroy() {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = this.inputSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
MisInputComponent.decorators = [
|
|
64
|
+
{ type: Component, args: [{
|
|
65
|
+
selector: 'mis-input',
|
|
66
|
+
template: "<div class=\"input-container\" [ngClass]=\"{'rounded': type === 'rounded', 'floating': type === 'floating', 'has-error': !inputValidity || hasError, 'no-hint': noHints}\">\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{placeholder}}</span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>",
|
|
67
|
+
styles: [".input-container{position:relative;padding-bottom:24px}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px}.input-container .input-wrapper>:not(:last-child){margin-right:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0}.input-container.rounded .input-wrapper:focus-within,.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]
|
|
68
|
+
},] }
|
|
69
|
+
];
|
|
70
|
+
MisInputComponent.ctorParameters = () => [];
|
|
71
|
+
MisInputComponent.propDecorators = {
|
|
72
|
+
type: [{ type: Input }],
|
|
73
|
+
placeholder: [{ type: Input }],
|
|
74
|
+
noHints: [{ type: Input }],
|
|
75
|
+
hasError: [{ type: Input }],
|
|
76
|
+
formInput: [{ type: ContentChild, args: [MisInputDirective,] }]
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
class MisInputModule {
|
|
80
|
+
}
|
|
81
|
+
MisInputModule.decorators = [
|
|
82
|
+
{ type: NgModule, args: [{
|
|
83
|
+
declarations: [MisInputComponent, MisInputDirective],
|
|
84
|
+
imports: [CommonModule, FormsModule],
|
|
85
|
+
exports: [MisInputComponent, MisInputDirective],
|
|
86
|
+
},] }
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Generated bundle index. Do not edit.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
export { MisInputComponent, MisInputDirective, MisInputModule };
|
|
94
|
+
//# sourceMappingURL=mis-crystal-design-system-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-input.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import {\n Directive,\n ElementRef,\n OnDestroy,\n OnInit,\n Optional,\n Self,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { ReplaySubject, Subject, Subscription } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\n@Directive({\n // tslint:disable-next-line\n selector: 'input[misInput]',\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(\n public el: ElementRef,\n @Self() @Optional() private control: NgControl\n ) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.statusChanges\n .pipe(takeUntil(this.endObs))\n .subscribe(() => {\n this.validityChange.next(this.control.control?.valid);\n });\n this.el.nativeElement.placeholder += ' ';\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import {\n Component,\n ContentChild,\n Input,\n OnDestroy,\n OnInit,\n ViewEncapsulation,\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { MisInputDirective } from './directives/input/input.directive';\n\n@Component({\n selector: 'mis-input',\n templateUrl: './mis-input.component.html',\n styleUrls: ['./mis-input.component.scss'],\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: 'rounded' | 'floating' = 'floating';\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input.el.nativeElement.placeholder;\n }\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(\n (res) => (this.inputValidity = res)\n );\n this.placeholder += ' ';\n }\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MisInputDirective } from './directives/input/input.directive';\nimport { MisInputComponent } from './mis-input.component';\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective],\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAgBa,iBAAiB;IAC5B,YACS,EAAc,EACO,OAAkB;QADvC,OAAE,GAAF,EAAE,CAAY;QACO,YAAO,GAAP,OAAO,CAAW;QAExC,mBAAc,GAA2B,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;QAC9C,WAAM,GAAkB,IAAI,OAAO,EAAE,CAAC;QACtC,UAAK,GAAG,KAAK,CAAC;QACd,aAAQ,GAAG,KAAK,CAAC;KALb;IAOJ,QAAQ;;QACN,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,aAAa,CACjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3B,SAAS,CAAC;;YACT,IAAI,CAAC,cAAc,CAAC,IAAI,OAAC,IAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,KAAK,CAAC,CAAC;SACvD,EAAE;QACL,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,IAAI,GAAG,CAAC;KAC1C;IACD,WAAW;QACT,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KACxB;;;YA1BF,SAAS,SAAC;;gBAET,QAAQ,EAAE,iBAAiB;aAC5B;;;YAbC,UAAU;YAMH,SAAS,uBAWb,IAAI,YAAI,QAAQ;;;MCHR,iBAAiB;IAiB5B;QAhBS,SAAI,GAA2B,UAAU,CAAC;QAE1C,YAAO,GAAG,KAAK,CAAC;QAChB,aAAQ,GAAG,KAAK,CAAC;QAY1B,kBAAa,GAAY,IAAI,CAAC;KACd;IAZhB,IAAqC,SAAS,CAAC,KAAwB;;QACrE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC;SACvD;QACD,MAAA,IAAI,CAAC,iBAAiB,0CAAE,WAAW,GAAG;QACtC,IAAI,CAAC,iBAAiB,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC,SAAS,CAChD,CAAC,GAAG,MAAM,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,CACpC,CAAC;QACF,IAAI,CAAC,WAAW,IAAI,GAAG,CAAC;KACzB;IAKD,QAAQ,MAAW;IACnB,WAAW;;QACT,MAAA,IAAI,CAAC,iBAAiB,0CAAE,WAAW,GAAG;KACvC;;;YA3BF,SAAS,SAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,6mBAAyC;;aAE1C;;;;mBAEE,KAAK;0BACL,KAAK;sBACL,KAAK;uBACL,KAAK;wBACL,YAAY,SAAC,iBAAiB;;;MCVpB,cAAc;;;YAL1B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;gBACpD,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;gBACpC,OAAO,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;aAChD;;;ACVD;;;;;;"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
2
|
+
import { ComponentPortal, PortalInjector, PortalModule } from '@angular/cdk/portal';
|
|
3
|
+
import { InjectionToken, Component, ViewChild, ViewContainerRef, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Injectable, Injector, NgModule } from '@angular/core';
|
|
4
|
+
import { Subject } from 'rxjs';
|
|
5
|
+
import { trigger, transition, style, animate } from '@angular/animations';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
/** @format */
|
|
9
|
+
const MODAL_DATA_VAR = new InjectionToken("MISModalDataInjectionToken");
|
|
10
|
+
|
|
11
|
+
/** @format */
|
|
12
|
+
class ModalRef {
|
|
13
|
+
constructor(overlay) {
|
|
14
|
+
this.overlay = overlay;
|
|
15
|
+
this.afterClosed$ = new Subject();
|
|
16
|
+
this.afterClosed = this.afterClosed$.asObservable();
|
|
17
|
+
}
|
|
18
|
+
close(data) {
|
|
19
|
+
this.overlay.detach();
|
|
20
|
+
this.overlay.dispose();
|
|
21
|
+
this.afterClosed$.next(data);
|
|
22
|
+
this.afterClosed$.complete();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class ModuleWrapperComponent {
|
|
27
|
+
constructor() { }
|
|
28
|
+
bindComponent(type, injector) {
|
|
29
|
+
this.initComponent(type, injector);
|
|
30
|
+
}
|
|
31
|
+
initComponent(type, injector) {
|
|
32
|
+
this.modalPortal = new ComponentPortal(type, this.place, injector);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
ModuleWrapperComponent.decorators = [
|
|
36
|
+
{ type: Component, args: [{
|
|
37
|
+
selector: "mis-module-wrapper",
|
|
38
|
+
template: "<div class=\"mis-modal-body\" #place @slideInOut>\n <ng-template [cdkPortalOutlet]=\"modalPortal\"></ng-template>\n</div>\n",
|
|
39
|
+
animations: [
|
|
40
|
+
trigger("slideInOut", [
|
|
41
|
+
transition(":enter", [
|
|
42
|
+
style({ transform: "translateY(-30%)", opacity: 0 }),
|
|
43
|
+
animate("200ms ease-out", style({ transform: "translatey(0%)", opacity: 1 })),
|
|
44
|
+
]),
|
|
45
|
+
transition(":leave", [animate("200ms ease-out", style({ transform: "translatey(-30%)", opacity: 0 }))]),
|
|
46
|
+
]),
|
|
47
|
+
],
|
|
48
|
+
styles: [".mis-modal-body{display:block;width:100%;height:100%;background-color:transparent;border-radius:12px;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);overflow:hidden}"]
|
|
49
|
+
},] }
|
|
50
|
+
];
|
|
51
|
+
ModuleWrapperComponent.ctorParameters = () => [];
|
|
52
|
+
ModuleWrapperComponent.propDecorators = {
|
|
53
|
+
place: [{ type: ViewChild, args: ["place", { static: false, read: ViewContainerRef },] }]
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
class ModalService {
|
|
57
|
+
constructor(overlay, injector) {
|
|
58
|
+
this.overlay = overlay;
|
|
59
|
+
this.injector = injector;
|
|
60
|
+
}
|
|
61
|
+
show(component, data, options) {
|
|
62
|
+
const positionStrategy = this.calculatePosition(options);
|
|
63
|
+
const { width, height } = options || {};
|
|
64
|
+
const config = new OverlayConfig({
|
|
65
|
+
hasBackdrop: true,
|
|
66
|
+
positionStrategy,
|
|
67
|
+
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
68
|
+
width: width,
|
|
69
|
+
height,
|
|
70
|
+
panelClass: "mis-modal",
|
|
71
|
+
backdropClass: "mis-modal-overlay",
|
|
72
|
+
});
|
|
73
|
+
const overlayRef = this.overlay.create(config);
|
|
74
|
+
const modalRef = new ModalRef(overlayRef);
|
|
75
|
+
const injector = this.createInjector(modalRef, this.injector, data);
|
|
76
|
+
const portal = new ComponentPortal(ModuleWrapperComponent, null);
|
|
77
|
+
this.componentInstance = overlayRef.attach(portal);
|
|
78
|
+
if (options === null || options === void 0 ? void 0 : options.closeOnBackdropClick) {
|
|
79
|
+
overlayRef.backdropClick().subscribe(() => modalRef.close());
|
|
80
|
+
}
|
|
81
|
+
this.componentInstance.instance.bindComponent(component, injector);
|
|
82
|
+
return modalRef;
|
|
83
|
+
}
|
|
84
|
+
createInjector(ref, inj, data) {
|
|
85
|
+
const injectorTokens = new WeakMap();
|
|
86
|
+
injectorTokens.set(ModalRef, ref);
|
|
87
|
+
injectorTokens.set(MODAL_DATA_VAR, data);
|
|
88
|
+
return new PortalInjector(inj, injectorTokens);
|
|
89
|
+
}
|
|
90
|
+
calculatePosition(options) {
|
|
91
|
+
const position = this.overlay.position().global().centerHorizontally().centerVertically();
|
|
92
|
+
if (options && screen.width > 600) {
|
|
93
|
+
if (options.top) {
|
|
94
|
+
position.top(options.top);
|
|
95
|
+
}
|
|
96
|
+
if (options.left) {
|
|
97
|
+
position.left(options.left);
|
|
98
|
+
}
|
|
99
|
+
if (options.right) {
|
|
100
|
+
position.right(options.right);
|
|
101
|
+
}
|
|
102
|
+
if (options.bottom) {
|
|
103
|
+
position.bottom(options.bottom);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return position;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
ModalService.ɵprov = ɵɵdefineInjectable({ factory: function ModalService_Factory() { return new ModalService(ɵɵinject(Overlay), ɵɵinject(INJECTOR)); }, token: ModalService, providedIn: "root" });
|
|
110
|
+
ModalService.decorators = [
|
|
111
|
+
{ type: Injectable, args: [{
|
|
112
|
+
providedIn: "root",
|
|
113
|
+
},] }
|
|
114
|
+
];
|
|
115
|
+
ModalService.ctorParameters = () => [
|
|
116
|
+
{ type: Overlay },
|
|
117
|
+
{ type: Injector }
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
class ModalModule {
|
|
121
|
+
static forRoot() {
|
|
122
|
+
return {
|
|
123
|
+
ngModule: ModalModule,
|
|
124
|
+
providers: [ModalService],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
static forChild() {
|
|
128
|
+
return {
|
|
129
|
+
ngModule: ModalModule,
|
|
130
|
+
providers: [ModalService],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
ModalModule.decorators = [
|
|
135
|
+
{ type: NgModule, args: [{
|
|
136
|
+
declarations: [ModuleWrapperComponent],
|
|
137
|
+
imports: [
|
|
138
|
+
CommonModule,
|
|
139
|
+
OverlayModule,
|
|
140
|
+
PortalModule
|
|
141
|
+
],
|
|
142
|
+
entryComponents: [ModuleWrapperComponent]
|
|
143
|
+
},] }
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Generated bundle index. Do not edit.
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
export { MODAL_DATA_VAR, ModalModule, ModalRef, ModalService, ModuleWrapperComponent as ɵa };
|
|
151
|
+
//# sourceMappingURL=mis-crystal-design-system-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-modal.js","sources":["../../../projects/mis-components/modal/modal-constants.ts","../../../projects/mis-components/modal/modal-ref.ts","../../../projects/mis-components/modal/module-wrapper/module-wrapper.component.ts","../../../projects/mis-components/modal/modal.service.ts","../../../projects/mis-components/modal/modal.module.ts","../../../projects/mis-components/modal/mis-crystal-design-system-modal.ts"],"sourcesContent":["/** @format */\n\nimport { InjectionToken } from \"@angular/core\";\n\nexport const MODAL_DATA_VAR = new InjectionToken<any>(\"MISModalDataInjectionToken\");\n","/** @format */\n\nimport { OverlayRef } from \"@angular/cdk/overlay\";\nimport { Injectable } from \"@angular/core\";\nimport { Subject } from \"rxjs\";\n\nexport class ModalRef {\n private afterClosed$ = new Subject<unknown>();\n afterClosed = this.afterClosed$.asObservable();\n\n constructor(public overlay: OverlayRef) {}\n\n close(data?: unknown): void {\n this.overlay.detach();\n this.overlay.dispose();\n this.afterClosed$.next(data);\n this.afterClosed$.complete();\n }\n}\n","import { trigger, transition, style, animate } from \"@angular/animations\";\nimport { ComponentPortal, PortalInjector } from \"@angular/cdk/portal\";\nimport { Component, Injector, OnInit, ViewChild, ViewContainerRef } from \"@angular/core\";\nimport { ModalRef } from \"../modal-ref\";\n\n@Component({\n selector: \"mis-module-wrapper\",\n templateUrl: \"./module-wrapper.component.html\",\n styleUrls: [\"./module-wrapper.component.scss\"],\n animations: [\n trigger(\"slideInOut\", [\n transition(\":enter\", [\n style({ transform: \"translateY(-30%)\", opacity: 0 }),\n animate(\"200ms ease-out\", style({ transform: \"translatey(0%)\", opacity: 1 })),\n ]),\n transition(\":leave\", [animate(\"200ms ease-out\", style({ transform: \"translatey(-30%)\", opacity: 0 }))]),\n ]),\n ],\n})\nexport class ModuleWrapperComponent {\n modalPortal: ComponentPortal<any>;\n constructor() {}\n\n @ViewChild(\"place\", { static: false, read: ViewContainerRef }) place: ViewContainerRef;\n\n bindComponent(type: any, injector: PortalInjector) {\n this.initComponent(type, injector);\n }\n\n private initComponent(type: any, injector: PortalInjector) {\n this.modalPortal = new ComponentPortal(type, this.place, injector);\n }\n}\n","import { ComponentType, Overlay, OverlayConfig } from \"@angular/cdk/overlay\";\nimport { ComponentPortal, PortalInjector } from \"@angular/cdk/portal\";\nimport { ComponentRef, Injectable, Injector } from \"@angular/core\";\nimport { MODAL_DATA_VAR } from \"./modal-constants\";\nimport { ModalRef } from \"./modal-ref\";\nimport { ModuleWrapperComponent } from \"./module-wrapper/module-wrapper.component\";\n\ninterface IModalOptions {\n width?: string;\n height?: string;\n top?: string;\n right?: string;\n bottom?: string;\n left?: string;\n closeOnBackdropClick?: boolean;\n}\n@Injectable({\n providedIn: \"root\",\n})\nexport class ModalService {\n private componentInstance: ComponentRef<ModuleWrapperComponent>;\n\n constructor(private overlay: Overlay, private injector: Injector) {}\n\n show<T, D>(component: ComponentType<T>, data?: D, options?: IModalOptions): ModalRef {\n const positionStrategy = this.calculatePosition(options);\n const { width, height } = options || {};\n const config = new OverlayConfig({\n hasBackdrop: true,\n positionStrategy,\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n width: width,\n height,\n panelClass: \"mis-modal\",\n backdropClass: \"mis-modal-overlay\",\n });\n const overlayRef = this.overlay.create(config);\n const modalRef = new ModalRef(overlayRef);\n const injector = this.createInjector(modalRef, this.injector, data);\n const portal = new ComponentPortal(ModuleWrapperComponent, null);\n this.componentInstance = overlayRef.attach(portal);\n if (options?.closeOnBackdropClick) {\n overlayRef.backdropClick().subscribe(() => modalRef.close());\n }\n this.componentInstance.instance.bindComponent(component, injector);\n return modalRef;\n }\n private createInjector<D>(ref: ModalRef, inj: Injector, data?: D): PortalInjector {\n const injectorTokens = new WeakMap();\n injectorTokens.set(ModalRef, ref);\n injectorTokens.set(MODAL_DATA_VAR, data);\n return new PortalInjector(inj, injectorTokens);\n }\n\n private calculatePosition(options: IModalOptions) {\n const position = this.overlay.position().global().centerHorizontally().centerVertically();\n if (options && screen.width > 600) {\n if (options.top) {\n position.top(options.top);\n }\n if (options.left) {\n position.left(options.left);\n }\n if (options.right) {\n position.right(options.right);\n }\n if (options.bottom) {\n position.bottom(options.bottom);\n }\n }\n return position;\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport { PortalModule } from '@angular/cdk/portal';\nimport { ModuleWrapperComponent } from './module-wrapper/module-wrapper.component';\nimport { ModalService } from './modal.service';\n\n\n\n@NgModule({\n declarations: [ModuleWrapperComponent],\n imports: [\n CommonModule,\n OverlayModule, \n PortalModule\n ],\n entryComponents: [ModuleWrapperComponent]\n})\nexport class ModalModule { \n static forRoot(): ModuleWithProviders<ModalModule> {\n return {\n ngModule: ModalModule,\n providers: [ModalService],\n };\n }\n\n static forChild(): ModuleWithProviders<ModalModule> {\n return {\n ngModule: ModalModule,\n providers: [ModalService],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {ModuleWrapperComponent as ɵa} from './module-wrapper/module-wrapper.component';"],"names":[],"mappings":";;;;;;;AAAA;MAIa,cAAc,GAAG,IAAI,cAAc,CAAM,4BAA4B;;ACJlF;MAMa,QAAQ;IAInB,YAAmB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QAH9B,iBAAY,GAAG,IAAI,OAAO,EAAW,CAAC;QAC9C,gBAAW,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,E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;YAtBF,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,OAAO,EAAE;oBACP,YAAY;oBACZ,aAAa;oBACb,YAAY;iBACb;gBACD,eAAe,EAAE,CAAC,sBAAsB,CAAC;aAC1C;;;ACjBD;;;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EventEmitter, Component, Renderer2, Output, ViewChild, ViewChildren, Input, Directive, ViewContainerRef, ComponentFactoryResolver, NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormControl } from '@angular/forms';
|
|
4
3
|
import { CheckboxModule } from 'mis-crystal-design-system/checkbox';
|
|
5
|
-
import {
|
|
4
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
6
5
|
|
|
7
6
|
class TableComponent {
|
|
8
7
|
constructor(renderer) {
|
|
@@ -26,6 +25,9 @@ class TableComponent {
|
|
|
26
25
|
if (this.config.paginationConfig) {
|
|
27
26
|
this.initializePagination();
|
|
28
27
|
}
|
|
28
|
+
if (this.config.canScrollHorizontally === undefined) {
|
|
29
|
+
this.config.canScrollHorizontally = false;
|
|
30
|
+
}
|
|
29
31
|
document.addEventListener('click', (event) => {
|
|
30
32
|
if (this.filter) {
|
|
31
33
|
let isCheckBoxClicked = false;
|
|
@@ -64,10 +66,9 @@ class TableComponent {
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
toggleFilter(filterName
|
|
69
|
+
toggleFilter(filterName) {
|
|
68
70
|
if (!this.showFilter) {
|
|
69
71
|
this.filterName = filterName;
|
|
70
|
-
this.filterData = [...filterData];
|
|
71
72
|
this.showFilter = true;
|
|
72
73
|
let offSet = 0;
|
|
73
74
|
let colHeadersReversed = this.colHeaders.toArray().reverse();
|
|
@@ -87,11 +88,6 @@ class TableComponent {
|
|
|
87
88
|
this.showFilter = false;
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
getAppliedFilters(filterName) {
|
|
91
|
-
if (this.appliedFilters[filterName])
|
|
92
|
-
return [...this.appliedFilters[filterName]];
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
95
91
|
updateAppliedFilters(appliedFilters) {
|
|
96
92
|
if (appliedFilters.length == 0) {
|
|
97
93
|
delete this.appliedFilters[this.filterName];
|
|
@@ -176,8 +172,8 @@ class TableComponent {
|
|
|
176
172
|
TableComponent.decorators = [
|
|
177
173
|
{ type: Component, args: [{
|
|
178
174
|
selector: 'mis-table',
|
|
179
|
-
template: "<div\n [ngStyle]=\"{\n height: getContainerHeight(),\n width: getContainerWidth()\n }\"\n id=\"main-container\"\n>\n <mis-table-filter\n #filter\n (filtersApplied)=\"updateAppliedFilters($event)\"\n *ngIf=\"showFilter\"\n [containerStyles]=\"filterContainerStyles\"\n [filtersData]=\"filterData\"\n
|
|
180
|
-
styles: ["#main-container{font-family:Lato,sans-serif;position:relative}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#9aa7b4
|
|
175
|
+
template: "<div\n [ngStyle]=\"{\n height: getContainerHeight(),\n width: getContainerWidth(),\n 'overflow-x': config.canScrollHorizontally ? 'auto' : 'unset'\n }\"\n id=\"main-container\"\n>\n <mis-table-filter\n #filter\n (filtersApplied)=\"updateAppliedFilters($event)\"\n *ngIf=\"showFilter\"\n [containerStyles]=\"filterContainerStyles\"\n [filtersData]=\"filterData\"\n ></mis-table-filter>\n <div #table id=\"table-container\" [ngClass]=\"{ 'scrollbar': expandedIndex < 0, 'no-scrollbar': !(expandedIndex < 0), 'scroll-horizontally': config.canScrollHorizontally }\">\n <div\n [ngStyle]=\"{\n 'min-height': getColHeadersRowHeight(),\n 'border-top': getColHeadersRowBorderTop(),\n 'border-bottom': getColHeadersRowBorderBottom()\n }\"\n id=\"col-headers-container\"\n >\n <div\n #colHeader\n (click)=\"colHeader?.action ? colHeader?.action(colHeader) : null\"\n *ngFor=\"let colHeader of config?.colHeaderConfig\"\n class=\"col-header\"\n [style]=\"colHeader?.style\"\n [ngStyle]=\"{\n width: colHeader?.style?.width || '',\n cursor: colHeader.action ? 'pointer' : 'default',\n 'justify-content': colHeader?.style?.justifyContent ? colHeader?.style?.justifyContent :\n colHeader.type === 'number'\n ? 'flex-end'\n : 'space-between'\n }\">\n <p *ngIf=\"colHeader?.type !== 'custom'\" class=\"col-header-text\">\n {{ colHeader?.data || \" \" }}\n </p>\n <span\n (click)=\"\n filterData = colHeader.filters;\n toggleFilter(colHeader.data);\n $event.stopPropagation()\n \"\n *ngIf=\"\n colHeader?.type !== 'custom' &&\n colHeader?.filters &&\n colHeader?.filters?.length > 0\n \"\n class=\"filter-icon\"\n >\n <span *ngIf=\"appliedFilters[colHeader.data]?.length > 0\" id=\"filter-active\"></span>\n <svg\n fill=\"none\"\n height=\"10\"\n viewBox=\"0 0 13 10\"\n width=\"13\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clip-rule=\"evenodd\"\n d=\"M4.97546 10H7.64213V8H4.97546V10ZM0.308472 0V2H12.3085V0H0.308472ZM2.30847 6H10.3085V4H2.30847V6Z\"\n fill=\"#181F33\"\n fill-rule=\"evenodd\"\n />\n </svg>\n </span>\n <ng-template\n *ngIf=\"colHeader?.type === 'custom'\"\n [customComponent]=\"colHeader?.componentRef\"\n [data]=\"colHeader.data\"\n customTableCell\n ></ng-template>\n </div>\n </div>\n <div id=\"data-container\">\n <div class=\"row-wrapper\" *ngFor=\"let row of tableData; let i = index\">\n <div class=\"t-row\" [ngStyle]=\"{'min-height': (config?.rowConfig?.height) ? config.rowConfig.height: '44px'}\">\n <div\n (click)=\"\n config?.colConfig[i]?.action\n ? config?.colConfig[i]?.action(col)\n : null\n \"\n *ngFor=\"let col of row; let i = index\"\n [ngStyle]=\"{\n width: config?.colConfig[i]?.style?.width || config?.colHeaderConfig[i]?.style?.width || ''\n }\"\n class=\"t-col-container\"\n >\n <div\n class=\"t-col\"\n [style]=\"config.colConfig[i]?.style\"\n [ngStyle]=\"{\n width: '100%',\n cursor: config.colConfig[i].action ? 'pointer' : 'default',\n 'justify-content': config.colConfig[i]?.style?.justifyContent ? config.colConfig[i]?.style?.justifyContent :\n config.colConfig[i].type === 'number'\n ? 'flex-end'\n : 'space-between'\n }\">\n <p\n *ngIf=\"config.colConfig[i].type !== 'custom'\"\n [ngStyle]=\"{\n color: config?.colConfig[i]?.style?.color\n ? config?.colConfig[i]?.style?.color\n : ''\n }\"\n class=\"t-col-text\"\n >\n {{ col }}\n </p>\n <ng-template\n *ngIf=\"config.colConfig[i].type === 'custom'\"\n [customComponent]=\"config.colConfig[i].componentRef\"\n [data]=\"col\"\n customTableCell\n ></ng-template>\n </div>\n </div>\n </div>\n <div *ngIf=\"config?.canExpand && expandedIndex === i\" class=\"sub-row\">\n <ng-container *ngIf=\"subTableDataLoading\">\n <div\n style=\"\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px;\n \"\n >\n Loading...\n </div>\n </ng-container>\n <ng-container *ngIf=\"!subTableDataLoading && subTableData.length === 0\">\n <div\n style=\"\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px;\n \"\n >\n No Data Available...\n </div>\n </ng-container>\n <ng-container *ngIf=\"!subTableDataLoading && subTableData.length > 0\">\n <sub-table [config]=\"subTableconfig\" [tableData]=\"subTableData\"></sub-table>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"config?.paginationConfig\" id=\"pagination-container\">\n <p id=\"pagination-text\">\n Showing\n {{ (selectedPage - 1) * config.paginationConfig.rowsPerPage + 1 }}-{{\n (selectedPage - 1) * config.paginationConfig.rowsPerPage +\n tableData.length\n }}\n of {{ config.paginationConfig.totalNoOfRows }} items\n </p>\n <div id=\"pages-container\">\n <span (click)=\"updateSelectedPage(selectedPage - 1)\" class=\"page\">\n <svg\n fill=\"none\"\n height=\"10\"\n viewBox=\"0 0 7 10\"\n width=\"7\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clip-rule=\"evenodd\"\n d=\"M0.857405 5.56295C0.855794 5.56139 0.854188 5.55982 0.852588 5.55824C0.695955 5.40408 0.617641 5.20203 0.617647 4.99998C0.617641 4.79793 0.695955 4.59588 0.852588 4.44172C0.854188 4.44014 0.855794 4.43858 0.857404 4.43702L5.13066 0.231231C5.44392 -0.0770771 5.9518 -0.0770771 6.26506 0.231231C6.57831 0.53954 6.57831 1.03941 6.26506 1.34772L2.5542 4.99998L6.26506 8.65225C6.57831 8.96055 6.57831 9.46042 6.26506 9.76873C5.9518 10.077 5.44392 10.077 5.13066 9.76873L0.857405 5.56295Z\"\n fill=\"#181F33\"\n fill-rule=\"evenodd\"\n />\n </svg>\n </span>\n <div *ngFor=\"let pageNumber of pages\">\n <span\n (click)=\"updateSelectedPage(pageNumber)\"\n *ngIf=\"pageNumber != 0\"\n [ngClass]=\"{ 'page-active': pageNumber == selectedPage }\"\n class=\"page\"\n >{{ pageNumber }}</span\n >\n <span *ngIf=\"pageNumber == 0\" class=\"page-seperator\">\n <div style=\"display: flex\">\n <span class=\"dot\" style=\"margin-right: 4px\"></span>\n <span class=\"dot\" style=\"margin-right: 4px\"></span>\n <span class=\"dot\"></span>\n </div>\n </span>\n </div>\n <span (click)=\"updateSelectedPage(selectedPage + 1)\" class=\"page\">\n <svg\n fill=\"none\"\n height=\"10\"\n viewBox=\"0 0 7 10\"\n width=\"7\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clip-rule=\"evenodd\"\n d=\"M6.1426 5.56295C6.14421 5.56139 6.14581 5.55982 6.14741 5.55824C6.30405 5.40408 6.38236 5.20203 6.38236 4.99998C6.38236 4.79793 6.30405 4.59588 6.14741 4.44172C6.14581 4.44014 6.14421 4.43858 6.1426 4.43702L1.86934 0.231231C1.55608 -0.0770771 1.0482 -0.0770771 0.734942 0.231231C0.421688 0.53954 0.421688 1.03941 0.734942 1.34772L4.4458 4.99998L0.734941 8.65225C0.421686 8.96055 0.421686 9.46042 0.734941 9.76873C1.0482 10.077 1.55608 10.077 1.86934 9.76873L6.1426 5.56295Z\"\n fill=\"#181F33\"\n fill-rule=\"evenodd\"\n />\n </svg>\n </span>\n </div>\n </div>\n</div>\n",
|
|
176
|
+
styles: ["#main-container{font-family:Lato,sans-serif;position:relative}.no-scrollbar::-webkit-scrollbar{width:0}.scrollbar::-webkit-scrollbar{width:8px;height:8px}.scrollbar::-webkit-scrollbar-thumb{background:#9aa7b4}#table-container{height:inherit;overflow-y:auto}.scroll-horizontally{height:inherit;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;overflow-y:unset!important;overflow-x:visible}#col-headers-container{display:flex;align-items:center;position:-webkit-sticky;position:sticky;background-color:#fff;width:100%;z-index:1;min-height:44px;border-bottom:1px solid #e0e0e0;top:0;left:0;right:0}.col-header{padding:0 16px;height:100%}.col-header,.col-header-text{display:flex;align-items:center}.col-header-text{font-style:normal;font-weight:700;font-size:14px;line-height:20px;letter-spacing:.2px;margin:0}.filter-icon{margin-left:8px;padding:0 8px;position:relative;cursor:pointer}#filter-active{height:8px;width:8px;background:#16cbbc;border-radius:50%;position:absolute;top:4px;right:4px}.sub-row{height:auto;border-bottom:none}.loader ::ng-deep .mat-progress-spinner circle,.mat-spinner circle{stroke:#0937b2}.t-row{display:flex;align-items:center;min-height:44px;background-color:#fff;width:100%;border-bottom:1px solid #e0e0e0}.t-row:hover{background-color:#f1fdf8}.t-col-container{padding:0 16px;height:100%}.t-col{height:100%}.t-col,.t-col-text{display:flex;align-items:center}.t-col-text{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;margin:0}#pagination-container{display:flex;justify-content:flex-end;align-items:center;height:56px}#pagination-text{font-style:normal;font-weight:400;font-size:12px;line-height:18px;letter-spacing:.4px;color:#6a737d;margin:0 96px 0 0}#pages-container{display:flex;margin-right:32px}.page{border:1px solid #6a737d;box-sizing:border-box;border-radius:4px;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d;cursor:pointer}.page,.page-seperator{display:flex;justify-content:center;align-items:center;width:32px;height:32px;margin-right:8px}.dot{height:3px;width:3px;border-radius:50%;background:#6a737d}.page-active{color:#0937b2;border:1px solid #0937b2}"]
|
|
181
177
|
},] }
|
|
182
178
|
];
|
|
183
179
|
TableComponent.ctorParameters = () => [
|
|
@@ -209,8 +205,9 @@ class CustomTableCellDirective {
|
|
|
209
205
|
}
|
|
210
206
|
set data(value) {
|
|
211
207
|
this.cellData = value;
|
|
212
|
-
if (this.ref)
|
|
208
|
+
if (this.ref) {
|
|
213
209
|
this.ref.instance.data = this.cellData;
|
|
210
|
+
}
|
|
214
211
|
}
|
|
215
212
|
createComponent() {
|
|
216
213
|
if (this.component) {
|
|
@@ -294,8 +291,8 @@ class SubTableComponent {
|
|
|
294
291
|
SubTableComponent.decorators = [
|
|
295
292
|
{ type: Component, args: [{
|
|
296
293
|
selector: 'sub-table',
|
|
297
|
-
template: "<div\n id=\"main-container\"\n [ngStyle]=\"{\n height: getContainerHeight(),\n width: getContainerWidth()\n }\"\n>\n <div id=\"table-container\" #table>\n <div\n id=\"col-headers-container\"\n *ngIf=\"!!config.showHeader\"\n [ngStyle]=\"{\n height: getColHeadersRowHeight(),\n 'border-top': getColHeadersRowBorderTop(),\n 'border-bottom': getColHeadersRowBorderBottom()\n }\"\n >\n <div\n
|
|
298
|
-
styles: ["#main-container{font-family:Lato,sans-serif}#table-container{height:inherit}#col-headers-container{display:flex;background-color:#fff;height:36px;border-bottom:1px solid #e0e0e0}.col-header{height:100%;width:160px;padding:0 16px}.col-header,.col-header-text{display:flex;align-items:center}.col-header-text{font-style:normal;font-weight:700;font-size:14px;line-height:20px;letter-spacing:.25px;margin:0}.t-row{display:flex;align-items:center;
|
|
294
|
+
template: "<div\n id=\"main-container\"\n [ngStyle]=\"{\n height: getContainerHeight(),\n width: getContainerWidth()\n }\"\n>\n <div id=\"table-container\" #table>\n <div\n id=\"col-headers-container\"\n *ngIf=\"!!config.showHeader\"\n [ngStyle]=\"{\n height: getColHeadersRowHeight(),\n 'border-top': getColHeadersRowBorderTop(),\n 'border-bottom': getColHeadersRowBorderBottom()\n }\"\n >\n <div\n class=\"col-header\"\n (click)=\"colHeader?.action ? colHeader?.action(colHeader) : null\"\n *ngFor=\"let colHeader of config?.colHeaderConfig\"\n [style]=\"colHeader?.style\"\n [ngStyle]=\"{\n width: colHeader?.style?.width || '',\n cursor: colHeader.action ? 'pointer' : 'default',\n 'justify-content': colHeader?.style?.justifyContent ? colHeader?.style?.justifyContent :\n colHeader.type === 'number'\n ? 'flex-end'\n : 'space-between'\n }\">\n <p *ngIf=\"colHeader?.type !== 'custom'\" class=\"col-header-text\">\n {{ colHeader?.data || \" \" }}\n </p>\n <ng-template\n *ngIf=\"colHeader?.type === 'custom'\"\n customTableCell\n [customComponent]=\"colHeader?.componentRef\"\n [data]=\"colHeader.data\"\n ></ng-template>\n </div>\n </div>\n <div>\n <cdk-virtual-scroll-viewport [minBufferPx]=\"config.dataContainerMaxHeight || '400'\" [maxBufferPx]=\"config.dataContainerMaxHeight + 200 || '600'\" [style.overflow]=\"'overlay'\" [style.height]=\"config.dataContainerMaxHeight || '400px'\" itemSize=\"50\" id=\"data-container\">\n <div\n class=\"row-wrapper\"\n *cdkVirtualFor=\"let row of tableData; let i = index\"\n [ngStyle]=\"{\n backgroundColor: i % 2 === 0 ? '#FAFAFA' : null\n }\"\n >\n <div class=\"t-row\">\n <div\n (click)=\"\n config?.colConfig[i]?.action\n ? config?.colConfig[i]?.action(col)\n : null\n \"\n *ngFor=\"let col of row; let i = index\"\n [ngStyle]=\"{\n width: config?.colConfig[i]?.style?.width || config?.colHeaderConfig[i]?.style?.width || ''\n }\"\n class=\"t-col-container\"\n >\n <div\n class=\"t-col\"\n [style]=\"config.colConfig[i]?.style\"\n [ngStyle]=\"{\n width: '100%',\n cursor: config.colConfig[i].action ? 'pointer' : 'default',\n 'justify-content': config.colConfig[i]?.style?.justifyContent ? config.colConfig[i]?.style?.justifyContent :\n config.colConfig[i].type === 'number'\n ? 'flex-end'\n : 'space-between'\n }\">\n <p\n *ngIf=\"config.colConfig[i].type !== 'custom'\"\n [ngStyle]=\"{\n color: config?.colConfig[i]?.style?.color\n ? config?.colConfig[i]?.style?.color\n : ''\n }\"\n class=\"t-col-text\"\n >\n {{ col }}\n </p>\n <ng-template\n *ngIf=\"config.colConfig[i].type === 'custom'\"\n [customComponent]=\"config.colConfig[i].componentRef\"\n [data]=\"col\"\n customTableCell\n ></ng-template>\n </div>\n </div>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n </div>\n </div>\n</div>\n",
|
|
295
|
+
styles: ["#main-container{font-family:Lato,sans-serif}#table-container{height:inherit}#col-headers-container{display:flex;background-color:#fff;height:36px;border-bottom:1px solid #e0e0e0}#data-container{overflow:scroll;width:100%}#data-container::-webkit-scrollbar{width:8px}#data-container::-webkit-scrollbar-thumb{background:#9aa7b4}.col-header{height:100%;width:160px;padding:0 16px}.col-header,.col-header-text{display:flex;align-items:center}.col-header-text{font-style:normal;font-weight:700;font-size:14px;line-height:20px;letter-spacing:.25px;margin:0}.t-row{display:flex;align-items:center;height:36px;width:100%;border-bottom:1px solid #e0e0e0}.t-row:hover{background-color:#f1fdf8}.t-col-container{padding:0 16px;height:100%}.t-col{height:100%}.t-col,.t-col-text{display:flex;align-items:center}.t-col-text{font-style:normal;font-weight:400;font-size:14px;line-height:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;letter-spacing:.2px;margin:0}"]
|
|
299
296
|
},] }
|
|
300
297
|
];
|
|
301
298
|
SubTableComponent.ctorParameters = () => [
|
|
@@ -315,30 +312,18 @@ class TableFilterComponent {
|
|
|
315
312
|
this.filtersMap = {};
|
|
316
313
|
this.searchValue = '';
|
|
317
314
|
this.mySort = (a, b) => {
|
|
318
|
-
if (a.
|
|
315
|
+
if (a.name < b.name)
|
|
319
316
|
return -1;
|
|
320
|
-
else if (
|
|
317
|
+
else if (b.name < a.name)
|
|
321
318
|
return 1;
|
|
322
|
-
else
|
|
323
|
-
|
|
324
|
-
return -1;
|
|
325
|
-
else if (b.name < a.name)
|
|
326
|
-
return 1;
|
|
327
|
-
else
|
|
328
|
-
return 0;
|
|
329
|
-
}
|
|
319
|
+
else
|
|
320
|
+
return 0;
|
|
330
321
|
};
|
|
331
322
|
}
|
|
332
323
|
ngOnInit() {
|
|
333
324
|
this.filtersData.forEach((filter) => {
|
|
334
|
-
filter.checked = false;
|
|
335
|
-
filter['formControl'] = new FormControl(false);
|
|
336
325
|
this.filtersMap[filter.value] = filter;
|
|
337
326
|
});
|
|
338
|
-
for (let filter of this.appliedFilters) {
|
|
339
|
-
this.filtersMap[filter.value].checked = true;
|
|
340
|
-
this.filtersMap[filter.value].formControl.setValue(true);
|
|
341
|
-
}
|
|
342
327
|
}
|
|
343
328
|
resetFilters() {
|
|
344
329
|
this.filtersData.forEach((filter) => {
|
|
@@ -348,7 +333,7 @@ class TableFilterComponent {
|
|
|
348
333
|
}
|
|
349
334
|
applyFilters() {
|
|
350
335
|
let list = Object.values(this.filtersMap)
|
|
351
|
-
.filter((filter) => filter.
|
|
336
|
+
.filter((filter) => filter.checked)
|
|
352
337
|
.map((filter) => {
|
|
353
338
|
return {
|
|
354
339
|
name: filter.name,
|
|
@@ -360,6 +345,11 @@ class TableFilterComponent {
|
|
|
360
345
|
updateSearchValue(event) {
|
|
361
346
|
this.searchValue = event.target.value;
|
|
362
347
|
}
|
|
348
|
+
updateFilter(data) {
|
|
349
|
+
if (this.filtersMap[data.name]) {
|
|
350
|
+
this.filtersMap[data.name].checked = !this.filtersMap[data.name].checked;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
363
353
|
getFiltersBasedOnSearchValue() {
|
|
364
354
|
let list = Object.values(this.filtersMap);
|
|
365
355
|
list = list.filter((filter) => {
|
|
@@ -367,18 +357,24 @@ class TableFilterComponent {
|
|
|
367
357
|
});
|
|
368
358
|
return list.sort(this.mySort);
|
|
369
359
|
}
|
|
360
|
+
getCheckedFilters() {
|
|
361
|
+
let list = Object.values(this.filtersMap);
|
|
362
|
+
list = list
|
|
363
|
+
.filter((filter) => filter.checked)
|
|
364
|
+
.sort(this.mySort);
|
|
365
|
+
return list;
|
|
366
|
+
}
|
|
370
367
|
}
|
|
371
368
|
TableFilterComponent.decorators = [
|
|
372
369
|
{ type: Component, args: [{
|
|
373
370
|
selector: 'mis-table-filter',
|
|
374
|
-
template: "<div id=\"main-container\"\n #mainContainer\n [ngStyle]=\"containerStyles\"\n>\n <div id=\"search-bar-container\">\n <input (keyup)=\"updateSearchValue($event)\" type=\"text\" placeholder=\"Search\">\n <svg id=\"search-icon\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M1.21496 8.14563C1.21496 4.3179 4.33709 1.21165 8.19249 1.21165C12.0479 1.21165 15.17 4.3179 15.17 8.14563C15.17 9.69308 14.6598 11.1226 13.797 12.2767L12.3684 13.7013C11.2043 14.5668 9.75891 15.0796 8.19249 15.0796C4.33709 15.0796 1.21496 11.9734 1.21496 8.14563ZM12.9419 14.7835C11.602 15.7329 9.96259 16.2913 8.19249 16.2913C3.66965 16.2913 -0.00012207 12.6461 -0.00012207 8.14563C-0.00012207 3.64512 3.66965 0 8.19249 0C12.7153 0 16.3851 3.64512 16.3851 8.14563C16.3851 9.93713 15.8036 11.5931 14.8183 12.9375L16.836 14.4048C17.6704 14.912 18.7553 15.6543 17.2453 17.215C15.7352 18.7756 15.0098 17.6663 14.499 16.8364L12.9419 14.7835Z\" fill=\"#6A737D\"/>\n </svg>\n </div>\n <div id=\"filters-main-container\">\n <div class=\"filters-
|
|
375
|
-
styles: ["#main-container{position:absolute;background:#fff;z-index:2;right:calc(50% - 128px);width:256px;padding:16px;font-family:Lato,sans-serif;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px}::-webkit-scrollbar{width:
|
|
371
|
+
template: "<div id=\"main-container\"\n #mainContainer\n [ngStyle]=\"containerStyles\"\n>\n <div id=\"search-bar-container\">\n <input (keyup)=\"updateSearchValue($event)\" type=\"text\" placeholder=\"Search\">\n <svg id=\"search-icon\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M1.21496 8.14563C1.21496 4.3179 4.33709 1.21165 8.19249 1.21165C12.0479 1.21165 15.17 4.3179 15.17 8.14563C15.17 9.69308 14.6598 11.1226 13.797 12.2767L12.3684 13.7013C11.2043 14.5668 9.75891 15.0796 8.19249 15.0796C4.33709 15.0796 1.21496 11.9734 1.21496 8.14563ZM12.9419 14.7835C11.602 15.7329 9.96259 16.2913 8.19249 16.2913C3.66965 16.2913 -0.00012207 12.6461 -0.00012207 8.14563C-0.00012207 3.64512 3.66965 0 8.19249 0C12.7153 0 16.3851 3.64512 16.3851 8.14563C16.3851 9.93713 15.8036 11.5931 14.8183 12.9375L16.836 14.4048C17.6704 14.912 18.7553 15.6543 17.2453 17.215C15.7352 18.7756 15.0098 17.6663 14.499 16.8364L12.9419 14.7835Z\" fill=\"#6A737D\"/>\n </svg>\n </div>\n <div id=\"filters-main-container\">\n <div class=\"filters-sub-container\">\n <div *ngFor=\"let filter of getCheckedFilters()\">\n <div class=\"filter\">\n <mis-checkbox\n [checked]=\"true\"\n [name]=\"filter.value\"\n (valueChange)=\"updateFilter($event)\"\n ></mis-checkbox>\n <span class=\"filter-text\">{{filter.name}}</span>\n </div>\n </div>\n </div>\n <div class=\"separator\" style=\"margin: 16px 0px;\" *ngIf=\"getCheckedFilters().length && (getCheckedFilters().length < filtersData.length)\"></div>\n <div class=\"filters-sub-container\">\n <div *ngFor=\"let filter of getFiltersBasedOnSearchValue()\">\n <div class=\"filter\" *ngIf=\"!filter.checked\">\n <mis-checkbox\n [checked]=\"false\"\n [name]=\"filter.value\"\n (valueChange)=\"updateFilter($event)\"\n ></mis-checkbox>\n <span class=\"filter-text\">{{filter.name}}</span>\n </div>\n </div>\n <div id=\"no-results-container\" *ngIf=\"getFiltersBasedOnSearchValue().length < 1\">\n <span class=\"filter-text\">No matches found</span>\n </div>\n </div>\n <div class=\"separator\" style=\"margin: 16px 0px;\"></div>\n <div id=\"buttons-container\">\n <button id=\"reset-btn\" style=\"margin-right: 8px;\" (click)=\"resetFilters()\">Reset</button>\n <button id=\"apply-btn\" (click)=\"applyFilters()\">Apply</button>\n </div>\n </div>\n</div>\n",
|
|
372
|
+
styles: ["#main-container{position:absolute;background:#fff;z-index:2;right:calc(50% - 128px);width:256px;padding:16px;font-family:Lato,sans-serif;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#9aa7b4}#search-bar-container{width:100%;position:relative;margin-bottom:8px}input{width:100%;padding:12px 12px 12px 42px;border:1px solid #000;border-radius:4px;height:48px;box-shadow:none;outline:none;font-style:normal;font-weight:400;font-size:15px;line-height:20px;letter-spacing:.1px;color:#181f33}input:focus{border:1px solid #0937b2}#search-icon{position:absolute;top:15px;left:12px}.filters-sub-container{max-height:144px;overflow-y:auto}.filter{height:36px;display:flex;justify-content:flex-start;align-items:center}.filter-text{font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#no-results-container{height:36px;display:flex;justify-content:center;align-items:center}.separator{border:1px solid #e0e0e0}#buttons-container{display:flex;justify-content:center;align-items:center}button{width:calc(50% - 4px);border:none;box-shadow:none;outline:none;font-size:16px;line-height:24px;text-align:center;letter-spacing:.2px;padding:10px 30px;background:none;border-radius:8px}#apply-btn{background:#0937b2;color:#fff}#reset-btn{background:#fff;color:#0937b2}"]
|
|
376
373
|
},] }
|
|
377
374
|
];
|
|
378
375
|
TableFilterComponent.ctorParameters = () => [];
|
|
379
376
|
TableFilterComponent.propDecorators = {
|
|
380
377
|
filtersData: [{ type: Input }],
|
|
381
|
-
appliedFilters: [{ type: Input }],
|
|
382
378
|
containerStyles: [{ type: Input }],
|
|
383
379
|
filtersApplied: [{ type: Output }],
|
|
384
380
|
container: [{ type: ViewChild, args: ['mainContainer',] }]
|
|
@@ -400,7 +396,7 @@ TableModule.decorators = [
|
|
|
400
396
|
imports: [
|
|
401
397
|
CommonModule,
|
|
402
398
|
CheckboxModule,
|
|
403
|
-
|
|
399
|
+
ScrollingModule
|
|
404
400
|
],
|
|
405
401
|
exports: [
|
|
406
402
|
TableComponent,
|
|
@@ -415,5 +411,5 @@ TableModule.decorators = [
|
|
|
415
411
|
* Generated bundle index. Do not edit.
|
|
416
412
|
*/
|
|
417
413
|
|
|
418
|
-
export { CustomTableCellDirective,
|
|
414
|
+
export { CustomTableCellDirective, TableComponent, TableFilterComponent, TableModule, SubTableComponent as ɵa };
|
|
419
415
|
//# sourceMappingURL=mis-crystal-design-system-table.js.map
|