@gen3/frontend 0.11.17 → 0.11.19

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.
Files changed (107) hide show
  1. package/dist/cjs/index.js +627 -383
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/Content/TextContent.d.ts.map +1 -1
  4. package/dist/dts/components/Content/TextContent.js +7 -8
  5. package/dist/dts/components/Content/TextContent.js.map +1 -1
  6. package/dist/dts/components/Details/DetailsDrawer.d.ts +2 -2
  7. package/dist/dts/components/Details/DetailsDrawer.d.ts.map +1 -1
  8. package/dist/dts/components/Details/DetailsDrawer.js +2 -2
  9. package/dist/dts/components/Details/DetailsDrawer.js.map +1 -1
  10. package/dist/dts/components/Layout/TexturedSidePanel.js +1 -1
  11. package/dist/dts/components/Layout/TexturedSidePanel.js.map +1 -1
  12. package/dist/dts/components/Providers/Gen3Provider.d.ts +1 -1
  13. package/dist/dts/components/charts/Charts.d.ts.map +1 -1
  14. package/dist/dts/components/charts/Charts.js +14 -12
  15. package/dist/dts/components/charts/Charts.js.map +1 -1
  16. package/dist/dts/components/charts/utils.d.ts +16 -0
  17. package/dist/dts/components/charts/utils.d.ts.map +1 -1
  18. package/dist/dts/components/charts/utils.js +28 -1
  19. package/dist/dts/components/charts/utils.js.map +1 -1
  20. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +4 -4
  21. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts +2 -1
  22. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts.map +1 -1
  23. package/dist/dts/features/CohortBuilder/CohortBuilder.js +5 -3
  24. package/dist/dts/features/CohortBuilder/CohortBuilder.js.map +1 -1
  25. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  26. package/dist/dts/features/CohortBuilder/CohortPanel.js +24 -2
  27. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  28. package/dist/dts/features/CohortBuilder/ExplorerTable/ArrayCellRenderer.d.ts +1 -1
  29. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.d.ts.map +1 -1
  30. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.js +58 -26
  31. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.js.map +1 -1
  32. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/types.d.ts +5 -1
  33. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/types.d.ts.map +1 -1
  34. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.d.ts.map +1 -1
  35. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js +63 -28
  36. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js.map +1 -1
  37. package/dist/dts/features/CohortBuilder/index.d.ts +1 -1
  38. package/dist/dts/features/CohortBuilder/index.d.ts.map +1 -1
  39. package/dist/dts/features/CohortBuilder/index.js +1 -1
  40. package/dist/dts/features/CohortBuilder/index.js.map +1 -1
  41. package/dist/dts/features/CohortBuilder/types.d.ts +1 -0
  42. package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
  43. package/dist/dts/features/CohortBuilder/types.js.map +1 -1
  44. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.d.ts +1 -1
  45. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.d.ts.map +1 -1
  46. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js +21 -14
  47. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js.map +1 -1
  48. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.d.ts.map +1 -1
  49. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.js +1 -0
  50. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.js.map +1 -1
  51. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts +11 -10
  52. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts.map +1 -1
  53. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.js +9 -5
  54. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.js.map +1 -1
  55. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.d.ts +1 -0
  56. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.d.ts.map +1 -1
  57. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.js +21 -6
  58. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.js.map +1 -1
  59. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.d.ts.map +1 -1
  60. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js +1 -1
  61. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js.map +1 -1
  62. package/dist/dts/features/CohortDiscovery/appApi.js +1 -1
  63. package/dist/dts/features/CohortDiscovery/appApi.js.map +1 -1
  64. package/dist/dts/features/CohortDiscovery/constants.d.ts +2 -0
  65. package/dist/dts/features/CohortDiscovery/constants.d.ts.map +1 -1
  66. package/dist/dts/features/CohortDiscovery/constants.js +11 -0
  67. package/dist/dts/features/CohortDiscovery/constants.js.map +1 -1
  68. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.d.ts.map +1 -1
  69. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.js +2 -1
  70. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.js.map +1 -1
  71. package/dist/dts/features/Dictionary/metadata/types.d.ts +1 -0
  72. package/dist/dts/features/Dictionary/metadata/types.d.ts.map +1 -1
  73. package/dist/dts/features/Discovery/Discovery.d.ts.map +1 -1
  74. package/dist/dts/features/Discovery/Discovery.js +3 -2
  75. package/dist/dts/features/Discovery/Discovery.js.map +1 -1
  76. package/dist/dts/features/Discovery/types.d.ts +1 -0
  77. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  78. package/dist/dts/features/Discovery/types.js.map +1 -1
  79. package/dist/dts/features/Navigation/Footer/FooterColumn.d.ts.map +1 -1
  80. package/dist/dts/features/Navigation/Footer/FooterColumn.js +3 -0
  81. package/dist/dts/features/Navigation/Footer/FooterColumn.js.map +1 -1
  82. package/dist/dts/features/Navigation/Footer/types.d.ts +1 -0
  83. package/dist/dts/features/Navigation/Footer/types.d.ts.map +1 -1
  84. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.d.ts.map +1 -1
  85. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.js +28 -1
  86. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.js.map +1 -1
  87. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.d.ts.map +1 -1
  88. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.js +7 -0
  89. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.js.map +1 -1
  90. package/dist/dts/features/Study/StudyDetails/SinglePageStudyDetailsPanel.js +4 -4
  91. package/dist/dts/features/Study/StudyDetails/SinglePageStudyDetailsPanel.js.map +1 -1
  92. package/dist/dts/features/Study/StudyDetails/StudyItems.d.ts.map +1 -1
  93. package/dist/dts/features/Study/StudyDetails/StudyItems.js +9 -5
  94. package/dist/dts/features/Study/StudyDetails/StudyItems.js.map +1 -1
  95. package/dist/dts/lib/common/staticProps.d.ts.map +1 -1
  96. package/dist/dts/lib/common/staticProps.js +11 -23
  97. package/dist/dts/lib/common/staticProps.js.map +1 -1
  98. package/dist/dts/lib/content/filesystem.js +1 -1
  99. package/dist/dts/lib/content/filesystem.js.map +1 -1
  100. package/dist/dts/pages/Explorer/Explorer.d.ts.map +1 -1
  101. package/dist/dts/pages/Explorer/Explorer.js +4 -1
  102. package/dist/dts/pages/Explorer/Explorer.js.map +1 -1
  103. package/dist/esm/index.js +627 -384
  104. package/dist/esm/index.js.map +1 -1
  105. package/dist/index.d.ts +203 -181
  106. package/dist/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +3 -3
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { createContext, useState, useMemo, useEffect, useCallback, useContext, useRef, createElement, forwardRef, useReducer } from 'react';
4
- import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, fetchFence, isFetchError, WorkspaceStatus, useGetWorkspaceStatusQuery, useGetWorkspacePayModelsQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, selectRequestedWorkspaceStatusTimestamp, useCoreDispatch, setActiveWorkspaceStatus, RequestedWorkspaceStatus, setRequestedWorkspaceStatus, isTimeGreaterThan, useGetCSRFQuery, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, GEN3_FENCE_API, showModal, Modals, isAuthenticated, useGetLoginProvidersQuery, hideModal, selectCurrentModal, fieldNameToTitle, isOperationWithField, selectShouldShareFilters, selectSharedFilters, updateCohortFilter as updateCohortFilter$1, selectIndexedFilterByName, isUnion, isOperatorWithFieldAndArrayOfOperands, extractEnumFilterValue, removeCohortFilter as removeCohortFilter$1, trimFirstFieldNameToTitle, selectAllCohortFiltersCollapsed, Accessibility, toggleCohortBuilderAllFilters, setShouldShareFilters, useIsUserLoggedIn, GEN3_DOMAIN, useDataLibrary, DataLibraryStoreMode, buildListItemsGroupedByDataset, extractFileDatasetsInRecords, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, setCohortFilter as setCohortFilter$1, clearCohortFilters as clearCohortFilters$1, handleOperation, selectAvailableCohorts, selectCurrentCohortId as selectCurrentCohortId$1, selectCohortFilters, selectCurrentCohortModified, selectCurrentCohortSaved, setCohortIndexFilters, setActiveCohort, setCohortFilterCombineMode, selectCohortFilterCombineMode, toggleCohortBuilderCategoryFilter, selectCohortFilterExpanded, selectCurrentCohortName as selectCurrentCohortName$1, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, isJSONValue, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, useGetAggsNoFilterSelfQuery, isIntersection, useGetCountsQuery, setSharedFilters, usePrevious, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, getCurrentTimestamp, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, useSetCurrentPayModelMutation, PodStatus, PodConditionType, isWorkspaceRunningOrStopping, GEN3_API, GEN3_COMMONS_NAME, getTimestamp, createAppStore, getRemoteSupportServiceRegistry, isHttpStatusError, MissingServiceConfigurationError, useLazyGetAggsNoFilterSelfQuery, useCreateRequestMutation, buildGetAggregationQuery, processHistogramResponse, roundHistogramResponse, selectCSRFToken, useUserRequestQuery, getGen3AppId, createGen3AppWithOwnStore, createAppApiForRTKQ, useGetDictionaryQuery, useGetMetadataByIdQuery, createGen3App, CoreProvider, fetchJSONDataFromURL, HttpMethod, groupSharedFields, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetProjectsDetailsQuery, useGetSubmissionsQuery, isCohortItem, isFileItem, fetchFencePresignedURL, HTTPError, getFederatedLoginStatus, queryMultipleMDSRecords, GEN3_MANIFEST_API, extractIndexFromDataLibraryCohort, isFilterSet, getNumberOfItemsInDatalist, isAdditionalDataItem, useLazyGetCrosswalkDataQuery } from '@gen3/core';
4
+ import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, fetchFence, isFetchError, WorkspaceStatus, useGetWorkspaceStatusQuery, useGetWorkspacePayModelsQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, selectRequestedWorkspaceStatusTimestamp, useCoreDispatch, setActiveWorkspaceStatus, RequestedWorkspaceStatus, setRequestedWorkspaceStatus, isTimeGreaterThan, useGetCSRFQuery, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, GEN3_FENCE_API, showModal, Modals, isAuthenticated, useGetLoginProvidersQuery, hideModal, selectCurrentModal, fieldNameToTitle, isOperationWithField, extractEnumFilterValue, selectIndexedFilterByName, selectShouldShareFilters, selectSharedFilters, updateCohortFilter as updateCohortFilter$1, isOperatorWithFieldAndArrayOfOperands, isUnion, removeCohortFilter as removeCohortFilter$1, trimFirstFieldNameToTitle, selectAllCohortFiltersCollapsed, Accessibility, toggleCohortBuilderAllFilters, setShouldShareFilters, useIsUserLoggedIn, GEN3_DOMAIN, useDataLibrary, DataLibraryStoreMode, buildListItemsGroupedByDataset, extractFileDatasetsInRecords, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, setCohortFilter as setCohortFilter$1, clearCohortFilters as clearCohortFilters$1, handleOperation, selectAvailableCohorts, selectCurrentCohortId as selectCurrentCohortId$1, selectCohortFilters, selectCurrentCohortModified, selectCurrentCohortSaved, setCohortIndexFilters, setActiveCohort, toggleCohortBuilderCategoryFilter, selectCohortFilterExpanded, setCohortFilterCombineMode, selectCohortFilterCombineMode, selectCurrentCohortName as selectCurrentCohortName$1, useGetRawDataAndTotalCountsQuery, selectIndexFilters, isJSONValue, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, useGetAggsNoFilterSelfQuery, isIntersection, useGetCountsQuery, setSharedFilters, usePrevious, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, getCurrentTimestamp, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, useSetCurrentPayModelMutation, PodStatus, PodConditionType, isWorkspaceRunningOrStopping, GEN3_API, GEN3_COMMONS_NAME, getTimestamp, createAppStore, getRemoteSupportServiceRegistry, isHttpStatusError, MissingServiceConfigurationError, useLazyGetAggsNoFilterSelfQuery, useCreateRequestMutation, buildGetAggregationQuery, processHistogramResponse, roundHistogramResponse, selectCSRFToken, useUserRequestQuery, getGen3AppId, createGen3AppWithOwnStore, useGeneralGQLQuery, createAppApiForRTKQ, useGetDictionaryQuery, useGetMetadataByIdQuery, createGen3App, CoreProvider, fetchJSONDataFromURL, HttpMethod, groupSharedFields, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetProjectsDetailsQuery, useGetSubmissionsQuery, isCohortItem, isFileItem, fetchFencePresignedURL, HTTPError, getFederatedLoginStatus, queryMultipleMDSRecords, GEN3_MANIFEST_API, extractIndexFromDataLibraryCohort, isFilterSet, getNumberOfItemsInDatalist, isAdditionalDataItem, useLazyGetCrosswalkDataQuery } from '@gen3/core';
5
5
  import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Center, Loader, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Accordion, Switch, SegmentedControl as SegmentedControl$1, ActionIcon, Badge, TextInput, NumberInput, RangeSlider, MultiSelect, Tabs, SimpleGrid, Highlight, MantineProvider, Flex, Menu, Alert, Drawer, CopyButton, factory, useProps, getStyleObject, Paper, useCombobox, Combobox, ScrollArea, Autocomplete, Title, Transition, rem, Stepper, Spoiler, Image as Image$1, NavLink, List, createTheme, Pagination, FileInput, CloseButton } from '@mantine/core';
