@updevs/components 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (310) hide show
  1. package/README.md +5 -22
  2. package/assets/styles/_bootstrap-components.scss +38 -0
  3. package/assets/styles/_bootstrap-config.scss +7 -0
  4. package/assets/styles/_bootstrap-override.scss +78 -0
  5. package/assets/styles/_config.scss +9 -0
  6. package/assets/styles/_core.scss +71 -0
  7. package/assets/styles/_mixins.scss +2 -0
  8. package/assets/styles/_updevs.scss +9 -0
  9. package/assets/styles/_utilities.scss +98 -0
  10. package/assets/styles/_variables-dark.scss +17 -0
  11. package/assets/styles/_variables.scss +934 -0
  12. package/assets/styles/fonts/_webfonts.scss +15 -0
  13. package/assets/styles/layout/_animations.scss +62 -0
  14. package/assets/styles/layout/_core.scss +61 -0
  15. package/assets/styles/layout/_dark.scss +72 -0
  16. package/assets/styles/layout/_footer.scss +12 -0
  17. package/assets/styles/layout/_navbar.scss +380 -0
  18. package/assets/styles/layout/_page.scss +169 -0
  19. package/assets/styles/layout/_root.scss +72 -0
  20. package/assets/styles/mixins/_functions.scss +43 -0
  21. package/assets/styles/mixins/_mixins.scss +68 -0
  22. package/assets/styles/ui/_accordion.scss +24 -0
  23. package/assets/styles/ui/_alerts.scss +59 -0
  24. package/assets/styles/ui/_avatars.scss +118 -0
  25. package/assets/styles/ui/_badges.scss +79 -0
  26. package/assets/styles/ui/_breadcrumbs.scss +50 -0
  27. package/assets/styles/ui/_button-group.scss +16 -0
  28. package/assets/styles/ui/_buttons.scss +265 -0
  29. package/assets/styles/ui/_calendars.scss +104 -0
  30. package/assets/styles/ui/_cards.scss +586 -0
  31. package/assets/styles/ui/_carousel.scss +68 -0
  32. package/assets/styles/ui/_charts.scss +61 -0
  33. package/assets/styles/ui/_chips.scss +0 -0
  34. package/assets/styles/ui/_close.scss +7 -0
  35. package/assets/styles/ui/_datagrid.scss +17 -0
  36. package/assets/styles/ui/_dropdowns.scss +117 -0
  37. package/assets/styles/ui/_empty.scss +65 -0
  38. package/assets/styles/ui/_flags.scss +31 -0
  39. package/assets/styles/ui/_forms.scss +224 -0
  40. package/assets/styles/ui/_grid.scss +115 -0
  41. package/assets/styles/ui/_icons.scss +72 -0
  42. package/assets/styles/ui/_images.scss +15 -0
  43. package/assets/styles/ui/_legend.scss +12 -0
  44. package/assets/styles/ui/_lists.scss +127 -0
  45. package/assets/styles/ui/_loaders.scss +72 -0
  46. package/assets/styles/ui/_login.scss +3 -0
  47. package/assets/styles/ui/_markdown.scss +42 -0
  48. package/assets/styles/ui/_modals.scss +67 -0
  49. package/assets/styles/ui/_nav.scss +92 -0
  50. package/assets/styles/ui/_offcanvas.scss +17 -0
  51. package/assets/styles/ui/_pagination.scss +56 -0
  52. package/assets/styles/ui/_payments.scss +28 -0
  53. package/assets/styles/ui/_placeholder.scss +9 -0
  54. package/assets/styles/ui/_popovers.scss +2 -0
  55. package/assets/styles/ui/_progress.scss +107 -0
  56. package/assets/styles/ui/_ribbons.scss +156 -0
  57. package/assets/styles/ui/_stars.scss +13 -0
  58. package/assets/styles/ui/_status.scss +163 -0
  59. package/assets/styles/ui/_steps.scss +152 -0
  60. package/assets/styles/ui/_switch-icon.scss +211 -0
  61. package/assets/styles/ui/_tables.scss +150 -0
  62. package/assets/styles/ui/_tags.scss +57 -0
  63. package/assets/styles/ui/_timeline.scss +61 -0
  64. package/assets/styles/ui/_toasts.scss +19 -0
  65. package/assets/styles/ui/_toolbar.scss +10 -0
  66. package/assets/styles/ui/_tracking.scss +29 -0
  67. package/assets/styles/ui/_type.scss +169 -0
  68. package/assets/styles/ui/forms/_form-check.scss +91 -0
  69. package/assets/styles/ui/forms/_form-colorinput.scss +54 -0
  70. package/assets/styles/ui/forms/_form-custom.scss +28 -0
  71. package/assets/styles/ui/forms/_form-icon.scss +35 -0
  72. package/assets/styles/ui/forms/_form-imagecheck.scss +104 -0
  73. package/assets/styles/ui/forms/_form-selectgroup.scss +153 -0
  74. package/assets/styles/ui/forms/_validation.scss +13 -0
  75. package/assets/styles/ui/typo/_hr.scss +74 -0
  76. package/assets/styles/utils/_background.scss +15 -0
  77. package/assets/styles/utils/_colors.scss +40 -0
  78. package/assets/styles/utils/_opacity.scss +7 -0
  79. package/assets/styles/utils/_scroll.scss +47 -0
  80. package/assets/styles/utils/_shadow.scss +17 -0
  81. package/assets/styles/utils/_sizing.scss +10 -0
  82. package/assets/styles/utils/_text.scss +15 -0
  83. package/button/ng-package.json +7 -0
  84. package/button/src/button.component.html +8 -0
  85. package/button/src/button.component.scss +5 -0
  86. package/button/src/button.component.spec.ts +23 -0
  87. package/button/src/button.component.ts +154 -0
  88. package/button/src/index.ts +1 -0
  89. package/button/src/public-api.ts +2 -0
  90. package/button/src/upd-button.module.ts +17 -0
  91. package/card/ng-package.json +7 -0
  92. package/card/src/card.component.html +105 -0
  93. package/card/src/card.component.scss +47 -0
  94. package/card/src/card.component.spec.ts +23 -0
  95. package/card/src/card.component.ts +112 -0
  96. package/card/src/directives/card-actions.directive.spec.ts +8 -0
  97. package/card/src/directives/card-actions.directive.ts +11 -0
  98. package/card/src/directives/card-footer.directive.spec.ts +8 -0
  99. package/card/src/directives/card-footer.directive.ts +11 -0
  100. package/card/src/directives/card-header.directive.spec.ts +8 -0
  101. package/card/src/directives/card-header.directive.ts +11 -0
  102. package/card/src/directives/card-image.directive.spec.ts +8 -0
  103. package/card/src/directives/card-image.directive.ts +11 -0
  104. package/card/src/directives/public-api.ts +4 -0
  105. package/card/src/index.ts +1 -0
  106. package/card/src/public-api.ts +3 -0
  107. package/card/src/types/card-state.type.ts +1 -0
  108. package/card/src/types/card-style.type.ts +1 -0
  109. package/card/src/types/hover-effect.type.ts +1 -0
  110. package/card/src/types/public-api.ts +5 -0
  111. package/card/src/types/ribbon-style.type.ts +1 -0
  112. package/card/src/types/status-position.type.ts +1 -0
  113. package/card/src/upd-card.module.ts +32 -0
  114. package/dropdown/ng-package.json +7 -0
  115. package/dropdown/src/dropdown.component.html +32 -0
  116. package/dropdown/src/dropdown.component.scss +19 -0
  117. package/dropdown/src/dropdown.component.spec.ts +23 -0
  118. package/dropdown/src/dropdown.component.ts +182 -0
  119. package/dropdown/src/index.ts +1 -0
  120. package/dropdown/src/models/dropdown-item.ts +22 -0
  121. package/dropdown/src/models/dropdown-item.type.ts +1 -0
  122. package/dropdown/src/models/public-api.ts +2 -0
  123. package/dropdown/src/public-api.ts +3 -0
  124. package/dropdown/src/upd-dropdown.module.ts +25 -0
  125. package/form/ng-package.json +7 -0
  126. package/form/src/form.module.ts +10 -0
  127. package/form/src/index.ts +1 -0
  128. package/form/src/public-api.ts +1 -0
  129. package/form-controls/checkbox/ng-package.json +7 -0
  130. package/form-controls/checkbox/src/checkbox.component.html +7 -0
  131. package/form-controls/checkbox/src/checkbox.component.scss +0 -0
  132. package/form-controls/checkbox/src/checkbox.component.spec.ts +23 -0
  133. package/form-controls/checkbox/src/checkbox.component.ts +48 -0
  134. package/form-controls/checkbox/src/index.ts +1 -0
  135. package/form-controls/checkbox/src/public-api.ts +3 -0
  136. package/form-controls/checkbox/src/upd-checkbox.module.ts +19 -0
  137. package/form-controls/input/ng-package.json +7 -0
  138. package/form-controls/input/src/directives/input-append.directive.spec.ts +8 -0
  139. package/form-controls/input/src/directives/input-append.directive.ts +11 -0
  140. package/form-controls/input/src/directives/input-prepend.directive.spec.ts +8 -0
  141. package/form-controls/input/src/directives/input-prepend.directive.ts +11 -0
  142. package/form-controls/input/src/directives/public-api.ts +2 -0
  143. package/form-controls/input/src/index.ts +1 -0
  144. package/form-controls/input/src/input.component.html +82 -0
  145. package/form-controls/input/src/input.component.scss +13 -0
  146. package/form-controls/input/src/input.component.spec.ts +23 -0
  147. package/form-controls/input/src/input.component.ts +124 -0
  148. package/form-controls/input/src/public-api.ts +4 -0
  149. package/form-controls/input/src/types/input.type.ts +1 -0
  150. package/form-controls/input/src/types/loader-position.type.ts +1 -0
  151. package/form-controls/input/src/types/public-api.ts +2 -0
  152. package/form-controls/input/src/upd-input.module.ts +29 -0
  153. package/form-controls/radio/ng-package.json +7 -0
  154. package/form-controls/radio/src/index.ts +1 -0
  155. package/form-controls/radio/src/public-api.ts +2 -0
  156. package/form-controls/radio/src/radio.component.html +7 -0
  157. package/form-controls/radio/src/radio.component.scss +0 -0
  158. package/form-controls/radio/src/radio.component.spec.ts +23 -0
  159. package/form-controls/radio/src/radio.component.ts +47 -0
  160. package/form-controls/radio/src/upd-radio.module.ts +17 -0
  161. package/form-controls/select/ng-package.json +7 -0
  162. package/form-controls/select/src/components/multiple/select-multiple.component.html +41 -0
  163. package/form-controls/select/src/components/multiple/select-multiple.component.scss +6 -0
  164. package/form-controls/select/src/components/multiple/select-multiple.component.spec.ts +21 -0
  165. package/form-controls/select/src/components/multiple/select-multiple.component.ts +69 -0
  166. package/form-controls/select/src/components/shared.scss +40 -0
  167. package/form-controls/select/src/components/single/select.component.html +53 -0
  168. package/form-controls/select/src/components/single/select.component.scss +3 -0
  169. package/form-controls/select/src/components/single/select.component.spec.ts +23 -0
  170. package/form-controls/select/src/components/single/select.component.ts +58 -0
  171. package/form-controls/select/src/index.ts +1 -0
  172. package/form-controls/select/src/models/abstractions/base-select.component.ts +259 -0
  173. package/form-controls/select/src/models/public-api.ts +1 -0
  174. package/form-controls/select/src/models/select-item.ts +26 -0
  175. package/form-controls/select/src/public-api.ts +4 -0
  176. package/form-controls/select/src/upd-select.module.ts +32 -0
  177. package/form-controls/textarea/ng-package.json +7 -0
  178. package/form-controls/textarea/src/index.ts +1 -0
  179. package/form-controls/textarea/src/public-api.ts +2 -0
  180. package/form-controls/textarea/src/textarea.component.html +8 -0
  181. package/form-controls/textarea/src/textarea.component.scss +0 -0
  182. package/form-controls/textarea/src/textarea.component.spec.ts +23 -0
  183. package/form-controls/textarea/src/textarea.component.ts +47 -0
  184. package/form-controls/textarea/src/upd-textarea.module.ts +17 -0
  185. package/form-controls/time-picker/ng-package.json +7 -0
  186. package/form-controls/time-picker/src/assets/i18n/en.json +5 -0
  187. package/form-controls/time-picker/src/assets/i18n/pt.json +5 -0
  188. package/form-controls/time-picker/src/index.ts +1 -0
  189. package/form-controls/time-picker/src/public-api.ts +3 -0
  190. package/form-controls/time-picker/src/time-picker.component.html +17 -0
  191. package/form-controls/time-picker/src/time-picker.component.scss +10 -0
  192. package/form-controls/time-picker/src/time-picker.component.spec.ts +21 -0
  193. package/form-controls/time-picker/src/time-picker.component.ts +110 -0
  194. package/form-controls/time-picker/src/time-selector/time-selector.component.html +44 -0
  195. package/form-controls/time-picker/src/time-selector/time-selector.component.scss +47 -0
  196. package/form-controls/time-picker/src/time-selector/time-selector.component.spec.ts +21 -0
  197. package/form-controls/time-picker/src/time-selector/time-selector.component.ts +107 -0
  198. package/form-controls/time-picker/src/upd-time-picker.module.ts +39 -0
  199. package/layout/ng-package.json +7 -0
  200. package/layout/src/abstractions/base-page.component.ts +21 -0
  201. package/layout/src/abstractions/public-api.ts +1 -0
  202. package/layout/src/assets/i18n/en.json +5 -0
  203. package/layout/src/assets/i18n/pt.json +5 -0
  204. package/layout/src/index.ts +1 -0
  205. package/layout/src/layouts/blank-layout/blank-layout.component.html +1 -0
  206. package/layout/src/layouts/blank-layout/blank-layout.component.scss +0 -0
  207. package/layout/src/layouts/blank-layout/blank-layout.component.spec.ts +23 -0
  208. package/layout/src/layouts/blank-layout/blank-layout.component.ts +10 -0
  209. package/layout/src/layouts/blank-layout/blank-layout.module.ts +17 -0
  210. package/layout/src/layouts/public-api.ts +4 -0
  211. package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.html +14 -0
  212. package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.scss +0 -0
  213. package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.spec.ts +23 -0
  214. package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.ts +31 -0
  215. package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.module.ts +52 -0
  216. package/layout/src/models/public-api.ts +1 -0
  217. package/layout/src/models/upd-layout-config.model.ts +71 -0
  218. package/layout/src/models/upd-layout.config.ts +37 -0
  219. package/layout/src/pages/auth-flow/auth-flow-routing.module.ts +21 -0
  220. package/layout/src/pages/auth-flow/auth-flow.module.ts +29 -0
  221. package/layout/src/pages/auth-flow/logged-out/logged-out.component.html +1 -0
  222. package/layout/src/pages/auth-flow/logged-out/logged-out.component.scss +0 -0
  223. package/layout/src/pages/auth-flow/logged-out/logged-out.component.spec.ts +23 -0
  224. package/layout/src/pages/auth-flow/logged-out/logged-out.component.ts +10 -0
  225. package/layout/src/pages/auth-flow/login/login.component.html +96 -0
  226. package/layout/src/pages/auth-flow/login/login.component.scss +0 -0
  227. package/layout/src/pages/auth-flow/login/login.component.spec.ts +23 -0
  228. package/layout/src/pages/auth-flow/login/login.component.ts +26 -0
  229. package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.html +1 -0
  230. package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.scss +0 -0
  231. package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.spec.ts +23 -0
  232. package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.ts +10 -0
  233. package/layout/src/pages/auth-flow/public-api.ts +5 -0
  234. package/layout/src/pages/public-api.ts +1 -0
  235. package/layout/src/partials/footer/footer-copyright.directive.spec.ts +8 -0
  236. package/layout/src/partials/footer/footer-copyright.directive.ts +9 -0
  237. package/layout/src/partials/footer/footer.component.html +30 -0
  238. package/layout/src/partials/footer/footer.component.scss +0 -0
  239. package/{src/lib/components.component.spec.ts → layout/src/partials/footer/footer.component.spec.ts} +6 -6
  240. package/layout/src/partials/footer/footer.component.ts +73 -0
  241. package/layout/src/partials/footer/public-api.ts +2 -0
  242. package/layout/src/partials/header/header-style.type.ts +1 -0
  243. package/layout/src/partials/header/header.component.html +163 -0
  244. package/layout/src/partials/header/header.component.scss +0 -0
  245. package/layout/src/partials/header/header.component.spec.ts +23 -0
  246. package/layout/src/partials/header/header.component.ts +86 -0
  247. package/layout/src/partials/header/public-api.ts +2 -0
  248. package/layout/src/partials/page-header/page-header.component.html +19 -0
  249. package/layout/src/partials/page-header/page-header.component.scss +0 -0
  250. package/layout/src/partials/page-header/page-header.component.spec.ts +23 -0
  251. package/layout/src/partials/page-header/page-header.component.ts +11 -0
  252. package/layout/src/partials/page-header/public-api.ts +1 -0
  253. package/layout/src/partials/public-api.ts +4 -0
  254. package/layout/src/partials/sidebar/public-api.ts +1 -0
  255. package/layout/src/partials/sidebar/sidebar.component.html +62 -0
  256. package/layout/src/partials/sidebar/sidebar.component.scss +0 -0
  257. package/layout/src/partials/sidebar/sidebar.component.spec.ts +23 -0
  258. package/layout/src/partials/sidebar/sidebar.component.ts +161 -0
  259. package/layout/src/public-api.ts +7 -0
  260. package/layout/src/services/public-api.ts +1 -0
  261. package/{src/lib/components.service.spec.ts → layout/src/services/upd-layout-config.service.spec.ts} +4 -4
  262. package/layout/src/services/upd-layout-config.service.ts +20 -0
  263. package/layout/src/tools/layout.constants.ts +18 -0
  264. package/layout/src/upd-layout.module.ts +34 -0
  265. package/link/ng-package.json +7 -0
  266. package/link/src/index.ts +1 -0
  267. package/link/src/link.component.html +3 -0
  268. package/link/src/link.component.scss +3 -0
  269. package/link/src/link.component.spec.ts +23 -0
  270. package/link/src/link.component.ts +48 -0
  271. package/link/src/public-api.ts +3 -0
  272. package/link/src/target.type.ts +1 -0
  273. package/link/src/upd-link.module.ts +17 -0
  274. package/list/ng-package.json +7 -0
  275. package/list/src/assets/i18n/en.json +5 -0
  276. package/list/src/assets/i18n/pt.json +5 -0
  277. package/list/src/index.ts +1 -0
  278. package/list/src/list.component.html +58 -0
  279. package/list/src/list.component.scss +21 -0
  280. package/list/src/list.component.spec.ts +23 -0
  281. package/list/src/list.component.ts +147 -0
  282. package/list/src/models/badge-position.type.ts +1 -0
  283. package/list/src/models/list-item.model.ts +35 -0
  284. package/list/src/models/list-item.ts +21 -0
  285. package/list/src/models/public-api.ts +2 -0
  286. package/list/src/public-api.ts +3 -0
  287. package/list/src/upd-list.module.ts +30 -0
  288. package/ng-package.json +9 -6
  289. package/package.json +8 -5
  290. package/popover/ng-package.json +7 -0
  291. package/popover/src/index.ts +1 -0
  292. package/popover/src/popover.component.html +20 -0
  293. package/popover/src/popover.component.scss +8 -0
  294. package/popover/src/popover.component.spec.ts +23 -0
  295. package/popover/src/popover.component.ts +53 -0
  296. package/popover/src/popover.directive.spec.ts +8 -0
  297. package/popover/src/popover.directive.ts +128 -0
  298. package/popover/src/public-api.ts +3 -0
  299. package/popover/src/upd-popover.module.ts +20 -0
  300. package/src/lib/index.ts +1 -0
  301. package/src/lib/public-api.ts +2 -0
  302. package/src/lib/types/component-size.type.ts +1 -0
  303. package/src/lib/types/public-api.ts +2 -0
  304. package/src/lib/types/validation-status.type.ts +1 -0
  305. package/src/lib/upd-components.module.ts +6 -0
  306. package/src/public-api.ts +1 -7
  307. package/tsconfig.lib.json +11 -11
  308. package/src/lib/components.component.ts +0 -14
  309. package/src/lib/components.module.ts +0 -17
  310. package/src/lib/components.service.ts +0 -9
