@nstudio/ui-collectionview 5.1.9-alpha.4 → 5.1.9

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 (39) hide show
  1. package/angular/collectionview.component.d.ts +8 -33
  2. package/angular/{fesm2020 → fesm2022}/nstudio-ui-collectionview-angular.mjs +58 -151
  3. package/angular/fesm2022/nstudio-ui-collectionview-angular.mjs.map +1 -0
  4. package/angular/index.d.ts +2 -2
  5. package/angular/package.json +2 -10
  6. package/common.d.ts +28 -66
  7. package/common.js +96 -138
  8. package/common.js.map +1 -1
  9. package/index.android.d.ts +38 -19
  10. package/index.android.js +448 -158
  11. package/index.android.js.map +1 -1
  12. package/index.d.ts +49 -16
  13. package/index.ios.d.ts +83 -28
  14. package/index.ios.js +589 -375
  15. package/index.ios.js.map +1 -1
  16. package/package.json +5 -2
  17. package/react/index.d.ts +1 -1
  18. package/react/index.js.map +1 -1
  19. package/svelte/index.d.ts +0 -1
  20. package/svelte/index.js +11 -7
  21. package/svelte/index.js.map +1 -1
  22. package/vue3/component.d.ts +36 -0
  23. package/vue3/component.js +98 -0
  24. package/vue3/component.js.map +1 -0
  25. package/vue3/index.d.ts +11 -0
  26. package/vue3/index.js +14 -0
  27. package/vue3/index.js.map +1 -0
  28. package/angular/esm2020/collectionview.component.mjs +0 -497
  29. package/angular/esm2020/index.mjs +0 -19
  30. package/angular/esm2020/nstudio-ui-collectionview-angular.mjs +0 -5
  31. package/angular/fesm2015/nstudio-ui-collectionview-angular.mjs +0 -528
  32. package/angular/fesm2015/nstudio-ui-collectionview-angular.mjs.map +0 -1
  33. package/angular/fesm2020/nstudio-ui-collectionview-angular.mjs.map +0 -1
  34. package/vue/component.d.ts +0 -38
  35. package/vue/component.js +0 -104
  36. package/vue/component.js.map +0 -1
  37. package/vue/index.d.ts +0 -4
  38. package/vue/index.js +0 -12
  39. package/vue/index.js.map +0 -1
package/common.d.ts CHANGED
@@ -1,19 +1,6 @@
1
- import { ChangedData, CoreTypes, EventData, KeyedTemplate, Label, ObservableArray, Property, Template, View } from '@nativescript/core';
2
- import { CollectionView as CollectionViewDefinition } from '.';
1
+ import { ChangedData, CoreTypes, ItemsSource, KeyedTemplate, Label, Property, Template, View } from '@nativescript/core';
2
+ import { CollectionView as CollectionViewDefinition, Orientation } from '.';
3
3
  export declare const CollectionViewTraceCategory = "NativescriptCollectionView";
