@dataloop-ai/components 0.20.100 → 0.20.102
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.20.
|
|
3
|
+
"version": "0.20.102",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./index.ts",
|
|
6
6
|
"./models": "./models.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@dataloop-ai/icons": "^3.0.
|
|
26
|
+
"@dataloop-ai/icons": "^3.0.191",
|
|
27
27
|
"@types/flat": "^5.0.2",
|
|
28
28
|
"@types/lodash": "^4.14.184",
|
|
29
29
|
"@types/sortablejs": "^1.15.7",
|
|
@@ -246,7 +246,7 @@ export default defineComponent({
|
|
|
246
246
|
default: () => [] as string[]
|
|
247
247
|
},
|
|
248
248
|
operatorsOverride: {
|
|
249
|
-
type: Object as PropType<{[name: string]: string[]}>,
|
|
249
|
+
type: Object as PropType<{ [name: string]: string[] }>,
|
|
250
250
|
default: () => ({})
|
|
251
251
|
},
|
|
252
252
|
forbiddenKeys: {
|
|
@@ -335,28 +335,7 @@ export default defineComponent({
|
|
|
335
335
|
|
|
336
336
|
showSuggestions.value = false
|
|
337
337
|
|
|
338
|
-
|
|
339
|
-
const dotOrCommaRegEx = /\s+([\.|\,]\s?)$/
|
|
340
|
-
const dotOrCommaMatch = value.match(dotOrCommaRegEx)
|
|
341
|
-
if (dotOrCommaMatch) {
|
|
342
|
-
value = value.replace(dotOrCommaRegEx, dotOrCommaMatch[1])
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// to handle date suggestion modal to open automatically.
|
|
346
|
-
if (value.includes(dateSuggestionPattern)) {
|
|
347
|
-
value = value.trimEnd()
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const specialSuggestions = suggestions.value.filter(
|
|
351
|
-
(suggestion) =>
|
|
352
|
-
typeof suggestion === 'string' && suggestion.startsWith('.')
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
for (const suggestion of specialSuggestions) {
|
|
356
|
-
if (value.includes(suggestion)) {
|
|
357
|
-
value = value.replace(` ${suggestion}`, suggestion)
|
|
358
|
-
}
|
|
359
|
-
}
|
|
338
|
+
value = _normalizeInputValue(value)
|
|
360
339
|
|
|
361
340
|
searchQuery.value = value
|
|
362
341
|
|
|
@@ -408,6 +387,43 @@ export default defineComponent({
|
|
|
408
387
|
}
|
|
409
388
|
}
|
|
410
389
|
|
|
390
|
+
const _normalizeInputValue = (value: string): string => {
|
|
391
|
+
// Normalize logical operators (' and ' -> ' AND ', ' or ' -> ' OR ')
|
|
392
|
+
const logicalOperatorsRegEx = /\s(and|or)\s/g
|
|
393
|
+
const logicalMatch = value.match(logicalOperatorsRegEx)
|
|
394
|
+
if (logicalMatch) {
|
|
395
|
+
value = value.replace(
|
|
396
|
+
logicalOperatorsRegEx,
|
|
397
|
+
(_, match) => ` ${match.toUpperCase()} `
|
|
398
|
+
)
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Handle typing '.' or ',' after accepting a suggestion
|
|
402
|
+
const dotOrCommaRegEx = /\s+([.,]\s?)$/
|
|
403
|
+
const dotOrCommaMatch = value.match(dotOrCommaRegEx)
|
|
404
|
+
if (dotOrCommaMatch) {
|
|
405
|
+
value = value.replace(dotOrCommaRegEx, dotOrCommaMatch[1])
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Handle date suggestion modal to open automatically.
|
|
409
|
+
if (value.includes(dateSuggestionPattern)) {
|
|
410
|
+
value = value.trimEnd()
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Handle special suggestions (suggestions that start with '.')
|
|
414
|
+
const specialSuggestions = suggestions.value.filter(
|
|
415
|
+
(suggestion) =>
|
|
416
|
+
typeof suggestion === 'string' && suggestion.startsWith('.')
|
|
417
|
+
)
|
|
418
|
+
for (const suggestion of specialSuggestions) {
|
|
419
|
+
if (value.includes(suggestion)) {
|
|
420
|
+
value = value.replace(` ${suggestion}`, suggestion)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return value
|
|
425
|
+
}
|
|
426
|
+
|
|
411
427
|
const setInputFromSuggestion = (suggestion: any) => {
|
|
412
428
|
const value = '' + suggestion
|
|
413
429
|
let stringValue = ''
|
|
@@ -639,18 +655,7 @@ export default defineComponent({
|
|
|
639
655
|
}
|
|
640
656
|
|
|
641
657
|
const endsWithOperator = computed(() => {
|
|
642
|
-
const operators = [
|
|
643
|
-
'>=',
|
|
644
|
-
'<=',
|
|
645
|
-
'!=',
|
|
646
|
-
'=',
|
|
647
|
-
'>',
|
|
648
|
-
'<',
|
|
649
|
-
'IN',
|
|
650
|
-
'NOT-IN',
|
|
651
|
-
'EXISTS',
|
|
652
|
-
'DOESNT-EXIST'
|
|
653
|
-
]
|
|
658
|
+
const operators = ['>=', '<=', '!=', '=', '>', '<', 'IN', 'NOT-IN']
|
|
654
659
|
|
|
655
660
|
for (const op of operators) {
|
|
656
661
|
if (
|
|
@@ -689,7 +694,9 @@ export default defineComponent({
|
|
|
689
694
|
const onPaste = (e: ClipboardEvent) => {
|
|
690
695
|
const selection = window.getSelection()
|
|
691
696
|
if (selection.rangeCount) {
|
|
692
|
-
let text = (
|
|
697
|
+
let text = (
|
|
698
|
+
e.clipboardData || (window as any).clipboardData
|
|
699
|
+
).getData('text')
|
|
693
700
|
if (text?.length > 0) {
|
|
694
701
|
const range = selection.getRangeAt(0)
|
|
695
702
|
|
|
@@ -701,19 +708,27 @@ export default defineComponent({
|
|
|
701
708
|
|
|
702
709
|
const stringOperators = getStringOperators()
|
|
703
710
|
if (
|
|
704
|
-
new RegExp(
|
|
711
|
+
new RegExp(
|
|
712
|
+
`(,|\\s(${stringOperators.join('|')}))\\s*$`
|
|
713
|
+
).test(preceedingText) &&
|
|
705
714
|
!/^\s*['"]/.test(text) &&
|
|
706
715
|
isNaN(Number(text)) &&
|
|
707
|
-
text !==
|
|
708
|
-
text !==
|
|
716
|
+
text !== 'false' &&
|
|
717
|
+
text !== 'true'
|
|
709
718
|
) {
|
|
710
719
|
text = enquoteString(text)
|
|
711
720
|
}
|
|
712
721
|
|
|
713
722
|
selection.deleteFromDocument()
|
|
714
|
-
selection
|
|
715
|
-
|
|
716
|
-
|
|
723
|
+
selection
|
|
724
|
+
.getRangeAt(0)
|
|
725
|
+
.insertNode(
|
|
726
|
+
document.createTextNode(
|
|
727
|
+
(preceedingText.endsWith(' ') ? '' : ' ') +
|
|
728
|
+
text +
|
|
729
|
+
' '
|
|
730
|
+
)
|
|
731
|
+
)
|
|
717
732
|
selection.collapseToEnd()
|
|
718
733
|
|
|
719
734
|
e.preventDefault()
|
|
@@ -893,7 +908,11 @@ export default defineComponent({
|
|
|
893
908
|
|
|
894
909
|
//#region computed
|
|
895
910
|
const editorStyle = computed((): SyntaxColorSchema => {
|
|
896
|
-
return createColorSchema(
|
|
911
|
+
return createColorSchema(
|
|
912
|
+
colorSchema.value,
|
|
913
|
+
aliases.value,
|
|
914
|
+
schema.value
|
|
915
|
+
)
|
|
897
916
|
})
|
|
898
917
|
|
|
899
918
|
const defaultIcon = 'icon-dl-stars'
|
|
@@ -290,6 +290,8 @@ export default defineComponent({
|
|
|
290
290
|
const denseState = ref([])
|
|
291
291
|
const resizableState = ref([])
|
|
292
292
|
const hasFlatTreeData = true
|
|
293
|
+
const draggedRow = ref<DlTableRow | null>(null)
|
|
294
|
+
const targetRow = ref<DlTableRow | null>(null)
|
|
293
295
|
|
|
294
296
|
const vue2h = ref()
|
|
295
297
|
|
|
@@ -553,7 +555,7 @@ export default defineComponent({
|
|
|
553
555
|
onUpdateExpandedRow: () =>
|
|
554
556
|
updateExpandedRow(!row.isExpanded, getRowKey.value(row)),
|
|
555
557
|
on: {
|
|
556
|
-
'update:
|
|
558
|
+
'update:model-value': (adding: boolean, evt: Event) => {
|
|
557
559
|
updateSelectionHierarchy(adding, evt, row)
|
|
558
560
|
},
|
|
559
561
|
rowClick: (event: Event, row: any, index: number) => {
|
|
@@ -656,10 +658,16 @@ export default defineComponent({
|
|
|
656
658
|
}
|
|
657
659
|
|
|
658
660
|
const handleEndEvent = (event: SortableJs.SortableEvent) => {
|
|
661
|
+
emit('row-drag-end', {
|
|
662
|
+
draggedRow: draggedRow.value,
|
|
663
|
+
targetRow: targetRow.value
|
|
664
|
+
})
|
|
659
665
|
emit(
|
|
660
666
|
'row-reorder',
|
|
661
667
|
moveNestedRow(tableRows.value, event, sortingMovement.value)
|
|
662
668
|
)
|
|
669
|
+
draggedRow.value = null
|
|
670
|
+
targetRow.value = null
|
|
663
671
|
mainTableKey.value = v4()
|
|
664
672
|
}
|
|
665
673
|
|
|
@@ -669,6 +677,17 @@ export default defineComponent({
|
|
|
669
677
|
originalEvent.srcElement,
|
|
670
678
|
'dl-tr'
|
|
671
679
|
) as HTMLElement
|
|
680
|
+
if (passedElement) {
|
|
681
|
+
const targetRowId = passedElement.dataset.id
|
|
682
|
+
targetRow.value =
|
|
683
|
+
tableRows.value.find(
|
|
684
|
+
(row) => getRowKey.value(row) === targetRowId
|
|
685
|
+
) || null
|
|
686
|
+
emit('row-drag-over', {
|
|
687
|
+
draggedRow: draggedRow.value,
|
|
688
|
+
targetRow: targetRow.value
|
|
689
|
+
})
|
|
690
|
+
}
|
|
672
691
|
const currentY = originalEvent.clientY
|
|
673
692
|
if (currentY > prevMouseY) {
|
|
674
693
|
sortingMovement.value.direction = 'down'
|
|
@@ -679,8 +698,16 @@ export default defineComponent({
|
|
|
679
698
|
sortingMovement.value.lastId = passedElement.dataset.id
|
|
680
699
|
}
|
|
681
700
|
|
|
682
|
-
const handleStartEvent = (event: any) =>
|
|
683
|
-
|
|
701
|
+
const handleStartEvent = (event: any) => {
|
|
702
|
+
prevMouseY = event.originalEvent.clientY
|
|
703
|
+
const rowIndex = event.oldIndex
|
|
704
|
+
if (rowIndex !== undefined && rowIndex >= 0) {
|
|
705
|
+
draggedRow.value = tableRows.value[rowIndex] || null
|
|
706
|
+
emit('row-drag-start', {
|
|
707
|
+
draggedRow: draggedRow.value
|
|
708
|
+
})
|
|
709
|
+
}
|
|
710
|
+
}
|
|
684
711
|
|
|
685
712
|
const updateColumns = (newColumns: DlTableColumn[]) => {
|
|
686
713
|
emit('col-update', newColumns)
|
|
@@ -16,7 +16,7 @@ export const useTreeTableRowSelectionProps = {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const useTreeTableRowSelectionEmits = ['selection', 'selected-
|
|
19
|
+
export const useTreeTableRowSelectionEmits = ['selection', 'selected-items']
|
|
20
20
|
|
|
21
21
|
export function useTreeTableRowSelection(
|
|
22
22
|
props: DlTableProps,
|
|
@@ -119,7 +119,7 @@ export function useTreeTableRowSelection(
|
|
|
119
119
|
const { selectedItems } = convertToNestedObject(payload)
|
|
120
120
|
selectedItemsNested.value = selectedItems
|
|
121
121
|
|
|
122
|
-
emit('
|
|
122
|
+
emit('selected-items', selectedItems)
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
function isIncludedInSelectedNestedItems(
|