@kigi/components 1.41.0 → 1.42.0-alpha.2

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.2",
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,68 @@ class MbgAverageCustomerTimeController {
36
37
  },
37
38
  true,
38
39
  )
40
+
41
+ const zoomLevel = String(window.devicePixelRatio)
42
+ const hasZoomLevelTwo = zoomLevel.includes(String(1.6))
43
+ const hasZoomLevelOne = zoomLevel.includes(String(0.8))
44
+
45
+ if ((hasZoomLevelTwo && Number(zoomLevel) < 2) || (hasZoomLevelOne && Number(zoomLevel) < 1)) {
46
+ this.adjustContainerWidth(true)
47
+ }
48
+
49
+ this.boundAdjustContainerWidth = this.adjustContainerWidth.bind(this)
50
+ window.addEventListener('resize', this.boundAdjustContainerWidth)
51
+ }
52
+
53
+ $onDestroy() {
54
+ window.removeEventListener('resize', this.boundAdjustContainerWidth)
55
+ }
56
+
57
+ adjustContainerWidth(onInit) {
58
+ const zoomLevel = window.devicePixelRatio
59
+
60
+ if (zoomLevel < 2 || zoomLevel < 1) {
61
+ const container = document.getElementById('line')
62
+ if (container) {
63
+ container.style.width = `94%`
64
+ }
65
+ }
39
66
  }
40
67
 
41
68
  configPanelPercentagesReturnCustomerTime() {
42
- const colors = ['#F24A57', '#45BDBF', '#482F72', '#CDDA34', '#F68E2C']
69
+ const colors = ['#696EF0', '#45C413', '#F8D658', '#F5AE3C', '#FF8A22', '#FF4641']
43
70
  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
- }))
71
+ const transformedData = this.percentagesReturnCustomerTime.map((item, index) => {
72
+ let daysLabel = ''
73
+ switch (index) {
74
+ case 0:
75
+ daysLabel = '0 a 30'
76
+ break
77
+ case 1:
78
+ daysLabel = '31 a 60'
79
+ break
80
+ case 2:
81
+ daysLabel = '61 a 90'
82
+ break
83
+ case 3:
84
+ daysLabel = '91 a 180'
85
+ break
86
+ case 4:
87
+ daysLabel = '181 a 365'
88
+ break
89
+ case 5:
90
+ daysLabel = '+365'
91
+ break
92
+ }
93
+
94
+ return {
95
+ name: `${item.days}`,
96
+ days: daysLabel,
97
+ y: parseFloat(item.percentage) > 0 ? parseFloat(item.percentage) : 0,
98
+ color: colors[index],
99
+ quantity: item.quantity,
100
+ }
101
+ })
49
102
 
50
103
  Highcharts.chart('container', {
51
104
  chart: {
@@ -87,10 +140,10 @@ class MbgAverageCustomerTimeController {
87
140
  },
88
141
  },
89
142
  title: {
143
+ align: 'left',
90
144
  text: `
91
145
  <div class="custom-title-container">
92
146
  <p class="custom-title">Tempo médio de retorno do cliente</p>
93
- <div class="line-pay"></div>
94
147
  </div>`,
95
148
  useHTML: true,
96
149
  style: {
@@ -102,7 +155,7 @@ class MbgAverageCustomerTimeController {
102
155
 
103
156
  legend: {
104
157
  layout: 'horizontal',
105
- itemDistance: 5,
158
+ itemDistance: 10,
106
159
  },
107
160
  plotOptions: {
108
161
  pie: {
@@ -111,12 +164,11 @@ class MbgAverageCustomerTimeController {
111
164
  borderRadius: 8,
112
165
  dataLabels: {
113
166
  enabled: !hasPermissionPorcentages,
114
-
115
167
  formatter: function () {
116
168
  if (!hasPermissionPorcentages) {
117
169
  return `<span style="color:#7B7B7B">${
118
- this.point.name
119
- }</span><br><span style="font-weight:bold; color:#333">(${this.y.toFixed(
170
+ this.point.days
171
+ } dias</span><br><span style="font-weight:bold; color:#333">(${this.y.toFixed(
120
172
  2,
121
173
  )}%)</span>`
122
174
  }
@@ -134,14 +186,16 @@ class MbgAverageCustomerTimeController {
134
186
  if (hasPermissionPorcentages) {
135
187
  return 'Sem permissão para visualizar'
136
188
  }
137
- return `<b>${this.point.name}</b><br>Porcentagem: ${this.y.toFixed(2)}%`
189
+ return `<b>${this.point.days} dias</b><br>Porcentagem: ${this.y.toFixed(
190
+ 2,
191
+ )}%<br><b>Clientes: ${this.point.quantity}</b>`
138
192
  },
139
193
  },
140
194
  series: [
141
195
  {
142
196
  name: 'Porcentagem',
143
197
  colorByPoint: true,
144
- innerSize: '75%',
198
+ innerSize: '65%',
145
199
  data: transformedData,
146
200
  },
147
201
  ],