@dataloop-ai/components 0.13.19 → 0.14.4
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/.nvmrc +1 -0
- package/README.md +3 -1
- package/package.json +19 -17
- package/src/assets/globals.scss +38 -3
- package/src/assets/grid.scss +9 -0
- package/src/components/DlAccordion/DlAccordion.vue +4 -4
- package/src/components/DlAlert.vue +6 -6
- package/src/components/DlChart/BrushThumb.vue +83 -0
- package/src/components/DlChart/DlBarChart.vue +545 -0
- package/src/components/DlChart/DlBrush.vue +475 -0
- package/src/components/DlChart/DlChartLabels.vue +279 -0
- package/src/components/DlChart/DlChartLegend.vue +141 -0
- package/src/components/DlChart/DlColumnChart.vue +555 -0
- package/src/components/DlChart/DlLineChart.vue +644 -0
- package/src/components/DlChart/DlScrollBar.vue +147 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChart.vue +448 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChartLegend.vue +281 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChartWidget.vue +64 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartAnimation.ts +4 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartData.ts +16 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartOptions.ts +11 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartProps.ts +8 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutWithOriginalColor.ts +13 -0
- package/src/components/DlChart/chart.ts +122 -0
- package/src/components/DlChart/index.ts +36 -0
- package/src/components/DlChart/props.ts +348 -0
- package/src/components/DlChart/typedCharts.ts +88 -0
- package/src/components/DlChart/types.ts +63 -0
- package/src/components/DlChart/utils.ts +153 -0
- package/src/components/DlChip/DlChip.vue +40 -13
- package/src/components/DlCounters.vue +31 -7
- package/src/components/DlDatePicker/DlCalendar.vue +22 -10
- package/src/components/DlDatePicker/DlDatePicker.vue +8 -5
- package/src/components/DlDateTimeRange/types.ts +2 -2
- package/src/components/DlDropdownButton.vue +5 -3
- package/src/components/DlMenu/DlMenu.vue +4 -2
- package/src/components/DlPagination/RowsSelector.vue +15 -2
- package/src/components/DlPopup/DlPopup.vue +0 -1
- package/src/components/DlRange/DlRange.vue +3 -2
- package/src/components/DlSearch.vue +1 -1
- package/src/components/DlSelect/DlSelect.vue +3 -2
- package/src/components/DlSlider/sliderStyles.scss +4 -0
- package/src/components/DlSlider/useSlider.ts +39 -12
- package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +1 -1
- package/src/components/DlSpinner.vue +259 -0
- package/src/components/DlTable/DlTable.vue +4 -1
- package/src/components/DlTable/hooks/tablePagination.ts +8 -2
- package/src/components/DlTextArea.vue +9 -0
- package/src/components/DlTextInput.vue +4 -2
- package/src/components/DlThemeProvider.vue +22 -13
- package/src/components/DlToastMessage/api/useToast.ts +23 -0
- package/src/components/DlToastMessage/components/ToastComponent.vue +279 -0
- package/src/components/DlToastMessage/index.ts +5 -0
- package/src/components/DlToastMessage/types.ts +4 -0
- package/src/components/DlToastMessage/utils/config.ts +17 -0
- package/src/components/DlToastMessage/utils/render.ts +56 -0
- package/src/components/DlTypography.vue +1 -1
- package/src/components/DlWidget/DlGrid.vue +33 -0
- package/src/components/DlWidget/DlGridRow.vue +32 -0
- package/src/components/DlWidget/DlWidget.vue +202 -11
- package/src/components/DlWidget/index.ts +2 -2
- package/src/components/DlWidget/utils.ts +26 -19
- package/src/components/index.ts +8 -3
- package/src/demo/BarChartDemo.vue +77 -0
- package/src/demo/ColumnChartDemo.vue +230 -0
- package/src/demo/DlButtonDemo.vue +1 -1
- package/src/demo/DlChartDoughnutDemo.vue +229 -0
- package/src/demo/DlChipDemo.vue +42 -18
- package/src/demo/DlDialogBoxDemo.vue +4 -4
- package/src/demo/DlDropdownButtonDemo.vue +1 -1
- package/src/demo/DlLineChartDemo.vue +375 -0
- package/src/demo/DlMenuDemo.vue +1 -1
- package/src/demo/DlOptionGroupDemo.vue +1 -1
- package/src/demo/DlSelectDemo.vue +1 -1
- package/src/demo/DlSpinnerDemo.vue +20 -0
- package/src/demo/DlTableDemo.vue +13 -94
- package/src/demo/DlToastMessageDemo.vue +143 -0
- package/src/demo/DlWidgetDemo.vue +105 -143
- package/src/demo/index.ts +20 -2
- package/src/hooks/use-theme.ts +19 -0
- package/src/utils/abbreviate-to-string.ts +14 -0
- package/src/utils/colors.ts +47 -0
- package/src/utils/getRootStyles.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/position-engine.ts +11 -2
- package/src/utils/swapNodes.ts +30 -0
- package/src/utils/update-key.ts +90 -0
- package/tsconfig.json +0 -1
- package/vite.config.ts +17 -0
- package/Dockerfile +0 -12
- package/jest.config.js +0 -16
- package/jest.setup.js +0 -59
- package/src/components/DlWidget/DlWidgetGrid.vue +0 -360
- package/storybook.js +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
+
v-if="isVisible"
|
|
3
4
|
:id="uuid"
|
|
4
|
-
ref="dlChipRef"
|
|
5
5
|
:tabindex="tabIndex"
|
|
6
6
|
class="dl-chip"
|
|
7
7
|
:style="cssChipVars"
|
|
@@ -17,16 +17,27 @@
|
|
|
17
17
|
:icon="icon"
|
|
18
18
|
/>
|
|
19
19
|
</span>
|
|
20
|
-
<slot>
|
|
21
|
-
{{ hasLabel ? label : null }}
|
|
22
|
-
</slot>
|
|
23
20
|
<dl-tooltip v-if="overflow && isOverflowing">
|
|
24
21
|
{{ label }}
|
|
25
22
|
</dl-tooltip>
|
|
23
|
+
<div
|
|
24
|
+
v-if="hasLabelSlot || hasLabel"
|
|
25
|
+
class="dl-chip--content"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
ref="dlChipRef"
|
|
29
|
+
class="dl-chip--ellipsis"
|
|
30
|
+
>
|
|
31
|
+
<slot>
|
|
32
|
+
{{ hasLabel ? label : null }}
|
|
33
|
+
</slot>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
26
37
|
<span
|
|
27
38
|
v-if="removable"
|
|
28
39
|
class="dl-chip-remove-icon-container"
|
|
29
|
-
@click="
|
|
40
|
+
@click="remove"
|
|
30
41
|
>
|
|
31
42
|
<dl-icon
|
|
32
43
|
class="dl-chip-remove-icon"
|
|
@@ -94,10 +105,12 @@ export default defineComponent({
|
|
|
94
105
|
},
|
|
95
106
|
emits: ['remove'],
|
|
96
107
|
setup() {
|
|
108
|
+
const isVisible = ref(true)
|
|
97
109
|
const dlChipRef = ref(null)
|
|
98
110
|
const { hasEllipsis } = useSizeObserver(dlChipRef)
|
|
99
111
|
|
|
100
112
|
return {
|
|
113
|
+
isVisible,
|
|
101
114
|
uuid: `dl-chip-${v4()}`,
|
|
102
115
|
dlChipRef,
|
|
103
116
|
isOverflowing: hasEllipsis
|
|
@@ -111,6 +124,9 @@ export default defineComponent({
|
|
|
111
124
|
this.label !== ''
|
|
112
125
|
)
|
|
113
126
|
},
|
|
127
|
+
hasLabelSlot(): boolean {
|
|
128
|
+
return !!this.$slots['default']
|
|
129
|
+
},
|
|
114
130
|
hasIcon(): boolean {
|
|
115
131
|
return typeof this.icon === 'string' && this.icon !== ''
|
|
116
132
|
},
|
|
@@ -167,9 +183,10 @@ export default defineComponent({
|
|
|
167
183
|
}
|
|
168
184
|
},
|
|
169
185
|
methods: {
|
|
170
|
-
|
|
186
|
+
remove(e: Event) {
|
|
171
187
|
if (!this.disabled) {
|
|
172
|
-
this
|
|
188
|
+
this.isVisible = false
|
|
189
|
+
this.$emit('remove')
|
|
173
190
|
}
|
|
174
191
|
}
|
|
175
192
|
}
|
|
@@ -179,6 +196,7 @@ export default defineComponent({
|
|
|
179
196
|
<style scoped lang="scss">
|
|
180
197
|
.dl-chip {
|
|
181
198
|
position: relative;
|
|
199
|
+
display: flex;
|
|
182
200
|
vertical-align: middle;
|
|
183
201
|
text-transform: var(--dl-chip-text-transform);
|
|
184
202
|
font-size: var(--dl-font-size-body);
|
|
@@ -189,19 +207,27 @@ export default defineComponent({
|
|
|
189
207
|
min-width: 18px; // +2px from borders
|
|
190
208
|
max-height: 18px; // +2px from borders
|
|
191
209
|
min-height: 12px;
|
|
192
|
-
height: fit-content;
|
|
193
210
|
max-width: var(--dl-chip-max-width);
|
|
194
|
-
width: fit-content;
|
|
195
211
|
color: var(--dl-chip-text-color);
|
|
196
212
|
background-color: var(--dl-chip-bg-color);
|
|
197
|
-
white-space: nowrap;
|
|
198
|
-
overflow: hidden;
|
|
199
|
-
text-overflow: ellipsis;
|
|
200
213
|
border: var(--dl-chip-border);
|
|
201
214
|
&::first-letter,
|
|
202
215
|
& > *::first-letter {
|
|
203
216
|
text-transform: capitalize;
|
|
204
217
|
}
|
|
218
|
+
|
|
219
|
+
&--content {
|
|
220
|
+
cursor: default;
|
|
221
|
+
width: auto;
|
|
222
|
+
min-width: 0;
|
|
223
|
+
max-width: 100%;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&--ellipsis {
|
|
227
|
+
text-overflow: ellipsis;
|
|
228
|
+
white-space: nowrap;
|
|
229
|
+
overflow: hidden;
|
|
230
|
+
}
|
|
205
231
|
}
|
|
206
232
|
.dl-chip-remove-icon-container {
|
|
207
233
|
cursor: var(--dl-chip-left-icon-cursor);
|
|
@@ -223,7 +249,7 @@ export default defineComponent({
|
|
|
223
249
|
|
|
224
250
|
.dl-chip-left-icon-container {
|
|
225
251
|
@extend .dl-chip-remove-icon-container;
|
|
226
|
-
cursor:
|
|
252
|
+
cursor: default;
|
|
227
253
|
left: 0;
|
|
228
254
|
width: 18px;
|
|
229
255
|
&:active {
|
|
@@ -240,5 +266,6 @@ export default defineComponent({
|
|
|
240
266
|
|
|
241
267
|
.dl-chip-remove-icon {
|
|
242
268
|
color: var(--dl-chip-text-color);
|
|
269
|
+
display: flex !important;
|
|
243
270
|
}
|
|
244
271
|
</style>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
:id="uuid"
|
|
4
|
-
class="container"
|
|
4
|
+
class="dl-counters-container"
|
|
5
|
+
:style="cssVars"
|
|
5
6
|
>
|
|
6
7
|
<ul>
|
|
7
8
|
<li
|
|
@@ -11,7 +12,11 @@
|
|
|
11
12
|
>
|
|
12
13
|
<div :class="computeClass('item-content')">
|
|
13
14
|
<p :class="computeClass('item-value')">
|
|
14
|
-
{{
|
|
15
|
+
{{
|
|
16
|
+
abbreviateNumbers
|
|
17
|
+
? abbreviateNumber(item.value)
|
|
18
|
+
: item.value
|
|
19
|
+
}}
|
|
15
20
|
</p>
|
|
16
21
|
<p
|
|
17
22
|
v-show="item.text"
|
|
@@ -35,6 +40,7 @@
|
|
|
35
40
|
<script lang="ts">
|
|
36
41
|
import { v4 } from 'uuid'
|
|
37
42
|
import { defineComponent, PropType } from 'vue-demi'
|
|
43
|
+
import { abbreviateToString } from '../utils/abbreviate-to-string'
|
|
38
44
|
|
|
39
45
|
interface CounterItem {
|
|
40
46
|
value?: number
|
|
@@ -49,12 +55,20 @@ export default defineComponent({
|
|
|
49
55
|
type: Boolean,
|
|
50
56
|
default: false
|
|
51
57
|
},
|
|
58
|
+
spacing: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '30px'
|
|
61
|
+
},
|
|
52
62
|
items: {
|
|
53
63
|
type: Array as PropType<CounterItem[]>,
|
|
54
64
|
default: (): CounterItem[] => [],
|
|
55
65
|
validator(value: CounterItem[]): boolean {
|
|
56
66
|
return value.length <= 8
|
|
57
67
|
}
|
|
68
|
+
},
|
|
69
|
+
abbreviateNumbers: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: true
|
|
58
72
|
}
|
|
59
73
|
},
|
|
60
74
|
data() {
|
|
@@ -62,10 +76,20 @@ export default defineComponent({
|
|
|
62
76
|
uuid: `dl-counters-${v4()}`
|
|
63
77
|
}
|
|
64
78
|
},
|
|
79
|
+
computed: {
|
|
80
|
+
cssVars(): Record<string, string> {
|
|
81
|
+
return {
|
|
82
|
+
'--dl-counter-spacing': this.spacing
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
65
86
|
methods: {
|
|
66
87
|
capitalize(value: string): string {
|
|
67
88
|
return value[0].toUpperCase() + value.slice(1)
|
|
68
89
|
},
|
|
90
|
+
abbreviateNumber(nr: number) {
|
|
91
|
+
if (nr) return abbreviateToString(nr)
|
|
92
|
+
},
|
|
69
93
|
computeClass(value: string): (string | boolean)[] {
|
|
70
94
|
return [value, this.small && `${value}--small`]
|
|
71
95
|
}
|
|
@@ -74,7 +98,7 @@ export default defineComponent({
|
|
|
74
98
|
</script>
|
|
75
99
|
|
|
76
100
|
<style scoped lang="scss">
|
|
77
|
-
.container {
|
|
101
|
+
.dl-counters-container {
|
|
78
102
|
padding: 10px;
|
|
79
103
|
width: fit-content;
|
|
80
104
|
}
|
|
@@ -96,12 +120,12 @@ ul {
|
|
|
96
120
|
display: flex;
|
|
97
121
|
flex-direction: column;
|
|
98
122
|
align-items: center;
|
|
99
|
-
padding-left:
|
|
100
|
-
padding-right:
|
|
123
|
+
padding-left: var(--dl-counter-spacing);
|
|
124
|
+
padding-right: var(--dl-counter-spacing);
|
|
101
125
|
|
|
102
126
|
&--small {
|
|
103
|
-
padding-left:
|
|
104
|
-
padding-right:
|
|
127
|
+
padding-left: var(--dl-counter-spacing);
|
|
128
|
+
padding-right: var(--dl-counter-spacing);
|
|
105
129
|
}
|
|
106
130
|
}
|
|
107
131
|
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
@mouseenter="handleMouseEnter(date)"
|
|
48
48
|
>
|
|
49
49
|
<div
|
|
50
|
+
v-if="!date.isDisabled"
|
|
50
51
|
class="dl-calendar--inner_day"
|
|
51
52
|
:style="getInnerDayStyle(date)"
|
|
52
53
|
>
|
|
@@ -135,27 +136,37 @@ export default defineComponent({
|
|
|
135
136
|
if (this.modelValue === null) return
|
|
136
137
|
|
|
137
138
|
const style: Record<string, any> = {}
|
|
139
|
+
if (value.isDisabled) return style
|
|
138
140
|
|
|
139
141
|
const from = new CalendarDate(this.modelValue.from)
|
|
140
142
|
const to = new CalendarDate(this.modelValue.to)
|
|
141
143
|
|
|
142
144
|
if (!from.isSameOrAfter(to, 'date')) {
|
|
143
|
-
const bgColor = '
|
|
145
|
+
const bgColor = 'var(--dl-date-picker-selected-strip)'
|
|
144
146
|
|
|
145
|
-
if (value.isAfter(from, '
|
|
147
|
+
if (value.isAfter(from, 'day') && value.isBefore(to, 'day')) {
|
|
146
148
|
style.background = bgColor
|
|
147
|
-
} else if (value.isSame(from, '
|
|
149
|
+
} else if (value.isSame(from, 'day')) {
|
|
148
150
|
style.background = `linear-gradient(to right, transparent 50%, ${bgColor} 50%)`
|
|
149
|
-
} else if (value.isSame(to, '
|
|
151
|
+
} else if (value.isSame(to, 'day')) {
|
|
150
152
|
style.background = `linear-gradient(to right, ${bgColor} 50%, transparent 50%)`
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
const radius = '11px'
|
|
156
|
+
const valueClone = value.clone()
|
|
154
157
|
|
|
155
|
-
if (
|
|
158
|
+
if (
|
|
159
|
+
value.day() === 0 ||
|
|
160
|
+
value.isSame(valueClone.startOf('month'), 'day')
|
|
161
|
+
) {
|
|
156
162
|
style.borderTopLeftRadius = radius
|
|
157
163
|
style.borderBottomLeftRadius = radius
|
|
158
|
-
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (
|
|
167
|
+
value.day() === DAYS_IN_WEEK - 1 ||
|
|
168
|
+
value.isSame(valueClone.endOf('month'), 'day')
|
|
169
|
+
) {
|
|
159
170
|
style.borderTopRightRadius = radius
|
|
160
171
|
style.borderBottomRightRadius = radius
|
|
161
172
|
}
|
|
@@ -166,8 +177,10 @@ export default defineComponent({
|
|
|
166
177
|
|
|
167
178
|
getInnerDayStyle(value: Partial<CalendarDate>) {
|
|
168
179
|
let style: Record<string, any> = {}
|
|
169
|
-
const disabledOpacity = 0.6
|
|
170
180
|
|
|
181
|
+
if (value.isDisabled) return style
|
|
182
|
+
|
|
183
|
+
const disabledOpacity = 0.6
|
|
171
184
|
const isToday = value.isSame(
|
|
172
185
|
new CalendarDate().startOf('day'),
|
|
173
186
|
'day'
|
|
@@ -198,14 +211,13 @@ export default defineComponent({
|
|
|
198
211
|
const to = new CalendarDate(this.modelValue.to)
|
|
199
212
|
|
|
200
213
|
const isIntervalBoundary =
|
|
201
|
-
value.isSame(from, '
|
|
214
|
+
value.isSame(from, 'day') || value.isSame(to, 'day')
|
|
202
215
|
|
|
203
216
|
if (isIntervalBoundary && this.disabled) {
|
|
204
217
|
style = {
|
|
205
218
|
...style,
|
|
206
219
|
...selectedStyle,
|
|
207
|
-
opacity: disabledOpacity
|
|
208
|
-
color: 'var(--dl-color-disabled)'
|
|
220
|
+
opacity: disabledOpacity
|
|
209
221
|
}
|
|
210
222
|
} else if (isIntervalBoundary) {
|
|
211
223
|
style = {
|
|
@@ -253,11 +253,13 @@ export default defineComponent({
|
|
|
253
253
|
if (!this.isSelectionMode) return
|
|
254
254
|
|
|
255
255
|
if (this.type === 'day') {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
const calendarDateClone = this.calendarTo?.activeDate.clone()
|
|
257
|
+
|
|
258
|
+
const isLastDayOfTheMonth = calendarDateClone
|
|
259
|
+
.endOf('month')
|
|
260
|
+
.isSame(new CalendarDate(date), 'day')
|
|
261
|
+
|
|
262
|
+
if (isLastDayOfTheMonth) {
|
|
261
263
|
if (this.timeout) {
|
|
262
264
|
clearTimeout(this.timeout)
|
|
263
265
|
}
|
|
@@ -293,6 +295,7 @@ export default defineComponent({
|
|
|
293
295
|
}
|
|
294
296
|
})
|
|
295
297
|
</script>
|
|
298
|
+
|
|
296
299
|
<style lang="scss" scoped>
|
|
297
300
|
.dl-date-picker {
|
|
298
301
|
user-select: none;
|
|
@@ -12,7 +12,7 @@ export const DAY_SIDEBAR_OPTION = {
|
|
|
12
12
|
} as const
|
|
13
13
|
|
|
14
14
|
export type DAY_SIDEBAR_OPTION =
|
|
15
|
-
typeof DAY_SIDEBAR_OPTION[keyof typeof DAY_SIDEBAR_OPTION]
|
|
15
|
+
(typeof DAY_SIDEBAR_OPTION)[keyof typeof DAY_SIDEBAR_OPTION]
|
|
16
16
|
|
|
17
17
|
export const MONTH_SIDEBAR_OPTION = {
|
|
18
18
|
this_month: 'this_month',
|
|
@@ -25,7 +25,7 @@ export const MONTH_SIDEBAR_OPTION = {
|
|
|
25
25
|
} as const
|
|
26
26
|
|
|
27
27
|
export type MONTH_SIDEBAR_OPTION =
|
|
28
|
-
typeof MONTH_SIDEBAR_OPTION[keyof typeof MONTH_SIDEBAR_OPTION]
|
|
28
|
+
(typeof MONTH_SIDEBAR_OPTION)[keyof typeof MONTH_SIDEBAR_OPTION]
|
|
29
29
|
|
|
30
30
|
export type DayTypeOption = {
|
|
31
31
|
title: string
|
|
@@ -78,7 +78,8 @@
|
|
|
78
78
|
:class="contentClass"
|
|
79
79
|
:style="contentStyle"
|
|
80
80
|
:cover="cover"
|
|
81
|
-
|
|
81
|
+
fit-container
|
|
82
|
+
:fit-content="fitContent"
|
|
82
83
|
:persistent="persistent"
|
|
83
84
|
:auto-close="autoClose"
|
|
84
85
|
:anchor="menuAnchor"
|
|
@@ -142,7 +143,8 @@
|
|
|
142
143
|
:class="contentClass"
|
|
143
144
|
:style="contentStyle"
|
|
144
145
|
:cover="cover"
|
|
145
|
-
|
|
146
|
+
fit-container
|
|
147
|
+
:fit-content="fitContent"
|
|
146
148
|
:persistent="persistent"
|
|
147
149
|
:auto-close="autoClose"
|
|
148
150
|
:anchor="menuAnchor"
|
|
@@ -228,7 +230,7 @@ export default defineComponent({
|
|
|
228
230
|
uppercase: Boolean,
|
|
229
231
|
outlined: Boolean,
|
|
230
232
|
padding: { type: String, default: '5px' },
|
|
231
|
-
|
|
233
|
+
fitContent: Boolean
|
|
232
234
|
},
|
|
233
235
|
emits: [
|
|
234
236
|
'update:model-value',
|
|
@@ -98,7 +98,8 @@ export default defineComponent({
|
|
|
98
98
|
|
|
99
99
|
noRefocus: Boolean,
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
fitContainer: Boolean,
|
|
102
|
+
fitContent: Boolean,
|
|
102
103
|
cover: Boolean,
|
|
103
104
|
|
|
104
105
|
square: Boolean,
|
|
@@ -358,7 +359,8 @@ export default defineComponent({
|
|
|
358
359
|
anchorOrigin: anchorOrigin.value,
|
|
359
360
|
selfOrigin: selfOrigin.value,
|
|
360
361
|
absoluteOffset,
|
|
361
|
-
|
|
362
|
+
fitContainer: props.fitContainer,
|
|
363
|
+
fitContent: props.fitContent,
|
|
362
364
|
cover: props.cover,
|
|
363
365
|
maxHeight: props.maxHeight,
|
|
364
366
|
maxWidth: props.maxWidth
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="dl-pagination--rows_selector">
|
|
3
3
|
<span class="dl-pagination--rows_per_page_label">{{ itemsName }} per page:</span>
|
|
4
|
+
<dl-typography
|
|
5
|
+
v-if="hasSingeValue"
|
|
6
|
+
color="dl-color-darker"
|
|
7
|
+
>
|
|
8
|
+
{{ modelValue }}
|
|
9
|
+
</dl-typography>
|
|
4
10
|
<dl-select
|
|
11
|
+
v-else
|
|
5
12
|
size="s"
|
|
6
13
|
:options="options"
|
|
7
14
|
:disabled="disabled"
|
|
8
|
-
:fit="false"
|
|
9
15
|
width="min-content"
|
|
10
16
|
align-right
|
|
11
17
|
disable-dropdown-icon-padding
|
|
@@ -19,11 +25,13 @@
|
|
|
19
25
|
<script lang="ts">
|
|
20
26
|
import { defineComponent, PropType } from 'vue-demi'
|
|
21
27
|
import { DlSelect } from '../DlSelect'
|
|
28
|
+
import DlTypography from '../DlTypography.vue'
|
|
22
29
|
|
|
23
30
|
export default defineComponent({
|
|
24
31
|
name: 'RowsSelector',
|
|
25
32
|
components: {
|
|
26
|
-
DlSelect
|
|
33
|
+
DlSelect,
|
|
34
|
+
DlTypography
|
|
27
35
|
},
|
|
28
36
|
model: {
|
|
29
37
|
prop: 'modelValue',
|
|
@@ -45,6 +53,11 @@ export default defineComponent({
|
|
|
45
53
|
disabled: Boolean
|
|
46
54
|
},
|
|
47
55
|
emits: ['update:modelValue'],
|
|
56
|
+
computed: {
|
|
57
|
+
hasSingeValue(): boolean {
|
|
58
|
+
return this.options.length <= 1
|
|
59
|
+
}
|
|
60
|
+
},
|
|
48
61
|
methods: {
|
|
49
62
|
setSelectedItem(val: number) {
|
|
50
63
|
this.$emit('update:modelValue', val)
|
|
@@ -98,6 +98,7 @@ import { v4 } from 'uuid'
|
|
|
98
98
|
type DlRangeModelValue = {
|
|
99
99
|
min: number | null
|
|
100
100
|
max: number | null
|
|
101
|
+
both?: boolean
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
interface DlRangeProps extends SliderProps {
|
|
@@ -234,7 +235,7 @@ export default defineComponent({
|
|
|
234
235
|
return evt
|
|
235
236
|
})
|
|
236
237
|
|
|
237
|
-
function getEvents(side: 'min' | 'max') {
|
|
238
|
+
function getEvents(side: 'min' | 'max' | 'both') {
|
|
238
239
|
return isMobile !== true && state.editable.value === true
|
|
239
240
|
? {
|
|
240
241
|
onFocus: () => {
|
|
@@ -385,7 +386,7 @@ export default defineComponent({
|
|
|
385
386
|
evt,
|
|
386
387
|
{
|
|
387
388
|
step: state.step.value,
|
|
388
|
-
focus: state.focus.value,
|
|
389
|
+
focus: state.focus.value as 'min' | 'max',
|
|
389
390
|
decimals: state.decimals.value
|
|
390
391
|
},
|
|
391
392
|
{ min: props.min, max: props.max },
|
|
@@ -135,7 +135,8 @@
|
|
|
135
135
|
<dl-menu
|
|
136
136
|
ref="menu"
|
|
137
137
|
v-model="isExpanded"
|
|
138
|
-
|
|
138
|
+
fit-container
|
|
139
|
+
:fit-content="fitContent"
|
|
139
140
|
square
|
|
140
141
|
no-focus
|
|
141
142
|
:offset="[0, 3]"
|
|
@@ -298,7 +299,7 @@ export default defineComponent({
|
|
|
298
299
|
search: { type: Boolean, default: false },
|
|
299
300
|
required: { type: Boolean, default: false },
|
|
300
301
|
optional: { type: Boolean, default: false },
|
|
301
|
-
|
|
302
|
+
fitContent: Boolean,
|
|
302
303
|
tooltip: { type: String, default: '' },
|
|
303
304
|
highlightSelected: { type: Boolean, default: false },
|
|
304
305
|
type: { type: String, default: 'text' },
|
|
@@ -26,16 +26,24 @@ export interface SliderProps extends FormProps {
|
|
|
26
26
|
tabindex: number | string
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export type Dragging =
|
|
29
|
+
export type Dragging = {
|
|
30
|
+
left: number
|
|
31
|
+
top: number
|
|
32
|
+
right?: number
|
|
33
|
+
width: number
|
|
34
|
+
height: number
|
|
35
|
+
bottom?: number
|
|
30
36
|
ratioMin: number
|
|
31
37
|
ratioMax: number
|
|
32
38
|
valueMin: number
|
|
33
39
|
valueMax: number
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
x?: number
|
|
41
|
+
y?: number
|
|
42
|
+
offsetRatio?: number
|
|
43
|
+
rangeRatio?: number
|
|
44
|
+
offsetModel?: number
|
|
45
|
+
rangeValue?: number
|
|
46
|
+
type?: (typeof dragType)[keyof typeof dragType]
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export const dragType = {
|
|
@@ -48,7 +56,6 @@ export const useSliderProps = {
|
|
|
48
56
|
...useFormProps,
|
|
49
57
|
text: {
|
|
50
58
|
type: String,
|
|
51
|
-
required: true,
|
|
52
59
|
default: ''
|
|
53
60
|
},
|
|
54
61
|
width: {
|
|
@@ -63,6 +70,8 @@ export const useSliderProps = {
|
|
|
63
70
|
type: Number,
|
|
64
71
|
default: 100
|
|
65
72
|
},
|
|
73
|
+
innerMin: Number,
|
|
74
|
+
innerMax: Number,
|
|
66
75
|
step: {
|
|
67
76
|
type: Number,
|
|
68
77
|
default: 1,
|
|
@@ -102,7 +111,7 @@ export const useSliderProps = {
|
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
export const useSliderEmits = ['pan', 'update:model-value'
|
|
114
|
+
export const useSliderEmits = ['pan', 'change', 'update:model-value']
|
|
106
115
|
|
|
107
116
|
export default function ({
|
|
108
117
|
updateValue,
|
|
@@ -116,7 +125,7 @@ export default function ({
|
|
|
116
125
|
const { props, emit }: { props: any; emit: any } = getCurrentInstance()!
|
|
117
126
|
|
|
118
127
|
const active: Ref<boolean> = ref(false)
|
|
119
|
-
const focus: Ref<'min' | 'max' | boolean> = ref(false)
|
|
128
|
+
const focus: Ref<'min' | 'max' | 'both' | boolean> = ref(false)
|
|
120
129
|
const dragging: Ref<Dragging | boolean | undefined> = ref(false)
|
|
121
130
|
|
|
122
131
|
const editable = computed(
|
|
@@ -126,6 +135,17 @@ export default function ({
|
|
|
126
135
|
props.min < props.max
|
|
127
136
|
)
|
|
128
137
|
|
|
138
|
+
const innerMin = computed(() =>
|
|
139
|
+
isNaN(props.innerMin) === true || props.innerMin < props.min
|
|
140
|
+
? props.min
|
|
141
|
+
: props.innerMin
|
|
142
|
+
)
|
|
143
|
+
const innerMax = computed(() =>
|
|
144
|
+
isNaN(props.innerMax) === true || props.innerMax > props.max
|
|
145
|
+
? props.max
|
|
146
|
+
: props.innerMax
|
|
147
|
+
)
|
|
148
|
+
|
|
129
149
|
const decimals = computed(
|
|
130
150
|
() => (String(props.step).trim().split('.')[1] || '').length
|
|
131
151
|
)
|
|
@@ -181,9 +201,14 @@ export default function ({
|
|
|
181
201
|
return trackLen.value === 0 ? 0 : (model - props.min) / trackLen.value
|
|
182
202
|
}
|
|
183
203
|
|
|
184
|
-
function getDraggingRatio(evt: MouseEvent, dragging: Dragging) {
|
|
204
|
+
function getDraggingRatio(evt: MouseEvent, dragging: Dragging | boolean) {
|
|
185
205
|
const pos = position(evt)
|
|
186
|
-
const val = between(
|
|
206
|
+
const val = between(
|
|
207
|
+
(pos.left - (dragging as Dragging).left) /
|
|
208
|
+
(dragging as Dragging).width,
|
|
209
|
+
0,
|
|
210
|
+
1
|
|
211
|
+
)
|
|
187
212
|
|
|
188
213
|
return between(val, minRatio.value, maxRatio.value)
|
|
189
214
|
}
|
|
@@ -259,7 +284,9 @@ export default function ({
|
|
|
259
284
|
tabindex,
|
|
260
285
|
attributes,
|
|
261
286
|
step,
|
|
262
|
-
decimals
|
|
287
|
+
decimals,
|
|
288
|
+
innerMin,
|
|
289
|
+
innerMax
|
|
263
290
|
},
|
|
264
291
|
|
|
265
292
|
methods: {
|