@dataloop-ai/components 0.19.129 → 0.19.131

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.129",
3
+ "version": "0.19.131",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -49,6 +49,7 @@
49
49
  <dl-tooltip
50
50
  v-if="tooltip || hasTooltipSlot"
51
51
  style="pointer-events: auto"
52
+ :trigger-percentage="tooltipTriggerPercentage"
52
53
  >
53
54
  <slot name="tooltip">
54
55
  {{ tooltip }}
@@ -173,6 +174,13 @@ export default defineComponent({
173
174
  * The tooltip displayed when hovering over the button
174
175
  */
175
176
  tooltip: { type: String, default: null, required: false },
177
+ /**
178
+ * The percentage of the button's width that will trigger the tooltip
179
+ */
180
+ tooltipTriggerPercentage: {
181
+ type: Number,
182
+ default: 1
183
+ },
176
184
  /**
177
185
  * The button will maintain the styles it has when it's pressed if this prop is active
178
186
  */
@@ -1,5 +1,14 @@
1
1
  <template>
2
2
  <div>
3
+ <div style="padding-bottom: 10px">
4
+ <div>switch the disalbed prop: {{ disabledInput }}</div>
5
+ <dl-switch v-model="disabledInput" />
6
+ <dl-input
7
+ v-model="textVal"
8
+ placeholder="Test reactivity"
9
+ :disabled="disabledInput"
10
+ />
11
+ </div>
3
12
  <div>
4
13
  <input v-model="textVal">
5
14
  <div>This is to test v-model reactivity</div>
@@ -255,11 +264,12 @@
255
264
  <script lang="ts">
256
265
  import { v4 } from 'uuid'
257
266
  import { computed, defineComponent, ref } from 'vue-demi'
258
- import { DlInput, DlButton, DlIcon } from '../components'
267
+ import { DlInput, DlButton, DlIcon, DlSwitch } from '../components'
259
268
  import { DlInputFile } from '../components/compound/DlInput/types'
260
269
  export default defineComponent({
261
270
  name: 'DlInputDemo',
262
271
  components: {
272
+ DlSwitch,
263
273
  DlInput,
264
274
  DlButton,
265
275
  DlIcon
@@ -298,6 +308,8 @@ export default defineComponent({
298
308
  files.value = val
299
309
  }
300
310
 
311
+ const disabledInput = ref<boolean>(false)
312
+
301
313
  const textVal = ref<string>('test me')
302
314
 
303
315
  const trimmedValue = ref('')
@@ -305,6 +317,7 @@ export default defineComponent({
305
317
  return {
306
318
  log: console.log,
307
319
  textVal,
320
+ disabledInput,
308
321
  trimmedValue,
309
322
  textInputValue,
310
323
  passFieldValue,
@@ -85,7 +85,7 @@ export const parseSmartQuery = (
85
85
  }
86
86
  }
87
87
 
88
- const andQuery: { [key: string]: any } = {}
88
+ const andQuery: { [key: string]: any }[] = []
89
89
  let queryValue: any
90
90
 
91
91
  let key: string
@@ -106,42 +106,42 @@ export const parseSmartQuery = (
106
106
  [key, value] = term.split('>=').map((x) => x.trim())
107
107
  pureValue = GeneratePureValue(value)
108
108
  if (pureValue !== null) {
109
- andQuery[key] = { $gte: pureValue }
109
+ andQuery.push({ [key]: { $gte: pureValue } })
110
110
  }
111
111
  break
112
112
  case term.includes('<='):
113
113
  [key, value] = term.split('<=').map((x) => x.trim())
114
114
  pureValue = GeneratePureValue(value)
115
115
  if (pureValue !== null) {
116
- andQuery[key] = { $lte: pureValue }
116
+ andQuery.push({ [key]: { $lte: pureValue } })
117
117
  }
118
118
  break
119
119
  case term.includes('>'):
120
120
  [key, value] = term.split('>').map((x) => x.trim())
121
121
  pureValue = GeneratePureValue(value)
122
122
  if (pureValue !== null) {
123
- andQuery[key] = { $gt: pureValue }
123
+ andQuery.push({ [key]: { $gt: pureValue } })
124
124
  }
125
125
  break
126
126
  case term.includes('<'):
127
127
  [key, value] = term.split('<').map((x) => x.trim())
128
128
  pureValue = GeneratePureValue(value)
129
129
  if (pureValue !== null) {
130
- andQuery[key] = { $lt: pureValue }
130
+ andQuery.push({ [key]: { $lt: pureValue } })
131
131
  }
132
132
  break
133
133
  case term.includes('!='):
134
134
  [key, value] = term.split('!=').map((x) => x.trim())
135
135
  pureValue = GeneratePureValue(value)
136
136
  if (pureValue !== null) {
137
- andQuery[key] = { $ne: pureValue }
137
+ andQuery.push({ [key]: { $ne: pureValue } })
138
138
  }
139
139
  break
140
140
  case term.includes('='):
141
141
  [key, value] = term.split('=').map((x) => x.trim())
142
142
  pureValue = GeneratePureValue(value)
143
143
  if (pureValue !== null) {
144
- andQuery[key] = pureValue
144
+ andQuery.push({ [key]: pureValue })
145
145
  }
146
146
  break
147
147
  case term.includes('IN'):
@@ -159,7 +159,7 @@ export const parseSmartQuery = (
159
159
 
160
160
  pureValue = GeneratePureValue(queryValue)
161
161
  if (pureValue !== null && Array.isArray(pureValue)) {
162
- andQuery[key] = { $nin: pureValue }
162
+ andQuery.push({ [key]: { $nin: pureValue } })
163
163
  }
164
164
  } else {
165
165
  queryValue = term
@@ -171,14 +171,24 @@ export const parseSmartQuery = (
171
171
 
172
172
  pureValue = GeneratePureValue(queryValue)
173
173
  if (pureValue !== null && Array.isArray(pureValue)) {
174
- andQuery[key] = { $in: pureValue }
174
+ andQuery.push({ [key]: { $in: pureValue } })
175
175
  }
176
176
  }
177
177
  break
178
178
  }
179
179
  }
180
180
 
181
- orTerms.push(andQuery)
181
+ const simlifiedAndQuery: { [key: string]: any } = {}
182
+ for (const term of andQuery) {
183
+ const key = Object.keys(term)[0]
184
+ simlifiedAndQuery[key] = term[key]
185
+ }
186
+
187
+ orTerms.push(
188
+ andQuery.length > Object.keys(simlifiedAndQuery).length
189
+ ? { $and: andQuery }
190
+ : simlifiedAndQuery
191
+ )
182
192
  }
183
193
 
184
194
  const builtQuery = orTerms.length > 1 ? { $or: orTerms } : orTerms[0]
@@ -211,14 +221,13 @@ export const stringifySmartQuery = (query: { [key: string]: any }): string => {
211
221
 
212
222
  if (key === '$and') {
213
223
  if (Array.isArray(value)) {
214
- const andObject: { [key: string]: any } = {}
215
- for (const subQuery of value) {
216
- for (const subKey in subQuery) {
217
- andObject[subKey] = subQuery[subKey]
218
- }
219
- }
220
- return stringifySmartQuery(andObject)
224
+ const subQueries = value.map(
225
+ (subQuery: { [key: string]: any }) =>
226
+ stringifySmartQuery(subQuery)
227
+ )
228
+ result += subQueries.join(' AND ')
221
229
  }
230
+ continue
222
231
  }
223
232
 
224
233
  if (result.length) {