@nativescript-community/ui-collectionview 5.3.7 → 5.3.8

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/index-common.js DELETED
@@ -1,692 +0,0 @@
1
- var CollectionViewBase_1;
2
- import { Builder, CSSType, ContentView, CoreTypes, Label, Length, Observable, ObservableArray, PercentLength, Property, ProxyViewContainer, Trace, Utils, View, addWeakEventListener, booleanConverter, heightProperty, makeParser, makeValidator, profile, removeWeakEventListener, widthProperty } from '@nativescript/core';
3
- import { CollectionView as CollectionViewDefinition } from '.';
4
- export const CollectionViewTraceCategory = 'NativescriptCollectionView';
5
- // iOS only
6
- export var ContentInsetAdjustmentBehavior;
7
- (function (ContentInsetAdjustmentBehavior) {
8
- ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["Always"] = 0] = "Always";
9
- ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["Automatic"] = 1] = "Automatic";
10
- ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["Never"] = 2] = "Never";
11
- ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["ScrollableAxes"] = 3] = "ScrollableAxes";
12
- })(ContentInsetAdjustmentBehavior || (ContentInsetAdjustmentBehavior = {}));
13
- export var CLogTypes;
14
- (function (CLogTypes) {
15
- CLogTypes[CLogTypes["log"] = Trace.messageType.log] = "log";
16
- CLogTypes[CLogTypes["info"] = Trace.messageType.info] = "info";
17
- CLogTypes[CLogTypes["warning"] = Trace.messageType.warn] = "warning";
18
- CLogTypes[CLogTypes["error"] = Trace.messageType.error] = "error";
19
- })(CLogTypes || (CLogTypes = {}));
20
- export const CLog = (type, ...args) => {
21
- Trace.write(args.map((a) => (a && typeof a === 'object' ? a.toString() : a)).join(' '), CollectionViewTraceCategory, type);
22
- };
23
- const autoEffectiveRowHeight = 0;
24
- const autoEffectiveColWidth = 0;
25
- // export * from 'ui/core/view';
26
- export var ListViewViewTypes;
27
- (function (ListViewViewTypes) {
28
- ListViewViewTypes[ListViewViewTypes["ItemView"] = 0] = "ItemView";
29
- })(ListViewViewTypes || (ListViewViewTypes = {}));
30
- export var knownTemplates;
31
- (function (knownTemplates) {
32
- knownTemplates.itemTemplate = 'itemTemplate';
33
- })(knownTemplates || (knownTemplates = {}));
34
- export var knownMultiTemplates;
35
- (function (knownMultiTemplates) {
36
- knownMultiTemplates.itemTemplates = 'itemTemplates';
37
- })(knownMultiTemplates || (knownMultiTemplates = {}));
38
- function toDevicePixels(length, auto = Number.NaN, parentAvailableWidth = Number.NaN) {
39
- if (length === 'auto') {
40
- // tslint:disable-line
41
- return auto;
42
- }
43
- if (typeof length === 'number') {
44
- return Math.floor(Utils.layout.toDevicePixels(length));
45
- }
46
- if (!length) {
47
- return auto;
48
- }
49
- switch (length.unit) {
50
- case 'px':
51
- return Math.floor(length.value);
52
- case '%':
53
- return Math.floor(parentAvailableWidth * length.value);
54
- case 'dip':
55
- default:
56
- return Math.floor(Utils.layout.toDevicePixels(length.value));
57
- }
58
- }
59
- let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends View {
60
- static registerPlugin(key, plugin) {
61
- this.plugins[key] = plugin;
62
- }
63
- static registerLayoutStyle(style, generator) {
64
- this.layoutStyles[style] = generator;
65
- }
66
- constructor() {
67
- super();
68
- this._innerWidth = 0;
69
- this._innerHeight = 0;
70
- this._dataUpdatesSuspended = false;
71
- this.layoutStyle = 'grid';
72
- this.plugins = [];
73
- // public _itemIdGenerator: (item: any, index: number, items: any) => number = (_item: any, index: number) => index;
74
- this._itemIdGenerator = null;
75
- this.onSpanSizeChanged = (oldValue, newValue) => {
76
- const start = Date.now();
77
- this.spanSize = newValue;
78
- this.refresh();
79
- };
80
- this._isDataDirty = false;
81
- this._defaultTemplate = {
82
- key: 'default',
83
- createView: () => {
84
- if (this.itemTemplate) {
85
- return Builder.parse(this.itemTemplate, this);
86
- }
87
- return undefined;
88
- }
89
- };
90
- this._itemTemplatesInternal = new Map();
91
- this._itemTemplatesInternal.set(this._defaultTemplate.key, this._defaultTemplate);
92
- }
93
- notifyForItemAtIndex(eventName, view, index, bindingContext, native) {
94
- throw new Error('Method not implemented.');
95
- }
96
- updateInnerSize() {
97
- const lastInnerWidth = this._innerWidth;
98
- const lastInnerHeight = this._innerHeight;
99
- const width = this.getMeasuredWidth();
100
- const height = this.getMeasuredHeight();
101
- if (width === 0 || height === 0) {
102
- return false;
103
- }
104
- this._innerWidth = width - this.effectivePaddingLeft - this.effectivePaddingRight;
105
- if (this.colWidth) {
106
- let newValue = toDevicePixels(this.colWidth, autoEffectiveColWidth, this._innerWidth); // We cannot use 0 for auto as it throws for android.
107
- if (global.isAndroid) {
108
- newValue = Math.floor(newValue);
109
- }
110
- if (newValue !== this._effectiveColWidth) {
111
- this._effectiveColWidth = newValue;
112
- }
113
- }
114
- this._innerHeight = height - this.effectivePaddingTop - this.effectivePaddingBottom;
115
- if (this.rowHeight) {
116
- let newValue = toDevicePixels(this.rowHeight, autoEffectiveRowHeight, this._innerHeight);
117
- if (global.isAndroid) {
118
- newValue = Math.floor(newValue);
119
- }
120
- if (newValue !== this._effectiveRowHeight) {
121
- this._effectiveRowHeight = newValue;
122
- }
123
- }
124
- return lastInnerWidth !== this._innerWidth || lastInnerHeight !== this._innerHeight;
125
- }
126
- // public onLayout(left: number, top: number, right: number, bottom: number) {
127
- // super.onLayout(left, top, right, bottom);
128
- // // on ios and during device rotation the getMeasuredWidth and getMeasuredHeight are wrong
129
- // // so we use left, top , right, bottom
130
- // this.updateInnerSize();
131
- // }
132
- onMeasure(widthMeasureSpec, heightMeasureSpec) {
133
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
134
- // on ios and during device rotation the getMeasuredWidth and getMeasuredHeight are wrong
135
- // so we use left, top , right, bottom
136
- this.updateInnerSize();
137
- }
138
- _prepareItem(view, index) {
139
- const context = this.getItemAtIndex(index);
140
- if (view) {
141
- // we check old bindingContext to see if properties disappeared.
142
- // if so we set them to null for the View to update
143
- if (view.bindingContext && view.bindingContext !== context && typeof context === 'object') {
144
- Object.keys(view.bindingContext).forEach((k) => {
145
- if (!context.hasOwnProperty(k)) {
146
- context[k] = null;
147
- }
148
- });
149
- view.bindingContext = context;
150
- }
151
- }
152
- return context;
153
- }
154
- notifyLoading(args) {
155
- this.notify(args);
156
- }
157
- getItemAtIndex(index) {
158
- // will be overriden in onItemsChangedInternal
159
- const thisItems = this.items;
160
- return thisItems.getItem ? thisItems.getItem(index) : thisItems[index];
161
- }
162
- isHorizontal() {
163
- return this.orientation === 'horizontal';
164
- }
165
- computeSpanCount() {
166
- let spanCount = 1;
167
- if (this.isHorizontal()) {
168
- if (this._effectiveRowHeight) {
169
- spanCount = Math.max(Math.floor(this._innerHeight / this._effectiveRowHeight), 1) || 1;
170
- }
171
- }
172
- else {
173
- if (this._effectiveColWidth) {
174
- spanCount = Math.max(Math.floor(this._innerWidth / this._effectiveColWidth), 1) || 1;
175
- }
176
- }
177
- return spanCount;
178
- }
179
- _onRowHeightPropertyChanged(oldValue, newValue) {
180
- this.refresh();
181
- }
182
- _onColWidthPropertyChanged(oldValue, newValue) {
183
- this.refresh();
184
- }
185
- onItemViewLoaderChanged() { }
186
- get itemViewLoader() {
187
- return this._itemViewLoader;
188
- }
189
- set itemViewLoader(value) {
190
- if (this._itemViewLoader !== value) {
191
- this._itemViewLoader = value;
192
- this.onItemViewLoaderChanged();
193
- }
194
- }
195
- get padding() {
196
- return this.style.padding;
197
- }
198
- set padding(value) {
199
- this.style.padding = value;
200
- }
201
- get paddingTop() {
202
- return this.style.paddingTop;
203
- }
204
- set paddingTop(value) {
205
- this.style.paddingTop = value;
206
- }
207
- get paddingRight() {
208
- return this.style.paddingRight;
209
- }
210
- set paddingRight(value) {
211
- this.style.paddingRight = value;
212
- }
213
- get paddingBottom() {
214
- return this.style.paddingBottom;
215
- }
216
- set paddingBottom(value) {
217
- this.style.paddingBottom = value;
218
- }
219
- get paddingLeft() {
220
- return this.style.paddingLeft;
221
- }
222
- set paddingLeft(value) {
223
- this.style.paddingLeft = value;
224
- }
225
- resolveTemplateView(template) {
226
- return Builder.parse(template, this);
227
- }
228
- _getDefaultItemContent() {
229
- const lbl = new Label();
230
- lbl['defaultItemView'] = true;
231
- lbl.bind({
232
- targetProperty: 'text',
233
- sourceProperty: '$value'
234
- });
235
- return lbl;
236
- }
237
- getTemplateFromSelector(templateKey) {
238
- const key = templateKey.toLowerCase();
239
- if (this._itemTemplatesInternal.has(key)) {
240
- return this._itemTemplatesInternal.get(key);
241
- }
242
- return this._itemTemplatesInternal.get('default');
243
- }
244
- getViewForViewType(viewType, templateKey) {
245
- let newView;
246
- if (templateKey) {
247
- const template = this.getTemplateFromSelector(templateKey);
248
- newView = template.createView();
249
- }
250
- if (!newView && this._itemViewLoader !== undefined) {
251
- newView = this._itemViewLoader(templateKey);
252
- }
253
- if (newView) {
254
- return newView;
255
- }
256
- let templateString;
257
- switch (viewType) {
258
- case ListViewViewTypes.ItemView:
259
- templateString = this.itemTemplate;
260
- if (templateString === undefined) {
261
- return undefined;
262
- // return this._getDefaultItemContent();
263
- }
264
- break;
265
- }
266
- return templateString === undefined ? undefined : this.resolveTemplateView(templateString);
267
- }
268
- onItemTemplateSelectorChanged(oldValue, newValue) {
269
- const start = Date.now();
270
- if (typeof newValue === 'string') {
271
- if (!this._itemTemplateSelectorBindable) {
272
- this._itemTemplateSelectorBindable = new ProxyViewContainer();
273
- }
274
- this._itemTemplateSelectorBindable.bind({
275
- sourceProperty: null,
276
- targetProperty: 'templateKey',
277
- expression: newValue
278
- });
279
- this._itemTemplateSelector = function (item, index, items) {
280
- item['$index'] = index;
281
- this._itemTemplateSelectorBindable.bindingContext = item;
282
- return this._itemTemplateSelectorBindable.get('templateKey');
283
- };
284
- }
285
- else if (typeof newValue === 'function') {
286
- this._itemTemplateSelector = newValue;
287
- }
288
- }
289
- onItemIdGeneratorChanged(oldValue, newValue) {
290
- const start = Date.now();
291
- if (typeof newValue === 'string') {
292
- if (!this._itemIdGeneratorBindable) {
293
- this._itemIdGeneratorBindable = new ProxyViewContainer();
294
- }
295
- this._itemIdGeneratorBindable.bind({
296
- sourceProperty: null,
297
- targetProperty: 'itemId',
298
- expression: newValue
299
- });
300
- this._itemIdGenerator = function (item, index, items) {
301
- item['$index'] = index;
302
- this._itemIdGeneratorBindable.bindingContext = item;
303
- return this._itemIdGeneratorBindable.get('itemId');
304
- };
305
- }
306
- else if (typeof newValue === 'function') {
307
- this._itemIdGenerator = newValue;
308
- }
309
- }
310
- onTemplateAdded(t) { }
311
- onTemplateRemoved(key) { }
312
- addTemplate(key, t) {
313
- if (!t.key) {
314
- t.key = t._key;
315
- delete t._key;
316
- }
317
- this._itemTemplatesInternal.set(t.key.toLowerCase(), t);
318
- this.onTemplateAdded(t);
319
- }
320
- removeTemplate(key) {
321
- const didDelete = this._itemTemplatesInternal.delete(key.toLowerCase());
322
- if (didDelete) {
323
- this.onTemplateRemoved(key);
324
- }
325
- }
326
- onItemTemplatesChanged(oldValue, newValue) {
327
- const start = Date.now();
328
- this._itemTemplatesInternal = new Map();
329
- if (newValue) {
330
- newValue.forEach((t) => {
331
- if (!t.key) {
332
- t.key = t._key;
333
- delete t._key;
334
- }
335
- this._itemTemplatesInternal.set(t.key, t);
336
- });
337
- }
338
- if (!this._itemTemplatesInternal.has(this._defaultTemplate.key)) {
339
- this._itemTemplatesInternal.set(this._defaultTemplate.key, this._defaultTemplate);
340
- }
341
- }
342
- onItemTemplateChanged(oldValue, newValue) { }
343
- // onItemTemplateSelectorPropertyChanged(oldValue, newValue) {
344
- // this.onItemTemplateSelectorChanged(oldValue, newValue);
345
- // }
346
- getItemSourceAtIndex(index) {
347
- return this.items.getItem(index);
348
- }
349
- getItemArrayAtIndex(index) {
350
- return this.items[index];
351
- }
352
- onItemsChanged(oldValue, newValue) {
353
- const start = Date.now();
354
- const getItem = newValue && newValue.getItem;
355
- this.isItemsSourceIn = typeof getItem === 'function';
356
- // we override the method to prevent the test on every getItem
357
- this.getItemAtIndex = this.isItemsSourceIn ? this.getItemSourceAtIndex.bind(this) : this.getItemArrayAtIndex.bind(this);
358
- if (oldValue instanceof Observable) {
359
- removeWeakEventListener(oldValue, ObservableArray.changeEvent, this.onSourceCollectionChangedInternal, this);
360
- }
361
- if (newValue instanceof Observable) {
362
- addWeakEventListener(newValue, ObservableArray.changeEvent, this.onSourceCollectionChangedInternal, this);
363
- }
364
- this.refresh();
365
- }
366
- onLoaded() {
367
- super.onLoaded();
368
- if (this._isDataDirty && this._effectiveColWidth !== undefined && this._effectiveRowHeight !== undefined) {
369
- this.refresh();
370
- }
371
- }
372
- onSourceCollectionChanged(event) {
373
- this.refresh();
374
- }
375
- onSourceCollectionChangedInternal(event) {
376
- if (this._dataUpdatesSuspended === false) {
377
- this.onSourceCollectionChanged(event);
378
- }
379
- }
380
- // onItemsChanged(oldValue, newValue) {
381
- // this.onItemsChangedInternal(oldValue, newValue);
382
- // }
383
- [widthProperty.getDefault]() {
384
- return '100%';
385
- }
386
- [heightProperty.getDefault]() {
387
- return '100%';
388
- }
389
- suspendUpdates() {
390
- this._dataUpdatesSuspended = true;
391
- }
392
- updatesSuspended() {
393
- return this._dataUpdatesSuspended;
394
- }
395
- resumeUpdates(refresh) {
396
- this._dataUpdatesSuspended = false;
397
- if (refresh === true) {
398
- this.refresh();
399
- }
400
- }
401
- _callItemReorderedEvent(oldPosition, newPosition, item) {
402
- const args = {
403
- eventName: CollectionViewBase_1.itemReorderedEvent,
404
- object: this,
405
- index: oldPosition,
406
- item,
407
- data: { targetIndex: newPosition },
408
- view: this.draggingView
409
- };
410
- this.notify(args);
411
- this.draggingView = null;
412
- }
413
- _reorderItemInSource(oldPosition, newPosition, callEvents = true) {
414
- this.suspendUpdates();
415
- const ownerSource = this.items;
416
- const item = this.getItemAtIndex(oldPosition);
417
- ownerSource.splice(oldPosition, 1);
418
- ownerSource.splice(newPosition, 0, item);
419
- this.resumeUpdates(false);
420
- if (callEvents) {
421
- this._callItemReorderedEvent(oldPosition, newPosition, item);
422
- }
423
- }
424
- shouldMoveItemAtIndex(index) {
425
- if (!this.reorderEnabled) {
426
- return false;
427
- }
428
- const item = this.getItemAtIndex(index);
429
- const view = (this.draggingView = this.getViewForItemAtIndex(index));
430
- let args = {
431
- returnValue: true,
432
- eventName: CollectionViewBase_1.itemReorderStartingEvent,
433
- object: this,
434
- index,
435
- item,
436
- view
437
- };
438
- this.notify(args);
439
- if (!args.returnValue) {
440
- return false;
441
- }
442
- args = {
443
- eventName: CollectionViewBase_1.itemReorderStartedEvent,
444
- object: this,
445
- index,
446
- item,
447
- view
448
- };
449
- this.notify(args);
450
- return true;
451
- }
452
- };
453
- CollectionViewBase.itemLoadingEvent = 'itemLoading';
454
- CollectionViewBase.itemRecyclingEvent = 'itemRecycling';
455
- CollectionViewBase.itemDisposingEvent = 'itemDisposing';
456
- CollectionViewBase.bindedEvent = 'binded';
457
- CollectionViewBase.scrollEvent = 'scroll';
458
- CollectionViewBase.scrollStartEvent = 'scrollStart';
459
- CollectionViewBase.scrollEndEvent = 'scrollEnd';
460
- CollectionViewBase.itemTapEvent = 'itemTap';
461
- CollectionViewBase.displayItemEvent = 'displayItem';
462
- CollectionViewBase.itemReorderedEvent = 'itemReordered';
463
- CollectionViewBase.itemReorderStartingEvent = 'itemReorderStarting';
464
- CollectionViewBase.itemReorderStartedEvent = 'itemReorderStarted';
465
- CollectionViewBase.loadMoreItemsEvent = 'loadMoreItems';
466
- CollectionViewBase.dataPopulatedEvent = 'dataPopulated';
467
- CollectionViewBase.knownFunctions = ['itemTemplateSelector', 'itemIdGenerator', 'spanSize']; // See component-builder.ts isKnownFunction
468
- CollectionViewBase.plugins = {};
469
- CollectionViewBase.layoutStyles = {};
470
- __decorate([
471
- profile
472
- ], CollectionViewBase.prototype, "_prepareItem", null);
473
- __decorate([
474
- profile
475
- ], CollectionViewBase.prototype, "notifyLoading", null);
476
- __decorate([
477
- profile
478
- ], CollectionViewBase.prototype, "onItemIdGeneratorChanged", null);
479
- __decorate([
480
- profile
481
- ], CollectionViewBase.prototype, "onItemTemplatesChanged", null);
482
- __decorate([
483
- profile
484
- ], CollectionViewBase.prototype, "onItemsChanged", null);
485
- __decorate([
486
- profile
487
- ], CollectionViewBase.prototype, "onSourceCollectionChanged", null);
488
- __decorate([
489
- profile
490
- ], CollectionViewBase.prototype, "onSourceCollectionChangedInternal", null);
491
- CollectionViewBase = CollectionViewBase_1 = __decorate([
492
- CSSType('CollectionView')
493
- ], CollectionViewBase);
494
- export { CollectionViewBase };
495
- const defaultRowHeight = 'auto';
496
- export const rowHeightProperty = new Property({
497
- name: 'rowHeight',
498
- defaultValue: defaultRowHeight,
499
- equalityComparer: PercentLength.equals,
500
- valueConverter: PercentLength.parse,
501
- valueChanged: (target, oldValue, newValue) => {
502
- if (target._innerHeight !== 0) {
503
- target._effectiveRowHeight = PercentLength.toDevicePixels(newValue, autoEffectiveRowHeight, target._innerHeight);
504
- target._onRowHeightPropertyChanged(oldValue, newValue);
505
- }
506
- }
507
- });
508
- rowHeightProperty.register(CollectionViewBase);
509
- const defaultColWidth = { unit: '%', value: 1 };
510
- export const colWidthProperty = new Property({
511
- name: 'colWidth',
512
- defaultValue: defaultColWidth,
513
- equalityComparer: PercentLength.equals,
514
- valueConverter: PercentLength.parse,
515
- valueChanged: (target, oldValue, newValue) => {
516
- if (target._innerWidth !== 0) {
517
- target._effectiveColWidth = PercentLength.toDevicePixels(newValue, autoEffectiveColWidth, target._innerWidth);
518
- target._onColWidthPropertyChanged(oldValue, newValue);
519
- }
520
- }
521
- });
522
- colWidthProperty.register(CollectionViewBase);
523
- const converter = makeParser(makeValidator('horizontal', 'vertical'));
524
- export const orientationProperty = new Property({
525
- name: 'orientation',
526
- defaultValue: 'vertical',
527
- affectsLayout: true,
528
- valueChanged: (target, oldValue, newValue) => {
529
- target.refresh();
530
- },
531
- valueConverter: converter
532
- });
533
- orientationProperty.register(CollectionViewBase);
534
- export const itemTemplateProperty = new Property({
535
- name: 'itemTemplate',
536
- valueChanged(target, oldValue, newValue) {
537
- target.onItemTemplateChanged(oldValue, newValue);
538
- }
539
- });
540
- itemTemplateProperty.register(CollectionViewBase);
541
- export const itemTemplatesProperty = new Property({
542
- name: 'itemTemplates',
543
- valueConverter: (value) => {
544
- if (typeof value === 'string') {
545
- return Builder.parseMultipleTemplates(value);
546
- }
547
- return value;
548
- },
549
- valueChanged(target, oldValue, newValue) {
550
- target.onItemTemplatesChanged(oldValue, newValue);
551
- }
552
- });
553
- itemTemplatesProperty.register(CollectionViewBase);
554
- export const itemTemplateSelectorProperty = new Property({
555
- name: 'itemTemplateSelector',
556
- defaultValue: undefined,
557
- valueChanged(target, oldValue, newValue) {
558
- target.onItemTemplateSelectorChanged(oldValue, newValue);
559
- }
560
- });
561
- itemTemplateSelectorProperty.register(CollectionViewBase);
562
- export const itemIdGeneratorProperty = new Property({
563
- name: 'itemIdGenerator',
564
- defaultValue: undefined,
565
- valueChanged(target, oldValue, newValue) {
566
- target.onItemIdGeneratorChanged(oldValue, newValue);
567
- }
568
- });
569
- itemIdGeneratorProperty.register(CollectionViewBase);
570
- export const itemsProperty = new Property({
571
- name: 'items',
572
- defaultValue: undefined,
573
- valueChanged(target, oldValue, newValue) {
574
- target.onItemsChanged(oldValue, newValue);
575
- }
576
- });
577
- itemsProperty.register(CollectionViewBase);
578
- export const spanSizeProperty = new Property({
579
- name: 'spanSize',
580
- defaultValue: undefined,
581
- valueChanged(target, oldValue, newValue) {
582
- target.onSpanSizeChanged(oldValue, newValue);
583
- }
584
- });
585
- spanSizeProperty.register(CollectionViewBase);
586
- export const isScrollEnabledProperty = new Property({
587
- name: 'isScrollEnabled',
588
- defaultValue: true,
589
- valueConverter: booleanConverter
590
- });
591
- isScrollEnabledProperty.register(CollectionViewBase);
592
- export const isBounceEnabledProperty = new Property({
593
- name: 'isBounceEnabled',
594
- defaultValue: true,
595
- valueConverter: booleanConverter
596
- });
597
- isBounceEnabledProperty.register(CollectionViewBase);
598
- export const reverseLayoutProperty = new Property({
599
- name: 'reverseLayout',
600
- defaultValue: false,
601
- valueConverter: booleanConverter
602
- });
603
- reverseLayoutProperty.register(CollectionViewBase);
604
- export const loadMoreThresholdProperty = new Property({
605
- name: 'loadMoreThreshold',
606
- defaultValue: 1,
607
- valueConverter: (v) => parseInt(v, 10)
608
- });
609
- loadMoreThresholdProperty.register(CollectionViewBase);
610
- export const reorderingEnabledProperty = new Property({
611
- name: 'reorderEnabled',
612
- defaultValue: false,
613
- valueConverter: booleanConverter
614
- });
615
- reorderingEnabledProperty.register(CollectionViewBase);
616
- export const reorderLongPressEnabledProperty = new Property({
617
- name: 'reorderLongPressEnabled',
618
- defaultValue: false,
619
- valueConverter: booleanConverter
620
- });
621
- reorderLongPressEnabledProperty.register(CollectionViewBase);
622
- export const scrollBarIndicatorVisibleProperty = new Property({
623
- name: 'scrollBarIndicatorVisible',
624
- defaultValue: true,
625
- valueConverter: booleanConverter
626
- });
627
- scrollBarIndicatorVisibleProperty.register(CollectionViewBase);
628
- export const autoReloadItemOnLayoutProperty = new Property({
629
- name: 'autoReloadItemOnLayout',
630
- defaultValue: false,
631
- valueConverter: booleanConverter
632
- });
633
- autoReloadItemOnLayoutProperty.register(CollectionViewBase);
634
- function parseThickness(value) {
635
- if (typeof value === 'string') {
636
- const arr = value.split(/[ ,]+/);
637
- let top;
638
- let right;
639
- let bottom;
640
- let left;
641
- if (arr.length === 1) {
642
- top = arr[0];
643
- right = arr[0];
644
- bottom = arr[0];
645
- left = arr[0];
646
- }
647
- else if (arr.length === 2) {
648
- top = arr[0];
649
- bottom = arr[0];
650
- right = arr[1];
651
- left = arr[1];
652
- }
653
- else if (arr.length === 3) {
654
- top = arr[0];
655
- right = arr[1];
656
- left = arr[1];
657
- bottom = arr[2];
658
- }
659
- else if (arr.length === 4) {
660
- top = arr[0];
661
- right = arr[1];
662
- bottom = arr[2];
663
- left = arr[3];
664
- }
665
- else {
666
- throw new Error('Expected 1, 2, 3 or 4 parameters. Actual: ' + value);
667
- }
668
- return {
669
- top,
670
- right,
671
- bottom,
672
- left
673
- };
674
- }
675
- else {
676
- return value;
677
- }
678
- }
679
- export const itemOverlapProperty = new Property({
680
- name: 'itemOverlap',
681
- valueConverter: (value) => {
682
- if (typeof value === 'string' && value !== 'auto') {
683
- const thickness = parseThickness(value);
684
- return [Length.parse(thickness.top), Length.parse(thickness.right), Length.parse(thickness.bottom), Length.parse(thickness.left)];
685
- }
686
- else {
687
- return [value, value, value, value];
688
- }
689
- }
690
- });
691
- itemOverlapProperty.register(CollectionViewBase);
692
- //# sourceMappingURL=index-common.js.map