@dataloop-ai/components 0.16.38 → 0.16.40
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 +1 -1
- package/src/components/basic/DlButton/DlButton.vue +16 -16
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +2 -2
- package/src/components/compound/DlTable/DlTable.vue +8 -1
- package/src/components/compound/DlTable/components/DlTh.vue +3 -3
- package/src/components/essential/DlMenu/DlMenu.vue +8 -4
- package/src/demo/DlTableDemo.vue +1 -0
- package/src/hooks/use-tick.ts +34 -14
package/package.json
CHANGED
|
@@ -18,24 +18,24 @@
|
|
|
18
18
|
<dl-tooltip
|
|
19
19
|
v-if="!tooltip && overflow && isOverflowing && hasLabel"
|
|
20
20
|
>
|
|
21
|
-
{{
|
|
21
|
+
{{ buttonLabel }}
|
|
22
22
|
</dl-tooltip>
|
|
23
|
-
<span class="dl-
|
|
23
|
+
<span class="dl-button-content dl-anchor--skip">
|
|
24
24
|
<dl-icon
|
|
25
25
|
v-if="hasIcon"
|
|
26
26
|
:size="iconSizePX"
|
|
27
27
|
:color="iconColor || textColor"
|
|
28
|
-
:class="{ 'dl-
|
|
28
|
+
:class="{ 'dl-button-icon': hasContent }"
|
|
29
29
|
:icon="icon"
|
|
30
30
|
:style="cssButtonVars"
|
|
31
31
|
/>
|
|
32
32
|
<span
|
|
33
33
|
v-if="hasLabel"
|
|
34
|
-
ref="
|
|
35
|
-
class="dl-
|
|
34
|
+
ref="buttonLabelRef"
|
|
35
|
+
class="dl-button-label"
|
|
36
36
|
:class="{ 'dl-button-no-wrap': noWrap }"
|
|
37
37
|
>
|
|
38
|
-
{{
|
|
38
|
+
{{ buttonLabel }}
|
|
39
39
|
</span>
|
|
40
40
|
<slot />
|
|
41
41
|
</span>
|
|
@@ -108,12 +108,12 @@ export default defineComponent({
|
|
|
108
108
|
},
|
|
109
109
|
emits: ['click', 'mousedown'],
|
|
110
110
|
setup() {
|
|
111
|
-
const
|
|
112
|
-
const { hasEllipsis } = useSizeObserver(
|
|
111
|
+
const buttonLabelRef = ref(null)
|
|
112
|
+
const { hasEllipsis } = useSizeObserver(buttonLabelRef)
|
|
113
113
|
|
|
114
114
|
return {
|
|
115
115
|
uuid: `dl-button-${v4()}`,
|
|
116
|
-
|
|
116
|
+
buttonLabelRef,
|
|
117
117
|
isOverflowing: hasEllipsis
|
|
118
118
|
}
|
|
119
119
|
},
|
|
@@ -134,7 +134,7 @@ export default defineComponent({
|
|
|
134
134
|
this.label !== ''
|
|
135
135
|
)
|
|
136
136
|
},
|
|
137
|
-
|
|
137
|
+
buttonLabel(): string {
|
|
138
138
|
return textTransform(this.label)
|
|
139
139
|
},
|
|
140
140
|
hasIcon(): boolean {
|
|
@@ -232,7 +232,7 @@ export default defineComponent({
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
return {
|
|
235
|
-
'--dl-
|
|
235
|
+
'--dl-button-container-width': this.fluid ? '100%' : 'auto',
|
|
236
236
|
'--dl-button-padding': this.dense
|
|
237
237
|
? '0'
|
|
238
238
|
: this.padding
|
|
@@ -326,13 +326,13 @@ export default defineComponent({
|
|
|
326
326
|
color: var(--dl-button-text-color-hover);
|
|
327
327
|
background-color: var(--dl-button-bg-hover);
|
|
328
328
|
border-color: var(--dl-button-border-hover);
|
|
329
|
-
& .dl-
|
|
329
|
+
& .dl-button-label {
|
|
330
330
|
transition: all ease-in 0.15s;
|
|
331
331
|
color: var(--dl-button-color-hover);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
.dl-
|
|
335
|
+
.dl-button-content {
|
|
336
336
|
display: flex;
|
|
337
337
|
text-align: center;
|
|
338
338
|
align-items: center;
|
|
@@ -346,12 +346,12 @@ export default defineComponent({
|
|
|
346
346
|
min-width: 1.5em;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
.dl-
|
|
350
|
-
margin
|
|
349
|
+
.dl-button-icon {
|
|
350
|
+
margin: var(--dl-button-icon-margin, '0px 7px 0px 0px');
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
.dl-button-container {
|
|
354
354
|
display: inline-block;
|
|
355
|
-
width: var(--dl-
|
|
355
|
+
width: var(--dl-button-container-width);
|
|
356
356
|
}
|
|
357
357
|
</style>
|
|
@@ -91,7 +91,7 @@ export default defineComponent({
|
|
|
91
91
|
'blur',
|
|
92
92
|
'clear',
|
|
93
93
|
'enter',
|
|
94
|
-
'search
|
|
94
|
+
'search',
|
|
95
95
|
'update:model-value'
|
|
96
96
|
],
|
|
97
97
|
data() {
|
|
@@ -132,7 +132,7 @@ export default defineComponent({
|
|
|
132
132
|
this.$emit('clear', value)
|
|
133
133
|
},
|
|
134
134
|
onSearchButtonPress(): void {
|
|
135
|
-
this.$emit('search
|
|
135
|
+
this.$emit('search', this.modelValue)
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
})
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
|
|
270
270
|
<slot
|
|
271
271
|
v-for="col in computedCols"
|
|
272
|
-
v-bind="getHeaderScope({ col })"
|
|
272
|
+
v-bind="getHeaderScope({ col, onThClick })"
|
|
273
273
|
:name="
|
|
274
274
|
hasSlotByName(`header-cell-${col.name}`)
|
|
275
275
|
? `header-cell-${col.name}`
|
|
@@ -279,6 +279,7 @@
|
|
|
279
279
|
<DlTh
|
|
280
280
|
:key="col.name"
|
|
281
281
|
:props="getHeaderScope({ col })"
|
|
282
|
+
@click="onThClick($event, col.name)"
|
|
282
283
|
>
|
|
283
284
|
{{ col.label }}
|
|
284
285
|
</DlTh>
|
|
@@ -617,6 +618,7 @@ export default defineComponent({
|
|
|
617
618
|
'row-reorder',
|
|
618
619
|
'col-reorder',
|
|
619
620
|
'row-click',
|
|
621
|
+
'th-click',
|
|
620
622
|
'row-dblclick',
|
|
621
623
|
'row-contextmenu',
|
|
622
624
|
...useTableRowExpandEmits,
|
|
@@ -1120,6 +1122,10 @@ export default defineComponent({
|
|
|
1120
1122
|
|
|
1121
1123
|
//
|
|
1122
1124
|
|
|
1125
|
+
const onThClick = (evt: MouseEvent, name: string) => {
|
|
1126
|
+
emit('th-click', evt, computedRows.value, name)
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1123
1129
|
const onTrClick = (
|
|
1124
1130
|
evt: MouseEvent,
|
|
1125
1131
|
row: DlTableRow,
|
|
@@ -1271,6 +1277,7 @@ export default defineComponent({
|
|
|
1271
1277
|
displayPagination,
|
|
1272
1278
|
onTrClick,
|
|
1273
1279
|
onTrDblClick,
|
|
1280
|
+
onThClick,
|
|
1274
1281
|
onTrContextMenu,
|
|
1275
1282
|
hasPaginationSlot
|
|
1276
1283
|
}
|
|
@@ -49,8 +49,8 @@ export default defineComponent({
|
|
|
49
49
|
|
|
50
50
|
const { hasEllipsis } = useSizeObserver(tableTh)
|
|
51
51
|
|
|
52
|
-
const onClickFn = (event: Event) => {
|
|
53
|
-
emit('click', event)
|
|
52
|
+
const onClickFn = (event: Event, name: string) => {
|
|
53
|
+
emit('click', event, name)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const hasOptionalProps = computed(() => {
|
|
@@ -98,7 +98,7 @@ export default defineComponent({
|
|
|
98
98
|
const sort = props.props?.sort as Function
|
|
99
99
|
sort(column.value)
|
|
100
100
|
}
|
|
101
|
-
onClickFn(evt)
|
|
101
|
+
onClickFn(evt, column.value.name)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
const onClick = !hasOptionalProps.value ? onClickFn : handleClick
|
|
@@ -268,9 +268,12 @@ export default defineComponent({
|
|
|
268
268
|
})
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
registerTick(
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
registerTick(
|
|
272
|
+
() => {
|
|
273
|
+
updatePosition()
|
|
274
|
+
},
|
|
275
|
+
{ continuous: true }
|
|
276
|
+
)
|
|
274
277
|
|
|
275
278
|
registerTimeout(() => {
|
|
276
279
|
// required in order to avoid the "double-tap needed" issue
|
|
@@ -357,7 +360,7 @@ export default defineComponent({
|
|
|
357
360
|
})
|
|
358
361
|
}
|
|
359
362
|
|
|
360
|
-
async
|
|
363
|
+
const updatePosition = async () => {
|
|
361
364
|
const el = innerRef.value
|
|
362
365
|
|
|
363
366
|
if (el === null || anchorEl.value === null) {
|
|
@@ -367,6 +370,7 @@ export default defineComponent({
|
|
|
367
370
|
const isAnchorElVisible = await CheckAnchorElVisiblity(
|
|
368
371
|
anchorEl.value
|
|
369
372
|
)
|
|
373
|
+
|
|
370
374
|
if (!isAnchorElVisible) {
|
|
371
375
|
hide()
|
|
372
376
|
return
|
package/src/demo/DlTableDemo.vue
CHANGED
package/src/hooks/use-tick.ts
CHANGED
|
@@ -1,32 +1,52 @@
|
|
|
1
1
|
import { nextTick, onBeforeUnmount } from 'vue-demi'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* registerTick(fn)
|
|
3
|
+
/**
|
|
4
|
+
* @description a tick hook that allows you to register a function to be called on the next tick or on the next animation frame.
|
|
5
|
+
* @returns {Object} registerTick, removeTick
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
7
|
export default function () {
|
|
10
|
-
let tickFn: Function |
|
|
8
|
+
let tickFn: Function | null = null
|
|
9
|
+
let animationFrameId: number | null = null
|
|
11
10
|
|
|
12
11
|
onBeforeUnmount(() => {
|
|
13
|
-
|
|
12
|
+
removeTick()
|
|
14
13
|
})
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const registerTick = (
|
|
16
|
+
fn: Function,
|
|
17
|
+
options: { continuous?: boolean } = {}
|
|
18
|
+
) => {
|
|
19
|
+
tickFn = fn
|
|
20
|
+
|
|
21
|
+
const { continuous } = options
|
|
19
22
|
|
|
23
|
+
if (continuous) {
|
|
24
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
25
|
+
if (tickFn === fn) {
|
|
26
|
+
tickFn()
|
|
27
|
+
registerTick(fn, { continuous })
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
} else {
|
|
20
31
|
nextTick(() => {
|
|
21
32
|
if (tickFn === fn) {
|
|
22
33
|
tickFn()
|
|
23
|
-
tickFn =
|
|
34
|
+
tickFn = null
|
|
24
35
|
}
|
|
25
36
|
})
|
|
26
|
-
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
27
39
|
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
const removeTick = () => {
|
|
41
|
+
tickFn = null
|
|
42
|
+
if (animationFrameId) {
|
|
43
|
+
cancelAnimationFrame(animationFrameId)
|
|
30
44
|
}
|
|
45
|
+
animationFrameId = null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
registerTick,
|
|
50
|
+
removeTick
|
|
31
51
|
}
|
|
32
52
|
}
|