@dataloop-ai/components 0.18.0 → 0.18.2
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 +6 -3
- package/src/App.vue +5 -227
- package/src/assets/constants.scss +2 -1
- package/src/assets/globals.scss +21 -0
- package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
- package/src/components/basic/DlAccordion/components/AccordionHeader.vue +2 -1
- package/src/components/basic/DlAvatar/DlAvatar.vue +1 -1
- package/src/components/basic/DlButton/DlButton.vue +115 -25
- package/src/components/basic/DlButton/utils.ts +45 -2
- package/src/components/basic/DlChip/DlChip.vue +3 -7
- package/src/components/basic/DlChip/utils.ts +4 -4
- package/src/components/basic/DlContainer/DlContainer.vue +70 -0
- package/src/components/basic/DlContainer/index.ts +3 -0
- 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/DlGrid/DlGrid.vue +163 -0
- package/src/components/basic/DlGrid/index.ts +4 -0
- package/src/components/basic/DlGrid/types.ts +5 -0
- package/src/components/basic/DlKpi/components/KpiInfo.vue +2 -1
- package/src/components/basic/DlListItem/DlListItem.vue +96 -66
- package/src/components/basic/DlListItem/utils.ts +0 -3
- package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +37 -13
- package/src/components/basic/DlPopup/DlPopup.vue +58 -11
- package/src/components/basic/DlPopup/components/PopupHeader.vue +11 -6
- package/src/components/basic/DlProgressChart/DlProgressChart.vue +2 -1
- package/src/components/basic/DlWidget/DlWidget.vue +273 -141
- package/src/components/basic/DlWidget/index.ts +1 -3
- package/src/components/basic/DlWidget/utils.ts +90 -8
- package/src/components/basic/index.ts +4 -2
- 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 +39 -4
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +128 -36
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +167 -87
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +2 -1
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +44 -3
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChartWidget.vue +1 -2
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +9 -18
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +48 -9
- package/src/components/compound/DlCharts/charts/DlScatterChart/DlScatterChart.vue +667 -0
- package/src/components/compound/DlCharts/charts/DlScatterChart/index.ts +2 -0
- package/src/components/compound/DlCharts/charts/index.ts +1 -0
- package/src/components/compound/DlCharts/components/DlBrush.vue +3 -2
- package/src/components/compound/DlCharts/components/DlChartLabels.vue +2 -1
- package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +1 -0
- 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 +173 -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/DlDatePicker/DlDatePicker.vue +9 -1
- package/src/components/compound/DlDateTime/DlDatePicker/components/DlCalendar.vue +4 -2
- package/src/components/compound/DlDateTime/DlDatePicker/components/DlMonthCalendar.vue +2 -1
- package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
- package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +18 -9
- package/src/components/compound/DlDateTime/DlTimePicker/DlTimePicker.vue +2 -2
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +74 -15
- package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -1
- package/src/components/compound/DlDialogBox/components/DlDialogBoxHeader.vue +9 -7
- package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +13 -4
- package/src/components/compound/DlInput/DlInput.vue +80 -17
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +42 -219
- package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +16 -17
- package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
- package/src/components/compound/DlPagination/DlPagination.vue +1 -1
- package/src/components/compound/DlPagination/components/PaginationLegend.vue +0 -2
- package/src/components/compound/DlPagination/components/RowsSelector.vue +0 -2
- package/src/components/compound/DlRange/DlRange.vue +3 -2
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +12 -5
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +413 -97
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchFilters.vue +4 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +100 -39
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +12 -7
- package/src/components/compound/DlSearches/DlSmartSearch/components/FiltersQuery.vue +5 -6
- package/src/components/compound/DlSearches/DlSmartSearch/types.ts +14 -0
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
- package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +172 -48
- package/src/components/compound/DlSelect/DlSelect.vue +264 -130
- package/src/components/compound/DlSelect/utils.ts +4 -1
- package/src/components/compound/DlSlider/DlSlider.vue +10 -2
- package/src/components/compound/DlSlider/components/DlSliderBase.vue +3 -3
- package/src/components/compound/DlSlider/components/DlSliderInput.vue +17 -26
- package/src/components/compound/DlSlider/sliderStyles.scss +5 -1
- package/src/components/compound/DlSlider/useSlider.ts +2 -2
- package/src/components/compound/DlSlider/utils.ts +2 -2
- package/src/components/compound/DlStepper/DlStepper.vue +46 -4
- package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
- package/src/components/compound/DlStepper/components/DlStepperFooter.vue +12 -0
- package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +24 -11
- package/src/components/compound/DlStepper/models/Step.ts +37 -8
- package/src/components/compound/DlStepper/models/Stepper.ts +108 -15
- package/src/components/compound/DlStepper/models/interfaces.ts +2 -1
- package/src/components/compound/DlTable/DlTable.vue +49 -14
- package/src/components/compound/DlTable/components/DlTd.vue +9 -9
- package/src/components/compound/DlTable/components/DlTh.vue +3 -2
- 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 +18 -18
- 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/DlTable/styles/dl-table-styles.scss +8 -0
- package/src/components/compound/DlTabs/DlTabs.vue +83 -31
- package/src/components/compound/DlTabs/components/DlTab.vue +14 -4
- package/src/components/compound/DlTabs/components/TabsWrapper.vue +32 -27
- 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/DlToast/api/useToast.ts +42 -1
- package/src/components/compound/DlToast/components/ToastComponent.vue +24 -32
- package/src/components/compound/DlToast/types.ts +52 -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 +14 -1
- package/src/components/compound/types.ts +2 -0
- package/src/components/essential/DlBadge/DlBadge.vue +3 -3
- package/src/components/essential/DlCheckbox/DlCheckbox.vue +10 -7
- package/src/components/essential/DlEllipsis/DlEllipsis.vue +141 -0
- package/src/components/essential/DlIcon/DlIcon.vue +5 -5
- package/src/components/essential/DlLabel/DlLabel.vue +190 -0
- package/src/components/essential/DlLabel/index.ts +2 -0
- package/src/components/essential/DlList/DlList.vue +3 -3
- package/src/components/essential/DlMenu/DlMenu.vue +41 -22
- package/src/components/essential/DlMenu/utils.ts +8 -7
- package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
- package/src/components/essential/DlPageLayout/index.ts +2 -0
- package/src/components/essential/DlProgressBar/DlProgressBar.vue +1 -1
- package/src/components/essential/DlRadio/DlRadio.vue +10 -5
- package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
- package/src/components/essential/DlSpinner/index.ts +1 -13
- package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +7 -0
- package/src/components/essential/DlSwitch/DlSwitch.vue +6 -3
- package/src/components/essential/DlTextArea/DlTextArea.vue +212 -7
- package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
- package/src/components/essential/DlTypography/DlTypography.vue +7 -1
- package/src/components/essential/index.ts +3 -2
- package/src/components/shared/DlInfoErrorMessage/DlInfoErrorMessage.vue +1 -1
- package/src/components/{essential → shared}/DlTooltip/DlTooltip.vue +26 -19
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +106 -43
- package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +28 -4
- package/src/components/shared/index.ts +1 -0
- package/src/components/types.ts +2 -0
- package/src/demos/BarChartDemo.vue +59 -2
- package/src/demos/ColumnChartDemo.vue +67 -2
- package/src/demos/DlAccordionDemo.vue +92 -43
- package/src/demos/DlAlertDemo.vue +14 -0
- package/src/demos/DlButtonDemo.vue +41 -4
- package/src/demos/DlCardDemo.vue +156 -19
- package/src/demos/DlChartDoughnutDemo.vue +49 -2
- package/src/demos/DlCheckboxDemo.vue +28 -3
- package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
- package/src/demos/DlCodeEditor/index.ts +2 -0
- package/src/demos/DlConfusionMatrixDemo.vue +93 -37
- package/src/demos/DlDemoPage.vue +235 -0
- package/src/demos/DlDialogBoxDemo.vue +56 -51
- package/src/demos/DlDropdownButtonDemo.vue +35 -27
- package/src/demos/DlEmptyStateDemo.vue +81 -0
- package/src/demos/DlGridDemo.vue +40 -0
- package/src/demos/DlInputDemo.vue +21 -1
- package/src/demos/DlJsonEditorDemo.vue +59 -0
- package/src/demos/DlLabelDemo.vue +208 -0
- package/src/demos/DlLineChartDemo.vue +50 -2
- package/src/demos/DlListDemo.vue +12 -9
- package/src/demos/DlMenuDemo.vue +147 -20
- package/src/demos/DlPageLayoutDemo.vue +146 -0
- package/src/demos/DlPanelContainerDemo.vue +113 -2
- package/src/demos/DlPopupDemo.vue +82 -1
- package/src/demos/DlRadioDemo.vue +16 -1
- package/src/demos/DlScatterChartDemo.vue +161 -0
- package/src/demos/DlSearchDemo.vue +9 -0
- package/src/demos/DlSelectDemo.vue +124 -27
- package/src/demos/DlSpinnerDemo.vue +0 -2
- package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
- package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
- package/src/demos/DlStepperDemo/SimpleStepper.vue +4 -0
- package/src/demos/DlStepperDemo/steps/GeneralStep.vue +1 -0
- package/src/demos/DlSwitchDemo.vue +12 -0
- package/src/demos/DlTableDemo.vue +84 -5
- package/src/demos/DlTabsDemo.vue +92 -3
- package/src/demos/DlTextAreaDemo.vue +14 -17
- package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
- package/src/demos/DlToastDemo.vue +3 -9
- package/src/demos/DlTooltipDemo.vue +66 -2
- package/src/demos/DlTreeTableDemo.vue +694 -0
- package/src/demos/DlVirtualScrollDemo.vue +3 -12
- package/src/demos/DlWidgetDemo.vue +252 -61
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +151 -32
- package/src/demos/index.ts +23 -4
- package/src/hooks/use-anchor.ts +15 -17
- package/src/hooks/use-arrow-navigation.ts +64 -21
- package/src/hooks/use-model-toggle.ts +14 -16
- package/src/hooks/use-portal.ts +9 -3
- package/src/hooks/use-scroll-target.ts +2 -4
- package/src/hooks/use-size-observer.ts +3 -2
- package/src/hooks/use-suggestions.ts +239 -49
- 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/input-sizes.ts +5 -2
- package/src/utils/is-ellipsis-active.ts +4 -1
- package/src/utils/parse-smart-query.ts +209 -111
- package/src/utils/portal.ts +5 -5
- package/src/utils/position-engine.ts +7 -7
- 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 -241
- package/src/components/basic/DlCard/types.ts +0 -20
- package/src/components/basic/DlEllipsis/DlEllipsis.vue +0 -114
- package/src/components/basic/DlWidget/DlGrid.vue +0 -33
- package/src/components/basic/DlWidget/DlGridRow.vue +0 -32
- package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +0 -124
- package/src/components/compound/DlToast/utils/config.ts +0 -17
- package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -65
- package/src/components/essential/DlTextHolder/index.ts +0 -2
- package/src/demos/DlTextHolderDemo.vue +0 -42
- package/src/utils/swapNodes.ts +0 -30
- /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
- /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
- /package/src/components/{basic → essential}/DlEllipsis/index.ts +0 -0
- /package/src/components/{essential → shared}/DlTooltip/index.ts +0 -0
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
ref,
|
|
12
12
|
watch,
|
|
13
13
|
isVue2,
|
|
14
|
-
h
|
|
14
|
+
h,
|
|
15
|
+
onUnmounted
|
|
15
16
|
} from 'vue-demi'
|
|
16
17
|
import getTableMiddle from '../../compound/DlTable/utils/getTableMiddle'
|
|
17
18
|
import { listenOpts, mergeSlot } from '../../../utils'
|
|
@@ -43,31 +44,40 @@ export default defineComponent({
|
|
|
43
44
|
|
|
44
45
|
virtualScrollSliceRatioBefore: {
|
|
45
46
|
type: [Number, String],
|
|
47
|
+
required: false,
|
|
46
48
|
default: 1
|
|
47
49
|
},
|
|
48
50
|
|
|
49
51
|
virtualScrollSliceRatioAfter: {
|
|
50
52
|
type: [Number, String],
|
|
53
|
+
required: false,
|
|
51
54
|
default: 1
|
|
52
55
|
},
|
|
53
56
|
|
|
54
57
|
virtualScrollItemSize: {
|
|
55
|
-
type:
|
|
58
|
+
type: Number,
|
|
59
|
+
required: false,
|
|
56
60
|
default: 0
|
|
57
61
|
},
|
|
58
62
|
|
|
59
63
|
virtualScrollStickySizeStart: {
|
|
60
64
|
type: [Number, String],
|
|
65
|
+
required: false,
|
|
61
66
|
default: 0
|
|
62
67
|
},
|
|
63
68
|
|
|
64
69
|
virtualScrollStickySizeEnd: {
|
|
65
70
|
type: [Number, String],
|
|
71
|
+
required: false,
|
|
66
72
|
default: 0
|
|
67
73
|
},
|
|
68
|
-
tableColspan: [Number, String],
|
|
69
|
-
virtualScrollHorizontal:
|
|
70
|
-
|
|
74
|
+
tableColspan: { type: [Number, String], required: false, default: 100 },
|
|
75
|
+
virtualScrollHorizontal: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
required: false,
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
onVirtualScroll: { type: Function, default: null },
|
|
71
81
|
items: {
|
|
72
82
|
type: Array,
|
|
73
83
|
default: () => [] as Record<string, any>[]
|
|
@@ -80,26 +90,56 @@ export default defineComponent({
|
|
|
80
90
|
typeOptions.includes(v)
|
|
81
91
|
},
|
|
82
92
|
|
|
83
|
-
itemsFn: { type: Function, default:
|
|
93
|
+
itemsFn: { type: Function, default: null },
|
|
84
94
|
itemsSize: { type: Number, default: 0 },
|
|
85
95
|
|
|
86
96
|
scrollTarget: {
|
|
87
|
-
|
|
97
|
+
type: [String, Object],
|
|
98
|
+
default: null
|
|
99
|
+
},
|
|
100
|
+
scrollDebounce: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 100
|
|
88
103
|
}
|
|
89
104
|
},
|
|
90
105
|
emits: ['virtual-scroll'],
|
|
91
106
|
setup(props, { slots, attrs }) {
|
|
92
107
|
let localScrollTarget: HTMLElement | undefined
|
|
93
108
|
const rootRef: Ref<HTMLElement | null> = ref(null)
|
|
109
|
+
const scrollSizeItem: Ref<number> = ref(40)
|
|
110
|
+
|
|
111
|
+
const isDefined = (v: any) => v !== undefined && v !== null
|
|
94
112
|
|
|
95
113
|
const virtualScrollLength = computed(() => {
|
|
96
|
-
return props.itemsSize >= 0 && props.itemsFn
|
|
114
|
+
return props.itemsSize >= 0 && isDefined(props.itemsFn)
|
|
97
115
|
? parseInt(props.itemsSize as unknown as string, 10)
|
|
98
116
|
: Array.isArray(props.items)
|
|
99
117
|
? props.items.length
|
|
100
118
|
: 0
|
|
101
119
|
})
|
|
102
120
|
|
|
121
|
+
const setItemSize = () => {
|
|
122
|
+
scrollSizeItem.value = props.virtualScrollItemSize
|
|
123
|
+
? props.virtualScrollItemSize
|
|
124
|
+
: typeof rootRef.value?.getElementsByClassName === 'function'
|
|
125
|
+
? rootRef.value?.getElementsByClassName(
|
|
126
|
+
'dl-virtual-scroll__content'
|
|
127
|
+
)[0]?.children[0]?.clientHeight ?? 40
|
|
128
|
+
: 40
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
watch(
|
|
132
|
+
props,
|
|
133
|
+
() => {
|
|
134
|
+
setItemSize()
|
|
135
|
+
},
|
|
136
|
+
{ deep: true }
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
const virtualScrollItemSizeComputed = computed(() => {
|
|
140
|
+
return scrollSizeItem.value
|
|
141
|
+
})
|
|
142
|
+
|
|
103
143
|
const {
|
|
104
144
|
virtualScrollSliceRange,
|
|
105
145
|
localResetVirtualScroll,
|
|
@@ -108,7 +148,9 @@ export default defineComponent({
|
|
|
108
148
|
} = useVirtualScroll({
|
|
109
149
|
virtualScrollLength,
|
|
110
150
|
getVirtualScrollTarget,
|
|
111
|
-
getVirtualScrollEl
|
|
151
|
+
getVirtualScrollEl,
|
|
152
|
+
virtualScrollItemSizeComputed,
|
|
153
|
+
debounceValue: props.scrollDebounce
|
|
112
154
|
})
|
|
113
155
|
|
|
114
156
|
const virtualScrollScope = computed(() => {
|
|
@@ -121,20 +163,21 @@ export default defineComponent({
|
|
|
121
163
|
item
|
|
122
164
|
})
|
|
123
165
|
|
|
124
|
-
|
|
125
|
-
|
|
166
|
+
const itemsFn = props.itemsFn as Function
|
|
167
|
+
const items = props.items as Record<string, any>[]
|
|
168
|
+
|
|
169
|
+
return isDefined(itemsFn)
|
|
170
|
+
? itemsFn(
|
|
171
|
+
virtualScrollSliceRange.value.from,
|
|
172
|
+
virtualScrollSliceRange.value.to -
|
|
173
|
+
virtualScrollSliceRange.value.from
|
|
174
|
+
).map(mapFn)
|
|
175
|
+
: items
|
|
126
176
|
.slice(
|
|
127
177
|
virtualScrollSliceRange.value.from,
|
|
128
178
|
virtualScrollSliceRange.value.to
|
|
129
179
|
)
|
|
130
180
|
.map(mapFn)
|
|
131
|
-
: props
|
|
132
|
-
.itemsFn(
|
|
133
|
-
virtualScrollSliceRange.value.from,
|
|
134
|
-
virtualScrollSliceRange.value.to -
|
|
135
|
-
virtualScrollSliceRange.value.from
|
|
136
|
-
)
|
|
137
|
-
.map(mapFn)
|
|
138
181
|
})
|
|
139
182
|
|
|
140
183
|
const classes = computed(
|
|
@@ -143,11 +186,11 @@ export default defineComponent({
|
|
|
143
186
|
(props.virtualScrollHorizontal === true
|
|
144
187
|
? '--horizontal'
|
|
145
188
|
: '--vertical') +
|
|
146
|
-
(props.scrollTarget
|
|
189
|
+
(isDefined(props.scrollTarget) ? '' : ' scroll')
|
|
147
190
|
)
|
|
148
191
|
|
|
149
192
|
const attributes = computed(() =>
|
|
150
|
-
props.scrollTarget
|
|
193
|
+
isDefined(props.scrollTarget) ? {} : { tabindex: 0 }
|
|
151
194
|
)
|
|
152
195
|
|
|
153
196
|
watch(virtualScrollLength, () => {
|
|
@@ -173,7 +216,7 @@ export default defineComponent({
|
|
|
173
216
|
function configureScrollTarget() {
|
|
174
217
|
localScrollTarget = getScrollTarget(
|
|
175
218
|
getVirtualScrollEl(),
|
|
176
|
-
props.scrollTarget
|
|
219
|
+
props.scrollTarget as any
|
|
177
220
|
)
|
|
178
221
|
|
|
179
222
|
localScrollTarget!.addEventListener(
|
|
@@ -184,13 +227,13 @@ export default defineComponent({
|
|
|
184
227
|
}
|
|
185
228
|
|
|
186
229
|
function unconfigureScrollTarget() {
|
|
187
|
-
if (localScrollTarget
|
|
230
|
+
if (isDefined(localScrollTarget)) {
|
|
188
231
|
localScrollTarget.removeEventListener(
|
|
189
232
|
'scroll',
|
|
190
233
|
onVirtualScrollEvt,
|
|
191
234
|
listenOpts.passive
|
|
192
235
|
)
|
|
193
|
-
localScrollTarget =
|
|
236
|
+
localScrollTarget = null
|
|
194
237
|
}
|
|
195
238
|
}
|
|
196
239
|
|
|
@@ -203,7 +246,7 @@ export default defineComponent({
|
|
|
203
246
|
create
|
|
204
247
|
)
|
|
205
248
|
|
|
206
|
-
if (slots.before
|
|
249
|
+
if (isDefined(slots.before)) {
|
|
207
250
|
child = slots.before().concat(child)
|
|
208
251
|
}
|
|
209
252
|
|
|
@@ -216,8 +259,11 @@ export default defineComponent({
|
|
|
216
259
|
|
|
217
260
|
onMounted(() => {
|
|
218
261
|
configureScrollTarget()
|
|
262
|
+
window.addEventListener('load', setItemSize)
|
|
219
263
|
})
|
|
220
264
|
|
|
265
|
+
onUnmounted(() => window.removeEventListener('load', () => {}))
|
|
266
|
+
|
|
221
267
|
onActivated(() => {
|
|
222
268
|
configureScrollTarget()
|
|
223
269
|
})
|
|
@@ -245,6 +291,12 @@ export default defineComponent({
|
|
|
245
291
|
}
|
|
246
292
|
},
|
|
247
293
|
render(createElement: Function) {
|
|
294
|
+
/**
|
|
295
|
+
* Had to do some general Typescript hackery here to get this to work in webpack based builder project.
|
|
296
|
+
* The original code is written in Vue 2, but this project is using Vue 3.
|
|
297
|
+
* Some of the types are not compatible, so I had to cast some of the types to any.
|
|
298
|
+
*/
|
|
299
|
+
|
|
248
300
|
const renderFn = isVue2 ? createElement : h
|
|
249
301
|
const renderSlot = (fn: Function) => (isVue2 ? fn() : () => fn())
|
|
250
302
|
|
|
@@ -255,25 +307,36 @@ export default defineComponent({
|
|
|
255
307
|
return
|
|
256
308
|
}
|
|
257
309
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
310
|
+
const isDlTable = (this.$props as any).type === '__dltable'
|
|
311
|
+
const getVirtualChildren = (this as any).getVirtualChildren as Function
|
|
312
|
+
|
|
313
|
+
if (isDlTable) {
|
|
314
|
+
return getTableMiddle(
|
|
315
|
+
{
|
|
316
|
+
ref: 'rootRef',
|
|
317
|
+
class: 'dl-table__middle ' + this.classes
|
|
318
|
+
},
|
|
319
|
+
getVirtualChildren(renderFn),
|
|
320
|
+
renderFn
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const attrs = this.attrs as Record<string, any>
|
|
325
|
+
const attributes = this.attributes as Record<string, any>
|
|
326
|
+
const classes = this.classes as string // todo: does this have to be casted to an object?
|
|
327
|
+
const attributeClasses = attrs.class as Record<string, any>
|
|
328
|
+
const tag = this.tag as string
|
|
329
|
+
|
|
330
|
+
return renderFn(
|
|
331
|
+
tag,
|
|
332
|
+
{
|
|
333
|
+
...attrs,
|
|
334
|
+
ref: 'rootRef',
|
|
335
|
+
class: [attributeClasses, classes],
|
|
336
|
+
...attributes
|
|
337
|
+
},
|
|
338
|
+
renderSlot(() => getVirtualChildren(renderFn))
|
|
339
|
+
)
|
|
277
340
|
}
|
|
278
341
|
})
|
|
279
342
|
</script>
|
|
@@ -279,17 +279,34 @@ export function useVirtualScroll({
|
|
|
279
279
|
virtualScrollLength,
|
|
280
280
|
getVirtualScrollTarget,
|
|
281
281
|
getVirtualScrollEl,
|
|
282
|
-
virtualScrollItemSizeComputed // optional
|
|
282
|
+
virtualScrollItemSizeComputed, // optional
|
|
283
|
+
debounceValue
|
|
283
284
|
}: {
|
|
284
285
|
virtualScrollLength: ComputedRef<number>
|
|
285
286
|
getVirtualScrollTarget: () => HTMLElement | undefined
|
|
286
287
|
getVirtualScrollEl: () => HTMLElement
|
|
287
288
|
virtualScrollItemSizeComputed?: ComputedRef<number>
|
|
289
|
+
debounceValue?: number
|
|
288
290
|
}) {
|
|
289
291
|
const vm = getCurrentInstance()
|
|
290
292
|
|
|
291
293
|
const { props, emit, proxy } = vm
|
|
292
294
|
|
|
295
|
+
let scrollAnimationFrameId: number | null = null
|
|
296
|
+
let changedRangeAnimationFrameId: number | null = null
|
|
297
|
+
|
|
298
|
+
onBeforeUnmount(() => {
|
|
299
|
+
resetAnimationFrame(scrollAnimationFrameId)
|
|
300
|
+
resetAnimationFrame(changedRangeAnimationFrameId)
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
const resetAnimationFrame = (frameId: number | null) => {
|
|
304
|
+
if (frameId) {
|
|
305
|
+
cancelAnimationFrame(frameId)
|
|
306
|
+
}
|
|
307
|
+
frameId = null
|
|
308
|
+
}
|
|
309
|
+
|
|
293
310
|
let prevScrollStart: number | undefined
|
|
294
311
|
let prevToIndex: number
|
|
295
312
|
let localScrollViewSize: number | undefined
|
|
@@ -571,7 +588,9 @@ export function useVirtualScroll({
|
|
|
571
588
|
virtualScrollLength.value
|
|
572
589
|
)
|
|
573
590
|
|
|
574
|
-
|
|
591
|
+
resetAnimationFrame(changedRangeAnimationFrameId)
|
|
592
|
+
|
|
593
|
+
changedRangeAnimationFrameId = requestAnimationFrame(() => {
|
|
575
594
|
if (
|
|
576
595
|
virtualScrollSliceRange.value.to !== to &&
|
|
577
596
|
prevScrollStart === scrollDetails.scrollStart
|
|
@@ -590,7 +609,9 @@ export function useVirtualScroll({
|
|
|
590
609
|
})
|
|
591
610
|
}
|
|
592
611
|
|
|
593
|
-
|
|
612
|
+
resetAnimationFrame(scrollAnimationFrameId)
|
|
613
|
+
|
|
614
|
+
scrollAnimationFrameId = requestAnimationFrame(() => {
|
|
594
615
|
// if the scroll was changed give up
|
|
595
616
|
// (another call to setVirtualScrollSliceRange before animation frame)
|
|
596
617
|
if (prevScrollStart !== scrollDetails.scrollStart) {
|
|
@@ -916,7 +937,10 @@ export function useVirtualScroll({
|
|
|
916
937
|
}
|
|
917
938
|
|
|
918
939
|
setVirtualScrollSize()
|
|
919
|
-
const onVirtualScrollEvt = debounce(
|
|
940
|
+
const onVirtualScrollEvt = debounce(
|
|
941
|
+
localOnVirtualScrollEvt,
|
|
942
|
+
debounceValue ?? 100
|
|
943
|
+
)
|
|
920
944
|
|
|
921
945
|
onBeforeMount(() => {
|
|
922
946
|
setVirtualScrollSize()
|
package/src/components/types.ts
CHANGED
|
@@ -14,12 +14,57 @@
|
|
|
14
14
|
:options="options"
|
|
15
15
|
:items-in-view="6"
|
|
16
16
|
/>
|
|
17
|
+
|
|
18
|
+
<dl-bar-chart
|
|
19
|
+
:legend-props="legendProps"
|
|
20
|
+
:data="data"
|
|
21
|
+
:options="options"
|
|
22
|
+
:items-in-view="6"
|
|
23
|
+
is-empty
|
|
24
|
+
:empty-state-props="{
|
|
25
|
+
responsive: true,
|
|
26
|
+
style: 'min-height: 350px;',
|
|
27
|
+
bgSize: '130px',
|
|
28
|
+
bgImage: `url(https://raw.githubusercontent.com/dataloop-ai/icons/main/assets/usage.svg)`,
|
|
29
|
+
title: 'Lorem ipsum',
|
|
30
|
+
subtitle:
|
|
31
|
+
'Lorem ipsum dolor sit amet consectetur. Senectus condimentum dolor sit',
|
|
32
|
+
info: 'To learn more about this analytics, read our documentation.'
|
|
33
|
+
}"
|
|
34
|
+
>
|
|
35
|
+
<template #links="">
|
|
36
|
+
<div style="display: flex; gap: 5px; padding: 0 20px">
|
|
37
|
+
<dl-button
|
|
38
|
+
padding="0px"
|
|
39
|
+
icon="icon-dl-sdk-documentation"
|
|
40
|
+
flat
|
|
41
|
+
uppercase
|
|
42
|
+
label="SDK"
|
|
43
|
+
/>
|
|
44
|
+
<div class="break" />
|
|
45
|
+
<dl-button
|
|
46
|
+
padding="0px"
|
|
47
|
+
icon="icon-dl-file"
|
|
48
|
+
flat
|
|
49
|
+
label="Documentation"
|
|
50
|
+
/>
|
|
51
|
+
<div class="break" />
|
|
52
|
+
<dl-button
|
|
53
|
+
padding="0px"
|
|
54
|
+
icon="icon-dl-youtube"
|
|
55
|
+
flat
|
|
56
|
+
label="Video"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
</dl-bar-chart>
|
|
17
61
|
</div>
|
|
18
62
|
</template>
|
|
19
63
|
|
|
20
64
|
<script lang="ts">
|
|
21
65
|
import { defineComponent } from 'vue-demi'
|
|
22
|
-
import {
|
|
66
|
+
import { ChartOptions } from 'chart.js'
|
|
67
|
+
import { DlBarChart, DlButton } from '../components'
|
|
23
68
|
|
|
24
69
|
const labelsFn = () => {
|
|
25
70
|
const a = []
|
|
@@ -59,14 +104,26 @@ const legendProps = {
|
|
|
59
104
|
alignItems: 'center'
|
|
60
105
|
}
|
|
61
106
|
|
|
107
|
+
const options: ChartOptions = {
|
|
108
|
+
scales: {
|
|
109
|
+
y: {
|
|
110
|
+
afterFit: (scaleInstance) => {
|
|
111
|
+
scaleInstance.width = 50
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
62
117
|
export default defineComponent({
|
|
63
118
|
name: 'DlChartDemo',
|
|
64
119
|
components: {
|
|
65
|
-
DlBarChart
|
|
120
|
+
DlBarChart,
|
|
121
|
+
DlButton
|
|
66
122
|
},
|
|
67
123
|
data() {
|
|
68
124
|
return {
|
|
69
125
|
data,
|
|
126
|
+
options,
|
|
70
127
|
legendProps
|
|
71
128
|
}
|
|
72
129
|
},
|
|
@@ -38,6 +38,21 @@
|
|
|
38
38
|
<dl-avatar size="24px">
|
|
39
39
|
<img :src="url">
|
|
40
40
|
</dl-avatar>
|
|
41
|
+
<dl-tooltip>
|
|
42
|
+
<div
|
|
43
|
+
style="
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: center;
|
|
47
|
+
padding: 10px;
|
|
48
|
+
"
|
|
49
|
+
>
|
|
50
|
+
<dl-avatar size="24px">
|
|
51
|
+
<img :src="url">
|
|
52
|
+
</dl-avatar>
|
|
53
|
+
<p>rotem.shaham@dataloop.com</p>
|
|
54
|
+
</div>
|
|
55
|
+
</dl-tooltip>
|
|
41
56
|
<div />
|
|
42
57
|
</div>
|
|
43
58
|
</div>
|
|
@@ -51,12 +66,60 @@
|
|
|
51
66
|
:options="options[0]"
|
|
52
67
|
style="width: 100%"
|
|
53
68
|
/>
|
|
69
|
+
|
|
70
|
+
<dl-column-chart
|
|
71
|
+
:brush-props="brushProps"
|
|
72
|
+
:display-brush="false"
|
|
73
|
+
:display-labels="false"
|
|
74
|
+
:display-legend="false"
|
|
75
|
+
:legend-props="legendProps"
|
|
76
|
+
:data="data[0]"
|
|
77
|
+
:options="options[0]"
|
|
78
|
+
style="width: 50%"
|
|
79
|
+
is-empty
|
|
80
|
+
:empty-state-props="{
|
|
81
|
+
responsive: true,
|
|
82
|
+
style: 'min-height: 350px;',
|
|
83
|
+
bgSize: '130px',
|
|
84
|
+
bgImage: `url(https://raw.githubusercontent.com/dataloop-ai/icons/main/assets/usage.svg)`,
|
|
85
|
+
title: 'Lorem ipsum',
|
|
86
|
+
subtitle:
|
|
87
|
+
'Lorem ipsum dolor sit amet consectetur. Senectus condimentum dolor sit',
|
|
88
|
+
info: 'To learn more about this analytics, read our documentation.'
|
|
89
|
+
}"
|
|
90
|
+
>
|
|
91
|
+
<template #links="">
|
|
92
|
+
<div style="display: flex; gap: 5px; padding: 0 20px">
|
|
93
|
+
<dl-button
|
|
94
|
+
padding="0px"
|
|
95
|
+
icon="icon-dl-sdk-documentation"
|
|
96
|
+
flat
|
|
97
|
+
uppercase
|
|
98
|
+
label="SDK"
|
|
99
|
+
/>
|
|
100
|
+
<div class="break" />
|
|
101
|
+
<dl-button
|
|
102
|
+
padding="0px"
|
|
103
|
+
icon="icon-dl-file"
|
|
104
|
+
flat
|
|
105
|
+
label="Documentation"
|
|
106
|
+
/>
|
|
107
|
+
<div class="break" />
|
|
108
|
+
<dl-button
|
|
109
|
+
padding="0px"
|
|
110
|
+
icon="icon-dl-youtube"
|
|
111
|
+
flat
|
|
112
|
+
label="Video"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
</dl-column-chart>
|
|
54
117
|
</div>
|
|
55
118
|
</template>
|
|
56
119
|
|
|
57
120
|
<script lang="ts">
|
|
58
121
|
import { defineComponent } from 'vue-demi'
|
|
59
|
-
import { DlAvatar, DlColumnChart } from '../components'
|
|
122
|
+
import { DlAvatar, DlColumnChart, DlTooltip, DlButton } from '../components'
|
|
60
123
|
|
|
61
124
|
import { orderBy } from 'lodash'
|
|
62
125
|
|
|
@@ -213,7 +276,9 @@ export default defineComponent({
|
|
|
213
276
|
name: 'DlColumnChartDemo',
|
|
214
277
|
components: {
|
|
215
278
|
DlColumnChart,
|
|
216
|
-
DlAvatar
|
|
279
|
+
DlAvatar,
|
|
280
|
+
DlTooltip,
|
|
281
|
+
DlButton
|
|
217
282
|
},
|
|
218
283
|
data() {
|
|
219
284
|
return {
|