@kigi/components 1.41.0 → 1.42.0-alpha.1

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": "@kigi/components",
3
- "version": "1.41.0",
3
+ "version": "1.42.0-alpha.1",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -1,6 +1,7 @@
1
1
  <div class="average-customer-time-wrapper">
2
2
  <figure class="highcharts-figure">
3
- <div class="description-container-dash">
3
+ <div class="description-container-dash"
4
+ ng-show="$ctrl.percentagesReturnCustomerTime.length">
4
5
  <div class="mbg-h-c-tone-s-icon-dash"
5
6
  ng-click="$ctrl.toggleShowValuesReturnCustomer(false)">
6
7
  <i class="fa fa-lock lock-dash-store"
@@ -16,6 +17,11 @@
16
17
  class="far fa-eye-slash eye-board-target"></i>
17
18
  </div>
18
19
  </div>
19
- <div id="container"></div>
20
+ <div class="chart-container"
21
+ id="container">
22
+ </div>
23
+ <div class="line-pay"
24
+ id="line"></div>
20
25
  </figure>
26
+
21
27
  </div>
@@ -4,16 +4,19 @@
4
4
  .custom-title-container{
5
5
  .custom-title{
6
6
  position: relative;
7
- left: -20px;
8
7
  }
9
8
  }
9
+
10
10
  .line-pay {
11
- width: 100%;
12
11
  background: #737373;
13
12
  height: 1px;
14
13
  opacity: 0.3;
15
-
14
+ position: relative;
15
+ top: -357px;
16
+ left: 34px;
17
+ width: 100%;
16
18
  }
19
+
17
20
  #container {
18
21
  border-radius: 10px;
19
22
  background: #FFF;
@@ -24,13 +27,13 @@
24
27
  justify-content: center;
25
28
  align-items: center;
26
29
  }
