@egjs/flicking 4.12.0-beta.5 → 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 +365 -27
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +357 -27
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +366 -27
- 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 +1131 -785
- 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 +4 -24
- 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.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.12.0-beta.
|
|
7
|
+
version: 4.12.0-beta.6
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
|
|
@@ -12,7 +12,7 @@ version: 4.12.0-beta.5
|
|
|
12
12
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Flicking = factory(global.eg.Component, global.eg.Axes, global.eg.ImReady));
|
|
13
13
|
})(this, (function (Component, Axes, ImReady) { 'use strict';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/******************************************************************************
|
|
16
16
|
Copyright (c) Microsoft Corporation.
|
|
17
17
|
|
|
18
18
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -26,7 +26,7 @@ version: 4.12.0-beta.5
|
|
|
26
26
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27
27
|
PERFORMANCE OF THIS SOFTWARE.
|
|
28
28
|
***************************************************************************** */
|
|
29
|
-
/* global Reflect, Promise */
|
|
29
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
30
30
|
|
|
31
31
|
var extendStatics = function (d, b) {
|
|
32
32
|
extendStatics = Object.setPrototypeOf || {
|
|
@@ -111,7 +111,7 @@ version: 4.12.0-beta.5
|
|
|
111
111
|
}
|
|
112
112
|
function step(op) {
|
|
113
113
|
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
-
while (_) try {
|
|
114
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
115
115
|
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;
|
|
116
116
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
117
117
|
switch (op[0]) {
|
|
@@ -215,6 +215,10 @@ version: 4.12.0-beta.5
|
|
|
215
215
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
216
216
|
return ar;
|
|
217
217
|
}
|
|
218
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
219
|
+
var e = new Error(message);
|
|
220
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
221
|
+
};
|
|
218
222
|
|
|
219
223
|
/*
|
|
220
224
|
* Copyright (c) 2015 NAVER Corp.
|
|
@@ -383,6 +387,8 @@ version: 4.12.0-beta.5
|
|
|
383
387
|
STRICT: "strict"
|
|
384
388
|
};
|
|
385
389
|
var CLASS = {
|
|
390
|
+
VIEWPORT: "flicking-viewport",
|
|
391
|
+
CAMERA: "flicking-camera",
|
|
386
392
|
VERTICAL: "vertical",
|
|
387
393
|
HIDDEN: "flicking-hidden",
|
|
388
394
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
@@ -409,6 +415,17 @@ version: 4.12.0-beta.5
|
|
|
409
415
|
LTR: "ltr",
|
|
410
416
|
RTL: "rtl"
|
|
411
417
|
};
|
|
418
|
+
/**
|
|
419
|
+
* An object that contains the direction that {@link Flicking} is moving
|
|
420
|
+
* @ko {@link Flicking}이 움직이는 방향을 담고 있는 객체
|
|
421
|
+
* @type {object}
|
|
422
|
+
* @property {"horizontal"} HORIZONTAL horizontal<ko>수평 방향</ko>
|
|
423
|
+
* @property {"vertical"} VERTICAL vertical<ko>수직 방향</ko>
|
|
424
|
+
*/
|
|
425
|
+
var MOVE_DIRECTION = {
|
|
426
|
+
HORIZONTAL: "horizontal",
|
|
427
|
+
VERTICAL: "vertical"
|
|
428
|
+
};
|
|
412
429
|
|
|
413
430
|
var Constants = {
|
|
414
431
|
__proto__: null,
|
|
@@ -419,6 +436,7 @@ version: 4.12.0-beta.5
|
|
|
419
436
|
CLASS: CLASS,
|
|
420
437
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
421
438
|
ORDER: ORDER,
|
|
439
|
+
MOVE_DIRECTION: MOVE_DIRECTION,
|
|
422
440
|
ERROR_CODE: CODE
|
|
423
441
|
};
|
|
424
442
|
|
|
@@ -735,6 +753,26 @@ version: 4.12.0-beta.5
|
|
|
735
753
|
obj.__proto__ = proto;
|
|
736
754
|
return obj;
|
|
737
755
|
};
|
|
756
|
+
var camelize = function (str) {
|
|
757
|
+
return str.replace(/[\s-_]([a-z])/g, function (all, letter) {
|
|
758
|
+
return letter.toUpperCase();
|
|
759
|
+
});
|
|
760
|
+
};
|
|
761
|
+
var getDataAttributes = function (element, attributePrefix) {
|
|
762
|
+
var dataAttributes = {};
|
|
763
|
+
var attributes = element.attributes;
|
|
764
|
+
var length = attributes.length;
|
|
765
|
+
for (var i = 0; i < length; ++i) {
|
|
766
|
+
var attribute = attributes[i];
|
|
767
|
+
var name_1 = attribute.name,
|
|
768
|
+
value = attribute.value;
|
|
769
|
+
if (name_1.indexOf(attributePrefix) === -1) {
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
dataAttributes[camelize(name_1.replace(attributePrefix, ""))] = value;
|
|
773
|
+
}
|
|
774
|
+
return dataAttributes;
|
|
775
|
+
};
|
|
738
776
|
|
|
739
777
|
var Utils = {
|
|
740
778
|
__proto__: null,
|
|
@@ -766,7 +804,9 @@ version: 4.12.0-beta.5
|
|
|
766
804
|
circulateIndex: circulateIndex,
|
|
767
805
|
range: range,
|
|
768
806
|
getElementSize: getElementSize,
|
|
769
|
-
setPrototypeOf: setPrototypeOf
|
|
807
|
+
setPrototypeOf: setPrototypeOf,
|
|
808
|
+
camelize: camelize,
|
|
809
|
+
getDataAttributes: getDataAttributes
|
|
770
810
|
};
|
|
771
811
|
|
|
772
812
|
/*
|
|
@@ -3775,7 +3815,6 @@ version: 4.12.0-beta.5
|
|
|
3775
3815
|
var _this = this;
|
|
3776
3816
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
3777
3817
|
align = _b === void 0 ? ALIGN.CENTER : _b;
|
|
3778
|
-
this._lookedOffset = 0;
|
|
3779
3818
|
this._checkTranslateSupport = function () {
|
|
3780
3819
|
var e_1, _a;
|
|
3781
3820
|
var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
|
|
@@ -4135,8 +4174,6 @@ version: 4.12.0-beta.5
|
|
|
4135
4174
|
*/
|
|
4136
4175
|
__proto.lookAt = function (pos) {
|
|
4137
4176
|
var _this = this;
|
|
4138
|
-
var prevOffset = this._offset;
|
|
4139
|
-
var isChangedOffset = this._lookedOffset !== prevOffset;
|
|
4140
4177
|
var flicking = getFlickingAttached(this._flicking);
|
|
4141
4178
|
var prevPos = this._position;
|
|
4142
4179
|
this._position = pos;
|
|
@@ -4147,12 +4184,7 @@ version: 4.12.0-beta.5
|
|
|
4147
4184
|
if (toggled) {
|
|
4148
4185
|
void flicking.renderer.render().then(function () {
|
|
4149
4186
|
_this.updateOffset();
|
|
4150
|
-
_this._lookedOffset = _this._offset;
|
|
4151
4187
|
});
|
|
4152
|
-
} else if (isChangedOffset) {
|
|
4153
|
-
// sync offset for renderOnlyVisible on resize
|
|
4154
|
-
this.updateOffset();
|
|
4155
|
-
this._lookedOffset = this._offset;
|
|
4156
4188
|
} else {
|
|
4157
4189
|
this.applyTransform();
|
|
4158
4190
|
}
|
|
@@ -4327,8 +4359,8 @@ version: 4.12.0-beta.5
|
|
|
4327
4359
|
return this;
|
|
4328
4360
|
};
|
|
4329
4361
|
/**
|
|
4330
|
-
* Update Viewport's height to
|
|
4331
|
-
* @ko 현재
|
|
4362
|
+
* Update Viewport's height to active panel's height
|
|
4363
|
+
* @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
|
|
4332
4364
|
* @throws {FlickingError}
|
|
4333
4365
|
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4334
4366
|
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
@@ -4338,17 +4370,9 @@ version: 4.12.0-beta.5
|
|
|
4338
4370
|
__proto.updateAdaptiveHeight = function () {
|
|
4339
4371
|
var flicking = getFlickingAttached(this._flicking);
|
|
4340
4372
|
var activePanel = flicking.control.activePanel;
|
|
4341
|
-
|
|
4342
|
-
var selectedPanels = __spread(visiblePanels);
|
|
4343
|
-
if (activePanel) {
|
|
4344
|
-
selectedPanels.push(activePanel);
|
|
4345
|
-
}
|
|
4346
|
-
if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
|
|
4347
|
-
var maxHeight = Math.max.apply(Math, __spread(selectedPanels.map(function (panel) {
|
|
4348
|
-
return panel.height;
|
|
4349
|
-
})));
|
|
4373
|
+
if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
|
|
4350
4374
|
flicking.viewport.setSize({
|
|
4351
|
-
height:
|
|
4375
|
+
height: activePanel.height
|
|
4352
4376
|
});
|
|
4353
4377
|
};
|
|
4354
4378
|
/**
|
|
@@ -4419,7 +4443,6 @@ version: 4.12.0-beta.5
|
|
|
4419
4443
|
};
|
|
4420
4444
|
__proto._resetInternalValues = function () {
|
|
4421
4445
|
this._position = 0;
|
|
4422
|
-
this._lookedOffset = 0;
|
|
4423
4446
|
this._alignPos = 0;
|
|
4424
4447
|
this._offset = 0;
|
|
4425
4448
|
this._circularOffset = 0;
|
|
@@ -7968,10 +7991,325 @@ version: 4.12.0-beta.5
|
|
|
7968
7991
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7969
7992
|
* ```
|
|
7970
7993
|
*/
|
|
7971
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7994
|
+
Flicking.VERSION = "4.12.0-beta.6";
|
|
7972
7995
|
return Flicking;
|
|
7973
7996
|
}(Component);
|
|
7974
7997
|
|
|
7998
|
+
/*
|
|
7999
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
8000
|
+
* egjs projects are licensed under the MIT license
|
|
8001
|
+
*/
|
|
8002
|
+
/**
|
|
8003
|
+
* @extends Component
|
|
8004
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
8005
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
8006
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
8007
|
+
*/
|
|
8008
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
8009
|
+
__extends(CrossFlicking, _super);
|
|
8010
|
+
// Options Setter
|
|
8011
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
8012
|
+
// this._align = val;
|
|
8013
|
+
// }
|
|
8014
|
+
function CrossFlicking(root, options) {
|
|
8015
|
+
if (options === void 0) {
|
|
8016
|
+
options = {};
|
|
8017
|
+
}
|
|
8018
|
+
var _this = _super.call(this, root, options) || this;
|
|
8019
|
+
_this._onHorizontalHoldStart = function () {
|
|
8020
|
+
_this.dragThreshold = 10;
|
|
8021
|
+
_this._moveDirection = null;
|
|
8022
|
+
};
|
|
8023
|
+
_this._onHorizontalMove = function (e) {
|
|
8024
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
8025
|
+
_this._sideFlicking.forEach(function (child) {
|
|
8026
|
+
child.dragThreshold = Infinity;
|
|
8027
|
+
});
|
|
8028
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
8029
|
+
}
|
|
8030
|
+
};
|
|
8031
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
8032
|
+
var visiblePanels = _this.visiblePanels;
|
|
8033
|
+
_this._sideFlicking.forEach(function (child) {
|
|
8034
|
+
child.dragThreshold = 10;
|
|
8035
|
+
});
|
|
8036
|
+
_this._moveDirection = null;
|
|
8037
|
+
if (visiblePanels.length > 1) {
|
|
8038
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
8039
|
+
} else {
|
|
8040
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
8041
|
+
}
|
|
8042
|
+
// _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 timeout으로 처리
|
|
8043
|
+
setTimeout(function () {
|
|
8044
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
8045
|
+
if (_this._nextIndex !== i) {
|
|
8046
|
+
var _a = _this._sideState[i],
|
|
8047
|
+
start = _a.start,
|
|
8048
|
+
end = _a.end;
|
|
8049
|
+
if (child.index < start) {
|
|
8050
|
+
child.stopAnimation();
|
|
8051
|
+
void child.moveTo(start, 0);
|
|
8052
|
+
} else if (child.index > end) {
|
|
8053
|
+
child.stopAnimation();
|
|
8054
|
+
void child.moveTo(end, 0);
|
|
8055
|
+
}
|
|
8056
|
+
}
|
|
8057
|
+
});
|
|
8058
|
+
});
|
|
8059
|
+
if (e.isTrusted) {
|
|
8060
|
+
_this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
8061
|
+
}
|
|
8062
|
+
};
|
|
8063
|
+
_this._onSideHoldStart = function () {
|
|
8064
|
+
_this._sideFlicking.forEach(function (child) {
|
|
8065
|
+
child.dragThreshold = 10;
|
|
8066
|
+
});
|
|
8067
|
+
_this._moveDirection = null;
|
|
8068
|
+
};
|
|
8069
|
+
_this._onSideMove = function (e) {
|
|
8070
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
8071
|
+
_this.dragThreshold = Infinity;
|
|
8072
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
8073
|
+
}
|
|
8074
|
+
};
|
|
8075
|
+
_this._onSideMoveEnd = function () {
|
|
8076
|
+
_this.dragThreshold = 10;
|
|
8077
|
+
_this._moveDirection = null;
|
|
8078
|
+
};
|
|
8079
|
+
_this._onSideChanged = function (e) {
|
|
8080
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
8081
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
8082
|
+
if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
|
|
8083
|
+
_this._syncToCategory(e.index, _this.index);
|
|
8084
|
+
}
|
|
8085
|
+
};
|
|
8086
|
+
// Internal states
|
|
8087
|
+
_this._sideState = _this._createSideState();
|
|
8088
|
+
_this._moveDirection = null;
|
|
8089
|
+
_this._nextIndex = 0;
|
|
8090
|
+
// Bind options
|
|
8091
|
+
_this._sideOptions = options.sideOptions;
|
|
8092
|
+
// Create core components
|
|
8093
|
+
_this._sideFlicking = _this._createSideFlicking();
|
|
8094
|
+
return _this;
|
|
8095
|
+
}
|
|
8096
|
+
var __proto = CrossFlicking.prototype;
|
|
8097
|
+
Object.defineProperty(__proto, "sideFlicking", {
|
|
8098
|
+
// Components
|
|
8099
|
+
/**
|
|
8100
|
+
* {@link Control} instance of the Flicking
|
|
8101
|
+
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
|
|
8102
|
+
* @type {Control}
|
|
8103
|
+
* @default SnapControl
|
|
8104
|
+
* @readonly
|
|
8105
|
+
* @see Control
|
|
8106
|
+
* @see SnapControl
|
|
8107
|
+
* @see FreeControl
|
|
8108
|
+
*/
|
|
8109
|
+
get: function () {
|
|
8110
|
+
return this._sideFlicking;
|
|
8111
|
+
},
|
|
8112
|
+
enumerable: false,
|
|
8113
|
+
configurable: true
|
|
8114
|
+
});
|
|
8115
|
+
Object.defineProperty(__proto, "sideState", {
|
|
8116
|
+
// Internal States
|
|
8117
|
+
/**
|
|
8118
|
+
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
8119
|
+
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
|
|
8120
|
+
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
|
|
8121
|
+
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
|
|
8122
|
+
* @type {boolean}
|
|
8123
|
+
* @default false
|
|
8124
|
+
* @readonly
|
|
8125
|
+
*/
|
|
8126
|
+
get: function () {
|
|
8127
|
+
return this._sideState;
|
|
8128
|
+
},
|
|
8129
|
+
enumerable: false,
|
|
8130
|
+
configurable: true
|
|
8131
|
+
});
|
|
8132
|
+
Object.defineProperty(__proto, "sideOptions", {
|
|
8133
|
+
// Options Getter
|
|
8134
|
+
/**
|
|
8135
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
8136
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8137
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8138
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8139
|
+
* @type {FlickingOptions}
|
|
8140
|
+
* @default undefined
|
|
8141
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8142
|
+
*/
|
|
8143
|
+
get: function () {
|
|
8144
|
+
return this._sideOptions;
|
|
8145
|
+
},
|
|
8146
|
+
enumerable: false,
|
|
8147
|
+
configurable: true
|
|
8148
|
+
});
|
|
8149
|
+
/**
|
|
8150
|
+
* Initialize Flicking and move to the default index
|
|
8151
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8152
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8153
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8154
|
+
* @fires Flicking#ready
|
|
8155
|
+
* @return {Promise<void>}
|
|
8156
|
+
*/
|
|
8157
|
+
__proto.init = function () {
|
|
8158
|
+
var _this = this;
|
|
8159
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8160
|
+
return _this._addComponentEvents();
|
|
8161
|
+
});
|
|
8162
|
+
};
|
|
8163
|
+
/**
|
|
8164
|
+
* Destroy Flicking and remove all event handlers
|
|
8165
|
+
* @ko Flicking과 하위 컴포넌트들을 초기 상태로 되돌리고, 부착된 모든 이벤트 핸들러를 제거합니다
|
|
8166
|
+
* @return {void}
|
|
8167
|
+
*/
|
|
8168
|
+
__proto.destroy = function () {
|
|
8169
|
+
// TODO 모든 child flicking destroy
|
|
8170
|
+
_super.prototype.destroy.call(this);
|
|
8171
|
+
};
|
|
8172
|
+
__proto._addComponentEvents = function () {
|
|
8173
|
+
var _this = this;
|
|
8174
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8175
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8176
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8177
|
+
this._sideFlicking.forEach(function (flicking) {
|
|
8178
|
+
flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
|
|
8179
|
+
flicking.on(EVENTS.MOVE, _this._onSideMove);
|
|
8180
|
+
flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
|
|
8181
|
+
flicking.on(EVENTS.CHANGED, _this._onSideChanged);
|
|
8182
|
+
});
|
|
8183
|
+
};
|
|
8184
|
+
__proto._createSideState = function () {
|
|
8185
|
+
var _this = this;
|
|
8186
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 side flicking으로 해보자.
|
|
8187
|
+
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
|
|
8188
|
+
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
|
|
8189
|
+
var viewportEl = this.element;
|
|
8190
|
+
var cameraEl = this.camera.element;
|
|
8191
|
+
var panels = toArray(cameraEl.children);
|
|
8192
|
+
var sideState = [];
|
|
8193
|
+
var sidePanels = "";
|
|
8194
|
+
// check data attribute exists
|
|
8195
|
+
var groupKeys = [];
|
|
8196
|
+
var groupPanels = {};
|
|
8197
|
+
var sideCamera = document.createElement("div");
|
|
8198
|
+
sideCamera.classList.add(CLASS.CAMERA);
|
|
8199
|
+
var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
|
|
8200
|
+
if (!isCrossStructure) {
|
|
8201
|
+
viewportEl.setAttribute("data-cross-structure", "true");
|
|
8202
|
+
panels.forEach(function (panel) {
|
|
8203
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8204
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8205
|
+
groupKeys.push(groupKey);
|
|
8206
|
+
groupPanels[groupKey] = [panel];
|
|
8207
|
+
} else if (groupKey) {
|
|
8208
|
+
groupPanels[groupKey].push(panel);
|
|
8209
|
+
}
|
|
8210
|
+
});
|
|
8211
|
+
if (groupKeys.length) {
|
|
8212
|
+
sideState = groupKeys.reduce(function (state, key) {
|
|
8213
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8214
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8215
|
+
sidePanels += panel.outerHTML;
|
|
8216
|
+
el.innerHTML += panel.outerHTML;
|
|
8217
|
+
return el;
|
|
8218
|
+
}, document.createElement("div"));
|
|
8219
|
+
return __spread(state, [{
|
|
8220
|
+
key: key,
|
|
8221
|
+
start: start,
|
|
8222
|
+
end: start + groupPanels[key].length - 1,
|
|
8223
|
+
element: element
|
|
8224
|
+
}]);
|
|
8225
|
+
}, []);
|
|
8226
|
+
this.remove(0, this.panelCount - groupKeys.length);
|
|
8227
|
+
sideState.forEach(function (_, i) {
|
|
8228
|
+
var panel = _this.camera.children[i];
|
|
8229
|
+
Array.from(panel.attributes).forEach(function (attribute) {
|
|
8230
|
+
return panel.removeAttribute(attribute.name);
|
|
8231
|
+
});
|
|
8232
|
+
});
|
|
8233
|
+
} else {
|
|
8234
|
+
sideState = panels.reduce(function (state, panel, i) {
|
|
8235
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8236
|
+
sidePanels += panel.innerHTML;
|
|
8237
|
+
return __spread(state, [{
|
|
8238
|
+
key: i.toString(),
|
|
8239
|
+
start: start,
|
|
8240
|
+
end: start + panel.children.length - 1,
|
|
8241
|
+
element: panel
|
|
8242
|
+
}]);
|
|
8243
|
+
}, []);
|
|
8244
|
+
}
|
|
8245
|
+
sideCamera.innerHTML = sidePanels;
|
|
8246
|
+
sideState.forEach(function (_, i) {
|
|
8247
|
+
var panel = _this.camera.children[i];
|
|
8248
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8249
|
+
if (!panel.classList.contains(className)) {
|
|
8250
|
+
panel.classList.add(className);
|
|
8251
|
+
}
|
|
8252
|
+
});
|
|
8253
|
+
panel.innerHTML = sideCamera.outerHTML;
|
|
8254
|
+
});
|
|
8255
|
+
} else {
|
|
8256
|
+
toArray(panels[0].children[0].children).forEach(function (panel) {
|
|
8257
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8258
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8259
|
+
groupKeys.push(groupKey);
|
|
8260
|
+
groupPanels[groupKey] = [panel];
|
|
8261
|
+
} else if (groupKey) {
|
|
8262
|
+
groupPanels[groupKey].push(panel);
|
|
8263
|
+
}
|
|
8264
|
+
});
|
|
8265
|
+
sideState = groupKeys.reduce(function (state, key) {
|
|
8266
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8267
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8268
|
+
el.innerHTML += panel.outerHTML;
|
|
8269
|
+
return el;
|
|
8270
|
+
}, document.createElement("div"));
|
|
8271
|
+
return __spread(state, [{
|
|
8272
|
+
key: key,
|
|
8273
|
+
start: start,
|
|
8274
|
+
end: start + groupPanels[key].length - 1,
|
|
8275
|
+
element: element
|
|
8276
|
+
}]);
|
|
8277
|
+
}, []);
|
|
8278
|
+
}
|
|
8279
|
+
return sideState;
|
|
8280
|
+
};
|
|
8281
|
+
__proto._createSideFlicking = function () {
|
|
8282
|
+
var _this = this;
|
|
8283
|
+
return this.sideState.map(function (state, i) {
|
|
8284
|
+
return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
|
|
8285
|
+
horizontal: false,
|
|
8286
|
+
panelsPerView: 1,
|
|
8287
|
+
defaultIndex: state.start
|
|
8288
|
+
}));
|
|
8289
|
+
});
|
|
8290
|
+
};
|
|
8291
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8292
|
+
var _this = this;
|
|
8293
|
+
this.stopAnimation();
|
|
8294
|
+
this._sideFlicking.forEach(function (child, i) {
|
|
8295
|
+
var _a = _this._sideState[i],
|
|
8296
|
+
start = _a.start,
|
|
8297
|
+
end = _a.end;
|
|
8298
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8299
|
+
child.stopAnimation();
|
|
8300
|
+
void child.moveTo(index, 0);
|
|
8301
|
+
void _this.moveTo(i, 0);
|
|
8302
|
+
}
|
|
8303
|
+
});
|
|
8304
|
+
};
|
|
8305
|
+
return CrossFlicking;
|
|
8306
|
+
}(Flicking);
|
|
8307
|
+
|
|
8308
|
+
var CrossFlicking$1 = {
|
|
8309
|
+
__proto__: null,
|
|
8310
|
+
CrossFlicking: CrossFlicking
|
|
8311
|
+
};
|
|
8312
|
+
|
|
7975
8313
|
/*
|
|
7976
8314
|
* Copyright (c) 2015 NAVER Corp.
|
|
7977
8315
|
* egjs projects are licensed under the MIT license
|
|
@@ -8217,6 +8555,7 @@ version: 4.12.0-beta.5
|
|
|
8217
8555
|
merge(Flicking, Constants);
|
|
8218
8556
|
merge(Flicking, CFC);
|
|
8219
8557
|
merge(Flicking, Utils);
|
|
8558
|
+
merge(Flicking, CrossFlicking$1);
|
|
8220
8559
|
|
|
8221
8560
|
return Flicking;
|
|
8222
8561
|
|