4
- export interface CollectionViewItemEventData extends EventData {
5
- eventName: string;
6
- object: CollectionViewBase;
7
- index: number;
8
- view: View;
9
- item: any;
10
- bindingContext?: any;
11
- }
12
- export interface CollectionViewItemDisplayEventData extends EventData {
13
- eventName: string;
14
- object: CollectionViewBase;
15
- index: number;
16
- }
17
4
  export declare enum ContentInsetAdjustmentBehavior {
18
5
  Always = 0,
19
6
  Automatic = 1,
@@ -21,28 +8,14 @@ export declare enum ContentInsetAdjustmentBehavior {
21
8
  ScrollableAxes = 3
22
9
  }
23
10
  export declare enum CLogTypes {
24
- log,
25
- info,
26
- warning,
27
- error
11
+ log = 0,
12
+ info = 1,
13
+ warning = 2,
14
+ error = 3
28
15
  }
29
16
  export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
30
- /**
31
- * Defines the different view types that {@link RadListView} can display in various scenarios.
32
- */
33
- export declare enum ViewTemplateType {
34
- /**
35
- * Identifies a view created using the {@link headerItemTemplate} value.
36
- */
37
- Header = "ns_default_header",
38
- /**
39
- * Identifies a view created using the {@link footerItemTemplate} value.
40
- */
41
- Footer = "ns_default_footer",
42
- /**
43
- * Identifies a view created using the {@link itemTemplate} value.
44
- */
45
- Item = "ns_default_item"
17
+ export declare enum ListViewViewTypes {
18
+ ItemView = 0
46
19
  }
47
20
  export declare namespace knownTemplates {
48
21
  const itemTemplate = "itemTemplate";
@@ -52,8 +25,8 @@ export declare namespace knownMultiTemplates {
52
25
  }
53
26
  export interface Plugin {
54
27
  onLayout?: Function;
28
+ onMeasure?: Function;
55
29
  }
56
- export declare function getUUID(): any;
57
30
  export declare abstract class CollectionViewBase extends View implements CollectionViewDefinition {
58
31
  static itemLoadingEvent: string;
59
32
  static itemRecyclingEvent: string;
@@ -67,6 +40,7 @@ export declare abstract class CollectionViewBase extends View implements Collect
67
40
  static itemHighlightEndEvent: string;
68
41
  static displayItemEvent: string;
69
42
  static itemReorderedEvent: string;
43
+ static itemReorderCheckEvent: string;
70
44
  static itemReorderStartingEvent: string;
71
45
  static itemReorderStartedEvent: string;
72
46
  static loadMoreItemsEvent: string;
@@ -74,23 +48,17 @@ export declare abstract class CollectionViewBase extends View implements Collect
74
48
  static knownFunctions: string[];
75
49
  isBounceEnabled: boolean;
76
50
  isScrollEnabled: boolean;
77
- isAnimationEnabled: boolean;
78
51
  reverseLayout: boolean;
79
- loadingMore: boolean;
80
- orientation: CoreTypes.OrientationType;
52
+ orientation: Orientation;
81
53
  itemTemplate: string | Template;
82
54
  itemTemplates: string | KeyedTemplate[];
83
- headerKey: string;
84
- headerItemTemplate: string | Template;
85
- headerPinned: boolean;
86
- footerKey: string;
87
- footerItemTemplate: string | Template;
88
- sectionTemplate: string;
89
55
  isItemsSourceIn: boolean;
90
56
  rowHeight: CoreTypes.PercentLengthType;
91
57
  colWidth: CoreTypes.PercentLengthType;
92
58
  verticalSpacing: CoreTypes.LengthType;
93
59
  horizontalSpacing: CoreTypes.LengthType;
60
+ spanSize: (item: any, index: number) => number;
61
+ itemOverlap: (item: any, index: number) => [number, number, number, number];
94
62
  _innerWidth: number;
95
63
  _innerHeight: number;
96
64
  _effectiveRowHeight: number;
@@ -105,10 +73,6 @@ export declare abstract class CollectionViewBase extends View implements Collect
105
73
  reorderLongPressEnabled: boolean;
106
74
  protected _dataUpdatesSuspended: boolean;
107
75
  scrollBarIndicatorVisible: boolean;
108
- sections: Array<{
109
- identifier: string;
110
- key: string;
111
- }>;
112
76
  layoutStyle: string;
113
77
  plugins: string[];
114
78
  static plugins: {
@@ -117,26 +81,29 @@ export declare abstract class CollectionViewBase extends View implements Collect
117
81
  static registerPlugin(key: string, plugin: Plugin): void;
118
82
  static layoutStyles: {
119
83
  [k: string]: {
120
- createLayout: (view: CollectionViewBase) => any;
121
- createDelegate?: (view: CollectionViewBase) => any;
84
+ createLayout: Function;
85
+ createDelegate?: Function;
122
86
  };
123
87
  };
124
88
  static registerLayoutStyle(style: string, generator: {
125
- createLayout: (view: CollectionViewBase) => any;
126
- createDelegate?: (view: CollectionViewBase) => any;
89
+ createLayout: Function;
90
+ createDelegate?: Function;
127
91
  }): void;
128
92
  protected _itemTemplatesInternal: Map<string, KeyedTemplate>;
129
93
  protected _defaultTemplate: KeyedTemplate;
130
94
  constructor();
131
95
  notifyForItemAtIndex(eventName: string, view: View, index: number, bindingContext?: any, native?: any): void;
132
96
  abstract refresh(): any;
97
+ abstract eachChildAsync(callback: any): any;
133
98
  abstract refreshVisibleItems(): any;
134
99
  abstract isItemAtIndexVisible(index: number): any;
100
+ abstract findFirstVisibleItemIndex(): number;
101
+ abstract findLastVisibleItemIndex(): number;
135
102
  abstract scrollToIndex(index: number, animated: boolean): any;
136
103
  abstract scrollToOffset(value: number, animated?: boolean): any;
137
- protected updateInnerSize(): void;
104
+ protected updateInnerSize(): boolean;
138
105
  onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
139
- items: any[] | ObservableArray<any>;
106
+ items: any[] | ItemsSource;
140
107
  _prepareItem(view: View, index: number): any;
141
108
  notifyLoading(args: any): void;
142
109
  getItemAtIndex(index: number): any;
@@ -161,7 +128,7 @@ export declare abstract class CollectionViewBase extends View implements Collect
161
128
  resolveTemplateView(template: any): View;
162
129
  _getDefaultItemContent(): Label;
163
130
  getTemplateFromSelector(templateKey: any): KeyedTemplate;
164
- getViewForTemplateType(templateKey: string, templateType?: ViewTemplateType): any;
131
+ getViewForViewType(viewType: ListViewViewTypes, templateKey: string): any;
165
132
  private _itemTemplateSelectorBindable;
166
133
  _itemTemplateSelector: Function;
167
134
  onItemTemplateSelectorChanged(oldValue: any, newValue: any): void;
@@ -174,14 +141,11 @@ export declare abstract class CollectionViewBase extends View implements Collect
174
141
  removeTemplate(key: any): void;
175
142
  onItemTemplatesChanged(oldValue: any, newValue: any): void;
176
143
  onItemTemplateChanged(oldValue: any, newValue: any): void;
177
- onHeaderItemTemplateChanged(oldValue: string | Template, newValue: string | Template): void;
178
- onFooterItemTemplateChanged(oldValue: string | Template, newValue: string | Template): void;
179
- onSupplementaryTemplateChanged(template: Template): void;
180
144
  getItemSourceAtIndex(index: number): any;
181
145
  getItemArrayAtIndex(index: number): any;
182
146
  onItemsChanged(oldValue: any, newValue: any): void;
183
- spanSize: (item: any, index: number) => number;
184
- onSpanSizeChangedInternal: (oldValue: any, newValue: any) => void;
147
+ onSpanSizeChanged: (oldValue: any, newValue: any) => void;
148
+ onItemOverlapChanged: (oldValue: any, newValue: any) => void;
185
149
  _isDataDirty: boolean;
186
150
  onLoaded(): void;
187
151
  onSourceCollectionChanged(event: ChangedData<any>): void;
@@ -193,27 +157,25 @@ export declare abstract class CollectionViewBase extends View implements Collect
193
157
  abstract startDragging(index: number): any;
194
158
  draggingView: View;
195
159
  _callItemReorderedEvent(oldPosition: any, newPosition: any, item: any): void;
160
+ _canReorderToPosition(oldPosition: any, newPosition: any, item: any): boolean;
196
161
  _reorderItemInSource(oldPosition: number, newPosition: number, callEvents?: boolean): void;
197
162
  shouldMoveItemAtIndex(index: number): boolean;
198
163
  }
199
164
  export declare const rowHeightProperty: Property<CollectionViewBase, CoreTypes.PercentLengthType>;
200
165
  export declare const colWidthProperty: Property<CollectionViewBase, CoreTypes.PercentLengthType>;
201
- export declare const orientationProperty: Property<CollectionViewBase, CoreTypes.OrientationType>;
166
+ export declare const orientationProperty: Property<CollectionViewBase, Orientation>;
202
167
  export declare const itemTemplateProperty: Property<CollectionViewBase, string | Template>;
203
168
  export declare const itemTemplatesProperty: Property<CollectionViewBase, KeyedTemplate[]>;
204
- export declare const headerItemTemplateProperty: Property<CollectionViewBase, string | Template>;
205
- export declare const footerItemTemplateProperty: Property<CollectionViewBase, string | Template>;
206
- export declare const sectionTemplateProperty: Property<CollectionViewBase, string | Template>;
207
169
  export declare const itemTemplateSelectorProperty: Property<CollectionViewBase, Function>;
208
170
  export declare const itemIdGeneratorProperty: Property<CollectionViewBase, Function>;
209
171
  export declare const itemsProperty: Property<CollectionViewBase, Function>;
210
172
  export declare const spanSizeProperty: Property<CollectionViewBase, Function>;
211
173
  export declare const isScrollEnabledProperty: Property<CollectionViewBase, boolean>;
212
174
  export declare const isBounceEnabledProperty: Property<CollectionViewBase, boolean>;
213
- export declare const isAnimationEnabledProperty: Property<CollectionViewBase, boolean>;
214
175
  export declare const reverseLayoutProperty: Property<CollectionViewBase, boolean>;
215
176
  export declare const loadMoreThresholdProperty: Property<CollectionViewBase, number>;
216
177
  export declare const reorderingEnabledProperty: Property<CollectionViewBase, boolean>;
217
178
  export declare const reorderLongPressEnabledProperty: Property<CollectionViewBase, boolean>;
218
179
  export declare const scrollBarIndicatorVisibleProperty: Property<CollectionViewBase, boolean>;
219
180
  export declare const autoReloadItemOnLayoutProperty: Property<CollectionViewBase, boolean>;
181
+ export declare const itemOverlapProperty: Property<CollectionViewBase, Function>;
package/common.js CHANGED
@@ -11,34 +11,21 @@ export var ContentInsetAdjustmentBehavior;
11
11
  })(ContentInsetAdjustmentBehavior || (ContentInsetAdjustmentBehavior = {}));
12
12
  export var CLogTypes;
13
13
  (function (CLogTypes) {
14
- CLogTypes[CLogTypes["log"] = Trace.messageType.log] = "log";
15
- CLogTypes[CLogTypes["info"] = Trace.messageType.info] = "info";
16
- CLogTypes[CLogTypes["warning"] = Trace.messageType.warn] = "warning";
17
- CLogTypes[CLogTypes["error"] = Trace.messageType.error] = "error";
14
+ CLogTypes[CLogTypes["log"] = 0] = "log";
15
+ CLogTypes[CLogTypes["info"] = 1] = "info";
16
+ CLogTypes[CLogTypes["warning"] = 2] = "warning";
17
+ CLogTypes[CLogTypes["error"] = 3] = "error";
18
18
  })(CLogTypes || (CLogTypes = {}));
19
19
  export const CLog = (type, ...args) => {
20
20
  Trace.write(args.map((a) => (a && typeof a === 'object' ? a.toString() : a)).join(' '), CollectionViewTraceCategory, type);
21
21
  };
22
22
  const autoEffectiveRowHeight = 0;
23
23
  const autoEffectiveColWidth = 0;
24
- /**
25
- * Defines the different view types that {@link RadListView} can display in various scenarios.
26
- */
27
- export var ViewTemplateType;
28
- (function (ViewTemplateType) {
29
- /**
30
- * Identifies a view created using the {@link headerItemTemplate} value.
31
- */
32
- ViewTemplateType["Header"] = "ns_default_header";
33
- /**
34
- * Identifies a view created using the {@link footerItemTemplate} value.
35
- */
36
- ViewTemplateType["Footer"] = "ns_default_footer";
37
- /**
38
- * Identifies a view created using the {@link itemTemplate} value.
39
- */
40
- ViewTemplateType["Item"] = "ns_default_item";
41
- })(ViewTemplateType || (ViewTemplateType = {}));
24
+ // export * from 'ui/core/view';
25
+ export var ListViewViewTypes;
26
+ (function (ListViewViewTypes) {
27
+ ListViewViewTypes[ListViewViewTypes["ItemView"] = 0] = "ItemView";
28
+ })(ListViewViewTypes || (ListViewViewTypes = {}));
42
29
  export var knownTemplates;
43
30
  (function (knownTemplates) {
44
31
  knownTemplates.itemTemplate = 'itemTemplate';
@@ -47,23 +34,6 @@ export var knownMultiTemplates;
47
34
  (function (knownMultiTemplates) {
48
35
  knownMultiTemplates.itemTemplates = 'itemTemplates';
49
36
  })(knownMultiTemplates || (knownMultiTemplates = {}));
50
- Builder.knownTemplates.add('itemTemplate').add('headerItemTemplate').add('footerItemTemplate');
51
- Builder.knownMultiTemplates.add('itemTemplates');
52
- export function getUUID() {
53
- var _a, _b;
54
- if (global.crypto === undefined) {
55
- (_a = global).crypto ?? (_a.crypto = {});
56
- (_b = global.crypto).randomUUID ?? (_b.randomUUID = function generateUUID() {
57
- if (global.isAndroid) {
58
- return java.util.UUID.randomUUID().toString();
59
- }
60
- if (global.isIOS) {
61
- return NSUUID.UUID().UUIDString;
62
- }
63
- });
64
- }
65
- return global.crypto.randomUUID();
66
- }
67
37
  function toDevicePixels(length, auto = Number.NaN, parentAvailableWidth = Number.NaN) {
68
38
  if (length === 'auto') {
69
39
  // tslint:disable-line
@@ -101,10 +71,14 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
101
71
  this.plugins = [];
102
72
  // public _itemIdGenerator: (item: any, index: number, items: any) => number = (_item: any, index: number) => index;
103
73
  this._itemIdGenerator = null;
104
- this.onSpanSizeChangedInternal = (oldValue, newValue) => {
74
+ this.onSpanSizeChanged = (oldValue, newValue) => {
105
75
  this.spanSize = newValue;
106
76
  this.refresh();
107
77
  };
78
+ this.onItemOverlapChanged = (oldValue, newValue) => {
79
+ this.itemOverlap = newValue;
80
+ this.refresh();
81
+ };
108
82
  this._isDataDirty = false;
109
83
  this._defaultTemplate = {
110
84
  key: 'default',
@@ -122,12 +96,17 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
122
96
  throw new Error('Method not implemented.');
123
97
  }
124
98
  updateInnerSize() {
99
+ const lastInnerWidth = this._innerWidth;
100
+ const lastInnerHeight = this._innerHeight;
125
101
  const width = this.getMeasuredWidth();
126
102
  const height = this.getMeasuredHeight();
103
+ if (width === 0 || height === 0) {
104
+ return false;
105
+ }
127
106
  this._innerWidth = width - this.effectivePaddingLeft - this.effectivePaddingRight;
128
107
  if (this.colWidth) {
129
108
  let newValue = toDevicePixels(this.colWidth, autoEffectiveColWidth, this._innerWidth); // We cannot use 0 for auto as it throws for android.
130
- if (global.isAndroid) {
109
+ if (__ANDROID__) {
131
110
  newValue = Math.floor(newValue);
132
111
  }
133
112
  if (newValue !== this._effectiveColWidth) {
@@ -137,24 +116,17 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
137
116
  this._innerHeight = height - this.effectivePaddingTop - this.effectivePaddingBottom;
138
117
  if (this.rowHeight) {
139
118
  let newValue = toDevicePixels(this.rowHeight, autoEffectiveRowHeight, this._innerHeight);
140
- if (global.isAndroid) {
119
+ if (__ANDROID__) {
141
120
  newValue = Math.floor(newValue);
142
121
  }
143
122
  if (newValue !== this._effectiveRowHeight) {
144
123
  this._effectiveRowHeight = newValue;
145
124
  }
146
125
  }
126
+ return lastInnerWidth !== this._innerWidth || lastInnerHeight !== this._innerHeight;
147
127
  }
148
- // public onLayout(left: number, top: number, right: number, bottom: number) {
149
- // super.onLayout(left, top, right, bottom);
150
- // // on ios and during device rotation the getMeasuredWidth and getMeasuredHeight are wrong
151
- // // so we use left, top , right, bottom
152
- // this.updateInnerSize();
153
- // }
154
128
  onMeasure(widthMeasureSpec, heightMeasureSpec) {
155
129
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
156
- // on ios and during device rotation the getMeasuredWidth and getMeasuredHeight are wrong
157
- // so we use left, top , right, bottom
158
130
  this.updateInnerSize();
159
131
  }
160
132
  _prepareItem(view, index) {
@@ -261,35 +233,28 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
261
233
  if (this._itemTemplatesInternal.has(key)) {
262
234
  return this._itemTemplatesInternal.get(key);
263
235
  }
264
- return null;
236
+ return this._itemTemplatesInternal.get('default');
265
237
  }
266
- getViewForTemplateType(templateKey, templateType = ViewTemplateType.Item) {
238
+ getViewForViewType(viewType, templateKey) {
267
239
  let newView;
268
- // console.log('getViewForTemplateType - templateKey: ', templateKey, ' templateType: ', templateType);
269
- if (templateType) {
240
+ if (templateKey) {
270
241
  const template = this.getTemplateFromSelector(templateKey);
271
- // console.log('template:', template)
272
- if (template && template.createView) {
273
- newView = template.createView();
274
- }
242
+ newView = template.createView();
275
243
  }
276
244
  if (!newView && this._itemViewLoader !== undefined) {
277
- // console.log('...using _itemViewLoader...')
278
- newView = this._itemViewLoader(templateType);
245
+ newView = this._itemViewLoader(templateKey);
279
246
  }
280
247
  if (newView) {
281
248
  return newView;
282
249
  }
283
250
  let templateString;
284
- switch (templateType) {
285
- case ViewTemplateType.Item:
251
+ switch (viewType) {
252
+ case ListViewViewTypes.ItemView:
286
253
  templateString = this.itemTemplate;
287
- break;
288
- case ViewTemplateType.Header:
289
- templateString = this.headerItemTemplate;
290
- break;
291
- case ViewTemplateType.Footer:
292
- templateString = this.footerItemTemplate;
254
+ if (templateString === undefined) {
255
+ return undefined;
256
+ // return this._getDefaultItemContent();
257
+ }
293
258
  break;
294
259
  }
295
260
  return templateString === undefined ? undefined : this.resolveTemplateView(templateString);
@@ -351,17 +316,13 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
351
316
  }
352
317
  }
353
318
  onItemTemplatesChanged(oldValue, newValue) {
354
- console.log('onItemTemplatesChanged:', newValue);
355
- if (!this._itemTemplatesInternal) {
356
- this._itemTemplatesInternal = new Map();
357
- }
319
+ this._itemTemplatesInternal = new Map();
358
320
  if (newValue) {
359
321
  newValue.forEach((t) => {
360
322
  if (!t.key) {
361
323
  t.key = t._key;
362
324
  delete t._key;
363
325
  }
364
- console.log('t.key:', t.key);
365
326
  this._itemTemplatesInternal.set(t.key, t);
366
327
  });
367
328
  }
@@ -369,40 +330,10 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
369
330
  this._itemTemplatesInternal.set(this._defaultTemplate.key, this._defaultTemplate);
370
331
  }
371
332
  }
372
- onItemTemplateChanged(oldValue, newValue) {
373
- // console.log('onItemTemplateChanged:', newValue)
374
- }
333
+ onItemTemplateChanged(oldValue, newValue) { }
375
334
  // onItemTemplateSelectorPropertyChanged(oldValue, newValue) {
376
335
  // this.onItemTemplateSelectorChanged(oldValue, newValue);
377
336
  // }
378
- onHeaderItemTemplateChanged(oldValue, newValue) {
379
- this.onSupplementaryTemplateChanged(newValue);
380
- // if (this.headerKey) {
381
- // console.log('onHeaderItemTemplateChanged this.headerKey:', this.headerKey)
382
- // if (!this._itemTemplatesInternal.has(this.headerKey)) {
383
- // this._itemTemplatesInternal.set(this.headerKey, {
384
- // key: this.headerKey,
385
- // createView: () => {
386
- // if (this.headerItemTemplate) {
387
- // return Builder.parse(this.headerItemTemplate, this);
388
- // }
389
- // return undefined;
390
- // }
391
- // });
392
- // }
393
- // }
394
- }
395
- onFooterItemTemplateChanged(oldValue, newValue) {
396
- this.onSupplementaryTemplateChanged(newValue);
397
- }
398
- onSupplementaryTemplateChanged(template) {
399
- // if (typeof template !== 'string') {
400
- // const key = template.key.toLowerCase();
401
- // if (!this._itemTemplatesInternal.has(key)) {
402
- // this._itemTemplatesInternal.set(key, template);
403
- // }
404
- // }
405
- }
406
337
  getItemSourceAtIndex(index) {
407
338
  return this.items.getItem(index);
408
339
  }
@@ -469,6 +400,19 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
469
400
  this.notify(args);
470
401
  this.draggingView = null;
471
402
  }
403
+ _canReorderToPosition(oldPosition, newPosition, item) {
404
+ const args = {
405
+ returnValue: true,
406
+ eventName: CollectionViewBase_1.itemReorderCheckEvent,
407
+ object: this,
408
+ index: oldPosition,
409
+ item,
410
+ data: { targetIndex: newPosition },
411
+ view: this.draggingView
412
+ };
413
+ this.notify(args);
414
+ return args.returnValue;
415
+ }
472
416
  _reorderItemInSource(oldPosition, newPosition, callEvents = true) {
473
417
  this.suspendUpdates();
474
418
  const ownerSource = this.items;
@@ -481,9 +425,9 @@ let CollectionViewBase = CollectionViewBase_1 = class CollectionViewBase extends
481
425
  }
482
426
  }
483
427
  shouldMoveItemAtIndex(index) {
484
- if (!this.reorderEnabled) {
485
- return false;
486
- }
428
+ // if (!this.reorderEnabled) {
429
+ // return false;
430
+ // }
487
431
  const item = this.getItemAtIndex(index);
488
432
  const view = (this.draggingView = this.getViewForItemAtIndex(index));
489
433
  let args = {
@@ -521,6 +465,7 @@ CollectionViewBase.itemHighlightEvent = 'itemHighlight';
521
465
  CollectionViewBase.itemHighlightEndEvent = 'itemHighlightEnd';
522
466
  CollectionViewBase.displayItemEvent = 'displayItem';
523
467
  CollectionViewBase.itemReorderedEvent = 'itemReordered';
468
+ CollectionViewBase.itemReorderCheckEvent = 'itemReorderCheck';
524
469
  CollectionViewBase.itemReorderStartingEvent = 'itemReorderStarting';
525
470
  CollectionViewBase.itemReorderStartedEvent = 'itemReorderStarted';
526
471
  CollectionViewBase.loadMoreItemsEvent = 'loadMoreItems';
@@ -540,6 +485,36 @@ __decorate([
540
485
  __metadata("design:paramtypes", [Object]),
541
486
  __metadata("design:returntype", void 0)
542
487
  ], CollectionViewBase.prototype, "notifyLoading", null);
488
+ __decorate([
489
+ profile,
490
+ __metadata("design:type", Function),
491
+ __metadata("design:paramtypes", [Object, Object]),
492
+ __metadata("design:returntype", void 0)
493
+ ], CollectionViewBase.prototype, "onItemIdGeneratorChanged", null);
494
+ __decorate([
495
+ profile,
496
+ __metadata("design:type", Function),
497
+ __metadata("design:paramtypes", [Object, Object]),
498
+ __metadata("design:returntype", void 0)
499
+ ], CollectionViewBase.prototype, "onItemTemplatesChanged", null);
500
+ __decorate([
501
+ profile,
502
+ __metadata("design:type", Function),
503
+ __metadata("design:paramtypes", [Object, Object]),
504
+ __metadata("design:returntype", void 0)
505
+ ], CollectionViewBase.prototype, "onItemsChanged", null);
506
+ __decorate([
507
+ profile,
508
+ __metadata("design:type", Function),
509
+ __metadata("design:paramtypes", [Object]),
510
+ __metadata("design:returntype", void 0)
511
+ ], CollectionViewBase.prototype, "onSourceCollectionChanged", null);
512
+ __decorate([
513
+ profile,
514
+ __metadata("design:type", Function),
515
+ __metadata("design:paramtypes", [Object]),
516
+ __metadata("design:returntype", void 0)
517
+ ], CollectionViewBase.prototype, "onSourceCollectionChangedInternal", null);
543
518
  CollectionViewBase = CollectionViewBase_1 = __decorate([
544
519
  CSSType('CollectionView'),
545
520
  __metadata("design:paramtypes", [])
@@ -552,8 +527,10 @@ export const rowHeightProperty = new Property({
552
527
  equalityComparer: PercentLength.equals,
553
528
  valueConverter: PercentLength.parse,
554
529
  valueChanged: (target, oldValue, newValue) => {
555
- target._effectiveRowHeight = PercentLength.toDevicePixels(newValue, autoEffectiveRowHeight, target._innerHeight);
556
- target._onRowHeightPropertyChanged(oldValue, newValue);
530
+ if (target._innerHeight !== 0) {
531
+ target._effectiveRowHeight = PercentLength.toDevicePixels(newValue, autoEffectiveRowHeight, target._innerHeight);
532
+ target._onRowHeightPropertyChanged(oldValue, newValue);
533
+ }
557
534
  }
558
535
  });
559
536
  rowHeightProperty.register(CollectionViewBase);
@@ -566,8 +543,8 @@ export const colWidthProperty = new Property({
566
543
  valueChanged: (target, oldValue, newValue) => {
567
544
  if (target._innerWidth !== 0) {
568
545
  target._effectiveColWidth = PercentLength.toDevicePixels(newValue, autoEffectiveColWidth, target._innerWidth);
546
+ target._onColWidthPropertyChanged(oldValue, newValue);
569
547
  }
570
- target._onColWidthPropertyChanged(oldValue, newValue);
571
548
  }
572
549
  });
573
550
  colWidthProperty.register(CollectionViewBase);
@@ -602,27 +579,6 @@ export const itemTemplatesProperty = new Property({
602
579
  }
603
580
  });
604
581
  itemTemplatesProperty.register(CollectionViewBase);
605
- export const headerItemTemplateProperty = new Property({
606
- name: "headerItemTemplate",
607
- defaultValue: undefined,
608
- valueChanged(target, oldValue, newValue) {
609
- target.onHeaderItemTemplateChanged(oldValue, newValue);
610
- }
611
- });
612
- headerItemTemplateProperty.register(CollectionViewBase);
613
- export const footerItemTemplateProperty = new Property({
614
- name: "footerItemTemplate",
615
- defaultValue: undefined,
616
- valueChanged(target, oldValue, newValue) {
617
- target.onFooterItemTemplateChanged(oldValue, newValue);
618
- }
619
- });
620
- footerItemTemplateProperty.register(CollectionViewBase);
621
- export const sectionTemplateProperty = new Property({
622
- name: "sectionTemplate",
623
- defaultValue: undefined,
624
- });
625
- sectionTemplateProperty.register(CollectionViewBase);
626
582
  export const itemTemplateSelectorProperty = new Property({
627
583
  name: 'itemTemplateSelector',
628
584
  defaultValue: undefined,
@@ -651,7 +607,7 @@ export const spanSizeProperty = new Property({
651
607
  name: 'spanSize',
652
608
  defaultValue: undefined,
653
609
  valueChanged(target, oldValue, newValue) {
654
- target.onSpanSizeChangedInternal(oldValue, newValue);
610
+ target.onSpanSizeChanged(oldValue, newValue);
655
611
  }
656
612
  });
657
613
  spanSizeProperty.register(CollectionViewBase);
@@ -667,12 +623,6 @@ export const isBounceEnabledProperty = new Property({
667
623
  valueConverter: booleanConverter
668
624
  });
669
625
  isBounceEnabledProperty.register(CollectionViewBase);
670
- export const isAnimationEnabledProperty = new Property({
671
- name: 'isAnimationEnabled',
672
- defaultValue: true,
673
- valueConverter: booleanConverter
674
- });
675
- isAnimationEnabledProperty.register(CollectionViewBase);
676
626
  export const reverseLayoutProperty = new Property({
677
627
  name: 'reverseLayout',
678
628
  defaultValue: false,
@@ -709,4 +659,12 @@ export const autoReloadItemOnLayoutProperty = new Property({
709
659
  valueConverter: booleanConverter
710
660
  });
711
661
  autoReloadItemOnLayoutProperty.register(CollectionViewBase);
662
+ export const itemOverlapProperty = new Property({
663
+ name: 'itemOverlap',
664
+ defaultValue: undefined,
665
+ valueChanged(target, oldValue, newValue) {
666
+ target.onItemOverlapChanged(oldValue, newValue);
667
+ }
668
+ });
669
+ itemOverlapProperty.register(CollectionViewBase);
712
670
  //# sourceMappingURL=common.js.map