30
+
27
31
  .description-container-dash {
28
32
  color: var(--titleColor);
29
33
  display: flex;
30
34
  justify-content: end;
31
35
  position: relative;
32
36
  top: 22px;
33
- right: 12px;
34
37
  z-index: 9999;
35
38
 
36
39
  .mbg-h-c-tone-s-icon-dash {
@@ -43,10 +46,15 @@
43
46
 
44
47
  @media screen and (max-width: 1920px){
45
48
  .highcharts-figure {
46
-
49
+ .custom-title-container{
50
+ .custom-title{
51
+ position: relative;
52
+ left: 4px;
53
+ }
54
+ }
47
55
  .line-pay {
48
56
  position: relative;
49
- left: -20px;
57
+ left: 30px;
50
58
  width: 480px;
51
59
  }
52
60
  #container {
@@ -65,7 +73,7 @@
65
73
  .highcharts-figure {
66
74
  .line-pay {
67
75
  position: relative;
68
- left: -20px;
76
+ left: 30px;
69
77
  width: 418px;
70
78
  }
71
79
  #container {
@@ -87,7 +95,7 @@
87
95
  }
88
96
  .line-pay {
89
97
  position: relative;
90
- left: -20px;
98
+ left: 30px;
91
99
  width: 366px;
92
100
  }
93
101
  #container {
@@ -110,7 +118,7 @@
110
118
 
111
119
  .line-pay {
112
120
  position: relative;
113
- left: -20px;
121
+ left: 30px;
114
122
  width: 332px;
115
123
  }
116
124
  #container {
@@ -134,7 +142,7 @@
134
142
 
135
143
  .line-pay {
136
144
  position: relative;
137
- left: -20px;
145
+ left: 30px;
138
146
  width: 450px;
139
147
  }
140
148
  #container {
@@ -158,7 +166,7 @@
158
166
 
159
167
  .line-pay {
160
168
  position: relative;
161
- left: -20px;
169
+ left: 30px;
162
170
  width: 450px;
163
171
  }
164
172
  #container {
@@ -182,7 +190,7 @@
182
190
 
183
191
  .line-pay {
184
192
  position: relative;
185
- left: -20px;
193
+ left: 30px;
186
194
  width: 306px;
187
195
  }
188
196
  #container {
@@ -14,6 +14,7 @@ class MbgAverageCustomerTimeController {
14
14
  private allowedCallBack: Function
15
15
  private isBlockValuesDashboarReturnCustomer
16
16
  private hideValue: boolean = false
17
+ private boundAdjustContainerWidth
17
18
 
18
19
  constructor(
19
20
  public $scope,
@@ -36,16 +37,66 @@ class MbgAverageCustomerTimeController {
36
37
  },
37
38
  true,
38
39
  )
40
+
41
+ const zoomLevel = String(window.devicePixelRatio)
42
+ const hasZoomLevel = zoomLevel.includes(String(1.6))
43
+ if (hasZoomLevel && Number(zoomLevel) < 2) {
44
+ this.adjustContainerWidth(true)
45
+ }
46
+
47
+ this.boundAdjustContainerWidth = this.adjustContainerWidth.bind(this)
48
+ window.addEventListener('resize', this.boundAdjustContainerWidth)
49
+ }
50
+
51
+ $onDestroy() {
52
+ console.log('chamoooo')
53
+ window.removeEventListener('resize', this.boundAdjustContainerWidth)
54
+ }
55
+
56
+ adjustContainerWidth(onInit) {
57
+ const zoomLevel = window.devicePixelRatio
58
+ if (zoomLevel < 2) {
59
+ const container = document.getElementById('line')
60
+ if (container) {
61
+ container.style.width = `94%`
62
+ }
63
+ }
39
64
  }
40
65
 
41
66
  configPanelPercentagesReturnCustomerTime() {
42
- const colors = ['#F24A57', '#45BDBF', '#482F72', '#CDDA34', '#F68E2C']
67
+ const colors = ['#696EF0', '#45C413', '#F8D658', '#F5AE3C', '#FF8A22', '#FF4641']
43
68
  const hasPermissionPorcentages = !this.isPermissionAverageCustomerReturnTime || this.hideValue
44
- const transformedData = this.percentagesReturnCustomerTime.map((item, index) => ({
45
- name: `${item.days} dias`,
46
- y: parseFloat(item.percentage) > 0 ? parseFloat(item.percentage) : 0,
47
- color: colors[index],
48
- }))
69
+ const transformedData = this.percentagesReturnCustomerTime.map((item, index) => {
70
+ let daysLabel = ''
71
+ switch (index) {
72
+ case 0:
73
+ daysLabel = '0 a 30'
74
+ break
75
+ case 1:
76
+ daysLabel = '31 a 60'
77
+ break
78
+ case 2:
79
+ daysLabel = '61 a 90'
80
+ break
81
+ case 3:
82
+ daysLabel = '91 a 180'
83
+ break
84
+ case 4:
85
+ daysLabel = '181 a 365'
86
+ break
87
+ case 5:
88
+ daysLabel = '+365'
89
+ break
90
+ }
91
+
92
+ return {
93
+ name: `${item.days}`,
94
+ days: daysLabel,
95
+ y: parseFloat(item.percentage) > 0 ? parseFloat(item.percentage) : 0,
96
+ color: colors[index],
97
+ quantity: item.quantity,
98
+ }
99
+ })
49
100
 
50
101
  Highcharts.chart('container', {
51
102
  chart: {
@@ -87,10 +138,10 @@ class MbgAverageCustomerTimeController {
87
138
  },
88
139
  },
89
140
  title: {
141
+ align: 'left',
90
142
  text: `
91
143
  <div class="custom-title-container">
92
144
  <p class="custom-title">Tempo médio de retorno do cliente</p>
93
- <div class="line-pay"></div>
94
145
  </div>`,
95
146
  useHTML: true,
96
147
  style: {
@@ -102,7 +153,7 @@ class MbgAverageCustomerTimeController {
102
153
 
103
154
  legend: {
104
155
  layout: 'horizontal',
105
- itemDistance: 5,
156
+ itemDistance: 10,
106
157
  },
107
158
  plotOptions: {
108
159
  pie: {
@@ -111,12 +162,11 @@ class MbgAverageCustomerTimeController {
111
162
  borderRadius: 8,
112
163
  dataLabels: {
113
164
  enabled: !hasPermissionPorcentages,
114
-
115
165
  formatter: function () {
116
166
  if (!hasPermissionPorcentages) {
117
167
  return `<span style="color:#7B7B7B">${
118
- this.point.name
119
- }</span><br><span style="font-weight:bold; color:#333">(${this.y.toFixed(
168
+ this.point.days
169
+ } dias</span><br><span style="font-weight:bold; color:#333">(${this.y.toFixed(
120
170
  2,
121
171
  )}%)</span>`
122
172
  }
@@ -134,14 +184,16 @@ class MbgAverageCustomerTimeController {
134
184
  if (hasPermissionPorcentages) {
135
185
  return 'Sem permissão para visualizar'
136
186
  }
137
- return `<b>${this.point.name}</b><br>Porcentagem: ${this.y.toFixed(2)}%`
187
+ return `<b>${this.point.days} dias</b><br>Porcentagem: ${this.y.toFixed(
188
+ 2,
189
+ )}%<br><b>Clientes: ${this.point.quantity}</b>`
138
190
  },
139
191
  },
140
192
  series: [
141
193
  {
142
194
  name: 'Porcentagem',
143
195
  colorByPoint: true,
144
- innerSize: '75%',
196
+ innerSize: '65%',
145
197
  data: transformedData,
146
198
  },
147
199
  ],