@castlabs/ui 7.21.0 → 7.21.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.
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v7.21.0 */
1
+ /* @castlabs/ui v7.21.2 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -1574,7 +1574,7 @@ export function clTableSorter (sorter, initialCol = 0, initialOrder = 'ASC') {
1574
1574
  *
1575
1575
  * @param dataCallback Function that returns the to-be-sorted object array.
1576
1576
  * @param keys Columns/keys in object to sort.
1577
- * @param initialCol Initial column to sort for.
1577
+ * @param initialCol Initial column to sort for, zero Based. If negative, sort reverse (1-based).
1578
1578
  * @param pageNo Pagination page, zero-based.
1579
1579
  * @param pageSize Pagination page size, defaults to 'one big page'.
1580
1580
  * @returns Object expeced by table sort.
@@ -1586,16 +1586,20 @@ export function clTableSorterObjects (
1586
1586
  pageNoCallback = () => 0,
1587
1587
  pageSizeCallback = () => Number.MAX_SAFE_INTEGER
1588
1588
  ) {
1589
- return clTableSorter((col, order) => {
1590
- return {
1591
- sorted: clPaginate(
1592
- clSort(dataCallback, keys[col], order),
1593
- pageNoCallback(),
1594
- pageSizeCallback()
1595
- ),
1596
- sortedOrder: order
1597
- }
1598
- }, initialCol)
1589
+ return clTableSorter(
1590
+ (col, order) => {
1591
+ return {
1592
+ sorted: clPaginate(
1593
+ clSort(dataCallback, keys[col], order),
1594
+ pageNoCallback(),
1595
+ pageSizeCallback()
1596
+ ),
1597
+ sortedOrder: order
1598
+ }
1599
+ },
1600
+ initialCol >= 0 ? initialCol : initialCol * -1 - 1,
1601
+ initialCol >= 0 ? 'ASC' : 'DESC'
1602
+ )
1599
1603
  }
1600
1604
 
1601
1605
  // -----------------------------------------------------------------------------