@m4l/components 3.1.7 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +183 -340
- package/node_modules-CQtkw0uG.js +7350 -0
- package/package.json +1 -1
- package/vendor-AfIOyqRr.js +24636 -0
- package/components/AccountPopover/index-Dm2-k-Mv.js +0 -334
- package/components/AppBar/index-i0rhG3J1.js +0 -93
- package/components/BaseModule/index-CiNNlxzS.js +0 -30
- package/components/CommonActions/components/ActionCancel/index-CIdpDXkr.js +0 -12
- package/components/CommonActions/components/ActionFormCancel/index-CpyASN3q.js +0 -56
- package/components/CommonActions/components/ActionFormIntro/index-7KKtcUra.js +0 -33
- package/components/CommonActions/components/ActionIntro/index-CqqDZZcG.js +0 -25
- package/components/CommonActions/components/Actions/index-CuG1pnXW.js +0 -70
- package/components/DataGrid/constants-8L7QgBKi.js +0 -10
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index-CveSCbq_.js +0 -26
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index-CHqvieM2.js +0 -22
- package/components/DataGrid/formatters/ColumnDateFormatter/index-CKg8CJ6A.js +0 -19
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index-DE6bwaKP.js +0 -23
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index-BslXGK-A.js +0 -14
- package/components/DataGrid/formatters/ColumnPointsFormatter/index-BXGW2CsK.js +0 -10
- package/components/DataGrid/formatters/ColumnPriceFormatter/index-O11tBykn.js +0 -10
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index-BaCawLr1.js +0 -36
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index-Cq7a-jnE.js +0 -10
- package/components/DataGrid/formatters/index-CrZXPa0e.js +0 -13
- package/components/DataGrid/index-BZ-lbmuU.js +0 -908
- package/components/DataGrid/subcomponents/Actions/index-CHvPZ4Ru.js +0 -549
- package/components/DataGrid/subcomponents/editors/TextEditor/index-BIFm8akr.js +0 -80
- package/components/DragResizeWindow/index-D2jLYExo.js +0 -505
- package/components/DynamicFilter/constants-ByqmFATV.js +0 -31
- package/components/DynamicFilter/dictionary-PrbXU3VZ.js +0 -51
- package/components/DynamicFilter/index-DZiJc9h7.js +0 -116
- package/components/DynamicFilter/slots/SlotsEnum-cawFeNzx.js +0 -34
- package/components/DynamicFilter/slots/dynamicFilterSlots-DHxelhXP.js +0 -151
- package/components/DynamicFilter/slots/index-l0sNRNKZ.js +0 -1
- package/components/DynamicFilter/store/index-BT-eWVnJ.js +0 -254
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/index-B32bAzi-.js +0 -60
- package/components/DynamicFilter/subcomponents/AppliedFilters/index-Bha19drV.js +0 -26
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/index-BmvzoHit.js +0 -40
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index-BcO3SlP5.js +0 -129
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index-BCJhpNS8.js +0 -171
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index-DCNhz68u.js +0 -153
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index-BdypjM1Y.js +0 -146
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index-D-NFIVnK.js +0 -114
- package/components/DynamicFilter/subcomponents/FieldTypes/index-BwQHJqk9.js +0 -38
- package/components/DynamicFilter/subcomponents/FilterActions/index-B9UWmk07.js +0 -88
- package/components/DynamicFilter/subcomponents/InputFilter/index-CfGb1TfV.js +0 -188
- package/components/DynamicFilter/subcomponents/PopoverFilter/index-DkfRGrlO.js +0 -158
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/index-DSegwAm2.js +0 -63
- package/components/FieldLabel/index-CI57EizR.js +0 -54
- package/components/GridLayout/index-C4HyxNYX.js +0 -1044
- package/components/GridLayout/subcomponents/Griditem/index-C7jT4s8t.js +0 -395
- package/components/GridLayout/subcomponents/Responsive/index-BKcU2OnF.js +0 -348
- package/components/GridLayout/subcomponents/SizeProvider/index-1aJ-e_54.js +0 -71
- package/components/HelperText/index-Crn_XIPF.js +0 -50
- package/components/Icon/index-C89MAkeH.js +0 -176
- package/components/Image/index-COp8vP0X.js +0 -175
- package/components/LanguagePopover/index-BA2Igs9L.js +0 -179
- package/components/LinearProgressIndeterminate/index-BwI756Mb.js +0 -55
- package/components/Loadable/index-BMbi9ISF.js +0 -9
- package/components/LoadingError/index-Cf0oGUrL.js +0 -89
- package/components/MFIsolationApp/index-V4R55hNU.js +0 -169
- package/components/MFLoader/index-BI8vQZSH.js +0 -299
- package/components/ModalDialog/index-CEVQBQ7W.js +0 -77
- package/components/NavLink/index-D1S_vtFO.js +0 -55
- package/components/NoItemSelected/index-B9oM26AX.js +0 -54
- package/components/ObjectLogs/index-CiXOJpS4.js +0 -233
- package/components/PDFViewer/index-GVN2rfd6.js +0 -51
- package/components/Page/index-DZMkYmr4.js +0 -117
- package/components/PaperForm/index-DwgAfjci.js +0 -59
- package/components/Period/index-2pJG3VmY.js +0 -238
- package/components/PrintingSystem/index-B2qcnfw0.js +0 -187
- package/components/PrintingSystem/subcomponents/BodyNode/index-Cv2aoy8S.js +0 -49
- package/components/PrintingSystem/subcomponents/ChartNode/index-BmJm8v_C.js +0 -105
- package/components/PrintingSystem/subcomponents/DividerNode/index-MpFhE-H0.js +0 -20
- package/components/PrintingSystem/subcomponents/FooterNode/index-ZEcWdMSM.js +0 -49
- package/components/PrintingSystem/subcomponents/GridNode/index-SsKax2xu.js +0 -74
- package/components/PrintingSystem/subcomponents/HeaderNode/index-Cs8TOOBL.js +0 -49
- package/components/PrintingSystem/subcomponents/PaperNode/index-DBb25Ecg.js +0 -30
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index-CTVn7J9Q.js +0 -47
- package/components/PrintingSystem/subcomponents/SectionNode/index-iYPM3EaS.js +0 -49
- package/components/PrintingSystem/subcomponents/TextBoxNode/index-DGjXCFKJ.js +0 -24
- package/components/PropertyValue/index-Bh-Jnrte.js +0 -264
- package/components/Resizeable/index-DdP1xfE9.js +0 -20
- package/components/ScrollBar/index-f2URPPE2.js +0 -35
- package/components/ScrollToTop/index-TxORk5dB.js +0 -12
- package/components/SideBar/index-PUBBe0yH.js +0 -758
- package/components/SplitLayout/index-Bu1hcO6G.js +0 -89
- package/components/ToastContainer/index-DK1d8NNd.js +0 -191
- package/components/WrapperComponent/index-BHV-CsDU.js +0 -14
- package/components/animate/LoadingScreen/index-CkVLOrMz.js +0 -70
- package/components/animate/MotionContainer/index-eartnWyO.js +0 -34
- package/components/animate/MotionLazyContainer/index-Be8osTiG.js +0 -9
- package/components/animate/PropagateLoader/index-Bkq8V2SN.js +0 -23
- package/components/animate/features-BbnE33u3.js +0 -5
- package/components/animate/index-BsWiJfzp.js +0 -89
- package/components/animate/variants/bounce-DanQqHAX.js +0 -101
- package/components/animate/variants/container-Dmpr6tg5.js +0 -22
- package/components/animate/variants/fade-CAOJNn06.js +0 -65
- package/components/animate/variants/index-l0sNRNKZ.js +0 -1
- package/components/animate/variants/transition-B9W5SWTa.js +0 -20
- package/components/areas/components/AreasAdmin/index-OxQU3P8Y.js +0 -699
- package/components/areas/components/AreasViewer/index-DQ0aPioP.js +0 -805
- package/components/areas/components/index-l0sNRNKZ.js +0 -1
- package/components/areas/constants-rqODZNZe.js +0 -6
- package/components/areas/contexts/AreasContext/index-BqRlA7JA.js +0 -1110
- package/components/areas/contexts/DynamicMFParmsContext/index-22c6E7vK.js +0 -36
- package/components/areas/contexts/WindowToolsMFContext/index-DkE30fhm.js +0 -12
- package/components/areas/contexts/index-l0sNRNKZ.js +0 -1
- package/components/areas/dictionary-YUsP9beq.js +0 -36
- package/components/areas/hooks/index-l0sNRNKZ.js +0 -1
- package/components/areas/hooks/useAreas/index-BSbwbJLS.js +0 -11
- package/components/areas/hooks/useDynamicMFParameters/index-DhbcZPs9.js +0 -12
- package/components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle-BzPD-miW.js +0 -31
- package/components/areas/hooks/useWindowToolsMF/index-BECQfhbC.js +0 -10
- package/components/areas/icons-CwFr-alN.js +0 -24
- package/components/areas/index-B_Odny9h.js +0 -22
- package/components/commercial/AppBarCommercial/index-CHq3P3GY.js +0 -28
- package/components/commercial/SectionCommercial/index-BeABGtdr.js +0 -56
- package/components/commercial/TopBar/index-F1repmti.js +0 -232
- package/components/commercial/index-CxDzs6Ax.js +0 -81
- package/components/formatters/BooleanFormatter/index-DktIidqW.js +0 -44
- package/components/formatters/DateFormatter/index-CGcRZ8BA.js +0 -43
- package/components/formatters/PointsFormatter/index-C7sR8iqk.js +0 -25
- package/components/formatters/PriceFormatter/index-CsvRawmc.js +0 -35
- package/components/formatters/UncertaintyFormatter/index-B9ESVEVp.js +0 -29
- package/components/formatters/index-pnJhDYKe.js +0 -109
- package/components/hook-form/HelperError/index-BVnmUazV.js +0 -19
- package/components/hook-form/RHFAutocomplete/index-BtPL16HR.js +0 -657
- package/components/hook-form/RHFAutocompleteAsync/index-BfzjLHG8.js +0 -226
- package/components/hook-form/RHFCheckbox/index-Vyttu8Vx.js +0 -132
- package/components/hook-form/RHFColorPicker/index-Cxxb5Wa_.js +0 -191
- package/components/hook-form/RHFDateTime/index-CW1Slb-f.js +0 -190
- package/components/hook-form/RHFMultiCheckbox/index-BARudV1A.js +0 -34
- package/components/hook-form/RHFPeriod/index-r-HeIOoZ.js +0 -98
- package/components/hook-form/RHFRadioGroup/index-CTD-0zKo.js +0 -52
- package/components/hook-form/RHFSelect/index-LdwRuFz-.js +0 -29
- package/components/hook-form/RHFTextField/index-B6ufruSB.js +0 -337
- package/components/hook-form/RHFUpload/index-CDPbm8NR.js +0 -253
- package/components/maps/components/GpsTools/index-5MXlhIEt.js +0 -1948
- package/components/maps/components/Map/index-2Lx5ARXa.js +0 -2546
- package/components/maps/index-Ci-7-FHg.js +0 -7
- package/components/modal/WindowBase-Gd27v5FU.js +0 -44
- package/components/modal/WindowConfirm-u6vAMFo7.js +0 -73
- package/components/modal/index-CydPIpKZ.js +0 -65
- package/components/mui_extended/Accordion/index-DMLYJL7o.js +0 -124
- package/components/mui_extended/Avatar/index-ClBa-6eF.js +0 -64
- package/components/mui_extended/Badge/index-zI-F_Qkq.js +0 -29
- package/components/mui_extended/BoxIcon/index-BUTJ2tKw.js +0 -22
- package/components/mui_extended/Breadcrumbs/index-DTS7rOZH.js +0 -86
- package/components/mui_extended/Button/index-CGfZbaea.js +0 -222
- package/components/mui_extended/CheckBox-BXUrbonB.js +0 -76
- package/components/mui_extended/CircularProgress/index-Bnnti_G6.js +0 -8
- package/components/mui_extended/IconButton/classes/constants-ChY2jKkp.js +0 -4
- package/components/mui_extended/IconButton/classes/index-BxjJGAqZ.js +0 -45
- package/components/mui_extended/IconButton/index-CusYFjie.js +0 -97
- package/components/mui_extended/IconButton/styledIconButton-fAsbGoFS.js +0 -7
- package/components/mui_extended/LinearProgress/index-CGgW8jq2.js +0 -9
- package/components/mui_extended/LinkWithRoute/index-BC2miUjR.js +0 -15
- package/components/mui_extended/MenuActions/MenuActions-C6CjSU6C.js +0 -149
- package/components/mui_extended/MenuActions/constants-BwsU9chA.js +0 -10
- package/components/mui_extended/MenuActions/dictionary-Dj_07puT.js +0 -11
- package/components/mui_extended/MenuActions/slots/MenuActionsEnum-Bu-L6eWU.js +0 -13
- package/components/mui_extended/MenuActions/slots/MenuActionsSlots-D65KZAKF.js +0 -46
- package/components/mui_extended/Pager/index-DCbxiTZA.js +0 -257
- package/components/mui_extended/Popover/index-DfrJAQkV.js +0 -153
- package/components/mui_extended/Stack/index-DzEeCYfp.js +0 -31
- package/components/mui_extended/Tab/index-Bu3dPidV.js +0 -129
- package/components/mui_extended/ToggleButton/index-C9cBkT1V.js +0 -18
- package/components/mui_extended/ToggleIconButton/index--0b3Td6C.js +0 -26
- package/components/mui_extended/Tooltip/index-B8QUytCK.js +0 -42
- package/components/mui_extended/Typography/index-Cf_4Zw8f.js +0 -54
- package/components/mui_extended/index-l0sNRNKZ.js +0 -1
- package/components/popups/PopupsProvider/index-DhSxmtfJ.js +0 -172
- package/components/popups/PopupsViewer/constants-DuyD7aCn.js +0 -4
- package/components/popups/PopupsViewer/icons-BUujqqbu.js +0 -7
- package/components/popups/PopupsViewer/index-BecevSns.js +0 -172
- package/components/popups/PopupsViewer/slots/index-B98CiRLa.js +0 -14
- package/components/popups/PopupsViewer/slots/popupsViewerSlots-BXH77nCF.js +0 -46
- package/components/popups/index-l0sNRNKZ.js +0 -1
- package/contexts/ModalContext/index-CPfNnfTL.js +0 -39
- package/contexts/RHFormContext/index-D_nK759o.js +0 -78
- package/hocs/withToggle/index-C1_DMZD3.js +0 -14
- package/hooks/useFormAddEdit/index-D9oSjUn1.js +0 -90
- package/hooks/useFormReadyForUpdate/index-B3HygFCM.js +0 -20
- package/hooks/useModal/index-BJSQOX3U.js +0 -10
- package/hooks/useSizeContainer/index-D4hDjM1P.js +0 -37
- package/hooks/useStateRef/index-C3P6ZK3m.js +0 -15
- package/hooks/useTab/index-B_GEQFOP.js +0 -12
- package/react-data-grid-BfYuZ6AK.js +0 -2606
- package/react-draggable-DsCPdgQP.js +0 -811
- package/react-json-view-bhqIAaNg.js +0 -2576
- package/react-resizable-eBbFl2dX.js +0 -618
- package/react-spinners-TpKN9lZg.js +0 -123
- package/react-splitter-layout-C-JTsNGs.js +0 -158
- package/styles/DynamicFilter-CJFsIegc.js +0 -319
- package/styles/MenuActions-lTi-ynPM.js +0 -42
- package/styles/index-DKj6m8SL.js +0 -1691
- package/test/constants_no_mock-CF-669v-.js +0 -4
- package/test/getNameDataTestId-BaBTWhBr.js +0 -10
- package/utils/index-DiMrtgIu.js +0 -502
- /package/components/GridLayout/subcomponents/{Griditem → GridItem}/index.d.ts +0 -0
- /package/components/GridLayout/subcomponents/{Griditem → GridItem}/types.d.ts +0 -0
|
@@ -1,811 +0,0 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from "./commonjs-BfYxJMv3.js";
|
|
2
|
-
import React__default from "react";
|
|
3
|
-
import require$$1 from "prop-types";
|
|
4
|
-
import require$$2 from "react-dom";
|
|
5
|
-
import clsx from "clsx";
|
|
6
|
-
import { d as domFns, s as shims, l as log, p as positionFns } from "./utils/index-DiMrtgIu.js";
|
|
7
|
-
var cjs = { exports: {} };
|
|
8
|
-
var Draggable$2 = {};
|
|
9
|
-
var DraggableCore$2 = {};
|
|
10
|
-
Object.defineProperty(DraggableCore$2, "__esModule", {
|
|
11
|
-
value: true
|
|
12
|
-
});
|
|
13
|
-
DraggableCore$2.default = void 0;
|
|
14
|
-
var React = _interopRequireWildcard(React__default);
|
|
15
|
-
var _propTypes = _interopRequireDefault(require$$1);
|
|
16
|
-
var _reactDom = _interopRequireDefault(require$$2);
|
|
17
|
-
var _domFns = domFns;
|
|
18
|
-
var _positionFns = positionFns;
|
|
19
|
-
var _shims = shims;
|
|
20
|
-
var _log = _interopRequireDefault(log);
|
|
21
|
-
function _interopRequireDefault(obj) {
|
|
22
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
23
|
-
}
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
25
|
-
if (typeof WeakMap !== "function") return null;
|
|
26
|
-
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
28
|
-
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
29
|
-
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
30
|
-
})(nodeInterop);
|
|
31
|
-
}
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
33
|
-
if (obj && obj.__esModule) {
|
|
34
|
-
return obj;
|
|
35
|
-
}
|
|
36
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
37
|
-
return { default: obj };
|
|
38
|
-
}
|
|
39
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
40
|
-
if (cache && cache.has(obj)) {
|
|
41
|
-
return cache.get(obj);
|
|
42
|
-
}
|
|
43
|
-
var newObj = {};
|
|
44
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
|
-
for (var key in obj) {
|
|
46
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
47
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
48
|
-
if (desc && (desc.get || desc.set)) {
|
|
49
|
-
Object.defineProperty(newObj, key, desc);
|
|
50
|
-
} else {
|
|
51
|
-
newObj[key] = obj[key];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
newObj.default = obj;
|
|
56
|
-
if (cache) {
|
|
57
|
-
cache.set(obj, newObj);
|
|
58
|
-
}
|
|
59
|
-
return newObj;
|
|
60
|
-
}
|
|
61
|
-
function _defineProperty(obj, key, value) {
|
|
62
|
-
key = _toPropertyKey(key);
|
|
63
|
-
if (key in obj) {
|
|
64
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
65
|
-
} else {
|
|
66
|
-
obj[key] = value;
|
|
67
|
-
}
|
|
68
|
-
return obj;
|
|
69
|
-
}
|
|
70
|
-
function _toPropertyKey(arg) {
|
|
71
|
-
var key = _toPrimitive(arg, "string");
|
|
72
|
-
return typeof key === "symbol" ? key : String(key);
|
|
73
|
-
}
|
|
74
|
-
function _toPrimitive(input, hint) {
|
|
75
|
-
if (typeof input !== "object" || input === null) return input;
|
|
76
|
-
var prim = input[Symbol.toPrimitive];
|
|
77
|
-
if (prim !== void 0) {
|
|
78
|
-
var res = prim.call(input, hint || "default");
|
|
79
|
-
if (typeof res !== "object") return res;
|
|
80
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
81
|
-
}
|
|
82
|
-
return (hint === "string" ? String : Number)(input);
|
|
83
|
-
}
|
|
84
|
-
const eventsFor = {
|
|
85
|
-
touch: {
|
|
86
|
-
start: "touchstart",
|
|
87
|
-
move: "touchmove",
|
|
88
|
-
stop: "touchend"
|
|
89
|
-
},
|
|
90
|
-
mouse: {
|
|
91
|
-
start: "mousedown",
|
|
92
|
-
move: "mousemove",
|
|
93
|
-
stop: "mouseup"
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
let dragEventFor = eventsFor.mouse;
|
|
97
|
-
let DraggableCore$1 = class DraggableCore extends React.Component {
|
|
98
|
-
constructor() {
|
|
99
|
-
super(...arguments);
|
|
100
|
-
_defineProperty(this, "dragging", false);
|
|
101
|
-
_defineProperty(this, "lastX", NaN);
|
|
102
|
-
_defineProperty(this, "lastY", NaN);
|
|
103
|
-
_defineProperty(this, "touchIdentifier", null);
|
|
104
|
-
_defineProperty(this, "mounted", false);
|
|
105
|
-
_defineProperty(this, "handleDragStart", (e) => {
|
|
106
|
-
this.props.onMouseDown(e);
|
|
107
|
-
if (!this.props.allowAnyClick && typeof e.button === "number" && e.button !== 0) return false;
|
|
108
|
-
const thisNode = this.findDOMNode();
|
|
109
|
-
if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
|
|
110
|
-
throw new Error("<DraggableCore> not mounted on DragStart!");
|
|
111
|
-
}
|
|
112
|
-
const {
|
|
113
|
-
ownerDocument
|
|
114
|
-
} = thisNode;
|
|
115
|
-
if (this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, this.props.handle, thisNode) || this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, this.props.cancel, thisNode)) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (e.type === "touchstart") e.preventDefault();
|
|
119
|
-
const touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
|
|
120
|
-
this.touchIdentifier = touchIdentifier;
|
|
121
|
-
const position = (0, _positionFns.getControlPosition)(e, touchIdentifier, this);
|
|
122
|
-
if (position == null) return;
|
|
123
|
-
const {
|
|
124
|
-
x,
|
|
125
|
-
y
|
|
126
|
-
} = position;
|
|
127
|
-
const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
|
|
128
|
-
(0, _log.default)("DraggableCore: handleDragStart: %j", coreEvent);
|
|
129
|
-
(0, _log.default)("calling", this.props.onStart);
|
|
130
|
-
const shouldUpdate = this.props.onStart(e, coreEvent);
|
|
131
|
-
if (shouldUpdate === false || this.mounted === false) return;
|
|
132
|
-
if (this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument);
|
|
133
|
-
this.dragging = true;
|
|
134
|
-
this.lastX = x;
|
|
135
|
-
this.lastY = y;
|
|
136
|
-
(0, _domFns.addEvent)(ownerDocument, dragEventFor.move, this.handleDrag);
|
|
137
|
-
(0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, this.handleDragStop);
|
|
138
|
-
});
|
|
139
|
-
_defineProperty(this, "handleDrag", (e) => {
|
|
140
|
-
const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this);
|
|
141
|
-
if (position == null) return;
|
|
142
|
-
let {
|
|
143
|
-
x,
|
|
144
|
-
y
|
|
145
|
-
} = position;
|
|
146
|
-
if (Array.isArray(this.props.grid)) {
|
|
147
|
-
let deltaX = x - this.lastX, deltaY = y - this.lastY;
|
|
148
|
-
[deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
|
|
149
|
-
if (!deltaX && !deltaY) return;
|
|
150
|
-
x = this.lastX + deltaX, y = this.lastY + deltaY;
|
|
151
|
-
}
|
|
152
|
-
const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
|
|
153
|
-
(0, _log.default)("DraggableCore: handleDrag: %j", coreEvent);
|
|
154
|
-
const shouldUpdate = this.props.onDrag(e, coreEvent);
|
|
155
|
-
if (shouldUpdate === false || this.mounted === false) {
|
|
156
|
-
try {
|
|
157
|
-
this.handleDragStop(new MouseEvent("mouseup"));
|
|
158
|
-
} catch (err) {
|
|
159
|
-
const event = document.createEvent("MouseEvents");
|
|
160
|
-
event.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
161
|
-
this.handleDragStop(event);
|
|
162
|
-
}
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this.lastX = x;
|
|
166
|
-
this.lastY = y;
|
|
167
|
-
});
|
|
168
|
-
_defineProperty(this, "handleDragStop", (e) => {
|
|
169
|
-
if (!this.dragging) return;
|
|
170
|
-
const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this);
|
|
171
|
-
if (position == null) return;
|
|
172
|
-
let {
|
|
173
|
-
x,
|
|
174
|
-
y
|
|
175
|
-
} = position;
|
|
176
|
-
if (Array.isArray(this.props.grid)) {
|
|
177
|
-
let deltaX = x - this.lastX || 0;
|
|
178
|
-
let deltaY = y - this.lastY || 0;
|
|
179
|
-
[deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
|
|
180
|
-
x = this.lastX + deltaX, y = this.lastY + deltaY;
|
|
181
|
-
}
|
|
182
|
-
const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
|
|
183
|
-
const shouldContinue = this.props.onStop(e, coreEvent);
|
|
184
|
-
if (shouldContinue === false || this.mounted === false) return false;
|
|
185
|
-
const thisNode = this.findDOMNode();
|
|
186
|
-
if (thisNode) {
|
|
187
|
-
if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
|
|
188
|
-
}
|
|
189
|
-
(0, _log.default)("DraggableCore: handleDragStop: %j", coreEvent);
|
|
190
|
-
this.dragging = false;
|
|
191
|
-
this.lastX = NaN;
|
|
192
|
-
this.lastY = NaN;
|
|
193
|
-
if (thisNode) {
|
|
194
|
-
(0, _log.default)("DraggableCore: Removing handlers");
|
|
195
|
-
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, this.handleDrag);
|
|
196
|
-
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, this.handleDragStop);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
_defineProperty(this, "onMouseDown", (e) => {
|
|
200
|
-
dragEventFor = eventsFor.mouse;
|
|
201
|
-
return this.handleDragStart(e);
|
|
202
|
-
});
|
|
203
|
-
_defineProperty(this, "onMouseUp", (e) => {
|
|
204
|
-
dragEventFor = eventsFor.mouse;
|
|
205
|
-
return this.handleDragStop(e);
|
|
206
|
-
});
|
|
207
|
-
_defineProperty(this, "onTouchStart", (e) => {
|
|
208
|
-
dragEventFor = eventsFor.touch;
|
|
209
|
-
return this.handleDragStart(e);
|
|
210
|
-
});
|
|
211
|
-
_defineProperty(this, "onTouchEnd", (e) => {
|
|
212
|
-
dragEventFor = eventsFor.touch;
|
|
213
|
-
return this.handleDragStop(e);
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
componentDidMount() {
|
|
217
|
-
this.mounted = true;
|
|
218
|
-
const thisNode = this.findDOMNode();
|
|
219
|
-
if (thisNode) {
|
|
220
|
-
(0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
|
|
221
|
-
passive: false
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
componentWillUnmount() {
|
|
226
|
-
this.mounted = false;
|
|
227
|
-
const thisNode = this.findDOMNode();
|
|
228
|
-
if (thisNode) {
|
|
229
|
-
const {
|
|
230
|
-
ownerDocument
|
|
231
|
-
} = thisNode;
|
|
232
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
|
|
233
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
|
|
234
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
|
|
235
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
|
|
236
|
-
(0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
|
|
237
|
-
passive: false
|
|
238
|
-
});
|
|
239
|
-
if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
// React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
|
|
243
|
-
// the underlying DOM node ourselves. See the README for more information.
|
|
244
|
-
findDOMNode() {
|
|
245
|
-
var _this$props, _this$props2;
|
|
246
|
-
return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.nodeRef) === null || _this$props2 === void 0 ? void 0 : _this$props2.current : _reactDom.default.findDOMNode(this);
|
|
247
|
-
}
|
|
248
|
-
render() {
|
|
249
|
-
return /* @__PURE__ */ React.cloneElement(React.Children.only(this.props.children), {
|
|
250
|
-
// Note: mouseMove handler is attached to document so it will still function
|
|
251
|
-
// when the user drags quickly and leaves the bounds of the element.
|
|
252
|
-
onMouseDown: this.onMouseDown,
|
|
253
|
-
onMouseUp: this.onMouseUp,
|
|
254
|
-
// onTouchStart is added on `componentDidMount` so they can be added with
|
|
255
|
-
// {passive: false}, which allows it to cancel. See
|
|
256
|
-
// https://developers.google.com/web/updates/2017/01/scrolling-intervention
|
|
257
|
-
onTouchEnd: this.onTouchEnd
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
DraggableCore$2.default = DraggableCore$1;
|
|
262
|
-
_defineProperty(DraggableCore$1, "displayName", "DraggableCore");
|
|
263
|
-
_defineProperty(DraggableCore$1, "propTypes", {
|
|
264
|
-
/**
|
|
265
|
-
* `allowAnyClick` allows dragging using any mouse button.
|
|
266
|
-
* By default, we only accept the left button.
|
|
267
|
-
*
|
|
268
|
-
* Defaults to `false`.
|
|
269
|
-
*/
|
|
270
|
-
allowAnyClick: _propTypes.default.bool,
|
|
271
|
-
children: _propTypes.default.node.isRequired,
|
|
272
|
-
/**
|
|
273
|
-
* `disabled`, if true, stops the <Draggable> from dragging. All handlers,
|
|
274
|
-
* with the exception of `onMouseDown`, will not fire.
|
|
275
|
-
*/
|
|
276
|
-
disabled: _propTypes.default.bool,
|
|
277
|
-
/**
|
|
278
|
-
* By default, we add 'user-select:none' attributes to the document body
|
|
279
|
-
* to prevent ugly text selection during drag. If this is causing problems
|
|
280
|
-
* for your app, set this to `false`.
|
|
281
|
-
*/
|
|
282
|
-
enableUserSelectHack: _propTypes.default.bool,
|
|
283
|
-
/**
|
|
284
|
-
* `offsetParent`, if set, uses the passed DOM node to compute drag offsets
|
|
285
|
-
* instead of using the parent node.
|
|
286
|
-
*/
|
|
287
|
-
offsetParent: function(props, propName) {
|
|
288
|
-
if (props[propName] && props[propName].nodeType !== 1) {
|
|
289
|
-
throw new Error("Draggable's offsetParent must be a DOM Node.");
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
/**
|
|
293
|
-
* `grid` specifies the x and y that dragging should snap to.
|
|
294
|
-
*/
|
|
295
|
-
grid: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
296
|
-
/**
|
|
297
|
-
* `handle` specifies a selector to be used as the handle that initiates drag.
|
|
298
|
-
*
|
|
299
|
-
* Example:
|
|
300
|
-
*
|
|
301
|
-
* ```jsx
|
|
302
|
-
* let App = React.createClass({
|
|
303
|
-
* render: function () {
|
|
304
|
-
* return (
|
|
305
|
-
* <Draggable handle=".handle">
|
|
306
|
-
* <div>
|
|
307
|
-
* <div className="handle">Click me to drag</div>
|
|
308
|
-
* <div>This is some other content</div>
|
|
309
|
-
* </div>
|
|
310
|
-
* </Draggable>
|
|
311
|
-
* );
|
|
312
|
-
* }
|
|
313
|
-
* });
|
|
314
|
-
* ```
|
|
315
|
-
*/
|
|
316
|
-
handle: _propTypes.default.string,
|
|
317
|
-
/**
|
|
318
|
-
* `cancel` specifies a selector to be used to prevent drag initialization.
|
|
319
|
-
*
|
|
320
|
-
* Example:
|
|
321
|
-
*
|
|
322
|
-
* ```jsx
|
|
323
|
-
* let App = React.createClass({
|
|
324
|
-
* render: function () {
|
|
325
|
-
* return(
|
|
326
|
-
* <Draggable cancel=".cancel">
|
|
327
|
-
* <div>
|
|
328
|
-
* <div className="cancel">You can't drag from here</div>
|
|
329
|
-
* <div>Dragging here works fine</div>
|
|
330
|
-
* </div>
|
|
331
|
-
* </Draggable>
|
|
332
|
-
* );
|
|
333
|
-
* }
|
|
334
|
-
* });
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
cancel: _propTypes.default.string,
|
|
338
|
-
/* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
|
|
339
|
-
* Unfortunately, in order for <Draggable> to work properly, we need raw access
|
|
340
|
-
* to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
|
|
341
|
-
* as in this example:
|
|
342
|
-
*
|
|
343
|
-
* function MyComponent() {
|
|
344
|
-
* const nodeRef = React.useRef(null);
|
|
345
|
-
* return (
|
|
346
|
-
* <Draggable nodeRef={nodeRef}>
|
|
347
|
-
* <div ref={nodeRef}>Example Target</div>
|
|
348
|
-
* </Draggable>
|
|
349
|
-
* );
|
|
350
|
-
* }
|
|
351
|
-
*
|
|
352
|
-
* This can be used for arbitrarily nested components, so long as the ref ends up
|
|
353
|
-
* pointing to the actual child DOM node and not a custom component.
|
|
354
|
-
*/
|
|
355
|
-
nodeRef: _propTypes.default.object,
|
|
356
|
-
/**
|
|
357
|
-
* Called when dragging starts.
|
|
358
|
-
* If this function returns the boolean false, dragging will be canceled.
|
|
359
|
-
*/
|
|
360
|
-
onStart: _propTypes.default.func,
|
|
361
|
-
/**
|
|
362
|
-
* Called while dragging.
|
|
363
|
-
* If this function returns the boolean false, dragging will be canceled.
|
|
364
|
-
*/
|
|
365
|
-
onDrag: _propTypes.default.func,
|
|
366
|
-
/**
|
|
367
|
-
* Called when dragging stops.
|
|
368
|
-
* If this function returns the boolean false, the drag will remain active.
|
|
369
|
-
*/
|
|
370
|
-
onStop: _propTypes.default.func,
|
|
371
|
-
/**
|
|
372
|
-
* A workaround option which can be passed if onMouseDown needs to be accessed,
|
|
373
|
-
* since it'll always be blocked (as there is internal use of onMouseDown)
|
|
374
|
-
*/
|
|
375
|
-
onMouseDown: _propTypes.default.func,
|
|
376
|
-
/**
|
|
377
|
-
* `scale`, if set, applies scaling while dragging an element
|
|
378
|
-
*/
|
|
379
|
-
scale: _propTypes.default.number,
|
|
380
|
-
/**
|
|
381
|
-
* These properties should be defined on the child, not here.
|
|
382
|
-
*/
|
|
383
|
-
className: _shims.dontSetMe,
|
|
384
|
-
style: _shims.dontSetMe,
|
|
385
|
-
transform: _shims.dontSetMe
|
|
386
|
-
});
|
|
387
|
-
_defineProperty(DraggableCore$1, "defaultProps", {
|
|
388
|
-
allowAnyClick: false,
|
|
389
|
-
// by default only accept left click
|
|
390
|
-
disabled: false,
|
|
391
|
-
enableUserSelectHack: true,
|
|
392
|
-
onStart: function() {
|
|
393
|
-
},
|
|
394
|
-
onDrag: function() {
|
|
395
|
-
},
|
|
396
|
-
onStop: function() {
|
|
397
|
-
},
|
|
398
|
-
onMouseDown: function() {
|
|
399
|
-
},
|
|
400
|
-
scale: 1
|
|
401
|
-
});
|
|
402
|
-
(function(exports) {
|
|
403
|
-
Object.defineProperty(exports, "__esModule", {
|
|
404
|
-
value: true
|
|
405
|
-
});
|
|
406
|
-
Object.defineProperty(exports, "DraggableCore", {
|
|
407
|
-
enumerable: true,
|
|
408
|
-
get: function() {
|
|
409
|
-
return _DraggableCore.default;
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
exports.default = void 0;
|
|
413
|
-
var React2 = _interopRequireWildcard2(React__default);
|
|
414
|
-
var _propTypes2 = _interopRequireDefault2(require$$1);
|
|
415
|
-
var _reactDom2 = _interopRequireDefault2(require$$2);
|
|
416
|
-
var _clsx = _interopRequireDefault2(clsx);
|
|
417
|
-
var _domFns2 = domFns;
|
|
418
|
-
var _positionFns2 = positionFns;
|
|
419
|
-
var _shims2 = shims;
|
|
420
|
-
var _DraggableCore = _interopRequireDefault2(DraggableCore$2);
|
|
421
|
-
var _log2 = _interopRequireDefault2(log);
|
|
422
|
-
function _interopRequireDefault2(obj) {
|
|
423
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
424
|
-
}
|
|
425
|
-
function _getRequireWildcardCache2(nodeInterop) {
|
|
426
|
-
if (typeof WeakMap !== "function") return null;
|
|
427
|
-
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
428
|
-
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
429
|
-
return (_getRequireWildcardCache2 = function(nodeInterop2) {
|
|
430
|
-
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
431
|
-
})(nodeInterop);
|
|
432
|
-
}
|
|
433
|
-
function _interopRequireWildcard2(obj, nodeInterop) {
|
|
434
|
-
if (obj && obj.__esModule) {
|
|
435
|
-
return obj;
|
|
436
|
-
}
|
|
437
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
438
|
-
return { default: obj };
|
|
439
|
-
}
|
|
440
|
-
var cache = _getRequireWildcardCache2(nodeInterop);
|
|
441
|
-
if (cache && cache.has(obj)) {
|
|
442
|
-
return cache.get(obj);
|
|
443
|
-
}
|
|
444
|
-
var newObj = {};
|
|
445
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
446
|
-
for (var key in obj) {
|
|
447
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
448
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
449
|
-
if (desc && (desc.get || desc.set)) {
|
|
450
|
-
Object.defineProperty(newObj, key, desc);
|
|
451
|
-
} else {
|
|
452
|
-
newObj[key] = obj[key];
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
newObj.default = obj;
|
|
457
|
-
if (cache) {
|
|
458
|
-
cache.set(obj, newObj);
|
|
459
|
-
}
|
|
460
|
-
return newObj;
|
|
461
|
-
}
|
|
462
|
-
function _extends() {
|
|
463
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
464
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
465
|
-
var source = arguments[i];
|
|
466
|
-
for (var key in source) {
|
|
467
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
468
|
-
target[key] = source[key];
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return target;
|
|
473
|
-
};
|
|
474
|
-
return _extends.apply(this, arguments);
|
|
475
|
-
}
|
|
476
|
-
function _defineProperty2(obj, key, value) {
|
|
477
|
-
key = _toPropertyKey2(key);
|
|
478
|
-
if (key in obj) {
|
|
479
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
480
|
-
} else {
|
|
481
|
-
obj[key] = value;
|
|
482
|
-
}
|
|
483
|
-
return obj;
|
|
484
|
-
}
|
|
485
|
-
function _toPropertyKey2(arg) {
|
|
486
|
-
var key = _toPrimitive2(arg, "string");
|
|
487
|
-
return typeof key === "symbol" ? key : String(key);
|
|
488
|
-
}
|
|
489
|
-
function _toPrimitive2(input, hint) {
|
|
490
|
-
if (typeof input !== "object" || input === null) return input;
|
|
491
|
-
var prim = input[Symbol.toPrimitive];
|
|
492
|
-
if (prim !== void 0) {
|
|
493
|
-
var res = prim.call(input, hint || "default");
|
|
494
|
-
if (typeof res !== "object") return res;
|
|
495
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
496
|
-
}
|
|
497
|
-
return (hint === "string" ? String : Number)(input);
|
|
498
|
-
}
|
|
499
|
-
class Draggable2 extends React2.Component {
|
|
500
|
-
// React 16.3+
|
|
501
|
-
// Arity (props, state)
|
|
502
|
-
static getDerivedStateFromProps(_ref, _ref2) {
|
|
503
|
-
let {
|
|
504
|
-
position
|
|
505
|
-
} = _ref;
|
|
506
|
-
let {
|
|
507
|
-
prevPropsPosition
|
|
508
|
-
} = _ref2;
|
|
509
|
-
if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
|
|
510
|
-
(0, _log2.default)("Draggable: getDerivedStateFromProps %j", {
|
|
511
|
-
position,
|
|
512
|
-
prevPropsPosition
|
|
513
|
-
});
|
|
514
|
-
return {
|
|
515
|
-
x: position.x,
|
|
516
|
-
y: position.y,
|
|
517
|
-
prevPropsPosition: {
|
|
518
|
-
...position
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
return null;
|
|
523
|
-
}
|
|
524
|
-
constructor(props) {
|
|
525
|
-
super(props);
|
|
526
|
-
_defineProperty2(this, "onDragStart", (e, coreData) => {
|
|
527
|
-
(0, _log2.default)("Draggable: onDragStart: %j", coreData);
|
|
528
|
-
const shouldStart = this.props.onStart(e, (0, _positionFns2.createDraggableData)(this, coreData));
|
|
529
|
-
if (shouldStart === false) return false;
|
|
530
|
-
this.setState({
|
|
531
|
-
dragging: true,
|
|
532
|
-
dragged: true
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
_defineProperty2(this, "onDrag", (e, coreData) => {
|
|
536
|
-
if (!this.state.dragging) return false;
|
|
537
|
-
(0, _log2.default)("Draggable: onDrag: %j", coreData);
|
|
538
|
-
const uiData = (0, _positionFns2.createDraggableData)(this, coreData);
|
|
539
|
-
const newState = {
|
|
540
|
-
x: uiData.x,
|
|
541
|
-
y: uiData.y,
|
|
542
|
-
slackX: 0,
|
|
543
|
-
slackY: 0
|
|
544
|
-
};
|
|
545
|
-
if (this.props.bounds) {
|
|
546
|
-
const {
|
|
547
|
-
x,
|
|
548
|
-
y
|
|
549
|
-
} = newState;
|
|
550
|
-
newState.x += this.state.slackX;
|
|
551
|
-
newState.y += this.state.slackY;
|
|
552
|
-
const [newStateX, newStateY] = (0, _positionFns2.getBoundPosition)(this, newState.x, newState.y);
|
|
553
|
-
newState.x = newStateX;
|
|
554
|
-
newState.y = newStateY;
|
|
555
|
-
newState.slackX = this.state.slackX + (x - newState.x);
|
|
556
|
-
newState.slackY = this.state.slackY + (y - newState.y);
|
|
557
|
-
uiData.x = newState.x;
|
|
558
|
-
uiData.y = newState.y;
|
|
559
|
-
uiData.deltaX = newState.x - this.state.x;
|
|
560
|
-
uiData.deltaY = newState.y - this.state.y;
|
|
561
|
-
}
|
|
562
|
-
const shouldUpdate = this.props.onDrag(e, uiData);
|
|
563
|
-
if (shouldUpdate === false) return false;
|
|
564
|
-
this.setState(newState);
|
|
565
|
-
});
|
|
566
|
-
_defineProperty2(this, "onDragStop", (e, coreData) => {
|
|
567
|
-
if (!this.state.dragging) return false;
|
|
568
|
-
const shouldContinue = this.props.onStop(e, (0, _positionFns2.createDraggableData)(this, coreData));
|
|
569
|
-
if (shouldContinue === false) return false;
|
|
570
|
-
(0, _log2.default)("Draggable: onDragStop: %j", coreData);
|
|
571
|
-
const newState = {
|
|
572
|
-
dragging: false,
|
|
573
|
-
slackX: 0,
|
|
574
|
-
slackY: 0
|
|
575
|
-
};
|
|
576
|
-
const controlled = Boolean(this.props.position);
|
|
577
|
-
if (controlled) {
|
|
578
|
-
const {
|
|
579
|
-
x,
|
|
580
|
-
y
|
|
581
|
-
} = this.props.position;
|
|
582
|
-
newState.x = x;
|
|
583
|
-
newState.y = y;
|
|
584
|
-
}
|
|
585
|
-
this.setState(newState);
|
|
586
|
-
});
|
|
587
|
-
this.state = {
|
|
588
|
-
// Whether or not we are currently dragging.
|
|
589
|
-
dragging: false,
|
|
590
|
-
// Whether or not we have been dragged before.
|
|
591
|
-
dragged: false,
|
|
592
|
-
// Current transform x and y.
|
|
593
|
-
x: props.position ? props.position.x : props.defaultPosition.x,
|
|
594
|
-
y: props.position ? props.position.y : props.defaultPosition.y,
|
|
595
|
-
prevPropsPosition: {
|
|
596
|
-
...props.position
|
|
597
|
-
},
|
|
598
|
-
// Used for compensating for out-of-bounds drags
|
|
599
|
-
slackX: 0,
|
|
600
|
-
slackY: 0,
|
|
601
|
-
// Can only determine if SVG after mounting
|
|
602
|
-
isElementSVG: false
|
|
603
|
-
};
|
|
604
|
-
if (props.position && !(props.onDrag || props.onStop)) {
|
|
605
|
-
console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
componentDidMount() {
|
|
609
|
-
if (typeof window.SVGElement !== "undefined" && this.findDOMNode() instanceof window.SVGElement) {
|
|
610
|
-
this.setState({
|
|
611
|
-
isElementSVG: true
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
componentWillUnmount() {
|
|
616
|
-
this.setState({
|
|
617
|
-
dragging: false
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
// React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
|
|
621
|
-
// the underlying DOM node ourselves. See the README for more information.
|
|
622
|
-
findDOMNode() {
|
|
623
|
-
var _this$props$nodeRef$c, _this$props;
|
|
624
|
-
return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 || (_this$props = _this$props.nodeRef) === null || _this$props === void 0 ? void 0 : _this$props.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom2.default.findDOMNode(this);
|
|
625
|
-
}
|
|
626
|
-
render() {
|
|
627
|
-
const {
|
|
628
|
-
axis,
|
|
629
|
-
bounds,
|
|
630
|
-
children,
|
|
631
|
-
defaultPosition,
|
|
632
|
-
defaultClassName,
|
|
633
|
-
defaultClassNameDragging,
|
|
634
|
-
defaultClassNameDragged,
|
|
635
|
-
position,
|
|
636
|
-
positionOffset,
|
|
637
|
-
scale,
|
|
638
|
-
...draggableCoreProps
|
|
639
|
-
} = this.props;
|
|
640
|
-
let style = {};
|
|
641
|
-
let svgTransform = null;
|
|
642
|
-
const controlled = Boolean(position);
|
|
643
|
-
const draggable = !controlled || this.state.dragging;
|
|
644
|
-
const validPosition = position || defaultPosition;
|
|
645
|
-
const transformOpts = {
|
|
646
|
-
// Set left if horizontal drag is enabled
|
|
647
|
-
x: (0, _positionFns2.canDragX)(this) && draggable ? this.state.x : validPosition.x,
|
|
648
|
-
// Set top if vertical drag is enabled
|
|
649
|
-
y: (0, _positionFns2.canDragY)(this) && draggable ? this.state.y : validPosition.y
|
|
650
|
-
};
|
|
651
|
-
if (this.state.isElementSVG) {
|
|
652
|
-
svgTransform = (0, _domFns2.createSVGTransform)(transformOpts, positionOffset);
|
|
653
|
-
} else {
|
|
654
|
-
style = (0, _domFns2.createCSSTransform)(transformOpts, positionOffset);
|
|
655
|
-
}
|
|
656
|
-
const className = (0, _clsx.default)(children.props.className || "", defaultClassName, {
|
|
657
|
-
[defaultClassNameDragging]: this.state.dragging,
|
|
658
|
-
[defaultClassNameDragged]: this.state.dragged
|
|
659
|
-
});
|
|
660
|
-
return /* @__PURE__ */ React2.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
|
|
661
|
-
onStart: this.onDragStart,
|
|
662
|
-
onDrag: this.onDrag,
|
|
663
|
-
onStop: this.onDragStop
|
|
664
|
-
}), /* @__PURE__ */ React2.cloneElement(React2.Children.only(children), {
|
|
665
|
-
className,
|
|
666
|
-
style: {
|
|
667
|
-
...children.props.style,
|
|
668
|
-
...style
|
|
669
|
-
},
|
|
670
|
-
transform: svgTransform
|
|
671
|
-
}));
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
exports.default = Draggable2;
|
|
675
|
-
_defineProperty2(Draggable2, "displayName", "Draggable");
|
|
676
|
-
_defineProperty2(Draggable2, "propTypes", {
|
|
677
|
-
// Accepts all props <DraggableCore> accepts.
|
|
678
|
-
..._DraggableCore.default.propTypes,
|
|
679
|
-
/**
|
|
680
|
-
* `axis` determines which axis the draggable can move.
|
|
681
|
-
*
|
|
682
|
-
* Note that all callbacks will still return data as normal. This only
|
|
683
|
-
* controls flushing to the DOM.
|
|
684
|
-
*
|
|
685
|
-
* 'both' allows movement horizontally and vertically.
|
|
686
|
-
* 'x' limits movement to horizontal axis.
|
|
687
|
-
* 'y' limits movement to vertical axis.
|
|
688
|
-
* 'none' limits all movement.
|
|
689
|
-
*
|
|
690
|
-
* Defaults to 'both'.
|
|
691
|
-
*/
|
|
692
|
-
axis: _propTypes2.default.oneOf(["both", "x", "y", "none"]),
|
|
693
|
-
/**
|
|
694
|
-
* `bounds` determines the range of movement available to the element.
|
|
695
|
-
* Available values are:
|
|
696
|
-
*
|
|
697
|
-
* 'parent' restricts movement within the Draggable's parent node.
|
|
698
|
-
*
|
|
699
|
-
* Alternatively, pass an object with the following properties, all of which are optional:
|
|
700
|
-
*
|
|
701
|
-
* {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
|
|
702
|
-
*
|
|
703
|
-
* All values are in px.
|
|
704
|
-
*
|
|
705
|
-
* Example:
|
|
706
|
-
*
|
|
707
|
-
* ```jsx
|
|
708
|
-
* let App = React.createClass({
|
|
709
|
-
* render: function () {
|
|
710
|
-
* return (
|
|
711
|
-
* <Draggable bounds={{right: 300, bottom: 300}}>
|
|
712
|
-
* <div>Content</div>
|
|
713
|
-
* </Draggable>
|
|
714
|
-
* );
|
|
715
|
-
* }
|
|
716
|
-
* });
|
|
717
|
-
* ```
|
|
718
|
-
*/
|
|
719
|
-
bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
|
|
720
|
-
left: _propTypes2.default.number,
|
|
721
|
-
right: _propTypes2.default.number,
|
|
722
|
-
top: _propTypes2.default.number,
|
|
723
|
-
bottom: _propTypes2.default.number
|
|
724
|
-
}), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
|
|
725
|
-
defaultClassName: _propTypes2.default.string,
|
|
726
|
-
defaultClassNameDragging: _propTypes2.default.string,
|
|
727
|
-
defaultClassNameDragged: _propTypes2.default.string,
|
|
728
|
-
/**
|
|
729
|
-
* `defaultPosition` specifies the x and y that the dragged item should start at
|
|
730
|
-
*
|
|
731
|
-
* Example:
|
|
732
|
-
*
|
|
733
|
-
* ```jsx
|
|
734
|
-
* let App = React.createClass({
|
|
735
|
-
* render: function () {
|
|
736
|
-
* return (
|
|
737
|
-
* <Draggable defaultPosition={{x: 25, y: 25}}>
|
|
738
|
-
* <div>I start with transformX: 25px and transformY: 25px;</div>
|
|
739
|
-
* </Draggable>
|
|
740
|
-
* );
|
|
741
|
-
* }
|
|
742
|
-
* });
|
|
743
|
-
* ```
|
|
744
|
-
*/
|
|
745
|
-
defaultPosition: _propTypes2.default.shape({
|
|
746
|
-
x: _propTypes2.default.number,
|
|
747
|
-
y: _propTypes2.default.number
|
|
748
|
-
}),
|
|
749
|
-
positionOffset: _propTypes2.default.shape({
|
|
750
|
-
x: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
|
|
751
|
-
y: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
|
|
752
|
-
}),
|
|
753
|
-
/**
|
|
754
|
-
* `position`, if present, defines the current position of the element.
|
|
755
|
-
*
|
|
756
|
-
* This is similar to how form elements in React work - if no `position` is supplied, the component
|
|
757
|
-
* is uncontrolled.
|
|
758
|
-
*
|
|
759
|
-
* Example:
|
|
760
|
-
*
|
|
761
|
-
* ```jsx
|
|
762
|
-
* let App = React.createClass({
|
|
763
|
-
* render: function () {
|
|
764
|
-
* return (
|
|
765
|
-
* <Draggable position={{x: 25, y: 25}}>
|
|
766
|
-
* <div>I start with transformX: 25px and transformY: 25px;</div>
|
|
767
|
-
* </Draggable>
|
|
768
|
-
* );
|
|
769
|
-
* }
|
|
770
|
-
* });
|
|
771
|
-
* ```
|
|
772
|
-
*/
|
|
773
|
-
position: _propTypes2.default.shape({
|
|
774
|
-
x: _propTypes2.default.number,
|
|
775
|
-
y: _propTypes2.default.number
|
|
776
|
-
}),
|
|
777
|
-
/**
|
|
778
|
-
* These properties should be defined on the child, not here.
|
|
779
|
-
*/
|
|
780
|
-
className: _shims2.dontSetMe,
|
|
781
|
-
style: _shims2.dontSetMe,
|
|
782
|
-
transform: _shims2.dontSetMe
|
|
783
|
-
});
|
|
784
|
-
_defineProperty2(Draggable2, "defaultProps", {
|
|
785
|
-
..._DraggableCore.default.defaultProps,
|
|
786
|
-
axis: "both",
|
|
787
|
-
bounds: false,
|
|
788
|
-
defaultClassName: "react-draggable",
|
|
789
|
-
defaultClassNameDragging: "react-draggable-dragging",
|
|
790
|
-
defaultClassNameDragged: "react-draggable-dragged",
|
|
791
|
-
defaultPosition: {
|
|
792
|
-
x: 0,
|
|
793
|
-
y: 0
|
|
794
|
-
},
|
|
795
|
-
scale: 1
|
|
796
|
-
});
|
|
797
|
-
})(Draggable$2);
|
|
798
|
-
const {
|
|
799
|
-
default: Draggable,
|
|
800
|
-
DraggableCore: DraggableCore2
|
|
801
|
-
} = Draggable$2;
|
|
802
|
-
cjs.exports = Draggable;
|
|
803
|
-
cjs.exports.default = Draggable;
|
|
804
|
-
var DraggableCore_1 = cjs.exports.DraggableCore = DraggableCore2;
|
|
805
|
-
var cjsExports = cjs.exports;
|
|
806
|
-
const Draggable$1 = /* @__PURE__ */ getDefaultExportFromCjs(cjsExports);
|
|
807
|
-
export {
|
|
808
|
-
DraggableCore_1 as D,
|
|
809
|
-
Draggable$1 as a,
|
|
810
|
-
cjsExports as c
|
|
811
|
-
};
|