@thinkpixellab-public/px-vue 3.0.100 → 3.0.101

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.
@@ -24,6 +24,7 @@
24
24
  :class="bem()"
25
25
  :name="transitionName ? transitionName : 'px-transition-item__fade'"
26
26
  tag="div"
27
+ @before-leave="onBeforeLeave"
27
28
  >
28
29
  <div
29
30
  :class="[bem('item'), itemClass]"
@@ -39,6 +40,8 @@
39
40
  </template>
40
41
 
41
42
  <script>
43
+ import utils from '@thinkpixellab-public/px-vue/utils/utils.js';
44
+
42
45
  export default {
43
46
  name: 'px-transition-item',
44
47
  props: {
@@ -46,6 +49,7 @@ export default {
46
49
  itemClass: { default: null },
47
50
  transitionName: { default: null },
48
51
  transitionDurationMs: { type: Number, default: null },
52
+ pin: { type: Boolean, default: false },
49
53
  },
50
54
  data() {
51
55
  return { items: [], currentId: 0 };
@@ -75,6 +79,18 @@ export default {
75
79
  },
76
80
  },
77
81
  },
82
+ methods: {
83
+ onBeforeLeave(el) {
84
+ if (this.pin) {
85
+ let r = utils.getClientRect(el);
86
+ el.style.position = 'fixed';
87
+ el.style.top = r.top + 'px';
88
+ el.style.left = r.left + 'px';
89
+ el.style.width = r.width + 'px';
90
+ el.style.height = r.height + 'px';
91
+ }
92
+ },
93
+ },
78
94
  };
79
95
  </script>
80
96
 
@@ -82,7 +98,7 @@ export default {
82
98
  @use '../styles/px.scss' as *;
83
99
 
84
100
  // background change transition
85
- @include vue-transition-fade(px-transition-item__fade, $dur: 0.5s);
101
+ @include vue-transition-fade(px-transition-item__fade, $dur: 0.5s, $pin: true);
86
102
 
87
103
  .px-transition-item {
88
104
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "3.0.100",
3
+ "version": "3.0.101",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": "Pixel Lab",
6
6
  "license": "MIT",