@dataloop-ai/components 0.16.45 → 0.16.47

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.
Files changed (145) hide show
  1. package/.eslintrc.js +2 -2
  2. package/package.json +10 -9
  3. package/src/App.vue +120 -58
  4. package/src/assets/globals.scss +2 -0
  5. package/src/components/basic/DlAlert/DlAlert.vue +1 -1
  6. package/src/components/basic/DlButton/DlButton.vue +13 -13
  7. package/src/components/basic/DlCard/DlCard.vue +234 -0
  8. package/src/components/basic/DlCard/index.ts +3 -0
  9. package/src/components/basic/DlCard/types.ts +20 -0
  10. package/src/components/basic/DlChip/DlChip.vue +1 -0
  11. package/src/components/basic/DlEllipsis/DlEllipsis.vue +90 -0
  12. package/src/components/basic/DlEllipsis/index.ts +2 -0
  13. package/src/components/basic/DlListItem/DlListItem.vue +11 -5
  14. package/src/components/basic/index.ts +2 -0
  15. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +8 -1
  16. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +22 -6
  17. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +542 -0
  18. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/index.ts +2 -0
  19. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +96 -0
  20. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +2 -2
  21. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +22 -6
  22. package/src/components/compound/DlCharts/charts/index.ts +1 -0
  23. package/src/components/compound/DlCharts/components/DlBrush.vue +8 -1
  24. package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +34 -21
  25. package/src/components/compound/DlCharts/types/DlConfusionMatrix.types.ts +19 -0
  26. package/src/components/compound/DlCharts/types/index.ts +2 -1
  27. package/src/components/compound/DlCharts/types/props.ts +14 -0
  28. package/src/components/compound/DlDialogBox/DlDialogBox.vue +1 -1
  29. package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -0
  30. package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +58 -12
  31. package/src/components/compound/DlInput/DlInput.vue +45 -23
  32. package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +13 -29
  33. package/src/components/compound/DlPagination/DlPagination.vue +14 -4
  34. package/src/components/compound/DlPagination/components/PageNavigation.vue +24 -25
  35. package/src/components/compound/DlPagination/components/PaginationLegend.vue +2 -1
  36. package/src/components/compound/DlPagination/components/QuickNavigation.vue +1 -0
  37. package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +86 -49
  38. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +86 -69
  39. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +43 -4
  40. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +1 -55
  41. package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +42 -10
  42. package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +107 -0
  43. package/src/components/compound/DlSelect/DlSelect.vue +41 -8
  44. package/src/components/compound/DlTable/DlTable.vue +13 -10
  45. package/src/components/compound/DlTable/styles/dl-table-styles.scss +16 -4
  46. package/src/components/compound/DlToggleButton/DlToggleButton.vue +109 -0
  47. package/src/components/compound/DlToggleButton/config.ts +27 -0
  48. package/src/components/compound/DlToggleButton/index.ts +3 -0
  49. package/src/components/compound/DlToggleButton/types.ts +4 -0
  50. package/src/components/compound/index.ts +1 -0
  51. package/src/components/compound/types.ts +1 -0
  52. package/src/components/essential/DlColorPicker/DlColorPicker.vue +4 -1
  53. package/src/components/essential/DlColorPicker/components/DlColors.vue +2 -6
  54. package/src/components/essential/DlIcon/DlIcon.vue +5 -1
  55. package/src/components/essential/DlMenu/DlMenu.vue +30 -2
  56. package/src/components/essential/DlSeparator/DlSeparator.vue +66 -0
  57. package/src/components/essential/DlSeparator/index.ts +2 -0
  58. package/src/components/essential/DlSpinner/DlSpinner.vue +53 -217
  59. package/src/components/essential/DlSpinner/components/DlSpinnerCircle.vue +156 -0
  60. package/src/components/essential/DlSpinner/components/DlSpinnerClock.vue +191 -0
  61. package/src/components/essential/DlSpinner/components/DlSpinnerDots.vue +225 -0
  62. package/src/components/essential/DlSpinner/components/DlSpinnerGrid.vue +278 -0
  63. package/src/components/essential/DlSpinner/components/DlSpinnerLogo.vue +264 -0
  64. package/src/components/essential/DlSpinner/index.ts +14 -1
  65. package/src/components/essential/DlSpinner/types.ts +7 -0
  66. package/src/components/essential/index.ts +1 -0
  67. package/src/components/essential/types.ts +1 -0
  68. package/src/components/shared/DlItemSection/DlItemSection.vue +21 -15
  69. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +36 -21
  70. package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +8 -10
  71. package/src/{demo → demos}/DlButtonDemo.vue +15 -0
  72. package/src/demos/DlCardDemo.vue +47 -0
  73. package/src/{demo → demos}/DlColorPickerDemo.vue +16 -1
  74. package/src/demos/DlConfusionMatrixDemo.vue +53 -0
  75. package/src/{demo → demos}/DlDialogBoxDemo.vue +4 -1
  76. package/src/demos/DlDropdownButtonDemo.vue +386 -0
  77. package/src/demos/DlEllipsisDemo.vue +30 -0
  78. package/src/{demo → demos}/DlLineChartDemo.vue +8 -8
  79. package/src/{demo → demos}/DlMenuDemo.vue +61 -2
  80. package/src/{demo → demos}/DlSearchDemo.vue +3 -2
  81. package/src/demos/DlSeparatorDemo.vue +44 -0
  82. package/src/demos/DlSpinnerDemo.vue +59 -0
  83. package/src/{demo → demos}/DlTableDemo.vue +117 -29
  84. package/src/demos/DlToggleButtonDemo.vue +55 -0
  85. package/src/{demo → demos}/DlTooltipDemo.vue +43 -2
  86. package/src/{demo → demos}/DlWidgetDemo.vue +34 -19
  87. package/src/{demo → demos}/SmartSearchDemo/DlSmartSearchDemo.vue +2 -50
  88. package/src/{demo → demos}/index.ts +14 -56
  89. package/src/hooks/use-arrow-navigation.ts +58 -0
  90. package/src/hooks/use-suggestions.ts +97 -74
  91. package/src/utils/colors.ts +1 -1
  92. package/src/utils/draggable-table.ts +2 -2
  93. package/src/utils/index.ts +1 -0
  94. package/src/utils/parse-smart-query.ts +87 -0
  95. package/src/components/compound/DlCharts/types.ts +0 -1
  96. package/src/demo/DlDropdownButtonDemo.vue +0 -260
  97. package/src/demo/DlSpinnerDemo.vue +0 -20
  98. /package/src/{demo → demos}/BarChartDemo.vue +0 -0
  99. /package/src/{demo → demos}/ColumnChartDemo.vue +0 -0
  100. /package/src/{demo → demos}/DlAccordionDemo.vue +0 -0
  101. /package/src/{demo → demos}/DlAlertDemo.vue +0 -0
  102. /package/src/{demo → demos}/DlAvatarDemo.vue +0 -0
  103. /package/src/{demo → demos}/DlBadgeDemo.vue +0 -0
  104. /package/src/{demo → demos}/DlChartDoughnutDemo.vue +0 -0
  105. /package/src/{demo → demos}/DlCheckboxDemo.vue +0 -0
  106. /package/src/{demo → demos}/DlChipDemo.vue +0 -0
  107. /package/src/{demo → demos}/DlCounterDemo.vue +0 -0
  108. /package/src/{demo → demos}/DlDateTimeRangeDemo.vue +0 -0
  109. /package/src/{demo → demos}/DlIconDemo.vue +0 -0
  110. /package/src/{demo → demos}/DlInputDemo.vue +0 -0
  111. /package/src/{demo → demos}/DlKpiDemo.vue +0 -0
  112. /package/src/{demo → demos}/DlLinkDemo.vue +0 -0
  113. /package/src/{demo → demos}/DlListDemo.vue +0 -0
  114. /package/src/{demo → demos}/DlOptionGroupDemo.vue +0 -0
  115. /package/src/{demo → demos}/DlPaginationDemo.vue +0 -0
  116. /package/src/{demo → demos}/DlPanelContainerDemo.vue +0 -0
  117. /package/src/{demo → demos}/DlPopupDemo.vue +0 -0
  118. /package/src/{demo → demos}/DlProgressBarDemo.vue +0 -0
  119. /package/src/{demo → demos}/DlProgressChartDemo.vue +0 -0
  120. /package/src/{demo → demos}/DlRadioDemo.vue +0 -0
  121. /package/src/{demo → demos}/DlRangeDemo.vue +0 -0
  122. /package/src/{demo → demos}/DlSelectDemo.vue +0 -0
  123. /package/src/{demo → demos}/DlSkeletonDemo.vue +0 -0
  124. /package/src/{demo → demos}/DlSliderDemo.vue +0 -0
  125. /package/src/{demo → demos}/DlStepperDemo/CenteredStepperInDialogBox.vue +0 -0
  126. /package/src/{demo → demos}/DlStepperDemo/DlStepperDemo.vue +0 -0
  127. /package/src/{demo → demos}/DlStepperDemo/SimpleStepper.vue +0 -0
  128. /package/src/{demo → demos}/DlStepperDemo/StepperInDialogBox.vue +0 -0
  129. /package/src/{demo → demos}/DlStepperDemo/index.ts +0 -0
  130. /package/src/{demo → demos}/DlStepperDemo/steps/AssignmentsStep.vue +0 -0
  131. /package/src/{demo → demos}/DlStepperDemo/steps/DataStep.vue +0 -0
  132. /package/src/{demo → demos}/DlStepperDemo/steps/GeneralStep.vue +0 -0
  133. /package/src/{demo → demos}/DlStepperDemo/steps/InstructionStep.vue +0 -0
  134. /package/src/{demo → demos}/DlStepperDemo/steps/QualityStep.vue +0 -0
  135. /package/src/{demo → demos}/DlSwitchDemo.vue +0 -0
  136. /package/src/{demo → demos}/DlTabsDemo.vue +0 -0
  137. /package/src/{demo → demos}/DlTdDemo.vue +0 -0
  138. /package/src/{demo → demos}/DlTextAreaDemo.vue +0 -0
  139. /package/src/{demo → demos}/DlTextHolderDemo.vue +0 -0
  140. /package/src/{demo → demos}/DlThDemo.vue +0 -0
  141. /package/src/{demo → demos}/DlToastDemo.vue +0 -0
  142. /package/src/{demo → demos}/DlTrDemo.vue +0 -0
  143. /package/src/{demo → demos}/DlTrendDemo.vue +0 -0
  144. /package/src/{demo → demos}/DlTypographyDemo.vue +0 -0
  145. /package/src/{demo → demos}/SmartSearchDemo/schema.ts +0 -0
