@thinkpixellab-public/px-vue 3.0.12 → 3.0.14
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/PxAutoClamp.vue +12 -6
- package/components/PxBaseResize.vue +4 -4
- package/components/PxContain.vue +28 -6
- package/components/PxFloat.vue +18 -2
- package/package.json +2 -2
- package/plugins/common.js +3 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Automatically computes line clamp based on the available height and current line height.
|
|
3
3
|
-->
|
|
4
4
|
<template>
|
|
5
|
-
<
|
|
5
|
+
<component :is="tag" :class="bem()" :style="{}">
|
|
6
6
|
<span
|
|
7
7
|
:class="bem('clamp')"
|
|
8
8
|
:style="{
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
height: cssPx(maxHeight),
|
|
12
12
|
}"
|
|
13
13
|
>
|
|
14
|
-
|
|
14
|
+
<slot>
|
|
15
|
+
{{ text }}
|
|
16
|
+
</slot>
|
|
15
17
|
</span>
|
|
16
|
-
</
|
|
18
|
+
</component>
|
|
17
19
|
</template>
|
|
18
20
|
|
|
19
21
|
<script>
|
|
@@ -24,6 +26,7 @@ export default {
|
|
|
24
26
|
mixins: [PxBaseResize],
|
|
25
27
|
props: {
|
|
26
28
|
text: { type: String, default: null },
|
|
29
|
+
tag: { type: String, default: 'div' },
|
|
27
30
|
},
|
|
28
31
|
data() {
|
|
29
32
|
return {
|
|
@@ -38,8 +41,12 @@ export default {
|
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
let availableHeight = this.$el.clientHeight;
|
|
45
|
+
let lineHeight = parseFloat(window.getComputedStyle(this.$el).lineHeight);
|
|
46
|
+
|
|
47
|
+
if (isNaN(lineHeight)) {
|
|
48
|
+
lineHeight = parseFloat(window.getComputedStyle(this.$el).fontSize) * 1.33;
|
|
49
|
+
}
|
|
43
50
|
|
|
44
51
|
this.lineCount = Math.floor(availableHeight / lineHeight);
|
|
45
52
|
this.height = this.lineCount * this.lineHeight;
|
|
@@ -65,7 +72,6 @@ export default {
|
|
|
65
72
|
display: block;
|
|
66
73
|
display: -webkit-box;
|
|
67
74
|
overflow: hidden;
|
|
68
|
-
|
|
69
75
|
max-height: 100%;
|
|
70
76
|
height: auto;
|
|
71
77
|
overflow: hidden;
|
|
@@ -29,22 +29,22 @@ export default {
|
|
|
29
29
|
}, this.resizeDebounceValue)
|
|
30
30
|
: null;
|
|
31
31
|
|
|
32
|
-
const resizeFn =
|
|
32
|
+
const resizeFn = () => {
|
|
33
33
|
// debounced version
|
|
34
34
|
if (resizeDebouncedFn) {
|
|
35
35
|
if (!this.resizing) {
|
|
36
36
|
this.resizing = true;
|
|
37
37
|
if (this.resizeStarted) {
|
|
38
|
-
this.resizeStarted(
|
|
38
|
+
this.resizeStarted();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
resizeDebouncedFn(
|
|
41
|
+
resizeDebouncedFn();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// regular version
|
|
45
45
|
else {
|
|
46
46
|
if (this.resize) {
|
|
47
|
-
this.resize(
|
|
47
|
+
this.resize();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
};
|
package/components/PxContain.vue
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
:width="contain.width"
|
|
19
19
|
:height="contain.height"
|
|
20
20
|
:scale="contain.scale"
|
|
21
|
+
:enabled="contain.enabled"
|
|
21
22
|
></slot>
|
|
22
23
|
</div>
|
|
23
24
|
</template>
|
|
@@ -32,6 +33,8 @@ export default {
|
|
|
32
33
|
mixins: [PxBaseResize],
|
|
33
34
|
|
|
34
35
|
props: {
|
|
36
|
+
enabled: { type: Boolean, default: true },
|
|
37
|
+
|
|
35
38
|
// an optional aspect ratio that should be maintained when calculating size and position, if
|
|
36
39
|
// not provided then width and height will always cover the full outer container (can be a
|
|
37
40
|
// number or ratio string like '16:9')
|
|
@@ -75,13 +78,14 @@ export default {
|
|
|
75
78
|
container: null,
|
|
76
79
|
|
|
77
80
|
contain: {
|
|
81
|
+
enabled: this.enabled,
|
|
78
82
|
current: false,
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
81
|
-
top:
|
|
82
|
-
right:
|
|
83
|
-
bottom:
|
|
84
|
-
left:
|
|
83
|
+
width: null,
|
|
84
|
+
height: null,
|
|
85
|
+
top: null,
|
|
86
|
+
right: null,
|
|
87
|
+
bottom: null,
|
|
88
|
+
left: null,
|
|
85
89
|
scale: 1,
|
|
86
90
|
},
|
|
87
91
|
};
|
|
@@ -136,6 +140,9 @@ export default {
|
|
|
136
140
|
},
|
|
137
141
|
|
|
138
142
|
watch: {
|
|
143
|
+
enabled() {
|
|
144
|
+
this.resize();
|
|
145
|
+
},
|
|
139
146
|
aspectNumber() {
|
|
140
147
|
this.resize();
|
|
141
148
|
},
|
|
@@ -150,6 +157,20 @@ export default {
|
|
|
150
157
|
this.resize();
|
|
151
158
|
},
|
|
152
159
|
resize() {
|
|
160
|
+
if (!this.enabled) {
|
|
161
|
+
this.contain = {
|
|
162
|
+
enabled: false,
|
|
163
|
+
current: true,
|
|
164
|
+
width: null,
|
|
165
|
+
height: null,
|
|
166
|
+
top: null,
|
|
167
|
+
right: null,
|
|
168
|
+
bottom: null,
|
|
169
|
+
left: null,
|
|
170
|
+
scale: 1,
|
|
171
|
+
};
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
153
174
|
let p = this.toBoxModelObject(this.padding);
|
|
154
175
|
let b = this.toBoxModelObject(this.border);
|
|
155
176
|
|
|
@@ -195,6 +216,7 @@ export default {
|
|
|
195
216
|
|
|
196
217
|
let c = {
|
|
197
218
|
current: true,
|
|
219
|
+
enabled: true,
|
|
198
220
|
width: r.width + b.w,
|
|
199
221
|
height: r.height + b.h,
|
|
200
222
|
top: r.y + p.top,
|
package/components/PxFloat.vue
CHANGED
|
@@ -487,12 +487,14 @@ export default {
|
|
|
487
487
|
if (typeof reference == 'string') {
|
|
488
488
|
// previous sibling
|
|
489
489
|
if (reference == 'previous') {
|
|
490
|
-
reference = this.$el.
|
|
490
|
+
reference = this.$el.previousElementSibling;
|
|
491
|
+
console.log(reference);
|
|
491
492
|
}
|
|
492
493
|
|
|
493
494
|
// next sibling
|
|
494
495
|
else if (reference == 'next') {
|
|
495
|
-
reference = this.$el.
|
|
496
|
+
reference = this.$el.nextElementSibling;
|
|
497
|
+
console.log(reference);
|
|
496
498
|
}
|
|
497
499
|
|
|
498
500
|
// selector
|
|
@@ -574,6 +576,20 @@ $d: 0.4s;
|
|
|
574
576
|
}
|
|
575
577
|
}
|
|
576
578
|
|
|
579
|
+
&--menu & {
|
|
580
|
+
&__popup {
|
|
581
|
+
display: flex;
|
|
582
|
+
flex-direction: column;
|
|
583
|
+
@include css-map(
|
|
584
|
+
popup(
|
|
585
|
+
(
|
|
586
|
+
padding: 0,
|
|
587
|
+
)
|
|
588
|
+
)
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
577
593
|
// sizes
|
|
578
594
|
|
|
579
595
|
&--sm & {
|
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.14",
|
|
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.3",
|
|
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",
|
package/plugins/common.js
CHANGED
|
@@ -23,6 +23,9 @@ export default {
|
|
|
23
23
|
Vue.prototype.cssUrl = cssUrl;
|
|
24
24
|
|
|
25
25
|
// filters
|
|
26
|
+
// note: filters can be called as methods with something like
|
|
27
|
+
// this.$options.filters.slug('Make me a slug.');
|
|
28
|
+
|
|
26
29
|
Vue.filter('aspect', aspect);
|
|
27
30
|
Vue.filter('kebab', kebab);
|
|
28
31
|
Vue.filter('slug', slug);
|