@egjs/flicking 4.12.0-beta.4 → 4.12.0-beta.6
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/declaration/CrossFlicking.d.ts +36 -0
- package/declaration/Flicking.d.ts +244 -244
- package/declaration/camera/Camera.d.ts +89 -90
- package/declaration/camera/index.d.ts +4 -4
- package/declaration/camera/mode/BoundCameraMode.d.ts +13 -13
- package/declaration/camera/mode/CameraMode.d.ts +20 -20
- package/declaration/camera/mode/CircularCameraMode.d.ts +19 -19
- package/declaration/camera/mode/LinearCameraMode.d.ts +9 -9
- package/declaration/camera/mode/index.d.ts +6 -6
- package/declaration/cfc/getDefaultCameraTransform.d.ts +3 -3
- package/declaration/cfc/getRenderingPanels.d.ts +4 -4
- package/declaration/cfc/index.d.ts +5 -5
- package/declaration/cfc/sync.d.ts +4 -4
- package/declaration/cfc/withFlickingMethods.d.ts +2 -2
- package/declaration/const/axes.d.ts +8 -8
- package/declaration/const/error.d.ts +34 -34
- package/declaration/const/external.d.ts +54 -48
- package/declaration/control/AxesController.d.ts +44 -44
- package/declaration/control/Control.d.ts +45 -45
- package/declaration/control/FreeControl.d.ts +14 -14
- package/declaration/control/SnapControl.d.ts +16 -16
- package/declaration/control/StateMachine.d.ts +14 -14
- package/declaration/control/StrictControl.d.ts +20 -20
- package/declaration/control/index.d.ts +14 -14
- package/declaration/control/states/AnimatingState.d.ts +9 -9
- package/declaration/control/states/DisabledState.d.ts +9 -9
- package/declaration/control/states/DraggingState.d.ts +8 -8
- package/declaration/control/states/HoldingState.d.ts +10 -10
- package/declaration/control/states/IdleState.d.ts +9 -9
- package/declaration/control/states/State.d.ts +47 -47
- package/declaration/core/AnchorPoint.d.ts +15 -15
- package/declaration/core/AutoResizer.d.ts +16 -16
- package/declaration/core/FlickingError.d.ts +5 -5
- package/declaration/core/ResizeWatcher.d.ts +33 -33
- package/declaration/core/Viewport.d.ts +25 -25
- package/declaration/core/VirtualManager.d.ts +37 -37
- package/declaration/core/index.d.ts +6 -6
- package/declaration/core/panel/Panel.d.ts +89 -89
- package/declaration/core/panel/VirtualPanel.d.ts +19 -19
- package/declaration/core/panel/index.d.ts +5 -5
- package/declaration/core/panel/provider/ElementProvider.d.ts +8 -8
- package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -12
- package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -15
- package/declaration/core/panel/provider/index.d.ts +5 -5
- package/declaration/index.cjs.d.ts +3 -3
- package/declaration/index.d.ts +15 -13
- package/declaration/index.umd.d.ts +2 -2
- package/declaration/renderer/ExternalRenderer.d.ts +7 -7
- package/declaration/renderer/Renderer.d.ts +59 -59
- package/declaration/renderer/VanillaRenderer.d.ts +10 -10
- package/declaration/renderer/index.d.ts +6 -6
- package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -23
- package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -15
- package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -17
- package/declaration/renderer/strategy/index.d.ts +5 -5
- package/declaration/type/event.d.ts +88 -88
- package/declaration/type/external.d.ts +31 -31
- package/declaration/type/internal.d.ts +13 -13
- package/declaration/utils.d.ts +47 -45
- package/dist/flicking.cjs.js +361 -15
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +353 -15
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +362 -15
- 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 +1129 -775
- 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 +2 -2
- package/src/CrossFlicking.ts +405 -0
- package/src/camera/Camera.ts +0 -9
- package/src/const/external.ts +14 -0
- package/src/index.ts +4 -1
- package/src/index.umd.ts +2 -0
- package/src/utils.ts +21 -0
package/dist/flicking.esm.js
CHANGED
|
@@ -4,13 +4,13 @@ name: @egjs/flicking
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking
|
|
7
|
-
version: 4.12.0-beta.
|
|
7
|
+
version: 4.12.0-beta.6
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
11
11
|
import ImReady from '@egjs/imready';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/******************************************************************************
|
|
14
14
|
Copyright (c) Microsoft Corporation.
|
|
15
15
|
|
|
16
16
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -24,7 +24,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
24
24
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
25
|
PERFORMANCE OF THIS SOFTWARE.
|
|
26
26
|
***************************************************************************** */
|
|
27
|
-
/* global Reflect, Promise */
|
|
27
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
28
28
|
|
|
29
29
|
var extendStatics = function (d, b) {
|
|
30
30
|
extendStatics = Object.setPrototypeOf || {
|
|
@@ -109,7 +109,7 @@ function __generator(thisArg, body) {
|
|
|
109
109
|
}
|
|
110
110
|
function step(op) {
|
|
111
111
|
if (f) throw new TypeError("Generator is already executing.");
|
|
112
|
-
while (_) try {
|
|
112
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
113
113
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
114
114
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
115
115
|
switch (op[0]) {
|
|
@@ -213,6 +213,10 @@ function __spread() {
|
|
|
213
213
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
214
214
|
return ar;
|
|
215
215
|
}
|
|
216
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
217
|
+
var e = new Error(message);
|
|
218
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
219
|
+
};
|
|
216
220
|
|
|
217
221
|
/*
|
|
218
222
|
* Copyright (c) 2015 NAVER Corp.
|
|
@@ -381,6 +385,8 @@ var MOVE_TYPE = {
|
|
|
381
385
|
STRICT: "strict"
|
|
382
386
|
};
|
|
383
387
|
var CLASS = {
|
|
388
|
+
VIEWPORT: "flicking-viewport",
|
|
389
|
+
CAMERA: "flicking-camera",
|
|
384
390
|
VERTICAL: "vertical",
|
|
385
391
|
HIDDEN: "flicking-hidden",
|
|
386
392
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
@@ -407,6 +413,17 @@ var ORDER = {
|
|
|
407
413
|
LTR: "ltr",
|
|
408
414
|
RTL: "rtl"
|
|
409
415
|
};
|
|
416
|
+
/**
|
|
417
|
+
* An object that contains the direction that {@link Flicking} is moving
|
|
418
|
+
* @ko {@link Flicking}이 움직이는 방향을 담고 있는 객체
|
|
419
|
+
* @type {object}
|
|
420
|
+
* @property {"horizontal"} HORIZONTAL horizontal<ko>수평 방향</ko>
|
|
421
|
+
* @property {"vertical"} VERTICAL vertical<ko>수직 방향</ko>
|
|
422
|
+
*/
|
|
423
|
+
var MOVE_DIRECTION = {
|
|
424
|
+
HORIZONTAL: "horizontal",
|
|
425
|
+
VERTICAL: "vertical"
|
|
426
|
+
};
|
|
410
427
|
|
|
411
428
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
412
429
|
var merge = function (target) {
|
|
@@ -721,6 +738,26 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
|
721
738
|
obj.__proto__ = proto;
|
|
722
739
|
return obj;
|
|
723
740
|
};
|
|
741
|
+
var camelize = function (str) {
|
|
742
|
+
return str.replace(/[\s-_]([a-z])/g, function (all, letter) {
|
|
743
|
+
return letter.toUpperCase();
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
var getDataAttributes = function (element, attributePrefix) {
|
|
747
|
+
var dataAttributes = {};
|
|
748
|
+
var attributes = element.attributes;
|
|
749
|
+
var length = attributes.length;
|
|
750
|
+
for (var i = 0; i < length; ++i) {
|
|
751
|
+
var attribute = attributes[i];
|
|
752
|
+
var name_1 = attribute.name,
|
|
753
|
+
value = attribute.value;
|
|
754
|
+
if (name_1.indexOf(attributePrefix) === -1) {
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
dataAttributes[camelize(name_1.replace(attributePrefix, ""))] = value;
|
|
758
|
+
}
|
|
759
|
+
return dataAttributes;
|
|
760
|
+
};
|
|
724
761
|
|
|
725
762
|
/*
|
|
726
763
|
* Copyright (c) 2015 NAVER Corp.
|
|
@@ -3707,7 +3744,6 @@ var Camera = /*#__PURE__*/function () {
|
|
|
3707
3744
|
var _this = this;
|
|
3708
3745
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
3709
3746
|
align = _b === void 0 ? ALIGN.CENTER : _b;
|
|
3710
|
-
this._lookedOffset = 0;
|
|
3711
3747
|
this._checkTranslateSupport = function () {
|
|
3712
3748
|
var e_1, _a;
|
|
3713
3749
|
var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
|
|
@@ -4067,8 +4103,6 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4067
4103
|
*/
|
|
4068
4104
|
__proto.lookAt = function (pos) {
|
|
4069
4105
|
var _this = this;
|
|
4070
|
-
var prevOffset = this._offset;
|
|
4071
|
-
var isChangedOffset = this._lookedOffset !== prevOffset;
|
|
4072
4106
|
var flicking = getFlickingAttached(this._flicking);
|
|
4073
4107
|
var prevPos = this._position;
|
|
4074
4108
|
this._position = pos;
|
|
@@ -4079,12 +4113,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4079
4113
|
if (toggled) {
|
|
4080
4114
|
void flicking.renderer.render().then(function () {
|
|
4081
4115
|
_this.updateOffset();
|
|
4082
|
-
_this._lookedOffset = _this._offset;
|
|
4083
4116
|
});
|
|
4084
|
-
} else if (isChangedOffset) {
|
|
4085
|
-
// sync offset for renderOnlyVisible on resize
|
|
4086
|
-
this.updateOffset();
|
|
4087
|
-
this._lookedOffset = this._offset;
|
|
4088
4117
|
} else {
|
|
4089
4118
|
this.applyTransform();
|
|
4090
4119
|
}
|
|
@@ -4343,7 +4372,6 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4343
4372
|
};
|
|
4344
4373
|
__proto._resetInternalValues = function () {
|
|
4345
4374
|
this._position = 0;
|
|
4346
|
-
this._lookedOffset = 0;
|
|
4347
4375
|
this._alignPos = 0;
|
|
4348
4376
|
this._offset = 0;
|
|
4349
4377
|
this._circularOffset = 0;
|
|
@@ -7865,10 +7893,320 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7865
7893
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7866
7894
|
* ```
|
|
7867
7895
|
*/
|
|
7868
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7896
|
+
Flicking.VERSION = "4.12.0-beta.6";
|
|
7869
7897
|
return Flicking;
|
|
7870
7898
|
}(Component);
|
|
7871
7899
|
|
|
7900
|
+
/*
|
|
7901
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7902
|
+
* egjs projects are licensed under the MIT license
|
|
7903
|
+
*/
|
|
7904
|
+
/**
|
|
7905
|
+
* @extends Component
|
|
7906
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7907
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7908
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7909
|
+
*/
|
|
7910
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7911
|
+
__extends(CrossFlicking, _super);
|
|
7912
|
+
// Options Setter
|
|
7913
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7914
|
+
// this._align = val;
|
|
7915
|
+
// }
|
|
7916
|
+
function CrossFlicking(root, options) {
|
|
7917
|
+
if (options === void 0) {
|
|
7918
|
+
options = {};
|
|
7919
|
+
}
|
|
7920
|
+
var _this = _super.call(this, root, options) || this;
|
|
7921
|
+
_this._onHorizontalHoldStart = function () {
|
|
7922
|
+
_this.dragThreshold = 10;
|
|
7923
|
+
_this._moveDirection = null;
|
|
7924
|
+
};
|
|
7925
|
+
_this._onHorizontalMove = function (e) {
|
|
7926
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7927
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7928
|
+
child.dragThreshold = Infinity;
|
|
7929
|
+
});
|
|
7930
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
7931
|
+
}
|
|
7932
|
+
};
|
|
7933
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
7934
|
+
var visiblePanels = _this.visiblePanels;
|
|
7935
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7936
|
+
child.dragThreshold = 10;
|
|
7937
|
+
});
|
|
7938
|
+
_this._moveDirection = null;
|
|
7939
|
+
if (visiblePanels.length > 1) {
|
|
7940
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
7941
|
+
} else {
|
|
7942
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
7943
|
+
}
|
|
7944
|
+
// _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 timeout으로 처리
|
|
7945
|
+
setTimeout(function () {
|
|
7946
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
7947
|
+
if (_this._nextIndex !== i) {
|
|
7948
|
+
var _a = _this._sideState[i],
|
|
7949
|
+
start = _a.start,
|
|
7950
|
+
end = _a.end;
|
|
7951
|
+
if (child.index < start) {
|
|
7952
|
+
child.stopAnimation();
|
|
7953
|
+
void child.moveTo(start, 0);
|
|
7954
|
+
} else if (child.index > end) {
|
|
7955
|
+
child.stopAnimation();
|
|
7956
|
+
void child.moveTo(end, 0);
|
|
7957
|
+
}
|
|
7958
|
+
}
|
|
7959
|
+
});
|
|
7960
|
+
});
|
|
7961
|
+
if (e.isTrusted) {
|
|
7962
|
+
_this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
7963
|
+
}
|
|
7964
|
+
};
|
|
7965
|
+
_this._onSideHoldStart = function () {
|
|
7966
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7967
|
+
child.dragThreshold = 10;
|
|
7968
|
+
});
|
|
7969
|
+
_this._moveDirection = null;
|
|
7970
|
+
};
|
|
7971
|
+
_this._onSideMove = function (e) {
|
|
7972
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7973
|
+
_this.dragThreshold = Infinity;
|
|
7974
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
7975
|
+
}
|
|
7976
|
+
};
|
|
7977
|
+
_this._onSideMoveEnd = function () {
|
|
7978
|
+
_this.dragThreshold = 10;
|
|
7979
|
+
_this._moveDirection = null;
|
|
7980
|
+
};
|
|
7981
|
+
_this._onSideChanged = function (e) {
|
|
7982
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
7983
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
7984
|
+
if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
|
|
7985
|
+
_this._syncToCategory(e.index, _this.index);
|
|
7986
|
+
}
|
|
7987
|
+
};
|
|
7988
|
+
// Internal states
|
|
7989
|
+
_this._sideState = _this._createSideState();
|
|
7990
|
+
_this._moveDirection = null;
|
|
7991
|
+
_this._nextIndex = 0;
|
|
7992
|
+
// Bind options
|
|
7993
|
+
_this._sideOptions = options.sideOptions;
|
|
7994
|
+
// Create core components
|
|
7995
|
+
_this._sideFlicking = _this._createSideFlicking();
|
|
7996
|
+
return _this;
|
|
7997
|
+
}
|
|
7998
|
+
var __proto = CrossFlicking.prototype;
|
|
7999
|
+
Object.defineProperty(__proto, "sideFlicking", {
|
|
8000
|
+
// Components
|
|
8001
|
+
/**
|
|
8002
|
+
* {@link Control} instance of the Flicking
|
|
8003
|
+
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
|
|
8004
|
+
* @type {Control}
|
|
8005
|
+
* @default SnapControl
|
|
8006
|
+
* @readonly
|
|
8007
|
+
* @see Control
|
|
8008
|
+
* @see SnapControl
|
|
8009
|
+
* @see FreeControl
|
|
8010
|
+
*/
|
|
8011
|
+
get: function () {
|
|
8012
|
+
return this._sideFlicking;
|
|
8013
|
+
},
|
|
8014
|
+
enumerable: false,
|
|
8015
|
+
configurable: true
|
|
8016
|
+
});
|
|
8017
|
+
Object.defineProperty(__proto, "sideState", {
|
|
8018
|
+
// Internal States
|
|
8019
|
+
/**
|
|
8020
|
+
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
8021
|
+
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
|
|
8022
|
+
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
|
|
8023
|
+
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
|
|
8024
|
+
* @type {boolean}
|
|
8025
|
+
* @default false
|
|
8026
|
+
* @readonly
|
|
8027
|
+
*/
|
|
8028
|
+
get: function () {
|
|
8029
|
+
return this._sideState;
|
|
8030
|
+
},
|
|
8031
|
+
enumerable: false,
|
|
8032
|
+
configurable: true
|
|
8033
|
+
});
|
|
8034
|
+
Object.defineProperty(__proto, "sideOptions", {
|
|
8035
|
+
// Options Getter
|
|
8036
|
+
/**
|
|
8037
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
8038
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8039
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8040
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8041
|
+
* @type {FlickingOptions}
|
|
8042
|
+
* @default undefined
|
|
8043
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8044
|
+
*/
|
|
8045
|
+
get: function () {
|
|
8046
|
+
return this._sideOptions;
|
|
8047
|
+
},
|
|
8048
|
+
enumerable: false,
|
|
8049
|
+
configurable: true
|
|
8050
|
+
});
|
|
8051
|
+
/**
|
|
8052
|
+
* Initialize Flicking and move to the default index
|
|
8053
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8054
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8055
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8056
|
+
* @fires Flicking#ready
|
|
8057
|
+
* @return {Promise<void>}
|
|
8058
|
+
*/
|
|
8059
|
+
__proto.init = function () {
|
|
8060
|
+
var _this = this;
|
|
8061
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8062
|
+
return _this._addComponentEvents();
|
|
8063
|
+
});
|
|
8064
|
+
};
|
|
8065
|
+
/**
|
|
8066
|
+
* Destroy Flicking and remove all event handlers
|
|
8067
|
+
* @ko Flicking과 하위 컴포넌트들을 초기 상태로 되돌리고, 부착된 모든 이벤트 핸들러를 제거합니다
|
|
8068
|
+
* @return {void}
|
|
8069
|
+
*/
|
|
8070
|
+
__proto.destroy = function () {
|
|
8071
|
+
// TODO 모든 child flicking destroy
|
|
8072
|
+
_super.prototype.destroy.call(this);
|
|
8073
|
+
};
|
|
8074
|
+
__proto._addComponentEvents = function () {
|
|
8075
|
+
var _this = this;
|
|
8076
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8077
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8078
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8079
|
+
this._sideFlicking.forEach(function (flicking) {
|
|
8080
|
+
flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
|
|
8081
|
+
flicking.on(EVENTS.MOVE, _this._onSideMove);
|
|
8082
|
+
flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
|
|
8083
|
+
flicking.on(EVENTS.CHANGED, _this._onSideChanged);
|
|
8084
|
+
});
|
|
8085
|
+
};
|
|
8086
|
+
__proto._createSideState = function () {
|
|
8087
|
+
var _this = this;
|
|
8088
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 side flicking으로 해보자.
|
|
8089
|
+
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
|
|
8090
|
+
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
|
|
8091
|
+
var viewportEl = this.element;
|
|
8092
|
+
var cameraEl = this.camera.element;
|
|
8093
|
+
var panels = toArray(cameraEl.children);
|
|
8094
|
+
var sideState = [];
|
|
8095
|
+
var sidePanels = "";
|
|
8096
|
+
// check data attribute exists
|
|
8097
|
+
var groupKeys = [];
|
|
8098
|
+
var groupPanels = {};
|
|
8099
|
+
var sideCamera = document.createElement("div");
|
|
8100
|
+
sideCamera.classList.add(CLASS.CAMERA);
|
|
8101
|
+
var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
|
|
8102
|
+
if (!isCrossStructure) {
|
|
8103
|
+
viewportEl.setAttribute("data-cross-structure", "true");
|
|
8104
|
+
panels.forEach(function (panel) {
|
|
8105
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8106
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8107
|
+
groupKeys.push(groupKey);
|
|
8108
|
+
groupPanels[groupKey] = [panel];
|
|
8109
|
+
} else if (groupKey) {
|
|
8110
|
+
groupPanels[groupKey].push(panel);
|
|
8111
|
+
}
|
|
8112
|
+
});
|
|
8113
|
+
if (groupKeys.length) {
|
|
8114
|
+
sideState = groupKeys.reduce(function (state, key) {
|
|
8115
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8116
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8117
|
+
sidePanels += panel.outerHTML;
|
|
8118
|
+
el.innerHTML += panel.outerHTML;
|
|
8119
|
+
return el;
|
|
8120
|
+
}, document.createElement("div"));
|
|
8121
|
+
return __spread(state, [{
|
|
8122
|
+
key: key,
|
|
8123
|
+
start: start,
|
|
8124
|
+
end: start + groupPanels[key].length - 1,
|
|
8125
|
+
element: element
|
|
8126
|
+
}]);
|
|
8127
|
+
}, []);
|
|
8128
|
+
this.remove(0, this.panelCount - groupKeys.length);
|
|
8129
|
+
sideState.forEach(function (_, i) {
|
|
8130
|
+
var panel = _this.camera.children[i];
|
|
8131
|
+
Array.from(panel.attributes).forEach(function (attribute) {
|
|
8132
|
+
return panel.removeAttribute(attribute.name);
|
|
8133
|
+
});
|
|
8134
|
+
});
|
|
8135
|
+
} else {
|
|
8136
|
+
sideState = panels.reduce(function (state, panel, i) {
|
|
8137
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8138
|
+
sidePanels += panel.innerHTML;
|
|
8139
|
+
return __spread(state, [{
|
|
8140
|
+
key: i.toString(),
|
|
8141
|
+
start: start,
|
|
8142
|
+
end: start + panel.children.length - 1,
|
|
8143
|
+
element: panel
|
|
8144
|
+
}]);
|
|
8145
|
+
}, []);
|
|
8146
|
+
}
|
|
8147
|
+
sideCamera.innerHTML = sidePanels;
|
|
8148
|
+
sideState.forEach(function (_, i) {
|
|
8149
|
+
var panel = _this.camera.children[i];
|
|
8150
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8151
|
+
if (!panel.classList.contains(className)) {
|
|
8152
|
+
panel.classList.add(className);
|
|
8153
|
+
}
|
|
8154
|
+
});
|
|
8155
|
+
panel.innerHTML = sideCamera.outerHTML;
|
|
8156
|
+
});
|
|
8157
|
+
} else {
|
|
8158
|
+
toArray(panels[0].children[0].children).forEach(function (panel) {
|
|
8159
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8160
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8161
|
+
groupKeys.push(groupKey);
|
|
8162
|
+
groupPanels[groupKey] = [panel];
|
|
8163
|
+
} else if (groupKey) {
|
|
8164
|
+
groupPanels[groupKey].push(panel);
|
|
8165
|
+
}
|
|
8166
|
+
});
|
|
8167
|
+
sideState = groupKeys.reduce(function (state, key) {
|
|
8168
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8169
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8170
|
+
el.innerHTML += panel.outerHTML;
|
|
8171
|
+
return el;
|
|
8172
|
+
}, document.createElement("div"));
|
|
8173
|
+
return __spread(state, [{
|
|
8174
|
+
key: key,
|
|
8175
|
+
start: start,
|
|
8176
|
+
end: start + groupPanels[key].length - 1,
|
|
8177
|
+
element: element
|
|
8178
|
+
}]);
|
|
8179
|
+
}, []);
|
|
8180
|
+
}
|
|
8181
|
+
return sideState;
|
|
8182
|
+
};
|
|
8183
|
+
__proto._createSideFlicking = function () {
|
|
8184
|
+
var _this = this;
|
|
8185
|
+
return this.sideState.map(function (state, i) {
|
|
8186
|
+
return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
|
|
8187
|
+
horizontal: false,
|
|
8188
|
+
panelsPerView: 1,
|
|
8189
|
+
defaultIndex: state.start
|
|
8190
|
+
}));
|
|
8191
|
+
});
|
|
8192
|
+
};
|
|
8193
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8194
|
+
var _this = this;
|
|
8195
|
+
this.stopAnimation();
|
|
8196
|
+
this._sideFlicking.forEach(function (child, i) {
|
|
8197
|
+
var _a = _this._sideState[i],
|
|
8198
|
+
start = _a.start,
|
|
8199
|
+
end = _a.end;
|
|
8200
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8201
|
+
child.stopAnimation();
|
|
8202
|
+
void child.moveTo(index, 0);
|
|
8203
|
+
void _this.moveTo(i, 0);
|
|
8204
|
+
}
|
|
8205
|
+
});
|
|
8206
|
+
};
|
|
8207
|
+
return CrossFlicking;
|
|
8208
|
+
}(Flicking);
|
|
8209
|
+
|
|
7872
8210
|
/**
|
|
7873
8211
|
* Decorator that makes the method of flicking available in the framework.
|
|
7874
8212
|
* @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
|
|
@@ -8083,5 +8421,5 @@ var parseAlign = function (alignVal) {
|
|
|
8083
8421
|
* egjs projects are licensed under the MIT license
|
|
8084
8422
|
*/
|
|
8085
8423
|
|
|
8086
|
-
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_TYPE, NormalRenderingStrategy, ORDER, 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, getElementSize, 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 };
|
|
8424
|
+
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, CrossFlicking, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_DIRECTION, MOVE_TYPE, NormalRenderingStrategy, ORDER, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, camelize, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDataAttributes, getDefaultCameraTransform, getDirection, getElement, getElementSize, 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 };
|
|
8087
8425
|
//# sourceMappingURL=flicking.esm.js.map
|