@dataloop-ai/components 0.18.144 → 0.19.0
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 +4 -1
- package/src/assets/constants.scss +25 -26
- package/src/assets/globals.scss +58 -56
- package/src/assets/grid.css +1 -1
- package/src/assets/grid.scss +4 -4
- package/src/components/basic/DlAccordion/DlAccordion.vue +10 -3
- package/src/components/basic/DlEmptyState/types.ts +1 -1
- package/src/components/basic/DlGrid/DlGrid.vue +2 -1
- package/src/components/basic/DlPopup/DlPopup.vue +159 -396
- package/src/components/basic/DlWidget/DlWidget.vue +2 -1
- package/src/components/basic/utils.ts +0 -9
- package/src/components/blocks/DlLabelPicker/DlLabelPicker.vue +127 -0
- package/src/components/blocks/DlLabelPicker/index.ts +3 -0
- package/src/components/blocks/DlLabelPicker/types.ts +6 -0
- package/src/components/blocks/index.ts +1 -0
- package/src/components/blocks/types.ts +1 -0
- package/src/components/compound/DlCodeEditor/README.md +5 -4
- package/src/components/compound/DlCodeEditor/styles/themes-base16.css +16934 -11289
- package/src/components/compound/DlCodeEditor/styles/themes.css +5122 -3448
- package/src/components/compound/DlInput/DlInput.vue +609 -178
- package/src/components/compound/DlInput/components/InputFileElement.vue +97 -0
- package/src/components/compound/DlInput/types.ts +12 -0
- package/src/components/compound/DlInput/utils.ts +117 -0
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +10 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +12 -3
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +1 -1
- package/src/components/compound/DlSlider/sliderStyles.scss +92 -92
- package/src/components/compound/DlTable/DlTable.vue +701 -358
- package/src/components/compound/DlTable/components/DlTd.vue +11 -9
- package/src/components/compound/DlTable/components/DlTh.vue +22 -21
- package/src/components/compound/DlTable/components/SortableJS.vue +33 -0
- package/src/components/compound/DlTable/hooks/tableActions.ts +3 -3
- package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +3 -4
- package/src/components/compound/DlTable/hooks/use-sortable.ts +152 -0
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +372 -377
- package/src/components/compound/DlTable/types.ts +6 -0
- package/src/components/compound/DlTable/utils/getCellValue.ts +27 -0
- package/src/components/compound/DlTable/utils/insertAtIndex.ts +22 -0
- package/src/components/compound/DlTable/utils/tableClasses.ts +22 -0
- package/src/components/compound/DlToast/api/useToast.ts +10 -4
- package/src/components/compound/DlToast/components/ToastComponent.vue +26 -21
- package/src/components/compound/DlToast/utils/render.ts +15 -8
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +708 -323
- package/src/components/compound/DlTreeTable/components/DlTdTree.vue +10 -9
- package/src/components/compound/DlTreeTable/components/DlTrTree.vue +13 -0
- package/src/components/compound/DlTreeTable/emits.ts +2 -2
- package/src/components/compound/DlTreeTable/utils/index.ts +6 -0
- package/src/components/compound/DlTreeTable/utils/moveNestedRow.ts +95 -0
- package/src/components/compound/DlTreeTable/utils/trSpacing.ts +12 -1
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +10 -7
- package/src/components/compound/DlTreeTable/views/DlTrTreeView.vue +52 -58
- package/src/components/essential/DlMenu/DlMenu.vue +25 -0
- package/src/components/index.ts +1 -0
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +2 -1
- package/src/components/shared/DlVirtualScroll/styles/dl-virtual-scroll-styles.scss +62 -41
- package/src/components/types.ts +1 -0
- package/src/demos/DlAccordionDemo.vue +32 -0
- package/src/demos/DlButtonDemo.vue +7 -0
- package/src/demos/DlDemoPage.vue +1 -0
- package/src/demos/DlInputDemo.vue +122 -64
- package/src/demos/DlLabelPickerDemo.vue +46 -0
- package/src/demos/DlPopupDemo.vue +94 -4
- package/src/demos/DlSearchDemo.vue +0 -1
- package/src/demos/DlTableDemo.vue +261 -162
- package/src/demos/DlToastDemo.vue +28 -1
- package/src/demos/DlTreeTableDemo.vue +266 -262
- package/src/demos/DlVirtualScrollDemo.vue +1 -4
- package/src/demos/index.ts +3 -1
- package/src/hooks/use-model-toggle.ts +26 -62
- package/src/utils/browse-nested-nodes.ts +26 -0
- package/src/utils/draggable-table.ts +100 -488
- package/src/utils/get-element-above.ts +8 -0
- package/src/utils/getSlotByVersion.ts +11 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/keyCodes.ts +1 -1
- package/src/utils/remove-child-nodes.ts +5 -0
- package/src/utils/render-fn.ts +46 -0
- package/src/utils/resizable-table.ts +110 -0
- package/src/utils/selection.ts +196 -0
- package/src/utils/swap-nodes.ts +11 -0
- package/src/utils/table-columns.ts +209 -0
- package/src/components/compound/DlTable/utils/ResizableManager.ts +0 -236
- package/src/components/compound/DlTable/utils/index.ts +0 -1
- package/src/components/compound/DlTable/utils/props.ts +0 -120
- package/src/components/compound/DlTreeTable/props.ts +0 -134
- package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +0 -19
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<td
|
|
3
|
+
ref="tableTd"
|
|
3
4
|
:class="classes"
|
|
4
5
|
:style="styles"
|
|
6
|
+
:data-col-index="colIndex"
|
|
5
7
|
>
|
|
6
|
-
<
|
|
7
|
-
ref="tableTd"
|
|
8
|
-
class="dl-table-cell-inner-div"
|
|
9
|
-
>
|
|
10
|
-
<dl-tooltip v-if="hasEllipsis">
|
|
11
|
-
<slot />
|
|
12
|
-
</dl-tooltip>
|
|
8
|
+
<dl-tooltip v-if="!noTooltip && hasEllipsis">
|
|
13
9
|
<slot />
|
|
14
|
-
</
|
|
10
|
+
</dl-tooltip>
|
|
11
|
+
<slot />
|
|
15
12
|
</td>
|
|
16
13
|
</template>
|
|
17
14
|
|
|
@@ -33,7 +30,12 @@ export default defineComponent({
|
|
|
33
30
|
bgColor: {
|
|
34
31
|
type: String,
|
|
35
32
|
default: ''
|
|
36
|
-
}
|
|
33
|
+
},
|
|
34
|
+
colIndex: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
noTooltip: Boolean
|
|
37
39
|
},
|
|
38
40
|
setup(props) {
|
|
39
41
|
const vm = getCurrentInstance()
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<th
|
|
3
|
+
ref="tableTh"
|
|
3
4
|
:style="headerStyle"
|
|
4
5
|
:class="thClasses"
|
|
6
|
+
:data-col-index="colIndex"
|
|
5
7
|
@click="onClick"
|
|
6
8
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
class="
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:class="iconClass"
|
|
14
|
-
icon="icon-dl-arrow-up"
|
|
15
|
-
/>
|
|
16
|
-
<dl-tooltip v-if="hasEllipsis">
|
|
17
|
-
<slot />
|
|
18
|
-
</dl-tooltip>
|
|
9
|
+
<dl-icon
|
|
10
|
+
v-if="isSortable && align === 'right'"
|
|
11
|
+
:class="iconClass"
|
|
12
|
+
icon="icon-dl-arrow-up"
|
|
13
|
+
/>
|
|
14
|
+
<dl-tooltip v-if="hasEllipsis">
|
|
19
15
|
<slot />
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
</dl-tooltip>
|
|
17
|
+
<slot />
|
|
18
|
+
<dl-icon
|
|
19
|
+
v-if="isSortable && ['left', 'center'].includes(align)"
|
|
20
|
+
:class="iconClass"
|
|
21
|
+
icon="icon-dl-arrow-up"
|
|
22
|
+
/>
|
|
26
23
|
</th>
|
|
27
24
|
</template>
|
|
28
25
|
|
|
@@ -42,7 +39,11 @@ export default defineComponent({
|
|
|
42
39
|
},
|
|
43
40
|
props: {
|
|
44
41
|
props: { type: Object, default: null },
|
|
45
|
-
autoWidth: Boolean
|
|
42
|
+
autoWidth: Boolean,
|
|
43
|
+
colIndex: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: null
|
|
46
|
+
}
|
|
46
47
|
},
|
|
47
48
|
emits: ['click'],
|
|
48
49
|
|
|
@@ -83,10 +84,10 @@ export default defineComponent({
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
const thClasses = computed(() => {
|
|
86
|
-
let className = ''
|
|
87
|
+
let className = 'dl-th'
|
|
87
88
|
|
|
88
89
|
if (props.autoWidth) {
|
|
89
|
-
className = 'dl-table--col-auto-width'
|
|
90
|
+
className = className.concat(' dl-table--col-auto-width')
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
if (column.value.thClass) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="$props.tag"
|
|
4
|
+
v-if="isSortable"
|
|
5
|
+
ref="rootRef"
|
|
6
|
+
v-bind="props"
|
|
7
|
+
:class="$props.class"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</component>
|
|
11
|
+
<component
|
|
12
|
+
:is="$props.tag"
|
|
13
|
+
v-else
|
|
14
|
+
v-bind="props"
|
|
15
|
+
:class="$props.class"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</component>
|
|
19
|
+
</template>
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent, getCurrentInstance } from 'vue-demi'
|
|
22
|
+
import { useSortable, useSortableProps, emits } from '../hooks/use-sortable'
|
|
23
|
+
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
props: useSortableProps,
|
|
26
|
+
emits,
|
|
27
|
+
setup() {
|
|
28
|
+
const vm = getCurrentInstance()
|
|
29
|
+
const { getKey, rootRef } = useSortable(vm)
|
|
30
|
+
return { getKey, rootRef }
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
@@ -5,7 +5,7 @@ export const useTableActionsV2Props = {
|
|
|
5
5
|
type: Function,
|
|
6
6
|
default: null as Function | null
|
|
7
7
|
},
|
|
8
|
-
|
|
8
|
+
rowDoubleClick: {
|
|
9
9
|
type: Function,
|
|
10
10
|
default: null as Function | null
|
|
11
11
|
},
|
|
@@ -20,7 +20,7 @@ export const useTableActionsV3Props = {
|
|
|
20
20
|
type: Function,
|
|
21
21
|
default: null as Function | null
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
onRowDoubleClick: {
|
|
24
24
|
type: Function,
|
|
25
25
|
default: null as Function | null
|
|
26
26
|
},
|
|
@@ -40,7 +40,7 @@ export function useTableActions(props: any) {
|
|
|
40
40
|
)
|
|
41
41
|
|
|
42
42
|
const hasDblClickEvent = computed(() =>
|
|
43
|
-
Boolean(props.
|
|
43
|
+
Boolean(props.onRowDoubleClick || props.rowDoubleClick)
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
const hasContextMenuEvent = computed(() =>
|
|
@@ -5,9 +5,7 @@ import { DlTableProps, DlTableColumn, DlTableRow } from '../types'
|
|
|
5
5
|
import { TablePagination } from './tablePagination'
|
|
6
6
|
|
|
7
7
|
export const useTableColumnSelectionProps = {
|
|
8
|
-
|
|
9
|
-
visibleColumns: { type: Array, required: false, default: null as any },
|
|
10
|
-
hasVisibleColumns: Boolean
|
|
8
|
+
visibleColumns: { type: Array, required: false, default: null as any }
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export function useTableColumnSelection(
|
|
@@ -131,7 +129,8 @@ export function useTableColumnSelection(
|
|
|
131
129
|
? props.tableColspan
|
|
132
130
|
: computedCols.value.length +
|
|
133
131
|
(hasSelectionMode.value === true ? 1 : 0) +
|
|
134
|
-
(hasDraggableRows.value === true ? 1 : 0)
|
|
132
|
+
(hasDraggableRows.value === true ? 1 : 0) +
|
|
133
|
+
(props.isTreeTable ? 1 : 0)
|
|
135
134
|
})
|
|
136
135
|
|
|
137
136
|
return {
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Ref,
|
|
3
|
+
ref,
|
|
4
|
+
PropType,
|
|
5
|
+
watch,
|
|
6
|
+
onUnmounted,
|
|
7
|
+
computed,
|
|
8
|
+
useAttrs
|
|
9
|
+
} from 'vue-demi'
|
|
10
|
+
import Sortable, { SortableOptions } from 'sortablejs'
|
|
11
|
+
import type { AutoScrollOptions } from 'sortablejs/plugins'
|
|
12
|
+
|
|
13
|
+
type SortableOptionsProp = Omit<
|
|
14
|
+
SortableOptions | AutoScrollOptions,
|
|
15
|
+
| 'onUnchoose'
|
|
16
|
+
| 'onChoose'
|
|
17
|
+
| 'onStart'
|
|
18
|
+
| 'onEnd'
|
|
19
|
+
| 'onAdd'
|
|
20
|
+
| 'onUpdate'
|
|
21
|
+
| 'onSort'
|
|
22
|
+
| 'onRemove'
|
|
23
|
+
| 'onFilter'
|
|
24
|
+
| 'onMove'
|
|
25
|
+
| 'onClone'
|
|
26
|
+
| 'onChange'
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
export const emits = [
|
|
30
|
+
'unchoose',
|
|
31
|
+
'choose',
|
|
32
|
+
'start',
|
|
33
|
+
'end',
|
|
34
|
+
'add',
|
|
35
|
+
'update',
|
|
36
|
+
'sort',
|
|
37
|
+
'remove',
|
|
38
|
+
'filter',
|
|
39
|
+
'move',
|
|
40
|
+
'clone',
|
|
41
|
+
'change'
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
type ExposedProps = {
|
|
45
|
+
rootRef: Ref<HTMLDivElement | null>
|
|
46
|
+
sortable: Ref<Sortable | null>
|
|
47
|
+
isDragging: Ref<boolean>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const element = {
|
|
51
|
+
table: 'DlTable'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const useSortableProps = {
|
|
55
|
+
props: {
|
|
56
|
+
type: Object as PropType<Record<string, any>>,
|
|
57
|
+
default: () => {}
|
|
58
|
+
},
|
|
59
|
+
/** All SortableJS options are supported; events are handled by the `defineEmits` below and should be used with v-on */
|
|
60
|
+
options: {
|
|
61
|
+
type: Object as PropType<SortableOptionsProp>,
|
|
62
|
+
default: () => {}
|
|
63
|
+
},
|
|
64
|
+
/** Your list of items **/
|
|
65
|
+
list: {
|
|
66
|
+
type: [Array, Object],
|
|
67
|
+
default: () => [] as any[]
|
|
68
|
+
},
|
|
69
|
+
/** The name of the key present in each item in the list that corresponds to a unique value. */
|
|
70
|
+
itemKey: {
|
|
71
|
+
type: [String, Function] as PropType<
|
|
72
|
+
string | ((item: any) => string | number | Symbol)
|
|
73
|
+
>,
|
|
74
|
+
default: ''
|
|
75
|
+
},
|
|
76
|
+
/** The element type to render as. */
|
|
77
|
+
tag: {
|
|
78
|
+
type: String as PropType<string>,
|
|
79
|
+
default: 'div'
|
|
80
|
+
},
|
|
81
|
+
isSortable: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
className: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: ''
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function useSortable(vm: Record<string, any>) {
|
|
92
|
+
const { props, emit } = vm
|
|
93
|
+
const isDragging = ref(false)
|
|
94
|
+
const rootRef = ref<HTMLElement | null>(null)
|
|
95
|
+
const sortable = ref<Sortable | null>(null)
|
|
96
|
+
const getKey = computed(() => {
|
|
97
|
+
if (typeof props.itemKey === 'string')
|
|
98
|
+
return (item: any) => item[props.itemKey as string]
|
|
99
|
+
return props.itemKey
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
watch(rootRef, (newRootRef) => {
|
|
103
|
+
if (newRootRef) {
|
|
104
|
+
sortable.value = new Sortable(newRootRef, {
|
|
105
|
+
...props.options,
|
|
106
|
+
onChoose: (event) => emit('choose', event),
|
|
107
|
+
onUnchoose: (event) => emit('unchoose', event),
|
|
108
|
+
onStart: (event) => {
|
|
109
|
+
isDragging.value = true
|
|
110
|
+
emit('start', event)
|
|
111
|
+
},
|
|
112
|
+
onEnd: (event) => {
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
isDragging.value = false
|
|
115
|
+
emit('end', event)
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
onAdd: (event) => emit('add', event),
|
|
119
|
+
onUpdate: (event) => emit('update', event),
|
|
120
|
+
onSort: (event) => emit('sort', event),
|
|
121
|
+
onRemove: (event) => emit('remove', event),
|
|
122
|
+
onFilter: (event) => emit('filter', event),
|
|
123
|
+
onClone: (event) => emit('clone', event),
|
|
124
|
+
onChange: (event) => emit('change', event)
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
watch(
|
|
130
|
+
() => props.options,
|
|
131
|
+
(options: SortableOptionsProp) => {
|
|
132
|
+
if (options && sortable?.value) {
|
|
133
|
+
for (const property in options) {
|
|
134
|
+
sortable.value.option(
|
|
135
|
+
property as keyof SortableOptionsProp,
|
|
136
|
+
options[property as keyof SortableOptionsProp]
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
onUnmounted(() => {
|
|
144
|
+
if (sortable.value) {
|
|
145
|
+
sortable.value.destroy()
|
|
146
|
+
rootRef.value = null
|
|
147
|
+
sortable.value = null
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
return { rootRef, getKey, element }
|
|
152
|
+
}
|