@dataloop-ai/components 0.20.185 → 0.20.186
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
package/src/assets/globals.scss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './theme.css';
|
|
2
2
|
|
|
3
3
|
body {
|
|
4
4
|
& > * {
|
|
@@ -8,6 +8,231 @@ body {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
html.dl-sortable--dragging,
|
|
12
|
+
html.dl-sortable--dragging * {
|
|
13
|
+
cursor: grabbing !important;
|
|
14
|
+
user-select: none !important;
|
|
15
|
+
-webkit-user-select: none !important;
|
|
16
|
+
-moz-user-select: none !important;
|
|
17
|
+
-ms-user-select: none !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dl-table-fallback-row.sortable-drag {
|
|
21
|
+
display: table !important;
|
|
22
|
+
table-layout: fixed;
|
|
23
|
+
border-collapse: collapse;
|
|
24
|
+
border-spacing: 0;
|
|
25
|
+
font-family: 'Roboto', sans-serif;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
font-style: normal;
|
|
28
|
+
font-size: var(--dl-font-size-body);
|
|
29
|
+
line-height: 14px;
|
|
30
|
+
color: var(--dl-color-darker);
|
|
31
|
+
background-color: var(--dl-color-fill-hover);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
tr.dl-table-fallback-row.sortable-drag {
|
|
35
|
+
display: table !important;
|
|
36
|
+
table-layout: fixed;
|
|
37
|
+
border-collapse: collapse;
|
|
38
|
+
border-spacing: 0;
|
|
39
|
+
font-family: 'Roboto', sans-serif;
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
font-style: normal;
|
|
42
|
+
font-size: var(--dl-font-size-body);
|
|
43
|
+
line-height: 14px;
|
|
44
|
+
color: var(--dl-color-darker);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
tr.dl-table-fallback-row.sortable-drag > th,
|
|
48
|
+
tr.dl-table-fallback-row.sortable-drag > td {
|
|
49
|
+
display: table-cell;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
background-color: var(--dl-color-fill-hover);
|
|
52
|
+
color: var(--dl-color-darker);
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
height: 40px;
|
|
55
|
+
padding-top: 0 !important;
|
|
56
|
+
padding-bottom: 0 !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tbody.dl-table-fallback-row.sortable-drag {
|
|
60
|
+
display: table-row-group !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.dl-tree-table-fallback-row.sortable-drag {
|
|
64
|
+
display: table !important;
|
|
65
|
+
table-layout: fixed;
|
|
66
|
+
border-collapse: collapse;
|
|
67
|
+
border-spacing: 0;
|
|
68
|
+
font-family: 'Roboto', sans-serif;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
font-style: normal;
|
|
71
|
+
font-size: var(--dl-font-size-body);
|
|
72
|
+
line-height: 14px;
|
|
73
|
+
color: var(--dl-color-darker);
|
|
74
|
+
background-color: var(--dl-color-panel-background);
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
tr.dl-tree-table-fallback-row.sortable-drag {
|
|
81
|
+
display: table !important;
|
|
82
|
+
table-layout: fixed;
|
|
83
|
+
border-collapse: collapse;
|
|
84
|
+
border-spacing: 0;
|
|
85
|
+
font-family: 'Roboto', sans-serif;
|
|
86
|
+
font-weight: 400;
|
|
87
|
+
font-style: normal;
|
|
88
|
+
font-size: var(--dl-font-size-body);
|
|
89
|
+
line-height: 14px;
|
|
90
|
+
color: var(--dl-color-darker);
|
|
91
|
+
background-color: var(--dl-color-panel-background);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
tr.dl-tree-table-fallback-row.sortable-drag > th,
|
|
95
|
+
tr.dl-tree-table-fallback-row.sortable-drag > td {
|
|
96
|
+
display: table-cell;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
background-color: var(--dl-color-fill-hover);
|
|
99
|
+
color: var(--dl-color-darker);
|
|
100
|
+
vertical-align: middle;
|
|
101
|
+
height: 40px;
|
|
102
|
+
padding-top: 0 !important;
|
|
103
|
+
padding-bottom: 0 !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
tbody.dl-tree-table-fallback-row.sortable-drag {
|
|
107
|
+
display: table-row-group !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.dl-table-fallback-row.sortable-drag > tr {
|
|
111
|
+
display: table-row;
|
|
112
|
+
height: 40px;
|
|
113
|
+
vertical-align: middle;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.dl-tree-table-fallback-row.sortable-drag > tr {
|
|
117
|
+
display: table-row;
|
|
118
|
+
height: 40px;
|
|
119
|
+
vertical-align: middle;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.dl-table-fallback-row.sortable-drag > tr > th,
|
|
123
|
+
.dl-table-fallback-row.sortable-drag > tr > td {
|
|
124
|
+
display: table-cell;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
background-color: var(--dl-color-fill-hover);
|
|
127
|
+
color: var(--dl-color-darker);
|
|
128
|
+
vertical-align: middle;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.dl-tree-table-fallback-row.sortable-drag > tr > th,
|
|
132
|
+
.dl-tree-table-fallback-row.sortable-drag > tr > td {
|
|
133
|
+
display: table-cell;
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
background-color: var(--dl-color-fill-hover);
|
|
136
|
+
color: var(--dl-color-darker);
|
|
137
|
+
vertical-align: middle;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.dl-tree-table-fallback-row.sortable-drag > tr:first-child > th,
|
|
141
|
+
.dl-tree-table-fallback-row.sortable-drag > tr:first-child > td {
|
|
142
|
+
background-color: var(--dl-color-fill-hover);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.dl-tree-table-fallback-row.sortable-drag > tr:not(:first-child) > th,
|
|
146
|
+
.dl-tree-table-fallback-row.sortable-drag > tr:not(:first-child) > td {
|
|
147
|
+
background-color: var(--dl-color-fill-hover);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
151
|
+
tr[data-level]:not([data-level='1'])
|
|
152
|
+
> td:first-child,
|
|
153
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
154
|
+
tr[data-level]:not([data-level='1'])
|
|
155
|
+
> td.dl-table--col-auto-width,
|
|
156
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
157
|
+
tr[data-level]:not([data-level='1'])
|
|
158
|
+
> td.chevron-icon-container {
|
|
159
|
+
background-color: transparent !important;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
163
|
+
tr[data-level]:not([data-level='1'])
|
|
164
|
+
> td.chevron-icon-container,
|
|
165
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
166
|
+
tr[data-level]:not([data-level='1'])
|
|
167
|
+
> td.chevron-icon-container
|
|
168
|
+
*,
|
|
169
|
+
.dl-tree-table-fallback-row.sortable-drag > tr:not(:first-child) .chevron-icon,
|
|
170
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
171
|
+
tr[data-level]:not([data-level='1'])
|
|
172
|
+
.chevron-icon
|
|
173
|
+
* {
|
|
174
|
+
background-color: transparent !important;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
178
|
+
tbody[data-level]:not([data-level='1'])
|
|
179
|
+
> tr
|
|
180
|
+
> td:first-child,
|
|
181
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
182
|
+
tbody[data-level]:not([data-level='1'])
|
|
183
|
+
> tr
|
|
184
|
+
> td.dl-table--col-auto-width,
|
|
185
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
186
|
+
tbody[data-level]:not([data-level='1'])
|
|
187
|
+
> tr
|
|
188
|
+
> td.chevron-icon-container {
|
|
189
|
+
background-color: transparent !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
193
|
+
tbody[data-level]:not([data-level='1'])
|
|
194
|
+
> tr
|
|
195
|
+
> td:nth-child(-n + 3) {
|
|
196
|
+
background-color: transparent !important;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
200
|
+
tr:not(:first-child)
|
|
201
|
+
> td:nth-child(-n + 3) {
|
|
202
|
+
background-color: transparent !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
206
|
+
tbody[data-level]:not([data-level='1'])
|
|
207
|
+
> tr
|
|
208
|
+
> td.chevron-icon-container,
|
|
209
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
210
|
+
tbody[data-level]:not([data-level='1'])
|
|
211
|
+
> tr
|
|
212
|
+
> td.chevron-icon-container
|
|
213
|
+
*,
|
|
214
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
215
|
+
tbody[data-level]:not([data-level='1'])
|
|
216
|
+
.chevron-icon,
|
|
217
|
+
.dl-tree-table-fallback-row.sortable-drag
|
|
218
|
+
tbody[data-level]:not([data-level='1'])
|
|
219
|
+
.chevron-icon
|
|
220
|
+
* {
|
|
221
|
+
background-color: transparent !important;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.dl-table-fallback-row.sortable-drag .draggable-icon {
|
|
225
|
+
visibility: hidden !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.dl-tree-table-fallback-row.sortable-drag .draggable-icon {
|
|
229
|
+
visibility: hidden !important;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.dl-table-fallback-row.sortable-drag > tr:not(:first-child) {
|
|
233
|
+
display: none !important;
|
|
234
|
+
}
|
|
235
|
+
|
|
11
236
|
// tranform
|
|
12
237
|
.rotate-180 {
|
|
13
238
|
transform: rotate(180deg);
|
|
@@ -145,7 +370,6 @@ body {
|
|
|
145
370
|
}
|
|
146
371
|
|
|
147
372
|
.non-draggable {
|
|
148
|
-
user-drag: none;
|
|
149
373
|
-webkit-user-drag: none;
|
|
150
374
|
user-select: none;
|
|
151
375
|
-moz-user-select: none;
|
|
@@ -185,7 +409,6 @@ body {
|
|
|
185
409
|
height: 100%;
|
|
186
410
|
}
|
|
187
411
|
|
|
188
|
-
|
|
189
412
|
// scrollbar
|
|
190
413
|
|
|
191
414
|
html {
|
|
@@ -1159,7 +1159,7 @@ export default defineComponent({
|
|
|
1159
1159
|
*/
|
|
1160
1160
|
selectedRowsLabel: {
|
|
1161
1161
|
type: Function,
|
|
1162
|
-
default: (val: number) => null
|
|
1162
|
+
default: (val: number): string | null => null
|
|
1163
1163
|
},
|
|
1164
1164
|
/**
|
|
1165
1165
|
* Label visible when loading is active
|
|
@@ -1762,7 +1762,8 @@ export default defineComponent({
|
|
|
1762
1762
|
|
|
1763
1763
|
const colspanForProgressBar = computed(() => {
|
|
1764
1764
|
return (
|
|
1765
|
-
colspanWithExpandableRow.value -
|
|
1765
|
+
colspanWithExpandableRow.value -
|
|
1766
|
+
(hasDraggableRows.value ? 0 : 1)
|
|
1766
1767
|
)
|
|
1767
1768
|
})
|
|
1768
1769
|
|
|
@@ -2091,6 +2092,9 @@ export default defineComponent({
|
|
|
2091
2092
|
group: props.isTreeTable ? 'nested' : tableUuid,
|
|
2092
2093
|
animation: 150,
|
|
2093
2094
|
fallbackOnBody: true,
|
|
2095
|
+
forceFallback: true,
|
|
2096
|
+
fallbackClass: 'dl-table-fallback-row',
|
|
2097
|
+
ghostClass: 'dl-table-ghost-row',
|
|
2094
2098
|
invertSwap: true,
|
|
2095
2099
|
swapThreshold: 0.5,
|
|
2096
2100
|
handle: '.draggable-icon'
|
|
@@ -100,33 +100,175 @@ export function useSortable(vm: Record<string, any>) {
|
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
watch(rootRef, (newRootRef) => {
|
|
103
|
-
|
|
104
103
|
if (sortable.value) {
|
|
105
104
|
sortable.value.destroy()
|
|
106
105
|
sortable.value = null
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
|
|
109
108
|
if (newRootRef) {
|
|
109
|
+
const DRAGGING_CLASS = 'dl-sortable--dragging'
|
|
110
|
+
|
|
111
|
+
const hasDocument = () =>
|
|
112
|
+
typeof document !== 'undefined' &&
|
|
113
|
+
!!document.documentElement &&
|
|
114
|
+
!!document.body
|
|
115
|
+
|
|
116
|
+
const applyGlobalDraggingState = (active: boolean) => {
|
|
117
|
+
if (!hasDocument()) return
|
|
118
|
+
|
|
119
|
+
document.documentElement.classList.toggle(
|
|
120
|
+
DRAGGING_CLASS,
|
|
121
|
+
active
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
document.documentElement.style.cursor = active ? 'grabbing' : ''
|
|
125
|
+
document.body.style.cursor = active ? 'grabbing' : ''
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const stopDragging = () => {
|
|
129
|
+
if (!isDragging.value) return
|
|
130
|
+
isDragging.value = false
|
|
131
|
+
didSyncCloneWidths = false
|
|
132
|
+
applyGlobalDraggingState(false)
|
|
133
|
+
removeHardStopListeners()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const hardStop = () => {
|
|
137
|
+
stopDragging()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
141
|
+
if (e.key === 'Escape') hardStop()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const addHardStopListeners = () => {
|
|
145
|
+
if (!hasDocument()) return
|
|
146
|
+
window.addEventListener('mouseup', hardStop, true)
|
|
147
|
+
window.addEventListener('pointerup', hardStop, true)
|
|
148
|
+
window.addEventListener('touchend', hardStop, true)
|
|
149
|
+
window.addEventListener('dragend', hardStop, true)
|
|
150
|
+
window.addEventListener('drop', hardStop, true)
|
|
151
|
+
window.addEventListener('keydown', onKeyDown, true)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const removeHardStopListeners = () => {
|
|
155
|
+
if (!hasDocument()) return
|
|
156
|
+
window.removeEventListener('mouseup', hardStop, true)
|
|
157
|
+
window.removeEventListener('pointerup', hardStop, true)
|
|
158
|
+
window.removeEventListener('touchend', hardStop, true)
|
|
159
|
+
window.removeEventListener('dragend', hardStop, true)
|
|
160
|
+
window.removeEventListener('drop', hardStop, true)
|
|
161
|
+
window.removeEventListener('keydown', onKeyDown, true)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let didSyncCloneWidths = false
|
|
165
|
+
|
|
166
|
+
const _syncDraggingElementColumnWidths = (event: any) => {
|
|
167
|
+
if (didSyncCloneWidths) return
|
|
168
|
+
if (!hasDocument()) return
|
|
169
|
+
|
|
170
|
+
const pickRowEl = (
|
|
171
|
+
el: HTMLElement
|
|
172
|
+
): HTMLTableRowElement | null => {
|
|
173
|
+
if (el.tagName === 'TR') return el as HTMLTableRowElement
|
|
174
|
+
const tr = el.querySelector('tr')
|
|
175
|
+
return (tr as HTMLTableRowElement) || null
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const itemEl = event?.item as HTMLElement | null
|
|
179
|
+
const sourceRow = itemEl ? pickRowEl(itemEl) : null
|
|
180
|
+
if (!sourceRow) return
|
|
181
|
+
|
|
182
|
+
const sourceCells = Array.from(
|
|
183
|
+
sourceRow.querySelectorAll('th,td')
|
|
184
|
+
) as HTMLElement[]
|
|
185
|
+
if (sourceCells.length === 0) return
|
|
186
|
+
|
|
187
|
+
const sourceRowWidth = sourceRow.getBoundingClientRect().width
|
|
188
|
+
const widths = sourceCells.map(
|
|
189
|
+
(cell) => cell.getBoundingClientRect().width
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
requestAnimationFrame(() => {
|
|
193
|
+
const dragEl = document.body.querySelector(
|
|
194
|
+
'.sortable-drag'
|
|
195
|
+
) as HTMLElement | null
|
|
196
|
+
if (!dragEl) return
|
|
197
|
+
|
|
198
|
+
const dragRow = pickRowEl(dragEl)
|
|
199
|
+
if (!dragRow) return
|
|
200
|
+
|
|
201
|
+
const dragRows =
|
|
202
|
+
dragEl.tagName === 'TR'
|
|
203
|
+
? ([dragEl] as HTMLElement[])
|
|
204
|
+
: (Array.from(
|
|
205
|
+
dragEl.querySelectorAll('tr')
|
|
206
|
+
) as HTMLElement[])
|
|
207
|
+
if (dragRows.length === 0) return
|
|
208
|
+
|
|
209
|
+
for (const row of dragRows) {
|
|
210
|
+
const cells = Array.from(
|
|
211
|
+
row.querySelectorAll('th,td')
|
|
212
|
+
) as HTMLElement[]
|
|
213
|
+
if (cells.length === 0) continue
|
|
214
|
+
|
|
215
|
+
const len = Math.min(widths.length, cells.length)
|
|
216
|
+
for (let i = 0; i < len; i++) {
|
|
217
|
+
const w = widths[i]
|
|
218
|
+
const cell = cells[i]
|
|
219
|
+
if (!w || !cell) continue
|
|
220
|
+
const px = `${w}px`
|
|
221
|
+
cell.style.width = px
|
|
222
|
+
cell.style.minWidth = px
|
|
223
|
+
cell.style.maxWidth = px
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const dragTable =
|
|
228
|
+
(dragEl.tagName === 'TABLE'
|
|
229
|
+
? (dragEl as HTMLElement)
|
|
230
|
+
: (dragRow.closest(
|
|
231
|
+
'table'
|
|
232
|
+
) as HTMLElement | null)) ||
|
|
233
|
+
(dragEl.querySelector('table') as HTMLElement | null)
|
|
234
|
+
if (dragTable && sourceRowWidth) {
|
|
235
|
+
dragTable.style.width = `${sourceRowWidth}px`
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (dragEl.tagName === 'TR' && sourceRowWidth) {
|
|
239
|
+
dragEl.style.width = `${sourceRowWidth}px`
|
|
240
|
+
dragEl.style.minWidth = `${sourceRowWidth}px`
|
|
241
|
+
dragEl.style.maxWidth = `${sourceRowWidth}px`
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
didSyncCloneWidths = true
|
|
245
|
+
})
|
|
246
|
+
}
|
|
247
|
+
|
|
110
248
|
sortable.value = new Sortable(newRootRef, {
|
|
111
249
|
...props.options,
|
|
112
250
|
onChoose: (event) => emit('choose', event),
|
|
113
251
|
onUnchoose: (event) => emit('unchoose', event),
|
|
114
252
|
onStart: (event) => {
|
|
115
253
|
isDragging.value = true
|
|
254
|
+
applyGlobalDraggingState(true)
|
|
255
|
+
addHardStopListeners()
|
|
256
|
+
_syncDraggingElementColumnWidths(event)
|
|
116
257
|
emit('start', event)
|
|
117
258
|
},
|
|
118
259
|
onEnd: (event) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
emit('end', event)
|
|
122
|
-
})
|
|
260
|
+
stopDragging()
|
|
261
|
+
emit('end', event)
|
|
123
262
|
},
|
|
124
263
|
onAdd: (event) => emit('add', event),
|
|
125
264
|
onUpdate: (event) => emit('update', event),
|
|
126
265
|
onSort: (event) => emit('sort', event),
|
|
127
266
|
onRemove: (event) => emit('remove', event),
|
|
128
267
|
onFilter: (event) => emit('filter', event),
|
|
129
|
-
onClone: (event) =>
|
|
268
|
+
onClone: (event) => {
|
|
269
|
+
_syncDraggingElementColumnWidths(event)
|
|
270
|
+
emit('clone', event)
|
|
271
|
+
},
|
|
130
272
|
onChange: (event) => emit('change', event)
|
|
131
273
|
})
|
|
132
274
|
}
|
|
@@ -266,11 +266,11 @@ export default defineComponent({
|
|
|
266
266
|
emptyStateProps: {
|
|
267
267
|
type: Object as PropType<DlEmptyStateProps>,
|
|
268
268
|
default: () =>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
269
|
+
({
|
|
270
|
+
title: '',
|
|
271
|
+
subtitle: 'No data to show yet',
|
|
272
|
+
icon: 'icon-dl-dataset-filled'
|
|
273
|
+
} as unknown as PropType<DlEmptyStateProps>)
|
|
274
274
|
},
|
|
275
275
|
/**
|
|
276
276
|
* Custom icon class to use for expanded rows.
|
|
@@ -392,7 +392,7 @@ export default defineComponent({
|
|
|
392
392
|
typeof props.rowKey === 'function'
|
|
393
393
|
? props.rowKey
|
|
394
394
|
: (row: Record<string, any>) =>
|
|
395
|
-
|
|
395
|
+
row[props.rowKey as string] ?? ''
|
|
396
396
|
)
|
|
397
397
|
|
|
398
398
|
const hasDraggableRows = computed(() =>
|
|
@@ -537,7 +537,7 @@ export default defineComponent({
|
|
|
537
537
|
const onMultipleSelectionSet = (val: boolean) => {
|
|
538
538
|
const value =
|
|
539
539
|
selectedData.value.length > 0 &&
|
|
540
|
-
|
|
540
|
+
selectedData.value.length === tableRows.value.length
|
|
541
541
|
? false
|
|
542
542
|
: val
|
|
543
543
|
|
|
@@ -754,6 +754,8 @@ export default defineComponent({
|
|
|
754
754
|
group: 'nested',
|
|
755
755
|
animation: 150,
|
|
756
756
|
fallbackOnBody: true,
|
|
757
|
+
forceFallback: true,
|
|
758
|
+
fallbackClass: 'dl-tree-table-fallback-row',
|
|
757
759
|
invertSwap: true,
|
|
758
760
|
swapThreshold: 0.85,
|
|
759
761
|
handle: '.draggable-icon',
|
|
@@ -787,15 +789,20 @@ export default defineComponent({
|
|
|
787
789
|
let finalTarget = targetRow.value
|
|
788
790
|
let shouldSkipValidation = false
|
|
789
791
|
|
|
790
|
-
if (storedValidTarget.value
|
|
791
|
-
|
|
792
|
-
storedValidTarget.value.id,
|
|
793
|
-
targetRow.value.id,
|
|
794
|
-
tableRows.value
|
|
795
|
-
)
|
|
796
|
-
if (isStoredTargetAncestor) {
|
|
792
|
+
if (storedValidTarget.value) {
|
|
793
|
+
if (!targetRow.value) {
|
|
797
794
|
finalTarget = storedValidTarget.value
|
|
798
795
|
shouldSkipValidation = true
|
|
796
|
+
} else {
|
|
797
|
+
const isStoredTargetAncestor = isAncestor(
|
|
798
|
+
storedValidTarget.value.id,
|
|
799
|
+
targetRow.value.id,
|
|
800
|
+
tableRows.value
|
|
801
|
+
)
|
|
802
|
+
if (isStoredTargetAncestor) {
|
|
803
|
+
finalTarget = storedValidTarget.value
|
|
804
|
+
shouldSkipValidation = true
|
|
805
|
+
}
|
|
799
806
|
}
|
|
800
807
|
}
|
|
801
808
|
|
|
@@ -823,11 +830,16 @@ export default defineComponent({
|
|
|
823
830
|
}
|
|
824
831
|
|
|
825
832
|
const handleChangeEvent = (event: any) => {
|
|
826
|
-
const originalEvent = event
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
833
|
+
const originalEvent = event?.originalEvent
|
|
834
|
+
if (!originalEvent) {
|
|
835
|
+
return
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const srcEl =
|
|
839
|
+
(originalEvent.srcElement ||
|
|
840
|
+
originalEvent.target ||
|
|
841
|
+
null) as HTMLElement | null
|
|
842
|
+
const passedElement = srcEl ? getElementAbove(srcEl, 'dl-tr') : null
|
|
831
843
|
if (passedElement) {
|
|
832
844
|
const targetRowId = passedElement.dataset.id
|
|
833
845
|
const targetLevel = passedElement.getAttribute('data-level')
|
|
@@ -859,14 +871,21 @@ export default defineComponent({
|
|
|
859
871
|
targetRow: targetRow.value
|
|
860
872
|
})
|
|
861
873
|
}
|
|
874
|
+
|
|
862
875
|
const currentY = originalEvent.clientY
|
|
863
|
-
if (currentY
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
876
|
+
if (typeof currentY === 'number') {
|
|
877
|
+
if (currentY > prevMouseY) {
|
|
878
|
+
sortingMovement.value.direction = 'down'
|
|
879
|
+
} else if (currentY < prevMouseY) {
|
|
880
|
+
sortingMovement.value.direction = 'up'
|
|
881
|
+
}
|
|
882
|
+
prevMouseY = currentY
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const lastId = passedElement?.dataset?.id
|
|
886
|
+
if (lastId) {
|
|
887
|
+
sortingMovement.value.lastId = lastId
|
|
867
888
|
}
|
|
868
|
-
prevMouseY = currentY
|
|
869
|
-
sortingMovement.value.lastId = passedElement.dataset.id
|
|
870
889
|
}
|
|
871
890
|
|
|
872
891
|
const handleStartEvent = (event: any) => {
|
|
@@ -929,7 +948,7 @@ export default defineComponent({
|
|
|
929
948
|
}
|
|
930
949
|
|
|
931
950
|
const isValid = checkParentCondition(draggedRow.value, targetRow)
|
|
932
|
-
|
|
951
|
+
|
|
933
952
|
if (isValid) {
|
|
934
953
|
storedValidTarget.value = targetRow
|
|
935
954
|
}
|
|
@@ -1159,6 +1178,8 @@ export default defineComponent({
|
|
|
1159
1178
|
group: 'nested',
|
|
1160
1179
|
animation: 150,
|
|
1161
1180
|
fallbackOnBody: true,
|
|
1181
|
+
forceFallback: true,
|
|
1182
|
+
fallbackClass: 'dl-tree-table-fallback-row',
|
|
1162
1183
|
invertSwap: true,
|
|
1163
1184
|
swapThreshold: 0.85,
|
|
1164
1185
|
handle: '.draggable-icon',
|
|
@@ -1222,7 +1243,7 @@ export default defineComponent({
|
|
|
1222
1243
|
this.vue2h = vue2h
|
|
1223
1244
|
const tableBodySlot = isVue2
|
|
1224
1245
|
? this.$slots['table-body'] &&
|
|
1225
|
-
|
|
1246
|
+
(() => (this.$slots['table-body'] as any)?.pop())
|
|
1226
1247
|
: this.$slots['table-body']
|
|
1227
1248
|
const tbody =
|
|
1228
1249
|
tableBodySlot ?? (this.isDataEmpty ? null : this.renderTBody)
|
|
@@ -1285,7 +1306,8 @@ export default defineComponent({
|
|
|
1285
1306
|
gap: 10px;
|
|
1286
1307
|
justify-content: center;
|
|
1287
1308
|
flex-wrap: wrap;
|
|
1288
|
-
|
|
1309
|
+
|
|
1310
|
+
&>* {
|
|
1289
1311
|
flex-grow: 1;
|
|
1290
1312
|
}
|
|
1291
1313
|
}
|
|
@@ -1314,23 +1336,27 @@ tr {
|
|
|
1314
1336
|
}
|
|
1315
1337
|
|
|
1316
1338
|
.sticky-header {
|
|
1339
|
+
|
|
1317
1340
|
::v-deep .dl-table__top,
|
|
1318
1341
|
::v-deep .dl-table__bottom,
|
|
1319
1342
|
::v-deep thead tr:first-child th {
|
|
1320
1343
|
/* bg color is important for th; just specify one */
|
|
1321
1344
|
background-color: var(--dl-color-panel-background);
|
|
1322
1345
|
}
|
|
1346
|
+
|
|
1323
1347
|
::v-deep thead tr th {
|
|
1324
1348
|
position: sticky !important;
|
|
1325
1349
|
z-index: 1;
|
|
1326
1350
|
}
|
|
1351
|
+
|
|
1327
1352
|
::v-deep thead tr:first-child th {
|
|
1328
1353
|
top: 0;
|
|
1329
1354
|
}
|
|
1355
|
+
|
|
1330
1356
|
/* this is when the loading indicator appears */
|
|
1331
1357
|
&.dl-table--loading thead tr:last-child th {
|
|
1332
1358
|
/* height of all previous header rows */
|
|
1333
1359
|
top: 40px;
|
|
1334
1360
|
}
|
|
1335
1361
|
}
|
|
1336
|
-
</style>
|
|
1362
|
+
</style>
|