@egjs/flicking 4.12.0-beta.1 → 4.12.0-beta.10

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.
@@ -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.1
7
+ version: 4.12.0-beta.10
8
8
  */
9
9
  'use strict';
10
10
 
@@ -387,6 +387,8 @@ var MOVE_TYPE = {
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"
@@ -738,6 +740,26 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
738
740
  obj.__proto__ = proto;
739
741
  return obj;
740
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
+ };
741
763
 
742
764
  /*
743
765
  * Copyright (c) 2015 NAVER Corp.
@@ -3724,6 +3746,7 @@ var Camera = /*#__PURE__*/function () {
3724
3746
  var _this = this;
3725
3747
  var _b = (_a === void 0 ? {} : _a).align,
3726
3748
  align = _b === void 0 ? ALIGN.CENTER : _b;
3749
+ this._lookedOffset = 0;
3727
3750
  this._checkTranslateSupport = function () {
3728
3751
  var e_1, _a;
3729
3752
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4083,6 +4106,8 @@ var Camera = /*#__PURE__*/function () {
4083
4106
  */
4084
4107
  __proto.lookAt = function (pos) {
4085
4108
  var _this = this;
4109
+ var prevOffset = this._offset;
4110
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4086
4111
  var flicking = getFlickingAttached(this._flicking);
4087
4112
  var prevPos = this._position;
4088
4113
  this._position = pos;
@@ -4093,7 +4118,12 @@ var Camera = /*#__PURE__*/function () {
4093
4118
  if (toggled) {
4094
4119
  void flicking.renderer.render().then(function () {
4095
4120
  _this.updateOffset();
4121
+ _this._lookedOffset = _this._offset;
4096
4122
  });
4123
+ } else if (isChangedOffset) {
4124
+ // sync offset for renderOnlyVisible on resize
4125
+ this.updateOffset();
4126
+ this._lookedOffset = this._offset;
4097
4127
  } else {
4098
4128
  this.applyTransform();
4099
4129
  }
@@ -4268,8 +4298,8 @@ var Camera = /*#__PURE__*/function () {
4268
4298
  return this;
4269
4299
  };
4270
4300
  /**
4271
- * Update Viewport's height to active panel's height
4272
- * @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
4301
+ * Update Viewport's height to visible panel's max height
4302
+ * @ko 현재 활성화된 패널과 보이는 패널의 최대 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
4273
4303
  * @throws {FlickingError}
4274
4304
  * {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
4275
4305
  * <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
@@ -4279,9 +4309,17 @@ var Camera = /*#__PURE__*/function () {
4279
4309
  __proto.updateAdaptiveHeight = function () {
4280
4310
  var flicking = getFlickingAttached(this._flicking);
4281
4311
  var activePanel = flicking.control.activePanel;
4282
- if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
4312
+ var visiblePanels = flicking.visiblePanels;
4313
+ var selectedPanels = __spread(visiblePanels);
4314
+ if (activePanel) {
4315
+ selectedPanels.push(activePanel);
4316
+ }
4317
+ if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
4318
+ var maxHeight = Math.max.apply(Math, __spread(selectedPanels.map(function (panel) {
4319
+ return panel.height;
4320
+ })));
4283
4321
  flicking.viewport.setSize({
4284
- height: activePanel.height
4322
+ height: maxHeight
4285
4323
  });
4286
4324
  };
4287
4325
  /**
@@ -4352,6 +4390,7 @@ var Camera = /*#__PURE__*/function () {
4352
4390
  };
4353
4391
  __proto._resetInternalValues = function () {
4354
4392
  this._position = 0;
4393
+ this._lookedOffset = 0;
4355
4394
  this._alignPos = 0;
4356
4395
  this._offset = 0;
4357
4396
  this._circularOffset = 0;
@@ -7873,180 +7912,332 @@ var Flicking = /*#__PURE__*/function (_super) {
7873
7912
  * Flicking.VERSION; // ex) 4.0.0
7874
7913
  * ```
7875
7914
  */
7876
- Flicking.VERSION = "4.12.0-beta.1";
7915
+ Flicking.VERSION = "4.12.0-beta.10";
7877
7916
  return Flicking;
7878
7917
  }(Component);
7879
7918
 
7880
- /*
7881
- * Copyright (c) 2015 NAVER Corp.
7882
- * egjs projects are licensed under the MIT license
7883
- */
7884
- /**
7885
- * @extends Component
7886
- * @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
7887
- * @requires {@link https://github.com/naver/egjs-component|@egjs/component}
7888
- * @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
7889
- */
7919
+ var SIDE_EVENTS = {
7920
+ HOLD_START: "sideHoldStart",
7921
+ HOLD_END: "sideHoldEnd",
7922
+ MOVE_START: "sideMoveStart",
7923
+ MOVE: "sideMove",
7924
+ MOVE_END: "sideMoveEnd",
7925
+ WILL_CHANGE: "sideWillChange",
7926
+ CHANGED: "sideChanged"
7927
+ };
7890
7928
  var CrossFlicking = /*#__PURE__*/function (_super) {
7891
7929
  __extends(CrossFlicking, _super);
7892
- // Options Setter
7893
- // UI / LAYOUT
7894
- // public set align(val: FlickingOptions["align"]) {
7895
- // this._align = val;
7896
- // }
7897
- function CrossFlicking(root, _a) {
7898
- var _b = (_a === void 0 ? {} : _a).verticalOptions,
7899
- verticalOptions = _b === void 0 ? undefined : _b;
7900
- var _this = _super.call(this, root) || this;
7930
+ function CrossFlicking(root, options) {
7931
+ var _this = _super.call(this, root, options) || this;
7932
+ _this._syncToCategory = function (index, outerIndex) {
7933
+ if (_this._disableIndexSync) {
7934
+ return;
7935
+ }
7936
+ _this.stopAnimation();
7937
+ _this._sideFlicking.forEach(function (child, i) {
7938
+ var _a = _this._sideState[i],
7939
+ start = _a.start,
7940
+ end = _a.end;
7941
+ if (start <= index && end >= index && outerIndex !== i) {
7942
+ child.stopAnimation();
7943
+ void child.moveTo(index, 0);
7944
+ void _this.moveTo(i, 0);
7945
+ }
7946
+ });
7947
+ };
7948
+ _this._setDraggable = function (direction, draggable) {
7949
+ if (!_this._disableSlideOnHold) {
7950
+ return;
7951
+ }
7952
+ var dragThreshold = _this._originalDragThreshold;
7953
+ var threshold = draggable ? dragThreshold && dragThreshold >= 10 ? dragThreshold : 10 : Infinity;
7954
+ if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
7955
+ _this.dragThreshold = threshold;
7956
+ } else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
7957
+ _this._sideFlicking.forEach(function (child) {
7958
+ child.dragThreshold = threshold;
7959
+ });
7960
+ }
7961
+ };
7962
+ _this._setPreviousSideIndex = function () {
7963
+ _this._sideFlicking.forEach(function (child, i) {
7964
+ var _a = _this._sideState[i],
7965
+ start = _a.start,
7966
+ end = _a.end;
7967
+ if (_this._preserveIndex) {
7968
+ if (_this._nextIndex !== i) {
7969
+ if (child.index < start) {
7970
+ child.stopAnimation();
7971
+ void child.moveTo(start, 0);
7972
+ } else if (child.index > end) {
7973
+ child.stopAnimation();
7974
+ void child.moveTo(end, 0);
7975
+ }
7976
+ }
7977
+ } else {
7978
+ if (_this._nextIndex !== i) {
7979
+ void child.moveTo(start, 0);
7980
+ }
7981
+ }
7982
+ });
7983
+ };
7901
7984
  _this._onHorizontalHoldStart = function () {
7902
- _this.dragThreshold = 10;
7985
+ _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
7903
7986
  _this._moveDirection = null;
7904
7987
  };
7905
7988
  _this._onHorizontalMove = function (e) {
7906
7989
  if (e.isTrusted && !_this._moveDirection) {
7907
- _this._verticalFlicking.forEach(function (child) {
7908
- child.dragThreshold = Infinity;
7909
- });
7990
+ _this._setDraggable(MOVE_DIRECTION.VERTICAL, false);
7910
7991
  _this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
7911
7992
  }
7912
7993
  };
7913
7994
  _this._onHorizontalMoveEnd = function (e) {
7914
7995
  var visiblePanels = _this.visiblePanels;
7915
- _this._verticalFlicking.forEach(function (child) {
7916
- child.dragThreshold = 10;
7917
- });
7918
- _this._moveDirection = null;
7919
7996
  if (visiblePanels.length > 1) {
7920
7997
  _this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
7921
7998
  } else {
7922
7999
  _this._nextIndex = visiblePanels[0].index;
7923
8000
  }
7924
- _this._verticalFlicking.forEach(function (child, i) {
7925
- if (_this._nextIndex !== i) {
7926
- var _a = _this._verticalState[i],
7927
- start = _a.start,
7928
- end = _a.end;
7929
- if (child.index < start) {
7930
- child.stopAnimation();
7931
- void child.moveTo(start, 0);
7932
- } else if (child.index > end) {
7933
- child.stopAnimation();
7934
- void child.moveTo(end, 0);
7935
- }
7936
- }
8001
+ _this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
8002
+ _this._moveDirection = null;
8003
+ // _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 requestAnimationFrame 처리
8004
+ requestAnimationFrame(function () {
8005
+ return _this._setPreviousSideIndex();
7937
8006
  });
7938
8007
  if (e.isTrusted) {
7939
- _this._syncToCategory(_this._verticalFlicking[_this._nextIndex].index, _this._nextIndex);
8008
+ _this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
7940
8009
  }
7941
8010
  };
7942
- _this._onVerticalHoldStart = function () {
7943
- _this._verticalFlicking.forEach(function (child) {
7944
- child.dragThreshold = 10;
7945
- });
8011
+ _this._onSideHoldStart = function () {
8012
+ _this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
7946
8013
  _this._moveDirection = null;
7947
8014
  };
7948
- _this._onVerticalMove = function (e) {
8015
+ _this._onSideMove = function (e) {
7949
8016
  if (e.isTrusted && !_this._moveDirection) {
7950
- _this.dragThreshold = Infinity;
8017
+ _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, false);
7951
8018
  _this._moveDirection = MOVE_DIRECTION.VERTICAL;
7952
8019
  }
7953
8020
  };
7954
- _this._onVerticalMoveEnd = function () {
7955
- _this.dragThreshold = 10;
8021
+ _this._onSideMoveEnd = function () {
8022
+ _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
7956
8023
  _this._moveDirection = null;
7957
8024
  };
7958
- _this._onVerticalChanged = function (e) {
7959
- // this.visiblePanels.length 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
7960
- // 경우 가로 방향 Flicking의 이동이 완전히 끝난 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
7961
- if (_this.visiblePanels.length < 2 && _this._verticalFlicking[_this.index] === e.currentTarget) {
8025
+ _this._onSideChanged = function (e) {
8026
+ // If this.visiblePanels.length >= 2, it means that horizontal flicking is being dragged.
8027
+ // In this case, syncToCategory in _onHorizontalMoveEnd will fire after moving finishes, so we don't fire it here.
8028
+ if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
7962
8029
  _this._syncToCategory(e.index, _this.index);
7963
8030
  }
7964
8031
  };
8032
+ var _a = options.sideOptions,
8033
+ sideOptions = _a === void 0 ? {} : _a,
8034
+ _b = options.preserveIndex,
8035
+ preserveIndex = _b === void 0 ? true : _b,
8036
+ _c = options.disableSlideOnHold,
8037
+ disableSlideOnHold = _c === void 0 ? true : _c,
8038
+ _d = options.disableIndexSync,
8039
+ disableIndexSync = _d === void 0 ? false : _d;
7965
8040
  // Internal states
7966
- _this._verticalState = [];
7967
8041
  _this._moveDirection = null;
7968
8042
  _this._nextIndex = 0;
8043
+ _this._originalDragThreshold = _this.dragThreshold;
7969
8044
  // Bind options
7970
- _this._verticalOptions = verticalOptions;
8045
+ _this._sideOptions = sideOptions;
8046
+ _this._preserveIndex = preserveIndex;
8047
+ _this._disableSlideOnHold = disableSlideOnHold;
8048
+ _this._disableIndexSync = disableIndexSync;
7971
8049
  return _this;
7972
- // Create core components
7973
- // this._viewport = new Viewport(this, getElement(root));
7974
8050
  }
7975
8051
  var __proto = CrossFlicking.prototype;
7976
- Object.defineProperty(__proto, "verticalOptions", {
8052
+ Object.defineProperty(__proto, "sideFlicking", {
7977
8053
  // Components
7978
- /**
7979
- * Change active panel index on mouse/touch hold while animating.
7980
- * `index` of the `willChange`/`willRestore` event will be used as new index.
7981
- * @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
7982
- * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
7983
- * @type {FlickingOptions}
7984
- * @default undefined
7985
- * @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
7986
- */
7987
8054
  get: function () {
7988
- return this._verticalOptions;
8055
+ return this._sideFlicking;
8056
+ },
8057
+ enumerable: false,
8058
+ configurable: true
8059
+ });
8060
+ Object.defineProperty(__proto, "sideState", {
8061
+ get: function () {
8062
+ return this._sideState;
8063
+ },
8064
+ enumerable: false,
8065
+ configurable: true
8066
+ });
8067
+ Object.defineProperty(__proto, "sideOptions", {
8068
+ // Options Getter
8069
+ get: function () {
8070
+ return this._sideOptions;
8071
+ },
8072
+ // Options Setter
8073
+ set: function (val) {
8074
+ this._sideOptions = val;
8075
+ },
8076
+ enumerable: false,
8077
+ configurable: true
8078
+ });
8079
+ Object.defineProperty(__proto, "preserveIndex", {
8080
+ get: function () {
8081
+ return this._preserveIndex;
8082
+ },
8083
+ set: function (val) {
8084
+ this._preserveIndex = val;
8085
+ },
8086
+ enumerable: false,
8087
+ configurable: true
8088
+ });
8089
+ Object.defineProperty(__proto, "disableSlideOnHold", {
8090
+ get: function () {
8091
+ return this._disableSlideOnHold;
8092
+ },
8093
+ set: function (val) {
8094
+ this._disableSlideOnHold = val;
8095
+ },
8096
+ enumerable: false,
8097
+ configurable: true
8098
+ });
8099
+ Object.defineProperty(__proto, "disableIndexSync", {
8100
+ get: function () {
8101
+ return this._disableIndexSync;
8102
+ },
8103
+ set: function (val) {
8104
+ this._disableIndexSync = val;
7989
8105
  },
7990
8106
  enumerable: false,
7991
8107
  configurable: true
7992
8108
  });
7993
- /**
7994
- * Initialize Flicking and move to the default index
7995
- * This is automatically called on Flicking's constructor when `autoInit` is true(default)
7996
- * @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
7997
- * 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
7998
- * @fires Flicking#ready
7999
- * @return {Promise<void>}
8000
- */
8001
8109
  __proto.init = function () {
8002
8110
  var _this = this;
8003
8111
  return _super.prototype.init.call(this).then(function () {
8004
- // data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
8005
- // camera.children들에 대해 갯수 세기
8006
- var verticalPanels = "";
8007
- _this._verticalState = _this.camera.children.reduce(function (state, child) {
8008
- var start = state.length ? +state[state.length - 1].end + 1 : 0;
8009
- verticalPanels += child.children[0].innerHTML;
8010
- return __spread(state, [{
8011
- start: start,
8012
- end: start + child.children[0].children.length - 1,
8013
- element: child
8014
- }]);
8015
- }, []);
8016
- _this.camera.children.forEach(function (child) {
8017
- child.children[0].innerHTML = verticalPanels;
8112
+ _this._sideState = _this._createSideState();
8113
+ _this._sideFlicking = _this._createSideFlicking();
8114
+ _this._addComponentEvents();
8115
+ });
8116
+ };
8117
+ __proto.destroy = function () {
8118
+ this._sideFlicking.forEach(function (flicking) {
8119
+ flicking.destroy();
8120
+ });
8121
+ _super.prototype.destroy.call(this);
8122
+ };
8123
+ __proto._addComponentEvents = function () {
8124
+ var _this = this;
8125
+ this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
8126
+ this.on(EVENTS.MOVE, this._onHorizontalMove);
8127
+ this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
8128
+ this._sideFlicking.forEach(function (flicking, mainIndex) {
8129
+ flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
8130
+ flicking.on(EVENTS.MOVE, _this._onSideMove);
8131
+ flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
8132
+ flicking.on(EVENTS.CHANGED, _this._onSideChanged);
8133
+ Object.keys(SIDE_EVENTS).forEach(function (name) {
8134
+ flicking.on(EVENTS[name], function (event) {
8135
+ _this.trigger(new Component.ComponentEvent(SIDE_EVENTS[name], __assign({
8136
+ mainIndex: mainIndex
8137
+ }, event)));
8138
+ });
8018
8139
  });
8019
- _this._verticalFlicking = _this.camera.children.map(function (child, i) {
8020
- return new Flicking(child, __assign(__assign({}, _this.verticalOptions), {
8021
- horizontal: false,
8022
- panelsPerView: 1,
8023
- defaultIndex: _this._verticalState[i].start
8024
- }));
8140
+ });
8141
+ };
8142
+ __proto._createSideState = function () {
8143
+ var viewportEl = this.element;
8144
+ var cameraEl = this.camera.element;
8145
+ var panels = toArray(cameraEl.children);
8146
+ var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
8147
+ var sideState = [];
8148
+ if (!isCrossStructure) {
8149
+ var groupPanels = this._getGroupFromAttribute(panels);
8150
+ var groupKeys = Object.keys(groupPanels);
8151
+ if (groupKeys.length) {
8152
+ sideState = this._getSideStateFromGroup(groupPanels);
8153
+ this.remove(0, this.panelCount - groupKeys.length);
8154
+ } else {
8155
+ sideState = this._getSideStateFromPanels(panels);
8156
+ }
8157
+ this._createCrossStructure(sideState);
8158
+ } else {
8159
+ sideState = this._getSideStateFromCrossStructure(panels);
8160
+ }
8161
+ void this.resize();
8162
+ return sideState;
8163
+ };
8164
+ __proto._createCrossStructure = function (sideState) {
8165
+ var _this = this;
8166
+ var sideCamera = document.createElement("div");
8167
+ var sidePanels = "";
8168
+ sideCamera.classList.add(CLASS.CAMERA);
8169
+ sideState.forEach(function (state, i) {
8170
+ var panel = _this.camera.children[i];
8171
+ sidePanels += state.element.innerHTML;
8172
+ Array.from(panel.attributes).forEach(function (attribute) {
8173
+ return panel.removeAttribute(attribute.name);
8025
8174
  });
8026
- _this.on(EVENTS.HOLD_START, _this._onHorizontalHoldStart);
8027
- _this.on(EVENTS.MOVE, _this._onHorizontalMove);
8028
- _this.on(EVENTS.MOVE_END, _this._onHorizontalMoveEnd);
8029
- _this._verticalFlicking.forEach(function (child) {
8030
- child.on(EVENTS.HOLD_START, _this._onVerticalHoldStart);
8031
- child.on(EVENTS.MOVE, _this._onVerticalMove);
8032
- child.on(EVENTS.MOVE_END, _this._onVerticalMoveEnd);
8033
- child.on(EVENTS.CHANGED, _this._onVerticalChanged);
8175
+ });
8176
+ sideCamera.innerHTML = sidePanels;
8177
+ sideState.forEach(function (_, i) {
8178
+ var panel = _this.camera.children[i];
8179
+ [CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
8180
+ if (!panel.classList.contains(className)) {
8181
+ panel.classList.add(className);
8182
+ }
8034
8183
  });
8184
+ panel.innerHTML = sideCamera.outerHTML;
8035
8185
  });
8186
+ this.element.setAttribute("data-cross-structure", "true");
8036
8187
  };
8037
- __proto._syncToCategory = function (index, outerIndex) {
8038
- var _this = this;
8039
- this.stopAnimation();
8040
- this._verticalFlicking.forEach(function (child, i) {
8041
- var _a = _this._verticalState[i],
8042
- start = _a.start,
8043
- end = _a.end;
8044
- if (start <= index && end >= index && outerIndex !== i) {
8045
- child.stopAnimation();
8046
- void child.moveTo(index, 0);
8047
- void _this.moveTo(i, 0);
8188
+ __proto._getGroupFromAttribute = function (panels) {
8189
+ var groupKeys = [];
8190
+ var groupPanels = {};
8191
+ panels.forEach(function (panel) {
8192
+ var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
8193
+ if (groupKey && !includes(groupKeys, groupKey)) {
8194
+ groupKeys.push(groupKey);
8195
+ groupPanels[groupKey] = [panel];
8196
+ } else if (groupKey) {
8197
+ groupPanels[groupKey].push(panel);
8048
8198
  }
8049
8199
  });
8200
+ return groupPanels;
8201
+ };
8202
+ __proto._getSideStateFromGroup = function (groupPanels) {
8203
+ return Object.keys(groupPanels).reduce(function (state, key) {
8204
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8205
+ var element = groupPanels[key].reduce(function (el, panel) {
8206
+ el.innerHTML += panel.outerHTML;
8207
+ return el;
8208
+ }, document.createElement("div"));
8209
+ return __spread(state, [{
8210
+ key: key,
8211
+ start: start,
8212
+ end: start + groupPanels[key].length - 1,
8213
+ element: element
8214
+ }]);
8215
+ }, []);
8216
+ };
8217
+ __proto._getSideStateFromPanels = function (panels) {
8218
+ return panels.reduce(function (state, panel, i) {
8219
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8220
+ return __spread(state, [{
8221
+ key: i.toString(),
8222
+ start: start,
8223
+ end: start + panel.children.length - 1,
8224
+ element: panel
8225
+ }]);
8226
+ }, []);
8227
+ };
8228
+ __proto._getSideStateFromCrossStructure = function (panels) {
8229
+ var groupPanels = this._getGroupFromAttribute(panels);
8230
+ return this._getSideStateFromGroup(groupPanels);
8231
+ };
8232
+ __proto._createSideFlicking = function () {
8233
+ var _this = this;
8234
+ return this.sideState.map(function (state, i) {
8235
+ return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
8236
+ horizontal: false,
8237
+ panelsPerView: 1,
8238
+ defaultIndex: state.start
8239
+ }));
8240
+ });
8050
8241
  };
8051
8242
  return CrossFlicking;
8052
8243
  }(Flicking);
@@ -8268,6 +8459,7 @@ var parseAlign = function (alignVal) {
8268
8459
  var modules = {
8269
8460
  __proto__: null,
8270
8461
  'default': Flicking,
8462
+ SIDE_EVENTS: SIDE_EVENTS,
8271
8463
  CrossFlicking: CrossFlicking,
8272
8464
  VanillaElementProvider: VanillaElementProvider,
8273
8465
  VirtualElementProvider: VirtualElementProvider,
@@ -8339,7 +8531,9 @@ var modules = {
8339
8531
  circulateIndex: circulateIndex,
8340
8532
  range: range,
8341
8533
  getElementSize: getElementSize,
8342
- setPrototypeOf: setPrototypeOf
8534
+ setPrototypeOf: setPrototypeOf,
8535
+ camelize: camelize,
8536
+ getDataAttributes: getDataAttributes
8343
8537
  };
8344
8538
 
8345
8539
  /*
@@ -8379,6 +8573,7 @@ exports.NormalRenderingStrategy = NormalRenderingStrategy;
8379
8573
  exports.ORDER = ORDER;
8380
8574
  exports.Panel = Panel;
8381
8575
  exports.Renderer = Renderer;
8576
+ exports.SIDE_EVENTS = SIDE_EVENTS;
8382
8577
  exports.SnapControl = SnapControl;
8383
8578
  exports.State = State;
8384
8579
  exports.StateMachine = StateMachine;
@@ -8390,6 +8585,7 @@ exports.VirtualElementProvider = VirtualElementProvider;
8390
8585
  exports.VirtualManager = VirtualManager;
8391
8586
  exports.VirtualPanel = VirtualPanel;
8392
8587
  exports.VirtualRenderingStrategy = VirtualRenderingStrategy;
8588
+ exports.camelize = camelize;
8393
8589
  exports.checkExistence = checkExistence;
8394
8590
  exports.circulateIndex = circulateIndex;
8395
8591
  exports.circulatePosition = circulatePosition;
@@ -8398,6 +8594,7 @@ exports["default"] = Flicking;
8398
8594
  exports.find = find;
8399
8595
  exports.findIndex = findIndex;
8400
8596
  exports.findRight = findRight;
8597
+ exports.getDataAttributes = getDataAttributes;
8401
8598
  exports.getDefaultCameraTransform = getDefaultCameraTransform;
8402
8599
  exports.getDirection = getDirection;
8403
8600
  exports.getElement = getElement;