@egjs/flicking 4.3.0 → 4.4.2
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/README.md +1 -2
- package/declaration/Flicking.d.ts +23 -11
- package/declaration/camera/Camera.d.ts +3 -2
- package/declaration/camera/CircularCamera.d.ts +2 -1
- package/declaration/const/error.d.ts +3 -1
- package/declaration/const/external.d.ts +5 -0
- package/declaration/core/AutoResizer.d.ts +13 -0
- package/declaration/core/VirtualManager.d.ts +37 -0
- package/declaration/core/index.d.ts +2 -1
- package/declaration/core/panel/Panel.d.ts +13 -7
- package/declaration/core/panel/VirtualPanel.d.ts +19 -0
- package/declaration/core/panel/index.d.ts +4 -4
- package/declaration/core/panel/provider/ElementProvider.d.ts +8 -0
- package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -0
- package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -0
- package/declaration/core/panel/provider/index.d.ts +5 -0
- package/declaration/index.d.ts +11 -1
- package/declaration/renderer/ExternalRenderer.d.ts +1 -1
- package/declaration/renderer/Renderer.d.ts +17 -12
- package/declaration/renderer/VanillaRenderer.d.ts +2 -7
- package/declaration/renderer/index.d.ts +1 -0
- package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -0
- package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -0
- package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -0
- package/declaration/renderer/strategy/index.d.ts +5 -0
- package/declaration/utils.d.ts +7 -1
- package/dist/flicking.esm.js +1401 -421
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +1429 -425
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +8683 -8061
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +9 -22
- package/src/Flicking.ts +146 -30
- package/src/camera/BoundCamera.ts +2 -2
- package/src/camera/Camera.ts +50 -27
- package/src/camera/CircularCamera.ts +52 -27
- package/src/camera/LinearCamera.ts +1 -1
- package/src/cfc/sync.ts +10 -5
- package/src/const/error.ts +6 -3
- package/src/const/external.ts +6 -0
- package/src/control/AxesController.ts +11 -6
- package/src/control/Control.ts +6 -6
- package/src/control/FreeControl.ts +2 -2
- package/src/control/SnapControl.ts +3 -3
- package/src/control/StrictControl.ts +2 -2
- package/src/core/AutoResizer.ts +81 -0
- package/src/core/Viewport.ts +4 -4
- package/src/core/VirtualManager.ts +188 -0
- package/src/core/index.ts +3 -1
- package/src/core/panel/Panel.ts +54 -34
- package/src/core/panel/VirtualPanel.ts +110 -0
- package/src/core/panel/index.ts +5 -7
- package/src/core/panel/provider/ElementProvider.ts +14 -0
- package/src/core/panel/provider/VanillaElementProvider.ts +45 -0
- package/src/core/panel/provider/VirtualElementProvider.ts +48 -0
- package/src/core/panel/provider/index.ts +16 -0
- package/src/index.ts +12 -1
- package/src/index.umd.ts +2 -0
- package/src/renderer/ExternalRenderer.ts +7 -7
- package/src/renderer/Renderer.ts +106 -65
- package/src/renderer/VanillaRenderer.ts +28 -86
- package/src/renderer/index.ts +2 -0
- package/src/renderer/strategy/NormalRenderingStrategy.ts +106 -0
- package/src/renderer/strategy/RenderingStrategy.ts +21 -0
- package/src/renderer/strategy/VirtualRenderingStrategy.ts +110 -0
- package/src/renderer/strategy/index.ts +17 -0
- package/src/utils.ts +36 -2
- package/declaration/core/panel/ElementPanel.d.ts +0 -14
- package/declaration/core/panel/ExternalPanel.d.ts +0 -9
- package/declaration/exports.d.ts +0 -10
- package/src/core/panel/ElementPanel.ts +0 -52
- package/src/core/panel/ExternalPanel.ts +0 -32
- package/src/exports.ts +0 -16
package/dist/flicking.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ name: @egjs/flicking
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking
|
|
7
|
-
version: 4.
|
|
7
|
+
version: 4.4.2
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -274,6 +274,7 @@ function __spreadArray(to, from) {
|
|
|
274
274
|
* <ko>프레임워크(React, Angular, Vue ...)에서 사용 불가능한 메소드를 호출했을 경우</ko>
|
|
275
275
|
* @property {number} NOT_INITIALIZED When the {@link Flicking#init} is not called before but is needed<ko>{@link Flicking#init}의 호출이 필요하나, 아직 호출되지 않았을 경우</ko>
|
|
276
276
|
* @property {number} NO_ACTIVE When there're no active panel that flicking has selected. This may be due to the absence of any panels<ko>현재 Flicking이 선택한 패널이 없을 경우. 일반적으로 패널이 하나도 없는 경우에 발생할 수 있습니다</ko>
|
|
277
|
+
* @property {number} NOT_ALLOWED_IN_VIRTUAL When the non-allowed method is called while the virtual option is enabled<ko>virtual 옵션이 활성화된 상태에서 사용 불가능한 메소드가 호출되었을 경우</ko>
|
|
277
278
|
*/
|
|
278
279
|
var CODE = {
|
|
279
280
|
WRONG_TYPE: 0,
|
|
@@ -289,7 +290,8 @@ var CODE = {
|
|
|
289
290
|
ANIMATION_ALREADY_PLAYING: 10,
|
|
290
291
|
NOT_ALLOWED_IN_FRAMEWORK: 11,
|
|
291
292
|
NOT_INITIALIZED: 12,
|
|
292
|
-
NO_ACTIVE: 13
|
|
293
|
+
NO_ACTIVE: 13,
|
|
294
|
+
NOT_ALLOWED_IN_VIRTUAL: 14
|
|
293
295
|
};
|
|
294
296
|
var MESSAGE = {
|
|
295
297
|
WRONG_TYPE: function (wrongVal, correctTypes) {
|
|
@@ -303,9 +305,7 @@ var MESSAGE = {
|
|
|
303
305
|
VAL_MUST_NOT_NULL: function (val, name) {
|
|
304
306
|
return name + " should be provided. Given: " + val;
|
|
305
307
|
},
|
|
306
|
-
NOT_ATTACHED_TO_FLICKING:
|
|
307
|
-
return name + " is not attached to the Flicking instance. \"init()\" should be called first.";
|
|
308
|
-
},
|
|
308
|
+
NOT_ATTACHED_TO_FLICKING: "This module is not attached to the Flicking instance. \"init()\" should be called first.",
|
|
309
309
|
WRONG_OPTION: function (optionName, val) {
|
|
310
310
|
return "Option \"" + optionName + "\" is not in correct format, given: " + val;
|
|
311
311
|
},
|
|
@@ -321,7 +321,8 @@ var MESSAGE = {
|
|
|
321
321
|
ANIMATION_ALREADY_PLAYING: "Animation is already playing.",
|
|
322
322
|
NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular.",
|
|
323
323
|
NOT_INITIALIZED: "Flicking is not initialized yet, call init() first.",
|
|
324
|
-
NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels."
|
|
324
|
+
NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels.",
|
|
325
|
+
NOT_ALLOWED_IN_VIRTUAL: "This behavior is not allowed when the virtual option is enabled"
|
|
325
326
|
};
|
|
326
327
|
|
|
327
328
|
/*
|
|
@@ -417,7 +418,26 @@ var MOVE_TYPE = {
|
|
|
417
418
|
FREE_SCROLL: "freeScroll",
|
|
418
419
|
STRICT: "strict"
|
|
419
420
|
};
|
|
421
|
+
var CLASS = {
|
|
422
|
+
VERTICAL: "vertical",
|
|
423
|
+
HIDDEN: "flicking-hidden",
|
|
424
|
+
DEFAULT_VIRTUAL: "flicking-panel"
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
var merge = function (target) {
|
|
428
|
+
var sources = [];
|
|
420
429
|
|
|
430
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
431
|
+
sources[_i - 1] = arguments[_i];
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
sources.forEach(function (source) {
|
|
435
|
+
Object.keys(source).forEach(function (key) {
|
|
436
|
+
target[key] = source[key];
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
return target;
|
|
440
|
+
};
|
|
421
441
|
var getElement = function (el, parent) {
|
|
422
442
|
var targetEl = null;
|
|
423
443
|
|
|
@@ -448,9 +468,9 @@ var checkExistence = function (value, nameOnErrMsg) {
|
|
|
448
468
|
var clamp = function (x, min, max) {
|
|
449
469
|
return Math.max(Math.min(x, max), min);
|
|
450
470
|
};
|
|
451
|
-
var getFlickingAttached = function (val
|
|
471
|
+
var getFlickingAttached = function (val) {
|
|
452
472
|
if (!val) {
|
|
453
|
-
throw new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING
|
|
473
|
+
throw new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING);
|
|
454
474
|
}
|
|
455
475
|
|
|
456
476
|
return val;
|
|
@@ -566,6 +586,12 @@ var parseArithmeticExpression = function (cssValue) {
|
|
|
566
586
|
|
|
567
587
|
return parsed;
|
|
568
588
|
};
|
|
589
|
+
var parseCSSSizeValue = function (val) {
|
|
590
|
+
return isString(val) ? val : val + "px";
|
|
591
|
+
};
|
|
592
|
+
var parsePanelAlign = function (align) {
|
|
593
|
+
return typeof align === "object" ? align.panel : align;
|
|
594
|
+
};
|
|
569
595
|
var getDirection = function (start, end) {
|
|
570
596
|
if (start === end) return DIRECTION.NONE;
|
|
571
597
|
return start < end ? DIRECTION.NEXT : DIRECTION.PREV;
|
|
@@ -659,6 +685,17 @@ var find = function (array, checker) {
|
|
|
659
685
|
|
|
660
686
|
return null;
|
|
661
687
|
};
|
|
688
|
+
var findRight = function (array, checker) {
|
|
689
|
+
for (var idx = array.length - 1; idx >= 0; idx--) {
|
|
690
|
+
var val = array[idx];
|
|
691
|
+
|
|
692
|
+
if (checker(val)) {
|
|
693
|
+
return val;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
return null;
|
|
698
|
+
};
|
|
662
699
|
var findIndex = function (array, checker) {
|
|
663
700
|
for (var idx = 0; idx < array.length; idx++) {
|
|
664
701
|
if (checker(array[idx])) {
|
|
@@ -675,6 +712,26 @@ var getProgress = function (pos, prev, next) {
|
|
|
675
712
|
var getStyle = function (el) {
|
|
676
713
|
return window.getComputedStyle(el) || el.currentStyle;
|
|
677
714
|
};
|
|
715
|
+
var setSize = function (el, _a) {
|
|
716
|
+
var width = _a.width,
|
|
717
|
+
height = _a.height;
|
|
718
|
+
|
|
719
|
+
if (width != null) {
|
|
720
|
+
if (isString(width)) {
|
|
721
|
+
el.style.width = width;
|
|
722
|
+
} else {
|
|
723
|
+
el.style.width = width + "px";
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
if (height != null) {
|
|
728
|
+
if (isString(height)) {
|
|
729
|
+
el.style.height = height;
|
|
730
|
+
} else {
|
|
731
|
+
el.style.height = height + "px";
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
};
|
|
678
735
|
var isBetween = function (val, min, max) {
|
|
679
736
|
return val >= min && val <= max;
|
|
680
737
|
};
|
|
@@ -687,6 +744,15 @@ var circulateIndex = function (index, max) {
|
|
|
687
744
|
return index;
|
|
688
745
|
}
|
|
689
746
|
};
|
|
747
|
+
var range = function (end) {
|
|
748
|
+
var arr = new Array(end);
|
|
749
|
+
|
|
750
|
+
for (var i = 0; i < end; i++) {
|
|
751
|
+
arr[i] = i;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
return arr;
|
|
755
|
+
};
|
|
690
756
|
var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
691
757
|
obj.__proto__ = proto;
|
|
692
758
|
return obj;
|
|
@@ -715,7 +781,9 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
|
715
781
|
* ```
|
|
716
782
|
*/
|
|
717
783
|
|
|
718
|
-
var FlickingError =
|
|
784
|
+
var FlickingError =
|
|
785
|
+
/*#__PURE__*/
|
|
786
|
+
function (_super) {
|
|
719
787
|
__extends(FlickingError, _super);
|
|
720
788
|
/**
|
|
721
789
|
* @param message Error message<ko>에러 메시지</ko>
|
|
@@ -744,7 +812,9 @@ var FlickingError = function (_super) {
|
|
|
744
812
|
* @ko 뷰포트 크기 정보를 담당하는 컴포넌트
|
|
745
813
|
*/
|
|
746
814
|
|
|
747
|
-
var Viewport =
|
|
815
|
+
var Viewport =
|
|
816
|
+
/*#__PURE__*/
|
|
817
|
+
function () {
|
|
748
818
|
/**
|
|
749
819
|
* @param el A viewport element<ko>뷰포트 엘리먼트</ko>
|
|
750
820
|
*/
|
|
@@ -867,10 +937,10 @@ var Viewport = function () {
|
|
|
867
937
|
this._width = el.clientWidth;
|
|
868
938
|
this._height = el.clientHeight;
|
|
869
939
|
this._padding = {
|
|
870
|
-
left: parseFloat(elStyle.paddingLeft),
|
|
871
|
-
right: parseFloat(elStyle.paddingRight),
|
|
872
|
-
top: parseFloat(elStyle.paddingTop),
|
|
873
|
-
bottom: parseFloat(elStyle.paddingBottom)
|
|
940
|
+
left: elStyle.paddingLeft ? parseFloat(elStyle.paddingLeft) : 0,
|
|
941
|
+
right: elStyle.paddingRight ? parseFloat(elStyle.paddingRight) : 0,
|
|
942
|
+
top: elStyle.paddingTop ? parseFloat(elStyle.paddingTop) : 0,
|
|
943
|
+
bottom: elStyle.paddingBottom ? parseFloat(elStyle.paddingBottom) : 0
|
|
874
944
|
};
|
|
875
945
|
this._isBorderBoxSizing = elStyle.boxSizing === "border-box";
|
|
876
946
|
};
|
|
@@ -878,6 +948,412 @@ var Viewport = function () {
|
|
|
878
948
|
return Viewport;
|
|
879
949
|
}();
|
|
880
950
|
|
|
951
|
+
var AutoResizer =
|
|
952
|
+
/*#__PURE__*/
|
|
953
|
+
function () {
|
|
954
|
+
function AutoResizer(flicking) {
|
|
955
|
+
var _this = this;
|
|
956
|
+
|
|
957
|
+
this._onResize = function () {
|
|
958
|
+
void _this._flicking.resize();
|
|
959
|
+
}; // eslint-disable-next-line @typescript-eslint/member-ordering
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
this._skipFirstResize = function () {
|
|
963
|
+
var isFirstResize = true;
|
|
964
|
+
return function () {
|
|
965
|
+
if (isFirstResize) {
|
|
966
|
+
isFirstResize = false;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
_this._onResize();
|
|
971
|
+
};
|
|
972
|
+
}();
|
|
973
|
+
|
|
974
|
+
this._flicking = flicking;
|
|
975
|
+
this._enabled = false;
|
|
976
|
+
this._resizeObserver = null;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
var __proto = AutoResizer.prototype;
|
|
980
|
+
Object.defineProperty(__proto, "enabled", {
|
|
981
|
+
get: function () {
|
|
982
|
+
return this._enabled;
|
|
983
|
+
},
|
|
984
|
+
enumerable: false,
|
|
985
|
+
configurable: true
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
__proto.enable = function () {
|
|
989
|
+
var flicking = this._flicking;
|
|
990
|
+
var viewport = flicking.viewport;
|
|
991
|
+
|
|
992
|
+
if (this._enabled) {
|
|
993
|
+
this.disable();
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
997
|
+
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
998
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
|
|
999
|
+
resizeObserver.observe(flicking.viewport.element);
|
|
1000
|
+
this._resizeObserver = resizeObserver;
|
|
1001
|
+
} else {
|
|
1002
|
+
window.addEventListener("resize", this._onResize);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
this._enabled = true;
|
|
1006
|
+
return this;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
__proto.disable = function () {
|
|
1010
|
+
if (!this._enabled) return this;
|
|
1011
|
+
var resizeObserver = this._resizeObserver;
|
|
1012
|
+
|
|
1013
|
+
if (resizeObserver) {
|
|
1014
|
+
resizeObserver.disconnect();
|
|
1015
|
+
this._resizeObserver = null;
|
|
1016
|
+
} else {
|
|
1017
|
+
window.removeEventListener("resize", this._onResize);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
this._enabled = false;
|
|
1021
|
+
return this;
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
return AutoResizer;
|
|
1025
|
+
}();
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* @internal
|
|
1029
|
+
*/
|
|
1030
|
+
var VanillaElementProvider =
|
|
1031
|
+
/*#__PURE__*/
|
|
1032
|
+
function () {
|
|
1033
|
+
function VanillaElementProvider(element) {
|
|
1034
|
+
this._element = element;
|
|
1035
|
+
this._rendered = true;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
var __proto = VanillaElementProvider.prototype;
|
|
1039
|
+
Object.defineProperty(__proto, "element", {
|
|
1040
|
+
get: function () {
|
|
1041
|
+
return this._element;
|
|
1042
|
+
},
|
|
1043
|
+
enumerable: false,
|
|
1044
|
+
configurable: true
|
|
1045
|
+
});
|
|
1046
|
+
Object.defineProperty(__proto, "rendered", {
|
|
1047
|
+
get: function () {
|
|
1048
|
+
return this._rendered;
|
|
1049
|
+
},
|
|
1050
|
+
enumerable: false,
|
|
1051
|
+
configurable: true
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
__proto.show = function (flicking) {
|
|
1055
|
+
var el = this.element;
|
|
1056
|
+
var cameraEl = flicking.camera.element;
|
|
1057
|
+
|
|
1058
|
+
if (el.parentElement !== cameraEl) {
|
|
1059
|
+
cameraEl.appendChild(el);
|
|
1060
|
+
this._rendered = true;
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
__proto.hide = function (flicking) {
|
|
1065
|
+
var el = this.element;
|
|
1066
|
+
var cameraEl = flicking.camera.element;
|
|
1067
|
+
|
|
1068
|
+
if (el.parentElement === cameraEl) {
|
|
1069
|
+
cameraEl.removeChild(el);
|
|
1070
|
+
this._rendered = false;
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
return VanillaElementProvider;
|
|
1075
|
+
}();
|
|
1076
|
+
|
|
1077
|
+
/*
|
|
1078
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
1079
|
+
* egjs projects are licensed under the MIT license
|
|
1080
|
+
*/
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* @internal
|
|
1084
|
+
*/
|
|
1085
|
+
var VirtualElementProvider =
|
|
1086
|
+
/*#__PURE__*/
|
|
1087
|
+
function () {
|
|
1088
|
+
function VirtualElementProvider(flicking) {
|
|
1089
|
+
this._flicking = flicking;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
var __proto = VirtualElementProvider.prototype;
|
|
1093
|
+
Object.defineProperty(__proto, "element", {
|
|
1094
|
+
get: function () {
|
|
1095
|
+
return this._virtualElement.nativeElement;
|
|
1096
|
+
},
|
|
1097
|
+
enumerable: false,
|
|
1098
|
+
configurable: true
|
|
1099
|
+
});
|
|
1100
|
+
Object.defineProperty(__proto, "rendered", {
|
|
1101
|
+
get: function () {
|
|
1102
|
+
return this._virtualElement.visible;
|
|
1103
|
+
},
|
|
1104
|
+
enumerable: false,
|
|
1105
|
+
configurable: true
|
|
1106
|
+
});
|
|
1107
|
+
Object.defineProperty(__proto, "_virtualElement", {
|
|
1108
|
+
get: function () {
|
|
1109
|
+
var flicking = this._flicking;
|
|
1110
|
+
var elIndex = this._panel.elementIndex;
|
|
1111
|
+
var virtualElements = flicking.virtual.elements;
|
|
1112
|
+
return virtualElements[elIndex];
|
|
1113
|
+
},
|
|
1114
|
+
enumerable: false,
|
|
1115
|
+
configurable: true
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
__proto.init = function (panel) {
|
|
1119
|
+
this._panel = panel;
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
__proto.show = function () {// DO_NOTHING
|
|
1123
|
+
// Actual element visibility is controlled by VirtualManager
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
__proto.hide = function () {// DO_NOTHING
|
|
1127
|
+
// Actual element visibility is controlled by VirtualManager
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
return VirtualElementProvider;
|
|
1131
|
+
}();
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* A manager class to add / remove virtual panels
|
|
1135
|
+
*/
|
|
1136
|
+
|
|
1137
|
+
var VirtualManager =
|
|
1138
|
+
/*#__PURE__*/
|
|
1139
|
+
function () {
|
|
1140
|
+
function VirtualManager(flicking, options) {
|
|
1141
|
+
var _a, _b, _c, _d;
|
|
1142
|
+
|
|
1143
|
+
this._flicking = flicking;
|
|
1144
|
+
this._renderPanel = (_a = options === null || options === void 0 ? void 0 : options.renderPanel) !== null && _a !== void 0 ? _a : function () {
|
|
1145
|
+
return "";
|
|
1146
|
+
};
|
|
1147
|
+
this._initialPanelCount = (_b = options === null || options === void 0 ? void 0 : options.initialPanelCount) !== null && _b !== void 0 ? _b : -1;
|
|
1148
|
+
this._cache = (_c = options === null || options === void 0 ? void 0 : options.cache) !== null && _c !== void 0 ? _c : false;
|
|
1149
|
+
this._panelClass = (_d = options === null || options === void 0 ? void 0 : options.panelClass) !== null && _d !== void 0 ? _d : CLASS.DEFAULT_VIRTUAL;
|
|
1150
|
+
this._elements = [];
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
var __proto = VirtualManager.prototype;
|
|
1154
|
+
Object.defineProperty(__proto, "elements", {
|
|
1155
|
+
get: function () {
|
|
1156
|
+
return this._elements;
|
|
1157
|
+
},
|
|
1158
|
+
enumerable: false,
|
|
1159
|
+
configurable: true
|
|
1160
|
+
});
|
|
1161
|
+
Object.defineProperty(__proto, "renderPanel", {
|
|
1162
|
+
// Options
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* A rendering function for the panel element's innerHTML
|
|
1166
|
+
* @ko 패널 엘리먼트의 innerHTML을 렌더링하는 함수
|
|
1167
|
+
* @type {function}
|
|
1168
|
+
* @param {VirtualPanel} panel Instance of the panel<ko>패널 인스턴스</ko>
|
|
1169
|
+
* @param {number} index Index of the panel<ko>패널 인덱스</ko>
|
|
1170
|
+
* @default "() => {}"
|
|
1171
|
+
*/
|
|
1172
|
+
get: function () {
|
|
1173
|
+
return this._renderPanel;
|
|
1174
|
+
},
|
|
1175
|
+
set: function (val) {
|
|
1176
|
+
this._renderPanel = val;
|
|
1177
|
+
|
|
1178
|
+
this._flicking.renderer.panels.forEach(function (panel) {
|
|
1179
|
+
return panel.uncacheRenderResult();
|
|
1180
|
+
});
|
|
1181
|
+
},
|
|
1182
|
+
enumerable: false,
|
|
1183
|
+
configurable: true
|
|
1184
|
+
});
|
|
1185
|
+
Object.defineProperty(__proto, "initialPanelCount", {
|
|
1186
|
+
/**
|
|
1187
|
+
* Initial panel count to render
|
|
1188
|
+
* @ko 최초로 렌더링할 패널의 개수
|
|
1189
|
+
* @readonly
|
|
1190
|
+
* @type {number}
|
|
1191
|
+
* @default -1
|
|
1192
|
+
*/
|
|
1193
|
+
get: function () {
|
|
1194
|
+
return this._initialPanelCount;
|
|
1195
|
+
},
|
|
1196
|
+
enumerable: false,
|
|
1197
|
+
configurable: true
|
|
1198
|
+
});
|
|
1199
|
+
Object.defineProperty(__proto, "cache", {
|
|
1200
|
+
/**
|
|
1201
|
+
* Whether to cache rendered panel's innerHTML
|
|
1202
|
+
* @ko 렌더링된 패널의 innerHTML 정보를 캐시할지 여부
|
|
1203
|
+
* @type {boolean}
|
|
1204
|
+
* @default false
|
|
1205
|
+
*/
|
|
1206
|
+
get: function () {
|
|
1207
|
+
return this._cache;
|
|
1208
|
+
},
|
|
1209
|
+
set: function (val) {
|
|
1210
|
+
this._cache = val;
|
|
1211
|
+
},
|
|
1212
|
+
enumerable: false,
|
|
1213
|
+
configurable: true
|
|
1214
|
+
});
|
|
1215
|
+
Object.defineProperty(__proto, "panelClass", {
|
|
1216
|
+
/**
|
|
1217
|
+
* The class name that will be applied to rendered panel elements
|
|
1218
|
+
* @ko 렌더링되는 패널 엘리먼트에 적용될 클래스 이름
|
|
1219
|
+
* @type {string}
|
|
1220
|
+
* @default "flicking-panel"
|
|
1221
|
+
*/
|
|
1222
|
+
get: function () {
|
|
1223
|
+
return this._panelClass;
|
|
1224
|
+
},
|
|
1225
|
+
set: function (val) {
|
|
1226
|
+
this._panelClass = val;
|
|
1227
|
+
},
|
|
1228
|
+
enumerable: false,
|
|
1229
|
+
configurable: true
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
__proto.init = function () {
|
|
1233
|
+
var flicking = this._flicking;
|
|
1234
|
+
if (!flicking.virtualEnabled) return;
|
|
1235
|
+
|
|
1236
|
+
if (!flicking.externalRenderer && !flicking.renderExternal) {
|
|
1237
|
+
this._initVirtualElements();
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
var virtualElements = flicking.camera.children;
|
|
1241
|
+
this._elements = virtualElements.map(function (el) {
|
|
1242
|
+
return {
|
|
1243
|
+
nativeElement: el,
|
|
1244
|
+
visible: true
|
|
1245
|
+
};
|
|
1246
|
+
});
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
__proto.show = function (index) {
|
|
1250
|
+
var el = this._elements[index];
|
|
1251
|
+
var nativeEl = el.nativeElement;
|
|
1252
|
+
el.visible = true;
|
|
1253
|
+
|
|
1254
|
+
if (nativeEl.style.display) {
|
|
1255
|
+
nativeEl.style.display = "";
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
__proto.hide = function (index) {
|
|
1260
|
+
var el = this._elements[index];
|
|
1261
|
+
var nativeEl = el.nativeElement;
|
|
1262
|
+
el.visible = false;
|
|
1263
|
+
nativeEl.style.display = "none";
|
|
1264
|
+
};
|
|
1265
|
+
/**
|
|
1266
|
+
* Add new virtual panels at the end of the list
|
|
1267
|
+
* @ko 새로운 가상 패널들을 리스트의 끝에 추가합니다
|
|
1268
|
+
* @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
|
|
1269
|
+
* @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
|
|
1270
|
+
*/
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
__proto.append = function (count) {
|
|
1274
|
+
if (count === void 0) {
|
|
1275
|
+
count = 1;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
var flicking = this._flicking;
|
|
1279
|
+
return this.insert(flicking.panels.length, count);
|
|
1280
|
+
};
|
|
1281
|
+
/**
|
|
1282
|
+
* Add new virtual panels at the start of the list
|
|
1283
|
+
* @ko 새로운 가상 패널들을 리스트의 시작에 추가합니다
|
|
1284
|
+
* @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
|
|
1285
|
+
* @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
|
|
1286
|
+
*/
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
__proto.prepend = function (count) {
|
|
1290
|
+
if (count === void 0) {
|
|
1291
|
+
count = 1;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
return this.insert(0, count);
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* Add new virtual panels at the given index
|
|
1298
|
+
* @ko 새로운 가상 패널들을 주어진 인덱스에 추가합니다
|
|
1299
|
+
* @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
|
|
1300
|
+
* @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
|
|
1301
|
+
*/
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
__proto.insert = function (index, count) {
|
|
1305
|
+
if (count === void 0) {
|
|
1306
|
+
count = 1;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
if (count <= 0) return [];
|
|
1310
|
+
var flicking = this._flicking;
|
|
1311
|
+
return flicking.renderer.batchInsert({
|
|
1312
|
+
index: index,
|
|
1313
|
+
elements: range(count),
|
|
1314
|
+
hasDOMInElements: false
|
|
1315
|
+
});
|
|
1316
|
+
};
|
|
1317
|
+
/**
|
|
1318
|
+
* Remove panels at the given index
|
|
1319
|
+
* @ko 주어진 인덱스에서 패널들을 삭제합니다
|
|
1320
|
+
* @param {number} count The number of panels to remove<ko>삭제할 패널의 개수</ko>
|
|
1321
|
+
* @returns {Array<VirtualPanel>} The panels removed<ko>삭제된 패널들</ko>
|
|
1322
|
+
*/
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
__proto.remove = function (index, count) {
|
|
1326
|
+
if (count <= 0) return [];
|
|
1327
|
+
var flicking = this._flicking;
|
|
1328
|
+
return flicking.renderer.batchRemove({
|
|
1329
|
+
index: index,
|
|
1330
|
+
deleteCount: count,
|
|
1331
|
+
hasDOMInElements: false
|
|
1332
|
+
});
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
__proto._initVirtualElements = function () {
|
|
1336
|
+
var _this = this;
|
|
1337
|
+
|
|
1338
|
+
var flicking = this._flicking;
|
|
1339
|
+
var cameraElement = flicking.camera.element;
|
|
1340
|
+
var panelsPerView = flicking.panelsPerView;
|
|
1341
|
+
var fragment = document.createDocumentFragment();
|
|
1342
|
+
var newElements = range(panelsPerView + 1).map(function (idx) {
|
|
1343
|
+
var panelEl = document.createElement("div");
|
|
1344
|
+
panelEl.className = _this._panelClass;
|
|
1345
|
+
panelEl.dataset.elementIndex = idx.toString();
|
|
1346
|
+
return panelEl;
|
|
1347
|
+
});
|
|
1348
|
+
newElements.forEach(function (el) {
|
|
1349
|
+
fragment.appendChild(el);
|
|
1350
|
+
});
|
|
1351
|
+
cameraElement.appendChild(fragment);
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
return VirtualManager;
|
|
1355
|
+
}();
|
|
1356
|
+
|
|
881
1357
|
/**
|
|
882
1358
|
* All possible @egjs/axes event keys
|
|
883
1359
|
* @internal
|
|
@@ -912,7 +1388,9 @@ var STATE_TYPE;
|
|
|
912
1388
|
*/
|
|
913
1389
|
|
|
914
1390
|
|
|
915
|
-
var State =
|
|
1391
|
+
var State =
|
|
1392
|
+
/*#__PURE__*/
|
|
1393
|
+
function () {
|
|
916
1394
|
function State() {
|
|
917
1395
|
this._delta = 0;
|
|
918
1396
|
this._targetPanel = null;
|
|
@@ -1069,7 +1547,9 @@ var State = function () {
|
|
|
1069
1547
|
* @internal
|
|
1070
1548
|
*/
|
|
1071
1549
|
|
|
1072
|
-
var IdleState =
|
|
1550
|
+
var IdleState =
|
|
1551
|
+
/*#__PURE__*/
|
|
1552
|
+
function (_super) {
|
|
1073
1553
|
__extends(IdleState, _super);
|
|
1074
1554
|
|
|
1075
1555
|
function IdleState() {
|
|
@@ -1156,7 +1636,9 @@ var IdleState = function (_super) {
|
|
|
1156
1636
|
* @internal
|
|
1157
1637
|
*/
|
|
1158
1638
|
|
|
1159
|
-
var HoldingState =
|
|
1639
|
+
var HoldingState =
|
|
1640
|
+
/*#__PURE__*/
|
|
1641
|
+
function (_super) {
|
|
1160
1642
|
__extends(HoldingState, _super);
|
|
1161
1643
|
|
|
1162
1644
|
function HoldingState() {
|
|
@@ -1309,7 +1791,9 @@ var HoldingState = function (_super) {
|
|
|
1309
1791
|
* @internal
|
|
1310
1792
|
*/
|
|
1311
1793
|
|
|
1312
|
-
var DraggingState =
|
|
1794
|
+
var DraggingState =
|
|
1795
|
+
/*#__PURE__*/
|
|
1796
|
+
function (_super) {
|
|
1313
1797
|
__extends(DraggingState, _super);
|
|
1314
1798
|
|
|
1315
1799
|
function DraggingState() {
|
|
@@ -1372,7 +1856,9 @@ var DraggingState = function (_super) {
|
|
|
1372
1856
|
* @internal
|
|
1373
1857
|
*/
|
|
1374
1858
|
|
|
1375
|
-
var AnimatingState =
|
|
1859
|
+
var AnimatingState =
|
|
1860
|
+
/*#__PURE__*/
|
|
1861
|
+
function (_super) {
|
|
1376
1862
|
__extends(AnimatingState, _super);
|
|
1377
1863
|
|
|
1378
1864
|
function AnimatingState() {
|
|
@@ -1446,7 +1932,9 @@ var AnimatingState = function (_super) {
|
|
|
1446
1932
|
* @internal
|
|
1447
1933
|
*/
|
|
1448
1934
|
|
|
1449
|
-
var DisabledState =
|
|
1935
|
+
var DisabledState =
|
|
1936
|
+
/*#__PURE__*/
|
|
1937
|
+
function (_super) {
|
|
1450
1938
|
__extends(DisabledState, _super);
|
|
1451
1939
|
|
|
1452
1940
|
function DisabledState() {
|
|
@@ -1502,7 +1990,9 @@ var DisabledState = function (_super) {
|
|
|
1502
1990
|
* @internal
|
|
1503
1991
|
*/
|
|
1504
1992
|
|
|
1505
|
-
var StateMachine =
|
|
1993
|
+
var StateMachine =
|
|
1994
|
+
/*#__PURE__*/
|
|
1995
|
+
function () {
|
|
1506
1996
|
function StateMachine() {
|
|
1507
1997
|
var _this = this;
|
|
1508
1998
|
|
|
@@ -1591,7 +2081,9 @@ var StateMachine = function () {
|
|
|
1591
2081
|
* @internal
|
|
1592
2082
|
*/
|
|
1593
2083
|
|
|
1594
|
-
var AxesController =
|
|
2084
|
+
var AxesController =
|
|
2085
|
+
/*#__PURE__*/
|
|
2086
|
+
function () {
|
|
1595
2087
|
/** */
|
|
1596
2088
|
function AxesController() {
|
|
1597
2089
|
var _this = this;
|
|
@@ -1874,7 +2366,7 @@ var AxesController = function () {
|
|
|
1874
2366
|
__proto.update = function (controlParams) {
|
|
1875
2367
|
var _a;
|
|
1876
2368
|
|
|
1877
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2369
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
1878
2370
|
var camera = flicking.camera;
|
|
1879
2371
|
var axes = this._axes;
|
|
1880
2372
|
var axis = axes.axis[POSITION_KEY];
|
|
@@ -1892,7 +2384,7 @@ var AxesController = function () {
|
|
|
1892
2384
|
|
|
1893
2385
|
|
|
1894
2386
|
__proto.addPreventClickHandler = function () {
|
|
1895
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2387
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
1896
2388
|
var axes = this._axes;
|
|
1897
2389
|
var cameraEl = flicking.camera.element;
|
|
1898
2390
|
axes.on(EVENT.HOLD, this._onAxesHold);
|
|
@@ -1908,7 +2400,7 @@ var AxesController = function () {
|
|
|
1908
2400
|
|
|
1909
2401
|
|
|
1910
2402
|
__proto.removePreventClickHandler = function () {
|
|
1911
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2403
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
1912
2404
|
var axes = this._axes;
|
|
1913
2405
|
var cameraEl = flicking.camera.element;
|
|
1914
2406
|
axes.off(EVENT.HOLD, this._onAxesHold);
|
|
@@ -1944,17 +2436,25 @@ var AxesController = function () {
|
|
|
1944
2436
|
|
|
1945
2437
|
var _this = this;
|
|
1946
2438
|
|
|
2439
|
+
var _b;
|
|
2440
|
+
|
|
1947
2441
|
var axes = this._axes;
|
|
2442
|
+
var state = this._stateMachine.state;
|
|
1948
2443
|
|
|
1949
2444
|
if (!axes) {
|
|
1950
|
-
return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING
|
|
2445
|
+
return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING));
|
|
1951
2446
|
}
|
|
1952
2447
|
|
|
1953
2448
|
var startPos = axes.get([POSITION_KEY])[POSITION_KEY];
|
|
1954
2449
|
|
|
1955
2450
|
if (startPos === position) {
|
|
1956
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2451
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
1957
2452
|
flicking.camera.lookAt(position);
|
|
2453
|
+
|
|
2454
|
+
if (state.targetPanel) {
|
|
2455
|
+
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_b = axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) !== null && _b !== void 0 ? _b : false);
|
|
2456
|
+
}
|
|
2457
|
+
|
|
1958
2458
|
return Promise.resolve();
|
|
1959
2459
|
}
|
|
1960
2460
|
|
|
@@ -1985,7 +2485,7 @@ var AxesController = function () {
|
|
|
1985
2485
|
};
|
|
1986
2486
|
|
|
1987
2487
|
if (duration === 0) {
|
|
1988
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2488
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
1989
2489
|
var camera = flicking.camera;
|
|
1990
2490
|
animate();
|
|
1991
2491
|
var newPos = flicking.circularEnabled ? circulatePosition(position, camera.range.min, camera.range.max) : position;
|
|
@@ -2030,7 +2530,9 @@ var AxesController = function () {
|
|
|
2030
2530
|
* @ko Flicking의 입력 장치 & 애니메이션을 담당하는 컴포넌트
|
|
2031
2531
|
*/
|
|
2032
2532
|
|
|
2033
|
-
var Control =
|
|
2533
|
+
var Control =
|
|
2534
|
+
/*#__PURE__*/
|
|
2535
|
+
function () {
|
|
2034
2536
|
/** */
|
|
2035
2537
|
function Control() {
|
|
2036
2538
|
this._flicking = null;
|
|
@@ -2174,7 +2676,7 @@ var Control = function () {
|
|
|
2174
2676
|
|
|
2175
2677
|
|
|
2176
2678
|
__proto.updatePosition = function (_progressInPanel) {
|
|
2177
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2679
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2178
2680
|
var camera = flicking.camera;
|
|
2179
2681
|
var activePanel = this._activePanel;
|
|
2180
2682
|
|
|
@@ -2191,7 +2693,7 @@ var Control = function () {
|
|
|
2191
2693
|
|
|
2192
2694
|
|
|
2193
2695
|
__proto.updateInput = function () {
|
|
2194
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2696
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2195
2697
|
var camera = flicking.camera;
|
|
2196
2698
|
|
|
2197
2699
|
this._controller.update(camera.controlParams);
|
|
@@ -2258,7 +2760,7 @@ var Control = function () {
|
|
|
2258
2760
|
return __awaiter(this, void 0, void 0, function () {
|
|
2259
2761
|
var flicking, camera, position, nearestAnchor, camPos_1, camRangeDiff, possiblePositions;
|
|
2260
2762
|
return __generator(this, function (_c) {
|
|
2261
|
-
flicking = getFlickingAttached(this._flicking
|
|
2763
|
+
flicking = getFlickingAttached(this._flicking);
|
|
2262
2764
|
camera = flicking.camera;
|
|
2263
2765
|
position = panel.position;
|
|
2264
2766
|
nearestAnchor = camera.findNearestAnchor(position);
|
|
@@ -2310,7 +2812,7 @@ var Control = function () {
|
|
|
2310
2812
|
__proto.setActive = function (newActivePanel, prevActivePanel, isTrusted) {
|
|
2311
2813
|
var _a;
|
|
2312
2814
|
|
|
2313
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2815
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2314
2816
|
this._activePanel = newActivePanel;
|
|
2315
2817
|
flicking.camera.updateAdaptiveHeight();
|
|
2316
2818
|
|
|
@@ -2333,7 +2835,7 @@ var Control = function () {
|
|
|
2333
2835
|
__proto._triggerIndexChangeEvent = function (panel, position, axesEvent) {
|
|
2334
2836
|
var _a;
|
|
2335
2837
|
|
|
2336
|
-
var flicking = getFlickingAttached(this._flicking
|
|
2838
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2337
2839
|
var triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
|
|
2338
2840
|
var camera = flicking.camera;
|
|
2339
2841
|
var activePanel = this._activePanel;
|
|
@@ -2361,7 +2863,7 @@ var Control = function () {
|
|
|
2361
2863
|
var _this = this;
|
|
2362
2864
|
|
|
2363
2865
|
return __generator(this, function (_b) {
|
|
2364
|
-
flicking = getFlickingAttached(this._flicking
|
|
2866
|
+
flicking = getFlickingAttached(this._flicking);
|
|
2365
2867
|
|
|
2366
2868
|
animate = function () {
|
|
2367
2869
|
return _this._controller.animateTo(position, duration, axesEvent);
|
|
@@ -2411,7 +2913,9 @@ var Control = function () {
|
|
|
2411
2913
|
* A data component that has actual position where the camera should be stopped at
|
|
2412
2914
|
* @ko 카메라가 정지해야하는 실제 위치를 담고 있는 데이터 컴포넌트
|
|
2413
2915
|
*/
|
|
2414
|
-
var AnchorPoint =
|
|
2916
|
+
var AnchorPoint =
|
|
2917
|
+
/*#__PURE__*/
|
|
2918
|
+
function () {
|
|
2415
2919
|
/**
|
|
2416
2920
|
* @param {object} options An options object<ko>옵션 객체</ko>
|
|
2417
2921
|
* @param {number} [options.index] Index of AnchorPoint<ko>AnchorPoint의 인덱스</ko>
|
|
@@ -2475,7 +2979,9 @@ var AnchorPoint = function () {
|
|
|
2475
2979
|
* @ko 입력을 중단한 시점의 가속도에 영향받아 도달할 패널을 계산하는 이동 방식을 사용하는 {@link Control}
|
|
2476
2980
|
*/
|
|
2477
2981
|
|
|
2478
|
-
var SnapControl =
|
|
2982
|
+
var SnapControl =
|
|
2983
|
+
/*#__PURE__*/
|
|
2984
|
+
function (_super) {
|
|
2479
2985
|
__extends(SnapControl, _super);
|
|
2480
2986
|
/** */
|
|
2481
2987
|
|
|
@@ -2549,7 +3055,7 @@ var SnapControl = function (_super) {
|
|
|
2549
3055
|
return __awaiter(this, void 0, void 0, function () {
|
|
2550
3056
|
var flicking, camera, activeAnchor, anchorAtCamera, state, snapThreshold, posDelta, absPosDelta, snapDelta, targetAnchor;
|
|
2551
3057
|
return __generator(this, function (_a) {
|
|
2552
|
-
flicking = getFlickingAttached(this._flicking
|
|
3058
|
+
flicking = getFlickingAttached(this._flicking);
|
|
2553
3059
|
camera = flicking.camera;
|
|
2554
3060
|
activeAnchor = camera.findActiveAnchor();
|
|
2555
3061
|
anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
@@ -2592,7 +3098,7 @@ var SnapControl = function (_super) {
|
|
|
2592
3098
|
};
|
|
2593
3099
|
|
|
2594
3100
|
__proto._findSnappedAnchor = function (position, anchorAtCamera) {
|
|
2595
|
-
var flicking = getFlickingAttached(this._flicking
|
|
3101
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2596
3102
|
var camera = flicking.camera;
|
|
2597
3103
|
var count = this._count;
|
|
2598
3104
|
var currentPos = camera.position;
|
|
@@ -2652,7 +3158,7 @@ var SnapControl = function (_super) {
|
|
|
2652
3158
|
__proto._findAdjacentAnchor = function (posDelta, anchorAtCamera) {
|
|
2653
3159
|
var _a;
|
|
2654
3160
|
|
|
2655
|
-
var flicking = getFlickingAttached(this._flicking
|
|
3161
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2656
3162
|
var camera = flicking.camera;
|
|
2657
3163
|
var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
|
|
2658
3164
|
return adjacentAnchor;
|
|
@@ -2681,7 +3187,9 @@ var SnapControl = function (_super) {
|
|
|
2681
3187
|
* @ko 패널이 정해진 지점에 정렬되지 않고, 자유롭게 스크롤할 수 있는 이동 방식을 사용하는 {@link Control}
|
|
2682
3188
|
*/
|
|
2683
3189
|
|
|
2684
|
-
var FreeControl =
|
|
3190
|
+
var FreeControl =
|
|
3191
|
+
/*#__PURE__*/
|
|
3192
|
+
function (_super) {
|
|
2685
3193
|
__extends(FreeControl, _super);
|
|
2686
3194
|
/** */
|
|
2687
3195
|
|
|
@@ -2726,7 +3234,7 @@ var FreeControl = function (_super) {
|
|
|
2726
3234
|
*/
|
|
2727
3235
|
|
|
2728
3236
|
__proto.updatePosition = function (progressInPanel) {
|
|
2729
|
-
var flicking = getFlickingAttached(this._flicking
|
|
3237
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2730
3238
|
var camera = flicking.camera;
|
|
2731
3239
|
var activePanel = this._activePanel;
|
|
2732
3240
|
|
|
@@ -2778,7 +3286,7 @@ var FreeControl = function (_super) {
|
|
|
2778
3286
|
return __awaiter(this, void 0, void 0, function () {
|
|
2779
3287
|
var flicking, camera, targetPos, anchorAtPosition, targetPanel;
|
|
2780
3288
|
return __generator(this, function (_a) {
|
|
2781
|
-
flicking = getFlickingAttached(this._flicking
|
|
3289
|
+
flicking = getFlickingAttached(this._flicking);
|
|
2782
3290
|
camera = flicking.camera;
|
|
2783
3291
|
targetPos = camera.clampToReachablePosition(position);
|
|
2784
3292
|
anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
@@ -2815,7 +3323,9 @@ var FreeControl = function (_super) {
|
|
|
2815
3323
|
* @ko 한번에 최대로 이동할 패널의 개수를 선택 가능한 {@link Control}
|
|
2816
3324
|
*/
|
|
2817
3325
|
|
|
2818
|
-
var StrictControl =
|
|
3326
|
+
var StrictControl =
|
|
3327
|
+
/*#__PURE__*/
|
|
3328
|
+
function (_super) {
|
|
2819
3329
|
__extends(StrictControl, _super);
|
|
2820
3330
|
/** */
|
|
2821
3331
|
|
|
@@ -2879,7 +3389,7 @@ var StrictControl = function (_super) {
|
|
|
2879
3389
|
__proto.updateInput = function () {
|
|
2880
3390
|
var _a;
|
|
2881
3391
|
|
|
2882
|
-
var flicking = getFlickingAttached(this._flicking
|
|
3392
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
2883
3393
|
var camera = flicking.camera;
|
|
2884
3394
|
var renderer = flicking.renderer;
|
|
2885
3395
|
var controller = this._controller;
|
|
@@ -2988,7 +3498,7 @@ var StrictControl = function (_super) {
|
|
|
2988
3498
|
return __awaiter(this, void 0, void 0, function () {
|
|
2989
3499
|
var flicking, camera, activePanel, axesRange, indexRange, cameraRange, clampedPosition, anchorAtPosition, prevPos, isOverThreshold, adjacentAnchor, targetPos, targetPanel, anchors, firstAnchor, lastAnchor, shouldBounceToFirst, shouldBounceToLast, targetAnchor;
|
|
2990
3500
|
return __generator(this, function (_a) {
|
|
2991
|
-
flicking = getFlickingAttached(this._flicking
|
|
3501
|
+
flicking = getFlickingAttached(this._flicking);
|
|
2992
3502
|
camera = flicking.camera;
|
|
2993
3503
|
activePanel = this._activePanel;
|
|
2994
3504
|
axesRange = this._controller.range;
|
|
@@ -3059,7 +3569,9 @@ var StrictControl = function (_super) {
|
|
|
3059
3569
|
* @ko 뷰포트 내에서의 실제 움직임을 담당하는 컴포넌트
|
|
3060
3570
|
*/
|
|
3061
3571
|
|
|
3062
|
-
var Camera =
|
|
3572
|
+
var Camera =
|
|
3573
|
+
/*#__PURE__*/
|
|
3574
|
+
function () {
|
|
3063
3575
|
/** */
|
|
3064
3576
|
function Camera(_a) {
|
|
3065
3577
|
var _this = this;
|
|
@@ -3115,8 +3627,8 @@ var Camera = function () {
|
|
|
3115
3627
|
// Internal states getter
|
|
3116
3628
|
|
|
3117
3629
|
/**
|
|
3118
|
-
* The camera(`.flicking-camera`)
|
|
3119
|
-
* @ko 카메라(`.flicking-camera`)
|
|
3630
|
+
* The camera element(`.flicking-camera`)
|
|
3631
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)
|
|
3120
3632
|
* @type {HTMLElement}
|
|
3121
3633
|
* @readonly
|
|
3122
3634
|
*/
|
|
@@ -3126,6 +3638,19 @@ var Camera = function () {
|
|
|
3126
3638
|
enumerable: false,
|
|
3127
3639
|
configurable: true
|
|
3128
3640
|
});
|
|
3641
|
+
Object.defineProperty(__proto, "children", {
|
|
3642
|
+
/**
|
|
3643
|
+
* An array of the child elements of the camera element(`.flicking-camera`)
|
|
3644
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)의 자식 엘리먼트 배열
|
|
3645
|
+
* @type {HTMLElement[]}
|
|
3646
|
+
* @readonly
|
|
3647
|
+
*/
|
|
3648
|
+
get: function () {
|
|
3649
|
+
return toArray(this._el.children);
|
|
3650
|
+
},
|
|
3651
|
+
enumerable: false,
|
|
3652
|
+
configurable: true
|
|
3653
|
+
});
|
|
3129
3654
|
Object.defineProperty(__proto, "position", {
|
|
3130
3655
|
/**
|
|
3131
3656
|
* Current position of the camera
|
|
@@ -3172,7 +3697,7 @@ var Camera = function () {
|
|
|
3172
3697
|
* @ko Camera의 {@link Camera#position position}이 도달 가능한 범위
|
|
3173
3698
|
* @type {object}
|
|
3174
3699
|
* @property {number} min A minimum position<ko>최소 위치</ko>
|
|
3175
|
-
* @property {number}
|
|
3700
|
+
* @property {number} max A maximum position<ko>최대 위치</ko>
|
|
3176
3701
|
* @readonly
|
|
3177
3702
|
*/
|
|
3178
3703
|
get: function () {
|
|
@@ -3409,7 +3934,7 @@ var Camera = function () {
|
|
|
3409
3934
|
|
|
3410
3935
|
this._checkReachEnd(prevPos, pos);
|
|
3411
3936
|
|
|
3412
|
-
this.
|
|
3937
|
+
this.applyTransform();
|
|
3413
3938
|
};
|
|
3414
3939
|
/**
|
|
3415
3940
|
* Return a previous {@link AnchorPoint} of given {@link AnchorPoint}
|
|
@@ -3509,7 +4034,7 @@ var Camera = function () {
|
|
|
3509
4034
|
|
|
3510
4035
|
|
|
3511
4036
|
__proto.findActiveAnchor = function () {
|
|
3512
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4037
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3513
4038
|
var activeIndex = flicking.control.activeIndex;
|
|
3514
4039
|
return find(this._anchors, function (anchor) {
|
|
3515
4040
|
return anchor.panel.index === activeIndex;
|
|
@@ -3552,7 +4077,7 @@ var Camera = function () {
|
|
|
3552
4077
|
__proto.canSee = function (panel) {
|
|
3553
4078
|
var visibleRange = this.visibleRange; // Should not include margin, as we don't declare what the margin is visible as what the panel is visible.
|
|
3554
4079
|
|
|
3555
|
-
return panel.
|
|
4080
|
+
return panel.isVisibleOnRange(visibleRange.min, visibleRange.max);
|
|
3556
4081
|
};
|
|
3557
4082
|
/**
|
|
3558
4083
|
* Update Camera's {@link Camera#alignPosition alignPosition}
|
|
@@ -3580,7 +4105,7 @@ var Camera = function () {
|
|
|
3580
4105
|
|
|
3581
4106
|
|
|
3582
4107
|
__proto.updateAnchors = function () {
|
|
3583
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4108
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3584
4109
|
var panels = flicking.renderer.panels;
|
|
3585
4110
|
this._anchors = panels.map(function (panel, index) {
|
|
3586
4111
|
return new AnchorPoint({
|
|
@@ -3603,27 +4128,34 @@ var Camera = function () {
|
|
|
3603
4128
|
|
|
3604
4129
|
|
|
3605
4130
|
__proto.updateAdaptiveHeight = function () {
|
|
3606
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4131
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3607
4132
|
var activePanel = flicking.control.activePanel;
|
|
3608
4133
|
if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
|
|
3609
4134
|
flicking.viewport.setSize({
|
|
3610
4135
|
height: activePanel.height
|
|
3611
4136
|
});
|
|
3612
4137
|
};
|
|
4138
|
+
/**
|
|
4139
|
+
* Update current offset of the camera
|
|
4140
|
+
* @ko 현재 카메라의 오프셋을 업데이트합니다
|
|
4141
|
+
* @chainable
|
|
4142
|
+
* @return {this}
|
|
4143
|
+
*/
|
|
4144
|
+
|
|
3613
4145
|
|
|
3614
4146
|
__proto.updateOffset = function () {
|
|
3615
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4147
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4148
|
+
var position = this._position;
|
|
3616
4149
|
var unRenderedPanels = flicking.panels.filter(function (panel) {
|
|
3617
4150
|
return !panel.rendered;
|
|
3618
4151
|
});
|
|
3619
|
-
var position = this._position;
|
|
3620
4152
|
this._offset = unRenderedPanels.filter(function (panel) {
|
|
3621
4153
|
return panel.position + panel.offset < position;
|
|
3622
4154
|
}).reduce(function (offset, panel) {
|
|
3623
4155
|
return offset + panel.sizeIncludingMargin;
|
|
3624
4156
|
}, 0);
|
|
3625
|
-
|
|
3626
|
-
this
|
|
4157
|
+
this.applyTransform();
|
|
4158
|
+
return this;
|
|
3627
4159
|
};
|
|
3628
4160
|
/**
|
|
3629
4161
|
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
@@ -3640,6 +4172,21 @@ var Camera = function () {
|
|
|
3640
4172
|
};
|
|
3641
4173
|
return this;
|
|
3642
4174
|
};
|
|
4175
|
+
/**
|
|
4176
|
+
* Apply "transform" style with the current position to camera element
|
|
4177
|
+
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
4178
|
+
* @chainable
|
|
4179
|
+
* @return {this}
|
|
4180
|
+
*/
|
|
4181
|
+
|
|
4182
|
+
|
|
4183
|
+
__proto.applyTransform = function () {
|
|
4184
|
+
var el = this._el;
|
|
4185
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4186
|
+
var actualPosition = this._position - this._alignPos - this._offset;
|
|
4187
|
+
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4188
|
+
return this;
|
|
4189
|
+
};
|
|
3643
4190
|
|
|
3644
4191
|
__proto._resetInternalValues = function () {
|
|
3645
4192
|
this._position = 0;
|
|
@@ -3660,7 +4207,7 @@ var Camera = function () {
|
|
|
3660
4207
|
__proto._refreshVisiblePanels = function () {
|
|
3661
4208
|
var _this = this;
|
|
3662
4209
|
|
|
3663
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4210
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3664
4211
|
var panels = flicking.renderer.panels;
|
|
3665
4212
|
var newVisiblePanels = panels.filter(function (panel) {
|
|
3666
4213
|
return _this.canSee(panel);
|
|
@@ -3688,7 +4235,7 @@ var Camera = function () {
|
|
|
3688
4235
|
__proto._checkNeedPanel = function () {
|
|
3689
4236
|
var needPanelTriggered = this._needPanelTriggered;
|
|
3690
4237
|
if (needPanelTriggered.prev && needPanelTriggered.next) return;
|
|
3691
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4238
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3692
4239
|
var panels = flicking.renderer.panels;
|
|
3693
4240
|
|
|
3694
4241
|
if (panels.length <= 0) {
|
|
@@ -3742,7 +4289,7 @@ var Camera = function () {
|
|
|
3742
4289
|
};
|
|
3743
4290
|
|
|
3744
4291
|
__proto._checkReachEnd = function (prevPos, newPos) {
|
|
3745
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4292
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3746
4293
|
var range = this._range;
|
|
3747
4294
|
var wasBetweenRange = prevPos > range.min && prevPos < range.max;
|
|
3748
4295
|
var isBetweenRange = newPos > range.min && newPos < range.max;
|
|
@@ -3753,13 +4300,6 @@ var Camera = function () {
|
|
|
3753
4300
|
}));
|
|
3754
4301
|
};
|
|
3755
4302
|
|
|
3756
|
-
__proto._applyTransform = function () {
|
|
3757
|
-
var el = this._el;
|
|
3758
|
-
var flicking = getFlickingAttached(this._flicking, "Camera");
|
|
3759
|
-
var actualPosition = this._position - this._alignPos - this._offset;
|
|
3760
|
-
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
3761
|
-
};
|
|
3762
|
-
|
|
3763
4303
|
return Camera;
|
|
3764
4304
|
}();
|
|
3765
4305
|
|
|
@@ -3768,7 +4308,9 @@ var Camera = function () {
|
|
|
3768
4308
|
* @ko 첫번째 패널의 좌표로부터 마지막 패널의 좌표로까지 이동할 수 있는 종류의 {@link Camera}
|
|
3769
4309
|
*/
|
|
3770
4310
|
|
|
3771
|
-
var LinearCamera =
|
|
4311
|
+
var LinearCamera =
|
|
4312
|
+
/*#__PURE__*/
|
|
4313
|
+
function (_super) {
|
|
3772
4314
|
__extends(LinearCamera, _super);
|
|
3773
4315
|
|
|
3774
4316
|
function LinearCamera() {
|
|
@@ -3790,7 +4332,7 @@ var LinearCamera = function (_super) {
|
|
|
3790
4332
|
__proto.updateRange = function () {
|
|
3791
4333
|
var _a, _b;
|
|
3792
4334
|
|
|
3793
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4335
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3794
4336
|
var renderer = flicking.renderer;
|
|
3795
4337
|
var firstPanel = renderer.getPanel(0);
|
|
3796
4338
|
var lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
@@ -3809,7 +4351,9 @@ var LinearCamera = function (_super) {
|
|
|
3809
4351
|
* @ko 첫번째 패널과 마지막 패널이 이어진 상태로, 무한히 회전할 수 있는 종류의 {@link Camera}
|
|
3810
4352
|
*/
|
|
3811
4353
|
|
|
3812
|
-
var CircularCamera =
|
|
4354
|
+
var CircularCamera =
|
|
4355
|
+
/*#__PURE__*/
|
|
4356
|
+
function (_super) {
|
|
3813
4357
|
__extends(CircularCamera, _super);
|
|
3814
4358
|
|
|
3815
4359
|
function CircularCamera() {
|
|
@@ -3867,12 +4411,32 @@ var CircularCamera = function (_super) {
|
|
|
3867
4411
|
__proto.findAnchorIncludePosition = function (position) {
|
|
3868
4412
|
if (!this._circularEnabled) return _super.prototype.findAnchorIncludePosition.call(this, position);
|
|
3869
4413
|
var range = this._range;
|
|
4414
|
+
var anchors = this._anchors;
|
|
4415
|
+
var rangeDiff = this.rangeDiff;
|
|
4416
|
+
var anchorCount = anchors.length;
|
|
3870
4417
|
var positionInRange = circulatePosition(position, range.min, range.max);
|
|
3871
4418
|
|
|
3872
4419
|
var anchorInRange = _super.prototype.findAnchorIncludePosition.call(this, positionInRange);
|
|
3873
4420
|
|
|
4421
|
+
if (anchorCount > 0 && (position === range.min || position === range.max)) {
|
|
4422
|
+
var possibleAnchors = [anchorInRange, new AnchorPoint({
|
|
4423
|
+
index: 0,
|
|
4424
|
+
position: anchors[0].position + rangeDiff,
|
|
4425
|
+
panel: anchors[0].panel
|
|
4426
|
+
}), new AnchorPoint({
|
|
4427
|
+
index: anchorCount - 1,
|
|
4428
|
+
position: anchors[anchorCount - 1].position - rangeDiff,
|
|
4429
|
+
panel: anchors[anchorCount - 1].panel
|
|
4430
|
+
})].filter(function (anchor) {
|
|
4431
|
+
return !!anchor;
|
|
4432
|
+
});
|
|
4433
|
+
anchorInRange = possibleAnchors.reduce(function (nearest, anchor) {
|
|
4434
|
+
if (!nearest) return anchor;
|
|
4435
|
+
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
|
|
4436
|
+
}, null);
|
|
4437
|
+
}
|
|
4438
|
+
|
|
3874
4439
|
if (!anchorInRange) return null;
|
|
3875
|
-
var rangeDiff = this.rangeDiff;
|
|
3876
4440
|
|
|
3877
4441
|
if (position < range.min) {
|
|
3878
4442
|
var loopCount = -Math.floor((range.min - position) / rangeDiff) - 1;
|
|
@@ -3917,9 +4481,9 @@ var CircularCamera = function (_super) {
|
|
|
3917
4481
|
|
|
3918
4482
|
|
|
3919
4483
|
if (visibleRange.min < range.min) {
|
|
3920
|
-
return visibleInCurrentRange || panel.
|
|
4484
|
+
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff);
|
|
3921
4485
|
} else if (visibleRange.max > range.max) {
|
|
3922
|
-
return visibleInCurrentRange || panel.
|
|
4486
|
+
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff);
|
|
3923
4487
|
}
|
|
3924
4488
|
|
|
3925
4489
|
return visibleInCurrentRange;
|
|
@@ -3936,7 +4500,7 @@ var CircularCamera = function (_super) {
|
|
|
3936
4500
|
|
|
3937
4501
|
|
|
3938
4502
|
__proto.updateRange = function () {
|
|
3939
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4503
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3940
4504
|
var renderer = flicking.renderer;
|
|
3941
4505
|
var panels = renderer.panels;
|
|
3942
4506
|
|
|
@@ -3972,13 +4536,20 @@ var CircularCamera = function (_super) {
|
|
|
3972
4536
|
};
|
|
3973
4537
|
}
|
|
3974
4538
|
|
|
4539
|
+
this.updateOffset();
|
|
4540
|
+
return this;
|
|
4541
|
+
};
|
|
4542
|
+
|
|
4543
|
+
__proto.updateOffset = function () {
|
|
3975
4544
|
this._updateCircularOffset();
|
|
3976
4545
|
|
|
3977
|
-
return this;
|
|
4546
|
+
return _super.prototype.updateOffset.call(this);
|
|
3978
4547
|
};
|
|
3979
4548
|
|
|
3980
4549
|
__proto.lookAt = function (pos) {
|
|
3981
|
-
var
|
|
4550
|
+
var _this = this;
|
|
4551
|
+
|
|
4552
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3982
4553
|
var prevPos = this._position;
|
|
3983
4554
|
if (pos === prevPos) return _super.prototype.lookAt.call(this, pos);
|
|
3984
4555
|
var panels = flicking.renderer.panels;
|
|
@@ -3987,22 +4558,23 @@ var CircularCamera = function (_super) {
|
|
|
3987
4558
|
});
|
|
3988
4559
|
this._position = pos;
|
|
3989
4560
|
|
|
4561
|
+
_super.prototype.lookAt.call(this, pos);
|
|
4562
|
+
|
|
3990
4563
|
if (toggled.some(function (isToggled) {
|
|
3991
4564
|
return isToggled;
|
|
3992
4565
|
})) {
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
4566
|
+
void flicking.renderer.render().then(function () {
|
|
4567
|
+
_this.updateOffset();
|
|
4568
|
+
});
|
|
3996
4569
|
}
|
|
3997
|
-
|
|
3998
|
-
return _super.prototype.lookAt.call(this, pos);
|
|
3999
4570
|
};
|
|
4000
4571
|
|
|
4001
|
-
__proto.
|
|
4572
|
+
__proto.applyTransform = function () {
|
|
4002
4573
|
var el = this._el;
|
|
4003
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4574
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4004
4575
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4005
4576
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4577
|
+
return this;
|
|
4006
4578
|
};
|
|
4007
4579
|
|
|
4008
4580
|
__proto._resetInternalValues = function () {
|
|
@@ -4024,17 +4596,15 @@ var CircularCamera = function (_super) {
|
|
|
4024
4596
|
return;
|
|
4025
4597
|
}
|
|
4026
4598
|
|
|
4027
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4028
|
-
var
|
|
4029
|
-
var toggledNext = [];
|
|
4030
|
-
flicking.panels.filter(function (panel) {
|
|
4599
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4600
|
+
var toggled = flicking.panels.filter(function (panel) {
|
|
4031
4601
|
return panel.toggled;
|
|
4032
|
-
})
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4602
|
+
});
|
|
4603
|
+
var toggledPrev = toggled.filter(function (panel) {
|
|
4604
|
+
return panel.toggleDirection === DIRECTION.PREV;
|
|
4605
|
+
});
|
|
4606
|
+
var toggledNext = toggled.filter(function (panel) {
|
|
4607
|
+
return panel.toggleDirection === DIRECTION.NEXT;
|
|
4038
4608
|
});
|
|
4039
4609
|
this._circularOffset = this._calcPanelAreaSum(toggledPrev) - this._calcPanelAreaSum(toggledNext);
|
|
4040
4610
|
};
|
|
@@ -4047,7 +4617,9 @@ var CircularCamera = function (_super) {
|
|
|
4047
4617
|
* @ko 첫번째와 마지막 패널 밖으로 넘어가지 못하도록 범위를 설정하여, 첫번째/마지막 패널 전/후의 빈 공간을 보이지 않도록 하는 종류의 {@link Camera}
|
|
4048
4618
|
*/
|
|
4049
4619
|
|
|
4050
|
-
var BoundCamera =
|
|
4620
|
+
var BoundCamera =
|
|
4621
|
+
/*#__PURE__*/
|
|
4622
|
+
function (_super) {
|
|
4051
4623
|
__extends(BoundCamera, _super);
|
|
4052
4624
|
|
|
4053
4625
|
function BoundCamera() {
|
|
@@ -4067,7 +4639,7 @@ var BoundCamera = function (_super) {
|
|
|
4067
4639
|
var __proto = BoundCamera.prototype;
|
|
4068
4640
|
|
|
4069
4641
|
__proto.updateRange = function () {
|
|
4070
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4642
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4071
4643
|
var renderer = flicking.renderer;
|
|
4072
4644
|
var alignPos = this._alignPos;
|
|
4073
4645
|
var firstPanel = renderer.getPanel(0);
|
|
@@ -4110,7 +4682,7 @@ var BoundCamera = function (_super) {
|
|
|
4110
4682
|
__proto.updateAnchors = function () {
|
|
4111
4683
|
var _this = this;
|
|
4112
4684
|
|
|
4113
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4685
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4114
4686
|
var panels = flicking.renderer.panels;
|
|
4115
4687
|
|
|
4116
4688
|
if (panels.length <= 0) {
|
|
@@ -4219,20 +4791,23 @@ var BoundCamera = function (_super) {
|
|
|
4219
4791
|
* @ko {@link Panel}과 그 엘리먼트들을 관리하는 컴포넌트
|
|
4220
4792
|
*/
|
|
4221
4793
|
|
|
4222
|
-
var Renderer =
|
|
4794
|
+
var Renderer =
|
|
4795
|
+
/*#__PURE__*/
|
|
4796
|
+
function () {
|
|
4223
4797
|
/**
|
|
4224
4798
|
* @param {object} options An options object<ko>옵션 오브젝트</ko>
|
|
4225
|
-
* @param {Constants.ALIGN | string | number} [options.align] An {@link Flicking#align align} value that will be applied to all panels<ko>전체 패널에 적용될 {@link Flicking#align align} 값</ko>
|
|
4799
|
+
* @param {Constants.ALIGN | string | number} [options.align="center"] An {@link Flicking#align align} value that will be applied to all panels<ko>전체 패널에 적용될 {@link Flicking#align align} 값</ko>
|
|
4800
|
+
* @param {object} [options.strategy] An instance of RenderingStrategy(internal module)<ko>RenderingStrategy의 인스턴스(내부 모듈)</ko>
|
|
4226
4801
|
*/
|
|
4227
4802
|
function Renderer(_a) {
|
|
4228
|
-
var _b = _a
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4803
|
+
var _b = _a.align,
|
|
4804
|
+
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
4805
|
+
strategy = _a.strategy;
|
|
4232
4806
|
this._flicking = null;
|
|
4233
4807
|
this._panels = []; // Bind options
|
|
4234
4808
|
|
|
4235
4809
|
this._align = align;
|
|
4810
|
+
this._strategy = strategy;
|
|
4236
4811
|
}
|
|
4237
4812
|
|
|
4238
4813
|
var __proto = Renderer.prototype;
|
|
@@ -4265,6 +4840,16 @@ var Renderer = function () {
|
|
|
4265
4840
|
enumerable: false,
|
|
4266
4841
|
configurable: true
|
|
4267
4842
|
});
|
|
4843
|
+
Object.defineProperty(__proto, "strategy", {
|
|
4844
|
+
/**
|
|
4845
|
+
* @internal
|
|
4846
|
+
*/
|
|
4847
|
+
get: function () {
|
|
4848
|
+
return this._strategy;
|
|
4849
|
+
},
|
|
4850
|
+
enumerable: false,
|
|
4851
|
+
configurable: true
|
|
4852
|
+
});
|
|
4268
4853
|
Object.defineProperty(__proto, "align", {
|
|
4269
4854
|
// Options Getter
|
|
4270
4855
|
|
|
@@ -4279,8 +4864,7 @@ var Renderer = function () {
|
|
|
4279
4864
|
// Options Setter
|
|
4280
4865
|
set: function (val) {
|
|
4281
4866
|
this._align = val;
|
|
4282
|
-
|
|
4283
|
-
var panelAlign = this._getPanelAlign();
|
|
4867
|
+
var panelAlign = parsePanelAlign(val);
|
|
4284
4868
|
|
|
4285
4869
|
this._panels.forEach(function (panel) {
|
|
4286
4870
|
panel.align = panelAlign;
|
|
@@ -4326,6 +4910,14 @@ var Renderer = function () {
|
|
|
4326
4910
|
__proto.getPanel = function (index) {
|
|
4327
4911
|
return this._panels[index] || null;
|
|
4328
4912
|
};
|
|
4913
|
+
|
|
4914
|
+
__proto.forceRenderAllPanels = function () {
|
|
4915
|
+
this._panels.forEach(function (panel) {
|
|
4916
|
+
return panel.markForShow();
|
|
4917
|
+
});
|
|
4918
|
+
|
|
4919
|
+
return Promise.resolve();
|
|
4920
|
+
};
|
|
4329
4921
|
/**
|
|
4330
4922
|
* Update all panel sizes
|
|
4331
4923
|
* @ko 모든 패널의 크기를 업데이트합니다
|
|
@@ -4335,10 +4927,15 @@ var Renderer = function () {
|
|
|
4335
4927
|
|
|
4336
4928
|
|
|
4337
4929
|
__proto.updatePanelSize = function () {
|
|
4338
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4930
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4931
|
+
var panels = this._panels;
|
|
4932
|
+
if (panels.length <= 0) return this;
|
|
4339
4933
|
|
|
4340
4934
|
if (flicking.panelsPerView > 0) {
|
|
4341
|
-
|
|
4935
|
+
var firstPanel = panels[0];
|
|
4936
|
+
firstPanel.resize();
|
|
4937
|
+
|
|
4938
|
+
this._updatePanelSizeByGrid(firstPanel, panels);
|
|
4342
4939
|
} else {
|
|
4343
4940
|
flicking.panels.forEach(function (panel) {
|
|
4344
4941
|
return panel.resize();
|
|
@@ -4352,8 +4949,10 @@ var Renderer = function () {
|
|
|
4352
4949
|
* This will increase index of panels after by the number of panels added
|
|
4353
4950
|
* @ko 주어진 인덱스에 새로운 패널들을 추가합니다
|
|
4354
4951
|
* 해당 인덱스보다 같거나 큰 인덱스를 가진 기존 패널들은 추가한 패널의 개수만큼 인덱스가 증가합니다.
|
|
4355
|
-
* @param {
|
|
4356
|
-
* @param {
|
|
4952
|
+
* @param {Array<object>} items An array of items to insert<ko>추가할 아이템들의 배열</ko>
|
|
4953
|
+
* @param {number} [items.index] Index to insert new panels at<ko>새로 패널들을 추가할 인덱스</ko>
|
|
4954
|
+
* @param {any[]} [items.elements] An array of element or framework component with element in it<ko>엘리먼트의 배열 혹은 프레임워크에서 엘리먼트를 포함한 컴포넌트들의 배열</ko>
|
|
4955
|
+
* @param {boolean} [items.hasDOMInElements] Whether it contains actual DOM elements. If set to true, renderer will add them to the camera element<ko>내부에 실제 DOM 엘리먼트들을 포함하고 있는지 여부. true로 설정할 경우, 렌더러는 해당 엘리먼트들을 카메라 엘리먼트 내부에 추가합니다</ko>
|
|
4357
4956
|
* @return {Panel[]} An array of prepended panels<ko>추가된 패널들의 배열</ko>
|
|
4358
4957
|
*/
|
|
4359
4958
|
|
|
@@ -4368,11 +4967,10 @@ var Renderer = function () {
|
|
|
4368
4967
|
}
|
|
4369
4968
|
|
|
4370
4969
|
var panels = this._panels;
|
|
4371
|
-
var flicking = getFlickingAttached(this._flicking
|
|
4970
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4372
4971
|
var control = flicking.control;
|
|
4373
|
-
|
|
4374
|
-
var align = this.
|
|
4375
|
-
|
|
4972
|
+
var prevFirstPanel = panels[0];
|
|
4973
|
+
var align = parsePanelAlign(this._align);
|
|
4376
4974
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
4377
4975
|
var _a;
|
|
4378
4976
|
|
|
@@ -4385,20 +4983,30 @@ var Renderer = function () {
|
|
|
4385
4983
|
flicking: flicking
|
|
4386
4984
|
});
|
|
4387
4985
|
});
|
|
4388
|
-
panels.splice.apply(panels, __spreadArray([insertingIdx, 0], __read(panelsInserted)));
|
|
4986
|
+
panels.splice.apply(panels, __spreadArray([insertingIdx, 0], __read(panelsInserted)));
|
|
4389
4987
|
|
|
4390
|
-
|
|
4988
|
+
if (item.hasDOMInElements) {
|
|
4989
|
+
// Insert the actual elements as camera element's children
|
|
4990
|
+
_this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) !== null && _a !== void 0 ? _a : null);
|
|
4991
|
+
} // Resize the newly added panels
|
|
4391
4992
|
|
|
4392
4993
|
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4994
|
+
if (flicking.panelsPerView > 0) {
|
|
4995
|
+
var firstPanel = prevFirstPanel || panelsInserted[0].resize();
|
|
4996
|
+
|
|
4997
|
+
_this._updatePanelSizeByGrid(firstPanel, panelsInserted);
|
|
4998
|
+
} else {
|
|
4999
|
+
panelsInserted.forEach(function (panel) {
|
|
5000
|
+
return panel.resize();
|
|
5001
|
+
});
|
|
5002
|
+
} // Update panel indexes & positions
|
|
5003
|
+
|
|
4396
5004
|
|
|
4397
5005
|
panelsPushed.forEach(function (panel) {
|
|
4398
5006
|
panel.increaseIndex(panelsInserted.length);
|
|
4399
5007
|
panel.updatePosition();
|
|
4400
5008
|
});
|
|
4401
|
-
return __spreadArray(__spreadArray([], __read(addedPanels)), __read(panelsInserted));
|
|
5009
|
+
return __spreadArray(__spreadArray([], __read(addedPanels), false), __read(panelsInserted));
|
|
4402
5010
|
}, []);
|
|
4403
5011
|
if (allPanelsInserted.length <= 0) return []; // Update camera & control
|
|
4404
5012
|
|
|
@@ -4428,8 +5036,10 @@ var Renderer = function () {
|
|
|
4428
5036
|
* This will decrease index of panels after by the number of panels removed
|
|
4429
5037
|
* @ko 주어진 인덱스의 패널을 제거합니다
|
|
4430
5038
|
* 해당 인덱스보다 큰 인덱스를 가진 기존 패널들은 제거한 패널의 개수만큼 인덱스가 감소합니다
|
|
4431
|
-
* @param {
|
|
4432
|
-
* @param {number} [
|
|
5039
|
+
* @param {Array<object>} items An array of items to remove<ko>제거할 아이템들의 배열</ko>
|
|
5040
|
+
* @param {number} [items.index] Index of panel to remove<ko>제거할 패널의 인덱스</ko>
|
|
5041
|
+
* @param {number} [items.deleteCount=1] Number of panels to remove from index<ko>`index` 이후로 제거할 패널의 개수</ko>
|
|
5042
|
+
* @param {boolean} [items.hasDOMInElements=1] Whether it contains actual DOM elements. If set to true, renderer will remove them from the camera element<ko>내부에 실제 DOM 엘리먼트들을 포함하고 있는지 여부. true로 설정할 경우, 렌더러는 해당 엘리먼트들을 카메라 엘리먼트 내부에서 제거합니다</ko>
|
|
4433
5043
|
* @return An array of removed panels<ko>제거된 패널들의 배열</ko>
|
|
4434
5044
|
*/
|
|
4435
5045
|
|
|
@@ -4444,7 +5054,7 @@ var Renderer = function () {
|
|
|
4444
5054
|
}
|
|
4445
5055
|
|
|
4446
5056
|
var panels = this._panels;
|
|
4447
|
-
var flicking = getFlickingAttached(this._flicking
|
|
5057
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4448
5058
|
var camera = flicking.camera,
|
|
4449
5059
|
control = flicking.control;
|
|
4450
5060
|
var activePanel = control.activePanel;
|
|
@@ -4462,21 +5072,24 @@ var Renderer = function () {
|
|
|
4462
5072
|
panel.updatePosition();
|
|
4463
5073
|
});
|
|
4464
5074
|
|
|
4465
|
-
|
|
5075
|
+
if (item.hasDOMInElements) {
|
|
5076
|
+
_this._removePanelElements(panelsRemoved);
|
|
5077
|
+
} // Remove panel elements
|
|
4466
5078
|
|
|
4467
5079
|
|
|
4468
5080
|
panelsRemoved.forEach(function (panel) {
|
|
4469
5081
|
return panel.destroy();
|
|
4470
|
-
});
|
|
4471
|
-
|
|
4472
|
-
_this._updateCameraAndControl();
|
|
5082
|
+
});
|
|
4473
5083
|
|
|
4474
5084
|
if (includes(panelsRemoved, activePanel)) {
|
|
4475
5085
|
control.resetActive();
|
|
4476
5086
|
}
|
|
4477
5087
|
|
|
4478
|
-
return __spreadArray(__spreadArray([], __read(removed)), __read(panelsRemoved));
|
|
4479
|
-
}, []);
|
|
5088
|
+
return __spreadArray(__spreadArray([], __read(removed), false), __read(panelsRemoved));
|
|
5089
|
+
}, []); // Update camera & control
|
|
5090
|
+
|
|
5091
|
+
this._updateCameraAndControl();
|
|
5092
|
+
|
|
4480
5093
|
void this.render(); // FIXME: fix for animating case
|
|
4481
5094
|
|
|
4482
5095
|
if (allPanelsRemoved.length > 0 && !control.animating) {
|
|
@@ -4509,9 +5122,10 @@ var Renderer = function () {
|
|
|
4509
5122
|
__proto.checkPanelContentsReady = function (checkingPanels) {
|
|
4510
5123
|
var _this = this;
|
|
4511
5124
|
|
|
4512
|
-
var
|
|
5125
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5126
|
+
var resizeOnContentsReady = flicking.resizeOnContentsReady;
|
|
4513
5127
|
var panels = this._panels;
|
|
4514
|
-
if (!resizeOnContentsReady) return;
|
|
5128
|
+
if (!resizeOnContentsReady || flicking.virtualEnabled) return;
|
|
4515
5129
|
|
|
4516
5130
|
var hasContents = function (panel) {
|
|
4517
5131
|
return !!panel.element.querySelector("img, video");
|
|
@@ -4526,9 +5140,7 @@ var Renderer = function () {
|
|
|
4526
5140
|
panel.loading = true;
|
|
4527
5141
|
});
|
|
4528
5142
|
contentsReadyChecker.on("readyElement", function (e) {
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
if (!flicking) {
|
|
5143
|
+
if (!_this._flicking) {
|
|
4532
5144
|
// Renderer's destroy() is called before
|
|
4533
5145
|
contentsReadyChecker.destroy();
|
|
4534
5146
|
return;
|
|
@@ -4573,13 +5185,8 @@ var Renderer = function () {
|
|
|
4573
5185
|
}));
|
|
4574
5186
|
};
|
|
4575
5187
|
|
|
4576
|
-
__proto._getPanelAlign = function () {
|
|
4577
|
-
var align = this._align;
|
|
4578
|
-
return typeof align === "object" ? align.panel : align;
|
|
4579
|
-
};
|
|
4580
|
-
|
|
4581
5188
|
__proto._updateCameraAndControl = function () {
|
|
4582
|
-
var flicking = getFlickingAttached(this._flicking
|
|
5189
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4583
5190
|
var camera = flicking.camera,
|
|
4584
5191
|
control = flicking.control;
|
|
4585
5192
|
camera.updateRange();
|
|
@@ -4588,18 +5195,6 @@ var Renderer = function () {
|
|
|
4588
5195
|
control.updateInput();
|
|
4589
5196
|
};
|
|
4590
5197
|
|
|
4591
|
-
__proto._updateRenderingPanels = function () {
|
|
4592
|
-
var flicking = getFlickingAttached(this._flicking, "Renderer");
|
|
4593
|
-
|
|
4594
|
-
if (flicking.renderOnlyVisible) {
|
|
4595
|
-
this._showOnlyVisiblePanels(flicking);
|
|
4596
|
-
} else {
|
|
4597
|
-
flicking.panels.forEach(function (panel) {
|
|
4598
|
-
return panel.markForShow();
|
|
4599
|
-
});
|
|
4600
|
-
}
|
|
4601
|
-
};
|
|
4602
|
-
|
|
4603
5198
|
__proto._showOnlyVisiblePanels = function (flicking) {
|
|
4604
5199
|
var panels = flicking.renderer.panels;
|
|
4605
5200
|
var camera = flicking.camera;
|
|
@@ -4616,23 +5211,19 @@ var Renderer = function () {
|
|
|
4616
5211
|
panel.markForHide();
|
|
4617
5212
|
}
|
|
4618
5213
|
});
|
|
4619
|
-
camera.updateOffset();
|
|
4620
5214
|
};
|
|
4621
5215
|
|
|
4622
|
-
__proto._updatePanelSizeByGrid = function (
|
|
4623
|
-
var
|
|
5216
|
+
__proto._updatePanelSizeByGrid = function (referencePanel, panels) {
|
|
5217
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4624
5218
|
var panelsPerView = flicking.panelsPerView;
|
|
4625
5219
|
|
|
4626
5220
|
if (panelsPerView <= 0) {
|
|
4627
5221
|
throw new FlickingError(MESSAGE.WRONG_OPTION("panelsPerView", panelsPerView), CODE.WRONG_OPTION);
|
|
4628
5222
|
}
|
|
4629
5223
|
|
|
4630
|
-
if (panels.length <= 0) return;
|
|
4631
|
-
|
|
4632
|
-
var firstPanel = panels[0];
|
|
4633
|
-
firstPanel.resize();
|
|
5224
|
+
if (panels.length <= 0) return;
|
|
4634
5225
|
var viewportSize = flicking.camera.size;
|
|
4635
|
-
var gap =
|
|
5226
|
+
var gap = referencePanel.margin.prev + referencePanel.margin.next;
|
|
4636
5227
|
var panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
|
|
4637
5228
|
var panelSizeObj = flicking.horizontal ? {
|
|
4638
5229
|
width: panelSize
|
|
@@ -4641,14 +5232,12 @@ var Renderer = function () {
|
|
|
4641
5232
|
};
|
|
4642
5233
|
var firstPanelSizeObj = {
|
|
4643
5234
|
size: panelSize,
|
|
4644
|
-
height:
|
|
4645
|
-
margin:
|
|
5235
|
+
height: referencePanel.height,
|
|
5236
|
+
margin: referencePanel.margin
|
|
4646
5237
|
};
|
|
4647
5238
|
|
|
4648
5239
|
if (!flicking.noPanelStyleOverride) {
|
|
4649
|
-
|
|
4650
|
-
return panel.setSize(panelSizeObj);
|
|
4651
|
-
});
|
|
5240
|
+
this._strategy.updatePanelSizes(flicking, panelSizeObj);
|
|
4652
5241
|
}
|
|
4653
5242
|
|
|
4654
5243
|
flicking.panels.forEach(function (panel) {
|
|
@@ -4656,30 +5245,202 @@ var Renderer = function () {
|
|
|
4656
5245
|
});
|
|
4657
5246
|
};
|
|
4658
5247
|
|
|
5248
|
+
__proto._removeAllChildsFromCamera = function () {
|
|
5249
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5250
|
+
var cameraElement = flicking.camera.element; // Remove other elements
|
|
5251
|
+
|
|
5252
|
+
while (cameraElement.firstChild) {
|
|
5253
|
+
cameraElement.removeChild(cameraElement.firstChild);
|
|
5254
|
+
}
|
|
5255
|
+
};
|
|
5256
|
+
|
|
5257
|
+
__proto._insertPanelElements = function (panels, nextSibling) {
|
|
5258
|
+
if (nextSibling === void 0) {
|
|
5259
|
+
nextSibling = null;
|
|
5260
|
+
}
|
|
5261
|
+
|
|
5262
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5263
|
+
var camera = flicking.camera;
|
|
5264
|
+
var cameraElement = camera.element;
|
|
5265
|
+
var nextSiblingElement = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.element) || null;
|
|
5266
|
+
var fragment = document.createDocumentFragment();
|
|
5267
|
+
panels.forEach(function (panel) {
|
|
5268
|
+
return fragment.appendChild(panel.element);
|
|
5269
|
+
});
|
|
5270
|
+
cameraElement.insertBefore(fragment, nextSiblingElement);
|
|
5271
|
+
};
|
|
5272
|
+
|
|
5273
|
+
__proto._removePanelElements = function (panels) {
|
|
5274
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5275
|
+
var cameraElement = flicking.camera.element;
|
|
5276
|
+
panels.forEach(function (panel) {
|
|
5277
|
+
cameraElement.removeChild(panel.element);
|
|
5278
|
+
});
|
|
5279
|
+
};
|
|
5280
|
+
|
|
4659
5281
|
return Renderer;
|
|
4660
5282
|
}();
|
|
4661
5283
|
|
|
4662
|
-
|
|
5284
|
+
/**
|
|
5285
|
+
*
|
|
5286
|
+
*/
|
|
5287
|
+
|
|
5288
|
+
var VanillaRenderer =
|
|
5289
|
+
/*#__PURE__*/
|
|
5290
|
+
function (_super) {
|
|
5291
|
+
__extends(VanillaRenderer, _super);
|
|
5292
|
+
|
|
5293
|
+
function VanillaRenderer() {
|
|
5294
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
5295
|
+
} // eslint-disable-next-line @typescript-eslint/require-await
|
|
5296
|
+
|
|
5297
|
+
|
|
5298
|
+
var __proto = VanillaRenderer.prototype;
|
|
5299
|
+
|
|
5300
|
+
__proto.render = function () {
|
|
5301
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5302
|
+
var flicking, strategy;
|
|
5303
|
+
return __generator(this, function (_a) {
|
|
5304
|
+
flicking = getFlickingAttached(this._flicking);
|
|
5305
|
+
strategy = this._strategy;
|
|
5306
|
+
strategy.updateRenderingPanels(flicking);
|
|
5307
|
+
strategy.renderPanels(flicking);
|
|
5308
|
+
|
|
5309
|
+
this._resetPanelElementOrder();
|
|
5310
|
+
|
|
5311
|
+
return [2
|
|
5312
|
+
/*return*/
|
|
5313
|
+
];
|
|
5314
|
+
});
|
|
5315
|
+
});
|
|
5316
|
+
};
|
|
5317
|
+
|
|
5318
|
+
__proto._collectPanels = function () {
|
|
5319
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5320
|
+
var camera = flicking.camera;
|
|
5321
|
+
|
|
5322
|
+
this._removeAllTextNodes();
|
|
5323
|
+
|
|
5324
|
+
this._panels = this._strategy.collectPanels(flicking, camera.children);
|
|
5325
|
+
};
|
|
5326
|
+
|
|
5327
|
+
__proto._createPanel = function (el, options) {
|
|
5328
|
+
return this._strategy.createPanel(el, options);
|
|
5329
|
+
};
|
|
5330
|
+
|
|
5331
|
+
__proto._resetPanelElementOrder = function () {
|
|
5332
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5333
|
+
var cameraEl = flicking.camera.element; // We're using reversed panels here as last panel should be the last element of camera element
|
|
5334
|
+
|
|
5335
|
+
var reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
|
|
5336
|
+
|
|
5337
|
+
reversedElements.forEach(function (el, idx) {
|
|
5338
|
+
var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
|
|
5339
|
+
|
|
5340
|
+
if (el.nextElementSibling !== nextEl) {
|
|
5341
|
+
cameraEl.insertBefore(el, nextEl);
|
|
5342
|
+
}
|
|
5343
|
+
});
|
|
5344
|
+
};
|
|
5345
|
+
|
|
5346
|
+
__proto._removeAllTextNodes = function () {
|
|
5347
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5348
|
+
var cameraElement = flicking.camera.element; // Remove all text nodes in the camera element
|
|
5349
|
+
|
|
5350
|
+
toArray(cameraElement.childNodes).forEach(function (node) {
|
|
5351
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
5352
|
+
cameraElement.removeChild(node);
|
|
5353
|
+
}
|
|
5354
|
+
});
|
|
5355
|
+
};
|
|
5356
|
+
|
|
5357
|
+
return VanillaRenderer;
|
|
5358
|
+
}(Renderer);
|
|
5359
|
+
|
|
5360
|
+
/**
|
|
5361
|
+
* @internal
|
|
5362
|
+
*/
|
|
5363
|
+
|
|
5364
|
+
var ExternalRenderer =
|
|
5365
|
+
/*#__PURE__*/
|
|
5366
|
+
function (_super) {
|
|
5367
|
+
__extends(ExternalRenderer, _super);
|
|
5368
|
+
|
|
5369
|
+
function ExternalRenderer() {
|
|
5370
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
5371
|
+
}
|
|
5372
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5373
|
+
|
|
5374
|
+
|
|
5375
|
+
var __proto = ExternalRenderer.prototype;
|
|
5376
|
+
|
|
5377
|
+
__proto._removePanelElements = function (panels) {// DO NOTHING, overrided to prevent an unexpected error
|
|
5378
|
+
};
|
|
5379
|
+
|
|
5380
|
+
__proto._removeAllChildsFromCamera = function () {// DO NOTHING, overrided to prevent an unexpected error
|
|
5381
|
+
};
|
|
5382
|
+
|
|
5383
|
+
return ExternalRenderer;
|
|
5384
|
+
}(Renderer);
|
|
5385
|
+
|
|
5386
|
+
/**
|
|
5387
|
+
* A slide data component that holds information of a single HTMLElement
|
|
5388
|
+
* @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
|
|
5389
|
+
*/
|
|
5390
|
+
|
|
5391
|
+
var Panel =
|
|
5392
|
+
/*#__PURE__*/
|
|
5393
|
+
function () {
|
|
4663
5394
|
/**
|
|
4664
5395
|
* @param {object} options An options object<ko>옵션 오브젝트</ko>
|
|
4665
5396
|
* @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
|
|
4666
5397
|
* @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
|
|
4667
5398
|
* @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
|
|
5399
|
+
* @param {Flicking} [options.elementProvider] A provider instance that redirects elements<ko>실제 엘리먼트를 반환하는 엘리먼트 공급자의 인스턴스</ko>
|
|
4668
5400
|
*/
|
|
4669
5401
|
function Panel(_a) {
|
|
4670
5402
|
var index = _a.index,
|
|
4671
5403
|
align = _a.align,
|
|
4672
|
-
flicking = _a.flicking
|
|
5404
|
+
flicking = _a.flicking,
|
|
5405
|
+
elementProvider = _a.elementProvider;
|
|
4673
5406
|
this._index = index;
|
|
4674
5407
|
this._flicking = flicking;
|
|
5408
|
+
this._elProvider = elementProvider;
|
|
4675
5409
|
this._align = align;
|
|
4676
5410
|
this._removed = false;
|
|
5411
|
+
this._rendered = true;
|
|
4677
5412
|
this._loading = false;
|
|
4678
5413
|
|
|
4679
5414
|
this._resetInternalStates();
|
|
4680
5415
|
}
|
|
4681
5416
|
|
|
4682
5417
|
var __proto = Panel.prototype;
|
|
5418
|
+
Object.defineProperty(__proto, "element", {
|
|
5419
|
+
// Internal States Getter
|
|
5420
|
+
|
|
5421
|
+
/**
|
|
5422
|
+
* `HTMLElement` that panel's referencing
|
|
5423
|
+
* @ko 패널이 참조하고 있는 `HTMLElement`
|
|
5424
|
+
* @type {HTMLElement}
|
|
5425
|
+
* @readonly
|
|
5426
|
+
*/
|
|
5427
|
+
get: function () {
|
|
5428
|
+
return this._elProvider.element;
|
|
5429
|
+
},
|
|
5430
|
+
enumerable: false,
|
|
5431
|
+
configurable: true
|
|
5432
|
+
});
|
|
5433
|
+
Object.defineProperty(__proto, "elementProvider", {
|
|
5434
|
+
/**
|
|
5435
|
+
* @internal
|
|
5436
|
+
* @readonly
|
|
5437
|
+
*/
|
|
5438
|
+
get: function () {
|
|
5439
|
+
return this._elProvider;
|
|
5440
|
+
},
|
|
5441
|
+
enumerable: false,
|
|
5442
|
+
configurable: true
|
|
5443
|
+
});
|
|
4683
5444
|
Object.defineProperty(__proto, "index", {
|
|
4684
5445
|
/**
|
|
4685
5446
|
* Index of the panel
|
|
@@ -4792,6 +5553,19 @@ var Panel = function () {
|
|
|
4792
5553
|
enumerable: false,
|
|
4793
5554
|
configurable: true
|
|
4794
5555
|
});
|
|
5556
|
+
Object.defineProperty(__proto, "rendered", {
|
|
5557
|
+
/**
|
|
5558
|
+
* A value indicating whether the panel's element is being rendered on the screen
|
|
5559
|
+
* @ko 패널의 엘리먼트가 화면상에 렌더링되고있는지 여부를 나타내는 값
|
|
5560
|
+
* @type {boolean}
|
|
5561
|
+
* @readonly
|
|
5562
|
+
*/
|
|
5563
|
+
get: function () {
|
|
5564
|
+
return this._rendered;
|
|
5565
|
+
},
|
|
5566
|
+
enumerable: false,
|
|
5567
|
+
configurable: true
|
|
5568
|
+
});
|
|
4795
5569
|
Object.defineProperty(__proto, "loading", {
|
|
4796
5570
|
/**
|
|
4797
5571
|
* A value indicating whether the panel's image/video is not loaded and waiting for resize
|
|
@@ -4963,6 +5737,27 @@ var Panel = function () {
|
|
|
4963
5737
|
enumerable: false,
|
|
4964
5738
|
configurable: true
|
|
4965
5739
|
});
|
|
5740
|
+
/**
|
|
5741
|
+
* Mark panel element to be appended on the camera element
|
|
5742
|
+
* @internal
|
|
5743
|
+
*/
|
|
5744
|
+
|
|
5745
|
+
__proto.markForShow = function () {
|
|
5746
|
+
this._rendered = true;
|
|
5747
|
+
|
|
5748
|
+
this._elProvider.show(this._flicking);
|
|
5749
|
+
};
|
|
5750
|
+
/**
|
|
5751
|
+
* Mark panel element to be removed from the camera element
|
|
5752
|
+
* @internal
|
|
5753
|
+
*/
|
|
5754
|
+
|
|
5755
|
+
|
|
5756
|
+
__proto.markForHide = function () {
|
|
5757
|
+
this._rendered = false;
|
|
5758
|
+
|
|
5759
|
+
this._elProvider.hide(this._flicking);
|
|
5760
|
+
};
|
|
4966
5761
|
/**
|
|
4967
5762
|
* Update size of the panel
|
|
4968
5763
|
* @ko 패널의 크기를 갱신합니다
|
|
@@ -4971,9 +5766,9 @@ var Panel = function () {
|
|
|
4971
5766
|
* @return {this}
|
|
4972
5767
|
*/
|
|
4973
5768
|
|
|
5769
|
+
|
|
4974
5770
|
__proto.resize = function (cached) {
|
|
4975
5771
|
var el = this.element;
|
|
4976
|
-
var elStyle = getStyle(el);
|
|
4977
5772
|
var flicking = this._flicking;
|
|
4978
5773
|
var horizontal = flicking.horizontal;
|
|
4979
5774
|
|
|
@@ -4982,6 +5777,7 @@ var Panel = function () {
|
|
|
4982
5777
|
this._margin = __assign({}, cached.margin);
|
|
4983
5778
|
this._height = cached.height;
|
|
4984
5779
|
} else {
|
|
5780
|
+
var elStyle = getStyle(el);
|
|
4985
5781
|
this._size = horizontal ? el.offsetWidth : el.offsetHeight;
|
|
4986
5782
|
this._margin = horizontal ? {
|
|
4987
5783
|
prev: parseFloat(elStyle.marginLeft || "0"),
|
|
@@ -5010,27 +5806,8 @@ var Panel = function () {
|
|
|
5010
5806
|
*/
|
|
5011
5807
|
|
|
5012
5808
|
|
|
5013
|
-
__proto.setSize = function (
|
|
5014
|
-
|
|
5015
|
-
height = _a.height;
|
|
5016
|
-
var el = this.element;
|
|
5017
|
-
|
|
5018
|
-
if (width != null) {
|
|
5019
|
-
if (isString(width)) {
|
|
5020
|
-
el.style.width = width;
|
|
5021
|
-
} else {
|
|
5022
|
-
el.style.width = width + "px";
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
|
|
5026
|
-
if (height != null) {
|
|
5027
|
-
if (isString(height)) {
|
|
5028
|
-
el.style.height = height;
|
|
5029
|
-
} else {
|
|
5030
|
-
el.style.height = height + "px";
|
|
5031
|
-
}
|
|
5032
|
-
}
|
|
5033
|
-
|
|
5809
|
+
__proto.setSize = function (size) {
|
|
5810
|
+
setSize(this.element, size);
|
|
5034
5811
|
return this;
|
|
5035
5812
|
};
|
|
5036
5813
|
/**
|
|
@@ -5075,7 +5852,7 @@ var Panel = function () {
|
|
|
5075
5852
|
return this.includeRange(pos, pos, includeMargin);
|
|
5076
5853
|
};
|
|
5077
5854
|
/**
|
|
5078
|
-
* Check whether the given range is fully included in this panel's area
|
|
5855
|
+
* Check whether the given range is fully included in this panel's area (inclusive)
|
|
5079
5856
|
* @ko 주어진 범위가 이 패널 내부에 완전히 포함되는지를 반환합니다
|
|
5080
5857
|
* @param {number} min Minimum value of the range to check<ko>확인하고자 하는 최소 범위</ko>
|
|
5081
5858
|
* @param {number} max Maximum value of the range to check<ko>확인하고자 하는 최대 범위</ko>
|
|
@@ -5099,6 +5876,19 @@ var Panel = function () {
|
|
|
5099
5876
|
|
|
5100
5877
|
return max >= panelRange.min && min <= panelRange.max;
|
|
5101
5878
|
};
|
|
5879
|
+
/**
|
|
5880
|
+
* Check whether the panel is visble in the given range (exclusive)
|
|
5881
|
+
* @ko 주어진 범위 내에서 이 패널의 일부가 보여지는지를 반환합니다
|
|
5882
|
+
* @param {number} min Minimum value of the range to check<ko>확인하고자 하는 최소 범위</ko>
|
|
5883
|
+
* @param {number} max Maximum value of the range to check<ko>확인하고자 하는 최대 범위</ko>
|
|
5884
|
+
* @returns {boolean} A Boolean value indicating whether the panel is visible<ko>해당 범위 내에서 패널을 볼 수 있는지 여부</ko>
|
|
5885
|
+
*/
|
|
5886
|
+
|
|
5887
|
+
|
|
5888
|
+
__proto.isVisibleOnRange = function (min, max) {
|
|
5889
|
+
var panelRange = this.range;
|
|
5890
|
+
return max > panelRange.min && min < panelRange.max;
|
|
5891
|
+
};
|
|
5102
5892
|
/**
|
|
5103
5893
|
* Move {@link Camera} to this panel
|
|
5104
5894
|
* @ko {@link Camera}를 이 패널로 이동합니다
|
|
@@ -5265,7 +6055,103 @@ var Panel = function () {
|
|
|
5265
6055
|
this._toggleDirection = DIRECTION.NONE;
|
|
5266
6056
|
};
|
|
5267
6057
|
|
|
5268
|
-
return Panel;
|
|
6058
|
+
return Panel;
|
|
6059
|
+
}();
|
|
6060
|
+
|
|
6061
|
+
var NormalRenderingStrategy =
|
|
6062
|
+
/*#__PURE__*/
|
|
6063
|
+
function () {
|
|
6064
|
+
function NormalRenderingStrategy(_a) {
|
|
6065
|
+
var providerCtor = _a.providerCtor;
|
|
6066
|
+
this._providerCtor = providerCtor;
|
|
6067
|
+
}
|
|
6068
|
+
|
|
6069
|
+
var __proto = NormalRenderingStrategy.prototype;
|
|
6070
|
+
|
|
6071
|
+
__proto.renderPanels = function () {// DO_NOTHING
|
|
6072
|
+
};
|
|
6073
|
+
|
|
6074
|
+
__proto.getRenderingIndexesByOrder = function (flicking) {
|
|
6075
|
+
var renderedPanels = flicking.renderer.panels.filter(function (panel) {
|
|
6076
|
+
return panel.rendered;
|
|
6077
|
+
});
|
|
6078
|
+
var toggledPrev = renderedPanels.filter(function (panel) {
|
|
6079
|
+
return panel.toggled && panel.toggleDirection === DIRECTION.PREV;
|
|
6080
|
+
});
|
|
6081
|
+
var toggledNext = renderedPanels.filter(function (panel) {
|
|
6082
|
+
return panel.toggled && panel.toggleDirection === DIRECTION.NEXT;
|
|
6083
|
+
});
|
|
6084
|
+
var notToggled = renderedPanels.filter(function (panel) {
|
|
6085
|
+
return !panel.toggled;
|
|
6086
|
+
});
|
|
6087
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(toggledPrev), false), __read(notToggled), false), __read(toggledNext)).map(function (panel) {
|
|
6088
|
+
return panel.index;
|
|
6089
|
+
});
|
|
6090
|
+
};
|
|
6091
|
+
|
|
6092
|
+
__proto.getRenderingElementsByOrder = function (flicking) {
|
|
6093
|
+
var panels = flicking.panels;
|
|
6094
|
+
return this.getRenderingIndexesByOrder(flicking).map(function (index) {
|
|
6095
|
+
return panels[index].element;
|
|
6096
|
+
});
|
|
6097
|
+
};
|
|
6098
|
+
|
|
6099
|
+
__proto.updateRenderingPanels = function (flicking) {
|
|
6100
|
+
if (flicking.renderOnlyVisible) {
|
|
6101
|
+
this._showOnlyVisiblePanels(flicking);
|
|
6102
|
+
} else {
|
|
6103
|
+
flicking.panels.forEach(function (panel) {
|
|
6104
|
+
return panel.markForShow();
|
|
6105
|
+
});
|
|
6106
|
+
}
|
|
6107
|
+
};
|
|
6108
|
+
|
|
6109
|
+
__proto.collectPanels = function (flicking, elements) {
|
|
6110
|
+
var _this = this;
|
|
6111
|
+
|
|
6112
|
+
var align = parsePanelAlign(flicking.renderer.align);
|
|
6113
|
+
return elements.map(function (el, index) {
|
|
6114
|
+
return new Panel({
|
|
6115
|
+
index: index,
|
|
6116
|
+
elementProvider: new _this._providerCtor(el),
|
|
6117
|
+
align: align,
|
|
6118
|
+
flicking: flicking
|
|
6119
|
+
});
|
|
6120
|
+
});
|
|
6121
|
+
};
|
|
6122
|
+
|
|
6123
|
+
__proto.createPanel = function (element, options) {
|
|
6124
|
+
return new Panel(__assign(__assign({}, options), {
|
|
6125
|
+
elementProvider: new this._providerCtor(element)
|
|
6126
|
+
}));
|
|
6127
|
+
};
|
|
6128
|
+
|
|
6129
|
+
__proto.updatePanelSizes = function (flicking, size) {
|
|
6130
|
+
flicking.panels.forEach(function (panel) {
|
|
6131
|
+
return panel.setSize(size);
|
|
6132
|
+
});
|
|
6133
|
+
};
|
|
6134
|
+
|
|
6135
|
+
__proto._showOnlyVisiblePanels = function (flicking) {
|
|
6136
|
+
var panels = flicking.renderer.panels;
|
|
6137
|
+
var camera = flicking.camera;
|
|
6138
|
+
var visibleIndexes = camera.visiblePanels.reduce(function (visibles, panel) {
|
|
6139
|
+
visibles[panel.index] = true;
|
|
6140
|
+
return visibles;
|
|
6141
|
+
}, {});
|
|
6142
|
+
panels.forEach(function (panel) {
|
|
6143
|
+
if (panel.index in visibleIndexes || panel.loading) {
|
|
6144
|
+
panel.markForShow();
|
|
6145
|
+
} else if (!flicking.holding) {
|
|
6146
|
+
// During the input sequence,
|
|
6147
|
+
// Do not remove panel elements as it won't trigger touchend event.
|
|
6148
|
+
panel.markForHide();
|
|
6149
|
+
}
|
|
6150
|
+
});
|
|
6151
|
+
camera.updateOffset();
|
|
6152
|
+
};
|
|
6153
|
+
|
|
6154
|
+
return NormalRenderingStrategy;
|
|
5269
6155
|
}();
|
|
5270
6156
|
|
|
5271
6157
|
/**
|
|
@@ -5273,26 +6159,28 @@ var Panel = function () {
|
|
|
5273
6159
|
* @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
|
|
5274
6160
|
*/
|
|
5275
6161
|
|
|
5276
|
-
var
|
|
5277
|
-
|
|
6162
|
+
var VirtualPanel =
|
|
6163
|
+
/*#__PURE__*/
|
|
6164
|
+
function (_super) {
|
|
6165
|
+
__extends(VirtualPanel, _super);
|
|
5278
6166
|
/**
|
|
5279
6167
|
* @param {object} options An options object<ko>옵션 오브젝트</ko>
|
|
5280
|
-
* @param {HTMLElement} [options.el] A `HTMLElement` panel's referencing<ko>패널이 참조하는 `HTMLElement`</ko>
|
|
5281
6168
|
* @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
|
|
5282
6169
|
* @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
|
|
5283
6170
|
* @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
|
|
5284
6171
|
*/
|
|
5285
6172
|
|
|
5286
6173
|
|
|
5287
|
-
function
|
|
6174
|
+
function VirtualPanel(options) {
|
|
5288
6175
|
var _this = _super.call(this, options) || this;
|
|
5289
6176
|
|
|
5290
|
-
|
|
5291
|
-
_this.
|
|
6177
|
+
options.elementProvider.init(_this);
|
|
6178
|
+
_this._elProvider = options.elementProvider;
|
|
6179
|
+
_this._cachedInnerHTML = null;
|
|
5292
6180
|
return _this;
|
|
5293
6181
|
}
|
|
5294
6182
|
|
|
5295
|
-
var __proto =
|
|
6183
|
+
var __proto = VirtualPanel.prototype;
|
|
5296
6184
|
Object.defineProperty(__proto, "element", {
|
|
5297
6185
|
/**
|
|
5298
6186
|
* `HTMLElement` that panel's referencing
|
|
@@ -5301,211 +6189,189 @@ var ElementPanel = function (_super) {
|
|
|
5301
6189
|
* @readonly
|
|
5302
6190
|
*/
|
|
5303
6191
|
get: function () {
|
|
5304
|
-
return this.
|
|
6192
|
+
return this._elProvider.element;
|
|
5305
6193
|
},
|
|
5306
6194
|
enumerable: false,
|
|
5307
6195
|
configurable: true
|
|
5308
6196
|
});
|
|
5309
|
-
Object.defineProperty(__proto, "
|
|
6197
|
+
Object.defineProperty(__proto, "cachedInnerHTML", {
|
|
6198
|
+
/**
|
|
6199
|
+
* Cached innerHTML by the previous render function
|
|
6200
|
+
* @ko 이전 렌더링에서 캐시된 innerHTML 정보
|
|
6201
|
+
* @type {string|null}
|
|
6202
|
+
* @readonly
|
|
6203
|
+
*/
|
|
5310
6204
|
get: function () {
|
|
5311
|
-
return this.
|
|
6205
|
+
return this._cachedInnerHTML;
|
|
5312
6206
|
},
|
|
5313
6207
|
enumerable: false,
|
|
5314
6208
|
configurable: true
|
|
5315
6209
|
});
|
|
6210
|
+
Object.defineProperty(__proto, "elementIndex", {
|
|
6211
|
+
/**
|
|
6212
|
+
* An number for indexing which element it will be rendered on
|
|
6213
|
+
* @ko 몇 번째 엘리먼트에 렌더링될 것인지를 나타내는 숫자
|
|
6214
|
+
* @type {number}
|
|
6215
|
+
* @readonly
|
|
6216
|
+
*/
|
|
6217
|
+
get: function () {
|
|
6218
|
+
var flicking = this._flicking;
|
|
6219
|
+
var virtualElCount = flicking.panelsPerView + 1;
|
|
6220
|
+
var panelCount = flicking.panelCount;
|
|
6221
|
+
var index = this._index;
|
|
5316
6222
|
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
__proto.markForHide = function () {
|
|
5322
|
-
this._rendered = false;
|
|
5323
|
-
};
|
|
5324
|
-
|
|
5325
|
-
return ElementPanel;
|
|
5326
|
-
}(Panel);
|
|
5327
|
-
|
|
5328
|
-
/**
|
|
5329
|
-
*
|
|
5330
|
-
*/
|
|
5331
|
-
|
|
5332
|
-
var VanillaRenderer = function (_super) {
|
|
5333
|
-
__extends(VanillaRenderer, _super);
|
|
6223
|
+
if (this._toggled) {
|
|
6224
|
+
// To prevent element duplication
|
|
6225
|
+
index = this._toggleDirection === DIRECTION.NEXT ? index + panelCount : index - panelCount;
|
|
6226
|
+
}
|
|
5334
6227
|
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
6228
|
+
return circulateIndex(index, virtualElCount);
|
|
6229
|
+
},
|
|
6230
|
+
enumerable: false,
|
|
6231
|
+
configurable: true
|
|
6232
|
+
});
|
|
5338
6233
|
|
|
6234
|
+
__proto.cacheRenderResult = function (result) {
|
|
6235
|
+
this._cachedInnerHTML = result;
|
|
6236
|
+
};
|
|
5339
6237
|
|
|
5340
|
-
|
|
6238
|
+
__proto.uncacheRenderResult = function () {
|
|
6239
|
+
this._cachedInnerHTML = null;
|
|
6240
|
+
};
|
|
5341
6241
|
|
|
5342
6242
|
__proto.render = function () {
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
6243
|
+
var flicking = this._flicking;
|
|
6244
|
+
var _a = flicking.virtual,
|
|
6245
|
+
renderPanel = _a.renderPanel,
|
|
6246
|
+
cache = _a.cache;
|
|
6247
|
+
var element = this._elProvider.element;
|
|
6248
|
+
var newInnerHTML = this._cachedInnerHTML || renderPanel(this, this._index);
|
|
6249
|
+
if (newInnerHTML === element.innerHTML) return;
|
|
6250
|
+
element.innerHTML = newInnerHTML;
|
|
6251
|
+
|
|
6252
|
+
if (cache) {
|
|
6253
|
+
this.cacheRenderResult(newInnerHTML);
|
|
6254
|
+
}
|
|
6255
|
+
};
|
|
5355
6256
|
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
6257
|
+
__proto.increaseIndex = function (val) {
|
|
6258
|
+
this.uncacheRenderResult();
|
|
6259
|
+
return _super.prototype.increaseIndex.call(this, val);
|
|
6260
|
+
};
|
|
5359
6261
|
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
6262
|
+
__proto.decreaseIndex = function (val) {
|
|
6263
|
+
this.uncacheRenderResult();
|
|
6264
|
+
return _super.prototype.decreaseIndex.call(this, val);
|
|
6265
|
+
};
|
|
5363
6266
|
|
|
5364
|
-
|
|
6267
|
+
return VirtualPanel;
|
|
6268
|
+
}(Panel);
|
|
5365
6269
|
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
6270
|
+
var VirtualRenderingStrategy =
|
|
6271
|
+
/*#__PURE__*/
|
|
6272
|
+
function () {
|
|
6273
|
+
function VirtualRenderingStrategy() {}
|
|
6274
|
+
|
|
6275
|
+
var __proto = VirtualRenderingStrategy.prototype;
|
|
6276
|
+
|
|
6277
|
+
__proto.renderPanels = function (flicking) {
|
|
6278
|
+
var virtualManager = flicking.virtual;
|
|
6279
|
+
var visiblePanels = flicking.visiblePanels;
|
|
6280
|
+
var invisibleIndexes = range(flicking.panelsPerView + 1);
|
|
6281
|
+
visiblePanels.forEach(function (panel) {
|
|
6282
|
+
var elementIndex = panel.elementIndex;
|
|
6283
|
+
panel.render();
|
|
6284
|
+
virtualManager.show(elementIndex);
|
|
6285
|
+
invisibleIndexes[elementIndex] = -1;
|
|
5370
6286
|
});
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5376
|
-
var flicking, camera, cameraElement, fragment;
|
|
5377
|
-
return __generator(this, function (_a) {
|
|
5378
|
-
flicking = getFlickingAttached(this._flicking, "Renderer");
|
|
5379
|
-
camera = flicking.camera;
|
|
5380
|
-
cameraElement = camera.element;
|
|
5381
|
-
fragment = document.createDocumentFragment();
|
|
5382
|
-
|
|
5383
|
-
this._panels.forEach(function (panel) {
|
|
5384
|
-
return fragment.appendChild(panel.element);
|
|
5385
|
-
});
|
|
5386
|
-
|
|
5387
|
-
this._removeAllChildsFromCamera();
|
|
5388
|
-
|
|
5389
|
-
cameraElement.appendChild(fragment);
|
|
5390
|
-
return [2
|
|
5391
|
-
/*return*/
|
|
5392
|
-
];
|
|
5393
|
-
});
|
|
6287
|
+
invisibleIndexes.filter(function (val) {
|
|
6288
|
+
return val >= 0;
|
|
6289
|
+
}).forEach(function (idx) {
|
|
6290
|
+
virtualManager.hide(idx);
|
|
5394
6291
|
});
|
|
5395
6292
|
};
|
|
5396
6293
|
|
|
5397
|
-
__proto.
|
|
5398
|
-
var
|
|
5399
|
-
var cameraElement = flicking.camera.element; // Remove all text nodes in the camera element
|
|
6294
|
+
__proto.getRenderingIndexesByOrder = function (flicking) {
|
|
6295
|
+
var virtualManager = flicking.virtual;
|
|
5400
6296
|
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
6297
|
+
var visiblePanels = __spreadArray([], __read(flicking.visiblePanels)).filter(function (panel) {
|
|
6298
|
+
return panel.rendered;
|
|
6299
|
+
}).sort(function (panel1, panel2) {
|
|
6300
|
+
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
5405
6301
|
});
|
|
5406
6302
|
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
return
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
6303
|
+
if (visiblePanels.length <= 0) return virtualManager.elements.map(function (_, idx) {
|
|
6304
|
+
return idx;
|
|
6305
|
+
});
|
|
6306
|
+
var visibleIndexes = visiblePanels.map(function (panel) {
|
|
6307
|
+
return panel.elementIndex;
|
|
6308
|
+
});
|
|
6309
|
+
var invisibleIndexes = virtualManager.elements.map(function (el, idx) {
|
|
6310
|
+
return __assign(__assign({}, el), {
|
|
6311
|
+
idx: idx
|
|
5416
6312
|
});
|
|
6313
|
+
}).filter(function (el) {
|
|
6314
|
+
return !el.visible;
|
|
6315
|
+
}).map(function (el) {
|
|
6316
|
+
return el.idx;
|
|
5417
6317
|
});
|
|
6318
|
+
return __spreadArray(__spreadArray([], __read(visibleIndexes), false), __read(invisibleIndexes));
|
|
5418
6319
|
};
|
|
5419
6320
|
|
|
5420
|
-
__proto.
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
__proto._insertPanelElements = function (panels, nextSibling) {
|
|
5427
|
-
var flicking = getFlickingAttached(this._flicking, "Renderer");
|
|
5428
|
-
var camera = flicking.camera;
|
|
5429
|
-
var cameraElement = camera.element;
|
|
5430
|
-
var nextSiblingElement = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.element) || null;
|
|
5431
|
-
var fragment = document.createDocumentFragment();
|
|
5432
|
-
panels.forEach(function (panel) {
|
|
5433
|
-
return fragment.appendChild(panel.element);
|
|
6321
|
+
__proto.getRenderingElementsByOrder = function (flicking) {
|
|
6322
|
+
var virtualManager = flicking.virtual;
|
|
6323
|
+
var elements = virtualManager.elements;
|
|
6324
|
+
return this.getRenderingIndexesByOrder(flicking).map(function (index) {
|
|
6325
|
+
return elements[index].nativeElement;
|
|
5434
6326
|
});
|
|
5435
|
-
cameraElement.insertBefore(fragment, nextSiblingElement);
|
|
5436
|
-
return this;
|
|
5437
6327
|
};
|
|
5438
6328
|
|
|
5439
|
-
__proto.
|
|
5440
|
-
var
|
|
5441
|
-
var
|
|
6329
|
+
__proto.updateRenderingPanels = function (flicking) {
|
|
6330
|
+
var panels = flicking.renderer.panels;
|
|
6331
|
+
var camera = flicking.camera;
|
|
6332
|
+
var visibleIndexes = camera.visiblePanels.reduce(function (visibles, panel) {
|
|
6333
|
+
visibles[panel.index] = true;
|
|
6334
|
+
return visibles;
|
|
6335
|
+
}, {});
|
|
5442
6336
|
panels.forEach(function (panel) {
|
|
5443
|
-
|
|
6337
|
+
if (panel.index in visibleIndexes || panel.loading) {
|
|
6338
|
+
panel.markForShow();
|
|
6339
|
+
} else {
|
|
6340
|
+
panel.markForHide();
|
|
6341
|
+
}
|
|
5444
6342
|
});
|
|
5445
|
-
|
|
6343
|
+
camera.updateOffset();
|
|
5446
6344
|
};
|
|
5447
6345
|
|
|
5448
|
-
__proto.
|
|
5449
|
-
var
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
if (panel.element.nextElementSibling !== nextPanelEl) {
|
|
5459
|
-
cameraEl.insertBefore(panel.element, nextPanelEl);
|
|
5460
|
-
}
|
|
6346
|
+
__proto.collectPanels = function (flicking) {
|
|
6347
|
+
var align = parsePanelAlign(flicking.renderer.align);
|
|
6348
|
+
return range(flicking.virtual.initialPanelCount).map(function (index) {
|
|
6349
|
+
return new VirtualPanel({
|
|
6350
|
+
index: index,
|
|
6351
|
+
elementProvider: new VirtualElementProvider(flicking),
|
|
6352
|
+
align: align,
|
|
6353
|
+
flicking: flicking
|
|
6354
|
+
});
|
|
5461
6355
|
});
|
|
5462
6356
|
};
|
|
5463
6357
|
|
|
5464
|
-
__proto.
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
while (cameraElement.firstChild) {
|
|
5469
|
-
cameraElement.removeChild(cameraElement.firstChild);
|
|
5470
|
-
}
|
|
6358
|
+
__proto.createPanel = function (_el, options) {
|
|
6359
|
+
return new VirtualPanel(__assign(__assign({}, options), {
|
|
6360
|
+
elementProvider: new VirtualElementProvider(options.flicking)
|
|
6361
|
+
}));
|
|
5471
6362
|
};
|
|
5472
6363
|
|
|
5473
|
-
__proto.
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
return a.position + a.offset - (b.position + b.offset);
|
|
6364
|
+
__proto.updatePanelSizes = function (flicking, size) {
|
|
6365
|
+
flicking.virtual.elements.forEach(function (el) {
|
|
6366
|
+
setSize(el.nativeElement, size);
|
|
6367
|
+
});
|
|
6368
|
+
flicking.panels.forEach(function (panel) {
|
|
6369
|
+
return panel.setSize(size);
|
|
5480
6370
|
});
|
|
5481
6371
|
};
|
|
5482
6372
|
|
|
5483
|
-
return
|
|
5484
|
-
}(
|
|
5485
|
-
|
|
5486
|
-
/**
|
|
5487
|
-
*
|
|
5488
|
-
*/
|
|
5489
|
-
|
|
5490
|
-
var ExternalRenderer = function (_super) {
|
|
5491
|
-
__extends(ExternalRenderer, _super);
|
|
5492
|
-
|
|
5493
|
-
function ExternalRenderer() {
|
|
5494
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
5495
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
var __proto = ExternalRenderer.prototype;
|
|
5499
|
-
|
|
5500
|
-
__proto._insertPanelElements = function (panels, nextSibling) {// DO NOTHING
|
|
5501
|
-
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
__proto._removePanelElements = function (panels) {// DO NOTHING
|
|
5505
|
-
};
|
|
5506
|
-
|
|
5507
|
-
return ExternalRenderer;
|
|
5508
|
-
}(Renderer);
|
|
6373
|
+
return VirtualRenderingStrategy;
|
|
6374
|
+
}();
|
|
5509
6375
|
|
|
5510
6376
|
/**
|
|
5511
6377
|
* @extends Component
|
|
@@ -5514,7 +6380,9 @@ var ExternalRenderer = function (_super) {
|
|
|
5514
6380
|
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
5515
6381
|
*/
|
|
5516
6382
|
|
|
5517
|
-
var Flicking =
|
|
6383
|
+
var Flicking =
|
|
6384
|
+
/*#__PURE__*/
|
|
6385
|
+
function (_super) {
|
|
5518
6386
|
__extends(Flicking, _super);
|
|
5519
6387
|
/**
|
|
5520
6388
|
* @param root A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
|
|
@@ -5596,12 +6464,18 @@ var Flicking = function (_super) {
|
|
|
5596
6464
|
disableOnInit = _z === void 0 ? false : _z,
|
|
5597
6465
|
_0 = _b.renderOnlyVisible,
|
|
5598
6466
|
renderOnlyVisible = _0 === void 0 ? false : _0,
|
|
5599
|
-
_1 = _b.
|
|
5600
|
-
|
|
5601
|
-
_2 = _b.
|
|
5602
|
-
|
|
5603
|
-
_3 = _b.
|
|
5604
|
-
|
|
6467
|
+
_1 = _b.virtual,
|
|
6468
|
+
virtual = _1 === void 0 ? null : _1,
|
|
6469
|
+
_2 = _b.autoInit,
|
|
6470
|
+
autoInit = _2 === void 0 ? true : _2,
|
|
6471
|
+
_3 = _b.autoResize,
|
|
6472
|
+
autoResize = _3 === void 0 ? true : _3,
|
|
6473
|
+
_4 = _b.useResizeObserver,
|
|
6474
|
+
useResizeObserver = _4 === void 0 ? true : _4,
|
|
6475
|
+
_5 = _b.externalRenderer,
|
|
6476
|
+
externalRenderer = _5 === void 0 ? null : _5,
|
|
6477
|
+
_6 = _b.renderExternal,
|
|
6478
|
+
renderExternal = _6 === void 0 ? null : _6;
|
|
5605
6479
|
|
|
5606
6480
|
var _this = _super.call(this) || this; // Internal states
|
|
5607
6481
|
|
|
@@ -5618,6 +6492,7 @@ var Flicking = function (_super) {
|
|
|
5618
6492
|
_this._panelsPerView = panelsPerView;
|
|
5619
6493
|
_this._noPanelStyleOverride = noPanelStyleOverride;
|
|
5620
6494
|
_this._resizeOnContentsReady = resizeOnContentsReady;
|
|
6495
|
+
_this._virtual = virtual;
|
|
5621
6496
|
_this._needPanelThreshold = needPanelThreshold;
|
|
5622
6497
|
_this._preventEventsBeforeInit = preventEventsBeforeInit;
|
|
5623
6498
|
_this._deceleration = deceleration;
|
|
@@ -5632,15 +6507,18 @@ var Flicking = function (_super) {
|
|
|
5632
6507
|
_this._preventClickOnDrag = preventClickOnDrag;
|
|
5633
6508
|
_this._disableOnInit = disableOnInit;
|
|
5634
6509
|
_this._renderOnlyVisible = renderOnlyVisible;
|
|
5635
|
-
_this._autoResize = autoResize;
|
|
5636
6510
|
_this._autoInit = autoInit;
|
|
6511
|
+
_this._autoResize = autoResize;
|
|
6512
|
+
_this._useResizeObserver = useResizeObserver;
|
|
6513
|
+
_this._externalRenderer = externalRenderer;
|
|
5637
6514
|
_this._renderExternal = renderExternal; // Create core components
|
|
5638
6515
|
|
|
5639
6516
|
_this._viewport = new Viewport(getElement(root));
|
|
6517
|
+
_this._autoResizer = new AutoResizer(_this);
|
|
5640
6518
|
_this._renderer = _this._createRenderer();
|
|
5641
6519
|
_this._camera = _this._createCamera();
|
|
5642
6520
|
_this._control = _this._createControl();
|
|
5643
|
-
_this.
|
|
6521
|
+
_this._virtualManager = new VirtualManager(_this, virtual);
|
|
5644
6522
|
|
|
5645
6523
|
if (_this._autoInit) {
|
|
5646
6524
|
void _this.init();
|
|
@@ -5752,6 +6630,22 @@ var Flicking = function (_super) {
|
|
|
5752
6630
|
enumerable: false,
|
|
5753
6631
|
configurable: true
|
|
5754
6632
|
});
|
|
6633
|
+
Object.defineProperty(__proto, "virtualEnabled", {
|
|
6634
|
+
/**
|
|
6635
|
+
* Whether the `virtual` option is enabled.
|
|
6636
|
+
* The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
|
|
6637
|
+
* @ko {@link Flicking#virtual virtual} 옵션이 활성화되었는지 여부를 나타내는 멤버 변수.
|
|
6638
|
+
* {@link Flicking#virtual virtual} 옵션은 {@link Flicking#panelsPerView panelsPerView} 옵션의 값이 0보다 같거나 작으면 비활성화됩니다.
|
|
6639
|
+
* @type {boolean}
|
|
6640
|
+
* @default false
|
|
6641
|
+
* @readonly
|
|
6642
|
+
*/
|
|
6643
|
+
get: function () {
|
|
6644
|
+
return this._panelsPerView > 0 && this._virtual != null;
|
|
6645
|
+
},
|
|
6646
|
+
enumerable: false,
|
|
6647
|
+
configurable: true
|
|
6648
|
+
});
|
|
5755
6649
|
Object.defineProperty(__proto, "index", {
|
|
5756
6650
|
/**
|
|
5757
6651
|
* Index number of the {@link Flicking#currentPanel currentPanel}
|
|
@@ -6334,8 +7228,8 @@ var Flicking = function (_super) {
|
|
|
6334
7228
|
// PERFORMANCE
|
|
6335
7229
|
|
|
6336
7230
|
/**
|
|
6337
|
-
* Whether to render visible panels only. This can dramatically increase performance when there're many panels
|
|
6338
|
-
* @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수
|
|
7231
|
+
* Whether to render visible panels only. This can dramatically increase performance when there're many panels
|
|
7232
|
+
* @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다
|
|
6339
7233
|
* @type {boolean}
|
|
6340
7234
|
* @default false
|
|
6341
7235
|
*/
|
|
@@ -6349,6 +7243,44 @@ var Flicking = function (_super) {
|
|
|
6349
7243
|
enumerable: false,
|
|
6350
7244
|
configurable: true
|
|
6351
7245
|
});
|
|
7246
|
+
Object.defineProperty(__proto, "virtual", {
|
|
7247
|
+
/**
|
|
7248
|
+
* By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
|
|
7249
|
+
* Must be used with `panelsPerview`.
|
|
7250
|
+
* After Flicking's initialized, this property can be used to add/remove the panel count.
|
|
7251
|
+
* @ko 이 옵션을 활성화할 경우 패널 엘리먼트의 개수를 `panelsPerView + 1` 개로 고정함으로써, 메모리 사용량을 줄일 수 있습니다.
|
|
7252
|
+
* `panelsPerView` 옵션과 함께 사용되어야만 합니다.
|
|
7253
|
+
* Flicking 초기화 이후에, 이 프로퍼티는 렌더링하는 패널의 개수를 추가/제거하기 위해 사용될 수 있습니다.
|
|
7254
|
+
* @type {VirtualManager}
|
|
7255
|
+
* @property {function} renderPanel A rendering function for the panel element's innerHTML<ko>패널 엘리먼트의 innerHTML을 렌더링하는 함수</ko>
|
|
7256
|
+
* @property {number} initialPanelCount Initial panel count to render<ko>최초로 렌더링할 패널의 개수</ko>
|
|
7257
|
+
* @property {boolean} [cache=false] Whether to cache rendered panel's innerHTML<ko>렌더링된 패널의 innerHTML 정보를 캐시할지 여부</ko>
|
|
7258
|
+
* @property {string} [panelClass="flicking-panel"] The class name that will be applied to rendered panel elements<ko>렌더링되는 패널 엘리먼트에 적용될 클래스 이름</ko>
|
|
7259
|
+
* @example
|
|
7260
|
+
* ```ts
|
|
7261
|
+
* import Flicking, { VirtualPanel } from "@egjs/flicking";
|
|
7262
|
+
*
|
|
7263
|
+
* const flicking = new Flicking("#some_el", {
|
|
7264
|
+
* panelsPerView: 3,
|
|
7265
|
+
* virtual: {
|
|
7266
|
+
* renderPanel: (panel: VirtualPanel, index: number) => `Panel ${index}`,
|
|
7267
|
+
* initialPanelCount: 100
|
|
7268
|
+
* }
|
|
7269
|
+
* });
|
|
7270
|
+
*
|
|
7271
|
+
* // Add 100 virtual panels (at the end)
|
|
7272
|
+
* flicking.virtual.append(100);
|
|
7273
|
+
*
|
|
7274
|
+
* // Remove 100 virtual panels from 0 to 100
|
|
7275
|
+
* flicking.virtual.remove(0, 100);
|
|
7276
|
+
* ```
|
|
7277
|
+
*/
|
|
7278
|
+
get: function () {
|
|
7279
|
+
return this._virtualManager;
|
|
7280
|
+
},
|
|
7281
|
+
enumerable: false,
|
|
7282
|
+
configurable: true
|
|
7283
|
+
});
|
|
6352
7284
|
Object.defineProperty(__proto, "autoInit", {
|
|
6353
7285
|
// OTHERS
|
|
6354
7286
|
|
|
@@ -6367,10 +7299,8 @@ var Flicking = function (_super) {
|
|
|
6367
7299
|
});
|
|
6368
7300
|
Object.defineProperty(__proto, "autoResize", {
|
|
6369
7301
|
/**
|
|
6370
|
-
*
|
|
6371
|
-
*
|
|
6372
|
-
* @ko Flicking의 {@link Flicking#resize resize} 메소드를 window의 resize 이벤트 핸들러로 등록합니다.
|
|
6373
|
-
* 설정시 window 창 크기 및 orientation 변경에 의해 자동으로 {@link Flicking#resize resize}를 호출합니다.
|
|
7302
|
+
* Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
|
|
7303
|
+
* @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
|
|
6374
7304
|
* @type {boolean}
|
|
6375
7305
|
* @default true
|
|
6376
7306
|
*/
|
|
@@ -6380,6 +7310,46 @@ var Flicking = function (_super) {
|
|
|
6380
7310
|
// OTHERS
|
|
6381
7311
|
set: function (val) {
|
|
6382
7312
|
this._autoResize = val;
|
|
7313
|
+
|
|
7314
|
+
if (val) {
|
|
7315
|
+
this._autoResizer.enable();
|
|
7316
|
+
} else {
|
|
7317
|
+
this._autoResizer.disable();
|
|
7318
|
+
}
|
|
7319
|
+
},
|
|
7320
|
+
enumerable: false,
|
|
7321
|
+
configurable: true
|
|
7322
|
+
});
|
|
7323
|
+
Object.defineProperty(__proto, "useResizeObserver", {
|
|
7324
|
+
/**
|
|
7325
|
+
* Whether to listen {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}'s event instead of Window's {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} event when using the `autoResize` option
|
|
7326
|
+
* @ko autoResize 옵션 사용시 {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}의 이벤트를 Window객체의 {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} 이벤트 대신 수신할지 여부를 설정합니다
|
|
7327
|
+
* @type {boolean}
|
|
7328
|
+
* @default true
|
|
7329
|
+
*/
|
|
7330
|
+
get: function () {
|
|
7331
|
+
return this._useResizeObserver;
|
|
7332
|
+
},
|
|
7333
|
+
set: function (val) {
|
|
7334
|
+
this._useResizeObserver = val;
|
|
7335
|
+
|
|
7336
|
+
if (this._autoResize) {
|
|
7337
|
+
this._autoResizer.enable();
|
|
7338
|
+
}
|
|
7339
|
+
},
|
|
7340
|
+
enumerable: false,
|
|
7341
|
+
configurable: true
|
|
7342
|
+
});
|
|
7343
|
+
Object.defineProperty(__proto, "externalRenderer", {
|
|
7344
|
+
/**
|
|
7345
|
+
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
7346
|
+
* @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
|
|
7347
|
+
* @default null
|
|
7348
|
+
* @internal
|
|
7349
|
+
* @readonly
|
|
7350
|
+
*/
|
|
7351
|
+
get: function () {
|
|
7352
|
+
return this._externalRenderer;
|
|
6383
7353
|
},
|
|
6384
7354
|
enumerable: false,
|
|
6385
7355
|
configurable: true
|
|
@@ -6388,10 +7358,10 @@ var Flicking = function (_super) {
|
|
|
6388
7358
|
/**
|
|
6389
7359
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
6390
7360
|
* @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
|
|
6391
|
-
* @
|
|
6392
|
-
* @default false
|
|
7361
|
+
* @default null
|
|
6393
7362
|
* @internal
|
|
6394
7363
|
* @readonly
|
|
7364
|
+
* @deprecated
|
|
6395
7365
|
*/
|
|
6396
7366
|
get: function () {
|
|
6397
7367
|
return this._renderExternal;
|
|
@@ -6410,7 +7380,7 @@ var Flicking = function (_super) {
|
|
|
6410
7380
|
|
|
6411
7381
|
__proto.init = function () {
|
|
6412
7382
|
return __awaiter(this, void 0, void 0, function () {
|
|
6413
|
-
var camera, renderer, control, originalTrigger, preventEventsBeforeInit;
|
|
7383
|
+
var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
|
|
6414
7384
|
|
|
6415
7385
|
var _this = this;
|
|
6416
7386
|
|
|
@@ -6423,9 +7393,11 @@ var Flicking = function (_super) {
|
|
|
6423
7393
|
camera = this._camera;
|
|
6424
7394
|
renderer = this._renderer;
|
|
6425
7395
|
control = this._control;
|
|
7396
|
+
virtualManager = this._virtualManager;
|
|
6426
7397
|
originalTrigger = this.trigger;
|
|
6427
7398
|
preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
6428
7399
|
camera.init(this);
|
|
7400
|
+
virtualManager.init();
|
|
6429
7401
|
renderer.init(this);
|
|
6430
7402
|
control.init(this);
|
|
6431
7403
|
|
|
@@ -6452,7 +7424,7 @@ var Flicking = function (_super) {
|
|
|
6452
7424
|
_a.sent();
|
|
6453
7425
|
|
|
6454
7426
|
if (this._autoResize) {
|
|
6455
|
-
|
|
7427
|
+
this._autoResizer.enable();
|
|
6456
7428
|
}
|
|
6457
7429
|
|
|
6458
7430
|
if (this._preventClickOnDrag) {
|
|
@@ -6493,7 +7465,8 @@ var Flicking = function (_super) {
|
|
|
6493
7465
|
|
|
6494
7466
|
__proto.destroy = function () {
|
|
6495
7467
|
this.off();
|
|
6496
|
-
|
|
7468
|
+
|
|
7469
|
+
this._autoResizer.disable();
|
|
6497
7470
|
|
|
6498
7471
|
this._control.destroy();
|
|
6499
7472
|
|
|
@@ -6710,7 +7683,7 @@ var Flicking = function (_super) {
|
|
|
6710
7683
|
* @param {boolean} [options.includePanelHTML=false] Include panel's `outerHTML` to the returning status<ko>패널의 `outerHTML`을 반환값에 포함시킵니다</ko>
|
|
6711
7684
|
* @param {boolean} [options.visiblePanelsOnly=false] Include only {@link Flicking#visiblePanel visiblePanel}'s HTML. This option is available only when the `includePanelHTML` is true
|
|
6712
7685
|
* <ko>현재 보이는 패널({@link Flicking#visiblePanel visiblePanel})의 HTML만 반환합니다. `includePanelHTML`이 `true`일 경우에만 동작합니다.</ko>
|
|
6713
|
-
* @return {
|
|
7686
|
+
* @return {Status} An object with current status value information<ko>현재 상태값 정보를 가진 객체.</ko>
|
|
6714
7687
|
*/
|
|
6715
7688
|
|
|
6716
7689
|
|
|
@@ -6790,13 +7763,15 @@ var Flicking = function (_super) {
|
|
|
6790
7763
|
if (((_a = panels[0]) === null || _a === void 0 ? void 0 : _a.html) && !this._renderExternal) {
|
|
6791
7764
|
renderer.batchRemove({
|
|
6792
7765
|
index: 0,
|
|
6793
|
-
deleteCount: this.panels.length
|
|
7766
|
+
deleteCount: this.panels.length,
|
|
7767
|
+
hasDOMInElements: true
|
|
6794
7768
|
});
|
|
6795
7769
|
renderer.batchInsert({
|
|
6796
7770
|
index: 0,
|
|
6797
7771
|
elements: parseElement(panels.map(function (panel) {
|
|
6798
7772
|
return panel.html;
|
|
6799
|
-
}))
|
|
7773
|
+
})),
|
|
7774
|
+
hasDOMInElements: true
|
|
6800
7775
|
});
|
|
6801
7776
|
}
|
|
6802
7777
|
|
|
@@ -7033,7 +8008,8 @@ var Flicking = function (_super) {
|
|
|
7033
8008
|
|
|
7034
8009
|
return this._renderer.batchInsert({
|
|
7035
8010
|
index: index,
|
|
7036
|
-
elements: parseElement(element)
|
|
8011
|
+
elements: parseElement(element),
|
|
8012
|
+
hasDOMInElements: true
|
|
7037
8013
|
});
|
|
7038
8014
|
};
|
|
7039
8015
|
/**
|
|
@@ -7058,7 +8034,8 @@ var Flicking = function (_super) {
|
|
|
7058
8034
|
|
|
7059
8035
|
return this._renderer.batchRemove({
|
|
7060
8036
|
index: index,
|
|
7061
|
-
deleteCount: deleteCount
|
|
8037
|
+
deleteCount: deleteCount,
|
|
8038
|
+
hasDOMInElements: true
|
|
7062
8039
|
});
|
|
7063
8040
|
};
|
|
7064
8041
|
|
|
@@ -7108,11 +8085,33 @@ var Flicking = function (_super) {
|
|
|
7108
8085
|
};
|
|
7109
8086
|
|
|
7110
8087
|
__proto._createRenderer = function () {
|
|
7111
|
-
var
|
|
8088
|
+
var externalRenderer = this._externalRenderer;
|
|
8089
|
+
|
|
8090
|
+
if (this._virtual && this._panelsPerView <= 0) {
|
|
8091
|
+
// eslint-disable-next-line no-console
|
|
8092
|
+
console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
|
|
8093
|
+
}
|
|
8094
|
+
|
|
8095
|
+
return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
|
|
8096
|
+
};
|
|
8097
|
+
|
|
8098
|
+
__proto._createExternalRenderer = function () {
|
|
8099
|
+
var _a = this._renderExternal,
|
|
8100
|
+
renderer = _a.renderer,
|
|
8101
|
+
rendererOptions = _a.rendererOptions;
|
|
8102
|
+
return new renderer(__assign({
|
|
7112
8103
|
align: this._align
|
|
7113
|
-
};
|
|
7114
|
-
|
|
7115
|
-
|
|
8104
|
+
}, rendererOptions));
|
|
8105
|
+
};
|
|
8106
|
+
|
|
8107
|
+
__proto._createVanillaRenderer = function () {
|
|
8108
|
+
var virtual = this.virtualEnabled;
|
|
8109
|
+
return new VanillaRenderer({
|
|
8110
|
+
align: this._align,
|
|
8111
|
+
strategy: virtual ? new VirtualRenderingStrategy() : new NormalRenderingStrategy({
|
|
8112
|
+
providerCtor: VanillaElementProvider
|
|
8113
|
+
})
|
|
8114
|
+
});
|
|
7116
8115
|
};
|
|
7117
8116
|
|
|
7118
8117
|
__proto._moveToInitialPanel = function () {
|
|
@@ -7146,36 +8145,10 @@ var Flicking = function (_super) {
|
|
|
7146
8145
|
*/
|
|
7147
8146
|
|
|
7148
8147
|
|
|
7149
|
-
Flicking.VERSION = "4.
|
|
8148
|
+
Flicking.VERSION = "4.4.2";
|
|
7150
8149
|
return Flicking;
|
|
7151
8150
|
}(Component);
|
|
7152
8151
|
|
|
7153
|
-
/**
|
|
7154
|
-
* An slide data component that holds information of a single HTMLElement
|
|
7155
|
-
* @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
|
|
7156
|
-
*/
|
|
7157
|
-
|
|
7158
|
-
var ExternalPanel = function (_super) {
|
|
7159
|
-
__extends(ExternalPanel, _super);
|
|
7160
|
-
/**
|
|
7161
|
-
* @param {object} options An options object<ko>옵션 오브젝트</ko>
|
|
7162
|
-
* @param {HTMLElement} [options.el] A `HTMLElement` panel's referencing<ko>패널이 참조하는 `HTMLElement`</ko>
|
|
7163
|
-
* @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
|
|
7164
|
-
* @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
|
|
7165
|
-
* @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
|
|
7166
|
-
*/
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
function ExternalPanel(options) {
|
|
7170
|
-
var _this = _super.call(this, options) || this;
|
|
7171
|
-
|
|
7172
|
-
_this._externalComponent = options.externalComponent;
|
|
7173
|
-
return _this;
|
|
7174
|
-
}
|
|
7175
|
-
|
|
7176
|
-
return ExternalPanel;
|
|
7177
|
-
}(Panel);
|
|
7178
|
-
|
|
7179
8152
|
/**
|
|
7180
8153
|
* Decorator that makes the method of flicking available in the framework.
|
|
7181
8154
|
* @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
|
|
@@ -7249,6 +8222,8 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
7249
8222
|
var renderer = flicking.renderer;
|
|
7250
8223
|
var panels = renderer.panels;
|
|
7251
8224
|
|
|
8225
|
+
var prevList = __spreadArray([], __read(diffResult.prevList));
|
|
8226
|
+
|
|
7252
8227
|
if (diffResult.removed.length > 0) {
|
|
7253
8228
|
var endIdx_1 = -1;
|
|
7254
8229
|
var prevIdx_1 = -1;
|
|
@@ -7264,6 +8239,8 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
7264
8239
|
} else {
|
|
7265
8240
|
prevIdx_1 = removedIdx;
|
|
7266
8241
|
}
|
|
8242
|
+
|
|
8243
|
+
prevList.splice(removedIdx, 1);
|
|
7267
8244
|
});
|
|
7268
8245
|
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
7269
8246
|
}
|
|
@@ -7303,13 +8280,14 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
7303
8280
|
if (diffResult.added.length > 0) {
|
|
7304
8281
|
var startIdx_1 = -1;
|
|
7305
8282
|
var prevIdx_2 = -1;
|
|
8283
|
+
var addedElements_1 = rendered.slice(prevList.length);
|
|
7306
8284
|
diffResult.added.forEach(function (addedIdx, idx) {
|
|
7307
8285
|
if (startIdx_1 < 0) {
|
|
7308
8286
|
startIdx_1 = idx;
|
|
7309
8287
|
}
|
|
7310
8288
|
|
|
7311
8289
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
7312
|
-
batchInsert(renderer, diffResult,
|
|
8290
|
+
batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
|
|
7313
8291
|
startIdx_1 = -1;
|
|
7314
8292
|
prevIdx_2 = -1;
|
|
7315
8293
|
} else {
|
|
@@ -7318,16 +8296,17 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
7318
8296
|
});
|
|
7319
8297
|
|
|
7320
8298
|
if (startIdx_1 >= 0) {
|
|
7321
|
-
batchInsert(renderer, diffResult,
|
|
8299
|
+
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
7322
8300
|
}
|
|
7323
8301
|
}
|
|
7324
8302
|
});
|
|
7325
8303
|
|
|
7326
|
-
var batchInsert = function (renderer, diffResult,
|
|
8304
|
+
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
7327
8305
|
renderer.batchInsert.apply(renderer, __spreadArray([], __read(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
7328
8306
|
return {
|
|
7329
8307
|
index: index,
|
|
7330
|
-
elements: [
|
|
8308
|
+
elements: [addedElements[elIdx]],
|
|
8309
|
+
hasDOMInElements: false
|
|
7331
8310
|
};
|
|
7332
8311
|
}))));
|
|
7333
8312
|
};
|
|
@@ -7336,7 +8315,8 @@ var batchRemove = function (renderer, startIdx, endIdx) {
|
|
|
7336
8315
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
7337
8316
|
renderer.batchRemove({
|
|
7338
8317
|
index: startIdx,
|
|
7339
|
-
deleteCount: removed.length
|
|
8318
|
+
deleteCount: removed.length,
|
|
8319
|
+
hasDOMInElements: false
|
|
7340
8320
|
});
|
|
7341
8321
|
};
|
|
7342
8322
|
|
|
@@ -7360,7 +8340,7 @@ var getRenderingPanels = (function (flicking, diffResult) {
|
|
|
7360
8340
|
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
7361
8341
|
}).map(function (panel) {
|
|
7362
8342
|
return diffResult.list[maintainedMap[panel.index]];
|
|
7363
|
-
}))), __read(diffResult.added.map(function (idx) {
|
|
8343
|
+
})), false), __read(diffResult.added.map(function (idx) {
|
|
7364
8344
|
return diffResult.list[idx];
|
|
7365
8345
|
})));
|
|
7366
8346
|
});
|
|
@@ -7416,5 +8396,5 @@ var parseAlign = function (alignVal) {
|
|
|
7416
8396
|
* egjs projects are licensed under the MIT license
|
|
7417
8397
|
*/
|
|
7418
8398
|
|
|
7419
|
-
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCamera, Camera, CircularCamera, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS,
|
|
8399
|
+
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCamera, CLASS, Camera, CircularCamera, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCamera, MOVE_TYPE, NormalRenderingStrategy, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDefaultCameraTransform, getDirection, getElement, getFlickingAttached, getMinusCompensatedIndex, getProgress, getRenderingPanels, getStyle, includes, isBetween, isString, merge, parseAlign$1 as parseAlign, parseArithmeticExpression, parseArithmeticSize, parseBounce, parseCSSSizeValue, parseElement, parsePanelAlign, range, setPrototypeOf, setSize, sync, toArray, withFlickingMethods };
|
|
7420
8400
|
//# sourceMappingURL=flicking.esm.js.map
|