@egjs/flicking 4.16.0-beta.3 → 4.16.1-beta.0
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/dist/flicking.cjs.js +271 -190
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +271 -190
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +273 -192
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +1 -1
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +273 -192
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +1 -1
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/flicking.js
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory(require("@egjs/component"), require("@egjs/axes"), require("@egjs/imready")) : typeof define === "function" && define.amd ? define(["@egjs/component", "@egjs/axes", "@egjs/imready"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.Flicking = factory(global.eg.Component, global.eg.Axes, global.eg.ImReady));
|
|
3
3
|
})(this, (function(Component, Axes, ImReady) {
|
|
4
|
-
"use strict";
|
|
4
|
+
"use strict";var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __reflectGet = Reflect.get;
|
|
12
|
+
var __pow = Math.pow;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
27
|
+
var __async = (__this, __arguments, generator) => {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
var fulfilled = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.next(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var rejected = (value) => {
|
|
37
|
+
try {
|
|
38
|
+
step(generator.throw(value));
|
|
39
|
+
} catch (e) {
|
|
40
|
+
reject(e);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
44
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
5
48
|
const ALIGN = {
|
|
6
49
|
/** left/top align */
|
|
7
50
|
PREV: "prev",
|
|
@@ -879,10 +922,11 @@
|
|
|
879
922
|
return true;
|
|
880
923
|
}
|
|
881
924
|
getRange() {
|
|
925
|
+
var _a, _b;
|
|
882
926
|
const renderer = this._flicking.renderer;
|
|
883
927
|
const firstPanel = renderer.getPanel(0);
|
|
884
928
|
const lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
885
|
-
return { min: firstPanel
|
|
929
|
+
return { min: (_a = firstPanel == null ? void 0 : firstPanel.position) != null ? _a : 0, max: (_b = lastPanel == null ? void 0 : lastPanel.position) != null ? _b : 0 };
|
|
886
930
|
}
|
|
887
931
|
}
|
|
888
932
|
let Camera$1 = class Camera {
|
|
@@ -1211,10 +1255,11 @@
|
|
|
1211
1255
|
* @returns The {@link AnchorPoint} that matches current panel
|
|
1212
1256
|
*/
|
|
1213
1257
|
findActiveAnchor() {
|
|
1258
|
+
var _a;
|
|
1214
1259
|
const flicking = getFlickingAttached(this._flicking);
|
|
1215
1260
|
const activePanel = flicking.control.activePanel;
|
|
1216
1261
|
if (!activePanel) return null;
|
|
1217
|
-
return find(this._anchors, (anchor) => anchor.panel.index === activePanel.index)
|
|
1262
|
+
return (_a = find(this._anchors, (anchor) => anchor.panel.index === activePanel.index)) != null ? _a : this.findNearestAnchor(activePanel.position);
|
|
1218
1263
|
}
|
|
1219
1264
|
/**
|
|
1220
1265
|
* Clamp the given position between camera's range
|
|
@@ -1852,7 +1897,7 @@
|
|
|
1852
1897
|
}
|
|
1853
1898
|
fire(eventType, externalCtx) {
|
|
1854
1899
|
const currentState = this._state;
|
|
1855
|
-
const ctx = {
|
|
1900
|
+
const ctx = __spreadProps(__spreadValues({}, externalCtx), { transitTo: this.transitTo });
|
|
1856
1901
|
switch (eventType) {
|
|
1857
1902
|
case EVENT.HOLD:
|
|
1858
1903
|
currentState.onHold(ctx);
|
|
@@ -1878,7 +1923,8 @@
|
|
|
1878
1923
|
this._dragged = false;
|
|
1879
1924
|
};
|
|
1880
1925
|
this._onAxesChange = () => {
|
|
1881
|
-
|
|
1926
|
+
var _a;
|
|
1927
|
+
this._dragged = !!((_a = this._panInput) == null ? void 0 : _a.isEnabled());
|
|
1882
1928
|
};
|
|
1883
1929
|
this._preventClickWhenDragged = (e) => {
|
|
1884
1930
|
if (this._dragged) {
|
|
@@ -1949,28 +1995,32 @@
|
|
|
1949
1995
|
* @readonly
|
|
1950
1996
|
*/
|
|
1951
1997
|
get enabled() {
|
|
1952
|
-
|
|
1998
|
+
var _a, _b;
|
|
1999
|
+
return (_b = (_a = this._panInput) == null ? void 0 : _a.isEnabled()) != null ? _b : false;
|
|
1953
2000
|
}
|
|
1954
2001
|
/**
|
|
1955
2002
|
* Current position value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
1956
2003
|
* @readonly
|
|
1957
2004
|
*/
|
|
1958
2005
|
get position() {
|
|
1959
|
-
|
|
2006
|
+
var _a, _b;
|
|
2007
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
|
|
1960
2008
|
}
|
|
1961
2009
|
/**
|
|
1962
2010
|
* Current range value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
1963
2011
|
* @readonly
|
|
1964
2012
|
*/
|
|
1965
2013
|
get range() {
|
|
1966
|
-
|
|
2014
|
+
var _a, _b;
|
|
2015
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].range) != null ? _b : [0, 0];
|
|
1967
2016
|
}
|
|
1968
2017
|
/**
|
|
1969
2018
|
* Actual bounce size(px)
|
|
1970
2019
|
* @readonly
|
|
1971
2020
|
*/
|
|
1972
2021
|
get bounce() {
|
|
1973
|
-
|
|
2022
|
+
var _a;
|
|
2023
|
+
return (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].bounce;
|
|
1974
2024
|
}
|
|
1975
2025
|
/**
|
|
1976
2026
|
* Initialize AxesController
|
|
@@ -2023,11 +2073,12 @@
|
|
|
2023
2073
|
* This method destroys the Axes and PanInput instances and removes all event handlers.
|
|
2024
2074
|
*/
|
|
2025
2075
|
destroy() {
|
|
2076
|
+
var _a;
|
|
2026
2077
|
if (this._axes) {
|
|
2027
2078
|
this.removePreventClickHandler();
|
|
2028
2079
|
this._axes.destroy();
|
|
2029
2080
|
}
|
|
2030
|
-
this._panInput
|
|
2081
|
+
(_a = this._panInput) == null ? void 0 : _a.destroy();
|
|
2031
2082
|
this._resetInternalValues();
|
|
2032
2083
|
}
|
|
2033
2084
|
/**
|
|
@@ -2037,7 +2088,8 @@
|
|
|
2037
2088
|
* @returns The current instance for method chaining
|
|
2038
2089
|
*/
|
|
2039
2090
|
enable() {
|
|
2040
|
-
|
|
2091
|
+
var _a;
|
|
2092
|
+
(_a = this._panInput) == null ? void 0 : _a.enable();
|
|
2041
2093
|
return this;
|
|
2042
2094
|
}
|
|
2043
2095
|
/**
|
|
@@ -2047,7 +2099,8 @@
|
|
|
2047
2099
|
* @returns The current instance for method chaining
|
|
2048
2100
|
*/
|
|
2049
2101
|
disable() {
|
|
2050
|
-
|
|
2102
|
+
var _a;
|
|
2103
|
+
(_a = this._panInput) == null ? void 0 : _a.disable();
|
|
2051
2104
|
return this;
|
|
2052
2105
|
}
|
|
2053
2106
|
/**
|
|
@@ -2057,7 +2110,8 @@
|
|
|
2057
2110
|
* @returns The current instance for method chaining
|
|
2058
2111
|
*/
|
|
2059
2112
|
release() {
|
|
2060
|
-
|
|
2113
|
+
var _a;
|
|
2114
|
+
(_a = this._panInput) == null ? void 0 : _a.release();
|
|
2061
2115
|
return this;
|
|
2062
2116
|
}
|
|
2063
2117
|
/**
|
|
@@ -2069,11 +2123,11 @@
|
|
|
2069
2123
|
* @returns The current instance for method chaining
|
|
2070
2124
|
*/
|
|
2071
2125
|
updateAnimation(position, duration) {
|
|
2072
|
-
|
|
2073
|
-
|
|
2126
|
+
var _a;
|
|
2127
|
+
this._animatingContext = __spreadProps(__spreadValues({}, this._animatingContext), {
|
|
2074
2128
|
end: position
|
|
2075
|
-
};
|
|
2076
|
-
this._axes
|
|
2129
|
+
});
|
|
2130
|
+
(_a = this._axes) == null ? void 0 : _a.updateAnimation({
|
|
2077
2131
|
destPos: { [POSITION_KEY]: position },
|
|
2078
2132
|
duration
|
|
2079
2133
|
});
|
|
@@ -2086,7 +2140,8 @@
|
|
|
2086
2140
|
* @returns The current instance for method chaining
|
|
2087
2141
|
*/
|
|
2088
2142
|
stopAnimation() {
|
|
2089
|
-
|
|
2143
|
+
var _a;
|
|
2144
|
+
(_a = this._axes) == null ? void 0 : _a.stopAnimation();
|
|
2090
2145
|
return this;
|
|
2091
2146
|
}
|
|
2092
2147
|
/**
|
|
@@ -2149,6 +2204,7 @@
|
|
|
2149
2204
|
* @returns A Promise which will be resolved after reaching the target position
|
|
2150
2205
|
*/
|
|
2151
2206
|
animateTo(position, duration, axesEvent) {
|
|
2207
|
+
var _a;
|
|
2152
2208
|
const axes = this._axes;
|
|
2153
2209
|
const state = this._stateMachine.state;
|
|
2154
2210
|
if (!axes) {
|
|
@@ -2161,7 +2217,7 @@
|
|
|
2161
2217
|
const flicking = getFlickingAttached(this._flicking);
|
|
2162
2218
|
flicking.camera.lookAt(position);
|
|
2163
2219
|
if (state.targetPanel) {
|
|
2164
|
-
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, axesEvent
|
|
2220
|
+
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_a = axesEvent == null ? void 0 : axesEvent.isTrusted) != null ? _a : false);
|
|
2165
2221
|
}
|
|
2166
2222
|
return Promise.resolve();
|
|
2167
2223
|
}
|
|
@@ -2199,7 +2255,8 @@
|
|
|
2199
2255
|
* Returns the current axes position
|
|
2200
2256
|
*/
|
|
2201
2257
|
getCurrentPosition() {
|
|
2202
|
-
|
|
2258
|
+
var _a, _b;
|
|
2259
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
|
|
2203
2260
|
}
|
|
2204
2261
|
updateDirection() {
|
|
2205
2262
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -2236,7 +2293,8 @@
|
|
|
2236
2293
|
* @readonly
|
|
2237
2294
|
*/
|
|
2238
2295
|
get activeIndex() {
|
|
2239
|
-
|
|
2296
|
+
var _a, _b;
|
|
2297
|
+
return (_b = (_a = this._activePanel) == null ? void 0 : _a.index) != null ? _b : -1;
|
|
2240
2298
|
}
|
|
2241
2299
|
/**
|
|
2242
2300
|
* An active panel
|
|
@@ -2328,7 +2386,7 @@
|
|
|
2328
2386
|
*/
|
|
2329
2387
|
updateAnimation(panel, duration, direction) {
|
|
2330
2388
|
const state = this._controller.state;
|
|
2331
|
-
const position = this._getPosition(panel, direction
|
|
2389
|
+
const position = this._getPosition(panel, direction != null ? direction : DIRECTION.NONE);
|
|
2332
2390
|
state.targetPanel = panel;
|
|
2333
2391
|
this._controller.updateAnimation(position, duration);
|
|
2334
2392
|
return this;
|
|
@@ -2390,10 +2448,12 @@
|
|
|
2390
2448
|
* @throws {@link MovementErrors}
|
|
2391
2449
|
* @returns A Promise which will be resolved after reaching the target panel
|
|
2392
2450
|
*/
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2451
|
+
moveToPanel(_0, _1) {
|
|
2452
|
+
return __async(this, arguments, function* (panel, { duration, direction = DIRECTION.NONE, axesEvent }) {
|
|
2453
|
+
const position = this._getPosition(panel, direction);
|
|
2454
|
+
this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
|
|
2455
|
+
return this._animateToPosition({ position, duration, newActivePanel: panel, axesEvent });
|
|
2456
|
+
});
|
|
2397
2457
|
}
|
|
2398
2458
|
/**
|
|
2399
2459
|
* @internal
|
|
@@ -2401,6 +2461,7 @@
|
|
|
2401
2461
|
* Sets the active panel and triggers {@link ChangedEvent} or {@link RestoredEvent} based on whether the panel changed.
|
|
2402
2462
|
*/
|
|
2403
2463
|
setActive(newActivePanel, prevActivePanel, isTrusted) {
|
|
2464
|
+
var _a;
|
|
2404
2465
|
const flicking = getFlickingAttached(this._flicking);
|
|
2405
2466
|
this._activePanel = newActivePanel;
|
|
2406
2467
|
this._nextPanel = null;
|
|
@@ -2410,7 +2471,7 @@
|
|
|
2410
2471
|
new Component.ComponentEvent(EVENTS.CHANGED, {
|
|
2411
2472
|
index: newActivePanel.index,
|
|
2412
2473
|
panel: newActivePanel,
|
|
2413
|
-
prevIndex: prevActivePanel
|
|
2474
|
+
prevIndex: (_a = prevActivePanel == null ? void 0 : prevActivePanel.index) != null ? _a : -1,
|
|
2414
2475
|
prevPanel: prevActivePanel,
|
|
2415
2476
|
isTrusted,
|
|
2416
2477
|
direction: prevActivePanel ? getDirection(prevActivePanel.position, newActivePanel.position) : DIRECTION.NONE
|
|
@@ -2440,6 +2501,7 @@
|
|
|
2440
2501
|
* Triggers {@link WillChangeEvent} or {@link WillRestoreEvent} based on whether the target panel differs from the active panel.
|
|
2441
2502
|
*/
|
|
2442
2503
|
_triggerIndexChangeEvent(panel, position, axesEvent, direction) {
|
|
2504
|
+
var _a;
|
|
2443
2505
|
const flicking = getFlickingAttached(this._flicking);
|
|
2444
2506
|
const triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
|
|
2445
2507
|
const camera = flicking.camera;
|
|
@@ -2447,8 +2509,8 @@
|
|
|
2447
2509
|
const event = new Component.ComponentEvent(triggeringEvent, {
|
|
2448
2510
|
index: panel.index,
|
|
2449
2511
|
panel,
|
|
2450
|
-
isTrusted: axesEvent
|
|
2451
|
-
direction: direction
|
|
2512
|
+
isTrusted: (axesEvent == null ? void 0 : axesEvent.isTrusted) || false,
|
|
2513
|
+
direction: direction != null ? direction : getDirection((_a = activePanel == null ? void 0 : activePanel.position) != null ? _a : camera.position, position)
|
|
2452
2514
|
});
|
|
2453
2515
|
this._nextPanel = panel;
|
|
2454
2516
|
flicking.trigger(event);
|
|
@@ -2461,32 +2523,34 @@
|
|
|
2461
2523
|
* @privateRemarks
|
|
2462
2524
|
* Animates the camera to the target position and handles animation completion or interruption.
|
|
2463
2525
|
*/
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
nextDuration
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2526
|
+
_animateToPosition(_0) {
|
|
2527
|
+
return __async(this, arguments, function* ({
|
|
2528
|
+
position,
|
|
2529
|
+
duration,
|
|
2530
|
+
newActivePanel,
|
|
2531
|
+
axesEvent
|
|
2532
|
+
}) {
|
|
2533
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
2534
|
+
let nextDuration = duration;
|
|
2535
|
+
if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
|
|
2536
|
+
nextDuration = 0;
|
|
2537
|
+
}
|
|
2538
|
+
const animate = () => this._controller.animateTo(position, nextDuration, axesEvent);
|
|
2539
|
+
const state = this._controller.state;
|
|
2540
|
+
state.targetPanel = newActivePanel;
|
|
2541
|
+
if (nextDuration <= 0) {
|
|
2542
|
+
return animate();
|
|
2543
|
+
} else {
|
|
2544
|
+
return animate().then(() => __async(this, null, function* () {
|
|
2545
|
+
if (flicking.initialized) {
|
|
2546
|
+
yield flicking.renderer.render();
|
|
2547
|
+
}
|
|
2548
|
+
})).catch((err) => {
|
|
2549
|
+
if (axesEvent && err instanceof FlickingError && err.code === CODE.ANIMATION_INTERRUPTED) return;
|
|
2550
|
+
throw err;
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2490
2554
|
}
|
|
2491
2555
|
/**
|
|
2492
2556
|
* @internal
|
|
@@ -2708,6 +2772,7 @@
|
|
|
2708
2772
|
* Finds the adjacent anchor point based on the movement direction.
|
|
2709
2773
|
*/
|
|
2710
2774
|
_findAdjacentAnchor(position, posDelta, anchorAtCamera) {
|
|
2775
|
+
var _a;
|
|
2711
2776
|
const flicking = getFlickingAttached(this._flicking);
|
|
2712
2777
|
const camera = flicking.camera;
|
|
2713
2778
|
if (camera.circularEnabled) {
|
|
@@ -2716,7 +2781,7 @@
|
|
|
2716
2781
|
return anchorIncludePosition;
|
|
2717
2782
|
}
|
|
2718
2783
|
}
|
|
2719
|
-
const adjacentAnchor = (posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera))
|
|
2784
|
+
const adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) != null ? _a : anchorAtCamera;
|
|
2720
2785
|
return adjacentAnchor;
|
|
2721
2786
|
}
|
|
2722
2787
|
/**
|
|
@@ -2772,13 +2837,14 @@
|
|
|
2772
2837
|
* @returns The current instance for method chaining
|
|
2773
2838
|
*/
|
|
2774
2839
|
updateInput() {
|
|
2840
|
+
var _a;
|
|
2775
2841
|
const flicking = getFlickingAttached(this._flicking);
|
|
2776
2842
|
const camera = flicking.camera;
|
|
2777
2843
|
const renderer = flicking.renderer;
|
|
2778
2844
|
const controller = this._controller;
|
|
2779
2845
|
const controlParams = camera.controlParams;
|
|
2780
2846
|
const count = this._count;
|
|
2781
|
-
const activePanel = controller.state.animating ? camera.findNearestAnchor(camera.position)
|
|
2847
|
+
const activePanel = controller.state.animating ? (_a = camera.findNearestAnchor(camera.position)) == null ? void 0 : _a.panel : this._activePanel;
|
|
2782
2848
|
if (!activePanel) {
|
|
2783
2849
|
controller.update(controlParams);
|
|
2784
2850
|
this._resetIndexRange();
|
|
@@ -2826,12 +2892,14 @@
|
|
|
2826
2892
|
};
|
|
2827
2893
|
return this;
|
|
2828
2894
|
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2895
|
+
moveToPanel(panel, options) {
|
|
2896
|
+
return __async(this, null, function* () {
|
|
2897
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
2898
|
+
const camera = flicking.camera;
|
|
2899
|
+
const controller = this._controller;
|
|
2900
|
+
controller.update(camera.controlParams);
|
|
2901
|
+
return __superGet(StrictControl.prototype, this, "moveToPanel").call(this, panel, options);
|
|
2902
|
+
});
|
|
2835
2903
|
}
|
|
2836
2904
|
/**
|
|
2837
2905
|
* Move {@link Camera} to the given position
|
|
@@ -2845,9 +2913,10 @@
|
|
|
2845
2913
|
* @returns A Promise which will be resolved after reaching the target position
|
|
2846
2914
|
*/
|
|
2847
2915
|
moveToPosition(position, duration, axesEvent) {
|
|
2916
|
+
var _a;
|
|
2848
2917
|
const flicking = getFlickingAttached(this._flicking);
|
|
2849
2918
|
const camera = flicking.camera;
|
|
2850
|
-
const currentPanel = this._nextPanel
|
|
2919
|
+
const currentPanel = (_a = this._nextPanel) != null ? _a : this._activePanel;
|
|
2851
2920
|
const axesRange = this._controller.range;
|
|
2852
2921
|
const indexRange = this._indexRange;
|
|
2853
2922
|
const cameraRange = camera.range;
|
|
@@ -3266,11 +3335,12 @@
|
|
|
3266
3335
|
this._panelClass = val;
|
|
3267
3336
|
}
|
|
3268
3337
|
constructor(flicking, options) {
|
|
3338
|
+
var _a, _b, _c, _d;
|
|
3269
3339
|
this._flicking = flicking;
|
|
3270
|
-
this._renderPanel = options
|
|
3271
|
-
this._initialPanelCount = options
|
|
3272
|
-
this._cache = options
|
|
3273
|
-
this._panelClass = options
|
|
3340
|
+
this._renderPanel = (_a = options == null ? void 0 : options.renderPanel) != null ? _a : (() => "");
|
|
3341
|
+
this._initialPanelCount = (_b = options == null ? void 0 : options.initialPanelCount) != null ? _b : -1;
|
|
3342
|
+
this._cache = (_c = options == null ? void 0 : options.cache) != null ? _c : false;
|
|
3343
|
+
this._panelClass = (_d = options == null ? void 0 : options.panelClass) != null ? _d : CLASS.DEFAULT_VIRTUAL;
|
|
3274
3344
|
this._elements = [];
|
|
3275
3345
|
}
|
|
3276
3346
|
init() {
|
|
@@ -3496,6 +3566,7 @@
|
|
|
3496
3566
|
const prevFirstPanel = panels[0];
|
|
3497
3567
|
const align = parsePanelAlign(this._align);
|
|
3498
3568
|
const allPanelsInserted = items.reduce((addedPanels, item) => {
|
|
3569
|
+
var _a;
|
|
3499
3570
|
const insertingIdx = getMinusCompensatedIndex(item.index, panels.length);
|
|
3500
3571
|
const panelsPushed = panels.slice(insertingIdx);
|
|
3501
3572
|
const panelsInserted = item.elements.map(
|
|
@@ -3503,7 +3574,7 @@
|
|
|
3503
3574
|
);
|
|
3504
3575
|
panels.splice(insertingIdx, 0, ...panelsInserted);
|
|
3505
3576
|
if (item.hasDOMInElements) {
|
|
3506
|
-
this._insertPanelElements(panelsInserted, panelsPushed[0]
|
|
3577
|
+
this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) != null ? _a : null);
|
|
3507
3578
|
}
|
|
3508
3579
|
if (flicking.panelsPerView > 0) {
|
|
3509
3580
|
const firstPanel = prevFirstPanel || panelsInserted[0].resize();
|
|
@@ -3570,6 +3641,7 @@
|
|
|
3570
3641
|
* Updates camera, control, and triggers {@link PanelChangeEvent} after panels are added or removed.
|
|
3571
3642
|
*/
|
|
3572
3643
|
updateAfterPanelChange(panelsAdded, panelsRemoved) {
|
|
3644
|
+
var _a;
|
|
3573
3645
|
const flicking = getFlickingAttached(this._flicking);
|
|
3574
3646
|
const { camera, control } = flicking;
|
|
3575
3647
|
const panels = this._panels;
|
|
@@ -3593,7 +3665,7 @@
|
|
|
3593
3665
|
if (panels.length <= 0) {
|
|
3594
3666
|
camera.lookAt(0);
|
|
3595
3667
|
} else {
|
|
3596
|
-
let targetIndex = activePanel
|
|
3668
|
+
let targetIndex = (_a = activePanel == null ? void 0 : activePanel.index) != null ? _a : 0;
|
|
3597
3669
|
if (targetIndex > panels.length - 1) {
|
|
3598
3670
|
targetIndex = panels.length - 1;
|
|
3599
3671
|
}
|
|
@@ -3723,11 +3795,10 @@
|
|
|
3723
3795
|
const gap = referencePanel.margin.prev + referencePanel.margin.next;
|
|
3724
3796
|
const panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
|
|
3725
3797
|
const panelSizeObj = flicking.horizontal ? { width: panelSize } : { height: panelSize };
|
|
3726
|
-
const firstPanelSizeObj = {
|
|
3798
|
+
const firstPanelSizeObj = __spreadValues({
|
|
3727
3799
|
size: panelSize,
|
|
3728
|
-
margin: referencePanel.margin
|
|
3729
|
-
|
|
3730
|
-
};
|
|
3800
|
+
margin: referencePanel.margin
|
|
3801
|
+
}, !flicking.horizontal && { height: referencePanel.height });
|
|
3731
3802
|
if (!flicking.noPanelStyleOverride) {
|
|
3732
3803
|
this._strategy.updatePanelSizes(flicking, panelSizeObj);
|
|
3733
3804
|
}
|
|
@@ -3754,7 +3825,7 @@
|
|
|
3754
3825
|
const flicking = getFlickingAttached(this._flicking);
|
|
3755
3826
|
const camera = flicking.camera;
|
|
3756
3827
|
const cameraElement = camera.element;
|
|
3757
|
-
const nextSiblingElement = nextSibling
|
|
3828
|
+
const nextSiblingElement = (nextSibling == null ? void 0 : nextSibling.element) || null;
|
|
3758
3829
|
const fragment = document.createDocumentFragment();
|
|
3759
3830
|
panels.forEach((panel) => fragment.appendChild(panel.element));
|
|
3760
3831
|
cameraElement.insertBefore(fragment, nextSiblingElement);
|
|
@@ -3799,13 +3870,15 @@
|
|
|
3799
3870
|
}
|
|
3800
3871
|
class VanillaRenderer extends Renderer$1 {
|
|
3801
3872
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3873
|
+
render() {
|
|
3874
|
+
return __async(this, null, function* () {
|
|
3875
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
3876
|
+
const strategy = this._strategy;
|
|
3877
|
+
strategy.updateRenderingPanels(flicking);
|
|
3878
|
+
strategy.renderPanels(flicking);
|
|
3879
|
+
this._resetPanelElementOrder();
|
|
3880
|
+
this._afterRender();
|
|
3881
|
+
});
|
|
3809
3882
|
}
|
|
3810
3883
|
_collectPanels() {
|
|
3811
3884
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -4077,6 +4150,7 @@
|
|
|
4077
4150
|
* @returns The current instance for method chaining
|
|
4078
4151
|
*/
|
|
4079
4152
|
resize(cached) {
|
|
4153
|
+
var _a;
|
|
4080
4154
|
const el = this.element;
|
|
4081
4155
|
const flicking = this._flicking;
|
|
4082
4156
|
const { horizontal, useFractionalSize } = flicking;
|
|
@@ -4085,8 +4159,8 @@
|
|
|
4085
4159
|
}
|
|
4086
4160
|
if (cached) {
|
|
4087
4161
|
this._size = cached.size;
|
|
4088
|
-
this._margin = {
|
|
4089
|
-
this._height = cached.height
|
|
4162
|
+
this._margin = __spreadValues({}, cached.margin);
|
|
4163
|
+
this._height = (_a = cached.height) != null ? _a : getElementSize({
|
|
4090
4164
|
el,
|
|
4091
4165
|
horizontal: false,
|
|
4092
4166
|
useFractionalSize,
|
|
@@ -4140,7 +4214,8 @@
|
|
|
4140
4214
|
* @returns A Boolean value indicating the element is inside of this panel {@link Panel.element | element}
|
|
4141
4215
|
*/
|
|
4142
4216
|
contains(element) {
|
|
4143
|
-
|
|
4217
|
+
var _a;
|
|
4218
|
+
return !!((_a = this.element) == null ? void 0 : _a.contains(element));
|
|
4144
4219
|
}
|
|
4145
4220
|
/**
|
|
4146
4221
|
* Reset internal state and set {@link Panel.removed | removed} to `true`
|
|
@@ -4375,10 +4450,9 @@
|
|
|
4375
4450
|
);
|
|
4376
4451
|
}
|
|
4377
4452
|
createPanel(element, options) {
|
|
4378
|
-
return new Panel({
|
|
4379
|
-
...options,
|
|
4453
|
+
return new Panel(__spreadProps(__spreadValues({}, options), {
|
|
4380
4454
|
elementProvider: new this._providerCtor(element)
|
|
4381
|
-
});
|
|
4455
|
+
}));
|
|
4382
4456
|
}
|
|
4383
4457
|
updatePanelSizes(flicking, size) {
|
|
4384
4458
|
flicking.panels.forEach((panel) => panel.setSize(size));
|
|
@@ -4489,7 +4563,7 @@
|
|
|
4489
4563
|
});
|
|
4490
4564
|
if (visiblePanels.length <= 0) return virtualManager.elements.map((_, idx) => idx);
|
|
4491
4565
|
const visibleIndexes = visiblePanels.map((panel) => panel.elementIndex);
|
|
4492
|
-
const invisibleIndexes = virtualManager.elements.map((el, idx) => ({
|
|
4566
|
+
const invisibleIndexes = virtualManager.elements.map((el, idx) => __spreadProps(__spreadValues({}, el), { idx })).filter((el) => !el.visible).map((el) => el.idx);
|
|
4493
4567
|
return [...visibleIndexes, ...invisibleIndexes];
|
|
4494
4568
|
}
|
|
4495
4569
|
getRenderingElementsByOrder(flicking) {
|
|
@@ -4525,10 +4599,9 @@
|
|
|
4525
4599
|
);
|
|
4526
4600
|
}
|
|
4527
4601
|
createPanel(_el, options) {
|
|
4528
|
-
return new VirtualPanel({
|
|
4529
|
-
...options,
|
|
4602
|
+
return new VirtualPanel(__spreadProps(__spreadValues({}, options), {
|
|
4530
4603
|
elementProvider: new VirtualElementProvider(options.flicking)
|
|
4531
|
-
});
|
|
4604
|
+
}));
|
|
4532
4605
|
}
|
|
4533
4606
|
updatePanelSizes(flicking, size) {
|
|
4534
4607
|
flicking.virtual.elements.forEach((el) => {
|
|
@@ -4580,7 +4653,7 @@
|
|
|
4580
4653
|
preventEventsBeforeInit = true,
|
|
4581
4654
|
deceleration = 75e-4,
|
|
4582
4655
|
duration = 500,
|
|
4583
|
-
easing = (x) => 1 - (1 - x
|
|
4656
|
+
easing = (x) => 1 - __pow(1 - x, 3),
|
|
4584
4657
|
inputType = ["mouse", "touch"],
|
|
4585
4658
|
moveType = "snap",
|
|
4586
4659
|
threshold = 40,
|
|
@@ -5435,7 +5508,8 @@
|
|
|
5435
5508
|
* @returns Promise that resolves after reaching the previous panel
|
|
5436
5509
|
*/
|
|
5437
5510
|
prev(duration = this._duration) {
|
|
5438
|
-
|
|
5511
|
+
var _a, _b, _c;
|
|
5512
|
+
return this.moveTo((_c = (_b = (_a = this._control.activePanel) == null ? void 0 : _a.prev()) == null ? void 0 : _b.index) != null ? _c : -1, duration, DIRECTION.PREV);
|
|
5439
5513
|
}
|
|
5440
5514
|
/**
|
|
5441
5515
|
* Move to the next panel (current index + 1).
|
|
@@ -5445,7 +5519,8 @@
|
|
|
5445
5519
|
* @returns Promise that resolves after reaching the next panel
|
|
5446
5520
|
*/
|
|
5447
5521
|
next(duration = this._duration) {
|
|
5448
|
-
|
|
5522
|
+
var _a, _b, _c;
|
|
5523
|
+
return this.moveTo((_c = (_b = (_a = this._control.activePanel) == null ? void 0 : _a.next()) == null ? void 0 : _b.index) != null ? _c : this._renderer.panelCount, duration, DIRECTION.NEXT);
|
|
5449
5524
|
}
|
|
5450
5525
|
/**
|
|
5451
5526
|
* Move to the panel with the given index.
|
|
@@ -5556,6 +5631,7 @@
|
|
|
5556
5631
|
* @returns Status object that can be used with {@link Flicking.setStatus} to restore the state
|
|
5557
5632
|
*/
|
|
5558
5633
|
getStatus(options = {}) {
|
|
5634
|
+
var _a, _b;
|
|
5559
5635
|
const { index = true, position = true, includePanelHTML = false, visiblePanelsOnly = false } = options;
|
|
5560
5636
|
const camera = this._camera;
|
|
5561
5637
|
const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
|
|
@@ -5582,7 +5658,7 @@
|
|
|
5582
5658
|
}
|
|
5583
5659
|
if (visiblePanelsOnly) {
|
|
5584
5660
|
const visiblePanels = this.visiblePanels;
|
|
5585
|
-
status.visibleOffset = visiblePanels[0]
|
|
5661
|
+
status.visibleOffset = (_b = (_a = visiblePanels[0]) == null ? void 0 : _a.index) != null ? _b : 0;
|
|
5586
5662
|
}
|
|
5587
5663
|
return status;
|
|
5588
5664
|
}
|
|
@@ -5592,13 +5668,14 @@
|
|
|
5592
5668
|
* @throws {@link StatusRestoreErrors}
|
|
5593
5669
|
*/
|
|
5594
5670
|
setStatus(status) {
|
|
5671
|
+
var _a;
|
|
5595
5672
|
if (!this._initialized) {
|
|
5596
5673
|
throw new FlickingError(MESSAGE.NOT_INITIALIZED, CODE.NOT_INITIALIZED);
|
|
5597
5674
|
}
|
|
5598
5675
|
const { index, position, visibleOffset, panels } = status;
|
|
5599
5676
|
const renderer = this._renderer;
|
|
5600
5677
|
const control = this._control;
|
|
5601
|
-
if (panels[0]
|
|
5678
|
+
if (((_a = panels[0]) == null ? void 0 : _a.html) && !this._renderExternal) {
|
|
5602
5679
|
renderer.batchRemove({
|
|
5603
5680
|
index: 0,
|
|
5604
5681
|
deleteCount: this.panels.length,
|
|
@@ -5660,78 +5737,80 @@
|
|
|
5660
5737
|
* @fires {@link ResizeEvents}
|
|
5661
5738
|
* @returns Promise that resolves when resize is complete
|
|
5662
5739
|
*/
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
if (this._isResizing) {
|
|
5668
|
-
this._scheduleResize = true;
|
|
5669
|
-
return;
|
|
5670
|
-
}
|
|
5671
|
-
this._scheduleResize = false;
|
|
5672
|
-
this._isResizing = true;
|
|
5673
|
-
const viewport = this._viewport;
|
|
5674
|
-
const renderer = this._renderer;
|
|
5675
|
-
const camera = this._camera;
|
|
5676
|
-
const control = this._control;
|
|
5677
|
-
const activePanel = control.activePanel;
|
|
5678
|
-
const prevWidth = viewport.width;
|
|
5679
|
-
const prevHeight = viewport.height;
|
|
5680
|
-
const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
|
|
5681
|
-
this.trigger(
|
|
5682
|
-
new Component.ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
5683
|
-
width: prevWidth,
|
|
5684
|
-
height: prevHeight,
|
|
5685
|
-
element: viewport.element
|
|
5686
|
-
})
|
|
5687
|
-
);
|
|
5688
|
-
viewport.resize();
|
|
5689
|
-
if (this._optimizeSizeUpdate) {
|
|
5690
|
-
if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
|
|
5691
|
-
await renderer.forceRenderAllPanels();
|
|
5740
|
+
resize() {
|
|
5741
|
+
return __async(this, null, function* () {
|
|
5742
|
+
if (!this._initialized) {
|
|
5743
|
+
return;
|
|
5692
5744
|
}
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
}
|
|
5710
|
-
if (control.animating) ;
|
|
5711
|
-
else {
|
|
5712
|
-
control.updatePosition(prevProgressInPanel);
|
|
5713
|
-
control.updateInput();
|
|
5714
|
-
}
|
|
5715
|
-
const newWidth = viewport.width;
|
|
5716
|
-
const newHeight = viewport.height;
|
|
5717
|
-
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
5718
|
-
this.trigger(
|
|
5719
|
-
new Component.ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
5720
|
-
width: viewport.width,
|
|
5721
|
-
height: viewport.height,
|
|
5722
|
-
prev: {
|
|
5745
|
+
if (this._isResizing) {
|
|
5746
|
+
this._scheduleResize = true;
|
|
5747
|
+
return;
|
|
5748
|
+
}
|
|
5749
|
+
this._scheduleResize = false;
|
|
5750
|
+
this._isResizing = true;
|
|
5751
|
+
const viewport = this._viewport;
|
|
5752
|
+
const renderer = this._renderer;
|
|
5753
|
+
const camera = this._camera;
|
|
5754
|
+
const control = this._control;
|
|
5755
|
+
const activePanel = control.activePanel;
|
|
5756
|
+
const prevWidth = viewport.width;
|
|
5757
|
+
const prevHeight = viewport.height;
|
|
5758
|
+
const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
|
|
5759
|
+
this.trigger(
|
|
5760
|
+
new Component.ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
5723
5761
|
width: prevWidth,
|
|
5724
|
-
height: prevHeight
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5762
|
+
height: prevHeight,
|
|
5763
|
+
element: viewport.element
|
|
5764
|
+
})
|
|
5765
|
+
);
|
|
5766
|
+
viewport.resize();
|
|
5767
|
+
if (this._optimizeSizeUpdate) {
|
|
5768
|
+
if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
|
|
5769
|
+
yield renderer.forceRenderAllPanels();
|
|
5770
|
+
}
|
|
5771
|
+
} else {
|
|
5772
|
+
yield renderer.forceRenderAllPanels();
|
|
5773
|
+
}
|
|
5774
|
+
if (!this._initialized) {
|
|
5775
|
+
return;
|
|
5776
|
+
}
|
|
5777
|
+
renderer.updatePanelSize();
|
|
5778
|
+
camera.updateAlignPos();
|
|
5779
|
+
camera.updateRange();
|
|
5780
|
+
camera.updateAnchors();
|
|
5781
|
+
camera.updateAdaptiveHeight();
|
|
5782
|
+
camera.updatePanelOrder();
|
|
5783
|
+
camera.updateOffset();
|
|
5784
|
+
yield renderer.render();
|
|
5785
|
+
if (!this._initialized) {
|
|
5786
|
+
return;
|
|
5787
|
+
}
|
|
5788
|
+
if (control.animating) ;
|
|
5789
|
+
else {
|
|
5790
|
+
control.updatePosition(prevProgressInPanel);
|
|
5791
|
+
control.updateInput();
|
|
5792
|
+
}
|
|
5793
|
+
const newWidth = viewport.width;
|
|
5794
|
+
const newHeight = viewport.height;
|
|
5795
|
+
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
5796
|
+
this.trigger(
|
|
5797
|
+
new Component.ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
5798
|
+
width: viewport.width,
|
|
5799
|
+
height: viewport.height,
|
|
5800
|
+
prev: {
|
|
5801
|
+
width: prevWidth,
|
|
5802
|
+
height: prevHeight
|
|
5803
|
+
},
|
|
5804
|
+
sizeChanged,
|
|
5805
|
+
element: viewport.element
|
|
5806
|
+
})
|
|
5807
|
+
);
|
|
5808
|
+
this._isResizing = false;
|
|
5809
|
+
if (this._scheduleResize) {
|
|
5810
|
+
void this.resize();
|
|
5811
|
+
}
|
|
5812
|
+
return;
|
|
5813
|
+
});
|
|
5735
5814
|
}
|
|
5736
5815
|
/**
|
|
5737
5816
|
* Add new panels after the last panel.
|
|
@@ -5820,10 +5899,11 @@
|
|
|
5820
5899
|
* Throws error if moveType is invalid.
|
|
5821
5900
|
*/
|
|
5822
5901
|
_createControl() {
|
|
5902
|
+
var _a;
|
|
5823
5903
|
const moveType = this._moveType;
|
|
5824
5904
|
const moveTypes = Object.keys(MOVE_TYPE).map((key) => MOVE_TYPE[key]);
|
|
5825
5905
|
const moveTypeStr = Array.isArray(moveType) ? moveType[0] : moveType;
|
|
5826
|
-
const moveTypeOptions = Array.isArray(moveType) ? moveType[1]
|
|
5906
|
+
const moveTypeOptions = Array.isArray(moveType) ? (_a = moveType[1]) != null ? _a : {} : {};
|
|
5827
5907
|
if (!includes(moveTypes, moveTypeStr)) {
|
|
5828
5908
|
throw new FlickingError(
|
|
5829
5909
|
MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
|
|
@@ -5876,7 +5956,7 @@
|
|
|
5876
5956
|
*/
|
|
5877
5957
|
_createExternalRenderer() {
|
|
5878
5958
|
const { renderer, rendererOptions } = this._renderExternal;
|
|
5879
|
-
return new renderer({ align: this._align,
|
|
5959
|
+
return new renderer(__spreadValues({ align: this._align }, rendererOptions));
|
|
5880
5960
|
}
|
|
5881
5961
|
/**
|
|
5882
5962
|
* Factory method to create VanillaRenderer for vanilla JavaScript rendering.
|
|
@@ -5967,7 +6047,7 @@
|
|
|
5967
6047
|
);
|
|
5968
6048
|
}
|
|
5969
6049
|
};
|
|
5970
|
-
_Flicking.VERSION = "4.16.
|
|
6050
|
+
_Flicking.VERSION = "4.16.1-beta.0";
|
|
5971
6051
|
let Flicking = _Flicking;
|
|
5972
6052
|
const SIDE_EVENTS = {
|
|
5973
6053
|
HOLD_START: "sideHoldStart",
|
|
@@ -6150,10 +6230,9 @@
|
|
|
6150
6230
|
Object.keys(SIDE_EVENTS).forEach((name) => {
|
|
6151
6231
|
flicking.on(EVENTS[name], (event) => {
|
|
6152
6232
|
this.trigger(
|
|
6153
|
-
new Component.ComponentEvent(SIDE_EVENTS[name], {
|
|
6154
|
-
mainIndex
|
|
6155
|
-
|
|
6156
|
-
})
|
|
6233
|
+
new Component.ComponentEvent(SIDE_EVENTS[name], __spreadValues({
|
|
6234
|
+
mainIndex
|
|
6235
|
+
}, event))
|
|
6157
6236
|
);
|
|
6158
6237
|
});
|
|
6159
6238
|
});
|
|
@@ -6254,12 +6333,11 @@
|
|
|
6254
6333
|
}
|
|
6255
6334
|
_createSideFlicking() {
|
|
6256
6335
|
return this.sideState.map((state, i) => {
|
|
6257
|
-
return new Flicking(this.camera.children[i], {
|
|
6258
|
-
...this.sideOptions,
|
|
6336
|
+
return new Flicking(this.camera.children[i], __spreadProps(__spreadValues({}, this.sideOptions), {
|
|
6259
6337
|
horizontal: false,
|
|
6260
6338
|
panelsPerView: 1,
|
|
6261
6339
|
defaultIndex: state.start
|
|
6262
|
-
});
|
|
6340
|
+
}));
|
|
6263
6341
|
});
|
|
6264
6342
|
}
|
|
6265
6343
|
}
|
|
@@ -6421,13 +6499,15 @@
|
|
|
6421
6499
|
const getterDescriptor = {};
|
|
6422
6500
|
if (descriptor.get) {
|
|
6423
6501
|
getterDescriptor.get = function() {
|
|
6502
|
+
var _a;
|
|
6424
6503
|
const flicking = this[flickingName];
|
|
6425
|
-
return flicking && descriptor.get
|
|
6504
|
+
return flicking && ((_a = descriptor.get) == null ? void 0 : _a.call(flicking));
|
|
6426
6505
|
};
|
|
6427
6506
|
}
|
|
6428
6507
|
if (descriptor.set) {
|
|
6429
6508
|
getterDescriptor.set = function(...args) {
|
|
6430
|
-
|
|
6509
|
+
var _a;
|
|
6510
|
+
return (_a = descriptor.set) == null ? void 0 : _a.call(this[flickingName], ...args);
|
|
6431
6511
|
};
|
|
6432
6512
|
}
|
|
6433
6513
|
Object.defineProperty(prototype, name, getterDescriptor);
|
|
@@ -6864,12 +6944,13 @@
|
|
|
6864
6944
|
return indexProgress;
|
|
6865
6945
|
};
|
|
6866
6946
|
const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps }) => {
|
|
6947
|
+
var _a, _b, _c;
|
|
6867
6948
|
let flicking;
|
|
6868
6949
|
const moveTo = (i) => {
|
|
6869
6950
|
if (flicking == null) {
|
|
6870
6951
|
return Promise.reject(new Error("Flicking instance is not available"));
|
|
6871
6952
|
}
|
|
6872
|
-
if (flicking
|
|
6953
|
+
if (flicking == null ? void 0 : flicking.animating) {
|
|
6873
6954
|
return Promise.resolve();
|
|
6874
6955
|
}
|
|
6875
6956
|
return flicking.moveTo(i);
|
|
@@ -6877,12 +6958,12 @@
|
|
|
6877
6958
|
setMethods(["moveTo"]);
|
|
6878
6959
|
const options = getProps().options;
|
|
6879
6960
|
const reactiveObj = reactive({
|
|
6880
|
-
isReachStart: options
|
|
6881
|
-
isReachEnd: options
|
|
6882
|
-
totalPanelCount: options
|
|
6883
|
-
currentPanelIndex: options
|
|
6961
|
+
isReachStart: (options == null ? void 0 : options.defaultIndex) ? (options == null ? void 0 : options.defaultIndex) === 0 : true,
|
|
6962
|
+
isReachEnd: (options == null ? void 0 : options.totalPanelCount) && (options == null ? void 0 : options.defaultIndex) ? options.defaultIndex === options.totalPanelCount - 1 : false,
|
|
6963
|
+
totalPanelCount: (_a = options == null ? void 0 : options.totalPanelCount) != null ? _a : 0,
|
|
6964
|
+
currentPanelIndex: (_b = options == null ? void 0 : options.defaultIndex) != null ? _b : 0,
|
|
6884
6965
|
progress: 0,
|
|
6885
|
-
indexProgress: options
|
|
6966
|
+
indexProgress: (_c = options == null ? void 0 : options.defaultIndex) != null ? _c : 0,
|
|
6886
6967
|
moveTo
|
|
6887
6968
|
});
|
|
6888
6969
|
const onChanged = () => {
|
|
@@ -6909,14 +6990,14 @@
|
|
|
6909
6990
|
reactiveObj.currentPanelIndex = getCurrentPanelIndex(flicking);
|
|
6910
6991
|
reactiveObj.progress = getProgress(flicking);
|
|
6911
6992
|
reactiveObj.totalPanelCount = getTotalPanelCount(flicking);
|
|
6912
|
-
flicking
|
|
6913
|
-
flicking
|
|
6914
|
-
flicking
|
|
6993
|
+
flicking == null ? void 0 : flicking.on("changed", onChanged);
|
|
6994
|
+
flicking == null ? void 0 : flicking.on("panelChange", onPanelChange);
|
|
6995
|
+
flicking == null ? void 0 : flicking.on("move", onMove);
|
|
6915
6996
|
});
|
|
6916
6997
|
onDestroy(() => {
|
|
6917
|
-
flicking
|
|
6918
|
-
flicking
|
|
6919
|
-
flicking
|
|
6998
|
+
flicking == null ? void 0 : flicking.off("changed", onChanged);
|
|
6999
|
+
flicking == null ? void 0 : flicking.off("panelChange", onPanelChange);
|
|
7000
|
+
flicking == null ? void 0 : flicking.off("move", onMove);
|
|
6920
7001
|
});
|
|
6921
7002
|
return reactiveObj;
|
|
6922
7003
|
};
|
|
@@ -6932,7 +7013,7 @@
|
|
|
6932
7013
|
connectFlickingReactiveAPI,
|
|
6933
7014
|
flickingReactiveAPIAdapter
|
|
6934
7015
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6935
|
-
const Constants = {
|
|
7016
|
+
const Constants = __spreadValues(__spreadValues({}, Events), Values);
|
|
6936
7017
|
merge(Flicking, Core);
|
|
6937
7018
|
merge(Flicking, Camera);
|
|
6938
7019
|
merge(Flicking, Control);
|