@egjs/flicking 4.12.0-beta.8 → 4.12.0-beta.9
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 +28 -4
- package/declaration/camera/Camera.d.ts +1 -0
- package/dist/flicking.cjs.js +172 -119
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +171 -120
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +171 -119
- 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 +171 -119
- 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 +1 -1
- package/sass/flicking.sass +13 -0
- package/src/CrossFlicking.ts +196 -112
- package/src/camera/Camera.ts +24 -4
package/dist/flicking.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ name: @egjs/flicking
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking
|
|
7
|
-
version: 4.12.0-beta.
|
|
7
|
+
version: 4.12.0-beta.9
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -3744,6 +3744,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
3744
3744
|
var _this = this;
|
|
3745
3745
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
3746
3746
|
align = _b === void 0 ? ALIGN.CENTER : _b;
|
|
3747
|
+
this._lookedOffset = 0;
|
|
3747
3748
|
this._checkTranslateSupport = function () {
|
|
3748
3749
|
var e_1, _a;
|
|
3749
3750
|
var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
|
|
@@ -4103,6 +4104,8 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4103
4104
|
*/
|
|
4104
4105
|
__proto.lookAt = function (pos) {
|
|
4105
4106
|
var _this = this;
|
|
4107
|
+
var prevOffset = this._offset;
|
|
4108
|
+
var isChangedOffset = this._lookedOffset !== prevOffset;
|
|
4106
4109
|
var flicking = getFlickingAttached(this._flicking);
|
|
4107
4110
|
var prevPos = this._position;
|
|
4108
4111
|
this._position = pos;
|
|
@@ -4113,7 +4116,12 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4113
4116
|
if (toggled) {
|
|
4114
4117
|
void flicking.renderer.render().then(function () {
|
|
4115
4118
|
_this.updateOffset();
|
|
4119
|
+
_this._lookedOffset = _this._offset;
|
|
4116
4120
|
});
|
|
4121
|
+
} else if (isChangedOffset) {
|
|
4122
|
+
// sync offset for renderOnlyVisible on resize
|
|
4123
|
+
this.updateOffset();
|
|
4124
|
+
this._lookedOffset = this._offset;
|
|
4117
4125
|
} else {
|
|
4118
4126
|
this.applyTransform();
|
|
4119
4127
|
}
|
|
@@ -4288,8 +4296,8 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4288
4296
|
return this;
|
|
4289
4297
|
};
|
|
4290
4298
|
/**
|
|
4291
|
-
* Update Viewport's height to
|
|
4292
|
-
* @ko 현재
|
|
4299
|
+
* Update Viewport's height to visible panel's max height
|
|
4300
|
+
* @ko 현재 활성화된 패널과 보이는 패널의 최대 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
|
|
4293
4301
|
* @throws {FlickingError}
|
|
4294
4302
|
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4295
4303
|
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
@@ -4299,9 +4307,17 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4299
4307
|
__proto.updateAdaptiveHeight = function () {
|
|
4300
4308
|
var flicking = getFlickingAttached(this._flicking);
|
|
4301
4309
|
var activePanel = flicking.control.activePanel;
|
|
4302
|
-
|
|
4310
|
+
var visiblePanels = flicking.visiblePanels;
|
|
4311
|
+
var selectedPanels = __spread(visiblePanels);
|
|
4312
|
+
if (activePanel) {
|
|
4313
|
+
selectedPanels.push(activePanel);
|
|
4314
|
+
}
|
|
4315
|
+
if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
|
|
4316
|
+
var maxHeight = Math.max.apply(Math, __spread(selectedPanels.map(function (panel) {
|
|
4317
|
+
return panel.height;
|
|
4318
|
+
})));
|
|
4303
4319
|
flicking.viewport.setSize({
|
|
4304
|
-
height:
|
|
4320
|
+
height: maxHeight
|
|
4305
4321
|
});
|
|
4306
4322
|
};
|
|
4307
4323
|
/**
|
|
@@ -4372,6 +4388,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4372
4388
|
};
|
|
4373
4389
|
__proto._resetInternalValues = function () {
|
|
4374
4390
|
this._position = 0;
|
|
4391
|
+
this._lookedOffset = 0;
|
|
4375
4392
|
this._alignPos = 0;
|
|
4376
4393
|
this._offset = 0;
|
|
4377
4394
|
this._circularOffset = 0;
|
|
@@ -7893,103 +7910,139 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7893
7910
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7894
7911
|
* ```
|
|
7895
7912
|
*/
|
|
7896
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7913
|
+
Flicking.VERSION = "4.12.0-beta.9";
|
|
7897
7914
|
return Flicking;
|
|
7898
7915
|
}(Component);
|
|
7899
7916
|
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7917
|
+
var SIDE_EVENTS = {
|
|
7918
|
+
HOLD_START: "sideHoldStart",
|
|
7919
|
+
HOLD_END: "sideHoldEnd",
|
|
7920
|
+
MOVE_START: "sideMoveStart",
|
|
7921
|
+
MOVE: "sideMove",
|
|
7922
|
+
MOVE_END: "sideMoveEnd",
|
|
7923
|
+
WILL_CHANGE: "sideWillChange",
|
|
7924
|
+
CHANGED: "sideChanged"
|
|
7925
|
+
};
|
|
7904
7926
|
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7905
7927
|
__extends(CrossFlicking, _super);
|
|
7906
7928
|
function CrossFlicking(root, options) {
|
|
7907
|
-
if (options === void 0) {
|
|
7908
|
-
options = {
|
|
7909
|
-
sideOptions: {},
|
|
7910
|
-
preserveIndex: false,
|
|
7911
|
-
disableSlideOnHold: false,
|
|
7912
|
-
disableIndexSync: false
|
|
7913
|
-
};
|
|
7914
|
-
}
|
|
7915
7929
|
var _this = _super.call(this, root, options) || this;
|
|
7930
|
+
_this._syncToCategory = function (index, outerIndex) {
|
|
7931
|
+
if (_this._disableIndexSync) {
|
|
7932
|
+
return;
|
|
7933
|
+
}
|
|
7934
|
+
_this.stopAnimation();
|
|
7935
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
7936
|
+
var _a = _this._sideState[i],
|
|
7937
|
+
start = _a.start,
|
|
7938
|
+
end = _a.end;
|
|
7939
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
7940
|
+
child.stopAnimation();
|
|
7941
|
+
void child.moveTo(index, 0);
|
|
7942
|
+
void _this.moveTo(i, 0);
|
|
7943
|
+
}
|
|
7944
|
+
});
|
|
7945
|
+
};
|
|
7946
|
+
_this._setDraggable = function (direction, draggable) {
|
|
7947
|
+
if (!_this._disableSlideOnHold) {
|
|
7948
|
+
return;
|
|
7949
|
+
}
|
|
7950
|
+
var threshold = draggable ? _this.dragThreshold && _this.dragThreshold >= 10 ? _this.dragThreshold : 10 : Infinity;
|
|
7951
|
+
if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
|
|
7952
|
+
_this.dragThreshold = threshold;
|
|
7953
|
+
} else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
|
|
7954
|
+
_this._sideFlicking.forEach(function (child) {
|
|
7955
|
+
child.dragThreshold = threshold;
|
|
7956
|
+
});
|
|
7957
|
+
}
|
|
7958
|
+
};
|
|
7959
|
+
_this._setPreviousSideIndex = function () {
|
|
7960
|
+
_this._sideFlicking.forEach(function (child, i) {
|
|
7961
|
+
var _a = _this._sideState[i],
|
|
7962
|
+
start = _a.start,
|
|
7963
|
+
end = _a.end;
|
|
7964
|
+
if (_this._preserveIndex) {
|
|
7965
|
+
if (_this._nextIndex !== i) {
|
|
7966
|
+
if (child.index < start) {
|
|
7967
|
+
child.stopAnimation();
|
|
7968
|
+
void child.moveTo(start, 0);
|
|
7969
|
+
} else if (child.index > end) {
|
|
7970
|
+
child.stopAnimation();
|
|
7971
|
+
void child.moveTo(end, 0);
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
} else {
|
|
7975
|
+
if (_this._nextIndex !== i) {
|
|
7976
|
+
void child.moveTo(start, 0);
|
|
7977
|
+
}
|
|
7978
|
+
}
|
|
7979
|
+
});
|
|
7980
|
+
};
|
|
7916
7981
|
_this._onHorizontalHoldStart = function () {
|
|
7917
|
-
_this.
|
|
7982
|
+
_this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
|
|
7918
7983
|
_this._moveDirection = null;
|
|
7919
7984
|
};
|
|
7920
7985
|
_this._onHorizontalMove = function (e) {
|
|
7921
7986
|
if (e.isTrusted && !_this._moveDirection) {
|
|
7922
|
-
_this.
|
|
7923
|
-
child.dragThreshold = Infinity;
|
|
7924
|
-
});
|
|
7987
|
+
_this._setDraggable(MOVE_DIRECTION.VERTICAL, false);
|
|
7925
7988
|
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
7926
7989
|
}
|
|
7927
7990
|
};
|
|
7928
7991
|
_this._onHorizontalMoveEnd = function (e) {
|
|
7929
7992
|
var visiblePanels = _this.visiblePanels;
|
|
7930
|
-
_this._sideFlicking.forEach(function (child) {
|
|
7931
|
-
child.dragThreshold = 10;
|
|
7932
|
-
});
|
|
7933
|
-
_this._moveDirection = null;
|
|
7934
7993
|
if (visiblePanels.length > 1) {
|
|
7935
7994
|
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
7936
7995
|
} else {
|
|
7937
7996
|
_this._nextIndex = visiblePanels[0].index;
|
|
7938
7997
|
}
|
|
7998
|
+
_this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
|
|
7999
|
+
_this._moveDirection = null;
|
|
7939
8000
|
// _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 requestAnimationFrame 처리
|
|
7940
8001
|
requestAnimationFrame(function () {
|
|
7941
|
-
_this.
|
|
7942
|
-
if (_this._nextIndex !== i) {
|
|
7943
|
-
var _a = _this._sideState[i],
|
|
7944
|
-
start = _a.start,
|
|
7945
|
-
end = _a.end;
|
|
7946
|
-
if (child.index < start) {
|
|
7947
|
-
child.stopAnimation();
|
|
7948
|
-
void child.moveTo(start, 0);
|
|
7949
|
-
} else if (child.index > end) {
|
|
7950
|
-
child.stopAnimation();
|
|
7951
|
-
void child.moveTo(end, 0);
|
|
7952
|
-
}
|
|
7953
|
-
}
|
|
7954
|
-
});
|
|
8002
|
+
return _this._setPreviousSideIndex();
|
|
7955
8003
|
});
|
|
7956
8004
|
if (e.isTrusted) {
|
|
7957
8005
|
_this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
7958
8006
|
}
|
|
7959
8007
|
};
|
|
7960
8008
|
_this._onSideHoldStart = function () {
|
|
7961
|
-
_this.
|
|
7962
|
-
child.dragThreshold = 10;
|
|
7963
|
-
});
|
|
8009
|
+
_this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
|
|
7964
8010
|
_this._moveDirection = null;
|
|
7965
8011
|
};
|
|
7966
8012
|
_this._onSideMove = function (e) {
|
|
7967
8013
|
if (e.isTrusted && !_this._moveDirection) {
|
|
7968
|
-
_this.
|
|
8014
|
+
_this._setDraggable(MOVE_DIRECTION.HORIZONTAL, false);
|
|
7969
8015
|
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
7970
8016
|
}
|
|
7971
8017
|
};
|
|
7972
8018
|
_this._onSideMoveEnd = function () {
|
|
7973
|
-
_this.
|
|
8019
|
+
_this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
|
|
7974
8020
|
_this._moveDirection = null;
|
|
7975
8021
|
};
|
|
7976
8022
|
_this._onSideChanged = function (e) {
|
|
7977
|
-
// this.visiblePanels.length
|
|
7978
|
-
//
|
|
8023
|
+
// If this.visiblePanels.length >= 2, it means that horizontal flicking is being dragged.
|
|
8024
|
+
// In this case, syncToCategory in _onHorizontalMoveEnd will fire after moving finishes, so we don't fire it here.
|
|
7979
8025
|
if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
|
|
7980
8026
|
_this._syncToCategory(e.index, _this.index);
|
|
7981
8027
|
}
|
|
7982
8028
|
};
|
|
8029
|
+
var _a = options.sideOptions,
|
|
8030
|
+
sideOptions = _a === void 0 ? {} : _a,
|
|
8031
|
+
_b = options.preserveIndex,
|
|
8032
|
+
preserveIndex = _b === void 0 ? true : _b,
|
|
8033
|
+
_c = options.disableSlideOnHold,
|
|
8034
|
+
disableSlideOnHold = _c === void 0 ? true : _c,
|
|
8035
|
+
_d = options.disableIndexSync,
|
|
8036
|
+
disableIndexSync = _d === void 0 ? false : _d;
|
|
7983
8037
|
// Internal states
|
|
7984
8038
|
_this._moveDirection = null;
|
|
7985
8039
|
_this._nextIndex = 0;
|
|
7986
8040
|
// Bind options
|
|
7987
|
-
_this._sideOptions =
|
|
7988
|
-
_this._preserveIndex =
|
|
7989
|
-
_this._disableSlideOnHold =
|
|
7990
|
-
_this._disableIndexSync =
|
|
8041
|
+
_this._sideOptions = sideOptions;
|
|
8042
|
+
_this._preserveIndex = preserveIndex;
|
|
8043
|
+
_this._disableSlideOnHold = disableSlideOnHold;
|
|
8044
|
+
_this._disableIndexSync = disableIndexSync;
|
|
7991
8045
|
return _this;
|
|
7992
|
-
// Create core components
|
|
7993
8046
|
}
|
|
7994
8047
|
var __proto = CrossFlicking.prototype;
|
|
7995
8048
|
Object.defineProperty(__proto, "sideFlicking", {
|
|
@@ -8058,7 +8111,9 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
|
8058
8111
|
});
|
|
8059
8112
|
};
|
|
8060
8113
|
__proto.destroy = function () {
|
|
8061
|
-
|
|
8114
|
+
this._sideFlicking.forEach(function (flicking) {
|
|
8115
|
+
flicking.destroy();
|
|
8116
|
+
});
|
|
8062
8117
|
_super.prototype.destroy.call(this);
|
|
8063
8118
|
};
|
|
8064
8119
|
__proto._addComponentEvents = function () {
|
|
@@ -8066,80 +8121,80 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
|
8066
8121
|
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8067
8122
|
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8068
8123
|
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8069
|
-
this._sideFlicking.forEach(function (flicking) {
|
|
8124
|
+
this._sideFlicking.forEach(function (flicking, mainIndex) {
|
|
8070
8125
|
flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
|
|
8071
8126
|
flicking.on(EVENTS.MOVE, _this._onSideMove);
|
|
8072
8127
|
flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
|
|
8073
8128
|
flicking.on(EVENTS.CHANGED, _this._onSideChanged);
|
|
8129
|
+
Object.keys(SIDE_EVENTS).forEach(function (name) {
|
|
8130
|
+
flicking.on(EVENTS[name], function (event) {
|
|
8131
|
+
_this.trigger(new ComponentEvent(SIDE_EVENTS[name], __assign({
|
|
8132
|
+
mainIndex: mainIndex
|
|
8133
|
+
}, event)));
|
|
8134
|
+
});
|
|
8135
|
+
});
|
|
8074
8136
|
});
|
|
8075
8137
|
};
|
|
8076
|
-
__proto._getGroupFromAttribute = function (panels) {
|
|
8077
|
-
var groupKeys = [];
|
|
8078
|
-
var groupPanels = {};
|
|
8079
|
-
panels.forEach(function (panel) {
|
|
8080
|
-
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8081
|
-
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8082
|
-
groupKeys.push(groupKey);
|
|
8083
|
-
groupPanels[groupKey] = [panel];
|
|
8084
|
-
} else if (groupKey) {
|
|
8085
|
-
groupPanels[groupKey].push(panel);
|
|
8086
|
-
}
|
|
8087
|
-
});
|
|
8088
|
-
return groupPanels;
|
|
8089
|
-
};
|
|
8090
8138
|
__proto._createSideState = function () {
|
|
8091
|
-
var _this = this;
|
|
8092
8139
|
var viewportEl = this.element;
|
|
8093
8140
|
var cameraEl = this.camera.element;
|
|
8094
8141
|
var panels = toArray(cameraEl.children);
|
|
8095
|
-
var sideState = [];
|
|
8096
|
-
var sidePanels = "";
|
|
8097
|
-
// check data attribute exists
|
|
8098
|
-
var sideCamera = document.createElement("div");
|
|
8099
|
-
sideCamera.classList.add(CLASS.CAMERA);
|
|
8100
8142
|
var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
|
|
8143
|
+
var sideState = [];
|
|
8101
8144
|
if (!isCrossStructure) {
|
|
8102
|
-
viewportEl.setAttribute("data-cross-structure", "true");
|
|
8103
8145
|
var groupPanels = this._getGroupFromAttribute(panels);
|
|
8104
8146
|
var groupKeys = Object.keys(groupPanels);
|
|
8105
8147
|
if (groupKeys.length) {
|
|
8106
8148
|
sideState = this._getSideStateFromGroup(groupPanels);
|
|
8107
8149
|
this.remove(0, this.panelCount - groupKeys.length);
|
|
8108
|
-
sideState.forEach(function (state, i) {
|
|
8109
|
-
var panel = _this.camera.children[i];
|
|
8110
|
-
sidePanels += state.element.innerHTML;
|
|
8111
|
-
Array.from(panel.attributes).forEach(function (attribute) {
|
|
8112
|
-
return panel.removeAttribute(attribute.name);
|
|
8113
|
-
});
|
|
8114
|
-
});
|
|
8115
8150
|
} else {
|
|
8116
|
-
sideState =
|
|
8117
|
-
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8118
|
-
sidePanels += panel.innerHTML;
|
|
8119
|
-
return __spread(state, [{
|
|
8120
|
-
key: i.toString(),
|
|
8121
|
-
start: start,
|
|
8122
|
-
end: start + panel.children.length - 1,
|
|
8123
|
-
element: panel
|
|
8124
|
-
}]);
|
|
8125
|
-
}, []);
|
|
8151
|
+
sideState = this._getSideStateFromPanels(panels);
|
|
8126
8152
|
}
|
|
8127
|
-
|
|
8128
|
-
sideState.forEach(function (_, i) {
|
|
8129
|
-
var panel = _this.camera.children[i];
|
|
8130
|
-
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8131
|
-
if (!panel.classList.contains(className)) {
|
|
8132
|
-
panel.classList.add(className);
|
|
8133
|
-
}
|
|
8134
|
-
});
|
|
8135
|
-
panel.innerHTML = sideCamera.outerHTML;
|
|
8136
|
-
});
|
|
8153
|
+
this._createCrossStructure(sideState);
|
|
8137
8154
|
} else {
|
|
8138
|
-
sideState = this.
|
|
8155
|
+
sideState = this._getSideStateFromCrossStructure(panels);
|
|
8139
8156
|
}
|
|
8140
8157
|
void this.resize();
|
|
8141
8158
|
return sideState;
|
|
8142
8159
|
};
|
|
8160
|
+
__proto._createCrossStructure = function (sideState) {
|
|
8161
|
+
var _this = this;
|
|
8162
|
+
var sideCamera = document.createElement("div");
|
|
8163
|
+
var sidePanels = "";
|
|
8164
|
+
sideCamera.classList.add(CLASS.CAMERA);
|
|
8165
|
+
sideState.forEach(function (state, i) {
|
|
8166
|
+
var panel = _this.camera.children[i];
|
|
8167
|
+
sidePanels += state.element.innerHTML;
|
|
8168
|
+
Array.from(panel.attributes).forEach(function (attribute) {
|
|
8169
|
+
return panel.removeAttribute(attribute.name);
|
|
8170
|
+
});
|
|
8171
|
+
});
|
|
8172
|
+
sideCamera.innerHTML = sidePanels;
|
|
8173
|
+
sideState.forEach(function (_, i) {
|
|
8174
|
+
var panel = _this.camera.children[i];
|
|
8175
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8176
|
+
if (!panel.classList.contains(className)) {
|
|
8177
|
+
panel.classList.add(className);
|
|
8178
|
+
}
|
|
8179
|
+
});
|
|
8180
|
+
panel.innerHTML = sideCamera.outerHTML;
|
|
8181
|
+
});
|
|
8182
|
+
this.element.setAttribute("data-cross-structure", "true");
|
|
8183
|
+
};
|
|
8184
|
+
__proto._getGroupFromAttribute = function (panels) {
|
|
8185
|
+
var groupKeys = [];
|
|
8186
|
+
var groupPanels = {};
|
|
8187
|
+
panels.forEach(function (panel) {
|
|
8188
|
+
var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
|
|
8189
|
+
if (groupKey && !includes(groupKeys, groupKey)) {
|
|
8190
|
+
groupKeys.push(groupKey);
|
|
8191
|
+
groupPanels[groupKey] = [panel];
|
|
8192
|
+
} else if (groupKey) {
|
|
8193
|
+
groupPanels[groupKey].push(panel);
|
|
8194
|
+
}
|
|
8195
|
+
});
|
|
8196
|
+
return groupPanels;
|
|
8197
|
+
};
|
|
8143
8198
|
__proto._getSideStateFromGroup = function (groupPanels) {
|
|
8144
8199
|
return Object.keys(groupPanels).reduce(function (state, key) {
|
|
8145
8200
|
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
@@ -8156,6 +8211,17 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
|
8156
8211
|
}, []);
|
|
8157
8212
|
};
|
|
8158
8213
|
__proto._getSideStateFromPanels = function (panels) {
|
|
8214
|
+
return panels.reduce(function (state, panel, i) {
|
|
8215
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8216
|
+
return __spread(state, [{
|
|
8217
|
+
key: i.toString(),
|
|
8218
|
+
start: start,
|
|
8219
|
+
end: start + panel.children.length - 1,
|
|
8220
|
+
element: panel
|
|
8221
|
+
}]);
|
|
8222
|
+
}, []);
|
|
8223
|
+
};
|
|
8224
|
+
__proto._getSideStateFromCrossStructure = function (panels) {
|
|
8159
8225
|
var groupPanels = this._getGroupFromAttribute(panels);
|
|
8160
8226
|
return this._getSideStateFromGroup(groupPanels);
|
|
8161
8227
|
};
|
|
@@ -8165,25 +8231,10 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
|
8165
8231
|
return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
|
|
8166
8232
|
horizontal: false,
|
|
8167
8233
|
panelsPerView: 1,
|
|
8168
|
-
defaultIndex: state.start
|
|
8169
|
-
moveType: "strict"
|
|
8234
|
+
defaultIndex: state.start
|
|
8170
8235
|
}));
|
|
8171
8236
|
});
|
|
8172
8237
|
};
|
|
8173
|
-
__proto._syncToCategory = function (index, outerIndex) {
|
|
8174
|
-
var _this = this;
|
|
8175
|
-
this.stopAnimation();
|
|
8176
|
-
this._sideFlicking.forEach(function (child, i) {
|
|
8177
|
-
var _a = _this._sideState[i],
|
|
8178
|
-
start = _a.start,
|
|
8179
|
-
end = _a.end;
|
|
8180
|
-
if (start <= index && end >= index && outerIndex !== i) {
|
|
8181
|
-
child.stopAnimation();
|
|
8182
|
-
void child.moveTo(index, 0);
|
|
8183
|
-
void _this.moveTo(i, 0);
|
|
8184
|
-
}
|
|
8185
|
-
});
|
|
8186
|
-
};
|
|
8187
8238
|
return CrossFlicking;
|
|
8188
8239
|
}(Flicking);
|
|
8189
8240
|
|
|
@@ -8401,5 +8452,5 @@ var parseAlign = function (alignVal) {
|
|
|
8401
8452
|
* egjs projects are licensed under the MIT license
|
|
8402
8453
|
*/
|
|
8403
8454
|
|
|
8404
|
-
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 };
|
|
8455
|
+
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, SIDE_EVENTS, 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 };
|
|
8405
8456
|
//# sourceMappingURL=flicking.esm.js.map
|