@dataloop-ai/components 0.17.84 → 0.17.85

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": "@dataloop-ai/components",
3
- "version": "0.17.84",
3
+ "version": "0.17.85",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -79,10 +79,15 @@
79
79
  <div class="x-axis">
80
80
  <span
81
81
  v-for="(label, index) in visibleLabels"
82
+ ref="xAxis"
82
83
  :key="index"
83
84
  class="x-axis__element"
84
85
  :style="`${
85
- !labelImages[0] ? 'transform: rotate(70deg);' : ''
86
+ !labelImages[0]
87
+ ? `transform: rotate(${
88
+ rotateXLabels ? '70' : '0'
89
+ }deg);`
90
+ : ''
86
91
  }`"
87
92
  >
88
93
  <span class="x-axis__element--text">
@@ -227,6 +232,7 @@ export default defineComponent({
227
232
  max: props.matrix.length
228
233
  })
229
234
  const cellWidth = ref<number | null>(null)
235
+ const rotateXLabels = ref(true)
230
236
 
231
237
  const getCellBackground = (value: number = 1): string => {
232
238
  const object: { [key: string]: any } = {
@@ -251,7 +257,8 @@ export default defineComponent({
251
257
  getCellTextColor,
252
258
  cellWidth,
253
259
  tooltipState,
254
- currentBrushState
260
+ currentBrushState,
261
+ rotateXLabels
255
262
  }
256
263
  },
257
264
  computed: {
@@ -309,6 +316,14 @@ export default defineComponent({
309
316
  this.currentBrushState.max = value.length
310
317
  this.resizeMatrix()
311
318
  }
319
+ },
320
+ currentBrushState() {
321
+ const longest = Math.max(
322
+ ...this.visibleLabels.map(
323
+ (el: DlConfusionMatrixLabel) => el.title.length
324
+ )
325
+ )
326
+ this.rotateXLabels = longest * 12 > getCellWidth()
312
327
  }
313
328
  },
314
329
  mounted() {
@@ -424,7 +439,7 @@ export default defineComponent({
424
439
  .x-axis {
425
440
  width: 100%;
426
441
  display: flex;
427
- justify-content: space-between;
442
+ justify-content: space-evenly;
428
443
  margin-top: 10px;
429
444
  min-height: 100px;
430
445
  max-height: 100px;
@@ -482,7 +497,7 @@ export default defineComponent({
482
497
  grid-template-columns: repeat(var(--matrix-rows), 1fr);
483
498
 
484
499
  &__cell {
485
- font-size: 60%;
500
+ font-size: 12px;
486
501
  cursor: pointer;
487
502
  border: 1px solid var(--dl-color-separator);
488
503
  box-sizing: border-box;
@@ -2,7 +2,8 @@ import { isObject } from 'lodash'
2
2
  import { DlConfusionMatrixCell, DlConfusionMatrixLabel } from '../../types'
3
3
 
4
4
  export function getCellWidth() {
5
- return document.querySelector('.matrix__cell').getBoundingClientRect().width
5
+ return document.querySelector('.matrix__cell')?.getBoundingClientRect()
6
+ .width
6
7
  }
7
8
 
8
9
  export function setZoom(zoom: number, el: HTMLElement) {