@stonecrop/beam 0.4.8 → 0.4.9
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/dist/assets/index.css +1 -1
- package/dist/beam.js +2421 -2216
- package/dist/beam.js.map +1 -1
- package/dist/beam.umd.cjs +7 -7
- package/dist/beam.umd.cjs.map +1 -1
- package/package.json +2 -1
- package/src/components/BeamFilter.vue +18 -43
- package/src/components/BeamFilterOption.vue +21 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/beam",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"src/*"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@vueuse/components": "^12.7.0",
|
|
32
33
|
"@vueuse/core": "^12.7.0",
|
|
33
34
|
"mqtt": "^5.10.3",
|
|
34
35
|
"onscan.js": "^1.5.2",
|
|
@@ -1,66 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<div
|
|
4
|
-
<ToggleArrow :open="
|
|
2
|
+
<div class="beam_filters">
|
|
3
|
+
<div @click="isFilterExpanded = !isFilterExpanded" class="beam_filters-heading">
|
|
4
|
+
<ToggleArrow :open="isFilterExpanded" />
|
|
5
5
|
<BeamHeading>Filter</BeamHeading>
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
|
-
<div class="beam_filters-options">
|
|
9
|
-
<slot
|
|
8
|
+
<div v-show="isFilterExpanded" class="beam_filters-options">
|
|
9
|
+
<slot />
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
-
import { ref
|
|
15
|
+
import { ref } from 'vue'
|
|
16
16
|
|
|
17
17
|
defineSlots<{ default(): any }>()
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
const beamFilters = useTemplateRef('beam-filters')
|
|
21
|
-
|
|
22
|
-
const isOpen = ref(false)
|
|
23
|
-
const headerHeight = ref<string>()
|
|
24
|
-
const totalHeight = ref<string>()
|
|
25
|
-
|
|
26
|
-
const toggle = () => {
|
|
27
|
-
isOpen.value = !isOpen.value
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
onMounted(() => {
|
|
31
|
-
if (header.value && beamFilters.value) {
|
|
32
|
-
headerHeight.value = getTotalHeight(header.value)
|
|
33
|
-
totalHeight.value = getTotalHeight(beamFilters.value)
|
|
34
|
-
beamFilters.value.style.height = headerHeight.value
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const getTotalHeight = (el: HTMLDivElement) => {
|
|
39
|
-
const height = el.getBoundingClientRect().height
|
|
40
|
-
const marginTop = parseInt(getComputedStyle(el).marginTop)
|
|
41
|
-
const marginBottom = parseInt(getComputedStyle(el).marginBottom)
|
|
42
|
-
return height + marginTop + marginBottom + 'px'
|
|
43
|
-
}
|
|
19
|
+
const isFilterExpanded = ref(false)
|
|
44
20
|
</script>
|
|
45
21
|
|
|
46
22
|
<style scoped>
|
|
47
23
|
.beam_filters {
|
|
48
|
-
|
|
24
|
+
background-color: var(--sc-primary-color);
|
|
25
|
+
border-bottom: 1px solid var(--sc-row-border-color);
|
|
49
26
|
box-sizing: border-box;
|
|
27
|
+
min-height: 2em;
|
|
28
|
+
overflow: visible;
|
|
29
|
+
padding: 0.625rem;
|
|
50
30
|
transition: all 0.2s ease-in-out;
|
|
51
|
-
border-bottom: 1px solid var(--sc-row-border-color);
|
|
52
|
-
background: white;
|
|
53
31
|
}
|
|
54
32
|
|
|
55
33
|
.beam_filters-heading {
|
|
56
|
-
background: var(--sc-primary-color);
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
display: flex;
|
|
59
34
|
align-items: center;
|
|
60
|
-
|
|
35
|
+
background-color: var(--sc-primary-color);
|
|
61
36
|
box-sizing: border-box;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
display: flex;
|
|
62
39
|
font-size: 1rem;
|
|
63
|
-
padding: 0 2rem;
|
|
64
40
|
|
|
65
41
|
& > h1 {
|
|
66
42
|
font-size: 1rem;
|
|
@@ -70,11 +46,10 @@ const getTotalHeight = (el: HTMLDivElement) => {
|
|
|
70
46
|
.beam_filters-options {
|
|
71
47
|
display: flex;
|
|
72
48
|
flex-direction: row;
|
|
73
|
-
|
|
74
|
-
background: white;
|
|
75
|
-
box-sizing: border-box;
|
|
76
|
-
padding: 0 1rem;
|
|
49
|
+
justify-content: flex-start;
|
|
77
50
|
margin: 1rem 0;
|
|
51
|
+
padding: 0 1rem;
|
|
52
|
+
gap: 1rem;
|
|
78
53
|
|
|
79
54
|
@media (max-width: 479px) {
|
|
80
55
|
flex-direction: column;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="beam_filter-container">
|
|
2
|
+
<div v-on-click-outside="() => (isMenuOpen = false)" class="beam_filter-container">
|
|
3
3
|
<BeamHeading class="beam_filter-option-heading">{{ title }}</BeamHeading>
|
|
4
|
-
<div @click="
|
|
4
|
+
<div @click="isMenuOpen = !isMenuOpen" class="beam_filter-option">
|
|
5
5
|
<div class="beam_filter-option-select">
|
|
6
6
|
<div class="beam_filter-arrow">
|
|
7
7
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35.36 70.71">
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
<ul ref="menu" v-if="
|
|
16
|
+
<ul ref="menu" v-if="isMenuOpen" class="beam_filter-select-menu">
|
|
17
17
|
<li
|
|
18
18
|
v-for="choice in choices"
|
|
19
19
|
:class="{ selected: label == choice.label }"
|
|
@@ -29,20 +29,19 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script setup lang="ts">
|
|
32
|
+
import { vOnClickOutside } from '@vueuse/components'
|
|
32
33
|
import { ref } from 'vue'
|
|
33
34
|
|
|
34
35
|
import { BeamFilterChoice } from '../types'
|
|
35
36
|
|
|
36
|
-
const emit = defineEmits<{
|
|
37
|
-
select: [choice: BeamFilterChoice]
|
|
38
|
-
}>()
|
|
37
|
+
const emit = defineEmits<{ select: [choice: BeamFilterChoice] }>()
|
|
39
38
|
|
|
40
39
|
const { title = 'title', choices = [] } = defineProps<{
|
|
41
40
|
choices: BeamFilterChoice[]
|
|
42
41
|
title?: string
|
|
43
42
|
}>()
|
|
44
43
|
|
|
45
|
-
const
|
|
44
|
+
const isMenuOpen = ref(false)
|
|
46
45
|
const label = ref(choices[0].label)
|
|
47
46
|
const value = ref(choices[0].value)
|
|
48
47
|
|
|
@@ -57,24 +56,24 @@ const selectChoice = (data: BeamFilterChoice) => {
|
|
|
57
56
|
.beam_filter-option {
|
|
58
57
|
cursor: pointer;
|
|
59
58
|
position: relative;
|
|
60
|
-
margin-bottom: 1rem;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
.beam_filter-option-heading {
|
|
64
|
-
font-size: 1rem;
|
|
62
|
+
font-size: 1rem !important;
|
|
65
63
|
padding-bottom: 0.25rem;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
.beam_filter-option-select {
|
|
69
|
-
|
|
67
|
+
align-items: stretch;
|
|
70
68
|
appearance: none;
|
|
69
|
+
background-color: white;
|
|
71
70
|
border: 1px solid var(--sc-row-border-color);
|
|
72
|
-
font-weight: bold;
|
|
73
71
|
color: var(--sc-primary-text-color);
|
|
74
|
-
font-size: 0.8rem;
|
|
75
|
-
font-family: var(--sc-font-family);
|
|
76
72
|
display: flex;
|
|
77
|
-
|
|
73
|
+
font-family: var(--sc-font-family);
|
|
74
|
+
font-size: 0.8rem;
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
position: relative;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
label {
|
|
@@ -104,18 +103,19 @@ svg {
|
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
.beam_filter-select-menu {
|
|
107
|
-
|
|
108
|
-
z-index: 100;
|
|
106
|
+
background-color: white;
|
|
109
107
|
border-top: none;
|
|
110
|
-
left: 0;
|
|
111
108
|
border: 1px solid var(--sc-row-border-color);
|
|
112
|
-
padding: 0rem;
|
|
113
|
-
list-style: none;
|
|
114
|
-
width: 100%;
|
|
115
109
|
box-sizing: border-box;
|
|
110
|
+
left: 0;
|
|
111
|
+
list-style: none;
|
|
112
|
+
margin: 0;
|
|
116
113
|
max-height: 200px;
|
|
117
114
|
overflow-y: scroll;
|
|
118
|
-
|
|
115
|
+
padding: 0rem;
|
|
116
|
+
position: absolute;
|
|
117
|
+
width: 100%;
|
|
118
|
+
z-index: 100;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.beam_filter-select-option {
|