@weni/unnnic-system 2.0.23 → 2.0.25

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": "@weni/unnnic-system",
3
- "version": "2.0.23",
3
+ "version": "2.0.25",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -74,4 +74,4 @@
74
74
  "vite": "4.3.5",
75
75
  "vue-eslint-parser": "^9.4.2"
76
76
  }
77
- }
77
+ }
@@ -28,7 +28,7 @@
28
28
  />
29
29
  </div>
30
30
  <div
31
- v-if="$slots.icon"
31
+ v-if="hasIcon"
32
32
  class="unnnic-modal-container-background-body__icon-slot"
33
33
  >
34
34
  <slot name="icon"></slot>
@@ -126,7 +126,10 @@ export default {
126
126
  return !(this.alertMessage === null || this.alertMessage.length === 0);
127
127
  },
128
128
  hasButton() {
129
- return !!this.$slots.options;
129
+ return !!this.$slots.options?.().length;
130
+ },
131
+ hasIcon() {
132
+ return !!this.$slots.icon?.().length;
130
133
  },
131
134
  },
132
135
  mounted() {
@@ -161,11 +161,8 @@ export default {
161
161
  window.removeEventListener('resize', this.handleResize);
162
162
  },
163
163
  mounted() {
164
- const fallbackLabelWidth = 32 + this.sliderVal.toString().length * 4.5;
165
- this.sliderWidth = this.$refs.input.clientWidth;
166
- this.labelWidth =
167
- this.$refs.tooltip.$refs.label.clientWidth || fallbackLabelWidth;
168
- this.tooltipOffset = this.getNewTooltipPosition();
164
+ this.checkInputWidth();
165
+ this.checkTooltipLabelWidth();
169
166
  },
170
167
  methods: {
171
168
  configureTooltip() {
@@ -185,9 +182,40 @@ export default {
185
182
 
186
183
  this.handleValueChange();
187
184
  },
185
+ checkInputWidth() {
186
+ const intervalId = setInterval(() => {
187
+ const inputElement = this.$refs.input;
188
+ if (inputElement) {
189
+ const { offsetWidth } = inputElement;
190
+ if (offsetWidth > 0) {
191
+ this.sliderWidth = offsetWidth;
192
+ this.configureTooltip();
193
+ clearInterval(intervalId);
194
+ }
195
+ }
196
+ }, 100);
197
+ },
198
+ checkTooltipLabelWidth() {
199
+ const intervalId = setInterval(() => {
200
+ const tooltipLabel = this.$refs.tooltip?.$refs.label;
201
+ if (!tooltipLabel) {
202
+ return;
203
+ }
204
+
205
+ const { clientWidth } = tooltipLabel;
206
+ if (clientWidth > 0) {
207
+ this.labelWidth = clientWidth;
208
+ this.configureTooltip();
209
+ clearInterval(intervalId);
210
+ }
211
+ }, 100);
212
+ },
188
213
  getNewTooltipPosition() {
189
- const haldThumbWidth = 12 / 2;
190
- const halfLabelWidth = (this.labelWidth === 0 ? 32 : this.labelWidth) / 2;
214
+ if (this.sliderWidth === 0 || this.labelWidth === 0) {
215
+ return 0;
216
+ }
217
+ const halfThumbWidth = 12 / 2;
218
+ const halfLabelWidth = this.labelWidth / 2 || 16;
191
219
  const centerPosition = this.sliderWidth / 2;
192
220
 
193
221
  let percentOfRange =
@@ -199,7 +227,7 @@ export default {
199
227
  const valuePXPosition = percentOfRange * this.sliderWidth;
200
228
  const distFromCenter = valuePXPosition - centerPosition;
201
229
  const percentDistFromCenter = distFromCenter / centerPosition;
202
- const offset = percentDistFromCenter * haldThumbWidth;
230
+ const offset = percentDistFromCenter * halfThumbWidth;
203
231
 
204
232
  const finalLabelPosition = valuePXPosition - halfLabelWidth - offset;
205
233
  return finalLabelPosition;
@@ -36,7 +36,7 @@
36
36
  :target="row.link.target || '_blank'"
37
37
  >
38
38
  <TableBodyCell
39
- v-for="(cell, index) of row.content"
39
+ v-for="cell of row.content"
40
40
  :key="cell + index"
41
41
  class="unnnic-table-next__body-cell"
42
42
  :cell="cell"
@@ -44,7 +44,7 @@
44
44
  </a>
45
45
  <template v-else>
46
46
  <TableBodyCell
47
- v-for="(cell, index) of row.content"
47
+ v-for="cell of row.content"
48
48
  :key="cell + index"
49
49
  class="unnnic-table-next__body-cell"
50
50
  :cell="cell"
@@ -66,7 +66,7 @@
66
66
  <TablePagination
67
67
  :modelValue="pagination"
68
68
  :total="treatedPaginationTotal"
69
- :interval="rows.length"
69
+ :interval="paginationInterval"
70
70
  @update:model-value="$emit('update:pagination', $event)"
71
71
  />
72
72
  </table>
@@ -129,12 +129,18 @@ export default {
129
129
  type: Number,
130
130
  default: 1,
131
131
  },
132
+ paginationInterval: {
133
+ type: Number,
134
+ default: 1,
135
+ },
132
136
  isLoading: {
133
137
  type: Boolean,
134
138
  default: false,
135
139
  },
136
140
  },
137
141
 
142
+ emits: ['update:pagination'],
143
+
138
144
  data() {
139
145
  return {
140
146
  defaultTranslations: {
@@ -44,6 +44,7 @@ export default {
44
44
  :rows="args.rows || table.rows"
45
45
  v-model:pagination="pagination"
46
46
  :paginationTotal="125"
47
+ :paginationInterval="5"
47
48
  />
48
49
  `,
49
50
  }),