mis-crystal-design-system 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/action-list/index.d.ts +1 -1
  2. package/action-list/public_api.d.ts +2 -2
  3. package/async-search-dropdown/async-dropdown.component.d.ts +4 -4
  4. package/async-search-dropdown/index.d.ts +1 -1
  5. package/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.metadata.json +1 -1
  6. package/async-search-dropdown/public_api.d.ts +2 -2
  7. package/bundles/mis-crystal-design-system-action-list.umd.js +1 -1
  8. package/bundles/mis-crystal-design-system-action-list.umd.js.map +1 -1
  9. package/bundles/mis-crystal-design-system-action-list.umd.min.js +1 -1
  10. package/bundles/mis-crystal-design-system-action-list.umd.min.js.map +1 -1
  11. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js +15 -15
  12. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js.map +1 -1
  13. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js +1 -1
  14. package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js.map +1 -1
  15. package/bundles/mis-crystal-design-system-button.umd.js +25 -25
  16. package/bundles/mis-crystal-design-system-button.umd.js.map +1 -1
  17. package/bundles/mis-crystal-design-system-button.umd.min.js +1 -1
  18. package/bundles/mis-crystal-design-system-button.umd.min.js.map +1 -1
  19. package/bundles/mis-crystal-design-system-checkbox.umd.js +5 -6
  20. package/bundles/mis-crystal-design-system-checkbox.umd.js.map +1 -1
  21. package/bundles/mis-crystal-design-system-checkbox.umd.min.js.map +1 -1
  22. package/bundles/mis-crystal-design-system-chip.umd.js +6 -7
  23. package/bundles/mis-crystal-design-system-chip.umd.js.map +1 -1
  24. package/bundles/mis-crystal-design-system-chip.umd.min.js +1 -1
  25. package/bundles/mis-crystal-design-system-chip.umd.min.js.map +1 -1
  26. package/bundles/mis-crystal-design-system-datepicker_v2.umd.js +22 -19
  27. package/bundles/mis-crystal-design-system-datepicker_v2.umd.js.map +1 -1
  28. package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js +1 -1
  29. package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js.map +1 -1
  30. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js +26 -49
  31. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js.map +1 -1
  32. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js +1 -1
  33. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js.map +1 -1
  34. package/bundles/mis-crystal-design-system-drawer.umd.js +9 -12
  35. package/bundles/mis-crystal-design-system-drawer.umd.js.map +1 -1
  36. package/bundles/mis-crystal-design-system-drawer.umd.min.js.map +1 -1
  37. package/bundles/mis-crystal-design-system-dropdown.umd.js.map +1 -1
  38. package/bundles/mis-crystal-design-system-dropdown.umd.min.js.map +1 -1
  39. package/bundles/mis-crystal-design-system-fab.umd.js +11 -14
  40. package/bundles/mis-crystal-design-system-fab.umd.js.map +1 -1
  41. package/bundles/mis-crystal-design-system-fab.umd.min.js.map +1 -1
  42. package/bundles/mis-crystal-design-system-input.umd.js +7 -7
  43. package/bundles/mis-crystal-design-system-input.umd.js.map +1 -1
  44. package/bundles/mis-crystal-design-system-input.umd.min.js +1 -1
  45. package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -1
  46. package/bundles/mis-crystal-design-system-loader.umd.js +3 -4
  47. package/bundles/mis-crystal-design-system-loader.umd.js.map +1 -1
  48. package/bundles/mis-crystal-design-system-loader.umd.min.js +1 -1
  49. package/bundles/mis-crystal-design-system-loader.umd.min.js.map +1 -1
  50. package/bundles/mis-crystal-design-system-modal.umd.js +8 -12
  51. package/bundles/mis-crystal-design-system-modal.umd.js.map +1 -1
  52. package/bundles/mis-crystal-design-system-modal.umd.min.js.map +1 -1
  53. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.js.map +1 -1
  54. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.min.js.map +1 -1
  55. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.js.map +1 -1
  56. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.min.js.map +1 -1
  57. package/bundles/mis-crystal-design-system-radio-button.umd.js +6 -7
  58. package/bundles/mis-crystal-design-system-radio-button.umd.js.map +1 -1
  59. package/bundles/mis-crystal-design-system-radio-button.umd.min.js +1 -1
  60. package/bundles/mis-crystal-design-system-radio-button.umd.min.js.map +1 -1
  61. package/bundles/mis-crystal-design-system-switch.umd.js +3 -4
  62. package/bundles/mis-crystal-design-system-switch.umd.js.map +1 -1
  63. package/bundles/mis-crystal-design-system-switch.umd.min.js +1 -1
  64. package/bundles/mis-crystal-design-system-switch.umd.min.js.map +1 -1
  65. package/bundles/mis-crystal-design-system-table.umd.js +40 -58
  66. package/bundles/mis-crystal-design-system-table.umd.js.map +1 -1
  67. package/bundles/mis-crystal-design-system-table.umd.min.js +1 -1
  68. package/bundles/mis-crystal-design-system-table.umd.min.js.map +1 -1
  69. package/bundles/mis-crystal-design-system-toast.umd.js +28 -33
  70. package/bundles/mis-crystal-design-system-toast.umd.js.map +1 -1
  71. package/bundles/mis-crystal-design-system-toast.umd.min.js +1 -1
  72. package/bundles/mis-crystal-design-system-toast.umd.min.js.map +1 -1
  73. package/bundles/mis-crystal-design-system.umd.js.map +1 -1
  74. package/button/button.component.d.ts +4 -4
  75. package/button/button.directive.d.ts +3 -3
  76. package/button/button.directive.scss +1 -1
  77. package/button/button.module.d.ts +1 -1
  78. package/button/index.d.ts +1 -1
  79. package/button/mis-crystal-design-system-button.metadata.json +1 -1
  80. package/button/public_api.d.ts +2 -2
  81. package/checkbox/checkbox.component.d.ts +3 -3
  82. package/checkbox/checkbox.module.d.ts +1 -1
  83. package/checkbox/index.d.ts +1 -1
  84. package/checkbox/mis-crystal-design-system-checkbox.metadata.json +1 -1
  85. package/checkbox/public_api.d.ts +2 -2
  86. package/chip/chip.component.d.ts +2 -2
  87. package/chip/chip.module.d.ts +1 -1
  88. package/chip/index.d.ts +1 -1
  89. package/chip/mis-crystal-design-system-chip.metadata.json +1 -1
  90. package/chip/public_api.d.ts +2 -2
  91. package/datepicker_v2/index.d.ts +1 -1
  92. package/datepicker_v2/mis-crystal-design-system-datepicker_v2.metadata.json +1 -1
  93. package/datepicker_v2/public_api.d.ts +3 -3
  94. package/daterangepicker_v2/index.d.ts +1 -1
  95. package/daterangepicker_v2/mis-crystal-design-system-daterangepicker_v2.metadata.json +1 -1
  96. package/daterangepicker_v2/public_api.d.ts +3 -3
  97. package/drawer/index.d.ts +1 -1
  98. package/drawer/mis-crystal-design-system-drawer.metadata.json +1 -1
  99. package/drawer/public_api.d.ts +4 -4
  100. package/dropdown/dropdown.module.d.ts +1 -1
  101. package/dropdown/index.d.ts +1 -1
  102. package/dropdown/mis-crystal-design-system-dropdown.metadata.json +1 -1
  103. package/dropdown/public_api.d.ts +2 -2
  104. package/esm2015/action-list/action-list.component.js +2 -2
  105. package/esm2015/action-list/index.js +2 -2
  106. package/esm2015/action-list/public_api.js +3 -3
  107. package/esm2015/async-search-dropdown/async-dropdown.component.js +25 -25
  108. package/esm2015/async-search-dropdown/async-dropdown.module.js +7 -7
  109. package/esm2015/async-search-dropdown/index.js +2 -2
  110. package/esm2015/async-search-dropdown/public_api.js +3 -3
  111. package/esm2015/button/button.component.js +10 -10
  112. package/esm2015/button/button.directive.js +19 -19
  113. package/esm2015/button/button.module.js +5 -5
  114. package/esm2015/button/index.js +2 -2
  115. package/esm2015/button/public_api.js +3 -3
  116. package/esm2015/checkbox/checkbox.component.js +8 -9
  117. package/esm2015/checkbox/checkbox.module.js +5 -5
  118. package/esm2015/checkbox/index.js +2 -2
  119. package/esm2015/checkbox/public_api.js +3 -3
  120. package/esm2015/chip/chip.component.js +8 -9
  121. package/esm2015/chip/chip.module.js +4 -4
  122. package/esm2015/chip/index.js +2 -2
  123. package/esm2015/chip/public_api.js +3 -3
  124. package/esm2015/datepicker_v2/datepicker-constants.js +2 -2
  125. package/esm2015/datepicker_v2/datepicker.module.js +3 -3
  126. package/esm2015/datepicker_v2/index.js +2 -2
  127. package/esm2015/datepicker_v2/models/dp-config.model.js +1 -1
  128. package/esm2015/datepicker_v2/public_api.js +3 -3
  129. package/esm2015/datepicker_v2/tz-dp-container/tz-dp-container.component.js +12 -9
  130. package/esm2015/datepicker_v2/utils/index.js +13 -13
  131. package/esm2015/daterangepicker_v2/daterangepicker-constants.js +2 -2
  132. package/esm2015/daterangepicker_v2/daterangepicker.module.js +2 -2
  133. package/esm2015/daterangepicker_v2/index.js +2 -2
  134. package/esm2015/daterangepicker_v2/public_api.js +3 -3
  135. package/esm2015/daterangepicker_v2/tz-drp-container/tz-drp-container.component.js +15 -38
  136. package/esm2015/daterangepicker_v2/utils/index.js +13 -13
  137. package/esm2015/drawer/drawer-body/drawer-body.component.js +4 -7
  138. package/esm2015/drawer/drawer.module.js +4 -4
  139. package/esm2015/drawer/drawer.service.js +4 -4
  140. package/esm2015/drawer/index.js +2 -2
  141. package/esm2015/drawer/public_api.js +5 -5
  142. package/esm2015/dropdown/dropdown.module.js +5 -5
  143. package/esm2015/dropdown/index.js +2 -2
  144. package/esm2015/dropdown/public_api.js +3 -3
  145. package/esm2015/fab/fab.component.js +11 -14
  146. package/esm2015/fab/fab.module.js +3 -3
  147. package/esm2015/fab/index.js +2 -2
  148. package/esm2015/fab/public_api.js +3 -3
  149. package/esm2015/index.js +2 -2
  150. package/esm2015/input/directives/input/input.directive.js +7 -7
  151. package/esm2015/input/index.js +2 -2
  152. package/esm2015/input/mis-input.component.js +8 -8
  153. package/esm2015/input/mis-input.module.js +7 -7
  154. package/esm2015/input/public_api.js +4 -4
  155. package/esm2015/loader/index.js +2 -2
  156. package/esm2015/loader/loader.component.js +5 -6
  157. package/esm2015/loader/loader.module.js +4 -4
  158. package/esm2015/loader/public_api.js +3 -3
  159. package/esm2015/menu/index.js +2 -2
  160. package/esm2015/modal/index.js +2 -2
  161. package/esm2015/modal/modal.module.js +10 -14
  162. package/esm2015/modal/modal.service.js +3 -3
  163. package/esm2015/modal/module-wrapper/module-wrapper.component.js +4 -4
  164. package/esm2015/modal/public_api.js +5 -5
  165. package/esm2015/multi-select-dropdown/index.js +2 -2
  166. package/esm2015/multi-select-dropdown/multi-select-dropdown.module.js +7 -7
  167. package/esm2015/multi-select-dropdown/public_api.js +3 -3
  168. package/esm2015/nested-multi-select-dropdown/index.js +2 -2
  169. package/esm2015/nested-multi-select-dropdown/nested-multi-select-dropdown.module.js +7 -7
  170. package/esm2015/nested-multi-select-dropdown/public_api.js +3 -3
  171. package/esm2015/public-api.js +1 -1
  172. package/esm2015/radio-button/index.js +2 -2
  173. package/esm2015/radio-button/public_api.js +3 -3
  174. package/esm2015/radio-button/radio-button.component.js +9 -10
  175. package/esm2015/radio-button/radio-button.module.js +5 -5
  176. package/esm2015/switch/index.js +2 -2
  177. package/esm2015/switch/public_api.js +3 -3
  178. package/esm2015/switch/switch.component.js +6 -7
  179. package/esm2015/switch/switch.module.js +5 -5
  180. package/esm2015/table/custom-table-cell.directive.js +3 -3
  181. package/esm2015/table/filter/filter.component.js +11 -13
  182. package/esm2015/table/index.js +2 -2
  183. package/esm2015/table/public_api.js +5 -5
  184. package/esm2015/table/sub-table/sub-table.component.js +12 -13
  185. package/esm2015/table/table.component.js +21 -22
  186. package/esm2015/table/table.module.js +7 -21
  187. package/esm2015/toast/index.js +2 -2
  188. package/esm2015/toast/toast.component.js +12 -14
  189. package/esm2015/toast/toast.data.service.js +3 -3
  190. package/esm2015/toast/toast.module.js +9 -9
  191. package/esm2015/toast/toast.service.js +23 -26
  192. package/fab/index.d.ts +1 -1
  193. package/fab/mis-crystal-design-system-fab.metadata.json +1 -1
  194. package/fab/public_api.d.ts +2 -2
  195. package/fesm2015/mis-crystal-design-system-action-list.js +1 -1
  196. package/fesm2015/mis-crystal-design-system-action-list.js.map +1 -1
  197. package/fesm2015/mis-crystal-design-system-async-search-dropdown.js +20 -20
  198. package/fesm2015/mis-crystal-design-system-async-search-dropdown.js.map +1 -1
  199. package/fesm2015/mis-crystal-design-system-button.js +25 -25
  200. package/fesm2015/mis-crystal-design-system-button.js.map +1 -1
  201. package/fesm2015/mis-crystal-design-system-checkbox.js +5 -6
  202. package/fesm2015/mis-crystal-design-system-checkbox.js.map +1 -1
  203. package/fesm2015/mis-crystal-design-system-chip.js +6 -7
  204. package/fesm2015/mis-crystal-design-system-chip.js.map +1 -1
  205. package/fesm2015/mis-crystal-design-system-datepicker_v2.js +24 -21
  206. package/fesm2015/mis-crystal-design-system-datepicker_v2.js.map +1 -1
  207. package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js +28 -51
  208. package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js.map +1 -1
  209. package/fesm2015/mis-crystal-design-system-drawer.js +9 -12
  210. package/fesm2015/mis-crystal-design-system-drawer.js.map +1 -1
  211. package/fesm2015/mis-crystal-design-system-dropdown.js.map +1 -1
  212. package/fesm2015/mis-crystal-design-system-fab.js +11 -14
  213. package/fesm2015/mis-crystal-design-system-fab.js.map +1 -1
  214. package/fesm2015/mis-crystal-design-system-input.js +8 -8
  215. package/fesm2015/mis-crystal-design-system-input.js.map +1 -1
  216. package/fesm2015/mis-crystal-design-system-loader.js +3 -4
  217. package/fesm2015/mis-crystal-design-system-loader.js.map +1 -1
  218. package/fesm2015/mis-crystal-design-system-modal.js +8 -12
  219. package/fesm2015/mis-crystal-design-system-modal.js.map +1 -1
  220. package/fesm2015/mis-crystal-design-system-multi-select-dropdown.js.map +1 -1
  221. package/fesm2015/mis-crystal-design-system-nested-multi-select-dropdown.js.map +1 -1
  222. package/fesm2015/mis-crystal-design-system-radio-button.js +6 -7
  223. package/fesm2015/mis-crystal-design-system-radio-button.js.map +1 -1
  224. package/fesm2015/mis-crystal-design-system-switch.js +3 -4
  225. package/fesm2015/mis-crystal-design-system-switch.js.map +1 -1
  226. package/fesm2015/mis-crystal-design-system-table.js +42 -60
  227. package/fesm2015/mis-crystal-design-system-table.js.map +1 -1
  228. package/fesm2015/mis-crystal-design-system-toast.js +28 -33
  229. package/fesm2015/mis-crystal-design-system-toast.js.map +1 -1
  230. package/fesm2015/mis-crystal-design-system.js.map +1 -1
  231. package/index.d.ts +1 -1
  232. package/input/directives/input/input.directive.d.ts +3 -3
  233. package/input/index.d.ts +1 -1
  234. package/input/mis-crystal-design-system-input.metadata.json +1 -1
  235. package/input/mis-input.component.d.ts +4 -4
  236. package/input/public_api.d.ts +3 -3
  237. package/loader/index.d.ts +1 -1
  238. package/loader/loader.component.d.ts +1 -1
  239. package/loader/loader.module.d.ts +1 -1
  240. package/loader/mis-crystal-design-system-loader.metadata.json +1 -1
  241. package/loader/public_api.d.ts +2 -2
  242. package/menu/index.d.ts +1 -1
  243. package/modal/index.d.ts +1 -1
  244. package/modal/mis-crystal-design-system-modal.metadata.json +1 -1
  245. package/modal/modal.module.d.ts +1 -1
  246. package/modal/public_api.d.ts +4 -4
  247. package/multi-select-dropdown/index.d.ts +1 -1
  248. package/multi-select-dropdown/mis-crystal-design-system-multi-select-dropdown.metadata.json +1 -1
  249. package/multi-select-dropdown/multi-select-dropdown.module.d.ts +1 -1
  250. package/multi-select-dropdown/public_api.d.ts +2 -2
  251. package/nested-multi-select-dropdown/index.d.ts +1 -1
  252. package/nested-multi-select-dropdown/mis-crystal-design-system-nested-multi-select-dropdown.metadata.json +1 -1
  253. package/nested-multi-select-dropdown/nested-multi-select-dropdown.module.d.ts +1 -1
  254. package/nested-multi-select-dropdown/public_api.d.ts +2 -2
  255. package/package.json +1 -1
  256. package/radio-button/index.d.ts +1 -1
  257. package/radio-button/mis-crystal-design-system-radio-button.metadata.json +1 -1
  258. package/radio-button/public_api.d.ts +2 -2
  259. package/radio-button/radio-button.component.d.ts +2 -2
  260. package/radio-button/radio-button.module.d.ts +1 -1
  261. package/switch/index.d.ts +1 -1
  262. package/switch/mis-crystal-design-system-switch.metadata.json +1 -1
  263. package/switch/public_api.d.ts +2 -2
  264. package/switch/switch.component.d.ts +2 -2
  265. package/switch/switch.module.d.ts +1 -1
  266. package/table/custom-table-cell.directive.d.ts +1 -1
  267. package/table/filter/filter.component.d.ts +1 -1
  268. package/table/index.d.ts +1 -1
  269. package/table/mis-crystal-design-system-table.metadata.json +1 -1
  270. package/table/public_api.d.ts +7 -7
  271. package/table/sub-table/sub-table.component.d.ts +6 -6
  272. package/table/table.component.d.ts +6 -6
  273. package/toast/index.d.ts +1 -1
  274. package/toast/mis-crystal-design-system-toast.metadata.json +1 -1
  275. package/toast/toast.component.d.ts +1 -1
  276. package/toast/toast.module.d.ts +1 -1
  277. package/toast/toast.service.d.ts +3 -3
@@ -9,7 +9,7 @@
9
9
  var _this = this;
10
10
  this.overlay = overlay;
11
11
  this.viewContainerRef = viewContainerRef;
12
- this.placeholder = 'Select'; // placeholder for input
12
+ this.placeholder = "Select"; // placeholder for input
13
13
  this.debounceTime = 400; // wait time till which API call is paused
14
14
  this.minInputLength = 2; // min length after which API call is made
15
15
  this.multi = false; // maintain a list or emit value
@@ -31,7 +31,7 @@
31
31
  var _this = this;
32
32
  var _a, _b;
33
33
  if (this.multi && !this.uniqueKey) {
34
- throw new Error('[uniqueKey] required in multi mode.');
34
+ throw new Error("[uniqueKey] required in multi mode.");
35
35
  }
36
36
  if (this.disabled) {
37
37
  this.searchInput.disable();
@@ -70,16 +70,16 @@
70
70
  .position()
71
71
  .flexibleConnectedTo(origin)
72
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' }),
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
75
  ])
76
76
  .withPush(true);
77
77
  var configs = new overlay.OverlayConfig({
78
78
  hasBackdrop: true,
79
- backdropClass: 'cdk-overlay-transparent-backdrop',
79
+ backdropClass: "cdk-overlay-transparent-backdrop",
80
80
  scrollStrategy: this.overlay.scrollStrategies.reposition(),
81
81
  positionStrategy: positionStrategy,
82
- width: origin.clientWidth,
82
+ width: origin.clientWidth
83
83
  });
84
84
  this.overlayRef = this.overlay.create(configs);
85
85
  this.overlayRef.attach(new portal.TemplatePortal(template, this.viewContainerRef));
@@ -123,7 +123,7 @@
123
123
  _this.input.nativeElement.scrollIntoView();
124
124
  }, 10);
125
125
  }
126
- this.searchInput.patchValue('');
126
+ this.searchInput.patchValue("");
127
127
  this.data = [];
128
128
  }
129
129
  this.closeDropdown();
@@ -136,7 +136,7 @@
136
136
  this.selections.delete(item[this.uniqueKey]);
137
137
  this.setControlValue(this.selectedItems);
138
138
  // tslint:disable-next-line
139
- this.input['nativeElement'].focus();
139
+ this.input["nativeElement"].focus();
140
140
  };
141
141
  AsyncDropdownComponent.prototype.setControlValue = function (value) {
142
142
  var _a;
@@ -157,8 +157,8 @@
157
157
  }());
158
158
  AsyncDropdownComponent.decorators = [
159
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",
160
+ selector: "mis-async-search-dropdown",
161
+ template: "<div class=\"dd-wrapper\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\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 tabindex=\"0\" type=\"text\" class=\"black-text\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" />\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\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n</ng-template>\n",
162
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
163
  },] }
