@sgcloud-sgsistemas/base 1.0.15 → 1.0.17

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