@dataloop-ai/components 0.17.105 → 0.17.107

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.105",
3
+ "version": "0.17.107",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -2,3 +2,4 @@ export interface DlGridLayout {
2
2
  name: string
3
3
  value: number[][]
4
4
  }
5
+ export type DlGridSideType = 'left' | 'right'
@@ -94,6 +94,7 @@ export default defineComponent({
94
94
  clone.style.visibility = 'visible'
95
95
  clone.style.width = `${this.draggedWidget.offsetWidth}px`
96
96
  clone.style.height = `${this.draggedWidget.offsetHeight}px`
97
+ clone.style.backgroundColor = `var(--dl-color-bg)`
97
98
  }
98
99
 
99
100
  const sourceCanvas = this.draggedWidget?.querySelector('canvas')
@@ -249,6 +250,8 @@ export default defineComponent({
249
250
 
250
251
  &__drag {
251
252
  position: relative;
253
+ opacity: 0.2;
254
+ background: var(--dl-color-separator);
252
255
  &::after {
253
256
  content: '';
254
257
  position: absolute;
@@ -256,7 +259,6 @@ export default defineComponent({
256
259
  height: 100%;
257
260
  top: 0;
258
261
  left: 0;
259
- background: var(--dl-color-separator);
260
262
  border-radius: 5px;
261
263
  }
262
264
  }
@@ -1,4 +1,5 @@
1
1
  import { cloneDeep } from 'lodash'
2
+ import { DlGridSideType } from '../DlGrid/types'
2
3
 
3
4
  export function leastCommonMultiple(arr: number[]) {
4
5
  if (!arr) return
@@ -61,11 +62,9 @@ export function swapElemensInMatrix(
61
62
  layout: number[][],
62
63
  sourceIndex: any,
63
64
  targetIndex: any,
64
- side: string,
65
+ side: DlGridSideType,
65
66
  maxElements: number
66
67
  ) {
67
- if (targetIndex.column === sourceIndex.column + 1 && side === 'left')
68
- return layout
69
68
  const newLayout = cloneDeep(layout)
70
69
 
71
70
  const removedElement = newLayout[sourceIndex.row].splice(
@@ -78,7 +77,35 @@ export function swapElemensInMatrix(
78
77
  removedElement[0]
79
78
  )
80
79
 
81
- return isTooLarge(newLayout, maxElements) ? layout : newLayout
80
+ return isTooLarge(newLayout, maxElements)
81
+ ? moveElementsToNextIndex(newLayout, maxElements)
82
+ : newLayout
83
+ }
84
+
85
+ function moveElementsToNextIndex(
86
+ template: number[][],
87
+ maxElements: number
88
+ ): number[][] {
89
+ const clonedTemplate: number[][] = cloneDeep(template)
90
+ let overflow: number[] = []
91
+
92
+ for (let i = 0; i < clonedTemplate.length; i++) {
93
+ let currentRow = clonedTemplate[i]
94
+ if (overflow.length > 0) {
95
+ currentRow = overflow.concat(currentRow)
96
+ overflow = []
97
+ }
98
+ if (currentRow.length > maxElements) {
99
+ overflow = currentRow.slice(maxElements)
100
+ currentRow = currentRow.slice(0, maxElements)
101
+ }
102
+ clonedTemplate[i] = currentRow
103
+ if (i + 1 < clonedTemplate.length && overflow.length > 0) {
104
+ clonedTemplate[i + 1] = overflow.concat(clonedTemplate[i + 1])
105
+ overflow = []
106
+ }
107
+ }
108
+ return clonedTemplate
82
109
  }
83
110
 
84
111
  function isTooLarge(layout: number[][], max: number) {
@@ -465,7 +465,7 @@ export default defineComponent({
465
465
  &--separator {
466
466
  position: absolute;
467
467
  left: 0;
468
- width: 1px;
468
+ width: 0.7px;
469
469
  height: 60%;
470
470
  }
471
471
 
@@ -466,7 +466,7 @@ export default defineComponent({
466
466
  )
467
467
  },
468
468
  hasPrepend(): boolean {
469
- return !!this.$slots.prepend && !this.isSmall
469
+ return !!this.$slots.prepend
470
470
  },
471
471
  hasAppend(): boolean {
472
472
  return (
@@ -489,7 +489,6 @@ export default defineComponent({
489
489
  !this.disabled &&
490
490
  !this.readonly &&
491
491
  !!this.modelValue
492
- // this.focused
493
492
  )
494
493
  },
495
494
  showShowPassButton(): boolean {
@@ -760,9 +759,8 @@ export default defineComponent({
760
759
  }
761
760
 
762
761
  &--s {
763
- padding-top: 3px;
762
+ padding-top: 4px;
764
763
  padding-bottom: 3px;
765
- padding-left: 5px;
766
764
  padding-right: 5px;
767
765
  }
768
766
  &--small {
@@ -835,6 +833,7 @@ export default defineComponent({
835
833
  }
836
834
 
837
835
  &--s {
836
+ margin-top: 1px;
838
837
  height: 20px;
839
838
  }
840
839
 
@@ -51,13 +51,15 @@ import { DlInput } from '../../DlInput'
51
51
 
52
52
  const SearchSizes = {
53
53
  l: 'l',
54
- m: 'm'
54
+ m: 'm',
55
+ s: 's'
55
56
  } as const
56
57
  type TSearchSizes = (typeof SearchSizes)[keyof typeof SearchSizes]
57
58
 
58
59
  const BUTTON_SIZES = {
59
60
  l: 'l',
60
- m: 's'
61
+ m: 's',
62
+ s: 's'
61
63
  }
62
64
 
63
65
  export default defineComponent({
@@ -281,13 +281,10 @@
281
281
  name="option"
282
282
  />
283
283
  <template v-else>
284
- {{
285
- capitalizedOptions
286
- ? typeof getOptionLabel(option) ===
287
- 'string' &&
288
- getOptionLabel(option).toLowerCase()
289
- : getOptionLabel(option)
290
- }}
284
+ <span
285
+ class="inner-option"
286
+ v-html="getOptionHtml(option)"
287
+ />
291
288
  </template>
292
289
  </dl-select-option>
293
290
  <dl-list-item v-if="hasAfterOptions && !noOptions">
@@ -418,6 +415,7 @@ export default defineComponent({
418
415
  const selectedIndex = ref(-1)
419
416
  const highlightedIndex = ref(-1)
420
417
  const isEmpty = ref(true)
418
+ const searchInputValue = ref('')
421
419
  const MAX_ITEMS_PER_LIST = 100 // HARDCODED - max items per list before virtual scroll
422
420
 
423
421
  const setHighlightedIndex = (value: any) => {
@@ -446,7 +444,8 @@ export default defineComponent({
446
444
  selectedIndex,
447
445
  setHighlightedIndex,
448
446
  handleSelectedItem,
449
- handleModelValueUpdate
447
+ handleModelValueUpdate,
448
+ searchInputValue
450
449
  }
451
450
  },
452
451
  computed: {
@@ -817,7 +816,19 @@ export default defineComponent({
817
816
  (this.$refs.menu as any)?.updatePosition()
818
817
  })
819
818
  }
820
- this.$emit('search-input', (e.target as HTMLInputElement).value)
819
+ const searchValue = (e.target as HTMLInputElement).value
820
+ this.searchInputValue = searchValue
821
+ this.$emit('search-input', searchValue)
822
+ },
823
+ getOptionHtml(option: DlSelectOptionType) {
824
+ return `<span>${(this.capitalizedOptions
825
+ ? typeof this.getOptionLabel(option) === 'string' &&
826
+ this.getOptionLabel(option).toLowerCase()
827
+ : this.getOptionLabel(option)
828
+ ).replace(
829
+ this.searchInputValue,
830
+ `<span style="background: var(--dl-color-warning)">${this.searchInputValue}</span>`
831
+ )}</span>`
821
832
  },
822
833
  handleSearchBlur(e: Event): void {
823
834
  if (this.search) {
@@ -7,11 +7,11 @@
7
7
  @change="selectLayout"
8
8
  >
9
9
  <option
10
- v-for="(layout, index) in layouts"
11
- :key="index"
12
- :value="index"
10
+ v-for="(layoutItem, layoutIndex) in layouts"
11
+ :key="layoutIndex"
12
+ :value="layoutIndex"
13
13
  >
14
- {{ layout.name }}
14
+ {{ layoutItem.name }}
15
15
  </option>
16
16
  </select>
17
17
  <button
@@ -42,9 +42,7 @@
42
42
  </template>
43
43
  <template #content>
44
44
  <dl-bar-chart
45
- :legend-props="legendProps"
46
45
  :data="data"
47
- :options="options"
48
46
  :items-in-view="8"
49
47
  />
50
48
  </template>
@@ -75,9 +73,7 @@
75
73
  </template>
76
74
  <template #content>
77
75
  <dl-bar-chart
78
- :legend-props="legendProps"
79
76
  :data="data"
80
- :options="options"
81
77
  :items-in-view="6"
82
78
  />
83
79
  </template>
@@ -89,9 +85,7 @@
89
85
  </template>
90
86
  <template #content>
91
87
  <dl-bar-chart
92
- :legend-props="legendProps"
93
88
  :data="data"
94
- :options="options"
95
89
  :items-in-view="6"
96
90
  />
97
91
  </template>
@@ -104,9 +98,7 @@
104
98
  </template>
105
99
  <template #content>
106
100
  <dl-bar-chart
107
- :legend-props="legendProps"
108
101
  :data="data"
109
- :options="options"
110
102
  :items-in-view="8"
111
103
  />
112
104
  </template>
@@ -125,9 +117,7 @@
125
117
  </template>
126
118
  <template #content>
127
119
  <dl-bar-chart
128
- :legend-props="legendProps"
129
120
  :data="data"
130
- :options="options"
131
121
  :items-in-view="6"
132
122
  />
133
123
  </template>