framework7 7.0.0-beta.10 → 7.0.0-beta.15

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.
Files changed (121) hide show
  1. package/components/actions/actions-class.js +6 -1
  2. package/components/actions/actions-rtl.css +1 -1
  3. package/components/actions/actions.css +1 -1
  4. package/components/actions/actions.d.ts +2 -0
  5. package/components/actions/actions.js +1 -0
  6. package/components/actions/actions.lazy.js +1 -1
  7. package/components/actions/actions.less +3 -0
  8. package/components/breadcrumbs/breadcrumbs-aurora.less +2 -0
  9. package/components/breadcrumbs/breadcrumbs-ios.less +2 -0
  10. package/components/breadcrumbs/breadcrumbs-md.less +2 -0
  11. package/components/breadcrumbs/breadcrumbs-rtl.css +1 -0
  12. package/components/breadcrumbs/breadcrumbs-vars.less +36 -0
  13. package/components/breadcrumbs/breadcrumbs.css +1 -0
  14. package/components/breadcrumbs/breadcrumbs.d.ts +15 -0
  15. package/components/breadcrumbs/breadcrumbs.js +13 -0
  16. package/components/breadcrumbs/breadcrumbs.lazy.js +1 -0
  17. package/components/breadcrumbs/breadcrumbs.less +100 -0
  18. package/components/calendar/calendar-class.js +206 -122
  19. package/components/calendar/calendar-rtl.css +1 -1
  20. package/components/calendar/calendar-vars.less +6 -10
  21. package/components/calendar/calendar.css +1 -1
  22. package/components/calendar/calendar.d.ts +2 -0
  23. package/components/calendar/calendar.js +1 -0
  24. package/components/calendar/calendar.lazy.js +1 -1
  25. package/components/calendar/calendar.less +20 -16
  26. package/components/list-index/list-index.d.ts +1 -1
  27. package/components/modal/modal-class.js +10 -0
  28. package/components/notification/notification.d.ts +4 -4
  29. package/components/picker/picker-class.js +6 -6
  30. package/components/picker/picker-column.js +34 -270
  31. package/components/picker/picker-rtl.css +1 -1
  32. package/components/picker/picker.css +1 -1
  33. package/components/picker/picker.d.ts +2 -13
  34. package/components/picker/picker.js +0 -5
  35. package/components/picker/picker.lazy.js +1 -1
  36. package/components/picker/picker.less +28 -10
  37. package/components/popover/popover-class.js +15 -2
  38. package/components/popover/popover-rtl.css +1 -1
  39. package/components/popover/popover.css +1 -1
  40. package/components/popover/popover.d.ts +2 -0
  41. package/components/popover/popover.js +1 -0
  42. package/components/popover/popover.lazy.js +1 -1
  43. package/components/popover/popover.less +3 -0
  44. package/components/popup/popup-class.js +6 -1
  45. package/components/popup/popup-rtl.css +1 -1
  46. package/components/popup/popup.css +1 -1
  47. package/components/popup/popup.d.ts +4 -0
  48. package/components/popup/popup.js +1 -0
  49. package/components/popup/popup.lazy.js +1 -1
  50. package/components/popup/popup.less +4 -0
  51. package/components/preloader/preloader-ios.less +3 -0
  52. package/components/preloader/preloader-rtl.css +1 -1
  53. package/components/preloader/preloader.css +1 -1
  54. package/components/preloader/preloader.d.ts +4 -0
  55. package/components/progressbar/progressbar-aurora.less +32 -13
  56. package/components/progressbar/progressbar-ios.less +19 -7
  57. package/components/progressbar/progressbar-md.less +64 -28
  58. package/components/progressbar/progressbar-rtl.css +1 -1
  59. package/components/progressbar/progressbar.css +1 -1
  60. package/components/progressbar/progressbar.js +1 -1
  61. package/components/progressbar/progressbar.lazy.js +1 -1
  62. package/components/progressbar/progressbar.less +16 -4
  63. package/components/range/range.d.ts +23 -5
  64. package/components/sheet/sheet-class.js +6 -1
  65. package/components/sheet/sheet-rtl.css +1 -1
  66. package/components/sheet/sheet.css +1 -1
  67. package/components/sheet/sheet.d.ts +2 -0
  68. package/components/sheet/sheet.js +1 -0
  69. package/components/sheet/sheet.lazy.js +1 -1
  70. package/components/sheet/sheet.less +3 -0
  71. package/components/sortable/sortable.d.ts +5 -1
  72. package/components/sortable/sortable.js +15 -2
  73. package/components/sortable/sortable.lazy.js +1 -1
  74. package/components/statusbar/statusbar.d.ts +9 -9
  75. package/components/swiper/swiper-rtl.css +1 -1
  76. package/components/swiper/swiper.css +1 -1
  77. package/components/swiper/swiper.lazy.js +1 -1
  78. package/components/tabs/tabs.js +4 -5
  79. package/components/tabs/tabs.lazy.js +1 -1
  80. package/components/toast/toast.d.ts +2 -2
  81. package/components/toolbar/toolbar-aurora.less +0 -13
  82. package/components/toolbar/toolbar-md.less +0 -13
  83. package/components/toolbar/toolbar.js +1 -1
  84. package/components/toolbar/toolbar.less +13 -0
  85. package/components/view/view-class.js +8 -1
  86. package/components/view/view.d.ts +5 -1
  87. package/components/view/view.js +2 -0
  88. package/components/virtual-list/virtual-list-class.js +44 -7
  89. package/components/virtual-list/virtual-list.d.ts +2 -2
  90. package/components/virtual-list/virtual-list.lazy.js +1 -1
  91. package/framework7-bundle-rtl.css +252 -150
  92. package/framework7-bundle-rtl.min.css +4 -4
  93. package/framework7-bundle.css +237 -134
  94. package/framework7-bundle.esm.js +5 -4
  95. package/framework7-bundle.js +982 -724
  96. package/framework7-bundle.js.map +1 -1
  97. package/framework7-bundle.less +4 -3
  98. package/framework7-bundle.min.css +4 -4
  99. package/framework7-bundle.min.js +4 -4
  100. package/framework7-bundle.min.js.map +1 -1
  101. package/framework7-lite-bundle.esm.js +5 -4
  102. package/framework7-lite.esm.js +3 -3
  103. package/framework7-rtl.css +12 -21
  104. package/framework7-rtl.min.css +4 -4
  105. package/framework7-types.d.ts +5 -1
  106. package/framework7.css +11 -19
  107. package/framework7.d.ts +4 -0
  108. package/framework7.esm.js +3 -3
  109. package/framework7.js +49 -17
  110. package/framework7.js.map +1 -1
  111. package/framework7.less +3 -3
  112. package/framework7.min.css +4 -4
  113. package/framework7.min.js +4 -4
  114. package/framework7.min.js.map +1 -1
  115. package/modules/component/component.d.ts +2 -2
  116. package/modules/device/device.js +1 -1
  117. package/modules/router/back.js +11 -1
  118. package/modules/router/tab.js +1 -1
  119. package/package.json +10 -5
  120. package/shared/get-device.d.ts +0 -2
  121. package/shared/get-device.js +1 -2
