@thinkpixellab-public/px-vue 3.0.76 → 3.0.77
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 +24 -0
- package/package.json +1 -1
- package/utils/textWidth.js +1 -0
package/components/PxFloat.vue
CHANGED
|
@@ -171,6 +171,15 @@ export default {
|
|
|
171
171
|
// like flip but for the start/end direction
|
|
172
172
|
shift: { default: true },
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* When true, the popup will be sized to the reference elemement, allowed values are:
|
|
176
|
+
* - "width" - size the width to the width of the reference element
|
|
177
|
+
* - "minWidth" - size the minWidth to the width of the reference element
|
|
178
|
+
* - "height" - (not implemented) size the height to the height of the reference element
|
|
179
|
+
* - "minHeight" - (not implemented) size the height to the height of the reference element
|
|
180
|
+
*/
|
|
181
|
+
sizeToReference: { type: String, default: null },
|
|
182
|
+
|
|
174
183
|
// uses the size middleware to keep the float on screen, resizing when necessary
|
|
175
184
|
sizeToView: { default: false },
|
|
176
185
|
sizeToViewPadding: { type: Number, default: 10 },
|
|
@@ -489,6 +498,21 @@ export default {
|
|
|
489
498
|
);
|
|
490
499
|
}
|
|
491
500
|
|
|
501
|
+
if (this.sizeToReference) {
|
|
502
|
+
const elementProp = this.sizeToReference;
|
|
503
|
+
const referenceProp = 'width';
|
|
504
|
+
|
|
505
|
+
middleware.push(
|
|
506
|
+
size({
|
|
507
|
+
apply({ rects, elements }) {
|
|
508
|
+
const assignValue = {};
|
|
509
|
+
assignValue[elementProp] = `${rects.reference[referenceProp]}px`;
|
|
510
|
+
Object.assign(elements.floating.style, assignValue);
|
|
511
|
+
},
|
|
512
|
+
})
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
|
|
492
516
|
if (this.placement && this.$refs.popup && reference) {
|
|
493
517
|
computePosition(reference, this.$refs.popup, {
|
|
494
518
|
placement: this.placement,
|
package/package.json
CHANGED
package/utils/textWidth.js
CHANGED