@sgcloud-sgsistemas/base 1.0.15 → 1.0.16

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 (52) hide show
  1. package/dist/mobiage-base.min.css +2 -0
  2. package/dist/mobiage-base.min.css.map +1 -0
  3. package/dist/mobiage-base.min.js +8 -0
  4. package/dist/mobiage-base.min.js.map +1 -0
  5. package/package.json +1 -1
  6. package/src/modules/base/components/container/container.style.scss +1 -2
  7. package/src/modules/base/components/content-container/content-container.style.scss +6 -5
  8. package/src/modules/base/components/content-container/content-container.template.html +1 -0
  9. package/src/modules/base/components/content-container/content-container.ts +38 -0
  10. package/src/modules/base/index.js +1 -1
  11. package/src/modules/side-menu/components/hotbar/hotbar.html +10 -0
  12. package/src/modules/side-menu/components/hotbar/hotbar.scss +229 -0
  13. package/src/modules/side-menu/components/hotbar/hotbar.ts +299 -0
  14. package/src/modules/side-menu/components/hotbar/interface/angular-interface/angular.ts +54 -0
  15. package/src/modules/side-menu/components/hotbar/interface/config.ts +55 -0
  16. package/src/modules/side-menu/components/hotbar/interface/coordenates.ts +8 -0
  17. package/src/modules/side-menu/components/hotbar/interface/rect.ts +14 -0
  18. package/src/modules/side-menu/components/hotbar/utils/element-utils.ts +55 -0
  19. package/src/modules/side-menu/controllers/sideMenu.ts +37 -0
  20. package/src/modules/side-menu/index.js +6 -16
  21. package/src/modules/side-menu/services/sidemenu-service.ts +63 -0
  22. package/src/modules/side-menu/styles/side-menu.style.scss +9 -80
  23. package/src/modules/side-menu/templates/side-menu.template.html +29 -29
  24. package/src/modules/themes/themes.style.scss +4 -0
  25. package/src/modules/topbar/components/notifications/notifications.controller.js +5 -5
  26. package/src/modules/topbar/components/notifications/notifications.template.html +1 -3
  27. package/src/modules/topbar/controllers/topbar.controller.js +1 -1
  28. package/src/modules/topbar/styles/topbar.style.scss +18 -18
  29. package/src/modules/topbar/templates/topbar.template.html +8 -11
  30. package/src/modules/side-menu/components/btn/btn.controller.js +0 -13
  31. package/src/modules/side-menu/components/btn/btn.style.scss +0 -75
  32. package/src/modules/side-menu/components/btn/btn.template.html +0 -43
  33. package/src/modules/side-menu/components/btn/index.js +0 -26
  34. package/src/modules/side-menu/components/category/category.style.scss +0 -47
  35. package/src/modules/side-menu/components/category/category.template.html +0 -23
  36. package/src/modules/side-menu/components/category/index.js +0 -13
  37. package/src/modules/side-menu/components/item/index.js +0 -29
  38. package/src/modules/side-menu/components/item/item.template.html +0 -40
  39. package/src/modules/side-menu/components/link/index.js +0 -18
  40. package/src/modules/side-menu/components/link/link.controller.js +0 -48
  41. package/src/modules/side-menu/components/link/link.style.scss +0 -10
  42. package/src/modules/side-menu/components/link/link.template.html +0 -21
  43. package/src/modules/side-menu/components/quick-menu/index.js +0 -14
  44. package/src/modules/side-menu/components/quick-menu/quick-menu.controller.js +0 -67
  45. package/src/modules/side-menu/components/quick-menu/quick-menu.style.scss +0 -151
  46. package/src/modules/side-menu/components/quick-menu/quick-menu.template.html +0 -44
  47. package/src/modules/side-menu/components/sub-category/index.js +0 -20
  48. package/src/modules/side-menu/components/sub-category/sub-category.controller.js +0 -16
  49. package/src/modules/side-menu/components/sub-category/sub-category.style.scss +0 -50
  50. package/src/modules/side-menu/components/sub-category/sub-category.template.html +0 -47
  51. package/src/modules/side-menu/controllers/sideMenu.js +0 -71
  52. package/src/modules/side-menu/services/sideMenu.js +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgcloud-sgsistemas/base",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Base para os sistemas da mobiage",
