From 4390bf83cbbb2fa4305f7e1ccf6ada22034f408c Mon Sep 17 00:00:00 2001 From: Gaelle Date: Fri, 18 Aug 2023 17:56:45 +0200 Subject: [PATCH 01/13] create BIMDataSlider component & Slider documentation --- .../BIMDataSlider/BIMDataSlider.vue | 79 +++++++++++++++++++ .../BIMDataSlider/_BIMDataSlider.scss | 51 ++++++++++++ src/BIMDataComponents/index.js | 1 + src/web/router.js | 5 ++ src/web/store.js | 7 ++ src/web/views/Components/Slider/Slider.vue | 42 ++++++++++ 6 files changed, 185 insertions(+) create mode 100644 src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue create mode 100644 src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss create mode 100644 src/web/views/Components/Slider/Slider.vue diff --git a/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue b/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue new file mode 100644 index 00000000..175c4e4f --- /dev/null +++ b/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss b/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss new file mode 100644 index 00000000..02448922 --- /dev/null +++ b/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss @@ -0,0 +1,51 @@ +.bimdata-slider { + position: relative; + .bimdata-slider-input { + &::-webkit-slider-runnable-track { + height: 3px; + background: linear-gradient( + to right, + var(--color-primary), + var(--color-primary) + ), + var(--color-silver); + background-size: var(--background-size, 0%) 100%; + background-repeat: no-repeat; + border-radius: 5px; + } + &::-webkit-slider-thumb { + width: 15px; + height: 15px; + cursor: pointer; + background: var(--color-primary); + border: solid var(--color-white) 1px; + border-radius: 50%; + margin-top: -6px; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4); + } + &::-moz-range-progress { + background-color: var(--color-primary); + border-radius: 5px; + } + &::-moz-range-track { + background-color: var(--color-silver); + border-radius: 5px; + } + &::-moz-range-thumb { + width: 15px; + height: 15px; + cursor: pointer; + background: var(--color-primary); + border: solid var(--color-white) 1px; + border-radius: 50%; + margin-top: -6px; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4); + } + } + .bimdata-slider-input, + .bimdata-slider-input::-webkit-slider-runnable-track, + .bimdata-slider-input::-webkit-slider-thumb { + appearance: none; + -webkit-appearance: none; + } +} diff --git a/src/BIMDataComponents/index.js b/src/BIMDataComponents/index.js index 1b55be36..cb169df1 100644 --- a/src/BIMDataComponents/index.js +++ b/src/BIMDataComponents/index.js @@ -35,6 +35,7 @@ export { default as BIMDataSearchAutocomplete } from "./BIMDataSearchAutocomplet export { default as BIMDataSelect } from "./BIMDataSelect/BIMDataSelect.vue"; export { default as BIMDataSimplePieChart } from "./BIMDataSimplePieChart/BIMDataSimplePieChart.vue"; export { default as BIMDataSpinner } from "./BIMDataSpinner/BIMDataSpinner.vue"; +export { default as BIMDataSlider } from "./BIMDataSlider/BIMDataSlider.vue"; export { default as BIMDataTable } from "./BIMDataTable/BIMDataTable.vue"; export { default as BIMDataTabs } from "./BIMDataTabs/BIMDataTabs.vue"; export { default as BIMDataText } from "./BIMDataText/BIMDataText.vue"; diff --git a/src/web/router.js b/src/web/router.js index e708f8f8..f6371625 100644 --- a/src/web/router.js +++ b/src/web/router.js @@ -207,6 +207,11 @@ const routes = [ name: "select", component: () => import("./views/Components/Select/Select.vue"), }, + { + path: "slider", + name: "slider", + component: () => import("./views/Components/Slider/Slider.vue"), + }, { path: "table", name: "table", diff --git a/src/web/store.js b/src/web/store.js index 6731e789..d6411272 100644 --- a/src/web/store.js +++ b/src/web/store.js @@ -282,6 +282,13 @@ export default { text: "Select (dropdown) is used to enabled a user to select a single item from a list of options.", btn: "View select", }, + { + title: "Slider", + img: select, + path: "slider", + text: "slider", + btn: "View slider", + }, { title: "Table", img: table, diff --git a/src/web/views/Components/Slider/Slider.vue b/src/web/views/Components/Slider/Slider.vue new file mode 100644 index 00000000..fad181a0 --- /dev/null +++ b/src/web/views/Components/Slider/Slider.vue @@ -0,0 +1,42 @@ + + + + + From 146b4288d911ba75be15baabf4b677fc0660466d Mon Sep 17 00:00:00 2001 From: Gaelle Date: Wed, 6 Sep 2023 18:18:47 +0200 Subject: [PATCH 02/13] create slider icon --- src/web/assets/img/icon-slider.svg | 24 ++++++++++++++++++++++++ src/web/store.js | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/web/assets/img/icon-slider.svg diff --git a/src/web/assets/img/icon-slider.svg b/src/web/assets/img/icon-slider.svg new file mode 100644 index 00000000..42206e53 --- /dev/null +++ b/src/web/assets/img/icon-slider.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/web/store.js b/src/web/store.js index d6411272..6dc18be5 100644 --- a/src/web/store.js +++ b/src/web/store.js @@ -31,6 +31,7 @@ import safe_zone_inline from "./assets/img/icon-safe_zone_inline.svg"; import search from "./assets/img/icon-search.svg"; import search_autocomplete from "./assets/img/icon-search_autocomplete.svg"; import select from "./assets/img/icon-select.svg"; +import slider from "./assets/img/icon-slider.svg"; import table from "./assets/img/icon-table.svg"; import tabs from "./assets/img/icon-tabs.svg"; import text from "./assets/img/icon-text.svg"; @@ -284,7 +285,7 @@ export default { }, { title: "Slider", - img: select, + img: slider, path: "slider", text: "slider", btn: "View slider", From 620f2a6377a43a3b8818a0021b687dd7b1b190fe Mon Sep 17 00:00:00 2001 From: Gaelle Date: Wed, 6 Sep 2023 18:19:04 +0200 Subject: [PATCH 03/13] add tooltip for slider --- .../BIMDataSlider/BIMDataSlider.vue | 23 +++++++++++++++ .../BIMDataSlider/_BIMDataSlider.scss | 29 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue b/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue index 175c4e4f..e9de1861 100644 --- a/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue +++ b/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue @@ -12,6 +12,9 @@ :disabled="disabled" @input="onInput" /> + {{ + modelValue + }} @@ -43,12 +46,24 @@ export default { data() { return { backgroundSize: 0, + tooltipPosition: `calc(${this.modelValue}% + (${ + 8 - this.modelValue * 0.18 + }px))`, }; }, watch: { modelValue() { this.$nextTick(() => { this.backgroundSize = this.getBackgroundSize(); + + // let sliderWidth = document.getElementsByClassName( + // "bimdata-slider-input" + // )[0].offsetWidth; + // let tooltipWidth = document.getElementsByClassName( + // "bimdata-slider-tooltip" + // )[0].offsetWidth; + + this.getTooltipPosition(); }); }, }, @@ -72,6 +87,14 @@ export default { onInput(event) { this.$emit("update:modelValue", +event.target.value); }, + getTooltipPosition() { + this.tooltipPosition = this.modelValue; + const val = this.modelValue; + const min = this.min ? this.min : 0; + const max = this.max ? this.max : 100; + const newVal = Number(((val - min) * 100) / (max - min)); + this.tooltipPosition = `calc(${newVal}% + (${8 - newVal * 0.18}px))`; + }, }, }; diff --git a/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss b/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss index 02448922..f26b8dec 100644 --- a/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss +++ b/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss @@ -42,6 +42,35 @@ box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4); } } + &:hover { + .bimdata-slider-tooltip { + opacity: 1; + transition: opacity 0.2s ease-out; + } + } + &-tooltip { + background: var(--color-primary); + color: var(--color-white); + padding: calc(var(--spacing-unit) / 2); + position: absolute; + border-radius: 4px; + bottom: calc(var(--spacing-unit) * 3); + left: 50%; + transform: translateX(-50%); + opacity: 0; + transition: opacity 0.2s ease-out; + &::after { + border: 5px solid transparent; + border-top-color: var(--color-primary); + bottom: 5px * -2; + content: ""; + height: 0; + left: 50%; + position: absolute; + transform: translate(-50%); + width: 0; + } + } .bimdata-slider-input, .bimdata-slider-input::-webkit-slider-runnable-track, .bimdata-slider-input::-webkit-slider-thumb { From 15e4adcdbaad61f0f2ab5741be9cca5098ca7fec Mon Sep 17 00:00:00 2001 From: Gaelle Date: Wed, 6 Sep 2023 18:19:17 +0200 Subject: [PATCH 04/13] add parameters for slider documentation --- src/web/views/Components/Slider/Slider.vue | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/web/views/Components/Slider/Slider.vue b/src/web/views/Components/Slider/Slider.vue index fad181a0..605b5b61 100644 --- a/src/web/views/Components/Slider/Slider.vue +++ b/src/web/views/Components/Slider/Slider.vue @@ -7,11 +7,27 @@ - + @@ -41,6 +44,10 @@ export default { type: Boolean, default: false, }, + tooltip: { + type: Boolean, + default: false, + }, }, emits: ["update:modelValue"], data() { @@ -55,8 +62,9 @@ export default { modelValue() { this.$nextTick(() => { this.backgroundSize = this.getBackgroundSize(); - - this.getTooltipPosition(); + if (this.tooltip) { + this.getTooltipPosition(); + } }); }, }, From 3f4e66fb0b4a176729168c570434b95afde40219 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Thu, 7 Sep 2023 15:03:09 +0200 Subject: [PATCH 09/13] add slider documentation --- src/web/views/Components/Slider/Slider.vue | 44 +++++++++++++++- .../views/Components/Slider/events-data.js | 5 ++ src/web/views/Components/Slider/props-data.js | 51 +++++++++++++++++++ 3 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 src/web/views/Components/Slider/events-data.js create mode 100644 src/web/views/Components/Slider/props-data.js diff --git a/src/web/views/Components/Slider/Slider.vue b/src/web/views/Components/Slider/Slider.vue index 605b5b61..d9bfb11f 100644 --- a/src/web/views/Components/Slider/Slider.vue +++ b/src/web/views/Components/Slider/Slider.vue @@ -7,7 +7,13 @@ @@ -27,6 +33,8 @@ placeholder="Slider default value" v-model="slider" /> + + - + + +
+ + Props: + + +
+
+ + Events: + + +