@dataloop-ai/components 0.17.134 → 0.18.1
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 +3 -1
- package/src/App.vue +5 -227
- package/src/assets/globals.scss +4 -0
- package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
- package/src/components/basic/DlButton/DlButton.vue +2 -6
- package/src/components/basic/DlChip/DlChip.vue +1 -5
- package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
- package/src/components/basic/DlEmptyState/index.ts +2 -0
- package/src/components/basic/DlEmptyState/types.ts +20 -0
- package/src/components/basic/DlListItem/DlListItem.vue +96 -63
- package/src/components/basic/DlListItem/utils.ts +0 -3
- package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +35 -12
- package/src/components/basic/DlPopup/DlPopup.vue +29 -7
- package/src/components/basic/DlWidget/DlWidget.vue +32 -4
- package/src/components/basic/index.ts +2 -1
- package/src/components/basic/types.ts +2 -0
- package/src/components/compound/DlCard/DlCard.vue +796 -0
- package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
- package/src/components/compound/DlCard/types.ts +38 -0
- package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +35 -3
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +51 -12
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +71 -14
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +28 -4
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +1 -1
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +46 -8
- package/src/components/compound/DlCharts/components/DlBrush.vue +2 -2
- package/src/components/compound/DlCharts/types/props.ts +5 -1
- package/src/components/compound/DlCharts/utils.ts +1 -1
- package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +171 -0
- package/src/components/compound/DlCodeEditor/README.md +11 -0
- package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
- package/src/components/compound/DlCodeEditor/index.ts +3 -0
- package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
- package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
- package/src/components/compound/DlCodeEditor/types.ts +21 -0
- package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
- package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -8
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +26 -2
- package/src/components/compound/DlInput/DlInput.vue +2 -2
- package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
- package/src/components/compound/DlRange/DlRange.vue +2 -2
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +1 -1
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
- package/src/components/compound/DlSelect/DlSelect.vue +78 -70
- package/src/components/compound/DlSlider/components/DlSliderBase.vue +2 -2
- package/src/components/compound/DlSlider/useSlider.ts +2 -2
- package/src/components/compound/DlStepper/DlStepper.vue +33 -3
- package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
- package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +12 -6
- package/src/components/compound/DlTable/DlTable.vue +30 -4
- package/src/components/compound/DlTable/components/DlTd.vue +8 -8
- package/src/components/compound/DlTable/components/DlTh.vue +1 -1
- package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
- package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
- package/src/components/compound/DlTable/hooks/tablePagination.ts +10 -13
- package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
- package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
- package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
- package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
- package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
- package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
- package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
- package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
- package/src/components/compound/DlTreeTable/index.ts +3 -0
- package/src/components/compound/DlTreeTable/types.ts +1 -0
- package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
- package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
- package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
- package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
- package/src/components/compound/index.ts +5 -0
- package/src/components/compound/types.ts +2 -0
- package/src/components/essential/DlBadge/DlBadge.vue +3 -3
- package/src/components/essential/DlCheckbox/DlCheckbox.vue +6 -3
- package/src/components/essential/DlEllipsis/DlEllipsis.vue +18 -14
- package/src/components/essential/DlIcon/DlIcon.vue +1 -1
- package/src/components/essential/DlLabel/DlLabel.vue +174 -0
- package/src/components/essential/DlLabel/index.ts +2 -0
- package/src/components/essential/DlList/DlList.vue +2 -2
- package/src/components/essential/DlMenu/DlMenu.vue +26 -20
- package/src/components/essential/DlMenu/utils.ts +7 -6
- package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
- package/src/components/essential/DlPageLayout/index.ts +2 -0
- package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
- package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
- package/src/components/essential/index.ts +2 -1
- package/src/components/shared/DlTooltip/DlTooltip.vue +9 -10
- package/src/demos/BarChartDemo.vue +47 -2
- package/src/demos/ColumnChartDemo.vue +51 -2
- package/src/demos/DlAccordionDemo.vue +92 -43
- package/src/demos/DlCardDemo.vue +156 -19
- package/src/demos/DlChartDoughnutDemo.vue +49 -2
- package/src/demos/DlCheckboxDemo.vue +13 -0
- package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
- package/src/demos/DlCodeEditor/index.ts +2 -0
- package/src/demos/DlConfusionMatrixDemo.vue +51 -6
- package/src/demos/DlDemoPage.vue +235 -0
- package/src/demos/DlDialogBoxDemo.vue +56 -51
- package/src/demos/DlDropdownButtonDemo.vue +1 -1
- package/src/demos/DlEmptyStateDemo.vue +81 -0
- package/src/demos/DlLabelDemo.vue +128 -0
- package/src/demos/DlLineChartDemo.vue +50 -2
- package/src/demos/DlListDemo.vue +12 -9
- package/src/demos/DlMenuDemo.vue +13 -14
- package/src/demos/DlPageLayoutDemo.vue +146 -0
- package/src/demos/DlPanelContainerDemo.vue +113 -2
- package/src/demos/DlPopupDemo.vue +51 -0
- package/src/demos/DlSelectDemo.vue +14 -5
- package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
- package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
- package/src/demos/DlTableDemo.vue +65 -2
- package/src/demos/DlTabsDemo.vue +1 -1
- package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
- package/src/demos/DlTreeTableDemo.vue +694 -0
- package/src/demos/DlWidgetDemo.vue +48 -3
- package/src/demos/index.ts +17 -4
- package/src/hooks/use-anchor.ts +14 -16
- package/src/hooks/use-model-toggle.ts +12 -14
- package/src/hooks/use-portal.ts +2 -2
- package/src/hooks/use-scroll-target.ts +2 -4
- package/src/hooks/use-size-observer.ts +3 -2
- package/src/hooks/use-transition.ts +10 -4
- package/src/index.ts +22 -1
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
- package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
- package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
- package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
- package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
- package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
- package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
- package/src/layouts/DlStudioLayout/index.ts +2 -0
- package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
- package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
- package/src/simple-code-editor.d.ts +1 -0
- package/src/utils/click-outside.ts +1 -1
- package/src/utils/dom.ts +5 -5
- package/src/utils/events.ts +3 -3
- package/src/utils/global-nodes.ts +2 -2
- package/src/utils/is-ellipsis-active.ts +4 -1
- package/src/utils/portal.ts +5 -5
- package/src/utils/position-engine.ts +5 -5
- package/src/utils/render.ts +1 -1
- package/src/utils/scroll.ts +2 -2
- package/src/utils/selection.ts +3 -3
- package/vite.config.ts +9 -1
- package/src/components/basic/DlCard/DlCard.vue +0 -242
- package/src/components/basic/DlCard/types.ts +0 -20
- package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -93
- package/src/components/essential/DlTextHolder/index.ts +0 -2
- package/src/demos/DlTextHolderDemo.vue +0 -50
- /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
- /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
|
@@ -4,6 +4,7 @@ import { sortDate } from '../../../../utils/sort'
|
|
|
4
4
|
import { isNumber, isDate, isObject } from '../../../../utils/is'
|
|
5
5
|
import { DlTableProps, DlTableColumn, DlTableSortMethod } from '../types'
|
|
6
6
|
import { TablePagination } from './tablePagination'
|
|
7
|
+
import { isUndefined } from 'lodash'
|
|
7
8
|
|
|
8
9
|
export const useTableSortProps = {
|
|
9
10
|
sortMethod: Function,
|
|
@@ -29,52 +30,56 @@ export function useTableSort(
|
|
|
29
30
|
: null
|
|
30
31
|
})
|
|
31
32
|
|
|
32
|
-
const computedSortMethod = computed(() =>
|
|
33
|
-
props.sortMethod
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
33
|
+
const computedSortMethod = computed(() => {
|
|
34
|
+
if (props.sortMethod) {
|
|
35
|
+
return props.sortMethod
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const sortMethod: DlTableSortMethod = (data, sortBy, descending) => {
|
|
39
|
+
const col = colList.value.find((def) => def.name === sortBy)
|
|
40
|
+
if (isUndefined(col) || isUndefined(col.field)) {
|
|
41
|
+
return data
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const dir = descending === true ? -1 : 1
|
|
45
|
+
const val =
|
|
46
|
+
typeof col.field === 'function'
|
|
47
|
+
? (v: string) => (col.field as Function)(v)
|
|
48
|
+
: (v: Record<string, any>) => v[col.field as string]
|
|
49
|
+
|
|
50
|
+
return data.sort((a: any, b: any) => {
|
|
51
|
+
let A = val(a)
|
|
52
|
+
let B = val(b)
|
|
53
|
+
|
|
54
|
+
if (A === null || isUndefined(A)) {
|
|
55
|
+
return -1 * dir
|
|
56
|
+
}
|
|
57
|
+
if (B === null || isUndefined(B)) {
|
|
58
|
+
return 1 * dir
|
|
59
|
+
}
|
|
60
|
+
if (col.sort) {
|
|
61
|
+
return col.sort(A, B, a, b) * dir
|
|
62
|
+
}
|
|
63
|
+
if (isNumber(A) === true && isNumber(B) === true) {
|
|
64
|
+
return (A - B) * dir
|
|
65
|
+
}
|
|
66
|
+
if (isDate(A) === true && isDate(B) === true) {
|
|
67
|
+
return sortDate(A, B) * dir
|
|
68
|
+
}
|
|
69
|
+
if (typeof A === 'boolean' && typeof B === 'boolean') {
|
|
70
|
+
return (Number(A) - Number(B)) * dir
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[A, B] = [A, B].map((s) =>
|
|
74
|
+
(s + '').toLocaleString().toLowerCase()
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return A < B ? -1 * dir : A === B ? 0 : dir
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return sortMethod
|
|
82
|
+
})
|
|
78
83
|
|
|
79
84
|
function sort(col: string | DlTableColumn) {
|
|
80
85
|
let sortOrder: DlTableProps['columnSortOrder'] = props.columnSortOrder
|
|
@@ -87,7 +92,7 @@ export function useTableSort(
|
|
|
87
92
|
col = (col as DlTableColumn).name
|
|
88
93
|
} else {
|
|
89
94
|
const def = colList.value.find((def) => def.name === col)
|
|
90
|
-
if (def
|
|
95
|
+
if (def && def.sortOrder) {
|
|
91
96
|
sortOrder = def.sortOrder
|
|
92
97
|
}
|
|
93
98
|
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="slider-wrapper">
|
|
3
|
+
<div
|
|
4
|
+
:style="imageContainerStyles"
|
|
5
|
+
class="slider"
|
|
6
|
+
>
|
|
7
|
+
<div class="slider__arrow">
|
|
8
|
+
<div
|
|
9
|
+
:class="getChevronClass('left')"
|
|
10
|
+
@mousedown="navigateBackward"
|
|
11
|
+
>
|
|
12
|
+
<dl-icon
|
|
13
|
+
color="--dl-color-darker"
|
|
14
|
+
size="24px"
|
|
15
|
+
icon="icon-dl-left-chevron"
|
|
16
|
+
:inline="false"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
ref="images"
|
|
23
|
+
class="slider__images"
|
|
24
|
+
>
|
|
25
|
+
<div
|
|
26
|
+
v-for="image in currentImages"
|
|
27
|
+
:key="image.src"
|
|
28
|
+
:class="getImageClass(image.src)"
|
|
29
|
+
:style="getImageOutline(image.src)"
|
|
30
|
+
@mousedown="handleThumbnailMousedown(image)"
|
|
31
|
+
>
|
|
32
|
+
<div class="slider__images--status">
|
|
33
|
+
<dl-icon
|
|
34
|
+
v-if="image.status"
|
|
35
|
+
size="16px"
|
|
36
|
+
color="dl-color-darker"
|
|
37
|
+
:icon="getStatusIcon(image.status)"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
<img
|
|
41
|
+
:src="image.src"
|
|
42
|
+
@error="handleImageError"
|
|
43
|
+
>
|
|
44
|
+
<dl-tooltip>{{ image.name }}</dl-tooltip>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="slider__arrow">
|
|
49
|
+
<div
|
|
50
|
+
:class="getChevronClass('right')"
|
|
51
|
+
@mousedown="navigateForward"
|
|
52
|
+
>
|
|
53
|
+
<dl-icon
|
|
54
|
+
size="24px"
|
|
55
|
+
icon="icon-dl-right-chevron"
|
|
56
|
+
:inline="false"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script lang="ts">
|
|
65
|
+
import { defineComponent, PropType } from 'vue-demi'
|
|
66
|
+
import { DlIcon } from '../../essential'
|
|
67
|
+
import { DlTooltip } from '../../shared'
|
|
68
|
+
import { DlThumbnail, statusColors } from './types'
|
|
69
|
+
|
|
70
|
+
export default defineComponent({
|
|
71
|
+
components: {
|
|
72
|
+
DlIcon,
|
|
73
|
+
DlTooltip
|
|
74
|
+
},
|
|
75
|
+
model: {
|
|
76
|
+
prop: 'modelValue',
|
|
77
|
+
event: 'update:modelValue'
|
|
78
|
+
},
|
|
79
|
+
props: {
|
|
80
|
+
/**
|
|
81
|
+
* The currently selected image
|
|
82
|
+
*/
|
|
83
|
+
modelValue: {
|
|
84
|
+
type: Object as PropType<DlThumbnail>,
|
|
85
|
+
default: null
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* The array of image objects to be contained in the gallery
|
|
89
|
+
*/
|
|
90
|
+
images: {
|
|
91
|
+
type: Array as PropType<DlThumbnail[]>,
|
|
92
|
+
default: (): DlThumbnail[] => []
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* The number of thumbnails visible at once
|
|
96
|
+
*/
|
|
97
|
+
visibleThumbnails: {
|
|
98
|
+
type: Number,
|
|
99
|
+
default: 10
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* The source of the image to be displayed when an image is unavailable
|
|
103
|
+
*/
|
|
104
|
+
invalidImage: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: null
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* The aspect ratio of the image inside each thumbnail. Available values: default, full and full-with-padding
|
|
110
|
+
*/
|
|
111
|
+
aspectRatio: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: 'default'
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* The opacity value of the white overlay on the thumbnails
|
|
117
|
+
*/
|
|
118
|
+
overlayOpacity: {
|
|
119
|
+
type: Number,
|
|
120
|
+
default: 0.3
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
emits: ['update:modelValue', 'selected'],
|
|
124
|
+
data() {
|
|
125
|
+
return {
|
|
126
|
+
currentList: { first: 0, last: this.visibleThumbnails }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
computed: {
|
|
130
|
+
imageContainerStyles(): object {
|
|
131
|
+
return {
|
|
132
|
+
'--thumbnail-size': `${100 / this.visibleThumbnails}%`,
|
|
133
|
+
'--img-object-fit':
|
|
134
|
+
this.aspectRatio === 'full' ||
|
|
135
|
+
this.aspectRatio === 'full-with-padding'
|
|
136
|
+
? 'contain'
|
|
137
|
+
: '',
|
|
138
|
+
'--img-padding':
|
|
139
|
+
this.aspectRatio === 'full-with-padding' ? '5px' : '',
|
|
140
|
+
'--images-min-width': `${this.currentImages.length * 70}px`,
|
|
141
|
+
'--overlay-opacity': this.overlayOpacity
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
currentImages(): DlThumbnail[] {
|
|
145
|
+
return this.images.slice(
|
|
146
|
+
this.currentList.first,
|
|
147
|
+
this.currentList.last
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
methods: {
|
|
152
|
+
navigateForward() {
|
|
153
|
+
this.currentList.first += this.visibleThumbnails
|
|
154
|
+
this.currentList.last += this.visibleThumbnails
|
|
155
|
+
},
|
|
156
|
+
navigateBackward() {
|
|
157
|
+
this.currentList.first -= this.visibleThumbnails
|
|
158
|
+
this.currentList.last -= this.visibleThumbnails
|
|
159
|
+
},
|
|
160
|
+
handleImageError(e: ErrorEvent) {
|
|
161
|
+
(e.target as HTMLImageElement).src = this.invalidImage
|
|
162
|
+
},
|
|
163
|
+
getImageOutline(image: string) {
|
|
164
|
+
return {
|
|
165
|
+
outline:
|
|
166
|
+
image === this.modelValue?.src
|
|
167
|
+
? '2px solid var(--dl-color-secondary)'
|
|
168
|
+
: '1px solid var(--dl-color-separator)'
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
getImageClass(image: string) {
|
|
172
|
+
return `slider__images--image ${
|
|
173
|
+
image !== this.modelValue?.src ? 'greyed-out' : ''
|
|
174
|
+
}`
|
|
175
|
+
},
|
|
176
|
+
getStatusIcon(status: string) {
|
|
177
|
+
return statusColors[status as keyof typeof statusColors]
|
|
178
|
+
},
|
|
179
|
+
getChevronClass(side: string) {
|
|
180
|
+
const isVisible =
|
|
181
|
+
side === 'left'
|
|
182
|
+
? this.currentList.first > 0
|
|
183
|
+
: this.currentList.last <= this.images.length
|
|
184
|
+
return isVisible
|
|
185
|
+
? 'slider__arrow--icon'
|
|
186
|
+
: 'slider__arrow--icon--invisible'
|
|
187
|
+
},
|
|
188
|
+
handleThumbnailMousedown(image: string) {
|
|
189
|
+
this.$emit('update:modelValue', image)
|
|
190
|
+
this.$emit('selected', image)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<style lang="scss" scoped>
|
|
197
|
+
.slider-wrapper {
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
justify-content: flex-end;
|
|
201
|
+
width: 100%;
|
|
202
|
+
}
|
|
203
|
+
.slider {
|
|
204
|
+
display: flex;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
width: 100%;
|
|
207
|
+
height: 65px;
|
|
208
|
+
&__arrow {
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
&--icon {
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
background-color: var(--dl-color-text-buttons);
|
|
214
|
+
border-radius: 50%;
|
|
215
|
+
&--invisible {
|
|
216
|
+
visibility: hidden;
|
|
217
|
+
cursor: default;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
&__images {
|
|
222
|
+
display: flex;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
min-width: var(--images-min-width);
|
|
225
|
+
height: 100%;
|
|
226
|
+
padding: 0px 10px;
|
|
227
|
+
&--image {
|
|
228
|
+
position: relative;
|
|
229
|
+
border-radius: 3px;
|
|
230
|
+
margin: 0px 5px;
|
|
231
|
+
width: var(--thumbnail-size);
|
|
232
|
+
max-width: 60px;
|
|
233
|
+
max-height: 60px;
|
|
234
|
+
transition: 0.1s;
|
|
235
|
+
&:hover {
|
|
236
|
+
transform: scale(1.1);
|
|
237
|
+
outline: 1px solid var(--dl-color-hover) !important;
|
|
238
|
+
}
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
background-color: var(--dl-color-text-buttons);
|
|
241
|
+
padding: var(--img-padding);
|
|
242
|
+
}
|
|
243
|
+
&--image img {
|
|
244
|
+
pointer-events: none;
|
|
245
|
+
border-radius: 3px;
|
|
246
|
+
width: 100%;
|
|
247
|
+
height: 100%;
|
|
248
|
+
object-fit: var(--img-object-fit);
|
|
249
|
+
}
|
|
250
|
+
&--status {
|
|
251
|
+
position: absolute;
|
|
252
|
+
top: 0;
|
|
253
|
+
right: 4px;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
.greyed-out::after {
|
|
258
|
+
content: '';
|
|
259
|
+
position: absolute;
|
|
260
|
+
width: 100%;
|
|
261
|
+
height: 100%;
|
|
262
|
+
top: 0;
|
|
263
|
+
left: 0;
|
|
264
|
+
background-color: #ffffff;
|
|
265
|
+
border-radius: 3px;
|
|
266
|
+
opacity: var(--overlay-opacity);
|
|
267
|
+
}
|
|
268
|
+
</style>
|