5
5
  "repository": {
6
6
  "type": "private",
@@ -1,7 +1,6 @@
1
1
  .mb[base-container] {
2
2
  width: 100%;
3
3
  height: 100%;
4
- max-width: 1920px;
5
4
  text-align: left;
6
- display: inline-table;
5
+ display: inline-block;
7
6
  }
@@ -1,12 +1,17 @@
1
1
  @import "../../../themes/themes.style.scss";
2
2
 
3
3
  .mb[content-container] {
4
+ transition: width $transition;
4
5
  height: calc(100% - #{$topbarHeight});
5
- width: calc(100% - 224px);
6
+ width: calc(100% - #{$leftHotbarWidth} - 4px);
6
7
  display: inline-block;
7
8
  font-family: 'MontSerrat', sans-serif;
8
9
  padding: 5px;
9
10
 
11
+ &.with-menu-opened{
12
+ width: calc(100% - #{$leftHotbarWidthMax} - 4px);
13
+ }
14
+
10
15
  > .mb-cc-content {
11
16
  height: calc(100vh - calc(150px - #{$topbarHeight}));
12
17
  width: 100%;
@@ -29,8 +34,4 @@
29
34
  overflow-y: auto;
30
35
  }
31
36
  }
32
-
33
- @media screen and (max-width: 768px) {
34
- width: 100%;
35
- }
36
37
  }
@@ -1,5 +1,6 @@
1
1
  <div id="mb-cc"
2
2
  class="mb"
3
+ ng-class="{'with-menu-opened':vm.openedMenu}"
3
4
  content-container>
4
5
  <div ng-transclude
5
6
  class="mb-cc-content"
@@ -0,0 +1,38 @@
1
+ import template from './content-container.template.html';
2
+ import './content-container.style.scss';
3
+ import { $Element, $Scope, $Timeout } from '@sgcloud-sgsistemas/base/src/modules/side-menu/components/hotbar/interface/angular-interface/angular';
4
+ import { MbSidemenuService } from '@sgcloud-sgsistemas/base/src/modules/side-menu/services/sidemenu-service';
5
+
6
+
7
+ class ContentContainerController {
8
+ openedMenu: boolean = false
9
+
10
+ constructor(
11
+ public $scope: $Scope,
12
+ public $element: $Element,
13
+ public $timeout: $Timeout,
14
+ public mbSidemenuService: MbSidemenuService,
15
+ ) { }
16
+
17
+
18
+ $onDestroy(): void {
19
+
20
+ }
21
+
22
+ $onInit(): void {
23
+ this.mbSidemenuService.addCallback((value: boolean): void => {
24
+ this.openedMenu = value
25
+ })
26
+ }
27
+ }
28
+
29
+ const contentContainer = {
30
+ template,
31
+ controller: ContentContainerController,
32
+ transclude: true,
33
+ controllerAs: 'vm'
34
+ };
35
+
36
+ export {
37
+ contentContainer
38
+ }
@@ -13,9 +13,9 @@ import './styles/base.style.scss';
13
13
  import './styles/base.flex.scss';
14
14
 
15
15
  import container from './components/container';
16
- import contentContainer from './components/content-container';
17
16
 
18
17
  import themeProvider from './providers/theme.provider';
18
+ import { contentContainer } from './components/content-container/content-container';
19
19
 
20
20
  const component = {
21
21
  bindings: {
@@ -0,0 +1,10 @@
1
+ <div class="sg" hotbar
2
+ ng-class="{
3
+ 'opened':vm.open,
4
+ 'force-hide':vm.forceHide,
5
+ 're-open':vm.reopen,
6
+ 'hover':vm.openedIndexSub == undefined,
7
+ }">
8
+ <modules ng-transclude="module" ng-if="!vm.ngifHide">
9
+ </modules>
10
+ </div>
@@ -0,0 +1,229 @@
1
+ @import "../../../themes/themes.style.scss";
2
+
3
+
4
+ $borderRadius: 10px;
5
+ $transitionAll: all $transition;
6
+ $subModulePadding: 10px;
7
+
8
+ @mixin block() {
9
+ background: var(--primary);
10
+ border-bottom-right-radius: $borderRadius;
11
+ border-top-right-radius: $borderRadius;
12
+ box-shadow: 0px 10px 20px 0px rgba(0, 0, 0, 0.3);
13
+ }
14
+
15
+ @mixin delayOnBack($fields, $return: false, $ignoredFields:null, $duration:(300ms), $timeFunction: ease-in-out) {
16
+ transition-property: $fields, $ignoredFields;
17
+
18
+ $timeList1: ();
19
+ $timeList2: ();
20
+
21
+ @each $item in $fields {
22
+ $timeList1: append($timeList1, 0s, comma)
23
+ }
24
+
25
+ @each $item in $fields {
26
+ $timeList2: append($timeList2, nth($duration, 1), comma)
27
+ }
28
+
29
+ @if $return {
30
+ transition-duration: $timeList1, $duration;
31
+ transition-delay: $timeList2, 0s;
32
+ transition-timing-function: $timeFunction;
33
+ }
34
+ @else {
35
+ transition-duration: $timeList2, $duration;
36
+ transition-delay: 0s;
37
+ transition-timing-function: $timeFunction;
38
+ }
39
+ }
40
+
41
+ @mixin transition($fields, $duration:(300ms), $timeFunction: ease-in-out, $delay:(0s)) {
42
+ transition-property: $fields;
43
+ transition-duration: $duration;
44
+ transition-delay: $delay;
45
+ transition-timing-function: $timeFunction;
46
+ }
47
+
48
+ hotbar {
49
+ @include transition(min-width);
50
+ z-index: 100;
51
+ position: relative;
52
+ min-width: 100%;
53
+ width: max-content;
54
+ height: 100%;
55
+ display: block;
56
+ @include block();
57
+ color: var(--color2);
58
+
59
+ @mixin onDisplay() {
60
+ >modules {
61
+ >module {
62
+ >div {
63
+ @include delayOnBack(gap, false, (grid-template-columns, color), (300ms, 200ms));
64
+ grid-template-columns: max-content 1fr;
65
+ gap: 6px;
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ .sg[hotbar] {
72
+ height: 100%;
73
+ @include block();
74
+
75
+ >modules {
76
+ position: relative;
77
+ display: grid;
78
+ gap: 10px;
79
+
80
+ >module {
81
+ display: flex;
82
+ flex-direction: column;
83
+
84
+ >div {
85
+ @include delayOnBack(gap, true, (grid-template-columns, color), (300ms, 200ms));
86
+ grid-template-columns: max-content 0fr;
87
+ display: grid;
88
+ text-wrap: nowrap;
89
+ margin: 0px 6px;
90
+ padding: 6px;
91
+ gap: 0px;
92
+
93
+ i {
94
+ text-align: center;
95
+ font-size: 20px;
96
+ width: 1.3em;
97
+ }
98
+
99
+ label {
100
+ padding-left: 0px;
101
+ font-size: 16px;
102
+ overflow: hidden;
103
+ text-wrap: nowrap;
104
+
105
+ @include delayOnBack(text-wrap, true)
106
+ }
107
+ }
108
+
109
+ >sub-module {
110
+ left: 0px;
111
+ grid-template-columns: 0fr;
112
+ display: grid;
113
+ gap: 15px;
114
+ padding: 14px 10px;
115
+ width: max-content;
116
+ text-wrap: nowrap;
117
+ @include block();
118
+ @include transition((grid-template-columns, left));
119
+ position: absolute;
120
+ z-index: -1;
121
+ overflow-y: scroll;
122
+ transform: translateY(-40%);
123
+
124
+ >* {
125
+ overflow: hidden;
126
+ @include transition(color, 200ms);
127
+
128
+ &:hover {
129
+ color: var(--contrast);
130
+ }
131
+ }
132
+
133
+ &::-webkit-scrollbar-track {
134
+ margin: 10px;
135
+ }
136
+ }
137
+
138
+ &:not(:first-child) {
139
+ &:hover {
140
+ >div {
141
+ color: var(--contrast);
142
+ }
143
+ }
144
+ }
145
+
146
+ &:first-child {
147
+ margin-top: 12px;
148
+
149
+ >div {
150
+ background: var(--contrast);
151
+ border-radius: $borderRadius;
152
+ }
153
+
154
+ >sub-module {
155
+ display: none;
156
+ }
157
+ }
158
+
159
+ &:last-child {
160
+ margin-bottom: 12px;
161
+ }
162
+
163
+ &.force-open-sub {
164
+ >div{
165
+ color: var(--contrast);
166
+ }
167
+ >sub-module {
168
+ left: 100%;
169
+ grid-template-columns: 1fr;
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ &:hover {
176
+ @include onDisplay();
177
+
178
+ &.hover {
179
+ >modules {
180
+ >module {
181
+ &:hover {
182
+ >sub-module {
183
+ left: 100%;
184
+ grid-template-columns: 1fr;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ &:not(.hover) {
193
+ @include onDisplay();
194
+ }
195
+
196
+ &.opened {
197
+ @include onDisplay();
198
+
199
+ >modules {
200
+ max-width: $leftHotbarWidthMax;
201
+
202
+ >module {
203
+ >div {
204
+ label {
205
+ text-wrap: balance;
206
+ @include delayOnBack(text-wrap, false)
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+ &.force-hide {
214
+ >modules {
215
+ >module {
216
+ >div {
217
+ @include delayOnBack(gap, true, (grid-template-columns, color), (300ms, 200ms));
218
+ grid-template-columns: max-content 0fr;
219
+ gap: 6px;
220
+ }
221
+ }
222
+ }
223
+ }
224
+
225
+ &.re-open {
226
+ @include onDisplay();
227
+ }
228
+ }
229
+ }
@@ -0,0 +1,299 @@
1
+ import $ from 'jquery';
2
+ import { MbSidemenuService } from './../../services/sidemenu-service';
3
+ import template from './hotbar.html';
4
+ import './hotbar.scss';
5
+ import { $Interval, $Scope, $Timeout, GenericFunction } from './interface/angular-interface/angular';
6
+ import { Config, SubModule } from './interface/config';
7
+
8
+ class HotbarController {
9
+ private watchHTML: Function
10
+ private sgElement: JQuery
11
+ private subModules: JQuery
12
+ private modules: JQuery
13
+ private config: Config
14
+ private currentIndexSelection: number = 0
15
+
16
+ public open: boolean
17
+ public reopen: boolean
18
+ public forceHide: boolean
19
+ public ngifHide: boolean
20
+ public openedIndexSub?: number = undefined
21
+
22
+ constructor(
23
+ public $element: JQuery,
24
+ public $scope: $Scope,
25
+ public $interval: $Interval,
26
+ public hotkeys: any,
27
+ public $state: any,
28
+ public $timeout: $Timeout,
29
+ public mbSidemenuService: MbSidemenuService,
30
+ public MbgNotification: any,
31
+
32
+ ) { }
33
+
34
+ $onDestroy(): void {
35
+ this.__unWatch(this.watchHTML)
36
+ window.removeEventListener('resize', this.__onResize)
37
+ document.removeEventListener('click', this.__onClick)
38
+ }
39
+
40
+ $onInit(): void {
41
+ this.sgElement = this.$element.find('.sg')
42
+ this.$scope.$on('$destroy', (): void => this.$onDestroy())
43
+ this.mbSidemenuService.sideMenu = this.sgElement
44
+ this.__initWatchers()
45
+ }
46
+
47
+ private __unWatch(watcher?: Function): void {
48
+ if (watcher) watcher()
49
+ }
50
+
51
+ private __initWatchers(): void {
52
+ this.$scope.$watch((): string => this.$element.html(),
53
+ (newHTML: string, oldHTML: string): void => {
54
+ if ((newHTML) != (oldHTML) && !oldHTML.includes('sub-module')) {
55
+ this.__updateHotbar()
56
+ }
57
+ }
58
+ )
59
+ window.addEventListener('resize', this.__onResize)
60
+ document.addEventListener('click', this.__onClick)
61
+ }
62
+
63
+ private __onClick: (ev: MouseEvent)=> void = (ev: MouseEvent): void => {
64
+ if (this.sgElement.find(ev.target).length == 0 && this.openedIndexSub != undefined) {
65
+ $(this.modules[this.openedIndexSub]).removeClass('force-open-sub')
66
+ this.openedIndexSub = undefined
67
+ }
68
+ }
69
+
70
+ private __onResize: ()=> void = (): void => {
71
+ if (this.sgElement.children().length > 0) {
72
+ this.sgElement.children().css('top', '')
73
+ }
74
+ this.__updateSubModulePosition()
75
+ }
76
+
77
+ private __updateSubModulePosition(): void {
78
+ if (this.subModules) {
79
+ this.subModules.each((index: number, subModuleElement: Element): void => {
80
+ let subModule: JQuery = $(subModuleElement)
81
+
82
+ const borderRadius = 10
83
+ const hotbarHeight: number = this.sgElement.height() - (borderRadius * 4)
84
+
85
+ let cssObj: any = {
86
+ 'max-height': `${hotbarHeight}px`,
87
+ 'transform': '',
88
+ 'top': '',
89
+ 'bottom': '',
90
+ }
91
+
92
+ const rectSG: DOMRect = this.sgElement[0].getBoundingClientRect()
93
+ const rectModule: DOMRect = subModule.parent()[0].getBoundingClientRect()
94
+ const rectSubModule: DOMRect = subModule[0].getBoundingClientRect()
95
+ const scrollTopPosition: number = parseFloat(this.sgElement.children().css('top')) || 0
96
+
97
+ const middle: number = ((rectModule.height / 2) + rectModule.top)
98
+ const hasPassedFromTheTop: boolean = middle - (rectSubModule.height / 2) < rectSG.top
99
+ const hasPassedFromTheBottom: boolean = middle + (rectSubModule.height / 2) > rectSG.top + rectSG.height
100
+
101
+ if (hasPassedFromTheBottom) {
102
+ const bottomScrollPosition: number =
103
+ Math.abs(this.sgElement.height() - this.sgElement.children().height()) + scrollTopPosition
104
+ cssObj['transform'] = 'none'
105
+ cssObj['bottom'] = `${bottomScrollPosition + borderRadius}px`
106
+ cssObj['top'] = ''
107
+ }
108
+ else if (hasPassedFromTheTop) {
109
+ cssObj['transform'] = 'none'
110
+ cssObj['top'] = `${scrollTopPosition * -1 + borderRadius}px`
111
+ cssObj['bottom'] = ''
112
+ }
113
+ subModule.css(cssObj)
114
+ })
115
+ }
116
+ }
117
+
118
+ private __onHotBarScroll(): void {
119
+ const $modulesElement: JQuery = this.sgElement.children()
120
+ this.__buildOnIfDoesntExists('wheel', $modulesElement[0], (): void => {
121
+ $modulesElement.on('wheel', (event: JQueryEventObject): void => {
122
+ const scrollInSubModule: boolean =
123
+ this.subModules.index(event.target) != -1 ||
124
+ this.subModules.find(event.target).length > 0
125
+
126
+ if (!scrollInSubModule && !event.altKey && !event.ctrlKey && !event.shiftKey) {
127
+ const originalEvent: WheelEvent = event.originalEvent as WheelEvent
128
+
129
+ const scrollDetails = {
130
+ scrollDirection: originalEvent.deltaY > 0 ? 'down' : 'up',
131
+ top: Number($modulesElement.position().top.toFixed(1)),
132
+ bottom: this.sgElement.height() - ($modulesElement.position().top + $modulesElement.height()),
133
+ difference: Math.abs(this.sgElement.height() - $modulesElement.height()) * -1
134
+ }
135
+
136
+ const scrollAmount: number = Math.abs(originalEvent.deltaY)
137
+ let newScrollPosition: string = `${scrollDetails.top}px`
138
+ if (scrollDetails.scrollDirection == 'down') {
139
+ if (scrollDetails.bottom < 0) {
140
+ newScrollPosition = `${Math.max(scrollDetails.top - scrollAmount, scrollDetails.difference).toFixed(1)}px`
141
+ if(parseFloat(newScrollPosition) != scrollDetails.top){
142
+ event.preventDefault()
143
+ }
144
+ }
145
+ } else {
146
+ if (scrollDetails.top < 0) {
147
+ newScrollPosition = `${Math.min(scrollDetails.top + scrollAmount, 0).toFixed(1)}px`
148
+ event.preventDefault()
149
+ }
150
+ }
151
+ $modulesElement.css('top', newScrollPosition)
152
+ }
153
+ this.__updateSubModulePosition()
154
+ })
155
+ })
156
+ }
157
+
158
+ private __updateHotbar(): void {
159
+ this.modules = this.$element.find('module')
160
+ this.subModules = this.$element.find('sub-module')
161
+ this.__onHotBarScroll()
162
+ this.__onResize()
163
+
164
+ this.modules.each((index: number, value: Element): void => {
165
+ this.__buildOnIfDoesntExists('click', value, (): void => {
166
+ let $module: JQuery = $(value)
167
+ $module.on('click', (evt: JQueryEventObject): void => {
168
+ if ($(this.subModules[index]).find(evt.target).length == 0) {
169
+ this.__onClickModule(index, $module)
170
+ }
171
+ })
172
+ })
173
+ })
174
+
175
+ this.subModules.each((index: number, subModuleElement: Element): void => {
176
+ const subModule: JQuery = $(subModuleElement)
177
+ subModule.children().each((index2: number, optionElement: Element): void => {
178
+ this.__buildOnIfDoesntExists('click', optionElement, (): void => {
179
+ let option: JQuery = $(optionElement)
180
+ option.on('click', (): void => {
181
+ this.__onClickSubModule(index - 1, index2)
182
+ })
183
+ })
184
+ })
185
+ })
186
+ }
187
+
188
+ private __buildOnIfDoesntExists(on: string, inElement: Element, callback: GenericFunction): void {
189
+ const events: any = inElement ? $._data(inElement, 'events') : null
190
+ if (!events || !events[on] || events[on].length == 0) callback()
191
+ }
192
+
193
+ private __onClickModule(index: number, element: Element): void {
194
+ if (index > 0) {
195
+ if (this.openedIndexSub) $(this.modules[this.openedIndexSub]).removeClass('force-open-sub')
196
+ $(element).addClass('force-open-sub')
197
+ this.openedIndexSub = index
198
+ } else {
199
+ const quickMenuSize: number = this.config.quickMenu!.links.length
200
+ const correctIndex: number = this.currentIndexSelection == quickMenuSize ? 0 : this.currentIndexSelection
201
+ this.__onClickSubModule(-1, correctIndex)
202
+ if (quickMenuSize == this.currentIndexSelection) {
203
+ this.currentIndexSelection = 0
204
+ } else {
205
+ this.currentIndexSelection++
206
+ }
207
+ }
208
+ }
209
+
210
+ private __onClickSubModule(index: number, index2: number): void {
211
+ if(this.openedIndexSub){
212
+ $(this.modules[this.openedIndexSub]).removeClass('force-open-sub')
213
+ this.openedIndexSub = undefined
214
+ }
215
+ const subModuleConfig: SubModule = index > -1 ? this.config.structure![index].children[index2] : this.config.quickMenu!.links[index2]
216
+ if (index == -1) {
217
+ const menuState: boolean = this.open
218
+ this.forceHide = true
219
+ this.open = false
220
+ this.$timeout((): void => {
221
+ this.ngifHide = true
222
+ this.__onSubModuleSelected(subModuleConfig)
223
+ this.$timeout((): void => {
224
+ this.ngifHide = false
225
+ this.$timeout((): void => {
226
+ this.forceHide = false
227
+ this.open = menuState
228
+ this.reopen = !menuState
229
+ if (this.reopen) {
230
+ this.$timeout((): void => {
231
+ this.reopen = false
232
+ }, 300)
233
+ }
234
+ })
235
+ })
236
+ }, 300)
237
+ } else {
238
+ this.__onSubModuleSelected(subModuleConfig)
239
+ }
240
+ }
241
+
242
+ private async __onSubModuleSelected(subModuleConfig: SubModule): Promise<void> {
243
+ let access: boolean = true
244
+ if (subModuleConfig && !!subModuleConfig.key && (this.config.keys || []).indexOf(subModuleConfig.key) === -1) {
245
+ if (this.config.authAccess) {
246
+ access = await this.config.authAccess(subModuleConfig)
247
+ }
248
+ }
249
+ if (access) {
250
+ switch (subModuleConfig.actionType) {
251
+ case 'state':
252
+ if (typeof subModuleConfig.action == 'string') {
253
+ const regexParams: RegExpExecArray | null = new RegExp(/\((.*?)\)/gm).exec(subModuleConfig.action as string)
254
+ const state: any = subModuleConfig.action.replace(new RegExp(/\((.*?)\)/, 'gm'), '')
255
+ const params: any = (regexParams || []).length > 0 ? JSON.parse(regexParams![1].replace(new RegExp(/'/, 'gm'), `"`)) : {}
256
+ this.$state.go(state, params)
257
+ }
258
+ break
259
+ case 'link':
260
+ if (typeof subModuleConfig.action == 'string') {
261
+ location.href = subModuleConfig.action
262
+ }
263
+ break
264
+ case 'function':
265
+ if (typeof subModuleConfig.action != 'string') {
266
+ subModuleConfig.action!()
267
+ }
268
+ break
269
+ }
270
+ } else {
271
+ this.$timeout((): void => {
272
+ this.MbgNotification.openNotification({
273
+ type: 'error',
274
+ variation: 'toast',
275
+ duration: 3000,
276
+ text: 'Acesso negado'
277
+ })
278
+ })
279
+ }
280
+ }
281
+ }
282
+
283
+ const hotbar = {
284
+ bindings: {
285
+ 'config': '<',
286
+ 'open': '=',
287
+ },
288
+ template,
289
+ controller: HotbarController,
290
+ transclude: {
291
+ 'module': '?module',
292
+ },
293
+ controllerAs: 'vm'
294
+ };
295
+
296
+ export {
297
+ hotbar
298
+ };
299
+
@@ -0,0 +1,54 @@
1
+ export {
2
+ $Interval,
3
+ $Scope,
4
+ $Timeout,
5
+ GenericFunction,
6
+ FunctionCallbackWithMs,
7
+ Fn,
8
+ Offset,
9
+ Position
10
+ };
11
+
12
+ type GenericFunction<Return = void> = () => Return
13
+ type FunctionCallbackWithMs = (callback: GenericFunction, ms?: number) => unknown
14
+ type $Timeout = FunctionCallbackWithMs
15
+ type Fn = (eventObject: any) => any
16
+
17
+ type $Interval = $IntervalObj & FunctionCallbackWithMs
18
+ interface $IntervalObj {
19
+ cancel(interval: unknown): void
20
+ }
21
+
22
+ interface Position {
23
+ top: number,
24
+ left: number
25
+ }
26
+
27
+ interface Offset {
28
+ top: number
29
+ left: number,
30
+ }
31
+
32
+ interface $Scope {
33
+ $new(isolate?: boolean, parent?: $Scope): $Scope;
34
+ $watch(watchExpression: string | Function, listener: (newValue: any, oldValue: any, scope: $Scope) => void, objectEquality?: boolean): () => void;
35
+ $watchGroup(watchExpressions: (string | Function)[], listener: (newValues: any[], oldValues: any[], scope: $Scope) => void): () => void;
36
+ $watchCollection(obj: object | Array<any>, listener: (newValue: any, oldValue: any, scope: $Scope) => void): () => void;
37
+ $digest(): void;
38
+ $suspend(): void;
39
+ $isSuspended(): boolean;
40
+ $resume(): void;
41
+ $destroy(): void;
42
+ $eval(expression?: string | Function, locals?: object): any;
43
+ $evalAsync(expression?: string | Function, locals?: object): void;
44
+ $apply(exp?: string | Function): void;
45
+ $applyAsync(exp?: string | Function): void;
46
+ $on(name: string, listener: (event: any, ...args: any[]) => void): () => void;
47
+ $emit(name: string, args?: any): void;
48
+ $broadcast(name: string, args?: any): void;
49
+ $id
50
+ $parent
51
+ $root
52
+
53
+ [property: string]: any;
54
+ }