@thinkpixellab-public/px-vue 3.0.20 → 3.0.22
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/components/PxArrowScroller.vue +126 -0
- package/components/PxQrCode.vue +22 -23
- package/package.json +3 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Creates a horizontally scrolling container with an invisible scrollbar and arrows on either side
|
|
3
|
+
to scroll to the beginning or end of the container.
|
|
4
|
+
|
|
5
|
+
<px-arrow-scroller :arrow-start-src="require(...)" :arrow-end-src="require(...)">
|
|
6
|
+
...
|
|
7
|
+
</px-arrow-scroller>
|
|
8
|
+
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<div :class="bem()">
|
|
12
|
+
<px-icon-button
|
|
13
|
+
:class="[bem('arrow', { start: true, visible: arrowStartVisible }), arrowClass]"
|
|
14
|
+
:src="arrowStartSrc"
|
|
15
|
+
size="0.8em"
|
|
16
|
+
@click="scrollTo(0)"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<div :class="bem('scroller')" ref="scroller" @scroll="updateScrollArrows">
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<px-icon-button
|
|
24
|
+
:class="[bem('arrow', { end: true, visible: arrowEndVisible }), arrowClass]"
|
|
25
|
+
:src="arrowEndSrc"
|
|
26
|
+
size="0.8em"
|
|
27
|
+
@click="scrollTo(100000)"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
// import { mapState } from 'vuex';
|
|
34
|
+
// import Component from '~/components/Component.vue';
|
|
35
|
+
// import Mixin from '~/components/Mixin.vue';
|
|
36
|
+
import PxBaseResize from './PxBaseResize.vue';
|
|
37
|
+
import PxIconButton from '@thinkpixellab-public/px-vue/components/PxIconButton.vue';
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: 'px-arrow-scroller',
|
|
41
|
+
components: { PxIconButton },
|
|
42
|
+
mixins: [PxBaseResize, PxIconButton],
|
|
43
|
+
props: {
|
|
44
|
+
arrowStartSrc: { type: String, default: null },
|
|
45
|
+
arrowEndSrc: { type: String, default: null },
|
|
46
|
+
arrowClass: { type: String, default: null },
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
arrowsVisible: false,
|
|
51
|
+
arrowStartVisible: false,
|
|
52
|
+
arrowEndVisible: false,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
// computed: {},
|
|
56
|
+
// watch: {},
|
|
57
|
+
// mounted() {},
|
|
58
|
+
methods: {
|
|
59
|
+
resize() {
|
|
60
|
+
this.updateScrollArrows();
|
|
61
|
+
},
|
|
62
|
+
updateScrollArrows() {
|
|
63
|
+
const scroller = this.$refs.scroller;
|
|
64
|
+
|
|
65
|
+
if (!scroller) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const fromStart = scroller.scrollLeft;
|
|
70
|
+
const fromEnd = scroller.scrollWidth - scroller.scrollLeft - scroller.clientWidth;
|
|
71
|
+
|
|
72
|
+
this.arrowsVisible = scroller.clientWidth > scroller.scrollWidth;
|
|
73
|
+
this.arrowStartVisible = fromStart > 2;
|
|
74
|
+
this.arrowEndVisible = fromEnd > 2;
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
scrollTo(x) {
|
|
78
|
+
if (this.$refs.scroller) {
|
|
79
|
+
this.$refs.scroller.scrollTo({
|
|
80
|
+
left: x,
|
|
81
|
+
behavior: 'smooth',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style lang="scss">
|
|
90
|
+
@use '../styles/px.scss' as *;
|
|
91
|
+
|
|
92
|
+
.px-arrow-scroller {
|
|
93
|
+
// prettier-ignore
|
|
94
|
+
@include grid-art((
|
|
95
|
+
'auto | 1fr | auto |',
|
|
96
|
+
'arrow-start | scroller | arrow-end | auto'
|
|
97
|
+
));
|
|
98
|
+
|
|
99
|
+
&__arrow {
|
|
100
|
+
padding: 0.1em 1em 0.25em;
|
|
101
|
+
|
|
102
|
+
&--start {
|
|
103
|
+
grid-area: arrow-start;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&--end {
|
|
107
|
+
grid-area: arrow-end;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@include transition(opacity, $dur: 200ms);
|
|
111
|
+
opacity: 0;
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
|
|
114
|
+
&--visible {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
pointer-events: visible;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&__scroller {
|
|
121
|
+
grid-area: scroller;
|
|
122
|
+
overflow-x: auto;
|
|
123
|
+
@include invisible-scrollbar;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</style>
|
package/components/PxQrCode.vue
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
const QRCode = require('qrcode
|
|
13
|
+
const QRCode = require('qrcode');
|
|
14
14
|
import PxBaseResize from './PxBaseResize.vue';
|
|
15
15
|
|
|
16
16
|
export default {
|
|
@@ -18,8 +18,8 @@ export default {
|
|
|
18
18
|
mixins: [PxBaseResize],
|
|
19
19
|
props: {
|
|
20
20
|
content: { type: String, default: 'Hello' },
|
|
21
|
-
|
|
22
|
-
background: { type: String, default: '
|
|
21
|
+
foreground: { type: String, default: '#000000' },
|
|
22
|
+
background: { type: String, default: '#FFFFFF' },
|
|
23
23
|
padding: { type: Number, default: 0 },
|
|
24
24
|
ecl: { type: String, default: 'L' },
|
|
25
25
|
},
|
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
content() {
|
|
31
31
|
this.updateSvg();
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
foreground() {
|
|
34
34
|
this.updateSvg();
|
|
35
35
|
},
|
|
36
36
|
background() {
|
|
@@ -39,36 +39,35 @@ export default {
|
|
|
39
39
|
padding() {
|
|
40
40
|
this.updateSvg();
|
|
41
41
|
},
|
|
42
|
-
ecl() {
|
|
43
|
-
this.updateSvg();
|
|
44
|
-
},
|
|
45
42
|
},
|
|
46
43
|
mounted() {
|
|
47
|
-
this.
|
|
44
|
+
this.updateSvg();
|
|
48
45
|
},
|
|
49
46
|
methods: {
|
|
50
|
-
resize() {
|
|
51
|
-
this.size = this.$el.offsetWidth;
|
|
52
|
-
this.updateSvg();
|
|
53
|
-
},
|
|
54
47
|
updateSvg() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
QRCode.toString(
|
|
49
|
+
this.content,
|
|
50
|
+
{
|
|
51
|
+
type: 'svg',
|
|
52
|
+
margin: this.padding,
|
|
53
|
+
color: {
|
|
54
|
+
dark: this.foreground,
|
|
55
|
+
light: this.background,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
(err, str) => {
|
|
59
|
+
if (err) {
|
|
60
|
+
console.warn('Error creating QR Code. \n' + err);
|
|
61
|
+
}
|
|
62
|
+
this.svg = str;
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
</script>
|
|
69
69
|
|
|
70
70
|
<style lang="scss">
|
|
71
|
-
@import '@/styles/include.scss';
|
|
72
71
|
.px-qr-code {
|
|
73
72
|
aspect-ratio: 1;
|
|
74
73
|
width: 256px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thinkpixellab-public/px-vue",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.22",
|
|
4
4
|
"description": "General purpose Vue components and helpers that can be used across projects.",
|
|
5
5
|
"author": "Pixel Lab",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@floating-ui/dom": "^1.0.1",
|
|
16
16
|
"@popperjs/core": "^2.11.5",
|
|
17
|
-
"@thinkpixellab-public/px-styles": "^3.7.
|
|
17
|
+
"@thinkpixellab-public/px-styles": "^3.7.6",
|
|
18
18
|
"@thinkpixellab-public/px-vue-tester": "^2.0.0",
|
|
19
19
|
"@thinkpixellab-public/vue-resize-directive": "^1.2.2",
|
|
20
20
|
"body-scroll-lock": "^3.1.5",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dateformat": "^5.0.3",
|
|
23
23
|
"debounce": "^1.2.1",
|
|
24
24
|
"gsap": "^3.10.4",
|
|
25
|
-
"qrcode
|
|
25
|
+
"qrcode": "^1.5.1",
|
|
26
26
|
"tiny-date-picker": "^3.2.8",
|
|
27
27
|
"tiny-swiper": "^2.2.0",
|
|
28
28
|
"vue-inline-svg": "^2.1.0"
|