@@ -60,12 +60,22 @@ type Expression = {
60
60
  }
61
61
 
62
62
  const space = ' '
63
+ const dateStartSuggestionString = '(From dd/mm/yyyy)'
64
+ const dateEndSuggestionString = '(To dd/mm/yyyy)'
63
65
  const dateIntervalSuggestionString = '(From (dd/mm/yyyy) To (dd/mm/yyyy))'
64
66
 
65
67
  let localSuggestions: Suggestion[] = []
66
68
 
69
+ export const startDatePattern = new RegExp(
70
+ /(from\s?\d{2}\/\d{2}\/\d{4}\s?|from\s?dd\/mm\/yyyy\s?)/,
71
+ 'gi'
72
+ )
73
+ export const endDatePattern = new RegExp(
74
+ /(to\s?\d{2}\/\d{2}\/\d{4}\s?|to\s?dd\/mm\/yyyy\s?)/,
75
+ 'gi'
76
+ )
67
77
  export const dateIntervalPattern = new RegExp(
68
- /\((from\s?\(\d{2}\/\d{2}\/\d{4}\)\s?to\s?\(\d{2}\/\d{2}\/\d{4}\))\)|\((from\s?\(dd\/mm\/yyyy\)\s?to\s?\(dd\/mm\/yyyy\))\)/,
78
+ /(from\s?\d{2}\/\d{2}\/\d{4}\s?to\s?\d{2}\/\d{2}\/\d{4})|(from\s?dd\/mm\/yyyy\s?to\s?dd\/mm\/yyyy)/,
69
79
  'gi'
70
80
  )
