@egjs/react-flicking 4.11.3-beta.2 → 4.11.3-beta.3
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/Flicking.d.ts +41 -41
- package/declaration/NonStrictPanel.d.ts +12 -12
- package/declaration/ReactElementProvider.d.ts +12 -12
- package/declaration/ReactRenderer.d.ts +16 -17
- package/declaration/StrictPanel.d.ts +14 -14
- package/declaration/ViewportSlot.d.ts +5 -5
- package/declaration/consts.d.ts +2 -2
- package/declaration/index.d.ts +6 -6
- package/declaration/index.umd.d.ts +2 -2
- package/declaration/types.d.ts +32 -32
- package/dist/flicking.cjs.js +183 -55
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +183 -55
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.umd.js +183 -55
- package/dist/flicking.umd.js.map +1 -1
- package/package.json +2 -2
- package/dist/flicking.js +0 -9221
- package/dist/flicking.js.map +0 -1
- package/dist/flicking.min.js +0 -10
- package/dist/flicking.min.js.map +0 -1
- package/dist/flicking.pkgd.js +0 -14483
- package/dist/flicking.pkgd.js.map +0 -1
- package/dist/flicking.pkgd.min.js +0 -10
- package/dist/flicking.pkgd.min.js.map +0 -1
package/dist/flicking.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ name: @egjs/react-flicking
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking/tree/master/packages/react-flicking
|
|
7
|
-
version: 4.
|
|
7
|
+
version: 4.10.3-beta.0
|
|
8
8
|
*/
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import React__default from 'react';
|
|
@@ -14,7 +14,7 @@ import VanillaFlicking__default, { getFlickingAttached, ExternalRenderer, Virtua
|
|
|
14
14
|
export * from '@egjs/flicking';
|
|
15
15
|
import { findDOMNode } from 'react-dom';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/*! *****************************************************************************
|
|
18
18
|
Copyright (c) Microsoft Corporation.
|
|
19
19
|
|
|
20
20
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -28,8 +28,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
28
28
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
29
29
|
PERFORMANCE OF THIS SOFTWARE.
|
|
30
30
|
***************************************************************************** */
|
|
31
|
-
/* global Reflect, Promise */
|
|
32
31
|
|
|
32
|
+
/* global Reflect, Promise */
|
|
33
33
|
var extendStatics = function (d, b) {
|
|
34
34
|
extendStatics = Object.setPrototypeOf || {
|
|
35
35
|
__proto__: []
|
|
@@ -38,29 +38,38 @@ var extendStatics = function (d, b) {
|
|
|
38
38
|
} || function (d, b) {
|
|
39
39
|
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
40
40
|
};
|
|
41
|
+
|
|
41
42
|
return extendStatics(d, b);
|
|
42
43
|
};
|
|
44
|
+
|
|
43
45
|
function __extends(d, b) {
|
|
44
46
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
45
47
|
extendStatics(d, b);
|
|
48
|
+
|
|
46
49
|
function __() {
|
|
47
50
|
this.constructor = d;
|
|
48
51
|
}
|
|
52
|
+
|
|
49
53
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
50
54
|
}
|
|
51
55
|
var __assign = function () {
|
|
52
56
|
__assign = Object.assign || function __assign(t) {
|
|
53
57
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
54
58
|
s = arguments[i];
|
|
59
|
+
|
|
55
60
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
56
61
|
}
|
|
62
|
+
|
|
57
63
|
return t;
|
|
58
64
|
};
|
|
65
|
+
|
|
59
66
|
return __assign.apply(this, arguments);
|
|
60
67
|
};
|
|
61
68
|
function __rest(s, e) {
|
|
62
69
|
var t = {};
|
|
70
|
+
|
|
63
71
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
72
|
+
|
|
64
73
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
65
74
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
66
75
|
}
|
|
@@ -68,8 +77,8 @@ function __rest(s, e) {
|
|
|
68
77
|
}
|
|
69
78
|
function __decorate(decorators, target, key, desc) {
|
|
70
79
|
var c = arguments.length,
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
81
|
+
d;
|
|
73
82
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
74
83
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
75
84
|
}
|
|
@@ -79,6 +88,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
79
88
|
resolve(value);
|
|
80
89
|
});
|
|
81
90
|
}
|
|
91
|
+
|
|
82
92
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
83
93
|
function fulfilled(value) {
|
|
84
94
|
try {
|
|
@@ -87,6 +97,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
87
97
|
reject(e);
|
|
88
98
|
}
|
|
89
99
|
}
|
|
100
|
+
|
|
90
101
|
function rejected(value) {
|
|
91
102
|
try {
|
|
92
103
|
step(generator["throw"](value));
|
|
@@ -94,26 +105,28 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
94
105
|
reject(e);
|
|
95
106
|
}
|
|
96
107
|
}
|
|
108
|
+
|
|
97
109
|
function step(result) {
|
|
98
110
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
99
111
|
}
|
|
112
|
+
|
|
100
113
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
101
114
|
});
|
|
102
115
|
}
|
|
103
116
|
function __generator(thisArg, body) {
|
|
104
117
|
var _ = {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
trys: [],
|
|
111
|
-
ops: []
|
|
118
|
+
label: 0,
|
|
119
|
+
sent: function () {
|
|
120
|
+
if (t[0] & 1) throw t[1];
|
|
121
|
+
return t[1];
|
|
112
122
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
trys: [],
|
|
124
|
+
ops: []
|
|
125
|
+
},
|
|
126
|
+
f,
|
|
127
|
+
y,
|
|
128
|
+
t,
|
|
129
|
+
g;
|
|
117
130
|
return g = {
|
|
118
131
|
next: verb(0),
|
|
119
132
|
"throw": verb(1),
|
|
@@ -121,59 +134,78 @@ function __generator(thisArg, body) {
|
|
|
121
134
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
122
135
|
return this;
|
|
123
136
|
}), g;
|
|
137
|
+
|
|
124
138
|
function verb(n) {
|
|
125
139
|
return function (v) {
|
|
126
140
|
return step([n, v]);
|
|
127
141
|
};
|
|
128
142
|
}
|
|
143
|
+
|
|
129
144
|
function step(op) {
|
|
130
145
|
if (f) throw new TypeError("Generator is already executing.");
|
|
131
|
-
|
|
146
|
+
|
|
147
|
+
while (_) try {
|
|
132
148
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
133
149
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
150
|
+
|
|
134
151
|
switch (op[0]) {
|
|
135
152
|
case 0:
|
|
136
153
|
case 1:
|
|
137
154
|
t = op;
|
|
138
155
|
break;
|
|
156
|
+
|
|
139
157
|
case 4:
|
|
140
158
|
_.label++;
|
|
141
159
|
return {
|
|
142
160
|
value: op[1],
|
|
143
161
|
done: false
|
|
144
162
|
};
|
|
163
|
+
|
|
145
164
|
case 5:
|
|
146
165
|
_.label++;
|
|
147
166
|
y = op[1];
|
|
148
167
|
op = [0];
|
|
149
168
|
continue;
|
|
169
|
+
|
|
150
170
|
case 7:
|
|
151
171
|
op = _.ops.pop();
|
|
172
|
+
|
|
152
173
|
_.trys.pop();
|
|
174
|
+
|
|
153
175
|
continue;
|
|
176
|
+
|
|
154
177
|
default:
|
|
155
178
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
156
179
|
_ = 0;
|
|
157
180
|
continue;
|
|
158
181
|
}
|
|
182
|
+
|
|
159
183
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
160
184
|
_.label = op[1];
|
|
161
185
|
break;
|
|
162
186
|
}
|
|
187
|
+
|
|
163
188
|
if (op[0] === 6 && _.label < t[1]) {
|
|
164
189
|
_.label = t[1];
|
|
165
190
|
t = op;
|
|
166
191
|
break;
|
|
167
192
|
}
|
|
193
|
+
|
|
168
194
|
if (t && _.label < t[2]) {
|
|
169
195
|
_.label = t[2];
|
|
196
|
+
|
|
170
197
|
_.ops.push(op);
|
|
198
|
+
|
|
171
199
|
break;
|
|
172
200
|
}
|
|
201
|
+
|
|
173
202
|
if (t[2]) _.ops.pop();
|
|
203
|
+
|
|
174
204
|
_.trys.pop();
|
|
205
|
+
|
|
175
206
|
continue;
|
|
176
207
|
}
|
|
208
|
+
|
|
177
209
|
op = body.call(thisArg, _);
|
|
178
210
|
} catch (e) {
|
|
179
211
|
op = [6, e];
|
|
@@ -181,6 +213,7 @@ function __generator(thisArg, body) {
|
|
|
181
213
|
} finally {
|
|
182
214
|
f = t = 0;
|
|
183
215
|
}
|
|
216
|
+
|
|
184
217
|
if (op[0] & 5) throw op[1];
|
|
185
218
|
return {
|
|
186
219
|
value: op[0] ? op[1] : void 0,
|
|
@@ -225,19 +258,27 @@ var DEFAULT_PROPS = {
|
|
|
225
258
|
onPanelChange: function (e) {}
|
|
226
259
|
};
|
|
227
260
|
|
|
228
|
-
var ReactRenderer =
|
|
261
|
+
var ReactRenderer =
|
|
262
|
+
/*#__PURE__*/
|
|
263
|
+
function (_super) {
|
|
229
264
|
__extends(ReactRenderer, _super);
|
|
265
|
+
|
|
230
266
|
function ReactRenderer(options) {
|
|
231
267
|
var _this = _super.call(this, options) || this;
|
|
268
|
+
|
|
232
269
|
_this._reactFlicking = options.reactFlicking;
|
|
233
270
|
return _this;
|
|
234
|
-
}
|
|
235
|
-
|
|
271
|
+
} // eslint-disable-next-line @typescript-eslint/require-await
|
|
272
|
+
|
|
273
|
+
|
|
236
274
|
var __proto = ReactRenderer.prototype;
|
|
275
|
+
|
|
237
276
|
__proto.render = function () {
|
|
238
277
|
return __awaiter(this, void 0, void 0, function () {
|
|
239
278
|
var flicking, reactFlicking, strategy;
|
|
279
|
+
|
|
240
280
|
var _this = this;
|
|
281
|
+
|
|
241
282
|
return __generator(this, function (_a) {
|
|
242
283
|
flicking = getFlickingAttached(this._flicking);
|
|
243
284
|
reactFlicking = this._reactFlicking;
|
|
@@ -245,10 +286,11 @@ var ReactRenderer = /*#__PURE__*/function (_super) {
|
|
|
245
286
|
this._rendering = true;
|
|
246
287
|
strategy.updateRenderingPanels(flicking);
|
|
247
288
|
strategy.renderPanels(flicking);
|
|
248
|
-
return [2
|
|
289
|
+
return [2
|
|
290
|
+
/*return*/
|
|
291
|
+
, new Promise(function (resolve) {
|
|
249
292
|
reactFlicking.renderEmitter.once("render", function () {
|
|
250
293
|
_this._rendering = false;
|
|
251
|
-
_this._afterRender();
|
|
252
294
|
resolve();
|
|
253
295
|
});
|
|
254
296
|
reactFlicking.forceUpdate();
|
|
@@ -256,19 +298,28 @@ var ReactRenderer = /*#__PURE__*/function (_super) {
|
|
|
256
298
|
});
|
|
257
299
|
});
|
|
258
300
|
};
|
|
301
|
+
|
|
259
302
|
__proto.forceRenderAllPanels = function () {
|
|
260
303
|
return __awaiter(this, void 0, void 0, function () {
|
|
261
304
|
var reactFlicking;
|
|
305
|
+
|
|
262
306
|
var _this = this;
|
|
307
|
+
|
|
263
308
|
return __generator(this, function (_a) {
|
|
264
309
|
switch (_a.label) {
|
|
265
310
|
case 0:
|
|
266
311
|
reactFlicking = this._reactFlicking;
|
|
267
312
|
this._rendering = true;
|
|
268
|
-
return [4
|
|
313
|
+
return [4
|
|
314
|
+
/*yield*/
|
|
315
|
+
, _super.prototype.forceRenderAllPanels.call(this)];
|
|
316
|
+
|
|
269
317
|
case 1:
|
|
270
318
|
_a.sent();
|
|
271
|
-
|
|
319
|
+
|
|
320
|
+
return [2
|
|
321
|
+
/*return*/
|
|
322
|
+
, new Promise(function (resolve) {
|
|
272
323
|
reactFlicking.renderEmitter.once("render", function () {
|
|
273
324
|
_this._rendering = false;
|
|
274
325
|
resolve();
|
|
@@ -279,30 +330,34 @@ var ReactRenderer = /*#__PURE__*/function (_super) {
|
|
|
279
330
|
});
|
|
280
331
|
});
|
|
281
332
|
};
|
|
282
|
-
|
|
283
|
-
_super.prototype.destroy.call(this);
|
|
284
|
-
this._reactFlicking.renderEmitter.off("render");
|
|
285
|
-
};
|
|
333
|
+
|
|
286
334
|
__proto._collectPanels = function () {
|
|
287
335
|
var flicking = getFlickingAttached(this._flicking);
|
|
288
336
|
var reactFlicking = this._reactFlicking;
|
|
289
337
|
var reactPanels = reactFlicking.reactPanels;
|
|
290
338
|
this._panels = this._strategy.collectPanels(flicking, reactPanels);
|
|
291
339
|
};
|
|
340
|
+
|
|
292
341
|
__proto._createPanel = function (externalComponent, options) {
|
|
293
342
|
return this._strategy.createPanel(externalComponent, options);
|
|
294
343
|
};
|
|
344
|
+
|
|
295
345
|
return ReactRenderer;
|
|
296
346
|
}(ExternalRenderer);
|
|
297
347
|
|
|
298
|
-
var StrictPanel =
|
|
348
|
+
var StrictPanel =
|
|
349
|
+
/*#__PURE__*/
|
|
350
|
+
function (_super) {
|
|
299
351
|
__extends(StrictPanel, _super);
|
|
352
|
+
|
|
300
353
|
function StrictPanel() {
|
|
301
354
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
355
|
+
|
|
302
356
|
_this._hide = false;
|
|
303
357
|
_this._elRef = React.createRef();
|
|
304
358
|
return _this;
|
|
305
359
|
}
|
|
360
|
+
|
|
306
361
|
var __proto = StrictPanel.prototype;
|
|
307
362
|
Object.defineProperty(__proto, "nativeElement", {
|
|
308
363
|
get: function () {
|
|
@@ -318,30 +373,40 @@ var StrictPanel = /*#__PURE__*/function (_super) {
|
|
|
318
373
|
enumerable: false,
|
|
319
374
|
configurable: true
|
|
320
375
|
});
|
|
376
|
+
|
|
321
377
|
__proto.render = function () {
|
|
322
378
|
return this._hide ? React.createElement(React.Fragment, null) : this._getElement();
|
|
323
379
|
};
|
|
380
|
+
|
|
324
381
|
__proto.show = function () {
|
|
325
382
|
this._hide = false;
|
|
326
383
|
};
|
|
384
|
+
|
|
327
385
|
__proto.hide = function () {
|
|
328
386
|
this._hide = true;
|
|
329
387
|
};
|
|
388
|
+
|
|
330
389
|
__proto._getElement = function () {
|
|
331
390
|
return React.cloneElement(React.Children.only(this.props.children), {
|
|
332
391
|
ref: this._elRef
|
|
333
392
|
});
|
|
334
393
|
};
|
|
394
|
+
|
|
335
395
|
return StrictPanel;
|
|
336
396
|
}(React.Component);
|
|
337
397
|
|
|
338
|
-
var NonStrictPanel =
|
|
398
|
+
var NonStrictPanel =
|
|
399
|
+
/*#__PURE__*/
|
|
400
|
+
function (_super) {
|
|
339
401
|
__extends(NonStrictPanel, _super);
|
|
402
|
+
|
|
340
403
|
function NonStrictPanel() {
|
|
341
404
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
405
|
+
|
|
342
406
|
_this._hide = false;
|
|
343
407
|
return _this;
|
|
344
408
|
}
|
|
409
|
+
|
|
345
410
|
var __proto = NonStrictPanel.prototype;
|
|
346
411
|
Object.defineProperty(__proto, "nativeElement", {
|
|
347
412
|
get: function () {
|
|
@@ -357,30 +422,37 @@ var NonStrictPanel = /*#__PURE__*/function (_super) {
|
|
|
357
422
|
enumerable: false,
|
|
358
423
|
configurable: true
|
|
359
424
|
});
|
|
425
|
+
|
|
360
426
|
__proto.render = function () {
|
|
361
427
|
return this._hide ? React.createElement(React.Fragment, null) : this.props.children;
|
|
362
428
|
};
|
|
429
|
+
|
|
363
430
|
__proto.show = function () {
|
|
364
431
|
this._hide = false;
|
|
365
432
|
};
|
|
433
|
+
|
|
366
434
|
__proto.hide = function () {
|
|
367
435
|
this._hide = true;
|
|
368
436
|
};
|
|
437
|
+
|
|
369
438
|
return NonStrictPanel;
|
|
370
439
|
}(React.Component);
|
|
371
440
|
|
|
372
|
-
/*
|
|
373
|
-
* Copyright (c) 2015 NAVER Corp.
|
|
374
|
-
* egjs projects are licensed under the MIT license
|
|
441
|
+
/*
|
|
442
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
443
|
+
* egjs projects are licensed under the MIT license
|
|
375
444
|
*/
|
|
376
445
|
var ViewportSlot = React__default.memo(function (props) {
|
|
377
446
|
return React__default.createElement(React__default.Fragment, null, props.children);
|
|
378
447
|
});
|
|
379
448
|
|
|
380
|
-
var ReactElementProvider =
|
|
449
|
+
var ReactElementProvider =
|
|
450
|
+
/*#__PURE__*/
|
|
451
|
+
function () {
|
|
381
452
|
function ReactElementProvider(el) {
|
|
382
453
|
this._el = el;
|
|
383
454
|
}
|
|
455
|
+
|
|
384
456
|
var __proto = ReactElementProvider.prototype;
|
|
385
457
|
Object.defineProperty(__proto, "element", {
|
|
386
458
|
get: function () {
|
|
@@ -396,26 +468,36 @@ var ReactElementProvider = /*#__PURE__*/function () {
|
|
|
396
468
|
enumerable: false,
|
|
397
469
|
configurable: true
|
|
398
470
|
});
|
|
471
|
+
|
|
399
472
|
__proto.show = function () {
|
|
400
473
|
this._el.show();
|
|
401
474
|
};
|
|
475
|
+
|
|
402
476
|
__proto.hide = function () {
|
|
403
477
|
this._el.hide();
|
|
404
478
|
};
|
|
479
|
+
|
|
405
480
|
return ReactElementProvider;
|
|
406
481
|
}();
|
|
407
482
|
|
|
408
|
-
var Flicking =
|
|
483
|
+
var Flicking =
|
|
484
|
+
/*#__PURE__*/
|
|
485
|
+
function (_super) {
|
|
409
486
|
__extends(Flicking, _super);
|
|
487
|
+
|
|
410
488
|
function Flicking(props) {
|
|
411
489
|
var _this = _super.call(this, props) || this;
|
|
490
|
+
|
|
412
491
|
_this._panels = [];
|
|
413
492
|
_this._renderEmitter = new Component();
|
|
493
|
+
|
|
414
494
|
var children = _this._getChildren();
|
|
495
|
+
|
|
415
496
|
_this._panels = _this._createPanelRefs(props, children);
|
|
416
497
|
_this._prevChildren = children;
|
|
417
498
|
return _this;
|
|
418
499
|
}
|
|
500
|
+
|
|
419
501
|
var __proto = Flicking.prototype;
|
|
420
502
|
Object.defineProperty(__proto, "reactPanels", {
|
|
421
503
|
get: function () {
|
|
@@ -433,6 +515,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
433
515
|
enumerable: false,
|
|
434
516
|
configurable: true
|
|
435
517
|
});
|
|
518
|
+
|
|
436
519
|
__proto.componentDidMount = function () {
|
|
437
520
|
var props = this.props;
|
|
438
521
|
var rendererOptions = {
|
|
@@ -446,103 +529,123 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
446
529
|
externalRenderer: new ReactRenderer(rendererOptions)
|
|
447
530
|
}));
|
|
448
531
|
this._vanillaFlicking = flicking;
|
|
532
|
+
|
|
449
533
|
var children = this._getChildren();
|
|
534
|
+
|
|
450
535
|
this._jsxDiffer = new ListDiffer(children, function (panel) {
|
|
451
536
|
return panel.key;
|
|
452
537
|
});
|
|
453
538
|
this._pluginsDiffer = new ListDiffer();
|
|
454
539
|
this._prevChildren = children;
|
|
540
|
+
|
|
455
541
|
this._bindEvents();
|
|
542
|
+
|
|
456
543
|
this._checkPlugins();
|
|
544
|
+
|
|
457
545
|
if (props.status) {
|
|
458
546
|
flicking.setStatus(props.status);
|
|
459
547
|
}
|
|
460
548
|
};
|
|
549
|
+
|
|
461
550
|
__proto.componentWillUnmount = function () {
|
|
462
551
|
var _a;
|
|
552
|
+
|
|
463
553
|
(_a = this._vanillaFlicking) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
464
554
|
};
|
|
555
|
+
|
|
465
556
|
__proto.shouldComponentUpdate = function (nextProps) {
|
|
466
557
|
var vanillaFlicking = this._vanillaFlicking;
|
|
467
558
|
var prevProps = this.props;
|
|
468
559
|
if (!vanillaFlicking || !vanillaFlicking.initialized) return false;
|
|
560
|
+
|
|
469
561
|
var children = nextProps.children,
|
|
470
|
-
|
|
562
|
+
restProps = __rest(nextProps, ["children"]);
|
|
563
|
+
|
|
471
564
|
for (var key in restProps) {
|
|
472
565
|
if (prevProps[key] !== nextProps[key]) {
|
|
473
566
|
return true;
|
|
474
567
|
}
|
|
475
568
|
}
|
|
569
|
+
|
|
476
570
|
var prevChildren = this._prevChildren;
|
|
571
|
+
|
|
477
572
|
var nextChildren = this._getChildren(children);
|
|
573
|
+
|
|
478
574
|
if (nextProps.renderOnSameKey || !this._hasSameChildren(prevChildren, nextChildren)) return true;
|
|
479
575
|
return false;
|
|
480
576
|
};
|
|
577
|
+
|
|
481
578
|
__proto.beforeRender = function () {
|
|
482
579
|
var vanillaFlicking = this._vanillaFlicking;
|
|
483
580
|
var props = this.props;
|
|
484
|
-
var prevChildren = this._prevChildren;
|
|
485
|
-
// Ignore updates before init, they will be updated after "ready" event's force update
|
|
581
|
+
var prevChildren = this._prevChildren; // Ignore updates before init, they will be updated after "ready" event's force update
|
|
486
582
|
// Also, prevent updates when another update is already queued.
|
|
487
583
|
// This usually happens when render() called twice without calling componentDidMount, like in the case of React.StrictMode.
|
|
584
|
+
|
|
488
585
|
if (!vanillaFlicking || !vanillaFlicking.initialized || this._diffResult) return;
|
|
586
|
+
|
|
489
587
|
var nextChildren = this._getChildren(props.children);
|
|
588
|
+
|
|
490
589
|
if (props.renderOnSameKey || !this._hasSameChildren(prevChildren, nextChildren)) {
|
|
491
590
|
this._panels = this._createPanelRefs(props, nextChildren);
|
|
492
591
|
this._diffResult = this._jsxDiffer.update(nextChildren);
|
|
493
592
|
this._prevChildren = nextChildren;
|
|
494
593
|
}
|
|
495
594
|
};
|
|
595
|
+
|
|
496
596
|
__proto.componentDidUpdate = function () {
|
|
497
597
|
var flicking = this._vanillaFlicking;
|
|
498
598
|
var renderEmitter = this._renderEmitter;
|
|
499
599
|
var diffResult = this._diffResult;
|
|
600
|
+
|
|
500
601
|
this._checkPlugins();
|
|
602
|
+
|
|
501
603
|
renderEmitter.trigger("render");
|
|
502
604
|
flicking.camera.updateOffset();
|
|
503
|
-
// Omit 'virtual', as it can't have any setter
|
|
504
|
-
var _a = this.props;
|
|
505
|
-
_a.virtual;
|
|
506
|
-
var props = __rest(_a, ["virtual"]);
|
|
507
|
-
for (var key in props) {
|
|
508
|
-
if (key in flicking && flicking[key] !== props[key]) {
|
|
509
|
-
flicking[key] = props[key];
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
605
|
if (!diffResult || !flicking.initialized) return;
|
|
513
606
|
sync(flicking, diffResult, this.reactPanels);
|
|
514
607
|
this._diffResult = null;
|
|
515
608
|
};
|
|
609
|
+
|
|
516
610
|
__proto.render = function () {
|
|
517
611
|
var _this = this;
|
|
612
|
+
|
|
518
613
|
var _a, _b;
|
|
614
|
+
|
|
519
615
|
var props = this.props;
|
|
520
616
|
var Viewport = props.viewportTag;
|
|
521
617
|
var Camera = props.cameraTag;
|
|
522
618
|
var attributes = {};
|
|
523
619
|
var flicking = this._vanillaFlicking;
|
|
524
620
|
this.beforeRender();
|
|
621
|
+
|
|
525
622
|
for (var name in props) {
|
|
526
623
|
if (!(name in DEFAULT_PROPS) && !(name in VanillaFlicking__default.prototype)) {
|
|
527
624
|
attributes[name] = props[name];
|
|
528
625
|
}
|
|
529
626
|
}
|
|
627
|
+
|
|
530
628
|
var initialized = flicking && flicking.initialized;
|
|
531
629
|
var viewportClasses = ["flicking-viewport"];
|
|
532
630
|
var cameraClasses = ["flicking-camera"];
|
|
533
631
|
var isHorizontal = flicking ? flicking.horizontal : (_a = props.horizontal) !== null && _a !== void 0 ? _a : true;
|
|
632
|
+
|
|
534
633
|
if (!isHorizontal) {
|
|
535
634
|
viewportClasses.push("vertical");
|
|
536
635
|
}
|
|
636
|
+
|
|
537
637
|
if (props.hideBeforeInit && !initialized) {
|
|
538
638
|
viewportClasses.push("flicking-hidden");
|
|
539
639
|
}
|
|
640
|
+
|
|
540
641
|
if (attributes.className) {
|
|
541
642
|
viewportClasses.push(attributes.className);
|
|
542
643
|
}
|
|
644
|
+
|
|
543
645
|
if (props.cameraClass) {
|
|
544
646
|
cameraClasses.push(props.cameraClass);
|
|
545
647
|
}
|
|
648
|
+
|
|
546
649
|
var cameraProps = !initialized && props.firstPanelSize ? {
|
|
547
650
|
style: {
|
|
548
651
|
transform: getDefaultCameraTransform(this.props.align, this.props.horizontal, this.props.firstPanelSize)
|
|
@@ -558,8 +661,10 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
558
661
|
className: cameraClasses.join(" ")
|
|
559
662
|
}, cameraProps), panels), this._getViewportSlot());
|
|
560
663
|
};
|
|
664
|
+
|
|
561
665
|
__proto._createPanelRefs = function (props, children) {
|
|
562
666
|
var _a;
|
|
667
|
+
|
|
563
668
|
var panelsPerView = (_a = props.panelsPerView) !== null && _a !== void 0 ? _a : -1;
|
|
564
669
|
return panelsPerView > 0 && !!props.virtual ? range(panelsPerView + 1).map(function () {
|
|
565
670
|
return React.createRef();
|
|
@@ -567,8 +672,10 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
567
672
|
return React.createRef();
|
|
568
673
|
});
|
|
569
674
|
};
|
|
675
|
+
|
|
570
676
|
__proto._bindEvents = function () {
|
|
571
677
|
var _this = this;
|
|
678
|
+
|
|
572
679
|
var flicking = this._vanillaFlicking;
|
|
573
680
|
Object.keys(EVENTS).forEach(function (eventKey) {
|
|
574
681
|
var eventName = EVENTS[eventKey];
|
|
@@ -583,13 +690,16 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
583
690
|
_this.forceUpdate();
|
|
584
691
|
});
|
|
585
692
|
};
|
|
693
|
+
|
|
586
694
|
__proto._checkPlugins = function () {
|
|
587
695
|
var flicking = this._vanillaFlicking;
|
|
696
|
+
|
|
588
697
|
var _a = this._pluginsDiffer.update(this.props.plugins),
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
698
|
+
list = _a.list,
|
|
699
|
+
added = _a.added,
|
|
700
|
+
removed = _a.removed,
|
|
701
|
+
prevList = _a.prevList;
|
|
702
|
+
|
|
593
703
|
flicking.addPlugins.apply(flicking, added.map(function (index) {
|
|
594
704
|
return list[index];
|
|
595
705
|
}));
|
|
@@ -597,10 +707,12 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
597
707
|
return prevList[index];
|
|
598
708
|
}));
|
|
599
709
|
};
|
|
710
|
+
|
|
600
711
|
__proto._hasSameChildren = function (prevChildren, nextChildren) {
|
|
601
712
|
if (prevChildren.length !== nextChildren.length || prevChildren.length === 0) return false;
|
|
602
713
|
var same = prevChildren.every(function (child, idx) {
|
|
603
714
|
var nextChild = nextChildren[idx];
|
|
715
|
+
|
|
604
716
|
if (child.key && nextChild.key) {
|
|
605
717
|
return child.key === nextChild.key;
|
|
606
718
|
} else {
|
|
@@ -609,32 +721,40 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
609
721
|
});
|
|
610
722
|
return same;
|
|
611
723
|
};
|
|
724
|
+
|
|
612
725
|
__proto._getChildren = function (children) {
|
|
613
726
|
var _this = this;
|
|
727
|
+
|
|
614
728
|
if (children === void 0) {
|
|
615
729
|
children = this.props.children;
|
|
616
730
|
}
|
|
731
|
+
|
|
617
732
|
return React.Children.toArray(children).filter(function (child) {
|
|
618
733
|
return child.type !== ViewportSlot;
|
|
619
734
|
}).reduce(function (all, child) {
|
|
620
735
|
return __spreadArray(__spreadArray([], all, true), _this._unpackFragment(child), true);
|
|
621
736
|
}, []);
|
|
622
737
|
};
|
|
738
|
+
|
|
623
739
|
__proto._getViewportSlot = function () {
|
|
624
740
|
return React.Children.toArray(this.props.children).filter(function (child) {
|
|
625
741
|
return child.type === ViewportSlot;
|
|
626
742
|
});
|
|
627
743
|
};
|
|
744
|
+
|
|
628
745
|
__proto._unpackFragment = function (child) {
|
|
629
746
|
var _this = this;
|
|
747
|
+
|
|
630
748
|
return this._isFragment(child) ? React.Children.toArray(child.props.children).reduce(function (allChilds, fragChild) {
|
|
631
749
|
return __spreadArray(__spreadArray([], allChilds, true), _this._unpackFragment(fragChild), true);
|
|
632
750
|
}, []) : [child];
|
|
633
751
|
};
|
|
752
|
+
|
|
634
753
|
__proto._getVirtualPanels = function () {
|
|
635
754
|
var _this = this;
|
|
755
|
+
|
|
636
756
|
var _a = this.props.virtual.panelClass,
|
|
637
|
-
|
|
757
|
+
panelClass = _a === void 0 ? "flicking-panel" : _a;
|
|
638
758
|
var panelsPerView = this.props.panelsPerView;
|
|
639
759
|
var flicking = this._vanillaFlicking;
|
|
640
760
|
var initialized = flicking && flicking.initialized;
|
|
@@ -655,9 +775,12 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
655
775
|
});
|
|
656
776
|
});
|
|
657
777
|
};
|
|
778
|
+
|
|
658
779
|
__proto._getPanels = function () {
|
|
659
780
|
var _this = this;
|
|
781
|
+
|
|
660
782
|
var origChildren = this._getChildren();
|
|
783
|
+
|
|
661
784
|
var vanillaFlicking = this._vanillaFlicking;
|
|
662
785
|
var diffResult = this._diffResult;
|
|
663
786
|
var children = vanillaFlicking && vanillaFlicking.initialized ? diffResult ? getRenderingPanels(vanillaFlicking, diffResult) : getRenderingPanels(vanillaFlicking, diff(origChildren, origChildren)) : origChildren;
|
|
@@ -673,20 +796,25 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
673
796
|
}, child);
|
|
674
797
|
});
|
|
675
798
|
};
|
|
799
|
+
|
|
676
800
|
__proto._isFragment = function (child) {
|
|
677
801
|
if (child.type) {
|
|
678
802
|
return child.type === React.Fragment;
|
|
679
803
|
}
|
|
804
|
+
|
|
680
805
|
return child === React.Fragment;
|
|
681
806
|
};
|
|
807
|
+
|
|
682
808
|
Flicking.defaultProps = DEFAULT_PROPS;
|
|
809
|
+
|
|
683
810
|
__decorate([withFlickingMethods], Flicking.prototype, "_vanillaFlicking", void 0);
|
|
811
|
+
|
|
684
812
|
return Flicking;
|
|
685
813
|
}(React.Component);
|
|
686
814
|
|
|
687
|
-
/*
|
|
688
|
-
* Copyright (c) 2015 NAVER Corp.
|
|
689
|
-
* egjs projects are licensed under the MIT license
|
|
815
|
+
/*
|
|
816
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
817
|
+
* egjs projects are licensed under the MIT license
|
|
690
818
|
*/
|
|
691
819
|
|
|
692
820
|
export { ViewportSlot, Flicking as default };
|