@dataloop-ai/components 0.17.27 → 0.17.29
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/DlPopup/DlPopup.vue +1 -0
- package/src/components/compound/DlTabs/DlTabs.vue +83 -31
- package/src/components/compound/DlTabs/components/DlTab.vue +1 -0
- package/src/components/compound/DlTabs/components/TabsWrapper.vue +32 -27
- package/src/demos/DlPopupDemo.vue +31 -1
- package/src/demos/DlTabsDemo.vue +89 -2
- package/src/demos/DlTooltipDemo.vue +31 -2
package/package.json
CHANGED
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
:
|
|
6
|
-
:is-at-start="isAtStart"
|
|
7
|
-
:is-vertical="vertical"
|
|
8
|
-
@left-arrow-click="handleLeft"
|
|
9
|
-
@right-arrow-click="handleRight"
|
|
2
|
+
<div
|
|
3
|
+
class="dl-tabs-wrapper"
|
|
4
|
+
:class="{ 'full-width': fullWidth }"
|
|
5
|
+
:style="cssVars"
|
|
10
6
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
:
|
|
15
|
-
|
|
7
|
+
<tabs-wrapper
|
|
8
|
+
:id="uuid"
|
|
9
|
+
:is-scrollable="isOverflowing"
|
|
10
|
+
:is-at-end="isAtEnd"
|
|
11
|
+
:is-at-start="isAtStart"
|
|
12
|
+
class="dl-tabs-root"
|
|
13
|
+
:is-vertical="vertical"
|
|
14
|
+
@left-arrow-click="handleLeft"
|
|
15
|
+
@right-arrow-click="handleRight"
|
|
16
16
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
<div
|
|
18
|
+
ref="dlTabsRef"
|
|
19
|
+
class="dl-tabs-container"
|
|
20
|
+
:class="{ 'full-width': fullWidth }"
|
|
21
|
+
role="tablist"
|
|
22
|
+
>
|
|
23
|
+
<dl-tab
|
|
24
|
+
v-for="(item, index) in items"
|
|
25
|
+
:key="index"
|
|
26
|
+
:name="item.name"
|
|
27
|
+
:vertical="vertical"
|
|
28
|
+
:label="item.label"
|
|
29
|
+
:show-tooltip="item.showTooltip"
|
|
30
|
+
:tooltip="item.tooltip"
|
|
31
|
+
:disabled="disabled || item.disabled"
|
|
32
|
+
:no-caps="item.noCaps"
|
|
33
|
+
:is-active="modelValue === item.name"
|
|
34
|
+
:font-size="fontSize"
|
|
35
|
+
@click="handleTabClick"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</tabs-wrapper>
|
|
39
|
+
<div class="empty-space" />
|
|
40
|
+
<slot
|
|
41
|
+
name="top-right"
|
|
42
|
+
:styles="topRightSlotStyles"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
33
45
|
</template>
|
|
34
46
|
|
|
35
47
|
<script lang="ts">
|
|
@@ -56,7 +68,8 @@ export default defineComponent({
|
|
|
56
68
|
fullWidth: { type: Boolean, default: false },
|
|
57
69
|
disabled: { type: Boolean, default: false },
|
|
58
70
|
modelValue: { type: String, required: true },
|
|
59
|
-
fontSize: { type: String, default: '12px' }
|
|
71
|
+
fontSize: { type: String, default: '12px' },
|
|
72
|
+
gap: { type: String, default: '40px' }
|
|
60
73
|
},
|
|
61
74
|
emits: ['update:model-value'],
|
|
62
75
|
data() {
|
|
@@ -67,10 +80,28 @@ export default defineComponent({
|
|
|
67
80
|
isAtEnd: false,
|
|
68
81
|
children: [] as HTMLElement[],
|
|
69
82
|
invisibleLeftIndex: 0,
|
|
70
|
-
invisibleRightIndex: 0
|
|
83
|
+
invisibleRightIndex: 0,
|
|
84
|
+
topRightSlotWidth: 0
|
|
71
85
|
}
|
|
72
86
|
},
|
|
73
87
|
computed: {
|
|
88
|
+
topRightSlotStyles(): string {
|
|
89
|
+
return `border-bottom: ${
|
|
90
|
+
this.vertical
|
|
91
|
+
? 'inherit'
|
|
92
|
+
: '1px solid var(--dl-color-separator)'
|
|
93
|
+
};
|
|
94
|
+
padding-left: ${this.topRightSlotWidth ? this.gap : '0px'};
|
|
95
|
+
`
|
|
96
|
+
},
|
|
97
|
+
cssVars(): Record<string, string> {
|
|
98
|
+
return {
|
|
99
|
+
'--dl-tabs-top-right-slot-width': this.topRightSlotWidth + 'px',
|
|
100
|
+
'--dl-empty-space-border': this.vertical
|
|
101
|
+
? 'inherit'
|
|
102
|
+
: '1px solid var(--dl-color-separator)'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
74
105
|
// @ts-ignore
|
|
75
106
|
resizeObserver(): ResizeObserver | undefined {
|
|
76
107
|
// @ts-ignore
|
|
@@ -96,6 +127,9 @@ export default defineComponent({
|
|
|
96
127
|
const element = this.$refs.dlTabsRef as HTMLElement
|
|
97
128
|
this.resizeObserver?.observe(element)
|
|
98
129
|
element?.addEventListener('scroll', this.updatePosition)
|
|
130
|
+
this.topRightSlotWidth =
|
|
131
|
+
(this.$refs.dlTabsRef as HTMLElement)?.parentNode?.parentNode
|
|
132
|
+
?.children?.[2]?.clientWidth || 0
|
|
99
133
|
},
|
|
100
134
|
unmounted() {
|
|
101
135
|
this.unsubscribeListeners()
|
|
@@ -172,6 +206,24 @@ export default defineComponent({
|
|
|
172
206
|
</script>
|
|
173
207
|
|
|
174
208
|
<style scoped lang="scss">
|
|
209
|
+
.dl-tabs-wrapper {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-wrap: nowrap;
|
|
212
|
+
justify-content: space-between;
|
|
213
|
+
max-width: 100%;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.dl-tabs-root {
|
|
217
|
+
max-width: calc(100% - var(--dl-tabs-top-right-slot-width));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.empty-space {
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-grow: 1;
|
|
223
|
+
border-bottom: var(--dl-empty-space-border);
|
|
224
|
+
max-height: calc(100% - 1px);
|
|
225
|
+
}
|
|
226
|
+
|
|
175
227
|
.dl-tabs-container {
|
|
176
228
|
position: relative;
|
|
177
229
|
text-align: center;
|
|
@@ -123,6 +123,7 @@ export default defineComponent({
|
|
|
123
123
|
padding: 5px 10px;
|
|
124
124
|
font-size: var(--dl-tab-font-size);
|
|
125
125
|
line-height: 14px;
|
|
126
|
+
border-color: var(--dl-color-separator) !important;
|
|
126
127
|
&:not(:last-child) {
|
|
127
128
|
border-right: 1px solid var(--dl-color-separator);
|
|
128
129
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="['tabs-wrapper', { scrollable: isScrollable }]"
|
|
4
|
-
:style="cssVars"
|
|
5
|
-
>
|
|
2
|
+
<div :class="['tabs-wrapper', { scrollable: isScrollable }]">
|
|
6
3
|
<dl-button
|
|
7
4
|
v-if="isScrollable"
|
|
8
|
-
size="
|
|
5
|
+
:size="buttonSize"
|
|
9
6
|
flat
|
|
7
|
+
padding="0"
|
|
10
8
|
:disabled="isAtStart"
|
|
11
9
|
data-qa="left-arrow-button"
|
|
12
10
|
class="arrow-button"
|
|
@@ -21,12 +19,13 @@
|
|
|
21
19
|
<slot class="tabs" />
|
|
22
20
|
<dl-button
|
|
23
21
|
v-if="isScrollable"
|
|
24
|
-
size="
|
|
22
|
+
:size="buttonSize"
|
|
25
23
|
data-qa="right-arrow-button"
|
|
26
24
|
text-color="dl-color-darker"
|
|
27
25
|
flat
|
|
26
|
+
padding="0"
|
|
28
27
|
:disabled="isAtEnd"
|
|
29
|
-
class="
|
|
28
|
+
:class="rightArrowClass"
|
|
30
29
|
@click="handleRightArrowClick"
|
|
31
30
|
>
|
|
32
31
|
<dl-icon
|
|
@@ -54,10 +53,17 @@ export default defineComponent({
|
|
|
54
53
|
},
|
|
55
54
|
emits: ['left-arrow-click', 'right-arrow-click'],
|
|
56
55
|
computed: {
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
buttonSize(): string {
|
|
57
|
+
return this.isVertical ? 's' : 'm'
|
|
58
|
+
},
|
|
59
|
+
hasTopRightSlot(): boolean {
|
|
60
|
+
return !!this.$parent.$slots['top-right']
|
|
61
|
+
},
|
|
62
|
+
rightArrowClass(): string {
|
|
63
|
+
if (this.hasTopRightSlot && !this.isVertical) {
|
|
64
|
+
return 'arrow-button--right'
|
|
65
|
+
}
|
|
66
|
+
return 'arrow-button'
|
|
61
67
|
}
|
|
62
68
|
},
|
|
63
69
|
methods: {
|
|
@@ -81,24 +87,23 @@ export default defineComponent({
|
|
|
81
87
|
align-items: center;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
padding: 0px;
|
|
90
|
-
|
|
91
|
-
&:disabled {
|
|
92
|
-
pointer-events: none;
|
|
90
|
+
.arrow-button {
|
|
91
|
+
&--right {
|
|
92
|
+
border-bottom: 1px solid var(--dl-color-separator);
|
|
93
|
+
height: calc(100% - 1px);
|
|
94
|
+
display: flex;
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
.tabs {
|
|
99
|
+
flex-grow: 1;
|
|
100
|
+
::v-deep .dl-button-content {
|
|
101
|
+
padding-top: 1px;
|
|
102
|
+
min-height: var(--dl-tabs-arrows-size);
|
|
103
|
+
width: var(--dl-tabs-arrows-size);
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
}
|
|
103
108
|
}
|
|
104
109
|
</style>
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
</template>
|
|
23
23
|
</dl-popup>
|
|
24
24
|
</dl-button>
|
|
25
|
-
<div />
|
|
26
25
|
<dl-button label="Open Popup persistent">
|
|
27
26
|
<dl-popup
|
|
28
27
|
title="Edit Item Description"
|
|
@@ -54,6 +53,37 @@
|
|
|
54
53
|
</template>
|
|
55
54
|
</dl-popup>
|
|
56
55
|
</dl-button>
|
|
56
|
+
<dl-button label="Open Popup with max height 50px">
|
|
57
|
+
<dl-popup
|
|
58
|
+
title="Edit Item Description"
|
|
59
|
+
additional-info="Some additional information"
|
|
60
|
+
subtitle="Some text for better explanation."
|
|
61
|
+
with-close-button
|
|
62
|
+
max-height="50px"
|
|
63
|
+
>
|
|
64
|
+
<dl-text-area
|
|
65
|
+
v-model="text"
|
|
66
|
+
:max-length="100"
|
|
67
|
+
show-counter
|
|
68
|
+
placeholder="Type your text"
|
|
69
|
+
width="203px"
|
|
70
|
+
/>
|
|
71
|
+
<template #close-button>
|
|
72
|
+
<dl-button
|
|
73
|
+
flat
|
|
74
|
+
style="padding-bottom: 0; padding-top: 0"
|
|
75
|
+
label="clear"
|
|
76
|
+
size="m"
|
|
77
|
+
@click="handleClear"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
<template #footer>
|
|
81
|
+
<dl-button fluid>
|
|
82
|
+
Save
|
|
83
|
+
</dl-button>
|
|
84
|
+
</template>
|
|
85
|
+
</dl-popup>
|
|
86
|
+
</dl-button>
|
|
57
87
|
</div>
|
|
58
88
|
</template>
|
|
59
89
|
<script lang="ts">
|
package/src/demos/DlTabsDemo.vue
CHANGED
|
@@ -16,18 +16,105 @@
|
|
|
16
16
|
<h1>{{ item.label }}</h1>
|
|
17
17
|
</dl-tab-panel>
|
|
18
18
|
</dl-tab-panels>
|
|
19
|
+
|
|
20
|
+
<dl-tabs
|
|
21
|
+
v-model="selectedTab"
|
|
22
|
+
:items="tabItems"
|
|
23
|
+
full-width
|
|
24
|
+
vertical
|
|
25
|
+
style="margin-top: 100px"
|
|
26
|
+
@update:model-value="handleModelValueUpdate"
|
|
27
|
+
>
|
|
28
|
+
<template #top-right="props">
|
|
29
|
+
<div
|
|
30
|
+
:style="props.styles"
|
|
31
|
+
style="
|
|
32
|
+
width: 200px;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: flex-end;
|
|
36
|
+
"
|
|
37
|
+
>
|
|
38
|
+
<dl-button
|
|
39
|
+
flat
|
|
40
|
+
size="s"
|
|
41
|
+
icon="icon-dl-refresh"
|
|
42
|
+
label="Refresh"
|
|
43
|
+
/>
|
|
44
|
+
<dl-button
|
|
45
|
+
size="s"
|
|
46
|
+
icon="icon-dl-pause"
|
|
47
|
+
label="Pause"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
</dl-tabs>
|
|
52
|
+
<div style="height: 4px" />
|
|
53
|
+
<dl-tab-panels v-model="selectedTab">
|
|
54
|
+
<dl-tab-panel
|
|
55
|
+
v-for="item in tabItems"
|
|
56
|
+
:key="item.name"
|
|
57
|
+
class="tabpanel"
|
|
58
|
+
:name="item.name"
|
|
59
|
+
>
|
|
60
|
+
<h1>{{ item.label }}</h1>
|
|
61
|
+
</dl-tab-panel>
|
|
62
|
+
</dl-tab-panels>
|
|
63
|
+
|
|
64
|
+
<dl-tabs
|
|
65
|
+
v-model="selectedTab"
|
|
66
|
+
:items="tabItems"
|
|
67
|
+
style="margin-top: 100px; max-width: 60%"
|
|
68
|
+
@update:model-value="handleModelValueUpdate"
|
|
69
|
+
>
|
|
70
|
+
<template #top-right="props">
|
|
71
|
+
<div
|
|
72
|
+
:style="props.styles"
|
|
73
|
+
style="
|
|
74
|
+
width: 200px;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: flex-end;
|
|
78
|
+
"
|
|
79
|
+
>
|
|
80
|
+
<dl-button
|
|
81
|
+
flat
|
|
82
|
+
size="s"
|
|
83
|
+
icon="icon-dl-refresh"
|
|
84
|
+
label="Refresh"
|
|
85
|
+
/>
|
|
86
|
+
<dl-button
|
|
87
|
+
size="s"
|
|
88
|
+
icon="icon-dl-pause"
|
|
89
|
+
label="Pause"
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
</dl-tabs>
|
|
94
|
+
<div style="height: 4px" />
|
|
95
|
+
<dl-tab-panels v-model="selectedTab">
|
|
96
|
+
<dl-tab-panel
|
|
97
|
+
v-for="item in tabItems"
|
|
98
|
+
:key="item.name"
|
|
99
|
+
class="tabpanel"
|
|
100
|
+
:name="item.name"
|
|
101
|
+
>
|
|
102
|
+
<h1>{{ item.label }}</h1>
|
|
103
|
+
</dl-tab-panel>
|
|
104
|
+
</dl-tab-panels>
|
|
19
105
|
</div>
|
|
20
106
|
</template>
|
|
21
107
|
<script lang="ts">
|
|
22
108
|
import { defineComponent } from 'vue-demi'
|
|
23
|
-
import { DlTabs, DlTabPanel, DlTabPanels } from '../components'
|
|
109
|
+
import { DlTabs, DlTabPanel, DlTabPanels, DlButton } from '../components'
|
|
24
110
|
import { DlTabDetails } from '../components/types'
|
|
25
111
|
|
|
26
112
|
export default defineComponent({
|
|
27
113
|
components: {
|
|
28
114
|
DlTabs,
|
|
29
115
|
DlTabPanel,
|
|
30
|
-
DlTabPanels
|
|
116
|
+
DlTabPanels,
|
|
117
|
+
DlButton
|
|
31
118
|
},
|
|
32
119
|
data() {
|
|
33
120
|
return {
|
|
@@ -54,11 +54,39 @@
|
|
|
54
54
|
/>
|
|
55
55
|
</dl-tooltip>
|
|
56
56
|
</div>
|
|
57
|
+
<div>
|
|
58
|
+
Tooltip with chip
|
|
59
|
+
<dl-tooltip style="padding: 0; border-radius: 2px">
|
|
60
|
+
<DlChip
|
|
61
|
+
label="Long Chip Label With Alot Of Text"
|
|
62
|
+
max-width="75px"
|
|
63
|
+
/>
|
|
64
|
+
</dl-tooltip>
|
|
65
|
+
</div>
|
|
66
|
+
<div>
|
|
67
|
+
Tooltip with chip and flex
|
|
68
|
+
<dl-tooltip>
|
|
69
|
+
<div style="display: flex; flex-flow: row wrap; gap: 3px">
|
|
70
|
+
<DlChip
|
|
71
|
+
label="Long Chip Label With Alot Of Text"
|
|
72
|
+
max-width="75px"
|
|
73
|
+
/>
|
|
74
|
+
<DlChip
|
|
75
|
+
label="Long Chip Label With Alot Of Text"
|
|
76
|
+
max-width="75px"
|
|
77
|
+
/>
|
|
78
|
+
<DlChip
|
|
79
|
+
label="Long Chip Label With Alot Of Text"
|
|
80
|
+
max-width="75px"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</dl-tooltip>
|
|
84
|
+
</div>
|
|
57
85
|
</div>
|
|
58
86
|
</template>
|
|
59
87
|
|
|
60
88
|
<script lang="ts">
|
|
61
|
-
import { DlTooltip, DlLink, DlCard } from '../components'
|
|
89
|
+
import { DlTooltip, DlLink, DlCard, DlChip } from '../components'
|
|
62
90
|
import { defineComponent } from 'vue-demi'
|
|
63
91
|
|
|
64
92
|
export default defineComponent({
|
|
@@ -66,7 +94,8 @@ export default defineComponent({
|
|
|
66
94
|
components: {
|
|
67
95
|
DlCard,
|
|
68
96
|
DlTooltip,
|
|
69
|
-
DlLink
|
|
97
|
+
DlLink,
|
|
98
|
+
DlChip
|
|
70
99
|
},
|
|
71
100
|
data() {
|
|
72
101
|
return {
|