6
6
  import { useDeepCompareEffect, useDeepCompareMemo, useDeepCompareCallback } from 'use-deep-compare';
7
7
  import { useRouter } from 'next/router';
@@ -1285,11 +1285,11 @@ const LoginProvidersPanel = ({ handleLoginSelected })=>{
1285
1285
 
1286
1286
  const TexturedSidePanel = ({ url })=>{
1287
1287
  return /*#__PURE__*/ jsx("div", {
1288
- "aria-label": 'background image',
1288
+ "aria-hidden": "true",
1289
1289
  style: {
1290
1290
  backgroundImage: `url(${url})`
1291
1291
  },
1292
- className: "flex h-screen w-full bg-left bg-repeat-y last:-scale-x-100"
1292
+ className: "bg-contain flex h-full w-full bg-repeat-y last:-scale-x-100"
1293
1293
  });
1294
1294
  };
1295
1295
 
@@ -1459,8 +1459,7 @@ function hashCode(str) {
1459
1459
  className: className,
1460
1460
  dangerouslySetInnerHTML: {
1461
1461
  __html: textString
1462
- },
1463
- "aria-label": "HTML content"
1462
+ }
1464
1463
  });
1465
1464
  }
1466
1465
  case "textArray":
@@ -1468,22 +1467,29 @@ function hashCode(str) {
1468
1467
  const textArray = !Array.isArray(text) ? [
1469
1468
  text
1470
1469
  ] : text;
1471
- return /*#__PURE__*/ jsx("div", {
1470
+ return /*#__PURE__*/ jsxs("div", {
1472
1471
  className: className,
1473
1472
  role: "list",
1474
- "aria-label": "Text array",
1475
- children: textArray.map((item)=>/*#__PURE__*/ jsx("p", {
1476
- className: "my-2",
1477
- role: "listitem",
1478
- children: item
1479
- }, hashCode(item)))
1473
+ children: [
1474
+ /*#__PURE__*/ jsxs("style", {
1475
+ children: [
1476
+ "@source inline(",
1477
+ className,
1478
+ ");"
1479
+ ]
1480
+ }),
1481
+ textArray.map((item)=>/*#__PURE__*/ jsx("p", {
1482
+ className: "my-2",
1483
+ role: "listitem",
1484
+ children: item
1485
+ }, hashCode(item)))
1486
+ ]
1480
1487
  });
1481
1488
  }
1482
1489
  case "markdown":
1483
1490
  {
1484
1491
  const textString = Array.isArray(text) ? text.join('') : text;
1485
1492
  return /*#__PURE__*/ jsx("div", {
1486
- "aria-label": "Markdown content",
1487
1493
  children: /*#__PURE__*/ jsx(Markdown, {
1488
1494
  remarkPlugins: [
1489
1495
  remarkGfm
@@ -1527,21 +1533,29 @@ function hashCode(str) {
1527
1533
  const DEFAULT_STYLE = 'inline text-base-contrast-max font-medium margin-block-start-1 margin-block-end-1';
1528
1534
  const mergedClassname = className ? twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
1529
1535
  const textString = Array.isArray(text) ? text.join('') : text;
1530
- return /*#__PURE__*/ jsx("div", {
1536
+ return /*#__PURE__*/ jsxs("div", {
1531
1537
  className: mergedClassname,
1532
- children: /*#__PURE__*/ jsxs("span", {
1533
- children: [
1534
- textString,
1535
- email && /*#__PURE__*/ jsx(Anchor, {
1536
- classNames: {
1537
- root: mergedClassname
1538
- },
1539
- href: `mailto:${email}`,
1540
- "aria-label": `Send an email to ${email}`,
1541
- children: ` ${email}.`
1542
- })
1543
- ]
1544
- })
1538
+ children: [
1539
+ /*#__PURE__*/ jsxs("style", {
1540
+ children: [
1541
+ "@source inline(",
1542
+ className,
1543
+ ");"
1544
+ ]
1545
+ }),
1546
+ /*#__PURE__*/ jsxs("span", {
1547
+ children: [
1548
+ textString,
1549
+ email && /*#__PURE__*/ jsx(Anchor, {
1550
+ classNames: {
1551
+ root: mergedClassname
1552
+ },
1553
+ href: `mailto:${email}`,
1554
+ children: ` ${email}.`
1555
+ })
1556
+ ]
1557
+ })
1558
+ ]
1545
1559
  });
1546
1560
  }
1547
1561
  case "textWithLink":
@@ -1552,35 +1566,50 @@ function hashCode(str) {
1552
1566
  if (!link) {
1553
1567
  return /*#__PURE__*/ jsx("div", {
1554
1568
  className: mergedClassname,
1555
- "aria-label": "No link defined",
1556
1569
  children: "Link is not defined."
1557
1570
  });
1558
1571
  }
1559
- return /*#__PURE__*/ jsx("div", {
1572
+ return /*#__PURE__*/ jsxs("div", {
1560
1573
  className: mergedClassname,
1561
- children: /*#__PURE__*/ jsxs("span", {
1562
- children: [
1563
- textString,
1564
- link && /*#__PURE__*/ jsx(Anchor, {
1565
- classNames: {
1566
- root: mergedClassname
1567
- },
1568
- href: link,
1569
- "aria-label": `Visit the link: ${linkText || link}`,
1570
- children: ` ${linkText ?? link}.`
1571
- })
1572
- ]
1573
- })
1574
+ children: [
1575
+ /*#__PURE__*/ jsxs("style", {
1576
+ children: [
1577
+ "@source inline(",
1578
+ className,
1579
+ ");"
1580
+ ]
1581
+ }),
1582
+ /*#__PURE__*/ jsxs("span", {
1583
+ children: [
1584
+ textString,
1585
+ link && /*#__PURE__*/ jsx(Anchor, {
1586
+ classNames: {
1587
+ root: mergedClassname
1588
+ },
1589
+ href: link,
1590
+ children: ` ${linkText ?? link}.`
1591
+ })
1592
+ ]
1593
+ })
1594
+ ]
1574
1595
  });
1575
1596
  }
1576
1597
  case "text":
1577
1598
  default:
1578
- return /*#__PURE__*/ jsx("div", {
1599
+ return /*#__PURE__*/ jsxs("div", {
1579
1600
  className: className,
1580
- "aria-label": "Plain text content",
1581
- children: /*#__PURE__*/ jsx("p", {
1582
- children: text.toString()
1583
- })
1601
+ children: [
1602
+ /*#__PURE__*/ jsxs("style", {
1603
+ children: [
1604
+ "@source inline(",
1605
+ className,
1606
+ ");"
1607
+ ]
1608
+ }),
1609
+ /*#__PURE__*/ jsx("p", {
1610
+ children: text.toString()
1611
+ })
1612
+ ]
1584
1613
  });
1585
1614
  }
1586
1615
  };
@@ -2074,7 +2103,6 @@ const Gen3ModalsProvider = ({ config, children })=>{
2074
2103
  });
2075
2104
  };
2076
2105
 
2077
- // import { BinGuru } from 'binguru';
2078
2106
  const capitalize = (original)=>{
2079
2107
  if (original === undefined) {
2080
2108
  throw new Error('capitalize: original is undefined');
@@ -2113,6 +2141,60 @@ const processRangeKeyLabel = (key)=>{
2113
2141
  spans = spans.concat(new Array(numLastRow).fill(Math.floor(12 / numLastRow)));
2114
2142
  return spans;
2115
2143
  };
2144
+ /**
2145
+ * Filters the keys from the provided aggregation data based on a given list of keys to remove.
2146
+ *
2147
+ * This function processes an `AggregationsData` object by iterating through its properties.
2148
+ * It removes elements from the data that match any of the keys specified in the `keysToRemove` array.
2149
+ * The filtering applies specifically to elements with a valid `key` property of type == string.
2150
+ * If the `key` is empty or matches one of the `keysToRemove`, it is excluded from the resulting object.
2151
+ *
2152
+ * @param {AggregationsData} data - The aggregation data object to filter. Expected to have properties that
2153
+ * are arrays of items containing a `key` property.
2154
+ * @param {Array<string>} keysToRemove - Array of string keys that should be removed from the aggregation data.
2155
+ * @returns {AggregationsData} A new `AggregationsData` object with filtered entries,
2156
+ * omitting the specified keys.
2157
+ */ const filterAggregationsDataKeys = (data, keysToRemove)=>{
2158
+ if (!data || typeof data !== 'object') {
2159
+ return {};
2160
+ }
2161
+ return Object.entries(data).reduce((acc, [key, chartData])=>{
2162
+ if (Array.isArray(chartData)) {
2163
+ acc[key] = chartData.filter((x)=>x && typeof x.key === 'string' && !keysToRemove.includes(x.key));
2164
+ }
2165
+ return acc;
2166
+ }, {});
2167
+ };
2168
+
2169
+ const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
2170
+ const [showTooltip, setShowTooltip] = useState(false);
2171
+ return /*#__PURE__*/ jsx(Tooltip, {
2172
+ label: label,
2173
+ disabled: !showTooltip,
2174
+ position: "top-start",
2175
+ offset: 5,
2176
+ multiline: true,
2177
+ withArrow: true,
2178
+ arrowOffset: 20,
2179
+ classNames: {
2180
+ tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
2181
+ arrow: 'bg-base-min bg-opacity-90'
2182
+ },
2183
+ children: /*#__PURE__*/ jsx("div", {
2184
+ className: `${className} truncate ... `,
2185
+ ref: (el)=>{
2186
+ if (el) {
2187
+ if (el.clientWidth < el.scrollWidth) {
2188
+ setShowTooltip(true);
2189
+ } else {
2190
+ setShowTooltip(false);
2191
+ }
2192
+ }
2193
+ },
2194
+ children: children
2195
+ })
2196
+ });
2197
+ };
2116
2198
 
2117
2199
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2118
2200
  function DefaultItemRenderer(_props) {
@@ -2600,16 +2682,25 @@ const LegendRows = ({ data })=>{
2600
2682
  const limitedRows = moreThanMaxRows ? data.slice(0, MAX_LEGEND_ROWS) : data;
2601
2683
  return limitedRows.map((element, elIndex)=>/*#__PURE__*/ jsxs(Table.Tr, {
2602
2684
  children: [
2603
- /*#__PURE__*/ jsxs(Table.Td, {
2604
- children: [
2605
- /*#__PURE__*/ jsx(ColorSwatch, {
2606
- className: "inline-block mr-2 align-middle",
2607
- size: "1em",
2608
- radius: "xs",
2609
- color: chartColors?.[elIndex % chartColors.length] || ''
2610
- }),
2611
- element.key
2612
- ]
2685
+ /*#__PURE__*/ jsx(Table.Td, {
2686
+ children: /*#__PURE__*/ jsxs("div", {
2687
+ className: "flex flex-nowrap items-center overflow-hidden",
2688
+ children: [
2689
+ /*#__PURE__*/ jsx(ColorSwatch, {
2690
+ className: "inline-block mr-2 align-middle",
2691
+ size: "1em",
2692
+ radius: "xs",
2693
+ color: chartColors?.[elIndex % chartColors.length] || ''
2694
+ }),
2695
+ /*#__PURE__*/ jsx(OverflowTooltippedLabel, {
2696
+ label: element.key.toString(),
2697
+ children: /*#__PURE__*/ jsx("span", {
2698
+ className: "text-sm font-medium font-content",
2699
+ children: element.key.toString()
2700
+ })
2701
+ })
2702
+ ]
2703
+ })
2613
2704
  }),
2614
2705
  /*#__PURE__*/ jsx(Table.Td, {
2615
2706
  className: "text-right",
@@ -2647,25 +2738,35 @@ const LegendOverflow = ({ chart, data, chartTitle, counts })=>{
2647
2738
  children: /*#__PURE__*/ jsx(Table, {
2648
2739
  withRowBorders: false,
2649
2740
  classNames: {
2650
- table: '',
2741
+ table: 'w-full table-fixed',
2651
2742
  td: 'p-1 leading-3'
2652
2743
  },
2653
2744
  children: /*#__PURE__*/ jsx(Table.Tbody, {
2654
2745
  children: data.map((element, elIndex)=>/*#__PURE__*/ jsxs(Table.Tr, {
2746
+ className: `${elIndex === 0 ? 'overflow-hidden text-ellipsis whitespace-nowrap' : 'last:text-right'}`,
2655
2747
  children: [
2656
- /*#__PURE__*/ jsxs(Table.Td, {
2657
- children: [
2658
- /*#__PURE__*/ jsx(ColorSwatch, {
2659
- className: "inline-block mr-2 align-middle",
2660
- size: "1em",
2661
- radius: "xs",
2662
- color: chartColors?.[elIndex % chartColors.length] || ''
2663
- }),
2664
- element.key
2665
- ]
2748
+ /*#__PURE__*/ jsx(Table.Td, {
2749
+ children: /*#__PURE__*/ jsxs("div", {
2750
+ className: "flex flex-nowrap items-center",
2751
+ children: [
2752
+ /*#__PURE__*/ jsx(ColorSwatch, {
2753
+ className: "inline-block mr-2 align-middle",
2754
+ size: "1em",
2755
+ radius: "xs",
2756
+ color: chartColors?.[elIndex % chartColors.length] || ''
2757
+ }),
2758
+ /*#__PURE__*/ jsx(OverflowTooltippedLabel, {
2759
+ label: element.key.toString(),
2760
+ children: /*#__PURE__*/ jsx("span", {
2761
+ className: "text-sm font-medium font-content",
2762
+ children: element.key.toString()
2763
+ })
2764
+ })
2765
+ ]
2766
+ })
2666
2767
  }),
2667
2768
  /*#__PURE__*/ jsx(Table.Td, {
2668
- className: "text-right",
2769
+ className: "w-[10%] text-right",
2669
2770
  children: element.count
2670
2771
  })
2671
2772
  ]
@@ -2743,31 +2844,35 @@ const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style
2743
2844
  inheritPadding: true,
2744
2845
  py: "xs",
2745
2846
  withBorder: style === 'box',
2746
- children: /*#__PURE__*/ jsxs(Table, {
2747
- withRowBorders: false,
2748
- classNames: {
2749
- td: 'p-1 leading-3',
2750
- th: 'p-1 leading-3 [text-shadow:_1px_0_#000]',
2751
- thead: 'border-b',
2752
- tbody: "before:content-[''] before:block before:p-1"
2753
- },
2754
- children: [
2755
- /*#__PURE__*/ jsx(Table.Thead, {
2756
- children: /*#__PURE__*/ jsx(Table.Tr, {
2757
- children: dataKeys.map((el, i)=>/*#__PURE__*/ jsx(Table.Th, {
2758
- className: "last:text-right",
2759
- children: charts[field]?.dataLabels?.[el] || /*#__PURE__*/ jsx(React__default.Fragment, {
2760
- children: " "
2761
- })
2762
- }, i))
2763
- })
2764
- }),
2765
- /*#__PURE__*/ jsx(Table.Tbody, {
2766
- children: data === undefined ? '' : /*#__PURE__*/ jsx(LegendRows, {
2767
- data: data[field]
2847
+ children: /*#__PURE__*/ jsx("div", {
2848
+ className: "w-full",
2849
+ children: /*#__PURE__*/ jsxs(Table, {
2850
+ withRowBorders: false,
2851
+ classNames: {
2852
+ table: 'w-full table-fixed',
2853
+ td: 'p-1 leading-3',
2854
+ th: 'p-1 leading-3 [text-shadow:_1px_0_#000]',
2855
+ thead: 'border-b',
2856
+ tbody: "before:content-[''] before:block before:p-1"
2857
+ },
2858
+ children: [
2859
+ /*#__PURE__*/ jsx(Table.Thead, {
2860
+ children: /*#__PURE__*/ jsx(Table.Tr, {
2861
+ children: dataKeys.map((el, i)=>/*#__PURE__*/ jsx(Table.Th, {
2862
+ className: `${i === 0 ? 'w-[90%] overflow-hidden text-ellipsis whitespace-nowrap' : 'last:text-right'}`,
2863
+ children: charts[field]?.dataLabels?.[el] || /*#__PURE__*/ jsx(React__default.Fragment, {
2864
+ children: " "
2865
+ })
2866
+ }, i))
2867
+ })
2868
+ }),
2869
+ /*#__PURE__*/ jsx(Table.Tbody, {
2870
+ children: data === undefined ? '' : /*#__PURE__*/ jsx(LegendRows, {
2871
+ data: data[field]
2872
+ })
2768
2873
  })
2769
- })
2770
- ]
2874
+ ]
2875
+ })
2771
2876
  })
2772
2877
  }),
2773
2878
  showLegends && moreThanMaxRows && /*#__PURE__*/ jsx(Card.Section, {
@@ -3798,36 +3903,6 @@ flex items-start justify-between items-center flex-nowrap bg-secondary px-1.5 ro
3798
3903
  });
3799
3904
  };
3800
3905
 
3801
- const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
3802
- const [showTooltip, setShowTooltip] = useState(false);
3803
- return /*#__PURE__*/ jsx(Tooltip, {
3804
- label: label,
3805
- disabled: !showTooltip,
3806
- position: "top-start",
3807
- offset: 5,
3808
- multiline: true,
3809
- withArrow: true,
3810
- arrowOffset: 20,
3811
- classNames: {
3812
- tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
3813
- arrow: 'bg-base-min bg-opacity-90'
3814
- },
3815
- children: /*#__PURE__*/ jsx("div", {
3816
- className: `${className} truncate ... `,
3817
- ref: (el)=>{
3818
- if (el) {
3819
- if (el.clientWidth < el.scrollWidth) {
3820
- setShowTooltip(true);
3821
- } else {
3822
- setShowTooltip(false);
3823
- }
3824
- }
3825
- },
3826
- children: children
3827
- })
3828
- });
3829
- };
3830
-
3831
3906
  const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc', moveValuesToBottom = [], excludeValues = [] })=>{
3832
3907
  const [isGroupExpanded, setIsGroupExpanded] = useState(false);
3833
3908
  const cardRef = useRef(null);
@@ -5724,6 +5799,20 @@ const FooterRowComponent = ({ item, rowClassname })=>{
5724
5799
  case 'Icon':
5725
5800
  {
5726
5801
  const logo = item[itemType];
5802
+ if (logo.href) {
5803
+ return /*#__PURE__*/ jsx("a", {
5804
+ href: logo.href,
5805
+ target: "_blank",
5806
+ rel: "noopener noreferrer",
5807
+ className: className,
5808
+ children: /*#__PURE__*/ jsx(Image, {
5809
+ src: `${logo.logo}`,
5810
+ width: logo.width,
5811
+ height: logo.height,
5812
+ alt: logo.description
5813
+ })
5814
+ }, `icons-${logo.logo}`);
5815
+ }
5727
5816
  return /*#__PURE__*/ jsx(Image, {
5728
5817
  src: `${logo.logo}`,
5729
5818
  width: logo.width,
@@ -7159,10 +7248,16 @@ const createFieldRendererElement = (field, resource)=>{
7159
7248
  json: resource,
7160
7249
  path: field.field
7161
7250
  });
7162
- if (resourceFieldValue === undefined || resourceFieldValue === null) {
7251
+ if (!isArray(resourceFieldValue) || resourceFieldValue.length == 0 || resourceFieldValue[0] === null) {
7163
7252
  if (field.includeIfNotAvailable === false) return null;
7164
- if (field.valueIfNotAvailable) resourceFieldValue = field.valueIfNotAvailable;
7165
- } else resourceFieldValue = resourceFieldValue.length > 0 ? resourceFieldValue[0] : '';
7253
+ if (field.valueIfNotAvailable) {
7254
+ resourceFieldValue = field.valueIfNotAvailable;
7255
+ } else {
7256
+ resourceFieldValue = '';
7257
+ }
7258
+ } else {
7259
+ resourceFieldValue = resourceFieldValue[0];
7260
+ }
7166
7261
  const label = field.includeLabel === undefined || field?.includeLabel ? field.name : undefined;
7167
7262
  const studyFieldRenderer = StudyDetailsRenderer(field.contentType, field?.renderer ?? 'default');
7168
7263
  switch(field.contentType){
@@ -7419,17 +7514,17 @@ const SinglePageStudyDetailsPanel = ({ data, studyConfig, authorization })=>{
7419
7514
  children: "Study Details Panel not configured"
7420
7515
  });
7421
7516
  } else {
7422
- return studyConfig?.fieldsToShow.map((field)=>{
7517
+ return studyConfig?.fieldsToShow.map((fieldToShow)=>{
7423
7518
  return /*#__PURE__*/ jsx("div", {
7424
- className: `px-2 ${field.groupWidth == 'full' || field.groupWidth === undefined ? 'w-full' : 'w-1/2'}`,
7519
+ className: `px-2 ${fieldToShow.groupWidth == 'full' || fieldToShow.groupWidth === undefined ? 'w-full' : 'w-1/2'}`,
7425
7520
  children: /*#__PURE__*/ jsxs("div", {
7426
7521
  className: "flex flex-col",
7427
7522
  children: [
7428
- field?.groupName ? /*#__PURE__*/ jsx("div", {
7523
+ fieldToShow?.groupName ? /*#__PURE__*/ jsx("div", {
7429
7524
  className: "text-lg font-bold",
7430
- children: field.groupName
7525
+ children: fieldToShow.groupName
7431
7526
  }) : null,
7432
- field.fields.map((field)=>{
7527
+ fieldToShow.fields.map((field)=>{
7433
7528
  const element = createFieldRendererElement(field, data);
7434
7529
  if (element !== null) {
7435
7530
  return /*#__PURE__*/ jsx("div", {
@@ -7440,7 +7535,7 @@ const SinglePageStudyDetailsPanel = ({ data, studyConfig, authorization })=>{
7440
7535
  })
7441
7536
  ]
7442
7537
  })
7443
- }, `${field.fields.join('-')}-details`);
7538
+ }, `${fieldToShow.fields.join('-')}-details`);
7444
7539
  });
7445
7540
  }
7446
7541
  }, [
@@ -11301,160 +11396,6 @@ const CohortManager$1 = ({ index })=>{
11301
11396
  });
11302
11397
  };
11303
11398
 
11304
- function isQueryResponse(obj) {
11305
- // Considering that the data property can be optional
11306
- return typeof obj === 'object' && (obj.data === undefined || typeof obj.data === 'object');
11307
- }
11308
- const ExtractData = (data, index)=>{
11309
- if (data === undefined || data === null) return {};
11310
- if (data.data === undefined || data.data === null) return {};
11311
- return Array.isArray(data.data[index]) && data.data[index].length > 0 ? data.data[index][0] : {};
11312
- };
11313
- const QueryRowDetailsPanel = ({ id, index, tableConfig, accessibility })=>{
11314
- //const [queryGuppy, { data, isLoading, isError }] = useLazyGeneralGQLQuery();
11315
- const idField = tableConfig.detailsConfig?.idField;
11316
- const { data, isLoading, isError } = useGeneralGQLQuery({
11317
- query: `query ($filter: JSON) {
11318
- ${index} (filter: $filter, accessibility: all) {
11319
- ${tableConfig.fields}
11320
- }
11321
- }`,
11322
- variables: {
11323
- filter: {
11324
- AND: [
11325
- {
11326
- IN: {
11327
- [idField ?? 0]: [
11328
- id
11329
- ]
11330
- }
11331
- }
11332
- ]
11333
- }
11334
- }
11335
- });
11336
- if (!idField) {
11337
- return /*#__PURE__*/ jsx(ErrorCard, {
11338
- message: 'idField not configure in Tables Details Config'
11339
- });
11340
- }
11341
- if (isError) {
11342
- return /*#__PURE__*/ jsx(ErrorCard, {
11343
- message: 'Error occurred while fetching data'
11344
- });
11345
- }
11346
- const queryData = isQueryResponse(data) ? ExtractData(data, index) : {};
11347
- const rows = Object.entries(queryData).map(([field, value])=>/*#__PURE__*/ jsxs("tr", {
11348
- children: [
11349
- /*#__PURE__*/ jsx("td", {
11350
- children: /*#__PURE__*/ jsx(Text, {
11351
- fw: "bold",
11352
- children: field
11353
- })
11354
- }),
11355
- /*#__PURE__*/ jsx("td", {
11356
- children: /*#__PURE__*/ jsx(Text, {
11357
- children: value ? value : ''
11358
- })
11359
- })
11360
- ]
11361
- }, field));
11362
- return /*#__PURE__*/ jsxs(Stack, {
11363
- children: [
11364
- /*#__PURE__*/ jsx(LoadingOverlay, {
11365
- visible: isLoading
11366
- }),
11367
- /*#__PURE__*/ jsxs(Text, {
11368
- c: "primary.4",
11369
- children: [
11370
- "Results for ",
11371
- id
11372
- ]
11373
- }),
11374
- /*#__PURE__*/ jsxs(Table, {
11375
- withTableBorder: true,
11376
- withColumnBorders: true,
11377
- children: [
11378
- /*#__PURE__*/ jsx("thead", {
11379
- children: /*#__PURE__*/ jsxs("tr", {
11380
- children: [
11381
- /*#__PURE__*/ jsx("th", {
11382
- children: "Field"
11383
- }),
11384
- /*#__PURE__*/ jsx("th", {
11385
- children: "Value"
11386
- })
11387
- ]
11388
- })
11389
- }),
11390
- /*#__PURE__*/ jsx("tbody", {
11391
- children: rows
11392
- })
11393
- ]
11394
- })
11395
- ]
11396
- });
11397
- };
11398
-
11399
- const RowTableDetailsPanel = ({ row })=>{
11400
- const rowData = row?.original ?? {};
11401
- const rows = Object.entries(rowData).map(([field, value])=>/*#__PURE__*/ jsxs(Table.Tr, {
11402
- children: [
11403
- /*#__PURE__*/ jsx(Table.Td, {
11404
- children: /*#__PURE__*/ jsx(Text, {
11405
- fw: "bold",
11406
- children: field
11407
- })
11408
- }),
11409
- /*#__PURE__*/ jsx(Table.Td, {
11410
- children: /*#__PURE__*/ jsx(Text, {
11411
- children: value ? value : ''
11412
- })
11413
- })
11414
- ]
11415
- }, field));
11416
- return /*#__PURE__*/ jsxs(Table, {
11417
- striped: true,
11418
- highlightOnHover: true,
11419
- withTableBorder: true,
11420
- withColumnBorders: true,
11421
- children: [
11422
- /*#__PURE__*/ jsx(Table.Thead, {
11423
- children: /*#__PURE__*/ jsxs(Table.Tr, {
11424
- children: [
11425
- /*#__PURE__*/ jsx(Table.Th, {
11426
- children: "Field"
11427
- }),
11428
- /*#__PURE__*/ jsx(Table.Th, {
11429
- children: "Value"
11430
- })
11431
- ]
11432
- })
11433
- }),
11434
- /*#__PURE__*/ jsx(Table.Tbody, {
11435
- children: rows
11436
- })
11437
- ]
11438
- });
11439
- };
11440
-
11441
- let instance$2;
11442
- const DefaultRendererCatalog$1 = {
11443
- tableDetails: {
11444
- default: RowTableDetailsPanel,
11445
- queryRowDetails: QueryRowDetailsPanel
11446
- }
11447
- };
11448
- const ExplorerTableDetailsPanelFactory = ()=>{
11449
- if (!instance$2) {
11450
- instance$2 = new RenderFactoryTypedInstance();
11451
- }
11452
- return instance$2;
11453
- };
11454
- const registerCohortBuilderDefaultPreviewRenderers = ()=>{
11455
- ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog$1);
11456
- };
11457
-
11458
11399
  const DEFAULT_PROPS = {
11459
11400
  body: 'bg-base-max',
11460
11401
  header: '!bg-primary !pb-9 !mb-9',
@@ -11498,6 +11439,48 @@ const DetailsModal = ({ title, id, row, classNames, panel, panelProps, onClose,
11498
11439
  });
11499
11440
  };
11500
11441
 
11442
+ const DetailsDrawer = ({ id, title, panel, panelProps })=>{
11443
+ const [opened, { open, close }] = useDisclosure(id !== undefined);
11444
+ useEffect(()=>{
11445
+ if (id !== undefined) open();
11446
+ else close();
11447
+ }, [
11448
+ close,
11449
+ id,
11450
+ open
11451
+ ]);
11452
+ return /*#__PURE__*/ jsxs(Drawer.Root, {
11453
+ opened: opened,
11454
+ onClose: close,
11455
+ size: "50%",
11456
+ position: "right",
11457
+ children: [
11458
+ /*#__PURE__*/ jsx(Drawer.Overlay, {
11459
+ opacity: 0.5,
11460
+ blur: 4
11461
+ }),
11462
+ /*#__PURE__*/ jsxs(Drawer.Content, {
11463
+ children: [
11464
+ /*#__PURE__*/ jsx(Drawer.Header, {
11465
+ children: /*#__PURE__*/ jsx(Button, {
11466
+ leftSection: /*#__PURE__*/ jsx(MdKeyboardDoubleArrowLeft, {}),
11467
+ onClick: close,
11468
+ variant: "outline",
11469
+ children: "Back"
11470
+ })
11471
+ }),
11472
+ /*#__PURE__*/ jsx(Drawer.Body, {
11473
+ children: panel({
11474
+ id: id,
11475
+ ...panelProps
11476
+ })
11477
+ })
11478
+ ]
11479
+ })
11480
+ ]
11481
+ });
11482
+ };
11483
+
11501
11484
  // TODO need to type this
11502
11485
  const RenderArrayCell = ({ cell })=>{
11503
11486
  const value = cell.getValue();
@@ -11597,12 +11580,12 @@ const LinkCellFunctionCatalog = {
11597
11580
  default: RenderLinkCell,
11598
11581
  linkWithValueMap: RenderLinkCellUsingValueMap
11599
11582
  };
11600
- let instance$1;
11583
+ let instance$2;
11601
11584
  const ExplorerTableCellRendererFactory = ()=>{
11602
- if (!instance$1) {
11603
- instance$1 = new RenderFactoryTypedInstance();
11585
+ if (!instance$2) {
11586
+ instance$2 = new RenderFactoryTypedInstance();
11604
11587
  }
11605
- return instance$1;
11588
+ return instance$2;
11606
11589
  };
11607
11590
  // register default cell renderers
11608
11591
  const registerExplorerDefaultCellRenderers = ()=>{
@@ -11869,6 +11852,91 @@ const SubtableStack = ({ subTables, data })=>{
11869
11852
  });
11870
11853
  };
11871
11854
 
11855
+ function isQueryResponse(obj) {
11856
+ // Considering that the data property can be optional
11857
+ return typeof obj === 'object' && (obj.data === undefined || typeof obj.data === 'object');
11858
+ }
11859
+ const ExtractData = (data, index, path)=>{
11860
+ if (data === undefined || data === null) return {};
11861
+ if (data.data === undefined || data.data === null) return {};
11862
+ if (!isArray(data.data[index])) return {};
11863
+ let rowData = data.data[index][0];
11864
+ if (path) {
11865
+ const tmp = JSONPath({
11866
+ path: path,
11867
+ json: data.data[index][0]
11868
+ });
11869
+ if (!isArray(tmp)) {
11870
+ return {};
11871
+ }
11872
+ if (tmp.length > 0) {
11873
+ rowData = tmp[0];
11874
+ }
11875
+ }
11876
+ return rowData;
11877
+ };
11878
+ const QueryRowDetailsPanel = ({ id, index, tableConfig, accessibility })=>{
11879
+ //const [queryGuppy, { data, isLoading, isError }] = useLazyGeneralGQLQuery();
11880
+ const idField = tableConfig.detailsConfig?.idField;
11881
+ const simpleDetailsView = tableConfig.detailsConfig?.simpleDetailsView;
11882
+ const { setStudyDetails } = useStudyContext();
11883
+ const [opened, { open, close }] = useDisclosure(false);
11884
+ const { data, isError, isFetching } = useGetRawDataAndTotalCountsQuery({
11885
+ type: index,
11886
+ fields: tableConfig.fields,
11887
+ filters: {
11888
+ mode: 'and',
11889
+ root: {
11890
+ [idField]: buildNested(idField, {
11891
+ operator: '=',
11892
+ field: idField,
11893
+ operand: id
11894
+ })
11895
+ }
11896
+ },
11897
+ offset: 0,
11898
+ size: 1,
11899
+ accessibility: accessibility
11900
+ }, {
11901
+ skip: !idField || !id
11902
+ });
11903
+ const queryData = useMemo(()=>isQueryResponse(data) ? ExtractData(data, index, tableConfig?.detailsConfig?.dataPath) : {}, [
11904
+ data,
11905
+ index,
11906
+ tableConfig?.detailsConfig?.dataPath
11907
+ ]);
11908
+ useEffect(()=>{
11909
+ setStudyDetails(queryData);
11910
+ }, [
11911
+ queryData,
11912
+ setStudyDetails
11913
+ ]);
11914
+ if (!idField) {
11915
+ return /*#__PURE__*/ jsx(ErrorCard, {
11916
+ message: 'idField not configure in Tables Details Config'
11917
+ });
11918
+ }
11919
+ if (isError) {
11920
+ return /*#__PURE__*/ jsx(ErrorCard, {
11921
+ message: 'Error occurred while fetching data'
11922
+ });
11923
+ }
11924
+ // Inital attempt at using Study Details component
11925
+ return /*#__PURE__*/ jsxs(Stack, {
11926
+ children: [
11927
+ /*#__PURE__*/ jsx(LoadingOverlay, {
11928
+ visible: isFetching
11929
+ }),
11930
+ simpleDetailsView ? /*#__PURE__*/ jsx(SinglePageStudyDetailsPanel, {
11931
+ data: queryData ?? {},
11932
+ studyConfig: simpleDetailsView
11933
+ }) : /*#__PURE__*/ jsx("div", {
11934
+ children: "Study Details Panel not configured"
11935
+ })
11936
+ ]
11937
+ });
11938
+ };
11939
+
11872
11940
  const DEFAULT_PAGE_LIMIT_LABEL = 'Rows per Page (Limited to 10,0000):';
11873
11941
  const DEFAULT_PAGE_LIMIT = 10000;
11874
11942
  /**
@@ -11883,13 +11951,19 @@ const DEFAULT_PAGE_LIMIT = 10000;
11883
11951
  pageIndex: 0,
11884
11952
  pageSize: 10
11885
11953
  });
11886
- const DetailsComponent = DetailsModal;
11954
+ const DetailsComponent = useMemo(()=>tableConfig?.detailsConfig?.panelContainer === 'drawer' ? DetailsDrawer : DetailsModal, []);
11887
11955
  const [sorting, setSorting] = useState([]);
11888
11956
  const [rowSelection, setRowSelection] = useState({});
11889
11957
  const [selectedRow, setSelectedRow] = useState(undefined);
11890
- const DetailsPanel = useMemo(()=>ExplorerTableDetailsPanelFactory().getRenderer('tableDetails', tableConfig?.detailsConfig?.panel ?? 'default'), [
11891
- tableConfig?.detailsConfig?.panel
11892
- ]);
11958
+ // const DetailsPanel = useMemo(
11959
+ // () =>
11960
+ // ExplorerTableDetailsPanelFactory().getRenderer(
11961
+ // 'tableDetails',
11962
+ // tableConfig?.detailsConfig?.panel ?? 'default',
11963
+ // ),
11964
+ // [tableConfig?.detailsConfig?.panel],
11965
+ // );
11966
+ const DetailsPanel = useMemo(()=>QueryRowDetailsPanel, []);
11893
11967
  const tableColumns = useDeepCompareMemo(()=>{
11894
11968
  return createTableColumns(tableConfig);
11895
11969
  }, [
@@ -11902,7 +11976,18 @@ const DEFAULT_PAGE_LIMIT = 10000;
11902
11976
  const getRowId = useCallback((tableConfig)=>{
11903
11977
  const { detailsConfig } = tableConfig || {};
11904
11978
  const idField = detailsConfig?.idField;
11905
- return (originalRow)=>idField && Object.keys(originalRow).includes(idField) ? originalRow[idField] : undefined;
11979
+ if (!idField) return undefined;
11980
+ return (originalRow)=>{
11981
+ const id = JSONPath({
11982
+ json: originalRow,
11983
+ path: idField
11984
+ });
11985
+ if (id.length > 0) {
11986
+ return id[0];
11987
+ } else {
11988
+ return undefined;
11989
+ }
11990
+ };
11906
11991
  }, []);
11907
11992
  const cohortFilters = useCoreSelector((state)=>selectIndexFilters(state, index));
11908
11993
  const { data, isLoading, isError, isFetching } = useGetRawDataAndTotalCountsQuery({
@@ -11959,6 +12044,12 @@ const DEFAULT_PAGE_LIMIT = 10000;
11959
12044
  onPaginationChange: setPagination,
11960
12045
  onSortingChange: setSorting,
11961
12046
  enableTopToolbar: false,
12047
+ enableExpandAll: false,
12048
+ displayColumnDefOptions: {
12049
+ 'mrt-row-expand': {
12050
+ enableHiding: true
12051
+ }
12052
+ },
11962
12053
  enableExpanding: !!tableConfig?.detailsConfig,
11963
12054
  getRowId: getRowId(tableConfig),
11964
12055
  rowCount: totalRowCount,
@@ -11968,6 +12059,16 @@ const DEFAULT_PAGE_LIMIT = 10000;
11968
12059
  localization: {
11969
12060
  rowsPerPage: limitLabel
11970
12061
  },
12062
+ // mantineExpandAllButtonProps: {
12063
+ // style: {
12064
+ // visibility: 'hidden',
12065
+ // },
12066
+ // },
12067
+ // mantineExpandButtonProps: {
12068
+ // style: {
12069
+ // visibility: 'hidden',
12070
+ // },
12071
+ // },
11971
12072
  mantineTableProps: {
11972
12073
  style: {
11973
12074
  backgroundColor: 'var(--mantine-color-base-1)',
@@ -11999,7 +12100,10 @@ const DEFAULT_PAGE_LIMIT = 10000;
11999
12100
  showProgressBars: isFetching,
12000
12101
  showAlertBanner: isError,
12001
12102
  density: 'xs',
12002
- rowSelection: rowSelection
12103
+ rowSelection: rowSelection,
12104
+ columnVisibility: {
12105
+ 'mrt-row-expand': false
12106
+ }
12003
12107
  },
12004
12108
  mantineTableBodyRowProps: tableConfig.detailsConfig?.mode === 'click' ? ({ row })=>({
12005
12109
  onClick: ()=>{
@@ -12031,29 +12135,31 @@ const DEFAULT_PAGE_LIMIT = 10000;
12031
12135
  } else return null;
12032
12136
  } : undefined
12033
12137
  });
12034
- return /*#__PURE__*/ jsxs(React__default.Fragment, {
12035
- children: [
12036
- Object.keys(rowSelection).length > 0 ? /*#__PURE__*/ jsx(DetailsComponent, {
12037
- title: tableConfig?.detailsConfig?.title,
12038
- id: Object.keys(rowSelection).length > 0 ? Object.keys(rowSelection).at(0) : undefined,
12039
- row: selectedRow,
12040
- onClose: ()=>setRowSelection({}),
12041
- panel: DetailsPanel,
12042
- classNames: tableConfig?.detailsConfig?.classNames,
12043
- panelProps: {
12044
- index,
12045
- tableConfig,
12046
- ...tableConfig?.detailsConfig?.params ?? {},
12047
- accessibility
12048
- }
12049
- }) : null,
12050
- /*#__PURE__*/ jsx("div", {
12051
- className: "inline-block overflow-x-scroll",
12052
- children: /*#__PURE__*/ jsx(MantineReactTable, {
12053
- table: table
12138
+ return /*#__PURE__*/ jsx(React__default.Fragment, {
12139
+ children: /*#__PURE__*/ jsxs(StudyProvider, {
12140
+ children: [
12141
+ /*#__PURE__*/ jsx(DetailsComponent, {
12142
+ title: tableConfig?.detailsConfig?.title,
12143
+ id: Object.keys(rowSelection).length > 0 ? Object.keys(rowSelection).at(0) : undefined,
12144
+ row: selectedRow,
12145
+ onClose: ()=>setRowSelection({}),
12146
+ panel: DetailsPanel,
12147
+ classNames: tableConfig?.detailsConfig?.classNames,
12148
+ panelProps: {
12149
+ index,
12150
+ tableConfig,
12151
+ ...tableConfig?.detailsConfig?.params ?? {},
12152
+ accessibility
12153
+ }
12154
+ }),
12155
+ /*#__PURE__*/ jsx("div", {
12156
+ className: "inline-block overflow-x-scroll",
12157
+ children: /*#__PURE__*/ jsx(MantineReactTable, {
12158
+ table: table
12159
+ })
12054
12160
  })
12055
- })
12056
- ]
12161
+ ]
12162
+ })
12057
12163
  });
12058
12164
  };
12059
12165
 
@@ -12728,6 +12834,25 @@ const EmptyData = {};
12728
12834
  }, {
12729
12835
  skip: chartKeys.length === 0
12730
12836
  });
12837
+ const cleanChartData = useDeepCompareMemo(()=>{
12838
+ if (isChartSuccess && chartData) {
12839
+ const cleanedData = {};
12840
+ Object.keys(summaryCharts).forEach((key)=>{
12841
+ // remove empty keys
12842
+ cleanedData[key] = chartData[key].filter((x)=>typeof x.key !== 'string' ? true : x.key !== '');
12843
+ const facetDef = facetDefinitions?.[key];
12844
+ if (facetDef?.excludeValues) {
12845
+ cleanedData[key] = cleanedData[key].filter((x)=>typeof x.key !== 'string' ? true : facetDef?.excludeValues?.includes(String(x.key)) === false);
12846
+ }
12847
+ });
12848
+ return cleanedData;
12849
+ }
12850
+ return chartData;
12851
+ }, [
12852
+ chartData,
12853
+ isChartSuccess,
12854
+ summaryCharts
12855
+ ]);
12731
12856
  const getEnumFacetData = useDeepCompareCallback((field)=>{
12732
12857
  let filters = undefined;
12733
12858
  let combineMode = 'or';
@@ -12868,7 +12993,7 @@ const EmptyData = {};
12868
12993
  }); // TODO: replace with configurable message
12869
12994
  }
12870
12995
  return /*#__PURE__*/ jsxs("div", {
12871
- className: "flex flex-col mt-3 relative px-4 bg-base-light w-full",
12996
+ className: "flex flex-col mt-3 relative px-4 bg-base-lightest w-full",
12872
12997
  children: [
12873
12998
  /*#__PURE__*/ jsx(CohortManager$1, {
12874
12999
  index: index
@@ -12918,24 +13043,21 @@ const EmptyData = {};
12918
13043
  ...chartsSection,
12919
13044
  charts: summaryCharts
12920
13045
  },
12921
- data: chartData ?? EmptyData,
13046
+ data: cleanChartData ?? EmptyData,
12922
13047
  isSuccess: isChartSuccess
12923
13048
  }) : /*#__PURE__*/ jsx(Charts, {
12924
13049
  charts: summaryCharts,
12925
- data: chartData ?? EmptyData,
13050
+ data: cleanChartData ?? EmptyData,
12926
13051
  counts: counts,
12927
13052
  isSuccess: isChartSuccess,
12928
13053
  numCols: numCols
12929
13054
  }),
12930
13055
  table?.enabled && /*#__PURE__*/ jsx("div", {
12931
13056
  className: "mt-2 flex flex-col",
12932
- children: /*#__PURE__*/ jsx("div", {
12933
- className: "grid",
12934
- children: /*#__PURE__*/ jsx(ExplorerTable, {
12935
- index: index,
12936
- tableConfig: table,
12937
- accessibility: accessLevel
12938
- })
13057
+ children: /*#__PURE__*/ jsx(ExplorerTable, {
13058
+ index: index,
13059
+ tableConfig: table,
13060
+ accessibility: accessLevel
12939
13061
  })
12940
13062
  })
12941
13063
  ]
@@ -12970,16 +13092,20 @@ const TabsLayoutToComponentProp = (tabsLayout)=>{
12970
13092
  }
12971
13093
  };
12972
13094
 
12973
- const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
13095
+ const useGetCurrentCohort = ()=>{
13096
+ return useCoreSelector((state)=>selectCurrentCohortId$1(state));
13097
+ };
13098
+ const CohortBuilder$1 = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
12974
13099
  const dispatch = useCoreDispatch();
12975
13100
  dispatch(setSharedFilters(sharedFiltersMap ?? {}));
12976
13101
  const configuration = useDeepCompareMemo(()=>explorerConfig, [
12977
13102
  explorerConfig
12978
13103
  ]);
12979
13104
  return /*#__PURE__*/ jsx("div", {
12980
- className: "w-full",
13105
+ className: "w-full mt-2",
12981
13106
  children: /*#__PURE__*/ jsxs(Tabs, {
12982
13107
  color: "primary.4",
13108
+ variant: explorerConfig[0]?.tabType,
12983
13109
  keepMounted: true,
12984
13110
  defaultValue: explorerConfig[0].tabTitle,
12985
13111
  children: [
@@ -13010,6 +13136,71 @@ const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = '
13010
13136
  });
13011
13137
  };
13012
13138
 
13139
+ var CohortBuilder$2 = /*#__PURE__*/Object.freeze({
13140
+ __proto__: null,
13141
+ default: CohortBuilder$1,
13142
+ useGetCurrentCohort: useGetCurrentCohort
13143
+ });
13144
+
13145
+ const RowTableDetailsPanel = ({ row })=>{
13146
+ const rowData = row?.original ?? {};
13147
+ const rows = Object.entries(rowData).map(([field, value])=>/*#__PURE__*/ jsxs(Table.Tr, {
13148
+ children: [
13149
+ /*#__PURE__*/ jsx(Table.Td, {
13150
+ children: /*#__PURE__*/ jsx(Text, {
13151
+ fw: "bold",
13152
+ children: field
13153
+ })
13154
+ }),
13155
+ /*#__PURE__*/ jsx(Table.Td, {
13156
+ children: /*#__PURE__*/ jsx(Text, {
13157
+ children: value ? value : ''
13158
+ })
13159
+ })
13160
+ ]
13161
+ }, field));
13162
+ return /*#__PURE__*/ jsxs(Table, {
13163
+ striped: true,
13164
+ highlightOnHover: true,
13165
+ withTableBorder: true,
13166
+ withColumnBorders: true,
13167
+ children: [
13168
+ /*#__PURE__*/ jsx(Table.Thead, {
13169
+ children: /*#__PURE__*/ jsxs(Table.Tr, {
13170
+ children: [
13171
+ /*#__PURE__*/ jsx(Table.Th, {
13172
+ children: "Field"
13173
+ }),
13174
+ /*#__PURE__*/ jsx(Table.Th, {
13175
+ children: "Value"
13176
+ })
13177
+ ]
13178
+ })
13179
+ }),
13180
+ /*#__PURE__*/ jsx(Table.Tbody, {
13181
+ children: rows
13182
+ })
13183
+ ]
13184
+ });
13185
+ };
13186
+
13187
+ let instance$1;
13188
+ const DefaultRendererCatalog$1 = {
13189
+ tableDetails: {
13190
+ default: RowTableDetailsPanel,
13191
+ queryRowDetails: QueryRowDetailsPanel
13192
+ }
13193
+ };
13194
+ const ExplorerTableDetailsPanelFactory = ()=>{
13195
+ if (!instance$1) {
13196
+ instance$1 = new RenderFactoryTypedInstance();
13197
+ }
13198
+ return instance$1;
13199
+ };
13200
+ const registerCohortBuilderDefaultPreviewRenderers = ()=>{
13201
+ ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog$1);
13202
+ };
13203
+
13013
13204
  const useCustomFacets = ()=>({
13014
13205
  data: [],
13015
13206
  isSuccess: true
@@ -14514,12 +14705,39 @@ const StaticNotebookViewer = ({ notebook })=>{
14514
14705
 
14515
14706
  const StaticNotebookIFrame = ({ notebook })=>{
14516
14707
  const router = useRouter$1();
14708
+ const iframeRef = useRef(null);
14709
+ useEffect(()=>{
14710
+ const iframe = iframeRef.current;
14711
+ const handleLoad = ()=>{
14712
+ try {
14713
+ // Access iframe document
14714
+ if (iframe) {
14715
+ const iframeDoc = iframe.contentDocument || iframe?.contentWindow?.document;
14716
+ // Find all anchor tags and add target="_blank"
14717
+ const links = iframeDoc?.querySelectorAll('a');
14718
+ links?.forEach((link)=>{
14719
+ link.setAttribute('target', '_blank');
14720
+ link.setAttribute('rel', 'noreferrer');
14721
+ });
14722
+ }
14723
+ } catch (error) {
14724
+ console.error('Cannot access iframe content:', error);
14725
+ }
14726
+ };
14727
+ if (iframe) {
14728
+ iframe.addEventListener('load', handleLoad);
14729
+ return ()=>iframe.removeEventListener('load', handleLoad);
14730
+ }
14731
+ }, []);
14517
14732
  return /*#__PURE__*/ jsx("div", {
14518
14733
  className: "flex w-full h-full",
14519
14734
  children: /*#__PURE__*/ jsx("div", {
14520
14735
  className: "flex justify-items-center w-full",
14521
14736
  children: /*#__PURE__*/ jsx("iframe", {
14522
- allow: "cross-origin",
14737
+ ref: iframeRef,
14738
+ sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",
14739
+ referrerPolicy: "strict-origin-when-cross-origin",
14740
+ allow: "geolocation 'none'; microphone 'none'; camera 'none'",
14523
14741
  src: `${router.basePath}/${GEN3_STATIC_NOTEBOOK_DIR}/${notebook}`,
14524
14742
  width: "100%",
14525
14743
  height: "100%",
@@ -14553,7 +14771,7 @@ class FilesystemContent {
14553
14771
  try {
14554
14772
  const files = myGlob(path.join(this.rootPath, filepath), filter);
14555
14773
  return Promise.all(files.map((file)=>this.get(path.join(filepath, file))));
14556
- } catch (err) {
14774
+ } catch (_err) {
14557
14775
  throw new Error(`getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`);
14558
14776
  }
14559
14777
  }
@@ -14608,12 +14826,18 @@ var ContentSource$1 = ContentSource.getInstance();
14608
14826
  * @returns A Promise resolving to an object containing header and footer props.
14609
14827
  */ const getNavPageLayoutPropsFromConfig = async ()=>{
14610
14828
  const navigationConfigJSON = await ContentSource$1.getContentDatabase().get(`${GEN3_COMMONS_NAME}/navigation.json`);
14611
- let bannerConfigJSON = [];
14612
- try {
14613
- bannerConfigJSON = await ContentSource$1.getContentDatabase().get(`${GEN3_COMMONS_NAME}/banner.json`);
14614
- } catch (error) {
14615
- console.warn('No banner config found at: ', `${GEN3_COMMONS_NAME}/banner.json`);
14616
- }
14829
+ const bannerConfigJSON = [];
14830
+ // TODO: enable later
14831
+ // try {
14832
+ // bannerConfigJSON = await ContentSource.getContentDatabase().get(
14833
+ // `${GEN3_COMMONS_NAME}/banner.json`,
14834
+ // );
14835
+ // } catch (error: unknown) {
14836
+ // console.warn(
14837
+ // 'No banner config found at: ',
14838
+ // `${GEN3_COMMONS_NAME}/banner.json`,
14839
+ // );
14840
+ // }
14617
14841
  const { topBar, navigation, type = 'original' } = navigationConfigJSON;
14618
14842
  let headerMetadata = {
14619
14843
  title: 'Gen3 Frontend Framework Page',
@@ -15199,8 +15423,9 @@ const cohortsAdapter = createEntityAdapter({
15199
15423
  const DEFAULT_COHORT_NAME = 'Default';
15200
15424
  const loadCohortsFromStorage = createAsyncThunk('cohorts/loadFromStorage', async ()=>{
15201
15425
  try {
15202
- const cohortsMap = await cohortStorage.getAllCohorts();
15203
- return Object(cohortsMap).values();
15426
+ const results = await cohortStorage.getAllCohorts();
15427
+ if (results.data) return Object.values(results.data);
15428
+ else return [];
15204
15429
  } catch (error) {
15205
15430
  console.error('Failed to load cohorts:', error);
15206
15431
  return [];
@@ -15242,11 +15467,13 @@ const deleteCohortFromStorage = createAsyncThunk('cohorts/deleteFromStorage', as
15242
15467
  return cohortId;
15243
15468
  });
15244
15469
  const emptyInitialState = cohortsAdapter.getInitialState({
15245
- currentCohortId: 'empty',
15470
+ currentCohortId: 'uninitialized',
15246
15471
  loading: false,
15472
+ uninitialized: true,
15247
15473
  error: null,
15248
15474
  autoSaveInProgress: []
15249
15475
  });
15476
+ // const initialState = emptyInitialState;
15250
15477
  const initialState = cohortsAdapter.addOne(emptyInitialState, createDefaultCohort());
15251
15478
  const updateAutoSave = (cohortId, state)=>{
15252
15479
  // Add to auto-save queue if not already present
@@ -15427,16 +15654,24 @@ const cohortManagerSlice = createSlice({
15427
15654
  extraReducers: (builder)=>{
15428
15655
  builder.addCase(loadCohortsFromStorage.pending, (state)=>{
15429
15656
  state.loading = true;
15657
+ state.uninitialized = false;
15430
15658
  state.error = null;
15659
+ console.log('loadCohortsFromStorage.pending');
15431
15660
  }).addCase(loadCohortsFromStorage.fulfilled, (state, action)=>{
15432
15661
  state.loading = false;
15662
+ console.log('loadCohortsFromStorage.fulfilled', action.payload);
15433
15663
  if (action.payload.length > 0) {
15434
- if (Object.keys(state.entities).length === 1) {
15435
- cohortsAdapter.removeOne(state, state.entities[0].id);
15664
+ if (Object.keys(state.entities).length >= 0) {
15665
+ cohortsAdapter.removeAll(state);
15436
15666
  }
15437
15667
  cohortsAdapter.addMany(state, action.payload);
15438
15668
  const sortedCohorts = action.payload.sort((a, b)=>b.modifiedDatetime.localeCompare(a.modifiedDatetime));
15439
15669
  state.currentCohortId = sortedCohorts[0].id;
15670
+ } else {
15671
+ // No cohorts in storage, create default cohort
15672
+ const defaultCohort = createDefaultCohort();
15673
+ cohortsAdapter.addOne(state, defaultCohort);
15674
+ state.currentCohortId = defaultCohort.id;
15440
15675
  }
15441
15676
  }).addCase(loadCohortsFromStorage.rejected, (state, action)=>{
15442
15677
  state.loading = false;
@@ -15493,6 +15728,7 @@ const cohortManagerReducer = cohortManagerSlice.reducer;
15493
15728
  const getCurrentCohort = (state)=>{
15494
15729
  const cohort = state.entities[state.currentCohortId];
15495
15730
  if (!cohort) {
15731
+ console.log('creating default cohort');
15496
15732
  return createDefaultCohort();
15497
15733
  }
15498
15734
  return cohort;
@@ -15602,7 +15838,6 @@ const reducers = combineReducers({
15602
15838
  filtersExpandedState: filtersExpandedReducer,
15603
15839
  facetDefinitionState: facetDefinitionsReducer,
15604
15840
  cohorts: cohortManagerReducer,
15605
- // savedCohorts: saveCohortPersistenceReducer,
15606
15841
  dataAccessRequests: dataAccessRequestsReducer
15607
15842
  });
15608
15843
  const persistedReducers = persistReducer(persistConfig, reducers);
@@ -15613,6 +15848,10 @@ const { id, AppStore, AppContext, useAppSelector, useAppDispatch } = createAppSt
15613
15848
  version: '0.0.1'
15614
15849
  });
15615
15850
 
15851
+ process.env.GEN3_COHORT_DISCOVERY_API || `${GEN3_API}/api/auth/analysis/cohortDiscovery`;
15852
+ const UninitializeCohort = {
15853
+ filters: {}};
15854
+
15616
15855
  // Selectors
15617
15856
  const { selectAll: selectAllCohorts, selectTotal: selectTotalCohorts, selectById: selectCohortById, selectIds: selectCohortIds } = cohortsAdapter.getSelectors((state)=>state.cohorts);
15618
15857
  const selectCurrentCohortId = (state)=>state.cohorts.currentCohortId;
@@ -15620,7 +15859,7 @@ const selectCurrentCohort = (state)=>{
15620
15859
  const { currentCohortId, entities } = state.cohorts;
15621
15860
  const cohort = entities[currentCohortId];
15622
15861
  if (!cohort) {
15623
- return createDefaultCohort();
15862
+ return null;
15624
15863
  }
15625
15864
  return cohort;
15626
15865
  };
@@ -15642,15 +15881,15 @@ createSelector([
15642
15881
  ], (autoSaveArray, cohortId)=>autoSaveArray.includes(cohortId));
15643
15882
  const selectCurrentCohortName = createSelector([
15644
15883
  selectCurrentCohort
15645
- ], (cohort)=>cohort.name);
15884
+ ], (cohort)=>cohort?.name ?? 'No Cohort Defined');
15646
15885
  const selectCurrentCohortFilters = createSelector([
15647
15886
  selectCurrentCohort
15648
- ], (cohort)=>cohort.filters);
15887
+ ], (cohort)=>cohort ? cohort.filters : UninitializeCohort.filters);
15649
15888
  const selectCurrentCohortIndexFilters = createSelector([
15650
15889
  selectCurrentCohort,
15651
15890
  (state, index)=>index
15652
15891
  ], (cohort, index)=>{
15653
- return cohort.filters?.[index] ?? EmptyFilterSet;
15892
+ return cohort?.filters?.[index] ?? EmptyFilterSet;
15654
15893
  });
15655
15894
  createSelector([
15656
15895
  selectAllCohorts,
@@ -15662,7 +15901,6 @@ createSelector([
15662
15901
  const trimmedName = params.name.trim().toLowerCase();
15663
15902
  return cohorts.some((cohort)=>cohort.id !== params.excludeId && cohort.name.trim().toLowerCase() === trimmedName);
15664
15903
  });
15665
- const selectCohortManagerLoading = (state)=>state.cohorts.loading;
15666
15904
  const selectCohortIdToNameMap = createSelector([
15667
15905
  selectAllCohorts
15668
15906
  ], (cohorts)=>{
@@ -16129,14 +16367,12 @@ const submitCohortRequestAction = async (cohort, values, user, indexResources, r
16129
16367
  }
16130
16368
  };
16131
16369
 
16132
- const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16133
- const dispatch = useAppDispatch();
16370
+ const CohortManagerPanel = ({ indexResources, remoteSupportService, size = 'md' })=>{
16371
+ const appDispatch = useAppDispatch();
16134
16372
  const [isEditing, setIsEditing] = useState(false);
16135
16373
  const [editingLabel, setEditingLabel] = useState('');
16136
16374
  const allCohorts = useAppSelector(selectAllCohorts);
16137
16375
  const currentCohort = useAppSelector(selectCurrentCohort);
16138
- const loading = useAppSelector(selectCohortManagerLoading);
16139
- const appDispatch = useAppDispatch();
16140
16376
  const [getGetAggs] = useLazyGetAggsNoFilterSelfQuery();
16141
16377
  const [requestQuery] = useCreateRequestMutation();
16142
16378
  const user = useCoreSelector(selectUserDetails);
@@ -16153,7 +16389,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16153
16389
  };
16154
16390
  const saveEdit = ()=>{
16155
16391
  if (editingLabel.trim() === '' || !currentCohort.name) return;
16156
- dispatch(updateCohortName({
16392
+ appDispatch(updateCohortName({
16157
16393
  id: currentCohort.id,
16158
16394
  name: editingLabel
16159
16395
  }));
@@ -16161,7 +16397,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16161
16397
  setEditingLabel('');
16162
16398
  };
16163
16399
  const handleCreateNew = ()=>{
16164
- dispatch(createNewCohort({
16400
+ appDispatch(createNewCohort({
16165
16401
  name: 'New Cohort'
16166
16402
  }));
16167
16403
  };
@@ -16173,22 +16409,26 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16173
16409
  }, [
16174
16410
  allCohorts
16175
16411
  ]);
16412
+ useDeepCompareEffect(()=>{
16413
+ if (!currentCohort) {
16414
+ appDispatch(setCurrentCohortId(allCohorts[0].id));
16415
+ }
16416
+ }, [
16417
+ allCohorts,
16418
+ currentCohort,
16419
+ setCurrentCohortId
16420
+ ]);
16176
16421
  const onSelectCohort = useCallback((_value, option)=>{
16177
16422
  if (option) {
16178
- dispatch(setCurrentCohortId(option.value));
16423
+ appDispatch(setCurrentCohortId(option.value));
16179
16424
  }
16180
16425
  }, [
16181
- dispatch
16426
+ appDispatch
16182
16427
  ]);
16183
16428
  const handleCohortAccessRequest = async (cohortId, values)=>{
16184
16429
  const cohort = allCohorts.find((obj)=>obj.id === cohortId);
16185
16430
  if (cohort) await submitCohortRequestAction(cohort, values, user, indexResources, remoteSupportService, appDispatch, getGetAggs, requestQuery);
16186
16431
  };
16187
- if (loading) {
16188
- return /*#__PURE__*/ jsx("div", {
16189
- children: "Loading cohorts..."
16190
- });
16191
- }
16192
16432
  return /*#__PURE__*/ jsxs(Group, {
16193
16433
  gap: "xs",
16194
16434
  className: "flex pt-4 pl-2",
@@ -16246,7 +16486,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16246
16486
  onClick: saveEdit,
16247
16487
  "data-testid": "completeCohortRenameButton",
16248
16488
  "aria-label": "Complete rename cohort",
16249
- disabled: editingLabel.trim() === '' || editingLabel.trim() === currentCohort.name,
16489
+ disabled: editingLabel.trim() === '' || editingLabel.trim() === currentCohort?.name,
16250
16490
  size: `compact-${size}`,
16251
16491
  children: /*#__PURE__*/ jsx(Icon, {
16252
16492
  icon: "gen3:check",
@@ -16321,7 +16561,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16321
16561
  color: theme.colors.accent[4]
16322
16562
  },
16323
16563
  onConfirm: ()=>{
16324
- dispatch(removeCohort(currentCohort.id));
16564
+ appDispatch(removeCohort(currentCohort.id));
16325
16565
  }
16326
16566
  });
16327
16567
  },
@@ -16363,8 +16603,15 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16363
16603
  ]
16364
16604
  });
16365
16605
  };
16366
-
16367
- process.env.GEN3_COHORT_DISCOVERY_API || `${GEN3_API}/api/auth/analysis/cohortDiscovery`;
16606
+ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16607
+ // TODO: initialize and load cohorts from cohort storage
16608
+ // as right now the redux-persist is handling cohorts
16609
+ return /*#__PURE__*/ jsx(CohortManagerPanel, {
16610
+ indexResources: indexResources,
16611
+ remoteSupportService: remoteSupportService,
16612
+ size: size
16613
+ });
16614
+ };
16368
16615
 
16369
16616
  const useGraphQLData = (url, body, skip)=>{
16370
16617
  // Create a fetcher function that handles the GraphQL POST request
@@ -16833,22 +17080,6 @@ const SavedCohortsTable = ({ indexResources, remoteSupportService, size = 'md' }
16833
17080
  })
16834
17081
  })
16835
17082
  }),
16836
- /*#__PURE__*/ jsx(Tooltip, {
16837
- label: "Select Cohort",
16838
- withArrow: true,
16839
- children: /*#__PURE__*/ jsx(ActionIcon, {
16840
- color: "accent.4",
16841
- variant: "transparent",
16842
- "aria-label": "Select cohort",
16843
- onClick: ()=>{},
16844
- children: /*#__PURE__*/ jsx(Icon, {
16845
- icon: "gen3:cohort",
16846
- height: iconSize,
16847
- width: iconSize,
16848
- color: theme.colors.secondary[4]
16849
- })
16850
- })
16851
- }),
16852
17083
  /*#__PURE__*/ jsx(Tooltip, {
16853
17084
  label: "Delete Cohort",
16854
17085
  withArrow: true,
@@ -19376,6 +19607,7 @@ const MetadataDictionary = ({ schemas })=>{
19376
19607
  }
19377
19608
  return /*#__PURE__*/ jsxs(Tabs, {
19378
19609
  defaultValue: schemas[0].schemaID,
19610
+ variant: schemas[0]?.tabType,
19379
19611
  className: "w-full",
19380
19612
  keepMounted: false,
19381
19613
  children: [
@@ -19715,6 +19947,7 @@ const Discovery = ({ discoveryConfig })=>{
19715
19947
  children: /*#__PURE__*/ jsxs(Tabs, {
19716
19948
  className: "w-full",
19717
19949
  defaultValue: metadataIndex,
19950
+ variant: discoveryConfig.metadataConfig[0]?.tabType,
19718
19951
  onChange: (v)=>{
19719
19952
  setMetadataIndex(v ?? '0');
19720
19953
  },
@@ -20016,6 +20249,9 @@ const LandingPageGetServerSideProps = async ()=>{
20016
20249
  };
20017
20250
  };
20018
20251
 
20252
+ const CohortBuilder = dynamic(()=>Promise.resolve().then(function () { return CohortBuilder$2; }), {
20253
+ ssr: false
20254
+ });
20019
20255
  const ExplorerPage = ({ headerProps, footerProps, explorerConfig, headerMetadata, tabsLayout, sharedFiltersMap })=>{
20020
20256
  if (explorerConfig === undefined) {
20021
20257
  return /*#__PURE__*/ jsx(Center, {
@@ -25913,6 +26149,13 @@ const staticNotebookAPI = async (req, res)=>{
25913
26149
  });
25914
26150
  }
25915
26151
  const rawContent = fs.readFileSync(fullPath, 'utf8');
26152
+ DOMPurify.addHook('afterSanitizeAttributes', function(node) {
26153
+ if (node.tagName === 'a' || node.tagName === 'A') {
26154
+ // Check for anchor tags and target attribute
26155
+ node.setAttribute('target', '_blank');
26156
+ node.setAttribute('rel', 'noopener'); // Prevent window.opener vulnerability
26157
+ }
26158
+ });
25916
26159
  const sanitizedContent = DOMPurify.sanitize(rawContent, {
25917
26160
  ALLOWED_TAGS: [
25918
26161
  'p',
@@ -25961,5 +26204,5 @@ const staticNotebookAPI = async (req, res)=>{
25961
26204
  });
25962
26205
  };
25963
26206
 
25964
- export { AISearchPageGetServerSideProps, AccessLevel, AccordionPanel, ActionBar, ActionButton, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisCenterWithSections, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BAD_DATA_MESSAGE, Banner, BaseModal, Charts, CohortBuilder, CohortManager$1 as CohortManager, CollapsableCharts, CollapsableSidebar, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource$1 as ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DAYS_IN_YEAR, DEFAULT_MAXIMUM, DEFAULT_MINIMUM, DEFAULT_VISIBLE_ITEMS$1 as DEFAULT_VISIBLE_ITEMS, DataLibraryPage, DataLibraryPageGetServerSideProps, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, DropdownButton, DropdownPanel, DropdownWithIcon, EnumFacet, EnumFacetChart, ErrorCard, ExactValueFacet, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerPageGetServerSidePropsForConfigId, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FacetControlsHeader, FacetExpander, FacetSelector, FacetSortPanel, FacetTabs, FiltersPanel, FirstTimeModal, Footer, Gen3Button, Gen3ButtonReverse, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header$1 as Header, HoverLink, LandingPage, LandingPageGetServerSideProps, LoginButton$1 as LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, MinutesToMilliseconds, MultiSelectValueFacet, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryExpression, QueryExpressionContext, QueryExpressionSection, QueryPage, QueryPageGetServerSideProps, RangeFacet, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SegmentedControl, SessionExpiredModal, SinglePageStudyDetailsPanel, StaticNotebookIFrame, StaticNotebookViewer, StudyDetailsPanel, StudyGroup, StudyGroupPanel, StudyProvider, SubmissionPage, SubmissionPageGetServerSideProps, TabbedCohortBuilder, TabbedCohortBuilderPage, TabbedCohortBuilderPageGetServerSideProps, TabbedPanel, TagCloud, TailwindConfig, TopBar, UploadJSONButton, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, accessibleFieldName, addIntersectionToIncludes, addUnion, analysisApiCohortDiscovery, buildNested, capitalize, classifyFacets, compareKeysAscending, compareKeysDescending, computeRowSpan, convertMinutesToMilliseconds, convertPathsToTree, convertSecondsToMilliseconds, convertToStringArray, create10ColorAccessibleContrast, create10ColorPallet, createMantineTheme, credentialsLogin, credentialsLogout, extractObjectKey, extractRangeValues, focusStyles, getAllFieldsFromFilterConfigs, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isEnumFacetResponse, isHeaderMetadata, isPropertyKey, isTextTransform$1 as isTextTransform, mapFacetSortToSortType, processBucketData, processLabel$1 as processLabel, processRangeData, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortSimilarityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, registerMetadataSchemaApp, removeIntersectionFromEnum, removeKey$1 as removeKey, removeUnion, resourcePathFromProjectID, sessionLogout, sessionToken, staticNotebookAPI, stripTrailingSlash, toCountsString, toDisplayName, truncateString, unixTimeToString, updateFacetEnum, useClearFilters$1 as useClearFilters, useDiscoveryContext, useExtractEnumFilterValues, useExtractRangeFilterValues, useFieldNameToTitle, useGetFacetFilters$1 as useGetFacetFilters, useUpdateFilters$1 as useUpdateFilters, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
26207
+ export { AISearchPageGetServerSideProps, AccessLevel, AccordionPanel, ActionBar, ActionButton, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisCenterWithSections, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BAD_DATA_MESSAGE, Banner, BaseModal, Charts, CohortBuilder$1 as CohortBuilder, CohortManager$1 as CohortManager, CollapsableCharts, CollapsableSidebar, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource$1 as ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DAYS_IN_YEAR, DEFAULT_MAXIMUM, DEFAULT_MINIMUM, DEFAULT_VISIBLE_ITEMS$1 as DEFAULT_VISIBLE_ITEMS, DataLibraryPage, DataLibraryPageGetServerSideProps, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, DropdownButton, DropdownPanel, DropdownWithIcon, EnumFacet, EnumFacetChart, ErrorCard, ExactValueFacet, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerPageGetServerSidePropsForConfigId, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FacetControlsHeader, FacetExpander, FacetSelector, FacetSortPanel, FacetTabs, FiltersPanel, FirstTimeModal, Footer, Gen3Button, Gen3ButtonReverse, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header$1 as Header, HoverLink, LandingPage, LandingPageGetServerSideProps, LoginButton$1 as LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, MinutesToMilliseconds, MultiSelectValueFacet, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryExpression, QueryExpressionContext, QueryExpressionSection, QueryPage, QueryPageGetServerSideProps, RangeFacet, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SegmentedControl, SessionExpiredModal, SinglePageStudyDetailsPanel, StaticNotebookIFrame, StaticNotebookViewer, StudyDetailsPanel, StudyGroup, StudyGroupPanel, StudyProvider, SubmissionPage, SubmissionPageGetServerSideProps, TabbedCohortBuilder, TabbedCohortBuilderPage, TabbedCohortBuilderPageGetServerSideProps, TabbedPanel, TagCloud, TailwindConfig, TopBar, UploadJSONButton, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, accessibleFieldName, addIntersectionToIncludes, addUnion, analysisApiCohortDiscovery, buildNested, capitalize, classifyFacets, compareKeysAscending, compareKeysDescending, computeRowSpan, convertMinutesToMilliseconds, convertPathsToTree, convertSecondsToMilliseconds, convertToStringArray, create10ColorAccessibleContrast, create10ColorPallet, createMantineTheme, credentialsLogin, credentialsLogout, extractObjectKey, extractRangeValues, filterAggregationsDataKeys, focusStyles, getAllFieldsFromFilterConfigs, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isEnumFacetResponse, isHeaderMetadata, isPropertyKey, isTextTransform$1 as isTextTransform, mapFacetSortToSortType, processBucketData, processLabel$1 as processLabel, processRangeData, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortSimilarityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, registerMetadataSchemaApp, removeIntersectionFromEnum, removeKey$1 as removeKey, removeUnion, resourcePathFromProjectID, sessionLogout, sessionToken, staticNotebookAPI, stripTrailingSlash, toCountsString, toDisplayName, truncateString, unixTimeToString, updateFacetEnum, useClearFilters$1 as useClearFilters, useDiscoveryContext, useExtractEnumFilterValues, useExtractRangeFilterValues, useFieldNameToTitle, useGetFacetFilters$1 as useGetFacetFilters, useUpdateFilters$1 as useUpdateFilters, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
25965
26208
  //# sourceMappingURL=index.js.map