@rpg-engine/long-bow 0.5.8 → 0.5.10
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/Leaderboard/Leaderboard.d.ts +5 -3
- package/dist/components/Leaderboard/LeaderboardTable.d.ts +2 -2
- package/dist/long-bow.cjs.development.js +58 -19
- 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 +58 -19
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/leaderboard.mocks.d.ts +4 -4
- package/package.json +2 -2
- package/src/components/Item/Inventory/ItemContainer.tsx +54 -4
- package/src/components/Leaderboard/Leaderboard.tsx +41 -24
- package/src/components/Leaderboard/LeaderboardTable.tsx +6 -3
- package/src/mocks/itemContainer.mocks.ts +2 -1
- package/src/mocks/leaderboard.mocks.ts +116 -107
- package/src/stories/Leaderboard.stories.tsx +16 -10
package/dist/long-bow.esm.js
CHANGED
|
@@ -15578,6 +15578,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
15578
15578
|
isDepotSystem = _ref.isDepotSystem,
|
|
15579
15579
|
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
15580
15580
|
onPositionChangeStart = _ref.onPositionChangeStart;
|
|
15581
|
+
var MAX_SLOTS_PER_PAGE = 20;
|
|
15581
15582
|
var _useState = useState({
|
|
15582
15583
|
isOpen: false,
|
|
15583
15584
|
maxQuantity: 1,
|
|
@@ -15588,6 +15589,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
15588
15589
|
var _useState2 = useState(-1),
|
|
15589
15590
|
settingShortcutIndex = _useState2[0],
|
|
15590
15591
|
setSettingShortcutIndex = _useState2[1];
|
|
15592
|
+
var _useState3 = useState(1),
|
|
15593
|
+
currentPage = _useState3[0],
|
|
15594
|
+
setCurrentPage = _useState3[1];
|
|
15595
|
+
var totalPages = Math.ceil(itemContainer.slotQty / MAX_SLOTS_PER_PAGE);
|
|
15591
15596
|
var handleSetShortcut = function handleSetShortcut(item, index) {
|
|
15592
15597
|
if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
|
|
15593
15598
|
setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
|
|
@@ -15595,7 +15600,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
15595
15600
|
};
|
|
15596
15601
|
var onRenderSlots = function onRenderSlots() {
|
|
15597
15602
|
var slots = [];
|
|
15598
|
-
|
|
15603
|
+
var start = (currentPage - 1) * MAX_SLOTS_PER_PAGE;
|
|
15604
|
+
var end = start + MAX_SLOTS_PER_PAGE;
|
|
15605
|
+
for (var i = start; i < end && i < itemContainer.slotQty; i++) {
|
|
15599
15606
|
var _itemContainer$slots;
|
|
15600
15607
|
slots.push(React.createElement(ItemSlot, {
|
|
15601
15608
|
isContextMenuDisabled: disableContextMenu,
|
|
@@ -15647,6 +15654,16 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
15647
15654
|
}
|
|
15648
15655
|
return slots;
|
|
15649
15656
|
};
|
|
15657
|
+
var goToNextPage = function goToNextPage() {
|
|
15658
|
+
setCurrentPage(function (current) {
|
|
15659
|
+
return Math.min(current + 1, totalPages);
|
|
15660
|
+
});
|
|
15661
|
+
};
|
|
15662
|
+
var goToPreviousPage = function goToPreviousPage() {
|
|
15663
|
+
setCurrentPage(function (current) {
|
|
15664
|
+
return Math.max(current - 1, 1);
|
|
15665
|
+
});
|
|
15666
|
+
};
|
|
15650
15667
|
return React.createElement(React.Fragment, null, React.createElement(SlotsContainer, {
|
|
15651
15668
|
title: itemContainer.name || 'Container',
|
|
15652
15669
|
onClose: onClose,
|
|
@@ -15663,7 +15680,23 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
15663
15680
|
atlasJSON: atlasJSON
|
|
15664
15681
|
}), React.createElement(ItemsContainer, {
|
|
15665
15682
|
className: "item-container-body"
|
|
15666
|
-
}, onRenderSlots())
|
|
15683
|
+
}, onRenderSlots()), totalPages > 1 && React.createElement(ArrowContainer$1, null, React.createElement(SelectArrow, {
|
|
15684
|
+
className: 'arrow .arrow-up',
|
|
15685
|
+
direction: "left",
|
|
15686
|
+
onPointerDown: function onPointerDown() {
|
|
15687
|
+
if (currentPage > 1) {
|
|
15688
|
+
goToPreviousPage();
|
|
15689
|
+
}
|
|
15690
|
+
}
|
|
15691
|
+
}), React.createElement(SelectArrow, {
|
|
15692
|
+
className: 'arrow .arrow-down',
|
|
15693
|
+
direction: "right",
|
|
15694
|
+
onPointerDown: function onPointerDown() {
|
|
15695
|
+
if (currentPage < totalPages) {
|
|
15696
|
+
goToNextPage();
|
|
15697
|
+
}
|
|
15698
|
+
}
|
|
15699
|
+
}))), quantitySelect.isOpen && React.createElement(ModalPortal, null, React.createElement(QuantitySelectorContainer, null, React.createElement(ItemQuantitySelector, {
|
|
15667
15700
|
quantity: quantitySelect.maxQuantity,
|
|
15668
15701
|
onConfirm: function onConfirm(quantity) {
|
|
15669
15702
|
quantitySelect.callback(quantity);
|
|
@@ -15691,6 +15724,10 @@ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
15691
15724
|
displayName: "ItemContainer__QuantitySelectorContainer",
|
|
15692
15725
|
componentId: "sc-15y5p9l-1"
|
|
15693
15726
|
})(["position:absolute;top:0;left:0;width:100vw;height:100vh;z-index:100;display:flex;justify-content:center;align-items:center;background-color:rgba(0,0,0,0.5);"]);
|
|
15727
|
+
var ArrowContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
15728
|
+
displayName: "ItemContainer__ArrowContainer",
|
|
15729
|
+
componentId: "sc-15y5p9l-2"
|
|
15730
|
+
})(["margin-top:10px;margin-bottom:30px;span:first-child{margin-left:20px;}span:last-child{margin-right:20px;}"]);
|
|
15694
15731
|
|
|
15695
15732
|
var LeaderboardTable = function LeaderboardTable(props) {
|
|
15696
15733
|
var items = props.items,
|
|
@@ -15738,33 +15775,35 @@ var TableRowValue = /*#__PURE__*/styled.td.withConfig({
|
|
|
15738
15775
|
componentId: "sc-kk017f-1"
|
|
15739
15776
|
})(["padding:0 20px;"]);
|
|
15740
15777
|
|
|
15741
|
-
var rankTypeOptions = /*#__PURE__*/['Level', 'Class', 'Skill'].map(function (itemType, index) {
|
|
15742
|
-
return {
|
|
15743
|
-
id: index + 1,
|
|
15744
|
-
value: itemType,
|
|
15745
|
-
option: itemType
|
|
15746
|
-
};
|
|
15747
|
-
});
|
|
15748
|
-
var classTypeOptions = /*#__PURE__*/Object.keys(CharacterClass).map(function (itemType, index) {
|
|
15749
|
-
return {
|
|
15750
|
-
id: index + 1,
|
|
15751
|
-
value: itemType,
|
|
15752
|
-
option: itemType
|
|
15753
|
-
};
|
|
15754
|
-
});
|
|
15755
15778
|
var Leaderboard = function Leaderboard(props) {
|
|
15756
15779
|
var items = props.items,
|
|
15757
15780
|
onChangeRankType = props.onChangeRankType,
|
|
15758
15781
|
onChangeClassType = props.onChangeClassType,
|
|
15759
15782
|
rankType = props.rankType,
|
|
15760
|
-
|
|
15761
|
-
onChangeSkillType = props.onChangeSkillType
|
|
15783
|
+
skillOptions = props.skillOptions,
|
|
15784
|
+
onChangeSkillType = props.onChangeSkillType,
|
|
15785
|
+
classOptions = props.classOptions,
|
|
15786
|
+
rankOptions = props.rankOptions;
|
|
15762
15787
|
var itemsContainer = useRef(null);
|
|
15763
15788
|
useEffect(function () {
|
|
15764
15789
|
var _itemsContainer$curre;
|
|
15765
15790
|
(_itemsContainer$curre = itemsContainer.current) == null ? void 0 : _itemsContainer$curre.scrollTo(0, 0);
|
|
15766
15791
|
}, []);
|
|
15767
|
-
var
|
|
15792
|
+
var rankTypeOptions = rankOptions.map(function (itemType, index) {
|
|
15793
|
+
return {
|
|
15794
|
+
id: index + 1,
|
|
15795
|
+
value: itemType,
|
|
15796
|
+
option: itemType
|
|
15797
|
+
};
|
|
15798
|
+
});
|
|
15799
|
+
var skillTypeOptions = skillOptions.map(function (itemType, index) {
|
|
15800
|
+
return {
|
|
15801
|
+
id: index + 1,
|
|
15802
|
+
value: itemType,
|
|
15803
|
+
option: itemType
|
|
15804
|
+
};
|
|
15805
|
+
});
|
|
15806
|
+
var classTypeOptions = classOptions.map(function (itemType, index) {
|
|
15768
15807
|
return {
|
|
15769
15808
|
id: index + 1,
|
|
15770
15809
|
value: itemType,
|