@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.
@@ -1,11 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { TopCharacterEntry, TopSkillEntry } from '@rpg-engine/shared';
2
+ import { IRankingTopCharacterEntry, IRankingTopSkillEntry } from '@rpg-engine/shared';
3
3
  export interface ILeaderboardProps {
4
- items: Set<TopCharacterEntry> | Set<TopSkillEntry> | null;
4
+ items: Set<IRankingTopCharacterEntry> | Set<IRankingTopSkillEntry> | null;
5
5
  onChangeClassType: (value: string) => void;
6
6
  onChangeRankType: (value: string) => void;
7
7
  onChangeSkillType: (value: string) => void;
8
- skills: string[];
8
+ skillOptions: string[];
9
+ rankOptions: string[];
10
+ classOptions: string[];
9
11
  rankType: string;
10
12
  }
11
13
  export declare const Leaderboard: (props: ILeaderboardProps) => JSX.Element;
@@ -1,7 +1,7 @@
1
- import { TopCharacterEntry, TopSkillEntry } from '@rpg-engine/shared';
1
+ import { IRankingTopCharacterEntry, IRankingTopSkillEntry } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  export interface ILeaderboardLevelProps {
4
- items: Set<TopCharacterEntry> | Set<TopSkillEntry> | null;
4
+ items: Set<IRankingTopCharacterEntry> | Set<IRankingTopSkillEntry> | null;
5
5
  rankType: string;
6
6
  }
7
7
  export declare const LeaderboardTable: React.FC<ILeaderboardLevelProps>;
@@ -15580,6 +15580,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15580
15580
  isDepotSystem = _ref.isDepotSystem,
15581
15581
  onPositionChangeEnd = _ref.onPositionChangeEnd,
15582
15582
  onPositionChangeStart = _ref.onPositionChangeStart;
15583
+ var MAX_SLOTS_PER_PAGE = 20;
15583
15584
  var _useState = React.useState({
15584
15585
  isOpen: false,
15585
15586
  maxQuantity: 1,
@@ -15590,6 +15591,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15590
15591
  var _useState2 = React.useState(-1),
15591
15592
  settingShortcutIndex = _useState2[0],
15592
15593
  setSettingShortcutIndex = _useState2[1];
15594
+ var _useState3 = React.useState(1),
15595
+ currentPage = _useState3[0],
15596
+ setCurrentPage = _useState3[1];
15597
+ var totalPages = Math.ceil(itemContainer.slotQty / MAX_SLOTS_PER_PAGE);
15593
15598
  var handleSetShortcut = function handleSetShortcut(item, index) {
15594
15599
  if (item.type === shared.ItemType.Consumable || item.type === shared.ItemType.Tool) {
15595
15600
  setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
@@ -15597,7 +15602,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15597
15602
  };
15598
15603
  var onRenderSlots = function onRenderSlots() {
15599
15604
  var slots = [];
15600
- for (var i = 0; i < itemContainer.slotQty; i++) {
15605
+ var start = (currentPage - 1) * MAX_SLOTS_PER_PAGE;
15606
+ var end = start + MAX_SLOTS_PER_PAGE;
15607
+ for (var i = start; i < end && i < itemContainer.slotQty; i++) {
15601
15608
  var _itemContainer$slots;
15602
15609
  slots.push(React__default.createElement(ItemSlot, {
15603
15610
  isContextMenuDisabled: disableContextMenu,
@@ -15649,6 +15656,16 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15649
15656
  }
15650
15657
  return slots;
15651
15658
  };
15659
+ var goToNextPage = function goToNextPage() {
15660
+ setCurrentPage(function (current) {
15661
+ return Math.min(current + 1, totalPages);
15662
+ });
15663
+ };
15664
+ var goToPreviousPage = function goToPreviousPage() {
15665
+ setCurrentPage(function (current) {
15666
+ return Math.max(current - 1, 1);
15667
+ });
15668
+ };
15652
15669
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(SlotsContainer, {
15653
15670
  title: itemContainer.name || 'Container',
15654
15671
  onClose: onClose,
@@ -15665,7 +15682,23 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15665
15682
  atlasJSON: atlasJSON
15666
15683
  }), React__default.createElement(ItemsContainer, {
15667
15684
  className: "item-container-body"
15668
- }, onRenderSlots())), quantitySelect.isOpen && React__default.createElement(ModalPortal, null, React__default.createElement(QuantitySelectorContainer, null, React__default.createElement(ItemQuantitySelector, {
15685
+ }, onRenderSlots()), totalPages > 1 && React__default.createElement(ArrowContainer$1, null, React__default.createElement(SelectArrow, {
15686
+ className: 'arrow .arrow-up',
15687
+ direction: "left",
15688
+ onPointerDown: function onPointerDown() {
15689
+ if (currentPage > 1) {
15690
+ goToPreviousPage();
15691
+ }
15692
+ }
15693
+ }), React__default.createElement(SelectArrow, {
15694
+ className: 'arrow .arrow-down',
15695
+ direction: "right",
15696
+ onPointerDown: function onPointerDown() {
15697
+ if (currentPage < totalPages) {
15698
+ goToNextPage();
15699
+ }
15700
+ }
15701
+ }))), quantitySelect.isOpen && React__default.createElement(ModalPortal, null, React__default.createElement(QuantitySelectorContainer, null, React__default.createElement(ItemQuantitySelector, {
15669
15702
  quantity: quantitySelect.maxQuantity,
15670
15703
  onConfirm: function onConfirm(quantity) {
15671
15704
  quantitySelect.callback(quantity);
@@ -15693,6 +15726,10 @@ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
15693
15726
  displayName: "ItemContainer__QuantitySelectorContainer",
15694
15727
  componentId: "sc-15y5p9l-1"
15695
15728
  })(["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);"]);
15729
+ var ArrowContainer$1 = /*#__PURE__*/styled.div.withConfig({
15730
+ displayName: "ItemContainer__ArrowContainer",
15731
+ componentId: "sc-15y5p9l-2"
15732
+ })(["margin-top:10px;margin-bottom:30px;span:first-child{margin-left:20px;}span:last-child{margin-right:20px;}"]);
15696
15733
 
15697
15734
  var LeaderboardTable = function LeaderboardTable(props) {
15698
15735
  var items = props.items,
@@ -15740,33 +15777,35 @@ var TableRowValue = /*#__PURE__*/styled.td.withConfig({
15740
15777
  componentId: "sc-kk017f-1"
15741
15778
  })(["padding:0 20px;"]);
15742
15779
 
15743
- var rankTypeOptions = /*#__PURE__*/['Level', 'Class', 'Skill'].map(function (itemType, index) {
15744
- return {
15745
- id: index + 1,
15746
- value: itemType,
15747
- option: itemType
15748
- };
15749
- });
15750
- var classTypeOptions = /*#__PURE__*/Object.keys(shared.CharacterClass).map(function (itemType, index) {
15751
- return {
15752
- id: index + 1,
15753
- value: itemType,
15754
- option: itemType
15755
- };
15756
- });
15757
15780
  var Leaderboard = function Leaderboard(props) {
15758
15781
  var items = props.items,
15759
15782
  onChangeRankType = props.onChangeRankType,
15760
15783
  onChangeClassType = props.onChangeClassType,
15761
15784
  rankType = props.rankType,
15762
- skills = props.skills,
15763
- onChangeSkillType = props.onChangeSkillType;
15785
+ skillOptions = props.skillOptions,
15786
+ onChangeSkillType = props.onChangeSkillType,
15787
+ classOptions = props.classOptions,
15788
+ rankOptions = props.rankOptions;
15764
15789
  var itemsContainer = React.useRef(null);
15765
15790
  React.useEffect(function () {
15766
15791
  var _itemsContainer$curre;
15767
15792
  (_itemsContainer$curre = itemsContainer.current) == null ? void 0 : _itemsContainer$curre.scrollTo(0, 0);
15768
15793
  }, []);
15769
- var skillTypeOptions = skills.map(function (itemType, index) {
15794
+ var rankTypeOptions = rankOptions.map(function (itemType, index) {
15795
+ return {
15796
+ id: index + 1,
15797
+ value: itemType,
15798
+ option: itemType
15799
+ };
15800
+ });
15801
+ var skillTypeOptions = skillOptions.map(function (itemType, index) {
15802
+ return {
15803
+ id: index + 1,
15804
+ value: itemType,
15805
+ option: itemType
15806
+ };
15807
+ });
15808
+ var classTypeOptions = classOptions.map(function (itemType, index) {
15770
15809
  return {
15771
15810
  id: index + 1,
15772
15811
  value: itemType,