@natec/mef-dev-ui-kit 0.0.67 → 0.0.69

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 (241) hide show
  1. package/esm2020/lib/markup-kit/card/card/card.component.mjs +36 -0
  2. package/esm2020/lib/markup-kit/card/card-long/card-long.component.mjs +46 -0
  3. package/esm2020/lib/markup-kit/card/card-long/cart-type-colors.enum.mjs +7 -0
  4. package/esm2020/lib/markup-kit/card/card-simple/card-simple.component.mjs +23 -0
  5. package/esm2020/lib/markup-kit/card/card.module.mjs +41 -0
  6. package/esm2020/lib/markup-kit/card/index.mjs +6 -0
  7. package/esm2020/lib/markup-kit/collapse/collapse/collapse.component.mjs +87 -0
  8. package/esm2020/lib/markup-kit/collapse/collapse-set/collapse-set.component.mjs +54 -0
  9. package/esm2020/lib/markup-kit/collapse/collapse.module.mjs +25 -0
  10. package/esm2020/lib/markup-kit/collapse/index.mjs +4 -0
  11. package/esm2020/lib/markup-kit/modals/fill/fill.component.mjs +52 -0
  12. package/esm2020/lib/markup-kit/modals/index.mjs +7 -0
  13. package/esm2020/lib/markup-kit/modals/markup-kit.module.mjs +45 -0
  14. package/esm2020/lib/markup-kit/modals/modal-size.enum.mjs +2 -0
  15. package/esm2020/lib/markup-kit/modals/right-filter/right-filter.component.mjs +28 -0
  16. package/esm2020/lib/markup-kit/modals/slide-right/slide-right.component.mjs +55 -0
  17. package/esm2020/lib/markup-kit/modals/slide-up/slide-up.component.mjs +55 -0
  18. package/esm2020/lib/markup-kit/page-layouts/central-page/central-page.component.mjs +25 -0
  19. package/esm2020/lib/markup-kit/page-layouts/central-page-row/central-page-row.component.mjs +14 -0
  20. package/esm2020/lib/markup-kit/page-layouts/index.mjs +7 -0
  21. package/esm2020/lib/markup-kit/page-layouts/manage-page/manage-page.component.mjs +25 -0
  22. package/esm2020/lib/markup-kit/page-layouts/page-layouts.module.mjs +45 -0
  23. package/esm2020/lib/markup-kit/page-layouts/profile/profile.component.mjs +49 -0
  24. package/esm2020/lib/markup-kit/page-layouts/table-page/table-page.component.mjs +18 -0
  25. package/esm2020/lib/markup-kit/utils/filtered-field/filtered-field-container/filtered-field-container.component.mjs +40 -0
  26. package/esm2020/lib/markup-kit/utils/filtered-field/filtered-field-item/filtered-field-item.component.mjs +29 -0
  27. package/esm2020/lib/markup-kit/utils/filtered-field/filtered-field.module.mjs +31 -0
  28. package/esm2020/lib/markup-kit/utils/filtered-field/filtered-field.service.mjs +30 -0
  29. package/esm2020/lib/markup-kit/utils/filtered-field/filtred-item.model.mjs +9 -0
  30. package/esm2020/lib/markup-kit/utils/filtered-field/index.mjs +6 -0
  31. package/esm2020/lib/markup-kit/utils/help-block/help-block.component.mjs +47 -0
  32. package/esm2020/lib/markup-kit/utils/help-block/hepl-block.module.mjs +26 -0
  33. package/esm2020/lib/markup-kit/utils/help-block/index.mjs +3 -0
  34. package/esm2020/lib/markup-kit/utils/loader/index.mjs +5 -0
  35. package/esm2020/lib/markup-kit/utils/loader/loader/loader.component.mjs +27 -0
  36. package/esm2020/lib/markup-kit/utils/loader/loader.module.mjs +58 -0
  37. package/esm2020/lib/markup-kit/utils/loader/loader.service.mjs +51 -0
  38. package/esm2020/lib/markup-kit/utils/loader/request-event.enum.mjs +7 -0
  39. package/esm2020/lib/pg-components/card/card.components.mjs +252 -0
  40. package/esm2020/lib/pg-components/card/card.module.mjs +24 -0
  41. package/esm2020/lib/pg-components/card/index.mjs +3 -0
  42. package/esm2020/lib/pg-components/progress/index.mjs +4 -0
  43. package/esm2020/lib/pg-components/progress/progress.component.mjs +39 -0
  44. package/esm2020/lib/pg-components/progress/progress.config.mjs +14 -0
  45. package/esm2020/lib/pg-components/progress/progress.module.mjs +22 -0
  46. package/esm2020/lib/pg-components/select/index.mjs +5 -0
  47. package/esm2020/lib/pg-components/select/option.component.mjs +60 -0
  48. package/esm2020/lib/pg-components/select/option.pipe.mjs +42 -0
  49. package/esm2020/lib/pg-components/select/select.component.mjs +762 -0
  50. package/esm2020/lib/pg-components/select/select.module.mjs +22 -0
  51. package/esm2020/lib/pg-components/spec-flow-test/index.mjs +3 -0
  52. package/esm2020/lib/pg-components/spec-flow-test/spec-flow-test/spec-flow-test.component.mjs +24 -0
  53. package/esm2020/lib/pg-components/spec-flow-test/spec-flow-test.module.mjs +27 -0
  54. package/esm2020/lib/pg-components/switch/index.mjs +3 -0
  55. package/esm2020/lib/pg-components/switch/switch.component.mjs +130 -0
  56. package/esm2020/lib/pg-components/switch/switch.module.mjs +18 -0
  57. package/esm2020/lib/pg-components/tabs/index.mjs +8 -0
  58. package/esm2020/lib/pg-components/tabs/tab-body.component.mjs +22 -0
  59. package/esm2020/lib/pg-components/tabs/tab-label.directive.mjs +44 -0
  60. package/esm2020/lib/pg-components/tabs/tab.component.mjs +66 -0
  61. package/esm2020/lib/pg-components/tabs/tabs-ink-bar.directive.mjs +78 -0
  62. package/esm2020/lib/pg-components/tabs/tabs-nav.component.mjs +335 -0
  63. package/esm2020/lib/pg-components/tabs/tabs.module.mjs +24 -0
  64. package/esm2020/lib/pg-components/tabs/tabset.component.mjs +260 -0
  65. package/esm2020/lib/pg-components/util/convert.mjs +4 -0
  66. package/esm2020/lib/pg-components/util/request-animation.mjs +26 -0
  67. package/esm2020/natec-mef-dev-ui-kit.mjs +5 -0
  68. package/esm2020/public-api.mjs +16 -0
  69. package/fesm2015/natec-mef-dev-ui-kit.mjs +3190 -0
  70. package/fesm2015/natec-mef-dev-ui-kit.mjs.map +1 -0
  71. package/fesm2020/natec-mef-dev-ui-kit.mjs +3183 -0
  72. package/fesm2020/natec-mef-dev-ui-kit.mjs.map +1 -0
  73. package/lib/markup-kit/card/card/card.component.d.ts +17 -0
  74. package/lib/markup-kit/card/card-long/card-long.component.d.ts +21 -0
  75. package/lib/markup-kit/card/card-long/cart-type-colors.enum.d.ts +5 -0
  76. package/lib/markup-kit/card/card-simple/card-simple.component.d.ts +10 -0
  77. package/lib/markup-kit/card/card.module.d.ts +17 -0
  78. package/{src/lib/markup-kit/card/index.ts → lib/markup-kit/card/index.d.ts} +0 -1
  79. package/lib/markup-kit/collapse/collapse/collapse.component.d.ts +19 -0
  80. package/lib/markup-kit/collapse/collapse-set/collapse-set.component.d.ts +18 -0
  81. package/lib/markup-kit/collapse/collapse.module.d.ts +14 -0
  82. package/{src/lib/markup-kit/collapse/index.ts → lib/markup-kit/collapse/index.d.ts} +0 -0
  83. package/lib/markup-kit/modals/fill/fill.component.d.ts +17 -0
  84. package/{src/lib/markup-kit/modals/index.ts → lib/markup-kit/modals/index.d.ts} +0 -0
  85. package/lib/markup-kit/modals/markup-kit.module.d.ts +13 -0
  86. package/lib/markup-kit/modals/modal-size.enum.d.ts +5 -0
  87. package/lib/markup-kit/modals/right-filter/right-filter.component.d.ts +13 -0
  88. package/lib/markup-kit/modals/slide-right/slide-right.component.d.ts +19 -0
  89. package/lib/markup-kit/modals/slide-up/slide-up.component.d.ts +19 -0
  90. package/lib/markup-kit/page-layouts/central-page/central-page.component.d.ts +11 -0
  91. package/lib/markup-kit/page-layouts/central-page-row/central-page-row.component.d.ts +8 -0
  92. package/{src/lib/markup-kit/page-layouts/index.ts → lib/markup-kit/page-layouts/index.d.ts} +0 -0
  93. package/lib/markup-kit/page-layouts/manage-page/manage-page.component.d.ts +11 -0
  94. package/lib/markup-kit/page-layouts/page-layouts.module.d.ts +13 -0
  95. package/lib/markup-kit/page-layouts/profile/profile.component.d.ts +27 -0
  96. package/lib/markup-kit/page-layouts/table-page/table-page.component.d.ts +9 -0
  97. package/lib/markup-kit/utils/filtered-field/filtered-field-container/filtered-field-container.component.d.ts +14 -0
  98. package/lib/markup-kit/utils/filtered-field/filtered-field-item/filtered-field-item.component.d.ts +14 -0
  99. package/lib/markup-kit/utils/filtered-field/filtered-field.module.d.ts +9 -0
  100. package/lib/markup-kit/utils/filtered-field/filtered-field.service.d.ts +14 -0
  101. package/lib/markup-kit/utils/filtered-field/filtred-item.model.d.ts +7 -0
  102. package/{src/lib/markup-kit/utils/filtered-field/index.ts → lib/markup-kit/utils/filtered-field/index.d.ts} +0 -0
  103. package/lib/markup-kit/utils/help-block/help-block.component.d.ts +11 -0
  104. package/lib/markup-kit/utils/help-block/hepl-block.module.d.ts +9 -0
  105. package/{src/lib/markup-kit/utils/help-block/index.ts → lib/markup-kit/utils/help-block/index.d.ts} +1 -1
  106. package/{src/lib/markup-kit/utils/loader/index.ts → lib/markup-kit/utils/loader/index.d.ts} +1 -1
  107. package/lib/markup-kit/utils/loader/loader/loader.component.d.ts +12 -0
  108. package/lib/markup-kit/utils/loader/loader.module.d.ts +9 -0
  109. package/lib/markup-kit/utils/loader/loader.service.d.ts +16 -0
  110. package/lib/markup-kit/utils/loader/request-event.enum.d.ts +5 -0
  111. package/lib/pg-components/card/card.components.d.ts +60 -0
  112. package/lib/pg-components/card/card.module.d.ts +11 -0
  113. package/{src/lib/pg-components/card/index.ts → lib/pg-components/card/index.d.ts} +1 -1
  114. package/{src/lib/pg-components/progress/index.ts → lib/pg-components/progress/index.d.ts} +1 -1
  115. package/lib/pg-components/progress/progress.component.d.ts +15 -0
  116. package/lib/pg-components/progress/progress.config.d.ts +7 -0
  117. package/lib/pg-components/progress/progress.module.d.ts +10 -0
  118. package/{src/lib/pg-components/select/index.ts → lib/pg-components/select/index.d.ts} +1 -1
  119. package/lib/pg-components/select/option.component.d.ts +21 -0
  120. package/lib/pg-components/select/option.pipe.d.ts +8 -0
  121. package/lib/pg-components/select/select.component.d.ts +135 -0
  122. package/lib/pg-components/select/select.module.d.ts +12 -0
  123. package/{src/lib/pg-components/spec-flow-test/index.ts → lib/pg-components/spec-flow-test/index.d.ts} +1 -1
  124. package/lib/pg-components/spec-flow-test/spec-flow-test/spec-flow-test.component.d.ts +22 -0
  125. package/lib/pg-components/spec-flow-test/spec-flow-test.module.d.ts +10 -0
  126. package/{src/lib/pg-components/switch/index.ts → lib/pg-components/switch/index.d.ts} +1 -1
  127. package/lib/pg-components/switch/switch.component.d.ts +29 -0
  128. package/lib/pg-components/switch/switch.module.d.ts +8 -0
  129. package/{src/lib/pg-components/tabs/index.ts → lib/pg-components/tabs/index.d.ts} +1 -1
  130. package/lib/pg-components/tabs/tab-body.component.d.ts +7 -0
  131. package/lib/pg-components/tabs/tab-label.directive.d.ts +15 -0
  132. package/lib/pg-components/tabs/tab.component.d.ts +22 -0
  133. package/lib/pg-components/tabs/tabs-ink-bar.directive.d.ts +23 -0
  134. package/lib/pg-components/tabs/tabs-nav.component.d.ts +79 -0
  135. package/lib/pg-components/tabs/tabs.module.d.ts +14 -0
  136. package/lib/pg-components/tabs/tabset.component.d.ts +67 -0
  137. package/lib/pg-components/util/convert.d.ts +1 -0
  138. package/lib/pg-components/util/request-animation.d.ts +1 -0
  139. package/natec-mef-dev-ui-kit.d.ts +5 -0
  140. package/package.json +21 -6
  141. package/{src/public-api.ts → public-api.d.ts} +14 -19
  142. package/.browserslistrc +0 -16
  143. package/karma.conf.js +0 -44
  144. package/ng-package.json +0 -24
  145. package/src/lib/markup-kit/card/card/card.component.html +0 -46
  146. package/src/lib/markup-kit/card/card/card.component.scss +0 -61
  147. package/src/lib/markup-kit/card/card/card.component.ts +0 -31
  148. package/src/lib/markup-kit/card/card-long/card-long.component.html +0 -54
  149. package/src/lib/markup-kit/card/card-long/card-long.component.scss +0 -72
  150. package/src/lib/markup-kit/card/card-long/card-long.component.ts +0 -33
  151. package/src/lib/markup-kit/card/card-long/cart-type-colors.enum.ts +0 -5
  152. package/src/lib/markup-kit/card/card-simple/card-simple.component.html +0 -12
  153. package/src/lib/markup-kit/card/card-simple/card-simple.component.scss +0 -12
  154. package/src/lib/markup-kit/card/card-simple/card-simple.component.ts +0 -18
  155. package/src/lib/markup-kit/card/card.module.ts +0 -23
  156. package/src/lib/markup-kit/collapse/collapse/collapse.component.html +0 -16
  157. package/src/lib/markup-kit/collapse/collapse/collapse.component.scss +0 -13
  158. package/src/lib/markup-kit/collapse/collapse/collapse.component.ts +0 -78
  159. package/src/lib/markup-kit/collapse/collapse-set/collapse-set.component.html +0 -3
  160. package/src/lib/markup-kit/collapse/collapse-set/collapse-set.component.scss +0 -0
  161. package/src/lib/markup-kit/collapse/collapse-set/collapse-set.component.ts +0 -58
  162. package/src/lib/markup-kit/collapse/collapse.module.ts +0 -20
  163. package/src/lib/markup-kit/modals/fill/fill.component.html +0 -18
  164. package/src/lib/markup-kit/modals/fill/fill.component.scss +0 -0
  165. package/src/lib/markup-kit/modals/fill/fill.component.ts +0 -45
  166. package/src/lib/markup-kit/modals/markup-kit.module.ts +0 -27
  167. package/src/lib/markup-kit/modals/modal-size.enum.ts +0 -5
  168. package/src/lib/markup-kit/modals/right-filter/right-filter.component.html +0 -7
  169. package/src/lib/markup-kit/modals/right-filter/right-filter.component.scss +0 -6
  170. package/src/lib/markup-kit/modals/right-filter/right-filter.component.ts +0 -30
  171. package/src/lib/markup-kit/modals/slide-right/slide-right.component.html +0 -16
  172. package/src/lib/markup-kit/modals/slide-right/slide-right.component.scss +0 -0
  173. package/src/lib/markup-kit/modals/slide-right/slide-right.component.ts +0 -50
  174. package/src/lib/markup-kit/modals/slide-up/slide-up.component.html +0 -16
  175. package/src/lib/markup-kit/modals/slide-up/slide-up.component.scss +0 -0
  176. package/src/lib/markup-kit/modals/slide-up/slide-up.component.ts +0 -50
  177. package/src/lib/markup-kit/page-layouts/central-page/central-page.component.html +0 -6
  178. package/src/lib/markup-kit/page-layouts/central-page/central-page.component.scss +0 -0
  179. package/src/lib/markup-kit/page-layouts/central-page/central-page.component.ts +0 -26
  180. package/src/lib/markup-kit/page-layouts/central-page-row/central-page-row.component.html +0 -3
  181. package/src/lib/markup-kit/page-layouts/central-page-row/central-page-row.component.scss +0 -0
  182. package/src/lib/markup-kit/page-layouts/central-page-row/central-page-row.component.ts +0 -15
  183. package/src/lib/markup-kit/page-layouts/manage-page/manage-page.component.html +0 -10
  184. package/src/lib/markup-kit/page-layouts/manage-page/manage-page.component.scss +0 -14
  185. package/src/lib/markup-kit/page-layouts/manage-page/manage-page.component.ts +0 -20
  186. package/src/lib/markup-kit/page-layouts/page-layouts.module.ts +0 -26
  187. package/src/lib/markup-kit/page-layouts/profile/profile.component.html +0 -42
  188. package/src/lib/markup-kit/page-layouts/profile/profile.component.scss +0 -72
  189. package/src/lib/markup-kit/page-layouts/profile/profile.component.ts +0 -38
  190. package/src/lib/markup-kit/page-layouts/table-page/table-page.component.html +0 -9
  191. package/src/lib/markup-kit/page-layouts/table-page/table-page.component.scss +0 -0
  192. package/src/lib/markup-kit/page-layouts/table-page/table-page.component.ts +0 -16
  193. package/src/lib/markup-kit/utils/filtered-field/filtered-field-container/filtered-field-container.component.html +0 -3
  194. package/src/lib/markup-kit/utils/filtered-field/filtered-field-container/filtered-field-container.component.scss +0 -4
  195. package/src/lib/markup-kit/utils/filtered-field/filtered-field-container/filtered-field-container.component.ts +0 -46
  196. package/src/lib/markup-kit/utils/filtered-field/filtered-field-item/filtered-field-item.component.html +0 -4
  197. package/src/lib/markup-kit/utils/filtered-field/filtered-field-item/filtered-field-item.component.scss +0 -12
  198. package/src/lib/markup-kit/utils/filtered-field/filtered-field-item/filtered-field-item.component.ts +0 -28
  199. package/src/lib/markup-kit/utils/filtered-field/filtered-field.module.ts +0 -19
  200. package/src/lib/markup-kit/utils/filtered-field/filtered-field.service.ts +0 -32
  201. package/src/lib/markup-kit/utils/filtered-field/filtred-item.model.ts +0 -15
  202. package/src/lib/markup-kit/utils/help-block/help-block.component.html +0 -19
  203. package/src/lib/markup-kit/utils/help-block/help-block.component.scss +0 -22
  204. package/src/lib/markup-kit/utils/help-block/help-block.component.ts +0 -40
  205. package/src/lib/markup-kit/utils/help-block/hepl-block.module.ts +0 -14
  206. package/src/lib/markup-kit/utils/loader/loader/loader.component.html +0 -1
  207. package/src/lib/markup-kit/utils/loader/loader/loader.component.scss +0 -0
  208. package/src/lib/markup-kit/utils/loader/loader/loader.component.ts +0 -29
  209. package/src/lib/markup-kit/utils/loader/loader.module.ts +0 -47
  210. package/src/lib/markup-kit/utils/loader/loader.service.ts +0 -55
  211. package/src/lib/markup-kit/utils/loader/request-event.enum.ts +0 -1
  212. package/src/lib/pg-components/card/card.components.html +0 -66
  213. package/src/lib/pg-components/card/card.components.ts +0 -243
  214. package/src/lib/pg-components/card/card.module.ts +0 -17
  215. package/src/lib/pg-components/progress/progress.component.html +0 -28
  216. package/src/lib/pg-components/progress/progress.component.ts +0 -32
  217. package/src/lib/pg-components/progress/progress.config.ts +0 -7
  218. package/src/lib/pg-components/progress/progress.module.ts +0 -16
  219. package/src/lib/pg-components/select/option.component.ts +0 -71
  220. package/src/lib/pg-components/select/option.pipe.ts +0 -41
  221. package/src/lib/pg-components/select/select.component.html +0 -77
  222. package/src/lib/pg-components/select/select.component.ts +0 -808
  223. package/src/lib/pg-components/select/select.module.ts +0 -14
  224. package/src/lib/pg-components/spec-flow-test/spec-flow-test/spec-flow-test.component.html +0 -6
  225. package/src/lib/pg-components/spec-flow-test/spec-flow-test/spec-flow-test.component.scss +0 -0
  226. package/src/lib/pg-components/spec-flow-test/spec-flow-test/spec-flow-test.component.ts +0 -36
  227. package/src/lib/pg-components/spec-flow-test/spec-flow-test.module.ts +0 -18
  228. package/src/lib/pg-components/switch/switch.component.ts +0 -122
  229. package/src/lib/pg-components/switch/switch.module.ts +0 -11
  230. package/src/lib/pg-components/tabs/tab-body.component.ts +0 -12
  231. package/src/lib/pg-components/tabs/tab-label.directive.ts +0 -40
  232. package/src/lib/pg-components/tabs/tab.component.ts +0 -62
  233. package/src/lib/pg-components/tabs/tabs-ink-bar.directive.ts +0 -77
  234. package/src/lib/pg-components/tabs/tabs-nav.component.ts +0 -345
  235. package/src/lib/pg-components/tabs/tabs.module.ts +0 -16
  236. package/src/lib/pg-components/tabs/tabset.component.ts +0 -237
  237. package/src/lib/pg-components/util/convert.ts +0 -3
  238. package/src/lib/pg-components/util/request-animation.ts +0 -31
  239. package/tsconfig.lib.json +0 -15
  240. package/tsconfig.lib.prod.json +0 -10
  241. package/tsconfig.spec.json +0 -17