71
81
 
@@ -75,99 +85,99 @@ export const useSuggestions = (schema: Schema, aliases: Alias[]) => {
75
85
  const error: Ref<string | null> = ref(null)
76
86
 
77
87
  const findSuggestions = (input: string) => {
88
+ input = input.replace(/\s+/g, ' ').trimStart()
78
89
  localSuggestions = initialSuggestions
79
90
 
80
91
  const words = splitByQuotes(input, space)
81
92
  const expressions = mapWordsToExpressions(words)
82
93
 
83
- expressions.forEach(
84
- ({ field, operator, value, keyword }: Expression) => {
85
- let matchedField: Suggestion | null = null
86
- let matchedOperator: Suggestion | null = null
87
- let matchedKeyword: Suggestion | null = null
94
+ for (const { field, operator, value, keyword } of expressions) {
95
+ let matchedField: Suggestion | null = null
96
+ let matchedOperator: Suggestion | null = null
97
+ let matchedKeyword: Suggestion | null = null
88
98
 
89
- if (!field) return
99
+ if (!field) continue
90
100
 
91
- localSuggestions = getMatches(localSuggestions, field)
92
- matchedField = getMatch(localSuggestions, field)
101
+ localSuggestions = getMatches(localSuggestions, field)
102
+ matchedField = getMatch(localSuggestions, field)
93
103
 
94
- if (!matchedField && isNextCharSpace(input, field)) {
95
- localSuggestions = []
96
- return
97
- }
104
+ if (!matchedField && isNextCharSpace(input, field)) {
105
+ localSuggestions = []
106
+ continue
107
+ }
98
108
 
99
- if (!matchedField || !isNextCharSpace(input, matchedField)) {
100
- return
101
- }
109
+ if (!matchedField || !isNextCharSpace(input, matchedField)) {
110
+ continue
111
+ }
102
112
 
103
- const alias = getAliasObjByAlias(aliases, matchedField)
104
- if (!alias) return
105
- const dataType = getDataTypeByAliasKey(schema, alias.key)
106
- if (!dataType) {
107
- localSuggestions = []
108
- return
109
- }
113
+ const alias = getAliasObjByAlias(aliases, matchedField)
114
+ if (!alias) continue
115
+ const dataType = getDataTypeByAliasKey(schema, alias.key)
116
+ if (!dataType) {
117
+ localSuggestions = []
118
+ continue
119
+ }
110
120
 
111
- const ops: string[] = Array.isArray(dataType)
112
- ? getGenericOperators()
113
- : getOperatorByDataType(dataType)
121
+ const ops: string[] = Array.isArray(dataType)
122
+ ? getGenericOperators()
123
+ : getOperatorByDataType(dataType)
114
124
 
115
- localSuggestions = getOperators(ops)
125
+ localSuggestions = getOperators(ops)
116
126
 
117
- if (!operator) return
127
+ if (!operator) continue
118
128
 
119
- localSuggestions = getMatches(localSuggestions, operator)
120
- matchedOperator = getMatch(localSuggestions, operator)
129
+ localSuggestions = getMatches(localSuggestions, operator)
130
+ matchedOperator = getMatch(localSuggestions, operator)
121
131
 
122
- if (!matchedOperator && isNextCharSpace(input, operator)) {
123
- localSuggestions = []
124
- return
125
- }
132
+ if (!matchedOperator && isNextCharSpace(input, operator)) {
133
+ localSuggestions = []
134
+ continue
135
+ }
126
136
 
127
- if (
128
- !matchedOperator ||
129
- !isNextCharSpace(input, matchedOperator)
130
- ) {
131
- return
132
- }
137
+ if (!matchedOperator || !isNextCharSpace(input, matchedOperator)) {
138
+ continue
139
+ }
133
140
 
134
- if (Array.isArray(dataType)) {
135
- localSuggestions = dataType
141
+ if (Array.isArray(dataType)) {
142
+ localSuggestions = dataType
136
143
 
137
- if (!value) return
144
+ if (!value) continue
138
145
 
139
- localSuggestions = getMatches(localSuggestions, value)
140
- } else if (
141
- dataType === 'datetime' ||
142
- dataType === 'date' ||
143
- dataType === 'time'
144
- ) {
145
- localSuggestions = [dateIntervalSuggestionString]
146
+ localSuggestions = getMatches(localSuggestions, value)
147
+ } else if (
148
+ dataType === 'datetime' ||
149
+ dataType === 'date' ||
150
+ dataType === 'time'
151
+ ) {
152
+ localSuggestions = [
153
+ dateIntervalSuggestionString,
154
+ dateStartSuggestionString,
155
+ dateEndSuggestionString
156
+ ]
146
157
 
147
- if (!value) return
158
+ if (!value) continue
148
159
 
149
- localSuggestions = getMatches(localSuggestions, value)
150
- } else {
151
- localSuggestions = []
152
- }
160
+ localSuggestions = getMatches(localSuggestions, value)
161
+ } else {
162
+ localSuggestions = []
163
+ }
153
164
 
154
- if (!value || !isNextCharSpace(input, value)) {
155
- return
156
- }
165
+ if (!value || !isNextCharSpace(input, value)) {
166
+ continue
167
+ }
157
168
 
158
- localSuggestions = [Logical.AND, Logical.OR]
169
+ localSuggestions = [Logical.AND, Logical.OR]
159
170
 
160
- if (!keyword) return
171
+ if (!keyword) continue
161
172
 
162
- localSuggestions = getMatches(localSuggestions, keyword)
163
- matchedKeyword = getMatch(localSuggestions, keyword)
173
+ localSuggestions = getMatches(localSuggestions, keyword)
174
+ matchedKeyword = getMatch(localSuggestions, keyword)
164
175
 
165
- if (!matchedKeyword || !isNextCharSpace(input, matchedKeyword))
166
- return
176
+ if (!matchedKeyword || !isNextCharSpace(input, matchedKeyword))
177
+ continue
167
178
 
168
- localSuggestions = initialSuggestions
169
- }
170
- )
179
+ localSuggestions = initialSuggestions
180
+ }
171
181
 
172
182
  error.value = input.length
173
183
  ? getError(schema, aliases, expressions)
@@ -203,12 +213,11 @@ const getError = (
203
213
  return expressions
204
214
  .filter(({ field, value }) => field !== null && value !== null)
205
215
  .reduce<string | null>((acc, { field, value, operator }, _, arr) => {
216
+ const aliasObj = getAliasObjByAlias(aliases, field)
217
+ if (!aliasObj) return 'warning'
206
218
  const valid = isValidByDataType(
207
- value,
208
- getDataTypeByAliasKey(
209
- schema,
210
- getAliasObjByAlias(aliases, field)!.key
211
- ),
219
+ validateBracketValues(value),
220
+ getDataTypeByAliasKey(schema, aliasObj!.key),
212
221
  operator
213
222
  )
214
223
 
@@ -244,8 +253,18 @@ const isValidByDataType = (
244
253
  }
245
254
  }
246
255
 
256
+ const validateBracketValues = (value: string) => {
257
+ value = removeBrackets(value)
258
+ value = value.split(',')[0]
259
+ return value
260
+ }
261
+
247
262
  const isValidDateIntervalPattern = (str: string) => {
248
- return !!str.match(dateIntervalPattern)
263
+ return (
264
+ !!str.match(dateIntervalPattern) ||
265
+ !!str.match(startDatePattern) ||
266
+ !!str.match(endDatePattern)
267
+ )
249
268
  }
250
269
 
251
270
  const isValidNumber = (str: string) => {
@@ -309,7 +328,7 @@ const getGenericOperators = () => {
309
328
  )
310
329
  }
311
330
 
312
- const mapWordsToExpressions = (words: string[]): Expression[] => {
331
+ export const mapWordsToExpressions = (words: string[]): Expression[] => {
313
332
  const _words = words.slice()
314
333
  const expressions = [mapWordsToExpression(_words.splice(0, 4))]
315
334
 
@@ -353,3 +372,7 @@ const isNextCharSpace = (input: string, str: string) => {
353
372
 
354
373
  const matchStringEnd = (input: string, str: string) =>
355
374
  input.lastIndexOf(str + '" ') > -1 || input.lastIndexOf(str + "' ") > -1
375
+
376
+ export const removeBrackets = (str: string) => {
377
+ return str.replaceAll('(', '').replaceAll(')', '')
378
+ }
@@ -4,7 +4,7 @@ export const hexToRgbA = (hex: string, opacity = 1) => {
4
4
  const g = parseInt(hex.slice(3, 5), 16)
5
5
  const b = parseInt(hex.slice(5, 7), 16)
6
6
 
7
- if (opacity) {
7
+ if (opacity || opacity === 0) {
8
8
  return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity + ')'
9
9
  } else {
10
10
  return 'rgb(' + r + ', ' + g + ', ' + b + ')'
@@ -58,7 +58,7 @@ function isIntersecting(
58
58
  }
59
59
 
60
60
  function getRows(table: HTMLTableElement) {
61
- return table.querySelectorAll('tbody tr')
61
+ return table.querySelectorAll('tbody#draggable tr')
62
62
  }
63
63
 
64
64
  export function applyDraggableRows(
@@ -66,7 +66,7 @@ export function applyDraggableRows(
66
66
  vm?: any,
67
67
  root?: HTMLDivElement
68
68
  ) {
69
- const tbody = table.querySelector('tbody')!
69
+ const tbody = table.querySelector('tbody#draggable')!
70
70
 
71
71
  let currRow: any = null
72
72
  let dragElem: any = null
@@ -12,6 +12,7 @@ export * from './render'
12
12
  export * from './component-name-parser'
13
13
  export * from './colors'
14
14
  export * from './teleport'
15
+ export * from './parse-smart-query'
15
16
 
16
17
  export const isMobileOrTablet = () => {
17
18
  let check = false
@@ -0,0 +1,87 @@
1
+ /* eslint-disable no-empty */
2
+
3
+ import { isFinite } from 'lodash'
4
+
5
+ export const parseSmartQuery = (query: string) => {
6
+ const queryArr = query.split(' OR ')
7
+ const orTerms: { [key: string]: any }[] = []
8
+
9
+ for (const query of queryArr) {
10
+ const andTerms = query.split(' AND ')
11
+
12
+ const andQuery: { [key: string]: any } = {}
13
+ let queryValue: any
14
+
15
+ let key: string
16
+ let value: string | number | object
17
+
18
+ const cleanValue = (value: any) => {
19
+ if (typeof value === 'string') {
20
+ try {
21
+ const num = Number(value)
22
+ if (isFinite(num)) {
23
+ return num
24
+ }
25
+ } catch (e) {}
26
+ return value.replaceAll('"', '').replaceAll("'", '')
27
+ }
28
+ return value
29
+ }
30
+
31
+ for (const term of andTerms) {
32
+ switch (true) {
33
+ case term.includes('>='):
34
+ [key, value] = term.split('>=').map((x) => x.trim())
35
+ andQuery[key] = { $gte: cleanValue(value) }
36
+ break
37
+ case term.includes('<='):
38
+ [key, value] = term.split('<=').map((x) => x.trim())
39
+ andQuery[key] = { $lte: cleanValue(value) }
40
+ break
41
+ case term.includes('>'):
42
+ [key, value] = term.split('>').map((x) => x.trim())
43
+ andQuery[key] = { $gt: cleanValue(value) }
44
+ break
45
+ case term.includes('<'):
46
+ [key, value] = term.split('<').map((x) => x.trim())
47
+ andQuery[key] = { $lt: cleanValue(value) }
48
+ break
49
+ case term.includes('!='):
50
+ [key, value] = term.split('!=').map((x) => x.trim())
51
+ andQuery[key] = { $ne: cleanValue(value) }
52
+ break
53
+ case term.includes('='):
54
+ [key, value] = term.split('=').map((x) => x.trim())
55
+ andQuery[key] = cleanValue(value)
56
+ break
57
+ case term.includes('IN'):
58
+ [key, value] = term.split('IN').map((x) => x.trim())
59
+ if (key.includes('NOT-')) {
60
+ [key, value] = term
61
+ .split('NOT-IN')
62
+ .map((x) => x.trim())
63
+ queryValue = term
64
+ .split('NOT-IN')
65
+ .map((x) => x.trim())[1]
66
+ .split(',')
67
+ .map((x) => cleanValue(x.trim()))
68
+ andQuery[key] = { $nin: cleanValue(queryValue) }
69
+ } else {
70
+ queryValue = term
71
+ .split('IN')
72
+ .map((x) => x.trim())[1]
73
+ .split(',')
74
+ .map((x) => cleanValue(x.trim()))
75
+ andQuery[key] = { $in: cleanValue(queryValue) }
76
+ }
77
+ break
78
+ }
79
+ }
80
+
81
+ orTerms.push(andQuery)
82
+ }
83
+
84
+ const builtQuery = orTerms.length > 1 ? { $or: orTerms } : orTerms[0]
85
+
86
+ return builtQuery
87
+ }
@@ -1 +0,0 @@
1
- export * from './types'
@@ -1,260 +0,0 @@
1
- <template>
2
- <div>
3
- <div style="display: flex; gap: 20px; flex-direction: column">
4
- <h2>Splitted</h2>
5
- <dl-dropdown-button
6
- auto-close
7
- outlined
8
- split
9
- label="Dropdown Button Outlined"
10
- >
11
- <dl-list>
12
- <dl-list-item clickable>
13
- <dl-item-section> Photos </dl-item-section>
14
- </dl-list-item>
15
-
16
- <dl-list-item clickable>
17
- <dl-item-section> Videos </dl-item-section>
18
- </dl-list-item>
19
-
20
- <dl-list-item clickable>
21
- <dl-item-section> Articles </dl-item-section>
22
- </dl-list-item>
23
- </dl-list>
24
- </dl-dropdown-button>
25
-
26
- <dl-dropdown-button
27
- disabled
28
- auto-close
29
- outlined
30
- split
31
- label="Dropdown Button Outlined"
32
- >
33
- <dl-list>
34
- <dl-list-item clickable>
35
- <dl-item-section> Photos </dl-item-section>
36
- </dl-list-item>
37
-
38
- <dl-list-item clickable>
39
- <dl-item-section> Videos </dl-item-section>
40
- </dl-list-item>
41
-
42
- <dl-list-item clickable>
43
- <dl-item-section> Articles </dl-item-section>
44
- </dl-list-item>
45
- </dl-list>
46
- </dl-dropdown-button>
47
-
48
- <dl-dropdown-button
49
- split
50
- label="Dropdown Button Contained"
51
- >
52
- <dl-list>
53
- <dl-list-item clickable>
54
- <dl-item-section> Photos </dl-item-section>
55
- </dl-list-item>
56
-
57
- <dl-list-item clickable>
58
- <dl-item-section> Videos </dl-item-section>
59
- </dl-list-item>
60
-
61
- <dl-list-item clickable>
62
- <dl-item-section> Articles </dl-item-section>
63
- </dl-list-item>
64
- </dl-list>
65
- </dl-dropdown-button>
66
-
67
- <dl-dropdown-button
68
- v-model="showing"
69
- auto-close
70
- split
71
- :label="name"
72
- main-btn-style="width: 120px"
73
- @click="onClick"
74
- >
75
- <dl-list>
76
- <dl-list-item
77
- clickable
78
- @click="() => onClose('Photos')"
79
- >
80
- <dl-item-section> Photos </dl-item-section>
81
- </dl-list-item>
82
-
83
- <dl-list-item
84
- clickable
85
- @click="() => onClose('Videos and long text')"
86
- >
87
- <dl-item-section>
88
- Videos and long text
89
- </dl-item-section>
90
- </dl-list-item>
91
-
92
- <dl-list-item
93
- clickable
94
- @click="() => onClose('Articles')"
95
- >
96
- <dl-item-section> Articles </dl-item-section>
97
- </dl-list-item>
98
- </dl-list>
99
- </dl-dropdown-button>
100
- </div>
101
-
102
- <div style="display: flex; gap: 20px; flex-direction: column">
103
- <h2>One Button</h2>
104
- <dl-dropdown-button
105
- auto-close
106
- outlined
107
- label="Dropdown Button Outlined"
108
- >
109
- <dl-list>
110
- <dl-list-item clickable>
111
- <dl-item-section> Photos </dl-item-section>
112
- </dl-list-item>
113
-
114
- <dl-list-item clickable>
115
- <dl-item-section> Videos </dl-item-section>
116
- </dl-list-item>
117
-
118
- <dl-list-item clickable>
119
- <dl-item-section> Articles </dl-item-section>
120
- </dl-list-item>
121
- </dl-list>
122
- </dl-dropdown-button>
123
-
124
- <dl-dropdown-button
125
- disabled
126
- auto-close
127
- outlined
128
- label="Dropdown Button Outlined"
129
- >
130
- <dl-list>
131
- <dl-list-item clickable>
132
- <dl-item-section> Photos </dl-item-section>
133
- </dl-list-item>
134
-
135
- <dl-list-item clickable>
136
- <dl-item-section> Videos </dl-item-section>
137
- </dl-list-item>
138
-
139
- <dl-list-item clickable>
140
- <dl-item-section> Articles </dl-item-section>
141
- </dl-list-item>
142
- </dl-list>
143
- </dl-dropdown-button>
144
-
145
- <dl-dropdown-button
146
- auto-close
147
- label="Dropdown Button Contained"
148
- max-height="210px"
149
- >
150
- <dl-list>
151
- <dl-list-item clickable>
152
- <dl-item-section> Photos </dl-item-section>
153
- </dl-list-item>
154
-
155
- <dl-list-item clickable>
156
- <dl-item-section> Videos </dl-item-section>
157
- </dl-list-item>
158
-
159
- <dl-list-item clickable>
160
- <dl-item-section> Articles </dl-item-section>
161
- </dl-list-item>
162
- <dl-list-item clickable>
163
- <dl-item-section> Photos </dl-item-section>
164
- </dl-list-item>
165
-
166
- <dl-list-item clickable>
167
- <dl-item-section> Videos </dl-item-section>
168
- </dl-list-item>
169
-
170
- <dl-list-item clickable>
171
- <dl-item-section> Articles </dl-item-section>
172
- </dl-list-item>
173
- <dl-list-item clickable>
174
- <dl-item-section> Photos </dl-item-section>
175
- </dl-list-item>
176
-
177
- <dl-list-item clickable>
178
- <dl-item-section> Videos </dl-item-section>
179
- </dl-list-item>
180
-
181
- <dl-list-item clickable>
182
- <dl-item-section> Articles </dl-item-section>
183
- </dl-list-item>
184
- </dl-list>
185
- </dl-dropdown-button>
186
-
187
- <dl-dropdown-button
188
- auto-close
189
- :model-value="showing"
190
- :label="name"
191
- main-btn-style="width: 150px;"
192
- @show="onOpen"
193
- >
194
- <dl-list>
195
- <dl-list-item
196
- clickable
197
- @click="() => onClose('Photos')"
198
- >
199
- <dl-item-section> Photos </dl-item-section>
200
- </dl-list-item>
201
-
202
- <dl-list-item
203
- clickable
204
- @click="() => onClose('Videos and long text')"
205
- >
206
- <dl-item-section>
207
- Videos and long text Videos and long text
208
- </dl-item-section>
209
- </dl-list-item>
210
-
211
- <dl-list-item
212
- clickable
213
- @click="() => onClose('Articles')"
214
- >
215
- <dl-item-section> Articles </dl-item-section>
216
- </dl-list-item>
217
- </dl-list>
218
- </dl-dropdown-button>
219
- </div>
220
- </div>
221
- </template>
222
-
223
- <script lang="ts">
224
- import { defineComponent } from 'vue-demi'
225
- import {
226
- DlListItem,
227
- DlItemSection,
228
- DlList,
229
- DlDropdownButton
230
- } from '../components'
231
-
232
- export default defineComponent({
233
- name: 'DlDropdownButtonDemo',
234
- components: {
235
- DlListItem,
236
- DlItemSection,
237
- DlList,
238
- DlDropdownButton
239
- },
240
- data() {
241
- return {
242
- name: 'Dropdown Button Controlled',
243
- showing: false
244
- }
245
- },
246
- methods: {
247
- onClose(name: string) {
248
- this.name = name
249
- this.showing = false
250
- alert(this.name)
251
- },
252
- onOpen() {
253
- this.showing = true
254
- },
255
- onClick() {
256
- alert(this.name)
257
- }
258
- }
259
- })
260
- </script>
@@ -1,20 +0,0 @@
1
- <template>
2
- <dl-spinner
3
- text="Loading data, please wait..."
4
- :text-styles="{
5
- marginLeft: '10px',
6
- color: 'var(--dl-color-tooltip-background)'
7
- }"
8
- />
9
- </template>
10
-
11
- <script>
12
- import { defineComponent } from 'vue-demi'
13
- import { DlSpinner } from '../components'
14
-
15
- export default defineComponent({
16
- components: {
17
- DlSpinner
18
- }
19
- })
20
- </script>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes