@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
|
@@ -1,58 +1,144 @@
|
|
|
1
1
|
/* eslint-disable no-empty */
|
|
2
2
|
|
|
3
|
-
import { isFinite, isObject, isString } from 'lodash'
|
|
3
|
+
import { isBoolean, isFinite, isNumber, isObject, isString } from 'lodash'
|
|
4
4
|
|
|
5
|
+
export function isDatePattern(str: string) {
|
|
6
|
+
const datePattern = new RegExp(
|
|
7
|
+
/([\(']?\d{2}\/\d{2}\/\d{4}[\)']?\s?|\s?\(dd\/mm\/yyyy\)\s?)/,
|
|
8
|
+
'gi'
|
|
9
|
+
)
|
|
10
|
+
const dates = str.match(datePattern) ?? []
|
|
11
|
+
return dates.length > 0
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const GeneratePureValue = (value: any) => {
|
|
15
|
+
if (value === '') {
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (typeof value === 'string') {
|
|
20
|
+
if (value === 'true') {
|
|
21
|
+
return true
|
|
22
|
+
}
|
|
23
|
+
if (value === 'false') {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const num = Number(value)
|
|
29
|
+
if (isFinite(num)) {
|
|
30
|
+
return num
|
|
31
|
+
}
|
|
32
|
+
return value.replaceAll('"', '').replaceAll("'", '')
|
|
33
|
+
} catch (e) {}
|
|
34
|
+
}
|
|
35
|
+
return value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Operators: string[] = ['>=', '<=', '!=', '=', '>', '<', 'IN', 'NOT-IN']
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Method to convert a DlSmartSearch query string to Mongo based JSON query
|
|
42
|
+
*
|
|
43
|
+
* @param { string } query DlSmartSearch query string
|
|
44
|
+
* @returns Mongo based JSON
|
|
45
|
+
*/
|
|
5
46
|
export const parseSmartQuery = (query: string) => {
|
|
6
47
|
const queryArr = query.split(' OR ')
|
|
48
|
+
for (let i = 0; i < queryArr.length; i++) {
|
|
49
|
+
const term: string = queryArr[i]
|
|
50
|
+
let withOperator = false
|
|
51
|
+
if (Operators.includes(term.split(' ')[1])) {
|
|
52
|
+
withOperator = true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!withOperator) {
|
|
56
|
+
if (i > 0) {
|
|
57
|
+
queryArr[i - 1] += ` OR ${term}`
|
|
58
|
+
queryArr.splice(i, 1)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
7
62
|
const orTerms: { [key: string]: any }[] = []
|
|
8
63
|
|
|
9
64
|
for (const query of queryArr) {
|
|
10
65
|
const andTerms = query.split(' AND ')
|
|
66
|
+
for (let i = 0; i < andTerms.length; i++) {
|
|
67
|
+
const term: string = andTerms[i]
|
|
68
|
+
let withOperator = false
|
|
69
|
+
for (const op of Operators) {
|
|
70
|
+
if (term.includes(op)) {
|
|
71
|
+
withOperator = true
|
|
72
|
+
break
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!withOperator) {
|
|
77
|
+
if (i > 0) {
|
|
78
|
+
andTerms[i - 1] += ` AND ${term}`
|
|
79
|
+
andTerms.splice(i, 1)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
11
83
|
|
|
12
84
|
const andQuery: { [key: string]: any } = {}
|
|
13
85
|
let queryValue: any
|
|
14
86
|
|
|
15
87
|
let key: string
|
|
16
88
|
let value: string | number | object
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
} catch (e) {}
|
|
26
|
-
return value.replaceAll('"', '').replaceAll("'", '')
|
|
27
|
-
}
|
|
28
|
-
return value
|
|
29
|
-
}
|
|
89
|
+
let pureValue:
|
|
90
|
+
| string
|
|
91
|
+
| number
|
|
92
|
+
| object
|
|
93
|
+
| boolean
|
|
94
|
+
| null
|
|
95
|
+
| (string | number | object | boolean)[]
|
|
30
96
|
|
|
31
97
|
for (const term of andTerms) {
|
|
98
|
+
pureValue = null
|
|
99
|
+
|
|
32
100
|
switch (true) {
|
|
33
101
|
case term.includes('>='):
|
|
34
102
|
[key, value] = term.split('>=').map((x) => x.trim())
|
|
35
|
-
|
|
103
|
+
pureValue = GeneratePureValue(value)
|
|
104
|
+
if (pureValue !== null) {
|
|
105
|
+
andQuery[key] = { $gte: pureValue }
|
|
106
|
+
}
|
|
36
107
|
break
|
|
37
108
|
case term.includes('<='):
|
|
38
109
|
[key, value] = term.split('<=').map((x) => x.trim())
|
|
39
|
-
|
|
110
|
+
pureValue = GeneratePureValue(value)
|
|
111
|
+
if (pureValue !== null) {
|
|
112
|
+
andQuery[key] = { $lte: pureValue }
|
|
113
|
+
}
|
|
40
114
|
break
|
|
41
115
|
case term.includes('>'):
|
|
42
116
|
[key, value] = term.split('>').map((x) => x.trim())
|
|
43
|
-
|
|
117
|
+
pureValue = GeneratePureValue(value)
|
|
118
|
+
if (pureValue !== null) {
|
|
119
|
+
andQuery[key] = { $gt: pureValue }
|
|
120
|
+
}
|
|
44
121
|
break
|
|
45
122
|
case term.includes('<'):
|
|
46
123
|
[key, value] = term.split('<').map((x) => x.trim())
|
|
47
|
-
|
|
124
|
+
pureValue = GeneratePureValue(value)
|
|
125
|
+
if (pureValue !== null) {
|
|
126
|
+
andQuery[key] = { $lt: pureValue }
|
|
127
|
+
}
|
|
48
128
|
break
|
|
49
129
|
case term.includes('!='):
|
|
50
130
|
[key, value] = term.split('!=').map((x) => x.trim())
|
|
51
|
-
|
|
131
|
+
pureValue = GeneratePureValue(value)
|
|
132
|
+
if (pureValue !== null) {
|
|
133
|
+
andQuery[key] = { $ne: pureValue }
|
|
134
|
+
}
|
|
52
135
|
break
|
|
53
136
|
case term.includes('='):
|
|
54
137
|
[key, value] = term.split('=').map((x) => x.trim())
|
|
55
|
-
|
|
138
|
+
pureValue = GeneratePureValue(value)
|
|
139
|
+
if (pureValue !== null) {
|
|
140
|
+
andQuery[key] = pureValue
|
|
141
|
+
}
|
|
56
142
|
break
|
|
57
143
|
case term.includes('IN'):
|
|
58
144
|
[key, value] = term.split('IN').map((x) => x.trim())
|
|
@@ -64,15 +150,25 @@ export const parseSmartQuery = (query: string) => {
|
|
|
64
150
|
.split('NOT-IN')
|
|
65
151
|
.map((x) => x.trim())[1]
|
|
66
152
|
.split(',')
|
|
67
|
-
.map((x) =>
|
|
68
|
-
|
|
153
|
+
.map((x) => GeneratePureValue(x.trim()))
|
|
154
|
+
.filter((x) => x)
|
|
155
|
+
|
|
156
|
+
pureValue = GeneratePureValue(queryValue)
|
|
157
|
+
if (pureValue !== null && Array.isArray(pureValue)) {
|
|
158
|
+
andQuery[key] = { $nin: pureValue }
|
|
159
|
+
}
|
|
69
160
|
} else {
|
|
70
161
|
queryValue = term
|
|
71
162
|
.split('IN')
|
|
72
163
|
.map((x) => x.trim())[1]
|
|
73
164
|
.split(',')
|
|
74
|
-
.map((x) =>
|
|
75
|
-
|
|
165
|
+
.map((x) => GeneratePureValue(x.trim()))
|
|
166
|
+
.filter((x) => x)
|
|
167
|
+
|
|
168
|
+
pureValue = GeneratePureValue(queryValue)
|
|
169
|
+
if (pureValue !== null && Array.isArray(pureValue)) {
|
|
170
|
+
andQuery[key] = { $in: pureValue }
|
|
171
|
+
}
|
|
76
172
|
}
|
|
77
173
|
break
|
|
78
174
|
}
|
|
@@ -86,108 +182,110 @@ export const parseSmartQuery = (query: string) => {
|
|
|
86
182
|
return builtQuery
|
|
87
183
|
}
|
|
88
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Method to convert a Mongo based JSON query to a DlSmartSearch query string
|
|
187
|
+
*
|
|
188
|
+
* @param { { [key: string]: any } } query Mongo based JSON that represents a query
|
|
189
|
+
* @returns DlSmartSearch query string
|
|
190
|
+
*/
|
|
89
191
|
export const stringifySmartQuery = (query: { [key: string]: any }) => {
|
|
90
192
|
let result = ''
|
|
91
193
|
|
|
92
194
|
for (const key in query) {
|
|
93
|
-
|
|
94
|
-
const value = query[key]
|
|
95
|
-
|
|
96
|
-
if (key === '$or') {
|
|
97
|
-
if (Array.isArray(value)) {
|
|
98
|
-
const subQueries = value.map(
|
|
99
|
-
(subQuery: { [key: string]: any }) =>
|
|
100
|
-
stringifySmartQuery(subQuery)
|
|
101
|
-
)
|
|
102
|
-
result += subQueries.join(' OR ')
|
|
103
|
-
}
|
|
104
|
-
continue
|
|
105
|
-
}
|
|
195
|
+
const value = query[key]
|
|
106
196
|
|
|
107
|
-
|
|
108
|
-
|
|
197
|
+
if (key === '$or') {
|
|
198
|
+
if (Array.isArray(value)) {
|
|
199
|
+
const subQueries = value.map(
|
|
200
|
+
(subQuery: { [key: string]: any }) =>
|
|
201
|
+
stringifySmartQuery(subQuery)
|
|
202
|
+
)
|
|
203
|
+
result += subQueries.join(' OR ')
|
|
109
204
|
}
|
|
205
|
+
continue
|
|
206
|
+
}
|
|
110
207
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
208
|
+
if (result.length) {
|
|
209
|
+
result += ' AND '
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (isObject(value)) {
|
|
213
|
+
for (const operator in value) {
|
|
214
|
+
if (value.hasOwnProperty(operator)) {
|
|
215
|
+
let operatorValue = (
|
|
216
|
+
value as {
|
|
217
|
+
[key: string]: string | number | string[] | number[]
|
|
218
|
+
}
|
|
219
|
+
)[operator]
|
|
220
|
+
switch (operator) {
|
|
221
|
+
case '$eq':
|
|
222
|
+
result += `${key} = ${
|
|
223
|
+
isString(operatorValue)
|
|
224
|
+
? `'${operatorValue}'`
|
|
225
|
+
: operatorValue
|
|
226
|
+
}`
|
|
227
|
+
break
|
|
228
|
+
case '$ne':
|
|
229
|
+
result += `${key} != ${
|
|
230
|
+
isString(operatorValue)
|
|
231
|
+
? `'${operatorValue}'`
|
|
232
|
+
: operatorValue
|
|
233
|
+
}`
|
|
234
|
+
break
|
|
235
|
+
case '$gt':
|
|
236
|
+
result += `${key} > ${operatorValue}`
|
|
237
|
+
break
|
|
238
|
+
case '$gte':
|
|
239
|
+
result += `${key} >= ${operatorValue}`
|
|
240
|
+
break
|
|
241
|
+
case '$lt':
|
|
242
|
+
result += `${key} < ${operatorValue}`
|
|
243
|
+
break
|
|
244
|
+
case '$lte':
|
|
245
|
+
result += `${key} <= ${operatorValue}`
|
|
246
|
+
break
|
|
247
|
+
case '$in':
|
|
248
|
+
if (!Array.isArray(operatorValue)) {
|
|
249
|
+
operatorValue = [operatorValue] as
|
|
119
250
|
| string[]
|
|
120
251
|
| number[]
|
|
121
252
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
isString(operatorValue)
|
|
127
|
-
? `'${operatorValue}'`
|
|
128
|
-
: operatorValue
|
|
129
|
-
}`
|
|
130
|
-
break
|
|
131
|
-
case '$ne':
|
|
132
|
-
result += `${key} != ${
|
|
133
|
-
isString(operatorValue)
|
|
134
|
-
? `'${operatorValue}'`
|
|
135
|
-
: operatorValue
|
|
136
|
-
}`
|
|
137
|
-
break
|
|
138
|
-
case '$gt':
|
|
139
|
-
result += `${key} > ${operatorValue}`
|
|
140
|
-
break
|
|
141
|
-
case '$gte':
|
|
142
|
-
result += `${key} >= ${operatorValue}`
|
|
143
|
-
break
|
|
144
|
-
case '$lt':
|
|
145
|
-
result += `${key} < ${operatorValue}`
|
|
146
|
-
break
|
|
147
|
-
case '$lte':
|
|
148
|
-
result += `${key} <= ${operatorValue}`
|
|
149
|
-
break
|
|
150
|
-
case '$in':
|
|
151
|
-
if (!Array.isArray(operatorValue)) {
|
|
152
|
-
operatorValue = [operatorValue] as
|
|
153
|
-
| string[]
|
|
154
|
-
| number[]
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const inValues: string = (
|
|
158
|
-
operatorValue as any[]
|
|
253
|
+
|
|
254
|
+
const inValues: string = (operatorValue as any[])
|
|
255
|
+
.map((x: string | number) =>
|
|
256
|
+
isString(x) ? `'${x}'` : x
|
|
159
257
|
)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const ninValues: string = (
|
|
174
|
-
operatorValue as any[]
|
|
258
|
+
.join(', ')
|
|
259
|
+
result += `${key} IN ${inValues} `
|
|
260
|
+
break
|
|
261
|
+
case '$nin':
|
|
262
|
+
if (!Array.isArray(operatorValue)) {
|
|
263
|
+
operatorValue = [operatorValue] as
|
|
264
|
+
| string[]
|
|
265
|
+
| number[]
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const ninValues: string = (operatorValue as any[])
|
|
269
|
+
.map((x: string | number) =>
|
|
270
|
+
isString(x) ? `'${x}'` : x
|
|
175
271
|
)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
break
|
|
183
|
-
default:
|
|
184
|
-
throw new Error(`Invalid operator: ${operator}`)
|
|
185
|
-
}
|
|
272
|
+
.join(', ')
|
|
273
|
+
|
|
274
|
+
result += `${key} NOT-IN ${ninValues}`
|
|
275
|
+
break
|
|
276
|
+
default:
|
|
277
|
+
throw new Error(`Invalid operator: ${operator}`)
|
|
186
278
|
}
|
|
187
279
|
}
|
|
188
|
-
} else {
|
|
189
|
-
result += `${key} = '${value}'`
|
|
190
280
|
}
|
|
281
|
+
} else if (isNumber(value)) {
|
|
282
|
+
result += `${key} = ${value}`
|
|
283
|
+
} else if (isBoolean(value)) {
|
|
284
|
+
result += `${key} = ${value}`
|
|
285
|
+
} else if (isDatePattern(value)) {
|
|
286
|
+
result += `${key} = (${value})`
|
|
287
|
+
} else {
|
|
288
|
+
result += `${key} = '${value}'`
|
|
191
289
|
}
|
|
192
290
|
}
|
|
193
291
|
|
package/src/utils/portal.ts
CHANGED
|
@@ -19,13 +19,13 @@ export function closePortalMenus(vm: any, evt: Event) {
|
|
|
19
19
|
if (vm.$props.separateClosePopup === true) {
|
|
20
20
|
return getParentVm(vm)
|
|
21
21
|
}
|
|
22
|
-
} else if (vm.__dlPortalInnerRef
|
|
22
|
+
} else if (vm.__dlPortalInnerRef) {
|
|
23
23
|
// treat it as point of separation if parent is DlPopupProxy
|
|
24
24
|
// (so mobile matches desktop behavior)
|
|
25
25
|
// and hide it too
|
|
26
26
|
const parent = getParentVm(vm)
|
|
27
27
|
|
|
28
|
-
if (parent
|
|
28
|
+
if (parent && parent.$options.name === 'DlPopupProxy') {
|
|
29
29
|
vm.hide(evt)
|
|
30
30
|
return parent
|
|
31
31
|
} else {
|
|
@@ -34,12 +34,12 @@ export function closePortalMenus(vm: any, evt: Event) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
vm = getParentVm(vm)
|
|
37
|
-
} while (vm
|
|
37
|
+
} while (vm)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function closePortals(vm: any, evt: Event, depth: number) {
|
|
41
|
-
while (depth !== 0 && vm
|
|
42
|
-
if (vm.__dlPortalInnerRef
|
|
41
|
+
while (depth !== 0 && vm) {
|
|
42
|
+
if (vm.__dlPortalInnerRef) {
|
|
43
43
|
depth--
|
|
44
44
|
|
|
45
45
|
if (vm.$options.name === 'DlMenu') {
|
|
@@ -84,7 +84,7 @@ export function parsePosition(pos: string): ParsedPosition {
|
|
|
84
84
|
export function getAnchorProps(el: HTMLElement, offset: number[]) {
|
|
85
85
|
let { top, left, right, bottom, width, height } = el.getBoundingClientRect()
|
|
86
86
|
|
|
87
|
-
if (offset
|
|
87
|
+
if (offset) {
|
|
88
88
|
top -= offset[1]
|
|
89
89
|
left -= offset[0]
|
|
90
90
|
bottom += offset[1]
|
|
@@ -101,8 +101,8 @@ export function getAnchorProps(el: HTMLElement, offset: number[]) {
|
|
|
101
101
|
bottom,
|
|
102
102
|
width,
|
|
103
103
|
height,
|
|
104
|
-
middle: left + (right - left) / 2,
|
|
105
|
-
center: top + (bottom - top) / 2
|
|
104
|
+
middle: left + (right - left) / 2 + offset[0] ?? 0,
|
|
105
|
+
center: top + (bottom - top) / 2 + offset[1] ?? 0
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -145,7 +145,7 @@ interface ElementStyle {
|
|
|
145
145
|
export function setPosition(cfg: PositionConfig) {
|
|
146
146
|
const isMobile = isMobileOrTablet()
|
|
147
147
|
|
|
148
|
-
if (isMobile && window.visualViewport
|
|
148
|
+
if (isMobile && window.visualViewport) {
|
|
149
149
|
// uses the dl-position-engine CSS class
|
|
150
150
|
|
|
151
151
|
const el = document.body.style
|
|
@@ -169,7 +169,7 @@ export function setPosition(cfg: PositionConfig) {
|
|
|
169
169
|
// the new positioning
|
|
170
170
|
const { scrollLeft, scrollTop } = cfg.el!
|
|
171
171
|
|
|
172
|
-
if (cfg.absoluteOffset
|
|
172
|
+
if (!cfg.absoluteOffset) {
|
|
173
173
|
anchorProps = getAnchorProps(cfg.anchorEl, cfg.offset)
|
|
174
174
|
} else {
|
|
175
175
|
const { top: anchorTop, left: anchorLeft } =
|
|
@@ -245,7 +245,7 @@ export function setPosition(cfg: PositionConfig) {
|
|
|
245
245
|
left: props.left + 'px'
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
if (props.maxHeight
|
|
248
|
+
if (props.maxHeight) {
|
|
249
249
|
elStyle.maxHeight = props.maxHeight + 'px'
|
|
250
250
|
|
|
251
251
|
if (anchorProps.height > props.maxHeight) {
|
|
@@ -253,7 +253,7 @@ export function setPosition(cfg: PositionConfig) {
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
if (props.maxWidth
|
|
256
|
+
if (props.maxWidth) {
|
|
257
257
|
elStyle.maxWidth = props.maxWidth + 'px'
|
|
258
258
|
|
|
259
259
|
if (anchorProps.width > props.maxWidth) {
|
package/src/utils/render.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const createElement = (
|
|
|
18
18
|
* so it's merged with the possible slot
|
|
19
19
|
*/
|
|
20
20
|
export function mergeSlot(slot: any, source: any) {
|
|
21
|
-
return slot
|
|
21
|
+
return slot ? source.concat(slot()) : source
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const hSlot = (
|
package/src/utils/scroll.ts
CHANGED
package/src/utils/selection.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export function clearSelection() {
|
|
2
|
-
if (window.getSelection
|
|
2
|
+
if (window.getSelection) {
|
|
3
3
|
const selection = window.getSelection()
|
|
4
4
|
if (!selection) return
|
|
5
5
|
|
|
6
|
-
if (selection.empty
|
|
6
|
+
if (selection.empty) {
|
|
7
7
|
selection.empty()
|
|
8
|
-
} else if (selection.removeAllRanges
|
|
8
|
+
} else if (selection.removeAllRanges) {
|
|
9
9
|
selection.removeAllRanges()
|
|
10
10
|
if ('ontouchstart' in window) {
|
|
11
11
|
selection.addRange(document.createRange())
|
package/vite.config.ts
CHANGED
|
@@ -13,9 +13,17 @@ export default defineConfig({
|
|
|
13
13
|
},
|
|
14
14
|
coverage: {
|
|
15
15
|
reporter: ['lcovonly', 'text']
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
exclude: [
|
|
18
|
+
'node_modules/**/*.spec.js',
|
|
19
|
+
'node_modules/**/*.spec.ts',
|
|
20
|
+
'node_modules/**/*.test.js',
|
|
21
|
+
'node_modules/**/*.test.ts',
|
|
22
|
+
'misc'
|
|
23
|
+
]
|
|
17
24
|
},
|
|
18
25
|
optimizeDeps: {
|
|
26
|
+
include: ['highlight.js'],
|
|
19
27
|
exclude: ['vue-demi']
|
|
20
28
|
},
|
|
21
29
|
define: {
|