funda-ui 4.5.677 → 4.5.682
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/ColorPicker/index.js +3 -1
- package/DragDropList/index.css +188 -0
- package/DragDropList/index.d.ts +43 -0
- package/DragDropList/index.js +1589 -0
- package/LICENSE +21 -0
- package/MultipleSelect/index.css +237 -144
- package/MultipleSelect/index.d.ts +23 -10
- package/MultipleSelect/index.js +2242 -1225
- package/README.md +3 -1
- package/Utils/useBoundedDrag.d.ts +127 -0
- package/Utils/useBoundedDrag.js +382 -0
- package/Utils/useDragDropPosition.d.ts +169 -0
- package/Utils/useDragDropPosition.js +456 -0
- package/all.d.ts +1 -0
- package/all.js +1 -0
- package/lib/cjs/ColorPicker/index.js +3 -1
- package/lib/cjs/DragDropList/index.d.ts +43 -0
- package/lib/cjs/DragDropList/index.js +1589 -0
- package/lib/cjs/MultipleSelect/index.d.ts +23 -10
- package/lib/cjs/MultipleSelect/index.js +2242 -1225
- package/lib/cjs/Utils/useBoundedDrag.d.ts +127 -0
- package/lib/cjs/Utils/useBoundedDrag.js +382 -0
- package/lib/cjs/Utils/useDragDropPosition.d.ts +169 -0
- package/lib/cjs/Utils/useDragDropPosition.js +456 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/css/DragDropList/index.css +188 -0
- package/lib/css/MultipleSelect/index.css +237 -144
- package/lib/esm/ColorPicker/index.tsx +53 -49
- package/lib/esm/DragDropList/index.scss +245 -0
- package/lib/esm/DragDropList/index.tsx +493 -0
- package/lib/esm/MultipleSelect/index.scss +288 -183
- package/lib/esm/MultipleSelect/index.tsx +304 -166
- package/lib/esm/MultipleSelect/utils/func.ts +21 -1
- package/lib/esm/Tabs/Tabs.tsx +1 -1
- package/lib/esm/Utils/hooks/useBoundedDrag.tsx +303 -0
- package/lib/esm/Utils/hooks/useDragDropPosition.tsx +420 -0
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
- package/lib/esm/MultipleSelect/ItemList.tsx +0 -323
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("react"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["react"], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["RPB"] = factory(require("react"));
|
|
8
|
+
else
|
|
9
|
+
root["RPB"] = factory(root["React"]);
|
|
10
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ 787:
|
|
16
|
+
/***/ ((module) => {
|
|
17
|
+
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
19
|
+
|
|
20
|
+
/***/ })
|
|
21
|
+
|
|
22
|
+
/******/ });
|
|
23
|
+
/************************************************************************/
|
|
24
|
+
/******/ // The module cache
|
|
25
|
+
/******/ var __webpack_module_cache__ = {};
|
|
26
|
+
/******/
|
|
27
|
+
/******/ // The require function
|
|
28
|
+
/******/ function __webpack_require__(moduleId) {
|
|
29
|
+
/******/ // Check if module is in cache
|
|
30
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
31
|
+
/******/ if (cachedModule !== undefined) {
|
|
32
|
+
/******/ return cachedModule.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ // Create a new module (and put it into the cache)
|
|
35
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
36
|
+
/******/ // no module.id needed
|
|
37
|
+
/******/ // no module.loaded needed
|
|
38
|
+
/******/ exports: {}
|
|
39
|
+
/******/ };
|
|
40
|
+
/******/
|
|
41
|
+
/******/ // Execute the module function
|
|
42
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // Return the exports of the module
|
|
45
|
+
/******/ return module.exports;
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/
|
|
48
|
+
/************************************************************************/
|
|
49
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
50
|
+
/******/ (() => {
|
|
51
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
52
|
+
/******/ __webpack_require__.n = (module) => {
|
|
53
|
+
/******/ var getter = module && module.__esModule ?
|
|
54
|
+
/******/ () => (module['default']) :
|
|
55
|
+
/******/ () => (module);
|
|
56
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
57
|
+
/******/ return getter;
|
|
58
|
+
/******/ };
|
|
59
|
+
/******/ })();
|
|
60
|
+
/******/
|
|
61
|
+
/******/ /* webpack/runtime/define property getters */
|
|
62
|
+
/******/ (() => {
|
|
63
|
+
/******/ // define getter functions for harmony exports
|
|
64
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
65
|
+
/******/ for(var key in definition) {
|
|
66
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
67
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
68
|
+
/******/ }
|
|
69
|
+
/******/ }
|
|
70
|
+
/******/ };
|
|
71
|
+
/******/ })();
|
|
72
|
+
/******/
|
|
73
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
74
|
+
/******/ (() => {
|
|
75
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
76
|
+
/******/ })();
|
|
77
|
+
/******/
|
|
78
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
79
|
+
/******/ (() => {
|
|
80
|
+
/******/ // define __esModule on exports
|
|
81
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
82
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
83
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
84
|
+
/******/ }
|
|
85
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
86
|
+
/******/ };
|
|
87
|
+
/******/ })();
|
|
88
|
+
/******/
|
|
89
|
+
/************************************************************************/
|
|
90
|
+
var __webpack_exports__ = {};
|
|
91
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
92
|
+
(() => {
|
|
93
|
+
__webpack_require__.r(__webpack_exports__);
|
|
94
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
95
|
+
/* harmony export */ "useDragDropPosition": () => (/* binding */ useDragDropPosition)
|
|
96
|
+
/* harmony export */ });
|
|
97
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
|
|
98
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
99
|
+
/**
|
|
100
|
+
* Drag Drop Object
|
|
101
|
+
*
|
|
102
|
+
* @usage:
|
|
103
|
+
|
|
104
|
+
import { useState, useCallback } from 'react';
|
|
105
|
+
import { useDragDropPosition } from '@/utils/hooks/useDragDropPosition';
|
|
106
|
+
|
|
107
|
+
const App = () => {
|
|
108
|
+
|
|
109
|
+
const [show, setShow] = useState<boolean>(false);
|
|
110
|
+
|
|
111
|
+
// drag & drop
|
|
112
|
+
//---------------、
|
|
113
|
+
const moveDelay = 150;
|
|
114
|
+
const pin = false;
|
|
115
|
+
const dimension = 32; // onject with dimension
|
|
116
|
+
const [objPosition, setObjPosition] = useState<{
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
}>({ x: 0, y: 0 });
|
|
120
|
+
const [isDragged, setIsDragged] = useState<boolean>(false);
|
|
121
|
+
const [isPressed, setIsPressed] = useState<boolean>(false);
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
const { setup, ref } = useDragDropPosition({
|
|
125
|
+
// usePercentage: true, // Enable percentage values
|
|
126
|
+
dimension,
|
|
127
|
+
onDragEnd: ({position, hasContainer}) => {
|
|
128
|
+
const { left, top } = position;
|
|
129
|
+
setObjPosition({
|
|
130
|
+
x: left || 0,
|
|
131
|
+
y: (top || 0),
|
|
132
|
+
});
|
|
133
|
+
setIsPressed(false);
|
|
134
|
+
setIsDragged(false);
|
|
135
|
+
|
|
136
|
+
// click event here (restore)
|
|
137
|
+
setShow(false);
|
|
138
|
+
},
|
|
139
|
+
onDragStart: ({position, hasContainer}) => {
|
|
140
|
+
const { left, top } = position;
|
|
141
|
+
setObjPosition({
|
|
142
|
+
x: left || 0,
|
|
143
|
+
y: (top || 0),
|
|
144
|
+
});
|
|
145
|
+
setIsDragged(true);
|
|
146
|
+
|
|
147
|
+
// click event here (restore)
|
|
148
|
+
setShow(false);
|
|
149
|
+
},
|
|
150
|
+
onInit: ({position, hasContainer}) => {
|
|
151
|
+
const { left, top } = position;
|
|
152
|
+
setObjPosition({
|
|
153
|
+
x: left || 0,
|
|
154
|
+
y: (top || 0),
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
onPointerDown: () => {
|
|
158
|
+
setIsPressed(true);
|
|
159
|
+
},
|
|
160
|
+
onPointerUp: useCallback(() => {
|
|
161
|
+
setIsPressed(false);
|
|
162
|
+
|
|
163
|
+
// click event here
|
|
164
|
+
setShow((prev) => !prev);
|
|
165
|
+
|
|
166
|
+
}, []),
|
|
167
|
+
onMove: ({position, hasContainer}) => {
|
|
168
|
+
const { left, top } = position;
|
|
169
|
+
setObjPosition({
|
|
170
|
+
x: left || 0,
|
|
171
|
+
y: (top || 0),
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
pin,
|
|
175
|
+
moveDelay
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<>
|
|
184
|
+
|
|
185
|
+
<div
|
|
186
|
+
ref={setup}
|
|
187
|
+
className="float-btn"
|
|
188
|
+
style={{position: 'fixed', left: '50%', top: '50%', zIndex: 1000, background: 'red'}}
|
|
189
|
+
|
|
190
|
+
>Move Here<small>{JSON.stringify(objPosition)}</small><br /><strong>{show ? 'Clicked' : 'None'}</strong></div>
|
|
191
|
+
|
|
192
|
+
</>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
const App2 = () => {
|
|
200
|
+
|
|
201
|
+
const dragdropContainerRef = useRef<HTMLDivElement>(null);
|
|
202
|
+
....
|
|
203
|
+
|
|
204
|
+
const { setup, ref } = useDragDropPosition({
|
|
205
|
+
container: dragdropContainerRef.current, // If there is a container with a drag range
|
|
206
|
+
...
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
|
|
212
|
+
<>
|
|
213
|
+
|
|
214
|
+
<div
|
|
215
|
+
ref={dragdropContainerRef}
|
|
216
|
+
style={{
|
|
217
|
+
width: '300px',
|
|
218
|
+
height: '300px',
|
|
219
|
+
border: '1px solid #ddd',
|
|
220
|
+
background: '#efefef',
|
|
221
|
+
position: 'relative'
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
<div
|
|
225
|
+
ref={setup}
|
|
226
|
+
className="float-btn"
|
|
227
|
+
style={{ position: 'absolute', left: '50%', top: '50%', zIndex: 1000, background: 'red' }}
|
|
228
|
+
|
|
229
|
+
>Move Here<small>{JSON.stringify(objPosition)}</small><br /><strong>{show ? 'Clicked' : 'None'}</strong></div>
|
|
230
|
+
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
</>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
var useDragDropPosition = function useDragDropPosition(settings) {
|
|
243
|
+
var _settings$container = settings.container,
|
|
244
|
+
container = _settings$container === void 0 ? null : _settings$container,
|
|
245
|
+
onPointerDown = settings.onPointerDown,
|
|
246
|
+
onPointerUp = settings.onPointerUp,
|
|
247
|
+
onDragStart = settings.onDragStart,
|
|
248
|
+
onDragEnd = settings.onDragEnd,
|
|
249
|
+
onMove = settings.onMove,
|
|
250
|
+
_settings$dimension = settings.dimension,
|
|
251
|
+
dimension = _settings$dimension === void 0 ? 0 : _settings$dimension,
|
|
252
|
+
onInit = settings.onInit,
|
|
253
|
+
pin = settings.pin,
|
|
254
|
+
_settings$moveDelay = settings.moveDelay,
|
|
255
|
+
moveDelay = _settings$moveDelay === void 0 ? 150 : _settings$moveDelay,
|
|
256
|
+
_settings$usePercenta = settings.usePercentage,
|
|
257
|
+
usePercentage = _settings$usePercenta === void 0 ? false : _settings$usePercenta;
|
|
258
|
+
var ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
259
|
+
var isClicked = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
260
|
+
var isDragged = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
261
|
+
var keyPressed = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
262
|
+
var convertToPercentage = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (position) {
|
|
263
|
+
if (usePercentage) {
|
|
264
|
+
if (!container) return {
|
|
265
|
+
position: position,
|
|
266
|
+
hasContainer: Boolean(container)
|
|
267
|
+
};
|
|
268
|
+
var containerDim = getContainerDimensions();
|
|
269
|
+
return {
|
|
270
|
+
position: {
|
|
271
|
+
left: position.left / containerDim.width * 100,
|
|
272
|
+
top: position.top / containerDim.height * 100
|
|
273
|
+
},
|
|
274
|
+
hasContainer: Boolean(container)
|
|
275
|
+
};
|
|
276
|
+
} else {
|
|
277
|
+
return {
|
|
278
|
+
position: position,
|
|
279
|
+
hasContainer: false
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}, [container, usePercentage]);
|
|
283
|
+
var getContainerDimensions = function getContainerDimensions() {
|
|
284
|
+
if (!container) {
|
|
285
|
+
return {
|
|
286
|
+
width: window.innerWidth,
|
|
287
|
+
height: window.innerHeight,
|
|
288
|
+
left: 0,
|
|
289
|
+
top: 0
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
var rect = container.getBoundingClientRect();
|
|
293
|
+
return {
|
|
294
|
+
width: rect.width,
|
|
295
|
+
height: rect.height,
|
|
296
|
+
left: rect.left,
|
|
297
|
+
top: rect.top
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
var getLeft = function getLeft(left, dimension) {
|
|
301
|
+
var containerDim = getContainerDimensions();
|
|
302
|
+
var minLeft = container ? 0 : containerDim.left;
|
|
303
|
+
var maxLeft = containerDim.width - dimension;
|
|
304
|
+
if (left < minLeft) {
|
|
305
|
+
return minLeft;
|
|
306
|
+
} else if (left > maxLeft) {
|
|
307
|
+
return maxLeft;
|
|
308
|
+
}
|
|
309
|
+
return left;
|
|
310
|
+
};
|
|
311
|
+
var getTop = function getTop(top, dimension) {
|
|
312
|
+
var containerDim = getContainerDimensions();
|
|
313
|
+
var minTop = container ? 0 : containerDim.top;
|
|
314
|
+
var maxTop = containerDim.height - dimension;
|
|
315
|
+
if (top < minTop) {
|
|
316
|
+
return minTop;
|
|
317
|
+
} else if (top > maxTop) {
|
|
318
|
+
return maxTop;
|
|
319
|
+
}
|
|
320
|
+
return top;
|
|
321
|
+
};
|
|
322
|
+
var moveTimeout = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
323
|
+
var moveDisabled = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(true);
|
|
324
|
+
var moveDelayInit = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {
|
|
325
|
+
moveTimeout.current = setTimeout(function () {
|
|
326
|
+
moveDisabled.current = false;
|
|
327
|
+
}, moveDelay);
|
|
328
|
+
}, [moveDelay]);
|
|
329
|
+
var moveDelayInitClear = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {
|
|
330
|
+
moveDisabled.current = true;
|
|
331
|
+
if (moveTimeout.current) {
|
|
332
|
+
clearTimeout(moveTimeout.current);
|
|
333
|
+
}
|
|
334
|
+
}, []);
|
|
335
|
+
var positionRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({
|
|
336
|
+
left: 0,
|
|
337
|
+
top: 0
|
|
338
|
+
});
|
|
339
|
+
var calculateRelativePosition = function calculateRelativePosition(clientX, clientY) {
|
|
340
|
+
var containerDim = getContainerDimensions();
|
|
341
|
+
var halfWidth = Math.round(dimension / 2);
|
|
342
|
+
var x = clientX;
|
|
343
|
+
var y = clientY;
|
|
344
|
+
if (container) {
|
|
345
|
+
x = clientX - containerDim.left;
|
|
346
|
+
y = clientY - containerDim.top;
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
x: x - halfWidth,
|
|
350
|
+
y: y - halfWidth
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
var handlePointerDown = function handlePointerDown(ev) {
|
|
354
|
+
moveDelayInit();
|
|
355
|
+
isClicked.current = true;
|
|
356
|
+
var ele = ev.target;
|
|
357
|
+
ev.stopPropagation();
|
|
358
|
+
if (ev instanceof PointerEvent) {
|
|
359
|
+
keyPressed.current = false;
|
|
360
|
+
ele.setPointerCapture(ev.pointerId);
|
|
361
|
+
} else if (ev instanceof KeyboardEvent) {
|
|
362
|
+
keyPressed.current = true;
|
|
363
|
+
}
|
|
364
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
|
|
365
|
+
};
|
|
366
|
+
var handlePointerUp = function handlePointerUp(ev) {
|
|
367
|
+
moveDelayInitClear();
|
|
368
|
+
isClicked.current = false;
|
|
369
|
+
if (ev instanceof PointerEvent) {
|
|
370
|
+
var ele = ev.target;
|
|
371
|
+
ele.releasePointerCapture(ev.pointerId);
|
|
372
|
+
}
|
|
373
|
+
if (onDragEnd) {
|
|
374
|
+
var finalPosition = convertToPercentage(positionRef.current);
|
|
375
|
+
onDragEnd(finalPosition);
|
|
376
|
+
}
|
|
377
|
+
if (!isDragged.current) {
|
|
378
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
|
|
379
|
+
} else {
|
|
380
|
+
isDragged.current = false;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
var onPointerMove = function onPointerMove(e) {
|
|
384
|
+
if (moveDisabled.current || !isClicked.current || !ref.current || keyPressed.current) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
var touches = 'touches' in e ? e.touches : null;
|
|
388
|
+
var clientX = touches && touches.length ? touches[0].clientX : e.clientX;
|
|
389
|
+
var clientY = touches && touches.length ? touches[0].clientY : e.clientY;
|
|
390
|
+
var _calculateRelativePos = calculateRelativePosition(clientX, clientY),
|
|
391
|
+
x = _calculateRelativePos.x,
|
|
392
|
+
y = _calculateRelativePos.y;
|
|
393
|
+
var position = {
|
|
394
|
+
left: getLeft(x, dimension),
|
|
395
|
+
top: getTop(y, dimension)
|
|
396
|
+
};
|
|
397
|
+
if (!isDragged.current) {
|
|
398
|
+
isDragged.current = true;
|
|
399
|
+
if (onDragStart) {
|
|
400
|
+
var startPosition = convertToPercentage(position);
|
|
401
|
+
onDragStart(startPosition);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
positionRef.current = position;
|
|
405
|
+
ref.current.style.cssText += "top: ".concat(position.top, "px;left: ").concat(position.left, "px;");
|
|
406
|
+
if (onMove) {
|
|
407
|
+
var movePosition = convertToPercentage(position);
|
|
408
|
+
onMove(movePosition);
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var setup = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (node) {
|
|
412
|
+
if (node) {
|
|
413
|
+
ref.current = node;
|
|
414
|
+
node.addEventListener("pointerdown", handlePointerDown);
|
|
415
|
+
node.addEventListener("keydown", handlePointerDown);
|
|
416
|
+
node.addEventListener("mouseup", handlePointerUp);
|
|
417
|
+
node.style.touchAction = "none";
|
|
418
|
+
var rect = node.getBoundingClientRect();
|
|
419
|
+
var containerDim = getContainerDimensions();
|
|
420
|
+
var initialPosition = {
|
|
421
|
+
left: container ? rect.left - containerDim.left : rect.left,
|
|
422
|
+
top: container ? rect.top - containerDim.top : rect.top
|
|
423
|
+
};
|
|
424
|
+
if (onInit) {
|
|
425
|
+
var initPosition = convertToPercentage(initialPosition);
|
|
426
|
+
onInit(initPosition);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}, [container, onInit, convertToPercentage]);
|
|
430
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
431
|
+
if (!pin) {
|
|
432
|
+
document.addEventListener("mousemove", onPointerMove);
|
|
433
|
+
document.addEventListener("touchmove", onPointerMove);
|
|
434
|
+
return function () {
|
|
435
|
+
document.removeEventListener("mousemove", onPointerMove);
|
|
436
|
+
document.removeEventListener("touchmove", onPointerMove);
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
}, [container, pin]);
|
|
440
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
441
|
+
return function () {
|
|
442
|
+
moveDelayInitClear();
|
|
443
|
+
};
|
|
444
|
+
}, [moveDelayInitClear]);
|
|
445
|
+
return {
|
|
446
|
+
ref: ref,
|
|
447
|
+
setup: setup
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
})();
|
|
452
|
+
|
|
453
|
+
/******/ return __webpack_exports__;
|
|
454
|
+
/******/ })()
|
|
455
|
+
;
|
|
456
|
+
});
|
package/all.d.ts
CHANGED
package/all.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.Checkbox = _interopRequireDefault(require("./Checkbox")).default;
|
|
|
10
10
|
exports.ColorPicker = _interopRequireDefault(require("./ColorPicker")).default;
|
|
11
11
|
exports.Date = _interopRequireDefault(require("./Date")).default;
|
|
12
12
|
exports.DigitalClock = _interopRequireDefault(require("./DigitalClock")).default;
|
|
13
|
+
exports.DragDropList = _interopRequireDefault(require("./DragDropList")).default;
|
|
13
14
|
exports.DropdownMenu = _interopRequireDefault(require("./DropdownMenu")).default;
|
|
14
15
|
exports.DynamicFields = _interopRequireDefault(require("./DynamicFields")).default;
|
|
15
16
|
exports.EventCalendar = _interopRequireDefault(require("./EventCalendar")).default;
|
|
@@ -603,6 +603,8 @@ var ColorPicker = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)
|
|
|
603
603
|
htmlFor: idRes,
|
|
604
604
|
className: "form-label"
|
|
605
605
|
}, label)) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
606
|
+
className: "position-relative"
|
|
607
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
606
608
|
className: "input-group"
|
|
607
609
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
608
610
|
ref: function ref(node) {
|
|
@@ -649,7 +651,7 @@ var ColorPicker = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)
|
|
|
649
651
|
className: "text-danger"
|
|
650
652
|
}, "*"))) : '', changedVal === '' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
651
653
|
className: "custom-colorpicker__transparent-placeholder"
|
|
652
|
-
})) : null));
|
|
654
|
+
})) : null)));
|
|
653
655
|
});
|
|
654
656
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ColorPicker);
|
|
655
657
|
})();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ListItem {
|
|
3
|
+
id: number;
|
|
4
|
+
parentId?: number;
|
|
5
|
+
label: string;
|
|
6
|
+
listItemLabel: string;
|
|
7
|
+
value: string;
|
|
8
|
+
queryString: string;
|
|
9
|
+
depth?: number;
|
|
10
|
+
children?: ListItem[];
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
appendControl?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export interface DragDropListProps {
|
|
15
|
+
wrapperClassName?: string;
|
|
16
|
+
prefix?: string;
|
|
17
|
+
data?: ListItem[];
|
|
18
|
+
draggable?: boolean;
|
|
19
|
+
handleHide?: boolean;
|
|
20
|
+
handleIcon?: string;
|
|
21
|
+
handlePos?: 'left' | 'right';
|
|
22
|
+
dragMode?: 'handle' | 'block';
|
|
23
|
+
editable?: boolean;
|
|
24
|
+
itemStyle?: React.CSSProperties;
|
|
25
|
+
hierarchical?: boolean;
|
|
26
|
+
indentation?: string;
|
|
27
|
+
doubleIndent?: boolean;
|
|
28
|
+
alternateCollapse?: boolean;
|
|
29
|
+
arrow?: React.ReactNode;
|
|
30
|
+
onUpdate?: (items: ListItem[], curId: number) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface EditValue {
|
|
33
|
+
[propName: string]: string | number;
|
|
34
|
+
}
|
|
35
|
+
export interface TouchOffset {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}
|
|
39
|
+
export interface OptionConfig {
|
|
40
|
+
[propName: string]: string | number | boolean | Function | any[];
|
|
41
|
+
}
|
|
42
|
+
declare const DragDropList: React.ForwardRefExoticComponent<DragDropListProps & React.RefAttributes<unknown>>;
|
|
43
|
+
export default DragDropList;
|