synapse-react-client 4.0.21 → 4.0.22
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/SWC.index.d.ts +1 -0
- package/dist/SWC.index.d.ts.map +1 -1
- package/dist/SWC.index.js +2 -1
- package/dist/SWC.index.js.map +1 -1
- package/dist/components/CardContainer/CardContainer.d.ts.map +1 -1
- package/dist/components/CardContainer/CardContainer.js +43 -49
- package/dist/components/CardContainer/CardContainer.js.map +1 -1
- package/dist/components/CardContainerLogic/CardContainerLogic.d.ts +13 -0
- package/dist/components/CardContainerLogic/CardContainerLogic.d.ts.map +1 -1
- package/dist/components/CardContainerLogic/CardContainerLogic.js +64 -40
- package/dist/components/CardContainerLogic/CardContainerLogic.js.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.css +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
- package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.scss +0 -1
- package/dist/components/DataGrid/DataGrid.d.ts +1 -0
- package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +72 -72
- package/dist/components/DataGrid/DataGrid.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +209 -206
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts +2 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js +51 -42
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +68 -67
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts +1 -0
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +4 -3
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js +15 -14
- package/dist/components/DataGrid/utils/modelColsToGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts +7 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.js +8 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.js.map +1 -0
- package/dist/components/Goals/Goals.d.ts +8 -0
- package/dist/components/Goals/Goals.d.ts.map +1 -1
- package/dist/components/Goals/Goals.js +54 -40
- package/dist/components/Goals/Goals.js.map +1 -1
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts +9 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js +69 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js.map +1 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts +13 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js +11 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js.map +1 -0
- package/dist/components/ProjectVisibilityChip/index.d.ts +5 -0
- package/dist/components/ProjectVisibilityChip/index.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/index.js +7 -0
- package/dist/components/ProjectVisibilityChip/index.js.map +1 -0
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/RowSetView.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/RowSetView.js +9 -12
- package/dist/components/QueryWrapperPlotNav/RowSetView.js.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.d.ts +7 -15
- package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.js +114 -123
- package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
- package/dist/components/UserCardList/UserCardList.d.ts +2 -20
- package/dist/components/UserCardList/UserCardList.d.ts.map +1 -1
- package/dist/components/UserCardList/UserCardList.js +49 -72
- package/dist/components/UserCardList/UserCardList.js.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.d.ts +13 -0
- package/dist/components/UserCardList/UserCardListRotate.d.ts.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.js +82 -57
- package/dist/components/UserCardList/UserCardListRotate.js.map +1 -1
- package/dist/style/abstracts/_cssVariables.scss +1 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +1 -0
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +3 -0
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/index.js +46 -44
- package/dist/synapse-queries/user/index.js +3 -3
- package/dist/synapse-queries/user/useUserBundle.d.ts +12 -0
- package/dist/synapse-queries/user/useUserBundle.d.ts.map +1 -1
- package/dist/synapse-queries/user/useUserBundle.js +50 -36
- package/dist/synapse-queries/user/useUserBundle.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts +10 -5
- package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts.map +1 -1
- package/dist/utils/AppUtils/session/SessionInitializedGuard.js +13 -9
- package/dist/utils/AppUtils/session/SessionInitializedGuard.js.map +1 -1
- package/dist/utils/functions/SqlFunctions.d.ts +1 -1
- package/dist/utils/functions/SqlFunctions.d.ts.map +1 -1
- package/dist/utils/functions/SqlFunctions.js +1 -1
- package/dist/utils/functions/SqlFunctions.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { consolidateResourceAccessList as e } from "../../utils/functions/AccessControlListUtils.js";
|
|
2
|
+
import { ACCESS_TYPE as t } from "@sage-bionetworks/synapse-types";
|
|
3
|
+
//#region src/components/ProjectVisibilityChip/getProjectVisibilityFromACL.ts
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
let i = e(n), a = i.find((e) => e.principalId === Number(r.publicGroup))?.accessType ?? [], o = i.find((e) => e.principalId === Number(r.authenticatedUsers))?.accessType ?? [], s = a.includes(t.READ), c = o.includes(t.READ), l = o.includes(t.DOWNLOAD);
|
|
6
|
+
return s && c && l ? "PUBLIC" : s && c ? "DISCOVERABLE" : "PRIVATE";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as getProjectVisibilityFromACL };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=getProjectVisibilityFromACL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getProjectVisibilityFromACL.js","names":[],"sources":["../../../src/components/ProjectVisibilityChip/getProjectVisibilityFromACL.ts"],"sourcesContent":["import { ACCESS_TYPE, ResourceAccess } from '@sage-bionetworks/synapse-types'\nimport { consolidateResourceAccessList } from '@/utils/functions/AccessControlListUtils'\n\nexport type ProjectVisibility = 'PRIVATE' | 'DISCOVERABLE' | 'PUBLIC'\n\n/**\n * Determines a project's visibility category based on its Access Control List (ACL).\n * - **PUBLIC**: Public group has READ access AND authenticated users have both READ and DOWNLOAD access.\n * - **DISCOVERABLE**: Public group has READ access AND authenticated users have READ access (but lack DOWNLOAD access).\n * - **PRIVATE**: Default state; matches neither condition above.\n */\nexport function getProjectVisibilityFromACL(\n resourceAccess: ResourceAccess[],\n realmPrincipals: { publicGroup?: string; authenticatedUsers?: string },\n): ProjectVisibility {\n const consolidated = consolidateResourceAccessList(resourceAccess)\n\n // Extract access types for public and authenticated principals\n const publicAccess =\n consolidated.find(\n ra => ra.principalId === Number(realmPrincipals.publicGroup),\n )?.accessType ?? []\n\n const authAccess =\n consolidated.find(\n ra => ra.principalId === Number(realmPrincipals.authenticatedUsers),\n )?.accessType ?? []\n\n const publicCanRead = publicAccess.includes(ACCESS_TYPE.READ)\n const authCanRead = authAccess.includes(ACCESS_TYPE.READ)\n const authCanDownload = authAccess.includes(ACCESS_TYPE.DOWNLOAD)\n\n if (publicCanRead && authCanRead && authCanDownload) {\n return 'PUBLIC'\n }\n if (publicCanRead && authCanRead) {\n return 'DISCOVERABLE'\n }\n return 'PRIVATE'\n}\n"],"mappings":";;;AAWA,SAAgB,EACd,GACA,GACmB;CACnB,IAAM,IAAe,EAA8B,CAAc,GAG3D,IACJ,EAAa,MACX,MAAM,EAAG,gBAAgB,OAAO,EAAgB,WAAW,CAC7D,GAAG,cAAc,CAAC,GAEd,IACJ,EAAa,MACX,MAAM,EAAG,gBAAgB,OAAO,EAAgB,kBAAkB,CACpE,GAAG,cAAc,CAAC,GAEd,IAAgB,EAAa,SAAS,EAAY,IAAI,GACtD,IAAc,EAAW,SAAS,EAAY,IAAI,GAClD,IAAkB,EAAW,SAAS,EAAY,QAAQ;CAQhE,OANI,KAAiB,KAAe,IAC3B,WAEL,KAAiB,IACZ,iBAEF;AACT"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ProjectVisibilityChip from './ProjectVisibilityChip';
|
|
2
|
+
import type { ProjectVisibilityChipProps, ProjectVisibilityChipContainerProps } from './ProjectVisibilityChip';
|
|
3
|
+
export { ProjectVisibilityChip, ProjectVisibilityChipProps, ProjectVisibilityChipContainerProps, };
|
|
4
|
+
export default ProjectVisibilityChip;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProjectVisibilityChip/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,mCAAmC,EACpC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,mCAAmC,GACpC,CAAA;AACD,eAAe,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ProjectVisibilityChip/index.ts"],"sourcesContent":["import ProjectVisibilityChip from './ProjectVisibilityChip'\nimport type {\n ProjectVisibilityChipProps,\n ProjectVisibilityChipContainerProps,\n} from './ProjectVisibilityChip'\nexport {\n ProjectVisibilityChip,\n ProjectVisibilityChipProps,\n ProjectVisibilityChipContainerProps,\n}\nexport default ProjectVisibilityChip\n"],"mappings":";;AAUA,IAAA,IAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryVisualizationWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAA6C,MAAM,OAAO,CAAA;AAI5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAA;AAUpG,KAAK,uBAAuB,GAAG;IAC7B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uGAAuG;IACvG,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,gGAAgG;IAChG,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,6BAA6B;IAC7B,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAA;IACjC;mEAC+D;IAC/D,kCAAkC,CAAC,EAAE,MAAM,CAAA;IAC3C,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,CAAA;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;gDAC4C;IAC5C,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,CAAA;IAC7D,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"QueryVisualizationWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx"],"names":[],"mappings":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AAA;IACxB;gDAC4C;IAC5C,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,CAAA;IAC7D,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,8BAA8B,2CAqNtC"}
|
|
@@ -32,7 +32,7 @@ function m(m) {
|
|
|
32
32
|
X
|
|
33
33
|
]);
|
|
34
34
|
let Z = s((e, t) => {
|
|
35
|
-
let n = localStorage.getItem("force-display-original-column-names") === "true";
|
|
35
|
+
let n = typeof localStorage < "u" && localStorage.getItem("force-display-original-column-names") === "true";
|
|
36
36
|
if (!e || n && !t) return e;
|
|
37
37
|
if (T[e]) return T[e];
|
|
38
38
|
if (t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryVisualizationWrapper.js","names":[],"sources":["../../../src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx"],"sourcesContent":["import { getDisplayValue } from '@/utils/functions/getDataFromFromStorage'\nimport { unCamelCase } from '@/utils/functions/unCamelCase'\nimport useMutuallyExclusiveState from '@/utils/hooks/useMutuallyExclusiveState'\nimport { useQuery } from '@tanstack/react-query'\nimport { ReactNode, useCallback, useEffect, useMemo, useState } from 'react'\nimport { useDeepCompareMemoize } from 'use-deep-compare-effect'\nimport { useQueryContext } from '../QueryContext'\nimport { useGetQueryMetadata } from '../QueryWrapper/useGetQueryMetadata'\nimport { NoContentPlaceholderType } from '../SynapseTable/NoContentPlaceholderType'\nimport { ExternalAnalysisPlatform } from '../SynapseTable/export/ExternalAnalysisPlatformsConstants'\nimport NoContentPlaceholderComponent from './NoContentPlaceholder'\nimport {\n QueryVisualizationContextProvider,\n QueryVisualizationContextType,\n} from './QueryVisualizationContext'\n\n// By default, show no external analysis platforms.\nconst DEFAULT_ENABLED_ANALYSIS_PLATFORMS: ExternalAnalysisPlatform[] = []\n\ntype ColumnOrFacetHelpConfig = {\n /** Text that describes the column or facet */\n helpText: string\n /** The name of the column for which the markdown applies */\n columnName: string\n /** The JSON path matching a described JSON Column facet */\n jsonPath?: string\n}\n\nexport type QueryVisualizationWrapperProps = {\n children: ReactNode | ReactNode[]\n rgbIndex?: number\n /** The singular word to use to describe a what a row represents (e.g. \"file\"). Defaults to \"result\" */\n unitDescription?: string\n /** Mapping from column name to the name that should be shown for the column */\n columnAliases?: Record<string, string>\n visibleColumnCount?: number\n hiddenColumns?: string[]\n defaultShowPlots?: boolean\n hideCopyToClipboard?: boolean\n hideSearchBarControl?: boolean\n /** When true, the text matches filter pill is shown but cannot be removed. Defaults to true. */\n lockTextMatchesQueryFilterPill?: boolean\n defaultShowSearchBar?: boolean\n showLastUpdatedOn?: boolean\n /** Default is INTERACTIVE */\n noContentPlaceholderType?: NoContentPlaceholderType\n isRowSelectionVisible?: boolean\n /** The set of columns that defines a uniqueness constraint on the table for the purposes of filtering based on row selection.\n * Note that Synapse tables have no internal concept of a primary key.\n */\n rowSelectionPrimaryKey?: string[]\n /** Look for additional filters using the given key. If not provided, the entity ID will be used.\n * @deprecated - configure the filter before passing a query */\n additionalFiltersSessionStorageKey?: string\n /** Configuration to add a help popover to each corresponding column header */\n helpConfiguration?: ColumnOrFacetHelpConfig[]\n hasCustomPlots?: boolean\n /** The set of external analysis platform to which the UI will support exporting data.\n * @default [] (no platforms are enabled) */\n enabledExternalAnalysisPlatforms?: ExternalAnalysisPlatform[]\n hideVisualizationsControl?: boolean\n}\n\n/**\n * QueryVisualizationWrapper manages UI state for components that query tables in Synapse. That state can be accessed\n * or updated using QueryVisualizationContext. A QueryVisualizationWrapper must be used within a QueryWrapper.\n */\nexport function QueryVisualizationWrapper(\n props: QueryVisualizationWrapperProps,\n) {\n const {\n noContentPlaceholderType = NoContentPlaceholderType.INTERACTIVE,\n defaultShowSearchBar = false,\n defaultShowPlots = true,\n hideCopyToClipboard = false,\n hideSearchBarControl = false,\n lockTextMatchesQueryFilterPill = true,\n unitDescription = 'result',\n helpConfiguration,\n hasCustomPlots = false,\n visibleColumnCount = Infinity,\n enabledExternalAnalysisPlatforms = DEFAULT_ENABLED_ANALYSIS_PLATFORMS,\n } = props\n\n const columnAliases = useMemo(\n () => props.columnAliases ?? {},\n [props.columnAliases],\n )\n\n const {\n getCurrentQueryRequest,\n hasFacetedSelectColumn,\n hasResettableFilters,\n rowDataQueryOptions,\n } = useQueryContext()\n const { data: queryMetadata } = useGetQueryMetadata()\n\n // Get the selectColumns from either query so that creating the context isn't bottlenecked by one or the other\n // Use the previous result as placeholder data so we don't reset the selectColumns unless they have actually changed.\n const { data: selectColumnsFromRowData } = useQuery({\n ...rowDataQueryOptions,\n select: data => data.responseBody?.queryResult?.queryResults.headers,\n placeholderData: prevData => prevData,\n })\n const { data: selectColumnsFromMetadata } = useGetQueryMetadata({\n select: data => data.responseBody?.selectColumns,\n placeholderData: prevData => prevData,\n })\n // We deep-compare-memoize the selectColumns so we don't reset visible columns if the reference changes, but not the contents (e.g. on page change)\n const selectColumns = useDeepCompareMemoize(\n selectColumnsFromRowData ?? selectColumnsFromMetadata ?? [],\n )\n\n const [showSqlEditor, setShowSqlEditor] = useState(false)\n const [showPlots, setShowPlots] = useState(defaultShowPlots)\n const [showCopyToClipboard, setShowCopyToClipboard] =\n useState(!hideCopyToClipboard)\n const [showFacetFilter, setShowFacetFilter] = useState(true)\n\n // The search bar and download confirmation should not be shown at the same time.\n const [\n showSearchBar,\n setShowSearchBar,\n showDownloadConfirmation,\n setShowDownloadConfirmation,\n ] = useMutuallyExclusiveState(\n defaultShowSearchBar && !hideSearchBarControl,\n false,\n )\n\n const [\n isShowingExportToAnalysisPlatformModal,\n setIsShowingExportToAnalysisPlatformModal,\n ] = useState<boolean>(false)\n\n const [visibleColumns, setVisibleColumns] = useState<string[]>([])\n\n const lastQueryRequest = useMemo(\n () => getCurrentQueryRequest(),\n [getCurrentQueryRequest],\n )\n\n // Deep-compare-memoize so callers passing a fresh array literal\n // (e.g. `hiddenColumns={['topic']}`) don't reset visible columns on every\n // parent render.\n const hiddenColumns = useDeepCompareMemoize(props.hiddenColumns ?? [])\n useEffect(() => {\n // SWC-6030: If sql changes, reset what columns are visible\n const hidden = new Set(hiddenColumns)\n setVisibleColumns(\n selectColumns\n .filter(el => !hidden.has(el.name))\n .slice(0, visibleColumnCount)\n .map(el => el.name),\n )\n }, [\n selectColumns,\n lastQueryRequest.query.sql,\n visibleColumnCount,\n hiddenColumns,\n ])\n\n const getColumnDisplayName = useCallback(\n (columnName: string, jsonPath?: string) => {\n // SWC-5982: if force-display-original-column-names is set, then just return the string\n const forceDisplayOriginalColumnName =\n localStorage.getItem('force-display-original-column-names') === 'true'\n\n if (!columnName || (forceDisplayOriginalColumnName && !jsonPath)) {\n return columnName\n }\n if (columnAliases[columnName]) {\n return columnAliases[columnName]\n }\n if (jsonPath) {\n const columnModel = queryMetadata?.columnModels?.find(\n cm => cm.name === columnName,\n )\n if (columnModel?.jsonSubColumns) {\n const jsonSubColumn = columnModel.jsonSubColumns.find(\n jsc => jsc.jsonPath === jsonPath,\n )\n if (jsonSubColumn) {\n return jsonSubColumn.name\n }\n }\n }\n return unCamelCase(columnName)\n },\n [columnAliases, queryMetadata?.columnModels],\n )\n\n const getHelpText = useCallback(\n (columnName: string, jsonPath?: string): string | undefined => {\n if (Array.isArray(helpConfiguration)) {\n const helpConfig = helpConfiguration.find(\n config =>\n config.columnName === columnName && config.jsonPath === jsonPath,\n )\n return helpConfig?.helpText\n }\n return undefined\n },\n [helpConfiguration],\n )\n\n const NoContentPlaceholder = useCallback(\n () => (\n <NoContentPlaceholderComponent\n type={noContentPlaceholderType}\n hasResettableFilters={hasResettableFilters}\n />\n ),\n [noContentPlaceholderType, hasResettableFilters],\n )\n\n const context: QueryVisualizationContextType = useMemo(\n () => ({\n columnsToShowInTable: visibleColumns,\n setColumnsToShowInTable: setVisibleColumns,\n rgbIndex: props.rgbIndex,\n unitDescription: unitDescription,\n showLastUpdatedOn: props.showLastUpdatedOn,\n getColumnDisplayName,\n getDisplayValue,\n getHelpText,\n NoContentPlaceholder,\n isShowingExportToAnalysisPlatformModal:\n isShowingExportToAnalysisPlatformModal,\n setIsShowingExportToAnalysisPlatformModal:\n setIsShowingExportToAnalysisPlatformModal,\n showFacetFilter: hasFacetedSelectColumn ? showFacetFilter : false,\n setShowFacetFilter,\n hideSearchBarControl,\n lockTextMatchesQueryFilterPill,\n showSearchBar,\n setShowSearchBar,\n showDownloadConfirmation,\n setShowDownloadConfirmation,\n showSqlEditor,\n setShowSqlEditor,\n showPlots: hasCustomPlots || hasFacetedSelectColumn ? showPlots : false,\n setShowPlots,\n showCopyToClipboard,\n setShowCopyToClipboard,\n enabledExternalAnalysisPlatforms,\n }),\n [\n NoContentPlaceholder,\n getColumnDisplayName,\n getHelpText,\n hasFacetedSelectColumn,\n isShowingExportToAnalysisPlatformModal,\n props.rgbIndex,\n props.showLastUpdatedOn,\n setShowDownloadConfirmation,\n setShowSearchBar,\n showCopyToClipboard,\n showDownloadConfirmation,\n showFacetFilter,\n showPlots,\n showSearchBar,\n showSqlEditor,\n unitDescription,\n visibleColumns,\n hasCustomPlots,\n enabledExternalAnalysisPlatforms,\n hideSearchBarControl,\n lockTextMatchesQueryFilterPill,\n ],\n )\n /**\n * Render the children without any formatting\n */\n const { children } = props\n return (\n <QueryVisualizationContextProvider queryVisualizationContext={context}>\n {children}\n </QueryVisualizationContextProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAM,IAAiE,CAAC;AAkDxE,SAAgB,EACd,GACA;CACA,IAAM,EACJ,8BAA2B,EAAyB,aACpD,0BAAuB,IACvB,sBAAmB,IACnB,0BAAsB,IACtB,0BAAuB,IACvB,oCAAiC,IACjC,qBAAkB,UAClB,sBACA,oBAAiB,IACjB,wBAAqB,UACrB,sCAAmC,MACjC,GAEE,IAAgB,QACd,EAAM,iBAAiB,CAAC,GAC9B,CAAC,EAAM,aAAa,CACtB,GAEM,EACJ,2BACA,2BACA,yBACA,2BACE,EAAgB,GACd,EAAE,MAAM,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,MAAO,EAAI,aAAa,CAC1B;IACA,IAAI,GACF,OAAO,EAAc;GAEzB;EACF;EACA,OAAO,EAAY,CAAU;CAC/B,GACA,CAAC,GAAe,GAAe,YAAY,CAC7C,GAEM,IAAc,GACjB,GAAoB,MAA0C;EAC7D,IAAI,MAAM,QAAQ,CAAiB,GAKjC,OAJmB,EAAkB,MACnC,MACE,EAAO,eAAe,KAAc,EAAO,aAAa,CAErD,GAAY;CAGvB,GACA,CAAC,CAAiB,CACpB,GAEM,IAAuB,QAEzB,kBAAC,GAAD;EACE,MAAM;EACgB;CACvB,CAAA,GAEH,CAAC,GAA0B,CAAoB,CACjD,GAEM,KAAyC,SACtC;EACL,sBAAsB;EACtB,yBAAyB;EACzB,UAAU,EAAM;EACC;EACjB,mBAAmB,EAAM;EACzB;EACA;EACA;EACA,sBAAA;EAEE;EAEA;EACF,iBAAiB,IAAyB,IAAkB;EAC5D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,KAAkB,IAAyB,IAAY;EAClE;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA,EAAM;EACN,EAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF,GAIM,EAAE,iBAAa;CACrB,OACE,kBAAC,IAAD;EAAmC,2BAA2B;EAC3D;CACgC,CAAA;AAEvC"}
|
|
1
|
+
{"version":3,"file":"QueryVisualizationWrapper.js","names":[],"sources":["../../../src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx"],"sourcesContent":["import { getDisplayValue } from '@/utils/functions/getDataFromFromStorage'\nimport { unCamelCase } from '@/utils/functions/unCamelCase'\nimport useMutuallyExclusiveState from '@/utils/hooks/useMutuallyExclusiveState'\nimport { useQuery } from '@tanstack/react-query'\nimport { ReactNode, useCallback, useEffect, useMemo, useState } from 'react'\nimport { useDeepCompareMemoize } from 'use-deep-compare-effect'\nimport { useQueryContext } from '../QueryContext'\nimport { useGetQueryMetadata } from '../QueryWrapper/useGetQueryMetadata'\nimport { NoContentPlaceholderType } from '../SynapseTable/NoContentPlaceholderType'\nimport { ExternalAnalysisPlatform } from '../SynapseTable/export/ExternalAnalysisPlatformsConstants'\nimport NoContentPlaceholderComponent from './NoContentPlaceholder'\nimport {\n QueryVisualizationContextProvider,\n QueryVisualizationContextType,\n} from './QueryVisualizationContext'\n\n// By default, show no external analysis platforms.\nconst DEFAULT_ENABLED_ANALYSIS_PLATFORMS: ExternalAnalysisPlatform[] = []\n\ntype ColumnOrFacetHelpConfig = {\n /** Text that describes the column or facet */\n helpText: string\n /** The name of the column for which the markdown applies */\n columnName: string\n /** The JSON path matching a described JSON Column facet */\n jsonPath?: string\n}\n\nexport type QueryVisualizationWrapperProps = {\n children: ReactNode | ReactNode[]\n rgbIndex?: number\n /** The singular word to use to describe a what a row represents (e.g. \"file\"). Defaults to \"result\" */\n unitDescription?: string\n /** Mapping from column name to the name that should be shown for the column */\n columnAliases?: Record<string, string>\n visibleColumnCount?: number\n hiddenColumns?: string[]\n defaultShowPlots?: boolean\n hideCopyToClipboard?: boolean\n hideSearchBarControl?: boolean\n /** When true, the text matches filter pill is shown but cannot be removed. Defaults to true. */\n lockTextMatchesQueryFilterPill?: boolean\n defaultShowSearchBar?: boolean\n showLastUpdatedOn?: boolean\n /** Default is INTERACTIVE */\n noContentPlaceholderType?: NoContentPlaceholderType\n isRowSelectionVisible?: boolean\n /** The set of columns that defines a uniqueness constraint on the table for the purposes of filtering based on row selection.\n * Note that Synapse tables have no internal concept of a primary key.\n */\n rowSelectionPrimaryKey?: string[]\n /** Look for additional filters using the given key. If not provided, the entity ID will be used.\n * @deprecated - configure the filter before passing a query */\n additionalFiltersSessionStorageKey?: string\n /** Configuration to add a help popover to each corresponding column header */\n helpConfiguration?: ColumnOrFacetHelpConfig[]\n hasCustomPlots?: boolean\n /** The set of external analysis platform to which the UI will support exporting data.\n * @default [] (no platforms are enabled) */\n enabledExternalAnalysisPlatforms?: ExternalAnalysisPlatform[]\n hideVisualizationsControl?: boolean\n}\n\n/**\n * QueryVisualizationWrapper manages UI state for components that query tables in Synapse. That state can be accessed\n * or updated using QueryVisualizationContext. A QueryVisualizationWrapper must be used within a QueryWrapper.\n */\nexport function QueryVisualizationWrapper(\n props: QueryVisualizationWrapperProps,\n) {\n const {\n noContentPlaceholderType = NoContentPlaceholderType.INTERACTIVE,\n defaultShowSearchBar = false,\n defaultShowPlots = true,\n hideCopyToClipboard = false,\n hideSearchBarControl = false,\n lockTextMatchesQueryFilterPill = true,\n unitDescription = 'result',\n helpConfiguration,\n hasCustomPlots = false,\n visibleColumnCount = Infinity,\n enabledExternalAnalysisPlatforms = DEFAULT_ENABLED_ANALYSIS_PLATFORMS,\n } = props\n\n const columnAliases = useMemo(\n () => props.columnAliases ?? {},\n [props.columnAliases],\n )\n\n const {\n getCurrentQueryRequest,\n hasFacetedSelectColumn,\n hasResettableFilters,\n rowDataQueryOptions,\n } = useQueryContext()\n const { data: queryMetadata } = useGetQueryMetadata()\n\n // Get the selectColumns from either query so that creating the context isn't bottlenecked by one or the other\n // Use the previous result as placeholder data so we don't reset the selectColumns unless they have actually changed.\n const { data: selectColumnsFromRowData } = useQuery({\n ...rowDataQueryOptions,\n select: data => data.responseBody?.queryResult?.queryResults.headers,\n placeholderData: prevData => prevData,\n })\n const { data: selectColumnsFromMetadata } = useGetQueryMetadata({\n select: data => data.responseBody?.selectColumns,\n placeholderData: prevData => prevData,\n })\n // We deep-compare-memoize the selectColumns so we don't reset visible columns if the reference changes, but not the contents (e.g. on page change)\n const selectColumns = useDeepCompareMemoize(\n selectColumnsFromRowData ?? selectColumnsFromMetadata ?? [],\n )\n\n const [showSqlEditor, setShowSqlEditor] = useState(false)\n const [showPlots, setShowPlots] = useState(defaultShowPlots)\n const [showCopyToClipboard, setShowCopyToClipboard] =\n useState(!hideCopyToClipboard)\n const [showFacetFilter, setShowFacetFilter] = useState(true)\n\n // The search bar and download confirmation should not be shown at the same time.\n const [\n showSearchBar,\n setShowSearchBar,\n showDownloadConfirmation,\n setShowDownloadConfirmation,\n ] = useMutuallyExclusiveState(\n defaultShowSearchBar && !hideSearchBarControl,\n false,\n )\n\n const [\n isShowingExportToAnalysisPlatformModal,\n setIsShowingExportToAnalysisPlatformModal,\n ] = useState<boolean>(false)\n\n const [visibleColumns, setVisibleColumns] = useState<string[]>([])\n\n const lastQueryRequest = useMemo(\n () => getCurrentQueryRequest(),\n [getCurrentQueryRequest],\n )\n\n // Deep-compare-memoize so callers passing a fresh array literal\n // (e.g. `hiddenColumns={['topic']}`) don't reset visible columns on every\n // parent render.\n const hiddenColumns = useDeepCompareMemoize(props.hiddenColumns ?? [])\n useEffect(() => {\n // SWC-6030: If sql changes, reset what columns are visible\n const hidden = new Set(hiddenColumns)\n setVisibleColumns(\n selectColumns\n .filter(el => !hidden.has(el.name))\n .slice(0, visibleColumnCount)\n .map(el => el.name),\n )\n }, [\n selectColumns,\n lastQueryRequest.query.sql,\n visibleColumnCount,\n hiddenColumns,\n ])\n\n const getColumnDisplayName = useCallback(\n (columnName: string, jsonPath?: string) => {\n // SWC-5982: if force-display-original-column-names is set, then just return the string\n const forceDisplayOriginalColumnName =\n typeof localStorage !== 'undefined' &&\n localStorage.getItem('force-display-original-column-names') === 'true'\n\n if (!columnName || (forceDisplayOriginalColumnName && !jsonPath)) {\n return columnName\n }\n if (columnAliases[columnName]) {\n return columnAliases[columnName]\n }\n if (jsonPath) {\n const columnModel = queryMetadata?.columnModels?.find(\n cm => cm.name === columnName,\n )\n if (columnModel?.jsonSubColumns) {\n const jsonSubColumn = columnModel.jsonSubColumns.find(\n jsc => jsc.jsonPath === jsonPath,\n )\n if (jsonSubColumn) {\n return jsonSubColumn.name\n }\n }\n }\n return unCamelCase(columnName)\n },\n [columnAliases, queryMetadata?.columnModels],\n )\n\n const getHelpText = useCallback(\n (columnName: string, jsonPath?: string): string | undefined => {\n if (Array.isArray(helpConfiguration)) {\n const helpConfig = helpConfiguration.find(\n config =>\n config.columnName === columnName && config.jsonPath === jsonPath,\n )\n return helpConfig?.helpText\n }\n return undefined\n },\n [helpConfiguration],\n )\n\n const NoContentPlaceholder = useCallback(\n () => (\n <NoContentPlaceholderComponent\n type={noContentPlaceholderType}\n hasResettableFilters={hasResettableFilters}\n />\n ),\n [noContentPlaceholderType, hasResettableFilters],\n )\n\n const context: QueryVisualizationContextType = useMemo(\n () => ({\n columnsToShowInTable: visibleColumns,\n setColumnsToShowInTable: setVisibleColumns,\n rgbIndex: props.rgbIndex,\n unitDescription: unitDescription,\n showLastUpdatedOn: props.showLastUpdatedOn,\n getColumnDisplayName,\n getDisplayValue,\n getHelpText,\n NoContentPlaceholder,\n isShowingExportToAnalysisPlatformModal:\n isShowingExportToAnalysisPlatformModal,\n setIsShowingExportToAnalysisPlatformModal:\n setIsShowingExportToAnalysisPlatformModal,\n showFacetFilter: hasFacetedSelectColumn ? showFacetFilter : false,\n setShowFacetFilter,\n hideSearchBarControl,\n lockTextMatchesQueryFilterPill,\n showSearchBar,\n setShowSearchBar,\n showDownloadConfirmation,\n setShowDownloadConfirmation,\n showSqlEditor,\n setShowSqlEditor,\n showPlots: hasCustomPlots || hasFacetedSelectColumn ? showPlots : false,\n setShowPlots,\n showCopyToClipboard,\n setShowCopyToClipboard,\n enabledExternalAnalysisPlatforms,\n }),\n [\n NoContentPlaceholder,\n getColumnDisplayName,\n getHelpText,\n hasFacetedSelectColumn,\n isShowingExportToAnalysisPlatformModal,\n props.rgbIndex,\n props.showLastUpdatedOn,\n setShowDownloadConfirmation,\n setShowSearchBar,\n showCopyToClipboard,\n showDownloadConfirmation,\n showFacetFilter,\n showPlots,\n showSearchBar,\n showSqlEditor,\n unitDescription,\n visibleColumns,\n hasCustomPlots,\n enabledExternalAnalysisPlatforms,\n hideSearchBarControl,\n lockTextMatchesQueryFilterPill,\n ],\n )\n /**\n * Render the children without any formatting\n */\n const { children } = props\n return (\n <QueryVisualizationContextProvider queryVisualizationContext={context}>\n {children}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AAa;CACrB,OACE,kBAAC,IAAD;EAAmC,2BAA2B;EAC3D;CACgC,CAAA;AAEvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowSetView.d.ts","sourceRoot":"","sources":["../../../src/components/QueryWrapperPlotNav/RowSetView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAWtE,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,CAAC,EAAE,yBAAyB,CAAA;IAC9C,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"RowSetView.d.ts","sourceRoot":"","sources":["../../../src/components/QueryWrapperPlotNav/RowSetView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAWtE,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,CAAC,EAAE,yBAAyB,CAAA;IAC9C,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA2EhD"}
|
|
@@ -24,18 +24,15 @@ function g(g) {
|
|
|
24
24
|
className: "RowSetView",
|
|
25
25
|
children: [
|
|
26
26
|
D && /* @__PURE__ */ p(a, { progressMessage: E }),
|
|
27
|
-
!D && T && /* @__PURE__ */ m(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
multiCardList: b
|
|
37
|
-
})]
|
|
38
|
-
}),
|
|
27
|
+
!D && T && /* @__PURE__ */ m(f, { children: [w && /* @__PURE__ */ p(r, {
|
|
28
|
+
...w,
|
|
29
|
+
rowSet: T,
|
|
30
|
+
isLoadingNewPage: O
|
|
31
|
+
}), _ && /* @__PURE__ */ p(n, {
|
|
32
|
+
..._,
|
|
33
|
+
rowSet: T,
|
|
34
|
+
multiCardList: b
|
|
35
|
+
})] }),
|
|
39
36
|
/* @__PURE__ */ m(l, {
|
|
40
37
|
fallback: /* @__PURE__ */ p(f, {}),
|
|
41
38
|
children: [!C && /* @__PURE__ */ p(d, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowSetView.js","names":[],"sources":["../../../src/components/QueryWrapperPlotNav/RowSetView.tsx"],"sourcesContent":["import { Suspense, useState } from 'react'\nimport { CardContainer } from '../CardContainer/CardContainer'\nimport { SynapseTable, SynapseTableConfiguration } from '../SynapseTable'\nimport { CardConfiguration } from '../CardContainer/CardConfiguration'\nimport LastUpdatedOn from './LastUpdatedOn'\nimport { useDeepCompareMemoize } from 'use-deep-compare-effect'\nimport QueryWrapperLoadingScreen from '../QueryWrapper/QueryWrapperLoadingScreen'\nimport { SynapseErrorBoundary } from '../error'\nimport { useQueryContext } from '../QueryContext'\nimport { Box } from '@mui/material'\nimport { TablePagination } from '../SynapseTable/TablePagination'\nimport { ViewMoreQueryResultsButton } from '../QueryWrapper/ViewMoreQueryResultsButton'\nimport { useRowSet } from './UseRowSet'\n\nexport type RowSetViewProps = {\n tableConfiguration?: SynapseTableConfiguration\n cardConfiguration?: CardConfiguration\n initialLimit?: number\n hideDownload?: boolean\n multiCardList?: boolean\n}\n\n/**\n * Renders a table or cards representing the RowSet. Also displays appropriate pagination controls\n * depending on the value of QueryContext.isInfinite.\n * @param props\n * @constructor\n */\nexport function RowSetView(props: RowSetViewProps) {\n const { cardConfiguration, hideDownload, initialLimit, multiCardList } = props\n\n const [initialLimitIsApplied, setInitialLimitIsApplied] = useState(\n initialLimit != null,\n )\n\n const { isInfinite } = useQueryContext()\n const tableConfiguration = useDeepCompareMemoize(\n props.tableConfiguration\n ? {\n ...props.tableConfiguration,\n hideDownload,\n }\n : undefined,\n )\n\n const {\n rowSet,\n progressMessage,\n isLoading,\n isLoadingNewPage,\n fetchNextPageOfInfiniteData,\n hasNextPageOfInfiniteData,\n } = useRowSet(initialLimitIsApplied ? initialLimit : undefined)\n\n return (\n <SynapseErrorBoundary>\n <div className={`RowSetView`}>\n {isLoading && (\n <QueryWrapperLoadingScreen progressMessage={progressMessage} />\n )}\n {!isLoading
|
|
1
|
+
{"version":3,"file":"RowSetView.js","names":[],"sources":["../../../src/components/QueryWrapperPlotNav/RowSetView.tsx"],"sourcesContent":["import { Suspense, useState } from 'react'\nimport { CardContainer } from '../CardContainer/CardContainer'\nimport { SynapseTable, SynapseTableConfiguration } from '../SynapseTable'\nimport { CardConfiguration } from '../CardContainer/CardConfiguration'\nimport LastUpdatedOn from './LastUpdatedOn'\nimport { useDeepCompareMemoize } from 'use-deep-compare-effect'\nimport QueryWrapperLoadingScreen from '../QueryWrapper/QueryWrapperLoadingScreen'\nimport { SynapseErrorBoundary } from '../error'\nimport { useQueryContext } from '../QueryContext'\nimport { Box } from '@mui/material'\nimport { TablePagination } from '../SynapseTable/TablePagination'\nimport { ViewMoreQueryResultsButton } from '../QueryWrapper/ViewMoreQueryResultsButton'\nimport { useRowSet } from './UseRowSet'\n\nexport type RowSetViewProps = {\n tableConfiguration?: SynapseTableConfiguration\n cardConfiguration?: CardConfiguration\n initialLimit?: number\n hideDownload?: boolean\n multiCardList?: boolean\n}\n\n/**\n * Renders a table or cards representing the RowSet. Also displays appropriate pagination controls\n * depending on the value of QueryContext.isInfinite.\n * @param props\n * @constructor\n */\nexport function RowSetView(props: RowSetViewProps) {\n const { cardConfiguration, hideDownload, initialLimit, multiCardList } = props\n\n const [initialLimitIsApplied, setInitialLimitIsApplied] = useState(\n initialLimit != null,\n )\n\n const { isInfinite } = useQueryContext()\n const tableConfiguration = useDeepCompareMemoize(\n props.tableConfiguration\n ? {\n ...props.tableConfiguration,\n hideDownload,\n }\n : undefined,\n )\n\n const {\n rowSet,\n progressMessage,\n isLoading,\n isLoadingNewPage,\n fetchNextPageOfInfiniteData,\n hasNextPageOfInfiniteData,\n } = useRowSet(initialLimitIsApplied ? initialLimit : undefined)\n\n return (\n <SynapseErrorBoundary>\n <div className={`RowSetView`}>\n {isLoading && (\n <QueryWrapperLoadingScreen progressMessage={progressMessage} />\n )}\n {!isLoading && rowSet && (\n <>\n {tableConfiguration && (\n <SynapseTable\n {...tableConfiguration}\n rowSet={rowSet}\n isLoadingNewPage={isLoadingNewPage}\n />\n )}\n {cardConfiguration && (\n <CardContainer\n {...cardConfiguration}\n rowSet={rowSet}\n multiCardList={multiCardList}\n />\n )}\n </>\n )}\n <Suspense fallback={<></>}>\n {!isInfinite && (\n <Box sx={{ mt: 2, textAlign: 'right' }}>\n <TablePagination />\n </Box>\n )}\n {isInfinite && (\n <ViewMoreQueryResultsButton\n initialLimit={initialLimit}\n initialLimitIsApplied={initialLimitIsApplied}\n onRemoveInitialLimit={() => {\n setInitialLimitIsApplied(false)\n }}\n fetchNextPage={() => {\n void fetchNextPageOfInfiniteData()\n }}\n hasNextPage={hasNextPageOfInfiniteData}\n isFetchingNextPage={isLoadingNewPage}\n />\n )}\n </Suspense>\n <LastUpdatedOn />\n </div>\n </SynapseErrorBoundary>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,SAAgB,EAAW,GAAwB;CACjD,IAAM,EAAE,sBAAmB,iBAAc,iBAAc,qBAAkB,GAEnE,CAAC,GAAuB,KAA4B,EACxD,KAAgB,IAClB,GAEM,EAAE,kBAAe,EAAgB,GACjC,IAAqB,EACzB,EAAM,qBACF;EACE,GAAG,EAAM;EACT;CACF,IACA,KAAA,CACN,GAEM,EACJ,WACA,oBACA,cACA,qBACA,gCACA,iCACE,EAAU,IAAwB,IAAe,KAAA,CAAS;CAE9D,OACE,kBAAC,GAAD,EAAA,UACE,kBAAC,OAAD;EAAK,WAAW;YAAhB;GACG,KACC,kBAAC,GAAD,EAA4C,mBAAkB,CAAA;GAE/D,CAAC,KAAa,KACb,kBAAA,GAAA,EAAA,UAAA,CACG,KACC,kBAAC,GAAD;IACE,GAAI;IACI;IACU;GACnB,CAAA,GAEF,KACC,kBAAC,GAAD;IACE,GAAI;IACI;IACO;GAChB,CAAA,CAEH,EAAA,CAAA;GAEJ,kBAAC,GAAD;IAAU,UAAU,kBAAA,GAAA,CAAI,CAAA;cAAxB,CACG,CAAC,KACA,kBAAC,GAAD;KAAK,IAAI;MAAE,IAAI;MAAG,WAAW;KAAQ;eACnC,kBAAC,GAAD,CAAkB,CAAA;IACf,CAAA,GAEN,KACC,kBAAC,GAAD;KACgB;KACS;KACvB,4BAA4B;MAC1B,EAAyB,EAAK;KAChC;KACA,qBAAqB;MACnB,EAAiC;KACnC;KACA,aAAa;KACb,oBAAoB;IACrB,CAAA,CAEK;;GACV,kBAAC,GAAD,CAAgB,CAAA;EACb;IACe,CAAA;AAE1B"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type RssState = {
|
|
3
|
-
rssFeed: any;
|
|
4
|
-
isLoadingError: boolean;
|
|
5
|
-
isShowingSubscribeUI: boolean;
|
|
6
|
-
allItemsUrl?: string;
|
|
7
|
-
};
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
8
2
|
export type RssFilter = {
|
|
9
3
|
type?: 'tag' | 'category';
|
|
10
4
|
value: string;
|
|
@@ -18,13 +12,11 @@ export type RssFeedCardsProps = {
|
|
|
18
12
|
mailChimpUrl?: string;
|
|
19
13
|
viewAllNewsButtonText?: string;
|
|
20
14
|
};
|
|
21
|
-
export declare
|
|
22
|
-
_isMounted: boolean;
|
|
23
|
-
constructor(props: RssFeedCardsProps);
|
|
24
|
-
componentDidMount(): void;
|
|
25
|
-
componentWillUnmount(): void;
|
|
26
|
-
onClickSubscribe: () => void;
|
|
27
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
}
|
|
15
|
+
export declare function RssFeedCards(props: RssFeedCardsProps): import("react/jsx-runtime").JSX.Element;
|
|
29
16
|
export default RssFeedCards;
|
|
17
|
+
/**
|
|
18
|
+
* Prefetches the RSS feed into a QueryClient for use with HydrationBoundary.
|
|
19
|
+
* Uses the same query key as the RssFeedCards component.
|
|
20
|
+
*/
|
|
21
|
+
export declare function prefetchRssFeed(queryClient: QueryClient, url: string, filter?: RssFilter): Promise<void>;
|
|
30
22
|
//# sourceMappingURL=RssFeedCards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RssFeedCards.d.ts","sourceRoot":"","sources":["../../../src/components/RssFeedCards/RssFeedCards.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RssFeedCards.d.ts","sourceRoot":"","sources":["../../../src/components/RssFeedCards/RssFeedCards.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAA0B,MAAM,uBAAuB,CAAA;AAK3E,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAA;AAuBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA6IpD;AAED,eAAe,YAAY,CAAA;AAE3B;;;GAGG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -1,135 +1,126 @@
|
|
|
1
1
|
import e from "../../assets/icons/NoData.js";
|
|
2
2
|
import { LargeButton as t } from "../styled/LargeButton.js";
|
|
3
3
|
import { ForwardRef as n } from "../../assets/icons/subscribe_plus.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useState as r } from "react";
|
|
5
5
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
-
import s from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import { queryOptions as s, useQuery as c } from "@tanstack/react-query";
|
|
7
|
+
import l from "dayjs";
|
|
8
|
+
import u from "react-mailchimp-subscribe";
|
|
9
|
+
import d from "rss-parser";
|
|
9
10
|
//#region src/components/RssFeedCards/RssFeedCards.tsx
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
isShowingSubscribeUI: !1
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
componentDidMount() {
|
|
20
|
-
this._isMounted = !0;
|
|
21
|
-
let { url: e, filter: t } = this.props, n = t?.value, r = t?.type, i = `${e}${n ? `/${r ?? "tag"}/${n.replace(" ", "-")}` : ""}`, a = `${i}/?feed=rss2`;
|
|
22
|
-
fetch(a).then((e) => e.text()).then((e) => u.parseString(e)).then((e) => {
|
|
23
|
-
this._isMounted && this.setState({
|
|
24
|
-
rssFeed: e,
|
|
25
|
-
allItemsUrl: i
|
|
26
|
-
});
|
|
27
|
-
}).catch((e) => {
|
|
28
|
-
this._isMounted && this.setState({ isLoadingError: !0 });
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
componentWillUnmount() {
|
|
32
|
-
this._isMounted = !1;
|
|
33
|
-
}
|
|
34
|
-
onClickSubscribe = () => {
|
|
35
|
-
this.setState({ isShowingSubscribeUI: !0 });
|
|
11
|
+
var f = new d();
|
|
12
|
+
function p(e, t) {
|
|
13
|
+
let n = t?.value, r = t?.type, i = `${e}${n ? `/${r ?? "tag"}/${n.replace(" ", "-")}` : ""}`;
|
|
14
|
+
return {
|
|
15
|
+
allItemsUrl: i,
|
|
16
|
+
feedUrl: `${i}/?feed=rss2`
|
|
36
17
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/* @__PURE__ */ a("div", {
|
|
64
|
-
className: "SRC-marginBottomTop",
|
|
65
|
-
children: /* @__PURE__ */ a(c, { url: this.props.mailChimpUrl })
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})]
|
|
69
|
-
}), /* @__PURE__ */ o("div", {
|
|
70
|
-
className: "Feed",
|
|
18
|
+
}
|
|
19
|
+
function m(e) {
|
|
20
|
+
return s({
|
|
21
|
+
queryKey: ["rssFeed", e],
|
|
22
|
+
queryFn: () => fetch(e).then((e) => e.text()).then((e) => f.parseString(e))
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function h(s) {
|
|
26
|
+
let { url: d, filter: f, itemsToShow: h, allowCategories: g, mailChimpListName: _, mailChimpUrl: v, viewAllNewsButtonText: y } = s, { allItemsUrl: b, feedUrl: x } = p(d, f), { data: S, isError: C } = c(m(x)), [w, T] = r(!1);
|
|
27
|
+
return S?.items?.length === 0 ? /* @__PURE__ */ o("div", {
|
|
28
|
+
className: "text-center SRCBorderedPanel SRCBorderedPanel--padded2x",
|
|
29
|
+
children: [e, /* @__PURE__ */ a("div", {
|
|
30
|
+
style: {
|
|
31
|
+
marginTop: "20px",
|
|
32
|
+
fontStyle: "italic"
|
|
33
|
+
},
|
|
34
|
+
children: "There are no items currently available"
|
|
35
|
+
})]
|
|
36
|
+
}) : /* @__PURE__ */ o(i, { children: [v && /* @__PURE__ */ o("div", {
|
|
37
|
+
className: "FeedSubscribe",
|
|
38
|
+
children: [!w && /* @__PURE__ */ o("a", {
|
|
39
|
+
className: "FeedSubscribeToNewsLink SRC-no-border-bottom-imp",
|
|
40
|
+
onClick: () => T(!0),
|
|
41
|
+
children: [/* @__PURE__ */ a(n, { title: "Subscribe to News" }), "Subscribe to News"]
|
|
42
|
+
}), w && /* @__PURE__ */ o("div", {
|
|
43
|
+
className: "MailchimpSubscribeContainer",
|
|
71
44
|
children: [
|
|
45
|
+
/* @__PURE__ */ a(n, { title: "Subscribe to News" }),
|
|
46
|
+
/* @__PURE__ */ o("p", { children: [
|
|
47
|
+
"Subscribe to receive the ",
|
|
48
|
+
_,
|
|
49
|
+
" by e-mail, which provides information and updates related to the Portal. You can opt out at any time by using the unsubscribe link within the e-mail. We will not share your information with any third parties or use it for any other purposes."
|
|
50
|
+
] }),
|
|
72
51
|
/* @__PURE__ */ a("div", {
|
|
73
|
-
className: "
|
|
74
|
-
children:
|
|
75
|
-
|
|
76
|
-
className: "FeedItem",
|
|
77
|
-
children: /* @__PURE__ */ o("div", { children: [
|
|
78
|
-
this.props.allowCategories && this.props.allowCategories.length > 0 && /* @__PURE__ */ a("div", {
|
|
79
|
-
className: "FeedItemCategories",
|
|
80
|
-
children: e.categories.map((t) => {
|
|
81
|
-
let n = t.toLowerCase();
|
|
82
|
-
return this.props.allowCategories?.findIndex((e) => n === e.toLowerCase()) === -1 ? /* @__PURE__ */ a(i, {}) : /* @__PURE__ */ a("a", {
|
|
83
|
-
href: `${this.state.rssFeed.link}/tag/${t.replace(" ", "-")}`,
|
|
84
|
-
className: "SRC-no-border-bottom-imp",
|
|
85
|
-
target: "_blank",
|
|
86
|
-
rel: "noopener noreferrer",
|
|
87
|
-
children: /* @__PURE__ */ a("div", {
|
|
88
|
-
className: "FeedItemCategory",
|
|
89
|
-
children: t
|
|
90
|
-
})
|
|
91
|
-
}, `${e.guid}_${t}`);
|
|
92
|
-
})
|
|
93
|
-
}),
|
|
94
|
-
/* @__PURE__ */ a("p", {
|
|
95
|
-
className: "FeedItemDate",
|
|
96
|
-
children: s(e.isoDate).format("MMMM YYYY")
|
|
97
|
-
}),
|
|
98
|
-
/* @__PURE__ */ a("p", {
|
|
99
|
-
className: "FeedItemTitle",
|
|
100
|
-
children: e.title
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ a("div", {
|
|
103
|
-
className: "FeedItemDescription",
|
|
104
|
-
children: e.contentSnippet.replace(/\[...\]|\[…\]/gm, "…")
|
|
105
|
-
}),
|
|
106
|
-
/* @__PURE__ */ a("a", {
|
|
107
|
-
className: "FeedItemLink",
|
|
108
|
-
href: e.link,
|
|
109
|
-
target: "_blank",
|
|
110
|
-
rel: "noopener noreferrer",
|
|
111
|
-
children: "Continue reading"
|
|
112
|
-
})
|
|
113
|
-
] })
|
|
114
|
-
}, e.guid);
|
|
115
|
-
})
|
|
116
|
-
}),
|
|
117
|
-
this.state.rssFeed.items && this.state.rssFeed.items.length > this.props.itemsToShow && this.state.allItemsUrl && /* @__PURE__ */ a("div", {
|
|
118
|
-
className: "FeedViewAllNewsButtonContainer",
|
|
119
|
-
children: /* @__PURE__ */ a(t, {
|
|
120
|
-
color: "secondary",
|
|
121
|
-
variant: "contained",
|
|
122
|
-
onClick: () => window.open(this.state.allItemsUrl, "_blank", "noopener"),
|
|
123
|
-
target: "_blank",
|
|
124
|
-
children: r ?? "View All News"
|
|
125
|
-
})
|
|
126
|
-
}),
|
|
127
|
-
this.state.isLoadingError && /* @__PURE__ */ o("div", { children: ["Unable to load feed: ", this.props.url] })
|
|
52
|
+
className: "SRC-marginBottomTop",
|
|
53
|
+
children: /* @__PURE__ */ a(u, { url: v })
|
|
54
|
+
})
|
|
128
55
|
]
|
|
129
|
-
})]
|
|
130
|
-
}
|
|
131
|
-
|
|
56
|
+
})]
|
|
57
|
+
}), /* @__PURE__ */ o("div", {
|
|
58
|
+
className: "Feed",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ a("div", {
|
|
61
|
+
className: "FeedItems",
|
|
62
|
+
children: S?.items && S.items.map((e, t) => {
|
|
63
|
+
if (!(t >= h)) return /* @__PURE__ */ a("div", {
|
|
64
|
+
className: "FeedItem",
|
|
65
|
+
children: /* @__PURE__ */ o("div", { children: [
|
|
66
|
+
g && g.length > 0 && /* @__PURE__ */ a("div", {
|
|
67
|
+
className: "FeedItemCategories",
|
|
68
|
+
children: e.categories?.map((t) => {
|
|
69
|
+
let n = t.toLowerCase();
|
|
70
|
+
return g?.findIndex((e) => n === e.toLowerCase()) === -1 ? null : /* @__PURE__ */ a("a", {
|
|
71
|
+
href: `${S.link}/tag/${t.replace(" ", "-")}`,
|
|
72
|
+
className: "SRC-no-border-bottom-imp",
|
|
73
|
+
target: "_blank",
|
|
74
|
+
rel: "noopener noreferrer",
|
|
75
|
+
children: /* @__PURE__ */ a("div", {
|
|
76
|
+
className: "FeedItemCategory",
|
|
77
|
+
children: t
|
|
78
|
+
})
|
|
79
|
+
}, `${e.guid}_${t}`);
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ a("p", {
|
|
83
|
+
className: "FeedItemDate",
|
|
84
|
+
children: l(e.isoDate).format("MMMM YYYY")
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ a("p", {
|
|
87
|
+
className: "FeedItemTitle",
|
|
88
|
+
children: e.title
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ a("div", {
|
|
91
|
+
className: "FeedItemDescription",
|
|
92
|
+
children: e.contentSnippet?.replace(/\[...\]|\[…\]/gm, "…")
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ a("a", {
|
|
95
|
+
className: "FeedItemLink",
|
|
96
|
+
href: e.link,
|
|
97
|
+
target: "_blank",
|
|
98
|
+
rel: "noopener noreferrer",
|
|
99
|
+
children: "Continue reading"
|
|
100
|
+
})
|
|
101
|
+
] })
|
|
102
|
+
}, e.guid);
|
|
103
|
+
})
|
|
104
|
+
}),
|
|
105
|
+
S?.items && S.items.length > h && b && /* @__PURE__ */ a("div", {
|
|
106
|
+
className: "FeedViewAllNewsButtonContainer",
|
|
107
|
+
children: /* @__PURE__ */ a(t, {
|
|
108
|
+
color: "secondary",
|
|
109
|
+
variant: "contained",
|
|
110
|
+
onClick: () => window.open(b, "_blank", "noopener"),
|
|
111
|
+
target: "_blank",
|
|
112
|
+
children: y ?? "View All News"
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
C && /* @__PURE__ */ o("div", { children: ["Unable to load feed: ", d] })
|
|
116
|
+
]
|
|
117
|
+
})] });
|
|
118
|
+
}
|
|
119
|
+
async function g(e, t, n) {
|
|
120
|
+
let { feedUrl: r } = p(t, n);
|
|
121
|
+
await e.prefetchQuery(m(r));
|
|
122
|
+
}
|
|
132
123
|
//#endregion
|
|
133
|
-
export {
|
|
124
|
+
export { h as RssFeedCards, h as default, g as prefetchRssFeed };
|
|
134
125
|
|
|
135
126
|
//# sourceMappingURL=RssFeedCards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RssFeedCards.js","names":[],"sources":["../../../src/components/RssFeedCards/RssFeedCards.tsx"],"sourcesContent":["import NoData from '@/assets/icons/NoData'\nimport { ReactComponent as SubscribePlus } from '@/assets/icons/subscribe_plus.svg'\nimport LargeButton from '@/components/styled/LargeButton'\nimport dayjs from 'dayjs'\nimport { Component } from 'react'\nimport MailchimpSubscribe from 'react-mailchimp-subscribe'\nimport Parser from 'rss-parser'\n\nconst rssParser = new Parser()\ntype RssState = {\n rssFeed: any\n isLoadingError: boolean\n isShowingSubscribeUI: boolean\n allItemsUrl?: string\n}\n\nexport type RssFilter = {\n type?: 'tag' | 'category'\n value: string\n}\n\nexport type RssFeedCardsProps = {\n url: string\n filter?: RssFilter // optional tag or category to use as a filter\n itemsToShow: number\n allowCategories?: string[]\n mailChimpListName?: string\n mailChimpUrl?: string\n viewAllNewsButtonText?: string\n}\nexport class RssFeedCards extends Component<RssFeedCardsProps, RssState> {\n // only update the state if this component is mounted\n _isMounted = false\n\n constructor(props: RssFeedCardsProps) {\n super(props)\n this.state = {\n rssFeed: {},\n isLoadingError: false,\n isShowingSubscribeUI: false,\n }\n }\n\n componentDidMount() {\n this._isMounted = true\n const { url, filter } = this.props\n const filterValue = filter?.value\n const filterType = filter?.type\n const tagPath = filterValue\n ? `/${filterType ?? 'tag'}/${filterValue.replace(' ', '-')}`\n : ''\n const allItems = `${url}${tagPath}`\n const feedUrl = `${allItems}/?feed=rss2`\n fetch(feedUrl)\n .then(response => response.text())\n .then(responseData => rssParser.parseString(responseData))\n .then(rss => {\n if (this._isMounted) {\n this.setState({ rssFeed: rss, allItemsUrl: allItems })\n }\n })\n .catch(err => {\n if (this._isMounted) {\n this.setState({ isLoadingError: true })\n }\n })\n }\n\n componentWillUnmount() {\n this._isMounted = false\n }\n\n public onClickSubscribe = () => {\n this.setState({ isShowingSubscribeUI: true })\n }\n\n render() {\n const { viewAllNewsButtonText } = this.props\n\n if (this.state.rssFeed.items?.length === 0) {\n return (\n <div className=\"text-center SRCBorderedPanel SRCBorderedPanel--padded2x\">\n {NoData}\n <div style={{ marginTop: '20px', fontStyle: 'italic' }}>\n There are no items currently available\n </div>\n </div>\n )\n }\n return (\n <>\n {this.props.mailChimpUrl && (\n <div className=\"FeedSubscribe\">\n {!this.state.isShowingSubscribeUI && (\n <a\n className=\"FeedSubscribeToNewsLink SRC-no-border-bottom-imp\"\n onClick={this.onClickSubscribe}\n >\n <SubscribePlus title=\"Subscribe to News\" />\n Subscribe to News\n </a>\n )}\n {this.state.isShowingSubscribeUI && (\n <div className=\"MailchimpSubscribeContainer\">\n <SubscribePlus title=\"Subscribe to News\" />\n <p>\n Subscribe to receive the {this.props.mailChimpListName} by\n e-mail, which provides information and updates related to the\n Portal. You can opt out at any time by using the unsubscribe\n link within the e-mail. We will not share your information\n with any third parties or use it for any other purposes.\n </p>\n <div className=\"SRC-marginBottomTop\">\n <MailchimpSubscribe url={this.props.mailChimpUrl} />\n </div>\n </div>\n )}\n </div>\n )}\n <div className=\"Feed\">\n <div className=\"FeedItems\">\n {this.state.rssFeed.items &&\n this.state.rssFeed.items.map((item: any, index: any) => {\n // The other is to hide the large number of items in a particular feed (usually a max of 10 are returned). See state.isShowingMoreItems\n if (index >= this.props.itemsToShow) {\n return\n }\n\n return (\n <div key={item.guid} className={`FeedItem`}>\n <div>\n {this.props.allowCategories &&\n this.props.allowCategories.length > 0 && (\n <div className=\"FeedItemCategories\">\n {item['categories'].map((categoryName: string) => {\n // are we allowed to show this category/tag?\n const categoryNameLowerCase =\n categoryName.toLowerCase()\n const allowCategories = this.props.allowCategories\n if (\n allowCategories?.findIndex(\n item =>\n categoryNameLowerCase ===\n item.toLowerCase(),\n ) === -1\n )\n return <></>\n // else\n return (\n <a\n href={`${\n this.state.rssFeed.link\n }/tag/${categoryName.replace(' ', '-')}`}\n className=\"SRC-no-border-bottom-imp\"\n key={`${item.guid}_${categoryName}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <div className=\"FeedItemCategory\">\n {categoryName}\n </div>\n </a>\n )\n })}\n </div>\n )}\n <p className=\"FeedItemDate\">\n {dayjs(item['isoDate']).format('MMMM YYYY')}\n </p>\n <p className=\"FeedItemTitle\">{item['title']}</p>\n <div className=\"FeedItemDescription\">\n {item['contentSnippet'].replace(/\\[...\\]|\\[…\\]/gm, '…')}\n </div>\n <a\n className=\"FeedItemLink\"\n href={item['link']}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Continue reading\n </a>\n </div>\n </div>\n )\n })}\n </div>\n {this.state.rssFeed.items &&\n this.state.rssFeed.items.length > this.props.itemsToShow &&\n this.state.allItemsUrl && (\n <div className=\"FeedViewAllNewsButtonContainer\">\n <LargeButton\n color=\"secondary\"\n variant=\"contained\"\n onClick={() =>\n window.open(this.state.allItemsUrl, '_blank', 'noopener')\n }\n // @ts-expect-error - target prop exists, but TS doesn't recognize on styled component\n target=\"_blank\"\n >\n {viewAllNewsButtonText ?? 'View All News'}\n </LargeButton>\n </div>\n )}\n {this.state.isLoadingError && (\n <div>Unable to load feed: {this.props.url}</div>\n )}\n </div>\n </>\n )\n }\n}\n\nexport default RssFeedCards\n"],"mappings":";;;;;;;;;AAQA,IAAM,IAAY,IAAI,EAAO,GAsBhB,IAAb,cAAkC,EAAuC;CAEvE,aAAa;CAEb,YAAY,GAA0B;EAEpC,AADA,MAAM,CAAK,GACX,KAAK,QAAQ;GACX,SAAS,CAAC;GACV,gBAAgB;GAChB,sBAAsB;EACxB;CACF;CAEA,oBAAoB;EAClB,KAAK,aAAa;EAClB,IAAM,EAAE,QAAK,cAAW,KAAK,OACvB,IAAc,GAAQ,OACtB,IAAa,GAAQ,MAIrB,IAAW,GAAG,IAHJ,IACZ,IAAI,KAAc,MAAM,GAAG,EAAY,QAAQ,KAAK,GAAG,MACvD,MAEE,IAAU,GAAG,EAAS;EAC5B,MAAM,CAAO,EACV,MAAK,MAAY,EAAS,KAAK,CAAC,EAChC,MAAK,MAAgB,EAAU,YAAY,CAAY,CAAC,EACxD,MAAK,MAAO;GACX,AAAI,KAAK,cACP,KAAK,SAAS;IAAE,SAAS;IAAK,aAAa;GAAS,CAAC;EAEzD,CAAC,EACA,OAAM,MAAO;GACZ,AAAI,KAAK,cACP,KAAK,SAAS,EAAE,gBAAgB,GAAK,CAAC;EAE1C,CAAC;CACL;CAEA,uBAAuB;E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iBAEhB,WACf,MACE,MACA,EAAK,YAAY,CACrB,MAAM,KAEC,kBAAA,GAAA,CAAI,CAAA,IAGX,kBAAC,KAAD;WACE,MAAM,GACJ,KAAK,MAAM,QAAQ,KACpB,OAAO,EAAa,QAAQ,KAAK,GAAG;WACrC,WAAU;WAEV,QAAO;WACP,KAAI;qBAEJ,kBAAC,OAAD;YAAK,WAAU;sBACZ;WACE,CAAA;UACJ,GAPI,GAAG,EAAK,KAAK,GAAG,GAOpB;SAEP,CAAC;QACE,CAAA;QAET,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAM,EAAK,OAAU,EAAE,OAAO,WAAW;QACzC,CAAA;QACH,kBAAC,KAAD;SAAG,WAAU;mBAAiB,EAAK;QAAY,CAAA;QAC/C,kBAAC,OAAD;SAAK,WAAU;mBACZ,EAAK,eAAkB,QAAQ,mBAAmB,GAAG;QACnD,CAAA;QACL,kBAAC,KAAD;SACE,WAAU;SACV,MAAM,EAAK;SACX,QAAO;SACP,KAAI;mBACL;QAEE,CAAA;OACA,EAAA,CAAA;MACF,GArDK,EAAK,IAqDV;KAET,CAAC;IACA,CAAA;IACJ,KAAK,MAAM,QAAQ,SAClB,KAAK,MAAM,QAAQ,MAAM,SAAS,KAAK,MAAM,eAC7C,KAAK,MAAM,eACT,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,OAAM;MACN,SAAQ;MACR,eACE,OAAO,KAAK,KAAK,MAAM,aAAa,UAAU,UAAU;MAG1D,QAAO;gBAEN,KAAyB;KACf,CAAA;IACV,CAAA;IAER,KAAK,MAAM,kBACV,kBAAC,OAAD,EAAA,UAAA,CAAK,yBAAsB,KAAK,MAAM,GAAS,EAAA,CAAA;GAE9C;IACL,EAAA,CAAA;CAEN;AACF"}
|
|
1
|
+
{"version":3,"file":"RssFeedCards.js","names":[],"sources":["../../../src/components/RssFeedCards/RssFeedCards.tsx"],"sourcesContent":["import NoData from '@/assets/icons/NoData'\nimport { ReactComponent as SubscribePlus } from '@/assets/icons/subscribe_plus.svg'\nimport LargeButton from '@/components/styled/LargeButton'\nimport dayjs from 'dayjs'\nimport MailchimpSubscribe from 'react-mailchimp-subscribe'\nimport Parser from 'rss-parser'\nimport { QueryClient, queryOptions, useQuery } from '@tanstack/react-query'\nimport { useState } from 'react'\n\nconst rssParser = new Parser()\n\nexport type RssFilter = {\n type?: 'tag' | 'category'\n value: string\n}\n\nexport type RssFeedCardsProps = {\n url: string\n filter?: RssFilter // optional tag or category to use as a filter\n itemsToShow: number\n allowCategories?: string[]\n mailChimpListName?: string\n mailChimpUrl?: string\n viewAllNewsButtonText?: string\n}\n\nfunction buildRssFeedUrl(url: string, filter?: RssFilter) {\n const filterValue = filter?.value\n const filterType = filter?.type\n const tagPath = filterValue\n ? `/${filterType ?? 'tag'}/${filterValue.replace(' ', '-')}`\n : ''\n const allItemsUrl = `${url}${tagPath}`\n const feedUrl = `${allItemsUrl}/?feed=rss2`\n return { allItemsUrl, feedUrl }\n}\n\nfunction getRssFeedQueryOptions(feedUrl: string) {\n return queryOptions({\n queryKey: ['rssFeed', feedUrl],\n queryFn: () =>\n fetch(feedUrl)\n .then(response => response.text())\n .then(responseData => rssParser.parseString(responseData)),\n })\n}\n\nexport function RssFeedCards(props: RssFeedCardsProps) {\n const {\n url,\n filter,\n itemsToShow,\n allowCategories,\n mailChimpListName,\n mailChimpUrl,\n viewAllNewsButtonText,\n } = props\n\n const { allItemsUrl, feedUrl } = buildRssFeedUrl(url, filter)\n\n const { data: rssFeed, isError } = useQuery(getRssFeedQueryOptions(feedUrl))\n\n const [isShowingSubscribeUI, setIsShowingSubscribeUI] = useState(false)\n\n if (rssFeed?.items?.length === 0) {\n return (\n <div className=\"text-center SRCBorderedPanel SRCBorderedPanel--padded2x\">\n {NoData}\n <div style={{ marginTop: '20px', fontStyle: 'italic' }}>\n There are no items currently available\n </div>\n </div>\n )\n }\n return (\n <>\n {mailChimpUrl && (\n <div className=\"FeedSubscribe\">\n {!isShowingSubscribeUI && (\n <a\n className=\"FeedSubscribeToNewsLink SRC-no-border-bottom-imp\"\n onClick={() => setIsShowingSubscribeUI(true)}\n >\n <SubscribePlus title=\"Subscribe to News\" />\n Subscribe to News\n </a>\n )}\n {isShowingSubscribeUI && (\n <div className=\"MailchimpSubscribeContainer\">\n <SubscribePlus title=\"Subscribe to News\" />\n <p>\n Subscribe to receive the {mailChimpListName} by e-mail, which\n provides information and updates related to the Portal. You can\n opt out at any time by using the unsubscribe link within the\n e-mail. We will not share your information with any third\n parties or use it for any other purposes.\n </p>\n <div className=\"SRC-marginBottomTop\">\n <MailchimpSubscribe url={mailChimpUrl} />\n </div>\n </div>\n )}\n </div>\n )}\n <div className=\"Feed\">\n <div className=\"FeedItems\">\n {rssFeed?.items &&\n rssFeed.items.map((item, index) => {\n // The other is to hide the large number of items in a particular feed (usually a max of 10 are returned). See state.isShowingMoreItems\n if (index >= itemsToShow) {\n return\n }\n\n return (\n <div key={item.guid} className={`FeedItem`}>\n <div>\n {allowCategories && allowCategories.length > 0 && (\n <div className=\"FeedItemCategories\">\n {item.categories?.map((categoryName: string) => {\n // are we allowed to show this category/tag?\n const categoryNameLowerCase =\n categoryName.toLowerCase()\n if (\n allowCategories?.findIndex(\n item =>\n categoryNameLowerCase === item.toLowerCase(),\n ) === -1\n )\n return null\n // else\n return (\n <a\n href={`${rssFeed.link}/tag/${categoryName.replace(\n ' ',\n '-',\n )}`}\n className=\"SRC-no-border-bottom-imp\"\n key={`${item.guid}_${categoryName}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <div className=\"FeedItemCategory\">\n {categoryName}\n </div>\n </a>\n )\n })}\n </div>\n )}\n <p className=\"FeedItemDate\">\n {dayjs(item.isoDate).format('MMMM YYYY')}\n </p>\n <p className=\"FeedItemTitle\">{item.title}</p>\n <div className=\"FeedItemDescription\">\n {item.contentSnippet?.replace(/\\[...\\]|\\[…\\]/gm, '…')}\n </div>\n <a\n className=\"FeedItemLink\"\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Continue reading\n </a>\n </div>\n </div>\n )\n })}\n </div>\n {rssFeed?.items &&\n rssFeed.items.length > itemsToShow &&\n allItemsUrl && (\n <div className=\"FeedViewAllNewsButtonContainer\">\n <LargeButton\n color=\"secondary\"\n variant=\"contained\"\n onClick={() => window.open(allItemsUrl, '_blank', 'noopener')}\n // @ts-expect-error - target prop exists, but TS doesn't recognize on styled component\n target=\"_blank\"\n >\n {viewAllNewsButtonText ?? 'View All News'}\n </LargeButton>\n </div>\n )}\n {isError && <div>Unable to load feed: {url}</div>}\n </div>\n </>\n )\n}\n\nexport default RssFeedCards\n\n/**\n * Prefetches the RSS feed into a QueryClient for use with HydrationBoundary.\n * Uses the same query key as the RssFeedCards component.\n */\nexport async function prefetchRssFeed(\n queryClient: QueryClient,\n url: string,\n filter?: RssFilter,\n): Promise<void> {\n const { feedUrl } = buildRssFeedUrl(url, filter)\n await queryClient.prefetchQuery(getRssFeedQueryOptions(feedUrl))\n}\n"],"mappings":";;;;;;;;;;AASA,IAAM,IAAY,IAAI,EAAO;AAiB7B,SAAS,EAAgB,GAAa,GAAoB;CACxD,IAAM,IAAc,GAAQ,OACtB,IAAa,GAAQ,MAIrB,IAAc,GAAG,IAHP,IACZ,IAAI,KAAc,MAAM,GAAG,EAAY,QAAQ,KAAK,GAAG,MACvD;CAGJ,OAAO;EAAE;EAAa,SAAA,GADH,EAAY;CACD;AAChC;AAEA,SAAS,EAAuB,GAAiB;CAC/C,OAAO,EAAa;EAClB,UAAU,CAAC,WAAW,CAAO;EAC7B,eACE,MAAM,CAAO,EACV,MAAK,MAAY,EAAS,KAAK,CAAC,EAChC,MAAK,MAAgB,EAAU,YAAY,CAAY,CAAC;CAC/D,CAAC;AACH;AAEA,SAAgB,EAAa,GAA0B;CACrD,IAAM,EACJ,QACA,WACA,gBACA,oBACA,sBACA,iBACA,6BACE,GAEE,EAAE,gBAAa,eAAY,EAAgB,GAAK,CAAM,GAEtD,EAAE,MAAM,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ACZ;UACE,CAAA;SACJ,GAPI,GAAG,EAAK,KAAK,GAAG,GAOpB;QAEP,CAAC;OACE,CAAA;OAEP,kBAAC,KAAD;QAAG,WAAU;kBACV,EAAM,EAAK,OAAO,EAAE,OAAO,WAAW;OACtC,CAAA;OACH,kBAAC,KAAD;QAAG,WAAU;kBAAiB,EAAK;OAAS,CAAA;OAC5C,kBAAC,OAAD;QAAK,WAAU;kBACZ,EAAK,gBAAgB,QAAQ,mBAAmB,GAAG;OACjD,CAAA;OACL,kBAAC,KAAD;QACE,WAAU;QACV,MAAM,EAAK;QACX,QAAO;QACP,KAAI;kBACL;OAEE,CAAA;MACA,EAAA,CAAA;KACF,GAnDK,EAAK,IAmDV;IAET,CAAC;GACA,CAAA;GACJ,GAAS,SACR,EAAQ,MAAM,SAAS,KACvB,KACE,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,GAAD;KACE,OAAM;KACN,SAAQ;KACR,eAAe,OAAO,KAAK,GAAa,UAAU,UAAU;KAE5D,QAAO;eAEN,KAAyB;IACf,CAAA;GACV,CAAA;GAER,KAAW,kBAAC,OAAD,EAAA,UAAA,CAAK,yBAAsB,CAAS,EAAA,CAAA;EAC7C;GACL,EAAA,CAAA;AAEN;AAQA,eAAsB,EACpB,GACA,GACA,GACe;CACf,IAAM,EAAE,eAAY,EAAgB,GAAK,CAAM;CAC/C,MAAM,EAAY,cAAc,EAAuB,CAAO,CAAC;AACjE"}
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
import { UserCardSize } from '@/utils/SynapseConstants';
|
|
2
|
-
import { RowSet
|
|
3
|
-
import { Component } from 'react';
|
|
2
|
+
import { RowSet } from '@sage-bionetworks/synapse-types';
|
|
4
3
|
export type UserCardListProps = {
|
|
5
4
|
list: (string | null)[];
|
|
6
5
|
size?: UserCardSize;
|
|
7
6
|
rowSet?: RowSet;
|
|
8
7
|
};
|
|
9
|
-
export
|
|
10
|
-
userProfileMap: Record<string, UserProfile>;
|
|
11
|
-
};
|
|
12
|
-
export declare class UserCardList extends Component<UserCardListProps, UserCardListState> {
|
|
13
|
-
constructor(props: UserCardListProps);
|
|
14
|
-
componentDidMount(): void;
|
|
15
|
-
componentDidUpdate(prevProps: UserCardListProps): void;
|
|
16
|
-
update(list: (string | null)[]): void;
|
|
17
|
-
/**
|
|
18
|
-
* Given data this will find rows where there is no userId columnType and create faux user profiles
|
|
19
|
-
* using firstName, lastName, and institution (company in UserProfile object).
|
|
20
|
-
* @param {RowSet} rowSet
|
|
21
|
-
* @returns list of UserProfiles with firstName, lastName, company, userName (first letter of firstName) filled out.
|
|
22
|
-
* @memberof UserCardList
|
|
23
|
-
*/
|
|
24
|
-
manuallyExtractData(rowSet: RowSet): Omit<UserProfile, "ownerId">[];
|
|
25
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
}
|
|
8
|
+
export declare function UserCardList(props: UserCardListProps): import("react/jsx-runtime").JSX.Element;
|
|
27
9
|
export default UserCardList;
|
|
28
10
|
//# sourceMappingURL=UserCardList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserCardList.d.ts","sourceRoot":"","sources":["../../../src/components/UserCardList/UserCardList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserCardList.d.ts","sourceRoot":"","sources":["../../../src/components/UserCardList/UserCardList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoB,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,EAEL,MAAM,EAEP,MAAM,iCAAiC,CAAA;AAIxC,MAAM,MAAM,iBAAiB,GAAG;IAE9B,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAA;IACvB,IAAI,CAAC,EAAE,YAAY,CAAA;IAGnB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AA8BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAkEpD;AAED,eAAe,YAAY,CAAA"}
|