@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/declaration/utils.d.ts
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import Flicking, { FlickingOptions } from "./Flicking";
|
|
2
|
-
import { ALIGN, DIRECTION } from "./const/external";
|
|
3
|
-
import { LiteralUnion, Merged, ValueOf } from "./type/internal";
|
|
4
|
-
import { ElementLike } from "./type/external";
|
|
5
|
-
export declare const merge: <From extends object, To extends object>(target: From, ...sources: To[]) => Merged<From, To>;
|
|
6
|
-
export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement) => HTMLElement;
|
|
7
|
-
export declare const checkExistence: (value: any, nameOnErrMsg: string) => void;
|
|
8
|
-
export declare const clamp: (x: number, min: number, max: number) => number;
|
|
9
|
-
export declare const getFlickingAttached: (val: Flicking | null) => Flicking;
|
|
10
|
-
export declare const toArray: <T>(iterable: ArrayLike<T>) => T[];
|
|
11
|
-
export declare const parseAlign: (align: LiteralUnion<ValueOf<typeof ALIGN>> | number, size: number) => number;
|
|
12
|
-
export declare const parseBounce: (bounce: FlickingOptions["bounce"], size: number) => number[];
|
|
13
|
-
export declare const parseArithmeticSize: (cssValue: number | string, base: number) => number | null;
|
|
14
|
-
export declare const parseArithmeticExpression: (cssValue: number | string) => {
|
|
15
|
-
percentage: number;
|
|
16
|
-
absolute: number;
|
|
17
|
-
} | null;
|
|
18
|
-
export declare const parseCSSSizeValue: (val: string | number) => string;
|
|
19
|
-
export declare const parsePanelAlign: (align: FlickingOptions["align"]) => string | number;
|
|
20
|
-
export declare const getDirection: (start: number, end: number) => ValueOf<typeof DIRECTION>;
|
|
21
|
-
export declare const parseElement: (element: ElementLike | ElementLike[]) => HTMLElement[];
|
|
22
|
-
export declare const getMinusCompensatedIndex: (idx: number, max: number) => number;
|
|
23
|
-
export declare const includes: <T>(array: T[], target: any) => target is T;
|
|
24
|
-
export declare const isString: (val: any) => val is string;
|
|
25
|
-
export declare const circulatePosition: (pos: number, min: number, max: number) => number;
|
|
26
|
-
export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T;
|
|
27
|
-
export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T;
|
|
28
|
-
export declare const findIndex: <T>(array: T[], checker: (val: T) => boolean) => number;
|
|
29
|
-
export declare const getProgress: (pos: number, prev: number, next: number) => number;
|
|
30
|
-
export declare const getStyle: (el: HTMLElement) => CSSStyleDeclaration;
|
|
31
|
-
export declare const setSize: (el: HTMLElement, { width, height }: Partial<{
|
|
32
|
-
width: number | string;
|
|
33
|
-
height: number | string;
|
|
34
|
-
}>) => void;
|
|
35
|
-
export declare const isBetween: (val: number, min: number, max: number) => boolean;
|
|
36
|
-
export declare const circulateIndex: (index: number, max: number) => number;
|
|
37
|
-
export declare const range: (end: number) => number[];
|
|
38
|
-
export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOffset, style }: {
|
|
39
|
-
el: HTMLElement;
|
|
40
|
-
horizontal: boolean;
|
|
41
|
-
useFractionalSize: boolean;
|
|
42
|
-
useOffset: boolean;
|
|
43
|
-
style: CSSStyleDeclaration;
|
|
44
|
-
}) => number;
|
|
45
|
-
export declare const setPrototypeOf: (o: any, proto: object) => any;
|
|
1
|
+
import Flicking, { FlickingOptions } from "./Flicking";
|
|
2
|
+
import { ALIGN, DIRECTION } from "./const/external";
|
|
3
|
+
import { LiteralUnion, Merged, ValueOf } from "./type/internal";
|
|
4
|
+
import { ElementLike } from "./type/external";
|
|
5
|
+
export declare const merge: <From extends object, To extends object>(target: From, ...sources: To[]) => Merged<From, To>;
|
|
6
|
+
export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement) => HTMLElement;
|
|
7
|
+
export declare const checkExistence: (value: any, nameOnErrMsg: string) => void;
|
|
8
|
+
export declare const clamp: (x: number, min: number, max: number) => number;
|
|
9
|
+
export declare const getFlickingAttached: (val: Flicking | null) => Flicking;
|
|
10
|
+
export declare const toArray: <T>(iterable: ArrayLike<T>) => T[];
|
|
11
|
+
export declare const parseAlign: (align: LiteralUnion<ValueOf<typeof ALIGN>> | number, size: number) => number;
|
|
12
|
+
export declare const parseBounce: (bounce: FlickingOptions["bounce"], size: number) => number[];
|
|
13
|
+
export declare const parseArithmeticSize: (cssValue: number | string, base: number) => number | null;
|
|
14
|
+
export declare const parseArithmeticExpression: (cssValue: number | string) => {
|
|
15
|
+
percentage: number;
|
|
16
|
+
absolute: number;
|
|
17
|
+
} | null;
|
|
18
|
+
export declare const parseCSSSizeValue: (val: string | number) => string;
|
|
19
|
+
export declare const parsePanelAlign: (align: FlickingOptions["align"]) => string | number;
|
|
20
|
+
export declare const getDirection: (start: number, end: number) => ValueOf<typeof DIRECTION>;
|
|
21
|
+
export declare const parseElement: (element: ElementLike | ElementLike[]) => HTMLElement[];
|
|
22
|
+
export declare const getMinusCompensatedIndex: (idx: number, max: number) => number;
|
|
23
|
+
export declare const includes: <T>(array: T[], target: any) => target is T;
|
|
24
|
+
export declare const isString: (val: any) => val is string;
|
|
25
|
+
export declare const circulatePosition: (pos: number, min: number, max: number) => number;
|
|
26
|
+
export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T;
|
|
27
|
+
export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T;
|
|
28
|
+
export declare const findIndex: <T>(array: T[], checker: (val: T) => boolean) => number;
|
|
29
|
+
export declare const getProgress: (pos: number, prev: number, next: number) => number;
|
|
30
|
+
export declare const getStyle: (el: HTMLElement) => CSSStyleDeclaration;
|
|
31
|
+
export declare const setSize: (el: HTMLElement, { width, height }: Partial<{
|
|
32
|
+
width: number | string;
|
|
33
|
+
height: number | string;
|
|
34
|
+
}>) => void;
|
|
35
|
+
export declare const isBetween: (val: number, min: number, max: number) => boolean;
|
|
36
|
+
export declare const circulateIndex: (index: number, max: number) => number;
|
|
37
|
+
export declare const range: (end: number) => number[];
|
|
38
|
+
export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOffset, style }: {
|
|
39
|
+
el: HTMLElement;
|
|
40
|
+
horizontal: boolean;
|
|
41
|
+
useFractionalSize: boolean;
|
|
42
|
+
useOffset: boolean;
|
|
43
|
+
style: CSSStyleDeclaration;
|
|
44
|
+
}) => number;
|
|
45
|
+
export declare const setPrototypeOf: (o: any, proto: object) => any;
|
|
46
|
+
export declare const camelize: (str: string) => string;
|
|
47
|
+
export declare const getDataAttributes: (element: HTMLElement, attributePrefix: string) => Record<string, string>;
|
package/dist/flicking.cjs.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
|
'use strict';
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ var Component = require('@egjs/component');
|
|
|
12
12
|
var Axes = require('@egjs/axes');
|
|
13
13
|
var ImReady = require('@egjs/imready');
|
|
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 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
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 @@ function __generator(thisArg, body) {
|
|
|
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 @@ function __spread() {
|
|
|
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 @@ var MOVE_TYPE = {
|
|
|
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 @@ var ORDER = {
|
|
|
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
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
414
431
|
var merge = function (target) {
|
|
@@ -723,6 +740,26 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
|
723
740
|
obj.__proto__ = proto;
|
|
724
741
|
return obj;
|
|
725
742
|
};
|
|
743
|
+
var camelize = function (str) {
|
|
744
|
+
return str.replace(/[\s-_]([a-z])/g, function (all, letter) {
|
|
745
|
+
return letter.toUpperCase();
|
|
746
|
+
});
|
|
747
|
+
};
|
|
748
|
+
var getDataAttributes = function (element, attributePrefix) {
|
|
749
|
+
var dataAttributes = {};
|
|
750
|
+
var attributes = element.attributes;
|
|
751
|
+
var length = attributes.length;
|
|
752
|
+
for (var i = 0; i < length; ++i) {
|
|
753
|
+
var attribute = attributes[i];
|
|
754
|
+
var name_1 = attribute.name,
|
|
755
|
+
value = attribute.value;
|
|
756
|
+
if (name_1.indexOf(attributePrefix) === -1) {
|
|
757
|
+
continue;
|
|
758
|
+
}
|
|
759
|
+
dataAttributes[camelize(name_1.replace(attributePrefix, ""))] = value;
|
|
760
|
+
}
|
|
761
|
+
return dataAttributes;
|
|
762
|
+
};
|
|
726
763
|
|
|
727
764
|
/*
|
|
728
765
|
* Copyright (c) 2015 NAVER Corp.
|
|
@@ -3709,7 +3746,6 @@ var Camera = /*#__PURE__*/function () {
|
|
|
3709
3746
|
var _this = this;
|
|
3710
3747
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
3711
3748
|
align = _b === void 0 ? ALIGN.CENTER : _b;
|
|
3712
|
-
this._lookedOffset = 0;
|
|
3713
3749
|
this._checkTranslateSupport = function () {
|
|
3714
3750
|
var e_1, _a;
|
|
3715
3751
|
var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
|
|
@@ -4069,8 +4105,6 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4069
4105
|
*/
|
|
4070
4106
|
__proto.lookAt = function (pos) {
|
|
4071
4107
|
var _this = this;
|
|
4072
|
-
var prevOffset = this._offset;
|
|
4073
|
-
var isChangedOffset = this._lookedOffset !== prevOffset;
|
|
4074
4108
|
var flicking = getFlickingAttached(this._flicking);
|
|
4075
4109
|
var prevPos = this._position;
|
|
4076
4110
|
this._position = pos;
|
|
@@ -4081,12 +4115,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4081
4115
|
if (toggled) {
|
|
4082
4116
|
void flicking.renderer.render().then(function () {
|
|
4083
4117
|
_this.updateOffset();
|
|
4084
|
-
_this._lookedOffset = _this._offset;
|
|
4085
4118
|
});
|
|
4086
|
-
} else if (isChangedOffset) {
|
|
4087
|
-
// sync offset for renderOnlyVisible on resize
|
|
4088
|
-
this.updateOffset();
|
|
4089
|
-
this._lookedOffset = this._offset;
|
|
4090
4119
|
} else {
|
|
4091
4120
|
this.applyTransform();
|
|
4092
4121
|
}
|
|
@@ -4345,7 +4374,6 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4345
4374
|
};
|
|
4346
4375
|
__proto._resetInternalValues = function () {
|
|
4347
4376
|
this._position = 0;
|
|
4348
|
-
this._lookedOffset = 0;
|
|
4349
4377
|
this._alignPos = 0;
|
|
4350
4378
|
this._offset = 0;
|
|
4351
4379
|
this._circularOffset = 0;
|
|
@@ -7867,10 +7895,320 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7867
7895
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7868
7896
|
* ```
|
|
7869
7897
|
*/
|
|
7870
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7898
|
+
Flicking.VERSION = "4.12.0-beta.6";
|
|
7871
7899
|
return Flicking;
|
|
7872
7900
|
}(Component);
|
|
7873
7901
|
|
|
7902
|
+
/*
|
|
7903
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7904
|
+
* egjs projects are licensed under the MIT license
|
|
7905
|
+
*/
|
|
7906
|
+
/**
|
|
7907
|
+
* @extends Component
|
|
7908
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7909
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7910
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7911
|
+
*/
|
|
7912
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7913
|
+
__extends(CrossFlicking, _super);
|
|
7914
|
+
// Options Setter
|
|
7915
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7916
|
+
// this._align = val;
|
|
7917
|
+
// }
|
|
7918
|
+
function CrossFlicking(root, options) {
|
|
7919
|
+
if (options === void 0) {
|
|
7920
|
+
options = {};
|
|
7921
|
+
}
|
|
7922
|
+
var _this = _super.call(this, root, options) || this;
|
|
7923
|
+
_this._onHorizontalHoldStart = function () {
|
|
7924
|
+
_this.dragThreshold = 10;
|
|
7925
|
+
_this._moveDirection = null;
|
|
7926
|
+
};
|
|
7927
|
+
_this._onHorizontalMove = function (e) {
|
|
7928
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7929
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7930
|
+
child.dragThreshold = Infinity;
|
|
7931
|
+
});
|
|
7932
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
7933
|
+
}
|
|
7934
|
+
};
|
|
7935
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
7936
|
+
var visiblePanels = _this.visiblePanels;
|
|
7937
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7938
|
+
child.dragThreshold = 10;
|
|
7939
|
+
});
|
|
7940
|
+
_this._moveDirection = null;
|
|
7941
|
+
if (visiblePanels.length > 1) {
|
|
7942
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
7943
|
+
} else {
|
|
7944
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
7945
|
+
}
|
|
7946
|
+
// _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 timeout으로 처리
|
|
7947
|
+
setTimeout(function () {
|
|
7948
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
7949
|
+
if (_this._nextIndex !== i) {
|
|
7950
|
+
var _a = _this._sideState[i],
|
|
7951
|
+
start = _a.start,
|
|
7952
|
+
end = _a.end;
|
|
7953
|
+
if (child.index < start) {
|
|
7954
|
+
child.stopAnimation();
|
|
7955
|
+
void child.moveTo(start, 0);
|
|
7956
|
+
} else if (child.index > end) {
|
|
7957
|
+
child.stopAnimation();
|
|
7958
|
+
void child.moveTo(end, 0);
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7961
|
+
});
|
|
7962
|
+
});
|
|
7963
|
+
if (e.isTrusted) {
|
|
7964
|
+
_this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
7965
|
+
}
|
|
7966
|
+
};
|
|
7967
|
+
_this._onSideHoldStart = function () {
|
|
7968
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7969
|
+
child.dragThreshold = 10;
|
|
7970
|
+
});
|
|
7971
|
+
_this._moveDirection = null;
|
|
7972
|
+
};
|
|
7973
|
+
_this._onSideMove = function (e) {
|
|
7974
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7975
|
+
_this.dragThreshold = Infinity;
|
|
7976
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
7977
|
+
}
|
|
7978
|
+
};
|
|
7979
|
+
_this._onSideMoveEnd = function () {
|
|
7980
|
+
_this.dragThreshold = 10;
|
|
7981
|
+
_this._moveDirection = null;
|
|
7982
|
+
};
|
|
7983
|
+
_this._onSideChanged = function (e) {
|
|
7984
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
7985
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
7986
|
+
if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
|
|
7987
|
+
_this._syncToCategory(e.index, _this.index);
|
|
7988
|
+
}
|
|
7989
|
+
};
|
|
7990
|
+
// Internal states
|
|
7991
|
+
_this._sideState = _this._createSideState();
|
|
7992
|
+
_this._moveDirection = null;
|
|
7993
|
+
_this._nextIndex = 0;
|
|
7994
|
+
// Bind options
|
|
7995
|
+
_this._sideOptions = options.sideOptions;
|
|
7996
|
+
// Create core components
|
|
7997
|
+
_this._sideFlicking = _this._createSideFlicking();
|
|
7998
|
+
return _this;
|
|
7999
|
+
}
|
|
8000
|
+
var __proto = CrossFlicking.prototype;
|
|
8001
|
+
Object.defineProperty(__proto, "sideFlicking", {
|
|
8002
|
+
// Components
|
|
8003
|
+
/**
|
|
8004
|
+
* {@link Control} instance of the Flicking
|
|
8005
|
+
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
|
|
8006
|
+
* @type {Control}
|
|
8007
|
+
* @default SnapControl
|
|
8008
|
+
* @readonly
|
|
8009
|
+
* @see Control
|
|
8010
|
+
* @see SnapControl
|
|
8011
|
+
* @see FreeControl
|
|
8012
|
+
*/
|
|
8013
|
+
get: function () {
|
|
8014
|
+
return this._sideFlicking;
|
|
8015
|
+
},
|
|
8016
|
+
enumerable: false,
|
|
8017
|
+
configurable: true
|
|
8018
|
+
});
|
|
8019
|
+
Object.defineProperty(__proto, "sideState", {
|
|
8020
|
+
// Internal States
|
|
8021
|
+
/**
|
|
8022
|
+
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
8023
|
+
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
|
|
8024
|
+
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
|
|
8025
|
+
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
|
|
8026
|
+
* @type {boolean}
|
|
8027
|
+
* @default false
|
|
8028
|
+
* @readonly
|
|
8029
|
+
*/
|
|
8030
|
+
get: function () {
|
|
8031
|
+
return this._sideState;
|
|
8032
|
+
},
|
|
8033
|
+
enumerable: false,
|
|
8034
|
+
configurable: true
|
|
8035
|
+
});
|
|
8036
|
+
Object.defineProperty(__proto, "sideOptions", {
|
|
8037
|
+
// Options Getter
|
|
8038
|
+
/**
|
|
8039
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
8040
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8041
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8042
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8043
|
+
* @type {FlickingOptions}
|
|
8044
|
+
* @default undefined
|
|
8045
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8046
|
+
*/
|
|
8047
|
+
get: function () {
|
|
8048
|
+
return this._sideOptions;
|
|
8049
|
+
},
|
|
8050
|
+
enumerable: false,
|
|
8051
|
+
configurable: true
|
|
8052
|
+
});
|
|
8053
|
+
/**
|
|
8054
|
+
* Initialize Flicking and move to the default index
|
|
8055
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8056
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8057
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8058
|
+
* @fires Flicking#ready
|
|
8059
|
+
* @return {Promise<void>}
|
|
8060
|
+
*/
|
|
8061
|
+
__proto.init = function () {
|
|
8062
|
+
var _this = this;
|
|
8063
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8064
|
+
return _this._addComponentEvents();
|
|
8065
|
+
});
|
|
8066
|
+
};
|
|
8067
|
+
/**
|
|
8068
|
+
* Destroy Flicking and remove all event handlers
|
|
8069
|
+
* @ko Flicking과 하위 컴포넌트들을 초기 상태로 되돌리고, 부착된 모든 이벤트 핸들러를 제거합니다
|
|
8070
|
+
* @return {void}
|
|
8071
|
+
*/
|
|
8072
|
+
__proto.destroy = function () {
|
|
8073
|
+
// TODO 모든 child flicking destroy
|
|
8074
|
+
_super.prototype.destroy.call(this);
|
|
8075
|
+
};
|
|
8076
|
+
__proto._addComponentEvents = function () {
|
|
8077
|
+
var _this = this;
|
|
8078
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8079
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8080
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8081
|
+
this._sideFlicking.forEach(function (flicking) {
|
|
8082
|
+
flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
|
|
8083
|
+
flicking.on(EVENTS.MOVE, _this._onSideMove);
|
|
8084
|
+
flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
|
|
8085
|
+
flicking.on(EVENTS.CHANGED, _this._onSideChanged);
|
|
8086
|
+
});
|
|
8087
|
+
};
|
|
8088
|
+
__proto._createSideState = function () {
|
|
8089
|
+
var _this = this;
|
|
8090
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 side flicking으로 해보자.
|
|
8091
|
+
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
|
|
8092
|
+
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
|
|
8093
|
+
var viewportEl = this.element;
|
|
8094
|
+
var cameraEl = this.camera.element;
|
|
8095
|
+
var panels = toArray(cameraEl.children);
|
|
8096
|
+
var sideState = [];
|
|
8097
|
+
var sidePanels = "";
|
|
8098
|
+
// check data attribute exists
|
|
8099
|
+
var groupKeys = [];
|
|
8100
|
+
var groupPanels = {};
|
|
8101
|
+
var sideCamera = document.createElement("div");
|
|
8102
|
+
sideCamera.classList.add(CLASS.CAMERA);
|
|
8103
|
+
var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
|
|
8104
|
+
if (!isCrossStructure) {
|
|
8105
|
+
viewportEl.setAttribute("data-cross-structure", "true");
|
|
8106
|
+
panels.forEach(function (panel) {
|
|
8107
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8108
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8109
|
+
groupKeys.push(groupKey);
|
|
8110
|
+
groupPanels[groupKey] = [panel];
|
|
8111
|
+
} else if (groupKey) {
|
|
8112
|
+
groupPanels[groupKey].push(panel);
|
|
8113
|
+
}
|
|
8114
|
+
});
|
|
8115
|
+
if (groupKeys.length) {
|
|
8116
|
+
sideState = groupKeys.reduce(function (state, key) {
|
|
8117
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8118
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8119
|
+
sidePanels += panel.outerHTML;
|
|
8120
|
+
el.innerHTML += panel.outerHTML;
|
|
8121
|
+
return el;
|
|
8122
|
+
}, document.createElement("div"));
|
|
8123
|
+
return __spread(state, [{
|
|
8124
|
+
key: key,
|
|
8125
|
+
start: start,
|
|
8126
|
+
end: start + groupPanels[key].length - 1,
|
|
8127
|
+
element: element
|
|
8128
|
+
}]);
|
|
8129
|
+
}, []);
|
|
8130
|
+
this.remove(0, this.panelCount - groupKeys.length);
|
|
8131
|
+
sideState.forEach(function (_, i) {
|
|
8132
|
+
var panel = _this.camera.children[i];
|
|
8133
|
+
Array.from(panel.attributes).forEach(function (attribute) {
|
|
8134
|
+
return panel.removeAttribute(attribute.name);
|
|
8135
|
+
});
|
|
8136
|
+
});
|
|
8137
|
+
} else {
|
|
8138
|
+
sideState = panels.reduce(function (state, panel, i) {
|
|
8139
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8140
|
+
sidePanels += panel.innerHTML;
|
|
8141
|
+
return __spread(state, [{
|
|
8142
|
+
key: i.toString(),
|
|
8143
|
+
start: start,
|
|
8144
|
+
end: start + panel.children.length - 1,
|
|
8145
|
+
element: panel
|
|
8146
|
+
}]);
|
|
8147
|
+
}, []);
|
|
8148
|
+
}
|
|
8149
|
+
sideCamera.innerHTML = sidePanels;
|
|
8150
|
+
sideState.forEach(function (_, i) {
|
|
8151
|
+
var panel = _this.camera.children[i];
|
|
8152
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8153
|
+
if (!panel.classList.contains(className)) {
|
|
8154
|
+
panel.classList.add(className);
|
|
8155
|
+
}
|
|
8156
|
+
});
|
|
8157
|
+
panel.innerHTML = sideCamera.outerHTML;
|
|
8158
|
+
});
|
|
8159
|
+
} else {
|
|
8160
|
+
toArray(panels[0].children[0].children).forEach(function (panel) {
|
|
8161
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8162
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8163
|
+
groupKeys.push(groupKey);
|
|
8164
|
+
groupPanels[groupKey] = [panel];
|
|
8165
|
+
} else if (groupKey) {
|
|
8166
|
+
groupPanels[groupKey].push(panel);
|
|
8167
|
+
}
|
|
8168
|
+
});
|
|
8169
|
+
sideState = groupKeys.reduce(function (state, key) {
|
|
8170
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8171
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8172
|
+
el.innerHTML += panel.outerHTML;
|
|
8173
|
+
return el;
|
|
8174
|
+
}, document.createElement("div"));
|
|
8175
|
+
return __spread(state, [{
|
|
8176
|
+
key: key,
|
|
8177
|
+
start: start,
|
|
8178
|
+
end: start + groupPanels[key].length - 1,
|
|
8179
|
+
element: element
|
|
8180
|
+
}]);
|
|
8181
|
+
}, []);
|
|
8182
|
+
}
|
|
8183
|
+
return sideState;
|
|
8184
|
+
};
|
|
8185
|
+
__proto._createSideFlicking = function () {
|
|
8186
|
+
var _this = this;
|
|
8187
|
+
return this.sideState.map(function (state, i) {
|
|
8188
|
+
return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
|
|
8189
|
+
horizontal: false,
|
|
8190
|
+
panelsPerView: 1,
|
|
8191
|
+
defaultIndex: state.start
|
|
8192
|
+
}));
|
|
8193
|
+
});
|
|
8194
|
+
};
|
|
8195
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8196
|
+
var _this = this;
|
|
8197
|
+
this.stopAnimation();
|
|
8198
|
+
this._sideFlicking.forEach(function (child, i) {
|
|
8199
|
+
var _a = _this._sideState[i],
|
|
8200
|
+
start = _a.start,
|
|
8201
|
+
end = _a.end;
|
|
8202
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8203
|
+
child.stopAnimation();
|
|
8204
|
+
void child.moveTo(index, 0);
|
|
8205
|
+
void _this.moveTo(i, 0);
|
|
8206
|
+
}
|
|
8207
|
+
});
|
|
8208
|
+
};
|
|
8209
|
+
return CrossFlicking;
|
|
8210
|
+
}(Flicking);
|
|
8211
|
+
|
|
7874
8212
|
/**
|
|
7875
8213
|
* Decorator that makes the method of flicking available in the framework.
|
|
7876
8214
|
* @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
|
|
@@ -8088,6 +8426,7 @@ var parseAlign = function (alignVal) {
|
|
|
8088
8426
|
var modules = {
|
|
8089
8427
|
__proto__: null,
|
|
8090
8428
|
'default': Flicking,
|
|
8429
|
+
CrossFlicking: CrossFlicking,
|
|
8091
8430
|
VanillaElementProvider: VanillaElementProvider,
|
|
8092
8431
|
VirtualElementProvider: VirtualElementProvider,
|
|
8093
8432
|
Panel: Panel,
|
|
@@ -8125,6 +8464,7 @@ var modules = {
|
|
|
8125
8464
|
CLASS: CLASS,
|
|
8126
8465
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
8127
8466
|
ORDER: ORDER,
|
|
8467
|
+
MOVE_DIRECTION: MOVE_DIRECTION,
|
|
8128
8468
|
withFlickingMethods: withFlickingMethods,
|
|
8129
8469
|
sync: sync,
|
|
8130
8470
|
getRenderingPanels: getRenderingPanels,
|
|
@@ -8157,7 +8497,9 @@ var modules = {
|
|
|
8157
8497
|
circulateIndex: circulateIndex,
|
|
8158
8498
|
range: range,
|
|
8159
8499
|
getElementSize: getElementSize,
|
|
8160
|
-
setPrototypeOf: setPrototypeOf
|
|
8500
|
+
setPrototypeOf: setPrototypeOf,
|
|
8501
|
+
camelize: camelize,
|
|
8502
|
+
getDataAttributes: getDataAttributes
|
|
8161
8503
|
};
|
|
8162
8504
|
|
|
8163
8505
|
/*
|
|
@@ -8179,6 +8521,7 @@ exports.CLASS = CLASS;
|
|
|
8179
8521
|
exports.Camera = Camera;
|
|
8180
8522
|
exports.CircularCameraMode = CircularCameraMode;
|
|
8181
8523
|
exports.Control = Control;
|
|
8524
|
+
exports.CrossFlicking = CrossFlicking;
|
|
8182
8525
|
exports.DIRECTION = DIRECTION;
|
|
8183
8526
|
exports.DisabledState = DisabledState;
|
|
8184
8527
|
exports.DraggingState = DraggingState;
|
|
@@ -8190,6 +8533,7 @@ exports.FreeControl = FreeControl;
|
|
|
8190
8533
|
exports.HoldingState = HoldingState;
|
|
8191
8534
|
exports.IdleState = IdleState;
|
|
8192
8535
|
exports.LinearCameraMode = LinearCameraMode;
|
|
8536
|
+
exports.MOVE_DIRECTION = MOVE_DIRECTION;
|
|
8193
8537
|
exports.MOVE_TYPE = MOVE_TYPE;
|
|
8194
8538
|
exports.NormalRenderingStrategy = NormalRenderingStrategy;
|
|
8195
8539
|
exports.ORDER = ORDER;
|
|
@@ -8206,6 +8550,7 @@ exports.VirtualElementProvider = VirtualElementProvider;
|
|
|
8206
8550
|
exports.VirtualManager = VirtualManager;
|
|
8207
8551
|
exports.VirtualPanel = VirtualPanel;
|
|
8208
8552
|
exports.VirtualRenderingStrategy = VirtualRenderingStrategy;
|
|
8553
|
+
exports.camelize = camelize;
|
|
8209
8554
|
exports.checkExistence = checkExistence;
|
|
8210
8555
|
exports.circulateIndex = circulateIndex;
|
|
8211
8556
|
exports.circulatePosition = circulatePosition;
|
|
@@ -8214,6 +8559,7 @@ exports["default"] = Flicking;
|
|
|
8214
8559
|
exports.find = find;
|
|
8215
8560
|
exports.findIndex = findIndex;
|
|
8216
8561
|
exports.findRight = findRight;
|
|
8562
|
+
exports.getDataAttributes = getDataAttributes;
|
|
8217
8563
|
exports.getDefaultCameraTransform = getDefaultCameraTransform;
|
|
8218
8564
|
exports.getDirection = getDirection;
|
|
8219
8565
|
exports.getElement = getElement;
|