@nativescript-community/ui-pager 13.0.30 → 13.0.34

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +186 -266
  3. package/angular/esm2020/index.mjs +54 -0
  4. package/angular/esm2020/nativescript-community-ui-pager-angular.mjs +2 -0
  5. package/angular/esm2020/pager-items-comp.mjs +304 -0
  6. package/angular/fesm2015/nativescript-community-ui-pager-angular.mjs +379 -0
  7. package/angular/fesm2015/nativescript-community-ui-pager-angular.mjs.map +1 -0
  8. package/angular/{fesm2015/nativescript-community-ui-pager-angular.js → fesm2020/nativescript-community-ui-pager-angular.mjs} +15 -24
  9. package/angular/fesm2020/nativescript-community-ui-pager-angular.mjs.map +1 -0
  10. package/angular/package.json +20 -6
  11. package/{pager.android.d.ts → index.android.d.ts} +3 -3
  12. package/{pager.android.js → index.android.js} +22 -33
  13. package/index.android.js.map +1 -0
  14. package/{pager.common.d.ts → index.common.d.ts} +2 -1
  15. package/{pager.common.js → index.common.js} +38 -43
  16. package/index.common.js.map +1 -0
  17. package/{pager.d.ts → index.d.ts} +2 -2
  18. package/{pager.ios.d.ts → index.ios.d.ts} +20 -18
  19. package/{pager.ios.js → index.ios.js} +177 -184
  20. package/index.ios.js.map +1 -0
  21. package/package.json +17 -4
  22. package/platforms/android/native-api-usage.json +7 -5
  23. package/react/index.d.ts +7 -7
  24. package/react/index.js +1 -1
  25. package/react/index.js.map +1 -1
  26. package/references.d.ts +1 -0
  27. package/svelte/index.d.ts +1 -1
  28. package/svelte/index.js +6 -6
  29. package/svelte/index.js.map +1 -1
  30. package/typings/objc!CHIPageControl.d.ts +197 -0
  31. package/vue/pager.js +15 -15
  32. package/vue/pager.js.map +1 -1
  33. package/.pnpm-debug.log +0 -1
  34. package/angular/bundles/nativescript-community-ui-pager-angular.umd.js +0 -753
  35. package/angular/bundles/nativescript-community-ui-pager-angular.umd.js.map +0 -1
  36. package/angular/esm2015/index.js +0 -55
  37. package/angular/esm2015/nativescript-community-ui-pager-angular.js +0 -2
  38. package/angular/esm2015/pager-items-comp.js +0 -312
  39. package/angular/fesm2015/nativescript-community-ui-pager-angular.js.map +0 -1
  40. package/pager.android.js.map +0 -1
  41. package/pager.common.js.map +0 -1
  42. package/pager.ios.js.map +0 -1
