@splunk/visualizations-shared 26.4.1 → 27.1.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/.loki/reference/chrome_docker_SizeAwareWrapper_50_parent.png +0 -0
- package/.loki/reference/chrome_docker_SizeAwareWrapper_Fix_size_container.png +0 -0
- package/.loki/reference/chrome_docker_SizeAwareWrapper_Flex_layout_container.png +0 -0
- package/.loki/reference/chrome_docker_SizeAwareWrapper_Flex_layout_container_with_extra_wrapper.png +0 -0
- package/Downloader.js +164 -403
- package/Downloader.js.map +7 -1
- package/FileDownloader.js +121 -557
- package/FileDownloader.js.map +7 -1
- package/JSONSchemaUtils.js +58 -134
- package/JSONSchemaUtils.js.map +7 -1
- package/Message.js +105 -270
- package/Message.js.map +7 -1
- package/RemoteIcon.js +272 -736
- package/RemoteIcon.js.map +7 -1
- package/RemoteImage.js +190 -458
- package/RemoteImage.js.map +7 -1
- package/SanitizeProps.js +117 -238
- package/SanitizeProps.js.map +7 -1
- package/SizeAwareWrapper.js +108 -306
- package/SizeAwareWrapper.js.map +7 -1
- package/SizeAwareWrapperDeprecated.js +117 -326
- package/SizeAwareWrapperDeprecated.js.map +7 -1
- package/VisualizationDocPage.js +212 -461
- package/VisualizationDocPage.js.map +7 -1
- package/colorConstants.js +81 -132
- package/colorConstants.js.map +7 -1
- package/colorUtils.js +47 -134
- package/colorUtils.js.map +7 -1
- package/configUtils.js +28 -112
- package/configUtils.js.map +7 -1
- package/console.js +45 -183
- package/console.js.map +7 -1
- package/dataSourceUtils.js +45 -140
- package/dataSourceUtils.js.map +7 -1
- package/domUtils.js +58 -122
- package/domUtils.js.map +7 -1
- package/hocUtils.js +45 -122
- package/hocUtils.js.map +7 -1
- package/i18n.js +168 -323
- package/i18n.js.map +7 -1
- package/iconUtils.js +47 -178
- package/iconUtils.js.map +7 -1
- package/mapUtils.js +45 -122
- package/mapUtils.js.map +7 -1
- package/numberUtils.js +101 -275
- package/numberUtils.js.map +7 -1
- package/package.json +18 -22
- package/previewVizMessage.js +28 -108
- package/previewVizMessage.js.map +7 -1
- package/propUtils.js +88 -212
- package/propUtils.js.map +7 -1
- package/schemaUtils.js +58 -185
- package/schemaUtils.js.map +7 -1
- package/simpleXMLOptions.js +142 -225
- package/simpleXMLOptions.js.map +7 -1
- package/style.js +65 -168
- package/style.js.map +7 -1
- package/testHelper.js +247 -303
- package/testHelper.js.map +7 -1
- package/themeUtils.js +63 -142
- package/themeUtils.js.map +7 -1
- package/trellisUtils.js +108 -276
- package/trellisUtils.js.map +7 -1
package/SizeAwareWrapper.js
CHANGED
|
@@ -1,330 +1,132 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/******/ i: moduleId,
|
|
21
|
-
/******/ l: false,
|
|
22
|
-
/******/ exports: {}
|
|
23
|
-
/******/ };
|
|
24
|
-
/******/
|
|
25
|
-
/******/ // Execute the module function
|
|
26
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
27
|
-
/******/
|
|
28
|
-
/******/ // Flag the module as loaded
|
|
29
|
-
/******/ module.l = true;
|
|
30
|
-
/******/
|
|
31
|
-
/******/ // Return the exports of the module
|
|
32
|
-
/******/ return module.exports;
|
|
33
|
-
/******/ }
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
37
|
-
/******/ __webpack_require__.m = modules;
|
|
38
|
-
/******/
|
|
39
|
-
/******/ // expose the module cache
|
|
40
|
-
/******/ __webpack_require__.c = installedModules;
|
|
41
|
-
/******/
|
|
42
|
-
/******/ // define getter function for harmony exports
|
|
43
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
44
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
45
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
46
|
-
/******/ }
|
|
47
|
-
/******/ };
|
|
48
|
-
/******/
|
|
49
|
-
/******/ // define __esModule on exports
|
|
50
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
51
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
52
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
53
|
-
/******/ }
|
|
54
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
-
/******/ };
|
|
56
|
-
/******/
|
|
57
|
-
/******/ // create a fake namespace object
|
|
58
|
-
/******/ // mode & 1: value is a module id, require it
|
|
59
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
-
/******/ // mode & 4: return value when already ns object
|
|
61
|
-
/******/ // mode & 8|1: behave like require
|
|
62
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
-
/******/ if(mode & 8) return value;
|
|
65
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
-
/******/ var ns = Object.create(null);
|
|
67
|
-
/******/ __webpack_require__.r(ns);
|
|
68
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
-
/******/ return ns;
|
|
71
|
-
/******/ };
|
|
72
|
-
/******/
|
|
73
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
-
/******/ __webpack_require__.n = function(module) {
|
|
75
|
-
/******/ var getter = module && module.__esModule ?
|
|
76
|
-
/******/ function getDefault() { return module['default']; } :
|
|
77
|
-
/******/ function getModuleExports() { return module; };
|
|
78
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
-
/******/ return getter;
|
|
80
|
-
/******/ };
|
|
81
|
-
/******/
|
|
82
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
-
/******/
|
|
85
|
-
/******/ // __webpack_public_path__
|
|
86
|
-
/******/ __webpack_require__.p = "";
|
|
87
|
-
/******/
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s = 47);
|
|
91
|
-
/******/ })
|
|
92
|
-
/************************************************************************/
|
|
93
|
-
/******/ ({
|
|
94
|
-
|
|
95
|
-
/***/ 0:
|
|
96
|
-
/***/ (function(module, exports) {
|
|
97
|
-
|
|
98
|
-
module.exports = require("prop-types");
|
|
99
|
-
|
|
100
|
-
/***/ }),
|
|
101
|
-
|
|
102
|
-
/***/ 1:
|
|
103
|
-
/***/ (function(module, exports) {
|
|
104
|
-
|
|
105
|
-
module.exports = require("react");
|
|
106
|
-
|
|
107
|
-
/***/ }),
|
|
108
|
-
|
|
109
|
-
/***/ 11:
|
|
110
|
-
/***/ (function(module, exports) {
|
|
111
|
-
|
|
112
|
-
module.exports = require("@babel/runtime/helpers/assertThisInitialized");
|
|
113
|
-
|
|
114
|
-
/***/ }),
|
|
115
|
-
|
|
116
|
-
/***/ 2:
|
|
117
|
-
/***/ (function(module, exports) {
|
|
118
|
-
|
|
119
|
-
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
120
|
-
|
|
121
|
-
/***/ }),
|
|
122
|
-
|
|
123
|
-
/***/ 3:
|
|
124
|
-
/***/ (function(module, exports) {
|
|
125
|
-
|
|
126
|
-
module.exports = require("@babel/runtime/helpers/getPrototypeOf");
|
|
127
|
-
|
|
128
|
-
/***/ }),
|
|
129
|
-
|
|
130
|
-
/***/ 47:
|
|
131
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
132
|
-
|
|
133
|
-
"use strict";
|
|
134
|
-
__webpack_require__.r(__webpack_exports__);
|
|
135
|
-
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
136
|
-
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
|
|
137
|
-
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
|
138
|
-
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
|
|
139
|
-
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11);
|
|
140
|
-
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
|
|
141
|
-
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
|
|
142
|
-
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
|
|
143
|
-
/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
|
|
144
|
-
/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
|
|
145
|
-
/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3);
|
|
146
|
-
/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
|
|
147
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
|
|
148
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6__);
|
|
149
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
|
|
150
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__);
|
|
151
|
-
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(0);
|
|
152
|
-
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_8__);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
function _createSuper(Derived) {
|
|
162
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
163
|
-
|
|
164
|
-
return function _createSuperInternal() {
|
|
165
|
-
var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(Derived),
|
|
166
|
-
result;
|
|
167
|
-
|
|
168
|
-
if (hasNativeReflectConstruct) {
|
|
169
|
-
var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(this).constructor;
|
|
170
|
-
|
|
171
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
172
|
-
} else {
|
|
173
|
-
result = Super.apply(this, arguments);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, result);
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function _isNativeReflectConstruct() {
|
|
181
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
182
|
-
if (Reflect.construct.sham) return false;
|
|
183
|
-
if (typeof Proxy === "function") return true;
|
|
184
|
-
|
|
185
|
-
try {
|
|
186
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
187
|
-
return true;
|
|
188
|
-
} catch (e) {
|
|
189
|
-
return false;
|
|
1
|
+
/* Copyright © 2020 Splunk Inc.
|
|
2
|
+
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
3
|
+
in part without a valid written license from Splunk Inc. is PROHIBITED. */
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
190
20
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
+
|
|
35
|
+
// src/SizeAwareWrapper.jsx
|
|
36
|
+
var SizeAwareWrapper_exports = {};
|
|
37
|
+
__export(SizeAwareWrapper_exports, {
|
|
38
|
+
default: () => SizeAwareWrapper_default
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(SizeAwareWrapper_exports);
|
|
41
|
+
|
|
42
|
+
// esm-externals:react
|
|
43
|
+
var react_exports = {};
|
|
44
|
+
__export(react_exports, {
|
|
45
|
+
default: () => react_default
|
|
46
|
+
});
|
|
47
|
+
var defaultImport = __toESM(require("react"));
|
|
48
|
+
__reExport(react_exports, require("react"));
|
|
49
|
+
var react_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
50
|
+
|
|
51
|
+
// esm-externals:prop-types
|
|
52
|
+
var prop_types_exports = {};
|
|
53
|
+
__export(prop_types_exports, {
|
|
54
|
+
default: () => prop_types_default
|
|
55
|
+
});
|
|
56
|
+
var defaultImport2 = __toESM(require("prop-types"));
|
|
57
|
+
__reExport(prop_types_exports, require("prop-types"));
|
|
58
|
+
var prop_types_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
59
|
+
|
|
60
|
+
// src/SizeAwareWrapper.jsx
|
|
195
61
|
var styles = {
|
|
196
|
-
position:
|
|
62
|
+
position: "absolute",
|
|
197
63
|
width: 0,
|
|
198
64
|
height: 0,
|
|
199
|
-
visibility:
|
|
200
|
-
display:
|
|
65
|
+
visibility: "hidden",
|
|
66
|
+
display: "none"
|
|
201
67
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
function SizeAwareWrapper() {
|
|
209
|
-
var _this;
|
|
210
|
-
|
|
211
|
-
_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SizeAwareWrapper);
|
|
212
|
-
|
|
213
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
214
|
-
args[_key] = arguments[_key];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
218
|
-
|
|
219
|
-
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "getElement", function () {
|
|
220
|
-
var parentElement = _this.el && _this.el.parentElement;
|
|
68
|
+
var SizeAwareWrapper = class extends react_exports.PureComponent {
|
|
69
|
+
constructor() {
|
|
70
|
+
super(...arguments);
|
|
71
|
+
__publicField(this, "getElement", () => {
|
|
72
|
+
const parentElement = this.el && this.el.parentElement;
|
|
221
73
|
return parentElement;
|
|
222
74
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
width = _entry$contentRect.width,
|
|
228
|
-
height = _entry$contentRect.height;
|
|
229
|
-
|
|
230
|
-
_this.props.onResize(width, height);
|
|
75
|
+
__publicField(this, "handleResize", (entries) => {
|
|
76
|
+
entries.forEach((entry) => {
|
|
77
|
+
const { width, height } = entry.contentRect;
|
|
78
|
+
this.props.onResize(width, height);
|
|
231
79
|
});
|
|
232
80
|
});
|
|
233
|
-
|
|
234
|
-
return _this;
|
|
235
81
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (resizableElement) {
|
|
243
|
-
this.ro = this.getResizeObserver();
|
|
244
|
-
this.ro.observe(resizableElement);
|
|
245
|
-
}
|
|
82
|
+
componentDidMount() {
|
|
83
|
+
const resizableElement = this.getElement();
|
|
84
|
+
if (resizableElement) {
|
|
85
|
+
this.ro = this.getResizeObserver();
|
|
86
|
+
this.ro.observe(resizableElement);
|
|
246
87
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (resizableElement && this.ro) {
|
|
253
|
-
this.ro.unobserve(resizableElement);
|
|
254
|
-
}
|
|
88
|
+
}
|
|
89
|
+
componentWillUnmount() {
|
|
90
|
+
const resizableElement = this.getElement();
|
|
91
|
+
if (resizableElement && this.ro) {
|
|
92
|
+
this.ro.unobserve(resizableElement);
|
|
255
93
|
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return new ResizeObserver(this.handleResize);
|
|
94
|
+
}
|
|
95
|
+
getResizeObserver() {
|
|
96
|
+
if (typeof ResizeObserver !== "function") {
|
|
97
|
+
return {
|
|
98
|
+
observe() {
|
|
99
|
+
},
|
|
100
|
+
unobserve() {
|
|
101
|
+
}
|
|
102
|
+
};
|
|
267
103
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
104
|
+
return new ResizeObserver(this.handleResize);
|
|
105
|
+
}
|
|
106
|
+
render() {
|
|
107
|
+
return /* @__PURE__ */ react_default.createElement(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
274
110
|
key: "resize-detector",
|
|
275
111
|
style: styles,
|
|
276
|
-
ref:
|
|
277
|
-
|
|
112
|
+
ref: (el) => {
|
|
113
|
+
this.el = el;
|
|
278
114
|
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return SizeAwareWrapper;
|
|
284
|
-
}(react__WEBPACK_IMPORTED_MODULE_7__["PureComponent"]);
|
|
285
|
-
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
286
119
|
SizeAwareWrapper.propTypes = {
|
|
287
|
-
onResize:
|
|
120
|
+
onResize: prop_types_default.func
|
|
121
|
+
// This was to use width and height as props and then check to see if the values have changed inside the handleResize function
|
|
288
122
|
// Some components need a double render to 'settle' and are using this so no check is needed.
|
|
289
123
|
// However until that is fixed unit tests rely on these props so keeping as optional.
|
|
290
124
|
// width: T.arrayOf(T.number, T.string),
|
|
291
125
|
// height: T.arrayOf(T.number, T.string),
|
|
292
|
-
|
|
293
126
|
};
|
|
294
127
|
SizeAwareWrapper.defaultProps = {
|
|
295
|
-
onResize:
|
|
128
|
+
onResize: () => {
|
|
129
|
+
}
|
|
296
130
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
/***/ }),
|
|
300
|
-
|
|
301
|
-
/***/ 5:
|
|
302
|
-
/***/ (function(module, exports) {
|
|
303
|
-
|
|
304
|
-
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
305
|
-
|
|
306
|
-
/***/ }),
|
|
307
|
-
|
|
308
|
-
/***/ 6:
|
|
309
|
-
/***/ (function(module, exports) {
|
|
310
|
-
|
|
311
|
-
module.exports = require("@babel/runtime/helpers/createClass");
|
|
312
|
-
|
|
313
|
-
/***/ }),
|
|
314
|
-
|
|
315
|
-
/***/ 7:
|
|
316
|
-
/***/ (function(module, exports) {
|
|
317
|
-
|
|
318
|
-
module.exports = require("@babel/runtime/helpers/inherits");
|
|
319
|
-
|
|
320
|
-
/***/ }),
|
|
321
|
-
|
|
322
|
-
/***/ 8:
|
|
323
|
-
/***/ (function(module, exports) {
|
|
324
|
-
|
|
325
|
-
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
|
|
326
|
-
|
|
327
|
-
/***/ })
|
|
328
|
-
|
|
329
|
-
/******/ });
|
|
330
|
-
//# sourceMappingURL=SizeAwareWrapper.js.map
|
|
131
|
+
var SizeAwareWrapper_default = SizeAwareWrapper;
|
|
132
|
+
//# sourceMappingURL=SizeAwareWrapper.js.map
|
package/SizeAwareWrapper.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["src/SizeAwareWrapper.jsx", "esm-externals:react", "esm-externals:prop-types"],
|
|
4
|
+
"sourcesContent": ["import React, { PureComponent } from 'react';\nimport T from 'prop-types';\n\nconst styles = {\n position: 'absolute',\n width: 0,\n height: 0,\n visibility: 'hidden',\n display: 'none',\n};\n\nclass SizeAwareWrapper extends PureComponent {\n componentDidMount() {\n const resizableElement = this.getElement();\n if (resizableElement) {\n this.ro = this.getResizeObserver();\n this.ro.observe(resizableElement);\n }\n }\n\n componentWillUnmount() {\n const resizableElement = this.getElement();\n if (resizableElement && this.ro) {\n this.ro.unobserve(resizableElement);\n }\n }\n\n getElement = () => {\n const parentElement = this.el && this.el.parentElement;\n return parentElement;\n };\n\n getResizeObserver() {\n if (typeof ResizeObserver !== 'function') {\n return {\n observe() {},\n unobserve() {},\n };\n }\n return new ResizeObserver(this.handleResize);\n }\n\n handleResize = entries => {\n entries.forEach(entry => {\n const { width, height } = entry.contentRect;\n this.props.onResize(width, height);\n });\n };\n\n render() {\n return (\n <div\n key=\"resize-detector\"\n style={styles}\n ref={el => {\n this.el = el;\n }}\n />\n );\n }\n}\n\nSizeAwareWrapper.propTypes = {\n onResize: T.func,\n // This was to use width and height as props and then check to see if the values have changed inside the handleResize function\n // Some components need a double render to 'settle' and are using this so no check is needed.\n // However until that is fixed unit tests rely on these props so keeping as optional.\n // width: T.arrayOf(T.number, T.string),\n // height: T.arrayOf(T.number, T.string),\n};\n\nSizeAwareWrapper.defaultProps = {\n onResize: () => {},\n};\n\nexport default SizeAwareWrapper;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"prop-types\";\nexport * from \"prop-types\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,+BAAc;AACd,IAAO,qBAAS,aAAaA,iBAA8B,yBAAUA;;;AFArE,IAAM,SAAS;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AACb;AAEA,IAAM,mBAAN,cAA+B,4BAAc;AAAA,EAA7C;AAAA;AAgBI,sCAAa,MAAM;AACf,YAAM,gBAAgB,KAAK,MAAM,KAAK,GAAG;AACzC,aAAO;AAAA,IACX;AAYA,wCAAe,aAAW;AACtB,cAAQ,QAAQ,WAAS;AACrB,cAAM,EAAE,OAAO,OAAO,IAAI,MAAM;AAChC,aAAK,MAAM,SAAS,OAAO,MAAM;AAAA,MACrC,CAAC;AAAA,IACL;AAAA;AAAA,EAnCA,oBAAoB;AAChB,UAAM,mBAAmB,KAAK,WAAW;AACzC,QAAI,kBAAkB;AAClB,WAAK,KAAK,KAAK,kBAAkB;AACjC,WAAK,GAAG,QAAQ,gBAAgB;AAAA,IACpC;AAAA,EACJ;AAAA,EAEA,uBAAuB;AACnB,UAAM,mBAAmB,KAAK,WAAW;AACzC,QAAI,oBAAoB,KAAK,IAAI;AAC7B,WAAK,GAAG,UAAU,gBAAgB;AAAA,IACtC;AAAA,EACJ;AAAA,EAOA,oBAAoB;AAChB,QAAI,OAAO,mBAAmB,YAAY;AACtC,aAAO;AAAA,QACH,UAAU;AAAA,QAAC;AAAA,QACX,YAAY;AAAA,QAAC;AAAA,MACjB;AAAA,IACJ;AACA,WAAO,IAAI,eAAe,KAAK,YAAY;AAAA,EAC/C;AAAA,EASA,SAAS;AACL,WACI;AAAA,MAAC;AAAA;AAAA,QACG,KAAI;AAAA,QACJ,OAAO;AAAA,QACP,KAAK,QAAM;AACP,eAAK,KAAK;AAAA,QACd;AAAA;AAAA,IACJ;AAAA,EAER;AACJ;AAEA,iBAAiB,YAAY;AAAA,EACzB,UAAU,mBAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAMhB;AAEA,iBAAiB,eAAe;AAAA,EAC5B,UAAU,MAAM;AAAA,EAAC;AACrB;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["defaultImport"]
|
|
7
|
+
}
|