@egjs/flicking 4.12.0-beta.1 → 4.12.0-beta.11
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 +66 -14
- package/declaration/camera/Camera.d.ts +1 -0
- package/declaration/const/external.d.ts +2 -0
- package/declaration/index.d.ts +2 -1
- package/declaration/utils.d.ts +2 -0
- package/dist/flicking.cjs.js +327 -122
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.css +5 -5
- package/dist/flicking.esm.js +321 -122
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +324 -122
- 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 +1091 -882
- 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 +4 -3
- package/sass/flicking.sass +13 -0
- package/src/CrossFlicking.ts +336 -143
- package/src/camera/Camera.ts +24 -4
- package/src/const/external.ts +2 -0
- package/src/control/states/HoldingState.ts +4 -0
- package/src/core/panel/Panel.ts +4 -0
- package/src/index.ts +2 -1
- 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.11
|
|
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')) :
|
|
@@ -387,6 +387,8 @@ version: 4.12.0-beta.1
|
|
|
387
387
|
STRICT: "strict"
|
|
388
388
|
};
|
|
389
389
|
var CLASS = {
|
|
390
|
+
VIEWPORT: "flicking-viewport",
|
|
391
|
+
CAMERA: "flicking-camera",
|
|
390
392
|
VERTICAL: "vertical",
|
|
391
393
|
HIDDEN: "flicking-hidden",
|
|
392
394
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
@@ -751,6 +753,26 @@ version: 4.12.0-beta.1
|
|
|
751
753
|
obj.__proto__ = proto;
|
|
752
754
|
return obj;
|
|
753
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
|
+
};
|
|
754
776
|
|
|
755
777
|
var Utils = {
|
|
756
778
|
__proto__: null,
|
|
@@ -782,7 +804,9 @@ version: 4.12.0-beta.1
|
|
|
782
804
|
circulateIndex: circulateIndex,
|
|
783
805
|
range: range,
|
|
784
806
|
getElementSize: getElementSize,
|
|
785
|
-
setPrototypeOf: setPrototypeOf
|
|
807
|
+
setPrototypeOf: setPrototypeOf,
|
|
808
|
+
camelize: camelize,
|
|
809
|
+
getDataAttributes: getDataAttributes
|
|
786
810
|
};
|
|
787
811
|
|
|
788
812
|
/*
|
|
@@ -1616,6 +1640,9 @@ version: 4.12.0-beta.1
|
|
|
1616
1640
|
axesEvent = ctx.axesEvent,
|
|
1617
1641
|
transitTo = ctx.transitTo;
|
|
1618
1642
|
var inputEvent = axesEvent.inputEvent;
|
|
1643
|
+
if (!inputEvent) {
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1619
1646
|
var offset = flicking.horizontal ? inputEvent.offsetX : inputEvent.offsetY;
|
|
1620
1647
|
var moveStartEvent = new Component.ComponentEvent(EVENTS.MOVE_START, {
|
|
1621
1648
|
isTrusted: axesEvent.isTrusted,
|
|
@@ -3791,6 +3818,7 @@ version: 4.12.0-beta.1
|
|
|
3791
3818
|
var _this = this;
|
|
3792
3819
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
3793
3820
|
align = _b === void 0 ? ALIGN.CENTER : _b;
|
|
3821
|
+
this._lookedOffset = 0;
|
|
3794
3822
|
this._checkTranslateSupport = function () {
|
|
3795
3823
|
var e_1, _a;
|
|
3796
3824
|
var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
|
|
@@ -4150,6 +4178,8 @@ version: 4.12.0-beta.1
|
|
|
4150
4178
|
*/
|
|
4151
4179
|
__proto.lookAt = function (pos) {
|
|
4152
4180
|
var _this = this;
|
|
4181
|
+
var prevOffset = this._offset;
|
|
4182
|
+
var isChangedOffset = this._lookedOffset !== prevOffset;
|
|
4153
4183
|
var flicking = getFlickingAttached(this._flicking);
|
|
4154
4184
|
var prevPos = this._position;
|
|
4155
4185
|
this._position = pos;
|
|
@@ -4160,7 +4190,12 @@ version: 4.12.0-beta.1
|
|
|
4160
4190
|
if (toggled) {
|
|
4161
4191
|
void flicking.renderer.render().then(function () {
|
|
4162
4192
|
_this.updateOffset();
|
|
4193
|
+
_this._lookedOffset = _this._offset;
|
|
4163
4194
|
});
|
|
4195
|
+
} else if (isChangedOffset) {
|
|
4196
|
+
// sync offset for renderOnlyVisible on resize
|
|
4197
|
+
this.updateOffset();
|
|
4198
|
+
this._lookedOffset = this._offset;
|
|
4164
4199
|
} else {
|
|
4165
4200
|
this.applyTransform();
|
|
4166
4201
|
}
|
|
@@ -4335,8 +4370,8 @@ version: 4.12.0-beta.1
|
|
|
4335
4370
|
return this;
|
|
4336
4371
|
};
|
|
4337
4372
|
/**
|
|
4338
|
-
* Update Viewport's height to
|
|
4339
|
-
* @ko 현재
|
|
4373
|
+
* Update Viewport's height to visible panel's max height
|
|
4374
|
+
* @ko 현재 활성화된 패널과 보이는 패널의 최대 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
|
|
4340
4375
|
* @throws {FlickingError}
|
|
4341
4376
|
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4342
4377
|
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
@@ -4346,9 +4381,17 @@ version: 4.12.0-beta.1
|
|
|
4346
4381
|
__proto.updateAdaptiveHeight = function () {
|
|
4347
4382
|
var flicking = getFlickingAttached(this._flicking);
|
|
4348
4383
|
var activePanel = flicking.control.activePanel;
|
|
4349
|
-
|
|
4384
|
+
var visiblePanels = flicking.visiblePanels;
|
|
4385
|
+
var selectedPanels = __spread(visiblePanels);
|
|
4386
|
+
if (activePanel) {
|
|
4387
|
+
selectedPanels.push(activePanel);
|
|
4388
|
+
}
|
|
4389
|
+
if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
|
|
4390
|
+
var maxHeight = Math.max.apply(Math, __spread(selectedPanels.map(function (panel) {
|
|
4391
|
+
return panel.height;
|
|
4392
|
+
})));
|
|
4350
4393
|
flicking.viewport.setSize({
|
|
4351
|
-
height:
|
|
4394
|
+
height: maxHeight
|
|
4352
4395
|
});
|
|
4353
4396
|
};
|
|
4354
4397
|
/**
|
|
@@ -4419,6 +4462,7 @@ version: 4.12.0-beta.1
|
|
|
4419
4462
|
};
|
|
4420
4463
|
__proto._resetInternalValues = function () {
|
|
4421
4464
|
this._position = 0;
|
|
4465
|
+
this._lookedOffset = 0;
|
|
4422
4466
|
this._alignPos = 0;
|
|
4423
4467
|
this._offset = 0;
|
|
4424
4468
|
this._circularOffset = 0;
|
|
@@ -5492,6 +5536,9 @@ version: 4.12.0-beta.1
|
|
|
5492
5536
|
var flicking = this._flicking;
|
|
5493
5537
|
var horizontal = flicking.horizontal,
|
|
5494
5538
|
useFractionalSize = flicking.useFractionalSize;
|
|
5539
|
+
if (!el) {
|
|
5540
|
+
return this;
|
|
5541
|
+
}
|
|
5495
5542
|
if (cached) {
|
|
5496
5543
|
this._size = cached.size;
|
|
5497
5544
|
this._margin = __assign({}, cached.margin);
|
|
@@ -7967,186 +8014,341 @@ version: 4.12.0-beta.1
|
|
|
7967
8014
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7968
8015
|
* ```
|
|
7969
8016
|
*/
|
|
7970
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
8017
|
+
Flicking.VERSION = "4.12.0-beta.11";
|
|
7971
8018
|
return Flicking;
|
|
7972
8019
|
}(Component);
|
|
7973
8020
|
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
8021
|
+
var SIDE_EVENTS = {
|
|
8022
|
+
HOLD_START: "sideHoldStart",
|
|
8023
|
+
HOLD_END: "sideHoldEnd",
|
|
8024
|
+
MOVE_START: "sideMoveStart",
|
|
8025
|
+
MOVE: "sideMove",
|
|
8026
|
+
MOVE_END: "sideMoveEnd",
|
|
8027
|
+
WILL_CHANGE: "sideWillChange",
|
|
8028
|
+
CHANGED: "sideChanged",
|
|
8029
|
+
WILL_RESTORE: "sideWillRestore",
|
|
8030
|
+
RESTORED: "sideRestored"
|
|
8031
|
+
};
|
|
7984
8032
|
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7985
8033
|
__extends(CrossFlicking, _super);
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
8034
|
+
function CrossFlicking(root, options) {
|
|
8035
|
+
var _this = _super.call(this, root, options) || this;
|
|
8036
|
+
_this._syncToCategory = function (index, outerIndex) {
|
|
8037
|
+
if (_this._disableIndexSync) {
|
|
8038
|
+
return;
|
|
8039
|
+
}
|
|
8040
|
+
_this.stopAnimation();
|
|
8041
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
8042
|
+
var _a = _this._sideState[i],
|
|
8043
|
+
start = _a.start,
|
|
8044
|
+
end = _a.end;
|
|
8045
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8046
|
+
child.stopAnimation();
|
|
8047
|
+
void child.moveTo(index, 0);
|
|
8048
|
+
void _this.moveTo(i, 0);
|
|
8049
|
+
}
|
|
8050
|
+
});
|
|
8051
|
+
};
|
|
8052
|
+
_this._setDraggable = function (direction, draggable) {
|
|
8053
|
+
if (!_this._disableSlideOnHold) {
|
|
8054
|
+
return;
|
|
8055
|
+
}
|
|
8056
|
+
var dragThreshold = _this._originalDragThreshold;
|
|
8057
|
+
var threshold = draggable ? dragThreshold && dragThreshold >= 10 ? dragThreshold : 10 : Infinity;
|
|
8058
|
+
if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
|
|
8059
|
+
_this.dragThreshold = threshold;
|
|
8060
|
+
} else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
|
|
8061
|
+
_this._sideFlicking.forEach(function (child) {
|
|
8062
|
+
child.dragThreshold = threshold;
|
|
8063
|
+
});
|
|
8064
|
+
}
|
|
8065
|
+
};
|
|
8066
|
+
_this._setPreviousSideIndex = function () {
|
|
8067
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
8068
|
+
var _a = _this._sideState[i],
|
|
8069
|
+
start = _a.start,
|
|
8070
|
+
end = _a.end;
|
|
8071
|
+
if (_this._preserveIndex) {
|
|
8072
|
+
if (_this._nextIndex !== i) {
|
|
8073
|
+
if (child.index < start) {
|
|
8074
|
+
child.stopAnimation();
|
|
8075
|
+
void child.moveTo(start, 0);
|
|
8076
|
+
} else if (child.index > end) {
|
|
8077
|
+
child.stopAnimation();
|
|
8078
|
+
void child.moveTo(end, 0);
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
} else {
|
|
8082
|
+
if (_this._nextIndex !== i) {
|
|
8083
|
+
void child.moveTo(start, 0);
|
|
8084
|
+
}
|
|
8085
|
+
}
|
|
8086
|
+
});
|
|
8087
|
+
};
|
|
7995
8088
|
_this._onHorizontalHoldStart = function () {
|
|
7996
|
-
_this.
|
|
8089
|
+
_this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
|
|
7997
8090
|
_this._moveDirection = null;
|
|
7998
8091
|
};
|
|
7999
8092
|
_this._onHorizontalMove = function (e) {
|
|
8000
8093
|
if (e.isTrusted && !_this._moveDirection) {
|
|
8001
|
-
_this.
|
|
8002
|
-
child.dragThreshold = Infinity;
|
|
8003
|
-
});
|
|
8094
|
+
_this._setDraggable(MOVE_DIRECTION.VERTICAL, false);
|
|
8004
8095
|
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
8005
8096
|
}
|
|
8006
8097
|
};
|
|
8007
8098
|
_this._onHorizontalMoveEnd = function (e) {
|
|
8008
8099
|
var visiblePanels = _this.visiblePanels;
|
|
8009
|
-
_this._verticalFlicking.forEach(function (child) {
|
|
8010
|
-
child.dragThreshold = 10;
|
|
8011
|
-
});
|
|
8012
|
-
_this._moveDirection = null;
|
|
8013
8100
|
if (visiblePanels.length > 1) {
|
|
8014
8101
|
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
8015
8102
|
} else {
|
|
8016
8103
|
_this._nextIndex = visiblePanels[0].index;
|
|
8017
8104
|
}
|
|
8018
|
-
_this.
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
if (child.index < start) {
|
|
8024
|
-
child.stopAnimation();
|
|
8025
|
-
void child.moveTo(start, 0);
|
|
8026
|
-
} else if (child.index > end) {
|
|
8027
|
-
child.stopAnimation();
|
|
8028
|
-
void child.moveTo(end, 0);
|
|
8029
|
-
}
|
|
8030
|
-
}
|
|
8105
|
+
_this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
|
|
8106
|
+
_this._moveDirection = null;
|
|
8107
|
+
// _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 requestAnimationFrame 처리
|
|
8108
|
+
requestAnimationFrame(function () {
|
|
8109
|
+
return _this._setPreviousSideIndex();
|
|
8031
8110
|
});
|
|
8032
8111
|
if (e.isTrusted) {
|
|
8033
|
-
_this._syncToCategory(_this.
|
|
8112
|
+
_this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
8034
8113
|
}
|
|
8035
8114
|
};
|
|
8036
|
-
_this.
|
|
8037
|
-
_this.
|
|
8038
|
-
child.dragThreshold = 10;
|
|
8039
|
-
});
|
|
8115
|
+
_this._onSideHoldStart = function () {
|
|
8116
|
+
_this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
|
|
8040
8117
|
_this._moveDirection = null;
|
|
8041
8118
|
};
|
|
8042
|
-
_this.
|
|
8119
|
+
_this._onSideMove = function (e) {
|
|
8043
8120
|
if (e.isTrusted && !_this._moveDirection) {
|
|
8044
|
-
_this.
|
|
8121
|
+
_this._setDraggable(MOVE_DIRECTION.HORIZONTAL, false);
|
|
8045
8122
|
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
8046
8123
|
}
|
|
8047
8124
|
};
|
|
8048
|
-
_this.
|
|
8049
|
-
_this.
|
|
8125
|
+
_this._onSideMoveEnd = function () {
|
|
8126
|
+
_this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
|
|
8050
8127
|
_this._moveDirection = null;
|
|
8051
8128
|
};
|
|
8052
|
-
_this.
|
|
8053
|
-
// this.visiblePanels.length
|
|
8054
|
-
//
|
|
8055
|
-
if (_this.visiblePanels.length < 2 && _this.
|
|
8129
|
+
_this._onSideChanged = function (e) {
|
|
8130
|
+
// If this.visiblePanels.length >= 2, it means that horizontal flicking is being dragged.
|
|
8131
|
+
// In this case, syncToCategory in _onHorizontalMoveEnd will fire after moving finishes, so we don't fire it here.
|
|
8132
|
+
if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
|
|
8056
8133
|
_this._syncToCategory(e.index, _this.index);
|
|
8057
8134
|
}
|
|
8058
8135
|
};
|
|
8136
|
+
var _a = options.sideOptions,
|
|
8137
|
+
sideOptions = _a === void 0 ? {} : _a,
|
|
8138
|
+
_b = options.preserveIndex,
|
|
8139
|
+
preserveIndex = _b === void 0 ? true : _b,
|
|
8140
|
+
_c = options.disableSlideOnHold,
|
|
8141
|
+
disableSlideOnHold = _c === void 0 ? true : _c,
|
|
8142
|
+
_d = options.disableIndexSync,
|
|
8143
|
+
disableIndexSync = _d === void 0 ? false : _d;
|
|
8059
8144
|
// Internal states
|
|
8060
|
-
_this._verticalState = [];
|
|
8061
8145
|
_this._moveDirection = null;
|
|
8062
8146
|
_this._nextIndex = 0;
|
|
8147
|
+
_this._originalDragThreshold = _this.dragThreshold;
|
|
8063
8148
|
// Bind options
|
|
8064
|
-
_this.
|
|
8149
|
+
_this._sideOptions = sideOptions;
|
|
8150
|
+
_this._preserveIndex = preserveIndex;
|
|
8151
|
+
_this._disableSlideOnHold = disableSlideOnHold;
|
|
8152
|
+
_this._disableIndexSync = disableIndexSync;
|
|
8065
8153
|
return _this;
|
|
8066
|
-
// Create core components
|
|
8067
|
-
// this._viewport = new Viewport(this, getElement(root));
|
|
8068
8154
|
}
|
|
8069
8155
|
var __proto = CrossFlicking.prototype;
|
|
8070
|
-
Object.defineProperty(__proto, "
|
|
8156
|
+
Object.defineProperty(__proto, "sideFlicking", {
|
|
8071
8157
|
// Components
|
|
8072
|
-
/**
|
|
8073
|
-
* Change active panel index on mouse/touch hold while animating.
|
|
8074
|
-
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8075
|
-
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8076
|
-
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8077
|
-
* @type {FlickingOptions}
|
|
8078
|
-
* @default undefined
|
|
8079
|
-
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8080
|
-
*/
|
|
8081
8158
|
get: function () {
|
|
8082
|
-
return this.
|
|
8159
|
+
return this._sideFlicking;
|
|
8160
|
+
},
|
|
8161
|
+
enumerable: false,
|
|
8162
|
+
configurable: true
|
|
8163
|
+
});
|
|
8164
|
+
Object.defineProperty(__proto, "sideState", {
|
|
8165
|
+
get: function () {
|
|
8166
|
+
return this._sideState;
|
|
8167
|
+
},
|
|
8168
|
+
enumerable: false,
|
|
8169
|
+
configurable: true
|
|
8170
|
+
});
|
|
8171
|
+
Object.defineProperty(__proto, "sideOptions", {
|
|
8172
|
+
// Options Getter
|
|
8173
|
+
get: function () {
|
|
8174
|
+
return this._sideOptions;
|
|
8175
|
+
},
|
|
8176
|
+
// Options Setter
|
|
8177
|
+
set: function (val) {
|
|
8178
|
+
this._sideOptions = val;
|
|
8179
|
+
},
|
|
8180
|
+
enumerable: false,
|
|
8181
|
+
configurable: true
|
|
8182
|
+
});
|
|
8183
|
+
Object.defineProperty(__proto, "preserveIndex", {
|
|
8184
|
+
get: function () {
|
|
8185
|
+
return this._preserveIndex;
|
|
8186
|
+
},
|
|
8187
|
+
set: function (val) {
|
|
8188
|
+
this._preserveIndex = val;
|
|
8189
|
+
},
|
|
8190
|
+
enumerable: false,
|
|
8191
|
+
configurable: true
|
|
8192
|
+
});
|
|
8193
|
+
Object.defineProperty(__proto, "disableSlideOnHold", {
|
|
8194
|
+
get: function () {
|
|
8195
|
+
return this._disableSlideOnHold;
|
|
8196
|
+
},
|
|
8197
|
+
set: function (val) {
|
|
8198
|
+
this._disableSlideOnHold = val;
|
|
8199
|
+
},
|
|
8200
|
+
enumerable: false,
|
|
8201
|
+
configurable: true
|
|
8202
|
+
});
|
|
8203
|
+
Object.defineProperty(__proto, "disableIndexSync", {
|
|
8204
|
+
get: function () {
|
|
8205
|
+
return this._disableIndexSync;
|
|
8206
|
+
},
|
|
8207
|
+
set: function (val) {
|
|
8208
|
+
this._disableIndexSync = val;
|
|
8083
8209
|
},
|
|
8084
8210
|
enumerable: false,
|
|
8085
8211
|
configurable: true
|
|
8086
8212
|
});
|
|
8087
|
-
/**
|
|
8088
|
-
* Initialize Flicking and move to the default index
|
|
8089
|
-
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8090
|
-
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8091
|
-
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8092
|
-
* @fires Flicking#ready
|
|
8093
|
-
* @return {Promise<void>}
|
|
8094
|
-
*/
|
|
8095
8213
|
__proto.init = function () {
|
|
8096
8214
|
var _this = this;
|
|
8097
8215
|
return _super.prototype.init.call(this).then(function () {
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8216
|
+
_this._sideState = _this._createSideState();
|
|
8217
|
+
_this._sideFlicking = _this._createSideFlicking();
|
|
8218
|
+
_this._addComponentEvents();
|
|
8219
|
+
});
|
|
8220
|
+
};
|
|
8221
|
+
__proto.destroy = function () {
|
|
8222
|
+
this._sideFlicking.forEach(function (flicking) {
|
|
8223
|
+
flicking.destroy();
|
|
8224
|
+
});
|
|
8225
|
+
_super.prototype.destroy.call(this);
|
|
8226
|
+
};
|
|
8227
|
+
__proto._addComponentEvents = function () {
|
|
8228
|
+
var _this = this;
|
|
8229
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8230
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8231
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8232
|
+
this._sideFlicking.forEach(function (flicking, mainIndex) {
|
|
8233
|
+
flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
|
|
8234
|
+
flicking.on(EVENTS.MOVE, _this._onSideMove);
|
|
8235
|
+
flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
|
|
8236
|
+
flicking.on(EVENTS.CHANGED, _this._onSideChanged);
|
|
8237
|
+
Object.keys(SIDE_EVENTS).forEach(function (name) {
|
|
8238
|
+
flicking.on(EVENTS[name], function (event) {
|
|
8239
|
+
_this.trigger(new Component.ComponentEvent(SIDE_EVENTS[name], __assign({
|
|
8240
|
+
mainIndex: mainIndex
|
|
8241
|
+
}, event)));
|
|
8242
|
+
});
|
|
8112
8243
|
});
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8244
|
+
});
|
|
8245
|
+
};
|
|
8246
|
+
__proto._createSideState = function () {
|
|
8247
|
+
var viewportEl = this.element;
|
|
8248
|
+
var cameraEl = this.camera.element;
|
|
8249
|
+
var panels = toArray(cameraEl.children);
|
|
8250
|
+
var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
|
|
8251
|
+
var sideState = [];
|
|
8252
|
+
if (!isCrossStructure) {
|
|
8253
|
+
var groupPanels = this._getGroupFromAttribute(panels);
|
|
8254
|
+
var groupKeys = Object.keys(groupPanels);
|
|
8255
|
+
if (groupKeys.length) {
|
|
8256
|
+
sideState = this._getSideStateFromGroup(groupPanels);
|
|
8257
|
+
this.remove(0, this.panelCount - groupKeys.length);
|
|
8258
|
+
} else {
|
|
8259
|
+
sideState = this._getSideStateFromPanels(panels);
|
|
8260
|
+
}
|
|
8261
|
+
this._createCrossStructure(sideState);
|
|
8262
|
+
} else {
|
|
8263
|
+
sideState = this._getSideStateFromCrossStructure(panels);
|
|
8264
|
+
}
|
|
8265
|
+
void this.resize();
|
|
8266
|
+
return sideState;
|
|
8267
|
+
};
|
|
8268
|
+
__proto._createCrossStructure = function (sideState) {
|
|
8269
|
+
var _this = this;
|
|
8270
|
+
var sideCamera = document.createElement("div");
|
|
8271
|
+
var sidePanels = "";
|
|
8272
|
+
sideCamera.classList.add(CLASS.CAMERA);
|
|
8273
|
+
sideState.forEach(function (state, i) {
|
|
8274
|
+
var panel = _this.camera.children[i];
|
|
8275
|
+
sidePanels += state.element.innerHTML;
|
|
8276
|
+
Array.from(panel.attributes).forEach(function (attribute) {
|
|
8277
|
+
return panel.removeAttribute(attribute.name);
|
|
8119
8278
|
});
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
_this.
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8279
|
+
});
|
|
8280
|
+
sideCamera.innerHTML = sidePanels;
|
|
8281
|
+
sideState.forEach(function (_, i) {
|
|
8282
|
+
var panel = _this.camera.children[i];
|
|
8283
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8284
|
+
if (!panel.classList.contains(className)) {
|
|
8285
|
+
panel.classList.add(className);
|
|
8286
|
+
}
|
|
8128
8287
|
});
|
|
8288
|
+
panel.innerHTML = sideCamera.outerHTML;
|
|
8129
8289
|
});
|
|
8290
|
+
this.element.setAttribute("data-cross-structure", "true");
|
|
8130
8291
|
};
|
|
8131
|
-
__proto.
|
|
8132
|
-
var
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
var
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
void _this.moveTo(i, 0);
|
|
8292
|
+
__proto._getGroupFromAttribute = function (panels) {
|
|
8293
|
+
var groupKeys = [];
|
|
8294
|
+
var groupPanels = {};
|
|
8295
|
+
panels.forEach(function (panel) {
|
|
8296
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8297
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8298
|
+
groupKeys.push(groupKey);
|
|
8299
|
+
groupPanels[groupKey] = [panel];
|
|
8300
|
+
} else if (groupKey) {
|
|
8301
|
+
groupPanels[groupKey].push(panel);
|
|
8142
8302
|
}
|
|
8143
8303
|
});
|
|
8304
|
+
return groupPanels;
|
|
8305
|
+
};
|
|
8306
|
+
__proto._getSideStateFromGroup = function (groupPanels) {
|
|
8307
|
+
return Object.keys(groupPanels).reduce(function (state, key) {
|
|
8308
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8309
|
+
var element = groupPanels[key].reduce(function (el, panel) {
|
|
8310
|
+
el.innerHTML += panel.outerHTML;
|
|
8311
|
+
return el;
|
|
8312
|
+
}, document.createElement("div"));
|
|
8313
|
+
return __spread(state, [{
|
|
8314
|
+
key: key,
|
|
8315
|
+
start: start,
|
|
8316
|
+
end: start + groupPanels[key].length - 1,
|
|
8317
|
+
element: element
|
|
8318
|
+
}]);
|
|
8319
|
+
}, []);
|
|
8320
|
+
};
|
|
8321
|
+
__proto._getSideStateFromPanels = function (panels) {
|
|
8322
|
+
return panels.reduce(function (state, panel, i) {
|
|
8323
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8324
|
+
return __spread(state, [{
|
|
8325
|
+
key: i.toString(),
|
|
8326
|
+
start: start,
|
|
8327
|
+
end: start + panel.children.length - 1,
|
|
8328
|
+
element: panel
|
|
8329
|
+
}]);
|
|
8330
|
+
}, []);
|
|
8331
|
+
};
|
|
8332
|
+
__proto._getSideStateFromCrossStructure = function (panels) {
|
|
8333
|
+
var groupPanels = this._getGroupFromAttribute(panels);
|
|
8334
|
+
return this._getSideStateFromGroup(groupPanels);
|
|
8335
|
+
};
|
|
8336
|
+
__proto._createSideFlicking = function () {
|
|
8337
|
+
var _this = this;
|
|
8338
|
+
return this.sideState.map(function (state, i) {
|
|
8339
|
+
return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
|
|
8340
|
+
horizontal: false,
|
|
8341
|
+
panelsPerView: 1,
|
|
8342
|
+
defaultIndex: state.start
|
|
8343
|
+
}));
|
|
8344
|
+
});
|
|
8144
8345
|
};
|
|
8145
8346
|
return CrossFlicking;
|
|
8146
8347
|
}(Flicking);
|
|
8147
8348
|
|
|
8148
8349
|
var CrossFlicking$1 = {
|
|
8149
8350
|
__proto__: null,
|
|
8351
|
+
SIDE_EVENTS: SIDE_EVENTS,
|
|
8150
8352
|
CrossFlicking: CrossFlicking
|
|
8151
8353
|
};
|
|
8152
8354
|
|