@@ -1,753 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@nativescript-community/ui-pager'), require('@nativescript/angular'), require('@nativescript/core'), require('@nativescript/core/data/observable-array'), require('@nativescript/core/profiling')) :
3
- typeof define === 'function' && define.amd ? define('@nativescript-community/ui-pager-angular', ['exports', '@angular/core', '@nativescript-community/ui-pager', '@nativescript/angular', '@nativescript/core', '@nativescript/core/data/observable-array', '@nativescript/core/profiling'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['nativescript-community'] = global['nativescript-community'] || {}, global['nativescript-community']['ui-pager-angular'] = {}), global.ng.core, global['ns-ui-pager'], global['ns-angular'], global['ns-core'], global.observableArray, global.profiling));
5
- }(this, (function (exports, i0, uiPager, angular, core, observableArray, profiling) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
22
- }
23
- n['default'] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
-
29
- /*! *****************************************************************************
30
- Copyright (c) Microsoft Corporation.
31
-
32
- Permission to use, copy, modify, and/or distribute this software for any
33
- purpose with or without fee is hereby granted.
34
-
35
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
- PERFORMANCE OF THIS SOFTWARE.
42
- ***************************************************************************** */
43
- /* global Reflect, Promise */
44
- var extendStatics = function (d, b) {
45
- extendStatics = Object.setPrototypeOf ||
46
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47
- function (d, b) { for (var p in b)
48
- if (Object.prototype.hasOwnProperty.call(b, p))
49
- d[p] = b[p]; };
50
- return extendStatics(d, b);
51
- };
52
- function __extends(d, b) {
53
- if (typeof b !== "function" && b !== null)
54
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
55
- extendStatics(d, b);
56
- function __() { this.constructor = d; }
57
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58
- }
59
- var __assign = function () {
60
- __assign = Object.assign || function __assign(t) {
61
- for (var s, i = 1, n = arguments.length; i < n; i++) {
62
- s = arguments[i];
63
- for (var p in s)
64
- if (Object.prototype.hasOwnProperty.call(s, p))
65
- t[p] = s[p];
66
- }
67
- return t;
68
- };
69
- return __assign.apply(this, arguments);
70
- };
71
- function __rest(s, e) {
72
- var t = {};
73
- for (var p in s)
74
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
- t[p] = s[p];
76
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
77
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79
- t[p[i]] = s[p[i]];
80
- }
81
- return t;
82
- }
83
- function __decorate$1(decorators, target, key, desc) {
84
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
85
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
86
- r = Reflect.decorate(decorators, target, key, desc);
87
- else
88
- for (var i = decorators.length - 1; i >= 0; i--)
89
- if (d = decorators[i])
90
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
- function __param(paramIndex, decorator) {
94
- return function (target, key) { decorator(target, key, paramIndex); };
95
- }
96
- function __metadata(metadataKey, metadataValue) {
97
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
98
- return Reflect.metadata(metadataKey, metadataValue);
99
- }
100
- function __awaiter(thisArg, _arguments, P, generator) {
101
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
102
- return new (P || (P = Promise))(function (resolve, reject) {
103
- function fulfilled(value) { try {
104
- step(generator.next(value));
105
- }
106
- catch (e) {
107
- reject(e);
108
- } }
109
- function rejected(value) { try {
110
- step(generator["throw"](value));
111
- }
112
- catch (e) {
113
- reject(e);
114
- } }
115
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
116
- step((generator = generator.apply(thisArg, _arguments || [])).next());
117
- });
118
- }
119
- function __generator(thisArg, body) {
120
- var _ = { label: 0, sent: function () { if (t[0] & 1)
121
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
122
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
123
- function verb(n) { return function (v) { return step([n, v]); }; }
124
- function step(op) {
125
- if (f)
126
- throw new TypeError("Generator is already executing.");
127
- while (_)
128
- try {
129
- 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)
130
- return t;
131
- if (y = 0, t)
132
- op = [op[0] & 2, t.value];
133
- switch (op[0]) {
134
- case 0:
135
- case 1:
136
- t = op;
137
- break;
138
- case 4:
139
- _.label++;
140
- return { value: op[1], done: false };
141
- case 5:
142
- _.label++;
143
- y = op[1];
144
- op = [0];
145
- continue;
146
- case 7:
147
- op = _.ops.pop();
148
- _.trys.pop();
149
- continue;
150
- default:
151
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
152
- _ = 0;
153
- continue;
154
- }
155
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
156
- _.label = op[1];
157
- break;
158
- }
159
- if (op[0] === 6 && _.label < t[1]) {
160
- _.label = t[1];
161
- t = op;
162
- break;
163
- }
164
- if (t && _.label < t[2]) {
165
- _.label = t[2];
166
- _.ops.push(op);
167
- break;
168
- }
169
- if (t[2])
170
- _.ops.pop();
171
- _.trys.pop();
172
- continue;
173
- }
174
- op = body.call(thisArg, _);
175
- }
176
- catch (e) {
177
- op = [6, e];
178
- y = 0;
179
- }
180
- finally {
181
- f = t = 0;
182
- }
183
- if (op[0] & 5)
184
- throw op[1];
185
- return { value: op[0] ? op[1] : void 0, done: true };
186
- }
187
- }
188
- var __createBinding = Object.create ? (function (o, m, k, k2) {
189
- if (k2 === undefined)
190
- k2 = k;
191
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
192
- }) : (function (o, m, k, k2) {
193
- if (k2 === undefined)
194
- k2 = k;
195
- o[k2] = m[k];
196
- });
197
- function __exportStar(m, o) {
198
- for (var p in m)
199
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
200
- __createBinding(o, m, p);
201
- }
202
- function __values(o) {
203
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
204
- if (m)
205
- return m.call(o);
206
- if (o && typeof o.length === "number")
207
- return {
208
- next: function () {
209
- if (o && i >= o.length)
210
- o = void 0;
211
- return { value: o && o[i++], done: !o };
212
- }
213
- };
214
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
215
- }
216
- function __read(o, n) {
217
- var m = typeof Symbol === "function" && o[Symbol.iterator];
218
- if (!m)
219
- return o;
220
- var i = m.call(o), r, ar = [], e;
221
- try {
222
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
223
- ar.push(r.value);
224
- }
225
- catch (error) {
226
- e = { error: error };
227
- }
228
- finally {
229
- try {
230
- if (r && !r.done && (m = i["return"]))
231
- m.call(i);
232
- }
233
- finally {
234
- if (e)
235
- throw e.error;
236
- }
237
- }
238
- return ar;
239
- }
240
- /** @deprecated */
241
- function __spread() {
242
- for (var ar = [], i = 0; i < arguments.length; i++)
243
- ar = ar.concat(__read(arguments[i]));
244
- return ar;
245
- }
246
- /** @deprecated */
247
- function __spreadArrays() {
248
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
249
- s += arguments[i].length;
250
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
251
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
252
- r[k] = a[j];
253
- return r;
254
- }
255
- function __spreadArray(to, from) {
256
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
257
- to[j] = from[i];
258
- return to;
259
- }
260
- function __await(v) {
261
- return this instanceof __await ? (this.v = v, this) : new __await(v);
262
- }
263
- function __asyncGenerator(thisArg, _arguments, generator) {
264
- if (!Symbol.asyncIterator)
265
- throw new TypeError("Symbol.asyncIterator is not defined.");
266
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
267
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
268
- function verb(n) { if (g[n])
269
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
270
- function resume(n, v) { try {
271
- step(g[n](v));
272
- }
273
- catch (e) {
274
- settle(q[0][3], e);
275
- } }
276
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
277
- function fulfill(value) { resume("next", value); }
278
- function reject(value) { resume("throw", value); }
279
- function settle(f, v) { if (f(v), q.shift(), q.length)
280
- resume(q[0][0], q[0][1]); }
281
- }
282
- function __asyncDelegator(o) {
283
- var i, p;
284
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
285
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
286
- }
287
- function __asyncValues(o) {
288
- if (!Symbol.asyncIterator)
289
- throw new TypeError("Symbol.asyncIterator is not defined.");
290
- var m = o[Symbol.asyncIterator], i;
291
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
292
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
293
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
294
- }
295
- function __makeTemplateObject(cooked, raw) {
296
- if (Object.defineProperty) {
297
- Object.defineProperty(cooked, "raw", { value: raw });
298
- }
299
- else {
300
- cooked.raw = raw;
301
- }
302
- return cooked;
303
- }
304
- ;
305
- var __setModuleDefault = Object.create ? (function (o, v) {
306
- Object.defineProperty(o, "default", { enumerable: true, value: v });
307
- }) : function (o, v) {
308
- o["default"] = v;
309
- };
310
- function __importStar(mod) {
311
- if (mod && mod.__esModule)
312
- return mod;
313
- var result = {};
314
- if (mod != null)
315
- for (var k in mod)
316
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
317
- __createBinding(result, mod, k);
318
- __setModuleDefault(result, mod);
319
- return result;
320
- }
321
- function __importDefault(mod) {
322
- return (mod && mod.__esModule) ? mod : { default: mod };
323
- }
324
- function __classPrivateFieldGet(receiver, state, kind, f) {
325
- if (kind === "a" && !f)
326
- throw new TypeError("Private accessor was defined without a getter");
327
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
328
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
329
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
330
- }
331
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
332
- if (kind === "m")
333
- throw new TypeError("Private method is not writable");
334
- if (kind === "a" && !f)
335
- throw new TypeError("Private accessor was defined without a setter");
336
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
337
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
338
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
339
- }
340
-
341
- var _c0 = ["loader"];
342
- angular.registerElement('Pager', function () { return uiPager.Pager; });
343
- angular.registerElement('PagerItem', function () { return uiPager.PagerItem; });
344
- var NG_VIEW = '_ngViewRef';
345
- var ItemContext = /** @class */ (function () {
346
- function ItemContext($implicit, item, index, even, odd) {
347
- this.$implicit = $implicit;
348
- this.item = item;
349
- this.index = index;
350
- this.even = even;
351
- this.odd = odd;
352
- }
353
- return ItemContext;
354
- }());
355
- var TemplatedItemsComponent = /** @class */ (function () {
356
- function TemplatedItemsComponent(_elementRef, _iterableDiffers) {
357
- this._iterableDiffers = _iterableDiffers;
358
- this.setupItemView = new i0.EventEmitter();
359
- this.templatedItemsView = _elementRef.nativeElement;
360
- this.templatedItemsView.on('itemLoading', this.onItemLoading, this);
361
- this.templatedItemsView.on('itemDisposing', this.onItemDisposing, this);
362
- }
363
- Object.defineProperty(TemplatedItemsComponent.prototype, "items", {
364
- get: function () {
365
- return this._items;
366
- },
367
- set: function (value) {
368
- this._items = value;
369
- var needDiffer = true;
370
- if (value instanceof observableArray.ObservableArray) {
371
- needDiffer = false;
372
- }
373
- if (needDiffer && !this._differ && i0.ɵisListLikeIterable(value)) {
374
- this._differ = this._iterableDiffers
375
- .find(this._items)
376
- .create(function (_index, item) { return item; });
377
- }
378
- this.templatedItemsView.items = this._items;
379
- },
380
- enumerable: false,
381
- configurable: true
382
- });
383
- Object.defineProperty(TemplatedItemsComponent.prototype, "selectedIndex", {
384
- get: function () {
385
- return this._selectedIndex;
386
- },
387
- set: function (value) {
388
- this._selectedIndex = value;
389
- this.templatedItemsView.selectedIndex = this._selectedIndex;
390
- },
391
- enumerable: false,
392
- configurable: true
393
- });
394
- TemplatedItemsComponent.prototype.ngAfterViewInit = function () {
395
- var _this = this;
396
- if (!!(this._selectedIndex)) {
397
- setTimeout(function () {
398
- if (core.isIOS) {
399
- _this.templatedItemsView.scrollToIndexAnimated(_this._selectedIndex, false);
400
- }
401
- _this.templatedItemsView.selectedIndex = _this._selectedIndex;
402
- });
403
- }
404
- };
405
- TemplatedItemsComponent.prototype.ngAfterContentInit = function () {
406
- if (core.Trace.isEnabled()) {
407
- uiPager.PagerLog('TemplatedItemsView.ngAfterContentInit()');
408
- }
409
- this.setItemTemplates();
410
- };
411
- TemplatedItemsComponent.prototype.ngOnDestroy = function () {
412
- this.templatedItemsView.off('itemLoading', this.onItemLoading, this);
413
- this.templatedItemsView.off('itemDisposing', this.onItemDisposing, this);
414
- };
415
- TemplatedItemsComponent.prototype.setItemTemplates = function () {
416
- if (!this.items)
417
- return;
418
- this.itemTemplate = this.itemTemplateQuery;
419
- if (this._templateMap) {
420
- if (core.Trace.isEnabled()) {
421
- uiPager.PagerLog('Setting templates');
422
- }
423
- var templates_1 = [];
424
- this._templateMap.forEach(function (value) {
425
- templates_1.push(value);
426
- });
427
- this.templatedItemsView.itemTemplates = templates_1;
428
- }
429
- };
430
- TemplatedItemsComponent.prototype.registerTemplate = function (key, template) {
431
- if (core.Trace.isEnabled()) {
432
- uiPager.PagerLog("registerTemplate for key: " + key);
433
- }
434
- if (!this._templateMap) {
435
- this._templateMap = new Map();
436
- }
437
- var keyedTemplate = {
438
- key: key,
439
- createView: this.getItemTemplateViewFactory(template),
440
- };
441
- this._templateMap.set(key, keyedTemplate);
442
- };
443
- TemplatedItemsComponent.prototype.onItemLoading = function (args) {
444
- if (!args.view && !this.itemTemplate) {
445
- return;
446
- }
447
- if (!this.items)
448
- return;
449
- var index = args.index;
450
- var items = args.object.items;
451
- var currentItem = typeof items.getItem === 'function'
452
- ? items.getItem(index)
453
- : items[index];
454
- var viewRef;
455
- if (args.view) {
456
- if (core.Trace.isEnabled()) {
457
- uiPager.PagerLog("onItemLoading: " + index + " - Reusing existing view");
458
- }
459
- viewRef = args.view[NG_VIEW];
460
- if (!viewRef &&
461
- args.view instanceof core.LayoutBase &&
462
- args.view.getChildrenCount() > 0) {
463
- viewRef = args.view.getChildAt(0)[NG_VIEW];
464
- }
465
- if (!viewRef && core.Trace.isEnabled()) {
466
- uiPager.PagerError("ViewReference not found for item " + index + ". View recycling is not working");
467
- }
468
- }
469
- if (!viewRef) {
470
- if (core.Trace.isEnabled()) {
471
- uiPager.PagerLog("onItemLoading: " + index + " - Creating view from template");
472
- }
473
- viewRef = this.loader.createEmbeddedView(this.itemTemplate, new ItemContext(), 0);
474
- args.view = getItemViewRoot(viewRef);
475
- args.view[NG_VIEW] = viewRef;
476
- }
477
- this.setupViewRef(viewRef, currentItem, index);
478
- this.detectChangesOnChild(viewRef, index);
479
- };
480
- TemplatedItemsComponent.prototype.onItemDisposing = function (args) {
481
- if (!args.view) {
482
- return;
483
- }
484
- var viewRef;
485
- if (args.view) {
486
- if (core.Trace.isEnabled()) {
487
- uiPager.PagerLog("onItemDisposing: " + args.index + " - Removing angular view");
488
- }
489
- viewRef = args.view[NG_VIEW];
490
- if (!viewRef &&
491
- args.view instanceof core.LayoutBase &&
492
- args.view.getChildrenCount() > 0) {
493
- viewRef = args.view.getChildAt(0)[NG_VIEW];
494
- }
495
- if (!viewRef && core.Trace.isEnabled()) {
496
- uiPager.PagerError("ViewReference not found for item " + args.index + ". View disposing is not working");
497
- }
498
- }
499
- if (viewRef) {
500
- if (core.Trace.isEnabled()) {
501
- uiPager.PagerLog("onItemDisposing: " + args.index + " - Disposing view reference");
502
- }
503
- viewRef.destroy();
504
- }
505
- };
506
- TemplatedItemsComponent.prototype.setupViewRef = function (viewRef, data, index) {
507
- var context = viewRef.context;
508
- context.$implicit = data;
509
- context.item = data;
510
- context.index = index;
511
- context.even = index % 2 === 0;
512
- context.odd = !context.even;
513
- this.setupItemView.next({
514
- view: viewRef,
515
- data: data,
516
- index: index,
517
- context: context,
518
- });
519
- };
520
- TemplatedItemsComponent.prototype.getItemTemplateViewFactory = function (template) {
521
- var _this = this;
522
- return function () {
523
- var viewRef = _this.loader.createEmbeddedView(template, new ItemContext(), 0);
524
- var resultView = getItemViewRoot(viewRef);
525
- resultView[NG_VIEW] = viewRef;
526
- return resultView;
527
- };
528
- };
529
- TemplatedItemsComponent.prototype.detectChangesOnChild = function (viewRef, index) {
530
- if (core.Trace.isEnabled()) {
531
- uiPager.PagerLog("Manually detect changes in child: " + index);
532
- }
533
- viewRef.markForCheck();
534
- viewRef.detectChanges();
535
- };
536
- TemplatedItemsComponent.prototype.ngDoCheck = function () {
537
- if (this._differ) {
538
- if (core.Trace.isEnabled()) {
539
- uiPager.PagerLog('ngDoCheck() - execute differ');
540
- }
541
- var changes = this._differ.diff(this._items);
542
- if (changes) {
543
- if (core.Trace.isEnabled()) {
544
- uiPager.PagerLog('ngDoCheck() - refresh');
545
- }
546
- this.templatedItemsView.refresh();
547
- }
548
- }
549
- };
550
- return TemplatedItemsComponent;
551
- }());
552
- TemplatedItemsComponent.ɵfac = function TemplatedItemsComponent_Factory(t) { return new (t || TemplatedItemsComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(i0__namespace.IterableDiffers)); };
553
- TemplatedItemsComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: TemplatedItemsComponent, selectors: [["ng-component"]], contentQueries: function TemplatedItemsComponent_ContentQueries(rf, ctx, dirIndex) {
554
- if (rf & 1) {
555
- i0__namespace.ɵɵcontentQuery(dirIndex, i0.TemplateRef, 5);
556
- }
557
- if (rf & 2) {
558
- var _t = void 0;
559
- i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.itemTemplateQuery = _t.first);
560
- }
561
- }, viewQuery: function TemplatedItemsComponent_Query(rf, ctx) {
562
- if (rf & 1) {
563
- i0__namespace.ɵɵviewQuery(_c0, 5, i0.ViewContainerRef);
564
- }
565
- if (rf & 2) {
566
- var _t = void 0;
567
- i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.loader = _t.first);
568
- }
569
- }, inputs: { items: "items", selectedIndex: "selectedIndex" }, outputs: { setupItemView: "setupItemView" }, decls: 0, vars: 0, template: function TemplatedItemsComponent_Template(rf, ctx) { }, encapsulation: 2 });
570
- __decorate([
571
- profiling.profile
572
- ], TemplatedItemsComponent.prototype, "onItemLoading", null);
573
- __decorate([
574
- profiling.profile
575
- ], TemplatedItemsComponent.prototype, "onItemDisposing", null);
576
- __decorate([
577
- profiling.profile
578
- ], TemplatedItemsComponent.prototype, "detectChangesOnChild", null);
579
- (function () {
580
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(TemplatedItemsComponent, [{
581
- type: i0.Component,
582
- args: [{
583
- template: '',
584
- }]
585
- }], function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.IterableDiffers }]; }, { loader: [{
586
- type: i0.ViewChild,
587
- args: ['loader', { read: i0.ViewContainerRef, static: false }]
588
- }], setupItemView: [{
589
- type: i0.Output
590
- }], itemTemplateQuery: [{
591
- type: i0.ContentChild,
592
- args: [i0.TemplateRef, { static: false }]
593
- }], items: [{
594
- type: i0.Input
595
- }], selectedIndex: [{
596
- type: i0.Input
597
- }], onItemLoading: [], onItemDisposing: [], detectChangesOnChild: [] });
598
- })();
599
- function getItemViewRoot(viewRef, rootLocator) {
600
- if (rootLocator === void 0) { rootLocator = angular.getSingleViewRecursive; }
601
- return rootLocator(viewRef.rootNodes, 0);
602
- }
603
- var TEMPLATED_ITEMS_COMPONENT = new i0.InjectionToken('TemplatedItemsComponent');
604
- var PagerItemDirective = /** @class */ (function () {
605
- function PagerItemDirective(templateRef, owner, viewContainer) {
606
- this.templateRef = templateRef;
607
- this.owner = owner;
608
- this.viewContainer = viewContainer;
609
- }
610
- PagerItemDirective.prototype.ensureItem = function () {
611
- if (!this.item) {
612
- this.item = new uiPager.PagerItem();
613
- }
614
- };
615
- PagerItemDirective.prototype.applyConfig = function () {
616
- this.ensureItem();
617
- };
618
- PagerItemDirective.prototype.ngOnInit = function () {
619
- this.applyConfig();
620
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
621
- var realViews = viewRef.rootNodes.filter(function (node) { return !angular.isInvisibleNode(node); });
622
- if (realViews.length > 0) {
623
- var view = realViews[0];
624
- this.item.addChild(view);
625
- this.owner.nativeElement._addChildFromBuilder('PagerItem', this.item);
626
- }
627
- };
628
- return PagerItemDirective;
629
- }());
630
- PagerItemDirective.ɵfac = function PagerItemDirective_Factory(t) { return new (t || PagerItemDirective)(i0__namespace.ɵɵdirectiveInject(i0__namespace.TemplateRef), i0__namespace.ɵɵdirectiveInject(TEMPLATED_ITEMS_COMPONENT, 1), i0__namespace.ɵɵdirectiveInject(i0__namespace.ViewContainerRef)); };
631
- PagerItemDirective.ɵdir = i0__namespace.ɵɵdefineDirective({ type: PagerItemDirective, selectors: [["", "pagerItem", ""]] });
632
- (function () {
633
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PagerItemDirective, [{
634
- type: i0.Directive,
635
- args: [{
636
- selector: '[pagerItem]',
637
- }]
638
- }], function () {
639
- return [{ type: i0__namespace.TemplateRef }, { type: TemplatedItemsComponent, decorators: [{
640
- type: i0.Inject,
641
- args: [TEMPLATED_ITEMS_COMPONENT]
642
- }, {
643
- type: i0.Host
644
- }] }, { type: i0__namespace.ViewContainerRef }];
645
- }, null);
646
- })();
647
- var TemplateKeyDirective = /** @class */ (function () {
648
- function TemplateKeyDirective(templateRef, comp) {
649
- this.templateRef = templateRef;
650
- this.comp = comp;
651
- }
652
- Object.defineProperty(TemplateKeyDirective.prototype, "pagerTemplateKey", {
653
- set: function (value) {
654
- if (this.comp && this.templateRef) {
655
- this.comp.registerTemplate(value, this.templateRef);
656
- }
657
- },
658
- enumerable: false,
659
- configurable: true
660
- });
661
- return TemplateKeyDirective;
662
- }());
663
- TemplateKeyDirective.ɵfac = function TemplateKeyDirective_Factory(t) { return new (t || TemplateKeyDirective)(i0__namespace.ɵɵdirectiveInject(i0__namespace.TemplateRef), i0__namespace.ɵɵdirectiveInject(TEMPLATED_ITEMS_COMPONENT, 1)); };
664
- TemplateKeyDirective.ɵdir = i0__namespace.ɵɵdefineDirective({ type: TemplateKeyDirective, selectors: [["", "pagerTemplateKey", ""]], inputs: { pagerTemplateKey: "pagerTemplateKey" } });
665
- (function () {
666
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(TemplateKeyDirective, [{
667
- type: i0.Directive,
668
- args: [{ selector: '[pagerTemplateKey]' }]
669
- }], function () {
670
- return [{ type: i0__namespace.TemplateRef }, { type: TemplatedItemsComponent, decorators: [{
671
- type: i0.Inject,
672
- args: [TEMPLATED_ITEMS_COMPONENT]
673
- }, {
674
- type: i0.Host
675
- }] }];
676
- }, { pagerTemplateKey: [{
677
- type: i0.Input
678
- }] });
679
- })();
680
-
681
- var PagerComponent = /** @class */ (function (_super) {
682
- __extends(PagerComponent, _super);
683
- function PagerComponent(_elementRef, _iterableDiffers) {
684
- return _super.call(this, _elementRef, _iterableDiffers) || this;
685
- }
686
- Object.defineProperty(PagerComponent.prototype, "nativeElement", {
687
- get: function () {
688
- return this.templatedItemsView;
689
- },
690
- enumerable: false,
691
- configurable: true
692
- });
693
- return PagerComponent;
694
- }(TemplatedItemsComponent));
695
- PagerComponent.ɵfac = function PagerComponent_Factory(t) { return new (t || PagerComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(i0__namespace.IterableDiffers)); };
696
- PagerComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: PagerComponent, selectors: [["Pager"]], features: [i0__namespace.ɵɵProvidersFeature([
697
- {
698
- provide: TEMPLATED_ITEMS_COMPONENT,
699
- useExisting: i0.forwardRef(function () { return PagerComponent; })
700
- }
701
- ]), i0__namespace.ɵɵInheritDefinitionFeature], decls: 3, vars: 0, consts: [["loader", ""]], template: function PagerComponent_Template(rf, ctx) {
702
- if (rf & 1) {
703
- i0__namespace.ɵɵelementStart(0, "DetachedContainer");
704
- i0__namespace.ɵɵelement(1, "Placeholder", null, 0);
705
- i0__namespace.ɵɵelementEnd();
706
- }
707
- }, encapsulation: 2, changeDetection: 0 });
708
- (function () {
709
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PagerComponent, [{
710
- type: i0.Component,
711
- args: [{
712
- selector: 'Pager',
713
- template: "\n\t\t<DetachedContainer>\n\t\t\t<Placeholder #loader></Placeholder>\n\t\t</DetachedContainer>",
714
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
715
- providers: [
716
- {
717
- provide: TEMPLATED_ITEMS_COMPONENT,
718
- useExisting: i0.forwardRef(function () { return PagerComponent; })
719
- }
720
- ]
721
- }]
722
- }], function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.IterableDiffers }]; }, null);
723
- })();
724
- var PagerModule = /** @class */ (function () {
725
- function PagerModule() {
726
- }
727
- return PagerModule;
728
- }());
729
- PagerModule.ɵfac = function PagerModule_Factory(t) { return new (t || PagerModule)(); };
730
- PagerModule.ɵmod = i0__namespace.ɵɵdefineNgModule({ type: PagerModule });
731
- PagerModule.ɵinj = i0__namespace.ɵɵdefineInjector({});
732
- (function () {
733
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PagerModule, [{
734
- type: i0.NgModule,
735
- args: [{
736
- declarations: [PagerComponent, TemplateKeyDirective, PagerItemDirective],
737
- exports: [PagerComponent, TemplateKeyDirective, PagerItemDirective],
738
- schemas: [i0.NO_ERRORS_SCHEMA]
739
- }]
740
- }], null, null);
741
- })();
742
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(PagerModule, { declarations: [PagerComponent, TemplateKeyDirective, PagerItemDirective], exports: [PagerComponent, TemplateKeyDirective, PagerItemDirective] }); })();
743
-
744
- exports.PagerComponent = PagerComponent;
745
- exports.PagerItemDirective = PagerItemDirective;
746
- exports.PagerModule = PagerModule;
747
- exports.TemplateKeyDirective = TemplateKeyDirective;
748
- exports.TemplatedItemsComponent = TemplatedItemsComponent;
749
-
750
- Object.defineProperty(exports, '__esModule', { value: true });
751
-
752
- })));
753
- //# sourceMappingURL=nativescript-community-ui-pager-angular.umd.js.map