@castlabs/ui 7.20.1 → 7.21.1

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.
@@ -9,6 +9,7 @@ declare module '@castlabs/ui/dist/castlabs-ui.module.js' {
9
9
  export function clModalShow (id: string, value?: any): void
10
10
  export function clModalValue (id: string): any
11
11
  export function clModalIsShown (id?: string): boolean
12
+ export function clModalBack (to: any): boolean
12
13
 
13
14
  export function clPaginate (array: any[], pageNo?: number, pageSize?: number): any[]
14
15
 
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v7.20.1 */
1
+ /* @castlabs/ui v7.21.1 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -385,10 +385,10 @@ const SERVICE = {
385
385
  PP_URN_REACTNATIVE: 'urn:janus:service:6efecac3ac04477e9b36d3d14e0ae257',
386
386
  PP_URN_WEBRTC: 'urn:janus:service:250402eb2e2d47118422ba4f2334ee54',
387
387
  VTK: 'Video Toolkit',
388
- VTK_TAGLINE: 'Cloud encoding, packaging, watermarking',
388
+ VTK_TAGLINE: 'Cloud content processing',
389
389
  VTK_URN: 'urn:janus:service:a50e21d6a5e246809b636854abfbd34d',
390
390
  VTKS: 'Video Toolkit Staging',
391
- VTKS_TAGLINE: 'Cloud encoding, packaging, watermarking',
391
+ VTKS_TAGLINE: 'Cloud content processing',
392
392
  VTKS_URN: 'urn:janus:service:ca5bb34e8f39459796778e74fa097248',
393
393
  WM: 'STARDUSTmark',
394
394
  WM_TAGLINE: 'Video & image forensic watermarking',
@@ -1036,6 +1036,23 @@ export function clModalIsShown (modalId) {
1036
1036
  return modal.id === modalId && modal._isShown
1037
1037
  }
1038
1038
 
1039
+ /**
1040
+ * Handle navigation events for modals. Back closes modal.
1041
+ *
1042
+ * @param to Vue's to-route.
1043
+ * @returns True if a modal was closed instead of navigating away.
1044
+ */
1045
+ export function clModalBack (to) {
1046
+ if (clModalIsShown()) {
1047
+ clModalHide()
1048
+ if (to.meta?.ignoreModal) {
1049
+ return false
1050
+ }
1051
+ return true
1052
+ }
1053
+ return false
1054
+ }
1055
+
1039
1056
  // -----------------------------------------------------------------------------
1040
1057
  // --- paginator ---------------------------------------------------------------
1041
1058
  // -----------------------------------------------------------------------------
@@ -1557,7 +1574,7 @@ export function clTableSorter (sorter, initialCol = 0, initialOrder = 'ASC') {
1557
1574
  *
1558
1575
  * @param dataCallback Function that returns the to-be-sorted object array.
1559
1576
  * @param keys Columns/keys in object to sort.
1560
- * @param initialCol Initial column to sort for.
1577
+ * @param initialCol Initial column to sort for, zero Based. If negative, sort reverse (1-based).
1561
1578
  * @param pageNo Pagination page, zero-based.
1562
1579
  * @param pageSize Pagination page size, defaults to 'one big page'.
1563
1580
  * @returns Object expeced by table sort.
@@ -1569,16 +1586,20 @@ export function clTableSorterObjects (
1569
1586
  pageNoCallback = () => 0,
1570
1587
  pageSizeCallback = () => Number.MAX_SAFE_INTEGER
1571
1588
  ) {
1572
- return clTableSorter((col, order) => {
1573
- return {
1574
- sorted: clPaginate(
1575
- clSort(dataCallback, keys[col], order),
1576
- pageNoCallback(),
1577
- pageSizeCallback()
1578
- ),
1579
- sortedOrder: order
1580
- }
1581
- }, 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
+ )
1582
1603
  }
1583
1604
 
1584
1605
  // -----------------------------------------------------------------------------