@rpg-engine/long-bow 0.1.66 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DraggableContainer.d.ts +3 -0
- package/dist/components/Item/Inventory/ItemContainer.d.ts +4 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +3 -2
- package/dist/components/Item/Inventory/itemContainerHelper.d.ts +7 -0
- package/dist/hooks/useOutsideAlerter.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +201 -137
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +203 -139
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/types/eventTypes.d.ts +4 -0
- package/package.json +5 -5
- package/src/components/DraggableContainer.tsx +18 -3
- package/src/components/Item/Cards/ItemCard.tsx +7 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +129 -132
- package/src/components/Item/Inventory/ItemSlot.tsx +24 -9
- package/src/components/Item/Inventory/itemContainerHelper.ts +44 -0
- package/src/hooks/useOutsideAlerter.ts +25 -0
- package/src/types/eventTypes.ts +4 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IPosition } from '../types/eventTypes';
|
|
2
3
|
import { RPGUIContainerTypes } from './RPGUIContainer';
|
|
3
4
|
export interface IDraggableContainerProps {
|
|
4
5
|
children: React.ReactNode;
|
|
@@ -10,5 +11,7 @@ export interface IDraggableContainerProps {
|
|
|
10
11
|
imgSrc?: string;
|
|
11
12
|
imgWidth?: string;
|
|
12
13
|
onCloseButton: () => void;
|
|
14
|
+
cancelDrag?: string;
|
|
15
|
+
onPositionChange?: (position: IPosition) => void;
|
|
13
16
|
}
|
|
14
17
|
export declare const DraggableContainer: React.FC<IDraggableContainerProps>;
|
|
@@ -5,5 +5,9 @@ export interface IItemContainerProps {
|
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onMouseOver: (e: any, slotIndex: number, item: IItem | null) => void;
|
|
7
7
|
onActionSelected: (payload: any) => void;
|
|
8
|
+
initialPosition?: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
13
|
export declare const ItemContainer: React.FC<IItemContainerProps>;
|
|
@@ -3,8 +3,9 @@ import React from 'react';
|
|
|
3
3
|
interface IProps {
|
|
4
4
|
slotIndex: number;
|
|
5
5
|
item: IItem | null;
|
|
6
|
-
onMouseOver: (event: any, slotIndex: number, item: IItem | null) => void;
|
|
7
|
-
|
|
6
|
+
onMouseOver: (event: any, slotIndex: number, item: IItem | null, x: number, y: number) => void;
|
|
7
|
+
onClick: (item: IItem, posX: number, posY: number) => void;
|
|
8
|
+
onCancelContextMenu: () => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const ItemSlot: React.FC<IProps>;
|
|
10
11
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useOutsideClick(ref: any, id: string): void;
|
|
@@ -299,14 +299,23 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
299
299
|
title = _ref.title,
|
|
300
300
|
imgSrc = _ref.imgSrc,
|
|
301
301
|
_ref$imgWidth = _ref.imgWidth,
|
|
302
|
-
imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth
|
|
302
|
+
imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
|
|
303
|
+
cancelDrag = _ref.cancelDrag,
|
|
304
|
+
onPositionChange = _ref.onPositionChange;
|
|
303
305
|
return React__default.createElement(Draggable, {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
+
cancel: ".container-close," + cancelDrag,
|
|
307
|
+
onDrag: function onDrag(_e, data) {
|
|
308
|
+
if (onPositionChange) {
|
|
309
|
+
onPositionChange({
|
|
310
|
+
x: data.x,
|
|
311
|
+
y: data.y
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
306
315
|
}, React__default.createElement(Container$2, {
|
|
307
316
|
width: width,
|
|
308
317
|
height: height || 'auto',
|
|
309
|
-
className: "rpgui-container " + type + " " + className
|
|
318
|
+
className: "rpgui-container " + type + " " + className
|
|
310
319
|
}, React__default.createElement(TitleContainer, {
|
|
311
320
|
className: "drag-handler"
|
|
312
321
|
}, React__default.createElement(Title, null, imgSrc && React__default.createElement(Icon, {
|
|
@@ -393,6 +402,32 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
393
402
|
}));
|
|
394
403
|
};
|
|
395
404
|
|
|
405
|
+
function useOutsideClick(ref, id) {
|
|
406
|
+
React.useEffect(function () {
|
|
407
|
+
/**
|
|
408
|
+
* Alert if clicked on outside of element
|
|
409
|
+
*/
|
|
410
|
+
function handleClickOutside(event) {
|
|
411
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
412
|
+
var _event = new CustomEvent('clickOutside', {
|
|
413
|
+
detail: {
|
|
414
|
+
id: id
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
document.dispatchEvent(_event);
|
|
419
|
+
}
|
|
420
|
+
} // Bind the event listener
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
424
|
+
return function () {
|
|
425
|
+
// Unbind the event listener on clean up
|
|
426
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
427
|
+
};
|
|
428
|
+
}, [ref]);
|
|
429
|
+
}
|
|
430
|
+
|
|
396
431
|
var ListMenu = function ListMenu(_ref) {
|
|
397
432
|
var options = _ref.options,
|
|
398
433
|
onSelected = _ref.onSelected,
|
|
@@ -445,12 +480,57 @@ var ItemCard = function ItemCard(_ref) {
|
|
|
445
480
|
var Container$4 = /*#__PURE__*/styled.div.withConfig({
|
|
446
481
|
displayName: "ItemCard__Container",
|
|
447
482
|
componentId: "sc-170rits-0"
|
|
448
|
-
})(["position:absolute;top:", "px;left:", "px;font-size:
|
|
483
|
+
})(["position:absolute;top:", "px;left:", "px;font-size:0.5rem;color:white;background-color:black;border-radius:5px;padding:0.5rem;min-width:20px;opacity:0.5;"], function (props) {
|
|
449
484
|
return props.y || 0;
|
|
450
485
|
}, function (props) {
|
|
451
486
|
return props.x || 0;
|
|
452
487
|
});
|
|
453
488
|
|
|
489
|
+
var handleContextMenuList = function handleContextMenuList(itemType) {
|
|
490
|
+
var generateContextList = function generateContextList(actionsByTypeList) {
|
|
491
|
+
var contextMenu = actionsByTypeList.map(function (action) {
|
|
492
|
+
return {
|
|
493
|
+
id: action,
|
|
494
|
+
text: action
|
|
495
|
+
};
|
|
496
|
+
});
|
|
497
|
+
return contextMenu;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
var contextActionMenu = [];
|
|
501
|
+
|
|
502
|
+
switch (itemType) {
|
|
503
|
+
case shared.ItemType.Weapon:
|
|
504
|
+
case shared.ItemType.Armor:
|
|
505
|
+
case shared.ItemType.Accessory:
|
|
506
|
+
case shared.ItemType.Jewelry:
|
|
507
|
+
case shared.ItemType.Tool:
|
|
508
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Equipment);
|
|
509
|
+
break;
|
|
510
|
+
|
|
511
|
+
case shared.ItemType.Consumable:
|
|
512
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Consumable);
|
|
513
|
+
break;
|
|
514
|
+
|
|
515
|
+
case shared.ItemType.CraftMaterial:
|
|
516
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.CraftMaterial);
|
|
517
|
+
break;
|
|
518
|
+
|
|
519
|
+
case shared.ItemType.Other:
|
|
520
|
+
case shared.ItemType.Information:
|
|
521
|
+
case shared.ItemType.Quest:
|
|
522
|
+
case shared.ItemType.Container:
|
|
523
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Other);
|
|
524
|
+
break;
|
|
525
|
+
|
|
526
|
+
default:
|
|
527
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Other);
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return contextActionMenu;
|
|
532
|
+
};
|
|
533
|
+
|
|
454
534
|
var frames = {
|
|
455
535
|
"accessories/bandana.png": {
|
|
456
536
|
frame: {
|
|
@@ -2203,20 +2283,27 @@ var ItemSlot = function ItemSlot(_ref) {
|
|
|
2203
2283
|
var slotIndex = _ref.slotIndex,
|
|
2204
2284
|
item = _ref.item,
|
|
2205
2285
|
_onMouseOver = _ref.onMouseOver,
|
|
2206
|
-
|
|
2286
|
+
_onClick = _ref.onClick,
|
|
2287
|
+
onCancelContextMenu = _ref.onCancelContextMenu;
|
|
2207
2288
|
|
|
2208
|
-
var
|
|
2289
|
+
var getLeftPositionValue = function getLeftPositionValue(quantity) {
|
|
2209
2290
|
if (quantity > 0 && quantity < 10) return '2.5rem';else if (quantity > 9 && quantity < 100) return '2.0rem';else if (quantity > 99) return '1rem';
|
|
2210
2291
|
return '2.5rem';
|
|
2211
2292
|
};
|
|
2212
2293
|
|
|
2213
2294
|
return React__default.createElement(Container$6, {
|
|
2214
|
-
onContextMenu: function onContextMenu(event) {
|
|
2215
|
-
onActionContextMenu(event, slotIndex);
|
|
2216
|
-
},
|
|
2217
2295
|
className: "rpgui-icon empty-slot",
|
|
2218
2296
|
onMouseOver: function onMouseOver(event) {
|
|
2219
|
-
return _onMouseOver(event, slotIndex, item);
|
|
2297
|
+
return _onMouseOver(event, slotIndex, item, event.clientX, event.clientY);
|
|
2298
|
+
},
|
|
2299
|
+
onClick: function onClick(e) {
|
|
2300
|
+
if (item) {
|
|
2301
|
+
console.log(e);
|
|
2302
|
+
|
|
2303
|
+
_onClick(item, e.clientX, e.clientY);
|
|
2304
|
+
} else {
|
|
2305
|
+
onCancelContextMenu();
|
|
2306
|
+
}
|
|
2220
2307
|
}
|
|
2221
2308
|
}, item && item.texturePath ? React__default.createElement(SpriteFromAtlas, {
|
|
2222
2309
|
atlasIMG: img,
|
|
@@ -2224,7 +2311,7 @@ var ItemSlot = function ItemSlot(_ref) {
|
|
|
2224
2311
|
spriteKey: item.texturePath,
|
|
2225
2312
|
scale: 3
|
|
2226
2313
|
}) : null, item && item.isStackable && item != null && item.stackQty ? React__default.createElement(ItemQty, {
|
|
2227
|
-
left:
|
|
2314
|
+
left: getLeftPositionValue(item.stackQty)
|
|
2228
2315
|
}, ' ', item.stackQty, ' ') : null);
|
|
2229
2316
|
};
|
|
2230
2317
|
var Container$6 = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -2242,181 +2329,158 @@ var ItemContainer = function ItemContainer(_ref) {
|
|
|
2242
2329
|
var itemContainer = _ref.itemContainer,
|
|
2243
2330
|
onClose = _ref.onClose,
|
|
2244
2331
|
onMouseOver = _ref.onMouseOver,
|
|
2245
|
-
onActionSelected = _ref.onActionSelected
|
|
2332
|
+
onActionSelected = _ref.onActionSelected,
|
|
2333
|
+
_ref$initialPosition = _ref.initialPosition,
|
|
2334
|
+
initialPosition = _ref$initialPosition === void 0 ? {
|
|
2335
|
+
x: 0,
|
|
2336
|
+
y: 0
|
|
2337
|
+
} : _ref$initialPosition;
|
|
2338
|
+
|
|
2339
|
+
// we use this draggable position to offset the menu position, after the container is dragged (otherwise, it bugs!)
|
|
2340
|
+
var _useState = React.useState(initialPosition),
|
|
2341
|
+
draggablePosition = _useState[0],
|
|
2342
|
+
setDraggablePosition = _useState[1];
|
|
2343
|
+
|
|
2344
|
+
var draggableRef = React.useRef(null);
|
|
2345
|
+
useOutsideClick(draggableRef, 'item-container');
|
|
2346
|
+
React.useEffect(function () {
|
|
2347
|
+
document.addEventListener('clickOutside', function (event) {
|
|
2348
|
+
var e = event;
|
|
2349
|
+
|
|
2350
|
+
if (e.detail.id === 'item-container') {
|
|
2351
|
+
clearContextMenu();
|
|
2352
|
+
clearItemHoverDetail();
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
return function () {
|
|
2356
|
+
document.removeEventListener('clickOutside', function (_e) {});
|
|
2357
|
+
};
|
|
2358
|
+
}, []);
|
|
2359
|
+
var initX = initialPosition.x,
|
|
2360
|
+
initY = initialPosition.y;
|
|
2246
2361
|
|
|
2247
|
-
var
|
|
2362
|
+
var _useState2 = React.useState({
|
|
2248
2363
|
visible: false,
|
|
2249
|
-
posX:
|
|
2250
|
-
posY:
|
|
2364
|
+
posX: initX,
|
|
2365
|
+
posY: initY,
|
|
2251
2366
|
contextActions: [],
|
|
2252
2367
|
slotItem: null
|
|
2253
2368
|
}),
|
|
2254
|
-
contextData =
|
|
2255
|
-
setContextData =
|
|
2369
|
+
contextData = _useState2[0],
|
|
2370
|
+
setContextData = _useState2[1];
|
|
2256
2371
|
|
|
2257
|
-
var
|
|
2372
|
+
var _useState3 = React.useState({
|
|
2258
2373
|
visible: false,
|
|
2259
|
-
posX:
|
|
2260
|
-
posY:
|
|
2374
|
+
posX: initX,
|
|
2375
|
+
posY: initY,
|
|
2261
2376
|
item: null
|
|
2262
2377
|
}),
|
|
2263
|
-
itemHoverDetail =
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
});
|
|
2275
|
-
return contextMenu;
|
|
2276
|
-
};
|
|
2277
|
-
|
|
2278
|
-
var contextActionMenu = [];
|
|
2279
|
-
|
|
2280
|
-
switch (itemType) {
|
|
2281
|
-
case shared.ItemType.Weapon:
|
|
2282
|
-
case shared.ItemType.Armor:
|
|
2283
|
-
case shared.ItemType.Accessory:
|
|
2284
|
-
case shared.ItemType.Jewelry:
|
|
2285
|
-
case shared.ItemType.Tool:
|
|
2286
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.Equipment);
|
|
2287
|
-
break;
|
|
2288
|
-
|
|
2289
|
-
case shared.ItemType.Consumable:
|
|
2290
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.Consumable);
|
|
2291
|
-
break;
|
|
2292
|
-
|
|
2293
|
-
case shared.ItemType.CraftMaterial:
|
|
2294
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.CraftMaterial);
|
|
2295
|
-
break;
|
|
2296
|
-
|
|
2297
|
-
case shared.ItemType.Other:
|
|
2298
|
-
case shared.ItemType.Information:
|
|
2299
|
-
case shared.ItemType.Quest:
|
|
2300
|
-
case shared.ItemType.Container:
|
|
2301
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.Other);
|
|
2302
|
-
break;
|
|
2303
|
-
|
|
2304
|
-
default:
|
|
2305
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.Other);
|
|
2306
|
-
break;
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
return contextActionMenu;
|
|
2378
|
+
itemHoverDetail = _useState3[0],
|
|
2379
|
+
setItemHoverDetail = _useState3[1];
|
|
2380
|
+
|
|
2381
|
+
var clearContextMenu = function clearContextMenu() {
|
|
2382
|
+
setContextData({
|
|
2383
|
+
visible: false,
|
|
2384
|
+
posX: 0,
|
|
2385
|
+
posY: 0,
|
|
2386
|
+
contextActions: [],
|
|
2387
|
+
slotItem: null
|
|
2388
|
+
});
|
|
2310
2389
|
};
|
|
2311
2390
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
var itemData = (_itemContainer$slots$ = (_itemContainer$slots = itemContainer.slots) == null ? void 0 : _itemContainer$slots[selectedSlotContext]) != null ? _itemContainer$slots$ : null;
|
|
2320
|
-
|
|
2321
|
-
if (itemData) {
|
|
2322
|
-
// TODO: generate a menuActionList based on type and subType of the item.
|
|
2323
|
-
var contextActionMenu = handleContextMenuList(itemData.type);
|
|
2324
|
-
setContextData(_extends({}, contextData, {
|
|
2325
|
-
visible: true,
|
|
2326
|
-
posX: event.clientX,
|
|
2327
|
-
posY: event.clientY,
|
|
2328
|
-
slotItem: itemData,
|
|
2329
|
-
contextActions: contextActionMenu
|
|
2330
|
-
}));
|
|
2331
|
-
} else {
|
|
2332
|
-
// console.log("Empty Slot")
|
|
2333
|
-
setContextData(_extends({}, contextData, {
|
|
2334
|
-
visible: false,
|
|
2335
|
-
posX: 0,
|
|
2336
|
-
posY: 0,
|
|
2337
|
-
slotIndex: null,
|
|
2338
|
-
slotItem: null,
|
|
2339
|
-
contextActions: []
|
|
2340
|
-
}));
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
|
|
2345
|
-
var offClickHandler = function offClickHandler(event) {
|
|
2346
|
-
console.log(event);
|
|
2347
|
-
setContextData(_extends({}, contextData, {
|
|
2348
|
-
visible: false,
|
|
2349
|
-
posX: 0,
|
|
2350
|
-
posY: 0,
|
|
2351
|
-
slotIndex: null,
|
|
2352
|
-
slotItem: null
|
|
2391
|
+
var handleOnMouseHover = function handleOnMouseHover(event, slotIndex, item, x, y) {
|
|
2392
|
+
if (item) {
|
|
2393
|
+
setItemHoverDetail(_extends({}, itemHoverDetail, {
|
|
2394
|
+
visible: true,
|
|
2395
|
+
item: item,
|
|
2396
|
+
posX: x - draggablePosition.x,
|
|
2397
|
+
posY: y - draggablePosition.y
|
|
2353
2398
|
}));
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
document.removeEventListener('contextmenu', contextMenuEventHandler);
|
|
2360
|
-
document.removeEventListener('click', offClickHandler);
|
|
2361
|
-
};
|
|
2362
|
-
}, [contextData, selectedSlotContext]);
|
|
2399
|
+
onMouseOver(event, slotIndex, item);
|
|
2400
|
+
} else {
|
|
2401
|
+
clearItemHoverDetail();
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2363
2404
|
|
|
2364
|
-
var
|
|
2365
|
-
|
|
2366
|
-
|
|
2405
|
+
var clearItemHoverDetail = function clearItemHoverDetail() {
|
|
2406
|
+
setItemHoverDetail(_extends({}, itemHoverDetail, {
|
|
2407
|
+
visible: false,
|
|
2408
|
+
item: null
|
|
2409
|
+
}));
|
|
2367
2410
|
};
|
|
2368
2411
|
|
|
2369
|
-
var
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2412
|
+
var handleOnItemClick = function handleOnItemClick(item, posX, posY) {
|
|
2413
|
+
var contextList = handleContextMenuList(item.type);
|
|
2414
|
+
setContextData(_extends({}, contextData, {
|
|
2415
|
+
visible: true,
|
|
2416
|
+
posX: posX,
|
|
2417
|
+
posY: posY,
|
|
2418
|
+
slotItem: item,
|
|
2419
|
+
contextActions: contextList
|
|
2420
|
+
}));
|
|
2421
|
+
clearItemHoverDetail();
|
|
2374
2422
|
};
|
|
2375
2423
|
|
|
2376
2424
|
var onSelected = function onSelected(selectedActionId) {
|
|
2377
2425
|
var payloadData = {
|
|
2378
2426
|
actionType: selectedActionId,
|
|
2379
2427
|
item: contextData.slotItem
|
|
2380
|
-
};
|
|
2381
|
-
|
|
2428
|
+
};
|
|
2382
2429
|
onActionSelected(payloadData);
|
|
2430
|
+
clearContextMenu();
|
|
2383
2431
|
};
|
|
2384
2432
|
|
|
2385
2433
|
var onRenderSlots = function onRenderSlots() {
|
|
2386
2434
|
var slots = [];
|
|
2387
2435
|
|
|
2388
2436
|
for (var i = 0; i < itemContainer.slotQty; i++) {
|
|
2389
|
-
var _itemContainer$
|
|
2437
|
+
var _itemContainer$slots;
|
|
2390
2438
|
|
|
2391
2439
|
slots.push(React__default.createElement(ItemSlot, {
|
|
2392
2440
|
key: i,
|
|
2393
2441
|
slotIndex: i,
|
|
2394
|
-
item: ((_itemContainer$
|
|
2442
|
+
item: ((_itemContainer$slots = itemContainer.slots) == null ? void 0 : _itemContainer$slots[i]) || null,
|
|
2395
2443
|
onMouseOver: handleOnMouseHover,
|
|
2396
|
-
|
|
2444
|
+
onClick: handleOnItemClick,
|
|
2445
|
+
onCancelContextMenu: function onCancelContextMenu() {
|
|
2446
|
+
clearContextMenu();
|
|
2447
|
+
}
|
|
2397
2448
|
}));
|
|
2398
2449
|
}
|
|
2399
2450
|
|
|
2400
2451
|
return slots;
|
|
2401
2452
|
};
|
|
2402
2453
|
|
|
2403
|
-
return React__default.createElement(
|
|
2454
|
+
return React__default.createElement("div", {
|
|
2455
|
+
ref: draggableRef
|
|
2456
|
+
}, React__default.createElement(DraggableContainer, {
|
|
2404
2457
|
title: itemContainer.name || 'Container',
|
|
2405
2458
|
type: exports.RPGUIContainerTypes.Framed,
|
|
2406
2459
|
onCloseButton: function onCloseButton() {
|
|
2407
2460
|
return onClose();
|
|
2408
2461
|
},
|
|
2409
|
-
width: "330px"
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2462
|
+
width: "330px",
|
|
2463
|
+
cancelDrag: ".item-container-body",
|
|
2464
|
+
onPositionChange: function onPositionChange(_ref2) {
|
|
2465
|
+
var x = _ref2.x,
|
|
2466
|
+
y = _ref2.y;
|
|
2467
|
+
setDraggablePosition({
|
|
2468
|
+
x: x,
|
|
2469
|
+
y: y
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2472
|
+
}, React__default.createElement(ItemsContainer, {
|
|
2473
|
+
className: "item-container-body"
|
|
2474
|
+
}, onRenderSlots()), contextData.visible ? React__default.createElement(ListMenu, {
|
|
2475
|
+
x: contextData.posX - draggablePosition.x,
|
|
2476
|
+
y: contextData.posY - draggablePosition.y,
|
|
2413
2477
|
options: contextData.contextActions,
|
|
2414
2478
|
onSelected: onSelected
|
|
2415
2479
|
}) : null, itemHoverDetail.visible ? React__default.createElement(ItemCard, {
|
|
2416
2480
|
item: itemHoverDetail.item,
|
|
2417
2481
|
x: itemHoverDetail.posX,
|
|
2418
2482
|
y: itemHoverDetail.posY
|
|
2419
|
-
}) : null);
|
|
2483
|
+
}) : null));
|
|
2420
2484
|
};
|
|
2421
2485
|
var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
2422
2486
|
displayName: "ItemContainer__ItemsContainer",
|