@civicactions/cmsds-open-data-components 4.1.7-alpha.1 → 4.1.7-alpha.2

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/main.js CHANGED
@@ -2620,13 +2620,12 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
2620
2620
  ]);
2621
2621
  // keep state in sync
2622
2622
  (0, $hgUW1$useEffect)(()=>{
2623
- if (columnOrder?.length) setCards(columnOrder.map((c)=>{
2624
- const column = columns.filter((col)=>col.id === c)[0];
2625
- return {
2623
+ if (columnOrder?.length) setCards(columnOrder.map((id)=>columns.find((col)=>col.id === id)) // Get list of cards in order
2624
+ .filter(Boolean) // Filter out an possible undefined/non-matches
2625
+ .map((column)=>({
2626
2626
  id: column.id,
2627
2627
  visible: column.getIsVisible()
2628
- };
2629
- }));
2628
+ })));
2630
2629
  }, [
2631
2630
  columnOrder
2632
2631
  ]);
@@ -2762,13 +2761,12 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
2762
2761
  onClick: ()=>{
2763
2762
  // reset to default column order and set all cards to visible
2764
2763
  // do not save this to the table state until the "Save" button is clicked
2765
- setCards(defaultColumnOrder.map((column)=>{
2766
- const card = cards.filter((c)=>c.id === column)[0];
2767
- return {
2764
+ setCards(defaultColumnOrder.map((id)=>cards.find((c)=>c.id === id)) // Get list of cards in order
2765
+ .filter(Boolean) // Filter out an possible undefined/non-matches
2766
+ .map((card)=>({
2768
2767
  ...card,
2769
2768
  visible: true
2770
- };
2771
- }));
2769
+ })));
2772
2770
  },
2773
2771
  children: "Reset Columns"
2774
2772
  })