@dataloop-ai/components 0.18.145 → 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 +3 -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,18 +1,15 @@
|
|
|
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
|
-
|
|
8
|
-
class="dl-table-cell-inner-div"
|
|
9
|
-
>
|
|
10
|
-
<slot name="icon" />
|
|
11
|
-
<dl-tooltip v-if="hasEllipsis">
|
|
12
|
-
<slot />
|
|
13
|
-
</dl-tooltip>
|
|
8
|
+
<slot name="icon" />
|
|
9
|
+
<dl-tooltip v-if="hasEllipsis">
|
|
14
10
|
<slot />
|
|
15
|
-
</
|
|
11
|
+
</dl-tooltip>
|
|
12
|
+
<slot />
|
|
16
13
|
</td>
|
|
17
14
|
</template>
|
|
18
15
|
|
|
@@ -38,6 +35,10 @@ export default defineComponent({
|
|
|
38
35
|
bgColor: {
|
|
39
36
|
type: String,
|
|
40
37
|
default: ''
|
|
38
|
+
},
|
|
39
|
+
colIndex: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: null
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
44
|
setup(props) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<tr
|
|
3
3
|
ref="dlTrTreeRef"
|
|
4
|
+
:data-level="props.row.level"
|
|
5
|
+
:data-id="props.row.id"
|
|
4
6
|
:class="trClasses"
|
|
5
7
|
v-bind="$attrs"
|
|
6
8
|
v-on="listeners"
|
|
@@ -11,6 +13,7 @@
|
|
|
11
13
|
|
|
12
14
|
<script lang="ts">
|
|
13
15
|
import { defineComponent, isVue2 } from 'vue-demi'
|
|
16
|
+
import { DlTableRow } from '../../types'
|
|
14
17
|
|
|
15
18
|
export default defineComponent({
|
|
16
19
|
name: 'DlTrTree',
|
|
@@ -54,7 +57,17 @@ export default defineComponent({
|
|
|
54
57
|
return classes
|
|
55
58
|
}
|
|
56
59
|
},
|
|
60
|
+
|
|
57
61
|
watch: {
|
|
62
|
+
'props.row': {
|
|
63
|
+
handler(row: DlTableRow) {
|
|
64
|
+
(this.$refs.dlTrTreeRef as any).setAttribute(
|
|
65
|
+
'data-is-visible',
|
|
66
|
+
row.isExpandedParent || row.level === 1
|
|
67
|
+
)
|
|
68
|
+
},
|
|
69
|
+
deep: true
|
|
70
|
+
},
|
|
58
71
|
childrenComputed(value) {
|
|
59
72
|
(this.$refs.dlTrTreeRef as any).setAttribute(
|
|
60
73
|
'data-children',
|
|
@@ -5,10 +5,10 @@ export const emits = [
|
|
|
5
5
|
'request',
|
|
6
6
|
'virtual-scroll',
|
|
7
7
|
'row-reorder',
|
|
8
|
-
'col-
|
|
8
|
+
'col-update',
|
|
9
9
|
'row-click',
|
|
10
10
|
'th-click',
|
|
11
|
-
'row-
|
|
11
|
+
'row-double-click',
|
|
12
12
|
'row-contextmenu',
|
|
13
13
|
'update-visible-columns',
|
|
14
14
|
...useTableRowExpandEmits,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { SortableEvent } from 'sortablejs'
|
|
2
|
+
import { SortingMovement } from '../../types'
|
|
3
|
+
|
|
4
|
+
interface NestedObject {
|
|
5
|
+
id: string
|
|
6
|
+
children?: NestedObject[]
|
|
7
|
+
[key: string]: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function moveNestedRow(
|
|
11
|
+
rows: any[],
|
|
12
|
+
event: SortableEvent,
|
|
13
|
+
sortingMovement: SortingMovement
|
|
14
|
+
) {
|
|
15
|
+
const sourceId = event.item.querySelector('tr').dataset.id
|
|
16
|
+
const { lastId, direction } = sortingMovement
|
|
17
|
+
return moveItem(rows, sourceId, lastId, direction)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function moveItem(
|
|
21
|
+
objects: NestedObject[],
|
|
22
|
+
sourceId: string,
|
|
23
|
+
targetId: string,
|
|
24
|
+
direction: 'up' | 'down'
|
|
25
|
+
): NestedObject[] {
|
|
26
|
+
const findItemAndParent = (
|
|
27
|
+
items: NestedObject[],
|
|
28
|
+
id: string,
|
|
29
|
+
parent: NestedObject | null = null
|
|
30
|
+
): { item: NestedObject | null; parent: NestedObject | null } => {
|
|
31
|
+
for (const item of items) {
|
|
32
|
+
if (item.id === id) {
|
|
33
|
+
return { item, parent }
|
|
34
|
+
}
|
|
35
|
+
if (item.children) {
|
|
36
|
+
const result = findItemAndParent(item.children, id, item)
|
|
37
|
+
if (result.item) {
|
|
38
|
+
return result
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { item: null, parent }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const cloneObjects = (objectsToClone: NestedObject[]): NestedObject[] => {
|
|
46
|
+
return objectsToClone.map((obj) => ({ ...obj }))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const rootObjects = cloneObjects(objects)
|
|
50
|
+
const { item: sourceItem, parent: sourceParent } = findItemAndParent(
|
|
51
|
+
rootObjects,
|
|
52
|
+
sourceId
|
|
53
|
+
)
|
|
54
|
+
const { item: targetItem, parent: targetParent } = findItemAndParent(
|
|
55
|
+
rootObjects,
|
|
56
|
+
targetId
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if (!sourceItem || !targetItem) {
|
|
60
|
+
return rootObjects
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (sourceItem === targetItem) {
|
|
64
|
+
return rootObjects
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (sourceParent) {
|
|
68
|
+
const sourceIndex = sourceParent.children!.findIndex(
|
|
69
|
+
(child) => child.id === sourceId
|
|
70
|
+
)
|
|
71
|
+
if (sourceIndex !== -1) {
|
|
72
|
+
sourceParent.children!.splice(sourceIndex, 1)
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
const sourceIndex = rootObjects.findIndex(
|
|
76
|
+
(item) => item.id === sourceId
|
|
77
|
+
)
|
|
78
|
+
if (sourceIndex !== -1) {
|
|
79
|
+
rootObjects.splice(sourceIndex, 1)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const targetIndex = targetParent
|
|
83
|
+
? targetParent.children!.findIndex((child) => child.id === targetId)
|
|
84
|
+
: rootObjects.findIndex((item) => item.id === targetId)
|
|
85
|
+
|
|
86
|
+
const insertIndex = direction === 'up' ? targetIndex : targetIndex + 1
|
|
87
|
+
|
|
88
|
+
if (targetParent) {
|
|
89
|
+
targetParent.children!.splice(insertIndex, 0, sourceItem)
|
|
90
|
+
} else {
|
|
91
|
+
rootObjects.splice(insertIndex, 0, sourceItem)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return rootObjects
|
|
95
|
+
}
|
|
@@ -10,4 +10,15 @@ const setTrSpacing = (item: Record<string, any>) => {
|
|
|
10
10
|
return `padding-left: ${paddingLeft}px;`
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const setTrPadding = (level = 1, hasChildren = false, colIndex = 0) => {
|
|
14
|
+
let paddingLeft = 0
|
|
15
|
+
|
|
16
|
+
if (colIndex == 0) {
|
|
17
|
+
paddingLeft = (level - 1) * 16
|
|
18
|
+
return paddingLeft
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return paddingLeft
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { setTrSpacing, setTrPadding }
|
|
@@ -16,7 +16,7 @@ export const useTreeTableRowSelectionProps = {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const useTreeTableRowSelectionEmits = ['selection', '
|
|
19
|
+
export const useTreeTableRowSelectionEmits = ['selection', 'selected-iitems']
|
|
20
20
|
|
|
21
21
|
export function useTreeTableRowSelection(
|
|
22
22
|
props: DlTableProps,
|
|
@@ -49,21 +49,23 @@ export function useTreeTableRowSelection(
|
|
|
49
49
|
return props.selection === 'multiple'
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
const allRowsSelected = computed(
|
|
53
|
-
(
|
|
52
|
+
const allRowsSelected = computed(() => {
|
|
53
|
+
return (
|
|
54
54
|
computedRows.value.length > 0 &&
|
|
55
55
|
computedRows.value.every(
|
|
56
56
|
(row) => selectedKeys.value[getRowKey.value(row)] === true
|
|
57
57
|
)
|
|
58
|
-
|
|
58
|
+
)
|
|
59
|
+
})
|
|
59
60
|
|
|
60
|
-
const someRowsSelected = computed(
|
|
61
|
-
(
|
|
61
|
+
const someRowsSelected = computed(() => {
|
|
62
|
+
return (
|
|
62
63
|
allRowsSelected.value !== true &&
|
|
63
64
|
computedRows.value.some(
|
|
64
65
|
(row) => selectedKeys.value[getRowKey.value(row)] === true
|
|
65
66
|
)
|
|
66
|
-
|
|
67
|
+
)
|
|
68
|
+
})
|
|
67
69
|
|
|
68
70
|
const rowsSelectedNumber = computed(() => selectedRows.value.length)
|
|
69
71
|
|
|
@@ -82,6 +84,7 @@ export function useTreeTableRowSelection(
|
|
|
82
84
|
evt?: (event: string, val: any) => void
|
|
83
85
|
) {
|
|
84
86
|
emit('selection', { rows, added, keys, evt })
|
|
87
|
+
|
|
85
88
|
/*
|
|
86
89
|
const payload =
|
|
87
90
|
singleSelection.value === true
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<DlTrTree
|
|
3
|
-
v-show="row.isExpandedParent || row.level === 1"
|
|
4
3
|
:class="rowClass"
|
|
5
4
|
:no-hover="noHover"
|
|
6
5
|
:children="childrenCount"
|
|
6
|
+
:props="{ row }"
|
|
7
7
|
@click="emitRowClick($event, row, rowIndex)"
|
|
8
8
|
@dblclick="onTrDoubleClick($event, row, rowIndex)"
|
|
9
9
|
@contextmenu="onTrContextMenu($event, row, rowIndex)"
|
|
10
|
+
@mouseenter="isDragIconVisible = true"
|
|
11
|
+
@mouseleave="isDragIconVisible = false"
|
|
10
12
|
>
|
|
11
|
-
<td
|
|
13
|
+
<td
|
|
14
|
+
v-if="hasDraggableRows"
|
|
15
|
+
:style="`width: 25px; opacity: ${isDragIconVisible ? '1' : '0'}`"
|
|
16
|
+
>
|
|
12
17
|
<dl-icon
|
|
13
18
|
class="draggable-icon"
|
|
14
19
|
icon="icon-dl-drag"
|
|
15
20
|
size="12px"
|
|
16
21
|
/>
|
|
17
22
|
</td>
|
|
23
|
+
<td class="chevron-icon">
|
|
24
|
+
<DlIcon
|
|
25
|
+
v-if="(row.children || []).length > 0"
|
|
26
|
+
:icon="`icon-dl-${row.isExpanded ? 'down' : 'right'}-chevron`"
|
|
27
|
+
@click="emitUpdateExpandedRow"
|
|
28
|
+
/>
|
|
29
|
+
</td>
|
|
18
30
|
<td
|
|
19
31
|
v-if="hasSelectionMode"
|
|
20
32
|
class="dl-table--col-auto-with"
|
|
@@ -40,16 +52,18 @@
|
|
|
40
52
|
v-for="(col, colIndex) in computedCols"
|
|
41
53
|
:key="colIndex"
|
|
42
54
|
:class="col.tdClass(row)"
|
|
43
|
-
:style="
|
|
55
|
+
:style="
|
|
56
|
+
col.tdStyle(row) +
|
|
57
|
+
`padding-left: ${
|
|
58
|
+
setTrPadding(
|
|
59
|
+
level,
|
|
60
|
+
(row.children || []).length > 0,
|
|
61
|
+
colIndex
|
|
62
|
+
) + 1
|
|
63
|
+
}px;`
|
|
64
|
+
"
|
|
65
|
+
:col-index="colIndex"
|
|
44
66
|
>
|
|
45
|
-
<template #icon="{}">
|
|
46
|
-
<DlIcon
|
|
47
|
-
v-if="(row.children || []).length > 0 && colIndex === 0"
|
|
48
|
-
style="margin-right: 5px"
|
|
49
|
-
:icon="`icon-dl-${row.expanded ? 'down' : 'right'}-chevron`"
|
|
50
|
-
@click="emitUpdateExpandedRow"
|
|
51
|
-
/>
|
|
52
|
-
</template>
|
|
53
67
|
<template v-if="!hasSlotByName(`body-cell-${col.name}`)">
|
|
54
68
|
{{ getCellValue(col, row) }}
|
|
55
69
|
</template>
|
|
@@ -70,7 +84,8 @@ import {
|
|
|
70
84
|
onMounted,
|
|
71
85
|
ref,
|
|
72
86
|
toRefs,
|
|
73
|
-
watch
|
|
87
|
+
watch,
|
|
88
|
+
getCurrentInstance
|
|
74
89
|
} from 'vue-demi'
|
|
75
90
|
import DlTrTree from '../components/DlTrTree.vue'
|
|
76
91
|
import DlTdTree from '../components/DlTdTree.vue'
|
|
@@ -78,7 +93,8 @@ import DlIcon from '../../../essential/DlIcon/DlIcon.vue'
|
|
|
78
93
|
import DlCheckbox from '../../../essential/DlCheckbox/DlCheckbox.vue'
|
|
79
94
|
import { getRowKey } from '../utils/getRowKey'
|
|
80
95
|
import { DlTableRow } from '../../DlTable/types'
|
|
81
|
-
import {
|
|
96
|
+
import { setTrPadding } from '../utils/trSpacing'
|
|
97
|
+
import { getCellValue } from '../../DlTable/utils/getCellValue'
|
|
82
98
|
|
|
83
99
|
export default defineComponent({
|
|
84
100
|
name: 'DlTrTreeView',
|
|
@@ -108,6 +124,10 @@ export default defineComponent({
|
|
|
108
124
|
type: Boolean,
|
|
109
125
|
default: false
|
|
110
126
|
},
|
|
127
|
+
level: {
|
|
128
|
+
type: Number,
|
|
129
|
+
default: 1
|
|
130
|
+
},
|
|
111
131
|
rowIndex: {
|
|
112
132
|
type: Number,
|
|
113
133
|
required: true
|
|
@@ -139,35 +159,22 @@ export default defineComponent({
|
|
|
139
159
|
modelValue: {
|
|
140
160
|
type: [String, Boolean],
|
|
141
161
|
default: null
|
|
142
|
-
},
|
|
143
|
-
slotName: {
|
|
144
|
-
type: String,
|
|
145
|
-
default: null
|
|
146
|
-
},
|
|
147
|
-
computedRows: {
|
|
148
|
-
type: Array as PropType<DlTableRow[]>,
|
|
149
|
-
default: () => [] as DlTableRow[]
|
|
150
|
-
},
|
|
151
|
-
cellValue: {
|
|
152
|
-
type: String,
|
|
153
|
-
default: null
|
|
154
|
-
},
|
|
155
|
-
slotsProps: {
|
|
156
|
-
type: Object as PropType<Record<string, any>>,
|
|
157
|
-
default: () => ({})
|
|
158
162
|
}
|
|
159
163
|
},
|
|
160
|
-
|
|
164
|
+
emits: [
|
|
161
165
|
'rowClick',
|
|
162
|
-
'
|
|
166
|
+
'rowDoubleClick',
|
|
163
167
|
'rowContextMenu',
|
|
164
168
|
'update:model-value',
|
|
165
169
|
'updateExpandedRow'
|
|
166
170
|
],
|
|
167
171
|
setup(props, context) {
|
|
168
|
-
const visibleChildren = ref(
|
|
169
|
-
const childrenCount = ref(
|
|
172
|
+
const visibleChildren = ref(0)
|
|
173
|
+
const childrenCount = ref(0)
|
|
170
174
|
const { row } = toRefs(props)
|
|
175
|
+
const isDragIconVisible = ref(false)
|
|
176
|
+
|
|
177
|
+
const vm = getCurrentInstance()
|
|
171
178
|
|
|
172
179
|
watch(
|
|
173
180
|
row,
|
|
@@ -208,19 +215,10 @@ export default defineComponent({
|
|
|
208
215
|
context.emit('update:model-value', adding, evt)
|
|
209
216
|
}
|
|
210
217
|
|
|
211
|
-
const getTdStyles = (
|
|
212
|
-
row: (typeof props.computedRows)[number],
|
|
213
|
-
colIndex: number
|
|
214
|
-
) => {
|
|
218
|
+
const getTdStyles = (row: any, colIndex: number) => {
|
|
215
219
|
let styles = ''
|
|
216
220
|
if (colIndex === 0) {
|
|
217
221
|
styles = 'max-width: 100px; box-sizing: border-box;'
|
|
218
|
-
styles =
|
|
219
|
-
styles +
|
|
220
|
-
setTrSpacing({
|
|
221
|
-
...row,
|
|
222
|
-
colIndex
|
|
223
|
-
})
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
return styles
|
|
@@ -228,19 +226,6 @@ export default defineComponent({
|
|
|
228
226
|
const emitUpdateExpandedRow = () => {
|
|
229
227
|
context.emit('updateExpandedRow')
|
|
230
228
|
}
|
|
231
|
-
const getCellValue = (
|
|
232
|
-
col: Record<string, any>,
|
|
233
|
-
row: Record<string, any>
|
|
234
|
-
) => {
|
|
235
|
-
if (!col) {
|
|
236
|
-
return
|
|
237
|
-
}
|
|
238
|
-
const val =
|
|
239
|
-
typeof col?.field === 'function'
|
|
240
|
-
? col.field(row)
|
|
241
|
-
: row[col.field]
|
|
242
|
-
return col?.format !== void 0 ? col.format(val, row) : val
|
|
243
|
-
}
|
|
244
229
|
|
|
245
230
|
const hasSlotByName = (name: string) => !!context.slots[name]
|
|
246
231
|
|
|
@@ -258,7 +243,7 @@ export default defineComponent({
|
|
|
258
243
|
return ' cursor-pointer'
|
|
259
244
|
}
|
|
260
245
|
|
|
261
|
-
return ''
|
|
246
|
+
return 'dl-tr'
|
|
262
247
|
}
|
|
263
248
|
|
|
264
249
|
const getExpandedvisibleChildren = (): void => {
|
|
@@ -320,12 +305,14 @@ export default defineComponent({
|
|
|
320
305
|
return {
|
|
321
306
|
visibleChildren,
|
|
322
307
|
childrenCount,
|
|
308
|
+
isDragIconVisible,
|
|
323
309
|
getRowKey,
|
|
324
310
|
emitRowClick,
|
|
325
311
|
onTrDoubleClick,
|
|
326
312
|
onTrContextMenu,
|
|
327
313
|
emitUpdateModelValue,
|
|
328
314
|
getTdStyles,
|
|
315
|
+
setTrPadding,
|
|
329
316
|
emitUpdateExpandedRow,
|
|
330
317
|
getCellValue,
|
|
331
318
|
hasSlotByName,
|
|
@@ -338,4 +325,11 @@ export default defineComponent({
|
|
|
338
325
|
})
|
|
339
326
|
</script>
|
|
340
327
|
|
|
341
|
-
<style scoped
|
|
328
|
+
<style scoped lang="scss">
|
|
329
|
+
@import '../../DlTable/styles/dl-table-styles.scss';
|
|
330
|
+
.chevron-icon {
|
|
331
|
+
cursor: pointer;
|
|
332
|
+
width: 25px;
|
|
333
|
+
padding: 5px;
|
|
334
|
+
}
|
|
335
|
+
</style>
|
|
@@ -210,6 +210,8 @@ export default defineComponent({
|
|
|
210
210
|
(props.square === true ? ' dl-menu--square' : '')
|
|
211
211
|
)
|
|
212
212
|
|
|
213
|
+
const isInitialized = ref(false)
|
|
214
|
+
|
|
213
215
|
const { hide } = useModelToggle({
|
|
214
216
|
showing,
|
|
215
217
|
canShow,
|
|
@@ -356,6 +358,8 @@ export default defineComponent({
|
|
|
356
358
|
conditionalHandler(!hiding, () => {
|
|
357
359
|
refocusTarget = null
|
|
358
360
|
})
|
|
361
|
+
|
|
362
|
+
isInitialized.value = false
|
|
359
363
|
}
|
|
360
364
|
|
|
361
365
|
function configureScrollTarget() {
|
|
@@ -396,6 +400,27 @@ export default defineComponent({
|
|
|
396
400
|
return
|
|
397
401
|
}
|
|
398
402
|
|
|
403
|
+
if ((vm.parent.proxy as any).draggable) {
|
|
404
|
+
if (!isInitialized.value) {
|
|
405
|
+
isInitialized.value = true
|
|
406
|
+
setPosition({
|
|
407
|
+
el,
|
|
408
|
+
offset: props.offset as number[],
|
|
409
|
+
anchorEl: anchorEl.value as HTMLElement,
|
|
410
|
+
anchorOrigin: anchorOrigin.value,
|
|
411
|
+
selfOrigin: selfOrigin.value,
|
|
412
|
+
absoluteOffset,
|
|
413
|
+
fitContainer: props.fitContainer,
|
|
414
|
+
fitContent: props.fitContent,
|
|
415
|
+
cover: props.cover,
|
|
416
|
+
maxHeight: props.maxHeight,
|
|
417
|
+
maxWidth: props.maxWidth
|
|
418
|
+
})
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return
|
|
422
|
+
}
|
|
423
|
+
|
|
399
424
|
const isAnchorElVisible = await CheckAnchorElVisibility(
|
|
400
425
|
anchorEl.value,
|
|
401
426
|
{
|
package/src/components/index.ts
CHANGED
|
@@ -255,7 +255,8 @@ export default defineComponent({
|
|
|
255
255
|
)
|
|
256
256
|
|
|
257
257
|
if (isDefined(slots.before)) {
|
|
258
|
-
|
|
258
|
+
const before = slots.before()
|
|
259
|
+
child = before ? before.concat(child) : child
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
return mergeSlot(slots.after, child)
|
|
@@ -1,52 +1,73 @@
|
|
|
1
1
|
.dl-virtual-scroll {
|
|
2
2
|
&:focus {
|
|
3
|
-
|
|
3
|
+
outline: 0;
|
|
4
4
|
}
|
|
5
5
|
&__content {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
outline: none;
|
|
7
|
+
contain: content;
|
|
8
|
+
|
|
9
|
+
& > * {
|
|
10
|
+
overflow-anchor: none;
|
|
11
|
+
}
|
|
12
|
+
& > [data-dl-vs-anchor] {
|
|
13
|
+
overflow-anchor: auto;
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
16
|
&__padding {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
background: linear-gradient(
|
|
18
|
+
rgba(255, 255, 255, 0),
|
|
19
|
+
rgba(255, 255, 255, 0) 20%,
|
|
20
|
+
rgba(128, 128, 128, 0.03) 20%,
|
|
21
|
+
rgba(128, 128, 128, 0.08) 50%,
|
|
22
|
+
rgba(128, 128, 128, 0.03) 80%,
|
|
23
|
+
rgba(255, 255, 255, 0) 80%,
|
|
24
|
+
rgba(255, 255, 255, 0)
|
|
25
|
+
)
|
|
26
|
+
#{'/* rtl:ignore */'};
|
|
27
|
+
background-size: var(--dl-virtual-scroll-item-width, 100%)
|
|
28
|
+
var(--dl-virtual-scroll-item-height, 50px) #{'/* rtl:ignore */'};
|
|
29
|
+
|
|
30
|
+
.dl-table & {
|
|
31
|
+
tr {
|
|
32
|
+
height: 0 !important;
|
|
33
|
+
}
|
|
34
|
+
td {
|
|
35
|
+
padding: 0 !important;
|
|
36
|
+
}
|
|
26
37
|
}
|
|
27
|
-
}
|
|
28
38
|
}
|
|
29
39
|
&--horizontal {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
flex-wrap: nowrap;
|
|
43
|
+
align-items: stretch;
|
|
44
|
+
|
|
45
|
+
.dl-virtual-scroll {
|
|
46
|
+
&__content {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
flex-wrap: nowrap;
|
|
50
|
+
}
|
|
51
|
+
&__padding,
|
|
52
|
+
&__content,
|
|
53
|
+
&__content > * {
|
|
54
|
+
flex: 0 0 auto;
|
|
55
|
+
}
|
|
56
|
+
&__padding {
|
|
57
|
+
background: linear-gradient(
|
|
58
|
+
to left,
|
|
59
|
+
rgba(255, 255, 255, 0),
|
|
60
|
+
rgba(255, 255, 255, 0) 20%,
|
|
61
|
+
rgba(128, 128, 128, 0.03) 20%,
|
|
62
|
+
rgba(128, 128, 128, 0.08) 50%,
|
|
63
|
+
rgba(128, 128, 128, 0.03) 80%,
|
|
64
|
+
rgba(255, 255, 255, 0) 80%,
|
|
65
|
+
rgba(255, 255, 255, 0)
|
|
66
|
+
)
|
|
67
|
+
#{'/* rtl:ignore */'};
|
|
68
|
+
background-size: var(--dl-virtual-scroll-item-width, 50px)
|
|
69
|
+
var(--dl-virtual-scroll-item-height, 100%) #{'/* rtl:ignore */'};
|
|
70
|
+
}
|
|
49
71
|
}
|
|
50
|
-
}
|
|
51
72
|
}
|
|
52
|
-
|
|
73
|
+
}
|
package/src/components/types.ts
CHANGED