@m4l/components 0.1.36 → 0.1.37

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 (61) hide show
  1. package/dist/{commonjs.bcc6b707.js → commonjs.565e6834.js} +0 -1
  2. package/dist/components/CommonActions/components/ActionCancel/{index.4b36950f.js → index.9230c57b.js} +1 -1
  3. package/dist/components/CommonActions/components/ActionFormCancel/{index.945e9887.js → index.ab514bd9.js} +9 -7
  4. package/dist/components/CommonActions/components/ActionIntro/{index.35a0d240.js → index.a0a341c7.js} +1 -1
  5. package/dist/components/CommonActions/components/Actions/index.d3e1f36e.js +54 -0
  6. package/dist/components/DataGrid/{index.156cc30c.js → index.67260455.js} +663 -15
  7. package/dist/components/DynamicFilter/{index.32f84995.js → index.071aa795.js} +92 -18
  8. package/dist/components/Icon/{index.1dbd3e58.js → index.8d754623.js} +62 -5
  9. package/dist/components/LanguagePopover/index.cbc4b282.js +144 -0
  10. package/dist/components/Loadable/{index.8c6006be.js → index.117eaced.js} +1 -1
  11. package/dist/components/ModalDialog/{index.91777582.js → index.a684827f.js} +5 -5
  12. package/dist/components/ObjectLogs/{index.9d3fc2ae.js → index.4a859658.js} +12 -10
  13. package/dist/components/PaperForm/{index.218a6c4b.js → index.c5948756.js} +1 -1
  14. package/dist/components/Period/{index.74f35862.js → index.abe445bd.js} +9 -7
  15. package/dist/components/Resizeable/{index.44a0dd46.js → index.c96c0f09.js} +1 -1
  16. package/dist/components/SplitLayout/{index.81fc4750.js → index.5a8355d8.js} +1 -1
  17. package/dist/components/animate/PropagateLoader/index.be5b02c3.js +30 -0
  18. package/dist/components/areas/components/AreasAdmin/index.6794b22f.js +112 -0
  19. package/dist/components/areas/components/AreasContainer/index.a2f8899b.js +43 -0
  20. package/dist/components/areas/components/GridLayout/index.b9c1e846.js +92 -0
  21. package/dist/components/areas/components/Window/index.252fbf4e.js +646 -0
  22. package/dist/components/areas/components/WindowPopUp/index.214cf099.js +120 -0
  23. package/dist/components/areas/components/index.7d6cd649.js +67 -0
  24. package/dist/components/areas/contexts/AreaContext/index.4894cf23.js +286 -0
  25. package/dist/components/areas/contexts/AreasContext/index.cd8e4bee.js +158 -0
  26. package/dist/components/areas/contexts/DynamicMFParmsContext/index.668bc2e2.js +17 -0
  27. package/dist/components/areas/contexts/index.f9196fb2.js +1 -0
  28. package/dist/components/areas/hooks/useArea/index.9b85ce24.js +19 -0
  29. package/dist/components/areas/hooks/useDynamicMFParameters/index.e6a44ae3.js +11 -0
  30. package/dist/components/areas/index.d1bf612c.js +16 -0
  31. package/dist/components/formatters/BooleanFormatter/{index.efc8ffc2.js → index.3a9b16c8.js} +1 -1
  32. package/dist/components/formatters/{index.c3f4b687.js → index.0b5f95d0.js} +1 -1
  33. package/dist/components/hook-form/RHFPeriod/{index.2b8e63a2.js → index.3772295b.js} +1 -1
  34. package/dist/components/hook-form/RHFTextField/{index.7feaec71.js → index.b17d68f4.js} +1 -1
  35. package/dist/components/modal/WindowBase.04439b8e.js +120 -0
  36. package/dist/components/modal/WindowConfirm.0b8a6818.js +115 -0
  37. package/dist/components/modal/index.8387e90e.js +18 -0
  38. package/dist/components/mui_extended/Accordion/{index.8e123c57.js → index.a541c71c.js} +2 -2
  39. package/dist/components/mui_extended/Button/index.86a155a2.js +101 -0
  40. package/dist/components/mui_extended/IconButton/{index.e3adaa33.js → index.82f16572.js} +5 -62
  41. package/dist/components/mui_extended/MenuActions/index.ee17bddd.js +112 -0
  42. package/dist/components/mui_extended/Pager/{index.d245f821.js → index.74d3f5fc.js} +66 -1
  43. package/dist/components/mui_extended/Popover/index.53c77d23.js +137 -0
  44. package/dist/components/mui_extended/index.85dfadf1.js +16 -0
  45. package/dist/contexts/ModalContext/{index.0797eb17.js → index.b90eec94.js} +1 -1
  46. package/dist/hooks/useModal/{index.32da4dcb.js → index.d14edee3.js} +1 -1
  47. package/dist/index.js +128 -1691
  48. package/dist/{components/animate/PropagateLoader/index.eb401503.js → node_modules.416f1da3.js} +59 -28
  49. package/dist/package.json +2 -1
  50. package/dist/{react-draggable.3b5b6680.js → react-draggable.84d6b038.js} +1 -1
  51. package/dist/{react-json-view.03ae95f5.js → react-json-view.57125fcf.js} +1 -1
  52. package/dist/{react-resizable.6eae0397.js → react-resizable.1d00271d.js} +3 -4
  53. package/dist/{react-splitter-layout.873aece3.js → react-splitter-layout.8b1655c8.js} +1 -1
  54. package/dist/style.css +0 -114
  55. package/dist/utils/{index.9dce2e2f.js → index.899eb67b.js} +28 -460
  56. package/package.json +3 -1
  57. package/vite.config.ts +201 -129
  58. package/dist/components/CommonActions/components/Actions/index.ba86f72f.js +0 -868
  59. package/dist/components/mui_extended/Button/index.55fc70dc.js +0 -178
  60. package/dist/components/mui_extended/Popover/index.97cf3a3e.js +0 -275
  61. package/dist/node_modules.e0b84fac.js +0 -2154
