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.
Files changed (109) hide show
  1. package/async-search-dropdown/async-dropdown.component.d.ts +60 -0
  2. package/async-search-dropdown/async-dropdown.module.d.ts +2 -0
  3. package/async-search-dropdown/index.d.ts +1 -0
  4. package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.d.ts +4 -0
  5. package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.metadata.json +1 -0
  6. package/async-search-dropdown/package.json +11 -0
  7. package/async-search-dropdown/public_api.d.ts +2 -0
  8. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js +211 -0
  9. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js.map +1 -0
  10. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js +2 -0
  11. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js.map +1 -0
  12. package/bundles/mis-crystal-design-system-button.umd.js +60 -2
  13. package/bundles/mis-crystal-design-system-button.umd.js.map +1 -1
  14. package/bundles/mis-crystal-design-system-button.umd.min.js +1 -1
  15. package/bundles/mis-crystal-design-system-button.umd.min.js.map +1 -1
  16. package/bundles/mis-crystal-design-system-datepicker.umd.js +3 -1
  17. package/bundles/mis-crystal-design-system-datepicker.umd.js.map +1 -1
  18. package/bundles/mis-crystal-design-system-datepicker.umd.min.js +1 -1
  19. package/bundles/mis-crystal-design-system-datepicker.umd.min.js.map +1 -1
  20. package/bundles/mis-crystal-design-system-dropdown.umd.js.map +1 -1
  21. package/bundles/mis-crystal-design-system-dropdown.umd.min.js.map +1 -1
  22. package/bundles/mis-crystal-design-system-input.umd.js +111 -0
  23. package/bundles/mis-crystal-design-system-input.umd.js.map +1 -0
  24. package/bundles/mis-crystal-design-system-input.umd.min.js +2 -0
  25. package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -0
  26. package/bundles/mis-crystal-design-system-modal.umd.js +165 -0
  27. package/bundles/mis-crystal-design-system-modal.umd.js.map +1 -0
  28. package/bundles/mis-crystal-design-system-modal.umd.min.js +2 -0
  29. package/bundles/mis-crystal-design-system-modal.umd.min.js.map +1 -0
  30. package/bundles/mis-crystal-design-system-table.umd.js +35 -49
  31. package/bundles/mis-crystal-design-system-table.umd.js.map +1 -1
  32. package/bundles/mis-crystal-design-system-table.umd.min.js +2 -2
  33. package/bundles/mis-crystal-design-system-table.umd.min.js.map +1 -1
  34. package/button/button.directive.d.ts +12 -0
  35. package/button/button.directive.scss +69 -0
  36. package/button/mis-crystal-design-system-button.d.ts +1 -0
  37. package/button/mis-crystal-design-system-button.metadata.json +1 -1
  38. package/datepicker/mis-crystal-design-system-datepicker.metadata.json +1 -1
  39. package/dropdown/mis-crystal-design-system-dropdown.metadata.json +1 -1
  40. package/esm2015/async-search-dropdown/async-dropdown.component.js +176 -0
  41. package/esm2015/async-search-dropdown/async-dropdown.module.js +15 -0
  42. package/esm2015/async-search-dropdown/index.js +2 -0
  43. package/esm2015/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.js +5 -0
  44. package/esm2015/async-search-dropdown/public_api.js +3 -0
  45. package/esm2015/button/button.directive.js +57 -0
  46. package/esm2015/button/button.module.js +4 -3
  47. package/esm2015/button/mis-crystal-design-system-button.js +2 -1
  48. package/esm2015/datepicker/bs-datepicker.module.js +6 -2
  49. package/esm2015/dropdown/dropdown.component.js +1 -1
  50. package/esm2015/input/directives/input/input.directive.js +38 -0
  51. package/esm2015/input/index.js +2 -0
  52. package/esm2015/input/mis-crystal-design-system-input.js +5 -0
  53. package/esm2015/input/mis-input.component.js +40 -0
  54. package/esm2015/input/mis-input.module.js +15 -0
  55. package/esm2015/input/public_api.js +4 -0
  56. package/esm2015/modal/index.js +2 -0
  57. package/esm2015/modal/mis-crystal-design-system-modal.js +6 -0
  58. package/esm2015/modal/modal-constants.js +4 -0
  59. package/esm2015/modal/modal-ref.js +16 -0
  60. package/esm2015/modal/modal.module.js +32 -0
  61. package/esm2015/modal/modal.service.js +72 -0
  62. package/esm2015/modal/module-wrapper/module-wrapper.component.js +33 -0
  63. package/esm2015/modal/public_api.js +5 -0
  64. package/esm2015/table/custom-table-cell.directive.js +3 -2
  65. package/esm2015/table/filter/filter.component.js +20 -22
  66. package/esm2015/table/mis-crystal-design-system-table.js +2 -1
  67. package/esm2015/table/public_api.js +1 -2
  68. package/esm2015/table/sub-table/sub-table.component.js +3 -3
  69. package/esm2015/table/table.component.js +7 -10
  70. package/esm2015/table/table.module.js +3 -3
  71. package/fesm2015/mis-crystal-design-system-async-search-dropdown.js +194 -0
  72. package/fesm2015/mis-crystal-design-system-async-search-dropdown.js.map +1 -0
  73. package/fesm2015/mis-crystal-design-system-button.js +60 -4
  74. package/fesm2015/mis-crystal-design-system-button.js.map +1 -1
  75. package/fesm2015/mis-crystal-design-system-datepicker.js +3 -1
  76. package/fesm2015/mis-crystal-design-system-datepicker.js.map +1 -1
  77. package/fesm2015/mis-crystal-design-system-dropdown.js.map +1 -1
  78. package/fesm2015/mis-crystal-design-system-input.js +94 -0
  79. package/fesm2015/mis-crystal-design-system-input.js.map +1 -0
  80. package/fesm2015/mis-crystal-design-system-modal.js +151 -0
  81. package/fesm2015/mis-crystal-design-system-modal.js.map +1 -0
  82. package/fesm2015/mis-crystal-design-system-table.js +32 -36
  83. package/fesm2015/mis-crystal-design-system-table.js.map +1 -1
  84. package/input/directives/input/input.directive.d.ts +15 -0
  85. package/input/index.d.ts +1 -0
  86. package/input/mis-crystal-design-system-input.d.ts +4 -0
  87. package/input/mis-crystal-design-system-input.metadata.json +1 -0
  88. package/input/mis-input.component.d.ts +15 -0
  89. package/input/mis-input.module.d.ts +2 -0
  90. package/input/package.json +11 -0
  91. package/input/public_api.d.ts +3 -0
  92. package/modal/index.d.ts +1 -0
  93. package/modal/mis-crystal-design-system-modal.d.ts +5 -0
  94. package/modal/mis-crystal-design-system-modal.metadata.json +1 -0
  95. package/modal/modal-constants.d.ts +3 -0
  96. package/modal/modal-ref.d.ts +9 -0
  97. package/modal/modal.module.d.ts +5 -0
  98. package/modal/modal.scss +9 -0
  99. package/modal/modal.service.d.ts +22 -0
  100. package/modal/module-wrapper/module-wrapper.component.d.ts +9 -0
  101. package/modal/package.json +11 -0
  102. package/modal/public_api.d.ts +4 -0
  103. package/package.json +1 -1
  104. package/table/filter/filter.component.d.ts +3 -5
  105. package/table/mis-crystal-design-system-table.d.ts +1 -0
  106. package/table/mis-crystal-design-system-table.metadata.json +1 -1
  107. package/table/public_api.d.ts +1 -1
  108. package/table/sub-table/sub-table.component.d.ts +1 -0
  109. package/table/table.component.d.ts +2 -5
