@egjs/flicking 4.12.0-beta.0 → 4.12.0-beta.1
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 +29 -0
- package/declaration/const/external.d.ts +4 -0
- package/declaration/index.d.ts +1 -0
- package/dist/flicking.cjs.js +191 -2
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +188 -3
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +194 -2
- 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 +194 -2
- 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/src/CrossFlicking.ts +252 -0
- package/src/const/external.ts +12 -0
- package/src/index.ts +2 -0
- package/src/index.umd.ts +2 -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.1
|
|
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')) :
|
|
@@ -413,6 +413,17 @@ version: 4.12.0-beta.0
|
|
|
413
413
|
LTR: "ltr",
|
|
414
414
|
RTL: "rtl"
|
|
415
415
|
};
|
|
416
|
+
/**
|
|
417
|
+
* An object that contains the direction that {@link Flicking} is moving
|
|
418
|
+
* @ko {@link Flicking}이 움직이는 방향을 담고 있는 객체
|
|
419
|
+
* @type {object}
|
|
420
|
+
* @property {"horizontal"} HORIZONTAL horizontal<ko>수평 방향</ko>
|
|
421
|
+
* @property {"vertical"} VERTICAL vertical<ko>수직 방향</ko>
|
|
422
|
+
*/
|
|
423
|
+
var MOVE_DIRECTION = {
|
|
424
|
+
HORIZONTAL: "horizontal",
|
|
425
|
+
VERTICAL: "vertical"
|
|
426
|
+
};
|
|
416
427
|
|
|
417
428
|
var Constants = {
|
|
418
429
|
__proto__: null,
|
|
@@ -423,6 +434,7 @@ version: 4.12.0-beta.0
|
|
|
423
434
|
CLASS: CLASS,
|
|
424
435
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
425
436
|
ORDER: ORDER,
|
|
437
|
+
MOVE_DIRECTION: MOVE_DIRECTION,
|
|
426
438
|
ERROR_CODE: CODE
|
|
427
439
|
};
|
|
428
440
|
|
|
@@ -7955,10 +7967,189 @@ version: 4.12.0-beta.0
|
|
|
7955
7967
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7956
7968
|
* ```
|
|
7957
7969
|
*/
|
|
7958
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7970
|
+
Flicking.VERSION = "4.12.0-beta.1";
|
|
7959
7971
|
return Flicking;
|
|
7960
7972
|
}(Component);
|
|
7961
7973
|
|
|
7974
|
+
/*
|
|
7975
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7976
|
+
* egjs projects are licensed under the MIT license
|
|
7977
|
+
*/
|
|
7978
|
+
/**
|
|
7979
|
+
* @extends Component
|
|
7980
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7981
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7982
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7983
|
+
*/
|
|
7984
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7985
|
+
__extends(CrossFlicking, _super);
|
|
7986
|
+
// Options Setter
|
|
7987
|
+
// UI / LAYOUT
|
|
7988
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7989
|
+
// this._align = val;
|
|
7990
|
+
// }
|
|
7991
|
+
function CrossFlicking(root, _a) {
|
|
7992
|
+
var _b = (_a === void 0 ? {} : _a).verticalOptions,
|
|
7993
|
+
verticalOptions = _b === void 0 ? undefined : _b;
|
|
7994
|
+
var _this = _super.call(this, root) || this;
|
|
7995
|
+
_this._onHorizontalHoldStart = function () {
|
|
7996
|
+
_this.dragThreshold = 10;
|
|
7997
|
+
_this._moveDirection = null;
|
|
7998
|
+
};
|
|
7999
|
+
_this._onHorizontalMove = function (e) {
|
|
8000
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
8001
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8002
|
+
child.dragThreshold = Infinity;
|
|
8003
|
+
});
|
|
8004
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
8005
|
+
}
|
|
8006
|
+
};
|
|
8007
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
8008
|
+
var visiblePanels = _this.visiblePanels;
|
|
8009
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8010
|
+
child.dragThreshold = 10;
|
|
8011
|
+
});
|
|
8012
|
+
_this._moveDirection = null;
|
|
8013
|
+
if (visiblePanels.length > 1) {
|
|
8014
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
8015
|
+
} else {
|
|
8016
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
8017
|
+
}
|
|
8018
|
+
_this._verticalFlicking.forEach(function (child, i) {
|
|
8019
|
+
if (_this._nextIndex !== i) {
|
|
8020
|
+
var _a = _this._verticalState[i],
|
|
8021
|
+
start = _a.start,
|
|
8022
|
+
end = _a.end;
|
|
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
|
+
}
|
|
8031
|
+
});
|
|
8032
|
+
if (e.isTrusted) {
|
|
8033
|
+
_this._syncToCategory(_this._verticalFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
8034
|
+
}
|
|
8035
|
+
};
|
|
8036
|
+
_this._onVerticalHoldStart = function () {
|
|
8037
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8038
|
+
child.dragThreshold = 10;
|
|
8039
|
+
});
|
|
8040
|
+
_this._moveDirection = null;
|
|
8041
|
+
};
|
|
8042
|
+
_this._onVerticalMove = function (e) {
|
|
8043
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
8044
|
+
_this.dragThreshold = Infinity;
|
|
8045
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
8046
|
+
}
|
|
8047
|
+
};
|
|
8048
|
+
_this._onVerticalMoveEnd = function () {
|
|
8049
|
+
_this.dragThreshold = 10;
|
|
8050
|
+
_this._moveDirection = null;
|
|
8051
|
+
};
|
|
8052
|
+
_this._onVerticalChanged = function (e) {
|
|
8053
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
8054
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
8055
|
+
if (_this.visiblePanels.length < 2 && _this._verticalFlicking[_this.index] === e.currentTarget) {
|
|
8056
|
+
_this._syncToCategory(e.index, _this.index);
|
|
8057
|
+
}
|
|
8058
|
+
};
|
|
8059
|
+
// Internal states
|
|
8060
|
+
_this._verticalState = [];
|
|
8061
|
+
_this._moveDirection = null;
|
|
8062
|
+
_this._nextIndex = 0;
|
|
8063
|
+
// Bind options
|
|
8064
|
+
_this._verticalOptions = verticalOptions;
|
|
8065
|
+
return _this;
|
|
8066
|
+
// Create core components
|
|
8067
|
+
// this._viewport = new Viewport(this, getElement(root));
|
|
8068
|
+
}
|
|
8069
|
+
var __proto = CrossFlicking.prototype;
|
|
8070
|
+
Object.defineProperty(__proto, "verticalOptions", {
|
|
8071
|
+
// 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
|
+
get: function () {
|
|
8082
|
+
return this._verticalOptions;
|
|
8083
|
+
},
|
|
8084
|
+
enumerable: false,
|
|
8085
|
+
configurable: true
|
|
8086
|
+
});
|
|
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
|
+
__proto.init = function () {
|
|
8096
|
+
var _this = this;
|
|
8097
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8098
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
|
|
8099
|
+
// camera.children들에 대해 갯수 세기
|
|
8100
|
+
var verticalPanels = "";
|
|
8101
|
+
_this._verticalState = _this.camera.children.reduce(function (state, child) {
|
|
8102
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8103
|
+
verticalPanels += child.children[0].innerHTML;
|
|
8104
|
+
return __spread(state, [{
|
|
8105
|
+
start: start,
|
|
8106
|
+
end: start + child.children[0].children.length - 1,
|
|
8107
|
+
element: child
|
|
8108
|
+
}]);
|
|
8109
|
+
}, []);
|
|
8110
|
+
_this.camera.children.forEach(function (child) {
|
|
8111
|
+
child.children[0].innerHTML = verticalPanels;
|
|
8112
|
+
});
|
|
8113
|
+
_this._verticalFlicking = _this.camera.children.map(function (child, i) {
|
|
8114
|
+
return new Flicking(child, __assign(__assign({}, _this.verticalOptions), {
|
|
8115
|
+
horizontal: false,
|
|
8116
|
+
panelsPerView: 1,
|
|
8117
|
+
defaultIndex: _this._verticalState[i].start
|
|
8118
|
+
}));
|
|
8119
|
+
});
|
|
8120
|
+
_this.on(EVENTS.HOLD_START, _this._onHorizontalHoldStart);
|
|
8121
|
+
_this.on(EVENTS.MOVE, _this._onHorizontalMove);
|
|
8122
|
+
_this.on(EVENTS.MOVE_END, _this._onHorizontalMoveEnd);
|
|
8123
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8124
|
+
child.on(EVENTS.HOLD_START, _this._onVerticalHoldStart);
|
|
8125
|
+
child.on(EVENTS.MOVE, _this._onVerticalMove);
|
|
8126
|
+
child.on(EVENTS.MOVE_END, _this._onVerticalMoveEnd);
|
|
8127
|
+
child.on(EVENTS.CHANGED, _this._onVerticalChanged);
|
|
8128
|
+
});
|
|
8129
|
+
});
|
|
8130
|
+
};
|
|
8131
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8132
|
+
var _this = this;
|
|
8133
|
+
this.stopAnimation();
|
|
8134
|
+
this._verticalFlicking.forEach(function (child, i) {
|
|
8135
|
+
var _a = _this._verticalState[i],
|
|
8136
|
+
start = _a.start,
|
|
8137
|
+
end = _a.end;
|
|
8138
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8139
|
+
child.stopAnimation();
|
|
8140
|
+
void child.moveTo(index, 0);
|
|
8141
|
+
void _this.moveTo(i, 0);
|
|
8142
|
+
}
|
|
8143
|
+
});
|
|
8144
|
+
};
|
|
8145
|
+
return CrossFlicking;
|
|
8146
|
+
}(Flicking);
|
|
8147
|
+
|
|
8148
|
+
var CrossFlicking$1 = {
|
|
8149
|
+
__proto__: null,
|
|
8150
|
+
CrossFlicking: CrossFlicking
|
|
8151
|
+
};
|
|
8152
|
+
|
|
7962
8153
|
/*
|
|
7963
8154
|
* Copyright (c) 2015 NAVER Corp.
|
|
7964
8155
|
* egjs projects are licensed under the MIT license
|
|
@@ -8204,6 +8395,7 @@ version: 4.12.0-beta.0
|
|
|
8204
8395
|
merge(Flicking, Constants);
|
|
8205
8396
|
merge(Flicking, CFC);
|
|
8206
8397
|
merge(Flicking, Utils);
|
|
8398
|
+
merge(Flicking, CrossFlicking$1);
|
|
8207
8399
|
|
|
8208
8400
|
return Flicking;
|
|
8209
8401
|
|