164
164
  ];
@@ -178,10 +178,10 @@
178
178
  control: [{ type: core.Input }],
179
179
  disabled: [{ type: core.Input }],
180
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 },] }],
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
185
  onSelect: [{ type: core.Output }]
186
186
  };
187
187
 
@@ -194,7 +194,7 @@
194
194
  { type: core.NgModule, args: [{
195
195
  declarations: [AsyncDropdownComponent],
196
196
  imports: [common.CommonModule, overlay.OverlayModule, forms.ReactiveFormsModule, forms.FormsModule],
197
- exports: [AsyncDropdownComponent],
197
+ exports: [AsyncDropdownComponent]
198
198
  },] }
199
199
  ];
200
200
 
@@ -1 +1 @@
1
- {"version":3,"file":"mis-crystal-design-system-async-search-dropdown.umd.js","sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts","../../../projects/mis-components/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.ts"],"sourcesContent":["import {\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;;YA1B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tC,OAAO,EAAE,CAACC,mBAAY,EAAEC,qBAAa,EAAEC,yBAAmB,EAAEC,iBAAW,CAAC;oBACxE,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBAClC;;;ICVD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mis-crystal-design-system-async-search-dropdown.umd.js","sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts","../../../projects/mis-components/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.ts"],"sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport {\n 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(private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\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(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n\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(this.handleControlChanges);\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(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n}\n","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":";;;;;;;QA8BE,gCAAoB,OAAgB,EAAU,gBAAkC;YAAhF,iBAAoF;YAAhE,YAAO,GAAP,OAAO,CAAS;YAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;YAKvE,gBAAW,GAAG,QAAQ,CAAC;YACvB,iBAAY,GAAG,GAAG,CAAC;YACnB,mBAAc,GAAG,CAAC,CAAC;YACnB,UAAK,GAAG,KAAK,CAAC;;YAWb,aAAQ,GAA0C,IAAIA,iBAAY,CAAC,IAAI,CAAC,CAAC;YACnF,gBAAW,GAAgB,IAAIC,iBAAW,EAAE,CAAC;YAC7C,SAAI,GAAgB,EAAE,CAAC;YACvB,WAAM,GAAG,KAAK,CAAC;;YAEf,eAAU,GAAqB,IAAI,GAAG,EAAE,CAAC;YA6CjC,yBAAoB,GAAG,UAAC,MAAmB;gBACjD,MAAM,CAAC,OAAO,CAAC,UAAA,EAAE;oBACf,KAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;iBAC3B,CAAC,CAAC;;aAEJ,CAAC;SA1EkF;QA6BpF,yCAAQ,GAAR;YAAA,iBAyBC;;YAxBC,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,OAA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==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})}));
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 class="dd-wrapper" [ngClass]="{ opened: opened, disabled: disabled, readonly: readonly }" #ddBtn>\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 tabindex="0" type="text" class="black-text" #input [placeholder]="placeholder" [formControl]="searchInput" />\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\n *ngIf="customItem; else standardItem"\n [ngTemplateOutlet]="customItem"\n [ngTemplateOutletContext]="{ $implicit: item }"\n ></ng-container>\n <ng-template #standardItem>\n <div class="item">\n <div class="value">\n <div class="primary">\n {{ item[displayKey] }}\n </div>\n <div class="secondary">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n</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
2
  //# sourceMappingURL=mis-crystal-design-system-async-search-dropdown.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../projects/mis-components/async-search-dropdown/async-dropdown.component.ts","../../../projects/mis-components/async-search-dropdown/async-dropdown.module.ts"],"names":["AsyncDropdownComponent","overlay","viewContainerRef","_this","this","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,kBAAU,IAAAD,OAAA,EAAAA,EAAEE,gBAAiBH,EAAKL,OAAS,GACnD9B,EAAKuC,aAAavC,EAAKwC,GAAIxC,EAAKyC,OAAOC,sBAI/B,QAAhBN,EAAInC,KAAK0C,eAAO,IAAAP,OAAA,EAAAA,EAAEQ,QAChB3C,KAAKa,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AAC,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"]}
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":"2xBA8BE,SAAAA,EAAoBC,EAA0BC,GAA9C,IAAAC,EAAAC,KAAoBA,KAAAH,QAAAA,EAA0BG,KAAAF,iBAAAA,EAKrCE,KAAAC,YAAc,SACdD,KAAAE,aAAe,IACfF,KAAAG,eAAiB,EACjBH,KAAAI,OAAQ,EAWPJ,KAAAK,SAAkD,IAAIC,EAAAA,cAAa,GAC7EN,KAAAO,YAA2B,IAAIC,EAAAA,YAC/BR,KAAAS,KAAoB,GACpBT,KAAAU,QAAS,EAETV,KAAAW,WAA+B,IAAIC,IA6C3BZ,KAAAa,qBAAuB,SAACC,GAC9BA,EAAOC,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KkF,eAE1BlF,KAAKoF,MAAqB,cAAEC,SAGtBzF,EAAAsB,UAAA+D,gBAAA,SAAgBtC,SACtB3C,KAAKK,SAASuF,KAAKjD,GACP,QAAZR,EAAAnC,KAAK0C,eAAO,IAAAP,GAAAA,EAAEoD,WAAW5C,EAAO,CAAE8C,WAAW,KAM/CI,OAAAC,eAAIlG,EAAAsB,UAAA,gBAAa,KAAjB,WACE,OAAO6E,MAAMC,KAAKhG,KAAKW,WAAWG,oEArKrCmF,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,4BACVhD,SAAA,quGA1B+BiD,EAAAA,eAe/BC,EAAAA,wDAiBCC,EAAAA,0BACAA,EAAAA,mCACAA,EAAAA,2BACAA,EAAAA,4BACAA,EAAAA,8BACAA,EAAAA,qBACAA,EAAAA,yBACAA,EAAAA,uBACAA,EAAAA,wBACAA,EAAAA,wBACAA,EAAAA,sBACAC,EAAAA,UAASL,KAAA,CAAC,QAAS,CAAEM,QAAQ,mBAC7BD,EAAAA,UAASL,KAAA,CAAC,QAAS,CAAEM,QAAQ,gBAC7BD,EAAAA,UAASL,KAAA,CAAC,KAAM,CAAEM,QAAQ,wBAC1BC,EAAAA,aAAYP,KAAA,CAAC,gBAAiB,CAAEM,QAAQ,sBAGxCE,EAAAA,gBCtCH,iCALCC,EAAAA,SAAQT,KAAA,CAAC,CACRU,aAAc,CAAChH,GACfiH,QAAS,CAACC,EAAAA,aAAcC,EAAAA,cAAeC,EAAAA,oBAAqBC,EAAAA,aAC5DC,QAAS,CAACtH","sourcesContent":["import { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } 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(private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\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(true); // emit selected values\n searchInput: FormControl = new FormControl();\n data: IListData[] = [];\n opened = false;\n // tslint:disable-next-line\n selections: Map<string, any> = new Map();\n private searchSubscription: Subscription;\n private overlayRef: OverlayRef;\n controlSubscription: Subscription | undefined;\n\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(this.handleControlChanges);\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(template: TemplateRef<Element>, origin: HTMLElement): void {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(origin)\n .withPositions([\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" })\n ])\n .withPush(true);\n\n const configs = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n positionStrategy,\n width: origin.clientWidth\n });\n this.overlayRef = this.overlay.create(configs);\n this.overlayRef.attach(new TemplatePortal(template, this.viewContainerRef));\n this.overlayRef.backdropClick().subscribe(res => {\n this.closeDropdown();\n });\n }\n\n /**\n * closes the dropdown\n */\n closeDropdown(): void {\n this.opened = false;\n this.overlayRef?.detach();\n this.data = [];\n }\n\n /**\n *\n * @param item item to select\n * if item property disabled is set to true, selection will be disabled\n * @param effectedFromOutside set to true if calling from parent component, if true will focus on search input\n */\n selectData(item: IListData, effectedFromOutside = true): void {\n if (item.disabled) {\n return;\n }\n if (!this.multi) {\n this.searchInput.patchValue(item[this.displayKey], { emitEvent: false });\n this.setControlValue(item);\n } else {\n if (!this.selections.has(item[this.uniqueKey])) {\n this.selections.set(item[this.uniqueKey], item);\n }\n this.setControlValue(this.selectedItems);\n if (!effectedFromOutside) {\n setTimeout(() => {\n this.input.nativeElement.focus();\n this.input.nativeElement.scrollIntoView();\n }, 10);\n }\n this.searchInput.patchValue(\"\");\n this.data = [];\n }\n this.closeDropdown();\n }\n\n /**\n *\n * @param item remove item from selected list\n */\n removeItem(item: IListData): void {\n this.selections.delete(item[this.uniqueKey]);\n this.setControlValue(this.selectedItems);\n // tslint:disable-next-line\n this.input[\"nativeElement\"].focus();\n }\n\n private setControlValue(value: IListData): void {\n this.onSelect.emit(value);\n this.control?.patchValue(value, { emitEvent: false });\n }\n\n /**\n * @returns list of selected items\n */\n get selectedItems(): Array<IListData> {\n return Array.from(this.selections.values());\n }\n}\n","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"]}
@@ -6,13 +6,13 @@
6
6
 
7
7
  var ButtonComponent = /** @class */ (function () {
8
8
  function ButtonComponent() {
9
- this.name = 'Enabled';
10
- this.type = 'Solid';
11
- this.size = 'Medium';
12
- this.width = '';
9
+ this.name = "Enabled";
10
+ this.type = "Solid";
11
+ this.size = "Medium";
12
+ this.width = "";
13
13
  this.showIcon = false;
14
- this.iconUrl = '';
15
- this.iconPosition = 'Left';
14
+ this.iconUrl = "";
15
+ this.iconPosition = "Left";
16
16
  this.disabled = false;
17
17
  this.disableLeftBorderRadius = false;
18
18
  this.disableRightBorderRadius = false;
@@ -27,8 +27,8 @@
27
27
  }());
28
28
  ButtonComponent.decorators = [
29
29
  { type: core.Component, args: [{
30
- selector: 'mis-button',
31
- 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",
30
+ selector: "mis-button",
31
+ 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",
32
32
  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}"]
33
33
  },] }
34
34
  ];
@@ -51,39 +51,39 @@
51
51
  function ButtonDirective(el, renderer) {
52
52
  this.el = el;
53
53
  this.renderer = renderer;
54
- this.type = 'none';
55
- this.size = 'md';
56
- this.elementClass = 'mis-btn';
54
+ this.type = "none";
55
+ this.size = "md";
56
+ this.elementClass = "mis-btn";
57
57
  }
58
58
  ButtonDirective.prototype.ngAfterViewInit = function () {
59
59
  this.bindTypeClass();
60
60
  this.bindSizeClass();
61
61
  };
62
62
  ButtonDirective.prototype.bindTypeClass = function () {
63
- var className = '';
63
+ var className = "";
64
64
  switch (this.type) {
65
- case 'primary':
66
- className = 'mis-primary';
65
+ case "primary":
66
+ className = "mis-primary";
67
67
  break;
68
- case 'outline':
69
- className = 'mis-outline';
68
+ case "outline":
69
+ className = "mis-outline";
70
70
  break;
71
71
  default:
72
- className = 'mis-none';
72
+ className = "mis-none";
73
73
  }
74
74
  this.renderer.addClass(this.el.nativeElement, className);
75
75
  };
76
76
  ButtonDirective.prototype.bindSizeClass = function () {
77
- var className = '';
77
+ var className = "";
78
78
  switch (this.size) {
79
- case 'lg':
80
- className = 'mis-btn-lg';
79
+ case "lg":
80
+ className = "mis-btn-lg";
81
81
  break;
82
- case 'sm':
83
- className = 'mis-btn-sm';
82
+ case "sm":
83
+ className = "mis-btn-sm";
84
84
  break;
85
85
  default:
86
- className = 'mis-btn-md';
86
+ className = "mis-btn-md";
87
87
  }
88
88
  this.renderer.addClass(this.el.nativeElement, className);
89
89
  };
@@ -91,7 +91,7 @@
91
91
  }());
