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