@sgcloud-sgsistemas/base 1.0.16 → 1.0.18

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.16",
3
+ "version": "1.0.18",
4
4
  "description": "Base para os sistemas da mobiage",
5
5
  "repository": {
6
6
  "type": "private",
@@ -1,6 +1,6 @@
1
1
  <div class="sg" hotbar
2
2
  ng-class="{
3
- 'opened':vm.open,
3
+ 'opened':vm.open || vm.openedIndexSub,
4
4
  'force-hide':vm.forceHide,
5
5
  're-open':vm.reopen,
6
6
  'hover':vm.openedIndexSub == undefined,
@@ -46,23 +46,31 @@ $subModulePadding: 10px;
46
46
  }
47
47
 
48
48
  hotbar {
49
- @include transition(min-width);
49
+ @include delayOnBack(width);
50
50
  z-index: 100;
51
51
  position: relative;
52
52
  min-width: 100%;
53
- width: max-content;
53
+ width: 0px;
54
54
  height: 100%;
55
55
  display: block;
56
56
  @include block();
57
57
  color: var(--color2);
58
58
 
59
+ &:has(:hover,.opened) {
60
+ @include delayOnBack(width);
61
+ width: 200px;
62
+ }
63
+
59
64
  @mixin onDisplay() {
60
65
  >modules {
61
66
  >module {
62
67
  >div {
63
- @include delayOnBack(gap, false, (grid-template-columns, color), (300ms, 200ms));
68
+ @include delayOnBack(opacity, false, (grid-template-columns, color), (300ms, 200ms));
64
69
  grid-template-columns: max-content 1fr;
65
- gap: 6px;
70
+ label {
71
+ font-size: 16px;
72
+ white-space: break-spaces;
73
+ }
66
74
  }
67
75
  }
68
76
  }
@@ -76,19 +84,17 @@ hotbar {
76
84
  position: relative;
77
85
  display: grid;
78
86
  gap: 10px;
87
+ max-width: $leftHotbarWidthMax;
79
88
 
80
89
  >module {
81
90
  display: flex;
82
91
  flex-direction: column;
83
-
84
92
  >div {
85
- @include delayOnBack(gap, true, (grid-template-columns, color), (300ms, 200ms));
86
93
  grid-template-columns: max-content 0fr;
87
94
  display: grid;
88
- text-wrap: nowrap;
95
+ white-space: nowrap;
89
96
  margin: 0px 6px;
90
97
  padding: 6px;
91
- gap: 0px;
92
98
 
93
99
  i {
94
100
  text-align: center;
@@ -98,11 +104,10 @@ hotbar {
98
104
 
99
105
  label {
100
106
  padding-left: 0px;
101
- font-size: 16px;
102
107
  overflow: hidden;
103
- text-wrap: nowrap;
108
+ white-space: nowrap;
104
109
 
105
- @include delayOnBack(text-wrap, true)
110
+ @include delayOnBack(white-space, true);
106
111
  }
107
112
  }
108
113
 
@@ -113,7 +118,7 @@ hotbar {
113
118
  gap: 15px;
114
119
  padding: 14px 10px;
115
120
  width: max-content;
116
- text-wrap: nowrap;
121
+ white-space: nowrap;
117
122
  @include block();
118
123
  @include transition((grid-template-columns, left));
119
124
  position: absolute;
@@ -135,7 +140,7 @@ hotbar {
135
140
  }
136
141
  }
137
142
 
138
- &:not(:first-child) {
143
+ &:not([main]) {
139
144
  &:hover {
140
145
  >div {
141
146
  color: var(--contrast);
@@ -143,8 +148,7 @@ hotbar {
143
148
  }
144
149
  }
145
150
 
146
- &:first-child {
147
- margin-top: 12px;
151
+ &[main] {
148
152
 
149
153
  >div {
150
154
  background: var(--contrast);
@@ -154,6 +158,13 @@ hotbar {
154
158
  >sub-module {
155
159
  display: none;
156
160
  }
161
+ &:first-child{
162
+ margin-top: 12px;
163
+ >div{
164
+ background: var(--contrast);
165
+ border-radius: $borderRadius;
166
+ }
167
+ }
157
168
  }
158
169
 
159
170
  &:last-child {
@@ -161,6 +172,7 @@ hotbar {
161
172
  }
162
173
 
163
174
  &.force-open-sub {
175
+ min-width: 200px;
164
176
  >div{
165
177
  color: var(--contrast);
166
178
  }
@@ -172,7 +184,7 @@ hotbar {
172
184
  }
173
185
  }
174
186
 
175
- &:hover {
187
+ &:not(.force-hide):hover {
176
188
  @include onDisplay();
177
189
 
178
190
  &.hover {
@@ -202,23 +214,22 @@ hotbar {
202
214
  >module {
203
215
  >div {
204
216
  label {
205
- text-wrap: balance;
206
- @include delayOnBack(text-wrap, false)
217
+ white-space: balance;
218
+ @include delayOnBack(white-space, false)
207
219
  }
208
220
  }
209
221
  }
210
222
  }
211
223
  }
212
224
 
225
+ >modules>module>div {
226
+ transition: opacity 0.3s linear;
227
+ opacity: 1;
228
+ }
229
+
213
230
  &.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
- }
231
+ >modules>module>div {
232
+ opacity: 0;
222
233
  }
223
234
  }
224
235
 
@@ -14,7 +14,6 @@ class HotbarController {
14
14
  private currentIndexSelection: number = 0
15
15
 
16
16
  public open: boolean
17
- public reopen: boolean
18
17
  public forceHide: boolean
19
18
  public ngifHide: boolean
20
19
  public openedIndexSub?: number = undefined
@@ -156,6 +155,7 @@ class HotbarController {
156
155
  }
157
156
 
158
157
  private __updateHotbar(): void {
158
+ const quickMenuSize: number = this.config && this.config.quickMenu!.links.length
159
159
  this.modules = this.$element.find('module')
160
160
  this.subModules = this.$element.find('sub-module')
161
161
  this.__onHotBarScroll()
@@ -178,7 +178,7 @@ class HotbarController {
178
178
  this.__buildOnIfDoesntExists('click', optionElement, (): void => {
179
179
  let option: JQuery = $(optionElement)
180
180
  option.on('click', (): void => {
181
- this.__onClickSubModule(index - 1, index2)
181
+ this.__onClickSubModule(index - 1 - quickMenuSize, index2)
182
182
  })
183
183
  })
184
184
  })
@@ -190,23 +190,39 @@ class HotbarController {
190
190
  if (!events || !events[on] || events[on].length == 0) callback()
191
191
  }
192
192
 
193
- private __onClickModule(index: number, element: Element): void {
194
- if (index > 0) {
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')) {
195
200
  if (this.openedIndexSub) $(this.modules[this.openedIndexSub]).removeClass('force-open-sub')
196
201
  $(element).addClass('force-open-sub')
197
202
  this.openedIndexSub = index
198
- } else {
203
+ '' } else {
199
204
  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
- }
205
+ this.__onClickSubModule(-1, index - 1)
206
+ this.currentIndexSelection = (this.currentIndexSelection + index) % (quickMenuSize + 1)
207
207
  }
208
208
  }
209
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
+
210
226
  private __onClickSubModule(index: number, index2: number): void {
211
227
  if(this.openedIndexSub){
212
228
  $(this.modules[this.openedIndexSub]).removeClass('force-open-sub')
@@ -214,26 +230,8 @@ class HotbarController {
214
230
  }
215
231
  const subModuleConfig: SubModule = index > -1 ? this.config.structure![index].children[index2] : this.config.quickMenu!.links[index2]
216
232
  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)
233
+ this.__onSubModuleSelected(subModuleConfig)
234
+ this.reloadComponent()
237
235
  } else {
238
236
  this.__onSubModuleSelected(subModuleConfig)
239
237
  }
@@ -283,7 +281,7 @@ class HotbarController {
283
281
  const hotbar = {
284
282
  bindings: {
285
283
  'config': '<',
286
- 'open': '=',
284
+ 'open': '<',
287
285
  },
288
286
  template,
289
287
  controller: HotbarController,
@@ -53,7 +53,7 @@ class MbSidemenuService {
53
53
  }
54
54
 
55
55
  public getMenuConfig(): any {
56
- this.menuConfig
56
+ return this.menuConfig
57
57
  }
58
58
  }
59
59
 
@@ -1,18 +1,22 @@
1
1
  <div class="side-menu-wrapper" ng-class="{'opened-size':vm.menuOpen}">
2
2
  <hotbar config="vm.config" open="vm.menuOpen">
3
- <module main>
3
+ <module main="true">
4
4
  <div>
5
5
  <i class="{{vm.config.quickMenu.icon || 'fas fa-times'}}"></i>
6
6
  <label>{{vm.config.quickMenu.buttonText}}</label>
7
7
  </div>
8
8
  <sub-module>
9
- <div ng-repeat="subModule in vm.config.quickMenu.links">
10
- <i class="{{subModule.icon}}"></i>
11
- <label>{{subModule.label}}</label>
12
- </div>
13
9
  </sub-module>
14
10
  </module>
15
- <module ng-repeat="module in vm.config.structure" ng-if="module.label && module.children">
11
+ <module main="true" ng-repeat="module in vm.config.quickMenu.links" ng-hide="vm.forceHide" ng-class="{'hidden':!vm.config.quickMenu.open}">
12
+ <div >
13
+ <i class="{{module.icon}}"></i>
14
+ <label>{{module.label}}</label>
15
+ <sub-module>
16
+ </sub-module>
17
+ </div>
18
+ </module>
19
+ <module ng-repeat="module in vm.config.structure" ng-if="module.label && module.children" ng-hide="vm.forceHide" ng-class="{'hidden':vm.config.quickMenu.open}">
16
20
  <div>
17
21
  <i ng-if="module.icon && module.icon != ''"
18
22
  class="{{module.icon}}">
@@ -37,7 +37,7 @@ const controller = ($scope, $timeout, baseNotificationService, $sce) => {
37
37
  const onClickOutside = () => {
38
38
  $timeout(() => {
39
39
  vm.notificationOpen = false
40
- $timeout(() => document.removeEventListener('dblclick', onClickOutside))
40
+ $timeout(() => document.removeEventListener('click', onClickOutside))
41
41
  })
42
42
  }
43
43
 
@@ -49,9 +49,9 @@ const controller = ($scope, $timeout, baseNotificationService, $sce) => {
49
49
  vm.notificationOpen = !vm.notificationOpen
50
50
  if (vm.notificationOpen) {
51
51
  baseNotificationService.getNotifications()
52
- $timeout(() => document.addEventListener('dblclick', onClickOutside))
52
+ $timeout(() => document.addEventListener('click', onClickOutside))
53
53
  } else {
54
- $timeout(() => document.removeEventListener('dblclick', onClickOutside))
54
+ $timeout(() => document.removeEventListener('click', onClickOutside))
55
55
  }
56
56
  }
57
57
 
@@ -74,7 +74,7 @@ const controller = ($scope, $timeout, baseNotificationService, $sce) => {
74
74
  baseNotificationService.removeNotification(notification.id)
75
75
  $timeout(() => {
76
76
  vm.notifications.read = vm.notifications.read.filter((not) => not.id != notification.id)
77
- vm.notifications.countRead = vm.notifications.countRead - 1
77
+ vm.notifications.countRead = vm.notifications.countRead - 1
78
78
  if (vm.notifications.read.length == 0) {
79
79
  baseNotificationService.getNotifications()
80
80
  }
@@ -85,7 +85,7 @@ const controller = ($scope, $timeout, baseNotificationService, $sce) => {
85
85
  baseNotificationService.markRead(notification.id)
86
86
  $timeout(() => {
87
87
  vm.notifications.unread = vm.notifications.unread.filter((not) => not.id != notification.id)
88
- vm.notifications.countUnread = vm.notifications.countUnread - 1
88
+ vm.notifications.countUnread = vm.notifications.countUnread - 1
89
89
  baseNotificationService.seeMoreRead(0, vm.notifications.pageSizeRead)
90
90
  if (vm.notifications.unread.length == 0) {
91
91
  baseNotificationService.getNotifications()
@@ -8,7 +8,8 @@
8
8
  <div class="mb-tn-number"
9
9
  tabindex="-1"
10
10
  ng-style="{'width': getWidth(total), 'right': getRight(total)}"
11
- ng-show="total > 0">
11
+ ng-show="total > 0"
12
+ ng-click="toogle()">
12
13
  {{ total }}
13
14
  </div>
14
15
  <div class="mb-tn-wrapper"
@@ -47,6 +48,7 @@
47
48
  tabindex="-1"
48
49
  ng-show="notifications && (notifications.read.length > 0 || notifications.unread.length > 0)">
49
50
  <div class="row" tabindex="-1">
51
+
50
52
  <div class="col-md-12"
51
53
  tabindex="-1"
52
54
  style="display: flex;
@@ -14,7 +14,8 @@ import baseNotificationService from './services/base-notification-service'
14
14
  const component = {
15
15
  bindings: {
16
16
  config: '=',
17
- configMenu: '=?'
17
+ configMenu: '=?',
18
+ hideSidebarButtom: '<?',
18
19
  },
19
20
  template,
20
21
  controller,
@@ -115,7 +115,7 @@
115
115
  display: flex;
116
116
  align-items: center;
117
117
  justify-items: center;
118
-
118
+
119
119
  span{
120
120
  color: var(--font1);
121
121
  font-size: 22px;
@@ -182,10 +182,11 @@
182
182
  font-size: 25px;
183
183
  position: relative;
184
184
  text-align: center;
185
- cursor: pointer;
185
+ cursor: unset;
186
186
  i {
187
187
  color: #8034ad;
188
188
  @include themify(color, color1);
189
+ cursor: pointer;
189
190
  }
190
191
  .mb-tn-number {
191
192
  position: absolute;
@@ -6,7 +6,8 @@
6
6
  <div class="mb-t-container"
7
7
  tabindex="-1">
8
8
  <div class="mb-t-buguer-btn-container"
9
- ng-click="vm.openMenu()">
9
+ ng-click="vm.openMenu()"
10
+ ng-hide="vm.hideSidebarButtom">
10
11
  <i class="fas fa-bars"></i>
11
12
  </div>
12
13
  <a ng-if="vm.config.logoActionType === 'state'" ui-sref="{{vm.config.logoAction}}"