@@ -1,2154 +0,0 @@
1
- import React__default from "react";
2
- import require$$0 from "lodash.isequal";
3
- import clsx from "clsx";
4
- import { u as utils } from "./utils/index.9dce2e2f.js";
5
- import require$$1 from "prop-types";
6
- import { c as cjs } from "./react-draggable.3b5b6680.js";
7
- import { r as reactResizable } from "./react-resizable.6eae0397.js";
8
- var cssUnit = {
9
- cm: true,
10
- mm: true,
11
- in: true,
12
- px: true,
13
- pt: true,
14
- pc: true,
15
- em: true,
16
- ex: true,
17
- ch: true,
18
- rem: true,
19
- vw: true,
20
- vh: true,
21
- vmin: true,
22
- vmax: true,
23
- "%": true
24
- };
25
- function parseLengthAndUnit(size) {
26
- if (typeof size === "number") {
27
- return {
28
- value: size,
29
- unit: "px"
30
- };
31
- }
32
- var value;
33
- var valueString = (size.match(/^[0-9.]*/) || "").toString();
34
- if (valueString.includes(".")) {
35
- value = parseFloat(valueString);
36
- } else {
37
- value = parseInt(valueString, 10);
38
- }
39
- var unit = (size.match(/[^0-9]*$/) || "").toString();
40
- if (cssUnit[unit]) {
41
- return {
42
- value,
43
- unit
44
- };
45
- }
46
- console.warn("React Spinners: ".concat(size, " is not a valid css value. Defaulting to ").concat(value, "px."));
47
- return {
48
- value,
49
- unit: "px"
50
- };
51
- }
52
- var createAnimation = function(loaderName, frames, suffix) {
53
- var animationName = "react-spinners-".concat(loaderName, "-").concat(suffix);
54
- if (typeof window == "undefined" || !window.document) {
55
- return animationName;
56
- }
57
- var styleEl = document.createElement("style");
58
- document.head.appendChild(styleEl);
59
- var styleSheet = styleEl.sheet;
60
- var keyFrames = "\n @keyframes ".concat(animationName, " {\n ").concat(frames, "\n }\n ");
61
- if (styleSheet) {
62
- styleSheet.insertRule(keyFrames, 0);
63
- }
64
- return animationName;
65
- };
66
- var reactGridLayout = { exports: {} };
67
- var ReactGridLayout$1 = {};
68
- var fastRGLPropsEqual = function fastRGLPropsEqual2(a, b, isEqualImpl) {
69
- if (a === b)
70
- return true;
71
- return a.className === b.className && isEqualImpl(a.style, b.style) && a.width === b.width && a.autoSize === b.autoSize && a.cols === b.cols && a.draggableCancel === b.draggableCancel && a.draggableHandle === b.draggableHandle && isEqualImpl(a.verticalCompact, b.verticalCompact) && isEqualImpl(a.compactType, b.compactType) && isEqualImpl(a.layout, b.layout) && isEqualImpl(a.margin, b.margin) && isEqualImpl(a.containerPadding, b.containerPadding) && a.rowHeight === b.rowHeight && a.maxRows === b.maxRows && a.isBounded === b.isBounded && a.isDraggable === b.isDraggable && a.isResizable === b.isResizable && a.allowOverlap === b.allowOverlap && a.preventCollision === b.preventCollision && a.useCSSTransforms === b.useCSSTransforms && a.transformScale === b.transformScale && a.isDroppable === b.isDroppable && isEqualImpl(a.resizeHandles, b.resizeHandles) && isEqualImpl(a.resizeHandle, b.resizeHandle) && a.onLayoutChange === b.onLayoutChange && a.onDragStart === b.onDragStart && a.onDrag === b.onDrag && a.onDragStop === b.onDragStop && a.onResizeStart === b.onResizeStart && a.onResize === b.onResize && a.onResizeStop === b.onResizeStop && a.onDrop === b.onDrop && isEqualImpl(a.droppingItem, b.droppingItem) && isEqualImpl(a.innerRef, b.innerRef);
72
- };
73
- var calculateUtils = {};
74
- Object.defineProperty(calculateUtils, "__esModule", {
75
- value: true
76
- });
77
- calculateUtils.calcGridColWidth = calcGridColWidth;
78
- calculateUtils.calcGridItemPosition = calcGridItemPosition;
79
- calculateUtils.calcGridItemWHPx = calcGridItemWHPx;
80
- calculateUtils.calcWH = calcWH;
81
- calculateUtils.calcXY = calcXY;
82
- calculateUtils.clamp = clamp;
83
- function calcGridColWidth(positionParams) {
84
- var margin = positionParams.margin, containerPadding = positionParams.containerPadding, containerWidth = positionParams.containerWidth, cols = positionParams.cols;
85
- return (containerWidth - margin[0] * (cols - 1) - containerPadding[0] * 2) / cols;
86
- }
87
- function calcGridItemWHPx(gridUnits, colOrRowSize, marginPx) {
88
- if (!Number.isFinite(gridUnits))
89
- return gridUnits;
90
- return Math.round(colOrRowSize * gridUnits + Math.max(0, gridUnits - 1) * marginPx);
91
- }
92
- function calcGridItemPosition(positionParams, x, y, w, h, state) {
93
- var margin = positionParams.margin, containerPadding = positionParams.containerPadding, rowHeight = positionParams.rowHeight;
94
- var colWidth = calcGridColWidth(positionParams);
95
- var out = {};
96
- if (state && state.resizing) {
97
- out.width = Math.round(state.resizing.width);
98
- out.height = Math.round(state.resizing.height);
99
- } else {
100
- out.width = calcGridItemWHPx(w, colWidth, margin[0]);
101
- out.height = calcGridItemWHPx(h, rowHeight, margin[1]);
102
- }
103
- if (state && state.dragging) {
104
- out.top = Math.round(state.dragging.top);
105
- out.left = Math.round(state.dragging.left);
106
- } else {
107
- out.top = Math.round((rowHeight + margin[1]) * y + containerPadding[1]);
108
- out.left = Math.round((colWidth + margin[0]) * x + containerPadding[0]);
109
- }
110
- return out;
111
- }
112
- function calcXY(positionParams, top, left, w, h) {
113
- var margin = positionParams.margin, cols = positionParams.cols, rowHeight = positionParams.rowHeight, maxRows = positionParams.maxRows;
114
- var colWidth = calcGridColWidth(positionParams);
115
- var x = Math.round((left - margin[0]) / (colWidth + margin[0]));
116
- var y = Math.round((top - margin[1]) / (rowHeight + margin[1]));
117
- x = clamp(x, 0, cols - w);
118
- y = clamp(y, 0, maxRows - h);
119
- return {
120
- x,
121
- y
122
- };
123
- }
124
- function calcWH(positionParams, width, height, x, y) {
125
- var margin = positionParams.margin, maxRows = positionParams.maxRows, cols = positionParams.cols, rowHeight = positionParams.rowHeight;
126
- var colWidth = calcGridColWidth(positionParams);
127
- var w = Math.round((width + margin[0]) / (colWidth + margin[0]));
128
- var h = Math.round((height + margin[1]) / (rowHeight + margin[1]));
129
- w = clamp(w, 0, cols - x);
130
- h = clamp(h, 0, maxRows - y);
131
- return {
132
- w,
133
- h
134
- };
135
- }
136
- function clamp(num, lowerBound, upperBound) {
137
- return Math.max(Math.min(num, upperBound), lowerBound);
138
- }
139
- var GridItem$1 = {};
140
- var ReactGridLayoutPropTypes = {};
141
- Object.defineProperty(ReactGridLayoutPropTypes, "__esModule", {
142
- value: true
143
- });
144
- ReactGridLayoutPropTypes.resizeHandleType = ReactGridLayoutPropTypes.resizeHandleAxesType = ReactGridLayoutPropTypes.default = void 0;
145
- var _propTypes$3 = _interopRequireDefault$4(require$$1);
146
- var _react$1 = _interopRequireDefault$4(React__default);
147
- function _interopRequireDefault$4(obj) {
148
- return obj && obj.__esModule ? obj : { default: obj };
149
- }
150
- var resizeHandleAxesType = _propTypes$3.default.arrayOf(_propTypes$3.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"]));
151
- ReactGridLayoutPropTypes.resizeHandleAxesType = resizeHandleAxesType;
152
- var resizeHandleType = _propTypes$3.default.oneOfType([_propTypes$3.default.node, _propTypes$3.default.func]);
153
- ReactGridLayoutPropTypes.resizeHandleType = resizeHandleType;
154
- var _default = {
155
- className: _propTypes$3.default.string,
156
- style: _propTypes$3.default.object,
157
- width: _propTypes$3.default.number,
158
- autoSize: _propTypes$3.default.bool,
159
- cols: _propTypes$3.default.number,
160
- draggableCancel: _propTypes$3.default.string,
161
- draggableHandle: _propTypes$3.default.string,
162
- verticalCompact: function verticalCompact(props) {
163
- if (props.verticalCompact === false && process.env.NODE_ENV !== "production") {
164
- console.warn(
165
- '`verticalCompact` on <ReactGridLayout> is deprecated and will be removed soon. Use `compactType`: "horizontal" | "vertical" | null.'
166
- );
167
- }
168
- },
169
- compactType: _propTypes$3.default.oneOf(["vertical", "horizontal"]),
170
- layout: function layout(props) {
171
- var layout2 = props.layout;
172
- if (layout2 === void 0)
173
- return;
174
- utils.validateLayout(layout2, "layout");
175
- },
176
- margin: _propTypes$3.default.arrayOf(_propTypes$3.default.number),
177
- containerPadding: _propTypes$3.default.arrayOf(_propTypes$3.default.number),
178
- rowHeight: _propTypes$3.default.number,
179
- maxRows: _propTypes$3.default.number,
180
- isBounded: _propTypes$3.default.bool,
181
- isDraggable: _propTypes$3.default.bool,
182
- isResizable: _propTypes$3.default.bool,
183
- allowOverlap: _propTypes$3.default.bool,
184
- preventCollision: _propTypes$3.default.bool,
185
- useCSSTransforms: _propTypes$3.default.bool,
186
- transformScale: _propTypes$3.default.number,
187
- isDroppable: _propTypes$3.default.bool,
188
- resizeHandles: resizeHandleAxesType,
189
- resizeHandle: resizeHandleType,
190
- onLayoutChange: _propTypes$3.default.func,
191
- onDragStart: _propTypes$3.default.func,
192
- onDrag: _propTypes$3.default.func,
193
- onDragStop: _propTypes$3.default.func,
194
- onResizeStart: _propTypes$3.default.func,
195
- onResize: _propTypes$3.default.func,
196
- onResizeStop: _propTypes$3.default.func,
197
- onDrop: _propTypes$3.default.func,
198
- droppingItem: _propTypes$3.default.shape({
199
- i: _propTypes$3.default.string.isRequired,
200
- w: _propTypes$3.default.number.isRequired,
201
- h: _propTypes$3.default.number.isRequired
202
- }),
203
- children: function children(props, propName) {
204
- var children2 = props[propName];
205
- var keys = {};
206
- _react$1.default.Children.forEach(children2, function(child) {
207
- if ((child === null || child === void 0 ? void 0 : child.key) == null)
208
- return;
209
- if (keys[child.key]) {
210
- throw new Error('Duplicate child key "' + child.key + '" found! This will cause problems in ReactGridLayout.');
211
- }
212
- keys[child.key] = true;
213
- });
214
- },
215
- innerRef: _propTypes$3.default.any
216
- };
217
- ReactGridLayoutPropTypes.default = _default;
218
- function _typeof$3(obj) {
219
- "@babel/helpers - typeof";
220
- return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
221
- return typeof obj2;
222
- } : function(obj2) {
223
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
224
- }, _typeof$3(obj);
225
- }
226
- Object.defineProperty(GridItem$1, "__esModule", {
227
- value: true
228
- });
229
- GridItem$1.default = void 0;
230
- var _react = _interopRequireDefault$3(React__default);
231
- var _propTypes$2 = _interopRequireDefault$3(require$$1);
232
- var _reactDraggable = cjs.exports;
233
- var _reactResizable = reactResizable.exports;
234
- var _utils$3 = utils;
235
- var _calculateUtils$1 = calculateUtils;
236
- var _ReactGridLayoutPropTypes$1 = ReactGridLayoutPropTypes;
237
- var _clsx$2 = _interopRequireDefault$3(clsx);
238
- function _interopRequireDefault$3(obj) {
239
- return obj && obj.__esModule ? obj : { default: obj };
240
- }
241
- function ownKeys$2(object, enumerableOnly) {
242
- var keys = Object.keys(object);
243
- if (Object.getOwnPropertySymbols) {
244
- var symbols = Object.getOwnPropertySymbols(object);
245
- enumerableOnly && (symbols = symbols.filter(function(sym) {
246
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
247
- })), keys.push.apply(keys, symbols);
248
- }
249
- return keys;
250
- }
251
- function _objectSpread$2(target) {
252
- for (var i = 1; i < arguments.length; i++) {
253
- var source = null != arguments[i] ? arguments[i] : {};
254
- i % 2 ? ownKeys$2(Object(source), true).forEach(function(key) {
255
- _defineProperty$3(target, key, source[key]);
256
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function(key) {
257
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
258
- });
259
- }
260
- return target;
261
- }
262
- function _classCallCheck$3(instance, Constructor) {
263
- if (!(instance instanceof Constructor)) {
264
- throw new TypeError("Cannot call a class as a function");
265
- }
266
- }
267
- function _defineProperties$3(target, props) {
268
- for (var i = 0; i < props.length; i++) {
269
- var descriptor = props[i];
270
- descriptor.enumerable = descriptor.enumerable || false;
271
- descriptor.configurable = true;
272
- if ("value" in descriptor)
273
- descriptor.writable = true;
274
- Object.defineProperty(target, descriptor.key, descriptor);
275
- }
276
- }
277
- function _createClass$3(Constructor, protoProps, staticProps) {
278
- if (protoProps)
279
- _defineProperties$3(Constructor.prototype, protoProps);
280
- if (staticProps)
281
- _defineProperties$3(Constructor, staticProps);
282
- Object.defineProperty(Constructor, "prototype", { writable: false });
283
- return Constructor;
284
- }
285
- function _inherits$3(subClass, superClass) {
286
- if (typeof superClass !== "function" && superClass !== null) {
287
- throw new TypeError("Super expression must either be null or a function");
288
- }
289
- subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
290
- Object.defineProperty(subClass, "prototype", { writable: false });
291
- if (superClass)
292
- _setPrototypeOf$3(subClass, superClass);
293
- }
294
- function _setPrototypeOf$3(o, p) {
295
- _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
296
- o2.__proto__ = p2;
297
- return o2;
298
- };
299
- return _setPrototypeOf$3(o, p);
300
- }
301
- function _createSuper$3(Derived) {
302
- var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
303
- return function _createSuperInternal() {
304
- var Super = _getPrototypeOf$3(Derived), result;
305
- if (hasNativeReflectConstruct) {
306
- var NewTarget = _getPrototypeOf$3(this).constructor;
307
- result = Reflect.construct(Super, arguments, NewTarget);
308
- } else {
309
- result = Super.apply(this, arguments);
310
- }
311
- return _possibleConstructorReturn$3(this, result);
312
- };
313
- }
314
- function _possibleConstructorReturn$3(self, call) {
315
- if (call && (_typeof$3(call) === "object" || typeof call === "function")) {
316
- return call;
317
- } else if (call !== void 0) {
318
- throw new TypeError("Derived constructors may only return object or undefined");
319
- }
320
- return _assertThisInitialized$3(self);
321
- }
322
- function _assertThisInitialized$3(self) {
323
- if (self === void 0) {
324
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
325
- }
326
- return self;
327
- }
328
- function _isNativeReflectConstruct$3() {
329
- if (typeof Reflect === "undefined" || !Reflect.construct)
330
- return false;
331
- if (Reflect.construct.sham)
332
- return false;
333
- if (typeof Proxy === "function")
334
- return true;
335
- try {
336
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
337
- }));
338
- return true;
339
- } catch (e) {
340
- return false;
341
- }
342
- }
343
- function _getPrototypeOf$3(o) {
344
- _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
345
- return o2.__proto__ || Object.getPrototypeOf(o2);
346
- };
347
- return _getPrototypeOf$3(o);
348
- }
349
- function _defineProperty$3(obj, key, value) {
350
- if (key in obj) {
351
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
352
- } else {
353
- obj[key] = value;
354
- }
355
- return obj;
356
- }
357
- var GridItem = /* @__PURE__ */ function(_React$Component) {
358
- _inherits$3(GridItem2, _React$Component);
359
- var _super = _createSuper$3(GridItem2);
360
- function GridItem2() {
361
- var _this;
362
- _classCallCheck$3(this, GridItem2);
363
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
364
- args[_key] = arguments[_key];
365
- }
366
- _this = _super.call.apply(_super, [this].concat(args));
367
- _defineProperty$3(_assertThisInitialized$3(_this), "state", {
368
- resizing: null,
369
- dragging: null,
370
- className: ""
371
- });
372
- _defineProperty$3(_assertThisInitialized$3(_this), "elementRef", /* @__PURE__ */ _react.default.createRef());
373
- _defineProperty$3(_assertThisInitialized$3(_this), "onDragStart", function(e, _ref) {
374
- var node = _ref.node;
375
- var _this$props = _this.props, onDragStart = _this$props.onDragStart, transformScale = _this$props.transformScale;
376
- if (!onDragStart)
377
- return;
378
- var newPosition = {
379
- top: 0,
380
- left: 0
381
- };
382
- var offsetParent = node.offsetParent;
383
- if (!offsetParent)
384
- return;
385
- var parentRect = offsetParent.getBoundingClientRect();
386
- var clientRect = node.getBoundingClientRect();
387
- var cLeft = clientRect.left / transformScale;
388
- var pLeft = parentRect.left / transformScale;
389
- var cTop = clientRect.top / transformScale;
390
- var pTop = parentRect.top / transformScale;
391
- newPosition.left = cLeft - pLeft + offsetParent.scrollLeft;
392
- newPosition.top = cTop - pTop + offsetParent.scrollTop;
393
- _this.setState({
394
- dragging: newPosition
395
- });
396
- var _calcXY = (0, _calculateUtils$1.calcXY)(_this.getPositionParams(), newPosition.top, newPosition.left, _this.props.w, _this.props.h), x = _calcXY.x, y = _calcXY.y;
397
- return onDragStart.call(_assertThisInitialized$3(_this), _this.props.i, x, y, {
398
- e,
399
- node,
400
- newPosition
401
- });
402
- });
403
- _defineProperty$3(_assertThisInitialized$3(_this), "onDrag", function(e, _ref2) {
404
- var node = _ref2.node, deltaX = _ref2.deltaX, deltaY = _ref2.deltaY;
405
- var onDrag = _this.props.onDrag;
406
- if (!onDrag)
407
- return;
408
- if (!_this.state.dragging) {
409
- throw new Error("onDrag called before onDragStart.");
410
- }
411
- var top = _this.state.dragging.top + deltaY;
412
- var left = _this.state.dragging.left + deltaX;
413
- var _this$props2 = _this.props, isBounded = _this$props2.isBounded, i = _this$props2.i, w = _this$props2.w, h = _this$props2.h, containerWidth = _this$props2.containerWidth;
414
- var positionParams = _this.getPositionParams();
415
- if (isBounded) {
416
- var offsetParent = node.offsetParent;
417
- if (offsetParent) {
418
- var _this$props3 = _this.props, margin = _this$props3.margin, rowHeight = _this$props3.rowHeight;
419
- var bottomBoundary = offsetParent.clientHeight - (0, _calculateUtils$1.calcGridItemWHPx)(h, rowHeight, margin[1]);
420
- top = (0, _calculateUtils$1.clamp)(top, 0, bottomBoundary);
421
- var colWidth = (0, _calculateUtils$1.calcGridColWidth)(positionParams);
422
- var rightBoundary = containerWidth - (0, _calculateUtils$1.calcGridItemWHPx)(w, colWidth, margin[0]);
423
- left = (0, _calculateUtils$1.clamp)(left, 0, rightBoundary);
424
- }
425
- }
426
- var newPosition = {
427
- top,
428
- left
429
- };
430
- _this.setState({
431
- dragging: newPosition
432
- });
433
- var _calcXY2 = (0, _calculateUtils$1.calcXY)(positionParams, top, left, w, h), x = _calcXY2.x, y = _calcXY2.y;
434
- return onDrag.call(_assertThisInitialized$3(_this), i, x, y, {
435
- e,
436
- node,
437
- newPosition
438
- });
439
- });
440
- _defineProperty$3(_assertThisInitialized$3(_this), "onDragStop", function(e, _ref3) {
441
- var node = _ref3.node;
442
- var onDragStop = _this.props.onDragStop;
443
- if (!onDragStop)
444
- return;
445
- if (!_this.state.dragging) {
446
- throw new Error("onDragEnd called before onDragStart.");
447
- }
448
- var _this$props4 = _this.props, w = _this$props4.w, h = _this$props4.h, i = _this$props4.i;
449
- var _this$state$dragging = _this.state.dragging, left = _this$state$dragging.left, top = _this$state$dragging.top;
450
- var newPosition = {
451
- top,
452
- left
453
- };
454
- _this.setState({
455
- dragging: null
456
- });
457
- var _calcXY3 = (0, _calculateUtils$1.calcXY)(_this.getPositionParams(), top, left, w, h), x = _calcXY3.x, y = _calcXY3.y;
458
- return onDragStop.call(_assertThisInitialized$3(_this), i, x, y, {
459
- e,
460
- node,
461
- newPosition
462
- });
463
- });
464
- _defineProperty$3(_assertThisInitialized$3(_this), "onResizeStop", function(e, callbackData) {
465
- _this.onResizeHandler(e, callbackData, "onResizeStop");
466
- });
467
- _defineProperty$3(_assertThisInitialized$3(_this), "onResizeStart", function(e, callbackData) {
468
- _this.onResizeHandler(e, callbackData, "onResizeStart");
469
- });
470
- _defineProperty$3(_assertThisInitialized$3(_this), "onResize", function(e, callbackData) {
471
- _this.onResizeHandler(e, callbackData, "onResize");
472
- });
473
- return _this;
474
- }
475
- _createClass$3(GridItem2, [{
476
- key: "shouldComponentUpdate",
477
- value: function shouldComponentUpdate(nextProps, nextState) {
478
- if (this.props.children !== nextProps.children)
479
- return true;
480
- if (this.props.droppingPosition !== nextProps.droppingPosition)
481
- return true;
482
- var oldPosition = (0, _calculateUtils$1.calcGridItemPosition)(this.getPositionParams(this.props), this.props.x, this.props.y, this.props.w, this.props.h, this.state);
483
- var newPosition = (0, _calculateUtils$1.calcGridItemPosition)(this.getPositionParams(nextProps), nextProps.x, nextProps.y, nextProps.w, nextProps.h, nextState);
484
- return !(0, _utils$3.fastPositionEqual)(oldPosition, newPosition) || this.props.useCSSTransforms !== nextProps.useCSSTransforms;
485
- }
486
- }, {
487
- key: "componentDidMount",
488
- value: function componentDidMount() {
489
- this.moveDroppingItem({});
490
- }
491
- }, {
492
- key: "componentDidUpdate",
493
- value: function componentDidUpdate(prevProps) {
494
- this.moveDroppingItem(prevProps);
495
- }
496
- }, {
497
- key: "moveDroppingItem",
498
- value: function moveDroppingItem(prevProps) {
499
- var droppingPosition = this.props.droppingPosition;
500
- if (!droppingPosition)
501
- return;
502
- var node = this.elementRef.current;
503
- if (!node)
504
- return;
505
- var prevDroppingPosition = prevProps.droppingPosition || {
506
- left: 0,
507
- top: 0
508
- };
509
- var dragging = this.state.dragging;
510
- var shouldDrag = dragging && droppingPosition.left !== prevDroppingPosition.left || droppingPosition.top !== prevDroppingPosition.top;
511
- if (!dragging) {
512
- this.onDragStart(droppingPosition.e, {
513
- node,
514
- deltaX: droppingPosition.left,
515
- deltaY: droppingPosition.top
516
- });
517
- } else if (shouldDrag) {
518
- var deltaX = droppingPosition.left - dragging.left;
519
- var deltaY = droppingPosition.top - dragging.top;
520
- this.onDrag(droppingPosition.e, {
521
- node,
522
- deltaX,
523
- deltaY
524
- });
525
- }
526
- }
527
- }, {
528
- key: "getPositionParams",
529
- value: function getPositionParams() {
530
- var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
531
- return {
532
- cols: props.cols,
533
- containerPadding: props.containerPadding,
534
- containerWidth: props.containerWidth,
535
- margin: props.margin,
536
- maxRows: props.maxRows,
537
- rowHeight: props.rowHeight
538
- };
539
- }
540
- }, {
541
- key: "createStyle",
542
- value: function createStyle(pos) {
543
- var _this$props5 = this.props, usePercentages = _this$props5.usePercentages, containerWidth = _this$props5.containerWidth, useCSSTransforms = _this$props5.useCSSTransforms;
544
- var style;
545
- if (useCSSTransforms) {
546
- style = (0, _utils$3.setTransform)(pos);
547
- } else {
548
- style = (0, _utils$3.setTopLeft)(pos);
549
- if (usePercentages) {
550
- style.left = (0, _utils$3.perc)(pos.left / containerWidth);
551
- style.width = (0, _utils$3.perc)(pos.width / containerWidth);
552
- }
553
- }
554
- return style;
555
- }
556
- }, {
557
- key: "mixinDraggable",
558
- value: function mixinDraggable(child, isDraggable) {
559
- return /* @__PURE__ */ _react.default.createElement(_reactDraggable.DraggableCore, {
560
- disabled: !isDraggable,
561
- onStart: this.onDragStart,
562
- onDrag: this.onDrag,
563
- onStop: this.onDragStop,
564
- handle: this.props.handle,
565
- cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
566
- scale: this.props.transformScale,
567
- nodeRef: this.elementRef
568
- }, child);
569
- }
570
- }, {
571
- key: "mixinResizable",
572
- value: function mixinResizable(child, position, isResizable) {
573
- var _this$props6 = this.props, cols = _this$props6.cols, x = _this$props6.x, minW2 = _this$props6.minW, minH2 = _this$props6.minH, maxW2 = _this$props6.maxW, maxH2 = _this$props6.maxH, transformScale = _this$props6.transformScale, resizeHandles = _this$props6.resizeHandles, resizeHandle = _this$props6.resizeHandle;
574
- var positionParams = this.getPositionParams();
575
- var maxWidth = (0, _calculateUtils$1.calcGridItemPosition)(positionParams, 0, 0, cols - x, 0).width;
576
- var mins = (0, _calculateUtils$1.calcGridItemPosition)(positionParams, 0, 0, minW2, minH2);
577
- var maxes = (0, _calculateUtils$1.calcGridItemPosition)(positionParams, 0, 0, maxW2, maxH2);
578
- var minConstraints = [mins.width, mins.height];
579
- var maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
580
- return /* @__PURE__ */ _react.default.createElement(
581
- _reactResizable.Resizable,
582
- {
583
- draggableOpts: {
584
- disabled: !isResizable
585
- },
586
- className: isResizable ? void 0 : "react-resizable-hide",
587
- width: position.width,
588
- height: position.height,
589
- minConstraints,
590
- maxConstraints,
591
- onResizeStop: this.onResizeStop,
592
- onResizeStart: this.onResizeStart,
593
- onResize: this.onResize,
594
- transformScale,
595
- resizeHandles,
596
- handle: resizeHandle
597
- },
598
- child
599
- );
600
- }
601
- }, {
602
- key: "onResizeHandler",
603
- value: function onResizeHandler(e, _ref4, handlerName) {
604
- var node = _ref4.node, size = _ref4.size;
605
- var handler = this.props[handlerName];
606
- if (!handler)
607
- return;
608
- var _this$props7 = this.props, cols = _this$props7.cols, x = _this$props7.x, y = _this$props7.y, i = _this$props7.i, maxH2 = _this$props7.maxH, minH2 = _this$props7.minH;
609
- var _this$props8 = this.props, minW2 = _this$props8.minW, maxW2 = _this$props8.maxW;
610
- var _calcWH = (0, _calculateUtils$1.calcWH)(this.getPositionParams(), size.width, size.height, x, y), w = _calcWH.w, h = _calcWH.h;
611
- minW2 = Math.max(minW2, 1);
612
- maxW2 = Math.min(maxW2, cols - x);
613
- w = (0, _calculateUtils$1.clamp)(w, minW2, maxW2);
614
- h = (0, _calculateUtils$1.clamp)(h, minH2, maxH2);
615
- this.setState({
616
- resizing: handlerName === "onResizeStop" ? null : size
617
- });
618
- handler.call(this, i, w, h, {
619
- e,
620
- node,
621
- size
622
- });
623
- }
624
- }, {
625
- key: "render",
626
- value: function render() {
627
- var _this$props9 = this.props, x = _this$props9.x, y = _this$props9.y, w = _this$props9.w, h = _this$props9.h, isDraggable = _this$props9.isDraggable, isResizable = _this$props9.isResizable, droppingPosition = _this$props9.droppingPosition, useCSSTransforms = _this$props9.useCSSTransforms;
628
- var pos = (0, _calculateUtils$1.calcGridItemPosition)(this.getPositionParams(), x, y, w, h, this.state);
629
- var child = _react.default.Children.only(this.props.children);
630
- var newChild = /* @__PURE__ */ _react.default.cloneElement(child, {
631
- ref: this.elementRef,
632
- className: (0, _clsx$2.default)("react-grid-item", child.props.className, this.props.className, {
633
- static: this.props.static,
634
- resizing: Boolean(this.state.resizing),
635
- "react-draggable": isDraggable,
636
- "react-draggable-dragging": Boolean(this.state.dragging),
637
- dropping: Boolean(droppingPosition),
638
- cssTransforms: useCSSTransforms
639
- }),
640
- style: _objectSpread$2(_objectSpread$2(_objectSpread$2({}, this.props.style), child.props.style), this.createStyle(pos))
641
- });
642
- newChild = this.mixinResizable(newChild, pos, isResizable);
643
- newChild = this.mixinDraggable(newChild, isDraggable);
644
- return newChild;
645
- }
646
- }]);
647
- return GridItem2;
648
- }(_react.default.Component);
649
- GridItem$1.default = GridItem;
650
- _defineProperty$3(GridItem, "propTypes", {
651
- children: _propTypes$2.default.element,
652
- cols: _propTypes$2.default.number.isRequired,
653
- containerWidth: _propTypes$2.default.number.isRequired,
654
- rowHeight: _propTypes$2.default.number.isRequired,
655
- margin: _propTypes$2.default.array.isRequired,
656
- maxRows: _propTypes$2.default.number.isRequired,
657
- containerPadding: _propTypes$2.default.array.isRequired,
658
- x: _propTypes$2.default.number.isRequired,
659
- y: _propTypes$2.default.number.isRequired,
660
- w: _propTypes$2.default.number.isRequired,
661
- h: _propTypes$2.default.number.isRequired,
662
- minW: function minW(props, propName) {
663
- var value = props[propName];
664
- if (typeof value !== "number")
665
- return new Error("minWidth not Number");
666
- if (value > props.w || value > props.maxW)
667
- return new Error("minWidth larger than item width/maxWidth");
668
- },
669
- maxW: function maxW(props, propName) {
670
- var value = props[propName];
671
- if (typeof value !== "number")
672
- return new Error("maxWidth not Number");
673
- if (value < props.w || value < props.minW)
674
- return new Error("maxWidth smaller than item width/minWidth");
675
- },
676
- minH: function minH(props, propName) {
677
- var value = props[propName];
678
- if (typeof value !== "number")
679
- return new Error("minHeight not Number");
680
- if (value > props.h || value > props.maxH)
681
- return new Error("minHeight larger than item height/maxHeight");
682
- },
683
- maxH: function maxH(props, propName) {
684
- var value = props[propName];
685
- if (typeof value !== "number")
686
- return new Error("maxHeight not Number");
687
- if (value < props.h || value < props.minH)
688
- return new Error("maxHeight smaller than item height/minHeight");
689
- },
690
- i: _propTypes$2.default.string.isRequired,
691
- resizeHandles: _ReactGridLayoutPropTypes$1.resizeHandleAxesType,
692
- resizeHandle: _ReactGridLayoutPropTypes$1.resizeHandleType,
693
- onDragStop: _propTypes$2.default.func,
694
- onDragStart: _propTypes$2.default.func,
695
- onDrag: _propTypes$2.default.func,
696
- onResizeStop: _propTypes$2.default.func,
697
- onResizeStart: _propTypes$2.default.func,
698
- onResize: _propTypes$2.default.func,
699
- isDraggable: _propTypes$2.default.bool.isRequired,
700
- isResizable: _propTypes$2.default.bool.isRequired,
701
- isBounded: _propTypes$2.default.bool.isRequired,
702
- static: _propTypes$2.default.bool,
703
- useCSSTransforms: _propTypes$2.default.bool.isRequired,
704
- transformScale: _propTypes$2.default.number,
705
- className: _propTypes$2.default.string,
706
- handle: _propTypes$2.default.string,
707
- cancel: _propTypes$2.default.string,
708
- droppingPosition: _propTypes$2.default.shape({
709
- e: _propTypes$2.default.object.isRequired,
710
- left: _propTypes$2.default.number.isRequired,
711
- top: _propTypes$2.default.number.isRequired
712
- })
713
- });
714
- _defineProperty$3(GridItem, "defaultProps", {
715
- className: "",
716
- cancel: "",
717
- handle: "",
718
- minH: 1,
719
- minW: 1,
720
- maxH: Infinity,
721
- maxW: Infinity,
722
- transformScale: 1
723
- });
724
- function _typeof$2(obj) {
725
- "@babel/helpers - typeof";
726
- return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
727
- return typeof obj2;
728
- } : function(obj2) {
729
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
730
- }, _typeof$2(obj);
731
- }
732
- Object.defineProperty(ReactGridLayout$1, "__esModule", {
733
- value: true
734
- });
735
- ReactGridLayout$1.default = void 0;
736
- var React$2 = _interopRequireWildcard$2(React__default);
737
- var _lodash$1 = _interopRequireDefault$2(require$$0);
738
- var _clsx$1 = _interopRequireDefault$2(clsx);
739
- var _utils$2 = utils;
740
- var _calculateUtils = calculateUtils;
741
- var _GridItem = _interopRequireDefault$2(GridItem$1);
742
- var _ReactGridLayoutPropTypes = _interopRequireDefault$2(ReactGridLayoutPropTypes);
743
- function _interopRequireDefault$2(obj) {
744
- return obj && obj.__esModule ? obj : { default: obj };
745
- }
746
- function _getRequireWildcardCache$2(nodeInterop) {
747
- if (typeof WeakMap !== "function")
748
- return null;
749
- var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
750
- var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
751
- return (_getRequireWildcardCache$2 = function _getRequireWildcardCache2(nodeInterop2) {
752
- return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
753
- })(nodeInterop);
754
- }
755
- function _interopRequireWildcard$2(obj, nodeInterop) {
756
- if (!nodeInterop && obj && obj.__esModule) {
757
- return obj;
758
- }
759
- if (obj === null || _typeof$2(obj) !== "object" && typeof obj !== "function") {
760
- return { default: obj };
761
- }
762
- var cache = _getRequireWildcardCache$2(nodeInterop);
763
- if (cache && cache.has(obj)) {
764
- return cache.get(obj);
765
- }
766
- var newObj = {};
767
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
768
- for (var key in obj) {
769
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
770
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
771
- if (desc && (desc.get || desc.set)) {
772
- Object.defineProperty(newObj, key, desc);
773
- } else {
774
- newObj[key] = obj[key];
775
- }
776
- }
777
- }
778
- newObj.default = obj;
779
- if (cache) {
780
- cache.set(obj, newObj);
781
- }
782
- return newObj;
783
- }
784
- function _toConsumableArray(arr) {
785
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
786
- }
787
- function _nonIterableSpread() {
788
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
789
- }
790
- function _iterableToArray(iter) {
791
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
792
- return Array.from(iter);
793
- }
794
- function _arrayWithoutHoles(arr) {
795
- if (Array.isArray(arr))
796
- return _arrayLikeToArray(arr);
797
- }
798
- function ownKeys$1(object, enumerableOnly) {
799
- var keys = Object.keys(object);
800
- if (Object.getOwnPropertySymbols) {
801
- var symbols = Object.getOwnPropertySymbols(object);
802
- enumerableOnly && (symbols = symbols.filter(function(sym) {
803
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
804
- })), keys.push.apply(keys, symbols);
805
- }
806
- return keys;
807
- }
808
- function _objectSpread$1(target) {
809
- for (var i = 1; i < arguments.length; i++) {
810
- var source = null != arguments[i] ? arguments[i] : {};
811
- i % 2 ? ownKeys$1(Object(source), true).forEach(function(key) {
812
- _defineProperty$2(target, key, source[key]);
813
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) {
814
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
815
- });
816
- }
817
- return target;
818
- }
819
- function _slicedToArray(arr, i) {
820
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
821
- }
822
- function _nonIterableRest() {
823
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
824
- }
825
- function _unsupportedIterableToArray(o, minLen) {
826
- if (!o)
827
- return;
828
- if (typeof o === "string")
829
- return _arrayLikeToArray(o, minLen);
830
- var n = Object.prototype.toString.call(o).slice(8, -1);
831
- if (n === "Object" && o.constructor)
832
- n = o.constructor.name;
833
- if (n === "Map" || n === "Set")
834
- return Array.from(o);
835
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
836
- return _arrayLikeToArray(o, minLen);
837
- }
838
- function _arrayLikeToArray(arr, len) {
839
- if (len == null || len > arr.length)
840
- len = arr.length;
841
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
842
- arr2[i] = arr[i];
843
- }
844
- return arr2;
845
- }
846
- function _iterableToArrayLimit(arr, i) {
847
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
848
- if (_i == null)
849
- return;
850
- var _arr = [];
851
- var _n = true;
852
- var _d = false;
853
- var _s, _e;
854
- try {
855
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
856
- _arr.push(_s.value);
857
- if (i && _arr.length === i)
858
- break;
859
- }
860
- } catch (err) {
861
- _d = true;
862
- _e = err;
863
- } finally {
864
- try {
865
- if (!_n && _i["return"] != null)
866
- _i["return"]();
867
- } finally {
868
- if (_d)
869
- throw _e;
870
- }
871
- }
872
- return _arr;
873
- }
874
- function _arrayWithHoles(arr) {
875
- if (Array.isArray(arr))
876
- return arr;
877
- }
878
- function _classCallCheck$2(instance, Constructor) {
879
- if (!(instance instanceof Constructor)) {
880
- throw new TypeError("Cannot call a class as a function");
881
- }
882
- }
883
- function _defineProperties$2(target, props) {
884
- for (var i = 0; i < props.length; i++) {
885
- var descriptor = props[i];
886
- descriptor.enumerable = descriptor.enumerable || false;
887
- descriptor.configurable = true;
888
- if ("value" in descriptor)
889
- descriptor.writable = true;
890
- Object.defineProperty(target, descriptor.key, descriptor);
891
- }
892
- }
893
- function _createClass$2(Constructor, protoProps, staticProps) {
894
- if (protoProps)
895
- _defineProperties$2(Constructor.prototype, protoProps);
896
- if (staticProps)
897
- _defineProperties$2(Constructor, staticProps);
898
- Object.defineProperty(Constructor, "prototype", { writable: false });
899
- return Constructor;
900
- }
901
- function _inherits$2(subClass, superClass) {
902
- if (typeof superClass !== "function" && superClass !== null) {
903
- throw new TypeError("Super expression must either be null or a function");
904
- }
905
- subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
906
- Object.defineProperty(subClass, "prototype", { writable: false });
907
- if (superClass)
908
- _setPrototypeOf$2(subClass, superClass);
909
- }
910
- function _setPrototypeOf$2(o, p) {
911
- _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
912
- o2.__proto__ = p2;
913
- return o2;
914
- };
915
- return _setPrototypeOf$2(o, p);
916
- }
917
- function _createSuper$2(Derived) {
918
- var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
919
- return function _createSuperInternal() {
920
- var Super = _getPrototypeOf$2(Derived), result;
921
- if (hasNativeReflectConstruct) {
922
- var NewTarget = _getPrototypeOf$2(this).constructor;
923
- result = Reflect.construct(Super, arguments, NewTarget);
924
- } else {
925
- result = Super.apply(this, arguments);
926
- }
927
- return _possibleConstructorReturn$2(this, result);
928
- };
929
- }
930
- function _possibleConstructorReturn$2(self, call) {
931
- if (call && (_typeof$2(call) === "object" || typeof call === "function")) {
932
- return call;
933
- } else if (call !== void 0) {
934
- throw new TypeError("Derived constructors may only return object or undefined");
935
- }
936
- return _assertThisInitialized$2(self);
937
- }
938
- function _assertThisInitialized$2(self) {
939
- if (self === void 0) {
940
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
941
- }
942
- return self;
943
- }
944
- function _isNativeReflectConstruct$2() {
945
- if (typeof Reflect === "undefined" || !Reflect.construct)
946
- return false;
947
- if (Reflect.construct.sham)
948
- return false;
949
- if (typeof Proxy === "function")
950
- return true;
951
- try {
952
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
953
- }));
954
- return true;
955
- } catch (e) {
956
- return false;
957
- }
958
- }
959
- function _getPrototypeOf$2(o) {
960
- _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
961
- return o2.__proto__ || Object.getPrototypeOf(o2);
962
- };
963
- return _getPrototypeOf$2(o);
964
- }
965
- function _defineProperty$2(obj, key, value) {
966
- if (key in obj) {
967
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
968
- } else {
969
- obj[key] = value;
970
- }
971
- return obj;
972
- }
973
- var layoutClassName$1 = "react-grid-layout";
974
- var isFirefox = false;
975
- try {
976
- isFirefox = /firefox/i.test(navigator.userAgent);
977
- } catch (e) {
978
- }
979
- var ReactGridLayout = /* @__PURE__ */ function(_React$Component) {
980
- _inherits$2(ReactGridLayout2, _React$Component);
981
- var _super = _createSuper$2(ReactGridLayout2);
982
- function ReactGridLayout2() {
983
- var _this;
984
- _classCallCheck$2(this, ReactGridLayout2);
985
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
986
- args[_key] = arguments[_key];
987
- }
988
- _this = _super.call.apply(_super, [this].concat(args));
989
- _defineProperty$2(_assertThisInitialized$2(_this), "state", {
990
- activeDrag: null,
991
- layout: (0, _utils$2.synchronizeLayoutWithChildren)(
992
- _this.props.layout,
993
- _this.props.children,
994
- _this.props.cols,
995
- (0, _utils$2.compactType)(_this.props),
996
- _this.props.allowOverlap
997
- ),
998
- mounted: false,
999
- oldDragItem: null,
1000
- oldLayout: null,
1001
- oldResizeItem: null,
1002
- droppingDOMNode: null,
1003
- children: []
1004
- });
1005
- _defineProperty$2(_assertThisInitialized$2(_this), "dragEnterCounter", 0);
1006
- _defineProperty$2(_assertThisInitialized$2(_this), "onDragStart", function(i, x, y, _ref) {
1007
- var e = _ref.e, node = _ref.node;
1008
- var layout2 = _this.state.layout;
1009
- var l = (0, _utils$2.getLayoutItem)(layout2, i);
1010
- if (!l)
1011
- return;
1012
- _this.setState({
1013
- oldDragItem: (0, _utils$2.cloneLayoutItem)(l),
1014
- oldLayout: layout2
1015
- });
1016
- return _this.props.onDragStart(layout2, l, l, null, e, node);
1017
- });
1018
- _defineProperty$2(_assertThisInitialized$2(_this), "onDrag", function(i, x, y, _ref2) {
1019
- var e = _ref2.e, node = _ref2.node;
1020
- var oldDragItem = _this.state.oldDragItem;
1021
- var layout2 = _this.state.layout;
1022
- var _this$props = _this.props, cols = _this$props.cols, allowOverlap = _this$props.allowOverlap, preventCollision = _this$props.preventCollision;
1023
- var l = (0, _utils$2.getLayoutItem)(layout2, i);
1024
- if (!l)
1025
- return;
1026
- var placeholder = {
1027
- w: l.w,
1028
- h: l.h,
1029
- x: l.x,
1030
- y: l.y,
1031
- placeholder: true,
1032
- i
1033
- };
1034
- var isUserAction = true;
1035
- layout2 = (0, _utils$2.moveElement)(layout2, l, x, y, isUserAction, preventCollision, (0, _utils$2.compactType)(_this.props), cols, allowOverlap);
1036
- _this.props.onDrag(layout2, oldDragItem, l, placeholder, e, node);
1037
- _this.setState({
1038
- layout: allowOverlap ? layout2 : (0, _utils$2.compact)(layout2, (0, _utils$2.compactType)(_this.props), cols),
1039
- activeDrag: placeholder
1040
- });
1041
- });
1042
- _defineProperty$2(_assertThisInitialized$2(_this), "onDragStop", function(i, x, y, _ref3) {
1043
- var e = _ref3.e, node = _ref3.node;
1044
- if (!_this.state.activeDrag)
1045
- return;
1046
- var oldDragItem = _this.state.oldDragItem;
1047
- var layout2 = _this.state.layout;
1048
- var _this$props2 = _this.props, cols = _this$props2.cols, preventCollision = _this$props2.preventCollision, allowOverlap = _this$props2.allowOverlap;
1049
- var l = (0, _utils$2.getLayoutItem)(layout2, i);
1050
- if (!l)
1051
- return;
1052
- var isUserAction = true;
1053
- layout2 = (0, _utils$2.moveElement)(layout2, l, x, y, isUserAction, preventCollision, (0, _utils$2.compactType)(_this.props), cols, allowOverlap);
1054
- _this.props.onDragStop(layout2, oldDragItem, l, null, e, node);
1055
- var newLayout = allowOverlap ? layout2 : (0, _utils$2.compact)(layout2, (0, _utils$2.compactType)(_this.props), cols);
1056
- var oldLayout = _this.state.oldLayout;
1057
- _this.setState({
1058
- activeDrag: null,
1059
- layout: newLayout,
1060
- oldDragItem: null,
1061
- oldLayout: null
1062
- });
1063
- _this.onLayoutMaybeChanged(newLayout, oldLayout);
1064
- });
1065
- _defineProperty$2(_assertThisInitialized$2(_this), "onResizeStart", function(i, w, h, _ref4) {
1066
- var e = _ref4.e, node = _ref4.node;
1067
- var layout2 = _this.state.layout;
1068
- var l = (0, _utils$2.getLayoutItem)(layout2, i);
1069
- if (!l)
1070
- return;
1071
- _this.setState({
1072
- oldResizeItem: (0, _utils$2.cloneLayoutItem)(l),
1073
- oldLayout: _this.state.layout
1074
- });
1075
- _this.props.onResizeStart(layout2, l, l, null, e, node);
1076
- });
1077
- _defineProperty$2(_assertThisInitialized$2(_this), "onResize", function(i, w, h, _ref5) {
1078
- var e = _ref5.e, node = _ref5.node;
1079
- var _this$state = _this.state, layout2 = _this$state.layout, oldResizeItem = _this$state.oldResizeItem;
1080
- var _this$props3 = _this.props, cols = _this$props3.cols, preventCollision = _this$props3.preventCollision, allowOverlap = _this$props3.allowOverlap;
1081
- var _withLayoutItem = (0, _utils$2.withLayoutItem)(layout2, i, function(l2) {
1082
- var hasCollisions;
1083
- if (preventCollision && !allowOverlap) {
1084
- var collisions = (0, _utils$2.getAllCollisions)(layout2, _objectSpread$1(_objectSpread$1({}, l2), {}, {
1085
- w,
1086
- h
1087
- })).filter(function(layoutItem) {
1088
- return layoutItem.i !== l2.i;
1089
- });
1090
- hasCollisions = collisions.length > 0;
1091
- if (hasCollisions) {
1092
- var leastX = Infinity, leastY = Infinity;
1093
- collisions.forEach(function(layoutItem) {
1094
- if (layoutItem.x > l2.x)
1095
- leastX = Math.min(leastX, layoutItem.x);
1096
- if (layoutItem.y > l2.y)
1097
- leastY = Math.min(leastY, layoutItem.y);
1098
- });
1099
- if (Number.isFinite(leastX))
1100
- l2.w = leastX - l2.x;
1101
- if (Number.isFinite(leastY))
1102
- l2.h = leastY - l2.y;
1103
- }
1104
- }
1105
- if (!hasCollisions) {
1106
- l2.w = w;
1107
- l2.h = h;
1108
- }
1109
- return l2;
1110
- }), _withLayoutItem2 = _slicedToArray(_withLayoutItem, 2), newLayout = _withLayoutItem2[0], l = _withLayoutItem2[1];
1111
- if (!l)
1112
- return;
1113
- var placeholder = {
1114
- w: l.w,
1115
- h: l.h,
1116
- x: l.x,
1117
- y: l.y,
1118
- static: true,
1119
- i
1120
- };
1121
- _this.props.onResize(newLayout, oldResizeItem, l, placeholder, e, node);
1122
- _this.setState({
1123
- layout: allowOverlap ? newLayout : (0, _utils$2.compact)(newLayout, (0, _utils$2.compactType)(_this.props), cols),
1124
- activeDrag: placeholder
1125
- });
1126
- });
1127
- _defineProperty$2(_assertThisInitialized$2(_this), "onResizeStop", function(i, w, h, _ref6) {
1128
- var e = _ref6.e, node = _ref6.node;
1129
- var _this$state2 = _this.state, layout2 = _this$state2.layout, oldResizeItem = _this$state2.oldResizeItem;
1130
- var _this$props4 = _this.props, cols = _this$props4.cols, allowOverlap = _this$props4.allowOverlap;
1131
- var l = (0, _utils$2.getLayoutItem)(layout2, i);
1132
- _this.props.onResizeStop(layout2, oldResizeItem, l, null, e, node);
1133
- var newLayout = allowOverlap ? layout2 : (0, _utils$2.compact)(layout2, (0, _utils$2.compactType)(_this.props), cols);
1134
- var oldLayout = _this.state.oldLayout;
1135
- _this.setState({
1136
- activeDrag: null,
1137
- layout: newLayout,
1138
- oldResizeItem: null,
1139
- oldLayout: null
1140
- });
1141
- _this.onLayoutMaybeChanged(newLayout, oldLayout);
1142
- });
1143
- _defineProperty$2(_assertThisInitialized$2(_this), "onDragOver", function(e) {
1144
- var _e$nativeEvent$target;
1145
- e.preventDefault();
1146
- e.stopPropagation();
1147
- if (isFirefox && !((_e$nativeEvent$target = e.nativeEvent.target) !== null && _e$nativeEvent$target !== void 0 && _e$nativeEvent$target.classList.contains(layoutClassName$1))) {
1148
- return false;
1149
- }
1150
- var _this$props5 = _this.props, droppingItem = _this$props5.droppingItem, onDropDragOver = _this$props5.onDropDragOver, margin = _this$props5.margin, cols = _this$props5.cols, rowHeight = _this$props5.rowHeight, maxRows = _this$props5.maxRows, width = _this$props5.width, containerPadding = _this$props5.containerPadding, transformScale = _this$props5.transformScale;
1151
- var onDragOverResult = onDropDragOver === null || onDropDragOver === void 0 ? void 0 : onDropDragOver(e);
1152
- if (onDragOverResult === false) {
1153
- if (_this.state.droppingDOMNode) {
1154
- _this.removeDroppingPlaceholder();
1155
- }
1156
- return false;
1157
- }
1158
- var finalDroppingItem = _objectSpread$1(_objectSpread$1({}, droppingItem), onDragOverResult);
1159
- var layout2 = _this.state.layout;
1160
- var _e$nativeEvent = e.nativeEvent, layerX = _e$nativeEvent.layerX, layerY = _e$nativeEvent.layerY;
1161
- var droppingPosition = {
1162
- left: layerX / transformScale,
1163
- top: layerY / transformScale,
1164
- e
1165
- };
1166
- if (!_this.state.droppingDOMNode) {
1167
- var positionParams = {
1168
- cols,
1169
- margin,
1170
- maxRows,
1171
- rowHeight,
1172
- containerWidth: width,
1173
- containerPadding: containerPadding || margin
1174
- };
1175
- var calculatedPosition = (0, _calculateUtils.calcXY)(positionParams, layerY, layerX, finalDroppingItem.w, finalDroppingItem.h);
1176
- _this.setState({
1177
- droppingDOMNode: /* @__PURE__ */ React$2.createElement("div", {
1178
- key: finalDroppingItem.i
1179
- }),
1180
- droppingPosition,
1181
- layout: [].concat(_toConsumableArray(layout2), [_objectSpread$1(_objectSpread$1({}, finalDroppingItem), {}, {
1182
- x: calculatedPosition.x,
1183
- y: calculatedPosition.y,
1184
- static: false,
1185
- isDraggable: true
1186
- })])
1187
- });
1188
- } else if (_this.state.droppingPosition) {
1189
- var _this$state$droppingP = _this.state.droppingPosition, left = _this$state$droppingP.left, top = _this$state$droppingP.top;
1190
- var shouldUpdatePosition = left != layerX || top != layerY;
1191
- if (shouldUpdatePosition) {
1192
- _this.setState({
1193
- droppingPosition
1194
- });
1195
- }
1196
- }
1197
- });
1198
- _defineProperty$2(_assertThisInitialized$2(_this), "removeDroppingPlaceholder", function() {
1199
- var _this$props6 = _this.props, droppingItem = _this$props6.droppingItem, cols = _this$props6.cols;
1200
- var layout2 = _this.state.layout;
1201
- var newLayout = (0, _utils$2.compact)(layout2.filter(function(l) {
1202
- return l.i !== droppingItem.i;
1203
- }), (0, _utils$2.compactType)(_this.props), cols);
1204
- _this.setState({
1205
- layout: newLayout,
1206
- droppingDOMNode: null,
1207
- activeDrag: null,
1208
- droppingPosition: void 0
1209
- });
1210
- });
1211
- _defineProperty$2(_assertThisInitialized$2(_this), "onDragLeave", function(e) {
1212
- e.preventDefault();
1213
- e.stopPropagation();
1214
- _this.dragEnterCounter--;
1215
- if (_this.dragEnterCounter === 0) {
1216
- _this.removeDroppingPlaceholder();
1217
- }
1218
- });
1219
- _defineProperty$2(_assertThisInitialized$2(_this), "onDragEnter", function(e) {
1220
- e.preventDefault();
1221
- e.stopPropagation();
1222
- _this.dragEnterCounter++;
1223
- });
1224
- _defineProperty$2(_assertThisInitialized$2(_this), "onDrop", function(e) {
1225
- e.preventDefault();
1226
- e.stopPropagation();
1227
- var droppingItem = _this.props.droppingItem;
1228
- var layout2 = _this.state.layout;
1229
- var item = layout2.find(function(l) {
1230
- return l.i === droppingItem.i;
1231
- });
1232
- _this.dragEnterCounter = 0;
1233
- _this.removeDroppingPlaceholder();
1234
- _this.props.onDrop(layout2, item, e);
1235
- });
1236
- return _this;
1237
- }
1238
- _createClass$2(ReactGridLayout2, [{
1239
- key: "componentDidMount",
1240
- value: function componentDidMount() {
1241
- this.setState({
1242
- mounted: true
1243
- });
1244
- this.onLayoutMaybeChanged(this.state.layout, this.props.layout);
1245
- }
1246
- }, {
1247
- key: "shouldComponentUpdate",
1248
- value: function shouldComponentUpdate(nextProps, nextState) {
1249
- return this.props.children !== nextProps.children || !(0, _utils$2.fastRGLPropsEqual)(this.props, nextProps, _lodash$1.default) || this.state.activeDrag !== nextState.activeDrag || this.state.mounted !== nextState.mounted || this.state.droppingPosition !== nextState.droppingPosition;
1250
- }
1251
- }, {
1252
- key: "componentDidUpdate",
1253
- value: function componentDidUpdate(prevProps, prevState) {
1254
- if (!this.state.activeDrag) {
1255
- var newLayout = this.state.layout;
1256
- var oldLayout = prevState.layout;
1257
- this.onLayoutMaybeChanged(newLayout, oldLayout);
1258
- }
1259
- }
1260
- }, {
1261
- key: "containerHeight",
1262
- value: function containerHeight() {
1263
- if (!this.props.autoSize)
1264
- return;
1265
- var nbRow = (0, _utils$2.bottom)(this.state.layout);
1266
- var containerPaddingY = this.props.containerPadding ? this.props.containerPadding[1] : this.props.margin[1];
1267
- return nbRow * this.props.rowHeight + (nbRow - 1) * this.props.margin[1] + containerPaddingY * 2 + "px";
1268
- }
1269
- }, {
1270
- key: "onLayoutMaybeChanged",
1271
- value: function onLayoutMaybeChanged(newLayout, oldLayout) {
1272
- if (!oldLayout)
1273
- oldLayout = this.state.layout;
1274
- if (!(0, _lodash$1.default)(oldLayout, newLayout)) {
1275
- this.props.onLayoutChange(newLayout);
1276
- }
1277
- }
1278
- }, {
1279
- key: "placeholder",
1280
- value: function placeholder() {
1281
- var activeDrag = this.state.activeDrag;
1282
- if (!activeDrag)
1283
- return null;
1284
- var _this$props7 = this.props, width = _this$props7.width, cols = _this$props7.cols, margin = _this$props7.margin, containerPadding = _this$props7.containerPadding, rowHeight = _this$props7.rowHeight, maxRows = _this$props7.maxRows, useCSSTransforms = _this$props7.useCSSTransforms, transformScale = _this$props7.transformScale;
1285
- return /* @__PURE__ */ React$2.createElement(_GridItem.default, {
1286
- w: activeDrag.w,
1287
- h: activeDrag.h,
1288
- x: activeDrag.x,
1289
- y: activeDrag.y,
1290
- i: activeDrag.i,
1291
- className: "react-grid-placeholder",
1292
- containerWidth: width,
1293
- cols,
1294
- margin,
1295
- containerPadding: containerPadding || margin,
1296
- maxRows,
1297
- rowHeight,
1298
- isDraggable: false,
1299
- isResizable: false,
1300
- isBounded: false,
1301
- useCSSTransforms,
1302
- transformScale
1303
- }, /* @__PURE__ */ React$2.createElement("div", null));
1304
- }
1305
- }, {
1306
- key: "processGridItem",
1307
- value: function processGridItem(child, isDroppingItem) {
1308
- if (!child || !child.key)
1309
- return;
1310
- var l = (0, _utils$2.getLayoutItem)(this.state.layout, String(child.key));
1311
- if (!l)
1312
- return null;
1313
- var _this$props8 = this.props, width = _this$props8.width, cols = _this$props8.cols, margin = _this$props8.margin, containerPadding = _this$props8.containerPadding, rowHeight = _this$props8.rowHeight, maxRows = _this$props8.maxRows, isDraggable = _this$props8.isDraggable, isResizable = _this$props8.isResizable, isBounded = _this$props8.isBounded, useCSSTransforms = _this$props8.useCSSTransforms, transformScale = _this$props8.transformScale, draggableCancel = _this$props8.draggableCancel, draggableHandle = _this$props8.draggableHandle, resizeHandles = _this$props8.resizeHandles, resizeHandle = _this$props8.resizeHandle;
1314
- var _this$state3 = this.state, mounted = _this$state3.mounted, droppingPosition = _this$state3.droppingPosition;
1315
- var draggable = typeof l.isDraggable === "boolean" ? l.isDraggable : !l.static && isDraggable;
1316
- var resizable = typeof l.isResizable === "boolean" ? l.isResizable : !l.static && isResizable;
1317
- var resizeHandlesOptions = l.resizeHandles || resizeHandles;
1318
- var bounded = draggable && isBounded && l.isBounded !== false;
1319
- return /* @__PURE__ */ React$2.createElement(_GridItem.default, {
1320
- containerWidth: width,
1321
- cols,
1322
- margin,
1323
- containerPadding: containerPadding || margin,
1324
- maxRows,
1325
- rowHeight,
1326
- cancel: draggableCancel,
1327
- handle: draggableHandle,
1328
- onDragStop: this.onDragStop,
1329
- onDragStart: this.onDragStart,
1330
- onDrag: this.onDrag,
1331
- onResizeStart: this.onResizeStart,
1332
- onResize: this.onResize,
1333
- onResizeStop: this.onResizeStop,
1334
- isDraggable: draggable,
1335
- isResizable: resizable,
1336
- isBounded: bounded,
1337
- useCSSTransforms: useCSSTransforms && mounted,
1338
- usePercentages: !mounted,
1339
- transformScale,
1340
- w: l.w,
1341
- h: l.h,
1342
- x: l.x,
1343
- y: l.y,
1344
- i: l.i,
1345
- minH: l.minH,
1346
- minW: l.minW,
1347
- maxH: l.maxH,
1348
- maxW: l.maxW,
1349
- static: l.static,
1350
- droppingPosition: isDroppingItem ? droppingPosition : void 0,
1351
- resizeHandles: resizeHandlesOptions,
1352
- resizeHandle
1353
- }, child);
1354
- }
1355
- }, {
1356
- key: "render",
1357
- value: function render() {
1358
- var _this2 = this;
1359
- var _this$props9 = this.props, className = _this$props9.className, style = _this$props9.style, isDroppable = _this$props9.isDroppable, innerRef = _this$props9.innerRef;
1360
- var mergedClassName = (0, _clsx$1.default)(layoutClassName$1, className);
1361
- var mergedStyle = _objectSpread$1({
1362
- height: this.containerHeight()
1363
- }, style);
1364
- return /* @__PURE__ */ React$2.createElement("div", {
1365
- ref: innerRef,
1366
- className: mergedClassName,
1367
- style: mergedStyle,
1368
- onDrop: isDroppable ? this.onDrop : _utils$2.noop,
1369
- onDragLeave: isDroppable ? this.onDragLeave : _utils$2.noop,
1370
- onDragEnter: isDroppable ? this.onDragEnter : _utils$2.noop,
1371
- onDragOver: isDroppable ? this.onDragOver : _utils$2.noop
1372
- }, React$2.Children.map(this.props.children, function(child) {
1373
- return _this2.processGridItem(child);
1374
- }), isDroppable && this.state.droppingDOMNode && this.processGridItem(this.state.droppingDOMNode, true), this.placeholder());
1375
- }
1376
- }], [{
1377
- key: "getDerivedStateFromProps",
1378
- value: function getDerivedStateFromProps(nextProps, prevState) {
1379
- var newLayoutBase;
1380
- if (prevState.activeDrag) {
1381
- return null;
1382
- }
1383
- if (!(0, _lodash$1.default)(nextProps.layout, prevState.propsLayout) || nextProps.compactType !== prevState.compactType) {
1384
- newLayoutBase = nextProps.layout;
1385
- } else if (!(0, _utils$2.childrenEqual)(nextProps.children, prevState.children)) {
1386
- newLayoutBase = prevState.layout;
1387
- }
1388
- if (newLayoutBase) {
1389
- var newLayout = (0, _utils$2.synchronizeLayoutWithChildren)(newLayoutBase, nextProps.children, nextProps.cols, (0, _utils$2.compactType)(nextProps), nextProps.allowOverlap);
1390
- return {
1391
- layout: newLayout,
1392
- compactType: nextProps.compactType,
1393
- children: nextProps.children,
1394
- propsLayout: nextProps.layout
1395
- };
1396
- }
1397
- return null;
1398
- }
1399
- }]);
1400
- return ReactGridLayout2;
1401
- }(React$2.Component);
1402
- ReactGridLayout$1.default = ReactGridLayout;
1403
- _defineProperty$2(ReactGridLayout, "displayName", "ReactGridLayout");
1404
- _defineProperty$2(ReactGridLayout, "propTypes", _ReactGridLayoutPropTypes.default);
1405
- _defineProperty$2(ReactGridLayout, "defaultProps", {
1406
- autoSize: true,
1407
- cols: 12,
1408
- className: "",
1409
- style: {},
1410
- draggableHandle: "",
1411
- draggableCancel: "",
1412
- containerPadding: null,
1413
- rowHeight: 150,
1414
- maxRows: Infinity,
1415
- layout: [],
1416
- margin: [10, 10],
1417
- isBounded: false,
1418
- isDraggable: true,
1419
- isResizable: true,
1420
- allowOverlap: false,
1421
- isDroppable: false,
1422
- useCSSTransforms: true,
1423
- transformScale: 1,
1424
- verticalCompact: true,
1425
- compactType: "vertical",
1426
- preventCollision: false,
1427
- droppingItem: {
1428
- i: "__dropping-elem__",
1429
- h: 1,
1430
- w: 1
1431
- },
1432
- resizeHandles: ["se"],
1433
- onLayoutChange: _utils$2.noop,
1434
- onDragStart: _utils$2.noop,
1435
- onDrag: _utils$2.noop,
1436
- onDragStop: _utils$2.noop,
1437
- onResizeStart: _utils$2.noop,
1438
- onResize: _utils$2.noop,
1439
- onResizeStop: _utils$2.noop,
1440
- onDrop: _utils$2.noop,
1441
- onDropDragOver: _utils$2.noop
1442
- });
1443
- var ResponsiveReactGridLayout$1 = {};
1444
- var responsiveUtils = {};
1445
- Object.defineProperty(responsiveUtils, "__esModule", {
1446
- value: true
1447
- });
1448
- responsiveUtils.findOrGenerateResponsiveLayout = findOrGenerateResponsiveLayout;
1449
- responsiveUtils.getBreakpointFromWidth = getBreakpointFromWidth;
1450
- responsiveUtils.getColsFromBreakpoint = getColsFromBreakpoint;
1451
- responsiveUtils.sortBreakpoints = sortBreakpoints;
1452
- var _utils$1 = utils;
1453
- function getBreakpointFromWidth(breakpoints, width) {
1454
- var sorted = sortBreakpoints(breakpoints);
1455
- var matching = sorted[0];
1456
- for (var i = 1, len = sorted.length; i < len; i++) {
1457
- var breakpointName = sorted[i];
1458
- if (width > breakpoints[breakpointName])
1459
- matching = breakpointName;
1460
- }
1461
- return matching;
1462
- }
1463
- function getColsFromBreakpoint(breakpoint, cols) {
1464
- if (!cols[breakpoint]) {
1465
- throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint " + breakpoint + " is missing!");
1466
- }
1467
- return cols[breakpoint];
1468
- }
1469
- function findOrGenerateResponsiveLayout(layouts2, breakpoints, breakpoint, lastBreakpoint, cols, compactType) {
1470
- if (layouts2[breakpoint])
1471
- return (0, _utils$1.cloneLayout)(layouts2[breakpoint]);
1472
- var layout2 = layouts2[lastBreakpoint];
1473
- var breakpointsSorted = sortBreakpoints(breakpoints);
1474
- var breakpointsAbove = breakpointsSorted.slice(breakpointsSorted.indexOf(breakpoint));
1475
- for (var i = 0, len = breakpointsAbove.length; i < len; i++) {
1476
- var b = breakpointsAbove[i];
1477
- if (layouts2[b]) {
1478
- layout2 = layouts2[b];
1479
- break;
1480
- }
1481
- }
1482
- layout2 = (0, _utils$1.cloneLayout)(layout2 || []);
1483
- return (0, _utils$1.compact)((0, _utils$1.correctBounds)(layout2, {
1484
- cols
1485
- }), compactType, cols);
1486
- }
1487
- function sortBreakpoints(breakpoints) {
1488
- var keys = Object.keys(breakpoints);
1489
- return keys.sort(function(a, b) {
1490
- return breakpoints[a] - breakpoints[b];
1491
- });
1492
- }
1493
- function _typeof$1(obj) {
1494
- "@babel/helpers - typeof";
1495
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
1496
- return typeof obj2;
1497
- } : function(obj2) {
1498
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
1499
- }, _typeof$1(obj);
1500
- }
1501
- Object.defineProperty(ResponsiveReactGridLayout$1, "__esModule", {
1502
- value: true
1503
- });
1504
- ResponsiveReactGridLayout$1.default = void 0;
1505
- var React$1 = _interopRequireWildcard$1(React__default);
1506
- var _propTypes$1 = _interopRequireDefault$1(require$$1);
1507
- var _lodash = _interopRequireDefault$1(require$$0);
1508
- var _utils = utils;
1509
- var _responsiveUtils = responsiveUtils;
1510
- var _ReactGridLayout = _interopRequireDefault$1(ReactGridLayout$1);
1511
- var _excluded$1 = ["breakpoint", "breakpoints", "cols", "layouts", "margin", "containerPadding", "onBreakpointChange", "onLayoutChange", "onWidthChange"];
1512
- function _interopRequireDefault$1(obj) {
1513
- return obj && obj.__esModule ? obj : { default: obj };
1514
- }
1515
- function _getRequireWildcardCache$1(nodeInterop) {
1516
- if (typeof WeakMap !== "function")
1517
- return null;
1518
- var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
1519
- var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
1520
- return (_getRequireWildcardCache$1 = function _getRequireWildcardCache2(nodeInterop2) {
1521
- return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
1522
- })(nodeInterop);
1523
- }
1524
- function _interopRequireWildcard$1(obj, nodeInterop) {
1525
- if (!nodeInterop && obj && obj.__esModule) {
1526
- return obj;
1527
- }
1528
- if (obj === null || _typeof$1(obj) !== "object" && typeof obj !== "function") {
1529
- return { default: obj };
1530
- }
1531
- var cache = _getRequireWildcardCache$1(nodeInterop);
1532
- if (cache && cache.has(obj)) {
1533
- return cache.get(obj);
1534
- }
1535
- var newObj = {};
1536
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
1537
- for (var key in obj) {
1538
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
1539
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
1540
- if (desc && (desc.get || desc.set)) {
1541
- Object.defineProperty(newObj, key, desc);
1542
- } else {
1543
- newObj[key] = obj[key];
1544
- }
1545
- }
1546
- }
1547
- newObj.default = obj;
1548
- if (cache) {
1549
- cache.set(obj, newObj);
1550
- }
1551
- return newObj;
1552
- }
1553
- function _extends$1() {
1554
- _extends$1 = Object.assign || function(target) {
1555
- for (var i = 1; i < arguments.length; i++) {
1556
- var source = arguments[i];
1557
- for (var key in source) {
1558
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1559
- target[key] = source[key];
1560
- }
1561
- }
1562
- }
1563
- return target;
1564
- };
1565
- return _extends$1.apply(this, arguments);
1566
- }
1567
- function _objectWithoutProperties$1(source, excluded) {
1568
- if (source == null)
1569
- return {};
1570
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
1571
- var key, i;
1572
- if (Object.getOwnPropertySymbols) {
1573
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1574
- for (i = 0; i < sourceSymbolKeys.length; i++) {
1575
- key = sourceSymbolKeys[i];
1576
- if (excluded.indexOf(key) >= 0)
1577
- continue;
1578
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
1579
- continue;
1580
- target[key] = source[key];
1581
- }
1582
- }
1583
- return target;
1584
- }
1585
- function _objectWithoutPropertiesLoose$1(source, excluded) {
1586
- if (source == null)
1587
- return {};
1588
- var target = {};
1589
- var sourceKeys = Object.keys(source);
1590
- var key, i;
1591
- for (i = 0; i < sourceKeys.length; i++) {
1592
- key = sourceKeys[i];
1593
- if (excluded.indexOf(key) >= 0)
1594
- continue;
1595
- target[key] = source[key];
1596
- }
1597
- return target;
1598
- }
1599
- function ownKeys(object, enumerableOnly) {
1600
- var keys = Object.keys(object);
1601
- if (Object.getOwnPropertySymbols) {
1602
- var symbols = Object.getOwnPropertySymbols(object);
1603
- enumerableOnly && (symbols = symbols.filter(function(sym) {
1604
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1605
- })), keys.push.apply(keys, symbols);
1606
- }
1607
- return keys;
1608
- }
1609
- function _objectSpread(target) {
1610
- for (var i = 1; i < arguments.length; i++) {
1611
- var source = null != arguments[i] ? arguments[i] : {};
1612
- i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
1613
- _defineProperty$1(target, key, source[key]);
1614
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
1615
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1616
- });
1617
- }
1618
- return target;
1619
- }
1620
- function _classCallCheck$1(instance, Constructor) {
1621
- if (!(instance instanceof Constructor)) {
1622
- throw new TypeError("Cannot call a class as a function");
1623
- }
1624
- }
1625
- function _defineProperties$1(target, props) {
1626
- for (var i = 0; i < props.length; i++) {
1627
- var descriptor = props[i];
1628
- descriptor.enumerable = descriptor.enumerable || false;
1629
- descriptor.configurable = true;
1630
- if ("value" in descriptor)
1631
- descriptor.writable = true;
1632
- Object.defineProperty(target, descriptor.key, descriptor);
1633
- }
1634
- }
1635
- function _createClass$1(Constructor, protoProps, staticProps) {
1636
- if (protoProps)
1637
- _defineProperties$1(Constructor.prototype, protoProps);
1638
- if (staticProps)
1639
- _defineProperties$1(Constructor, staticProps);
1640
- Object.defineProperty(Constructor, "prototype", { writable: false });
1641
- return Constructor;
1642
- }
1643
- function _inherits$1(subClass, superClass) {
1644
- if (typeof superClass !== "function" && superClass !== null) {
1645
- throw new TypeError("Super expression must either be null or a function");
1646
- }
1647
- subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
1648
- Object.defineProperty(subClass, "prototype", { writable: false });
1649
- if (superClass)
1650
- _setPrototypeOf$1(subClass, superClass);
1651
- }
1652
- function _setPrototypeOf$1(o, p) {
1653
- _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
1654
- o2.__proto__ = p2;
1655
- return o2;
1656
- };
1657
- return _setPrototypeOf$1(o, p);
1658
- }
1659
- function _createSuper$1(Derived) {
1660
- var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
1661
- return function _createSuperInternal() {
1662
- var Super = _getPrototypeOf$1(Derived), result;
1663
- if (hasNativeReflectConstruct) {
1664
- var NewTarget = _getPrototypeOf$1(this).constructor;
1665
- result = Reflect.construct(Super, arguments, NewTarget);
1666
- } else {
1667
- result = Super.apply(this, arguments);
1668
- }
1669
- return _possibleConstructorReturn$1(this, result);
1670
- };
1671
- }
1672
- function _possibleConstructorReturn$1(self, call) {
1673
- if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
1674
- return call;
1675
- } else if (call !== void 0) {
1676
- throw new TypeError("Derived constructors may only return object or undefined");
1677
- }
1678
- return _assertThisInitialized$1(self);
1679
- }
1680
- function _assertThisInitialized$1(self) {
1681
- if (self === void 0) {
1682
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1683
- }
1684
- return self;
1685
- }
1686
- function _isNativeReflectConstruct$1() {
1687
- if (typeof Reflect === "undefined" || !Reflect.construct)
1688
- return false;
1689
- if (Reflect.construct.sham)
1690
- return false;
1691
- if (typeof Proxy === "function")
1692
- return true;
1693
- try {
1694
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
1695
- }));
1696
- return true;
1697
- } catch (e) {
1698
- return false;
1699
- }
1700
- }
1701
- function _getPrototypeOf$1(o) {
1702
- _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
1703
- return o2.__proto__ || Object.getPrototypeOf(o2);
1704
- };
1705
- return _getPrototypeOf$1(o);
1706
- }
1707
- function _defineProperty$1(obj, key, value) {
1708
- if (key in obj) {
1709
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1710
- } else {
1711
- obj[key] = value;
1712
- }
1713
- return obj;
1714
- }
1715
- var type = function type2(obj) {
1716
- return Object.prototype.toString.call(obj);
1717
- };
1718
- function getIndentationValue(param, breakpoint) {
1719
- if (param == null)
1720
- return null;
1721
- return Array.isArray(param) ? param : param[breakpoint];
1722
- }
1723
- var ResponsiveReactGridLayout = /* @__PURE__ */ function(_React$Component) {
1724
- _inherits$1(ResponsiveReactGridLayout2, _React$Component);
1725
- var _super = _createSuper$1(ResponsiveReactGridLayout2);
1726
- function ResponsiveReactGridLayout2() {
1727
- var _this;
1728
- _classCallCheck$1(this, ResponsiveReactGridLayout2);
1729
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1730
- args[_key] = arguments[_key];
1731
- }
1732
- _this = _super.call.apply(_super, [this].concat(args));
1733
- _defineProperty$1(_assertThisInitialized$1(_this), "state", _this.generateInitialState());
1734
- _defineProperty$1(_assertThisInitialized$1(_this), "onLayoutChange", function(layout2) {
1735
- _this.props.onLayoutChange(layout2, _objectSpread(_objectSpread({}, _this.props.layouts), {}, _defineProperty$1({}, _this.state.breakpoint, layout2)));
1736
- });
1737
- return _this;
1738
- }
1739
- _createClass$1(ResponsiveReactGridLayout2, [{
1740
- key: "generateInitialState",
1741
- value: function generateInitialState() {
1742
- var _this$props = this.props, width = _this$props.width, breakpoints = _this$props.breakpoints, layouts2 = _this$props.layouts, cols = _this$props.cols;
1743
- var breakpoint = (0, _responsiveUtils.getBreakpointFromWidth)(breakpoints, width);
1744
- var colNo = (0, _responsiveUtils.getColsFromBreakpoint)(breakpoint, cols);
1745
- var compactType = this.props.verticalCompact === false ? null : this.props.compactType;
1746
- var initialLayout = (0, _responsiveUtils.findOrGenerateResponsiveLayout)(layouts2, breakpoints, breakpoint, breakpoint, colNo, compactType);
1747
- return {
1748
- layout: initialLayout,
1749
- breakpoint,
1750
- cols: colNo
1751
- };
1752
- }
1753
- }, {
1754
- key: "componentDidUpdate",
1755
- value: function componentDidUpdate(prevProps) {
1756
- if (this.props.width != prevProps.width || this.props.breakpoint !== prevProps.breakpoint || !(0, _lodash.default)(this.props.breakpoints, prevProps.breakpoints) || !(0, _lodash.default)(this.props.cols, prevProps.cols)) {
1757
- this.onWidthChange(prevProps);
1758
- }
1759
- }
1760
- }, {
1761
- key: "onWidthChange",
1762
- value: function onWidthChange(prevProps) {
1763
- var _this$props2 = this.props, breakpoints = _this$props2.breakpoints, cols = _this$props2.cols, layouts2 = _this$props2.layouts, compactType = _this$props2.compactType;
1764
- var newBreakpoint = this.props.breakpoint || (0, _responsiveUtils.getBreakpointFromWidth)(this.props.breakpoints, this.props.width);
1765
- var lastBreakpoint = this.state.breakpoint;
1766
- var newCols = (0, _responsiveUtils.getColsFromBreakpoint)(newBreakpoint, cols);
1767
- var newLayouts = _objectSpread({}, layouts2);
1768
- if (lastBreakpoint !== newBreakpoint || prevProps.breakpoints !== breakpoints || prevProps.cols !== cols) {
1769
- if (!(lastBreakpoint in newLayouts))
1770
- newLayouts[lastBreakpoint] = (0, _utils.cloneLayout)(this.state.layout);
1771
- var layout2 = (0, _responsiveUtils.findOrGenerateResponsiveLayout)(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType);
1772
- layout2 = (0, _utils.synchronizeLayoutWithChildren)(layout2, this.props.children, newCols, compactType, this.props.allowOverlap);
1773
- newLayouts[newBreakpoint] = layout2;
1774
- this.props.onLayoutChange(layout2, newLayouts);
1775
- this.props.onBreakpointChange(newBreakpoint, newCols);
1776
- this.setState({
1777
- breakpoint: newBreakpoint,
1778
- layout: layout2,
1779
- cols: newCols
1780
- });
1781
- }
1782
- var margin = getIndentationValue(this.props.margin, newBreakpoint);
1783
- var containerPadding = getIndentationValue(this.props.containerPadding, newBreakpoint);
1784
- this.props.onWidthChange(this.props.width, margin, newCols, containerPadding);
1785
- }
1786
- }, {
1787
- key: "render",
1788
- value: function render() {
1789
- var _this$props3 = this.props;
1790
- _this$props3.breakpoint;
1791
- _this$props3.breakpoints;
1792
- _this$props3.cols;
1793
- _this$props3.layouts;
1794
- var margin = _this$props3.margin, containerPadding = _this$props3.containerPadding;
1795
- _this$props3.onBreakpointChange;
1796
- _this$props3.onLayoutChange;
1797
- _this$props3.onWidthChange;
1798
- var other = _objectWithoutProperties$1(_this$props3, _excluded$1);
1799
- return /* @__PURE__ */ React$1.createElement(_ReactGridLayout.default, _extends$1({}, other, {
1800
- margin: getIndentationValue(margin, this.state.breakpoint),
1801
- containerPadding: getIndentationValue(containerPadding, this.state.breakpoint),
1802
- onLayoutChange: this.onLayoutChange,
1803
- layout: this.state.layout,
1804
- cols: this.state.cols
1805
- }));
1806
- }
1807
- }], [{
1808
- key: "getDerivedStateFromProps",
1809
- value: function getDerivedStateFromProps(nextProps, prevState) {
1810
- if (!(0, _lodash.default)(nextProps.layouts, prevState.layouts)) {
1811
- var breakpoint = prevState.breakpoint, _cols = prevState.cols;
1812
- var newLayout = (0, _responsiveUtils.findOrGenerateResponsiveLayout)(nextProps.layouts, nextProps.breakpoints, breakpoint, breakpoint, _cols, nextProps.compactType);
1813
- return {
1814
- layout: newLayout,
1815
- layouts: nextProps.layouts
1816
- };
1817
- }
1818
- return null;
1819
- }
1820
- }]);
1821
- return ResponsiveReactGridLayout2;
1822
- }(React$1.Component);
1823
- ResponsiveReactGridLayout$1.default = ResponsiveReactGridLayout;
1824
- _defineProperty$1(ResponsiveReactGridLayout, "propTypes", {
1825
- breakpoint: _propTypes$1.default.string,
1826
- breakpoints: _propTypes$1.default.object,
1827
- allowOverlap: _propTypes$1.default.bool,
1828
- cols: _propTypes$1.default.object,
1829
- margin: _propTypes$1.default.oneOfType([_propTypes$1.default.array, _propTypes$1.default.object]),
1830
- containerPadding: _propTypes$1.default.oneOfType([_propTypes$1.default.array, _propTypes$1.default.object]),
1831
- layouts: function layouts(props, propName) {
1832
- if (type(props[propName]) !== "[object Object]") {
1833
- throw new Error("Layout property must be an object. Received: " + type(props[propName]));
1834
- }
1835
- Object.keys(props[propName]).forEach(function(key) {
1836
- if (!(key in props.breakpoints)) {
1837
- throw new Error("Each key in layouts must align with a key in breakpoints.");
1838
- }
1839
- (0, _utils.validateLayout)(props.layouts[key], "layouts." + key);
1840
- });
1841
- },
1842
- width: _propTypes$1.default.number.isRequired,
1843
- onBreakpointChange: _propTypes$1.default.func,
1844
- onLayoutChange: _propTypes$1.default.func,
1845
- onWidthChange: _propTypes$1.default.func
1846
- });
1847
- _defineProperty$1(ResponsiveReactGridLayout, "defaultProps", {
1848
- breakpoints: {
1849
- lg: 1200,
1850
- md: 996,
1851
- sm: 768,
1852
- xs: 480,
1853
- xxs: 0
1854
- },
1855
- cols: {
1856
- lg: 12,
1857
- md: 10,
1858
- sm: 6,
1859
- xs: 4,
1860
- xxs: 2
1861
- },
1862
- containerPadding: {
1863
- lg: null,
1864
- md: null,
1865
- sm: null,
1866
- xs: null,
1867
- xxs: null
1868
- },
1869
- layouts: {},
1870
- margin: [10, 10],
1871
- allowOverlap: false,
1872
- onBreakpointChange: _utils.noop,
1873
- onLayoutChange: _utils.noop,
1874
- onWidthChange: _utils.noop
1875
- });
1876
- var WidthProvider = {};
1877
- function _typeof(obj) {
1878
- "@babel/helpers - typeof";
1879
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
1880
- return typeof obj2;
1881
- } : function(obj2) {
1882
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
1883
- }, _typeof(obj);
1884
- }
1885
- Object.defineProperty(WidthProvider, "__esModule", {
1886
- value: true
1887
- });
1888
- WidthProvider.default = WidthProvideRGL;
1889
- var React = _interopRequireWildcard(React__default);
1890
- var _propTypes = _interopRequireDefault(require$$1);
1891
- var _clsx = _interopRequireDefault(clsx);
1892
- var _excluded = ["measureBeforeMount"];
1893
- function _interopRequireDefault(obj) {
1894
- return obj && obj.__esModule ? obj : { default: obj };
1895
- }
1896
- function _getRequireWildcardCache(nodeInterop) {
1897
- if (typeof WeakMap !== "function")
1898
- return null;
1899
- var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
1900
- var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
1901
- return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
1902
- return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
1903
- })(nodeInterop);
1904
- }
1905
- function _interopRequireWildcard(obj, nodeInterop) {
1906
- if (!nodeInterop && obj && obj.__esModule) {
1907
- return obj;
1908
- }
1909
- if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
1910
- return { default: obj };
1911
- }
1912
- var cache = _getRequireWildcardCache(nodeInterop);
1913
- if (cache && cache.has(obj)) {
1914
- return cache.get(obj);
1915
- }
1916
- var newObj = {};
1917
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
1918
- for (var key in obj) {
1919
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
1920
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
1921
- if (desc && (desc.get || desc.set)) {
1922
- Object.defineProperty(newObj, key, desc);
1923
- } else {
1924
- newObj[key] = obj[key];
1925
- }
1926
- }
1927
- }
1928
- newObj.default = obj;
1929
- if (cache) {
1930
- cache.set(obj, newObj);
1931
- }
1932
- return newObj;
1933
- }
1934
- function _extends() {
1935
- _extends = Object.assign || function(target) {
1936
- for (var i = 1; i < arguments.length; i++) {
1937
- var source = arguments[i];
1938
- for (var key in source) {
1939
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1940
- target[key] = source[key];
1941
- }
1942
- }
1943
- }
1944
- return target;
1945
- };
1946
- return _extends.apply(this, arguments);
1947
- }
1948
- function _objectWithoutProperties(source, excluded) {
1949
- if (source == null)
1950
- return {};
1951
- var target = _objectWithoutPropertiesLoose(source, excluded);
1952
- var key, i;
1953
- if (Object.getOwnPropertySymbols) {
1954
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1955
- for (i = 0; i < sourceSymbolKeys.length; i++) {
1956
- key = sourceSymbolKeys[i];
1957
- if (excluded.indexOf(key) >= 0)
1958
- continue;
1959
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
1960
- continue;
1961
- target[key] = source[key];
1962
- }
1963
- }
1964
- return target;
1965
- }
1966
- function _objectWithoutPropertiesLoose(source, excluded) {
1967
- if (source == null)
1968
- return {};
1969
- var target = {};
1970
- var sourceKeys = Object.keys(source);
1971
- var key, i;
1972
- for (i = 0; i < sourceKeys.length; i++) {
1973
- key = sourceKeys[i];
1974
- if (excluded.indexOf(key) >= 0)
1975
- continue;
1976
- target[key] = source[key];
1977
- }
1978
- return target;
1979
- }
1980
- function _classCallCheck(instance, Constructor) {
1981
- if (!(instance instanceof Constructor)) {
1982
- throw new TypeError("Cannot call a class as a function");
1983
- }
1984
- }
1985
- function _defineProperties(target, props) {
1986
- for (var i = 0; i < props.length; i++) {
1987
- var descriptor = props[i];
1988
- descriptor.enumerable = descriptor.enumerable || false;
1989
- descriptor.configurable = true;
1990
- if ("value" in descriptor)
1991
- descriptor.writable = true;
1992
- Object.defineProperty(target, descriptor.key, descriptor);
1993
- }
1994
- }
1995
- function _createClass(Constructor, protoProps, staticProps) {
1996
- if (protoProps)
1997
- _defineProperties(Constructor.prototype, protoProps);
1998
- if (staticProps)
1999
- _defineProperties(Constructor, staticProps);
2000
- Object.defineProperty(Constructor, "prototype", { writable: false });
2001
- return Constructor;
2002
- }
2003
- function _inherits(subClass, superClass) {
2004
- if (typeof superClass !== "function" && superClass !== null) {
2005
- throw new TypeError("Super expression must either be null or a function");
2006
- }
2007
- subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
2008
- Object.defineProperty(subClass, "prototype", { writable: false });
2009
- if (superClass)
2010
- _setPrototypeOf(subClass, superClass);
2011
- }
2012
- function _setPrototypeOf(o, p) {
2013
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
2014
- o2.__proto__ = p2;
2015
- return o2;
2016
- };
2017
- return _setPrototypeOf(o, p);
2018
- }
2019
- function _createSuper(Derived) {
2020
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
2021
- return function _createSuperInternal() {
2022
- var Super = _getPrototypeOf(Derived), result;
2023
- if (hasNativeReflectConstruct) {
2024
- var NewTarget = _getPrototypeOf(this).constructor;
2025
- result = Reflect.construct(Super, arguments, NewTarget);
2026
- } else {
2027
- result = Super.apply(this, arguments);
2028
- }
2029
- return _possibleConstructorReturn(this, result);
2030
- };
2031
- }
2032
- function _possibleConstructorReturn(self, call) {
2033
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
2034
- return call;
2035
- } else if (call !== void 0) {
2036
- throw new TypeError("Derived constructors may only return object or undefined");
2037
- }
2038
- return _assertThisInitialized(self);
2039
- }
2040
- function _assertThisInitialized(self) {
2041
- if (self === void 0) {
2042
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2043
- }
2044
- return self;
2045
- }
2046
- function _isNativeReflectConstruct() {
2047
- if (typeof Reflect === "undefined" || !Reflect.construct)
2048
- return false;
2049
- if (Reflect.construct.sham)
2050
- return false;
2051
- if (typeof Proxy === "function")
2052
- return true;
2053
- try {
2054
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2055
- }));
2056
- return true;
2057
- } catch (e) {
2058
- return false;
2059
- }
2060
- }
2061
- function _getPrototypeOf(o) {
2062
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
2063
- return o2.__proto__ || Object.getPrototypeOf(o2);
2064
- };
2065
- return _getPrototypeOf(o);
2066
- }
2067
- function _defineProperty(obj, key, value) {
2068
- if (key in obj) {
2069
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
2070
- } else {
2071
- obj[key] = value;
2072
- }
2073
- return obj;
2074
- }
2075
- var layoutClassName = "react-grid-layout";
2076
- function WidthProvideRGL(ComposedComponent) {
2077
- var _class;
2078
- return _class = /* @__PURE__ */ function(_React$Component) {
2079
- _inherits(WidthProvider2, _React$Component);
2080
- var _super = _createSuper(WidthProvider2);
2081
- function WidthProvider2() {
2082
- var _this;
2083
- _classCallCheck(this, WidthProvider2);
2084
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2085
- args[_key] = arguments[_key];
2086
- }
2087
- _this = _super.call.apply(_super, [this].concat(args));
2088
- _defineProperty(_assertThisInitialized(_this), "state", {
2089
- width: 1280
2090
- });
2091
- _defineProperty(_assertThisInitialized(_this), "elementRef", /* @__PURE__ */ React.createRef());
2092
- _defineProperty(_assertThisInitialized(_this), "mounted", false);
2093
- _defineProperty(_assertThisInitialized(_this), "onWindowResize", function() {
2094
- if (!_this.mounted)
2095
- return;
2096
- var node = _this.elementRef.current;
2097
- if (node instanceof HTMLElement && node.offsetWidth) {
2098
- _this.setState({
2099
- width: node.offsetWidth
2100
- });
2101
- }
2102
- });
2103
- return _this;
2104
- }
2105
- _createClass(WidthProvider2, [{
2106
- key: "componentDidMount",
2107
- value: function componentDidMount() {
2108
- this.mounted = true;
2109
- window.addEventListener("resize", this.onWindowResize);
2110
- this.onWindowResize();
2111
- }
2112
- }, {
2113
- key: "componentWillUnmount",
2114
- value: function componentWillUnmount() {
2115
- this.mounted = false;
2116
- window.removeEventListener("resize", this.onWindowResize);
2117
- }
2118
- }, {
2119
- key: "render",
2120
- value: function render() {
2121
- var _this$props = this.props, measureBeforeMount = _this$props.measureBeforeMount, rest = _objectWithoutProperties(_this$props, _excluded);
2122
- if (measureBeforeMount && !this.mounted) {
2123
- return /* @__PURE__ */ React.createElement("div", {
2124
- className: (0, _clsx.default)(this.props.className, layoutClassName),
2125
- style: this.props.style,
2126
- ref: this.elementRef
2127
- });
2128
- }
2129
- return /* @__PURE__ */ React.createElement(ComposedComponent, _extends({
2130
- innerRef: this.elementRef
2131
- }, rest, this.state));
2132
- }
2133
- }]);
2134
- return WidthProvider2;
2135
- }(React.Component), _defineProperty(_class, "defaultProps", {
2136
- measureBeforeMount: false
2137
- }), _defineProperty(_class, "propTypes", {
2138
- measureBeforeMount: _propTypes.default.bool
2139
- }), _class;
2140
- }
2141
- (function(module) {
2142
- module.exports = ReactGridLayout$1.default;
2143
- module.exports.utils = utils;
2144
- module.exports.Responsive = ResponsiveReactGridLayout$1.default;
2145
- module.exports.Responsive.utils = responsiveUtils;
2146
- module.exports.WidthProvider = WidthProvider.default;
2147
- })(reactGridLayout);
2148
- const styles = "";
2149
- export {
2150
- createAnimation as c,
2151
- fastRGLPropsEqual as f,
2152
- parseLengthAndUnit as p,
2153
- reactGridLayout as r
2154
- };