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
package/dist/js/SelectModule.js
DELETED
|
@@ -1,860 +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 _domChildOf = _interopRequireDefault(require("./domChildOf"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
|
-
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); } }
|
|
21
|
-
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
23
|
-
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
27
|
-
|
|
28
|
-
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); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
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); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
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; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
var dom = require('dom-create-element');
|
|
43
|
-
|
|
44
|
-
var selectEl = require('select-el');
|
|
45
|
-
/**
|
|
46
|
-
* @classdesc A class for cretating a custom select element. <br>
|
|
47
|
-
* Available targets:
|
|
48
|
-
* <ul>
|
|
49
|
-
* <li>open</li>
|
|
50
|
-
* <li>opened</li>
|
|
51
|
-
* <li>close</li>
|
|
52
|
-
* <li>closed</li>
|
|
53
|
-
* <li>change</li>
|
|
54
|
-
* </ul>
|
|
55
|
-
* Each callback receives {@linkcode Vevet.SelectModule.Callback} as an argument.
|
|
56
|
-
* <br><br> <b>import {SelectModule} from 'vevet';</b>
|
|
57
|
-
*
|
|
58
|
-
* @vevetModuleCallback { Vevet.SelectModule : open : Vevet.SelectModule.Callback}
|
|
59
|
-
* @vevetModuleCallback { Vevet.SelectModule : opened : Vevet.SelectModule.Callback}
|
|
60
|
-
* @vevetModuleCallback { Vevet.SelectModule : close : Vevet.SelectModule.Callback}
|
|
61
|
-
* @vevetModuleCallback { Vevet.SelectModule : closed : Vevet.SelectModule.Callback}
|
|
62
|
-
* @vevetModuleCallback { Vevet.SelectModule : change : Vevet.SelectModule.Callback}
|
|
63
|
-
*
|
|
64
|
-
* @class
|
|
65
|
-
* @memberof Vevet
|
|
66
|
-
* @augments Vevet.Module
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var SelectModule = /*#__PURE__*/function (_Module) {
|
|
71
|
-
_inherits(SelectModule, _Module);
|
|
72
|
-
|
|
73
|
-
var _super = _createSuper(SelectModule);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @memberof Vevet.SelectModule
|
|
77
|
-
* @typedef {object} Properties
|
|
78
|
-
* @augments Vevet.Module.Properties
|
|
79
|
-
*
|
|
80
|
-
* @property {string|HTMLSelectElement} [selector=vevet-select] - *** Selector of a "select" element.
|
|
81
|
-
* @property {boolean} [showSelected=true] - Set true if you want to display the selected option in the selector.
|
|
82
|
-
* @property {boolean} [changePlaceholder=true] - Defines if you need to change the text in the head of the selector.
|
|
83
|
-
* @property {number} [duration=250] - Duration of animation when showing and hiding.
|
|
84
|
-
*
|
|
85
|
-
* @property {object} [search] - Search settings.
|
|
86
|
-
* @property {boolean} [search.on=false] - Enable search.
|
|
87
|
-
* @property {string} [search.placeholder=Type to search] - *** Placeholder of the search input.
|
|
88
|
-
*
|
|
89
|
-
* @property {object} [close] - When to close the selectbox.
|
|
90
|
-
* @property {boolean} [close.change=true] - Close on change.
|
|
91
|
-
* @property {boolean} [close.out=true] - Close on click on any element except for the selector.
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @alias Vevet.SelectModule
|
|
96
|
-
*
|
|
97
|
-
* @param {Vevet.SelectModule.Properties} [data]
|
|
98
|
-
*/
|
|
99
|
-
function SelectModule(data) {
|
|
100
|
-
_classCallCheck(this, SelectModule);
|
|
101
|
-
|
|
102
|
-
return _super.call(this, data);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
_createClass(SelectModule, [{
|
|
106
|
-
key: "prefix",
|
|
107
|
-
get: function get() {
|
|
108
|
-
return "".concat(this._v.prefix, "select");
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @readonly
|
|
112
|
-
* @type {Vevet.SelectModule.Properties}
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
}, {
|
|
116
|
-
key: "defaultProp",
|
|
117
|
-
get: function get() {
|
|
118
|
-
return (0, _merge.default)(_get(_getPrototypeOf(SelectModule.prototype), "defaultProp", this), {
|
|
119
|
-
selector: ".".concat(this._prefix),
|
|
120
|
-
showSelected: true,
|
|
121
|
-
changePlaceholder: true,
|
|
122
|
-
duration: 250,
|
|
123
|
-
search: {
|
|
124
|
-
on: false,
|
|
125
|
-
placeholder: 'Type to search'
|
|
126
|
-
},
|
|
127
|
-
close: {
|
|
128
|
-
change: true,
|
|
129
|
-
out: true
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @member Vevet.SelectModule#prop
|
|
135
|
-
* @memberof Vevet.SelectModule
|
|
136
|
-
* @readonly
|
|
137
|
-
* @type {Vevet.SelectModule.Properties}
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @member Vevet.SelectModule#_prop
|
|
142
|
-
* @memberof Vevet.SelectModule
|
|
143
|
-
* @protected
|
|
144
|
-
* @type {Vevet.SelectModule.Properties}
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @function Vevet.SelectModule#changeProp
|
|
149
|
-
* @memberof Vevet.SelectModule
|
|
150
|
-
* @param {Vevet.SelectModule.Properties} [prop]
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @description Select element.
|
|
155
|
-
* @readonly
|
|
156
|
-
* @type {HTMLSelectElement}
|
|
157
|
-
*/
|
|
158
|
-
|
|
159
|
-
}, {
|
|
160
|
-
key: "select",
|
|
161
|
-
get: function get() {
|
|
162
|
-
return this._select;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* @description Options.
|
|
166
|
-
* @readonly
|
|
167
|
-
* @type {Array<HTMLOptionElement>}
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
}, {
|
|
171
|
-
key: "options",
|
|
172
|
-
get: function get() {
|
|
173
|
-
return this._options;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* @description If the element is opened.
|
|
177
|
-
* @readonly
|
|
178
|
-
* @type {boolean}
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
}, {
|
|
182
|
-
key: "opened",
|
|
183
|
-
get: function get() {
|
|
184
|
-
return this._opened;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* @description If the select element is multiple.
|
|
188
|
-
* @readonly
|
|
189
|
-
* @type {boolean}
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
}, {
|
|
193
|
-
key: "multiple",
|
|
194
|
-
get: function get() {
|
|
195
|
-
return this._multiple;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @description If the animation is in process.
|
|
199
|
-
* @readonly
|
|
200
|
-
* @type {boolean}
|
|
201
|
-
*/
|
|
202
|
-
|
|
203
|
-
}, {
|
|
204
|
-
key: "animating",
|
|
205
|
-
get: function get() {
|
|
206
|
-
return this._animating;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* @description The order number/numbers (for multiple) of options or false if none are selected.
|
|
210
|
-
* @readonly
|
|
211
|
-
* @type {number|Array<number>|false}
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
}, {
|
|
215
|
-
key: "active",
|
|
216
|
-
get: function get() {
|
|
217
|
-
if (this._actives.length > 1) {
|
|
218
|
-
return this._actives;
|
|
219
|
-
} else {
|
|
220
|
-
if (this._actives.length > 0) {
|
|
221
|
-
return this._actives[0];
|
|
222
|
-
} else {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* @description Returns the value/values (for multiple) of the select or false if none are selected.
|
|
229
|
-
* @readonly
|
|
230
|
-
* @type {string|Array<string>|false}
|
|
231
|
-
*/
|
|
232
|
-
|
|
233
|
-
}, {
|
|
234
|
-
key: "value",
|
|
235
|
-
get: function get() {
|
|
236
|
-
var values = this._getValues();
|
|
237
|
-
|
|
238
|
-
if (values.length > 1) {
|
|
239
|
-
return values;
|
|
240
|
-
} else {
|
|
241
|
-
if (values.length > 0) {
|
|
242
|
-
return values[0];
|
|
243
|
-
} else {
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* @memberof Vevet.SelectModule
|
|
250
|
-
* @typedef {object} Callback
|
|
251
|
-
* @property {number|Array<number>|false} active - The order number/numbers (for multiple) of options or false if none are selected.
|
|
252
|
-
* @property {string|Array<string>|false} value - Returns the value/values (for multiple) of the select or false if none are selected.
|
|
253
|
-
* @property {Array<HTMLOptionElement>} [options] - Options.
|
|
254
|
-
* @property {HTMLSelectElement} select - Select element.
|
|
255
|
-
* @property {HTMLElement} outer - Outer element.
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @description Get callback data.
|
|
260
|
-
* @returns {Vevet.SelectModule.Callback} Returns callback data.
|
|
261
|
-
*/
|
|
262
|
-
|
|
263
|
-
}, {
|
|
264
|
-
key: "_callbackData",
|
|
265
|
-
value: function _callbackData() {
|
|
266
|
-
var obj = {
|
|
267
|
-
active: this.active,
|
|
268
|
-
value: this.value,
|
|
269
|
-
options: this._options,
|
|
270
|
-
select: this._select,
|
|
271
|
-
outer: this._outer
|
|
272
|
-
};
|
|
273
|
-
return obj;
|
|
274
|
-
} // Extra constructor
|
|
275
|
-
|
|
276
|
-
}, {
|
|
277
|
-
key: "_extra",
|
|
278
|
-
value: function _extra() {
|
|
279
|
-
_get(_getPrototypeOf(SelectModule.prototype), "_extra", this).call(this);
|
|
280
|
-
/**
|
|
281
|
-
* @description If multiple.
|
|
282
|
-
* @protected
|
|
283
|
-
* @member {boolean}
|
|
284
|
-
*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
this._multiple = false;
|
|
288
|
-
/**
|
|
289
|
-
* @description If opened.
|
|
290
|
-
* @protected
|
|
291
|
-
* @member {boolean}
|
|
292
|
-
*/
|
|
293
|
-
|
|
294
|
-
this._opened = false;
|
|
295
|
-
/**
|
|
296
|
-
* @description If animating.
|
|
297
|
-
* @protected
|
|
298
|
-
* @member {boolean}
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
|
-
this._animating = false;
|
|
302
|
-
/**
|
|
303
|
-
* @description Active options numbers.
|
|
304
|
-
* @protected
|
|
305
|
-
* @member {Array<number>}
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
|
-
this._actives = [];
|
|
309
|
-
/**
|
|
310
|
-
* @description List elements.
|
|
311
|
-
* @protected
|
|
312
|
-
* @member {HTMLLIElement}
|
|
313
|
-
*/
|
|
314
|
-
|
|
315
|
-
this._li = []; // get & create elements
|
|
316
|
-
|
|
317
|
-
this._elementsGet();
|
|
318
|
-
|
|
319
|
-
this._elementsCreate(); // set classes
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
this._setClasses();
|
|
323
|
-
} // When properties are changed
|
|
324
|
-
|
|
325
|
-
}, {
|
|
326
|
-
key: "_changeProp",
|
|
327
|
-
value: function _changeProp(prop) {
|
|
328
|
-
_get(_getPrototypeOf(SelectModule.prototype), "_changeProp", this).call(this, prop);
|
|
329
|
-
|
|
330
|
-
this._setClasses();
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* @description Set classes.
|
|
334
|
-
* @protected
|
|
335
|
-
*/
|
|
336
|
-
|
|
337
|
-
}, {
|
|
338
|
-
key: "_setClasses",
|
|
339
|
-
value: function _setClasses() {
|
|
340
|
-
var prop = this._prop,
|
|
341
|
-
prefix = this._prefix,
|
|
342
|
-
classNameSearch = "".concat(prefix, "__search_hide"),
|
|
343
|
-
classNameValues = "".concat(prefix, "__values_hide-active"); // search
|
|
344
|
-
|
|
345
|
-
if (!prop.search.on) {
|
|
346
|
-
this._search.classList.add(classNameSearch);
|
|
347
|
-
} else {
|
|
348
|
-
this._search.classList.remove(classNameSearch);
|
|
349
|
-
} // selected
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (!prop.showSelected) {
|
|
353
|
-
this._values.classList.add(classNameValues);
|
|
354
|
-
} else {
|
|
355
|
-
this._values.classList.remove(classNameValues);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* @description Get elements.
|
|
360
|
-
* @protected
|
|
361
|
-
*/
|
|
362
|
-
|
|
363
|
-
}, {
|
|
364
|
-
key: "_elementsGet",
|
|
365
|
-
value: function _elementsGet() {
|
|
366
|
-
/**
|
|
367
|
-
* @description Select element.
|
|
368
|
-
* @protected
|
|
369
|
-
* @member {HTMLSelectElement}
|
|
370
|
-
*/
|
|
371
|
-
this._select = selectEl.one(this._prop.selector);
|
|
372
|
-
this._select.style.display = 'none'; // multiple
|
|
373
|
-
|
|
374
|
-
if (this._select.multiple) {
|
|
375
|
-
this._multiple = true;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* @description Options.
|
|
379
|
-
* @protected
|
|
380
|
-
* @member {Array<HTMLOptionElement>}
|
|
381
|
-
*/
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
this._options = this._select.querySelectorAll("option");
|
|
385
|
-
/**
|
|
386
|
-
* @description Parent element of the select element.
|
|
387
|
-
* @protected
|
|
388
|
-
* @member {HTMLElement}
|
|
389
|
-
*/
|
|
390
|
-
|
|
391
|
-
this._parent = this._select.parentElement;
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* @description Create elements.
|
|
395
|
-
* @protected
|
|
396
|
-
*/
|
|
397
|
-
|
|
398
|
-
}, {
|
|
399
|
-
key: "_elementsCreate",
|
|
400
|
-
value: function _elementsCreate() {
|
|
401
|
-
// get prefix
|
|
402
|
-
var prefix = this._prefix,
|
|
403
|
-
domSelector = 'div';
|
|
404
|
-
/**
|
|
405
|
-
* @description Outer element.
|
|
406
|
-
* @protected
|
|
407
|
-
* @member {HTMLElement}
|
|
408
|
-
*/
|
|
409
|
-
|
|
410
|
-
this._outer = dom({
|
|
411
|
-
selector: domSelector,
|
|
412
|
-
styles: "".concat(prefix)
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
this._parent.insertBefore(this._outer, this._select);
|
|
416
|
-
/**
|
|
417
|
-
* @description Placeholder outer element.
|
|
418
|
-
* @protected
|
|
419
|
-
* @member {HTMLElement}
|
|
420
|
-
*/
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
this._placeholder = dom({
|
|
424
|
-
selector: domSelector,
|
|
425
|
-
styles: "".concat(prefix, "__placeholder")
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
this._outer.appendChild(this._placeholder);
|
|
429
|
-
/**
|
|
430
|
-
* @description Container element.
|
|
431
|
-
* @protected
|
|
432
|
-
* @member {HTMLElement}
|
|
433
|
-
*/
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
this._container = dom({
|
|
437
|
-
selector: domSelector,
|
|
438
|
-
styles: "".concat(prefix, "__container")
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
this._outer.appendChild(this._container);
|
|
442
|
-
/**
|
|
443
|
-
* @description Content element.
|
|
444
|
-
* @protected
|
|
445
|
-
* @member {HTMLElement}
|
|
446
|
-
*/
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
this._content = dom({
|
|
450
|
-
selector: domSelector,
|
|
451
|
-
styles: "".concat(prefix, "__content")
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
this._container.appendChild(this._content);
|
|
455
|
-
/**
|
|
456
|
-
* @description Search outer element.
|
|
457
|
-
* @protected
|
|
458
|
-
* @member {HTMLElement}
|
|
459
|
-
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
this._search = dom({
|
|
463
|
-
selector: domSelector,
|
|
464
|
-
styles: "".concat(prefix, "__search")
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
this._content.appendChild(this._search);
|
|
468
|
-
/**
|
|
469
|
-
* @description Search input element.
|
|
470
|
-
* @protected
|
|
471
|
-
* @member {HTMLInputElement}
|
|
472
|
-
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
this._input = dom({
|
|
476
|
-
selector: 'input',
|
|
477
|
-
attr: {
|
|
478
|
-
type: "text",
|
|
479
|
-
placeholder: this._prop.search.placeholder
|
|
480
|
-
},
|
|
481
|
-
styles: "".concat(prefix, "__input")
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
this._search.appendChild(this._input);
|
|
485
|
-
/**
|
|
486
|
-
* @description UL element.
|
|
487
|
-
* @protected
|
|
488
|
-
* @member {HTMLUListElement}
|
|
489
|
-
*/
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
this._values = dom({
|
|
493
|
-
selector: 'ul',
|
|
494
|
-
styles: "".concat(prefix, "__values")
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
this._content.appendChild(this._values); // li
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
for (var i = 0; i < this._options.length; i++) {
|
|
501
|
-
// get option
|
|
502
|
-
var option = this._options[i],
|
|
503
|
-
text = option.innerHTML; // create li
|
|
504
|
-
|
|
505
|
-
var li = dom({
|
|
506
|
-
selector: 'li',
|
|
507
|
-
styles: "".concat(prefix, "__value")
|
|
508
|
-
});
|
|
509
|
-
li.innerHTML = text; // if selected
|
|
510
|
-
|
|
511
|
-
if (option.selected) {
|
|
512
|
-
li.classList.add("".concat(prefix, "__value_active"));
|
|
513
|
-
|
|
514
|
-
this._actives.push(i);
|
|
515
|
-
} // push to stack
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
this._li.push(li);
|
|
519
|
-
|
|
520
|
-
this._values.appendChild(li);
|
|
521
|
-
} // change actives
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (this._actives.length === 0 & this._options.length > 0) {
|
|
525
|
-
this._options[0].selected = true;
|
|
526
|
-
this._actives = [0];
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
this._change(false);
|
|
530
|
-
} // Set events
|
|
531
|
-
|
|
532
|
-
}, {
|
|
533
|
-
key: "_setEvents",
|
|
534
|
-
value: function _setEvents() {
|
|
535
|
-
var _this = this;
|
|
536
|
-
|
|
537
|
-
// toggle on placeholder
|
|
538
|
-
this._placeholder.addEventListener("click", function () {
|
|
539
|
-
_this.toggle();
|
|
540
|
-
}); // change on li click
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
var _loop = function _loop(i) {
|
|
544
|
-
_this._li[i].addEventListener("click", function () {
|
|
545
|
-
_this._changeValue(i);
|
|
546
|
-
});
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
for (var i = 0; i < this._li.length; i++) {
|
|
550
|
-
_loop(i);
|
|
551
|
-
} // hide
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
this.listener(window, 'click', this._windowClick.bind(this)); // change select
|
|
555
|
-
|
|
556
|
-
this.listener(this._select, 'change', this._changeSelect.bind(this)); // search
|
|
557
|
-
|
|
558
|
-
this._input.addEventListener("keyup", function () {
|
|
559
|
-
_this._searchKeyup();
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* @description Outer click on window.
|
|
564
|
-
* @param {object} e
|
|
565
|
-
* @protected
|
|
566
|
-
*/
|
|
567
|
-
|
|
568
|
-
}, {
|
|
569
|
-
key: "_windowClick",
|
|
570
|
-
value: function _windowClick(e) {
|
|
571
|
-
if (!(0, _domChildOf.default)(e.target, this._outer) & this._opened & this._prop.close.out) {
|
|
572
|
-
this.close();
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* @description Key-up in search.
|
|
577
|
-
* @protected
|
|
578
|
-
*/
|
|
579
|
-
|
|
580
|
-
}, {
|
|
581
|
-
key: "_searchKeyup",
|
|
582
|
-
value: function _searchKeyup() {
|
|
583
|
-
// check if search is enabled
|
|
584
|
-
if (!this._prop.search.on) {
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
var className = "".concat(this._prefix, "__value_hide"); // get search value
|
|
589
|
-
|
|
590
|
-
var value = this._input.value; // do searching
|
|
591
|
-
|
|
592
|
-
if (value.length === 0) {
|
|
593
|
-
this._li.forEach(function (el) {
|
|
594
|
-
el.classList.remove(className);
|
|
595
|
-
});
|
|
596
|
-
} else {
|
|
597
|
-
this._li.forEach(function (el) {
|
|
598
|
-
// get inner text & compare
|
|
599
|
-
var text = el.innerText.toLowerCase();
|
|
600
|
-
|
|
601
|
-
if (text.includes(value.toLowerCase())) {
|
|
602
|
-
el.classList.remove(className);
|
|
603
|
-
} else {
|
|
604
|
-
el.classList.add(className);
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* @description Reset searching.
|
|
611
|
-
* @protected
|
|
612
|
-
*/
|
|
613
|
-
|
|
614
|
-
}, {
|
|
615
|
-
key: "_searchReset",
|
|
616
|
-
value: function _searchReset() {
|
|
617
|
-
this._input.value = '';
|
|
618
|
-
|
|
619
|
-
this._searchKeyup();
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* @description Get values.
|
|
623
|
-
* @protected
|
|
624
|
-
*/
|
|
625
|
-
|
|
626
|
-
}, {
|
|
627
|
-
key: "_getValues",
|
|
628
|
-
value: function _getValues() {
|
|
629
|
-
var values = [];
|
|
630
|
-
|
|
631
|
-
for (var i = 0; i < this._options.length; i++) {
|
|
632
|
-
if (this._actives.includes(i)) {
|
|
633
|
-
values.push(this._options[i].value);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
return values;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* @description Get texts.
|
|
641
|
-
* @protected
|
|
642
|
-
*/
|
|
643
|
-
|
|
644
|
-
}, {
|
|
645
|
-
key: "_getTexts",
|
|
646
|
-
value: function _getTexts() {
|
|
647
|
-
var texts = [];
|
|
648
|
-
|
|
649
|
-
for (var i = 0; i < this._options.length; i++) {
|
|
650
|
-
if (this._actives.includes(i)) {
|
|
651
|
-
texts.push(this._options[i].innerText);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
return texts;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* @description Change values.
|
|
659
|
-
* @protected
|
|
660
|
-
* @param {boolean} [event=true] - Defines if you need to launch callbacks.
|
|
661
|
-
*/
|
|
662
|
-
|
|
663
|
-
}, {
|
|
664
|
-
key: "_change",
|
|
665
|
-
value: function _change() {
|
|
666
|
-
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
667
|
-
var prefix = this._prefix,
|
|
668
|
-
className = "".concat(prefix, "__value_active"); // change placeholder
|
|
669
|
-
|
|
670
|
-
if (this._prop.changePlaceholder) {
|
|
671
|
-
this._placeholder.innerHTML = "<span>".concat(this._getTexts().join(", "), "</span> <div class=\"").concat(prefix, "__arrow\"></div>");
|
|
672
|
-
} // change value classes
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
for (var i = 0; i < this._li.length; i++) {
|
|
676
|
-
var li = this._li[i];
|
|
677
|
-
|
|
678
|
-
if (this._actives.includes(i)) {
|
|
679
|
-
li.classList.add(className);
|
|
680
|
-
} else {
|
|
681
|
-
li.classList.remove(className);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
if (event) {
|
|
686
|
-
this.lbt("change", this._callbackData());
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* @description Change on value click.
|
|
691
|
-
* @protected
|
|
692
|
-
* @param {number} num - The order number of a value li.
|
|
693
|
-
*/
|
|
694
|
-
|
|
695
|
-
}, {
|
|
696
|
-
key: "_changeValue",
|
|
697
|
-
value: function _changeValue(num) {
|
|
698
|
-
// get option
|
|
699
|
-
var option = this._options[num]; // set or reset
|
|
700
|
-
|
|
701
|
-
if (this._multiple) {
|
|
702
|
-
if (option.selected) {
|
|
703
|
-
option.selected = false;
|
|
704
|
-
} else {
|
|
705
|
-
option.selected = true;
|
|
706
|
-
}
|
|
707
|
-
} else {
|
|
708
|
-
option.selected = true;
|
|
709
|
-
} // change select
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
this._select.dispatchEvent(new Event('change')); // close
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
if (this._prop.close.change) {
|
|
716
|
-
this.close();
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* @description Change on select change.
|
|
721
|
-
* @protected
|
|
722
|
-
*/
|
|
723
|
-
|
|
724
|
-
}, {
|
|
725
|
-
key: "_changeSelect",
|
|
726
|
-
value: function _changeSelect() {
|
|
727
|
-
// get current value
|
|
728
|
-
var actives = [],
|
|
729
|
-
i = 0;
|
|
730
|
-
|
|
731
|
-
this._options.forEach(function (el) {
|
|
732
|
-
if (el.selected) {
|
|
733
|
-
actives.push(i);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
i++;
|
|
737
|
-
}); // change vars
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
this._actives = actives; // change
|
|
741
|
-
|
|
742
|
-
this._change();
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* @description Show/Hide the selectbox.
|
|
746
|
-
* @returns {boolean} Returns true if success.
|
|
747
|
-
*/
|
|
748
|
-
|
|
749
|
-
}, {
|
|
750
|
-
key: "toggle",
|
|
751
|
-
value: function toggle() {
|
|
752
|
-
if (this._animating) {
|
|
753
|
-
return false;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
if (this._opened) {
|
|
757
|
-
this.close();
|
|
758
|
-
} else {
|
|
759
|
-
this.open();
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
return true;
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* @description Open the select box.
|
|
766
|
-
* @returns {boolean} Returns true if success.
|
|
767
|
-
*/
|
|
768
|
-
|
|
769
|
-
}, {
|
|
770
|
-
key: "open",
|
|
771
|
-
value: function open() {
|
|
772
|
-
var _this2 = this;
|
|
773
|
-
|
|
774
|
-
if (this._opened || this._animating) {
|
|
775
|
-
return false;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
var prefix = this._prefix; // reset search
|
|
779
|
-
|
|
780
|
-
this._searchReset(); // change vars
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
this._opened = true;
|
|
784
|
-
this._animating = true; // show select
|
|
785
|
-
|
|
786
|
-
this._outer.classList.add("".concat(prefix, "_opened"));
|
|
787
|
-
|
|
788
|
-
this._container.classList.add("".concat(prefix, "__container_opened"));
|
|
789
|
-
|
|
790
|
-
setTimeout(function () {
|
|
791
|
-
_this2._outer.classList.add("".concat(prefix, "_animate"));
|
|
792
|
-
|
|
793
|
-
_this2._container.classList.add("".concat(prefix, "__container_animate"));
|
|
794
|
-
|
|
795
|
-
_this2.lbt("open", _this2._callbackData());
|
|
796
|
-
|
|
797
|
-
setTimeout(function () {
|
|
798
|
-
_this2._animating = false;
|
|
799
|
-
|
|
800
|
-
_this2.lbt("opened", _this2._callbackData());
|
|
801
|
-
}, _this2._prop.duration);
|
|
802
|
-
}, 15);
|
|
803
|
-
return true;
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* @description Close the select box.
|
|
807
|
-
* @returns {boolean} Returns true if success.
|
|
808
|
-
*/
|
|
809
|
-
|
|
810
|
-
}, {
|
|
811
|
-
key: "close",
|
|
812
|
-
value: function close() {
|
|
813
|
-
var _this3 = this;
|
|
814
|
-
|
|
815
|
-
if (!this._opened || this._animating) {
|
|
816
|
-
return false;
|
|
817
|
-
} // change vars
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
this._opened = false;
|
|
821
|
-
this._animating = true;
|
|
822
|
-
var prefix = this._prefix; // hide select
|
|
823
|
-
|
|
824
|
-
this._outer.classList.remove("".concat(prefix, "_animate"));
|
|
825
|
-
|
|
826
|
-
this._container.classList.remove("".concat(prefix, "__container_animate"));
|
|
827
|
-
|
|
828
|
-
this.lbt("close", this._callbackData());
|
|
829
|
-
setTimeout(function () {
|
|
830
|
-
_this3._outer.classList.remove("".concat(prefix, "_opened"));
|
|
831
|
-
|
|
832
|
-
_this3._container.classList.remove("".concat(prefix, "__container_opened"));
|
|
833
|
-
|
|
834
|
-
_this3._animating = false;
|
|
835
|
-
|
|
836
|
-
_this3.lbt("closed", _this3._callbackData());
|
|
837
|
-
}, this._prop.duration);
|
|
838
|
-
return true;
|
|
839
|
-
}
|
|
840
|
-
/**
|
|
841
|
-
* @description Destroy the select.
|
|
842
|
-
*/
|
|
843
|
-
|
|
844
|
-
}, {
|
|
845
|
-
key: "destroy",
|
|
846
|
-
value: function destroy() {
|
|
847
|
-
_get(_getPrototypeOf(SelectModule.prototype), "destroy", this).call(this); // remove element
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
this._outer.remove(); // display select
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
this._select.style.display = '';
|
|
854
|
-
}
|
|
855
|
-
}]);
|
|
856
|
-
|
|
857
|
-
return SelectModule;
|
|
858
|
-
}(_Module2.default);
|
|
859
|
-
|
|
860
|
-
exports.default = SelectModule;
|