@@ -1,808 +0,0 @@
1
- /**
2
- * complex but work well
3
- * TODO: rebuild latter
4
- */
5
- import { DOWN_ARROW, ENTER, TAB } from "@angular/cdk/keycodes";
6
- import {
7
- CdkConnectedOverlay,
8
- ConnectedOverlayPositionChange
9
- } from "@angular/cdk/overlay";
10
- import {
11
- forwardRef,
12
- AfterContentChecked,
13
- AfterContentInit,
14
- Component,
15
- ElementRef,
16
- EventEmitter,
17
- HostListener,
18
- Input,
19
- OnInit,
20
- Output,
21
- Renderer2,
22
- ViewChild,
23
- ViewEncapsulation,
24
- ChangeDetectorRef
25
- } from "@angular/core";
26
- import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
27
- import { pgOptionComponent } from "./option.component";
28
- import { OptionPipe } from "./option.pipe";
29
- import { toBoolean } from '../util/convert';
30
- import { animate, state, style, transition, trigger } from "@angular/animations";
31
-
32
- @Component({
33
- selector: "pg-select",
34
- encapsulation: ViewEncapsulation.None,
35
- providers: [
36
- {
37
- provide: NG_VALUE_ACCESSOR,
38
- useExisting: forwardRef(() => pgSelectComponent),
39
- multi: true
40
- }
41
- ],
42
- animations: [trigger('dropDownAnimation', [
43
- state('bottom', style({
44
- opacity : 1,
45
- transform : 'scaleY(1)',
46
- transformOrigin: '0% 0%'
47
- })),
48
- transition('void => bottom', [
49
- style({
50
- opacity : 0,
51
- transform : 'scaleY(0)',
52
- transformOrigin: '0% 0%'
53
- }),
54
- animate('150ms cubic-bezier(0.25, 0.8, 0.25, 1)')
55
- ]),
56
- state('top', style({
57
- opacity : 1,
58
- transform : 'scaleY(1)',
59
- transformOrigin: '0% 100%'
60
- })),
61
- transition('void => top', [
62
- style({
63
- opacity : 0,
64
- transform : 'scaleY(0)',
65
- transformOrigin: '0% 100%'
66
- }),
67
- animate('150ms cubic-bezier(0.25, 0.8, 0.25, 1)')
68
- ]),
69
- transition('* => void', [
70
- animate('250ms 100ms linear', style({ opacity: 0 }))
71
- ])
72
- ]),
73
-
74
- trigger('tagAnimation', [
75
- state('*', style({ opacity: 1, transform: 'scale(1)' })),
76
- transition('void => *', [
77
- style({ opacity: 0, transform: 'scale(0)' }),
78
- animate('150ms linear')
79
- ]),
80
- state('void', style({ opacity: 0, transform: 'scale(0)' })),
81
- transition('* => void', [
82
- style({ opacity: 1, transform: 'scale(1)' }),
83
- animate('150ms linear')
84
- ])])],
85
- templateUrl: "./select.component.html"
86
- })
87
- export class pgSelectComponent
88
- implements
89
- OnInit,
90
- AfterContentInit,
91
- AfterContentChecked,
92
- ControlValueAccessor {
93
- private _allowClear = false;
94
- private _disabled = false;
95
- private _isTags = false;
96
- private _isMultiple = false;
97
- private _keepUnListOptions = false;
98
- private _showSearch = false;
99
- _el: HTMLElement;
100
- _isOpen = false;
101
- _prefixCls = "pg-select";
102
- _classList: string[] = [];
103
- _dropDownClassMap: any;
104
- _dropDownPrefixCls = `${this._prefixCls}-dropdown`;
105
- _selectionClassMap: any;
106
- _selectionPrefixCls = `${this._prefixCls}-selection`;
107
- _size: string;
108
- _value: string[] | string;
109
- _placeholder = "placeholder";
110
- _notFoundContent = "No Content";
111
- _searchText = "";
112
- _triggerWidth = 0;
113
- _selectedOption: pgOptionComponent;
114
- _operatingMultipleOption: pgOptionComponent;
115
- _selectedOptions: Set<pgOptionComponent> = new Set();
116
- _options: pgOptionComponent[] = [];
117
- _cacheOptions: pgOptionComponent[] = [];
118
- _filterOptions: pgOptionComponent[] = [];
119
- _tagsOptions: pgOptionComponent[] = [];
120
- _activeFilterOption: pgOptionComponent;
121
- _isMultiInit = false;
122
- _dropDownPosition: "top" | "center" | "bottom" = "bottom";
123
- _composing = false;
124
- _mode: any;
125
- // ngModel Access
126
- onChange: (value: string | string[]) => void = () => null;
127
- onTouched: () => void = () => null;
128
- @ViewChild("searchInput") searchInputElementRef: any;
129
- @ViewChild("trigger") trigger: ElementRef;
130
- @ViewChild("dropdownUl") dropdownUl: ElementRef;
131
- @Output() SearchChange: EventEmitter<string> = new EventEmitter();
132
- @Output() change: EventEmitter<string> = new EventEmitter();
133
- @Output() OpenChange: EventEmitter<boolean> = new EventEmitter();
134
- @Output() ScrollToBottom: EventEmitter<boolean> = new EventEmitter();
135
- @Input() Filter = true;
136
- @Input() MaxMultiple = Infinity;
137
- @Input() FirstDefault: boolean = false;
138
- @ViewChild(CdkConnectedOverlay) _cdkOverlay: CdkConnectedOverlay;
139
-
140
- @Input()
141
- set AllowClear(value: boolean) {
142
- this._allowClear = toBoolean(value);
143
- }
144
-
145
- get AllowClear(): boolean {
146
- return this._allowClear;
147
- }
148
-
149
- @Input()
150
- set KeepUnListOptions(value: boolean) {
151
- this._keepUnListOptions = toBoolean(value);
152
- }
153
-
154
- get KeepUnListOptions(): boolean {
155
- return this._keepUnListOptions;
156
- }
157
-
158
- @Input()
159
- set Mode(value: string) {
160
- this._mode = value;
161
- if (this._mode === "multiple") {
162
- this.Multiple = true;
163
- } else if (this._mode === "tags") {
164
- this.Tags = true;
165
- } else if (this._mode === "combobox") {
166
- this.ShowSearch = true;
167
- }
168
- }
169
-
170
- @Input()
171
- set Multiple(value: boolean) {
172
- this._isMultiple = toBoolean(value);
173
- if (this._isMultiple) {
174
- this.ShowSearch = true;
175
- }
176
- }
177
-
178
- get Multiple(): boolean {
179
- return this._isMultiple;
180
- }
181
-
182
- @Input()
183
- set PlaceHolder(value: string) {
184
- this._placeholder = value;
185
- }
186
-
187
- get PlaceHolder(): string {
188
- return this._placeholder;
189
- }
190
-
191
- @Input()
192
- set NotFoundContent(value: string) {
193
- this._notFoundContent = value;
194
- }
195
-
196
- get NotFoundContent(): string {
197
- return this._notFoundContent;
198
- }
199
-
200
- @Input()
201
- set Size(value: string) {
202
- // @ts-ignore
203
- this._size = { large: "lg", small: "sm" }[value];
204
- this.setClassMap();
205
- }
206
-
207
- get Size(): string {
208
- return this._size;
209
- }
210
-
211
- @Input()
212
- set ShowSearch(value: boolean) {
213
- this._showSearch = toBoolean(value);
214
- }
215
-
216
- get ShowSearch(): boolean {
217
- return this._showSearch;
218
- }
219
-
220
- @Input()
221
- set Tags(value: boolean) {
222
- const isTags = toBoolean(value);
223
- this._isTags = isTags;
224
- this.Multiple = isTags;
225
- }
226
-
227
- get Tags(): boolean {
228
- return this._isTags;
229
- }
230
-
231
- @Input()
232
- set Disabled(value: boolean) {
233
- this._disabled = toBoolean(value);
234
- this.closeDropDown();
235
- this.setClassMap();
236
- }
237
-
238
- get Disabled(): boolean {
239
- return this._disabled;
240
- }
241
-
242
- @Input()
243
- set Open(value: boolean) {
244
- const isOpen = toBoolean(value);
245
- if (this._isOpen === isOpen) {
246
- return;
247
- }
248
- if (isOpen) {
249
- this.scrollToActive();
250
- this._setTriggerWidth();
251
- }
252
- this._isOpen = isOpen;
253
- this.OpenChange.emit(this._isOpen);
254
- this.setClassMap();
255
- if (this._isOpen) {
256
- setTimeout(() => {
257
- this.checkDropDownScroll();
258
- });
259
- }
260
- }
261
-
262
- get Open(): boolean {
263
- return this._isOpen;
264
- }
265
-
266
- /** new -option insert or new tags insert */
267
- // @ts-ignore
268
- addOption = option => {
269
- this._options.push(option);
270
- if (!this._isTags) {
271
- if (option.Value) {
272
- this.updateSelectedOption(this._value);
273
- } else {
274
- this.forceUpdateSelectedOption(this._value);
275
- }
276
- }
277
- };
278
-
279
- /** -option remove or tags remove */
280
- removeOption(option: pgOptionComponent): void {
281
- this._options.splice(this._options.indexOf(option), 1);
282
- if (!this._isTags) {
283
- this.forceUpdateSelectedOption(this._value);
284
- }
285
- }
286
-
287
- /** dropdown position changed */
288
- onPositionChange(position: ConnectedOverlayPositionChange): void {
289
- this._dropDownPosition = position.connectionPair.originY;
290
- }
291
-
292
- compositionStart(): void {
293
- this._composing = true;
294
- }
295
-
296
- compositionEnd(): void {
297
- this._composing = false;
298
- }
299
-
300
- /** clear single selected option */
301
- clearSelect($event?: MouseEvent): void {
302
- if ($event) {
303
- $event.preventDefault();
304
- $event.stopPropagation();
305
- } // @ts-ignore
306
- this._selectedOption = null; // @ts-ignore
307
- this.Value = null; // @ts-ignore
308
- this.onChange(null);
309
- }
310
-
311
- /** click dropdown option by user */
312
- clickOption(option: pgOptionComponent, $event?: MouseEvent): void {
313
- if (!option) {
314
- return;
315
- }
316
- this.chooseOption(option, true, $event);
317
- this.clearSearchText();
318
- if (!this._isMultiple) {
319
- this.Open = false;
320
- }
321
- }
322
-
323
- /** choose option */
324
- chooseOption(
325
- option: pgOptionComponent,
326
- isUserClick: boolean = false,
327
- $event?: MouseEvent
328
- ): void {
329
- if ($event) {
330
- $event.preventDefault();
331
- $event.stopPropagation();
332
- }
333
- this._activeFilterOption = option;
334
- if (option && !option.Disabled) {
335
- if (!this.Multiple) {
336
- this._selectedOption = option;
337
- this._value = option.Value;
338
- if (isUserClick) {
339
- this.change.next(this._value);
340
- this.onChange(option.Value);
341
- }
342
- } else {
343
- if (isUserClick) {
344
- this.isInSet(this._selectedOptions, option)
345
- ? this.unSelectMultipleOption(option)
346
- : this.selectMultipleOption(option);
347
- }
348
- }
349
- }
350
- }
351
-
352
- updateWidth(element: HTMLInputElement, text: string): void {
353
- if (text) {
354
- /** wait for scroll width change */ // @ts-ignore
355
- setTimeout(_ => {
356
- this._renderer.setStyle(element, "width", `${element.scrollWidth}px`);
357
- });
358
- } else {
359
- this._renderer.removeStyle(element, "width");
360
- }
361
- }
362
-
363
- /** determine if option in set */
364
- isInSet(
365
- set: Set<pgOptionComponent>,
366
- option: pgOptionComponent
367
- ): pgOptionComponent { // @ts-ignore
368
- return (Array.from(set) as pgOptionComponent[]).find(
369
- (data: pgOptionComponent) => data.Value === option.Value
370
- );
371
- }
372
-
373
- /** cancel select multiple option */ // @ts-ignore
374
- unSelectMultipleOption = (option, $event?, emitChange = true) => {
375
- this._operatingMultipleOption = option;
376
- this._selectedOptions.delete(option);
377
- if (emitChange) {
378
- this.emitMultipleOptions();
379
- }
380
-
381
- // 对Tag进行特殊处理
382
- if (
383
- this._isTags &&
384
- this._options.indexOf(option) !== -1 &&
385
- this._tagsOptions.indexOf(option) !== -1
386
- ) {
387
- this.removeOption(option);
388
- this._tagsOptions.splice(this._tagsOptions.indexOf(option), 1);
389
- }
390
- if ($event) {
391
- $event.preventDefault();
392
- $event.stopPropagation();
393
- }
394
- };
395
-
396
- /** select multiple option */
397
- selectMultipleOption(option: pgOptionComponent, $event?: MouseEvent): void {
398
- /** if tags do push to tag option */
399
- if (
400
- this._isTags &&
401
- this._options.indexOf(option) === -1 &&
402
- this._tagsOptions.indexOf(option) === -1
403
- ) {
404
- this.addOption(option);
405
- this._tagsOptions.push(option);
406
- }
407
- this._operatingMultipleOption = option;
408
- if (this._selectedOptions.size < this.MaxMultiple) {
409
- this._selectedOptions.add(option);
410
- }
411
- this.emitMultipleOptions();
412
-
413
- if ($event) {
414
- $event.preventDefault();
415
- $event.stopPropagation();
416
- }
417
- }
418
-
419
- /** emit multiple options */
420
- emitMultipleOptions(): void {
421
- if (this._isMultiInit) {
422
- return;
423
- }
424
- const arrayOptions = Array.from(this._selectedOptions);
425
- this._value = arrayOptions.map(item => item.Value);
426
- this.onChange(this._value);
427
- }
428
-
429
- /** update selected option when add remove option etc */
430
- updateSelectedOption(
431
- currentModelValue: string | string[],
432
- triggerByNgModel: boolean = false
433
- ): void {
434
- if (currentModelValue == null) {
435
- return;
436
- }
437
- if (this.Multiple) {
438
- const selectedOptions = this._options.filter(item => {
439
- return item != null && currentModelValue.indexOf(item.Value) !== -1;
440
- });
441
- if ((this.KeepUnListOptions || this.Tags) && !triggerByNgModel) {
442
- const _selectedOptions = Array.from(this._selectedOptions);
443
- selectedOptions.forEach(option => {
444
- const _exist = _selectedOptions.some(
445
- item => item._value === option._value
446
- );
447
- if (!_exist) {
448
- this._selectedOptions.add(option);
449
- }
450
- });
451
- } else {
452
- this._selectedOptions = new Set();
453
- selectedOptions.forEach(option => {
454
- this._selectedOptions.add(option);
455
- });
456
- }
457
- } else {
458
- const selectedOption = this._options.filter(item => {
459
- return item != null && item.Value === currentModelValue;
460
- });
461
- this.chooseOption(selectedOption[0]);
462
- }
463
- }
464
-
465
- forceUpdateSelectedOption(value: string | string[]): void {
466
- /** trigger dirty check */ // @ts-ignore
467
- setTimeout(_ => {
468
- this.updateSelectedOption(value);
469
- });
470
- }
471
-
472
- get Value(): string | string[] {
473
- return this._value;
474
- }
475
-
476
- set Value(value: string | string[]) {
477
- this._updateValue(value);
478
- }
479
-
480
- clearAllSelectedOption(emitChange: boolean = true): void {
481
- this._selectedOptions.forEach(item => {
482
- this.unSelectMultipleOption(item, null, emitChange);
483
- });
484
- }
485
-
486
- handleKeyEnterEvent(event: KeyboardEvent): void {
487
- /** when composing end */
488
- if (!this._composing && this._isOpen) {
489
- event.preventDefault();
490
- event.stopPropagation();
491
- this.updateFilterOption(false);
492
- this.clickOption(this._activeFilterOption);
493
- }
494
- }
495
-
496
- handleKeyBackspaceEvent(event: KeyboardEvent): void {
497
- if (!this._searchText && !this._composing && this._isMultiple) {
498
- event.preventDefault();
499
- const lastOption = Array.from(this._selectedOptions).pop();
500
- this.unSelectMultipleOption(lastOption);
501
- }
502
- }
503
-
504
- handleKeyDownEvent($event: MouseEvent): void {
505
- if (this._isOpen) {
506
- $event.preventDefault();
507
- $event.stopPropagation();
508
- this._activeFilterOption = this.nextOption(
509
- this._activeFilterOption,
510
- this._filterOptions.filter(w => !w.Disabled)
511
- );
512
- this.scrollToActive();
513
- }
514
- }
515
-
516
- handleKeyUpEvent($event: MouseEvent): void {
517
- if (this._isOpen) {
518
- $event.preventDefault();
519
- $event.stopPropagation();
520
- this._activeFilterOption = this.preOption(
521
- this._activeFilterOption,
522
- this._filterOptions.filter(w => !w.Disabled)
523
- );
524
- this.scrollToActive();
525
- }
526
- }
527
-
528
- preOption(
529
- option: pgOptionComponent,
530
- options: pgOptionComponent[]
531
- ): pgOptionComponent {
532
- return options[options.indexOf(option) - 1] || options[options.length - 1];
533
- }
534
-
535
- nextOption(
536
- option: pgOptionComponent,
537
- options: pgOptionComponent[]
538
- ): pgOptionComponent {
539
- return options[options.indexOf(option) + 1] || options[0];
540
- }
541
-
542
- clearSearchText(): void {
543
- this._searchText = "";
544
- this.updateFilterOption();
545
- }
546
-
547
- updateFilterOption(updateActiveFilter: boolean = true): void {
548
- if (this.Filter) {
549
- this._filterOptions = new OptionPipe().transform(this._options, {
550
- searchText: this._searchText,
551
- tags: this._isTags,
552
- notFoundContent: this._isTags
553
- ? this._searchText
554
- : this._notFoundContent,
555
- disabled: !this._isTags,
556
- value: this._isTags ? this._searchText : "disabled"
557
- });
558
- } else {
559
- this._filterOptions = this._options;
560
- }
561
-
562
- /** TODO: cause pre & next key selection not work */
563
- if (updateActiveFilter && !this._selectedOption) {
564
- this._activeFilterOption = this._filterOptions[0];
565
- }
566
- }
567
-
568
- onSearchChange(searchValue: string): void {
569
- this.SearchChange.emit(searchValue);
570
- }
571
-
572
- @HostListener("click", ["$event"])
573
- onClick(e: MouseEvent): void {
574
- e.preventDefault();
575
- if (!this._disabled) {
576
- this.Open = !this.Open;
577
- if (this.ShowSearch) {
578
- /** wait for search display */ // @ts-ignore
579
- setTimeout(_ => {
580
- this.searchInputElementRef.nativeElement.focus();
581
- });
582
- }
583
- }
584
- }
585
-
586
- @HostListener("keydown", ["$event"])
587
- onKeyDown(e: KeyboardEvent): void {
588
- const keyCode = e.keyCode;
589
- if (keyCode === TAB && this.Open) {
590
- this.Open = false;
591
- return;
592
- }
593
- if ((keyCode !== DOWN_ARROW && keyCode !== ENTER) || this.Open) {
594
- return;
595
- }
596
- e.preventDefault();
597
- if (!this._disabled) {
598
- this.Open = true;
599
- if (this.ShowSearch) {
600
- /** wait for search display */ // @ts-ignore
601
- setTimeout(_ => {
602
- this.searchInputElementRef.nativeElement.focus();
603
- });
604
- }
605
- }
606
- }
607
-
608
- closeDropDown(): void {
609
- if (!this.Open) {
610
- return;
611
- }
612
- this.onTouched();
613
- if (this.Multiple) {
614
- this._renderer.removeStyle(
615
- this.searchInputElementRef.nativeElement,
616
- "width"
617
- );
618
- }
619
- this.clearSearchText();
620
- this.Open = false;
621
- }
622
-
623
- setClassMap(): void {
624
- this._classList.forEach(_className => {
625
- this._renderer.removeClass(this._el, _className);
626
- }); // @ts-ignore
627
- this._classList = [
628
- this._prefixCls,
629
- this._mode === "combobox" && `${this._prefixCls}-combobox`,
630
- !this._disabled && `${this._prefixCls}-enabled`,
631
- this._disabled && `${this._prefixCls}-disabled`,
632
- this._isOpen && `${this._prefixCls}-open`,
633
- this._showSearch && `${this._prefixCls}-show-search`,
634
- this._size && `${this._prefixCls}-${this._size}`
635
- ].filter(item => {
636
- return !!item;
637
- });
638
- this._classList.forEach(_className => {
639
- this._renderer.addClass(this._el, _className);
640
- });
641
- this._selectionClassMap = {
642
- [this._selectionPrefixCls]: true,
643
- [`${this._selectionPrefixCls}--single`]: !this.Multiple,
644
- [`${this._selectionPrefixCls}--multiple`]: this.Multiple
645
- };
646
- }
647
-
648
- setDropDownClassMap(): void {
649
- this._dropDownClassMap = {
650
- [this._dropDownPrefixCls]: true,
651
- ["component-select"]: this._mode === "combobox",
652
- [`${this._dropDownPrefixCls}--single`]: !this.Multiple,
653
- [`${this._dropDownPrefixCls}--multiple`]: this.Multiple,
654
- [`${this._dropDownPrefixCls}-placement-bottomLeft`]:
655
- this._dropDownPosition === "bottom",
656
- [`${this._dropDownPrefixCls}-placement-topLeft`]:
657
- this._dropDownPosition === "top"
658
- };
659
- }
660
-
661
- scrollToActive(): void {
662
- /** wait for dropdown display */ // @ts-ignore
663
- setTimeout(_ => {
664
- if (this._activeFilterOption && this._activeFilterOption.Value) {
665
- const index = this._filterOptions.findIndex(
666
- option => option.Value === this._activeFilterOption.Value
667
- );
668
- try {
669
- const scrollPane = this.dropdownUl.nativeElement.children[
670
- index
671
- ] as HTMLLIElement;
672
- // TODO: scrollIntoViewIfNeeded is not a standard API, why doing so?
673
- /* tslint:disable-next-line:no-any */
674
- (scrollPane as any).scrollIntoViewIfNeeded(false);
675
- } catch (e) {}
676
- }
677
- });
678
- }
679
-
680
- flushComponentState(): void {
681
- this.updateFilterOption();
682
- if (!this.Multiple) {
683
- this.updateSelectedOption(this._value);
684
- } else {
685
- if (this._value) {
686
- this.updateSelectedOption(this._value);
687
- }
688
- }
689
- }
690
-
691
- _setTriggerWidth(): void {
692
- this._triggerWidth = this._getTriggerRect().width;
693
- /** should remove after after https://github.com/angular/material2/pull/8765 merged **/
694
- if (this._cdkOverlay && this._cdkOverlay.overlayRef) {
695
- this._cdkOverlay.overlayRef.updateSize({
696
- width: this._triggerWidth
697
- });
698
- }
699
- }
700
-
701
- _getTriggerRect(): ClientRect {
702
- return this.trigger.nativeElement.getBoundingClientRect();
703
- }
704
-
705
- writeValue(value: string | string[]): void {
706
- this._updateValue(value, false);
707
- }
708
-
709
- registerOnChange(fn: (value: string | string[]) => void): void {
710
- this.onChange = fn;
711
- }
712
-
713
- registerOnTouched(fn: () => void): void {
714
- this.onTouched = fn;
715
- }
716
-
717
- setDisabledState(isDisabled: boolean): void {
718
- this.Disabled = isDisabled;
719
- }
720
-
721
- dropDownScroll(ul: HTMLUListElement): void {
722
- if (ul && ul.scrollHeight - ul.scrollTop === ul.clientHeight) {
723
- this.ScrollToBottom.emit(true);
724
- }
725
- }
726
-
727
- checkDropDownScroll(): void {
728
- if (
729
- this.dropdownUl &&
730
- this.dropdownUl.nativeElement.scrollHeight ===
731
- this.dropdownUl.nativeElement.clientHeight
732
- ) {
733
- this.ScrollToBottom.emit(true);
734
- }
735
- }
736
-
737
- constructor(
738
- private _elementRef: ElementRef,
739
- private _renderer: Renderer2,
740
- private cDRef: ChangeDetectorRef
741
- ) {
742
- this._el = this._elementRef.nativeElement;
743
- }
744
-
745
- ngAfterContentInit(): void {
746
- if (this._value != null) {
747
- this.flushComponentState();
748
- }
749
- }
750
-
751
- ngOnInit(): void {
752
- this.updateFilterOption();
753
- this.setClassMap();
754
- this.setDropDownClassMap();
755
- }
756
-
757
- ngAfterContentChecked(): void {
758
- if (this._cacheOptions !== this._options) {
759
- /** update filter option after every content check cycle */
760
- this.updateFilterOption();
761
- this._cacheOptions = this._options;
762
- } else {
763
- this.updateFilterOption(false);
764
- }
765
-
766
- if (this.FirstDefault) {
767
- if (!this._value && this._options) {
768
- if (this._options[0] !== undefined && this._options[0].Value) {
769
- this.chooseOption(this._options[0], false);
770
- setTimeout(() => {
771
- this.onChange(this._options[0].Value);
772
- });
773
- }
774
- }
775
- }
776
- }
777
-
778
- private _updateValue(
779
- value: string[] | string,
780
- emitChange: boolean = true
781
- ): void {
782
- if (this._value === value) {
783
- return;
784
- }
785
- if (value == null && this.Multiple) {
786
- this._value = [];
787
- } else {
788
- this._value = value;
789
- }
790
- if (!this.Multiple) {
791
- if (value == null) { // @ts-ignore
792
- this._selectedOption = null;
793
- } else {
794
- this.updateSelectedOption(value);
795
- }
796
- } else {
797
- if (value) {
798
- if (value.length === 0) {
799
- this.clearAllSelectedOption(emitChange);
800
- } else {
801
- this.updateSelectedOption(value, true);
802
- }
803
- } else if (value == null) {
804
- this.clearAllSelectedOption(emitChange);
805
- }
806
- }
807
- }
808
- }