@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
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
class="dl-smart-search__input-wrapper"
|
|
10
10
|
>
|
|
11
11
|
<dl-smart-search-input
|
|
12
|
+
ref="smartSearchInput"
|
|
12
13
|
:status="computedStatus"
|
|
13
14
|
:style-model="defineStyleModel"
|
|
14
15
|
:with-save-button="true"
|
|
@@ -22,55 +23,124 @@
|
|
|
22
23
|
:default-width="width"
|
|
23
24
|
@save="saveQueryDialogBoxModel = true"
|
|
24
25
|
@focus="setFocused"
|
|
25
|
-
@update:modelValue="
|
|
26
|
+
@update:modelValue="debouncedInputModel"
|
|
26
27
|
@dql-edit="jsonEditorModel = !jsonEditorModel"
|
|
27
28
|
/>
|
|
28
29
|
</div>
|
|
29
30
|
<div class="dl-smart-search__buttons">
|
|
30
|
-
<
|
|
31
|
-
style="
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
31
|
+
<slot name="buttons">
|
|
32
|
+
<div style="display: flex; align-items: center">
|
|
33
|
+
<div
|
|
34
|
+
style="height: 28px"
|
|
35
|
+
class="dl-smart-search__search-btn-wrapper"
|
|
36
|
+
>
|
|
37
|
+
<dl-button
|
|
38
|
+
icon="icon-dl-search"
|
|
39
|
+
:styles="{
|
|
40
|
+
height: '28px'
|
|
41
|
+
}"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
@click="emitSearchQuery"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<slot name="extra-actions" />
|
|
48
|
+
|
|
49
|
+
<dl-button
|
|
50
|
+
class="dl-smart-search__buttons--filters"
|
|
51
|
+
shaded
|
|
52
|
+
outlined
|
|
53
|
+
size="s"
|
|
54
|
+
>
|
|
55
|
+
Saved Filters
|
|
56
|
+
<dl-menu
|
|
57
|
+
v-model="filtersModel"
|
|
58
|
+
:offset="[0, 5]"
|
|
59
|
+
anchor="bottom middle"
|
|
60
|
+
self="top middle"
|
|
61
|
+
>
|
|
62
|
+
<dl-smart-search-filters
|
|
63
|
+
:filters="filters"
|
|
64
|
+
@filters-select="handleFiltersSelect"
|
|
65
|
+
@filters-delete="handleFiltersDelete"
|
|
66
|
+
/>
|
|
67
|
+
</dl-menu>
|
|
68
|
+
</dl-button>
|
|
69
|
+
</div>
|
|
70
|
+
</slot>
|
|
63
71
|
</div>
|
|
64
|
-
<dl-
|
|
65
|
-
|
|
66
|
-
:
|
|
67
|
-
:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
<dl-dialog-box
|
|
73
|
+
v-model="jsonEditorModel"
|
|
74
|
+
:height="500"
|
|
75
|
+
:width="800"
|
|
76
|
+
style="--dl-dialog-box-footer-padding: 10px 16px"
|
|
77
|
+
>
|
|
78
|
+
<template #header>
|
|
79
|
+
<dl-dialog-box-header
|
|
80
|
+
title="DQL Search"
|
|
81
|
+
:close-button="true"
|
|
82
|
+
style="font-weight: 200"
|
|
83
|
+
@onClose="handleJsonEditorClose"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
<template #body>
|
|
87
|
+
<div class="json-editor-layout">
|
|
88
|
+
<div class="json-query">
|
|
89
|
+
<div class="json-query-menu">
|
|
90
|
+
<dl-select
|
|
91
|
+
:model-value="selectedOption"
|
|
92
|
+
width="200px"
|
|
93
|
+
:options="selectOptions"
|
|
94
|
+
placeholder="New Query"
|
|
95
|
+
@update:model-value="updateActiveQuery"
|
|
96
|
+
/>
|
|
97
|
+
<dl-button
|
|
98
|
+
icon="icon-dl-align-left"
|
|
99
|
+
label="Align Left"
|
|
100
|
+
flat
|
|
101
|
+
color="secondary"
|
|
102
|
+
padding="0px 3px"
|
|
103
|
+
@click="alignJsonText"
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
<dl-json-editor
|
|
107
|
+
v-model="jsonEditorQuery"
|
|
108
|
+
:prevent-update="preventUpdate"
|
|
109
|
+
@update-prevent="(val) => (preventUpdate = val)"
|
|
110
|
+
@align-text="alignJsonText"
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
<template #footer>
|
|
116
|
+
<div class="json-editor__footer-menu">
|
|
117
|
+
<div class="json-editor__footer-delete">
|
|
118
|
+
<dl-button
|
|
119
|
+
:disabled="deleteButtonState"
|
|
120
|
+
icon="icon-dl-delete"
|
|
121
|
+
label="Delete Query"
|
|
122
|
+
flat
|
|
123
|
+
color="secondary"
|
|
124
|
+
padding="0"
|
|
125
|
+
@click="handleQueryRemove"
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="json-editor__footer-save">
|
|
129
|
+
<dl-button
|
|
130
|
+
style="margin-right: 14px"
|
|
131
|
+
outlined
|
|
132
|
+
label="Save As"
|
|
133
|
+
@click="saveQueryDialogBoxModel = true"
|
|
134
|
+
/>
|
|
135
|
+
<dl-button
|
|
136
|
+
label="Search"
|
|
137
|
+
@click="handleJsonSearchButton"
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
</dl-dialog-box>
|
|
143
|
+
|
|
74
144
|
<dl-dialog-box v-model="removeQueryDialogBoxModel">
|
|
75
145
|
<template #header>
|
|
76
146
|
<dl-dialog-box-header
|
|
@@ -94,7 +164,10 @@
|
|
|
94
164
|
</div>
|
|
95
165
|
</template>
|
|
96
166
|
</dl-dialog-box>
|
|
97
|
-
<dl-dialog-box
|
|
167
|
+
<dl-dialog-box
|
|
168
|
+
v-model="saveQueryDialogBoxModel"
|
|
169
|
+
style="--dl-dialog-box-footer-padding: 14px 17px"
|
|
170
|
+
>
|
|
98
171
|
<template #header>
|
|
99
172
|
<dl-dialog-box-header
|
|
100
173
|
title="Save Query"
|
|
@@ -104,17 +177,22 @@
|
|
|
104
177
|
<template #body>
|
|
105
178
|
<dl-input
|
|
106
179
|
v-model="newQueryName"
|
|
180
|
+
title="Query name"
|
|
107
181
|
style="text-align: center"
|
|
108
182
|
placeholder="Type query name"
|
|
109
183
|
/>
|
|
110
184
|
</template>
|
|
111
185
|
<template #footer>
|
|
112
186
|
<div class="dl-smart-search__buttons--save">
|
|
113
|
-
<dl-button
|
|
187
|
+
<dl-button
|
|
188
|
+
:disabled="!newQueryName"
|
|
189
|
+
outlined
|
|
190
|
+
@click="handleSaveQuery"
|
|
191
|
+
>
|
|
114
192
|
Save
|
|
115
193
|
</dl-button>
|
|
116
194
|
<dl-button
|
|
117
|
-
|
|
195
|
+
:disabled="!newQueryName"
|
|
118
196
|
@click="handleSaveQuery(true)"
|
|
119
197
|
>
|
|
120
198
|
Save and Search
|
|
@@ -125,28 +203,49 @@
|
|
|
125
203
|
</div>
|
|
126
204
|
</template>
|
|
127
205
|
<script lang="ts">
|
|
128
|
-
import {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
206
|
+
import {
|
|
207
|
+
defineComponent,
|
|
208
|
+
PropType,
|
|
209
|
+
ref,
|
|
210
|
+
nextTick,
|
|
211
|
+
toRef,
|
|
212
|
+
onMounted,
|
|
213
|
+
watch,
|
|
214
|
+
computed
|
|
215
|
+
} from 'vue-demi'
|
|
134
216
|
import { DlTypography, DlMenu } from '../../../essential'
|
|
135
217
|
import { DlButton } from '../../../basic'
|
|
218
|
+
import { DlSelect } from '../../DlSelect'
|
|
219
|
+
import { DlInput } from '../../DlInput'
|
|
220
|
+
import { DlDialogBox, DlDialogBoxHeader } from '../../DlDialogBox'
|
|
221
|
+
import { DlJsonEditor } from '../../DlJsonEditor'
|
|
222
|
+
|
|
223
|
+
import DlSmartSearchInput from './components/DlSmartSearchInput.vue'
|
|
224
|
+
import DlSmartSearchFilters from './components/DlSmartSearchFilters.vue'
|
|
225
|
+
|
|
136
226
|
import {
|
|
137
227
|
useSuggestions,
|
|
138
228
|
Schema,
|
|
139
229
|
Alias,
|
|
140
230
|
removeBrackets
|
|
141
231
|
} from '../../../../hooks/use-suggestions'
|
|
142
|
-
import { Filters, Query, ColorSchema, SearchStatus } from './types'
|
|
143
232
|
import {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
233
|
+
Filters,
|
|
234
|
+
Query,
|
|
235
|
+
ColorSchema,
|
|
236
|
+
SearchStatus,
|
|
237
|
+
SyntaxColorSchema
|
|
238
|
+
} from './types'
|
|
239
|
+
import {
|
|
240
|
+
revertAliases,
|
|
241
|
+
setAliases,
|
|
242
|
+
replaceStringifiedDatesWithJSDates,
|
|
243
|
+
createColorSchema,
|
|
244
|
+
replaceJSDatesWithStringifiedDates
|
|
245
|
+
} from './utils'
|
|
148
246
|
import { v4 } from 'uuid'
|
|
149
247
|
import { parseSmartQuery, stringifySmartQuery } from '../../../../utils'
|
|
248
|
+
import { debounce, isEqual } from 'lodash'
|
|
150
249
|
|
|
151
250
|
export default defineComponent({
|
|
152
251
|
components: {
|
|
@@ -158,16 +257,25 @@ export default defineComponent({
|
|
|
158
257
|
DlTypography,
|
|
159
258
|
DlInput,
|
|
160
259
|
DlSmartSearchFilters,
|
|
161
|
-
DlMenu
|
|
260
|
+
DlMenu,
|
|
261
|
+
DlSelect
|
|
262
|
+
},
|
|
263
|
+
model: {
|
|
264
|
+
prop: 'modelValue',
|
|
265
|
+
event: 'update:modelValue'
|
|
162
266
|
},
|
|
163
267
|
props: {
|
|
268
|
+
modelValue: {
|
|
269
|
+
type: Object as PropType<Record<string, any>>,
|
|
270
|
+
default: () => ({})
|
|
271
|
+
},
|
|
164
272
|
status: {
|
|
165
273
|
type: Object as PropType<SearchStatus>,
|
|
166
274
|
default: () => ({ type: 'info', message: '' })
|
|
167
275
|
},
|
|
168
276
|
schema: {
|
|
169
277
|
type: Object as PropType<Schema>,
|
|
170
|
-
default: () => {}
|
|
278
|
+
default: () => ({})
|
|
171
279
|
},
|
|
172
280
|
aliases: {
|
|
173
281
|
type: Array as PropType<Alias[]>,
|
|
@@ -176,9 +284,9 @@ export default defineComponent({
|
|
|
176
284
|
colorSchema: {
|
|
177
285
|
type: Object as PropType<ColorSchema>,
|
|
178
286
|
default: () => ({
|
|
179
|
-
fields: '
|
|
180
|
-
operators: '
|
|
181
|
-
keywords: '
|
|
287
|
+
fields: 'var(--dl-color-secondary)',
|
|
288
|
+
operators: 'var(--dl-color-positive)',
|
|
289
|
+
keywords: 'var(--dl-color-medium)'
|
|
182
290
|
})
|
|
183
291
|
},
|
|
184
292
|
isLoading: {
|
|
@@ -204,10 +312,17 @@ export default defineComponent({
|
|
|
204
312
|
width: {
|
|
205
313
|
type: String,
|
|
206
314
|
default: '450px'
|
|
315
|
+
},
|
|
316
|
+
/**
|
|
317
|
+
* If true, the validation will be a closed set based on the schema provided
|
|
318
|
+
*/
|
|
319
|
+
strict: {
|
|
320
|
+
type: Boolean,
|
|
321
|
+
default: false
|
|
207
322
|
}
|
|
208
323
|
},
|
|
209
|
-
emits: ['save-query', 'remove-query', 'search-query'],
|
|
210
|
-
setup(props) {
|
|
324
|
+
emits: ['save-query', 'remove-query', 'search-query', 'update:modelValue'],
|
|
325
|
+
setup(props, { emit }) {
|
|
211
326
|
const inputModel = ref('')
|
|
212
327
|
const jsonEditorModel = ref(false)
|
|
213
328
|
const searchBarWidth = ref('100%')
|
|
@@ -224,25 +339,77 @@ export default defineComponent({
|
|
|
224
339
|
const isQuerying = ref(false)
|
|
225
340
|
const currentTab = ref('saved')
|
|
226
341
|
const oldInputQuery = ref('')
|
|
342
|
+
const jsonEditorQuery = ref('{}')
|
|
343
|
+
const newQuery = ref('')
|
|
344
|
+
const preventUpdate = ref(false)
|
|
345
|
+
const selectedOption = ref({
|
|
346
|
+
label: 'New Query',
|
|
347
|
+
value: ''
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
const strictRef = toRef(props, 'strict')
|
|
227
351
|
|
|
228
352
|
const { suggestions, error, findSuggestions } = useSuggestions(
|
|
229
353
|
props.schema,
|
|
230
|
-
props.aliases
|
|
354
|
+
props.aliases,
|
|
355
|
+
{ strict: strictRef }
|
|
231
356
|
)
|
|
232
357
|
|
|
233
358
|
const handleInputModel = (value: string) => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
359
|
+
const aliased = setAliases(value, props.aliases)
|
|
360
|
+
inputModel.value = aliased
|
|
361
|
+
const bracketless = removeBrackets(value)
|
|
362
|
+
const cleanedAliases = revertAliases(bracketless, props.aliases)
|
|
363
|
+
const json = toJSON(cleanedAliases)
|
|
364
|
+
if (!isEqual(json, props.modelValue)) {
|
|
365
|
+
emit('update:modelValue', json)
|
|
366
|
+
}
|
|
367
|
+
const stringified = JSON.stringify(json)
|
|
368
|
+
activeQuery.value.query = stringified
|
|
369
|
+
nextTick(() => {
|
|
370
|
+
findSuggestions(aliased)
|
|
371
|
+
})
|
|
238
372
|
isQuerying.value = false
|
|
239
|
-
oldInputQuery.value =
|
|
373
|
+
oldInputQuery.value = aliased
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const debouncedInputModel = debounce(handleInputModel, 300)
|
|
377
|
+
|
|
378
|
+
const isValidJSON = (item: string | Object): boolean => {
|
|
379
|
+
let value = typeof item !== 'string' ? JSON.stringify(item) : item
|
|
380
|
+
try {
|
|
381
|
+
value = JSON.parse(value)
|
|
382
|
+
} catch (e) {
|
|
383
|
+
return false
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return typeof value === 'object' && value !== null
|
|
240
387
|
}
|
|
241
388
|
|
|
242
389
|
const toJSON = (value: string) => {
|
|
243
|
-
|
|
244
|
-
|
|
390
|
+
const json = parseSmartQuery(
|
|
391
|
+
replaceStringifiedDatesWithJSDates(value) ?? inputModel.value
|
|
245
392
|
)
|
|
393
|
+
|
|
394
|
+
return isValidJSON(json) ? json : inputModel.value
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const schemaRef = toRef(props, 'schema')
|
|
398
|
+
const dateKeys = computed(() => {
|
|
399
|
+
return Object.keys(schemaRef.value).filter(
|
|
400
|
+
(key) => schemaRef.value[key] === 'date'
|
|
401
|
+
)
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
const fromJSON = (value: { [key: string]: any }) => {
|
|
405
|
+
const replacedDate = replaceJSDatesWithStringifiedDates(
|
|
406
|
+
value,
|
|
407
|
+
dateKeys.value
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
const stringQuery = stringifySmartQuery(replacedDate)
|
|
411
|
+
const aliased = setAliases(stringQuery, props.aliases)
|
|
412
|
+
return aliased
|
|
246
413
|
}
|
|
247
414
|
|
|
248
415
|
const setFocused = (value: boolean) => {
|
|
@@ -258,6 +425,38 @@ export default defineComponent({
|
|
|
258
425
|
}
|
|
259
426
|
}
|
|
260
427
|
|
|
428
|
+
const readModelValue = (val: { [key: string]: any }) => {
|
|
429
|
+
if (val) {
|
|
430
|
+
const currModel = JSON.parse(
|
|
431
|
+
activeQuery.value.query && activeQuery.value.query.length
|
|
432
|
+
? activeQuery.value.query
|
|
433
|
+
: '{}'
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
if (isEqual(val, currModel)) {
|
|
437
|
+
return
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const aliased = fromJSON(val)
|
|
441
|
+
|
|
442
|
+
if (aliased !== inputModel.value.trim()) {
|
|
443
|
+
debouncedInputModel(aliased)
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const modelRef = toRef(props, 'modelValue')
|
|
449
|
+
|
|
450
|
+
watch(modelRef, (val: any) => {
|
|
451
|
+
readModelValue(val)
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
onMounted(() => {
|
|
455
|
+
if (props.modelValue) {
|
|
456
|
+
readModelValue(props.modelValue)
|
|
457
|
+
}
|
|
458
|
+
})
|
|
459
|
+
|
|
261
460
|
return {
|
|
262
461
|
uuid: `dl-smart-search-${v4()}`,
|
|
263
462
|
inputModel,
|
|
@@ -274,10 +473,16 @@ export default defineComponent({
|
|
|
274
473
|
currentTab,
|
|
275
474
|
searchBarWidth,
|
|
276
475
|
oldInputQuery,
|
|
476
|
+
jsonEditorQuery,
|
|
477
|
+
newQuery,
|
|
478
|
+
preventUpdate,
|
|
479
|
+
selectedOption,
|
|
277
480
|
handleInputModel,
|
|
481
|
+
debouncedInputModel,
|
|
278
482
|
setFocused,
|
|
279
483
|
findSuggestions,
|
|
280
|
-
toJSON
|
|
484
|
+
toJSON,
|
|
485
|
+
fromJSON
|
|
281
486
|
}
|
|
282
487
|
},
|
|
283
488
|
computed: {
|
|
@@ -289,11 +494,8 @@ export default defineComponent({
|
|
|
289
494
|
'--dl-search-max-width': this.isFocused ? '100%' : this.width
|
|
290
495
|
}
|
|
291
496
|
},
|
|
292
|
-
defineStyleModel():
|
|
293
|
-
return createColorSchema(
|
|
294
|
-
this.colorSchema,
|
|
295
|
-
this.aliases
|
|
296
|
-
) as any as Record<string, string>
|
|
497
|
+
defineStyleModel(): SyntaxColorSchema {
|
|
498
|
+
return createColorSchema(this.colorSchema, this.aliases)
|
|
297
499
|
},
|
|
298
500
|
computedStatus(): SearchStatus {
|
|
299
501
|
if (this.isQuerying) return
|
|
@@ -319,6 +521,49 @@ export default defineComponent({
|
|
|
319
521
|
return this.isQuerying || this.inputModel === ''
|
|
320
522
|
? this.activeQuery.name
|
|
321
523
|
: this.inputModel
|
|
524
|
+
},
|
|
525
|
+
deleteButtonState(): boolean {
|
|
526
|
+
return !this.filters?.saved?.filter(
|
|
527
|
+
(q: Query) => q.name === this.activeQuery?.name
|
|
528
|
+
).length
|
|
529
|
+
},
|
|
530
|
+
selectOptions(): Record<string, string>[] {
|
|
531
|
+
const options: Record<string, string>[] = [
|
|
532
|
+
{
|
|
533
|
+
label: 'New Query',
|
|
534
|
+
value: '{}'
|
|
535
|
+
}
|
|
536
|
+
]
|
|
537
|
+
|
|
538
|
+
const filters = this.filters?.saved ?? []
|
|
539
|
+
for (const filter of filters) {
|
|
540
|
+
options.push({
|
|
541
|
+
label: filter.name,
|
|
542
|
+
value: filter.query
|
|
543
|
+
})
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return options
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
watch: {
|
|
550
|
+
jsonEditorModel() {
|
|
551
|
+
const json = JSON.stringify(
|
|
552
|
+
this.toJSON(removeBrackets(this.inputModel))
|
|
553
|
+
)
|
|
554
|
+
const newQuery = revertAliases(json, this.aliases)
|
|
555
|
+
if (newQuery && newQuery !== '{}') {
|
|
556
|
+
this.jsonEditorQuery = newQuery
|
|
557
|
+
}
|
|
558
|
+
this.alignJsonText()
|
|
559
|
+
},
|
|
560
|
+
jsonEditorQuery(val) {
|
|
561
|
+
if (
|
|
562
|
+
this.activeQuery.name === 'New Query' ||
|
|
563
|
+
this.activeQuery.name === ''
|
|
564
|
+
) {
|
|
565
|
+
this.newQuery = this.fromJSON(JSON.parse(val))
|
|
566
|
+
}
|
|
322
567
|
}
|
|
323
568
|
},
|
|
324
569
|
mounted() {
|
|
@@ -328,35 +573,36 @@ export default defineComponent({
|
|
|
328
573
|
observer.observe(this.$refs.inputWrapper as HTMLElement)
|
|
329
574
|
},
|
|
330
575
|
methods: {
|
|
331
|
-
handleQueryRemove(
|
|
576
|
+
handleQueryRemove() {
|
|
332
577
|
this.filtersModel = false
|
|
333
|
-
this.activeQuery = query
|
|
334
578
|
this.removeQueryDialogBoxModel = true
|
|
335
579
|
},
|
|
336
|
-
handleQuerySearchEditor(query: Query) {
|
|
337
|
-
this.filtersModel = false
|
|
338
|
-
this.activeQuery = query
|
|
339
|
-
this.oldInputQuery = query.query
|
|
340
|
-
this.$emit('search-query', this.activeQuery, this.stringQuery)
|
|
341
|
-
},
|
|
342
580
|
handleSaveQuery(performSearch: boolean) {
|
|
581
|
+
this.activeQuery = {
|
|
582
|
+
name: this.newQueryName || this.activeQuery.name,
|
|
583
|
+
query: this.jsonEditorQuery
|
|
584
|
+
}
|
|
343
585
|
if (performSearch === true) {
|
|
344
586
|
this.emitSaveQuery()
|
|
345
587
|
this.emitSearchQuery()
|
|
588
|
+
const newQuery = setAliases(
|
|
589
|
+
stringifySmartQuery(JSON.parse(this.activeQuery.query)),
|
|
590
|
+
this.aliases
|
|
591
|
+
)
|
|
592
|
+
this.inputModel = newQuery
|
|
593
|
+
this.oldInputQuery = newQuery
|
|
346
594
|
this.jsonEditorModel = false
|
|
347
595
|
} else {
|
|
348
596
|
this.emitSaveQuery()
|
|
349
597
|
}
|
|
350
598
|
},
|
|
351
|
-
|
|
352
|
-
this.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
this.
|
|
356
|
-
this.
|
|
357
|
-
}
|
|
358
|
-
console.log(error)
|
|
359
|
-
}
|
|
599
|
+
handleJsonSearchButton() {
|
|
600
|
+
this.jsonEditorModel = false
|
|
601
|
+
this.activeQuery.query = this.jsonEditorQuery
|
|
602
|
+
nextTick(() => {
|
|
603
|
+
this.setQueryInput()
|
|
604
|
+
this.$emit('search-query', this.activeQuery, this.stringQuery)
|
|
605
|
+
})
|
|
360
606
|
},
|
|
361
607
|
handleFiltersDelete(currentTab: string, query: Query) {
|
|
362
608
|
this.activeQuery = query
|
|
@@ -366,12 +612,19 @@ export default defineComponent({
|
|
|
366
612
|
},
|
|
367
613
|
handleFiltersSelect(currentTab: string, query: Query) {
|
|
368
614
|
this.activeQuery = { ...query }
|
|
369
|
-
const stringQuery =
|
|
615
|
+
const stringQuery = setAliases(
|
|
616
|
+
stringifySmartQuery(JSON.parse(query.query)),
|
|
617
|
+
this.aliases
|
|
618
|
+
)
|
|
370
619
|
this.oldInputQuery = stringQuery
|
|
371
620
|
this.inputModel = stringQuery
|
|
372
621
|
this.currentTab = currentTab
|
|
373
622
|
this.filtersModel = false
|
|
374
623
|
},
|
|
624
|
+
handleJsonEditorClose() {
|
|
625
|
+
this.jsonEditorModel = false
|
|
626
|
+
this.newQuery = ''
|
|
627
|
+
},
|
|
375
628
|
emitSearchQuery() {
|
|
376
629
|
this.$emit('search-query', this.activeQuery, this.stringQuery)
|
|
377
630
|
},
|
|
@@ -383,6 +636,12 @@ export default defineComponent({
|
|
|
383
636
|
this.currentTab,
|
|
384
637
|
this.inputModel
|
|
385
638
|
)
|
|
639
|
+
this.selectedOption = {
|
|
640
|
+
label: 'New Query',
|
|
641
|
+
value: '{}'
|
|
642
|
+
}
|
|
643
|
+
this.activeQuery.query = this.newQuery
|
|
644
|
+
this.jsonEditorQuery = this.newQuery || '{}'
|
|
386
645
|
this.removeQueryDialogBoxModel = false
|
|
387
646
|
},
|
|
388
647
|
emitSaveQuery() {
|
|
@@ -392,6 +651,37 @@ export default defineComponent({
|
|
|
392
651
|
this.$emit('save-query', { ...this.activeQuery }, this.currentTab)
|
|
393
652
|
this.saveQueryDialogBoxModel = false
|
|
394
653
|
this.newQueryName = ''
|
|
654
|
+
},
|
|
655
|
+
setQueryInput(query?: string) {
|
|
656
|
+
const stringQuery = this.fromJSON(
|
|
657
|
+
JSON.parse(query || this.activeQuery.query)
|
|
658
|
+
)
|
|
659
|
+
this.inputModel = stringQuery
|
|
660
|
+
this.oldInputQuery = stringQuery
|
|
661
|
+
},
|
|
662
|
+
updateActiveQuery(option: Record<string, string>) {
|
|
663
|
+
this.preventUpdate = true
|
|
664
|
+
const isNewQuery =
|
|
665
|
+
option.label === 'New Query' || option.label === ''
|
|
666
|
+
this.activeQuery = {
|
|
667
|
+
name: option.label,
|
|
668
|
+
query: isNewQuery ? this.newQuery : this.activeQuery.query
|
|
669
|
+
}
|
|
670
|
+
this.preventUpdate = false
|
|
671
|
+
this.jsonEditorQuery = isNewQuery
|
|
672
|
+
? this.newQuery || '{}'
|
|
673
|
+
: option.value
|
|
674
|
+
this.alignJsonText()
|
|
675
|
+
},
|
|
676
|
+
alignJsonText() {
|
|
677
|
+
try {
|
|
678
|
+
this.preventUpdate = false
|
|
679
|
+
this.jsonEditorQuery = JSON.stringify(
|
|
680
|
+
JSON.parse(this.jsonEditorQuery),
|
|
681
|
+
null,
|
|
682
|
+
2
|
|
683
|
+
)
|
|
684
|
+
} catch (err) {}
|
|
395
685
|
}
|
|
396
686
|
}
|
|
397
687
|
})
|
|
@@ -465,4 +755,30 @@ export default defineComponent({
|
|
|
465
755
|
word-break: break-all;
|
|
466
756
|
}
|
|
467
757
|
}
|
|
758
|
+
.json-editor__footer {
|
|
759
|
+
&-menu {
|
|
760
|
+
width: 100%;
|
|
761
|
+
display: flex;
|
|
762
|
+
justify-content: space-between;
|
|
763
|
+
}
|
|
764
|
+
&-delete {
|
|
765
|
+
align-items: center;
|
|
766
|
+
display: flex;
|
|
767
|
+
& > * {
|
|
768
|
+
margin-bottom: 6px;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
.json-query {
|
|
773
|
+
height: 100%;
|
|
774
|
+
}
|
|
775
|
+
.json-editor-layout {
|
|
776
|
+
height: 90%;
|
|
777
|
+
}
|
|
778
|
+
.json-query-menu {
|
|
779
|
+
display: flex;
|
|
780
|
+
justify-content: space-between;
|
|
781
|
+
align-items: center;
|
|
782
|
+
margin-bottom: 10px;
|
|
783
|
+
}
|
|
468
784
|
</style>
|