@mixd-id/web-scaffold 0.1.230406369 → 0.1.230406370

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406369",
4
+ "version": "0.1.230406370",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -82,6 +82,8 @@ export default{
82
82
  this.isOnEndScroll = false
83
83
  }
84
84
  }
85
+
86
+ this.scrolled = this.scrollTop > 0
85
87
  }, 16),
86
88
 
87
89
  init(){
@@ -218,6 +220,8 @@ export default{
218
220
  isOnEndScroll: false,
219
221
  selectedIndex: -1,
220
222
  state: 1,
223
+ scrolled: false,
224
+ scrollerCache: {}
221
225
  }
222
226
  },
223
227
 
@@ -227,11 +231,11 @@ export default{
227
231
 
228
232
  watch: {
229
233
 
230
- column(to){
234
+ column(){
231
235
  this.resize()
232
236
  },
233
237
 
234
- gap(to){
238
+ gap(){
235
239
  this.resize()
236
240
  },
237
241
 
@@ -246,6 +250,19 @@ export default{
246
250
  }
247
251
  },
248
252
 
253
+ scrollerStyle(to){
254
+ if(this.scrolled && this.scrollerCache?.id){
255
+ const index = this.items.findIndex(_ => _.id === this.scrollerCache.id)
256
+ const addToScroll = (index - this.scrollerCache.index) * this.itemHeight
257
+ this.scrollTop = this.$el.scrollTop = this.scrollTop + addToScroll
258
+ }
259
+
260
+ this.scrollerCache = {
261
+ id: this.items[this.visibleStartIndex].id,
262
+ index: this.visibleStartIndex
263
+ }
264
+ },
265
+
249
266
  }
250
267
 
251
268
  }
@@ -139,7 +139,9 @@ export default{
139
139
  maxVisibleItems: 0,
140
140
  isOnEndScroll: false,
141
141
  selectedIndex: -1,
142
- state: 1
142
+ state: 1,
143
+ scrolled: false,
144
+ scrollerCache: {}
143
145
  }
144
146
  },
145
147
 
@@ -318,6 +320,8 @@ export default{
318
320
  this.isOnEndScroll = false
319
321
  }
320
322
  }
323
+
324
+ this.scrolled = this.scrollTop > 0
321
325
  }, 16),
322
326
 
323
327
  passiveScrollSupported() {
@@ -600,7 +604,20 @@ export default{
600
604
  handler(){
601
605
  this.resize()
602
606
  }
603
- }
607
+ },
608
+
609
+ scrollerStyle(to){
610
+ if(this.scrolled && this.scrollerCache?.id){
611
+ const index = this.items.findIndex(_ => _.id === this.scrollerCache.id)
612
+ const addToScroll = (index - this.scrollerCache.index) * this.itemHeight
613
+ this.scrollTop = this.$refs.cont.scrollTop = this.scrollTop + addToScroll
614
+ }
615
+
616
+ this.scrollerCache = {
617
+ id: this.items[this.visibleStartIndex].id,
618
+ index: this.visibleStartIndex
619
+ }
620
+ },
604
621
 
605
622
  }
606
623