@@ -211,12 +211,11 @@ const Tab = {
211
211
  if ($tabLinkEl && $tabLinkEl.length > 0) {
212
212
  $tabLinkEl.addClass('tab-link-active'); // Material Highlight
213
213
 
214
- if (app.theme !== 'ios' && app.toolbar) {
215
- const $tabbarEl = $tabLinkEl.parents('.tabbar, .tabbar-labels');
214
+ const $tabbarEl = $tabLinkEl.parents('.tabbar, .tabbar-labels');
215
+ const hasHighlight = app.toolbar && $tabbarEl.length > 0 && ($tabbarEl.hasClass('tabbar-highlight') || app.theme !== 'ios');
216
216
 
217
- if ($tabbarEl.length > 0) {
218
- app.toolbar.setHighlight($tabbarEl);
219
- }
217
+ if (hasHighlight) {
218
+ app.toolbar.setHighlight($tabbarEl);
220
219
  }
221
220
  }
222
221
  }
@@ -1 +1 @@
1
- (function framework7ComponentLoader(t,a){void 0===a&&(a=!0);var e=t.$,n=t.utils,i=(t.getDevice,t.getSupport,t.Class,t.Modal,t.ConstructorMethods,t.ModalMethods,n.extend);const s={show(...t){const a=this;let n,i,s,r,l;1===t.length&&t[0]&&t[0].constructor===Object?(n=t[0].tabEl,i=t[0].tabLinkEl,s=t[0].animate,r=t[0].tabRoute,l=t[0].animatedInit):([n,i,s,r]=t,"boolean"==typeof t[1]&&([n,s,i,r]=t,t.length>2&&i.constructor===Object&&([n,s,r,i]=t))),void 0===s&&(s=!0);const o=e(n);if(r&&o[0]&&(o[0].f7TabRoute=r),!l&&(0===o.length||o.hasClass("tab-active")))return{$newTabEl:o,newTabEl:o[0]};let b;i&&(b=e(i));const h=o.parent(".tabs");if(0===h.length)return{$newTabEl:o,newTabEl:o[0]};a.swipeout&&(a.swipeout.allowOpen=!0);const d=[];function g(){d.forEach((t=>{t()}))}let c,p=!1;if(h.parent().hasClass("tabs-animated-wrap")){h.parent()[s?"removeClass":"addClass"]("not-animated");const t=parseFloat(h.css("transition-duration").replace(",","."));s&&t&&(h.transitionEnd(g),p=!0);const e=100*(a.rtl?o.index():-o.index());h.transform(`translate3d(${e}%,0,0)`)}h.parent().hasClass("tabs-swipeable-wrap")&&a.swiper&&(c=h.parent()[0].swiper,c&&c.activeIndex!==o.index()?(p=!0,c.once("slideChangeTransitionEnd",(()=>{g()})).slideTo(o.index(),s?void 0:0)):c&&c.animating&&(p=!0,c.once("slideChangeTransitionEnd",(()=>{g()}))));const u=h.children(".tab-active");if(u.removeClass("tab-active"),!l&&(!c||c&&!c.animating||c&&r)&&(u.hasClass("view")&&u.children(".page").length&&u.children(".page").each((t=>{e(t).trigger("page:tabhide"),a.emit("pageTabHide",t)})),u.trigger("tab:hide"),a.emit("tabHide",u[0])),o.addClass("tab-active"),!l&&(!c||c&&!c.animating||c&&r)&&(o.hasClass("view")&&o.children(".page").length&&o.children(".page").each((t=>{e(t).trigger("page:tabshow"),a.emit("pageTabShow",t)})),o.trigger("tab:show"),a.emit("tabShow",o[0])),!b&&(b=e("string"==typeof n?`.tab-link[href="${n}"]`:`.tab-link[href="#${o.attr("id")}"]`),(!b||b&&0===b.length)&&e("[data-tab]").each((t=>{o.is(e(t).attr("data-tab"))&&(b=e(t))})),r&&(!b||b&&0===b.length)&&(b=e(`[data-route-tab-id="${r.route.tab.id}"]`),0===b.length&&(b=e(`.tab-link[href="${r.url}"]`))),b.length>1&&o.parents(".page").length&&(b=b.filter((t=>e(t).parents(".page")[0]===o.parents(".page")[0])),"ios"===a.theme&&0===b.length&&r))){const t=o.parents(".page"),n=e(a.navbar.getElByPage(t));b=n.find(`[data-route-tab-id="${r.route.tab.id}"]`),0===b.length&&(b=n.find(`.tab-link[href="${r.url}"]`))}if(b.length>0){let t;if(u&&u.length>0){const a=u.attr("id");a&&(t=e(`.tab-link[href="#${a}"]`),(!t||t&&0===t.length)&&(t=e(`.tab-link[data-route-tab-id="${a}"]`))),(!t||t&&0===t.length)&&e("[data-tab]").each((a=>{u.is(e(a).attr("data-tab"))&&(t=e(a))})),(!t||t&&0===t.length)&&(t=b.siblings(".tab-link-active"))}else r&&(t=b.siblings(".tab-link-active"));if(t&&t.length>1&&u&&u.parents(".page").length&&(t=t.filter((t=>e(t).parents(".page")[0]===u.parents(".page")[0]))),t&&t.length>0&&t.removeClass("tab-link-active"),b&&b.length>0&&(b.addClass("tab-link-active"),"ios"!==a.theme&&a.toolbar)){const t=b.parents(".tabbar, .tabbar-labels");t.length>0&&a.toolbar.setHighlight(t)}}return{$newTabEl:o,newTabEl:o[0],$oldTabEl:u,oldTabEl:u[0],onTabsChanged:function(t){d.push(t)},animated:p}}};var r={name:"tabs",create(){i(this,{tab:{show:s.show.bind(this)}})},on:{"pageInit tabMounted":function(t){const a=e(t.el||t).find(".tabs-animated-wrap > .tabs > .tab-active")[0];if(!a)return;this.tab.show({tabEl:a,animatedInit:!0,animate:!1})}},clicks:{".tab-link":function(t,a={}){if(t.attr("href")&&0===t.attr("href").indexOf("#")||t.attr("data-tab")){this.tab.show({tabEl:a.tab||t.attr("href"),tabLinkEl:t,animate:a.animate})}}}};if(a){if(t.prototype.modules&&t.prototype.modules[r.name])return;t.use(r),t.instance&&(t.instance.useModuleParams(r,t.instance.params),t.instance.useModule(r))}return r}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))
1
+ (function framework7ComponentLoader(t,a){void 0===a&&(a=!0);var e=t.$,n=t.utils,i=(t.getDevice,t.getSupport,t.Class,t.Modal,t.ConstructorMethods,t.ModalMethods,n.extend);const s={show(...t){const a=this;let n,i,s,r,l;1===t.length&&t[0]&&t[0].constructor===Object?(n=t[0].tabEl,i=t[0].tabLinkEl,s=t[0].animate,r=t[0].tabRoute,l=t[0].animatedInit):([n,i,s,r]=t,"boolean"==typeof t[1]&&([n,s,i,r]=t,t.length>2&&i.constructor===Object&&([n,s,r,i]=t))),void 0===s&&(s=!0);const o=e(n);if(r&&o[0]&&(o[0].f7TabRoute=r),!l&&(0===o.length||o.hasClass("tab-active")))return{$newTabEl:o,newTabEl:o[0]};let b;i&&(b=e(i));const h=o.parent(".tabs");if(0===h.length)return{$newTabEl:o,newTabEl:o[0]};a.swipeout&&(a.swipeout.allowOpen=!0);const d=[];function g(){d.forEach((t=>{t()}))}let c,p=!1;if(h.parent().hasClass("tabs-animated-wrap")){h.parent()[s?"removeClass":"addClass"]("not-animated");const t=parseFloat(h.css("transition-duration").replace(",","."));s&&t&&(h.transitionEnd(g),p=!0);const e=100*(a.rtl?o.index():-o.index());h.transform(`translate3d(${e}%,0,0)`)}h.parent().hasClass("tabs-swipeable-wrap")&&a.swiper&&(c=h.parent()[0].swiper,c&&c.activeIndex!==o.index()?(p=!0,c.once("slideChangeTransitionEnd",(()=>{g()})).slideTo(o.index(),s?void 0:0)):c&&c.animating&&(p=!0,c.once("slideChangeTransitionEnd",(()=>{g()}))));const u=h.children(".tab-active");if(u.removeClass("tab-active"),!l&&(!c||c&&!c.animating||c&&r)&&(u.hasClass("view")&&u.children(".page").length&&u.children(".page").each((t=>{e(t).trigger("page:tabhide"),a.emit("pageTabHide",t)})),u.trigger("tab:hide"),a.emit("tabHide",u[0])),o.addClass("tab-active"),!l&&(!c||c&&!c.animating||c&&r)&&(o.hasClass("view")&&o.children(".page").length&&o.children(".page").each((t=>{e(t).trigger("page:tabshow"),a.emit("pageTabShow",t)})),o.trigger("tab:show"),a.emit("tabShow",o[0])),!b&&(b=e("string"==typeof n?`.tab-link[href="${n}"]`:`.tab-link[href="#${o.attr("id")}"]`),(!b||b&&0===b.length)&&e("[data-tab]").each((t=>{o.is(e(t).attr("data-tab"))&&(b=e(t))})),r&&(!b||b&&0===b.length)&&(b=e(`[data-route-tab-id="${r.route.tab.id}"]`),0===b.length&&(b=e(`.tab-link[href="${r.url}"]`))),b.length>1&&o.parents(".page").length&&(b=b.filter((t=>e(t).parents(".page")[0]===o.parents(".page")[0])),"ios"===a.theme&&0===b.length&&r))){const t=o.parents(".page"),n=e(a.navbar.getElByPage(t));b=n.find(`[data-route-tab-id="${r.route.tab.id}"]`),0===b.length&&(b=n.find(`.tab-link[href="${r.url}"]`))}if(b.length>0){let t;if(u&&u.length>0){const a=u.attr("id");a&&(t=e(`.tab-link[href="#${a}"]`),(!t||t&&0===t.length)&&(t=e(`.tab-link[data-route-tab-id="${a}"]`))),(!t||t&&0===t.length)&&e("[data-tab]").each((a=>{u.is(e(a).attr("data-tab"))&&(t=e(a))})),(!t||t&&0===t.length)&&(t=b.siblings(".tab-link-active"))}else r&&(t=b.siblings(".tab-link-active"));if(t&&t.length>1&&u&&u.parents(".page").length&&(t=t.filter((t=>e(t).parents(".page")[0]===u.parents(".page")[0]))),t&&t.length>0&&t.removeClass("tab-link-active"),b&&b.length>0){b.addClass("tab-link-active");const t=b.parents(".tabbar, .tabbar-labels");a.toolbar&&t.length>0&&(t.hasClass("tabbar-highlight")||"ios"!==a.theme)&&a.toolbar.setHighlight(t)}}return{$newTabEl:o,newTabEl:o[0],$oldTabEl:u,oldTabEl:u[0],onTabsChanged:function(t){d.push(t)},animated:p}}};var r={name:"tabs",create(){i(this,{tab:{show:s.show.bind(this)}})},on:{"pageInit tabMounted":function(t){const a=e(t.el||t).find(".tabs-animated-wrap > .tabs > .tab-active")[0];if(!a)return;this.tab.show({tabEl:a,animatedInit:!0,animate:!1})}},clicks:{".tab-link":function(t,a={}){if(t.attr("href")&&0===t.attr("href").indexOf("#")||t.attr("data-tab")){this.tab.show({tabEl:a.tab||t.attr("href"),tabLinkEl:t,animate:a.animate})}}}};if(a){if(t.prototype.modules&&t.prototype.modules[r.name])return;t.use(r),t.instance&&(t.instance.useModuleParams(r,t.instance.params),t.instance.useModule(r))}return r}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))
@@ -60,9 +60,9 @@ export namespace Toast {
60
60
  params: Parameters;
61
61
 
62
62
  /** Open toast */
63
- open(): Toast;
63
+ open(animate?: boolean): Toast;
64
64
  /** Close toast */
65
- close(): Toast;
65
+ close(animate?: boolean): Toast;
66
66
  /** Destroy toast */
67
67
  destroy(): void;
68
68
  }
