@dataloop-ai/components 0.17.104 → 0.17.106
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 +1 -1
- package/src/components/basic/DlGrid/types.ts +1 -0
- package/src/components/basic/DlWidget/DlWidget.vue +3 -1
- package/src/components/basic/DlWidget/utils.ts +31 -4
- package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +1 -1
- package/src/components/compound/DlInput/DlInput.vue +17 -10
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +4 -2
- package/src/demos/DlWidgetDemo.vue +4 -14
package/package.json
CHANGED
|
@@ -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:
|
|
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)
|
|
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) {
|
|
@@ -401,6 +401,15 @@ export default defineComponent({
|
|
|
401
401
|
}
|
|
402
402
|
return classes
|
|
403
403
|
},
|
|
404
|
+
getBorderColor(): string {
|
|
405
|
+
if (this.error) {
|
|
406
|
+
return `var(--dl-color-negative)`
|
|
407
|
+
} else if (this.warning) {
|
|
408
|
+
return `var(--dl-color-warning)`
|
|
409
|
+
} else {
|
|
410
|
+
return `var(--dl-color-secondary)`
|
|
411
|
+
}
|
|
412
|
+
},
|
|
404
413
|
cssVars(): Record<string, any> {
|
|
405
414
|
let inputMargin = this.margin
|
|
406
415
|
|
|
@@ -408,7 +417,8 @@ export default defineComponent({
|
|
|
408
417
|
inputMargin = '0px 20px 0px 0px'
|
|
409
418
|
}
|
|
410
419
|
return {
|
|
411
|
-
'--dl-input-margin': inputMargin
|
|
420
|
+
'--dl-input-margin': inputMargin,
|
|
421
|
+
'--dl-input-border-color-hover': this.getBorderColor
|
|
412
422
|
}
|
|
413
423
|
},
|
|
414
424
|
inputClasses(): string[] {
|
|
@@ -456,7 +466,7 @@ export default defineComponent({
|
|
|
456
466
|
)
|
|
457
467
|
},
|
|
458
468
|
hasPrepend(): boolean {
|
|
459
|
-
return !!this.$slots.prepend
|
|
469
|
+
return !!this.$slots.prepend
|
|
460
470
|
},
|
|
461
471
|
hasAppend(): boolean {
|
|
462
472
|
return (
|
|
@@ -479,7 +489,6 @@ export default defineComponent({
|
|
|
479
489
|
!this.disabled &&
|
|
480
490
|
!this.readonly &&
|
|
481
491
|
!!this.modelValue
|
|
482
|
-
// this.focused
|
|
483
492
|
)
|
|
484
493
|
},
|
|
485
494
|
showShowPassButton(): boolean {
|
|
@@ -750,9 +759,8 @@ export default defineComponent({
|
|
|
750
759
|
}
|
|
751
760
|
|
|
752
761
|
&--s {
|
|
753
|
-
padding-top:
|
|
762
|
+
padding-top: 4px;
|
|
754
763
|
padding-bottom: 3px;
|
|
755
|
-
padding-left: 5px;
|
|
756
764
|
padding-right: 5px;
|
|
757
765
|
}
|
|
758
766
|
&--small {
|
|
@@ -765,14 +773,12 @@ export default defineComponent({
|
|
|
765
773
|
&--error {
|
|
766
774
|
border-color: var(--dl-color-negative);
|
|
767
775
|
&:hover {
|
|
768
|
-
border-color: var(--dl-color-separator) !important;
|
|
769
776
|
}
|
|
770
777
|
}
|
|
771
778
|
|
|
772
779
|
&--warning {
|
|
773
|
-
border-color: var(--dl-color-
|
|
780
|
+
border-color: var(--dl-input-border-color-hover);
|
|
774
781
|
&:hover {
|
|
775
|
-
border-color: var(--dl-color-separator) !important;
|
|
776
782
|
}
|
|
777
783
|
}
|
|
778
784
|
|
|
@@ -782,11 +788,11 @@ export default defineComponent({
|
|
|
782
788
|
}
|
|
783
789
|
|
|
784
790
|
&:hover {
|
|
785
|
-
border-color: var(--dl-color-
|
|
791
|
+
border-color: var(--dl-input-border-color-hover);
|
|
786
792
|
}
|
|
787
793
|
|
|
788
794
|
&:focus {
|
|
789
|
-
border-color: var(--dl-color-
|
|
795
|
+
border-color: var(--dl-input-border-color-hover);
|
|
790
796
|
}
|
|
791
797
|
|
|
792
798
|
&:disabled {
|
|
@@ -827,6 +833,7 @@ export default defineComponent({
|
|
|
827
833
|
}
|
|
828
834
|
|
|
829
835
|
&--s {
|
|
836
|
+
margin-top: 1px;
|
|
830
837
|
height: 20px;
|
|
831
838
|
}
|
|
832
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({
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
@change="selectLayout"
|
|
8
8
|
>
|
|
9
9
|
<option
|
|
10
|
-
v-for="(
|
|
11
|
-
:key="
|
|
12
|
-
:value="
|
|
10
|
+
v-for="(layoutItem, layoutIndex) in layouts"
|
|
11
|
+
:key="layoutIndex"
|
|
12
|
+
:value="layoutIndex"
|
|
13
13
|
>
|
|
14
|
-
{{
|
|
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>
|