@sgcloud-sgsistemas/base 1.0.32 → 1.0.34

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgcloud-sgsistemas/base",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Base para os sistemas da mobiage",
5
5
  "repository": {
6
6
  "type": "private",
@@ -22,6 +22,7 @@
22
22
  <label>{{module.label}}</label>
23
23
  </div>
24
24
  </module>
25
+
25
26
  <module ng-repeat="module in vm.config.structure"
26
27
  ng-if="module.label && module.children"
27
28
  ng-hide="vm.forceHide"
@@ -29,15 +30,49 @@
29
30
  ng-click="vm.onClickModule($index)"
30
31
  id="sg-hotbar-module-{{$index}}">
31
32
  <div>
32
- <i ng-if="module.icon && module.icon != ''"
33
- class="{{module.icon}}">
33
+ <i ng-if="module.icon && module.icon != ''"
34
+ class="{{module.icon}}">
34
35
  </i>
35
36
  <label>{{module.label}}</label>
36
37
  </div>
38
+
39
+ <sub-module id="sg-hotbar-sub-modules-{{$index}}"
40
+ class="favorite-module"
41
+ ng-if="$first && !!module.children && !module.children.length">
42
+ <div>
43
+ <label ng-click="vm.goToFavoritesConfig()">
44
+ Não há favoritos configurados
45
+ </label>
46
+ </div>
47
+ </sub-module>
48
+
49
+ <sub-module id="sg-hotbar-sub-modules-{{$index}}"
50
+ class="favorite-module"
51
+ ng-style="::vm.getSubModuleStyle($index)"
52
+ ng-if="$first && !!module.children && module.children.length"
53
+ ng-class="{'has-forced-hover': vm.openedFavoriteGroupIndex !== undefined }">
54
+ <div ng-repeat="favoriteGroup in module.children"
55
+ ng-if="!favoriteGroup.hide && favoriteGroup.children"
56
+ ng-class="{'force-open-favorite-group': vm.openedFavoriteGroupIndex == $index}"
57
+ ng-click="vm.onFavoriteGroupSelected($index)">
58
+ <label>{{favoriteGroup.label}}</label>
59
+
60
+ <div id="sg-hotbar-favorite-submodules-{{$index}}"
61
+ class="favorite-submodule"
62
+ ng-style="::vm.getFavoriteSubmodulesStyle($index)">
63
+ <div ng-repeat="favoriteSubmodule in favoriteGroup.children"
64
+ ng-click="vm.onSubModuleSelected(favoriteSubmodule, false, $event)">
65
+ <label>{{favoriteSubmodule.label}}</label>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </sub-module>
70
+
37
71
  <sub-module ng-style="::vm.getSubModuleStyle($index)"
38
- id="sg-hotbar-sub-modules-{{$index}}">
39
- <div ng-if="!subModule.hide"
40
- ng-repeat="subModule in module.children"
72
+ id="sg-hotbar-sub-modules-{{$index}}"
73
+ ng-if="!$first">
74
+ <div ng-repeat="subModule in module.children"
75
+ ng-if="!subModule.hide"
41
76
  ng-click="vm.onSubModuleSelected(subModule, false, $event)">
42
77
  <i class="{{subModule.icon}}"></i>
43
78
  <label>{{subModule.label}}</label>
@@ -138,13 +138,41 @@ hotbar {
138
138
  @include transition((grid-template-columns, left));
139
139
  position: absolute;
140
140
  z-index: -1;
141
- overflow-y: scroll;
142
141
 
143
- >* {
142
+ &:not(.favorite-module) {
143
+ overflow-y: scroll;
144
+ }
145
+
146
+ &.favorite-module {
147
+ box-shadow: none;
148
+ padding: 0;
149
+ gap: 0;
150
+
151
+ > div {
152
+ box-shadow: 4px 8px 10px -2px #00000066;
153
+ padding: 7.5px 10px;
154
+ background-color: var(--primary);
155
+
156
+ &:first-child {
157
+ padding-top: 14px;
158
+ border-top-right-radius: $borderRadius;
159
+ }
160
+
161
+ &:last-child {
162
+ padding-bottom: 14px;
163
+ border-bottom-right-radius: $borderRadius;
164
+ }
165
+ }
166
+ }
167
+
168
+ > div {
144
169
  overflow: hidden;
145
- @include transition(color, 200ms);
146
170
 
147
- &:hover {
171
+ label {
172
+ @include transition(color, 200ms);
173
+ }
174
+
175
+ &:hover > label {
148
176
  color: var(--contrast);
149
177
  }
150
178
  }
@@ -152,6 +180,44 @@ hotbar {
152
180
  &::-webkit-scrollbar-track {
153
181
  margin: 10px;
154
182
  }
183
+
184
+ div.favorite-submodule {
185
+ @include block();
186
+ @include transition(left, 300ms, (cubic-bezier(1, 0.35, 0, 1)));
187
+
188
+ padding: 14px 10px;
189
+ overflow: hidden;
190
+ white-space: nowrap;
191
+ left: -100vw;
192
+ position: absolute;
193
+ min-height: 50px;
194
+ min-width: 150px;
195
+ width: max-content;
196
+ display: flex;
197
+ flex-direction: column;
198
+ gap: 15px;
199
+ border-radius: $borderRadius;
200
+ pointer-events: none;
201
+ z-index: -2;
202
+ }
203
+
204
+ div.force-open-favorite-group div.favorite-submodule,
205
+ &:not(.has-forced-hover) > div:hover div.favorite-submodule {
206
+ @include transition(left, 300ms, (cubic-bezier(0, 1, 0.5, 1)), 100ms);
207
+
208
+ left: 100%;
209
+ pointer-events: all;
210
+
211
+ & > div:hover > label {
212
+ color: var(--contrast);
213
+ }
214
+ }
215
+
216
+ div.force-open-favorite-group {
217
+ > label {
218
+ color: var(--contrast);
219
+ }
220
+ }
155
221
  }
156
222
 
157
223
  &:not([main]) {
@@ -159,6 +225,11 @@ hotbar {
159
225
  >div {
160
226
  color: var(--contrast);
161
227
  }
228
+
229
+ > .favorite-module {
230
+ min-width: 150px;
231
+ min-height: 50px;
232
+ }
162
233
  }
163
234
  }
164
235
 
@@ -190,6 +261,12 @@ hotbar {
190
261
  >div{
191
262
  color: var(--contrast);
192
263
  }
264
+
265
+ > .favorite-module {
266
+ min-width: 150px;
267
+ min-height: 50px;
268
+ }
269
+
193
270
  >sub-module {
194
271
  left: 100%;
195
272
  grid-template-columns: 1fr;
@@ -17,6 +17,7 @@ class HotbarController {
17
17
  public forceHide: boolean
18
18
  public ngifHide: boolean
19
19
  public openedIndexSub?: number = undefined
20
+ public openedFavoriteGroupIndex?: number = undefined
20
21
 
21
22
  constructor(
22
23
  public $element: JQuery,
@@ -64,6 +65,8 @@ class HotbarController {
64
65
  private __onClick: (ev: MouseEvent)=> void = (ev: MouseEvent): void => {
65
66
  if (this.sgElement.find(ev.target).length == 0 && this.openedIndexSub != undefined) {
66
67
  this.openedIndexSub = undefined
68
+ this.openedFavoriteGroupIndex = undefined
69
+
67
70
  try{
68
71
  this.$scope.$digest()
69
72
  }catch{}
@@ -87,11 +90,20 @@ class HotbarController {
87
90
  }
88
91
  }
89
92
 
90
- public getSubModuleStyle($index: number): CssInterface {
91
- const subModule = $(this.$element.find(`#sg-hotbar-sub-modules-${$index}`)[0])
93
+ public getSubModuleStyle($moduleIndex: number): CssInterface {
94
+ const id: string = `#sg-hotbar-sub-modules-${$moduleIndex}`;
95
+ const subModule = $(this.$element.find(id)[0]) as HTMLElement;
96
+
92
97
  return this.getSubModuleStyleFromElement(subModule);
93
98
  }
94
99
 
100
+ public getFavoriteSubmodulesStyle(subModuleIndex: number): CssInterface {
101
+ const id: string = `#sg-hotbar-favorite-submodules-${subModuleIndex}`;
102
+ const submodules = $(this.$element.find(id)[0]) as HTMLElement;
103
+
104
+ return this.getSubModuleStyleFromElement(submodules);
105
+ }
106
+
95
107
  private getSubModuleStyleFromElement(subModule: any): CssInterface {
96
108
  const borderRadius = 10;
97
109
  const hotbarHeight: number = this.sgElement.height() - (borderRadius * 4);
@@ -99,6 +111,7 @@ class HotbarController {
99
111
  let cssObj: any = {
100
112
  'max-height': `${hotbarHeight}px`,
101
113
  'transform': 'translateY(-40%)',
114
+ 'top': '',
102
115
  };
103
116
 
104
117
  const rectSG: DOMRect = this.sgElement[0].getBoundingClientRect();
@@ -121,6 +134,7 @@ class HotbarController {
121
134
  cssObj.top = `${scrollTopPosition * -1 + borderRadius}px`;
122
135
  cssObj.bottom = '';
123
136
  }
137
+
124
138
  return cssObj;
125
139
  }
126
140
 
@@ -182,7 +196,12 @@ class HotbarController {
182
196
  }
183
197
 
184
198
  public onClickModule(index: number): void {
199
+ if (this.openedIndexSub !== index) {
200
+ this.openedFavoriteGroupIndex = undefined
201
+ }
202
+
185
203
  this.openedIndexSub = index
204
+
186
205
  try{
187
206
  this.$scope.$digest()
188
207
  }catch{}
@@ -217,6 +236,8 @@ class HotbarController {
217
236
  event.stopPropagation()
218
237
  event.preventDefault()
219
238
  this.openedIndexSub = undefined
239
+ this.openedFavoriteGroupIndex = undefined
240
+
220
241
  let access: boolean = true
221
242
  document.body.focus()
222
243
  if (subModuleConfig && !!subModuleConfig.key && (this.config.keys || []).indexOf(subModuleConfig.key) === -1) {
@@ -225,7 +246,6 @@ class HotbarController {
225
246
  }
226
247
  }
227
248
  if (access) {
228
- this.openedIndexSub = undefined
229
249
  switch (subModuleConfig.actionType) {
230
250
  case 'state':
231
251
  if (typeof subModuleConfig.action == 'string') {
@@ -260,6 +280,19 @@ class HotbarController {
260
280
  this.reloadComponent()
261
281
  }
262
282
  }
283
+
284
+ public goToFavoritesConfig(): void {
285
+ this.$state.go('app.favorites-config')
286
+ }
287
+
288
+ public onFavoriteGroupSelected(index: number): void {
289
+ if (this.openedFavoriteGroupIndex === index) {
290
+ this.openedFavoriteGroupIndex = undefined
291
+ return
292
+ }
293
+
294
+ this.openedFavoriteGroupIndex = index
295
+ }
263
296
  }
264
297
 
265
298
  const hotbar = {
@@ -1,3 +1,4 @@
1
+ import { Config } from "../components/hotbar/interface/config";
1
2
  import { $Scope, $Timeout } from "./../components/hotbar/interface/angular-interface/angular";
2
3
  import { MbSidemenuService } from "./../services/sidemenu-service";
3
4
 
@@ -8,16 +9,19 @@ class SideMenuController {
8
9
  constructor(
9
10
  public $timeout: $Timeout,
10
11
  public $scope: $Scope,
12
+ public $rootScope: $Scope,
11
13
  public mbSidemenuService: MbSidemenuService,
12
14
  ) { }
13
15
 
14
16
  $onInit(): void {
15
17
  this.$scope.$on('$destroy', (): void => this.$onDestroy())
16
- this.watchConfig = this.$scope.$watch('vm.config', (config: any): void => {
18
+
19
+ this.watchConfig = this.$scope.$watch('vm.config', (config: Config): void => {
17
20
  this.mbSidemenuService.setMenuConfig(config);
18
21
  this.$scope.structure = config ? config.structure : null;
19
22
  this.$scope.quickMenu = config ? config.quickMenu : null;
20
23
  })
24
+
21
25
  this.mbSidemenuService.addCallback((value: boolean): any => {
22
26
  this.menuOpen = value
23
27
  })