@dataloop-ai/components 0.19.121 → 0.19.123
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/compound/DlInput/DlInput.vue +19 -9
- package/src/components/compound/DlPagination/DlPagination.vue +27 -0
- package/src/components/compound/DlPagination/components/PageNavigation.vue +17 -8
- package/src/components/compound/DlPagination/components/PaginationLegend.vue +43 -4
- package/src/demos/DlPaginationDemo.vue +23 -6
package/package.json
CHANGED
|
@@ -707,8 +707,12 @@ export default defineComponent({
|
|
|
707
707
|
updateSyntax()
|
|
708
708
|
setCaretAtTheEnd(input.value)
|
|
709
709
|
|
|
710
|
-
|
|
711
|
-
|
|
710
|
+
const toEmit = trimmed.replace(
|
|
711
|
+
new RegExp(' ', 'g'),
|
|
712
|
+
' '
|
|
713
|
+
)
|
|
714
|
+
emit('input', toEmit)
|
|
715
|
+
emit('update:model-value', toEmit)
|
|
712
716
|
}
|
|
713
717
|
})
|
|
714
718
|
}
|
|
@@ -729,8 +733,12 @@ export default defineComponent({
|
|
|
729
733
|
isMenuOpen.value = true
|
|
730
734
|
updateSyntax()
|
|
731
735
|
const target = e.target as HTMLElement
|
|
732
|
-
|
|
733
|
-
|
|
736
|
+
const toEmit = target.innerText.replace(
|
|
737
|
+
new RegExp(' ', 'g'),
|
|
738
|
+
' '
|
|
739
|
+
)
|
|
740
|
+
emit('input', toEmit, e)
|
|
741
|
+
emit('update:model-value', toEmit)
|
|
734
742
|
if (autoTrim.value) {
|
|
735
743
|
debouncedHandleValueTrim.value()
|
|
736
744
|
}
|
|
@@ -739,9 +747,10 @@ export default defineComponent({
|
|
|
739
747
|
const onAutoSuggestClick = (e: Event, item: string): void => {
|
|
740
748
|
const newValue = clearSuggestion(modelValue.value.toString(), item)
|
|
741
749
|
if (!maxLength.value || newValue.length < maxLength.value) {
|
|
742
|
-
|
|
743
|
-
emit('
|
|
744
|
-
|
|
750
|
+
const toEmit = newValue.replace(new RegExp(' ', 'g'), ' ')
|
|
751
|
+
emit('input', toEmit, e)
|
|
752
|
+
emit('update:model-value', toEmit)
|
|
753
|
+
input.value.innerHTML = toEmit.replace(/ /g, ' ')
|
|
745
754
|
setCaretAtTheEnd(input.value)
|
|
746
755
|
isInternalChange.value = true
|
|
747
756
|
}
|
|
@@ -863,8 +872,9 @@ export default defineComponent({
|
|
|
863
872
|
stringSuggestions,
|
|
864
873
|
showPlaceholder,
|
|
865
874
|
spanText,
|
|
866
|
-
handleValueTrim,
|
|
867
|
-
|
|
875
|
+
handleValueTrim: debouncedHandleValueTrim,
|
|
876
|
+
onModelValueChange: debouncedOnModelValueChange,
|
|
877
|
+
isInternalChange
|
|
868
878
|
}
|
|
869
879
|
},
|
|
870
880
|
data() {
|
|
@@ -7,13 +7,24 @@
|
|
|
7
7
|
<rows-selector
|
|
8
8
|
v-if="withRowsPerPage && rowsPerPageState"
|
|
9
9
|
v-model="rowsPerPageState"
|
|
10
|
+
class="dl-pagination--sides dl-pagination--sides--left"
|
|
10
11
|
:options="rowsPerPageOptions"
|
|
11
12
|
:items-name="itemsName"
|
|
12
13
|
:disabled="disabled"
|
|
13
14
|
/>
|
|
15
|
+
<div
|
|
16
|
+
v-else-if="withLegend"
|
|
17
|
+
class="dl-pagination--sides dl-pagination--sides--left"
|
|
18
|
+
/>
|
|
19
|
+
|
|
14
20
|
<div
|
|
15
21
|
v-if="rowsPerPageState"
|
|
16
22
|
class="dl-pagination--navigation"
|
|
23
|
+
:class="
|
|
24
|
+
withLegend || (withRowsPerPage && rowsPerPageState)
|
|
25
|
+
? ''
|
|
26
|
+
: 'dl-pagination--navigation--maximized'
|
|
27
|
+
"
|
|
17
28
|
>
|
|
18
29
|
<page-navigation
|
|
19
30
|
:model-value="value"
|
|
@@ -45,6 +56,11 @@
|
|
|
45
56
|
:to="rowTo"
|
|
46
57
|
:total="totalItems"
|
|
47
58
|
:items-name="itemsName"
|
|
59
|
+
class="dl-pagination--sides dl-pagination--sides--right"
|
|
60
|
+
/>
|
|
61
|
+
<div
|
|
62
|
+
v-else-if="withRowsPerPage && rowsPerPageState"
|
|
63
|
+
class="dl-pagination--sides dl-pagination--sides--right"
|
|
48
64
|
/>
|
|
49
65
|
</div>
|
|
50
66
|
</div>
|
|
@@ -182,6 +198,7 @@ export default defineComponent({
|
|
|
182
198
|
|
|
183
199
|
&--container {
|
|
184
200
|
height: 100%;
|
|
201
|
+
width: 100%;
|
|
185
202
|
display: flex;
|
|
186
203
|
justify-content: space-between;
|
|
187
204
|
align-items: center;
|
|
@@ -189,6 +206,16 @@ export default defineComponent({
|
|
|
189
206
|
|
|
190
207
|
&--navigation {
|
|
191
208
|
display: flex;
|
|
209
|
+
flex-grow: 1;
|
|
210
|
+
width: 60%;
|
|
211
|
+
justify-content: center;
|
|
212
|
+
&--maximized {
|
|
213
|
+
width: 100%;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&--sides {
|
|
218
|
+
width: 20%;
|
|
192
219
|
}
|
|
193
220
|
}
|
|
194
221
|
</style>
|
|
@@ -33,7 +33,10 @@
|
|
|
33
33
|
:disabled="disabled"
|
|
34
34
|
@click="setPage(min)"
|
|
35
35
|
>
|
|
36
|
-
|
|
36
|
+
<DlEllipsis
|
|
37
|
+
:text="`${min}`"
|
|
38
|
+
style="justify-content: center; padding: 0 5px"
|
|
39
|
+
/>
|
|
37
40
|
</button>
|
|
38
41
|
<button
|
|
39
42
|
v-if="ellipsesStart"
|
|
@@ -55,7 +58,10 @@
|
|
|
55
58
|
:disabled="disabled"
|
|
56
59
|
@click="setPage(page)"
|
|
57
60
|
>
|
|
58
|
-
|
|
61
|
+
<DlEllipsis
|
|
62
|
+
:text="`${page}`"
|
|
63
|
+
style="justify-content: center; padding: 0 5px"
|
|
64
|
+
/>
|
|
59
65
|
</button>
|
|
60
66
|
</template>
|
|
61
67
|
<button
|
|
@@ -71,9 +77,13 @@
|
|
|
71
77
|
class="dl-pagination--page_button"
|
|
72
78
|
:class="{ 'dl-pagination--active': isActivePage(max) }"
|
|
73
79
|
:disabled="disabled"
|
|
80
|
+
:data-tooltip="max"
|
|
74
81
|
@click="setPage(max)"
|
|
75
82
|
>
|
|
76
|
-
|
|
83
|
+
<DlEllipsis
|
|
84
|
+
:text="`${max}`"
|
|
85
|
+
style="justify-content: center; padding: 0 5px"
|
|
86
|
+
/>
|
|
77
87
|
</button>
|
|
78
88
|
</div>
|
|
79
89
|
<button
|
|
@@ -104,12 +114,13 @@
|
|
|
104
114
|
<script lang="ts">
|
|
105
115
|
import { defineComponent } from 'vue-demi'
|
|
106
116
|
import { getColor } from '../../../../utils'
|
|
107
|
-
import { DlIcon } from '../../../essential'
|
|
117
|
+
import { DlIcon, DlEllipsis } from '../../../essential'
|
|
108
118
|
|
|
109
119
|
export default defineComponent({
|
|
110
120
|
name: 'PageNavigation',
|
|
111
121
|
components: {
|
|
112
|
-
DlIcon
|
|
122
|
+
DlIcon,
|
|
123
|
+
DlEllipsis
|
|
113
124
|
},
|
|
114
125
|
model: {
|
|
115
126
|
prop: 'modelValue',
|
|
@@ -173,7 +184,7 @@ export default defineComponent({
|
|
|
173
184
|
return this.value === this.max
|
|
174
185
|
},
|
|
175
186
|
buttonMinWidth(): string {
|
|
176
|
-
return
|
|
187
|
+
return `3em`
|
|
177
188
|
},
|
|
178
189
|
cssVars(): Record<string, any> {
|
|
179
190
|
return {
|
|
@@ -305,8 +316,6 @@ export default defineComponent({
|
|
|
305
316
|
line-height: 14px;
|
|
306
317
|
font-weight: 400;
|
|
307
318
|
white-space: nowrap;
|
|
308
|
-
overflow: hidden;
|
|
309
|
-
text-overflow: ellipsis;
|
|
310
319
|
}
|
|
311
320
|
|
|
312
321
|
&--active {
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="dl-pagination--legend">
|
|
3
3
|
{{ paginationContent }}
|
|
4
|
+
<dl-tooltip v-if="longItemsLength">
|
|
5
|
+
{{ fullContent }}
|
|
6
|
+
</dl-tooltip>
|
|
4
7
|
</div>
|
|
5
8
|
</template>
|
|
6
9
|
|
|
7
10
|
<script lang="ts">
|
|
8
11
|
import { defineComponent } from 'vue-demi'
|
|
12
|
+
import { DlTooltip } from '../../../shared'
|
|
9
13
|
|
|
10
14
|
export default defineComponent({
|
|
11
15
|
name: 'PaginationLegend',
|
|
16
|
+
components: {
|
|
17
|
+
DlTooltip
|
|
18
|
+
},
|
|
12
19
|
props: {
|
|
13
20
|
from: {
|
|
14
21
|
type: Number,
|
|
@@ -28,11 +35,43 @@ export default defineComponent({
|
|
|
28
35
|
}
|
|
29
36
|
},
|
|
30
37
|
computed: {
|
|
38
|
+
longItemsLength(): boolean {
|
|
39
|
+
return String(this.total).length > 6
|
|
40
|
+
},
|
|
31
41
|
paginationContent(): string {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
let totalItemsLength = String(this.total)
|
|
43
|
+
if (this.longItemsLength) {
|
|
44
|
+
totalItemsLength = `${totalItemsLength.slice(
|
|
45
|
+
0,
|
|
46
|
+
4
|
|
47
|
+
)}...${totalItemsLength.slice(-3)}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let toDisplayString = String(this.to)
|
|
51
|
+
if (toDisplayString.length > 3) {
|
|
52
|
+
toDisplayString = `${toDisplayString.slice(
|
|
53
|
+
0,
|
|
54
|
+
2
|
|
55
|
+
)}...${toDisplayString.slice(-2)}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let fromDisplayString = String(this.from)
|
|
59
|
+
if (fromDisplayString.length > 3) {
|
|
60
|
+
fromDisplayString = `${fromDisplayString.slice(
|
|
61
|
+
0,
|
|
62
|
+
2
|
|
63
|
+
)}...${fromDisplayString.slice(-2)}`
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const header = `Showing ${fromDisplayString} - ${toDisplayString}`
|
|
67
|
+
const footer = this.total
|
|
68
|
+
? `of ${totalItemsLength} ${this.itemsName}`
|
|
69
|
+
: ''
|
|
70
|
+
|
|
71
|
+
return `${header} ${footer}`
|
|
72
|
+
},
|
|
73
|
+
fullContent(): string {
|
|
74
|
+
return `Showing ${this.from} - ${this.to} of ${this.total} ${this.itemsName}`
|
|
36
75
|
}
|
|
37
76
|
}
|
|
38
77
|
})
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
style="
|
|
4
|
+
align-items: stretch;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
width: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
"
|
|
9
|
+
>
|
|
10
|
+
<div style="display: flex; width: 100%; justify-content: center">
|
|
4
11
|
<dl-input
|
|
5
12
|
v-model="rowsPerPage"
|
|
6
13
|
width="100px"
|
|
@@ -27,7 +34,10 @@
|
|
|
27
34
|
title="itemsName"
|
|
28
35
|
/>
|
|
29
36
|
</div>
|
|
30
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
class="row"
|
|
39
|
+
style="display: flex; width: 100%; justify-content: center"
|
|
40
|
+
>
|
|
31
41
|
<dl-checkbox
|
|
32
42
|
v-model="boundaryNumbers"
|
|
33
43
|
label="boundaryNumbers"
|
|
@@ -57,7 +67,7 @@
|
|
|
57
67
|
label="withRowsPerPage"
|
|
58
68
|
/>
|
|
59
69
|
</div>
|
|
60
|
-
<div style="width:
|
|
70
|
+
<div style="display: flex; width: 100%; justify-content: center">
|
|
61
71
|
<dl-pagination
|
|
62
72
|
v-model="page"
|
|
63
73
|
:max="max"
|
|
@@ -74,7 +84,14 @@
|
|
|
74
84
|
:with-rows-per-page="withRowsPerPage"
|
|
75
85
|
/>
|
|
76
86
|
</div>
|
|
77
|
-
<div
|
|
87
|
+
<div
|
|
88
|
+
style="
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
width: 100%;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
"
|
|
94
|
+
>
|
|
78
95
|
<h4>case 1</h4>
|
|
79
96
|
<p>with exactly 30 items, 15 per row. should be exactly 2 pages</p>
|
|
80
97
|
<dl-pagination
|
|
@@ -111,7 +128,7 @@ export default defineComponent({
|
|
|
111
128
|
boundaryNumbers: true,
|
|
112
129
|
boundaryLinks: true,
|
|
113
130
|
directionLinks: true,
|
|
114
|
-
total:
|
|
131
|
+
total: 99,
|
|
115
132
|
withQuickNavigation: true,
|
|
116
133
|
disabled: false,
|
|
117
134
|
itemsName: 'Rows',
|