@egjs/vue3-flicking 4.3.1 → 4.4.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 +4 -101
- package/declaration/FlickingProps.d.ts +38 -0
- package/declaration/VueElementProvider.d.ts +12 -0
- package/declaration/VuePanel.d.ts +5 -7
- package/declaration/VueRenderer.d.ts +2 -3
- package/declaration/index.d.ts +1 -1
- package/declaration/types.d.ts +44 -0
- package/dist/flicking.cjs.js +296 -282
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +298 -284
- package/dist/flicking.esm.js.map +1 -1
- package/package.json +4 -5
- package/src/Flicking.ts +174 -128
- package/src/FlickingProps.ts +42 -0
- package/src/VueElementProvider.ts +37 -0
- package/src/VuePanel.ts +17 -14
- package/src/VueRenderer.ts +36 -23
- package/src/index.ts +1 -1
- package/src/shims-vue.d.ts +5 -5
- package/src/types.ts +75 -0
- package/declaration/VuePanelComponent.d.ts +0 -6
- package/src/VuePanelComponent.ts +0 -14
package/dist/flicking.esm.js
CHANGED
|
@@ -4,12 +4,12 @@ name: @egjs/vue3-flicking
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking/tree/master/packages/vue3-flicking
|
|
7
|
-
version: 4.3
|
|
7
|
+
version: 4.4.3
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { defineComponent, getCurrentInstance, resolveComponent, h, Fragment } from 'vue';
|
|
10
10
|
import ListDiffer from '@egjs/list-differ';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import Component from '@egjs/component';
|
|
12
|
+
import VanillaFlicking__default, { getFlickingAttached, ExternalRenderer, getRenderingPanels, range, withFlickingMethods, VirtualRenderingStrategy, NormalRenderingStrategy, EVENTS, sync, getDefaultCameraTransform } from '@egjs/flicking';
|
|
13
13
|
export * from '@egjs/flicking';
|
|
14
14
|
|
|
15
15
|
/*! *****************************************************************************
|
|
@@ -63,13 +63,6 @@ var __assign = function () {
|
|
|
63
63
|
|
|
64
64
|
return __assign.apply(this, arguments);
|
|
65
65
|
};
|
|
66
|
-
function __decorate(decorators, target, key, desc) {
|
|
67
|
-
var c = arguments.length,
|
|
68
|
-
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
69
|
-
d;
|
|
70
|
-
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;
|
|
71
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
72
|
-
}
|
|
73
66
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
74
67
|
function adopt(value) {
|
|
75
68
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -209,51 +202,55 @@ function __generator(thisArg, body) {
|
|
|
209
202
|
};
|
|
210
203
|
}
|
|
211
204
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return r;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
var VuePanel =
|
|
223
|
-
/*#__PURE__*/
|
|
224
|
-
function (_super) {
|
|
225
|
-
__extends(VuePanel, _super);
|
|
226
|
-
|
|
227
|
-
function VuePanel() {
|
|
228
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
205
|
+
function __spreadArray(to, from, pack) {
|
|
206
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
207
|
+
if (ar || !(i in from)) {
|
|
208
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
209
|
+
ar[i] = from[i];
|
|
210
|
+
}
|
|
229
211
|
}
|
|
212
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
213
|
+
}
|
|
230
214
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
215
|
+
var FlickingProps = {
|
|
216
|
+
viewportTag: {
|
|
217
|
+
type: String,
|
|
218
|
+
default: "div",
|
|
219
|
+
required: false
|
|
220
|
+
},
|
|
221
|
+
cameraTag: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: "div",
|
|
224
|
+
required: false
|
|
225
|
+
},
|
|
226
|
+
hideBeforeInit: {
|
|
227
|
+
type: Boolean,
|
|
228
|
+
default: false,
|
|
229
|
+
required: false
|
|
230
|
+
},
|
|
231
|
+
firstPanelSize: {
|
|
232
|
+
type: String,
|
|
233
|
+
required: false
|
|
234
|
+
},
|
|
235
|
+
options: {
|
|
236
|
+
type: Object,
|
|
237
|
+
default: function () {
|
|
238
|
+
return {};
|
|
235
239
|
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return
|
|
240
|
+
required: false
|
|
241
|
+
},
|
|
242
|
+
plugins: {
|
|
243
|
+
type: Array,
|
|
244
|
+
default: function () {
|
|
245
|
+
return [];
|
|
242
246
|
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
__proto.markForHide = function () {
|
|
252
|
-
this._externalComponent.hide = true;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
return VuePanel;
|
|
256
|
-
}(ExternalPanel);
|
|
247
|
+
required: false
|
|
248
|
+
},
|
|
249
|
+
status: {
|
|
250
|
+
type: Object,
|
|
251
|
+
required: false
|
|
252
|
+
}
|
|
253
|
+
};
|
|
257
254
|
|
|
258
255
|
var VueRenderer =
|
|
259
256
|
/*#__PURE__*/
|
|
@@ -265,159 +262,206 @@ function (_super) {
|
|
|
265
262
|
|
|
266
263
|
_this._vueFlicking = options.vueFlicking;
|
|
267
264
|
return _this;
|
|
268
|
-
}
|
|
269
|
-
|
|
265
|
+
}
|
|
270
266
|
|
|
271
267
|
var __proto = VueRenderer.prototype;
|
|
272
268
|
|
|
273
269
|
__proto.render = function () {
|
|
274
270
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
|
-
var flicking;
|
|
271
|
+
var flicking, vueFlicking, strategy;
|
|
276
272
|
return __generator(this, function (_a) {
|
|
277
|
-
flicking = this._flicking;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
this._updateRenderingPanels();
|
|
283
|
-
|
|
284
|
-
this._vueFlicking.$forceUpdate();
|
|
285
|
-
|
|
273
|
+
flicking = getFlickingAttached(this._flicking);
|
|
274
|
+
vueFlicking = this._vueFlicking;
|
|
275
|
+
strategy = this._strategy;
|
|
276
|
+
strategy.updateRenderingPanels(flicking);
|
|
277
|
+
strategy.renderPanels(flicking);
|
|
286
278
|
return [2
|
|
287
279
|
/*return*/
|
|
288
|
-
|
|
280
|
+
, new Promise(function (resolve) {
|
|
281
|
+
vueFlicking.renderEmitter.once("render", resolve);
|
|
282
|
+
vueFlicking.$forceUpdate();
|
|
283
|
+
})];
|
|
289
284
|
});
|
|
290
285
|
});
|
|
291
|
-
};
|
|
292
|
-
|
|
286
|
+
};
|
|
293
287
|
|
|
294
288
|
__proto.forceRenderAllPanels = function () {
|
|
295
289
|
return __awaiter(this, void 0, void 0, function () {
|
|
290
|
+
var vueFlicking;
|
|
296
291
|
return __generator(this, function (_a) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
292
|
+
switch (_a.label) {
|
|
293
|
+
case 0:
|
|
294
|
+
vueFlicking = this._vueFlicking;
|
|
295
|
+
return [4
|
|
296
|
+
/*yield*/
|
|
297
|
+
, _super.prototype.forceRenderAllPanels.call(this)];
|
|
298
|
+
|
|
299
|
+
case 1:
|
|
300
|
+
_a.sent();
|
|
301
|
+
|
|
302
|
+
return [2
|
|
303
|
+
/*return*/
|
|
304
|
+
, new Promise(function (resolve) {
|
|
305
|
+
vueFlicking.renderEmitter.once("render", resolve);
|
|
306
|
+
vueFlicking.$forceUpdate();
|
|
307
|
+
})];
|
|
308
|
+
}
|
|
306
309
|
});
|
|
307
310
|
});
|
|
308
311
|
};
|
|
309
312
|
|
|
310
313
|
__proto._collectPanels = function () {
|
|
311
|
-
var
|
|
312
|
-
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
var childRefs = this._vueFlicking.$refs;
|
|
316
|
-
var children = Object.keys(childRefs).map(function (refKey) {
|
|
314
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
315
|
+
var vueFlicking = this._vueFlicking;
|
|
316
|
+
var childRefs = vueFlicking.$refs;
|
|
317
|
+
var vuePanels = Object.keys(childRefs).map(function (refKey) {
|
|
317
318
|
return childRefs[refKey];
|
|
318
319
|
});
|
|
319
|
-
this._panels =
|
|
320
|
-
return new VuePanel({
|
|
321
|
-
flicking: _this._flicking,
|
|
322
|
-
index: index,
|
|
323
|
-
align: align,
|
|
324
|
-
externalComponent: panelComponent
|
|
325
|
-
});
|
|
326
|
-
});
|
|
320
|
+
this._panels = this._strategy.collectPanels(flicking, vuePanels);
|
|
327
321
|
};
|
|
328
322
|
|
|
329
323
|
__proto._createPanel = function (externalComponent, options) {
|
|
330
|
-
return
|
|
331
|
-
externalComponent: externalComponent
|
|
332
|
-
}, options));
|
|
324
|
+
return this._strategy.createPanel(externalComponent, options);
|
|
333
325
|
};
|
|
334
326
|
|
|
335
327
|
return VueRenderer;
|
|
336
328
|
}(ExternalRenderer);
|
|
337
329
|
|
|
338
|
-
|
|
330
|
+
/*
|
|
331
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
332
|
+
* egjs projects are licensed under the MIT license
|
|
333
|
+
*/
|
|
334
|
+
var VuePanel = defineComponent({
|
|
335
|
+
data: function () {
|
|
336
|
+
return {
|
|
337
|
+
hide: false
|
|
338
|
+
};
|
|
339
|
+
},
|
|
340
|
+
render: function () {
|
|
341
|
+
if (this.hide || !this.$slots.default) return;
|
|
342
|
+
return this.$slots.default();
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
var VueElementProvider =
|
|
339
347
|
/*#__PURE__*/
|
|
340
|
-
function (
|
|
341
|
-
|
|
348
|
+
function () {
|
|
349
|
+
function VueElementProvider(el) {
|
|
350
|
+
this._el = el;
|
|
351
|
+
}
|
|
342
352
|
|
|
343
|
-
|
|
344
|
-
|
|
353
|
+
var __proto = VueElementProvider.prototype;
|
|
354
|
+
Object.defineProperty(__proto, "rendered", {
|
|
355
|
+
get: function () {
|
|
356
|
+
return !this._el.hide;
|
|
357
|
+
},
|
|
358
|
+
enumerable: false,
|
|
359
|
+
configurable: true
|
|
360
|
+
});
|
|
361
|
+
Object.defineProperty(__proto, "element", {
|
|
362
|
+
get: function () {
|
|
363
|
+
var el = this._el.$el.nextSibling;
|
|
345
364
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
365
|
+
if (el && el.nodeType === Node.ELEMENT_NODE) {
|
|
366
|
+
this._cachedElement = el;
|
|
367
|
+
}
|
|
349
368
|
|
|
350
|
-
|
|
369
|
+
return this._cachedElement;
|
|
370
|
+
},
|
|
371
|
+
enumerable: false,
|
|
372
|
+
configurable: true
|
|
373
|
+
});
|
|
351
374
|
|
|
352
|
-
__proto.
|
|
353
|
-
|
|
354
|
-
return this.$slots.default();
|
|
375
|
+
__proto.show = function () {
|
|
376
|
+
this._el.hide = false;
|
|
355
377
|
};
|
|
356
378
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
var FlickingProps =
|
|
361
|
-
/*#__PURE__*/
|
|
362
|
-
function () {
|
|
363
|
-
function FlickingProps() {
|
|
364
|
-
this.viewportTag = prop({
|
|
365
|
-
required: false,
|
|
366
|
-
default: "div"
|
|
367
|
-
});
|
|
368
|
-
this.cameraTag = prop({
|
|
369
|
-
required: false,
|
|
370
|
-
default: "div"
|
|
371
|
-
});
|
|
372
|
-
this.hideBeforeInit = prop({
|
|
373
|
-
required: false,
|
|
374
|
-
default: false
|
|
375
|
-
});
|
|
376
|
-
this.firstPanelSize = prop({
|
|
377
|
-
required: false
|
|
378
|
-
});
|
|
379
|
-
this.options = prop({
|
|
380
|
-
required: false,
|
|
381
|
-
default: {}
|
|
382
|
-
});
|
|
383
|
-
this.plugins = prop({
|
|
384
|
-
required: false,
|
|
385
|
-
default: []
|
|
386
|
-
});
|
|
387
|
-
this.status = prop({
|
|
388
|
-
required: false
|
|
389
|
-
});
|
|
390
|
-
}
|
|
379
|
+
__proto.hide = function () {
|
|
380
|
+
this._el.hide = true;
|
|
381
|
+
};
|
|
391
382
|
|
|
392
|
-
return
|
|
383
|
+
return VueElementProvider;
|
|
393
384
|
}();
|
|
394
385
|
|
|
395
|
-
var Flicking =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
386
|
+
var Flicking = defineComponent({
|
|
387
|
+
props: FlickingProps,
|
|
388
|
+
components: {
|
|
389
|
+
Panel: VuePanel
|
|
390
|
+
},
|
|
391
|
+
data: function () {
|
|
392
|
+
return {};
|
|
393
|
+
},
|
|
394
|
+
created: function () {
|
|
395
|
+
var _this = this;
|
|
399
396
|
|
|
400
|
-
|
|
401
|
-
|
|
397
|
+
this.vanillaFlicking = null;
|
|
398
|
+
this.renderEmitter = new Component();
|
|
399
|
+
this.diffResult = null;
|
|
402
400
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
401
|
+
this.getPanels = function () {
|
|
402
|
+
var componentInstance = getCurrentInstance();
|
|
403
|
+
var vueFlicking = componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.ctx;
|
|
404
|
+
var flicking = _this.vanillaFlicking;
|
|
407
405
|
|
|
408
|
-
|
|
406
|
+
var defaultSlots = _this.getSlots();
|
|
409
407
|
|
|
410
|
-
|
|
408
|
+
var diffResult = vueFlicking === null || vueFlicking === void 0 ? void 0 : vueFlicking.diffResult;
|
|
409
|
+
var slots = diffResult ? getRenderingPanels(flicking, diffResult) : defaultSlots;
|
|
410
|
+
var panelComponent = resolveComponent("Panel");
|
|
411
|
+
var panels = slots.map(function (slot, idx) {
|
|
412
|
+
return h(panelComponent, {
|
|
413
|
+
key: slot.key,
|
|
414
|
+
ref: idx.toString()
|
|
415
|
+
}, function () {
|
|
416
|
+
return slot;
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
return panels;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
this.getVirtualPanels = function () {
|
|
423
|
+
var options = _this.options;
|
|
424
|
+
var _a = options.virtual.panelClass,
|
|
425
|
+
panelClass = _a === void 0 ? "flicking-panel" : _a;
|
|
426
|
+
var panelsPerView = options.panelsPerView;
|
|
427
|
+
var flicking = _this.vanillaFlicking;
|
|
428
|
+
var initialized = flicking && flicking.initialized;
|
|
429
|
+
var renderingIndexes = initialized ? flicking.renderer.strategy.getRenderingIndexesByOrder(flicking) : range(panelsPerView + 1);
|
|
430
|
+
var firstPanel = initialized && flicking.panels[0];
|
|
431
|
+
var size = firstPanel ? flicking.horizontal ? {
|
|
432
|
+
width: firstPanel.size
|
|
433
|
+
} : {
|
|
434
|
+
height: firstPanel.size
|
|
435
|
+
} : {};
|
|
436
|
+
return renderingIndexes.map(function (idx) {
|
|
437
|
+
return h("div", {
|
|
438
|
+
key: idx,
|
|
439
|
+
ref: idx.toString(),
|
|
440
|
+
class: panelClass,
|
|
441
|
+
style: size,
|
|
442
|
+
"data-element-index": idx
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
withFlickingMethods(this, "vanillaFlicking");
|
|
448
|
+
},
|
|
449
|
+
mounted: function () {
|
|
411
450
|
var _this = this;
|
|
412
451
|
|
|
452
|
+
var _a;
|
|
453
|
+
|
|
454
|
+
var options = this.options;
|
|
413
455
|
var viewportEl = this.$el;
|
|
414
|
-
var
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
456
|
+
var rendererOptions = {
|
|
457
|
+
vueFlicking: this,
|
|
458
|
+
align: options.align,
|
|
459
|
+
strategy: options.virtual && ((_a = options.panelsPerView) !== null && _a !== void 0 ? _a : -1) > 0 ? new VirtualRenderingStrategy() : new NormalRenderingStrategy({
|
|
460
|
+
providerCtor: VueElementProvider
|
|
461
|
+
})
|
|
462
|
+
};
|
|
463
|
+
var flicking = new VanillaFlicking__default(viewportEl, __assign(__assign({}, options), {
|
|
464
|
+
externalRenderer: new VueRenderer(rendererOptions)
|
|
421
465
|
}));
|
|
422
466
|
this.vanillaFlicking = flicking;
|
|
423
467
|
flicking.once(EVENTS.READY, function () {
|
|
@@ -428,52 +472,45 @@ function (_super) {
|
|
|
428
472
|
return vnode.key;
|
|
429
473
|
});
|
|
430
474
|
this.pluginsDiffer = new ListDiffer();
|
|
431
|
-
|
|
432
|
-
this.
|
|
433
|
-
|
|
434
|
-
this._checkPlugins();
|
|
475
|
+
this.bindEvents();
|
|
476
|
+
this.checkPlugins();
|
|
435
477
|
|
|
436
478
|
if (this.status) {
|
|
437
479
|
flicking.setStatus(this.status);
|
|
438
480
|
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
__proto.beforeDestroy = function () {
|
|
481
|
+
},
|
|
482
|
+
beforeUnmount: function () {
|
|
442
483
|
var _a;
|
|
443
484
|
|
|
444
485
|
(_a = this.vanillaFlicking) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
__proto.updated = function () {
|
|
486
|
+
},
|
|
487
|
+
beforeMount: function () {
|
|
488
|
+
this.fillKeys();
|
|
489
|
+
},
|
|
490
|
+
beforeUpdate: function () {
|
|
491
|
+
this.fillKeys();
|
|
492
|
+
this.diffResult = this.slotDiffer.update(this.getSlots());
|
|
493
|
+
},
|
|
494
|
+
updated: function () {
|
|
456
495
|
var flicking = this.vanillaFlicking;
|
|
457
496
|
var diffResult = this.diffResult;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
497
|
+
this.checkPlugins();
|
|
498
|
+
this.renderEmitter.trigger("render");
|
|
499
|
+
if (!diffResult || !(flicking === null || flicking === void 0 ? void 0 : flicking.initialized)) return;
|
|
500
|
+
var children = this.getChildren();
|
|
462
501
|
sync(flicking, diffResult, children);
|
|
463
502
|
|
|
464
|
-
this._checkPlugins();
|
|
465
|
-
|
|
466
503
|
if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
|
|
467
504
|
this.$forceUpdate();
|
|
468
505
|
}
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
__proto.render = function () {
|
|
472
|
-
var _this = this;
|
|
473
506
|
|
|
507
|
+
this.diffResult = undefined;
|
|
508
|
+
},
|
|
509
|
+
render: function () {
|
|
474
510
|
var _a;
|
|
475
511
|
|
|
476
512
|
var flicking = this.vanillaFlicking;
|
|
513
|
+
var options = this.options;
|
|
477
514
|
var initialized = flicking && flicking.initialized;
|
|
478
515
|
var isHorizontal = flicking ? flicking.horizontal : (_a = this.options.horizontal) !== null && _a !== void 0 ? _a : true;
|
|
479
516
|
var viewportData = {
|
|
@@ -491,111 +528,88 @@ function (_super) {
|
|
|
491
528
|
transform: getDefaultCameraTransform(this.options.align, this.options.horizontal, this.firstPanelSize)
|
|
492
529
|
} : {}
|
|
493
530
|
};
|
|
494
|
-
|
|
495
|
-
var getPanels = function () {
|
|
496
|
-
var defaultSlots = _this.getSlots();
|
|
497
|
-
|
|
498
|
-
_this.diffResult = initialized ? _this.slotDiffer.update(defaultSlots) : undefined;
|
|
499
|
-
var slots = _this.diffResult ? getRenderingPanels(flicking, _this.diffResult) : defaultSlots;
|
|
500
|
-
var panelComponent = resolveComponent("Panel");
|
|
501
|
-
var panels = slots.map(function (slot, idx) {
|
|
502
|
-
return h(panelComponent, {
|
|
503
|
-
key: slot.key,
|
|
504
|
-
ref: idx.toString()
|
|
505
|
-
}, function () {
|
|
506
|
-
return slot;
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
return panels;
|
|
510
|
-
};
|
|
511
|
-
|
|
531
|
+
var panels = options.virtual && options.panelsPerView && options.panelsPerView > 0 ? this.getVirtualPanels : this.getPanels;
|
|
512
532
|
var viewportSlots = this.$slots.viewport ? this.$slots.viewport() : [];
|
|
513
|
-
return h(this.viewportTag, viewportData,
|
|
514
|
-
default:
|
|
515
|
-
})], viewportSlots));
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
533
|
+
return h(this.viewportTag, viewportData, __spreadArray([h(this.cameraTag, cameraData, {
|
|
534
|
+
default: panels
|
|
535
|
+
})], viewportSlots, true));
|
|
536
|
+
},
|
|
537
|
+
methods: {
|
|
538
|
+
getSlots: function () {
|
|
539
|
+
var _this = this;
|
|
540
|
+
|
|
541
|
+
var slots = this.$slots.default ? this.$slots.default() : [];
|
|
542
|
+
return slots.reduce(function (elementSlots, slot) {
|
|
543
|
+
return __spreadArray(__spreadArray([], elementSlots, true), _this.getElementVNodes(slot), true);
|
|
544
|
+
}, []);
|
|
545
|
+
},
|
|
546
|
+
getElementVNodes: function (slot, childSlots) {
|
|
547
|
+
var _this = this;
|
|
520
548
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}, []);
|
|
525
|
-
};
|
|
549
|
+
if (childSlots === void 0) {
|
|
550
|
+
childSlots = [];
|
|
551
|
+
}
|
|
526
552
|
|
|
527
|
-
|
|
528
|
-
|
|
553
|
+
if (slot.type === Fragment && Array.isArray(slot.children)) {
|
|
554
|
+
slot.children.filter(function (child) {
|
|
555
|
+
return child && typeof child === "object";
|
|
556
|
+
}).forEach(function (child) {
|
|
557
|
+
return _this.getElementVNodes(child, childSlots);
|
|
558
|
+
});
|
|
559
|
+
} else {
|
|
560
|
+
childSlots.push(slot);
|
|
561
|
+
}
|
|
529
562
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
563
|
+
return childSlots;
|
|
564
|
+
},
|
|
565
|
+
bindEvents: function () {
|
|
566
|
+
var _this = this;
|
|
533
567
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return
|
|
537
|
-
}).forEach(function (child) {
|
|
538
|
-
return _this.getElementVNodes(child, childSlots);
|
|
568
|
+
var flicking = this.vanillaFlicking;
|
|
569
|
+
var events = Object.keys(EVENTS).map(function (key) {
|
|
570
|
+
return EVENTS[key];
|
|
539
571
|
});
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
return childSlots;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
__proto._bindEvents = function () {
|
|
548
|
-
var _this = this;
|
|
549
|
-
|
|
550
|
-
var flicking = this.vanillaFlicking;
|
|
551
|
-
var events = Object.keys(EVENTS).map(function (key) {
|
|
552
|
-
return EVENTS[key];
|
|
553
|
-
});
|
|
554
|
-
events.forEach(function (eventName) {
|
|
555
|
-
flicking.on(eventName, function (e) {
|
|
556
|
-
e.currentTarget = _this; // Make events from camelCase to kebab-case
|
|
572
|
+
events.forEach(function (eventName) {
|
|
573
|
+
flicking.on(eventName, function (e) {
|
|
574
|
+
e.currentTarget = _this; // Make events from camelCase to kebab-case
|
|
557
575
|
|
|
558
|
-
|
|
576
|
+
_this.$emit(eventName.replace(/([A-Z])/g, "-$1").toLowerCase(), e);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
},
|
|
580
|
+
checkPlugins: function () {
|
|
581
|
+
var _a, _b;
|
|
582
|
+
|
|
583
|
+
var _c = this.pluginsDiffer.update(this.plugins),
|
|
584
|
+
list = _c.list,
|
|
585
|
+
added = _c.added,
|
|
586
|
+
removed = _c.removed,
|
|
587
|
+
prevList = _c.prevList;
|
|
588
|
+
|
|
589
|
+
(_a = this.vanillaFlicking).addPlugins.apply(_a, added.map(function (index) {
|
|
590
|
+
return list[index];
|
|
591
|
+
}));
|
|
592
|
+
|
|
593
|
+
(_b = this.vanillaFlicking).removePlugins.apply(_b, removed.map(function (index) {
|
|
594
|
+
return prevList[index];
|
|
595
|
+
}));
|
|
596
|
+
},
|
|
597
|
+
fillKeys: function () {
|
|
598
|
+
var vnodes = this.getSlots();
|
|
599
|
+
vnodes.forEach(function (node, idx) {
|
|
600
|
+
if (node.key == null) {
|
|
601
|
+
node.key = "$_" + idx;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
getChildren: function () {
|
|
606
|
+
var childRefs = this.$refs;
|
|
607
|
+
return Object.keys(childRefs).map(function (refKey) {
|
|
608
|
+
return childRefs[refKey];
|
|
559
609
|
});
|
|
560
|
-
});
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
__proto._checkPlugins = function () {
|
|
564
|
-
var _a, _b;
|
|
565
|
-
|
|
566
|
-
var _c = this.pluginsDiffer.update(this.plugins),
|
|
567
|
-
list = _c.list,
|
|
568
|
-
added = _c.added,
|
|
569
|
-
removed = _c.removed,
|
|
570
|
-
prevList = _c.prevList;
|
|
571
|
-
|
|
572
|
-
(_a = this.vanillaFlicking).addPlugins.apply(_a, added.map(function (index) {
|
|
573
|
-
return list[index];
|
|
574
|
-
}));
|
|
575
|
-
|
|
576
|
-
(_b = this.vanillaFlicking).removePlugins.apply(_b, removed.map(function (index) {
|
|
577
|
-
return prevList[index];
|
|
578
|
-
}));
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
__proto._fillKeys = function () {
|
|
582
|
-
var vnodes = this.getSlots();
|
|
583
|
-
vnodes.forEach(function (node, idx) {
|
|
584
|
-
if (node.key == null) {
|
|
585
|
-
node.key = "$_" + idx;
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
__decorate([withFlickingMethods], Flicking.prototype, "vanillaFlicking", void 0);
|
|
591
|
-
|
|
592
|
-
Flicking = __decorate([Options({
|
|
593
|
-
components: {
|
|
594
|
-
Panel: VuePanelComponent
|
|
595
610
|
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
}(Vue.with(FlickingProps));
|
|
611
|
+
}
|
|
612
|
+
});
|
|
599
613
|
|
|
600
|
-
export default
|
|
614
|
+
export { Flicking as default };
|
|
601
615
|
//# sourceMappingURL=flicking.esm.js.map
|