@ohif/app 3.0.0 → 3.5.0
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/dist/151.bundle.07bac9172580a60fae7a.js +2579 -0
- package/dist/192.bundle.62be5f0ef9705a485071.js +894 -0
- package/dist/199.bundle.2286f24cf0a068e7f50c.js +480 -0
- package/dist/205.bundle.39e6c847d618ad2b1b7a.js +62 -0
- package/dist/208.bundle.23748a85dfdc79c05d3a.js +864 -0
- package/dist/270.bundle.abbdb5348274bae3e8bc.js +23906 -0
- package/dist/283.bundle.33f99a75a5e2d9333da2.js +2939 -0
- package/dist/295.bundle.5105ce962be15c92484d.js +48 -0
- package/dist/331.bundle.7ac7b142d249d14fd99e.js +73034 -0
- package/dist/351.bundle.c5d7279ef42e30f61e08.js +1471 -0
- package/dist/351.css +3 -0
- package/dist/36785fbd89b0e17f6099.wasm +0 -0
- package/dist/381.bundle.0905e683605fcbc0895f.js +1009 -0
- package/dist/404.bundle.0f7a500421f246153d89.js +706 -0
- package/dist/50.bundle.4cb103cd20f5ffccf927.js +324 -0
- package/dist/5004fdc02f329ce53b69.wasm +0 -0
- package/dist/531.bundle.1bc152c87c7e2e987d2b.js +5935 -0
- package/dist/55.bundle.a5a215e13a8511f7aee7.js +685 -0
- package/dist/55.css +3 -0
- package/dist/569.bundle.d147c0aa0604f8ea2094.js +514 -0
- package/dist/581.bundle.646c89c5c3e3ee096363.js +508 -0
- package/dist/606.bundle.5d876f5f3dd8287f0a28.js +4939 -0
- package/dist/610.min.worker.js +2 -0
- package/dist/610.min.worker.js.map +1 -0
- package/dist/616.bundle.bec4736d8c9513e62856.js +686 -0
- package/dist/62ab5d58a2bea7b5a1dc.wasm +0 -0
- package/dist/642.bundle.030d908e22c8ff5611f3.js +169 -0
- package/dist/65916ef3def695744bda.wasm +0 -0
- package/dist/664.bundle.4792c88ae0d6d4b5ed13.js +901 -0
- package/dist/707.bundle.0a74aa3e61ed002eb3c6.js +9049 -0
- package/dist/707.css +1 -0
- package/dist/728.bundle.d13856835357400fef82.js +26221 -0
- package/dist/744.bundle.53b07e48e07a11e920ac.js +2355 -0
- package/dist/75788f12450d4c5ed494.wasm +0 -0
- package/dist/75a0c2dfe07b824c7d21.wasm +0 -0
- package/dist/780.bundle.f60ac1906e0ae080dee8.js +4769 -0
- package/dist/790.bundle.b4df2c5d78a2a565b150.js +454 -0
- package/dist/799.bundle.3fff638815e355b0bdfd.js +271 -0
- package/dist/806.css +1 -0
- package/dist/82.bundle.a24015533196e05d190e.js +6104 -0
- package/dist/917.bundle.a094ae9e9de6df4119ae.js +196 -0
- package/dist/926.bundle.dbc9d0e591cb9217fda2.js +72552 -0
- package/dist/935.bundle.deeffff0e4f7b528e3c3.js +1849 -0
- package/dist/945.min.worker.js +2 -0
- package/dist/945.min.worker.js.map +1 -0
- package/dist/953.bundle.c14d9eb6400f697019ee.js +449 -0
- package/dist/973.bundle.4100cf103686b64938d1.js +261 -0
- package/dist/976.bundle.2720eb892514e1818018.js +2725 -0
- package/dist/984.bundle.157fc66ea5040e1364af.js +1842 -0
- package/dist/_headers +6 -0
- package/dist/_redirects +6 -0
- package/dist/app-config.js +215 -0
- package/dist/app.bundle.253eeb2a7ee986e89c50.js +154621 -0
- package/dist/app.bundle.css +21 -0
- package/dist/assets/android-chrome-144x144.png +0 -0
- package/dist/assets/android-chrome-192x192.png +0 -0
- package/dist/assets/android-chrome-256x256.png +0 -0
- package/dist/assets/android-chrome-36x36.png +0 -0
- package/dist/assets/android-chrome-384x384.png +0 -0
- package/dist/assets/android-chrome-48x48.png +0 -0
- package/dist/assets/android-chrome-512x512.png +0 -0
- package/dist/assets/android-chrome-72x72.png +0 -0
- package/dist/assets/android-chrome-96x96.png +0 -0
- package/dist/assets/apple-touch-icon-1024x1024.png +0 -0
- package/dist/assets/apple-touch-icon-114x114.png +0 -0
- package/dist/assets/apple-touch-icon-120x120.png +0 -0
- package/dist/assets/apple-touch-icon-144x144.png +0 -0
- package/dist/assets/apple-touch-icon-152x152.png +0 -0
- package/dist/assets/apple-touch-icon-167x167.png +0 -0
- package/dist/assets/apple-touch-icon-180x180.png +0 -0
- package/dist/assets/apple-touch-icon-57x57.png +0 -0
- package/dist/assets/apple-touch-icon-60x60.png +0 -0
- package/dist/assets/apple-touch-icon-72x72.png +0 -0
- package/dist/assets/apple-touch-icon-76x76.png +0 -0
- package/dist/assets/apple-touch-icon-precomposed.png +0 -0
- package/dist/assets/apple-touch-icon.png +0 -0
- package/dist/assets/apple-touch-startup-image-1182x2208.png +0 -0
- package/dist/assets/apple-touch-startup-image-1242x2148.png +0 -0
- package/dist/assets/apple-touch-startup-image-1496x2048.png +0 -0
- package/dist/assets/apple-touch-startup-image-1536x2008.png +0 -0
- package/dist/assets/apple-touch-startup-image-320x460.png +0 -0
- package/dist/assets/apple-touch-startup-image-640x1096.png +0 -0
- package/dist/assets/apple-touch-startup-image-640x920.png +0 -0
- package/dist/assets/apple-touch-startup-image-748x1024.png +0 -0
- package/dist/assets/apple-touch-startup-image-750x1294.png +0 -0
- package/dist/assets/apple-touch-startup-image-768x1004.png +0 -0
- package/dist/assets/browserconfig.xml +12 -0
- package/dist/assets/coast-228x228.png +0 -0
- package/dist/assets/favicon-16x16.png +0 -0
- package/dist/assets/favicon-32x32.png +0 -0
- package/dist/assets/favicon.ico +0 -0
- package/dist/assets/firefox_app_128x128.png +0 -0
- package/dist/assets/firefox_app_512x512.png +0 -0
- package/dist/assets/firefox_app_60x60.png +0 -0
- package/dist/assets/manifest.webapp +14 -0
- package/dist/assets/mstile-144x144.png +0 -0
- package/dist/assets/mstile-150x150.png +0 -0
- package/dist/assets/mstile-310x150.png +0 -0
- package/dist/assets/mstile-310x310.png +0 -0
- package/dist/assets/mstile-70x70.png +0 -0
- package/dist/assets/yandex-browser-50x50.png +0 -0
- package/dist/assets/yandex-browser-manifest.json +9 -0
- package/dist/b6b803111e2d06a825bd.wasm +0 -0
- package/dist/c22b37c3488e1d6c3aa4.wasm +0 -0
- package/dist/cornerstoneDICOMImageLoader.min.js +2 -0
- package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -0
- package/dist/dicom-microscopy-viewer.bundle.aa60bdf008c32c39cfd7.js +12 -0
- package/dist/dicomMicroscopyViewer.min.js +3 -0
- package/dist/dicomMicroscopyViewer.min.js.LICENSE.txt +29 -0
- package/dist/es6-shim.min.js +12 -0
- package/dist/google.js +75 -0
- package/dist/index.html +1 -0
- package/dist/index.worker.ea71efba2ce63c499055.worker.js +2 -0
- package/dist/index.worker.ea71efba2ce63c499055.worker.js.map +1 -0
- package/dist/index.worker.min.worker.js +2 -0
- package/dist/index.worker.min.worker.js.map +1 -0
- package/dist/init-service-worker.js +59 -0
- package/dist/manifest.json +59 -0
- package/dist/ohif-logo-light.svg +15 -0
- package/dist/ohif-logo.svg +15 -0
- package/dist/oidc-client.min.js +46 -0
- package/dist/polyfill.min.js +1 -0
- package/dist/silent-refresh.html +16 -0
- package/dist/sw.js +56 -0
- package/package.json +24 -23
|
@@ -0,0 +1,901 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[664],{
|
|
3
|
+
|
|
4
|
+
/***/ 14664:
|
|
5
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6
|
+
|
|
7
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8
|
+
/* harmony export */ "ZP": () => (/* binding */ ResizeDetector)
|
|
9
|
+
/* harmony export */ });
|
|
10
|
+
/* unused harmony exports useResizeDetector, withResizeDetector */
|
|
11
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32735);
|
|
12
|
+
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12788);
|
|
13
|
+
/*! *****************************************************************************
|
|
14
|
+
Copyright (c) Microsoft Corporation.
|
|
15
|
+
|
|
16
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
17
|
+
purpose with or without fee is hereby granted.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
22
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
24
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
+
***************************************************************************** */
|
|
27
|
+
/* global Reflect, Promise */
|
|
28
|
+
|
|
29
|
+
var extendStatics = function(d, b) {
|
|
30
|
+
extendStatics = Object.setPrototypeOf ||
|
|
31
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
32
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
33
|
+
return extendStatics(d, b);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function __extends(d, b) {
|
|
37
|
+
if (typeof b !== "function" && b !== null)
|
|
38
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
39
|
+
extendStatics(d, b);
|
|
40
|
+
function __() { this.constructor = d; }
|
|
41
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var __assign = function() {
|
|
45
|
+
__assign = Object.assign || function __assign(t) {
|
|
46
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
47
|
+
s = arguments[i];
|
|
48
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
49
|
+
}
|
|
50
|
+
return t;
|
|
51
|
+
};
|
|
52
|
+
return __assign.apply(this, arguments);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function __rest(s, e) {
|
|
56
|
+
var t = {};
|
|
57
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
58
|
+
t[p] = s[p];
|
|
59
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
60
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
61
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
62
|
+
t[p[i]] = s[p[i]];
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
}var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};/**
|
|
66
|
+
* Checks if `value` is the
|
|
67
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
68
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
69
|
+
*
|
|
70
|
+
* @static
|
|
71
|
+
* @memberOf _
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
* @category Lang
|
|
74
|
+
* @param {*} value The value to check.
|
|
75
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
76
|
+
* @example
|
|
77
|
+
*
|
|
78
|
+
* _.isObject({});
|
|
79
|
+
* // => true
|
|
80
|
+
*
|
|
81
|
+
* _.isObject([1, 2, 3]);
|
|
82
|
+
* // => true
|
|
83
|
+
*
|
|
84
|
+
* _.isObject(_.noop);
|
|
85
|
+
* // => true
|
|
86
|
+
*
|
|
87
|
+
* _.isObject(null);
|
|
88
|
+
* // => false
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
function isObject$3(value) {
|
|
92
|
+
var type = typeof value;
|
|
93
|
+
return value != null && (type == 'object' || type == 'function');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var isObject_1 = isObject$3;/** Detect free variable `global` from Node.js. */
|
|
97
|
+
|
|
98
|
+
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
99
|
+
|
|
100
|
+
var _freeGlobal = freeGlobal$1;var freeGlobal = _freeGlobal;
|
|
101
|
+
|
|
102
|
+
/** Detect free variable `self`. */
|
|
103
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
104
|
+
|
|
105
|
+
/** Used as a reference to the global object. */
|
|
106
|
+
var root$2 = freeGlobal || freeSelf || Function('return this')();
|
|
107
|
+
|
|
108
|
+
var _root = root$2;var root$1 = _root;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
112
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
113
|
+
*
|
|
114
|
+
* @static
|
|
115
|
+
* @memberOf _
|
|
116
|
+
* @since 2.4.0
|
|
117
|
+
* @category Date
|
|
118
|
+
* @returns {number} Returns the timestamp.
|
|
119
|
+
* @example
|
|
120
|
+
*
|
|
121
|
+
* _.defer(function(stamp) {
|
|
122
|
+
* console.log(_.now() - stamp);
|
|
123
|
+
* }, _.now());
|
|
124
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
125
|
+
*/
|
|
126
|
+
var now$1 = function() {
|
|
127
|
+
return root$1.Date.now();
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var now_1 = now$1;/** Used to match a single whitespace character. */
|
|
131
|
+
|
|
132
|
+
var reWhitespace = /\s/;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
136
|
+
* character of `string`.
|
|
137
|
+
*
|
|
138
|
+
* @private
|
|
139
|
+
* @param {string} string The string to inspect.
|
|
140
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
141
|
+
*/
|
|
142
|
+
function trimmedEndIndex$1(string) {
|
|
143
|
+
var index = string.length;
|
|
144
|
+
|
|
145
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
146
|
+
return index;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var _trimmedEndIndex = trimmedEndIndex$1;var trimmedEndIndex = _trimmedEndIndex;
|
|
150
|
+
|
|
151
|
+
/** Used to match leading whitespace. */
|
|
152
|
+
var reTrimStart = /^\s+/;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The base implementation of `_.trim`.
|
|
156
|
+
*
|
|
157
|
+
* @private
|
|
158
|
+
* @param {string} string The string to trim.
|
|
159
|
+
* @returns {string} Returns the trimmed string.
|
|
160
|
+
*/
|
|
161
|
+
function baseTrim$1(string) {
|
|
162
|
+
return string
|
|
163
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
164
|
+
: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var _baseTrim = baseTrim$1;var root = _root;
|
|
168
|
+
|
|
169
|
+
/** Built-in value references. */
|
|
170
|
+
var Symbol$2 = root.Symbol;
|
|
171
|
+
|
|
172
|
+
var _Symbol = Symbol$2;var Symbol$1 = _Symbol;
|
|
173
|
+
|
|
174
|
+
/** Used for built-in method references. */
|
|
175
|
+
var objectProto$1 = Object.prototype;
|
|
176
|
+
|
|
177
|
+
/** Used to check objects for own properties. */
|
|
178
|
+
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Used to resolve the
|
|
182
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
183
|
+
* of values.
|
|
184
|
+
*/
|
|
185
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
186
|
+
|
|
187
|
+
/** Built-in value references. */
|
|
188
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
192
|
+
*
|
|
193
|
+
* @private
|
|
194
|
+
* @param {*} value The value to query.
|
|
195
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
196
|
+
*/
|
|
197
|
+
function getRawTag$1(value) {
|
|
198
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1),
|
|
199
|
+
tag = value[symToStringTag$1];
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
value[symToStringTag$1] = undefined;
|
|
203
|
+
var unmasked = true;
|
|
204
|
+
} catch (e) {}
|
|
205
|
+
|
|
206
|
+
var result = nativeObjectToString$1.call(value);
|
|
207
|
+
if (unmasked) {
|
|
208
|
+
if (isOwn) {
|
|
209
|
+
value[symToStringTag$1] = tag;
|
|
210
|
+
} else {
|
|
211
|
+
delete value[symToStringTag$1];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
var _getRawTag = getRawTag$1;/** Used for built-in method references. */
|
|
218
|
+
|
|
219
|
+
var objectProto = Object.prototype;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Used to resolve the
|
|
223
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
224
|
+
* of values.
|
|
225
|
+
*/
|
|
226
|
+
var nativeObjectToString = objectProto.toString;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
230
|
+
*
|
|
231
|
+
* @private
|
|
232
|
+
* @param {*} value The value to convert.
|
|
233
|
+
* @returns {string} Returns the converted string.
|
|
234
|
+
*/
|
|
235
|
+
function objectToString$1(value) {
|
|
236
|
+
return nativeObjectToString.call(value);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
var _objectToString = objectToString$1;var Symbol = _Symbol,
|
|
240
|
+
getRawTag = _getRawTag,
|
|
241
|
+
objectToString = _objectToString;
|
|
242
|
+
|
|
243
|
+
/** `Object#toString` result references. */
|
|
244
|
+
var nullTag = '[object Null]',
|
|
245
|
+
undefinedTag = '[object Undefined]';
|
|
246
|
+
|
|
247
|
+
/** Built-in value references. */
|
|
248
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
252
|
+
*
|
|
253
|
+
* @private
|
|
254
|
+
* @param {*} value The value to query.
|
|
255
|
+
* @returns {string} Returns the `toStringTag`.
|
|
256
|
+
*/
|
|
257
|
+
function baseGetTag$1(value) {
|
|
258
|
+
if (value == null) {
|
|
259
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
260
|
+
}
|
|
261
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
262
|
+
? getRawTag(value)
|
|
263
|
+
: objectToString(value);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
var _baseGetTag = baseGetTag$1;/**
|
|
267
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
268
|
+
* and has a `typeof` result of "object".
|
|
269
|
+
*
|
|
270
|
+
* @static
|
|
271
|
+
* @memberOf _
|
|
272
|
+
* @since 4.0.0
|
|
273
|
+
* @category Lang
|
|
274
|
+
* @param {*} value The value to check.
|
|
275
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
276
|
+
* @example
|
|
277
|
+
*
|
|
278
|
+
* _.isObjectLike({});
|
|
279
|
+
* // => true
|
|
280
|
+
*
|
|
281
|
+
* _.isObjectLike([1, 2, 3]);
|
|
282
|
+
* // => true
|
|
283
|
+
*
|
|
284
|
+
* _.isObjectLike(_.noop);
|
|
285
|
+
* // => false
|
|
286
|
+
*
|
|
287
|
+
* _.isObjectLike(null);
|
|
288
|
+
* // => false
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
function isObjectLike$1(value) {
|
|
292
|
+
return value != null && typeof value == 'object';
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
var isObjectLike_1 = isObjectLike$1;var baseGetTag = _baseGetTag,
|
|
296
|
+
isObjectLike = isObjectLike_1;
|
|
297
|
+
|
|
298
|
+
/** `Object#toString` result references. */
|
|
299
|
+
var symbolTag = '[object Symbol]';
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
303
|
+
*
|
|
304
|
+
* @static
|
|
305
|
+
* @memberOf _
|
|
306
|
+
* @since 4.0.0
|
|
307
|
+
* @category Lang
|
|
308
|
+
* @param {*} value The value to check.
|
|
309
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
310
|
+
* @example
|
|
311
|
+
*
|
|
312
|
+
* _.isSymbol(Symbol.iterator);
|
|
313
|
+
* // => true
|
|
314
|
+
*
|
|
315
|
+
* _.isSymbol('abc');
|
|
316
|
+
* // => false
|
|
317
|
+
*/
|
|
318
|
+
function isSymbol$1(value) {
|
|
319
|
+
return typeof value == 'symbol' ||
|
|
320
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
var isSymbol_1 = isSymbol$1;var baseTrim = _baseTrim,
|
|
324
|
+
isObject$2 = isObject_1,
|
|
325
|
+
isSymbol = isSymbol_1;
|
|
326
|
+
|
|
327
|
+
/** Used as references for various `Number` constants. */
|
|
328
|
+
var NAN = 0 / 0;
|
|
329
|
+
|
|
330
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
331
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
332
|
+
|
|
333
|
+
/** Used to detect binary string values. */
|
|
334
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
335
|
+
|
|
336
|
+
/** Used to detect octal string values. */
|
|
337
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
338
|
+
|
|
339
|
+
/** Built-in method references without a dependency on `root`. */
|
|
340
|
+
var freeParseInt = parseInt;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Converts `value` to a number.
|
|
344
|
+
*
|
|
345
|
+
* @static
|
|
346
|
+
* @memberOf _
|
|
347
|
+
* @since 4.0.0
|
|
348
|
+
* @category Lang
|
|
349
|
+
* @param {*} value The value to process.
|
|
350
|
+
* @returns {number} Returns the number.
|
|
351
|
+
* @example
|
|
352
|
+
*
|
|
353
|
+
* _.toNumber(3.2);
|
|
354
|
+
* // => 3.2
|
|
355
|
+
*
|
|
356
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
357
|
+
* // => 5e-324
|
|
358
|
+
*
|
|
359
|
+
* _.toNumber(Infinity);
|
|
360
|
+
* // => Infinity
|
|
361
|
+
*
|
|
362
|
+
* _.toNumber('3.2');
|
|
363
|
+
* // => 3.2
|
|
364
|
+
*/
|
|
365
|
+
function toNumber$1(value) {
|
|
366
|
+
if (typeof value == 'number') {
|
|
367
|
+
return value;
|
|
368
|
+
}
|
|
369
|
+
if (isSymbol(value)) {
|
|
370
|
+
return NAN;
|
|
371
|
+
}
|
|
372
|
+
if (isObject$2(value)) {
|
|
373
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
374
|
+
value = isObject$2(other) ? (other + '') : other;
|
|
375
|
+
}
|
|
376
|
+
if (typeof value != 'string') {
|
|
377
|
+
return value === 0 ? value : +value;
|
|
378
|
+
}
|
|
379
|
+
value = baseTrim(value);
|
|
380
|
+
var isBinary = reIsBinary.test(value);
|
|
381
|
+
return (isBinary || reIsOctal.test(value))
|
|
382
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
383
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
var toNumber_1 = toNumber$1;var isObject$1 = isObject_1,
|
|
387
|
+
now = now_1,
|
|
388
|
+
toNumber = toNumber_1;
|
|
389
|
+
|
|
390
|
+
/** Error message constants. */
|
|
391
|
+
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
|
392
|
+
|
|
393
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
394
|
+
var nativeMax = Math.max,
|
|
395
|
+
nativeMin = Math.min;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
399
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
400
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
401
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
402
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
403
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
404
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
405
|
+
* calls to the debounced function return the result of the last `func`
|
|
406
|
+
* invocation.
|
|
407
|
+
*
|
|
408
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
409
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
410
|
+
* is invoked more than once during the `wait` timeout.
|
|
411
|
+
*
|
|
412
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
413
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
414
|
+
*
|
|
415
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
416
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
417
|
+
*
|
|
418
|
+
* @static
|
|
419
|
+
* @memberOf _
|
|
420
|
+
* @since 0.1.0
|
|
421
|
+
* @category Function
|
|
422
|
+
* @param {Function} func The function to debounce.
|
|
423
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
424
|
+
* @param {Object} [options={}] The options object.
|
|
425
|
+
* @param {boolean} [options.leading=false]
|
|
426
|
+
* Specify invoking on the leading edge of the timeout.
|
|
427
|
+
* @param {number} [options.maxWait]
|
|
428
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
429
|
+
* @param {boolean} [options.trailing=true]
|
|
430
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
431
|
+
* @returns {Function} Returns the new debounced function.
|
|
432
|
+
* @example
|
|
433
|
+
*
|
|
434
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
435
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
436
|
+
*
|
|
437
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
438
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
439
|
+
* 'leading': true,
|
|
440
|
+
* 'trailing': false
|
|
441
|
+
* }));
|
|
442
|
+
*
|
|
443
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
444
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
445
|
+
* var source = new EventSource('/stream');
|
|
446
|
+
* jQuery(source).on('message', debounced);
|
|
447
|
+
*
|
|
448
|
+
* // Cancel the trailing debounced invocation.
|
|
449
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
450
|
+
*/
|
|
451
|
+
function debounce$1(func, wait, options) {
|
|
452
|
+
var lastArgs,
|
|
453
|
+
lastThis,
|
|
454
|
+
maxWait,
|
|
455
|
+
result,
|
|
456
|
+
timerId,
|
|
457
|
+
lastCallTime,
|
|
458
|
+
lastInvokeTime = 0,
|
|
459
|
+
leading = false,
|
|
460
|
+
maxing = false,
|
|
461
|
+
trailing = true;
|
|
462
|
+
|
|
463
|
+
if (typeof func != 'function') {
|
|
464
|
+
throw new TypeError(FUNC_ERROR_TEXT$1);
|
|
465
|
+
}
|
|
466
|
+
wait = toNumber(wait) || 0;
|
|
467
|
+
if (isObject$1(options)) {
|
|
468
|
+
leading = !!options.leading;
|
|
469
|
+
maxing = 'maxWait' in options;
|
|
470
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
471
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function invokeFunc(time) {
|
|
475
|
+
var args = lastArgs,
|
|
476
|
+
thisArg = lastThis;
|
|
477
|
+
|
|
478
|
+
lastArgs = lastThis = undefined;
|
|
479
|
+
lastInvokeTime = time;
|
|
480
|
+
result = func.apply(thisArg, args);
|
|
481
|
+
return result;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function leadingEdge(time) {
|
|
485
|
+
// Reset any `maxWait` timer.
|
|
486
|
+
lastInvokeTime = time;
|
|
487
|
+
// Start the timer for the trailing edge.
|
|
488
|
+
timerId = setTimeout(timerExpired, wait);
|
|
489
|
+
// Invoke the leading edge.
|
|
490
|
+
return leading ? invokeFunc(time) : result;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function remainingWait(time) {
|
|
494
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
495
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
496
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
497
|
+
|
|
498
|
+
return maxing
|
|
499
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
500
|
+
: timeWaiting;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function shouldInvoke(time) {
|
|
504
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
505
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
506
|
+
|
|
507
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
508
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
509
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
510
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
511
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function timerExpired() {
|
|
515
|
+
var time = now();
|
|
516
|
+
if (shouldInvoke(time)) {
|
|
517
|
+
return trailingEdge(time);
|
|
518
|
+
}
|
|
519
|
+
// Restart the timer.
|
|
520
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function trailingEdge(time) {
|
|
524
|
+
timerId = undefined;
|
|
525
|
+
|
|
526
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
527
|
+
// debounced at least once.
|
|
528
|
+
if (trailing && lastArgs) {
|
|
529
|
+
return invokeFunc(time);
|
|
530
|
+
}
|
|
531
|
+
lastArgs = lastThis = undefined;
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
function cancel() {
|
|
536
|
+
if (timerId !== undefined) {
|
|
537
|
+
clearTimeout(timerId);
|
|
538
|
+
}
|
|
539
|
+
lastInvokeTime = 0;
|
|
540
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function flush() {
|
|
544
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function debounced() {
|
|
548
|
+
var time = now(),
|
|
549
|
+
isInvoking = shouldInvoke(time);
|
|
550
|
+
|
|
551
|
+
lastArgs = arguments;
|
|
552
|
+
lastThis = this;
|
|
553
|
+
lastCallTime = time;
|
|
554
|
+
|
|
555
|
+
if (isInvoking) {
|
|
556
|
+
if (timerId === undefined) {
|
|
557
|
+
return leadingEdge(lastCallTime);
|
|
558
|
+
}
|
|
559
|
+
if (maxing) {
|
|
560
|
+
// Handle invocations in a tight loop.
|
|
561
|
+
clearTimeout(timerId);
|
|
562
|
+
timerId = setTimeout(timerExpired, wait);
|
|
563
|
+
return invokeFunc(lastCallTime);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (timerId === undefined) {
|
|
567
|
+
timerId = setTimeout(timerExpired, wait);
|
|
568
|
+
}
|
|
569
|
+
return result;
|
|
570
|
+
}
|
|
571
|
+
debounced.cancel = cancel;
|
|
572
|
+
debounced.flush = flush;
|
|
573
|
+
return debounced;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
var debounce_1 = debounce$1;var debounce = debounce_1,
|
|
577
|
+
isObject = isObject_1;
|
|
578
|
+
|
|
579
|
+
/** Error message constants. */
|
|
580
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
584
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
585
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
586
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
587
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
588
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
589
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
590
|
+
* result of the last `func` invocation.
|
|
591
|
+
*
|
|
592
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
593
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
594
|
+
* is invoked more than once during the `wait` timeout.
|
|
595
|
+
*
|
|
596
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
597
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
598
|
+
*
|
|
599
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
600
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
601
|
+
*
|
|
602
|
+
* @static
|
|
603
|
+
* @memberOf _
|
|
604
|
+
* @since 0.1.0
|
|
605
|
+
* @category Function
|
|
606
|
+
* @param {Function} func The function to throttle.
|
|
607
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
608
|
+
* @param {Object} [options={}] The options object.
|
|
609
|
+
* @param {boolean} [options.leading=true]
|
|
610
|
+
* Specify invoking on the leading edge of the timeout.
|
|
611
|
+
* @param {boolean} [options.trailing=true]
|
|
612
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
613
|
+
* @returns {Function} Returns the new throttled function.
|
|
614
|
+
* @example
|
|
615
|
+
*
|
|
616
|
+
* // Avoid excessively updating the position while scrolling.
|
|
617
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
618
|
+
*
|
|
619
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
620
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
621
|
+
* jQuery(element).on('click', throttled);
|
|
622
|
+
*
|
|
623
|
+
* // Cancel the trailing throttled invocation.
|
|
624
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
625
|
+
*/
|
|
626
|
+
function throttle(func, wait, options) {
|
|
627
|
+
var leading = true,
|
|
628
|
+
trailing = true;
|
|
629
|
+
|
|
630
|
+
if (typeof func != 'function') {
|
|
631
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
632
|
+
}
|
|
633
|
+
if (isObject(options)) {
|
|
634
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
635
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
636
|
+
}
|
|
637
|
+
return debounce(func, wait, {
|
|
638
|
+
'leading': leading,
|
|
639
|
+
'maxWait': wait,
|
|
640
|
+
'trailing': trailing
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
var throttle_1 = throttle;var patchResizeHandler = function (resizeCallback, refreshMode, refreshRate, refreshOptions) {
|
|
645
|
+
switch (refreshMode) {
|
|
646
|
+
case 'debounce':
|
|
647
|
+
return debounce_1(resizeCallback, refreshRate, refreshOptions);
|
|
648
|
+
case 'throttle':
|
|
649
|
+
return throttle_1(resizeCallback, refreshRate, refreshOptions);
|
|
650
|
+
default:
|
|
651
|
+
return resizeCallback;
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
var isFunction = function (fn) { return typeof fn === 'function'; };
|
|
655
|
+
var isSSR = function () { return typeof window === 'undefined'; };
|
|
656
|
+
var isDOMElement = function (element) { return element instanceof Element || element instanceof HTMLDocument; };
|
|
657
|
+
var createNotifier = function (onResize, setSize, handleWidth, handleHeight) {
|
|
658
|
+
return function (_a) {
|
|
659
|
+
var width = _a.width, height = _a.height;
|
|
660
|
+
setSize(function (prev) {
|
|
661
|
+
if (prev.width === width && prev.height === height) {
|
|
662
|
+
// skip if dimensions haven't changed
|
|
663
|
+
return prev;
|
|
664
|
+
}
|
|
665
|
+
if ((prev.width === width && !handleHeight) || (prev.height === height && !handleWidth)) {
|
|
666
|
+
// process `handleHeight/handleWidth` props
|
|
667
|
+
return prev;
|
|
668
|
+
}
|
|
669
|
+
if (onResize && isFunction(onResize)) {
|
|
670
|
+
onResize(width, height);
|
|
671
|
+
}
|
|
672
|
+
return { width: width, height: height };
|
|
673
|
+
});
|
|
674
|
+
};
|
|
675
|
+
};var ResizeDetector = /** @class */ (function (_super) {
|
|
676
|
+
__extends(ResizeDetector, _super);
|
|
677
|
+
function ResizeDetector(props) {
|
|
678
|
+
var _this = _super.call(this, props) || this;
|
|
679
|
+
_this.cancelHandler = function () {
|
|
680
|
+
if (_this.resizeHandler && _this.resizeHandler.cancel) {
|
|
681
|
+
// cancel debounced handler
|
|
682
|
+
_this.resizeHandler.cancel();
|
|
683
|
+
_this.resizeHandler = null;
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
_this.attachObserver = function () {
|
|
687
|
+
var _a = _this.props, targetRef = _a.targetRef, observerOptions = _a.observerOptions;
|
|
688
|
+
if (isSSR()) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (targetRef && targetRef.current) {
|
|
692
|
+
_this.targetRef.current = targetRef.current;
|
|
693
|
+
}
|
|
694
|
+
var element = _this.getElement();
|
|
695
|
+
if (!element) {
|
|
696
|
+
// can't find element to observe
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (_this.observableElement && _this.observableElement === element) {
|
|
700
|
+
// element is already observed
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
_this.observableElement = element;
|
|
704
|
+
_this.resizeObserver.observe(element, observerOptions);
|
|
705
|
+
};
|
|
706
|
+
_this.getElement = function () {
|
|
707
|
+
var _a = _this.props, querySelector = _a.querySelector, targetDomEl = _a.targetDomEl;
|
|
708
|
+
if (isSSR())
|
|
709
|
+
return null;
|
|
710
|
+
// in case we pass a querySelector
|
|
711
|
+
if (querySelector)
|
|
712
|
+
return document.querySelector(querySelector);
|
|
713
|
+
// in case we pass a DOM element
|
|
714
|
+
if (targetDomEl && isDOMElement(targetDomEl))
|
|
715
|
+
return targetDomEl;
|
|
716
|
+
// in case we pass a React ref using React.createRef()
|
|
717
|
+
if (_this.targetRef && isDOMElement(_this.targetRef.current))
|
|
718
|
+
return _this.targetRef.current;
|
|
719
|
+
// the worse case when we don't receive any information from the parent and the library doesn't add any wrappers
|
|
720
|
+
// we have to use a deprecated `findDOMNode` method in order to find a DOM element to attach to
|
|
721
|
+
var currentElement = (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.findDOMNode)(_this);
|
|
722
|
+
if (!currentElement)
|
|
723
|
+
return null;
|
|
724
|
+
var renderType = _this.getRenderType();
|
|
725
|
+
switch (renderType) {
|
|
726
|
+
case 'renderProp':
|
|
727
|
+
return currentElement;
|
|
728
|
+
case 'childFunction':
|
|
729
|
+
return currentElement;
|
|
730
|
+
case 'child':
|
|
731
|
+
return currentElement;
|
|
732
|
+
case 'childArray':
|
|
733
|
+
return currentElement;
|
|
734
|
+
default:
|
|
735
|
+
return currentElement.parentElement;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
_this.createResizeHandler = function (entries) {
|
|
739
|
+
var _a = _this.props, _b = _a.handleWidth, handleWidth = _b === void 0 ? true : _b, _c = _a.handleHeight, handleHeight = _c === void 0 ? true : _c, onResize = _a.onResize;
|
|
740
|
+
if (!handleWidth && !handleHeight)
|
|
741
|
+
return;
|
|
742
|
+
var notifyResize = createNotifier(onResize, _this.setState.bind(_this), handleWidth, handleHeight);
|
|
743
|
+
entries.forEach(function (entry) {
|
|
744
|
+
var _a = (entry && entry.contentRect) || {}, width = _a.width, height = _a.height;
|
|
745
|
+
var shouldSetSize = !_this.skipOnMount && !isSSR();
|
|
746
|
+
if (shouldSetSize) {
|
|
747
|
+
notifyResize({ width: width, height: height });
|
|
748
|
+
}
|
|
749
|
+
_this.skipOnMount = false;
|
|
750
|
+
});
|
|
751
|
+
};
|
|
752
|
+
_this.getRenderType = function () {
|
|
753
|
+
var _a = _this.props, render = _a.render, children = _a.children;
|
|
754
|
+
if (isFunction(render)) {
|
|
755
|
+
// DEPRECATED. Use `Child Function Pattern` instead
|
|
756
|
+
return 'renderProp';
|
|
757
|
+
}
|
|
758
|
+
if (isFunction(children)) {
|
|
759
|
+
return 'childFunction';
|
|
760
|
+
}
|
|
761
|
+
if ((0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(children)) {
|
|
762
|
+
return 'child';
|
|
763
|
+
}
|
|
764
|
+
if (Array.isArray(children)) {
|
|
765
|
+
// DEPRECATED. Wrap children with a single parent
|
|
766
|
+
return 'childArray';
|
|
767
|
+
}
|
|
768
|
+
// DEPRECATED. Use `Child Function Pattern` instead
|
|
769
|
+
return 'parent';
|
|
770
|
+
};
|
|
771
|
+
var skipOnMount = props.skipOnMount, refreshMode = props.refreshMode, _a = props.refreshRate, refreshRate = _a === void 0 ? 1000 : _a, refreshOptions = props.refreshOptions;
|
|
772
|
+
_this.state = {
|
|
773
|
+
width: undefined,
|
|
774
|
+
height: undefined
|
|
775
|
+
};
|
|
776
|
+
_this.skipOnMount = skipOnMount;
|
|
777
|
+
_this.targetRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();
|
|
778
|
+
_this.observableElement = null;
|
|
779
|
+
if (isSSR()) {
|
|
780
|
+
return _this;
|
|
781
|
+
}
|
|
782
|
+
_this.resizeHandler = patchResizeHandler(_this.createResizeHandler, refreshMode, refreshRate, refreshOptions);
|
|
783
|
+
_this.resizeObserver = new window.ResizeObserver(_this.resizeHandler);
|
|
784
|
+
return _this;
|
|
785
|
+
}
|
|
786
|
+
ResizeDetector.prototype.componentDidMount = function () {
|
|
787
|
+
this.attachObserver();
|
|
788
|
+
};
|
|
789
|
+
ResizeDetector.prototype.componentDidUpdate = function () {
|
|
790
|
+
this.attachObserver();
|
|
791
|
+
};
|
|
792
|
+
ResizeDetector.prototype.componentWillUnmount = function () {
|
|
793
|
+
if (isSSR()) {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
this.resizeObserver.disconnect();
|
|
797
|
+
this.cancelHandler();
|
|
798
|
+
};
|
|
799
|
+
ResizeDetector.prototype.render = function () {
|
|
800
|
+
var _a = this.props, render = _a.render, children = _a.children, _b = _a.nodeType, WrapperTag = _b === void 0 ? 'div' : _b;
|
|
801
|
+
var _c = this.state, width = _c.width, height = _c.height;
|
|
802
|
+
var childProps = { width: width, height: height, targetRef: this.targetRef };
|
|
803
|
+
var renderType = this.getRenderType();
|
|
804
|
+
var typedChildren;
|
|
805
|
+
switch (renderType) {
|
|
806
|
+
case 'renderProp':
|
|
807
|
+
return render && render(childProps);
|
|
808
|
+
case 'childFunction':
|
|
809
|
+
typedChildren = children;
|
|
810
|
+
return typedChildren(childProps);
|
|
811
|
+
case 'child':
|
|
812
|
+
// @TODO bug prone logic
|
|
813
|
+
typedChildren = children;
|
|
814
|
+
if (typedChildren.type && typeof typedChildren.type === 'string') {
|
|
815
|
+
// child is a native DOM elements such as div, span etc
|
|
816
|
+
childProps.targetRef; var nativeProps = __rest(childProps, ["targetRef"]);
|
|
817
|
+
return (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(typedChildren, nativeProps);
|
|
818
|
+
}
|
|
819
|
+
// class or functional component otherwise
|
|
820
|
+
return (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(typedChildren, childProps);
|
|
821
|
+
case 'childArray':
|
|
822
|
+
typedChildren = children;
|
|
823
|
+
return typedChildren.map(function (el) { return !!el && (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(el, childProps); });
|
|
824
|
+
default:
|
|
825
|
+
return react__WEBPACK_IMPORTED_MODULE_0__.createElement(WrapperTag, null);
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
return ResizeDetector;
|
|
829
|
+
}(react__WEBPACK_IMPORTED_MODULE_0__.PureComponent));function withResizeDetector(ComponentInner, options) {
|
|
830
|
+
if (options === void 0) { options = {}; }
|
|
831
|
+
var ResizeDetectorHOC = /** @class */ (function (_super) {
|
|
832
|
+
__extends(ResizeDetectorHOC, _super);
|
|
833
|
+
function ResizeDetectorHOC() {
|
|
834
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
835
|
+
_this.ref = createRef();
|
|
836
|
+
return _this;
|
|
837
|
+
}
|
|
838
|
+
ResizeDetectorHOC.prototype.render = function () {
|
|
839
|
+
var _a = this.props, forwardedRef = _a.forwardedRef, rest = __rest(_a, ["forwardedRef"]);
|
|
840
|
+
var targetRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : this.ref;
|
|
841
|
+
return (React.createElement(ResizeDetector, __assign({}, options, { targetRef: targetRef }),
|
|
842
|
+
React.createElement(ComponentInner, __assign({ targetRef: targetRef }, rest))));
|
|
843
|
+
};
|
|
844
|
+
return ResizeDetectorHOC;
|
|
845
|
+
}(Component));
|
|
846
|
+
function forwardRefWrapper(props, ref) {
|
|
847
|
+
return React.createElement(ResizeDetectorHOC, __assign({}, props, { forwardedRef: ref }));
|
|
848
|
+
}
|
|
849
|
+
var name = ComponentInner.displayName || ComponentInner.name;
|
|
850
|
+
forwardRefWrapper.displayName = "withResizeDetector(".concat(name, ")");
|
|
851
|
+
return forwardRef(forwardRefWrapper);
|
|
852
|
+
}var useEnhancedEffect = isSSR() ? react__WEBPACK_IMPORTED_MODULE_0__.useEffect : react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect;
|
|
853
|
+
function useResizeDetector(props) {
|
|
854
|
+
if (props === void 0) { props = {}; }
|
|
855
|
+
var _a = props.skipOnMount, skipOnMount = _a === void 0 ? false : _a, refreshMode = props.refreshMode, _b = props.refreshRate, refreshRate = _b === void 0 ? 1000 : _b, refreshOptions = props.refreshOptions, _c = props.handleWidth, handleWidth = _c === void 0 ? true : _c, _d = props.handleHeight, handleHeight = _d === void 0 ? true : _d, targetRef = props.targetRef, observerOptions = props.observerOptions, onResize = props.onResize;
|
|
856
|
+
var skipResize = useRef(skipOnMount);
|
|
857
|
+
var localRef = useRef(null);
|
|
858
|
+
var ref = (targetRef !== null && targetRef !== void 0 ? targetRef : localRef);
|
|
859
|
+
var resizeHandler = useRef();
|
|
860
|
+
var _e = useState({
|
|
861
|
+
width: undefined,
|
|
862
|
+
height: undefined
|
|
863
|
+
}), size = _e[0], setSize = _e[1];
|
|
864
|
+
useEnhancedEffect(function () {
|
|
865
|
+
if (isSSR()) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
var notifyResize = createNotifier(onResize, setSize, handleWidth, handleHeight);
|
|
869
|
+
var resizeCallback = function (entries) {
|
|
870
|
+
if (!handleWidth && !handleHeight)
|
|
871
|
+
return;
|
|
872
|
+
entries.forEach(function (entry) {
|
|
873
|
+
var _a = (entry && entry.contentRect) || {}, width = _a.width, height = _a.height;
|
|
874
|
+
var shouldSetSize = !skipResize.current && !isSSR();
|
|
875
|
+
if (shouldSetSize) {
|
|
876
|
+
notifyResize({ width: width, height: height });
|
|
877
|
+
}
|
|
878
|
+
skipResize.current = false;
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
resizeHandler.current = patchResizeHandler(resizeCallback, refreshMode, refreshRate, refreshOptions);
|
|
882
|
+
var resizeObserver = new window.ResizeObserver(resizeHandler.current);
|
|
883
|
+
if (ref.current) {
|
|
884
|
+
// Something wrong with typings here...
|
|
885
|
+
resizeObserver.observe(ref.current, observerOptions);
|
|
886
|
+
}
|
|
887
|
+
return function () {
|
|
888
|
+
resizeObserver.disconnect();
|
|
889
|
+
var patchedResizeHandler = resizeHandler.current;
|
|
890
|
+
if (patchedResizeHandler && patchedResizeHandler.cancel) {
|
|
891
|
+
patchedResizeHandler.cancel();
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
}, [refreshMode, refreshRate, refreshOptions, handleWidth, handleHeight, onResize, observerOptions, ref.current]);
|
|
895
|
+
return __assign({ ref: ref }, size);
|
|
896
|
+
}//# sourceMappingURL=index.esm.js.map
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
/***/ })
|
|
900
|
+
|
|
901
|
+
}]);
|