@thinkpixellab-public/px-vue 3.0.26 → 3.0.27
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/PxFloat.vue
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
import PxBaseVariants from './PxBaseVariants.vue';
|
|
67
67
|
import PxPortal from './PxPortal.vue';
|
|
68
68
|
|
|
69
|
-
import { computePosition, autoUpdate, flip, shift, offset } from '@floating-ui/dom';
|
|
69
|
+
import { computePosition, autoUpdate, flip, shift, offset, size } from '@floating-ui/dom';
|
|
70
70
|
import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
|
|
71
71
|
|
|
72
72
|
const FOCUS_ELEMENTS = [
|
|
@@ -171,6 +171,10 @@ export default {
|
|
|
171
171
|
// like flip but for the start/end direction
|
|
172
172
|
shift: { default: true },
|
|
173
173
|
|
|
174
|
+
// uses the size middleware to keep the float on screen, resizing when necessary
|
|
175
|
+
sizeToView: { default: false },
|
|
176
|
+
sizeToViewPadding: { type: Number, default: 10 },
|
|
177
|
+
|
|
174
178
|
// NOT IMPLEMENTED
|
|
175
179
|
// hiddenClass: { type: String, default: null },
|
|
176
180
|
|
|
@@ -461,6 +465,18 @@ export default {
|
|
|
461
465
|
middleware.push(flip(this.flip));
|
|
462
466
|
}
|
|
463
467
|
|
|
468
|
+
let maxHeight = null;
|
|
469
|
+
if (this.sizeToView) {
|
|
470
|
+
let padding = this.sizeToViewPadding || 0;
|
|
471
|
+
middleware.push(
|
|
472
|
+
size({
|
|
473
|
+
apply({ availableHeight }) {
|
|
474
|
+
maxHeight = availableHeight - padding;
|
|
475
|
+
},
|
|
476
|
+
})
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
464
480
|
if (this.placement && this.$refs.popup && reference) {
|
|
465
481
|
computePosition(reference, this.$refs.popup, {
|
|
466
482
|
placement: this.placement,
|
|
@@ -470,11 +486,13 @@ export default {
|
|
|
470
486
|
if (this.useTranslate) {
|
|
471
487
|
this.positionCss = {
|
|
472
488
|
transform: `translate(${this.cssPx(x)},${this.cssPx(y)})`,
|
|
489
|
+
maxHeight: this.cssPx(maxHeight),
|
|
473
490
|
};
|
|
474
491
|
} else {
|
|
475
492
|
this.positionCss = {
|
|
476
493
|
left: this.cssPx(x),
|
|
477
494
|
top: this.cssPx(y),
|
|
495
|
+
maxHeight: this.cssPx(maxHeight),
|
|
478
496
|
};
|
|
479
497
|
}
|
|
480
498
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export default val => {
|
|
2
2
|
if (!process.server) {
|
|
3
|
-
|
|
3
|
+
val = val.replace(/<\/p>/g, '</p> ');
|
|
4
|
+
val = val.replace(/<\/li>/g, '</li> ');
|
|
5
|
+
val = val.replace(/<\/div>/g, '</div> ');
|
|
6
|
+
|
|
7
|
+
let div = document.createElement('div');
|
|
4
8
|
div.innerHTML = val;
|
|
5
|
-
|
|
9
|
+
|
|
10
|
+
let text = div.innerText || '';
|
|
11
|
+
text = text.replace(/(\n)+/g, ' ');
|
|
12
|
+
|
|
6
13
|
return text;
|
|
7
14
|
} else {
|
|
8
15
|
return '';
|