92
92
  ButtonDirective.decorators = [
93
93
  { type: core.Directive, args: [{
94
- selector: '[mis-button]',
94
+ selector: "[mis-button]"
95
95
  },] }
96
96
  ];
97
97
  ButtonDirective.ctorParameters = function () { return [
@@ -101,7 +101,7 @@
101
101
  ButtonDirective.propDecorators = {
102
102
  type: [{ type: core.Input }],
103
103
  size: [{ type: core.Input }],
104
- elementClass: [{ type: core.HostBinding, args: ['class',] }]
104
+ elementClass: [{ type: core.HostBinding, args: ["class",] }]
105
105
  };
106
106
 
107
107
  var ButtonModule = /** @class */ (function () {
@@ -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.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,UAAK;+BACLA,UAAK;2BAELA,UAAK;0CACLA,UAAK;2CACLA,UAAK;wBAGLC,WAAM;;;;QCNP,yBAAoB,EAAc,EAAU,QAAmB;YAA3C,OAAE,GAAF,EAAE,CAAY;YAAU,aAAQ,GAAR,QAAQ,CAAW;YAJtD,SAAI,GAAmC,MAAM,CAAC;YAC9C,SAAI,GAAuB,IAAI,CAAC;YACnB,iBAAY,GAAG,SAAS,CAAC;SAEqB;QAEpE,yCAAe,GAAf;YACE,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,EAAE,CAAC;SACtB;QAEO,uCAAa,GAAb;YACN,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,QAAQ,IAAI,CAAC,IAAI;gBACf,KAAK,SAAS;oBACZ,SAAS,GAAG,aAAa,CAAC;oBAC1B,MAAM;gBACR,KAAK,SAAS;oBACZ,SAAS,GAAG,aAAa,CAAC;oBAC1B,MAAM;gBACR;oBACE,SAAS,GAAG,UAAU,CAAC;aAC1B;YACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;SAC1D;QAEO,uCAAa,GAAb;YACN,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,QAAQ,IAAI,CAAC,IAAI;gBACf,KAAK,IAAI;oBACP,SAAS,GAAG,YAAY,CAAC;oBACzB,MAAM;gBACR,KAAK,IAAI;oBACP,SAAS,GAAG,YAAY,CAAC;oBACzB,MAAM;gBACR;oBACE,SAAS,GAAG,YAAY,CAAC;aAC5B;YACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;SAC1D;;;;gBA3CFC,cAAS,SAAC;oBACT,QAAQ,EAAE,cAAc;iBACzB;;;gBARCC,eAAU;gBAGVC,cAAS;;;uBAORJ,UAAK;uBACLA,UAAK;+BACLK,gBAAW,SAAC,OAAO;;;;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
+ {"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 @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 { AfterViewInit, Directive, ElementRef, HostBinding, Input, Renderer2 } 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":";;;;;;;QAwBE;YAhBS,SAAI,GAAW,SAAS,CAAC;YACzB,SAAI,GAAiC,OAAO,CAAC;YAC7C,SAAI,GAAyD,QAAQ,CAAC;YACtE,UAAK,GAAW,EAAE,CAAC;YAEnB,aAAQ,GAAY,KAAK,CAAC;YAC1B,YAAO,GAAW,EAAE,CAAC;YACrB,iBAAY,GAAqB,MAAM,CAAC;YAExC,aAAQ,GAAY,KAAK,CAAC;YAC1B,4BAAuB,GAAY,KAAK,CAAC;YACzC,6BAAwB,GAAY,KAAK,CAAC;;YAGzC,UAAK,GAAG,IAAIA,iBAAY,EAAO,CAAC;SAE1B;QAEhB,kCAAQ,GAAR,eAAa;QAEb,iCAAO,GAAP,UAAQ,KAAK;YACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACxB;;;;gBA5BFC,cAAS,SAAC;oBACT,QAAQ,EAAE,YAAY;oBACtB,88BAAsC;;iBAEvC;;;;uBAEEC,UAAK;uBACLA,UAAK;uBACLA,UAAK;wBACLA,UAAK;2BAELA,UAAK;0BACLA,UAAK;+BACLA,UAAK;2BAELA,UAAK;0CACLA,UAAK;2CACLA,UAAK;wBAGLC,WAAM;;;;QCZP,yBAAoB,EAAc,EAAU,QAAmB;YAA3C,OAAE,GAAF,EAAE,CAAY;Y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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(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})}));
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.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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AKyB,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"]}
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":"mfAwBE,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,IAAI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AChCoB,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 @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 { AfterViewInit, Directive, ElementRef, HostBinding, Input, Renderer2 } 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"]}
@@ -8,13 +8,13 @@
8
8
  function CheckboxComponent() {
9
9
  this.isError = false;
10
10
  this.isIndeterminate = false;
11
- this.name = '';
11
+ this.name = "";
12
12
  this.formControl = new forms.FormControl();
13
13
  this.valueChange = new core.EventEmitter();
14
14
  }
15
15
  Object.defineProperty(CheckboxComponent.prototype, "type", {
16
16
  set: function (value) {
17
- this.isError = value === 'Error';
17
+ this.isError = value === "Error";
18
18
  },
19
19
  enumerable: false,
20
20
  configurable: true
@@ -60,8 +60,7 @@
60
60
  enumerable: false,
61
61
  configurable: true
62
62
  });
63
- CheckboxComponent.prototype.ngOnInit = function () {
64
- };
63
+ CheckboxComponent.prototype.ngOnInit = function () { };
65
64
  CheckboxComponent.prototype.toggleState = function () {
66
65
  if (this.isIndeterminate) {
67
66
  this.isIndeterminate = false;
@@ -82,14 +81,14 @@
82
81
  }());
83
82
  CheckboxComponent.decorators = [
84
83
  { type: core.Component, args: [{
85
- selector: 'mis-checkbox',
84
+ selector: "mis-checkbox",
86
85
  template: "<div\n class=\"checkbox-container\"\n [ngStyle]=\"{ cursor: formControl.disabled ? 'not-allowed' : 'pointer' }\"\n (click)=\"!formControl.disabled && toggleState()\"\n>\n <input hidden type=\"checkbox\" [formControl]=\"formControl\" (click)=\"$event.stopPropagation()\" />\n <span\n class=\"checkmark\"\n tabindex=\"0\"\n *ngIf=\"!isIndeterminate\"\n [ngClass]=\"{\n 'disabled-checkbox': formControl.disabled,\n error: isError && !formControl.disabled\n }\"\n ></span>\n <span\n class=\"checkmark indeterminate\"\n tabindex=\"0\"\n *ngIf=\"isIndeterminate\"\n [ngClass]=\"{\n 'disabled-checkbox': formControl.disabled,\n error: isError && !formControl.disabled\n }\"\n ></span>\n</div>\n",
87
86
  styles: [".checkbox-container{height:20px;width:20px;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:sub}.checkbox-container input{opacity:0;cursor:pointer}.checkbox-container input,.checkmark{position:absolute;height:20px;width:20px}.checkmark{display:flex;justify-content:center;align-items:center;top:0;left:0;border-radius:4px;background-color:#fff;border:2px solid #6a737d;box-sizing:border-box}.checkmark:hover{border-color:#929dab}.checkmark:focus,.checkmark:focus-within{box-shadow:0 0 0 .09em #fff,0 0 .01em .2em #0937b2;outline:none}.checkbox-container input:checked~.checkmark{background-color:#0937b2;border-color:#0937b2}.checkbox-container input:checked~.checkmark.disabled-checkbox{background-color:#c8cdd3;border-color:#c8cdd3}.checkmark:after{content:\"\";position:absolute;display:none}.checkbox-container input:checked~.checkmark:after{display:block}.checkbox-container .checkmark:after{top:1px;width:4px;height:9px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.checkbox-container .checkmark.indeterminate:after{top:2px;width:2px;height:0;border:solid #fff;border-width:0 0 12px;border-radius:14px;transform:rotate(90deg);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg)}.disabled-checkbox{pointer-events:none;border-color:#c8cdd3}.error{border-color:#b00020}.checkbox-container input:checked~.error.checkmark{border:#b00020!important;background:#b00020!important}.checkbox-container .error.checkmark:after{top:3px;width:4px;height:9px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.checkbox-container .error.checkmark.indeterminate:after{top:4px;width:2px;height:0;border:solid #fff;border-width:0 0 12px;border-radius:14px;transform:rotate(90deg);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg)}.error:focus,.error:focus-within{box-shadow:none!important;outline:none}"]
88
87
  },] }
89
88
  ];
90
89
  CheckboxComponent.ctorParameters = function () { return []; };
91
90
  CheckboxComponent.propDecorators = {
92
- inputBox: [{ type: core.ViewChild, args: ['input',] }],
91
+ inputBox: [{ type: core.ViewChild, args: ["input",] }],
93
92
  type: [{ type: core.Input }],
94
93
  indeterminate: [{ type: core.Input }],
95
94
  checked: [{ type: core.Input }],
@@ -1 +1 @@
1
- {"version":3,"file":"mis-crystal-design-system-checkbox.umd.js","sources":["../../../projects/mis-components/checkbox/checkbox.component.ts","../../../projects/mis-components/checkbox/checkbox.module.ts","../../../projects/mis-components/checkbox/mis-crystal-design-system-checkbox.ts"],"sourcesContent":["import {Component, OnInit, EventEmitter, Input, Output, ViewChild, ElementRef, Renderer2} from '@angular/core';\nimport {AbstractControl, FormControl} from '@angular/forms';\n\n@Component({\n selector: 'mis-checkbox',\n templateUrl: './checkbox.component.html',\n styleUrls: ['./checkbox.component.scss']\n})\nexport class CheckboxComponent implements OnInit {\n\n public isError: boolean = false\n public isIndeterminate: boolean = false\n\n @ViewChild('input') inputBox: ElementRef\n @Input() set type(value: 'Default' | 'Error') {\n this.isError = value === 'Error';\n }\n @Input() set indeterminate(value: boolean){\n if(value) {\n this.formControl.setValue(true)\n this.valueChange.emit({\n name: this.name,\n value: true\n })\n }\n else{\n this.formControl.setValue(false)\n this.valueChange.emit({\n name: this.name,\n value: false\n })\n }\n this.isIndeterminate = value\n }\n @Input() set checked(value: boolean){\n if(value)this.formControl.setValue(true)\n else this.formControl.setValue(false)\n }\n @Input() set disabled(value: boolean){\n if(value) this.formControl.disable()\n else this.formControl.enable()\n }\n @Input() name: string = ''\n @Input() formControl: AbstractControl = new FormControl()\n @Output() valueChange = new EventEmitter<{name: string, value: boolean}>()\n\n constructor() {}\n ngOnInit() {\n }\n\n toggleState() {\n if(this.isIndeterminate) {\n this.isIndeterminate = false;\n this.formControl.setValue(true)\n } else {\n if(this.formControl.value) this.formControl.setValue(false)\n else this.formControl.setValue(true)\n }\n this.valueChange.emit({\n name: this.name,\n value: this.formControl.value\n });\n }\n\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport {ReactiveFormsModule} from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\nimport { CheckboxComponent } from './checkbox.component';\n\n\n@NgModule({\n declarations: [CheckboxComponent],\n imports: [CommonModule, ReactiveFormsModule],\n exports: [CheckboxComponent]\n})\nexport class CheckboxModule {\n static forRoot(): ModuleWithProviders<CheckboxModule> {\n return { ngModule: CheckboxModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["FormControl","EventEmitter","Component","ViewChild","Input","Output","NgModule","CommonModule","ReactiveFormsModule"],"mappings":";;;;;;;QA8CE;YApCO,YAAO,GAAY,KAAK,CAAA;YACxB,oBAAe,GAAY,KAAK,CAAA;YA+B9B,SAAI,GAAW,EAAE,CAAA;YACjB,gBAAW,GAAoB,IAAIA,iBAAW,EAAE,CAAA;YAC/C,gBAAW,GAAG,IAAIC,iBAAY,EAAkC,CAAA;SAE1D;QAhChB,sBAAa,mCAAI;iBAAjB,UAAkB,KAA0B;gBAC1C,IAAI,CAAC,OAAO,GAAG,KAAK,KAAK,OAAO,CAAC;aAClC;;;WAAA;QACD,sBAAa,4CAAa;iBAA1B,UAA2B,KAAc;gBACvC,IAAG,KAAK,EAAE;oBACR,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;oBAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;wBACpB,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,KAAK,EAAE,IAAI;qBACZ,CAAC,CAAA;iBACH;qBACG;oBACF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;oBAChC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;wBACpB,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,KAAK,EAAE,KAAK;qBACb,CAAC,CAAA;iBACH;gB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SAAS,EAAE,EAAE,EAAE,CAAC;SACpD;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,OAAO,EAAE,CAACC,mBAAY,EAAEC,yBAAmB,CAAC;oBAC5C,OAAO,EAAE,CAAC,iBAAiB,CAAC;iBAC7B;;;ICXD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mis-crystal-design-system-checkbox.umd.js","sources":["../../../projects/mis-components/checkbox/checkbox.component.ts","../../../projects/mis-components/checkbox/checkbox.module.ts","../../../projects/mis-components/checkbox/mis-crystal-design-system-checkbox.ts"],"sourcesContent":["import { Component, OnInit, EventEmitter, Input, Output, ViewChild, ElementRef, Renderer2 } from \"@angular/core\";\nimport { AbstractControl, FormControl } from \"@angular/forms\";\n\n@Component({\n selector: \"mis-checkbox\",\n templateUrl: \"./checkbox.component.html\",\n styleUrls: [\"./checkbox.component.scss\"]\n})\nexport class CheckboxComponent implements OnInit {\n public isError: boolean = false;\n public isIndeterminate: boolean = false;\n\n @ViewChild(\"input\") inputBox: ElementRef;\n @Input() set type(value: \"Default\" | \"Error\") {\n this.isError = value === \"Error\";\n }\n @Input() set indeterminate(value: boolean) {\n if (value) {\n this.formControl.setValue(true);\n this.valueChange.emit({\n name: this.name,\n value: true\n });\n } else {\n this.formControl.setValue(false);\n this.valueChange.emit({\n name: this.name,\n value: false\n });\n }\n this.isIndeterminate = value;\n }\n @Input() set checked(value: boolean) {\n if (value) this.formControl.setValue(true);\n else this.formControl.setValue(false);\n }\n @Input() set disabled(value: boolean) {\n if (value) this.formControl.disable();\n else this.formControl.enable();\n }\n @Input() name: string = \"\";\n @Input() formControl: AbstractControl = new FormControl();\n @Output() valueChange = new EventEmitter<{ name: string; value: boolean }>();\n\n constructor() {}\n ngOnInit() {}\n\n toggleState() {\n if (this.isIndeterminate) {\n this.isIndeterminate = false;\n this.formControl.setValue(true);\n } else {\n if (this.formControl.value) this.formControl.setValue(false);\n else this.formControl.setValue(true);\n }\n this.valueChange.emit({\n name: this.name,\n value: this.formControl.value\n });\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\nimport { CommonModule } from \"@angular/common\";\n\nimport { CheckboxComponent } from \"./checkbox.component\";\n\n@NgModule({\n declarations: [CheckboxComponent],\n imports: [CommonModule, ReactiveFormsModule],\n exports: [CheckboxComponent]\n})\nexport class CheckboxModule {\n static forRoot(): ModuleWithProviders<CheckboxModule> {\n return { ngModule: CheckboxModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["FormControl","EventEmitter","Component","ViewChild","Input","Output","NgModule","CommonModule","ReactiveFormsModule"],"mappings":";;;;;;;QA4CE;YAnCO,YAAO,GAAY,KAAK,CAAC;YACzB,oBAAe,GAAY,KAAK,CAAC;YA8B/B,SAAI,GAAW,EAAE,CAAC;YAClB,gBAAW,GAAoB,IAAIA,iBAAW,EAAE,CAAC;YAChD,gBAAW,GAAG,IAAIC,iBAAY,EAAoC,CAAC;SAE7D;QA/BhB,sBAAa,mCAAI;iBAAjB,UAAkB,KAA0B;gBAC1C,IAAI,CAAC,OAAO,GAAG,KAAK,KAAK,OAAO,CAAC;aAClC;;;WAAA;QACD,sBAAa,4CAAa;iBAA1B,UAA2B,KAAc;gBACvC,IAAI,KAAK,EAAE;oBACT,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAChC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;wBACpB,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,KAAK,EAAE,IAAI;qBACZ,CAAC,CAAC;iBACJ;qBAAM;oBACL,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;wBACpB,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,KAAK,EAAE,KAAK;qBACb,CAAC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