@@ -0,0 +1,86 @@
1
+ import { Component, ViewEncapsulation, Input, HostBinding, OnChanges, SimpleChanges, OnInit } from '@angular/core';
2
+ import { UpdCoreLayoutConfigService, BaseComponent, LayoutService } from '@updevs/sdk/layout';
3
+ import { TablerIconsType } from '@updevs/icons';
4
+ import { TranslocoService } from '@ngneat/transloco';
5
+
6
+ import { HeaderStyleType } from './header-style.type';
7
+
8
+ @Component({
9
+ selector: 'upd-header',
10
+ templateUrl: './header.component.html',
11
+ styleUrls: ['./header.component.scss'],
12
+ encapsulation: ViewEncapsulation.None
13
+ })
14
+ export class HeaderComponent extends BaseComponent implements OnInit, OnChanges {
15
+ @HostBinding('class') wrapperClasses = '';
16
+
17
+ @Input() style: HeaderStyleType = 'light';
18
+ @Input() showSearchBar = true;
19
+
20
+ nextThemeIcon: TablerIconsType = 'moon';
21
+ nextThemeColor = 'black';
22
+ currentNotificationsIcon: TablerIconsType = 'bell';
23
+ hasNewNotifications = false;
24
+ showNotifications = false;
25
+ showLanguageSwitcher = true; // TODO: add on config.
26
+ showUserMenu = false;
27
+
28
+ private baseWrapperClasses = 'navbar navbar-expand-md d-none d-lg-flex d-print-none';
29
+
30
+ constructor(
31
+ private coreLayoutConfigService: UpdCoreLayoutConfigService,
32
+ private layoutService: LayoutService,
33
+ private translocoService: TranslocoService
34
+ ) {
35
+ super();
36
+ }
37
+
38
+ ngOnInit(): void {
39
+ this.updateWrapperClasses();
40
+
41
+ if (this.coreLayoutConfigService.config.showNotificationsButton) {
42
+ this.setupNotifications();
43
+ }
44
+
45
+ if (this.coreLayoutConfigService.config.showUserMenu) {
46
+ this.showUserMenu = true;
47
+ }
48
+ }
49
+
50
+ ngOnChanges(changes: SimpleChanges): void {
51
+ if (!!changes['style'].currentValue) {
52
+ this.updateWrapperClasses();
53
+ }
54
+ }
55
+
56
+ switchTheme(): void {
57
+ const isDarkMode = this.nextThemeIcon === 'moon';
58
+ this.nextThemeIcon = isDarkMode ? 'sun' : 'moon';
59
+ this.nextThemeColor = isDarkMode ? 'white' : 'black';
60
+
61
+ this.layoutService.toggleDarkMode(isDarkMode);
62
+ }
63
+
64
+ // TODO: implement.
65
+ switchLanguage(): void {
66
+ const currentLang = this.translocoService.getActiveLang();
67
+ this.translocoService.setActiveLang(currentLang === 'en' ? 'pt' : 'en');
68
+ }
69
+
70
+ openNotifications(): void {
71
+ this.updateNotificationsIcon();
72
+ }
73
+
74
+ private setupNotifications(): void {
75
+ this.showNotifications = true;
76
+ }
77
+
78
+ private updateNotificationsIcon(): void {
79
+ this.currentNotificationsIcon = this.currentNotificationsIcon === 'bell' ? 'bell-ringing' : 'bell';
80
+ this.hasNewNotifications = !this.hasNewNotifications;
81
+ }
82
+
83
+ private updateWrapperClasses(): void {
84
+ this.wrapperClasses = `${this.baseWrapperClasses} navbar-${this.style}`;
85
+ }
86
+ }
@@ -0,0 +1,2 @@
1
+ export * from './header.component';
2
+ export * from './header-style.type';
@@ -0,0 +1,19 @@
1
+ <div class="page-header d-print-none">
2
+ <div class="container-xl">
3
+ <div class="row g-2 align-items-center">
4
+ <div class="col">
5
+ <div class="page-pretitle">
6
+ {{model.titleHeader}}
7
+ </div>
8
+ <h2 class="page-title">
9
+ {{model.title}}
10
+ </h2>
11
+ </div>
12
+ <div *ngIf="(model.actionButtons?.length || 0) > 0" class="col-auto ms-auto d-print-none">
13
+ <div class="btn-list">
14
+ <upd-button *ngFor="let btn of model.actionButtons" [model]="btn!"></upd-button>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { PageHeaderComponent } from './page-header.component';
4
+
5
+ describe('PageHeaderComponent', () => {
6
+ let component: PageHeaderComponent;
7
+ let fixture: ComponentFixture<PageHeaderComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ PageHeaderComponent ]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(PageHeaderComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,11 @@
1
+ import { Component, Input } from '@angular/core';
2
+ import { PageHeaderModel } from '@updevs/sdk/layout';
3
+
4
+ @Component({
5
+ selector: 'upd-page-header',
6
+ templateUrl: './page-header.component.html',
7
+ styleUrls: ['./page-header.component.scss']
8
+ })
9
+ export class PageHeaderComponent {
10
+ @Input() model!: PageHeaderModel;
11
+ }
@@ -0,0 +1 @@
1
+ export * from './page-header.component';
@@ -0,0 +1,4 @@
1
+ export * from './footer/public-api';
2
+ export * from './header/public-api';
3
+ export * from './page-header/public-api';
4
+ export * from './sidebar/public-api';
@@ -0,0 +1 @@
1
+ export * from './sidebar.component';
@@ -0,0 +1,62 @@
1
+ <div class="container-fluid">
2
+ <button class="navbar-toggler" type="button">
3
+ <span class="navbar-toggler-icon"></span>
4
+ </button>
5
+ <h1 class="navbar-brand navbar-brand-autodark">
6
+ <a href=".">
7
+ <img width="110" height="32" class="navbar-brand-image upd-brand-logo"/>
8
+ </a>
9
+ </h1>
10
+ <div class="collapse navbar-collapse">
11
+ <ul class="navbar-nav pt-lg-3">
12
+ <li *ngFor="let item of menuItems" class="nav-item" [class.dropdown]="hasChildren(item)"
13
+ [class.active]="item.isActive">
14
+ <ng-container [ngTemplateOutlet]="itemTpl" [ngTemplateOutletContext]="{menuItem: item}">
15
+ </ng-container>
16
+ </li>
17
+ </ul>
18
+ </div>
19
+ </div>
20
+
21
+ <ng-template #itemTpl let-item="menuItem">
22
+ <upd-link [isNavigation]="true" (clicked)="onMenuItemClick(item)"
23
+ [customClasses]="[hasChildren(item) ? 'dropdown-toggle' : '', item.isActive ? 'show' : '']">
24
+ <span class="nav-link-icon d-md-none d-lg-inline-block">
25
+ <upd-icon [model]="item.icon"></upd-icon>
26
+ </span>
27
+ <span class="nav-link-title">{{item.title}}</span>
28
+ </upd-link>
29
+ <ng-container *ngIf="hasChildren(item)" [ngTemplateOutlet]="childrenTpl" [ngTemplateOutletContext]="{menuItem: item}">
30
+ </ng-container>
31
+ </ng-template>
32
+
33
+ <ng-template #childrenTpl let-item="menuItem">
34
+ <div class="dropdown-menu" [class.show]="item.isActive">
35
+ <div class="dropdown-menu-columns">
36
+ <div class="dropdown-menu-column">
37
+ <ng-container *ngFor="let child of item.children">
38
+ <upd-link *ngIf="!hasChildren(child); else grandchildTpl" (clicked)="onMenuItemClick(child)"
39
+ [customClasses]="['dropdown-item', child.isActive ? 'active' : '']">
40
+ {{child.title}}
41
+ </upd-link>
42
+ <ng-template #grandchildTpl>
43
+ <div class="dropend">
44
+ <upd-link (clicked)="onMenuItemClick(child)"
45
+ [customClasses]="['dropdown-item', 'dropdown-toggle', child.isActive ? 'active' : '']">
46
+ {{child.title}}
47
+ </upd-link>
48
+ <div class="dropdown-menu" [class.show]="child.isActive">
49
+ <ng-container *ngFor="let grandchild of child.children">
50
+ <upd-link (clicked)="onMenuItemClick(grandchild)"
51
+ [customClasses]="['dropdown-item', grandchild.isActive ? 'active' : '']">
52
+ {{grandchild.title}}
53
+ </upd-link>
54
+ </ng-container>
55
+ </div>
56
+ </div>
57
+ </ng-template>
58
+ </ng-container>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </ng-template>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { SidebarComponent } from './sidebar.component';
4
+
5
+ describe('SidebarComponent', () => {
6
+ let component: SidebarComponent;
7
+ let fixture: ComponentFixture<SidebarComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ SidebarComponent ]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(SidebarComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,161 @@
1
+ import { Component, HostBinding, ViewEncapsulation, OnInit } from '@angular/core';
2
+ import { Router, NavigationStart } from '@angular/router';
3
+ import { OptionalType } from '@updevs/sdk/types';
4
+ import { RouteDataModel } from '@updevs/sdk/routes';
5
+ import { BaseComponent } from '@updevs/sdk/layout';
6
+ import { filter } from 'rxjs';
7
+
8
+ @Component({
9
+ selector: 'upd-sidebar',
10
+ templateUrl: './sidebar.component.html',
11
+ styleUrls: ['./sidebar.component.scss'],
12
+ encapsulation: ViewEncapsulation.None
13
+ })
14
+ export class SidebarComponent extends BaseComponent implements OnInit {
15
+ @HostBinding('class') wrapperClasses = 'navbar navbar-vertical navbar-expand-lg';
16
+ @HostBinding('attr.data-bs-theme') theme = 'dark';
17
+
18
+ menuItems: RouteDataModel[] = [];
19
+
20
+ constructor(
21
+ private router: Router
22
+ ) {
23
+ super();
24
+ }
25
+
26
+ ngOnInit(): void {
27
+ // TODO: remove demo code.
28
+ const sampleCardsItem = new RouteDataModel({
29
+ title: 'Sample cards',
30
+ icon: { tablerIcon: 'home' }
31
+ });
32
+ const cardActionsItem = new RouteDataModel({
33
+ title: 'Card actions',
34
+ icon: { tablerIcon: 'folder' }
35
+ });
36
+ const emptyPageItem = new RouteDataModel({
37
+ title: 'Empty page',
38
+ icon: { tablerIcon: 'home' }
39
+ });
40
+ const cardsItem = new RouteDataModel({
41
+ title: 'Cards',
42
+ icon: { tablerIcon: 'user' },
43
+ children: [
44
+ sampleCardsItem,
45
+ cardActionsItem
46
+ ]
47
+ });
48
+ const interfaceItem = new RouteDataModel({
49
+ title: 'Interface',
50
+ icon: { tablerIcon: 'device-desktop' },
51
+ children: [
52
+ emptyPageItem,
53
+ cardsItem
54
+ ]
55
+ });
56
+ sampleCardsItem.parent = cardsItem;
57
+ cardActionsItem.parent = cardsItem;
58
+ emptyPageItem.parent = interfaceItem;
59
+ cardsItem.parent = interfaceItem;
60
+ this.menuItems = [
61
+ new RouteDataModel({
62
+ title: 'Home',
63
+ icon: { tablerIcon: 'home' }
64
+ }),
65
+ new RouteDataModel({
66
+ title: 'Archives',
67
+ icon: { tablerIcon: 'folder' }
68
+ }),
69
+ interfaceItem,
70
+ new RouteDataModel({
71
+ title: 'Library',
72
+ icon: { tablerIcon: 'building' }
73
+ })
74
+ ];
75
+ // END demo code
76
+
77
+ const routerSub = this.router.events.pipe(
78
+ filter(event => event instanceof NavigationStart)
79
+ ).subscribe(event => this.updateActiveRoute((<NavigationStart> event).url));
80
+
81
+ this.updateActiveRoute(this.router.url);
82
+ this.addSubscriptions(routerSub);
83
+ }
84
+
85
+ onMenuItemClick(item: RouteDataModel): void {
86
+ this.resetMenuState(this.menuItems);
87
+
88
+ item.isActive = true;
89
+
90
+ this.updateParents(item);
91
+
92
+ if (!!item.clickFunction) {
93
+ item.clickFunction();
94
+ return;
95
+ }
96
+
97
+ if ((item.children?.length || 0) > 0) {
98
+ return;
99
+ }
100
+
101
+ this.router.navigate(item.getFullPath()).then();
102
+ }
103
+
104
+ hasChildren(item: RouteDataModel): boolean {
105
+ return (item.children?.length || 0) > 0;
106
+ }
107
+
108
+ private findActiveNode(item: RouteDataModel, fullPath: string): OptionalType<RouteDataModel> {
109
+ if (item.fullPath === fullPath) {
110
+ return item;
111
+ } else if (item.children.length > 0) {
112
+ let result;
113
+
114
+ for (let i = 0; !result && i < item.children.length; i++) {
115
+ result = this.findActiveNode(item.children[i], fullPath);
116
+ }
117
+
118
+ return result;
119
+ }
120
+
121
+ return undefined;
122
+ }
123
+
124
+ private updateActiveRoute(newPath: string): void {
125
+ this.resetMenuState(this.menuItems);
126
+
127
+ let item: OptionalType<RouteDataModel>;
128
+
129
+ for (const mi of this.menuItems) {
130
+ item = this.findActiveNode(mi, newPath);
131
+
132
+ if (!!item) {
133
+ break;
134
+ }
135
+ }
136
+
137
+ while (!!item) {
138
+ item.isActive = true;
139
+ item = item.parent;
140
+ }
141
+ }
142
+
143
+ private resetMenuState(items: RouteDataModel[]): void {
144
+ items.forEach(i => {
145
+ i.isActive = false;
146
+
147
+ if (i.children.length > 0) {
148
+ this.resetMenuState(i.children);
149
+ }
150
+ });
151
+ }
152
+
153
+ private updateParents(menuItem: RouteDataModel): void {
154
+ let item: OptionalType<RouteDataModel> = menuItem;
155
+
156
+ while (!!item) {
157
+ item.isActive = true;
158
+ item = item.parent;
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,7 @@
1
+ export * from './abstractions/public-api';
2
+ export * from './layouts/public-api';
3
+ export * from './models/public-api';
4
+ export * from './pages/public-api';
5
+ export * from './partials/public-api';
6
+ export * from './services/public-api';
7
+ export * from './upd-layout.module';
@@ -0,0 +1 @@
1
+ export * from './upd-layout-config.service';
@@ -1,13 +1,13 @@
1
1
  import { TestBed } from '@angular/core/testing';
2
2
 
3
- import { ComponentsService } from './components.service';
3
+ import { UpdLayoutConfigService } from './upd-layout-config.service';
4
4
 
5
- describe('ComponentsService', () => {
6
- let service: ComponentsService;
5
+ describe('UpdLayoutConfigService', () => {
6
+ let service: UpdLayoutConfigService;
7
7
 
8
8
  beforeEach(() => {
9
9
  TestBed.configureTestingModule({});
10
- service = TestBed.inject(ComponentsService);
10
+ service = TestBed.inject(UpdLayoutConfigService);
11
11
  });
12
12
 
13
13
  it('should be created', () => {
@@ -0,0 +1,20 @@
1
+ import { Injectable, Inject } from '@angular/core';
2
+
3
+ import { UpdLayoutConfigModel } from '../models/upd-layout-config.model';
4
+ import { LayoutConstants } from '../tools/layout.constants';
5
+ import { UpdLayoutConfig } from '../models/upd-layout.config';
6
+
7
+ /**
8
+ * Layout configuration data.
9
+ */
10
+ @Injectable()
11
+ export class UpdLayoutConfigService {
12
+ /**
13
+ * Configuration (See: #upsee[p:models, i:UpdCoreLayoutConfigModel]).
14
+ */
15
+ readonly config: UpdLayoutConfigModel;
16
+
17
+ constructor(@Inject(LayoutConstants.defaultOptionsInjectionToken) layoutConfig: UpdLayoutConfig) {
18
+ this.config = new UpdLayoutConfigModel(layoutConfig);
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ import { InjectionToken } from '@angular/core';
2
+
3
+ import { UpdLayoutConfig } from '../models/upd-layout.config';
4
+
5
+ /**
6
+ * Layout constants.
7
+ */
8
+ export class LayoutConstants {
9
+ /**
10
+ * Key to inject the default configuration.
11
+ */
12
+ static defaultOptionsKey = 'upd-layout-default-options';
13
+
14
+ /**
15
+ * Injection token for the default configuration.
16
+ */
17
+ static defaultOptionsInjectionToken = new InjectionToken<UpdLayoutConfig>(LayoutConstants.defaultOptionsKey);
18
+ }
@@ -0,0 +1,34 @@
1
+ import { ModuleWithProviders, NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { UpdCoreLayoutModule } from '@updevs/sdk/layout';
4
+
5
+ import { UpdLayoutConfig } from './models/upd-layout.config';
6
+ import { LayoutConstants } from './tools/layout.constants';
7
+ import { UpdLayoutConfigService } from './services/upd-layout-config.service';
8
+
9
+ /**
10
+ * Layout module.
11
+ */
12
+ @NgModule({
13
+ imports: [
14
+ CommonModule,
15
+ UpdCoreLayoutModule
16
+ ],
17
+ providers: [
18
+ UpdLayoutConfigService
19
+ ]
20
+ })
21
+ export class UpdLayoutModule {
22
+ /**
23
+ * Sets up the layout module with the provided configuration.
24
+ * @param config Configuration (See: #updsee[p:abstractions, i:UpdCoreLayoutConfig]).
25
+ */
26
+ static forRoot(config: UpdLayoutConfig): ModuleWithProviders<UpdLayoutModule> {
27
+ return {
28
+ ngModule: UpdLayoutModule,
29
+ providers: [
30
+ { provide: LayoutConstants.defaultOptionsInjectionToken, useValue: config }
31
+ ]
32
+ };
33
+ }
34
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../../node_modules/@updevs/components/link",
4
+ "lib": {
5
+ "entryFile": "src/index.ts"
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ export * from './public-api';
@@ -0,0 +1,3 @@
1
+ <a [attr.href]="href" [attr.target]="target" [ngClass]="classes" (click)="onClick($event)">
2
+ <ng-content></ng-content>
3
+ </a>
@@ -0,0 +1,3 @@
1
+ a:hover {
2
+ cursor: pointer;
3
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { LinkComponent } from './link.component';
4
+
5
+ describe('LinkComponent', () => {
6
+ let component: LinkComponent;
7
+ let fixture: ComponentFixture<LinkComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [LinkComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(LinkComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,48 @@
1
+ import { Component, Output, EventEmitter, SimpleChanges, OnInit, OnChanges, Input, ViewEncapsulation } from '@angular/core';
2
+
3
+ import { LinkTargetType } from './target.type';
4
+
5
+ @Component({
6
+ selector: 'upd-link',
7
+ templateUrl: './link.component.html',
8
+ styleUrls: ['./link.component.scss'],
9
+ encapsulation: ViewEncapsulation.None
10
+ })
11
+ export class LinkComponent implements OnInit, OnChanges {
12
+ @Input() href?: string;
13
+ @Input() target: LinkTargetType = '_self';
14
+ @Input() customClasses: string[] = [];
15
+ @Input() isNavigation = false;
16
+
17
+ /**
18
+ * Emitted when the link is clicked.
19
+ * **NOTE:** The name of the event can not be 'click'. It would generate a conflict with the HTML event of same name.
20
+ * That would cause strange behaviors like preventing `isDisabled` from working correctly.
21
+ */
22
+ @Output() readonly clicked = new EventEmitter<any>();
23
+
24
+ classes: string[] = [];
25
+
26
+ ngOnInit(): void {
27
+ this.updateWrapperClasses();
28
+ }
29
+
30
+ ngOnChanges(changes: SimpleChanges): void {
31
+ this.updateWrapperClasses();
32
+ }
33
+
34
+ onClick(event: MouseEvent): void {
35
+ this.clicked.emit(undefined);
36
+ event.stopPropagation();
37
+ }
38
+
39
+ private updateWrapperClasses(): void {
40
+ const lClasses: string[] = [];
41
+
42
+ if (this.isNavigation) {
43
+ lClasses.push('nav-link');
44
+ }
45
+
46
+ this.classes = [...lClasses, ...this.customClasses];
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ export * from './link.component';
2
+ export * from './target.type';
3
+ export * from './upd-link.module';
@@ -0,0 +1 @@
1
+ export type LinkTargetType = '_blank' | '_self' | '_parent' | '_top';
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+ import { LinkComponent } from './link.component';
5
+
6
+ @NgModule({
7
+ imports: [
8
+ CommonModule
9
+ ],
10
+ declarations: [
11
+ LinkComponent
12
+ ],
13
+ exports: [
14
+ LinkComponent
15
+ ]
16
+ })
17
+ export class UpdLinkModule {}
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../../node_modules/@updevs/components/list",
4
+ "lib": {
5
+ "entryFile": "src/index.ts"
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "NoRecordsFound": "No records found.",
3
+ "Item": "item",
4
+ "Items": "items"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "NoRecordsFound": "Nenhum registro encontrado.",
3
+ "Item": "item",
4
+ "Items": "itens"
5
+ }
@@ -0,0 +1 @@
1
+ export * from './public-api';