@dataloop-ai/components 0.19.194 → 0.19.196
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/DlAlert/DlAlert.vue +21 -10
- package/src/components/blocks/DlLabelPicker/DlLabelPicker.vue +57 -8
- package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +1 -1
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +2 -0
- package/src/demos/DlAlertDemo.vue +38 -28
- package/src/demos/DlLabelPickerDemo.vue +6 -1
package/package.json
CHANGED
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
:color="iconColor"
|
|
16
16
|
:size="iconSize"
|
|
17
17
|
/>
|
|
18
|
-
<span
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
><slot v-if="!text" /> <span v-else> {{ text }}</span></span>
|
|
18
|
+
<span class="text" :style="textStyle"
|
|
19
|
+
><slot v-if="!text" /> <span v-else> {{ text }}</span></span
|
|
20
|
+
>
|
|
22
21
|
</div>
|
|
23
22
|
<div
|
|
24
23
|
v-if="closable"
|
|
@@ -118,10 +117,10 @@ export default defineComponent({
|
|
|
118
117
|
emits: ['update:model-value'],
|
|
119
118
|
setup(props, { emit }) {
|
|
120
119
|
const show = ref(props.modelValue)
|
|
121
|
-
const type = props.type as DlAlertType
|
|
122
|
-
const typeIcon = typeToIconMap[type]
|
|
123
|
-
const icon = computed(() => typeToIconMap[type])
|
|
124
|
-
const iconColor = computed(() => typeToIconColorMap[type])
|
|
120
|
+
const type = ref(props.type as DlAlertType)
|
|
121
|
+
const typeIcon = computed(() => typeToIconMap[type.value])
|
|
122
|
+
const icon = computed(() => typeToIconMap[type.value])
|
|
123
|
+
const iconColor = computed(() => typeToIconColorMap[type.value])
|
|
125
124
|
const textStyle = computed(() => ({
|
|
126
125
|
color: getColor(props.textColor, 'dl-color-darker')
|
|
127
126
|
}))
|
|
@@ -143,7 +142,19 @@ export default defineComponent({
|
|
|
143
142
|
)
|
|
144
143
|
|
|
145
144
|
watch(
|
|
146
|
-
|
|
145
|
+
() => props.type,
|
|
146
|
+
(val) => {
|
|
147
|
+
type.value = val as DlAlertType
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
watch(
|
|
152
|
+
[
|
|
153
|
+
() => props.fluid,
|
|
154
|
+
() => props.text,
|
|
155
|
+
() => props.closable,
|
|
156
|
+
() => props.type
|
|
157
|
+
],
|
|
147
158
|
([fluid]) => {
|
|
148
159
|
normalizeStyles(fluid)
|
|
149
160
|
}
|
|
@@ -158,7 +169,7 @@ export default defineComponent({
|
|
|
158
169
|
display: 'flex'
|
|
159
170
|
}
|
|
160
171
|
const rootS: Record<string, any> = {
|
|
161
|
-
backgroundColor: getColor(typeToBackgroundMap[type])
|
|
172
|
+
backgroundColor: getColor(typeToBackgroundMap[type.value])
|
|
162
173
|
}
|
|
163
174
|
if (height > 46) {
|
|
164
175
|
iconS.alignSelf = 'flex-start'
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
:rows="rows"
|
|
30
30
|
row-key="identifier"
|
|
31
31
|
color="dl-color-secondary"
|
|
32
|
+
:empty-state-props="emptyStateProps"
|
|
33
|
+
:hide-bottom="hideBottom"
|
|
34
|
+
:hide-no-data="hideNoData"
|
|
32
35
|
@row-click="handleRowClick"
|
|
33
36
|
>
|
|
34
37
|
<template #body-cell-displayLabel="item">
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
import { ref, PropType, defineComponent, computed, toRefs } from 'vue-demi'
|
|
47
50
|
import { DlLabel, DlIcon } from '../../essential'
|
|
48
51
|
import { DlInput, DlTreeTable } from '../../compound'
|
|
49
|
-
import { DlTableColumn, DlTableRow } from '../../types'
|
|
52
|
+
import { DlEmptyStateProps, DlTableColumn, DlTableRow } from '../../types'
|
|
50
53
|
import { DlLabelPickerItem } from './types'
|
|
51
54
|
|
|
52
55
|
export default defineComponent({
|
|
@@ -61,6 +64,32 @@ export default defineComponent({
|
|
|
61
64
|
items: {
|
|
62
65
|
type: Array as PropType<DlLabelPickerItem[]>,
|
|
63
66
|
default: () => [] as PropType<DlLabelPickerItem[]>
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Props for the empty state component
|
|
70
|
+
*/
|
|
71
|
+
emptyStateProps: {
|
|
72
|
+
type: Object as PropType<DlEmptyStateProps>,
|
|
73
|
+
default: () =>
|
|
74
|
+
({
|
|
75
|
+
title: '',
|
|
76
|
+
subtitle: 'No labels to show yet.',
|
|
77
|
+
icon: ''
|
|
78
|
+
} as unknown as PropType<DlEmptyStateProps>)
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Hides the bottom footer of the DlLabelPicker
|
|
82
|
+
*/
|
|
83
|
+
hideBottom: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Hides the "No data" of the DlLabelPicker
|
|
89
|
+
*/
|
|
90
|
+
hideNoData: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false
|
|
64
93
|
}
|
|
65
94
|
},
|
|
66
95
|
emits: ['selected-label', 'click'],
|
|
@@ -80,7 +109,9 @@ export default defineComponent({
|
|
|
80
109
|
]
|
|
81
110
|
|
|
82
111
|
const inputValue = ref('')
|
|
83
|
-
const currentSelectedLabel = ref<DlLabelPickerItem>(
|
|
112
|
+
const currentSelectedLabel = ref<DlLabelPickerItem>(
|
|
113
|
+
items.value ? items.value[0] : null
|
|
114
|
+
)
|
|
84
115
|
|
|
85
116
|
const handleRowClick = (_: MouseEvent, item: DlLabelPickerItem) => {
|
|
86
117
|
currentSelectedLabel.value = item
|
|
@@ -110,13 +141,31 @@ export default defineComponent({
|
|
|
110
141
|
return { 'border-left': `2px solid ${selectedColor.value}` }
|
|
111
142
|
})
|
|
112
143
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
144
|
+
const mapObjects = (
|
|
145
|
+
item: DlLabelPickerItem,
|
|
146
|
+
callback: (obj: DlLabelPickerItem) => DlLabelPickerItem
|
|
147
|
+
) => {
|
|
148
|
+
const mappedItem: DlLabelPickerItem = callback(item)
|
|
149
|
+
|
|
150
|
+
if (item.children && item.children.length > 0) {
|
|
151
|
+
mappedItem.children = item.children.map((child) =>
|
|
152
|
+
mapObjects(child, callback)
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
return mappedItem
|
|
156
|
+
}
|
|
119
157
|
|
|
158
|
+
const mapItems = ref<DlTableRow[]>(
|
|
159
|
+
items.value?.map((item) =>
|
|
160
|
+
mapObjects(item, (obj: DlLabelPickerItem) => {
|
|
161
|
+
return {
|
|
162
|
+
...obj,
|
|
163
|
+
name: obj.displayLabel
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
const rows = computed(() => mapItems.value)
|
|
120
169
|
return {
|
|
121
170
|
handleRowClick,
|
|
122
171
|
inputValue,
|
|
@@ -844,6 +844,8 @@ export default defineComponent({
|
|
|
844
844
|
'onUpdate:selected': this.updateSelected,
|
|
845
845
|
onColUpdate: this.updateColumns,
|
|
846
846
|
class: this.containerClass,
|
|
847
|
+
hideBottom: this.hideBottom,
|
|
848
|
+
hideNoData: this.hideNoData,
|
|
847
849
|
on: {
|
|
848
850
|
'row-click': this.emitRowClick,
|
|
849
851
|
'row-dblclick': this.emitRowDblclick,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<DlAlert
|
|
4
|
-
type="info"
|
|
5
|
-
:closable="true"
|
|
6
|
-
fluid
|
|
7
|
-
>
|
|
3
|
+
<DlAlert type="info" :closable="true" fluid>
|
|
8
4
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas eos
|
|
9
5
|
amet, nobis unde animi atque itaque? Provident suscipit enim eos
|
|
10
6
|
sequi dolor minima optio tempora error tenetur, autem ratione
|
|
@@ -18,17 +14,10 @@
|
|
|
18
14
|
Pneumonoultramicroscopicsilicovolcanoconiosis/Pneumonoultramicroscopicsilicovolcanoconiosis/Pneumonoultramicroscopicsilicovolcanoconiosis.
|
|
19
15
|
</DlAlert>
|
|
20
16
|
<div style="display: flex; justify-content: space-between">
|
|
21
|
-
<DlAlert
|
|
22
|
-
type="error"
|
|
23
|
-
:closable="true"
|
|
24
|
-
>
|
|
17
|
+
<DlAlert type="error" :closable="true">
|
|
25
18
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
26
19
|
</DlAlert>
|
|
27
|
-
<DlAlert
|
|
28
|
-
type="info"
|
|
29
|
-
text="Alert text"
|
|
30
|
-
fluid
|
|
31
|
-
>
|
|
20
|
+
<DlAlert type="info" text="Alert text" fluid>
|
|
32
21
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
33
22
|
</DlAlert>
|
|
34
23
|
</div>
|
|
@@ -39,11 +28,7 @@
|
|
|
39
28
|
>
|
|
40
29
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
41
30
|
</DlAlert>
|
|
42
|
-
<dl-alert
|
|
43
|
-
style="margin-top: 20px"
|
|
44
|
-
fluid
|
|
45
|
-
type="warning"
|
|
46
|
-
>
|
|
31
|
+
<dl-alert style="margin-top: 20px" fluid type="warning">
|
|
47
32
|
this is an annoying message with link, this is an annoying message
|
|
48
33
|
with linkthis is an annoying message with linkthis is an annoying
|
|
49
34
|
message with linkthis is an annoying message with linkthis is an
|
|
@@ -51,7 +36,8 @@
|
|
|
51
36
|
is an annoying message with link
|
|
52
37
|
<span>
|
|
53
38
|
Please
|
|
54
|
-
<dl-link color="dl-color-link">Contact us</dl-link>.</span
|
|
39
|
+
<dl-link color="dl-color-link">Contact us</dl-link>.</span
|
|
40
|
+
>
|
|
55
41
|
</dl-alert>
|
|
56
42
|
<DlAlert
|
|
57
43
|
type="success"
|
|
@@ -59,11 +45,7 @@
|
|
|
59
45
|
>
|
|
60
46
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
61
47
|
</DlAlert>
|
|
62
|
-
<dl-alert
|
|
63
|
-
style="margin-top: 20px"
|
|
64
|
-
fluid
|
|
65
|
-
type="warning"
|
|
66
|
-
>
|
|
48
|
+
<dl-alert style="margin-top: 20px" fluid type="warning">
|
|
67
49
|
this is an annoying message with link, this is an annoying message
|
|
68
50
|
with linkthis is an annoying message with linkthis is an annoying
|
|
69
51
|
message with linkthis is an annoying message with linkthis is an
|
|
@@ -71,20 +53,48 @@
|
|
|
71
53
|
is an annoying message with link
|
|
72
54
|
<span>
|
|
73
55
|
Please
|
|
74
|
-
<dl-link color="dl-color-link">Contact us</dl-link>.</span
|
|
56
|
+
<dl-link color="dl-color-link">Contact us</dl-link>.</span
|
|
57
|
+
>
|
|
75
58
|
</dl-alert>
|
|
59
|
+
|
|
60
|
+
<div>
|
|
61
|
+
<dl-button label="Toggle" @click="handleAlertToggle" />
|
|
62
|
+
<DlAlert :type="alertType" :closable="true" fluid>
|
|
63
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas
|
|
64
|
+
eos amet, nobis unde animi atque itaque? Provident suscipit enim
|
|
65
|
+
eos sequi dolor minima optio tempora error tenetur, autem
|
|
66
|
+
ratione cumque!
|
|
67
|
+
</DlAlert>
|
|
68
|
+
</div>
|
|
76
69
|
</div>
|
|
77
70
|
</template>
|
|
78
71
|
|
|
79
72
|
<script lang="ts">
|
|
80
|
-
import { DlAlert, DlLink } from '../components'
|
|
73
|
+
import { DlAlert, DlLink, DlButton } from '../components'
|
|
81
74
|
import { defineComponent } from 'vue-demi'
|
|
82
75
|
|
|
76
|
+
const alertTypes = ['info', 'success', 'warning', 'error']
|
|
77
|
+
|
|
83
78
|
export default defineComponent({
|
|
84
79
|
name: 'DlAlertDemo',
|
|
85
80
|
components: {
|
|
86
81
|
DlAlert,
|
|
87
|
-
DlLink
|
|
82
|
+
DlLink,
|
|
83
|
+
DlButton
|
|
84
|
+
},
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
alertType: alertTypes[0]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
methods: {
|
|
91
|
+
handleAlertToggle() {
|
|
92
|
+
const index = alertTypes.indexOf(this.alertType)
|
|
93
|
+
this.alertType =
|
|
94
|
+
index === alertTypes.length - 1
|
|
95
|
+
? alertTypes[0]
|
|
96
|
+
: alertTypes[index + 1]
|
|
97
|
+
}
|
|
88
98
|
},
|
|
89
99
|
template: 'dl-alert-demo'
|
|
90
100
|
})
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
<div>Label picker component</div>
|
|
4
4
|
<DlLabelPicker
|
|
5
5
|
:items="items"
|
|
6
|
+
:empty-state-props="{
|
|
7
|
+
title: '',
|
|
8
|
+
icon: ''
|
|
9
|
+
}"
|
|
10
|
+
hide-bottom
|
|
11
|
+
hide-no-data
|
|
6
12
|
@selected-label="setSelectedEvent"
|
|
7
13
|
/>
|
|
8
14
|
<div>last selected: {{ lastSelected }}</div>
|
|
@@ -13,7 +19,6 @@
|
|
|
13
19
|
import { DlLabelPicker } from '../components'
|
|
14
20
|
import { defineComponent, ref } from 'vue-demi'
|
|
15
21
|
import { DlLabelPickerItem } from '../types'
|
|
16
|
-
|
|
17
22
|
const rows: DlLabelPickerItem[] = [
|
|
18
23
|
{
|
|
19
24
|
identifier: 'a',
|