@@ -10,19 +10,6 @@
10
10
  }
11
11
  .tabbar,
12
12
  .tabbar-labels {
13
- .tab-link-highlight {
14
- position: absolute;
15
- left: 0;
16
- height: 2px;
17
- background: var(--f7-tabbar-link-active-border-color, var(--f7-theme-color));
18
- transition-duration: 300ms;
19
- .ltr({
20
- left: 0;
21
- });
22
- .rtl({
23
- right: 0;
24
- });
25
- }
26
13
  .toolbar-inner {
27
14
  padding-left: 0;
28
15
  padding-right: 0;
@@ -26,19 +26,6 @@
26
26
  overflow: hidden;
27
27
  position: relative;
28
28
  }
29
- .tab-link-highlight {
30
- position: absolute;
31
- left: 0;
32
- height: 2px;
33
- background: var(--f7-tabbar-link-active-border-color, var(--f7-theme-color));
34
- transition-duration: 300ms;
35
- .ltr({
36
- left: 0;
37
- });
38
- .rtl({
39
- right: 0;
40
- });
41
- }
42
29
  }
43
30
 
44
31
  .tabbar-labels {
@@ -3,8 +3,8 @@ import { nextFrame, bindMethods } from '../../shared/utils.js';
3
3
  const Toolbar = {
4
4
  setHighlight(tabbarEl) {
5
5
  const app = this;
6
- if (app.theme === 'ios') return;
7
6
  const $tabbarEl = $(tabbarEl);
7
+ if (app.theme === 'ios' && !$tabbarEl.hasClass('tabbar-highlight')) return;
8
8
  if ($tabbarEl.length === 0 || !($tabbarEl.hasClass('tabbar') || $tabbarEl.hasClass('tabbar-labels'))) return;
9
9
  let $highlightEl = $tabbarEl.find('.tab-link-highlight');
10
10
  const tabLinksCount = $tabbarEl.find('.tab-link').length;
@@ -153,6 +153,19 @@
153
153
  height: var(--f7-tabbar-icon-size);
154
154
  line-height: var(--f7-tabbar-icon-size);
155
155
  }
156
+ .tab-link-highlight {
157
+ position: absolute;
158
+ left: 0;
159
+ height: 2px;
160
+ background: var(--f7-tabbar-link-active-border-color, var(--f7-theme-color));
161
+ transition-duration: 300ms;
162
+ .ltr({
163
+ left: 0;
164
+ });
165
+ .rtl({
166
+ right: 0;
167
+ });
168
+ }
156
169
  }
157
170
  .tabbar-labels {
158
171
  --f7-toolbar-height: var(--f7-tabbar-labels-height);
@@ -207,7 +207,14 @@ class View extends Framework7Class {
207
207
  view.initMasterDetail();
208
208
  }
209
209
 
210
- view.router.init();
210
+ if (view.params.initRouterOnTabShow && view.$el.hasClass('tab') && !view.$el.hasClass('tab-active')) {
211
+ view.$el.once('tab:show', () => {
212
+ view.router.init();
213
+ });
214
+ } else {
215
+ view.router.init();
216
+ }
217
+
211
218
  view.$el.trigger('view:init');
212
219
  view.emit('local::init viewInit', view);
213
220
  }
@@ -26,6 +26,8 @@ export namespace View {
26
26
  destroy(): void;
27
27
  }
28
28
  interface Parameters {
29
+ /** If enabled and View is tab, it won't initialize router and load initial page until View tab becomes visible */
30
+ initRouterOnTabShow?: boolean;
29
31
  /** View name. If view was created with name, then it may be accessed via app.views.[name] */
30
32
  name?: string;
31
33
  /** Specify whether this is View is main or not. If not passed then will be determined based on whether its element has view-main class or not */
@@ -142,7 +144,7 @@ export namespace View {
142
144
  auroraSwipeBackAnimateShadow?: boolean;
143
145
  /** Enable/disable opacity animation during swipe back action. You can disable it to improve performance. For Aurora theme */
144
146
  auroraSwipeBackAnimateOpacity?: boolean;
145
- /** If you develop web app (not PhoneGap or Home Screen web app) it is useful to enable hash navigation (browser url will look like "http://my-webapp.com/#!/about.html"). User as well will be able to navigate through app's history by using browser's default back and forward buttons. */
147
+ /** If you develop web app (not Cordova/Capacitor or Home Screen web app) it is useful to enable hash navigation (browser url will look like "http://my-webapp.com/#!/about.html"). User as well will be able to navigate through app's history by using browser's default back and forward buttons. */
146
148
  browserHistory?: boolean;
147
149
  /** Browser history root URL, for example "http://my-app.com/". It is useful only in case when you use empty ("") browserHistorySeparator */
148
150
  browserHistoryRoot?: string;
@@ -158,6 +160,8 @@ export namespace View {
158
160
  browserHistoryInitialMatch?: boolean;
159
161
  /** When enabled (by default), it will store router history in localStorage and try to restore it on next web app visit */
160
162
  browserHistoryStoreHistory?: boolean;
163
+ /** When "replace" (by default), it will replace state on routable tabs change, otherwise (if "push"), it will add to history every routable tab change, so it will be possible to switch back between tabs with browser back button */
164
+ browserHistoryTabs?: 'replace' | 'push';
161
165
  /** Object with events handlers.. */
162
166
  on?: {
163
167
  [event in keyof Events]?: Events[event];
@@ -48,6 +48,7 @@ export default {
48
48
  params: {
49
49
  view: {
50
50
  init: true,
51
+ initRouterOnTabShow: false,
51
52
  name: undefined,
52
53
  main: false,
53
54
  router: true,
@@ -98,6 +99,7 @@ export default {
98
99
  browserHistoryOnLoad: true,
99
100
  browserHistoryInitialMatch: false,
100
101
  browserHistoryStoreHistory: true,
102
+ browserHistoryTabs: 'replace',
101
103
  // Animate Pages
102
104
  animate: true,
103
105
  // iOS Dynamic Navbar
@@ -122,7 +122,8 @@ class VirtualList extends Framework7Class {
122
122
  rowsToRender: undefined,
123
123
  maxBufferHeight: 0,
124
124
  listHeight: undefined,
125
- dynamicHeight: typeof vl.params.height === 'function'
125
+ dynamicHeight: typeof vl.params.height === 'function',
126
+ autoHeight: vl.params.height === 'auto'
126
127
  }); // Install Modules
127
128
 
128
129
  vl.useModules(); // Attach events
@@ -163,10 +164,13 @@ class VirtualList extends Framework7Class {
163
164
  return vl;
164
165
  }
165
166
 
166
- setListSize() {
167
+ setListSize(autoHeightRerender) {
167
168
  const vl = this;
168
169
  const items = vl.filteredItems || vl.items;
169
- vl.pageHeight = vl.$scrollableParentEl[0].offsetHeight;
170
+
171
+ if (!autoHeightRerender) {
172
+ vl.pageHeight = vl.$scrollableParentEl[0].offsetHeight;
173
+ }
170
174
 
171
175
  if (vl.dynamicHeight) {
172
176
  vl.listHeight = 0;
@@ -177,6 +181,31 @@ class VirtualList extends Framework7Class {
177
181
  vl.listHeight += itemHeight;
178
182
  vl.heights.push(itemHeight);
179
183
  }
184
+ } else if (vl.autoHeight) {
185
+ vl.listHeight = 0;
186
+ if (!vl.heights) vl.heights = [];
187
+ if (!vl.heightsCalculated) vl.heightsCalculated = [];
188
+ const renderedItems = {};
189
+ vl.$itemsWrapEl.find(`[data-virtual-list-index]`).forEach(el => {
190
+ renderedItems[parseInt(el.getAttribute('data-virtual-list-index'), 10)] = el;
191
+ });
192
+
193
+ for (let i = 0; i < items.length; i += 1) {
194
+ const renderedItem = renderedItems[i];
195
+
196
+ if (renderedItem) {
197
+ if (!vl.heightsCalculated.includes(i)) {
198
+ vl.heights[i] = renderedItem.offsetHeight;
199
+ vl.heightsCalculated.push(i);
200
+ }
201
+ }
202
+
203
+ if (typeof vl.heights[i] === 'undefined') {
204
+ vl.heights[i] = 40;
205
+ }
206
+
207
+ vl.listHeight += vl.heights[i];
208
+ }
180
209
  } else {
181
210
  vl.listHeight = Math.ceil(items.length / vl.params.cols) * vl.params.height;
182
211
  vl.rowsPerScreen = Math.ceil(vl.pageHeight / vl.params.height);
@@ -211,7 +240,7 @@ class VirtualList extends Framework7Class {
211
240
  let heightBeforeFirstItem = 0;
212
241
  let heightBeforeLastItem = 0;
213
242
 
214
- if (vl.dynamicHeight) {
243
+ if (vl.dynamicHeight || vl.autoHeight) {
215
244
  let itemTop = 0;
216
245
  let itemHeight;
217
246
  vl.maxBufferHeight = vl.pageHeight;
@@ -278,7 +307,7 @@ class VirtualList extends Framework7Class {
278
307
 
279
308
 
280
309
  if (i === fromIndex) {
281
- if (vl.dynamicHeight) {
310
+ if (vl.dynamicHeight || vl.autoHeight) {
282
311
  topPosition = heightBeforeFirstItem;
283
312
  } else {
284
313
  topPosition = i * vl.params.height / vl.params.cols;
@@ -296,7 +325,7 @@ class VirtualList extends Framework7Class {
296
325
 
297
326
 
298
327
  if (!vl.updatableScroll) {
299
- if (vl.dynamicHeight) {
328
+ if (vl.dynamicHeight || vl.autoHeight) {
300
329
  vl.itemsWrapEl.style.height = `${heightBeforeLastItem}px`;
301
330
  } else {
302
331
  vl.itemsWrapEl.style.height = `${i * vl.params.height / vl.params.cols}px`;
@@ -336,6 +365,12 @@ class VirtualList extends Framework7Class {
336
365
  items: renderExternalItems
337
366
  });
338
367
  }
368
+
369
+ if (vl.autoHeight) {
370
+ requestAnimationFrame(() => {
371
+ vl.setListSize(true);
372
+ });
373
+ }
339
374
  } // Filter
340
375
 
341
376
 
@@ -372,7 +407,7 @@ class VirtualList extends Framework7Class {
372
407
  if (index > vl.items.length) return false;
373
408
  let itemTop = 0;
374
409
 
375
- if (vl.dynamicHeight) {
410
+ if (vl.dynamicHeight || vl.autoHeight) {
376
411
  for (let i = 0; i < index; i += 1) {
377
412
  itemTop += vl.heights[i];
378
413
  }
@@ -400,6 +435,7 @@ class VirtualList extends Framework7Class {
400
435
  const vl = this;
401
436
 
402
437
  if (vl.isVisible()) {
438
+ vl.heightsCalculated = [];
403
439
  vl.setListSize();
404
440
  vl.render(true);
405
441
  }
@@ -600,6 +636,7 @@ class VirtualList extends Framework7Class {
600
636
  vl.domCache = {};
601
637
  }
602
638
 
639
+ vl.heightsCalculated = [];
603
640
  vl.setListSize();
604
641
  vl.render(true);
605
642
  }
@@ -80,8 +80,8 @@ export namespace VirtualList {
80
80
  rowsAfter?: number;
81
81
  /** Number of items per row. Doesn't compatible when using Virtual List with dynamic height (default 1) */
82
82
  cols?: number;
83
- /** If number - list item height in px. If function then function should return item height. By default equals to 44 for iOS theme, 48 for MD theme, and 38 for Aurora theme */
84
- height?: number | Function;
83
+ /** If number - list item height in px. If function then function should return item height. If "auto" - will automatically calculate each items heights. By default equals to 44 for iOS theme, 48 for MD theme, and 38 for Aurora theme */
84
+ height?: number | Function | string;
85
85
  /** This optional function allows to use custom function to render item HTML. It could be used instead of template parameter */
86
86
  renderItem?(item: any): string;
87
87
  /** This optional function allows to render DOM items using some custom method. Useful in case it is used (e.g.) with Vue/React plugin to pass DOM rendering and manipulation to Vue/React. renderParameters conaints object with the following properties: fromIndex, toIndex, listHeight, topPosition, items */
@@ -1 +1 @@
1
- (function framework7ComponentLoader(e,t){void 0===t&&(t=!0);var l=e.$,s=e.utils,a=e.getDevice,r=(e.getSupport,e.Class),n=(e.Modal,e.ConstructorMethods),i=(e.ModalMethods,s.extend),o=s.deleteProps;class m extends r{constructor(e,t={}){super(t,[e]);const s=this,r=a(),n=getDocument();let o;"md"===e.theme?o=48:"ios"===e.theme?o=44:"aurora"===e.theme&&(o=38);const m={cols:1,height:o,cache:!0,dynamicHeightBufferSize:1,showFilteredItemsOnly:!1,renderExternal:void 0,setListHeight:!0,searchByItem:void 0,searchAll:void 0,ul:null,createUl:!0,scrollableParentEl:void 0,renderItem:e=>`\n <li>\n <div class="item-content">\n <div class="item-inner">\n <div class="item-title">${e}</div>\n </div>\n </div>\n </li>\n `.trim(),on:{}};if(s.useModulesParams(m),s.params=i(m,t),void 0!==s.params.height&&s.params.height||(s.params.height=o),s.$el=l(t.el),s.el=s.$el[0],0===s.$el.length)return;s.$el[0].f7VirtualList=s,s.items=s.params.items,s.params.showFilteredItemsOnly&&(s.filteredItems=[]),s.params.renderItem&&(s.renderItem=s.params.renderItem),s.$pageContentEl=s.$el.parents(".page-content"),s.pageContentEl=s.$pageContentEl[0],s.$scrollableParentEl=s.params.scrollableParentEl?l(s.params.scrollableParentEl).eq(0):s.$pageContentEl,!s.$scrollableParentEl.length&&s.$pageContentEl.length&&(s.$scrollableParentEl=s.$pageContentEl),s.scrollableParentEl=s.$scrollableParentEl[0],void 0!==s.params.updatableScroll?s.updatableScroll=s.params.updatableScroll:(s.updatableScroll=!0,r.ios&&r.osVersion.split(".")[0]<8&&(s.updatableScroll=!1));const h=s.params.ul;let c;s.$ul=h?l(s.params.ul):s.$el.children("ul"),0===s.$ul.length&&s.params.createUl&&(s.$el.append("<ul></ul>"),s.$ul=s.$el.children("ul")),s.ul=s.$ul[0],c=s.ul||s.params.createUl?s.$ul:s.$el,i(s,{$itemsWrapEl:c,itemsWrapEl:c[0],domCache:{},displayDomCache:{},tempDomElement:n.createElement("ul"),lastRepaintY:null,fragment:n.createDocumentFragment(),pageHeight:void 0,rowsPerScreen:void 0,rowsBefore:void 0,rowsAfter:void 0,rowsToRender:void 0,maxBufferHeight:0,listHeight:void 0,dynamicHeight:"function"==typeof s.params.height}),s.useModules();const p=s.handleScroll.bind(s),d=s.handleResize.bind(s);let f,g,u,I;return s.attachEvents=function(){f=s.$el.parents(".page").eq(0),g=s.$el.parents(".tab").filter((e=>0===l(e).parent(".tabs").parent(".tabs-animated-wrap, .tabs-swipeable-wrap").length)).eq(0),u=s.$el.parents(".panel").eq(0),I=s.$el.parents(".popup").eq(0),s.$scrollableParentEl.on("scroll",p),f.length&&f.on("page:reinit",d),g.length&&g.on("tab:show",d),u.length&&u.on("panel:open",d),I.length&&I.on("popup:open",d),e.on("resize",d)},s.detachEvents=function(){s.$scrollableParentEl.off("scroll",p),f.length&&f.off("page:reinit",d),g.length&&g.off("tab:show",d),u.length&&u.off("panel:open",d),I.length&&I.off("popup:open",d),e.off("resize",d)},s.init(),s}setListSize(){const e=this,t=e.filteredItems||e.items;if(e.pageHeight=e.$scrollableParentEl[0].offsetHeight,e.dynamicHeight){e.listHeight=0,e.heights=[];for(let l=0;l<t.length;l+=1){const s=e.params.height(t[l]);e.listHeight+=s,e.heights.push(s)}}else e.listHeight=Math.ceil(t.length/e.params.cols)*e.params.height,e.rowsPerScreen=Math.ceil(e.pageHeight/e.params.height),e.rowsBefore=e.params.rowsBefore||2*e.rowsPerScreen,e.rowsAfter=e.params.rowsAfter||e.rowsPerScreen,e.rowsToRender=e.rowsPerScreen+e.rowsBefore+e.rowsAfter,e.maxBufferHeight=e.rowsBefore/2*e.params.height;(e.updatableScroll||e.params.setListHeight)&&e.$itemsWrapEl.css({height:`${e.listHeight}px`})}render(e,t){const l=this;e&&(l.lastRepaintY=null);let s=-(l.$el[0].getBoundingClientRect().top-l.$scrollableParentEl[0].getBoundingClientRect().top);if(void 0!==t&&(s=t),!(null===l.lastRepaintY||Math.abs(s-l.lastRepaintY)>l.maxBufferHeight||!l.updatableScroll&&l.$scrollableParentEl[0].scrollTop+l.pageHeight>=l.$scrollableParentEl[0].scrollHeight))return;l.lastRepaintY=s;const a=l.filteredItems||l.items;let r,n,i,o=0,m=0;if(l.dynamicHeight){let e,t=0;l.maxBufferHeight=l.pageHeight;for(let a=0;a<l.heights.length;a+=1)e=l.heights[a],void 0===r&&(t+e>=s-2*l.pageHeight*l.params.dynamicHeightBufferSize?r=a:o+=e),void 0===n&&((t+e>=s+2*l.pageHeight*l.params.dynamicHeightBufferSize||a===l.heights.length-1)&&(n=a+1),m+=e),t+=e;n=Math.min(n,a.length)}else r=(parseInt(s/l.params.height,10)-l.rowsBefore)*l.params.cols,r<0&&(r=0),n=Math.min(r+l.rowsToRender*l.params.cols,a.length);const h=[];let c;for(l.reachEnd=!1,c=r;c<n;c+=1){let e;const t=l.items.indexOf(a[c]);c===r&&(l.currentFromIndex=t),c===n-1&&(l.currentToIndex=t),l.filteredItems?l.items[t]===l.filteredItems[l.filteredItems.length-1]&&(l.reachEnd=!0):t===l.items.length-1&&(l.reachEnd=!0),l.params.renderExternal?h.push(a[c]):l.domCache[t]?(e=l.domCache[t],e.f7VirtualListIndex=t):(l.renderItem?l.tempDomElement.innerHTML=l.renderItem(a[c],t).trim():l.tempDomElement.innerHTML=a[c].toString().trim(),e=l.tempDomElement.childNodes[0],l.params.cache&&(l.domCache[t]=e),e.f7VirtualListIndex=t),c===r&&(i=l.dynamicHeight?o:c*l.params.height/l.params.cols),l.params.renderExternal||(e.style.top=`${i}px`,l.emit("local::itemBeforeInsert vlItemBeforeInsert",l,e,a[c]),l.fragment.appendChild(e))}l.updatableScroll||(l.dynamicHeight?l.itemsWrapEl.style.height=`${m}px`:l.itemsWrapEl.style.height=c*l.params.height/l.params.cols+"px"),l.params.renderExternal?a&&0===a.length&&(l.reachEnd=!0):(l.emit("local::beforeClear vlBeforeClear",l,l.fragment),l.itemsWrapEl.innerHTML="",l.emit("local::itemsBeforeInsert vlItemsBeforeInsert",l,l.fragment),a&&0===a.length?(l.reachEnd=!0,l.params.emptyTemplate&&(l.itemsWrapEl.innerHTML=l.params.emptyTemplate)):l.itemsWrapEl.appendChild(l.fragment),l.emit("local::itemsAfterInsert vlItemsAfterInsert",l,l.fragment)),void 0!==t&&e&&l.$scrollableParentEl.scrollTop(t,0),l.params.renderExternal&&l.params.renderExternal(l,{fromIndex:r,toIndex:n,listHeight:l.listHeight,topPosition:i,items:h})}filterItems(e,t=!0){const l=this;l.filteredItems=[];for(let t=0;t<e.length;t+=1)l.filteredItems.push(l.items[e[t]]);t&&(l.$scrollableParentEl[0].scrollTop=0),l.update()}resetFilter(){const e=this;e.params.showFilteredItemsOnly?e.filteredItems=[]:(e.filteredItems=null,delete e.filteredItems),e.update()}scrollToItem(e){const t=this;if(e>t.items.length)return!1;let l=0;if(t.dynamicHeight)for(let s=0;s<e;s+=1)l+=t.heights[s];else l=e*t.params.height;const s=t.$el[0].offsetTop;return t.render(!0,s+l-parseInt(t.$scrollableParentEl.css("padding-top"),10)),!0}handleScroll(){this.render()}isVisible(){const e=this;return!!(e.el.offsetWidth||e.el.offsetHeight||e.el.getClientRects().length)}handleResize(){const e=this;e.isVisible()&&(e.setListSize(),e.render(!0))}appendItems(e){const t=this;for(let l=0;l<e.length;l+=1)t.items.push(e[l]);t.update()}appendItem(e){this.appendItems([e])}replaceAllItems(e){const t=this;t.items=e,delete t.filteredItems,t.domCache={},t.update()}replaceItem(e,t){const l=this;l.items[e]=t,l.params.cache&&delete l.domCache[e],l.update()}prependItems(e){const t=this;for(let l=e.length-1;l>=0;l-=1)t.items.unshift(e[l]);if(t.params.cache){const l={};Object.keys(t.domCache).forEach((s=>{l[parseInt(s,10)+e.length]=t.domCache[s]})),t.domCache=l}t.update()}prependItem(e){this.prependItems([e])}moveItem(e,t){const l=this,s=e;let a=t;if(s===a)return;const r=l.items.splice(s,1)[0];if(a>=l.items.length?(l.items.push(r),a=l.items.length-1):l.items.splice(a,0,r),l.params.cache){const e={};Object.keys(l.domCache).forEach((t=>{const r=parseInt(t,10),n=s<a?s:a,i=s<a?a:s,o=s<a?-1:1;(r<n||r>i)&&(e[r]=l.domCache[r]),r===n&&(e[i]=l.domCache[r]),r>n&&r<=i&&(e[r+o]=l.domCache[r])})),l.domCache=e}l.update()}insertItemBefore(e,t){const l=this;if(0!==e)if(e>=l.items.length)l.appendItem(t);else{if(l.items.splice(e,0,t),l.params.cache){const t={};Object.keys(l.domCache).forEach((s=>{const a=parseInt(s,10);a>=e&&(t[a+1]=l.domCache[a])})),l.domCache=t}l.update()}else l.prependItem(t)}deleteItems(e){const t=this;let l,s=0;for(let a=0;a<e.length;a+=1){let r=e[a];void 0!==l&&r>l&&(s=-a),r+=s,l=e[a];const n=t.items.splice(r,1)[0];if(t.filteredItems&&t.filteredItems.indexOf(n)>=0&&t.filteredItems.splice(t.filteredItems.indexOf(n),1),t.params.cache){const e={};Object.keys(t.domCache).forEach((l=>{const s=parseInt(l,10);s===r?delete t.domCache[r]:parseInt(l,10)>r?e[s-1]=t.domCache[l]:e[s]=t.domCache[l]})),t.domCache=e}}t.update()}deleteAllItems(){const e=this;e.items=[],delete e.filteredItems,e.params.cache&&(e.domCache={}),e.update()}deleteItem(e){this.deleteItems([e])}clearCache(){this.domCache={}}update(e){const t=this;e&&t.params.cache&&(t.domCache={}),t.setListSize(),t.render(!0)}init(){const e=this;e.attachEvents(),e.setListSize(),e.render()}destroy(){let e=this;e.detachEvents(),e.$el[0].f7VirtualList=null,delete e.$el[0].f7VirtualList,o(e),e=null}}var h={name:"virtualList",static:{VirtualList:m},create(){this.virtualList=n({defaultSelector:".virtual-list",constructor:m,app:this,domProp:"f7VirtualList"})}};if(t){if(e.prototype.modules&&e.prototype.modules[h.name])return;e.use(h),e.instance&&(e.instance.useModuleParams(h,e.instance.params),e.instance.useModule(h))}return h}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))
1
+ (function framework7ComponentLoader(e,t){void 0===t&&(t=!0);var s=e.$,a=e.utils,l=e.getDevice,r=(e.getSupport,e.Class),i=(e.Modal,e.ConstructorMethods),n=(e.ModalMethods,a.extend),o=a.deleteProps;class h extends r{constructor(e,t={}){super(t,[e]);const a=this,r=l(),i=getDocument();let o;"md"===e.theme?o=48:"ios"===e.theme?o=44:"aurora"===e.theme&&(o=38);const h={cols:1,height:o,cache:!0,dynamicHeightBufferSize:1,showFilteredItemsOnly:!1,renderExternal:void 0,setListHeight:!0,searchByItem:void 0,searchAll:void 0,ul:null,createUl:!0,scrollableParentEl:void 0,renderItem:e=>`\n <li>\n <div class="item-content">\n <div class="item-inner">\n <div class="item-title">${e}</div>\n </div>\n </div>\n </li>\n `.trim(),on:{}};if(a.useModulesParams(h),a.params=n(h,t),void 0!==a.params.height&&a.params.height||(a.params.height=o),a.$el=s(t.el),a.el=a.$el[0],0===a.$el.length)return;a.$el[0].f7VirtualList=a,a.items=a.params.items,a.params.showFilteredItemsOnly&&(a.filteredItems=[]),a.params.renderItem&&(a.renderItem=a.params.renderItem),a.$pageContentEl=a.$el.parents(".page-content"),a.pageContentEl=a.$pageContentEl[0],a.$scrollableParentEl=a.params.scrollableParentEl?s(a.params.scrollableParentEl).eq(0):a.$pageContentEl,!a.$scrollableParentEl.length&&a.$pageContentEl.length&&(a.$scrollableParentEl=a.$pageContentEl),a.scrollableParentEl=a.$scrollableParentEl[0],void 0!==a.params.updatableScroll?a.updatableScroll=a.params.updatableScroll:(a.updatableScroll=!0,r.ios&&r.osVersion.split(".")[0]<8&&(a.updatableScroll=!1));const m=a.params.ul;let c;a.$ul=m?s(a.params.ul):a.$el.children("ul"),0===a.$ul.length&&a.params.createUl&&(a.$el.append("<ul></ul>"),a.$ul=a.$el.children("ul")),a.ul=a.$ul[0],c=a.ul||a.params.createUl?a.$ul:a.$el,n(a,{$itemsWrapEl:c,itemsWrapEl:c[0],domCache:{},displayDomCache:{},tempDomElement:i.createElement("ul"),lastRepaintY:null,fragment:i.createDocumentFragment(),pageHeight:void 0,rowsPerScreen:void 0,rowsBefore:void 0,rowsAfter:void 0,rowsToRender:void 0,maxBufferHeight:0,listHeight:void 0,dynamicHeight:"function"==typeof a.params.height,autoHeight:"auto"===a.params.height}),a.useModules();const p=a.handleScroll.bind(a),d=a.handleResize.bind(a);let g,f,u,I;return a.attachEvents=function(){g=a.$el.parents(".page").eq(0),f=a.$el.parents(".tab").filter((e=>0===s(e).parent(".tabs").parent(".tabs-animated-wrap, .tabs-swipeable-wrap").length)).eq(0),u=a.$el.parents(".panel").eq(0),I=a.$el.parents(".popup").eq(0),a.$scrollableParentEl.on("scroll",p),g.length&&g.on("page:reinit",d),f.length&&f.on("tab:show",d),u.length&&u.on("panel:open",d),I.length&&I.on("popup:open",d),e.on("resize",d)},a.detachEvents=function(){a.$scrollableParentEl.off("scroll",p),g.length&&g.off("page:reinit",d),f.length&&f.off("tab:show",d),u.length&&u.off("panel:open",d),I.length&&I.off("popup:open",d),e.off("resize",d)},a.init(),a}setListSize(e){const t=this,s=t.filteredItems||t.items;if(e||(t.pageHeight=t.$scrollableParentEl[0].offsetHeight),t.dynamicHeight){t.listHeight=0,t.heights=[];for(let e=0;e<s.length;e+=1){const a=t.params.height(s[e]);t.listHeight+=a,t.heights.push(a)}}else if(t.autoHeight){t.listHeight=0,t.heights||(t.heights=[]),t.heightsCalculated||(t.heightsCalculated=[]);const e={};t.$itemsWrapEl.find("[data-virtual-list-index]").forEach((t=>{e[parseInt(t.getAttribute("data-virtual-list-index"),10)]=t}));for(let a=0;a<s.length;a+=1){const s=e[a];s&&(t.heightsCalculated.includes(a)||(t.heights[a]=s.offsetHeight,t.heightsCalculated.push(a))),void 0===t.heights[a]&&(t.heights[a]=40),t.listHeight+=t.heights[a]}}else t.listHeight=Math.ceil(s.length/t.params.cols)*t.params.height,t.rowsPerScreen=Math.ceil(t.pageHeight/t.params.height),t.rowsBefore=t.params.rowsBefore||2*t.rowsPerScreen,t.rowsAfter=t.params.rowsAfter||t.rowsPerScreen,t.rowsToRender=t.rowsPerScreen+t.rowsBefore+t.rowsAfter,t.maxBufferHeight=t.rowsBefore/2*t.params.height;(t.updatableScroll||t.params.setListHeight)&&t.$itemsWrapEl.css({height:`${t.listHeight}px`})}render(e,t){const s=this;e&&(s.lastRepaintY=null);let a=-(s.$el[0].getBoundingClientRect().top-s.$scrollableParentEl[0].getBoundingClientRect().top);if(void 0!==t&&(a=t),!(null===s.lastRepaintY||Math.abs(a-s.lastRepaintY)>s.maxBufferHeight||!s.updatableScroll&&s.$scrollableParentEl[0].scrollTop+s.pageHeight>=s.$scrollableParentEl[0].scrollHeight))return;s.lastRepaintY=a;const l=s.filteredItems||s.items;let r,i,n,o=0,h=0;if(s.dynamicHeight||s.autoHeight){let e,t=0;s.maxBufferHeight=s.pageHeight;for(let l=0;l<s.heights.length;l+=1)e=s.heights[l],void 0===r&&(t+e>=a-2*s.pageHeight*s.params.dynamicHeightBufferSize?r=l:o+=e),void 0===i&&((t+e>=a+2*s.pageHeight*s.params.dynamicHeightBufferSize||l===s.heights.length-1)&&(i=l+1),h+=e),t+=e;i=Math.min(i,l.length)}else r=(parseInt(a/s.params.height,10)-s.rowsBefore)*s.params.cols,r<0&&(r=0),i=Math.min(r+s.rowsToRender*s.params.cols,l.length);const m=[];let c;for(s.reachEnd=!1,c=r;c<i;c+=1){let e;const t=s.items.indexOf(l[c]);c===r&&(s.currentFromIndex=t),c===i-1&&(s.currentToIndex=t),s.filteredItems?s.items[t]===s.filteredItems[s.filteredItems.length-1]&&(s.reachEnd=!0):t===s.items.length-1&&(s.reachEnd=!0),s.params.renderExternal?m.push(l[c]):s.domCache[t]?(e=s.domCache[t],e.f7VirtualListIndex=t):(s.renderItem?s.tempDomElement.innerHTML=s.renderItem(l[c],t).trim():s.tempDomElement.innerHTML=l[c].toString().trim(),e=s.tempDomElement.childNodes[0],s.params.cache&&(s.domCache[t]=e),e.f7VirtualListIndex=t),c===r&&(n=s.dynamicHeight||s.autoHeight?o:c*s.params.height/s.params.cols),s.params.renderExternal||(e.style.top=`${n}px`,s.emit("local::itemBeforeInsert vlItemBeforeInsert",s,e,l[c]),s.fragment.appendChild(e))}s.updatableScroll||(s.dynamicHeight||s.autoHeight?s.itemsWrapEl.style.height=`${h}px`:s.itemsWrapEl.style.height=c*s.params.height/s.params.cols+"px"),s.params.renderExternal?l&&0===l.length&&(s.reachEnd=!0):(s.emit("local::beforeClear vlBeforeClear",s,s.fragment),s.itemsWrapEl.innerHTML="",s.emit("local::itemsBeforeInsert vlItemsBeforeInsert",s,s.fragment),l&&0===l.length?(s.reachEnd=!0,s.params.emptyTemplate&&(s.itemsWrapEl.innerHTML=s.params.emptyTemplate)):s.itemsWrapEl.appendChild(s.fragment),s.emit("local::itemsAfterInsert vlItemsAfterInsert",s,s.fragment)),void 0!==t&&e&&s.$scrollableParentEl.scrollTop(t,0),s.params.renderExternal&&s.params.renderExternal(s,{fromIndex:r,toIndex:i,listHeight:s.listHeight,topPosition:n,items:m}),s.autoHeight&&requestAnimationFrame((()=>{s.setListSize(!0)}))}filterItems(e,t=!0){const s=this;s.filteredItems=[];for(let t=0;t<e.length;t+=1)s.filteredItems.push(s.items[e[t]]);t&&(s.$scrollableParentEl[0].scrollTop=0),s.update()}resetFilter(){const e=this;e.params.showFilteredItemsOnly?e.filteredItems=[]:(e.filteredItems=null,delete e.filteredItems),e.update()}scrollToItem(e){const t=this;if(e>t.items.length)return!1;let s=0;if(t.dynamicHeight||t.autoHeight)for(let a=0;a<e;a+=1)s+=t.heights[a];else s=e*t.params.height;const a=t.$el[0].offsetTop;return t.render(!0,a+s-parseInt(t.$scrollableParentEl.css("padding-top"),10)),!0}handleScroll(){this.render()}isVisible(){const e=this;return!!(e.el.offsetWidth||e.el.offsetHeight||e.el.getClientRects().length)}handleResize(){const e=this;e.isVisible()&&(e.heightsCalculated=[],e.setListSize(),e.render(!0))}appendItems(e){const t=this;for(let s=0;s<e.length;s+=1)t.items.push(e[s]);t.update()}appendItem(e){this.appendItems([e])}replaceAllItems(e){const t=this;t.items=e,delete t.filteredItems,t.domCache={},t.update()}replaceItem(e,t){const s=this;s.items[e]=t,s.params.cache&&delete s.domCache[e],s.update()}prependItems(e){const t=this;for(let s=e.length-1;s>=0;s-=1)t.items.unshift(e[s]);if(t.params.cache){const s={};Object.keys(t.domCache).forEach((a=>{s[parseInt(a,10)+e.length]=t.domCache[a]})),t.domCache=s}t.update()}prependItem(e){this.prependItems([e])}moveItem(e,t){const s=this,a=e;let l=t;if(a===l)return;const r=s.items.splice(a,1)[0];if(l>=s.items.length?(s.items.push(r),l=s.items.length-1):s.items.splice(l,0,r),s.params.cache){const e={};Object.keys(s.domCache).forEach((t=>{const r=parseInt(t,10),i=a<l?a:l,n=a<l?l:a,o=a<l?-1:1;(r<i||r>n)&&(e[r]=s.domCache[r]),r===i&&(e[n]=s.domCache[r]),r>i&&r<=n&&(e[r+o]=s.domCache[r])})),s.domCache=e}s.update()}insertItemBefore(e,t){const s=this;if(0!==e)if(e>=s.items.length)s.appendItem(t);else{if(s.items.splice(e,0,t),s.params.cache){const t={};Object.keys(s.domCache).forEach((a=>{const l=parseInt(a,10);l>=e&&(t[l+1]=s.domCache[l])})),s.domCache=t}s.update()}else s.prependItem(t)}deleteItems(e){const t=this;let s,a=0;for(let l=0;l<e.length;l+=1){let r=e[l];void 0!==s&&r>s&&(a=-l),r+=a,s=e[l];const i=t.items.splice(r,1)[0];if(t.filteredItems&&t.filteredItems.indexOf(i)>=0&&t.filteredItems.splice(t.filteredItems.indexOf(i),1),t.params.cache){const e={};Object.keys(t.domCache).forEach((s=>{const a=parseInt(s,10);a===r?delete t.domCache[r]:parseInt(s,10)>r?e[a-1]=t.domCache[s]:e[a]=t.domCache[s]})),t.domCache=e}}t.update()}deleteAllItems(){const e=this;e.items=[],delete e.filteredItems,e.params.cache&&(e.domCache={}),e.update()}deleteItem(e){this.deleteItems([e])}clearCache(){this.domCache={}}update(e){const t=this;e&&t.params.cache&&(t.domCache={}),t.heightsCalculated=[],t.setListSize(),t.render(!0)}init(){const e=this;e.attachEvents(),e.setListSize(),e.render()}destroy(){let e=this;e.detachEvents(),e.$el[0].f7VirtualList=null,delete e.$el[0].f7VirtualList,o(e),e=null}}var m={name:"virtualList",static:{VirtualList:h},create(){this.virtualList=i({defaultSelector:".virtual-list",constructor:h,app:this,domProp:"f7VirtualList"})}};if(t){if(e.prototype.modules&&e.prototype.modules[m.name])return;e.use(m),e.instance&&(e.instance.useModuleParams(m,e.instance.params),e.instance.useModule(m))}return m}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))