@bimdata/design-system 2.0.0-rc.36 → 2.0.0-rc.37
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
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="bimdata-input"
|
|
4
|
-
:class="{
|
|
4
|
+
:class="{
|
|
5
|
+
error,
|
|
6
|
+
success,
|
|
7
|
+
disabled,
|
|
8
|
+
loading,
|
|
9
|
+
'not-empty': modelValue != null,
|
|
10
|
+
}"
|
|
5
11
|
:style="style"
|
|
6
12
|
>
|
|
7
13
|
<input
|
|
@@ -40,7 +46,7 @@ export default {
|
|
|
40
46
|
},
|
|
41
47
|
props: {
|
|
42
48
|
modelValue: {
|
|
43
|
-
type: [String, Number
|
|
49
|
+
type: [String, Number],
|
|
44
50
|
default: "",
|
|
45
51
|
},
|
|
46
52
|
placeholder: {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bimdata-slider">
|
|
3
|
+
<input
|
|
4
|
+
ref="input"
|
|
5
|
+
class="bimdata-slider-input"
|
|
6
|
+
type="range"
|
|
7
|
+
:style="`--background-size: ${backgroundSize}%`"
|
|
8
|
+
:min="min"
|
|
9
|
+
:max="max"
|
|
10
|
+
:step="step"
|
|
11
|
+
:value="modelValue"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
@input="onInput"
|
|
14
|
+
/>
|
|
15
|
+
<output
|
|
16
|
+
v-if="tooltip"
|
|
17
|
+
class="bimdata-slider-tooltip"
|
|
18
|
+
:style="{ left: tooltipPosition }"
|
|
19
|
+
>{{ modelValue }}</output
|
|
20
|
+
>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
export default {
|
|
26
|
+
props: {
|
|
27
|
+
min: {
|
|
28
|
+
type: [Number, String],
|
|
29
|
+
default: null,
|
|
30
|
+
},
|
|
31
|
+
max: {
|
|
32
|
+
type: [Number, String],
|
|
33
|
+
default: null,
|
|
34
|
+
},
|
|
35
|
+
step: {
|
|
36
|
+
type: [Number, String],
|
|
37
|
+
default: null,
|
|
38
|
+
},
|
|
39
|
+
modelValue: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 0,
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
tooltip: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
emits: ["update:modelValue"],
|
|
53
|
+
data() {
|
|
54
|
+
return {
|
|
55
|
+
backgroundSize: 0,
|
|
56
|
+
tooltipPosition: `calc(${this.modelValue}% + (${
|
|
57
|
+
8 - this.modelValue * 0.18
|
|
58
|
+
}px))`,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
watch: {
|
|
62
|
+
modelValue() {
|
|
63
|
+
this.$nextTick(() => {
|
|
64
|
+
this.backgroundSize = this.getBackgroundSize();
|
|
65
|
+
if (this.tooltip) {
|
|
66
|
+
this.getTooltipPosition();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
mounted() {
|
|
72
|
+
this.backgroundSize = this.getBackgroundSize();
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
getBackgroundSize() {
|
|
76
|
+
const input = this.$refs.input;
|
|
77
|
+
|
|
78
|
+
if (!input) return null;
|
|
79
|
+
|
|
80
|
+
const min = +input.min || 0;
|
|
81
|
+
const max = +input.max || 100;
|
|
82
|
+
const value = +input.value;
|
|
83
|
+
|
|
84
|
+
const size = ((value - min) / (max - min)) * 100;
|
|
85
|
+
|
|
86
|
+
return size;
|
|
87
|
+
},
|
|
88
|
+
onInput(event) {
|
|
89
|
+
this.$emit("update:modelValue", +event.target.value);
|
|
90
|
+
},
|
|
91
|
+
getTooltipPosition() {
|
|
92
|
+
const min = this.min ? this.min : 0;
|
|
93
|
+
const max = this.max ? this.max : 100;
|
|
94
|
+
const newVal = Number(((this.modelValue - min) * 100) / (max - min));
|
|
95
|
+
this.tooltipPosition = `calc(${newVal}% + (${8 - newVal * 0.18}px))`;
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<style scoped lang="scss" src="./_BIMDataSlider.scss"></style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.bimdata-slider {
|
|
2
|
+
position: relative;
|
|
3
|
+
.bimdata-slider-input {
|
|
4
|
+
&::-webkit-slider-runnable-track {
|
|
5
|
+
height: 3px;
|
|
6
|
+
background: linear-gradient(
|
|
7
|
+
to right,
|
|
8
|
+
var(--color-primary),
|
|
9
|
+
var(--color-primary)
|
|
10
|
+
),
|
|
11
|
+
var(--color-silver);
|
|
12
|
+
background-size: var(--background-size, 0%) 100%;
|
|
13
|
+
background-repeat: no-repeat;
|
|
14
|
+
border-radius: 5px;
|
|
15
|
+
}
|
|
16
|
+
&::-webkit-slider-thumb {
|
|
17
|
+
width: 15px;
|
|
18
|
+
height: 15px;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
background: var(--color-primary);
|
|
21
|
+
border: solid var(--color-white) 1px;
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
margin-top: -6px;
|
|
24
|
+
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
|
|
25
|
+
}
|
|
26
|
+
&::-moz-range-progress {
|
|
27
|
+
background-color: var(--color-primary);
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
}
|
|
30
|
+
&::-moz-range-track {
|
|
31
|
+
background-color: var(--color-silver);
|
|
32
|
+
border-radius: 5px;
|
|
33
|
+
}
|
|
34
|
+
&::-moz-range-thumb {
|
|
35
|
+
width: 15px;
|
|
36
|
+
height: 15px;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
background: var(--color-primary);
|
|
39
|
+
border: solid var(--color-white) 1px;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
margin-top: -6px;
|
|
42
|
+
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
&:hover {
|
|
46
|
+
.bimdata-slider-tooltip {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
transition: opacity 0.2s ease-out;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
&-tooltip {
|
|
52
|
+
background: var(--color-primary);
|
|
53
|
+
color: var(--color-white);
|
|
54
|
+
padding: calc(var(--spacing-unit) / 2);
|
|
55
|
+
position: absolute;
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
bottom: calc(var(--spacing-unit) * 3);
|
|
58
|
+
left: 50%;
|
|
59
|
+
transform: translateX(-50%);
|
|
60
|
+
opacity: 0;
|
|
61
|
+
transition: opacity 0.2s ease-out;
|
|
62
|
+
&::after {
|
|
63
|
+
border: 5px solid transparent;
|
|
64
|
+
border-top-color: var(--color-primary);
|
|
65
|
+
bottom: 5px * -2;
|
|
66
|
+
content: "";
|
|
67
|
+
height: 0;
|
|
68
|
+
left: 50%;
|
|
69
|
+
position: absolute;
|
|
70
|
+
transform: translate(-50%);
|
|
71
|
+
width: 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.bimdata-slider-input,
|
|
75
|
+
.bimdata-slider-input::-webkit-slider-runnable-track,
|
|
76
|
+
.bimdata-slider-input::-webkit-slider-thumb {
|
|
77
|
+
appearance: none;
|
|
78
|
+
-webkit-appearance: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -35,6 +35,7 @@ export { default as BIMDataSearchAutocomplete } from "./BIMDataSearchAutocomplet
|
|
|
35
35
|
export { default as BIMDataSelect } from "./BIMDataSelect/BIMDataSelect.vue";
|
|
36
36
|
export { default as BIMDataSimplePieChart } from "./BIMDataSimplePieChart/BIMDataSimplePieChart.vue";
|
|
37
37
|
export { default as BIMDataSpinner } from "./BIMDataSpinner/BIMDataSpinner.vue";
|
|
38
|
+
export { default as BIMDataSlider } from "./BIMDataSlider/BIMDataSlider.vue";
|
|
38
39
|
export { default as BIMDataTable } from "./BIMDataTable/BIMDataTable.vue";
|
|
39
40
|
export { default as BIMDataTabs } from "./BIMDataTabs/BIMDataTabs.vue";
|
|
40
41
|
export { default as BIMDataText } from "./BIMDataText/BIMDataText.vue";
|