@@ -0,0 +1,60 @@
1
+ import { Overlay } from '@angular/cdk/overlay';
2
+ import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
3
+ import { AbstractControl, FormControl } from '@angular/forms';
4
+ import { Observable, Subscription } from 'rxjs';
5
+ declare type IListData = any;
6
+ export declare class AsyncDropdownComponent implements OnInit, OnChanges, OnDestroy {
7
+ private overlay;
8
+ private viewContainerRef;
9
+ constructor(overlay: Overlay, viewContainerRef: ViewContainerRef);
10
+ httpStream: (searchKey: string) => Observable<IListData>;
11
+ displayKey: string;
12
+ secondaryDisplayKey: string;
13
+ placeholder: string;
14
+ debounceTime: number;
15
+ minInputLength: number;
16
+ multi: boolean;
17
+ uniqueKey: string;
18
+ control: AbstractControl | null;
19
+ disabled: boolean;
20
+ readonly: boolean;
21
+ origin: ElementRef;
22
+ input: ElementRef;
23
+ dd: TemplateRef<Element>;
24
+ customItem: TemplateRef<Element>;
25
+ onSelect: EventEmitter<IListData | IListData[]>;
26
+ searchInput: FormControl;
27
+ data: IListData[];
28
+ opened: boolean;
29
+ selections: Map<string, any>;
30
+ private searchSubscription;
31
+ private overlayRef;
32
+ controlSubscription: Subscription | undefined;
33
+ ngOnInit(): void;
34
+ ngOnChanges(changes: SimpleChanges): void;
35
+ ngOnDestroy(): void;
36
+ private handleControlChanges;
37
+ private openDropdown;
38
+ /**
39
+ * closes the dropdown
40
+ */
41
+ closeDropdown(): void;
42
+ /**
43
+ *
44
+ * @param item item to select
45
+ * if item property disabled is set to true, selection will be disabled
46
+ * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input
47
+ */
48
+ selectData(item: IListData, effectedFromOutside?: boolean): void;
49
+ /**
50
+ *
51
+ * @param item remove item from selected list
52
+ */
53
+ removeItem(item: IListData): void;
54
+ private setControlValue;
55
+ /**
56
+ * @returns list of selected items
57
+ */
58
+ get selectedItems(): Array<IListData>;
59
+ }
60
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare class AsyncDropdownModule {
2
+ }
@@ -0,0 +1 @@
1
+ export * from './public_api';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
@@ -0,0 +1 @@
1
+ {"__symbolic":"module","version":4,"metadata":{"AsyncDropdownComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":29,"character":1},"arguments":[{"selector":"mis-async-search-dropdown","template":"<div\n class=\"dd-wrapper\"\n [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\"\n #ddBtn\n>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <span *ngFor=\"let item of selectedItems\" (click)=\"removeItem(item)\">{{item[displayKey]}} <span class=\"ic-navigation-cancel-24\"></span> </span>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input\n tabindex=\"0\"\n type=\"text\"\n class=\"black-text\"\n #input\n [placeholder]=\"placeholder\"\n [formControl]=\"searchInput\"\n />\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" *ngIf=\"data.length\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container *ngIf=\"customItem; else standardItem\" [ngTemplateOutlet]=\"customItem\" [ngTemplateOutletContext]=\"{$implicit:item}\"></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</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 .selected-list>span{display:inline-block;background:#e0e0e0;border-radius:16px;padding:6px 12px;cursor:pointer;vertical-align:middle}.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{outline:none;padding:10px 12px 10px 48px;background-color:transparent;font-size:15px;line-height:20px;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{position:absolute;top:50%;transform:translateY(-50%);font-size:24px;width:24;line-height:24px;height:24px;left:10px}.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}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"Overlay","line":36,"character":21},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":37,"character":30}]}],"httpStream":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"displayKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":3}}]}],"secondaryDisplayKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":42,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"debounceTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3}}]}],"minInputLength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":45,"character":3}}]}],"multi":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":46,"character":3}}]}],"uniqueKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":47,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":48,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":50,"character":3}}]}],"origin":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":51,"character":3},"arguments":["ddBtn",{"static":false}]}]}],"input":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":52,"character":3},"arguments":["input",{"static":false}]}]}],"dd":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":53,"character":3},"arguments":["dd",{"static":false}]}]}],"customItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":54,"character":3},"arguments":["misCustomItem",{"static":false}]}]}],"onSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":57,"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"}]}},"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"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "main": "../bundles/mis-crystal-design-system-async-search-dropdown.umd.js",
3
+ "module": "../fesm2015/mis-crystal-design-system-async-search-dropdown.js",
4
+ "es2015": "../fesm2015/mis-crystal-design-system-async-search-dropdown.js",
5
+ "esm2015": "../esm2015/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.js",
6
+ "fesm2015": "../fesm2015/mis-crystal-design-system-async-search-dropdown.js",
7
+ "typings": "mis-crystal-design-system-async-search-dropdown.d.ts",
8
+ "metadata": "mis-crystal-design-system-async-search-dropdown.metadata.json",
9
+ "sideEffects": false,
10
+ "name": "mis-crystal-design-system/async-search-dropdown"
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './async-dropdown.component';
2
+ export * from './async-dropdown.module';
@@ -0,0 +1,211 @@
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';
6
+
7
+ var AsyncDropdownComponent = /** @class */ (function () {
8
+ function AsyncDropdownComponent(overlay, viewContainerRef) {
9
+ var _this = this;
10
+ this.overlay = overlay;
11
+ this.viewContainerRef = viewContainerRef;
12
+ this.placeholder = 'Select'; // placeholder for input
13
+ this.debounceTime = 400; // wait time till which API call is paused
14
+ this.minInputLength = 2; // min length after which API call is made
15
+ this.multi = false; // maintain a list or emit value
16
+ // tslint:disable-next-line
17
+ this.onSelect = new core.EventEmitter(true); // emit selected values
18
+ this.searchInput = new forms.FormControl();
19
+ this.data = [];
20
+ this.opened = false;
21
+ // tslint:disable-next-line
22
+ this.selections = new Map();
23
+ this.handleControlChanges = function (values) {
24
+ values.forEach(function (el) {
25
+ _this.selectData(el, true);
26
+ });
27
+ // tslint:disable-next-line
28
+ };
29
+ }
30
+ AsyncDropdownComponent.prototype.ngOnInit = function () {
31
+ var _this = this;
32
+ var _a, _b;
33
+ if (this.multi && !this.uniqueKey) {
34
+ throw new Error('[uniqueKey] required in multi mode.');
35
+ }
36
+ if (this.disabled) {
37
+ this.searchInput.disable();
38
+ }
39
+ this.searchSubscription = this.searchInput.valueChanges
40
+ .pipe(operators.filter(function (val) { return val && val.length >= _this.minInputLength; }), operators.debounceTime(this.debounceTime), operators.distinctUntilChanged())
41
+ .subscribe(function (res) {
42
+ _this.httpStream(res).subscribe(function (list) {
43
+ var _a;
44
+ _this.data = list;
45
+ if (!((_a = _this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && list.length > 0) {
46
+ _this.openDropdown(_this.dd, _this.origin.nativeElement);
47
+ }
48
+ });
49
+ });
50
+ if ((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) {
51
+ this.handleControlChanges(this.control.value);
52
+ }
53
+ this.controlSubscription = (_b = this.control) === null || _b === void 0 ? void 0 : _b.valueChanges.subscribe(this.handleControlChanges);
54
+ };
55
+ AsyncDropdownComponent.prototype.ngOnChanges = function (changes) {
56
+ if (changes && changes.disabled) {
57
+ this.searchInput.enable();
58
+ if (this.disabled) {
59
+ this.searchInput.disable();
60
+ }
61
+ }
62
+ };
63
+ AsyncDropdownComponent.prototype.ngOnDestroy = function () {
64
+ var _a;
65
+ (_a = this.searchSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
66
+ };
67
+ AsyncDropdownComponent.prototype.openDropdown = function (template, origin) {
68
+ var _this = this;
69
+ var positionStrategy = this.overlay
70
+ .position()
71
+ .flexibleConnectedTo(origin)
72
+ .withPositions([
73
+ new overlay.ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }),
74
+ new overlay.ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' }),
75
+ ])
76
+ .withPush(true);
77
+ var configs = new overlay.OverlayConfig({
78
+ hasBackdrop: true,
79
+ backdropClass: 'cdk-overlay-transparent-backdrop',
80
+ scrollStrategy: this.overlay.scrollStrategies.reposition(),
81
+ positionStrategy: positionStrategy,
82
+ width: origin.clientWidth,
83
+ });
84
+ this.overlayRef = this.overlay.create(configs);
85
+ this.overlayRef.attach(new portal.TemplatePortal(template, this.viewContainerRef));
86
+ this.overlayRef.backdropClick().subscribe(function (res) {
87
+ _this.closeDropdown();
88
+ });
89
+ };
90
+ /**
91
+ * closes the dropdown
92
+ */
93
+ AsyncDropdownComponent.prototype.closeDropdown = function () {
94
+ var _a;
95
+ this.opened = false;
96
+ (_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.detach();
97
+ this.data = [];
98
+ };
99
+ /**
100
+ *
101
+ * @param item item to select
102
+ * if item property disabled is set to true, selection will be disabled
103
+ * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input
104
+ */
105
+ AsyncDropdownComponent.prototype.selectData = function (item, effectedFromOutside) {
106
+ var _this = this;
107
+ if (effectedFromOutside === void 0) { effectedFromOutside = true; }
108
+ if (item.disabled) {
109
+ return;
110
+ }
111
+ if (!this.multi) {
112
+ this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });
113
+ this.setControlValue(item);
114
+ }
115
+ else {
116
+ if (!this.selections.has(item[this.uniqueKey])) {
117
+ this.selections.set(item[this.uniqueKey], item);
118
+ }
119
+ this.setControlValue(this.selectedItems);
120
+ if (!effectedFromOutside) {
121
+ setTimeout(function () {
122
+ _this.input.nativeElement.focus();
123
+ _this.input.nativeElement.scrollIntoView();
124
+ }, 10);
125
+ }
126
+ this.searchInput.patchValue('');
127
+ this.data = [];
128
+ }
129
+ this.closeDropdown();
130
+ };
131
+ /**
132
+ *
133
+ * @param item remove item from selected list
134
+ */
135
+ AsyncDropdownComponent.prototype.removeItem = function (item) {
136
+ this.selections.delete(item[this.uniqueKey]);
137
+ this.setControlValue(this.selectedItems);
138
+ // tslint:disable-next-line
139
+ this.input['nativeElement'].focus();
140
+ };
141
+ AsyncDropdownComponent.prototype.setControlValue = function (value) {
142
+ var _a;
143
+ this.onSelect.emit(value);
144
+ (_a = this.control) === null || _a === void 0 ? void 0 : _a.patchValue(value, { emitEvent: false });
145
+ };
146
+ Object.defineProperty(AsyncDropdownComponent.prototype, "selectedItems", {
147
+ /**
148
+ * @returns list of selected items
149
+ */
150
+ get: function () {
151
+ return Array.from(this.selections.values());
152
+ },
153
+ enumerable: false,
154
+ configurable: true
155
+ });
156
+ return AsyncDropdownComponent;
157
+ }());
158
+ AsyncDropdownComponent.decorators = [
159
+ { type: core.Component, args: [{
160
+ selector: 'mis-async-search-dropdown',
161
+ template: "<div\n class=\"dd-wrapper\"\n [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\"\n #ddBtn\n>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <span *ngFor=\"let item of selectedItems\" (click)=\"removeItem(item)\">{{item[displayKey]}} <span class=\"ic-navigation-cancel-24\"></span> </span>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input\n tabindex=\"0\"\n type=\"text\"\n class=\"black-text\"\n #input\n [placeholder]=\"placeholder\"\n [formControl]=\"searchInput\"\n />\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" *ngIf=\"data.length\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container *ngIf=\"customItem; else standardItem\" [ngTemplateOutlet]=\"customItem\" [ngTemplateOutletContext]=\"{$implicit:item}\"></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</ng-template>\n",
162
+ 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 .selected-list>span{display:inline-block;background:#e0e0e0;border-radius:16px;padding:6px 12px;cursor:pointer;vertical-align:middle}.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{outline:none;padding:10px 12px 10px 48px;background-color:transparent;font-size:15px;line-height:20px;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{position:absolute;top:50%;transform:translateY(-50%);font-size:24px;width:24;line-height:24px;height:24px;left:10px}.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}"]
163
+ },] }
164
+ ];
165
+ AsyncDropdownComponent.ctorParameters = function () { return [
166
+ { type: overlay.Overlay },
167
+ { type: core.ViewContainerRef }
168
+ ]; };
169
+ AsyncDropdownComponent.propDecorators = {
170
+ httpStream: [{ type: core.Input }],
171
+ displayKey: [{ type: core.Input }],
172
+ secondaryDisplayKey: [{ type: core.Input }],
173
+ placeholder: [{ type: core.Input }],
174
+ debounceTime: [{ type: core.Input }],
175
+ minInputLength: [{ type: core.Input }],
176
+ multi: [{ type: core.Input }],
177
+ uniqueKey: [{ type: core.Input }],
178
+ control: [{ type: core.Input }],
179
+ disabled: [{ type: core.Input }],
180
+ readonly: [{ type: core.Input }],
181
+ origin: [{ type: core.ViewChild, args: ['ddBtn', { static: false },] }],
182
+ input: [{ type: core.ViewChild, args: ['input', { static: false },] }],
183
+ dd: [{ type: core.ViewChild, args: ['dd', { static: false },] }],
184
+ customItem: [{ type: core.ContentChild, args: ['misCustomItem', { static: false },] }],
185
+ onSelect: [{ type: core.Output }]
186
+ };
187
+
188
+ var AsyncDropdownModule = /** @class */ (function () {
189
+ function AsyncDropdownModule() {
190
+ }
191
+ return AsyncDropdownModule;
192
+ }());
193
+ AsyncDropdownModule.decorators = [
194
+ { type: core.NgModule, args: [{
195
+ declarations: [AsyncDropdownComponent],
196
+ imports: [common.CommonModule, overlay.OverlayModule, forms.ReactiveFormsModule, forms.FormsModule],
197
+ exports: [AsyncDropdownComponent],
198
+ },] }
199
+ ];
200
+
201
+ /**
202
+ * Generated bundle index. Do not edit.
203
+ */
204
+
205
+ exports.AsyncDropdownComponent = AsyncDropdownComponent;
206
+ exports.AsyncDropdownModule = AsyncDropdownModule;
207
+
208
+ Object.defineProperty(exports, '__esModule', { value: true });
209
+
210
+ })));
211
+ //# sourceMappingURL=mis-crystal-design-system-async-search-dropdown.umd.js.map
@@ -0,0 +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 {\n ConnectionPositionPair,\n Overlay,\n OverlayConfig,\n OverlayRef,\n} from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\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 } 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(\n private overlay: Overlay,\n private viewContainerRef: ViewContainerRef\n ) {}\n\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(\n true\n ); // 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\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 debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe((res) => {\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 if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(\n this.handleControlChanges\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\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(\n template: TemplateRef<Element>,\n origin: HTMLElement\n ): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair(\n { originX: 'start', originY: 'bottom' },\n { overlayX: 'start', overlayY: 'top' }\n ),\n new ConnectionPositionPair(\n { originX: 'start', originY: 'top' },\n { overlayX: 'start', overlayY: 'bottom' }\n ),\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","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","filter","debounceTime","distinctUntilChanged","ConnectionPositionPair","OverlayConfig","TemplatePortal","Component","Overlay","ViewContainerRef","Input","ViewChild","ContentChild","Output","NgModule","CommonModule","OverlayModule","ReactiveFormsModule","FormsModule"],"mappings":";;;;;;;QAmCE,gCACU,OAAgB,EAChB,gBAAkC;YAF5C,iBAGI;YAFM,YAAO,GAAP,OAAO,CAAS;YAChB,qBAAgB,GAAhB,gBAAgB,CAAkB;YAMnC,gBAAW,GAAG,QAAQ,CAAC;YACvB,iBAAY,GAAG,GAAG,CAAC;YACnB,mBAAc,GAAG,CAAC,CAAC;YACnB,UAAK,GAAG,KAAK,CAAC;;YAWb,aAAQ,GAA0C,IAAIA,iBAAY,CAC1E,IAAI,CACL,CAAC;YACF,gBAAW,GAAgB,IAAIC,iBAAW,EAAE,CAAC;YAC7C,SAAI,GAAgB,EAAE,CAAC;YACvB,WAAM,GAAG,KAAK,CAAC;;YAEf,eAAU,GAAqB,IAAI,GAAG,EAAE,CAAC;YA+CjC,yBAAoB,GAAG,UAAC,MAAmB;gBACjD,MAAM,CAAC,OAAO,CAAC,UAAC,EAAE;oBAChB,KAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;iBAC3B,CAAC,CAAC;;aAEJ,CAAC;SA9EE;QA+BJ,yCAAQ,GAAR;YAAA,iBA2BC;;YA1BC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACjC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;aACxD;YACD,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;aAC5B;YACD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY;iBACpD,IAAI,CACHC,gBAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,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AAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAA,IAAI,CAAC,OAAO,0CAAE,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE;SACvD;QAKD,sBAAI,iDAAa;;;;iBAAjB;gBACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;aAC7C;;;WAAA;;;;gBAtLFC,cAAS,SAAC;oBACT,QAAQ,EAAE,2BAA2B;oBACrC,w2CAA8C;;iBAE/C;;;gBA/BCC,eAAO;gBAkBPC,qBAAgB;;;6BAoBfC,UAAK;6BACLA,UAAK;sCACLA,UAAK;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;2BAG/CC,WAAM;;;;QC9CT;;;;;gBALCC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,sBAAsB,CAAC;oBACtC,OAAO,EAAE,CAACC,mBAAY,EAAEC,qBAAa,EAAEC,yBAAmB,EAAEC,iBAAW,CAAC;oBACxE,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBAClC;;;ICVD;;;;;;;;;;;;;"}
@@ -0,0 +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,o,r,s){"use strict";var a=function(){function e(e,t){var n=this;this.overlay=e,this.viewContainerRef=t,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.selections=new Map,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(r.filter((function(e){return e&&e.length>=n.minInputLength})),r.debounceTime(this.debounceTime),r.distinctUntilChanged()).subscribe((function(e){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){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,r=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),s=new t.OverlayConfig({hasBackdrop:!0,backdropClass:"cdk-overlay-transparent-backdrop",scrollStrategy:this.overlay.scrollStrategies.reposition(),positionStrategy:r,width:i.clientWidth});this.overlayRef=this.overlay.create(s),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}();a.decorators=[{type:i.Component,args:[{selector:"mis-async-search-dropdown",template:'<div\n class="dd-wrapper"\n [ngClass]="{ opened: opened, disabled: disabled, readonly: readonly }"\n #ddBtn\n>\n <div class="selected-list" *ngIf="multi && selections.size > 0">\n <span *ngFor="let item of selectedItems" (click)="removeItem(item)">{{item[displayKey]}} <span class="ic-navigation-cancel-24"></span> </span>\n </div>\n <div class="search-input">\n <span class="ic-action-search-24"></span>\n <input\n tabindex="0"\n type="text"\n class="black-text"\n #input\n [placeholder]="placeholder"\n [formControl]="searchInput"\n />\n </div>\n</div>\n\n<ng-template #dd>\n <div class="dd-list" *ngIf="data.length">\n <ng-container *ngFor="let item of data">\n <div (click)="selectData(item, false)">\n <ng-container *ngIf="customItem; else standardItem" [ngTemplateOutlet]="customItem" [ngTemplateOutletContext]="{$implicit:item}"></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</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 .selected-list>span{display:inline-block;background:#e0e0e0;border-radius:16px;padding:6px 12px;cursor:pointer;vertical-align:middle}.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{outline:none;padding:10px 12px 10px 48px;background-color:transparent;font-size:15px;line-height:20px;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{position:absolute;top:50%;transform:translateY(-50%);font-size:24px;width:24;line-height:24px;height:24px;left:10px}.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}"]}]}],a.ctorParameters=function(){return[{type:t.Overlay},{type:i.ViewContainerRef}]},a.propDecorators={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}]};var l=function(){};l.decorators=[{type:i.NgModule,args:[{declarations:[a],imports:[s.CommonModule,t.OverlayModule,o.ReactiveFormsModule,o.FormsModule],exports:[a]}]}],e.AsyncDropdownComponent=a,e.AsyncDropdownModule=l,Object.defineProperty(e,"__esModule",{value:!0})}));
2
+ //# sourceMappingURL=mis-crystal-design-system-async-search-dropdown.umd.min.js.map
@@ -0,0 +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","placeholder","debounceTime","minInputLength","multi","onSelect","EventEmitter","searchInput","FormControl","data","opened","selections","Map","handleControlChanges","values","forEach","el","selectData","prototype","ngOnInit","uniqueKey","Error","disabled","disable","searchSubscription","valueChanges","pipe","filter","val","length","distinctUntilChanged","subscribe","res","httpStream","list","_a","overlayRef","hasAttached","openDropdown","dd","origin","nativeElement","control","value","controlSubscription","_b","ngOnChanges","changes","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","closeDropdown","detach","item","effectedFromOutside","has","set","setControlValue","selectedItems","setTimeout","input","focus","scrollIntoView","patchValue","displayKey","emitEvent","removeItem","delete","emit","Object","defineProperty","Array","from","Component","args","selector","Overlay","ViewContainerRef","Input","ViewChild","static","ContentChild","Output","NgModule","declarations","imports","CommonModule","OverlayModule","ReactiveFormsModule","FormsModule","exports"],"mappings":"2xBAmCE,SAAAA,EACUC,EACAC,GAFV,IAAAC,EAAAC,KACUA,KAAAH,QAAAA,EACAG,KAAAF,iBAAAA,EAMDE,KAAAC,YAAc,SACdD,KAAAE,aAAe,IACfF,KAAAG,eAAiB,EACjBH,KAAAI,OAAQ,EAWPJ,KAAAK,SAAkD,IAAIC,EAAAA,cAC9D,GAEFN,KAAAO,YAA2B,IAAIC,EAAAA,YAC/BR,KAAAS,KAAoB,GACpBT,KAAAU,QAAS,EAETV,KAAAW,WAA+B,IAAIC,IA+C3BZ,KAAAa,qBAAuB,SAACC,GAC9BA,EAAOC,SAAQ,SAACC,GACdjB,EAAKkB,WAAWD,GAAI,cA5CxBpB,EAAAsB,UAAAC,SAAA,WAAA,QAAApB,EAAAC,KACE,GAAIA,KAAKI,QAAUJ,KAAKoB,UACtB,MAAM,IAAIC,MAAM,uCAEdrB,KAAKsB,UACPtB,KAAKO,YAAYgB,UAEnBvB,KAAKwB,mBAAqBxB,KAAKO,YAAYkB,aACxCC,KACCC,EAAAA,QAAO,SAACC,GAAQ,OAAAA,GAAOA,EAAIC,QAAU9B,EAAKI,kBAC1CD,EAAAA,aAAaF,KAAKE,cAClB4B,EAAAA,wBAEDC,WAAU,SAACC,GACVjC,EAAKkC,WAAWD,GAAKD,WAAU,SAACG,SAC9BnC,EAAKU,KAAOyB,IACQ,QAAhBC,EAACpC,EAAKqC,kBA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ACAA,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,gBC9CH,iCALCC,EAAAA,SAAQT,KAAA,CAAC,CACRU,aAAc,CAAChH,GACfiH,QAAS,CAACC,EAAAA,aAAcC,EAAAA,cAAeC,EAAAA,oBAAqBC,EAAAA,aAC5DC,QAAS,CAACtH","sourcesContent":["import {\n ConnectionPositionPair,\n Overlay,\n OverlayConfig,\n OverlayRef,\n} from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\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 } 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(\n private overlay: Overlay,\n private viewContainerRef: ViewContainerRef\n ) {}\n\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(\n true\n ); // 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\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 debounceTime(this.debounceTime),\n distinctUntilChanged()\n )\n .subscribe((res) => {\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 if (this.control?.value) {\n this.handleControlChanges(this.control.value);\n }\n this.controlSubscription = this.control?.valueChanges.subscribe(\n this.handleControlChanges\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\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(\n template: TemplateRef<Element>,\n origin: HTMLElement\n ): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair(\n { originX: 'start', originY: 'bottom' },\n { overlayX: 'start', overlayY: 'top' }\n ),\n new ConnectionPositionPair(\n { originX: 'start', originY: 'top' },\n { overlayX: 'start', overlayY: 'bottom' }\n ),\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","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"]}
@@ -47,6 +47,63 @@
47
47
  click: [{ type: core.Output }]
48
48
  };
49
49
 
50
+ var ButtonDirective = /** @class */ (function () {
51
+ function ButtonDirective(el, renderer) {
52
+ this.el = el;
53
+ this.renderer = renderer;
54
+ this.type = 'none';
55
+ this.size = 'md';
56
+ this.elementClass = 'mis-btn';
57
+ }
58
+ ButtonDirective.prototype.ngAfterViewInit = function () {
59
+ this.bindTypeClass();
60
+ this.bindSizeClass();
61
+ };
62
+ ButtonDirective.prototype.bindTypeClass = function () {
63
+ var className = '';
64
+ switch (this.type) {
65
+ case 'primary':
66
+ className = 'mis-primary';
67
+ break;
68
+ case 'outline':
69
+ className = 'mis-outline';
70
+ break;
71
+ default:
72
+ className = 'mis-none';
73
+ }
74
+ this.renderer.addClass(this.el.nativeElement, className);
75
+ };
76
+ ButtonDirective.prototype.bindSizeClass = function () {
77
+ var className = '';
78
+ switch (this.size) {
79
+ case 'lg':
80
+ className = 'mis-btn-lg';
81
+ break;
82
+ case 'sm':
83
+ className = 'mis-btn-sm';
84
+ break;
85
+ default:
86
+ className = 'mis-btn-md';
87
+ }
88
+ this.renderer.addClass(this.el.nativeElement, className);
89
+ };
90
+ return ButtonDirective;
91
+ }());
92
+ ButtonDirective.decorators = [
93
+ { type: core.Directive, args: [{
94
+ selector: '[mis-button]',
95
+ },] }
96
+ ];
97
+ ButtonDirective.ctorParameters = function () { return [
98
+ { type: core.ElementRef },
99
+ { type: core.Renderer2 }
100
+ ]; };
101
+ ButtonDirective.propDecorators = {
102
+ type: [{ type: core.Input }],
103
+ size: [{ type: core.Input }],
104
+ elementClass: [{ type: core.HostBinding, args: ['class',] }]
105
+ };
106
+
50
107
  var ButtonModule = /** @class */ (function () {
51
108
  function ButtonModule() {
52
109
  }
@@ -57,9 +114,9 @@
57
114
  }());
58
115
  ButtonModule.decorators = [
59
116
  { type: core.NgModule, args: [{
60
- declarations: [ButtonComponent],
117
+ declarations: [ButtonComponent, ButtonDirective],
61
118
  imports: [common.CommonModule],
62
- exports: [ButtonComponent]
119
+ exports: [ButtonComponent, ButtonDirective]
63
120
  },] }
64
121
  ];
65
122
 
@@ -69,6 +126,7 @@
69
126
 
70
127
  exports.ButtonComponent = ButtonComponent;
71
128
  exports.ButtonModule = ButtonModule;
129
+ exports.ɵa = ButtonDirective;
72
130
 
73
131
  Object.defineProperty(exports, '__esModule', { value: true });
74
132
 
@@ -1 +1 @@
1
- {"version":3,"file":"mis-crystal-design-system-button.umd.js","sources":["../../../projects/mis-components/button/button.component.ts","../../../projects/mis-components/button/button.module.ts","../../../projects/mis-components/button/mis-crystal-design-system-button.ts"],"sourcesContent":["import {Component, Input, OnInit, Output, EventEmitter, ContentChild, TemplateRef} from '@angular/core';\n\n@Component({\n selector: 'mis-button',\n templateUrl: './button.component.html',\n styleUrls: ['./button.component.scss']\n})\nexport class ButtonComponent implements OnInit{\n\n @Input() name: string = 'Enabled'\n @Input() type: 'Solid' | 'Outline' | 'Text' = 'Solid'\n @Input() size: 'Small' | 'Medium' | 'Large' | 'Small-M' | 'Large-M' = 'Medium'\n @Input() width: string = ''\n\n @Input() showIcon: boolean = false\n @Input() iconUrl: string = ''\n @Input() iconPosition: 'Left' | 'Right' = 'Left'\n\n @Input() disabled: boolean = false\n @Input() disableLeftBorderRadius: boolean = false\n @Input() disableRightBorderRadius: boolean = false\n\n /** Emits event when button is clicked */\n @Output() click = new EventEmitter<any>()\n\n constructor(){}\n\n ngOnInit(){}\n\n onClick(event){\n this.click.emit(event)\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { ButtonComponent } from './button.component';\n\n@NgModule({\n declarations: [ButtonComponent],\n imports: [CommonModule],\n exports: [ButtonComponent]\n})\nexport class ButtonModule {\n static forRoot(): ModuleWithProviders<ButtonModule> {\n return { ngModule: ButtonModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["EventEmitter","Component","Input","Output","NgModule","CommonModule"],"mappings":";;;;;;;QAyBE;YAhBS,SAAI,GAAW,SAAS,CAAA;YACxB,SAAI,GAAiC,OAAO,CAAA;YAC5C,SAAI,GAAyD,QAAQ,CAAA;YACrE,UAAK,GAAW,EAAE,CAAA;YAElB,aAAQ,GAAY,KAAK,CAAA;YACzB,YAAO,GAAW,EAAE,CAAA;YACpB,iBAAY,GAAqB,MAAM,CAAA;YAEvC,aAAQ,GAAY,KAAK,CAAA;YACzB,4BAAuB,GAAY,KAAK,CAAA;YACxC,6BAAwB,GAAY,KAAK,CAAA;;YAGxC,UAAK,GAAG,IAAIA,iBAAY,EAAO,CAAA;SAE1B;QAEf,kCAAQ,GAAR,eAAY;QAEZ,iCAAO,GAAP,UAAQ,KAAK;YACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SACvB;;;;gBA7BFC,cAAS,SAAC;oBACT,QAAQ,EAAE,YAAY;oBACtB,m9BAAsC;;iBAEvC;;;;uBAGEC,UAAK;uBACLA,UAAK;uBACLA,UAAK;wBACLA,UAAK;2BAELA,UAAK;0BACLA,UAAK;+BACLA,UAAK;2BAELA,UAAK;0CACLA,UAAK;2CACLA,UAAK;wBAGLC,WAAM;;;;QCbT;;QACS,oBAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SAClD;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,eAAe,CAAC;oBAC/B,OAAO,EAAE,CAACC,mBAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,eAAe,CAAC;iBAC3B;;;ICTD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mis-crystal-design-system-button.umd.js","sources":["../../../projects/mis-components/button/button.component.ts","../../../projects/mis-components/button/button.directive.ts","../../../projects/mis-components/button/button.module.ts","../../../projects/mis-components/button/mis-crystal-design-system-button.ts"],"sourcesContent":["import {Component, Input, OnInit, Output, EventEmitter, ContentChild, TemplateRef} from '@angular/core';\n\n@Component({\n selector: 'mis-button',\n templateUrl: './button.component.html',\n styleUrls: ['./button.component.scss']\n})\nexport class ButtonComponent implements OnInit{\n\n @Input() name: string = 'Enabled'\n @Input() type: 'Solid' | 'Outline' | 'Text' = 'Solid'\n @Input() size: 'Small' | 'Medium' | 'Large' | 'Small-M' | 'Large-M' = 'Medium'\n @Input() width: string = ''\n\n @Input() showIcon: boolean = false\n @Input() iconUrl: string = ''\n @Input() iconPosition: 'Left' | 'Right' = 'Left'\n\n @Input() disabled: boolean = false\n @Input() disableLeftBorderRadius: boolean = false\n @Input() disableRightBorderRadius: boolean = false\n\n /** Emits event when button is clicked */\n @Output() click = new EventEmitter<any>()\n\n constructor(){}\n\n ngOnInit(){}\n\n onClick(event){\n this.click.emit(event)\n }\n}\n","import {\n AfterViewInit,\n Directive,\n ElementRef,\n HostBinding,\n Input,\n Renderer2,\n} from '@angular/core';\n\n@Directive({\n selector: '[mis-button]',\n})\nexport class ButtonDirective implements AfterViewInit {\n @Input() type: 'primary' | 'outline' | 'none' = 'none';\n @Input() size: 'sm' | 'md' | 'lg' = 'md';\n @HostBinding('class') elementClass = 'mis-btn';\n\n constructor(private el: ElementRef, private renderer: Renderer2) { }\n\n ngAfterViewInit(): void {\n this.bindTypeClass();\n this.bindSizeClass();\n }\n\n private bindTypeClass(): void {\n let className = '';\n switch (this.type) {\n case 'primary':\n className = 'mis-primary';\n break;\n case 'outline':\n className = 'mis-outline';\n break;\n default:\n className = 'mis-none';\n }\n this.renderer.addClass(this.el.nativeElement, className);\n }\n\n private bindSizeClass(): void {\n let className = '';\n switch (this.size) {\n case 'lg':\n className = 'mis-btn-lg';\n break;\n case 'sm':\n className = 'mis-btn-sm';\n break;\n default:\n className = 'mis-btn-md';\n }\n this.renderer.addClass(this.el.nativeElement, className);\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ButtonDirective } from './button.directive';\nimport { ButtonComponent } from './button.component';\n\n@NgModule({\n declarations: [ButtonComponent, ButtonDirective],\n imports: [CommonModule],\n exports: [ButtonComponent, ButtonDirective]\n})\nexport class ButtonModule {\n static forRoot(): ModuleWithProviders<ButtonModule> {\n return { ngModule: ButtonModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {ButtonDirective as ɵa} from './button.directive';"],"names":["EventEmitter","Component","Input","Output","Directive","ElementRef","Renderer2","HostBinding","NgModule","CommonModule"],"mappings":";;;;;;;QAyBE;YAhBS,SAAI,GAAW,SAAS,CAAA;YACxB,SAAI,GAAiC,OAAO,CAAA;YAC5C,SAAI,GAAyD,QAAQ,CAAA;YACrE,UAAK,GAAW,EAAE,CAAA;YAElB,aAAQ,GAAY,KAAK,CAAA;YACzB,YAAO,GAAW,EAAE,CAAA;YACpB,iBAAY,GAAqB,MAAM,CAAA;YAEvC,aAAQ,GAAY,KAAK,CAAA;YACzB,4BAAuB,GAAY,KAAK,CAAA;YACxC,6BAAwB,GAAY,KAAK,CAAA;;YAGxC,UAAK,GAAG,IAAIA,iBAAY,EAAO,CAAA;SAE1B;QAEf,kCAAQ,GAAR,eAAY;QAEZ,iCAAO,GAAP,UAAQ,KAAK;YACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SACvB;;;;gBA7BFC,cAAS,SAAC;oBACT,QAAQ,EAAE,YAAY;oBACtB,m9BAAsC;;iBAEvC;;;;uBAGEC,UAAK;uBACLA,UAAK;uBACLA,UAAK;wBACLA,UAAK;2BAELA,UAAK;0BACLA,UAA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;;;;QCLtB;;QACS,oBAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SAClD;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;oBAChD,OAAO,EAAE,CAACC,mBAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;iBAC5C;;;ICTD;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/button",["exports","@angular/core","@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"].button={}),e.ng.core,e.ng.common)}(this,(function(e,t,n){"use strict";var i=function(){function e(){this.name="Enabled",this.type="Solid",this.size="Medium",this.width="",this.showIcon=!1,this.iconUrl="",this.iconPosition="Left",this.disabled=!1,this.disableLeftBorderRadius=!1,this.disableRightBorderRadius=!1,this.click=new t.EventEmitter}return e.prototype.ngOnInit=function(){},e.prototype.onClick=function(e){this.click.emit(e)},e}();i.decorators=[{type:t.Component,args:[{selector:"mis-button",template:"<button\n (click)=\"onClick($event);\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'solid': type === 'Solid',\n 'outline': type === 'Outline',\n 'text': type === 'Text',\n 'large': size === 'Large',\n 'medium': size === 'Medium',\n 'small': size === 'Small',\n 'large-mobile': size === 'Large-M',\n 'small-mobile': size === 'Small-M'\n }\"\n [ngStyle]=\"{\n 'border-top-left-radius': disableLeftBorderRadius ? '0px': '',\n 'border-bottom-left-radius': disableLeftBorderRadius ? '0px': '',\n 'border-top-right-radius': disableRightBorderRadius ? '0px': '',\n 'border-bottom-right-radius': disableRightBorderRadius ? '0px': '',\n 'width': width\n }\"\n>\n <span id=\"left-icon\" *ngIf=\"showIcon && iconPosition === 'Left'\">\n <img [src]=\"iconUrl\" alt=\"\">\n </span>\n {{name}}\n <span id=\"right-icon\" *ngIf=\"showIcon && iconPosition === 'Right'\">\n <img [src]=\"iconUrl\" alt=\"\">\n </span>\n</button>\n",styles:["button{font-family:Lato,sans-serif!important;border:none;padding:0;margin:0;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#181f33;background-color:#fff}.solid{color:#fff;background:#0937b2}.solid:hover:enabled{background:#062a99}.solid:active:enabled{background:#041f80}.solid:disabled{color:#929dab;background:#f5f5f5}.outline{border:1px solid #0937b2;color:#0937b2;background:#fff}.outline:hover:enabled{background:#f0f3fa}.outline:active:enabled{background:#dae1f3}.outline:disabled{color:#929dab;border:1px solid #929dab}.text{color:#181f33;background:#fff}.text:hover:enabled{background:#f0f3fa}.text:active:enabled{background:#dae1f3}.text:disabled{color:#929dab}.large{height:56px;padding:16px;border-radius:10px;font-weight:700;letter-spacing:.5px}.large,.medium{font-style:normal;font-size:16px;line-height:24px}.medium{height:44px;padding:10px 16px;border-radius:8px;font-weight:400;letter-spacing:.2px}.small{height:32px;padding:6px 16px;border-radius:6px;font-weight:400;letter-spacing:.25px}.large-mobile,.small{font-style:normal;font-size:14px;line-height:20px}.large-mobile{height:44px;padding:12px}.large-mobile,.small-mobile{border-radius:8px;font-weight:700;letter-spacing:.1px}.small-mobile{height:32px;padding:6px 12px;font-style:normal;font-size:14px;line-height:20px}span{display:flex;justify-content:center;align-items:center}#left-icon{margin-right:8px}#right-icon{margin-left:8px}"]}]}],i.ctorParameters=function(){return[]},i.propDecorators={name:[{type:t.Input}],type:[{type:t.Input}],size:[{type:t.Input}],width:[{type:t.Input}],showIcon:[{type:t.Input}],iconUrl:[{type:t.Input}],iconPosition:[{type:t.Input}],disabled:[{type:t.Input}],disableLeftBorderRadius:[{type:t.Input}],disableRightBorderRadius:[{type:t.Input}],click:[{type:t.Output}]};var o=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[]}},e}();o.decorators=[{type:t.NgModule,args:[{declarations:[i],imports:[n.CommonModule],exports:[i]}]}],e.ButtonComponent=i,e.ButtonModule=o,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/button",["exports","@angular/core","@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"].button={}),e.ng.core,e.ng.common)}(this,(function(e,t,n){"use strict";var i=function(){function e(){this.name="Enabled",this.type="Solid",this.size="Medium",this.width="",this.showIcon=!1,this.iconUrl="",this.iconPosition="Left",this.disabled=!1,this.disableLeftBorderRadius=!1,this.disableRightBorderRadius=!1,this.click=new t.EventEmitter}return e.prototype.ngOnInit=function(){},e.prototype.onClick=function(e){this.click.emit(e)},e}();i.decorators=[{type:t.Component,args:[{selector:"mis-button",template:"<button\n (click)=\"onClick($event);\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'solid': type === 'Solid',\n 'outline': type === 'Outline',\n 'text': type === 'Text',\n 'large': size === 'Large',\n 'medium': size === 'Medium',\n 'small': size === 'Small',\n 'large-mobile': size === 'Large-M',\n 'small-mobile': size === 'Small-M'\n }\"\n [ngStyle]=\"{\n 'border-top-left-radius': disableLeftBorderRadius ? '0px': '',\n 'border-bottom-left-radius': disableLeftBorderRadius ? '0px': '',\n 'border-top-right-radius': disableRightBorderRadius ? '0px': '',\n 'border-bottom-right-radius': disableRightBorderRadius ? '0px': '',\n 'width': width\n }\"\n>\n <span id=\"left-icon\" *ngIf=\"showIcon && iconPosition === 'Left'\">\n <img [src]=\"iconUrl\" alt=\"\">\n </span>\n {{name}}\n <span id=\"right-icon\" *ngIf=\"showIcon && iconPosition === 'Right'\">\n <img [src]=\"iconUrl\" alt=\"\">\n </span>\n</button>\n",styles:["button{font-family:Lato,sans-serif!important;border:none;padding:0;margin:0;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#181f33;background-color:#fff}.solid{color:#fff;background:#0937b2}.solid:hover:enabled{background:#062a99}.solid:active:enabled{background:#041f80}.solid:disabled{color:#929dab;background:#f5f5f5}.outline{border:1px solid #0937b2;color:#0937b2;background:#fff}.outline:hover:enabled{background:#f0f3fa}.outline:active:enabled{background:#dae1f3}.outline:disabled{color:#929dab;border:1px solid #929dab}.text{color:#181f33;background:#fff}.text:hover:enabled{background:#f0f3fa}.text:active:enabled{background:#dae1f3}.text:disabled{color:#929dab}.large{height:56px;padding:16px;border-radius:10px;font-weight:700;letter-spacing:.5px}.large,.medium{font-style:normal;font-size:16px;line-height:24px}.medium{height:44px;padding:10px 16px;border-radius:8px;font-weight:400;letter-spacing:.2px}.small{height:32px;padding:6px 16px;border-radius:6px;font-weight:400;letter-spacing:.25px}.large-mobile,.small{font-style:normal;font-size:14px;line-height:20px}.large-mobile{height:44px;padding:12px}.large-mobile,.small-mobile{border-radius:8px;font-weight:700;letter-spacing:.1px}.small-mobile{height:32px;padding:6px 12px;font-style:normal;font-size:14px;line-height:20px}span{display:flex;justify-content:center;align-items:center}#left-icon{margin-right:8px}#right-icon{margin-left:8px}"]}]}],i.ctorParameters=function(){return[]},i.propDecorators={name:[{type:t.Input}],type:[{type:t.Input}],size:[{type:t.Input}],width:[{type:t.Input}],showIcon:[{type:t.Input}],iconUrl:[{type:t.Input}],iconPosition:[{type:t.Input}],disabled:[{type:t.Input}],disableLeftBorderRadius:[{type:t.Input}],disableRightBorderRadius:[{type:t.Input}],click:[{type:t.Output}]};var o=function(){function e(e,t){this.el=e,this.renderer=t,this.type="none",this.size="md",this.elementClass="mis-btn"}return e.prototype.ngAfterViewInit=function(){this.bindTypeClass(),this.bindSizeClass()},e.prototype.bindTypeClass=function(){var e="";switch(this.type){case"primary":e="mis-primary";break;case"outline":e="mis-outline";break;default:e="mis-none"}this.renderer.addClass(this.el.nativeElement,e)},e.prototype.bindSizeClass=function(){var e="";switch(this.size){case"lg":e="mis-btn-lg";break;case"sm":e="mis-btn-sm";break;default:e="mis-btn-md"}this.renderer.addClass(this.el.nativeElement,e)},e}();o.decorators=[{type:t.Directive,args:[{selector:"[mis-button]"}]}],o.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},o.propDecorators={type:[{type:t.Input}],size:[{type:t.Input}],elementClass:[{type:t.HostBinding,args:["class"]}]};var r=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[]}},e}();r.decorators=[{type:t.NgModule,args:[{declarations:[i,o],imports:[n.CommonModule],exports:[i,o]}]}],e.ButtonComponent=i,e.ButtonModule=r,e.ɵa=o,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=mis-crystal-design-system-button.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../projects/mis-components/button/button.component.ts","../../../projects/mis-components/button/button.module.ts"],"names":["ButtonComponent","this","name","type","size","width","showIcon","iconUrl","iconPosition","disabled","disableLeftBorderRadius","disableRightBorderRadius","click","EventEmitter","prototype","ngOnInit","onClick","event","emit","Component","args","selector","template","Input","Output","ButtonModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","exports"],"mappings":"mfAyBE,SAAAA,IAhBSC,KAAAC,KAAe,UACfD,KAAAE,KAAqC,QACrCF,KAAAG,KAA6D,SAC7DH,KAAAI,MAAgB,GAEhBJ,KAAAK,UAAoB,EACpBL,KAAAM,QAAkB,GAClBN,KAAAO,aAAiC,OAEjCP,KAAAQ,UAAoB,EACpBR,KAAAS,yBAAmC,EACnCT,KAAAU,0BAAoC,EAGnCV,KAAAW,MAAQ,IAAIC,EAAAA,oBAItBb,EAAAc,UAAAC,SAAA,aAEAf,EAAAc,UAAAE,QAAA,SAAQC,GACNhB,KAAKW,MAAMM,KAAKD,6BA5BnBE,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,aACVC,SAAA,y7EAKCC,EAAAA,oBACAA,EAAAA,oBACAA,EAAAA,qBACAA,EAAAA,wBAEAA,EAAAA,uBACAA,EAAAA,4BACAA,EAAAA,wBAEAA,EAAAA,uCACAA,EAAAA,wCACAA,EAAAA,qBAGAC,EAAAA,2BCbH,SAAAC,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAcG,UAAW,8BAP/CC,EAAAA,SAAQT,KAAA,CAAC,CACRU,aAAc,CAAC9B,GACf+B,QAAS,CAACC,EAAAA,cACVC,QAAS,CAACjC","sourcesContent":["import {Component, Input, OnInit, Output, EventEmitter, ContentChild, TemplateRef} from '@angular/core';\n\n@Component({\n selector: 'mis-button',\n templateUrl: './button.component.html',\n styleUrls: ['./button.component.scss']\n})\nexport class ButtonComponent implements OnInit{\n\n @Input() name: string = 'Enabled'\n @Input() type: 'Solid' | 'Outline' | 'Text' = 'Solid'\n @Input() size: 'Small' | 'Medium' | 'Large' | 'Small-M' | 'Large-M' = 'Medium'\n @Input() width: string = ''\n\n @Input() showIcon: boolean = false\n @Input() iconUrl: string = ''\n @Input() iconPosition: 'Left' | 'Right' = 'Left'\n\n @Input() disabled: boolean = false\n @Input() disableLeftBorderRadius: boolean = false\n @Input() disableRightBorderRadius: boolean = false\n\n /** Emits event when button is clicked */\n @Output() click = new EventEmitter<any>()\n\n constructor(){}\n\n ngOnInit(){}\n\n onClick(event){\n this.click.emit(event)\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { ButtonComponent } from './button.component';\n\n@NgModule({\n declarations: [ButtonComponent],\n imports: [CommonModule],\n exports: [ButtonComponent]\n})\nexport class ButtonModule {\n static forRoot(): ModuleWithProviders<ButtonModule> {\n return { ngModule: ButtonModule, providers: [] };\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../projects/mis-components/button/button.component.ts","../../../projects/mis-components/button/button.directive.ts","../../../projects/mis-components/button/button.module.ts"],"names":["ButtonComponent","this","name","type","size","width","showIcon","iconUrl","iconPosition","disabled","disableLeftBorderRadius","disableRightBorderRadius","click","EventEmitter","prototype","ngOnInit","onClick","event","emit","Component","args","selector","template","Input","Output","ButtonDirective","el","renderer","elementClass","ngAfterViewInit","bindTypeClass","bindSizeClass","className","addClass","nativeElement","Directive","ElementRef","Renderer2","HostBinding","ButtonModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","exports"],"mappings":"mfAyBE,SAAAA,IAhBSC,KAAAC,KAAe,UACfD,KAAAE,KAAqC,QACrCF,KAAAG,KAA6D,SAC7DH,KAAAI,MAAgB,GAEhBJ,KAAAK,UAAoB,EACpBL,KAAAM,QAAkB,GAClBN,KAAAO,aAAiC,OAEjCP,KAAAQ,UAAoB,EACpBR,KAAAS,yBAAmC,EACnCT,KAAAU,0BAAoC,EAGnCV,KAAAW,MAAQ,IAAIC,EAAAA,oBAItBb,EAAAc,UAAAC,SAAA,aAEAf,EAAAc,UAAAE,QAAA,SAAQC,GACNhB,KAAKW,MAAMM,KAAKD,6BA5BnBE,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,aACVC,SAAA,y7EAKCC,EAAAA,oBACAA,EAAAA,oBACAA,EAAAA,qBACAA,EAAAA,wBAEAA,EAAAA,uBACAA,EAAAA,4BACAA,EAAAA,wBAEAA,EAAAA,uCACAA,EAAAA,wCACAA,EAAAA,qBAGAC,EAAAA,2BCND,SAAAC,EAAoBC,EAAwBC,GAAxB1B,KAAAyB,GAAAA,EAAwBzB,KAAA0B,SAAAA,EAJnC1B,KAAAE,KAAuC,OACvCF,KAAAG,KAA2B,KACdH,KAAA2B,aAAe,iBAIrCH,EAAAX,UAAAe,gBAAA,WACE5B,KAAK6B,gBACL7B,KAAK8B,iBAGCN,EAAAX,UAAAgB,cAAA,WACN,IAAIE,EAAY,GAChB,OAAQ/B,KAAKE,MACX,IAAK,UACH6B,EAAY,cACZ,MACF,IAAK,UACHA,EAAY,cACZ,MACF,QACEA,EAAY,WAEhB/B,KAAK0B,SAASM,SAAShC,KAAKyB,GAAGQ,cAAeF,IAGxCP,EAAAX,UAAAiB,cAAA,WACN,IAAIC,EAAY,GAChB,OAAQ/B,KAAKG,MACX,IAAK,KACH4B,EAAY,aACZ,MACF,IAAK,KACHA,EAAY,aACZ,MACF,QACEA,EAAY,aAEhB/B,KAAK0B,SAASM,SAAShC,KAAKyB,GAAGQ,cAAeF,6BA1CjDG,EAAAA,UAASf,KAAA,CAAC,CACTC,SAAU,4DAPVe,EAAAA,kBAGAC,EAAAA,2CAOCd,EAAAA,oBACAA,EAAAA,4BACAe,EAAAA,YAAWlB,KAAA,CAAC,6BCLf,SAAAmB,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAcG,UAAW,8BAP/CC,EAAAA,SAAQvB,KAAA,CAAC,CACRwB,aAAc,CAAC5C,EAAiByB,GAChCoB,QAAS,CAACC,EAAAA,cACVC,QAAS,CAAC/C,EAAiByB","sourcesContent":["import {Component, Input, OnInit, Output, EventEmitter, ContentChild, TemplateRef} from '@angular/core';\n\n@Component({\n selector: 'mis-button',\n templateUrl: './button.component.html',\n styleUrls: ['./button.component.scss']\n})\nexport class ButtonComponent implements OnInit{\n\n @Input() name: string = 'Enabled'\n @Input() type: 'Solid' | 'Outline' | 'Text' = 'Solid'\n @Input() size: 'Small' | 'Medium' | 'Large' | 'Small-M' | 'Large-M' = 'Medium'\n @Input() width: string = ''\n\n @Input() showIcon: boolean = false\n @Input() iconUrl: string = ''\n @Input() iconPosition: 'Left' | 'Right' = 'Left'\n\n @Input() disabled: boolean = false\n @Input() disableLeftBorderRadius: boolean = false\n @Input() disableRightBorderRadius: boolean = false\n\n /** Emits event when button is clicked */\n @Output() click = new EventEmitter<any>()\n\n constructor(){}\n\n ngOnInit(){}\n\n onClick(event){\n this.click.emit(event)\n }\n}\n","import {\n AfterViewInit,\n Directive,\n ElementRef,\n HostBinding,\n Input,\n Renderer2,\n} from '@angular/core';\n\n@Directive({\n selector: '[mis-button]',\n})\nexport class ButtonDirective implements AfterViewInit {\n @Input() type: 'primary' | 'outline' | 'none' = 'none';\n @Input() size: 'sm' | 'md' | 'lg' = 'md';\n @HostBinding('class') elementClass = 'mis-btn';\n\n constructor(private el: ElementRef, private renderer: Renderer2) { }\n\n ngAfterViewInit(): void {\n this.bindTypeClass();\n this.bindSizeClass();\n }\n\n private bindTypeClass(): void {\n let className = '';\n switch (this.type) {\n case 'primary':\n className = 'mis-primary';\n break;\n case 'outline':\n className = 'mis-outline';\n break;\n default:\n className = 'mis-none';\n }\n this.renderer.addClass(this.el.nativeElement, className);\n }\n\n private bindSizeClass(): void {\n let className = '';\n switch (this.size) {\n case 'lg':\n className = 'mis-btn-lg';\n break;\n case 'sm':\n className = 'mis-btn-sm';\n break;\n default:\n className = 'mis-btn-md';\n }\n this.renderer.addClass(this.el.nativeElement, className);\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ButtonDirective } from './button.directive';\nimport { ButtonComponent } from './button.component';\n\n@NgModule({\n declarations: [ButtonComponent, ButtonDirective],\n imports: [CommonModule],\n exports: [ButtonComponent, ButtonDirective]\n})\nexport class ButtonModule {\n static forRoot(): ModuleWithProviders<ButtonModule> {\n return { ngModule: ButtonModule, providers: [] };\n }\n}\n"]}
@@ -13135,7 +13135,9 @@
13135
13135
  MisDatePickerStore,
13136
13136
  MisDatePickerActions,
13137
13137
  MisDatePickerEffects,
13138
- BsLocaleService
13138
+ BsLocaleService,
13139
+ MisDatePickerConfig,
13140
+ MisDateRangePickerConfig
13139
13141
  ]
13140
13142
  };
13141
13143
  };