@dataloop-ai/components 0.17.68 → 0.17.70
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/DlContainer/DlContainer.vue +70 -0
- package/src/components/basic/DlContainer/index.ts +3 -0
- package/src/components/basic/DlWidget/DlWidget.vue +37 -21
- package/src/components/basic/index.ts +1 -0
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +19 -10
- package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +1 -0
- package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +5 -1
- package/src/components/essential/DlRadio/DlRadio.vue +5 -1
- package/src/components/essential/DlSwitch/DlSwitch.vue +1 -1
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +3 -6
- package/src/demos/DlWidgetDemo.vue +1 -1
- package/src/utils/parse-smart-query.ts +12 -0
package/package.json
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="wrapper"
|
|
4
|
+
class="container-wrapper"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
:id="uuid"
|
|
8
|
+
ref="container"
|
|
9
|
+
:class="containerStyles"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
v-if="hasHeaderSlot"
|
|
13
|
+
class="dl-container__header"
|
|
14
|
+
>
|
|
15
|
+
<slot name="header" />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="dl-container__content">
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
import { v4 } from 'uuid'
|
|
26
|
+
import { defineComponent } from 'vue-demi'
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
name: 'DlContainer',
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
uuid: `dl-container-${v4()}`
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
containerStyles() {
|
|
37
|
+
return 'dl-container'
|
|
38
|
+
},
|
|
39
|
+
hasHeaderSlot(): boolean {
|
|
40
|
+
return this.$slots.header !== undefined
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
.dl-container {
|
|
48
|
+
border: 1px solid var(--dl-color-separator);
|
|
49
|
+
user-select: none;
|
|
50
|
+
height: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
&__header {
|
|
54
|
+
display: flex;
|
|
55
|
+
padding: 10px;
|
|
56
|
+
border-bottom: 1px solid var(--dl-color-separator);
|
|
57
|
+
}
|
|
58
|
+
&__content {
|
|
59
|
+
padding: 10px;
|
|
60
|
+
height: 100%;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.container-wrapper {
|
|
66
|
+
flex-basis: var(--container-flex-basis);
|
|
67
|
+
margin: var(--row-gap) var(--column-gap);
|
|
68
|
+
height: 100%;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -6,24 +6,22 @@
|
|
|
6
6
|
<div
|
|
7
7
|
:id="uuid"
|
|
8
8
|
ref="widget"
|
|
9
|
-
:class="
|
|
9
|
+
:class="widgetClasses"
|
|
10
10
|
@mouseenter="handleVisibleDragIcon(true)"
|
|
11
11
|
@mouseleave="handleVisibleDragIcon(false)"
|
|
12
12
|
>
|
|
13
|
+
<dl-icon
|
|
14
|
+
:style="iconStyles"
|
|
15
|
+
class="dl-widget__drag-icon"
|
|
16
|
+
icon="icon-dl-drag"
|
|
17
|
+
color="dl-color-medium"
|
|
18
|
+
size="15px"
|
|
19
|
+
@mousedown="startDragging"
|
|
20
|
+
/>
|
|
13
21
|
<div class="dl-widget__header">
|
|
14
22
|
<div class="dl-widget__header--titles">
|
|
15
23
|
<slot name="header" />
|
|
16
24
|
</div>
|
|
17
|
-
<dl-icon
|
|
18
|
-
:style="`visibility: ${
|
|
19
|
-
visibleDragIcon && !isDragging ? 'visible' : 'hidden'
|
|
20
|
-
}`"
|
|
21
|
-
class="dl-widget__header--drag-icon"
|
|
22
|
-
icon="icon-dl-drag"
|
|
23
|
-
color="dl-color-medium"
|
|
24
|
-
size="15px"
|
|
25
|
-
@mousedown="startDragging"
|
|
26
|
-
/>
|
|
27
25
|
<slot name="menu" />
|
|
28
26
|
</div>
|
|
29
27
|
|
|
@@ -65,8 +63,19 @@ export default defineComponent({
|
|
|
65
63
|
}
|
|
66
64
|
},
|
|
67
65
|
computed: {
|
|
68
|
-
|
|
66
|
+
widgetClasses() {
|
|
69
67
|
return `${this.isDragging ? 'dl-widget__drag' : 'dl-widget'}`
|
|
68
|
+
},
|
|
69
|
+
iconStyles() {
|
|
70
|
+
return {
|
|
71
|
+
'--dl-widget-drag-icon-left': `${
|
|
72
|
+
(this.$refs.widget as HTMLElement)?.offsetWidth / 2
|
|
73
|
+
}px`,
|
|
74
|
+
visibility:
|
|
75
|
+
this.visibleDragIcon && !this.isDragging
|
|
76
|
+
? 'visible'
|
|
77
|
+
: 'hidden'
|
|
78
|
+
}
|
|
70
79
|
}
|
|
71
80
|
},
|
|
72
81
|
methods: {
|
|
@@ -192,19 +201,14 @@ export default defineComponent({
|
|
|
192
201
|
height: 100%;
|
|
193
202
|
display: flex;
|
|
194
203
|
flex-direction: column;
|
|
204
|
+
position: relative;
|
|
195
205
|
&__header {
|
|
196
206
|
display: flex;
|
|
197
207
|
padding: 10px;
|
|
198
208
|
border-bottom: 1px solid var(--dl-color-separator);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
cursor: grab;
|
|
203
|
-
|
|
204
|
-
&::v-deep .dl-icon {
|
|
205
|
-
transform: rotate(90deg) !important;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
209
|
+
font-size: 20px;
|
|
210
|
+
color: var(--dl-color-darker);
|
|
211
|
+
justify-content: space-between;
|
|
208
212
|
|
|
209
213
|
&--titles {
|
|
210
214
|
width: 50%;
|
|
@@ -229,6 +233,18 @@ export default defineComponent({
|
|
|
229
233
|
color: var(--dl-color-medium);
|
|
230
234
|
}
|
|
231
235
|
|
|
236
|
+
&__drag-icon {
|
|
237
|
+
position: absolute;
|
|
238
|
+
top: 5px;
|
|
239
|
+
left: calc(var(--dl-widget-drag-icon-left) - 5px);
|
|
240
|
+
flex-grow: 1;
|
|
241
|
+
cursor: grab;
|
|
242
|
+
|
|
243
|
+
&::v-deep .dl-icon {
|
|
244
|
+
transform: rotate(90deg) !important;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
232
248
|
&__drag {
|
|
233
249
|
position: relative;
|
|
234
250
|
&::after {
|
|
@@ -61,9 +61,7 @@
|
|
|
61
61
|
class="matrix__cell"
|
|
62
62
|
:style="`background-color: ${getCellBackground(
|
|
63
63
|
cell.value
|
|
64
|
-
)}; color:
|
|
65
|
-
cell.value < 0.5 ? '-darker' : ''
|
|
66
|
-
}-buttons)`"
|
|
64
|
+
)}; color: ${getCellTextColor(cell.value)}`"
|
|
67
65
|
@mouseenter="handleShowTooltip(cell, $event)"
|
|
68
66
|
@mouseleave="handleHideTooltip"
|
|
69
67
|
@mousedown="openLink(cell)"
|
|
@@ -140,14 +138,14 @@
|
|
|
140
138
|
<div
|
|
141
139
|
v-if="tooltipVisible"
|
|
142
140
|
:style="tooltipStyles"
|
|
143
|
-
class="tooltip"
|
|
141
|
+
class="matrix-tooltip"
|
|
144
142
|
>
|
|
145
|
-
<span class="tooltip__x">{{ tooltipState.xLabel }}</span>
|
|
146
|
-
<span class="tooltip__y">{{ tooltipState.yLabel }}</span>
|
|
143
|
+
<span class="matrix-tooltip__x">{{ tooltipState.xLabel }}</span>
|
|
144
|
+
<span class="matrix-tooltip__y">{{ tooltipState.yLabel }}</span>
|
|
147
145
|
<span>
|
|
148
146
|
<span
|
|
149
147
|
v-if="tooltipState.value"
|
|
150
|
-
class="tooltip__color"
|
|
148
|
+
class="matrix-tooltip__color"
|
|
151
149
|
:style="`background-color: ${getCellBackground(
|
|
152
150
|
tooltipState.value
|
|
153
151
|
)}`"
|
|
@@ -238,9 +236,19 @@ export default defineComponent({
|
|
|
238
236
|
const hex = object[props.color]
|
|
239
237
|
return hexToRgbA(hex, value)
|
|
240
238
|
}
|
|
239
|
+
|
|
240
|
+
const getCellTextColor = (value: number) => {
|
|
241
|
+
const isDark =
|
|
242
|
+
document.documentElement.getAttribute('data-theme') ===
|
|
243
|
+
'dark-mode'
|
|
244
|
+
if (isDark) return 'var(--dl-color-text-buttons)'
|
|
245
|
+
return `var(--dl-color-text${value < 0.5 ? '-darker' : ''}-buttons)`
|
|
246
|
+
}
|
|
247
|
+
|
|
241
248
|
return {
|
|
242
249
|
variables,
|
|
243
250
|
getCellBackground,
|
|
251
|
+
getCellTextColor,
|
|
244
252
|
cellWidth,
|
|
245
253
|
tooltipState,
|
|
246
254
|
currentBrushState
|
|
@@ -365,8 +373,8 @@ export default defineComponent({
|
|
|
365
373
|
value: ctx.normalized ? cell.value : cell.unnormalizedValue,
|
|
366
374
|
xLabel: cell.xLabel,
|
|
367
375
|
yLabel: cell.yLabel,
|
|
368
|
-
x: e.
|
|
369
|
-
y: e.
|
|
376
|
+
x: e.x,
|
|
377
|
+
y: e.y,
|
|
370
378
|
visible: true
|
|
371
379
|
}
|
|
372
380
|
},
|
|
@@ -514,7 +522,7 @@ export default defineComponent({
|
|
|
514
522
|
}
|
|
515
523
|
}
|
|
516
524
|
|
|
517
|
-
.tooltip {
|
|
525
|
+
.matrix-tooltip {
|
|
518
526
|
position: absolute;
|
|
519
527
|
border: 1px solid var(--dl-color-separator);
|
|
520
528
|
padding: 8px;
|
|
@@ -522,6 +530,7 @@ export default defineComponent({
|
|
|
522
530
|
display: flex;
|
|
523
531
|
flex-direction: column;
|
|
524
532
|
background-color: var(--dl-color-shadow);
|
|
533
|
+
color: var(--dl-color-tooltip-background);
|
|
525
534
|
border-radius: 3px;
|
|
526
535
|
animation: fadeIn 0.4s;
|
|
527
536
|
|
|
@@ -84,7 +84,11 @@ export default defineComponent({
|
|
|
84
84
|
validator: optionsValidator
|
|
85
85
|
},
|
|
86
86
|
type: { type: String, default: 'radio', validator: typeValidator },
|
|
87
|
-
modelValue: {
|
|
87
|
+
modelValue: {
|
|
88
|
+
type: [Array, String, Number, Boolean],
|
|
89
|
+
required: false,
|
|
90
|
+
default: null
|
|
91
|
+
}
|
|
88
92
|
},
|
|
89
93
|
data() {
|
|
90
94
|
const logger = loggerFactory('DlOptionGroup')
|
|
@@ -77,7 +77,11 @@ export default defineComponent({
|
|
|
77
77
|
id: { type: [String, Number], default: null },
|
|
78
78
|
label: { type: String, default: null },
|
|
79
79
|
padding: { type: String, default: '0' },
|
|
80
|
-
modelValue: {
|
|
80
|
+
modelValue: {
|
|
81
|
+
type: [String, Number, Boolean],
|
|
82
|
+
required: false,
|
|
83
|
+
default: null
|
|
84
|
+
},
|
|
81
85
|
value: { type: [String, Number, Boolean], required: true },
|
|
82
86
|
tabindex: { type: String, default: '0' },
|
|
83
87
|
subLabel: { type: String, default: '' },
|
|
@@ -79,7 +79,7 @@ export default defineComponent({
|
|
|
79
79
|
type: String,
|
|
80
80
|
default: '0'
|
|
81
81
|
},
|
|
82
|
-
modelValue: { type: Any, required:
|
|
82
|
+
modelValue: { type: Any, required: false, default: null },
|
|
83
83
|
labelProps: {
|
|
84
84
|
type: Object as PropType<{ fontSize: number; color: string }>,
|
|
85
85
|
default: () => ({
|
|
@@ -114,12 +114,6 @@ export default defineComponent({
|
|
|
114
114
|
: 0
|
|
115
115
|
})
|
|
116
116
|
|
|
117
|
-
onMounted(() => {
|
|
118
|
-
window.addEventListener('load', setItemSize)
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
onUnmounted(() => window.removeEventListener('load', () => {}))
|
|
122
|
-
|
|
123
117
|
const setItemSize = () => {
|
|
124
118
|
scrollSizeItem.value = props.virtualScrollItemSize
|
|
125
119
|
? props.virtualScrollItemSize
|
|
@@ -260,8 +254,11 @@ export default defineComponent({
|
|
|
260
254
|
|
|
261
255
|
onMounted(() => {
|
|
262
256
|
configureScrollTarget()
|
|
257
|
+
window.addEventListener('load', setItemSize)
|
|
263
258
|
})
|
|
264
259
|
|
|
260
|
+
onUnmounted(() => window.removeEventListener('load', () => {}))
|
|
261
|
+
|
|
265
262
|
onActivated(() => {
|
|
266
263
|
configureScrollTarget()
|
|
267
264
|
})
|
|
@@ -22,6 +22,12 @@ const GeneratePureValue = (value: any) => {
|
|
|
22
22
|
return value
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Method to convert a DlSmartSearch query string to Mongo based JSON query
|
|
27
|
+
*
|
|
28
|
+
* @param { string } query DlSmartSearch query string
|
|
29
|
+
* @returns Mongo based JSON
|
|
30
|
+
*/
|
|
25
31
|
export const parseSmartQuery = (query: string) => {
|
|
26
32
|
const queryArr = query.split(' OR ')
|
|
27
33
|
const orTerms: { [key: string]: any }[] = []
|
|
@@ -93,6 +99,12 @@ export const parseSmartQuery = (query: string) => {
|
|
|
93
99
|
return builtQuery
|
|
94
100
|
}
|
|
95
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Method to convert a Mongo based JSON query to a DlSmartSearch query string
|
|
104
|
+
*
|
|
105
|
+
* @param { { [key: string]: any } } query Mongo based JSON that represents a query
|
|
106
|
+
* @returns DlSmartSearch query string
|
|
107
|
+
*/
|
|
96
108
|
export const stringifySmartQuery = (query: { [key: string]: any }) => {
|
|
97
109
|
let result = ''
|
|
98
110
|
|