tp-react-elements-dev 1.13.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/_virtual/_commonjsHelpers.esm.js +30 -0
  2. package/dist/_virtual/defaultRanges.esm.js +3 -0
  3. package/dist/_virtual/index.esm.esm.js +6 -0
  4. package/dist/_virtual/index.esm.js +5 -0
  5. package/dist/_virtual/index.esm10.js +3 -0
  6. package/dist/_virtual/index.esm11.js +3 -0
  7. package/dist/_virtual/index.esm12.js +3 -0
  8. package/dist/_virtual/index.esm13.js +3 -0
  9. package/dist/_virtual/index.esm14.js +3 -0
  10. package/dist/_virtual/index.esm2.js +3 -0
  11. package/dist/_virtual/index.esm3.js +3 -0
  12. package/dist/_virtual/index.esm4.js +3 -0
  13. package/dist/_virtual/index.esm5.js +3 -0
  14. package/dist/_virtual/index.esm6.js +3 -0
  15. package/dist/_virtual/index.esm7.js +3 -0
  16. package/dist/_virtual/index.esm8.js +3 -0
  17. package/dist/_virtual/index.esm9.js +3 -0
  18. package/dist/_virtual/react-is.development.esm.js +3 -0
  19. package/dist/_virtual/react-is.production.min.esm.js +3 -0
  20. package/dist/_virtual/react-list.esm.js +3 -0
  21. package/dist/_virtual/styles.esm.js +3 -0
  22. package/dist/_virtual/utils.esm.js +3 -0
  23. package/dist/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  24. package/dist/components/DateRangePicker/DateRangePicker.esm.js +83 -0
  25. package/dist/components/DateRangePicker/index.d.ts +2 -0
  26. package/dist/components/DateRangePicker/index.esm.js +5 -0
  27. package/dist/components/Form/FormRender.esm.js +4 -0
  28. package/dist/index.esm.css +1 -1
  29. package/dist/node_modules/classnames/index.esm.js +85 -0
  30. package/dist/node_modules/object-assign/index.esm.js +99 -0
  31. package/dist/node_modules/prop-types/checkPropTypes.esm.js +115 -0
  32. package/dist/node_modules/prop-types/factoryWithThrowingShims.esm.js +74 -0
  33. package/dist/node_modules/prop-types/factoryWithTypeCheckers.esm.js +625 -0
  34. package/dist/node_modules/prop-types/index.esm.js +33 -0
  35. package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.esm.js +21 -0
  36. package/dist/node_modules/prop-types/lib/has.esm.js +11 -0
  37. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.esm.js +190 -0
  38. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.esm.js +26 -0
  39. package/dist/node_modules/prop-types/node_modules/react-is/index.esm.js +19 -0
  40. package/dist/node_modules/react-date-range/dist/accessibility/index.esm.js +29 -0
  41. package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +644 -0
  42. package/dist/node_modules/react-date-range/dist/components/DateInput/index.esm.js +153 -0
  43. package/dist/node_modules/react-date-range/dist/components/DateRange/index.esm.js +212 -0
  44. package/dist/node_modules/react-date-range/dist/components/DateRangePicker/index.esm.js +72 -0
  45. package/dist/node_modules/react-date-range/dist/components/DayCell/index.esm.js +252 -0
  46. package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +166 -0
  47. package/dist/node_modules/react-date-range/dist/components/InputRangeField/index.esm.js +91 -0
  48. package/dist/node_modules/react-date-range/dist/components/Month/index.esm.js +146 -0
  49. package/dist/node_modules/react-date-range/dist/defaultRanges.esm.js +111 -0
  50. package/dist/node_modules/react-date-range/dist/index.esm.js +70 -0
  51. package/dist/node_modules/react-date-range/dist/styles.esm.js +69 -0
  52. package/dist/node_modules/react-date-range/dist/utils.esm.js +93 -0
  53. package/dist/node_modules/react-list/react-list.esm.js +647 -0
  54. package/dist/node_modules/shallow-equal/dist/index.esm.esm.js +53 -0
  55. package/dist/utils/Interface/FormInterface.d.ts +1 -1
  56. package/package.json +6 -12
