vevet 1.4.27 → 2.0.1-dev.3
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/LICENSE +1 -1
- package/README.md +7 -71
- package/build/cdn/index.js +12 -0
- package/build/cdn/index.js.LICENSE.txt +14 -0
- package/build/cjs/app/Application.js +297 -0
- package/build/cjs/app/events/PageLoad.js +74 -0
- package/build/cjs/app/events/Viewport.js +303 -0
- package/build/cjs/base/Callbacks.js +232 -0
- package/build/cjs/base/Component.js +56 -0
- package/build/cjs/base/Module.js +262 -0
- package/build/cjs/base/MutableProp.js +165 -0
- package/build/cjs/base/Plugin.js +56 -0
- package/build/cjs/components/animation-frame/AnimationFrame.js +183 -0
- package/build/cjs/components/canvas/Ctx2D.js +200 -0
- package/build/cjs/components/canvas/Ctx2DPrerender.js +72 -0
- package/build/cjs/components/cursor/CustomCursor.js +344 -0
- package/build/cjs/components/dragger/Dragger.js +229 -0
- package/build/cjs/components/dragger/DraggerDirection.js +77 -0
- package/build/cjs/components/dragger/DraggerMove.js +84 -0
- package/build/cjs/components/loading/Preloader.js +229 -0
- package/build/cjs/components/loading/ProgressPreloader.js +377 -0
- package/build/cjs/components/page/Page.js +353 -0
- package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +517 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +178 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +138 -0
- package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +133 -0
- package/build/cjs/components/scroll/scrollable/ScrollView.js +315 -0
- package/build/cjs/components/scroll/scrollbar/Bar.js +315 -0
- package/build/cjs/components/scroll/scrollbar/ScrollBar.js +206 -0
- package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +625 -0
- package/build/cjs/components/scroll/types.js +2 -0
- package/build/cjs/components/split-text/SplitText.js +233 -0
- package/build/cjs/components/text/SplitText.js +329 -0
- package/build/cjs/components/timeline/StaticTimeline.js +137 -0
- package/build/cjs/components/timeline/Timeline.js +190 -0
- package/build/cjs/index.js +87 -0
- package/build/cjs/utils/common/index.js +12 -0
- package/build/cjs/utils/common/mergeWithoutArrays.js +19 -0
- package/build/cjs/utils/common/randID.js +11 -0
- package/build/cjs/utils/common/timeoutCallback.js +17 -0
- package/build/cjs/utils/errors.js +8 -0
- package/build/cjs/utils/listeners/index.js +10 -0
- package/build/cjs/utils/listeners/intersectionObserverSupported.js +11 -0
- package/build/cjs/utils/listeners/onScroll.js +47 -0
- package/build/cjs/utils/math/boundVal.js +16 -0
- package/build/cjs/utils/math/index.js +12 -0
- package/build/cjs/utils/math/lerp.js +15 -0
- package/build/cjs/utils/math/scopeProgress.js +25 -0
- package/build/cjs/utils/types/general.js +2 -0
- package/build/cjs/utils/types/utility.js +2 -0
- package/build/es/app/Application.js +210 -0
- package/build/es/app/events/PageLoad.js +47 -0
- package/build/es/app/events/Viewport.js +232 -0
- package/build/es/base/Callbacks.js +205 -0
- package/build/es/base/Component.js +32 -0
- package/build/es/base/Module.js +225 -0
- package/build/es/base/MutableProp.js +152 -0
- package/build/es/base/Plugin.js +31 -0
- package/build/es/components/animation-frame/AnimationFrame.js +145 -0
- package/build/es/components/canvas/Ctx2D.js +133 -0
- package/build/es/components/canvas/Ctx2DPrerender.js +37 -0
- package/build/es/components/cursor/CustomCursor.js +274 -0
- package/build/es/components/dragger/Dragger.js +175 -0
- package/build/es/components/dragger/DraggerDirection.js +42 -0
- package/build/es/components/dragger/DraggerMove.js +56 -0
- package/build/es/components/loading/Preloader.js +164 -0
- package/build/es/components/loading/ProgressPreloader.js +304 -0
- package/build/es/components/page/Page.js +283 -0
- package/build/es/components/scroll/custom-scroll/CustomScroll.js +486 -0
- package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +140 -0
- package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +109 -0
- package/build/es/components/scroll/scrollable/ScrollEventsBase.js +79 -0
- package/build/es/components/scroll/scrollable/ScrollView.js +264 -0
- package/build/es/components/scroll/scrollbar/Bar.js +262 -0
- package/build/es/components/scroll/scrollbar/ScrollBar.js +152 -0
- package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +519 -0
- package/build/es/components/scroll/types.js +1 -0
- package/build/es/components/split-text/SplitText.js +199 -0
- package/build/es/components/text/SplitText.js +270 -0
- package/build/es/components/timeline/StaticTimeline.js +92 -0
- package/build/es/components/timeline/Timeline.js +141 -0
- package/build/es/index.js +37 -0
- package/build/es/utils/common/index.js +4 -0
- package/build/es/utils/common/mergeWithoutArrays.js +13 -0
- package/build/es/utils/common/randID.js +7 -0
- package/build/es/utils/common/timeoutCallback.js +14 -0
- package/build/es/utils/errors.js +5 -0
- package/build/es/utils/listeners/index.js +3 -0
- package/build/es/utils/listeners/intersectionObserverSupported.js +8 -0
- package/build/es/utils/listeners/onScroll.js +44 -0
- package/build/es/utils/math/boundVal.js +12 -0
- package/build/es/utils/math/index.js +4 -0
- package/build/es/utils/math/lerp.js +11 -0
- package/build/es/utils/math/scopeProgress.js +22 -0
- package/build/es/utils/types/general.js +1 -0
- package/build/es/utils/types/utility.js +1 -0
- package/build/types/app/Application.d.ts +161 -0
- package/build/types/app/Application.d.ts.map +1 -0
- package/build/types/app/events/PageLoad.d.ts +28 -0
- package/build/types/app/events/PageLoad.d.ts.map +1 -0
- package/build/types/app/events/Viewport.d.ts +137 -0
- package/build/types/app/events/Viewport.d.ts.map +1 -0
- package/build/types/base/Callbacks.d.ts +174 -0
- package/build/types/base/Callbacks.d.ts.map +1 -0
- package/build/types/base/Component.d.ts +48 -0
- package/build/types/base/Component.d.ts.map +1 -0
- package/build/types/base/Module.d.ts +179 -0
- package/build/types/base/Module.d.ts.map +1 -0
- package/build/types/base/MutableProp.d.ts +142 -0
- package/build/types/base/MutableProp.d.ts.map +1 -0
- package/build/types/base/Plugin.d.ts +35 -0
- package/build/types/base/Plugin.d.ts.map +1 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts +96 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2D.d.ts +111 -0
- package/build/types/components/canvas/Ctx2D.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts +41 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -0
- package/build/types/components/cursor/CustomCursor.d.ts +181 -0
- package/build/types/components/cursor/CustomCursor.d.ts.map +1 -0
- package/build/types/components/dragger/Dragger.d.ts +120 -0
- package/build/types/components/dragger/Dragger.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerDirection.d.ts +39 -0
- package/build/types/components/dragger/DraggerDirection.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerMove.d.ts +49 -0
- package/build/types/components/dragger/DraggerMove.d.ts.map +1 -0
- package/build/types/components/loading/Preloader.d.ts +107 -0
- package/build/types/components/loading/Preloader.d.ts.map +1 -0
- package/build/types/components/loading/ProgressPreloader.d.ts +166 -0
- package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -0
- package/build/types/components/page/Page.d.ts +126 -0
- package/build/types/components/page/Page.d.ts.map +1 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +322 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +97 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts +34 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts +60 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts +140 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts +84 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +109 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +307 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -0
- package/build/types/components/scroll/types.d.ts +11 -0
- package/build/types/components/scroll/types.d.ts.map +1 -0
- package/build/types/components/split-text/SplitText.d.ts +118 -0
- package/build/types/components/split-text/SplitText.d.ts.map +1 -0
- package/build/types/components/text/SplitText.d.ts +118 -0
- package/build/types/components/text/SplitText.d.ts.map +1 -0
- package/build/types/components/timeline/StaticTimeline.d.ts +92 -0
- package/build/types/components/timeline/StaticTimeline.d.ts.map +1 -0
- package/build/types/components/timeline/Timeline.d.ts +101 -0
- package/build/types/components/timeline/Timeline.d.ts.map +1 -0
- package/build/types/index.d.ts +38 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/utils/common/index.d.ts +5 -0
- package/build/types/utils/common/index.d.ts.map +1 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts +6 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts.map +1 -0
- package/build/types/utils/common/randID.d.ts +5 -0
- package/build/types/utils/common/randID.d.ts.map +1 -0
- package/build/types/utils/common/timeoutCallback.d.ts +6 -0
- package/build/types/utils/common/timeoutCallback.d.ts.map +1 -0
- package/build/types/utils/errors.d.ts +3 -0
- package/build/types/utils/errors.d.ts.map +1 -0
- package/build/types/utils/listeners/index.d.ts +4 -0
- package/build/types/utils/listeners/index.d.ts.map +1 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts +2 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts.map +1 -0
- package/build/types/utils/listeners/onScroll.d.ts +10 -0
- package/build/types/utils/listeners/onScroll.d.ts.map +1 -0
- package/build/types/utils/math/boundVal.d.ts +5 -0
- package/build/types/utils/math/boundVal.d.ts.map +1 -0
- package/build/types/utils/math/index.d.ts +5 -0
- package/build/types/utils/math/index.d.ts.map +1 -0
- package/build/types/utils/math/lerp.d.ts +5 -0
- package/build/types/utils/math/lerp.d.ts.map +1 -0
- package/build/types/utils/math/scopeProgress.d.ts +20 -0
- package/build/types/utils/math/scopeProgress.d.ts.map +1 -0
- package/build/types/utils/types/general.d.ts +7 -0
- package/build/types/utils/types/general.d.ts.map +1 -0
- package/build/types/utils/types/utility.d.ts +14 -0
- package/build/types/utils/types/utility.d.ts.map +1 -0
- package/package.json +88 -82
- package/src/cdn/index.js +3 -0
- package/src/sass/base.scss +3 -0
- package/src/sass/components/cursor/_custom-cursor.scss +63 -0
- package/src/sass/components/index.scss +6 -0
- package/src/sass/components/loading/_preloader.scss +15 -0
- package/src/sass/components/scroll/_scrollbar.scss +73 -0
- package/src/sass/components/scroll/_smooth-scroll.scss +17 -0
- package/src/sass/index.scss +3 -0
- package/src/sass/mixins/_scroll.scss +7 -0
- package/{dist/scss → src/sass}/mixins/_transition.scss +8 -4
- package/src/sass/mixins/_viewport.scss +69 -0
- package/src/sass/mixins/index.scss +3 -0
- package/src/ts/app/Application.ts +350 -0
- package/src/ts/app/events/PageLoad.ts +79 -0
- package/src/ts/app/events/Viewport.ts +365 -0
- package/src/ts/base/Callbacks.ts +380 -0
- package/src/ts/base/Component.ts +83 -0
- package/src/ts/base/Module.ts +385 -0
- package/src/ts/base/MutableProp.ts +242 -0
- package/src/ts/base/Plugin.ts +76 -0
- package/src/ts/components/animation-frame/AnimationFrame.ts +264 -0
- package/src/ts/components/canvas/Ctx2D.ts +260 -0
- package/src/ts/components/canvas/Ctx2DPrerender.ts +96 -0
- package/src/ts/components/cursor/CustomCursor.ts +462 -0
- package/src/ts/components/dragger/Dragger.ts +313 -0
- package/src/ts/components/dragger/DraggerDirection.ts +106 -0
- package/src/ts/components/dragger/DraggerMove.ts +114 -0
- package/src/ts/components/loading/Preloader.ts +279 -0
- package/src/ts/components/loading/ProgressPreloader.ts +484 -0
- package/src/ts/components/page/Page.ts +421 -0
- package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +251 -0
- package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +166 -0
- package/src/ts/components/scroll/scrollable/ScrollEventsBase.ts +151 -0
- package/src/ts/components/scroll/scrollable/ScrollView.ts +435 -0
- package/src/ts/components/scroll/scrollbar/Bar.ts +364 -0
- package/src/ts/components/scroll/scrollbar/ScrollBar.ts +292 -0
- package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +861 -0
- package/src/ts/components/scroll/types.ts +10 -0
- package/src/ts/components/text/SplitText.ts +418 -0
- package/src/ts/components/timeline/StaticTimeline.ts +197 -0
- package/src/ts/components/timeline/Timeline.ts +256 -0
- package/src/ts/index.ts +94 -0
- package/src/ts/utils/common/index.ts +9 -0
- package/src/ts/utils/common/mergeWithoutArrays.ts +20 -0
- package/src/ts/utils/common/randID.ts +9 -0
- package/src/ts/utils/common/timeoutCallback.ts +16 -0
- package/src/ts/utils/errors.ts +6 -0
- package/src/ts/utils/listeners/index.ts +7 -0
- package/src/ts/utils/listeners/intersectionObserverSupported.ts +10 -0
- package/src/ts/utils/listeners/onScroll.ts +56 -0
- package/src/ts/utils/math/boundVal.ts +15 -0
- package/src/ts/utils/math/index.ts +9 -0
- package/src/ts/utils/math/lerp.ts +16 -0
- package/src/ts/utils/math/scopeProgress.ts +23 -0
- package/src/ts/utils/types/general.ts +7 -0
- package/src/ts/utils/types/utility.ts +34 -0
- package/dist/js/AJAXEvent.js +0 -355
- package/dist/js/Application.js +0 -345
- package/dist/js/ColumnsModule.js +0 -392
- package/dist/js/CursorModule.js +0 -390
- package/dist/js/DraggerModule.js +0 -792
- package/dist/js/Event.js +0 -538
- package/dist/js/FilterModule.js +0 -943
- package/dist/js/FormModule.js +0 -706
- package/dist/js/FrameModule.js +0 -229
- package/dist/js/IntervalModule.js +0 -270
- package/dist/js/KeydownModule.js +0 -293
- package/dist/js/LoadEvent.js +0 -106
- package/dist/js/MenuBaseModule.js +0 -292
- package/dist/js/MenuModule.js +0 -265
- package/dist/js/MenuTimelineModule.js +0 -321
- package/dist/js/Module.js +0 -478
- package/dist/js/PageAjaxModule.js +0 -1010
- package/dist/js/PageLoadMediaPlugin.js +0 -285
- package/dist/js/PageModule.js +0 -440
- package/dist/js/PaginationModule.js +0 -961
- package/dist/js/PaginationScrollPlugin.js +0 -209
- package/dist/js/Plugin.js +0 -114
- package/dist/js/PopupModule.js +0 -942
- package/dist/js/PreloaderModule.js +0 -724
- package/dist/js/ResponsiveProp.js +0 -301
- package/dist/js/ScrollAnchorModule.js +0 -554
- package/dist/js/ScrollAnimateModule.js +0 -419
- package/dist/js/ScrollBarPlugin.js +0 -594
- package/dist/js/ScrollDragPlugin.js +0 -396
- package/dist/js/ScrollModule.js +0 -1071
- package/dist/js/ScrollViewModule.js +0 -388
- package/dist/js/SelectModule.js +0 -860
- package/dist/js/SliderCanvasModule.js +0 -733
- package/dist/js/SliderControlsPlugin.js +0 -247
- package/dist/js/SliderCounterPlugin.js +0 -278
- package/dist/js/SliderDotsPlugin.js +0 -270
- package/dist/js/SliderDragSwipePlugin.js +0 -245
- package/dist/js/SliderIntervalPlugin.js +0 -192
- package/dist/js/SliderKeydownPlugin.js +0 -185
- package/dist/js/SliderModule.js +0 -1062
- package/dist/js/SliderWheelPlugin.js +0 -194
- package/dist/js/TextAnimateModule.js +0 -663
- package/dist/js/TextSplitModule.js +0 -785
- package/dist/js/TimelineBaseModule.js +0 -405
- package/dist/js/TimelineModule.js +0 -494
- package/dist/js/URLEvent.js +0 -239
- package/dist/js/ViewportEvent.js +0 -465
- package/dist/js/WheelEventModule.js +0 -295
- package/dist/js/domChildOf.js +0 -46
- package/dist/js/domChildren.js +0 -47
- package/dist/js/domInsertAfter.js +0 -32
- package/dist/js/domRemoveChildren.js +0 -26
- package/dist/js/easing.js +0 -363
- package/dist/js/eventListenerAdd.js +0 -87
- package/dist/js/eventListenerGet.js +0 -49
- package/dist/js/eventListenerRemove.js +0 -36
- package/dist/js/generateId.js +0 -29
- package/dist/js/getBrowserName.js +0 -60
- package/dist/js/getOsName.js +0 -39
- package/dist/js/getVevetProperties.js +0 -22
- package/dist/js/index.js +0 -519
- package/dist/js/mathScopeProgress.js +0 -32
- package/dist/js/mathSpreadScopeProgress.js +0 -35
- package/dist/js/merge.js +0 -33
- package/dist/js/normalizeWheel.js +0 -97
- package/dist/js/text_animate_module_addons/_composite_elementary.js +0 -196
- package/dist/js/text_animate_module_addons/_elementary.js +0 -88
- package/dist/js/timeoutCallback.js +0 -26
- package/dist/js/vevet.js +0 -10
- package/dist/scss/_prefix.scss +0 -1
- package/dist/scss/classes/_clear.scss +0 -5
- package/dist/scss/classes/_col-row.scss +0 -48
- package/dist/scss/classes/_display.scss +0 -65
- package/dist/scss/classes/_document-reset.scss +0 -28
- package/dist/scss/classes/_document.scss +0 -7
- package/dist/scss/classes/_overflow.scss +0 -39
- package/dist/scss/classes/_position.scss +0 -55
- package/dist/scss/classes/_text.scss +0 -24
- package/dist/scss/classes/_transition.scss +0 -22
- package/dist/scss/classes/_wrap.scss +0 -31
- package/dist/scss/classes/index.scss +0 -14
- package/dist/scss/index.scss +0 -3
- package/dist/scss/mixins/_clear.scss +0 -6
- package/dist/scss/mixins/_display.scss +0 -6
- package/dist/scss/mixins/_form.scss +0 -14
- package/dist/scss/mixins/_position.scss +0 -42
- package/dist/scss/mixins/_reset.scss +0 -17
- package/dist/scss/mixins/_responsive.scss +0 -88
- package/dist/scss/mixins/index.scss +0 -7
- package/dist/scss/modules/columns/_settings.scss +0 -1
- package/dist/scss/modules/columns/index.scss +0 -19
- package/dist/scss/modules/cursor/_settings.scss +0 -7
- package/dist/scss/modules/cursor/index.scss +0 -15
- package/dist/scss/modules/form/_settings.scss +0 -15
- package/dist/scss/modules/form/index.scss +0 -57
- package/dist/scss/modules/index.scss +0 -11
- package/dist/scss/modules/menu/_button.scss +0 -58
- package/dist/scss/modules/menu/_menu.scss +0 -25
- package/dist/scss/modules/menu/_settings.scss +0 -23
- package/dist/scss/modules/menu/index.scss +0 -3
- package/dist/scss/modules/pagination/_settings.scss +0 -6
- package/dist/scss/modules/pagination/index.scss +0 -24
- package/dist/scss/modules/popup/_settings.scss +0 -26
- package/dist/scss/modules/popup/index.scss +0 -294
- package/dist/scss/modules/preloader/_settings.scss +0 -3
- package/dist/scss/modules/preloader/index.scss +0 -19
- package/dist/scss/modules/scroll/_settings.scss +0 -22
- package/dist/scss/modules/scroll/index.scss +0 -94
- package/dist/scss/modules/select/_settings.scss +0 -28
- package/dist/scss/modules/select/index.scss +0 -142
- package/dist/scss/modules/slider/_settings.scss +0 -35
- package/dist/scss/modules/slider/index.scss +0 -153
- package/dist/scss/modules/text/_settings.scss +0 -1
- package/dist/scss/modules/text/index.scss +0 -19
- package/dist/types/types.d.ts +0 -18763
|
@@ -1,961 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _Module2 = _interopRequireDefault(require("./Module"));
|
|
11
|
-
|
|
12
|
-
var _merge = _interopRequireDefault(require("./merge"));
|
|
13
|
-
|
|
14
|
-
var _domInsertAfter = _interopRequireDefault(require("./domInsertAfter"));
|
|
15
|
-
|
|
16
|
-
var _domRemoveChildren = _interopRequireDefault(require("./domRemoveChildren"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
|
|
22
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
|
-
|
|
24
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
25
|
-
|
|
26
|
-
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
|
27
|
-
|
|
28
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
29
|
-
|
|
30
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
|
-
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
34
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
|
-
|
|
36
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
|
-
|
|
38
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
-
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
var dom = require('dom-create-element');
|
|
45
|
-
|
|
46
|
-
var selectEl = require('select-el');
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @classdesc Ajax Pagination. <br>
|
|
50
|
-
* Available targets:
|
|
51
|
-
* <ul>
|
|
52
|
-
* <li>load - {@linkcode Vevet.PaginationModule.Load} is an argument.</li>
|
|
53
|
-
* <li>last - {@linkcode Vevet.PaginationModule.Last} is an argument.</li>
|
|
54
|
-
* <li>paginationClick - {@linkcode Vevet.PaginationModule.Click} is an argument.</li>
|
|
55
|
-
* </ul>
|
|
56
|
-
* <br><br> <b>import {PaginationModule} from 'vevet';</b>
|
|
57
|
-
*
|
|
58
|
-
* @vevetModuleCallback { Vevet.PaginationModule : load : Vevet.PaginationModule.Load}
|
|
59
|
-
* @vevetModuleCallback { Vevet.PaginationModule : last : Vevet.PaginationModule.Last}
|
|
60
|
-
* @vevetModuleCallback { Vevet.PaginationModule : paginationClick : Vevet.PaginationModule.Click}
|
|
61
|
-
*
|
|
62
|
-
* @class
|
|
63
|
-
* @memberof Vevet
|
|
64
|
-
* @augments Vevet.Module
|
|
65
|
-
*/
|
|
66
|
-
var PaginationModule = /*#__PURE__*/function (_Module) {
|
|
67
|
-
_inherits(PaginationModule, _Module);
|
|
68
|
-
|
|
69
|
-
var _super = _createSuper(PaginationModule);
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @memberof Vevet.PaginationModule
|
|
73
|
-
* @typedef {object} Properties
|
|
74
|
-
* @augments Vevet.Module.Properties
|
|
75
|
-
*
|
|
76
|
-
* @property {string|HTMLElement} [selector=vevet-pagination] - *** Selector of the outer element.
|
|
77
|
-
* The element under the selector must contain the following attributes:
|
|
78
|
-
* <ul>
|
|
79
|
-
* <li>data-vevet-pagination-active - active, current page</li>
|
|
80
|
-
* <li>data-vevet-pagination-max - total amount of pages</li>
|
|
81
|
-
* <li>data-vevet-pagination-url - url for pagination</li>
|
|
82
|
-
* </ul>
|
|
83
|
-
* @property {string} [param=page] - URL parameter that changes when a new page is loaded.
|
|
84
|
-
*
|
|
85
|
-
* @property {object} [update]
|
|
86
|
-
* @property {boolean} [update.url=true] - Update the url address when a new page is loaded.
|
|
87
|
-
* @property {boolean} [update.title=true] - Update the title of the page when a new page is loaded.
|
|
88
|
-
* @property {boolean} [update.content=true] - Update content when a new page is loaded.
|
|
89
|
-
*
|
|
90
|
-
* @property {object} [pagination]
|
|
91
|
-
* @property {boolean} [pagination.on=true] - Enable pagination.
|
|
92
|
-
* @property {number} [pagination.left=3] - How many links are shown on the left from the active one.
|
|
93
|
-
* @property {number} [pagination.right=3] - How many links are shown on the left from the active one.
|
|
94
|
-
* @property {boolean} [pagination.updateContent=true] - If true, after a click the content will be automatically changed. If false - new content will be added.
|
|
95
|
-
* @property {number} [pagination.timeout=0] - How much time to wait before {@linkcode Vevet.PaginationModule#load} will be called.
|
|
96
|
-
*
|
|
97
|
-
* @property {object} [popstate]
|
|
98
|
-
* @property {boolean} [popstate.event=true] - Catch popstate event and load content of the current url.
|
|
99
|
-
* @property {boolean} [popstate.reload=false] - Reload on popstate.
|
|
100
|
-
*
|
|
101
|
-
* @property {object} [ajax] - Ajax settings.
|
|
102
|
-
* @property {boolean} [ajax.cache=false] - Store data in cache.
|
|
103
|
-
* @property {string} [ajax.method=post] - post or get.
|
|
104
|
-
*
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @alias Vevet.PaginationModule
|
|
109
|
-
*
|
|
110
|
-
* @param {Vevet.PaginationModule.Properties} [data]
|
|
111
|
-
*/
|
|
112
|
-
function PaginationModule(data) {
|
|
113
|
-
_classCallCheck(this, PaginationModule);
|
|
114
|
-
|
|
115
|
-
return _super.call(this, data);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_createClass(PaginationModule, [{
|
|
119
|
-
key: "prefix",
|
|
120
|
-
get: function get() {
|
|
121
|
-
return "".concat(this._v.prefix, "pagination");
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @readonly
|
|
125
|
-
* @type {Vevet.PaginationModule.Properties}
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
}, {
|
|
129
|
-
key: "defaultProp",
|
|
130
|
-
get: function get() {
|
|
131
|
-
return (0, _merge.default)(_get(_getPrototypeOf(PaginationModule.prototype), "defaultProp", this), {
|
|
132
|
-
selector: ".".concat(this._prefix),
|
|
133
|
-
param: "page",
|
|
134
|
-
update: {
|
|
135
|
-
url: true,
|
|
136
|
-
title: true,
|
|
137
|
-
content: true
|
|
138
|
-
},
|
|
139
|
-
pagination: {
|
|
140
|
-
on: true,
|
|
141
|
-
left: 3,
|
|
142
|
-
right: 3,
|
|
143
|
-
updateContent: true,
|
|
144
|
-
timeout: 0
|
|
145
|
-
},
|
|
146
|
-
popstate: {
|
|
147
|
-
event: true,
|
|
148
|
-
reload: false
|
|
149
|
-
},
|
|
150
|
-
ajax: {
|
|
151
|
-
cache: false,
|
|
152
|
-
method: 'post'
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* @member Vevet.PaginationModule#prop
|
|
158
|
-
* @memberof Vevet.PaginationModule
|
|
159
|
-
* @readonly
|
|
160
|
-
* @type {Vevet.PaginationModule.Properties}
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @member Vevet.PaginationModule#_prop
|
|
165
|
-
* @memberof Vevet.PaginationModule
|
|
166
|
-
* @protected
|
|
167
|
-
* @type {Vevet.PaginationModule.Properties}
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @function Vevet.PaginationModule#changeProp
|
|
172
|
-
* @memberof Vevet.PaginationModule
|
|
173
|
-
* @param {Vevet.PaginationModule.Properties} [prop]
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* @memberof Vevet.PaginationModule
|
|
178
|
-
* @typedef {object} Load
|
|
179
|
-
* @property {boolean} pagination - If the action was carried out thru a pagination click.
|
|
180
|
-
* @property {boolean} reload - If the action was carried out thru {@linkcode Vevet.PaginationModule#reload}.
|
|
181
|
-
* @property {HTMLElement} outer - Elements' outer.
|
|
182
|
-
* @property {string} fullHTML - The new page's html.
|
|
183
|
-
* @property {string} html - The innerHTML of the outer.
|
|
184
|
-
*/
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* @memberof Vevet.PaginationModule
|
|
188
|
-
* @typedef {object} Last
|
|
189
|
-
* @property {HTMLElement} outer - Elements' outer.
|
|
190
|
-
* @property {string} fullHTML - The new page's html.
|
|
191
|
-
* @property {string} html - The innerHTML of the outer.
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* @memberof Vevet.PaginationModule
|
|
196
|
-
* @typedef {object} Click
|
|
197
|
-
* @property {number} num - Order number of the anchor.
|
|
198
|
-
* @property {HTMLElement} anchor - Anchor.
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @description Get active page.
|
|
203
|
-
* @readonly
|
|
204
|
-
* @type {number}
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
}, {
|
|
208
|
-
key: "active",
|
|
209
|
-
get: function get() {
|
|
210
|
-
return this._active;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* @description Last page.
|
|
214
|
-
* @readonly
|
|
215
|
-
* @type {number}
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
}, {
|
|
219
|
-
key: "max",
|
|
220
|
-
get: function get() {
|
|
221
|
-
return this._max;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @description If content is loading.
|
|
225
|
-
* @readonly
|
|
226
|
-
* @type {boolean}
|
|
227
|
-
*/
|
|
228
|
-
|
|
229
|
-
}, {
|
|
230
|
-
key: "loading",
|
|
231
|
-
get: function get() {
|
|
232
|
-
return this._loading;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* @description Outer element.
|
|
236
|
-
* @readonly
|
|
237
|
-
* @type {HTMLElement}
|
|
238
|
-
*/
|
|
239
|
-
|
|
240
|
-
}, {
|
|
241
|
-
key: "outer",
|
|
242
|
-
get: function get() {
|
|
243
|
-
return this._outer;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* @description Pagination UL element.
|
|
247
|
-
* @readonly
|
|
248
|
-
* @type {HTMLUListElement}
|
|
249
|
-
*/
|
|
250
|
-
|
|
251
|
-
}, {
|
|
252
|
-
key: "pagination",
|
|
253
|
-
get: function get() {
|
|
254
|
-
return this._pagination;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* @description Current URL.
|
|
258
|
-
* @readonly
|
|
259
|
-
* @type {string}
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
|
-
}, {
|
|
263
|
-
key: "url",
|
|
264
|
-
get: function get() {
|
|
265
|
-
return this._url;
|
|
266
|
-
},
|
|
267
|
-
set: function set(value) {
|
|
268
|
-
this._url = value;
|
|
269
|
-
} // Extra constructor
|
|
270
|
-
|
|
271
|
-
}, {
|
|
272
|
-
key: "_extra",
|
|
273
|
-
value: function _extra() {
|
|
274
|
-
_get(_getPrototypeOf(PaginationModule.prototype), "_extra", this).call(this);
|
|
275
|
-
|
|
276
|
-
var prefix = this._prefix;
|
|
277
|
-
/**
|
|
278
|
-
* @description Available data attributes.
|
|
279
|
-
* @member {object}
|
|
280
|
-
* @protected
|
|
281
|
-
*/
|
|
282
|
-
|
|
283
|
-
this._data = {
|
|
284
|
-
active: "data-".concat(prefix, "-active"),
|
|
285
|
-
max: "data-".concat(prefix, "-max"),
|
|
286
|
-
url: "data-".concat(prefix, "-url")
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* @description Active page number.
|
|
290
|
-
* @protected
|
|
291
|
-
* @member {number}
|
|
292
|
-
*/
|
|
293
|
-
|
|
294
|
-
this._active = 1;
|
|
295
|
-
/**
|
|
296
|
-
* @description Maximum number of pages.
|
|
297
|
-
* @protected
|
|
298
|
-
* @member {number}
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
|
-
this._max = 1;
|
|
302
|
-
/**
|
|
303
|
-
* @description If content is loading.
|
|
304
|
-
* @protected
|
|
305
|
-
* @member {boolean}
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
|
-
this._loading = false;
|
|
309
|
-
/**
|
|
310
|
-
* @description Pagination UL element.
|
|
311
|
-
* @protected
|
|
312
|
-
* @member {HTMLUListElement}
|
|
313
|
-
*/
|
|
314
|
-
|
|
315
|
-
this._pagination = null; // get elements
|
|
316
|
-
|
|
317
|
-
this._elementsGet();
|
|
318
|
-
/**
|
|
319
|
-
* @description Current URL.
|
|
320
|
-
* @protected
|
|
321
|
-
* @member {string}
|
|
322
|
-
*/
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
this._url; // get url
|
|
326
|
-
|
|
327
|
-
var urlAttribute = this._outer.getAttribute(this._data.url);
|
|
328
|
-
|
|
329
|
-
if (urlAttribute != null) {
|
|
330
|
-
this._url = urlAttribute;
|
|
331
|
-
} else {
|
|
332
|
-
this._url = window.location.href;
|
|
333
|
-
} // actions
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
this._range(this._outer);
|
|
337
|
-
|
|
338
|
-
this._paginationCreate();
|
|
339
|
-
|
|
340
|
-
this._paginationLinks();
|
|
341
|
-
|
|
342
|
-
this._paginationActive();
|
|
343
|
-
|
|
344
|
-
this._paginationVisibility();
|
|
345
|
-
} // When properties are changed
|
|
346
|
-
|
|
347
|
-
}, {
|
|
348
|
-
key: "_changeProp",
|
|
349
|
-
value: function _changeProp(prop) {
|
|
350
|
-
_get(_getPrototypeOf(PaginationModule.prototype), "_changeProp", this).call(this, prop);
|
|
351
|
-
|
|
352
|
-
this._paginationVisibility();
|
|
353
|
-
|
|
354
|
-
this._paginationLinks();
|
|
355
|
-
|
|
356
|
-
this._paginationActive();
|
|
357
|
-
} // Set events
|
|
358
|
-
|
|
359
|
-
}, {
|
|
360
|
-
key: "_setEvents",
|
|
361
|
-
value: function _setEvents() {
|
|
362
|
-
// popstate event
|
|
363
|
-
this.listener(window, "popstate", this._popstate.bind(this));
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* @description Get elements
|
|
367
|
-
* @protected
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
}, {
|
|
371
|
-
key: "_elementsGet",
|
|
372
|
-
value: function _elementsGet() {
|
|
373
|
-
this._outer = selectEl.one(this._prop.selector);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* @description Popstate events.
|
|
377
|
-
* @protected
|
|
378
|
-
*/
|
|
379
|
-
|
|
380
|
-
}, {
|
|
381
|
-
key: "_popstate",
|
|
382
|
-
value: function _popstate() {
|
|
383
|
-
var popstate = this._prop.popstate;
|
|
384
|
-
|
|
385
|
-
if (!popstate.event) {
|
|
386
|
-
if (popstate.reload) {
|
|
387
|
-
window.location.reload();
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
this._popstateCatch();
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* @description Catch popstate and load a new page.
|
|
397
|
-
* @protected
|
|
398
|
-
*/
|
|
399
|
-
|
|
400
|
-
}, {
|
|
401
|
-
key: "_popstateCatch",
|
|
402
|
-
value: function _popstateCatch() {
|
|
403
|
-
// get active page according to the url
|
|
404
|
-
var active = this._v.url.getParam({
|
|
405
|
-
key: this._prop.param
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
if (active != null) {
|
|
409
|
-
active = parseInt(active);
|
|
410
|
-
} else {
|
|
411
|
-
active = 1;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
this.load({
|
|
415
|
-
num: active,
|
|
416
|
-
pushState: false,
|
|
417
|
-
reload: true
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* @description Variables range: first and last page.
|
|
422
|
-
* @param {HTMLElement} outer - Outer element.
|
|
423
|
-
* @param {boolean} updateActive - If we need to update the active value.
|
|
424
|
-
* @protected
|
|
425
|
-
*/
|
|
426
|
-
|
|
427
|
-
}, {
|
|
428
|
-
key: "_range",
|
|
429
|
-
value: function _range(outer) {
|
|
430
|
-
var updateActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
431
|
-
|
|
432
|
-
// check if outer exists
|
|
433
|
-
if (!outer) {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
var data = this._data; // get active
|
|
438
|
-
|
|
439
|
-
if (updateActive) {
|
|
440
|
-
this._active = this._rangeInt(outer, data.active);
|
|
441
|
-
} // get max
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
this._max = this._rangeInt(outer, data.max);
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* @description Get range number.
|
|
448
|
-
* @protected
|
|
449
|
-
* @param {HTMLElement} outer
|
|
450
|
-
* @param {string} data
|
|
451
|
-
*/
|
|
452
|
-
|
|
453
|
-
}, {
|
|
454
|
-
key: "_rangeInt",
|
|
455
|
-
value: function _rangeInt(outer, data) {
|
|
456
|
-
var num = outer.getAttribute(data);
|
|
457
|
-
num = parseInt(num);
|
|
458
|
-
|
|
459
|
-
if (!Number.isInteger(num)) {
|
|
460
|
-
num = 1;
|
|
461
|
-
} else {
|
|
462
|
-
if (num < 1) {
|
|
463
|
-
num = 1;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
return num;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* @description Pagination links
|
|
471
|
-
* @protected
|
|
472
|
-
*/
|
|
473
|
-
|
|
474
|
-
}, {
|
|
475
|
-
key: "_paginationCreate",
|
|
476
|
-
value: function _paginationCreate() {
|
|
477
|
-
var el = dom({
|
|
478
|
-
selector: 'ul',
|
|
479
|
-
styles: "".concat(this._prefix, "__ul")
|
|
480
|
-
});
|
|
481
|
-
(0, _domInsertAfter.default)(el, this._outer);
|
|
482
|
-
this._pagination = el;
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* @description Create pagination links.
|
|
486
|
-
* @protected
|
|
487
|
-
*/
|
|
488
|
-
|
|
489
|
-
}, {
|
|
490
|
-
key: "_paginationLinks",
|
|
491
|
-
value: function _paginationLinks() {
|
|
492
|
-
// first of all, remove previous pagination links
|
|
493
|
-
(0, _domRemoveChildren.default)(this._pagination); // create or update pagination arrays
|
|
494
|
-
|
|
495
|
-
this._paginationLi = [];
|
|
496
|
-
this._paginationA = [];
|
|
497
|
-
this._paginationDots = []; // create elements
|
|
498
|
-
|
|
499
|
-
for (var i = 0; i < this._max; i++) {
|
|
500
|
-
// list
|
|
501
|
-
var li = dom({
|
|
502
|
-
selector: 'li',
|
|
503
|
-
styles: "".concat(this.prefix, "__li")
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
this._paginationLi.push(li);
|
|
507
|
-
|
|
508
|
-
this._pagination.appendChild(li); // anchor
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
var a = dom({
|
|
512
|
-
selector: 'a'
|
|
513
|
-
});
|
|
514
|
-
li.appendChild(a);
|
|
515
|
-
|
|
516
|
-
this._paginationA.push(a); // set anchor href
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
var href = this._v.url.setParam({
|
|
520
|
-
url: this._url,
|
|
521
|
-
key: this._prop.param,
|
|
522
|
-
value: i + 1,
|
|
523
|
-
push: false
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
a.href = href; // anchor text
|
|
527
|
-
|
|
528
|
-
var text = i + 1;
|
|
529
|
-
|
|
530
|
-
if (i < 9) {
|
|
531
|
-
text = '0' + text;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
a.innerHTML = "<span>".concat(text, "</span>");
|
|
535
|
-
} // show or hide pagination
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
this._paginationVisibility(); // show links
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
this._paginationShown();
|
|
542
|
-
|
|
543
|
-
this._paginationEvents();
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* @description Sho pagination.
|
|
547
|
-
* @protected
|
|
548
|
-
*/
|
|
549
|
-
|
|
550
|
-
}, {
|
|
551
|
-
key: "_paginationShown",
|
|
552
|
-
value: function _paginationShown() {
|
|
553
|
-
// get shown links
|
|
554
|
-
var shown = [0, this._max - 1]; // add shown links
|
|
555
|
-
|
|
556
|
-
for (var i = this._active - 1; i >= this._active - 1 - this._prop.pagination.left; i--) {
|
|
557
|
-
shown.push(i);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
for (var _i = this._active - 1; _i <= this._active - 1 + this._prop.pagination.left; _i++) {
|
|
561
|
-
shown.push(_i);
|
|
562
|
-
} // append dots
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
for (var _i2 = 0; _i2 < this._paginationLi.length; _i2++) {
|
|
566
|
-
var anchor = this._paginationA[_i2];
|
|
567
|
-
|
|
568
|
-
if (!shown.includes(_i2)) {
|
|
569
|
-
// set dot
|
|
570
|
-
var li = this._paginationLi[_i2];
|
|
571
|
-
li.classList.add("".concat(this.prefix, "__dot"));
|
|
572
|
-
|
|
573
|
-
this._paginationDots.push(li); // append dots
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
var span = dom({
|
|
577
|
-
selector: 'span'
|
|
578
|
-
});
|
|
579
|
-
span.innerHTML = '...';
|
|
580
|
-
li.appendChild(span); // hide anchor
|
|
581
|
-
|
|
582
|
-
anchor.classList.add("display-none");
|
|
583
|
-
} else {
|
|
584
|
-
this._paginationDots.push(null);
|
|
585
|
-
}
|
|
586
|
-
} // hide extra dots
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
for (var _i3 = 0, a = 0; _i3 < this._active; _i3++) {
|
|
590
|
-
var dot = this._paginationDots[_i3];
|
|
591
|
-
|
|
592
|
-
if (dot != null) {
|
|
593
|
-
if (a > 0) {
|
|
594
|
-
dot.classList.add("display-none");
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
a++;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
for (var _i4 = this._active - 1, _a = 0; _i4 < this._max - 1; _i4++) {
|
|
602
|
-
var _dot = this._paginationDots[_i4];
|
|
603
|
-
|
|
604
|
-
if (_dot != null) {
|
|
605
|
-
if (_a > 0) {
|
|
606
|
-
_dot.classList.add("display-none");
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
_a++;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* @description Set pagination events: clicks on links.
|
|
615
|
-
* @protected
|
|
616
|
-
*/
|
|
617
|
-
|
|
618
|
-
}, {
|
|
619
|
-
key: "_paginationEvents",
|
|
620
|
-
value: function _paginationEvents() {
|
|
621
|
-
var _this = this;
|
|
622
|
-
|
|
623
|
-
var i = 0;
|
|
624
|
-
|
|
625
|
-
this._paginationA.forEach(function (el) {
|
|
626
|
-
el.addEventListener("click", _this._paginationClick.bind(_this, el, i));
|
|
627
|
-
i++;
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* @description Pagination click.
|
|
632
|
-
* @protected
|
|
633
|
-
* @param {HTMLElement} el - Link.
|
|
634
|
-
* @param {number} num
|
|
635
|
-
* @param {object} e
|
|
636
|
-
*/
|
|
637
|
-
|
|
638
|
-
}, {
|
|
639
|
-
key: "_paginationClick",
|
|
640
|
-
value: function _paginationClick(el, num, e) {
|
|
641
|
-
var _this2 = this;
|
|
642
|
-
|
|
643
|
-
// prevent default event
|
|
644
|
-
e.preventDefault(); // prevent event for active links
|
|
645
|
-
|
|
646
|
-
if (el.parentElement.classList.contains("".concat(this.prefix, "__li_active"))) {
|
|
647
|
-
return;
|
|
648
|
-
} // get page number
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
num += 1; // launch vevet events
|
|
652
|
-
|
|
653
|
-
this.lbt("paginationClick", {
|
|
654
|
-
num: num,
|
|
655
|
-
anchor: el
|
|
656
|
-
}); // load content
|
|
657
|
-
|
|
658
|
-
setTimeout(function () {
|
|
659
|
-
_this2.load({
|
|
660
|
-
num: num,
|
|
661
|
-
pagination: true
|
|
662
|
-
});
|
|
663
|
-
}, this._prop.pagination.timeout);
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* @description Set active link in pagination
|
|
667
|
-
* @protected
|
|
668
|
-
* @param {number} [num]
|
|
669
|
-
*/
|
|
670
|
-
|
|
671
|
-
}, {
|
|
672
|
-
key: "_paginationActive",
|
|
673
|
-
value: function _paginationActive() {
|
|
674
|
-
var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.active;
|
|
675
|
-
var activeClass = "".concat(this.prefix, "__li_active");
|
|
676
|
-
num -= 1;
|
|
677
|
-
|
|
678
|
-
for (var i = 0; i < this._paginationLi.length; i++) {
|
|
679
|
-
var li = this._paginationLi[i];
|
|
680
|
-
|
|
681
|
-
if (i !== num) {
|
|
682
|
-
li.classList.remove(activeClass);
|
|
683
|
-
} else {
|
|
684
|
-
li.classList.add(activeClass);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* @description Pagination visibility: hide or show.
|
|
690
|
-
* @protected
|
|
691
|
-
*/
|
|
692
|
-
|
|
693
|
-
}, {
|
|
694
|
-
key: "_paginationVisibility",
|
|
695
|
-
value: function _paginationVisibility() {
|
|
696
|
-
var visible = true;
|
|
697
|
-
|
|
698
|
-
if (this._max === 1) {
|
|
699
|
-
visible = false;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
if (!this._prop.pagination.on) {
|
|
703
|
-
visible = false;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
var className = "display-none_important";
|
|
707
|
-
|
|
708
|
-
if (visible) {
|
|
709
|
-
this._pagination.classList.remove(className);
|
|
710
|
-
} else {
|
|
711
|
-
this._pagination.classList.add(className);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* @description Load a new page.
|
|
716
|
-
* @param {object} data - Settings.
|
|
717
|
-
* @param {number|boolean} [data.num=true] - The order number of the page, or true (next page), or false (previous page).
|
|
718
|
-
* @param {boolean} [data.pagination=false] - Defines if the action was called due a pagination click.
|
|
719
|
-
* @param {boolean} [data.reload=false] - If thru {@linkcode Vevet.PaginationModule#reload}.
|
|
720
|
-
* @param {boolean} [data.pushState=true] - Defines if you need to change the url.
|
|
721
|
-
* @returns {boolean} Returns true if the action can be carried out.
|
|
722
|
-
*/
|
|
723
|
-
|
|
724
|
-
}, {
|
|
725
|
-
key: "load",
|
|
726
|
-
value: function load(data) {
|
|
727
|
-
// data
|
|
728
|
-
data = Object.assign({
|
|
729
|
-
num: true,
|
|
730
|
-
pagination: false,
|
|
731
|
-
reload: false,
|
|
732
|
-
pushState: true
|
|
733
|
-
}, data); // get order number
|
|
734
|
-
|
|
735
|
-
if (typeof data.num == 'boolean') {
|
|
736
|
-
if (data.num) {
|
|
737
|
-
data.num = this._active + 1;
|
|
738
|
-
} else {
|
|
739
|
-
data.num = this._active - 1;
|
|
740
|
-
}
|
|
741
|
-
} // check if possible
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
if (!this._loadCheck(data.num)) {
|
|
745
|
-
return false;
|
|
746
|
-
} // change bool
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
this._loading = true; // update url if needed
|
|
750
|
-
|
|
751
|
-
this.url = this._v.url.setParam({
|
|
752
|
-
url: this._url,
|
|
753
|
-
key: this._prop.param,
|
|
754
|
-
value: data.num,
|
|
755
|
-
push: this._prop.update.url & data.pushState
|
|
756
|
-
}); // load the resource
|
|
757
|
-
|
|
758
|
-
this._loadAjax(data.reload, data.num, data.pagination); // return success
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return true;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* @description Check if loading is available.
|
|
765
|
-
* @param {number} num - The order number of the page to be loaded.
|
|
766
|
-
* @returns {boolean} Returns true if available.
|
|
767
|
-
* @protected
|
|
768
|
-
*/
|
|
769
|
-
|
|
770
|
-
}, {
|
|
771
|
-
key: "_loadCheck",
|
|
772
|
-
value: function _loadCheck() {
|
|
773
|
-
var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._active;
|
|
774
|
-
|
|
775
|
-
if (this._loading) {
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
if (num > this._max) {
|
|
780
|
-
return false;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
if (num > this._max) {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
return true;
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* @description Load a new page.
|
|
791
|
-
* @param {boolean} reload - If thru {@linkcode Vevet.PaginationModule#reload}.
|
|
792
|
-
* @param {number} num - The order number of the page to be loaded.
|
|
793
|
-
* @param {boolean} pagination - Defines if the action was called due a pagination click.
|
|
794
|
-
* @protected
|
|
795
|
-
*/
|
|
796
|
-
|
|
797
|
-
}, {
|
|
798
|
-
key: "_loadAjax",
|
|
799
|
-
value: function _loadAjax(reload, num, pagination) {
|
|
800
|
-
this._v.ajax.load({
|
|
801
|
-
url: this._url,
|
|
802
|
-
method: this._prop.ajax.method,
|
|
803
|
-
data: {
|
|
804
|
-
pagination: 1
|
|
805
|
-
},
|
|
806
|
-
cache: this._prop.ajax.cache,
|
|
807
|
-
success: this._loadSuccess.bind(this, reload, num, pagination),
|
|
808
|
-
abort: this._loadAjax.bind(this, reload, num, pagination),
|
|
809
|
-
error: this._loadError.bind(this)
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* @description If error while loading.
|
|
814
|
-
* @protected
|
|
815
|
-
*/
|
|
816
|
-
|
|
817
|
-
}, {
|
|
818
|
-
key: "_loadError",
|
|
819
|
-
value: function _loadError() {}
|
|
820
|
-
/**
|
|
821
|
-
* @description Success loading of the new page.
|
|
822
|
-
* @param {boolean} reload - If thru {@linkcode Vevet.PaginationModule#reload}.
|
|
823
|
-
* @param {number} num - The order number of the page to be loaded.
|
|
824
|
-
* @param {boolean} pagination - Defines if the action was called due a pagination click.
|
|
825
|
-
* @param {Vevet.AJAXEvent.CacheItem} data - Ajax response.
|
|
826
|
-
* @protected
|
|
827
|
-
*/
|
|
828
|
-
|
|
829
|
-
}, {
|
|
830
|
-
key: "_loadSuccess",
|
|
831
|
-
value: function _loadSuccess(reload, num, pagination, data) {
|
|
832
|
-
// create additional element
|
|
833
|
-
var e = dom({
|
|
834
|
-
selector: 'div'
|
|
835
|
-
});
|
|
836
|
-
e.innerHTML = data.xhr.response; // update title
|
|
837
|
-
|
|
838
|
-
if (this._prop.update.title) {
|
|
839
|
-
var el = {
|
|
840
|
-
current: document.querySelector("title"),
|
|
841
|
-
new: e.querySelector("title")
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
if (el.current != null & el.new != null) {
|
|
845
|
-
el.current.innerHTML = el.new.innerHTML;
|
|
846
|
-
}
|
|
847
|
-
} // outer
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
var outers = {
|
|
851
|
-
current: this._outer,
|
|
852
|
-
new: e.querySelector(this._prop.selector)
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
if (outers.new == null) {
|
|
856
|
-
return;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
e = null; // html
|
|
860
|
-
|
|
861
|
-
var html = outers.new.innerHTML; // update content
|
|
862
|
-
|
|
863
|
-
if (this._prop.update.content) {
|
|
864
|
-
if (!reload) {
|
|
865
|
-
if (pagination) {
|
|
866
|
-
if (this._prop.pagination.updateContent) {
|
|
867
|
-
(0, _domRemoveChildren.default)(outers.current);
|
|
868
|
-
outers.current.innerHTML = html;
|
|
869
|
-
} else {
|
|
870
|
-
while (outers.new.firstChild) {
|
|
871
|
-
outers.current.appendChild(outers.new.firstChild);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
} else {
|
|
875
|
-
while (outers.new.firstChild) {
|
|
876
|
-
outers.current.appendChild(outers.new.firstChild);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
} else {
|
|
880
|
-
(0, _domRemoveChildren.default)(outers.current);
|
|
881
|
-
outers.current.innerHTML = html;
|
|
882
|
-
}
|
|
883
|
-
} // get range
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
this._range(outers.new, false);
|
|
887
|
-
|
|
888
|
-
this._active = num; // callbacks
|
|
889
|
-
|
|
890
|
-
this.lbt("load", {
|
|
891
|
-
pagination: pagination,
|
|
892
|
-
reload: reload,
|
|
893
|
-
outer: this._outer,
|
|
894
|
-
fullHTML: data.xhr.response,
|
|
895
|
-
html: html
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
if (this.active >= this.max) {
|
|
899
|
-
this.lbt("last", {
|
|
900
|
-
outer: this._outer,
|
|
901
|
-
fullHTML: data.xhr.response,
|
|
902
|
-
html: html
|
|
903
|
-
});
|
|
904
|
-
} // update pagination
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
this._paginationLinks();
|
|
908
|
-
|
|
909
|
-
this._paginationActive(); // loading
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
this._loading = false;
|
|
913
|
-
}
|
|
914
|
-
/**
|
|
915
|
-
* @description Reload the content.
|
|
916
|
-
* @param {boolean} [pushState=true] - Defines if you need to change the url.
|
|
917
|
-
* @param {boolean} [changeActive=true] - Defines if you need to change the active page.
|
|
918
|
-
* @returns {boolean} Returns true if the action can be carried out.
|
|
919
|
-
*/
|
|
920
|
-
|
|
921
|
-
}, {
|
|
922
|
-
key: "reload",
|
|
923
|
-
value: function reload() {
|
|
924
|
-
var pushState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
925
|
-
var changeActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
926
|
-
|
|
927
|
-
// check if possible
|
|
928
|
-
if (!this._loadCheck()) {
|
|
929
|
-
return false;
|
|
930
|
-
} // change active value
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
if (changeActive) {
|
|
934
|
-
this._active = 1;
|
|
935
|
-
} // load
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
return this.load({
|
|
939
|
-
num: this._active,
|
|
940
|
-
reload: true,
|
|
941
|
-
pushState: pushState
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
/**
|
|
945
|
-
* @description Destroy the module.
|
|
946
|
-
*/
|
|
947
|
-
|
|
948
|
-
}, {
|
|
949
|
-
key: "destroy",
|
|
950
|
-
value: function destroy() {
|
|
951
|
-
_get(_getPrototypeOf(PaginationModule.prototype), "destroy", this).call(this); // remove pagination
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
this._pagination.remove();
|
|
955
|
-
}
|
|
956
|
-
}]);
|
|
957
|
-
|
|
958
|
-
return PaginationModule;
|
|
959
|
-
}(_Module2.default);
|
|
960
|
-
|
|
961
|
-
exports.default = PaginationModule;
|