@react-stately/collections 3.0.0-alpha.1 → 3.0.0-nightly-4980928d3-240906
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/README.md +1 -1
- package/dist/CollectionBuilder.main.js +210 -0
- package/dist/CollectionBuilder.main.js.map +1 -0
- package/dist/CollectionBuilder.mjs +201 -0
- package/dist/CollectionBuilder.module.js +201 -0
- package/dist/CollectionBuilder.module.js.map +1 -0
- package/dist/Item.main.js +68 -0
- package/dist/Item.main.js.map +1 -0
- package/dist/Item.mjs +59 -0
- package/dist/Item.module.js +59 -0
- package/dist/Item.module.js.map +1 -0
- package/dist/Section.main.js +60 -0
- package/dist/Section.main.js.map +1 -0
- package/dist/Section.mjs +51 -0
- package/dist/Section.module.js +51 -0
- package/dist/Section.module.js.map +1 -0
- package/dist/getChildNodes.main.js +80 -0
- package/dist/getChildNodes.main.js.map +1 -0
- package/dist/getChildNodes.mjs +71 -0
- package/dist/getChildNodes.module.js +71 -0
- package/dist/getChildNodes.module.js.map +1 -0
- package/dist/getItemCount.main.js +35 -0
- package/dist/getItemCount.main.js.map +1 -0
- package/dist/getItemCount.mjs +30 -0
- package/dist/getItemCount.module.js +30 -0
- package/dist/getItemCount.module.js.map +1 -0
- package/dist/import.mjs +27 -0
- package/dist/main.js +24 -4427
- package/dist/main.js.map +1 -0
- package/dist/module.js +9 -2881
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +22 -577
- package/dist/types.d.ts.map +1 -1
- package/dist/useCollection.main.js +44 -0
- package/dist/useCollection.main.js.map +1 -0
- package/dist/useCollection.mjs +39 -0
- package/dist/useCollection.module.js +39 -0
- package/dist/useCollection.module.js.map +1 -0
- package/package.json +16 -8
- package/src/CollectionBuilder.ts +275 -0
- package/src/Item.ts +80 -0
- package/src/Section.ts +59 -0
- package/src/getChildNodes.ts +92 -0
- package/src/getItemCount.ts +38 -0
- package/src/index.ts +19 -0
- package/src/types.ts +31 -0
- package/src/useCollection.ts +34 -0
- package/LICENSE +0 -201
package/dist/main.js
CHANGED
|
@@ -1,3536 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _babelRuntimeHelpersAssertThisInitialized = $parcel$interopDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
24
|
-
|
|
25
|
-
var _babelRuntimeHelpersPossibleConstructorReturn = $parcel$interopDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
26
|
-
|
|
27
|
-
var _babelRuntimeHelpersGetPrototypeOf = $parcel$interopDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
28
|
-
|
|
29
|
-
var _babelRuntimeHelpersInherits = $parcel$interopDefault(require("@babel/runtime/helpers/inherits"));
|
|
30
|
-
|
|
31
|
-
var _babelRuntimeHelpersAsyncToGenerator = $parcel$interopDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
32
|
-
|
|
33
|
-
var _babelRuntimeHelpersObjectWithoutProperties = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
34
|
-
|
|
35
|
-
function $parcel$interopDefault(a) {
|
|
36
|
-
return a && a.__esModule ? a.default : a;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function $f0b055f01f903c465271926009358f36$var$_createForOfIteratorHelper(o) {
|
|
40
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
41
|
-
if (Array.isArray(o) || (o = $f0b055f01f903c465271926009358f36$var$_unsupportedIterableToArray(o))) {
|
|
42
|
-
var i = 0;
|
|
43
|
-
|
|
44
|
-
var F = function F() {};
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
s: F,
|
|
48
|
-
n: function n() {
|
|
49
|
-
if (i >= o.length) return {
|
|
50
|
-
done: true
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
done: false,
|
|
54
|
-
value: o[i++]
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
e: function e(_e) {
|
|
58
|
-
throw _e;
|
|
59
|
-
},
|
|
60
|
-
f: F
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var it,
|
|
68
|
-
normalCompletion = true,
|
|
69
|
-
didErr = false,
|
|
70
|
-
err;
|
|
71
|
-
return {
|
|
72
|
-
s: function s() {
|
|
73
|
-
it = o[Symbol.iterator]();
|
|
74
|
-
},
|
|
75
|
-
n: function n() {
|
|
76
|
-
var step = it.next();
|
|
77
|
-
normalCompletion = step.done;
|
|
78
|
-
return step;
|
|
79
|
-
},
|
|
80
|
-
e: function e(_e2) {
|
|
81
|
-
didErr = true;
|
|
82
|
-
err = _e2;
|
|
83
|
-
},
|
|
84
|
-
f: function f() {
|
|
85
|
-
try {
|
|
86
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
87
|
-
} finally {
|
|
88
|
-
if (didErr) throw err;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function $f0b055f01f903c465271926009358f36$var$_unsupportedIterableToArray(o, minLen) {
|
|
95
|
-
if (!o) return;
|
|
96
|
-
if (typeof o === "string") return $f0b055f01f903c465271926009358f36$var$_arrayLikeToArray(o, minLen);
|
|
97
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
98
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
99
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
100
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $f0b055f01f903c465271926009358f36$var$_arrayLikeToArray(o, minLen);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function $f0b055f01f903c465271926009358f36$var$_arrayLikeToArray(arr, len) {
|
|
104
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
105
|
-
|
|
106
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
107
|
-
arr2[i] = arr[i];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return arr2;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
var CollectionBuilder = /*#__PURE__*/function () {
|
|
114
|
-
function CollectionBuilder(itemKey) {
|
|
115
|
-
_babelRuntimeHelpersClassCallCheck(this, CollectionBuilder);
|
|
116
|
-
|
|
117
|
-
_babelRuntimeHelpersDefineProperty(this, "itemKey", void 0);
|
|
118
|
-
|
|
119
|
-
_babelRuntimeHelpersDefineProperty(this, "cache", new Map());
|
|
120
|
-
|
|
121
|
-
_babelRuntimeHelpersDefineProperty(this, "getItemStates", void 0);
|
|
122
|
-
|
|
123
|
-
this.itemKey = itemKey;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
_babelRuntimeHelpersCreateClass(CollectionBuilder, [{
|
|
127
|
-
key: "build",
|
|
128
|
-
value: function build(props, getItemStates) {
|
|
129
|
-
var _this = this;
|
|
130
|
-
|
|
131
|
-
this.getItemStates = getItemStates || function () {
|
|
132
|
-
return {};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
return $f0b055f01f903c465271926009358f36$var$iterable(function () {
|
|
136
|
-
return _this.iterateCollection(props);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
key: "iterateCollection",
|
|
141
|
-
value: /*#__PURE__*/_babelRuntimeRegenerator.mark(function iterateCollection(props) {
|
|
142
|
-
var children, items, _iterator, _step, item, _items, _iterator2, _step2, _item;
|
|
143
|
-
|
|
144
|
-
return _babelRuntimeRegenerator.wrap(function iterateCollection$(_context) {
|
|
145
|
-
while (1) {
|
|
146
|
-
switch (_context.prev = _context.next) {
|
|
147
|
-
case 0:
|
|
148
|
-
children = props.children, items = props.items;
|
|
149
|
-
|
|
150
|
-
if (!(typeof children === 'function')) {
|
|
151
|
-
_context.next = 23;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (items) {
|
|
156
|
-
_context.next = 4;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
throw new Error('props.children was a function but props.items is missing');
|
|
161
|
-
|
|
162
|
-
case 4:
|
|
163
|
-
_iterator = $f0b055f01f903c465271926009358f36$var$_createForOfIteratorHelper(props.items);
|
|
164
|
-
_context.prev = 5;
|
|
165
|
-
|
|
166
|
-
_iterator.s();
|
|
167
|
-
|
|
168
|
-
case 7:
|
|
169
|
-
if ((_step = _iterator.n()).done) {
|
|
170
|
-
_context.next = 13;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
item = _step.value;
|
|
175
|
-
_context.next = 11;
|
|
176
|
-
return this.getFullNode({
|
|
177
|
-
value: item
|
|
178
|
-
}, children);
|
|
179
|
-
|
|
180
|
-
case 11:
|
|
181
|
-
_context.next = 7;
|
|
182
|
-
break;
|
|
183
|
-
|
|
184
|
-
case 13:
|
|
185
|
-
_context.next = 18;
|
|
186
|
-
break;
|
|
187
|
-
|
|
188
|
-
case 15:
|
|
189
|
-
_context.prev = 15;
|
|
190
|
-
_context.t0 = _context["catch"](5);
|
|
191
|
-
|
|
192
|
-
_iterator.e(_context.t0);
|
|
193
|
-
|
|
194
|
-
case 18:
|
|
195
|
-
_context.prev = 18;
|
|
196
|
-
|
|
197
|
-
_iterator.f();
|
|
198
|
-
|
|
199
|
-
return _context.finish(18);
|
|
200
|
-
|
|
201
|
-
case 21:
|
|
202
|
-
_context.next = 41;
|
|
203
|
-
break;
|
|
204
|
-
|
|
205
|
-
case 23:
|
|
206
|
-
_items = _react.Children.toArray(children);
|
|
207
|
-
_iterator2 = $f0b055f01f903c465271926009358f36$var$_createForOfIteratorHelper(_items);
|
|
208
|
-
_context.prev = 25;
|
|
209
|
-
|
|
210
|
-
_iterator2.s();
|
|
211
|
-
|
|
212
|
-
case 27:
|
|
213
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
214
|
-
_context.next = 33;
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
_item = _step2.value;
|
|
219
|
-
_context.next = 31;
|
|
220
|
-
return this.getFullNode({
|
|
221
|
-
element: _item
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
case 31:
|
|
225
|
-
_context.next = 27;
|
|
226
|
-
break;
|
|
227
|
-
|
|
228
|
-
case 33:
|
|
229
|
-
_context.next = 38;
|
|
230
|
-
break;
|
|
231
|
-
|
|
232
|
-
case 35:
|
|
233
|
-
_context.prev = 35;
|
|
234
|
-
_context.t1 = _context["catch"](25);
|
|
235
|
-
|
|
236
|
-
_iterator2.e(_context.t1);
|
|
237
|
-
|
|
238
|
-
case 38:
|
|
239
|
-
_context.prev = 38;
|
|
240
|
-
|
|
241
|
-
_iterator2.f();
|
|
242
|
-
|
|
243
|
-
return _context.finish(38);
|
|
244
|
-
|
|
245
|
-
case 41:
|
|
246
|
-
case "end":
|
|
247
|
-
return _context.stop();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}, iterateCollection, this, [[5, 15, 18, 21], [25, 35, 38, 41]]);
|
|
251
|
-
})
|
|
252
|
-
}, {
|
|
253
|
-
key: "getKey",
|
|
254
|
-
value: function getKey(item, value, parentKey) {
|
|
255
|
-
if (item.props.uniqueKey) {
|
|
256
|
-
return item.props.uniqueKey;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (item.key) {
|
|
260
|
-
return parentKey ? "".concat(parentKey).concat(item.key) : item.key;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (this.itemKey && value[this.itemKey]) {
|
|
264
|
-
return value[this.itemKey];
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
var v = value;
|
|
268
|
-
var key = v.key || v.id;
|
|
269
|
-
|
|
270
|
-
if (key == null) {
|
|
271
|
-
throw new Error('No key found for item');
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return key;
|
|
275
|
-
}
|
|
276
|
-
}, {
|
|
277
|
-
key: "getCached",
|
|
278
|
-
value: function getCached(item) {
|
|
279
|
-
var node = this.cache.get(item);
|
|
280
|
-
|
|
281
|
-
if (!node) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (node.type === 'section') {
|
|
286
|
-
return node;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
var states = this.getItemStates(node.key);
|
|
290
|
-
|
|
291
|
-
if ($f0b055f01f903c465271926009358f36$var$shallowEqual(states, node)) {
|
|
292
|
-
return node;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}, {
|
|
296
|
-
key: "getFullNode",
|
|
297
|
-
value: function getFullNode(partialNode, renderer, parentKey, parentNode) {
|
|
298
|
-
// If there's a value instead of an element on the node, and a parent renderer function is available,
|
|
299
|
-
// use it to render an element for the value.
|
|
300
|
-
var element = partialNode.element;
|
|
301
|
-
|
|
302
|
-
if (!element && partialNode.value && renderer) {
|
|
303
|
-
var cached = this.getCached(partialNode.value);
|
|
304
|
-
|
|
305
|
-
if (cached) {
|
|
306
|
-
return cached;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
element = renderer(partialNode.value);
|
|
310
|
-
} // If there's an element with a getCollectionNode function on its type, then it's a supported component.
|
|
311
|
-
// Call this function to get a partial node, and recursively build a full node from there.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (element) {
|
|
315
|
-
var type = element.type;
|
|
316
|
-
|
|
317
|
-
if (typeof type !== 'function' || typeof type.getCollectionNode !== 'function') {
|
|
318
|
-
var name = typeof element.type === 'function' ? element.type.name : element.type;
|
|
319
|
-
throw new Error("Unknown element <".concat(name, "> in collection."));
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
var childNode = type.getCollectionNode(element.props);
|
|
323
|
-
|
|
324
|
-
var _node = this.getFullNode(_babelRuntimeHelpersObjectSpread({}, childNode, {
|
|
325
|
-
key: childNode.element ? null : this.getKey(element, partialNode.value, parentKey),
|
|
326
|
-
wrapper: $f0b055f01f903c465271926009358f36$var$compose(partialNode.wrapper, childNode.wrapper)
|
|
327
|
-
}), childNode.renderer || renderer, parentKey ? "".concat(parentKey).concat(element.key) : element.key, parentNode); // Cache the node based on its value
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
_node.value = childNode.value || partialNode.value;
|
|
331
|
-
|
|
332
|
-
if (_node.value) {
|
|
333
|
-
this.cache.set(_node.value, _node);
|
|
334
|
-
} // The partial node may have specified a type for the child in order to specify a constraint.
|
|
335
|
-
// Verify that the full node that was built recursively matches this type.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (partialNode.type && _node.type !== partialNode.type) {
|
|
339
|
-
throw new Error("Unsupported type <".concat($f0b055f01f903c465271926009358f36$var$capitalize(_node.type), "> in <").concat($f0b055f01f903c465271926009358f36$var$capitalize(parentNode.type), ">. Only <").concat($f0b055f01f903c465271926009358f36$var$capitalize(partialNode.type), "> is supported."));
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return _node;
|
|
343
|
-
} // Create full node
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
var builder = this;
|
|
347
|
-
var node = {
|
|
348
|
-
type: partialNode.type,
|
|
349
|
-
props: partialNode.props,
|
|
350
|
-
key: partialNode.key,
|
|
351
|
-
parentKey: parentNode ? parentNode.key : null,
|
|
352
|
-
value: partialNode.value,
|
|
353
|
-
level: parentNode ? parentNode.level + 1 : 0,
|
|
354
|
-
rendered: partialNode.rendered,
|
|
355
|
-
textValue: partialNode.textValue,
|
|
356
|
-
'aria-label': partialNode['aria-label'],
|
|
357
|
-
wrapper: partialNode.wrapper,
|
|
358
|
-
hasChildNodes: partialNode.hasChildNodes,
|
|
359
|
-
childNodes: $f0b055f01f903c465271926009358f36$var$iterable( /*#__PURE__*/_babelRuntimeRegenerator.mark(function _callee() {
|
|
360
|
-
var _iterator3, _step3, child;
|
|
361
|
-
|
|
362
|
-
return _babelRuntimeRegenerator.wrap(function _callee$(_context2) {
|
|
363
|
-
while (1) {
|
|
364
|
-
switch (_context2.prev = _context2.next) {
|
|
365
|
-
case 0:
|
|
366
|
-
_iterator3 = $f0b055f01f903c465271926009358f36$var$_createForOfIteratorHelper(partialNode.childNodes());
|
|
367
|
-
_context2.prev = 1;
|
|
368
|
-
|
|
369
|
-
_iterator3.s();
|
|
370
|
-
|
|
371
|
-
case 3:
|
|
372
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
373
|
-
_context2.next = 9;
|
|
374
|
-
break;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
child = _step3.value;
|
|
378
|
-
_context2.next = 7;
|
|
379
|
-
return builder.getFullNode(child, child.renderer || renderer, parentKey, node);
|
|
380
|
-
|
|
381
|
-
case 7:
|
|
382
|
-
_context2.next = 3;
|
|
383
|
-
break;
|
|
384
|
-
|
|
385
|
-
case 9:
|
|
386
|
-
_context2.next = 14;
|
|
387
|
-
break;
|
|
388
|
-
|
|
389
|
-
case 11:
|
|
390
|
-
_context2.prev = 11;
|
|
391
|
-
_context2.t0 = _context2["catch"](1);
|
|
392
|
-
|
|
393
|
-
_iterator3.e(_context2.t0);
|
|
394
|
-
|
|
395
|
-
case 14:
|
|
396
|
-
_context2.prev = 14;
|
|
397
|
-
|
|
398
|
-
_iterator3.f();
|
|
399
|
-
|
|
400
|
-
return _context2.finish(14);
|
|
401
|
-
|
|
402
|
-
case 17:
|
|
403
|
-
case "end":
|
|
404
|
-
return _context2.stop();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}, _callee, null, [[1, 11, 14, 17]]);
|
|
408
|
-
}))
|
|
409
|
-
}; // Add states if the node is an item
|
|
410
|
-
|
|
411
|
-
if (node.type === 'item') {
|
|
412
|
-
Object.assign(node, this.getItemStates(node.key));
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return node;
|
|
416
|
-
}
|
|
417
|
-
}]);
|
|
418
|
-
|
|
419
|
-
return CollectionBuilder;
|
|
420
|
-
}(); // Wraps an iterator function as an iterable object.
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
exports.CollectionBuilder = CollectionBuilder;
|
|
424
|
-
|
|
425
|
-
function $f0b055f01f903c465271926009358f36$var$iterable(iterator) {
|
|
426
|
-
return _babelRuntimeHelpersDefineProperty({}, Symbol.iterator, iterator);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function $f0b055f01f903c465271926009358f36$var$shallowEqual(a, b) {
|
|
430
|
-
for (var _key in a) {
|
|
431
|
-
if (a[_key] !== b[_key]) {
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
function $f0b055f01f903c465271926009358f36$var$compose(outer, inner) {
|
|
440
|
-
if (outer && inner) {
|
|
441
|
-
return function (element) {
|
|
442
|
-
return outer(inner(element));
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (outer) {
|
|
447
|
-
return outer;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (inner) {
|
|
451
|
-
return inner;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function $f0b055f01f903c465271926009358f36$var$capitalize(str) {
|
|
456
|
-
return str[0].toUpperCase() + str.slice(1);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function $e32293027966eeccf2ff17c1314c3189$var$_createForOfIteratorHelper(o) {
|
|
460
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
461
|
-
if (Array.isArray(o) || (o = $e32293027966eeccf2ff17c1314c3189$var$_unsupportedIterableToArray(o))) {
|
|
462
|
-
var i = 0;
|
|
463
|
-
|
|
464
|
-
var F = function F() {};
|
|
465
|
-
|
|
466
|
-
return {
|
|
467
|
-
s: F,
|
|
468
|
-
n: function n() {
|
|
469
|
-
if (i >= o.length) return {
|
|
470
|
-
done: true
|
|
471
|
-
};
|
|
472
|
-
return {
|
|
473
|
-
done: false,
|
|
474
|
-
value: o[i++]
|
|
475
|
-
};
|
|
476
|
-
},
|
|
477
|
-
e: function e(_e) {
|
|
478
|
-
throw _e;
|
|
479
|
-
},
|
|
480
|
-
f: F
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
var it,
|
|
488
|
-
normalCompletion = true,
|
|
489
|
-
didErr = false,
|
|
490
|
-
err;
|
|
491
|
-
return {
|
|
492
|
-
s: function s() {
|
|
493
|
-
it = o[Symbol.iterator]();
|
|
494
|
-
},
|
|
495
|
-
n: function n() {
|
|
496
|
-
var step = it.next();
|
|
497
|
-
normalCompletion = step.done;
|
|
498
|
-
return step;
|
|
499
|
-
},
|
|
500
|
-
e: function e(_e2) {
|
|
501
|
-
didErr = true;
|
|
502
|
-
err = _e2;
|
|
503
|
-
},
|
|
504
|
-
f: function f() {
|
|
505
|
-
try {
|
|
506
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
507
|
-
} finally {
|
|
508
|
-
if (didErr) throw err;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function $e32293027966eeccf2ff17c1314c3189$var$_unsupportedIterableToArray(o, minLen) {
|
|
515
|
-
if (!o) return;
|
|
516
|
-
if (typeof o === "string") return $e32293027966eeccf2ff17c1314c3189$var$_arrayLikeToArray(o, minLen);
|
|
517
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
518
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
519
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
520
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $e32293027966eeccf2ff17c1314c3189$var$_arrayLikeToArray(o, minLen);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
function $e32293027966eeccf2ff17c1314c3189$var$_arrayLikeToArray(arr, len) {
|
|
524
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
525
|
-
|
|
526
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
527
|
-
arr2[i] = arr[i];
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
return arr2;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
function $e32293027966eeccf2ff17c1314c3189$var$Item(props) {
|
|
534
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
535
|
-
return null;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
$e32293027966eeccf2ff17c1314c3189$var$Item.getCollectionNode = function (props) {
|
|
539
|
-
var childItems = props.childItems,
|
|
540
|
-
title = props.title,
|
|
541
|
-
children = props.children;
|
|
542
|
-
var rendered = props.title || props.children;
|
|
543
|
-
var textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';
|
|
544
|
-
|
|
545
|
-
if (!textValue) {
|
|
546
|
-
console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
return {
|
|
550
|
-
type: 'item',
|
|
551
|
-
props: props,
|
|
552
|
-
rendered: rendered,
|
|
553
|
-
textValue: textValue,
|
|
554
|
-
'aria-label': props['aria-label'],
|
|
555
|
-
hasChildNodes: $e32293027966eeccf2ff17c1314c3189$var$hasChildItems(props),
|
|
556
|
-
childNodes: /*#__PURE__*/_babelRuntimeRegenerator.mark(function childNodes() {
|
|
557
|
-
var _iterator, _step, child, items, _iterator2, _step2, item;
|
|
558
|
-
|
|
559
|
-
return _babelRuntimeRegenerator.wrap(function childNodes$(_context) {
|
|
560
|
-
while (1) {
|
|
561
|
-
switch (_context.prev = _context.next) {
|
|
562
|
-
case 0:
|
|
563
|
-
if (!childItems) {
|
|
564
|
-
_context.next = 20;
|
|
565
|
-
break;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
_iterator = $e32293027966eeccf2ff17c1314c3189$var$_createForOfIteratorHelper(childItems);
|
|
569
|
-
_context.prev = 2;
|
|
570
|
-
|
|
571
|
-
_iterator.s();
|
|
572
|
-
|
|
573
|
-
case 4:
|
|
574
|
-
if ((_step = _iterator.n()).done) {
|
|
575
|
-
_context.next = 10;
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
child = _step.value;
|
|
580
|
-
_context.next = 8;
|
|
581
|
-
return {
|
|
582
|
-
type: 'item',
|
|
583
|
-
value: child
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
case 8:
|
|
587
|
-
_context.next = 4;
|
|
588
|
-
break;
|
|
589
|
-
|
|
590
|
-
case 10:
|
|
591
|
-
_context.next = 15;
|
|
592
|
-
break;
|
|
593
|
-
|
|
594
|
-
case 12:
|
|
595
|
-
_context.prev = 12;
|
|
596
|
-
_context.t0 = _context["catch"](2);
|
|
597
|
-
|
|
598
|
-
_iterator.e(_context.t0);
|
|
599
|
-
|
|
600
|
-
case 15:
|
|
601
|
-
_context.prev = 15;
|
|
602
|
-
|
|
603
|
-
_iterator.f();
|
|
604
|
-
|
|
605
|
-
return _context.finish(15);
|
|
606
|
-
|
|
607
|
-
case 18:
|
|
608
|
-
_context.next = 39;
|
|
609
|
-
break;
|
|
610
|
-
|
|
611
|
-
case 20:
|
|
612
|
-
if (!title) {
|
|
613
|
-
_context.next = 39;
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
items = _react.Children.toArray(children);
|
|
618
|
-
_iterator2 = $e32293027966eeccf2ff17c1314c3189$var$_createForOfIteratorHelper(items);
|
|
619
|
-
_context.prev = 23;
|
|
620
|
-
|
|
621
|
-
_iterator2.s();
|
|
622
|
-
|
|
623
|
-
case 25:
|
|
624
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
625
|
-
_context.next = 31;
|
|
626
|
-
break;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
item = _step2.value;
|
|
630
|
-
_context.next = 29;
|
|
631
|
-
return {
|
|
632
|
-
type: 'item',
|
|
633
|
-
element: item
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
case 29:
|
|
637
|
-
_context.next = 25;
|
|
638
|
-
break;
|
|
639
|
-
|
|
640
|
-
case 31:
|
|
641
|
-
_context.next = 36;
|
|
642
|
-
break;
|
|
643
|
-
|
|
644
|
-
case 33:
|
|
645
|
-
_context.prev = 33;
|
|
646
|
-
_context.t1 = _context["catch"](23);
|
|
647
|
-
|
|
648
|
-
_iterator2.e(_context.t1);
|
|
649
|
-
|
|
650
|
-
case 36:
|
|
651
|
-
_context.prev = 36;
|
|
652
|
-
|
|
653
|
-
_iterator2.f();
|
|
654
|
-
|
|
655
|
-
return _context.finish(36);
|
|
656
|
-
|
|
657
|
-
case 39:
|
|
658
|
-
case "end":
|
|
659
|
-
return _context.stop();
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}, childNodes, null, [[2, 12, 15, 18], [23, 33, 36, 39]]);
|
|
663
|
-
})
|
|
664
|
-
};
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
function $e32293027966eeccf2ff17c1314c3189$var$hasChildItems(props) {
|
|
668
|
-
if (props.hasChildItems != null) {
|
|
669
|
-
return props.hasChildItems;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
if (props.childItems) {
|
|
673
|
-
return true;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
if (props.title && _react.Children.count(props.children) > 0) {
|
|
677
|
-
return true;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
return false;
|
|
681
|
-
} // We don't want getCollectionNode to show up in the type definition
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
var Item = $e32293027966eeccf2ff17c1314c3189$var$Item;
|
|
685
|
-
exports.Item = Item;
|
|
686
|
-
|
|
687
|
-
function $be4165049b08042f900cd19fb7d$var$_createForOfIteratorHelper(o) {
|
|
688
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
689
|
-
if (Array.isArray(o) || (o = $be4165049b08042f900cd19fb7d$var$_unsupportedIterableToArray(o))) {
|
|
690
|
-
var i = 0;
|
|
691
|
-
|
|
692
|
-
var F = function F() {};
|
|
693
|
-
|
|
694
|
-
return {
|
|
695
|
-
s: F,
|
|
696
|
-
n: function n() {
|
|
697
|
-
if (i >= o.length) return {
|
|
698
|
-
done: true
|
|
699
|
-
};
|
|
700
|
-
return {
|
|
701
|
-
done: false,
|
|
702
|
-
value: o[i++]
|
|
703
|
-
};
|
|
704
|
-
},
|
|
705
|
-
e: function e(_e) {
|
|
706
|
-
throw _e;
|
|
707
|
-
},
|
|
708
|
-
f: F
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
var it,
|
|
716
|
-
normalCompletion = true,
|
|
717
|
-
didErr = false,
|
|
718
|
-
err;
|
|
719
|
-
return {
|
|
720
|
-
s: function s() {
|
|
721
|
-
it = o[Symbol.iterator]();
|
|
722
|
-
},
|
|
723
|
-
n: function n() {
|
|
724
|
-
var step = it.next();
|
|
725
|
-
normalCompletion = step.done;
|
|
726
|
-
return step;
|
|
727
|
-
},
|
|
728
|
-
e: function e(_e2) {
|
|
729
|
-
didErr = true;
|
|
730
|
-
err = _e2;
|
|
731
|
-
},
|
|
732
|
-
f: function f() {
|
|
733
|
-
try {
|
|
734
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
735
|
-
} finally {
|
|
736
|
-
if (didErr) throw err;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
function $be4165049b08042f900cd19fb7d$var$_unsupportedIterableToArray(o, minLen) {
|
|
743
|
-
if (!o) return;
|
|
744
|
-
if (typeof o === "string") return $be4165049b08042f900cd19fb7d$var$_arrayLikeToArray(o, minLen);
|
|
745
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
746
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
747
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
748
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $be4165049b08042f900cd19fb7d$var$_arrayLikeToArray(o, minLen);
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
function $be4165049b08042f900cd19fb7d$var$_arrayLikeToArray(arr, len) {
|
|
752
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
753
|
-
|
|
754
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
755
|
-
arr2[i] = arr[i];
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
return arr2;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
function $be4165049b08042f900cd19fb7d$var$Section(props) {
|
|
762
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
763
|
-
return null;
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
$be4165049b08042f900cd19fb7d$var$Section.getCollectionNode = function (props) {
|
|
767
|
-
var children = props.children,
|
|
768
|
-
title = props.title,
|
|
769
|
-
items = props.items;
|
|
770
|
-
return {
|
|
771
|
-
type: 'section',
|
|
772
|
-
hasChildNodes: true,
|
|
773
|
-
rendered: title,
|
|
774
|
-
'aria-label': props['aria-label'],
|
|
775
|
-
childNodes: /*#__PURE__*/_babelRuntimeRegenerator.mark(function childNodes() {
|
|
776
|
-
var _iterator, _step, item, _items, _iterator2, _step2, _item;
|
|
777
|
-
|
|
778
|
-
return _babelRuntimeRegenerator.wrap(function childNodes$(_context) {
|
|
779
|
-
while (1) {
|
|
780
|
-
switch (_context.prev = _context.next) {
|
|
781
|
-
case 0:
|
|
782
|
-
if (!(typeof children === 'function')) {
|
|
783
|
-
_context.next = 22;
|
|
784
|
-
break;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
if (items) {
|
|
788
|
-
_context.next = 3;
|
|
789
|
-
break;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
throw new Error('props.children was a function but props.items is missing');
|
|
793
|
-
|
|
794
|
-
case 3:
|
|
795
|
-
_iterator = $be4165049b08042f900cd19fb7d$var$_createForOfIteratorHelper(items);
|
|
796
|
-
_context.prev = 4;
|
|
797
|
-
|
|
798
|
-
_iterator.s();
|
|
799
|
-
|
|
800
|
-
case 6:
|
|
801
|
-
if ((_step = _iterator.n()).done) {
|
|
802
|
-
_context.next = 12;
|
|
803
|
-
break;
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
item = _step.value;
|
|
807
|
-
_context.next = 10;
|
|
808
|
-
return {
|
|
809
|
-
type: 'item',
|
|
810
|
-
value: item,
|
|
811
|
-
renderer: children
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
case 10:
|
|
815
|
-
_context.next = 6;
|
|
816
|
-
break;
|
|
817
|
-
|
|
818
|
-
case 12:
|
|
819
|
-
_context.next = 17;
|
|
820
|
-
break;
|
|
821
|
-
|
|
822
|
-
case 14:
|
|
823
|
-
_context.prev = 14;
|
|
824
|
-
_context.t0 = _context["catch"](4);
|
|
825
|
-
|
|
826
|
-
_iterator.e(_context.t0);
|
|
827
|
-
|
|
828
|
-
case 17:
|
|
829
|
-
_context.prev = 17;
|
|
830
|
-
|
|
831
|
-
_iterator.f();
|
|
832
|
-
|
|
833
|
-
return _context.finish(17);
|
|
834
|
-
|
|
835
|
-
case 20:
|
|
836
|
-
_context.next = 40;
|
|
837
|
-
break;
|
|
838
|
-
|
|
839
|
-
case 22:
|
|
840
|
-
_items = _react.Children.toArray(children);
|
|
841
|
-
_iterator2 = $be4165049b08042f900cd19fb7d$var$_createForOfIteratorHelper(_items);
|
|
842
|
-
_context.prev = 24;
|
|
843
|
-
|
|
844
|
-
_iterator2.s();
|
|
845
|
-
|
|
846
|
-
case 26:
|
|
847
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
848
|
-
_context.next = 32;
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
_item = _step2.value;
|
|
853
|
-
_context.next = 30;
|
|
854
|
-
return {
|
|
855
|
-
type: 'item',
|
|
856
|
-
element: _item
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
case 30:
|
|
860
|
-
_context.next = 26;
|
|
861
|
-
break;
|
|
862
|
-
|
|
863
|
-
case 32:
|
|
864
|
-
_context.next = 37;
|
|
865
|
-
break;
|
|
866
|
-
|
|
867
|
-
case 34:
|
|
868
|
-
_context.prev = 34;
|
|
869
|
-
_context.t1 = _context["catch"](24);
|
|
870
|
-
|
|
871
|
-
_iterator2.e(_context.t1);
|
|
872
|
-
|
|
873
|
-
case 37:
|
|
874
|
-
_context.prev = 37;
|
|
875
|
-
|
|
876
|
-
_iterator2.f();
|
|
877
|
-
|
|
878
|
-
return _context.finish(37);
|
|
879
|
-
|
|
880
|
-
case 40:
|
|
881
|
-
case "end":
|
|
882
|
-
return _context.stop();
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
}, childNodes, null, [[4, 14, 17, 20], [24, 34, 37, 40]]);
|
|
886
|
-
})
|
|
887
|
-
};
|
|
888
|
-
}; // We don't want getCollectionNode to show up in the type definition
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
var Section = $be4165049b08042f900cd19fb7d$var$Section;
|
|
892
|
-
exports.Section = Section;
|
|
893
|
-
var $e8b61f67b726fce139496dd6e$var$_Symbol$iterator;
|
|
894
|
-
|
|
895
|
-
function $e8b61f67b726fce139496dd6e$var$_createForOfIteratorHelper(o) {
|
|
896
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
897
|
-
if (Array.isArray(o) || (o = $e8b61f67b726fce139496dd6e$var$_unsupportedIterableToArray(o))) {
|
|
898
|
-
var i = 0;
|
|
899
|
-
|
|
900
|
-
var F = function F() {};
|
|
901
|
-
|
|
902
|
-
return {
|
|
903
|
-
s: F,
|
|
904
|
-
n: function n() {
|
|
905
|
-
if (i >= o.length) return {
|
|
906
|
-
done: true
|
|
907
|
-
};
|
|
908
|
-
return {
|
|
909
|
-
done: false,
|
|
910
|
-
value: o[i++]
|
|
911
|
-
};
|
|
912
|
-
},
|
|
913
|
-
e: function e(_e) {
|
|
914
|
-
throw _e;
|
|
915
|
-
},
|
|
916
|
-
f: F
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
var it,
|
|
924
|
-
normalCompletion = true,
|
|
925
|
-
didErr = false,
|
|
926
|
-
err;
|
|
927
|
-
return {
|
|
928
|
-
s: function s() {
|
|
929
|
-
it = o[Symbol.iterator]();
|
|
930
|
-
},
|
|
931
|
-
n: function n() {
|
|
932
|
-
var step = it.next();
|
|
933
|
-
normalCompletion = step.done;
|
|
934
|
-
return step;
|
|
935
|
-
},
|
|
936
|
-
e: function e(_e2) {
|
|
937
|
-
didErr = true;
|
|
938
|
-
err = _e2;
|
|
939
|
-
},
|
|
940
|
-
f: function f() {
|
|
941
|
-
try {
|
|
942
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
943
|
-
} finally {
|
|
944
|
-
if (didErr) throw err;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
function $e8b61f67b726fce139496dd6e$var$_unsupportedIterableToArray(o, minLen) {
|
|
951
|
-
if (!o) return;
|
|
952
|
-
if (typeof o === "string") return $e8b61f67b726fce139496dd6e$var$_arrayLikeToArray(o, minLen);
|
|
953
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
954
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
955
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
956
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $e8b61f67b726fce139496dd6e$var$_arrayLikeToArray(o, minLen);
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
function $e8b61f67b726fce139496dd6e$var$_arrayLikeToArray(arr, len) {
|
|
960
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
961
|
-
|
|
962
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
963
|
-
arr2[i] = arr[i];
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
return arr2;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
$e8b61f67b726fce139496dd6e$var$_Symbol$iterator = Symbol.iterator;
|
|
970
|
-
/*
|
|
971
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
972
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
973
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
974
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
975
|
-
*
|
|
976
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
977
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
978
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
979
|
-
* governing permissions and limitations under the License.
|
|
980
|
-
*/
|
|
981
|
-
|
|
982
|
-
var TreeCollection = /*#__PURE__*/function () {
|
|
983
|
-
function TreeCollection(nodes) {
|
|
984
|
-
var _this = this;
|
|
985
|
-
|
|
986
|
-
_babelRuntimeHelpersClassCallCheck(this, TreeCollection);
|
|
987
|
-
|
|
988
|
-
_babelRuntimeHelpersDefineProperty(this, "keyMap", new Map());
|
|
989
|
-
|
|
990
|
-
_babelRuntimeHelpersDefineProperty(this, "iterable", void 0);
|
|
991
|
-
|
|
992
|
-
_babelRuntimeHelpersDefineProperty(this, "firstKey", void 0);
|
|
993
|
-
|
|
994
|
-
_babelRuntimeHelpersDefineProperty(this, "lastKey", void 0);
|
|
995
|
-
|
|
996
|
-
this.iterable = nodes;
|
|
997
|
-
|
|
998
|
-
var visit = function visit(node) {
|
|
999
|
-
_this.keyMap.set(node.key, node);
|
|
1000
|
-
|
|
1001
|
-
if (node.childNodes && (node.type === 'section' || node.isExpanded)) {
|
|
1002
|
-
var _iterator = $e8b61f67b726fce139496dd6e$var$_createForOfIteratorHelper(node.childNodes),
|
|
1003
|
-
_step;
|
|
1004
|
-
|
|
1005
|
-
try {
|
|
1006
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1007
|
-
var child = _step.value;
|
|
1008
|
-
visit(child);
|
|
1009
|
-
}
|
|
1010
|
-
} catch (err) {
|
|
1011
|
-
_iterator.e(err);
|
|
1012
|
-
} finally {
|
|
1013
|
-
_iterator.f();
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
};
|
|
1017
|
-
|
|
1018
|
-
var _iterator2 = $e8b61f67b726fce139496dd6e$var$_createForOfIteratorHelper(nodes),
|
|
1019
|
-
_step2;
|
|
1020
|
-
|
|
1021
|
-
try {
|
|
1022
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1023
|
-
var node = _step2.value;
|
|
1024
|
-
visit(node);
|
|
1025
|
-
}
|
|
1026
|
-
} catch (err) {
|
|
1027
|
-
_iterator2.e(err);
|
|
1028
|
-
} finally {
|
|
1029
|
-
_iterator2.f();
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
var last;
|
|
1033
|
-
var index = 0;
|
|
1034
|
-
|
|
1035
|
-
var _iterator3 = $e8b61f67b726fce139496dd6e$var$_createForOfIteratorHelper(this.keyMap),
|
|
1036
|
-
_step3;
|
|
1037
|
-
|
|
1038
|
-
try {
|
|
1039
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1040
|
-
var _step3$value = _babelRuntimeHelpersSlicedToArray(_step3.value, 2),
|
|
1041
|
-
key = _step3$value[0],
|
|
1042
|
-
_node = _step3$value[1];
|
|
1043
|
-
|
|
1044
|
-
if (last) {
|
|
1045
|
-
last.nextKey = key;
|
|
1046
|
-
_node.prevKey = last.key;
|
|
1047
|
-
} else {
|
|
1048
|
-
this.firstKey = key;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
if (_node.type === 'item') {
|
|
1052
|
-
_node.index = index++;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
last = _node;
|
|
1056
|
-
}
|
|
1057
|
-
} catch (err) {
|
|
1058
|
-
_iterator3.e(err);
|
|
1059
|
-
} finally {
|
|
1060
|
-
_iterator3.f();
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
this.lastKey = last.key;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
_babelRuntimeHelpersCreateClass(TreeCollection, [{
|
|
1067
|
-
key: $e8b61f67b726fce139496dd6e$var$_Symbol$iterator,
|
|
1068
|
-
value: /*#__PURE__*/_babelRuntimeRegenerator.mark(function value() {
|
|
1069
|
-
return _babelRuntimeRegenerator.wrap(function value$(_context) {
|
|
1070
|
-
while (1) {
|
|
1071
|
-
switch (_context.prev = _context.next) {
|
|
1072
|
-
case 0:
|
|
1073
|
-
return _context.delegateYield(this.iterable, "t0", 1);
|
|
1074
|
-
|
|
1075
|
-
case 1:
|
|
1076
|
-
case "end":
|
|
1077
|
-
return _context.stop();
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
}, value, this);
|
|
1081
|
-
})
|
|
1082
|
-
}, {
|
|
1083
|
-
key: "getKeys",
|
|
1084
|
-
value: function getKeys() {
|
|
1085
|
-
return this.keyMap.keys();
|
|
1086
|
-
}
|
|
1087
|
-
}, {
|
|
1088
|
-
key: "getKeyBefore",
|
|
1089
|
-
value: function getKeyBefore(key) {
|
|
1090
|
-
var node = this.keyMap.get(key);
|
|
1091
|
-
return node ? node.prevKey : null;
|
|
1092
|
-
}
|
|
1093
|
-
}, {
|
|
1094
|
-
key: "getKeyAfter",
|
|
1095
|
-
value: function getKeyAfter(key) {
|
|
1096
|
-
var node = this.keyMap.get(key);
|
|
1097
|
-
return node ? node.nextKey : null;
|
|
1098
|
-
}
|
|
1099
|
-
}, {
|
|
1100
|
-
key: "getFirstKey",
|
|
1101
|
-
value: function getFirstKey() {
|
|
1102
|
-
return this.firstKey;
|
|
1103
|
-
}
|
|
1104
|
-
}, {
|
|
1105
|
-
key: "getLastKey",
|
|
1106
|
-
value: function getLastKey() {
|
|
1107
|
-
return this.lastKey;
|
|
1108
|
-
}
|
|
1109
|
-
}, {
|
|
1110
|
-
key: "getItem",
|
|
1111
|
-
value: function getItem(key) {
|
|
1112
|
-
return this.keyMap.get(key);
|
|
1113
|
-
}
|
|
1114
|
-
}, {
|
|
1115
|
-
key: "size",
|
|
1116
|
-
get: function get() {
|
|
1117
|
-
return this.keyMap.size;
|
|
1118
|
-
}
|
|
1119
|
-
}]);
|
|
1120
|
-
|
|
1121
|
-
return TreeCollection;
|
|
1122
|
-
}();
|
|
1123
|
-
|
|
1124
|
-
exports.TreeCollection = TreeCollection;
|
|
1125
|
-
|
|
1126
|
-
/*
|
|
1127
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1128
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1129
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1130
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1131
|
-
*
|
|
1132
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1133
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1134
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1135
|
-
* governing permissions and limitations under the License.
|
|
1136
|
-
*/
|
|
1137
|
-
var Point = /*#__PURE__*/function () {
|
|
1138
|
-
/** The x-coordinate of the point */
|
|
1139
|
-
|
|
1140
|
-
/** The y-coordinate of the point */
|
|
1141
|
-
function Point() {
|
|
1142
|
-
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1143
|
-
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1144
|
-
|
|
1145
|
-
_babelRuntimeHelpersClassCallCheck(this, Point);
|
|
1146
|
-
|
|
1147
|
-
_babelRuntimeHelpersDefineProperty(this, "x", void 0);
|
|
1148
|
-
|
|
1149
|
-
_babelRuntimeHelpersDefineProperty(this, "y", void 0);
|
|
1150
|
-
|
|
1151
|
-
this.x = x;
|
|
1152
|
-
this.y = y;
|
|
1153
|
-
}
|
|
1154
|
-
/**
|
|
1155
|
-
* Returns a copy of this point
|
|
1156
|
-
*/
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
_babelRuntimeHelpersCreateClass(Point, [{
|
|
1160
|
-
key: "copy",
|
|
1161
|
-
value: function copy() {
|
|
1162
|
-
return new Point(this.x, this.y);
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
* Checks if two points are equal
|
|
1166
|
-
*/
|
|
1167
|
-
|
|
1168
|
-
}, {
|
|
1169
|
-
key: "equals",
|
|
1170
|
-
value: function equals(point) {
|
|
1171
|
-
return this.x === point.x && this.y === point.y;
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* Returns true if this point is the origin
|
|
1175
|
-
*/
|
|
1176
|
-
|
|
1177
|
-
}, {
|
|
1178
|
-
key: "isOrigin",
|
|
1179
|
-
value: function isOrigin() {
|
|
1180
|
-
return this.x === 0 && this.y === 0;
|
|
1181
|
-
}
|
|
1182
|
-
}]);
|
|
1183
|
-
|
|
1184
|
-
return Point;
|
|
1185
|
-
}();
|
|
1186
|
-
|
|
1187
|
-
exports.Point = Point;
|
|
1188
|
-
// use high res timer if available
|
|
1189
|
-
var $add44ef2cec72f417f488b48a8d5b207$var$perf = typeof window !== 'undefined' ? window.performance : null; // @ts-ignore
|
|
1190
|
-
|
|
1191
|
-
var $add44ef2cec72f417f488b48a8d5b207$var$perfNow = $add44ef2cec72f417f488b48a8d5b207$var$perf && ($add44ef2cec72f417f488b48a8d5b207$var$perf.now || $add44ef2cec72f417f488b48a8d5b207$var$perf.webkitNow || $add44ef2cec72f417f488b48a8d5b207$var$perf.msNow || $add44ef2cec72f417f488b48a8d5b207$var$perf.mozNow);
|
|
1192
|
-
var $add44ef2cec72f417f488b48a8d5b207$var$getTime = $add44ef2cec72f417f488b48a8d5b207$var$perfNow ? $add44ef2cec72f417f488b48a8d5b207$var$perfNow.bind($add44ef2cec72f417f488b48a8d5b207$var$perf) : function () {
|
|
1193
|
-
return Date.now ? Date.now() : new Date().getTime();
|
|
1194
|
-
}; // check if we need to get the time each frame (see below)
|
|
1195
|
-
|
|
1196
|
-
var $add44ef2cec72f417f488b48a8d5b207$var$fixTs = false;
|
|
1197
|
-
requestAnimationFrame(function (t) {
|
|
1198
|
-
$add44ef2cec72f417f488b48a8d5b207$var$fixTs = t > 1e12 !== $add44ef2cec72f417f488b48a8d5b207$var$getTime() > 1e12;
|
|
1199
|
-
});
|
|
1200
|
-
|
|
1201
|
-
function $add44ef2cec72f417f488b48a8d5b207$export$tween(begin, end, duration, ease, fn) {
|
|
1202
|
-
var canceled = false;
|
|
1203
|
-
var raf_id;
|
|
1204
|
-
var promise = new Promise(function (resolve) {
|
|
1205
|
-
var start = $add44ef2cec72f417f488b48a8d5b207$var$getTime();
|
|
1206
|
-
var diffX = end.x - begin.x;
|
|
1207
|
-
var diffY = end.y - begin.y;
|
|
1208
|
-
raf_id = requestAnimationFrame(function run(t) {
|
|
1209
|
-
// if we're using a high res timer, make sure timestamp is not the old epoch-based value.
|
|
1210
|
-
// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
|
|
1211
|
-
if ($add44ef2cec72f417f488b48a8d5b207$var$fixTs) {
|
|
1212
|
-
t = $add44ef2cec72f417f488b48a8d5b207$var$getTime();
|
|
1213
|
-
} // check if we're done
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
var delta = t - start;
|
|
1217
|
-
|
|
1218
|
-
if (delta > duration) {
|
|
1219
|
-
fn(end);
|
|
1220
|
-
resolve();
|
|
1221
|
-
} else {
|
|
1222
|
-
// call frame callback after computing eased time and get the next frame
|
|
1223
|
-
var proceed = fn(new Point(begin.x + diffX * ease(delta / duration), begin.y + diffY * ease(delta / duration)));
|
|
1224
|
-
|
|
1225
|
-
if (proceed !== false && !canceled) {
|
|
1226
|
-
raf_id = requestAnimationFrame(run);
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
});
|
|
1230
|
-
});
|
|
1231
|
-
|
|
1232
|
-
promise.cancel = function () {
|
|
1233
|
-
canceled = true;
|
|
1234
|
-
cancelAnimationFrame(raf_id);
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
return promise;
|
|
1238
|
-
} // easing functions
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
function $add44ef2cec72f417f488b48a8d5b207$export$easeOut(t) {
|
|
1242
|
-
return Math.sin(t * Math.PI / 2);
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
var $b4afb93e92e2405c0f5b02e067098ca1$var$_marked = /*#__PURE__*/_babelRuntimeRegenerator.mark($b4afb93e92e2405c0f5b02e067098ca1$export$concatIterators);
|
|
1246
|
-
|
|
1247
|
-
function $b4afb93e92e2405c0f5b02e067098ca1$var$_createForOfIteratorHelper(o) {
|
|
1248
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
1249
|
-
if (Array.isArray(o) || (o = $b4afb93e92e2405c0f5b02e067098ca1$var$_unsupportedIterableToArray(o))) {
|
|
1250
|
-
var i = 0;
|
|
1251
|
-
|
|
1252
|
-
var F = function F() {};
|
|
1253
|
-
|
|
1254
|
-
return {
|
|
1255
|
-
s: F,
|
|
1256
|
-
n: function n() {
|
|
1257
|
-
if (i >= o.length) return {
|
|
1258
|
-
done: true
|
|
1259
|
-
};
|
|
1260
|
-
return {
|
|
1261
|
-
done: false,
|
|
1262
|
-
value: o[i++]
|
|
1263
|
-
};
|
|
1264
|
-
},
|
|
1265
|
-
e: function e(_e) {
|
|
1266
|
-
throw _e;
|
|
1267
|
-
},
|
|
1268
|
-
f: F
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
var it,
|
|
1276
|
-
normalCompletion = true,
|
|
1277
|
-
didErr = false,
|
|
1278
|
-
err;
|
|
1279
|
-
return {
|
|
1280
|
-
s: function s() {
|
|
1281
|
-
it = o[Symbol.iterator]();
|
|
1282
|
-
},
|
|
1283
|
-
n: function n() {
|
|
1284
|
-
var step = it.next();
|
|
1285
|
-
normalCompletion = step.done;
|
|
1286
|
-
return step;
|
|
1287
|
-
},
|
|
1288
|
-
e: function e(_e2) {
|
|
1289
|
-
didErr = true;
|
|
1290
|
-
err = _e2;
|
|
1291
|
-
},
|
|
1292
|
-
f: function f() {
|
|
1293
|
-
try {
|
|
1294
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
1295
|
-
} finally {
|
|
1296
|
-
if (didErr) throw err;
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
function $b4afb93e92e2405c0f5b02e067098ca1$var$_unsupportedIterableToArray(o, minLen) {
|
|
1303
|
-
if (!o) return;
|
|
1304
|
-
if (typeof o === "string") return $b4afb93e92e2405c0f5b02e067098ca1$var$_arrayLikeToArray(o, minLen);
|
|
1305
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1306
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1307
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1308
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $b4afb93e92e2405c0f5b02e067098ca1$var$_arrayLikeToArray(o, minLen);
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
function $b4afb93e92e2405c0f5b02e067098ca1$var$_arrayLikeToArray(arr, len) {
|
|
1312
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1313
|
-
|
|
1314
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1315
|
-
arr2[i] = arr[i];
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
return arr2;
|
|
1319
|
-
}
|
|
1320
|
-
/*
|
|
1321
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1322
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1323
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1324
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1325
|
-
*
|
|
1326
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1327
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1328
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1329
|
-
* governing permissions and limitations under the License.
|
|
1330
|
-
*/
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
function $b4afb93e92e2405c0f5b02e067098ca1$export$keyDiff(a, b) {
|
|
1334
|
-
var res = new Set();
|
|
1335
|
-
|
|
1336
|
-
var _iterator = $b4afb93e92e2405c0f5b02e067098ca1$var$_createForOfIteratorHelper(a.keys()),
|
|
1337
|
-
_step;
|
|
1338
|
-
|
|
1339
|
-
try {
|
|
1340
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1341
|
-
var key = _step.value;
|
|
1342
|
-
|
|
1343
|
-
if (!b.has(key)) {
|
|
1344
|
-
res.add(key);
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
} catch (err) {
|
|
1348
|
-
_iterator.e(err);
|
|
1349
|
-
} finally {
|
|
1350
|
-
_iterator.f();
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
return res;
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Returns the key difference between two maps. Returns a set of
|
|
1357
|
-
* keys to add to and remove from a to make it equal to b.
|
|
1358
|
-
* @private
|
|
1359
|
-
*/
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
function $b4afb93e92e2405c0f5b02e067098ca1$export$difference(a, b) {
|
|
1363
|
-
var toRemove = $b4afb93e92e2405c0f5b02e067098ca1$export$keyDiff(a, b);
|
|
1364
|
-
var toAdd = $b4afb93e92e2405c0f5b02e067098ca1$export$keyDiff(b, a);
|
|
1365
|
-
var toUpdate = new Set();
|
|
1366
|
-
|
|
1367
|
-
var _iterator2 = $b4afb93e92e2405c0f5b02e067098ca1$var$_createForOfIteratorHelper(a.keys()),
|
|
1368
|
-
_step2;
|
|
1369
|
-
|
|
1370
|
-
try {
|
|
1371
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1372
|
-
var key = _step2.value;
|
|
1373
|
-
|
|
1374
|
-
if (b.has(key)) {
|
|
1375
|
-
toUpdate.add(key);
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
} catch (err) {
|
|
1379
|
-
_iterator2.e(err);
|
|
1380
|
-
} finally {
|
|
1381
|
-
_iterator2.f();
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
return {
|
|
1385
|
-
toRemove: toRemove,
|
|
1386
|
-
toAdd: toAdd,
|
|
1387
|
-
toUpdate: toUpdate
|
|
1388
|
-
};
|
|
1389
|
-
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Returns an iterator that yields the items in all of the given iterators.
|
|
1392
|
-
* @private
|
|
1393
|
-
*/
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
function $b4afb93e92e2405c0f5b02e067098ca1$export$concatIterators() {
|
|
1397
|
-
var _len,
|
|
1398
|
-
iterators,
|
|
1399
|
-
_key,
|
|
1400
|
-
_i,
|
|
1401
|
-
_iterators,
|
|
1402
|
-
iterator,
|
|
1403
|
-
_args = arguments;
|
|
1404
|
-
|
|
1405
|
-
return _babelRuntimeRegenerator.wrap(function concatIterators$(_context) {
|
|
1406
|
-
while (1) {
|
|
1407
|
-
switch (_context.prev = _context.next) {
|
|
1408
|
-
case 0:
|
|
1409
|
-
for (_len = _args.length, iterators = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1410
|
-
iterators[_key] = _args[_key];
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
_i = 0, _iterators = iterators;
|
|
1414
|
-
|
|
1415
|
-
case 2:
|
|
1416
|
-
if (!(_i < _iterators.length)) {
|
|
1417
|
-
_context.next = 8;
|
|
1418
|
-
break;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
iterator = _iterators[_i];
|
|
1422
|
-
return _context.delegateYield(iterator, "t0", 5);
|
|
1423
|
-
|
|
1424
|
-
case 5:
|
|
1425
|
-
_i++;
|
|
1426
|
-
_context.next = 2;
|
|
1427
|
-
break;
|
|
1428
|
-
|
|
1429
|
-
case 8:
|
|
1430
|
-
case "end":
|
|
1431
|
-
return _context.stop();
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
}, $b4afb93e92e2405c0f5b02e067098ca1$var$_marked);
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* Represents a rectangle
|
|
1439
|
-
*/
|
|
1440
|
-
var Rect = /*#__PURE__*/function () {
|
|
1441
|
-
/** The x-coordinate of the rectangle */
|
|
1442
|
-
|
|
1443
|
-
/** The y-coordinate of the rectangle */
|
|
1444
|
-
|
|
1445
|
-
/** The width of the rectangle */
|
|
1446
|
-
|
|
1447
|
-
/** The height of the rectangle */
|
|
1448
|
-
function Rect() {
|
|
1449
|
-
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1450
|
-
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1451
|
-
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1452
|
-
var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1453
|
-
|
|
1454
|
-
_babelRuntimeHelpersClassCallCheck(this, Rect);
|
|
1455
|
-
|
|
1456
|
-
_babelRuntimeHelpersDefineProperty(this, "x", void 0);
|
|
1457
|
-
|
|
1458
|
-
_babelRuntimeHelpersDefineProperty(this, "y", void 0);
|
|
1459
|
-
|
|
1460
|
-
_babelRuntimeHelpersDefineProperty(this, "width", void 0);
|
|
1461
|
-
|
|
1462
|
-
_babelRuntimeHelpersDefineProperty(this, "height", void 0);
|
|
1463
|
-
|
|
1464
|
-
this.x = x;
|
|
1465
|
-
this.y = y;
|
|
1466
|
-
this.width = width;
|
|
1467
|
-
this.height = height;
|
|
1468
|
-
}
|
|
1469
|
-
/**
|
|
1470
|
-
* The maximum x-coordinate in the rectangle
|
|
1471
|
-
*/
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
_babelRuntimeHelpersCreateClass(Rect, [{
|
|
1475
|
-
key: "intersects",
|
|
1476
|
-
|
|
1477
|
-
/**
|
|
1478
|
-
* Returns whether this rectangle intersects another rectangle
|
|
1479
|
-
* @param rect - The rectangle to check
|
|
1480
|
-
*/
|
|
1481
|
-
value: function intersects(rect) {
|
|
1482
|
-
return this.x <= rect.x + rect.width && rect.x <= this.x + this.width && this.y <= rect.y + rect.height && rect.y <= this.y + this.height;
|
|
1483
|
-
}
|
|
1484
|
-
/**
|
|
1485
|
-
* Returns whether this rectangle fully contains another rectangle
|
|
1486
|
-
* @param rect - The rectangle to check
|
|
1487
|
-
*/
|
|
1488
|
-
|
|
1489
|
-
}, {
|
|
1490
|
-
key: "containsRect",
|
|
1491
|
-
value: function containsRect(rect) {
|
|
1492
|
-
return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;
|
|
1493
|
-
}
|
|
1494
|
-
/**
|
|
1495
|
-
* Returns whether the rectangle contains the given point
|
|
1496
|
-
* @param point - The point to check
|
|
1497
|
-
*/
|
|
1498
|
-
|
|
1499
|
-
}, {
|
|
1500
|
-
key: "containsPoint",
|
|
1501
|
-
value: function containsPoint(point) {
|
|
1502
|
-
return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;
|
|
1503
|
-
}
|
|
1504
|
-
/**
|
|
1505
|
-
* Returns the first corner of this rectangle (from top to bottom, left to right)
|
|
1506
|
-
* that is contained in the given rectangle, or null of the rectangles do not intersect.
|
|
1507
|
-
* @param rect - The rectangle to check
|
|
1508
|
-
*/
|
|
1509
|
-
|
|
1510
|
-
}, {
|
|
1511
|
-
key: "getCornerInRect",
|
|
1512
|
-
value: function getCornerInRect(rect) {
|
|
1513
|
-
for (var _i = 0, _arr = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']; _i < _arr.length; _i++) {
|
|
1514
|
-
var key = _arr[_i];
|
|
1515
|
-
|
|
1516
|
-
if (rect.containsPoint(this[key])) {
|
|
1517
|
-
return key;
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
return null;
|
|
1522
|
-
}
|
|
1523
|
-
}, {
|
|
1524
|
-
key: "equals",
|
|
1525
|
-
value: function equals(rect) {
|
|
1526
|
-
return rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
|
|
1527
|
-
}
|
|
1528
|
-
}, {
|
|
1529
|
-
key: "pointEquals",
|
|
1530
|
-
value: function pointEquals(point) {
|
|
1531
|
-
return this.x === point.x && this.y === point.y;
|
|
1532
|
-
}
|
|
1533
|
-
}, {
|
|
1534
|
-
key: "sizeEquals",
|
|
1535
|
-
value: function sizeEquals(size) {
|
|
1536
|
-
return this.width === size.width && this.height === size.height;
|
|
1537
|
-
}
|
|
1538
|
-
/**
|
|
1539
|
-
* Returns a copy of this rectangle
|
|
1540
|
-
*/
|
|
1541
|
-
|
|
1542
|
-
}, {
|
|
1543
|
-
key: "copy",
|
|
1544
|
-
value: function copy() {
|
|
1545
|
-
return new Rect(this.x, this.y, this.width, this.height);
|
|
1546
|
-
}
|
|
1547
|
-
}, {
|
|
1548
|
-
key: "maxX",
|
|
1549
|
-
get: function get() {
|
|
1550
|
-
return this.x + this.width;
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* The maximum y-coordinate in the rectangle
|
|
1554
|
-
*/
|
|
1555
|
-
|
|
1556
|
-
}, {
|
|
1557
|
-
key: "maxY",
|
|
1558
|
-
get: function get() {
|
|
1559
|
-
return this.y + this.height;
|
|
1560
|
-
}
|
|
1561
|
-
/**
|
|
1562
|
-
* The area of the rectangle
|
|
1563
|
-
*/
|
|
1564
|
-
|
|
1565
|
-
}, {
|
|
1566
|
-
key: "area",
|
|
1567
|
-
get: function get() {
|
|
1568
|
-
return this.width * this.height;
|
|
1569
|
-
}
|
|
1570
|
-
/**
|
|
1571
|
-
* The top left corner of the rectangle
|
|
1572
|
-
*/
|
|
1573
|
-
|
|
1574
|
-
}, {
|
|
1575
|
-
key: "topLeft",
|
|
1576
|
-
get: function get() {
|
|
1577
|
-
return new Point(this.x, this.y);
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* The top right corner of the rectangle
|
|
1581
|
-
*/
|
|
1582
|
-
|
|
1583
|
-
}, {
|
|
1584
|
-
key: "topRight",
|
|
1585
|
-
get: function get() {
|
|
1586
|
-
return new Point(this.maxX, this.y);
|
|
1587
|
-
}
|
|
1588
|
-
/**
|
|
1589
|
-
* The bottom left corner of the rectangle
|
|
1590
|
-
*/
|
|
1591
|
-
|
|
1592
|
-
}, {
|
|
1593
|
-
key: "bottomLeft",
|
|
1594
|
-
get: function get() {
|
|
1595
|
-
return new Point(this.x, this.maxY);
|
|
1596
|
-
}
|
|
1597
|
-
/**
|
|
1598
|
-
* The bottom right corner of the rectangle
|
|
1599
|
-
*/
|
|
1600
|
-
|
|
1601
|
-
}, {
|
|
1602
|
-
key: "bottomRight",
|
|
1603
|
-
get: function get() {
|
|
1604
|
-
return new Point(this.maxX, this.maxY);
|
|
1605
|
-
}
|
|
1606
|
-
}]);
|
|
1607
|
-
|
|
1608
|
-
return Rect;
|
|
1609
|
-
}();
|
|
1610
|
-
|
|
1611
|
-
exports.Rect = Rect;
|
|
1612
|
-
|
|
1613
|
-
var $e3e4feb35525992ec01972e76270426f$var$RollingAverage = /*#__PURE__*/function () {
|
|
1614
|
-
function RollingAverage() {
|
|
1615
|
-
_babelRuntimeHelpersClassCallCheck(this, RollingAverage);
|
|
1616
|
-
|
|
1617
|
-
_babelRuntimeHelpersDefineProperty(this, "count", 0);
|
|
1618
|
-
|
|
1619
|
-
_babelRuntimeHelpersDefineProperty(this, "value", 0);
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
_babelRuntimeHelpersCreateClass(RollingAverage, [{
|
|
1623
|
-
key: "addSample",
|
|
1624
|
-
value: function addSample(sample) {
|
|
1625
|
-
this.count++;
|
|
1626
|
-
this.value += (sample - this.value) / this.count;
|
|
1627
|
-
}
|
|
1628
|
-
}]);
|
|
1629
|
-
|
|
1630
|
-
return RollingAverage;
|
|
1631
|
-
}();
|
|
1632
|
-
|
|
1633
|
-
var $e3e4feb35525992ec01972e76270426f$export$OverscanManager = /*#__PURE__*/function () {
|
|
1634
|
-
function OverscanManager() {
|
|
1635
|
-
_babelRuntimeHelpersClassCallCheck(this, OverscanManager);
|
|
1636
|
-
|
|
1637
|
-
_babelRuntimeHelpersDefineProperty(this, "startTime", 0);
|
|
1638
|
-
|
|
1639
|
-
_babelRuntimeHelpersDefineProperty(this, "averagePerf", new $e3e4feb35525992ec01972e76270426f$var$RollingAverage());
|
|
1640
|
-
|
|
1641
|
-
_babelRuntimeHelpersDefineProperty(this, "averageTime", new $e3e4feb35525992ec01972e76270426f$var$RollingAverage());
|
|
1642
|
-
|
|
1643
|
-
_babelRuntimeHelpersDefineProperty(this, "velocity", new Point(5, 5));
|
|
1644
|
-
|
|
1645
|
-
_babelRuntimeHelpersDefineProperty(this, "overscanX", new $e3e4feb35525992ec01972e76270426f$var$RollingAverage());
|
|
1646
|
-
|
|
1647
|
-
_babelRuntimeHelpersDefineProperty(this, "overscanY", new $e3e4feb35525992ec01972e76270426f$var$RollingAverage());
|
|
1648
|
-
|
|
1649
|
-
_babelRuntimeHelpersDefineProperty(this, "visibleRect", new Rect());
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
_babelRuntimeHelpersCreateClass(OverscanManager, [{
|
|
1653
|
-
key: "setVisibleRect",
|
|
1654
|
-
value: function setVisibleRect(rect) {
|
|
1655
|
-
var time = performance.now() - this.startTime;
|
|
1656
|
-
|
|
1657
|
-
if (time < 500) {
|
|
1658
|
-
this.averageTime.addSample(time);
|
|
1659
|
-
|
|
1660
|
-
if (rect.y !== this.visibleRect.y && time > 0) {
|
|
1661
|
-
this.velocity.x = (rect.x - this.visibleRect.x) / time;
|
|
1662
|
-
this.velocity.y = (rect.y - this.visibleRect.y) / time;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
this.startTime = performance.now();
|
|
1667
|
-
this.visibleRect = rect;
|
|
1668
|
-
}
|
|
1669
|
-
}, {
|
|
1670
|
-
key: "collectMetrics",
|
|
1671
|
-
value: function collectMetrics() {
|
|
1672
|
-
var time = performance.now() - this.startTime;
|
|
1673
|
-
|
|
1674
|
-
if (time < 500) {
|
|
1675
|
-
this.averagePerf.addSample(time);
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
if (this.visibleRect.height > 0) {
|
|
1679
|
-
var o = Math.abs(this.velocity.y * (this.averageTime.value + this.averagePerf.value));
|
|
1680
|
-
this.overscanY.addSample(o);
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
if (this.visibleRect.width > 0) {
|
|
1684
|
-
var _o = Math.abs(this.velocity.x * (this.averageTime.value + this.averagePerf.value));
|
|
1685
|
-
|
|
1686
|
-
this.overscanX.addSample(_o);
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
}, {
|
|
1690
|
-
key: "getOverscannedRect",
|
|
1691
|
-
value: function getOverscannedRect() {
|
|
1692
|
-
var overscanned = this.visibleRect.copy();
|
|
1693
|
-
var overscanY = Math.round(Math.min(this.visibleRect.height * 2, this.overscanY.value) / 100) * 100;
|
|
1694
|
-
|
|
1695
|
-
if (this.velocity.y > 0) {
|
|
1696
|
-
overscanned.y -= overscanY * 0.2;
|
|
1697
|
-
overscanned.height += overscanY + overscanY * 0.2;
|
|
1698
|
-
} else {
|
|
1699
|
-
overscanned.y -= overscanY;
|
|
1700
|
-
overscanned.height += overscanY + overscanY * 0.2;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
var overscanX = Math.round(Math.min(this.visibleRect.width * 2, this.overscanX.value) / 100) * 100;
|
|
1704
|
-
|
|
1705
|
-
if (this.velocity.x > 0) {
|
|
1706
|
-
overscanned.x -= overscanX * 0.2;
|
|
1707
|
-
overscanned.width += overscanX + overscanX * 0.2;
|
|
1708
|
-
} else {
|
|
1709
|
-
overscanned.x -= overscanX;
|
|
1710
|
-
overscanned.width += overscanX + overscanX * 0.2;
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
return overscanned;
|
|
1714
|
-
}
|
|
1715
|
-
}]);
|
|
1716
|
-
|
|
1717
|
-
return OverscanManager;
|
|
1718
|
-
}();
|
|
1719
|
-
|
|
1720
|
-
/*
|
|
1721
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1722
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1723
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1724
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1725
|
-
*
|
|
1726
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1727
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1728
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1729
|
-
* governing permissions and limitations under the License.
|
|
1730
|
-
*/
|
|
1731
|
-
var $d019a21d62e1a544f8ff53038831e$var$KEY = 0;
|
|
1732
|
-
|
|
1733
|
-
var ReusableView = /*#__PURE__*/function () {
|
|
1734
|
-
/** The CollectionManager this view is a part of */
|
|
1735
|
-
|
|
1736
|
-
/** The LayoutInfo this view is currently representing. */
|
|
1737
|
-
|
|
1738
|
-
/** The content currently being displayed by this view, set by the collection view. */
|
|
1739
|
-
function ReusableView(collectionManager) {
|
|
1740
|
-
_babelRuntimeHelpersClassCallCheck(this, ReusableView);
|
|
1741
|
-
|
|
1742
|
-
_babelRuntimeHelpersDefineProperty(this, "collectionManager", void 0);
|
|
1743
|
-
|
|
1744
|
-
_babelRuntimeHelpersDefineProperty(this, "layoutInfo", void 0);
|
|
1745
|
-
|
|
1746
|
-
_babelRuntimeHelpersDefineProperty(this, "content", void 0);
|
|
1747
|
-
|
|
1748
|
-
_babelRuntimeHelpersDefineProperty(this, "rendered", void 0);
|
|
1749
|
-
|
|
1750
|
-
_babelRuntimeHelpersDefineProperty(this, "viewType", void 0);
|
|
1751
|
-
|
|
1752
|
-
_babelRuntimeHelpersDefineProperty(this, "key", void 0);
|
|
1753
|
-
|
|
1754
|
-
this.collectionManager = collectionManager;
|
|
1755
|
-
this.key = ++$d019a21d62e1a544f8ff53038831e$var$KEY;
|
|
1756
|
-
}
|
|
1757
|
-
/**
|
|
1758
|
-
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
1759
|
-
*/
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
_babelRuntimeHelpersCreateClass(ReusableView, [{
|
|
1763
|
-
key: "prepareForReuse",
|
|
1764
|
-
value: function prepareForReuse() {
|
|
1765
|
-
this.content = null;
|
|
1766
|
-
this.rendered = null;
|
|
1767
|
-
this.layoutInfo = null;
|
|
1768
|
-
}
|
|
1769
|
-
}]);
|
|
1770
|
-
|
|
1771
|
-
return ReusableView;
|
|
1772
|
-
}();
|
|
1773
|
-
|
|
1774
|
-
exports.ReusableView = ReusableView;
|
|
1775
|
-
|
|
1776
|
-
/*
|
|
1777
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1778
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1779
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1780
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1781
|
-
*
|
|
1782
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1783
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1784
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1785
|
-
* governing permissions and limitations under the License.
|
|
1786
|
-
*/
|
|
1787
|
-
var Size = /*#__PURE__*/function () {
|
|
1788
|
-
function Size() {
|
|
1789
|
-
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1790
|
-
var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1791
|
-
|
|
1792
|
-
_babelRuntimeHelpersClassCallCheck(this, Size);
|
|
1793
|
-
|
|
1794
|
-
_babelRuntimeHelpersDefineProperty(this, "width", void 0);
|
|
1795
|
-
|
|
1796
|
-
_babelRuntimeHelpersDefineProperty(this, "height", void 0);
|
|
1797
|
-
|
|
1798
|
-
this.width = width;
|
|
1799
|
-
this.height = height;
|
|
1800
|
-
}
|
|
1801
|
-
/**
|
|
1802
|
-
* Returns a copy of this size
|
|
1803
|
-
*/
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
_babelRuntimeHelpersCreateClass(Size, [{
|
|
1807
|
-
key: "copy",
|
|
1808
|
-
value: function copy() {
|
|
1809
|
-
return new Size(this.width, this.height);
|
|
1810
|
-
}
|
|
1811
|
-
/**
|
|
1812
|
-
* Returns whether this size is equal to another one
|
|
1813
|
-
*/
|
|
1814
|
-
|
|
1815
|
-
}, {
|
|
1816
|
-
key: "equals",
|
|
1817
|
-
value: function equals(other) {
|
|
1818
|
-
return this.width === other.width && this.height === other.height;
|
|
1819
|
-
}
|
|
1820
|
-
}]);
|
|
1821
|
-
|
|
1822
|
-
return Size;
|
|
1823
|
-
}();
|
|
1824
|
-
|
|
1825
|
-
exports.Size = Size;
|
|
1826
|
-
|
|
1827
|
-
/*
|
|
1828
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1829
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1830
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1831
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1832
|
-
*
|
|
1833
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1834
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1835
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1836
|
-
* governing permissions and limitations under the License.
|
|
1837
|
-
*/
|
|
1838
|
-
var $f49c737285afa132349253f865f735$export$Transaction = function Transaction() {
|
|
1839
|
-
_babelRuntimeHelpersClassCallCheck(this, Transaction);
|
|
1840
|
-
|
|
1841
|
-
_babelRuntimeHelpersDefineProperty(this, "level", 0);
|
|
1842
|
-
|
|
1843
|
-
_babelRuntimeHelpersDefineProperty(this, "actions", []);
|
|
1844
|
-
|
|
1845
|
-
_babelRuntimeHelpersDefineProperty(this, "animated", true);
|
|
1846
|
-
|
|
1847
|
-
_babelRuntimeHelpersDefineProperty(this, "initialMap", new Map());
|
|
1848
|
-
|
|
1849
|
-
_babelRuntimeHelpersDefineProperty(this, "finalMap", new Map());
|
|
1850
|
-
|
|
1851
|
-
_babelRuntimeHelpersDefineProperty(this, "initialLayoutInfo", new Map());
|
|
1852
|
-
|
|
1853
|
-
_babelRuntimeHelpersDefineProperty(this, "finalLayoutInfo", new Map());
|
|
1854
|
-
|
|
1855
|
-
_babelRuntimeHelpersDefineProperty(this, "removed", new Map());
|
|
1856
|
-
|
|
1857
|
-
_babelRuntimeHelpersDefineProperty(this, "toRemove", new Map());
|
|
1858
|
-
};
|
|
1859
|
-
|
|
1860
|
-
function $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(o) {
|
|
1861
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
1862
|
-
if (Array.isArray(o) || (o = $d11201c7ec0629352f016e7dc350a774$var$_unsupportedIterableToArray(o))) {
|
|
1863
|
-
var i = 0;
|
|
1864
|
-
|
|
1865
|
-
var F = function F() {};
|
|
1866
|
-
|
|
1867
|
-
return {
|
|
1868
|
-
s: F,
|
|
1869
|
-
n: function n() {
|
|
1870
|
-
if (i >= o.length) return {
|
|
1871
|
-
done: true
|
|
1872
|
-
};
|
|
1873
|
-
return {
|
|
1874
|
-
done: false,
|
|
1875
|
-
value: o[i++]
|
|
1876
|
-
};
|
|
1877
|
-
},
|
|
1878
|
-
e: function e(_e) {
|
|
1879
|
-
throw _e;
|
|
1880
|
-
},
|
|
1881
|
-
f: F
|
|
1882
|
-
};
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
var it,
|
|
1889
|
-
normalCompletion = true,
|
|
1890
|
-
didErr = false,
|
|
1891
|
-
err;
|
|
1892
|
-
return {
|
|
1893
|
-
s: function s() {
|
|
1894
|
-
it = o[Symbol.iterator]();
|
|
1895
|
-
},
|
|
1896
|
-
n: function n() {
|
|
1897
|
-
var step = it.next();
|
|
1898
|
-
normalCompletion = step.done;
|
|
1899
|
-
return step;
|
|
1900
|
-
},
|
|
1901
|
-
e: function e(_e2) {
|
|
1902
|
-
didErr = true;
|
|
1903
|
-
err = _e2;
|
|
1904
|
-
},
|
|
1905
|
-
f: function f() {
|
|
1906
|
-
try {
|
|
1907
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
1908
|
-
} finally {
|
|
1909
|
-
if (didErr) throw err;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
};
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
function $d11201c7ec0629352f016e7dc350a774$var$_unsupportedIterableToArray(o, minLen) {
|
|
1916
|
-
if (!o) return;
|
|
1917
|
-
if (typeof o === "string") return $d11201c7ec0629352f016e7dc350a774$var$_arrayLikeToArray(o, minLen);
|
|
1918
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1919
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1920
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1921
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $d11201c7ec0629352f016e7dc350a774$var$_arrayLikeToArray(o, minLen);
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
function $d11201c7ec0629352f016e7dc350a774$var$_arrayLikeToArray(arr, len) {
|
|
1925
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1926
|
-
|
|
1927
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1928
|
-
arr2[i] = arr[i];
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
return arr2;
|
|
1932
|
-
}
|
|
1933
|
-
/**
|
|
1934
|
-
* The CollectionView class renders a scrollable collection of data using customizable layouts,
|
|
1935
|
-
* and manages animated updates to the data over time. It supports very large collections by
|
|
1936
|
-
* only rendering visible views to the DOM, reusing them as you scroll. Collection views can
|
|
1937
|
-
* present any type of view, including non-item views such as section headers and footers.
|
|
1938
|
-
* Optionally, the {@link EditableCollectionView} subclass can be used to enable user interaction
|
|
1939
|
-
* with the collection, including drag and drop, multiple selection, and keyboard interacton.
|
|
1940
|
-
*
|
|
1941
|
-
* Collection views get their data from a {@link DataSource} object that you provide. Items are
|
|
1942
|
-
* grouped into sections by the data source, and the collection view calls its methods to retrieve
|
|
1943
|
-
* the data. When data changes, the data source emits change events, and the collection view
|
|
1944
|
-
* updates as appropriate, optionally with an animated transition. There is one built-in data source
|
|
1945
|
-
* implementation, {@link ArrayDataSource}, which renders content from a 2d array.
|
|
1946
|
-
*
|
|
1947
|
-
* Collection views use {@link Layout} objects to compute what views should be visible, and how
|
|
1948
|
-
* to position and style them. This means that collection views can have their items arranged in
|
|
1949
|
-
* a stack, a grid, a circle, or any other layout you can think of. The layout can be changed
|
|
1950
|
-
* dynamically at runtime as well, optionally with an animated transition between the layouts.
|
|
1951
|
-
*
|
|
1952
|
-
* Layouts produce information on what views should appear in the collection view, but do not create
|
|
1953
|
-
* the views themselves directly. It is the responsibility of the {@link CollectionViewDelegate} object
|
|
1954
|
-
* to create instances of {@link ReusableView} subclasses which render the items into DOM nodes.
|
|
1955
|
-
* The delegate determines what type of view to display for each item, and creates instances of
|
|
1956
|
-
* views as needed by the collection view. Those views are then reused by the collection view as
|
|
1957
|
-
* the user scrolls through the content.
|
|
1958
|
-
*/
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
var CollectionManager = /*#__PURE__*/function () {
|
|
1962
|
-
/**
|
|
1963
|
-
* The collection view delegate. The delegate is used by the collection view
|
|
1964
|
-
* to create and configure views.
|
|
1965
|
-
*/
|
|
1966
|
-
|
|
1967
|
-
/** The duration of animated layout changes, in milliseconds. Default is 500ms. */
|
|
1968
|
-
|
|
1969
|
-
/**
|
|
1970
|
-
* Whether to enable scroll anchoring. This will attempt to restore the scroll position
|
|
1971
|
-
* after layout changes outside the viewport. Default is off.
|
|
1972
|
-
*/
|
|
1973
|
-
|
|
1974
|
-
/** Whether to anchor the scroll position when at the top of the content. Default is off. */
|
|
1975
|
-
|
|
1976
|
-
/**
|
|
1977
|
-
* Whether to overscan the visible area to pre-render items slightly outside and
|
|
1978
|
-
* improve performance. Default is on.
|
|
1979
|
-
*/
|
|
1980
|
-
function CollectionManager() {
|
|
1981
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1982
|
-
|
|
1983
|
-
_babelRuntimeHelpersClassCallCheck(this, CollectionManager);
|
|
1984
|
-
|
|
1985
|
-
_babelRuntimeHelpersDefineProperty(this, "delegate", void 0);
|
|
1986
|
-
|
|
1987
|
-
_babelRuntimeHelpersDefineProperty(this, "transitionDuration", void 0);
|
|
1988
|
-
|
|
1989
|
-
_babelRuntimeHelpersDefineProperty(this, "anchorScrollPosition", void 0);
|
|
1990
|
-
|
|
1991
|
-
_babelRuntimeHelpersDefineProperty(this, "anchorScrollPositionAtTop", void 0);
|
|
1992
|
-
|
|
1993
|
-
_babelRuntimeHelpersDefineProperty(this, "shouldOverscan", void 0);
|
|
1994
|
-
|
|
1995
|
-
_babelRuntimeHelpersDefineProperty(this, "_collection", void 0);
|
|
1996
|
-
|
|
1997
|
-
_babelRuntimeHelpersDefineProperty(this, "_layout", void 0);
|
|
1998
|
-
|
|
1999
|
-
_babelRuntimeHelpersDefineProperty(this, "_contentSize", void 0);
|
|
2000
|
-
|
|
2001
|
-
_babelRuntimeHelpersDefineProperty(this, "_visibleRect", void 0);
|
|
2002
|
-
|
|
2003
|
-
_babelRuntimeHelpersDefineProperty(this, "_visibleLayoutInfos", void 0);
|
|
2004
|
-
|
|
2005
|
-
_babelRuntimeHelpersDefineProperty(this, "_reusableViews", void 0);
|
|
2006
|
-
|
|
2007
|
-
_babelRuntimeHelpersDefineProperty(this, "_visibleViews", void 0);
|
|
2008
|
-
|
|
2009
|
-
_babelRuntimeHelpersDefineProperty(this, "_renderedContent", void 0);
|
|
2010
|
-
|
|
2011
|
-
_babelRuntimeHelpersDefineProperty(this, "_children", void 0);
|
|
2012
|
-
|
|
2013
|
-
_babelRuntimeHelpersDefineProperty(this, "_invalidationContext", void 0);
|
|
2014
|
-
|
|
2015
|
-
_babelRuntimeHelpersDefineProperty(this, "_overscanManager", void 0);
|
|
2016
|
-
|
|
2017
|
-
_babelRuntimeHelpersDefineProperty(this, "_relayoutRaf", void 0);
|
|
2018
|
-
|
|
2019
|
-
_babelRuntimeHelpersDefineProperty(this, "_scrollAnimation", void 0);
|
|
2020
|
-
|
|
2021
|
-
_babelRuntimeHelpersDefineProperty(this, "_isScrolling", void 0);
|
|
2022
|
-
|
|
2023
|
-
_babelRuntimeHelpersDefineProperty(this, "_sizeUpdateQueue", void 0);
|
|
2024
|
-
|
|
2025
|
-
_babelRuntimeHelpersDefineProperty(this, "_animatedContentOffset", void 0);
|
|
2026
|
-
|
|
2027
|
-
_babelRuntimeHelpersDefineProperty(this, "_transaction", void 0);
|
|
2028
|
-
|
|
2029
|
-
_babelRuntimeHelpersDefineProperty(this, "_nextTransaction", void 0);
|
|
2030
|
-
|
|
2031
|
-
_babelRuntimeHelpersDefineProperty(this, "_transactionQueue", void 0);
|
|
2032
|
-
|
|
2033
|
-
this._contentSize = new Size();
|
|
2034
|
-
this._visibleRect = new Rect();
|
|
2035
|
-
this._reusableViews = {};
|
|
2036
|
-
this._visibleLayoutInfos = new Map();
|
|
2037
|
-
this._visibleViews = new Map();
|
|
2038
|
-
this._renderedContent = new WeakMap();
|
|
2039
|
-
this._children = new Set();
|
|
2040
|
-
this._invalidationContext = null;
|
|
2041
|
-
this._overscanManager = new $e3e4feb35525992ec01972e76270426f$export$OverscanManager();
|
|
2042
|
-
this._scrollAnimation = null;
|
|
2043
|
-
this._isScrolling = false;
|
|
2044
|
-
this._sizeUpdateQueue = new Map();
|
|
2045
|
-
this._animatedContentOffset = new Point(0, 0);
|
|
2046
|
-
this._transaction = null;
|
|
2047
|
-
this._nextTransaction = null;
|
|
2048
|
-
this._transactionQueue = []; // Set options from passed object if given
|
|
2049
|
-
|
|
2050
|
-
this.transitionDuration = options.transitionDuration || 500;
|
|
2051
|
-
this.anchorScrollPosition = options.anchorScrollPosition || false;
|
|
2052
|
-
this.anchorScrollPositionAtTop = options.anchorScrollPositionAtTop || false;
|
|
2053
|
-
this.shouldOverscan = options.shouldOverscan !== false;
|
|
2054
|
-
|
|
2055
|
-
for (var _i = 0, _arr = ['delegate', 'size', 'layout', 'collection']; _i < _arr.length; _i++) {
|
|
2056
|
-
var key = _arr[_i];
|
|
2057
|
-
|
|
2058
|
-
if (options[key]) {
|
|
2059
|
-
this[key] = options[key];
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
|
|
2064
|
-
_babelRuntimeHelpersCreateClass(CollectionManager, [{
|
|
2065
|
-
key: "_setContentSize",
|
|
2066
|
-
value: function _setContentSize(size) {
|
|
2067
|
-
this._contentSize = size;
|
|
2068
|
-
this.delegate.setContentSize(size);
|
|
2069
|
-
}
|
|
2070
|
-
}, {
|
|
2071
|
-
key: "_setContentOffset",
|
|
2072
|
-
value: function _setContentOffset(offset) {
|
|
2073
|
-
var rect = new Rect(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
2074
|
-
this.delegate.setVisibleRect(rect);
|
|
2075
|
-
}
|
|
2076
|
-
/**
|
|
2077
|
-
* Get the size of the scrollable content
|
|
2078
|
-
*/
|
|
2079
|
-
|
|
2080
|
-
}, {
|
|
2081
|
-
key: "_setVisibleRect",
|
|
2082
|
-
value: function _setVisibleRect(rect) {
|
|
2083
|
-
var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2084
|
-
var current = this._visibleRect; // Ignore if the rects are equal
|
|
2085
|
-
|
|
2086
|
-
if (rect.equals(current)) {
|
|
2087
|
-
return;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
if (this.shouldOverscan) {
|
|
2091
|
-
this._overscanManager.setVisibleRect(rect);
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
var shouldInvalidate = this.layout && this.layout.shouldInvalidate(rect);
|
|
2095
|
-
|
|
2096
|
-
this._resetAnimatedContentOffset();
|
|
2097
|
-
|
|
2098
|
-
this._visibleRect = rect;
|
|
2099
|
-
|
|
2100
|
-
if (shouldInvalidate) {
|
|
2101
|
-
this.relayout({
|
|
2102
|
-
offsetChanged: !rect.pointEquals(current),
|
|
2103
|
-
sizeChanged: !rect.sizeEquals(current)
|
|
2104
|
-
});
|
|
2105
|
-
} else {
|
|
2106
|
-
this.updateSubviews(forceUpdate);
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
}, {
|
|
2110
|
-
key: "_setData",
|
|
2111
|
-
value: function _setData(data) {
|
|
2112
|
-
var _this = this;
|
|
2113
|
-
|
|
2114
|
-
if (data === this._collection) {
|
|
2115
|
-
return;
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
if (this._collection) {
|
|
2119
|
-
this._runTransaction(function () {
|
|
2120
|
-
_this._collection = data;
|
|
2121
|
-
}, false); // TODO: determine if we should animate somehow??
|
|
2122
|
-
|
|
2123
|
-
} else {
|
|
2124
|
-
this._collection = data;
|
|
2125
|
-
this.reloadData();
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
/**
|
|
2129
|
-
* Reloads the data from the data source and relayouts the collection view.
|
|
2130
|
-
* Does not animate any changes. Equivalent to re-assigning the same data source
|
|
2131
|
-
* to the collection view.
|
|
2132
|
-
*/
|
|
2133
|
-
|
|
2134
|
-
}, {
|
|
2135
|
-
key: "reloadData",
|
|
2136
|
-
value: function reloadData() {
|
|
2137
|
-
this.relayout({
|
|
2138
|
-
contentChanged: true
|
|
2139
|
-
});
|
|
2140
|
-
}
|
|
2141
|
-
/**
|
|
2142
|
-
* Returns the item with the given key.
|
|
2143
|
-
*/
|
|
2144
|
-
|
|
2145
|
-
}, {
|
|
2146
|
-
key: "getItem",
|
|
2147
|
-
value: function getItem(key) {
|
|
2148
|
-
return this._collection ? this._collection.getItem(key) : null;
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* Get the collection view's layout
|
|
2152
|
-
*/
|
|
2153
|
-
|
|
2154
|
-
}, {
|
|
2155
|
-
key: "setLayout",
|
|
2156
|
-
|
|
2157
|
-
/**
|
|
2158
|
-
* Sets the collection view's layout, optionally with an animated transition
|
|
2159
|
-
* from the current layout to the new layout.
|
|
2160
|
-
* @param layout The layout to switch to
|
|
2161
|
-
* @param animated Whether to animate the layout change
|
|
2162
|
-
*/
|
|
2163
|
-
value: function setLayout(layout) {
|
|
2164
|
-
var _this2 = this;
|
|
2165
|
-
|
|
2166
|
-
var animated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2167
|
-
|
|
2168
|
-
if (layout === this._layout) {
|
|
2169
|
-
return;
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
var applyLayout = function applyLayout() {
|
|
2173
|
-
if (_this2._layout) {
|
|
2174
|
-
// @ts-ignore
|
|
2175
|
-
_this2._layout.collectionManager = null;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
layout.collectionManager = _this2;
|
|
2179
|
-
_this2._layout = layout;
|
|
2180
|
-
};
|
|
2181
|
-
|
|
2182
|
-
if (animated) {
|
|
2183
|
-
// Animated layout transitions are really simple, thanks to our transaction support.
|
|
2184
|
-
// We just set the layout inside a transaction action, which runs after the initial
|
|
2185
|
-
// layout infos for the animation are retrieved from the previous layout. Then, the
|
|
2186
|
-
// final layout infos are retrieved from the new layout, and animations occur.
|
|
2187
|
-
this._runTransaction(applyLayout);
|
|
2188
|
-
} else {
|
|
2189
|
-
applyLayout();
|
|
2190
|
-
this.relayout();
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
}, {
|
|
2194
|
-
key: "_getReuseType",
|
|
2195
|
-
value: function _getReuseType(layoutInfo, content) {
|
|
2196
|
-
if (layoutInfo.type === 'item' && content) {
|
|
2197
|
-
var _type = this.delegate.getType ? this.delegate.getType(content) : 'item';
|
|
2198
|
-
|
|
2199
|
-
var reuseType = _type === 'item' ? 'item' : layoutInfo.type + '_' + _type;
|
|
2200
|
-
return {
|
|
2201
|
-
type: _type,
|
|
2202
|
-
reuseType: reuseType
|
|
2203
|
-
};
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
|
-
return {
|
|
2207
|
-
type: layoutInfo.type,
|
|
2208
|
-
reuseType: layoutInfo.type
|
|
2209
|
-
};
|
|
2210
|
-
}
|
|
2211
|
-
}, {
|
|
2212
|
-
key: "getReusableView",
|
|
2213
|
-
value: function getReusableView(layoutInfo) {
|
|
2214
|
-
var content = this._getViewContent(layoutInfo.type, layoutInfo.key);
|
|
2215
|
-
|
|
2216
|
-
var _this$_getReuseType = this._getReuseType(layoutInfo, content),
|
|
2217
|
-
reuseType = _this$_getReuseType.reuseType;
|
|
2218
|
-
|
|
2219
|
-
if (!this._reusableViews[reuseType]) {
|
|
2220
|
-
this._reusableViews[reuseType] = [];
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
var reusable = this._reusableViews[reuseType];
|
|
2224
|
-
var view = reusable.length > 0 ? reusable.pop() : new ReusableView(this);
|
|
2225
|
-
view.viewType = reuseType;
|
|
2226
|
-
|
|
2227
|
-
if (!this._animatedContentOffset.isOrigin()) {
|
|
2228
|
-
layoutInfo = layoutInfo.copy();
|
|
2229
|
-
layoutInfo.rect.x += this._animatedContentOffset.x;
|
|
2230
|
-
layoutInfo.rect.y += this._animatedContentOffset.y;
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
view.layoutInfo = layoutInfo;
|
|
2234
|
-
|
|
2235
|
-
this._renderView(view);
|
|
2236
|
-
|
|
2237
|
-
return view;
|
|
2238
|
-
}
|
|
2239
|
-
}, {
|
|
2240
|
-
key: "_getViewContent",
|
|
2241
|
-
value: function _getViewContent(type, key) {
|
|
2242
|
-
// if (type === 'item') {
|
|
2243
|
-
return this.getItem(key); // }
|
|
2244
|
-
// if (this.delegate.getContentForExtraView) {
|
|
2245
|
-
// return this.delegate.getContentForExtraView(type, key);
|
|
2246
|
-
// }
|
|
2247
|
-
// return null;
|
|
2248
|
-
}
|
|
2249
|
-
}, {
|
|
2250
|
-
key: "_renderView",
|
|
2251
|
-
value: function _renderView(reusableView) {
|
|
2252
|
-
var _reusableView$layoutI = reusableView.layoutInfo,
|
|
2253
|
-
type = _reusableView$layoutI.type,
|
|
2254
|
-
key = _reusableView$layoutI.key;
|
|
2255
|
-
reusableView.content = this._getViewContent(type, key);
|
|
2256
|
-
reusableView.rendered = this._renderContent(type, reusableView.content);
|
|
2257
|
-
}
|
|
2258
|
-
}, {
|
|
2259
|
-
key: "_renderContent",
|
|
2260
|
-
value: function _renderContent(type, content) {
|
|
2261
|
-
var cached = this._renderedContent.get(content);
|
|
2262
|
-
|
|
2263
|
-
if (cached != null) {
|
|
2264
|
-
return cached;
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
var rendered = this.delegate.renderView(type, content);
|
|
2268
|
-
|
|
2269
|
-
if (content) {
|
|
2270
|
-
this._renderedContent.set(content, rendered);
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
return rendered;
|
|
2274
|
-
}
|
|
2275
|
-
/**
|
|
2276
|
-
* Returns an array of all currently visible views, including both
|
|
2277
|
-
* item views and supplementary views.
|
|
2278
|
-
*/
|
|
2279
|
-
|
|
2280
|
-
}, {
|
|
2281
|
-
key: "getItemView",
|
|
2282
|
-
|
|
2283
|
-
/**
|
|
2284
|
-
* Gets the visible item view for the given key. Returns null if
|
|
2285
|
-
* the view is not currently visible.
|
|
2286
|
-
*/
|
|
2287
|
-
value: function getItemView(key) {
|
|
2288
|
-
return this.getView('item', key);
|
|
2289
|
-
}
|
|
2290
|
-
/**
|
|
2291
|
-
* Gets the visible view for the given type and key. Returns null if
|
|
2292
|
-
* the view is not currently visible.
|
|
2293
|
-
*
|
|
2294
|
-
* @param type The view type. `'item'` for an item view.
|
|
2295
|
-
* @param key The key of the view to retrieve
|
|
2296
|
-
*/
|
|
2297
|
-
|
|
2298
|
-
}, {
|
|
2299
|
-
key: "getView",
|
|
2300
|
-
value: function getView(type, key) {
|
|
2301
|
-
try {
|
|
2302
|
-
var k = this._getViewKey(type, key);
|
|
2303
|
-
|
|
2304
|
-
return this._visibleViews.get(k) || null;
|
|
2305
|
-
} catch (err) {
|
|
2306
|
-
return null;
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
/**
|
|
2310
|
-
* Returns an array of visible views matching the given type.
|
|
2311
|
-
* @param type The view type to find. `'item'` for item views.
|
|
2312
|
-
*/
|
|
2313
|
-
|
|
2314
|
-
}, {
|
|
2315
|
-
key: "getViewsOfType",
|
|
2316
|
-
value: function getViewsOfType(type) {
|
|
2317
|
-
return this.visibleViews.filter(function (v) {
|
|
2318
|
-
return v.layoutInfo && v.layoutInfo.type === type;
|
|
2319
|
-
});
|
|
2320
|
-
}
|
|
2321
|
-
/**
|
|
2322
|
-
* Reloads the content of the supplementary view matching the given parameters.
|
|
2323
|
-
* This method does not work with item views. You should emit a "reloadItem" or
|
|
2324
|
-
* "reloadSection" event from your data source instead.
|
|
2325
|
-
*
|
|
2326
|
-
* @param type The view type. `'item'` for an item view.
|
|
2327
|
-
* @param key The key of the view to reload.
|
|
2328
|
-
*/
|
|
2329
|
-
|
|
2330
|
-
}, {
|
|
2331
|
-
key: "reloadSupplementaryView",
|
|
2332
|
-
value: function reloadSupplementaryView(type, key) {
|
|
2333
|
-
var _this3 = this;
|
|
2334
|
-
|
|
2335
|
-
if (type === 'item') {
|
|
2336
|
-
throw new Error('Do not reload item views with this method. ' + 'Emit a "reloadItem" or "reloadSection" event from your data source instead.');
|
|
2337
|
-
} // TODO
|
|
2338
|
-
// let content = this._getViewContent(type, key);
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
this._runTransaction(function () {
|
|
2342
|
-
var view = _this3.getView(type, key);
|
|
2343
|
-
|
|
2344
|
-
if (!view) {
|
|
2345
|
-
return;
|
|
2346
|
-
} // view.setContent(content);
|
|
2347
|
-
|
|
2348
|
-
}, false);
|
|
2349
|
-
}
|
|
2350
|
-
/**
|
|
2351
|
-
* Reloads the content of all visible supplementary views of the given type.
|
|
2352
|
-
* @param type The view type to reload. `'item'` for an item view.
|
|
2353
|
-
*/
|
|
2354
|
-
|
|
2355
|
-
}, {
|
|
2356
|
-
key: "reloadSupplementaryViewsOfType",
|
|
2357
|
-
value: function reloadSupplementaryViewsOfType(type) {
|
|
2358
|
-
var _iterator = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this.getViewsOfType(type)),
|
|
2359
|
-
_step;
|
|
2360
|
-
|
|
2361
|
-
try {
|
|
2362
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2363
|
-
var view = _step.value;
|
|
2364
|
-
|
|
2365
|
-
if (view.layoutInfo) {
|
|
2366
|
-
this.reloadSupplementaryView(type, view.layoutInfo.key);
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
} catch (err) {
|
|
2370
|
-
_iterator.e(err);
|
|
2371
|
-
} finally {
|
|
2372
|
-
_iterator.f();
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
/**
|
|
2376
|
-
* Returns the key for the given view. Returns null
|
|
2377
|
-
* if the view is not currently visible.
|
|
2378
|
-
*/
|
|
2379
|
-
|
|
2380
|
-
}, {
|
|
2381
|
-
key: "keyForView",
|
|
2382
|
-
value: function keyForView(view) {
|
|
2383
|
-
if (view && view.layoutInfo && view.layoutInfo.type === 'item') {
|
|
2384
|
-
return view.layoutInfo.key;
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
|
-
return null;
|
|
2388
|
-
}
|
|
2389
|
-
/**
|
|
2390
|
-
* Returns the key for the item view currently at the given point.
|
|
2391
|
-
*/
|
|
2392
|
-
|
|
2393
|
-
}, {
|
|
2394
|
-
key: "keyAtPoint",
|
|
2395
|
-
value: function keyAtPoint(point) {
|
|
2396
|
-
var rect = new Rect(point.x, point.y, 1, 1);
|
|
2397
|
-
var layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
2398
|
-
var layoutInfo = layoutInfos.filter(function (l) {
|
|
2399
|
-
return l.type === 'item';
|
|
2400
|
-
})[0];
|
|
2401
|
-
|
|
2402
|
-
if (!layoutInfo) {
|
|
2403
|
-
return null;
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
return layoutInfo.key;
|
|
2407
|
-
}
|
|
2408
|
-
/**
|
|
2409
|
-
* Triggers a layout invalidation, and updates the visible subviews.
|
|
2410
|
-
*/
|
|
2411
|
-
|
|
2412
|
-
}, {
|
|
2413
|
-
key: "relayout",
|
|
2414
|
-
value: function relayout() {
|
|
2415
|
-
var _this4 = this;
|
|
2416
|
-
|
|
2417
|
-
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Ignore relayouts while animating the scroll position
|
|
2418
|
-
|
|
2419
|
-
if (this._scrollAnimation) {
|
|
2420
|
-
return;
|
|
2421
|
-
} // If we already scheduled a relayout, extend the invalidation
|
|
2422
|
-
// context so we coalesce multiple relayouts in the same frame.
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
if (this._invalidationContext) {
|
|
2426
|
-
Object.assign(this._invalidationContext, context);
|
|
2427
|
-
return;
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
this._invalidationContext = context;
|
|
2431
|
-
this._relayoutRaf = requestAnimationFrame(function () {
|
|
2432
|
-
_this4._relayoutRaf = null;
|
|
2433
|
-
|
|
2434
|
-
_this4.relayoutNow();
|
|
2435
|
-
});
|
|
2436
|
-
}
|
|
2437
|
-
/**
|
|
2438
|
-
* Performs a relayout immediately. Prefer {@link relayout} over this method
|
|
2439
|
-
* where possible, since it coalesces multiple layout passes in the same tick.
|
|
2440
|
-
*/
|
|
2441
|
-
|
|
2442
|
-
}, {
|
|
2443
|
-
key: "relayoutNow",
|
|
2444
|
-
value: function relayoutNow() {
|
|
2445
|
-
var _this5 = this;
|
|
2446
|
-
|
|
2447
|
-
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._invalidationContext || {}; // Cancel the scheduled relayout, since we're doing it now.
|
|
2448
|
-
|
|
2449
|
-
if (this._relayoutRaf) {
|
|
2450
|
-
cancelAnimationFrame(this._relayoutRaf);
|
|
2451
|
-
this._relayoutRaf = null;
|
|
2452
|
-
} // Reset the invalidation context
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
this._invalidationContext = null; // Do nothing if we don't have a layout or content, or we are
|
|
2456
|
-
// in the middle of an animated scroll transition.
|
|
2457
|
-
|
|
2458
|
-
if (!this.layout || !this._collection || this._scrollAnimation) {
|
|
2459
|
-
return;
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
var scrollAnchor = this._getScrollAnchor(); // Enable transitions if this is an animated relayout
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
if (context.animated) {
|
|
2466
|
-
this._enableTransitions();
|
|
2467
|
-
} // Trigger the beforeLayout hook, if provided
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
if (typeof context.beforeLayout === 'function') {
|
|
2471
|
-
context.beforeLayout();
|
|
2472
|
-
} // Validate the layout
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
this.layout.validate(context);
|
|
2476
|
-
|
|
2477
|
-
this._setContentSize(this.layout.getContentSize()); // Trigger the afterLayout hook, if provided
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
if (typeof context.afterLayout === 'function') {
|
|
2481
|
-
context.afterLayout();
|
|
2482
|
-
} // Adjust scroll position based on scroll anchor, and constrain.
|
|
2483
|
-
// If the content changed, scroll to the top.
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
var visibleRect = this.getVisibleRect();
|
|
2487
|
-
|
|
2488
|
-
var restoredScrollAnchor = this._restoreScrollAnchor(scrollAnchor, context);
|
|
2489
|
-
|
|
2490
|
-
var contentOffsetX = context.contentChanged ? 0 : restoredScrollAnchor.x;
|
|
2491
|
-
var contentOffsetY = context.contentChanged ? 0 : restoredScrollAnchor.y;
|
|
2492
|
-
contentOffsetX = Math.max(0, Math.min(this.contentSize.width - visibleRect.width, contentOffsetX));
|
|
2493
|
-
contentOffsetY = Math.max(0, Math.min(this.contentSize.height - visibleRect.height, contentOffsetY));
|
|
2494
|
-
|
|
2495
|
-
if (contentOffsetX !== visibleRect.x || contentOffsetY !== visibleRect.y) {
|
|
2496
|
-
// If this is an animated relayout, we do not immediately scroll because it would be jittery.
|
|
2497
|
-
// Save the difference between the current and new content offsets, and apply it to the
|
|
2498
|
-
// individual content items instead. At the end of the animation, we'll reset and set the
|
|
2499
|
-
// scroll offset for real. This ensures jitter-free animation since we don't need to sync
|
|
2500
|
-
// the scroll animation and the content animation.
|
|
2501
|
-
if (context.animated || !this._animatedContentOffset.isOrigin()) {
|
|
2502
|
-
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
2503
|
-
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
2504
|
-
this.updateSubviews(context.contentChanged);
|
|
2505
|
-
} else {
|
|
2506
|
-
this._setContentOffset(new Point(contentOffsetX, contentOffsetY));
|
|
2507
|
-
}
|
|
2508
|
-
} else {
|
|
2509
|
-
this.updateSubviews(context.contentChanged);
|
|
2510
|
-
} // Apply layout infos, unless this is coming from an animated transaction
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
if (!(context.transaction && context.animated)) {
|
|
2514
|
-
this._applyLayoutInfos();
|
|
2515
|
-
} // Wait for animations, and apply the afterAnimation hook, if provided
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
if (context.animated) {
|
|
2519
|
-
var done = function done() {
|
|
2520
|
-
_this5._disableTransitions(); // Reset scroll position after animations (see above comment).
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
if (!_this5._animatedContentOffset.isOrigin()) {
|
|
2524
|
-
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
2525
|
-
var _this5$getVisibleRect = _this5.getVisibleRect(),
|
|
2526
|
-
x = _this5$getVisibleRect.x,
|
|
2527
|
-
y = _this5$getVisibleRect.y;
|
|
2528
|
-
|
|
2529
|
-
_this5._resetAnimatedContentOffset();
|
|
2530
|
-
|
|
2531
|
-
_this5._setContentOffset(new Point(x, y));
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
if (typeof context.afterAnimation === 'function') {
|
|
2535
|
-
context.afterAnimation();
|
|
2536
|
-
}
|
|
2537
|
-
};
|
|
2538
|
-
|
|
2539
|
-
setTimeout(done, this.transitionDuration);
|
|
2540
|
-
return;
|
|
2541
|
-
} else if (typeof context.afterAnimation === 'function') {
|
|
2542
|
-
context.afterAnimation();
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
/**
|
|
2546
|
-
* Corrects DOM order of visible views to match item order of collection
|
|
2547
|
-
*/
|
|
2548
|
-
|
|
2549
|
-
}, {
|
|
2550
|
-
key: "_correctItemOrder",
|
|
2551
|
-
value: function _correctItemOrder() {
|
|
2552
|
-
// Defer until after scrolling and animated transactions are complete
|
|
2553
|
-
if (this._isScrolling || this._transaction) {
|
|
2554
|
-
return;
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
var _iterator2 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._visibleLayoutInfos.keys()),
|
|
2558
|
-
_step2;
|
|
2559
|
-
|
|
2560
|
-
try {
|
|
2561
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2562
|
-
var key = _step2.value;
|
|
2563
|
-
|
|
2564
|
-
var view = this._visibleViews.get(key);
|
|
2565
|
-
|
|
2566
|
-
this._children.delete(view);
|
|
2567
|
-
|
|
2568
|
-
this._children.add(view);
|
|
2569
|
-
}
|
|
2570
|
-
} catch (err) {
|
|
2571
|
-
_iterator2.e(err);
|
|
2572
|
-
} finally {
|
|
2573
|
-
_iterator2.f();
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
}, {
|
|
2577
|
-
key: "_enableTransitions",
|
|
2578
|
-
value: function _enableTransitions() {
|
|
2579
|
-
this.delegate.beginAnimations();
|
|
2580
|
-
}
|
|
2581
|
-
}, {
|
|
2582
|
-
key: "_disableTransitions",
|
|
2583
|
-
value: function _disableTransitions() {
|
|
2584
|
-
this.delegate.endAnimations();
|
|
2585
|
-
}
|
|
2586
|
-
}, {
|
|
2587
|
-
key: "_getScrollAnchor",
|
|
2588
|
-
value: function _getScrollAnchor() {
|
|
2589
|
-
if (!this.anchorScrollPosition) {
|
|
2590
|
-
return null;
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
var visibleRect = this.getVisibleRect(); // Ask the delegate to provide a scroll anchor, if possible
|
|
2594
|
-
|
|
2595
|
-
if (this.delegate.getScrollAnchor) {
|
|
2596
|
-
var key = this.delegate.getScrollAnchor(visibleRect);
|
|
2597
|
-
|
|
2598
|
-
if (key) {
|
|
2599
|
-
var layoutInfo = this.layout.getLayoutInfo('item', key);
|
|
2600
|
-
var corner = layoutInfo.rect.getCornerInRect(visibleRect);
|
|
2601
|
-
|
|
2602
|
-
if (corner) {
|
|
2603
|
-
var _key = this._getViewKey(layoutInfo.type, layoutInfo.key);
|
|
2604
|
-
|
|
2605
|
-
var offset = layoutInfo.rect[corner].y - visibleRect.y;
|
|
2606
|
-
return {
|
|
2607
|
-
key: _key,
|
|
2608
|
-
layoutInfo: layoutInfo,
|
|
2609
|
-
corner: corner,
|
|
2610
|
-
offset: offset
|
|
2611
|
-
};
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
} // No need to anchor the scroll position if it is at the top
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
if (visibleRect.y === 0 && !this.anchorScrollPositionAtTop) {
|
|
2618
|
-
return null;
|
|
2619
|
-
} // Find a view with a visible corner that has the smallest distance to the top of the collection view
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
var cornerAnchor = null;
|
|
2623
|
-
|
|
2624
|
-
var _iterator3 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._visibleViews),
|
|
2625
|
-
_step3;
|
|
2626
|
-
|
|
2627
|
-
try {
|
|
2628
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2629
|
-
var _step3$value = _babelRuntimeHelpersSlicedToArray(_step3.value, 2),
|
|
2630
|
-
_key2 = _step3$value[0],
|
|
2631
|
-
view = _step3$value[1];
|
|
2632
|
-
|
|
2633
|
-
var _layoutInfo = view.layoutInfo;
|
|
2634
|
-
|
|
2635
|
-
if (_layoutInfo && _layoutInfo.rect.area > 0) {
|
|
2636
|
-
var _corner = _layoutInfo.rect.getCornerInRect(visibleRect);
|
|
2637
|
-
|
|
2638
|
-
if (_corner) {
|
|
2639
|
-
var _offset = _layoutInfo.rect[_corner].y - visibleRect.y;
|
|
2640
|
-
|
|
2641
|
-
if (!cornerAnchor || _offset < cornerAnchor.offset) {
|
|
2642
|
-
cornerAnchor = {
|
|
2643
|
-
key: _key2,
|
|
2644
|
-
layoutInfo: _layoutInfo,
|
|
2645
|
-
corner: _corner,
|
|
2646
|
-
offset: _offset
|
|
2647
|
-
};
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
} catch (err) {
|
|
2653
|
-
_iterator3.e(err);
|
|
2654
|
-
} finally {
|
|
2655
|
-
_iterator3.f();
|
|
2656
|
-
}
|
|
2657
|
-
|
|
2658
|
-
return cornerAnchor;
|
|
2659
|
-
}
|
|
2660
|
-
}, {
|
|
2661
|
-
key: "_restoreScrollAnchor",
|
|
2662
|
-
value: function _restoreScrollAnchor(scrollAnchor, context) {
|
|
2663
|
-
var contentOffset = this.getVisibleRect();
|
|
2664
|
-
|
|
2665
|
-
if (scrollAnchor) {
|
|
2666
|
-
var finalAnchor = context.transaction ? context.transaction.finalMap.get(scrollAnchor.key) : this.layout.getLayoutInfo(scrollAnchor.layoutInfo.type, scrollAnchor.layoutInfo.key);
|
|
2667
|
-
|
|
2668
|
-
if (finalAnchor) {
|
|
2669
|
-
var adjustment = finalAnchor.rect[scrollAnchor.corner].y - contentOffset.y - scrollAnchor.offset;
|
|
2670
|
-
contentOffset.y += adjustment;
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
|
-
return contentOffset;
|
|
2675
|
-
}
|
|
2676
|
-
}, {
|
|
2677
|
-
key: "getVisibleRect",
|
|
2678
|
-
value: function getVisibleRect() {
|
|
2679
|
-
var v = this.visibleRect;
|
|
2680
|
-
var x = v.x - this._animatedContentOffset.x;
|
|
2681
|
-
var y = v.y - this._animatedContentOffset.y;
|
|
2682
|
-
return new Rect(x, y, v.width, v.height);
|
|
2683
|
-
}
|
|
2684
|
-
}, {
|
|
2685
|
-
key: "getVisibleLayoutInfos",
|
|
2686
|
-
value: function getVisibleLayoutInfos() {
|
|
2687
|
-
var rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
2688
|
-
this._visibleLayoutInfos = this._getLayoutInfoMap(rect);
|
|
2689
|
-
return this._visibleLayoutInfos;
|
|
2690
|
-
}
|
|
2691
|
-
}, {
|
|
2692
|
-
key: "_getViewKey",
|
|
2693
|
-
value: function _getViewKey(type, key) {
|
|
2694
|
-
return type + ':' + key;
|
|
2695
|
-
}
|
|
2696
|
-
}, {
|
|
2697
|
-
key: "_getLayoutInfoMap",
|
|
2698
|
-
value: function _getLayoutInfoMap(rect) {
|
|
2699
|
-
var copy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2700
|
-
var layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
2701
|
-
var map = new Map();
|
|
2702
|
-
|
|
2703
|
-
var _iterator4 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(layoutInfos),
|
|
2704
|
-
_step4;
|
|
2705
|
-
|
|
2706
|
-
try {
|
|
2707
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2708
|
-
var layoutInfo = _step4.value;
|
|
2709
|
-
|
|
2710
|
-
if (copy) {
|
|
2711
|
-
layoutInfo = layoutInfo.copy();
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
|
-
var key = this._getViewKey(layoutInfo.type, layoutInfo.key);
|
|
2715
|
-
|
|
2716
|
-
map.set(key, layoutInfo);
|
|
2717
|
-
}
|
|
2718
|
-
} catch (err) {
|
|
2719
|
-
_iterator4.e(err);
|
|
2720
|
-
} finally {
|
|
2721
|
-
_iterator4.f();
|
|
2722
|
-
}
|
|
2723
|
-
|
|
2724
|
-
return map;
|
|
2725
|
-
}
|
|
2726
|
-
}, {
|
|
2727
|
-
key: "updateSubviews",
|
|
2728
|
-
value: function updateSubviews() {
|
|
2729
|
-
var _this6 = this;
|
|
2730
|
-
|
|
2731
|
-
var forceUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2732
|
-
|
|
2733
|
-
if (!this._collection) {
|
|
2734
|
-
return;
|
|
2735
|
-
}
|
|
2736
|
-
|
|
2737
|
-
var visibleLayoutInfos = this.getVisibleLayoutInfos();
|
|
2738
|
-
var currentlyVisible = this._visibleViews;
|
|
2739
|
-
var toAdd, toRemove, toUpdate; // If this is a force update, remove and re-add all views.
|
|
2740
|
-
// Otherwise, find and update the diff.
|
|
2741
|
-
|
|
2742
|
-
if (forceUpdate) {
|
|
2743
|
-
toAdd = visibleLayoutInfos;
|
|
2744
|
-
toRemove = currentlyVisible;
|
|
2745
|
-
toUpdate = new Set();
|
|
2746
|
-
} else {
|
|
2747
|
-
var _difference = $b4afb93e92e2405c0f5b02e067098ca1$export$difference(currentlyVisible, visibleLayoutInfos);
|
|
2748
|
-
|
|
2749
|
-
toAdd = _difference.toAdd;
|
|
2750
|
-
toRemove = _difference.toRemove;
|
|
2751
|
-
toUpdate = _difference.toUpdate;
|
|
2752
|
-
|
|
2753
|
-
var _iterator5 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(toUpdate),
|
|
2754
|
-
_step5;
|
|
2755
|
-
|
|
2756
|
-
try {
|
|
2757
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
2758
|
-
var key = _step5.value;
|
|
2759
|
-
var view = currentlyVisible.get(key);
|
|
2760
|
-
|
|
2761
|
-
if (!view || !view.layoutInfo) {
|
|
2762
|
-
continue;
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
var item = this.getItem(visibleLayoutInfos.get(key).key);
|
|
2766
|
-
|
|
2767
|
-
if (view.content === item) {
|
|
2768
|
-
toUpdate.delete(key);
|
|
2769
|
-
} else {
|
|
2770
|
-
// If the view type changes, delete and recreate the view instead of updating
|
|
2771
|
-
var _this$_getReuseType2 = this._getReuseType(view.layoutInfo, item),
|
|
2772
|
-
reuseType = _this$_getReuseType2.reuseType;
|
|
2773
|
-
|
|
2774
|
-
if (view.viewType !== reuseType) {
|
|
2775
|
-
toUpdate.delete(key);
|
|
2776
|
-
toAdd.add(key);
|
|
2777
|
-
toRemove.add(key);
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2780
|
-
} // We are done if the sets are equal
|
|
2781
|
-
|
|
2782
|
-
} catch (err) {
|
|
2783
|
-
_iterator5.e(err);
|
|
2784
|
-
} finally {
|
|
2785
|
-
_iterator5.f();
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
if (toAdd.size === 0 && toRemove.size === 0 && toUpdate.size === 0) {
|
|
2789
|
-
if (this._transaction) {
|
|
2790
|
-
this._applyLayoutInfos();
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
return;
|
|
2794
|
-
}
|
|
2795
|
-
} // Track views that should be removed. They are not removed from
|
|
2796
|
-
// the DOM immediately, since we may reuse and need to re-insert
|
|
2797
|
-
// them back into the DOM anyway.
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
var removed = new Set();
|
|
2801
|
-
|
|
2802
|
-
var _iterator6 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(toRemove.keys()),
|
|
2803
|
-
_step6;
|
|
2804
|
-
|
|
2805
|
-
try {
|
|
2806
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
2807
|
-
var _key3 = _step6.value;
|
|
2808
|
-
|
|
2809
|
-
var _view = this._visibleViews.get(_key3);
|
|
2810
|
-
|
|
2811
|
-
if (_view) {
|
|
2812
|
-
removed.add(_view);
|
|
2813
|
-
|
|
2814
|
-
this._visibleViews.delete(_key3); // If we are in the middle of a transaction, wait until the end
|
|
2815
|
-
// of the animations to remove the views from the DOM. Also means
|
|
2816
|
-
// we can't reuse those views immediately.
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
if (this._transaction) {
|
|
2820
|
-
this._transaction.toRemove.set(_key3, _view);
|
|
2821
|
-
} else {
|
|
2822
|
-
this.reuseView(_view);
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
} catch (err) {
|
|
2827
|
-
_iterator6.e(err);
|
|
2828
|
-
} finally {
|
|
2829
|
-
_iterator6.f();
|
|
2830
|
-
}
|
|
2831
|
-
|
|
2832
|
-
var _iterator7 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(toAdd.keys()),
|
|
2833
|
-
_step7;
|
|
2834
|
-
|
|
2835
|
-
try {
|
|
2836
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
2837
|
-
var _key4 = _step7.value;
|
|
2838
|
-
var layoutInfo = visibleLayoutInfos.get(_key4);
|
|
2839
|
-
|
|
2840
|
-
var _view2 = void 0; // If we're in a transaction, and a layout change happens
|
|
2841
|
-
// during the animations such that a view that was going
|
|
2842
|
-
// to be removed is now not, we don't create a new view
|
|
2843
|
-
// since the old one is still in the DOM, marked as toRemove.
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
if (this._transaction) {
|
|
2847
|
-
// if transaction, get initial layout attributes for the animation
|
|
2848
|
-
if (this._transaction.initialLayoutInfo.has(_key4)) {
|
|
2849
|
-
layoutInfo = this._transaction.initialLayoutInfo.get(_key4);
|
|
2850
|
-
}
|
|
2851
|
-
|
|
2852
|
-
_view2 = this._transaction.toRemove.get(_key4);
|
|
2853
|
-
|
|
2854
|
-
if (_view2) {
|
|
2855
|
-
this._transaction.toRemove.delete(_key4);
|
|
2856
|
-
|
|
2857
|
-
this._applyLayoutInfo(_view2, layoutInfo);
|
|
2858
|
-
}
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
if (!_view2) {
|
|
2862
|
-
// Create or reuse a view for this row
|
|
2863
|
-
_view2 = this.getReusableView(layoutInfo); // Add the view to the DOM if needed
|
|
2864
|
-
|
|
2865
|
-
if (!removed.has(_view2)) {
|
|
2866
|
-
this._children.add(_view2);
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
|
|
2870
|
-
this._visibleViews.set(_key4, _view2);
|
|
2871
|
-
|
|
2872
|
-
removed.delete(_view2);
|
|
2873
|
-
}
|
|
2874
|
-
} catch (err) {
|
|
2875
|
-
_iterator7.e(err);
|
|
2876
|
-
} finally {
|
|
2877
|
-
_iterator7.f();
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
var _iterator8 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(toUpdate),
|
|
2881
|
-
_step8;
|
|
2882
|
-
|
|
2883
|
-
try {
|
|
2884
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
2885
|
-
var _key5 = _step8.value;
|
|
2886
|
-
|
|
2887
|
-
var _view3 = currentlyVisible.get(_key5);
|
|
2888
|
-
|
|
2889
|
-
this._renderedContent.delete(_key5);
|
|
2890
|
-
|
|
2891
|
-
this._renderView(_view3);
|
|
2892
|
-
} // Remove the remaining rows to delete from the DOM
|
|
2893
|
-
|
|
2894
|
-
} catch (err) {
|
|
2895
|
-
_iterator8.e(err);
|
|
2896
|
-
} finally {
|
|
2897
|
-
_iterator8.f();
|
|
2898
|
-
}
|
|
2899
|
-
|
|
2900
|
-
if (!this._transaction) {
|
|
2901
|
-
this.removeViews(removed);
|
|
2902
|
-
}
|
|
2903
|
-
|
|
2904
|
-
this._correctItemOrder();
|
|
2905
|
-
|
|
2906
|
-
this._flushVisibleViews();
|
|
2907
|
-
|
|
2908
|
-
if (this._transaction) {
|
|
2909
|
-
requestAnimationFrame(function () {
|
|
2910
|
-
// If we're in a transaction, apply animations to visible views
|
|
2911
|
-
// and "to be removed" views, which animate off screen.
|
|
2912
|
-
if (_this6._transaction) {
|
|
2913
|
-
requestAnimationFrame(function () {
|
|
2914
|
-
return _this6._applyLayoutInfos();
|
|
2915
|
-
});
|
|
2916
|
-
}
|
|
2917
|
-
});
|
|
2918
|
-
}
|
|
2919
|
-
}
|
|
2920
|
-
}, {
|
|
2921
|
-
key: "afterRender",
|
|
2922
|
-
value: function afterRender() {
|
|
2923
|
-
if (this.shouldOverscan) {
|
|
2924
|
-
this._overscanManager.collectMetrics();
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
}, {
|
|
2928
|
-
key: "_flushVisibleViews",
|
|
2929
|
-
value: function _flushVisibleViews() {
|
|
2930
|
-
var _this7 = this; // CollectionManager deals with a flattened set of LayoutInfos, but they can represent heirarchy
|
|
2931
|
-
// by referencing a parentKey. Just before rendering the visible views, we rebuild this heirarchy
|
|
2932
|
-
// by creating a mapping of views by parent key and recursively calling the delegate's renderWrapper
|
|
2933
|
-
// method to build the final tree.
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
var viewsByParentKey = new Map([[null, []]]);
|
|
2937
|
-
|
|
2938
|
-
var _iterator9 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._children),
|
|
2939
|
-
_step9;
|
|
2940
|
-
|
|
2941
|
-
try {
|
|
2942
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
2943
|
-
var view = _step9.value;
|
|
2944
|
-
|
|
2945
|
-
if (!viewsByParentKey.has(view.layoutInfo.parentKey)) {
|
|
2946
|
-
viewsByParentKey.set(view.layoutInfo.parentKey, []);
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
viewsByParentKey.get(view.layoutInfo.parentKey).push(view);
|
|
2950
|
-
|
|
2951
|
-
if (!viewsByParentKey.has(view.layoutInfo.key)) {
|
|
2952
|
-
viewsByParentKey.set(view.layoutInfo.key, []);
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
} catch (err) {
|
|
2956
|
-
_iterator9.e(err);
|
|
2957
|
-
} finally {
|
|
2958
|
-
_iterator9.f();
|
|
2959
|
-
}
|
|
2960
|
-
|
|
2961
|
-
var buildTree = function buildTree(parent, views) {
|
|
2962
|
-
return views.map(function (view) {
|
|
2963
|
-
var children = viewsByParentKey.get(view.layoutInfo.key);
|
|
2964
|
-
return _this7.delegate.renderWrapper(parent, view, children, function (childViews) {
|
|
2965
|
-
return buildTree(view, childViews);
|
|
2966
|
-
});
|
|
2967
|
-
});
|
|
2968
|
-
};
|
|
2969
|
-
|
|
2970
|
-
var children = buildTree(null, viewsByParentKey.get(null));
|
|
2971
|
-
this.delegate.setVisibleViews(children);
|
|
2972
|
-
}
|
|
2973
|
-
}, {
|
|
2974
|
-
key: "_applyLayoutInfo",
|
|
2975
|
-
value: function _applyLayoutInfo(view, layoutInfo) {
|
|
2976
|
-
if (view.layoutInfo === layoutInfo) {
|
|
2977
|
-
return false;
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
|
-
view.layoutInfo = layoutInfo;
|
|
2981
|
-
|
|
2982
|
-
this._renderView(view);
|
|
2983
|
-
|
|
2984
|
-
return true;
|
|
2985
|
-
}
|
|
2986
|
-
}, {
|
|
2987
|
-
key: "_applyLayoutInfos",
|
|
2988
|
-
value: function _applyLayoutInfos() {
|
|
2989
|
-
var updated = false; // Apply layout infos to visible views
|
|
2990
|
-
|
|
2991
|
-
var _iterator10 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._visibleViews),
|
|
2992
|
-
_step10;
|
|
2993
|
-
|
|
2994
|
-
try {
|
|
2995
|
-
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
2996
|
-
var _step10$value = _babelRuntimeHelpersSlicedToArray(_step10.value, 2),
|
|
2997
|
-
key = _step10$value[0],
|
|
2998
|
-
_view5 = _step10$value[1];
|
|
2999
|
-
|
|
3000
|
-
if (this._transaction && this._transaction.initialLayoutInfo.get(key) === _view5.layoutInfo) {// view.forceStyleUpdate();
|
|
3001
|
-
}
|
|
3002
|
-
|
|
3003
|
-
var _cur2 = _view5.layoutInfo;
|
|
3004
|
-
|
|
3005
|
-
if (_cur2) {
|
|
3006
|
-
var _layoutInfo3 = this.layout.getLayoutInfo(_cur2.type, _cur2.key);
|
|
3007
|
-
|
|
3008
|
-
if (this._applyLayoutInfo(_view5, _layoutInfo3)) {
|
|
3009
|
-
updated = true;
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
} // Apply final layout infos for views that will be removed
|
|
3013
|
-
|
|
3014
|
-
} catch (err) {
|
|
3015
|
-
_iterator10.e(err);
|
|
3016
|
-
} finally {
|
|
3017
|
-
_iterator10.f();
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
if (this._transaction) {
|
|
3021
|
-
var _iterator11 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._transaction.toRemove.values()),
|
|
3022
|
-
_step11;
|
|
3023
|
-
|
|
3024
|
-
try {
|
|
3025
|
-
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
3026
|
-
var view = _step11.value;
|
|
3027
|
-
var cur = view.layoutInfo;
|
|
3028
|
-
var layoutInfo = this.layout.getLayoutInfo(cur.type, cur.key);
|
|
3029
|
-
|
|
3030
|
-
if (this._applyLayoutInfo(view, layoutInfo)) {
|
|
3031
|
-
updated = true;
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
} catch (err) {
|
|
3035
|
-
_iterator11.e(err);
|
|
3036
|
-
} finally {
|
|
3037
|
-
_iterator11.f();
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
var _iterator12 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._transaction.removed.values()),
|
|
3041
|
-
_step12;
|
|
3042
|
-
|
|
3043
|
-
try {
|
|
3044
|
-
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
3045
|
-
var _view4 = _step12.value;
|
|
3046
|
-
var _cur = _view4.layoutInfo;
|
|
3047
|
-
|
|
3048
|
-
var k = this._getViewKey(_cur.type, _cur.key);
|
|
3049
|
-
|
|
3050
|
-
var _layoutInfo2 = this._transaction.finalLayoutInfo.get(k) || _cur;
|
|
3051
|
-
|
|
3052
|
-
_layoutInfo2 = this.layout.getFinalLayoutInfo(_layoutInfo2.copy());
|
|
3053
|
-
|
|
3054
|
-
if (this._applyLayoutInfo(_view4, _layoutInfo2)) {
|
|
3055
|
-
updated = true;
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
} catch (err) {
|
|
3059
|
-
_iterator12.e(err);
|
|
3060
|
-
} finally {
|
|
3061
|
-
_iterator12.f();
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
if (updated) {
|
|
3066
|
-
this._flushVisibleViews();
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
}, {
|
|
3070
|
-
key: "reuseView",
|
|
3071
|
-
value: function reuseView(view) {
|
|
3072
|
-
view.prepareForReuse();
|
|
3073
|
-
|
|
3074
|
-
this._reusableViews[view.viewType].push(view);
|
|
3075
|
-
}
|
|
3076
|
-
}, {
|
|
3077
|
-
key: "removeViews",
|
|
3078
|
-
value: function removeViews(toRemove) {
|
|
3079
|
-
var _iterator13 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(toRemove),
|
|
3080
|
-
_step13;
|
|
3081
|
-
|
|
3082
|
-
try {
|
|
3083
|
-
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
3084
|
-
var view = _step13.value;
|
|
3085
|
-
|
|
3086
|
-
this._children.delete(view);
|
|
3087
|
-
}
|
|
3088
|
-
} catch (err) {
|
|
3089
|
-
_iterator13.e(err);
|
|
3090
|
-
} finally {
|
|
3091
|
-
_iterator13.f();
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
}, {
|
|
3095
|
-
key: "updateItemSize",
|
|
3096
|
-
value: function updateItemSize(key, size) {
|
|
3097
|
-
// TODO: we should be able to invalidate a single index path
|
|
3098
|
-
// @ts-ignore
|
|
3099
|
-
if (!this.layout.updateItemSize) {
|
|
3100
|
-
return;
|
|
3101
|
-
} // If the scroll position is currently animating, add the update
|
|
3102
|
-
// to a queue to be processed after the animation is complete.
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
if (this._scrollAnimation) {
|
|
3106
|
-
this._sizeUpdateQueue.set(key, size);
|
|
3107
|
-
|
|
3108
|
-
return;
|
|
3109
|
-
} // @ts-ignore
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
var changed = this.layout.updateItemSize(key, size);
|
|
3113
|
-
|
|
3114
|
-
if (changed) {
|
|
3115
|
-
this.relayout();
|
|
3116
|
-
}
|
|
3117
|
-
}
|
|
3118
|
-
}, {
|
|
3119
|
-
key: "startScrolling",
|
|
3120
|
-
value: function startScrolling() {
|
|
3121
|
-
this._isScrolling = true;
|
|
3122
|
-
}
|
|
3123
|
-
}, {
|
|
3124
|
-
key: "endScrolling",
|
|
3125
|
-
value: function endScrolling() {
|
|
3126
|
-
this._isScrolling = false;
|
|
3127
|
-
|
|
3128
|
-
this._correctItemOrder();
|
|
3129
|
-
|
|
3130
|
-
this._flushVisibleViews();
|
|
3131
|
-
}
|
|
3132
|
-
}, {
|
|
3133
|
-
key: "_resetAnimatedContentOffset",
|
|
3134
|
-
value: function _resetAnimatedContentOffset() {
|
|
3135
|
-
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
3136
|
-
if (!this._animatedContentOffset.isOrigin()) {
|
|
3137
|
-
this._animatedContentOffset = new Point(0, 0);
|
|
3138
|
-
|
|
3139
|
-
this._applyLayoutInfos();
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
/**
|
|
3143
|
-
* Scrolls the item with the given key into view, optionally with an animation.
|
|
3144
|
-
* @param key The key of the item to scroll into view
|
|
3145
|
-
* @param duration The duration of the scroll animation
|
|
3146
|
-
*/
|
|
3147
|
-
|
|
3148
|
-
}, {
|
|
3149
|
-
key: "scrollToItem",
|
|
3150
|
-
value: function scrollToItem(key) {
|
|
3151
|
-
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
3152
|
-
|
|
3153
|
-
if (!key) {
|
|
3154
|
-
return;
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
|
-
var layoutInfo = this.layout.getLayoutInfo('item', key);
|
|
3158
|
-
|
|
3159
|
-
if (!layoutInfo) {
|
|
3160
|
-
return;
|
|
3161
|
-
}
|
|
3162
|
-
|
|
3163
|
-
var offsetX = layoutInfo.rect.x;
|
|
3164
|
-
var offsetY = layoutInfo.rect.y;
|
|
3165
|
-
var x = this.visibleRect.x;
|
|
3166
|
-
var y = this.visibleRect.y;
|
|
3167
|
-
var maxX = x + this.visibleRect.width;
|
|
3168
|
-
var maxY = y + this.visibleRect.height;
|
|
3169
|
-
|
|
3170
|
-
if (offsetX <= x || maxX === 0) {
|
|
3171
|
-
x = offsetX;
|
|
3172
|
-
} else if (offsetX + layoutInfo.rect.width > maxX) {
|
|
3173
|
-
x += offsetX + layoutInfo.rect.width - maxX;
|
|
3174
|
-
}
|
|
3175
|
-
|
|
3176
|
-
if (offsetY <= y || maxY === 0) {
|
|
3177
|
-
y = offsetY;
|
|
3178
|
-
} else if (offsetY + layoutInfo.rect.height > maxY) {
|
|
3179
|
-
y += offsetY + layoutInfo.rect.height - maxY;
|
|
3180
|
-
}
|
|
3181
|
-
|
|
3182
|
-
return this.scrollTo(new Point(x, y), duration);
|
|
3183
|
-
}
|
|
3184
|
-
/**
|
|
3185
|
-
* Performs an animated scroll to the given offset.
|
|
3186
|
-
* @param offset - The offset to scroll to
|
|
3187
|
-
* @param duration The duration of the animation
|
|
3188
|
-
* @return a promise that resolves when the animation is complete
|
|
3189
|
-
*/
|
|
3190
|
-
|
|
3191
|
-
}, {
|
|
3192
|
-
key: "scrollTo",
|
|
3193
|
-
value: function scrollTo(offset) {
|
|
3194
|
-
var _this8 = this;
|
|
3195
|
-
|
|
3196
|
-
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300; // Cancel the current scroll animation
|
|
3197
|
-
|
|
3198
|
-
if (this._scrollAnimation) {
|
|
3199
|
-
this._scrollAnimation.cancel();
|
|
3200
|
-
|
|
3201
|
-
this._scrollAnimation = null;
|
|
3202
|
-
} // Set the content offset synchronously if the duration is zero
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
if (duration <= 0 || this.visibleRect.pointEquals(offset)) {
|
|
3206
|
-
this._setContentOffset(offset);
|
|
3207
|
-
|
|
3208
|
-
return Promise.resolve();
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
this.startScrolling();
|
|
3212
|
-
this._scrollAnimation = $add44ef2cec72f417f488b48a8d5b207$export$tween(this.visibleRect, offset, duration, $add44ef2cec72f417f488b48a8d5b207$export$easeOut, function (offset) {
|
|
3213
|
-
_this8._setContentOffset(offset);
|
|
3214
|
-
});
|
|
3215
|
-
|
|
3216
|
-
this._scrollAnimation.then(function () {
|
|
3217
|
-
_this8._scrollAnimation = null; // Process view size updates that occurred during the animation.
|
|
3218
|
-
// Only views that are still visible will be actually updated.
|
|
3219
|
-
|
|
3220
|
-
var _iterator14 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(_this8._sizeUpdateQueue),
|
|
3221
|
-
_step14;
|
|
3222
|
-
|
|
3223
|
-
try {
|
|
3224
|
-
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
3225
|
-
var _step14$value = _babelRuntimeHelpersSlicedToArray(_step14.value, 2),
|
|
3226
|
-
key = _step14$value[0],
|
|
3227
|
-
size = _step14$value[1];
|
|
3228
|
-
|
|
3229
|
-
_this8.updateItemSize(key, size);
|
|
3230
|
-
}
|
|
3231
|
-
} catch (err) {
|
|
3232
|
-
_iterator14.e(err);
|
|
3233
|
-
} finally {
|
|
3234
|
-
_iterator14.f();
|
|
3235
|
-
}
|
|
3236
|
-
|
|
3237
|
-
_this8._sizeUpdateQueue.clear();
|
|
3238
|
-
|
|
3239
|
-
_this8.relayout();
|
|
3240
|
-
|
|
3241
|
-
_this8._processTransactionQueue();
|
|
3242
|
-
|
|
3243
|
-
_this8.endScrolling();
|
|
3244
|
-
});
|
|
3245
|
-
|
|
3246
|
-
return this._scrollAnimation;
|
|
3247
|
-
}
|
|
3248
|
-
}, {
|
|
3249
|
-
key: "_runTransaction",
|
|
3250
|
-
value: function _runTransaction(action, animated) {
|
|
3251
|
-
this._startTransaction();
|
|
3252
|
-
|
|
3253
|
-
if (this._nextTransaction) {
|
|
3254
|
-
this._nextTransaction.actions.push(action);
|
|
3255
|
-
}
|
|
3256
|
-
|
|
3257
|
-
this._endTransaction(animated);
|
|
3258
|
-
}
|
|
3259
|
-
}, {
|
|
3260
|
-
key: "_startTransaction",
|
|
3261
|
-
value: function _startTransaction() {
|
|
3262
|
-
if (!this._nextTransaction) {
|
|
3263
|
-
this._nextTransaction = new $f49c737285afa132349253f865f735$export$Transaction();
|
|
3264
|
-
}
|
|
3265
|
-
|
|
3266
|
-
this._nextTransaction.level++;
|
|
3267
|
-
}
|
|
3268
|
-
}, {
|
|
3269
|
-
key: "_endTransaction",
|
|
3270
|
-
value: function _endTransaction(animated) {
|
|
3271
|
-
if (!this._nextTransaction) {
|
|
3272
|
-
return false;
|
|
3273
|
-
} // Save whether the transaction should be animated.
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
if (animated != null) {
|
|
3277
|
-
this._nextTransaction.animated = animated;
|
|
3278
|
-
} // If we haven't reached level 0, we are still in a
|
|
3279
|
-
// nested transaction. Wait for the parent to end.
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
if (--this._nextTransaction.level > 0) {
|
|
3283
|
-
return false;
|
|
3284
|
-
} // Do nothing for empty transactions
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
if (this._nextTransaction.actions.length === 0) {
|
|
3288
|
-
this._nextTransaction = null;
|
|
3289
|
-
return false;
|
|
3290
|
-
} // Default animations to true
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
if (this._nextTransaction.animated == null) {
|
|
3294
|
-
this._nextTransaction.animated = true;
|
|
3295
|
-
} // Enqueue the transaction
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
this._transactionQueue.push(this._nextTransaction);
|
|
3299
|
-
|
|
3300
|
-
this._nextTransaction = null;
|
|
3301
|
-
|
|
3302
|
-
this._processTransactionQueue();
|
|
3303
|
-
|
|
3304
|
-
return true;
|
|
3305
|
-
}
|
|
3306
|
-
}, {
|
|
3307
|
-
key: "_processTransactionQueue",
|
|
3308
|
-
value: function _processTransactionQueue() {
|
|
3309
|
-
// If the current transaction is animating, wait until the end
|
|
3310
|
-
// to process the next transaction.
|
|
3311
|
-
if (this._transaction || this._scrollAnimation) {
|
|
3312
|
-
return;
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
var next = this._transactionQueue.shift();
|
|
3316
|
-
|
|
3317
|
-
if (next) {
|
|
3318
|
-
this._performTransaction(next);
|
|
3319
|
-
}
|
|
3320
|
-
}
|
|
3321
|
-
}, {
|
|
3322
|
-
key: "_getContentRect",
|
|
3323
|
-
value: function _getContentRect() {
|
|
3324
|
-
return new Rect(0, 0, this.contentSize.width, this.contentSize.height);
|
|
3325
|
-
}
|
|
3326
|
-
}, {
|
|
3327
|
-
key: "_performTransaction",
|
|
3328
|
-
value: function _performTransaction(transaction) {
|
|
3329
|
-
var _this9 = this;
|
|
3330
|
-
|
|
3331
|
-
this._transaction = transaction;
|
|
3332
|
-
this.relayoutNow({
|
|
3333
|
-
transaction: transaction,
|
|
3334
|
-
animated: transaction.animated,
|
|
3335
|
-
beforeLayout: function beforeLayout() {
|
|
3336
|
-
// Get the initial layout infos for all views before the updates
|
|
3337
|
-
// so we can figure out which views to add and remove.
|
|
3338
|
-
transaction.initialMap = _this9._getLayoutInfoMap(_this9._getContentRect(), true); // Apply the actions that occurred during this transaction
|
|
3339
|
-
|
|
3340
|
-
var _iterator15 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(transaction.actions),
|
|
3341
|
-
_step15;
|
|
3342
|
-
|
|
3343
|
-
try {
|
|
3344
|
-
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
3345
|
-
var action = _step15.value;
|
|
3346
|
-
action();
|
|
3347
|
-
}
|
|
3348
|
-
} catch (err) {
|
|
3349
|
-
_iterator15.e(err);
|
|
3350
|
-
} finally {
|
|
3351
|
-
_iterator15.f();
|
|
3352
|
-
}
|
|
3353
|
-
},
|
|
3354
|
-
afterLayout: function afterLayout() {
|
|
3355
|
-
// Get the final layout infos after the updates
|
|
3356
|
-
transaction.finalMap = _this9._getLayoutInfoMap(_this9._getContentRect());
|
|
3357
|
-
|
|
3358
|
-
_this9._setupTransactionAnimations(transaction);
|
|
3359
|
-
|
|
3360
|
-
if (!transaction.animated) {
|
|
3361
|
-
_this9._transaction = null;
|
|
3362
|
-
}
|
|
3363
|
-
},
|
|
3364
|
-
afterAnimation: function afterAnimation() {
|
|
3365
|
-
// Remove and reuse views when animations are done
|
|
3366
|
-
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) {
|
|
3367
|
-
var _iterator16 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper($b4afb93e92e2405c0f5b02e067098ca1$export$concatIterators(transaction.toRemove.values(), transaction.removed.values())),
|
|
3368
|
-
_step16;
|
|
3369
|
-
|
|
3370
|
-
try {
|
|
3371
|
-
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
3372
|
-
var view = _step16.value;
|
|
3373
|
-
|
|
3374
|
-
_this9._children.delete(view);
|
|
3375
|
-
|
|
3376
|
-
_this9.reuseView(view);
|
|
3377
|
-
}
|
|
3378
|
-
} catch (err) {
|
|
3379
|
-
_iterator16.e(err);
|
|
3380
|
-
} finally {
|
|
3381
|
-
_iterator16.f();
|
|
3382
|
-
}
|
|
3383
|
-
} // Ensure DOM order is correct for accessibility after animations are complete
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
_this9._correctItemOrder();
|
|
3387
|
-
|
|
3388
|
-
_this9._flushVisibleViews();
|
|
3389
|
-
|
|
3390
|
-
_this9._transaction = null;
|
|
3391
|
-
|
|
3392
|
-
_this9._processTransactionQueue();
|
|
3393
|
-
}
|
|
3394
|
-
});
|
|
3395
|
-
}
|
|
3396
|
-
}, {
|
|
3397
|
-
key: "_setupTransactionAnimations",
|
|
3398
|
-
value: function _setupTransactionAnimations(transaction) {
|
|
3399
|
-
var initialMap = transaction.initialMap,
|
|
3400
|
-
finalMap = transaction.finalMap; // Store initial and final layout infos for animations
|
|
3401
|
-
|
|
3402
|
-
var _iterator17 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(initialMap),
|
|
3403
|
-
_step17;
|
|
3404
|
-
|
|
3405
|
-
try {
|
|
3406
|
-
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
3407
|
-
var _step17$value = _babelRuntimeHelpersSlicedToArray(_step17.value, 2),
|
|
3408
|
-
key = _step17$value[0],
|
|
3409
|
-
layoutInfo = _step17$value[1];
|
|
3410
|
-
|
|
3411
|
-
if (finalMap.has(key)) {
|
|
3412
|
-
// Store the initial layout info for use during animations.
|
|
3413
|
-
transaction.initialLayoutInfo.set(key, layoutInfo);
|
|
3414
|
-
} else {
|
|
3415
|
-
// This view was removed. Store the layout info for use
|
|
3416
|
-
// in Layout#getFinalLayoutInfo during animations.
|
|
3417
|
-
var k = this._getViewKey(layoutInfo.type, layoutInfo.key);
|
|
3418
|
-
|
|
3419
|
-
transaction.finalLayoutInfo.set(k, layoutInfo);
|
|
3420
|
-
}
|
|
3421
|
-
} // Get initial layout infos for views that were added
|
|
3422
|
-
|
|
3423
|
-
} catch (err) {
|
|
3424
|
-
_iterator17.e(err);
|
|
3425
|
-
} finally {
|
|
3426
|
-
_iterator17.f();
|
|
3427
|
-
}
|
|
3428
|
-
|
|
3429
|
-
var _iterator18 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(finalMap),
|
|
3430
|
-
_step18;
|
|
3431
|
-
|
|
3432
|
-
try {
|
|
3433
|
-
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
3434
|
-
var _step18$value = _babelRuntimeHelpersSlicedToArray(_step18.value, 2),
|
|
3435
|
-
_key6 = _step18$value[0],
|
|
3436
|
-
_layoutInfo4 = _step18$value[1];
|
|
3437
|
-
|
|
3438
|
-
if (!initialMap.has(_key6)) {
|
|
3439
|
-
var initialLayoutInfo = this.layout.getInitialLayoutInfo(_layoutInfo4.copy());
|
|
3440
|
-
transaction.initialLayoutInfo.set(_key6, initialLayoutInfo);
|
|
3441
|
-
}
|
|
3442
|
-
} // Figure out which views were removed.
|
|
3443
|
-
|
|
3444
|
-
} catch (err) {
|
|
3445
|
-
_iterator18.e(err);
|
|
3446
|
-
} finally {
|
|
3447
|
-
_iterator18.f();
|
|
3448
|
-
}
|
|
3449
|
-
|
|
3450
|
-
var _iterator19 = $d11201c7ec0629352f016e7dc350a774$var$_createForOfIteratorHelper(this._visibleViews),
|
|
3451
|
-
_step19;
|
|
3452
|
-
|
|
3453
|
-
try {
|
|
3454
|
-
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
3455
|
-
var _step19$value = _babelRuntimeHelpersSlicedToArray(_step19.value, 2),
|
|
3456
|
-
_key7 = _step19$value[0],
|
|
3457
|
-
view = _step19$value[1];
|
|
3458
|
-
|
|
3459
|
-
if (!finalMap.has(_key7)) {
|
|
3460
|
-
transaction.removed.set(_key7, view);
|
|
3461
|
-
|
|
3462
|
-
this._visibleViews.delete(_key7); // In case something weird happened, where we have a view but no
|
|
3463
|
-
// initial layout info, use the one attached to the view.
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
if (view.layoutInfo) {
|
|
3467
|
-
var _k = this._getViewKey(view.layoutInfo.type, view.layoutInfo.key);
|
|
3468
|
-
|
|
3469
|
-
if (!transaction.finalLayoutInfo.has(_k)) {
|
|
3470
|
-
transaction.finalLayoutInfo.set(_k, view.layoutInfo);
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
}
|
|
3475
|
-
} catch (err) {
|
|
3476
|
-
_iterator19.e(err);
|
|
3477
|
-
} finally {
|
|
3478
|
-
_iterator19.f();
|
|
3479
|
-
}
|
|
3480
|
-
}
|
|
3481
|
-
}, {
|
|
3482
|
-
key: "contentSize",
|
|
3483
|
-
get: function get() {
|
|
3484
|
-
return this._contentSize;
|
|
3485
|
-
}
|
|
3486
|
-
/**
|
|
3487
|
-
* Get the collection view's currently visible rectangle
|
|
3488
|
-
*/
|
|
3489
|
-
|
|
3490
|
-
}, {
|
|
3491
|
-
key: "visibleRect",
|
|
3492
|
-
get: function get() {
|
|
3493
|
-
return this._visibleRect;
|
|
3494
|
-
}
|
|
3495
|
-
/**
|
|
3496
|
-
* Set the collection view's currently visible rectangle
|
|
3497
|
-
*/
|
|
3498
|
-
,
|
|
3499
|
-
set: function set(rect) {
|
|
3500
|
-
this._setVisibleRect(rect);
|
|
3501
|
-
}
|
|
3502
|
-
}, {
|
|
3503
|
-
key: "collection",
|
|
3504
|
-
get: function get() {
|
|
3505
|
-
return this._collection;
|
|
3506
|
-
},
|
|
3507
|
-
set: function set(data) {
|
|
3508
|
-
this._setData(data);
|
|
3509
|
-
}
|
|
3510
|
-
}, {
|
|
3511
|
-
key: "layout",
|
|
3512
|
-
get: function get() {
|
|
3513
|
-
return this._layout;
|
|
3514
|
-
}
|
|
3515
|
-
/**
|
|
3516
|
-
* Set the collection view's layout
|
|
3517
|
-
*/
|
|
3518
|
-
,
|
|
3519
|
-
set: function set(layout) {
|
|
3520
|
-
this.setLayout(layout);
|
|
3521
|
-
}
|
|
3522
|
-
}, {
|
|
3523
|
-
key: "visibleViews",
|
|
3524
|
-
get: function get() {
|
|
3525
|
-
return Array.from(this._visibleViews.values());
|
|
3526
|
-
}
|
|
3527
|
-
}]);
|
|
3528
|
-
|
|
3529
|
-
return CollectionManager;
|
|
3530
|
-
}();
|
|
3531
|
-
|
|
3532
|
-
exports.CollectionManager = CollectionManager;
|
|
3533
|
-
|
|
1
|
+
var $c870f3b549c61b6b$exports = require("./Item.main.js");
|
|
2
|
+
var $350f13aa4d8b327c$exports = require("./Section.main.js");
|
|
3
|
+
var $98fc0fafaca75b6a$exports = require("./useCollection.main.js");
|
|
4
|
+
var $e749fe52977fe2c2$exports = require("./getItemCount.main.js");
|
|
5
|
+
var $7a155683b0d79a6a$exports = require("./getChildNodes.main.js");
|
|
6
|
+
var $51588fd411aace25$exports = require("./CollectionBuilder.main.js");
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function $parcel$export(e, n, v, s) {
|
|
10
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$parcel$export(module.exports, "Item", () => $c870f3b549c61b6b$exports.Item);
|
|
14
|
+
$parcel$export(module.exports, "Section", () => $350f13aa4d8b327c$exports.Section);
|
|
15
|
+
$parcel$export(module.exports, "useCollection", () => $98fc0fafaca75b6a$exports.useCollection);
|
|
16
|
+
$parcel$export(module.exports, "getItemCount", () => $e749fe52977fe2c2$exports.getItemCount);
|
|
17
|
+
$parcel$export(module.exports, "getChildNodes", () => $7a155683b0d79a6a$exports.getChildNodes);
|
|
18
|
+
$parcel$export(module.exports, "getFirstItem", () => $7a155683b0d79a6a$exports.getFirstItem);
|
|
19
|
+
$parcel$export(module.exports, "getLastItem", () => $7a155683b0d79a6a$exports.getLastItem);
|
|
20
|
+
$parcel$export(module.exports, "getNthItem", () => $7a155683b0d79a6a$exports.getNthItem);
|
|
21
|
+
$parcel$export(module.exports, "compareNodeOrder", () => $7a155683b0d79a6a$exports.compareNodeOrder);
|
|
22
|
+
$parcel$export(module.exports, "CollectionBuilder", () => $51588fd411aace25$exports.CollectionBuilder);
|
|
3534
23
|
/*
|
|
3535
24
|
* Copyright 2020 Adobe. All rights reserved.
|
|
3536
25
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -3541,904 +30,12 @@ exports.CollectionManager = CollectionManager;
|
|
|
3541
30
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
3542
31
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
3543
32
|
* governing permissions and limitations under the License.
|
|
3544
|
-
*/
|
|
3545
|
-
// import {Point} from './Point';
|
|
3546
|
-
// import { DragTarget, DropTarget } from '@react-types/shared';
|
|
3547
|
-
|
|
3548
|
-
/**
|
|
3549
|
-
* {@link CollectionView} supports arbitrary layout objects, which compute what views are visible, and how
|
|
3550
|
-
* to position and style them. However, layouts do not create the views themselves directly. Instead,
|
|
3551
|
-
* layouts produce lightweight {@link LayoutInfo} objects which describe various properties of a view,
|
|
3552
|
-
* such as its position and size. The {@link CollectionView} is then responsible for creating the actual
|
|
3553
|
-
* views as needed, based on this layout information.
|
|
3554
|
-
*
|
|
3555
|
-
* Every layout extends from the {@link Layout} abstract base class. Layouts must implement a minimum of the
|
|
3556
|
-
* two methods listed below. All other methods can be optionally overridden to implement custom behavior.
|
|
3557
|
-
*
|
|
3558
|
-
* - {@link getVisibleLayoutInfos}
|
|
3559
|
-
* - {@link getLayoutInfo}
|
|
3560
|
-
*/
|
|
3561
|
-
var Layout = /*#__PURE__*/function () {
|
|
3562
|
-
function Layout() {
|
|
3563
|
-
_babelRuntimeHelpersClassCallCheck(this, Layout);
|
|
3564
|
-
|
|
3565
|
-
_babelRuntimeHelpersDefineProperty(this, "collectionManager", void 0);
|
|
3566
|
-
}
|
|
3567
|
-
|
|
3568
|
-
_babelRuntimeHelpersCreateClass(Layout, [{
|
|
3569
|
-
key: "shouldInvalidate",
|
|
3570
|
-
|
|
3571
|
-
/**
|
|
3572
|
-
* Returns whether the layout should invalidate in response to
|
|
3573
|
-
* visible rectangle changes. By default, it only invalidates
|
|
3574
|
-
* when the collection view's size changes. Return true always
|
|
3575
|
-
* to make the layout invalidate while scrolling (e.g. sticky headers).
|
|
3576
|
-
*/
|
|
3577
|
-
value: function shouldInvalidate(rect) {
|
|
3578
|
-
// By default, invalidate when the size changes
|
|
3579
|
-
var size = this.collectionManager.visibleRect;
|
|
3580
|
-
return rect.width !== size.width || rect.height !== size.height;
|
|
3581
|
-
}
|
|
3582
|
-
/**
|
|
3583
|
-
* This method allows the layout to perform any pre-computation
|
|
3584
|
-
* it needs to in order to prepare {@link LayoutInfo}s for retrieval.
|
|
3585
|
-
* Called by the collection view before {@link getVisibleLayoutInfos}
|
|
3586
|
-
* or {@link getLayoutInfo} are called.
|
|
3587
|
-
*/
|
|
3588
|
-
|
|
3589
|
-
}, {
|
|
3590
|
-
key: "validate",
|
|
3591
|
-
value: function validate(invalidationContext) {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3592
|
-
|
|
3593
|
-
/**
|
|
3594
|
-
* Returns an array of {@link LayoutInfo} objects which are inside the given rectangle.
|
|
3595
|
-
* Should be implemented by subclasses.
|
|
3596
|
-
* @param rect The rectangle that should contain the returned LayoutInfo objects
|
|
3597
|
-
*/
|
|
3598
|
-
|
|
3599
|
-
}, {
|
|
3600
|
-
key: "getInitialLayoutInfo",
|
|
3601
|
-
|
|
3602
|
-
/**
|
|
3603
|
-
* Returns a {@link DragTarget} describing a view at the given point to be dragged.
|
|
3604
|
-
* Return `null` to cancel the drag. The default implementation returns the view at the given point.
|
|
3605
|
-
* @param point The point at which the drag occurred
|
|
3606
|
-
*/
|
|
3607
|
-
// getDragTarget(point: Point): DragTarget | null {
|
|
3608
|
-
// let target = this.collectionManager.keyAtPoint(point);
|
|
3609
|
-
// if (!target) {
|
|
3610
|
-
// return null;
|
|
3611
|
-
// }
|
|
3612
|
-
// return {
|
|
3613
|
-
// type: 'item',
|
|
3614
|
-
// key: target
|
|
3615
|
-
// };
|
|
3616
|
-
// }
|
|
3617
|
-
|
|
3618
|
-
/**
|
|
3619
|
-
* Returns a {@link DragTarget} object describing where a drop should occur. Return `null`
|
|
3620
|
-
* to reject the drop. The dropped items will be inserted before the resulting target.
|
|
3621
|
-
* @param point The point at which the drop occurred
|
|
3622
|
-
*/
|
|
3623
|
-
// getDropTarget(point: Point): DropTarget | null {
|
|
3624
|
-
// return null;
|
|
3625
|
-
// }
|
|
3626
|
-
|
|
3627
|
-
/**
|
|
3628
|
-
* Returns the starting attributes for an animated insertion.
|
|
3629
|
-
* The view is animated from this {@link LayoutInfo} to the one returned by {@link getLayoutInfo}.
|
|
3630
|
-
* The default implementation just returns its input.
|
|
3631
|
-
*
|
|
3632
|
-
* @param layoutInfo The proposed LayoutInfo for this view
|
|
3633
|
-
*/
|
|
3634
|
-
value: function getInitialLayoutInfo(layoutInfo) {
|
|
3635
|
-
return layoutInfo;
|
|
3636
|
-
}
|
|
3637
|
-
/**
|
|
3638
|
-
* Returns the ending attributes for an animated removal.
|
|
3639
|
-
* The view is animated from the {@link LayoutInfo} returned by {@link getLayoutInfo}
|
|
3640
|
-
* to the one returned by this method. The default implementation returns its input.
|
|
3641
|
-
*
|
|
3642
|
-
* @param layoutInfo The original LayoutInfo for this view
|
|
3643
|
-
*/
|
|
3644
|
-
|
|
3645
|
-
}, {
|
|
3646
|
-
key: "getFinalLayoutInfo",
|
|
3647
|
-
value: function getFinalLayoutInfo(layoutInfo) {
|
|
3648
|
-
return layoutInfo;
|
|
3649
|
-
}
|
|
3650
|
-
}]);
|
|
3651
|
-
|
|
3652
|
-
return Layout;
|
|
3653
|
-
}();
|
|
3654
|
-
|
|
3655
|
-
exports.Layout = Layout;
|
|
3656
|
-
|
|
3657
|
-
/**
|
|
3658
|
-
* Instances of this lightweight class are created by {@link Layout} subclasses
|
|
3659
|
-
* to represent each view in the {@link CollectionView}. LayoutInfo objects describe
|
|
3660
|
-
* various properties of a view, such as its position and size, and style information.
|
|
3661
|
-
* The collection view uses this information when creating actual views to display.
|
|
3662
|
-
*/
|
|
3663
|
-
var LayoutInfo = /*#__PURE__*/function () {
|
|
3664
|
-
/**
|
|
3665
|
-
* A string representing the view type. Should be `'item'` for item views.
|
|
3666
|
-
* Other types are used by supplementary views.
|
|
3667
|
-
*/
|
|
3668
|
-
|
|
3669
|
-
/**
|
|
3670
|
-
* A unique key for this view. For item views, it should match the content key.
|
|
3671
|
-
*/
|
|
3672
|
-
|
|
3673
|
-
/**
|
|
3674
|
-
* The key for a parent layout info, if any.
|
|
3675
|
-
*/
|
|
3676
|
-
|
|
3677
|
-
/**
|
|
3678
|
-
* The rectangle describing the size and position of this view.
|
|
3679
|
-
*/
|
|
3680
|
-
|
|
3681
|
-
/**
|
|
3682
|
-
* Whether the size is estimated. `false` by default.
|
|
3683
|
-
*/
|
|
3684
|
-
|
|
3685
|
-
/**
|
|
3686
|
-
* The view's opacity. 1 by default.
|
|
3687
|
-
*/
|
|
3688
|
-
|
|
3689
|
-
/**
|
|
3690
|
-
* A CSS transform string to apply to the view. `null` by default.
|
|
3691
|
-
*/
|
|
3692
|
-
|
|
3693
|
-
/**
|
|
3694
|
-
* The z-index of the view. 0 by default.
|
|
3695
|
-
*/
|
|
3696
|
-
|
|
3697
|
-
/**
|
|
3698
|
-
* @param type A string representing the view type. Should be `'item'` for item views.
|
|
3699
|
-
Other types are used by supplementary views.
|
|
3700
|
-
* @param key The unique key for this view.
|
|
3701
|
-
* @param rect The rectangle describing the size and position of this view.
|
|
3702
|
-
*/
|
|
3703
|
-
function LayoutInfo(type, key, rect) {
|
|
3704
|
-
_babelRuntimeHelpersClassCallCheck(this, LayoutInfo);
|
|
3705
|
-
|
|
3706
|
-
_babelRuntimeHelpersDefineProperty(this, "type", void 0);
|
|
3707
|
-
|
|
3708
|
-
_babelRuntimeHelpersDefineProperty(this, "key", void 0);
|
|
3709
|
-
|
|
3710
|
-
_babelRuntimeHelpersDefineProperty(this, "parentKey", void 0);
|
|
3711
|
-
|
|
3712
|
-
_babelRuntimeHelpersDefineProperty(this, "rect", void 0);
|
|
33
|
+
*/
|
|
3713
34
|
|
|
3714
|
-
_babelRuntimeHelpersDefineProperty(this, "estimatedSize", void 0);
|
|
3715
35
|
|
|
3716
|
-
_babelRuntimeHelpersDefineProperty(this, "opacity", void 0);
|
|
3717
36
|
|
|
3718
|
-
_babelRuntimeHelpersDefineProperty(this, "transform", void 0);
|
|
3719
37
|
|
|
3720
|
-
_babelRuntimeHelpersDefineProperty(this, "zIndex", void 0);
|
|
3721
38
|
|
|
3722
|
-
this.type = type;
|
|
3723
|
-
this.key = key;
|
|
3724
|
-
this.parentKey = null;
|
|
3725
|
-
this.rect = rect;
|
|
3726
|
-
this.estimatedSize = false;
|
|
3727
|
-
this.opacity = 1;
|
|
3728
|
-
this.transform = null;
|
|
3729
|
-
this.zIndex = 0;
|
|
3730
|
-
}
|
|
3731
|
-
/**
|
|
3732
|
-
* Returns a copy of the LayoutInfo.
|
|
3733
|
-
*/
|
|
3734
39
|
|
|
3735
40
|
|
|
3736
|
-
|
|
3737
|
-
key: "copy",
|
|
3738
|
-
value: function copy() {
|
|
3739
|
-
var res = new LayoutInfo(this.type, this.key, this.rect.copy());
|
|
3740
|
-
res.estimatedSize = this.estimatedSize;
|
|
3741
|
-
res.opacity = this.opacity;
|
|
3742
|
-
res.transform = this.transform;
|
|
3743
|
-
return res;
|
|
3744
|
-
}
|
|
3745
|
-
}]);
|
|
3746
|
-
|
|
3747
|
-
return LayoutInfo;
|
|
3748
|
-
}();
|
|
3749
|
-
|
|
3750
|
-
exports.LayoutInfo = LayoutInfo;
|
|
3751
|
-
|
|
3752
|
-
function $e9c45b16bd2d2e0b1c780b100d2a005b$var$_createForOfIteratorHelper(o) {
|
|
3753
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
3754
|
-
if (Array.isArray(o) || (o = $e9c45b16bd2d2e0b1c780b100d2a005b$var$_unsupportedIterableToArray(o))) {
|
|
3755
|
-
var i = 0;
|
|
3756
|
-
|
|
3757
|
-
var F = function F() {};
|
|
3758
|
-
|
|
3759
|
-
return {
|
|
3760
|
-
s: F,
|
|
3761
|
-
n: function n() {
|
|
3762
|
-
if (i >= o.length) return {
|
|
3763
|
-
done: true
|
|
3764
|
-
};
|
|
3765
|
-
return {
|
|
3766
|
-
done: false,
|
|
3767
|
-
value: o[i++]
|
|
3768
|
-
};
|
|
3769
|
-
},
|
|
3770
|
-
e: function e(_e) {
|
|
3771
|
-
throw _e;
|
|
3772
|
-
},
|
|
3773
|
-
f: F
|
|
3774
|
-
};
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
|
-
var it,
|
|
3781
|
-
normalCompletion = true,
|
|
3782
|
-
didErr = false,
|
|
3783
|
-
err;
|
|
3784
|
-
return {
|
|
3785
|
-
s: function s() {
|
|
3786
|
-
it = o[Symbol.iterator]();
|
|
3787
|
-
},
|
|
3788
|
-
n: function n() {
|
|
3789
|
-
var step = it.next();
|
|
3790
|
-
normalCompletion = step.done;
|
|
3791
|
-
return step;
|
|
3792
|
-
},
|
|
3793
|
-
e: function e(_e2) {
|
|
3794
|
-
didErr = true;
|
|
3795
|
-
err = _e2;
|
|
3796
|
-
},
|
|
3797
|
-
f: function f() {
|
|
3798
|
-
try {
|
|
3799
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
3800
|
-
} finally {
|
|
3801
|
-
if (didErr) throw err;
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
3804
|
-
};
|
|
3805
|
-
}
|
|
3806
|
-
|
|
3807
|
-
function $e9c45b16bd2d2e0b1c780b100d2a005b$var$_unsupportedIterableToArray(o, minLen) {
|
|
3808
|
-
if (!o) return;
|
|
3809
|
-
if (typeof o === "string") return $e9c45b16bd2d2e0b1c780b100d2a005b$var$_arrayLikeToArray(o, minLen);
|
|
3810
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3811
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3812
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3813
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $e9c45b16bd2d2e0b1c780b100d2a005b$var$_arrayLikeToArray(o, minLen);
|
|
3814
|
-
}
|
|
3815
|
-
|
|
3816
|
-
function $e9c45b16bd2d2e0b1c780b100d2a005b$var$_arrayLikeToArray(arr, len) {
|
|
3817
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3818
|
-
|
|
3819
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
3820
|
-
arr2[i] = arr[i];
|
|
3821
|
-
}
|
|
3822
|
-
|
|
3823
|
-
return arr2;
|
|
3824
|
-
}
|
|
3825
|
-
|
|
3826
|
-
function $e9c45b16bd2d2e0b1c780b100d2a005b$var$_createSuper(Derived) {
|
|
3827
|
-
return function () {
|
|
3828
|
-
var Super = _babelRuntimeHelpersGetPrototypeOf(Derived),
|
|
3829
|
-
result;
|
|
3830
|
-
|
|
3831
|
-
if ($e9c45b16bd2d2e0b1c780b100d2a005b$var$_isNativeReflectConstruct()) {
|
|
3832
|
-
var NewTarget = _babelRuntimeHelpersGetPrototypeOf(this).constructor;
|
|
3833
|
-
|
|
3834
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
3835
|
-
} else {
|
|
3836
|
-
result = Super.apply(this, arguments);
|
|
3837
|
-
}
|
|
3838
|
-
|
|
3839
|
-
return _babelRuntimeHelpersPossibleConstructorReturn(this, result);
|
|
3840
|
-
};
|
|
3841
|
-
}
|
|
3842
|
-
|
|
3843
|
-
function $e9c45b16bd2d2e0b1c780b100d2a005b$var$_isNativeReflectConstruct() {
|
|
3844
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
3845
|
-
if (Reflect.construct.sham) return false;
|
|
3846
|
-
if (typeof Proxy === "function") return true;
|
|
3847
|
-
|
|
3848
|
-
try {
|
|
3849
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
3850
|
-
return true;
|
|
3851
|
-
} catch (e) {
|
|
3852
|
-
return false;
|
|
3853
|
-
}
|
|
3854
|
-
}
|
|
3855
|
-
|
|
3856
|
-
var $e9c45b16bd2d2e0b1c780b100d2a005b$var$DEFAULT_HEIGHT = 48;
|
|
3857
|
-
/**
|
|
3858
|
-
* The ListLayout class is an implementation of a collection view {@link Layout}
|
|
3859
|
-
* it is used for creating lists and lists with indented sub-lists
|
|
3860
|
-
*
|
|
3861
|
-
* To configure a ListLayout, you can use the properties to define the
|
|
3862
|
-
* layouts and/or use the method for defining indentation.
|
|
3863
|
-
* The {@link ListLayoutDelegate} extends the existing collection view
|
|
3864
|
-
* delegate with an additional method to do this (it uses the same delegate object as
|
|
3865
|
-
* the collection view itself).
|
|
3866
|
-
*/
|
|
3867
|
-
|
|
3868
|
-
var ListLayout = /*#__PURE__*/function (_Layout) {
|
|
3869
|
-
_babelRuntimeHelpersInherits(ListLayout, _Layout);
|
|
3870
|
-
|
|
3871
|
-
var _super = $e9c45b16bd2d2e0b1c780b100d2a005b$var$_createSuper(ListLayout);
|
|
3872
|
-
/**
|
|
3873
|
-
* Creates a new ListLayout with options. See the list of properties below for a description
|
|
3874
|
-
* of the options that can be provided.
|
|
3875
|
-
*/
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
function ListLayout() {
|
|
3879
|
-
var _this;
|
|
3880
|
-
|
|
3881
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3882
|
-
|
|
3883
|
-
_babelRuntimeHelpersClassCallCheck(this, ListLayout);
|
|
3884
|
-
|
|
3885
|
-
_this = _super.call(this);
|
|
3886
|
-
|
|
3887
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "rowHeight", void 0);
|
|
3888
|
-
|
|
3889
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "estimatedRowHeight", void 0);
|
|
3890
|
-
|
|
3891
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "headingHeight", void 0);
|
|
3892
|
-
|
|
3893
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "estimatedHeadingHeight", void 0);
|
|
3894
|
-
|
|
3895
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "padding", void 0);
|
|
3896
|
-
|
|
3897
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "indentationForItem", void 0);
|
|
3898
|
-
|
|
3899
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "layoutInfos", void 0);
|
|
3900
|
-
|
|
3901
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "contentHeight", void 0);
|
|
3902
|
-
|
|
3903
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "collection", void 0);
|
|
3904
|
-
|
|
3905
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "lastWidth", void 0);
|
|
3906
|
-
|
|
3907
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "lastCollection", void 0);
|
|
3908
|
-
|
|
3909
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "rootNodes", void 0);
|
|
3910
|
-
|
|
3911
|
-
_babelRuntimeHelpersDefineProperty(_babelRuntimeHelpersAssertThisInitialized(_this), "collator", void 0);
|
|
3912
|
-
|
|
3913
|
-
_this.rowHeight = options.rowHeight;
|
|
3914
|
-
_this.estimatedRowHeight = options.estimatedRowHeight;
|
|
3915
|
-
_this.headingHeight = options.headingHeight;
|
|
3916
|
-
_this.estimatedHeadingHeight = options.estimatedHeadingHeight;
|
|
3917
|
-
_this.padding = options.padding || 0;
|
|
3918
|
-
_this.indentationForItem = options.indentationForItem;
|
|
3919
|
-
_this.collator = options.collator;
|
|
3920
|
-
_this.layoutInfos = {};
|
|
3921
|
-
_this.rootNodes = [];
|
|
3922
|
-
_this.lastWidth = 0;
|
|
3923
|
-
_this.lastCollection = null;
|
|
3924
|
-
_this.contentHeight = 0;
|
|
3925
|
-
return _this;
|
|
3926
|
-
}
|
|
3927
|
-
|
|
3928
|
-
_babelRuntimeHelpersCreateClass(ListLayout, [{
|
|
3929
|
-
key: "getLayoutInfo",
|
|
3930
|
-
value: function getLayoutInfo(type, key) {
|
|
3931
|
-
return this.layoutInfos[key];
|
|
3932
|
-
}
|
|
3933
|
-
}, {
|
|
3934
|
-
key: "getVisibleLayoutInfos",
|
|
3935
|
-
value: function getVisibleLayoutInfos(rect) {
|
|
3936
|
-
var res = [];
|
|
3937
|
-
|
|
3938
|
-
var addNodes = function addNodes(nodes) {
|
|
3939
|
-
var _iterator = $e9c45b16bd2d2e0b1c780b100d2a005b$var$_createForOfIteratorHelper(nodes),
|
|
3940
|
-
_step;
|
|
3941
|
-
|
|
3942
|
-
try {
|
|
3943
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3944
|
-
var node = _step.value;
|
|
3945
|
-
|
|
3946
|
-
if (node.layoutInfo.rect.intersects(rect)) {
|
|
3947
|
-
res.push(node.layoutInfo);
|
|
3948
|
-
|
|
3949
|
-
if (node.header) {
|
|
3950
|
-
res.push(node.header);
|
|
3951
|
-
}
|
|
3952
|
-
|
|
3953
|
-
if (node.children) {
|
|
3954
|
-
addNodes(node.children);
|
|
3955
|
-
}
|
|
3956
|
-
}
|
|
3957
|
-
}
|
|
3958
|
-
} catch (err) {
|
|
3959
|
-
_iterator.e(err);
|
|
3960
|
-
} finally {
|
|
3961
|
-
_iterator.f();
|
|
3962
|
-
}
|
|
3963
|
-
};
|
|
3964
|
-
|
|
3965
|
-
addNodes(this.rootNodes);
|
|
3966
|
-
return res;
|
|
3967
|
-
}
|
|
3968
|
-
}, {
|
|
3969
|
-
key: "validate",
|
|
3970
|
-
value: function validate() {
|
|
3971
|
-
var _this2 = this;
|
|
3972
|
-
|
|
3973
|
-
var width = this.collectionManager.visibleRect.width;
|
|
3974
|
-
var previousLayoutInfos = this.layoutInfos;
|
|
3975
|
-
this.layoutInfos = {}; // Build the layout recursively.
|
|
3976
|
-
|
|
3977
|
-
var build = function build(nodes) {
|
|
3978
|
-
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3979
|
-
var startY = y;
|
|
3980
|
-
var layoutNodes = [];
|
|
3981
|
-
|
|
3982
|
-
var _iterator2 = $e9c45b16bd2d2e0b1c780b100d2a005b$var$_createForOfIteratorHelper(nodes),
|
|
3983
|
-
_step2;
|
|
3984
|
-
|
|
3985
|
-
try {
|
|
3986
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3987
|
-
var node = _step2.value;
|
|
3988
|
-
var rectHeight = node.type === 'item' ? _this2.rowHeight : _this2.headingHeight;
|
|
3989
|
-
var isEstimated = false; // If no explicit height is available, use an estimated height.
|
|
3990
|
-
|
|
3991
|
-
if (rectHeight == null) {
|
|
3992
|
-
// If a previous version of this layout info exists, reuse its height.
|
|
3993
|
-
// Mark as estimated if the size of the overall collection view changed,
|
|
3994
|
-
// or the content of the item changed.
|
|
3995
|
-
var previousLayoutInfo = previousLayoutInfos[node.type === 'item' ? node.key : node.key + ':header'];
|
|
3996
|
-
|
|
3997
|
-
if (previousLayoutInfo) {
|
|
3998
|
-
var curNode = _this2.collection.getItem(node.key);
|
|
3999
|
-
|
|
4000
|
-
var lastNode = _this2.lastCollection ? _this2.lastCollection.getItem(node.key) : null;
|
|
4001
|
-
rectHeight = previousLayoutInfo.rect.height;
|
|
4002
|
-
isEstimated = width !== _this2.lastWidth || curNode !== lastNode || previousLayoutInfo.estimatedSize;
|
|
4003
|
-
} else {
|
|
4004
|
-
if (node.type === 'item') {
|
|
4005
|
-
rectHeight = _this2.estimatedRowHeight;
|
|
4006
|
-
} else {
|
|
4007
|
-
rectHeight = node.rendered ? _this2.estimatedHeadingHeight : 0;
|
|
4008
|
-
}
|
|
4009
|
-
|
|
4010
|
-
isEstimated = true;
|
|
4011
|
-
}
|
|
4012
|
-
}
|
|
4013
|
-
|
|
4014
|
-
if (rectHeight == null) {
|
|
4015
|
-
rectHeight = $e9c45b16bd2d2e0b1c780b100d2a005b$var$DEFAULT_HEIGHT;
|
|
4016
|
-
}
|
|
4017
|
-
|
|
4018
|
-
var layoutInfo = void 0;
|
|
4019
|
-
|
|
4020
|
-
if (node.type === 'section') {
|
|
4021
|
-
var headerRect = new Rect(0, y, width, rectHeight);
|
|
4022
|
-
var header = new LayoutInfo('header', node.key + ':header', headerRect);
|
|
4023
|
-
header.estimatedSize = isEstimated;
|
|
4024
|
-
header.parentKey = node.key;
|
|
4025
|
-
_this2.layoutInfos[header.key] = header;
|
|
4026
|
-
y += header.rect.height;
|
|
4027
|
-
var rect = new Rect(0, y, width, 0);
|
|
4028
|
-
layoutInfo = new LayoutInfo(node.type, node.key, rect);
|
|
4029
|
-
|
|
4030
|
-
var _build = build(node.childNodes, y),
|
|
4031
|
-
_build2 = _babelRuntimeHelpersSlicedToArray(_build, 2),
|
|
4032
|
-
_height = _build2[0],
|
|
4033
|
-
children = _build2[1];
|
|
4034
|
-
|
|
4035
|
-
rect.height = _height;
|
|
4036
|
-
layoutNodes.push({
|
|
4037
|
-
header: header,
|
|
4038
|
-
layoutInfo: layoutInfo,
|
|
4039
|
-
children: children
|
|
4040
|
-
});
|
|
4041
|
-
} else {
|
|
4042
|
-
var x = 0;
|
|
4043
|
-
|
|
4044
|
-
if (typeof _this2.indentationForItem === 'function') {
|
|
4045
|
-
x = _this2.indentationForItem(_this2.collection, node.key) || 0;
|
|
4046
|
-
}
|
|
4047
|
-
|
|
4048
|
-
var _rect = new Rect(x, y, width - x, rectHeight);
|
|
4049
|
-
|
|
4050
|
-
layoutInfo = new LayoutInfo(node.type, node.key, _rect);
|
|
4051
|
-
layoutInfo.estimatedSize = isEstimated;
|
|
4052
|
-
layoutNodes.push({
|
|
4053
|
-
layoutInfo: layoutInfo
|
|
4054
|
-
});
|
|
4055
|
-
}
|
|
4056
|
-
|
|
4057
|
-
layoutInfo.parentKey = node.parentKey || null;
|
|
4058
|
-
_this2.layoutInfos[node.key] = layoutInfo;
|
|
4059
|
-
y += layoutInfo.rect.height;
|
|
4060
|
-
}
|
|
4061
|
-
} catch (err) {
|
|
4062
|
-
_iterator2.e(err);
|
|
4063
|
-
} finally {
|
|
4064
|
-
_iterator2.f();
|
|
4065
|
-
}
|
|
4066
|
-
|
|
4067
|
-
return [y - startY, layoutNodes];
|
|
4068
|
-
};
|
|
4069
|
-
|
|
4070
|
-
var _build3 = build(this.collection, this.padding),
|
|
4071
|
-
_build4 = _babelRuntimeHelpersSlicedToArray(_build3, 2),
|
|
4072
|
-
height = _build4[0],
|
|
4073
|
-
nodes = _build4[1];
|
|
4074
|
-
|
|
4075
|
-
this.contentHeight = height + this.padding * 2;
|
|
4076
|
-
this.rootNodes = nodes;
|
|
4077
|
-
this.lastWidth = width;
|
|
4078
|
-
this.lastCollection = this.collection;
|
|
4079
|
-
}
|
|
4080
|
-
}, {
|
|
4081
|
-
key: "updateItemSize",
|
|
4082
|
-
value: function updateItemSize(key, size) {
|
|
4083
|
-
var layoutInfo = this.layoutInfos[key];
|
|
4084
|
-
layoutInfo.estimatedSize = false;
|
|
4085
|
-
|
|
4086
|
-
if (layoutInfo.rect.height !== size.height) {
|
|
4087
|
-
layoutInfo.rect.height = size.height;
|
|
4088
|
-
return true;
|
|
4089
|
-
}
|
|
4090
|
-
|
|
4091
|
-
return false;
|
|
4092
|
-
}
|
|
4093
|
-
}, {
|
|
4094
|
-
key: "getContentSize",
|
|
4095
|
-
value: function getContentSize() {
|
|
4096
|
-
return new Size(this.collectionManager.visibleRect.width, this.contentHeight);
|
|
4097
|
-
}
|
|
4098
|
-
}, {
|
|
4099
|
-
key: "getKeyAbove",
|
|
4100
|
-
value: function getKeyAbove(key) {
|
|
4101
|
-
var collection = this.collection;
|
|
4102
|
-
key = collection.getKeyBefore(key);
|
|
4103
|
-
|
|
4104
|
-
while (key) {
|
|
4105
|
-
var item = collection.getItem(key);
|
|
4106
|
-
|
|
4107
|
-
if (item.type === 'item' && !item.isDisabled) {
|
|
4108
|
-
return key;
|
|
4109
|
-
}
|
|
4110
|
-
|
|
4111
|
-
key = collection.getKeyBefore(key);
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
|
-
}, {
|
|
4115
|
-
key: "getKeyBelow",
|
|
4116
|
-
value: function getKeyBelow(key) {
|
|
4117
|
-
var collection = this.collection;
|
|
4118
|
-
key = collection.getKeyAfter(key);
|
|
4119
|
-
|
|
4120
|
-
while (key) {
|
|
4121
|
-
var item = collection.getItem(key);
|
|
4122
|
-
|
|
4123
|
-
if (item.type === 'item' && !item.isDisabled) {
|
|
4124
|
-
return key;
|
|
4125
|
-
}
|
|
4126
|
-
|
|
4127
|
-
key = collection.getKeyAfter(key);
|
|
4128
|
-
}
|
|
4129
|
-
}
|
|
4130
|
-
}, {
|
|
4131
|
-
key: "getKeyPageAbove",
|
|
4132
|
-
value: function getKeyPageAbove(key) {
|
|
4133
|
-
var layoutInfo = this.getLayoutInfo('item', key);
|
|
4134
|
-
var pageY = Math.max(0, layoutInfo.rect.y + layoutInfo.rect.height - this.collectionManager.visibleRect.height);
|
|
4135
|
-
|
|
4136
|
-
while (layoutInfo && layoutInfo.rect.y > pageY && layoutInfo) {
|
|
4137
|
-
var keyAbove = this.getKeyAbove(layoutInfo.key);
|
|
4138
|
-
layoutInfo = this.getLayoutInfo('item', keyAbove);
|
|
4139
|
-
}
|
|
4140
|
-
|
|
4141
|
-
if (layoutInfo) {
|
|
4142
|
-
return layoutInfo.key;
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
|
-
return this.getFirstKey();
|
|
4146
|
-
}
|
|
4147
|
-
}, {
|
|
4148
|
-
key: "getKeyPageBelow",
|
|
4149
|
-
value: function getKeyPageBelow(key) {
|
|
4150
|
-
var layoutInfo = this.getLayoutInfo('item', key);
|
|
4151
|
-
var pageY = Math.min(this.collectionManager.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.collectionManager.visibleRect.height);
|
|
4152
|
-
|
|
4153
|
-
while (layoutInfo && layoutInfo.rect.y < pageY) {
|
|
4154
|
-
var keyBelow = this.getKeyBelow(layoutInfo.key);
|
|
4155
|
-
layoutInfo = this.getLayoutInfo('item', keyBelow);
|
|
4156
|
-
}
|
|
4157
|
-
|
|
4158
|
-
if (layoutInfo) {
|
|
4159
|
-
return layoutInfo.key;
|
|
4160
|
-
}
|
|
4161
|
-
|
|
4162
|
-
return this.getLastKey();
|
|
4163
|
-
}
|
|
4164
|
-
}, {
|
|
4165
|
-
key: "getFirstKey",
|
|
4166
|
-
value: function getFirstKey() {
|
|
4167
|
-
var collection = this.collection;
|
|
4168
|
-
var key = collection.getFirstKey();
|
|
4169
|
-
|
|
4170
|
-
while (key) {
|
|
4171
|
-
var item = collection.getItem(key);
|
|
4172
|
-
|
|
4173
|
-
if (item.type === 'item' && !item.isDisabled) {
|
|
4174
|
-
return key;
|
|
4175
|
-
}
|
|
4176
|
-
|
|
4177
|
-
key = collection.getKeyAfter(key);
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
}, {
|
|
4181
|
-
key: "getLastKey",
|
|
4182
|
-
value: function getLastKey() {
|
|
4183
|
-
var collection = this.collection;
|
|
4184
|
-
var key = collection.getLastKey();
|
|
4185
|
-
|
|
4186
|
-
while (key) {
|
|
4187
|
-
var item = collection.getItem(key);
|
|
4188
|
-
|
|
4189
|
-
if (item.type === 'item' && !item.isDisabled) {
|
|
4190
|
-
return key;
|
|
4191
|
-
}
|
|
4192
|
-
|
|
4193
|
-
key = collection.getKeyBefore(key);
|
|
4194
|
-
}
|
|
4195
|
-
}
|
|
4196
|
-
}, {
|
|
4197
|
-
key: "getKeyForSearch",
|
|
4198
|
-
value: function getKeyForSearch(search, fromKey) {
|
|
4199
|
-
if (!this.collator) {
|
|
4200
|
-
return null;
|
|
4201
|
-
}
|
|
4202
|
-
|
|
4203
|
-
var collection = this.collection;
|
|
4204
|
-
var key = fromKey ? this.getKeyBelow(fromKey) : this.getFirstKey();
|
|
4205
|
-
|
|
4206
|
-
while (key) {
|
|
4207
|
-
var item = collection.getItem(key);
|
|
4208
|
-
var substring = item.textValue.slice(0, search.length);
|
|
4209
|
-
|
|
4210
|
-
if (item.textValue && this.collator.compare(substring, search) === 0) {
|
|
4211
|
-
return key;
|
|
4212
|
-
}
|
|
4213
|
-
|
|
4214
|
-
key = this.getKeyBelow(key);
|
|
4215
|
-
}
|
|
4216
|
-
|
|
4217
|
-
return null;
|
|
4218
|
-
} // getDragTarget(point: Point): DragTarget {
|
|
4219
|
-
// let visible = this.getVisibleLayoutInfos(new Rect(point.x, point.y, 1, 1));
|
|
4220
|
-
// if (visible.length > 0) {
|
|
4221
|
-
// visible = visible.sort((a, b) => b.zIndex - a.zIndex);
|
|
4222
|
-
// return {
|
|
4223
|
-
// type: 'item',
|
|
4224
|
-
// key: visible[0].key
|
|
4225
|
-
// };
|
|
4226
|
-
// }
|
|
4227
|
-
// return null;
|
|
4228
|
-
// }
|
|
4229
|
-
// getDropTarget(point: Point): DropTarget {
|
|
4230
|
-
// let key = this.collectionManager.keyAtPoint(point);
|
|
4231
|
-
// if (key) {
|
|
4232
|
-
// return {
|
|
4233
|
-
// type: 'item',
|
|
4234
|
-
// key,
|
|
4235
|
-
// dropPosition: DropPosition.ON
|
|
4236
|
-
// };
|
|
4237
|
-
// }
|
|
4238
|
-
// return null;
|
|
4239
|
-
// }
|
|
4240
|
-
|
|
4241
|
-
}, {
|
|
4242
|
-
key: "getInitialLayoutInfo",
|
|
4243
|
-
value: function getInitialLayoutInfo(layoutInfo) {
|
|
4244
|
-
layoutInfo.opacity = 0;
|
|
4245
|
-
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
|
|
4246
|
-
return layoutInfo;
|
|
4247
|
-
}
|
|
4248
|
-
}, {
|
|
4249
|
-
key: "getFinalLayoutInfo",
|
|
4250
|
-
value: function getFinalLayoutInfo(layoutInfo) {
|
|
4251
|
-
layoutInfo.opacity = 0;
|
|
4252
|
-
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
|
|
4253
|
-
return layoutInfo;
|
|
4254
|
-
}
|
|
4255
|
-
}]);
|
|
4256
|
-
|
|
4257
|
-
return ListLayout;
|
|
4258
|
-
}(Layout);
|
|
4259
|
-
|
|
4260
|
-
exports.ListLayout = ListLayout;
|
|
4261
|
-
|
|
4262
|
-
function useCollectionState(opts) {
|
|
4263
|
-
var _useState = useState([]),
|
|
4264
|
-
_useState2 = _babelRuntimeHelpersSlicedToArray(_useState, 2),
|
|
4265
|
-
visibleViews = _useState2[0],
|
|
4266
|
-
setVisibleViews = _useState2[1];
|
|
4267
|
-
|
|
4268
|
-
var _useState3 = useState(new Rect()),
|
|
4269
|
-
_useState4 = _babelRuntimeHelpersSlicedToArray(_useState3, 2),
|
|
4270
|
-
visibleRect = _useState4[0],
|
|
4271
|
-
_setVisibleRect = _useState4[1];
|
|
4272
|
-
|
|
4273
|
-
var _useState5 = useState(new Size()),
|
|
4274
|
-
_useState6 = _babelRuntimeHelpersSlicedToArray(_useState5, 2),
|
|
4275
|
-
contentSize = _useState6[0],
|
|
4276
|
-
setContentSize = _useState6[1];
|
|
4277
|
-
|
|
4278
|
-
var _useState7 = useState(false),
|
|
4279
|
-
_useState8 = _babelRuntimeHelpersSlicedToArray(_useState7, 2),
|
|
4280
|
-
isAnimating = _useState8[0],
|
|
4281
|
-
setAnimating = _useState8[1];
|
|
4282
|
-
|
|
4283
|
-
var collectionManager = useMemo(function () {
|
|
4284
|
-
return new CollectionManager();
|
|
4285
|
-
}, []);
|
|
4286
|
-
collectionManager.delegate = {
|
|
4287
|
-
setVisibleViews: setVisibleViews,
|
|
4288
|
-
setVisibleRect: function setVisibleRect(rect) {
|
|
4289
|
-
collectionManager.visibleRect = rect;
|
|
4290
|
-
|
|
4291
|
-
_setVisibleRect(rect);
|
|
4292
|
-
},
|
|
4293
|
-
setContentSize: setContentSize,
|
|
4294
|
-
renderView: opts.renderView,
|
|
4295
|
-
renderWrapper: opts.renderWrapper,
|
|
4296
|
-
beginAnimations: function beginAnimations() {
|
|
4297
|
-
return setAnimating(true);
|
|
4298
|
-
},
|
|
4299
|
-
endAnimations: function endAnimations() {
|
|
4300
|
-
return setAnimating(false);
|
|
4301
|
-
},
|
|
4302
|
-
getScrollAnchor: opts.getScrollAnchor
|
|
4303
|
-
};
|
|
4304
|
-
collectionManager.layout = opts.layout;
|
|
4305
|
-
collectionManager.collection = opts.collection;
|
|
4306
|
-
collectionManager.visibleRect = visibleRect;
|
|
4307
|
-
useLayoutEffect(function () {
|
|
4308
|
-
collectionManager.afterRender();
|
|
4309
|
-
});
|
|
4310
|
-
return {
|
|
4311
|
-
collectionManager: collectionManager,
|
|
4312
|
-
visibleViews: visibleViews,
|
|
4313
|
-
visibleRect: visibleRect,
|
|
4314
|
-
setVisibleRect: function setVisibleRect(rect) {
|
|
4315
|
-
collectionManager.visibleRect = rect;
|
|
4316
|
-
|
|
4317
|
-
_setVisibleRect(rect);
|
|
4318
|
-
},
|
|
4319
|
-
contentSize: contentSize,
|
|
4320
|
-
isAnimating: isAnimating,
|
|
4321
|
-
startScrolling: function startScrolling() {
|
|
4322
|
-
collectionManager.startScrolling();
|
|
4323
|
-
},
|
|
4324
|
-
endScrolling: function endScrolling() {
|
|
4325
|
-
collectionManager.endScrolling();
|
|
4326
|
-
}
|
|
4327
|
-
};
|
|
4328
|
-
}
|
|
4329
|
-
|
|
4330
|
-
exports.useCollectionState = useCollectionState;
|
|
4331
|
-
|
|
4332
|
-
function $c1b8d4171cdf614f347a94636ac703c$var$reducer(state, _ref) {
|
|
4333
|
-
var type = _ref.type,
|
|
4334
|
-
rest = _babelRuntimeHelpersObjectWithoutProperties(_ref, ["type"]);
|
|
4335
|
-
|
|
4336
|
-
switch (type) {
|
|
4337
|
-
case 'fetching':
|
|
4338
|
-
case 'sorting':
|
|
4339
|
-
return _babelRuntimeHelpersObjectSpread({}, state, {}, rest, {
|
|
4340
|
-
isLoading: true
|
|
4341
|
-
});
|
|
4342
|
-
|
|
4343
|
-
case 'error':
|
|
4344
|
-
return _babelRuntimeHelpersObjectSpread({}, state, {}, rest, {
|
|
4345
|
-
isLoading: false
|
|
4346
|
-
});
|
|
4347
|
-
|
|
4348
|
-
case 'success':
|
|
4349
|
-
return _babelRuntimeHelpersObjectSpread({}, state, {}, rest, {
|
|
4350
|
-
isLoading: false
|
|
4351
|
-
});
|
|
4352
|
-
|
|
4353
|
-
default:
|
|
4354
|
-
throw new Error();
|
|
4355
|
-
}
|
|
4356
|
-
}
|
|
4357
|
-
|
|
4358
|
-
function useAsyncList(options) {
|
|
4359
|
-
var load = options.load,
|
|
4360
|
-
loadMore = options.loadMore,
|
|
4361
|
-
sort = options.sort,
|
|
4362
|
-
defaultSortDescriptor = options.defaultSortDescriptor;
|
|
4363
|
-
|
|
4364
|
-
var _useReducer = useReducer($c1b8d4171cdf614f347a94636ac703c$var$reducer, {
|
|
4365
|
-
error: null,
|
|
4366
|
-
isLoading: true,
|
|
4367
|
-
items: [],
|
|
4368
|
-
sortDescriptor: defaultSortDescriptor || null,
|
|
4369
|
-
fetchFunction: load
|
|
4370
|
-
}),
|
|
4371
|
-
_useReducer2 = _babelRuntimeHelpersSlicedToArray(_useReducer, 2),
|
|
4372
|
-
state = _useReducer2[0],
|
|
4373
|
-
dispatch = _useReducer2[1];
|
|
4374
|
-
|
|
4375
|
-
var fetchData = /*#__PURE__*/function () {
|
|
4376
|
-
var _ref2 = _babelRuntimeHelpersAsyncToGenerator( /*#__PURE__*/_babelRuntimeRegenerator.mark(function _callee(fn) {
|
|
4377
|
-
var response;
|
|
4378
|
-
return _babelRuntimeRegenerator.wrap(function _callee$(_context) {
|
|
4379
|
-
while (1) {
|
|
4380
|
-
switch (_context.prev = _context.next) {
|
|
4381
|
-
case 0:
|
|
4382
|
-
_context.prev = 0;
|
|
4383
|
-
_context.next = 3;
|
|
4384
|
-
return fn(_babelRuntimeHelpersObjectSpread({}, state));
|
|
4385
|
-
|
|
4386
|
-
case 3:
|
|
4387
|
-
response = _context.sent;
|
|
4388
|
-
dispatch(_babelRuntimeHelpersObjectSpread({
|
|
4389
|
-
type: 'success'
|
|
4390
|
-
}, response));
|
|
4391
|
-
_context.next = 10;
|
|
4392
|
-
break;
|
|
4393
|
-
|
|
4394
|
-
case 7:
|
|
4395
|
-
_context.prev = 7;
|
|
4396
|
-
_context.t0 = _context["catch"](0);
|
|
4397
|
-
dispatch({
|
|
4398
|
-
type: 'error',
|
|
4399
|
-
error: _context.t0
|
|
4400
|
-
});
|
|
4401
|
-
|
|
4402
|
-
case 10:
|
|
4403
|
-
case "end":
|
|
4404
|
-
return _context.stop();
|
|
4405
|
-
}
|
|
4406
|
-
}
|
|
4407
|
-
}, _callee, null, [[0, 7]]);
|
|
4408
|
-
}));
|
|
4409
|
-
|
|
4410
|
-
return function fetchData(_x) {
|
|
4411
|
-
return _ref2.apply(this, arguments);
|
|
4412
|
-
};
|
|
4413
|
-
}();
|
|
4414
|
-
|
|
4415
|
-
var onLoadMore = !loadMore ? null : function () {
|
|
4416
|
-
dispatch({
|
|
4417
|
-
type: 'fetching',
|
|
4418
|
-
fetchFunction: loadMore
|
|
4419
|
-
});
|
|
4420
|
-
};
|
|
4421
|
-
|
|
4422
|
-
var onSortChange = function onSortChange(desc) {
|
|
4423
|
-
dispatch({
|
|
4424
|
-
type: 'sorting',
|
|
4425
|
-
fetchFunction: sort || load,
|
|
4426
|
-
sortDescriptor: desc
|
|
4427
|
-
});
|
|
4428
|
-
};
|
|
4429
|
-
|
|
4430
|
-
var fetchFunction = state.fetchFunction,
|
|
4431
|
-
otherState = _babelRuntimeHelpersObjectWithoutProperties(state, ["fetchFunction"]);
|
|
4432
|
-
|
|
4433
|
-
useEffect(function () {
|
|
4434
|
-
if (state.isLoading) {
|
|
4435
|
-
fetchData(fetchFunction);
|
|
4436
|
-
}
|
|
4437
|
-
});
|
|
4438
|
-
return _babelRuntimeHelpersObjectSpread({}, otherState, {
|
|
4439
|
-
onLoadMore: onLoadMore,
|
|
4440
|
-
onSortChange: onSortChange
|
|
4441
|
-
});
|
|
4442
|
-
}
|
|
4443
|
-
|
|
4444
|
-
exports.useAsyncList = useAsyncList;
|
|
41
|
+
//# sourceMappingURL=main.js.map
|