@@ -0,0 +1,647 @@
1
+ import { __exports as reactList } from '../../_virtual/react-list.esm.js';
2
+ import React__default from 'react';
3
+ import require$$1 from 'react/jsx-runtime';
4
+
5
+ var hasRequiredReactList;
6
+
7
+ function requireReactList () {
8
+ if (hasRequiredReactList) return reactList;
9
+ hasRequiredReactList = 1;
10
+ (function (exports) {
11
+ (function (global, factory) {
12
+ {
13
+ factory(exports, React__default, require$$1);
14
+ }
15
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : reactList, function (_exports, _react, _jsxRuntime) {
16
+
17
+ Object.defineProperty(_exports, "__esModule", {
18
+ value: true
19
+ });
20
+ _exports["default"] = void 0;
21
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
22
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
23
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
24
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: false }), e; }
25
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
26
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
27
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
28
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
29
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
30
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: true, configurable: true } }), Object.defineProperty(t, "prototype", { writable: false }), e && _setPrototypeOf(t, e); }
31
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
32
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
33
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
34
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
35
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
36
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
37
+ var CLIENT_SIZE_KEYS = {
38
+ x: 'clientWidth',
39
+ y: 'clientHeight'
40
+ };
41
+ var CLIENT_START_KEYS = {
42
+ x: 'clientTop',
43
+ y: 'clientLeft'
44
+ };
45
+ var INNER_SIZE_KEYS = {
46
+ x: 'innerWidth',
47
+ y: 'innerHeight'
48
+ };
49
+ var OFFSET_SIZE_KEYS = {
50
+ x: 'offsetWidth',
51
+ y: 'offsetHeight'
52
+ };
53
+ var OFFSET_START_KEYS = {
54
+ x: 'offsetLeft',
55
+ y: 'offsetTop'
56
+ };
57
+ var OVERFLOW_KEYS = {
58
+ x: 'overflowX',
59
+ y: 'overflowY'
60
+ };
61
+ var SCROLL_SIZE_KEYS = {
62
+ x: 'scrollWidth',
63
+ y: 'scrollHeight'
64
+ };
65
+ var SCROLL_START_KEYS = {
66
+ x: 'scrollLeft',
67
+ y: 'scrollTop'
68
+ };
69
+ var SIZE_KEYS = {
70
+ x: 'width',
71
+ y: 'height'
72
+ };
73
+ var NOOP = function NOOP() {};
74
+
75
+ // If a browser doesn't support the `options` argument to
76
+ // add/removeEventListener, we need to check, otherwise we will
77
+ // accidentally set `capture` with a truthy value.
78
+ var PASSIVE = function () {
79
+ if (typeof window === 'undefined') return false;
80
+ var hasSupport = false;
81
+ try {
82
+ document.createElement('div').addEventListener('test', NOOP, {
83
+ get passive() {
84
+ hasSupport = true;
85
+ return false;
86
+ }
87
+ });
88
+ } catch (e) {
89
+ // noop
90
+ }
91
+ return hasSupport;
92
+ }() ? {
93
+ passive: true
94
+ } : false;
95
+ var UNSTABLE_MESSAGE = 'ReactList failed to reach a stable state.';
96
+ var MAX_SYNC_UPDATES = 40;
97
+ var isEqualSubset = function isEqualSubset(a, b) {
98
+ for (var key in b) if (a[key] !== b[key]) return false;
99
+ return true;
100
+ };
101
+ var defaultScrollParentGetter = function defaultScrollParentGetter(component) {
102
+ var axis = component.props.axis;
103
+ var el = component.getEl();
104
+ var overflowKey = OVERFLOW_KEYS[axis];
105
+ while (el = el.parentElement) {
106
+ switch (window.getComputedStyle(el)[overflowKey]) {
107
+ case 'auto':
108
+ case 'scroll':
109
+ case 'overlay':
110
+ return el;
111
+ }
112
+ }
113
+ return window;
114
+ };
115
+ var defaultScrollParentViewportSizeGetter = function defaultScrollParentViewportSizeGetter(component) {
116
+ var axis = component.props.axis;
117
+ var scrollParent = component.scrollParent;
118
+ return scrollParent === window ? window[INNER_SIZE_KEYS[axis]] : scrollParent[CLIENT_SIZE_KEYS[axis]];
119
+ };
120
+ var constrain = function constrain(props, state) {
121
+ var length = props.length,
122
+ minSize = props.minSize,
123
+ type = props.type;
124
+ var from = state.from,
125
+ size = state.size,
126
+ itemsPerRow = state.itemsPerRow;
127
+ size = Math.max(size, minSize);
128
+ var mod = size % itemsPerRow;
129
+ if (mod) size += itemsPerRow - mod;
130
+ if (size > length) size = length;
131
+ from = type === 'simple' || !from ? 0 : Math.max(Math.min(from, length - size), 0);
132
+ if (mod = from % itemsPerRow) {
133
+ from -= mod;
134
+ size += mod;
135
+ }
136
+ if (from === state.from && size === state.size) return state;
137
+ return _objectSpread(_objectSpread({}, state), {}, {
138
+ from: from,
139
+ size: size
140
+ });
141
+ };
142
+ var ReactList = _exports["default"] = /*#__PURE__*/function (_Component) {
143
+ function ReactList(props) {
144
+ var _this;
145
+ _classCallCheck(this, ReactList);
146
+ _this = _callSuper(this, ReactList, [props]);
147
+ _this.state = constrain(props, {
148
+ itemsPerRow: 1,
149
+ from: props.initialIndex,
150
+ size: 0
151
+ });
152
+ _this.cache = {};
153
+ _this.cachedScrollPosition = null;
154
+ _this.prevPrevState = {};
155
+ _this.unstable = false;
156
+ _this.updateCounter = 0;
157
+ return _this;
158
+ }
159
+ _inherits(ReactList, _Component);
160
+ return _createClass(ReactList, [{
161
+ key: "componentDidMount",
162
+ value: function componentDidMount() {
163
+ this.updateFrameAndClearCache = this.updateFrameAndClearCache.bind(this);
164
+ window.addEventListener('resize', this.updateFrameAndClearCache);
165
+ this.updateFrame(this.scrollTo.bind(this, this.props.initialIndex));
166
+ }
167
+ }, {
168
+ key: "componentDidUpdate",
169
+ value: function componentDidUpdate(prevProps) {
170
+ var _this2 = this;
171
+ // Viewport scroll is no longer useful if axis changes
172
+ if (this.props.axis !== prevProps.axis) this.clearSizeCache();
173
+
174
+ // If the list has reached an unstable state, prevent an infinite loop.
175
+ if (this.unstable) return;
176
+ if (++this.updateCounter > MAX_SYNC_UPDATES) {
177
+ this.unstable = true;
178
+ return console.error(UNSTABLE_MESSAGE);
179
+ }
180
+ if (!this.updateCounterTimeoutId) {
181
+ this.updateCounterTimeoutId = setTimeout(function () {
182
+ _this2.updateCounter = 0;
183
+ delete _this2.updateCounterTimeoutId;
184
+ }, 0);
185
+ }
186
+ this.updateFrame();
187
+ }
188
+ }, {
189
+ key: "maybeSetState",
190
+ value: function maybeSetState(b, cb) {
191
+ if (isEqualSubset(this.state, b)) return cb();
192
+ this.setState(b, cb);
193
+ }
194
+ }, {
195
+ key: "componentWillUnmount",
196
+ value: function componentWillUnmount() {
197
+ window.removeEventListener('resize', this.updateFrameAndClearCache);
198
+ this.scrollParent.removeEventListener('scroll', this.updateFrameAndClearCache, PASSIVE);
199
+ this.scrollParent.removeEventListener('mousewheel', NOOP, PASSIVE);
200
+ }
201
+ }, {
202
+ key: "getOffset",
203
+ value: function getOffset(el) {
204
+ var axis = this.props.axis;
205
+ var offset = el[CLIENT_START_KEYS[axis]] || 0;
206
+ var offsetKey = OFFSET_START_KEYS[axis];
207
+ do offset += el[offsetKey] || 0; while (el = el.offsetParent);
208
+ return offset;
209
+ }
210
+ }, {
211
+ key: "getEl",
212
+ value: function getEl() {
213
+ return this.el || this.items;
214
+ }
215
+ }, {
216
+ key: "getScrollPosition",
217
+ value: function getScrollPosition() {
218
+ // Cache scroll position as this causes a forced synchronous layout.
219
+ if (typeof this.cachedScrollPosition === 'number') {
220
+ return this.cachedScrollPosition;
221
+ }
222
+ var scrollParent = this.scrollParent;
223
+ var axis = this.props.axis;
224
+ var scrollKey = SCROLL_START_KEYS[axis];
225
+ var actual = scrollParent === window ?
226
+ // Firefox always returns document.body[scrollKey] as 0 and Chrome/Safari
227
+ // always return document.documentElement[scrollKey] as 0, so take
228
+ // whichever has a value.
229
+ document.body[scrollKey] || document.documentElement[scrollKey] : scrollParent[scrollKey];
230
+ var max = this.getScrollSize() - this.props.scrollParentViewportSizeGetter(this);
231
+ var scroll = Math.max(0, Math.min(actual, max));
232
+ var el = this.getEl();
233
+ this.cachedScrollPosition = this.getOffset(scrollParent) + scroll - this.getOffset(el);
234
+ return this.cachedScrollPosition;
235
+ }
236
+ }, {
237
+ key: "setScroll",
238
+ value: function setScroll(offset) {
239
+ var scrollParent = this.scrollParent;
240
+ var axis = this.props.axis;
241
+ offset += this.getOffset(this.getEl());
242
+ if (scrollParent === window) return window.scrollTo(0, offset);
243
+ offset -= this.getOffset(this.scrollParent);
244
+ scrollParent[SCROLL_START_KEYS[axis]] = offset;
245
+ }
246
+ }, {
247
+ key: "getScrollSize",
248
+ value: function getScrollSize() {
249
+ var scrollParent = this.scrollParent;
250
+ var _document = document,
251
+ body = _document.body,
252
+ documentElement = _document.documentElement;
253
+ var key = SCROLL_SIZE_KEYS[this.props.axis];
254
+ return scrollParent === window ? Math.max(body[key], documentElement[key]) : scrollParent[key];
255
+ }
256
+ }, {
257
+ key: "hasDeterminateSize",
258
+ value: function hasDeterminateSize() {
259
+ var _this$props = this.props,
260
+ itemSizeGetter = _this$props.itemSizeGetter,
261
+ type = _this$props.type;
262
+ return type === 'uniform' || itemSizeGetter;
263
+ }
264
+ }, {
265
+ key: "getStartAndEnd",
266
+ value: function getStartAndEnd() {
267
+ var threshold = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.threshold;
268
+ var scroll = this.getScrollPosition();
269
+ var start = Math.max(0, scroll - threshold);
270
+ var end = scroll + this.props.scrollParentViewportSizeGetter(this) + threshold;
271
+ if (this.hasDeterminateSize()) {
272
+ end = Math.min(end, this.getSpaceBefore(this.props.length));
273
+ }
274
+ return {
275
+ start: start,
276
+ end: end
277
+ };
278
+ }
279
+ }, {
280
+ key: "getItemSizeAndItemsPerRow",
281
+ value: function getItemSizeAndItemsPerRow() {
282
+ var _this$props2 = this.props,
283
+ axis = _this$props2.axis,
284
+ useStaticSize = _this$props2.useStaticSize;
285
+ var _this$state = this.state,
286
+ itemSize = _this$state.itemSize,
287
+ itemsPerRow = _this$state.itemsPerRow;
288
+ if (useStaticSize && itemSize && itemsPerRow) {
289
+ return {
290
+ itemSize: itemSize,
291
+ itemsPerRow: itemsPerRow
292
+ };
293
+ }
294
+ var itemEls = this.items.children;
295
+ if (!itemEls.length) return {};
296
+ var firstEl = itemEls[0];
297
+
298
+ // Firefox has a problem where it will return a *slightly* (less than
299
+ // thousandths of a pixel) different size for the same element between
300
+ // renders. This can cause an infinite render loop, so only change the
301
+ // itemSize when it is significantly different.
302
+ var firstElSize = firstEl[OFFSET_SIZE_KEYS[axis]];
303
+ var delta = Math.abs(firstElSize - itemSize);
304
+ if (isNaN(delta) || delta >= 1) itemSize = firstElSize;
305
+ if (!itemSize) return {};
306
+ var startKey = OFFSET_START_KEYS[axis];
307
+ var firstStart = firstEl[startKey];
308
+ itemsPerRow = 1;
309
+ for (var item = itemEls[itemsPerRow]; item && item[startKey] === firstStart; item = itemEls[itemsPerRow]) {
310
+ ++itemsPerRow;
311
+ }
312
+ return {
313
+ itemSize: itemSize,
314
+ itemsPerRow: itemsPerRow
315
+ };
316
+ }
317
+ }, {
318
+ key: "clearSizeCache",
319
+ value: function clearSizeCache() {
320
+ this.cachedScrollPosition = null;
321
+ }
322
+
323
+ // Called by 'scroll' and 'resize' events, clears scroll position cache.
324
+ }, {
325
+ key: "updateFrameAndClearCache",
326
+ value: function updateFrameAndClearCache(cb) {
327
+ this.clearSizeCache();
328
+ return this.updateFrame(cb);
329
+ }
330
+ }, {
331
+ key: "updateFrame",
332
+ value: function updateFrame(cb) {
333
+ this.updateScrollParent();
334
+ if (typeof cb !== 'function') cb = NOOP;
335
+ switch (this.props.type) {
336
+ case 'simple':
337
+ return this.updateSimpleFrame(cb);
338
+ case 'variable':
339
+ return this.updateVariableFrame(cb);
340
+ case 'uniform':
341
+ return this.updateUniformFrame(cb);
342
+ }
343
+ }
344
+ }, {
345
+ key: "updateScrollParent",
346
+ value: function updateScrollParent() {
347
+ var prev = this.scrollParent;
348
+ this.scrollParent = this.props.scrollParentGetter(this);
349
+ if (prev === this.scrollParent) return;
350
+ if (prev) {
351
+ prev.removeEventListener('scroll', this.updateFrameAndClearCache);
352
+ prev.removeEventListener('mousewheel', NOOP);
353
+ }
354
+ // If we have a new parent, cached parent dimensions are no longer useful.
355
+ this.clearSizeCache();
356
+ this.scrollParent.addEventListener('scroll', this.updateFrameAndClearCache, PASSIVE);
357
+ // You have to attach mousewheel listener to the scrollable element.
358
+ // Just an empty listener. After that onscroll events will be fired synchronously.
359
+ this.scrollParent.addEventListener('mousewheel', NOOP, PASSIVE);
360
+ }
361
+ }, {
362
+ key: "updateSimpleFrame",
363
+ value: function updateSimpleFrame(cb) {
364
+ var _this$getStartAndEnd = this.getStartAndEnd(),
365
+ end = _this$getStartAndEnd.end;
366
+ var itemEls = this.items.children;
367
+ var elEnd = 0;
368
+ if (itemEls.length) {
369
+ var axis = this.props.axis;
370
+ var firstItemEl = itemEls[0];
371
+ var lastItemEl = itemEls[itemEls.length - 1];
372
+ elEnd = this.getOffset(lastItemEl) + lastItemEl[OFFSET_SIZE_KEYS[axis]] - this.getOffset(firstItemEl);
373
+ }
374
+ if (elEnd > end) return cb();
375
+ var _this$props3 = this.props,
376
+ pageSize = _this$props3.pageSize,
377
+ length = _this$props3.length;
378
+ var size = Math.min(this.state.size + pageSize, length);
379
+ this.maybeSetState({
380
+ size: size
381
+ }, cb);
382
+ }
383
+ }, {
384
+ key: "updateVariableFrame",
385
+ value: function updateVariableFrame(cb) {
386
+ if (!this.props.itemSizeGetter) this.cacheSizes();
387
+ var _this$getStartAndEnd2 = this.getStartAndEnd(),
388
+ start = _this$getStartAndEnd2.start,
389
+ end = _this$getStartAndEnd2.end;
390
+ var _this$props4 = this.props,
391
+ length = _this$props4.length,
392
+ pageSize = _this$props4.pageSize;
393
+ var space = 0;
394
+ var from = 0;
395
+ var size = 0;
396
+ var maxFrom = length - 1;
397
+ while (from < maxFrom) {
398
+ var itemSize = this.getSizeOfItem(from);
399
+ if (itemSize == null || space + itemSize > start) break;
400
+ space += itemSize;
401
+ ++from;
402
+ }
403
+ var maxSize = length - from;
404
+ while (size < maxSize && space < end) {
405
+ var _itemSize = this.getSizeOfItem(from + size);
406
+ if (_itemSize == null) {
407
+ size = Math.min(size + pageSize, maxSize);
408
+ break;
409
+ }
410
+ space += _itemSize;
411
+ ++size;
412
+ }
413
+ this.maybeSetState(constrain(this.props, {
414
+ from: from,
415
+ itemsPerRow: 1,
416
+ size: size
417
+ }), cb);
418
+ }
419
+ }, {
420
+ key: "updateUniformFrame",
421
+ value: function updateUniformFrame(cb) {
422
+ var _this$getItemSizeAndI = this.getItemSizeAndItemsPerRow(),
423
+ itemSize = _this$getItemSizeAndI.itemSize,
424
+ itemsPerRow = _this$getItemSizeAndI.itemsPerRow;
425
+ if (!itemSize || !itemsPerRow) return cb();
426
+ var _this$getStartAndEnd3 = this.getStartAndEnd(),
427
+ start = _this$getStartAndEnd3.start,
428
+ end = _this$getStartAndEnd3.end;
429
+ var _constrain = constrain(this.props, {
430
+ from: Math.floor(start / itemSize) * itemsPerRow,
431
+ size: (Math.ceil((end - start) / itemSize) + 1) * itemsPerRow,
432
+ itemsPerRow: itemsPerRow
433
+ }),
434
+ from = _constrain.from,
435
+ size = _constrain.size;
436
+ return this.maybeSetState({
437
+ itemsPerRow: itemsPerRow,
438
+ from: from,
439
+ itemSize: itemSize,
440
+ size: size
441
+ }, cb);
442
+ }
443
+ }, {
444
+ key: "getSpaceBefore",
445
+ value: function getSpaceBefore(index) {
446
+ var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
447
+ if (cache[index] != null) return cache[index];
448
+
449
+ // Try the static itemSize.
450
+ var _this$state2 = this.state,
451
+ itemSize = _this$state2.itemSize,
452
+ itemsPerRow = _this$state2.itemsPerRow;
453
+ if (itemSize) {
454
+ return cache[index] = Math.floor(index / itemsPerRow) * itemSize;
455
+ }
456
+
457
+ // Find the closest space to index there is a cached value for.
458
+ var from = index;
459
+ while (from > 0 && cache[--from] == null);
460
+
461
+ // Finally, accumulate sizes of items from - index.
462
+ var space = cache[from] || 0;
463
+ for (var i = from; i < index; ++i) {
464
+ cache[i] = space;
465
+ var _itemSize2 = this.getSizeOfItem(i);
466
+ if (_itemSize2 == null) break;
467
+ space += _itemSize2;
468
+ }
469
+ return cache[index] = space;
470
+ }
471
+ }, {
472
+ key: "cacheSizes",
473
+ value: function cacheSizes() {
474
+ var cache = this.cache;
475
+ var from = this.state.from;
476
+ var itemEls = this.items.children;
477
+ var sizeKey = OFFSET_SIZE_KEYS[this.props.axis];
478
+ for (var i = 0, l = itemEls.length; i < l; ++i) {
479
+ cache[from + i] = itemEls[i][sizeKey];
480
+ }
481
+ }
482
+ }, {
483
+ key: "getSizeOfItem",
484
+ value: function getSizeOfItem(index) {
485
+ var cache = this.cache,
486
+ items = this.items;
487
+ var _this$props5 = this.props,
488
+ axis = _this$props5.axis,
489
+ itemSizeGetter = _this$props5.itemSizeGetter,
490
+ itemSizeEstimator = _this$props5.itemSizeEstimator,
491
+ type = _this$props5.type;
492
+ var _this$state3 = this.state,
493
+ from = _this$state3.from,
494
+ itemSize = _this$state3.itemSize,
495
+ size = _this$state3.size;
496
+
497
+ // Try the static itemSize.
498
+ if (itemSize) return itemSize;
499
+
500
+ // Try the itemSizeGetter.
501
+ if (itemSizeGetter) return itemSizeGetter(index);
502
+
503
+ // Try the cache.
504
+ if (index in cache) return cache[index];
505
+
506
+ // Try the DOM.
507
+ if (type === 'simple' && index >= from && index < from + size && items) {
508
+ var itemEl = items.children[index - from];
509
+ if (itemEl) return itemEl[OFFSET_SIZE_KEYS[axis]];
510
+ }
511
+
512
+ // Try the itemSizeEstimator.
513
+ if (itemSizeEstimator) return itemSizeEstimator(index, cache);
514
+ }
515
+ }, {
516
+ key: "scrollTo",
517
+ value: function scrollTo(index) {
518
+ if (index != null) this.setScroll(this.getSpaceBefore(index));
519
+ }
520
+ }, {
521
+ key: "scrollAround",
522
+ value: function scrollAround(index) {
523
+ var current = this.getScrollPosition();
524
+ var bottom = this.getSpaceBefore(index);
525
+ var top = bottom - this.props.scrollParentViewportSizeGetter(this) + this.getSizeOfItem(index);
526
+ var min = Math.min(top, bottom);
527
+ var max = Math.max(top, bottom);
528
+ if (current <= min) return this.setScroll(min);
529
+ if (current > max) return this.setScroll(max);
530
+ }
531
+ }, {
532
+ key: "getVisibleRange",
533
+ value: function getVisibleRange() {
534
+ var _this$state4 = this.state,
535
+ from = _this$state4.from,
536
+ size = _this$state4.size;
537
+ var _this$getStartAndEnd4 = this.getStartAndEnd(0),
538
+ start = _this$getStartAndEnd4.start,
539
+ end = _this$getStartAndEnd4.end;
540
+ var cache = {};
541
+ var first, last;
542
+ for (var i = from; i < from + size; ++i) {
543
+ var itemStart = this.getSpaceBefore(i, cache);
544
+ var itemEnd = itemStart + this.getSizeOfItem(i);
545
+ if (first == null && itemEnd > start) first = i;
546
+ if (first != null && itemStart < end) last = i;
547
+ }
548
+ return [first, last];
549
+ }
550
+ }, {
551
+ key: "renderItems",
552
+ value: function renderItems() {
553
+ var _this3 = this;
554
+ var _this$props6 = this.props,
555
+ itemRenderer = _this$props6.itemRenderer,
556
+ itemsRenderer = _this$props6.itemsRenderer;
557
+ var _this$state5 = this.state,
558
+ from = _this$state5.from,
559
+ size = _this$state5.size;
560
+ var items = [];
561
+ for (var i = 0; i < size; ++i) items.push(itemRenderer(from + i, i));
562
+ return itemsRenderer(items, function (c) {
563
+ return _this3.items = c;
564
+ });
565
+ }
566
+ }, {
567
+ key: "render",
568
+ value: function render() {
569
+ var _this4 = this;
570
+ var _this$props7 = this.props,
571
+ axis = _this$props7.axis,
572
+ length = _this$props7.length,
573
+ type = _this$props7.type,
574
+ useTranslate3d = _this$props7.useTranslate3d;
575
+ var _this$state6 = this.state,
576
+ from = _this$state6.from,
577
+ itemsPerRow = _this$state6.itemsPerRow;
578
+ var items = this.renderItems();
579
+ if (type === 'simple') return items;
580
+ var style = {
581
+ position: 'relative'
582
+ };
583
+ var cache = {};
584
+ var bottom = Math.ceil(length / itemsPerRow) * itemsPerRow;
585
+ var size = this.getSpaceBefore(bottom, cache);
586
+ if (size) {
587
+ style[SIZE_KEYS[axis]] = size;
588
+ if (axis === 'x') style.overflowX = 'hidden';
589
+ }
590
+ var offset = this.getSpaceBefore(from, cache);
591
+ var x = axis === 'x' ? offset : 0;
592
+ var y = axis === 'y' ? offset : 0;
593
+ var transform = useTranslate3d ? "translate3d(".concat(x, "px, ").concat(y, "px, 0)") : "translate(".concat(x, "px, ").concat(y, "px)");
594
+ var listStyle = {
595
+ msTransform: transform,
596
+ WebkitTransform: transform,
597
+ transform: transform
598
+ };
599
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
600
+ style: style,
601
+ ref: function ref(c) {
602
+ return _this4.el = c;
603
+ },
604
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
605
+ style: listStyle,
606
+ children: items
607
+ })
608
+ });
609
+ }
610
+ }], [{
611
+ key: "getDerivedStateFromProps",
612
+ value: function getDerivedStateFromProps(props, state) {
613
+ var newState = constrain(props, state);
614
+ return newState === state ? null : newState;
615
+ }
616
+ }]);
617
+ }(_react.Component);
618
+ _defineProperty(ReactList, "displayName", 'ReactList');
619
+ _defineProperty(ReactList, "defaultProps", {
620
+ axis: 'y',
621
+ itemRenderer: function itemRenderer(index, key) {
622
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
623
+ children: index
624
+ }, key);
625
+ },
626
+ itemsRenderer: function itemsRenderer(items, ref) {
627
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
628
+ ref: ref,
629
+ children: items
630
+ });
631
+ },
632
+ length: 0,
633
+ minSize: 1,
634
+ pageSize: 10,
635
+ scrollParentGetter: defaultScrollParentGetter,
636
+ scrollParentViewportSizeGetter: defaultScrollParentViewportSizeGetter,
637
+ threshold: 100,
638
+ type: 'simple',
639
+ useStaticSize: false,
640
+ useTranslate3d: false
641
+ });
642
+ });
643
+ } (reactList));
644
+ return reactList;
645
+ }
646
+
647
+ export { requireReactList as __require };
@@ -0,0 +1,53 @@
1
+ function shallowEqualObjects(objA, objB) {
2
+ if (objA === objB) {
3
+ return true;
4
+ }
5
+
6
+ if (!objA || !objB) {
7
+ return false;
8
+ }
9
+
10
+ var aKeys = Object.keys(objA);
11
+ var bKeys = Object.keys(objB);
12
+ var len = aKeys.length;
13
+
14
+ if (bKeys.length !== len) {
15
+ return false;
16
+ }
17
+
18
+ for (var i = 0; i < len; i++) {
19
+ var key = aKeys[i];
20
+
21
+ if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ return true;
27
+ }
28
+
29
+ function shallowEqualArrays(arrA, arrB) {
30
+ if (arrA === arrB) {
31
+ return true;
32
+ }
33
+
34
+ if (!arrA || !arrB) {
35
+ return false;
36
+ }
37
+
38
+ var len = arrA.length;
39
+
40
+ if (arrB.length !== len) {
41
+ return false;
42
+ }
43
+
44
+ for (var i = 0; i < len; i++) {
45
+ if (arrA[i] !== arrB[i]) {
46
+ return false;
47
+ }
48
+ }
49
+
50
+ return true;
51
+ }
52
+
53
+ export { shallowEqualArrays, shallowEqualObjects };